Re: [PATCH 20/22] KVM: SVM: enable GMET and set it in MMU role

From: Paolo Bonzini

Date: Wed Mar 25 2026 - 05:33:56 EST


On Wed, Mar 25, 2026 at 10:26 AM Nikunj A. Dadhania <nikunj@xxxxxxx> wrote:
>
>
>
> On 3/21/2026 5:39 AM, Paolo Bonzini wrote:
> > @@ -1184,6 +1187,10 @@ static void init_vmcb(struct kvm_vcpu *vcpu)
> > save->g_pat = vcpu->arch.pat;
> > save->cr3 = 0;
> > }
> > +
> > + if (gmet_enabled)
>
> if (gmet_enabled && guest_cpu_cap_has(vcpu, X86_FEATURE_GMET))

No, this is the non-nested case (vmcb01) and I'm enabling GMET on
purpose for easier testing.

guest_cpu_cap_has(GMET) only matters for nested guests and is added by patch 22:

vmcb02->control.nested_ctl &= ~SVM_NESTED_CTL_GMET_ENABLE;
if (guest_cpu_cap_has(vcpu, X86_FEATURE_GMET))
vmcb02->control.nested_ctl |=
(svm->nested.ctl.nested_ctl & SVM_NESTED_CTL_GMET_ENABLE);

Paolo