openwrt/staging/blogic.git
16 years ago[POWERPC] 4xx: remove bogus "ranges" property in Bamboo EBC node
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:35 +0000 (15:39 +1100)]
[POWERPC] 4xx: remove bogus "ranges" property in Bamboo EBC node

This removes a bogus empty "ranges" property in the EBC device node
of the Bamboo board device-tree.

The "ranges" property should be created by the wrapper code when it is
implemented.  Until then, remove the empty property since it incorrectly
implies that there is a 1:1 address mapping between the EBC and the OPB.

This also fixes a warning from newer DTCs.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Base support for 440SPe "Katmai" eval board
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:34 +0000 (15:39 +1100)]
[POWERPC] 4xx: Base support for 440SPe "Katmai" eval board

This adds base support for the Katmai board, including PCI-X and
PCI-Express (but no RTC, nvram, etc... yet).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stefan Roese <sr@denx.de>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Rework clock probing in boot wrapper
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:33 +0000 (15:39 +1100)]
[POWERPC] 4xx: Rework clock probing in boot wrapper

This reworks the boot wrapper library function that probes
the chip clocks. Better separate the base function that is
used on 440GX,SPe,EP,... from the uart fixups as those need
different device-tree path on different processors.

Also, rework the function itself based on the arch/ppc code
from Eugene Surovegin which I find more readable, and which
handles one more bypass case. Also handle the subtle difference
between 440EP/EPx and 440SPe/GX, on the former, PerClk is derived
from the PLB clock while on the later, it's derived from the OPB.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Add CPR0 accessors to boot wrapper
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:32 +0000 (15:39 +1100)]
[POWERPC] 4xx: Add CPR0 accessors to boot wrapper

This adds macros to the boot wrapper to access the CPR
registers from the boot wrappers.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Add mfspr/mtspr inline macros to 4xx bootwrapper
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:32 +0000 (15:39 +1100)]
[POWERPC] 4xx: Add mfspr/mtspr inline macros to 4xx bootwrapper

The 4xx bootwrapper occasionally needs to access SPR registers,
this adds mfspr/mtspr wrappers to it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Adds decoding of 440SPE memory size to boot wrapper library
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:31 +0000 (15:39 +1100)]
[POWERPC] 4xx: Adds decoding of 440SPE memory size to boot wrapper library

This adds a function to the bootwrapper 4xx library to decode memory
size on 440SPE processors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Wire up 440EP USB controller support to Bamboo board
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:30 +0000 (15:39 +1100)]
[POWERPC] 4xx: Wire up 440EP USB controller support to Bamboo board

This adds the definition of the on-chip OHCI controller to the
Bamboo board's device-tree. This is enough to get it probed and
working, though a separate patch fixing a bug in the OHCI driver
is needed to make it reliable.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Wire up PCI on Bamboo board
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:29 +0000 (15:39 +1100)]
[POWERPC] 4xx: Wire up PCI on Bamboo board

This adds the device-tree bits & call to ppc4xx_pci_find_bridges()
to make PCI work on the Bamboo board

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Base support for 440GX Taishan eval board
Hugh Blemings [Fri, 21 Dec 2007 04:39:28 +0000 (15:39 +1100)]
[POWERPC] 4xx: Base support for 440GX Taishan eval board

This patch adds base support for the AMCC Taishan 440GX evaluation
board.

Signed-off-by: Hugh Blemings <hugh@blemings.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Add PCI to Walnut platform
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:28 +0000 (15:39 +1100)]
[POWERPC] 4xx: Add PCI to Walnut platform

This wires up the 4xx PCI support & device-tree bits for the
405GP based Walnut platform.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: EP405 boards support for arch/powerpc
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:26 +0000 (15:39 +1100)]
[POWERPC] 4xx: EP405 boards support for arch/powerpc

Brings EP405 support to arch/powerpc. The IRQ routing for the CPLD
comes from a device-tree property, PCI is working to the point where
I can see the video card, USB device, and south bridge.

This should work with both EP405 and EP405PC.

I've not totally figured out how IRQs are wired on this hardware
though, thus at this stage, expect only USB interrupts working,
pretty much the same as what arch/ppc did.

Also, the flash, nvram, rtc and temp control still have to be wired.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Add early udbg support for 40x processors
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:26 +0000 (15:39 +1100)]
[POWERPC] 4xx: Add early udbg support for 40x processors

This adds some basic real mode based early udbg support for 40x
in order to debug things more easily

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: PCI support for Ebony board
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:25 +0000 (15:39 +1100)]
[POWERPC] 4xx: PCI support for Ebony board

This wires up the 4xx PCI support & device tree bits for
440GP based Ebony platform.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: PLB to PCI Express support
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:24 +0000 (15:39 +1100)]
[POWERPC] 4xx: PLB to PCI Express support

This adds to the previous 2 patches the support for the 4xx PCI Express
cells as found in the 440SPe revA, revB and 405EX.

Unfortunately, due to significant differences between these, and other
interesting "features" of those pieces of HW, the code isn't as simple
as it is for PCI and PCI-X and some of the functions differ significantly
between the 3 implementations. Thus, not only this code can only support
those 3 implementations for now and will refuse to operate on any other,
but there are added ifdef's to avoid the bloat of building a fairly large
amount of code on platforms that don't need it.

Also, this code currently only supports fully initializing root complex
nodes, not endpoint. Some more code will have to be lifted from the
arch/ppc implementation to add the endpoint support, though it's mostly
differences in memory mapping, and the question on how to represent
endpoint mode PCI in the device-tree is thus open.

Many thanks to Stefan Roese for testing & fixing up the 405EX bits !

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: PLB to PCI 2.x support
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:23 +0000 (15:39 +1100)]
[POWERPC] 4xx: PLB to PCI 2.x support

