Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'asm-generic-fixes-5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

Pull asm-generic fix from Arnd Bergmann:
"Add correct MAX_POSSIBLE_PHYSMEM_BITS setting to asm-generic.

This is a single bugfix for a bug that Stefan Agner found on 32-bit
Arm, but that exists on several other architectures"

* tag 'asm-generic-fixes-5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
arch: pgtable: define MAX_POSSIBLE_PHYSMEM_BITS where needed

+28
+2
arch/arc/include/asm/pgtable.h
··· 134 134 135 135 #ifdef CONFIG_ARC_HAS_PAE40 136 136 #define PTE_BITS_NON_RWX_IN_PD1 (0xff00000000 | PAGE_MASK | _PAGE_CACHEABLE) 137 + #define MAX_POSSIBLE_PHYSMEM_BITS 40 137 138 #else 138 139 #define PTE_BITS_NON_RWX_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE) 140 + #define MAX_POSSIBLE_PHYSMEM_BITS 32 139 141 #endif 140 142 141 143 /**************************************************************************
+2
arch/arm/include/asm/pgtable-2level.h
··· 75 75 #define PTE_HWTABLE_OFF (PTE_HWTABLE_PTRS * sizeof(pte_t)) 76 76 #define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u32)) 77 77 78 + #define MAX_POSSIBLE_PHYSMEM_BITS 32 79 + 78 80 /* 79 81 * PMD_SHIFT determines the size of the area a second-level page table can map 80 82 * PGDIR_SHIFT determines what a third-level page table entry can map
+2
arch/arm/include/asm/pgtable-3level.h
··· 25 25 #define PTE_HWTABLE_OFF (0) 26 26 #define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u64)) 27 27 28 + #define MAX_POSSIBLE_PHYSMEM_BITS 40 29 + 28 30 /* 29 31 * PGDIR_SHIFT determines the size a top-level page table entry can map. 30 32 */
+3
arch/mips/include/asm/pgtable-32.h
··· 154 154 155 155 #if defined(CONFIG_XPA) 156 156 157 + #define MAX_POSSIBLE_PHYSMEM_BITS 40 157 158 #define pte_pfn(x) (((unsigned long)((x).pte_high >> _PFN_SHIFT)) | (unsigned long)((x).pte_low << _PAGE_PRESENT_SHIFT)) 158 159 static inline pte_t 159 160 pfn_pte(unsigned long pfn, pgprot_t prot) ··· 170 169 171 170 #elif defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) 172 171 172 + #define MAX_POSSIBLE_PHYSMEM_BITS 36 173 173 #define pte_pfn(x) ((unsigned long)((x).pte_high >> 6)) 174 174 175 175 static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) ··· 185 183 186 184 #else 187 185 186 + #define MAX_POSSIBLE_PHYSMEM_BITS 32 188 187 #ifdef CONFIG_CPU_VR41XX 189 188 #define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2))) 190 189 #define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
+2
arch/powerpc/include/asm/book3s/32/pgtable.h
··· 36 36 */ 37 37 #ifdef CONFIG_PTE_64BIT 38 38 #define PTE_RPN_MASK (~((1ULL << PTE_RPN_SHIFT) - 1)) 39 + #define MAX_POSSIBLE_PHYSMEM_BITS 36 39 40 #else 40 41 #define PTE_RPN_MASK (~((1UL << PTE_RPN_SHIFT) - 1)) 42 + #define MAX_POSSIBLE_PHYSMEM_BITS 32 41 43 #endif 42 44 43 45 /*
+2
arch/powerpc/include/asm/nohash/32/pgtable.h
··· 153 153 */ 154 154 #if defined(CONFIG_PPC32) && defined(CONFIG_PTE_64BIT) 155 155 #define PTE_RPN_MASK (~((1ULL << PTE_RPN_SHIFT) - 1)) 156 + #define MAX_POSSIBLE_PHYSMEM_BITS 36 156 157 #else 157 158 #define PTE_RPN_MASK (~((1UL << PTE_RPN_SHIFT) - 1)) 159 + #define MAX_POSSIBLE_PHYSMEM_BITS 32 158 160 #endif 159 161 160 162 /*
+2
arch/riscv/include/asm/pgtable-32.h
··· 14 14 #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) 15 15 #define PGDIR_MASK (~(PGDIR_SIZE - 1)) 16 16 17 + #define MAX_POSSIBLE_PHYSMEM_BITS 34 18 + 17 19 #endif /* _ASM_RISCV_PGTABLE_32_H */
+13
include/linux/pgtable.h
··· 1427 1427 1428 1428 #endif /* !__ASSEMBLY__ */ 1429 1429 1430 + #if !defined(MAX_POSSIBLE_PHYSMEM_BITS) && !defined(CONFIG_64BIT) 1431 + #ifdef CONFIG_PHYS_ADDR_T_64BIT 1432 + /* 1433 + * ZSMALLOC needs to know the highest PFN on 32-bit architectures 1434 + * with physical address space extension, but falls back to 1435 + * BITS_PER_LONG otherwise. 1436 + */ 1437 + #error Missing MAX_POSSIBLE_PHYSMEM_BITS definition 1438 + #else 1439 + #define MAX_POSSIBLE_PHYSMEM_BITS 32 1440 + #endif 1441 + #endif 1442 + 1430 1443 #ifndef has_transparent_hugepage 1431 1444 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 1432 1445 #define has_transparent_hugepage() 1