kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Gardon <bgardon@google.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Robert Hu <robert.hu@intel.com>,
	Farrah Chen <farrah.chen@intel.com>,
	Danmei Wei <danmei.wei@intel.com>,
	Ben Gardon <bgardon@google.com>,
	kernel test robot <lkp@intel.com>
Subject: [PATCH 1/2] KVM: x86/mmu: Wrap kvm_mmu_zap_all_fast TDP MMU code in ifdefs
Date: Mon, 19 Apr 2021 11:37:41 -0700	[thread overview]
Message-ID: <20210419183742.901647-1-bgardon@google.com> (raw)

The TDP MMU code in kvm_mmu_zap_all_fast is only needed with
CONFIG_X86_64 and creates a build error without that setting. Since the
TDP MMU can only be enabled with CONFIG_X86_64, wrap those code blocks
in ifdefs.

Fixes: 1336c692abad ("KVM: x86/mmu: Fast invalidation for TDP MMU")

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Ben Gardon <bgardon@google.com>
---
 arch/x86/kvm/mmu/mmu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 0f311c9bf9c6..3ae59c8e129b 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5407,7 +5407,9 @@ static void kvm_zap_obsolete_pages(struct kvm *kvm)
  */
 static void kvm_mmu_zap_all_fast(struct kvm *kvm)
 {
+#ifdef CONFIG_X86_64
 	struct kvm_mmu_page *root;
+#endif /* CONFIG_X86_64 */
 
 	lockdep_assert_held(&kvm->slots_lock);
 
@@ -5424,6 +5426,7 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
 	kvm->arch.mmu_valid_gen = kvm->arch.mmu_valid_gen ? 0 : 1;
 
 
+#ifdef CONFIG_X86_64
 	if (is_tdp_mmu_enabled(kvm)) {
 		/*
 		 * Mark each TDP MMU root as invalid so that other threads
@@ -5456,6 +5459,7 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
 			if (refcount_inc_not_zero(&root->tdp_mmu_root_count))
 				root->role.invalid = true;
 	}
+#endif /* CONFIG_X86_64 */
 
 	/*
 	 * Notify all vcpus to reload its shadow page table and flush TLB.
@@ -5471,11 +5475,13 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
 
 	write_unlock(&kvm->mmu_lock);
 
+#ifdef CONFIG_X86_64
 	if (is_tdp_mmu_enabled(kvm)) {
 		read_lock(&kvm->mmu_lock);
 		kvm_tdp_mmu_zap_invalidated_roots(kvm);
 		read_unlock(&kvm->mmu_lock);
 	}
+#endif /* CONFIG_X86_64 */
 }
 
 static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm)
-- 
2.31.1.368.gbe11c130af-goog


             reply	other threads:[~2021-04-19 18:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 18:37 Ben Gardon [this message]
2021-04-19 18:37 ` [PATCH 2/2] KVM: x86/mmu: Fix typo in for_each_tdp_mmu_root Ben Gardon

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=20210419183742.901647-1-bgardon@google.com \
    --to=bgardon@google.com \
    --cc=danmei.wei@intel.com \
    --cc=farrah.chen@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=robert.hu@intel.com \
    --cc=seanjc@google.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;
as well as URLs for NNTP newsgroup(s).