This adds to the previous patch the support for the 4xx PCI 2.x
bridges.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: PLB to PCI-X support
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:22 +0000 (15:39 +1100)]
[POWERPC] 4xx: PLB to PCI-X support

This adds base support code for the 4xx PCI-X bridge. It also provides
placeholders for the PCI and PCI-E version but they aren't supported
with this patch.

The bridges are configured based on device-tree properties.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Improve support for 4xx indirect DCRs
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:22 +0000 (15:39 +1100)]
[POWERPC] 4xx: Improve support for 4xx indirect DCRs

Accessing indirect DCRs is done via a pair of address/data DCRs.

Such accesses are thus inherently racy, vs. interrupts, preemption
and possibly SMP if 4xx SMP cores are ever used.

This updates the mfdcri/mtdcri macros in dcr-native.h (which were
so far unused) to use a spinlock.

In addition, add some common definitions to a new dcr-regs.h file.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] Reworking machine check handling and Fix 440/440A
Benjamin Herrenschmidt [Fri, 21 Dec 2007 04:39:21 +0000 (15:39 +1100)]
[POWERPC] Reworking machine check handling and Fix 440/440A

This adds a cputable function pointer for the CPU-side machine
check handling. The semantic is still the same as the old one,
the one in ppc_md. overrides the one in cputable, though
ultimately we'll want to change that so the CPU gets first.

This removes CONFIG_440A which was a problem for multiplatform
kernels and instead fixes up the IVOR at runtime from a setup_cpu
function. The "A" version of the machine check also tweaks the
regs->trap value to differenciate the 2 versions at the C level.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years agoMerge branch 'linux-2.6'
Paul Mackerras [Fri, 21 Dec 2007 11:21:08 +0000 (22:21 +1100)]
Merge branch 'linux-2.6'

16 years ago[POWERPC] Make non-PCI build work again
Stephen Rothwell [Fri, 21 Dec 2007 04:37:07 +0000 (15:37 +1100)]
[POWERPC] Make non-PCI build work again

Maple and pasemi both require PCI as does CONFIG_OF_PLATFORM_PCI.
The default setting of CONFIG_ISA_DMA_API is set to match the protection
around the relevant routines in asm/dma.h.

I also had to remove the PMAC platform from the combined build.  The
precis is that to build a 64 bit kernel with no PCI, you can only include
pSeries and iSeries.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Pointers marked as __iomem do not need to be volatile
Stephen Rothwell [Fri, 21 Dec 2007 04:23:48 +0000 (15:23 +1100)]
[POWERPC] Pointers marked as __iomem do not need to be volatile

Fixes this warning:

arch/powerpc/platforms/powermac/pci.c: In function 'u3_ht_cfg_access':
arch/powerpc/platforms/powermac/pci.c:354: warning: return discards qualifiers from pointer target type
arch/powerpc/platforms/powermac/pci.c:358: warning: return discards qualifiers from pointer target type

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Constify the of_device_id passed to of_platform_bus_probe
Stephen Rothwell [Fri, 21 Dec 2007 04:21:51 +0000 (15:21 +1100)]
[POWERPC] Constify the of_device_id passed to of_platform_bus_probe

This will allow us to declare const all the statically declared arrrays
of these.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] The builtin matches for ibmebus.c can be __initdata
Stephen Rothwell [Fri, 21 Dec 2007 04:19:59 +0000 (15:19 +1100)]
[POWERPC] The builtin matches for ibmebus.c can be __initdata

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Add EHEA and EHCA as modules in the ppc64_defconfig
Stephen Rothwell [Fri, 21 Dec 2007 03:54:59 +0000 (14:54 +1100)]
[POWERPC] Add EHEA and EHCA as modules in the ppc64_defconfig

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fix possible NULL deref in ppc32 PCI
Benjamin Herrenschmidt [Fri, 21 Dec 2007 03:53:27 +0000 (14:53 +1100)]
[POWERPC] Fix possible NULL deref in ppc32 PCI

The 32-bit PCI code tests if "bus" is non-NULL after calling
pci_scan_bus_parented() in one place but not another before
dereferencing it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fix for via-pmu based backlight control
Benjamin Herrenschmidt [Thu, 20 Dec 2007 04:00:21 +0000 (15:00 +1100)]
[POWERPC] Fix for via-pmu based backlight control

This fixes a few issues with via-pmu based backlight control.

