From 126187f1e00048abec4d4a2eb3eeae396fbaa944 Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Wed, 23 May 2007 14:14:52 -0700 Subject: [PATCH 1/4] [AVR32] ratelimit segfault reporting rate Limit the rate of the kernel logging for the segfaults of user applications, to avoid potential message floods or denial-of-service attacks. Signed-off-by: Andrea Righi Signed-off-by: Andrew Morton Signed-off-by: Haavard Skinnemoen --- arch/avr32/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c index e011f1ce1875..4b2495285d94 100644 --- a/arch/avr32/mm/fault.c +++ b/arch/avr32/mm/fault.c @@ -158,7 +158,7 @@ bad_area: up_read(&mm->mmap_sem); if (user_mode(regs)) { - if (exception_trace) + if (exception_trace && printk_ratelimit()) printk("%s%s[%d]: segfault at %08lx pc %08lx " "sp %08lx ecr %lu\n", is_init(tsk) ? KERN_EMERG : KERN_INFO, From 2ae795b02aa46a99d845958ae8d7bc8afa04292b Mon Sep 17 00:00:00 2001 From: David Brownell Date: Thu, 24 May 2007 13:52:08 -0700 Subject: [PATCH 2/4] [AVR32] gpio_*_cansleep() fix The AVR32 was missing the gpio_*_cansleep() calls, breaking compilation for some code using them. Signed-off-by: David Brownell Signed-off-by: Haavard Skinnemoen --- include/asm-avr32/arch-at32ap/gpio.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/asm-avr32/arch-at32ap/gpio.h b/include/asm-avr32/arch-at32ap/gpio.h index 80a21aa9ae77..af7f9535bab3 100644 --- a/include/asm-avr32/arch-at32ap/gpio.h +++ b/include/asm-avr32/arch-at32ap/gpio.h @@ -14,6 +14,8 @@ int gpio_direction_output(unsigned int gpio, int value); int gpio_get_value(unsigned int gpio); void gpio_set_value(unsigned int gpio, int value); +#include /* cansleep wrappers */ + static inline int gpio_to_irq(unsigned int gpio) { return gpio + GPIO_IRQ_BASE; From 2fdfe8d9a2687718b07a35196b89fbf48ba0c82f Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Tue, 29 May 2007 21:33:37 +0200 Subject: [PATCH 3/4] [AVR32] STK1000: Set SPI_MODE_3 in the ltv350qv board info In the latest incarnation of the ltv350qv driver the call to spi_setup() has been removed. So we need to initialize things more carefully in the board info struct. Signed-off-by: Haavard Skinnemoen --- arch/avr32/boards/atstk1000/atstk1002.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index fe1dbe2e28f4..e253e86a1a39 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c @@ -42,6 +42,7 @@ static struct spi_board_info spi0_board_info[] __initdata = { .modalias = "ltv350qv", .max_speed_hz = 16000000, .chip_select = 1, + .mode = SPI_MODE_3, }, }; From 093d0faf57e59feee224217273f944e10e4e3562 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Mon, 11 Jun 2007 17:17:14 +0200 Subject: [PATCH 4/4] [AVR32] Define ARCH_KMALLOC_MINALIGN to L1_CACHE_BYTES This allows SLUB debugging to be used without fear of messing up DMA transfers. SPI is one example that easily breaks without this patch. Signed-off-by: Haavard Skinnemoen --- include/asm-avr32/cache.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/asm-avr32/cache.h b/include/asm-avr32/cache.h index dabb955f3c00..d3cf35ab11ab 100644 --- a/include/asm-avr32/cache.h +++ b/include/asm-avr32/cache.h @@ -4,6 +4,15 @@ #define L1_CACHE_SHIFT 5 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) +/* + * Memory returned by kmalloc() may be used for DMA, so we must make + * sure that all such allocations are cache aligned. Otherwise, + * unrelated code may cause parts of the buffer to be read into the + * cache before the transfer is done, causing old data to be seen by + * the CPU. + */ +#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES + #ifndef __ASSEMBLER__ struct cache_info { unsigned int ways;