Lines Matching full:msi
14 #include <linux/msi.h>
25 * struct msi_device_data - MSI per device data
26 * @properties: MSI properties which are interesting to drivers
27 * @mutex: Mutex protecting the MSI descriptor store
28 * @__domains: Internal data for per device MSI domains
39 * struct msi_ctrl - MSI internal management control structure
44 * than the range due to PCI/multi-MSI.
103 struct msi_device_data *md = dev->msi.data; in msi_insert_desc()
139 * msi_domain_insert_msi_desc - Allocate and initialize a MSI descriptor and
144 * @init_desc: Pointer to an MSI descriptor to initialize the new descriptor
153 lockdep_assert_held(&dev->msi.data->mutex); in msi_domain_insert_msi_desc()
184 (dev->msi.domain && in msi_ctrl_valid()
185 !dev->msi.data->__domains[ctrl->domid].domain))) in msi_ctrl_valid()
202 lockdep_assert_held(&dev->msi.data->mutex); in msi_domain_free_descs()
207 xa = &dev->msi.data->__domains[ctrl->domid].store; in msi_domain_free_descs()
219 * msi_domain_free_msi_descs_range - Free a range of MSI descriptors of a device in an irqdomain
238 * msi_domain_add_simple_msi_descs - Allocate and initialize MSI descriptors
250 lockdep_assert_held(&dev->msi.data->mutex); in msi_domain_add_simple_msi_descs()
295 dev->msi.data = NULL; in msi_device_data_release()
299 * msi_setup_device_data - Setup MSI device data
300 * @dev: Device for which MSI device data should be set up
304 * This can be called more than once for @dev. If the MSI device data is
313 if (dev->msi.data) in msi_setup_device_data()
330 * If @dev::msi::domain is set and is a global MSI domain, copy the in msi_setup_device_data()
333 * architecture specific PCI/MSI support working. in msi_setup_device_data()
335 if (dev->msi.domain && !irq_domain_is_msi_parent(dev->msi.domain)) in msi_setup_device_data()
336 md->__domains[MSI_DEFAULT_DOMAIN].domain = dev->msi.domain; in msi_setup_device_data()
339 dev->msi.data = md; in msi_setup_device_data()
345 * msi_lock_descs - Lock the MSI descriptor storage of a device
350 mutex_lock(&dev->msi.data->mutex); in msi_lock_descs()
355 * msi_unlock_descs - Unlock the MSI descriptor storage of a device
361 dev->msi.data->__iter_idx = MSI_XA_MAX_INDEX; in msi_unlock_descs()
362 mutex_unlock(&dev->msi.data->mutex); in msi_unlock_descs()
381 * msi_domain_first_desc - Get the first MSI descriptor of an irqdomain associated to a device
386 * Must be called with the MSI descriptor mutex held, i.e. msi_lock_descs()
389 * Return: Pointer to the first MSI descriptor matching the search
395 struct msi_device_data *md = dev->msi.data; in msi_domain_first_desc()
408 * msi_next_desc - Get the next MSI descriptor of a device
416 * to be done within the same MSI mutex held region.
418 * Return: Pointer to the next MSI descriptor matching the search
424 struct msi_device_data *md = dev->msi.data; in msi_next_desc()
440 * msi_domain_get_virq - Lookup the Linux interrupt number for a MSI index on a interrupt domain
443 * @index: MSI interrupt index to look for (0-based)
454 if (!dev->msi.data) in msi_domain_get_virq()
460 /* This check is only valid for the PCI default MSI domain */ in msi_domain_get_virq()
465 xa = &dev->msi.data->__domains[domid].store; in msi_domain_get_virq()
469 * PCI-MSI has only one descriptor for multiple interrupts. in msi_domain_get_virq()
470 * PCI-MSIX and platform MSI use a descriptor per in msi_domain_get_virq()
504 /* MSI vs. MSIX is per device not per interrupt */ in msi_mode_show()
507 return sysfs_emit(buf, "%s\n", is_msix ? "msix" : "msi"); in msi_mode_show()
604 lockdep_assert_held(&dev->msi.data->mutex); in msi_get_device_domain()
609 domain = dev->msi.data->__domains[domid].domain; in msi_get_device_domain()
644 * If the MSI provider has messed with the second message and in msi_check_level()
653 * msi_domain_set_affinity - Generic affinity setter function for MSI domains
658 * Intended to be used by MSI interrupt controllers which are
752 * for MSI domains which really support this, e.g. MBIGEN. in msi_domain_translate()
874 * msi_create_irq_domain - Create an MSI interrupt domain
876 * @info: MSI domain info
889 * msi_parent_init_dev_msi_info - Delegate initialization of device MSI info down
895 * @msi_child_info: The MSI domain info of the IRQ_DOMAIN_FLAG_MSI_DEVICE
900 * This is the most complex problem of per device MSI domains and the
930 * msi_create_device_irq_domain - Create a device MSI interrupt domain
933 * @template: MSI domain info bundle used as template
934 * @hwsize: Maximum number of MSI table entries (0 if unknown or unlimited)
946 * The domain name and the irq chip name for a MSI device domain are
949 * $PREFIX: Optional prefix provided by the underlying MSI parent domain
958 * PCI-MSI-0000:00:1c.0 0-edge Parent domain has no prefix
959 * IR-PCI-MSI-0000:00:1c.4 0-edge Same with interrupt remapping prefix 'IR-'
962 * IR-PCI-MSIX-0000:3d:00.0 1-edge the real MSI-X index on that device
969 * The domain pointer is stored in @dev::msi::data::__irqdomains[]. All
973 * in the context of @dev::msi::data freeing, but it can also be
981 struct irq_domain *domain, *parent = dev->msi.domain; in msi_create_device_irq_domain()
1008 * Using the device firmware node is required for wire to MSI in msi_create_device_irq_domain()
1011 * All other device domains like PCI/MSI use the named firmware in msi_create_device_irq_domain()
1039 dev->msi.data->__domains[domid].domain = domain; in msi_create_device_irq_domain()
1053 * msi_remove_device_irq_domain - Free a device MSI interrupt domain
1070 dev->msi.data->__domains[domid].domain = NULL; in msi_remove_device_irq_domain()
1119 * dummy vector to the device. If the PCI/MSI device does not support
1125 * used. For now reservation mode is restricted to PCI/MSI.
1150 * Checking the first MSI descriptor is sufficient. MSIX supports in msi_check_reservation_mode()
1151 * masking and MSI does so when the can_mask attribute is set. in msi_check_reservation_mode()
1172 /* Let a failed PCI multi MSI allocation retry */ in msi_handle_pci_fail()
1225 struct xarray *xa = &dev->msi.data->__domains[ctrl->domid].store; in __msi_domain_alloc_irqs()
1240 * the MSI entries before the PCI layer enables MSI in the in __msi_domain_alloc_irqs()
1241 * card. Otherwise the card latches a random msi message. in __msi_domain_alloc_irqs()
1336 * msi_domain_alloc_irqs_range_locked - Allocate interrupts from a MSI interrupt domain
1344 * pair. Use this for MSI irqdomains which implement their own descriptor
1363 * msi_domain_alloc_irqs_range - Allocate interrupts from a MSI interrupt domain
1385 * msi_domain_alloc_irqs_all_locked - Allocate all interrupts from a MSI interrupt domain
1392 * This function scans all MSI descriptors of the MSI domain and allocates interrupts
1393 * for all unassigned ones. That function is to be used for MSI domain usage where
1394 * the descriptor allocation is handled at the call site, e.g. PCI/MSI[X].
1456 * msi_domain_alloc_irq_at - Allocate an interrupt from a MSI interrupt domain at
1467 * Must be NULL for MSI-X allocations
1469 * This requires a MSI interrupt domain which lets the core code manage the
1470 * MSI descriptors.
1498 * This weirdness supports wire to MSI controllers like MBIGEN.
1501 * irq_create_fwspec_mapping(). As the wire to MSI domain is sparse, but
1502 * sized in firmware, the hardware interrupt number cannot be used as MSI
1503 * index. For the underlying irq chip the MSI index is irrelevant and
1506 * To handle this the MSI index is allocated with MSI_ANY_INDEX and the
1539 struct xarray *xa = &dev->msi.data->__domains[ctrl->domid].store; in __msi_domain_free_irqs()
1547 /* Only handle MSI entries which have an interrupt associated */ in __msi_domain_free_irqs()
1594 * msi_domain_free_irqs_range_locked - Free a range of interrupts from a MSI interrupt domain
1614 * msi_domain_free_irqs_range - Free a range of interrupts from a MSI interrupt domain
1632 * msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain
1639 * pair. Use this for MSI irqdomains which implement their own vector
1649 * msi_domain_free_irqs_all - Free all interrupts from a MSI interrupt domain
1668 * weird wired to MSI converting domains.
1687 * msi_get_domain_info - Get the MSI interrupt domain info for @domain
1698 * msi_device_has_isolated_msi - True if the device has isolated MSI
1701 * Isolated MSI means that HW modeled by an irq_domain on the path from the
1702 * initiating device to the CPU will validate that the MSI message specifies an
1705 * Currently authorization means the MSI vector is one assigned to the device.
1707 * This is interesting for securing VFIO use cases where a rouge MSI (eg created