Commit graph

29230 commits

Author SHA1 Message Date
Magnus Damm da9fdc8b44 sh: split coherent pages
Split pages returned by dma_alloc_coherent() and make sure
we free them one by one.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:48 +09:00
Paul Mundt 78fb40263f sh: dma: Kill off ISA DMA wrapper.
There are no more users for this code, and it has been deprecated for
some time, so just kill it off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:47 +09:00
Paul Mundt 5d2685d0b3 sh: Conditionalize the code dumper on CONFIG_DUMP_CODE.
We don't really want this enabled by default, but it is still quite
useful for debugging. So, make it conditional and leave it off by
default.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:47 +09:00
Paul Mundt fe58cac35f sh: Kill off the unused SH_ALPHANUMERIC debug option.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:47 +09:00
Paul Mundt 740a3e677b sh: Enable skipping of bss on debug platforms for sh32 also.
This enables the same functionality that sh64 has for sh32. When running
on simulated hardware or via remote memory via the debug interface,
memory is gauranteed to be zero on boot already, and skipping the zeroing
of BSS has measurable boot time benefits.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:47 +09:00
Paul Mundt 8a655053ca doc: Update sh cpufreq documentation.
The sh cpufreq driver is no longer limited to just the SH-3 and SH-4,
update the documentation to reflect this fact accordingly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:47 +09:00
Paul Mundt 0146d78759 sh: mrshpc_setup_windows() needs to be inline.
While no one should be including this file multiple times, flag it
inline anyways just in case.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:46 +09:00
Paul Mundt 073da9c0de sh: Kill off cf-enabler with extreme prejudice.
Now that the rest of the boards that were using cf-enabler "generically"
have switched to setting up their mappings on their own, only the mach-se
boards were left using it. All of the cf-enabler using mach-se boards
use a special initialization of the MRSHPC windows rather than going
through the special PTE as other SH-4 platforms do. This consolidates
the MRSHPC setup logic, hooks it up on the boards that care, and gets rid
of any and all remaining references to cf-enabler.

This has been long overdue, as cf-enabler has been the bane of
arch/sh/kernel for the last 7 years. Good riddance.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:46 +09:00
Paul Mundt 8c197c3afb sh: Add a simple edosk7705_defconfig for build testing.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:46 +09:00
Paul Mundt 866ef8f48f sh: mach-edosk7705: Fix up edosk7705 so it all builds again.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:45 +09:00
Paul Mundt 0ef0e6ca42 sh: mach-microdev: Split out the fdc37c93xapm initialization code.
This makes the microdev code a bit more readable, and moves the
setup for the SuperIO out on its own.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:45 +09:00
Paul Mundt 43eeb0fb9f sh: mach-sh03: Use __set_io_port_base(), kill off special ioport_map().
This also fixes up a long-standing bug for this platform where the PIO
base was set to a register offset, rather than the actual PIO offset
itself.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:45 +09:00
Paul Mundt 8db806ec80 sh: mach-sh03: Move off of cf_enabler to pata_platform, as per landisk.
This gets rid of the cf enabler use on mach-sh03 and switches to use
pata_platform with the proper address directly. cf_enabler is
subsequently disabled for mach-sh03.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:45 +09:00
Paul Mundt 98a955da85 sh: board-shmin: Convert shmin to use __set_io_port_base().
Drop the special mv_ioport_map() implementation, as this can simply use
__set_io_port_base() directly.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:45 +09:00
Paul Mundt 2125a46083 sh: Kill off dead mv_init_pci() from machvec.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:45 +09:00
Paul Mundt 43f8f9b95b sh: Simplify kernel_thread_helper() for sh32.
This can use the same implementation as sh64, the generated assembly is
the same between the new and old version, so there is not much point in
leaving it open coded in inline assembly.

This is preparatory work for future consolidation of the _32/_64
variants.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:44 +09:00
Paul Mundt 7b80fb32b3 sh: Kill off mv_heartbeat() from the machvec.
Nothing is using this any more, so get rid of it before anyone gets the
bright idea to start using it again.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:44 +09:00
Paul Mundt b94ea27570 sh: Kill off the cayman and microdev special heartbeat code.
These can use the generic code instead.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:44 +09:00
Paul Mundt ca0c14e447 sh: Kill off sh_bios_in_gdb_mode().
With the reworked kgdb support, we always detach and reinitialize the
stub. This was mostly a feature for handoffs between sh-ipl+g and the
kgdb stub, but virtually no sh-ipl+g versions ever had this working
right in the first place.

Given that the sh-ipl+g stubs in general use today don't even support
the GDB stub, and we have already killed off the special casing in the
sh-sci serial driver, kill off this now unused symbol too.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:44 +09:00
Paul Mundt a9df1ed92f sh: export sh_bios_get_node_addr() symbol for stnic module.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:44 +09:00
Paul Mundt 8e32018b04 sh: Run sh_bios through a long overdue Lindent.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:44 +09:00
Paul Mundt d9341b51f2 sh: oprofile: Convert op_model_sh7750 to new common interface.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:43 +09:00
Dave Peverley 40a8b421b6 sh: oprofile: Backtrace support.
This patch improves the oprofile support on sh and adds backtrace
support.

Signed-off-by: Dave Peverley <dpeverley@mpc-data.co.uk>
Signed-off-by: Chris Smith <chris.smith@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:43 +09:00
Paul Mundt 60a51fbe5d sh: oprofile: Refactor common setup code for multiple driver support.
This re-implements the old op_model_null code in to something more
generic, where multiple drivers, backtrace, etc. can all be interfaced.
Based largely on arch/mips/oprofile/common.c.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:43 +09:00
Matt Fleming 70fe224743 sh: Enable GENERIC_HARDIRQS_NO__DO_IRQ for all SuperH machines
After the recent changes to switch SuperH board support over to irq_chip
it is now possible to set GENERIC_HARDIRQS_NO__DO_IRQ for all SuperH
boards.

