Home | History | Annotate | Download | only in include
History log of /src/sys/arch/sh3/include/cpu.h
RevisionDateAuthorComments
 1.61  23-Feb-2022  andvar fix various typos in comments, mainly immediatly/immediately/,
as well shared and recently fixed typos in OpenBSD code by Jonathan Grey.
 1.60  03-Aug-2020  uwe SH3_P2SEG_FUNC(f) - get a P2 address of a function.


Just SH3_P1SEG_TO_P2SEG + cast, but we now define SH3_P1SEG_TO_P2SEG
and SH3_P2SEG_TO_P1SEG to use arithmetic, not bitwise ops. That gives
the same result for the correct P1/P2 input values, but addition can
be done at link time with addends. Thus SH3_P2SEG_FUNC compiles to a
constant P2 address.
 1.59  01-Dec-2019  ad Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
the IPI bitmask and ci_want_resched.
 1.58  23-Nov-2019  ad cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().
 1.57  22-Aug-2018  msaitoh - Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.
 1.56  19-Oct-2013  christos branches: 1.56.28; 1.56.30;
make cpu_need_resched() macros consistent; __USE flags
 1.55  22-Dec-2010  nisimura branches: 1.55.8; 1.55.18; 1.55.22;
PROC_PC() should have been changed to LWP_PC().
 1.54  21-Oct-2009  rmind branches: 1.54.4;
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.53  22-Mar-2008  uwe branches: 1.53.4;
Revert interrupt stack changes. There are some issues and, at least
in the current form, they complicate implementation of fast software
interrupts. I'd rather get fast softints in now and may be revisit
interrupt stack later.
 1.52  16-Mar-2008  uwe Rewrite RUN_P2, RUN_P1 in asm. gcc4 is too happy to optimize away
assigned-goto versions if try to do anything fancy with them
(discovered by trying to wrap RUN_P2 into an "if").
 1.51  27-Feb-2008  xtraeme Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.50  07-Jan-2008  uwe branches: 1.50.2; 1.50.6;
Now that sh3 has didicated interrupt stack we can check for cpu_intr_p
with simple sp comparison, so we can drop ci_idepth.
 1.49  14-Dec-2007  uwe Use dedicated interrupt stack. Tested on hpcsh and landisk. This has
been sitting in my tree for quite a while. While here s/top/bottom/
in a few places related to stacks to confirm to conventional
terminology.
 1.48  03-Dec-2007  ad branches: 1.48.2; 1.48.6;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.47  17-Oct-2007  garbled branches: 1.47.2;
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.46  01-Oct-2007  ad Make want_resched a member of cpu_info.
 1.45  04-Aug-2007  ad branches: 1.45.2; 1.45.4;
Add ci_cpuid where it's missing.
 1.44  17-May-2007  yamt branches: 1.44.2; 1.44.4; 1.44.8;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.43  16-Feb-2007  ad branches: 1.43.2; 1.43.6; 1.43.8; 1.43.14;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.42  09-Feb-2007  ad Merge newlock2 to head.
 1.41  21-Jan-2006  uwe branches: 1.41.18;
Declare cpu_reset as __attribute__((__noreturn__)).
 1.40  21-Jan-2006  uwe Hide RUN_P2 and RUN_P1 from lint.
Drop CONSTCOND as lint doesn't see that code now.
While here, tweak them a bit to use less casts.
 1.39  21-Jan-2006  uwe Use uint32_t.
 1.38  24-Dec-2005  perry branches: 1.38.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.37  11-Dec-2005  christos merge ktrace-lwp.
 1.36  25-Sep-2004  yamt branches: 1.36.12;
include sys/cpu_data.h only if defined(_KERNEL)
 1.35  22-Sep-2004  yamt move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.
 1.34  24-Mar-2004  wiz Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.
 1.33  04-Jan-2004  jdolecek Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread
 1.32  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.31  18-Jan-2003  thorpej branches: 1.31.2;
Merge the nathanw_sa branch.
 1.30  13-Nov-2002  msaitoh add some definitions for P[VR]R register
 1.29  07-May-2002  thorpej branches: 1.29.6;
Make CLKF_INTR() slightly less broken. The previous definition always
tested true if the CPU was running in the kernel at the time of the clock
interrupt, therefore all such time (kernel and idle) was counted as interrupt
time. The new definition simply punts on trying to count interrupt time,
which allows us to see kernel and idle time.
 1.28  28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.27  26-Apr-2002  msaitoh add SH4 Processor Version Register
 1.26  24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.25  17-Mar-2002  uch cosmetic changes, fix comments.
 1.24  17-Mar-2002  uch change to per-process AST.
 1.23  08-Mar-2002  uch cpu_swapout() moved to cpu.h
 1.22  04-Mar-2002  uch CTL_MACHDEP definitions are integrated into sh3/include/cpu.h again.
 1.21  03-Mar-2002  uch machine dependent sysctl are moved to machine/cpu.h
