Commit graph

1477 commits

Author SHA1 Message Date
Magnus Damm fae4339919 sh: Break out SuperH PFC code
This file breaks out the SuperH PFC code from
arch/sh/kernel/gpio.c + arch/sh/include/asm/gpio.h
to drivers/sh/pfc.c + include/linux/sh_pfc.h.

Similar to the INTC stuff. The non-SuperH specific
file location makes it possible to share the code
between multiple architectures.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-30 12:02:53 +09:00
Alexey Dobriyan 9a1607071c sh: convert /proc/cpu/aligmnent, /proc/cpu/kernel_alignment to seq_file
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-30 12:02:50 +09:00
Magnus Damm 2ebe0ff7e6 sh: Add CPG save/restore code for sh7724 R-standby
Add sh7724 code to save and restore CPG state during
R-standby. Only CPG registers IRDACLKCR and SPUCLKCR
require software save and restore.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-30 12:02:49 +09:00
Paul Mundt 6ba653830c sh: Fix up the FPU emulation build.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-25 12:07:31 +09:00
Paul Mundt 0f09e197a3 sh: Apply the sleazy FPU changes for SH-2A FPU as well.
This plugs in the fpu_counter manipulation for the SH-2A side also.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-24 17:56:17 +09:00
Stuart Menefy d3ea9fa0a5 sh: Minor optimisations to FPU handling
A number of small optimisations to FPU handling, in particular:

 - move the task USEDFPU flag from the thread_info flags field (which
   is accessed asynchronously to the thread) to a new status field,
   which is only accessed by the thread itself. This allows locking to
   be removed in most cases, or can be reduced to a preempt_lock().
   This mimics the i386 behaviour.

 - move the modification of regs->sr and thread_info->status flags out
   of save_fpu() to __unlazy_fpu(). This gives the compiler a better
   chance to optimise things, as well as making save_fpu() symmetrical
   with restore_fpu() and init_fpu().

 - implement prepare_to_copy(), so that when creating a thread, we can
   unlazy the FPU prior to copying the thread data structures.

Also make sure that the FPU is disabled while in the kernel, in
particular while booting, and for newly created kernel threads,

In a very artificial benchmark, the execution time for 2500000
context switches was reduced from 50 to 45 seconds.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-24 17:45:38 +09:00
Paul Mundt 49fb2cd257 Merge branch 'master' into sh/st-integration 2009-11-24 16:32:11 +09:00
Giuseppe CAVALLARO a0458b07c1 sh: add sleazy FPU optimization
sh port of the sLeAZY-fpu feature currently implemented for some architectures
such us i386.

Right now the SH kernel has a 100% lazy fpu behaviour.
This is of course great for applications that have very sporadic or no FPU use.
However for very frequent FPU users...  you take an extra trap every context
switch.
The patch below adds a simple heuristic to this code: after 5 consecutive
context switches of FPU use, the lazy behavior is disabled and the context
gets restored every context switch.
After 256 switches, this is reset and the 100% lazy behavior is returned.

Tests with LMbench showed no regression.
I saw a little improvement due to the prefetching (~2%).

The tests below also show that, with this sLeazy patch, indeed,
the number of FPU exceptions is reduced.
To test this. I hacked the lat_ctx LMBench to use the FPU a little more.

   sLeasy implementation
   ===========================================
   switch_to calls            |  79326
   sleasy   calls             |  42577
   do_fpu_state_restore  calls|  59232
   restore_fpu   calls        |  59032

   Exceptions:  0x800 (FPU disabled  ): 16604

   100% Leazy (default implementation)
   ===========================================
   switch_to  calls            |  79690
   do_fpu_state_restore calls  |  53299
   restore_fpu  calls          |   53101

   Exceptions: 0x800 (FPU disabled  ):  53273

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-24 16:23:38 +09:00
David S. Miller 3505d1a9fd Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
	drivers/net/sfc/sfe4001.c
	drivers/net/wireless/libertas/cmd.c
	drivers/staging/Kconfig
	drivers/staging/Makefile
	drivers/staging/rtl8187se/Kconfig
	drivers/staging/rtl8192e/Kconfig
2009-11-18 22:19:03 -08:00
Eric W. Biederman 6d4561110a sysctl: Drop & in front of every proc_handler.
For consistency drop & in front of every proc_handler.  Explicity
taking the address is unnecessary and it prevents optimizations
like stubbing the proc_handlers to NULL.

Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2009-11-18 08:37:40 -08:00
Paul Mundt 260af56271 Merge branch 'sh/stable-updates' 2009-11-18 10:53:52 +09:00
Thomas Gleixner 648f15345a sh: Fixup last users of irq_chip->typename
The typename member of struct irq_chip was kept for migration purposes
and is obsolete since more than 2 years. Fix up the leftovers.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-18 10:50:22 +09:00
Eric W. Biederman bb9074ff58 Merge commit 'v2.6.32-rc7'
Resolve the conflict between v2.6.32-rc7 where dn_def_dev_handler
gets a small bug fix and the sysctl tree where I am removing all
sysctl strategy routines.
2009-11-17 01:01:34 -08:00
Eric W. Biederman a09b6e8118 sysctl sh: Remove dead binary sysctl support
Now that sys_sysctl is a generic wrapper around /proc/sys  .ctl_name
and .strategy members of sysctl tables are dead code.  Remove them.

Also add an C99 named initializer to the child member of unaligned_root
to prevent chaos as the ctl_table definition changes over time.

Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2009-11-12 02:05:03 -08:00
Paul Mundt 626ac8e138 sh64: Fix up the CONFIG_GENERIC_BUG=n build.
sh64 doesn't use GENERIC_BUG, which presently causes the handle_BUG()
code to blow up. Fix up the dependencies and get it all building again.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-12 16:39:47 +09:00
Paul Mundt e9c58fc57b sh: Use the generic I/O port base for slowdown.
This fixes up the build and behaviour for various configurations. Namely
the CONFIG_32BIT cases where legacy mappings do not exist, as well as the
sh64 build.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-12 16:36:26 +09:00
Paul Mundt c4e708dc52 sh: Fix up the CONFIG_PERF_EVENTS=n build for SH-4.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-12 16:20:36 +09:00
Paul Mundt 0fe69d773f sh: perf events: Document SH-4A raw event codes.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-09 14:11:07 +09:00
Paul Mundt 76d2318020 Merge branch 'sh/stable-updates' 2009-11-09 10:55:36 +09:00
Paul Mundt 421b541110 sh: unwinder: Fix up invalid PC refetch in dwarf unwinder.
The dwarf unwinder presently attempts to provide a sane PC value if none
is provided, however the logic is broken and cases where a previous valid
dwarf frame exists along with a bogus PC value can still proceed. This
fixes up the test and prevents the unwinder from blowing up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-06 17:23:33 +09:00
Paul Mundt 1d823323f2 sh: perf events: Add support for SH7750-style counters.
This adds perf events support for the SH7750/SH7750S/SH7091 performance
counters.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-05 17:02:03 +09:00
Paul Mundt 830fafecc2 sh: perf events: Preliminary callchain support.
This implements preliminary support for perf callchains (at the moment
only the kernel side is implemented). The actual implementation itself is
just a simple wrapper around the unwinder API, which allows for callchain
generation with or without the dwarf unwinder.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-05 16:20:09 +09:00
Paul Mundt d1b261ef85 sh: Default-enable SPU clock for SH7724.
Wanted by the SPU2 UIO driver, which really ought to be handling this
itself. Default enable it for now, until the driver gets a bit more
intelligent.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-05 14:06:36 +09:00
Kuninori Morimoto 2de339231b sh: sh7724: Add SPU2 support
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-05 13:58:46 +09:00
Paul Mundt 8820002c18 sh: perf events: Fix up uninitialized variable warning.
'config' can be unintialized, and although it's not really an error, it
still manages to trigger the -Werror with certain toolchains. Initialize
it early to shut up gcc.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-05 13:56:50 +09:00
Magnus Damm c4b973f532 sh: Add RWDT save/restore code for sh7724 R-standby
Add sh7724 code to save and restore RWDT state during
R-standby. Without this patch the watchdog will generate
a reset shortly after resuming from R-standby.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-04 11:48:05 +09:00
Paul Mundt 45b9deaf14 sh: intc: Handle legacy IRQ reservation in vector map.
Different CPUs will have different starting vectors, with varying
amounts of reserved or unusable vector space prior to the first slot.
This introduces a legacy vector reservation system that inserts itself in
between the CPU vector map registration and the platform specific IRQ
setup. This works fine in practice as the only new vectors that boards
need to establish on their own should be dynamically allocated rather
than arbitrarily assigned. As a plus, this also makes all of the
converted platforms sparseirq ready.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-11-02 15:43:20 +09:00
Magnus Damm bb3e0eed9d sh: Add R-standby sleep mode support
Add R-standby specific bits to the SuperH Mobile sleep code.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-30 14:38:45 +09:00
Magnus Damm 03625e7107 sh: Use RSMEM for sleep code on sh7724
Use RSMEM instead of ILMEM for sleep mode code storage on SH7724.
This allows us to use R-standby mode on SH7724.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-30 14:38:33 +09:00
Magnus Damm 99675a7a45 sh: Add MMU and Cache handling sleep mode code
Add MMU and cache handling functionality to the SuperH Mobile
sleep code. The MMU and cache registers are saved and restored.
The MMU is disabled and the cache is flushed and disabled before
entering sleep modes if the SUSP_SH_MMU flag is set. This flag
should be set in the case of R-standby and most likely for future
U-standby support as well.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-30 14:37:56 +09:00
Magnus Damm 02bf89347c sh: Keep track of allowed sleep modes
Add code to keep track of supported sleep modes. This to
only export cpuidle modes that are backed by board support
code. Also, do not allow suspend-to-ram if sdram board code
is missing.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-30 14:37:42 +09:00
Magnus Damm 323ef8dba6 sh: Rework SuperH Mobile sleep mode code
Rework the SuperH Mobile sleep code from including
board specific code to allowing each board to provide
pre/post code snippets. These snippets should contain
sdram management code to enter and leave self-refresh.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-30 14:36:52 +09:00
Magnus Damm 159f8cd99e sh: Allow boards to register memory pre/post sleep code
Add code to allow boards registering self-contained
functions for going to/from self-refresh. At this
point the board code is unused. When all supported
boards have been converted then the new sleep code
will make use of these functions.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-30 11:55:24 +09:00
Magnus Damm da14909eb0 sh: Add sh7724 notifier for R-standby save/restore
Make use of the recently added notifier chains for sh7724
r-standby register save/restore handling. At this point
only the BSC and INTC are handled.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-30 11:55:14 +09:00
Magnus Damm 49f42644fd sh: Add notifiers chains for cpu/board code
This patch adds atomic notifier chains for pre/post
sleep events. Useful for cpu code and boards that
need to save and restore register state before and
after entering a sleep mode.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-30 11:54:59 +09:00
Paul Mundt 1d317f90d9 sh: perf events: Kill off left over debugging cruft.
num_events should be compared > MAX_HWEVENTS and not >=. The latter was
used as a debugging test which accidentally slipped in.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-28 18:02:15 +09:00
Paul Mundt ac44e66947 sh: perf events: Add preliminary support for SH-4A counters.
This adds in preliminary support for the SH-4A performance counters.
Presently only the first 2 counters are supported, as these are the ones
of the most interest to the perf tool and end users. Counter chaining is
not presently handled, so these are simply implemented as 32-bit
counters.

This also establishes a perf event support framework for other hardware
counters, which the existing SH-4 oprofile code will migrate over to as
the SH-4A support evolves.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-28 17:57:54 +09:00
Paul Mundt 4c978ca319 sh: Clean up more superfluous symbol exports.
Many of these symbols went away completely, or we just never cared about
them in the first place. Trim the exports down to the essential set.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-27 11:51:19 +09:00
Paul Mundt 0a993b0a29 sh64: cache flush symbol exports.
These were previously hidden in sh_ksyms_32, despite also being needed
for sh64 now that the cache.c code is shared.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-27 10:51:35 +09:00
Paul Mundt 01be5d63fd sh: Revamp PCI DMA coherence Kconfig bits.
Leaving this configurable caused more trouble than it was ever worth, so
just make it explicit. Boards that are verified one way or the other can
fix up their selects accordingly. We presently default to non-coherent
for most platforms.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-27 10:35:02 +09:00
Matt Fleming 3f375f12ec sh: Annotate irq functions with "notrace"
Now that SH's irqflags functions are out of line it becomes necessary to
mark them as "notrace" so that we don't try to trace them.

[ Do the same for irq_64.c -- PFM. ]

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-27 07:37:10 +09:00
Magnus Damm ef01b9a06d sh: fix kexec by removing check for old kexec-tools
This unbreaks kexec support. Without this fix all
cases of kexec fails since __pa() does not behave
like PHYSADDR(). The downside is that we also kill
the code blocking users running old kexec-tools.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-26 19:45:45 +09:00
Paul Mundt 6253195b67 Merge branch 'sh/stable-updates'
Conflicts:
	arch/sh/kernel/dwarf.c
2009-10-26 10:48:18 +09:00
Matt Fleming 60339fad5c sh: Check for return_to_handler when unwinding the stack
When CONFIG_FUNCTION_GRAPH_TRACER is enabled the function graph tracer
may patch return addresses on the stack with the address of
return_to_handler(). This really confuses the DWARF unwinder because it
will try find the caller of return_to_handler(), not the caller of the
real return address.

So teach the DWARF unwinder how to find the real return address whenever
it encounters return_to_handler().