Signed-off-by: Matt Fleming <mjf@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:42 +09:00
Matt Fleming 1a94757fae sh: Convert Cayman boards from hw_interrupt_type to irq_chip
I've been unable to even compile-test this change because I don't have
an sh5 toolchain. All uses of hw_interrupt_type for SuperH boards have
now been converted to use irq_chip.

Signed-off-by: Matt Fleming <mjf@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:06 +09:00
Matt Fleming e85a47744b sh: Convert Dreamcast support from hw_interrupt_type to irq_chip
Switch the dreamcast IRQ code over to the irq_chip way of doing things,
so that we can set GENERIC_HARDIRQS_NO__DO_IRQ for all SuperH boards.

Also, whilst I'm here change some things to make checkpatch.pl happy:
	- Indent with tabs, not with spaces
	- Include <linux/io.h>, not <asm/io.h>
	- Fix the multi-line comment style
	- Fix some typos in the comments

Tested-by: Adrian McMenamin <adrian@newgolddream.dyndns.info>
Signed-off-by: Matt Fleming <mjf@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:06 +09:00
Matt Fleming bd0a22d21f sh: Convert SystemH board support from hw_interrupt_type to irq_chip
... as part of the hw_interrupt_type to irq_chip crusade.

Signed-off-by: Matt Fleming <mjf@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:05 +09:00
Matt Fleming be729fd890 sh: Convert Microdev boards from hw_interrupt_type to irq_chip
This is part of the SH move to irq_chip.

Signed-off-by: Matt Fleming <mjf@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:05 +09:00
Paul Mundt 180ae2037f sh: Provide sdivsi3/udivsi3/udivdi3 for sh64, kill off libgcc linking.
This moves in the necessary libgcc bits and kills off the libgcc linking
for sh64 kernels as well.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:05 +09:00
Paul Mundt 4466b20cfc sh: Add SH-5 optimized memcpy()/memset()/strcpy()/strlen().
Adopted from the uClibc optimized string versions.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:05 +09:00
Paul Mundt 776d6c298a sh: Kill off remaining CONFIG_SH_KGDB bits.
Now that we use the generic stub, kill off all of the left over
references.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:05 +09:00
Paul Mundt ab6e570ba3 sh: Generic kgdb stub support.
This migrates from the old bitrotted kgdb stub implementation and moves
to the generic stub. In the process support for SH-2/SH-2A is also added,
which the old stub never provided.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:04 +09:00
Paul Mundt d7b01f78a3 sh: Enable HAVE_ARCH_TRACEHOOK for all SH, now that SH-5 supports it too.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:04 +09:00
Paul Mundt dd76279b47 sh: Provide linux/regset.h interface for SH-5.
Plugs in general and FPU regsets.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:04 +09:00
Paul Mundt 94e2fb3d3e sh: Provide asm/syscall.h for SH-5.
This provides the asm/syscall.h implementation for sh64 parts.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:04 +09:00
Paul Mundt 6ac034375f sh: Handle cases where setup{_rt,}_frame() fail on SH-5 signal delivery.
Presently these cases are not handled properly due to the return value
not being passed back. This needs to be correct to get proper behaviour
out of things like the tracehook signal notifier, amongst others.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:04 +09:00
Paul Mundt f15b2dc02f sh: Fix up syscall_get_nr() comment in syscall_32.h.
Residual copy-and-paste damage, fix it up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:04 +09:00
Paul Mundt 35724a0aed sh: Fix up the cpu_asid() return value on nommu.
This ought to be unsigned long, rather than defaulting to int.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:03 +09:00
Paul Mundt a99d6fde69 sh: Convert sh64 /proc/asids to debugfs and generic sh.
This converts the sh64 /proc/asids entry to debugfs and enables it for
all SH parts that have debugfs enabled.

On MMU systems this can be used to determine which processes are using
which ASIDs which in turn can be used for finer grained cache tag
analysis.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:03 +09:00
Paul Mundt 4d1f3bbec4 sh: Kill off sh64's unused alloc/free_task_struct() definitions.
These were left over from some time ago, sh64 never got around to
defining __HAVE_ARCH_TASK_STRUCT_ALLOCATOR during the conversion, and it
has no need to. Kill these off and use the generic versions instead.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:03 +09:00
Paul Mundt 4eec8834f0 sh: mach-migor: Kill off unused Migo-R machvec.
This kills off the special Migo-R machvec, as nothing is using it. By
default this will switch to using the generic machvec, which provides the
same functionality. This saves us a bit of space in the machvec section.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:03 +09:00
Magnus Damm 4545bfa00a sh: add ov772x reset delay on Migo-R
Add reset delay for the ov772x device on Migo-R.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:03 +09:00
Paul Mundt a6bc25abc8 sh: Drop the special qemu defconfig.
QEMU can now use rts7751r2dplus_defconfig directly, there is no more need
for a neutered defconfig.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:03 +09:00
Aoi Shinkai bd40e81323 sh: Delete unnecessary mov in the interrupt exception entry point.
The INTEVT read at interrupt exception entry is uneccessary, as the read
is deferred until we are ready to enter do_IRQ(). The kgdb nmi path still
requires it, so move it there.

