Home | History | Annotate | Download | only in include
History log of /src/sys/arch/sparc/include/pmap.h
RevisionDateAuthorComments
 1.98  23-Mar-2024  andvar s/ignorning/ignoring/ in comment.
 1.97  25-Jan-2021  mrg avoid needing <machine/promlib.h>. fixes sparc64 build.
 1.96  24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.95  18-Dec-2020  mrg remove unused and #if 0'd since introduced in 1996 struct kvm_cpustate.
sparc kvm was handled differently for the sun4m port.
 1.94  06-Sep-2020  mrg branches: 1.94.2;
forward declare struct vm_page, and include uvm_prot.h and uvm_pmap.h.

fixes build, presumeably after uvm.h external rototill.
 1.93  14-Mar-2020  ad pmap_remove_all(): Return a boolean value to indicate the behaviour. If
true, all mappings have been removed, the pmap is totally cleared out, and
UVM can then avoid doing the work to call pmap_remove() for each map entry.
If false, either nothing has been done, or some helpful arch-specific voodoo
has taken place.
 1.92  19-Oct-2013  mrg branches: 1.92.30;
- remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.91  07-Jan-2013  chs branches: 1.91.2;
switch to __USE_TOPDOWN_VM.
 1.90  14-Feb-2011  he branches: 1.90.4; 1.90.14;
Provide a macro for pmap_mmap_flags() since we define PMAP_EXCLUDE_DECLS
here.
 1.89  14-Nov-2010  uebayasi branches: 1.89.2; 1.89.4;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.88  21-Nov-2009  rmind branches: 1.88.2; 1.88.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.87  07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.86  21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.85  16-Aug-2009  skrll s/int/u_int/ for flags in pmap_enter and deal with this in rump.

Hi cegger.
 1.84  09-Dec-2008  pooka Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module. pmap_kernel()
remains as the syntactic sugar.

Bonus cosmetics round: move all the pmap_t pointer typedefs into
uvm_pmap.h.

Thanks to Greg Oster for providing cpu muscle for doing test builds.
 1.83  25-Oct-2008  mrg branches: 1.83.2;
include <sparc/pte.h> not <machine/pte.h> so this gets the right
version in 32 bit mode.
 1.82  02-Jan-2008  ad branches: 1.82.6; 1.82.10; 1.82.16;
Merge vmlocking2 to head.
 1.81  17-Oct-2007  garbled branches: 1.81.2; 1.81.4; 1.81.8;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.80  16-Jul-2007  macallan branches: 1.80.10;
turn pmap_phys_address() into a macro since all the function ever did was
to cast its parameter to paddr_t and return it
approved by mrg
 1.79  04-Mar-2007  mrg branches: 1.79.2; 1.79.10;
fix fall out from caddr_t changes.
 1.78  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.77  21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.76  11-Dec-2005  christos branches: 1.76.26;
merge ktrace-lwp.
 1.75  17-Jan-2005  atatat branches: 1.75.8;
Convert the PMAP_PREFER() macro from two arguments (offset and hint)
to four (adding size and direction).

In order for topdown uvm to be an option on ports using PMAP_PREFER,
they will need to "prefer" lower addresses if topdown is being used.
Additionally, at least one port also needs to know the size.
 1.74  16-Jan-2005  chs implement pmap_wired_count(). use more macros for determining MMU type.
 1.73  10-Apr-2004  pk branches: 1.73.4;
