From d346a5db02fc16263b44eb511fcb260265e3ef77 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 14 Apr 2013 22:17:20 +0200 Subject: m68k: Remove inline strcpy() and strcat() implementations Gcc may replace calls to standard string functions by open code and/or calls to other standard string functions. If the replacement function is not available out-of-line, link errors will happen. To avoid this, the out-of-line versions were provided by arch/m68k/lib/string.c, but they were usually not linked in anymore as typically none of its symbols are referenced by built-in code. However, if any module would need them, they would not be available. Hence remove the inline strcpy() and strcat() implementations, remove arch/m68k/lib/string.c, and let the generic string library code handle it. Impact on a typical kernel build seems minimal or nonexistent: - .text : 0x00001000 - 0x002aac74 (2728 KiB) - .data : 0x002ada48 - 0x00392148 ( 914 KiB) + .text : 0x00001000 - 0x002aacf4 (2728 KiB) + .data : 0x002adac8 - 0x00392148 ( 914 KiB) See also commit e00c73ee05dc38ecaccced55d4f5fc58b0b769f7 ("m68k: Remove inline strlen() implementation"). Signed-off-by: Geert Uytterhoeven --- arch/m68k/include/asm/string.h | 32 -------------------------------- arch/m68k/lib/Makefile | 2 +- arch/m68k/lib/string.c | 22 ---------------------- 3 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 arch/m68k/lib/string.c (limited to 'arch/m68k') diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h index 9aea9f11fa2..c30c03d9858 100644 --- a/arch/m68k/include/asm/string.h +++ b/arch/m68k/include/asm/string.h @@ -4,20 +4,6 @@ #include #include -static inline char *__kernel_strcpy(char *dest, const char *src) -{ - char *xdest = dest; - - asm volatile ("\n" - "1: move.b (%1)+,(%0)+\n" - " jne 1b" - : "+a" (dest), "+a" (src) - : : "memory"); - return xdest; -} - -#ifndef __IN_STRING_C - #define __HAVE_ARCH_STRNLEN static inline size_t strnlen(const char *s, size_t count) { @@ -34,16 +20,6 @@ static inline size_t strnlen(const char *s, size_t count) return sc - s; } -#define __HAVE_ARCH_STRCPY -#if __GNUC__ >= 4 -#define strcpy(d, s) (__builtin_constant_p(s) && \ - __builtin_strlen(s) <= 32 ? \ - __builtin_strcpy(d, s) : \ - __kernel_strcpy(d, s)) -#else -#define strcpy(d, s) __kernel_strcpy(d, s) -#endif - #define __HAVE_ARCH_STRNCPY static inline char *strncpy(char *dest, const char *src, size_t n) { @@ -61,12 +37,6 @@ static inline char *strncpy(char *dest, const char *src, size_t n) return xdest; } -#define __HAVE_ARCH_STRCAT -#define strcat(d, s) ({ \ - char *__d = (d); \ - strcpy(__d + strlen(__d), (s)); \ -}) - #ifndef CONFIG_COLDFIRE #define __HAVE_ARCH_STRCMP static inline int strcmp(const char *cs, const char *ct) @@ -100,6 +70,4 @@ extern void *memset(void *, int, __kernel_size_t); extern void *memcpy(void *, const void *, __kernel_size_t); #define memcpy(d, s, n) __builtin_memcpy(d, s, n) -#endif - #endif /* _M68K_STRING_H_ */ diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile index a9d782d3427..fcd8eb1d7c7 100644 --- a/arch/m68k/lib/Makefile +++ b/arch/m68k/lib/Makefile @@ -6,7 +6,7 @@ lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ memcpy.o memset.o memmove.o -lib-$(CONFIG_MMU) += string.o uaccess.o +lib-$(CONFIG_MMU) += uaccess.o lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += mulsi3.o divsi3.o udivsi3.o lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += modsi3.o umodsi3.o diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c deleted file mode 100644 index 4d61fa8a112..00000000000 --- a/arch/m68k/lib/string.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - */ - -#define __IN_STRING_C - -#include -#include - -char *strcpy(char *dest, const char *src) -{ - return __kernel_strcpy(dest, src); -} -EXPORT_SYMBOL(strcpy); - -char *strcat(char *dest, const char *src) -{ - return __kernel_strcpy(dest + strlen(dest), src); -} -EXPORT_SYMBOL(strcat); -- cgit v1.2.3-70-g09d2 From 5ecf85f082e2e0f4bfd967b9c7ae9d0b89552153 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Thu, 9 May 2013 14:36:56 +0400 Subject: m68k/sun3: remove inline marking of EXPORT_SYMBOL functions EXPORT_SYMBOL and inline directives are contradictory to each other. The patch fixes this inconsistency. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Denis Efremov Signed-off-by: Geert Uytterhoeven --- arch/m68k/sun3/sun3dvma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/m68k') diff --git a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c index ca0966cac72..cab54482ca3 100644 --- a/arch/m68k/sun3/sun3dvma.c +++ b/arch/m68k/sun3/sun3dvma.c @@ -275,7 +275,7 @@ void dvma_init(void) } -inline unsigned long dvma_map_align(unsigned long kaddr, int len, int align) +unsigned long dvma_map_align(unsigned long kaddr, int len, int align) { unsigned long baddr; -- cgit v1.2.3-70-g09d2 From 220921a0d1d2ab91ad719c06a09d86f0e8852bfa Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 29 May 2013 16:53:32 +1000 Subject: m68k: remove CONFIG_EARLY_PRINTK dependency on CONFIG_EMBEDDED, default to n Allow CONFIG_EARLY_PRINTK without requiring both CONFIG_EMBEDDED and CONFIG_DEBUG. Default to disabled. Signed-off-by: Finn Thain Signed-off-by: Laurent Vivier Signed-off-by: Geert Uytterhoeven --- arch/m68k/Kconfig.debug | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/Kconfig.debug b/arch/m68k/Kconfig.debug index fa12283d58f..22968272124 100644 --- a/arch/m68k/Kconfig.debug +++ b/arch/m68k/Kconfig.debug @@ -11,9 +11,8 @@ config BOOTPARAM_STRING depends on BOOTPARAM config EARLY_PRINTK - bool "Early printk" if EMBEDDED + bool "Early printk" depends on MVME16x || MAC - default y help Write kernel log output directly to a serial port. -- cgit v1.2.3-70-g09d2 From ddc2fc2c5bf459d49c241123112741b99198f473 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Thu, 30 May 2013 16:21:36 +0800 Subject: m68k/math-emu: unsigned issue, 'unsigned long' will never be less than zero 'oldmant.m32[1]' is 'unsigned long' which can never be '< 0', and the original author wanted to check whether the highest bit is set. So make the bit test explicit (which is better than casting from 'unsigned long' to 'long'). The related warning: (with EXTRA_CFLAGS=-W ARCH=m68k for allmodconfig) arch/m68k/math-emu/fp_arith.c:522:4: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] Signed-off-by: Chen Gang Signed-off-by: Geert Uytterhoeven --- arch/m68k/math-emu/fp_arith.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/m68k') diff --git a/arch/m68k/math-emu/fp_arith.c b/arch/m68k/math-emu/fp_arith.c index 08f286db3c5..239eb199018 100644 --- a/arch/m68k/math-emu/fp_arith.c +++ b/arch/m68k/math-emu/fp_arith.c @@ -519,7 +519,7 @@ static void fp_roundint(struct fp_ext *dest, int mode) return; break; case 0x401e: - if (!(oldmant.m32[1] >= 0)) + if (oldmant.m32[1] & 0x80000000) return; if (oldmant.m32[0] & 1) break; -- cgit v1.2.3-70-g09d2 From 378f7ca6aa2269519b825246e63f81f95f10a63b Mon Sep 17 00:00:00 2001 From: Thomas Bogendoerfer Date: Mon, 3 Jun 2013 12:53:01 +0200 Subject: m68k/irq: Vector ints need a valid interrupt handler To get vectored interrupts working we need to switch from the default handler handle_bad_irq() to something more sensible. Tested on a MVME177 board. Signed-off-by: Thomas Bogendoerfer Signed-off-by: Geert Uytterhoeven --- arch/m68k/kernel/ints.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/m68k') diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c index 6b32b64bac3..4d7da384eea 100644 --- a/arch/m68k/kernel/ints.c +++ b/arch/m68k/kernel/ints.c @@ -101,7 +101,7 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt) BUG_ON(IRQ_USER + cnt > NR_IRQS); m68k_first_user_vec = vec; for (i = 0; i < cnt; i++) - irq_set_chip(IRQ_USER + i, &user_irq_chip); + irq_set_chip_and_handler(i, &user_irq_chip, handle_simple_irq); *user_irqvec_fixup = vec - IRQ_USER; flush_icache(); } -- cgit v1.2.3-70-g09d2 From 631d8b674f5f8235e9cb7e628b0fe9e5200e3158 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 9 Jun 2013 20:12:42 +0200 Subject: m68k/uaccess: Fix asm constraints for userspace access When compiling a MMU kernel with CPU_HAS_ADDRESS_SPACES=n (e.g. "MMU=y allnoconfig": "echo CONFIG_MMU=y > allno.config && make KCONFIG_ALLCONFIG=1 allnoconfig"), we use plain "move" instead of "moves", and I got: CC arch/m68k/lib/uaccess.o {standard input}: Assembler messages: {standard input}:47: Error: operands mismatch -- statement `move.b %a0,(%a1)' ignored This happens because plain "move" doesn't support byte transfers between memory and address registers, while "moves" does. Fix the asm constraints for __generic_copy_from_user(), __generic_copy_to_user(), and __clear_user() to only use data registers when accessing userspace. Also, relax the asm constraints for 16-bit userspace accesses in __put_user() and __get_user(), as both "move" and "moves" do support such transfers between memory and address registers. Signed-off-by: Geert Uytterhoeven --- arch/m68k/include/asm/uaccess_mm.h | 8 ++++---- arch/m68k/lib/uaccess.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/include/asm/uaccess_mm.h b/arch/m68k/include/asm/uaccess_mm.h index 472c891a4ae..15901db435b 100644 --- a/arch/m68k/include/asm/uaccess_mm.h +++ b/arch/m68k/include/asm/uaccess_mm.h @@ -90,7 +90,7 @@ asm volatile ("\n" \ __put_user_asm(__pu_err, __pu_val, ptr, b, d, -EFAULT); \ break; \ case 2: \ - __put_user_asm(__pu_err, __pu_val, ptr, w, d, -EFAULT); \ + __put_user_asm(__pu_err, __pu_val, ptr, w, r, -EFAULT); \ break; \ case 4: \ __put_user_asm(__pu_err, __pu_val, ptr, l, r, -EFAULT); \ @@ -158,7 +158,7 @@ asm volatile ("\n" \ __get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \ break; \ case 2: \ - __get_user_asm(__gu_err, x, ptr, u16, w, d, -EFAULT); \ + __get_user_asm(__gu_err, x, ptr, u16, w, r, -EFAULT); \ break; \ case 4: \ __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \ @@ -245,7 +245,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n) __get_user_asm(res, *(u8 *)to, (u8 __user *)from, u8, b, d, 1); break; case 2: - __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, d, 2); + __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, r, 2); break; case 3: __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,); @@ -326,7 +326,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) __put_user_asm(res, *(u8 *)from, (u8 __user *)to, b, d, 1); break; case 2: - __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, d, 2); + __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, r, 2); break; case 3: __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,); diff --git a/arch/m68k/lib/uaccess.c b/arch/m68k/lib/uaccess.c index 5e97f2ee7c1..35d1442dee8 100644 --- a/arch/m68k/lib/uaccess.c +++ b/arch/m68k/lib/uaccess.c @@ -52,7 +52,7 @@ unsigned long __generic_copy_from_user(void *to, const void __user *from, " .long 3b,30b\n" " .long 5b,50b\n" " .previous" - : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp) + : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp) : "0" (n / 4), "d" (n & 3)); return res; @@ -96,7 +96,7 @@ unsigned long __generic_copy_to_user(void __user *to, const void *from, " .long 7b,50b\n" " .long 8b,50b\n" " .previous" - : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp) + : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp) : "0" (n / 4), "d" (n & 3)); return res; @@ -141,7 +141,7 @@ unsigned long __clear_user(void __user *to, unsigned long n) " .long 7b,40b\n" " .previous" : "=d" (res), "+a" (to) - : "r" (0), "0" (n / 4), "d" (n & 3)); + : "d" (0), "0" (n / 4), "d" (n & 3)); return res; } -- cgit v1.2.3-70-g09d2 From db8ac55ca7908a484c11f15c100358d65c108225 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Mon, 17 Jun 2013 17:40:01 +0200 Subject: m68k/q40: Undefine insl/outsl before redefining them To use the PC parallel port driver on Q40, we need non-standard versions of the insl/outsl accessors. Make sure to undefine them first, to kill this compiler warning: In file included from drivers/parport/parport_pc.c:67: arch/m68k/include/asm/parport.h:14:1: warning: "insl" redefined In file included from arch/m68k/include/asm/io.h:4, from include/linux/scatterlist.h:10, from include/linux/dma-mapping.h:9, from drivers/parport/parport_pc.c:54: arch/m68k/include/asm/io_mm.h:370:1: warning: this is the location of the previous definition In file included from drivers/parport/parport_pc.c:67: arch/m68k/include/asm/parport.h:15:1: warning: "outsl" redefined In file included from arch/m68k/include/asm/io.h:4, from include/linux/scatterlist.h:10, from include/linux/dma-mapping.h:9, from drivers/parport/parport_pc.c:54: arch/m68k/include/asm/io_mm.h:373:1: warning: this is the location of the previous definition Reported-by: Thorsten Glaser Signed-off-by: Geert Uytterhoeven --- arch/m68k/include/asm/parport.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/m68k') diff --git a/arch/m68k/include/asm/parport.h b/arch/m68k/include/asm/parport.h index 5ea75e6a739..c85cece778e 100644 --- a/arch/m68k/include/asm/parport.h +++ b/arch/m68k/include/asm/parport.h @@ -11,6 +11,8 @@ #ifndef _ASM_M68K_PARPORT_H #define _ASM_M68K_PARPORT_H 1 +#undef insl +#undef outsl #define insl(port,buf,len) isa_insb(port,buf,(len)<<2) #define outsl(port,buf,len) isa_outsb(port,buf,(len)<<2) -- cgit v1.2.3-70-g09d2 From 980f3a7315b4691ec90538352a9e9c5a53ea9d34 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Mon, 17 Jun 2013 17:50:46 +0200 Subject: m68k/q40: Enable PC parallel port in defconfig Enable the PC parallel port and other related options in the Q40-specific and multi-platform defconfigs. Signed-off-by: Geert Uytterhoeven --- arch/m68k/configs/multi_defconfig | 2 ++ arch/m68k/configs/q40_defconfig | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'arch/m68k') diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig index 0f795d8e65f..b17a8837f0e 100644 --- a/arch/m68k/configs/multi_defconfig +++ b/arch/m68k/configs/multi_defconfig @@ -214,6 +214,7 @@ CONFIG_DEVTMPFS=y # CONFIG_FW_LOADER_USER_HELPER is not set CONFIG_CONNECTOR=m CONFIG_PARPORT=m +CONFIG_PARPORT_PC=m CONFIG_PARPORT_AMIGA=m CONFIG_PARPORT_MFC3=m CONFIG_PARPORT_ATARI=m @@ -325,6 +326,7 @@ CONFIG_ZORRO8390=y # CONFIG_NET_VENDOR_SEEQ is not set # CONFIG_NET_VENDOR_STMICRO is not set # CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_PLIP=m CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig index 8982370e8b4..be1496ed9b6 100644 --- a/arch/m68k/configs/q40_defconfig +++ b/arch/m68k/configs/q40_defconfig @@ -199,6 +199,9 @@ CONFIG_DEVTMPFS=y # CONFIG_FIRMWARE_IN_KERNEL is not set # CONFIG_FW_LOADER_USER_HELPER is not set CONFIG_CONNECTOR=m +CONFIG_PARPORT=m +CONFIG_PARPORT_PC=m +CONFIG_PARPORT_1284=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_CRYPTOLOOP=m CONFIG_BLK_DEV_DRBD=m @@ -267,6 +270,7 @@ CONFIG_NE2000=m # CONFIG_NET_VENDOR_SMSC is not set # CONFIG_NET_VENDOR_STMICRO is not set # CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_PLIP=m CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m @@ -292,9 +296,11 @@ CONFIG_SERIO_Q40KBD=y CONFIG_VT_HW_CONSOLE_BINDING=y # CONFIG_LEGACY_PTYS is not set # CONFIG_DEVKMEM is not set +CONFIG_PRINTER=m # CONFIG_HW_RANDOM is not set CONFIG_NTP_PPS=y CONFIG_PPS_CLIENT_LDISC=m +CONFIG_PPS_CLIENT_PARPORT=m CONFIG_PTP_1588_CLOCK=m # CONFIG_HWMON is not set CONFIG_FB=y -- cgit v1.2.3-70-g09d2