Signed-off-by: Aoi Shinkai <shinkoi2005@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:02 +09:00
Paul Mundt 06be372454 sh: Fix an off-by-1 check in __mutex_fastpath_unlock().
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:02 +09:00
Paul Mundt a47925ffd1 sh: Update rsk701_defconfig to reflect mach-rsk changes.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:02 +09:00
Paul Mundt ff15b90506 sh: Enable leds-gpio in rsk7203 defconfig.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:02 +09:00
Paul Mundt ea0aac1e13 sh: Consolidate rsk7203/7201 in to a new mach-rsk.
RSK+ platforms have quite a few characteristics in common, so roll them
together in to a shiny new RSK mach-type.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:02 +09:00
Paul Mundt b5cfeac990 sh: Provide ftrace_make_call()/ftrace_make_nop().
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:02 +09:00
Paul Mundt 4bc3e7192c sh: Disable -Werror for arch/sh/oprofile/.
drivers/oprofile/ objects have proven to be problematic in this regard,
so simply disable -Werror for now.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:44:02 +09:00
Takashi YOSHII 3b041227f7 sh: Add plain udivsi3 (not _i4*) for gcc-4.1 and lower.
We chan't share code for udivsi3 and udivsi3_i4, because they
have a different clobber list. Copy udivsi3 from gcc-4.1.2.

As shown in arch/sh/lib/udivsi3.S (and -Os.S),

  .global __udivsi3_i4i
  .global __udivsi3_i4
  .global __udivsi3
__udivsi3_i4i:
  ...

Three symbols are sharing one code, which is actually udivsi3_i4i.
But, this results unwanted code with gcc 4.1.

In gcc, these three are treated as pseudo instructions that have
their own clobber list apart from the usual calling convention.

According to sh's machine description. The clobber list is as
follows:

 - udivsi3_i4i : t,r1,pr,mach,macl
 - udivsi3_i4  : t,r0,r1,r4,r5,pr,dr0,dr2,dr4
 - udivsi3     : t,r4,pr

The caller of udivsi3 will be left with a broken r1 and mac*.

gcc-4.1.x and older(at least to 3.4) generate udivsi3.
ST's gcc-4.1.1 seems to be OK because it has _i4i.

Signed-off-by: Takashi YOSHII <yoshii.takashi@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:53 +09:00
Nick Andrew 1fdae0e59a Fix incorrect use of loose in c-checksum.c
Fix incorrect use of loose in c-checksum.c

It should be 'lose', not 'loose'.

Signed-off-by: Nick Andrew <nick@nick-andrew.net>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:52 +09:00
Paul Mundt 77ba93a7ac sh: Fix up the SH-4A mutex fastpath semantics.
This fixes up the __mutex_fastpath_xxx() routines to match the semantics
noted in the comment. Previously these were looping rather than doing a
single-pass, which is counter-intuitive, as the slow path takes care of
the looping for us in the event of contention.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:52 +09:00
Magnus Damm c6f17cb227 sh: allow CONFIG_CPU_IDLE
Allow users to select CONFIG_CPU_IDLE regardless of processor type or board.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:52 +09:00
Magnus Damm af998a9a0a sh: allow CONFIG_PM
Allow users to select CONFIG_PM regardless of processor type or board.
Suspend and hibernation are only allowed on supported platforms.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:52 +09:00
Magnus Damm 3e51762759 sh: move the hp6xx pm code
Move the not-so-generic pm code from arch/sh/kernel/pm.c to the
platform directory together with the rest of the hp6xx pm code.

This is done to let non-hp6xx platforms enable CONFIG_PM.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:52 +09:00
Magnus Damm 04645185d0 sh: update se7343 defconfig
Update the se7343 defconfig with:
 - use 33MHz PCLK
 - increase max number of SCIFs
 - add serial console configuration to compiled-in kernel command line
 - add 8250 serial port support
 - add sh-mobile-i2c driver
 - add uio driver to export VEU and VPU
 - add usb support and isp1161 host controller
 - add dm9601 ethernet-over-usb support
 - remove smc91x support

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:52 +09:00
Magnus Damm 21c601bb2e sh: remove ioport cruft and smc91x from se7343
Remove out-of-date se7343 ioport code including some old support
for unknown-ne2000-pcmcia-card, cf-over-pcmcia and a mysterical
smc91x that once must have been on a special daughterboard.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:51 +09:00
Magnus Damm 5e5aacb0de sh: add isp1161 usb host device to se7343
Add isp1161 platform data to get usb host working on se7343.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:51 +09:00
Magnus Damm 6aacba72db sh: add st16c2550 devices to se7343
Add 8250 platform data to setup the ST16C2550C chip on se7343.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:51 +09:00
Magnus Damm 5727003b5d sh: fix number of interrupts on se7343
Fix to make sure that the on-board interrupt sources are included
in the interrupt count on se7343.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:51 +09:00
Magnus Damm 551ea2b40e sh: sh7343 scif configuration update
Fix interrupt values for the first sh7343 SCIF port and
update the configuration to include the remaining 3 ones.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:51 +09:00
Magnus Damm 0c0daec7ca sh: propagate r_clk
Make sure the 32 KHz r_clk rate gets propagated correctly. Without
this fix the clocks for RTC, CMT, KEYSC and RWDT are stuck at 0 Hz.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:51 +09:00
Peter Griffin 6feb348783 sh: RSK+ 7201 board support.
This patch adds support for the RTE RSK+ 7201 board.

Signed-off-by: Peter Griffin <pgriffin@mpc-data.co.uk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:51 +09:00
Peter Griffin 2825999e8a sh: Add support for SH7201 CPU subtype.
This patch adds support for the SH-2A FPU based SH7201 processor subtype.

Signed-off-by: Peter Griffin <pgriffin@mpc-data.co.uk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:50 +09:00
Matt Fleming 135210b378 sh: Switch HD64461 from hw_interrupt_type to irq_chip
Use struct irq_chip for the interrupt handler for the HD64461. Also
convert some in{b,w} and out{b,w} calls to the equivalent __raw_* calls.
Include <linux/io.h> and not <asm/io.h> to stop checkpatch.pl
complaining.

This change should now allow machines with HD64461 to define
GENERIC_HARDIRQS_NO__DO_IRQ.

