[PATCH] PPC64 Close firmware stdin
From: Paul Mackerras
Date: Sun Dec 05 2004 - 22:24:34 EST
Andrew & Linus,
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: Paul Mackerras <paulus@xxxxxxxxx>
--- linux-2.5/arch/ppc64/kernel/prom_init.c 2004-11-26 20:40:32.000000000 +1100
+++ g5-ppc64/arch/ppc64/kernel/prom_init.c 2004-12-04 14:54:08.000000000 +1100
@@ -1108,6 +1108,16 @@
}
}
+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();
@@ -1686,6 +1696,9 @@
prom_printf("copying OF device tree ...\n");
flatten_device_tree();
+ /* 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...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/