kernel/kernel-generic.git
17 years ago[POWERPC] fix missing #include in sys_ppc32.c
Arnd Bergmann [Mon, 27 Nov 2006 18:18:59 +0000 (19:18 +0100)]
[POWERPC] fix missing #include in sys_ppc32.c

sys_mmap is declared in asm/syscalls.h

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add a default zImage target
Arnd Bergmann [Mon, 27 Nov 2006 18:18:58 +0000 (19:18 +0100)]
[POWERPC] ps3: add a default zImage target

It's currently not possible to build the default zImage
target if PS3 is the only selected platform. This is
a hack to fall back to building the pseries style
zImage, so the build is successful. This will probably
change in the future, if someone writes a PS3 specific
boot wrapper.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: multiplatform build fixes
Arnd Bergmann [Mon, 27 Nov 2006 18:18:57 +0000 (19:18 +0100)]
[POWERPC] ps3: multiplatform build fixes

A few code paths need to check whether or not they are running
on the PS3's LV1 hypervisor before making hcalls. This introduces
a new firmware feature bit for this, FW_FEATURE_PS3_LV1.

Now when both PS3 and IBM_CELL_BLADE are enabled, but not PSERIES,
FW_FEATURE_PS3_LV1 and FW_FEATURE_LPAR get enabled at compile time,
which is a bug. The same problem can also happen for (PPC_ISERIES &&
!PPC_PSERIES && PPC_SOMETHING_ELSE). In order to solve this, I
introduce a new CONFIG_PPC_NATIVE option that is set when at least
one platform is selected that can run without a hypervisor and then
turns the firmware feature check into a run-time option.

The new cell oprofile support that was recently merged does not
work on hypervisor based platforms like the PS3, therefore make
it depend on PPC_CELL_NATIVE instead of PPC_CELL. This may change
if we get oprofile support for PS3.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: Missed renames of CONFIG_PS3 to CONFIG_PPC_PS3
Geert Uytterhoeven [Mon, 27 Nov 2006 18:18:56 +0000 (19:18 +0100)]
[POWERPC] ps3: Missed renames of CONFIG_PS3 to CONFIG_PPC_PS3

When renaming CONFIG_PS3 to CONFIG_PPC_PS3, a few occurrences have been
missed.

I also fixed up the alignment in arch/powerpc/platforms/Makefile.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] cell: fix building without spufs
Arnd Bergmann [Mon, 27 Nov 2006 18:18:55 +0000 (19:18 +0100)]
[POWERPC] cell: fix building without spufs

It may be desireable to build a kernel for cell without
spufs, e.g. as the initial kboot kernel. This requires
that the SPU specific parts of the core dump and the xmon
code depend on CONFIG_SPU_BASE instead of CONFIG_PPC_CELL.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] spufs: we should only execute init_spu_base on cell
Stephen Rothwell [Mon, 27 Nov 2006 18:18:54 +0000 (19:18 +0100)]
[POWERPC] spufs: we should only execute init_spu_base on cell

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] spufs: always send sigtrap on breakpoint
Arnd Bergmann [Mon, 27 Nov 2006 18:18:53 +0000 (19:18 +0100)]
[POWERPC] spufs: always send sigtrap on breakpoint

Currently, we only send a sigtrap if the current task is being ptraced.
This is somewhat inconsistant, and it breaks utrace support in fedora.
Removing the check should do the right thing in all cases.

Cc: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] spufs: return an error in spu_create is isolated create isnt supported
Jeremy Kerr [Mon, 27 Nov 2006 18:18:52 +0000 (19:18 +0100)]
[POWERPC] spufs: return an error in spu_create is isolated create isnt supported

This changes the spu_create system call to return an error (-ENODEV) if
and isolated spu context is requested on hardware that doesn't support
isolated mode.

Tested on systemsim with and without isolation support

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Fix compile issue for Efika platform
Nicolas DET [Fri, 17 Nov 2006 15:03:20 +0000 (16:03 +0100)]
[POWERPC] Fix compile issue for Efika platform

This patch fixes a compile issue for the Efika platform recently
introduced by API changes.

Signed-off-by: Nicolas DET <nd@bplan-gmbh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Compile a zImage.chrp if PPC_EFIKA seleted
Nicolas DET [Fri, 17 Nov 2006 16:08:37 +0000 (17:08 +0100)]
[POWERPC] Compile a zImage.chrp if PPC_EFIKA seleted

Signed-off-by: Nicolas DET <nd@bplan-gmbh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] powerpc: Make 970MP detectable by oprofile
Mike Wolf [Tue, 21 Nov 2006 20:41:54 +0000 (14:41 -0600)]
[POWERPC] powerpc: Make 970MP detectable by oprofile

Change the oprofile_cpu_type in cputables.c to be ppc64/970MP.  Oprofile
needs to distinquish the MP from other 970 processors so it can add some
new counters specific to the 970MP.

Signed-off-by: Mike Wolf <mjw@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] update cell_defconfig for ps3 support
Arnd Bergmann [Wed, 22 Nov 2006 23:47:02 +0000 (00:47 +0100)]
[POWERPC] update cell_defconfig for ps3 support

In the common cell kernel, I want to have ps3 enabled
to find potential bugs at compile-time.
Also enable SPU disassembly in xmon.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add ps3_defconfig
Geoff Levand [Wed, 22 Nov 2006 23:47:01 +0000 (00:47 +0100)]
[POWERPC] ps3: add ps3_defconfig

Adds a ps3_defconfig for the PS3 game console.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add ps3 platform system bus support
Geoff Levand [Wed, 22 Nov 2006 23:47:00 +0000 (00:47 +0100)]
[POWERPC] ps3: add ps3 platform system bus support

Adds a PS3 system bus driver.  This system bus is a virtual bus used to present
the PS3 system devices in the LDM.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add spu support
Geoff Levand [Wed, 22 Nov 2006 23:46:59 +0000 (00:46 +0100)]
[POWERPC] ps3: add spu support

Adds spu support for the PS3 platform.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add OS params support
Geoff Levand [Wed, 22 Nov 2006 23:46:58 +0000 (00:46 +0100)]
[POWERPC] ps3: add OS params support