Acked-by: Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
Signed-off-by: Matt Fleming <mjf@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:50 +09:00
Yoshihiro Shimoda 331ff103c7 sh: pci-sh7780: fix pci memory address mask
Fix the problem that cannot work a PCI device when system memory size is
256Mbyte in 29bit address mode.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:50 +09:00
Paul Mundt 22f131aa8d sh: Provide a dyn_arch_ftrace struct definition.
Needed for dynamic ftrace API changes.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:50 +09:00
Paul Mundt 1da1180c6e sh: Split out the idle loop for reuse between _32/_64 variants.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:50 +09:00
Paul Mundt eb67cf14ae sh: Consolidate cpu_relax()/cpu_sleep() definitions across _32/_64.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:50 +09:00
Paul Mundt f74c034d52 sh: do not latency trace idle.
Description snipped from Steven Rostedt's PPC patch:

    When idle is called, interrupts are blocked, but the idle
    function will still wake up on an interrupt. The problem is
    that the interrupt disabled latency tracer will take this call
    to idle as a latency.

    This patch disables the latency tracing when going into idle.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:49 +09:00
Paul Mundt 75fd24c107 sh: Tidy up backtrace formatting with kallsyms disabled.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:49 +09:00
Paul Mundt 9cfc9a9b6f sh: Add a simple code dumper for SUPERH32 show_regs().
This implements a simple show_code() that is in turn plugged in to
show_regs() to provide minimal code dumping at the end of the trace.

Built on top of a simple instruction disassembler derived from the
binutils opcode table.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:49 +09:00
Paul Mundt edfd6da040 sh: Add a few more branch types to the branch emulator.
This plugs in some extra encodings for matching more bsr/bsrf/jsr
branches.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:49 +09:00
Paul Mundt 5dd614761f sh: Re-add support for best fit ISA tuning if none is available.
This was removed in the libgcc integration, but there are still some
compilers that need this. We also relax the rules on the ISA tuning in
the cases where there are no matches for the CPU tuning and adopt the
-any default, which matches the intent of the isa-y target list. This
compensates for mismatches where binutils supports a wide array of
targets whilst the compiler is much more restricted.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:49 +09:00
Paul Mundt 624c6a6750 sh: More movmem alias symbol exports for older compilers.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:49 +09:00
Paul Mundt 95b781c239 sh: Provide optimized unaligned loads on SH-4A.
This adds support for unaligned loads on SH-4A, using the SH-4A's
neutered movua.l instruction. As movua.l is r0-inspired, stores are
still handled through the packed struct.

Based on asm-generic/unaligned.h by Harvey Harrison.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:48 +09:00
Magnus Damm 716777db72 sh: P4 ioremap pass-through
This patch adds a pass-through case when ioremapping P4 addresses.

Addresses passed to ioremap() should be physical addresses, so the
best option is usually to convert the virtual address to a physical
address before calling ioremap. This will give you a virtual address
in P2 which matches the physical address and this works well for
most internal hardware blocks on the SuperH architecture.

However, some hardware blocks must be accessed through P4. Converting
the P4 address to a physical and then back to a P2 does not work. One
example of this is the sh7722 TMU block, it must be accessed through P4.

Without this patch P4 addresses will be mapped using PTEs which
requires the page allocator to be up and running.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:43:48 +09:00
Michael Trimarchi 0c9122323a sh: Add SH-4A optimized fastpath mutex implementation.
Add fast mutex path implementation for the SH4A architecture

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:55 +09:00
Steve Glendinning f617682e9c sh: add SH DMAC burst mode constant
The SH7709 datasheet defines bit 5 as set for burst mode, clear for
cycle-steal mode.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:54 +09:00
Steve Glendinning c2c5883b3f sh: fix DMAOR register access on SH7709
sh7709 hardware manual says DMAOR is 16 bits long on this platform.

Tested and working with a modified smsc911x ethernet driver (sh-dma
support patch for this driver is coming soon).

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:54 +09:00
Steve Glendinning 8085ac7531 sh: Add platform-specific constants for SH7709
I'm using these constants in support of an in-house development board,
and thought they may be useful to other users of SH7709.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:54 +09:00
Paul Mundt 0d5bbe0bc2 sh: Provide optimized non-atomic bitops for SH-2A.
This ties in the new SH-2A 32-bit non-atomic bitops.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:54 +09:00
Paul Mundt 8bcc5c1c33 sh: Add -m4al tuning for SH4AL-DSP.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:54 +09:00
Paul Mundt 9ef100287a sh: Add exports for __udivsi3/__sdivsi3 and the _i4 versions.
Needed by older compilers.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:54 +09:00
Paul Mundt 16b529d1d7 sh: Convert to generic bitops for IRQ-toggling implementation.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:53 +09:00
Paul Mundt 709420dd4e sh: Specify sane default image targets for the SH-2 platforms.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:53 +09:00
Paul Mundt 1aad54a99b sh: Migrate necessary libgcc bits in to arch/sh/lib for SUPERH32.
This moves in the necessary libgcc bits for SUPERH32 and drops the
libgcc linking for the regular targets. This in turn allows us to rip
out quite a few hacks both in sh_ksyms_32 and arch/sh/Makefile.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:53 +09:00
Paul Mundt e9bf51e5cc sh: __udivdi3 -> do_div() in softfloat lib.
Inhibit the generation of __udivdi3 for the softfloat lib, use do_div()
outright.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:53 +09:00
Paul Mundt 00e825c6b9 sh: Fix clock framework compiler warnings.
CC      arch/sh/kernel/cpu/clock.o
  arch/sh/kernel/cpu/clock.c: In function 'clk_disable':
  arch/sh/kernel/cpu/clock.c:156: warning: 'return' with a value, in function returning void

Introduced by ("sh: enable and disable clocks recursively").

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:53 +09:00
Matt Fleming fad57feba7 sh: dynamic ftrace support.
First cut at dynamic ftrace support.

