Home | History | Annotate | Download | only in booke
History log of /src/sys/arch/powerpc/booke/booke_pmap.c
RevisionDateAuthorComments
 1.39  24-Sep-2024  skrll Partially fix PMAP_MINIMALTLB compilation. From andvar@
 1.38  17-Apr-2023  skrll branches: 1.38.6;
KNF.
 1.37  07-Apr-2023  skrll Spaces to TAB
 1.36  26-Oct-2022  skrll MI PMAP hardware page table walker support.

This is based on code given to me by Matt Thomas a long time ago with
many updates and bugs fixes from me.
 1.35  25-Sep-2022  skrll Rename pmap_segtab_t *stp to stb for consistency with a future
pmap_pdetab_t *ptb. pmap_pdetab_t *ptp would be far too confusing.

NFC. Same code before and after.
 1.34  02-Oct-2021  skrll Pass the pmap in tlb_set_asid for the benefit of aarch64.
 1.33  02-Oct-2021  skrll Use KERNEL_PID instead of 0. NFC.
 1.32  19-Mar-2021  skrll Support pmap_growkernel and KASAN shadow mapping of the new KVA.

Neither mips nor ppc booke actually use pmap_growkernel (at present).

Thanks to rin@ for testing a similar patch on ppc booke.
 1.31  06-Jan-2021  rin Fix pmap_procwr() for powerpc/booke:

- Use PAGE_MASK, not PAGE_SIZE, to calculate page offset.
- Do not drop page offset of target address.
 1.30  20-Dec-2020  skrll Support __HAVE_PMAP_PV_TRACK in sys/uvm/pmap based pmaps (aka common pmap)
 1.29  06-Jul-2020  rin branches: 1.29.2;
Include missing opt_multiprocessor.h and opt_pmap.h.
 1.28  06-Jul-2020  rin Style and cosmetic changes. No binary changes intended.
 1.27  11-Mar-2020  thorpej With DEBUG defined, it's possible to execute a TLB-vs-segmap consistency
check from a (soft) interrupt handler. But if a platform does not otherwise
require the pmap_tlb_miss_lock, then where will be a brief window of
inconsistency that, while harmless, will still fire an assertion in the
consistency check.

Fix this with the following changes:
1- Refactor the pmap_tlb_miss_lock into MI code and rename it from
pmap_tlb_miss_lock_{enter,exit}() to pmap_tlb_miss_lock_{enter,exit}().
MD code can still define the "md" hooks as necessary, and if so, will
override the common implementation.
2- Provde a pmap_bootstrap_common() function to perform common pmap bootstrap
operations, namely initializing the pmap_tlb_miss_lock if it's needed.
If MD code overrides the implementation, it's responsible for initializing
its own lock.
3- Call pmap_bootstrap_common() from the mips, powerpc booke, and riscv
pmap_bootstrap() routines. (This required adding one for riscv.)
4- Switch powerpc booke to the common pmap_tlb_miss_lock.
5- Enable pmap_tlb_miss_lock if DEBUG is defined, even if it's not otherwise
required.

PR port-mips/55062 (Failed assertion in pmap_md_tlb_check_entry())
 1.26  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.25  24-Dec-2016  cherry branches: 1.25.14; 1.25.16;
Tell mpc85xx about uvm_hotplug(9)

Should fix the evbppc build breakage.
 1.24  11-Jul-2016  matt branches: 1.24.2;
Adapt to common pmap changes.
 1.23  05-Nov-2015  pgoyette Remove SYSVSHM-specific code. The value of shminfo.shmall is zero at
the time this pmap initialization code is called, so the increment is
a no-op. (Thanks christos@ for pointing it out.)
 1.22  26-Jan-2015  nonaka Avoid race condition between PTE update and TLB miss walk.
 1.21  23-Jan-2015  nonaka When pmap_bootstrap is called, kcpuset_running has not been created yet.
 1.20  09-Jan-2015  nonaka Use correct register for next cacheline address.
 1.19  05-Jan-2015  nonaka Initialize lock objects.
 1.18  18-Mar-2014  riastradh branches: 1.18.6;
Merge riastradh-drm2 to HEAD.
 1.17  17-Jul-2013  matt kcpuset_t changes for the pmap and removal of __cpuset_t
 1.16  07-Sep-2012  matt branches: 1.16.2; 1.16.4; 1.16.10;
Fool gcc into thinking we aren't using r31. We do use it but we don't
clobber it since it save and restore it from a temporary register.
 1.15  09-Jul-2012  matt More cleanup. Use a union (pmap_segtab) and a typedef (pmap_segtab_t). Add
more functionality from the mips pmap and try to make it more common to ease
the transition for mips in the future.
 1.14  05-Jul-2012  matt s/seg_tab/seg_ptr/
 1.13  29-Mar-2012  matt Add support PMAP_MINIMALTLB option. This changes the default use of TLB1
entries to map all of physical memory to using two TLB1 entries, one for
mapping text and one for data. The rest of memory is mapped using the
page table which is updated as needed. This is used to trap memory
corruption issues.
 1.12  02-Feb-2012  para branches: 1.12.2;
