]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86: nSVM: Clear VMCB_NPT clean bit when updating hPAT from guest mode
authorJim Mattson <jmattson@google.com>
Tue, 7 Apr 2026 19:03:25 +0000 (12:03 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 14 May 2026 12:45:09 +0000 (05:45 -0700)
commit0a8aeb15848ea1c873fd20e1ad3aeba689aeafa8
tree3bc019557c0ee5463beab2c0f73cd09a17aa5c6d
parent822790ab01495d67b14174063ba46fcc19ff0aa8
KVM: x86: nSVM: Clear VMCB_NPT clean bit when updating hPAT from guest mode

When running an L2 guest and writing to MSR_IA32_CR_PAT, the host PAT value
is stored in both vmcb01's g_pat field and vmcb02's g_pat field, but the
clean bit was only being cleared for vmcb02.

Introduce the helper vmcb_set_gpat() which sets vmcb->save.g_pat and marks
the VMCB dirty for VMCB_NPT. Use this helper in both svm_set_msr() for
updating vmcb01 and in nested_vmcb02_compute_g_pat() for updating vmcb02,
ensuring both VMCBs' NPT fields are properly marked dirty.

Fixes: 4995a3685f1b ("KVM: SVM: Use a separate vmcb for the nested L2 guest")
Signed-off-by: Jim Mattson <jmattson@google.com>
Link: https://patch.msgid.link/20260407190343.325299-3-jmattson@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/nested.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm.h