Home | History | Annotate | Download | only in ibm4xx
History log of /src/sys/arch/powerpc/ibm4xx/pmap.c
RevisionDateAuthorComments
 1.110  01-Feb-2024  andvar s/againt/against/ in comment.
 1.109  05-Oct-2022  rin ppc4xx_tlb_enter: One more style sync. No binary changes.

Use hi and lo instead of th and tl for TLBHI and TLBLO, respectively,
as done for other functions in pmap.c.
 1.108  05-Oct-2022  rin Use %[foo], %[bar], ... instead of %0, %1, ... for asm codes.
Unify variable names if possible. No binary changes.
 1.107  05-Oct-2022  rin Minor style fixes to asm codes. No binary changes.
 1.106  12-Sep-2022  rin Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.
 1.105  08-Sep-2021  rin pte_enter() and pmap_enter_pv(): return zero for success, and
non-zero value for failure, as normally expected.
 1.104  05-Sep-2021  rin Now, ctx_flush() never fails. So, make this function void.
 1.103  05-Sep-2021  rin pmap_enter_pv(): At the moment, this function is always called with
pmap_initialized. So, convert test for this condition to KASSERT.
 1.102  05-Sep-2021  rin pmap_enter_pv(): No need to initialize npv to NULL.

No functional changes intended.
 1.101  05-Sep-2021  rin pmap_testout(): Use pmap_{protect,remove}() for va to (va + PAGE_SIZE),
instead of (va + 1).

No functional changes for the current implementation. Also, this affects
only when the function is manually called from DDB on DEBUG kernel.
 1.100  05-Sep-2021  rin if (cond) panic() or Debugger() in #ifdef DIAGNOSTIC ---> KASSERT(!cond)

There is no regression observed during a full ATF run.
 1.99  04-Sep-2021  rin Style. No binary changes.

Also, remove old #if-0'ed code block copied from oea (and therefore
will never be enabled).
 1.98  15-Apr-2021  rin Use uvm_km_alloc(9) with UVM_KMF_NOWAIT flag in pte_enter(), in order not to
sleep in pmap_enter(9) and pmap_kenter_pa(9), which can result in dead lock.

In most cases, pmap_enter(9) is used with PMAP_CANFAIL flag. In this case,
if pte_enter() fails due to uvm_km_alloc(9), we can safely return ENOMEM.
UVM layer will take care of it.

uvm_km_alloc(9) fails for pmap_enter(9) without PMAP_CANFAIL or for
pmap_kenter_pa(9), we have no choice but to panic there.

However, my testbeds for 403 and 405 survive more than a week at least
without hitting this panic.
 1.97  14-Apr-2021  rin Style fixes:

- Add "static inline" to pte_enter(), to match with its declaration.
- Remove parentheses from return.
- Use NULL instead of 0 for pointer initialization.

No binary changes.
 1.96  30-Mar-2021  rin G/C misleading <evbppc/tlb.h>. Use <powerpc/ibm4xx/tlb.h> directly.
 1.95  10-Sep-2020  rin branches: 1.95.2; 1.95.4;
Tiny cosmetic fix for previous. No functional changes.
 1.94  10-Sep-2020  rin Real fix for pmap_procwr(), attempted in revs 1.85 and 1.87:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.85
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.87

ibm4xx has VIPT icache and operations in pmap_procwr() should be done with
DMMU enabled (write back dcache into memory and invalidate icache).

When p == curproc, this is trivial. However, p != curproc needs a special
care; we cannot rely upon TLB miss handler in user context. Therefore,
extract pa and operate against it.

Note that va below VM_MIN_KERNEL_ADDRESS (== 2GB at the moment) is reserved
for direct mapping.

Tested by gdb with WIP software single stepping for ibm4xx.
 1.93  10-Sep-2020  rin Introduce PMAP_TLBDEBUG option for ibm4xx: clear only TLBHI[V] bit when
TLB entry is invalidated, instead of clearing entire TLBHI register.
 1.92  10-Sep-2020  rin pmap_kenter_pa: Remove comment which says ``Have to remove any existing
mapping first.'' Contrary to this comment, pmap_kremove(9) has never
been called there since rev 1.1, and we don't for other ports also.
 1.91  10-Sep-2020  rin Introduce PV_VA() macro to extract va from pv->pv_va by clearing
