Commit Graph

34 Commits

Author SHA1 Message Date
Sebastian Huber
a6f84b2753 powerpc: Add 64-bit context/interrupt support
Update #3082.
2017-08-22 16:26:19 +02:00
Sebastian Huber
32b4a0c427 Simplify TLS support in context switch
There is no need to save the thread pointer in _CPU_Context_switch()
since it is a thread invariant.  It is initialized once in
_CPU_Context_Initialize().
2017-06-09 07:30:41 +02:00
Sebastian Huber
a11e1ff576 powerpc: Optimize AltiVec context switch
Use r8 instead of r5 to slightly optimize _CPU_Context_switch().  It is
not a big deal, however, we already assume r12 is used by
_CPU_Context_switch().  Treat r5 the in same way.
2017-03-07 07:58:11 +01:00
Sebastian Huber
7ce60b378d powerpc: Use Per_CPU_Control::isr_dispatch_disable
Update #2751.
2016-11-18 07:30:35 +01:00
Sebastian Huber
d5e073cde7 score: Allow interrupts during thread dispatch
Use a processor-specific interrupt frame during context switches in case
the executing thread is longer executes on the processor and the heir
thread is about to start execution.  During this period we must not use
a thread stack for interrupt processing.

Update #2809.
2016-11-18 07:30:34 +01:00
Sebastian Huber
275032b85a powerpc: Fix SMP context switch
We need the unmodified r4 for get_potential_new_heir.

This partially reverts commit 8d785f72d9.
2016-09-08 09:55:26 +02:00
Sebastian Huber
8d785f72d9 bsps/powerpc: Fix AtliVec context switch
Properly pass the stack aligned context to _CPU_Context_switch_altivec()
since _CPU_altivec_ctxt_off defined via ppc_context.

Close #2761.
2016-07-19 08:12:32 +02:00
Sebastian Huber
258ad71e96 SMP: Fix and optimize thread dispatching
According to the C11 and C++11 memory models only a read-modify-write
operation guarantees that we read the last value written in modification
order.  Avoid the sequential consistent thread fence and instead use the
inter-processor interrupt to set the thread dispatch necessary
indicator.
2015-09-28 13:56:57 +02:00
Sebastian Huber
3e2647a714 powerpc: AltiVec and FPU context support
Add AltiVec and FPU support to the Context_Control in case we use the
e6500 multilib.

Add PPC_MULTILIB_ALTIVEC and PPC_MULTILIB_FPU multilib defines.  Add
non-volatile AltiVec and FPU context to Context_Control.  Add save/restore of
non-volatile AltiVec and FPU to _CPU_Context_switch().  Add save/restore
of volatile AltiVec and FPU context to the exception code.  Adjust data
cache optimizations for the new context and cache line size.
2015-01-13 11:37:28 +01:00
Sebastian Huber
2e19bfde2f powerpc: Use PPC_HAS_FPU
Provide floating point context support only if PPC_HAS_FPU == 1.
2015-01-09 14:05:46 +01:00
Sebastian Huber
7c16e1a514 powerpc: Set PPC_DEFAULT_CACHE_LINE_SIZE for e6500 2015-01-09 14:05:08 +01:00
Sebastian Huber
fbda4a8834 score: PR2183: Fix context switch on SMP
Fix context switch on SMP for ARM, PowerPC and SPARC.

Atomically test and set the is executing indicator of the heir context
to ensure that at most one processor uses the heir context.  Break the
busy wait loop also due to heir updates.
2014-07-04 13:17:19 +02:00
Sebastian Huber
11b05f11d4 score: Fix CPU context usage on SMP
We must not alter the is executing indicator in
_CPU_Context_Initialize() since this would cause an invalid state during
a self restart.

The is executing indicator must be valid at creation time since
otherwise _Thread_Kill_zombies() uses an undefined value for not started
threads.  This could result in a system life lock.
2014-05-08 13:02:40 +02:00
Sebastian Huber
38b59a6d30 score: Implement forced thread migration
The current implementation of task migration in RTEMS has some
implications with respect to the interrupt latency. It is crucial to
preserve the system invariant that a task can execute on at most one
processor in the system at a time. This is accomplished with a boolean
indicator in the task context. The processor architecture specific
low-level task context switch code will mark that a task context is no
longer executing and waits that the heir context stopped execution
before it restores the heir context and resumes execution of the heir
task. So there is one point in time in which a processor is without a
task. This is essential to avoid cyclic dependencies in case multiple
tasks migrate at once. Otherwise some supervising entity is necessary to
prevent life-locks. Such a global supervisor would lead to scalability
problems so this approach is not used. Currently the thread dispatch is
performed with interrupts disabled. So in case the heir task is
currently executing on another processor then this prolongs the time of
disabled interrupts since one processor has to wait for another
processor to make progress.

It is difficult to avoid this issue with the interrupt latency since
interrupts normally store the context of the interrupted task on its
stack. In case a task is marked as not executing we must not use its
task stack to store such an interrupt context. We cannot use the heir
stack before it stopped execution on another processor. So if we enable
interrupts during this transition we have to provide an alternative task
independent stack for this time frame. This issue needs further
investigation.
2014-05-07 14:26:28 +02:00
Chris Johns
c49985691f Change all references of rtems.com to rtems.org. 2014-03-21 08:10:47 +11:00
Sebastian Huber
057c294afd bsps/powerpc: Unconditionally clear reservations 2013-12-03 12:58:47 +01:00
Sebastian Huber
39a4574652 powerpc: Add r2 to CPU context
The r2 may be used for thread-local storage.
2013-11-18 14:56:43 +01:00
Sebastian Huber
18e2fbe70d smp: Fix PowerPC context switch 2013-06-07 17:06:43 +02:00
Sebastian Huber
1869bb7101 powerpc: Simplify context switch
PowerPC cores with the SPE (Signal Processing Extension) have 64-bit
general-purpose registers.  The SPE context switch code has been merged
with the standard context switch code.  The context switch may use cache
operations to increase the performance.  It will be ensured that the
context is 32-byte aligned (PPC_DEFAULT_CACHE_LINE_SIZE).  This
increases the overall memory size of the context area in the thread
control block slightly.  The general-purpose registers GPR2 and GPR13
are no longer part of the context.  The BSP must initialize these
registers during startup (usually initialized by the __eabi() function).

The new BSP option BSP_USE_DATA_CACHE_BLOCK_TOUCH can be used to enable
the dcbt instruction in the context switch.

The new BSP option BSP_USE_SYNC_IN_CONTEXT_SWITCH can be used to enable
sync and isync instructions in the context switch.  This should be not
necessary in most cases.
2012-06-04 09:54:31 +02:00
Joel Sherrill
9b4422a251 Remove All CVS Id Strings Possible Using a Script
Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines
  next to each other after Id string line removed.
+ remove entire comment blocks which only exited to
  contain CVS Ids
+ If the processing left a blank line at the top of
  a file, it was removed.
2012-05-11 08:44:13 -05:00
Sebastian Huber
fdd9de8001 2011-07-21 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR 1799/bsps
	* new-exceptions/bspsupport/ppc_exc_async_normal.S: New file.
	* new-exceptions/cpu.c, new-exceptions/cpu_asm.S,
	new-exceptions/bspsupport/ppc_exc_asm_macros.h,
	new-exceptions/bspsupport/ppc_exc_global_handler.c,
	new-exceptions/bspsupport/ppc_exc_prologue.c,
	new-exceptions/bspsupport/vectors.h: Added support for SPE.
	* configure.ac, preinstall.am, Makefile.am: Added support for qoriq
	BSPs.
2011-07-21 15:03:31 +00:00
Sebastian Huber
ae2b1e056a 2011-06-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* new-exceptions/cpu_asm.S: Use BSP_DATA_CACHE_ENABLED instead of
	PPC_USE_DATA_CACHE.
2011-06-07 12:59:39 +00:00
Till Straumann
c7f8408d31 2009-12-01 Till Straumann <strauman@slac.stanford.edu>
* new-exceptions/cpu.c, new-exceptions/cpu_asm.S,
	new-exceptions/bspsupport/ppc_exc_asm_macros.h,
	new-exceptions/bspsupport/ppc_exc_initialize.c,
	new-exceptions/bspsupport/vectors.h:
	Added AltiVec support (save/restore volatile vregs
	across exceptions).
2009-12-02 01:41:57 +00:00
Till Straumann
368894feef FP context switch may be called from environment with no
FPU available (ISR, int-only task) - switch FPU on
 for the switch and restore MSR_FP after it's done.
2006-06-19 19:59:59 +00:00
Till Straumann
36c30fe2e7 2005-11-21 Till Straumann <strauman@slac.stanford.edu>
* new-exceptions/cpu_asm.S: the book says a context
    synchronizing instruction (isync) is necessary after flipping
    certain bits (e.g, MSR_FP) in msr -- since this could happen as
    part of a context switch I added 'isync'.
2005-11-22 01:24:10 +00:00
Ralf Corsepius
3e5a93cc86 2005-02-14 Ralf Corsepius <ralf.corsepius@rtems.org>
* cpu.c, cpu_asm.S, irq_stub.S: #include <rtems/powerpc/powerpc.h>.
2005-02-14 04:44:17 +00:00
Ralf Corsepius
f05b2ac0bc Remove duplicate white lines. 2004-04-21 16:01:48 +00:00
Ralf Corsepius
6128a4aa5e Remove stray white spaces. 2004-04-21 10:43:04 +00:00
Ralf Corsepius
3239698d1f Remove stray white spaces. 2004-04-15 13:26:21 +00:00
Ralf Corsepius
b49bcfcec6 2004-04-01 Ralf Corsepius <ralf_corsepius@rtems.org>
* cpu_asm.S: Include <rtems/asm.h> instead of <asm.h>.
2004-04-01 10:12:49 +00:00
Joel Sherrill
9563a3a59d 2003-09-04 Joel Sherrill <joel@OARcorp.com>
* cpu.c, cpu_asm.S: URL for license changed.
2003-09-04 18:52:41 +00:00
Joel Sherrill
3ddf3b5e96 2001-11-14 Till Straumann <strauman@SLAC.Stanford.EDU>
* new_exception_processing/cpu_asm.S: Support double or single
	precision context switches.  Note that doing a single precision
	context save/restore on a double precision PowerPC machine does not
	only result in rounding errors but also screws up the FPSCR register!
2001-11-14 20:14:35 +00:00
Joel Sherrill
590aba4f1a 2001-10-12 Joel Sherrill <joel@OARcorp.com>
* mpc6xx/clock/c_clock.c, mpc6xx/clock/c_clock.h, mpc8xx/clock/clock.c,
	mpc8xx/timer/timer.c, new_exception_processing/cpu.c,
	new_exception_processing/cpu.h, new_exception_processing/cpu_asm.S,
	old_exception_processing/cpu.c, old_exception_processing/cpu.h,
	old_exception_processing/cpu_asm.S, old_exception_processing/rtems.S:
	Fixed typo.
2001-10-12 21:03:53 +00:00
Joel Sherrill
acc25eec35 Merged of mcp750 and mvme2307 BSP by Eric Valette <valette@crf.canon.fr>.
As part of this effort, the mpc750 libcpu code is now shared with the
ppc6xx.
1999-12-02 14:31:19 +00:00