mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: akpm@osdl.org, torvalds@osdl.org
Cc: anton@samba.org, sfr@canb.auug.org.au, linux-kernel@vger.kernel.org
Subject: [PATCH] PPC64 Close firmware stdin
Date: Mon, 6 Dec 2004 14:31:16 +1100	[thread overview]
Message-ID: <16819.53892.21800.432263@cargo.ozlabs.ibm.com> (raw)

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@samba.org>

--- 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...

             reply	other threads:[~2004-12-06  3:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-06  3:31 Paul Mackerras [this message]
     [not found] <200412071904.iB7J4DOj023759@hera.kernel.org>
2004-12-07 22:30 ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16819.53892.21800.432263@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=akpm@osdl.org \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®