PV_WIRED flag, and use it where appropriate.

There should be no functional changes. Only for safety in future.
 1.90  06-Jul-2020  rin Include missing opt_ddb.h.
 1.89  29-Jun-2020  rin Remove evcnt(9) counter for tlbhit; there's no way to observe TLB hits
from kernel, and it just counted intersection b/w tlbmiss and tlbenter.
 1.88  19-Jun-2020  rin Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.
 1.87  19-Jun-2020  rin Oops, commit log was missing. It should be:

Revert rev 1.85:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.85

Not clearly documented in reference manual, but the previous code seems
correct; the operations must be carried out with DMMU disabled. Otherwise,
WIP software single step for userland does not work correctly (stalled
indefinitely at pmap_procwr()).

XXX
pullup to netbsd-9
 1.86  19-Jun-2020  rin *** empty log message ***
 1.85  05-Mar-2020  rin Fix pmap_procwr().

While we need to turn off IMMU, DMMU should be kept on. Otherwise,
dcbst (and also icbi probably, though not documented clearly both
for 405 and 403) should not work correctly.
 1.84  05-Mar-2020  rin Retire tlbpid_t (u_short):

- PID (ctx, ASID) is 8-bit length, not half word.
- For struct pmap, no need to use integer types smaller than word as
pm_ctx because of alignment.
- For ppc4xx_tlb_enter(), we need word-length storage for pid (and msr).

XXX
Better to rewrite pmap module with more suggestive integer types rather
than char, int, long, and so on.
 1.83  05-Mar-2020  rin pmap_procwr(): use dcbst instead of dcbf as a tiny optimization.
 1.82  05-Mar-2020  rin ppc4xx_tlb_enter(): invalidate entry after clearing MSR for sure.
 1.81  05-Mar-2020  rin Misc non-critical fixes.

- __asm --> __asm volatile for sure
- turn DEBUG code in __asm into DIAGNOSTIC code in C
- style
 1.80  21-Feb-2020  rin In ppc4xx_tlb_find_victim(), mark kernel stack page TLBF_REF instead of
TLBF_USED. This should be originally intended behavior of this code
segment, because

- TLBF_USED is already checked just before, so marking this page
TLBF_USED is no-op.
- TLBF_REF flag exempts that page from being flushed from TLB in next
scan, when kernel stack may be still there with high probability.
 1.79  20-Feb-2020  rin Clear ti_ctx when flushing a TLB entry for clarity.
 1.78  20-Feb-2020  rin Fix off-by-one error for ctx (ASID).

Note that NUM_CTX = 256 = 0 stands for disabling protection by ASID.
 1.77  20-Feb-2020  rin Fix NULL dereference; "pap" argument of pmap_extract(9) can be NULL.
 1.76  24-Dec-2016  cherry branches: 1.76.16; 1.76.20; 1.76.22;
Conform API use of uvm_hotplug(9) to documented behaviour:

When testing for an invalid uvm_physseg_t,
compare with UVM_PHYSSEG_TYPE_INVALID which is implementation agnostic.
 1.75  24-Dec-2016  cherry introduce evbppc pmap to the uvm_hotplug(9) API

Should fix build.
 1.74  23-Dec-2016  cherry "Make NetBSD great again!"

Introduce uvm_hotplug(9) to the kernel.

Many thanks, in no particular order to:

TNF, for funding the project.

Chuck Silvers - for multiple API reviews and feedback.
Nick Hudson - for testing on multiple architectures and bugfix patches.
Everyone who helped with boot testing.

