Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm

* 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm:
ARM: drop experimental status for ARM_PATCH_PHYS_VIRT
ARM: 7008/1: alignment: Make SIGBUS sent to userspace POSIXly correct
ARM: 7007/1: alignment: Prevent ignoring of faults with ARMv6 unaligned access model
ARM: 7010/1: mm: fix invalid loop for poison_init_mem
ARM: 7005/1: freshen up mm/proc-arm946.S
dmaengine: PL08x: Fix trivial build error
ARM: Fix build error for SMP=n builds

+50 -19
+1 -2
arch/arm/Kconfig
··· 195 195 The base address of exception vectors. 196 196 197 197 config ARM_PATCH_PHYS_VIRT 198 - bool "Patch physical to virtual translations at runtime (EXPERIMENTAL)" 199 - depends on EXPERIMENTAL 198 + bool "Patch physical to virtual translations at runtime" 200 199 depends on !XIP_KERNEL && MMU 201 200 depends on !ARCH_REALVIEW || !SPARSEMEM 202 201 help
+4
arch/arm/kernel/module.c
··· 323 323 #endif 324 324 s = find_mod_section(hdr, sechdrs, ".alt.smp.init"); 325 325 if (s && !is_smp()) 326 + #ifdef CONFIG_SMP_ON_UP 326 327 fixup_smp((void *)s->sh_addr, s->sh_size); 328 + #else 329 + return -EINVAL; 330 + #endif 327 331 return 0; 328 332 } 329 333
+41 -15
arch/arm/mm/alignment.c
··· 22 22 #include <linux/sched.h> 23 23 #include <linux/uaccess.h> 24 24 25 + #include <asm/system.h> 25 26 #include <asm/unaligned.h> 26 27 27 28 #include "fault.h" ··· 96 95 "signal+warn" 97 96 }; 98 97 98 + /* Return true if and only if the ARMv6 unaligned access model is in use. */ 99 + static bool cpu_is_v6_unaligned(void) 100 + { 101 + return cpu_architecture() >= CPU_ARCH_ARMv6 && (cr_alignment & CR_U); 102 + } 103 + 104 + static int safe_usermode(int new_usermode, bool warn) 105 + { 106 + /* 107 + * ARMv6 and later CPUs can perform unaligned accesses for 108 + * most single load and store instructions up to word size. 109 + * LDM, STM, LDRD and STRD still need to be handled. 110 + * 111 + * Ignoring the alignment fault is not an option on these 112 + * CPUs since we spin re-faulting the instruction without 113 + * making any progress. 114 + */ 115 + if (cpu_is_v6_unaligned() && !(new_usermode & (UM_FIXUP | UM_SIGNAL))) { 116 + new_usermode |= UM_FIXUP; 117 + 118 + if (warn) 119 + printk(KERN_WARNING "alignment: ignoring faults is unsafe on this CPU. Defaulting to fixup mode.\n"); 120 + } 121 + 122 + return new_usermode; 123 + } 124 + 99 125 static int alignment_proc_show(struct seq_file *m, void *v) 100 126 { 101 127 seq_printf(m, "User:\t\t%lu\n", ai_user); ··· 153 125 if (get_user(mode, buffer)) 154 126 return -EFAULT; 155 127 if (mode >= '0' && mode <= '5') 156 - ai_usermode = mode - '0'; 128 + ai_usermode = safe_usermode(mode - '0', true); 157 129 } 158 130 return count; 159 131 } ··· 914 886 if (ai_usermode & UM_FIXUP) 915 887 goto fixup; 916 888 917 - if (ai_usermode & UM_SIGNAL) 918 - force_sig(SIGBUS, current); 919 - else { 889 + if (ai_usermode & UM_SIGNAL) { 890 + siginfo_t si; 891 + 892 + si.si_signo = SIGBUS; 893 + si.si_errno = 0; 894 + si.si_code = BUS_ADRALN; 895 + si.si_addr = (void __user *)addr; 896 + 897 + force_sig_info(si.si_signo, &si, current); 898 + } else { 920 899 /* 921 900 * We're about to disable the alignment trap and return to 922 901 * user space. But if an interrupt occurs before actually ··· 961 926 return -ENOMEM; 962 927 #endif 963 928 964 - /* 965 - * ARMv6 and later CPUs can perform unaligned accesses for 966 - * most single load and store instructions up to word size. 967 - * LDM, STM, LDRD and STRD still need to be handled. 968 - * 969 - * Ignoring the alignment fault is not an option on these 970 - * CPUs since we spin re-faulting the instruction without 971 - * making any progress. 972 - */ 973 - if (cpu_architecture() >= CPU_ARCH_ARMv6 && (cr_alignment & CR_U)) { 929 + if (cpu_is_v6_unaligned()) { 974 930 cr_alignment &= ~CR_A; 975 931 cr_no_alignment &= ~CR_A; 976 932 set_cr(cr_alignment); 977 - ai_usermode = UM_FIXUP; 933 + ai_usermode = safe_usermode(ai_usermode, false); 978 934 } 979 935 980 936 hook_fault_code(1, do_alignment, SIGBUS, BUS_ADRALN,
+1 -1
arch/arm/mm/init.c
··· 441 441 static inline void poison_init_mem(void *s, size_t count) 442 442 { 443 443 u32 *p = (u32 *)s; 444 - while ((count = count - 4)) 444 + for (; count != 0; count -= 4) 445 445 *p++ = 0xe7fddef0; 446 446 } 447 447
+2 -1
arch/arm/mm/proc-arm946.S
··· 410 410 .long 0x41009460 411 411 .long 0xff00fff0 412 412 .long 0 413 + .long 0 413 414 b __arm946_setup 414 415 .long cpu_arch_name 415 416 .long cpu_elf_name ··· 419 418 .long arm946_processor_functions 420 419 .long 0 421 420 .long 0 422 - .long arm940_cache_fns 421 + .long arm946_cache_fns 423 422 .size __arm946_proc_info, . - __arm946_proc_info 424 423
+1
drivers/dma/amba-pl08x.c
··· 80 80 #include <linux/interrupt.h> 81 81 #include <linux/slab.h> 82 82 #include <linux/delay.h> 83 + #include <linux/dma-mapping.h> 83 84 #include <linux/dmapool.h> 84 85 #include <linux/dmaengine.h> 85 86 #include <linux/amba/bus.h>