Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4819072ybl; Wed, 22 Jan 2020 05:21:26 -0800 (PST) X-Google-Smtp-Source: APXvYqwr3dCI2aY/UgzVUpSc5Lx01tmgTq5AwDdId1JHPuk8xjNcoVAHSYamjYrkDNoUoRpmrfJ7 X-Received: by 2002:a05:6830:4ca:: with SMTP id s10mr7323917otd.268.1579699285704; Wed, 22 Jan 2020 05:21:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699285; cv=none; d=google.com; s=arc-20160816; b=JKaALvckMg7HlAzBkgAtW8jFQzmsPVugY4n5X7waVhCINjKQ7g/Fb+RaCD5m71FcbD U6FZ58E0uvmMkvEZ1H3/dNYZKVvOSE4Mz7Gr2nSEqQ2W9doyC9lKraL1sHmizt0BeIIk RbFvt26LLd8ad9ZvXe/KAPKaqy7ntaRkkyIQVeJxXlPy+LSJ8ovDDS4PDcKxn3Va9rMA PijKk7spQ7r26OXGH7Kh3PtHFjMa7N3qngfPrCZSygiOFmju8uHBI1B+7voI+GcIiZW7 Eks5kksP0HtWYEWQnw3tjjGkNlZJqO1F5YMFK1hB3Yfgqdim6JOJgg3IpRidb+tR25Tc jqVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6bUoHce40PK+J3obYx5EdjLuqkGupcuqyMJXjTCltm4=; b=VmMmSqhvE7hjKZMYEc7/VmyHXFLKF3wVVKBQMHc2k9KFM5STOJLY27mNhBpZNIZbDu W/8RCHTmHKK2Kq8sid9ku7h8N3YjqoN6casHGfvh1BzzpqXc7scqiZFsIiD4tf5ZvuqF tcrgEkITlc247RWCWHMpTNEx9SSmiAZm3YaAfTEDWHH+porI9I7zwOJaCYopSKT+JksT 9zFZF4qbZ9oRMCATODLyWa/hgJTFeHjGLs/JlmhJzQUZlHAvIhE6pNQ4mgnTQmUrJ2Jd vfb2my+Jb/HD6JNm4Q6+rrsmEYZ2Ubarbxj2xn42CCj66QboSXAx6GQYWiz/FGFHJQAt s/4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p0PhzQ38; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l26si24661659otn.48.2020.01.22.05.21.14; Wed, 22 Jan 2020 05:21:25 -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; dkim=pass header.i=@kernel.org header.s=default header.b=p0PhzQ38; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729764AbgAVNTj (ORCPT + 99 others); Wed, 22 Jan 2020 08:19:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:35606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729732AbgAVNTh (ORCPT ); Wed, 22 Jan 2020 08:19:37 -0500 Received: from localhost (unknown [84.241.205.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CFA0324685; Wed, 22 Jan 2020 13:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699177; bh=4mZaHo6CGGEjhoLAyszHVHx7u6Ppbk9GFGCtN7ajr8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0PhzQ381w7pDeE3XHyMn3qRghTCqr/VroqC3Dl7czhNl+ox+QRa4JIC8Virti+JZ BcxgffppOVG1GDwOCWpKUXcc1kZdUYfsuA6UWMdA5mv8vs+2d+x3ymKmUkqzn6WBnj KPJLG6i9YkWgztpMcU/V9ymNhdvsi6WoSrd7lKSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , Borislav Petkov Subject: [PATCH 5.4 063/222] x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained Date: Wed, 22 Jan 2020 10:27:29 +0100 Message-Id: <20200122092838.232080512@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Lendacky commit a006483b2f97af685f0e60f3a547c9ad4c9b9e94 upstream. If the SME and SEV features are present via CPUID, but memory encryption support is not enabled (MSR 0xC001_0010[23]), the feature flags are cleared using clear_cpu_cap(). However, if get_cpu_cap() is later called, these feature flags 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 flags is maintained. Signed-off-by: Tom Lendacky Signed-off-by: Borislav Petkov Cc: # 4.16.x- Link: https://lkml.kernel.org/r/226de90a703c3c0be5a49565047905ac4e94e8f3.1579125915.git.thomas.lendacky@amd.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/amd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -615,9 +615,9 @@ static void early_detect_mem_encrypt(str 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); } }