Adds support for early access to the parameter data from the PS3 'Other OS'
flash memory area.  The parameter data mainly holds user preferences like
static ip address.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add lpar addressing
Geoff Levand [Wed, 22 Nov 2006 23:46:57 +0000 (00:46 +0100)]
[POWERPC] ps3: add lpar addressing

Adds some needed bits for a config option PS3_USE_LPAR_ADDR that disables
the PS3 lpar address translation mechanism.  This is a currently needed
workaround for limitations in the design of the generic cell spu support.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add interrupt support
Geoff Levand [Wed, 22 Nov 2006 23:46:56 +0000 (00:46 +0100)]
[POWERPC] ps3: add interrupt support

Adds routines to interface with the PS3 interrupt services.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add repository support
Geoff Levand [Wed, 22 Nov 2006 23:46:55 +0000 (00:46 +0100)]
[POWERPC] ps3: add repository support

Adds support for the PS3 repository.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add htab routines
Geoff Levand [Wed, 22 Nov 2006 23:46:54 +0000 (00:46 +0100)]
[POWERPC] ps3: add htab routines

Adds pagetable management routines for the PS3.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add feature bits
Geoff Levand [Wed, 22 Nov 2006 23:46:53 +0000 (00:46 +0100)]
[POWERPC] ps3: add feature bits

Adds the needed firmware feature bits for the PS3.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add lv1 hvcalls
Geoff Levand [Wed, 22 Nov 2006 23:46:52 +0000 (00:46 +0100)]
[POWERPC] ps3: add lv1 hvcalls

Adds the PS3 hvcalls.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] ps3: add support for ps3 platform
Geoff Levand [Wed, 22 Nov 2006 23:46:51 +0000 (00:46 +0100)]
[POWERPC] ps3: add support for ps3 platform

Adds the core platform support for the PS3 game console and other devices
using the PS3 hypervisor.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] cell: spu management xmon routines
Michael Ellerman [Wed, 22 Nov 2006 23:46:50 +0000 (00:46 +0100)]
[POWERPC] cell: spu management xmon routines

This fixes the xmon support for the cell spu to be compatable with the split
spu platform code.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] cell: abstract spu management routines
Geoff Levand [Wed, 22 Nov 2006 23:46:49 +0000 (00:46 +0100)]
[POWERPC] cell: abstract spu management routines

This adds a platform specific spu management abstraction and the coresponding
routines to support the IBM Cell Blade.  It also removes the hypervisor only
resources that were included in struct spu.

Three new platform specific routines are introduced, spu_enumerate_spus(),
spu_create_spu() and spu_destroy_spu().  The underlying design uses a new
type, struct spu_management_ops, to hold function pointers that the platform
setup code is expected to initialize to instances appropriate to that platform.

For the IBM Cell Blade support, I put the hypervisor only resources that were
in struct spu into a platform specific data structure struct spu_pdata.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] add virq_to_hw accessor routine
Geoff Levand [Wed, 22 Nov 2006 23:46:48 +0000 (00:46 +0100)]
[POWERPC] add virq_to_hw accessor routine

This adds an accessor routine virq_to_hw() to the
virq routines which hides the implementation details
of the virq to hwirq map.

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Import updated version of ppc disassembly code for xmon
Michael Ellerman [Wed, 22 Nov 2006 23:46:47 +0000 (00:46 +0100)]
[POWERPC] Import updated version of ppc disassembly code for xmon

This includes:
 * version 1.24 of ppc-dis.c
 * version 1.88 of ppc-opc.c
 * version 1.23 of ppc.h

I can't vouch for the accuracy etc. of these changes, but it brings
us into line with binutils - and from a cursory test appears to work
fine.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Make 64-bit cpu features defined on 32-bit
Michael Ellerman [Wed, 22 Nov 2006 23:46:46 +0000 (00:46 +0100)]
[POWERPC] Make 64-bit cpu features defined on 32-bit

It saves #ifdef'ing in callers if we at least define the 64-bit cpu
features for 32-bit also.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Make xmon disassembly optional
Michael Ellerman [Wed, 22 Nov 2006 23:46:45 +0000 (00:46 +0100)]
[POWERPC] Make xmon disassembly optional

While adding spu disassembly support it struck me that we're actually
carrying quite a lot of code around, just to do disassembly in the case
of a crash.

While on large systems it's not an issue, on smaller ones it might be
nice to have xmon - but without the weight of the disassembly support.
For a Cell build this saves ~230KB (!), and for pSeries ~195KB.

We still support the 'di' and 'sdi' commands, however they just dump
the instruction in hex.

Move the definitions into a header to clean xmon.c just a tiny bit.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Add spu disassembly to xmon
Michael Ellerman [Wed, 22 Nov 2006 23:46:44 +0000 (00:46 +0100)]
[POWERPC] Add spu disassembly to xmon

This patch adds a "sdi" command to xmon, to disassemble the contents
of an spu's local store.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Import spu disassembly code into xmon
Michael Ellerman [Wed, 22 Nov 2006 23:46:43 +0000 (00:46 +0100)]
[POWERPC] Import spu disassembly code into xmon

This patch imports and munges the spu disassembly code from binutils.

All files originated from version 1.1 in binutils cvs.
 * spu.h, spu-insns.h and spu-opc.c are unchanged except for pathnames.
 * spu-dis.c has been edited heavily:
   * use printf instead of info->fprintf_func and similar.
   * pass the instruction in rather than reading it.
   * we have no equivalent to symbol_at_address_func, so we just assume
     there is never a symbol at the address given.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Prepare for spu disassembly in xmon
Michael Ellerman [Wed, 22 Nov 2006 23:46:42 +0000 (00:46 +0100)]
[POWERPC] Prepare for spu disassembly in xmon

In order to do disassembly of spu binaries in xmon, we need to abstract
the disassembly function from ppc_inst_dump.

We do this by making the actual disassembly function a function pointer
that we pass to ppc_inst_dump(). To save updating all the callers, we
turn ppc_inst_dump() into generic_inst_dump() and make ppc_inst_dump()
a wrapper which always uses print_insn_powerpc().

