Home | History | Annotate | Download | only in ibm4xx
History log of /src/sys/arch/powerpc/ibm4xx/trap_subr.S
RevisionDateAuthorComments
 1.30  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.29  06-Jul-2020  rin Include required opt_*.h for sure.
 1.28  01-Mar-2020  rin Implement workaround for IBM405 Errata 77 (aka CPU_210), where
interrupted stwcx. may errantly write data to memory:

https://elinux.org/images/1/1d/Ppc405gp-errata.pdf

This is because stwcx. is split into two pieces in the pipeline.

We need to
(1) insert dcbt before every stwcx. instruction, as well as
(2) insert sync before every rfi/rfci instruction.

It is unclear which processors are affected, but according to Linux,
all 405-based cores up until 405GPR and 405EP are affected:

https://github.com/torvalds/linux/blob/master/arch/powerpc/platforms/40x/Kconfig#L140

For kernel, this workaround can be restricted to affected processors.
However, for kernel modules and userland, we have to enable it for all
32bit powerpc archs in order to share common binaries as before.

Proposed on port-powerpc:

http://mail-index.netbsd.org/port-powerpc/2020/02/21/msg003583.html
 1.27  15-Jul-2018  maxv branches: 1.27.4;
Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 1.26  28-Dec-2016  rin branches: 1.26.14; 1.26.16;
PR port-powerpc/51367: kernel panic for powerpc/ibm4xx with "option DDB"

Stop using ddbstk/ipkdbstk to make nested traps possible, which avoids
kernel panics reported in the PR.

Suggested and approved by matt.
 1.25  26-Dec-2016  rin No need to have same trap handlers in trap_subr.S.
No functional changes.
 1.24  09-Feb-2013  kiyohara branches: 1.24.14; 1.24.18;
Fix KASSERT(l == curlwp)ed in mi_switch(). Don't use INTSTK of cpu_info in
INTR_PROLOG when user-mode. Interrupted user context switches to newlwp, if
sched tick. This context must save to USPACE.
When use our INTSTK?
 1.23  29-Jan-2013  kiyohara Set SRR1 to r31 in intr_exit. Not cpuinfo.
 1.22  22-Dec-2011  kiyohara branches: 1.22.6;
Check PSL_PR instead of CI_IDEPTH in INTR_PROLOG.
 1.21  15-Dec-2011  kiyohara Like intrleave_to_user:, intrleave_to_kernel: should also restore PID.
Moreover, disable transration.
 1.20  15-Dec-2011  kiyohara Store r30 and r31 beforehand to restore.
 1.19  14-Dec-2011  kiyohara Indent.
Remove white-spaces and unnecessary semi-collons.
 1.18  28-Jun-2011  kiyohara branches: 1.18.2; 1.18.6;
Must need srr0 and srr1 in FRAME_SETUP and trapexit.
parentheses is good.
Remove no-need 'addi FRAME_TF'.
 1.17  24-Jun-2011  kiyohara Fix broken stack. The r4 points cpu_info in ddb_trap. (not test)
 1.16  15-Jun-2011  cliff - FRAME_SAVE_CALLEE() starts at r14 (not r13, which is curlwp) (from matt@)
- INTR_SAVE() must also save r13 (from matt@).
- fitint must pass clock frame, not trap frame
- fix comment in pitint and fitint to indicate passing clock frame, not intr frame
 1.15  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.14  02-May-2011  kiyohara branches: 1.14.2;
Fix broken stack. The r1 is stack pointer. Not cpu_info pointer.
 1.13  18-Jan-2011  matt 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.12  05-Jan-2011  matt branches: 1.12.2;
Use regnames (%rX %crX), use m[ft]sprg[0-9]. No binary difference.
 1.11  17-Oct-2007  garbled branches: 1.11.42; 1.11.46;
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.10  11-Dec-2005  christos branches: 1.10.30; 1.10.38; 1.10.48; 1.10.50; 1.10.52; 1.10.54;
merge ktrace-lwp.
 1.9  11-Aug-2003  chs branches: 1.9.16;
catch up with changes elsewhere.
 1.8  09-Jul-2003  matt Enhance db_trace to understand syscalls and print the syscall number
that the user requested. For example:

0xd5c56f40: SC trap #240 by 0x15668c60: srr1=0xd032
r1=0xffffe470 cr=0x44000045 xer=0 ctr=0xeff27ab8
 1.7  02-Feb-2003  matt branches: 1.7.2;
Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.
 1.6  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.5  02-Aug-2002  chs use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.
 1.4  11-Jul-2002  simonb Clean up some white space niggles.
 1.3  13-Mar-2002  eeh branches: 1.3.4;