Signed-off-by: Matt Fleming <mjf@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:52 +09:00
Magnus Damm ef6aff6884 sh: remove old sh_mobile mstpc clocks
Remove the old sh_mobile mstpcr clocks.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:52 +09:00
Magnus Damm b51339fff2 sh: sh_mobile lcdc clock framework support
Add clock framework support to the lcdc driver and
adjust the board specific code accordingly.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:52 +09:00
Magnus Damm 765786e0ae sh: sh_mobile usb clock framework support
Add clock framework support to the usb/r8a66597 driver and
adjust the cpu specific code accordingly.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:51 +09:00
Magnus Damm af5be79a7f sh: sh_mobile usbf clock framework support
Add clock framework support to the usbf/m66592 driver and
adjust the cpu specific code accordingly.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:51 +09:00
Magnus Damm a42b6dd69c sh: sh_mobile ceu clock framework support
Add clock framework support to the sh_mobile ceu and
adjust the board specific code accordingly.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:51 +09:00
Magnus Damm 090d951b69 sh: sh_mobile keysc clock framework support
Add clock framework support to the sh_mobile keysc driver and
adjust the board specific code accordingly.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:51 +09:00
Magnus Damm a5616bd0f1 sh: sh_mobile i2c clock framework support
Add clock framework support to the sh_mobile i2c driver and
adjust the processor specific code accordingly.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:51 +09:00
Magnus Damm f2eb0109fb sh: sh_mobile mstpcr clocks for sh7366
Add sh7366 mstpcr bits and information about their parent clocks.
The datasheet is pretty clear about the clocks on this device.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:51 +09:00
Magnus Damm 6e88d030a1 sh: sh_mobile mstpcr clocks for sh7343
Add sh7343 mstpcr bits and information about their parent clocks.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:50 +09:00
Magnus Damm f14c017d6b sh: sh_mobile mstpcr clocks for sh7723
Add sh7723 mstpcr bits and information about their parent clocks.
The datasheet is pretty clear about the clocks on this device.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:50 +09:00
Magnus Damm ecf399bdaf sh: sh_mobile mstpcr clocks for sh7722
Add sh7722 mstpcr bits and information about their parent clocks.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:50 +09:00
Magnus Damm 7c7e02a28b sh: new sh_mobile mstpcr clocks base code
Add base code to handle new mstpcr clocks. Make sure clock rates propagate.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:50 +09:00
Magnus Damm 1dc7b776d9 sh: use arch_flags for sh_mobile mstpcr clock bits
Use arch_flags to keep track of register and flag number.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:50 +09:00
Magnus Damm d902d04f54 sh: sh_mobile clock divider index fix
Use divider index value instead of divider value.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:50 +09:00
Magnus Damm d12cfac146 sh: enable and disable clocks recursively
Recurse and make sure parent clocks get enabled/disabled.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:50 +09:00
Paul Mundt 4a4a9be3eb sh: Move arch_get_unmapped_area() in to arch/sh/mm/mmap.c.
Now that arch/sh/mm/mmap.c exists, move arch_get_unmapped_area() there.
Follows the ARM change.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:49 +09:00
David Daney ed2b03ed3c MIPS: MIPS64R2: Fix buggy __arch_swab64
The way the code is written it was assuming dshd has the function of a
hypothetical dshw instruction ...

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2008-12-22 08:54:47 +00:00
David Daney 08d9d1c4d4 MIPS: Fix preprocessor warnings flaged by GCC 4.4
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2008-12-22 08:54:47 +00:00
Krzysztof Hałasa e6da96ace8 IXP4xx: move common debugging from network drivers to QMGR module.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
2008-12-22 00:48:00 +01:00
Krzysztof Hałasa ae2754a975 IXP4xx: clear IRQ stat in qmgr_disable_irq().
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
2008-12-22 00:41:50 +01:00
Krzysztof Hałasa 3edcfb2937 IXP4xx: check for queue being empty in qmgr_release_queue().
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
2008-12-22 00:41:49 +01:00
Wolfram Sang aec739e010 powerpc/mpc5200: add rts/cts handling in PSC UART driver
Add RTS/CTS-support for the PSC of the MPC5200B. Tested with a Phytec
MPC5200B-IO.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2008-12-21 02:54:32 -07:00
Tim Yamin 6b61e69e7b powerpc/mpc5200: Add MDMA/UDMA support to MPC5200 ATA driver
This patch adds MDMA/UDMA support using BestComm for DMA on the MPC5200
platform.  Based heavily on previous work by Freescale (Bernard Kuhn,
John Rigby) and Domen Puncer.

With this patch, a SanDisk Extreme IV CF card gets read speeds of
approximately 26.70 MB/sec.

Signed-off-by: Tim Yamin <plasm@roo.me.uk>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2008-12-21 02:54:29 -07:00
Grant Likely aaab5e83c2 powerpc/mpc5200: Disable bestcomm prefetching when ATA DMA enabled
When ATA DMA is enabled, bestcomm prefetching does not work.  This
patch adds a function to disable bestcomm prefetch when the ATA
Bestcomm task is initialized.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2008-12-21 02:54:28 -07:00
Tim Yamin e4efe3c271 powerpc/mpc5200: Bestcomm fixes to ATA support
1) ata.h has dst_pa in the wrong place (needs to match what the BestComm
   task microcode in bcom_ata_task.c expects); fix it.

2) The BestComm ATA task priority was changed to maximum in bestcomm_priv.h;
   this fixes a deadlock issue experienced with heavy DMA occurring on
   both the ATA and Ethernet BestComm tasks, e.g. when downloading a large
   file over a LAN to disk.

Signed-off-by: Tim Yamin <plasm@roo.me.uk>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2008-12-21 02:54:28 -07:00
Grant Likely 622882455a powerpc/mpc5200: Bugfix on handling variable sized buffer descriptors
The buffer descriptors for the ATA BestComm task are larger than the
current definition for bcom_bd.  This causes problems because the
various bcom_... functions dereference the buffer descriptor pointer
by using the array operator which doesn't work when the buffer
descriptors are a different size.

