From 0728a2f99ef6efd1984f9e0ed59834c1cc602e6f Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Sat, 11 Feb 2006 18:21:47 +0100 Subject: [PATCH] powerpc: remove duplicate exports A few symbols are exported twice, remove them from ppc_ksyms.c Remove users of sys_ctrler in arch/ppc/ WARNING: vmlinux: duplicate symbol '__delay' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol '__up' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol '__down' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol '__down_interruptible' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'sys_ctrler' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'strncat' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'strncmp' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'strchr' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'strrchr' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'strnlen' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'strpbrk' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'memscan' previous definition was in vmlinux WARNING: vmlinux: duplicate symbol 'strstr' previous definition was in vmlinux Signed-off-by: Olaf Hering Signed-off-by: Paul Mackerras --- arch/ppc/kernel/ppc_ksyms.c | 8 -------- arch/ppc/xmon/start.c | 15 +-------------- 2 files changed, 1 insertion(+), 22 deletions(-) (limited to 'arch/ppc') diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 15bd9b448a4..82adb460134 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c @@ -93,15 +93,8 @@ EXPORT_SYMBOL(test_and_change_bit); EXPORT_SYMBOL(strcpy); EXPORT_SYMBOL(strncpy); EXPORT_SYMBOL(strcat); -EXPORT_SYMBOL(strncat); -EXPORT_SYMBOL(strchr); -EXPORT_SYMBOL(strrchr); -EXPORT_SYMBOL(strpbrk); -EXPORT_SYMBOL(strstr); EXPORT_SYMBOL(strlen); -EXPORT_SYMBOL(strnlen); EXPORT_SYMBOL(strcmp); -EXPORT_SYMBOL(strncmp); EXPORT_SYMBOL(strcasecmp); EXPORT_SYMBOL(__div64_32); @@ -253,7 +246,6 @@ EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(cacheable_memcpy); EXPORT_SYMBOL(memset); EXPORT_SYMBOL(memmove); -EXPORT_SYMBOL(memscan); EXPORT_SYMBOL(memcmp); EXPORT_SYMBOL(memchr); diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c index 4344cbe9b5c..484f5bb1aa3 100644 --- a/arch/ppc/xmon/start.c +++ b/arch/ppc/xmon/start.c @@ -146,19 +146,6 @@ xmon_map_scc(void) static int scc_initialized = 0; void xmon_init_scc(void); -extern void cuda_poll(void); - -static inline void do_poll_adb(void) -{ -#ifdef CONFIG_ADB_PMU - if (sys_ctrler == SYS_CTRLER_PMU) - pmu_poll_adb(); -#endif /* CONFIG_ADB_PMU */ -#ifdef CONFIG_ADB_CUDA - if (sys_ctrler == SYS_CTRLER_CUDA) - cuda_poll(); -#endif /* CONFIG_ADB_CUDA */ -} int xmon_write(void *handle, void *ptr, int nb) @@ -189,7 +176,7 @@ xmon_write(void *handle, void *ptr, int nb) ct = 0; for (i = 0; i < nb; ++i) { while ((*sccc & TXRDY) == 0) - do_poll_adb(); + ; c = p[i]; if (c == '\n' && !ct) { c = '\r'; -- cgit v1.2.3 From c57914a4f24322a8f7ef06a8e2fca5f0b2c98878 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 21 Feb 2006 21:06:41 +0100 Subject: [PATCH] ppc: fix adb breakage in xmon Fix up xmon compilation after the last change. Remove lots of dead code, all the pmac and chrp support is in arch/powerpc Signed-off-by: Olaf Hering Signed-off-by: Paul Mackerras --- arch/ppc/xmon/adb.c | 212 -------------------------------------------------- arch/ppc/xmon/start.c | 169 +--------------------------------------- arch/ppc/xmon/xmon.c | 108 ------------------------- 3 files changed, 3 insertions(+), 486 deletions(-) delete mode 100644 arch/ppc/xmon/adb.c (limited to 'arch/ppc') diff --git a/arch/ppc/xmon/adb.c b/arch/ppc/xmon/adb.c deleted file mode 100644 index e91384dccca..00000000000 --- a/arch/ppc/xmon/adb.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 1996 Paul Mackerras. - */ -#include "nonstdio.h" -#include "privinst.h" - -#define scanhex xmon_scanhex -#define skipbl xmon_skipbl - -#define ADB_B (*(volatile unsigned char *)0xf3016000) -#define ADB_SR (*(volatile unsigned char *)0xf3017400) -#define ADB_ACR (*(volatile unsigned char *)0xf3017600) -#define ADB_IFR (*(volatile unsigned char *)0xf3017a00) - -static inline void eieio(void) { asm volatile ("eieio" : :); } - -#define N_ADB_LOG 1000 -struct adb_log { - unsigned char b; - unsigned char ifr; - unsigned char acr; - unsigned int time; -} adb_log[N_ADB_LOG]; -int n_adb_log; - -void -init_adb_log(void) -{ - adb_log[0].b = ADB_B; - adb_log[0].ifr = ADB_IFR; - adb_log[0].acr = ADB_ACR; - adb_log[0].time = get_dec(); - n_adb_log = 0; -} - -void -dump_adb_log(void) -{ - unsigned t, t0; - struct adb_log *ap; - int i; - - ap = adb_log; - t0 = ap->time; - for (i = 0; i <= n_adb_log; ++i, ++ap) { - t = t0 - ap->time; - printf("b=%x ifr=%x acr=%x at %d.%.7d\n", ap->b, ap->ifr, ap->acr, - t / 1000000000, (t % 1000000000) / 100); - } -} - -void -adb_chklog(void) -{ - struct adb_log *ap = &adb_log[n_adb_log + 1]; - - ap->b = ADB_B; - ap->ifr = ADB_IFR; - ap->acr = ADB_ACR; - if (ap->b != ap[-1].b || (ap->ifr & 4) != (ap[-1].ifr & 4) - || ap->acr != ap[-1].acr) { - ap->time = get_dec(); - ++n_adb_log; - } -} - -int -adb_bitwait(int bmask, int bval, int fmask, int fval) -{ - int i; - struct adb_log *ap; - - for (i = 10000; i > 0; --i) { - adb_chklog(); - ap = &adb_log[n_adb_log]; - if ((ap->b & bmask) == bval && (ap->ifr & fmask) == fval) - return 0; - } - return -1; -} - -int -adb_wait(void) -{ - if (adb_bitwait(0, 0, 4, 4) < 0) { - printf("adb: ready wait timeout\n"); - return -1; - } - return 0; -} - -void -adb_readin(void) -{ - int i, j; - unsigned char d[64]; - - if (ADB_B & 8) { - printf("ADB_B: %x\n", ADB_B); - return; - } - i = 0; - adb_wait(); - j = ADB_SR; - eieio(); - ADB_B &= ~0x20; - eieio(); - for (;;) { - if (adb_wait() < 0) - break; - d[i++] = ADB_SR; - eieio(); - if (ADB_B & 8) - break; - ADB_B ^= 0x10; - eieio(); - } - ADB_B |= 0x30; - if (adb_wait() == 0) - j = ADB_SR; - for (j = 0; j < i; ++j) - printf("%.2x ", d[j]); - printf("\n"); -} - -int -adb_write(unsigned char *d, int i) -{ - int j; - unsigned x; - - if ((ADB_B & 8) == 0) { - printf("r: "); - adb_readin(); - } - for (;;) { - ADB_ACR = 0x1c; - eieio(); - ADB_SR = d[0]; - eieio(); - ADB_B &= ~0x20; - eieio(); - if (ADB_B & 8) - break; - ADB_ACR = 0xc; - eieio(); - ADB_B |= 0x20; - eieio(); - adb_readin(); - } - adb_wait(); - for (j = 1; j < i; ++j) { - ADB_SR = d[j]; - eieio(); - ADB_B ^= 0x10; - eieio(); - if (adb_wait() < 0) - break; - } - ADB_ACR = 0xc; - eieio(); - x = ADB_SR; - eieio(); - ADB_B |= 0x30; - return j; -} - -void -adbcmds(void) -{ - char cmd; - unsigned rtcu, rtcl, dec, pdec, x; - int i, j; - unsigned char d[64]; - - cmd = skipbl(); - switch (cmd) { - case 't': - for (;;) { - rtcl = get_rtcl(); - rtcu = get_rtcu(); - dec = get_dec(); - printf("rtc u=%u l=%u dec=%x (%d = %d.%.7d)\n", - rtcu, rtcl, dec, pdec - dec, (pdec - dec) / 1000000000, - ((pdec - dec) % 1000000000) / 100); - pdec = dec; - if (cmd == 'x') - break; - while (xmon_read(stdin, &cmd, 1) != 1) - ; - } - break; - case 'r': - init_adb_log(); - while (adb_bitwait(8, 0, 0, 0) == 0) - adb_readin(); - break; - case 'w': - i = 0; - while (scanhex(&x)) - d[i++] = x; - init_adb_log(); - j = adb_write(d, i); - printf("sent %d bytes\n", j); - while (adb_bitwait(8, 0, 0, 0) == 0) - adb_readin(); - break; - case 'l': - dump_adb_log(); - break; - } -} diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c index 484f5bb1aa3..ff86b2d814c 100644 --- a/arch/ppc/xmon/start.c +++ b/arch/ppc/xmon/start.c @@ -6,16 +6,11 @@ #include #include #include -#include -#include -#include #include #include #include #include #include -#include -#include #include #include #include @@ -26,9 +21,7 @@ static volatile unsigned char *sccc, *sccd; unsigned int TXRDY, RXRDY, DLAB; static int xmon_expect(const char *str, unsigned int timeout); -static int use_screen; static int via_modem; -static int xmon_use_sccb; #define TB_SPEED 25000000 @@ -46,47 +39,6 @@ void buf_access(void) sccd[3] &= ~DLAB; /* reset DLAB */ } -extern int adb_init(void); - -#ifdef CONFIG_PPC_CHRP -/* - * This looks in the "ranges" property for the primary PCI host bridge - * to find the physical address of the start of PCI/ISA I/O space. - * It is basically a cut-down version of pci_process_bridge_OF_ranges. - */ -static unsigned long chrp_find_phys_io_base(void) -{ - struct device_node *node; - unsigned int *ranges; - unsigned long base = CHRP_ISA_IO_BASE; - int rlen = 0; - int np; - - node = find_devices("isa"); - if (node != NULL) { - node = node->parent; - if (node == NULL || node->type == NULL - || strcmp(node->type, "pci") != 0) - node = NULL; - } - if (node == NULL) - node = find_devices("pci"); - if (node == NULL) - return base; - - ranges = (unsigned int *) get_property(node, "ranges", &rlen); - np = prom_n_addr_cells(node) + 5; - while ((rlen -= np * sizeof(unsigned int)) >= 0) { - if ((ranges[0] >> 24) == 1 && ranges[2] == 0) { - /* I/O space starting at 0, grab the phys base */ - base = ranges[np - 3]; - break; - } - ranges += np; - } - return base; -} -#endif /* CONFIG_PPC_CHRP */ #ifdef CONFIG_MAGIC_SYSRQ static void sysrq_handle_xmon(int key, struct pt_regs *regs, @@ -109,22 +61,6 @@ xmon_map_scc(void) #ifdef CONFIG_PPC_MULTIPLATFORM volatile unsigned char *base; -#ifdef CONFIG_PPC_CHRP - base = (volatile unsigned char *) isa_io_base; - if (_machine == _MACH_chrp) - base = (volatile unsigned char *) - ioremap(chrp_find_phys_io_base(), 0x1000); - - sccc = base + 0x3fd; - sccd = base + 0x3f8; - if (xmon_use_sccb) { - sccc -= 0x100; - sccd -= 0x100; - } - TXRDY = 0x20; - RXRDY = 1; - DLAB = 0x80; -#endif /* CONFIG_PPC_CHRP */ #elif defined(CONFIG_GEMINI) /* should already be mapped by the kernel boot */ sccc = (volatile unsigned char *) 0xffeffb0d; @@ -143,7 +79,7 @@ xmon_map_scc(void) register_sysrq_key('x', &sysrq_xmon_op); } -static int scc_initialized = 0; +static int scc_initialized; void xmon_init_scc(void); @@ -163,14 +99,6 @@ xmon_write(void *handle, void *ptr, int nb) break; #endif -#ifdef CONFIG_BOOTX_TEXT - if (use_screen) { - /* write it on the screen */ - for (i = 0; i < nb; ++i) - btext_drawchar(*p++); - goto out; - } -#endif if (!scc_initialized) xmon_init_scc(); ct = 0; @@ -190,7 +118,6 @@ xmon_write(void *handle, void *ptr, int nb) eieio(); } - out: #ifdef CONFIG_SMP if (!locked) clear_bit(0, &xmon_write_lock); @@ -199,65 +126,7 @@ xmon_write(void *handle, void *ptr, int nb) } int xmon_wants_key; -int xmon_adb_keycode; - -#ifdef CONFIG_BOOTX_TEXT -static int xmon_adb_shiftstate; - -static unsigned char xmon_keytab[128] = - "asdfhgzxcv\000bqwer" /* 0x00 - 0x0f */ - "yt123465=97-80]o" /* 0x10 - 0x1f */ - "u[ip\rlj'k;\\,/nm." /* 0x20 - 0x2f */ - "\t `\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */ - "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */ - "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */ - -static unsigned char xmon_shift_keytab[128] = - "ASDFHGZXCV\000BQWER" /* 0x00 - 0x0f */ - "YT!@#$^%+(&_*)}O" /* 0x10 - 0x1f */ - "U{IP\rLJ\"K:|" /* 0x20 - 0x2f */ - "\t ~\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */ - "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */ - "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */ - -static int -xmon_get_adb_key(void) -{ - int k, t, on; - xmon_wants_key = 1; - for (;;) { - xmon_adb_keycode = -1; - t = 0; - on = 0; - do { - if (--t < 0) { - on = 1 - on; - btext_drawchar(on? 0xdb: 0x20); - btext_drawchar('\b'); - t = 200000; - } - do_poll_adb(); - } while (xmon_adb_keycode == -1); - k = xmon_adb_keycode; - if (on) - btext_drawstring(" \b"); - - /* test for shift keys */ - if ((k & 0x7f) == 0x38 || (k & 0x7f) == 0x7b) { - xmon_adb_shiftstate = (k & 0x80) == 0; - continue; - } - if (k >= 0x80) - continue; /* ignore up transitions */ - k = (xmon_adb_shiftstate? xmon_shift_keytab: xmon_keytab)[k]; - if (k != 0) - break; - } - xmon_wants_key = 0; - return k; -} -#endif /* CONFIG_BOOTX_TEXT */ int xmon_read(void *handle, void *ptr, int nb) @@ -265,18 +134,11 @@ xmon_read(void *handle, void *ptr, int nb) char *p = ptr; int i; -#ifdef CONFIG_BOOTX_TEXT - if (use_screen) { - for (i = 0; i < nb; ++i) - *p++ = xmon_get_adb_key(); - return i; - } -#endif if (!scc_initialized) xmon_init_scc(); for (i = 0; i < nb; ++i) { while ((*sccc & RXRDY) == 0) - do_poll_adb(); + ; buf_access(); *p++ = *sccd; } @@ -287,7 +149,7 @@ int xmon_read_poll(void) { if ((*sccc & RXRDY) == 0) { - do_poll_adb(); + ; return -1; } buf_access(); @@ -297,15 +159,6 @@ xmon_read_poll(void) void xmon_init_scc(void) { - if ( _machine == _MACH_chrp ) - { - sccd[3] = 0x83; eieio(); /* LCR = 8N1 + DLAB */ - sccd[0] = 12; eieio(); /* DLL = 9600 baud */ - sccd[1] = 0; eieio(); - sccd[2] = 0; eieio(); /* FCR = 0 */ - sccd[3] = 3; eieio(); /* LCR = 8N1 */ - sccd[1] = 0; eieio(); /* IER = 0 */ - } scc_initialized = 1; if (via_modem) { for (;;) { @@ -321,22 +174,6 @@ xmon_init_scc(void) } } -#if 0 -extern int (*prom_entry)(void *); - -int -xmon_exit(void) -{ - struct prom_args { - char *service; - } args; - - for (;;) { - args.service = "exit"; - (*prom_entry)(&args); - } -} -#endif void *xmon_stdin; void *xmon_stdout; diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c index bdaf6597b4c..06fa44b5c64 100644 --- a/arch/ppc/xmon/xmon.c +++ b/arch/ppc/xmon/xmon.c @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #include #include "nonstdio.h" @@ -101,9 +99,6 @@ void cacheflush(void); static void cpu_cmd(void); #endif /* CONFIG_SMP */ static void csum(void); -#ifdef CONFIG_BOOTX_TEXT -static void vidcmds(void); -#endif static void bootcmds(void); static void proccall(void); static void printtime(void); @@ -522,11 +517,6 @@ cmds(struct pt_regs *excp) cpu_cmd(); break; #endif /* CONFIG_SMP */ -#ifdef CONFIG_BOOTX_TEXT - case 'v': - vidcmds(); - break; -#endif case 'z': bootcmds(); break; @@ -618,43 +608,6 @@ static void cpu_cmd(void) } #endif /* CONFIG_SMP */ -#ifdef CONFIG_BOOTX_TEXT -extern boot_infos_t disp_bi; - -static void vidcmds(void) -{ - int c = inchar(); - unsigned int val, w; - extern int boot_text_mapped; - - if (!boot_text_mapped) - return; - if (c != '\n' && scanhex(&val)) { - switch (c) { - case 'd': - w = disp_bi.dispDeviceRowBytes - / (disp_bi.dispDeviceDepth >> 3); - disp_bi.dispDeviceDepth = val; - disp_bi.dispDeviceRowBytes = w * (val >> 3); - return; - case 'p': - disp_bi.dispDeviceRowBytes = val; - return; - case 'w': - disp_bi.dispDeviceRect[2] = val; - return; - case 'h': - disp_bi.dispDeviceRect[3] = val; - return; - } - } - printf("W = %d (0x%x) H = %d (0x%x) D = %d (0x%x) P = %d (0x%x)\n", - disp_bi.dispDeviceRect[2], disp_bi.dispDeviceRect[2], - disp_bi.dispDeviceRect[3], disp_bi.dispDeviceRect[3], - disp_bi.dispDeviceDepth, disp_bi.dispDeviceDepth, - disp_bi.dispDeviceRowBytes, disp_bi.dispDeviceRowBytes); -} -#endif /* CONFIG_BOOTX_TEXT */ static unsigned short fcstab[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, @@ -1020,7 +973,6 @@ dump_hash_table(void) } #else -#ifndef CONFIG_PPC64BRIDGE static void dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) { @@ -1079,66 +1031,6 @@ dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) printf(" ... %x\n", last_va); } -#else /* CONFIG_PPC64BRIDGE */ -static void -dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) -{ - extern void *Hash; - extern unsigned long Hash_size; - unsigned *htab = Hash; - unsigned hsize = Hash_size; - unsigned v, hmask, va, last_va; - int found, last_found, i; - unsigned *hg, w1, last_w2, last_va0; - - last_found = 0; - hmask = hsize / 128 - 1; - va = start; - start = (start >> 12) & 0xffff; - end = (end >> 12) & 0xffff; - for (v = start; v < end; ++v) { - found = 0; - hg = htab + (((v ^ seg) & hmask) * 32); - w1 = 1 | (seg << 12) | ((v & 0xf800) >> 4); - for (i = 0; i < 8; ++i, hg += 4) { - if (hg[1] == w1) { - found = 1; - break; - } - } - if (!found) { - w1 ^= 2; - hg = htab + ((~(v ^ seg) & hmask) * 32); - for (i = 0; i < 8; ++i, hg += 4) { - if (hg[1] == w1) { - found = 1; - break; - } - } - } - if (!(last_found && found && (hg[3] & ~0x180) == last_w2 + 4096)) { - if (last_found) { - if (last_va != last_va0) - printf(" ... %x", last_va); - printf("\n"); - } - if (found) { - printf("%x to %x", va, hg[3]); - last_va0 = va; - } - last_found = found; - } - if (found) { - last_w2 = hg[3] & ~0x180; - last_va = va; - } - va += 4096; - } - if (last_found) - printf(" ... %x\n", last_va); -} -#endif /* CONFIG_PPC64BRIDGE */ - static unsigned hash_ctx; static unsigned hash_start; static unsigned hash_end; -- cgit v1.2.3 From f1434a4854407a262d194411245eb9ee66221f90 Mon Sep 17 00:00:00 2001 From: Alan Curry Date: Wed, 22 Feb 2006 01:42:37 -0500 Subject: [PATCH] powerpc: fix altivec_unavailable_exception Oopses altivec_unavailable_exception is called without setting r3... it looks like the r3 that actually gets passed in as struct pt_regs *regs is the undisturbed value of r3 at the time the altivec instruction was encountered. The user actually gets to choose the pt_regs printed in the Oops! This fixes the oops by passing the correct pt_regs pointer to altivec_unavailable_exception. Signed-off-by: Alan Curry Signed-off-by: Paul Mackerras --- arch/ppc/kernel/head.S | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/ppc') diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S index c5a890dca9c..53ea845fb91 100644 --- a/arch/ppc/kernel/head.S +++ b/arch/ppc/kernel/head.S @@ -751,6 +751,7 @@ AltiVecUnavailable: #ifdef CONFIG_ALTIVEC bne load_up_altivec /* if from user, just load it up */ #endif /* CONFIG_ALTIVEC */ + addi r3,r1,STACK_FRAME_OVERHEAD EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) #ifdef CONFIG_PPC64BRIDGE -- cgit v1.2.3 From 1bd79336a426c5e4f3bab142407059ceb12cadf9 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 8 Mar 2006 13:24:22 +1100 Subject: powerpc: Fix various syscall/signal/swapcontext bugs A careful reading of the recent changes to the system call entry/exit paths revealed several problems, plus some things that could be simplified and improved: * 32-bit wasn't testing the _TIF_NOERROR bit in the syscall fast exit path, so it was only doing anything with it once it saw some other bit being set. In other words, the noerror behaviour would apply to the next system call where we had to reschedule or deliver a signal, which is not necessarily the current system call. * 32-bit wasn't doing the call to ptrace_notify in the syscall exit path when the _TIF_SINGLESTEP bit was set. * _TIF_RESTOREALL was in both _TIF_USER_WORK_MASK and _TIF_PERSYSCALL_MASK, which is odd since _TIF_RESTOREALL is only set by system calls. I took it out of _TIF_USER_WORK_MASK. * On 64-bit, _TIF_RESTOREALL wasn't causing the non-volatile registers to be restored (unless perhaps a signal was delivered or the syscall was traced or single-stepped). Thus the non-volatile registers weren't restored on exit from a signal handler. We probably got away with it mostly because signal handlers written in C wouldn't alter the non-volatile registers. * On 32-bit I simplified the code and made it more like 64-bit by making the syscall exit path jump to ret_from_except to handle preemption and signal delivery. * 32-bit was calling do_signal unnecessarily when _TIF_RESTOREALL was set - but I think because of that 32-bit was actually restoring the non-volatile registers on exit from a signal handler. * I changed the order of enabling interrupts and saving the non-volatile registers before calling do_syscall_trace_leave; now we enable interrupts first. Signed-off-by: Paul Mackerras --- arch/ppc/kernel/asm-offsets.c | 1 - arch/ppc/kernel/entry.S | 95 +++++++++++-------------------------------- 2 files changed, 24 insertions(+), 72 deletions(-) (limited to 'arch/ppc') diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c index 7964bf660e9..77e4dc780f8 100644 --- a/arch/ppc/kernel/asm-offsets.c +++ b/arch/ppc/kernel/asm-offsets.c @@ -131,7 +131,6 @@ main(void) DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); - DEFINE(TI_SIGFRAME, offsetof(struct thread_info, nvgprs_frame)); DEFINE(TI_TASK, offsetof(struct thread_info, task)); DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index a48b950722a..3a281597848 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S @@ -227,7 +227,7 @@ ret_from_syscall: MTMSRD(r10) lwz r9,TI_FLAGS(r12) li r8,-_LAST_ERRNO - andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL) + andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) bne- syscall_exit_work cmplw 0,r3,r8 blt+ syscall_exit_cont @@ -287,8 +287,10 @@ syscall_dotrace: syscall_exit_work: andi. r0,r9,_TIF_RESTOREALL - bne- 2f - cmplw 0,r3,r8 + beq+ 0f + REST_NVGPRS(r1) + b 2f +0: cmplw 0,r3,r8 blt+ 1f andi. r0,r9,_TIF_NOERROR bne- 1f @@ -302,9 +304,7 @@ syscall_exit_work: 2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) beq 4f - /* Clear per-syscall TIF flags if any are set, but _leave_ - _TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that - yet. */ + /* Clear per-syscall TIF flags if any are set. */ li r11,_TIF_PERSYSCALL_MASK addi r12,r12,TI_FLAGS @@ -318,8 +318,13 @@ syscall_exit_work: subi r12,r12,TI_FLAGS 4: /* Anything which requires enabling interrupts? */ - andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS) - beq 7f + andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) + beq ret_from_except + + /* Re-enable interrupts */ + ori r10,r10,MSR_EE + SYNC + MTMSRD(r10) /* Save NVGPRS if they're not saved already */ lwz r4,TRAP(r1) @@ -328,71 +333,11 @@ syscall_exit_work: SAVE_NVGPRS(r1) li r4,0xc00 stw r4,TRAP(r1) - - /* Re-enable interrupts */ -5: ori r10,r10,MSR_EE - SYNC - MTMSRD(r10) - - andi. r0,r9,_TIF_SAVE_NVGPRS - bne save_user_nvgprs - -save_user_nvgprs_cont: - andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) - beq 7f - +5: addi r3,r1,STACK_FRAME_OVERHEAD bl do_syscall_trace_leave - REST_NVGPRS(r1) - -6: lwz r3,GPR3(r1) - LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ - SYNC - MTMSRD(r10) /* disable interrupts again */ - rlwinm r12,r1,0,0,18 /* current_thread_info() */ - lwz r9,TI_FLAGS(r12) -7: - andi. r0,r9,_TIF_NEED_RESCHED - bne 8f - lwz r5,_MSR(r1) - andi. r5,r5,MSR_PR - beq ret_from_except - andi. r0,r9,_TIF_SIGPENDING - beq ret_from_except - b do_user_signal -8: - ori r10,r10,MSR_EE - SYNC - MTMSRD(r10) /* re-enable interrupts */ - bl schedule - b 6b - -save_user_nvgprs: - lwz r8,TI_SIGFRAME(r12) - -.macro savewords start, end - 1: stw \start,4*(\start)(r8) - .section __ex_table,"a" - .align 2 - .long 1b,save_user_nvgprs_fault - .previous - .if \end - \start - savewords "(\start+1)",\end - .endif -.endm - savewords 14,31 - b save_user_nvgprs_cont - - -save_user_nvgprs_fault: - li r3,11 /* SIGSEGV */ - lwz r4,TI_TASK(r12) - bl force_sigsegv + b ret_from_except_full - rlwinm r12,r1,0,0,18 /* current_thread_info() */ - lwz r9,TI_FLAGS(r12) - b save_user_nvgprs_cont - #ifdef SHOW_SYSCALLS do_show_syscall: #ifdef SHOW_SYSCALLS_TASK @@ -490,6 +435,14 @@ ppc_clone: stw r0,TRAP(r1) /* register set saved */ b sys_clone + .globl ppc_swapcontext +ppc_swapcontext: + SAVE_NVGPRS(r1) + lwz r0,TRAP(r1) + rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */ + stw r0,TRAP(r1) /* register set saved */ + b sys_swapcontext + /* * Top-level page fault handling. * This is in assembler because if do_page_fault tells us that @@ -683,7 +636,7 @@ user_exc_return: /* r10 contains MSR_KERNEL here */ /* Check current_thread_info()->flags */ rlwinm r9,r1,0,0,18 lwz r9,TI_FLAGS(r9) - andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL) + andi. r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED) bne do_work restore_user: -- cgit v1.2.3 From d116fe5aeafd8226712d2de9c69428725ca74474 Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Mon, 6 Mar 2006 21:13:32 +0100 Subject: [PATCH] kzalloc() conversion in arch/ppc This converts arch/ppc to kzalloc usage. Crosscompile tested with allyesconfig. Signed-off-by: Eric Sesterhenn Signed-off-by: Paul Mackerras --- arch/ppc/4xx_io/serial_sicc.c | 3 +-- arch/ppc/kernel/smp-tbsync.c | 3 +-- arch/ppc/platforms/katana.c | 3 +-- arch/ppc/platforms/radstone_ppc7d.c | 3 +-- arch/ppc/syslib/ocp.c | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) (limited to 'arch/ppc') diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c index 4dc6aa2abfc..98b25fa0049 100644 --- a/arch/ppc/4xx_io/serial_sicc.c +++ b/arch/ppc/4xx_io/serial_sicc.c @@ -1637,9 +1637,8 @@ static struct SICC_info *siccuart_get(int line) state->count++; if (state->info) return state->info; - info = kmalloc(sizeof(struct SICC_info), GFP_KERNEL); + info = kzalloc(sizeof(struct SICC_info), GFP_KERNEL); if (info) { - memset(info, 0, sizeof(struct SICC_info)); init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->delta_msr_wait); diff --git a/arch/ppc/kernel/smp-tbsync.c b/arch/ppc/kernel/smp-tbsync.c index 2c9cd95bcea..6a5694fcc71 100644 --- a/arch/ppc/kernel/smp-tbsync.c +++ b/arch/ppc/kernel/smp-tbsync.c @@ -126,8 +126,7 @@ smp_generic_give_timebase( void ) printk("Synchronizing timebase\n"); /* if this fails then this kernel won't work anyway... */ - tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL ); - memset( tbsync, 0, sizeof(*tbsync) ); + tbsync = kzalloc( sizeof(*tbsync), GFP_KERNEL ); mb(); running = 1; diff --git a/arch/ppc/platforms/katana.c b/arch/ppc/platforms/katana.c index d2766617c3c..6f3bc616174 100644 --- a/arch/ppc/platforms/katana.c +++ b/arch/ppc/platforms/katana.c @@ -662,12 +662,11 @@ katana_setup_mtd(void) ptbl_entries = (size >= (64*MB)) ? 6 : 4; - if ((ptbl = kmalloc(ptbl_entries * sizeof(struct mtd_partition), + if ((ptbl = kcalloc(ptbl_entries, sizeof(struct mtd_partition), GFP_KERNEL)) == NULL) { printk(KERN_WARNING "Can't alloc MTD partition table\n"); return -ENOMEM; } - memset(ptbl, 0, ptbl_entries * sizeof(struct mtd_partition)); ptbl[0].name = "Monitor"; ptbl[0].size = KATANA_MTD_MONITOR_SIZE; diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c index 1b1e7c5ef15..30188085bd3 100644 --- a/arch/ppc/platforms/radstone_ppc7d.c +++ b/arch/ppc/platforms/radstone_ppc7d.c @@ -683,11 +683,10 @@ ppc7d_fixup_i2c_pdata(struct platform_device *pdev) pdata = pdev->dev.platform_data; if (pdata == NULL) { - pdata = kmalloc(sizeof(*pdata), GFP_KERNEL); + pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); if (pdata == NULL) return; - memset(pdata, 0, sizeof(*pdata)); pdev->dev.platform_data = pdata; } diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c index 2fe28ded2c6..a4ecc2ee579 100644 --- a/arch/ppc/syslib/ocp.c +++ b/arch/ppc/syslib/ocp.c @@ -451,10 +451,9 @@ ocp_driver_init(void) DBG(("ocp: ocp_driver_init()...\n")); /* Allocate/register primary OCP bus */ - ocp_bus = kmalloc(sizeof(struct device), GFP_KERNEL); + ocp_bus = kzalloc(sizeof(struct device), GFP_KERNEL); if (ocp_bus == NULL) return 1; - memset(ocp_bus, 0, sizeof(struct device)); strcpy(ocp_bus->bus_id, "ocp"); bus_register(&ocp_bus_type); -- cgit v1.2.3 From bbbe1212bd6f815290f782ba5b489467b54131dc Mon Sep 17 00:00:00 2001 From: Adrian Cox Date: Wed, 8 Mar 2006 22:10:20 +0000 Subject: [PATCH] ppc: Fix platform_notify functions marked __init While adding USB support to an MV64360 based board this week, I discovered that all MV64x60 boards in the kernel have platform_notify functions marked with __init. This causes an oops if a device is added after boot. The patch below removes the __init markers. I do not have all these boards to test on, but the change seems very unlikely to break anything else. Signed-off-by: Adrian Cox Signed-off-by: Paul Mackerras --- arch/ppc/platforms/cpci690.c | 2 +- arch/ppc/platforms/ev64260.c | 2 +- arch/ppc/platforms/ev64360.c | 2 +- arch/ppc/platforms/hdpu.c | 2 +- arch/ppc/platforms/katana.c | 2 +- arch/ppc/platforms/radstone_ppc7d.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'arch/ppc') diff --git a/arch/ppc/platforms/cpci690.c b/arch/ppc/platforms/cpci690.c index 55be550a081..790475c22fd 100644 --- a/arch/ppc/platforms/cpci690.c +++ b/arch/ppc/platforms/cpci690.c @@ -288,7 +288,7 @@ cpci690_fixup_mpsc_pdata(struct platform_device *pdev) pdata->brg_clk_freq = cpci690_get_bus_freq(); } -static int __init +static int cpci690_platform_notify(struct device *dev) { static struct { diff --git a/arch/ppc/platforms/ev64260.c b/arch/ppc/platforms/ev64260.c index 6444760caa3..31e8e21e1d5 100644 --- a/arch/ppc/platforms/ev64260.c +++ b/arch/ppc/platforms/ev64260.c @@ -414,7 +414,7 @@ ev64260_fixup_mpsc_pdata(struct platform_device *pdev) return; } -static int __init +static int ev64260_platform_notify(struct device *dev) { static struct { diff --git a/arch/ppc/platforms/ev64360.c b/arch/ppc/platforms/ev64360.c index b5f52eba4fc..104ac9b16e8 100644 --- a/arch/ppc/platforms/ev64360.c +++ b/arch/ppc/platforms/ev64360.c @@ -298,7 +298,7 @@ ev64360_fixup_eth_pdata(struct platform_device *pdev) } #endif -static int __init +static int ev64360_platform_notify(struct device *dev) { static struct { diff --git a/arch/ppc/platforms/hdpu.c b/arch/ppc/platforms/hdpu.c index 220674d883d..fc869bb5b2b 100644 --- a/arch/ppc/platforms/hdpu.c +++ b/arch/ppc/platforms/hdpu.c @@ -351,7 +351,7 @@ static void __init hdpu_fixup_cpustate_pdata(struct platform_device *pd) } #endif -static int __init hdpu_platform_notify(struct device *dev) +static int hdpu_platform_notify(struct device *dev) { static struct { char *bus_id; diff --git a/arch/ppc/platforms/katana.c b/arch/ppc/platforms/katana.c index 6f3bc616174..ad21280e892 100644 --- a/arch/ppc/platforms/katana.c +++ b/arch/ppc/platforms/katana.c @@ -596,7 +596,7 @@ katana_fixup_mv64xxx_pdata(struct platform_device *pdev) } #endif -static int __init +static int katana_platform_notify(struct device *dev) { static struct { diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c index 30188085bd3..bc26b6d71c1 100644 --- a/arch/ppc/platforms/radstone_ppc7d.c +++ b/arch/ppc/platforms/radstone_ppc7d.c @@ -709,7 +709,7 @@ ppc7d_fixup_i2c_pdata(struct platform_device *pdev) } #endif -static int __init ppc7d_platform_notify(struct device *dev) +static int ppc7d_platform_notify(struct device *dev) { static struct { char *bus_id; -- cgit v1.2.3 From 898b1920a67048c1f38bb99777f4cff06380a59a Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Thu, 9 Mar 2006 23:36:40 -0700 Subject: [PATCH] Fix compile error for ML300/403 Needed due to changes in ppc_sys.c. Signed-off-by: Grant Likely Signed-off-by: Paul Mackerras --- arch/ppc/platforms/4xx/virtex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/ppc') diff --git a/arch/ppc/platforms/4xx/virtex.h b/arch/ppc/platforms/4xx/virtex.h index 1a01b81cff1..c14325dfd7b 100644 --- a/arch/ppc/platforms/4xx/virtex.h +++ b/arch/ppc/platforms/4xx/virtex.h @@ -27,7 +27,7 @@ /* Device type enumeration for platform bus definitions */ #ifndef __ASSEMBLY__ enum ppc_sys_devices { - VIRTEX_UART, + VIRTEX_UART, NUM_PPC_SYS_DEVS, }; #endif -- cgit v1.2.3