Currently we pass the dialect into print_insn_powerpc(), but we always
pass 0 - so just make it a local.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Add a sd command (spu dump) to xmon to dump spu local store
Michael Ellerman [Wed, 22 Nov 2006 23:46:41 +0000 (00:46 +0100)]
[POWERPC] Add a sd command (spu dump) to xmon to dump spu local store

Add a command to xmon to dump the memory of a spu's local store.
This mimics the 'd' command which dumps regular memory, but does
a little hand holding by taking the user supplied address and
finding that offset in the local store for the specified spu.

This makes it easy for example to look at what was executing on a spu:

1:mon> ss
...
Stopped spu 04 (was running)
...
1:mon> sf 4
Dumping spu fields at address c0000000019e0a00:
...
  problem->spu_npc_RW     = 0x228
...
1:mon> sd 4 0x228
d000080080318228 01a00c021cffc408 4020007f217ff488  |........@ ..!...|

Aha, 01a00c02, which is of course rdch $2,$ch24 !

--

Updated to only do the setjmp goo around the spu access, and not
around prdump because it does its own (via mread).

Also the num variable is now common between sf and sd, so you don't
have to keep typing the spu number in if you're repeating commands
on the same spu.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Show state of spus as theyre stopped in Cell xmon helper
Michael Ellerman [Wed, 22 Nov 2006 23:46:40 +0000 (00:46 +0100)]
[POWERPC] Show state of spus as theyre stopped in Cell xmon helper

After stopping spus in xmon I often find myself trawling through the
field dumps to find out which spus were running. The spu stopping
code actually knows what's running, so let's print it out to save
the user some futzing.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] Fix sparse warning in xmon Cell code
Michael Ellerman [Wed, 22 Nov 2006 23:46:39 +0000 (00:46 +0100)]
[POWERPC] Fix sparse warning in xmon Cell code

My patch to add spu helpers to xmon (a898497088f46252e6750405504064e2dce53117)
introduced a few sparse warnings, because I was dereferencing an __iomem
pointer.

I think the best way to handle it is to actually use the appropriate in_beXX
functions. Need to rejigger the DUMP macro a little to accomodate that.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] cell: hard disable interrupts in power_save()
Benjamin Herrenschmidt [Wed, 22 Nov 2006 23:46:38 +0000 (00:46 +0100)]
[POWERPC] cell: hard disable interrupts in power_save()

With soft-disabled interrupts in power_save, we can
still get external exceptions on Cell, even if we are
in pause(0) a.k.a. sleep state.

When the CPU really wakes up through the 0x100 (system reset)
vector, while we have already started processing the 0x500
(external) exception, we get a panic in unrecoverable_exception()
because of the lost state.

This occurred in Systemsim for Cell, but as far as I can see,
it can theoretically occur on any machine that uses the
system reset exception to get out of sleep state.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] coredump: Add SPU elf notes to coredump.
Dwayne Grant McConnell [Wed, 22 Nov 2006 23:46:37 +0000 (00:46 +0100)]
[POWERPC] coredump: Add SPU elf notes to coredump.

This patch adds SPU elf notes to the coredump. It creates a separate note
for each of /regs, /fpcr, /lslr, /decr, /decr_status, /mem, /signal1,
/signal1_type, /signal2, /signal2_type, /event_mask, /event_status,
/mbox_info, /ibox_info, /wbox_info, /dma_info, /proxydma_info, /object-id.

A new macro, ARCH_HAVE_EXTRA_NOTES, was created for architectures to
specify they have extra elf core notes.

A new macro, ELF_CORE_EXTRA_NOTES_SIZE, was created so the size of the
additional notes could be calculated and added to the notes phdr entry.

A new macro, ELF_CORE_WRITE_EXTRA_NOTES, was created so the new notes
would be written after the existing notes.

The SPU coredump code resides in spufs. Stub functions are provided in the
kernel which are hooked into the spufs code which does the actual work via
register_arch_coredump_calls().

A new set of __spufs_<file>_read/get() functions was provided to allow the
coredump code to read from the spufs files without having to lock the
SPU context for each file read from.

Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Dwayne Grant McConnell <decimal@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
17 years ago[POWERPC] powerpc: Workaround for of_platform without "reg" nor "dcr-reg"
Benjamin Herrenschmidt [Tue, 21 Nov 2006 03:56:37 +0000 (14:56 +1100)]
[POWERPC] powerpc: Workaround for of_platform without "reg" nor "dcr-reg"

Devices with no "reg" nor "dcr-reg" property are given a bus_id which
is the node name alone. This means that if more than one such device
with the same names are present in the system, sysfs will have
collisions when creating the symlinks and will fail registering the
devices.

This works around that problem by assigning successive numbers to such
devices.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Distinguish POWER6 partition modes and tell userspace
Paul Mackerras [Fri, 10 Nov 2006 09:38:53 +0000 (20:38 +1100)]
[POWERPC] Distinguish POWER6 partition modes and tell userspace

This adds code to look at the properties firmware puts in the device
tree to determine what compatibility mode the partition is in on
POWER6 machines, and set the ELF aux vector AT_HWCAP and AT_PLATFORM
entries appropriately.

Specifically, we look at the cpu-version property in the cpu node(s).
If that contains a "logical" PVR value (of the form 0x0f00000x), we
call identify_cpu again with this PVR value.  A value of 0x0f000001
indicates the partition is in POWER5+ compatibility mode, and a value
of 0x0f000002 indicates "POWER6 architected" mode, with various
extensions disabled.  We also look for various other properties:
ibm,dfp, ibm,purr and ibm,spurr.

Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] cell: Add oprofile support
Maynard Johnson [Mon, 20 Nov 2006 17:45:16 +0000 (18:45 +0100)]
[POWERPC] cell: Add oprofile support

Add PPU event-based and cycle-based profiling support to Oprofile for Cell.

Oprofile is expected to collect data on all CPUs simultaneously.
However, there is one set of performance counters per node.  There are
two hardware threads or virtual CPUs on each node.  Hence, OProfile must
multiplex in time the performance counter collection on the two virtual
CPUs.

The multiplexing of the performance counters is done by a virtual
counter routine.  Initially, the counters are configured to collect data
on the even CPUs in the system, one CPU per node.  In order to capture
the PC for the virtual CPU when the performance counter interrupt occurs
(the specified number of events between samples has occurred), the even
processors are configured to handle the performance counter interrupts
for their node.  The virtual counter routine is called via a kernel
timer after the virtual sample time.  The routine stops the counters,
saves the current counts, loads the last counts for the other virtual
CPU on the node, sets interrupts to be handled by the other virtual CPU
and restarts the counters, the virtual timer routine is scheduled to run
again.  The virtual sample time is kept relatively small to make sure
sampling occurs on both CPUs on the node with a relatively small
granularity.  Whenever the counters overflow, the performance counter
interrupt is called to collect the PC for the CPU where data is being
collected.

The oprofile driver relies on a firmware RTAS call to setup the debug bus
to route the desired signals to the performance counter hardware to be
counted.  The RTAS call must set the routing registers appropriately in
each of the islands to pass the signals down the debug bus as well as
routing the signals from a particular island onto the bus.  There is a
second firmware RTAS call to reset the debug bus to the non pass thru
state when the counters are not in use.

Signed-off-by: Carl Love <carll@us.ibm.com>
Signed-off-by: Maynard Johnson <mpjohn@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] cell: Add routines for managing PMU interrupts
Kevin Corry [Mon, 20 Nov 2006 17:45:15 +0000 (18:45 +0100)]
[POWERPC] cell: Add routines for managing PMU interrupts

The following routines are added to arch/powerpc/platforms/cell/pmu.c:
 cbe_clear_pm_interrupts()
 cbe_enable_pm_interrupts()
 cbe_disable_pm_interrupts()
 cbe_query_pm_interrupts()
 cbe_pm_irq()
 cbe_init_pm_irq()

This also adds a routine in arch/powerpc/platforms/cell/interrupt.c and
some macros in cbe_regs.h to manipulate the IIC_IR register:
 iic_set_interrupt_routing()

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
Signed-off-by: Carl Love <carll@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] cell: Move PMU-related stuff to include/asm-powerpc/cell-pmu.h
Kevin Corry [Mon, 20 Nov 2006 17:45:14 +0000 (18:45 +0100)]
[POWERPC] cell: Move PMU-related stuff to include/asm-powerpc/cell-pmu.h

Move some PMU-related macros and function prototypes from cbe_regs.h
and pmu.h in arch/powerpc/platforms/cell/ to a new header at
include/asm-powerpc/cell-pmu.h

This is cleaner to use from the oprofile code, since that sits in
arch/powerpc/oprofile, not in the cell platform directory.

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] cell: PMU register macros
Kevin Corry [Mon, 20 Nov 2006 17:45:13 +0000 (18:45 +0100)]
[POWERPC] cell: PMU register macros

More macros for manipulating bits in the Cell PMU control registers.

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
Signed-off-by: Carl Love <carll@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] cell: Add symbol exports for oprofile
Arnd Bergmann [Mon, 20 Nov 2006 17:45:12 +0000 (18:45 +0100)]
[POWERPC] cell: Add symbol exports for oprofile

Add symbol-exports for the new routines in arch/powerpc/platforms/cell/pmu.c.
They are needed for Oprofile, which can be built as a module.

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Load isolation kernel from spu_run
Jeremy Kerr [Mon, 20 Nov 2006 17:45:10 +0000 (18:45 +0100)]
[POWERPC] spufs: Load isolation kernel from spu_run

In order to fit with the "don't-run-spus-outside-of-spu_run" model, this
patch starts the isolated-mode loader in spu_run, rather than
spu_create. If spu_run is passed an isolated-mode context that isn't in
isolated mode state, it will run the loader.

This fixes potential races with the isolated SPE app doing a
stop-and-signal before the PPE has called spu_run: bugzilla #29111.
Also (in conjunction with a mambo patch), this addresses #28565, as we
always set the runcntrl register when entering spu_run.

It is up to libspe to ensure that isolated-mode apps are cleaned up
after running to completion - ie, put the app through the "ISOLATE EXIT"
state (see Ch11 of the CBEA).

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Add runcntrl read accessors
Jeremy Kerr [Mon, 20 Nov 2006 17:45:09 +0000 (18:45 +0100)]
[POWERPC] spufs: Add runcntrl read accessors

This change adds a read accessor for the SPE problem-state run control
register.

This is required for for applying (userspace) changes made to the run
control register while the SPE is stopped - simply asserting the master
run control bit is not sufficient. My next patch for isolated-mode
setup requires this.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Use SPU master control to prevent wild SPU execution
Arnd Bergmann [Mon, 20 Nov 2006 17:45:08 +0000 (18:45 +0100)]
[POWERPC] spufs: Use SPU master control to prevent wild SPU execution

When the user changes the runcontrol register, an SPU might be
running without a process being attached to it and waiting for
events. In order to prevent this, make sure we always disable
the priv1 master control when we're not inside of spu_run.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Fix return value of spufs_mfc_write
Masato Noguchi [Mon, 20 Nov 2006 17:45:07 +0000 (18:45 +0100)]
[POWERPC] spufs: Fix return value of spufs_mfc_write

This patch changes spufs_mfc_write() to return
correct size instead of 0.

Signed-off-by: Masato Noguchi <Masato.Noguchi@jp.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Always map local store non-guarded
Arnd Bergmann [Mon, 20 Nov 2006 17:45:06 +0000 (18:45 +0100)]
[POWERPC] spufs: Always map local store non-guarded

When fixing spufs to map the 'mem' file backing store cacheable,
I incorrectly set the physical mapping to use both cache-inhibited
and guarded mapping, which resulted in a serious performance
degradation.

Debugged-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Avoid user-triggered oops in ptrace
Christoph Hellwig [Mon, 20 Nov 2006 17:45:05 +0000 (18:45 +0100)]
[POWERPC] spufs: Avoid user-triggered oops in ptrace

When one of the spufs files is mapped into a process address
space, regular users can use ptrace to attempt accessing
them with access_process_vm(). With the way that the
mappings currently work, this likely causes an oops.

Setting the vm_flags to VM_IO makes sure that ptrace can
not access them but returns an error code. This is not
the perfect solution in case of the local store mapping,
but it fixes the oops in a well-defined way.

