]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/cpu: Get rid of compute_unit_id
authorBorislav Petkov <bp@suse.de>
Fri, 25 Mar 2016 14:52:36 +0000 (15:52 +0100)
committerBrian Maly <brian.maly@oracle.com>
Tue, 13 Nov 2018 19:09:13 +0000 (14:09 -0500)
It is cpu_core_id anyway.

Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1458917557-8757-3-git-send-email-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
(cherry picked from commit 8196dab4fc159943df6baaac04973bb1accb7100)

Orabug: 28783929

Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
arch/x86/kernel/cpu/amd.c
Removed smp_num_siblings calculation as we have it in get_topology_early.
Add UEK_KABI_DEPRECATE for compute_unit_id to cpuinfo to preserva KABI.

Signed-off-by: Brian Maly <brian.maly@oracle.com>
arch/x86/include/asm/processor.h
arch/x86/kernel/amd_nb.c
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/smpboot.c

index 4e87a7f2be3ae8d95fda8b9f5c34e42e3aa5a151..e8aabd27e9762c0ad6c180e765616ca39b8ac0f4 100644 (file)
@@ -127,7 +127,7 @@ struct cpuinfo_x86 {
        /* Core id: */
        u16                     cpu_core_id;
        /* Compute unit id */
-       u8                      compute_unit_id;
+       UEK_KABI_DEPRECATE(u8, compute_unit_id)
        /* Index into per_cpu list: */
        u16                     cpu_index;
        u32                     microcode;
index 80bb8c0349a73f73234633f90bd616e57a953ff8..e6513ee80853430987a9c4a4305aa25a9e489c3e 100644 (file)
@@ -172,15 +172,13 @@ int amd_get_subcaches(int cpu)
 {
        struct pci_dev *link = node_to_amd_nb(amd_get_nb_id(cpu))->link;
        unsigned int mask;
-       int cuid;
 
        if (!amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
                return 0;
 
        pci_read_config_dword(link, 0x1d4, &mask);
 
-       cuid = cpu_data(cpu).compute_unit_id;
-       return (mask >> (4 * cuid)) & 0xf;
+       return (mask >> (4 * cpu_data(cpu).cpu_core_id)) & 0xf;
 }
 
 int amd_set_subcaches(int cpu, unsigned long mask)
@@ -206,7 +204,7 @@ int amd_set_subcaches(int cpu, unsigned long mask)
                pci_write_config_dword(nb->misc, 0x1b8, reg & ~0x180000);
        }
 
-       cuid = cpu_data(cpu).compute_unit_id;
+       cuid = cpu_data(cpu).cpu_core_id;
        mask <<= 4 * cuid;
        mask |= (0xf ^ (1 << cuid)) << 26;
 
index d4376ac8b988150dfbfbfa3c44cd404843a3ad5f..b06d2c62d2cdd1b6ce0e6c30d15a55cf6907601a 100644 (file)
@@ -305,7 +305,6 @@ static void amd_get_topology_early(struct cpuinfo_x86 *c)
 #ifdef CONFIG_X86_HT
 static void amd_get_topology(struct cpuinfo_x86 *c)
 {
-       u32 cores_per_cu = 1;
        u8 node_id;
        int cpu = smp_processor_id();
 
@@ -317,9 +316,8 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
                node_id = ecx & 7;
 
                /* get compute unit information */
-               cores_per_cu = ((ebx >> 8) & 3) + 1;
-               c->x86_max_cores /= cores_per_cu;
-               c->compute_unit_id = ebx & 0xff;
+               c->x86_max_cores /= smp_num_siblings;
+               c->cpu_core_id = ebx & 0xff;
        } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {
                u64 value;
 
@@ -330,19 +328,16 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
 
        /* fixup multi-node processor information */
        if (nodes_per_socket > 1) {
-               u32 cores_per_node;
                u32 cus_per_node;
 
                set_cpu_cap(c, X86_FEATURE_AMD_DCM);
                cus_per_node = c->x86_max_cores / nodes_per_socket;
-               cores_per_node = cus_per_node * cores_per_cu;
 
                /* store NodeID, use llc_shared_map to store sibling info */
                per_cpu(cpu_llc_id, cpu) = node_id;
 
                /* core id has to be in the [0 .. cores_per_node - 1] range */
-               c->cpu_core_id %= cores_per_node;
-               c->compute_unit_id %= cus_per_node;
+               c->cpu_core_id %= cus_per_node;
        }
 }
 #endif
index fa9abc8af3f0ad7f88a7ecd6a81978378bf07a64..6df5e79a5115e14d8e480889f8556ae6fc1f8738 100644 (file)
@@ -355,7 +355,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
 
                if (c->phys_proc_id == o->phys_proc_id &&
                    per_cpu(cpu_llc_id, cpu1) == per_cpu(cpu_llc_id, cpu2) &&
-                   c->compute_unit_id == o->compute_unit_id)
+                   c->cpu_core_id == o->cpu_core_id)
                        return topology_sane(c, o, "smt");
 
        } else if (c->phys_proc_id == o->phys_proc_id &&