[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <832e87d1-8349-47f8-b1dc-33768b534b10@zytor.com>
Date: Fri, 13 Dec 2024 10:43:49 -0800
From: Xin Li <xin@...or.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Chao Gao <chao.gao@...el.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
pbonzini@...hat.com, corbet@....net, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
x86@...nel.org, hpa@...or.com, luto@...nel.org, peterz@...radead.org,
andrew.cooper3@...rix.com
Subject: Re: [PATCH v3 17/27] KVM: x86: Mark CR4.FRED as not reserved when
guest can use FRED
On 12/12/2024 11:05 AM, Sean Christopherson wrote:
> On Thu, Dec 12, 2024, Xin Li wrote:
>> On 10/24/2024 12:18 AM, Chao Gao wrote:
>>>> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>>>> index 03f42b218554..bfdd10773136 100644
>>>> --- a/arch/x86/kvm/vmx/vmx.c
>>>> +++ b/arch/x86/kvm/vmx/vmx.c
>>>> @@ -8009,6 +8009,10 @@ void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
>>>> kvm_governed_feature_check_and_set(vcpu, X86_FEATURE_LAM);
>>>> kvm_governed_feature_check_and_set(vcpu, X86_FEATURE_FRED);
>>>>
>>>> + /* Don't allow CR4.FRED=1 before all of FRED KVM support is in place. */
>>>> + if (!guest_can_use(vcpu, X86_FEATURE_FRED))
>>>> + vcpu->arch.cr4_guest_rsvd_bits |= X86_CR4_FRED;
>>>
>>> is this necessary? __kvm_is_valid_cr4() ensures that guests cannot set any bit
>>> which isn't supported by the hardware.
>>>
>>> To account for hardware/KVM caps, I think the following changes will work. This
>>> will fix all other bits besides X86_CR4_FRED.
>>
>> This seems a generic infra improvement, maybe it's better for you to
>> send it as an individual patch to Sean and the KVM mailing list?
>
> Already ahead of y'all :-) (I think, I didn't look closely at this).
>
> https://lore.kernel.org/all/20241128013424.4096668-6-seanjc@google.com
Ha, that is nice. Thank you!
Powered by blists - more mailing lists