[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240423174114.526704-12-jacob.jun.pan@linux.intel.com>
Date: Tue, 23 Apr 2024 10:41:13 -0700
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: LKML <linux-kernel@...r.kernel.org>,
X86 Kernel <x86@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
iommu@...ts.linux.dev,
Thomas Gleixner <tglx@...utronix.de>,
"Lu Baolu" <baolu.lu@...ux.intel.com>,
kvm@...r.kernel.org,
Dave Hansen <dave.hansen@...el.com>,
Joerg Roedel <joro@...tes.org>,
"H. Peter Anvin" <hpa@...or.com>,
"Borislav Petkov" <bp@...en8.de>,
"Ingo Molnar" <mingo@...hat.com>
Cc: Paul Luse <paul.e.luse@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Jens Axboe <axboe@...nel.dk>,
Raj Ashok <ashok.raj@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
maz@...nel.org,
seanjc@...gle.com,
"Robin Murphy" <robin.murphy@....com>,
jim.harris@...sung.com,
a.manzanares@...sung.com,
"Bjorn Helgaas" <helgaas@...nel.org>,
guang.zeng@...el.com,
robert.hoo.linux@...il.com,
oliver.sang@...el.com,
acme@...nel.org,
Jacob Pan <jacob.jun.pan@...ux.intel.com>
Subject: [PATCH v3 11/12] iommu/vt-d: Make posted MSI an opt-in cmdline option
Add a command line opt-in option for posted MSI if CONFIG_X86_POSTED_MSI=y.
Also introduce a helper function for testing if posted MSI is supported on
the platform.
Signed-off-by: Jacob Pan <jacob.jun.pan@...ux.intel.com>
---
v3: Delete unnecessary checks for disable_irq_post || disable_irq_remap.
(Kevin)
---
Documentation/admin-guide/kernel-parameters.txt | 1 +
arch/x86/include/asm/irq_remapping.h | 11 +++++++++++
drivers/iommu/irq_remapping.c | 9 ++++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 902ecd92a29f..6de1459bc312 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2251,6 +2251,7 @@
no_x2apic_optout
BIOS x2APIC opt-out request will be ignored
nopost disable Interrupt Posting
+ posted_msi enable MSIs delivered as posted interrupts
iomem= Disable strict checking of access to MMIO memory
strict regions from userspace.
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 7a2ed154a5e1..e46bde61029b 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -50,6 +50,17 @@ static inline struct irq_domain *arch_get_ir_parent_domain(void)
return x86_vector_domain;
}
+#ifdef CONFIG_X86_POSTED_MSI
+extern int enable_posted_msi;
+
+static inline bool posted_msi_supported(void)
+{
+ return enable_posted_msi && irq_remapping_cap(IRQ_POSTING_CAP);
+}
+#else
+static inline bool posted_msi_supported(void) { return false; };
+#endif
+
#else /* CONFIG_IRQ_REMAP */
static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; }
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
index ee59647c2050..eec3547dbf80 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
@@ -24,6 +24,10 @@ int no_x2apic_optout;
int disable_irq_post = 0;
+#ifdef CONFIG_X86_POSTED_MSI
+int enable_posted_msi;
+#endif
+
static int disable_irq_remap;
static struct irq_remap_ops *remap_ops;
@@ -70,7 +74,10 @@ static __init int setup_irqremap(char *str)
no_x2apic_optout = 1;
else if (!strncmp(str, "nopost", 6))
disable_irq_post = 1;
-
+#ifdef CONFIG_X86_POSTED_MSI
+ else if (!strncmp(str, "posted_msi", 10))
+ enable_posted_msi = 1;
+#endif
str += strcspn(str, ",");
while (*str == ',')
str++;
--
2.25.1
Powered by blists - more mailing lists