Re: [PATCH v4 6/6] KVM: x86: Refactor __kvm_emulate_hypercall() into a macro

From: Paolo Bonzini
Date: Thu Dec 12 2024 - 10:46:23 EST


On 12/12/24 08:32, Adrian Hunter wrote:
On 10/12/24 22:03, Sean Christopherson wrote:
What I do deeply care about though is consistency within KVM, across vendors and
VM flavors. And that means that guest registers absolutely need to be captured in
vcpu->arch.regs[].

In general, TDX host VMM does not know what guest register
values are.

This case, where some GPRs are passed to the host VMM via
arguments of the TDG.VP.VMCALL TDCALL, is really just a
side effect of the choice of argument passing rather than
any attempt to share guest registers with the host VMM.

It could be regarded as more consistent to never use
vcpu->arch.regs[] for confidential guests.

Yes, that's where I stand as well. There's reasons to use vcpu->arch.regs[] when "decrypted" values are available, and reasons to not use it at all. Both of them could be considered the more consistent choice, and I think I prefer slightly the latter, but it's definitely not a hill to die on...

Paolo