Re: [PATCH 1/7] KVM: SVM: Initialize FRED VMCB fields
From: Shivansh Dhiman
Date: Mon Mar 09 2026 - 13:51:02 EST
Hey Sean,
On 07-03-2026 07:28, Sean Christopherson wrote:
> On Thu, Jan 29, 2026, Shivansh Dhiman wrote:
>> From: Neeraj Upadhyay <Neeraj.Upadhyay@xxxxxxx>
>>
>> The upcoming AMD FRED (Flexible Return and Event Delivery) feature
>> introduces several new fields to the VMCB save area. These fields include
>> FRED-specific stack pointers (fred_rsp[0-3], fred_ssp[1-3]), stack level
>> tracking (fred_stklvls), and configuration (fred_config).
>>
>> Ensure that a vCPU starts with a clean and valid FRED state on
>> capable hardware. Also update the size of save areas of VMCB.
>
>> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
>> index f4ccb3e66635..5cec971a1f5a 100644
>> --- a/arch/x86/kvm/svm/svm.c
>> +++ b/arch/x86/kvm/svm/svm.c
>> @@ -1110,6 +1110,16 @@ static void init_vmcb(struct kvm_vcpu *vcpu, bool init_event)
>> save->idtr.base = 0;
>> save->idtr.limit = 0xffff;
>>
>> + save->fred_rsp0 = 0;
>> + save->fred_rsp1 = 0;
>> + save->fred_rsp2 = 0;
>> + save->fred_rsp3 = 0;
>> + save->fred_stklvls = 0;
>> + save->fred_ssp1 = 0;
>> + save->fred_ssp2 = 0;
>> + save->fred_ssp3 = 0;
>> + save->fred_config = 0;
>
> Is this architecturally correct? I.e. are all the FRED MSRs zeroed on INIT?
Yes that's right, the FRED MSRs are zeroed on init.
- Shivansh