Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Xudong Hao <xudong.hao@intel.com>
To: pbonzini@redhat.com, kvm@vger.kernel.org
Cc: Xudong Hao <xudong.hao@intel.com>
Subject: [PATCH kvm-unit-tests] x86/vmx: Skip LAM CR3 bits in 32-bit guest reserved bit tests
Date: Tue,  7 Jul 2026 07:02:40 +0000	[thread overview]
Message-ID: <20260707070240.78295-1-xudong.hao@intel.com> (raw)

According to Intel SDM 4.4.1 "Linear-Address Masking" (LAM), CR3 bits
61 (LAM_U57) and 62 (LAM_U48) are LAM control bits, not reserved. Skip
the LAM control bits in the CR3 reserved-bit loops when LAM is
supported for vmx_pae_test and vmx_pse_test.

Fixes: 55b77db1 ("vmx: add a test for 32-bit guest PAE paging PDPTEs")
Fixes: feef9d92 ("vmx: add test for 32-bit non-PAE guest")

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
---
 x86/vmx_tests.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 16f8a648..2c0feca0 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -5896,6 +5896,11 @@ static void test_vmx_guest_pdptes(u64 cr3, u64 *pdpt)
 	}
 
 	for (b = cpuid_maxphyaddr(); b < 64; b++) {
+		/* CR3 bits 61 and 62 are LAM control bits, not reserved. */
+		if (this_cpu_has(X86_FEATURE_LAM) &&
+		    (b == X86_CR3_LAM_U57_BIT || b == X86_CR3_LAM_U48_BIT))
+			continue;
+
 		vmx_32bit_guest_init_common(cr3 | (1ull << b), pdpt);
 		test_guest_state("CR3 reserved bit", true, (1ull << b), "bit");
 	}
@@ -5979,6 +5984,11 @@ static void vmx_pse_test(void)
 	}
 
 	for (b = cpuid_maxphyaddr(); b < 64; b++) {
+		/* CR3 bits 61 and 62 are LAM control bits, not reserved. */
+		if (this_cpu_has(X86_FEATURE_LAM) &&
+		    (b == X86_CR3_LAM_U57_BIT || b == X86_CR3_LAM_U48_BIT))
+			continue;
+
 		vmx_32bit_guest_init_common(cr3 | (1ull << b), NULL);
 		test_guest_state("CR3 reserved bit", true, (1ull << b), "bit");
 	}
-- 
2.52.0


                 reply	other threads:[~2026-07-07  7:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260707070240.78295-1-xudong.hao@intel.com \
    --to=xudong.hao@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox