summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-08-21 20:11:31 -0400
committerIan Moffett <ian@osmora.org>2025-08-21 20:11:31 -0400
commit6bd8fc75891cf2c08aaf4584f0110ca1cbbf84db (patch)
treec4cc4cdda2d307ccd10c7396a10708e365b85958 /sys/include
parent6da57a82e1b40f6f1f105aa990475b451d4958e9 (diff)
kernel/amd64: ipi: Greatly simplify IPI framework
The previous IPI framework design was quite an overengineered mess thanks to our friend, Φ of the body. - Use a flat array instead of a weird bitmap - Only use one ISR and chain the functions Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/arch/amd64/cpu.h5
-rw-r--r--sys/include/arch/amd64/ipi.h51
2 files changed, 3 insertions, 53 deletions
diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h
index cf073fe..5adff29 100644
--- a/sys/include/arch/amd64/cpu.h
+++ b/sys/include/arch/amd64/cpu.h
@@ -52,7 +52,7 @@
#define CPU_VENDOR_INTEL 0x00000001
#define CPU_VENDOR_AMD 0x00000002
-typedef uint16_t ipi_pend_t;
+typedef uint32_t ipi_pend_t;
struct cpu_info {
uint32_t apicid;
@@ -60,8 +60,7 @@ struct cpu_info {
uint32_t vendor; /* Vendor (see CPU_VENDOR_*) */
uint8_t preempt : 1; /* CPU is preemptable */
uint8_t ipi_dispatch : 1; /* 1: IPIs being dispatched */
- uint8_t ipi_id;
- ipi_pend_t ipi_pending[N_IPIVEC];
+ ipi_pend_t ipi_pending;
uint8_t id; /* MI Logical ID */
uint8_t model : 4; /* CPU model number */
uint8_t family : 4; /* CPU family ID */
diff --git a/sys/include/arch/amd64/ipi.h b/sys/include/arch/amd64/ipi.h
index 1a3b51c..452d006 100644
--- a/sys/include/arch/amd64/ipi.h
+++ b/sys/include/arch/amd64/ipi.h
@@ -53,57 +53,8 @@ struct cpu_ipi {
int(*handler)(struct cpu_ipi *ipi);
};
-/*
- * Represents an interrupt vector for a
- * specific IPI
- *
- * @ipi: IPIs associated with this vector
- * @cookie: Used to verify an instance
- * @nipi: Number of IPIs associated
- * @vec: System interrupt vector number
- */
-struct ipi_vector {
- struct cpu_ipi ipi[IPI_PER_VEC];
- uint16_t cookie;
- uint8_t nipi;
- uint8_t vec;
-};
-
int md_ipi_alloc(struct cpu_ipi **res);
-int md_ipi_send(struct cpu_info *ci);
+int md_ipi_send(struct cpu_info *ci, ipi_pend_t ipi);
void md_ipi_init(void);
-/*
- * Get the vector an IPI belongs to
- *
- * @ipi: IPI to check
- */
-__always_inline static inline uint8_t
-ipi_vector(uint8_t ipi)
-{
- return ipi / N_IPIVEC;
-}
-
-/*
- * Get the handler index an IPI belongs
- * to
- *
- * @ipi: IPI to check
- */
-__always_inline static inline uint8_t
-ipi_index(uint8_t ipi)
-{
- return ipi % (sizeof(ipi_pend_t) * 8);
-}
-
-__always_inline static inline int
-cpu_ipi_send(struct cpu_info *ci, uint8_t ipi)
-{
- uint8_t vec = ipi_vector(ipi);
- uint8_t idx = ipi_index(ipi);
-
- ci->ipi_pending[vec] |= BIT(idx);
- return md_ipi_send(ci);
-}
-
#endif /* !_MACHINE_IPI_H_ */