public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained
@ 2020-01-15 22:05 Tom Lendacky
  2020-01-17 13:00 ` Joerg Roedel
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Lendacky @ 2020-01-15 22:05 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Joerg Roedel,
	Brijesh Singh, stable

If the SME and SEV features are present via CPUID, but memory encryption
support is not enabled (MSR 0xC001_0010[23]), the features are cleared
using clear_cpu_cap(). However, if get_cpu_cap() is later called, these
features will be reset back to present, which is not desired.

Change from using clear_cpu_cap() to setup_clear_cpu_cap() so that the
clearing of the features is maintained.

Cc: <stable@vger.kernel.org> # 4.16.x-
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 arch/x86/kernel/cpu/amd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 90f75e515876..62c30279be77 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -615,9 +615,9 @@ static void early_detect_mem_encrypt(struct cpuinfo_x86 *c)
 		return;
 
 clear_all:
-		clear_cpu_cap(c, X86_FEATURE_SME);
+		setup_clear_cpu_cap(X86_FEATURE_SME);
 clear_sev:
-		clear_cpu_cap(c, X86_FEATURE_SEV);
+		setup_clear_cpu_cap(X86_FEATURE_SEV);
 	}
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained
  2020-01-15 22:05 [PATCH] x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained Tom Lendacky
@ 2020-01-17 13:00 ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2020-01-17 13:00 UTC (permalink / raw)
  To: Tom Lendacky
  Cc: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Brijesh Singh, stable

On Wed, Jan 15, 2020 at 04:05:16PM -0600, Tom Lendacky wrote:
> If the SME and SEV features are present via CPUID, but memory encryption
> support is not enabled (MSR 0xC001_0010[23]), the features are cleared
> using clear_cpu_cap(). However, if get_cpu_cap() is later called, these
> features will be reset back to present, which is not desired.
> 
> Change from using clear_cpu_cap() to setup_clear_cpu_cap() so that the
> clearing of the features is maintained.
> 
> Cc: <stable@vger.kernel.org> # 4.16.x-
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>

Reviewed-by: Joerg Roedel <jroedel@suse.de>

> ---
>  arch/x86/kernel/cpu/amd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 90f75e515876..62c30279be77 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -615,9 +615,9 @@ static void early_detect_mem_encrypt(struct cpuinfo_x86 *c)
>  		return;
>  
>  clear_all:
> -		clear_cpu_cap(c, X86_FEATURE_SME);
> +		setup_clear_cpu_cap(X86_FEATURE_SME);
>  clear_sev:
> -		clear_cpu_cap(c, X86_FEATURE_SEV);
> +		setup_clear_cpu_cap(X86_FEATURE_SEV);
>  	}
>  }
>  
> -- 
> 2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-17 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-15 22:05 [PATCH] x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained Tom Lendacky
2020-01-17 13:00 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox