aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/compat.h3
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/cred.h10
-rw-r--r--include/linux/dmaengine.h12
-rw-r--r--include/linux/eventfd.h2
-rw-r--r--include/linux/fs.h12
-rw-r--r--include/linux/ipc_namespace.h42
-rw-r--r--include/linux/kcmp.h17
-rw-r--r--include/linux/kernel.h1
-rw-r--r--include/linux/kexec.h75
-rw-r--r--include/linux/kmod.h34
-rw-r--r--include/linux/msdos_fs.h3
-rw-r--r--include/linux/prctl.h6
-rw-r--r--include/linux/rio.h47
-rw-r--r--include/linux/rio_drv.h9
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/syscalls.h2
18 files changed, 206 insertions, 73 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 7185b8f15ced..8760be30b375 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -226,6 +226,7 @@ header-y += kdev_t.h
226header-y += kernel.h 226header-y += kernel.h
227header-y += kernelcapi.h 227header-y += kernelcapi.h
228header-y += kernel-page-flags.h 228header-y += kernel-page-flags.h
229header-y += kexec.h
229header-y += keyboard.h 230header-y += keyboard.h
230header-y += keyctl.h 231header-y += keyctl.h
231header-y += l2tp.h 232header-y += l2tp.h
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 5d46217f84ad..4e890394ef99 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -577,8 +577,7 @@ extern ssize_t compat_rw_copy_check_uvector(int type,
577 const struct compat_iovec __user *uvector, 577 const struct compat_iovec __user *uvector,
578 unsigned long nr_segs, 578 unsigned long nr_segs,
579 unsigned long fast_segs, struct iovec *fast_pointer, 579 unsigned long fast_segs, struct iovec *fast_pointer,
580 struct iovec **ret_pointer, 580 struct iovec **ret_pointer);
581 int check_access);
582 581
583extern void __user *compat_alloc_user_space(unsigned long len); 582extern void __user *compat_alloc_user_space(unsigned long len);
584 583
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 7230bb59a06f..2e9b9ebbeb78 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -177,6 +177,7 @@ extern void put_online_cpus(void);
177#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) 177#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri)
178#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 178#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
179#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 179#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
180void clear_tasks_mm_cpumask(int cpu);
180int cpu_down(unsigned int cpu); 181int cpu_down(unsigned int cpu);
181 182
182#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE 183#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 917dc5aeb1d4..ebbed2ce6637 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -277,17 +277,13 @@ static inline void put_cred(const struct cred *_cred)
277 * @task: The task to query 277 * @task: The task to query
278 * 278 *
279 * Access the objective credentials of a task. The caller must hold the RCU 279 * Access the objective credentials of a task. The caller must hold the RCU
280 * readlock or the task must be dead and unable to change its own credentials. 280 * readlock.
281 * 281 *
282 * The result of this function should not be passed directly to get_cred(); 282 * The result of this function should not be passed directly to get_cred();
283 * rather get_task_cred() should be used instead. 283 * rather get_task_cred() should be used instead.
284 */ 284 */
285#define __task_cred(task) \ 285#define __task_cred(task) \
286 ({ \ 286 rcu_dereference((task)->real_cred)
287 const struct task_struct *__t = (task); \
288 rcu_dereference_check(__t->real_cred, \
289 task_is_dead(__t)); \
290 })
291 287
292/** 288/**
293 * get_current_cred - Get the current task's subjective credentials 289 * get_current_cred - Get the current task's subjective credentials
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index d3fec584e8c3..56377df39124 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -635,6 +635,18 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
635 dir, flags, NULL); 635 dir, flags, NULL);
636} 636}
637 637
638#ifdef CONFIG_RAPIDIO_DMA_ENGINE
639struct rio_dma_ext;
640static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg(
641 struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
642 enum dma_transfer_direction dir, unsigned long flags,
643 struct rio_dma_ext *rio_ext)
644{
645 return chan->device->device_prep_slave_sg(chan, sgl, sg_len,
646 dir, flags, rio_ext);
647}
648#endif
649
638static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic( 650static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
639 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 651 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
640 size_t period_len, enum dma_transfer_direction dir) 652 size_t period_len, enum dma_transfer_direction dir)
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 91bb4f27238c..3c3ef19a625a 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -34,7 +34,7 @@ void eventfd_ctx_put(struct eventfd_ctx *ctx);
34struct file *eventfd_fget(int fd); 34struct file *eventfd_fget(int fd);
35struct eventfd_ctx *eventfd_ctx_fdget(int fd); 35struct eventfd_ctx *eventfd_ctx_fdget(int fd);
36struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); 36struct eventfd_ctx *eventfd_ctx_fileget(struct file *file);
37int eventfd_signal(struct eventfd_ctx *ctx, int n); 37__u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n);
38ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt); 38ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt);
39int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, 39int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait,
40 __u64 *cnt); 40 __u64 *cnt);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 598a5892ff2b..40887afaaca7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -173,6 +173,15 @@ struct inodes_stat_t {
173#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA) 173#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
174#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) 174#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
175 175
176
177/*
178 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
179 * that indicates that they should check the contents of the iovec are
180 * valid, but not check the memory that the iovec elements
181 * points too.
182 */
183#define CHECK_IOVEC_ONLY -1
184
176#define SEL_IN 1 185#define SEL_IN 1
177#define SEL_OUT 2 186#define SEL_OUT 2
178#define SEL_EX 4 187#define SEL_EX 4
@@ -1690,8 +1699,7 @@ struct seq_file;
1690ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1699ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1691 unsigned long nr_segs, unsigned long fast_segs, 1700 unsigned long nr_segs, unsigned long fast_segs,
1692 struct iovec *fast_pointer, 1701 struct iovec *fast_pointer,
1693 struct iovec **ret_pointer, 1702 struct iovec **ret_pointer);
1694 int check_access);
1695 1703
1696extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); 1704extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
1697extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); 1705extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 8a297a5e794c..5499c92a9153 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -62,6 +62,8 @@ struct ipc_namespace {
62 unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */ 62 unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */
63 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ 63 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */
64 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ 64 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */
65 unsigned int mq_msg_default;
66 unsigned int mq_msgsize_default;
65 67
66 /* user_ns which owns the ipc ns */ 68 /* user_ns which owns the ipc ns */
67 struct user_namespace *user_ns; 69 struct user_namespace *user_ns;
@@ -90,11 +92,41 @@ static inline void shm_destroy_orphaned(struct ipc_namespace *ns) {}
90 92
91#ifdef CONFIG_POSIX_MQUEUE 93#ifdef CONFIG_POSIX_MQUEUE
92extern int mq_init_ns(struct ipc_namespace *ns); 94extern int mq_init_ns(struct ipc_namespace *ns);
93/* default values */ 95/*
94#define DFLT_QUEUESMAX 256 /* max number of message queues */ 96 * POSIX Message Queue default values:
95#define DFLT_MSGMAX 10 /* max number of messages in each queue */ 97 *
96#define HARD_MSGMAX (32768*sizeof(void *)/4) 98 * MIN_*: Lowest value an admin can set the maximum unprivileged limit to
97#define DFLT_MSGSIZEMAX 8192 /* max message size */ 99 * DFLT_*MAX: Default values for the maximum unprivileged limits
100 * DFLT_{MSG,MSGSIZE}: Default values used when the user doesn't supply
101 * an attribute to the open call and the queue must be created
102 * HARD_*: Highest value the maximums can be set to. These are enforced
103 * on CAP_SYS_RESOURCE apps as well making them inviolate (so make them
104 * suitably high)
105 *
106 * POSIX Requirements:
107 * Per app minimum openable message queues - 8. This does not map well
108 * to the fact that we limit the number of queues on a per namespace
109 * basis instead of a per app basis. So, make the default high enough
110 * that no given app should have a hard time opening 8 queues.
111 * Minimum maximum for HARD_MSGMAX - 32767. I bumped this to 65536.
112 * Minimum maximum for HARD_MSGSIZEMAX - POSIX is silent on this. However,
113 * we have run into a situation where running applications in the wild
114 * require this to be at least 5MB, and preferably 10MB, so I set the
115 * value to 16MB in hopes that this user is the worst of the bunch and
116 * the new maximum will handle anyone else. I may have to revisit this
117 * in the future.
118 */
119#define MIN_QUEUESMAX 1
120#define DFLT_QUEUESMAX 256
121#define HARD_QUEUESMAX 1024
122#define MIN_MSGMAX 1
123#define DFLT_MSG 10U
124#define DFLT_MSGMAX 10
125#define HARD_MSGMAX 65536
126#define MIN_MSGSIZEMAX 128
127#define DFLT_MSGSIZE 8192U
128#define DFLT_MSGSIZEMAX 8192
129#define HARD_MSGSIZEMAX (16*1024*1024)
98#else 130#else
99static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } 131static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
100#endif 132#endif
diff --git a/include/linux/kcmp.h b/include/linux/kcmp.h
new file mode 100644
index 000000000000..2dcd1b3aafc8
--- /dev/null
+++ b/include/linux/kcmp.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_KCMP_H
2#define _LINUX_KCMP_H
3
4/* Comparison type */
5enum kcmp_type {
6 KCMP_FILE,
7 KCMP_VM,
8 KCMP_FILES,
9 KCMP_FS,
10 KCMP_SIGHAND,
11 KCMP_IO,
12 KCMP_SYSVSEM,
13
14 KCMP_TYPES,
15};
16
17#endif /* _LINUX_KCMP_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ec55a3c8ba77..e07f5e0c5df4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -35,6 +35,7 @@
35#define LLONG_MAX ((long long)(~0ULL>>1)) 35#define LLONG_MAX ((long long)(~0ULL>>1))
36#define LLONG_MIN (-LLONG_MAX - 1) 36#define LLONG_MIN (-LLONG_MAX - 1)
37#define ULLONG_MAX (~0ULL) 37#define ULLONG_MAX (~0ULL)
38#define SIZE_MAX (~(size_t)0)
38 39
39#define STACK_MAGIC 0xdeadbeef 40#define STACK_MAGIC 0xdeadbeef
40 41
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 0d7d6a1b172f..37c5f7261142 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -1,8 +1,58 @@
1#ifndef LINUX_KEXEC_H 1#ifndef LINUX_KEXEC_H
2#define LINUX_KEXEC_H 2#define LINUX_KEXEC_H
3 3
4#ifdef CONFIG_KEXEC 4/* kexec system call - It loads the new kernel to boot into.
5 * kexec does not sync, or unmount filesystems so if you need
6 * that to happen you need to do that yourself.
7 */
8
5#include <linux/types.h> 9#include <linux/types.h>
10
11/* kexec flags for different usage scenarios */
12#define KEXEC_ON_CRASH 0x00000001
13#define KEXEC_PRESERVE_CONTEXT 0x00000002
14#define KEXEC_ARCH_MASK 0xffff0000
15
16/* These values match the ELF architecture values.
17 * Unless there is a good reason that should continue to be the case.
18 */
19#define KEXEC_ARCH_DEFAULT ( 0 << 16)
20#define KEXEC_ARCH_386 ( 3 << 16)
21#define KEXEC_ARCH_X86_64 (62 << 16)
22#define KEXEC_ARCH_PPC (20 << 16)
23#define KEXEC_ARCH_PPC64 (21 << 16)
24#define KEXEC_ARCH_IA_64 (50 << 16)
25#define KEXEC_ARCH_ARM (40 << 16)
26#define KEXEC_ARCH_S390 (22 << 16)
27#define KEXEC_ARCH_SH (42 << 16)
28#define KEXEC_ARCH_MIPS_LE (10 << 16)
29#define KEXEC_ARCH_MIPS ( 8 << 16)
30
31/* The artificial cap on the number of segments passed to kexec_load. */
32#define KEXEC_SEGMENT_MAX 16
33
34#ifndef __KERNEL__
35/*
36 * This structure is used to hold the arguments that are used when
37 * loading kernel binaries.
38 */
39struct kexec_segment {
40 const void *buf;
41 size_t bufsz;
42 const void *mem;
43 size_t memsz;
44};
45
46/* Load a new kernel image as described by the kexec_segment array
47 * consisting of passed number of segments at the entry-point address.
48 * The flags allow different useage types.
49 */
50extern int kexec_load(void *, size_t, struct kexec_segment *,
51 unsigned long int);
52#endif /* __KERNEL__ */
53
54#ifdef __KERNEL__
55#ifdef CONFIG_KEXEC
6#include <linux/list.h> 56#include <linux/list.h>
7#include <linux/linkage.h> 57#include <linux/linkage.h>
8#include <linux/compat.h> 58#include <linux/compat.h>
@@ -67,11 +117,10 @@ typedef unsigned long kimage_entry_t;
67#define IND_DONE 0x4 117#define IND_DONE 0x4
68#define IND_SOURCE 0x8 118#define IND_SOURCE 0x8
69 119
70#define KEXEC_SEGMENT_MAX 16
71struct kexec_segment { 120struct kexec_segment {
72 void __user *buf; 121 void __user *buf;
73 size_t bufsz; 122 size_t bufsz;
74 unsigned long mem; /* User space sees this as a (void *) ... */ 123 unsigned long mem;
75 size_t memsz; 124 size_t memsz;
76}; 125};
77 126
@@ -175,25 +224,6 @@ extern struct kimage *kexec_crash_image;
175#define kexec_flush_icache_page(page) 224#define kexec_flush_icache_page(page)
176#endif 225#endif
177 226
178#define KEXEC_ON_CRASH 0x00000001
179#define KEXEC_PRESERVE_CONTEXT 0x00000002
180#define KEXEC_ARCH_MASK 0xffff0000
181
182/* These values match the ELF architecture values.
183 * Unless there is a good reason that should continue to be the case.
184 */
185#define KEXEC_ARCH_DEFAULT ( 0 << 16)
186#define KEXEC_ARCH_386 ( 3 << 16)
187#define KEXEC_ARCH_X86_64 (62 << 16)
188#define KEXEC_ARCH_PPC (20 << 16)
189#define KEXEC_ARCH_PPC64 (21 << 16)
190#define KEXEC_ARCH_IA_64 (50 << 16)
191#define KEXEC_ARCH_ARM (40 << 16)
192#define KEXEC_ARCH_S390 (22 << 16)
193#define KEXEC_ARCH_SH (42 << 16)
194#define KEXEC_ARCH_MIPS_LE (10 << 16)
195#define KEXEC_ARCH_MIPS ( 8 << 16)
196
197/* List of defined/legal kexec flags */ 227/* List of defined/legal kexec flags */
198#ifndef CONFIG_KEXEC_JUMP 228#ifndef CONFIG_KEXEC_JUMP
199#define KEXEC_FLAGS KEXEC_ON_CRASH 229#define KEXEC_FLAGS KEXEC_ON_CRASH
@@ -228,4 +258,5 @@ struct task_struct;
228static inline void crash_kexec(struct pt_regs *regs) { } 258static inline void crash_kexec(struct pt_regs *regs) { }
229static inline int kexec_should_crash(struct task_struct *p) { return 0; } 259static inline int kexec_should_crash(struct task_struct *p) { return 0; }
230#endif /* CONFIG_KEXEC */ 260#endif /* CONFIG_KEXEC */
261#endif /* __KERNEL__ */
231#endif /* LINUX_KEXEC_H */ 262#endif /* LINUX_KEXEC_H */
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index dd99c329e161..5398d5807075 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -66,40 +66,10 @@ struct subprocess_info {
66 void *data; 66 void *data;
67}; 67};
68 68
69/* Allocate a subprocess_info structure */ 69extern int
70struct subprocess_info *call_usermodehelper_setup(char *path, char **argv,
71 char **envp, gfp_t gfp_mask);
72
73/* Set various pieces of state into the subprocess_info structure */
74void call_usermodehelper_setfns(struct subprocess_info *info,
75 int (*init)(struct subprocess_info *info, struct cred *new),
76 void (*cleanup)(struct subprocess_info *info),
77 void *data);
78
79/* Actually execute the sub-process */
80int call_usermodehelper_exec(struct subprocess_info *info, int wait);
81
82/* Free the subprocess_info. This is only needed if you're not going
83 to call call_usermodehelper_exec */
84void call_usermodehelper_freeinfo(struct subprocess_info *info);
85
86static inline int
87call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, 70call_usermodehelper_fns(char *path, char **argv, char **envp, int wait,
88 int (*init)(struct subprocess_info *info, struct cred *new), 71 int (*init)(struct subprocess_info *info, struct cred *new),
89 void (*cleanup)(struct subprocess_info *), void *data) 72 void (*cleanup)(struct subprocess_info *), void *data);
90{
91 struct subprocess_info *info;
92 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
93
94 info = call_usermodehelper_setup(path, argv, envp, gfp_mask);
95
96 if (info == NULL)
97 return -ENOMEM;
98
99 call_usermodehelper_setfns(info, init, cleanup, data);
100
101 return call_usermodehelper_exec(info, wait);
102}
103 73
104static inline int 74static inline int
105call_usermodehelper(char *path, char **argv, char **envp, int wait) 75call_usermodehelper(char *path, char **argv, char **envp, int wait)
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 34066e65fdeb..11cc2ac67e75 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -21,8 +21,9 @@
21#define CT_LE_W(v) cpu_to_le16(v) 21#define CT_LE_W(v) cpu_to_le16(v)
22#define CT_LE_L(v) cpu_to_le32(v) 22#define CT_LE_L(v) cpu_to_le32(v)
23 23
24#define MSDOS_ROOT_INO 1 /* The root inode number */
25#define MSDOS_FSINFO_INO 2 /* Used for managing the FSINFO block */
24 26
25#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */
26#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ 27#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
27 28
28/* directory limit */ 29/* directory limit */
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 78b76e24cc7e..711e0a30aacc 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -113,6 +113,12 @@
113# define PR_SET_MM_START_STACK 5 113# define PR_SET_MM_START_STACK 5
114# define PR_SET_MM_START_BRK 6 114# define PR_SET_MM_START_BRK 6
115# define PR_SET_MM_BRK 7 115# define PR_SET_MM_BRK 7
116# define PR_SET_MM_ARG_START 8
117# define PR_SET_MM_ARG_END 9
118# define PR_SET_MM_ENV_START 10
119# define PR_SET_MM_ENV_END 11
120# define PR_SET_MM_AUXV 12
121# define PR_SET_MM_EXE_FILE 13
116 122
117/* 123/*
118 * Set specific pid that is allowed to ptrace the current task. 124 * Set specific pid that is allowed to ptrace the current task.
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 4d50611112ba..a90ebadd9da0 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -20,6 +20,9 @@
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/rio_regs.h> 22#include <linux/rio_regs.h>
23#ifdef CONFIG_RAPIDIO_DMA_ENGINE
24#include <linux/dmaengine.h>
25#endif
23 26
24#define RIO_NO_HOPCOUNT -1 27#define RIO_NO_HOPCOUNT -1
25#define RIO_INVALID_DESTID 0xffff 28#define RIO_INVALID_DESTID 0xffff
@@ -254,6 +257,9 @@ struct rio_mport {
254 u32 phys_efptr; 257 u32 phys_efptr;
255 unsigned char name[40]; 258 unsigned char name[40];
256 void *priv; /* Master port private data */ 259 void *priv; /* Master port private data */
260#ifdef CONFIG_RAPIDIO_DMA_ENGINE
261 struct dma_device dma;
262#endif
257}; 263};
258 264
259/** 265/**
@@ -395,6 +401,47 @@ union rio_pw_msg {
395 u32 raw[RIO_PW_MSG_SIZE/sizeof(u32)]; 401 u32 raw[RIO_PW_MSG_SIZE/sizeof(u32)];
396}; 402};
397 403
404#ifdef CONFIG_RAPIDIO_DMA_ENGINE
405
406/**
407 * enum rio_write_type - RIO write transaction types used in DMA transfers
408 *
409 * Note: RapidIO specification defines write (NWRITE) and
410 * write-with-response (NWRITE_R) data transfer operations.
411 * Existing DMA controllers that service RapidIO may use one of these operations
412 * for entire data transfer or their combination with only the last data packet
413 * requires response.
414 */
415enum rio_write_type {
416 RDW_DEFAULT, /* default method used by DMA driver */
417 RDW_ALL_NWRITE, /* all packets use NWRITE */
418 RDW_ALL_NWRITE_R, /* all packets use NWRITE_R */
419 RDW_LAST_NWRITE_R, /* last packet uses NWRITE_R, others - NWRITE */
420};
421
422struct rio_dma_ext {
423 u16 destid;
424 u64 rio_addr; /* low 64-bits of 66-bit RapidIO address */
425 u8 rio_addr_u; /* upper 2-bits of 66-bit RapidIO address */
426 enum rio_write_type wr_type; /* preferred RIO write operation type */
427};
428
429struct rio_dma_data {
430 /* Local data (as scatterlist) */
431 struct scatterlist *sg; /* I/O scatter list */
432 unsigned int sg_len; /* size of scatter list */
433 /* Remote device address (flat buffer) */
434 u64 rio_addr; /* low 64-bits of 66-bit RapidIO address */
435 u8 rio_addr_u; /* upper 2-bits of 66-bit RapidIO address */
436 enum rio_write_type wr_type; /* preferred RIO write operation type */
437};
438
439static inline struct rio_mport *dma_to_mport(struct dma_device *ddev)
440{
441 return container_of(ddev, struct rio_mport, dma);
442}
443#endif /* CONFIG_RAPIDIO_DMA_ENGINE */
444
398/* Architecture and hardware-specific functions */ 445/* Architecture and hardware-specific functions */
399extern int rio_register_mport(struct rio_mport *); 446extern int rio_register_mport(struct rio_mport *);
400extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 447extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 7f07470e1ed9..31ad146be316 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -377,6 +377,15 @@ void rio_unregister_driver(struct rio_driver *);
377struct rio_dev *rio_dev_get(struct rio_dev *); 377struct rio_dev *rio_dev_get(struct rio_dev *);
378void rio_dev_put(struct rio_dev *); 378void rio_dev_put(struct rio_dev *);
379 379
380#ifdef CONFIG_RAPIDIO_DMA_ENGINE
381extern struct dma_chan *rio_request_dma(struct rio_dev *rdev);
382extern void rio_release_dma(struct dma_chan *dchan);
383extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(
384 struct rio_dev *rdev, struct dma_chan *dchan,
385 struct rio_dma_data *data,
386 enum dma_transfer_direction direction, unsigned long flags);
387#endif
388
380/** 389/**
381 * rio_name - Get the unique RIO device identifier 390 * rio_name - Get the unique RIO device identifier
382 * @rdev: RIO device 391 * @rdev: RIO device
diff --git a/include/linux/slab.h b/include/linux/slab.h
index a595dce6b0c7..67d5d94b783a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -242,7 +242,7 @@ size_t ksize(const void *);
242 */ 242 */
243static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) 243static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
244{ 244{
245 if (size != 0 && n > ULONG_MAX / size) 245 if (size != 0 && n > SIZE_MAX / size)
246 return NULL; 246 return NULL;
247 return __kmalloc(n * size, flags); 247 return __kmalloc(n * size, flags);
248} 248}
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 3de3acb84a95..19439c75c5b2 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -858,4 +858,6 @@ asmlinkage long sys_process_vm_writev(pid_t pid,
858 unsigned long riovcnt, 858 unsigned long riovcnt,
859 unsigned long flags); 859 unsigned long flags);
860 860
861asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
862 unsigned long idx1, unsigned long idx2);
861#endif 863#endif