]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/log
linux-2.6-omap-h63xx.git
16 years ago[POWERPC] Include pagemap.h in asm/powerpc/tlb.h
Mathieu Desnoyers [Tue, 2 Oct 2007 20:30:04 +0000 (13:30 -0700)]
[POWERPC] Include pagemap.h in asm/powerpc/tlb.h

Fixes this powerpc build error in 2.6.22-rc6-mm1 for powerpc 64 with
CONFIG_SWAP=n :

In file included from include2/asm/tlb.h:60,
                 from /home/compudj/git/linux-2.6-lttng/arch/powerpc/mm/init_64.
c:56:
/home/compudj/git/linux-2.6-lttng/include/asm-generic/tlb.h: In function 'tlb_flush_mmu':
/home/compudj/git/linux-2.6-lttng/include/asm-generic/tlb.h:76: error: implicit declaration of function 'release_pages'
/home/compudj/git/linux-2.6-lttng/include/asm-generic/tlb.h: In function 'tlb_remove_page':
/home/compudj/git/linux-2.6-lttng/include/asm-generic/tlb.h:105: error: implicit declaration of function 'page_cache_release'
make[2]: *** [arch/powerpc/mm/init_64.o] Error 1

release_pages is declared in linux/pagemap.h, but cannot be included in
linux/swap.h because of a sparc related comment:

/* only sparc can not include linux/pagemap.h in this file
 * so leave page_cache_release and release_pages undeclared... */
#define free_page_and_swap_cache(page) \
        page_cache_release(page)
#define free_pages_and_swap_cache(pages, nr) \
        release_pages((pages), (nr), 0);

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] ppc64: support CONFIG_DEBUG_PREEMPT
Hugh Dickins [Tue, 31 Oct 2006 18:44:54 +0000 (05:44 +1100)]
[POWERPC] ppc64: support CONFIG_DEBUG_PREEMPT

Add CONFIG_DEBUG_PREEMPT support to ppc64: it was useful for testing
get_paca() preemption.  Cheat a little, just use debug_smp_processor_id()
in the debug version of get_paca(): it contains all the right checks and
reporting, though get_paca() doesn't really use smp_processor_id().

Use local_paca for what might have been called __raw_get_paca().
Silence harmless warnings from io.h and lparcfg.c with local_paca -
it is okay for iseries_lparcfg_data to be referencing shared_proc
with preemption enabled: all cpus should show the same value for
shared_proc.

Why do other architectures need TRACE_IRQFLAGS_SUPPORT for DEBUG_PREEMPT?
I don't know, ppc64 appears to get along fine without it.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Limit range of __init_ref_ok somewhat
Stephen Rothwell [Tue, 2 Oct 2007 03:37:53 +0000 (13:37 +1000)]
[POWERPC] Limit range of __init_ref_ok somewhat

This patch introduces zalloc_maybe_bootmem and uses it so that we don't
have to mark a whole (largish) routine as __init_ref_ok.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] MAINTAINERS shouldn't reference linuxppc-embedded
Mark A. Greer [Tue, 2 Oct 2007 00:24:08 +0000 (10:24 +1000)]
[POWERPC] MAINTAINERS shouldn't reference linuxppc-embedded

Powerpc patches should be posted to linuxppc-dev@ozlabs.org, so modify
MAINTAINERS to no longer reference linuxppc-embedded@ozlabs.org.

Signed-off-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Make instruction dumping work in real mode
Scott Wood [Thu, 27 Sep 2007 18:38:55 +0000 (04:38 +1000)]
[POWERPC] Make instruction dumping work in real mode

On non-book-E, exceptions execute in real mode.  If a fault happens
that leads to a register dump, the kernel currently prints XXXXXXXX
because it doesn't realize that PC is a physical address.

This patch checks whether instruction address translation is turned
on, and if not converts PC into a virtual address.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fix pci domain detection
Arnd Bergmann [Wed, 26 Sep 2007 14:02:05 +0000 (00:02 +1000)]
[POWERPC] Fix pci domain detection

