All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: linux-mips@vger.kernel.org, peterx@redhat.com, rppt@linux.ibm.com
Subject: [PATCH] KVM: MIPS: fix compilation
Date: Tue, 31 Mar 2020 11:47:49 -0400	[thread overview]
Message-ID: <20200331154749.5457-1-pbonzini@redhat.com> (raw)

Commit 31168f033e37 is correct that pud_index() & __pud_offset() are the same
when pud_index() is actually provided, however it does not take into account
the __PAGETABLE_PUD_FOLDED case.  Provide kvm_pud_index so that MIPS KVM
compiles.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/mips/kvm/mmu.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
index 7dad7a293eae..ccf98c22fd2c 100644
--- a/arch/mips/kvm/mmu.c
+++ b/arch/mips/kvm/mmu.c
@@ -25,6 +25,12 @@
 #define KVM_MMU_CACHE_MIN_PAGES 2
 #endif
 
+#if defined(__PAGETABLE_PUD_FOLDED)
+#define kvm_pud_index(gva) 0
+#else
+#define kvm_pud_index(gva) pud_index(gva)
+#endif
+
 static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
 				  int min, int max)
 {
@@ -234,8 +240,8 @@ static bool kvm_mips_flush_gpa_pud(pud_t *pud, unsigned long start_gpa,
 {
 	pmd_t *pmd;
 	unsigned long end = ~0ul;
-	int i_min = pud_index(start_gpa);
-	int i_max = pud_index(end_gpa);
+	int i_min = kvm_pud_index(start_gpa);
+	int i_max = kvm_pud_index(end_gpa);
 	bool safe_to_remove = (i_min == 0 && i_max == PTRS_PER_PUD - 1);
 	int i;
 
@@ -361,8 +367,8 @@ static int kvm_mips_##name##_pud(pud_t *pud, unsigned long start,	\
 	int ret = 0;							\
 	pmd_t *pmd;							\
 	unsigned long cur_end = ~0ul;					\
-	int i_min = pud_index(start);				\
-	int i_max = pud_index(end);					\
+	int i_min = kvm_pud_index(start);				\
+	int i_max = kvm_pud_index(end);					\
 	int i;								\
 									\
 	for (i = i_min; i <= i_max; ++i, start = 0) {			\
@@ -896,8 +902,8 @@ static bool kvm_mips_flush_gva_pud(pud_t *pud, unsigned long start_gva,
 {
 	pmd_t *pmd;
 	unsigned long end = ~0ul;
-	int i_min = pud_index(start_gva);
-	int i_max = pud_index(end_gva);
+	int i_min = kvm_pud_index(start_gva);
+	int i_max = kvm_pud_index(end_gva);
 	bool safe_to_remove = (i_min == 0 && i_max == PTRS_PER_PUD - 1);
 	int i;
 
-- 
2.18.2


             reply	other threads:[~2020-03-31 15:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 15:47 Paolo Bonzini [this message]
2020-03-31 16:07 ` [PATCH] KVM: MIPS: fix compilation Mike Rapoport
2020-03-31 16:33   ` Paolo Bonzini
2020-04-01  6:33     ` maobibo
2020-04-01 10:20 ` Sergei Shtylyov

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=20200331154749.5457-1-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=peterx@redhat.com \
    --cc=rppt@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.