Skip to content

Commit 3b6be8d

Browse files
Merge patch "riscv: Fix compilation error with FAST_GUP and rv32"
I'm picking this up on top of the broken patch for the merge window, as the offending patch breaks the rv32 build and was itself a fix so isn't on for-next. * b4-shazam-merge: riscv: Fix compilation error with FAST_GUP and rv32 riscv: Fix pte_leaf_size() for NAPOT Revert "riscv: mm: support Svnapot in huge vmap" Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
2 parents b8e00bd + 2bb7e0c commit 3b6be8d

File tree

2 files changed

+7
-60
lines changed

2 files changed

+7
-60
lines changed

arch/riscv/include/asm/pgtable.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,12 @@ static inline pte_t pte_mkhuge(pte_t pte)
439439
return pte;
440440
}
441441

442+
#ifdef CONFIG_RISCV_ISA_SVNAPOT
443+
#define pte_leaf_size(pte) (pte_napot(pte) ? \
444+
napot_cont_size(napot_cont_order(pte)) :\
445+
PAGE_SIZE)
446+
#endif
447+
442448
#ifdef CONFIG_NUMA_BALANCING
443449
/*
444450
* See the comment in include/asm-generic/pgtable.h

arch/riscv/include/asm/vmalloc.h

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,65 +19,6 @@ static inline bool arch_vmap_pmd_supported(pgprot_t prot)
1919
return true;
2020
}
2121

22-
#ifdef CONFIG_RISCV_ISA_SVNAPOT
23-
#include <linux/pgtable.h>
22+
#endif
2423

25-
#define arch_vmap_pte_range_map_size arch_vmap_pte_range_map_size
26-
static inline unsigned long arch_vmap_pte_range_map_size(unsigned long addr, unsigned long end,
27-
u64 pfn, unsigned int max_page_shift)
28-
{
29-
unsigned long map_size = PAGE_SIZE;
30-
unsigned long size, order;
31-
32-
if (!has_svnapot())
33-
return map_size;
34-
35-
for_each_napot_order_rev(order) {
36-
if (napot_cont_shift(order) > max_page_shift)
37-
continue;
38-
39-
size = napot_cont_size(order);
40-
if (end - addr < size)
41-
continue;
42-
43-
if (!IS_ALIGNED(addr, size))
44-
continue;
45-
46-
if (!IS_ALIGNED(PFN_PHYS(pfn), size))
47-
continue;
48-
49-
map_size = size;
50-
break;
51-
}
52-
53-
return map_size;
54-
}
55-
56-
#define arch_vmap_pte_supported_shift arch_vmap_pte_supported_shift
57-
static inline int arch_vmap_pte_supported_shift(unsigned long size)
58-
{
59-
int shift = PAGE_SHIFT;
60-
unsigned long order;
61-
62-
if (!has_svnapot())
63-
return shift;
64-
65-
WARN_ON_ONCE(size >= PMD_SIZE);
66-
67-
for_each_napot_order_rev(order) {
68-
if (napot_cont_size(order) > size)
69-
continue;
70-
71-
if (!IS_ALIGNED(size, napot_cont_size(order)))
72-
continue;
73-
74-
shift = napot_cont_shift(order);
75-
break;
76-
}
77-
78-
return shift;
79-
}
80-
81-
#endif /* CONFIG_RISCV_ISA_SVNAPOT */
82-
#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
8324
#endif /* _ASM_RISCV_VMALLOC_H */

0 commit comments

Comments
 (0)