]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/irq_remapping: Sanitize posted_msi_supported()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 25 Nov 2025 21:50:49 +0000 (22:50 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 18 Dec 2025 21:59:40 +0000 (22:59 +0100)
posted_msi_supported() is a misnomer as it actually checks whether it is
enabled or not. Aside of that this does not take CONFIG_X86_POSTED_MSI into
account which is required to actually use it.

Rename it to posted_msi_enabled() and make the return value depend on
CONFIG_X86_POSTED_MSI, which allows the compiler to eliminate the related
dead code and data if disabled:

  text    data     bss     dec     hex filename
  10046     701    3296   14043    36db drivers/iommu/intel/irq_remapping.o
   9904     413    3296   13613    352d drivers/iommu/intel/irq_remapping.o

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/20251125214631.170499997@linutronix.de
arch/x86/include/asm/irq_remapping.h
drivers/iommu/intel/irq_remapping.c

index 4e55d17558465da86cb803e2421299a4e878fb5c..37b94f484ef3387117205defccbe1583a6e8f40e 100644 (file)
@@ -67,9 +67,10 @@ static inline struct irq_domain *arch_get_ir_parent_domain(void)
 
 extern bool enable_posted_msi;
 
-static inline bool posted_msi_supported(void)
+static inline bool posted_msi_enabled(void)
 {
-       return enable_posted_msi && irq_remapping_cap(IRQ_POSTING_CAP);
+       return IS_ENABLED(CONFIG_X86_POSTED_MSI) &&
+               enable_posted_msi && irq_remapping_cap(IRQ_POSTING_CAP);
 }
 
 #else  /* CONFIG_IRQ_REMAP */
index 8bcbfe3d9c72216188165037fef3fe79fcd0965e..ecb591e98565cf4741fc94bf828bcaa5838c3276 100644 (file)
@@ -1368,7 +1368,7 @@ static void intel_irq_remapping_prepare_irte(struct intel_ir_data *data,
                break;
        case X86_IRQ_ALLOC_TYPE_PCI_MSI:
        case X86_IRQ_ALLOC_TYPE_PCI_MSIX:
-               if (posted_msi_supported()) {
+               if (posted_msi_enabled()) {
                        prepare_irte_posted(irte);
                        data->irq_2_iommu.posted_msi = 1;
                }
@@ -1460,7 +1460,7 @@ static int intel_irq_remapping_alloc(struct irq_domain *domain,
 
                irq_data->hwirq = (index << 16) + i;
                irq_data->chip_data = ird;
-               if (posted_msi_supported() &&
+               if (posted_msi_enabled() &&
                    ((info->type == X86_IRQ_ALLOC_TYPE_PCI_MSI) ||
                     (info->type == X86_IRQ_ALLOC_TYPE_PCI_MSIX)))
                        irq_data->chip = &intel_ir_chip_post_msi;