This patch does not cope very well when multiple return addresses on the
stack have been patched. To make it work properly it would require state
to track how many return_to_handler()'s have been seen so that we'd know
where to look in current->curr_ret_stack[]. So for now, instead of
trying to handle this, just moan if more than one return address on the
stack has been patched.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-26 10:04:56 +09:00
Lubomir Rintel 26fadd3672 sh: Build fix: define more __movmem* symbols
ERROR: "__movmemSI12" [net/unix/unix.ko] undefined!
ERROR: "__movmemSI52" [net/ipv6/sit.ko] undefined!
ERROR: "__movmemSI24" [net/ipv6/ipv6.ko] undefined!
ERROR: "__movmemSI60" [net/ipv6/ipv6.ko] undefined!
ERROR: "__movmemSI16" [net/ipv6/ipv6.ko] undefined!
ERROR: "__movmemSI20" [net/ipv6/ipv6.ko] undefined!
ERROR: "__movmemSI32" [net/ipv6/ipv6.ko] undefined!

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-26 10:00:26 +09:00
Paul Mundt ba93483f8c sh: __irq_entry annotate do_IRQ().
This adds an __irq_entry annotation for do_IRQ() so that the IRQ
annotation in the function graph tracer works as advertized. We already
have the IRQENTRY section wired up, so this is just a trivial addition
to actually make use of it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-26 09:58:31 +09:00
Paul Mundt f32154c9b5 sh: Add dma-mapping support for dma_alloc/free_coherent() overrides.
This moves the current dma_alloc/free_coherent() calls to a generic
variant and plugs them in for the nommu default. Other variants can
override the defaults in the dma mapping ops directly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-26 09:50:51 +09:00
Paul Mundt 73c926bee0 sh: Convert to asm-generic/dma-mapping-common.h
This converts the old DMA mapping support to the new generic
dma-mapping-common.h abstraction.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-20 12:55:56 +09:00
Paul Mundt 14c011deb4 sh: Fix up cacheflush routine symbol exports.
Fixes up flush_dcache_page() references by modules with run-time cache
disabling.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-19 15:52:20 +09:00
Paul Mundt eca28e3764 sh: Fix up uninitialized variable warning in dwarf unwinder.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-19 15:51:21 +09:00
Paul Mundt 15dfdddbf0 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>
2009-10-18 15:13:28 +09:00
Paul Mundt 03fdb70892 sh: Convert to asm-generic/irqflags.h.
This simplifies the irqflags support by switching over to the asm-generic
version. The necessary support functions are brought out-of-line for both
SHcompact and SHmedia instruction sets.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-17 21:06:39 +09:00
Paul Mundt cae19b5902 sh: Kill off legacy UBC wakeup cruft.
This code was added for some ancient SH-4 solution engines with peculiar
boot ROMs that did silly things to the UBC MSTP bits. None of these have
been in the wild for years, and these days the clock framework wraps up
the MSTP bits, meaning that the UBC code is one of the few interfaces
that is stomping MSTP bits underneath the clock framework. At this point
the risks far outweigh any benefit this code provided, so just kill it
off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-16 18:20:42 +09:00
Paul Mundt 896f0c0e8e sh: Support SCHED_MC for SH-X3 multi-cores.
This enables SCHED_MC support for SH-X3 multi-cores. Presently this is
just a simple wrapper around the possible map, but this allows for
tying in support for some of the more exotic NUMA clusters where we can
actually do something with the topology.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-16 18:00:02 +09:00
Paul Mundt 9dbe00a56a sh: Fix up IRQ re-enabling for the need_resched() case.
In the case where need_resched() is set in between the cpu_idle() and
pm_idle() calls we were missing an else case for just re-enabling local
IRQs and bailing out. This was noticed by the irqs_disabled() warning,
even though IRQs were being re-enabled elsewhere.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-16 17:55:59 +09:00
Paul Mundt 0e6d4986e7 sh: Make check_pgt_cache() more aggressive while idling.
This follows the x86 change and moves check_pgt_cache() up under the
!need_resched() tight loop, rather than simply calling in to it when
exiting idle.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-16 17:27:58 +09:00
Paul Mundt f533c3d340 sh: Idle loop chainsawing for SMP-based light sleep.
This does a bit of chainsawing of the idle loop code to get light sleep
working on SMP. Previously this was forcing secondary CPUs in to sleep
mode with them not coming back if they didn't have their own local
timers. Given that we use clockevents broadcasting by default, the CPU
managing the clockevents can't have IRQs disabled before entering its
sleep state.

This unfortunately leaves us with the age-old need_resched() race in
between local_irq_enable() and cpu_sleep(), but at present this is
unavoidable. After some more experimentation it may be possible to layer
on SR.BL bit manipulation over top of this scheme to inhibit the race
condition, but given the current potential for missing wakeups, this is
left as a future exercise.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-16 17:20:58 +09:00
Paul Mundt 94eab0bb20 sh: Force boot CPU in to light sleep mode for SH-X3 SMP.
All of the secondary CPUs are forced in to light sleep mode, but we were
missing the same initialization for the boot CPU. This resulted in
inconsistent sleep modes depending on which CPU we were on, confusing the
idle loop when not polling.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-16 17:19:08 +09:00
Paul Mundt 731ba3301d sh: Count NMIs in irq_cpustat_t.
This plugs in support for NMI counting per-CPU via irq_cpustat_t.
Modelled after the x86 implementation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 16:42:28 +09:00
Paul Mundt 56bfc42f6c sh: TS_RESTORE_SIGMASK conversion.
Replace TIF_RESTORE_SIGMASK with TS_RESTORE_SIGMASK and define our own
set_restore_sigmask() function.  This saves the costly SMP-safe set_bit
operation, which we do not need for the sigmask flag since TIF_SIGPENDING
always has to be set too.

Based on the x86 and powerpc change.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 16:05:42 +09:00
Paul Mundt b195e46677 Merge branch 'sh/stable-updates' 2009-10-14 15:53:08 +09:00
Paul Mundt 457b646189 sh: Fix a TRACE_IRQS_OFF typo.
The resume_userspace path had TRACE_IRQS_OFF written incorrectly and so
never handled the transition properly. This was fixed once before but
seems to have made it back in the tree. Fix it for good.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 15:50:28 +09:00
Paul Mundt 4d2947f7c6 sh: Optimize the setup_rt_frame() I-cache flush.
This only needs to flush the return code via the legacy path, and just
invalidates uselessly otherwise. This makes the behaviour consistent for
all of the trampoline setup paths.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 15:49:45 +09:00
Paul Mundt a66c2edea5 sh: Populate initial secondary CPU info from boot_cpu_data.
The secondary CPU info was seeing corrupted results due to not entering
all of the setup paths taken by the boot CPU. So we just memcpy() the
boot cpu data over directly, and then fix up the per-CPU bits.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 15:44:12 +09:00
Paul Mundt 2908df9e2c sh: Tidy up SMP cpuinfo.
Trivial change for cleaning up the cpuinfo pretty printing on SMP, adds a
newline between CPUs.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 15:43:52 +09:00
Paul Mundt eaa47704d9 sh: Use boot_cpu_data for FPU tests in sigcontext paths.
We do not want to use smp_processor_id() from these paths, as they trip
preempt BUGs. Switch the test over to the boot cpu directly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 15:43:41 +09:00
Paul Mundt d780613acc sh: Only invalidate the I-cache range for secondary CPUs stack_start.
Secondary CPUs already take care of the D-cache bits through the common
cache initialization path, and the only thing that is necessary after
twiddling around with stack_start is ensuring that the I-cache changes
are visible (particularly since this tends to be the only part lacking
coherency).

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14 11:51:28 +09:00
Paul Mundt e4b053d96a sh: ftrace: Make code modification NMI safe.
This cribs the x86 implementation of ftrace_nmi_enter() and friends to
make ftrace_modify_code() NMI safe, particularly on SMP configurations.

For additional notes on the problems involved, see the comment below
ftrace_call_replace().

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-13 16:52:50 +09:00
Paul Mundt c8afde7f40 sh: Don't profile return_address().
This adds return_address.c to the -pg exclusion list, as this is the
building block for CALLER_ADDRx we do not want to profile this.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-13 16:31:08 +09:00
Arnaldo Carvalho de Melo a2e2725541 net: Introduce recvmmsg socket syscall
Meaning receive multiple messages, reducing the number of syscalls and
net stack entry/exit operations.

Next patches will introduce mechanisms where protocols that want to
optimize this operation will provide an unlocked_recvmsg operation.

This takes into account comments made by:

. Paul Moore: sock_recvmsg is called only for the first datagram,
  sock_recvmsg_nosec is used for the rest.

. Caitlin Bestler: recvmmsg now has a struct timespec timeout, that
  works in the same fashion as the ppoll one.

  If the underlying protocol returns a datagram with MSG_OOB set, this
  will make recvmmsg return right away with as many datagrams (+ the OOB
  one) it has received so far.

. Rémi Denis-Courmont & Steven Whitehouse: If we receive N < vlen
  datagrams and then recvmsg returns an error, recvmmsg will return
  the successfully received datagrams, store the error and return it
  in the next call.

This paves the way for a subsequent optimization, sk_prot->unlocked_recvmsg,
where we will be able to acquire the lock only at batch start and end, not at
every underlying recvmsg call.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-12 23:40:10 -07:00
Paul Mundt 5a3abba77d sh: Tidy up the dwarf module helpers.
This enables us to build the dwarf unwinder both with modules enabled and
disabled in addition to reducing code size in the latter case. The
helpers are also consolidated, and modified to resemble the BUG module
helpers.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-13 13:32:19 +09:00
Paul Mundt ac4fac8cb2 sh: Generalize CALLER_ADDRx support.
This splits out the unwinder implementation and adds a new
return_address() abstraction modelled after the ARM code. The DWARF
unwinder is tied in to this, returning NULL otherwise in the case of
being unable to support arbitrary depths.

This enables us to get correct behaviour with the unwinder enabled,
as well as disabling the arbitrary depth support when frame pointers are
enabled, as arbitrary depths with __builtin_return_address() are not
supported regardless.

With this abstraction it's also possible to layer on a simplified
implementation with frame pointers in the event that the unwinder isn't
enabled, although this is left as a future exercise.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-13 13:10:14 +09:00
Paul Mundt 5852b203ef Merge branch 'sh/stable-updates' 2009-10-13 12:45:08 +09:00
Paul Mundt 9922262242 sh: ftrace: Fix up syscall tracepoint support.
Sync up with latest core changes in the syscalls tracing area:

- tracing: Map syscall name to number (syscall_name_to_nr())
- tracing: Call arch_init_ftrace_syscalls at boot
- tracing: add support tracepoint ids (set_syscall_{enter,exit}_id())

Taken from the s390 change.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-13 12:42:48 +09:00
Paul Mundt 95019b48ad Merge branch 'sh/stable-updates' 2009-10-13 11:27:08 +09:00
Paul Mundt af67c3a9e6 sh: update die() output.
This follows the ARM change, as SH had all of the same issues:

Make die() better match x86:
- add printing of the last accessed sysfs file
- ensure console_verbose() is called under the lock
- ensure we panic outside of oops_exit()

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-13 10:57:52 +09:00
Paul Mundt 8ec006c587 Merge branch 'sh/dwarf-unwinder'
Conflicts:
	arch/sh/kernel/dwarf.c
2009-10-12 08:50:07 +09:00
Paul Mundt 5ab78ff693 Merge branch 'sh/dwarf-unwinder' of git://github.com/mfleming/linux-2.6 into sh/dwarf-unwinder 2009-10-12 08:42:46 +09:00
Matt Fleming c2d474d6f8 sh: Remove any reference to recursive functions from comments
Originally, dwarf_unwind_stack() was a recursive function and it seems
that some of the old comments were never updated.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-10-11 17:12:32 +01:00
Matt Fleming ed4fe7f488 sh: Fix memory leak in dwarf_unwind_stack()
If we broke out of the while (1) loop because the return address of
"frame" was zero, then "frame" needs to be free'd before we return.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-10-11 17:12:28 +01:00
Matt Fleming a6a2f2ad67 sh: Teach the DWARF unwinder about modules
Pass a module's .eh_frame section to the DWARF unwinder at module load
time so that the section's FDEs and CIEs can be registered with the
DWARF unwinder. This allows us to unwind the stack through module code
when generating backtraces.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-10-11 16:41:44 +01:00
Paul Mundt 3d4e0cfb33 sh: Reinstate ILSEL -> IRL intc mappings for SH-X3 proto CPU.
In the multi-evt conversion for the SH-X3 proto CPU, IRLs were dropped
down to a single unique masking source, which ended up blowing up on
ILSEL-based IRQs which have special semantics that otherwise confuse the
intc code. While this does result in intc spewing about not having a
unique masking source, we don't really care.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-10 22:45:41 +09:00
Matt Fleming 20b5014b3e sh: Fold fixed-PMB support into dynamic PMB support
The initialisation process differs for CONFIG_PMB and for
CONFIG_PMB_FIXED. For CONFIG_PMB_FIXED we need to register the PMB
entries that were allocated by the bootloader.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-10 21:52:34 +09:00
Matt Fleming 8386aebb9e sh: Make most PMB functions static
There's no need to export the internal PMB functions for allocating,
freeing and modifying PMB entries, etc. This way we can restrict the
interface for PMB.

