Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1416351
| From | Eric Auger <eric.auger@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v10 5/9] genirq/msi-doorbell: msi_doorbell_safe |
| Date | 2016-06-07 18:10 +0200 |
| Message-ID | <rHrJL-4Rf-17@gated-at.bofh.it> (permalink) |
| References | <rHrJL-4Rf-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
msi_doorbell_safe returns whether all the registered doorbells
implement irq_remapping.
When assigning a PCIe device whose host controller is upstream to
an IOMMU, we currently do not know whether the MSI controller is
upstream or downstream to the IOMMU.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
include/linux/msi-doorbell.h | 12 ++++++++++++
kernel/irq/msi-doorbell.c | 14 ++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/include/linux/msi-doorbell.h b/include/linux/msi-doorbell.h
index abdaaa0..648f239 100644
--- a/include/linux/msi-doorbell.h
+++ b/include/linux/msi-doorbell.h
@@ -65,6 +65,13 @@ msi_doorbell_lookup(void *chip_data);
*/
int msi_doorbell_pages(unsigned int order);
+/**
+ * msi_doorbell_safe: return whether all registered doorbells
+ * do implement irq_remapping and are safe to assign (coarse safety
+ * assessment)
+ */
+bool msi_doorbell_safe(void);
+
#else
static inline int
@@ -88,6 +95,11 @@ msi_doorbell_pages(unsigned int order)
return 0;
}
+static inline bool
+msi_doorbell_safe(void)
+{
+ return true;
+}
#endif /* CONFIG_MSI_DOORBELL */
#endif
diff --git a/kernel/irq/msi-doorbell.c b/kernel/irq/msi-doorbell.c
index 65ca9292..69121c8 100644
--- a/kernel/irq/msi-doorbell.c
+++ b/kernel/irq/msi-doorbell.c
@@ -132,3 +132,17 @@ int msi_doorbell_pages(unsigned int order)
}
EXPORT_SYMBOL_GPL(msi_doorbell_pages);
+bool msi_doorbell_safe(void)
+{
+ struct irqchip_doorbell *db;
+ bool irq_remapping = true;
+
+ mutex_lock(&irqchip_doorbell_mutex);
+ list_for_each_entry(db, &irqchip_doorbell_list, next) {
+ irq_remapping &= db->info.irq_remapping;
+ }
+ mutex_unlock(&irqchip_doorbell_mutex);
+
+ return irq_remapping;
+}
+EXPORT_SYMBOL_GPL(msi_doorbell_safe);
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v10 0/9] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 2/3: msi changes Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 5/9] genirq/msi-doorbell: msi_doorbell_safe Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 3/9] genirq/msi-doorbell: creation Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 2/9] genirq/msi: msi_compose wrapper Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 1/9] genirq/msi: export msi_get_domain_info Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 7/9] irqchip/gicv3-its: register the MSI global doorbell Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 6/9] irqchip/gicv2m: register the MSI global doorbell Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 8/9] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 4/9] genirq/msi-doorbell: msi_doorbell_pages Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200 [PATCH v10 9/9] genirq/msi: use the MSI doorbell's IOVA when requested Eric Auger <eric.auger@redhat.com> - 2016-06-07 18:10 +0200
csiph-web