Re: [PATCH v6 34/60] i386/tdx: implement tdx_cpu_realizefn()

Daniel P. Berrangé
2025-01-14T13:10:55Z

On Tue, Jan 14, 2025 at 04:52:07PM +0800, Xiaoyao Li wrote:
> On 12/13/2024 6:04 AM, Ira Weiny wrote:
> > On Tue, Nov 05, 2024 at 12:53:25PM +0100, Paolo Bonzini wrote:
> > > On 11/5/24 12:38, Xiaoyao Li wrote:
> > > > On 11/5/2024 6:06 PM, Paolo Bonzini wrote:
> > > > > On 11/5/24 07:23, Xiaoyao Li wrote:
> > > > > > +static void tdx_cpu_realizefn(X86ConfidentialGuest *cg, CPUState *cs,
> > > > > > +                              Error **errp)
> > > > > > +{
> > > > > > +    X86CPU *cpu = X86_CPU(cs);
> > > > > > +    uint32_t host_phys_bits = host_cpu_phys_bits();
> > > > > > +
> > > > > > +    if (!cpu->phys_bits) {
> > > > > > +        cpu->phys_bits = host_phys_bits;
> > > > > > +    } else if (cpu->phys_bits != host_phys_bits) {
> > > > > > +        error_setg(errp, "TDX only supports host physical bits (%u)",
> > > > > > +                   host_phys_bits);

If keeping this check in next version of the patches, for improved debugging,
can you include both values here eg something like

error_setg(errp, "TDX requires guest CPU physical bits (%u) "
"to match host CPU physical bits (%u)",
cpu->phys_bits, host_phys_bits);

With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|