Also remove the static from pmb_init() so that we have more freedom in
setting up the initial PMB entries and turning on MMU 32bit mode.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-10 21:51:37 +09:00
Matt Fleming b336f124b1 sh: CONFIG_PMB doesn't mean the MMU is in 32bit mode
CONFIG_PMB will eventually allow the MMU to be switched between 29-bit
and 32-bit mode dynamically at runtime.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-10 21:51:23 +09:00
Matt Fleming 8bd642b17b sh: Obliterate the P1 area macros
Replace the use of PHYSADDR() with __pa(). PHYSADDR() is based on the
idea that all addresses in P1SEG are untranslated, so we can access an
address's physical page as an offset from P1SEG. This doesn't work for
CONFIG_PMB/CONFIG_PMB_FIXED because pages in P1SEG and P2SEG are used
for PMB mappings and so can be translated to any physical address.

Likewise, replace a P1SEGADDR() use with virt_to_phys().

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-10 21:51:02 +09:00
Lubomir Rintel f16bf3e2e4 sh: Build fix: export __movmem
ERROR: "__movmem" [net/irda/irda.ko] undefined!
ERROR: "__movmem" [fs/nfsd/nfsd.ko] undefined!
ERROR: "__movmem" [fs/lockd/lockd.ko] undefined!
ERROR: "__movmem" [crypto/sha1_generic.ko] undefined!

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-30 15:41:42 +09:00
Paul Mundt 8406638ab0 sh: Disable unaligned kernel access printks by default.
Certain networking and USB workloads generate floods of these accesses,
so just disable it by default (thereby restoring the old behaviour). The
option remains configurable from userspace, and can still be used as a
debugging aid.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-30 14:02:42 +09:00
Matt Fleming 421f7a5dbd 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>
2009-09-28 15:11:45 +09:00
Paul Mundt d44ee12ad6 sh: Set the default I/O port base to P2SEG.
This bumps up the default I/O base to P2SEG, which allows legacy probing
to bail out gracefully rather than oopsing. Platforms that have a real
PIO offset still need to fix this up on their own, although most
platforms are content with P2SEG already.

The previous change to teach ioport_map() about >= P1SEG offsets in
combination with this patch allows both the already remapped and the
legacy address probing to pass through and succeed.

Fixes up an oops with i8042 on the sh7785lcr board.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-28 15:05:41 +09:00
Paul Mundt 48ff3e04ff sh: Handle ioport_map() cases for >= P1SEG addresses.
This fixes up the case where certain drivers already do their own
remapping and subsequently attempt to use the PIO calls for I/O. In this
case there is no additional remapping that needs to be done, and the
address can be casted in to the cookie directly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-28 15:04:04 +09:00
Nobuhiro Iwamatsu ecb6fd5299 sh: Add support DMA Engine to SH7780
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-25 12:19:33 +09:00
Nobuhiro Iwamatsu 8255fff45b sh: Add support DMA Engine to SH7722
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-25 12:17:27 +09:00
Paul Mundt 40258ee97d sh: Fix up uninitialized variable use caught by gcc 4.4.
In the unaligned kernel exception fixup case the printk() was ordered
before the copy_from_user(), resulting in a nonsensical instruction
value. This fixes up the ordering properly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-24 17:48:15 +09:00
Paul Mundt 23c4c82171 sh: Handle unaligned 16-bit instructions on SH-2A.
This adds some sanity checking in the unaligned instruction handler to
verify the instruction size, which enables basic support for 16-bit
fixups on SH-2A parts.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-24 17:38:18 +09:00
Jaswinder Singh Rajput a6bbce200d sh: includecheck fix: dwarf.c
fix the following 'make includecheck' warning:

  arch/sh/kernel/dwarf.c: asm/dwarf.h is included more than once.

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-24 16:21:50 +09:00
Alexey Dobriyan 2bcd57ab61 headers: utsname.h redux
* remove asm/atomic.h inclusion from linux/utsname.h --
   not needed after kref conversion
 * remove linux/utsname.h inclusion from files which do not need it

NOTE: it looks like fs/binfmt_elf.c do not need utsname.h, however
due to some personality stuff it _is_ needed -- cowardly leave ELF-related
headers and files alone.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-23 18:13:10 -07:00
Linus Torvalds c37efa9325 Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (30 commits)
  Use macros for .data.page_aligned section.
  Use macros for .bss.page_aligned section.
  Use new __init_task_data macro in arch init_task.c files.
  kbuild: Don't define ALIGN and ENTRY when preprocessing linker scripts.
  arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash 4.0
  kbuild: add static to prototypes
  kbuild: fail build if recordmcount.pl fails
  kbuild: set -fconserve-stack option for gcc 4.5
  kbuild: echo the record_mcount command
  gconfig: disable "typeahead find" search in treeviews
  kbuild: fix cc1 options check to ensure we do not use -fPIC when compiling
  checkincludes.pl: add option to remove duplicates in place
  markup_oops: use modinfo to avoid confusion with underscored module names
  checkincludes.pl: provide usage helper
  checkincludes.pl: close file as soon as we're done with it
  ctags: usability fix
  kernel hacking: move STRIP_ASM_SYMS from General
  gitignore usr/initramfs_data.cpio.bz2 and usr/initramfs_data.cpio.lzma
  kbuild: Check if linker supports the -X option
  kbuild: introduce ld-option
  ...

Fix trivial conflict in scripts/basic/fixdep.c
2009-09-23 15:37:02 -07:00
Ingo Molnar cdd6c482c9 perf: Do the big rename: Performance Counters -> Performance Events
Bye-bye Performance Counters, welcome Performance Events!

In the past few months the perfcounters subsystem has grown out its
initial role of counting hardware events, and has become (and is
becoming) a much broader generic event enumeration, reporting, logging,
monitoring, analysis facility.

Naming its core object 'perf_counter' and naming the subsystem
'perfcounters' has become more and more of a misnomer. With pending
code like hw-breakpoints support the 'counter' name is less and
less appropriate.

All in one, we've decided to rename the subsystem to 'performance
events' and to propagate this rename through all fields, variables
and API names. (in an ABI compatible fashion)

The word 'event' is also a bit shorter than 'counter' - which makes
it slightly more convenient to write/handle as well.

Thanks goes to Stephane Eranian who first observed this misnomer and
suggested a rename.

User-space tooling and ABI compatibility is not affected - this patch
should be function-invariant. (Also, defconfigs were not touched to
keep the size down.)

This patch has been generated via the following script:

  FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')

  sed -i \
    -e 's/PERF_EVENT_/PERF_RECORD_/g' \
    -e 's/PERF_COUNTER/PERF_EVENT/g' \
    -e 's/perf_counter/perf_event/g' \
    -e 's/nb_counters/nb_events/g' \
    -e 's/swcounter/swevent/g' \
    -e 's/tpcounter_event/tp_event/g' \
    $FILES

  for N in $(find . -name perf_counter.[ch]); do
    M=$(echo $N | sed 's/perf_counter/perf_event/g')
    mv $N $M
  done

  FILES=$(find . -name perf_event.*)

  sed -i \
    -e 's/COUNTER_MASK/REG_MASK/g' \
    -e 's/COUNTER/EVENT/g' \
    -e 's/\<event\>/event_id/g' \
    -e 's/counter/event/g' \
    -e 's/Counter/Event/g' \
    $FILES

... to keep it as correct as possible. This script can also be
used by anyone who has pending perfcounters patches - it converts
a Linux kernel tree over to the new naming. We tried to time this
change to the point in time where the amount of pending patches
is the smallest: the end of the merge window.

Namespace clashes were fixed up in a preparatory patch - and some
stylistic fallout will be fixed up in a subsequent patch.

( NOTE: 'counters' are still the proper terminology when we deal
  with hardware registers - and these sed scripts are a bit
  over-eager in renaming them. I've undone some of that, but
  in case there's something left where 'counter' would be
  better than 'event' we can undo that on an individual basis
  instead of touching an otherwise nicely automated patch. )

Suggested-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <linux-arch@vger.kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-09-21 14:28:04 +02:00
Tim Abbott 02b7da37f7 Use macros for .bss.page_aligned section.
This patch changes the remaining direct references to
.bss.page_aligned in C and assembly code to use the macros in
include/linux/linkage.h.

Signed-off-by: Tim Abbott <tabbott@ksplice.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-09-21 06:27:08 +02:00
Joe Perches d200c922bc Use new __init_task_data macro in arch init_task.c files.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Tim Abbott <tabbott@ksplice.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-09-21 06:27:08 +02:00
Sam Ravnborg f86fd30660 kbuild: rename ld-option to cc-ldoption
ld-option is misnamed as it test options to gcc, not to ld.
Renamed it to reflect this.

Cc: Andi Kleen <andi@firstfloor.org>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-09-20 12:27:42 +02:00
Linus Torvalds 515b696b28 Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (262 commits)
  sh: mach-ecovec24: Add user debug switch support
  sh: Kill off unused se_skipped in alignment trap notification code.
  sh: Wire up HAVE_SYSCALL_TRACEPOINTS.
  video: sh_mobile_lcdcfb: use both register sets for display panning
  video: sh_mobile_lcdcfb: implement display panning
  sh: Fix up sh7705 flush_dcache_page() build.
  sh: kfr2r09: document the PLL/FLL <-> RF relationship.
  sh: mach-ecovec24: need asm/clock.h.
  sh: mach-ecovec24: deassert usb irq on boot.
  sh: Add KEYSC support for EcoVec24
  sh: add kycr2_delay for sh_keysc
  sh: cpufreq: Include CPU id in info messages.
  sh: multi-evt support for SH-X3 proto CPU.
  sh: clkfwk: remove bogus set_bus_parent() from SH7709.
  sh: Fix the indication point of the liquid crystal of AP-325RXA(AP3300)
  sh: Add EcoVec24 romImage defconfig
  sh: USB disable process is needed if romImage boot for EcoVec24
  sh: EcoVec24: add HIZA setting for LED
  sh: EcoVec24: write MAC address in boot
  sh: Add romImage support for EcoVec24
  ...
2009-09-18 09:43:09 -07:00
Linus Torvalds a03fdb7612 Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (34 commits)
  time: Prevent 32 bit overflow with set_normalized_timespec()
  clocksource: Delay clocksource down rating to late boot
  clocksource: clocksource_select must be called with mutex locked
  clocksource: Resolve cpu hotplug dead lock with TSC unstable, fix crash
  timers: Drop a function prototype
  clocksource: Resolve cpu hotplug dead lock with TSC unstable
  timer.c: Fix S/390 comments
  timekeeping: Fix invalid getboottime() value
  timekeeping: Fix up read_persistent_clock() breakage on sh
  timekeeping: Increase granularity of read_persistent_clock(), build fix
  time: Introduce CLOCK_REALTIME_COARSE
  x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown
  clocksource: Avoid clocksource watchdog circular locking dependency
  clocksource: Protect the watchdog rating changes with clocksource_mutex
  clocksource: Call clocksource_change_rating() outside of watchdog_lock
  timekeeping: Introduce read_boot_clock
  timekeeping: Increase granularity of read_persistent_clock()
  timekeeping: Update clocksource with stop_machine
  timekeeping: Add timekeeper read_clock helper functions
  timekeeping: Move NTP adjusted clock multiplier to struct timekeeper
  ...

Fix trivial conflict due to MIPS lemote -> loongson renaming.
2009-09-18 09:15:24 -07:00
Paul Mundt 480c646c32 sh: Kill off unused se_skipped in alignment trap notification code.
Nothing is using this, resulting in a build error with certain
configurations. Just kill it off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-16 15:06:39 +09:00
Paul Mundt a74f7e0410 sh: Wire up HAVE_SYSCALL_TRACEPOINTS.
This is necessary to get ftrace syscall tracing working again.. a fairly
trivial and mechanical change. The one benefit is that this can also be
enabled on sh64, despite not having its own ftrace port.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-16 14:30:34 +09:00
Paul Mundt ea88023b34 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
	arch/sh/kernel/vmlinux.lds.S
2009-09-16 13:48:32 +09:00
Linus Torvalds ada3fa1505 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (46 commits)
  powerpc64: convert to dynamic percpu allocator
  sparc64: use embedding percpu first chunk allocator
  percpu: kill lpage first chunk allocator
  x86,percpu: use embedding for 64bit NUMA and page for 32bit NUMA
  percpu: update embedding first chunk allocator to handle sparse units
  percpu: use group information to allocate vmap areas sparsely
  vmalloc: implement pcpu_get_vm_areas()
  vmalloc: separate out insert_vmalloc_vm()
  percpu: add chunk->base_addr
  percpu: add pcpu_unit_offsets[]
  percpu: introduce pcpu_alloc_info and pcpu_group_info
  percpu: move pcpu_lpage_build_unit_map() and pcpul_lpage_dump_cfg() upward
  percpu: add @align to pcpu_fc_alloc_fn_t
  percpu: make @dyn_size mandatory for pcpu_setup_first_chunk()
  percpu: drop @static_size from first chunk allocators
  percpu: generalize first chunk allocator selection
  percpu: build first chunk allocators selectively
  percpu: rename 4k first chunk allocator to page
  percpu: improve boot messages
  percpu: fix pcpu_reclaim() locking
  ...

Fix trivial conflict as by Tejun Heo in kernel/sched.c
2009-09-15 09:39:44 -07:00
Paul Mundt 033eb0acdd sh: cpufreq: Include CPU id in info messages.
This tidies up the printks when running on SMP, and aids in debugging
when certain cores are unable to be scaled.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-15 09:26:04 +09:00
Paul Mundt 3639dfb57d sh: multi-evt support for SH-X3 proto CPU.
This adds support for multiple vectors per unique IRQ masking source on
the SH-X3 proto CPU.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-14 17:29:35 +09:00
Rafael Ignacio Zurita 2fd5a02107 sh: clkfwk: remove bogus set_bus_parent() from SH7709.
This fixes up broken clock re-parenting undertaken by the SH7709 clock
framework code, which is currently in conflict with the legacy CPG
framework. With this change in place, the legacy CPG ancestry is used,
and we manage to avoid contending on the clock_list_sem mutex, which is
already held under the legacy registration path, resulting in livelock.

