Skip to content

Commit d441e38

Browse files
committed
x86/irq_remapping: Sanitize posted_msi_supported()
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
1 parent 4021a6d commit d441e38

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

arch/x86/include/asm/irq_remapping.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ static inline struct irq_domain *arch_get_ir_parent_domain(void)
6767

6868
extern bool enable_posted_msi;
6969

70-
static inline bool posted_msi_supported(void)
70+
static inline bool posted_msi_enabled(void)
7171
{
72-
return enable_posted_msi && irq_remapping_cap(IRQ_POSTING_CAP);
72+
return IS_ENABLED(CONFIG_X86_POSTED_MSI) &&
73+
enable_posted_msi && irq_remapping_cap(IRQ_POSTING_CAP);
7374
}
7475

7576
#else /* CONFIG_IRQ_REMAP */

drivers/iommu/intel/irq_remapping.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ static void intel_irq_remapping_prepare_irte(struct intel_ir_data *data,
13681368
break;
13691369
case X86_IRQ_ALLOC_TYPE_PCI_MSI:
13701370
case X86_IRQ_ALLOC_TYPE_PCI_MSIX:
1371-
if (posted_msi_supported()) {
1371+
if (posted_msi_enabled()) {
13721372
prepare_irte_posted(irte);
13731373
data->irq_2_iommu.posted_msi = 1;
13741374
}
@@ -1460,7 +1460,7 @@ static int intel_irq_remapping_alloc(struct irq_domain *domain,
14601460

14611461
irq_data->hwirq = (index << 16) + i;
14621462
irq_data->chip_data = ird;
1463-
if (posted_msi_supported() &&
1463+
if (posted_msi_enabled() &&
14641464
((info->type == X86_IRQ_ALLOC_TYPE_PCI_MSI) ||
14651465
(info->type == X86_IRQ_ALLOC_TYPE_PCI_MSIX)))
14661466
irq_data->chip = &intel_ir_chip_post_msi;

0 commit comments

Comments
 (0)