Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446450

[PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe

From Eric Auger <eric.auger@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe
Date 2016-07-19 15:10 +0200
Message-ID <rWCWD-4qE-49@gated-at.bofh.it> (permalink)
References <rWCWB-4qE-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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    | 15 +++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/include/linux/msi-doorbell.h b/include/linux/msi-doorbell.h
index 146bfbc..9c30141 100644
--- a/include/linux/msi-doorbell.h
+++ b/include/linux/msi-doorbell.h
@@ -43,6 +43,13 @@ void msi_doorbell_unregister_global(struct irq_chip_msi_doorbell_info *db);
  */
 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 struct irq_chip_msi_doorbell_info *
@@ -61,6 +68,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 a5bde37..fa5b429 100644
--- a/kernel/irq/msi-doorbell.c
+++ b/kernel/irq/msi-doorbell.c
@@ -112,3 +112,18 @@ int msi_doorbell_pages(unsigned int order)
 	return ret;
 }
 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);
\ No newline at end of file
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v11 00/10] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 2/3: msi changes Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
  [PATCH v11 02/10] genirq/msi: msi_compose wrapper Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
  [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
    Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on  msi_domain_alloc/free_irqs Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 11:10 +0200
      Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on  msi_domain_alloc/free_irqs Auger Eric <eric.auger@redhat.com> - 2016-07-25 18:30 +0200
  [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
    Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when  requested Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 11:20 +0200
      Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when  requested Auger Eric <eric.auger@redhat.com> - 2016-07-25 18:40 +0200
  [PATCH v11 08/10] irqchip/gicv3-its: register the MSI global doorbell Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
  [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
    Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 10:20 +0200
      Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Auger Eric <eric.auger@redhat.com> - 2016-07-21 15:40 +0200
        Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Thomas Gleixner <tglx@linutronix.de> - 2016-07-22 14:50 +0200
          Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Auger Eric <eric.auger@redhat.com> - 2016-07-22 16:10 +0200
  [PATCH v11 01/10] genirq/msi: export msi_get_domain_info Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200

csiph-web