Home | History | Annotate | Download | only in include
History log of /src/sys/arch/sparc64/include/pmap.h
RevisionDateAuthorComments
 1.64  06-Sep-2020  mrg forward declare struct vm_page, and include uvm_prot.h and uvm_pmap.h.

fixes build, presumeably after uvm.h external rototill.
 1.63  15-Dec-2019  ad Merge from yamt-pagecache:

- do gang lookup of pages using radixtree.
- remove now unused uvm_object::uo_memq and vm_page::listq.queue.
 1.62  10-Jan-2019  mrg - move pmap_ctx() macro into pmap.h instead of duplicating it.
- fix description of some mach ddb commands.
 1.61  04-Nov-2016  macallan branches: 1.61.14; 1.61.16;
add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.60  06-Sep-2015  nakayama branches: 1.60.2;
Use <machine/*.h> instead of <sparc64/*.h> for consistency.
 1.59  04-Sep-2014  palle branches: 1.59.2;
sun4v: All cpus must be setup with a TSB descriptor, so pmap_setup_tsb_sun4v() must take a pointer to the TSB descriptor
 1.58  14-Apr-2014  martin Implement and enable TOPDOWN_VM. From Chuck Silvers.
 1.57  27-Dec-2013  palle branches: 1.57.2;
a) make the hunt through the cpus list more generic b) sun4v: ensure that the interrupt stack is mapped permanently and the TSB is setup properly - parts from OpenBSD. OK martin@
 1.56  11-Sep-2013  martin Disallow MAP_FIXED mmap's in the sparc64 VA hole (XXX - need to deal with
different variants of the hole for different CPU types)
 1.55  06-Oct-2011  mrg branches: 1.55.2; 1.55.12; 1.55.16;
make struct page_size_map consistent across DEBUG/!DEBUG kernels.
 1.54  12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.53  14-Nov-2010  uebayasi branches: 1.53.6;
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.52  06-Mar-2010  mrg branches: 1.52.2;
clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.51  04-Mar-2010  mrg - in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.
 1.50  24-Feb-2010  mrg move the tlb flush routines into cache.h to avoid machine/pmap.h polution.
 1.49  24-Feb-2010  mrg - re-introduce sp_tlb_flush_pte() and sp_tlb_flush_all() that call
the right USI/USIII version.
- define tlb_flush_pte() in terms of sp_tlb_flush_pte() for the
!MULTIPROCESSOR case

this centralises some CPU_IS_USIII_UP() tests.
 1.48  23-Feb-2010  mrg oops. don't call sp_tlb_flush_pte_usiii() on USI/USII.
 1.47  02-Feb-2010  mrg branches: 1.47.2;
- split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 1.46  01-Feb-2010  mrg - sp_tlb_flush_all() becomes sp_tlb_flush_all_us() and sp_tlb_flush_all_usiii()
- sparc64_ipi_flush_pte() becomes sparc64_ipi_flush_pte_us() and
sparc64_ipi_flush_pte_usiii()
- add some commented out code to disable interrupts and raise the traplevel
in sparc64_ipi_flush_pte_usiii()
- cache_flush_phys() was missing a little of code in the cheetah case
 1.45  30-Nov-2009  mrg delete some no longer used code:
- smp_tlb_flush_ctx()
- smp_tlb_flush_all()
- sparc64_ipi_flush_ctx()
- sparc64_ipi_flush_all()
- sp_tlb_flush_ctx()
 1.44  12-Dec-2008  pooka this header needs machine/cpuset.h
 1.43  10-Dec-2008  martin Backout previous - Matt, you probably did a partial update and didn't
pick up the sys/uvm changes.
 1.42  10-Dec-2008  mrg fix sparc64 build: provide pmap_kernel(), re-provide pmap_t.

fixes builds for my U60.
 1.41  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.40  14-Mar-2008  nakayama branches: 1.40.4; 1.40.10; 1.40.12; 1.40.14; 1.40.20;
Complete per-CPU TSBs and MMU contexts changes.
 1.39  28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.38  04-Mar-2007  christos branches: 1.38.20; 1.38.36; 1.38.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.37  20-Feb-2006  cdi branches: 1.37.20;
Use ANSI-style function definitions and declarations.
 1.36  11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.35  27-Jan-2006  cdi branches: 1.35.2; 1.35.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.34  11-Dec-2005  christos branches: 1.34.2;
merge ktrace-lwp.
 1.33  25-Feb-2005  heas branches: 1.33.4;
Add a few comments wrt PTEs
 1.32  17-Jan-2005  atatat branches: 1.32.2;
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.31  14-Mar-2004  chs branches: 1.31.8;
checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.30  26-Feb-2004  petrov Correct VA_ALIAS_MASK. From Chuck Silvers.
 1.29  24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.28  10-Aug-2003  chs remove some leftover cruft.
 1.27  14-Apr-2003  petrov branches: 1.27.2;
clean-up unused definition.
 1.26  02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.25  31-Jan-2003  martin Make the pmap count resident/wired mappings on the fly instead of
walking the page tables whenever this information is needed.

Add an option PMAP_COUNT_DEBUG to assert the new counts and the
page table walk agree.

The old solution had very bad performance impact, for example
by the high CPU load when running top(1).

Thanks to Simon Burge for pointing at the cause of the problem and
to Valeriy E. Ushakov for optimizing my simple minded assembler code.
 1.24  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.23  22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.22  16-Apr-2002  eeh We want pages modulo 16K not modulo 32K.
 1.21  24-Sep-2001  eeh branches: 1.21.4;
Change bus_space_mmap() signature to the official one.
 1.20  23-Sep-2001  chs implement pmap_wired_count().
 1.19  10-Sep-2001  chris 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.18  31-Aug-2001  martin branches: 1.18.2;
Move struct segmap declaration inside #ifndef _LOCORE to make locore.s
compilable again.
 1.17  30-Aug-2001  mrg add some sun4/sun4c/sun4m compat code so we can build 32 bit kvm. (these files are not even vaguely syncable.)
 1.16  22-Apr-2001  thorpej branches: 1.16.2;
Undo a misguided previous change to the pmap_update() API.
 1.15  22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.14  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.13  29-Oct-2000  eeh branches: 1.13.2;
Add pmap_growkernel().
 1.12  11-Sep-2000  eeh Add locking to pmap operations and support multiple physical memory segments.
 1.11  30-Dec-1999  eeh branches: 1.11.4;
Implement PMAP_PREFER().
 1.10  07-Jun-1999  eeh branches: 1.10.2;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.9  28-Mar-1999  eeh branches: 1.9.4;
Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().
 1.8  22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.7  13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.6  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.5  30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.4  27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.3  13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2  07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1  20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1  20-Jun-1998  eeh Import of sparc64.
 1.2.2.4  09-Aug-1998  eeh General pmap and debug cleanup. Added PMAP_NEW support, but it doesn't work too well yet.
 1.2.2.3  08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.2.2.2  02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.2.1  30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.9.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.3  23-Apr-2001  bouyer Sync with HEAD.
 1.10.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.10.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.11.4.1  17-Oct-2000  tv Pullup 1.12 [eeh]:
Add locking to pmap operations and support multiple physical memory segments.
 1.13.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.16.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.16.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.16.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.18.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.21.4.5  18-Oct-2002  nathanw Catch up to -current.
 1.21.4.4  20-Jun-2002  nathanw Catch up to -current.
 1.21.4.3  04-Jan-2002  eeh Cleanup.
 1.21.4.2  03-Jan-2002  petrov make kernel compile
 1.21.4.1  24-Sep-2001  petrov file pmap.h was added on branch nathanw_sa on 2002-01-03 06:42:33 +0000
 1.27.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.2.4  17-Jan-2005  skrll Sync with HEAD.
 1.27.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.27.2.1  03-Aug-2004  skrll Sync with HEAD
 1.31.8.1  29-Apr-2005  kent sync with -current
 1.32.2.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.33.4.3  17-Mar-2008  yamt sync with head.
 1.33.4.2  03-Sep-2007  yamt sync with head.
 1.33.4.1  21-Jun-2006  yamt sync with head.
 1.34.2.3  01-Mar-2006  yamt sync with head.
 1.34.2.2  18-Feb-2006  yamt sync with head.
 1.34.2.1  01-Feb-2006  yamt sync with head.
 1.35.4.1  22-Apr-2006  simonb Sync with head.
 1.35.2.1  09-Sep-2006  rpaulo sync with head
 1.37.20.1  12-Mar-2007  rmind Sync with HEAD.
 1.38.40.2  17-Jan-2009  mjf Sync with HEAD.
 1.38.40.1  03-Apr-2008  mjf Sync with HEAD.
 1.38.36.1  24-Mar-2008  keiichi sync with head.
 1.38.20.1  23-Mar-2008  matt sync with HEAD
 1.40.20.1  21-Apr-2010  matt sync to netbsd-5
 1.40.14.1  17-Mar-2010  snj Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
properly handle flushes in all cpus as necessary
 1.40.12.1  19-Jan-2009  skrll Sync with HEAD.
 1.40.10.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.40.4.2  11-Mar-2010  yamt sync with head
 1.40.4.1  04-May-2009  yamt sync with head.
 1.47.2.2  16-Nov-2010  uebayasi Sync with HEAD.
 1.47.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.52.2.2  05-Mar-2011  rmind sync with head
 1.52.2.1  16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.53.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.55.16.1  18-May-2014  rmind sync with head
 1.55.12.2  03-Dec-2017  jdolecek update from HEAD
 1.55.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.2.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.55.2.1  02-Dec-2011  yamt adapt sparc64. compile tested.
 1.57.2.1  10-Aug-2014  tls Rebase.
 1.59.2.2  05-Dec-2016  skrll Sync with HEAD
 1.59.2.1  22-Sep-2015  skrll Sync with HEAD
 1.60.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.61.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.61.16.1  10-Jun-2019  christos Sync with HEAD
 1.61.14.1  18-Jan-2019  pgoyette Synch with HEAD

RSS XML Feed