Module Name: src Committed By: mhitch Date: Fri Feb 10 04:49:46 UTC 2012
Modified Files: src/sys/arch/atari/atari: atari_init.c src/sys/arch/cesfic/cesfic: pmap_bootstrap.c src/sys/arch/hp300/hp300: pmap_bootstrap.c src/sys/arch/luna68k/luna68k: pmap_bootstrap.c src/sys/arch/mac68k/mac68k: pmap_bootstrap.c src/sys/arch/mvme68k/mvme68k: pmap_bootstrap.c src/sys/arch/news68k/news68k: pmap_bootstrap.c src/sys/arch/next68k/next68k: pmap_bootstrap.c src/sys/arch/x68k/x68k: pmap_bootstrap.c Log Message: The recent kmem changes allocate a large kernel address space before pmap_init() is called, and the initial kernel PT pages aren't enough for the allocations pmap_init(). This fails because pmap_kenter_pa() tries to allocate a new kernel PT page and traps because the pmap has not been initialized. When computing the number if initial kernel PT pages, include enough to allow kmem to map the physical memory. This should fix PR/45915. OK by releng@. One mac68k system has been verified to boot. Volunteers to test the others welcome. Amigas with at least up to 128MB of memory were OK, but larger memory will need some adjusting. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/arch/atari/atari/atari_init.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/cesfic/cesfic/pmap_bootstrap.c cvs rdiff -u -r1.54 -r1.55 src/sys/arch/hp300/hp300/pmap_bootstrap.c cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c cvs rdiff -u -r1.92 -r1.93 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c cvs rdiff -u -r1.48 -r1.49 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c cvs rdiff -u -r1.37 -r1.38 src/sys/arch/news68k/news68k/pmap_bootstrap.c cvs rdiff -u -r1.39 -r1.40 src/sys/arch/next68k/next68k/pmap_bootstrap.c cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x68k/x68k/pmap_bootstrap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.97 src/sys/arch/atari/atari/atari_init.c:1.98 --- src/sys/arch/atari/atari/atari_init.c:1.97 Fri Jan 27 18:52:52 2012 +++ src/sys/arch/atari/atari/atari_init.c Fri Feb 10 04:49:44 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.97 2012/01/27 18:52:52 para Exp $ */ +/* $NetBSD: atari_init.c,v 1.98 2012/02/10 04:49:44 mhitch Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.97 2012/01/27 18:52:52 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.98 2012/02/10 04:49:44 mhitch Exp $"); #include "opt_ddb.h" #include "opt_mbtype.h" @@ -322,6 +322,12 @@ start_c(int id, u_int ttphystart, u_int if (machineid & ATARI_MILAN) ptextra += btoc(PCI_IO_SIZE + PCI_MEM_SIZE); ptextra += btoc(BOOTM_VA_POOL); + /* + * now need to account for the kmem area, which is allocated + * before pmap_init() is called. It is roughly the size of physical + * memory. + */ + ptextra += physmem; /* * The 'pt' (the initial kernel pagetable) has to map the kernel and Index: src/sys/arch/cesfic/cesfic/pmap_bootstrap.c diff -u src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.31 src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.32 --- src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.31 Sun Jan 2 18:48:05 2011 +++ src/sys/arch/cesfic/cesfic/pmap_bootstrap.c Fri Feb 10 04:49:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.31 2011/01/02 18:48:05 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.32 2012/02/10 04:49:45 mhitch Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.31 2011/01/02 18:48:05 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.32 2012/02/10 04:49:45 mhitch Exp $"); #include <sys/param.h> #include <uvm/uvm_extern.h> @@ -120,7 +120,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f lkptpa = nextpa; nextpa += PAGE_SIZE; kptpa = nextpa; - nptpages = RELOC(Sysptsize, int); + nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG); nextpa += nptpages * PAGE_SIZE; /* Index: src/sys/arch/hp300/hp300/pmap_bootstrap.c diff -u src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.54 src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.55 --- src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.54 Thu Jan 6 14:19:54 2011 +++ src/sys/arch/hp300/hp300/pmap_bootstrap.c Fri Feb 10 04:49:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.54 2011/01/06 14:19:54 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.55 2012/02/10 04:49:45 mhitch Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.54 2011/01/06 14:19:54 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.55 2012/02/10 04:49:45 mhitch Exp $"); #include <sys/param.h> #include <uvm/uvm_extern.h> @@ -126,7 +126,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f lkptpa = nextpa; nextpa += PAGE_SIZE; kptpa = nextpa; - nptpages = RELOC(Sysptsize, int) + + nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) + (IIOMAPSIZE + EIOMAPSIZE + NPTEPG - 1) / NPTEPG; nextpa += nptpages * PAGE_SIZE; Index: src/sys/arch/luna68k/luna68k/pmap_bootstrap.c diff -u src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.32 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.33 --- src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.32 Sun Jan 2 18:48:06 2011 +++ src/sys/arch/luna68k/luna68k/pmap_bootstrap.c Fri Feb 10 04:49:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.32 2011/01/02 18:48:06 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.33 2012/02/10 04:49:45 mhitch Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.32 2011/01/02 18:48:06 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.33 2012/02/10 04:49:45 mhitch Exp $"); #include "opt_m68k_arch.h" @@ -125,7 +125,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f kptmpa = nextpa; nextpa += PAGE_SIZE; kptpa = nextpa; - nptpages = RELOC(Sysptsize, int) + + nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) + (iiomapsize + NPTEPG - 1) / NPTEPG; nextpa += nptpages * PAGE_SIZE; Index: src/sys/arch/mac68k/mac68k/pmap_bootstrap.c diff -u src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.92 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.93 --- src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.92 Sun Jan 2 18:48:06 2011 +++ src/sys/arch/mac68k/mac68k/pmap_bootstrap.c Fri Feb 10 04:49:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.92 2011/01/02 18:48:06 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.93 2012/02/10 04:49:45 mhitch Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.92 2011/01/02 18:48:06 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.93 2012/02/10 04:49:45 mhitch Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -156,6 +156,16 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f kptpa = nextpa; nptpages = Sysptsize + (IIOMAPSIZE + ROMMAPSIZE + VIDMAPSIZE + NPTEPG - 1) / NPTEPG; + /* + * New kmem arena is allocated prior to pmap_init(), so we need + * additiona PT pages to account for that allocation, which is based + * on physical memory size. Just sum up memory and add enough PT + * pages for that size. + */ + mem_size = 0; + for (i = 0; i < numranges; i++) + mem_size += high[i] - low[i]; + nptpages += howmany(m68k_btop(mem_size), NPTEPG); nextpa += nptpages * PAGE_SIZE; for (i = 0; i < numranges; i++) Index: src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.48 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.49 --- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.48 Sun Jan 2 18:48:06 2011 +++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Fri Feb 10 04:49:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.48 2011/01/02 18:48:06 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.49 2012/02/10 04:49:45 mhitch Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.48 2011/01/02 18:48:06 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.49 2012/02/10 04:49:45 mhitch Exp $"); #include "opt_m68k_arch.h" @@ -135,7 +135,8 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f kptmpa = nextpa; nextpa += PAGE_SIZE; kptpa = nextpa; - nptpages = RELOC(Sysptsize, int) + (iiomappages + NPTEPG - 1) / NPTEPG; + nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) + + (iiomappages + NPTEPG - 1) / NPTEPG; nextpa += nptpages * PAGE_SIZE; /* Index: src/sys/arch/news68k/news68k/pmap_bootstrap.c diff -u src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.37 src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.38 --- src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.37 Sun Nov 20 15:38:00 2011 +++ src/sys/arch/news68k/news68k/pmap_bootstrap.c Fri Feb 10 04:49:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.37 2011/11/20 15:38:00 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.38 2012/02/10 04:49:45 mhitch Exp $ */ /* * Copyright (c) 1991, 1993 @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.37 2011/11/20 15:38:00 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.38 2012/02/10 04:49:45 mhitch Exp $"); #include "opt_m68k_arch.h" @@ -138,7 +138,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f kptmpa = nextpa; nextpa += PAGE_SIZE; kptpa = nextpa; - nptpages = RELOC(Sysptsize, int) + + nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) + (iiomapsize + eiomapsize + NPTEPG - 1) / NPTEPG; nextpa += nptpages * PAGE_SIZE; Index: src/sys/arch/next68k/next68k/pmap_bootstrap.c diff -u src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.39 src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.40 --- src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.39 Sun Jan 2 18:48:07 2011 +++ src/sys/arch/next68k/next68k/pmap_bootstrap.c Fri Feb 10 04:49:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.39 2011/01/02 18:48:07 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.40 2012/02/10 04:49:46 mhitch Exp $ */ /* * This file was taken from mvme68k/mvme68k/pmap_bootstrap.c @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.39 2011/01/02 18:48:07 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.40 2012/02/10 04:49:46 mhitch Exp $"); #include "opt_m68k_arch.h" @@ -147,7 +147,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f lkptpa = nextpa; nextpa += PAGE_SIZE; kptpa = nextpa; - nptpages = RELOC(Sysptsize, int) + + nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) + (IIOMAPSIZE + MONOMAPSIZE + COLORMAPSIZE + NPTEPG - 1) / NPTEPG; nextpa += nptpages * PAGE_SIZE; Index: src/sys/arch/x68k/x68k/pmap_bootstrap.c diff -u src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.55 src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.56 --- src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.55 Sat May 14 10:19:58 2011 +++ src/sys/arch/x68k/x68k/pmap_bootstrap.c Fri Feb 10 04:49:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.55 2011/05/14 10:19:58 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.56 2012/02/10 04:49:46 mhitch Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.55 2011/05/14 10:19:58 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.56 2012/02/10 04:49:46 mhitch Exp $"); #include "opt_m68k_arch.h" @@ -122,7 +122,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f kptmpa = nextpa; nextpa += PAGE_SIZE; kptpa = nextpa; - nptpages = RELOC(Sysptsize, int) + + nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) + (IIOMAPSIZE + NPTEPG - 1) / NPTEPG; nextpa += nptpages * PAGE_SIZE;