Also remove leftover VM_RESERVED flags in spufs.  The
VM_RESERVED flag is on it's way out and not checked by
the memory managment code anymore.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Christoph Hellwig <chellwig@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Fix missing stop-and-signal
Masato Noguchi [Mon, 20 Nov 2006 17:45:04 +0000 (18:45 +0100)]
[POWERPC] spufs: Fix missing stop-and-signal

When there is pending signals, current spufs_run_spu() always returns
-ERESTARTSYS and it is called again automatically.
But, if spe already stopped by stop-and-signal or halt instruction,
returning -ERESTARTSYS makes stop-and-signal/halt lost and
spu run over the end-point.

For your convenience, I attached a sample code to restage this bug.
If there is no bug, printed NPC will be 0x4000.

Signed-off-by: Masato Noguchi <Masato.Noguchi@jp.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Return correct event for data storage interrupt
Arnd Bergmann [Mon, 20 Nov 2006 17:45:03 +0000 (18:45 +0100)]
[POWERPC] spufs: Return correct event for data storage interrupt

When we attempt an MFC DMA to an unmapped address, the event
returned from spu_run should be SPE_EVENT_SPE_DATA_STORAGE,
not SPE_EVENT_INVALID_DMA.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Replace spu.nid with spu.node
Geoff Levand [Mon, 20 Nov 2006 17:45:02 +0000 (18:45 +0100)]
[POWERPC] spufs: Replace spu.nid with spu.node

Replace the use of the platform specific variable spu.nid with the
platform independednt variable spu.node.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Read from signal files only if data is there
Dwayne Grant McConnell [Mon, 20 Nov 2006 17:45:01 +0000 (18:45 +0100)]
[POWERPC] spufs: Read from signal files only if data is there

We need to check the channel count of the signal notification registers
before reading them, because it can be undefined when the count is
zero. In order to read count and data atomically, we read from the
saved context.

This patch uses spu_acquire_saved() to force a context save before a
/signal1 or /signal2 read. Because of this it is no longer necessary to
have backing_ops and hw_ops versions of this function so they have been
removed.

Regular applications should not rely on reading this register
to be fast, as it's conceptually a write-only file from the PPE
perspective.

Signed-off-by: Dwayne Grant McConnell <decimal@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Implement /mbox_info, /ibox_info, and /wbox_info.
Dwayne Grant McConnell [Mon, 20 Nov 2006 17:45:00 +0000 (18:45 +0100)]
[POWERPC] spufs: Implement /mbox_info, /ibox_info, and /wbox_info.

This patch implements read only access to

/mbox_info - SPU Write Outbound Mailbox
/ibox_info - SPU Write Outbound Interrupt Mailbox
/wbox_info - SPU Read Inbound Mailbox

These files are used by gdb in order to look into the current mailbox
queues without changing the contents at the same time. They are
not meant for general programming use, since the access requires
a context save and is therefore rather slow.

It would be good to complement this patch with one that adds
write support as well.

Signed-off-by: Dwayne Grant McConnell <decimal@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Remove /spu_tag_mask file
Dwayne Grant McConnell [Mon, 20 Nov 2006 17:44:59 +0000 (18:44 +0100)]
[POWERPC] spufs: Remove /spu_tag_mask file

This patch removes the /spu_tag_mask file from spufs. The data provided by
this file is also available from the /dma_info file in the dma_info_mask
of the spu_dma_info struct.

The file was intended to be used by gdb, but that never used it, and
now it has been replaced with the more verbose dma_info file.

Signed-off-by: Dwayne Grant McConnell <decimal@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Add /lslr, /dma_info and /proxydma files
Dwayne Grant McConnell [Mon, 20 Nov 2006 17:44:58 +0000 (18:44 +0100)]
[POWERPC] spufs: Add /lslr, /dma_info and /proxydma files

The /lslr file gives read access to the SPU_LSLR register in hex; 0x3fff
for example The /dma_info file provides read access to the SPU Command
Queue in a binary format. The /proxydma_info files provides read access
access to the Proxy Command Queue in a binary format. The spu_info.h
file provides data structures for interpreting the binary format of
/dma_info and /proxydma_info.

Signed-off-by: Dwayne Grant McConnell <decimal@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] spufs: Change %llx to 0x%llx.
Dwayne Grant McConnell [Mon, 20 Nov 2006 17:44:57 +0000 (18:44 +0100)]
[POWERPC] spufs: Change %llx to 0x%llx.

This patches changes /npc, /decr, /decr_status, /spu_tag_mask,
/event_mask, /event_status, and /srr0 files to provide output according to
the format string "0x%llx" instead of "%llx".

Before this patch some files used "0x%llx" and other used "%llx" which is
inconsistent and potentially confusing. A user might assume "%llx" numbers
were decimal if they happened to not contain any a-f digits. This change
will break any code cannot tolerate a leading 0x in the file contents. The
only known users of these files are the libspe but there might also be
some scripts which access these files. This risk is deemed acceptable for
future consistency.

Signed-off-by: Dwayne Grant McConnell <decimal@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Change ppc_rtas declaration to weak
Geoff Levand [Mon, 20 Nov 2006 17:44:56 +0000 (18:44 +0100)]
[POWERPC] Change ppc_rtas declaration to weak

Change the definition of powerpc's cond_syscall() to use the standard gcc
weak attribute specifier which provides proper support for C linkage as
needed by spu_syscall_table[].

