On Wed, Nov 23, 2022 at 10:25:11PM +0800, Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx> wrote: > > On 10/30/2022 2:23 PM, isaku.yamahata@xxxxxxxxx wrote: > > From: Isaku Yamahata <isaku.yamahata@xxxxxxxxx> > > > > Implements set_msr/get_msr/has_emulated_msr methods for TDX to handle > > hypercall from guest TD for paravirtualized rdmsr and wrmsr. The TDX > > module virtualizes MSRs. For some MSRs, it injects #VE to the guest TD > > upon RDMSR or WRMSR. The exact list of such MSRs are defined in the spec. > > How does KVM handle the case that the userland wants to get the TD MSR list? > > KVM_GET_MSR_INDEX_LIST will return the global KVM MSR list, which is > different from the TD version. Do you mean user space VMM (e.g. qemu) by "the userland"? There are three classes of MSRs virtualization. - non-configurable: TDX module directly virtualizes it. VMM can't configure. the value set by KVM_SET_MSR_INDEX_LIST is ignored. - configurable: TDX module directly virtualizes it. VMM can configure at the VM creation time. the value set by KVM_SET_MSR_INDEX_LIST is used. - #VE VMM handles the MSR hypercall by guest TD issues. The value set by KVM_SET_MSR_INDEX_LIST is used. > > Upon #VE, the guest TD may execute hypercalls, > > TDG.VP.VMCALL<INSTRUCTION.RDMSR> and TDG.VP.VMCALL<INSTRUCTION.WRMSR>, > > which are defined in GHCI (Guest-Host Communication Interface) so that the > > host VMM (e.g. KVM) can virtualizes > can virtualize Yes, will fix. -- Isaku Yamahata <isaku.yamahata@xxxxxxxxx>