In order for SH7709 to fully support the varying clock modes, it needs to
implement a more complete clock framework. After this change it is in
sync with legacy CPG mode, which ends up being the default configuration
for this CPU anyways.

Signed-off-by: Rafael Ignacio Zurita <rizurita@yahoo.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-14 14:09:00 +09:00
David Howells ee18d64c1f KEYS: Add a keyctl to install a process's session keyring on its parent [try #6]
Add a keyctl to install a process's session keyring onto its parent.  This
replaces the parent's session keyring.  Because the COW credential code does
not permit one process to change another process's credentials directly, the
change is deferred until userspace next starts executing again.  Normally this
will be after a wait*() syscall.

To support this, three new security hooks have been provided:
cred_alloc_blank() to allocate unset security creds, cred_transfer() to fill in
the blank security creds and key_session_to_parent() - which asks the LSM if
the process may replace its parent's session keyring.

The replacement may only happen if the process has the same ownership details
as its parent, and the process has LINK permission on the session keyring, and
the session keyring is owned by the process, and the LSM permits it.

Note that this requires alteration to each architecture's notify_resume path.
This has been done for all arches barring blackfin, m68k* and xtensa, all of
which need assembly alteration to support TIF_NOTIFY_RESUME.  This allows the
replacement to be performed at the point the parent process resumes userspace
execution.

This allows the userspace AFS pioctl emulation to fully emulate newpag() and
the VIOCSETTOK and VIOCSETTOK2 pioctls, all of which require the ability to
alter the parent process's PAG membership.  However, since kAFS doesn't use
PAGs per se, but rather dumps the keys into the session keyring, the session
keyring of the parent must be replaced if, for example, VIOCSETTOK is passed
the newpag flag.

This can be tested with the following program:

	#include <stdio.h>
	#include <stdlib.h>
	#include <keyutils.h>

	#define KEYCTL_SESSION_TO_PARENT	18

	#define OSERROR(X, S) do { if ((long)(X) == -1) { perror(S); exit(1); } } while(0)

	int main(int argc, char **argv)
	{
		key_serial_t keyring, key;
		long ret;

		keyring = keyctl_join_session_keyring(argv[1]);
		OSERROR(keyring, "keyctl_join_session_keyring");

		key = add_key("user", "a", "b", 1, keyring);
		OSERROR(key, "add_key");

		ret = keyctl(KEYCTL_SESSION_TO_PARENT);
		OSERROR(ret, "KEYCTL_SESSION_TO_PARENT");

		return 0;
	}

Compiled and linked with -lkeyutils, you should see something like:

	[dhowells@andromeda ~]$ keyctl show
	Session Keyring
	       -3 --alswrv   4043  4043  keyring: _ses
	355907932 --alswrv   4043    -1   \_ keyring: _uid.4043
	[dhowells@andromeda ~]$ /tmp/newpag
	[dhowells@andromeda ~]$ keyctl show
	Session Keyring
	       -3 --alswrv   4043  4043  keyring: _ses
	1055658746 --alswrv   4043  4043   \_ user: a
	[dhowells@andromeda ~]$ /tmp/newpag hello
	[dhowells@andromeda ~]$ keyctl show
	Session Keyring
	       -3 --alswrv   4043  4043  keyring: hello
	340417692 --alswrv   4043  4043   \_ user: a

Where the test program creates a new session keyring, sticks a user key named
'a' into it and then installs it on its parent.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
2009-09-02 21:29:22 +10:00
Paul Mundt ade315d83c 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>
2009-09-01 17:45:35 +09:00
Paul Mundt 1e1030dccb 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>
2009-09-01 17:38:32 +09:00
Paul Mundt ac6a0cf671 Merge branch 'master' into sh/smp
Conflicts:
	arch/sh/mm/cache-sh4.c
2009-09-01 13:54:14 +09:00
Paul Mundt 2f6dafc5fc sh: unwinder: Fix up uninitialized variable warnings on sh2a build.
A couple of these popped up on the sh2a build, causing build failures.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-31 13:47:06 +09:00
Matt Fleming 4aa5ac4ef4 sh: Only shout about fixing up unexpected unaligned accesses
Some unaligned accesses are completely expected. For example, the
trapped_io code uses the unaligned access fixup code path so there's no
need to warn about having to fixup the unaligned access.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-29 20:31:44 +09:00
Kuninori Morimoto b37c7c66f0 sh: fix CPU_SH7723/7724 numbering bug
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-27 11:35:46 +09:00
Paul Mundt 0ceb4c3e3f timekeeping: Fix up read_persistent_clock() breakage on sh
The recent commit "timekeeping: Increase granularity of
read_persistent_clock()" introduced read_persistent_clock()
rework which inadvertently broke the sh conversion:

	arch/sh/kernel/time.c:45: error: passing argument 1 of 'rtc_sh_get_time' from incompatible pointer type
	distcc[13470] ERROR: compile arch/sh/kernel/time.c on sprygo/32 failed
	make[2]: *** [arch/sh/kernel/time.o] Error 1

This trivial fix gets it working again.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
LKML-Reference: <20090824223239.GB20832@linux-sh.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-08-25 08:46:16 +02:00
Paul Mundt 12cceb6251 Merge branch 'sh/st-integration' 2009-08-24 22:49:17 +09:00
Paul Mundt f13327864f sh: Move the FTRACE_SYSCALL_MAX definition in to asm/ftrace.h.
Needed by ftrace changes in -tip.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 22:48:27 +09:00
Pawel Moll 05ecd5a1f7 sh: Simplify "multi-evt" interrupt handling.
This patch changes the way in which "multi-evt" interrups are handled.
The intc_evt2irq_table and related intc_evt2irq() have been removed and
the "redirecting" handler is installed for the coupled interrupts.

Thanks to that the do_IRQ() function don't have to use another level
of indirection for all the interrupts...

Signed-off-by: Pawel Moll <pawel.moll@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 19:52:38 +09:00
Giuseppe Cavallaro 788e6af37a sh: fix sys_cacheflush error checking
sys_cacheflush should return with EINVAL if the cache parameter is not
one of ICACHE, DCACHE or BCACHE.
So, we need to include 0 in the first check.

It also adds the three definitions above as wrapper of the existent macros.

PS: ltp cacheflush01 test now passes.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 18:59:09 +09:00
Stuart Menefy 6000fc4d6f sh: Fixes some write posting issues in the interrupt handling for SH
It is possible for the CPU to re-enable it's interrupt block bit
before the write to the interrupt controller has actually masked out
the external interupt at the controller. We get around this by
reading back from the interrupt controller which will ensure the
write has happened.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 18:27:33 +09:00
Stuart Menefy 6d243dd370 sh: Add sys_cacheflush() call for SH CPUs.
Adds a system call to allow user code to flush code from the cache.
You can use instructions for the data side, but the iside can
only be done by a flush ROM which really only works with a direct
mapped cache. The later SH4's have 2 way Iside, so this call allows
a portable way to flush the cache.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 18:16:56 +09:00
Stuart Menefy 5e9377ec6f sh: Optimise memcpy_to/fromio for SH4
Optimise memcpy_to/fromio. This is used extensivly by MTD, so is a
worthwhile performance gain. The main savings come from not repeatedly
calling readl/writel, and doing word instead of byte at a time
transfers. Also using "movca.l" on SH4 gives a small performance win.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 17:35:07 +09:00
Stuart Menefy 8af57f8b4c sh: generic_in/outs{bwl} optimizations.
After performing the port2addr conversion, and checking that the data is
correctly aligned, simply call __raw_readsX/writesX. These have already been
optimised.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 17:26:39 +09:00
Stuart Menefy fea966f756 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>
2009-08-24 17:09:53 +09:00
Pawel Moll d724a9c9d5 sh: Allow for kernel command line concatenation.
So far kernel command line arguments could be passed in by a bootloader
or defined as CONFIG_CMDLINE, which completely overwriting the first one.

This change allows a developer to declare selected kernel parameters in
a kernel configuration (eg. project-specific defconfig), retaining
possibility of passing others by a bootloader.

The obvious examples of the first type are MTD partition or
bigphysarea-like region definitions, while "debug" option or network
configuration should be given by a bootloader or a JTAG boot script.

Signed-off-by: Pawel Moll <pawel.moll@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 16:25:38 +09:00
Jon Frosdick b46373e0d4 sh: Use internal watchdog timer to perform reset
This patches will trigger a reboot using the watchdog
timer instead of double fault.  Unlike the previous
method, this one actually works in 32 bit mode.

Reset should also be cleaner.

Signed-off-by: Jon Frosdick <jon.frosdick@st.com>
Signed-off-by: Carl Shaw <carl.shaw@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 16:20:44 +09:00
Giuseppe Cavallaro 27a30f53bb sh: kgdb: do not reload VBR while handling debugger breackpoint
Save the VBR allowing GDB to dump full registers set but do not reload it
as soon as the kgdb_handle_exception is invoked.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 16:14:03 +09:00
David McKay 15444a8973 sh: Allow use of GENERIC_IOMAP
The synopsys PCI cell used in the later STMicro chips requires code to
be run in order to do IO cycles, rather than just memory mapping the IO
space. Rather than extending the existing SH infrastructure to allow
this, use the GENERIC_IOMAP implmentation to save re-inventing the
wheel.

This set of changes allows the SH to be built with GENERIC_IOMAP
enabled, it just ifdef's out the functions provided by the GENERIC_IOMAP
implementation, and provides a few required missing functions.

Signed-off-by: David McKay <david.mckay@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 16:10:40 +09:00
Carl Shaw 2fc742f8d6 sh: Improve unwind info for signals
GCC does not issue unwind information for function epilogues.
Unfortunately we can catch a signal during an epilogue.  The signal
handler writes the current context and signal return code onto the stack
overwriting previous contents.  During unwinding, libgcc can try to
restore registers from the stack and restores corrupted ones. This can
lead to segmentation, misaligned access and sigbus faults.

For example, consider the following code:

    mov.l   r12,@-r15
    mov.l   r14,@-r15
    sts.l   pr,@-r15
    mov     r15,r14

    <do stuff>

    mov r14, r15
    lds.l @r15+, pr
	<<< SIGNAL HERE
    mov.l @r15+, r14
    mov.l @r15+, r12
    rts

Unwind is aware that pr was pushed to stack in prolog, so tries to
restore it.  Unfortunately it restores the last word of the signal
handler code placed on the stack by the kernel.

This patch tries to avoid the problem by adding a guard region on the
stack between where the function pushes data and where the signal handler
pushes its return code.  We probably don't see this problem often because
exception handling unwinding in an epilogue only occurs due to a pthread
cancel signal.  Also the kernel signal stack handler alignment of 8 bytes
could hide the occurance of this problem sometimes as the stack may not
be trampled at a particular required word.

This is not guaranteed to always work.  It relies on a frame pointer
existing for the function (so it can get the correct sp value) which is
not always the case for the SH4.

Modifications will also be made to libgcc for the case where there is no
fp.

Signed-off-by: Carl Shaw <carl.shaw@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 15:07:08 +09:00
Andre Draszik 5a0ab35e43 sh: cleanup of do_address_error()
This patch fixes a few problems with the existing code in do_address_error().

a) the variable used to printk()d the offending instruction wasn't
   initialized correctly. This is a fix to bug 5727

b) behaviour for CONFIG_CPU_SH2A wasn't correct

c) the 'ignore address error' behaviour didn't update the PC, causing an
   infinite loop.

Signed-off-by: Andre Draszik <andre.draszik@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 15:01:10 +09:00
Andre Draszik 7436cde6b2 sh: Allow user control over misaligned fixup handling
This patch brings the SH4 misaligned trap handler in line with what
happens on ARM:
Add a /proc/cpu/alignment which can be read from to get alignment
trap statistics and written to to influence the behaviour of the
alignment trap handling. The value to write is a bitfield, which
has the following meaning: 1 warn, 2 fixup, 4 signal
In addition, we add a /proc/cpu/kernel_alignment, to enable or
disable warnings in case of kernel code causing alignment errors.

Signed-off by: Andre Draszik <andre.draszik@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 14:53:46 +09:00
Andre Draszik 9a4af027a0 sh: ratelimit unaligned fixups
This patch makes sure we see messages about unaligned access fixups
every now and then. Else especially userspace apps suffering from
bad programming won't ever be noticed...

Signed-off by: Andre Draszik <andre.draszik@st.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-24 14:38:27 +09:00
Paul Mundt c3144fc46f Merge branches 'sh/hwblk' and 'sh/pm-runtime' 2009-08-23 18:04:07 +09:00
Magnus Damm cc58f597af sh: drop static UIO clocks for sh7722, sh7723 and sh7724
The Runtime PM patch for UIO driver implements coarse grained
dynamic power management for UIO devices. With that patch in
place we can get rid of the static clock configuration. Which
in turn makes it possible for cpuidle to enter deeper sleep.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-23 18:03:21 +09:00
Paul Mundt a62926fe4b sh: Fix section mismatch in platform bus notifier.
The runtime PM for SH-Mobile code had platform_bus_notify() as __devinit,
which is rather bogus. Kill off the annotation, which subsequently
silences the section mismatch warnings.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-23 18:03:20 +09:00
Magnus Damm 6a93dde1e8 sh: Runtime PM for SuperH Mobile platform bus devices
This patch is V3 of the SuperH Mobile Runtime PM platform bus
implentation matching Rafael's Runtime PM v16.

