History

genirq/msi: Add a new field in msi_desc to store an IOMMU cookie

When an MSI doorbell is located downstream of an IOMMU, it is required to swizzle the physical address with an appropriately-mapped IOVA for any device attached to one of our DMA ops domain. At the moment, the allocation of the mapping may be done when composing the message. However, the composing may be done in non-preemtible context while the allocation requires to be called from preemptible context. A follow-up change will split the current logic in two functions requiring to keep an IOMMU cookie per MSI. A new field is introduced in msi_desc to store an IOMMU cookie. As the cookie may not be required in some configuration, the field is protected under a new config CONFIG_IRQ_MSI_IOMMU. A pair of helpers has also been introduced to access the field.

Julien Grall committed 7 years ago

Commit aaebdf81 parent 009669e2 files · +29 −0Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/msi.h+26−0
@@ -86,6 +86,9 @@ struct msi_desc { · 85 unmodified lines
86 struct device *dev;86 struct device *dev;
87 struct msi_msg msg;87 struct msi_msg msg;
88 struct irq_affinity_desc *affinity;88 struct irq_affinity_desc *affinity;
89#ifdef CONFIG_IRQ_MSI_IOMMU
90 const void *iommu_cookie;
91#endif
89 92
90 union {93 union {
91 /* PCI MSI/X specific data */94 /* PCI MSI/X specific data */
@@ -129,6 +132,29 @@ struct msi_desc { · 37 unmodified lines
129#define for_each_msi_entry_safe(desc, tmp, dev) \132#define for_each_msi_entry_safe(desc, tmp, dev) \
130 list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list)133 list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list)
131 134
135#ifdef CONFIG_IRQ_MSI_IOMMU
136static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
137{
138 return desc->iommu_cookie;
139}
140
141static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
142 const void *iommu_cookie)
143{
144 desc->iommu_cookie = iommu_cookie;
145}
146#else
147static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
148{
149 return NULL;
150}
151
152static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
153 const void *iommu_cookie)
154{
155}
156#endif
157
132#ifdef CONFIG_PCI_MSI158#ifdef CONFIG_PCI_MSI
133#define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev)159#define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev)
134#define for_each_pci_msi_entry(desc, pdev) \160#define for_each_pci_msi_entry(desc, pdev) \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t