On Fri, Aug 28, 2026 at 10:31:14AM +0800, Xiaoyao Li wrote:
> > 
> > Hmm... This makes me wonder if vm->arch.s_bit below could be replaced
> > with the same architectural approach. GPAW is available through
> > TDG.VP.INFO or the initial RBX value. This does require a bit more
> > plumbing though.
> 
> I'm afraid not. Because below is host code, and vm->arch.s_bit is not used
> in guest code.
> 
> Or are suggesting something like dropping the
> 
>       if (is_tdx_vm(vm)) {
>               ucall_mmio_gpa = UCALL_MMIO_GPA | vm->arch.s_bit;
>               sync_global_to_guest(vm, ucall_mmio_gpa);
>       }
> 
> entirely and use below hardcoded value instead in guest code?
> 
>       UCALL_MMIO_GPA | 1 << (GPAW - 1)

Yeah this is what I meant. Just drop sync_global_to_guest() entirely and
do things like a normal TDX guest would.

> 
> > > 
> > > > +       if (is_tdx_vm(vm)) {
> > > > +               ucall_mmio_gpa = UCALL_MMIO_GPA | vm->arch.s_bit;
> > > 
> > > So the passed-in @mmio_gpa is not used. Why cannot use the mmio_gpa,
> > > 
> > >    slot0->region.guest_phys_addr + slot0->region.memory_size
> > > 
> > > chosen by __vm_create()?
> > 
> > Looks like this was discussed previously [1]. Maybe at least a comment
> > here would help?
> 
> yeah. A comment surely will help.
> 
> > [1] https://lore.kernel.org/all/[email protected]/
> > 
> > > 
> 

Reply via email to