powerpc: Fix random memory corruption in merged elf.h
The merged verison of ELF_CORE_COPY_REGS is basically the PPC64 version, with
a memset that came from PPC and a few types abstracted out into #defines. But
it's not _quite_ right.
The first problem is we calculate the number of registers with:
nregs = sizeof(struct pt_regs) / sizeof(ELF_GREG_TYPE)
For a 32-bit process on a 64-bit kernel that's bogus because the registers are
64 bits, but ELF_GREG_TYPE is u32, so nregs == 88 which is wrong.
The other problem is the memset, which assumes a struct pt_regs is smaller
than a struct elf_regs. For a 32-bit process on a 64-bit kernel that's false.
The fix is to calculate the number of regs using sizeof(unsigned long), which
should always be right, and just memset the whole damn thing _before_ copying
the registers in.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
powerpc: Implement smp_release_cpus() in C not asm
There's no reason for smp_release_cpus() to be asm, and most people can make
more sense of C code. Add an extern declaration to smp.h and remove the custom
one in machine_kexec.c
Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
powerpc: Add helper functions for synthesising instructions at runtime
There's a few places already, and soon will be more, where we synthesise
branch instructions at runtime. Rather than doing it by hand in each case,
it would make sense to have one implementation.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
David Gibson [Wed, 2 Nov 2005 23:13:58 +0000 (10:13 +1100)]
[PATCH] powerpc: Keep fixing merged ipcbuf.h
Oops, replacing the two u64s in struct ipc64_perm with __u32s changed
the alignment of that structure, which could mess up userspace.
Revert to using two unsigned long longs (which is what ppc32 had
originally). ppc64 orignally had two unsigned longs, but long long is
the same size on 64 bit, so this should be ok there too.
Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
David Woodhouse [Wed, 2 Nov 2005 16:54:46 +0000 (16:54 +0000)]
[PATCH] powerpc: always init nvram on 64-bit powermac
Currently there is no Kconfig symbol to indicate that we want nvram
support on 64-bit kernels; it's assumed we always want it, so make
the powermac setup code always initialize the pmac nvram code if
64-bit.
Becky Bruce [Wed, 2 Nov 2005 16:52:52 +0000 (10:52 -0600)]
[PATCH] ppc: Fix build warnings in arch/ppc/kernel/traps.c
The latest updates to bug.h generate build warnings in traps.c in
arch/ppc. Fix print format specifiers to account for change of line type
to long from int.
Signed-off-by: Becky Bruce <becky.bruce@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
John Rose [Wed, 2 Nov 2005 16:29:55 +0000 (10:29 -0600)]
[PATCH] ppc64: Fix add notifier crashes
The extraction of PCI stuff from struct device_node left some false
assumptions in notifier code. As a result, dynamic add crashes when
non-PCI nodes are added. This patch fixes these assumptions.
Signed-off-by: John Rose <johnrose@austin.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
powerpc: Set entry point and text address in linker script
Currently we set the kernel entry point and the address of the text
section in the Makefile, using CONFIG_KERNEL_START.
But we've already got <asm/page.h> in the linker script, so we can just
use KERNELBASE directly. That means if we ever change KERNELBASE there's
one less place to change it.
And we can set the entry point with ENTRY().
There are zero differences from "readelf -a vmlinux" with or without this
patch.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
powerpc: Merge asm-ppc/kexec.h and asm-ppc64/kexec.h
Merge include/asm-ppc/kexec.h and include/asm-ppc64/kexec.h.
The only thing that's really changed is that we now allocate crash_notes
properly on PPC32. It's address is exported via sysfs, so it's not correct
for it to be a pointer.
I've also removed some of the "we don't use this" comments, because they're
wrong (or perhaps were referring only to arch code).
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Paul Mackerras [Thu, 3 Nov 2005 03:41:19 +0000 (14:41 +1100)]
powerpc: Merge remaining RTAS code
This moves rtas-proc.c and rtas_flash.c into arch/powerpc/kernel, since
cell wants them as well as pseries (and chrp can use rtas-proc.c too,
at least in principle). rtas_fw.c is gone, with its bits moved into
rtas_flash.c and rtas.c.
David Gibson [Tue, 1 Nov 2005 04:30:26 +0000 (15:30 +1100)]
[PATCH] powerpc: Move naca.h to platforms/iseries
These days, the NACA only exists on iSeries. Therefore, this patch
moves naca.h from include/asm-ppc64 to arch/powerpc/platforms/iseries.
There was one file including naca.h outside of platforms/iseries -
arch/ppc64/kernel/udbg_scc.c. However, that's obviously a hangover
from older days. The include is not necessary, so this patch simply
removes it.
Built and booted on iSeries, built for G5 (which uses udbg_scc.o).
Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
David Gibson [Wed, 2 Nov 2005 04:13:20 +0000 (15:13 +1100)]
[PATCH] powerpc: Move dart.h
asm-ppc64/dart.h is included in exactly one place -
arch/powerpc/sysdev/u3_iommu.c. This patch, therefore, moves it into
arch/powerpc/sysdev. While we're at it, update the #ifndef/#define
protecting the include, and the filename in the comments of
u3_iommu.c.
Built and booted on pSeries and G5, built for ppc32 powermac.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
David Gibson [Wed, 2 Nov 2005 03:48:36 +0000 (14:48 +1100)]
[PATCH] powerpc: Merge (move) numnodes.h and sparsemem.h
The ppc64 versions of numnodes.h and sparsemem.h can be safely moved
to asm-powerpc with no changes apart from changing the #define to the
standard _ASM_POWERPC_ form. There are no ppc32 versions of these
files, because they only have any effect if CONFIG_SPARSEMEM is
enabled, which it never can be on ppc32.
Built and booted on pSeries (POWER5), built for 32-bit powermac.
Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras [Wed, 2 Nov 2005 04:19:47 +0000 (15:19 +1100)]
powerpc: clean up bug.h further
This simplifies the macros which are different between 32-bit and
64-bit. It also fixes a couple of printks on the bug->line element,
which is now a long.
Paul Mackerras [Wed, 2 Nov 2005 04:08:17 +0000 (15:08 +1100)]
powerpc: exclude powerbook sleep code with CONFIG_PPC64 and CONFIG_PM
We were getting powerbook sleep code included, and giving compile
errors, with CONFIG_PM=y on a 64-bit build. This excludes that code
so the kernel will compile. One day BenH will implement on sleep on
the G5...
Paul Mackerras [Wed, 2 Nov 2005 04:04:26 +0000 (15:04 +1100)]
powerpc: Use rtas_call not call_rtas in CHRP code
The nvram driver imported from the ppc code uses call_rtas, but
rtas_call is the name we are using in merged code (since ppc64 used
that name, and it uses far more RTAS calls than ppc32).
David Gibson [Wed, 2 Nov 2005 02:58:22 +0000 (13:58 +1100)]
[PATCH] powerpc: Merge futex.h
This patch merges the ppc32 and ppc64 versions of futex.h, essentially
by taking the ppc64 version as the powerpc version. The old ppc32
version did not implement the futex_atomic_op_inuser() callback (it
always returned -ENOSYS), so FUTEX_WAKE_OP would not work on ppc32.
In fact the ppc64 version of this function is almost suitable for
ppc32 as well - the only change needed is to extend ppc_asm.h with a
macro expanding to to the right pseudo-op to store a pointer (either
".long" or ".llong").
Built and booted on pSeries. Built for 32-bit powermac.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
David Gibson [Wed, 2 Nov 2005 00:44:26 +0000 (11:44 +1100)]
[PATCH] powerpc: Fix merged ipcbuf.h
Oops, when merging ipcbuf.h, I forgot that 'u64' can't be used in
user-visible headers. This patch corrects the problem, replacing the
unused fields with an array of four __u32s.
Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras [Tue, 1 Nov 2005 11:37:47 +0000 (22:37 +1100)]
powerpc: Fix pseries (64-bit) build
A recent commit that removed rtas-fw.h and moved its contents to
include/asm-powerpc/rtas.h forgot to also remove the inclusion of
it in arch/powerpc/platforms/pseries/setup.c.
Paul Mackerras [Tue, 1 Nov 2005 10:54:38 +0000 (21:54 +1100)]
powerpc: Fix BUG/WARN macros for 64-bit
The bug_entry struct had an int in the middle of pointers and unsigned
longs, and the inline asm that generated the bug table entries didn't
insert the necessary padding, so the fields following it didn't get
initialized properly and an oops resulted. This changes the int field
(the line number) to a long so that all the fields are the same size
and no padding is required.
David Gibson [Tue, 1 Nov 2005 06:28:10 +0000 (17:28 +1100)]
[PATCH] powerpc: Merge bitops.h
Here's a revised version. This re-introduces the set_bits() function
from ppc64, which I removed because I thought it was unused (it exists
on no other arch). In fact it is used in the powermac interrupt code
(but not on pSeries).
- We use LARXL/STCXL macros to generate the right (32 or 64 bit)
instructions, similar to LDL/STL from ppc_asm.h, used in fpu.S
- ppc32 previously used a full "sync" barrier at the end of
test_and_*_bit(), whereas ppc64 used an "isync". The merged version
uses "isync", since I believe that's sufficient.
- The ppc64 versions of then minix_*() bitmap functions have changed
semantics. Previously on ppc64, these functions were big-endian
(that is bit 0 was the LSB in the first 64-bit, big-endian word).
On ppc32 (and x86, for that matter, they were little-endian. As far
as I can tell, the big-endian usage was simply wrong - I guess
no-one ever tried to use minixfs on ppc64.
- On ppc32 find_next_bit() and find_next_zero_bit() are no longer
inline (they were already out-of-line on ppc64).
- For ppc64, sched_find_first_bit() has moved from mmu_context.h to
the merged bitops. What it was doing in mmu_context.h in the first
place, I have no idea.
- The fls() function is now implemented using the cntlzw instruction
on ppc64, instead of generic_fls(), as it already was on ppc32.
- For ARCH=ppc, this patch requires adding arch/powerpc/lib to the
arch/ppc/Makefile. This in turn requires some changes to
arch/powerpc/lib/Makefile which didn't correctly handle ARCH=ppc.
Built and running on G5.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
David Gibson [Tue, 1 Nov 2005 05:53:24 +0000 (16:53 +1100)]
[PATCH] powerpc: Merge ipcbuf.h
This patch merges ppc32 and ppc64 versions of ipcbuf.h. The merge is
essentially trivial, since the structure defined in each version was
already identical. Only wrinkle is that the merged version now
includes linux/types.h in order to get the fixed width integer types.
In fact, the old versions probably should have been including that
anyway, since the file uses various __kernel_*_t types.
Built and booted on G5, built for 32-bit pmac, but not booted, since
the merge tree currently doesn't boot there.
Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Arnd Bergmann [Tue, 1 Nov 2005 01:08:37 +0000 (20:08 -0500)]
[PATCH] powerpc: Rename BPA to Cell
The official name for BPA is now CBEA (Cell Broadband
Engine Architecture). This patch renames all occurences
of the term BPA to 'Cell' for easier recognition.
Signed-off-by: Arnd Bergmann <arndb@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Linus Torvalds [Tue, 1 Nov 2005 05:12:40 +0000 (21:12 -0800)]
Don't touch USB controller IO registers when they are disabled
The USB "handoff" code is an early PCI quirk to make sure we own the USB
controller (as opposed to the BIOS/SMM). But if the controller isn't
even enabled yet, don't try to access it.
Acked-by: Paul Mackerras <paulus@samba.org> (who had an alternate patch) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Tue, 1 Nov 2005 03:16:17 +0000 (19:16 -0800)]
Revert "i386: move apic init in init_IRQs"
Commit f2b36db692b7ff6972320ad9839ae656a3b0ee3e causes a bootup hang on
at least one machine. Revert for now until we understand why. The old
code may be ugly, but it works.
This adds the magic IO wakeup code for the CardBus version of the
Creative Labs Audigy 2 to the snd-emu10k1 driver.
Without the magic IO enable sequence, reading from the IO region of the
card will fail spectacularly, and the machine will hang.
My next task will be getting the driver to actually play sound without
distortion.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
[ This is a work-in-progress, but since it avoids a total lockup
if the emu10k module is loaded on a machine with the cardbus
card inserted, we're better off with it than without it, even
if sound quality is bad right now ]
Andrea Arcangeli [Mon, 31 Oct 2005 22:08:54 +0000 (14:08 -0800)]
[PATCH] fix __writeback_single_inode WARN_ON
When the inode count is zero in inode writeback, the
WARN_ON(!(inode->i_state & I_WILL_FREE));
is broken, and needs to test for either I_WILL_FREE|I_FREEING.
When the inode is in I_FREEING state, it's already out of the visibility
of the vm so it can't be freed so it doesn't require the __iget and the
generic_delete_inode path can call the sync internally to the lowlevel
fs callback during the last iput. So the inode being in I_FREEING is
also a valid condition for calling the sync with i_count == 0.
Arthur Othieno [Mon, 31 Oct 2005 04:04:05 +0000 (23:04 -0500)]
[PATCH] i386: CONFIG_PC removal
CONFIG_PC is left-over cruft after the introduction of CONFIG_X86_PC with
the subarch split. Remove it, and fixup the remaining users to depend on
CONFIG_X86_PC instead.
Signed-off-by: Arthur Othieno <a.othieno@bluewin.ch> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
"I'm currently debugging this. The problem is that we are using the
generic dispatch queue directly in the noop sched and merging is NOT
allowed on dispatch queues but generic handling of last_merge tries
to merge requests. I'm still trying to verify this, so I'll be back
with results soon."
In the meantime, disable merging for noop by setting REQ_NOMERGE in
elevator_noop_add_request().
Eventually, we should add a noop_list and do the dispatching like in the
other io schedulers. Merging is still beneficial for noop (and it has
always done it).