Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/apic: Remove unused phys_pkg_id() callback

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




-68
-1
arch/x86/include/asm/apic.h
··· 295 295 void (*init_apic_ldr)(void); 296 296 void (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap); 297 297 u32 (*cpu_present_to_apicid)(int mps_cpu); 298 - u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb); 299 298 300 299 u32 (*get_apic_id)(u32 id); 301 300 u32 (*set_apic_id)(u32 apicid);
-7
arch/x86/kernel/apic/apic_flat_64.c
··· 66 66 return (id & 0xFF) << 24; 67 67 } 68 68 69 - static u32 flat_phys_pkg_id(u32 initial_apic_id, int index_msb) 70 - { 71 - return initial_apic_id >> index_msb; 72 - } 73 - 74 69 static int flat_probe(void) 75 70 { 76 71 return 1; ··· 83 88 84 89 .init_apic_ldr = default_init_apic_ldr, 85 90 .cpu_present_to_apicid = default_cpu_present_to_apicid, 86 - .phys_pkg_id = flat_phys_pkg_id, 87 91 88 92 .max_apic_id = 0xFE, 89 93 .get_apic_id = flat_get_apic_id, ··· 152 158 .disable_esr = 0, 153 159 154 160 .cpu_present_to_apicid = default_cpu_present_to_apicid, 155 - .phys_pkg_id = flat_phys_pkg_id, 156 161 157 162 .max_apic_id = 0xFE, 158 163 .get_apic_id = flat_get_apic_id,
-3
arch/x86/kernel/apic/apic_noop.c
··· 29 29 static void noop_apic_icr_write(u32 low, u32 id) { } 30 30 static int noop_wakeup_secondary_cpu(u32 apicid, unsigned long start_eip) { return -1; } 31 31 static u64 noop_apic_icr_read(void) { return 0; } 32 - static u32 noop_phys_pkg_id(u32 cpuid_apic, int index_msb) { return 0; } 33 32 static u32 noop_get_apic_id(u32 apicid) { return 0; } 34 33 static void noop_apic_eoi(void) { } 35 34 ··· 53 54 .check_apicid_used = default_check_apicid_used, 54 55 .ioapic_phys_id_map = default_ioapic_phys_id_map, 55 56 .cpu_present_to_apicid = default_cpu_present_to_apicid, 56 - 57 - .phys_pkg_id = noop_phys_pkg_id, 58 57 59 58 .max_apic_id = 0xFE, 60 59 .get_apic_id = noop_get_apic_id,
-7
arch/x86/kernel/apic/apic_numachip.c
··· 56 56 return id << 24; 57 57 } 58 58 59 - static u32 numachip_phys_pkg_id(u32 initial_apic_id, int index_msb) 60 - { 61 - return initial_apic_id >> index_msb; 62 - } 63 - 64 59 static void numachip1_apic_icr_write(int apicid, unsigned int val) 65 60 { 66 61 write_lcsr(CSR_G3_EXT_IRQ_GEN, (apicid << 16) | val); ··· 222 227 .disable_esr = 0, 223 228 224 229 .cpu_present_to_apicid = default_cpu_present_to_apicid, 225 - .phys_pkg_id = numachip_phys_pkg_id, 226 230 227 231 .max_apic_id = UINT_MAX, 228 232 .get_apic_id = numachip1_get_apic_id, ··· 257 263 .disable_esr = 0, 258 264 259 265 .cpu_present_to_apicid = default_cpu_present_to_apicid, 260 - .phys_pkg_id = numachip_phys_pkg_id, 261 266 262 267 .max_apic_id = UINT_MAX, 263 268 .get_apic_id = numachip2_get_apic_id,
-6
arch/x86/kernel/apic/bigsmp_32.c
··· 29 29 physids_promote(0xFFL, retmap); 30 30 } 31 31 32 - static u32 bigsmp_phys_pkg_id(u32 cpuid_apic, int index_msb) 33 - { 34 - return cpuid_apic >> index_msb; 35 - } 36 - 37 32 static void bigsmp_send_IPI_allbutself(int vector) 38 33 { 39 34 default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector); ··· 82 87 .check_apicid_used = bigsmp_check_apicid_used, 83 88 .ioapic_phys_id_map = bigsmp_ioapic_phys_id_map, 84 89 .cpu_present_to_apicid = default_cpu_present_to_apicid, 85 - .phys_pkg_id = bigsmp_phys_pkg_id, 86 90 87 91 .max_apic_id = 0xFE, 88 92 .get_apic_id = bigsmp_get_apic_id,
-1
arch/x86/kernel/apic/local.h
··· 17 17 void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest); 18 18 u32 x2apic_get_apic_id(u32 id); 19 19 u32 x2apic_set_apic_id(u32 id); 20 - u32 x2apic_phys_pkg_id(u32 initial_apicid, int index_msb); 21 20 22 21 void x2apic_send_IPI_all(int vector); 23 22 void x2apic_send_IPI_allbutself(int vector);
-6
arch/x86/kernel/apic/probe_32.c
··· 18 18 19 19 #include "local.h" 20 20 21 - static u32 default_phys_pkg_id(u32 cpuid_apic, int index_msb) 22 - { 23 - return cpuid_apic >> index_msb; 24 - } 25 - 26 21 static u32 default_get_apic_id(u32 x) 27 22 { 28 23 unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); ··· 48 53 .init_apic_ldr = default_init_apic_ldr, 49 54 .ioapic_phys_id_map = default_ioapic_phys_id_map, 50 55 .cpu_present_to_apicid = default_cpu_present_to_apicid, 51 - .phys_pkg_id = default_phys_pkg_id, 52 56 53 57 .max_apic_id = 0xFE, 54 58 .get_apic_id = default_get_apic_id,
-1
arch/x86/kernel/apic/x2apic_cluster.c
··· 235 235 .init_apic_ldr = init_x2apic_ldr, 236 236 .ioapic_phys_id_map = NULL, 237 237 .cpu_present_to_apicid = default_cpu_present_to_apicid, 238 - .phys_pkg_id = x2apic_phys_pkg_id, 239 238 240 239 .max_apic_id = UINT_MAX, 241 240 .x2apic_set_max_apicid = true,
-6
arch/x86/kernel/apic/x2apic_phys.c
··· 134 134 return id; 135 135 } 136 136 137 - u32 x2apic_phys_pkg_id(u32 initial_apicid, int index_msb) 138 - { 139 - return initial_apicid >> index_msb; 140 - } 141 - 142 137 static struct apic apic_x2apic_phys __ro_after_init = { 143 138 144 139 .name = "physical x2apic", ··· 145 150 .disable_esr = 0, 146 151 147 152 .cpu_present_to_apicid = default_cpu_present_to_apicid, 148 - .phys_pkg_id = x2apic_phys_pkg_id, 149 153 150 154 .max_apic_id = UINT_MAX, 151 155 .x2apic_set_max_apicid = true,
-11
arch/x86/kernel/apic/x2apic_uv_x.c
··· 784 784 return id; 785 785 } 786 786 787 - static unsigned int uv_read_apic_id(void) 788 - { 789 - return x2apic_get_apic_id(apic_read(APIC_ID)); 790 - } 791 - 792 - static u32 uv_phys_pkg_id(u32 initial_apicid, int index_msb) 793 - { 794 - return uv_read_apic_id() >> index_msb; 795 - } 796 - 797 787 static int uv_probe(void) 798 788 { 799 789 return apic == &apic_x2apic_uv_x; ··· 800 810 .disable_esr = 0, 801 811 802 812 .cpu_present_to_apicid = default_cpu_present_to_apicid, 803 - .phys_pkg_id = uv_phys_pkg_id, 804 813 805 814 .max_apic_id = UINT_MAX, 806 815 .get_apic_id = x2apic_get_apic_id,
-13
arch/x86/kernel/vsmp_64.c
··· 127 127 #endif 128 128 } 129 129 130 - static u32 apicid_phys_pkg_id(u32 initial_apic_id, int index_msb) 131 - { 132 - return read_apic_id() >> index_msb; 133 - } 134 - 135 - static void vsmp_apic_post_init(void) 136 - { 137 - /* need to update phys_pkg_id */ 138 - apic->phys_pkg_id = apicid_phys_pkg_id; 139 - } 140 - 141 130 void __init vsmp_init(void) 142 131 { 143 132 detect_vsmp_box(); 144 133 if (!is_vsmp_box()) 145 134 return; 146 - 147 - x86_platform.apic_post_init = vsmp_apic_post_init; 148 135 149 136 vsmp_cap_cpus(); 150 137
-6
arch/x86/xen/apic.c
··· 110 110 return xen_pv_domain(); 111 111 } 112 112 113 - static u32 xen_phys_pkg_id(u32 initial_apic_id, int index_msb) 114 - { 115 - return initial_apic_id >> index_msb; 116 - } 117 - 118 113 static u32 xen_cpu_present_to_apicid(int cpu) 119 114 { 120 115 if (cpu_present(cpu)) ··· 128 133 .disable_esr = 0, 129 134 130 135 .cpu_present_to_apicid = xen_cpu_present_to_apicid, 131 - .phys_pkg_id = xen_phys_pkg_id, /* detect_ht */ 132 136 133 137 .max_apic_id = UINT_MAX, 134 138 .get_apic_id = xen_get_apic_id,