From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e34.co.us.ibm.com", Issuer "Equifax" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7C570B6EE6 for ; Sat, 24 Mar 2012 19:23:16 +1100 (EST) Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 24 Mar 2012 02:23:12 -0600 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 605A1C90052 for ; Sat, 24 Mar 2012 04:23:05 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2O8N5cc224422 for ; Sat, 24 Mar 2012 04:23:05 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2O8N4tW003305 for ; Sat, 24 Mar 2012 05:23:05 -0300 Subject: [PATCH] Disable /dev/port interface on powerpc systems From: Haren Myneni To: Benjamin Herrenschmidt In-Reply-To: <1332314613.2982.38.camel@pasglop> References: <1332308237.23222.49.camel@hbabu-laptop> <1332314613.2982.38.camel@pasglop> Content-Type: text/plain; charset="UTF-8" Date: Sat, 24 Mar 2012 01:23:03 -0700 Message-ID: <1332577383.19329.5.camel@hbabu-laptop> Mime-Version: 1.0 Cc: linuxppc-dev@lists.ozlabs.org, anton@samba.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Ben, Here it is the updated patch based on your suggestions. Please let me know if it has any issues. 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 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-03-24 00:51:21.619999958 -0700 +++ linux/arch/powerpc/include/asm/io.h 2012-03-24 00:52:50.450000543 -0700 @@ -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 #include diff -Naurp linux.orig/drivers/char/mem.c linux/drivers/char/mem.c --- linux.orig/drivers/char/mem.c 2012-03-24 00:50:21.570000660 -0700 +++ linux/drivers/char/mem.c 2012-03-24 00:52:32.080000802 -0700 @@ -35,6 +35,8 @@ # include #endif +#define DEVPORT_MINOR 4 + static inline unsigned long size_inside_page(unsigned long start, unsigned long size) { @@ -930,6 +932,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-03-24 00:54:18.060000449 -0700 +++ linux/include/linux/io.h 2012-03-24 01:12:43.280000840 -0700 @@ -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, should define the following symbol. + */ +#ifndef arch_has_dev_port +#define arch_has_dev_port() (1) +#endif + #endif /* _LINUX_IO_H */