- bringing kmeminit_nkmempages back and revert pmaps that called this early
- use nkmempages to scale the kmem_arena
- reducing diff to pre kmem/vmem change
(NKMEMPAGES_MAX_DEFAULT will need adjusting on some archs)
 1.11  27-Jan-2012  para 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.10  27-Sep-2011  jym branches: 1.10.2; 1.10.6;
Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
 1.9  29-Jun-2011  dholland Add missing $NetBSD$ and/or __KERNEL_RCSID.
 1.8  29-Jun-2011  matt Add an empty pmap_md_tlb_info_init.
 1.7  23-Jun-2011  matt Move some MD parts back to the booke pmap.c. Cleanup initialization a bit.
 1.6  20-Jun-2011  matt PowerPC now exports a common view of cpu.h, vmparam.h and pmap.h
when building a MODULAR kernel or compiling _MODULE.
It should be noted that MODULAR or _MODULE export a view of the kernel
as being MULTIPROCESSOR (even if isn't).
The shared pmap TLB uses mdpg in places where it used mdpg to avoid
deadly embrance inclusion problems.
 1.5  12-Jun-2011  matt For debugging, use UVMHIST to create kernel histories pmaphist and
pmapexechist. This replaces the old pmapdebug/PDB stuff.
In ddb, you can just use kernhist_dump(pmaphist) to view the history
or vmstat -H from userland.
 1.4  05-Jun-2011  matt Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.
 1.3  17-Feb-2011  matt branches: 1.3.2; 1.3.4;
Use _PMAP_PRIVATE to control the inclusion of <powerpc/booke/cpuvar.h>.
This prevents most of the MI files from depending on it.
 1.2  18-Jan-2011  matt branches: 1.2.2;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.
 1.1  07-Jan-2011  matt branches: 1.1.2; 1.1.4;
file booke_pmap.c was initially added on branch matt-nb5-pq3.
 1.1.4.1  06-Jun-2011  jruoho Sync with HEAD.
 1.1.2.2  14-Oct-2011  matt Sync with current pulling P2020 and other newer processor support.
 1.1.2.1  07-Jan-2011  matt Add mpc85xx support for netbsd-5 (with some incompatible kernel changes).
 1.2.2.1  05-Mar-2011  bouyer Sync with HEAD
 1.3.4.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3.2.3  12-Jun-2011  rmind sync with head
 1.3.2.2  05-Mar-2011  rmind sync with head
 1.3.2.1  17-Feb-2011  rmind file booke_pmap.c was added on branch rmind-uvmplock on 2011-03-05 20:51:33 +0000
 1.10.6.2  05-Apr-2012  mrg sync to latest -current.
 1.10.6.1  18-Feb-2012  mrg merge to -current.
 1.10.2.3  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.10.2.2  30-Oct-2012  yamt sync with head
 1.10.2.1  17-Apr-2012  yamt sync with head
 1.12.2.1  09-May-2012  riz Pull up following revision(s) (requested by matt in ticket #241):
sys/arch/powerpc/conf/kern-mb.ldscript: revision 1.1
sys/arch/powerpc/include/booke/pmap.h: revision 1.9
sys/arch/powerpc/booke/e500_tlb.c: revision 1.8
sys/arch/powerpc/conf/files.powerpc: revision 1.83
sys/arch/powerpc/booke/booke_pmap.c: revision 1.13
sys/arch/powerpc/include/booke/e500var.h: revision 1.5
sys/arch/evbppc/mpc85xx/machdep.c: revision 1.23
Add ldscript which aligns .data to a 1MB boundary. (used for testing)
Add PMAP_MINIMALTLB defflag
Add vsize_t to pmap_md_{un,}map_poolpage.
Add pmap_kvptefill prototype.
Slightly change pmap_bootstrap prototype.
Add e500_tlb_minimize prototype.
Add support PMAP_MINIMALTLB option. This changes the default use of TLB1
entries to map all of physical memory to using two TLB1 entries, one for
mapping text and one for data. The rest of memory is mapped using the
page table which is updated as needed. This is used to trap memory
corruption issues.
Add support for PMAP_MINIMALTLB.
 1.16.10.1  23-Jul-2013  riastradh sync with HEAD
 1.16.4.1  28-Aug-2013  rmind sync with head
 1.16.2.2  03-Dec-2017  jdolecek update from HEAD
 1.16.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.6.4  05-Feb-2017  skrll Sync with HEAD
 1.18.6.3  05-Oct-2016  skrll Sync with HEAD
 1.18.6.2  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.18.6.1  06-Apr-2015  skrll Sync with HEAD
 1.24.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.25.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.25.16.1  10-Jun-2019  christos Sync with HEAD
 1.25.14.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.29.2.2  03-Apr-2021  thorpej Sync with HEAD.
 1.29.2.1  03-Jan-2021  thorpej Sync w/ HEAD.
 1.38.6.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed