Skip to content

Commit 9164d94

Browse files
kimphillamdIngo Molnar
authored andcommitted
x86/cpu: Add get_llc_id() helper function
Factor out a helper function rather than export cpu_llc_id, which is needed in order to be able to build the AMD uncore driver as a module. Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0a0b53e commit 9164d94

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

arch/x86/events/amd/uncore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static int amd_uncore_cpu_starting(unsigned int cpu)
452452

453453
if (amd_uncore_llc) {
454454
uncore = *per_cpu_ptr(amd_uncore_llc, cpu);
455-
uncore->id = per_cpu(cpu_llc_id, cpu);
455+
uncore->id = get_llc_id(cpu);
456456

457457
uncore = amd_uncore_find_online_sibling(uncore, amd_uncore_llc);
458458
*per_cpu_ptr(amd_uncore_llc, cpu) = uncore;

arch/x86/include/asm/processor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ extern int set_tsc_mode(unsigned int val);
795795

796796
DECLARE_PER_CPU(u64, msr_misc_features_shadow);
797797

798+
extern u16 get_llc_id(unsigned int cpu);
799+
798800
#ifdef CONFIG_CPU_SUP_AMD
799801
extern u32 amd_get_nodes_per_socket(void);
800802
extern u32 amd_get_highest_perf(void);

arch/x86/kernel/cpu/amd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
438438

439439
node = numa_cpu_node(cpu);
440440
if (node == NUMA_NO_NODE)
441-
node = per_cpu(cpu_llc_id, cpu);
441+
node = get_llc_id(cpu);
442442

443443
/*
444444
* On multi-fabric platform (e.g. Numascale NumaChip) a

arch/x86/kernel/cpu/common.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ EXPORT_SYMBOL(smp_num_siblings);
7979
/* Last level cache ID of each logical CPU */
8080
DEFINE_PER_CPU_READ_MOSTLY(u16, cpu_llc_id) = BAD_APICID;
8181

82+
u16 get_llc_id(unsigned int cpu)
83+
{
84+
return per_cpu(cpu_llc_id, cpu);
85+
}
86+
EXPORT_SYMBOL_GPL(get_llc_id);
87+
8288
/* correctly size the local cpu masks */
8389
void __init setup_cpu_local_masks(void)
8490
{

0 commit comments

Comments
 (0)