The code gets invoked from the SuperH specific Runtime PM
platform bus functions that override the weak symbols for:
 - platform_pm_runtime_suspend()
 - platform_pm_runtime_resume()
 - platform_pm_runtime_idle()

This Runtime PM implementation performs two levels of power
management. At the time of platform bus runtime suspend the
clock to the device is stopped instantly. Later on if all
devices within the power domain has their clocks stopped
then the device driver ->runtime_suspend() callbacks are
used to save hardware register state for each device.

Device driver ->runtime_suspend() calls are scheduled from
cpuidle context using platform_pm_runtime_suspend_idle().
When all devices have been fully suspended the processor
is allowed to enter deep sleep from cpuidle.

The runtime resume operation turns on clocks and also
restores registers if needed. It is worth noting that the
devices start in a suspended state and the device driver
is responsible for calling runtime resume before accessing
the actual hardware.

In this particular platform bus implementation runtime
resume is not allowed from interrupt context. Runtime
suspend is however allowed from interrupt context as
long as the synchronous functions are avoided.

[ updated for v17 -- PFM. ]

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-23 18:03:17 +09:00
Paul Mundt 4f896ffca2 sh: unwinder: cacheline align slab cache objects.
The CIE and FDE structs are big enough and accessed regularly enough in
certain configurations to make cacheline alignment useful.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-22 19:03:25 +09:00
Paul Mundt fa9d3b4da5 Merge branch 'sh/dwarf-unwinder'
Conflicts:
	arch/sh/kernel/cpu/sh3/entry.S
2009-08-22 05:37:14 +09:00
Paul Mundt e115f2c17c sh: unwinder: Use a special bug flag for unwinder traps.
This simplifies the unwinder trap handling, dropping the use of the
special trapa vector and simply piggybacking on top of the BUG support. A
new BUGFLAG_UNWINDER is added for flagging the unwinder fault, before
continuing on with regular BUG dispatch.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-22 05:28:25 +09:00
Paul Mundt c153a58e71 Merge branch 'sh/dwarf-unwinder' of git://github.com/mfleming/linux-2.6 into sh/dwarf-unwinder 2009-08-22 03:49:58 +09:00
Paul Mundt 4ab8f241f6 sh: Export unwind_stack() to satisfy modular oprofile.
If the oprofile code is built as a module, unwind_stack() as used by the
oprofile backtrace code is not available, causing build breakage.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-22 03:43:15 +09:00
Matt Fleming 5580e9044d sh: Handle the DWARF op, DW_CFA_undefined
Allow a DWARF register to have an undefined value. When applied to the
DWARF return address register this lets lets us label a function as
having no direct caller, e.g. kernel_thread_helper().

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-08-21 13:04:11 +01:00
Matt Fleming 5480675dc6 sh: Fix bug calculating the end of the FDE instructions
The 'end' member of struct dwarf_fde denotes one byte past the end of
the CFA instruction stream for an FDE. The value of 'end' was being
calcualted incorrectly, it was being set too high. This resulted in
dwarf_cfa_execute_insns() interpreting data past the end of valid
instructions, thus causing all sorts of weird crashes.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-08-21 13:04:10 +01:00
Matt Fleming fe98dd31eb 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>
2009-08-21 13:04:10 +01:00
Matt Fleming b344e24a8e sh: unwinder: Introduce UNWINDER_BUG() and UNWINDER_BUG_ON()
We can't assume that if we execute the unwinder code and the unwinder
was already running that it has faulted. Clearly two kernel threads can
invoke the unwinder at the same time and may be running simultaneously.

The previous approach used BUG() and BUG_ON() in the unwinder code to
detect whether the unwinder was incapable of unwinding the stack, and
that the next available unwinder should be used instead. A better
approach is to explicitly invoke a trap handler to switch unwinders when
the current unwinder cannot continue.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-08-21 13:02:44 +01:00
Matt Fleming 97efbbd588 sh: unwinder: Set the flags for DW_CFA_val_offset ops as DWARF_VAL_OFFSET
The handling of DW_CFA_val_offset ops was incorrectly using the
DWARF_REG_OFFSET flag but the register's value cannot be calculated
using the DWARF_REG_OFFSET method. Create a new flag to indicate that a
different method must be used to calculate the register's value even
though there is no implementation for DWARF_VAL_OFFSET yet; it's mainly
just a place holder.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-08-21 13:02:44 +01:00
Matt Fleming fb3f3e7fc6 sh: unwinder: Fix memory leak and create our own kmem cache
Plug a memory leak in dwarf_unwinder_dump() where we didn't free the
memory that we had previously allocated for the DWARF frames and DWARF
registers.

