x86/apic: Allow apic::wait_icr_idle() to be NULL
authorThomas Gleixner <tglx@linutronix.de>
Tue, 8 Aug 2023 22:04:04 +0000 (15:04 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 9 Aug 2023 18:58:28 +0000 (11:58 -0700)
Nuke more NOOP callbacks and make the invocation conditional. Will be
replaced with a static call 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 1499865ebae78e938e69de295a44049a1ff8ab59..397cd5ff2ebc270057c679ef2b34d575bc699c4e 100644 (file)
@@ -206,12 +206,6 @@ static inline u32 native_apic_msr_read(u32 reg)
        return (u32)msr;
 }
 
-static inline void native_x2apic_wait_icr_idle(void)
-{
-       /* no need to wait for icr idle in x2apic */
-       return;
-}
-
 static inline u32 native_safe_x2apic_wait_icr_idle(void)
 {
        /* no need to wait for icr idle in x2apic */
@@ -376,7 +370,8 @@ static inline void apic_icr_write(u32 low, u32 high)
 
 static inline void apic_wait_icr_idle(void)
 {
-       apic->wait_icr_idle();
+       if (apic->wait_icr_idle)
+               apic->wait_icr_idle();
 }
 
 static inline u32 safe_apic_wait_icr_idle(void)
index c73a7a811bb94908b9fe3da68fa24b3015e6edbf..ef31a2e829f10fb7768daaec27c7e4f415e4feeb 100644 (file)
@@ -20,7 +20,6 @@ static void noop_send_IPI_mask_allbutself(const struct cpumask *cpumask, int vec
 static void noop_send_IPI_allbutself(int vector) { }
 static void noop_send_IPI_all(int vector) { }
 static void noop_send_IPI_self(int vector) { }
-static void noop_apic_wait_icr_idle(void) { }
 static void noop_apic_icr_write(u32 low, u32 id) { }
 
 static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip)
@@ -105,6 +104,5 @@ struct apic apic_noop __ro_after_init = {
        .eoi_write                      = noop_apic_write,
        .icr_read                       = noop_apic_icr_read,
        .icr_write                      = noop_apic_icr_write,
-       .wait_icr_idle                  = noop_apic_wait_icr_idle,
        .safe_wait_icr_idle             = noop_safe_apic_wait_icr_idle,
 };
index e8e13d7c84d77587c1091bc29f64797a360bbc43..647ed774b34600c43441a61588ee502b0500c37c 100644 (file)
@@ -223,11 +223,6 @@ static int numachip2_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
        return 1;
 }
 
-/* APIC IPIs are queued */
-static void numachip_apic_wait_icr_idle(void)
-{
-}
-
 /* APIC NMI IPIs are queued */
 static u32 numachip_safe_apic_wait_icr_idle(void)
 {
@@ -269,7 +264,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,
-       .wait_icr_idle                  = numachip_apic_wait_icr_idle,
        .safe_wait_icr_idle             = numachip_safe_apic_wait_icr_idle,
 };
 
@@ -310,7 +304,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,
-       .wait_icr_idle                  = numachip_apic_wait_icr_idle,
        .safe_wait_icr_idle             = numachip_safe_apic_wait_icr_idle,
 };
 
index 705b33d7072a7e99a63c7e52eb6bda5668ab36aa..7ceef70312b590e889e576f2071d0b3c4d9e9372 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,
-       .wait_icr_idle                  = native_x2apic_wait_icr_idle,
        .safe_wait_icr_idle             = native_safe_x2apic_wait_icr_idle,
 };
 
index e0fdbf5522cd1c0353487e40f9b84e9d55e8741d..c1ab67859134eb9388ef0d08d1f2bc1ddae6aff2 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,
-       .wait_icr_idle                  = native_x2apic_wait_icr_idle,
        .safe_wait_icr_idle             = native_safe_x2apic_wait_icr_idle,
 };
 
index 9e25e3033d0d9acaec3f9a6845c35d1eebae2996..5cb68f657f79adac590173f04bf3df7d3dfd2e5f 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,
-       .wait_icr_idle                  = native_x2apic_wait_icr_idle,
        .safe_wait_icr_idle             = native_safe_x2apic_wait_icr_idle,
 };
 
index f1cd7f2b3ac0de759668a36103b86d3eb80ec2fb..e709bf0be86a78806c169ae1f924e98344134083 100644 (file)
@@ -120,10 +120,6 @@ static int xen_phys_pkg_id(int initial_apic_id, int index_msb)
        return initial_apic_id >> index_msb;
 }
 
-static void xen_noop(void)
-{
-}
-
 static int xen_cpu_present_to_apicid(int cpu)
 {
        if (cpu_present(cpu))
@@ -165,7 +161,6 @@ static struct apic xen_pv_apic = {
 
        .icr_read                       = xen_apic_icr_read,
        .icr_write                      = xen_apic_icr_write,
-       .wait_icr_idle                  = xen_noop,
        .safe_wait_icr_idle             = xen_safe_apic_wait_icr_idle,
 };