From 1bb3df50d2f0f0dc4bc35a608b5fa5834ac5c8de Mon Sep 17 00:00:00 2001 From: mrg Date: Wed, 28 Dec 2016 03:27:08 +0000 Subject: [PATCH] add an OCTEON_MEMSIZE option to override the uboot provided memory size. limiting this to 256 avoids an annoying uvm freelist problem on the 512mb erlite, partly described here: http://mail-index.netbsd.org/tech-kern/2016/12/20/msg021358.html --- sys/arch/evbmips/cavium/machdep.c | 9 +++++++-- sys/arch/evbmips/conf/files.octeon | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/arch/evbmips/cavium/machdep.c b/sys/arch/evbmips/cavium/machdep.c index c61c706015e0..9d1a4472a1ae 100644 --- a/sys/arch/evbmips/cavium/machdep.c +++ b/sys/arch/evbmips/cavium/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.9 2016/12/22 14:47:56 cherry Exp $ */ +/* $NetBSD: machdep.c,v 1.10 2016/12/28 03:27:08 mrg Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. @@ -112,9 +112,10 @@ */ #include "opt_multiprocessor.h" +#include "opt_cavium.h" #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.9 2016/12/22 14:47:56 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.10 2016/12/28 03:27:08 mrg Exp $"); #include #include @@ -203,7 +204,11 @@ mach_init(uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3) sizeof(octeon_btinfo)); corefreq = octeon_btinfo.obt_eclock_hz; +#ifdef OCTEON_MEMSIZE // avoid uvm issue + memsize = OCTEON_MEMSIZE; +#else memsize = octeon_btinfo.obt_dram_size * 1024 * 1024; +#endif octeon_cal_timer(corefreq); diff --git a/sys/arch/evbmips/conf/files.octeon b/sys/arch/evbmips/conf/files.octeon index ab5152db1a6e..0d3bb3fc8306 100644 --- a/sys/arch/evbmips/conf/files.octeon +++ b/sys/arch/evbmips/conf/files.octeon @@ -1,4 +1,4 @@ -# $NetBSD: files.octeon,v 1.5 2016/12/09 10:30:48 roy Exp $ +# $NetBSD: files.octeon,v 1.6 2016/12/28 03:27:08 mrg Exp $ file arch/evbmips/cavium/autoconf.c file arch/evbmips/cavium/machdep.c @@ -18,3 +18,6 @@ include "external/bsd/sljit/conf/files.sljit" # Memory Disk file dev/md_root.c memory_disk_hooks + +# workaround Cavium 50x0 problem vs uvm freelists +defparam opt_cavium.h OCTEON_MEMSIZE