History log of /linux-master/arch/sh/kernel/cpu/sh3/entry.S
Revision Date Author Comments
# a8ac2961 01-Jun-2023 Sergey Shtylyov <s.shtylyov@omp.ru>

sh: Avoid using IRQ0 on SH3 and SH4

IRQ0 is no longer returned by platform_get_irq() and its ilk -- they now
return -EINVAL instead. However, the kernel code supporting SH3/4-based
SoCs still maps the IRQ #s starting at 0 -- modify that code to start the
IRQ #s from 16 instead.

The patch should mostly affect the AP-SH4A-3A/AP-SH4AD-0A boards as they
indeed are using IRQ0 for the SMSC911x compatible Ethernet chip.

Fixes: ce753ad1549c ("platform: finally disallow IRQ0 in platform_get_irq() and its ilk")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/71105dbf-cdb0-72e1-f9eb-eeda8e321696@omp.ru
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>


# 7a202ec7 08-Nov-2020 Wang Qing <wangqing@vivo.com>

arch: sh: remove duplicate include

Remove duplicate header which is included twice.

Signed-off-by: Wang Qing <wangqing@vivo.com>
Signed-off-by: Rich Felker <dalias@libc.org>


# 5ab5d57c 28-Dec-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

sh: sh3: convert to SPDX identifiers

Update license to use SPDX-License-Identifier instead of verbose license
text.

Link: http://lkml.kernel.org/r/87bm60csyl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Cc: Rich Felker <dalias@libc.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 5a1dc78a 13-May-2012 Paul Mundt <lethal@linux-sh.org>

sh: Support thread fault code encoding.

This provides a simple interface modelled after sparc64/m32r to encode
the error code in the upper byte of thread_info for finer-grained
handling in the page fault path.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 1af0b2fc 30-Jan-2010 Matt Fleming <matt@console-pimps.org>

sh: Remove superfluous setup_frame_reg call

There's no need to setup the frame pointer again in
call_handle_tlbmiss. The frame pointer will already have been setup in
handle_interrupt.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 1dca56f1 27-Jan-2010 Matt Fleming <matt@console-pimps.org>

sh: Setup frame pointer in handle_exception path

In order to allow the DWARF unwinder to unwind through exceptions we
need to setup the frame pointer register (r14).

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 15dfdddb 18-Oct-2009 Paul Mundt <lethal@linux-sh.org>

sh: Disable SCIF2 on the SH-X3 proto CPU.

SCIF2 and the FPU exceptions happen to share vector numbers, one in
EXPEVT and the other in INTEVT. This is a violation of the interface and
should have never made it in to silicon. On top of that, the demux hack
that was added for special dispatch is rather error prone, and introduces
more problems than it solves. Kill all of it off, and just refuse to deal
with SCIF2 outright.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 421f7a5d 26-Sep-2009 Matt Fleming <matt@console-pimps.org>

sh: Don't enable interrupts in the page fault path

There's already code in do_page_fault() to conditionally enable
interrupts, so we don't need to unconditonally enable them before
calling it. This fixes a lockdep warning where we called
trace_hardirqs_off() but with irqs still enabled.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# ade315d8 01-Sep-2009 Paul Mundt <lethal@linux-sh.org>

sh: Kill off kgdb's magical NMI debouncing.

The kgdb stub has traditionally tied in to the NMI slot, and manually
handled debounce. Now that we have a generic way to do this instead, all
of the stub-specific debounce silliness can be killed off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 1e1030dc 01-Sep-2009 Paul Mundt <lethal@linux-sh.org>

sh: nmi_debug support.

This implements support for NMI debugging that was shamelessly copied
from the avr32 port. A bit of special magic is needed in the interrupt
exception path given that the NMI exception handler is stubbed in to the
regular exception handling table despite being reported in INTEVT. So we
mangle the lookup and kick off an EXPEVT-style exception dispatch from
the INTEVT path for exceptions that do_IRQ() has no chance of handling.
As a result, we also drop the evt2irq() conversion from the do_IRQ() path
and just do it in assembly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# fea966f7 24-Aug-2009 Stuart Menefy <stuart.menefy@st.com>

sh: Remove implicit sign extension from assembler immediates

