Lines Matching +full:device +full:- +full:specific
1 /* SPDX-License-Identifier: GPL-2.0 */
8 * - Interrupt core code
9 * - PCI/MSI core code
10 * - MSI interrupt domain implementations
11 * - IOMMU, low level VFIO, NTB and other justified exceptions
14 * Regular device drivers have no business with any of these functions and
18 * Device driver relevant functions are available in <linux/msi_api.h>
52 * msi_msg - Representation of a MSI message
54 * @arch_addrlo: Architecture specific shadow of @address_lo
56 * (only used when device supports it)
57 * @arch_addrhi: Architecture specific shadow of @address_hi
59 * @arch_data: Architecture specific shadow of @data
95 * pci_msi_desc - PCI/MSI specific MSI descriptor data
98 * @msix_ctrl: [PCI MSI-X] MSI-X cached per vector control bits
99 * @is_msix: [PCI MSI/X] True if MSI-X
104 * @default_irq:[PCI MSI/X] The default pre-assigned non-MSI irq
106 * @mask_base: [PCI MSI-X] Mask register base address
129 * union msi_domain_cookie - Opaque MSI domain specific data
131 * @ptr: Pointer to domain specific data
132 * @iobase: Domain specific IOmem pointer
135 * domain to store domain specific information which is requried for
145 * struct msi_desc_data - Generic MSI descriptor data
146 * @dcookie: Cookie for MSI domain specific data which is required
163 * struct msi_desc - Descriptor structure for MSI based interrupts
166 * @dev: Pointer to the device which uses this descriptor
169 * @sysfs_attr: Pointer to sysfs device attribute
176 * @pci: PCI specific msi descriptor data
180 /* Shared device/bus type independent data */
183 struct device *dev;
217 * struct msi_dev_domain - The internals of MSI domain info per device
219 * @irqdomain: Pointer to a per device interrupt domain
226 int msi_setup_device_data(struct device *dev);
228 void msi_lock_descs(struct device *dev);
229 void msi_unlock_descs(struct device *dev);
231 struct msi_desc *msi_domain_first_desc(struct device *dev, unsigned int domid,
235 * msi_first_desc - Get the first MSI descriptor of the default irqdomain
236 * @dev: Device to operate on
245 static inline struct msi_desc *msi_first_desc(struct device *dev, in msi_first_desc()
251 struct msi_desc *msi_next_desc(struct device *dev, unsigned int domid,
255 * msi_domain_for_each_desc - Iterate the MSI descriptors in a specific domain
258 * @dev: struct device pointer - device to iterate
263 * - The loop must be protected with a msi_lock_descs()/msi_unlock_descs()
265 * - It is safe to remove a retrieved MSI descriptor in the loop.
272 * msi_for_each_desc - Iterate the MSI descriptors in the default irqdomain
275 * @dev: struct device pointer - device to iterate
279 * - The loop must be protected with a msi_lock_descs()/msi_unlock_descs()
281 * - It is safe to remove a retrieved MSI descriptor in the loop.
286 #define msi_desc_to_dev(desc) ((desc)->dev)
291 return desc->iommu_cookie; in msi_desc_get_iommu_cookie()
297 desc->iommu_cookie = iommu_cookie; in msi_desc_set_iommu_cookie()
311 int msi_domain_insert_msi_desc(struct device *dev, unsigned int domid,
314 * msi_insert_msi_desc - Allocate and initialize a MSI descriptor in the
315 * default irqdomain and insert it at @init_desc->msi_index
316 * @dev: Pointer to the device for which the descriptor is allocated
321 static inline int msi_insert_msi_desc(struct device *dev, struct msi_desc *init_desc) in msi_insert_msi_desc()
326 void msi_domain_free_msi_descs_range(struct device *dev, unsigned int domid,
330 * msi_free_msi_descs_range - Free a range of MSI descriptors of a device
333 * @dev: Device for which to free the descriptors
337 static inline void msi_free_msi_descs_range(struct device *dev, unsigned int first, in msi_free_msi_descs_range()
344 * msi_free_msi_descs - Free all MSI descriptors of a device in the default irqdomain
345 * @dev: Device to free the descriptors
347 static inline void msi_free_msi_descs(struct device *dev) in msi_free_msi_descs()
354 * as weak symbols so that they /can/ be overriden by architecture specific
368 * Xen uses non-default msi_domain_ops and hence needs a way to populate sysfs
373 int msi_device_populate_sysfs(struct device *dev);
374 void msi_device_destroy_sysfs(struct device *dev);
376 static inline int msi_device_populate_sysfs(struct device *dev) { return 0; } in msi_device_populate_sysfs()
377 static inline void msi_device_destroy_sysfs(struct device *dev) { } in msi_device_destroy_sysfs()
400 * struct msi_domain_ops - MSI interrupt domain callbacks
402 * @msi_init: Domain specific init function for MSI interrupts
403 * @msi_free: Domain specific function to free a MSI interrupts
441 struct device *dev, int nvec,
448 struct device *dev, int nvec);
450 struct device *dev);
452 struct device *dev);
458 * struct msi_domain_info - MSI interrupt domain data
471 * @data: Optional: domain specific data
487 * struct msi_domain_template - Template for MSI device domains
503 * Bit 0-15: Generic MSI functionality which is not subject to restriction
506 * Bit 16-31: Functionality which depends on the underlying parent domain and
508 * a device MSI domain is initialized.
534 /* Use dev->fwnode for MSI device domain creation */
536 /* Set parent->dev into domain->pm_dev on device domain creation */
544 /* Mask for the domain specific functionality */
551 /* Is level-triggered capable, using two messages */
553 /* MSI-X entries must be contiguous */
555 /* PCI/MSI-X vectors can be dynamically allocated/freed post MSI-X enable */
562 * struct msi_parent_ops - MSI parent domain callbacks and configuration info
572 * domain specific domain flags, domain ops and interrupt chip
573 * callbacks when a per device domain is created.
581 bool (*init_dev_msi_info)(struct device *dev, struct irq_domain *domain,
586 bool msi_parent_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
597 bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
601 void msi_remove_device_irq_domain(struct device *dev, unsigned int domid);
603 bool msi_match_device_irq_domain(struct device *dev, unsigned int domid,
606 int msi_domain_alloc_irqs_range_locked(struct device *dev, unsigned int domid,
608 int msi_domain_alloc_irqs_range(struct device *dev, unsigned int domid,
610 int msi_domain_alloc_irqs_all_locked(struct device *dev, unsigned int domid, int nirqs);
612 struct msi_map msi_domain_alloc_irq_at(struct device *dev, unsigned int domid, unsigned int index,
616 void msi_domain_free_irqs_range_locked(struct device *dev, unsigned int domid,
618 void msi_domain_free_irqs_range(struct device *dev, unsigned int domid,
620 void msi_domain_free_irqs_all_locked(struct device *dev, unsigned int domid);
621 void msi_domain_free_irqs_all(struct device *dev, unsigned int domid);
625 /* Per device platform MSI */
626 int platform_device_msi_init_and_alloc_irqs(struct device *dev, unsigned int nvec,
628 void platform_device_msi_free_irqs_all(struct device *dev);
630 bool msi_device_has_isolated_msi(struct device *dev);
632 static inline int msi_domain_alloc_irqs(struct device *dev, unsigned int domid, int nirqs) in msi_domain_alloc_irqs()
634 return msi_domain_alloc_irqs_range(dev, domid, 0, nirqs - 1); in msi_domain_alloc_irqs()
638 static inline bool msi_device_has_isolated_msi(struct device *dev) in msi_device_has_isolated_msi()
650 /* PCI specific interfaces */