Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp474838rdh; Wed, 7 Feb 2024 10:01:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxqojf9FV59c9vZ936oviGiIrgTLm7/SzjecZTBfLQOMpBFV3gWFY74mkCi1slm80y4Wdb X-Received: by 2002:a05:620a:1787:b0:785:9046:f66c with SMTP id ay7-20020a05620a178700b007859046f66cmr6721465qkb.75.1707328887970; Wed, 07 Feb 2024 10:01:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707328887; cv=pass; d=google.com; s=arc-20160816; b=mQO2HsfZv7FVBqofwSL4a5AZJkzrQ1HOZgNhSTdsXdv9EjSldOqzzggvx1VhMZXM91 aSb3COmYDMpoTcVuGczMXKJKl9BufuH/8AcukGRrPD1p484V8mvMkFs717TVdLRI0Srt TYzldStDzBNSo/cwUmYFcb5QC86vGAH8mEBEd2fGiI9mzkExDn74N7+HsfcEdLWAk+gI WMlZgfhxNzbFV2Zrzdv1gWZ5P4RVYGdKMnyD2Rsn4z/KzboK3vcPTyqvzyBZoKKfNhAj xpybPc0PrY8SiMhGhbNkC/Yw6bKCqFPeIMOWah44plOZM6sryHDNZigaHDEPbYIfYoXA xjeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nWPYB9eeGVBVZF3HehvyjJcetS3097sYt9v/f076u80=; fh=Ux6PPHePH7/xSPsN52koW+yznrgW4rGsygeyupkahg8=; b=NMqPd096MUStRLPPR+lXow0CwlBBtG7BzPV+dOhGhkx9kyCi1mhbA+hBwhF3Yd25bi SUv95oJCPzaVVi0KaKwlEZMAh2cLryNAg+dsqXKj5xACzz+CoCCSCw67YNDgVAe86VjG +x5Eqthe8MNDSboPYkAJOhrVmRjZylfZaKW4u9cbogQSbu2GH7kD8phimGKSfln9mX5D A8QniCJw3XdljSUejjL+W4WGRHhd7bmOx/koJoEalWLGAp94NB0/d6HiEk8UQ+yqhlhN VU14eHuMGmp9mbMFLIlIefKZHxLXi27LbweXNdJ5visddhJZOYvuaXGFlD2KtcHJiDBg DSKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OuxLvb5J; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-56857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVV8n3dIpoUT+uNeL0GlBhW9JXgOlWqnKdR3ngfOFoLnXm5b8r1yT7VfZ17eUGV0/Y15UsuEThYkMn+KbYVNNc0iS/omkePHP3E8ONFZw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y3-20020a05620a44c300b00785950307cbsi1632833qkp.698.2024.02.07.10.01.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 10:01:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OuxLvb5J; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-56857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8D86F1C26C68 for ; Wed, 7 Feb 2024 18:00:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2768686120; Wed, 7 Feb 2024 17:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OuxLvb5J" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE91D82D91; Wed, 7 Feb 2024 17:59:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707328746; cv=none; b=seoSVQBdB2HnzsYIFezNX7uXixxz4EJU8JUrcPtdjFYR3OTM7ekSQelnlSBKqkklz5vI4ft+b0En8fAbi4SeKoo3Fq4BYUU+QvLZAkrCPUHjrSyqgUyEPe9ss2oSI7vdYTafdLmLj5Q+nsrVH6LQmf9VNOP4tlvWE7Ztubx0PUQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707328746; c=relaxed/simple; bh=7KPmwPclT/FKLhFcFWIDWM27z0VWKv0aw6taF2QMvjE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SLUnv0zKSfRbuqORWU4bP7oDZZAwp5RPmbSj4MQuWEPiK90K2peKt7aTTvuNaQM/9uCKQGsgnkiZTsa+WF7c2aPXROYqGu7ap9yLUti+H09F4+M/ZPpLBcovuDWndkbCjI9l/6v++rYdxSrxGP+mDoom2yJ50kuGr+LbSzYIaXo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OuxLvb5J; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707328741; x=1738864741; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7KPmwPclT/FKLhFcFWIDWM27z0VWKv0aw6taF2QMvjE=; b=OuxLvb5J4PGsbqTzqonWOqpzQRnc1b29hErnPSClGKwV4tejtHIV+83d 4MOskxdxS+wkMWcDLTVLKnXinwcPbkrzH0RicnMdG1JD5VN3eyaOPJ/Ua JlgWHExdHv0b5q46D8lPMp/Ks5amFPzuqF6qe0fPjfhoc7we87rPRw3nx YPI/+Gh0/tIYV/vJabx79ReIKicK4SOuAhUFQFSIidCM8pnJ9vrS8KWoE 6hUCwoz5ChBsazKwjgA8Gy0xC8IO9LFFBTxHQYqHJQoNpYtRm+Hn391GD yowMjIc7tRC9VFfpPSkEsUBFqHcp4gKwCVL9gDPe2mLbfIB40hGXBAXnF A==; X-IronPort-AV: E=McAfee;i="6600,9927,10977"; a="11622517" X-IronPort-AV: E=Sophos;i="6.05,251,1701158400"; d="scan'208";a="11622517" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2024 09:58:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,251,1701158400"; d="scan'208";a="6020704" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmviesa004.fm.intel.com with ESMTP; 07 Feb 2024 09:58:54 -0800 From: Xin Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: seanjc@google.com, pbonzini@redhat.com, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, shuah@kernel.org, vkuznets@redhat.com, peterz@infradead.org, ravi.v.shankar@intel.com, xin@zytor.com Subject: [PATCH v2 04/25] KVM: x86: Mark CR4.FRED as not reserved Date: Wed, 7 Feb 2024 09:26:24 -0800 Message-ID: <20240207172646.3981-5-xin3.li@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207172646.3981-1-xin3.li@intel.com> References: <20240207172646.3981-1-xin3.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The CR4.FRED bit, i.e., CR4[32], is no longer a reserved bit when a guest enumerates FRED, otherwise it is still a reserved bit. Signed-off-by: Xin Li Tested-by: Shan Kang --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/x86.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index b5b2d0fde579..0d88873eba63 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -134,7 +134,7 @@ | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \ | X86_CR4_OSXMMEXCPT | X86_CR4_LA57 | X86_CR4_VMXE \ | X86_CR4_SMAP | X86_CR4_PKE | X86_CR4_UMIP \ - | X86_CR4_LAM_SUP)) + | X86_CR4_LAM_SUP | X86_CR4_FRED)) #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 2f7e19166658..9a52016ebf5a 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -532,6 +532,8 @@ bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type); __reserved_bits |= X86_CR4_PCIDE; \ if (!__cpu_has(__c, X86_FEATURE_LAM)) \ __reserved_bits |= X86_CR4_LAM_SUP; \ + if (!__cpu_has(__c, X86_FEATURE_FRED)) \ + __reserved_bits |= X86_CR4_FRED; \ __reserved_bits; \ }) -- 2.43.0