Browse Source

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>
master
Anton Johansson 8 months ago
committed by Philippe Mathieu-Daudé
parent
commit
ab7a864082
  1. 9
      target/i386/cpu.c
  2. 3
      target/i386/kvm/kvm.c
  3. 2
      target/i386/tcg/helper-tcg.h

9
target/i386/cpu.c

@ -9941,12 +9941,9 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
* accel-specific code in cpu_exec_realizefn.
*/
if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) {
if (cpu->phys_bits &&
(cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS ||
cpu->phys_bits < 32)) {
error_setg(errp, "phys-bits should be between 32 and %u "
" (but is %u)",
TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits);
if (cpu->phys_bits && cpu->phys_bits < 32) {
error_setg(errp, "phys-bits should be at least 32"
" (but is %u)", cpu->phys_bits);
return;
}
/*

3
target/i386/kvm/kvm.c

@ -4983,8 +4983,7 @@ static int kvm_get_msrs(X86CPU *cpu)
*/
if (cpu->fill_mtrr_mask) {
QEMU_BUILD_BUG_ON(TARGET_PHYS_ADDR_SPACE_BITS > 52);
assert(cpu->phys_bits <= TARGET_PHYS_ADDR_SPACE_BITS);
assert(cpu->phys_bits <= 52);
mtrr_top_bits = MAKE_64BIT_MASK(cpu->phys_bits, 52 - cpu->phys_bits);
} else {
mtrr_top_bits = 0;

2
target/i386/tcg/helper-tcg.h

@ -31,8 +31,6 @@
# define TCG_PHYS_ADDR_BITS 36
#endif
QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS);
/**
* x86_cpu_do_interrupt:
* @cpu: vCPU the interrupt is to be handled by.

Loading…
Cancel
Save