]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
powerpc: Disable /dev/port interface on systems without an ISA bridge
authorHaren Myneni <haren@us.ibm.com>
Wed, 11 Jul 2012 05:18:44 +0000 (15:18 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 11 Jul 2012 08:22:32 +0000 (18:22 +1000)
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>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/io.h
drivers/char/mem.c
include/linux/io.h

index a3855b81eada2ed893a6d272198e6add4b85752e..f94ef4213e9d03f80e1c0f180ea9a75d966358ad 100644 (file)
@@ -20,6 +20,14 @@ extern int check_legacy_ioport(unsigned long base_port);
 #define _PNPWRP                0xa79
 #define PNPBIOS_BASE   0xf000
 
+#if defined(CONFIG_PPC64) && defined(CONFIG_PCI)
+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>
 
index 67c3371723cc3b2f953fe528c6c4eef3af8f0e3a..e5eedfa24c91010bd8358db7b7076e4f0af6ad1b 100644 (file)
 #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);
        }
index 7fd2d2138bf3de8130e5660922a32fe81a47f22b..069e4075f8720331f99696e34a563d4ac1b76e35 100644 (file)
@@ -67,4 +67,13 @@ int check_signature(const volatile void __iomem *io_addr,
                        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 */