linux/arch/riscv
Alexandre Ghiti 6392d71b4b riscv: Fix P4D_SHIFT definition for 3-level page table mode
[ Upstream commit 71fc3621ef ]

RISC-V kernels support 3,4,5-level page tables at runtime by folding
upper levels.

In case of a 3-level page table, PGDIR is folded into P4D which in turn
is folded into PUD: PGDIR_SHIFT value is correctly set to the same value
as PUD_SHIFT, but P4D_SHIFT is not, then any use of P4D_SHIFT will access
invalid address bits (all set to 1).

Fix this by dynamically defining P4D_SHIFT value, like we already do for
PGDIR_SHIFT.

Fixes: d10efa21a9 ("riscv: mm: Control p4d's folding by pgtable_l5_enabled")
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Link: https://lore.kernel.org/r/20221201135128.1482189-2-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:32:38 +01:00
..
boot riscv: dts: microchip: remove pcie node from the sev kit 2022-12-31 13:31:52 +01:00
configs riscv: enable CD-ROM file systems in defconfig 2022-08-25 17:01:09 -07:00
errata Merge patch series "Some style cleanups for recent extension additions" 2022-10-13 08:46:31 -07:00
include riscv: Fix P4D_SHIFT definition for 3-level page table mode 2022-12-31 13:32:38 +01:00
kernel RISC-V: Align the shadow stack 2022-12-31 13:32:38 +01:00
kvm RISC-V: KVM: Fix kvm_riscv_vcpu_timer_pending() for Sstc 2022-10-21 11:52:45 +05:30
lib riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit 2022-08-10 14:06:31 -07:00
mm riscv: Fix crash during early errata patching 2022-12-31 13:32:37 +01:00
net riscv, bpf: Emit fixed-length instructions for BPF_PSEUDO_FUNC 2022-12-31 13:32:23 +01:00
purgatory riscv/purgatory: Omit use of bin2c 2022-08-11 09:32:34 -07:00
Kbuild riscv: move errata/ and kvm/ builds to arch/riscv/Kbuild 2022-06-01 22:26:32 -07:00
Kconfig riscv: Fix NR_CPUS range conditions 2022-11-28 15:27:00 -08:00
Kconfig.debug
Kconfig.erratas riscv: make t-head erratas depend on MMU 2022-09-17 01:48:22 -07:00
Kconfig.socs riscv: Kconfig: Style cleanups 2022-06-30 19:26:16 -07:00
Makefile Merge patch series "Fix RISC-V toolchain extension support detection" 2022-10-27 15:14:07 -07:00