The /proc/bus/pci/* files list PCI domain numbers only for
devices that claim to be on a multi-domain system. The check
for this is broken on powerpc, because the buid value is
truncated to 32 bits.

There is at least one machine (IBM QS21) that only uses
the high-order bits of the buid, so the return value
of pci_proc_domain() ends up being always zero, which
makes /proc/bus/pci useless.

Change the logic to always return '1' for a nonzero
buid value.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Add CHECK_FULL_REGS in several places in ptrace code
Roland McGrath [Mon, 24 Sep 2007 23:50:52 +0000 (09:50 +1000)]
[POWERPC] Add CHECK_FULL_REGS in several places in ptrace code

This restores the CHECK_FULL_REGS sanity check to every place that can
access the nonvolatile GPRs for ptrace.  This is already done for
native-bitwidth PTRACE_PEEKUSR, but was omitted for many other cases
(32-bit ptrace, PTRACE_GETREGS, etc.); I think there may have been more
uniform checks before that were lost in the recent cleanup of GETREGS et al.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] bootwrapper: Add PlanetCore firmware support
Scott Wood [Mon, 24 Sep 2007 20:09:49 +0000 (06:09 +1000)]
[POWERPC] bootwrapper: Add PlanetCore firmware support

This is a library that board code can use to extract information from the
PlanetCore configuration keys.  PlanetCore is used on various boards from
Embedded Planet.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] bootwrapper: Factor out dt_set_mac_address()
Scott Wood [Mon, 24 Sep 2007 20:09:11 +0000 (06:09 +1000)]
[POWERPC] bootwrapper: Factor out dt_set_mac_address()

This allows callers to set addresses one at a time when that would be more
convenient.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] boot: Simplify gunzip_finish
Milton Miller [Fri, 21 Sep 2007 23:03:52 +0000 (09:03 +1000)]
[POWERPC] boot: Simplify gunzip_finish

Call gunzip_partial to calculate the remaining length and copy the
data to the user buffer.  This makes it shorter and reduces
duplication.

Signed-off-by: Milton Miller <miltonm@bga.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] boot: Record header bytes in gunzip_start
Milton Miller [Fri, 21 Sep 2007 23:03:34 +0000 (09:03 +1000)]
[POWERPC] boot: Record header bytes in gunzip_start

Record the number of header bytes skipped in the total bytes read field.

This is needed for the initramfs parsing code to find the end of the zip file.

Signed-off-by: Milton Miller <miltonm@bga.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Make vio_bus_type static
Stephen Rothwell [Fri, 21 Sep 2007 04:32:05 +0000 (14:32 +1000)]
[POWERPC] Make vio_bus_type static

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Simplify vio_bus_init a little for legacy iSeries
Stephen Rothwell [Fri, 21 Sep 2007 04:31:02 +0000 (14:31 +1000)]
[POWERPC] Simplify vio_bus_init a little for legacy iSeries

iSeries_vio_dev was already statically initialised and we can remove
one set of #ifdef CONFIG_PPC_ISERIES guards.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Remove debug printk from vio_bus_init
Stephen Rothwell [Fri, 21 Sep 2007 04:29:28 +0000 (14:29 +1000)]
[POWERPC] Remove debug printk from vio_bus_init

As it just adds noise to the boot messages.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Implement generic time of day clocksource for powerpc
Tony Breeds [Fri, 21 Sep 2007 21:35:52 +0000 (07:35 +1000)]
[POWERPC] Implement generic time of day clocksource for powerpc

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Implement {read,update}_persistent_clock
Tony Breeds [Fri, 21 Sep 2007 03:26:02 +0000 (13:26 +1000)]
[POWERPC] Implement {read,update}_persistent_clock

With these functions implemented we cooperate better with the generic
timekeeping code.  This obsoletes the need for the timer sysdev as a bonus.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Add memory regions to the kcore list for 32-bit machines
Ed Swarthout [Fri, 21 Sep 2007 02:53:02 +0000 (12:53 +1000)]
[POWERPC] Add memory regions to the kcore list for 32-bit machines

The entries are only 32-bit, so restrict the virtual address to stay
below 0xffff_ffff.  With KERNELBASE set to 0xc000_0000, this in effect
restricts access to the first 1GB of real memory.

Make setup_kcore conditional on CONFIG_PROC_KCORE for both 32/64.

Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Disable power management for arch/ppc
Paul Mackerras [Fri, 21 Sep 2007 01:52:36 +0000 (11:52 +1000)]
[POWERPC] Disable power management for arch/ppc

Currently the prep_defconfig in arch/ppc won't build due to swsusp
being broken.  This patch avoids the problem by essentially disabling
all power management on those platforms left in arch/ppc.

Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Create and use CONFIG_WORD_SIZE
Stephen Rothwell [Fri, 21 Sep 2007 00:16:20 +0000 (10:16 +1000)]
[POWERPC] Create and use CONFIG_WORD_SIZE

Linus made this suggestion for the x86 merge and this starts the process
for powerpc.  We assume that CONFIG_PPC64 implies CONFIG_PPC_MERGE and
CONFIG_PPC_STD_MMU_32 implies CONFIG_PPC_STD_MMU.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Separate out legacy machine check exception parsers
Olof Johansson [Thu, 20 Sep 2007 19:11:20 +0000 (05:11 +1000)]
[POWERPC] Separate out legacy machine check exception parsers

Move out the old-style exception parsers to a separate function, and
don't call it on platforms that have a platform-specific handler.

It would make sense to move out the generic versions into their platforms
instead, but that can be done gradually down the road.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] clk.h interface for platforms
Domen Puncer [Thu, 20 Sep 2007 14:00:11 +0000 (00:00 +1000)]
[POWERPC] clk.h interface for platforms

This provides an implementation of the <linux/clk.h> interface for
arch/powerpc using a set of function pointers in clk_functions.
Platforms that want to support this interface should fill
clk_functions and select CONFIG_PPC_CLOCK in Kconfig.

Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Inline u3msi_compose_msi_msg()
Michael Ellerman [Thu, 20 Sep 2007 06:36:51 +0000 (16:36 +1000)]
[POWERPC] Inline u3msi_compose_msi_msg()

In the MPIC U3 MSI code, we call u3msi_compose_msi_msg() once for each MSI.
This is overkill, as the address is per pci device, not per MSI. So setup
the address once, and just set the data per MSI.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Simplify rtas_change_msi() error semantics
Michael Ellerman [Thu, 20 Sep 2007 06:36:50 +0000 (16:36 +1000)]
[POWERPC] Simplify rtas_change_msi() error semantics

Currently rtas_change_msi() returns either the error code from RTAS, or if
the RTAS call succeeded the number of irqs that were configured by RTAS.
This makes checking the return value more complicated than it needs to be.

Instead, have rtas_change_msi() check that the number of irqs configured by
RTAS is equal to what we requested - and return an error otherwise. This makes
the return semantics match the usual 0 for success, something else for error.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Simplify error logic in rtas_setup_msi_irqs()
Michael Ellerman [Thu, 20 Sep 2007 06:36:48 +0000 (16:36 +1000)]
[POWERPC] Simplify error logic in rtas_setup_msi_irqs()

rtas_setup_msi_irqs() doesn't need to call teardown() itself, the
generic code will do this for us as long as we return a non-zero
value.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Simplify error logic in u3msi_setup_msi_irqs()
Michael Ellerman [Thu, 20 Sep 2007 06:36:47 +0000 (16:36 +1000)]
[POWERPC] Simplify error logic in u3msi_setup_msi_irqs()

u3msi_setup_msi_irqs() doesn't need to call teardown() itself,
the generic code will do this for us as long as we return a non
zero value.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Make sure to of_node_get() the result of pci_device_to_OF_node()
Michael Ellerman [Mon, 17 Sep 2007 06:03:45 +0000 (16:03 +1000)]
[POWERPC] Make sure to of_node_get() the result of pci_device_to_OF_node()

pci_device_to_OF_node() returns the device node attached to a PCI device,
but doesn't actually grab a reference - we need to do it ourselves.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Move embedded6xx into multiplatform
Arnd Bergmann [Wed, 29 Aug 2007 23:11:24 +0000 (09:11 +1000)]
[POWERPC] Move embedded6xx into multiplatform

The various embedded 6xx systems can easily coexist in one kernel
together with the other 6xx based systems, so there is no strict
reason to keep them separate.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] pseries: device node status can be "ok" or "okay"
Linas Vepstas [Thu, 9 Aug 2007 23:27:00 +0000 (09:27 +1000)]
[POWERPC] pseries: device node status can be "ok" or "okay"

It seems that some versions of firmware will report a device
node status as the string "okay". As we are not expecting this
string, the device node will be ignored by the EEH subsystem.
Which means EEH will not be enabled.

When EEH is not enabled, PCI errors will be converted into
Machine Check exceptions, and we'll have a very unhappy system.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fix build errors when BLOCK=n
Emil Medve [Thu, 20 Sep 2007 02:25:17 +0000 (12:25 +1000)]
[POWERPC] Fix build errors when BLOCK=n

These are the symptom error messages:

  CC      arch/powerpc/kernel/setup_32.o
In file included from include/linux/blkdev.h:17,
                 from include/linux/ide.h:13,
                 from arch/powerpc/kernel/setup_32.c:13:
include/linux/bsg.h:67: warning: 'struct request_queue' declared inside parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside parameter list
In file included from arch/powerpc/kernel/setup_32.c:13:
include/linux/ide.h:857: error: field 'wrq' has incomplete type

  CC      arch/powerpc/kernel/ppc_ksyms.o
In file included from include/linux/blkdev.h:17,
                 from include/linux/ide.h:13,
                 from arch/powerpc/kernel/ppc_ksyms.c:15:
include/linux/bsg.h:67: warning: 'struct request_queue' declared inside parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside parameter list
In file included from arch/powerpc/kernel/ppc_ksyms.c:15:
include/linux/ide.h:857: error: field 'wrq' has incomplete type

The fix tries to use the smallest scope CONFIG_* symbols that will fix
the build problem.  In this case <linux/ide.h> needs to be included
only if IDE=y or IDE=m were selected.  Also, ppc_ide_md is needed only
if BLK_DEV_IDE=y or BLK_DEV_IDE=m

Moved the EXPORT_SYMBOL(ppc_ide_md) from ppc_ksysms.c next to its
declaration in setup_32.c which made <linux/ide.h> not needed. With
<linux/ide.h> gone from ppc_ksyms.c, <asm/cacheflush.h> is needed to
address the following warnings and errors:

  CC      arch/powerpc/kernel/ppc_ksyms.o
arch/powerpc/kernel/ppc_ksyms.c:122: error: '__flush_icache_range' undeclared here (not in a function)
arch/powerpc/kernel/ppc_ksyms.c:122: warning: type defaults to 'int' in declaration of '__flush_icache_range'
arch/powerpc/kernel/ppc_ksyms.c:123: error: 'flush_dcache_range' undeclared here (not in a function)
arch/powerpc/kernel/ppc_ksyms.c:123: warning: type defaults to 'int' in declaration of 'flush_dcache_range'

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fix platinumfb framebuffer
Benjamin Herrenschmidt [Wed, 19 Sep 2007 04:50:22 +0000 (14:50 +1000)]
[POWERPC] Fix platinumfb framebuffer

Current kernels have a non-working platinumfb due to some resource
management issues.  This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Avoid pointless WARN_ON(irqs_disabled()) from panic codepath
Satyam Sharma [Mon, 17 Sep 2007 23:43:40 +0000 (09:43 +1000)]
[POWERPC] Avoid pointless WARN_ON(irqs_disabled()) from panic codepath

> ------------[ cut here ]------------
> Badness at arch/powerpc/kernel/smp.c:202

comes when smp_call_function_map() has been called with irqs disabled,
which is illegal. However, there is a special case, the panic() codepath,
when we do not want to warn about this -- warning at that time is pointless
anyway, and only serves to scroll away the *real* cause of the panic and
distracts from the real bug.

* So let's extract the WARN_ON() from smp_call_function_map() into all its
  callers -- smp_call_function() and smp_call_function_single()

* Also, introduce another caller of smp_call_function_map(), namely
  __smp_call_function() (and make smp_call_function() a wrapper over this)
  which does *not* warn about disabled irqs

* Use this __smp_call_function() from the panic codepath's smp_send_stop()

We also end having to move code of smp_send_stop() below the definition
of __smp_call_function().

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Support setting affinity for U3/U4 MSI sources
Olof Johansson [Mon, 17 Sep 2007 20:12:29 +0000 (06:12 +1000)]
[POWERPC] Support setting affinity for U3/U4 MSI sources

Hook up affinity-setting for U3/U4 MSI interrupt sources.

Tested on Quad G5 with myri10ge.

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] add Kconfig option for optimizing for cell
Arnd Bergmann [Sat, 15 Sep 2007 00:21:57 +0000 (10:21 +1000)]
[POWERPC] add Kconfig option for optimizing for cell

Since the PPE on cell is an in-order core, it suffers significantly
from wrong instruction scheduling.  This adds a Kconfig option that
enables passing -mtune=cell to gcc in order to generate object
code that runs well on cell.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] cell: Don't cast the result of of_get_property()
Jeremy Kerr [Fri, 14 Sep 2007 05:46:40 +0000 (15:46 +1000)]
[POWERPC] cell: Don't cast the result of of_get_property()

The cast to u32 * isn't required, of_get_property returns a void *.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Convert define_machine(mpc885_ads) to C99 initializer syntax
Tony Breeds [Wed, 12 Sep 2007 03:58:54 +0000 (13:58 +1000)]
[POWERPC] Convert define_machine(mpc885_ads) to C99 initializer syntax

Make the define_machine() block for mpc885_ads more greppable and
consistent with other examples in tree.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] mpc5200: Add cuimage support for mpc5200 boards
Grant Likely [Fri, 31 Aug 2007 17:34:37 +0000 (03:34 +1000)]
[POWERPC] mpc5200: Add cuimage support for mpc5200 boards

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] mpc8349: Add linux,network-index to ethernet nodes in device tree
Grant Likely [Thu, 30 Aug 2007 20:26:24 +0000 (06:26 +1000)]
[POWERPC] mpc8349: Add linux,network-index to ethernet nodes in device tree

cuImage needs to know the logical index of the ethernet devices in order
to assign mac addresses.  This adds the needed properties.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
CC: Scott Wood <scottwood@freescale.com>
CC: Kumar Gala <galak@kernel.crashing.org>
CC: Timur Tabi <timur@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fix ppc kernels after build-id addition
Meelis Roos [Wed, 25 Jul 2007 12:17:43 +0000 (22:17 +1000)]
[POWERPC] Fix ppc kernels after build-id addition

This patch fixes arch/ppc kernels, at least for prep subarch, after
build-id addition.  Without this, kernels were 3 times the size and
bootloader refused to load them.  Now they are back to normal again.

Tested only with Roland McGrath's "Use LDFLAGS_MODULE only for .ko
links" patch applied - boots and works fine.

Signed-off-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Prevent direct inclusion of <asm/rwsem.h>.
Robert P. J. Day [Wed, 18 Jul 2007 13:36:36 +0000 (23:36 +1000)]
[POWERPC] Prevent direct inclusion of <asm/rwsem.h>.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] adbhid: Enable KEY_FN key reporting
Aristeu Rozanski [Mon, 16 Jul 2007 20:53:09 +0000 (06:53 +1000)]
[POWERPC] adbhid: Enable KEY_FN key reporting

When a Fn key is used in combination with another key in ADB keyboards
it will generate a Fn event and then a second event that can be a
different key than pressed (Fn + F1 for instance can generate Fn +
brightness down if it's configured like that).  This enables the
reporting of the Fn key to the input system.

As Fn is a dead key for most purposes, it's useful to report it so
applications can make use of it.  One example is apple_mouse
(https://jake.ruivo.org/uinputd/trunk/apple_mouse/) that emulates the
second and third keys using a combination of keyboard keys and the mouse
button.  Other applications may use the KEY_FN as a modifier as well.
I've been updating and using this patch for months without problems.

Signed-off-by: Aristeu Rozanski <aris@ruivo.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Use __attribute__ in asm-powerpc
Mike Frysinger [Sun, 15 Jul 2007 03:36:09 +0000 (13:36 +1000)]
[POWERPC] Use __attribute__ in asm-powerpc

Pretty much everyone uses "__attribute__" or "attribute", no one uses
"__attribute".  This tweaks the three places in asm-powerpc where this
comes up.  While only asm-powerpc/types.h is interesting (for
userspace), I did asm-powerpc/processor.h as well for consistency.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Add Marvell mv64x60 udbg putc/getc functions
Dale Farnsworth [Mon, 14 May 2007 19:52:22 +0000 (05:52 +1000)]
[POWERPC] Add Marvell mv64x60 udbg putc/getc functions

Commit 69331af, "Fixes and cleanups for earlyprintk aka boot console",
resulted in printk output prior to the initialization of the mpsc
console driver not being printed.  That commit causes the mpsc's
CON_PRINTBUFFER flag to be cleared since udbg should have printed
the previous output.

I guess we can no longer ignore udbg. :)

This patch provides udbg_putc() and udbg_getc() functions for the
Marvell mv64x60 chips. These functions are enabled if an mv64x60
port is to be used as the console as determined from the device tree.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Acked-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Optionally use new device number for pmac_zilog
David Woodhouse [Wed, 4 Apr 2007 14:19:43 +0000 (00:19 +1000)]
[POWERPC] Optionally use new device number for pmac_zilog

This adds the option for the pmac_zilog driver to use the major/minor
numbers recently allocated specifically for it (/dev/ttyPZn) instead
of the /dev/ttySn numbers.  The advantage of doing this is that it
allows the pmac_zilog and 8250 drivers to coexist.  The disadvantage
of doing this is that it is a user-visible ABI change and it will
break existing working setups on powermacs, and could be confusing to
users.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Cleanups for physmap_of.c (v2)
David Gibson [Thu, 20 Sep 2007 01:22:25 +0000 (11:22 +1000)]
[POWERPC] Cleanups for physmap_of.c (v2)

This patch includes a whole batch of smallish cleanups for
drivers/mtd/physmap_of.c.

- A bunch of uneeded #includes are removed
- We switch to the modern linux/of.h etc. in place of
asm/prom.h
- Use some helper macros to avoid some ugly inline #ifdefs
- A few lines of unreachable code are removed
- A number of indentation / line-wrapping fixes
- More consistent use of kernel idioms such as if (!p) instead
of if (p == NULL)
- Clarify some printk()s and other informative strings.
- parse_obsolete_partitions() now returns 0 if no partition
information is found, instead of returning -ENOENT which the caller
had to handle specially.
- (the big one) Despite the name, this driver really has
nothing to do with drivers/mtd/physmap.c.  The fact that the flash
chips must be physically direct mapped is a constrant, but doesn't
really say anything about the actual purpose of this driver, which is
to instantiate MTD devices based on information from the device tree.
Therefore the physmap name is replaced everywhere within the file with
"of_flash".  The file itself and the Kconfig option is not renamed for
now (so that the diff is actually a diff).  That can come later.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Fix Sequoia MAL0 and EMAC dts entries.
Valentine Barshak [Tue, 18 Sep 2007 17:29:13 +0000 (03:29 +1000)]
[POWERPC] 4xx: Fix Sequoia MAL0 and EMAC dts entries.

According to PowerPC 440EPx documentation,
MAL0 is comprised of four channels (two transmit and two receive).
Each channel is dedicated to one of two EMAC cores.
This patch fixes Sequoia DTS MAL0 entry and EMAC entries,
assigning correct channel numbers to EMACs.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Fix Bamboo MAL0 dts entry.
Valentine Barshak [Tue, 18 Sep 2007 17:27:52 +0000 (03:27 +1000)]
[POWERPC] 4xx: Fix Bamboo MAL0 dts entry.

According to PowerPC 440EP documentation,
MAL0 consists of 6 channels (4 transmit channels and 2 receive channels)
This patch fixes Bamboo DTS MAL0 "num-rx-chans" entry.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] Add 64-bit resources support to pci_iomap
Valentine Barshak [Wed, 5 Sep 2007 17:30:16 +0000 (03:30 +1000)]
[POWERPC] Add 64-bit resources support to pci_iomap

The patch adds support for the 64-bit resources to the PCI
iomap code.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] Update PowerPC 4xx entry in MAINTAINERS
Josh Boyer [Thu, 20 Sep 2007 02:19:07 +0000 (21:19 -0500)]
[POWERPC] Update PowerPC 4xx entry in MAINTAINERS

Add myself as PowerPC 4xx maintainer and list the git tree

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm..com>
16 years ago[POWERPC] 4xx: Implement udbg_getc() for 440
Hollis Blanchard [Mon, 17 Sep 2007 10:56:47 +0000 (05:56 -0500)]
[POWERPC] 4xx: Implement udbg_getc() for 440

Implement udbg_getc() for 440, which fixes xmon input.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
16 years ago[POWERPC] 4xx: Convert Seqouia flash mappings to new binding
Josh Boyer [Fri, 14 Sep 2007 18:54:14 +0000 (04:54 +1000)]
[POWERPC] 4xx: Convert Seqouia flash mappings to new binding

A new binding for flash devices was recently introduced.  This updates the
Sequoia DTS to use the new binding and enabled MTD in the defconfig.

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Stefan Roese <sr@denx.de>
16 years ago[POWERPC] 4xx: Convert Walnut flash mappings to new binding
Josh Boyer [Fri, 14 Sep 2007 18:54:13 +0000 (04:54 +1000)]
[POWERPC] 4xx: Convert Walnut flash mappings to new binding

A new binding for flash devices was recently introduced.  This updates the
Walnut DTS to use the new binding.

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
16 years ago[POWERPC] Make partitions optional in physmap_of
Josh Boyer [Fri, 14 Sep 2007 18:54:12 +0000 (04:54 +1000)]
[POWERPC] Make partitions optional in physmap_of

The latest physmap_of driver has a small error where it will fail the probe
with:

physmap-flash: probe of fff00000.small-flas failed with error -2

if there are no partition subnodes in the device tree and the old style binding
is not used.  Since partition definitions are optional, the probe should still
succeed.

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
16 years ago[POWERPC] cuimage for Bamboo board
Josh Boyer [Fri, 14 Sep 2007 18:54:11 +0000 (04:54 +1000)]
[POWERPC] cuimage for Bamboo board

Add a cuboot wrapper for the Bamboo board.  Additionally, we enable MAC
address fixups for both cuboot and treeboot.

This also removes some obsoleted linker declarations that have been
moved into ops.h

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
16 years agoMerge branch 'linux-2.6'
Paul Mackerras [Thu, 20 Sep 2007 00:09:27 +0000 (10:09 +1000)]
Merge branch 'linux-2.6'

16 years agoMerge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
Linus Torvalds [Wed, 19 Sep 2007 18:45:32 +0000 (11:45 -0700)]
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus

* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
  [MIPS] cpu-bugs64.c: GCC 3.3 constraint workaround
  [MIPS] DEC: Initialise ioasic_ssr_lock

16 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
Linus Torvalds [Wed, 19 Sep 2007 18:41:15 +0000 (11:41 -0700)]
Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb

* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb:
  V4L/DVB (6173a): Documentation: Remove reference to dead "cpia_pp=" boot-time option
  Revert "V4L/DVB (6173a): Documentation: Remove reference to dead "cpia_pp=" boot-time option"

16 years agoMerge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
Linus Torvalds [Wed, 19 Sep 2007 18:40:13 +0000 (11:40 -0700)]
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] Avoid replaying inode buffer initialisation log items if on-disk version is newer.
  [XFS] Ensure file size updates have been completed before writing inode to disk.
  [XFS] On-demand reaping of the MRU cache

16 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
Linus Torvalds [Wed, 19 Sep 2007 18:39:39 +0000 (11:39 -0700)]
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SUNSAB]: Fix several bugs.

16 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
Linus Torvalds [Wed, 19 Sep 2007 18:39:10 +0000 (11:39 -0700)]
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6:
  ide: remove unused variables from drivers/ide/ppc/pmac.c
  ide: ST320413A has the same problem as ST340823A

16 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
Linus Torvalds [Wed, 19 Sep 2007 18:38:25 +0000 (11:38 -0700)]
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
  [POWERPC] Fix timekeeping on PowerPC 601
  [POWERPC] Don't expose clock vDSO functions when CPU has no timebase
  [POWERPC] spusched: Fix null pointer dereference in find_victim

16 years agox86-64: page faults from user mode are always user faults
Linus Torvalds [Wed, 19 Sep 2007 18:37:14 +0000 (11:37 -0700)]
x86-64: page faults from user mode are always user faults

Randy Dunlap noticed an interesting "crashme" behaviour on his dual
Prescott Xeon setup, where he gets page faults with the error code
having a zero "user" bit, but the register state points back to user
mode.

This may be a CPU microcode buglet triggered by some strange instruction
pattern that crashme generates, and loading a microcode update seems to
possibly have fixed it.

Regardless, we really should trust the register state more than the
error code, since it's really the register state that determines whether
we can actually send a signal, or whether we're in kernel mode and need
to oops/kill the process in the case of a page fault.

Cc: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years ago[MIPS] cpu-bugs64.c: GCC 3.3 constraint workaround
Maciej W. Rozycki [Mon, 17 Sep 2007 16:11:07 +0000 (17:11 +0100)]
[MIPS] cpu-bugs64.c: GCC 3.3 constraint workaround

Add a workaround to address warnings generated on the "n" constraint by
GCC 3.3 and below.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
16 years ago[MIPS] DEC: Initialise ioasic_ssr_lock
Maciej W. Rozycki [Mon, 17 Sep 2007 15:58:18 +0000 (16:58 +0100)]
[MIPS] DEC: Initialise ioasic_ssr_lock

Fix the definition of the ioasic_ssr_lock spinlock to include a proper
initialisation.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
16 years agoDriver core: fix deprectated sysfs structure for nested class devices
Dmitry Torokhov [Wed, 19 Sep 2007 05:46:50 +0000 (22:46 -0700)]
Driver core: fix deprectated sysfs structure for nested class devices

Nested class devices used to have 'device' symlink point to a real
(physical) device instead of a parent class device.  When converting
subsystems to struct device we need to keep doing what class devices did if
CONFIG_SYSFS_DEPRECATED is Y, otherwise parts of udev break.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Acked-by: Greg KH <greg@kroah.com>
Tested-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agouml: fix irqstack crash
Jeff Dike [Wed, 19 Sep 2007 05:46:49 +0000 (22:46 -0700)]
uml: fix irqstack crash

This patch fixes a crash caused by an interrupt coming in when an IRQ stack
is being torn down.  When this happens, handle_signal will loop, setting up
the IRQ stack again because the tearing down had finished, and handling
whatever signals had come in.

However, to_irq_stack returns a mask of pending signals to be handled, plus
bit zero is set if the IRQ stack was already active, and thus shouldn't be
torn down.  This causes a problem because when handle_signal goes around
the loop, sig will be zero, and to_irq_stack will duly set bit zero in the
returned mask, faking handle_signal into believing that it shouldn't tear
down the IRQ stack and return thread_info pointers back to their original
values.

This will eventually cause a crash, as the IRQ stack thread_info will
continue pointing to the original task_struct and an interrupt will look
into it after it has been freed.

The fix is to stop passing a signal number into to_irq_stack.  Rather, the
pending signals mask is initialized beforehand with the bit for sig already
set.  References to sig in to_irq_stack can be replaced with references to
the mask.

[akpm@linux-foundation.org: use UL]
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoFix NUMA Memory Policy Reference Counting
Lee Schermerhorn [Wed, 19 Sep 2007 05:46:47 +0000 (22:46 -0700)]
Fix NUMA Memory Policy Reference Counting

This patch proposes fixes to the reference counting of memory policy in the
page allocation paths and in show_numa_map().  Extracted from my "Memory
Policy Cleanups and Enhancements" series as stand-alone.

Shared policy lookup [shmem] has always added a reference to the policy,
but this was never unrefed after page allocation or after formatting the
numa map data.

Default system policy should not require additional ref counting, nor
should the current task's task policy.  However, show_numa_map() calls
get_vma_policy() to examine what may be [likely is] another task's policy.
The latter case needs protection against freeing of the policy.

This patch adds a reference count to a mempolicy returned by
get_vma_policy() when the policy is a vma policy or another task's
mempolicy.  Again, shared policy is already reference counted on lookup.  A
matching "unref" [__mpol_free()] is performed in alloc_page_vma() for
shared and vma policies, and in show_numa_map() for shared and another
task's mempolicy.  We can call __mpol_free() directly, saving an admittedly
inexpensive inline NULL test, because we know we have a non-NULL policy.

Handling policy ref counts for hugepages is a bit trickier.
huge_zonelist() returns a zone list that might come from a shared or vma
'BIND policy.  In this case, we should hold the reference until after the
huge page allocation in dequeue_hugepage().  The patch modifies
huge_zonelist() to return a pointer to the mempolicy if it needs to be
unref'd after allocation.

Kernel Build [16cpu, 32GB, ia64] - average of 10 runs:

w/o patch w/ refcount patch
    Avg   Std Devn    Avg   Std Devn
Real:  100.59     0.38  100.63     0.43
User: 1209.60     0.37 1209.91     0.31
System:   81.52     0.42   81.64     0.34

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Acked-by: Andi Kleen <ak@suse.de>
Cc: Christoph Lameter <clameter@sgi.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoFix user namespace exiting OOPs
Pavel Emelyanov [Wed, 19 Sep 2007 05:46:45 +0000 (22:46 -0700)]
Fix user namespace exiting OOPs

It turned out, that the user namespace is released during the do_exit() in
exit_task_namespaces(), but the struct user_struct is released only during the
put_task_struct(), i.e.  MUCH later.

On debug kernels with poisoned slabs this will cause the oops in
uid_hash_remove() because the head of the chain, which resides inside the
struct user_namespace, will be already freed and poisoned.

Since the uid hash itself is required only when someone can search it, i.e.
when the namespace is alive, we can safely unhash all the user_struct-s from
it during the namespace exiting.  The subsequent free_uid() will complete the
user_struct destruction.

For example simple program

   #include <sched.h>

   char stack[2 * 1024 * 1024];

   int f(void *foo)
   {
    return 0;
   }

   int main(void)
   {
    clone(f, stack + 1 * 1024 * 1024, 0x10000000, 0);
    return 0;
   }

run on kernel with CONFIG_USER_NS turned on will oops the
kernel immediately.

This was spotted during OpenVZ kernel testing.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
Acked-by: "Serge E. Hallyn" <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoConvert uid hash to hlist
Pavel Emelyanov [Wed, 19 Sep 2007 05:46:44 +0000 (22:46 -0700)]
Convert uid hash to hlist

Surprisingly, but (spotted by Alexey Dobriyan) the uid hash still uses
list_heads, thus occupying twice as much place as it could.  Convert it to
hlist_heads.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agokernel/user.c: Use list_for_each_entry instead of list_for_each
Matthias Kaehlcke [Wed, 19 Sep 2007 05:46:43 +0000 (22:46 -0700)]
kernel/user.c: Use list_for_each_entry instead of list_for_each

kernel/user.c: Convert list_for_each to list_for_each_entry in
uid_hash_find()

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoext34: ensure do_split leaves enough free space in both blocks
Eric Sandeen [Wed, 19 Sep 2007 05:46:42 +0000 (22:46 -0700)]
ext34: ensure do_split leaves enough free space in both blocks

The do_split() function for htree dir blocks is intended to split a leaf
block to make room for a new entry.  It sorts the entries in the original
block by hash value, then moves the last half of the entries to the new
block - without accounting for how much space this actually moves.  (IOW,
it moves half of the entry *count* not half of the entry *space*).  If by
chance we have both large & small entries, and we move only the smallest
entries, and we have a large new entry to insert, we may not have created
enough space for it.

The patch below stores each record size when calculating the dx_map, and
then walks the hash-sorted dx_map, calculating how many entries must be
moved to more evenly split the existing entries between the old block and
the new block, guaranteeing enough space for the new entry.

The dx_map "offs" member is reduced to u16 so that the overall map size
does not change - it is temporarily stored at the end of the new block, and
if it grows too large it may be overwritten.  By making offs and size both
u16, we won't grow the map size.

Also add a few comments to the functions involved.

This fixes the testcase reported by hooanon05@yahoo.co.jp on the
linux-ext4 list, "ext3 dir_index causes an error"

Thanks to Andreas Dilger for discussing the problem & solution with me.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Tested-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: <linux-ext4@vger.kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agodisable sys_timerfd() for 2.6.23
Andrew Morton [Wed, 19 Sep 2007 05:46:41 +0000 (22:46 -0700)]
disable sys_timerfd() for 2.6.23

There is still some confusion and disagreement over what this interface should
actually do.  So it is best that we disable it in 2.6.23 until we get that
fully sorted out.

(sys_timerfd() was present in 2.6.22 but it was apparently broken, so here we
assume that nobody is using it yet).

Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: Davide Libenzi <davidel@xmailserver.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agonfs: fix oops re sysctls and V4 support
Alexey Dobriyan [Wed, 19 Sep 2007 05:46:40 +0000 (22:46 -0700)]
nfs: fix oops re sysctls and V4 support

NFS unregisters sysctls only if V4 support is compiled in.  However, sysctl
table is not V4 specific, so unregister it always.

Steps to reproduce:

[build nfs.ko with CONFIG_NFS_V4=n]
modrobe nfs
rmmod nfs
ls /proc/sys

Unable to handle kernel paging request at ffffffff880661c0 RIP:
 [<ffffffff802af8e3>] proc_sys_readdir+0xd3/0x350
PGD 203067 PUD 207063 PMD 7e216067 PTE 0
Oops: 0000 [1] SMP
CPU 1
Modules linked in: lockd nfs_acl sunrpc
Pid: 3335, comm: ls Not tainted 2.6.23-rc3-bloat #2
RIP: 0010:[<ffffffff802af8e3>]  [<ffffffff802af8e3>] proc_sys_readdir+0xd3/0x350
RSP: 0018:ffff81007fd93e78  EFLAGS: 00010286
RAX: ffffffff880661c0 RBX: ffffffff80466370 RCX: ffffffff880661c0
RDX: 00000000000014c0 RSI: ffff81007f3ad020 RDI: ffff81007efd8b40
RBP: 0000000000000018 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: ffffffff802a8570 R12: ffffffff880661c0
R13: ffff81007e219640 R14: ffff81007efd8b40 R15: ffff81007ded7280
FS:  00002ba25ef03060(0000) GS:ffff81007ff81258(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: ffffffff880661c0 CR3: 000000007dfaf000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process ls (pid: 3335, threadinfo ffff81007fd92000, task ffff81007d8a0000)
Stack:  ffff81007f3ad150 ffffffff80283f30 ffff81007fd93f48 ffff81007efd8b40
 ffff81007ee00440 0000000422222222 0000000200035593 ffffffff88037e9a
 2222222222222222 ffffffff80466500 ffff81007e416400 ffff81007e219640
Call Trace:
 [<ffffffff80283f30>] filldir+0x0/0xf0
 [<ffffffff80283f30>] filldir+0x0/0xf0
 [<ffffffff802840c7>] vfs_readdir+0xa7/0xc0
 [<ffffffff80284376>] sys_getdents+0x96/0xe0
 [<ffffffff8020bb3e>] system_call+0x7e/0x83

Code: 41 8b 14 24 85 d2 74 dc 49 8b 44 24 08 48 85 c0 74 e7 49 3b
RIP  [<ffffffff802af8e3>] proc_sys_readdir+0xd3/0x350
 RSP <ffff81007fd93e78>
CR2: ffffffff880661c0
Kernel panic - not syncing: Fatal exception

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agodir_index: error out instead of BUG on corrupt dx dirs
Eric Sandeen [Wed, 19 Sep 2007 05:46:38 +0000 (22:46 -0700)]
dir_index: error out instead of BUG on corrupt dx dirs

Convert asserts (BUGs) in dx_probe from bad on-disk data to recoverable
errors with helpful warnings.  With help catching other asserts from Duane
Griffin <duaneg@dghda.com>

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Acked-by: Duane Griffin <duaneg@dghda.com>
Acked-by: Theodore Ts'o <tytso@mit.edu>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agointel-agp: Fix i830 mask variable that changed with G33 support
Dave Airlie [Wed, 19 Sep 2007 05:46:35 +0000 (22:46 -0700)]
intel-agp: Fix i830 mask variable that changed with G33 support

The mask on i830 should be 0x70 always, later chips 0xF0 should be okay.

Signed-off-by: Dave Airlie <airlied@linux.ie>
Acked-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Cc: Michael Haas <laga@laga.ath.cx>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agointelfb: Fix bug in DPLL disable
Antonino A. Daplas [Wed, 19 Sep 2007 05:46:34 +0000 (22:46 -0700)]
intelfb: Fix bug in DPLL disable

Reported in Kernel Bugzilla 9006

Fix an obvious bug in DPLL disable.

Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoxen: don't bother trying to set cr4
Jeremy Fitzhardinge [Wed, 19 Sep 2007 05:46:33 +0000 (22:46 -0700)]
xen: don't bother trying to set cr4

Xen ignores all updates to cr4, and some versions will kill the domain if
you try to change its value.  Just ignore all changes.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agopci: fix unterminated pci_device_id lists
Kees Cook [Wed, 19 Sep 2007 05:46:32 +0000 (22:46 -0700)]
pci: fix unterminated pci_device_id lists

Fix a couple drivers that do not correctly terminate their pci_device_id
lists.  This results in garbage being spewed into modules.pcimap when the
module happens to not have 28 NULL bytes following the table, and/or the
last PCI ID is actually truncated from the table when calculating the
modules.alias PCI aliases, cause those unfortunate device IDs to not
auto-load.

Signed-off-by: Kees Cook <kees@ubuntu.com>
Acked-by: Corey Minyard <minyard@acm.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Jeff Garzik <jeff@garzik.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agomspec: handle shrinking virtual memory areas
Cliff Wickman [Wed, 19 Sep 2007 05:46:31 +0000 (22:46 -0700)]
mspec: handle shrinking virtual memory areas

The shrinking of a virtual memory area that is mmap(2)'d to a memory
special file (device drivers/char/mspec.c) can cause a panic.

If the mapped size of the vma (vm_area_struct) is very large, mspec allocates
a large vma_data structure with vmalloc(). But such a vma can be shrunk by
an munmap(2).  The current driver uses the current size of each vma to
deduce whether its vma_data structure was allocated by kmalloc() or vmalloc().
So if the vma was shrunk it appears to have been allocated by kmalloc(),
and mspec attempts to free it with kfree().  This results in a panic.

This patch avoids the panic (by preserving the type of the allocation) and
also makes mspec work correctly as the vma is split into pieces by the
munmap(2)'s.

All vma's derived from such a split vma share the same vma_data structure that
represents all the pages mapped into this set of vma's.  The mpec driver
must be made capable of using the right portion of the structure for each
member vma.  In other words, it must index into the array of page addresses
using the portion of the array that represents the current vma. This is
enabled by storing the vma group's vm_start in the vma_data structure.

The shared vma_data's are not protected by mm->mmap_sem in the fork() case
so the reference count is left as atomic_t.

Signed-off-by: Cliff Wickman <cpw@sgi.com>
Acked-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agortc: rtc-ds1553.c should use resource_size_t for base address
Atsushi Nemoto [Wed, 19 Sep 2007 05:46:30 +0000 (22:46 -0700)]
rtc: rtc-ds1553.c should use resource_size_t for base address

Currently the rtc driver, rtc-ds1552.c uses an unsigned long to store the
base mmio address of the NVRAM/RTC.  This breaks on 32-bit systems with
larger physical addresses.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agortc-ds1742.c should use resource_size_t for base address
David Gibson [Wed, 19 Sep 2007 05:46:28 +0000 (22:46 -0700)]
rtc-ds1742.c should use resource_size_t for base address

Currently the rtc driver, rtc-ds1742.c uses an unsigned long to store the
base mmio address of the NVRAM/RTC.  This breaks on systems like PowerPC
440, which is a 32-bit core with 36-bit physical addresses: IO on the
system, including the RTC, is typically above the 4GB point, and cannot fit
into an unsigned long.

This patch fixes the problem by replacing the unsigned long with a
resource_size_t.  Tested on Ebony (PPC440) (with additional patches to
instantiate the ds1742 platform device appropriately).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoFix UTS corruption during clone(CLONE_NEWUTS)
Alexey Dobriyan [Wed, 19 Sep 2007 05:46:27 +0000 (22:46 -0700)]
Fix UTS corruption during clone(CLONE_NEWUTS)

struct utsname is copied from master one without any exclusion.

Here is sample output from one proggie doing

sethostname("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
sethostname("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");

and another

clone(,, CLONE_NEWUTS, ...)
uname()

hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaabbbbb'
hostname = 'bbbaaaaaaaaaaaaaaaaaaaaaaaaaaa'
hostname = 'aaaaaaaabbbbbbbbbbbbbbbbbbbbbb'
hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaaabbbb'
hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaabb'
hostname = 'aaabbbbbbbbbbbbbbbbbbbbbbbbbbb'
hostname = 'bbbbbbbbbbbbbbbbaaaaaaaaaaaaaa'

Hostname is sometimes corrupted.

Yes, even _the_ simplest namespace activity had bug in it. :-(

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoFix failure to resume from initrds
Nigel Cunningham [Wed, 19 Sep 2007 05:46:25 +0000 (22:46 -0700)]
Fix failure to resume from initrds

Commit 831441862956fffa17b9801db37e6ea1650b0f69 (Freezer: make kernel
threads nonfreezable by default) breaks freezing when attempting to resume
from an initrd, because the init (which is freezeable) spins while waiting
for another thread to run /linuxrc, but doesn't check whether it has been
told to enter the refrigerator.  The original patch replaced a call to
try_to_freeze() with a call to yield().  I believe a simple reversion is
wrong because if !CONFIG_PM_SLEEP, try_to_freeze() is a noop.  It should
still yield.

Signed-off-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agouml: use correct type in BLKGETSIZE ioctl
Nicolas George [Wed, 19 Sep 2007 05:46:21 +0000 (22:46 -0700)]
uml: use correct type in BLKGETSIZE ioctl

I found a type mismatch in UML that makes host block devices unusable as ubd
devices on x86_64 and other 64 bits systems (segfault of the mm subsystem):

In block/ioctl.c, the following lines show that the BLKGETSIZE ioctl expects
a pointer to a long:

case BLKGETSIZE:
if ((bdev->bd_inode->i_size >> 9) > ~0UL)
return -EFBIG;
return put_ulong(arg, bdev->bd_inode->i_size >> 9);

In arch/um/os-Linux/file.c, os_file_size calls it with an int.

The ioctl_list man page should be fixed as well.

Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoFix "Fix DAC960 driver on machines which don't support 64-bit DMA"
Andrew Morton [Wed, 19 Sep 2007 05:46:19 +0000 (22:46 -0700)]
Fix "Fix DAC960 driver on machines which don't support 64-bit DMA"

sparc32:

drivers/block/DAC960.c: In function 'DAC960_V1_EnableMemoryMailboxInterface':
drivers/block/DAC960.c:1168: error: 'DMA_32BIT_MASK' undeclared (first use in this function)
drivers/block/DAC960.c:1168: error: (Each undeclared identifier is reported only

Cc: <dac@conglom-o.org>
Cc: <stable@kernel.org>
Cc: Alessandro Polverini <alex@nibbles.it>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years ago[POWERPC] Fix timekeeping on PowerPC 601
Benjamin Herrenschmidt [Wed, 19 Sep 2007 04:21:56 +0000 (14:21 +1000)]
[POWERPC] Fix timekeeping on PowerPC 601

Recent changes to the timekeeping code broke support for the PowerPC 601
processor which doesn't have the usual timebase facility but a slightly
different thing called (yuck) the RTC.

This fixes it, boot tested on an old 601 based PowerMac 7200.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Don't expose clock vDSO functions when CPU has no timebase
Benjamin Herrenschmidt [Wed, 19 Sep 2007 04:21:56 +0000 (14:21 +1000)]
[POWERPC] Don't expose clock vDSO functions when CPU has no timebase

We forgot to remove the clock_gettime, clock_getres and get_tbfreq vDSO
calls on CPUs that have no timebase such as 601 or 403 (old CPUs that have
different mechanisms and for which the vDSO code will not work properly).
This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spusched: Fix null pointer dereference in find_victim
Christoph Hellwig [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spusched: Fix null pointer dereference in find_victim

find_victim can dereference a NULL pointer when iterating over the list
of victim spus because list_mutex only guarantees spu->ct to be stable,
but of course not to be non-NULL.

Also fix find_victim to not call spu_unbind_context without list_mutex
because that violates the above guarantee.

Signed-off-by: Christoph Hellwig <hch@lst.de>
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] FWNMI is only used on pSeries
Stephen Rothwell [Tue, 18 Sep 2007 07:25:12 +0000 (17:25 +1000)]
[POWERPC] FWNMI is only used on pSeries

This saves 4k on non pSeries builds (except for iSeries where it saves
almost 4k).

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Size swapper_pg_dir correctly
Stephen Rothwell [Tue, 18 Sep 2007 07:22:59 +0000 (17:22 +1000)]
[POWERPC] Size swapper_pg_dir correctly

David Gibson pointed out that swapper_pg_dir actually need to be
PGD_TABLE_SIZE bytes long not PAGE_SIZE.  This actually saves 64k in
the bss for a kernel ppc64_defconfig built with CONFIG_PPC_64K_PAGES.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Remove cmd_line from head*.S
Stephen Rothwell [Mon, 17 Sep 2007 04:41:38 +0000 (14:41 +1000)]
[POWERPC] Remove cmd_line from head*.S

It is just a C char array, so declare it thusly.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] Fix section mismatch in PCI code
Stephen Rothwell [Mon, 17 Sep 2007 04:08:06 +0000 (14:08 +1000)]
[POWERPC] Fix section mismatch in PCI code

Create a helper function (alloc_maybe_bootmem) that is marked __init_refok
to limit the chances of mistakenly referring to other __init routines.

WARNING: vmlinux.o(.text+0x2a9c4): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.update_dn_pci_info' and '.pci_dn_reconfig_notifier')
WARNING: vmlinux.o(.text+0x36430): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.mpic_msi_init_allocator' and '.find_ht_magic_addr')
WARNING: vmlinux.o(.text+0x5e804): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config')
WARNING: vmlinux.o(.text+0x5e8e8): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config')
WARNING: vmlinux.o(.text+0x5e968): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config')

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] MPC5200 low power mode
Domen Puncer [Tue, 17 Jul 2007 20:32:31 +0000 (06:32 +1000)]
[POWERPC] MPC5200 low power mode

Low-power mode implementation for Lite5200b.
Some I/O registers are also saved here.

A recent U-Boot that supports this (lite5200b_PM_config) is needed.

Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Add DEFINE_SPUFS_ATTRIBUTE()
Michael Ellerman [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spufs: Add DEFINE_SPUFS_ATTRIBUTE()

This patch adds DEFINE_SPUFS_ATTRIBUTE(), a wrapper around
DEFINE_SIMPLE_ATTRIBUTE which does the specified locking for the get
routine for us.

Unfortunately we need two get routines (a locked and unlocked version) to
support the coredump code.  This hides one of those (the locked version)
inside the macro foo.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Respect RLIMIT_CORE in spu coredump code
Michael Ellerman [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spufs: Respect RLIMIT_CORE in spu coredump code

Currently the spu coredump code doesn't respect the ulimit, it should.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Handle errors in SPU coredump code, and support coredump to a pipe
Michael Ellerman [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spufs: Handle errors in SPU coredump code, and support coredump to a pipe

Rework spufs_coredump_extra_notes_write() to check for and return errors.

If we're coredumping to a pipe we can't trust file->f_pos, we need to
maintain the foffset value passed to us. The cleanest way to do this is
to have the low level write routine increment foffset when we've
successfully written.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Cleanup ELF coredump extra notes logic
Michael Ellerman [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spufs: Cleanup ELF coredump extra notes logic

To start with, arch_notes_size() etc. is a little too ambiguous a name for
my liking, so change the function names to be more explicit.

Calling through macros is ugly, especially with hidden parameters, so don't
do that, call the routines directly.

Use ARCH_HAVE_EXTRA_ELF_NOTES as the only flag, and based on it decide
whether we want the extern declarations or the empty versions.

Since we have empty routines, actually use them in the coredump code to
save a few #ifdefs.

We want to change the handling of foffset so that the write routine updates
foffset as it goes, instead of using file->f_pos (so that writing to a pipe
works).  So pass foffset to the write routine, and for now just set it to
file->f_pos at the end of writing.

It should also be possible for the write routine to fail, so change it to
return int and treat a non-zero return as failure.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Combine spufs_coredump_calls with spufs_calls
Michael Ellerman [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spufs: Combine spufs_coredump_calls with spufs_calls

Because spufs might be built as a module, we can't have other parts of the
kernel calling directly into it, we need stub routines that check first if the
module is loaded.

Currently we have two structures which hold callbacks for these stubs, the
syscalls are in spufs_calls and the coredump calls are in spufs_coredump_calls.
In both cases the logic for registering/unregistering is essentially the same,
so we can simplify things by combining the two.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Add contents of npc file to SPU coredumps
Michael Ellerman [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spufs: Add contents of npc file to SPU coredumps

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Internal __spufs_get_foo() routines should take a spu_context *
Michael Ellerman [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spufs: Internal __spufs_get_foo() routines should take a spu_context *

The SPUFS attribute get routines take a void * because the generic attribute
code doesn't know what sort of data it's passing around.

However our internal __spufs_get_foo() routines can take a spu_context *
directly, which saves plonking it in and out of a void * again.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[POWERPC] spufs: Get rid of spufs_coredump_num_notes, it's not needed if we NULL...
Michael Ellerman [Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)]
[POWERPC] spufs: Get rid of spufs_coredump_num_notes, it's not needed if we NULL terminate

The spufs_coredump_read array is NULL terminated, and we also store the size.
We only need one or the other, and the other arrays in file.c are NULL
terminated, so do that.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>