From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.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 4D3B9387350 for ; Tue, 7 Apr 2026 23:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775605954; cv=none; b=AZFyU4mdrcAPeV/J1NO62LZWE76pn1zjYrYPOUBQBBfl24GNmqb8q/hfvyjW+fDeu4lcm1nH8j6nZGZ7DubkoYTdSIisLpC89NO8Zscdgmtj1isn1Z/hdlRXRPXOV4hiFYWD7jkhkKuDBdzTC7Ra2r3L7JXjl1cDZlmh8Mu+sWg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775605954; c=relaxed/simple; bh=SdsNngXjH3hSHT9gMgfDRt8l0hAzE4oAuI9Clo4mOaQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VPRW0XYZGI5U6ADsQ0rFC88o2hlG2q0P/oZ69787Phsj7Yr5E9daD04BrXw3Ai9Va2jhD21NtAg1xtWghnJEqr6Icc+5DJarHeBTzpcidIQPkpS0OagjGh3aXPu2rh+MF3OsxOtbE/dCeZQUi93DLHMqApUOyfS2zShUpw+cIIw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=t+A9uukX; arc=none smtp.client-ip=209.85.210.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--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="t+A9uukX" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-82ce50e6e28so3876884b3a.2 for ; Tue, 07 Apr 2026 16:52:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775605952; x=1776210752; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=Iz2WszebLY+x/oGqa2xe58ntUzkUx8FiRFvZTUBudmU=; b=t+A9uukXvH97+MHaPGfBtAxvV8gY0p+zyJia22Mki8ZTOoK5+RuklL3KQXDrUe52oH VtqYh7Y1gHO3dvwMLGNnEY5xBhdON6g2EMH1N7WFNDgCNxWKI/O2LMttSIgmFxxTxoVq m5lLQI02QQBHXM7f1WVj1sCupmglkdjVI8fR1dIsY468lRd0wFKCCz7gMt1SO6zLUDB1 qqh+y6IiV1sxFNmBVTBxktBHToLfqGaMj6VYQMdLSPnfpK8erZE8opuSr55qhz3W/Om2 rCJicNqFy86kHat6hta8Sbf3cJDp6KMcCotGiS3XDtDQtf/V8IE942CJNf4E95drTACx 5nTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775605952; x=1776210752; h=content-transfer-encoding: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=Iz2WszebLY+x/oGqa2xe58ntUzkUx8FiRFvZTUBudmU=; b=BKankDvfAMdbMd99CJf+t91Q7jPj2UYXwtMS4mkzZUZB3rJme61o3QV+AD8khSURr1 5HVpc3AV5QZ1vaM0rAOSqHEULSSbHURdpmv/sBE3QLSven4Q7Ljx3k1qm/3WKLoa3gZx xAJ3hpztChsOn8cxiAbox7AysVL7k/4ZGZfYJeLg+M+im0HkPYJUbh8VahKV17JqFv1a Vf07hMbOy/5f5m46pUApgogBCp2cAVh7emLP3ZzcqsQOJrZ852AFyvo05SKNGypiOJYZ CwfwfjGzP3fl+fjvPR3qRs5jaQk3ckn3twaNGm4oKr3h8FBi/3bNrqIG6b0nA0/fvBCx tIeQ== X-Forwarded-Encrypted: i=1; AJvYcCWxFtQDn4KjSdhtGjODAcRu7WIp3X5heQfBUwe8QIKQT9nn6ODIMmEM7XxFLffS085cN7d9pUpIGG0D9O8=@vger.kernel.org X-Gm-Message-State: AOJu0Yxm0XxK5SXraX+TokYledmPYeWQJpSyoCjAetkGpT2D83AS45Kk 7uVzPPwqBTq0WvWbTId96EL6BmzaQdjTXZaIePyyJZy5aUszC2NlqaO2vwPAG7vXyg3tnSpLmVU PTPUrTg== X-Received: from pfcp1.prod.google.com ([2002:a05:6a00:a241:b0:82c:5b7c:f4ce]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:4c14:b0:82c:2480:4e95 with SMTP id d2e1a72fcca58-82d0db4fcaamr17900679b3a.33.1775605952332; Tue, 07 Apr 2026 16:52:32 -0700 (PDT) Date: Tue, 7 Apr 2026 16:52:31 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260407190343.325299-1-jmattson@google.com> <20260407190343.325299-6-jmattson@google.com> Message-ID: Subject: Re: [PATCH] KVM: x86: nSVM: Redirect IA32_PAT accesses to either hPAT or gPAT From: Sean Christopherson To: Jim Mattson Cc: Paolo Bonzini , Jonathan Corbet , Shuah Khan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 07, 2026, Jim Mattson wrote: > On Tue, Apr 7, 2026 at 12:24=E2=80=AFPM Sean Christopherson wrote: > > > > On Tue, Apr 07, 2026, Jim Mattson wrote: > > > When KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT is disabled and the vCPU is = in > > > guest mode with nested NPT enabled, guest accesses to IA32_PAT are > > > redirected to the gPAT register, which is stored in VMCB02's g_pat fi= eld. > > > > > > Non-guest accesses (e.g. from userspace) to IA32_PAT are always redir= ected > > > to hPAT, which is stored in vcpu->arch.pat. > > > > > > Directing host-initiated accesses to hPAT ensures that KVM_GET/SET_MS= RS and > > > KVM_GET/SET_NESTED_STATE are independent of each other and can be ord= ered > > > arbitrarily during save and restore. gPAT is saved and restored separ= ately > > > via KVM_GET/SET_NESTED_STATE. > > > > > > Use WARN_ON_ONCE to flag any host-initiated accesses originating from= KVM > > > itself rather than userspace. > > > > > > Use pr_warn_once to flag any use of the common MSR-handling code (now > > > shared by VMX and TDX) for IA32_PAT by a vCPU that is SVM-capable. > > > > Changelog is stale, but otherwise this LGTM. I'll fixup the changelog = when > > applying (in a few weeks). >=20 > Oh, crud. This was supposed to be 5/8, but I made some changes after > checkpatch.pl complained and then tried to just regenerate this one, > but I totally flubbed it. Huh. The patch shows up when I grab the thread via b4 mbox and open it wit= h mutt, but b4 am skips it. I'm guessing there's version-based filtering somewhere= in b4. No need for a v9 on my account, I can splice in 5/8 when applying.