Subject: Re: Simplify pmap->uvm reporting of KVA boundaries
To: Jason Thorpe <thorpej@wasabisystems.com>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 05/08/2003 10:59:34
--Apple-Mail-2--1052353166
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed


On Monday, May 5, 2003, at 02:45  PM, Jason Thorpe wrote:

> Here is an updated patch.  This has been booted multiuser on an HP380.

Well, there's been zero comments since the last patch I posted, so here 
is the change to the pmap(9) manual page.  I'm going to check the patch 
in now.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>


--Apple-Mail-2--1052353166
Content-Disposition: attachment;
	filename=pmap.9.diff
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="pmap.9.diff"

Index: pmap.9
===================================================================
RCS file: /cvsroot/src/share/man/man9/pmap.9,v
retrieving revision 1.22
diff -c -r1.22 pmap.9
*** pmap.9	2003/04/16 13:35:32	1.22
--- pmap.9	2003/05/08 17:50:19
***************
*** 1,6 ****
  .\"	$NetBSD: pmap.9,v 1.22 2003/04/16 13:35:32 wiz Exp $
  .\"
! .\" Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
  .\" All rights reserved.
  .\"
  .\" This code is derived from software contributed to The NetBSD Foundation
--- 1,6 ----
  .\"	$NetBSD: pmap.9,v 1.22 2003/04/16 13:35:32 wiz Exp $
  .\"
! .\" Copyright (c) 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
  .\" All rights reserved.
  .\"
  .\" This code is derived from software contributed to The NetBSD Foundation
***************
*** 45,54 ****
  .In uvm/uvm_extern.h
  .Ft void
  .Fn "pmap_init" "void"
- .Ft void
- .Fn "pmap_virtual_space" "vaddr_t *vstartp" "vaddr_t *vendp"
  .Ft vaddr_t
! .Fn "pmap_steal_memory" "vsize_t size" "vaddr_t *vstartp" "vaddr_t *vendp"
  .Ft pmap_t
  .Fn "pmap_kernel" "void"
  .Ft pmap_t
--- 45,52 ----
  .In uvm/uvm_extern.h
  .Ft void
  .Fn "pmap_init" "void"
  .Ft vaddr_t
! .Fn "pmap_steal_memory" "vsize_t size"
  .Ft pmap_t
  .Fn "pmap_kernel" "void"
  .Ft pmap_t
***************
*** 113,118 ****
--- 111,118 ----
  .Fn "PMAP_MAP_POOLPAGE" "paddr_t pa"
  .Ft paddr_t
  .Fn "PMAP_UNMAP_POOLPAGE" "vaddr_t va"
+ .Vt extern vaddr_t virtual_avail;
+ .Vt extern vaddr_t virtual_end;
  .Sh DESCRIPTION
  The
  .Nm
***************
*** 213,218 ****
--- 213,254 ----
          long        wired_count;    /* number of wired pages */
  };
  .Ed
+ .Pp
+ The
+ .Nm
+ module is also responsible for defining the boundaries of the managed
+ kernel virtual address space.
+ The global variables
+ .Dv virtual_avail
+ and
+ .Dv virtual_end
+ are provided for this purpose.
+ The
+ .Nm
+ module must initialize
+ .Dv virtual_avail
+ and
+ .Dv virtual_end
+ to the first and last kernel virtual addresses that are to be managed by
+ .Xr uvm 9 .
+ These variables must be initialized during bootstrap, before
+ .Fn main
+ is called.
+ If the
+ .Fn pmap_growkernel
+ feature is used by a
+ .Nm
+ implementation, then
+ .Dv virtual_end
+ should be set to the maximum kernel virtual address allowed by the
+ implementation.
+ If
+ .Fn pmap_growkernel
+ is not used, then
+ .Dv virtual_end
+ .Em must
+ be set to the maximum kernel virtual address that can be mapped with
+ the resources currently allocated to map the kernel virtual address space.
  .Ss WIRED MAPPINGS
  The
  .Nm
***************
*** 388,424 ****
  structure that maps the kernel virtual address space.
  .Pp
  Note that this function may be provided as a C pre-processor macro.
- .It void Fn "pmap_virtual_space" "vaddr_t *vstartp" "vaddr_t *vendp"
- The
- .Fn pmap_virtual_space
- function is called to determine the initial kernel virtual address
- space beginning and end.
- These values are used to create the kernel's virtual memory map.
- The function must set
- .Fa *vstartp
- to the first kernel virtual address that will be managed by
- .Xr uvm 9 ,
- and must set
- .Fa *vendp
- to the last kernel virtual address that will be managed by
- .Xr uvm 9 .
- .Pp
- If the
- .Fn pmap_growkernel
- feature is used by a
- .Nm
- implementation, then
- .Fa *vendp
- should be set to the maximum kernel virtual address allowed by the
- implementation.
- If
- .Fn pmap_growkernel
- is not used, then
- .Fa *vendp
- .Em must
- be set to the maximum kernel virtual address that can be mapped with
- the resources currently allocated to map the kernel virtual address
- space.
  .It pmap_t Fn "pmap_create" "void"
  Create a physical map and return it to the caller.
  The reference count on the new map is 1.
--- 424,429 ----
***************
*** 862,869 ****
  .Nm
  API.
  .Bl -tag -width indent -offset indent
! .It vaddr_t Fn "pmap_steal_memory" "vsize_t size" "vaddr_t *vstartp" \
!     "vaddr_t *vendp"
  This function is a bootstrap memory allocator, which may be provided
  as an alternative to the bootstrap memory allocator used within
  .Xr uvm 9
--- 867,873 ----
  .Nm
  API.
  .Bl -tag -width indent -offset indent
! .It vaddr_t Fn "pmap_steal_memory" "vsize_t size"
  This function is a bootstrap memory allocator, which may be provided
  as an alternative to the bootstrap memory allocator used within
  .Xr uvm 9
***************
*** 910,923 ****
  function uses address space from the range provided to
  .Xr uvm 9
  by the
! .Fn pmap_virtual_space
! call, then
  .Fn pmap_steal_memory
  must adjust
! .Fa *vstartp
  and
! .Fa *vendp
! upon return.
  .Pp
  The
  .Fn pmap_steal_memory
--- 914,929 ----
  function uses address space from the range provided to
  .Xr uvm 9
  by the
! .Dv virtual_avail
! and
! .Dv virtual_end
! variables, then
  .Fn pmap_steal_memory
  must adjust
! .Dv virtual_avail
  and
! .Dv virtual_end
! as appropriate.
  .Pp
  The
  .Fn pmap_steal_memory

--Apple-Mail-2--1052353166--