All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] x86/vmx: Skip LAM CR3 bits in 32-bit guest reserved bit tests
@ 2026-07-07  7:02 Xudong Hao
  2026-09-02  8:54 ` Hao, Xudong
  2026-09-08 13:24 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Xudong Hao @ 2026-07-07  7:02 UTC (permalink / raw)
  To: pbonzini, kvm; +Cc: Xudong Hao

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH kvm-unit-tests] x86/vmx: Skip LAM CR3 bits in 32-bit guest reserved bit tests
  2026-07-07  7:02 [PATCH kvm-unit-tests] x86/vmx: Skip LAM CR3 bits in 32-bit guest reserved bit tests Xudong Hao
@ 2026-09-02  8:54 ` Hao, Xudong
  2026-09-08 13:24 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Hao, Xudong @ 2026-09-02  8:54 UTC (permalink / raw)
  To: Xudong Hao, pbonzini; +Cc: kvm



On 7/7/2026 3:02 PM, Xudong Hao wrote:
> 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");
>   	}

Hi Paolo,

Can you help to review this patch?

-Xudong

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH kvm-unit-tests] x86/vmx: Skip LAM CR3 bits in 32-bit guest reserved bit tests
  2026-07-07  7:02 [PATCH kvm-unit-tests] x86/vmx: Skip LAM CR3 bits in 32-bit guest reserved bit tests Xudong Hao
  2026-09-02  8:54 ` Hao, Xudong
@ 2026-09-08 13:24 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2026-09-08 13:24 UTC (permalink / raw)
  To: Xudong Hao; +Cc: kvm

On Tue, Jul 7, 2026 at 9:03 AM Xudong Hao <xudong.hao@intel.com> wrote:
>
> 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>

Applied, thanks.

Paolo

> ---
>  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
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-08 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07  7:02 [PATCH kvm-unit-tests] x86/vmx: Skip LAM CR3 bits in 32-bit guest reserved bit tests Xudong Hao
2026-09-02  8:54 ` Hao, Xudong
2026-09-08 13:24 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.