From nobody Sun Feb 8 17:42:55 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65CC032694D for ; Thu, 15 Jan 2026 23:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768519344; cv=none; b=LdlfIg42I1q7REqEDIZ4FMidndwC6ftzdK1v1KWronKoLgY5oo22ltjJ8uimA34Mb+wzRC68494UtkQgYz8QfTlQphoxNtnNULhIycKtBNvlgXbZaNKT+ET21Z/zO1srkf3QIw+lXsdHfEf819Juve4okI1fFcgR2GzM6YKZ6xQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768519344; c=relaxed/simple; bh=n9VuXnyas8RzAVq5FNPFG4pbXM3KIqWWE1kNwMcTCbA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=B/YCR/HGjtNrkP7UQVdXU3BzN8b8/aE/iGH2bMLOnXaiG0hEgGbGc4E4kuVp/WCWBG+9lJT9PInqree9TiR9H1yauS//ysR87zxB2iMRnug6TYhAmGfNJGKzqX+9bA8hGI11FZd3CHrL11Ber4kSrGJP8TKeriLEh6dkZxN8T4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jmattson.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TmIyEX/D; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jmattson.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TmIyEX/D" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2a351686c17so13662265ad.0 for ; Thu, 15 Jan 2026 15:22:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768519340; x=1769124140; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=c/zBrN190qohWKUBRuSYnE9mFnTLenfIQq4Uzz5XlzA=; b=TmIyEX/DYynmIOIJ4etW66jP19V46ZK2mcXN1ZcRtJ+ganeVyCMBbNdWn0USfMTJB/ VMGEx/rFp5LAWZxOdZvq4u3KJ79sGTJqrXhSAVTdlV4rxZY+ekd7izHDUkulnv3PD/g3 /z2owod91ZUuwcOIAPVyopqmyz/zsPD/6ERIaaWaCNldtR3PhxrHguxN6S5evrumJ3rc SRcykru2Sc4waO82Nf64Gw3sOOuGw08aLjB1btnk3wPpuuMXmvJymDZLvLWJlvQ900sU Z7Lpq/eICv6YwaydWOBVjn2/v1HEGkKqn0W4K3gkYBWzCjdXeCojvynoK00ee4uSUneu SVSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768519340; x=1769124140; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c/zBrN190qohWKUBRuSYnE9mFnTLenfIQq4Uzz5XlzA=; b=IeegdLuMVhiyM6FiqykhPi1oc9X5YLPO7jlUIou0KRQzqYNnCXstp+bVOY9sw8Vhi+ lLdjv3XZZtcTw2XsDxAxsHelzDznQPdMqjcva0FPFJAYcJFF03azGJwsB1MJmA+EGrZM UYFH8eUe7ZY97c9A+qNV/oGdZHei5mNzvZ6MyvUU3VeNu6a0+A/z1GDzRsuXVsVWxBjx qPecdqstdG+QcegLPNN5KyjeRYCtPkY6pFxsc9xqCvnVRgeKXUGIpF8TMG1pf5uYI/HP N0LUezVGo0ZTvAbLUfiy9hicxI50YmmmhPh9ZHN4OPQ1iBg95mYXby1IJc83WQemKUaZ FP4Q== X-Forwarded-Encrypted: i=1; AJvYcCUHENFuxaYgYaFG3MEN2urFFkh73uwLmla0bwePZS1aVx1NrzlnfKAl+OByF8d2RGc4WstEhX9nf9p06c0=@vger.kernel.org X-Gm-Message-State: AOJu0Ywk+zNqn1AxHTObJfmz5lANxoxDyEz+bd4Y7EENFqUddBU94MxI JwZ/2sce4U7PtovaORMOHRPrfw45jf2kaBHJsVkG7jnRjwBjSNyfhK7zjfxDLTAPP2sVuDIGCpU AHoSMMv90stzOAw== X-Received: from plcl20.prod.google.com ([2002:a17:902:e2d4:b0:2a0:9fe7:eaa6]) (user=jmattson job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:f685:b0:2a1:3ee7:cc75 with SMTP id d9443c01a7336-2a717539460mr9150535ad.19.1768519339675; Thu, 15 Jan 2026 15:22:19 -0800 (PST) Date: Thu, 15 Jan 2026 15:21:44 -0800 In-Reply-To: <20260115232154.3021475-1-jmattson@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260115232154.3021475-1-jmattson@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260115232154.3021475-6-jmattson@google.com> Subject: [PATCH v2 5/8] KVM: x86: nSVM: Save gPAT to vmcb12.g_pat on VMEXIT From: Jim Mattson To: Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Shuah Khan , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Jim Mattson Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" According to the APM volume 3 pseudo-code for "VMRUN," when nested paging is enabled in the vmcb, the guest PAT register (gPAT) is saved to the vmcb on emulated VMEXIT. Under KVM, the guest PAT register lives in the vmcb02 g_pat field. Save this value to the vmcb12 g_pat field on emulated VMEXIT. Fixes: 15038e147247 ("KVM: SVM: obey guest PAT") Signed-off-by: Jim Mattson --- arch/x86/kvm/svm/nested.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index b0c0184e6e24..5fb31faf2b46 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1189,6 +1189,9 @@ int nested_svm_vmexit(struct vcpu_svm *svm) vmcb12->save.dr6 =3D svm->vcpu.arch.dr6; vmcb12->save.cpl =3D vmcb02->save.cpl; =20 + if (nested_npt_enabled(svm)) + vmcb12->save.g_pat =3D svm->vmcb->save.g_pat; + if (guest_cpu_cap_has(vcpu, X86_FEATURE_SHSTK)) { vmcb12->save.s_cet =3D vmcb02->save.s_cet; vmcb12->save.isst_addr =3D vmcb02->save.isst_addr; --=20 2.52.0.457.g6b5491de43-goog