On Fri, Feb 13, 2026 at 07:20:28AM -0800, Sean Christopherson wrote:
> Please trim your replies. Scrolling through 100+ lines of quoted text to find
> the ~12 lines of context that actually matter is annoying.
Ack.
> Actually, calling svm_set_l2_pat() when !is_guest_mode() is wrong too, no?
> E.g.
> shouldn't we end up with this?
legacy_gpat_semantics should only be set in guest mode, and it's cleared
in pre-run, so before we can exit guest mode IIUC. But having the guard
in place for both cases is probably simpler anyway.
>
> static inline void svm_set_l1_pat(struct vcpu_svm *svm, u64 data)
> {
> svm->vcpu.arch.pat = data;
>
> if (npt_enabled)
> return;
>
> vmcb_set_gpat(svm->vmcb01.ptr, data);
>
> if (is_guest_mode(&svm->vcpu)) {
> if (svm->nested.legacy_gpat_semantics)
> svm_set_l2_pat(svm, data);
> else if (!nested_npt_enabled(svm))
> vmcb_set_gpat(svm->nested.vmcb02.ptr, data);
> }
> }
>