Re: [PATCH v2 11/13] iommu/vt-d: Make posted MSI an opt-in cmdline option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/9/2024 7:33 AM, Jacob Pan wrote:
Hi Robert,

On Sat, 6 Apr 2024 12:31:14 +0800, Robert Hoo <robert.hoo.linux@xxxxxxxxx>
wrote:

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.
I agree, posting should be treated as a sub-capability of remapping.
IRQ_POSTING_CAP is only set when remapping is on.

We need to delete this such that posting is always off when remapping is
off.

--- a/drivers/iommu/intel/irq_remapping.c
+++ b/drivers/iommu/intel/irq_remapping.c
@@ -1038,11 +1038,7 @@ static void disable_irq_remapping(void)
                 iommu_disable_irq_remapping(iommu);
         }
- /*
-        * Clear Posted-Interrupts capability.
-        */
-       if (!disable_irq_post)
-               intel_irq_remap_ops.capability &= ~(1 << IRQ_POSTING_CAP);
+       intel_irq_remap_ops.capability &= ~(1 << IRQ_POSTING_CAP);
  }

Right.





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux