On Thu, Jan 15, 2015 at 12:56:07PM +1100, Jonathan Gray wrote:
> The following Bitrig commit seems to be required for
> the Compulab Utilite and doesn't cause any problems on bbb.
>
> commit 6ea8cdd3daffb2edde3eadf87d3fea6d2f47384c
>
> Author: Patrick Wildt <[email protected]>
>
> Date: Sat Dec 7 15:04:09 2013 +0100
>
>
>
> Load additional memory space into UVM.
>
>
>
> Also bump the amount of 'space' to 2. More space has not
>
> been observed yet.
>
>
>
> ok drahn@
Dealing with the novena overflow reminded me of this diff so here is an
updated version with an overflow check that limits the amount of
segments loaded to VM_PHYSSEG_MAX.
Going by dmesg output the utilite u-boot reports two 1GB regions of
physical memory.
Index: armv7/armv7_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/armv7/armv7_machdep.c,v
retrieving revision 1.20
diff -u -p -r1.20 armv7_machdep.c
--- armv7/armv7_machdep.c 10 May 2015 15:56:28 -0000 1.20
+++ armv7/armv7_machdep.c 11 May 2015 03:52:12 -0000
@@ -383,8 +383,7 @@ copy_io_area_map(pd_entry_t *new_pd)
u_int
initarm(void *arg0, void *arg1, void *arg2)
{
- int loop;
- int loop1;
+ int loop, loop1, i, physsegs;
u_int l1pagetable;
pv_addr_t kernel_l1pt;
paddr_t memstart;
@@ -722,6 +721,17 @@ initarm(void *arg0, void *arg1, void *ar
uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */
uvm_page_physload(atop(physical_freestart), atop(physical_freeend),
atop(physical_freestart), atop(physical_freeend), 0);
+
+ physsegs = MIN(bootconfig.dramblocks, VM_PHYSSEG_MAX);
+
+ for (i = 1; i < physsegs; i++) {
+ vaddr_t dramstart = bootconfig.dram[i].address;
+ vaddr_t dramend = MIN((uint64_t)dramstart +
+ bootconfig.dram[i].pages * PAGE_SIZE, (paddr_t)-PAGE_SIZE);
+ physmem += (dramend - dramstart) / PAGE_SIZE;
+ uvm_page_physload(atop(dramstart), atop(dramend),
+ atop(dramstart), atop(dramend), 0);
+ }
/* Boot strap pmap telling it where the kernel page table is */
#ifdef VERBOSE_INIT_ARM
Index: include/vmparam.h
===================================================================
RCS file: /cvs/src/sys/arch/armv7/include/vmparam.h,v
retrieving revision 1.2
diff -u -p -r1.2 vmparam.h
--- include/vmparam.h 10 May 2015 15:56:28 -0000 1.2
+++ include/vmparam.h 11 May 2015 03:52:13 -0000
@@ -77,7 +77,7 @@
* max number of non-contig chunks of physical RAM you can have
*/
-#define VM_PHYSSEG_MAX 1
+#define VM_PHYSSEG_MAX 2
#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM
/*