public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
From: Haren Myneni <haren@linux.vnet.ibm.com>
To: benh@kernel.crashing.org, linuxppc-dev@lists.ozlabs.org, anton@samba.org
Subject: [PATCH] Disable /dev/port interface on powerpc systems
Date: Tue, 20 Mar 2012 22:37:17 -0700	[thread overview]
Message-ID: <1332308237.23222.49.camel@hbabu-laptop> (raw)


Some power systems do not have legacy ISA devices. So, /dev/port is not
a valid interface on these systems. User level tools such as kbdrate is
trying to access the device using this interface which is causing the
system crash. 

This patch will fix this issue by not creating this interface on these
powerpc systems. 

Signed-off-by: Haren Myneni <haren@us.ibm.com>


diff -Naurp linux.orig/arch/powerpc/kernel/isa-bridge.c
linux/arch/powerpc/kernel/isa-bridge.c
--- linux.orig/arch/powerpc/kernel/isa-bridge.c	2012-02-11
02:08:08.780005293 -0800
+++ linux/arch/powerpc/kernel/isa-bridge.c	2012-02-11 02:16:25.080003386
-0800
@@ -255,6 +255,14 @@ static struct notifier_block isa_bridge_
 	.notifier_call = isa_bridge_notify
 };
 
+int __init legacy_isa_device_found(void)
+{
+	if (isa_bridge_pcidev)
+		return 1;
+	
+	return 0;
+}
+
 /**
  * isa_bridge_init - register to be notified of ISA bridge
addition/removal
  *
diff -Naurp linux.orig/drivers/char/mem.c linux/drivers/char/mem.c
--- linux.orig/drivers/char/mem.c	2012-02-11 02:08:42.710002440 -0800
+++ linux/drivers/char/mem.c	2012-03-20 20:40:43.650000003 -0700
@@ -35,6 +35,8 @@
 # include <linux/efi.h>
 #endif
 
+#define DEVPORT_MINOR	4
+
 static inline unsigned long size_inside_page(unsigned long start,
 					     unsigned long size)
 {
@@ -910,6 +912,11 @@ static char *mem_devnode(struct device *
 
 static struct class *mem_class;
 
+int __init __weak legacy_isa_device_found(void)
+{
+	return 1;
+}
+
 static int __init chr_dev_init(void)
 {
 	int minor;
@@ -930,6 +937,13 @@ static int __init chr_dev_init(void)
 	for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) {
 		if (!devlist[minor].name)
 			continue;
+
+		/*
+		 * Create /dev/port? 
+		 */
+		if ((minor == DEVPORT_MINOR) && !legacy_isa_device_found())
+			continue;
+
 		device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor),
 			      NULL, devlist[minor].name);
 	}
diff -Naurp linux.orig/include/linux/isa.h linux/include/linux/isa.h
--- linux.orig/include/linux/isa.h	2012-02-11 02:07:52.030019810 -0800
+++ linux/include/linux/isa.h	2012-02-11 02:16:49.810002296 -0800
@@ -36,4 +36,5 @@ static inline void isa_unregister_driver
 }
 #endif
 
+extern int __init legacy_isa_device_found(void);
 #endif /* __LINUX_ISA_H */

             reply	other threads:[~2012-03-21  5:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21  5:37 Haren Myneni [this message]
2012-03-21  7:23 ` [PATCH] Disable /dev/port interface on powerpc systems Benjamin Herrenschmidt
2012-03-21 18:58   ` Haren Myneni
2012-03-21 20:48     ` Benjamin Herrenschmidt
2012-03-24  8:23   ` Haren Myneni
2012-06-08  2:00     ` Michael Ellerman
2012-04-30  5:00   ` Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2012-06-16  6:42 Haren Myneni

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=1332308237.23222.49.camel@hbabu-laptop \
    --to=haren@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.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