Home Home > GIT Browse
summaryrefslogtreecommitdiff
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-29 18:43:30 (GMT)
committer Linus Torvalds <torvalds@linux-foundation.org>2011-03-29 18:43:30 (GMT)
commiteefbab599531240adaffa1d23900afbc8b0342bd (patch) (unidiff)
tree2beb38a94aca40c7e5a0396503968d041e584bf9
parent90f1e7481eebfd47e7dbf7c8c0cbfe31e025e031 (diff)
parent3062aa50a6b2c3103470178fe7506c450d79ebe5 (diff)
Merge branch 'frv' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-frv
* 'frv' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-frv: FRV: Use generic show_interrupts() FRV: Convert genirq namespace frv: Select GENERIC_HARDIRQS_NO_DEPRECATED frv: Convert cpu irq_chip to new functions frv: Convert mb93493 irq_chip to new functions frv: Convert mb93093 irq_chip to new function frv: Convert mb93091 irq_chip to new functions frv: Fix typo from __do_IRQ overhaul frv: Remove stale irq_chip.end FRV: Do some cleanups FRV: Missing node arg in alloc_thread_info_node() macro NOMMU: implement access_remote_vm NOMMU: support SMP dynamic percpu_alloc NOMMU: percpu should use is_vmalloc_addr().
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--arch/frv/Kconfig1
-rw-r--r--arch/frv/include/asm/system.h9
-rw-r--r--arch/frv/include/asm/thread_info.h4
-rw-r--r--arch/frv/kernel/irq-mb93091.c2
-rw-r--r--include/linux/vmalloc.h32
-rw-r--r--mm/nommu.c52
-rw-r--r--mm/percpu.c3
7 files changed, 76 insertions, 27 deletions
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index e06e3c3..6db8aea 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -354,25 +354,24 @@ source "drivers/pcmcia/Kconfig"
354 #depends on EXPERIMENTAL 354 #depends on EXPERIMENTAL
355 #help 355 #help
356 # At some point in the future, this will cause floating-point math 356 # At some point in the future, this will cause floating-point math
357 # instructions to be emulated by the kernel on machines that lack a 357 # instructions to be emulated by the kernel on machines that lack a
358 # floating-point math coprocessor. Thrill-seekers and chronically 358 # floating-point math coprocessor. Thrill-seekers and chronically
359 # sleep-deprived psychotic hacker types can say Y now, everyone else 359 # sleep-deprived psychotic hacker types can say Y now, everyone else
360 # should probably wait a while. 360 # should probably wait a while.
361 361
362menu "Power management options" 362menu "Power management options"
363 363
364config ARCH_SUSPEND_POSSIBLE 364config ARCH_SUSPEND_POSSIBLE
365 def_bool y 365 def_bool y
366 depends on !SMP
367 366
368source kernel/power/Kconfig 367source kernel/power/Kconfig
369endmenu 368endmenu
370 369
371endmenu 370endmenu
372 371
373 372
374menu "Executable formats" 373menu "Executable formats"
375 374
376source "fs/Kconfig.binfmt" 375source "fs/Kconfig.binfmt"
377 376
378endmenu 377endmenu
diff --git a/arch/frv/include/asm/system.h b/arch/frv/include/asm/system.h
index 0a6d8d9..6c10fd2 100644
--- a/arch/frv/include/asm/system.h
+++ b/arch/frv/include/asm/system.h
@@ -36,39 +36,30 @@ do { \
36 mb(); \ 36 mb(); \
37} while(0) 37} while(0)
38 38
39/* 39/*
40 * Force strict CPU ordering. 40 * Force strict CPU ordering.
41 */ 41 */
42 #define nop() asm volatile ("nop"::) 42 #define nop() asm volatile ("nop"::)
43 #define mb() asm volatile ("membar" : : :"memory") 43 #define mb() asm volatile ("membar" : : :"memory")
44 #define rmb() asm volatile ("membar" : : :"memory") 44 #define rmb() asm volatile ("membar" : : :"memory")
45 #define wmb() asm volatile ("membar" : : :"memory") 45 #define wmb() asm volatile ("membar" : : :"memory")
46 #define read_barrier_depends()do { } while (0) 46 #define read_barrier_depends()do { } while (0)
47 47
48#ifdef CONFIG_SMP
49 #define smp_mb() mb()
50 #define smp_rmb() rmb()
51 #define smp_wmb() wmb()
52 #define smp_read_barrier_depends()read_barrier_depends()
53#define set_mb(var, value) \
54 do { xchg(&var, (value)); } while (0)
55#else
56 #define smp_mb() barrier() 48 #define smp_mb() barrier()
57 #define smp_rmb() barrier() 49 #define smp_rmb() barrier()
58 #define smp_wmb() barrier() 50 #define smp_wmb() barrier()
59 #define smp_read_barrier_depends()do {} while(0) 51 #define smp_read_barrier_depends()do {} while(0)
60#define set_mb(var, value) \ 52#define set_mb(var, value) \
61 do { var = (value); barrier(); } while (0) 53 do { var = (value); barrier(); } while (0)
62#endif
63 54
64extern void die_if_kernel(const char *, ...) __attribute__((format(printf, 1, 2))); 55extern void die_if_kernel(const char *, ...) __attribute__((format(printf, 1, 2)));
65extern void free_initmem(void); 56extern void free_initmem(void);
66 57
67#define arch_align_stack(x) (x) 58#define arch_align_stack(x) (x)
68 59
69/*****************************************************************************/ 60/*****************************************************************************/
70/* 61/*
71 * compare and conditionally exchange value with memory 62 * compare and conditionally exchange value with memory
72 * - if (*ptr == test) then orig = *ptr; *ptr = test; 63 * - if (*ptr == test) then orig = *ptr; *ptr = test;
73 * - if (*ptr != test) then orig = *ptr; 64 * - if (*ptr != test) then orig = *ptr;
74 */ 65 */
diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h
index 8582e9c..cefbe73 100644
--- a/arch/frv/include/asm/thread_info.h
+++ b/arch/frv/include/asm/thread_info.h
@@ -12,24 +12,26 @@
12 12
13#ifndef _ASM_THREAD_INFO_H 13#ifndef _ASM_THREAD_INFO_H
14#define _ASM_THREAD_INFO_H 14#define _ASM_THREAD_INFO_H
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
19#include <asm/processor.h> 19#include <asm/processor.h>
20#endif 20#endif
21 21
22 #define THREAD_SIZE 8192 22 #define THREAD_SIZE 8192
23 23
24#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
25
24/* 26/*
25 * low level task data that entry.S needs immediate access to 27 * low level task data that entry.S needs immediate access to
26 * - this struct should fit entirely inside of one cache line 28 * - this struct should fit entirely inside of one cache line
27 * - this struct shares the supervisor stack pages 29 * - this struct shares the supervisor stack pages
28 * - if the contents of this structure are changed, the assembly constants must also be changed 30 * - if the contents of this structure are changed, the assembly constants must also be changed
29 */ 31 */
30#ifndef __ASSEMBLY__ 32#ifndef __ASSEMBLY__
31 33
32struct thread_info { 34struct thread_info {
33 struct task_struct *task; /* main task structure */ 35 struct task_struct *task; /* main task structure */
34 struct exec_domain *exec_domain;/* execution domain */ 36 struct exec_domain *exec_domain;/* execution domain */
35 unsigned long flags; /* low level flags */ 37 unsigned long flags; /* low level flags */
@@ -78,25 +80,25 @@ struct thread_info {
78/* how to get the thread information struct from C */ 80/* how to get the thread information struct from C */
79register struct thread_info *__current_thread_info asm("gr15"); 81register struct thread_info *__current_thread_info asm("gr15");
80 82
81#define current_thread_info() ({ __current_thread_info; }) 83#define current_thread_info() ({ __current_thread_info; })
82 84
83#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 85#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
84 86
85/* thread information allocation */ 87/* thread information allocation */
86#ifdef CONFIG_DEBUG_STACK_USAGE 88#ifdef CONFIG_DEBUG_STACK_USAGE
87 #define alloc_thread_info_node(tsk, node) \ 89 #define alloc_thread_info_node(tsk, node) \
88 kzalloc_node(THREAD_SIZE, GFP_KERNEL, node) 90 kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
89#else 91#else
90 #define alloc_thread_info_node(tsk) \ 92 #define alloc_thread_info_node(tsk, node) \
91 kmalloc_node(THREAD_SIZE, GFP_KERNEL, node) 93 kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
92#endif 94#endif
93 95
94 #define free_thread_info(info)kfree(info) 96 #define free_thread_info(info)kfree(info)
95 97
96#endif /* __ASSEMBLY__ */ 98#endif /* __ASSEMBLY__ */
97 99
98/* 100/*
99 * thread information flags 101 * thread information flags
100 * - these are process state flags that various assembly files may need to access 102 * - these are process state flags that various assembly files may need to access
101 * - pending work-to-be-done flags are in LSW 103 * - pending work-to-be-done flags are in LSW
102 * - other flags in MSW 104 * - other flags in MSW
diff --git a/arch/frv/kernel/irq-mb93091.c b/arch/frv/kernel/irq-mb93091.c
index 372fe60..9afc2ea 100644
--- a/arch/frv/kernel/irq-mb93091.c
+++ b/arch/frv/kernel/irq-mb93091.c
@@ -38,25 +38,25 @@
38 */ 38 */
39static void frv_fpga_mask(struct irq_data *d) 39static void frv_fpga_mask(struct irq_data *d)
40{ 40{
41 uint16_t imr = __get_IMR(); 41 uint16_t imr = __get_IMR();
42 42
43 imr |= 1 << (d->irq - IRQ_BASE_FPGA); 43 imr |= 1 << (d->irq - IRQ_BASE_FPGA);
44 44
45 __set_IMR(imr); 45 __set_IMR(imr);
46} 46}
47 47
48static void frv_fpga_ack(struct irq_data *d) 48static void frv_fpga_ack(struct irq_data *d)
49{ 49{
50 __clr_IFR(1 << (irq - IRQ_BASE_FPGA)); 50 __clr_IFR(1 << (d->irq - IRQ_BASE_FPGA));
51} 51}
52 52
53static void frv_fpga_mask_ack(struct irq_data *d) 53static void frv_fpga_mask_ack(struct irq_data *d)
54{ 54{
55 uint16_t imr = __get_IMR(); 55 uint16_t imr = __get_IMR();
56 56
57 imr |= 1 << (d->irq - IRQ_BASE_FPGA); 57 imr |= 1 << (d->irq - IRQ_BASE_FPGA);
58 __set_IMR(imr); 58 __set_IMR(imr);
59 59
60 __clr_IFR(1 << (d->irq - IRQ_BASE_FPGA)); 60 __clr_IFR(1 << (d->irq - IRQ_BASE_FPGA));
61} 61}
62 62
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4ed6fcd..9332e52 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -86,41 +86,73 @@ extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
86extern struct vm_struct *get_vm_area_caller(unsigned long size, 86extern struct vm_struct *get_vm_area_caller(unsigned long size,
87 unsigned long flags, void *caller); 87 unsigned long flags, void *caller);
88extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 88extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
89 unsigned long start, unsigned long end); 89 unsigned long start, unsigned long end);
90extern struct vm_struct *__get_vm_area_caller(unsigned long size, 90extern struct vm_struct *__get_vm_area_caller(unsigned long size,
91 unsigned long flags, 91 unsigned long flags,
92 unsigned long start, unsigned long end, 92 unsigned long start, unsigned long end,
93 void *caller); 93 void *caller);
94extern struct vm_struct *remove_vm_area(const void *addr); 94extern struct vm_struct *remove_vm_area(const void *addr);
95 95
96extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 96extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
97 struct page ***pages); 97 struct page ***pages);
98#ifdef CONFIG_MMU
98extern int map_kernel_range_noflush(unsigned long start, unsigned long size, 99extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
99 pgprot_t prot, struct page **pages); 100 pgprot_t prot, struct page **pages);
100extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size); 101extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size);
101extern void unmap_kernel_range(unsigned long addr, unsigned long size); 102extern void unmap_kernel_range(unsigned long addr, unsigned long size);
103#else
104static inline int
105map_kernel_range_noflush(unsigned long start, unsigned long size,
106 pgprot_t prot, struct page **pages)
107{
108 return size >> PAGE_SHIFT;
109}
110static inline void
111unmap_kernel_range_noflush(unsigned long addr, unsigned long size)
112{
113}
114static inline void
115unmap_kernel_range(unsigned long addr, unsigned long size)
116{
117}
118#endif
102 119
103/* Allocate/destroy a 'vmalloc' VM area. */ 120/* Allocate/destroy a 'vmalloc' VM area. */
104extern struct vm_struct *alloc_vm_area(size_t size); 121extern struct vm_struct *alloc_vm_area(size_t size);
105extern void free_vm_area(struct vm_struct *area); 122extern void free_vm_area(struct vm_struct *area);
106 123
107/* for /dev/kmem */ 124/* for /dev/kmem */
108extern long vread(char *buf, char *addr, unsigned long count); 125extern long vread(char *buf, char *addr, unsigned long count);
109extern long vwrite(char *buf, char *addr, unsigned long count); 126extern long vwrite(char *buf, char *addr, unsigned long count);
110 127
111/* 128/*
112 *Internals. Dont't use.. 129 *Internals. Dont't use..
113 */ 130 */
114extern rwlock_t vmlist_lock; 131extern rwlock_t vmlist_lock;
115extern struct vm_struct *vmlist; 132extern struct vm_struct *vmlist;
116extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 133extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
117 134
118#ifdef CONFIG_SMP 135#ifdef CONFIG_SMP
136# ifdef CONFIG_MMU
119struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, 137struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
120 const size_t *sizes, int nr_vms, 138 const size_t *sizes, int nr_vms,
121 size_t align); 139 size_t align);
122 140
123void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms); 141void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);
142# else
143static inline struct vm_struct **
144pcpu_get_vm_areas(const unsigned long *offsets,
145 const size_t *sizes, int nr_vms,
146 size_t align)
147{
148 return NULL;
149}
150
151static inline void
152pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
153{
154}
155# endif
124#endif 156#endif
125 157
126#endif /* _LINUX_VMALLOC_H */ 158#endif /* _LINUX_VMALLOC_H */
diff --git a/mm/nommu.c b/mm/nommu.c
index cb86e7d..c4c542c 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1962,63 +1962,89 @@ error:
1962int in_gate_area_no_mm(unsigned long addr) 1962int in_gate_area_no_mm(unsigned long addr)
1963{ 1963{
1964 return 0; 1964 return 0;
1965} 1965}
1966 1966
1967int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 1967int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1968{ 1968{
1969 BUG(); 1969 BUG();
1970 return 0; 1970 return 0;
1971} 1971}
1972EXPORT_SYMBOL(filemap_fault); 1972EXPORT_SYMBOL(filemap_fault);
1973 1973
1974/* 1974static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
1975 * Access another process' address space. 1975 unsigned long addr, void *buf, int len, int write)
1976 * - source/target buffer must be kernel space
1977 */
1978int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
1979{ 1976{
1980 struct vm_area_struct *vma; 1977 struct vm_area_struct *vma;
1981 struct mm_struct *mm;
1982
1983 if (addr + len < addr)
1984 return 0;
1985
1986 mm = get_task_mm(tsk);
1987 if (!mm)
1988 return 0;
1989 1978
1990 down_read(&mm->mmap_sem); 1979 down_read(&mm->mmap_sem);
1991 1980
1992 /* the access must start within one of the target process's mappings */ 1981 /* the access must start within one of the target process's mappings */
1993 vma = find_vma(mm, addr); 1982 vma = find_vma(mm, addr);
1994 if (vma) { 1983 if (vma) {
1995 /* don't overrun this mapping */ 1984 /* don't overrun this mapping */
1996 if (addr + len >= vma->vm_end) 1985 if (addr + len >= vma->vm_end)
1997 len = vma->vm_end - addr; 1986 len = vma->vm_end - addr;
1998 1987
1999 /* only read or write mappings where it is permitted */ 1988 /* only read or write mappings where it is permitted */
2000 if (write && vma->vm_flags & VM_MAYWRITE) 1989 if (write && vma->vm_flags & VM_MAYWRITE)
2001 copy_to_user_page(vma, NULL, addr, 1990 copy_to_user_page(vma, NULL, addr,
2002 (void *) addr, buf, len); 1991 (void *) addr, buf, len);
2003 else if (!write && vma->vm_flags & VM_MAYREAD) 1992 else if (!write && vma->vm_flags & VM_MAYREAD)
2004 copy_from_user_page(vma, NULL, addr, 1993 copy_from_user_page(vma, NULL, addr,
2005 buf, (void *) addr, len); 1994 buf, (void *) addr, len);
2006 else 1995 else
2007 len = 0; 1996 len = 0;
2008 } else { 1997 } else {
2009 len = 0; 1998 len = 0;
2010 } 1999 }
2011 2000
2012 up_read(&mm->mmap_sem); 2001 up_read(&mm->mmap_sem);
2002
2003 return len;
2004}
2005
2006/**
2007 * @access_remote_vm - access another process' address space
2008 * @mm: the mm_struct of the target address space
2009 * @addr:start address to access
2010 * @buf:source or destination buffer
2011 * @len:number of bytes to transfer
2012 * @write:whether the access is a write
2013 *
2014 * The caller must hold a reference on @mm.
2015 */
2016int access_remote_vm(struct mm_struct *mm, unsigned long addr,
2017 void *buf, int len, int write)
2018{
2019 return __access_remote_vm(NULL, mm, addr, buf, len, write);
2020}
2021
2022/*
2023 * Access another process' address space.
2024 * - source/target buffer must be kernel space
2025 */
2026int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
2027{
2028 struct mm_struct *mm;
2029
2030 if (addr + len < addr)
2031 return 0;
2032
2033 mm = get_task_mm(tsk);
2034 if (!mm)
2035 return 0;
2036
2037 len = __access_remote_vm(tsk, mm, addr, buf, len, write);
2038
2013 mmput(mm); 2039 mmput(mm);
2014 return len; 2040 return len;
2015} 2041}
2016 2042
2017/** 2043/**
2018 * nommu_shrink_inode_mappings - Shrink the shared mappings on an inode 2044 * nommu_shrink_inode_mappings - Shrink the shared mappings on an inode
2019 * @inode: The inode to check 2045 * @inode: The inode to check
2020 * @size: The current filesize of the inode 2046 * @size: The current filesize of the inode
2021 * @newsize: The proposed filesize of the inode 2047 * @newsize: The proposed filesize of the inode
2022 * 2048 *
2023 * Check the shared mappings on an inode on behalf of a shrinking truncate to 2049 * Check the shared mappings on an inode on behalf of a shrinking truncate to
2024 * make sure that that any outstanding VMAs aren't broken and then shrink the 2050 * make sure that that any outstanding VMAs aren't broken and then shrink the
diff --git a/mm/percpu.c b/mm/percpu.c
index 3f93001..55d4d11 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -999,26 +999,25 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
999 (unsigned long)addr < first_end) { 999 (unsigned long)addr < first_end) {
1000 for_each_possible_cpu(cpu) { 1000 for_each_possible_cpu(cpu) {
1001 void *start = per_cpu_ptr(base, cpu); 1001 void *start = per_cpu_ptr(base, cpu);
1002 1002
1003 if (addr >= start && addr < start + pcpu_unit_size) { 1003 if (addr >= start && addr < start + pcpu_unit_size) {
1004 in_first_chunk = true; 1004 in_first_chunk = true;
1005 break; 1005 break;
1006 } 1006 }
1007 } 1007 }
1008 } 1008 }
1009 1009
1010 if (in_first_chunk) { 1010 if (in_first_chunk) {
1011 if ((unsigned long)addr < VMALLOC_START || 1011 if (!is_vmalloc_addr(addr))
1012 (unsigned long)addr >= VMALLOC_END)
1013 return __pa(addr); 1012 return __pa(addr);
1014 else 1013 else
1015 return page_to_phys(vmalloc_to_page(addr)); 1014 return page_to_phys(vmalloc_to_page(addr));
1016 } else 1015 } else
1017 return page_to_phys(pcpu_addr_to_page(addr)); 1016 return page_to_phys(pcpu_addr_to_page(addr));
1018} 1017}
1019 1018
1020/** 1019/**
1021 * pcpu_alloc_alloc_info - allocate percpu allocation info 1020 * pcpu_alloc_alloc_info - allocate percpu allocation info
1022 * @nr_groups: the number of groups 1021 * @nr_groups: the number of groups
1023 * @nr_units: the number of units 1022 * @nr_units: the number of units
1024 * 1023 *