From d2222c904821bab2d9c044b1ed868b93a332bd0b Mon Sep 17 00:00:00 2001 From: Pavel Kiryukhin Date: Tue, 27 Nov 2007 19:20:47 +0300 Subject: [PATCH] --- yaml --- r: 74421 b: refs/heads/master c: 54fd6441e04696c046d93e4407a9e1ee9b874e51 h: refs/heads/master i: 74419: bfcc087c97ea7c246f31337ba8dff427e67dee75 v: v3 --- [refs] | 2 +- trunk/MAINTAINERS | 2 +- trunk/arch/arm/common/uengine.c | 6 +- trunk/arch/arm/kernel/entry-armv.S | 96 ++++++++----------- trunk/arch/arm/kernel/traps.c | 5 +- trunk/arch/arm/mach-at91/at91rm9200_devices.c | 41 +------- .../arch/arm/mach-at91/at91sam9260_devices.c | 42 +------- .../arch/arm/mach-at91/at91sam9261_devices.c | 42 +------- .../arch/arm/mach-at91/at91sam9263_devices.c | 42 +------- trunk/arch/arm/mach-at91/at91sam9rl_devices.c | 43 +-------- trunk/arch/arm/mach-at91/board-carmeva.c | 2 +- trunk/arch/arm/mach-at91/board-csb337.c | 11 ++- trunk/arch/arm/mach-at91/board-csb637.c | 2 +- trunk/arch/arm/mach-at91/board-dk.c | 15 +-- trunk/arch/arm/mach-at91/board-eb9200.c | 10 +- trunk/arch/arm/mach-at91/board-ek.c | 2 +- trunk/arch/arm/mach-at91/board-kafa.c | 2 +- trunk/arch/arm/mach-at91/board-kb9202.c | 2 +- trunk/arch/arm/mach-at91/board-picotux200.c | 2 +- trunk/arch/arm/mach-at91/board-sam9260ek.c | 2 +- trunk/arch/arm/mach-at91/board-sam9261ek.c | 18 ++-- trunk/arch/arm/mach-at91/board-sam9263ek.c | 2 +- trunk/arch/arm/mach-at91/board-sam9rlek.c | 2 +- trunk/arch/arm/mach-at91/clock.c | 9 +- trunk/arch/arm/mach-imx/irq.c | 51 ++-------- trunk/arch/arm/mach-pxa/pxa27x.c | 2 +- trunk/arch/arm/mach-pxa/pxa320.c | 7 +- trunk/arch/arm/mach-pxa/ssp.c | 1 - trunk/drivers/serial/pxa.c | 4 +- trunk/include/asm-arm/arch-at91/board.h | 3 +- trunk/include/asm-arm/arch-ixp23xx/irqs.h | 2 +- .../asm-arm/arch-omap/board-innovator.h | 2 +- trunk/include/asm-arm/arch-pxa/irqs.h | 20 +--- trunk/include/asm-arm/arch-pxa/mfp-pxa300.h | 2 +- trunk/include/asm-arm/arch-pxa/mfp-pxa320.h | 2 +- trunk/include/asm-arm/arch-pxa/mfp.h | 18 +--- trunk/include/asm-arm/arch-pxa/pxa-regs.h | 5 +- trunk/include/asm-mips/cpu-features.h | 6 +- trunk/mm/slab.c | 4 +- 39 files changed, 122 insertions(+), 409 deletions(-) diff --git a/[refs] b/[refs] index b3854193564d..7283b225233f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b62c855938be50c13f3f2aa81fafe4a9ca2b6650 +refs/heads/master: 54fd6441e04696c046d93e4407a9e1ee9b874e51 diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 7c8392e1797d..ac425b5b4a40 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -439,7 +439,7 @@ S: Maintained ARM/ATMEL AT91RM9200 ARM ARCHITECTURE P: Andrew Victor -M: linux@maxim.org.za +M: andrew@sanpeople.com L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) W: http://maxim.org.za/at91_26.html S: Maintained diff --git a/trunk/arch/arm/common/uengine.c b/trunk/arch/arm/common/uengine.c index 117cab30bd36..95c8508c29b7 100644 --- a/trunk/arch/arm/common/uengine.c +++ b/trunk/arch/arm/common/uengine.c @@ -374,8 +374,8 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c) u8 *ucode; int i; - gpr_a = kzalloc(128 * sizeof(u32), GFP_KERNEL); - gpr_b = kzalloc(128 * sizeof(u32), GFP_KERNEL); + gpr_a = kmalloc(128 * sizeof(u32), GFP_KERNEL); + gpr_b = kmalloc(128 * sizeof(u32), GFP_KERNEL); ucode = kmalloc(513 * 5, GFP_KERNEL); if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) { kfree(ucode); @@ -388,6 +388,8 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c) if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS) per_ctx_regs = 32; + memset(gpr_a, 0, sizeof(gpr_a)); + memset(gpr_b, 0, sizeof(gpr_b)); for (i = 0; i < 256; i++) { struct ixp2000_reg_value *r = c->initial_reg_values + i; u32 *bank; diff --git a/trunk/arch/arm/kernel/entry-armv.S b/trunk/arch/arm/kernel/entry-armv.S index 29dec080a604..d645897652c2 100644 --- a/trunk/arch/arm/kernel/entry-armv.S +++ b/trunk/arch/arm/kernel/entry-armv.S @@ -339,6 +339,16 @@ __pabt_svc: str r1, [sp] @ save the "real" r0 copied @ from the exception stack +#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) +#ifndef CONFIG_MMU +#warning "NPTL on non MMU needs fixing" +#else + @ make sure our user space atomic helper is aborted + cmp r2, #TASK_SIZE + bichs r3, r3, #PSR_Z_BIT +#endif +#endif + @ @ We are now ready to fill in the remaining blanks on the stack: @ @@ -362,25 +372,9 @@ __pabt_svc: zero_fp .endm - .macro kuser_cmpxchg_check -#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) -#ifndef CONFIG_MMU -#warning "NPTL on non MMU needs fixing" -#else - @ Make sure our user space atomic helper is restarted - @ if it was interrupted in a critical region. Here we - @ perform a quick test inline since it should be false - @ 99.9999% of the time. The rest is done out of line. - cmp r2, #TASK_SIZE - blhs kuser_cmpxchg_fixup -#endif -#endif - .endm - .align 5 __dabt_usr: usr_entry - kuser_cmpxchg_check @ @ Call the processor-specific abort handler: @@ -410,7 +404,6 @@ __dabt_usr: .align 5 __irq_usr: usr_entry - kuser_cmpxchg_check #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_off @@ -453,9 +446,9 @@ __und_usr: @ @ r0 - instruction @ +1: ldrt r0, [r4] adr r9, ret_from_exception adr lr, __und_usr_unknown -1: ldrt r0, [r4] @ @ fallthrough to call_fpe @ @@ -676,7 +669,7 @@ __kuser_helper_start: * * Clobbered: * - * none + * the Z flag might be lost * * Definition and user space usage example: * @@ -737,6 +730,9 @@ __kuser_memory_barrier: @ 0xffff0fa0 * * - This routine already includes memory barriers as needed. * + * - A failure might be transient, i.e. it is possible, although unlikely, + * that "failure" be returned even if *ptr == oldval. + * * For example, a user space atomic_add implementation could look like this: * * #define atomic_add(ptr, val) \ @@ -773,62 +769,46 @@ __kuser_cmpxchg: @ 0xffff0fc0 #elif __LINUX_ARM_ARCH__ < 6 -#ifdef CONFIG_MMU - /* - * The only thing that can break atomicity in this cmpxchg - * implementation is either an IRQ or a data abort exception - * causing another process/thread to be scheduled in the middle - * of the critical sequence. To prevent this, code is added to - * the IRQ and data abort exception handlers to set the pc back - * to the beginning of the critical section if it is found to be - * within that critical section (see kuser_cmpxchg_fixup). + * Theory of operation: + * + * We set the Z flag before loading oldval. If ever an exception + * occurs we can not be sure the loaded value will still be the same + * when the exception returns, therefore the user exception handler + * will clear the Z flag whenever the interrupted user code was + * actually from the kernel address space (see the usr_entry macro). + * + * The post-increment on the str is used to prevent a race with an + * exception happening just after the str instruction which would + * clear the Z flag although the exchange was done. */ -1: ldr r3, [r2] @ load current val - subs r3, r3, r0 @ compare with oldval -2: streq r1, [r2] @ store newval if eq - rsbs r0, r3, #0 @ set return val and C flag - usr_ret lr - - .text -kuser_cmpxchg_fixup: - @ Called from kuser_cmpxchg_check macro. - @ r2 = address of interrupted insn (must be preserved). - @ sp = saved regs. r7 and r8 are clobbered. - @ 1b = first critical insn, 2b = last critical insn. - @ If r2 >= 1b and r2 <= 2b then saved pc_usr is set to 1b. - mov r7, #0xffff0fff - sub r7, r7, #(0xffff0fff - (0xffff0fc0 + (1b - __kuser_cmpxchg))) - subs r8, r2, r7 - rsbcss r8, r8, #(2b - 1b) - strcs r7, [sp, #S_PC] - mov pc, lr - .previous - +#ifdef CONFIG_MMU + teq ip, ip @ set Z flag + ldr ip, [r2] @ load current val + add r3, r2, #1 @ prepare store ptr + teqeq ip, r0 @ compare with oldval if still allowed + streq r1, [r3, #-1]! @ store newval if still allowed + subs r0, r2, r3 @ if r2 == r3 the str occured #else #warning "NPTL on non MMU needs fixing" mov r0, #-1 adds r0, r0, #0 - usr_ret lr #endif + usr_ret lr #else #ifdef CONFIG_SMP mcr p15, 0, r0, c7, c10, 5 @ dmb #endif -1: ldrex r3, [r2] + ldrex r3, [r2] subs r3, r3, r0 strexeq r3, r1, [r2] - teqeq r3, #1 - beq 1b rsbs r0, r3, #0 - /* beware -- each __kuser slot must be 8 instructions max */ #ifdef CONFIG_SMP - b __kuser_memory_barrier -#else - usr_ret lr + mcr p15, 0, r0, c7, c10, 5 @ dmb #endif + usr_ret lr #endif @@ -849,7 +829,7 @@ kuser_cmpxchg_fixup: * * Clobbered: * - * none + * the Z flag might be lost * * Definition and user space usage example: * diff --git a/trunk/arch/arm/kernel/traps.c b/trunk/arch/arm/kernel/traps.c index c34db4e868fa..4764bd9ccee8 100644 --- a/trunk/arch/arm/kernel/traps.c +++ b/trunk/arch/arm/kernel/traps.c @@ -327,7 +327,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) if ((instr & hook->instr_mask) == hook->instr_val && (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) { if (hook->fn(regs, instr) == 0) { - spin_unlock_irqrestore(&undef_lock, flags); + spin_unlock_irq(&undef_lock); return; } } @@ -509,7 +509,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) * existence. Don't ever use this from user code. */ case 0xfff0: - for (;;) { + { extern void do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs); unsigned long val; @@ -545,6 +545,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) up_read(&mm->mmap_sem); /* simulate a write access fault */ do_DataAbort(addr, 15 + (1 << 11), regs); + return -1; } #endif diff --git a/trunk/arch/arm/mach-at91/at91rm9200_devices.c b/trunk/arch/arm/mach-at91/at91rm9200_devices.c index 9296833f91cc..0417c165d50d 100644 --- a/trunk/arch/arm/mach-at91/at91rm9200_devices.c +++ b/trunk/arch/arm/mach-at91/at91rm9200_devices.c @@ -14,7 +14,6 @@ #include #include -#include #include #include @@ -436,40 +435,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {} * TWI (i2c) * -------------------------------------------------------------------- */ -/* - * Prefer the GPIO code since the TWI controller isn't robust - * (gets overruns and underruns under load) and can only issue - * repeated STARTs in one scenario (the driver doesn't yet handle them). - */ -#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) - -static struct i2c_gpio_platform_data pdata = { - .sda_pin = AT91_PIN_PA25, - .sda_is_open_drain = 1, - .scl_pin = AT91_PIN_PA26, - .scl_is_open_drain = 1, - .udelay = 2, /* ~100 kHz */ -}; - -static struct platform_device at91rm9200_twi_device = { - .name = "i2c-gpio", - .id = -1, - .dev.platform_data = &pdata, -}; - -void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) -{ - at91_set_GPIO_periph(AT91_PIN_PA25, 1); /* TWD (SDA) */ - at91_set_multi_drive(AT91_PIN_PA25, 1); - - at91_set_GPIO_periph(AT91_PIN_PA26, 1); /* TWCK (SCL) */ - at91_set_multi_drive(AT91_PIN_PA26, 1); - - i2c_register_board_info(0, devices, nr_devices); - platform_device_register(&at91rm9200_twi_device); -} - -#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) +#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) static struct resource twi_resources[] = { [0] = { @@ -491,7 +457,7 @@ static struct platform_device at91rm9200_twi_device = { .num_resources = ARRAY_SIZE(twi_resources), }; -void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) +void __init at91_add_device_i2c(void) { /* pins used for TWI interface */ at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */ @@ -500,11 +466,10 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */ at91_set_multi_drive(AT91_PIN_PA26, 1); - i2c_register_board_info(0, devices, nr_devices); platform_device_register(&at91rm9200_twi_device); } #else -void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {} +void __init at91_add_device_i2c(void) {} #endif diff --git a/trunk/arch/arm/mach-at91/at91sam9260_devices.c b/trunk/arch/arm/mach-at91/at91sam9260_devices.c index 3091bf47d8c9..ffd3154c1e54 100644 --- a/trunk/arch/arm/mach-at91/at91sam9260_devices.c +++ b/trunk/arch/arm/mach-at91/at91sam9260_devices.c @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -353,41 +352,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {} * TWI (i2c) * -------------------------------------------------------------------- */ -/* - * Prefer the GPIO code since the TWI controller isn't robust - * (gets overruns and underruns under load) and can only issue - * repeated STARTs in one scenario (the driver doesn't yet handle them). - */ - -#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) - -static struct i2c_gpio_platform_data pdata = { - .sda_pin = AT91_PIN_PA23, - .sda_is_open_drain = 1, - .scl_pin = AT91_PIN_PA24, - .scl_is_open_drain = 1, - .udelay = 2, /* ~100 kHz */ -}; - -static struct platform_device at91sam9260_twi_device = { - .name = "i2c-gpio", - .id = -1, - .dev.platform_data = &pdata, -}; - -void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) -{ - at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */ - at91_set_multi_drive(AT91_PIN_PA23, 1); - - at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */ - at91_set_multi_drive(AT91_PIN_PA24, 1); - - i2c_register_board_info(0, devices, nr_devices); - platform_device_register(&at91sam9260_twi_device); -} - -#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) +#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) static struct resource twi_resources[] = { [0] = { @@ -409,7 +374,7 @@ static struct platform_device at91sam9260_twi_device = { .num_resources = ARRAY_SIZE(twi_resources), }; -void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) +void __init at91_add_device_i2c(void) { /* pins used for TWI interface */ at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ @@ -418,11 +383,10 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ at91_set_multi_drive(AT91_PIN_PA24, 1); - i2c_register_board_info(0, devices, nr_devices); platform_device_register(&at91sam9260_twi_device); } #else -void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {} +void __init at91_add_device_i2c(void) {} #endif diff --git a/trunk/arch/arm/mach-at91/at91sam9261_devices.c b/trunk/arch/arm/mach-at91/at91sam9261_devices.c index 64979a9023c2..3576595b4941 100644 --- a/trunk/arch/arm/mach-at91/at91sam9261_devices.c +++ b/trunk/arch/arm/mach-at91/at91sam9261_devices.c @@ -14,9 +14,7 @@ #include #include -#include -#include #include