The SH instruction set has several instructions which accept an 8 bit
immediate operand. For logical instructions this operand is zero extended,
for arithmetic instructions the operand is sign extended. After adding an
option to the assembler to check this, it was found that several pieces
of assembly code were assuming this behaviour, and in one case
getting it wrong.

So this patch explicitly sign extends any immediate operands, which makes
it obvious what is happening, and fixes the one case which got it wrong.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# fe98dd31 20-Aug-2009 Matt Fleming <matt@console-pimps.org>

sh: Setup the frame pointer in handle_interrupt

When CONFIG_DWARF_UNWINDER is enabled setup r14 in handle_interrupt, so
that we can figure out what function was running when we were
interrupted.

Signed-off-by: Matt Fleming <matt@console-pimps.org>


# f3a83088 17-Aug-2009 Matt Fleming <matt@console-pimps.org>

sh: Add a few missing irqflags tracing markers.

save_regs contains an SR modification without an irqflags annotation,
which resulted in a missing TRACE_IRQS_OFF in the interrupt exception
path on SH-3/SH4.

I've also moved the TRACE_IRQS_OFF/ON annotation when returning from the
interrupt to just before we call __restore_all. This seems like the most
logical place to put this because the annotation is for when we restore
the SR register so we should delay the annotation until as last as
possible.

We were also missing a TRACE_IRQS_OFF in resume_kernel when
CONFIG_PREEMPT is enabled.

The end result is that this fixes up the lockdep engine debugging support
with CONFIG_PREEMPT enabled on all SH-3/4 parts.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 8010fbe7 14-Aug-2009 Paul Mundt <lethal@linux-sh.org>

sh: TLB fast path optimizations for load/store exceptions.

This only bothers with the TLB entry flush in the case of the initial
page write exception, as it is unecessary in the case of the load/store
exceptions.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 112e5847 14-Aug-2009 Paul Mundt <lethal@linux-sh.org>

sh: TLB protection violation exception optimizations.

This adds a bit of rework to have the TLB protection violations skip the
TLB miss fastpath and go directly in to do_page_fault(), as these require
slow path handling.

Based on an earlier patch by SUGIOKA Toshinobu.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 0b930489 02-Aug-2009 Matt Fleming <matt@console-pimps.org>

sh: Setup the frame register in asm code

In order to use DWARF unwinder info the frame register has to contain a
valid value. Whilst GCC takes care of this for C code, we have to do it
ourselves for assembly.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 01ab1039 03-Apr-2009 Michael Trimarchi <trimarchi@gandalf.sssup.it>

sh: Fix up DSP context save/restore.

There were a number of issues with the DSP context save/restore code,
mostly left-over relics from when it was introduced on SH3-DSP with
little follow-up testing, resulting in things like task_pt_dspregs()
referencing incorrect state on the stack.

This follows the MIPS convention of tracking the DSP state in the
thread_struct and handling the state save/restore in switch_to() and
finish_arch_switch() respectively. The regset interface is also updated,
which allows us to finally be rid of task_pt_dspregs() and the special
cased task_pt_regs().

Signed-off-by: Michael Trimarchi <michael@evidence.eu.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 7a516280 12-Mar-2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>

sh: Fix compile error by operands(mov.l) in sh3/entry.S

-- log --
arch/sh/kernel/cpu/sh4/../sh3/entry.S:365: Error: invalid operands for opcode
make[4]: *** [arch/sh/kernel/cpu/sh4/../sh3/entry.o] Error 1
make[3]: *** [arch/sh/kernel/cpu/sh4] Error 2
-- log --

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 2ef7f0da 06-Mar-2009 Magnus Damm <damm@igel.co.jp>

sh: hibernation support

Add Suspend-to-disk / swsusp / CONFIG_HIBERNATION support
to the SuperH architecture.

To suspend, use "swapon /dev/sda2; echo disk > /sys/power/state"
To resume, pass "resume=/dev/sda2" on the kernel command line.

The patch "pm: rework includes, remove arch ifdefs V2" is
needed to allow the generic swsusp code to build properly.

Hibernation is not enabled with this patch though, a patch
setting ARCH_HIBERNATION_POSSIBLE will be submitted later.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 0d5e19ab 27-Feb-2009 Paul Mundt <lethal@linux-sh.org>

