[tip: x86/apic] x86/apic: Turn on static calls

From: tip-bot2 for Thomas Gleixner
Date: Wed Aug 09 2023 - 16:36:13 EST


The following commit has been merged into the x86/apic branch of tip:

Commit-ID: f8542a55499a69a859c84866b66f0df43933e563
Gitweb: https://git.kernel.org/tip/f8542a55499a69a859c84866b66f0df43933e563
Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
AuthorDate: Tue, 08 Aug 2023 15:04:24 -07:00
Committer: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
CommitterDate: Wed, 09 Aug 2023 12:00:55 -07:00

x86/apic: Turn on static calls

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>
Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Tested-by: Juergen Gross <jgross@xxxxxxxx> # Xen PV (dom0 and unpriv. guest)
Tested-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
Tested-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>
---
arch/x86/include/asm/apic.h | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index ddafd14..5af4ec1 100644
--- 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)