Skip to content

Commit 7867e40

Browse files
committed
Merge tag 'riscv-for-linus-5.17-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull more RISC-V updates from Palmer Dabbelt: - Support for sv48 paging - Hart ID mappings are now sparse, which enables more CPUs to come up on systems with sparse hart IDs - A handful of cleanups and fixes * tag 'riscv-for-linus-5.17-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (27 commits) RISC-V: nommu_virt: Drop unused SLAB_MERGE_DEFAULT RISC-V: Remove redundant err variable riscv: dts: sifive unmatched: Add gpio poweroff riscv: canaan: remove useless select of non-existing config SYSCON RISC-V: Do not use cpumask data structure for hartid bitmap RISC-V: Move spinwait booting method to its own config RISC-V: Move the entire hart selection via lottery to SMP RISC-V: Use __cpu_up_stack/task_pointer only for spinwait method RISC-V: Do not print the SBI version during HSM extension boot print RISC-V: Avoid using per cpu array for ordered booting riscv: default to CONFIG_RISCV_SBI_V01=n riscv: fix boolconv.cocci warnings riscv: Explicit comment about user virtual address space size riscv: Use pgtable_l4_enabled to output mmu_type in cpuinfo riscv: Implement sv48 support asm-generic: Prepare for riscv use of pud_alloc_one and pud_free riscv: Allow to dynamically define VA_BITS riscv: Introduce functions to switch pt_ops riscv: Split early kasan mapping to prepare sv48 introduction riscv: Move KASAN mapping next to the kernel mapping ...
2 parents b21bae9 + c59cd50 commit 7867e40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1006
-425
lines changed

Documentation/riscv/vm-layout.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ RISC-V Linux Kernel SV39
4747
| Kernel-space virtual memory, shared between all processes:
4848
____________________________________________________________|___________________________________________________________
4949
| | | |
50-
ffffffc000000000 | -256 GB | ffffffc7ffffffff | 32 GB | kasan
51-
ffffffcefee00000 | -196 GB | ffffffcefeffffff | 2 MB | fixmap
52-
ffffffceff000000 | -196 GB | ffffffceffffffff | 16 MB | PCI io
53-
ffffffcf00000000 | -196 GB | ffffffcfffffffff | 4 GB | vmemmap
54-
ffffffd000000000 | -192 GB | ffffffdfffffffff | 64 GB | vmalloc/ioremap space
55-
ffffffe000000000 | -128 GB | ffffffff7fffffff | 124 GB | direct mapping of all physical memory
50+
ffffffc6fee00000 | -228 GB | ffffffc6feffffff | 2 MB | fixmap
51+
ffffffc6ff000000 | -228 GB | ffffffc6ffffffff | 16 MB | PCI io
52+
ffffffc700000000 | -228 GB | ffffffc7ffffffff | 4 GB | vmemmap
53+
ffffffc800000000 | -224 GB | ffffffd7ffffffff | 64 GB | vmalloc/ioremap space
54+
ffffffd800000000 | -160 GB | fffffff6ffffffff | 124 GB | direct mapping of all physical memory
55+
fffffff700000000 | -36 GB | fffffffeffffffff | 32 GB | kasan
5656
__________________|____________|__________________|_________|____________________________________________________________
5757
|
5858
|

arch/riscv/Kconfig

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,16 @@ config MMU
147147
Select if you want MMU-based virtualised addressing space
148148
support by paged memory management. If unsure, say 'Y'.
149149

150-
config VA_BITS
151-
int
152-
default 32 if 32BIT
153-
default 39 if 64BIT
154-
155-
config PA_BITS
156-
int
157-
default 34 if 32BIT
158-
default 56 if 64BIT
159-
160150
config PAGE_OFFSET
161151
hex
162-
default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB
152+
default 0xC0000000 if 32BIT
163153
default 0x80000000 if 64BIT && !MMU
164-
default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB
165-
default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB
154+
default 0xffffaf8000000000 if 64BIT
166155

167156
config KASAN_SHADOW_OFFSET
168157
hex
169158
depends on KASAN_GENERIC
170-
default 0xdfffffc800000000 if 64BIT
159+
default 0xdfffffff00000000 if 64BIT
171160
default 0xffffffff if 32BIT
172161

173162
config ARCH_FLATMEM_ENABLE
@@ -213,7 +202,7 @@ config FIX_EARLYCON_MEM
213202

214203
config PGTABLE_LEVELS
215204
int
216-
default 3 if 64BIT
205+
default 4 if 64BIT
217206
default 2
218207

219208
config LOCKDEP_SUPPORT
@@ -271,24 +260,6 @@ config MODULE_SECTIONS
271260
bool
272261
select HAVE_MOD_ARCH_SPECIFIC
273262

274-
choice
275-
prompt "Maximum Physical Memory"
276-
default MAXPHYSMEM_1GB if 32BIT
277-
default MAXPHYSMEM_2GB if 64BIT && CMODEL_MEDLOW
278-
default MAXPHYSMEM_128GB if 64BIT && CMODEL_MEDANY
279-
280-
config MAXPHYSMEM_1GB
281-
depends on 32BIT
282-
bool "1GiB"
283-
config MAXPHYSMEM_2GB
284-
depends on 64BIT
285-
bool "2GiB"
286-
config MAXPHYSMEM_128GB
287-
depends on 64BIT && CMODEL_MEDANY
288-
bool "128GiB"
289-
endchoice
290-
291-
292263
config SMP
293264
bool "Symmetric Multi-Processing"
294265
help
@@ -392,12 +363,25 @@ source "kernel/Kconfig.hz"
392363

