Skip to content

Commit 6a81269

Browse files
Andreas HerrmannBorislav Petkov
authored andcommitted
x86, EDAC: Provide function to return NodeId of a CPU
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> Acked-by: H. Peter Anvin <hpa@zytor.com>
1 parent b9183f9 commit 6a81269

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

arch/x86/include/asm/processor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,4 +1020,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
10201020
extern int get_tsc_mode(unsigned long adr);
10211021
extern int set_tsc_mode(unsigned int val);
10221022

1023+
extern int amd_get_nb_id(int cpu);
1024+
10231025
#endif /* _ASM_X86_PROCESSOR_H */

arch/x86/kernel/cpu/amd.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,16 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
333333
#endif
334334
}
335335

336+
int amd_get_nb_id(int cpu)
337+
{
338+
int id = 0;
339+
#ifdef CONFIG_SMP
340+
id = per_cpu(cpu_llc_id, cpu);
341+
#endif
342+
return id;
343+
}
344+
EXPORT_SYMBOL_GPL(amd_get_nb_id);
345+
336346
static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
337347
{
338348
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)

drivers/edac/edac_mce_amd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ void decode_mce(struct mce *m)
405405
regs.nbsh = (u32)(m->status >> 32);
406406
regs.nbeal = (u32) m->addr;
407407
regs.nbeah = (u32)(m->addr >> 32);
408-
node = per_cpu(cpu_llc_id, m->extcpu);
408+
node = amd_get_nb_id(m->extcpu);
409409

410410
amd_decode_nb_mce(node, &regs, 1);
411411
break;

0 commit comments

Comments
 (0)