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

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rkuo/linux-hexagon-kernel

Pull Hexagon fixes from Richard Kuo:
"Changes for the Hexagon architecture (and one touching OpenRISC).

They include various fixes to make use of additional arch features and
cleanups. The largest functional change is a cleanup of the signal
and event return paths"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rkuo/linux-hexagon-kernel: (32 commits)
Hexagon: add v4 CS regs to core copyout macro
Hexagon: use correct translation for VMALLOC_START
Hexagon: use correct translations for DMA mappings
Hexagon: fix return value for notify_resume case in do_work_pending
Hexagon: fix signal number for user mem faults
Hexagon: remove two Kconfig entries
arch: remove CONFIG_GENERIC_FIND_NEXT_BIT again
Hexagon: update copyright dates
Hexagon: add translation types for __vmnewmap
Hexagon: fix signal.c compile error
Hexagon: break up user fn/arg register setting
Hexagon: use generic sys_fork, sys_vfork, and sys_clone
Hexagon: fix psp/sp macro
Hexagon: fix up int enable/disable at ret_from_fork
Hexagon: add IOMEM and _relaxed IO macros
Hexagon: switch to using the device type for IO mappings
Hexagon: don't print info for offline CPU's
Hexagon: add support for single-stepping (v4+)
Hexagon: use correct work mask when checking for more work
Hexagon: add support for additional exceptions
...