This patch adds the bcom_get_bd() function which uses the value in
bcom_task.bd_size to calculate the offset into the BD table.  This
patch also changes the definition of bcom_bd to specify a data size
of 0 instead of 1 so that it will never work if anyone attempts to
dereference the bd list as an array (as opposed to something that
might work even though it is wrong).

Finally, this patch moves the definition of bcom_bd up in the file
to eliminate a forward declaration.

Based on patch originally written by Tim Yamin.

Signed-off-by: Tim Yamin <plasm@roo.me.uk>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2008-12-21 02:54:27 -07:00
Grant Likely dd952cbb3d powerpc/mpc5200: Make internal 5200 PIC the default interrupt controller
The MPC5200 internal interrupt controller setup function needs to set
the default interrupt controller when it is called.  Without this
irq_create_of_mapping() cannot be called without first determining
the pointer to the irq controller (ie. call with controller = NULL).

Reported-by: Steven Cavanagh <scavanagh@secretlab.ca>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2008-12-21 02:54:27 -07:00
Grant Likely bcb73f5611 powerpc/mpc5200: Document and tidy irq driver
This patch adds documentation to the mpc5200 interrupt controller
driver and cleans up some minor coding conventions.  It also moves the
contents of mpc52xx_pic.h into the driver proper (except for a small
common bit that is moved to the common mpc52xx.h) because the
information encoded there is not required by any other part of kernel
code.  Finally for code readability sake, the L2_OFFSET shift value
is removed because the code using it resolves to a noop.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2008-12-21 02:54:26 -07:00
Benjamin Herrenschmidt a14953597b powerpc: Fix missing 'blr' in _tlbia()
Rework to MMU code dropped a much missed 'blr' instruction.

Brown-Paper-Bag-Worn-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2008-12-21 02:54:25 -07:00
Scott Wood 49e6e3f1ae powerpc/bootwrapper: Use the child-bus #address-cells to decide which range entry to use
The correct #address-cells was still used for the actual translation,
so the impact is only a possibility of choosing the wrong range entry
or failing to find any match.  Most common cases were not affected.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:17 +11:00
Grant Erickson e14d77490d powerpc: Const-qualify Device Node Argument to DCR Resource Extent API
Add const qualifier to device_node argument for
dcr_resource_{start,len} as of_get_property also const-qualifies this
argument.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:16 +11:00
Benjamin Herrenschmidt 9dce3ce5c5 powerpc/44x: 44x TLB doesn't need "Guarded" set for all pages
After discussing with chip designers, it appears that it's not
necessary to set G everywhere on 440 cores. The various core
errata related to prefetch should be sorted out by firmware by
disabling icache prefetching in CCR0. We add the workaround to
the kernel however just in case oooold firmwares don't do it.

This is valid for -all- 4xx core variants. Later ones hard wire
the absence of prefetch but it doesn't harm to clear the bits
in CCR0 (they should already be cleared anyway).

We still leave G=1 on the linear mapping for now, we need to
stop over-mapping RAM to be able to remove it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:16 +11:00
Benjamin Herrenschmidt 64b3d0e812 powerpc/mm: Rework usage of _PAGE_COHERENT/NO_CACHE/GUARDED
Currently, we never set _PAGE_COHERENT in the PTEs, we just OR it in
in the hash code based on some CPU feature bit.  We also manipulate
_PAGE_NO_CACHE and _PAGE_GUARDED by hand in all sorts of places.

This changes the logic so that instead, the PTE now contains
_PAGE_COHERENT for all normal RAM pages thay have I = 0 on platforms
that need it.  The hash code clears it if the feature bit is not set.

It also adds some clean accessors to setup various valid combinations
of access flags and change various bits of code to use them instead.

This should help having the PTE actually containing the bit
combinations that we really want.

I also removed _PAGE_GUARDED from _PAGE_BASE on 44x and instead
set it explicitely from the TLB miss.  I will ultimately remove it
completely as it appears that it might not be needed after all
but in the meantime, having it in the TLB miss makes things a
lot easier.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:16 +11:00
Benjamin Herrenschmidt 7752035180 powerpc/mm: Runtime allocation of mmu context maps for nohash CPUs
This makes the MMU context code used for CPUs with no hash table
(except 603) dynamically allocate the various maps used to track
the state of contexts.

Only the main free map and CPU 0 stale map are allocated at boot
time.  Other CPU maps are allocated when those CPUs are brought up
and freed if they are unplugged.

This also moves the initialization of the MMU context management
slightly later during the boot process, which should be fine as
it's really only needed when userland if first started anyways.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:16 +11:00
Benjamin Herrenschmidt 760ec0e02d powerpc/44x: No need to mask MSR:CE, ME or DE in _tlbil_va on 440
The handlers for Critical, Machine Check or Debug interrupts
will save and restore MMUCR nowadays, thus we only need to
disable normal interrupts when invalidating TLB entries.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:16 +11:00
Benjamin Herrenschmidt 2a4aca1144 powerpc/mm: Split low level tlb invalidate for nohash processors
Currently, the various forms of low level TLB invalidations are all
implemented in misc_32.S for 32-bit processors, in a fairly scary
mess of #ifdef's and with interesting duplication such as a whole
bunch of code for FSL _tlbie and _tlbia which are no longer used.

This moves things around such that _tlbie is now defined in
hash_low_32.S and is only used by the 32-bit hash code, and all
nohash CPUs use the various _tlbil_* forms that are now moved to
a new file, tlb_nohash_low.S.

I moved all the definitions for that stuff out of
include/asm/tlbflush.h as they are really internal mm stuff, into
mm/mmu_decl.h

