@samitouri / QOSamiQemu / commits / ab7a864082

target/i386: Drop physical address range checks

Since TARGET_PHYS_ADDR_SPACE_BITS is now fixed to 64 bits for all targets we can remove range checks on cpu->phys_bits and TCG_PHYS_ADDR_BITS. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Anton Johansson <anjo@rev.ng> Message-ID: <20260218-phys_addr-v6-3-a603bf363218@rev.ng> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Anton Johansson committed Dec 9, 2025 at 14:56 UTC ab7a864082a21475ca4dab7bf286539ca0a85b8b
3 files changed +4 -10
target/i386/cpu.c
+3 -6
@@ -9941,12 +9941,9 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
9941 * accel-specific code in cpu_exec_realizefn.
9942 */
9943 if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) {
9944 - if (cpu->phys_bits &&
9945 - (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS ||
9946 - cpu->phys_bits < 32)) {
9947 - error_setg(errp, "phys-bits should be between 32 and %u "
9948 - " (but is %u)",
9949 - TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits);
9944 + if (cpu->phys_bits && cpu->phys_bits < 32) {
9945 + error_setg(errp, "phys-bits should be at least 32"
9946 + " (but is %u)", cpu->phys_bits);
9947 return;
9948 }
9949 /*
target/i386/kvm/kvm.c
+1 -2
@@ -4983,8 +4983,7 @@ static int kvm_get_msrs(X86CPU *cpu)
4983 */
4984
4985 if (cpu->fill_mtrr_mask) {
4986 - QEMU_BUILD_BUG_ON(TARGET_PHYS_ADDR_SPACE_BITS > 52);
4987 - assert(cpu->phys_bits <= TARGET_PHYS_ADDR_SPACE_BITS);
4986 + assert(cpu->phys_bits <= 52);
4987 mtrr_top_bits = MAKE_64BIT_MASK(cpu->phys_bits, 52 - cpu->phys_bits);
4988 } else {
4989 mtrr_top_bits = 0;
target/i386/tcg/helper-tcg.h
-2
@@ -31,8 +31,6 @@
31 # define TCG_PHYS_ADDR_BITS 36
32 #endif
33
34 -QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS);
35 -
34 /**
35 * x86_cpu_do_interrupt:
36 * @cpu: vCPU the interrupt is to be handled by.