Re: [PATCH v4 1/9] KVM: x86: Intercept CR4.LAM_SUP when LAM feature is enabled in guest

Robert Hoo
2023-02-14T12:24:17Z

On Tue, 2023-02-14 at 17:00 +0800, Binbin Wu wrote:
> According to the code of set_cr4_guest_host_mask,
> vcpu->arch.cr4_guest_owned_bits is a subset of
> KVM_POSSIBLE_CR4_GUEST_BITS,
> and X86_CR4_LAM_SUP is not included in KVM_POSSIBLE_CR4_GUEST_BITS.
> No matter change CR4_RESERVED_BITS or not, X86_CR4_LAM_SUP will
> always be set in CR4_GUEST_HOST_MASK.
>
>
set_cr4_guest_host_mask():
vcpu->arch.cr4_guest_owned_bits = KVM_POSSIBLE_CR4_GUEST_BITS &
~vcpu->arch.cr4_guest_rsvd_bits;

kvm_vcpu_after_set_cpuid():
vcpu->arch.cr4_guest_rsvd_bits =
__cr4_reserved_bits(guest_cpuid_has, vcpu);