Fixes this powerpc build error with CONFIG_SPU_FS=y, CONFIG_PPC_RTAS=n:

 arch/powerpc/platforms/built-in.o: undefined reference to `ppc_rtas'

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] 8xx: Off-by-one fixes to SCC parameter RAM definitions
Kalle Pokki [Sat, 11 Nov 2006 10:09:39 +0000 (12:09 +0200)]
[POWERPC] 8xx: Off-by-one fixes to SCC parameter RAM definitions

The SCC parameter RAM areas are mapped wrong in MPC8xx device descriptions. All
memory areas overlap with the next one, so that I2C, SPI, SMC1 and SMC2 cannot
be enabled if the four SCCs are.

Signed-off-by: Kalle Pokki <kalle.pokki@iki.fi>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] setup_kcore(): Fix incorrect function name in panic() call.
Geert Uytterhoeven [Fri, 17 Nov 2006 05:21:12 +0000 (06:21 +0100)]
[POWERPC] setup_kcore(): Fix incorrect function name in panic() call.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Don't compile arch/powerpc mpc52xx_pic driver for ARCH=ppc
Grant Likely [Sat, 18 Nov 2006 06:12:14 +0000 (23:12 -0700)]
[POWERPC] Don't compile arch/powerpc mpc52xx_pic driver for ARCH=ppc

arch/powerpc/sysdev/mpc52xx_pic.c breaks the ppc build

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Fix wraparound problem in smp-tbsync on 32-bit
Adrian Cox [Fri, 17 Nov 2006 14:35:48 +0000 (14:35 +0000)]
[POWERPC] Fix wraparound problem in smp-tbsync on 32-bit

The patch below fixes an arithmetic wrap-around issue on 32bit machines
using smp-tbsync. Without this patch a timebase value over
0x000000007fffffff will hang the boot process while bringing up
secondary CPUs.

Signed-off-by: Adrian Cox <adrian@humboldt.co.uk>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Cleanup zImage handling of kernel entry with flat device tree
David Gibson [Tue, 21 Nov 2006 00:37:37 +0000 (11:37 +1100)]
[POWERPC] Cleanup zImage handling of kernel entry with flat device tree

This makes 2 changes to clean up the flat device tree handling
logic in the zImage wrapper.

First, there were two callbacks from the dt_ops structure used for
producing a final flat tree to pass to the kerne: dt_ops.ft_pack()
which packed the flat tree (possibly a no-op) and dt_ops.ft_addr()
which retreived the address of the final blob.  Since they were only
ever called together, this patch combines the two into a single new
callback, dt_ops.finalize().  This new callback does whatever
platform-dependent things are necessary to produce a final flat device
tree blob, and returns the blob's addres.

Second, the current logic calls the kernel with a flat device tree if
one is build into the zImage wrapper, otherwise it boots the kernel
with a PROM pointer, expecting the kernel to copy the OF device tree
itself.  This approach precludes the possibility of the platform
wrapper code building a flat device tree from whatever
platform-specific information firmware provides.  Thus, this patch
takes the more sensible approach of invoking the kernel with a flat
tree if the dt_ops.finalize callback provides one (by whatever means).

So, the dt_ops.finalize callback can be NULL, or can be a function
which returns NULL.  In either case, the zImage wrapper logic assumes
that this is a platform with OF and invokes the kernel accordingly.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Small clarification of initrd handling
David Gibson [Thu, 16 Nov 2006 04:31:32 +0000 (15:31 +1100)]
[POWERPC] Small clarification of initrd handling

This patch makes the handling of the initrd (or initramfs) in the
zImage wrapper a little easier to follow.  Instead of passing the
initrd addresses out from prep_kernel() via the cryptic a1 and a2
parameters, use the global struct add_range, 'initrd'.  prep_kernel()
already passes information through the 'vmlinux' addr_range struct, so
this seems like a reasonable extension.

Some comments also clarify the logic with prep_kernel(): we use an
initrd included in the zImage if present, otherwise we use an initrd
passed in by the bootloader in the a1 and a2 parameters (yaboot, at
least, uses this mechanism to pass an initrd).

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Xserve cpu-meter driver
Benjamin Herrenschmidt [Thu, 16 Nov 2006 03:03:33 +0000 (14:03 +1100)]
[POWERPC] Xserve cpu-meter driver

This is a small driver for the Xserve G5 CPU-meter blue LEDs on the
front-panel. It might work on the Xserve G4 as well though that was
not tested. It's pretty basic and could use some improvements if
somebody cares doing them. :)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Wrap cpu_die() with CONFIG_HOTPLUG_CPU
Linas Vepstas [Thu, 16 Nov 2006 21:41:15 +0000 (15:41 -0600)]
[POWERPC] Wrap cpu_die() with CONFIG_HOTPLUG_CPU

Per email discussion, it appears that rtas_stop_self()
and pSeries_mach_cpu_die() should not be compiled if
CONFIG_HOTPLUG_CPU is not defined. This patch adds
#ifdefs around these bits of code.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Make pci_read_irq_line the default on mpc7448hpc2 board
Zang Roy-r61911 [Tue, 14 Nov 2006 06:31:50 +0000 (14:31 +0800)]
[POWERPC] Make pci_read_irq_line the default on mpc7448hpc2 board

The following patch adds a tsi108/9 pci interrupt controller host.
On mpc7448hpc2 board, pci_irq_fixup function is removed, which makes the
pci_read_irq_line be the default pci irq fixup.

Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] CPM_UART: Fix inconsistency of function definition
Kalle Pokki [Mon, 13 Nov 2006 08:22:30 +0000 (11:22 +0300)]
[POWERPC] CPM_UART: Fix inconsistency of function definition

The below hunk was missed from the recent patch, and now, there are somewhat
inconsistent definitions:

in cpm_uart.h:
int __init cpm_uart_init_portdesc(void);

in cpm_uart_cpm1.c:
int __init cpm_uart_init_portdesc(void)
{
}

in cpm_uart_cpm2.c:
int cpm_uart_init_portdesc(void)
{
}

Signed-off-by: Kalle Pokki <kalle.pokki@iki.fi>
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Compilation fixes for ppc4xx PCI-less configs
Wojtek Kaniewski [Thu, 9 Nov 2006 03:52:57 +0000 (19:52 -0800)]
[POWERPC] Compilation fixes for ppc4xx PCI-less configs

Fix compilation without PCI support for Bubinga, CPCI405 and EP405.
bios_fixup() for these boards uses functions available only with
CONFIG_PCI, so linker fails.

Signed-off-by: Wojtek Kaniewski <wojtekka@toxygen.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Book-E reg MCSR msg misquoted
nkalmala [Thu, 9 Nov 2006 03:52:56 +0000 (19:52 -0800)]
[POWERPC] Book-E reg MCSR msg misquoted

PPC/booke reg MCSR value misquoted

Signed-off-by: nkalmala <nkalmala@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Make soft_enabled irqs preempt safe
Hugh Dickins [Fri, 10 Nov 2006 21:32:40 +0000 (21:32 +0000)]
[POWERPC] Make soft_enabled irqs preempt safe

Rewrite local_get_flags and local_irq_disable to use r13 explicitly,
to avoid the risk that gcc will split get_paca()->soft_enabled into a
sequence unsafe against preemption.  Similar care in local_irq_restore.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] iSeries: fix slb.c for combined build
Stephen Rothwell [Tue, 14 Nov 2006 01:57:38 +0000 (12:57 +1100)]
[POWERPC] iSeries: fix slb.c for combined build

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] iSeries: fix xmon.c for combined build
Stephen Rothwell [Mon, 13 Nov 2006 03:50:28 +0000 (14:50 +1100)]
[POWERPC] iSeries: fix xmon.c for combined build

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] iSeries: fix time.c for combined build
Stephen Rothwell [Tue, 21 Nov 2006 04:10:20 +0000 (15:10 +1100)]
[POWERPC] iSeries: fix time.c for combined build

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] iSeries: fix sysfs.c for combined build
Stephen Rothwell [Mon, 13 Nov 2006 03:46:04 +0000 (14:46 +1100)]
[POWERPC] iSeries: fix sysfs.c for combined build

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] iSeries: fix irq.c for combined build
Stephen Rothwell [Tue, 21 Nov 2006 03:16:13 +0000 (14:16 +1100)]
[POWERPC] iSeries: fix irq.c for combined build

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] iSeries: improve viodasd initialisation
Stephen Rothwell [Mon, 13 Nov 2006 03:43:17 +0000 (14:43 +1100)]
[POWERPC] iSeries: improve viodasd initialisation

On error, make sure that we undo all necessary operations.

This also gets rid of a must_check warning.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Fix IDE build with ARCH=ppc
Benjamin Herrenschmidt [Tue, 21 Nov 2006 02:45:56 +0000 (13:45 +1100)]
[POWERPC] Fix IDE build with ARCH=ppc

The recent IO accessor changes broke IDE on arch/ppc due to the IDE
stream IO macros using the new reads/writes{b,w,l} accessors that
are only defined for arch/powerpc. This adds them to arch/ppc.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Fix __raw* accessors
Benjamin Herrenschmidt [Tue, 21 Nov 2006 01:35:29 +0000 (12:35 +1100)]
[POWERPC] Fix __raw* accessors

The new IO accessor code allows to stick a token in the top bit of MMIO
addresses which gets masked out during actual accesses. However, the
__raw_* accessors forgot to mask it out. This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Merge 32 and 64 bits asm-powerpc/io.h
Benjamin Herrenschmidt [Sun, 12 Nov 2006 22:27:39 +0000 (09:27 +1100)]
[POWERPC] Merge 32 and 64 bits asm-powerpc/io.h

powerpc: Merge 32 and 64 bits asm-powerpc/io.h

The rework on io.h done for the new hookable accessors made it easier,
so I just finished the work and merged 32 and 64 bits io.h for arch/powerpc.

arch/ppc still uses the old version in asm-ppc, there is just too much gunk
in there that I really can't be bothered trying to cleanup.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Remove ioremap64 and fixup_bigphys_addr
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:19 +0000 (17:25 +1100)]
[POWERPC] Remove ioremap64 and fixup_bigphys_addr

In order to suppose platforms with devices above 4Gb on 32 bits platforms
with a >32 bits physical address space, we used to have a special ioremap64
along with a fixup routine fixup_bigphys_addr.

This shouldn't be necessary anymore as struct resource now supports 64 bits
addresses even on 32 bits archs. This patch enables that option when
CONFIG_PHYS_64BIT is set and removes ioremap64 and fixup_bigphys_addr.

This is a preliminary work for the upcoming merge of 32 and 64 bits io.h

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Cell iommu support
Jeremy Kerr [Sat, 11 Nov 2006 06:25:18 +0000 (17:25 +1100)]
[POWERPC] Cell iommu support

This patch adds full cell iommu support (and iommu disabled mode).

It implements mapping/unmapping of iommu pages on demand using the
standard powerpc iommu framework.  It also supports running with
iommu disabled for machines with less than 2GB of memory.  (The
default is off in that case, though it can be forced on with the
kernel command line option iommu=force).

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Make cell use direct DMA ops
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:17 +0000 (17:25 +1100)]
[POWERPC] Make cell use direct DMA ops

Now that the direct DMA ops supports an offset, we use that instead
of defining our own.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Make direct DMA use node local allocations
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:16 +0000 (17:25 +1100)]
[POWERPC] Make direct DMA use node local allocations

This patch makes dma_alloc_coherent() use node local allocation when
using the direct DMA ops. The node is obtained from the new device
extension. If no such extension is present, the current node is used.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Add an optional offset to direct DMA on 64 bits
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:14 +0000 (17:25 +1100)]
[POWERPC] Add an optional offset to direct DMA on 64 bits

This patch adds an optional global offset that can be added to DMA addresses
when using the direct DMA operations.

That brings it a step closer to the 32 bits direct DMA operations, and makes
it useable on Cell when the MMU is disabled and we are using a spider
southbridge.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Spider uses low level BE MMIO accessors
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:13 +0000 (17:25 +1100)]
[POWERPC] Spider uses low level BE MMIO accessors

We use the powerpc specific low level MMIO accessor variants instead
of readl() or readl_be() because we know spidernet is not a real PCI
device and we can thus avoid the performance hit caused by the PCI
workarounds.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Cell "Spider" MMIO workarounds
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:12 +0000 (17:25 +1100)]
[POWERPC] Cell "Spider" MMIO workarounds

This patch implements a workaround for a Spider PCI host bridge bug
where it doesn't enforce some of the PCI ordering rules unless some
manual manipulation of a special register is done. In order to be
fully compliant with the PCI spec, I do this on every MMIO read
operation.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:10 +0000 (17:25 +1100)]
[POWERPC] Allow hooking of PCI MMIO & PIO accessors on 64 bits

This patch reworks the way iSeries hooks on PCI IO operations (both MMIO
and PIO) and provides a generic way for other platforms to do so (we
have need to do that for various other platforms).

While reworking the IO ops, I ended up doing some spring cleaning in
io.h and eeh.h which I might want to split into 2 or 3 patches (among
others, eeh.h had a lot of useless stuff in it).

A side effect is that EEH for PIO should work now (it used to pass IO
ports down to the eeh address check functions which is bogus).

Also, new are MMIO "repeat" ops, which other archs like ARM already had,
and that we have too now: readsb, readsw, readsl, writesb, writesw,
writesl.

In the long run, I might also make EEH use the hooks instead
of wrapping at the toplevel, which would make things even cleaner and
relegate EEH completely in platforms/iseries, but we have to measure the
performance impact there (though it's really only on MMIO reads)

Since I also need to hook on ioremap, I shuffled the functions a bit
there. I introduced ioremap_flags() to use by drivers who want to pass
explicit flags to ioremap (and it can be hooked). The old __ioremap() is
still there as a low level and cannot be hooked, thus drivers who use it
should migrate unless they know they want the low level version.

The patch "arch provides generic iomap missing accessors" (should be
number 4 in this series) is a pre-requisite to provide full iomap
API support with this patch.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Cell fixup DMA offset for new southbridge
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:09 +0000 (17:25 +1100)]
[POWERPC] Cell fixup DMA offset for new southbridge

This patch makes the Cell DMA code work on both the Spider and the Axon
south bridges by turning cell_dma_valid into a variable instead of a
constant. This is a temporary patch until we have full iommu support.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Generic OF platform driver for PCI host bridges.
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:08 +0000 (17:25 +1100)]
[POWERPC] Generic OF platform driver for PCI host bridges.

When enabled in Kconfig, it will pick up any of_platform_device
matching it's match list (currently type "pci", "pcix", "pcie",
or "ht" and setup a PHB for it.

Platform must provide a ppc_md.pci_setup_phb() for it to work
(for doing the necessary initialisations specific to a given PHB
like setting up the config space ops).

It's currently only available on 64 bits as the 32 bits PCI code
can't quite cope with it in it's current form. I will fix that
later.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Add "parent" struct device for PCI host bridges
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:07 +0000 (17:25 +1100)]
[POWERPC] Add "parent" struct device for PCI host bridges

Add a "parent" struct device to our PCI host bridge data structure so that
PCI can be rooted off another device in sysfs.

Note that arch/ppc doesn't use it, only arch/powerpc, though it's available
for both 32 and 64 bits.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Resolve the BUID for RTAS PCI config space accesses
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:06 +0000 (17:25 +1100)]
[POWERPC] Resolve the BUID for RTAS PCI config space accesses

The BUID is the first entry of a PCI host bridge "reg" property.

Now that PCI busses can be anywhere in the device-tree, we need to
fully translate the value there to a CPU physical address before
we can use it with RTAS.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Resolve the parent address of a PCI bus range
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:05 +0000 (17:25 +1100)]
[POWERPC] Resolve the parent address of a PCI bus range

When parsing the OF "ranges" properties of PCI host busses to determine
the mapping of a PCI bus, we need to translate the "parent" address using
the prom_parse.c routines in order to obtain a CPU physical address.

This wasn't necessary while PCI busses were always at the root of the
device-tree but this is no longer the case on Cell where they can be
anywhere in the tree.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Add DMA ops support for of_platform_device to Cell
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:04 +0000 (17:25 +1100)]
[POWERPC] Add DMA ops support for of_platform_device to Cell

This patch adds a bus device notifier to the of_platform bus type on
cell to setup the DMA operations for of_platform_devices. We currently
use the PCI operations as Cell use a special version of them that
happens to be suitable for our needs.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Refactor 64 bits DMA operations
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:02 +0000 (17:25 +1100)]
[POWERPC] Refactor 64 bits DMA operations

This patch completely refactors DMA operations for 64 bits powerpc. 32 bits
is untouched for now.

We use the new dev_archdata structure to add the dma operations pointer
and associated data to struct device. While at it, we also add the OF node
pointer and numa node. In the future, we might want to look into merging
that with pci_dn as well.

The old vio, pci-iommu and pci-direct DMA ops are gone. They are now replaced
by a set of generic iommu and direct DMA ops (non PCI specific) that can be
used by bus types. The toplevel implementation is now inline.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[PATCH] ibmveth: Remove ibmveth "liobn" field
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:24:42 +0000 (17:24 +1100)]
[PATCH] ibmveth: Remove ibmveth "liobn" field

Remove the now unused "liobn" field in ibmveth which also avoids
having insider knowledge of the iommu table in that driver.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Santiago Leon <santil@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Hook of_platform_bus_probe with cell
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:25:00 +0000 (17:25 +1100)]
[POWERPC] Hook of_platform_bus_probe with cell

Hook up of_platform_bus_probe with the cell platform in order to publish
the non-PCI devices in the device-tree of cell blades as of_platform_device(s)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Souped-up of_platform_device support
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:24:59 +0000 (17:24 +1100)]
[POWERPC] Souped-up of_platform_device support

This patch first splits of_device.c and of_platform.c, the later containing
the bits relative to of_platform_device's. On the "breaks" side of things,
drivers uisng of_platform_device(s) need to include asm/of_platform.h now
and of_(un)register_driver is now of_(un)register_platform_driver.

In addition to a few utility functions to locate of_platform_device(s),
the main new addition is of_platform_bus_probe() which allows the platform
code to trigger an automatic creation of of_platform_devices for a whole
tree of devices.

The function acts based on the type of the various "parent" devices encountered
from a provided root, using either a default known list of bus types that can be
"probed" or a passed-in list. It will only register devices on busses matching
that list, which mean that typically, it will not register PCI devices, as
expected (since they will be picked up by the PCI layer).

This will be used by Cell platforms using 4xx-type IOs in the Axon bridge
and can be used by any embedded-type device as well.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
17 years ago[POWERPC] Native cell support for MPIC in southbridge
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:24:58 +0000 (17:24 +1100)]
[POWERPC] Native cell support for MPIC in southbridge

Add support for southbridges using the MPIC interrupt controller to
the native cell platforms.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>