First, it fixes a sign problem with the setup of the backlight
curve since the `range' value there -can- (and will) go negative.

Then, it reworks the interaction between this and the via-pmu sleep
code to properly restore backlight on wakeup from sleep.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Implement arch disable/enable irq hooks.
Scott Wood [Wed, 12 Dec 2007 17:35:19 +0000 (04:35 +1100)]
[POWERPC] Implement arch disable/enable irq hooks.

These hooks ensure that a decrementer interrupt is not pending when
suspending; otherwise, problems may occur on 6xx/7xx/7xxx-based
systems (except for powermacs, which use a separate suspend path).
For example, with deep sleep on the 831x, a pending decrementer will
cause a system freeze because the SoC thinks the decrementer interrupt
would have woken the system, but the core must have interrupts
disabled due to the setup required for deep sleep.

Changed via-pmu.c to use the new ppc_md hooks, and made the arch_*
functions call the generic_* functions unconditionally.  -- paulus

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Don't leak kernel stack through an empty {i,m}box_info read
Jeremy Kerr [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: Don't leak kernel stack through an empty {i,m}box_info read

Based on an original patch from Arnd Bergmann
<arnd.bergmann@de.ibm.com>

If there's no entry in the mailbox, then a read on the _info file will
return data from an uninitialised variable.

This change returns EOF if there's no mailbox info available instead.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: DMA Restart after SIGSEGV
Andre Detsch [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: DMA Restart after SIGSEGV

This fixes the behavior of spufs when a spu tries a DMA operation
based on a wrong / unavailable address.

Instead of just generating a SIGBUS signal, spufs now
generates a SIGSEGV signal and restarts the problematic DMA operation
after the execution of the application's signal handler.  This allows
applications to employ user-level paging systems.

Although the restart_dma function is called before the application's
signal handler, the operation is not actually performed at this time,
since the spu context is already stopped.  The operation only takes
place when spu_run is restarted (which happens automatically).

Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Use separate timer for /proc/spu_loadavg calculation
Aegis Lin [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: Use separate timer for /proc/spu_loadavg calculation

The original spusched_timer was designed to take effect only when
a context is waiting in the runqueue.

This change adds an additional lower-freq timer has been added to
purely handle the spu_load updates. The new timer will be triggered
per LOAD_FREQ ticks.

Signed-off-by: Aegis Lin <aegislin@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: make state_mutex interruptible
Christoph Hellwig [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: make state_mutex interruptible

Make most places that use spu_acquire/spu_acquire_saved interruptible,
this allows getting out of the spufs code when e.g. pressing ctrl+c.
There are a few places where we get called e.g. from spufs teardown
routines were we can't simply err out so these are left with a comment.
For now I've also not touched the poll routines because it's open what
libspe would expect in terms of interrupted system calls.

Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: add enchanced simple attr macros
Christoph Hellwig [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: add enchanced simple attr macros

The simple attr macros currently used by spufs can't deal with the
handlers returning errors, which is required to make the state_mutex
interruptible.  This adds a local copy that allows for an error
return from the get/set handlers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: decouple spu scheduler from spufs_spu_run (asynchronous scheduling)
Luke Browning [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: decouple spu scheduler from spufs_spu_run (asynchronous scheduling)

Change spufs_spu_run so that the context is queued directly to the
scheduler and the controlling thread advances directly to spufs_wait()
for spe errors and exceptions.

nosched contexts are treated the same as before.

Fixes from Christoph Hellwig <hch@lst.de>

Signed-off-by: Luke Browning <lukebr@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: don't set reserved bits in spu interrupt status
Masato Noguchi [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: don't set reserved bits in spu interrupt status

This changes the spu context switch code to not write to reserved bits
of spu interrupt status register.
The architecture book says the reserved fields should be set to zero.

Signed-off-by: Masato Noguchi <Masato.Noguchi@jp.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: spu_find_victim may choose wrong victim
Luke Browning [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: spu_find_victim may choose wrong victim

Need to re-check priority after dropping lock.  Otherwise, a
more favored context may be preempted.

Signed-off-by: Luke Browning <lukebr@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: reorganize spu_run_init
Luke Browning [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: reorganize spu_run_init

This cleans up spu_run_init so that it does all of the spu
initialization for spufs_run_spu.  It initializes the spu context as
much as possible before it activates the spu and writes the runcntl
register.

Signed-off-by: Luke Browning <lukebr@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: rework class 0 and 1 interrupt handling
Jeremy Kerr [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: rework class 0 and 1 interrupt handling

Based on original patches from
 Arnd Bergmann <arnd.bergman@de.ibm.com>; and
 Luke Browning <lukebr@linux.vnet.ibm.com>

Currently, spu contexts need to be loaded to the SPU in order to take
class 0 and class 1 exceptions.

This change makes the actual interrupt-handlers much simpler (ie,
set the exception information in the context save area), and defers the
handling code to the spufs_handle_class[01] functions, called from
spufs_run_spu.

This should improve the concurrency of the spu scheduling leading to
greater SPU utilization when SPUs are overcommited.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: use #defines for SPU class [012] exception status
Jeremy Kerr [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: use #defines for SPU class [012] exception status

Add a few #defines for the class 0, 1 and 2 interrupt status bits, and
use them instead of magic numbers when we're setting or checking for
these interrupts.

Also, add a #define for the class 2 mailbox threshold interrupt mask.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: fix incorrect interrupt status clearing in backing mbox stat poll
Jeremy Kerr [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: fix incorrect interrupt status clearing in backing mbox stat poll

When doing a poll on the mbox stat file of a swapped-out context, we
clear the class 0 interrupt status, rather than the class 2 interrupt
status.

This change corrects the poll operation to clear the correct interrupt.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: add backing ops for privcntl register
Luke Browning [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: add backing ops for privcntl register

This change encapsulates the spu_privcntl_RW register so that it can
be written through backing ops.  This is necessary so that spu contexts
can be initialized and queued to the scheduler in spufs_run_spu.

Signed-off-by: Luke Browning <lukebr@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: block fault handlers in spu_acquire_runnable
Arnd Bergmann [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: block fault handlers in spu_acquire_runnable

This change disables the logic that faults-in spu contexts under the
covers from the page fault handler.  When a fault requires a runnable
context, the handler will block until the context is scheduled by
other means.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: move fault, lscsa_alloc and switch code to spufs module
Jeremy Kerr [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: move fault, lscsa_alloc and switch code to spufs module

Currently, part of the spufs code (switch.o, lscsa_alloc.o and fault.o)
is compiled directly into the kernel.

This change moves these components of spufs into the kernel.

The lscsa and switch objects are fairly straightforward to move in.

For the fault.o module, we split the fault-handling code into two
parts: a/p/p/c/spu_fault.c and a/p/p/c/spufs/fault.c. The former is for
the in-kernel spu_handle_mm_fault function, and we move the rest of the
fault-handling code into spufs.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: fix typos in sched.c comments
Julio M. Merino Vidal [Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)]
[POWERPC] spufs: fix typos in sched.c comments

Fix a few typos in the spufs scheduler comments

Signed-off-by: Julio M. Merino Vidal <jmerino@ac.upc.edu>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] cell: wrap master run control bit
Masato Noguchi [Wed, 5 Dec 2007 02:49:31 +0000 (13:49 +1100)]
[POWERPC] cell: wrap master run control bit

Add platform specific SPU run control routines to the spufs.  The current
spufs implementation uses the SPU master run control bit (MFC_SR1[S]) to
control SPE execution, but the PS3 hypervisor does not support the use of
this feature.

This change adds the run control wrapper routies spu_enable_spu() and
spu_disable_spu().  The bare metal routines use the master run control
bit, and the PS3 specific routines use the priv2 run control register.

An outstanding enhancement for the PS3 would be to add a guard to check
for incorrect access to the spu problem state when the spu context is
disabled.  This check could be implemented with a flag added to the spu
context that would inhibit mapping problem state pages, and a routine
to unmap spu problem state pages.  When the spu is enabled with
ps3_enable_spu() the flag would be set allowing pages to be mapped,
and when the spu is disabled with ps3_disable_spu() the flag would be
cleared and mapped problem state pages would be unmapped.

Signed-off-by: Masato Noguchi <Masato.Noguchi@jp.sony.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Optimize counting distinct entries in the relocation sections
Emil Medve [Tue, 13 Nov 2007 16:24:04 +0000 (03:24 +1100)]
[POWERPC] Optimize counting distinct entries in the relocation sections

When a module has relocation sections with tens of thousands of
entries, counting the distinct/unique entries only (i.e. no
duplicates) at load time can take tens of seconds and up to minutes.
The sore point is the count_relocs() function which is called as part
of the architecture specific module loading processing path:

-> load_module() generic
   -> module_frob_arch_sections() arch specific
      -> get_plt_size() 32-bit
      -> get_stubs_size() 64-bit
 -> count_relocs()

Here count_relocs is being called to find out how many distinct
targets of R_PPC_REL24 relocations there are, since each distinct
target needs a PLT entry or a stub created for it.

The previous counting algorithm has O(n^2) complexity.  Basically two
solutions were proposed on the e-mail list: a hash based approach and
a sort based approach.

The hash based approach is the fastest (O(n)) but the has it needs
additional memory and for certain corner cases it could take lots of
memory due to the degeneration of the hash.  One such proposal was
submitted here:

http://ozlabs.org/pipermail/linuxppc-dev/2007-June/037641.html

The sort based approach is slower (O(n * log n + n)) but if the
sorting is done "in place" it doesn't need additional memory.
This has O(n + n * log n) complexity with no additional memory
requirements.

This commit implements the in-place sort option.

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agoLinux 2.6.24-rc6
Linus Torvalds [Fri, 21 Dec 2007 01:25:48 +0000 (17:25 -0800)]
Linux 2.6.24-rc6

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
Linus Torvalds [Fri, 21 Dec 2007 01:02:37 +0000 (17:02 -0800)]
Merge git://git./linux/kernel/git/x86/linux-2.6-x86

* git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86:
  x86: intel_cacheinfo.c: cpu cache info entry for Intel Tolapai
  x86: fix die() to not be preemptible

16 years agoMerge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
Linus Torvalds [Fri, 21 Dec 2007 01:02:22 +0000 (17:02 -0800)]
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6

* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6:
  [XFS] Initialise current offset in xfs_file_readdir correctly
  [XFS] Fix mknod regression

16 years ago[XFS] Initialise current offset in xfs_file_readdir correctly
Lachlan McIlroy [Fri, 21 Dec 2007 00:00:23 +0000 (11:00 +1100)]
[XFS] Initialise current offset in xfs_file_readdir correctly

After reading the directory contents into the temporary buffer, we grab
each dirent and pass it to filldir witht eh current offset of the dirent.
The current offset was not being set for the first dirent in the temporary
buffer, which coul dresult in bad offsets being set in the f_pos field
result in looping and duplicate entries being returned from readdir.

SGI-PV: 974905
SGI-Modid: xfs-linux-melb:xfs-kern:30282a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
16 years ago[XFS] Fix mknod regression
Christoph Hellwig [Thu, 20 Dec 2007 23:58:56 +0000 (10:58 +1100)]
[XFS] Fix mknod regression

This was broken by my '[XFS] simplify xfs_create/mknod/symlink prototype',
which assigned the re-shuffled ondisk dev_t back to the rdev variable in
xfs_vn_mknod. Because of that i_rdev is set to the ondisk dev_t instead of
the linux dev_t later down the function.

Fortunately the fix for it is trivial: we can just remove the assignment
because xfs_revalidate_inode has done the proper job before unlocking the
inode.

SGI-PV: 974873
SGI-Modid: xfs-linux-melb:xfs-kern:30273a

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
16 years agox86: intel_cacheinfo.c: cpu cache info entry for Intel Tolapai
Jason Gaston [Fri, 21 Dec 2007 00:27:19 +0000 (01:27 +0100)]
x86: intel_cacheinfo.c: cpu cache info entry for Intel Tolapai

This patch adds a cpu cache info entry for the Intel Tolapai cpu.

Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: fix die() to not be preemptible
Ingo Molnar [Fri, 21 Dec 2007 00:27:19 +0000 (01:27 +0100)]
x86: fix die() to not be preemptible

Andrew "Eagle Eye" Morton noticed that we use raw_local_save_flags()
instead of raw_local_irq_save(flags) in die(). This allows the
preemption of oopsing contexts - which is highly undesirable. It also
causes CONFIG_DEBUG_PREEMPT to complain, as reported by Miles Lane.

this bug was introduced via:

  commit 39743c9ef717fd4f2b5583f010115c5f2482b8ae
  Author: Andi Kleen <ak@suse.de>
  Date:   Fri Oct 19 20:35:03 2007 +0200

      x86: use raw locks during oopses

-               spin_lock_irqsave(&die.lock, flags);
+               __raw_spin_lock(&die.lock);
+               raw_local_save_flags(flags);

that is not a correct open-coding of spin_lock_irqsave(): both the
ordering is wrong (irqs should be disabled _first_), and the wrong
flags-saving API was used.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched
Linus Torvalds [Thu, 20 Dec 2007 19:53:41 +0000 (11:53 -0800)]
Merge git://git./linux/kernel/git/mingo/linux-2.6-sched

* git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched:
  debug: add end-of-oops marker
  sched: rt: account the cpu time during the tick

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
Linus Torvalds [Thu, 20 Dec 2007 19:25:22 +0000 (11:25 -0800)]
Merge git://git./linux/kernel/git/agk/linux-2.6-dm

* git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm:
  dm crypt: use bio_add_page
  dm: merge max_hw_sector
  dm: trigger change uevent on rename
  dm crypt: fix write endio
  dm mpath: hp requires scsi
  dm: table detect io beyond device

16 years agodm crypt: use bio_add_page
Milan Broz [Thu, 13 Dec 2007 14:16:10 +0000 (14:16 +0000)]
dm crypt: use bio_add_page

Fix possible max_phys_segments violation in cloned dm-crypt bio.

In write operation dm-crypt needs to allocate new bio request
and run crypto operation on this clone. Cloned request has always
the same size, but number of physical segments can be increased
and violate max_phys_segments restriction.

This can lead to data corruption and serious hardware malfunction.
This was observed when using XFS over dm-crypt and at least
two HBA controller drivers (arcmsr, cciss) recently.

Fix it by using bio_add_page() call (which tests for other
restrictions too) instead of constructing own biovec.

All versions of dm-crypt are affected by this bug.

Cc: stable@kernel.org
Cc: dm-crypt@saout.de
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
16 years agodm: merge max_hw_sector
Neil Brown [Thu, 13 Dec 2007 14:16:04 +0000 (14:16 +0000)]
dm: merge max_hw_sector

Make sure dm honours max_hw_sectors of underlying devices

  We still have no firm testing evidence in support of this patch but
  believe it may help to resolve some bug reports.  - agk

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
16 years agodm: trigger change uevent on rename
Alasdair G Kergon [Thu, 13 Dec 2007 14:15:57 +0000 (14:15 +0000)]
dm: trigger change uevent on rename

Insert a missing KOBJ_CHANGE notification when a device is renamed.

Cc: Scott James Remnant <scott@ubuntu.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
16 years agodm crypt: fix write endio
Milan Broz [Thu, 13 Dec 2007 14:15:51 +0000 (14:15 +0000)]
dm crypt: fix write endio

Fix BIO_UPTODATE test for write io.

Cc: stable@kernel.org
Cc: dm-crypt@saout.de
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
16 years agodm mpath: hp requires scsi
Paul Mundt [Thu, 13 Dec 2007 14:15:43 +0000 (14:15 +0000)]
dm mpath: hp requires scsi

With CONFIG_SCSI=n __scsi_print_sense() is never linked in.

drivers/built-in.o: In function `hp_sw_end_io':
dm-mpath-hp-sw.c:(.text+0x914f8): undefined reference to `__scsi_print_sense'

Caught with a randconfig on current git.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
16 years agodm: table detect io beyond device
Jun'ichi Nomura [Thu, 13 Dec 2007 14:15:25 +0000 (14:15 +0000)]
dm: table detect io beyond device

This patch fixes a panic on shrinking a DM device if there is
outstanding I/O to the part of the device that is being removed.
(Normally this doesn't happen - a filesystem would be resized first,
for example.)

The bug is that __clone_and_map() assumes dm_table_find_target()
always returns a valid pointer.  It may fail if a bio arrives from the
block layer but its target sector is no longer included in the DM
btree.

This patch appends an empty entry to table->targets[] which will
be returned by a lookup beyond the end of the device.

After calling dm_table_find_target(), __clone_and_map() and target_message()
check for this condition using
dm_target_is_valid().

Sample test script to trigger oops:

16 years agomm: fix exit_mmap BUG() on a.out binary exit
Ivan Kokshaysky [Thu, 20 Dec 2007 08:47:07 +0000 (11:47 +0300)]
mm: fix exit_mmap BUG() on a.out binary exit

The problem was introduced by commit "mm: variable length argument
support" (b6a2fea39318e43fee84fa7b0b90d68bed92d2ba)
as it didn't update fs/binfmt_aout.c like other binfmt's.

I noticed that on alpha when accidentally launched old OSF/1
Acrobat Reader binary. Obviously, other architectures are affected
as well.

Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Ollie Wild <aaw@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agodebug: add end-of-oops marker
Arjan van de Ven [Thu, 20 Dec 2007 14:01:17 +0000 (15:01 +0100)]
debug: add end-of-oops marker

Right now it's nearly impossible for parsers that collect kernel crashes
from logs or emails (such as www.kerneloops.org) to detect the
end-of-oops condition. In addition, it's not currently possible to
detect whether or not 2 oopses that look alike are actually the same
oops reported twice, or are truly two unique oopses.

This patch adds an end-of-oops marker, and makes the end marker include
a very simple 64-bit random ID to be able to detect duplicate reports.

Normally, this ID is calculated as a late_initcall() (in the hope that
at that time there is enough entropy to get a unique enough ID); however
for early oopses the oops_exit() function needs to generate the ID on
the fly.

We do this all at the _end_ of an oops printout, so this does not impact
our ability to get the most important portions of a crash out to the
console first.

[ Sidenote: the already existing oopses-since-bootup counter we print
  during crashes serves as the differentiator between multiple oopses
  that trigger during the same bootup. ]

Tested on 32-bit and 64-bit x86. Artificially injected very early
crashes as well, as expected they result in this constant ID after
multiple bootups:

  ---[ end trace ca143223eefdc828 ]---
  ---[ end trace ca143223eefdc828 ]---

because the random pools are still all zero. But it all still works
fine and causes no additional problems (which is the main goal of
instrumentation code).

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: rt: account the cpu time during the tick
Peter Zijlstra [Thu, 20 Dec 2007 14:01:17 +0000 (15:01 +0100)]
sched: rt: account the cpu time during the tick

Realtime tasks would not account their runtime during ticks. Which would lead
to:

        struct sched_param param = { .sched_priority = 10 };
        pthread_setschedparam(pthread_self(), SCHED_FIFO, &param);

while (1) ;

Not showing up in top.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years ago[POWERPC] cell/cbe_regs.c: Add missing of_node_put
Julia Lawall [Thu, 13 Dec 2007 23:56:16 +0000 (15:56 -0800)]
[POWERPC] cell/cbe_regs.c: Add missing of_node_put

There should be an of_node_put when breaking out of a loop that iterates
using for_each_node_by_type.

This was detected and fixed using the following semantic patch.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
identifier d;
type T;
expression e;
iterator for_each_node_by_type;
@@

T *d;
...
for_each_node_by_type(d,...)
  {... when != of_node_put(d)
       when != e = d
(
   return d;
|
+  of_node_put(d);
?  return ...;
)
...}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Christian Krafft <krafft@de.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Erb <djerb@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] arch/powerpc: Add missing of_node_put
Julia Lawall [Thu, 13 Dec 2007 23:56:15 +0000 (15:56 -0800)]
[POWERPC] arch/powerpc: Add missing of_node_put

There should be an of_node_put when breaking out of a loop that iterates
over calls to of_find_all_nodes, as this function does an of_node_get on
the value it returns.

This was fixed using the following semantic patch.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
identifier d;
expression e;
@@

T *d;
...
for (d = NULL; (d = of_find_all_nodes(d)) != NULL; )
 {... when != of_node_put(d)
      when != e = d
(
   return d;
|
+  of_node_put(d);
?  return ...;
)
...}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] arch/ppc: Remove an unnecessary pci_dev_put
Julia Lawall [Thu, 13 Dec 2007 23:56:07 +0000 (15:56 -0800)]
[POWERPC] arch/ppc: Remove an unnecessary pci_dev_put

Remove an unnecessary pci_dev_put.  pci_dev_put is called implicitly
by the subsequent call to pci_get_device.

The problem was detected using the following semantic patch, and
corrected by hand.

@@
expression dev;
expression E;
@@

- pci_dev_put(dev)
   ... when != dev = E
- pci_get_device(...,dev)

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] arch/ppc: Remove duplicate includes
Lucas Woods [Thu, 13 Dec 2007 23:56:06 +0000 (15:56 -0800)]
[POWERPC] arch/ppc: Remove duplicate includes

Signed-off-by: Lucas Woods <woodzy@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] arch/powerpc: Remove duplicate includes
Lucas Woods [Thu, 13 Dec 2007 23:56:06 +0000 (15:56 -0800)]
[POWERPC] arch/powerpc: Remove duplicate includes

Signed-off-by: Lucas Woods <woodzy@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Don't cast a struct pointer to list_head pointer
Li Zefan [Thu, 6 Dec 2007 09:33:14 +0000 (20:33 +1100)]
[POWERPC] Don't cast a struct pointer to list_head pointer

The casting is safe only when the list_head member is the first member
of the structure, and even then it is better to use the address of the
list_head structure member.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] CHRP: Fix possible NULL pointer dereference
Cyrill Gorcunov [Fri, 23 Nov 2007 05:43:04 +0000 (16:43 +1100)]
[POWERPC] CHRP: Fix possible NULL pointer dereference

This fixes a possible NULL pointer dereference inside of strncmp() if
of_get_property() fails.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Stop the TOC overflowing for large builds
Stephen Rothwell [Wed, 7 Nov 2007 05:13:29 +0000 (16:13 +1100)]
[POWERPC] Stop the TOC overflowing for large builds

We were using -mno-minimal-toc on everything in arch/powerpc/kernel,
which means that all the functions in there were putting all their
TOC entries in the top-level TOC, and it was overflowing on an
allyesconfig build.  For various reasons, prom_init.c does need
-mno-minimal-toc, but the other .c files in there can use sub-TOCs
quite happily.  This change is sufficient for now to stop the TOC
overflowing; other directories under arch/powerpc also use
-mno-minimal-toc and could also be changed later if necessary.

Lmbench runs with and without this patch showed no significant speed
differences.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fix PCI IRQ fallback code to not map IRQ 0
Benjamin Herrenschmidt [Thu, 20 Dec 2007 04:10:02 +0000 (15:10 +1100)]
[POWERPC] Fix PCI IRQ fallback code to not map IRQ 0

The PCI IRQ code has a fallback when the device-tree parsing fails, that
tries to map the interrupt indicated by PCI_INTERRUPT_LINE if the firmware
set something in there. This is a bit fragile but has proven useful in some
cases so far. However, it's causing us to incorrectly try to map interrupt 0
on various setups, so let's prevent that case, as none of the cases where
the fallback is legit should have an IRQ 0.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Disable PCI IO/Mem on a device when resources can't be allocated
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:55:05 +0000 (14:55 +1100)]
[POWERPC] Disable PCI IO/Mem on a device when resources can't be allocated

This patch changes the PowerPC PCI code to disable IO and/or Memory
decoding on a PCI device when a resource of that type failed to be
allocated.  This is done to avoid having unallocated dangling BARs
enabled that might try to decode on top of other devices.

If a proper resource is assigned later on, then pci_enable_device()
will take care of re-enabling decoding.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fixup skipping of PowerMac PCI<->PCI bridge "closed" resources
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:55:04 +0000 (14:55 +1100)]
[POWERPC] Fixup skipping of PowerMac PCI<->PCI bridge "closed" resources

Apple firmware has a strange way to "close" bridge resources by setting
them to some bogus values that overlap RAM (strangely, I haven't seen it
conflicting with DMA so far...).  This explicitely closes them to avoid
problems.  Previously, they would be closed as a consequence of failing
to be allocated, but this makes it more explicit, and thus the log
message is more explicit too.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Improve resource setup of PowerMac G5 HT bridge
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:55:02 +0000 (14:55 +1100)]
[POWERPC] Improve resource setup of PowerMac G5 HT bridge

The device node for the HT bridge on G5s doesn't contain useful ranges.

We used to give it a bunch of the known PCI space and then punch a "hole"
in it based on where the AGP or PCIe region was.  This reworks it to
use the actual register in the bridge that controls the decoding instead.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Enable self-view of the HT host bridge on PowerMac G5
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:55:01 +0000 (14:55 +1100)]
[POWERPC] Enable self-view of the HT host bridge on PowerMac G5

This enables the PCI code to see the device that represents the
HT host bridge on the PowerMac G5.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Various fixes to pcibios_enable_device()
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:55:00 +0000 (14:55 +1100)]
[POWERPC] Various fixes to pcibios_enable_device()

Our implementation of pcibios_enable_device() has a couple of problems.

One is that it should not check IORESOURCE_UNSET, as this might be
left dangling after resource assignment (shouldn't but there are
bugs), but instead, we make it check resource->parent which should
be a reliable indication that the resource has been successfully
claimed (it's in the resource tree).

Then, we also need to skip ROM resources that haven't been enabled
as x86 does.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Clear pci_probe_only on 64 bits PowerMac
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:58 +0000 (14:54 +1100)]
[POWERPC] Clear pci_probe_only on 64 bits PowerMac

It should now be safe to re-assign unassigned resources on 64 bits PowerMac
machines (G5s).  This clears pci_probe_only on those.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fixup powermac enable device hook
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:57 +0000 (14:54 +1100)]
[POWERPC] Fixup powermac enable device hook

Powermac's use of the pcibios_enable_device_hook() got slightly
broken by the recent PCI merge in that it won't be called for
the "initial" case of assigning resources to a previously
unassigned device.  This was an abuse of that hook anyway, so
instead we now use a header quirk.

While at it, we move a #ifdef CONFIG_PPC32 to enclose more code
that is only ever used on 32 bits.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Merge 32 and 64 bits pcibios_enable_device
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:57 +0000 (14:54 +1100)]
[POWERPC] Merge 32 and 64 bits pcibios_enable_device

This merge the two implementations, based on the previously
fixed up 32 bits one.  The pcibios_enable_device_hook in ppc_md
is now available for ppc64 use.  Also remove the new unused
"initial" parameter from it and fixup users.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Updates/fixes to 32 bits pcibios_enable_device()
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:56 +0000 (14:54 +1100)]
[POWERPC] Updates/fixes to 32 bits pcibios_enable_device()

Our implementation of pcibios_enable_device() incorrectly ignores
the mask argument and always checks that all resources have been
allocated, which isn't the right thing to do anymore.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] fix iSeries PCI resource management
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:55 +0000 (14:54 +1100)]
[POWERPC] fix iSeries PCI resource management

The way iSeries manages PCI IO and Memory resources is a bit strange
and is based on overriding the content of those resources with home
cooked ones afterward.

This changes it a bit to better integrate with the new resource handling
so that the "virtual" tokens that iSeries replaces resources with are
done from the proper per-device fixup hook, and bridge resources are
set to enclose that token space.  This fixes various things such as
the output of /proc/iomem & ioports, among others.  This also fixes up
various boot messages as well.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Merge PCI resource allocation & assignment
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:53 +0000 (14:54 +1100)]
[POWERPC] Merge PCI resource allocation & assignment

The 32 bits PCI code now uses the generic code for assigning unassigned
resources and an algorithm similar to x86 for claiming existing ones.

This works far better than the 64 bits code which basically can only
claim existing ones (pci_probe_only=1) or would fall apart completely.

This merges them so that the new 32 bits implementation is used for both.

64 bits now gets the new PCI flags for controlling the behaviour, though
the old pci_probe_only global is still there for now to be cleared if you
want to.

I kept a pcibios_claim_one_bus() function mostly based on the old 64
bits code for use by the DLPAR hotplug. This will have to be cleaned
up, thought I hope it will work in the meantime.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Merge PCI resource fixups
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:51 +0000 (14:54 +1100)]
[POWERPC] Merge PCI resource fixups

The PCI code in 32 and 64 bits fixes up resources differently.

32 bits uses a header quirk plus handles bridges in pcibios_fixup_bus()
while 64 bits does things in various places depending on whether you
are using OF probing, using PCI hotplug, etc...

This merges those by basically using the 32 bits approach for both,
with various tweaks to make 64 bits work with the new approach.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Merge pcibios_resource_to_bus/bus_to_resource
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:50 +0000 (14:54 +1100)]
[POWERPC] Merge pcibios_resource_to_bus/bus_to_resource

This merges the PowerPC 32 and 64 bits version of pcibios_resource_to_bus
and pcibios_bus_to_resource().

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] pci32: Add platform option to enable /proc PCI domains
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:49 +0000 (14:54 +1100)]
[POWERPC] pci32: Add platform option to enable /proc PCI domains

This adds flags the platforms can use to enable domain numbers
in /proc/bus/pci.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] pci32: Remove obsolete PowerMac bus number hack
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:48 +0000 (14:54 +1100)]
[POWERPC] pci32: Remove obsolete PowerMac bus number hack

The 32 bits PCI code carries an old hack that was only useful for G5
machines.  Nowdays, the 32 bits kernel doesn't support any of those
machines anymore so the hack is basically never used, so remove it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] pci32: Add flags modifying the PCI code behaviour
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:46 +0000 (14:54 +1100)]
[POWERPC] pci32: Add flags modifying the PCI code behaviour

This adds to the 32 bits PCI code some flags, replacing the old
pci_assign_all_busses global, that allow us to control various
aspects of the PCI probing, such as whether to re-assign all
resources or not, or to not try to assign anything at all.

This also adds the flag x86 already has to avoid ISA alignment
on bridges that don't have ISA forwarding enabled (no legacy
devices on the top level bus) and sets it for PowerMacs.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] pci32: Remove PowerMac P2P bridge IO hack
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:44 +0000 (14:54 +1100)]
[POWERPC] pci32: Remove PowerMac P2P bridge IO hack

The 32 bits PowerPC PCI code has a hack for use by some PowerMacs
to try to re-open PCI<->PCI bridge IO resources that were closed
by the firmware.  This is no longer necessary as the generic code
will now do that for us.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] pci32: Use generic pci_assign_unassign_resources
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:43 +0000 (14:54 +1100)]
[POWERPC] pci32: Use generic pci_assign_unassign_resources

This makes the 32 bits PowerPC PCI code use the generic code to assign
resources to devices that had unassigned or conflicting resources.

This allow us to remove the local implementation that was incomplete and
could not assign for example a PCI<->PCI bridge from scratch, which is
needed on various embedded platforms.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] pci32: Remove bogus alignment message
Benjamin Herrenschmidt [Thu, 20 Dec 2007 03:54:42 +0000 (14:54 +1100)]
[POWERPC] pci32: Remove bogus alignment message

There's a stale & bogus piece of code in 32 bits PCI code that
complains about ISA related alignment issues.  Just remove it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Use embedded dtc in kernel builds
David Gibson [Tue, 18 Dec 2007 04:07:20 +0000 (15:07 +1100)]
[POWERPC] Use embedded dtc in kernel builds

This patch alters the kernel makefiles to build dtc from the sources
embedded in the previous patch.  It also changes the
arch/powerpc/boot/wrapper script to use the embedded dtc, rather than
expecting a copy of dtc already installed on the system.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Merge dtc upstream source
David Gibson [Tue, 18 Dec 2007 04:06:42 +0000 (15:06 +1100)]
[POWERPC] Merge dtc upstream source

This incorporates a copy of dtc into the kernel source, in
arch/powerpc/boot/dtc-src.  This commit only imports the upstream
sources verbatim, a later commit will actually link it into the kernel
Makefiles and use the embedded code during the kernel build.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] holly.c: Remove unnecessary include of linux/ide.h
Olof Johansson [Mon, 17 Dec 2007 23:04:34 +0000 (10:04 +1100)]
[POWERPC] holly.c: Remove unnecessary include of linux/ide.h

There's nothing in holly.c that needs linux/ide.h, just remove it from
the list of includes.

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] include/asm-ppc/: Spelling fixes
joe@perches.com [Mon, 17 Dec 2007 19:30:15 +0000 (06:30 +1100)]
[POWERPC] include/asm-ppc/: Spelling fixes

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] arch/ppc/: Spelling fixes
joe@perches.com [Mon, 17 Dec 2007 19:30:14 +0000 (06:30 +1100)]
[POWERPC] arch/ppc/: Spelling fixes

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] include/asm-powerpc/: Spelling fixes
joe@perches.com [Mon, 17 Dec 2007 19:30:13 +0000 (06:30 +1100)]
[POWERPC] include/asm-powerpc/: Spelling fixes

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] arch/powerpc/: Spelling fixes
joe@perches.com [Mon, 17 Dec 2007 19:30:12 +0000 (06:30 +1100)]
[POWERPC] arch/powerpc/: Spelling fixes

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Implement pci_set_dma_mask() in terms of the dma_ops
Michael Ellerman [Mon, 17 Dec 2007 06:35:53 +0000 (17:35 +1100)]
[POWERPC] Implement pci_set_dma_mask() in terms of the dma_ops

PowerPC currently doesn't implement pci_set_dma_mask(), which means drivers
calling it will get the generic version in drivers/pci/pci.c.

The powerpc dma mapping ops include a dma_set_mask() hook, which luckily is
not implemented by anyone - so there is no bug in the fact that the hook
is currently never called.

However in future we'll add implementation(s) of dma_set_mask(), and so we
need pci_set_dma_mask() to call the hook.

To save adding a hook to the dma mapping ops, pci-set_consistent_dma_mask()
simply calls the dma_set_mask() hook and then copies the new mask into
dev.coherenet_dma_mask.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Optimize account_system_vtime
Milton Miller [Fri, 14 Dec 2007 04:52:20 +0000 (15:52 +1100)]
[POWERPC] Optimize account_system_vtime

We have multiple calls to has_feature being inlined, but gcc can't
be sure that the store via get_paca() doesn't alias the path to
cur_cpu_spec->feature.

Reorder to put the calls to read_purr and read_spurr adjacent to each
other.  To add a sense of consistency, reorder the remaining lines to
perform parallel steps on purr and scaled purr of each line instead of
calculating and then using one value before going on to the next.

In addition, we can tell gcc that no SPURR means no PURR.  The test is
completely hidden in the PURR case, and in the !PURR case the second test
is eliminated resulting in the simple register copy in the out-of-line
branch.

Further, gcc sees get_paca()->system_time referenced several times and
allocates a register to address it (shadowing r13) instead of caching its
value.  Reading into a local varable saves the shadow of r13 and removes
a potentially duplicate load (between the nested if and its parent).

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>