]> git.baikalelectronics.ru Git - kernel.git/commit
x86/cpu: Clear SME feature flag when not in use
authorMario Limonciello <mario.limonciello@amd.com>
Wed, 16 Feb 2022 03:44:46 +0000 (21:44 -0600)
committerBorislav Petkov <bp@suse.de>
Wed, 16 Feb 2022 18:45:53 +0000 (19:45 +0100)
commite2dce390dcd29e8452f6467f2658eb77bd82bb77
tree7904449a2af5f99762707db4fa3a42c0ee2ac519
parent7e2a5f6370339fb03e85b3258d5d202c1f73455f
x86/cpu: Clear SME feature flag when not in use

Currently, the SME CPU feature flag is reflective of whether the CPU
supports the feature but not whether it has been activated by the
kernel.

Change this around to clear the SME feature flag if the kernel is not
using it so userspace can determine if it is available and in use
from /proc/cpuinfo.

As the feature flag is cleared on systems where SME isn't active, use
CPUID 0x8000001f to confirm SME availability before calling
native_wbinvd().

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20220216034446.2430634-1-mario.limonciello@amd.com
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/process.c