Skip to contentSkip to conversation

x86: Force host-phys-bits for normal maxphyaddr access tests

PATCH Applied Sean Christopherson 1 participant 2 messages Aug 23, 2024 – Feb 24, 2025 KVM

lore
Share & tools
lore

Sean Christopherson

author reviewer
#0 lore raw

PATCH 1/1 x86: Force host-phys-bits for normal maxphyaddr access tests

Explicitly force host-phys-bits for the access tests that intends to run with the host's MAXPHYADDR, as QEMU only forces host-phys-bits for "max" CPUs as of version 6.0 (see commit 5a140b255d ("x86/cpu: Use max host physical address if -cpu max option is applied")).

Running the access test with an older QEMU, e.g. 5.3, on a CPU with MAXPHYADDR=52 and allow_smaller_maxphyaddr=N (i.e. with TDP enabled) fails miserably as the test isn't aware that bit 51 is a legal physical address bit.

Amusingly, the KVM-Unit-Test appears to pre-date the QEMU change by a few months, which suggests that the KVM-Unit-Test change was made without proper testing, and the QEMU change was made to fix the problem.

Fixes 11cec501 ("x86: cover emulation of reduced MAXPHYADDR")
---
 x86/unittests.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
x86/unittests.cfg +2 -2
index 7c1691a9..6a60bd11 100644
@@ -126,12 +126,12 @@ groups = vmexit
 [access]
 file = access_test.flat
 arch = x86_64
-extra_params = -cpu max
+extra_params = -cpu max,host-phys-bits
 
 [access_fep]
 file = access_test.flat
 arch = x86_64
-extra_params = -cpu max -append force_emulation
+extra_params = -cpu max,host-phys-bits -append force_emulation
 groups = nodefault
 timeout = 240
 

base-commit: 6b801c8981f74d75419d77e031dd37f5ad356efe

Signature · 1 line
2.46.0.295.g3b9ea8a38a-goog
author reviewer Applied
#1 lore raw
Quoted 11 lines · Sean Christopherson

Explicitly force host-phys-bits for the access tests that intends to run with the host's MAXPHYADDR, as QEMU only forces host-phys-bits for "max" CPUs as of version 6.0 (see commit 5a140b255d ("x86/cpu: Use max host physical address if -cpu max option is applied")).

Running the access test with an older QEMU, e.g. 5.3, on a CPU with MAXPHYADDR=52 and allow_smaller_maxphyaddr=N (i.e. with TDP enabled) fails miserably as the test isn't aware that bit 51 is a legal physical address bit.

[...]

Applied to kvm-x86 next (and now pulled by Paolo). Thanks!

[1/1] x86: Force host-phys-bits for normal maxphyaddr access tests

      https://github.com/kvm-x86/kvm-unit-tests/commit/b8e135d6bb48

--
https://github.com/kvm-x86/kvm-unit-tests/tree/next