From 5b3d94510cb755eac7555fd2065875576e823e40 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Tue, 16 Mar 2021 09:31:39 +0100 Subject: [PATCH] arch/x86: Implementing ARCH_PCIE_IRQ_CONNECT for ia32 and intel64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While this does not change anything for ia32, this is fixing the chicken & egg issue on intel64 if (and only if) interrupt remapping is enabled so pcie_connect_dynamic_irq() is to be called properly. Signed-off-by: Tomasz Bursztyka --- include/arch/x86/ia32/arch.h | 8 ++++++++ include/arch/x86/intel64/arch.h | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/arch/x86/ia32/arch.h b/include/arch/x86/ia32/arch.h index 0f9ea0e41c7..19c59d7abf2 100644 --- a/include/arch/x86/ia32/arch.h +++ b/include/arch/x86/ia32/arch.h @@ -225,6 +225,14 @@ typedef struct s_isrList { (flags_p)); \ } +#ifdef CONFIG_PCIE + +#define ARCH_PCIE_IRQ_CONNECT(bdf_p, irq_p, priority_p, \ + isr_p, isr_param_p, flags_p) \ + ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) + +#endif /* CONFIG_PCIE */ + /* Direct interrupts won't work as expected with KPTI turned on, because * all non-user accessible pages in the page table are marked non-present. * It's likely possible to add logic to ARCH_ISR_DIRECT_HEADER/FOOTER to do diff --git a/include/arch/x86/intel64/arch.h b/include/arch/x86/intel64/arch.h index 840e89cfcd9..f016eb17c2a 100644 --- a/include/arch/x86/intel64/arch.h +++ b/include/arch/x86/intel64/arch.h @@ -133,6 +133,17 @@ struct x86_ssf { (void (*)(const void *))isr_p, \ isr_param_p, flags_p) +#ifdef CONFIG_PCIE + +#define ARCH_PCIE_IRQ_CONNECT(bdf_p, irq_p, priority_p, \ + isr_p, isr_param_p, flags_p) \ + X86_RESERVE_IRQ(irq_p, _CONCAT(_irq_alloc_fixed, __COUNTER__)); \ + pcie_connect_dynamic_irq(bdf_p, irq_p, priority_p, \ + (void (*)(const void *))isr_p, \ + isr_param_p, flags_p) + +#endif /* CONFIG_PCIE */ + /* * Thread object needs to be 16-byte aligned. */