FAILED: patch "[PATCH] riscv: Move early dtb mapping into the fixmap region" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x ef69d2559fe91f23d27a3d6fd640b5641787d22e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023041708-sinless-rectangle-f480@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
ef69d2559fe9 ("riscv: Move early dtb mapping into the fixmap region") dd3553793a75 ("Documentation: riscv: Document the sv57 VM layout") 9d19f2b5256e ("Documentation: riscv: Add sv48 description to VM layout") f83050a82d4f ("RISC-V: Avoid empty create_*_mapping definitions") 677b9eb8810e ("riscv: mm: Prepare pt_ops helper functions for sv57") e8a62cc26ddf ("riscv: Implement sv48 support")3270bfdb9e4a ("riscv: Allow to dynamically define VA_BITS") 840125a97abc ("riscv: Introduce functions to switch pt_ops") 2efad17e5794 ("riscv: Split early kasan mapping to prepare sv48 introduction") f7ae02333d13 ("riscv: Move KASAN mapping next to the kernel mapping") db1503d355a7 ("riscv: Get rid of MAXPHYSMEM configs")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ef69d2559fe91f23d27a3d6fd640b5641787d22e Mon Sep 17 00:00:00 2001
From: Alexandre Ghiti <[email protected]>
Date: Wed, 29 Mar 2023 10:19:30 +0200
Subject: [PATCH] riscv: Move early dtb mapping into the fixmap region
riscv establishes 2 virtual mappings:
- early_pg_dir maps the kernel which allows to discover the system memory
- swapper_pg_dir installs the final mapping (linear mapping included)
We used to map the dtb in early_pg_dir using DTB_EARLY_BASE_VA, and this mapping was not carried over in swapper_pg_dir. It happens that early_init_fdt_scan_reserved_mem() must be called before swapper_pg_dir is setup otherwise we could allocate reserved memory defined in the dtb. And this function initializes reserved_mem variable with addresses that lie in the early_pg_dir dtb mapping: when those addresses are reused with swapper_pg_dir, this mapping does not exist and then we trap.
The previous "fix" was incorrect as early_init_fdt_scan_reserved_mem() must be called before swapper_pg_dir is set up otherwise we could allocate in reserved memory defined in the dtb.
So move the dtb mapping in the fixmap region which is established in early_pg_dir and handed over to swapper_pg_dir.
Documentation/riscv/vm-layout.rst +3 -3
@@ -47,7 +47,7 @@ RISC-V Linux Kernel SV39 | Kernel-space virtual memory, shared between all processes: ____________________________________________________________|___________________________________________________________ | | | | - ffffffc6fee00000 | -228 GB | ffffffc6feffffff | 2 MB | fixmap + ffffffc6fea00000 | -228 GB | ffffffc6feffffff | 6 MB | fixmap ffffffc6ff000000 | -228 GB | ffffffc6ffffffff | 16 MB | PCI io ffffffc700000000 | -228 GB | ffffffc7ffffffff | 4 GB | vmemmap ffffffc800000000 | -224 GB | ffffffd7ffffffff | 64 GB | vmalloc/ioremap space
@@ -83,7 +83,7 @@ RISC-V Linux Kernel SV48 | Kernel-space virtual memory, shared between all processes: ____________________________________________________________|___________________________________________________________ | | | | - ffff8d7ffee00000 | -114.5 TB | ffff8d7ffeffffff | 2 MB | fixmap + ffff8d7ffea00000 | -114.5 TB | ffff8d7ffeffffff | 6 MB | fixmap ffff8d7fff000000 | -114.5 TB | ffff8d7fffffffff | 16 MB | PCI io ffff8d8000000000 | -114.5 TB | ffff8f7fffffffff | 2 TB | vmemmap ffff8f8000000000 | -112.5 TB | ffffaf7fffffffff | 32 TB | vmalloc/ioremap space
@@ -119,7 +119,7 @@ RISC-V Linux Kernel SV57 | Kernel-space virtual memory, shared between all processes: ____________________________________________________________|___________________________________________________________ | | | | - ff1bfffffee00000 | -57 PB | ff1bfffffeffffff | 2 MB | fixmap + ff1bfffffea00000 | -57 PB | ff1bfffffeffffff | 6 MB | fixmap ff1bffffff000000 | -57 PB | ff1bffffffffffff | 16 MB | PCI io ff1c000000000000 | -57 PB | ff1fffffffffffff | 1 PB | vmemmap ff20000000000000 | -56 PB | ff5fffffffffffff | 16 PB | vmalloc/ioremap space
arch/riscv/include/asm/fixmap.h +8 -0
@@ -22,6 +22,14 @@*/ enum fixed_addresses {FIX_HOLE , +/* +* The fdt fixmap mapping must be PMD aligned and will be mapped +* using PMD entries in fixmap_pmd in 64-bit and a PGD entry in 32-bit. +*/ +FIX_FDT_END , +FIX_FDT =FIX_FDT_END +FIX_FDT_SIZE /PAGE_SIZE -1 , + +/* Below fixmaps will be mapped using fixmap_pte */ FIX_PTE ,FIX_PMD ,FIX_PUD ,
arch/riscv/include/asm/pgtable.h +6 -2
@@ -87,9 +87,13 @@#define FIXADDR_TOP PCI_IO_START#ifdef CONFIG_64BIT -#define FIXADDR_SIZE PMD_SIZE +#define MAX_FDT_SIZE PMD_SIZE +#define FIX_FDT_SIZE (MAX_FDT_SIZE + SZ_2M) +#define FIXADDR_SIZE (PMD_SIZE + FIX_FDT_SIZE)#else -#define FIXADDR_SIZE PGDIR_SIZE +#define MAX_FDT_SIZE PGDIR_SIZE +#define FIX_FDT_SIZE MAX_FDT_SIZE +#define FIXADDR_SIZE (PGDIR_SIZE + FIX_FDT_SIZE)#endif #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
arch/riscv/kernel/setup.c +0 -1
@@ -283,7 +283,6 @@ void __init setup_arch(char **cmdline_p) else pr_err("No DTB found in kernel mappings\n");#endif -early_init_fdt_scan_reserved_mem ();misc_mem_init ();init_resources ();
arch/riscv/mm/init.c +34 -27
117 lines not on this page · raw message