[patch V3 60/60] x86/apic: Turn on static calls

From: Thomas Gleixner
Date: Tue Aug 01 2023 - 06:52:04 EST


Convert all the APIC callback inline wrappers from apic->foo() to
static_call(apic_call_foo)(), except for the safe_wait_icr_idle() one which
is only used during SMP bringup when sending INIT/SIPI. That really can do
the conditional callback. The regular wait_icr_idle() matters as it is used
in irq_work_raise(), so X2APIC machines spare the conditional.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
arch/x86/include/asm/apic.h | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)

--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -394,68 +394,67 @@ DECLARE_APIC_CALL(write);

static __always_inline u32 apic_read(u32 reg)
{
- return apic->read(reg);
+ return static_call(apic_call_read)(reg);
}

static __always_inline void apic_write(u32 reg, u32 val)
{
- apic->write(reg, val);
+ static_call(apic_call_write)(reg, val);
}

static __always_inline void apic_eoi(void)
{
- apic->eoi();
+ static_call(apic_call_eoi)();
}

static __always_inline void apic_native_eoi(void)
{
- apic->native_eoi();
+ static_call(apic_call_native_eoi)();
}

static __always_inline u64 apic_icr_read(void)
{
- return apic->icr_read();
+ return static_call(apic_call_icr_read)();
}

static __always_inline void apic_icr_write(u32 low, u32 high)
{
- apic->icr_write(low, high);
+ static_call(apic_call_icr_write)(low, high);
}

static __always_inline void __apic_send_IPI(int cpu, int vector)
{
- apic->send_IPI(cpu, vector);
+ static_call(apic_call_send_IPI)(cpu, vector);
}

static __always_inline void __apic_send_IPI_mask(const struct cpumask *mask, int vector)
{
- apic->send_IPI_mask(mask, vector);
+ static_call_mod(apic_call_send_IPI_mask)(mask, vector);
}

static __always_inline void __apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
{
- apic->send_IPI_mask_allbutself(mask, vector);
+ static_call(apic_call_send_IPI_mask_allbutself)(mask, vector);
}

static __always_inline void __apic_send_IPI_allbutself(int vector)
{
- apic->send_IPI_allbutself(vector);
+ static_call(apic_call_send_IPI_allbutself)(vector);
}

static __always_inline void __apic_send_IPI_all(int vector)
{
- apic->send_IPI_all(vector);
+ static_call(apic_call_send_IPI_all)(vector);
}

static __always_inline void __apic_send_IPI_self(int vector)
{
- apic->send_IPI_self(vector);
+ static_call_mod(apic_call_send_IPI_self)(vector);
}

static __always_inline void apic_wait_icr_idle(void)
{
- if (apic->wait_icr_idle)
- apic->wait_icr_idle();
+ static_call_cond(apic_call_wait_icr_idle)();
}

static __always_inline u32 safe_apic_wait_icr_idle(void)