From 0976eef35ab1c557238a87f253888a4d2dd1bf52 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 9 Aug 2025 23:18:09 -0400 Subject: kernel/amd64: Introduce flexible IPI management This commit greatly improves the handling of how inter-processor interrupts are allocated and managed. Previously Hyra used handlers at fixed interrupt vectors for IPIs, however, that is very rigid and not very scalable at all. With the new IPI framework, one may allocate IPIs by calling 'md_ipi_alloc()' and initializing the handler field. To send an IPI to a specific processor, one can use cpu_ipi_send() and pass the specific CPU structure as well as the IPI identifier. Signed-off-by: Ian Moffett --- sys/include/arch/amd64/cpu.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/include/arch/amd64/cpu.h') diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h index 116661b..4586163 100644 --- a/sys/include/arch/amd64/cpu.h +++ b/sys/include/arch/amd64/cpu.h @@ -37,6 +37,7 @@ #include #include #include +#include #define CPU_IRQ(IRQ_N) (BIT((IRQ_N)) & 0xFF) @@ -44,9 +45,14 @@ #define CPU_FEAT_SMAP BIT(0) #define CPU_FEAT_SMEP BIT(1) +typedef uint16_t ipi_pend_t; + struct cpu_info { uint32_t apicid; uint32_t feat; + uint8_t ipi_dispatch : 1; /* 1: IPIs being dispatched */ + uint8_t ipi_id; + ipi_pend_t ipi_pending[N_IPIVEC]; uint8_t id; /* MI Logical ID */ uint8_t model : 4; /* CPU model number */ uint8_t family : 4; /* CPU family ID */ -- cgit v1.2.3