Lines Matching full:msi

14 #include <linux/msi.h>
26 * struct msi_device_data - MSI per device data
27 * @properties: MSI properties which are interesting to drivers
28 * @mutex: Mutex protecting the MSI descriptor store
29 * @__domains: Internal data for per device MSI domains
40 * struct msi_ctrl - MSI internal management control structure
45 * than the range due to PCI/multi-MSI.
104 struct msi_device_data *md = dev->msi.data; in msi_insert_desc()
140 * msi_domain_insert_msi_desc - Allocate and initialize a MSI descriptor and
145 * @init_desc: Pointer to an MSI descriptor to initialize the new descriptor
154 lockdep_assert_held(&dev->msi.data->mutex); in msi_domain_insert_msi_desc()
185 (dev->msi.domain && in msi_ctrl_valid()
186 !dev->msi.data->__domains[ctrl->domid].domain))) in msi_ctrl_valid()
203 lockdep_assert_held(&dev->msi.data->mutex); in msi_domain_free_descs()
208 xa = &dev->msi.data->__domains[ctrl->domid].store; in msi_domain_free_descs()
220 * msi_domain_free_msi_descs_range - Free a range of MSI descriptors of a device in an irqdomain
239 * msi_domain_add_simple_msi_descs - Allocate and initialize MSI descriptors
251 lockdep_assert_held(&dev->msi.data->mutex); in msi_domain_add_simple_msi_descs()
296 dev->msi.data = NULL; in msi_device_data_release()
300 * msi_setup_device_data - Setup MSI device data
301 * @dev: Device for which MSI device data should be set up
305 * This can be called more than once for @dev. If the MSI device data is
314 if (dev->msi.data) in msi_setup_device_data()
331 * If @dev::msi::domain is set and is a global MSI domain, copy the in msi_setup_device_data()
334 * architecture specific PCI/MSI support working. in msi_setup_device_data()
336 if (dev->msi.domain && !irq_domain_is_msi_parent(dev->msi.domain)) in msi_setup_device_data()
337 md->__domains[MSI_DEFAULT_DOMAIN].domain = dev->msi.domain; in msi_setup_device_data()
340 dev->msi.data = md; in msi_setup_device_data()
346 * msi_lock_descs - Lock the MSI descriptor storage of a device
351 mutex_lock(&dev->msi.data->mutex); in msi_lock_descs()
356 * msi_unlock_descs - Unlock the MSI descriptor storage of a device
362 dev->msi.data->__iter_idx = MSI_XA_MAX_INDEX; in msi_unlock_descs()
363 mutex_unlock(&dev->msi.data->mutex); in msi_unlock_descs()
382 * msi_domain_first_desc - Get the first MSI descriptor of an irqdomain associated to a device
387 * Must be called with the MSI descriptor mutex held, i.e. msi_lock_descs()
390 * Return: Pointer to the first MSI descriptor matching the search
396 struct msi_device_data *md = dev->msi.data; in msi_domain_first_desc()
409 * msi_next_desc - Get the next MSI descriptor of a device
417 * to be done within the same MSI mutex held region.
419 * Return: Pointer to the next MSI descriptor matching the search
425 struct msi_device_data *md = dev->msi.data; in msi_next_desc()
441 * msi_domain_get_virq - Lookup the Linux interrupt number for a MSI index on a interrupt domain
444 * @index: MSI interrupt index to look for (0-based)
455 if (!dev->msi.data) in msi_domain_get_virq()
461 /* This check is only valid for the PCI default MSI domain */ in msi_domain_get_virq()
466 xa = &dev->msi.data->__domains[domid].store; in msi_domain_get_virq()
470 * PCI-MSI has only one descriptor for multiple interrupts. in msi_domain_get_virq()
471 * PCI-MSIX and platform MSI use a descriptor per in msi_domain_get_virq()
505 /* MSI vs. MSIX is per device not per interrupt */ in msi_mode_show()
508 return sysfs_emit(buf, "%s\n", is_msix ? "msix" : "msi"); in msi_mode_show()
605 lockdep_assert_held(&dev->msi.data->mutex); in msi_get_device_domain()
610 domain = dev->msi.data->__domains[domid].domain; in msi_get_device_domain()
645 * If the MSI provider has messed with the second message and in msi_check_level()
654 * msi_domain_set_affinity - Generic affinity setter function for MSI domains
659 * Intended to be used by MSI interrupt controllers which are
753 * for MSI domains which really support this, e.g. MBIGEN. in msi_domain_translate()
893 * msi_create_irq_domain - Create an MSI interrupt domain
895 * @info: MSI domain info
908 * msi_parent_init_dev_msi_info - Delegate initialization of device MSI info down
914 * @msi_child_info: The MSI domain info of the IRQ_DOMAIN_FLAG_MSI_DEVICE
919 * This is the most complex problem of per device MSI domains and the
949 * msi_create_device_irq_domain - Create a device MSI interrupt domain
952 * @template: MSI domain info bundle used as template
953 * @hwsize: Maximum number of MSI table entries (0 if unknown or unlimited)
965 * The domain name and the irq chip name for a MSI device domain are
968 * $PREFIX: Optional prefix provided by the underlying MSI parent domain
977 * PCI-MSI-0000:00:1c.0 0-edge Parent domain has no prefix
978 * IR-PCI-MSI-0000:00:1c.4 0-edge Same with interrupt remapping prefix 'IR-'
981 * IR-PCI-MSIX-0000:3d:00.0 1-edge the real MSI-X index on that device
988 * The domain pointer is stored in @dev::msi::data::__irqdomains[]. All
992 * in the context of @dev::msi::data freeing, but it can also be
1000 struct irq_domain *domain, *parent = dev->msi.domain; in msi_create_device_irq_domain()
1027 * Using the device firmware node is required for wire to MSI in msi_create_device_irq_domain()
1030 * All other device domains like PCI/MSI use the named firmware in msi_create_device_irq_domain()
1058 dev->msi.data->__domains[domid].domain = domain; in msi_create_device_irq_domain()
1072 * msi_remove_device_irq_domain - Free a device MSI interrupt domain
1089 dev->msi.data->__domains[domid].domain = NULL; in msi_remove_device_irq_domain()
1138 * dummy vector to the device. If the PCI/MSI device does not support
1144 * used. For now reservation mode is restricted to PCI/MSI.
1169 * Checking the first MSI descriptor is sufficient. MSIX supports in msi_check_reservation_mode()
1170 * masking and MSI does so when the can_mask attribute is set. in msi_check_reservation_mode()
1191 /* Let a failed PCI multi MSI allocation retry */ in msi_handle_pci_fail()
1244 struct xarray *xa = &dev->msi.data->__domains[ctrl->domid].store; in __msi_domain_alloc_irqs()
1259 * the MSI entries before the PCI layer enables MSI in the in __msi_domain_alloc_irqs()
1260 * card. Otherwise the card latches a random msi message. in __msi_domain_alloc_irqs()
1355 * msi_domain_alloc_irqs_range_locked - Allocate interrupts from a MSI interrupt domain
1363 * pair. Use this for MSI irqdomains which implement their own descriptor
1382 * msi_domain_alloc_irqs_range - Allocate interrupts from a MSI interrupt domain
1404 * msi_domain_alloc_irqs_all_locked - Allocate all interrupts from a MSI interrupt domain
1411 * This function scans all MSI descriptors of the MSI domain and allocates interrupts
1412 * for all unassigned ones. That function is to be used for MSI domain usage where
1413 * the descriptor allocation is handled at the call site, e.g. PCI/MSI[X].
1475 * msi_domain_alloc_irq_at - Allocate an interrupt from a MSI interrupt domain at
1486 * Must be NULL for MSI-X allocations
1488 * This requires a MSI interrupt domain which lets the core code manage the
1489 * MSI descriptors.
1517 * This weirdness supports wire to MSI controllers like MBIGEN.
1520 * irq_create_fwspec_mapping(). As the wire to MSI domain is sparse, but
1521 * sized in firmware, the hardware interrupt number cannot be used as MSI
1522 * index. For the underlying irq chip the MSI index is irrelevant and
1525 * To handle this the MSI index is allocated with MSI_ANY_INDEX and the
1558 struct xarray *xa = &dev->msi.data->__domains[ctrl->domid].store; in __msi_domain_free_irqs()
1566 /* Only handle MSI entries which have an interrupt associated */ in __msi_domain_free_irqs()
1613 * msi_domain_free_irqs_range_locked - Free a range of interrupts from a MSI interrupt domain
1633 * msi_domain_free_irqs_range - Free a range of interrupts from a MSI interrupt domain
1651 * msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain
1658 * pair. Use this for MSI irqdomains which implement their own vector
1668 * msi_domain_free_irqs_all - Free all interrupts from a MSI interrupt domain
1687 * weird wired to MSI converting domains.
1706 * msi_get_domain_info - Get the MSI interrupt domain info for @domain
1717 * msi_device_has_isolated_msi - True if the device has isolated MSI
1720 * Isolated MSI means that HW modeled by an irq_domain on the path from the
1721 * initiating device to the CPU will validate that the MSI message specifies an
1724 * Currently authorization means the MSI vector is one assigned to the device.
1726 * This is interesting for securing VFIO use cases where a rouge MSI (eg created