De-__P().
 1.72  10-Apr-2004  pk Do not maintain the number of valid pages per segment (`sg_npte') anymore
for the kernel map on SRMMU machines. This allows pmap_kenter() and
pmap_kremove() to update mappings without needing to lock the pmap
or raising the interrupt level.
 1.71  03-Apr-2004  pk Maintain pmap resident count as pages are mapped and unmapped instead
of traversing the page tables each time it's needed.
 1.70  16-Aug-2003  pk branches: 1.70.2;
sun4/sun4c MMU: keep `wired' status per page, implemented by defining a bit
in the PTE word that is not used by the hardware. Use it to unlock a `pmeg'
if the wired count in a segment drops to zero.
 1.69  12-Aug-2003  pk Use pmap_remove_all() to flush the cache by context and set a flag to
avoid subsequent user space cache flushes by page or segment in pmap_remove().
 1.68  10-May-2003  thorpej branches: 1.68.2;
Back out the following chagne:
http://mail-index.netbsd.org/source-changes/2003/05/08/0068.html

There were some side-effects that I didn't anticipate, and fixing them
is proving to be more difficult than I thought, do just eject for now.
Maybe one day we can look at this again.

Fixes PR kern/21517.
 1.67  08-May-2003  thorpej Simplify the way the bounds of the managed kernel virtual address
space is advertised to UVM by making virtual_avail and virtual_end
first-class exported variables by UVM. Machine-dependent code is
responsible for initializing them before main() is called. Anything
that steals KVA must adjust these variables accordingly.

This reduces the number of instances of this info from 3 to 1, and
simplifies the pmap(9) interface by removing the pmap_virtual_space()
function call, and removing two arguments from pmap_steal_memory().

This also eliminates some kludges such as having to burn kernel_map
entries on space used by the kernel and stolen KVA.

This also eliminates use of VM_{MIN,MAX}_KERNEL_ADDRESS from MI code,
this giving MD code greater flexibility over the bounds of the managed
kernel virtual address space if a given port's specific platforms can
vary in this regard (this is especially true of the evb* ports).
 1.66  02-Mar-2003  pk pmap_changeprot() is not a UVM <-> PMAP interface function; make it internal.
Provide pmap_kprotect() for MD code to change protection on a range of
kernel addresses (cuurent users: intr.c and mkclock.c).
 1.65  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.64  11-Jan-2003  mrg keep track of which cpu's have run a pmap and only broadcast tlb flushes to
cpu's who have done so. implement pmap_deactivate() for MULTIPROCESSOR and
call it from cpu_switch() when we are about to switch proces and when we
enter idle().

with this change, i see significantly reduced tlb IPI traffic and fork/exec
bound processes -- such as "configure" -- run significantly faster, upto
15%. i also obvserved a small (0-2%) benefit to CPU bound tasks as well.
 1.63  21-Dec-2002  pk tlb_flush_segment() and tlb_flush_region() now take a virtual address
argument instead of segment and region numbers.
 1.62  22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.61  22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.60  17-Jul-2002  thorpej Add SUN4D ifdef cases. Use CPU_HAS_SRMMU where appropriate.
 1.59  04-Dec-2001  darrenr branches: 1.59.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.58  10-Sep-2001  chris branches: 1.58.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.57  18-Jun-2001  mrg branches: 1.57.2; 1.57.4;
copy tlb_flush*() #defines here, but rename them tlb_flush*_real(). this
allows for tlb_flush*() to be defined differently if MULTIPROCESSOR.
 1.56  26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.55  23-Apr-2001  thorpej Don't need a prototype for pmap_bootstrap_alloc(); the function
does not exist in the pmap API anymore.
 1.54  22-Apr-2001  thorpej Remove pmap_kenter_pgs(). It was never really adopted by
anything, and the interface itself wasn't as flexible as
callers would have probably liked.
 1.53  22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.52  22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.51  21-Apr-2001  thorpej #define away pmap_update() in <machine/pmap.h> so that no function
call overhead is incurred as we start sprinkling pmap_update() calls
throughout the source tree (no pmaps currently defer operations, but
we are adding the infrastructure to allow them to do so).
 1.50  26-Mar-2001  pk pmap_release(), pmap_pinit() and the `pm_regstore' field are obsolete.
 1.49  01-Mar-2001  pk branches: 1.49.2;
Drop the managed() macro; it is no longer used.
State the intended use of the vm_{first,last,num}_phys variables that are
still exported from pmap.c.
 1.48  31-May-2000  pk Remove obsolete function declarations.
Move switchexit() to cpu.h
 1.47  31-May-2000  pk Fix a couple of typos.
 1.46  01-May-2000  pk branches: 1.46.2;
Implement HyperSPARC specific pmap_{zero,copy}_page functions.
 1.45  30-Apr-2000  pk Allow for CPU specific page clear and page copy functions.
 1.44  13-Mar-2000  soren Fix doubled 'the's in comments.
 1.43  14-Nov-1999  thorpej Update for pmap API change.
 1.42  04-Oct-1999  pk branches: 1.42.2; 1.42.4; 1.42.8;
Each process (i.e. each `pmap') needs a region table for each CPU.
Implement this by making the fields `pm_reg_ptp' and `pm_reg_ptp_pa'
pointers to an array of `ncpu' region table pointers and corresponding
physical addresses.

This is a somewhat unfortunate side effect of having the per-CPU data
addressable by the same virtual address on each CPU.
 1.41  12-Sep-1999  chs eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.40  08-Jul-1999  thorpej Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.39  28-Jun-1999  pk mmu_pagein() prototype: change address argument to `vaddr_t'.
 1.38  17-Jun-1999  thorpej pmap_change_wiring() -> pmap_unwire().
 1.37  17-Jun-1999  thorpej Remove pmap_pageable(); no pmap implements it, and it is not really useful,
because pmap_enter()/pmap_change_wiring() (soon to be pmap_unwire())
communicate the information in greater detail.
 1.36  26-Mar-1999  mycroft branches: 1.36.2; 1.36.4; 1.36.6;
Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.35  09-Sep-1998  thorpej Adjust for the new "reaper" kernel thread: do not free the vmspace and
u-area in machine-dependent code. Instead, call exit2() to schedule
the reaper to free them for us, once it is safe to do so (i.e. we are
no longer running on the dead proc's vmspace and stack).
 1.34  21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.33  02-Mar-1998  fvdl Make this compile again.
 1.32  08-Jan-1998  thorpej Update a comment relative to the vm_bootstrap_steal_memory() change, and
don't include pmap_free_pages() or pmap_next_page() in the new non-contig
case.
 1.31  02-Jan-1998  thorpej Implement pmap_activate().
 1.30  04-Aug-1997  pk Prototype pmap_writetext().
 1.29  06-Jul-1997  pk branches: 1.29.2;
Follow lock changes (DEBUG => LOCKDEBUG).
 1.28  06-Jul-1997  pk Adjust for generic lock changes.
 1.27  28-Jun-1997  pk Remove __VM_PMAP_HACK.
 1.26  24-May-1997  pk Define macros for encoding I/O space bits into the physical address
passed to pmap_enter().
 1.25  16-May-1997  gwr Add #define __VM_PMAP_HACK as a temporary measure.
 1.24  27-May-1996  pk prototype mmu_pagein4m() #if DEBUG is on.
 1.23  27-May-1996  pk No longer need to call mmu_pagein() through a pointer.
 1.22  20-May-1996  thorpej branches: 1.22.4;
RCS Id police.
 1.21  16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.20  31-Mar-1996  pk Add SRMMU/sun4m support. Size and layout of `struct pmap' has changed.
 1.19  14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.18  28-Feb-1996  gwr update PMAP_PREFER
 1.17  05-Jul-1995  pk Prototype pmap_dumpsize() and pmap_dumpmmu().
 1.16  13-Apr-1995  pk Make size of `struct pmap' independent of `MMU3_L', so libkvm is
usable on all machines.
 1.15  13-Apr-1995  pk 3-level MMU changes: software MMU data structures now display a VM model
consisting of `regions', `segments' and `page maps'.
 1.14  10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.13  28-Mar-1995  jtc KERNEL -> _KERNEL
 1.12  10-Mar-1995  pk Prototype for pmap_pa_exists().
 1.11  10-Jan-1995  pk pmap_init() already declared elsewhere.
 1.10  09-Jan-1995  mycroft Validate /dev/mem addresses again.
 1.9  10-Dec-1994  pk Introduce pmap_prefer() which is used to obtain a cache-friendly virtual
address.
 1.8  20-Nov-1994  deraadt copyright/Id cleanup
 1.7  14-Nov-1994  deraadt fixed rss code by charles
 1.6  06-Aug-1994  deraadt maintain resident_count and wired_count
 1.5  10-Jun-1994  pk branches: 1.5.2;
Allocate pmap's segmap separately.
Keep some tags on segment boundaries to optimise ctx_alloc().
 1.4  24-May-1994  deraadt for newish vm
 1.3  01-Feb-1994  pk pmap_t typedef outside `#ifdef KERNEL', as it is brought into user
scope by <vm/vm_map.h>
 1.2  11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1  02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.1  17-Aug-1994  deraadt update from trunk
 1.22.4.1  12-Jun-1996  pk Pull down from trunk:
> No longer need to call mmu_pagein() through a pointer.
 1.29.2.1  23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.6.1  30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.36.4.3  02-Aug-1999  thorpej Update from trunk.
 1.36.4.2  01-Jul-1999  thorpej Sync w/ -current.
 1.36.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.36.2.1  02-Jul-1999  perry pullup 1.38->1.39 (pk)
 1.42.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.42.4.1  15-Nov-1999  fvdl Sync with -current
 1.42.2.4  23-Apr-2001  bouyer Sync with HEAD.
 1.42.2.3  27-Mar-2001  bouyer Sync with HEAD.
 1.42.2.2  12-Mar-2001  bouyer Sync with HEAD.
 1.42.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.46.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.49.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.49.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.57.4.1  01-Oct-2001  fvdl Catch up with -current.
 1.57.2.4  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.57.2.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.57.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.57.2.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.58.4.7  15-Jan-2003  thorpej Sync with HEAD.
 1.58.4.6  29-Dec-2002  thorpej Sync with HEAD.
 1.58.4.5  18-Oct-2002  nathanw Catch up to -current.
 1.58.4.4  01-Aug-2002  nathanw Catch up to -current.
 1.58.4.3  08-Jan-2002  nathanw Catch up to -current.
 1.58.4.2  20-Nov-2001  pk Adjust prototypes for SA support.
 1.58.4.1  10-Sep-2001  pk file pmap.h was added on branch nathanw_sa on 2001-11-20 16:20:50 +0000
 1.59.8.1  21-Jul-2002  gehenna catch up with -current.
 1.68.2.4  17-Jan-2005  skrll Sync with HEAD.
 1.68.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.68.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.68.2.1  03-Aug-2004  skrll Sync with HEAD
 1.70.2.2  24-Apr-2004  jdc Pull up revisions 1.72-1.73 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.70.2.1  08-Apr-2004  jdc Pull up revisions 1.71 (requested by pk in ticket #96)

Maintain pmap resident count as pages are mapped and unmapped instead
of traversing the page tables each time it's needed.
 1.73.4.1  29-Apr-2005  kent sync with -current
 1.75.8.3  21-Jan-2008  yamt sync with head
 1.75.8.2  03-Sep-2007  yamt sync with head.
 1.75.8.1  26-Feb-2007  yamt sync with head.
 1.76.26.2  12-Mar-2007  rmind Sync with HEAD.
 1.76.26.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.79.10.1  03-Oct-2007  garbled Sync with HEAD
 1.79.2.1  20-Aug-2007  ad Sync with HEAD.
 1.80.10.2  09-Jan-2008  matt sync with HEAD
 1.80.10.1  06-Nov-2007  matt sync with HEAD
 1.81.8.1  02-Jan-2008  bouyer Sync with HEAD
 1.81.4.1  01-Jan-2008  ad Locking changes for sparc.
 1.81.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.82.16.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.82.10.3  11-Mar-2010  yamt sync with head
 1.82.10.2  19-Aug-2009  yamt sync with head.
 1.82.10.1  04-May-2009  yamt sync with head.
 1.82.6.1  17-Jan-2009  mjf Sync with HEAD.
 1.83.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.88.4.1  05-Mar-2011  rmind sync with head
 1.88.2.1  16-Nov-2010  uebayasi Sync with HEAD.
 1.89.4.1  17-Feb-2011  bouyer Sync with HEAD
 1.89.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.90.14.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.90.14.1  25-Feb-2013  tls resync with head
 1.90.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.90.4.1  23-Jan-2013  yamt sync with head
 1.91.2.1  18-May-2014  rmind sync with head
 1.92.30.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.94.2.2  03-Apr-2021  thorpej Sync with HEAD.
 1.94.2.1  03-Jan-2021  thorpej Sync w/ HEAD.

RSS XML Feed