x86/apic: Allow apic::safe_wait_icr_idle() to be NULL
authorThomas Gleixner <tglx@linutronix.de>
Tue, 8 Aug 2023 22:04:05 +0000 (15:04 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 9 Aug 2023 18:58:28 +0000 (11:58 -0700)
Remove tons of NOOP callbacks by making the invocation of
safe_wait_icr_idle() conditional in the inline wrapper.

Will be replaced by a static_call_cond() later.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Tested-by: Juergen Gross <jgross@suse.com> # Xen PV (dom0 and unpriv. guest)
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic_noop.c
arch/x86/kernel/apic/apic_numachip.c
arch/x86/kernel/apic/x2apic_cluster.c
arch/x86/kernel/apic/x2apic_phys.c
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/xen/apic.c

index 397cd5ff2ebc270057c679ef2b34d575bc699c4e..dd0a05dbe980f17206bebbc3230da5377cc56cc8 100644 (file)
@@ -206,12 +206,6 @@ static inline u32 native_apic_msr_read(u32 reg)
        return (u32)msr;
 }
 
-static inline u32 native_safe_x2apic_wait_icr_idle(void)
-{
-       /* no need to wait for icr idle in x2apic */
-       return 0;
-}
-
 static inline void native_x2apic_icr_write(u32 low, u32 id)
 {
        wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low);
@@ -376,7 +370,7 @@ static inline void apic_wait_icr_idle(void)
 
 static inline u32 safe_apic_wait_icr_idle(void)
 {
-       return apic->safe_wait_icr_idle();
+       return apic->safe_wait_icr_idle ? apic->safe_wait_icr_idle() : 0;
 }
 
 extern void __init apic_set_eoi_write(void (*eoi_write)(u32 reg, u32 v));
index ef31a2e829f10fb7768daaec27c7e4f415e4feeb..36c1e287ad0513b3bbb8750b18198e2db827debc 100644 (file)
@@ -27,11 +27,6 @@ static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip)
        return -1;
 }
 
-static u32 noop_safe_apic_wait_icr_idle(void)
-{
-       return 0;
-}
-
 static u64 noop_apic_icr_read(void)
 {
        return 0;
@@ -104,5 +99,4 @@ struct apic apic_noop __ro_after_init = {
        .eoi_write                      = noop_apic_write,
        .icr_read                       = noop_apic_icr_read,
        .icr_write                      = noop_apic_icr_write,
-       .safe_wait_icr_idle             = noop_safe_apic_wait_icr_idle,
 };
index 647ed774b34600c43441a61588ee502b0500c37c..e879dbb576960065e95ab7dad9ec8f6f97698f85 100644 (file)
@@ -223,12 +223,6 @@ static int numachip2_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
        return 1;
 }
 
-/* APIC NMI IPIs are queued */
-static u32 numachip_safe_apic_wait_icr_idle(void)
-{
-       return 0;
-}
-
 static const struct apic apic_numachip1 __refconst = {
        .name                           = "NumaConnect system",
        .probe                          = numachip1_probe,
@@ -264,7 +258,6 @@ static const struct apic apic_numachip1 __refconst = {
        .eoi_write                      = native_apic_mem_write,
        .icr_read                       = native_apic_icr_read,
        .icr_write                      = native_apic_icr_write,
-       .safe_wait_icr_idle             = numachip_safe_apic_wait_icr_idle,
 };
 
 apic_driver(apic_numachip1);
@@ -304,7 +297,6 @@ static const struct apic apic_numachip2 __refconst = {
        .eoi_write                      = native_apic_mem_write,
        .icr_read                       = native_apic_icr_read,
        .icr_write                      = native_apic_icr_write,
-       .safe_wait_icr_idle             = numachip_safe_apic_wait_icr_idle,
 };
 
 apic_driver(apic_numachip2);
index 7ceef70312b590e889e576f2071d0b3c4d9e9372..355da47e3d3aad3f79fed07f97811f7bc4bc1202 100644 (file)
@@ -266,7 +266,6 @@ static struct apic apic_x2apic_cluster __ro_after_init = {
        .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
-       .safe_wait_icr_idle             = native_safe_x2apic_wait_icr_idle,
 };
 
 apic_driver(apic_x2apic_cluster);
index c1ab67859134eb9388ef0d08d1f2bc1ddae6aff2..2c9a884efd6b432fbbf98ee43c98b80200fd62ef 100644 (file)
@@ -180,7 +180,6 @@ static struct apic apic_x2apic_phys __ro_after_init = {
        .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
-       .safe_wait_icr_idle             = native_safe_x2apic_wait_icr_idle,
 };
 
 apic_driver(apic_x2apic_phys);
index 5cb68f657f79adac590173f04bf3df7d3dfd2e5f..f532c5856dbbe767c8bf6cc5812176a4fb9c805c 100644 (file)
@@ -854,7 +854,6 @@ static struct apic apic_x2apic_uv_x __ro_after_init = {
        .eoi_write                      = native_apic_msr_eoi_write,
        .icr_read                       = native_x2apic_icr_read,
        .icr_write                      = native_x2apic_icr_write,
-       .safe_wait_icr_idle             = native_safe_x2apic_wait_icr_idle,
 };
 
 #define        UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_LENGTH      3
index e709bf0be86a78806c169ae1f924e98344134083..0f71b2e79c76ffa714f4fc56dec988dfbe765fe3 100644 (file)
@@ -92,11 +92,6 @@ static void xen_apic_icr_write(u32 low, u32 id)
        WARN_ON(1);
 }
 
-static u32 xen_safe_apic_wait_icr_idle(void)
-{
-        return 0;
-}
-
 static int xen_apic_probe_pv(void)
 {
        if (xen_pv_domain())
@@ -161,7 +156,6 @@ static struct apic xen_pv_apic = {
 
        .icr_read                       = xen_apic_icr_read,
        .icr_write                      = xen_apic_icr_write,
-       .safe_wait_icr_idle             = xen_safe_apic_wait_icr_idle,
 };
 
 static void __init xen_apic_check(void)