From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/8] KVM: x86/mmu: Use separate namespaces gPTEs and SPTEs
Date: Mon, 13 Jun 2022 22:57:15 +0000 [thread overview]
Message-ID: <20220613225723.2734132-1-seanjc@google.com> (raw)
Clean up the x86 MMU code to use separate namespaces for guest PTEs and
shadow PTEs. While there is most definitely overlap, especially in
attribute bits, the rules for walking gPTEs and for generating/walking
SPTEs differ in subtle ways, e.g. see commit fc9bf2e087ef ("KVM: x86/mmu:
Do not apply HPA (memory encryption) mask to GPAs"). The paging32 macros
in particular should never be used outside of paging_tmpl.h.
Separating gPTEs from SPTEs actually provides for nice cleanups (see the
diffstat) as KVM has ended up with a fair bit of copy+paste code that can
be deduplicated once KVM isn't trying to use PT64_* defines for both gPTEs
and SPTEs.
This is a spiritual successor to patches 4-7 of the series[*] that added
the aformentenioned commit.
[*] https://lore.kernel.org/all/20210623230552.4027702-1-seanjc@google.com
Sean Christopherson (8):
KVM: x86/mmu: Drop unused CMPXCHG macro from paging_tmpl.h
KVM: VMX: Refactor 32-bit PSE PT creation to avoid using MMU macro
KVM: x86/mmu: Bury 32-bit PSE paging helpers in paging_tmpl.h
KVM: x86/mmu: Dedup macros for computing various page table masks
KVM: x86/mmu: Use separate namespaces for guest PTEs and shadow PTEs
KVM: x86/mmu: Use common macros to compute 32/64-bit paging masks
KVM: x86/mmu: Truncate paging32's PT_BASE_ADDR_MASK to 32 bits
KVM: x86/mmu: Use common logic for computing the 32/64-bit base PA
mask
arch/x86/kvm/mmu.h | 10 ------
arch/x86/kvm/mmu/mmu.c | 64 ++++++++-------------------------
arch/x86/kvm/mmu/mmu_internal.h | 17 +++++++++
arch/x86/kvm/mmu/paging.h | 14 --------
arch/x86/kvm/mmu/paging_tmpl.h | 56 ++++++++++++++++-------------
arch/x86/kvm/mmu/spte.c | 2 +-
arch/x86/kvm/mmu/spte.h | 28 +++++++--------
arch/x86/kvm/mmu/tdp_iter.c | 6 ++--
arch/x86/kvm/mmu/tdp_mmu.c | 6 ++--
arch/x86/kvm/vmx/vmx.c | 2 +-
10 files changed, 83 insertions(+), 122 deletions(-)
delete mode 100644 arch/x86/kvm/mmu/paging.h
base-commit: 8baacf67c76c560fed954ac972b63e6e59a6fba0
--
2.36.1.476.g0c4daa206d-goog
next reply other threads:[~2022-06-13 22:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 22:57 Sean Christopherson [this message]
2022-06-13 22:57 ` [PATCH 1/8] KVM: x86/mmu: Drop unused CMPXCHG macro from paging_tmpl.h Sean Christopherson
2022-06-14 2:13 ` Lai Jiangshan
2022-06-14 14:31 ` Sean Christopherson
2022-06-14 17:12 ` Paolo Bonzini
2022-06-14 17:10 ` Paolo Bonzini
2022-06-13 22:57 ` [PATCH 2/8] KVM: VMX: Refactor 32-bit PSE PT creation to avoid using MMU macro Sean Christopherson
2022-06-13 22:57 ` [PATCH 3/8] KVM: x86/mmu: Bury 32-bit PSE paging helpers in paging_tmpl.h Sean Christopherson
2022-06-14 2:20 ` Lai Jiangshan
2022-06-14 14:25 ` Sean Christopherson
2022-06-13 22:57 ` [PATCH 4/8] KVM: x86/mmu: Dedup macros for computing various page table masks Sean Christopherson
2022-06-13 22:57 ` [PATCH 5/8] KVM: x86/mmu: Use separate namespaces for guest PTEs and shadow PTEs Sean Christopherson
2022-06-13 22:57 ` [PATCH 6/8] KVM: x86/mmu: Use common macros to compute 32/64-bit paging masks Sean Christopherson
2022-06-13 22:57 ` [PATCH 7/8] KVM: x86/mmu: Truncate paging32's PT_BASE_ADDR_MASK to 32 bits Sean Christopherson
2022-06-13 22:57 ` [PATCH 8/8] KVM: x86/mmu: Use common logic for computing the 32/64-bit base PA mask Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220613225723.2734132-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®