On 4/6/2024 6:31 AM, Jacob Pan wrote:
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@xxxxxxxxxxxxxxx>
---
Documentation/admin-guide/kernel-parameters.txt | 1 +
arch/x86/include/asm/irq_remapping.h | 11 +++++++++++
drivers/iommu/irq_remapping.c | 13 ++++++++++++-
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index bb884c14b2f6..e5fd02423c4c 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);
+}
Out of this patch set's scope, but, dropping into irq_remappping_cap(), I'd like
to bring this change for discussion:
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
index 4047ac396728..ef2de9034897 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
@@ -98,7 +98,7 @@ void set_irq_remapping_broken(void)
bool irq_remapping_cap(enum irq_remap_cap cap)
{
- if (!remap_ops || disable_irq_post)
+ if (!remap_ops || disable_irq_remap)
return false;
return (remap_ops->capability & (1 << cap));
1. irq_remapping_cap() is to exam some cap, though at present it has only 1 cap,
i.e. IRQ_POSTING_CAP, simply return false just because of disable_irq_post isn't
good. Instead, IRQ_REMAP is the foundation of all remapping caps.
2. disable_irq_post is used by Intel iommu code only, here irq_remapping_cap()
is common code. e.g. AMD iommu code doesn't use it to judge set cap of irq_post
or not.
+#else
+static inline bool posted_msi_supported(void) { return false; };
+#endif