Skip to content

Commit 7214618

Browse files
committed
Merge tag 'riscv/for-v5.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Paul Walmsley: "Several fixes, and one cleanup, for RISC-V. Fixes: - Fix an error in a Kconfig file that resulted in an undefined Kconfig option "CONFIG_CONFIG_MMU" - Fix undefined Kconfig option "CONFIG_CONFIG_MMU" - Fix scratch register clearing in M-mode (affects nommu users) - Fix a mismerge on my part that broke the build for CONFIG_SPARSEMEM_VMEMMAP users Cleanup: - Move SiFive L2 cache-related code to drivers/soc, per request" * tag 'riscv/for-v5.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: move sifive_l2_cache.c to drivers/soc riscv: define vmemmap before pfn_to_page calls riscv: fix scratch register clearing in M-mode. riscv: Fix use of undefined config option CONFIG_CONFIG_MMU
2 parents 78bac77 + 9209fb5 commit 7214618

File tree

11 files changed

+40
-21
lines changed

11 files changed

+40
-21
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6027,6 +6027,7 @@ M: Yash Shah <[email protected]>
60276027
60286028
S: Supported
60296029
F: drivers/edac/sifive_edac.c
6030+
F: drivers/soc/sifive_l2_cache.c
60306031

60316032
EDAC-SKYLAKE
60326033
M: Tony Luck <[email protected]>

arch/riscv/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ config GENERIC_HWEIGHT
154154
def_bool y
155155

156156
config FIX_EARLYCON_MEM
157-
def_bool CONFIG_MMU
157+
def_bool MMU
158158

159159
config PGTABLE_LEVELS
160160
int

arch/riscv/include/asm/pgtable.h

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,27 @@ extern pgd_t swapper_pg_dir[];
9090
#define __S110 PAGE_SHARED_EXEC
9191
#define __S111 PAGE_SHARED_EXEC
9292

93+
#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
94+
#define VMALLOC_END (PAGE_OFFSET - 1)
95+
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
96+
97+
/*
98+
* Roughly size the vmemmap space to be large enough to fit enough
99+
* struct pages to map half the virtual address space. Then
100+
* position vmemmap directly below the VMALLOC region.
101+
*/
102+
#define VMEMMAP_SHIFT \
103+
(CONFIG_VA_BITS - PAGE_SHIFT - 1 + STRUCT_PAGE_MAX_SHIFT)
104+
#define VMEMMAP_SIZE BIT(VMEMMAP_SHIFT)
105+
#define VMEMMAP_END (VMALLOC_START - 1)
106+
#define VMEMMAP_START (VMALLOC_START - VMEMMAP_SIZE)
107+
108+
/*
109+
* Define vmemmap for pfn_to_page & page_to_pfn calls. Needed if kernel
110+
* is configured with CONFIG_SPARSEMEM_VMEMMAP enabled.
111+
*/
112+
#define vmemmap ((struct page *)VMEMMAP_START)
113+
93114
static inline int pmd_present(pmd_t pmd)
94115
{
95116
return (pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE));
@@ -400,23 +421,6 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
400421
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
401422
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
402423

403-
#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
404-
#define VMALLOC_END (PAGE_OFFSET - 1)
405-
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
406-
407-
/*
408-
* Roughly size the vmemmap space to be large enough to fit enough
409-
* struct pages to map half the virtual address space. Then
410-
* position vmemmap directly below the VMALLOC region.
411-
*/
412-
#define VMEMMAP_SHIFT \
413-
(CONFIG_VA_BITS - PAGE_SHIFT - 1 + STRUCT_PAGE_MAX_SHIFT)
414-
#define VMEMMAP_SIZE BIT(VMEMMAP_SHIFT)
415-
#define VMEMMAP_END (VMALLOC_START - 1)
416-
#define VMEMMAP_START (VMALLOC_START - VMEMMAP_SIZE)
417-
418-
#define vmemmap ((struct page *)VMEMMAP_START)
419-
420424
#define PCI_IO_SIZE SZ_16M
421425
#define PCI_IO_END VMEMMAP_START
422426
#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE)

arch/riscv/kernel/head.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ ENTRY(reset_regs)
246246
li t4, 0
247247
li t5, 0
248248
li t6, 0
249-
csrw sscratch, 0
249+
csrw CSR_SCRATCH, 0
250250

251251
#ifdef CONFIG_FPU
252252
csrr t0, CSR_MISA

arch/riscv/mm/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ obj-y += extable.o
1010
obj-$(CONFIG_MMU) += fault.o
1111
obj-y += cacheflush.o
1212
obj-y += context.o
13-
obj-y += sifive_l2_cache.o
1413

1514
ifeq ($(CONFIG_MMU),y)
1615
obj-$(CONFIG_SMP) += tlbflush.o

drivers/edac/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ config EDAC_ALTERA_SDMMC
462462

463463
config EDAC_SIFIVE
464464
bool "Sifive platform EDAC driver"
465-
depends on EDAC=y && RISCV
465+
depends on EDAC=y && SIFIVE_L2
466466
help
467467
Support for error detection and correction on the SiFive SoCs.
468468

drivers/soc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ source "drivers/soc/qcom/Kconfig"
1414
source "drivers/soc/renesas/Kconfig"
1515
source "drivers/soc/rockchip/Kconfig"
1616
source "drivers/soc/samsung/Kconfig"
17+
source "drivers/soc/sifive/Kconfig"
1718
source "drivers/soc/sunxi/Kconfig"
1819
source "drivers/soc/tegra/Kconfig"
1920
source "drivers/soc/ti/Kconfig"

drivers/soc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ obj-y += qcom/
2020
obj-y += renesas/
2121
obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
2222
obj-$(CONFIG_SOC_SAMSUNG) += samsung/
23+
obj-$(CONFIG_SOC_SIFIVE) += sifive/
2324
obj-y += sunxi/
2425
obj-$(CONFIG_ARCH_TEGRA) += tegra/
2526
obj-y += ti/

drivers/soc/sifive/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
3+
if SOC_SIFIVE
4+
5+
config SIFIVE_L2
6+
bool "Sifive L2 Cache controller"
7+
help
8+
Support for the L2 cache controller on SiFive platforms.
9+
10+
endif

drivers/soc/sifive/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
3+
obj-$(CONFIG_SIFIVE_L2) += sifive_l2_cache.o

0 commit comments

Comments
 (0)