From patchwork Wed Feb 7 17:26:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 771714 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OuxLvb5J" 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-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Chao Gao --- 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; \ })