dreamcast, hpcsh ... CPU_CONSDEV
mmeye, evbsh3 ... CPU_CONSDEV, CPU_LOADANDRESET
 1.20  28-Feb-2002  uch cpu_dumpconf, reserve_dumppages, dumpsys, cpu_reset are moved to sh3/sh3_machdep.c
 1.19  24-Feb-2002  uch Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.
 1.18  22-Feb-2002  uch New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.
 1.17  19-Feb-2002  uch Clean up function declaration.
 1.16  17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.15  12-Feb-2002  uch ANSIfy KNF.
 1.14  11-Feb-2002  uch add useful macro for running P2, P1 area.
 1.13  24-Jun-2001  msaitoh branches: 1.13.2;
fix KERNELMODE() macro (check MD bits, too)
 1.12  30-May-2001  mrg use _KERNEL_OPT
 1.11  02-Feb-2001  thorpej branches: 1.11.2;
Add some comments about P/USEG
 1.10  25-Aug-2000  thorpej Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.
 1.9  07-Jun-2000  tsubai branches: 1.9.2;
Remove child_return prototype; it is now in sys/proc.h.
 1.8  26-May-2000  thorpej branches: 1.8.2;
First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.

- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).

- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.

- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.7  24-Feb-2000  msaitoh SH4!
 1.6  14-Jan-2000  msaitoh add SH3_{PHYS,P1SEG,P2SEG}_TO_{PHYS,P1SEG,P2SEG} macros
 1.5  24-Dec-1999  msaitoh back to previous one (suggested by cgd)
 1.4  21-Dec-1999  msaitoh move sysctl definitions into ${MACHINE}/include/cpu.h
 1.3  21-Dec-1999  msaitoh G.C.
 1.2  14-Sep-1999  tsubai branches: 1.2.2; 1.2.8;
Catch up with -current.
 1.1  13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.2  11-Feb-2001  bouyer Sync with HEAD.
 1.2.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.8.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.1  08-Oct-2001  he Pull up revision 1.13 (requested by msaitoh):
Fix KERNELMODE macro (check MD bits too).
 1.11.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.13.2.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.2.1  16-Mar-2002  jdolecek Catch up with -current.
 1.29.6.4  11-Dec-2002  thorpej Sync with HEAD.
 1.29.6.3  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.29.6.2  21-Jun-2002  thorpej Add support for scheduler activations on SuperH. Boots multi-user
on Dreamcast (SH4) with stock userland.
 1.29.6.1  07-May-2002  thorpej file cpu.h was added on branch nathanw_sa on 2002-06-21 21:26:27 +0000
 1.31.2.5  19-Oct-2004  skrll Sync with HEAD
 1.31.2.4  24-Sep-2004  skrll Sync with HEAD.
 1.31.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.31.2.1  03-Aug-2004  skrll Sync with HEAD
 1.36.12.8  24-Mar-2008  yamt sync with head.
 1.36.12.7  17-Mar-2008  yamt sync with head.
 1.36.12.6  21-Jan-2008  yamt sync with head
 1.36.12.5  07-Dec-2007  yamt sync with head
 1.36.12.4  27-Oct-2007  yamt sync with head.
 1.36.12.3  03-Sep-2007  yamt sync with head.
 1.36.12.2  26-Feb-2007  yamt sync with head.
 1.36.12.1  21-Jun-2006  yamt sync with head.
 1.38.2.1  01-Feb-2006  yamt sync with head.
 1.41.18.1  01-Feb-2007  ad Get sh3 compiling.
 1.43.14.2  03-Oct-2007  garbled Sync with HEAD
 1.43.14.1  22-May-2007  matt Update to HEAD.
 1.43.8.1  11-Jul-2007  mjf Sync with head.
 1.43.6.4  03-Dec-2007  ad Sync with HEAD.
 1.43.6.3  09-Oct-2007  ad Sync with head.
 1.43.6.2  20-Aug-2007  ad Sync with HEAD.
 1.43.6.1  27-May-2007  ad Sync with head.
 1.43.2.2  05-Apr-2007  uwe Provide cpu_did_resched() that MI code calls with proper locking.
 1.43.2.1  25-Mar-2007  uwe Adapt sh3 to yamt-idlelwp.
 1.44.8.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.44.8.2  02-Oct-2007  joerg Sync with HEAD.
 1.44.8.1  04-Aug-2007  jmcneill Sync with HEAD.
 1.44.4.1  15-Aug-2007  skrll Sync with HEAD.
 1.44.2.1  07-Aug-2007  matt Sync with HEAD.
 1.45.4.1  06-Oct-2007  yamt sync with head.
 1.45.2.3  23-Mar-2008  matt sync with HEAD
 1.45.2.2  09-Jan-2008  matt sync with HEAD
 1.45.2.1  06-Nov-2007  matt sync with HEAD
 1.47.2.3  18-Feb-2008  mjf Sync with HEAD.
 1.47.2.2  27-Dec-2007  mjf Sync with HEAD.
 1.47.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.48.6.2  08-Jan-2008  bouyer Sync with HEAD
 1.48.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.48.2.1  26-Dec-2007  ad Sync with head.
 1.50.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.50.2.1  24-Mar-2008  keiichi sync with head.
 1.53.4.1  11-Mar-2010  yamt sync with head
 1.54.4.1  05-Mar-2011  rmind sync with head
 1.55.22.1  18-May-2014  rmind sync with head
 1.55.18.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.8.1  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.56.30.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.56.30.1  10-Jun-2019  christos Sync with HEAD
 1.56.28.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

RSS XML Feed