On Thu, 8 May 2025 15:35:36 +0200 Philippe Mathieu-Daudé <phi...@linaro.org> wrote:
> The CPUX86State::fill_mtrr_mask boolean was only disabled > for the pc-q35-2.6 and pc-i440fx-2.6 machines, which got > removed. Being now always %true, we can remove it and simplify > kvm_get_msrs(). > > Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> > --- > target/i386/cpu.h | 3 --- > target/i386/cpu.c | 1 - > target/i386/kvm/kvm.c | 10 +++------- > 3 files changed, 3 insertions(+), 11 deletions(-) > > diff --git a/target/i386/cpu.h b/target/i386/cpu.h > index 06817a31cf9..7585407da54 100644 > --- a/target/i386/cpu.h > +++ b/target/i386/cpu.h > @@ -2253,9 +2253,6 @@ struct ArchCPU { > /* Enable auto level-increase for Intel Processor Trace leave */ > bool intel_pt_auto_level; > > - /* if true fill the top bits of the MTRR_PHYSMASKn variable range */ > - bool fill_mtrr_mask; > - > /* if true override the phys_bits value with a value read from the host > */ > bool host_phys_bits; > > diff --git a/target/i386/cpu.c b/target/i386/cpu.c > index 6fe37f71b1e..fb505d13122 100644 > --- a/target/i386/cpu.c > +++ b/target/i386/cpu.c > @@ -8810,7 +8810,6 @@ static const Property x86_cpu_properties[] = { > DEFINE_PROP_UINT32("guest-phys-bits", X86CPU, guest_phys_bits, -1), > DEFINE_PROP_BOOL("host-phys-bits", X86CPU, host_phys_bits, false), > DEFINE_PROP_UINT8("host-phys-bits-limit", X86CPU, host_phys_bits_limit, > 0), > - DEFINE_PROP_BOOL("fill-mtrr-mask", X86CPU, fill_mtrr_mask, true), same as previous patch, deprecate 1st then remove > DEFINE_PROP_UINT32("level-func7", X86CPU, env.cpuid_level_func7, > UINT32_MAX), > DEFINE_PROP_UINT32("level", X86CPU, env.cpuid_level, UINT32_MAX), > diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c > index c9a3c02e3e3..87edce99e85 100644 > --- a/target/i386/kvm/kvm.c > +++ b/target/i386/kvm/kvm.c > @@ -4635,13 +4635,9 @@ static int kvm_get_msrs(X86CPU *cpu) > * we're migrating to. > */ > > - if (cpu->fill_mtrr_mask) { > - QEMU_BUILD_BUG_ON(TARGET_PHYS_ADDR_SPACE_BITS > 52); > - assert(cpu->phys_bits <= TARGET_PHYS_ADDR_SPACE_BITS); > - mtrr_top_bits = MAKE_64BIT_MASK(cpu->phys_bits, 52 - cpu->phys_bits); > - } else { > - mtrr_top_bits = 0; > - } > + QEMU_BUILD_BUG_ON(TARGET_PHYS_ADDR_SPACE_BITS > 52); > + assert(cpu->phys_bits <= TARGET_PHYS_ADDR_SPACE_BITS); > + mtrr_top_bits = MAKE_64BIT_MASK(cpu->phys_bits, 52 - cpu->phys_bits); > > for (i = 0; i < ret; i++) { > uint32_t index = msrs[i].index;