aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/crypto/hash_info.h40
-rw-r--r--include/crypto/public_key.h25
-rw-r--r--include/keys/big_key-type.h25
-rw-r--r--include/keys/keyring-type.h17
-rw-r--r--include/keys/system_keyring.h23
-rw-r--r--include/linux/assoc_array.h92
-rw-r--r--include/linux/assoc_array_priv.h182
-rw-r--r--include/linux/audit.h15
-rw-r--r--include/linux/hugetlb.h10
-rw-r--r--include/linux/key-type.h6
-rw-r--r--include/linux/key.h52
-rw-r--r--include/linux/mm_types.h30
-rw-r--r--include/linux/msi.h10
-rw-r--r--include/linux/net.h8
-rw-r--r--include/linux/pci.h55
-rw-r--r--include/linux/pci_hotplug.h5
-rw-r--r--include/linux/pcieport_if.h2
-rw-r--r--include/linux/phy.h1
-rw-r--r--include/linux/security.h26
-rw-r--r--include/linux/slab.h9
-rw-r--r--include/linux/slab_def.h4
-rw-r--r--include/linux/slub_def.h2
-rw-r--r--include/linux/user_namespace.h6
-rw-r--r--include/net/genetlink.h8
-rw-r--r--include/target/target_core_backend.h5
-rw-r--r--include/target/target_core_base.h84
-rw-r--r--include/target/target_core_configfs.h1
-rw-r--r--include/target/target_core_fabric.h2
-rw-r--r--include/trace/events/btrfs.h4
-rw-r--r--include/uapi/linux/audit.h26
-rw-r--r--include/uapi/linux/hash_info.h37
-rw-r--r--include/uapi/linux/keyctl.h1
-rw-r--r--include/uapi/linux/pci_regs.h72
33 files changed, 683 insertions, 202 deletions
diff --git a/include/crypto/hash_info.h b/include/crypto/hash_info.h
new file mode 100644
index 000000000000..e1e5a3e5dd1b
--- /dev/null
+++ b/include/crypto/hash_info.h
@@ -0,0 +1,40 @@
1/*
2 * Hash Info: Hash algorithms information
3 *
4 * Copyright (c) 2013 Dmitry Kasatkin <d.kasatkin@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12
13#ifndef _CRYPTO_HASH_INFO_H
14#define _CRYPTO_HASH_INFO_H
15
16#include <crypto/sha.h>
17#include <crypto/md5.h>
18
19#include <uapi/linux/hash_info.h>
20
21/* not defined in include/crypto/ */
22#define RMD128_DIGEST_SIZE 16
23#define RMD160_DIGEST_SIZE 20
24#define RMD256_DIGEST_SIZE 32
25#define RMD320_DIGEST_SIZE 40
26
27/* not defined in include/crypto/ */
28#define WP512_DIGEST_SIZE 64
29#define WP384_DIGEST_SIZE 48
30#define WP256_DIGEST_SIZE 32
31
32/* not defined in include/crypto/ */
33#define TGR128_DIGEST_SIZE 16
34#define TGR160_DIGEST_SIZE 20
35#define TGR192_DIGEST_SIZE 24
36
37extern const char *const hash_algo_name[HASH_ALGO__LAST];
38extern const int hash_digest_size[HASH_ALGO__LAST];
39
40#endif /* _CRYPTO_HASH_INFO_H */
diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
index f5b0224c9967..fc09732613ad 100644
--- a/include/crypto/public_key.h
+++ b/include/crypto/public_key.h
@@ -15,6 +15,7 @@
15#define _LINUX_PUBLIC_KEY_H 15#define _LINUX_PUBLIC_KEY_H
16 16
17#include <linux/mpi.h> 17#include <linux/mpi.h>
18#include <crypto/hash_info.h>
18 19
19enum pkey_algo { 20enum pkey_algo {
20 PKEY_ALGO_DSA, 21 PKEY_ALGO_DSA,
@@ -22,21 +23,11 @@ enum pkey_algo {
22 PKEY_ALGO__LAST 23 PKEY_ALGO__LAST
23}; 24};
24 25
25extern const char *const pkey_algo[PKEY_ALGO__LAST]; 26extern const char *const pkey_algo_name[PKEY_ALGO__LAST];
27extern const struct public_key_algorithm *pkey_algo[PKEY_ALGO__LAST];
26 28
27enum pkey_hash_algo { 29/* asymmetric key implementation supports only up to SHA224 */
28 PKEY_HASH_MD4, 30#define PKEY_HASH__LAST (HASH_ALGO_SHA224 + 1)
29 PKEY_HASH_MD5,
30 PKEY_HASH_SHA1,
31 PKEY_HASH_RIPE_MD_160,
32 PKEY_HASH_SHA256,
33 PKEY_HASH_SHA384,
34 PKEY_HASH_SHA512,
35 PKEY_HASH_SHA224,
36 PKEY_HASH__LAST
37};
38
39extern const char *const pkey_hash_algo[PKEY_HASH__LAST];
40 31
41enum pkey_id_type { 32enum pkey_id_type {
42 PKEY_ID_PGP, /* OpenPGP generated key ID */ 33 PKEY_ID_PGP, /* OpenPGP generated key ID */
@@ -44,7 +35,7 @@ enum pkey_id_type {
44 PKEY_ID_TYPE__LAST 35 PKEY_ID_TYPE__LAST
45}; 36};
46 37
47extern const char *const pkey_id_type[PKEY_ID_TYPE__LAST]; 38extern const char *const pkey_id_type_name[PKEY_ID_TYPE__LAST];
48 39
49/* 40/*
50 * Cryptographic data for the public-key subtype of the asymmetric key type. 41 * Cryptographic data for the public-key subtype of the asymmetric key type.
@@ -59,6 +50,7 @@ struct public_key {
59#define PKEY_CAN_DECRYPT 0x02 50#define PKEY_CAN_DECRYPT 0x02
60#define PKEY_CAN_SIGN 0x04 51#define PKEY_CAN_SIGN 0x04
61#define PKEY_CAN_VERIFY 0x08 52#define PKEY_CAN_VERIFY 0x08
53 enum pkey_algo pkey_algo : 8;
62 enum pkey_id_type id_type : 8; 54 enum pkey_id_type id_type : 8;
63 union { 55 union {
64 MPI mpi[5]; 56 MPI mpi[5];
@@ -88,7 +80,8 @@ struct public_key_signature {
88 u8 *digest; 80 u8 *digest;
89 u8 digest_size; /* Number of bytes in digest */ 81 u8 digest_size; /* Number of bytes in digest */
90 u8 nr_mpi; /* Occupancy of mpi[] */ 82 u8 nr_mpi; /* Occupancy of mpi[] */
91 enum pkey_hash_algo pkey_hash_algo : 8; 83 enum pkey_algo pkey_algo : 8;
84 enum hash_algo pkey_hash_algo : 8;
92 union { 85 union {
93 MPI mpi[2]; 86 MPI mpi[2];
94 struct { 87 struct {
diff --git a/include/keys/big_key-type.h b/include/keys/big_key-type.h
new file mode 100644
index 000000000000..d69bc8af3292
--- /dev/null
+++ b/include/keys/big_key-type.h
@@ -0,0 +1,25 @@
1/* Big capacity key type.
2 *
3 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_BIG_KEY_TYPE_H
13#define _KEYS_BIG_KEY_TYPE_H
14
15#include <linux/key-type.h>
16
17extern struct key_type key_type_big_key;
18
19extern int big_key_instantiate(struct key *key, struct key_preparsed_payload *prep);
20extern void big_key_revoke(struct key *key);
21extern void big_key_destroy(struct key *key);
22extern void big_key_describe(const struct key *big_key, struct seq_file *m);
23extern long big_key_read(const struct key *key, char __user *buffer, size_t buflen);
24
25#endif /* _KEYS_BIG_KEY_TYPE_H */
diff --git a/include/keys/keyring-type.h b/include/keys/keyring-type.h
index cf49159b0e3a..fca5c62340a4 100644
--- a/include/keys/keyring-type.h
+++ b/include/keys/keyring-type.h
@@ -1,6 +1,6 @@
1/* Keyring key type 1/* Keyring key type
2 * 2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2008, 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -13,19 +13,6 @@
13#define _KEYS_KEYRING_TYPE_H 13#define _KEYS_KEYRING_TYPE_H
14 14
15#include <linux/key.h> 15#include <linux/key.h>
16#include <linux/rcupdate.h> 16#include <linux/assoc_array.h>
17
18/*
19 * the keyring payload contains a list of the keys to which the keyring is
20 * subscribed
21 */
22struct keyring_list {
23 struct rcu_head rcu; /* RCU deletion hook */
24 unsigned short maxkeys; /* max keys this list can hold */
25 unsigned short nkeys; /* number of keys currently held */
26 unsigned short delkey; /* key to be unlinked by RCU */
27 struct key __rcu *keys[0];
28};
29
30 17
31#endif /* _KEYS_KEYRING_TYPE_H */ 18#endif /* _KEYS_KEYRING_TYPE_H */
diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
new file mode 100644
index 000000000000..8dabc399bd1d
--- /dev/null
+++ b/include/keys/system_keyring.h
@@ -0,0 +1,23 @@
1/* System keyring containing trusted public keys.
2 *
3 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_SYSTEM_KEYRING_H
13#define _KEYS_SYSTEM_KEYRING_H
14
15#ifdef CONFIG_SYSTEM_TRUSTED_KEYRING
16
17#include <linux/key.h>
18
19extern struct key *system_trusted_keyring;
20
21#endif
22
23#endif /* _KEYS_SYSTEM_KEYRING_H */
diff --git a/include/linux/assoc_array.h b/include/linux/assoc_array.h
new file mode 100644
index 000000000000..9a193b84238a
--- /dev/null
+++ b/include/linux/assoc_array.h
@@ -0,0 +1,92 @@
1/* Generic associative array implementation.
2 *
3 * See Documentation/assoc_array.txt for information.
4 *
5 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
12 */
13
14#ifndef _LINUX_ASSOC_ARRAY_H
15#define _LINUX_ASSOC_ARRAY_H
16
17#ifdef CONFIG_ASSOCIATIVE_ARRAY
18
19#include <linux/types.h>
20
21#define ASSOC_ARRAY_KEY_CHUNK_SIZE BITS_PER_LONG /* Key data retrieved in chunks of this size */
22
23/*
24 * Generic associative array.
25 */
26struct assoc_array {
27 struct assoc_array_ptr *root; /* The node at the root of the tree */
28 unsigned long nr_leaves_on_tree;
29};
30
31/*
32 * Operations on objects and index keys for use by array manipulation routines.
33 */
34struct assoc_array_ops {
35 /* Method to get a chunk of an index key from caller-supplied data */
36 unsigned long (*get_key_chunk)(const void *index_key, int level);
37
38 /* Method to get a piece of an object's index key */
39 unsigned long (*get_object_key_chunk)(const void *object, int level);
40
41 /* Is this the object we're looking for? */
42 bool (*compare_object)(const void *object, const void *index_key);
43
44 /* How different are two objects, to a bit position in their keys? (or
45 * -1 if they're the same)
46 */
47 int (*diff_objects)(const void *a, const void *b);
48
49 /* Method to free an object. */
50 void (*free_object)(void *object);
51};
52
53/*
54 * Access and manipulation functions.
55 */
56struct assoc_array_edit;
57
58static inline void assoc_array_init(struct assoc_array *array)
59{
60 array->root = NULL;
61 array->nr_leaves_on_tree = 0;
62}
63
64extern int assoc_array_iterate(const struct assoc_array *array,
65 int (*iterator)(const void *object,
66 void *iterator_data),
67 void *iterator_data);
68extern void *assoc_array_find(const struct assoc_array *array,
69 const struct assoc_array_ops *ops,
70 const void *index_key);
71extern void assoc_array_destroy(struct assoc_array *array,
72 const struct assoc_array_ops *ops);
73extern struct assoc_array_edit *assoc_array_insert(struct assoc_array *array,
74 const struct assoc_array_ops *ops,
75 const void *index_key,
76 void *object);
77extern void assoc_array_insert_set_object(struct assoc_array_edit *edit,
78 void *object);
79extern struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
80 const struct assoc_array_ops *ops,
81 const void *index_key);
82extern struct assoc_array_edit *assoc_array_clear(struct assoc_array *array,
83 const struct assoc_array_ops *ops);
84extern void assoc_array_apply_edit(struct assoc_array_edit *edit);
85extern void assoc_array_cancel_edit(struct assoc_array_edit *edit);
86extern int assoc_array_gc(struct assoc_array *array,
87 const struct assoc_array_ops *ops,
88 bool (*iterator)(void *object, void *iterator_data),
89 void *iterator_data);
90
91#endif /* CONFIG_ASSOCIATIVE_ARRAY */
92#endif /* _LINUX_ASSOC_ARRAY_H */
diff --git a/include/linux/assoc_array_priv.h b/include/linux/assoc_array_priv.h
new file mode 100644
index 000000000000..711275e6681c
--- /dev/null
+++ b/include/linux/assoc_array_priv.h
@@ -0,0 +1,182 @@
1/* Private definitions for the generic associative array implementation.
2 *
3 * See Documentation/assoc_array.txt for information.
4 *
5 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
12 */
13
14#ifndef _LINUX_ASSOC_ARRAY_PRIV_H
15#define _LINUX_ASSOC_ARRAY_PRIV_H
16
17#ifdef CONFIG_ASSOCIATIVE_ARRAY
18
19#include <linux/assoc_array.h>
20
21#define ASSOC_ARRAY_FAN_OUT 16 /* Number of slots per node */
22#define ASSOC_ARRAY_FAN_MASK (ASSOC_ARRAY_FAN_OUT - 1)
23#define ASSOC_ARRAY_LEVEL_STEP (ilog2(ASSOC_ARRAY_FAN_OUT))
24#define ASSOC_ARRAY_LEVEL_STEP_MASK (ASSOC_ARRAY_LEVEL_STEP - 1)
25#define ASSOC_ARRAY_KEY_CHUNK_MASK (ASSOC_ARRAY_KEY_CHUNK_SIZE - 1)
26#define ASSOC_ARRAY_KEY_CHUNK_SHIFT (ilog2(BITS_PER_LONG))
27
28/*
29 * Undefined type representing a pointer with type information in the bottom
30 * two bits.
31 */
32struct assoc_array_ptr;
33
34/*
35 * An N-way node in the tree.
36 *
37 * Each slot contains one of four things:
38 *
39 * (1) Nothing (NULL).
40 *
41 * (2) A leaf object (pointer types 0).
42 *
43 * (3) A next-level node (pointer type 1, subtype 0).
44 *
45 * (4) A shortcut (pointer type 1, subtype 1).
46 *
47 * The tree is optimised for search-by-ID, but permits reasonable iteration
48 * also.
49 *
50 * The tree is navigated by constructing an index key consisting of an array of
51 * segments, where each segment is ilog2(ASSOC_ARRAY_FAN_OUT) bits in size.
52 *
53 * The segments correspond to levels of the tree (the first segment is used at
54 * level 0, the second at level 1, etc.).
55 */
56struct assoc_array_node {
57 struct assoc_array_ptr *back_pointer;
58 u8 parent_slot;
59 struct assoc_array_ptr *slots[ASSOC_ARRAY_FAN_OUT];
60 unsigned long nr_leaves_on_branch;
61};
62
63/*
64 * A shortcut through the index space out to where a collection of nodes/leaves
65 * with the same IDs live.
66 */
67struct assoc_array_shortcut {
68 struct assoc_array_ptr *back_pointer;
69 int parent_slot;
70 int skip_to_level;
71 struct assoc_array_ptr *next_node;
72 unsigned long index_key[];
73};
74
75/*
76 * Preallocation cache.
77 */
78struct assoc_array_edit {
79 struct rcu_head rcu;
80 struct assoc_array *array;
81 const struct assoc_array_ops *ops;
82 const struct assoc_array_ops *ops_for_excised_subtree;
83 struct assoc_array_ptr *leaf;
84 struct assoc_array_ptr **leaf_p;
85 struct assoc_array_ptr *dead_leaf;
86 struct assoc_array_ptr *new_meta[3];
87 struct assoc_array_ptr *excised_meta[1];
88 struct assoc_array_ptr *excised_subtree;
89 struct assoc_array_ptr **set_backpointers[ASSOC_ARRAY_FAN_OUT];
90 struct assoc_array_ptr *set_backpointers_to;
91 struct assoc_array_node *adjust_count_on;
92 long adjust_count_by;
93 struct {
94 struct assoc_array_ptr **ptr;
95 struct assoc_array_ptr *to;
96 } set[2];
97 struct {
98 u8 *p;
99 u8 to;
100 } set_parent_slot[1];
101 u8 segment_cache[ASSOC_ARRAY_FAN_OUT + 1];
102};
103
104/*
105 * Internal tree member pointers are marked in the bottom one or two bits to
106 * indicate what type they are so that we don't have to look behind every
107 * pointer to see what it points to.
108 *
109 * We provide functions to test type annotations and to create and translate
110 * the annotated pointers.
111 */
112#define ASSOC_ARRAY_PTR_TYPE_MASK 0x1UL
113#define ASSOC_ARRAY_PTR_LEAF_TYPE 0x0UL /* Points to leaf (or nowhere) */
114#define ASSOC_ARRAY_PTR_META_TYPE 0x1UL /* Points to node or shortcut */
115#define ASSOC_ARRAY_PTR_SUBTYPE_MASK 0x2UL
116#define ASSOC_ARRAY_PTR_NODE_SUBTYPE 0x0UL
117#define ASSOC_ARRAY_PTR_SHORTCUT_SUBTYPE 0x2UL
118
119static inline bool assoc_array_ptr_is_meta(const struct assoc_array_ptr *x)
120{
121 return (unsigned long)x & ASSOC_ARRAY_PTR_TYPE_MASK;
122}
123static inline bool assoc_array_ptr_is_leaf(const struct assoc_array_ptr *x)
124{
125 return !assoc_array_ptr_is_meta(x);
126}
127static inline bool assoc_array_ptr_is_shortcut(const struct assoc_array_ptr *x)
128{
129 return (unsigned long)x & ASSOC_ARRAY_PTR_SUBTYPE_MASK;
130}
131static inline bool assoc_array_ptr_is_node(const struct assoc_array_ptr *x)
132{
133 return !assoc_array_ptr_is_shortcut(x);
134}
135
136static inline void *assoc_array_ptr_to_leaf(const struct assoc_array_ptr *x)
137{
138 return (void *)((unsigned long)x & ~ASSOC_ARRAY_PTR_TYPE_MASK);
139}
140
141static inline
142unsigned long __assoc_array_ptr_to_meta(const struct assoc_array_ptr *x)
143{
144 return (unsigned long)x &
145 ~(ASSOC_ARRAY_PTR_SUBTYPE_MASK | ASSOC_ARRAY_PTR_TYPE_MASK);
146}
147static inline
148struct assoc_array_node *assoc_array_ptr_to_node(const struct assoc_array_ptr *x)
149{
150 return (struct assoc_array_node *)__assoc_array_ptr_to_meta(x);
151}
152static inline
153struct assoc_array_shortcut *assoc_array_ptr_to_shortcut(const struct assoc_array_ptr *x)
154{
155 return (struct assoc_array_shortcut *)__assoc_array_ptr_to_meta(x);
156}
157
158static inline
159struct assoc_array_ptr *__assoc_array_x_to_ptr(const void *p, unsigned long t)
160{
161 return (struct assoc_array_ptr *)((unsigned long)p | t);
162}
163static inline
164struct assoc_array_ptr *assoc_array_leaf_to_ptr(const void *p)
165{
166 return __assoc_array_x_to_ptr(p, ASSOC_ARRAY_PTR_LEAF_TYPE);
167}
168static inline
169struct assoc_array_ptr *assoc_array_node_to_ptr(const struct assoc_array_node *p)
170{
171 return __assoc_array_x_to_ptr(
172 p, ASSOC_ARRAY_PTR_META_TYPE | ASSOC_ARRAY_PTR_NODE_SUBTYPE);
173}
174static inline
175struct assoc_array_ptr *assoc_array_shortcut_to_ptr(const struct assoc_array_shortcut *p)
176{
177 return __assoc_array_x_to_ptr(
178 p, ASSOC_ARRAY_PTR_META_TYPE | ASSOC_ARRAY_PTR_SHORTCUT_SUBTYPE);
179}
180
181#endif /* CONFIG_ASSOCIATIVE_ARRAY */
182#endif /* _LINUX_ASSOC_ARRAY_PRIV_H */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 729a4d165bcc..a40641954c29 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -73,6 +73,8 @@ struct audit_field {
73 void *lsm_rule; 73 void *lsm_rule;
74}; 74};
75 75
76extern int is_audit_feature_set(int which);
77
76extern int __init audit_register_class(int class, unsigned *list); 78extern int __init audit_register_class(int class, unsigned *list);
77extern int audit_classify_syscall(int abi, unsigned syscall); 79extern int audit_classify_syscall(int abi, unsigned syscall);
78extern int audit_classify_arch(int arch); 80extern int audit_classify_arch(int arch);
@@ -207,7 +209,7 @@ static inline int audit_get_sessionid(struct task_struct *tsk)
207 209
208extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 210extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
209extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); 211extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
210extern int __audit_bprm(struct linux_binprm *bprm); 212extern void __audit_bprm(struct linux_binprm *bprm);
211extern int __audit_socketcall(int nargs, unsigned long *args); 213extern int __audit_socketcall(int nargs, unsigned long *args);
212extern int __audit_sockaddr(int len, void *addr); 214extern int __audit_sockaddr(int len, void *addr);
213extern void __audit_fd_pair(int fd1, int fd2); 215extern void __audit_fd_pair(int fd1, int fd2);
@@ -236,11 +238,10 @@ static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid
236 if (unlikely(!audit_dummy_context())) 238 if (unlikely(!audit_dummy_context()))
237 __audit_ipc_set_perm(qbytes, uid, gid, mode); 239 __audit_ipc_set_perm(qbytes, uid, gid, mode);
238} 240}
239static inline int audit_bprm(struct linux_binprm *bprm) 241static inline void audit_bprm(struct linux_binprm *bprm)
240{ 242{
241 if (unlikely(!audit_dummy_context())) 243 if (unlikely(!audit_dummy_context()))
242 return __audit_bprm(bprm); 244 __audit_bprm(bprm);
243 return 0;
244} 245}
245static inline int audit_socketcall(int nargs, unsigned long *args) 246static inline int audit_socketcall(int nargs, unsigned long *args)
246{ 247{
@@ -367,10 +368,8 @@ static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
367static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, 368static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
368 gid_t gid, umode_t mode) 369 gid_t gid, umode_t mode)
369{ } 370{ }
370static inline int audit_bprm(struct linux_binprm *bprm) 371static inline void audit_bprm(struct linux_binprm *bprm)
371{ 372{ }
372 return 0;
373}
374static inline int audit_socketcall(int nargs, unsigned long *args) 373static inline int audit_socketcall(int nargs, unsigned long *args)
375{ 374{
376 return 0; 375 return 0;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index acd2010328f3..9649ff0c63f8 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -31,6 +31,7 @@ struct hugepage_subpool *hugepage_new_subpool(long nr_blocks);
31void hugepage_put_subpool(struct hugepage_subpool *spool); 31void hugepage_put_subpool(struct hugepage_subpool *spool);
32 32
33int PageHuge(struct page *page); 33int PageHuge(struct page *page);
34int PageHeadHuge(struct page *page_head);
34 35
35void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 36void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
36int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 37int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
@@ -69,7 +70,6 @@ int dequeue_hwpoisoned_huge_page(struct page *page);
69bool isolate_huge_page(struct page *page, struct list_head *list); 70bool isolate_huge_page(struct page *page, struct list_head *list);
70void putback_active_hugepage(struct page *page); 71void putback_active_hugepage(struct page *page);
71bool is_hugepage_active(struct page *page); 72bool is_hugepage_active(struct page *page);
72void copy_huge_page(struct page *dst, struct page *src);
73 73
74#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 74#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
75pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); 75pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
@@ -104,6 +104,11 @@ static inline int PageHuge(struct page *page)
104 return 0; 104 return 0;
105} 105}
106 106
107static inline int PageHeadHuge(struct page *page_head)
108{
109 return 0;
110}
111
107static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma) 112static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
108{ 113{
109} 114}
@@ -140,9 +145,6 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page)
140#define isolate_huge_page(p, l) false 145#define isolate_huge_page(p, l) false
141#define putback_active_hugepage(p) do {} while (0) 146#define putback_active_hugepage(p) do {} while (0)
142#define is_hugepage_active(x) false 147#define is_hugepage_active(x) false
143static inline void copy_huge_page(struct page *dst, struct page *src)
144{
145}
146 148
147static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma, 149static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
148 unsigned long address, unsigned long end, pgprot_t newprot) 150 unsigned long address, unsigned long end, pgprot_t newprot)
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 518a53afb9ea..a74c3a84dfdd 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -45,6 +45,7 @@ struct key_preparsed_payload {
45 const void *data; /* Raw data */ 45 const void *data; /* Raw data */
46 size_t datalen; /* Raw datalen */ 46 size_t datalen; /* Raw datalen */
47 size_t quotalen; /* Quota length for proposed payload */ 47 size_t quotalen; /* Quota length for proposed payload */
48 bool trusted; /* True if key is trusted */
48}; 49};
49 50
50typedef int (*request_key_actor_t)(struct key_construction *key, 51typedef int (*request_key_actor_t)(struct key_construction *key,
@@ -63,6 +64,11 @@ struct key_type {
63 */ 64 */
64 size_t def_datalen; 65 size_t def_datalen;
65 66
67 /* Default key search algorithm. */
68 unsigned def_lookup_type;
69#define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */
70#define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */
71
66 /* vet a description */ 72 /* vet a description */
67 int (*vet_description)(const char *description); 73 int (*vet_description)(const char *description);
68 74
diff --git a/include/linux/key.h b/include/linux/key.h
index 4dfde1161c5e..80d677483e31 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -22,6 +22,7 @@
22#include <linux/sysctl.h> 22#include <linux/sysctl.h>
23#include <linux/rwsem.h> 23#include <linux/rwsem.h>
24#include <linux/atomic.h> 24#include <linux/atomic.h>
25#include <linux/assoc_array.h>
25 26
26#ifdef __KERNEL__ 27#ifdef __KERNEL__
27#include <linux/uidgid.h> 28#include <linux/uidgid.h>
@@ -82,6 +83,12 @@ struct key_owner;
82struct keyring_list; 83struct keyring_list;
83struct keyring_name; 84struct keyring_name;
84 85
86struct keyring_index_key {
87 struct key_type *type;
88 const char *description;
89 size_t desc_len;
90};
91
85/*****************************************************************************/ 92/*****************************************************************************/
86/* 93/*
87 * key reference with possession attribute handling 94 * key reference with possession attribute handling
@@ -99,7 +106,7 @@ struct keyring_name;
99typedef struct __key_reference_with_attributes *key_ref_t; 106typedef struct __key_reference_with_attributes *key_ref_t;
100 107
101static inline key_ref_t make_key_ref(const struct key *key, 108static inline key_ref_t make_key_ref(const struct key *key,
102 unsigned long possession) 109 bool possession)
103{ 110{
104 return (key_ref_t) ((unsigned long) key | possession); 111 return (key_ref_t) ((unsigned long) key | possession);
105} 112}
@@ -109,7 +116,7 @@ static inline struct key *key_ref_to_ptr(const key_ref_t key_ref)
109 return (struct key *) ((unsigned long) key_ref & ~1UL); 116 return (struct key *) ((unsigned long) key_ref & ~1UL);
110} 117}
111 118
112static inline unsigned long is_key_possessed(const key_ref_t key_ref) 119static inline bool is_key_possessed(const key_ref_t key_ref)
113{ 120{
114 return (unsigned long) key_ref & 1UL; 121 return (unsigned long) key_ref & 1UL;
115} 122}
@@ -129,7 +136,6 @@ struct key {
129 struct list_head graveyard_link; 136 struct list_head graveyard_link;
130 struct rb_node serial_node; 137 struct rb_node serial_node;
131 }; 138 };
132 struct key_type *type; /* type of key */
133 struct rw_semaphore sem; /* change vs change sem */ 139 struct rw_semaphore sem; /* change vs change sem */
134 struct key_user *user; /* owner of this key */ 140 struct key_user *user; /* owner of this key */
135 void *security; /* security data for this key */ 141 void *security; /* security data for this key */
@@ -162,13 +168,21 @@ struct key {
162#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ 168#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */
163#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */ 169#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */
164#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */ 170#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */
171#define KEY_FLAG_TRUSTED 8 /* set if key is trusted */
172#define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */
165 173
166 /* the description string 174 /* the key type and key description string
167 * - this is used to match a key against search criteria 175 * - the desc is used to match a key against search criteria
168 * - this should be a printable string 176 * - it should be a printable string
169 * - eg: for krb5 AFS, this might be "afs@REDHAT.COM" 177 * - eg: for krb5 AFS, this might be "afs@REDHAT.COM"
170 */ 178 */
171 char *description; 179 union {
180 struct keyring_index_key index_key;
181 struct {
182 struct key_type *type; /* type of key */
183 char *description;
184 };
185 };
172 186
173 /* type specific data 187 /* type specific data
174 * - this is used by the keyring type to index the name 188 * - this is used by the keyring type to index the name
@@ -185,11 +199,14 @@ struct key {
185 * whatever 199 * whatever
186 */ 200 */
187 union { 201 union {
188 unsigned long value; 202 union {
189 void __rcu *rcudata; 203 unsigned long value;
190 void *data; 204 void __rcu *rcudata;
191 struct keyring_list __rcu *subscriptions; 205 void *data;
192 } payload; 206 void *data2[2];
207 } payload;
208 struct assoc_array keys;
209 };
193}; 210};
194 211
195extern struct key *key_alloc(struct key_type *type, 212extern struct key *key_alloc(struct key_type *type,
@@ -203,18 +220,23 @@ extern struct key *key_alloc(struct key_type *type,
203#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */ 220#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */
204#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */ 221#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */
205#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */ 222#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
223#define KEY_ALLOC_TRUSTED 0x0004 /* Key should be flagged as trusted */
206 224
207extern void key_revoke(struct key *key); 225extern void key_revoke(struct key *key);
208extern void key_invalidate(struct key *key); 226extern void key_invalidate(struct key *key);
209extern void key_put(struct key *key); 227extern void key_put(struct key *key);
210 228
211static inline struct key *key_get(struct key *key) 229static inline struct key *__key_get(struct key *key)
212{ 230{
213 if (key) 231 atomic_inc(&key->usage);
214 atomic_inc(&key->usage);
215 return key; 232 return key;
216} 233}
217 234
235static inline struct key *key_get(struct key *key)
236{
237 return key ? __key_get(key) : key;
238}
239
218static inline void key_ref_put(key_ref_t key_ref) 240static inline void key_ref_put(key_ref_t key_ref)
219{ 241{
220 key_put(key_ref_to_ptr(key_ref)); 242 key_put(key_ref_to_ptr(key_ref));
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 10f5a7272b80..bd299418a934 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -44,18 +44,22 @@ struct page {
44 /* First double word block */ 44 /* First double word block */
45 unsigned long flags; /* Atomic flags, some possibly 45 unsigned long flags; /* Atomic flags, some possibly
46 * updated asynchronously */ 46 * updated asynchronously */
47 struct address_space *mapping; /* If low bit clear, points to 47 union {
48 * inode address_space, or NULL. 48 struct address_space *mapping; /* If low bit clear, points to
49 * If page mapped as anonymous 49 * inode address_space, or NULL.
50 * memory, low bit is set, and 50 * If page mapped as anonymous
51 * it points to anon_vma object: 51 * memory, low bit is set, and
52 * see PAGE_MAPPING_ANON below. 52 * it points to anon_vma object:
53 */ 53 * see PAGE_MAPPING_ANON below.
54 */
55 void *s_mem; /* slab first object */
56 };
57
54 /* Second double word */ 58 /* Second double word */
55 struct { 59 struct {
56 union { 60 union {
57 pgoff_t index; /* Our offset within mapping. */ 61 pgoff_t index; /* Our offset within mapping. */
58 void *freelist; /* slub/slob first free object */ 62 void *freelist; /* sl[aou]b first free object */
59 bool pfmemalloc; /* If set by the page allocator, 63 bool pfmemalloc; /* If set by the page allocator,
60 * ALLOC_NO_WATERMARKS was set 64 * ALLOC_NO_WATERMARKS was set
61 * and the low watermark was not 65 * and the low watermark was not
@@ -65,9 +69,6 @@ struct page {
65 * this page is only used to 69 * this page is only used to
66 * free other pages. 70 * free other pages.
67 */ 71 */
68#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS
69 pgtable_t pmd_huge_pte; /* protected by page->ptl */
70#endif
71 }; 72 };
72 73
73 union { 74 union {
@@ -114,6 +115,7 @@ struct page {
114 }; 115 };
115 atomic_t _count; /* Usage count, see below. */ 116 atomic_t _count; /* Usage count, see below. */
116 }; 117 };
118 unsigned int active; /* SLAB */
117 }; 119 };
118 }; 120 };
119 121
@@ -135,6 +137,12 @@ struct page {
135 137
136 struct list_head list; /* slobs list of pages */ 138 struct list_head list; /* slobs list of pages */
137 struct slab *slab_page; /* slab fields */ 139 struct slab *slab_page; /* slab fields */
140 struct rcu_head rcu_head; /* Used by SLAB
141 * when destroying via RCU
142 */
143#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS
144 pgtable_t pmd_huge_pte; /* protected by page->ptl */
145#endif
138 }; 146 };
139 147
140 /* Remainder is not double word aligned */ 148 /* Remainder is not double word aligned */
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 87cce50bd121..009b02481436 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -26,11 +26,11 @@ struct msi_desc {
26 struct { 26 struct {
27 __u8 is_msix : 1; 27 __u8 is_msix : 1;
28 __u8 multiple: 3; /* log2 number of messages */ 28 __u8 multiple: 3; /* log2 number of messages */
29 __u8 maskbit : 1; /* mask-pending bit supported ? */ 29 __u8 maskbit : 1; /* mask-pending bit supported ? */
30 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 30 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
31 __u8 pos; /* Location of the msi capability */ 31 __u8 pos; /* Location of the msi capability */
32 __u16 entry_nr; /* specific enabled entry */ 32 __u16 entry_nr; /* specific enabled entry */
33 unsigned default_irq; /* default pre-assigned irq */ 33 unsigned default_irq; /* default pre-assigned irq */
34 } msi_attrib; 34 } msi_attrib;
35 35
36 u32 masked; /* mask bits */ 36 u32 masked; /* mask bits */
diff --git a/include/linux/net.h b/include/linux/net.h
index b292a0435571..4bcee94cef93 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -164,6 +164,14 @@ struct proto_ops {
164#endif 164#endif
165 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 165 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
166 struct msghdr *m, size_t total_len); 166 struct msghdr *m, size_t total_len);
167 /* Notes for implementing recvmsg:
168 * ===============================
169 * msg->msg_namelen should get updated by the recvmsg handlers
170 * iff msg_name != NULL. It is by default 0 to prevent
171 * returning uninitialized memory to user space. The recvfrom
172 * handlers can assume that msg.msg_name is either NULL or has
173 * a minimum size of sizeof(struct sockaddr_storage).
174 */
167 int (*recvmsg) (struct kiocb *iocb, struct socket *sock, 175 int (*recvmsg) (struct kiocb *iocb, struct socket *sock,
168 struct msghdr *m, size_t total_len, 176 struct msghdr *m, size_t total_len,
169 int flags); 177 int flags);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 835ec7bf6c05..1084a15175e0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -32,7 +32,6 @@
32#include <linux/irqreturn.h> 32#include <linux/irqreturn.h>
33#include <uapi/linux/pci.h> 33#include <uapi/linux/pci.h>
34 34
35/* Include the ID list */
36#include <linux/pci_ids.h> 35#include <linux/pci_ids.h>
37 36
38/* 37/*
@@ -42,9 +41,10 @@
42 * 41 *
43 * 7:3 = slot 42 * 7:3 = slot
44 * 2:0 = function 43 * 2:0 = function
45 * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined uapi/linux/pci.h 44 *
45 * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined in uapi/linux/pci.h.
46 * In the interest of not exposing interfaces to user-space unnecessarily, 46 * In the interest of not exposing interfaces to user-space unnecessarily,
47 * the following kernel only defines are being added here. 47 * the following kernel-only defines are being added here.
48 */ 48 */
49#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) 49#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn)
50/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ 50/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
@@ -153,10 +153,10 @@ enum pcie_reset_state {
153 /* Reset is NOT asserted (Use to deassert reset) */ 153 /* Reset is NOT asserted (Use to deassert reset) */
154 pcie_deassert_reset = (__force pcie_reset_state_t) 1, 154 pcie_deassert_reset = (__force pcie_reset_state_t) 1,
155 155
156 /* Use #PERST to reset PCI-E device */ 156 /* Use #PERST to reset PCIe device */
157 pcie_warm_reset = (__force pcie_reset_state_t) 2, 157 pcie_warm_reset = (__force pcie_reset_state_t) 2,
158 158
159 /* Use PCI-E Hot Reset to reset device */ 159 /* Use PCIe Hot Reset to reset device */
160 pcie_hot_reset = (__force pcie_reset_state_t) 3 160 pcie_hot_reset = (__force pcie_reset_state_t) 3
161}; 161};
162 162
@@ -259,13 +259,13 @@ struct pci_dev {
259 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 259 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
260 u8 revision; /* PCI revision, low byte of class word */ 260 u8 revision; /* PCI revision, low byte of class word */
261 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 261 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
262 u8 pcie_cap; /* PCI-E capability offset */ 262 u8 pcie_cap; /* PCIe capability offset */
263 u8 msi_cap; /* MSI capability offset */ 263 u8 msi_cap; /* MSI capability offset */
264 u8 msix_cap; /* MSI-X capability offset */ 264 u8 msix_cap; /* MSI-X capability offset */
265 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ 265 u8 pcie_mpss:3; /* PCIe Max Payload Size Supported */
266 u8 rom_base_reg; /* which config register controls the ROM */ 266 u8 rom_base_reg; /* which config register controls the ROM */
267 u8 pin; /* which interrupt pin this device uses */ 267 u8 pin; /* which interrupt pin this device uses */
268 u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */ 268 u16 pcie_flags_reg; /* cached PCIe Capabilities Register */
269 269
270 struct pci_driver *driver; /* which driver has allocated this device */ 270 struct pci_driver *driver; /* which driver has allocated this device */
271 u64 dma_mask; /* Mask of the bits of bus address this 271 u64 dma_mask; /* Mask of the bits of bus address this
@@ -300,7 +300,7 @@ struct pci_dev {
300 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ 300 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
301 301
302#ifdef CONFIG_PCIEASPM 302#ifdef CONFIG_PCIEASPM
303 struct pcie_link_state *link_state; /* ASPM link state. */ 303 struct pcie_link_state *link_state; /* ASPM link state */
304#endif 304#endif
305 305
306 pci_channel_state_t error_state; /* current connectivity state */ 306 pci_channel_state_t error_state; /* current connectivity state */
@@ -317,7 +317,7 @@ struct pci_dev {
317 317
318 bool match_driver; /* Skip attaching driver */ 318 bool match_driver; /* Skip attaching driver */
319 /* These fields are used by common fixups */ 319 /* These fields are used by common fixups */
320 unsigned int transparent:1; /* Transparent PCI bridge */ 320 unsigned int transparent:1; /* Subtractive decode PCI bridge */
321 unsigned int multifunction:1;/* Part of multi-function device */ 321 unsigned int multifunction:1;/* Part of multi-function device */
322 /* keep track of device state */ 322 /* keep track of device state */
323 unsigned int is_added:1; 323 unsigned int is_added:1;
@@ -326,7 +326,7 @@ struct pci_dev {
326 unsigned int block_cfg_access:1; /* config space access is blocked */ 326 unsigned int block_cfg_access:1; /* config space access is blocked */
327 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 327 unsigned int broken_parity_status:1; /* Device generates false positive parity */
328 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ 328 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
329 unsigned int msi_enabled:1; 329 unsigned int msi_enabled:1;
330 unsigned int msix_enabled:1; 330 unsigned int msix_enabled:1;
331 unsigned int ari_enabled:1; /* ARI forwarding */ 331 unsigned int ari_enabled:1; /* ARI forwarding */
332 unsigned int is_managed:1; 332 unsigned int is_managed:1;
@@ -371,7 +371,6 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
371 if (dev->is_virtfn) 371 if (dev->is_virtfn)
372 dev = dev->physfn; 372 dev = dev->physfn;
373#endif 373#endif
374
375 return dev; 374 return dev;
376} 375}
377 376
@@ -456,7 +455,7 @@ struct pci_bus {
456 char name[48]; 455 char name[48];
457 456
458 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ 457 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
459 pci_bus_flags_t bus_flags; /* Inherited by child busses */ 458 pci_bus_flags_t bus_flags; /* inherited by child buses */
460 struct device *bridge; 459 struct device *bridge;
461 struct device dev; 460 struct device dev;
462 struct bin_attribute *legacy_io; /* legacy I/O for this bus */ 461 struct bin_attribute *legacy_io; /* legacy I/O for this bus */
@@ -468,7 +467,7 @@ struct pci_bus {
468#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 467#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
469 468
470/* 469/*
471 * Returns true if the pci bus is root (behind host-pci bridge), 470 * Returns true if the PCI bus is root (behind host-PCI bridge),
472 * false otherwise 471 * false otherwise
473 * 472 *
474 * Some code assumes that "bus->self == NULL" means that bus is a root bus. 473 * Some code assumes that "bus->self == NULL" means that bus is a root bus.
@@ -510,7 +509,7 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false;
510#define PCIBIOS_BUFFER_TOO_SMALL 0x89 509#define PCIBIOS_BUFFER_TOO_SMALL 0x89
511 510
512/* 511/*
513 * Translate above to generic errno for passing back through non-pci. 512 * Translate above to generic errno for passing back through non-PCI code.
514 */ 513 */
515static inline int pcibios_err_to_errno(int err) 514static inline int pcibios_err_to_errno(int err)
516{ 515{
@@ -561,11 +560,12 @@ struct pci_dynids {
561 struct list_head list; /* for IDs added at runtime */ 560 struct list_head list; /* for IDs added at runtime */
562}; 561};
563 562
564/* ---------------------------------------------------------------- */ 563
565/** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides 564/*
566 * a set of callbacks in struct pci_error_handlers, then that device driver 565 * PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
567 * will be notified of PCI bus errors, and will be driven to recovery 566 * a set of callbacks in struct pci_error_handlers, that device driver
568 * when an error occurs. 567 * will be notified of PCI bus errors, and will be driven to recovery
568 * when an error occurs.
569 */ 569 */
570 570
571typedef unsigned int __bitwise pci_ers_result_t; 571typedef unsigned int __bitwise pci_ers_result_t;
@@ -609,7 +609,6 @@ struct pci_error_handlers {
609 void (*resume)(struct pci_dev *dev); 609 void (*resume)(struct pci_dev *dev);
610}; 610};
611 611
612/* ---------------------------------------------------------------- */
613 612
614struct module; 613struct module;
615struct pci_driver { 614struct pci_driver {
@@ -713,10 +712,10 @@ extern enum pcie_bus_config_types pcie_bus_config;
713 712
714extern struct bus_type pci_bus_type; 713extern struct bus_type pci_bus_type;
715 714
716/* Do NOT directly access these two variables, unless you are arch specific pci 715/* Do NOT directly access these two variables, unless you are arch-specific PCI
717 * code, or pci core code. */ 716 * code, or PCI core code. */
718extern struct list_head pci_root_buses; /* list of all known PCI buses */ 717extern struct list_head pci_root_buses; /* list of all known PCI buses */
719/* Some device drivers need know if pci is initiated */ 718/* Some device drivers need know if PCI is initiated */
720int no_pci_devices(void); 719int no_pci_devices(void);
721 720
722void pcibios_resource_survey_bus(struct pci_bus *bus); 721void pcibios_resource_survey_bus(struct pci_bus *bus);
@@ -724,7 +723,7 @@ void pcibios_add_bus(struct pci_bus *bus);
724void pcibios_remove_bus(struct pci_bus *bus); 723void pcibios_remove_bus(struct pci_bus *bus);
725void pcibios_fixup_bus(struct pci_bus *); 724void pcibios_fixup_bus(struct pci_bus *);
726int __must_check pcibios_enable_device(struct pci_dev *, int mask); 725int __must_check pcibios_enable_device(struct pci_dev *, int mask);
727/* Architecture specific versions may override this (weak) */ 726/* Architecture-specific versions may override this (weak) */
728char *pcibios_setup(char *str); 727char *pcibios_setup(char *str);
729 728
730/* Used only when drivers/pci/setup.c is used */ 729/* Used only when drivers/pci/setup.c is used */
@@ -1258,7 +1257,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
1258 1257
1259/* 1258/*
1260 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 1259 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
1261 * a PCI domain is defined to be a set of PCI busses which share 1260 * a PCI domain is defined to be a set of PCI buses which share
1262 * configuration space. 1261 * configuration space.
1263 */ 1262 */
1264#ifdef CONFIG_PCI_DOMAINS 1263#ifdef CONFIG_PCI_DOMAINS
@@ -1672,7 +1671,7 @@ extern u8 pci_cache_line_size;
1672extern unsigned long pci_hotplug_io_size; 1671extern unsigned long pci_hotplug_io_size;
1673extern unsigned long pci_hotplug_mem_size; 1672extern unsigned long pci_hotplug_mem_size;
1674 1673
1675/* Architecture specific versions may override these (weak) */ 1674/* Architecture-specific versions may override these (weak) */
1676int pcibios_add_platform_entries(struct pci_dev *dev); 1675int pcibios_add_platform_entries(struct pci_dev *dev);
1677void pcibios_disable_device(struct pci_dev *dev); 1676void pcibios_disable_device(struct pci_dev *dev);
1678void pcibios_set_master(struct pci_dev *dev); 1677void pcibios_set_master(struct pci_dev *dev);
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 430dd963707b..a2e2f1d17e16 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -39,8 +39,8 @@
39 * @hardware_test: Called to run a specified hardware test on the specified 39 * @hardware_test: Called to run a specified hardware test on the specified
40 * slot. 40 * slot.
41 * @get_power_status: Called to get the current power status of a slot. 41 * @get_power_status: Called to get the current power status of a slot.
42 * If this field is NULL, the value passed in the struct hotplug_slot_info 42 * If this field is NULL, the value passed in the struct hotplug_slot_info
43 * will be used when this value is requested by a user. 43 * will be used when this value is requested by a user.
44 * @get_attention_status: Called to get the current attention status of a slot. 44 * @get_attention_status: Called to get the current attention status of a slot.
45 * If this field is NULL, the value passed in the struct hotplug_slot_info 45 * If this field is NULL, the value passed in the struct hotplug_slot_info
46 * will be used when this value is requested by a user. 46 * will be used when this value is requested by a user.
@@ -191,4 +191,3 @@ static inline int pci_get_hp_params(struct pci_dev *dev,
191 191
192void pci_configure_slot(struct pci_dev *dev); 192void pci_configure_slot(struct pci_dev *dev);
193#endif 193#endif
194
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index 9572669eea97..4f1089f2cc98 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -23,7 +23,7 @@
23#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT) 23#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT)
24 24
25struct pcie_device { 25struct pcie_device {
26 int irq; /* Service IRQ/MSI/MSI-X Vector */ 26 int irq; /* Service IRQ/MSI/MSI-X Vector */
27 struct pci_dev *port; /* Root/Upstream/Downstream Port */ 27 struct pci_dev *port; /* Root/Upstream/Downstream Port */
28 u32 service; /* Port service this device represents */ 28 u32 service; /* Port service this device represents */
29 void *priv_data; /* Service Private Data */ 29 void *priv_data; /* Service Private Data */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 64ab823f7b74..48a4dc3cb8cf 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -559,6 +559,7 @@ static inline int phy_read_status(struct phy_device *phydev) {
559 return phydev->drv->read_status(phydev); 559 return phydev->drv->read_status(phydev);
560} 560}
561 561
562int genphy_setup_forced(struct phy_device *phydev);
562int genphy_restart_aneg(struct phy_device *phydev); 563int genphy_restart_aneg(struct phy_device *phydev);
563int genphy_config_aneg(struct phy_device *phydev); 564int genphy_config_aneg(struct phy_device *phydev);
564int genphy_update_link(struct phy_device *phydev); 565int genphy_update_link(struct phy_device *phydev);
diff --git a/include/linux/security.h b/include/linux/security.h
index 9d37e2b9d3ec..5623a7f965b7 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1052,17 +1052,25 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1052 * @xfrm_policy_delete_security: 1052 * @xfrm_policy_delete_security:
1053 * @ctx contains the xfrm_sec_ctx. 1053 * @ctx contains the xfrm_sec_ctx.
1054 * Authorize deletion of xp->security. 1054 * Authorize deletion of xp->security.
1055 * @xfrm_state_alloc_security: 1055 * @xfrm_state_alloc:
1056 * @x contains the xfrm_state being added to the Security Association 1056 * @x contains the xfrm_state being added to the Security Association
1057 * Database by the XFRM system. 1057 * Database by the XFRM system.
1058 * @sec_ctx contains the security context information being provided by 1058 * @sec_ctx contains the security context information being provided by
1059 * the user-level SA generation program (e.g., setkey or racoon). 1059 * the user-level SA generation program (e.g., setkey or racoon).
1060 * @secid contains the secid from which to take the mls portion of the context.
1061 * Allocate a security structure to the x->security field; the security 1060 * Allocate a security structure to the x->security field; the security
1062 * field is initialized to NULL when the xfrm_state is allocated. Set the 1061 * field is initialized to NULL when the xfrm_state is allocated. Set the
1063 * context to correspond to either sec_ctx or polsec, with the mls portion 1062 * context to correspond to sec_ctx. Return 0 if operation was successful
1064 * taken from secid in the latter case. 1063 * (memory to allocate, legal context).
1065 * Return 0 if operation was successful (memory to allocate, legal context). 1064 * @xfrm_state_alloc_acquire:
1065 * @x contains the xfrm_state being added to the Security Association
1066 * Database by the XFRM system.
1067 * @polsec contains the policy's security context.
1068 * @secid contains the secid from which to take the mls portion of the
1069 * context.
1070 * Allocate a security structure to the x->security field; the security
1071 * field is initialized to NULL when the xfrm_state is allocated. Set the
1072 * context to correspond to secid. Return 0 if operation was successful
1073 * (memory to allocate, legal context).
1066 * @xfrm_state_free_security: 1074 * @xfrm_state_free_security:
1067 * @x contains the xfrm_state. 1075 * @x contains the xfrm_state.
1068 * Deallocate x->security. 1076 * Deallocate x->security.
@@ -1679,9 +1687,11 @@ struct security_operations {
1679 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx); 1687 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
1680 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx); 1688 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
1681 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx); 1689 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
1682 int (*xfrm_state_alloc_security) (struct xfrm_state *x, 1690 int (*xfrm_state_alloc) (struct xfrm_state *x,
1683 struct xfrm_user_sec_ctx *sec_ctx, 1691 struct xfrm_user_sec_ctx *sec_ctx);
1684 u32 secid); 1692 int (*xfrm_state_alloc_acquire) (struct xfrm_state *x,
1693 struct xfrm_sec_ctx *polsec,
1694 u32 secid);
1685 void (*xfrm_state_free_security) (struct xfrm_state *x); 1695 void (*xfrm_state_free_security) (struct xfrm_state *x);
1686 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1696 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1687 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 1697 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 74f105847d13..c2bba248fa63 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -53,7 +53,14 @@
53 * } 53 * }
54 * rcu_read_unlock(); 54 * rcu_read_unlock();
55 * 55 *
56 * See also the comment on struct slab_rcu in mm/slab.c. 56 * This is useful if we need to approach a kernel structure obliquely,
57 * from its address obtained without the usual locking. We can lock
58 * the structure to stabilize it and check it's still at the given address,
59 * only if we can be sure that the memory has not been meanwhile reused
60 * for some other kind of object (which our subsystem's lock might corrupt).
61 *
62 * rcu_read_lock before reading the address, then rcu_read_unlock after
63 * taking the spinlock within the structure expected at that address.
57 */ 64 */
58#define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ 65#define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */
59#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ 66#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index e9346b4f1ef4..09bfffb08a56 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -27,8 +27,8 @@ struct kmem_cache {
27 27
28 size_t colour; /* cache colouring range */ 28 size_t colour; /* cache colouring range */
29 unsigned int colour_off; /* colour offset */ 29 unsigned int colour_off; /* colour offset */
30 struct kmem_cache *slabp_cache; 30 struct kmem_cache *freelist_cache;
31 unsigned int slab_size; 31 unsigned int freelist_size;
32 32
33 /* constructor func */ 33 /* constructor func */
34 void (*ctor)(void *obj); 34 void (*ctor)(void *obj);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index cc0b67eada42..f56bfa9e4526 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -11,7 +11,7 @@
11enum stat_item { 11enum stat_item {
12 ALLOC_FASTPATH, /* Allocation from cpu slab */ 12 ALLOC_FASTPATH, /* Allocation from cpu slab */
13 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */ 13 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */
14 FREE_FASTPATH, /* Free to cpu slub */ 14 FREE_FASTPATH, /* Free to cpu slab */
15 FREE_SLOWPATH, /* Freeing not to cpu slab */ 15 FREE_SLOWPATH, /* Freeing not to cpu slab */
16 FREE_FROZEN, /* Freeing to frozen slab */ 16 FREE_FROZEN, /* Freeing to frozen slab */
17 FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ 17 FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 4db29859464f..4836ba3c1cd8 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -27,6 +27,12 @@ struct user_namespace {
27 kuid_t owner; 27 kuid_t owner;
28 kgid_t group; 28 kgid_t group;
29 unsigned int proc_inum; 29 unsigned int proc_inum;
30
31 /* Register of per-UID persistent keyrings for this namespace */
32#ifdef CONFIG_PERSISTENT_KEYRINGS
33 struct key *persistent_keyring_register;
34 struct rw_semaphore persistent_keyring_register_sem;
35#endif
30}; 36};
31 37
32extern struct user_namespace init_user_ns; 38extern struct user_namespace init_user_ns;
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index ace4abf118d7..1b177ed803b7 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -265,7 +265,7 @@ static inline int genlmsg_multicast_netns(struct genl_family *family,
265 struct net *net, struct sk_buff *skb, 265 struct net *net, struct sk_buff *skb,
266 u32 portid, unsigned int group, gfp_t flags) 266 u32 portid, unsigned int group, gfp_t flags)
267{ 267{
268 if (group >= family->n_mcgrps) 268 if (WARN_ON_ONCE(group >= family->n_mcgrps))
269 return -EINVAL; 269 return -EINVAL;
270 group = family->mcgrp_offset + group; 270 group = family->mcgrp_offset + group;
271 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags); 271 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags);
@@ -283,9 +283,6 @@ static inline int genlmsg_multicast(struct genl_family *family,
283 struct sk_buff *skb, u32 portid, 283 struct sk_buff *skb, u32 portid,
284 unsigned int group, gfp_t flags) 284 unsigned int group, gfp_t flags)
285{ 285{
286 if (group >= family->n_mcgrps)
287 return -EINVAL;
288 group = family->mcgrp_offset + group;
289 return genlmsg_multicast_netns(family, &init_net, skb, 286 return genlmsg_multicast_netns(family, &init_net, skb,
290 portid, group, flags); 287 portid, group, flags);
291} 288}
@@ -387,6 +384,9 @@ static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags)
387static inline int genl_set_err(struct genl_family *family, struct net *net, 384static inline int genl_set_err(struct genl_family *family, struct net *net,
388 u32 portid, u32 group, int code) 385 u32 portid, u32 group, int code)
389{ 386{
387 if (WARN_ON_ONCE(group >= family->n_mcgrps))
388 return -EINVAL;
389 group = family->mcgrp_offset + group;
390 return netlink_set_err(net->genl_sock, portid, group, code); 390 return netlink_set_err(net->genl_sock, portid, group, code);
391} 391}
392 392
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 5ebe21cd5d1c..39e0114d70c5 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -34,6 +34,11 @@ struct se_subsystem_api {
34 sense_reason_t (*parse_cdb)(struct se_cmd *cmd); 34 sense_reason_t (*parse_cdb)(struct se_cmd *cmd);
35 u32 (*get_device_type)(struct se_device *); 35 u32 (*get_device_type)(struct se_device *);
36 sector_t (*get_blocks)(struct se_device *); 36 sector_t (*get_blocks)(struct se_device *);
37 sector_t (*get_alignment_offset_lbas)(struct se_device *);
38 /* lbppbe = logical blocks per physical block exponent. see SBC-3 */
39 unsigned int (*get_lbppbe)(struct se_device *);
40 unsigned int (*get_io_min)(struct se_device *);
41 unsigned int (*get_io_opt)(struct se_device *);
37 unsigned char *(*get_sense_buffer)(struct se_cmd *); 42 unsigned char *(*get_sense_buffer)(struct se_cmd *);
38 bool (*get_write_cache)(struct se_device *); 43 bool (*get_write_cache)(struct se_device *);
39}; 44};
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 5bdb8b7d2a69..45412a6afa69 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -227,6 +227,7 @@ enum tcm_tmreq_table {
227 227
228/* fabric independent task management response values */ 228/* fabric independent task management response values */
229enum tcm_tmrsp_table { 229enum tcm_tmrsp_table {
230 TMR_FUNCTION_FAILED = 0,
230 TMR_FUNCTION_COMPLETE = 1, 231 TMR_FUNCTION_COMPLETE = 1,
231 TMR_TASK_DOES_NOT_EXIST = 2, 232 TMR_TASK_DOES_NOT_EXIST = 2,
232 TMR_LUN_DOES_NOT_EXIST = 3, 233 TMR_LUN_DOES_NOT_EXIST = 3,
@@ -282,11 +283,12 @@ struct t10_alua_lu_gp_member {
282struct t10_alua_tg_pt_gp { 283struct t10_alua_tg_pt_gp {
283 u16 tg_pt_gp_id; 284 u16 tg_pt_gp_id;
284 int tg_pt_gp_valid_id; 285 int tg_pt_gp_valid_id;
286 int tg_pt_gp_alua_supported_states;
285 int tg_pt_gp_alua_access_status; 287 int tg_pt_gp_alua_access_status;
286 int tg_pt_gp_alua_access_type; 288 int tg_pt_gp_alua_access_type;
287 int tg_pt_gp_nonop_delay_msecs; 289 int tg_pt_gp_nonop_delay_msecs;
288 int tg_pt_gp_trans_delay_msecs; 290 int tg_pt_gp_trans_delay_msecs;
289 int tg_pt_gp_implict_trans_secs; 291 int tg_pt_gp_implicit_trans_secs;
290 int tg_pt_gp_pref; 292 int tg_pt_gp_pref;
291 int tg_pt_gp_write_metadata; 293 int tg_pt_gp_write_metadata;
292 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */ 294 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */
@@ -442,7 +444,6 @@ struct se_cmd {
442 /* Used for sense data */ 444 /* Used for sense data */
443 void *sense_buffer; 445 void *sense_buffer;
444 struct list_head se_delayed_node; 446 struct list_head se_delayed_node;
445 struct list_head se_lun_node;
446 struct list_head se_qf_node; 447 struct list_head se_qf_node;
447 struct se_device *se_dev; 448 struct se_device *se_dev;
448 struct se_dev_entry *se_deve; 449 struct se_dev_entry *se_deve;
@@ -470,15 +471,11 @@ struct se_cmd {
470#define CMD_T_SENT (1 << 4) 471#define CMD_T_SENT (1 << 4)
471#define CMD_T_STOP (1 << 5) 472#define CMD_T_STOP (1 << 5)
472#define CMD_T_FAILED (1 << 6) 473#define CMD_T_FAILED (1 << 6)
473#define CMD_T_LUN_STOP (1 << 7) 474#define CMD_T_DEV_ACTIVE (1 << 7)
474#define CMD_T_LUN_FE_STOP (1 << 8) 475#define CMD_T_REQUEST_STOP (1 << 8)
475#define CMD_T_DEV_ACTIVE (1 << 9) 476#define CMD_T_BUSY (1 << 9)
476#define CMD_T_REQUEST_STOP (1 << 10)
477#define CMD_T_BUSY (1 << 11)
478 spinlock_t t_state_lock; 477 spinlock_t t_state_lock;
479 struct completion t_transport_stop_comp; 478 struct completion t_transport_stop_comp;
480 struct completion transport_lun_fe_stop_comp;
481 struct completion transport_lun_stop_comp;
482 479
483 struct work_struct work; 480 struct work_struct work;
484 481
@@ -498,6 +495,9 @@ struct se_cmd {
498 495
499 /* backend private data */ 496 /* backend private data */
500 void *priv; 497 void *priv;
498
499 /* Used for lun->lun_ref counting */
500 bool lun_ref_active;
501}; 501};
502 502
503struct se_ua { 503struct se_ua {
@@ -628,6 +628,34 @@ struct se_dev_attrib {
628 struct config_group da_group; 628 struct config_group da_group;
629}; 629};
630 630
631struct se_port_stat_grps {
632 struct config_group stat_group;
633 struct config_group scsi_port_group;
634 struct config_group scsi_tgt_port_group;
635 struct config_group scsi_transport_group;
636};
637
638struct se_lun {
639#define SE_LUN_LINK_MAGIC 0xffff7771
640 u32 lun_link_magic;
641 /* See transport_lun_status_table */
642 enum transport_lun_status_table lun_status;
643 u32 lun_access;
644 u32 lun_flags;
645 u32 unpacked_lun;
646 atomic_t lun_acl_count;
647 spinlock_t lun_acl_lock;
648 spinlock_t lun_sep_lock;
649 struct completion lun_shutdown_comp;
650 struct list_head lun_acl_list;
651 struct se_device *lun_se_dev;
652 struct se_port *lun_sep;
653 struct config_group lun_group;
654 struct se_port_stat_grps port_stat_grps;
655 struct completion lun_ref_comp;
656 struct percpu_ref lun_ref;
657};
658
631struct se_dev_stat_grps { 659struct se_dev_stat_grps {
632 struct config_group stat_group; 660 struct config_group stat_group;
633 struct config_group scsi_dev_group; 661 struct config_group scsi_dev_group;
@@ -656,11 +684,10 @@ struct se_device {
656 /* Pointer to transport specific device structure */ 684 /* Pointer to transport specific device structure */
657 u32 dev_index; 685 u32 dev_index;
658 u64 creation_time; 686 u64 creation_time;
659 u32 num_resets; 687 atomic_long_t num_resets;
660 u64 num_cmds; 688 atomic_long_t num_cmds;
661 u64 read_bytes; 689 atomic_long_t read_bytes;
662 u64 write_bytes; 690 atomic_long_t write_bytes;
663 spinlock_t stats_lock;
664 /* Active commands on this virtual SE device */ 691 /* Active commands on this virtual SE device */
665 atomic_t simple_cmds; 692 atomic_t simple_cmds;
666 atomic_t dev_ordered_id; 693 atomic_t dev_ordered_id;
@@ -711,6 +738,7 @@ struct se_device {
711 struct se_subsystem_api *transport; 738 struct se_subsystem_api *transport;
712 /* Linked list for struct se_hba struct se_device list */ 739 /* Linked list for struct se_hba struct se_device list */
713 struct list_head dev_list; 740 struct list_head dev_list;
741 struct se_lun xcopy_lun;
714}; 742};
715 743
716struct se_hba { 744struct se_hba {
@@ -730,34 +758,6 @@ struct se_hba {
730 struct se_subsystem_api *transport; 758 struct se_subsystem_api *transport;
731}; 759};
732 760
733struct se_port_stat_grps {
734 struct config_group stat_group;
735 struct config_group scsi_port_group;
736 struct config_group scsi_tgt_port_group;
737 struct config_group scsi_transport_group;
738};
739
740struct se_lun {
741#define SE_LUN_LINK_MAGIC 0xffff7771
742 u32 lun_link_magic;
743 /* See transport_lun_status_table */
744 enum transport_lun_status_table lun_status;
745 u32 lun_access;
746 u32 lun_flags;
747 u32 unpacked_lun;
748 atomic_t lun_acl_count;
749 spinlock_t lun_acl_lock;
750 spinlock_t lun_cmd_lock;
751 spinlock_t lun_sep_lock;
752 struct completion lun_shutdown_comp;
753 struct list_head lun_cmd_list;
754 struct list_head lun_acl_list;
755 struct se_device *lun_se_dev;
756 struct se_port *lun_sep;
757 struct config_group lun_group;
758 struct se_port_stat_grps port_stat_grps;
759};
760
761struct scsi_port_stats { 761struct scsi_port_stats {
762 u64 cmd_pdus; 762 u64 cmd_pdus;
763 u64 tx_data_octets; 763 u64 tx_data_octets;
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index 713c5004f4ae..e0801386e4dc 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -54,4 +54,3 @@ struct target_fabric_configfs {
54 struct target_fabric_configfs_template tf_cit_tmpl; 54 struct target_fabric_configfs_template tf_cit_tmpl;
55}; 55};
56 56
57#define TF_CIT_TMPL(tf) (&(tf)->tf_cit_tmpl)
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 882b650e32be..4cf4fda404a3 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -137,6 +137,8 @@ void transport_generic_request_failure(struct se_cmd *, sense_reason_t);
137void __target_execute_cmd(struct se_cmd *); 137void __target_execute_cmd(struct se_cmd *);
138int transport_lookup_tmr_lun(struct se_cmd *, u32); 138int transport_lookup_tmr_lun(struct se_cmd *, u32);
139 139
140struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
141 unsigned char *);
140struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, 142struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *,
141 unsigned char *); 143 unsigned char *);
142void core_tpg_clear_object_luns(struct se_portal_group *); 144void core_tpg_clear_object_luns(struct se_portal_group *);
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index f18b3b76e01e..4832d75dcbae 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -162,12 +162,14 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
162 { EXTENT_FLAG_LOGGING, "LOGGING" }, \ 162 { EXTENT_FLAG_LOGGING, "LOGGING" }, \
163 { EXTENT_FLAG_FILLING, "FILLING" }) 163 { EXTENT_FLAG_FILLING, "FILLING" })
164 164
165TRACE_EVENT(btrfs_get_extent, 165TRACE_EVENT_CONDITION(btrfs_get_extent,
166 166
167 TP_PROTO(struct btrfs_root *root, struct extent_map *map), 167 TP_PROTO(struct btrfs_root *root, struct extent_map *map),
168 168
169 TP_ARGS(root, map), 169 TP_ARGS(root, map),
170 170
171 TP_CONDITION(map),
172
171 TP_STRUCT__entry( 173 TP_STRUCT__entry(
172 __field( u64, root_objectid ) 174 __field( u64, root_objectid )
173 __field( u64, start ) 175 __field( u64, start )
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index db0b825b4810..44b05a09f193 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -68,6 +68,9 @@
68#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */ 68#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */
69#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */ 69#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */
70#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */ 70#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */
71#define AUDIT_SET_FEATURE 1018 /* Turn an audit feature on or off */
72#define AUDIT_GET_FEATURE 1019 /* Get which features are enabled */
73#define AUDIT_FEATURE_CHANGE 1020 /* audit log listing feature changes */
71 74
72#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ 75#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
73#define AUDIT_USER_AVC 1107 /* We filter this differently */ 76#define AUDIT_USER_AVC 1107 /* We filter this differently */
@@ -357,6 +360,12 @@ enum {
357#define AUDIT_PERM_READ 4 360#define AUDIT_PERM_READ 4
358#define AUDIT_PERM_ATTR 8 361#define AUDIT_PERM_ATTR 8
359 362
363/* MAX_AUDIT_MESSAGE_LENGTH is set in audit:lib/libaudit.h as:
364 * 8970 // PATH_MAX*2+CONTEXT_SIZE*2+11+256+1
365 * max header+body+tailer: 44 + 29 + 32 + 262 + 7 + pad
366 */
367#define AUDIT_MESSAGE_TEXT_MAX 8560
368
360struct audit_status { 369struct audit_status {
361 __u32 mask; /* Bit mask for valid entries */ 370 __u32 mask; /* Bit mask for valid entries */
362 __u32 enabled; /* 1 = enabled, 0 = disabled */ 371 __u32 enabled; /* 1 = enabled, 0 = disabled */
@@ -368,11 +377,28 @@ struct audit_status {
368 __u32 backlog; /* messages waiting in queue */ 377 __u32 backlog; /* messages waiting in queue */
369}; 378};
370 379
380struct audit_features {
381#define AUDIT_FEATURE_VERSION 1
382 __u32 vers;
383 __u32 mask; /* which bits we are dealing with */
384 __u32 features; /* which feature to enable/disable */
385 __u32 lock; /* which features to lock */
386};
387
388#define AUDIT_FEATURE_ONLY_UNSET_LOGINUID 0
389#define AUDIT_FEATURE_LOGINUID_IMMUTABLE 1
390#define AUDIT_LAST_FEATURE AUDIT_FEATURE_LOGINUID_IMMUTABLE
391
392#define audit_feature_valid(x) ((x) >= 0 && (x) <= AUDIT_LAST_FEATURE)
393#define AUDIT_FEATURE_TO_MASK(x) (1 << ((x) & 31)) /* mask for __u32 */
394
371struct audit_tty_status { 395struct audit_tty_status {
372 __u32 enabled; /* 1 = enabled, 0 = disabled */ 396 __u32 enabled; /* 1 = enabled, 0 = disabled */
373 __u32 log_passwd; /* 1 = enabled, 0 = disabled */ 397 __u32 log_passwd; /* 1 = enabled, 0 = disabled */
374}; 398};
375 399
400#define AUDIT_UID_UNSET (unsigned int)-1
401
376/* audit_rule_data supports filter rules with both integer and string 402/* audit_rule_data supports filter rules with both integer and string
377 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and 403 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
378 * AUDIT_LIST_RULES requests. 404 * AUDIT_LIST_RULES requests.
diff --git a/include/uapi/linux/hash_info.h b/include/uapi/linux/hash_info.h
new file mode 100644
index 000000000000..ca18c45f8304
--- /dev/null
+++ b/include/uapi/linux/hash_info.h
@@ -0,0 +1,37 @@
1/*
2 * Hash Info: Hash algorithms information
3 *
4 * Copyright (c) 2013 Dmitry Kasatkin <d.kasatkin@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12
13#ifndef _UAPI_LINUX_HASH_INFO_H
14#define _UAPI_LINUX_HASH_INFO_H
15
16enum hash_algo {
17 HASH_ALGO_MD4,
18 HASH_ALGO_MD5,
19 HASH_ALGO_SHA1,
20 HASH_ALGO_RIPE_MD_160,
21 HASH_ALGO_SHA256,
22 HASH_ALGO_SHA384,
23 HASH_ALGO_SHA512,
24 HASH_ALGO_SHA224,
25 HASH_ALGO_RIPE_MD_128,
26 HASH_ALGO_RIPE_MD_256,
27 HASH_ALGO_RIPE_MD_320,
28 HASH_ALGO_WP_256,
29 HASH_ALGO_WP_384,
30 HASH_ALGO_WP_512,
31 HASH_ALGO_TGR_128,
32 HASH_ALGO_TGR_160,
33 HASH_ALGO_TGR_192,
34 HASH_ALGO__LAST
35};
36
37#endif /* _UAPI_LINUX_HASH_INFO_H */
diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h
index c9b7f4faf97a..840cb990abe2 100644
--- a/include/uapi/linux/keyctl.h
+++ b/include/uapi/linux/keyctl.h
@@ -56,5 +56,6 @@
56#define KEYCTL_REJECT 19 /* reject a partially constructed key */ 56#define KEYCTL_REJECT 19 /* reject a partially constructed key */
57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ 57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */
58#define KEYCTL_INVALIDATE 21 /* invalidate a key */ 58#define KEYCTL_INVALIDATE 21 /* invalidate a key */
59#define KEYCTL_GET_PERSISTENT 22 /* get a user's persistent keyring */
59 60
60#endif /* _LINUX_KEYCTL_H */ 61#endif /* _LINUX_KEYCTL_H */
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 0890556f779e..4a98e85438a7 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -13,10 +13,10 @@
13 * PCI to PCI Bridge Specification 13 * PCI to PCI Bridge Specification
14 * PCI System Design Guide 14 * PCI System Design Guide
15 * 15 *
16 * For hypertransport information, please consult the following manuals 16 * For HyperTransport information, please consult the following manuals
17 * from http://www.hypertransport.org 17 * from http://www.hypertransport.org
18 * 18 *
19 * The Hypertransport I/O Link Specification 19 * The HyperTransport I/O Link Specification
20 */ 20 */
21 21
22#ifndef LINUX_PCI_REGS_H 22#ifndef LINUX_PCI_REGS_H
@@ -37,7 +37,7 @@
37#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ 37#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
38#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ 38#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
39#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ 39#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
40#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ 40#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
41#define PCI_COMMAND_SERR 0x100 /* Enable SERR */ 41#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
42#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ 42#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
43#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ 43#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
@@ -45,7 +45,7 @@
45#define PCI_STATUS 0x06 /* 16 bits */ 45#define PCI_STATUS 0x06 /* 16 bits */
46#define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */ 46#define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */
47#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ 47#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
48#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ 48#define PCI_STATUS_66MHZ 0x20 /* Support 66 MHz PCI 2.1 bus */
49#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ 49#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
50#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ 50#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
51#define PCI_STATUS_PARITY 0x100 /* Detected parity error */ 51#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
@@ -205,14 +205,14 @@
205#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 205#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
206#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 206#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
207#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ 207#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
208#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */ 208#define PCI_CAP_ID_VNDR 0x09 /* Vendor-Specific */
209#define PCI_CAP_ID_DBG 0x0A /* Debug port */ 209#define PCI_CAP_ID_DBG 0x0A /* Debug port */
210#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ 210#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */
211#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 211#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
212#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ 212#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */
213#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ 213#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */
214#define PCI_CAP_ID_SECDEV 0x0F /* Secure Device */ 214#define PCI_CAP_ID_SECDEV 0x0F /* Secure Device */
215#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 215#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
216#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 216#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
217#define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Conf. */ 217#define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Conf. */
218#define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ 218#define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */
@@ -268,8 +268,8 @@
268#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ 268#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
269#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ 269#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
270#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ 270#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
271#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ 271#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
272#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ 272#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
273#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ 273#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
274#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ 274#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */
275#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ 275#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */
@@ -321,7 +321,7 @@
321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ 321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */
322#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ 322#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */
323 323
324/* MSI-X entry's format */ 324/* MSI-X Table entry format */
325#define PCI_MSIX_ENTRY_SIZE 16 325#define PCI_MSIX_ENTRY_SIZE 16
326#define PCI_MSIX_ENTRY_LOWER_ADDR 0 326#define PCI_MSIX_ENTRY_LOWER_ADDR 0
327#define PCI_MSIX_ENTRY_UPPER_ADDR 4 327#define PCI_MSIX_ENTRY_UPPER_ADDR 4
@@ -372,7 +372,7 @@
372#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ 372#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */
373#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ 373#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */
374#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ 374#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */
375#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ 375#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */
376#define PCI_X_STATUS 4 /* PCI-X capabilities */ 376#define PCI_X_STATUS 4 /* PCI-X capabilities */
377#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ 377#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */
378#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ 378#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */
@@ -407,8 +407,8 @@
407 407
408/* PCI Bridge Subsystem ID registers */ 408/* PCI Bridge Subsystem ID registers */
409 409
410#define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */ 410#define PCI_SSVID_VENDOR_ID 4 /* PCI Bridge subsystem vendor ID */
411#define PCI_SSVID_DEVICE_ID 6 /* PCI-Bridge subsystem device id register */ 411#define PCI_SSVID_DEVICE_ID 6 /* PCI Bridge subsystem device ID */
412 412
413/* PCI Express capability registers */ 413/* PCI Express capability registers */
414 414
@@ -484,12 +484,12 @@
484#define PCI_EXP_LNKCTL_CLKREQ_EN 0x0100 /* Enable clkreq */ 484#define PCI_EXP_LNKCTL_CLKREQ_EN 0x0100 /* Enable clkreq */
485#define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */ 485#define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */
486#define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */ 486#define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */
487#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */ 487#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Link Autonomous Bandwidth Interrupt Enable */
488#define PCI_EXP_LNKSTA 18 /* Link Status */ 488#define PCI_EXP_LNKSTA 18 /* Link Status */
489#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ 489#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
490#define PCI_EXP_LNKSTA_CLS_2_5GB 0x0001 /* Current Link Speed 2.5GT/s */ 490#define PCI_EXP_LNKSTA_CLS_2_5GB 0x0001 /* Current Link Speed 2.5GT/s */
491#define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */ 491#define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */
492#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */ 492#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Negotiated Link Width */
493#define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */ 493#define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */
494#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ 494#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */
495#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ 495#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
@@ -593,7 +593,7 @@
593#define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function VC Capability */ 593#define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function VC Capability */
594#define PCI_EXT_CAP_ID_VC9 0x09 /* same as _VC */ 594#define PCI_EXT_CAP_ID_VC9 0x09 /* same as _VC */
595#define PCI_EXT_CAP_ID_RCRB 0x0A /* Root Complex RB? */ 595#define PCI_EXT_CAP_ID_RCRB 0x0A /* Root Complex RB? */
596#define PCI_EXT_CAP_ID_VNDR 0x0B /* Vendor Specific */ 596#define PCI_EXT_CAP_ID_VNDR 0x0B /* Vendor-Specific */
597#define PCI_EXT_CAP_ID_CAC 0x0C /* Config Access - obsolete */ 597#define PCI_EXT_CAP_ID_CAC 0x0C /* Config Access - obsolete */
598#define PCI_EXT_CAP_ID_ACS 0x0D /* Access Control Services */ 598#define PCI_EXT_CAP_ID_ACS 0x0D /* Access Control Services */
599#define PCI_EXT_CAP_ID_ARI 0x0E /* Alternate Routing ID */ 599#define PCI_EXT_CAP_ID_ARI 0x0E /* Alternate Routing ID */
@@ -602,12 +602,12 @@
602#define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virtualization */ 602#define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virtualization */
603#define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */ 603#define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */
604#define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */ 604#define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */
605#define PCI_EXT_CAP_ID_AMD_XXX 0x14 /* reserved for AMD */ 605#define PCI_EXT_CAP_ID_AMD_XXX 0x14 /* Reserved for AMD */
606#define PCI_EXT_CAP_ID_REBAR 0x15 /* resizable BAR */ 606#define PCI_EXT_CAP_ID_REBAR 0x15 /* Resizable BAR */
607#define PCI_EXT_CAP_ID_DPA 0x16 /* dynamic power alloc */ 607#define PCI_EXT_CAP_ID_DPA 0x16 /* Dynamic Power Allocation */
608#define PCI_EXT_CAP_ID_TPH 0x17 /* TPH request */ 608#define PCI_EXT_CAP_ID_TPH 0x17 /* TPH Requester */
609#define PCI_EXT_CAP_ID_LTR 0x18 /* latency tolerance reporting */ 609#define PCI_EXT_CAP_ID_LTR 0x18 /* Latency Tolerance Reporting */
610#define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCIe */ 610#define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCIe Capability */
611#define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */ 611#define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */
612#define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */ 612#define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */
613#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PASID 613#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PASID
@@ -667,9 +667,9 @@
667#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */ 667#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */
668/* Multi ERR_COR Received */ 668/* Multi ERR_COR Received */
669#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 669#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002
670/* ERR_FATAL/NONFATAL Recevied */ 670/* ERR_FATAL/NONFATAL Received */
671#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 671#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004
672/* Multi ERR_FATAL/NONFATAL Recevied */ 672/* Multi ERR_FATAL/NONFATAL Received */
673#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 673#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008
674#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ 674#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */
675#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ 675#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
@@ -678,7 +678,7 @@
678 678
679/* Virtual Channel */ 679/* Virtual Channel */
680#define PCI_VC_PORT_REG1 4 680#define PCI_VC_PORT_REG1 4
681#define PCI_VC_REG1_EVCC 0x7 /* extended vc count */ 681#define PCI_VC_REG1_EVCC 0x7 /* extended VC count */
682#define PCI_VC_PORT_REG2 8 682#define PCI_VC_PORT_REG2 8
683#define PCI_VC_REG2_32_PHASE 0x2 683#define PCI_VC_REG2_32_PHASE 0x2
684#define PCI_VC_REG2_64_PHASE 0x4 684#define PCI_VC_REG2_64_PHASE 0x4
@@ -711,7 +711,7 @@
711#define PCI_VNDR_HEADER_LEN(x) (((x) >> 20) & 0xfff) 711#define PCI_VNDR_HEADER_LEN(x) (((x) >> 20) & 0xfff)
712 712
713/* 713/*
714 * Hypertransport sub capability types 714 * HyperTransport sub capability types
715 * 715 *
716 * Unfortunately there are both 3 bit and 5 bit capability types defined 716 * Unfortunately there are both 3 bit and 5 bit capability types defined
717 * in the HT spec, catering for that is a little messy. You probably don't 717 * in the HT spec, catering for that is a little messy. You probably don't
@@ -739,8 +739,8 @@
739#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ 739#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */
740#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ 740#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */
741#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ 741#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */
742#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ 742#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 HyperTransport configuration */
743#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ 743#define HT_CAPTYPE_PM 0xE0 /* HyperTransport power management configuration */
744#define HT_CAP_SIZEOF_LONG 28 /* slave & primary */ 744#define HT_CAP_SIZEOF_LONG 28 /* slave & primary */
745#define HT_CAP_SIZEOF_SHORT 24 /* host & secondary */ 745#define HT_CAP_SIZEOF_SHORT 24 /* host & secondary */
746 746
@@ -777,14 +777,14 @@
777#define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ 777#define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */
778#define PCI_EXT_CAP_PRI_SIZEOF 16 778#define PCI_EXT_CAP_PRI_SIZEOF 16
779 779
780/* PASID capability */ 780/* Process Address Space ID */
781#define PCI_PASID_CAP 0x04 /* PASID feature register */ 781#define PCI_PASID_CAP 0x04 /* PASID feature register */
782#define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */ 782#define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */
783#define PCI_PASID_CAP_PRIV 0x04 /* Priviledge Mode Supported */ 783#define PCI_PASID_CAP_PRIV 0x04 /* Privilege Mode Supported */
784#define PCI_PASID_CTRL 0x06 /* PASID control register */ 784#define PCI_PASID_CTRL 0x06 /* PASID control register */
785#define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ 785#define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */
786#define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ 786#define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */
787#define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */ 787#define PCI_PASID_CTRL_PRIV 0x04 /* Privilege Mode Enable */
788#define PCI_EXT_CAP_PASID_SIZEOF 8 788#define PCI_EXT_CAP_PASID_SIZEOF 8
789 789
790/* Single Root I/O Virtualization */ 790/* Single Root I/O Virtualization */
@@ -839,22 +839,22 @@
839#define PCI_ACS_CTRL 0x06 /* ACS Control Register */ 839#define PCI_ACS_CTRL 0x06 /* ACS Control Register */
840#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ 840#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */
841 841
842#define PCI_VSEC_HDR 4 /* extended cap - vendor specific */ 842#define PCI_VSEC_HDR 4 /* extended cap - vendor-specific */
843#define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */ 843#define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */
844 844
845/* sata capability */ 845/* SATA capability */
846#define PCI_SATA_REGS 4 /* SATA REGs specifier */ 846#define PCI_SATA_REGS 4 /* SATA REGs specifier */
847#define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */ 847#define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */
848#define PCI_SATA_REGS_INLINE 0xF /* REGS in config space */ 848#define PCI_SATA_REGS_INLINE 0xF /* REGS in config space */
849#define PCI_SATA_SIZEOF_SHORT 8 849#define PCI_SATA_SIZEOF_SHORT 8
850#define PCI_SATA_SIZEOF_LONG 16 850#define PCI_SATA_SIZEOF_LONG 16
851 851
852/* resizable BARs */ 852/* Resizable BARs */
853#define PCI_REBAR_CTRL 8 /* control register */ 853#define PCI_REBAR_CTRL 8 /* control register */
854#define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # bars */ 854#define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # bars */
855#define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # bars */ 855#define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # bars */
856 856
857/* dynamic power allocation */ 857/* Dynamic Power Allocation */
858#define PCI_DPA_CAP 4 /* capability register */ 858#define PCI_DPA_CAP 4 /* capability register */
859#define PCI_DPA_CAP_SUBSTATE_MASK 0x1F /* # substates - 1 */ 859#define PCI_DPA_CAP_SUBSTATE_MASK 0x1F /* # substates - 1 */
860#define PCI_DPA_BASE_SIZEOF 16 /* size with 0 substates */ 860#define PCI_DPA_BASE_SIZEOF 16 /* size with 0 substates */