sh: Fix up SH-X3 general exception handler build.

With the recent entry.S refactoring, the SH-X3 path had a mov.l for a
register to register copy, resulting in:

AS arch/sh/kernel/cpu/sh4/../sh3/entry.o
arch/sh/kernel/cpu/sh4/../sh3/entry.S: Assembler messages:
arch/sh/kernel/cpu/sh4/../sh3/entry.S:366: Error: invalid operands for opcode
make[3]: *** [arch/sh/kernel/cpu/sh4/../sh3/entry.o] Error 1

Switch it over to a mov to fix it up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 0197f21c 27-Feb-2009 Magnus Damm <damm@igel.co.jp>

sh: prefetch early exception data on sh4/sh4a.

Prefetch early exception data. There is unused space in our
exception handler cache line anyway, so this is almost free.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 4f099ebb 23-Feb-2009 Magnus Damm <damm@igel.co.jp>

sh: remove EXPEVT vector from stack on sh3/sh4/sh4a

Remove EXPEVT vector from the stack, lookup_exception_vector()
for sh3/sh4/sh4a is already using k2 to get the vector.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 1dd22722 23-Feb-2009 Magnus Damm <damm@igel.co.jp>

sh: rework register restore code for sh3/sh4/sh4a

This patch reworks the sh3/sh4/sh4a register restore code in
the following ways:
- break out restore_regs() from restore_all()
- the register saving order is unchanged
- use restore_regs() in sh_bios_handler and restore_all
- document the function

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 1d015cf0 23-Feb-2009 Magnus Damm <damm@igel.co.jp>

sh: shared register saving code for sh3/sh4/sh4a

This patch reworks the sh3/sh4/sh4a register saving code in
the following ways:
- break out prepare_stack_save_dsp() from handle_exception()
- break out save_regs() from handle_exception()
- the register saving order is unchanged
- align new functions to fit in cache lines
- separate exception code from interrupt code
- keep main code flow in a single cache line per exception vector
- use bsr/rts for regular functions (save pr first)
- keep data in one shared cache line (exception_data)
- document the functions
- tie in the hp6xx code

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# ab6e570b 11-Dec-2008 Paul Mundt <lethal@linux-sh.org>

sh: Generic kgdb stub support.

This migrates from the old bitrotted kgdb stub implementation and moves
to the generic stub. In the process support for SH-2/SH-2A is also added,
which the old stub never provided.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# bd40e813 09-Dec-2008 Aoi Shinkai <shinkoi2005@gmail.com>

sh: Delete unnecessary mov in the interrupt exception entry point.

The INTEVT read at interrupt exception entry is uneccessary, as the read
is deferred until we are ready to enter do_IRQ(). The kgdb nmi path still
requires it, so move it there.

Signed-off-by: Aoi Shinkai <shinkoi2005@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# f15cbe6f 28-Jul-2008 Paul Mundt <lethal@linux-sh.org>

sh: migrate to arch/sh/include/

This follows the sparc changes a439fe51a1f8eb087c22dd24d69cebae4a3addac.

Most of the moving about was done with Sam's directions at:

http://marc.info/?l=linux-sh&m=121724823706062&w=2

with subsequent hacking and fixups entirely my fault.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 1efe4ce3 30-Nov-2007 Stuart Menefy <stuart.menefy@st.com>

sh: GUSA atomic rollback support.

This implements kernel-level atomic rollback built on top of gUSA,
as an alternative non-IRQ based atomicity method. This is generally
a faster method for platforms that are lacking the LL/SC pairs that
SH-4A and later use, and is only supportable on legacy cores.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# c347d12c 01-Aug-2007 Paul Mundt <lethal@linux-sh.org>

sh: Fix lockdep debugging oops on SH-3/4.

In the SH-3/4 TLB access violation path we were enabling IRQs before
the call in to trace_hardirqs_on(), which ended up triggering:

if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
return;

in kernel/lockdep.c:2031. Fix this up by removing the early re-enable,
we were already re-enabling IRQs post-trace_hardirqs_on() already, so
the semantics are now as was initially intended.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 2b1bd1ac 20-Jun-2007 Paul Mundt <lethal@linux-sh.org>