393364
config RISCV_SBI_V01
394365
bool "SBI v0.1 support"
395-
default y
396366
depends on RISCV_SBI
397367
help
398368
This config allows kernel to use SBI v0.1 APIs. This will be
399369
deprecated in future once legacy M-mode software are no longer in use.
400370

371+
config RISCV_BOOT_SPINWAIT
372+
bool "Spinwait booting method"
373+
depends on SMP
374+
default y
375+
help
376+
This enables support for booting Linux via spinwait method. In the
377+
spinwait method, all cores randomly jump to Linux. One of the cores
378+
gets chosen via lottery and all other keep spinning on a percpu
379+
variable. This method cannot support CPU hotplug and sparse hartid
380+
scheme. It should be only enabled for M-mode Linux or platforms relying
381+
on older firmware without SBI HSM extension. All other platforms should
382+
rely on ordered booting via SBI HSM extension which gets chosen
383+
dynamically at runtime if the firmware supports it.
384+
401385
config KEXEC
402386
bool "Kexec system call"
403387
select KEXEC_CORE

arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
clock-frequency = <RTCCLK_FREQ>;
4040
clock-output-names = "rtcclk";
4141
};
42+
43+
gpio-poweroff {
44+
compatible = "gpio-poweroff";
45+
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
46+
};
4247
};
4348

4449
&uart0 {

arch/riscv/configs/nommu_k210_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ CONFIG_EMBEDDED=y
2929
CONFIG_SLOB=y
3030
# CONFIG_MMU is not set
3131
CONFIG_SOC_CANAAN=y
32-
CONFIG_MAXPHYSMEM_2GB=y
3332
CONFIG_SMP=y
3433
CONFIG_NR_CPUS=2
3534
CONFIG_CMDLINE="earlycon console=ttySIF0"

arch/riscv/configs/nommu_k210_sdcard_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ CONFIG_EMBEDDED=y
2121
CONFIG_SLOB=y
2222
# CONFIG_MMU is not set
2323
CONFIG_SOC_CANAAN=y
24-
CONFIG_MAXPHYSMEM_2GB=y
2524
CONFIG_SMP=y
2625
CONFIG_NR_CPUS=2
2726
CONFIG_CMDLINE="earlycon console=ttySIF0 rootdelay=2 root=/dev/mmcblk0p1 ro"

arch/riscv/configs/nommu_virt_defconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ CONFIG_EXPERT=y
2424
# CONFIG_VM_EVENT_COUNTERS is not set
2525
# CONFIG_COMPAT_BRK is not set
2626
CONFIG_SLOB=y
27-
# CONFIG_SLAB_MERGE_DEFAULT is not set
2827
# CONFIG_MMU is not set
2928
CONFIG_SOC_VIRT=y
30-
CONFIG_MAXPHYSMEM_2GB=y
3129
CONFIG_SMP=y
3230
CONFIG_CMDLINE="root=/dev/vda rw earlycon=uart8250,mmio,0x10000000,115200n8 console=ttyS0"
3331
CONFIG_CMDLINE_FORCE=y

arch/riscv/include/asm/cpu_ops.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,5 @@ struct cpu_operations {
4040

4141
extern const struct cpu_operations *cpu_ops[NR_CPUS];
4242
void __init cpu_set_ops(int cpu);
43-
void cpu_update_secondary_bootdata(unsigned int cpuid,
44-
struct task_struct *tidle);
4543

4644
#endif /* ifndef __ASM_CPU_OPS_H */

arch/riscv/include/asm/cpu_ops_sbi.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (c) 2021 by Rivos Inc.
4+
*/
5+
#ifndef __ASM_CPU_OPS_SBI_H
6+
#define __ASM_CPU_OPS_SBI_H
7+
8+
#ifndef __ASSEMBLY__
9+
#include <linux/init.h>
10+
#include <linux/sched.h>
11+
#include <linux/threads.h>
12+
13+
/**
14+
* struct sbi_hart_boot_data - Hart specific boot used during booting and
15+
* cpu hotplug.
16+
* @task_ptr: A pointer to the hart specific tp
17+
* @stack_ptr: A pointer to the hart specific sp
18+
*/
19+
struct sbi_hart_boot_data {
20+
void *task_ptr;
21+
void *stack_ptr;
22+
};
23+
#endif
24+
25+
#endif /* ifndef __ASM_CPU_OPS_SBI_H */

arch/riscv/include/asm/csr.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@
4040
#ifndef CONFIG_64BIT
4141
#define SATP_PPN _AC(0x003FFFFF, UL)
4242
#define SATP_MODE_32 _AC(0x80000000, UL)
43-
#define SATP_MODE SATP_MODE_32
4443
#define SATP_ASID_BITS 9
4544
#define SATP_ASID_SHIFT 22
4645
#define SATP_ASID_MASK _AC(0x1FF, UL)
4746
#else
4847
#define SATP_PPN _AC(0x00000FFFFFFFFFFF, UL)
4948
#define SATP_MODE_39 _AC(0x8000000000000000, UL)
50-
#define SATP_MODE SATP_MODE_39
49+
#define SATP_MODE_48 _AC(0x9000000000000000, UL)
5150
#define SATP_ASID_BITS 16
5251
#define SATP_ASID_SHIFT 44
5352
#define SATP_ASID_MASK _AC(0xFFFF, UL)

arch/riscv/include/asm/fixmap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ enum fixed_addresses {
2424
FIX_HOLE,
2525
FIX_PTE,
2626
FIX_PMD,
27+
FIX_PUD,
2728
FIX_TEXT_POKE1,
2829
FIX_TEXT_POKE0,
2930
FIX_EARLYCON_MEM_BASE,

0 commit comments

Comments
 (0)