KeK (http://www.kek.org.in) for hosting the primary developers.
 1.73  22-Dec-2016  cherry switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.72  27-Jan-2012  para branches: 1.72.6; 1.72.24; 1.72.28;
extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
 1.71  09-Jan-2012  kiyohara Move spl from ppc4xx_tlb_enter() to pmap_enter(). Don't call splx() on
I/DTLBMISS.
 1.70  30-Jun-2011  matt branches: 1.70.2; 1.70.6;
Modify mapiodev to take a third argument indicating whether the space
should be prefetchable (true) or not (false).
 1.69  21-Jun-2011  matt Switch to using dcache_wbinv_page
 1.68  20-Jun-2011  matt Get rid of extern inline.
Cleanup includes.
Rearrange pv_entry so that are pointers are first.
 1.67  18-Jun-2011  matt Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.66  07-Feb-2011  matt branches: 1.66.2;
Use EVCNT_ATTACH_STATIC
 1.65  14-Jan-2011  rmind branches: 1.65.2; 1.65.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.64  10-Nov-2010  uebayasi Use more VM_PHYSMEM_*() accessors. No functional changes.
 1.63  06-Nov-2010  uebayasi Merge from uebayasi-xip:
 1.60.2.5  14-Aug-2010  uebayasi Teach TLB miss handler (pmap_tlbmiss()) to map "Expansion ROM" area as
PA == VA. Now we don't need to reserve a TLB entry for it.
 1.62  25-Feb-2010  matt branches: 1.62.2;
Adapt to spr.h breakup.
 1.61  25-Feb-2010  skrll s/cpu_fork/cpu_lwp_fork/ in comment
 1.60  21-Nov-2009  rmind branches: 1.60.2;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.59  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.58  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.57  18-Aug-2009  thorpej Add a real API for testing if a page is a managed page, and adjust callers
to stop relying on vm_physseg_find() for this purpose.
 1.56  11-Aug-2009  matt Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)
 1.55  11-May-2009  he Follow up the changed prototype of pmap_enter(), flag from int to u_int.
 1.54  18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.53  14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.52  10-Dec-2008  pooka branches: 1.52.2;
Make kernel_pmap_ptr a const. Requested by steve_martin.
 1.51  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.50  17-Oct-2007  garbled branches: 1.50.16; 1.50.20; 1.50.26; 1.50.28; 1.50.40;
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.49  24-Jul-2007  hannken branches: 1.49.6;
Use PR_NOWAIT in in pmap_enter_pv() and take care of PMAP_CANFAIL. Built
after powerpc/oea/pmap.c. Now a LOCKDEBUG kernel runs on EXPLORA451.

Ok: Simon Burge <simonb@netbsd.org>
 1.48  12-Mar-2007  ad branches: 1.48.8; 1.48.10; 1.48.12;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.47  04-Mar-2007  christos branches: 1.47.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.46  22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.45  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.44  29-Nov-2006  freza branches: 1.44.4;
Instead of mapping whole RAM with reserved TLB entries, map just enough
to ensure trap code will work (that is 0 upto ${endkernel}) and leave the
rest to pmap_tlbmiss(). Mapping whole physmem into the kernel wired way
too many TLB entries, see

http://mail-index.netbsd.org/port-powerpc/2006/10/27/0000.html

for performance analysis. While there, be a bit more descriptive in
pmap_tlbmiss() comment and use macro instead of numeric constant.

OK by Simon Burge
 1.43  16-Oct-2006  kiyohara * convert ibm4xx-based evbppc from reserved-TLB entry allocation to recently
introduced ppc4xx_tlb_reserve() API.
 1.42  31-Aug-2006  freza branches: 1.42.2; 1.42.4;
* ppc4xx_tlb_reserve(): allocate "reserved" TLB entries dynamically
* ppc4xx_tlb_mapiodev(): resolve pa to va from reserved TLB entries

OK by matt@

XXX we'll keep TLB_NRESERVED defined until we fix explora to use new API
 1.41  12-Jul-2006  simonb Remove unused ppc4xx_tlb_unpin() function.
 1.40  04-Jul-2006  simonb Remove some unused variables.
 1.39  24-Dec-2005  perry branches: 1.39.4; 1.39.8; 1.39.16;
bare asm -> __asm
 1.38  24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.37  11-Dec-2005  christos merge ktrace-lwp.
 1.36  03-Jun-2005  scw branches: 1.36.2;
Appease the -Wshadow and -Wcast-qual gods.
 1.35  07-Apr-2005  yamt pmap_testout: fix too many arguments for pmap_kenter_pa.
from Shoichi Miyake. PR/29914.
 1.34  01-Apr-2005  yamt merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.33  02-Mar-2005  chs fix two bugs with wiring:
