Re: [PATCH v8 0/8] KVM: x86: nSVM: Improve PAT virtualization
From: Yosry Ahmed
Date: Wed May 20 2026 - 22:36:35 EST
On Wed, May 20, 2026 at 08:30:31PM +0000, Yosry Ahmed wrote:
> On Mon, May 18, 2026 at 05:41:06PM -0700, Sean Christopherson wrote:
> > On Tue, 07 Apr 2026 12:03:23 -0700, Jim Mattson wrote:
> > > Currently, KVM's implementation of nested SVM treats the PAT MSR the same
> > > way whether or not nested NPT is enabled: L1 and L2 share a single
> > > PAT. However, the AMD APM specifies that when nested NPT is enabled, the host
> > > (L1) and the guest (L2) should have independent PATs: hPAT for L1 and gPAT
> > > for L2.
> > >
> > > This patch series implements independent PATs for L1 and L2 when nested NPT
> > > is enabled, but only when a new quirk, KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT,
> > > is disabled. By default, the quirk is enabled, preserving KVM's legacy
> > > behavior. When the quirk is disabled, KVM correctly virtualizes a separate
> > > PAT register for L2, using the g_pat field in the VMCB.
> > >
> > > [...]
> >
> > Applied to kvm-x86 svm. Yosry and/or Jim, please double check the result, the
> > goof with patch 5 was slightly more annoying than I was expecting.
>
> The result looks good to me. I also ran the selftest from v7 and it
> passes. I couldn't help myself from reworking it and cleaning it up, I
> will send a patch your way soon.
As promised, if you want something you can directly run against the
current kvm-x86 svm:
https://lore.kernel.org/kvm/20260521023448.3826878-1-yosry@xxxxxxxxxx/