]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop some riscv patches from 6.1 and 6.2
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Apr 2023 09:35:47 +0000 (11:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Apr 2023 09:35:47 +0000 (11:35 +0200)
queue-6.1/documentation-riscv-document-the-sv57-vm-layout.patch [deleted file]
queue-6.1/riscv-move-early-dtb-mapping-into-the-fixmap-region.patch [deleted file]
queue-6.1/series
queue-6.2/riscv-move-early-dtb-mapping-into-the-fixmap-region.patch [deleted file]
queue-6.2/series

diff --git a/queue-6.1/documentation-riscv-document-the-sv57-vm-layout.patch b/queue-6.1/documentation-riscv-document-the-sv57-vm-layout.patch
deleted file mode 100644 (file)
index 32b8693..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-From a6c803a703cd8d472810dae0ba1f2b2868a94354 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 18 Nov 2022 18:15:56 +0100
-Subject: Documentation: riscv: Document the sv57 VM layout
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Björn Töpel <bjorn@rivosinc.com>
-
-[ Upstream commit dd3553793a759e4f7f21c1aaffd5cb2de7a0068d ]
-
-RISC-V has been supporting the "sv57" address translation mode for a
-while, but is has not been added to the VM layout documentation. Let
-us fix that.
-
-Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
-Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
-Link: https://lore.kernel.org/r/20221118171556.1612190-1-bjorn@kernel.org
-Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-Stable-dep-of: ef69d2559fe9 ("riscv: Move early dtb mapping into the fixmap region")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/riscv/vm-layout.rst | 36 +++++++++++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
-
-diff --git a/Documentation/riscv/vm-layout.rst b/Documentation/riscv/vm-layout.rst
-index 5b36e45fef60b..3be44e74ec5d6 100644
---- a/Documentation/riscv/vm-layout.rst
-+++ b/Documentation/riscv/vm-layout.rst
-@@ -97,3 +97,39 @@ RISC-V Linux Kernel SV48
-    ffffffff00000000 |   -4    GB | ffffffff7fffffff |    2 GB | modules, BPF
-    ffffffff80000000 |   -2    GB | ffffffffffffffff |    2 GB | kernel
-   __________________|____________|__________________|_________|____________________________________________________________
-+
-+
-+RISC-V Linux Kernel SV57
-+------------------------
-+
-+::
-+
-+ ========================================================================================================================
-+      Start addr    |   Offset   |     End addr     |  Size   | VM area description
-+ ========================================================================================================================
-+                    |            |                  |         |
-+   0000000000000000 |   0        | 00ffffffffffffff |   64 PB | user-space virtual memory, different per mm
-+  __________________|____________|__________________|_________|___________________________________________________________
-+                    |            |                  |         |
-+   0100000000000000 | +64     PB | feffffffffffffff | ~16K PB | ... huge, almost 64 bits wide hole of non-canonical
-+                    |            |                  |         | virtual memory addresses up to the -64 PB
-+                    |            |                  |         | starting offset of kernel mappings.
-+  __________________|____________|__________________|_________|___________________________________________________________
-+                                                              |
-+                                                              | Kernel-space virtual memory, shared between all processes:
-+  ____________________________________________________________|___________________________________________________________
-+                    |            |                  |         |
-+   ff1bfffffee00000 | -57     PB | ff1bfffffeffffff |    2 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
-+   ff60000000000000 | -40     PB | ffdeffffffffffff |   32 PB | direct mapping of all physical memory
-+   ffdf000000000000 |  -8     PB | fffffffeffffffff |    8 PB | kasan
-+  __________________|____________|__________________|_________|____________________________________________________________
-+                                                              |
-+                                                              | Identical layout to the 39-bit one from here on:
-+  ____________________________________________________________|____________________________________________________________
-+                    |            |                  |         |
-+   ffffffff00000000 |  -4     GB | ffffffff7fffffff |    2 GB | modules, BPF
-+   ffffffff80000000 |  -2     GB | ffffffffffffffff |    2 GB | kernel
-+  __________________|____________|__________________|_________|____________________________________________________________
--- 
-2.39.2
-
diff --git a/queue-6.1/riscv-move-early-dtb-mapping-into-the-fixmap-region.patch b/queue-6.1/riscv-move-early-dtb-mapping-into-the-fixmap-region.patch
deleted file mode 100644 (file)
index 3f71246..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-From cbf41c65e31e4cd561076444cbdd7c2daaabda30 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 29 Mar 2023 10:19:30 +0200
-Subject: riscv: Move early dtb mapping into the fixmap region
-
-From: Alexandre Ghiti <alexghiti@rivosinc.com>
-
-[ Upstream commit ef69d2559fe91f23d27a3d6fd640b5641787d22e ]
-
-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.
-
-Fixes: 922b0375fc93 ("riscv: Fix memblock reservation for device tree blob")
-Fixes: 8f3a2b4a96dc ("RISC-V: Move DT mapping outof fixmap")
-Fixes: 50e63dd8ed92 ("riscv: fix reserved memory setup")
-Reported-by: Conor Dooley <conor.dooley@microchip.com>
-Link: https://lore.kernel.org/all/f8e67f82-103d-156c-deb0-d6d6e2756f5e@microchip.com/
-Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
-Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
-Tested-by: Conor Dooley <conor.dooley@microchip.com>
-Link: https://lore.kernel.org/r/20230329081932.79831-2-alexghiti@rivosinc.com
-Cc: stable@vger.kernel.org
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/riscv/vm-layout.rst |  6 +--
- arch/riscv/include/asm/fixmap.h   |  8 ++++
- arch/riscv/include/asm/pgtable.h  |  8 +++-
- arch/riscv/kernel/setup.c         |  1 -
- arch/riscv/mm/init.c              | 61 +++++++++++++++++--------------
- 5 files changed, 51 insertions(+), 33 deletions(-)
-
-diff --git a/Documentation/riscv/vm-layout.rst b/Documentation/riscv/vm-layout.rst
-index 3be44e74ec5d6..5462c84f4723f 100644
---- a/Documentation/riscv/vm-layout.rst
-+++ b/Documentation/riscv/vm-layout.rst
-@@ -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
-diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h
-index 5c3e7b97fcc6f..0a55099bb7349 100644
---- a/arch/riscv/include/asm/fixmap.h
-+++ b/arch/riscv/include/asm/fixmap.h
-@@ -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,
-diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
-index 92ec2d9d7273f..2aeaf8e3a4ab0 100644
---- a/arch/riscv/include/asm/pgtable.h
-+++ b/arch/riscv/include/asm/pgtable.h
-@@ -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)
-diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
-index d4a12233e728d..2acf51c235673 100644
---- a/arch/riscv/kernel/setup.c
-+++ b/arch/riscv/kernel/setup.c
-@@ -280,7 +280,6 @@ void __init setup_arch(char **cmdline_p)
- #else
-       unflatten_device_tree();
- #endif
--      early_init_fdt_scan_reserved_mem();
-       misc_mem_init();
-       init_resources();
-diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
-index 50a1b6edd4918..5570c52deb0b5 100644
---- a/arch/riscv/mm/init.c
-+++ b/arch/riscv/mm/init.c
-@@ -57,7 +57,6 @@ unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
- EXPORT_SYMBOL(empty_zero_page);
- extern char _start[];
--#define DTB_EARLY_BASE_VA      PGDIR_SIZE
- void *_dtb_early_va __initdata;
- uintptr_t _dtb_early_pa __initdata;
-@@ -236,6 +235,14 @@ static void __init setup_bootmem(void)
-       set_max_mapnr(max_low_pfn - ARCH_PFN_OFFSET);
-       reserve_initrd_mem();
-+
-+      /*
-+       * No allocation should be done before reserving the memory as defined
-+       * in the device tree, otherwise the allocation could end up in a
-+       * reserved region.
-+       */
-+      early_init_fdt_scan_reserved_mem();
-+
-       /*
-        * If DTB is built in, no need to reserve its memblock.
-        * Otherwise, do reserve it but avoid using
-@@ -279,9 +286,6 @@ pgd_t trampoline_pg_dir[PTRS_PER_PGD] __page_aligned_bss;
- static pte_t fixmap_pte[PTRS_PER_PTE] __page_aligned_bss;
- pgd_t early_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE);
--static p4d_t __maybe_unused early_dtb_p4d[PTRS_PER_P4D] __initdata __aligned(PAGE_SIZE);
--static pud_t __maybe_unused early_dtb_pud[PTRS_PER_PUD] __initdata __aligned(PAGE_SIZE);
--static pmd_t __maybe_unused early_dtb_pmd[PTRS_PER_PMD] __initdata __aligned(PAGE_SIZE);
- #ifdef CONFIG_XIP_KERNEL
- #define pt_ops                        (*(struct pt_alloc_ops *)XIP_FIXUP(&pt_ops))
-@@ -626,9 +630,6 @@ static void __init create_p4d_mapping(p4d_t *p4dp,
- #define trampoline_pgd_next   (pgtable_l5_enabled ?                   \
-               (uintptr_t)trampoline_p4d : (pgtable_l4_enabled ?       \
-               (uintptr_t)trampoline_pud : (uintptr_t)trampoline_pmd))
--#define early_dtb_pgd_next    (pgtable_l5_enabled ?                   \
--              (uintptr_t)early_dtb_p4d : (pgtable_l4_enabled ?        \
--              (uintptr_t)early_dtb_pud : (uintptr_t)early_dtb_pmd))
- #else
- #define pgd_next_t            pte_t
- #define alloc_pgd_next(__va)  pt_ops.alloc_pte(__va)
-@@ -636,7 +637,6 @@ static void __init create_p4d_mapping(p4d_t *p4dp,
- #define create_pgd_next_mapping(__nextp, __va, __pa, __sz, __prot)    \
-       create_pte_mapping(__nextp, __va, __pa, __sz, __prot)
- #define fixmap_pgd_next               ((uintptr_t)fixmap_pte)
--#define early_dtb_pgd_next    ((uintptr_t)early_dtb_pmd)
- #define create_p4d_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
- #define create_pud_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
- #define create_pmd_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
-@@ -859,32 +859,28 @@ static void __init create_kernel_page_table(pgd_t *pgdir, bool early)
-  * this means 2 PMD entries whereas for 32-bit kernel, this is only 1 PGDIR
-  * entry.
-  */
--static void __init create_fdt_early_page_table(pgd_t *pgdir, uintptr_t dtb_pa)
-+static void __init create_fdt_early_page_table(pgd_t *pgdir,
-+                                             uintptr_t fix_fdt_va,
-+                                             uintptr_t dtb_pa)
- {
--#ifndef CONFIG_BUILTIN_DTB
-       uintptr_t pa = dtb_pa & ~(PMD_SIZE - 1);
--      create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA,
--                         IS_ENABLED(CONFIG_64BIT) ? early_dtb_pgd_next : pa,
--                         PGDIR_SIZE,
--                         IS_ENABLED(CONFIG_64BIT) ? PAGE_TABLE : PAGE_KERNEL);
--
--      if (pgtable_l5_enabled)
--              create_p4d_mapping(early_dtb_p4d, DTB_EARLY_BASE_VA,
--                                 (uintptr_t)early_dtb_pud, P4D_SIZE, PAGE_TABLE);
--
--      if (pgtable_l4_enabled)
--              create_pud_mapping(early_dtb_pud, DTB_EARLY_BASE_VA,
--                                 (uintptr_t)early_dtb_pmd, PUD_SIZE, PAGE_TABLE);
-+#ifndef CONFIG_BUILTIN_DTB
-+      /* Make sure the fdt fixmap address is always aligned on PMD size */
-+      BUILD_BUG_ON(FIX_FDT % (PMD_SIZE / PAGE_SIZE));
--      if (IS_ENABLED(CONFIG_64BIT)) {
--              create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA,
-+      /* In 32-bit only, the fdt lies in its own PGD */
-+      if (!IS_ENABLED(CONFIG_64BIT)) {
-+              create_pgd_mapping(early_pg_dir, fix_fdt_va,
-+                                 pa, MAX_FDT_SIZE, PAGE_KERNEL);
-+      } else {
-+              create_pmd_mapping(fixmap_pmd, fix_fdt_va,
-                                  pa, PMD_SIZE, PAGE_KERNEL);
--              create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA + PMD_SIZE,
-+              create_pmd_mapping(fixmap_pmd, fix_fdt_va + PMD_SIZE,
-                                  pa + PMD_SIZE, PMD_SIZE, PAGE_KERNEL);
-       }
--      dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PMD_SIZE - 1));
-+      dtb_early_va = (void *)fix_fdt_va + (dtb_pa & (PMD_SIZE - 1));
- #else
-       /*
-        * For 64-bit kernel, __va can't be used since it would return a linear
-@@ -1054,7 +1050,8 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
-       create_kernel_page_table(early_pg_dir, true);
-       /* Setup early mapping for FDT early scan */
--      create_fdt_early_page_table(early_pg_dir, dtb_pa);
-+      create_fdt_early_page_table(early_pg_dir,
-+                                  __fix_to_virt(FIX_FDT), dtb_pa);
-       /*
-        * Bootime fixmap only can handle PMD_SIZE mapping. Thus, boot-ioremap
-@@ -1096,6 +1093,16 @@ static void __init setup_vm_final(void)
-       u64 i;
-       /* Setup swapper PGD for fixmap */
-+#if !defined(CONFIG_64BIT)
-+      /*
-+       * In 32-bit, the device tree lies in a pgd entry, so it must be copied
-+       * directly in swapper_pg_dir in addition to the pgd entry that points
-+       * to fixmap_pte.
-+       */
-+      unsigned long idx = pgd_index(__fix_to_virt(FIX_FDT));
-+
-+      set_pgd(&swapper_pg_dir[idx], early_pg_dir[idx]);
-+#endif
-       create_pgd_mapping(swapper_pg_dir, FIXADDR_START,
-                          __pa_symbol(fixmap_pgd_next),
-                          PGDIR_SIZE, PAGE_TABLE);
--- 
-2.39.2
-
index ffcc68c3fb98b5c5c080c5bae5ae1088090d21d0..021085e883c2310d159c4e15ce2b4e8804c305a3 100644 (file)
@@ -125,8 +125,6 @@ i2c-ocores-generate-stop-condition-after-timeout-in-.patch
 cifs-fix-negotiate-context-parsing.patch
 risc-v-add-infrastructure-to-allow-different-str-imp.patch
 purgatory-fix-disabling-debug-info.patch
