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.
This commit is contained in:
mhitch 2012-02-10 04:49:44 +00:00
parent b1c34b0c9a
commit 2c61985659
9 changed files with 42 additions and 25 deletions

View File

@ -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 ttphysize, u_int stphysize,
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

View File

@ -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 firstpa)
lkptpa = nextpa;
nextpa += PAGE_SIZE;
kptpa = nextpa;
nptpages = RELOC(Sysptsize, int);
nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG);
nextpa += nptpages * PAGE_SIZE;
/*

View File

@ -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 firstpa)
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;

View File

@ -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 firstpa)
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;

View File

@ -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 firstpa)
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++)

View File

@ -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 firstpa)
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;
/*

View File

@ -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 firstpa)
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;

View File

@ -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 firstpa)
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;

View File

@ -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 firstpa)
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;