Author: ian
Date: Tue Dec 26 19:02:56 2017
New Revision: 327222
URL: https://svnweb.freebsd.org/changeset/base/327222

Log:
  Add a new ARM kernel option, LOCORE_MAP_MB, to control the size of the
  kernel VA mapping in the temporary page tables set up by locore-v6.S.
  
  The number used to be hard-coded to 64MB, which is still the default if
  the kernel option is not specified.  However, 64MB is insufficient for
  using a large mdroot filesystem.  The hard-coded number can't be safely
  increased because too large a number may run into memory-mapped IO space
  on some SoCs that must not be mapped as ordinary memory.

Modified:
  head/sys/arm/arm/genassym.c
  head/sys/arm/arm/locore-v6.S
  head/sys/conf/options.arm

Modified: head/sys/arm/arm/genassym.c
==============================================================================
--- head/sys/arm/arm/genassym.c Tue Dec 26 18:42:29 2017        (r327221)
+++ head/sys/arm/arm/genassym.c Tue Dec 26 19:02:56 2017        (r327222)
@@ -161,3 +161,12 @@ ASSYM(DCACHE_LINE_SIZE, offsetof(struct cpuinfo, dcach
 ASSYM(DCACHE_LINE_MASK, offsetof(struct cpuinfo, dcache_line_mask));
 ASSYM(ICACHE_LINE_SIZE, offsetof(struct cpuinfo, icache_line_size));
 ASSYM(ICACHE_LINE_MASK, offsetof(struct cpuinfo, icache_line_mask));
+
+/*
+ * Emit the LOCORE_MAP_MB option as a #define only if the option was set.
+ */
+#include "opt_locore.h"
+
+#ifdef LOCORE_MAP_MB
+ASSYM(LOCORE_MAP_MB, LOCORE_MAP_MB);
+#endif

Modified: head/sys/arm/arm/locore-v6.S
==============================================================================
--- head/sys/arm/arm/locore-v6.S        Tue Dec 26 18:42:29 2017        
(r327221)
+++ head/sys/arm/arm/locore-v6.S        Tue Dec 26 19:02:56 2017        
(r327222)
@@ -38,6 +38,11 @@
 
 __FBSDID("$FreeBSD$");
 
+/* We map 64MB of kernel unless overridden in assym.s by the kernel option. */
+#ifndef LOCORE_MAP_MB
+#define        LOCORE_MAP_MB   64
+#endif
+
 #if __ARM_ARCH >= 7
 #if defined(__ARM_ARCH_7VE__) || defined(__clang__)
 /*
@@ -176,12 +181,13 @@ ASENTRY_NP(_start)
        bl      build_pagetables
 
        /* 
-        * Next we do 64MiB starting at the physical load address, mapped to
-        * the VA the kernel is linked for.
+        * Next we map the kernel starting at the physical load address, mapped
+        * to the VA the kernel is linked for.  The default size we map is 64MiB
+        * but it can be overridden with a kernel option.
         */
        mov     r1, r5
        ldr     r2, =(KERNVIRTADDR)
-       mov     r3, #64
+       ldr     r3, =(LOCORE_MAP_MB)
        bl      build_pagetables
 
        /* Create a device mapping for early_printf if specified. */

Modified: head/sys/conf/options.arm
==============================================================================
--- head/sys/conf/options.arm   Tue Dec 26 18:42:29 2017        (r327221)
+++ head/sys/conf/options.arm   Tue Dec 26 19:02:56 2017        (r327222)
@@ -35,6 +35,7 @@ KERNBASE              opt_global.h
 KERNVIRTADDR           opt_global.h
 LINUX_BOOT_ABI         opt_global.h
 LOADERRAMADDR          opt_global.h
+LOCORE_MAP_MB          opt_locore.h
 NKPT2PG                        opt_pmap.h
 PHYSADDR               opt_global.h
 PLATFORM               opt_global.h
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to