x86/apic: Remove unused phys_pkg_id() callback
authorThomas Gleixner <tglx@linutronix.de>
Tue, 13 Feb 2024 21:04:22 +0000 (22:04 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 15 Feb 2024 21:07:38 +0000 (22:07 +0100)
Now that the core code does not use this monstrosity anymore, it's time to
put it to rest.

The only real purpose was to read the APIC ID on UV and VSMP systems for
the actual evaluation. That's what the core code does now.

For doing the actual shift operation there is truly no APIC callback
required.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Juergen Gross <jgross@suse.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wang Wendy <wendy.wang@intel.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/r/20240212153625.516536121@linutronix.de
12 files changed:
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/apic_noop.c
arch/x86/kernel/apic/apic_numachip.c
arch/x86/kernel/apic/bigsmp_32.c
arch/x86/kernel/apic/local.h
arch/x86/kernel/apic/probe_32.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/kernel/vsmp_64.c
arch/x86/xen/apic.c

index 9d159b771dc814a123e77f85ca0793891d16a04d..80d6383b825dac7e3bf09e63c73366ef3532bf64 100644 (file)
@@ -295,7 +295,6 @@ struct apic {
        void    (*init_apic_ldr)(void);
        void    (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap);
        u32     (*cpu_present_to_apicid)(int mps_cpu);
-       u32     (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
 
        u32     (*get_apic_id)(u32 id);
        u32     (*set_apic_id)(u32 apicid);
index b295a056a4fc5c026a4caa4edfccba7835721837..fe9b728799f2c86d3465815070bab1aa6d1a55f3 100644 (file)
@@ -66,11 +66,6 @@ static u32 set_apic_id(u32 id)
        return (id & 0xFF) << 24;
 }
 
-static u32 flat_phys_pkg_id(u32 initial_apic_id, int index_msb)
-{
-       return initial_apic_id >> index_msb;
-}
-
 static int flat_probe(void)
 {
        return 1;
@@ -88,7 +83,6 @@ static struct apic apic_flat __ro_after_init = {
 
        .init_apic_ldr                  = default_init_apic_ldr,
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = flat_phys_pkg_id,
 
        .max_apic_id                    = 0xFE,
        .get_apic_id                    = flat_get_apic_id,
@@ -158,7 +152,6 @@ static struct apic apic_physflat __ro_after_init = {
        .disable_esr                    = 0,
 
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = flat_phys_pkg_id,
 
        .max_apic_id                    = 0xFE,
        .get_apic_id                    = flat_get_apic_id,
index 9f1d553eb48f48eeea15c7eb4460b4d327ecb826..1f2de665e12dea41cfa986067d490c53780e2001 100644 (file)
@@ -29,7 +29,6 @@ static void noop_send_IPI_self(int vector) { }
 static void noop_apic_icr_write(u32 low, u32 id) { }
 static int noop_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip) { return -1; }
 static u64 noop_apic_icr_read(void) { return 0; }
-static u32 noop_phys_pkg_id(u32 cpuid_apic, int index_msb) { return 0; }
 static u32 noop_get_apic_id(u32 apicid) { return 0; }
 static void noop_apic_eoi(void) { }
 
@@ -55,8 +54,6 @@ struct apic apic_noop __ro_after_init = {
        .ioapic_phys_id_map             = default_ioapic_phys_id_map,
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
 
-       .phys_pkg_id                    = noop_phys_pkg_id,
-
        .max_apic_id                    = 0xFE,
        .get_apic_id                    = noop_get_apic_id,
 
index 7d0c51b9d3bca8c29c44e2cb7694243b7bb6a678..f7591dc656d3374431e79c698c449750a8f0d803 100644 (file)
@@ -56,11 +56,6 @@ static u32 numachip2_set_apic_id(u32 id)
        return id << 24;
 }
 
-static u32 numachip_phys_pkg_id(u32 initial_apic_id, int index_msb)
-{
-       return initial_apic_id >> index_msb;
-}
-
 static void numachip1_apic_icr_write(int apicid, unsigned int val)
 {
        write_lcsr(CSR_G3_EXT_IRQ_GEN, (apicid << 16) | val);
@@ -227,7 +222,6 @@ static const struct apic apic_numachip1 __refconst = {
        .disable_esr                    = 0,
 
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = numachip_phys_pkg_id,
 
        .max_apic_id                    = UINT_MAX,
        .get_apic_id                    = numachip1_get_apic_id,
@@ -263,7 +257,6 @@ static const struct apic apic_numachip2 __refconst = {
        .disable_esr                    = 0,
 
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = numachip_phys_pkg_id,
 
        .max_apic_id                    = UINT_MAX,
        .get_apic_id                    = numachip2_get_apic_id,
index 5a0d60b38e6bf098e0546c4b3dcf94011452bceb..dc83c2eed2c13daf9fa614c67e673922426d8bb0 100644 (file)
@@ -29,11 +29,6 @@ static void bigsmp_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask_t *re
        physids_promote(0xFFL, retmap);
 }
 
-static u32 bigsmp_phys_pkg_id(u32 cpuid_apic, int index_msb)
-{
-       return cpuid_apic >> index_msb;
-}
-
 static void bigsmp_send_IPI_allbutself(int vector)
 {
        default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector);
@@ -87,7 +82,6 @@ static struct apic apic_bigsmp __ro_after_init = {
        .check_apicid_used              = bigsmp_check_apicid_used,
        .ioapic_phys_id_map             = bigsmp_ioapic_phys_id_map,
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = bigsmp_phys_pkg_id,
 
        .max_apic_id                    = 0xFE,
        .get_apic_id                    = bigsmp_get_apic_id,
index 9ea6186ea88c2dc701bafb92dc50acb628dabf98..8fd37c9d1b344d27de0aee740be3834e46bf26c2 100644 (file)
@@ -17,7 +17,6 @@
 void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest);
 u32 x2apic_get_apic_id(u32 id);
 u32 x2apic_set_apic_id(u32 id);
-u32 x2apic_phys_pkg_id(u32 initial_apicid, int index_msb);
 
 void x2apic_send_IPI_all(int vector);
 void x2apic_send_IPI_allbutself(int vector);
index c0f78059f06acac05b67c3d619134b768fd9c3b3..752a955497102941f2b2de3833cab27b91debbaa 100644 (file)
 
 #include "local.h"
 
-static u32 default_phys_pkg_id(u32 cpuid_apic, int index_msb)
-{
-       return cpuid_apic >> index_msb;
-}
-
 static u32 default_get_apic_id(u32 x)
 {
        unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
@@ -53,7 +48,6 @@ static struct apic apic_default __ro_after_init = {
        .init_apic_ldr                  = default_init_apic_ldr,
        .ioapic_phys_id_map             = default_ioapic_phys_id_map,
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = default_phys_pkg_id,
 
        .max_apic_id                    = 0xFE,
        .get_apic_id                    = default_get_apic_id,
index 28a7d3f2312d21fc864ee67cd22b86a61983d649..59b05737fe3ecf4ae0563fcc9a8db23df3fce620 100644 (file)
@@ -235,7 +235,6 @@ static struct apic apic_x2apic_cluster __ro_after_init = {
        .init_apic_ldr                  = init_x2apic_ldr,
        .ioapic_phys_id_map             = NULL,
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = x2apic_phys_pkg_id,
 
        .max_apic_id                    = UINT_MAX,
        .x2apic_set_max_apicid          = true,
index 409815a40668281923cfccf04e93ead53301d8e8..8f1c39fa81211c280e8f1bbea03c1dde93d339e1 100644 (file)
@@ -134,11 +134,6 @@ u32 x2apic_set_apic_id(u32 id)
        return id;
 }
 
-u32 x2apic_phys_pkg_id(u32 initial_apicid, int index_msb)
-{
-       return initial_apicid >> index_msb;
-}
-
 static struct apic apic_x2apic_phys __ro_after_init = {
 
        .name                           = "physical x2apic",
@@ -150,7 +145,6 @@ static struct apic apic_x2apic_phys __ro_after_init = {
        .disable_esr                    = 0,
 
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = x2apic_phys_pkg_id,
 
        .max_apic_id                    = UINT_MAX,
        .x2apic_set_max_apicid          = true,
index f1766b18dcd07d495be3b3b21c007b9f904a3180..51485f2c17b61763beaf2b9400180735535d0caa 100644 (file)
@@ -784,16 +784,6 @@ static u32 set_apic_id(u32 id)
        return id;
 }
 
-static unsigned int uv_read_apic_id(void)
-{
-       return x2apic_get_apic_id(apic_read(APIC_ID));
-}
-
-static u32 uv_phys_pkg_id(u32 initial_apicid, int index_msb)
-{
-       return uv_read_apic_id() >> index_msb;
-}
-
 static int uv_probe(void)
 {
        return apic == &apic_x2apic_uv_x;
@@ -810,7 +800,6 @@ static struct apic apic_x2apic_uv_x __ro_after_init = {
        .disable_esr                    = 0,
 
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
-       .phys_pkg_id                    = uv_phys_pkg_id,
 
        .max_apic_id                    = UINT_MAX,
        .get_apic_id                    = x2apic_get_apic_id,
index d3fc017705587de1f921c02f3da83edf6e73368f..73511332bb670074ddc83861b60c946e8e7004cd 100644 (file)
@@ -127,25 +127,12 @@ static void __init vsmp_cap_cpus(void)
 #endif
 }
 
-static u32 apicid_phys_pkg_id(u32 initial_apic_id, int index_msb)
-{
-       return read_apic_id() >> index_msb;
-}
-
-static void vsmp_apic_post_init(void)
-{
-       /* need to update phys_pkg_id */
-       apic->phys_pkg_id = apicid_phys_pkg_id;
-}
-
 void __init vsmp_init(void)
 {
        detect_vsmp_box();
        if (!is_vsmp_box())
                return;
 
-       x86_platform.apic_post_init = vsmp_apic_post_init;
-
        vsmp_cap_cpus();
 
        set_vsmp_ctl();
index 9dd5490b3318923b0810b89076697ab9b8b91d52..d4752382b60034b0b20e78cc087e88e543d7cc0e 100644 (file)
@@ -110,11 +110,6 @@ static int xen_madt_oem_check(char *oem_id, char *oem_table_id)
        return xen_pv_domain();
 }
 
-static u32 xen_phys_pkg_id(u32 initial_apic_id, int index_msb)
-{
-       return initial_apic_id >> index_msb;
-}
-
 static u32 xen_cpu_present_to_apicid(int cpu)
 {
        if (cpu_present(cpu))
@@ -133,7 +128,6 @@ static struct apic xen_pv_apic __ro_after_init = {
        .disable_esr                    = 0,
 
        .cpu_present_to_apicid          = xen_cpu_present_to_apicid,
-       .phys_pkg_id                    = xen_phys_pkg_id, /* detect_ht */
 
        .max_apic_id                    = UINT_MAX,
        .get_apic_id                    = xen_get_apic_id,