[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 2/3] kvm: add support for guest physical bits
From: |
Gerd Hoffmann |
Subject: |
Re: [PATCH v3 2/3] kvm: add support for guest physical bits |
Date: |
Mon, 18 Mar 2024 16:50:39 +0100 |
Hi,
> > diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c
> > index 9c791b7b0520..a2b7bfaeadf8 100644
> > --- a/target/i386/kvm/kvm-cpu.c
> > +++ b/target/i386/kvm/kvm-cpu.c
> > @@ -18,10 +18,36 @@
> > #include "kvm_i386.h"
> > #include "hw/core/accel-cpu.h"
> > +static void kvm_set_guest_phys_bits(CPUState *cs)
> > +{
> > + X86CPU *cpu = X86_CPU(cs);
> > + uint32_t eax, guest_phys_bits;
> > +
> > + if (!cpu->host_phys_bits) {
> > + return;
> > + }
>
> This needs explanation of why. What if users set the phys-bits to exactly
> host's value, via "-cpu xxx,phys-bits=host's value"?
If host_phys_bits is not enabled it is possible to set phys-bits to any
value today (including invalid values not supported by the host). With
this the same applies to guest_phys_bits.
My intention was to continue allowing any guest_phys_bits + phys_bits
with TCG, for testing purposes. But thinking again this logic is
flawed, if TCG is used the control flow doesn't land here in the first
place.
So, I think this can be dropped.
> > + ret = host_cpu_realizefn(cs, errp);
>
> We need to check ret and return if !ret;
Fixed.
thanks,
Gerd