Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9014922ybl; Fri, 17 Jan 2020 05:04:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyRl19oAZeKXxaTpljY52MWbNN2SF2PH6V52J/w4FkE50ICc8rjH53CQ12qGHtQ1f7LI+rK X-Received: by 2002:a9d:7ac9:: with SMTP id m9mr5752838otn.80.1579266239885; Fri, 17 Jan 2020 05:03:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579266239; cv=none; d=google.com; s=arc-20160816; b=j7KGQhJMgLQrQ+3ZIy/ql9t0M2pzNk+m0/gTK4GnAYRYSwTHLl2hzJcsGVcnSCyjix T0lPDvXScejouASIxxaDSwoPKFb4yMJx8muZN/aiiEWdqwLnH4hPy2R8IBHPHVH9iliV HiahodrnncA7psaJv9kGsn2f6VVrwehju5aDoYNIrCASfYhdzPk5AfBu2+bMBMAMvZhX WQZRyyPt+pt05Qa0gHC9grVFi4YWPKdUI4kfRBZNSeyayPVeZeyTH9955dP01kItQ8Cc gTU6w4yTFULHv+FjnMuqmnDHQMDdSaeRCT4BwiDSjTzwZR5LMVvWrOvCKpf13jT5v+BA 5YFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4FErasmjfmM8ikHfUwQwcBezIpDhlRpbBz3U11wfvWk=; b=IVdBnvi7iaLGtsxaZd+UOV4tU5fzBAVnrRR/0ndQm06Pj61kOmXDuhzv2AMgcvvDoY hjmmkYR+B0/gpXKZiu0wrxR6fcZrJLOwkGq6LE70p5+lebLqiiK6uTg2EnSAzrRdTYFn t7EN7MkzlBIG1o6ygB18S//zc8L4y8KIPUzSMTShOyuAfcjMEZHppI5YvkTx4mRFSOPW 5eylIKQsxCWy9cB9Dkxq5IftosZc6fB8FFsYMqrXUDoch8NqTpNWpMWT2koioQJRMJu5 24/fzp0xZ8qtrxAF6Q6NvEcSsP5P7pry3Uyonf4ATCihyZnbd7VyNfRiyJMOmHGB/+4o wSvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h18si15521071otj.114.2020.01.17.05.03.42; Fri, 17 Jan 2020 05:03:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726942AbgAQNAu (ORCPT + 99 others); Fri, 17 Jan 2020 08:00:50 -0500 Received: from 8bytes.org ([81.169.241.247]:60168 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726688AbgAQNAu (ORCPT ); Fri, 17 Jan 2020 08:00:50 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id D1DF9327; Fri, 17 Jan 2020 14:00:48 +0100 (CET) Date: Fri, 17 Jan 2020 14:00:47 +0100 From: Joerg Roedel To: Tom Lendacky Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Brijesh Singh , stable@vger.kernel.org Subject: Re: [PATCH] x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained Message-ID: <20200117130047.GA3685@8bytes.org> References: <226de90a703c3c0be5a49565047905ac4e94e8f3.1579125915.git.thomas.lendacky@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <226de90a703c3c0be5a49565047905ac4e94e8f3.1579125915.git.thomas.lendacky@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: # 4.16.x- > Signed-off-by: Tom Lendacky Reviewed-by: Joerg Roedel > --- > 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