Re: [PATCH v2 1/6] KVM: SVM: Use maxphyaddr in emulator RAX check for VMRUN/VMLOAD/VMSAVE

From: Yosry Ahmed

Date: Fri Mar 06 2026 - 19:32:19 EST


> > > >
> > > > Note that virtual VMLOAD/VMSAVE cannot be used if the guest's
> > > > maxphyaddr doesn't match the host's maxphyaddr.
> > >
> > > Not sure what you mean? Do you mean it wouldn't be correct to use it?
> > > AFAICT that doesn't prevent it from being enabled.
>
> It does, actually. KVM doesn't support allow_smaller_maxphyaddr when NPT is
> enabled, because AMD CPUs (and now some Intel CPUs, lolz) do A/D updates before
> signalling the reserved #NPF.
>
> allow_smaller_maxphyaddr = !npt_enabled;
>
>
> And vls is disabled if NPT is disabled, for all the reasons Jim is pointing out.
>
> if (vls) {
> if (!npt_enabled ||
> !boot_cpu_has(X86_FEATURE_V_VMSAVE_VMLOAD) ||
> !IS_ENABLED(CONFIG_X86_64)) {
> vls = false;
> } else {
> pr_info("Virtual VMLOAD VMSAVE supported\n");
> }
> }
>
> Thus running with allow_smaller_maxphyaddr+vls is impossible.

Oh, well never mind then.. :)

Will switch to cpuid_maxphyaddr(vcpu) in the next version (assuming
there's one).