The code should have no functional changes.  I kept some variants
inline for trivial forms on things like 40x and 8xx.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:16 +11:00
Benjamin Herrenschmidt f048aace29 powerpc/mm: Add SMP support to no-hash TLB handling
This commit moves the whole no-hash TLB handling out of line into a
new tlb_nohash.c file, and implements some basic SMP support using
IPIs and/or broadcast tlbivax instructions.

Note that I'm using local invalidations for D->I cache coherency.

At worst, if another processor is trying to execute the same and
has the old entry in its TLB, it will just take a fault and re-do
the TLB flush locally (it won't re-do the cache flush in any case).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:16 +11:00
Benjamin Herrenschmidt 7c03d653cd powerpc/mm: Introduce MMU features
We're soon running out of CPU features and I need to add some new
ones for various MMU related bits, so this patch separates the MMU
features from the CPU features.  I moved over the 32-bit MMU related
ones, added base features for MMU type families, but didn't move
over any 64-bit only feature yet.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:16 +11:00
Benjamin Herrenschmidt 2ca8cf7389 powerpc/mm: Rework context management for CPUs with no hash table
This reworks the context management code used by 4xx,8xx and
freescale BookE.  It adds support for SMP by implementing a
concept of stale context map to lazily flush the TLB on
processors where a context may have been invalidated.  This
also contains the ground work for generalizing such lazy TLB
flushing by just picking up a new PID and marking the old one
stale.  This will be implemented later.

This is a first implementation that uses a global spinlock.

Ideally, we should try to get at least the fast path (context ID
already assigned) lockless or limited to a per context lock,
but for now this will do.

I tried to keep the UP case reasonably simple to avoid adding
too much overhead to 8xx which does a lot of context stealing
since it effectively has only 16 PIDs available.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:15 +11:00
Benjamin Herrenschmidt 5e696617c4 powerpc/mm: Split mmu_context handling
This splits the mmu_context handling between 32-bit hash based
processors, 64-bit hash based processors and everybody else.  This is
preliminary work for adding SMP support for BookE processors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:15 +11:00
Benjamin Herrenschmidt 6d2170be45 powerpc/4xx: Extended DCR support v2
This adds supports to the "extended" DCR addressing via the indirect
mfdcrx/mtdcrx instructions supported by some 4xx cores (440H6 and
later).

I enabled the feature for now only on AMCC 460 chips.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:15 +11:00
Brian King fecba96268 powerpc: Add reboot notifier to Collaborative Memory Manager
When running Active Memory Sharing, pages can get marked as
"loaned" with the hypervisor by the CMM driver. This state gets
cleared by the system firmware when rebooting the partition.
When using kexec to boot a new kernel, this state never gets
cleared and the hypervisor and CMM driver can get out of sync
with respect to the number of pages currently marked "loaned".
Fix this by adding a reboot notifier to the CMM driver to deflate
the balloon and mark all pages as active.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:15 +11:00
Brian King 2218108e18 powerpc: Disable Collaborative Memory Manager for kdump
When running Active Memory Sharing, the Collaborative Memory Manager
(CMM) may mark some pages as "loaned" with the hypervisor.
Periodically, the CMM will query the hypervisor for a loan request,
which is a single signed value.  When kexec'ing into a kdump kernel,
the CMM driver in the kdump kernel is not aware of the pages the
previous kernel had marked as "loaned", so the hypervisor and the CMM
driver are out of sync.  This results in the CMM driver getting a
negative loan request, which can then get treated as a large unsigned
value and can cause kdump to hang due to the CMM driver inflating too
large.  Since there really is no clean way for the CMM driver in the
kdump kernel to clean this up, simply disable CMM in the kdump kernel.
This fixes hangs we were seeing doing kdump with AMS.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:15 +11:00
Stephen Rothwell 5d84e4bee0 powerpc/iseries: viodasd needs to depend on CONFIG_BLOCK
Otherwise you get lot of errors like these:

drivers/block/viodasd.c:72: error: dereferencing pointer to incomplete type
drivers/block/viodasd.c: In function 'viodasd_open':
drivers/block/viodasd.c:135: error: dereferencing pointer to incomplete type
drivers/block/viodasd.c: In function 'viodasd_release':
drivers/block/viodasd.c:184: error: dereferencing pointer to incomplete type
drivers/block/viodasd.c: In function 'viodasd_getgeo':
drivers/block/viodasd.c:209: error: dereferencing pointer to incomplete type
drivers/block/viodasd.c:214: error: implicit declaration of function 'get_capacity'
drivers/block/viodasd.c: At top level:
drivers/block/viodasd.c:222: error: variable 'viodasd_fops' has initializer but incomplete type
drivers/block/viodasd.c:223: error: unknown field 'owner' specified in initializer

Discovered by a randconfig build.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:15 +11:00
Tony Breeds 532774ec7f powerpc: Pass a valid token to rtas_call() in phyp-dump code
ibm_configure_kernel_dump is passed as the token to rtas_call() is
never initialised.  This sets it to something sane.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Acked-by: Nathan Lynch <ntl@pobox.com>
Acked-by: Manish Ahuja <mahujam@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:15 +11:00
Tony Breeds 7a2eab0d4e powerpc: Protect against NULL pointer deref in phyp-dump code
print_dump_header() will be called at least once with a NULL pointer in
a normal boot sequence.  If DEBUG is defined then we will dereference
the pointer and crash.  Add a quick fix to exit early in the NULL pointer
case.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Acked-by: Manish Ahuja <mahujam@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:14 +11:00
David Howells 8168b5400b powerpc: Rename struct vm_region to avoid conflict with NOMMU
Rename PowerPC's struct vm_region so that I can introduce my own
global version for NOMMU.  It's feasible that the PowerPC version may
wish to use my global one instead.

The NOMMU vm_region struct defines areas of the physical memory map
that are under mmap.  This may include chunks of RAM or regions of
memory mapped devices, such as flash.  It is also used to retain
copies of file content so that shareable private memory mappings of
files can be made.  As such, it may be compatible with what is
described in the banner comment for PowerPC's vm_region struct.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:14 +11:00
Nathan Lynch 13ba3c0092 powerpc: Convert sysfs cache code to of_find_next_cache_node()
Using the common code means that more complete cache information will
provided in sysfs on platforms that don't use the l2-cache property
convention.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:14 +11:00
Nathan Lynch b2ea25b958 powerpc: Convert cpu_to_l2cache() to of_find_next_cache_node()
The smp code uses cache information to populate cpu_core_map; change
it to use common code for cache lookup.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:14 +11:00
Nathan Lynch e523f723d6 powerpc: Add of_find_next_cache_node()
We have more than one piece of code that looks up cache nodes manually
using the "l2-cache" property.  Add a common helper routine which does
this and handles ePAPR's "next-level-cache" property as well as
powermac.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-21 14:21:14 +11:00
Linus Torvalds e6a997eda9 Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: fix resume (S2R) broken by Intel microcode module, on A110L
  x86 gart: don't complain if no AMD GART found
  AMD IOMMU: panic if completion wait loop fails
  AMD IOMMU: set cmd buffer pointers to zero manually
  x86: re-enable MCE on secondary CPUS after suspend/resume
  AMD IOMMU: allocate rlookup_table with __GFP_ZERO
2008-12-20 11:07:18 -08:00
Dmitry Adamushko 280a9ca5d0 x86: fix resume (S2R) broken by Intel microcode module, on A110L
Impact: fix deadlock

This is in response to the following bug report:

Bug-Entry       : http://bugzilla.kernel.org/show_bug.cgi?id=12100
Subject         : resume (S2R) broken by Intel microcode module, on A110L
Submitter       : Andreas Mohr <andi@lisas.de>
Date            : 2008-11-25 08:48 (19 days old)
Handled-By      : Dmitry Adamushko <dmitry.adamushko@gmail.com>

[ The deadlock scenario has been discovered by Andreas Mohr ]

I think I might have a logical explanation why the system:

  (http://bugzilla.kernel.org/show_bug.cgi?id=12100)

might hang upon resuming, OTOH it should have likely hanged each and every time.

(1) possible deadlock in microcode_resume_cpu() if either 'if' section is
taken;

(2) now, I don't see it in spec. and can't experimentally verify it (newer
ucodes don't seem to be available for my Core2duo)... but logically-wise, I'd
think that when read upon resuming, the 'microcode revision' (MSR 0x8B) should
be back to its original one (we need to reload ucode anyway so it doesn't seem
logical if a cpu doesn't drop the version)... if so, the comparison with
memcmp() for the full 'struct cpu_signature' is wrong... and that's how one of
the aforementioned 'if' sections might have been triggered - leading to a
deadlock.

Obviously, in my tests I simulated loading/resuming with the ucode of the same
version (just to see that the file is loaded/re-loaded upon resuming) so this
issue has never popped up.

I'd appreciate if someone with an appropriate system might give a try to the
2nd patch (titled "fix a comparison && deadlock...").

In any case, the deadlock situation is a must-have fix.

Reported-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Tested-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>

Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-12-20 14:29:20 +01:00
Markus Metzger c5dee6177f x86, bts: memory accounting
Impact: move the BTS buffer accounting to the mlock bucket

Add alloc_locked_buffer() and free_locked_buffer() functions to mm/mlock.c
to kalloc a buffer and account the locked memory to current.

Account the memory for the BTS buffer to the tracer.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-12-20 09:15:47 +01:00
Markus Metzger bf53de907d x86, bts: add fork and exit handling
Impact: introduce new ptrace facility

Add arch_ptrace_untrace() function that is called when the tracer
detaches (either voluntarily or when the tracing task dies);
ptrace_disable() is only called on a voluntary detach.

Add ptrace_fork() and arch_ptrace_fork(). They are called when a
traced task is forked.

Clear DS and BTS related fields on fork.

Release DS resources and reclaim memory in ptrace_untrace(). This
releases resources already when the tracing task dies. We used to do
that when the traced task dies.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-12-20 09:15:46 +01:00
venkatesh.pallipadi@intel.com 34801ba9bf x86: PAT: move track untrack pfnmap stubs to asm-generic
Impact: Cleanup and branch hints only.

Move the track and untrack pfn stub routines from memory.c to asm-generic.
Also add unlikely to pfnmap related calls in fork and exit path.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-12-19 15:40:30 -08:00
venkatesh.pallipadi@intel.com 982d789ab7 x86: PAT: remove follow_pfnmap_pte in favor of follow_phys
Impact: Cleanup - removes a new function in favor of a recently modified older one.

Replace follow_pfnmap_pte in pat code with follow_phys. follow_phys lso
returns protection eliminating the need of pte_pgprot call. Using follow_phys
also eliminates the need for pte_pa.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-12-19 15:40:30 -08:00
Hiroshi Shimamoto 8403295e0f x86: ia32_signal: remove unnecessary declaration
Impact: cleanup

No need to declare do_signal().

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-12-19 23:33:59 +01:00
Jaswinder Singh 34945ede31 x86: common.c boot_cpu_stack and boot_exception_stacks should be static
Impact: cleanup, avoid sparse warnings, reduce kernel size a bit

Fixes these sparse warnings:

 arch/x86/kernel/cpu/common.c:869:6: warning: symbol 'boot_cpu_stack' was not declared. Should it be static?
 arch/x86/kernel/cpu/common.c:910:6: warning: symbol 'boot_exception_stacks' was not declared. Should it be static?

Signed-off-by: Jaswinder Singh <jaswinder@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-12-19 23:16:08 +01:00