x86/cacheinfo: Add a cpu_llc_shared_mask() UP variant
authorBorislav Petkov <bp@suse.de>
Fri, 19 Aug 2022 17:47:44 +0000 (19:47 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 28 Sep 2022 16:35:37 +0000 (18:35 +0200)
commitdf5b035b5683d6a25f077af889fb88e09827f8bc
tree15b64f4c405a91cf8952b34f47851a10ac3baff8
parentefd608fa7403ba106412b437f873929e2c862e28
x86/cacheinfo: Add a cpu_llc_shared_mask() UP variant

On a CONFIG_SMP=n kernel, the LLC shared mask is 0, which prevents
__cache_amd_cpumap_setup() from doing the L3 masks setup, and more
specifically from setting up the shared_cpu_map and shared_cpu_list
files in sysfs, leading to lscpu from util-linux getting confused and
segfaulting.

Add a cpu_llc_shared_mask() UP variant which returns a mask with a
single bit set, i.e., for CPU0.

Fixes: 2b83809a5e6d ("x86/cpu/amd: Derive L3 shared_cpu_map from cpu_llc_shared_mask")
Reported-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1660148115-302-1-git-send-email-ssengar@linux.microsoft.com
arch/x86/include/asm/smp.h