Add a vector for machine check traps.
 1.2  17-Jun-2001  simonb branches: 1.2.2; 1.2.8;
Globalise "trapexit" for new ddb tracing changes.
 1.1  13-Jun-2001  simonb 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.2.8.4  06-Aug-2002  nathanw Catch up with powerpc rototilling.
 1.2.8.3  01-Aug-2002  nathanw Catch up to -current.
 1.2.8.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.8.1  17-Jun-2001  nathanw file trap_subr.S was added on branch nathanw_sa on 2002-04-01 07:42:02 +0000
 1.2.2.2  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.2.1  16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.2  31-Aug-2002  gehenna catch up with -current.
 1.3.4.1  16-Jul-2002  gehenna catch up with -current.
 1.7.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1  03-Aug-2004  skrll Sync with HEAD
 1.9.16.1  27-Oct-2007  yamt sync with head.
 1.10.54.1  25-Oct-2007  bouyer Sync with HEAD.
 1.10.52.1  18-Oct-2007  yamt sync with head.
 1.10.50.1  06-Nov-2007  matt sync with HEAD
 1.10.48.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.10.38.1  28-May-2007  freza Add KGDB support to evbppc/virtex port. From Jean-Francois Boudreault,
cosmetics by me.

While there, generalize virtex_console_tag() to virtex_bus_space_tag()
and fix one instance of yamt-idlelwp fallout (ci_need_resched renamed
to ci_want_resched).

XXX Only compile tested since my access to suitable Virtex HW is sporadic
XXX at best.
 1.10.30.1  23-Oct-2007  ad Sync with head.
 1.11.46.1  07-Jan-2011  matt Deal with new powerpc world.
 1.11.42.3  12-Jun-2011  rmind sync with head
 1.11.42.2  31-May-2011  rmind sync with head
 1.11.42.1  05-Mar-2011  rmind sync with head
 1.12.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.14.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.18.6.1  18-Feb-2012  mrg merge to -current.
 1.18.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.18.2.1  17-Apr-2012  yamt sync with head
 1.22.6.2  03-Dec-2017  jdolecek update from HEAD
 1.22.6.1  25-Feb-2013  tls resync with head
 1.24.18.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.24.14.1  05-Feb-2017  skrll Sync with HEAD
 1.26.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.26.16.1  10-Jun-2019  christos Sync with HEAD
 1.26.14.1  28-Jul-2018  pgoyette Sync with HEAD
 1.27.4.1  03-Mar-2020  martin Pull up following revision(s) (requested by rin in ticket #755):

sys/arch/evbppc/conf/std.virtex: revision 1.4
sys/arch/powerpc/powerpc/trap_subr.S: revision 1.81
sys/arch/powerpc/ibm4xx/4xx_trap_subr.S: revision 1.8
sys/arch/evbppc/conf/std.walnut: revision 1.9
common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h: revision 1.7
sys/arch/powerpc/include/asm.h: revision 1.49
common/lib/libc/arch/powerpc/atomic/atomic_cas.S: revision 1.9
sys/arch/powerpc/ibm4xx/trap_subr.S: revision 1.28
sys/arch/powerpc/include/lock.h: revision 1.15
sys/arch/evbppc/conf/std.obs266: revision 1.3
common/lib/libc/arch/powerpc/atomic/atomic_swap.S: revision 1.8
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.61
sys/arch/powerpc/powerpc/lock_stubs.S: revision 1.12
sys/arch/evbppc/conf/std.obs200: revision 1.5

Implement workaround for IBM405 Errata 77 (aka CPU_210), where
interrupted stwcx. may errantly write data to memory:

https://elinux.org/images/1/1d/Ppc405gp-errata.pdf

This is because stwcx. is split into two pieces in the pipeline.

We need to
(1) insert dcbt before every stwcx. instruction, as well as
(2) insert sync before every rfi/rfci instruction.

It is unclear which processors are affected, but according to Linux,
all 405-based cores up until 405GPR and 405EP are affected:

https://github.com/torvalds/linux/blob/master/arch/powerpc/platforms/40x/Kconfig#L140

For kernel, this workaround can be restricted to affected processors.

However, for kernel modules and userland, we have to enable it for all
32bit powerpc archs in order to share common binaries as before.
Proposed on port-powerpc:

http://mail-index.netbsd.org/port-powerpc/2020/02/21/msg003583.html

RSS XML Feed