Now is also a opportune time to implement our own mempool and kmem
cache. It's a good idea to have a certain number of frame and register
objects in reserve at all times, so that we are guaranteed to have our
allocation satisfied even when memory is scarce. Since we have pools to
allocate from we can implement the registers for each frame as a linked
list as opposed to a sparsely populated array. Whilst it's true that the
lookup time for a linked list is larger than for arrays, there's only
usually a maximum of 8 registers per frame. So the overhead isn't that
much of a concern.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-08-21 13:02:43 +01:00
Yoshihiro Shimoda c01f0f1a4a sh: Add initial support for SH7757 CPU subtype
Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-21 17:25:47 +09:00
Paul Mundt 307646c958 sh: Fix up the CONFIG_FTRACE_SYSCALLS=n build.
-tip can't be bothered keeping interfaces stable long enough for anyone
to use them without having their builds broken without notification, so
just ifdef around the problematic symbols until the new interfaces become
available upstream.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-20 12:07:46 +09:00
Paul Mundt fc6191dd30 sh: Fix up clockevents broadcasting.
This fixes up the clockevents broadcasting code as detailed in commit
ee348d5a1d ("[ARM] realview: fix broadcast
tick support"). This saves us from having to do strange ordering things
with the broadcast clockevent device, relying on the rating instead.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-19 18:00:03 +09:00
Paul Mundt ee8365f233 Merge branch 'master' into sh/cachetlb
Conflicts:
	arch/sh/kernel/Makefile_64
2009-08-19 09:12:00 +09:00
Kuninori Morimoto b2ea8b4215 sh: clkfwk: Support additional IFC divisor on SH7724.
This patch updates the FRQCRA.IFC divisor values for SH7724. Despite
not being initially documented, the / 3 mode is also support for the IFC
division.

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-18 21:16:29 +09:00
Matt Fleming f3a8308864 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>
2009-08-18 11:35:09 +09:00
Magnus Damm 63cd91dfd4 sh: SuperH Mobile Software Standby support for cpuidle
This patch adds "SuperH Mobile Standby Mode [SF]" to the list
of cpuidle sleep modes. If the software latency requirements
from cpuidle are met together with fulfilled hardware
requirements then deep sleep modes can be entered.

Tested on sh7722 and sh7724 with "Sleep Mode", "Sleep Mode + SF"
and "Software Standby Mode + SF" together with a multimedia
work load and flood ping without packet drop.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-18 10:17:32 +09:00
Magnus Damm 309214af53 sh: rework SuperH Mobile sleep code exception handling
This patch updates the exception handling in the sleep code
for SuperH Mobile. With the patch applied the sleep code
always rewrites the VBR and resumes from the exception vector,
re-initializes hardware and jumps straight to the original
interrupt vector.

Tested on sh7722 and sh7724 with "Sleep Mode", "Sleep Mode + SF"
and "Software Standby Mode + SF" with CONFIG_SUSPEND.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-18 10:17:29 +09:00
Paul Mundt 97f361e249 sh: unwinder: Move initialization to early_initcall() and tidy up locking.
This moves the initialization over to an early_initcall(). This fixes up
some lockdep interaction issues. At the same time, kill off some
superfluous locking in the init path.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-17 05:07:38 +09:00
Matt Fleming cd7246f0e2 sh: Add support for DWARF GNU extensions
Also, remove the "fix" to DW_CFA_def_cfa_register where we reset the
frame's cfa_offset to 0. This action is incorrect when handling
DW_CFA_def_cfa_register as the DWARF spec specifically states that the
previous contents of cfa_offset should be used with the new
register. The reason that I thought cfa_offset should be reset to 0 was
because it was being assigned a bogus value prior to executing the
DW_CFA_def_cfa_register op. It turns out that the bogus cfa_offset value
came from interpreting .cfi_escape pseudo-ops (those used by the GNU
extensions) as CFA_DW_def_cfa ops.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-08-16 12:48:53 +01:00
Matt Fleming b955873bf5 sh: Try again at getting the initial return address for an unwind
The previous hack for calculating the return address for the first frame
we unwind (dwarf_unwinder_dump) didn't always work. The problem was that
it assumed once it read the rule for calculating the return address,
there would be no new rules for calculating it. This isn't true because
the way in which the CFA is calculated can change as you progress
through a function and the return address is figured out using the
CFA. Therefore, the way to calculate the return address can change.

So, instead of using some offset from the beginning of
dwarf_unwind_stack which is just a flakey approach, and instead of
executing instructions from the FDE until the return address is setup,
we now figure out the pc in dwarf_unwind_stack() just before we call
dwarf_cfa_execute_insns().

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-08-16 12:48:53 +01:00
Paul Mundt 38f9ddf441 sh: Merge the _32/_64 variants of arch/sh/kernel/Makefile.
This uses the BITS export as per x86 in order to allow the same Makefile
to be used.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-16 03:35:26 +09:00
Paul Mundt 94ecd224c9 sh: Fix up the SH-5 build with caches enabled.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-16 01:50:17 +09:00
Paul Mundt 1ee4ab09f3 sh64: Build in support for generic stacktrace ops.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-16 00:55:38 +09:00
Martin Schwidefsky d4f587c67f timekeeping: Increase granularity of read_persistent_clock()
The persistent clock of some architectures (e.g. s390) have a
better granularity than seconds. To reduce the delta between the
host clock and the guest clock in a virtualized system change the 
read_persistent_clock function to return a struct timespec.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: John Stultz <johnstul@us.ibm.com>
Cc: Daniel Walker <dwalker@fifo99.com>
LKML-Reference: <20090814134811.013873340@de.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2009-08-15 10:55:46 +02:00
Paul Mundt eccee7457d sh: Kill off the unhandled pvr case in SH-4 CPU probing.
This is superfluous, as the default CPU type and family are already
established by the initial cpuinfo definition. Given that we are still
able to probe for the CPU family even if we are not able to detect the
subtype, it's preferable to let the probing code fill out what it can and
leave the rest.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 13:15:02 +09:00
Paul Mundt 4b6b987969 Merge branch 'master' into sh/hwblk 2009-08-15 13:00:02 +09:00
Paul Mundt 60e0a4c7ad Merge branch 'sh/stable-updates' 2009-08-15 12:59:42 +09:00
Magnus Damm 237674e050 sh: sh7724 ddr self-refresh changes
This patch updates the SuperH Mobile sleep assembly code with
support for DBSC memory controller found in the sh7724 processor.

Without this fix the memory hooked up to the sh7724 processor
will never enter self-refresh mode before suspending to ram. The
effect of this is that the memory contents most likeley will be
lost upon resume which may or may not be what you want.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 12:58:50 +09:00
Paul Mundt e82da214d2 sh: Track the CPU family in sh_cpuinfo.
This adds a family member to struct sh_cpuinfo, which allows us to fall
back more on the probe routines to work out what sort of subtype we are
running on. This will be used by the CPU cache initialization code in
order to first do family-level initialization, followed by subtype-level
optimizations.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 10:48:13 +09:00
Paul Mundt dde5e3ffb7 sh: rework nommu for generic cache.c use.
This does a bit of reorganizing for allowing nommu to use the new
and generic cache.c, no functional changes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 09:49:32 +09:00
Matt Fleming 180aa6e6aa sh: Set the cfa_offset to 0 if we see a DW_CFA_def_cfa_register op
The way that the CFA is calculated can change as we progress through a
function. If we see a DW_CFA_def_cfa_register op we need to reset the
frame's cfa_offset value which may have been previously setup.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 08:07:43 +09:00
Paul Mundt 7dd6662a92 sh: delay slot future proofing via EXPMASK on SH-4A parts.
This implements EXPMASK initialization code for SH-4A parts, where it is
possible to disable compat features that will go away in newer cores.
Presently this includes disabling support for non-nop instructions in the
rte delay slot, as well as a sleep instruction being placed in a delay
slot (neither of which the kernel does any longer). As a result of this,
any future offenders will have illegal slot exceptions generated for
them.

Associative writes for the memory-mapped cache array are still left
enabled, until such a point that special cache operations for SH-4A are
provided to move off of the current (and rather dated) SH-4 versions.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 07:43:21 +09:00
Paul Mundt 7a90e00dda sh: Make sure rte delay slots are nopped out on all parts.
Future SH parts do not support any instruction but a nop in the rte delay
slot, so make the change for all offending parts. SH-5 is excluded from
this, and already has its own set of restrictions with regards to rte
delay slot handling.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 07:41:45 +09:00
Paul Mundt d2dcd9101b Merge branch 'master' into sh/cachetlb 2009-08-15 05:58:45 +09:00
Paul Mundt 8010fbe7a6 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>
2009-08-15 03:06:41 +09:00
Paul Mundt 112e58471d 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>
2009-08-15 02:49:40 +09:00
Paul Mundt 606b4c992f sh: stacktrace: Properly terminate the trace entry buffer.
This inserts a ULONG_MAX entry at the end of the valid entries in the
stack trace buffer so the default code doesn't need to scan to the end of
available slots. This also makes the trace buffer termination behaviour
consistent with the other architectures.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 01:11:37 +09:00
Paul Mundt f9967e23c1 sh: flag the default unwinder as reliable.
This flags the default unwinder as reliable, as it tends to be reliable
enough for the purposes of the stacktrace buffer. We leave the unreliable
cases for the unwind methods that we know to be completely broken.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 01:09:03 +09:00
Paul Mundt 48e4d4604b sh: stacktrace: Add reliability checks in address saving ops.
This adopts the reliability checks from the x86 stacktrace code so known
bad addresses are not recorded in the stack trace buffer.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-15 01:05:46 +09:00
Paul Mundt 0fc11e3618 sh: unwinder: Convert frame allocations to GFP_ATOMIC.
save_stack_trace_tsk() and friends can be called from atomic context (as
triggered by latencytop), and subsequently hit two problematic allocation
points that were using GFP_KERNEL (these were dwarf_unwind_stack() and
dwarf_frame_alloc_regs()). Convert these over to GFP_ATOMIC and get
latencytop working with the DWARF unwinder.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-14 23:58:37 +09:00
Tejun Heo 384be2b18a Merge branch 'percpu-for-linus' into percpu-for-next
Conflicts:
	arch/sparc/kernel/smp_64.c
	arch/x86/kernel/cpu/perf_counter.c
	arch/x86/kernel/setup_percpu.c
	drivers/cpufreq/cpufreq_ondemand.c
	mm/percpu.c

Conflicts in core and arch percpu codes are mostly from commit
ed78e1e078dd44249f88b1dd8c76dafb39567161 which substituted many
num_possible_cpus() with nr_cpu_ids.  As for-next branch has moved all
the first chunk allocators into mm/percpu.c, the changes are moved
from arch code to mm/percpu.c.

Signed-off-by: Tejun Heo <tj@kernel.org>
2009-08-14 14:45:31 +09:00
Matt Fleming f826466772 sh: Delete DWARF_ARCH_UNWIND_OFFSET
Trying to figure out the best value for DWARF_ARCH_UNWIND_OFFSET is
tricky at best. Various things can change the size (and offset from the
beginning of the function) of the prologue. Notably, turning on ftrace
adds calls to mcount at the beginning of functions, thereby pushing the
prologue further into the function.

So replace DWARF_ARCH_UNWIND_OFFSET with some code that continues to
execute CFA instructions until the value of return address register is
defined. This is safe to do because we know that the return address must
have been pushed onto the frame before our first function call; we just
can't figure out where at compile-time.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-14 05:00:21 +09:00
Paul Mundt bf43a160ff sh: unwinder: Restore put_unaligned() for an unaligned destination.
The destination address might be unaligned, so set it with
put_unaligned() for safety. This restores the previous behaviour, albeit
through the proper API.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-14 03:06:13 +09:00
Paul Mundt 3497447f15 sh: unwinder: Fix up usage of unaligned accessors.
This was using internal symbols for unaligned accesses, bypassing the
exposed interface for variable sized safe accesses. This converts all of
the __get_unaligned_cpuXX() users over to get_unaligned() directly,
relying on the cast to select the proper internal routine.

Additionally, the __put_unaligned_cpuXX() case is superfluous given that
the destination address is aligned in all of the current cases, so just
drop that outright.

Furthermore, this switches to the asm/unaligned.h header instead of the
asm-generic version, which was silently bypassing the SH-4A optimized
unaligned ops.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-14 02:10:59 +09:00
Matt Fleming cafb0ddac6 sh: Add CFI annotations for exception return.
Annotate various assembly code paths with CFI assembler directives so
that DWARF unwind info is available for the unwinder.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-14 02:02:07 +09:00
Matt Fleming 0b930489b8 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>
2009-08-14 01:59:55 +09:00
Matt Fleming bd353861c7 sh: dwarf unwinder support.
This is a first cut at a generic DWARF unwinder for the kernel. It's
still lacking DWARF64 support and the DWARF expression support hasn't
been tested very well but it is generating proper stacktraces on SH for
WARN_ON() and NULL dereferences.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-14 01:58:43 +09:00
Matt Fleming 0eff9f66de sh: Use the new stack unwinder API
Instead of implementing our own stack unwinder via dump_trace() we
should use the new stack unwinder API because it is more modular. This
change allows us to decouple the interface for generating stacktraces
from the implementation of a stack unwinder.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-13 19:52:53 +09:00
Matt Fleming bf61ad1f87 sh: Allow multiple stack unwinders to be setup
Provide an interface for registering stack unwinders, where each
unwinder is given a rating that describes its accuracy and
complexity. The more accurate an unwinder is, the more complex it is.

If a the current stack unwinder faults, then the stack unwinder with the
next highest accuracy will be used in its place (provided one is
available). For example, this allows unwinders, such as the DWARF
unwinder, to liberally sprinkle BUG()s to catch badly formed DWARF debug
info.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-13 19:49:03 +09:00
Matt Fleming 4e14dfc722 sh: Use the generalized stacktrace ops
Copy the stacktrace ops code from x86 and provide a central function for
use by functions that need to dump a callstack.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-13 11:50:08 +09:00
Magnus Damm ba9a633787 sh: convert processor device setup functions to arch_initcall()
Convert the processor platform device setup
functions from __initcall() and sometimes
device_initcall() to arch_initcall().

This makes sure that the platform devices are
registered a bit earlier so the devices are
available when drivers register using initcall
levels earlier than device_initcall().

A good example is platform devices needed by
i2c-sh_mobile.c which registers a bit earlier
using subsys_initcall().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-13 11:36:33 +09:00
Paul Mundt d14d751ff9 sh64: Kill off special clear_page() implementation.
This can use the now generic clear_page() implementation, which is backed
by the sh64 optimized memset routine. This also fixes up the case where
PAGE_SIZE != 4kB.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 17:17:00 +09:00
Paul Mundt c7914834ef sh: Tidy up NEFF-based sign extension for SH-5.
This consolidates all of the NEFF-based sign extension for SH-5.
In the future the other SH code will need to make use of this as well,
so make it generic in preparation for more 32/64 consolidation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 17:14:39 +09:00
Paul Mundt 11d82905e0 sh: Fix up early printk build error.
Missing endif in the early printk case, fix it up..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 15:54:33 +09:00
Magnus Damm 593a0c898a sh: Runtime PM pdev hwblk - sh7724
Add hwblk_id to on-chip sh7724 platform devices.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 15:06:09 +09:00
Magnus Damm 09d21f9c83 sh: Runtime PM pdev hwblk - sh7723
Add hwblk_id to on-chip sh7723 platform devices.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 15:06:01 +09:00
Magnus Damm f69d578274 sh: Runtime PM pdev hwblk - sh7722
Add hwblk_id to on-chip sh7722 platform devices.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 15:05:53 +09:00
Magnus Damm 133b170f08 sh: clean up MSTPCRn register definitions
This patch removes the unused MSTPCRn register definitions
from the SuperH Mobile code for sh7722, sh7723 and sh7724.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 14:40:58 +09:00
Magnus Damm 6ba4a8f0f5 sh: hwblk support for sh7724
This patch adds hwblk support for the sh7724 processor.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 14:40:55 +09:00
Rafael Ignacio Zurita 05aa788275 sh: Add early printk support for SH770x CPUs.
This adds early printk support for SH770x (tested on SH7709 based hp6xx).

Signed-off-by: Rafael Ignacio Zurita <rizurita@yahoo.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-04 14:38:08 +09:00
Stuart Menefy fd78a76aef sh: Rework irqflags tracing to fix up CONFIG_PROVE_LOCKING.
This cleans up the irqflags tracing code quite a bit and ties it
in to various missing callsites that caused an imbalance when
CONFIG_PROVE_LOCKING was enabled.

Previously this was catching on:

 987 #ifdef CONFIG_PROVE_LOCKING
 988     DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
 989     DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
 990 #endif
 991     retval = -EAGAIN;

with hardirqs being doubly enabled, and subsequently bailing out
with the following call trace:

	Call trace:
	[<88035224>] __lock_acquire+0x616/0x6a6
	[<88015a8c>] do_fork+0xf8/0x2b0
	[<880331ec>] trace_hardirqs_on_caller+0xd4/0x114
	[<88241074>] _spin_unlock_irq+0x20/0x64
	[<88035224>] __lock_acquire+0x616/0x6a6
	[<8800386c>] kernel_thread+0x48/0x70
	[<88024ecc>] ____call_usermodehelper+0x0/0x110
	[<88024ecc>] ____call_usermodehelper+0x0/0x110
	[<88003894>] kernel_thread_helper+0x0/0x14
	[<88024bac>] __call_usermodehelper+0x38/0x70
	[<88025dc0>] worker_thread+0x150/0x274
	[<88035b9c>] lock_release+0x0/0x198
	[<88024b74>] __call_usermodehelper+0x0/0x70
	[<88028cf0>] autoremove_wake_function+0x0/0x30
	[<88028bf2>] kthread+0x3e/0x70
	[<88025c70>] worker_thread+0x0/0x274
	[<8800389c>] kernel_thread_helper+0x8/0x14
	[<88028bb4>] kthread+0x0/0x70
	[<88003894>] kernel_thread_helper+0x0/0x14

Reported-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-29 23:01:24 +09:00
Paul Mundt 82b242214b Revert "sh: Bump the earlytimer bits back to time_init()."
This reverts commit 1d29ebebcb.

Bumping up the earlytimer initialization causes IRQs to be enabled too
early, which blows up lockdep:

...
NR_IRQS:256 nr_irqs:256
------------[ cut here ]------------
Badness at kernel/lockdep.c:2128

Pid : 0, Comm:          swapper
CPU : 0                 Not tainted  (2.6.31-rc3-00205-g3ed6e12-dirty #2443)

PC is at trace_hardirqs_on_caller+0x48/0x10c
PR is at trace_hardirqs_on_caller+0x3c/0x10c
...

Revert it back to late_time_init time, which fixes up lockdep.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-29 22:43:58 +09:00
Paul Mundt dfff0fa65a sh: wire up clear_user_highpage() for sh4, convert sh7705.
This wires up clear_user_highpage() on SH-4 and subsequently converts the
SH7705 32kB cache mode over to using it. Now that the SH-4 implementation
handles all of the dcache purging directly in the aliasing case, there is
no need to do this in the default clear_page() implementation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-27 20:53:22 +09:00
Magnus Damm 955c9863bb sh: convert processor device setup functions to arch_initcall()
Convert the processor platform device setup
functions from __initcall() and sometimes
device_initcall() to arch_initcall().

This makes sure that the platform devices are
registered a bit earlier so the devices are
available when drivers register using initcall
levels earlier than device_initcall().

A good example is platform devices needed by
i2c-sh_mobile.c which registers a bit earlier
using subsys_initcall().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-23 13:06:07 +09:00
Magnus Damm 2c59b0b70b usb: m66592-udc platform data on_chip support
Convert the m66592-udc driver to use the on_chip flag
from platform data to enable on chip behaviour instead
of relying on CONFIG_SUPERH_BUILT_IN_M66592 ugliness.

This makes the code cleaner and also allows us to support
both external and internal m66592 with the same kernel.

It also makes the Kconfig part more future proof since
we with this patch can add support for new processors
with on-chip m66592 without modifying the Kconfig.

The patch adds a m66592 header file for platform data
and ties in platform data to the existing m66592 devices.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-23 13:04:15 +09:00
Tim Abbott 6bde607e69 sh: Clean up linker script using new BSS_SECTION macro.
Updated to use the fixed BSS linker script macros from this
thread:

	http://www.spinics.net/lists/kernel/msg913238.html

Signed-off-by: Tim Abbott <tabbott@ksplice.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-20 23:30:24 +09:00
Paul Mundt c358fc46ef Merge branches 'sh/hwblk' and 'sh/platform-updates' 2009-07-20 04:28:11 +09:00
Magnus Damm 719a72b7c7 usb: r8a66597-hcd platform data on_chip support
Convert the r8a66597-hcd driver to use the on_chip flag
from platform data to enable on chip behaviour instead
of relying on CONFIG_SUPERH_ON_CHIP_R8A66597 ugliness.

This makes the code cleaner and also allows us to support
both external and internal r8a66597 with the same kernel.

It also makes the Kconfig part more future proof since
we with this patch can add support for new processors
with on-chip r8a66597 without modifying the Kconfig.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-20 04:27:10 +09:00
Magnus Damm 2094e504a7 sh: hwblk support for sh7723
This patch adds hwblk support for the sh7723 processor.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-20 04:23:44 +09:00
Magnus Damm 0f8ee1874f sh: Add support for multiple hwblk counters
Extend the SuperH hwblk code to support more than one counter.
Contains ground work for the future Runtime PM implementation.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-20 04:23:39 +09:00
Paul Mundt 72849873cd sh: Kill off zero-sized vmlinux_64.lds.S
This seems to be some merge damage, kill it off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-14 06:51:54 -04:00
Paul Mundt fe27932052 sh: Use DECLARE_EXPORT() for mcount symbol export.
The function prototype for mcount is not defined if we are not building
with ftrace support enabled, so use DECLARE_EXPORT() to stub one in.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-11 20:32:14 +09:00
Paul Mundt 9f14b84afd sh: Replace DEBUG_STACKOVERFLOW with STACK_DEBUG.
STACK_DEBUG ties in to mcount in order to do function-granular stack
overflow checks as opposed to lazily checking from IRQ context. As the
default is nohz, the frequency of overflow checking is too irregular to
catch much useful information, and so the mcount approach employed by
sparc64 is adopted instead.

This kills off the old check entirely from the do_IRQ() path and now
adopts CONFIG_MCOUNT instead.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-11 20:05:34 +09:00
Paul Mundt 473d1cf4ee sh: Decouple mcount from ftrace.
This adds a general CONFIG_MCOUNT in order to permit mcount generation
without ftrace support. This is primarily for allowing platforms to
enable aggressive stack overflow checking without having to enable ftrace
support. Based on the sparc64 implementation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-11 19:56:58 +09:00
Paul Mundt f686d8c11c Merge branches 'sh/ftrace' and 'sh/stable-updates' 2009-07-11 10:08:33 +09:00
Matt Fleming 7816fecd03 sh: Mark __switch_to() as __notrace_funcgraph
Annotate __switch_to() so that the function graph tracer does not try to
trace it. Use __notrace_funcgraph, as opposed to notrace, so that other
tracers can continue to trace __switch_to().

The reason that we don't want to trace __switch_to() with the function
graph tracer is because of how the return address stack in task_struct
is implemented. When we enter __switch_to we store the real return
address on prev's ret_stack. When we return from __switch_to() we've
patched the return address on the kernel stack to be
return_to_handler. Calling return_to_handler we do,

       -> ftrace_return_to_handler()
       	  -> ftrace_pop_return_ftrace()

Which tries to pop the real return address from current->ret_stack. The
problem being that we stored the return address on prev->ret_stack, but
current now points to next, and next->ret_stack doesn't contain the
correct return address (and is possibly even empty).

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-11 10:08:06 +09:00
Matt Fleming 327933f5d6 sh: Function graph tracer support
Add both dynamic and static function graph tracer support for sh.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-11 10:08:01 +09:00
Matt Fleming b99610fb9c sh: Provide diagnostic kernel stack checks
Enable kernel stack checking code in both the dynamic ftrace and mcount
code paths. Check the stack to see if it's overflowing and make sure
that the stack pointer contains an address that's either in init_stack
or after the bss.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-11 10:07:58 +09:00
Tim Abbott 2802e34590 sh: Clean up linker script using new linker script macros.
This patch converts the sh architecture to use the new linker script
macros in include/asm-generic/vmlinux.lds.h.

Signed-off-by: Tim Abbott <tabbott@ksplice.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-10 15:58:16 +09:00
Tejun Heo 023bf6f1b8 linker script: unify usage of discard definition
Discarded sections in different archs share some commonality but have
considerable differences.  This led to linker script for each arch
implementing its own /DISCARD/ definition, which makes maintaining
tedious and adding new entries error-prone.

This patch makes all linker scripts to move discard definitions to the
end of the linker script and use the common DISCARDS macro.  As ld
uses the first matching section definition, archs can include default
discarded sections by including them earlier in the linker script.

ia64 is notable because it first throws away some ia64 specific
subsections and then include the rest of the sections into the final
image, so those sections must be discarded before the inclusion.

defconfig compile tested for x86, x86-64, powerpc, powerpc64, ia64,
alpha, sparc, sparc64 and s390.  Michal Simek tested microblaze.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Michal Simek <monstr@monstr.eu>
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Tony Luck <tony.luck@intel.com>
2009-07-09 11:27:40 +09:00
Paul Mundt 7119888df1 Merge branches 'sh/ftrace' and 'sh/cachetlb' 2009-07-06 20:19:28 +09:00
Matt Fleming c652d780c9 sh: Add ftrace syscall tracing support
Now that I've added TIF_SYSCALL_FTRACE the thread flags do not fit into
a single byte any more. Code testing them now needs to be aware of the
upper and lower bytes.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-06 20:16:33 +09:00
Paul Mundt 1ecc6ab669 Merge branches 'sh/hwblk', 'sh/cpuidle' and 'sh/stable-updates' 2009-07-05 00:33:40 +09:00
Magnus Damm 7426394f20 sh: cpuidle for SuperH Mobile using hwblk
This patch adds cpuidle support for SuperH Mobile.

The sleep mode selected by cpuidle is compared with
the mode selected by the hwblk sleep code and the
best allowed mode is entered.

At this point "Sleep mode" and "Sleep mode + SF" are
supported. This code can easily be extended to support
"Software suspend mode", but the assembly code must
first be updated to avoid loosing interrupts.

Also, update the code to only copy the assembly snippet
into internal memory once at bootup.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-05 00:29:54 +09:00
Magnus Damm a61c1a6366 sh: hwblk for sh7722
This patch contains the sh7722 specific hwblk implementation.

Hwblk ids are added to the processor specific header file,
module stop bits and areas are kept track of as hwblks,
clocks are converted to make use of the shared hwblk code.
Code to determine allowed sleep modes is also added.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-05 00:28:55 +09:00
Magnus Damm 79714acbab sh: hwblk base implementation
This patch is the hwblk base implementation, containing
structures and shared functions dealing with hardware blocks.

A each processor model should provide a list of hwblks and
describe which module stop bit that is associated with each
hwblck and how the hwblks are grouped together into areas.

The shared code keeps track of the usage count for each
hwblk and the areas. Fallback implementations for processor
specific code are also kept as weak symbols.

The clock framework, the runtime pm code and cpuidle will
all tie into this hwblk implementation.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-05 00:28:39 +09:00
Tejun Heo c43768cbb7 Merge branch 'master' into for-next
Pull linus#master to merge PER_CPU_DEF_ATTRIBUTES and alpha build fix
changes.  As alpha in percpu tree uses 'weak' attribute instead of
inline assembly, there's no need for __used attribute.

Conflicts:
	arch/alpha/include/asm/percpu.h
	arch/mn10300/kernel/vmlinux.lds.S
	include/linux/percpu-defs.h
2009-07-04 07:13:18 +09:00
Matt Fleming c601a51af1 sh: Use bootmem ontop of lmb
Rework the bootmem allocator to use the lmb framework.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-07-03 16:16:54 +09:00
Tejun Heo 405d967dc7 linker script: throw away .discard section
x86 throws away .discard section but no other archs do.  Also,
.discard is not thrown away while linking modules.  Make every arch
and module linking throw it away.  This will be used to define dummy
variables for percpu declarations and definitions.

This patch is based on Ivan Kokshaysky's alpha percpu patch.

[ Impact: always throw away everything in .discard ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Bryan Wu <cooloney@kernel.org>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@elte.hu>
2009-06-24 15:13:38 +09:00
Paul Mundt 2eb2a43682 sh: SH7786 SMP support.
SH7786 is roughly identical to SH-X3 proto SMP, though there are only 2
CPUs. This just wraps in to the existing SH-X3 SMP code with some minor
changes for SH7786, including wiring up the IPIs properly, enabling
IRQ_PER_CPU, and so forth.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-23 17:30:17 +09:00
Paul Mundt 2e046b9487 sh: Provide cpu_idle_wait() to fix up cpuidle/SMP build.
Crib the x86 cpu_idle_wait() implementation and shove it in with the
idle code, subsequently enabling ARCH_HAS_CPU_IDLE_WAIT.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-23 17:30:17 +09:00
Linus Torvalds 15fc204afc Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (56 commits)
  sh: Fix declaration of __kernel_sigreturn and __kernel_rt_sigreturn
  sh: Enable soc-camera in ap325rxa/migor/se7724 defconfigs.
  sh: remove stray markers.
  sh: defconfig updates.
  sh: pci: Initial PCI-Express support for SH7786 Urquell board.
  sh: Generic HAVE_PERF_COUNTER support.
  SH: convert migor to soc-camera as platform-device
  SH: convert ap325rxa to soc-camera as platform-device
  soc-camera: unify i2c camera device platform data
  sh: add platform data for r8a66597-hcd in setup-sh7723
  sh: add platform data for r8a66597-hcd in setup-sh7366
  sh: x3proto: add platform data for r8a66597-hcd
  sh: highlander: add platform data for r8a66597-hcd
  sh: sh7785lcr: add platform data for r8a66597-hcd
  sh: turn off irqs when disabling CMT/TMU timers
  sh: use kzalloc() for cpg clocks
  sh: unbreak WARN_ON()
  sh: Use generic atomic64_t implementation.
  sh: Revised clock function in highlander
  sh: Update r7780mp defconfig
  ...
2009-06-18 14:07:35 -07:00
Oleg Nesterov bba7fc0a21 ptrace: remove PT_DTRACE from avr32, mn10300, parisc, s390, sh, xtensa
avr32, mn10300, parisc, s390, sh, xtensa:

They never set PT_DTRACE, but clear it after do_execve().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Chris Zankel <chris@zankel.net>
Acked-by: Roland McGrath <roland@redhat.com>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-18 13:03:48 -07:00
Matt Fleming 9445571169 sh: Fix declaration of __kernel_sigreturn and __kernel_rt_sigreturn
GCC 4.5.0 complains about the declaration of variables
__kernel_sigreturn and __kernel_rt_sigreturn because they have type
void.  Correctly declare these symbols as functions to fix the
following error,

arch/sh/kernel/signal_32.c: In function 'setup_frame':
arch/sh/kernel/signal_32.c:368:14: error: taking address of expression of type 'void'
arch/sh/kernel/signal_32.c: In function 'setup_rt_frame':
arch/sh/kernel/signal_32.c:452:14: error: taking address of expression of type 'void'
make[1]: *** [arch/sh/kernel/signal_32.o] Error 1
make: *** [arch/sh/kernel] Error 2

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-18 18:25:21 +09:00
Christoph Hellwig 4505ffda54 sh: remove stray markers.
arch/sh has a couple of stray markers without any users introduced
in commit 3d58695edb.  Remove them in
preparation of removing the markers in favour of the TRACE_EVENT
macro (and also because we don't keep dead code around).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-18 13:38:26 +09:00
Paul Mundt 3d3638da49 Merge branches 'sh/pci-express-integration', 'sh/rsk-updates', 'sh/platform-updates' and 'sh/perf_counter' 2009-06-17 16:37:26 +09:00
Yoshihiro Shimoda f73c8f53cc sh: add platform data for r8a66597-hcd in setup-sh7723
and remove redundant parameter for r8a66597-hcd.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-17 16:21:48 +09:00
Yoshihiro Shimoda 6b64929c1e sh: add platform data for r8a66597-hcd in setup-sh7366
and remove redundant parameter for r8a66597-hcd.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-17 16:21:00 +09:00
Magnus Damm 4c7eb4ebc9 sh: use kzalloc() for cpg clocks
Convert the shared clock cpg code from bootmem to slab.
Without this patch the current bootmem code triggers
WARN_ON() because the slab is available.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-17 15:39:53 +09:00
Magnus Damm 0ec39885b2 sh: unbreak WARN_ON()
Fix WARN_ON() by modifying the bug trap handling code to
always return in the in-kernel instruction pointer case.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-17 15:39:52 +09:00
Alexey Dobriyan bb1f17b037 mm: consolidate init_mm definition
* create mm/init-mm.c, move init_mm there
* remove INIT_MM, initialize init_mm with C99 initializer
* unexport init_mm on all arches:

  init_mm is already unexported on x86.

  One strange place is some OMAP driver (drivers/video/omap/) which
  won't build modular, but it's already wants get_vm_area() export.
  Somebody should look there.

[akpm@linux-foundation.org: add missing #includes]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Americo Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-16 19:47:28 -07:00
Paul Mundt 3767f3f1ee sh: Convert sh64 to use the generic checksum code.
This plugs in GENERIC_CSUM support on sh64, and kills off all of the old
references.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-15 00:00:42 +09:00
Paul Mundt bff7b55bdb Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2009-06-14 21:22:15 +09:00
Paul Mundt 6fe32a4685 sh: Bump the earlytimer probe devices up.
Presently the earlytimer probe handles the clockevents driver, which
requires that the clockevents driver be registered first. This bumps it
up by 1 to include the clocksource device, which can be safely ignored
if it doesn't exist, as we will simply error out on that path and defer
to the jiffies clocksource.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-14 20:02:30 +09:00
Paul Mundt a34c7e3e7b sh: Use generic sched_clock().
The generic sched_clock() handles INITIAL_JIFFIES now as well, so we can
just use that instead.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-14 19:48:48 +09:00
Paul Mundt 1d29ebebcb sh: Bump the earlytimer bits back to time_init().
These were handled through late_time_init due to kmalloc() and friends
not being available earlier on previously. Now with slab caches being
available much earlier, this is no longer necessary, and we can move the
initialization up to an earlier point. One of the benefits with this is
that printk times are available a bit earlier!

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-14 19:45:40 +09:00
Rusty Russell e09377bae4 cpumask: Use accessors for cpu_*_mask: sh
Use the accessors rather than frobbing bits directly (the new versions
are const).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-14 18:24:16 +09:00
Rusty Russell 819807df6e cpumask: arch_send_call_function_ipi_mask: sh
We're weaning the core code off handing cpumask's around on-stack.
This introduces arch_send_call_function_ipi_mask(), and by defining
it, the old arch_send_call_function_ipi is defined by the core code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-14 18:24:14 +09:00
Rusty Russell 5933048c69 module: cleanup FIXME comments about trimming exception table entries.
Everyone cut and paste this comment from my original one.  We now do
it generically, so cut the comments.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Amerigo Wang <amwang@redhat.com>
2009-06-12 21:47:05 +09:30
Paul Mundt 19470e185a sh: Wire up sys_perf_counter_open.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-12 01:33:22 +03:00
Paul Mundt cf64c800f0 Merge branch 'sh/ftrace' of git://github.com/mfleming/linux-2.6 2009-06-12 01:12:44 +03:00
Matt Fleming 9e28c46b7d sh: Fix dynamic ftrace's NOP action.
Ftrace on sh handles nop'ing out trace function calls differently than
other architectures. Instead of inserting NOP instructions in place of
the call to the function tracer we branch over the call instructions
and continue executing the main body of the function.

This patch fixes a bug in the implementation of ftrace_modify_code()
where we check that the old value of the code we're about to replace
is an expected one. In the ftrace_make_call() code path
ftrace_modify_code() was comparing the old instruction value with NOP
instructions. The compare was failing because we never actually insert
NOP instructions. It makes sense to just get rid of the NOP
instructions in ftrace_nop and compare the old code with the address
of the function body if we're expecting ftrace to have nop'd out the
function trace call.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-06-11 19:00:58 +01:00
Matt Fleming 7780b6a299 sh: Update my email address
Use my current email address as my gentoo account will be closed at
some point.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
2009-06-11 09:26:43 +01:00
Paul Mundt 54ff328b46 sh: Tie sparseirq in to Kconfig.
Now that the dependent patches are merged, we are ready to enable
sparseirq support. This simply adds the Kconfig option, and then converts
from the _cpu to the _node allocation routines to follow the upstream
sparseirq API changes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 10:33:09 +03:00
Paul Mundt 6a1555fdde sh: Wire up sys_rt_tgsigqueueinfo.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:38:05 +03:00
Paul Mundt 75c936aec0 sh: Fix sys_pwritev() syscall table entry for sh32.
There was a typo here that had this as sys_writev() instead of
sys_pwritev(), fix this up. sh64 got this right, as did the preadv()
case.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:33:53 +03:00
Kuninori Morimoto f168dd00a9 sh: sh7724: Add JPU support
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Acked-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:17:17 +03:00
Kuninori Morimoto c5eeff1f8e sh: sh7724: INTC setting update
This patch follows Rev 0.50 manual

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:17:12 +03:00
Magnus Damm 46e9371c0e sh: sh7722 clock framework rewrite
This patch rewrites the sh7722 clock framework code.
The new code makes use of the recently merged div4,
div6 and mstp32 helper code. Both extal and dll are
supported as input clocks to the pll.

While at it, now when all SuperH Mobile processors
are converted, fix CONFIG_SH_CLK_CPG_LEGACY to depend
on CONFIG_ARCH_SHMOBILE.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:15:15 +03:00
Magnus Damm 4ed3739484 sh: sh7366 clock framework rewrite
This patch rewrites the sh7366 clock framework code.
The new code makes use of the recently merged div4,
div6 and mstp32 helper code. Both extal and dll are
supported as input clocks to the pll.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:15:07 +03:00
Magnus Damm bc49b6eaac sh: sh7343 clock framework rewrite
This patch rewrites the sh7343 clock framework code.
The new code makes use of the recently merged div4,
div6 and mstp32 helper code. Both extal and dll are
supported as input clocks to the pll.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:14:34 +03:00
Magnus Damm b621370a35 sh: sh7724 clock framework rewrite V3
This patch contains V3 of the sh7724 clock framework
rewrite. The new code makes use of the recently merged
div4, div6 and mstp32 helper code. Both extal and fll are
supported as input clocks to the pll. The div6 clocks are
fed through a divide-by-3 block.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:14:28 +03:00
Magnus Damm c521dc0203 sh: sh7723 clock framework rewrite V2
This patch contains V2 of the sh7723 clock framework
rewrite. The new code makes use of the recently merged
div4, div6 and mstp32 helper code. Both extal and dll
are supported as input clocks to the pll.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:13:36 +03:00
Magnus Damm 098dee99d1 sh: add enable()/disable()/set_rate() to div6 code
This patch updates the div6 clock helper code to add support
for enable(), disable() and set_rate() callbacks.

Needed by the camera clock enabling board code on Migo-R.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:12:58 +03:00
Magnus Damm 0d4fdbb64f sh: rework mode pin code
This patch reworks the mode pin code to keep the pin
definitions in one place. The mode pins values are now
the value of the bit instead of bit number.

With this patch in place the sh7785 header file contains
mode pin comments. The sh7785 clock code and the sh7785lcr
board code are updated to reflect the new shared mode pins.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:08:53 +03:00
Magnus Damm 2693e2740d sh: clock div6 helper code
This patch adds div6 clock helper code. The div6 clocks
are simply 6-bit divide-by-n modules where n is 1 to 64.

Needed for vclk on sh7722, sh7723, sh7343 and sh7366.
sh7724 needs this even more for vclk, fclka, fclkb,
irdaclk and spuclk.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:07:13 +03:00
Magnus Damm a50de78dc6 sh: clock div4 frequency table offset fix
This patch fixes the per clock offset calculation in
sh_clk_div4_register(). Without this patch the offset
to the frequency table for each clock is incorrect.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11 09:07:04 +03:00
Kuninori Morimoto 138f025267 sh: sh7723: L2 cache initialization.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-02 12:12:59 +09:00
Kuninori Morimoto b4bd9eb0d8 sh: sh7724: L2 cache initialization.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-02 12:12:57 +09:00
Kuninori Morimoto fab88d9fe9 sh: add weak l2_cache_init function.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-02 12:12:55 +09:00
Paul Mundt 0bf8513ed0 sh: Tidy up SH-4A boot_cpu_data.flags probing.
This tidies up the boot_cpu_data.flags probing on SH-4A. All of them have
a few things in common, which we can blindly set, rather than having each
subtype have to set the same flags. We can also make assumptions about
cache ways and the validity of PTEA, so this also kills off CPU_HAS_PTEA
as a config option. There was also a bug in the FPU probing, which is now
tidied up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 19:50:08 +09:00
Paul Mundt 7863d3f7ae sh: Tidy up the optional L2 probing, wire it up for SH7786.
This tidies up the L2 probing, as it may or may not be implemented on a
CPU, regardless of whether it is supported. This converts the cvr
validity checks from BUG_ON()'s to simply clearing the CPU_HAS_L2_CACHE
flag and moving on with life.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 19:38:41 +09:00
Magnus Damm 43909a9380 sh: hook up shared div4 clock code to sh7785
Hook up the shared 4-bit divisor clock code to sh7785.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 18:07:50 +09:00
Magnus Damm a1153e27ee sh: shared div4 clock code
Add shared code for 4-bit divisor clocks.

Processor specific code can use SH_CLK_DIV4()
to initialize div4 clocks, and then use
sh_clk_div4_register() for registration.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 18:07:37 +09:00
Magnus Damm e89d53e605 sh: hook up shared mstp32 clock code to sh7785
Hook up the shared 32-bit module stop bit code to sh7785.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 18:06:36 +09:00
Magnus Damm 6881e8bf3d sh: shared mstp32 clock code
Add shared 32-bit module stop bit clock support.

Processor specific code can use SH_CLK_MSTP32()
to initialize module stop bit clocks, and then
use sh_clk_mstp32() for registration.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 18:05:37 +09:00
Kuninori Morimoto 98fbe45bea sh: SH7724 has an L2 cache.
Add the CPU_HAS_L2_CACHE flag to SH7724.

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 15:59:03 +09:00
Magnus Damm 1823f6d5e6 sh: sh7785 pll configuration from mode pin
This patch modifies the sh7785 clock code to use the MODE4
value to switch between 72x and 36x PLL multiplication.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 15:57:12 +09:00
Magnus Damm eb9b9b56ee sh: boot word / mode pin support V2
Add mode pin support for the SuperH architecture V2.

With this patch applied the board code can add their
own function to export the cpu mode pin configuration.
In most cases this will be a constant bitmap, but
boards that allow reading this from a register can
instead read out the pin state from hardware.

The code warns if a pin is tested but no board specific
mode pin function has been provided.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-01 15:44:49 +09:00
Paul Mundt 464c9e1037 Merge branch 'sh/clkfwk' 2009-05-26 23:50:40 +09:00
Magnus Damm 61ce5393e4 sh: remove clk_ops->build_rate_table()
This patch removes the ->build_rate_table() callback,
->recalc() may instead be used for this purpose.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-26 17:08:45 +09:00
Magnus Damm df109e630f sh: use shared frequency tables on sh7785
This patch converts the sh7785 clock code to make use
of clk_rate_table_build() and clk_rate_table_round().
The ->build_rate_table() callback is removed, the
table building is instead handled in ->recalc().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-26 17:08:42 +09:00
Magnus Damm c94a85746f sh: add shared clock framework frequency table code
Add SuperH-specific clock framework helper functions:
- clk_rate_table_build() - build cpufreq table from divisors/multipliers
- clk_rate_table_round() - use cpufreq table to find matching frequency

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-26 17:08:39 +09:00
Magnus Damm c9904dd159 sh: add pll_clk to sh7785
This patch converts the sh7785 pll implementation from the
all-in-one code in frqmr_recalc() and frqmr_build_rate_table()
to a separate struct clk. This allows us to remove the processor
specific multiplier and use generic rate table functions.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-26 17:08:36 +09:00
Paul Mundt 3709ab8dfa sh: irq: Fix up imask build warnings.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-26 13:52:28 +09:00
Paul Mundt 36aa1e32f4 sh: clkfwk: Make clock-cpg usable for non-legacy platforms.
This adds a new SH_CLK_CPG for parts that have CPG support.
SH_CLK_CPG_LEGACY is made to depend on this, and still needs to be set
for platforms that want clock-cpg to register the legacy clocks. With
this new config item in place, it is now possible to start layering more
generic CPG code in place while other platforms transition off of the
legacy clocks.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-22 14:00:34 +09:00
Paul Mundt 2f3ed17e01 sh: Wrap irq_to_desc_alloc_cpu() around CONFIG_SPARSE_IRQ temporarily.
irq_to_desc_alloc_cpu() has been renamed to irq_to_desc_alloc_node() in
-next, but as we can not presently enable SPARSE_IRQ without the early
irq_desc alloc patch, protect it with an ifdef until the interface has
settled and we are ready to enable it system-wide.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-22 13:47:52 +09:00
Roel Kluin 7fc1e5c15f sh: clkfwk: beyond ARRAY_SIZE of onchip_ops for sh7722.
Do not go beyond ARRAY_SIZE of onchip_ops

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-22 12:58:02 +09:00
Magnus Damm 30cff215b5 sh: clkfwk branch compile fix for clock-sh7722
Fix clkfwk branch compile error in clock-sh7722.c.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-22 02:57:11 +09:00
Paul Mundt d8586ba6e1 sh: irq: Provide an arch_probe_nr_irqs() that wraps the machvec def.
This is just a simple arch_probe_nr_irqs() stub that wraps to the
platform defined number of IRQs. This can be made gradually more
intelligent based on what we can infer from the INTC tables and so on.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-22 01:36:13 +09:00
Paul Mundt 05ff3004d2 sh: irq: Teach ipr and intc about dynamically allocating irq_descs.
This hooks in irq_to_desc_alloc_cpu() to the necessary code paths in the
intc and ipr controller registration paths. As these are the primary call
paths for all SH CPUs, this alone will make all CPUs sparse IRQ ready.

There is the added benefit now that each CPU contains specific IPR and
INTC tables, so only the vectors with interrupt sources backing them will
ever see an irq_desc instantiation. This effectively packs irq_desc
down to match the CPU, rather than padding NR_IRQS out to cover the valid
vector range.

Boards with extra sources will still have to fiddle with the nr_irqs
setting, but they can continue doing so through the machvec as before.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-22 01:28:33 +09:00
Paul Mundt fa1d43ab45 sh: irq: Convert from irq_desc[] to irq_to_desc().
This converts a few places that were using the old irq_desc[] array over
to the shiny new irq_to_desc() helper. Preperatory work for sparse irq
support.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-22 01:26:16 +09:00
Paul Mundt 55620c86eb sh: irq: Rework the SR.IMASK bitmap handling.
This tidies up how the SR.IMASK bitmap is managed, using the bitmap API
directly instead. At the same time, tidy up the irq_chip conversion a
bit.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-22 01:16:17 +09:00
Magnus Damm 9304d0ccf1 sh: intc tables for sh7770
This patch adds INTC tables for sh7770, thanks
goes to Paul for the first prototype version.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-14 17:42:31 +09:00
Paul Mundt 549b5e358d sh: clkfwk: Add MSTP bits to SH7785 clock framework.
This plugs in all of the MSTP functions in to the clock framework,
and hands them off to the platform devices that want them.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-14 17:38:46 +09:00
Paul Mundt cedcf3366f sh: clkfwk: Map tree hierarchy in debugfs.
This adopts the OMAP clock framework debugfs bits and replaces the aging
procfs bits. The procfs clocks entry was primarily a debugging aid, and
used to be tied in to cpuinfo before the clock list grew too unweildly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13 21:51:28 +09:00
Paul Mundt cc96eace48 sh: clkfwk: rate table construction and rounding for SH7785.
This adds support for constructing a rate table by looking at potential
divisors for a specified clock. Each FQRMR clock is given its own table.
Presently each table is rebuilt when the parent propagates down a new
rate, so some more logic needs to be added to do this more intelligently.

Additionally, a fairly generic round_rate() implementation is then
layered on top of it, which subsequently provides us with cpufreq support.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13 20:28:15 +09:00
Paul Mundt a77b5ac0ea sh: clkfwk: Update SH7785 for refactored clock framework.
This updates the SH7785 CPU code as well as the SH7785LCR board support
code for making use of the newly refactored clock framework. Support for
the legacy CPG clocks is dropped at this point, with the extal frequency
fed in from the board code.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13 17:55:00 +09:00