Re: [PATCH v2 07/10] KVM: x86: Always populate L1 GPA for KVM_MAP_MEMORY

From: Edgecombe, Rick P
Date: Tue Apr 16 2024 - 13:12:25 EST


On Wed, 2024-04-10 at 15:07 -0700, isaku.yamahata@xxxxxxxxx wrote:
> +       /* Force to use L1 GPA despite of vcpu MMU mode. */
> +       is_smm = !!(vcpu->arch.hflags & HF_SMM_MASK);
> +       if (is_smm ||
> +           vcpu->arch.mmu != &vcpu->arch.root_mmu ||
> +           vcpu->arch.walk_mmu != &vcpu->arch.root_mmu) {
> +               vcpu->arch.hflags &= ~HF_SMM_MASK;

0-day informs me that the definition for HF_SMM_MASK depends on CONFIG_KVM_SMM.

> +               mmu = vcpu->arch.mmu;
> +               walk_mmu = vcpu->arch.walk_mmu;
> +               vcpu->arch.mmu = &vcpu->arch.root_mmu;
> +               vcpu->arch.walk_mmu = &vcpu->arch.root_mmu;
> +               kvm_mmu_reset_context(vcpu);
> +       }
> +