Re: [PATCH V2 07/12] KVM: TDX: restore host xsave state when exit from the guest TD

Xiaoyao Li
2025-02-28T01:58:51Z

On 2/27/2025 10:29 PM, Adrian Hunter wrote:
>>>   +    vcpu->arch.cr4 = ~vcpu->arch.cr4_guest_rsvd_bits;
>> when userspace doesn't configure XFEATURE_MASK_PKRU in XFAM, it seems kvm_load_host_xsave_state() will skip restore host's PKRU value.
> That's correct.

FYI, in this case, it's safe and functional though
kvm_load_host_xsave_state() skips restoring the host's PKRU value.
Because host's PKRU is not clobbered after TD exit when XFAM.PKU is 0.
So no need to restore.