-documentation-riscv-document-the-sv57-vm-layout.patch
-riscv-move-early-dtb-mapping-into-the-fixmap-region.patch
 nvme-pci-mark-lexar-nm760-as-ignore_dev_subnqn.patch
 nvme-pci-add-nvme_quirk_bogus_nid-for-t-force-z330-s.patch
 cgroup-cpuset-skip-spread-flags-update-on-v2.patch
diff --git a/queue-6.2/riscv-move-early-dtb-mapping-into-the-fixmap-region.patch b/queue-6.2/riscv-move-early-dtb-mapping-into-the-fixmap-region.patch
deleted file mode 100644 (file)
index a0e7730..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-From ef69d2559fe91f23d27a3d6fd640b5641787d22e Mon Sep 17 00:00:00 2001
-From: Alexandre Ghiti <alexghiti@rivosinc.com>
-Date: Wed, 29 Mar 2023 10:19:30 +0200
-Subject: riscv: Move early dtb mapping into the fixmap region
-
-From: Alexandre Ghiti <alexghiti@rivosinc.com>
-
-commit ef69d2559fe91f23d27a3d6fd640b5641787d22e upstream.
-
-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.
-
-Fixes: 922b0375fc93 ("riscv: Fix memblock reservation for device tree blob")
-Fixes: 8f3a2b4a96dc ("RISC-V: Move DT mapping outof fixmap")
-Fixes: 50e63dd8ed92 ("riscv: fix reserved memory setup")
-Reported-by: Conor Dooley <conor.dooley@microchip.com>
-Link: https://lore.kernel.org/all/f8e67f82-103d-156c-deb0-d6d6e2756f5e@microchip.com/
-Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
-Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
-Tested-by: Conor Dooley <conor.dooley@microchip.com>
-Link: https://lore.kernel.org/r/20230329081932.79831-2-alexghiti@rivosinc.com
-Cc: stable@vger.kernel.org
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- Documentation/riscv/vm-layout.rst |    6 +--
- arch/riscv/include/asm/fixmap.h   |    8 ++++
- arch/riscv/include/asm/pgtable.h  |    8 +++-
- arch/riscv/kernel/setup.c         |    1 
- arch/riscv/mm/init.c              |   61 +++++++++++++++++++++-----------------
- 5 files changed, 51 insertions(+), 33 deletions(-)
-
---- a/Documentation/riscv/vm-layout.rst
-+++ b/Documentation/riscv/vm-layout.rst
-@@ -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
---- a/arch/riscv/include/asm/fixmap.h
-+++ b/arch/riscv/include/asm/fixmap.h
-@@ -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,
---- a/arch/riscv/include/asm/pgtable.h
-+++ b/arch/riscv/include/asm/pgtable.h
-@@ -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)
---- a/arch/riscv/kernel/setup.c
-+++ b/arch/riscv/kernel/setup.c
-@@ -280,7 +280,6 @@ void __init setup_arch(char **cmdline_p)
- #else
-       unflatten_device_tree();
- #endif
--      early_init_fdt_scan_reserved_mem();
-       misc_mem_init();
-       init_resources();
---- a/arch/riscv/mm/init.c
-+++ b/arch/riscv/mm/init.c
-@@ -57,7 +57,6 @@ unsigned long empty_zero_page[PAGE_SIZE
- EXPORT_SYMBOL(empty_zero_page);
- extern char _start[];
--#define DTB_EARLY_BASE_VA      PGDIR_SIZE
- void *_dtb_early_va __initdata;
- uintptr_t _dtb_early_pa __initdata;
-@@ -236,6 +235,14 @@ static void __init setup_bootmem(void)
-       set_max_mapnr(max_low_pfn - ARCH_PFN_OFFSET);
-       reserve_initrd_mem();
-+
-+      /*
-+       * No allocation should be done before reserving the memory as defined
-+       * in the device tree, otherwise the allocation could end up in a
-+       * reserved region.
-+       */
-+      early_init_fdt_scan_reserved_mem();
-+
-       /*
-        * If DTB is built in, no need to reserve its memblock.
-        * Otherwise, do reserve it but avoid using
-@@ -279,9 +286,6 @@ pgd_t trampoline_pg_dir[PTRS_PER_PGD] __
- static pte_t fixmap_pte[PTRS_PER_PTE] __page_aligned_bss;
- pgd_t early_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE);
--static p4d_t __maybe_unused early_dtb_p4d[PTRS_PER_P4D] __initdata __aligned(PAGE_SIZE);
--static pud_t __maybe_unused early_dtb_pud[PTRS_PER_PUD] __initdata __aligned(PAGE_SIZE);
--static pmd_t __maybe_unused early_dtb_pmd[PTRS_PER_PMD] __initdata __aligned(PAGE_SIZE);
- #ifdef CONFIG_XIP_KERNEL
- #define pt_ops                        (*(struct pt_alloc_ops *)XIP_FIXUP(&pt_ops))
-@@ -626,9 +630,6 @@ static void __init create_p4d_mapping(p4
- #define trampoline_pgd_next   (pgtable_l5_enabled ?                   \
-               (uintptr_t)trampoline_p4d : (pgtable_l4_enabled ?       \
-               (uintptr_t)trampoline_pud : (uintptr_t)trampoline_pmd))
--#define early_dtb_pgd_next    (pgtable_l5_enabled ?                   \
--              (uintptr_t)early_dtb_p4d : (pgtable_l4_enabled ?        \
--              (uintptr_t)early_dtb_pud : (uintptr_t)early_dtb_pmd))
- #else
- #define pgd_next_t            pte_t
- #define alloc_pgd_next(__va)  pt_ops.alloc_pte(__va)
-@@ -636,7 +637,6 @@ static void __init create_p4d_mapping(p4
- #define create_pgd_next_mapping(__nextp, __va, __pa, __sz, __prot)    \
-       create_pte_mapping(__nextp, __va, __pa, __sz, __prot)
- #define fixmap_pgd_next               ((uintptr_t)fixmap_pte)
--#define early_dtb_pgd_next    ((uintptr_t)early_dtb_pmd)
- #define create_p4d_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
- #define create_pud_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
- #define create_pmd_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
-@@ -860,32 +860,28 @@ static void __init create_kernel_page_ta
-  * this means 2 PMD entries whereas for 32-bit kernel, this is only 1 PGDIR
-  * entry.
-  */
--static void __init create_fdt_early_page_table(pgd_t *pgdir, uintptr_t dtb_pa)
-+static void __init create_fdt_early_page_table(pgd_t *pgdir,
-+                                             uintptr_t fix_fdt_va,
-+                                             uintptr_t dtb_pa)
- {
--#ifndef CONFIG_BUILTIN_DTB
-       uintptr_t pa = dtb_pa & ~(PMD_SIZE - 1);
--      create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA,
--                         IS_ENABLED(CONFIG_64BIT) ? early_dtb_pgd_next : pa,
--                         PGDIR_SIZE,
--                         IS_ENABLED(CONFIG_64BIT) ? PAGE_TABLE : PAGE_KERNEL);
--
--      if (pgtable_l5_enabled)
--              create_p4d_mapping(early_dtb_p4d, DTB_EARLY_BASE_VA,
--                                 (uintptr_t)early_dtb_pud, P4D_SIZE, PAGE_TABLE);
--
--      if (pgtable_l4_enabled)
--              create_pud_mapping(early_dtb_pud, DTB_EARLY_BASE_VA,
--                                 (uintptr_t)early_dtb_pmd, PUD_SIZE, PAGE_TABLE);
-+#ifndef CONFIG_BUILTIN_DTB
-+      /* Make sure the fdt fixmap address is always aligned on PMD size */
-+      BUILD_BUG_ON(FIX_FDT % (PMD_SIZE / PAGE_SIZE));
--      if (IS_ENABLED(CONFIG_64BIT)) {
--              create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA,
-+      /* In 32-bit only, the fdt lies in its own PGD */
-+      if (!IS_ENABLED(CONFIG_64BIT)) {
-+              create_pgd_mapping(early_pg_dir, fix_fdt_va,
-+                                 pa, MAX_FDT_SIZE, PAGE_KERNEL);
-+      } else {
-+              create_pmd_mapping(fixmap_pmd, fix_fdt_va,
-                                  pa, PMD_SIZE, PAGE_KERNEL);
--              create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA + PMD_SIZE,
-+              create_pmd_mapping(fixmap_pmd, fix_fdt_va + PMD_SIZE,
-                                  pa + PMD_SIZE, PMD_SIZE, PAGE_KERNEL);
-       }
--      dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PMD_SIZE - 1));
-+      dtb_early_va = (void *)fix_fdt_va + (dtb_pa & (PMD_SIZE - 1));
- #else
-       /*
-        * For 64-bit kernel, __va can't be used since it would return a linear
-@@ -1055,7 +1051,8 @@ asmlinkage void __init setup_vm(uintptr_
-       create_kernel_page_table(early_pg_dir, true);
-       /* Setup early mapping for FDT early scan */
--      create_fdt_early_page_table(early_pg_dir, dtb_pa);
-+      create_fdt_early_page_table(early_pg_dir,
-+                                  __fix_to_virt(FIX_FDT), dtb_pa);
-       /*
-        * Bootime fixmap only can handle PMD_SIZE mapping. Thus, boot-ioremap
-@@ -1097,6 +1094,16 @@ static void __init setup_vm_final(void)
-       u64 i;
-       /* Setup swapper PGD for fixmap */
-+#if !defined(CONFIG_64BIT)
-+      /*
-+       * In 32-bit, the device tree lies in a pgd entry, so it must be copied
-+       * directly in swapper_pg_dir in addition to the pgd entry that points
-+       * to fixmap_pte.
-+       */
-+      unsigned long idx = pgd_index(__fix_to_virt(FIX_FDT));
-+
-+      set_pgd(&swapper_pg_dir[idx], early_pg_dir[idx]);
-+#endif
-       create_pgd_mapping(swapper_pg_dir, FIXADDR_START,
-                          __pa_symbol(fixmap_pgd_next),
-                          PGDIR_SIZE, PAGE_TABLE);
index 7f97e0de3946ee887c99e713f3e4bac252f6b434..4f926e410a65a3e0bba802f79b2692d5cfc992f6 100644 (file)
@@ -102,7 +102,6 @@ tracing-have-tracing_snapshot_instance_cond-write-er.patch
 maple_tree-fix-write-memory-barrier-of-nodes-once-de.patch
 ksmbd-avoid-out-of-bounds-access-in-decode_preauth_ctxt.patch
 riscv-do-not-set-initial_boot_params-to-the-linear-address-of-the-dtb.patch
-riscv-move-early-dtb-mapping-into-the-fixmap-region.patch
 riscv-add-icache-flush-for-nommu-sigreturn-trampoline.patch
 hid-intel-ish-hid-fix-kernel-panic-during-warm-reset.patch
 net-sfp-initialize-sfp-i2c_block_size-at-sfp-allocation.patch