+660 -347
+10 -23
arch/hexagon/Kconfig
··· 29 29 select GENERIC_CLOCKEVENTS 30 30 select GENERIC_CLOCKEVENTS_BROADCAST 31 31 select MODULES_USE_ELF_RELA 32 + select GENERIC_CPU_DEVICES 33 + select GENERIC_KERNEL_THREAD 34 + select GENERIC_KERNEL_EXECVE 32 35 ---help--- 33 36 Qualcomm Hexagon is a processor architecture designed for high 34 37 performance and low power across a wide variety of applications. 35 38 36 - config HEXAGON_ARCH_V1 37 - bool 38 - 39 - config HEXAGON_ARCH_V2 40 - bool 41 - 42 - config HEXAGON_ARCH_V3 43 - bool 44 - 45 - config HEXAGON_ARCH_V4 46 - bool 39 + config HEXAGON_PHYS_OFFSET 40 + def_bool y 41 + ---help--- 42 + Platforms that don't load the kernel at zero set this. 47 43 48 44 config FRAME_POINTER 49 45 def_bool y ··· 77 81 config RWSEM_XCHGADD_ALGORITHM 78 82 def_bool y 79 83 80 - config GENERIC_FIND_NEXT_BIT 81 - def_bool y 82 - 83 84 config GENERIC_HWEIGHT 84 85 def_bool y 85 86 ··· 96 103 97 104 config HEXAGON_COMET 98 105 bool "Comet Board" 99 - select HEXAGON_ARCH_V2 100 106 ---help--- 101 107 Support for the Comet platform. 102 108 103 109 endchoice 104 110 105 - config HEXAGON_VM 106 - def_bool y 111 + config HEXAGON_ARCH_VERSION 112 + int "Architecture version" 113 + default 2 107 114 108 115 config CMDLINE 109 116 string "Default kernel command string" ··· 114 121 command-line options at build time by entering them here. At a 115 122 minimum, you should specify the memory size and the root device 116 123 (e.g., mem=64M root=/dev/nfs). 117 - 118 - config HEXAGON_ANGEL_TRAPS 119 - bool "Use Angel Traps" 120 - default n 121 - ---help--- 122 - Enable angel debug traps (for printk's). 123 124 124 125 config SMP 125 126 bool "Multi-Processing support"
+3 -14
arch/hexagon/Makefile
··· 15 15 # LDFLAGS_MODULE += -shared 16 16 CFLAGS_MODULE += -mlong-calls 17 17 18 - cflags-$(CONFIG_HEXAGON_ARCH_V1) += $(call cc-option,-mv1) 19 - cflags-$(CONFIG_HEXAGON_ARCH_V2) += $(call cc-option,-mv2) 20 - cflags-$(CONFIG_HEXAGON_ARCH_V3) += $(call cc-option,-mv3) 21 - cflags-$(CONFIG_HEXAGON_ARCH_V4) += $(call cc-option,-mv4) 22 - 23 - aflags-$(CONFIG_HEXAGON_ARCH_V1) += $(call cc-option,-mv1) 24 - aflags-$(CONFIG_HEXAGON_ARCH_V2) += $(call cc-option,-mv2) 25 - aflags-$(CONFIG_HEXAGON_ARCH_V3) += $(call cc-option,-mv3) 26 - aflags-$(CONFIG_HEXAGON_ARCH_V4) += $(call cc-option,-mv4) 27 - 28 - ldflags-$(CONFIG_HEXAGON_ARCH_V1) += $(call cc-option,-mv1) 29 - ldflags-$(CONFIG_HEXAGON_ARCH_V2) += $(call cc-option,-mv2) 30 - ldflags-$(CONFIG_HEXAGON_ARCH_V3) += $(call cc-option,-mv3) 31 - ldflags-$(CONFIG_HEXAGON_ARCH_V4) += $(call cc-option,-mv4) 18 + cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) 19 + aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) 20 + ldflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) 32 21 33 22 KBUILD_CFLAGS += $(cflags-y) 34 23 KBUILD_AFLAGS += $(aflags-y)
+1 -1
arch/hexagon/include/asm/Kbuild
··· 25 25 generic-y += kmap_types.h 26 26 generic-y += local64.h 27 27 generic-y += local.h 28 - generic-y += local.h 29 28 generic-y += mman.h 30 29 generic-y += msgbuf.h 31 30 generic-y += pci.h ··· 40 41 generic-y += shmbuf.h 41 42 generic-y += shmparam.h 42 43 generic-y += siginfo.h 44 + generic-y += sizes.h 43 45 generic-y += socket.h 44 46 generic-y += sockios.h 45 47 generic-y += statfs.h
+12 -10
arch/hexagon/include/asm/atomic.h
··· 1 1 /* 2 2 * Atomic operations for the Hexagon architecture 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify ··· 117 117 #define atomic_sub(i, v) atomic_sub_return(i, (v)) 118 118 119 119 /** 120 - * atomic_add_unless - add unless the number is a given value 120 + * __atomic_add_unless - add unless the number is a given value 121 121 * @v: pointer to value 122 122 * @a: amount to add 123 123 * @u: unless value is equal to u 124 124 * 125 - * Returns 1 if the add happened, 0 if it didn't. 125 + * Returns old value. 126 + * 126 127 */ 128 + 127 129 static inline int __atomic_add_unless(atomic_t *v, int a, int u) 128 130 { 129 - int output, __oldval; 131 + int __oldval; 132 + register int tmp; 133 + 130 134 asm volatile( 131 135 "1: %0 = memw_locked(%2);" 132 136 " {" 133 137 " p3 = cmp.eq(%0, %4);" 134 138 " if (p3.new) jump:nt 2f;" 135 - " %0 = add(%0, %3);" 136 - " %1 = #0;" 139 + " %1 = add(%0, %3);" 137 140 " }" 138 - " memw_locked(%2, p3) = %0;" 141 + " memw_locked(%2, p3) = %1;" 139 142 " {" 140 143 " if !p3 jump 1b;" 141 - " %1 = #1;" 142 144 " }" 143 145 "2:" 144 - : "=&r" (__oldval), "=&r" (output) 146 + : "=&r" (__oldval), "=&r" (tmp) 145 147 : "r" (v), "r" (a), "r" (u) 146 148 : "memory", "p3" 147 149 ); 148 - return output; 150 + return __oldval; 149 151 } 150 152 151 153 #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
+16 -7
arch/hexagon/include/asm/elf.h
··· 1 1 /* 2 2 * ELF definitions for the Hexagon architecture 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 104 104 * Bypass the whole "regsets" thing for now and use the define. 105 105 */ 106 106 107 + #if CONFIG_HEXAGON_ARCH_VERSION >= 4 108 + #define CS_COPYREGS(DEST,REGS) \ 109 + do {\ 110 + DEST.cs0 = REGS->cs0;\ 111 + DEST.cs1 = REGS->cs1;\ 112 + } while (0) 113 + #else 114 + #define CS_COPYREGS(DEST,REGS) 115 + #endif 116 + 107 117 #define ELF_CORE_COPY_REGS(DEST, REGS) \ 108 118 do { \ 109 119 DEST.r0 = REGS->r00; \ ··· 158 148 DEST.p3_0 = REGS->preds; \ 159 149 DEST.gp = REGS->gp; \ 160 150 DEST.ugp = REGS->ugp; \ 161 - DEST.pc = pt_elr(REGS); \ 151 + CS_COPYREGS(DEST,REGS); \ 152 + DEST.pc = pt_elr(REGS); \ 162 153 DEST.cause = pt_cause(REGS); \ 163 154 DEST.badva = pt_badva(REGS); \ 164 155 } while (0); 165 - 166 - 167 156 168 157 /* 169 158 * This is used to ensure we don't load something for the wrong architecture. ··· 177 168 #define ELF_DATA ELFDATA2LSB 178 169 #define ELF_ARCH EM_HEXAGON 179 170 180 - #ifdef CONFIG_HEXAGON_ARCH_V2 171 + #if CONFIG_HEXAGON_ARCH_VERSION == 2 181 172 #define ELF_CORE_EFLAGS 0x1 182 173 #endif 183 174 184 - #ifdef CONFIG_HEXAGON_ARCH_V3 175 + #if CONFIG_HEXAGON_ARCH_VERSION == 3 185 176 #define ELF_CORE_EFLAGS 0x2 186 177 #endif 187 178 188 - #ifdef CONFIG_HEXAGON_ARCH_V4 179 + #if CONFIG_HEXAGON_ARCH_VERSION == 4 189 180 #define ELF_CORE_EFLAGS 0x3 190 181 #endif 191 182
+32 -24
arch/hexagon/include/asm/hexagon_vm.h
··· 1 1 /* 2 2 * Declarations for to Hexagon Virtal Machine. 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 31 31 * for tracing/debugging. 32 32 */ 33 33 34 - /* 35 - * Lets make this stuff visible only if configured, 36 - * so we can unconditionally include the file. 37 - */ 34 + #define HVM_TRAP1_VMVERSION 0 35 + #define HVM_TRAP1_VMRTE 1 36 + #define HVM_TRAP1_VMSETVEC 2 37 + #define HVM_TRAP1_VMSETIE 3 38 + #define HVM_TRAP1_VMGETIE 4 39 + #define HVM_TRAP1_VMINTOP 5 40 + #define HVM_TRAP1_VMCLRMAP 10 41 + #define HVM_TRAP1_VMNEWMAP 11 42 + #define HVM_TRAP1_FORMERLY_VMWIRE 12 43 + #define HVM_TRAP1_VMCACHE 13 44 + #define HVM_TRAP1_VMGETTIME 14 45 + #define HVM_TRAP1_VMSETTIME 15 46 + #define HVM_TRAP1_VMWAIT 16 47 + #define HVM_TRAP1_VMYIELD 17 48 + #define HVM_TRAP1_VMSTART 18 49 + #define HVM_TRAP1_VMSTOP 19 50 + #define HVM_TRAP1_VMVPID 20 51 + #define HVM_TRAP1_VMSETREGS 21 52 + #define HVM_TRAP1_VMGETREGS 22 53 + #define HVM_TRAP1_VMTIMEROP 24 38 54 39 55 #ifndef __ASSEMBLY__ 40 56 ··· 191 175 192 176 #else /* Only assembly code should reference these */ 193 177 194 - #define HVM_TRAP1_VMRTE 1 195 - #define HVM_TRAP1_VMSETVEC 2 196 - #define HVM_TRAP1_VMSETIE 3 197 - #define HVM_TRAP1_VMGETIE 4 198 - #define HVM_TRAP1_VMINTOP 5 199 - #define HVM_TRAP1_VMCLRMAP 10 200 - #define HVM_TRAP1_VMNEWMAP 11 201 - #define HVM_TRAP1_FORMERLY_VMWIRE 12 202 - #define HVM_TRAP1_VMCACHE 13 203 - #define HVM_TRAP1_VMGETTIME 14 204 - #define HVM_TRAP1_VMSETTIME 15 205 - #define HVM_TRAP1_VMWAIT 16 206 - #define HVM_TRAP1_VMYIELD 17 207 - #define HVM_TRAP1_VMSTART 18 208 - #define HVM_TRAP1_VMSTOP 19 209 - #define HVM_TRAP1_VMVPID 20 210 - #define HVM_TRAP1_VMSETREGS 21 211 - #define HVM_TRAP1_VMGETREGS 22 212 - 213 178 #endif /* __ASSEMBLY__ */ 214 179 215 180 /* 216 181 * Constants for virtual instruction parameters and return values 217 182 */ 183 + 184 + /* vmnewmap arguments */ 185 + 186 + #define VM_TRANS_TYPE_LINEAR 0 187 + #define VM_TRANS_TYPE_TABLE 1 188 + #define VM_TLB_INVALIDATE_FALSE 0 189 + #define VM_TLB_INVALIDATE_TRUE 1 218 190 219 191 /* vmsetie arguments */ 220 192 ··· 228 224 #define HVM_VMEST_UM_MSK 1 229 225 #define HVM_VMEST_IE_SFT 30 230 226 #define HVM_VMEST_IE_MSK 1 227 + #define HVM_VMEST_SS_SFT 29 228 + #define HVM_VMEST_SS_MSK 1 231 229 #define HVM_VMEST_EVENTNUM_SFT 16 232 230 #define HVM_VMEST_EVENTNUM_MSK 0xff 233 231 #define HVM_VMEST_CAUSE_SFT 0 ··· 266 260 #define HVM_GE_C_INVI 0x15 267 261 #define HVM_GE_C_PRIVI 0x1B 268 262 #define HVM_GE_C_XMAL 0x1C 263 + #define HVM_GE_C_WREG 0x1D 264 + #define HVM_GE_C_PCAL 0x1E 269 265 #define HVM_GE_C_RMAL 0x20 270 266 #define HVM_GE_C_WMAL 0x21 271 267 #define HVM_GE_C_RPROT 0x22
+15 -1
arch/hexagon/include/asm/io.h
··· 1 1 /* 2 2 * IO definitions for the Hexagon architecture 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 39 39 */ 40 40 #define IO_SPACE_LIMIT 0xffff 41 41 #define _IO_BASE ((void __iomem *)0xfe000000) 42 + 43 + #define IOMEM(x) ((void __force __iomem *)(x)) 42 44 43 45 extern int remap_area_pages(unsigned long start, unsigned long phys_addr, 44 46 unsigned long end, unsigned long flags); ··· 176 174 #define __raw_readb readb 177 175 #define __raw_readw readw 178 176 #define __raw_readl readl 177 + 178 + /* 179 + * http://comments.gmane.org/gmane.linux.ports.arm.kernel/117626 180 + */ 181 + 182 + #define readb_relaxed __raw_readb 183 + #define readw_relaxed __raw_readw 184 + #define readl_relaxed __raw_readl 185 + 186 + #define writeb_relaxed __raw_writeb 187 + #define writew_relaxed __raw_writew 188 + #define writel_relaxed __raw_writel 179 189 180 190 /* 181 191 * Need an mtype somewhere in here, for cache type deals?
+18 -10
arch/hexagon/include/asm/mem-layout.h
··· 1 1 /* 2 2 * Memory layout definitions for the Hexagon architecture 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 32 32 #define PAGE_OFFSET _AC(0xc0000000, UL) 33 33 34 34 /* 35 - * LOAD_ADDRESS is the physical/linear address of where in memory 36 - * the kernel gets loaded. The 12 least significant bits must be zero (0) 37 - * due to limitations on setting the EVB 38 - * 35 + * Compiling for a platform that needs a crazy physical offset 36 + * (like if the memory starts at 1GB and up) means we need 37 + * an actual PHYS_OFFSET. Should be set up in head.S. 39 38 */ 40 39 41 - #ifndef LOAD_ADDRESS 42 - #define LOAD_ADDRESS 0x00000000 40 + #ifdef CONFIG_HEXAGON_PHYS_OFFSET 41 + #ifndef __ASSEMBLY__ 42 + extern unsigned long __phys_offset; 43 43 #endif 44 + #define PHYS_OFFSET __phys_offset 45 + #endif 46 + 47 + #ifndef PHYS_OFFSET 48 + #define PHYS_OFFSET 0 49 + #endif 50 + 51 + #define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT) 52 + #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET 44 53 45 54 #define TASK_SIZE (PAGE_OFFSET) 46 55 ··· 64 55 __end_of_fixed_addresses 65 56 }; 66 57 67 - #define MIN_KERNEL_SEG 0x300 /* From 0xc0000000 */ 58 + #define MIN_KERNEL_SEG (PAGE_OFFSET >> PGDIR_SHIFT) /* L1 shift is 22 bits */ 68 59 extern int max_kernel_seg; 69 60 70 61 /* ··· 72 63 * supposed to be based on the amount of physical memory available 73 64 */ 74 65 75 - #define VMALLOC_START (PAGE_OFFSET + VMALLOC_OFFSET + \ 76 - (unsigned long)high_memory) 66 + #define VMALLOC_START ((unsigned long) __va(high_memory + VMALLOC_OFFSET)) 77 67 78 68 /* Gap between physical ram and vmalloc space for guard purposes. */ 79 69 #define VMALLOC_OFFSET PAGE_SIZE
+9 -3
arch/hexagon/include/asm/page.h
··· 1 1 /* 2 2 * Page management definitions for the Hexagon architecture 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 96 96 * MIPS says they're only used during mem_init. 97 97 * also, check if we need a PHYS_OFFSET. 98 98 */ 99 - #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) 100 - #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) 99 + #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET) 100 + #define __va(x) ((void *)((unsigned long)(x) - PHYS_OFFSET + PAGE_OFFSET)) 101 101 102 102 /* The "page frame" descriptor is defined in linux/mm.h */ 103 103 struct page; ··· 140 140 */ 141 141 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 142 142 143 + #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 144 + #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) 145 + 146 + #define page_to_virt(page) __va(page_to_phys(page)) 147 + 143 148 /* 144 149 * For port to Hexagon Virtual Machine, MAYBE we check for attempts 145 150 * to reference reserved HVM space, but in any case, the VM will be ··· 152 147 */ 153 148 #define kern_addr_valid(addr) (1) 154 149 150 + #include <asm/mem-layout.h> 155 151 #include <asm-generic/memory_model.h> 156 152 /* XXX Todo: implement assembly-optimized version of getorder. */ 157 153 #include <asm-generic/getorder.h>
+44 -7
arch/hexagon/include/asm/processor.h
··· 1 1 /* 2 2 * Process/processor support for the Hexagon architecture 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 100 100 */ 101 101 102 102 struct hexagon_switch_stack { 103 - unsigned long long r1716; 104 - unsigned long long r1918; 105 - unsigned long long r2120; 106 - unsigned long long r2322; 107 - unsigned long long r2524; 108 - unsigned long long r2726; 103 + union { 104 + struct { 105 + unsigned long r16; 106 + unsigned long r17; 107 + }; 108 + unsigned long long r1716; 109 + }; 110 + union { 111 + struct { 112 + unsigned long r18; 113 + unsigned long r19; 114 + }; 115 + unsigned long long r1918; 116 + }; 117 + union { 118 + struct { 119 + unsigned long r20; 120 + unsigned long r21; 121 + }; 122 + unsigned long long r2120; 123 + }; 124 + union { 125 + struct { 126 + unsigned long r22; 127 + unsigned long r23; 128 + }; 129 + unsigned long long r2322; 130 + }; 131 + union { 132 + struct { 133 + unsigned long r24; 134 + unsigned long r25; 135 + }; 136 + unsigned long long r2524; 137 + }; 138 + union { 139 + struct { 140 + unsigned long r26; 141 + unsigned long r27; 142 + }; 143 + unsigned long long r2726; 144 + }; 145 + 109 146 unsigned long fp; 110 147 unsigned long lr; 111 148 };
+6 -7
arch/hexagon/include/asm/vm_mmu.h
··· 1 1 /* 2 2 * Hexagon VM page table entry definitions 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2011,2013 The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 68 68 69 69 #define __HEXAGON_C_WB 0x0 /* Write-back, no L2 */ 70 70 #define __HEXAGON_C_WT 0x1 /* Write-through, no L2 */ 71 - #define __HEXAGON_C_DEV 0x4 /* Device register space */ 72 - #define __HEXAGON_C_WT_L2 0x5 /* Write-through, with L2 */ 73 - /* this really should be #if CONFIG_HEXAGON_ARCH = 2 but that's not defined */ 74 - #if defined(CONFIG_HEXAGON_COMET) || defined(CONFIG_QDSP6_ST1) 75 - #define __HEXAGON_C_UNC __HEXAGON_C_DEV 76 - #else 77 71 #define __HEXAGON_C_UNC 0x6 /* Uncached memory */ 72 + #if CONFIG_HEXAGON_ARCH_VERSION >= 2 73 + #define __HEXAGON_C_DEV 0x4 /* Device register space */ 74 + #else 75 + #define __HEXAGON_C_DEV __HEXAGON_C_UNC 78 76 #endif 77 + #define __HEXAGON_C_WT_L2 0x5 /* Write-through, with L2 */ 79 78 #define __HEXAGON_C_WB_L2 0x7 /* Write-back, with L2 */ 80 79 81 80 /*
+5
arch/hexagon/include/uapi/asm/ptrace.h
··· 36 36 ((struct pt_regs *) \ 37 37 ((unsigned long)current_thread_info() + THREAD_SIZE) - 1) 38 38 39 + #if CONFIG_HEXAGON_ARCH_VERSION >= 4 40 + #define arch_has_single_step() (1) 41 + #endif 42 + 43 + 39 44 #endif
+13 -4
arch/hexagon/include/uapi/asm/registers.h
··· 57 57 }; 58 58 union { 59 59 struct { 60 - unsigned long gp; 61 60 unsigned long ugp; 61 + unsigned long gp; 62 62 }; 63 - long long int ugpgp; 63 + long long int gpugp; 64 + }; 65 + union { 66 + struct { 67 + unsigned long cs0; 68 + unsigned long cs1; 69 + }; 70 + long long int cs1cs0; 64 71 }; 65 72 /* 66 73 * Be extremely careful with rearranging these, if at all. Some code ··· 211 204 #define pt_psp(regs) ((regs)->hvmer.vmpsp) 212 205 #define pt_badva(regs) ((regs)->hvmer.vmbadva) 213 206 207 + #define pt_set_singlestep(regs) ((regs)->hvmer.vmest |= (1<<HVM_VMEST_SS_SFT)) 208 + #define pt_clr_singlestep(regs) ((regs)->hvmer.vmest &= ~(1<<HVM_VMEST_SS_SFT)) 209 + 214 210 #define pt_set_rte_sp(regs, sp) do {\ 215 - pt_psp(regs) = (sp);\ 216 - (regs)->SP = (unsigned long) &((regs)->hvmer);\ 211 + pt_psp(regs) = (regs)->SP = (sp);\ 217 212 } while (0) 218 213 219 214 #define pt_set_kmode(regs) \
+4
arch/hexagon/include/uapi/asm/signal.h
··· 19 19 #ifndef _ASM_SIGNAL_H 20 20 #define _ASM_SIGNAL_H 21 21 22 + #include <uapi/asm/registers.h> 23 + 22 24 extern unsigned long __rt_sigtramp_template[2]; 25 + 26 + void do_signal(struct pt_regs *regs); 23 27 24 28 #include <asm-generic/signal.h> 25 29
+3
arch/hexagon/include/uapi/asm/unistd.h
··· 27 27 */ 28 28 29 29 #define sys_mmap2 sys_mmap_pgoff 30 + #define __ARCH_WANT_SYS_EXECVE 30 31 #define __ARCH_WANT_SYS_CLONE 32 + #define __ARCH_WANT_SYS_VFORK 33 + #define __ARCH_WANT_SYS_FORK 31 34 32 35 #include <asm-generic/unistd.h>
+6
arch/hexagon/include/uapi/asm/user.h
··· 55 55 unsigned long pc; 56 56 unsigned long cause; 57 57 unsigned long badva; 58 + #if CONFIG_HEXAGON_ARCH_VERSION < 4 58 59 unsigned long pad1; /* pad out to 48 words total */ 59 60 unsigned long pad2; /* pad out to 48 words total */ 60 61 unsigned long pad3; /* pad out to 48 words total */ 62 + #else 63 + unsigned long cs0; 64 + unsigned long cs1; 65 + unsigned long pad1; /* pad out to 48 words total */ 66 + #endif 61 67 }; 62 68 63 69 #endif
+1 -1
arch/hexagon/kernel/Makefile
··· 1 1 extra-y := head.o vmlinux.lds 2 2 3 - obj-$(CONFIG_SMP) += smp.o topology.o 3 + obj-$(CONFIG_SMP) += smp.o 4 4 5 5 obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o 6 6 obj-y += process.o trampoline.o reset.o ptrace.o vdso.o
+3 -2
arch/hexagon/kernel/asm-offsets.c
··· 5 5 * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com 6 6 * Copyright (C) 2000 MIPS Technologies, Inc. 7 7 * 8 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 8 + * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. 9 9 * 10 10 * This program is free software; you can redistribute it and/or modify 11 11 * it under the terms of the GNU General Public License version 2 and ··· 44 44 45 45 COMMENT("Hexagon pt_regs definitions"); 46 46 OFFSET(_PT_SYSCALL_NR, pt_regs, syscall_nr); 47 - OFFSET(_PT_UGPGP, pt_regs, ugpgp); 47 + OFFSET(_PT_GPUGP, pt_regs, gpugp); 48 + OFFSET(_PT_CS1CS0, pt_regs, cs1cs0); 48 49 OFFSET(_PT_R3130, pt_regs, r3130); 49 50 OFFSET(_PT_R2928, pt_regs, r2928); 50 51 OFFSET(_PT_R2726, pt_regs, r2726);
+17 -10
arch/hexagon/kernel/dma.c
··· 1 1 /* 2 2 * DMA implementation for Hexagon 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 23 23 #include <linux/genalloc.h> 24 24 #include <asm/dma-mapping.h> 25 25 #include <linux/module.h> 26 + #include <asm/page.h> 26 27 27 28 struct dma_map_ops *dma_ops; 28 29 EXPORT_SYMBOL(dma_ops); 29 30 30 31 int bad_dma_address; /* globals are automatically initialized to zero */ 32 + 33 + static inline void *dma_addr_to_virt(dma_addr_t dma_addr) 34 + { 35 + return phys_to_virt((unsigned long) dma_addr); 36 + } 31 37 32 38 int dma_supported(struct device *dev, u64 mask) 33 39 { ··· 66 60 { 67 61 void *ret; 68 62 63 + /* 64 + * Our max_low_pfn should have been backed off by 16MB in 65 + * mm/init.c to create DMA coherent space. Use that as the VA 66 + * for the pool. 67 + */ 68 + 69 69 if (coherent_pool == NULL) { 70 70 coherent_pool = gen_pool_create(PAGE_SHIFT, -1); 71 71 ··· 79 67 panic("Can't create %s() memory pool!", __func__); 80 68 else 81 69 gen_pool_add(coherent_pool, 82 - (PAGE_OFFSET + (max_low_pfn << PAGE_SHIFT)), 70 + pfn_to_virt(max_low_pfn), 83 71 hexagon_coherent_pool_size, -1); 84 72 } 85 73 ··· 87 75 88 76 if (ret) { 89 77 memset(ret, 0, size); 90 - *dma_addr = (dma_addr_t) (ret - PAGE_OFFSET); 78 + *dma_addr = (dma_addr_t) virt_to_phys(ret); 91 79 } else 92 80 *dma_addr = ~0; 93 81 ··· 130 118 131 119 s->dma_length = s->length; 132 120 133 - flush_dcache_range(PAGE_OFFSET + s->dma_address, 134 - PAGE_OFFSET + s->dma_address + s->length); 121 + flush_dcache_range(dma_addr_to_virt(s->dma_address), 122 + dma_addr_to_virt(s->dma_address + s->length)); 135 123 } 136 124 137 125 return nents; ··· 159 147 default: 160 148 BUG(); 161 149 } 162 - } 163 - 164 - static inline void *dma_addr_to_virt(dma_addr_t dma_addr) 165 - { 166 - return phys_to_virt((unsigned long) dma_addr); 167 150 } 168 151 169 152 /**
+91 -16
arch/hexagon/kernel/head.S
··· 1 1 /* 2 2 * Early kernel startup code for Hexagon 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify ··· 25 25 #include <asm/mem-layout.h> 26 26 #include <asm/vm_mmu.h> 27 27 #include <asm/page.h> 28 + #include <asm/hexagon_vm.h> 29 + 30 + #define SEGTABLE_ENTRIES #0x0e0 28 31 29 32 __INIT 30 33 ENTRY(stext) ··· 46 43 * Symbol is kernel segment address, but we need 47 44 * the logical/physical address. 48 45 */ 49 - r24 = asl(r24, #2) 50 - r24 = lsr(r24, #2) 46 + r25 = pc; 47 + r2.h = #0xffc0; 48 + r2.l = #0x0000; 49 + r25 = and(r2,r25); /* R25 holds PHYS_OFFSET now */ 50 + r1.h = #HI(PAGE_OFFSET); 51 + r1.l = #LO(PAGE_OFFSET); 52 + r24 = sub(r24,r1); /* swapper_pg_dir - PAGE_OFFSET */ 53 + r24 = add(r24,r25); /* + PHYS_OFFSET */ 51 54 52 - r0 = r24 55 + r0 = r24; /* aka __pa(swapper_pg_dir) */ 53 56 54 57 /* 55 - * Initialize a 16MB PTE to make the virtual and physical 58 + * Initialize page dir to make the virtual and physical 56 59 * addresses where the kernel was loaded be identical. 60 + * Done in 4MB chunks. 57 61 */ 58 62 #define PTE_BITS ( __HVM_PTE_R | __HVM_PTE_W | __HVM_PTE_X \ 59 63 | __HEXAGON_C_WB_L2 << 6 \ 60 64 | __HVM_PDE_S_4MB) 61 65 62 - r1 = pc 63 - r2.H = #0xffc0 64 - r2.L = #0x0000 65 - r1 = and(r1,r2) /* round PC to 4MB boundary */ 66 + /* 67 + * Get number of VA=PA entries; only really needed for jump 68 + * to hyperspace; gets blown away immediately after 69 + */ 70 + 71 + { 72 + r1.l = #LO(_end); 73 + r2.l = #LO(stext); 74 + r3 = #1; 75 + } 76 + { 77 + r1.h = #HI(_end); 78 + r2.h = #HI(stext); 79 + r3 = asl(r3, #22); 80 + } 81 + { 82 + r1 = sub(r1, r2); 83 + r3 = add(r3, #-1); 84 + } /* r1 = _end - stext */ 85 + r1 = add(r1, r3); /* + (4M-1) */ 86 + r26 = lsr(r1, #22); /* / 4M = # of entries */ 87 + 88 + r1 = r25; 89 + r2.h = #0xffc0; 90 + r2.l = #0x0000; /* round back down to 4MB boundary */ 91 + r1 = and(r1,r2); 66 92 r2 = lsr(r1, #22) /* 4MB page number */ 67 93 r2 = asl(r2, #2) /* times sizeof(PTE) (4bytes) */ 68 94 r0 = add(r0,r2) /* r0 = address of correct PTE */ 69 95 r2 = #PTE_BITS 70 96 r1 = add(r1,r2) /* r1 = 4MB PTE for the first entry */ 71 97 r2.h = #0x0040 72 - r2.l = #0x0000 /* 4MB */ 98 + r2.l = #0x0000 /* 4MB increments */ 99 + loop0(1f,r26); 100 + 1: 73 101 memw(r0 ++ #4) = r1 74 - r1 = add(r1, r2) 75 - memw(r0 ++ #4) = r1 102 + { r1 = add(r1, r2); } :endloop0 76 103 77 - r0 = r24 104 + /* Also need to overwrite the initial 0xc0000000 entries */ 105 + /* PAGE_OFFSET >> (4MB shift - 4 bytes per entry shift) */ 106 + R1.H = #HI(PAGE_OFFSET >> (22 - 2)) 107 + R1.L = #LO(PAGE_OFFSET >> (22 - 2)) 108 + 109 + r0 = add(r1, r24); /* advance to 0xc0000000 entry */ 110 + r1 = r25; 111 + r2.h = #0xffc0; 112 + r2.l = #0x0000; /* round back down to 4MB boundary */ 113 + r1 = and(r1,r2); /* for huge page */ 114 + r2 = #PTE_BITS 115 + r1 = add(r1,r2); 116 + r2.h = #0x0040 117 + r2.l = #0x0000 /* 4MB increments */ 118 + 119 + loop0(1f,SEGTABLE_ENTRIES); 120 + 1: 121 + memw(r0 ++ #4) = r1; 122 + { r1 = add(r1,r2); } :endloop0 123 + 124 + r0 = r24; 78 125 79 126 /* 80 127 * The subroutine wrapper around the virtual instruction touches 81 128 * no memory, so we should be able to use it even here. 129 + * Note that in this version, R1 and R2 get "clobbered"; see 130 + * vm_ops.S 82 131 */ 132 + r1 = #VM_TRANS_TYPE_TABLE 83 133 call __vmnewmap; 84 134 85 135 /* Jump into virtual address range. */ ··· 146 90 __head_s_vaddr_target: 147 91 /* 148 92 * Tear down VA=PA translation now that we are running 149 - * in the desgnated kernel segments. 93 + * in kernel virtual space. 150 94 */ 151 95 r0 = #__HVM_PDE_S_INVALID 152 - r1 = r24 153 - loop0(1f,#0x100) 96 + 97 + r1.h = #0xffc0; 98 + r1.l = #0x0000; 99 + r2 = r25; /* phys_offset */ 100 + r2 = and(r1,r2); 101 + 102 + r1.l = #lo(swapper_pg_dir) 103 + r1.h = #hi(swapper_pg_dir) 104 + r2 = lsr(r2, #22) /* 4MB page number */ 105 + r2 = asl(r2, #2) /* times sizeof(PTE) (4bytes) */ 106 + r1 = add(r1,r2); 107 + loop0(1f,r26) 108 + 154 109 1: 155 110 { 156 111 memw(R1 ++ #4) = R0 157 112 }:endloop0 158 113 159 114 r0 = r24 115 + r1 = #VM_TRANS_TYPE_TABLE 160 116 call __vmnewmap 161 117 162 118 /* Go ahead and install the trap0 return so angel calls work */ ··· 210 142 211 143 r2 = sub(r2,r0); 212 144 call memset; 145 + 146 + /* Set PHYS_OFFSET; should be in R25 */ 147 + #ifdef CONFIG_HEXAGON_PHYS_OFFSET 148 + r0.l = #LO(__phys_offset); 149 + r0.h = #HI(__phys_offset); 150 + memw(r0) = r25; 151 + #endif 213 152 214 153 /* Time to make the doughnuts. */ 215 154 call start_kernel
+3 -1
arch/hexagon/kernel/kgdb.c
··· 1 1 /* 2 2 * arch/hexagon/kernel/kgdb.c - Hexagon KGDB Support 3 3 * 4 - * Copyright (c) 2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 70 70 { "lc1", GDB_SIZEOF_REG, offsetof(struct pt_regs, lc1)}, 71 71 { " gp", GDB_SIZEOF_REG, offsetof(struct pt_regs, gp)}, 72 72 { "ugp", GDB_SIZEOF_REG, offsetof(struct pt_regs, ugp)}, 73 + { "cs0", GDB_SIZEOF_REG, offsetof(struct pt_regs, cs0)}, 74 + { "cs1", GDB_SIZEOF_REG, offsetof(struct pt_regs, cs1)}, 73 75 { "psp", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmpsp)}, 74 76 { "elr", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmel)}, 75 77 { "est", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmest)},
+41 -1
arch/hexagon/kernel/process.c
··· 24 24 #include <linux/tick.h> 25 25 #include <linux/uaccess.h> 26 26 #include <linux/slab.h> 27 + #include <linux/tracehook.h> 27 28 28 29 /* 29 30 * Program thread launch. Often defined as a macro in processor.h, ··· 96 95 if (unlikely(p->flags & PF_KTHREAD)) { 97 96 memset(childregs, 0, sizeof(struct pt_regs)); 98 97 /* r24 <- fn, r25 <- arg */ 99 - ss->r2524 = usp | ((u64)arg << 32); 98 + ss->r24 = usp; 99 + ss->r25 = arg; 100 100 pt_set_kmode(childregs); 101 101 return 0; 102 102 } ··· 186 184 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) 187 185 { 188 186 return 0; 187 + } 188 + 189 + 190 + /* 191 + * Called on the exit path of event entry; see vm_entry.S 192 + * 193 + * Interrupts will already be disabled. 194 + * 195 + * Returns 0 if there's no need to re-check for more work. 196 + */ 197 + 198 + int do_work_pending(struct pt_regs *regs, u32 thread_info_flags) 199 + { 200 + if (!(thread_info_flags & _TIF_WORK_MASK)) { 201 + return 0; 202 + } /* shortcut -- no work to be done */ 203 + 204 + local_irq_enable(); 205 + 206 + if (thread_info_flags & _TIF_NEED_RESCHED) { 207 + schedule(); 208 + return 1; 209 + } 210 + 211 + if (thread_info_flags & _TIF_SIGPENDING) { 212 + do_signal(regs); 213 + return 1; 214 + } 215 + 216 + if (thread_info_flags & _TIF_NOTIFY_RESUME) { 217 + clear_thread_flag(TIF_NOTIFY_RESUME); 218 + tracehook_notify_resume(regs); 219 + return 1; 220 + } 221 + 222 + /* Should not even reach here */ 223 + panic("%s: bad thread_info flags 0x%08x\n", __func__, 224 + thread_info_flags); 189 225 }
+25 -1
arch/hexagon/kernel/ptrace.c
··· 1 1 /* 2 2 * Ptrace support for Hexagon 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 31 31 #include <linux/elf.h> 32 32 33 33 #include <asm/user.h> 34 + 35 + #if arch_has_single_step() 36 + /* Both called from ptrace_resume */ 37 + void user_enable_single_step(struct task_struct *child) 38 + { 39 + pt_set_singlestep(task_pt_regs(child)); 40 + set_tsk_thread_flag(child, TIF_SINGLESTEP); 41 + } 42 + 43 + void user_disable_single_step(struct task_struct *child) 44 + { 45 + pt_clr_singlestep(task_pt_regs(child)); 46 + clear_tsk_thread_flag(child, TIF_SINGLESTEP); 47 + } 48 + #endif 34 49 35 50 static int genregs_get(struct task_struct *target, 36 51 const struct user_regset *regset, ··· 91 76 dummy = pt_cause(regs); 92 77 ONEXT(&dummy, cause); 93 78 ONEXT(&pt_badva(regs), badva); 79 + #if CONFIG_HEXAGON_ARCH_VERSION >=4 80 + ONEXT(&regs->cs0, cs0); 81 + ONEXT(&regs->cs1, cs1); 82 + #endif 94 83 95 84 /* Pad the rest with zeros, if needed */ 96 85 if (!ret) ··· 141 122 /* CAUSE and BADVA aren't writeable. */ 142 123 INEXT(&bucket, cause); 143 124 INEXT(&bucket, badva); 125 + 126 + #if CONFIG_HEXAGON_ARCH_VERSION >=4 127 + INEXT(&regs->cs0, cs0); 128 + INEXT(&regs->cs1, cs1); 129 + #endif 144 130 145 131 /* Ignore the rest, if needed */ 146 132 if (!ret)
+8 -1
arch/hexagon/kernel/setup.c
··· 1 1 /* 2 2 * Arch related setup for Hexagon 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 68 68 */ 69 69 __vmsetvec(_K_VM_event_vector); 70 70 71 + printk(KERN_INFO "PHYS_OFFSET=0x%08x\n", PHYS_OFFSET); 72 + 71 73 /* 72 74 * Simulator has a few differences from the hardware. 73 75 * For now, check uninitialized-but-mapped memory ··· 129 127 static int show_cpuinfo(struct seq_file *m, void *v) 130 128 { 131 129 int cpu = (unsigned long) v - 1; 130 + 131 + #ifdef CONFIG_SMP 132 + if (!cpu_online(cpu)) 133 + return 0; 134 + #endif 132 135 133 136 seq_printf(m, "processor\t: %d\n", cpu); 134 137 seq_printf(m, "model name\t: Hexagon Virtual Machine\n");
+18 -27
arch/hexagon/kernel/signal.c
··· 1 1 /* 2 2 * Signal support for Hexagon processor 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 41 41 { 42 42 unsigned long sp = regs->r29; 43 43 44 + /* check if we would overflow the alt stack */ 45 + if (on_sig_stack(sp) && !likely(on_sig_stack(sp - frame_size))) 46 + return (void __user __force *)-1UL; 47 + 44 48 /* Switch to signal stack if appropriate */ 45 49 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0)) 46 50 sp = current->sas_ss_sp + current->sas_ss_size; ··· 70 66 err |= __put_user(regs->preds, &sc->sc_regs.p3_0); 71 67 err |= __put_user(regs->gp, &sc->sc_regs.gp); 72 68 err |= __put_user(regs->ugp, &sc->sc_regs.ugp); 73 - 69 + #if CONFIG_HEXAGON_ARCH_VERSION >= 4 70 + err |= __put_user(regs->cs0, &sc->sc_regs.cs0); 71 + err |= __put_user(regs->cs1, &sc->sc_regs.cs1); 72 + #endif 74 73 tmp = pt_elr(regs); err |= __put_user(tmp, &sc->sc_regs.pc); 75 74 tmp = pt_cause(regs); err |= __put_user(tmp, &sc->sc_regs.cause); 76 75 tmp = pt_badva(regs); err |= __put_user(tmp, &sc->sc_regs.badva); ··· 100 93 err |= __get_user(regs->preds, &sc->sc_regs.p3_0); 101 94 err |= __get_user(regs->gp, &sc->sc_regs.gp); 102 95 err |= __get_user(regs->ugp, &sc->sc_regs.ugp); 103 - 96 + #if CONFIG_HEXAGON_ARCH_VERSION >= 4 97 + err |= __get_user(regs->cs0, &sc->sc_regs.cs0); 98 + err |= __get_user(regs->cs1, &sc->sc_regs.cs1); 99 + #endif 104 100 err |= __get_user(tmp, &sc->sc_regs.pc); pt_set_elr(regs, tmp); 105 101 106 102 return err; ··· 203 193 /* 204 194 * Called from return-from-event code. 205 195 */ 206 - static void do_signal(struct pt_regs *regs) 196 + void do_signal(struct pt_regs *regs) 207 197 { 208 198 struct k_sigaction sigact; 209 199 siginfo_t info; ··· 220 210 } 221 211 222 212 /* 223 - * If we came from a system call, handle the restart. 213 + * No (more) signals; if we came from a system call, handle the restart. 224 214 */ 215 + 225 216 if (regs->syscall_nr >= 0) { 226 217 switch (regs->r00) { 227 218 case -ERESTARTNOHAND: ··· 243 232 no_restart: 244 233 /* If there's no signal to deliver, put the saved sigmask back */ 245 234 restore_saved_sigmask(); 246 - } 247 - 248 - void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 249 - { 250 - if (thread_info_flags & _TIF_SIGPENDING) 251 - do_signal(regs); 252 - 253 - if (thread_info_flags & _TIF_NOTIFY_RESUME) { 254 - clear_thread_flag(TIF_NOTIFY_RESUME); 255 - tracehook_notify_resume(regs); 256 - } 257 235 } 258 236 259 237 /* ··· 272 272 /* Restore the user's stack as well */ 273 273 pt_psp(regs) = regs->r29; 274 274 275 - /* 276 - * Leave a trace in the stack frame that this was a sigreturn. 277 - * If the system call is to replay, we've already restored the 278 - * number in the GPR slot and it will be regenerated on the 279 - * new system call trap entry. Note that if restore_sigcontext() 280 - * did something other than a bulk copy of the pt_regs struct, 281 - * we could avoid this assignment by simply not overwriting 282 - * regs->syscall_nr. 283 - */ 284 - regs->syscall_nr = __NR_rt_sigreturn; 275 + regs->syscall_nr = -1; 285 276 286 277 if (restore_altstack(&frame->uc.uc_stack)) 287 278 goto badframe; 288 279 289 - return 0; 280 + return regs->r00; 290 281 291 282 badframe: 292 283 force_sig(SIGSEGV, current);
-52
arch/hexagon/kernel/topology.c
··· 1 - /* 2 - * CPU topology for Hexagon 3 - * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 and 8 - * only version 2 as published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write to the Free Software 17 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 - * 02110-1301, USA. 19 - */ 20 - 21 - #include <linux/cpu.h> 22 - #include <linux/cpumask.h> 23 - #include <linux/init.h> 24 - #include <linux/node.h> 25 - #include <linux/nodemask.h> 26 - #include <linux/percpu.h> 27 - 28 - /* Swiped from MIPS. */ 29 - 30 - static DEFINE_PER_CPU(struct cpu, cpu_devices); 31 - 32 - static int __init topology_init(void) 33 - { 34 - int i, ret; 35 - 36 - for_each_present_cpu(i) { 37 - 38 - /* 39 - * register_cpu takes a per_cpu pointer and 40 - * just points it at another per_cpu struct... 41 - */ 42 - 43 - ret = register_cpu(&per_cpu(cpu_devices, i), i); 44 - if (ret) 45 - printk(KERN_WARNING "topology_init: register_cpu %d " 46 - "failed (%d)\n", i, ret); 47 - } 48 - 49 - return 0; 50 - } 51 - 52 - subsys_initcall(topology_init);
+23 -13
arch/hexagon/kernel/traps.c
··· 1 1 /* 2 2 * Kernel traps/events for Hexagon processor 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 65 65 return "Write protection fault"; 66 66 case HVM_GE_C_XMAL: 67 67 return "Misaligned instruction"; 68 + case HVM_GE_C_WREG: 69 + return "Multiple writes to same register in packet"; 70 + case HVM_GE_C_PCAL: 71 + return "Program counter values that are not properly aligned"; 68 72 case HVM_GE_C_RMAL: 69 73 return "Misaligned data load"; 70 74 case HVM_GE_C_WMAL: ··· 320 316 case HVM_GE_C_XMAL: 321 317 misaligned_instruction(regs); 322 318 break; 319 + case HVM_GE_C_WREG: 320 + illegal_instruction(regs); 321 + break; 322 + case HVM_GE_C_PCAL: 323 + misaligned_instruction(regs); 324 + break; 323 325 case HVM_GE_C_RMAL: 324 326 misaligned_data_load(regs); 325 327 break; ··· 358 348 359 349 void do_trap0(struct pt_regs *regs) 360 350 { 361 - unsigned long syscallret = 0; 362 351 syscall_fn syscall; 363 352 364 353 switch (pt_cause(regs)) { ··· 397 388 } else { 398 389 syscall = (syscall_fn) 399 390 (sys_call_table[regs->syscall_nr]); 400 - syscallret = syscall(regs->r00, regs->r01, 391 + regs->r00 = syscall(regs->r00, regs->r01, 401 392 regs->r02, regs->r03, 402 393 regs->r04, regs->r05); 403 394 } 404 - 405 - /* 406 - * If it was a sigreturn system call, don't overwrite 407 - * r0 value in stack frame with return value. 408 - * 409 - * __NR_sigreturn doesn't seem to exist in new unistd.h 410 - */ 411 - 412 - if (regs->syscall_nr != __NR_rt_sigreturn) 413 - regs->r00 = syscallret; 414 395 415 396 /* allow strace to get the syscall return state */ 416 397 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACE))) ··· 442 443 { 443 444 /* Halt and catch fire */ 444 445 __vmstop(); 446 + } 447 + 448 + /* 449 + * Treat this like the old 0xdb trap. 450 + */ 451 + 452 + void do_debug_exception(struct pt_regs *regs) 453 + { 454 + regs->hvmer.vmest &= ~HVM_VMEST_CAUSE_MSK; 455 + regs->hvmer.vmest |= (TRAP_DEBUG << HVM_VMEST_CAUSE_SFT); 456 + do_trap0(regs); 445 457 }
+201 -81
arch/hexagon/kernel/vm_entry.S
··· 1 1 /* 2 2 * Event entry/exit for Hexagon 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 45 45 * number in the case where we decode a system call (trap0(#1)). 46 46 */ 47 47 48 + #if CONFIG_HEXAGON_ARCH_VERSION < 4 48 49 #define save_pt_regs()\ 49 - memd(R0 + #_PT_R3130) = R31:30; \ 50 + memd(R0 + #_PT_R3130) = R31:30; \ 51 + { memw(R0 + #_PT_R2928) = R28; \ 52 + R31 = memw(R0 + #_PT_ER_VMPSP); }\ 53 + { memw(R0 + #(_PT_R2928 + 4)) = R31; \ 54 + R31 = ugp; } \ 55 + { memd(R0 + #_PT_R2726) = R27:26; \ 56 + R30 = gp ; } \ 57 + memd(R0 + #_PT_R2524) = R25:24; \ 58 + memd(R0 + #_PT_R2322) = R23:22; \ 59 + memd(R0 + #_PT_R2120) = R21:20; \ 60 + memd(R0 + #_PT_R1918) = R19:18; \ 61 + memd(R0 + #_PT_R1716) = R17:16; \ 62 + memd(R0 + #_PT_R1514) = R15:14; \ 63 + memd(R0 + #_PT_R1312) = R13:12; \ 64 + { memd(R0 + #_PT_R1110) = R11:10; \ 65 + R15 = lc0; } \ 66 + { memd(R0 + #_PT_R0908) = R9:8; \ 67 + R14 = sa0; } \ 68 + { memd(R0 + #_PT_R0706) = R7:6; \ 69 + R13 = lc1; } \ 70 + { memd(R0 + #_PT_R0504) = R5:4; \ 71 + R12 = sa1; } \ 72 + { memd(R0 + #_PT_GPUGP) = R31:30; \ 73 + R11 = m1; \ 74 + R2.H = #HI(_THREAD_SIZE); } \ 75 + { memd(R0 + #_PT_LC0SA0) = R15:14; \ 76 + R10 = m0; \ 77 + R2.L = #LO(_THREAD_SIZE); } \ 78 + { memd(R0 + #_PT_LC1SA1) = R13:12; \ 79 + R15 = p3:0; \ 80 + R2 = neg(R2); } \ 81 + { memd(R0 + #_PT_M1M0) = R11:10; \ 82 + R14 = usr; \ 83 + R2 = and(R0,R2); } \ 84 + { memd(R0 + #_PT_PREDSUSR) = R15:14; \ 85 + THREADINFO_REG = R2; } \ 86 + { r24 = memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS); \ 87 + memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R0; \ 88 + R2 = #-1; } \ 89 + { memw(R0 + #_PT_SYSCALL_NR) = R2; \ 90 + R30 = #0; } 91 + #else 92 + /* V4+ */ 93 + /* the # ## # syntax inserts a literal ## */ 94 + #define save_pt_regs()\ 95 + { memd(R0 + #_PT_R3130) = R31:30; \ 96 + R30 = memw(R0 + #_PT_ER_VMPSP); }\ 50 97 { memw(R0 + #_PT_R2928) = R28; \ 51 - R31 = memw(R0 + #_PT_ER_VMPSP); }\ 52 - { memw(R0 + #(_PT_R2928 + 4)) = R31; \ 53 - R31 = ugp; } \ 54 - { memd(R0 + #_PT_R2726) = R27:26; \ 55 - R30 = gp ; } \ 56 - memd(R0 + #_PT_R2524) = R25:24; \ 57 - memd(R0 + #_PT_R2322) = R23:22; \ 58 - memd(R0 + #_PT_R2120) = R21:20; \ 59 - memd(R0 + #_PT_R1918) = R19:18; \ 60 - memd(R0 + #_PT_R1716) = R17:16; \ 61 - memd(R0 + #_PT_R1514) = R15:14; \ 62 - memd(R0 + #_PT_R1312) = R13:12; \ 98 + memw(R0 + #(_PT_R2928 + 4)) = R30; }\ 99 + { R31:30 = C11:10; \ 100 + memd(R0 + #_PT_R2726) = R27:26; \ 101 + memd(R0 + #_PT_R2524) = R25:24; }\ 102 + { memd(R0 + #_PT_R2322) = R23:22; \ 103 + memd(R0 + #_PT_R2120) = R21:20; }\ 104 + { memd(R0 + #_PT_R1918) = R19:18; \ 105 + memd(R0 + #_PT_R1716) = R17:16; }\ 106 + { memd(R0 + #_PT_R1514) = R15:14; \ 107 + memd(R0 + #_PT_R1312) = R13:12; \ 108 + R17:16 = C13:12; }\ 63 109 { memd(R0 + #_PT_R1110) = R11:10; \ 64 - R15 = lc0; } \ 65 - { memd(R0 + #_PT_R0908) = R9:8; \ 66 - R14 = sa0; } \ 110 + memd(R0 + #_PT_R0908) = R9:8; \ 111 + R15:14 = C1:0; } \ 67 112 { memd(R0 + #_PT_R0706) = R7:6; \ 68 - R13 = lc1; } \ 69 - { memd(R0 + #_PT_R0504) = R5:4; \ 70 - R12 = sa1; } \ 71 - { memd(R0 + #_PT_UGPGP) = R31:30; \ 72 - R11 = m1; \ 73 - R2.H = #HI(_THREAD_SIZE); } \ 74 - { memd(R0 + #_PT_LC0SA0) = R15:14; \ 75 - R10 = m0; \ 76 - R2.L = #LO(_THREAD_SIZE); } \ 77 - { memd(R0 + #_PT_LC1SA1) = R13:12; \ 78 - R15 = p3:0; \ 79 - R2 = neg(R2); } \ 113 + memd(R0 + #_PT_R0504) = R5:4; \ 114 + R13:12 = C3:2; } \ 115 + { memd(R0 + #_PT_GPUGP) = R31:30; \ 116 + memd(R0 + #_PT_LC0SA0) = R15:14; \ 117 + R11:10 = C7:6; }\ 118 + { THREADINFO_REG = and(R0, # ## #-_THREAD_SIZE); \ 119 + memd(R0 + #_PT_LC1SA1) = R13:12; \ 120 + R15 = p3:0; }\ 80 121 { memd(R0 + #_PT_M1M0) = R11:10; \ 81 - R14 = usr; \ 82 - R2 = and(R0,R2); } \ 83 - { memd(R0 + #_PT_PREDSUSR) = R15:14; \ 84 - THREADINFO_REG = R2; } \ 122 + memw(R0 + #_PT_PREDSUSR + 4) = R15; }\ 85 123 { r24 = memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS); \ 86 124 memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R0; \ 87 125 R2 = #-1; } \ 88 126 { memw(R0 + #_PT_SYSCALL_NR) = R2; \ 127 + memd(R0 + #_PT_CS1CS0) = R17:16; \ 89 128 R30 = #0; } 129 + #endif 90 130 91 131 /* 92 132 * Restore registers and thread_info.regs state. THREADINFO_REG ··· 134 94 * preserved. Don't restore R29 (SP) until later. 135 95 */ 136 96 97 + #if CONFIG_HEXAGON_ARCH_VERSION < 4 137 98 #define restore_pt_regs() \ 138 99 { memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R24; \ 139 100 R15:14 = memd(R0 + #_PT_PREDSUSR); } \ ··· 162 121 R23:22 = memd(R0 + #_PT_R2322); } \ 163 122 { R25:24 = memd(R0 + #_PT_R2524); \ 164 123 R27:26 = memd(R0 + #_PT_R2726); } \ 165 - R31:30 = memd(R0 + #_PT_UGPGP); \ 124 + R31:30 = memd(R0 + #_PT_GPUGP); \ 166 125 { R28 = memw(R0 + #_PT_R2928); \ 167 126 ugp = R31; } \ 168 127 { R31:30 = memd(R0 + #_PT_R3130); \ 169 128 gp = R30; } 129 + #else 130 + /* V4+ */ 131 + #define restore_pt_regs() \ 132 + { memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R24; \ 133 + R15:14 = memd(R0 + #_PT_PREDSUSR); } \ 134 + { R11:10 = memd(R0 + #_PT_M1M0); \ 135 + R13:12 = memd(R0 + #_PT_LC1SA1); \ 136 + p3:0 = R15; } \ 137 + { R15:14 = memd(R0 + #_PT_LC0SA0); \ 138 + R3:2 = memd(R0 + #_PT_R0302); \ 139 + usr = R14; } \ 140 + { R5:4 = memd(R0 + #_PT_R0504); \ 141 + R7:6 = memd(R0 + #_PT_R0706); \ 142 + C7:6 = R11:10; }\ 143 + { R9:8 = memd(R0 + #_PT_R0908); \ 144 + R11:10 = memd(R0 + #_PT_R1110); \ 145 + C3:2 = R13:12; }\ 146 + { R13:12 = memd(R0 + #_PT_R1312); \ 147 + R15:14 = memd(R0 + #_PT_R1514); \ 148 + C1:0 = R15:14; }\ 149 + { R17:16 = memd(R0 + #_PT_R1716); \ 150 + R19:18 = memd(R0 + #_PT_R1918); } \ 151 + { R21:20 = memd(R0 + #_PT_R2120); \ 152 + R23:22 = memd(R0 + #_PT_R2322); } \ 153 + { R25:24 = memd(R0 + #_PT_R2524); \ 154 + R27:26 = memd(R0 + #_PT_R2726); } \ 155 + R31:30 = memd(R0 + #_PT_CS1CS0); \ 156 + { C13:12 = R31:30; \ 157 + R31:30 = memd(R0 + #_PT_GPUGP) ; \ 158 + R28 = memw(R0 + #_PT_R2928); }\ 159 + { C11:10 = R31:30; \ 160 + R31:30 = memd(R0 + #_PT_R3130); } 161 + #endif 170 162 171 163 /* 172 164 * Clears off enough space for the rest of pt_regs; evrec is a part ··· 213 139 * Need to save off R0, R1, R2, R3 immediately. 214 140 */ 215 141 142 + #if CONFIG_HEXAGON_ARCH_VERSION < 4 216 143 #define vm_event_entry(CHandler) \ 217 144 { \ 218 145 R29 = add(R29, #-(_PT_REGS_SIZE)); \ ··· 233 158 R1.H = #HI(CHandler); \ 234 159 jump event_dispatch; \ 235 160 } 161 + #else 162 + /* V4+ */ 163 + /* turn on I$ prefetch early */ 164 + /* the # ## # syntax inserts a literal ## */ 165 + #define vm_event_entry(CHandler) \ 166 + { \ 167 + R29 = add(R29, #-(_PT_REGS_SIZE)); \ 168 + memd(R29 + #(_PT_R0100 + -_PT_REGS_SIZE)) = R1:0; \ 169 + memd(R29 + #(_PT_R0302 + -_PT_REGS_SIZE)) = R3:2; \ 170 + R0 = usr; \ 171 + } \ 172 + { \ 173 + memw(R29 + #_PT_PREDSUSR) = R0; \ 174 + R0 = setbit(R0, #16); \ 175 + } \ 176 + usr = R0; \ 177 + R1:0 = G1:0; \ 178 + { \ 179 + memd(R29 + #_PT_ER_VMEL) = R1:0; \ 180 + R1 = # ## #(CHandler); \ 181 + R3:2 = G3:2; \ 182 + } \ 183 + { \ 184 + R0 = R29; \ 185 + memd(R29 + #_PT_ER_VMPSP) = R3:2; \ 186 + jump event_dispatch; \ 187 + } 188 + #endif 236 189 237 190 .text 238 191 /* ··· 274 171 callr r1 275 172 276 173 /* 174 + * Coming back from the C-world, our thread info pointer 175 + * should be in the designated register (usually R19) 176 + * 277 177 * If we were in kernel mode, we don't need to check scheduler 278 178 * or signals if CONFIG_PREEMPT is not set. If set, then it has 279 179 * to jump to a need_resched kind of block. ··· 289 183 #endif 290 184 291 185 /* "Nested control path" -- if the previous mode was kernel */ 292 - R0 = memw(R29 + #_PT_ER_VMEST); 293 - P0 = tstbit(R0, #HVM_VMEST_UM_SFT); 294 - if !P0 jump restore_all; 186 + { 187 + R0 = memw(R29 + #_PT_ER_VMEST); 188 + R16.L = #LO(do_work_pending); 189 + } 190 + { 191 + P0 = tstbit(R0, #HVM_VMEST_UM_SFT); 192 + if (!P0.new) jump:nt restore_all; 193 + R16.H = #HI(do_work_pending); 194 + R0 = #VM_INT_DISABLE; 195 + } 196 + 295 197 /* 296 - * Returning from system call, normally coming back from user mode 198 + * Check also the return from fork/system call, normally coming back from 199 + * user mode 200 + * 201 + * R16 needs to have do_work_pending, and R0 should have VM_INT_DISABLE 297 202 */ 298 - return_from_syscall: 203 + 204 + check_work_pending: 299 205 /* Disable interrupts while checking TIF */ 300 - R0 = #VM_INT_DISABLE 301 206 trap1(#HVM_TRAP1_VMSETIE) 302 - 303 - /* 304 - * Coming back from the C-world, our thread info pointer 305 - * should be in the designated register (usually R19) 306 - */ 307 - R1.L = #LO(_TIF_ALLWORK_MASK) 308 207 { 309 - R1.H = #HI(_TIF_ALLWORK_MASK); 310 - R0 = memw(THREADINFO_REG + #_THREAD_INFO_FLAGS); 208 + R0 = R29; /* regs should still be at top of stack */ 209 + R1 = memw(THREADINFO_REG + #_THREAD_INFO_FLAGS); 210 + callr R16; 311 211 } 312 212 313 - /* 314 - * Compare against the "return to userspace" _TIF_WORK_MASK 315 - */ 316 - R1 = and(R1,R0); 317 - { P0 = cmp.eq(R1,#0); if (!P0.new) jump:t work_pending;} 318 - jump restore_all; /* we're outta here! */ 319 - 320 - work_pending: 321 213 { 322 - P0 = tstbit(R1, #TIF_NEED_RESCHED); 323 - if (!P0.new) jump:nt work_notifysig; 214 + P0 = cmp.eq(R0, #0); if (!P0.new) jump:nt check_work_pending; 215 + R0 = #VM_INT_DISABLE; 324 216 } 325 - call schedule 326 - jump return_from_syscall; /* check for more work */ 327 - 328 - work_notifysig: 329 - /* this is the part that's kind of fuzzy. */ 330 - R1 = and(R0, #(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME)); 331 - P0 = cmp.eq(R1, #0); 332 - if P0 jump restore_all 333 - R1 = R0; /* unsigned long thread_info_flags */ 334 - R0 = R29; /* regs should still be at top of stack */ 335 - call do_notify_resume 336 217 337 218 restore_all: 338 - /* Disable interrupts, if they weren't already, before reg restore. */ 339 - R0 = #VM_INT_DISABLE 219 + /* 220 + * Disable interrupts, if they weren't already, before reg restore. 221 + * R0 gets preloaded with #VM_INT_DISABLE before we get here. 222 + */ 340 223 trap1(#HVM_TRAP1_VMSETIE) 341 224 342 225 /* do the setregs here for VM 0.5 */ 343 226 /* R29 here should already be pointing at pt_regs */ 344 - R1:0 = memd(R29 + #_PT_ER_VMEL); 345 - R3:2 = memd(R29 + #_PT_ER_VMPSP); 227 + { 228 + R1:0 = memd(R29 + #_PT_ER_VMEL); 229 + R3:2 = memd(R29 + #_PT_ER_VMPSP); 230 + } 231 + #if CONFIG_HEXAGON_ARCH_VERSION < 4 346 232 trap1(#HVM_TRAP1_VMSETREGS); 233 + #else 234 + G1:0 = R1:0; 235 + G3:2 = R3:2; 236 + #endif 347 237 348 238 R0 = R29 349 239 restore_pt_regs() 350 - R1:0 = memd(R29 + #_PT_R0100); 351 - R29 = add(R29, #_PT_REGS_SIZE); 240 + { 241 + R1:0 = memd(R29 + #_PT_R0100); 242 + R29 = add(R29, #_PT_REGS_SIZE); 243 + } 352 244 trap1(#HVM_TRAP1_VMRTE) 353 245 /* Notreached */ 246 + 354 247 355 248 .globl _K_enter_genex 356 249 _K_enter_genex: ··· 367 262 _K_enter_machcheck: 368 263 vm_event_entry(do_machcheck) 369 264 265 + .globl _K_enter_debug 266 + _K_enter_debug: 267 + vm_event_entry(do_debug_exception) 370 268 371 269 .globl ret_from_fork 372 270 ret_from_fork: 373 - call schedule_tail 374 - P0 = cmp.eq(R24, #0); 375 - if P0 jump return_from_syscall 376 - R0 = R25; 377 - callr R24 378 - jump return_from_syscall 271 + { 272 + call schedule_tail 273 + R16.H = #HI(do_work_pending); 274 + } 275 + { 276 + P0 = cmp.eq(R24, #0); 277 + R16.L = #LO(do_work_pending); 278 + R0 = #VM_INT_DISABLE; 279 + } 280 + if P0 jump check_work_pending 281 + { 282 + R0 = R25; 283 + callr R24 284 + } 285 + { 286 + jump check_work_pending 287 + R0 = #VM_INT_DISABLE; 288 + }
+3 -1
arch/hexagon/kernel/vm_events.c
··· 1 1 /* 2 2 * Mostly IRQ support for Hexagon 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 44 44 regs->lc1, regs->sa1, regs->m1); 45 45 printk(KERN_EMERG "gp: \t0x%08lx ugp: 0x%08lx usr: 0x%08lx\n", 46 46 regs->gp, regs->ugp, regs->usr); 47 + printk(KERN_EMERG "cs0: \t0x%08lx cs1: 0x%08lx\n", 48 + regs->cs0, regs->cs1); 47 49 printk(KERN_EMERG "r0: \t0x%08lx %08lx %08lx %08lx\n", regs->r00, 48 50 regs->r01, 49 51 regs->r02,
+2 -2
arch/hexagon/kernel/vm_vectors.S
··· 1 1 /* 2 2 * Event jump tables 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2012,2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 41 41 jump 1b; /* Reset */ 42 42 jump _K_enter_machcheck; 43 43 jump _K_enter_genex; 44 - jump 1b; /* 3 Rsvd */ 44 + jump _K_enter_debug; 45 45 jump 1b; /* 4 Rsvd */ 46 46 jump _K_enter_trap0; 47 47 jump 1b; /* 6 Rsvd */
+3 -9
arch/hexagon/kernel/vmlinux.lds.S
··· 1 1 /* 2 2 * Linker script for Hexagon kernel 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 17 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 18 * 02110-1301, USA. 19 19 */ 20 - 21 - #define LOAD_OFFSET PAGE_OFFSET 22 20 23 21 #include <asm-generic/vmlinux.lds.h> 24 22 #include <asm/asm-offsets.h> /* Most of the kernel defines are here */ ··· 34 36 35 37 #define PAGE_SIZE _PAGE_SIZE 36 38 37 - /* This LOAD_OFFSET is temporary for debugging on the simulator; it may change 38 - for hypervisor pseudo-physical memory. */ 39 - 40 - 41 39 SECTIONS 42 40 { 43 - . = PAGE_OFFSET + LOAD_ADDRESS; 41 + . = PAGE_OFFSET; 44 42 45 43 __init_begin = .; 46 44 HEAD_TEXT_SECTION ··· 46 52 47 53 . = ALIGN(_PAGE_SIZE); 48 54 _stext = .; 49 - .text : AT(ADDR(.text) - LOAD_OFFSET) { 55 + .text : AT(ADDR(.text)) { 50 56 _text = .; 51 57 TEXT_TEXT 52 58 SCHED_TEXT
+22 -13
arch/hexagon/mm/init.c
··· 1 1 /* 2 2 * Memory subsystem initialization for Hexagon 3 3 * 4 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 31 31 * Define a startpg just past the end of the kernel image and a lastpg 32 32 * that corresponds to the end of real or simulated platform memory. 33 33 */ 34 - #define bootmem_startpg (PFN_UP(((unsigned long) _end) - PAGE_OFFSET)) 34 + #define bootmem_startpg (PFN_UP(((unsigned long) _end) - PAGE_OFFSET + PHYS_OFFSET)) 35 35 36 - unsigned long bootmem_lastpg; /* Should be set by platform code */ 36 + unsigned long bootmem_lastpg; /* Should be set by platform code */ 37 + unsigned long __phys_offset; /* physical kernel offset >> 12 */ 37 38 38 39 /* Set as variable to limit PMD copies */ 39 40 int max_kernel_seg = 0x303; ··· 45 44 /* indicate pfn's of high memory */ 46 45 unsigned long highstart_pfn, highend_pfn; 47 46 48 - /* struct mmu_gather defined in asm-generic.h; */ 49 47 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 50 48 51 49 /* Default cache attribute for newly created page tables */ ··· 71 71 { 72 72 /* No idea where this is actually declared. Seems to evade LXR. */ 73 73 totalram_pages += free_all_bootmem(); 74 - num_physpages = bootmem_lastpg; /* seriously, what? */ 74 + num_physpages = bootmem_lastpg-ARCH_PFN_OFFSET; 75 75 76 76 printk(KERN_INFO "totalram_pages = %ld\n", totalram_pages); 77 77 ··· 193 193 * This needs to change for highmem setups. 194 194 */ 195 195 196 + /* Prior to this, bootmem_lastpg is actually mem size */ 197 + bootmem_lastpg += ARCH_PFN_OFFSET; 198 + 196 199 /* Memory size needs to be a multiple of 16M */ 197 200 bootmem_lastpg = PFN_DOWN((bootmem_lastpg << PAGE_SHIFT) & 198 201 ~((BIG_KERNEL_PAGE_SIZE) - 1)); ··· 204 201 * Reserve the top DMA_RESERVE bytes of RAM for DMA (uncached) 205 202 * memory allocation 206 203 */ 207 - bootmap_size = init_bootmem(bootmem_startpg, bootmem_lastpg - 208 - PFN_DOWN(DMA_RESERVED_BYTES)); 204 + 205 + max_low_pfn = bootmem_lastpg - PFN_DOWN(DMA_RESERVED_BYTES); 206 + min_low_pfn = ARCH_PFN_OFFSET; 207 + bootmap_size = init_bootmem_node(NODE_DATA(0), bootmem_startpg, min_low_pfn, max_low_pfn); 209 208 210 209 printk(KERN_INFO "bootmem_startpg: 0x%08lx\n", bootmem_startpg); 211 210 printk(KERN_INFO "bootmem_lastpg: 0x%08lx\n", bootmem_lastpg); 212 211 printk(KERN_INFO "bootmap_size: %d\n", bootmap_size); 212 + printk(KERN_INFO "min_low_pfn: 0x%08lx\n", min_low_pfn); 213 213 printk(KERN_INFO "max_low_pfn: 0x%08lx\n", max_low_pfn); 214 214 215 215 /* ··· 227 221 /* this actually only goes to the end of the first gig */ 228 222 segtable_end = segtable + (1<<(30-22)); 229 223 230 - /* Move forward to the start of empty pages */ 231 - segtable += bootmem_lastpg >> (22-PAGE_SHIFT); 224 + /* 225 + * Move forward to the start of empty pages; take into account 226 + * phys_offset shift. 227 + */ 232 228 229 + segtable += (bootmem_lastpg-ARCH_PFN_OFFSET)>>(22-PAGE_SHIFT); 233 230 { 234 - int i; 231 + int i; 235 232 236 - for (i = 1 ; i <= DMA_RESERVE ; i++) 237 - segtable[-i] = ((segtable[-i] & __HVM_PTE_PGMASK_4MB) 233 + for (i = 1 ; i <= DMA_RESERVE ; i++) 234 + segtable[-i] = ((segtable[-i] & __HVM_PTE_PGMASK_4MB) 238 235 | __HVM_PTE_R | __HVM_PTE_W | __HVM_PTE_X 239 236 | __HEXAGON_C_UNC << 6 240 237 | __HVM_PDE_S_4MB); ··· 265 256 * Free all the memory that wasn't taken up by the bootmap, the DMA 266 257 * reserve, or kernel itself. 267 258 */ 268 - free_bootmem(PFN_PHYS(bootmem_startpg)+bootmap_size, 259 + free_bootmem(PFN_PHYS(bootmem_startpg) + bootmap_size, 269 260 PFN_PHYS(bootmem_lastpg - bootmem_startpg) - bootmap_size - 270 261 DMA_RESERVED_BYTES); 271 262
+2 -2
arch/hexagon/mm/vm_fault.c
··· 147 147 } 148 148 info.si_errno = 0; 149 149 info.si_addr = (void __user *)address; 150 - force_sig_info(info.si_code, &info, current); 150 + force_sig_info(info.si_signo, &info, current); 151 151 return; 152 152 153 153 bad_area: ··· 158 158 info.si_errno = 0; 159 159 info.si_code = si_code; 160 160 info.si_addr = (void *)address; 161 - force_sig_info(SIGSEGV, &info, current); 161 + force_sig_info(info.si_signo, &info, current); 162 162 return; 163 163 } 164 164 /* Kernel-mode fault falls through */
-3
arch/openrisc/Kconfig
··· 55 55 config GENERIC_CSUM 56 56 def_bool y 57 57 58 - config GENERIC_FIND_NEXT_BIT 59 - def_bool y 60 - 61 58 source "init/Kconfig" 62 59 63 60