Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD-current on CuBox i4Pro



>I got a CuBox i4Pro. Looking at the kernel config files already in the 
>tree, I'd guess that CUBOX-I corresponds to any of the CuBoxen, but maybe 
>not. Anyone?

current on imx6 board over 1G ram doesn't work.
options __HAVE_MM_MD_DIRECT_MAPPED_PHYS cause this problem,
but I don't even well understood and I'm investigating.

for now, please try below patch

Index: sys/arch/evbarm/nitrogen6/nitrogen6_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/nitrogen6/nitrogen6_machdep.c,v
retrieving revision 1.1
diff -a -u -r1.1 nitrogen6_machdep.c
--- sys/arch/evbarm/nitrogen6/nitrogen6_machdep.c	25 Sep 2014 05:05:28 -0000	1.1
+++ sys/arch/evbarm/nitrogen6/nitrogen6_machdep.c	3 Feb 2015 10:55:47 -0000
@@ -134,6 +134,15 @@
 	{ 0, 0, 0, 0, 0 }
 };
 
+#ifdef PMAP_NEED_ALLOC_POOLPAGE
+static struct boot_physmem bp_highgig = {
+	.bp_start = IMX6_MEM_BASE / NBPG,
+	.bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG,
+	.bp_freelist = VM_FREELIST_ISADMA,
+	.bp_flags = 0,
+};
+#endif
+
 /*
  * u_int initarm(...)
  *
@@ -213,24 +222,40 @@
 	bootconfig.dram[0].address = KERN_VTOPHYS(KERNEL_BASE);
 	bootconfig.dram[0].pages = memsize / PAGE_SIZE;
 
-	arm32_bootmem_init(bootconfig.dram[0].address,
-	    bootconfig.dram[0].pages * PAGE_SIZE, (paddr_t)KERNEL_BASE_phys);
+#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
+	const bool mapallmem_p = true;
+#ifndef PMAP_NEED_ALLOC_POOLPAGE
+	if (memsize > KERNEL_VM_BASE - KERNEL_BASE) {
+		printf("%s: dropping RAM size from %luMB to %uMB\n",
+		   __func__, (unsigned long) (memsize >> 20),
+		   (KERNEL_VM_BASE - KERNEL_BASE) >> 20);
+		memsize = KERNEL_VM_BASE - KERNEL_BASE;
+	}
+#endif
+#else /* !__HAVE_MM_MD_DIRECT_MAPPED_PHYS */
+	const bool mapallmem_p = false;
+#endif /* __HAVE_MM_MD_DIRECT_MAPPED_PHYS */
 
-	/*
-	 * This is going to do all the hard work of setting up the first and
-	 * and second level page tables.  Pages of memory will be allocated
-	 * and mapped for other structures that are required for system
-	 * operation.  When it returns, physical_freestart and free_pages will
-	 * have been updated to reflect the allocations that were made.  In
-	 * addition, kernel_l1pt, kernel_pt_table[], systempage, irqstack,
-	 * abtstack, undstack, kernelstack, msgbufphys will be set to point to
-	 * the memory that was allocated for them.
-	 */
-	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap, true);
+	arm32_bootmem_init(bootconfig.dram[0].address,
+	    memsize, (paddr_t)KERNEL_BASE_phys);
+	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, devmap,
+	    mapallmem_p);
 
 	/* we've a specific device_register routine */
 	evbarm_device_register = imx6_device_register;
 
+#ifdef PMAP_NEED_ALLOC_POOLPAGE
+	/*
+	 * If we couldn't map all of memory via TTBR1, limit the memory the
+	 * kernel can allocate from to be from the highest available 1GB.
+	 */
+	if (atop(memsize) > bp_highgig.bp_pages) {
+		bp_highgig.bp_start += atop(memsize) - bp_highgig.bp_pages;
+		arm_poolpage_vmfreelist = bp_highgig.bp_freelist;
+		return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE,
+		    &bp_highgig, 1);
+	}
+#endif
 	return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0);
 }
 
Index: sys/arch/evbarm/conf/std.nitrogen6
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/conf/std.nitrogen6,v
retrieving revision 1.1
diff -a -u -r1.1 std.nitrogen6
--- sys/arch/evbarm/conf/std.nitrogen6	25 Sep 2014 05:05:28 -0000	1.1
+++ sys/arch/evbarm/conf/std.nitrogen6	3 Feb 2015 10:55:47 -0000
@@ -11,10 +11,8 @@
 options 	NITROGEN6
 
 options 	ARM_HAS_VBAR
-options 	PMAP_NEED_ALLOC_POOLPAGE
 options 	__HAVE_CPU_COUNTER
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
-options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
 options 	TPIDRPRW_IS_CURCPU
 
 makeoptions	CPUFLAGS="-mcpu=cortex-a9"


Home | Main Index | Thread Index | Old Index