sh: Preliminary support for the SH-X3 CPU.

This adds basic support for UP SH-X3.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# c596b1a3 03-Jun-2007 Paul Mundt <lethal@linux-sh.org>

sh: Fix in_nmi symbol build error.

If CONFIG_KGDB_NMI is disabled, we're left with a stray in_nmi
reference that can't be resolved. Move the symbol under the ifdef,
too.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 370ac91a 30-May-2007 Takashi YOSHII <takasi-y@ops.dti.ne.jp>

sh: Fix pcrel too far for in_nmi label.

Add lost in_nmi definition to solve pcrel too far.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 58862699 08-May-2007 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>

fix file specification in comments

Many files include the filename at the beginning, serveral used a wrong one.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>


# 3afb209a 13-Mar-2007 Paul Mundt <lethal@linux-sh.org>

sh: Fix bogus regs pointer in do_IRQ().

SH-3 and SH-4 were trampling the register, and SH-2 wasn't even
setting it in the first place. This ended up with some rather
broken behaviour in the sysrq show_regs().

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# db2e1fa3 13-Feb-2007 Paul Mundt <lethal@linux-sh.org>

sh: Revert TLB miss fast-path changes that broke PTEA parts.

This ended up causing problems for older parts (particularly ones
using PTEA). Revert this for now, it can be added back in once it's
had some more testing.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 7a847f81 25-Dec-2006 Paul Mundt <lethal@linux-sh.org>

sh: More tidying for large base pages.

There were a few more things that needed fixing up, namely THREAD_SIZE
and the TLB miss handler where certain PTRS_PER_PGD == PTRS_PER_PTE
assumptions were being made.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# f413d0d9 13-Dec-2006 Paul Mundt <lethal@linux-sh.org>

sh: Use a jump call table for debug trap handlers.

This rips out most of the needlessly complicated sh_bios and kgdb
trap handling, and forces it all through a common fast dispatch path.
As more debug traps are inserted, it's important to keep them in sync
for all of the parts, not just SH-3/4.

As the SH-2 parts are unable to do traps in the >= 0x40 range, we
restrict the debug traps to the 0x30-0x3f range on all parts, and
also bump the kgdb breakpoint trap down in to this range (from 0xff
to 0x3c) so it's possible to use for nommu.

Optionally, this table can be padded out to catch spurious traps for
SH-3/4, but we don't do that yet..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# afbfb52e 04-Dec-2006 Paul Mundt <lethal@linux-sh.org>

sh: stacktrace/lockdep/irqflags tracing support.

Wire up all of the essentials for lockdep..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 510c72ad 26-Nov-2006 Paul Mundt <lethal@linux-sh.org>

sh: Fixup various PAGE_SIZE == 4096 assumptions.

There were a number of places that made evil PAGE_SIZE == 4k
assumptions that ended up breaking when trying to play with
8k and 64k page sizes, this fixes those up.

The most significant change is the way we load THREAD_SIZE,
previously this was done via:

mov #(THREAD_SIZE >> 8), reg
shll8 reg

to avoid a memory access and allow the immediate load. With
a 64k PAGE_SIZE, we're out of range for the immediate load
size without resorting to special instructions available in
later ISAs (movi20s and so on). The "workaround" for this is
to bump up the shift to 10 and insert a shll2, which gives a
bit more flexibility while still being much cheaper than a
memory access.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 9b3a53ab 23-Nov-2006 Stuart Menefy <stuart.menefy@st.com>

sh: TLB miss fast-path optimizations.

Handle simple TLB miss faults which can be resolved completely
from the page table in assembler.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 716067f2 07-Nov-2006 Paul Mundt <lethal@linux-sh.org>

sh: Fixup entry-common path breakage for SH-3.

The nommu patches broke the path for the common bits, get it building
for the SH-3/4 case again.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# de398406 05-Nov-2006 Yoshinori Sato <ysato@users.sourceforge.jp>

sh: Exception vector rework and SH-2/SH-2A support.

This splits out common bits from the existing exception handler for
use between SH-2/SH-2A and SH-3/4, and adds support for the SH-2/2A
exceptions.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>