[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/15] mips: define pud_index() regardless of page table folding
From: |
Huacai Chen |
Subject: |
[PATCH 01/15] mips: define pud_index() regardless of page table folding |
Date: |
Mon, 13 Apr 2020 15:30:10 +0800 |
From: Mike Rapoport <address@hidden>
Commit 31168f033e37 ("mips: drop __pXd_offset() macros that duplicate
pXd_index() ones") 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. This has broken MIPS KVM
compilation because it relied on availability of pud_index().
Define pud_index() regardless of page table folded. It will evaluate to
actual index for 4-level pagetables and to 0 for folded PUD level.
Link: https://lore.kernel.org/lkml/address@hidden
Tested-by: Bibo Mao <address@hidden>
Tested-by: Huacai Chen <address@hidden>
Reported-by: Paolo Bonzini <address@hidden>
Signed-off-by: Mike Rapoport <address@hidden>
[Huacai: Add Tested-by and take this patch into my series, because my
series can't build an available kernel if without this patch.]
Signed-off-by: Huacai Chen <address@hidden>
---
arch/mips/include/asm/pgtable-64.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/include/asm/pgtable-64.h
b/arch/mips/include/asm/pgtable-64.h
index f92716c..ee5dc0c 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -172,6 +172,8 @@
extern pte_t invalid_pte_table[PTRS_PER_PTE];
+#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
+
#ifndef __PAGETABLE_PUD_FOLDED
/*
* For 4-level pagetables we defines these ourselves, for 3-level the
@@ -210,8 +212,6 @@ static inline void p4d_clear(p4d_t *p4dp)
p4d_val(*p4dp) = (unsigned long)invalid_pud_table;
}
-#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
-
static inline unsigned long p4d_page_vaddr(p4d_t p4d)
{
return p4d_val(p4d);
--
2.7.0
- [PATCH 0/15] KVM: MIPS: Add Loongson-3 support (Host Side), Huacai Chen, 2020/04/13
- [PATCH 01/15] mips: define pud_index() regardless of page table folding,
Huacai Chen <=
- [PATCH 02/15] KVM: MIPS: Define KVM_ENTRYHI_ASID to cpu_asid_mask(&boot_cpu_data), Huacai Chen, 2020/04/13
- [PATCH 03/15] KVM: MIPS: Fix VPN2_MASK definition for variable cpu_vmbits, Huacai Chen, 2020/04/13
- [PATCH 04/15] KVM: MIPS: Increase KVM_MAX_VCPUS and KVM_USER_MEM_SLOTS to 16, Huacai Chen, 2020/04/13
- [PATCH 05/15] KVM: MIPS: Add EVENTFD support which is needed by VHOST, Huacai Chen, 2020/04/13
- [PATCH 06/15] KVM: MIPS: Use lddir/ldpte instructions to lookup gpa_mm.pgd, Huacai Chen, 2020/04/13
- [PATCH 07/15] KVM: MIPS: Introduce and use cpu_guest_has_ldpte, Huacai Chen, 2020/04/13