(1) in pmap_enter_pv(), we would always mark the header entry wired, even if
the new entry wasn't put there. noticed by Juergen Hannken-Illjes.
(2) in pmap_unwire(), we would never examine the header entry.
noticed by me.

while I'm here, move the counter increment in the pmap_enter() path to be
next to the corresponding PV_WIRE() call so it's more obvious they match.
 1.32  25-Feb-2005  simonb KNF: put "if (...)" and following statement on separate lines.
 1.31  27-Jan-2005  simonb Fix a typo in a printf string.
 1.30  16-Jan-2005  chs branches: 1.30.2;
implement pmap_wired_count(). fix some places we would forget to splx().
move the parts of pte.h that were used into pmap.c (since they were really
pmap-internal details) and delete ibm4xx/pte.h. other misc cleanup.
 1.29  31-Jul-2004  simonb branches: 1.29.4;
Remove some debug printf()s.
Reorder an evcnt_attach_static().
 1.28  18-Dec-2003  pk Use uvm_km_zalloc(...) instead of uvm_km_alloc1(...,1).
 1.27  20-Oct-2003  simonb Need Data Relocate in the MSR for the dcbf in pmap_procwr().
From Matt Thomas.
 1.26  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.25  12-Aug-2003  matt Nuke ci_curpm and curpm. Nuke pcb_pmreal. Those were use for spill stacks
and those no longer exist. for few uses that need CURPM, use CURPCB/PCB_PM
 1.24  19-Jul-2003  simonb Remove an unused variable.
 1.23  15-Jul-2003  lukem __KERNEL_RCSID()
 1.22  03-Jul-2003  scw Fix resident page accounting for the kernel pmap.
 1.21  10-May-2003  thorpej branches: 1.21.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.20  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.19  02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.18  11-Mar-2003  hannken Add support for the IBM 403GCX cpu. Enabled with "options PPC_IBM403".

- different set of device control registers.
- non-standard access to the time base.
- 16 byte cache lines.

Approved by: Eduardo Horvath <eeh@netbsd.org>
 1.17  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.16  06-Jan-2003  wiz writable, not writeable.
 1.15  04-Jan-2003  thorpej Make this compile without DDB.
 1.14  24-Nov-2002  thorpej Use EVCNT_TYPE_TRAP.
 1.13  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.12  11-Jul-2002  simonb Clean up some white space niggles.
 1.11  28-Mar-2002  eeh branches: 1.11.2;
Follow the post-UBC semantics of resetting ref/mod collection inside of
pmap_clear_{reference,modify}().
 1.10  13-Mar-2002  eeh pmap improvements:

Remove the cache flush routines that have been moved to cpu.c

Make sure we clear out the unused PA bits in the TTE which causes breakage
on some MMU models.
 1.9  08-Mar-2002  thorpej Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map). Try to deal with this:

* Group all information about the backend allocator for a pool in a
separate structure. The pool references this structure, rather than
the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
to become available, but will still fail if it cannot callocate KVA
space for the pages. If this happens, carefully drain all pools using
the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
some pages, and use that information to make draining easier and more
efficient.
* Get rid of PR_URGENT. There was only one use of it, and it could be
dealt with by the caller.

From art@openbsd.org.
 1.8  26-Nov-2001  thorpej Rename NOCACHE -> PPC_4XX_NOCACHE to avoid conflict with the namei
flag of the same name.

From Frank van der Linden <fvdl@wasabisystems.com>.
 1.7  26-Nov-2001  thorpej Reset the unused RPN bits in a TLBLO to 0, as specified by the PPC401B3
user's manual, page 8-40.

From Frank van der Linden <fvdl@wasabisystems.com>.
 1.6  06-Nov-2001  simonb In pmap_enter(), sync the instruction cache if VM_PROT_EXECUTE. Fixes
