Commit c22df075 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] PPC64 Close firmware stdin

We recently found a problem that was causing memory corruption during
boot on IBM POWER5 machines.  The problem was that the if you have a
USB keyboard and it is set to the input device for the firmware, it
will still be active when the kernel is started.  That means that the
OHCI controller has pointers to various memory areas that it polls for
transfers to do.  When we start using that same memory in the kernel,
bad things can happen.  (This isn't a problem on powermacs because the
Apple OF implements a "quiesce" call which turns off all the devices
it is using.)

This patch fixes the problem by calling the Open Firmware "close"
method for the input device.  Stephen Rothwell and I have verified
that doing this fixes the problem on the POWER5 machine where we
observed it.  I verified that this patch doesn't cause any problems on
powermacs.

I think this patch should go into 2.6.10 since it fixes a nasty memory
corruption bug that can cause rather subtle and hard-to-diagnose
problems during boot.  (The symptom on the POWER5 machine with the
particular kernel that we were using was that reading /proc/net/tcp
would oops, due to one of the pointers in tcp_ehash being corrupted.)
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 99827021
......@@ -1118,6 +1118,16 @@ static void __init prom_close_stdin(void)
call_prom("close", 1, 0, val);
}
static void __init prom_close_stdin(void)
{
unsigned long offset = reloc_offset();
struct prom_t *_prom = PTRRELOC(&prom);
ihandle val;
if (prom_getprop(_prom->chosen, "stdin", &val, sizeof(val)) > 0)
call_prom("close", 1, 0, val);
}
static int __init prom_find_machine_type(void)
{
unsigned long offset = reloc_offset();
......@@ -1699,6 +1709,9 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, unsigned long
/* in case stdin is USB and still active on IBM machines... */
prom_close_stdin();
/* in case stdin is USB and still active on IBM machines... */
prom_close_stdin();
/*
* Call OF "quiesce" method to shut down pending DMA's from
* devices etc...
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment