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
8686 struct device *dev;
8787 struct msi_msg msg;
8888 struct irq_affinity_desc *affinity;
89+#ifdef CONFIG_IRQ_MSI_IOMMU
90+ const void *iommu_cookie;
91+#endif
8992
9093 union {
9194 /* PCI MSI/X specific data */
@@ -129,6 +132,29 @@ struct msi_desc { · 37 unmodified lines
129132 #define for_each_msi_entry_safe(desc, tmp, dev) \
130133 list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list)
131134
135+#ifdef CONFIG_IRQ_MSI_IOMMU
136+static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
137+{
138+ return desc->iommu_cookie;
139+}
140+
141+static 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
147+static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
148+{
149+ return NULL;
150+}
151+
152+static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
153+ const void *iommu_cookie)
154+{
155+}
156+#endif
157+
132158 #ifdef CONFIG_PCI_MSI
133159 #define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev)
134160 #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