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

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/prom: Add CPU info to hardware description string later

cur_cpu_spec->cpu_name is appended to ppc_hw_desc before cur_cpu_spec
has taken on its final value. This is illustrated on pseries by
comparing the CPU name as reported at boot ("POWER8E (raw)") to the
contents of /proc/cpuinfo ("POWER8 (architected)"):

$ dmesg | grep Hardware
Hardware name: IBM,8408-E8E POWER8E (raw) 0x4b0201 0xf000004 \
of:IBM,FW860.50 (SV860_146) hv:phyp pSeries

$ grep -m 1 ^cpu /proc/cpuinfo
cpu : POWER8 (architected), altivec supported

Some 44x models would appear to be affected as well; see
identical_pvr_fixup().

This results in incorrect CPU information in stack dumps --
ppc_hw_desc is an input to dump_stack_set_arch_desc().

Delay gathering the CPU name until after all potential calls to
identify_cpu().

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Fixes: bd649d40e0f2 ("powerpc: Add PVR & CPU name to hardware description")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240603-fix-cpu-hwdesc-v1-1-945f2850fcaa@linux.ibm.com

authored by

Nathan Lynch and committed by
Michael Ellerman
7bdd1c6c 0974d03e

+8 -4
+8 -4
arch/powerpc/kernel/prom.c
··· 331 331 void *data) 332 332 { 333 333 const char *type = of_get_flat_dt_prop(node, "device_type", NULL); 334 + const __be32 *cpu_version = NULL; 334 335 const __be32 *prop; 335 336 const __be32 *intserv; 336 337 int i, nthreads; ··· 421 420 prop = of_get_flat_dt_prop(node, "cpu-version", NULL); 422 421 if (prop && (be32_to_cpup(prop) & 0xff000000) == 0x0f000000) { 423 422 identify_cpu(0, be32_to_cpup(prop)); 424 - seq_buf_printf(&ppc_hw_desc, "0x%04x ", be32_to_cpup(prop)); 423 + cpu_version = prop; 425 424 } 426 425 427 426 check_cpu_feature_properties(node); ··· 432 431 } 433 432 434 433 identical_pvr_fixup(node); 434 + 435 + // We can now add the CPU name & PVR to the hardware description 436 + seq_buf_printf(&ppc_hw_desc, "%s 0x%04lx ", cur_cpu_spec->cpu_name, mfspr(SPRN_PVR)); 437 + if (cpu_version) 438 + seq_buf_printf(&ppc_hw_desc, "0x%04x ", be32_to_cpup(cpu_version)); 439 + 435 440 init_mmu_slb_size(node); 436 441 437 442 #ifdef CONFIG_PPC64 ··· 887 880 DBG("Scanning CPUs ...\n"); 888 881 889 882 dt_cpu_ftrs_scan(); 890 - 891 - // We can now add the CPU name & PVR to the hardware description 892 - seq_buf_printf(&ppc_hw_desc, "%s 0x%04lx ", cur_cpu_spec->cpu_name, mfspr(SPRN_PVR)); 893 883 894 884 /* Retrieve CPU related informations from the flat tree 895 885 * (altivec support, boot CPU ID, ...)