problems when executing programs where text is copied to a page without
a dma sync (like NFS data bcopy'd to a buffer cache page).

From discussion with Jason Thorpe and Eduardo Horvath.
 1.5  11-Sep-2001  eeh branches: 1.5.2; 1.5.4;
Implement pmap_growkernel().
 1.4  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.3  22-Jul-2001  wiz branches: 1.3.2;
Replace memcpy's of obviously overlapping regions with memmove.
Noted by Izumi Tsutsui.
 1.2  22-Jul-2001  wiz bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.1  13-Jun-2001  simonb branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.
 1.1.2.7  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.1.2.6  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.5  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.4  16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.2  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.2.1  03-Aug-2001  lukem update to -current
 1.3.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.5.4.11  07-Jan-2003  thorpej Sync with head.
 1.5.4.10  11-Dec-2002  thorpej Sync with HEAD.
 1.5.4.9  18-Oct-2002  nathanw Catch up to -current.
 1.5.4.8  01-Aug-2002  nathanw Catch up to -current.
 1.5.4.7  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.5.4.6  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.5.4.5  17-Apr-2002  nathanw Catch up to -current.
 1.5.4.4  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.4.3  08-Jan-2002  nathanw Catch up to -current.
 1.5.4.2  05-Nov-2001  briggs Initial SA support for ppc. Test-booted on sandpoint, macppc, & walnut.
mcontext and cpu_getmcontext()/cpu_setmcontext() from Klaus Klein
<kleink@netbsd.org>.
 1.5.4.1  11-Sep-2001  briggs file pmap.c was added on branch nathanw_sa on 2001-11-05 19:46:16 +0000
 1.5.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.11.2.1  16-Jul-2002  gehenna catch up with -current.
 1.21.2.8  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.7  01-Apr-2005  skrll Sync with HEAD.
 1.21.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.5  04-Feb-2005  skrll Sync with HEAD.
 1.21.2.4  17-Jan-2005  skrll Sync with HEAD.
 1.21.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1  03-Aug-2004  skrll Sync with HEAD
 1.29.4.1  29-Apr-2005  kent sync with -current
 1.30.2.3  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.30.2.2  12-Feb-2005  yamt sync with head.
 1.30.2.1  28-Jan-2005  yamt convert arch/powerpc to new apis.
 1.36.2.4  03-Sep-2007  yamt sync with head.
 1.36.2.3  26-Feb-2007  yamt sync with head.
 1.36.2.2  30-Dec-2006  yamt sync with head.
 1.36.2.1  21-Jun-2006  yamt sync with head.
 1.39.16.1  13-Jul-2006  gdamore Merge from HEAD.
 1.39.8.2  03-Sep-2006  yamt sync with head.
 1.39.8.1  11-Aug-2006  yamt sync with head
 1.39.4.1  09-Sep-2006  rpaulo sync with head
 1.42.4.2  10-Dec-2006  yamt sync with head.
 1.42.4.1  22-Oct-2006  yamt sync with head
 1.42.2.2  12-Jan-2007  ad Sync with head.
 1.42.2.1  18-Nov-2006  ad Sync with head.
 1.44.4.3  24-Mar-2007  yamt sync with head.
 1.44.4.2  12-Mar-2007  rmind Sync with HEAD.
 1.44.4.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.47.2.2  20-Aug-2007  ad Sync with HEAD.
 1.47.2.1  13-Mar-2007  ad Sync with head.
 1.48.12.1  15-Aug-2007  skrll Sync with HEAD.
 1.48.10.1  07-Aug-2007  matt Sync with HEAD.
 1.48.8.2  03-Oct-2007  garbled Sync with HEAD
 1.48.8.1  02-Aug-2007  macallan sync with HEAD
 1.49.6.1  06-Nov-2007  matt sync with HEAD
 1.50.40.1  07-Jan-2011  matt Deal with new powerpc world.
 1.50.28.2  28-Apr-2009  skrll Sync with HEAD.
 1.50.28.1  19-Jan-2009  skrll Sync with HEAD.
 1.50.26.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.50.20.4  11-Mar-2010  yamt sync with head
 1.50.20.3  19-Aug-2009  yamt sync with head.
 1.50.20.2  16-May-2009  yamt sync with head
 1.50.20.1  04-May-2009  yamt sync with head.
 1.50.16.1  17-Jan-2009  mjf Sync with HEAD.
 1.52.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.60.2.8  04-Nov-2010  uebayasi Split physical device segment pages from "managed" to "managed
device". Cache that information as a flag PG_DEVICE so that callers
don't need to walk physsegs everytime.

Remove PQ_FIXED, which means that page daemon doesn't need to know
device segment pages at all. But still fault handlers need to know
them.

I think this is what I can do best now.
 1.60.2.7  31-Oct-2010  uebayasi We already have a flag PMAP_NOCACHE. s/PMAP_UNMANAGED/PMAN_NOCACHE/.
Pointed out by Chuck Silvers, thanks.
 1.60.2.6  30-Oct-2010  uebayasi Implement pmap_physload_device(9) to replace xmd(4) MD backend.
Implement pmap_mmap(9) and use it from mem(4) and xmd(4).
 1.60.2.5  14-Aug-2010  uebayasi Teach TLB miss handler (pmap_tlbmiss()) to map "Expansion ROM" area as
PA == VA. Now we don't need to reserve a TLB entry for it.
 1.60.2.4  11-Aug-2010  uebayasi Support XIP; look up "device" vm_physseg for managed pages. Initialize
vm_physseg MD part.
 1.60.2.3  30-Apr-2010  uebayasi Sync with HEAD.
 1.60.2.2  28-Apr-2010  uebayasi Always use struct vm_physseg *vm_physmem_ptrs[] in MD code.
 1.60.2.1  27-Apr-2010  uebayasi Support PMAP_UNMANAGED in some pmaps.

(Others should be converted eventually, but no problem while managed
device page is not used.)
 1.62.2.1  05-Mar-2011  rmind sync with head
 1.65.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.65.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.66.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.70.6.1  18-Feb-2012  mrg merge to -current.
 1.70.2.1  17-Apr-2012  yamt sync with head
 1.72.28.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.72.24.1  05-Feb-2017  skrll Sync with HEAD
 1.72.6.1  03-Dec-2017  jdolecek update from HEAD
 1.76.22.1  29-Feb-2020  ad Sync with head.
 1.76.20.2  09-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #773):

sys/arch/powerpc/ibm4xx/pmap.c: revision 1.81
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.82
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.83
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.84
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.85
sys/arch/powerpc/include/ibm4xx/tlb.h: revision 1.6
sys/arch/powerpc/include/ibm4xx/pmap.h: revision 1.20

Misc non-critical fixes.
- __asm --> __asm volatile for sure
- turn DEBUG code in __asm into DIAGNOSTIC code in C
- style

ppc4xx_tlb_enter(): invalidate entry after clearing MSR for sure.

pmap_procwr(): use dcbst instead of dcbf as a tiny optimization.

Retire tlbpid_t (u_short):
- PID (ctx, ASID) is 8-bit length, not half word.
- For struct pmap, no need to use integer types smaller than word as
pm_ctx because of alignment.
- For ppc4xx_tlb_enter(), we need word-length storage for pid (and msr).
XXX
Better to rewrite pmap module with more suggestive integer types rather
than char, int, long, and so on.

Fix pmap_procwr().
While we need to turn off IMMU, DMMU should be kept on. Otherwise,
dcbst (and also icbi probably, though not documented clearly both
for 405 and 403) should not work correctly.
 1.76.20.1  27-Feb-2020  martin Pull up following revision(s) (requested by rin in ticket #731):

sys/arch/powerpc/ibm4xx/pmap.c: revision 1.80
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.77
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.78
sys/arch/powerpc/ibm4xx/pmap.c: revision 1.79

Fix NULL dereference; "pap" argument of pmap_extract(9) can be NULL.

-

Fix off-by-one error for ctx (ASID).

-

Note that NUM_CTX = 256 = 0 stands for disabling protection by ASID.
Clear ti_ctx when flushing a TLB entry for clarity.

-

In ppc4xx_tlb_find_victim(), mark kernel stack page TLBF_REF instead of
TLBF_USED. This should be originally intended behavior of this code
segment, because
- TLBF_USED is already checked just before, so marking this page
TLBF_USED is no-op.
- TLBF_REF flag exempts that page from being flushed from TLB in next
scan, when kernel stack may be still there with high probability.
 1.76.16.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.95.4.2  17-Apr-2021  thorpej Sync with HEAD.
 1.95.4.1  03-Apr-2021  thorpej Sync with HEAD.
 1.95.2.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed