public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
From: Haren Myneni <haren@linux.vnet.ibm.com>
To: michael@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org, anton@samba.org
Subject: [PATCH] Disable /dev/port interface on powerpc systems
Date: Fri, 15 Jun 2012 23:42:13 -0700	[thread overview]
Message-ID: <1339828933.22619.15.camel@hbabu-laptop> (raw)

Michael, Thanks for the comment. Here it is the updated patch which
fixes x86 build.

Thanks
Haren

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/include/asm/io.h linux/arch/powerpc/include/asm/io.h
--- linux.orig/arch/powerpc/include/asm/io.h	2012-06-16 01:15:11.000000000 -0500
+++ linux/arch/powerpc/include/asm/io.h	2012-06-16 01:15:20.000000000 -0500
@@ -20,6 +20,14 @@ extern int check_legacy_ioport(unsigned 
 #define _PNPWRP		0xa79
 #define PNPBIOS_BASE	0xf000
 
+#ifdef CONFIG_PPC64
+extern struct pci_dev *isa_bridge_pcidev;
+/*
+ * has legacy ISA devices ?
+ */
+#define arch_has_dev_port()	(isa_bridge_pcidev != NULL)
+#endif
+
 #include <linux/device.h>
 #include <linux/io.h>
 
diff -Naurp linux.orig/drivers/char/mem.c linux/drivers/char/mem.c
--- linux.orig/drivers/char/mem.c	2012-06-16 01:15:42.000000000 -0500
+++ linux/drivers/char/mem.c	2012-06-16 01:15:53.000000000 -0500
@@ -27,14 +27,16 @@
 #include <linux/splice.h>
 #include <linux/pfn.h>
 #include <linux/export.h>
+#include <linux/io.h>
 
 #include <asm/uaccess.h>
-#include <asm/io.h>
 
 #ifdef CONFIG_IA64
 # include <linux/efi.h>
 #endif
 
+#define DEVPORT_MINOR	4
+
 static inline unsigned long size_inside_page(unsigned long start,
 					     unsigned long size)
 {
@@ -894,6 +896,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) && !arch_has_dev_port())
+			continue;
+
 		device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor),
 			      NULL, devlist[minor].name);
 	}
diff -Naurp linux.orig/include/linux/io.h linux/include/linux/io.h
--- linux.orig/include/linux/io.h	2012-06-16 01:16:13.000000000 -0500
+++ linux/include/linux/io.h	2012-06-16 01:16:24.000000000 -0500
@@ -67,4 +67,13 @@ int check_signature(const volatile void 
 			const unsigned char *signature, int length);
 void devm_ioremap_release(struct device *dev, void *res);
 
+/*
+ * Some systems do not have legacy ISA devices.
+ * /dev/port is not a valid interface on these systems.
+ * So for those archs, <asm/io.h> should define the following symbol.
+ */
+#ifndef arch_has_dev_port
+#define arch_has_dev_port()     (1)
+#endif
+
 #endif /* _LINUX_IO_H */

             reply	other threads:[~2012-06-16  6:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-16  6:42 Haren Myneni [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-21  5:37 [PATCH] Disable /dev/port interface on powerpc systems Haren Myneni
2012-03-21  7:23 ` 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

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=1339828933.22619.15.camel@hbabu-laptop \
    --to=haren@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=michael@ellerman.id.au \
    /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