From nobody Thu Apr 2 09:34:01 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.2]) (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 0E72C1DDA24; Thu, 12 Feb 2026 10:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770893160; cv=none; b=QgRfAOqT8l6h88VFt64uP2pDWW5EwBIDdgpyVGecDAZiQwC3WMx9IM+GE+YzuJN6+Mq+4ifNQ9jNbrDzHYTvVIMwgQ4c3r3rlJShr9k4qFQj53SrohJkj8dxyBUPeGKN0jV44YCO8006Aj65kIh6oGrvkHxX1CLKEnMW2FtB9WI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770893160; c=relaxed/simple; bh=Q9lBOtUg68sa9iMHgSNiQwBdqiC8tpa9sl++GN3qSZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lhSbglCUu2uOqfxYfxOsE7CY6bxHdC/xQxHB8RiwEi9HaJso2vesMRFRiSPH2wsXindN5vwi6+YVSWjRfKTjC8rzUqeId0ktFvipxjzQ302VKbOT22n1kbkn+XHgEX1h2i5d3qbx8fjlgPSfvVMbkhodY4M416QIMII0723Di4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=g5BOpCOI; arc=none smtp.client-ip=220.197.31.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="g5BOpCOI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=qe ccGjVLjUuQaSbBstJwiQOfIWq48EFo6VoO+Gt3HtY=; b=g5BOpCOIBd4ujm+v3L bACpaRc4XLiIdpWizPIMP45pgaMItayZldkEpD6iG3XzjnJ04WTtuiRftr7BWZMK yoRqefmKMad48OXCC6niAAiYBrr+24xej+NOxwcprMNKq34fl84Rkja9Jqx/JOrt EzXktG0bNSJgKBomI1Nnux+dE= Received: from 163.com (unknown []) by gzga-smtp-mtada-g0-4 (Coremail) with SMTP id _____wA38f4Tr41pL2eqLA--.10527S6; Thu, 12 Feb 2026 18:44:43 +0800 (CST) From: Zhiquan Li To: seanjc@google.com, pbonzini@redhat.com, shuah@kernel.org Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, zhiquan_li@163.com, stable@vger.kernel.org Subject: [PATCH v2 4/4] KVM: selftests: Fix reserved value WRMSR testcase for multi-feature MSRs Date: Thu, 12 Feb 2026 18:38:41 +0800 Message-ID: <20260212103841.171459-5-zhiquan_li@163.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212103841.171459-1-zhiquan_li@163.com> References: <20260212103841.171459-1-zhiquan_li@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wA38f4Tr41pL2eqLA--.10527S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kw1ktFW8WF48KrWfXryrZwb_yoW8Ar1kpa n3Jr40kr93Ka4fAayxGF4xXF18ZFnrWr40gF1Fy3srZF15Ja4xZw1xKay5Aas3urWSq3y3 Zas2gw1j9a1DJaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pEqg4hUUUUU= X-CM-SenderInfo: 52kl13xdqbzxi6rwjhhfrp/xtbCwhuvmGmNrxvmkQAA3J Content-Type: text/plain; charset="utf-8" From: Sean Christopherson When determining whether or not a WRMSR with reserved bits will #GP or succeed due to the WRMSR not existing per the guest virtual CPU model, expect failure if and only if _all_ features associated with the MSR are unsupported. Checking only the primary feature results in false failures when running on AMD and Hygon CPUs with only one of RDPID or RDTSCP, as AMD/Hygon CPUs ignore MSR_TSC_AUX[63:32], i.e. don't treat the bits as reserved, and so #GP only if the MSR is unsupported. Fixes: 9c38ddb3df94 ("KVM: selftests: Add an MSR test to exercise guest/hos= t and read/write") Reported-by: Zhiquan Li Closes: https://lore.kernel.org/all/20260209041305.64906-6-zhiquan_li@163.c= om Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/x86/msrs_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/x86/msrs_test.c b/tools/testing/se= lftests/kvm/x86/msrs_test.c index 4c97444fdefe..f7e39bf887ad 100644 --- a/tools/testing/selftests/kvm/x86/msrs_test.c +++ b/tools/testing/selftests/kvm/x86/msrs_test.c @@ -175,7 +175,7 @@ void guest_test_reserved_val(const struct kvm_msr *msr) * If the CPU will truncate the written value (e.g. SYSENTER on AMD), * expect success and a truncated value, not #GP. */ - if (!this_cpu_has(msr->feature) || + if ((!this_cpu_has(msr->feature) && !this_cpu_has(msr->feature2)) || msr->rsvd_val =3D=3D fixup_rdmsr_val(msr->index, msr->rsvd_val)) { u8 vec =3D wrmsr_safe(msr->index, msr->rsvd_val); =20 --=20 2.43.0