diff options
| author | Jason Gunthorpe <jgg@mellanox.com> | 2018-08-16 16:13:03 -0400 |
|---|---|---|
| committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-08-16 16:21:29 -0400 |
| commit | 0a3173a5f09bc58a3638ecfd0a80bdbae55e123c (patch) | |
| tree | d6c0bc84863cca54dfbde3b7463e5d49c82af9f1 /include/linux | |
| parent | 92f4e77c85918eab5e5803d7e28ab89a7e6bd3a2 (diff) | |
| parent | 5c60a7389d795e001c8748b458eb76e3a5b6008c (diff) | |
Merge branch 'linus/master' into rdma.git for-next
rdma.git merge resolution for the 4.19 merge window
Conflicts:
drivers/infiniband/core/rdma_core.c
- Use the rdma code and revise with the new spelling for
atomic_fetch_add_unless
drivers/nvme/host/rdma.c
- Replace max_sge with max_send_sge in new blk code
drivers/nvme/target/rdma.c
- Use the blk code and revise to use NULL for ib_post_recv when
appropriate
- Replace max_sge with max_recv_sge in new blk code
net/rds/ib_send.c
- Use the net code and revise to use NULL for ib_post_recv when
appropriate
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'include/linux')
183 files changed, 4208 insertions, 1447 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index e54f40974eb0..de8d3d3fa651 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -1058,27 +1058,20 @@ static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) | |||
| 1058 | 1058 | ||
| 1059 | /* Device properties */ | 1059 | /* Device properties */ |
| 1060 | 1060 | ||
| 1061 | #define MAX_ACPI_REFERENCE_ARGS 8 | ||
| 1062 | struct acpi_reference_args { | ||
| 1063 | struct acpi_device *adev; | ||
| 1064 | size_t nargs; | ||
| 1065 | u64 args[MAX_ACPI_REFERENCE_ARGS]; | ||
| 1066 | }; | ||
| 1067 | |||
| 1068 | #ifdef CONFIG_ACPI | 1061 | #ifdef CONFIG_ACPI |
| 1069 | int acpi_dev_get_property(const struct acpi_device *adev, const char *name, | 1062 | int acpi_dev_get_property(const struct acpi_device *adev, const char *name, |
| 1070 | acpi_object_type type, const union acpi_object **obj); | 1063 | acpi_object_type type, const union acpi_object **obj); |
| 1071 | int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, | 1064 | int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
| 1072 | const char *name, size_t index, size_t num_args, | 1065 | const char *name, size_t index, size_t num_args, |
| 1073 | struct acpi_reference_args *args); | 1066 | struct fwnode_reference_args *args); |
| 1074 | 1067 | ||
| 1075 | static inline int acpi_node_get_property_reference( | 1068 | static inline int acpi_node_get_property_reference( |
| 1076 | const struct fwnode_handle *fwnode, | 1069 | const struct fwnode_handle *fwnode, |
| 1077 | const char *name, size_t index, | 1070 | const char *name, size_t index, |
| 1078 | struct acpi_reference_args *args) | 1071 | struct fwnode_reference_args *args) |
| 1079 | { | 1072 | { |
| 1080 | return __acpi_node_get_property_reference(fwnode, name, index, | 1073 | return __acpi_node_get_property_reference(fwnode, name, index, |
| 1081 | MAX_ACPI_REFERENCE_ARGS, args); | 1074 | NR_FWNODE_REFERENCE_ARGS, args); |
| 1082 | } | 1075 | } |
| 1083 | 1076 | ||
| 1084 | int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname, | 1077 | int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname, |
| @@ -1096,14 +1089,6 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, | |||
| 1096 | struct fwnode_handle *child); | 1089 | struct fwnode_handle *child); |
| 1097 | struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode); | 1090 | struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode); |
| 1098 | 1091 | ||
| 1099 | struct fwnode_handle * | ||
| 1100 | acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode, | ||
| 1101 | struct fwnode_handle *prev); | ||
| 1102 | int acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode, | ||
| 1103 | struct fwnode_handle **remote, | ||
| 1104 | struct fwnode_handle **port, | ||
| 1105 | struct fwnode_handle **endpoint); | ||
| 1106 | |||
| 1107 | struct acpi_probe_entry; | 1092 | struct acpi_probe_entry; |
| 1108 | typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *, | 1093 | typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *, |
| 1109 | struct acpi_probe_entry *); | 1094 | struct acpi_probe_entry *); |
| @@ -1169,7 +1154,7 @@ static inline int acpi_dev_get_property(struct acpi_device *adev, | |||
| 1169 | static inline int | 1154 | static inline int |
| 1170 | __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, | 1155 | __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
| 1171 | const char *name, size_t index, size_t num_args, | 1156 | const char *name, size_t index, size_t num_args, |
| 1172 | struct acpi_reference_args *args) | 1157 | struct fwnode_reference_args *args) |
| 1173 | { | 1158 | { |
| 1174 | return -ENXIO; | 1159 | return -ENXIO; |
| 1175 | } | 1160 | } |
| @@ -1177,7 +1162,7 @@ __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, | |||
| 1177 | static inline int | 1162 | static inline int |
| 1178 | acpi_node_get_property_reference(const struct fwnode_handle *fwnode, | 1163 | acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
| 1179 | const char *name, size_t index, | 1164 | const char *name, size_t index, |
| 1180 | struct acpi_reference_args *args) | 1165 | struct fwnode_reference_args *args) |
| 1181 | { | 1166 | { |
| 1182 | return -ENXIO; | 1167 | return -ENXIO; |
| 1183 | } | 1168 | } |
diff --git a/include/linux/ascii85.h b/include/linux/ascii85.h new file mode 100644 index 000000000000..4cc40201273e --- /dev/null +++ b/include/linux/ascii85.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* | ||
| 2 | * SPDX-License-Identifier: GPL-2.0 | ||
| 3 | * | ||
| 4 | * Copyright (c) 2008 Intel Corporation | ||
| 5 | * Copyright (c) 2018 The Linux Foundation. All rights reserved. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef _ASCII85_H_ | ||
| 9 | #define _ASCII85_H_ | ||
| 10 | |||
| 11 | #include <linux/kernel.h> | ||
| 12 | |||
| 13 | #define ASCII85_BUFSZ 6 | ||
| 14 | |||
| 15 | static inline long | ||
| 16 | ascii85_encode_len(long len) | ||
| 17 | { | ||
| 18 | return DIV_ROUND_UP(len, 4); | ||
| 19 | } | ||
| 20 | |||
| 21 | static inline const char * | ||
| 22 | ascii85_encode(u32 in, char *out) | ||
| 23 | { | ||
| 24 | int i; | ||
| 25 | |||
| 26 | if (in == 0) | ||
| 27 | return "z"; | ||
| 28 | |||
| 29 | out[5] = '\0'; | ||
| 30 | for (i = 5; i--; ) { | ||
| 31 | out[i] = '!' + in % 85; | ||
| 32 | in /= 85; | ||
| 33 | } | ||
| 34 | |||
| 35 | return out; | ||
| 36 | } | ||
| 37 | |||
| 38 | #endif | ||
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 01ce3997cb42..1e8e88bdaf09 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | /* Atomic operations usable in machine independent code */ | 2 | /* Atomic operations usable in machine independent code */ |
| 3 | #ifndef _LINUX_ATOMIC_H | 3 | #ifndef _LINUX_ATOMIC_H |
| 4 | #define _LINUX_ATOMIC_H | 4 | #define _LINUX_ATOMIC_H |
| 5 | #include <linux/types.h> | ||
| 6 | |||
| 5 | #include <asm/atomic.h> | 7 | #include <asm/atomic.h> |
| 6 | #include <asm/barrier.h> | 8 | #include <asm/barrier.h> |
| 7 | 9 | ||
| @@ -36,40 +38,46 @@ | |||
| 36 | * barriers on top of the relaxed variant. In the case where the relaxed | 38 | * barriers on top of the relaxed variant. In the case where the relaxed |
| 37 | * variant is already fully ordered, no additional barriers are needed. | 39 | * variant is already fully ordered, no additional barriers are needed. |
| 38 | * | 40 | * |
| 39 | * Besides, if an arch has a special barrier for acquire/release, it could | 41 | * If an architecture overrides __atomic_acquire_fence() it will probably |
| 40 | * implement its own __atomic_op_* and use the same framework for building | 42 | * want to define smp_mb__after_spinlock(). |
| 41 | * variants | ||
| 42 | * | ||
| 43 | * If an architecture overrides __atomic_op_acquire() it will probably want | ||
| 44 | * to define smp_mb__after_spinlock(). | ||
| 45 | */ | 43 | */ |
| 46 | #ifndef __atomic_op_acquire | 44 | #ifndef __atomic_acquire_fence |
| 45 | #define __atomic_acquire_fence smp_mb__after_atomic | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #ifndef __atomic_release_fence | ||
| 49 | #define __atomic_release_fence smp_mb__before_atomic | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #ifndef __atomic_pre_full_fence | ||
| 53 | #define __atomic_pre_full_fence smp_mb__before_atomic | ||
| 54 | #endif | ||
| 55 | |||
| 56 | #ifndef __atomic_post_full_fence | ||
| 57 | #define __atomic_post_full_fence smp_mb__after_atomic | ||
| 58 | #endif | ||
| 59 | |||
| 47 | #define __atomic_op_acquire(op, args...) \ | 60 | #define __atomic_op_acquire(op, args...) \ |
| 48 | ({ \ | 61 | ({ \ |
| 49 | typeof(op##_relaxed(args)) __ret = op##_relaxed(args); \ | 62 | typeof(op##_relaxed(args)) __ret = op##_relaxed(args); \ |
| 50 | smp_mb__after_atomic(); \ | 63 | __atomic_acquire_fence(); \ |
| 51 | __ret; \ | 64 | __ret; \ |
| 52 | }) | 65 | }) |
| 53 | #endif | ||
| 54 | 66 | ||
| 55 | #ifndef __atomic_op_release | ||
| 56 | #define __atomic_op_release(op, args...) \ | 67 | #define __atomic_op_release(op, args...) \ |
| 57 | ({ \ | 68 | ({ \ |
| 58 | smp_mb__before_atomic(); \ | 69 | __atomic_release_fence(); \ |
| 59 | op##_relaxed(args); \ | 70 | op##_relaxed(args); \ |
| 60 | }) | 71 | }) |
| 61 | #endif | ||
| 62 | 72 | ||
| 63 | #ifndef __atomic_op_fence | ||
| 64 | #define __atomic_op_fence(op, args...) \ | 73 | #define __atomic_op_fence(op, args...) \ |
| 65 | ({ \ | 74 | ({ \ |
| 66 | typeof(op##_relaxed(args)) __ret; \ | 75 | typeof(op##_relaxed(args)) __ret; \ |
| 67 | smp_mb__before_atomic(); \ | 76 | __atomic_pre_full_fence(); \ |
| 68 | __ret = op##_relaxed(args); \ | 77 | __ret = op##_relaxed(args); \ |
| 69 | smp_mb__after_atomic(); \ | 78 | __atomic_post_full_fence(); \ |
| 70 | __ret; \ | 79 | __ret; \ |
| 71 | }) | 80 | }) |
| 72 | #endif | ||
| 73 | 81 | ||
| 74 | /* atomic_add_return_relaxed */ | 82 | /* atomic_add_return_relaxed */ |
| 75 | #ifndef atomic_add_return_relaxed | 83 | #ifndef atomic_add_return_relaxed |
| @@ -95,11 +103,23 @@ | |||
| 95 | #endif | 103 | #endif |
| 96 | #endif /* atomic_add_return_relaxed */ | 104 | #endif /* atomic_add_return_relaxed */ |
| 97 | 105 | ||
| 106 | #ifndef atomic_inc | ||
| 107 | #define atomic_inc(v) atomic_add(1, (v)) | ||
| 108 | #endif | ||
| 109 | |||
| 98 | /* atomic_inc_return_relaxed */ | 110 | /* atomic_inc_return_relaxed */ |
| 99 | #ifndef atomic_inc_return_relaxed | 111 | #ifndef atomic_inc_return_relaxed |
| 112 | |||
| 113 | #ifndef atomic_inc_return | ||
| 114 | #define atomic_inc_return(v) atomic_add_return(1, (v)) | ||
| 115 | #define atomic_inc_return_relaxed(v) atomic_add_return_relaxed(1, (v)) | ||
| 116 | #define atomic_inc_return_acquire(v) atomic_add_return_acquire(1, (v)) | ||
| 117 | #define atomic_inc_return_release(v) atomic_add_return_release(1, (v)) | ||
| 118 | #else /* atomic_inc_return */ | ||
| 100 | #define atomic_inc_return_relaxed atomic_inc_return | 119 | #define atomic_inc_return_relaxed atomic_inc_return |
| 101 | #define atomic_inc_return_acquire atomic_inc_return | 120 | #define atomic_inc_return_acquire atomic_inc_return |
| 102 | #define atomic_inc_return_release atomic_inc_return | 121 | #define atomic_inc_return_release atomic_inc_return |
| 122 | #endif /* atomic_inc_return */ | ||
| 103 | 123 | ||
| 104 | #else /* atomic_inc_return_relaxed */ | 124 | #else /* atomic_inc_return_relaxed */ |
| 105 | 125 | ||
| @@ -143,11 +163,23 @@ | |||
| 143 | #endif | 163 | #endif |
| 144 | #endif /* atomic_sub_return_relaxed */ | 164 | #endif /* atomic_sub_return_relaxed */ |
| 145 | 165 | ||
| 166 | #ifndef atomic_dec | ||
| 167 | #define atomic_dec(v) atomic_sub(1, (v)) | ||
| 168 | #endif | ||
| 169 | |||
| 146 | /* atomic_dec_return_relaxed */ | 170 | /* atomic_dec_return_relaxed */ |
| 147 | #ifndef atomic_dec_return_relaxed | 171 | #ifndef atomic_dec_return_relaxed |
| 172 | |||
| 173 | #ifndef atomic_dec_return | ||
| 174 | #define atomic_dec_return(v) atomic_sub_return(1, (v)) | ||
| 175 | #define atomic_dec_return_relaxed(v) atomic_sub_return_relaxed(1, (v)) | ||
| 176 | #define atomic_dec_return_acquire(v) atomic_sub_return_acquire(1, (v)) | ||
| 177 | #define atomic_dec_return_release(v) atomic_sub_return_release(1, (v)) | ||
| 178 | #else /* atomic_dec_return */ | ||
| 148 | #define atomic_dec_return_relaxed atomic_dec_return | 179 | #define atomic_dec_return_relaxed atomic_dec_return |
| 149 | #define atomic_dec_return_acquire atomic_dec_return | 180 | #define atomic_dec_return_acquire atomic_dec_return |
| 150 | #define atomic_dec_return_release atomic_dec_return | 181 | #define atomic_dec_return_release atomic_dec_return |
| 182 | #endif /* atomic_dec_return */ | ||
| 151 | 183 | ||
| 152 | #else /* atomic_dec_return_relaxed */ | 184 | #else /* atomic_dec_return_relaxed */ |
| 153 | 185 | ||
| @@ -328,12 +360,22 @@ | |||
| 328 | #endif | 360 | #endif |
| 329 | #endif /* atomic_fetch_and_relaxed */ | 361 | #endif /* atomic_fetch_and_relaxed */ |
| 330 | 362 | ||
| 331 | #ifdef atomic_andnot | 363 | #ifndef atomic_andnot |
| 332 | /* atomic_fetch_andnot_relaxed */ | 364 | #define atomic_andnot(i, v) atomic_and(~(int)(i), (v)) |
| 365 | #endif | ||
| 366 | |||
| 333 | #ifndef atomic_fetch_andnot_relaxed | 367 | #ifndef atomic_fetch_andnot_relaxed |
| 334 | #define atomic_fetch_andnot_relaxed atomic_fetch_andnot | 368 | |
| 335 | #define atomic_fetch_andnot_acquire atomic_fetch_andnot | 369 | #ifndef atomic_fetch_andnot |
| 336 | #define atomic_fetch_andnot_release atomic_fetch_andnot | 370 | #define atomic_fetch_andnot(i, v) atomic_fetch_and(~(int)(i), (v)) |
| 371 | #define atomic_fetch_andnot_relaxed(i, v) atomic_fetch_and_relaxed(~(int)(i), (v)) | ||
| 372 | #define atomic_fetch_andnot_acquire(i, v) atomic_fetch_and_acquire(~(int)(i), (v)) | ||
| 373 | #define atomic_fetch_andnot_release(i, v) atomic_fetch_and_release(~(int)(i), (v)) | ||
| 374 | #else /* atomic_fetch_andnot */ | ||
| 375 | #define atomic_fetch_andnot_relaxed atomic_fetch_andnot | ||
| 376 | #define atomic_fetch_andnot_acquire atomic_fetch_andnot | ||
| 377 | #define atomic_fetch_andnot_release atomic_fetch_andnot | ||
| 378 | #endif /* atomic_fetch_andnot */ | ||
| 337 | 379 | ||
| 338 | #else /* atomic_fetch_andnot_relaxed */ | 380 | #else /* atomic_fetch_andnot_relaxed */ |
| 339 | 381 | ||
| @@ -352,7 +394,6 @@ | |||
| 352 | __atomic_op_fence(atomic_fetch_andnot, __VA_ARGS__) | 394 | __atomic_op_fence(atomic_fetch_andnot, __VA_ARGS__) |
| 353 | #endif | 395 | #endif |
| 354 | #endif /* atomic_fetch_andnot_relaxed */ | 396 | #endif /* atomic_fetch_andnot_relaxed */ |
| 355 | #endif /* atomic_andnot */ | ||
| 356 | 397 | ||
| 357 | /* atomic_fetch_xor_relaxed */ | 398 | /* atomic_fetch_xor_relaxed */ |
| 358 | #ifndef atomic_fetch_xor_relaxed | 399 | #ifndef atomic_fetch_xor_relaxed |
| @@ -520,112 +561,140 @@ | |||
| 520 | #endif /* xchg_relaxed */ | 561 | #endif /* xchg_relaxed */ |
| 521 | 562 | ||
| 522 | /** | 563 | /** |
| 564 | * atomic_fetch_add_unless - add unless the number is already a given value | ||
| 565 | * @v: pointer of type atomic_t | ||
| 566 | * @a: the amount to add to v... | ||
| 567 | * @u: ...unless v is equal to u. | ||
| 568 | * | ||
| 569 | * Atomically adds @a to @v, if @v was not already @u. | ||
| 570 | * Returns the original value of @v. | ||
| 571 | */ | ||
| 572 | #ifndef atomic_fetch_add_unless | ||
| 573 | static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u) | ||
| 574 | { | ||
| 575 | int c = atomic_read(v); | ||
| 576 | |||
| 577 | do { | ||
| 578 | if (unlikely(c == u)) | ||
| 579 | break; | ||
| 580 | } while (!atomic_try_cmpxchg(v, &c, c + a)); | ||
| 581 | |||
| 582 | return c; | ||
| 583 | } | ||
| 584 | #endif | ||
| 585 | |||
| 586 | /** | ||
| 523 | * atomic_add_unless - add unless the number is already a given value | 587 | * atomic_add_unless - add unless the number is already a given value |
| 524 | * @v: pointer of type atomic_t | 588 | * @v: pointer of type atomic_t |
| 525 | * @a: the amount to add to v... | 589 | * @a: the amount to add to v... |
| 526 | * @u: ...unless v is equal to u. | 590 | * @u: ...unless v is equal to u. |
| 527 | * | 591 | * |
| 528 | * Atomically adds @a to @v, so long as @v was not already @u. | 592 | * Atomically adds @a to @v, if @v was not already @u. |
| 529 | * Returns non-zero if @v was not @u, and zero otherwise. | 593 | * Returns true if the addition was done. |
| 530 | */ | 594 | */ |
| 531 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | 595 | static inline bool atomic_add_unless(atomic_t *v, int a, int u) |
| 532 | { | 596 | { |
| 533 | return __atomic_add_unless(v, a, u) != u; | 597 | return atomic_fetch_add_unless(v, a, u) != u; |
| 534 | } | 598 | } |
| 535 | 599 | ||
| 536 | /** | 600 | /** |
| 537 | * atomic_inc_not_zero - increment unless the number is zero | 601 | * atomic_inc_not_zero - increment unless the number is zero |
| 538 | * @v: pointer of type atomic_t | 602 | * @v: pointer of type atomic_t |
| 539 | * | 603 | * |
| 540 | * Atomically increments @v by 1, so long as @v is non-zero. | 604 | * Atomically increments @v by 1, if @v is non-zero. |
| 541 | * Returns non-zero if @v was non-zero, and zero otherwise. | 605 | * Returns true if the increment was done. |
| 542 | */ | 606 | */ |
| 543 | #ifndef atomic_inc_not_zero | 607 | #ifndef atomic_inc_not_zero |
| 544 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 608 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
| 545 | #endif | 609 | #endif |
| 546 | 610 | ||
| 547 | #ifndef atomic_andnot | 611 | /** |
| 548 | static inline void atomic_andnot(int i, atomic_t *v) | 612 | * atomic_inc_and_test - increment and test |
| 549 | { | 613 | * @v: pointer of type atomic_t |
| 550 | atomic_and(~i, v); | 614 | * |
| 551 | } | 615 | * Atomically increments @v by 1 |
| 552 | 616 | * and returns true if the result is zero, or false for all | |
| 553 | static inline int atomic_fetch_andnot(int i, atomic_t *v) | 617 | * other cases. |
| 554 | { | 618 | */ |
| 555 | return atomic_fetch_and(~i, v); | 619 | #ifndef atomic_inc_and_test |
| 556 | } | 620 | static inline bool atomic_inc_and_test(atomic_t *v) |
| 557 | |||
| 558 | static inline int atomic_fetch_andnot_relaxed(int i, atomic_t *v) | ||
| 559 | { | 621 | { |
| 560 | return atomic_fetch_and_relaxed(~i, v); | 622 | return atomic_inc_return(v) == 0; |
| 561 | } | 623 | } |
| 624 | #endif | ||
| 562 | 625 | ||
| 563 | static inline int atomic_fetch_andnot_acquire(int i, atomic_t *v) | 626 | /** |
| 627 | * atomic_dec_and_test - decrement and test | ||
| 628 | * @v: pointer of type atomic_t | ||
| 629 | * | ||
| 630 | * Atomically decrements @v by 1 and | ||
| 631 | * returns true if the result is 0, or false for all other | ||
| 632 | * cases. | ||
| 633 | */ | ||
| 634 | #ifndef atomic_dec_and_test | ||
| 635 | static inline bool atomic_dec_and_test(atomic_t *v) | ||
| 564 | { | 636 | { |
| 565 | return atomic_fetch_and_acquire(~i, v); | 637 | return atomic_dec_return(v) == 0; |
| 566 | } | 638 | } |
| 639 | #endif | ||
| 567 | 640 | ||
| 568 | static inline int atomic_fetch_andnot_release(int i, atomic_t *v) | 641 | /** |
| 642 | * atomic_sub_and_test - subtract value from variable and test result | ||
| 643 | * @i: integer value to subtract | ||
| 644 | * @v: pointer of type atomic_t | ||
| 645 | * | ||
| 646 | * Atomically subtracts @i from @v and returns | ||
| 647 | * true if the result is zero, or false for all | ||
| 648 | * other cases. | ||
| 649 | */ | ||
| 650 | #ifndef atomic_sub_and_test | ||
| 651 | static inline bool atomic_sub_and_test(int i, atomic_t *v) | ||
| 569 | { | 652 | { |
| 570 | return atomic_fetch_and_release(~i, v); | 653 | return atomic_sub_return(i, v) == 0; |
| 571 | } | 654 | } |
| 572 | #endif | 655 | #endif |
| 573 | 656 | ||
| 574 | /** | 657 | /** |
| 575 | * atomic_inc_not_zero_hint - increment if not null | 658 | * atomic_add_negative - add and test if negative |
| 659 | * @i: integer value to add | ||
| 576 | * @v: pointer of type atomic_t | 660 | * @v: pointer of type atomic_t |
| 577 | * @hint: probable value of the atomic before the increment | ||
| 578 | * | ||
| 579 | * This version of atomic_inc_not_zero() gives a hint of probable | ||
| 580 | * value of the atomic. This helps processor to not read the memory | ||
| 581 | * before doing the atomic read/modify/write cycle, lowering | ||
| 582 | * number of bus transactions on some arches. | ||
| 583 | * | 661 | * |
| 584 | * Returns: 0 if increment was not done, 1 otherwise. | 662 | * Atomically adds @i to @v and returns true |
| 663 | * if the result is negative, or false when | ||
| 664 | * result is greater than or equal to zero. | ||
| 585 | */ | 665 | */ |
| 586 | #ifndef atomic_inc_not_zero_hint | 666 | #ifndef atomic_add_negative |
| 587 | static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint) | 667 | static inline bool atomic_add_negative(int i, atomic_t *v) |
| 588 | { | 668 | { |
| 589 | int val, c = hint; | 669 | return atomic_add_return(i, v) < 0; |
| 590 | |||
| 591 | /* sanity test, should be removed by compiler if hint is a constant */ | ||
| 592 | if (!hint) | ||
| 593 | return atomic_inc_not_zero(v); | ||
| 594 | |||
| 595 | do { | ||
| 596 | val = atomic_cmpxchg(v, c, c + 1); | ||
| 597 | if (val == c) | ||
| 598 | return 1; | ||
| 599 | c = val; | ||
| 600 | } while (c); | ||
| 601 | |||
| 602 | return 0; | ||
| 603 | } | 670 | } |
| 604 | #endif | 671 | #endif |
| 605 | 672 | ||
| 606 | #ifndef atomic_inc_unless_negative | 673 | #ifndef atomic_inc_unless_negative |
| 607 | static inline int atomic_inc_unless_negative(atomic_t *p) | 674 | static inline bool atomic_inc_unless_negative(atomic_t *v) |
| 608 | { | 675 | { |
| 609 | int v, v1; | 676 | int c = atomic_read(v); |
| 610 | for (v = 0; v >= 0; v = v1) { | 677 | |
| 611 | v1 = atomic_cmpxchg(p, v, v + 1); | 678 | do { |
| 612 | if (likely(v1 == v)) | 679 | if (unlikely(c < 0)) |
| 613 | return 1; | 680 | return false; |
| 614 | } | 681 | } while (!atomic_try_cmpxchg(v, &c, c + 1)); |
| 615 | return 0; | 682 | |
| 683 | return true; | ||
| 616 | } | 684 | } |
| 617 | #endif | 685 | #endif |
| 618 | 686 | ||
| 619 | #ifndef atomic_dec_unless_positive | 687 | #ifndef atomic_dec_unless_positive |
| 620 | static inline int atomic_dec_unless_positive(atomic_t *p) | 688 | static inline bool atomic_dec_unless_positive(atomic_t *v) |
| 621 | { | 689 | { |
| 622 | int v, v1; | 690 | int c = atomic_read(v); |
| 623 | for (v = 0; v <= 0; v = v1) { | 691 | |
| 624 | v1 = atomic_cmpxchg(p, v, v - 1); | 692 | do { |
| 625 | if (likely(v1 == v)) | 693 | if (unlikely(c > 0)) |
| 626 | return 1; | 694 | return false; |
| 627 | } | 695 | } while (!atomic_try_cmpxchg(v, &c, c - 1)); |
| 628 | return 0; | 696 | |
| 697 | return true; | ||
| 629 | } | 698 | } |
| 630 | #endif | 699 | #endif |
| 631 | 700 | ||
| @@ -639,17 +708,14 @@ static inline int atomic_dec_unless_positive(atomic_t *p) | |||
| 639 | #ifndef atomic_dec_if_positive | 708 | #ifndef atomic_dec_if_positive |
| 640 | static inline int atomic_dec_if_positive(atomic_t *v) | 709 | static inline int atomic_dec_if_positive(atomic_t *v) |
| 641 | { | 710 | { |
| 642 | int c, old, dec; | 711 | int dec, c = atomic_read(v); |
| 643 | c = atomic_read(v); | 712 | |
| 644 | for (;;) { | 713 | do { |
| 645 | dec = c - 1; | 714 | dec = c - 1; |
| 646 | if (unlikely(dec < 0)) | 715 | if (unlikely(dec < 0)) |
| 647 | break; | 716 | break; |
| 648 | old = atomic_cmpxchg((v), c, dec); | 717 | } while (!atomic_try_cmpxchg(v, &c, dec)); |
| 649 | if (likely(old == c)) | 718 | |
| 650 | break; | ||
| 651 | c = old; | ||
| 652 | } | ||
| 653 | return dec; | 719 | return dec; |
| 654 | } | 720 | } |
| 655 | #endif | 721 | #endif |
| @@ -693,11 +759,23 @@ static inline int atomic_dec_if_positive(atomic_t *v) | |||
| 693 | #endif | 759 | #endif |
| 694 | #endif /* atomic64_add_return_relaxed */ | 760 | #endif /* atomic64_add_return_relaxed */ |
| 695 | 761 | ||
| 762 | #ifndef atomic64_inc | ||
| 763 | #define atomic64_inc(v) atomic64_add(1, (v)) | ||
| 764 | #endif | ||
| 765 | |||
| 696 | /* atomic64_inc_return_relaxed */ | 766 | /* atomic64_inc_return_relaxed */ |
| 697 | #ifndef atomic64_inc_return_relaxed | 767 | #ifndef atomic64_inc_return_relaxed |
| 768 | |||
| 769 | #ifndef atomic64_inc_return | ||
| 770 | #define atomic64_inc_return(v) atomic64_add_return(1, (v)) | ||
| 771 | #define atomic64_inc_return_relaxed(v) atomic64_add_return_relaxed(1, (v)) | ||
| 772 | #define atomic64_inc_return_acquire(v) atomic64_add_return_acquire(1, (v)) | ||
| 773 | #define atomic64_inc_return_release(v) atomic64_add_return_release(1, (v)) | ||
| 774 | #else /* atomic64_inc_return */ | ||
| 698 | #define atomic64_inc_return_relaxed atomic64_inc_return | 775 | #define atomic64_inc_return_relaxed atomic64_inc_return |
| 699 | #define atomic64_inc_return_acquire atomic64_inc_return | 776 | #define atomic64_inc_return_acquire atomic64_inc_return |
| 700 | #define atomic64_inc_return_release atomic64_inc_return | 777 | #define atomic64_inc_return_release atomic64_inc_return |
| 778 | #endif /* atomic64_inc_return */ | ||
| 701 | 779 | ||
| 702 | #else /* atomic64_inc_return_relaxed */ | 780 | #else /* atomic64_inc_return_relaxed */ |
| 703 | 781 | ||
| @@ -742,11 +820,23 @@ static inline int atomic_dec_if_positive(atomic_t *v) | |||
| 742 | #endif | 820 | #endif |
| 743 | #endif /* atomic64_sub_return_relaxed */ | 821 | #endif /* atomic64_sub_return_relaxed */ |
| 744 | 822 | ||
| 823 | #ifndef atomic64_dec | ||
| 824 | #define atomic64_dec(v) atomic64_sub(1, (v)) | ||
| 825 | #endif | ||
| 826 | |||
| 745 | /* atomic64_dec_return_relaxed */ | 827 | /* atomic64_dec_return_relaxed */ |
| 746 | #ifndef atomic64_dec_return_relaxed | 828 | #ifndef atomic64_dec_return_relaxed |
| 829 | |||
| 830 | #ifndef atomic64_dec_return | ||
| 831 | #define atomic64_dec_return(v) atomic64_sub_return(1, (v)) | ||
| 832 | #define atomic64_dec_return_relaxed(v) atomic64_sub_return_relaxed(1, (v)) | ||
| 833 | #define atomic64_dec_return_acquire(v) atomic64_sub_return_acquire(1, (v)) | ||
| 834 | #define atomic64_dec_return_release(v) atomic64_sub_return_release(1, (v)) | ||
| 835 | #else /* atomic64_dec_return */ | ||
| 747 | #define atomic64_dec_return_relaxed atomic64_dec_return | 836 | #define atomic64_dec_return_relaxed atomic64_dec_return |
| 748 | #define atomic64_dec_return_acquire atomic64_dec_return | 837 | #define atomic64_dec_return_acquire atomic64_dec_return |
| 749 | #define atomic64_dec_return_release atomic64_dec_return | 838 | #define atomic64_dec_return_release atomic64_dec_return |
| 839 | #endif /* atomic64_dec_return */ | ||
| 750 | 840 | ||
| 751 | #else /* atomic64_dec_return_relaxed */ | 841 | #else /* atomic64_dec_return_relaxed */ |
| 752 | 842 | ||
| @@ -927,12 +1017,22 @@ static inline int atomic_dec_if_positive(atomic_t *v) | |||
| 927 | #endif | 1017 | #endif |
| 928 | #endif /* atomic64_fetch_and_relaxed */ | 1018 | #endif /* atomic64_fetch_and_relaxed */ |
| 929 | 1019 | ||
| 930 | #ifdef atomic64_andnot | 1020 | #ifndef atomic64_andnot |
| 931 | /* atomic64_fetch_andnot_relaxed */ | 1021 | #define atomic64_andnot(i, v) atomic64_and(~(long long)(i), (v)) |
| 1022 | #endif | ||
| 1023 | |||
| 932 | #ifndef atomic64_fetch_andnot_relaxed | 1024 | #ifndef atomic64_fetch_andnot_relaxed |
| 933 | #define atomic64_fetch_andnot_relaxed atomic64_fetch_andnot | 1025 | |
| 934 | #define atomic64_fetch_andnot_acquire atomic64_fetch_andnot | 1026 | #ifndef atomic64_fetch_andnot |
| 935 | #define atomic64_fetch_andnot_release atomic64_fetch_andnot | 1027 | #define atomic64_fetch_andnot(i, v) atomic64_fetch_and(~(long long)(i), (v)) |
| 1028 | #define atomic64_fetch_andnot_relaxed(i, v) atomic64_fetch_and_relaxed(~(long long)(i), (v)) | ||
| 1029 | #define atomic64_fetch_andnot_acquire(i, v) atomic64_fetch_and_acquire(~(long long)(i), (v)) | ||
| 1030 | #define atomic64_fetch_andnot_release(i, v) atomic64_fetch_and_release(~(long long)(i), (v)) | ||
| 1031 | #else /* atomic64_fetch_andnot */ | ||
| 1032 | #define atomic64_fetch_andnot_relaxed atomic64_fetch_andnot | ||
| 1033 | #define atomic64_fetch_andnot_acquire atomic64_fetch_andnot | ||
| 1034 | #define atomic64_fetch_andnot_release atomic64_fetch_andnot | ||
| 1035 | #endif /* atomic64_fetch_andnot */ | ||
| 936 | 1036 | ||
| 937 | #else /* atomic64_fetch_andnot_relaxed */ | 1037 | #else /* atomic64_fetch_andnot_relaxed */ |
| 938 | 1038 | ||
| @@ -951,7 +1051,6 @@ static inline int atomic_dec_if_positive(atomic_t *v) | |||
| 951 | __atomic_op_fence(atomic64_fetch_andnot, __VA_ARGS__) | 1051 | __atomic_op_fence(atomic64_fetch_andnot, __VA_ARGS__) |
| 952 | #endif | 1052 | #endif |
| 953 | #endif /* atomic64_fetch_andnot_relaxed */ | 1053 | #endif /* atomic64_fetch_andnot_relaxed */ |
| 954 | #endif /* atomic64_andnot */ | ||
| 955 | 1054 | ||
| 956 | /* atomic64_fetch_xor_relaxed */ | 1055 | /* atomic64_fetch_xor_relaxed */ |
| 957 | #ifndef atomic64_fetch_xor_relaxed | 1056 | #ifndef atomic64_fetch_xor_relaxed |
| @@ -1049,30 +1148,164 @@ static inline int atomic_dec_if_positive(atomic_t *v) | |||
| 1049 | #define atomic64_try_cmpxchg_release atomic64_try_cmpxchg | 1148 | #define atomic64_try_cmpxchg_release atomic64_try_cmpxchg |
| 1050 | #endif /* atomic64_try_cmpxchg */ | 1149 | #endif /* atomic64_try_cmpxchg */ |
| 1051 | 1150 | ||
| 1052 | #ifndef atomic64_andnot | 1151 | /** |
| 1053 | static inline void atomic64_andnot(long long i, atomic64_t *v) | 1152 | * atomic64_fetch_add_unless - add unless the number is already a given value |
| 1153 | * @v: pointer of type atomic64_t | ||
| 1154 | * @a: the amount to add to v... | ||
| 1155 | * @u: ...unless v is equal to u. | ||
| 1156 | * | ||
| 1157 | * Atomically adds @a to @v, if @v was not already @u. | ||
| 1158 | * Returns the original value of @v. | ||
| 1159 | */ | ||
| 1160 | #ifndef atomic64_fetch_add_unless | ||
| 1161 | static inline long long atomic64_fetch_add_unless(atomic64_t *v, long long a, | ||
| 1162 | long long u) | ||
| 1054 | { | 1163 | { |
| 1055 | atomic64_and(~i, v); | 1164 | long long c = atomic64_read(v); |
| 1165 | |||
| 1166 | do { | ||
| 1167 | if (unlikely(c == u)) | ||
| 1168 | break; | ||
| 1169 | } while (!atomic64_try_cmpxchg(v, &c, c + a)); | ||
| 1170 | |||
| 1171 | return c; | ||
| 1056 | } | 1172 | } |
| 1173 | #endif | ||
| 1057 | 1174 | ||
| 1058 | static inline long long atomic64_fetch_andnot(long long i, atomic64_t *v) | 1175 | /** |
| 1176 | * atomic64_add_unless - add unless the number is already a given value | ||
| 1177 | * @v: pointer of type atomic_t | ||
| 1178 | * @a: the amount to add to v... | ||
| 1179 | * @u: ...unless v is equal to u. | ||
| 1180 | * | ||
| 1181 | * Atomically adds @a to @v, if @v was not already @u. | ||
| 1182 | * Returns true if the addition was done. | ||
| 1183 | */ | ||
| 1184 | static inline bool atomic64_add_unless(atomic64_t *v, long long a, long long u) | ||
| 1059 | { | 1185 | { |
| 1060 | return atomic64_fetch_and(~i, v); | 1186 | return atomic64_fetch_add_unless(v, a, u) != u; |
| 1061 | } | 1187 | } |
| 1062 | 1188 | ||
| 1063 | static inline long long atomic64_fetch_andnot_relaxed(long long i, atomic64_t *v) | 1189 | /** |
| 1190 | * atomic64_inc_not_zero - increment unless the number is zero | ||
| 1191 | * @v: pointer of type atomic64_t | ||
| 1192 | * | ||
| 1193 | * Atomically increments @v by 1, if @v is non-zero. | ||
| 1194 | * Returns true if the increment was done. | ||
| 1195 | */ | ||
| 1196 | #ifndef atomic64_inc_not_zero | ||
| 1197 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) | ||
| 1198 | #endif | ||
| 1199 | |||
| 1200 | /** | ||
| 1201 | * atomic64_inc_and_test - increment and test | ||
| 1202 | * @v: pointer of type atomic64_t | ||
| 1203 | * | ||
| 1204 | * Atomically increments @v by 1 | ||
| 1205 | * and returns true if the result is zero, or false for all | ||
| 1206 | * other cases. | ||
| 1207 | */ | ||
| 1208 | #ifndef atomic64_inc_and_test | ||
| 1209 | static inline bool atomic64_inc_and_test(atomic64_t *v) | ||
| 1064 | { | 1210 | { |
| 1065 | return atomic64_fetch_and_relaxed(~i, v); | 1211 | return atomic64_inc_return(v) == 0; |
| 1066 | } | 1212 | } |
| 1213 | #endif | ||
| 1067 | 1214 | ||
| 1068 | static inline long long atomic64_fetch_andnot_acquire(long long i, atomic64_t *v) | 1215 | /** |
| 1216 | * atomic64_dec_and_test - decrement and test | ||
| 1217 | * @v: pointer of type atomic64_t | ||
| 1218 | * | ||
| 1219 | * Atomically decrements @v by 1 and | ||
| 1220 | * returns true if the result is 0, or false for all other | ||
| 1221 | * cases. | ||
| 1222 | */ | ||
| 1223 | #ifndef atomic64_dec_and_test | ||
| 1224 | static inline bool atomic64_dec_and_test(atomic64_t *v) | ||
| 1069 | { | 1225 | { |
| 1070 | return atomic64_fetch_and_acquire(~i, v); | 1226 | return atomic64_dec_return(v) == 0; |
| 1071 | } | 1227 | } |
| 1228 | #endif | ||
| 1072 | 1229 | ||
| 1073 | static inline long long atomic64_fetch_andnot_release(long long i, atomic64_t *v) | 1230 | /** |
| 1231 | * atomic64_sub_and_test - subtract value from variable and test result | ||
| 1232 | * @i: integer value to subtract | ||
| 1233 | * @v: pointer of type atomic64_t | ||
| 1234 | * | ||
| 1235 | * Atomically subtracts @i from @v and returns | ||
| 1236 | * true if the result is zero, or false for all | ||
| 1237 | * other cases. | ||
| 1238 | */ | ||
| 1239 | #ifndef atomic64_sub_and_test | ||
| 1240 | static inline bool atomic64_sub_and_test(long long i, atomic64_t *v) | ||
| 1241 | { | ||
| 1242 | return atomic64_sub_return(i, v) == 0; | ||
| 1243 | } | ||
| 1244 | #endif | ||
| 1245 | |||
| 1246 | /** | ||
| 1247 | * atomic64_add_negative - add and test if negative | ||
| 1248 | * @i: integer value to add | ||
| 1249 | * @v: pointer of type atomic64_t | ||
| 1250 | * | ||
| 1251 | * Atomically adds @i to @v and returns true | ||
| 1252 | * if the result is negative, or false when | ||
| 1253 | * result is greater than or equal to zero. | ||
| 1254 | */ | ||
| 1255 | #ifndef atomic64_add_negative | ||
| 1256 | static inline bool atomic64_add_negative(long long i, atomic64_t *v) | ||
| 1074 | { | 1257 | { |
| 1075 | return atomic64_fetch_and_release(~i, v); | 1258 | return atomic64_add_return(i, v) < 0; |
| 1259 | } | ||
| 1260 | #endif | ||
| 1261 | |||
| 1262 | #ifndef atomic64_inc_unless_negative | ||
| 1263 | static inline bool atomic64_inc_unless_negative(atomic64_t *v) | ||
| 1264 | { | ||
| 1265 | long long c = atomic64_read(v); | ||
| 1266 | |||
| 1267 | do { | ||
| 1268 | if (unlikely(c < 0)) | ||
| 1269 | return false; | ||
| 1270 | } while (!atomic64_try_cmpxchg(v, &c, c + 1)); | ||
| 1271 | |||
| 1272 | return true; | ||
| 1273 | } | ||
| 1274 | #endif | ||
| 1275 | |||
| 1276 | #ifndef atomic64_dec_unless_positive | ||
| 1277 | static inline bool atomic64_dec_unless_positive(atomic64_t *v) | ||
| 1278 | { | ||
| 1279 | long long c = atomic64_read(v); | ||
| 1280 | |||
| 1281 | do { | ||
| 1282 | if (unlikely(c > 0)) | ||
| 1283 | return false; | ||
| 1284 | } while (!atomic64_try_cmpxchg(v, &c, c - 1)); | ||
| 1285 | |||
| 1286 | return true; | ||
| 1287 | } | ||
| 1288 | #endif | ||
| 1289 | |||
| 1290 | /* | ||
| 1291 | * atomic64_dec_if_positive - decrement by 1 if old value positive | ||
| 1292 | * @v: pointer of type atomic64_t | ||
| 1293 | * | ||
| 1294 | * The function returns the old value of *v minus 1, even if | ||
| 1295 | * the atomic64 variable, v, was not decremented. | ||
| 1296 | */ | ||
| 1297 | #ifndef atomic64_dec_if_positive | ||
| 1298 | static inline long long atomic64_dec_if_positive(atomic64_t *v) | ||
| 1299 | { | ||
| 1300 | long long dec, c = atomic64_read(v); | ||
| 1301 | |||
| 1302 | do { | ||
| 1303 | dec = c - 1; | ||
| 1304 | if (unlikely(dec < 0)) | ||
| 1305 | break; | ||
| 1306 | } while (!atomic64_try_cmpxchg(v, &c, dec)); | ||
| 1307 | |||
| 1308 | return dec; | ||
| 1076 | } | 1309 | } |
| 1077 | #endif | 1310 | #endif |
| 1078 | 1311 | ||
diff --git a/include/linux/audit.h b/include/linux/audit.h index 69c78477590b..9334fbef7bae 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -117,6 +117,9 @@ struct filename; | |||
| 117 | 117 | ||
| 118 | extern void audit_log_session_info(struct audit_buffer *ab); | 118 | extern void audit_log_session_info(struct audit_buffer *ab); |
| 119 | 119 | ||
| 120 | #define AUDIT_OFF 0 | ||
| 121 | #define AUDIT_ON 1 | ||
| 122 | #define AUDIT_LOCKED 2 | ||
| 120 | #ifdef CONFIG_AUDIT | 123 | #ifdef CONFIG_AUDIT |
| 121 | /* These are defined in audit.c */ | 124 | /* These are defined in audit.c */ |
| 122 | /* Public API */ | 125 | /* Public API */ |
| @@ -202,7 +205,7 @@ static inline int audit_log_task_context(struct audit_buffer *ab) | |||
| 202 | static inline void audit_log_task_info(struct audit_buffer *ab, | 205 | static inline void audit_log_task_info(struct audit_buffer *ab, |
| 203 | struct task_struct *tsk) | 206 | struct task_struct *tsk) |
| 204 | { } | 207 | { } |
| 205 | #define audit_enabled 0 | 208 | #define audit_enabled AUDIT_OFF |
| 206 | #endif /* CONFIG_AUDIT */ | 209 | #endif /* CONFIG_AUDIT */ |
| 207 | 210 | ||
| 208 | #ifdef CONFIG_AUDIT_COMPAT_GENERIC | 211 | #ifdef CONFIG_AUDIT_COMPAT_GENERIC |
diff --git a/include/linux/bio.h b/include/linux/bio.h index f08f5fe7bd08..51371740d2a8 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -429,7 +429,6 @@ extern void bio_put(struct bio *); | |||
| 429 | 429 | ||
| 430 | extern void __bio_clone_fast(struct bio *, struct bio *); | 430 | extern void __bio_clone_fast(struct bio *, struct bio *); |
| 431 | extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *); | 431 | extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *); |
| 432 | extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); | ||
| 433 | 432 | ||
| 434 | extern struct bio_set fs_bio_set; | 433 | extern struct bio_set fs_bio_set; |
| 435 | 434 | ||
| @@ -443,12 +442,6 @@ static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs) | |||
| 443 | return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL); | 442 | return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL); |
| 444 | } | 443 | } |
| 445 | 444 | ||
| 446 | static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask) | ||
| 447 | { | ||
| 448 | return bio_clone_bioset(bio, gfp_mask, NULL); | ||
| 449 | |||
| 450 | } | ||
| 451 | |||
| 452 | extern blk_qc_t submit_bio(struct bio *); | 445 | extern blk_qc_t submit_bio(struct bio *); |
| 453 | 446 | ||
| 454 | extern void bio_endio(struct bio *); | 447 | extern void bio_endio(struct bio *); |
| @@ -496,9 +489,9 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int, | |||
| 496 | extern void bio_set_pages_dirty(struct bio *bio); | 489 | extern void bio_set_pages_dirty(struct bio *bio); |
| 497 | extern void bio_check_pages_dirty(struct bio *bio); | 490 | extern void bio_check_pages_dirty(struct bio *bio); |
| 498 | 491 | ||
| 499 | void generic_start_io_acct(struct request_queue *q, int rw, | 492 | void generic_start_io_acct(struct request_queue *q, int op, |
| 500 | unsigned long sectors, struct hd_struct *part); | 493 | unsigned long sectors, struct hd_struct *part); |
| 501 | void generic_end_io_acct(struct request_queue *q, int rw, | 494 | void generic_end_io_acct(struct request_queue *q, int op, |
| 502 | struct hd_struct *part, | 495 | struct hd_struct *part, |
| 503 | unsigned long start_time); | 496 | unsigned long start_time); |
| 504 | 497 | ||
| @@ -553,8 +546,16 @@ do { \ | |||
| 553 | #define bio_dev(bio) \ | 546 | #define bio_dev(bio) \ |
| 554 | disk_devt((bio)->bi_disk) | 547 | disk_devt((bio)->bi_disk) |
| 555 | 548 | ||
| 549 | #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) | ||
| 550 | int bio_associate_blkcg_from_page(struct bio *bio, struct page *page); | ||
| 551 | #else | ||
| 552 | static inline int bio_associate_blkcg_from_page(struct bio *bio, | ||
| 553 | struct page *page) { return 0; } | ||
| 554 | #endif | ||
| 555 | |||
| 556 | #ifdef CONFIG_BLK_CGROUP | 556 | #ifdef CONFIG_BLK_CGROUP |
| 557 | int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); | 557 | int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); |
| 558 | int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg); | ||
| 558 | void bio_disassociate_task(struct bio *bio); | 559 | void bio_disassociate_task(struct bio *bio); |
| 559 | void bio_clone_blkcg_association(struct bio *dst, struct bio *src); | 560 | void bio_clone_blkcg_association(struct bio *dst, struct bio *src); |
| 560 | #else /* CONFIG_BLK_CGROUP */ | 561 | #else /* CONFIG_BLK_CGROUP */ |
diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h index cf2588d81148..65a6981eef7b 100644 --- a/include/linux/bitfield.h +++ b/include/linux/bitfield.h | |||
| @@ -104,7 +104,7 @@ | |||
| 104 | (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ | 104 | (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ |
| 105 | }) | 105 | }) |
| 106 | 106 | ||
| 107 | extern void __compiletime_warning("value doesn't fit into mask") | 107 | extern void __compiletime_error("value doesn't fit into mask") |
| 108 | __field_overflow(void); | 108 | __field_overflow(void); |
| 109 | extern void __compiletime_error("bad bitfield mask") | 109 | extern void __compiletime_error("bad bitfield mask") |
| 110 | __bad_mask(void); | 110 | __bad_mask(void); |
| @@ -121,8 +121,8 @@ static __always_inline u64 field_mask(u64 field) | |||
| 121 | #define ____MAKE_OP(type,base,to,from) \ | 121 | #define ____MAKE_OP(type,base,to,from) \ |
| 122 | static __always_inline __##type type##_encode_bits(base v, base field) \ | 122 | static __always_inline __##type type##_encode_bits(base v, base field) \ |
| 123 | { \ | 123 | { \ |
| 124 | if (__builtin_constant_p(v) && (v & ~field_multiplier(field))) \ | 124 | if (__builtin_constant_p(v) && (v & ~field_mask(field))) \ |
| 125 | __field_overflow(); \ | 125 | __field_overflow(); \ |
| 126 | return to((v & field_mask(field)) * field_multiplier(field)); \ | 126 | return to((v & field_mask(field)) * field_multiplier(field)); \ |
| 127 | } \ | 127 | } \ |
| 128 | static __always_inline __##type type##_replace_bits(__##type old, \ | 128 | static __always_inline __##type type##_replace_bits(__##type old, \ |
| @@ -143,6 +143,7 @@ static __always_inline base type##_get_bits(__##type v, base field) \ | |||
| 143 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \ | 143 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \ |
| 144 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \ | 144 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \ |
| 145 | ____MAKE_OP(u##size,u##size,,) | 145 | ____MAKE_OP(u##size,u##size,,) |
| 146 | ____MAKE_OP(u8,u8,,) | ||
| 146 | __MAKE_OP(16) | 147 | __MAKE_OP(16) |
| 147 | __MAKE_OP(32) | 148 | __MAKE_OP(32) |
| 148 | __MAKE_OP(64) | 149 | __MAKE_OP(64) |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 4cac4e1a72ff..af419012d77d 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
| @@ -2,29 +2,9 @@ | |||
| 2 | #ifndef _LINUX_BITOPS_H | 2 | #ifndef _LINUX_BITOPS_H |
| 3 | #define _LINUX_BITOPS_H | 3 | #define _LINUX_BITOPS_H |
| 4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
| 5 | #include <linux/bits.h> | ||
| 5 | 6 | ||
| 6 | #ifdef __KERNEL__ | ||
| 7 | #define BIT(nr) (1UL << (nr)) | ||
| 8 | #define BIT_ULL(nr) (1ULL << (nr)) | ||
| 9 | #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) | ||
| 10 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) | ||
| 11 | #define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) | ||
| 12 | #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) | ||
| 13 | #define BITS_PER_BYTE 8 | ||
| 14 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) | 7 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) |
| 15 | #endif | ||
| 16 | |||
| 17 | /* | ||
| 18 | * Create a contiguous bitmask starting at bit position @l and ending at | ||
| 19 | * position @h. For example | ||
| 20 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. | ||
| 21 | */ | ||
| 22 | #define GENMASK(h, l) \ | ||
| 23 | (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) | ||
| 24 | |||
| 25 | #define GENMASK_ULL(h, l) \ | ||
| 26 | (((~0ULL) - (1ULL << (l)) + 1) & \ | ||
| 27 | (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) | ||
| 28 | 8 | ||
| 29 | extern unsigned int __sw_hweight8(unsigned int w); | 9 | extern unsigned int __sw_hweight8(unsigned int w); |
| 30 | extern unsigned int __sw_hweight16(unsigned int w); | 10 | extern unsigned int __sw_hweight16(unsigned int w); |
diff --git a/include/linux/bits.h b/include/linux/bits.h new file mode 100644 index 000000000000..2b7b532c1d51 --- /dev/null +++ b/include/linux/bits.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __LINUX_BITS_H | ||
| 3 | #define __LINUX_BITS_H | ||
| 4 | #include <asm/bitsperlong.h> | ||
| 5 | |||
| 6 | #define BIT(nr) (1UL << (nr)) | ||
| 7 | #define BIT_ULL(nr) (1ULL << (nr)) | ||
| 8 | #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) | ||
| 9 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) | ||
| 10 | #define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) | ||
| 11 | #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) | ||
| 12 | #define BITS_PER_BYTE 8 | ||
| 13 | |||
| 14 | /* | ||
| 15 | * Create a contiguous bitmask starting at bit position @l and ending at | ||
| 16 | * position @h. For example | ||
| 17 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. | ||
| 18 | */ | ||
| 19 | #define GENMASK(h, l) \ | ||
| 20 | (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) | ||
| 21 | |||
| 22 | #define GENMASK_ULL(h, l) \ | ||
| 23 | (((~0ULL) - (1ULL << (l)) + 1) & \ | ||
| 24 | (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) | ||
| 25 | |||
| 26 | #endif /* __LINUX_BITS_H */ | ||
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 6c666fd7de3c..34aec30e06c7 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h | |||
| @@ -35,6 +35,7 @@ enum blkg_rwstat_type { | |||
| 35 | BLKG_RWSTAT_WRITE, | 35 | BLKG_RWSTAT_WRITE, |
| 36 | BLKG_RWSTAT_SYNC, | 36 | BLKG_RWSTAT_SYNC, |
| 37 | BLKG_RWSTAT_ASYNC, | 37 | BLKG_RWSTAT_ASYNC, |
| 38 | BLKG_RWSTAT_DISCARD, | ||
| 38 | 39 | ||
| 39 | BLKG_RWSTAT_NR, | 40 | BLKG_RWSTAT_NR, |
| 40 | BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR, | 41 | BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR, |
| @@ -136,6 +137,12 @@ struct blkcg_gq { | |||
| 136 | struct blkg_policy_data *pd[BLKCG_MAX_POLS]; | 137 | struct blkg_policy_data *pd[BLKCG_MAX_POLS]; |
| 137 | 138 | ||
| 138 | struct rcu_head rcu_head; | 139 | struct rcu_head rcu_head; |
| 140 | |||
| 141 | atomic_t use_delay; | ||
| 142 | atomic64_t delay_nsec; | ||
| 143 | atomic64_t delay_start; | ||
| 144 | u64 last_delay; | ||
| 145 | int last_use; | ||
| 139 | }; | 146 | }; |
| 140 | 147 | ||
| 141 | typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp); | 148 | typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp); |
| @@ -148,6 +155,8 @@ typedef void (blkcg_pol_online_pd_fn)(struct blkg_policy_data *pd); | |||
| 148 | typedef void (blkcg_pol_offline_pd_fn)(struct blkg_policy_data *pd); | 155 | typedef void (blkcg_pol_offline_pd_fn)(struct blkg_policy_data *pd); |
| 149 | typedef void (blkcg_pol_free_pd_fn)(struct blkg_policy_data *pd); | 156 | typedef void (blkcg_pol_free_pd_fn)(struct blkg_policy_data *pd); |
| 150 | typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkg_policy_data *pd); | 157 | typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkg_policy_data *pd); |
| 158 | typedef size_t (blkcg_pol_stat_pd_fn)(struct blkg_policy_data *pd, char *buf, | ||
| 159 | size_t size); | ||
| 151 | 160 | ||
| 152 | struct blkcg_policy { | 161 | struct blkcg_policy { |
| 153 | int plid; | 162 | int plid; |
| @@ -167,6 +176,7 @@ struct blkcg_policy { | |||
| 167 | blkcg_pol_offline_pd_fn *pd_offline_fn; | 176 | blkcg_pol_offline_pd_fn *pd_offline_fn; |
| 168 | blkcg_pol_free_pd_fn *pd_free_fn; | 177 | blkcg_pol_free_pd_fn *pd_free_fn; |
| 169 | blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn; | 178 | blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn; |
| 179 | blkcg_pol_stat_pd_fn *pd_stat_fn; | ||
| 170 | }; | 180 | }; |
| 171 | 181 | ||
| 172 | extern struct blkcg blkcg_root; | 182 | extern struct blkcg blkcg_root; |
| @@ -238,6 +248,42 @@ static inline struct blkcg *bio_blkcg(struct bio *bio) | |||
| 238 | return css_to_blkcg(task_css(current, io_cgrp_id)); | 248 | return css_to_blkcg(task_css(current, io_cgrp_id)); |
| 239 | } | 249 | } |
| 240 | 250 | ||
| 251 | static inline bool blk_cgroup_congested(void) | ||
| 252 | { | ||
| 253 | struct cgroup_subsys_state *css; | ||
| 254 | bool ret = false; | ||
| 255 | |||
| 256 | rcu_read_lock(); | ||
| 257 | css = kthread_blkcg(); | ||
| 258 | if (!css) | ||
| 259 | css = task_css(current, io_cgrp_id); | ||
| 260 | while (css) { | ||
| 261 | if (atomic_read(&css->cgroup->congestion_count)) { | ||
| 262 | ret = true; | ||
| 263 | break; | ||
| 264 | } | ||
| 265 | css = css->parent; | ||
| 266 | } | ||
| 267 | rcu_read_unlock(); | ||
| 268 | return ret; | ||
| 269 | } | ||
| 270 | |||
| 271 | /** | ||
| 272 | * bio_issue_as_root_blkg - see if this bio needs to be issued as root blkg | ||
| 273 | * @return: true if this bio needs to be submitted with the root blkg context. | ||
| 274 | * | ||
| 275 | * In order to avoid priority inversions we sometimes need to issue a bio as if | ||
| 276 | * it were attached to the root blkg, and then backcharge to the actual owning | ||
| 277 | * blkg. The idea is we do bio_blkcg() to look up the actual context for the | ||
| 278 | * bio and attach the appropriate blkg to the bio. Then we call this helper and | ||
| 279 | * if it is true run with the root blkg for that queue and then do any | ||
| 280 | * backcharging to the originating cgroup once the io is complete. | ||
| 281 | */ | ||
| 282 | static inline bool bio_issue_as_root_blkg(struct bio *bio) | ||
| 283 | { | ||
| 284 | return (bio->bi_opf & (REQ_META | REQ_SWAP)) != 0; | ||
| 285 | } | ||
| 286 | |||
| 241 | /** | 287 | /** |
| 242 | * blkcg_parent - get the parent of a blkcg | 288 | * blkcg_parent - get the parent of a blkcg |
| 243 | * @blkcg: blkcg of interest | 289 | * @blkcg: blkcg of interest |
| @@ -296,6 +342,17 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, | |||
| 296 | } | 342 | } |
| 297 | 343 | ||
| 298 | /** | 344 | /** |
| 345 | * blk_queue_root_blkg - return blkg for the (blkcg_root, @q) pair | ||
| 346 | * @q: request_queue of interest | ||
| 347 | * | ||
| 348 | * Lookup blkg for @q at the root level. See also blkg_lookup(). | ||
| 349 | */ | ||
| 350 | static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q) | ||
| 351 | { | ||
| 352 | return q->root_blkg; | ||
| 353 | } | ||
| 354 | |||
| 355 | /** | ||
| 299 | * blkg_to_pdata - get policy private data | 356 | * blkg_to_pdata - get policy private data |
| 300 | * @blkg: blkg of interest | 357 | * @blkg: blkg of interest |
| 301 | * @pol: policy of interest | 358 | * @pol: policy of interest |
| @@ -355,6 +412,21 @@ static inline void blkg_get(struct blkcg_gq *blkg) | |||
| 355 | atomic_inc(&blkg->refcnt); | 412 | atomic_inc(&blkg->refcnt); |
| 356 | } | 413 | } |
| 357 | 414 | ||
| 415 | /** | ||
| 416 | * blkg_try_get - try and get a blkg reference | ||
| 417 | * @blkg: blkg to get | ||
| 418 | * | ||
| 419 | * This is for use when doing an RCU lookup of the blkg. We may be in the midst | ||
| 420 | * of freeing this blkg, so we can only use it if the refcnt is not zero. | ||
| 421 | */ | ||
| 422 | static inline struct blkcg_gq *blkg_try_get(struct blkcg_gq *blkg) | ||
| 423 | { | ||
| 424 | if (atomic_inc_not_zero(&blkg->refcnt)) | ||
| 425 | return blkg; | ||
| 426 | return NULL; | ||
| 427 | } | ||
| 428 | |||
| 429 | |||
| 358 | void __blkg_release_rcu(struct rcu_head *rcu); | 430 | void __blkg_release_rcu(struct rcu_head *rcu); |
| 359 | 431 | ||
| 360 | /** | 432 | /** |
| @@ -589,7 +661,9 @@ static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat, | |||
| 589 | { | 661 | { |
| 590 | struct percpu_counter *cnt; | 662 | struct percpu_counter *cnt; |
| 591 | 663 | ||
| 592 | if (op_is_write(op)) | 664 | if (op_is_discard(op)) |
| 665 | cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_DISCARD]; | ||
| 666 | else if (op_is_write(op)) | ||
| 593 | cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_WRITE]; | 667 | cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_WRITE]; |
| 594 | else | 668 | else |
| 595 | cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_READ]; | 669 | cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_READ]; |
| @@ -706,8 +780,14 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, | |||
| 706 | 780 | ||
| 707 | if (!throtl) { | 781 | if (!throtl) { |
| 708 | blkg = blkg ?: q->root_blkg; | 782 | blkg = blkg ?: q->root_blkg; |
| 709 | blkg_rwstat_add(&blkg->stat_bytes, bio->bi_opf, | 783 | /* |
| 710 | bio->bi_iter.bi_size); | 784 | * If the bio is flagged with BIO_QUEUE_ENTERED it means this |
| 785 | * is a split bio and we would have already accounted for the | ||
| 786 | * size of the bio. | ||
| 787 | */ | ||
| 788 | if (!bio_flagged(bio, BIO_QUEUE_ENTERED)) | ||
| 789 | blkg_rwstat_add(&blkg->stat_bytes, bio->bi_opf, | ||
| 790 | bio->bi_iter.bi_size); | ||
| 711 | blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1); | 791 | blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1); |
| 712 | } | 792 | } |
| 713 | 793 | ||
| @@ -715,6 +795,59 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, | |||
| 715 | return !throtl; | 795 | return !throtl; |
| 716 | } | 796 | } |
| 717 | 797 | ||
| 798 | static inline void blkcg_use_delay(struct blkcg_gq *blkg) | ||
| 799 | { | ||
| 800 | if (atomic_add_return(1, &blkg->use_delay) == 1) | ||
| 801 | atomic_inc(&blkg->blkcg->css.cgroup->congestion_count); | ||
| 802 | } | ||
| 803 | |||
| 804 | static inline int blkcg_unuse_delay(struct blkcg_gq *blkg) | ||
| 805 | { | ||
| 806 | int old = atomic_read(&blkg->use_delay); | ||
| 807 | |||
| 808 | if (old == 0) | ||
| 809 | return 0; | ||
| 810 | |||
| 811 | /* | ||
| 812 | * We do this song and dance because we can race with somebody else | ||
| 813 | * adding or removing delay. If we just did an atomic_dec we'd end up | ||
| 814 | * negative and we'd already be in trouble. We need to subtract 1 and | ||
| 815 | * then check to see if we were the last delay so we can drop the | ||
| 816 | * congestion count on the cgroup. | ||
| 817 | */ | ||
| 818 | while (old) { | ||
| 819 | int cur = atomic_cmpxchg(&blkg->use_delay, old, old - 1); | ||
| 820 | if (cur == old) | ||
| 821 | break; | ||
| 822 | old = cur; | ||
| 823 | } | ||
| 824 | |||
| 825 | if (old == 0) | ||
| 826 | return 0; | ||
| 827 | if (old == 1) | ||
| 828 | atomic_dec(&blkg->blkcg->css.cgroup->congestion_count); | ||
| 829 | return 1; | ||
| 830 | } | ||
| 831 | |||
| 832 | static inline void blkcg_clear_delay(struct blkcg_gq *blkg) | ||
| 833 | { | ||
| 834 | int old = atomic_read(&blkg->use_delay); | ||
| 835 | if (!old) | ||
| 836 | return; | ||
| 837 | /* We only want 1 person clearing the congestion count for this blkg. */ | ||
| 838 | while (old) { | ||
| 839 | int cur = atomic_cmpxchg(&blkg->use_delay, old, 0); | ||
| 840 | if (cur == old) { | ||
| 841 | atomic_dec(&blkg->blkcg->css.cgroup->congestion_count); | ||
| 842 | break; | ||
| 843 | } | ||
| 844 | old = cur; | ||
| 845 | } | ||
| 846 | } | ||
| 847 | |||
| 848 | void blkcg_add_delay(struct blkcg_gq *blkg, u64 now, u64 delta); | ||
| 849 | void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay); | ||
| 850 | void blkcg_maybe_throttle_current(void); | ||
| 718 | #else /* CONFIG_BLK_CGROUP */ | 851 | #else /* CONFIG_BLK_CGROUP */ |
| 719 | 852 | ||
| 720 | struct blkcg { | 853 | struct blkcg { |
| @@ -734,9 +867,16 @@ struct blkcg_policy { | |||
| 734 | 867 | ||
| 735 | #define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) | 868 | #define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) |
| 736 | 869 | ||
| 870 | static inline void blkcg_maybe_throttle_current(void) { } | ||
| 871 | static inline bool blk_cgroup_congested(void) { return false; } | ||
| 872 | |||
| 737 | #ifdef CONFIG_BLOCK | 873 | #ifdef CONFIG_BLOCK |
| 738 | 874 | ||
| 875 | static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { } | ||
| 876 | |||
| 739 | static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } | 877 | static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } |
| 878 | static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q) | ||
| 879 | { return NULL; } | ||
| 740 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } | 880 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } |
| 741 | static inline void blkcg_drain_queue(struct request_queue *q) { } | 881 | static inline void blkcg_drain_queue(struct request_queue *q) { } |
| 742 | static inline void blkcg_exit_queue(struct request_queue *q) { } | 882 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index ca3f2c2edd85..1da59c16f637 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h | |||
| @@ -35,10 +35,12 @@ struct blk_mq_hw_ctx { | |||
| 35 | struct sbitmap ctx_map; | 35 | struct sbitmap ctx_map; |
| 36 | 36 | ||
| 37 | struct blk_mq_ctx *dispatch_from; | 37 | struct blk_mq_ctx *dispatch_from; |
| 38 | unsigned int dispatch_busy; | ||
| 38 | 39 | ||
| 39 | struct blk_mq_ctx **ctxs; | ||
| 40 | unsigned int nr_ctx; | 40 | unsigned int nr_ctx; |
| 41 | struct blk_mq_ctx **ctxs; | ||
| 41 | 42 | ||
| 43 | spinlock_t dispatch_wait_lock; | ||
| 42 | wait_queue_entry_t dispatch_wait; | 44 | wait_queue_entry_t dispatch_wait; |
| 43 | atomic_t wait_index; | 45 | atomic_t wait_index; |
| 44 | 46 | ||
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 3c4f390aea4b..f6dfb30737d8 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
| @@ -179,11 +179,9 @@ struct bio { | |||
| 179 | */ | 179 | */ |
| 180 | struct io_context *bi_ioc; | 180 | struct io_context *bi_ioc; |
| 181 | struct cgroup_subsys_state *bi_css; | 181 | struct cgroup_subsys_state *bi_css; |
| 182 | #ifdef CONFIG_BLK_DEV_THROTTLING_LOW | 182 | struct blkcg_gq *bi_blkg; |
| 183 | void *bi_cg_private; | ||
| 184 | struct bio_issue bi_issue; | 183 | struct bio_issue bi_issue; |
| 185 | #endif | 184 | #endif |
| 186 | #endif | ||
| 187 | union { | 185 | union { |
| 188 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 186 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
| 189 | struct bio_integrity_payload *bi_integrity; /* data integrity */ | 187 | struct bio_integrity_payload *bi_integrity; /* data integrity */ |
| @@ -329,7 +327,7 @@ enum req_flag_bits { | |||
| 329 | 327 | ||
| 330 | /* for driver use */ | 328 | /* for driver use */ |
| 331 | __REQ_DRV, | 329 | __REQ_DRV, |
| 332 | 330 | __REQ_SWAP, /* swapping request. */ | |
| 333 | __REQ_NR_BITS, /* stops here */ | 331 | __REQ_NR_BITS, /* stops here */ |
| 334 | }; | 332 | }; |
| 335 | 333 | ||
| @@ -351,6 +349,7 @@ enum req_flag_bits { | |||
| 351 | #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) | 349 | #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) |
| 352 | 350 | ||
| 353 | #define REQ_DRV (1ULL << __REQ_DRV) | 351 | #define REQ_DRV (1ULL << __REQ_DRV) |
| 352 | #define REQ_SWAP (1ULL << __REQ_SWAP) | ||
| 354 | 353 | ||
| 355 | #define REQ_FAILFAST_MASK \ | 354 | #define REQ_FAILFAST_MASK \ |
| 356 | (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) | 355 | (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) |
| @@ -358,6 +357,14 @@ enum req_flag_bits { | |||
| 358 | #define REQ_NOMERGE_FLAGS \ | 357 | #define REQ_NOMERGE_FLAGS \ |
| 359 | (REQ_NOMERGE | REQ_PREFLUSH | REQ_FUA) | 358 | (REQ_NOMERGE | REQ_PREFLUSH | REQ_FUA) |
| 360 | 359 | ||
| 360 | enum stat_group { | ||
| 361 | STAT_READ, | ||
| 362 | STAT_WRITE, | ||
| 363 | STAT_DISCARD, | ||
| 364 | |||
| 365 | NR_STAT_GROUPS | ||
| 366 | }; | ||
| 367 | |||
| 361 | #define bio_op(bio) \ | 368 | #define bio_op(bio) \ |
| 362 | ((bio)->bi_opf & REQ_OP_MASK) | 369 | ((bio)->bi_opf & REQ_OP_MASK) |
| 363 | #define req_op(req) \ | 370 | #define req_op(req) \ |
| @@ -395,6 +402,18 @@ static inline bool op_is_sync(unsigned int op) | |||
| 395 | (op & (REQ_SYNC | REQ_FUA | REQ_PREFLUSH)); | 402 | (op & (REQ_SYNC | REQ_FUA | REQ_PREFLUSH)); |
| 396 | } | 403 | } |
| 397 | 404 | ||
| 405 | static inline bool op_is_discard(unsigned int op) | ||
| 406 | { | ||
| 407 | return (op & REQ_OP_MASK) == REQ_OP_DISCARD; | ||
| 408 | } | ||
| 409 | |||
| 410 | static inline int op_stat_group(unsigned int op) | ||
| 411 | { | ||
| 412 | if (op_is_discard(op)) | ||
| 413 | return STAT_DISCARD; | ||
| 414 | return op_is_write(op); | ||
| 415 | } | ||
| 416 | |||
| 398 | typedef unsigned int blk_qc_t; | 417 | typedef unsigned int blk_qc_t; |
| 399 | #define BLK_QC_T_NONE -1U | 418 | #define BLK_QC_T_NONE -1U |
| 400 | #define BLK_QC_T_SHIFT 16 | 419 | #define BLK_QC_T_SHIFT 16 |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 79226ca8f80f..d6869e0e2b64 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -27,8 +27,6 @@ | |||
| 27 | #include <linux/percpu-refcount.h> | 27 | #include <linux/percpu-refcount.h> |
| 28 | #include <linux/scatterlist.h> | 28 | #include <linux/scatterlist.h> |
| 29 | #include <linux/blkzoned.h> | 29 | #include <linux/blkzoned.h> |
| 30 | #include <linux/seqlock.h> | ||
| 31 | #include <linux/u64_stats_sync.h> | ||
| 32 | 30 | ||
| 33 | struct module; | 31 | struct module; |
| 34 | struct scsi_ioctl_command; | 32 | struct scsi_ioctl_command; |
| @@ -42,7 +40,7 @@ struct bsg_job; | |||
| 42 | struct blkcg_gq; | 40 | struct blkcg_gq; |
| 43 | struct blk_flush_queue; | 41 | struct blk_flush_queue; |
| 44 | struct pr_ops; | 42 | struct pr_ops; |
| 45 | struct rq_wb; | 43 | struct rq_qos; |
| 46 | struct blk_queue_stats; | 44 | struct blk_queue_stats; |
| 47 | struct blk_stat_callback; | 45 | struct blk_stat_callback; |
| 48 | 46 | ||
| @@ -442,10 +440,8 @@ struct request_queue { | |||
| 442 | int nr_rqs[2]; /* # allocated [a]sync rqs */ | 440 | int nr_rqs[2]; /* # allocated [a]sync rqs */ |
| 443 | int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */ | 441 | int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */ |
| 444 | 442 | ||
| 445 | atomic_t shared_hctx_restart; | ||
| 446 | |||
| 447 | struct blk_queue_stats *stats; | 443 | struct blk_queue_stats *stats; |
| 448 | struct rq_wb *rq_wb; | 444 | struct rq_qos *rq_qos; |
| 449 | 445 | ||
| 450 | /* | 446 | /* |
| 451 | * If blkcg is not used, @q->root_rl serves all requests. If blkcg | 447 | * If blkcg is not used, @q->root_rl serves all requests. If blkcg |
| @@ -592,6 +588,7 @@ struct request_queue { | |||
| 592 | 588 | ||
| 593 | struct queue_limits limits; | 589 | struct queue_limits limits; |
| 594 | 590 | ||
| 591 | #ifdef CONFIG_BLK_DEV_ZONED | ||
| 595 | /* | 592 | /* |
| 596 | * Zoned block device information for request dispatch control. | 593 | * Zoned block device information for request dispatch control. |
| 597 | * nr_zones is the total number of zones of the device. This is always | 594 | * nr_zones is the total number of zones of the device. This is always |
| @@ -612,6 +609,7 @@ struct request_queue { | |||
| 612 | unsigned int nr_zones; | 609 | unsigned int nr_zones; |
| 613 | unsigned long *seq_zones_bitmap; | 610 | unsigned long *seq_zones_bitmap; |
| 614 | unsigned long *seq_zones_wlock; | 611 | unsigned long *seq_zones_wlock; |
| 612 | #endif /* CONFIG_BLK_DEV_ZONED */ | ||
| 615 | 613 | ||
| 616 | /* | 614 | /* |
| 617 | * sg stuff | 615 | * sg stuff |
| @@ -800,11 +798,7 @@ static inline unsigned int blk_queue_zone_sectors(struct request_queue *q) | |||
| 800 | return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; | 798 | return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; |
| 801 | } | 799 | } |
| 802 | 800 | ||
| 803 | static inline unsigned int blk_queue_nr_zones(struct request_queue *q) | 801 | #ifdef CONFIG_BLK_DEV_ZONED |
| 804 | { | ||
| 805 | return q->nr_zones; | ||
| 806 | } | ||
| 807 | |||
| 808 | static inline unsigned int blk_queue_zone_no(struct request_queue *q, | 802 | static inline unsigned int blk_queue_zone_no(struct request_queue *q, |
| 809 | sector_t sector) | 803 | sector_t sector) |
| 810 | { | 804 | { |
| @@ -820,6 +814,7 @@ static inline bool blk_queue_zone_is_seq(struct request_queue *q, | |||
| 820 | return false; | 814 | return false; |
| 821 | return test_bit(blk_queue_zone_no(q, sector), q->seq_zones_bitmap); | 815 | return test_bit(blk_queue_zone_no(q, sector), q->seq_zones_bitmap); |
| 822 | } | 816 | } |
| 817 | #endif /* CONFIG_BLK_DEV_ZONED */ | ||
| 823 | 818 | ||
| 824 | static inline bool rq_is_sync(struct request *rq) | 819 | static inline bool rq_is_sync(struct request *rq) |
| 825 | { | 820 | { |
| @@ -1070,6 +1065,7 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | |||
| 1070 | return blk_rq_cur_bytes(rq) >> SECTOR_SHIFT; | 1065 | return blk_rq_cur_bytes(rq) >> SECTOR_SHIFT; |
| 1071 | } | 1066 | } |
| 1072 | 1067 | ||
| 1068 | #ifdef CONFIG_BLK_DEV_ZONED | ||
| 1073 | static inline unsigned int blk_rq_zone_no(struct request *rq) | 1069 | static inline unsigned int blk_rq_zone_no(struct request *rq) |
| 1074 | { | 1070 | { |
| 1075 | return blk_queue_zone_no(rq->q, blk_rq_pos(rq)); | 1071 | return blk_queue_zone_no(rq->q, blk_rq_pos(rq)); |
| @@ -1079,6 +1075,7 @@ static inline unsigned int blk_rq_zone_is_seq(struct request *rq) | |||
| 1079 | { | 1075 | { |
| 1080 | return blk_queue_zone_is_seq(rq->q, blk_rq_pos(rq)); | 1076 | return blk_queue_zone_is_seq(rq->q, blk_rq_pos(rq)); |
| 1081 | } | 1077 | } |
| 1078 | #endif /* CONFIG_BLK_DEV_ZONED */ | ||
| 1082 | 1079 | ||
| 1083 | /* | 1080 | /* |
| 1084 | * Some commands like WRITE SAME have a payload or data transfer size which | 1081 | * Some commands like WRITE SAME have a payload or data transfer size which |
| @@ -1437,8 +1434,6 @@ enum blk_default_limits { | |||
| 1437 | BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL, | 1434 | BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL, |
| 1438 | }; | 1435 | }; |
| 1439 | 1436 | ||
| 1440 | #define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) | ||
| 1441 | |||
| 1442 | static inline unsigned long queue_segment_boundary(struct request_queue *q) | 1437 | static inline unsigned long queue_segment_boundary(struct request_queue *q) |
| 1443 | { | 1438 | { |
| 1444 | return q->limits.seg_boundary_mask; | 1439 | return q->limits.seg_boundary_mask; |
| @@ -1639,15 +1634,6 @@ static inline unsigned int bdev_zone_sectors(struct block_device *bdev) | |||
| 1639 | return 0; | 1634 | return 0; |
| 1640 | } | 1635 | } |
| 1641 | 1636 | ||
| 1642 | static inline unsigned int bdev_nr_zones(struct block_device *bdev) | ||
| 1643 | { | ||
| 1644 | struct request_queue *q = bdev_get_queue(bdev); | ||
| 1645 | |||
| 1646 | if (q) | ||
| 1647 | return blk_queue_nr_zones(q); | ||
| 1648 | return 0; | ||
| 1649 | } | ||
| 1650 | |||
| 1651 | static inline int queue_dma_alignment(struct request_queue *q) | 1637 | static inline int queue_dma_alignment(struct request_queue *q) |
| 1652 | { | 1638 | { |
| 1653 | return q ? q->dma_alignment : 511; | 1639 | return q ? q->dma_alignment : 511; |
| @@ -1877,6 +1863,28 @@ static inline bool integrity_req_gap_front_merge(struct request *req, | |||
| 1877 | bip_next->bip_vec[0].bv_offset); | 1863 | bip_next->bip_vec[0].bv_offset); |
| 1878 | } | 1864 | } |
| 1879 | 1865 | ||
| 1866 | /** | ||
| 1867 | * bio_integrity_intervals - Return number of integrity intervals for a bio | ||
| 1868 | * @bi: blk_integrity profile for device | ||
| 1869 | * @sectors: Size of the bio in 512-byte sectors | ||
| 1870 | * | ||
| 1871 | * Description: The block layer calculates everything in 512 byte | ||
| 1872 | * sectors but integrity metadata is done in terms of the data integrity | ||
| 1873 | * interval size of the storage device. Convert the block layer sectors | ||
| 1874 | * to the appropriate number of integrity intervals. | ||
| 1875 | */ | ||
| 1876 | static inline unsigned int bio_integrity_intervals(struct blk_integrity *bi, | ||
| 1877 | unsigned int sectors) | ||
| 1878 | { | ||
| 1879 | return sectors >> (bi->interval_exp - 9); | ||
| 1880 | } | ||
| 1881 | |||
| 1882 | static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, | ||
| 1883 | unsigned int sectors) | ||
| 1884 | { | ||
| 1885 | return bio_integrity_intervals(bi, sectors) * bi->tuple_size; | ||
| 1886 | } | ||
| 1887 | |||
| 1880 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | 1888 | #else /* CONFIG_BLK_DEV_INTEGRITY */ |
| 1881 | 1889 | ||
| 1882 | struct bio; | 1890 | struct bio; |
| @@ -1950,12 +1958,24 @@ static inline bool integrity_req_gap_front_merge(struct request *req, | |||
| 1950 | return false; | 1958 | return false; |
| 1951 | } | 1959 | } |
| 1952 | 1960 | ||
| 1961 | static inline unsigned int bio_integrity_intervals(struct blk_integrity *bi, | ||
| 1962 | unsigned int sectors) | ||
| 1963 | { | ||
| 1964 | return 0; | ||
| 1965 | } | ||
| 1966 | |||
| 1967 | static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi, | ||
| 1968 | unsigned int sectors) | ||
| 1969 | { | ||
| 1970 | return 0; | ||
| 1971 | } | ||
| 1972 | |||
| 1953 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 1973 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
| 1954 | 1974 | ||
| 1955 | struct block_device_operations { | 1975 | struct block_device_operations { |
| 1956 | int (*open) (struct block_device *, fmode_t); | 1976 | int (*open) (struct block_device *, fmode_t); |
| 1957 | void (*release) (struct gendisk *, fmode_t); | 1977 | void (*release) (struct gendisk *, fmode_t); |
| 1958 | int (*rw_page)(struct block_device *, sector_t, struct page *, bool); | 1978 | int (*rw_page)(struct block_device *, sector_t, struct page *, unsigned int); |
| 1959 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1979 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
| 1960 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1980 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
| 1961 | unsigned int (*check_events) (struct gendisk *disk, | 1981 | unsigned int (*check_events) (struct gendisk *disk, |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 7942a96b1a9d..42515195d7d8 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
| @@ -27,9 +27,20 @@ extern unsigned long max_pfn; | |||
| 27 | extern unsigned long long max_possible_pfn; | 27 | extern unsigned long long max_possible_pfn; |
| 28 | 28 | ||
| 29 | #ifndef CONFIG_NO_BOOTMEM | 29 | #ifndef CONFIG_NO_BOOTMEM |
| 30 | /* | 30 | /** |
| 31 | * node_bootmem_map is a map pointer - the bits represent all physical | 31 | * struct bootmem_data - per-node information used by the bootmem allocator |
| 32 | * memory pages (including holes) on the node. | 32 | * @node_min_pfn: the starting physical address of the node's memory |
| 33 | * @node_low_pfn: the end physical address of the directly addressable memory | ||
| 34 | * @node_bootmem_map: is a bitmap pointer - the bits represent all physical | ||
| 35 | * memory pages (including holes) on the node. | ||
| 36 | * @last_end_off: the offset within the page of the end of the last allocation; | ||
| 37 | * if 0, the page used is full | ||
| 38 | * @hint_idx: the PFN of the page used with the last allocation; | ||
| 39 | * together with using this with the @last_end_offset field, | ||
| 40 | * a test can be made to see if allocations can be merged | ||
| 41 | * with the page used for the last allocation rather than | ||
| 42 | * using up a full new page. | ||
| 43 | * @list: list entry in the linked list ordered by the memory addresses | ||
| 33 | */ | 44 | */ |
| 34 | typedef struct bootmem_data { | 45 | typedef struct bootmem_data { |
| 35 | unsigned long node_min_pfn; | 46 | unsigned long node_min_pfn; |
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index d50c2f0a655a..f91b0f8ff3a9 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h | |||
| @@ -4,22 +4,46 @@ | |||
| 4 | 4 | ||
| 5 | #include <linux/errno.h> | 5 | #include <linux/errno.h> |
| 6 | #include <linux/jump_label.h> | 6 | #include <linux/jump_label.h> |
| 7 | #include <linux/percpu.h> | ||
| 8 | #include <linux/rbtree.h> | ||
| 7 | #include <uapi/linux/bpf.h> | 9 | #include <uapi/linux/bpf.h> |
| 8 | 10 | ||
| 9 | struct sock; | 11 | struct sock; |
| 10 | struct sockaddr; | 12 | struct sockaddr; |
| 11 | struct cgroup; | 13 | struct cgroup; |
| 12 | struct sk_buff; | 14 | struct sk_buff; |
| 15 | struct bpf_map; | ||
| 16 | struct bpf_prog; | ||
| 13 | struct bpf_sock_ops_kern; | 17 | struct bpf_sock_ops_kern; |
| 18 | struct bpf_cgroup_storage; | ||
| 14 | 19 | ||
| 15 | #ifdef CONFIG_CGROUP_BPF | 20 | #ifdef CONFIG_CGROUP_BPF |
| 16 | 21 | ||
| 17 | extern struct static_key_false cgroup_bpf_enabled_key; | 22 | extern struct static_key_false cgroup_bpf_enabled_key; |
| 18 | #define cgroup_bpf_enabled static_branch_unlikely(&cgroup_bpf_enabled_key) | 23 | #define cgroup_bpf_enabled static_branch_unlikely(&cgroup_bpf_enabled_key) |
| 19 | 24 | ||
| 25 | DECLARE_PER_CPU(void*, bpf_cgroup_storage); | ||
| 26 | |||
| 27 | struct bpf_cgroup_storage_map; | ||
| 28 | |||
| 29 | struct bpf_storage_buffer { | ||
| 30 | struct rcu_head rcu; | ||
| 31 | char data[0]; | ||
| 32 | }; | ||
| 33 | |||
| 34 | struct bpf_cgroup_storage { | ||
| 35 | struct bpf_storage_buffer *buf; | ||
| 36 | struct bpf_cgroup_storage_map *map; | ||
| 37 | struct bpf_cgroup_storage_key key; | ||
| 38 | struct list_head list; | ||
| 39 | struct rb_node node; | ||
| 40 | struct rcu_head rcu; | ||
| 41 | }; | ||
| 42 | |||
| 20 | struct bpf_prog_list { | 43 | struct bpf_prog_list { |
| 21 | struct list_head node; | 44 | struct list_head node; |
| 22 | struct bpf_prog *prog; | 45 | struct bpf_prog *prog; |
| 46 | struct bpf_cgroup_storage *storage; | ||
| 23 | }; | 47 | }; |
| 24 | 48 | ||
| 25 | struct bpf_prog_array; | 49 | struct bpf_prog_array; |
| @@ -77,6 +101,26 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk, | |||
| 77 | int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, | 101 | int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, |
| 78 | short access, enum bpf_attach_type type); | 102 | short access, enum bpf_attach_type type); |
| 79 | 103 | ||
| 104 | static inline void bpf_cgroup_storage_set(struct bpf_cgroup_storage *storage) | ||
| 105 | { | ||
| 106 | struct bpf_storage_buffer *buf; | ||
| 107 | |||
| 108 | if (!storage) | ||
| 109 | return; | ||
| 110 | |||
| 111 | buf = READ_ONCE(storage->buf); | ||
| 112 | this_cpu_write(bpf_cgroup_storage, &buf->data[0]); | ||
| 113 | } | ||
| 114 | |||
| 115 | struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(struct bpf_prog *prog); | ||
| 116 | void bpf_cgroup_storage_free(struct bpf_cgroup_storage *storage); | ||
| 117 | void bpf_cgroup_storage_link(struct bpf_cgroup_storage *storage, | ||
| 118 | struct cgroup *cgroup, | ||
| 119 | enum bpf_attach_type type); | ||
| 120 | void bpf_cgroup_storage_unlink(struct bpf_cgroup_storage *storage); | ||
| 121 | int bpf_cgroup_storage_assign(struct bpf_prog *prog, struct bpf_map *map); | ||
| 122 | void bpf_cgroup_storage_release(struct bpf_prog *prog, struct bpf_map *map); | ||
| 123 | |||
| 80 | /* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */ | 124 | /* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */ |
| 81 | #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb) \ | 125 | #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb) \ |
| 82 | ({ \ | 126 | ({ \ |
| @@ -221,6 +265,16 @@ static inline int cgroup_bpf_prog_query(const union bpf_attr *attr, | |||
| 221 | return -EINVAL; | 265 | return -EINVAL; |
| 222 | } | 266 | } |
| 223 | 267 | ||
| 268 | static inline void bpf_cgroup_storage_set(struct bpf_cgroup_storage *storage) {} | ||
| 269 | static inline int bpf_cgroup_storage_assign(struct bpf_prog *prog, | ||
| 270 | struct bpf_map *map) { return 0; } | ||
| 271 | static inline void bpf_cgroup_storage_release(struct bpf_prog *prog, | ||
| 272 | struct bpf_map *map) {} | ||
| 273 | static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( | ||
| 274 | struct bpf_prog *prog) { return 0; } | ||
| 275 | static inline void bpf_cgroup_storage_free( | ||
| 276 | struct bpf_cgroup_storage *storage) {} | ||
| 277 | |||
| 224 | #define cgroup_bpf_enabled (0) | 278 | #define cgroup_bpf_enabled (0) |
| 225 | #define BPF_CGROUP_PRE_CONNECT_ENABLED(sk) (0) | 279 | #define BPF_CGROUP_PRE_CONNECT_ENABLED(sk) (0) |
| 226 | #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; }) | 280 | #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; }) |
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 8827e797ff97..523481a3471b 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h | |||
| @@ -23,7 +23,7 @@ struct bpf_prog; | |||
| 23 | struct bpf_map; | 23 | struct bpf_map; |
| 24 | struct sock; | 24 | struct sock; |
| 25 | struct seq_file; | 25 | struct seq_file; |
| 26 | struct btf; | 26 | struct btf_type; |
| 27 | 27 | ||
| 28 | /* map is generic key/value storage optionally accesible by eBPF programs */ | 28 | /* map is generic key/value storage optionally accesible by eBPF programs */ |
| 29 | struct bpf_map_ops { | 29 | struct bpf_map_ops { |
| @@ -48,8 +48,9 @@ struct bpf_map_ops { | |||
| 48 | u32 (*map_fd_sys_lookup_elem)(void *ptr); | 48 | u32 (*map_fd_sys_lookup_elem)(void *ptr); |
| 49 | void (*map_seq_show_elem)(struct bpf_map *map, void *key, | 49 | void (*map_seq_show_elem)(struct bpf_map *map, void *key, |
| 50 | struct seq_file *m); | 50 | struct seq_file *m); |
| 51 | int (*map_check_btf)(const struct bpf_map *map, const struct btf *btf, | 51 | int (*map_check_btf)(const struct bpf_map *map, |
| 52 | u32 key_type_id, u32 value_type_id); | 52 | const struct btf_type *key_type, |
| 53 | const struct btf_type *value_type); | ||
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 55 | struct bpf_map { | 56 | struct bpf_map { |
| @@ -85,6 +86,7 @@ struct bpf_map { | |||
| 85 | char name[BPF_OBJ_NAME_LEN]; | 86 | char name[BPF_OBJ_NAME_LEN]; |
| 86 | }; | 87 | }; |
| 87 | 88 | ||
| 89 | struct bpf_offload_dev; | ||
| 88 | struct bpf_offloaded_map; | 90 | struct bpf_offloaded_map; |
| 89 | 91 | ||
| 90 | struct bpf_map_dev_ops { | 92 | struct bpf_map_dev_ops { |
| @@ -117,9 +119,13 @@ static inline bool bpf_map_offload_neutral(const struct bpf_map *map) | |||
| 117 | 119 | ||
| 118 | static inline bool bpf_map_support_seq_show(const struct bpf_map *map) | 120 | static inline bool bpf_map_support_seq_show(const struct bpf_map *map) |
| 119 | { | 121 | { |
| 120 | return map->ops->map_seq_show_elem && map->ops->map_check_btf; | 122 | return map->btf && map->ops->map_seq_show_elem; |
| 121 | } | 123 | } |
| 122 | 124 | ||
| 125 | int map_check_no_btf(const struct bpf_map *map, | ||
| 126 | const struct btf_type *key_type, | ||
| 127 | const struct btf_type *value_type); | ||
| 128 | |||
| 123 | extern const struct bpf_map_ops bpf_map_offload_ops; | 129 | extern const struct bpf_map_ops bpf_map_offload_ops; |
| 124 | 130 | ||
| 125 | /* function argument constraints */ | 131 | /* function argument constraints */ |
| @@ -154,6 +160,7 @@ enum bpf_arg_type { | |||
| 154 | enum bpf_return_type { | 160 | enum bpf_return_type { |
| 155 | RET_INTEGER, /* function returns integer */ | 161 | RET_INTEGER, /* function returns integer */ |
| 156 | RET_VOID, /* function doesn't return anything */ | 162 | RET_VOID, /* function doesn't return anything */ |
| 163 | RET_PTR_TO_MAP_VALUE, /* returns a pointer to map elem value */ | ||
| 157 | RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */ | 164 | RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */ |
| 158 | }; | 165 | }; |
| 159 | 166 | ||
| @@ -281,6 +288,7 @@ struct bpf_prog_aux { | |||
| 281 | struct bpf_prog *prog; | 288 | struct bpf_prog *prog; |
| 282 | struct user_struct *user; | 289 | struct user_struct *user; |
| 283 | u64 load_time; /* ns since boottime */ | 290 | u64 load_time; /* ns since boottime */ |
| 291 | struct bpf_map *cgroup_storage; | ||
| 284 | char name[BPF_OBJ_NAME_LEN]; | 292 | char name[BPF_OBJ_NAME_LEN]; |
| 285 | #ifdef CONFIG_SECURITY | 293 | #ifdef CONFIG_SECURITY |
| 286 | void *security; | 294 | void *security; |
| @@ -347,12 +355,17 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, | |||
| 347 | * The 'struct bpf_prog_array *' should only be replaced with xchg() | 355 | * The 'struct bpf_prog_array *' should only be replaced with xchg() |
| 348 | * since other cpus are walking the array of pointers in parallel. | 356 | * since other cpus are walking the array of pointers in parallel. |
| 349 | */ | 357 | */ |
| 358 | struct bpf_prog_array_item { | ||
| 359 | struct bpf_prog *prog; | ||
| 360 | struct bpf_cgroup_storage *cgroup_storage; | ||
| 361 | }; | ||
| 362 | |||
| 350 | struct bpf_prog_array { | 363 | struct bpf_prog_array { |
| 351 | struct rcu_head rcu; | 364 | struct rcu_head rcu; |
| 352 | struct bpf_prog *progs[0]; | 365 | struct bpf_prog_array_item items[0]; |
| 353 | }; | 366 | }; |
| 354 | 367 | ||
| 355 | struct bpf_prog_array __rcu *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); | 368 | struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); |
| 356 | void bpf_prog_array_free(struct bpf_prog_array __rcu *progs); | 369 | void bpf_prog_array_free(struct bpf_prog_array __rcu *progs); |
| 357 | int bpf_prog_array_length(struct bpf_prog_array __rcu *progs); | 370 | int bpf_prog_array_length(struct bpf_prog_array __rcu *progs); |
| 358 | int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, | 371 | int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, |
| @@ -370,7 +383,8 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, | |||
| 370 | 383 | ||
| 371 | #define __BPF_PROG_RUN_ARRAY(array, ctx, func, check_non_null) \ | 384 | #define __BPF_PROG_RUN_ARRAY(array, ctx, func, check_non_null) \ |
| 372 | ({ \ | 385 | ({ \ |
| 373 | struct bpf_prog **_prog, *__prog; \ | 386 | struct bpf_prog_array_item *_item; \ |
| 387 | struct bpf_prog *_prog; \ | ||
| 374 | struct bpf_prog_array *_array; \ | 388 | struct bpf_prog_array *_array; \ |
| 375 | u32 _ret = 1; \ | 389 | u32 _ret = 1; \ |
| 376 | preempt_disable(); \ | 390 | preempt_disable(); \ |
| @@ -378,10 +392,11 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, | |||
| 378 | _array = rcu_dereference(array); \ | 392 | _array = rcu_dereference(array); \ |
| 379 | if (unlikely(check_non_null && !_array))\ | 393 | if (unlikely(check_non_null && !_array))\ |
| 380 | goto _out; \ | 394 | goto _out; \ |
| 381 | _prog = _array->progs; \ | 395 | _item = &_array->items[0]; \ |
| 382 | while ((__prog = READ_ONCE(*_prog))) { \ | 396 | while ((_prog = READ_ONCE(_item->prog))) { \ |
| 383 | _ret &= func(__prog, ctx); \ | 397 | bpf_cgroup_storage_set(_item->cgroup_storage); \ |
| 384 | _prog++; \ | 398 | _ret &= func(_prog, ctx); \ |
| 399 | _item++; \ | ||
| 385 | } \ | 400 | } \ |
| 386 | _out: \ | 401 | _out: \ |
| 387 | rcu_read_unlock(); \ | 402 | rcu_read_unlock(); \ |
| @@ -434,6 +449,8 @@ struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref); | |||
| 434 | void bpf_map_put_with_uref(struct bpf_map *map); | 449 | void bpf_map_put_with_uref(struct bpf_map *map); |
| 435 | void bpf_map_put(struct bpf_map *map); | 450 | void bpf_map_put(struct bpf_map *map); |
| 436 | int bpf_map_precharge_memlock(u32 pages); | 451 | int bpf_map_precharge_memlock(u32 pages); |
| 452 | int bpf_map_charge_memlock(struct bpf_map *map, u32 pages); | ||
| 453 | void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages); | ||
| 437 | void *bpf_map_area_alloc(size_t size, int numa_node); | 454 | void *bpf_map_area_alloc(size_t size, int numa_node); |
| 438 | void bpf_map_area_free(void *base); | 455 | void bpf_map_area_free(void *base); |
| 439 | void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); | 456 | void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); |
| @@ -512,6 +529,7 @@ static inline int bpf_map_attr_numa_node(const union bpf_attr *attr) | |||
| 512 | } | 529 | } |
| 513 | 530 | ||
| 514 | struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type); | 531 | struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type); |
| 532 | int array_map_alloc_check(union bpf_attr *attr); | ||
| 515 | 533 | ||
| 516 | #else /* !CONFIG_BPF_SYSCALL */ | 534 | #else /* !CONFIG_BPF_SYSCALL */ |
| 517 | static inline struct bpf_prog *bpf_prog_get(u32 ufd) | 535 | static inline struct bpf_prog *bpf_prog_get(u32 ufd) |
| @@ -648,7 +666,15 @@ int bpf_map_offload_delete_elem(struct bpf_map *map, void *key); | |||
| 648 | int bpf_map_offload_get_next_key(struct bpf_map *map, | 666 | int bpf_map_offload_get_next_key(struct bpf_map *map, |
| 649 | void *key, void *next_key); | 667 | void *key, void *next_key); |
| 650 | 668 | ||
| 651 | bool bpf_offload_dev_match(struct bpf_prog *prog, struct bpf_map *map); | 669 | bool bpf_offload_prog_map_match(struct bpf_prog *prog, struct bpf_map *map); |
| 670 | |||
| 671 | struct bpf_offload_dev *bpf_offload_dev_create(void); | ||
| 672 | void bpf_offload_dev_destroy(struct bpf_offload_dev *offdev); | ||
| 673 | int bpf_offload_dev_netdev_register(struct bpf_offload_dev *offdev, | ||
| 674 | struct net_device *netdev); | ||
| 675 | void bpf_offload_dev_netdev_unregister(struct bpf_offload_dev *offdev, | ||
| 676 | struct net_device *netdev); | ||
| 677 | bool bpf_offload_dev_match(struct bpf_prog *prog, struct net_device *netdev); | ||
| 652 | 678 | ||
| 653 | #if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL) | 679 | #if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL) |
| 654 | int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr); | 680 | int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr); |
| @@ -749,6 +775,33 @@ static inline void __xsk_map_flush(struct bpf_map *map) | |||
| 749 | } | 775 | } |
| 750 | #endif | 776 | #endif |
| 751 | 777 | ||
| 778 | #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) | ||
| 779 | void bpf_sk_reuseport_detach(struct sock *sk); | ||
| 780 | int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map, void *key, | ||
| 781 | void *value); | ||
| 782 | int bpf_fd_reuseport_array_update_elem(struct bpf_map *map, void *key, | ||
| 783 | void *value, u64 map_flags); | ||
| 784 | #else | ||
| 785 | static inline void bpf_sk_reuseport_detach(struct sock *sk) | ||
| 786 | { | ||
| 787 | } | ||
| 788 | |||
| 789 | #ifdef CONFIG_BPF_SYSCALL | ||
| 790 | static inline int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map, | ||
| 791 | void *key, void *value) | ||
| 792 | { | ||
| 793 | return -EOPNOTSUPP; | ||
| 794 | } | ||
| 795 | |||
| 796 | static inline int bpf_fd_reuseport_array_update_elem(struct bpf_map *map, | ||
| 797 | void *key, void *value, | ||
| 798 | u64 map_flags) | ||
| 799 | { | ||
| 800 | return -EOPNOTSUPP; | ||
| 801 | } | ||
| 802 | #endif /* CONFIG_BPF_SYSCALL */ | ||
| 803 | #endif /* defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) */ | ||
| 804 | |||
| 752 | /* verifier prototypes for helper functions called from eBPF programs */ | 805 | /* verifier prototypes for helper functions called from eBPF programs */ |
| 753 | extern const struct bpf_func_proto bpf_map_lookup_elem_proto; | 806 | extern const struct bpf_func_proto bpf_map_lookup_elem_proto; |
| 754 | extern const struct bpf_func_proto bpf_map_update_elem_proto; | 807 | extern const struct bpf_func_proto bpf_map_update_elem_proto; |
| @@ -768,6 +821,8 @@ extern const struct bpf_func_proto bpf_sock_map_update_proto; | |||
| 768 | extern const struct bpf_func_proto bpf_sock_hash_update_proto; | 821 | extern const struct bpf_func_proto bpf_sock_hash_update_proto; |
| 769 | extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto; | 822 | extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto; |
| 770 | 823 | ||
| 824 | extern const struct bpf_func_proto bpf_get_local_storage_proto; | ||
| 825 | |||
| 771 | /* Shared helpers among cBPF and eBPF. */ | 826 | /* Shared helpers among cBPF and eBPF. */ |
| 772 | void bpf_user_rnd_init_once(void); | 827 | void bpf_user_rnd_init_once(void); |
| 773 | u64 bpf_user_rnd_u32(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); | 828 | u64 bpf_user_rnd_u32(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); |
diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index c5700c2d5549..cd26c090e7c0 100644 --- a/include/linux/bpf_types.h +++ b/include/linux/bpf_types.h | |||
| @@ -29,6 +29,9 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) | |||
| 29 | #ifdef CONFIG_BPF_LIRC_MODE2 | 29 | #ifdef CONFIG_BPF_LIRC_MODE2 |
| 30 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) | 30 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) |
| 31 | #endif | 31 | #endif |
| 32 | #ifdef CONFIG_INET | ||
| 33 | BPF_PROG_TYPE(BPF_PROG_TYPE_SK_REUSEPORT, sk_reuseport) | ||
| 34 | #endif | ||
| 32 | 35 | ||
| 33 | BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops) | 36 | BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops) |
| 34 | BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, percpu_array_map_ops) | 37 | BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, percpu_array_map_ops) |
| @@ -37,6 +40,9 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_PERF_EVENT_ARRAY, perf_event_array_map_ops) | |||
| 37 | #ifdef CONFIG_CGROUPS | 40 | #ifdef CONFIG_CGROUPS |
| 38 | BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_ARRAY, cgroup_array_map_ops) | 41 | BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_ARRAY, cgroup_array_map_ops) |
| 39 | #endif | 42 | #endif |
| 43 | #ifdef CONFIG_CGROUP_BPF | ||
| 44 | BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_STORAGE, cgroup_storage_map_ops) | ||
| 45 | #endif | ||
| 40 | BPF_MAP_TYPE(BPF_MAP_TYPE_HASH, htab_map_ops) | 46 | BPF_MAP_TYPE(BPF_MAP_TYPE_HASH, htab_map_ops) |
| 41 | BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_HASH, htab_percpu_map_ops) | 47 | BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_HASH, htab_percpu_map_ops) |
| 42 | BPF_MAP_TYPE(BPF_MAP_TYPE_LRU_HASH, htab_lru_map_ops) | 48 | BPF_MAP_TYPE(BPF_MAP_TYPE_LRU_HASH, htab_lru_map_ops) |
| @@ -57,4 +63,7 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops) | |||
| 57 | #if defined(CONFIG_XDP_SOCKETS) | 63 | #if defined(CONFIG_XDP_SOCKETS) |
| 58 | BPF_MAP_TYPE(BPF_MAP_TYPE_XSKMAP, xsk_map_ops) | 64 | BPF_MAP_TYPE(BPF_MAP_TYPE_XSKMAP, xsk_map_ops) |
| 59 | #endif | 65 | #endif |
| 66 | #ifdef CONFIG_INET | ||
| 67 | BPF_MAP_TYPE(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, reuseport_array_ops) | ||
| 68 | #endif | ||
| 60 | #endif | 69 | #endif |
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index daa9234a9baf..949e9af8d9d6 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h | |||
| @@ -45,6 +45,7 @@ | |||
| 45 | #define PHY_ID_BCM7445 0x600d8510 | 45 | #define PHY_ID_BCM7445 0x600d8510 |
| 46 | 46 | ||
| 47 | #define PHY_ID_BCM_CYGNUS 0xae025200 | 47 | #define PHY_ID_BCM_CYGNUS 0xae025200 |
| 48 | #define PHY_ID_BCM_OMEGA 0xae025100 | ||
| 48 | 49 | ||
| 49 | #define PHY_BCM_OUI_MASK 0xfffffc00 | 50 | #define PHY_BCM_OUI_MASK 0xfffffc00 |
| 50 | #define PHY_BCM_OUI_1 0x00206000 | 51 | #define PHY_BCM_OUI_1 0x00206000 |
diff --git a/include/linux/build-salt.h b/include/linux/build-salt.h new file mode 100644 index 000000000000..bb007bd05e7a --- /dev/null +++ b/include/linux/build-salt.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #ifndef __BUILD_SALT_H | ||
| 2 | #define __BUILD_SALT_H | ||
| 3 | |||
| 4 | #include <linux/elfnote.h> | ||
| 5 | |||
| 6 | #define LINUX_ELFNOTE_BUILD_SALT 0x100 | ||
| 7 | |||
| 8 | #ifdef __ASSEMBLER__ | ||
| 9 | |||
| 10 | #define BUILD_SALT \ | ||
| 11 | ELFNOTE(Linux, LINUX_ELFNOTE_BUILD_SALT, .asciz CONFIG_BUILD_SALT) | ||
| 12 | |||
| 13 | #else | ||
| 14 | |||
| 15 | #define BUILD_SALT \ | ||
| 16 | ELFNOTE32("Linux", LINUX_ELFNOTE_BUILD_SALT, CONFIG_BUILD_SALT) | ||
| 17 | |||
| 18 | #endif | ||
| 19 | |||
| 20 | #endif /* __BUILD_SALT_H */ | ||
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 055aaf5ed9af..a83e1f632eb7 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
| @@ -143,7 +143,12 @@ u8 can_dlc2len(u8 can_dlc); | |||
| 143 | /* map the sanitized data length to an appropriate data length code */ | 143 | /* map the sanitized data length to an appropriate data length code */ |
| 144 | u8 can_len2dlc(u8 len); | 144 | u8 can_len2dlc(u8 len); |
| 145 | 145 | ||
| 146 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); | 146 | struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max, |
| 147 | unsigned int txqs, unsigned int rxqs); | ||
| 148 | #define alloc_candev(sizeof_priv, echo_skb_max) \ | ||
| 149 | alloc_candev_mqs(sizeof_priv, echo_skb_max, 1, 1) | ||
| 150 | #define alloc_candev_mq(sizeof_priv, echo_skb_max, count) \ | ||
| 151 | alloc_candev_mqs(sizeof_priv, echo_skb_max, count, count) | ||
| 147 | void free_candev(struct net_device *dev); | 152 | void free_candev(struct net_device *dev); |
| 148 | 153 | ||
| 149 | /* a candev safe wrapper around netdev_priv */ | 154 | /* a candev safe wrapper around netdev_priv */ |
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index e75dfd1f1dec..528271c60018 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/fs.h> /* not really needed, later.. */ | 14 | #include <linux/fs.h> /* not really needed, later.. */ |
| 15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
| 16 | #include <scsi/scsi_common.h> | ||
| 16 | #include <uapi/linux/cdrom.h> | 17 | #include <uapi/linux/cdrom.h> |
| 17 | 18 | ||
| 18 | struct packet_command | 19 | struct packet_command |
| @@ -21,7 +22,7 @@ struct packet_command | |||
| 21 | unsigned char *buffer; | 22 | unsigned char *buffer; |
| 22 | unsigned int buflen; | 23 | unsigned int buflen; |
| 23 | int stat; | 24 | int stat; |
| 24 | struct request_sense *sense; | 25 | struct scsi_sense_hdr *sshdr; |
| 25 | unsigned char data_direction; | 26 | unsigned char data_direction; |
| 26 | int quiet; | 27 | int quiet; |
| 27 | int timeout; | 28 | int timeout; |
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index c0e68f903011..ff20b677fb9f 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h | |||
| @@ -438,6 +438,9 @@ struct cgroup { | |||
| 438 | /* used to store eBPF programs */ | 438 | /* used to store eBPF programs */ |
| 439 | struct cgroup_bpf bpf; | 439 | struct cgroup_bpf bpf; |
| 440 | 440 | ||
| 441 | /* If there is block congestion on this cgroup. */ | ||
| 442 | atomic_t congestion_count; | ||
| 443 | |||
| 441 | /* ids of the ancestors at each level including self */ | 444 | /* ids of the ancestors at each level including self */ |
| 442 | int ancestor_ids[]; | 445 | int ancestor_ids[]; |
| 443 | }; | 446 | }; |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index c9fdf6f57913..32c553556bbd 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -554,6 +554,36 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp, | |||
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | /** | 556 | /** |
| 557 | * cgroup_ancestor - find ancestor of cgroup | ||
| 558 | * @cgrp: cgroup to find ancestor of | ||
| 559 | * @ancestor_level: level of ancestor to find starting from root | ||
| 560 | * | ||
| 561 | * Find ancestor of cgroup at specified level starting from root if it exists | ||
| 562 | * and return pointer to it. Return NULL if @cgrp doesn't have ancestor at | ||
| 563 | * @ancestor_level. | ||
| 564 | * | ||
| 565 | * This function is safe to call as long as @cgrp is accessible. | ||
| 566 | */ | ||
| 567 | static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp, | ||
| 568 | int ancestor_level) | ||
| 569 | { | ||
| 570 | struct cgroup *ptr; | ||
| 571 | |||
| 572 | if (cgrp->level < ancestor_level) | ||
| 573 | return NULL; | ||
| 574 | |||
| 575 | for (ptr = cgrp; | ||
| 576 | ptr && ptr->level > ancestor_level; | ||
| 577 | ptr = cgroup_parent(ptr)) | ||
| 578 | ; | ||
| 579 | |||
| 580 | if (ptr && ptr->level == ancestor_level) | ||
| 581 | return ptr; | ||
| 582 | |||
| 583 | return NULL; | ||
| 584 | } | ||
| 585 | |||
| 586 | /** | ||
| 557 | * task_under_cgroup_hierarchy - test task's membership of cgroup ancestry | 587 | * task_under_cgroup_hierarchy - test task's membership of cgroup ancestry |
| 558 | * @task: the task to be tested | 588 | * @task: the task to be tested |
| 559 | * @ancestor: possible ancestor of @task's cgroup | 589 | * @ancestor: possible ancestor of @task's cgroup |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index b7cfa037e593..08b1aa70a38d 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
| @@ -38,6 +38,8 @@ | |||
| 38 | #define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */ | 38 | #define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */ |
| 39 | /* parents need enable during gate/ungate, set rate and re-parent */ | 39 | /* parents need enable during gate/ungate, set rate and re-parent */ |
| 40 | #define CLK_OPS_PARENT_ENABLE BIT(12) | 40 | #define CLK_OPS_PARENT_ENABLE BIT(12) |
| 41 | /* duty cycle call may be forwarded to the parent clock */ | ||
| 42 | #define CLK_DUTY_CYCLE_PARENT BIT(13) | ||
| 41 | 43 | ||
| 42 | struct clk; | 44 | struct clk; |
| 43 | struct clk_hw; | 45 | struct clk_hw; |
| @@ -67,6 +69,17 @@ struct clk_rate_request { | |||
| 67 | }; | 69 | }; |
| 68 | 70 | ||
| 69 | /** | 71 | /** |
| 72 | * struct clk_duty - Struture encoding the duty cycle ratio of a clock | ||
| 73 | * | ||
| 74 | * @num: Numerator of the duty cycle ratio | ||
| 75 | * @den: Denominator of the duty cycle ratio | ||
| 76 | */ | ||
| 77 | struct clk_duty { | ||
| 78 | unsigned int num; | ||
| 79 | unsigned int den; | ||
| 80 | }; | ||
| 81 | |||
| 82 | /** | ||
| 70 | * struct clk_ops - Callback operations for hardware clocks; these are to | 83 | * struct clk_ops - Callback operations for hardware clocks; these are to |
| 71 | * be provided by the clock implementation, and will be called by drivers | 84 | * be provided by the clock implementation, and will be called by drivers |
| 72 | * through the clk_* api. | 85 | * through the clk_* api. |
| @@ -169,6 +182,15 @@ struct clk_rate_request { | |||
| 169 | * by the second argument. Valid values for degrees are | 182 | * by the second argument. Valid values for degrees are |
| 170 | * 0-359. Return 0 on success, otherwise -EERROR. | 183 | * 0-359. Return 0 on success, otherwise -EERROR. |
| 171 | * | 184 | * |
| 185 | * @get_duty_cycle: Queries the hardware to get the current duty cycle ratio | ||
| 186 | * of a clock. Returned values denominator cannot be 0 and must be | ||
| 187 | * superior or equal to the numerator. | ||
| 188 | * | ||
| 189 | * @set_duty_cycle: Apply the duty cycle ratio to this clock signal specified by | ||
| 190 | * the numerator (2nd argurment) and denominator (3rd argument). | ||
| 191 | * Argument must be a valid ratio (denominator > 0 | ||
| 192 | * and >= numerator) Return 0 on success, otherwise -EERROR. | ||
| 193 | * | ||
| 172 | * @init: Perform platform-specific initialization magic. | 194 | * @init: Perform platform-specific initialization magic. |
| 173 | * This is not not used by any of the basic clock types. | 195 | * This is not not used by any of the basic clock types. |
| 174 | * Please consider other ways of solving initialization problems | 196 | * Please consider other ways of solving initialization problems |
| @@ -218,6 +240,10 @@ struct clk_ops { | |||
| 218 | unsigned long parent_accuracy); | 240 | unsigned long parent_accuracy); |
| 219 | int (*get_phase)(struct clk_hw *hw); | 241 | int (*get_phase)(struct clk_hw *hw); |
| 220 | int (*set_phase)(struct clk_hw *hw, int degrees); | 242 | int (*set_phase)(struct clk_hw *hw, int degrees); |
| 243 | int (*get_duty_cycle)(struct clk_hw *hw, | ||
| 244 | struct clk_duty *duty); | ||
| 245 | int (*set_duty_cycle)(struct clk_hw *hw, | ||
| 246 | struct clk_duty *duty); | ||
| 221 | void (*init)(struct clk_hw *hw); | 247 | void (*init)(struct clk_hw *hw); |
| 222 | void (*debug_init)(struct clk_hw *hw, struct dentry *dentry); | 248 | void (*debug_init)(struct clk_hw *hw, struct dentry *dentry); |
| 223 | }; | 249 | }; |
diff --git a/include/linux/clk.h b/include/linux/clk.h index 0dbd0885b2c2..4f750c481b82 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
| @@ -142,6 +142,27 @@ int clk_set_phase(struct clk *clk, int degrees); | |||
| 142 | int clk_get_phase(struct clk *clk); | 142 | int clk_get_phase(struct clk *clk); |
| 143 | 143 | ||
| 144 | /** | 144 | /** |
| 145 | * clk_set_duty_cycle - adjust the duty cycle ratio of a clock signal | ||
| 146 | * @clk: clock signal source | ||
| 147 | * @num: numerator of the duty cycle ratio to be applied | ||
| 148 | * @den: denominator of the duty cycle ratio to be applied | ||
| 149 | * | ||
| 150 | * Adjust the duty cycle of a clock signal by the specified ratio. Returns 0 on | ||
| 151 | * success, -EERROR otherwise. | ||
| 152 | */ | ||
| 153 | int clk_set_duty_cycle(struct clk *clk, unsigned int num, unsigned int den); | ||
| 154 | |||
| 155 | /** | ||
| 156 | * clk_get_duty_cycle - return the duty cycle ratio of a clock signal | ||
| 157 | * @clk: clock signal source | ||
| 158 | * @scale: scaling factor to be applied to represent the ratio as an integer | ||
| 159 | * | ||
| 160 | * Returns the duty cycle ratio multiplied by the scale provided, otherwise | ||
| 161 | * returns -EERROR. | ||
| 162 | */ | ||
| 163 | int clk_get_scaled_duty_cycle(struct clk *clk, unsigned int scale); | ||
| 164 | |||
| 165 | /** | ||
| 145 | * clk_is_match - check if two clk's point to the same hardware clock | 166 | * clk_is_match - check if two clk's point to the same hardware clock |
| 146 | * @p: clk compared against q | 167 | * @p: clk compared against q |
| 147 | * @q: clk compared against p | 168 | * @q: clk compared against p |
| @@ -183,6 +204,18 @@ static inline long clk_get_phase(struct clk *clk) | |||
| 183 | return -ENOTSUPP; | 204 | return -ENOTSUPP; |
| 184 | } | 205 | } |
| 185 | 206 | ||
| 207 | static inline int clk_set_duty_cycle(struct clk *clk, unsigned int num, | ||
| 208 | unsigned int den) | ||
| 209 | { | ||
| 210 | return -ENOTSUPP; | ||
| 211 | } | ||
| 212 | |||
| 213 | static inline unsigned int clk_get_scaled_duty_cycle(struct clk *clk, | ||
| 214 | unsigned int scale) | ||
| 215 | { | ||
| 216 | return 0; | ||
| 217 | } | ||
| 218 | |||
| 186 | static inline bool clk_is_match(const struct clk *p, const struct clk *q) | 219 | static inline bool clk_is_match(const struct clk *p, const struct clk *q) |
| 187 | { | 220 | { |
| 188 | return p == q; | 221 | return p == q; |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 7dff1963c185..308918928767 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -194,6 +194,9 @@ extern void clocksource_suspend(void); | |||
| 194 | extern void clocksource_resume(void); | 194 | extern void clocksource_resume(void); |
| 195 | extern struct clocksource * __init clocksource_default_clock(void); | 195 | extern struct clocksource * __init clocksource_default_clock(void); |
| 196 | extern void clocksource_mark_unstable(struct clocksource *cs); | 196 | extern void clocksource_mark_unstable(struct clocksource *cs); |
| 197 | extern void | ||
| 198 | clocksource_start_suspend_timing(struct clocksource *cs, u64 start_cycles); | ||
| 199 | extern u64 clocksource_stop_suspend_timing(struct clocksource *cs, u64 now); | ||
| 197 | 200 | ||
| 198 | extern u64 | 201 | extern u64 |
| 199 | clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask, u64 *max_cycles); | 202 | clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask, u64 *max_cycles); |
diff --git a/include/linux/compat.h b/include/linux/compat.h index c68acc47da57..1a3c4f37e908 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
| @@ -115,11 +115,6 @@ typedef compat_ulong_t compat_aio_context_t; | |||
| 115 | struct compat_sel_arg_struct; | 115 | struct compat_sel_arg_struct; |
| 116 | struct rusage; | 116 | struct rusage; |
| 117 | 117 | ||
| 118 | struct compat_itimerspec { | ||
| 119 | struct compat_timespec it_interval; | ||
| 120 | struct compat_timespec it_value; | ||
| 121 | }; | ||
| 122 | |||
| 123 | struct compat_utimbuf { | 118 | struct compat_utimbuf { |
| 124 | compat_time_t actime; | 119 | compat_time_t actime; |
| 125 | compat_time_t modtime; | 120 | compat_time_t modtime; |
| @@ -300,10 +295,6 @@ extern int compat_get_timespec(struct timespec *, const void __user *); | |||
| 300 | extern int compat_put_timespec(const struct timespec *, void __user *); | 295 | extern int compat_put_timespec(const struct timespec *, void __user *); |
| 301 | extern int compat_get_timeval(struct timeval *, const void __user *); | 296 | extern int compat_get_timeval(struct timeval *, const void __user *); |
| 302 | extern int compat_put_timeval(const struct timeval *, void __user *); | 297 | extern int compat_put_timeval(const struct timeval *, void __user *); |
| 303 | extern int get_compat_itimerspec64(struct itimerspec64 *its, | ||
| 304 | const struct compat_itimerspec __user *uits); | ||
| 305 | extern int put_compat_itimerspec64(const struct itimerspec64 *its, | ||
| 306 | struct compat_itimerspec __user *uits); | ||
| 307 | 298 | ||
| 308 | struct compat_iovec { | 299 | struct compat_iovec { |
| 309 | compat_uptr_t iov_base; | 300 | compat_uptr_t iov_base; |
| @@ -1028,6 +1019,17 @@ static inline struct compat_timeval ns_to_compat_timeval(s64 nsec) | |||
| 1028 | return ctv; | 1019 | return ctv; |
| 1029 | } | 1020 | } |
| 1030 | 1021 | ||
| 1022 | /* | ||
| 1023 | * Kernel code should not call compat syscalls (i.e., compat_sys_xyzyyz()) | ||
| 1024 | * directly. Instead, use one of the functions which work equivalently, such | ||
| 1025 | * as the kcompat_sys_xyzyyz() functions prototyped below. | ||
| 1026 | */ | ||
| 1027 | |||
| 1028 | int kcompat_sys_statfs64(const char __user * pathname, compat_size_t sz, | ||
| 1029 | struct compat_statfs64 __user * buf); | ||
| 1030 | int kcompat_sys_fstatfs64(unsigned int fd, compat_size_t sz, | ||
| 1031 | struct compat_statfs64 __user * buf); | ||
| 1032 | |||
| 1031 | #else /* !CONFIG_COMPAT */ | 1033 | #else /* !CONFIG_COMPAT */ |
| 1032 | 1034 | ||
| 1033 | #define is_compat_task() (0) | 1035 | #define is_compat_task() (0) |
diff --git a/include/linux/compat_time.h b/include/linux/compat_time.h index 31f2774f1994..e70bfd1d2c3f 100644 --- a/include/linux/compat_time.h +++ b/include/linux/compat_time.h | |||
| @@ -17,7 +17,16 @@ struct compat_timeval { | |||
| 17 | s32 tv_usec; | 17 | s32 tv_usec; |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | struct compat_itimerspec { | ||
| 21 | struct compat_timespec it_interval; | ||
| 22 | struct compat_timespec it_value; | ||
| 23 | }; | ||
| 24 | |||
| 20 | extern int compat_get_timespec64(struct timespec64 *, const void __user *); | 25 | extern int compat_get_timespec64(struct timespec64 *, const void __user *); |
| 21 | extern int compat_put_timespec64(const struct timespec64 *, void __user *); | 26 | extern int compat_put_timespec64(const struct timespec64 *, void __user *); |
| 27 | extern int get_compat_itimerspec64(struct itimerspec64 *its, | ||
| 28 | const struct compat_itimerspec __user *uits); | ||
| 29 | extern int put_compat_itimerspec64(const struct itimerspec64 *its, | ||
| 30 | struct compat_itimerspec __user *uits); | ||
| 22 | 31 | ||
| 23 | #endif /* _LINUX_COMPAT_TIME_H */ | 32 | #endif /* _LINUX_COMPAT_TIME_H */ |
diff --git a/include/linux/console.h b/include/linux/console.h index dfd6b0e97855..f59f3dbca65c 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
| @@ -21,6 +21,7 @@ struct console_font_op; | |||
| 21 | struct console_font; | 21 | struct console_font; |
| 22 | struct module; | 22 | struct module; |
| 23 | struct tty_struct; | 23 | struct tty_struct; |
| 24 | struct notifier_block; | ||
| 24 | 25 | ||
| 25 | /* | 26 | /* |
| 26 | * this is what the terminal answers to a ESC-Z or csi0c query. | 27 | * this is what the terminal answers to a ESC-Z or csi0c query. |
| @@ -220,4 +221,8 @@ static inline bool vgacon_text_force(void) { return false; } | |||
| 220 | 221 | ||
| 221 | extern void console_init(void); | 222 | extern void console_init(void); |
| 222 | 223 | ||
| 224 | /* For deferred console takeover */ | ||
| 225 | void dummycon_register_output_notifier(struct notifier_block *nb); | ||
| 226 | void dummycon_unregister_output_notifier(struct notifier_block *nb); | ||
| 227 | |||
| 223 | #endif /* _LINUX_CONSOLE_H */ | 228 | #endif /* _LINUX_CONSOLE_H */ |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 3233fbe23594..218df7f4d3e1 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
| @@ -55,6 +55,8 @@ extern ssize_t cpu_show_spectre_v2(struct device *dev, | |||
| 55 | struct device_attribute *attr, char *buf); | 55 | struct device_attribute *attr, char *buf); |
| 56 | extern ssize_t cpu_show_spec_store_bypass(struct device *dev, | 56 | extern ssize_t cpu_show_spec_store_bypass(struct device *dev, |
| 57 | struct device_attribute *attr, char *buf); | 57 | struct device_attribute *attr, char *buf); |
| 58 | extern ssize_t cpu_show_l1tf(struct device *dev, | ||
| 59 | struct device_attribute *attr, char *buf); | ||
| 58 | 60 | ||
| 59 | extern __printf(4, 5) | 61 | extern __printf(4, 5) |
| 60 | struct device *cpu_device_create(struct device *parent, void *drvdata, | 62 | struct device *cpu_device_create(struct device *parent, void *drvdata, |
| @@ -103,6 +105,7 @@ extern void cpus_write_lock(void); | |||
| 103 | extern void cpus_write_unlock(void); | 105 | extern void cpus_write_unlock(void); |
| 104 | extern void cpus_read_lock(void); | 106 | extern void cpus_read_lock(void); |
| 105 | extern void cpus_read_unlock(void); | 107 | extern void cpus_read_unlock(void); |
| 108 | extern int cpus_read_trylock(void); | ||
| 106 | extern void lockdep_assert_cpus_held(void); | 109 | extern void lockdep_assert_cpus_held(void); |
| 107 | extern void cpu_hotplug_disable(void); | 110 | extern void cpu_hotplug_disable(void); |
| 108 | extern void cpu_hotplug_enable(void); | 111 | extern void cpu_hotplug_enable(void); |
| @@ -115,6 +118,7 @@ static inline void cpus_write_lock(void) { } | |||
| 115 | static inline void cpus_write_unlock(void) { } | 118 | static inline void cpus_write_unlock(void) { } |
| 116 | static inline void cpus_read_lock(void) { } | 119 | static inline void cpus_read_lock(void) { } |
| 117 | static inline void cpus_read_unlock(void) { } | 120 | static inline void cpus_read_unlock(void) { } |
| 121 | static inline int cpus_read_trylock(void) { return true; } | ||
| 118 | static inline void lockdep_assert_cpus_held(void) { } | 122 | static inline void lockdep_assert_cpus_held(void) { } |
| 119 | static inline void cpu_hotplug_disable(void) { } | 123 | static inline void cpu_hotplug_disable(void) { } |
| 120 | static inline void cpu_hotplug_enable(void) { } | 124 | static inline void cpu_hotplug_enable(void) { } |
| @@ -166,4 +170,23 @@ void cpuhp_report_idle_dead(void); | |||
| 166 | static inline void cpuhp_report_idle_dead(void) { } | 170 | static inline void cpuhp_report_idle_dead(void) { } |
| 167 | #endif /* #ifdef CONFIG_HOTPLUG_CPU */ | 171 | #endif /* #ifdef CONFIG_HOTPLUG_CPU */ |
| 168 | 172 | ||
| 173 | enum cpuhp_smt_control { | ||
| 174 | CPU_SMT_ENABLED, | ||
| 175 | CPU_SMT_DISABLED, | ||
| 176 | CPU_SMT_FORCE_DISABLED, | ||
| 177 | CPU_SMT_NOT_SUPPORTED, | ||
| 178 | }; | ||
| 179 | |||
| 180 | #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) | ||
| 181 | extern enum cpuhp_smt_control cpu_smt_control; | ||
| 182 | extern void cpu_smt_disable(bool force); | ||
| 183 | extern void cpu_smt_check_topology_early(void); | ||
| 184 | extern void cpu_smt_check_topology(void); | ||
| 185 | #else | ||
| 186 | # define cpu_smt_control (CPU_SMT_ENABLED) | ||
| 187 | static inline void cpu_smt_disable(bool force) { } | ||
| 188 | static inline void cpu_smt_check_topology_early(void) { } | ||
| 189 | static inline void cpu_smt_check_topology(void) { } | ||
| 190 | #endif | ||
| 191 | |||
| 169 | #endif /* _LINUX_CPU_H_ */ | 192 | #endif /* _LINUX_CPU_H_ */ |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 8796ba387152..4cf06a64bc02 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
| @@ -164,6 +164,7 @@ enum cpuhp_state { | |||
| 164 | CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE, | 164 | CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE, |
| 165 | CPUHP_AP_PERF_POWERPC_CORE_IMC_ONLINE, | 165 | CPUHP_AP_PERF_POWERPC_CORE_IMC_ONLINE, |
| 166 | CPUHP_AP_PERF_POWERPC_THREAD_IMC_ONLINE, | 166 | CPUHP_AP_PERF_POWERPC_THREAD_IMC_ONLINE, |
| 167 | CPUHP_AP_WATCHDOG_ONLINE, | ||
| 167 | CPUHP_AP_WORKQUEUE_ONLINE, | 168 | CPUHP_AP_WORKQUEUE_ONLINE, |
| 168 | CPUHP_AP_RCUTREE_ONLINE, | 169 | CPUHP_AP_RCUTREE_ONLINE, |
| 169 | CPUHP_AP_ONLINE_DYN, | 170 | CPUHP_AP_ONLINE_DYN, |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index bf53d893ad02..147bdec42215 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
| @@ -115,12 +115,17 @@ extern struct cpumask __cpu_active_mask; | |||
| 115 | #define cpu_active(cpu) ((cpu) == 0) | 115 | #define cpu_active(cpu) ((cpu) == 0) |
| 116 | #endif | 116 | #endif |
| 117 | 117 | ||
| 118 | /* verify cpu argument to cpumask_* operators */ | 118 | static inline void cpu_max_bits_warn(unsigned int cpu, unsigned int bits) |
| 119 | static inline unsigned int cpumask_check(unsigned int cpu) | ||
| 120 | { | 119 | { |
| 121 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 120 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
| 122 | WARN_ON_ONCE(cpu >= nr_cpumask_bits); | 121 | WARN_ON_ONCE(cpu >= bits); |
| 123 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ | 122 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ |
| 123 | } | ||
| 124 | |||
| 125 | /* verify cpu argument to cpumask_* operators */ | ||
| 126 | static inline unsigned int cpumask_check(unsigned int cpu) | ||
| 127 | { | ||
| 128 | cpu_max_bits_warn(cpu, nr_cpumask_bits); | ||
| 124 | return cpu; | 129 | return cpu; |
| 125 | } | 130 | } |
| 126 | 131 | ||
| @@ -154,6 +159,13 @@ static inline unsigned int cpumask_next_and(int n, | |||
| 154 | return n+1; | 159 | return n+1; |
| 155 | } | 160 | } |
| 156 | 161 | ||
| 162 | static inline unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, | ||
| 163 | int start, bool wrap) | ||
| 164 | { | ||
| 165 | /* cpu0 unless stop condition, wrap and at cpu0, then nr_cpumask_bits */ | ||
| 166 | return (wrap && n == 0); | ||
| 167 | } | ||
| 168 | |||
| 157 | /* cpu must be a valid cpu, ie 0, so there's no other choice. */ | 169 | /* cpu must be a valid cpu, ie 0, so there's no other choice. */ |
| 158 | static inline unsigned int cpumask_any_but(const struct cpumask *mask, | 170 | static inline unsigned int cpumask_any_but(const struct cpumask *mask, |
| 159 | unsigned int cpu) | 171 | unsigned int cpu) |
diff --git a/include/linux/crc32poly.h b/include/linux/crc32poly.h new file mode 100644 index 000000000000..62c4b7790a28 --- /dev/null +++ b/include/linux/crc32poly.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _LINUX_CRC32_POLY_H | ||
| 3 | #define _LINUX_CRC32_POLY_H | ||
| 4 | |||
| 5 | /* | ||
| 6 | * There are multiple 16-bit CRC polynomials in common use, but this is | ||
| 7 | * *the* standard CRC-32 polynomial, first popularized by Ethernet. | ||
| 8 | * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0 | ||
| 9 | */ | ||
| 10 | #define CRC32_POLY_LE 0xedb88320 | ||
| 11 | #define CRC32_POLY_BE 0x04c11db7 | ||
| 12 | |||
| 13 | /* | ||
| 14 | * This is the CRC32c polynomial, as outlined by Castagnoli. | ||
| 15 | * x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+ | ||
| 16 | * x^8+x^6+x^0 | ||
| 17 | */ | ||
| 18 | #define CRC32C_POLY_LE 0x82F63B78 | ||
| 19 | |||
| 20 | #endif /* _LINUX_CRC32_POLY_H */ | ||
diff --git a/include/linux/cred.h b/include/linux/cred.h index 631286535d0f..7eed6101c791 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h | |||
| @@ -65,6 +65,12 @@ extern void groups_free(struct group_info *); | |||
| 65 | 65 | ||
| 66 | extern int in_group_p(kgid_t); | 66 | extern int in_group_p(kgid_t); |
| 67 | extern int in_egroup_p(kgid_t); | 67 | extern int in_egroup_p(kgid_t); |
| 68 | extern int groups_search(const struct group_info *, kgid_t); | ||
| 69 | |||
| 70 | extern int set_current_groups(struct group_info *); | ||
| 71 | extern void set_groups(struct cred *, struct group_info *); | ||
| 72 | extern bool may_setgroups(void); | ||
| 73 | extern void groups_sort(struct group_info *); | ||
| 68 | #else | 74 | #else |
| 69 | static inline void groups_free(struct group_info *group_info) | 75 | static inline void groups_free(struct group_info *group_info) |
| 70 | { | 76 | { |
| @@ -78,12 +84,11 @@ static inline int in_egroup_p(kgid_t grp) | |||
| 78 | { | 84 | { |
| 79 | return 1; | 85 | return 1; |
| 80 | } | 86 | } |
| 87 | static inline int groups_search(const struct group_info *group_info, kgid_t grp) | ||
| 88 | { | ||
| 89 | return 1; | ||
| 90 | } | ||
| 81 | #endif | 91 | #endif |
| 82 | extern int set_current_groups(struct group_info *); | ||
| 83 | extern void set_groups(struct cred *, struct group_info *); | ||
| 84 | extern int groups_search(const struct group_info *, kgid_t); | ||
| 85 | extern bool may_setgroups(void); | ||
| 86 | extern void groups_sort(struct group_info *); | ||
| 87 | 92 | ||
| 88 | /* | 93 | /* |
| 89 | * The security context of a task | 94 | * The security context of a task |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 6eb06101089f..e8839d3a7559 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -113,6 +113,11 @@ | |||
| 113 | #define CRYPTO_ALG_OPTIONAL_KEY 0x00004000 | 113 | #define CRYPTO_ALG_OPTIONAL_KEY 0x00004000 |
| 114 | 114 | ||
| 115 | /* | 115 | /* |
| 116 | * Don't trigger module loading | ||
| 117 | */ | ||
| 118 | #define CRYPTO_NOLOAD 0x00008000 | ||
| 119 | |||
| 120 | /* | ||
| 116 | * Transform masks and values (for crt_flags). | 121 | * Transform masks and values (for crt_flags). |
| 117 | */ | 122 | */ |
| 118 | #define CRYPTO_TFM_NEED_KEY 0x00000001 | 123 | #define CRYPTO_TFM_NEED_KEY 0x00000001 |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 66c6e17e61e5..d32957b423d5 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -227,7 +227,6 @@ extern void d_instantiate(struct dentry *, struct inode *); | |||
| 227 | extern void d_instantiate_new(struct dentry *, struct inode *); | 227 | extern void d_instantiate_new(struct dentry *, struct inode *); |
| 228 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); | 228 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); |
| 229 | extern struct dentry * d_instantiate_anon(struct dentry *, struct inode *); | 229 | extern struct dentry * d_instantiate_anon(struct dentry *, struct inode *); |
| 230 | extern int d_instantiate_no_diralias(struct dentry *, struct inode *); | ||
| 231 | extern void __d_drop(struct dentry *dentry); | 230 | extern void __d_drop(struct dentry *dentry); |
| 232 | extern void d_drop(struct dentry *dentry); | 231 | extern void d_drop(struct dentry *dentry); |
| 233 | extern void d_delete(struct dentry *); | 232 | extern void d_delete(struct dentry *); |
| @@ -271,8 +270,6 @@ extern void d_rehash(struct dentry *); | |||
| 271 | 270 | ||
| 272 | extern void d_add(struct dentry *, struct inode *); | 271 | extern void d_add(struct dentry *, struct inode *); |
| 273 | 272 | ||
| 274 | extern void dentry_update_name_case(struct dentry *, const struct qstr *); | ||
| 275 | |||
| 276 | /* used for rename() and baskets */ | 273 | /* used for rename() and baskets */ |
| 277 | extern void d_move(struct dentry *, struct dentry *); | 274 | extern void d_move(struct dentry *, struct dentry *); |
| 278 | extern void d_exchange(struct dentry *, struct dentry *); | 275 | extern void d_exchange(struct dentry *, struct dentry *); |
diff --git a/include/linux/device.h b/include/linux/device.h index 055a69dbcd18..2a562f4ded07 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -90,7 +90,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | |||
| 90 | * @num_vf: Called to find out how many virtual functions a device on this | 90 | * @num_vf: Called to find out how many virtual functions a device on this |
| 91 | * bus supports. | 91 | * bus supports. |
| 92 | * @dma_configure: Called to setup DMA configuration on a device on | 92 | * @dma_configure: Called to setup DMA configuration on a device on |
| 93 | this bus. | 93 | * this bus. |
| 94 | * @pm: Power management operations of this bus, callback the specific | 94 | * @pm: Power management operations of this bus, callback the specific |
| 95 | * device driver's pm-ops. | 95 | * device driver's pm-ops. |
| 96 | * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU | 96 | * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU |
| @@ -384,6 +384,9 @@ int subsys_virtual_register(struct bus_type *subsys, | |||
| 384 | * @shutdown_pre: Called at shut-down time before driver shutdown. | 384 | * @shutdown_pre: Called at shut-down time before driver shutdown. |
| 385 | * @ns_type: Callbacks so sysfs can detemine namespaces. | 385 | * @ns_type: Callbacks so sysfs can detemine namespaces. |
| 386 | * @namespace: Namespace of the device belongs to this class. | 386 | * @namespace: Namespace of the device belongs to this class. |
| 387 | * @get_ownership: Allows class to specify uid/gid of the sysfs directories | ||
| 388 | * for the devices belonging to the class. Usually tied to | ||
| 389 | * device's namespace. | ||
| 387 | * @pm: The default device power management operations of this class. | 390 | * @pm: The default device power management operations of this class. |
| 388 | * @p: The private data of the driver core, no one other than the | 391 | * @p: The private data of the driver core, no one other than the |
| 389 | * driver core can touch this. | 392 | * driver core can touch this. |
| @@ -413,6 +416,8 @@ struct class { | |||
| 413 | const struct kobj_ns_type_operations *ns_type; | 416 | const struct kobj_ns_type_operations *ns_type; |
| 414 | const void *(*namespace)(struct device *dev); | 417 | const void *(*namespace)(struct device *dev); |
| 415 | 418 | ||
| 419 | void (*get_ownership)(struct device *dev, kuid_t *uid, kgid_t *gid); | ||
| 420 | |||
| 416 | const struct dev_pm_ops *pm; | 421 | const struct dev_pm_ops *pm; |
| 417 | 422 | ||
| 418 | struct subsys_private *p; | 423 | struct subsys_private *p; |
| @@ -784,14 +789,16 @@ enum device_link_state { | |||
| 784 | * Device link flags. | 789 | * Device link flags. |
| 785 | * | 790 | * |
| 786 | * STATELESS: The core won't track the presence of supplier/consumer drivers. | 791 | * STATELESS: The core won't track the presence of supplier/consumer drivers. |
| 787 | * AUTOREMOVE: Remove this link automatically on consumer driver unbind. | 792 | * AUTOREMOVE_CONSUMER: Remove the link automatically on consumer driver unbind. |
| 788 | * PM_RUNTIME: If set, the runtime PM framework will use this link. | 793 | * PM_RUNTIME: If set, the runtime PM framework will use this link. |
| 789 | * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. | 794 | * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. |
| 795 | * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind. | ||
| 790 | */ | 796 | */ |
| 791 | #define DL_FLAG_STATELESS BIT(0) | 797 | #define DL_FLAG_STATELESS BIT(0) |
| 792 | #define DL_FLAG_AUTOREMOVE BIT(1) | 798 | #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1) |
| 793 | #define DL_FLAG_PM_RUNTIME BIT(2) | 799 | #define DL_FLAG_PM_RUNTIME BIT(2) |
| 794 | #define DL_FLAG_RPM_ACTIVE BIT(3) | 800 | #define DL_FLAG_RPM_ACTIVE BIT(3) |
| 801 | #define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4) | ||
| 795 | 802 | ||
| 796 | /** | 803 | /** |
| 797 | * struct device_link - Device link representation. | 804 | * struct device_link - Device link representation. |
| @@ -886,6 +893,8 @@ struct dev_links_info { | |||
| 886 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all | 893 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all |
| 887 | * hardware supports 64-bit addresses for consistent allocations | 894 | * hardware supports 64-bit addresses for consistent allocations |
| 888 | * such descriptors. | 895 | * such descriptors. |
| 896 | * @bus_dma_mask: Mask of an upstream bridge or bus which imposes a smaller DMA | ||
| 897 | * limit than the device itself supports. | ||
| 889 | * @dma_pfn_offset: offset of DMA memory range relatively of RAM | 898 | * @dma_pfn_offset: offset of DMA memory range relatively of RAM |
| 890 | * @dma_parms: A low level driver may set these to teach IOMMU code about | 899 | * @dma_parms: A low level driver may set these to teach IOMMU code about |
| 891 | * segment limitations. | 900 | * segment limitations. |
| @@ -912,8 +921,6 @@ struct dev_links_info { | |||
| 912 | * @offline: Set after successful invocation of bus type's .offline(). | 921 | * @offline: Set after successful invocation of bus type's .offline(). |
| 913 | * @of_node_reused: Set if the device-tree node is shared with an ancestor | 922 | * @of_node_reused: Set if the device-tree node is shared with an ancestor |
| 914 | * device. | 923 | * device. |
| 915 | * @dma_32bit_limit: bridge limited to 32bit DMA even if the device itself | ||
| 916 | * indicates support for a higher limit in the dma_mask field. | ||
| 917 | * | 924 | * |
| 918 | * At the lowest level, every device in a Linux system is represented by an | 925 | * At the lowest level, every device in a Linux system is represented by an |
| 919 | * instance of struct device. The device structure contains the information | 926 | * instance of struct device. The device structure contains the information |
| @@ -967,6 +974,7 @@ struct device { | |||
| 967 | not all hardware supports | 974 | not all hardware supports |
| 968 | 64 bit addresses for consistent | 975 | 64 bit addresses for consistent |
| 969 | allocations such descriptors. */ | 976 | allocations such descriptors. */ |
| 977 | u64 bus_dma_mask; /* upstream dma_mask constraint */ | ||
| 970 | unsigned long dma_pfn_offset; | 978 | unsigned long dma_pfn_offset; |
| 971 | 979 | ||
| 972 | struct device_dma_parameters *dma_parms; | 980 | struct device_dma_parameters *dma_parms; |
| @@ -1002,7 +1010,6 @@ struct device { | |||
| 1002 | bool offline_disabled:1; | 1010 | bool offline_disabled:1; |
| 1003 | bool offline:1; | 1011 | bool offline:1; |
| 1004 | bool of_node_reused:1; | 1012 | bool of_node_reused:1; |
| 1005 | bool dma_32bit_limit:1; | ||
| 1006 | }; | 1013 | }; |
| 1007 | 1014 | ||
| 1008 | static inline struct device *kobj_to_dev(struct kobject *kobj) | 1015 | static inline struct device *kobj_to_dev(struct kobject *kobj) |
| @@ -1316,6 +1323,7 @@ extern const char *dev_driver_string(const struct device *dev); | |||
| 1316 | struct device_link *device_link_add(struct device *consumer, | 1323 | struct device_link *device_link_add(struct device *consumer, |
| 1317 | struct device *supplier, u32 flags); | 1324 | struct device *supplier, u32 flags); |
| 1318 | void device_link_del(struct device_link *link); | 1325 | void device_link_del(struct device_link *link); |
| 1326 | void device_link_remove(void *consumer, struct device *supplier); | ||
| 1319 | 1327 | ||
| 1320 | #ifdef CONFIG_PRINTK | 1328 | #ifdef CONFIG_PRINTK |
| 1321 | 1329 | ||
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 085db2fee2d7..58725f890b5b 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
| @@ -39,12 +39,12 @@ struct dma_buf_attachment; | |||
| 39 | 39 | ||
| 40 | /** | 40 | /** |
| 41 | * struct dma_buf_ops - operations possible on struct dma_buf | 41 | * struct dma_buf_ops - operations possible on struct dma_buf |
| 42 | * @map_atomic: maps a page from the buffer into kernel address | 42 | * @map_atomic: [optional] maps a page from the buffer into kernel address |
| 43 | * space, users may not block until the subsequent unmap call. | 43 | * space, users may not block until the subsequent unmap call. |
| 44 | * This callback must not sleep. | 44 | * This callback must not sleep. |
| 45 | * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer. | 45 | * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer. |
| 46 | * This Callback must not sleep. | 46 | * This Callback must not sleep. |
| 47 | * @map: maps a page from the buffer into kernel address space. | 47 | * @map: [optional] maps a page from the buffer into kernel address space. |
| 48 | * @unmap: [optional] unmaps a page from the buffer. | 48 | * @unmap: [optional] unmaps a page from the buffer. |
| 49 | * @vmap: [optional] creates a virtual mapping for the buffer into kernel | 49 | * @vmap: [optional] creates a virtual mapping for the buffer into kernel |
| 50 | * address space. Same restrictions as for vmap and friends apply. | 50 | * address space. Same restrictions as for vmap and friends apply. |
| @@ -55,11 +55,11 @@ struct dma_buf_ops { | |||
| 55 | * @attach: | 55 | * @attach: |
| 56 | * | 56 | * |
| 57 | * This is called from dma_buf_attach() to make sure that a given | 57 | * This is called from dma_buf_attach() to make sure that a given |
| 58 | * &device can access the provided &dma_buf. Exporters which support | 58 | * &dma_buf_attachment.dev can access the provided &dma_buf. Exporters |
| 59 | * buffer objects in special locations like VRAM or device-specific | 59 | * which support buffer objects in special locations like VRAM or |
| 60 | * carveout areas should check whether the buffer could be move to | 60 | * device-specific carveout areas should check whether the buffer could |
| 61 | * system memory (or directly accessed by the provided device), and | 61 | * be move to system memory (or directly accessed by the provided |
| 62 | * otherwise need to fail the attach operation. | 62 | * device), and otherwise need to fail the attach operation. |
| 63 | * | 63 | * |
| 64 | * The exporter should also in general check whether the current | 64 | * The exporter should also in general check whether the current |
| 65 | * allocation fullfills the DMA constraints of the new device. If this | 65 | * allocation fullfills the DMA constraints of the new device. If this |
| @@ -77,8 +77,7 @@ struct dma_buf_ops { | |||
| 77 | * to signal that backing storage is already allocated and incompatible | 77 | * to signal that backing storage is already allocated and incompatible |
| 78 | * with the requirements of requesting device. | 78 | * with the requirements of requesting device. |
| 79 | */ | 79 | */ |
| 80 | int (*attach)(struct dma_buf *, struct device *, | 80 | int (*attach)(struct dma_buf *, struct dma_buf_attachment *); |
| 81 | struct dma_buf_attachment *); | ||
| 82 | 81 | ||
| 83 | /** | 82 | /** |
| 84 | * @detach: | 83 | * @detach: |
| @@ -206,8 +205,6 @@ struct dma_buf_ops { | |||
| 206 | * to be restarted. | 205 | * to be restarted. |
| 207 | */ | 206 | */ |
| 208 | int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); | 207 | int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); |
| 209 | void *(*map_atomic)(struct dma_buf *, unsigned long); | ||
| 210 | void (*unmap_atomic)(struct dma_buf *, unsigned long, void *); | ||
| 211 | void *(*map)(struct dma_buf *, unsigned long); | 208 | void *(*map)(struct dma_buf *, unsigned long); |
| 212 | void (*unmap)(struct dma_buf *, unsigned long, void *); | 209 | void (*unmap)(struct dma_buf *, unsigned long, void *); |
| 213 | 210 | ||
| @@ -395,8 +392,6 @@ int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, | |||
| 395 | enum dma_data_direction dir); | 392 | enum dma_data_direction dir); |
| 396 | int dma_buf_end_cpu_access(struct dma_buf *dma_buf, | 393 | int dma_buf_end_cpu_access(struct dma_buf *dma_buf, |
| 397 | enum dma_data_direction dir); | 394 | enum dma_data_direction dir); |
| 398 | void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long); | ||
| 399 | void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *); | ||
| 400 | void *dma_buf_kmap(struct dma_buf *, unsigned long); | 395 | void *dma_buf_kmap(struct dma_buf *, unsigned long); |
| 401 | void dma_buf_kunmap(struct dma_buf *, unsigned long, void *); | 396 | void dma_buf_kunmap(struct dma_buf *, unsigned long, void *); |
| 402 | 397 | ||
diff --git a/include/linux/dma-direction.h b/include/linux/dma-direction.h index 3649a031893a..9c96e30e6a0b 100644 --- a/include/linux/dma-direction.h +++ b/include/linux/dma-direction.h | |||
| @@ -1,14 +1,12 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef _LINUX_DMA_DIRECTION_H | 2 | #ifndef _LINUX_DMA_DIRECTION_H |
| 3 | #define _LINUX_DMA_DIRECTION_H | 3 | #define _LINUX_DMA_DIRECTION_H |
| 4 | /* | 4 | |
| 5 | * These definitions mirror those in pci.h, so they can be used | ||
| 6 | * interchangeably with their PCI_ counterparts. | ||
| 7 | */ | ||
| 8 | enum dma_data_direction { | 5 | enum dma_data_direction { |
| 9 | DMA_BIDIRECTIONAL = 0, | 6 | DMA_BIDIRECTIONAL = 0, |
| 10 | DMA_TO_DEVICE = 1, | 7 | DMA_TO_DEVICE = 1, |
| 11 | DMA_FROM_DEVICE = 2, | 8 | DMA_FROM_DEVICE = 2, |
| 12 | DMA_NONE = 3, | 9 | DMA_NONE = 3, |
| 13 | }; | 10 | }; |
| 11 | |||
| 14 | #endif | 12 | #endif |
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index eb9b05aa5aea..02dba8cd033d 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h | |||
| @@ -166,7 +166,8 @@ struct dma_fence_ops { | |||
| 166 | * released when the fence is signalled (through e.g. the interrupt | 166 | * released when the fence is signalled (through e.g. the interrupt |
| 167 | * handler). | 167 | * handler). |
| 168 | * | 168 | * |
| 169 | * This callback is mandatory. | 169 | * This callback is optional. If this callback is not present, then the |
| 170 | * driver must always have signaling enabled. | ||
| 170 | */ | 171 | */ |
| 171 | bool (*enable_signaling)(struct dma_fence *fence); | 172 | bool (*enable_signaling)(struct dma_fence *fence); |
| 172 | 173 | ||
| @@ -190,11 +191,14 @@ struct dma_fence_ops { | |||
| 190 | /** | 191 | /** |
| 191 | * @wait: | 192 | * @wait: |
| 192 | * | 193 | * |
| 193 | * Custom wait implementation, or dma_fence_default_wait. | 194 | * Custom wait implementation, defaults to dma_fence_default_wait() if |
| 195 | * not set. | ||
| 194 | * | 196 | * |
| 195 | * Must not be NULL, set to dma_fence_default_wait for default implementation. | 197 | * The dma_fence_default_wait implementation should work for any fence, as long |
| 196 | * the dma_fence_default_wait implementation should work for any fence, as long | 198 | * as @enable_signaling works correctly. This hook allows drivers to |
| 197 | * as enable_signaling works correctly. | 199 | * have an optimized version for the case where a process context is |
| 200 | * already available, e.g. if @enable_signaling for the general case | ||
| 201 | * needs to set up a worker thread. | ||
| 198 | * | 202 | * |
| 199 | * Must return -ERESTARTSYS if the wait is intr = true and the wait was | 203 | * Must return -ERESTARTSYS if the wait is intr = true and the wait was |
| 200 | * interrupted, and remaining jiffies if fence has signaled, or 0 if wait | 204 | * interrupted, and remaining jiffies if fence has signaled, or 0 if wait |
| @@ -202,7 +206,7 @@ struct dma_fence_ops { | |||
| 202 | * which should be treated as if the fence is signaled. For example a hardware | 206 | * which should be treated as if the fence is signaled. For example a hardware |
| 203 | * lockup could be reported like that. | 207 | * lockup could be reported like that. |
| 204 | * | 208 | * |
| 205 | * This callback is mandatory. | 209 | * This callback is optional. |
| 206 | */ | 210 | */ |
| 207 | signed long (*wait)(struct dma_fence *fence, | 211 | signed long (*wait)(struct dma_fence *fence, |
| 208 | bool intr, signed long timeout); | 212 | bool intr, signed long timeout); |
| @@ -218,17 +222,6 @@ struct dma_fence_ops { | |||
| 218 | void (*release)(struct dma_fence *fence); | 222 | void (*release)(struct dma_fence *fence); |
| 219 | 223 | ||
| 220 | /** | 224 | /** |
| 221 | * @fill_driver_data: | ||
| 222 | * | ||
| 223 | * Callback to fill in free-form debug info. | ||
| 224 | * | ||
| 225 | * Returns amount of bytes filled, or negative error on failure. | ||
| 226 | * | ||
| 227 | * This callback is optional. | ||
| 228 | */ | ||
| 229 | int (*fill_driver_data)(struct dma_fence *fence, void *data, int size); | ||
| 230 | |||
| 231 | /** | ||
| 232 | * @fence_value_str: | 225 | * @fence_value_str: |
| 233 | * | 226 | * |
| 234 | * Callback to fill in free-form debug info specific to this fence, like | 227 | * Callback to fill in free-form debug info specific to this fence, like |
| @@ -242,8 +235,9 @@ struct dma_fence_ops { | |||
| 242 | * @timeline_value_str: | 235 | * @timeline_value_str: |
| 243 | * | 236 | * |
| 244 | * Fills in the current value of the timeline as a string, like the | 237 | * Fills in the current value of the timeline as a string, like the |
| 245 | * sequence number. This should match what @fill_driver_data prints for | 238 | * sequence number. Note that the specific fence passed to this function |
| 246 | * the most recently signalled fence (assuming no delayed signalling). | 239 | * should not matter, drivers should only use it to look up the |
| 240 | * corresponding timeline structures. | ||
| 247 | */ | 241 | */ |
| 248 | void (*timeline_value_str)(struct dma_fence *fence, | 242 | void (*timeline_value_str)(struct dma_fence *fence, |
| 249 | char *str, int size); | 243 | char *str, int size); |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index f9cc309507d9..1db6a6b46d0d 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
| @@ -538,10 +538,17 @@ static inline void dma_free_attrs(struct device *dev, size_t size, | |||
| 538 | const struct dma_map_ops *ops = get_dma_ops(dev); | 538 | const struct dma_map_ops *ops = get_dma_ops(dev); |
| 539 | 539 | ||
| 540 | BUG_ON(!ops); | 540 | BUG_ON(!ops); |
| 541 | WARN_ON(irqs_disabled()); | ||
| 542 | 541 | ||
| 543 | if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr)) | 542 | if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr)) |
| 544 | return; | 543 | return; |
| 544 | /* | ||
| 545 | * On non-coherent platforms which implement DMA-coherent buffers via | ||
| 546 | * non-cacheable remaps, ops->free() may call vunmap(). Thus getting | ||
| 547 | * this far in IRQ context is a) at risk of a BUG_ON() or trying to | ||
| 548 | * sleep on some machines, and b) an indication that the driver is | ||
| 549 | * probably misusing the coherent API anyway. | ||
| 550 | */ | ||
| 551 | WARN_ON(irqs_disabled()); | ||
| 545 | 552 | ||
| 546 | if (!ops->free || !cpu_addr) | 553 | if (!ops->free || !cpu_addr) |
| 547 | return; | 554 | return; |
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h index 10b2654d549b..a0aa00cc909d 100644 --- a/include/linux/dma-noncoherent.h +++ b/include/linux/dma-noncoherent.h | |||
| @@ -44,4 +44,12 @@ static inline void arch_sync_dma_for_cpu(struct device *dev, | |||
| 44 | } | 44 | } |
| 45 | #endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */ | 45 | #endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */ |
| 46 | 46 | ||
| 47 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL | ||
| 48 | void arch_sync_dma_for_cpu_all(struct device *dev); | ||
| 49 | #else | ||
| 50 | static inline void arch_sync_dma_for_cpu_all(struct device *dev) | ||
| 51 | { | ||
| 52 | } | ||
| 53 | #endif /* CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL */ | ||
| 54 | |||
| 47 | #endif /* _LINUX_DMA_NONCOHERENT_H */ | 55 | #endif /* _LINUX_DMA_NONCOHERENT_H */ |
diff --git a/include/linux/dma/pxa-dma.h b/include/linux/dma/pxa-dma.h index e56ec7af4fd7..9fc594f69eff 100644 --- a/include/linux/dma/pxa-dma.h +++ b/include/linux/dma/pxa-dma.h | |||
| @@ -9,6 +9,15 @@ enum pxad_chan_prio { | |||
| 9 | PXAD_PRIO_LOWEST, | 9 | PXAD_PRIO_LOWEST, |
| 10 | }; | 10 | }; |
| 11 | 11 | ||
| 12 | /** | ||
| 13 | * struct pxad_param - dma channel request parameters | ||
| 14 | * @drcmr: requestor line number | ||
| 15 | * @prio: minimal mandatory priority of the channel | ||
| 16 | * | ||
| 17 | * If a requested channel is granted, its priority will be at least @prio, | ||
| 18 | * ie. if PXAD_PRIO_LOW is required, the requested channel will be either | ||
| 19 | * PXAD_PRIO_LOW, PXAD_PRIO_NORMAL or PXAD_PRIO_HIGHEST. | ||
| 20 | */ | ||
| 12 | struct pxad_param { | 21 | struct pxad_param { |
| 13 | unsigned int drcmr; | 22 | unsigned int drcmr; |
| 14 | enum pxad_chan_prio prio; | 23 | enum pxad_chan_prio prio; |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 56add823f190..401e4b254e30 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -894,6 +894,16 @@ typedef struct _efi_file_handle { | |||
| 894 | void *flush; | 894 | void *flush; |
| 895 | } efi_file_handle_t; | 895 | } efi_file_handle_t; |
| 896 | 896 | ||
| 897 | typedef struct { | ||
| 898 | u64 revision; | ||
| 899 | u32 open_volume; | ||
| 900 | } efi_file_io_interface_32_t; | ||
| 901 | |||
| 902 | typedef struct { | ||
| 903 | u64 revision; | ||
| 904 | u64 open_volume; | ||
| 905 | } efi_file_io_interface_64_t; | ||
| 906 | |||
| 897 | typedef struct _efi_file_io_interface { | 907 | typedef struct _efi_file_io_interface { |
| 898 | u64 revision; | 908 | u64 revision; |
| 899 | int (*open_volume)(struct _efi_file_io_interface *, | 909 | int (*open_volume)(struct _efi_file_io_interface *, |
| @@ -988,14 +998,12 @@ extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); | |||
| 988 | extern void efi_gettimeofday (struct timespec64 *ts); | 998 | extern void efi_gettimeofday (struct timespec64 *ts); |
| 989 | extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ | 999 | extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ |
| 990 | #ifdef CONFIG_X86 | 1000 | #ifdef CONFIG_X86 |
| 991 | extern void efi_late_init(void); | ||
| 992 | extern void efi_free_boot_services(void); | 1001 | extern void efi_free_boot_services(void); |
| 993 | extern efi_status_t efi_query_variable_store(u32 attributes, | 1002 | extern efi_status_t efi_query_variable_store(u32 attributes, |
| 994 | unsigned long size, | 1003 | unsigned long size, |
| 995 | bool nonblocking); | 1004 | bool nonblocking); |
| 996 | extern void efi_find_mirror(void); | 1005 | extern void efi_find_mirror(void); |
| 997 | #else | 1006 | #else |
| 998 | static inline void efi_late_init(void) {} | ||
| 999 | static inline void efi_free_boot_services(void) {} | 1007 | static inline void efi_free_boot_services(void) {} |
| 1000 | 1008 | ||
| 1001 | static inline efi_status_t efi_query_variable_store(u32 attributes, | 1009 | static inline efi_status_t efi_query_variable_store(u32 attributes, |
| @@ -1651,4 +1659,7 @@ struct linux_efi_tpm_eventlog { | |||
| 1651 | 1659 | ||
| 1652 | extern int efi_tpm_eventlog_init(void); | 1660 | extern int efi_tpm_eventlog_init(void); |
| 1653 | 1661 | ||
| 1662 | /* Workqueue to queue EFI Runtime Services */ | ||
| 1663 | extern struct workqueue_struct *efi_rts_wq; | ||
| 1664 | |||
| 1654 | #endif /* _LINUX_EFI_H */ | 1665 | #endif /* _LINUX_EFI_H */ |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 79563840c295..572e11bb8696 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
| @@ -59,8 +59,7 @@ struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv, | |||
| 59 | unsigned int rxqs); | 59 | unsigned int rxqs); |
| 60 | #define devm_alloc_etherdev(dev, sizeof_priv) devm_alloc_etherdev_mqs(dev, sizeof_priv, 1, 1) | 60 | #define devm_alloc_etherdev(dev, sizeof_priv) devm_alloc_etherdev_mqs(dev, sizeof_priv, 1, 1) |
| 61 | 61 | ||
| 62 | struct sk_buff **eth_gro_receive(struct sk_buff **head, | 62 | struct sk_buff *eth_gro_receive(struct list_head *head, struct sk_buff *skb); |
| 63 | struct sk_buff *skb); | ||
| 64 | int eth_gro_complete(struct sk_buff *skb, int nhoff); | 63 | int eth_gro_complete(struct sk_buff *skb, int nhoff); |
| 65 | 64 | ||
| 66 | /* Reserved Ethernet Addresses per IEEE 802.1Q */ | 65 | /* Reserved Ethernet Addresses per IEEE 802.1Q */ |
diff --git a/include/linux/file.h b/include/linux/file.h index 279720db984a..6b2fb032416c 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -17,9 +17,12 @@ extern void fput(struct file *); | |||
| 17 | struct file_operations; | 17 | struct file_operations; |
| 18 | struct vfsmount; | 18 | struct vfsmount; |
| 19 | struct dentry; | 19 | struct dentry; |
| 20 | struct inode; | ||
| 20 | struct path; | 21 | struct path; |
| 21 | extern struct file *alloc_file(const struct path *, fmode_t mode, | 22 | extern struct file *alloc_file_pseudo(struct inode *, struct vfsmount *, |
| 22 | const struct file_operations *fop); | 23 | const char *, int flags, const struct file_operations *); |
| 24 | extern struct file *alloc_file_clone(struct file *, int flags, | ||
| 25 | const struct file_operations *); | ||
| 23 | 26 | ||
| 24 | static inline void fput_light(struct file *file, int fput_needed) | 27 | static inline void fput_light(struct file *file, int fput_needed) |
| 25 | { | 28 | { |
| @@ -78,7 +81,6 @@ extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); | |||
| 78 | extern int replace_fd(unsigned fd, struct file *file, unsigned flags); | 81 | extern int replace_fd(unsigned fd, struct file *file, unsigned flags); |
| 79 | extern void set_close_on_exec(unsigned int fd, int flag); | 82 | extern void set_close_on_exec(unsigned int fd, int flag); |
| 80 | extern bool get_close_on_exec(unsigned int fd); | 83 | extern bool get_close_on_exec(unsigned int fd); |
| 81 | extern void put_filp(struct file *); | ||
| 82 | extern int get_unused_fd_flags(unsigned flags); | 84 | extern int get_unused_fd_flags(unsigned flags); |
| 83 | extern void put_unused_fd(unsigned int fd); | 85 | extern void put_unused_fd(unsigned int fd); |
| 84 | 86 | ||
diff --git a/include/linux/filter.h b/include/linux/filter.h index c73dd7396886..5d565c50bcb2 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
| @@ -32,6 +32,7 @@ struct seccomp_data; | |||
| 32 | struct bpf_prog_aux; | 32 | struct bpf_prog_aux; |
| 33 | struct xdp_rxq_info; | 33 | struct xdp_rxq_info; |
| 34 | struct xdp_buff; | 34 | struct xdp_buff; |
| 35 | struct sock_reuseport; | ||
| 35 | 36 | ||
| 36 | /* ArgX, context and stack frame pointer register positions. Note, | 37 | /* ArgX, context and stack frame pointer register positions. Note, |
| 37 | * Arg1, Arg2, Arg3, etc are used as argument mappings of function | 38 | * Arg1, Arg2, Arg3, etc are used as argument mappings of function |
| @@ -537,6 +538,20 @@ struct sk_msg_buff { | |||
| 537 | struct list_head list; | 538 | struct list_head list; |
| 538 | }; | 539 | }; |
| 539 | 540 | ||
| 541 | struct bpf_redirect_info { | ||
| 542 | u32 ifindex; | ||
| 543 | u32 flags; | ||
| 544 | struct bpf_map *map; | ||
| 545 | struct bpf_map *map_to_flush; | ||
| 546 | unsigned long map_owner; | ||
| 547 | u32 kern_flags; | ||
| 548 | }; | ||
| 549 | |||
| 550 | DECLARE_PER_CPU(struct bpf_redirect_info, bpf_redirect_info); | ||
| 551 | |||
| 552 | /* flags for bpf_redirect_info kern_flags */ | ||
| 553 | #define BPF_RI_F_RF_NO_DIRECT BIT(0) /* no napi_direct on return_frame */ | ||
| 554 | |||
| 540 | /* Compute the linear packet data range [data, data_end) which | 555 | /* Compute the linear packet data range [data, data_end) which |
| 541 | * will be accessed by various program types (cls_bpf, act_bpf, | 556 | * will be accessed by various program types (cls_bpf, act_bpf, |
| 542 | * lwt, ...). Subsystems allowing direct data access must (!) | 557 | * lwt, ...). Subsystems allowing direct data access must (!) |
| @@ -738,6 +753,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); | |||
| 738 | int sk_attach_bpf(u32 ufd, struct sock *sk); | 753 | int sk_attach_bpf(u32 ufd, struct sock *sk); |
| 739 | int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk); | 754 | int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk); |
| 740 | int sk_reuseport_attach_bpf(u32 ufd, struct sock *sk); | 755 | int sk_reuseport_attach_bpf(u32 ufd, struct sock *sk); |
| 756 | void sk_reuseport_prog_free(struct bpf_prog *prog); | ||
| 741 | int sk_detach_filter(struct sock *sk); | 757 | int sk_detach_filter(struct sock *sk); |
| 742 | int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, | 758 | int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, |
| 743 | unsigned int len); | 759 | unsigned int len); |
| @@ -765,6 +781,27 @@ static inline bool bpf_dump_raw_ok(void) | |||
| 765 | struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, | 781 | struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, |
| 766 | const struct bpf_insn *patch, u32 len); | 782 | const struct bpf_insn *patch, u32 len); |
| 767 | 783 | ||
| 784 | static inline bool xdp_return_frame_no_direct(void) | ||
| 785 | { | ||
| 786 | struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info); | ||
| 787 | |||
| 788 | return ri->kern_flags & BPF_RI_F_RF_NO_DIRECT; | ||
| 789 | } | ||
| 790 | |||
| 791 | static inline void xdp_set_return_frame_no_direct(void) | ||
| 792 | { | ||
| 793 | struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info); | ||
| 794 | |||
| 795 | ri->kern_flags |= BPF_RI_F_RF_NO_DIRECT; | ||
| 796 | } | ||
| 797 | |||
| 798 | static inline void xdp_clear_return_frame_no_direct(void) | ||
| 799 | { | ||
| 800 | struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info); | ||
| 801 | |||
| 802 | ri->kern_flags &= ~BPF_RI_F_RF_NO_DIRECT; | ||
| 803 | } | ||
| 804 | |||
| 768 | static inline int xdp_ok_fwd_dev(const struct net_device *fwd, | 805 | static inline int xdp_ok_fwd_dev(const struct net_device *fwd, |
| 769 | unsigned int pktlen) | 806 | unsigned int pktlen) |
| 770 | { | 807 | { |
| @@ -798,6 +835,20 @@ void bpf_warn_invalid_xdp_action(u32 act); | |||
| 798 | struct sock *do_sk_redirect_map(struct sk_buff *skb); | 835 | struct sock *do_sk_redirect_map(struct sk_buff *skb); |
| 799 | struct sock *do_msg_redirect_map(struct sk_msg_buff *md); | 836 | struct sock *do_msg_redirect_map(struct sk_msg_buff *md); |
| 800 | 837 | ||
| 838 | #ifdef CONFIG_INET | ||
| 839 | struct sock *bpf_run_sk_reuseport(struct sock_reuseport *reuse, struct sock *sk, | ||
| 840 | struct bpf_prog *prog, struct sk_buff *skb, | ||
| 841 | u32 hash); | ||
| 842 | #else | ||
| 843 | static inline struct sock * | ||
| 844 | bpf_run_sk_reuseport(struct sock_reuseport *reuse, struct sock *sk, | ||
| 845 | struct bpf_prog *prog, struct sk_buff *skb, | ||
| 846 | u32 hash) | ||
| 847 | { | ||
| 848 | return NULL; | ||
| 849 | } | ||
| 850 | #endif | ||
| 851 | |||
| 801 | #ifdef CONFIG_BPF_JIT | 852 | #ifdef CONFIG_BPF_JIT |
| 802 | extern int bpf_jit_enable; | 853 | extern int bpf_jit_enable; |
| 803 | extern int bpf_jit_harden; | 854 | extern int bpf_jit_harden; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 805bf22898cf..1ec33fd0423f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -148,6 +148,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | |||
| 148 | /* Has write method(s) */ | 148 | /* Has write method(s) */ |
| 149 | #define FMODE_CAN_WRITE ((__force fmode_t)0x40000) | 149 | #define FMODE_CAN_WRITE ((__force fmode_t)0x40000) |
| 150 | 150 | ||
| 151 | #define FMODE_OPENED ((__force fmode_t)0x80000) | ||
| 152 | #define FMODE_CREATED ((__force fmode_t)0x100000) | ||
| 153 | |||
| 151 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 154 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
| 152 | #define FMODE_NONOTIFY ((__force fmode_t)0x4000000) | 155 | #define FMODE_NONOTIFY ((__force fmode_t)0x4000000) |
| 153 | 156 | ||
| @@ -275,6 +278,7 @@ struct writeback_control; | |||
| 275 | 278 | ||
| 276 | /* | 279 | /* |
| 277 | * Write life time hint values. | 280 | * Write life time hint values. |
| 281 | * Stored in struct inode as u8. | ||
| 278 | */ | 282 | */ |
| 279 | enum rw_hint { | 283 | enum rw_hint { |
| 280 | WRITE_LIFE_NOT_SET = 0, | 284 | WRITE_LIFE_NOT_SET = 0, |
| @@ -609,8 +613,8 @@ struct inode { | |||
| 609 | struct timespec64 i_ctime; | 613 | struct timespec64 i_ctime; |
| 610 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | 614 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ |
| 611 | unsigned short i_bytes; | 615 | unsigned short i_bytes; |
| 612 | unsigned int i_blkbits; | 616 | u8 i_blkbits; |
| 613 | enum rw_hint i_write_hint; | 617 | u8 i_write_hint; |
| 614 | blkcnt_t i_blocks; | 618 | blkcnt_t i_blocks; |
| 615 | 619 | ||
| 616 | #ifdef __NEED_I_SIZE_ORDERED | 620 | #ifdef __NEED_I_SIZE_ORDERED |
| @@ -685,6 +689,17 @@ static inline int inode_unhashed(struct inode *inode) | |||
| 685 | } | 689 | } |
| 686 | 690 | ||
| 687 | /* | 691 | /* |
| 692 | * __mark_inode_dirty expects inodes to be hashed. Since we don't | ||
| 693 | * want special inodes in the fileset inode space, we make them | ||
| 694 | * appear hashed, but do not put on any lists. hlist_del() | ||
| 695 | * will work fine and require no locking. | ||
| 696 | */ | ||
| 697 | static inline void inode_fake_hash(struct inode *inode) | ||
| 698 | { | ||
| 699 | hlist_add_fake(&inode->i_hash); | ||
| 700 | } | ||
| 701 | |||
| 702 | /* | ||
| 688 | * inode->i_mutex nesting subclasses for the lock validator: | 703 | * inode->i_mutex nesting subclasses for the lock validator: |
| 689 | * | 704 | * |
| 690 | * 0: the object of the current VFS operation | 705 | * 0: the object of the current VFS operation |
| @@ -1776,7 +1791,7 @@ struct inode_operations { | |||
| 1776 | int (*update_time)(struct inode *, struct timespec64 *, int); | 1791 | int (*update_time)(struct inode *, struct timespec64 *, int); |
| 1777 | int (*atomic_open)(struct inode *, struct dentry *, | 1792 | int (*atomic_open)(struct inode *, struct dentry *, |
| 1778 | struct file *, unsigned open_flag, | 1793 | struct file *, unsigned open_flag, |
| 1779 | umode_t create_mode, int *opened); | 1794 | umode_t create_mode); |
| 1780 | int (*tmpfile) (struct inode *, struct dentry *, umode_t); | 1795 | int (*tmpfile) (struct inode *, struct dentry *, umode_t); |
| 1781 | int (*set_acl)(struct inode *, struct posix_acl *, int); | 1796 | int (*set_acl)(struct inode *, struct posix_acl *, int); |
| 1782 | } ____cacheline_aligned; | 1797 | } ____cacheline_aligned; |
| @@ -2014,6 +2029,8 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) | |||
| 2014 | * I_OVL_INUSE Used by overlayfs to get exclusive ownership on upper | 2029 | * I_OVL_INUSE Used by overlayfs to get exclusive ownership on upper |
| 2015 | * and work dirs among overlayfs mounts. | 2030 | * and work dirs among overlayfs mounts. |
| 2016 | * | 2031 | * |
| 2032 | * I_CREATING New object's inode in the middle of setting up. | ||
| 2033 | * | ||
| 2017 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 2034 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
| 2018 | */ | 2035 | */ |
| 2019 | #define I_DIRTY_SYNC (1 << 0) | 2036 | #define I_DIRTY_SYNC (1 << 0) |
| @@ -2034,7 +2051,8 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) | |||
| 2034 | #define __I_DIRTY_TIME_EXPIRED 12 | 2051 | #define __I_DIRTY_TIME_EXPIRED 12 |
| 2035 | #define I_DIRTY_TIME_EXPIRED (1 << __I_DIRTY_TIME_EXPIRED) | 2052 | #define I_DIRTY_TIME_EXPIRED (1 << __I_DIRTY_TIME_EXPIRED) |
| 2036 | #define I_WB_SWITCH (1 << 13) | 2053 | #define I_WB_SWITCH (1 << 13) |
| 2037 | #define I_OVL_INUSE (1 << 14) | 2054 | #define I_OVL_INUSE (1 << 14) |
| 2055 | #define I_CREATING (1 << 15) | ||
| 2038 | 2056 | ||
| 2039 | #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) | 2057 | #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) |
| 2040 | #define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES) | 2058 | #define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES) |
| @@ -2420,7 +2438,10 @@ extern struct file *filp_open(const char *, int, umode_t); | |||
| 2420 | extern struct file *file_open_root(struct dentry *, struct vfsmount *, | 2438 | extern struct file *file_open_root(struct dentry *, struct vfsmount *, |
| 2421 | const char *, int, umode_t); | 2439 | const char *, int, umode_t); |
| 2422 | extern struct file * dentry_open(const struct path *, int, const struct cred *); | 2440 | extern struct file * dentry_open(const struct path *, int, const struct cred *); |
| 2423 | extern struct file *filp_clone_open(struct file *); | 2441 | static inline struct file *file_clone_open(struct file *file) |
| 2442 | { | ||
| 2443 | return dentry_open(&file->f_path, file->f_flags, file->f_cred); | ||
| 2444 | } | ||
| 2424 | extern int filp_close(struct file *, fl_owner_t id); | 2445 | extern int filp_close(struct file *, fl_owner_t id); |
| 2425 | 2446 | ||
| 2426 | extern struct filename *getname_flags(const char __user *, int, int *); | 2447 | extern struct filename *getname_flags(const char __user *, int, int *); |
| @@ -2428,13 +2449,8 @@ extern struct filename *getname(const char __user *); | |||
| 2428 | extern struct filename *getname_kernel(const char *); | 2449 | extern struct filename *getname_kernel(const char *); |
| 2429 | extern void putname(struct filename *name); | 2450 | extern void putname(struct filename *name); |
| 2430 | 2451 | ||
| 2431 | enum { | ||
| 2432 | FILE_CREATED = 1, | ||
| 2433 | FILE_OPENED = 2 | ||
| 2434 | }; | ||
| 2435 | extern int finish_open(struct file *file, struct dentry *dentry, | 2452 | extern int finish_open(struct file *file, struct dentry *dentry, |
| 2436 | int (*open)(struct inode *, struct file *), | 2453 | int (*open)(struct inode *, struct file *)); |
| 2437 | int *opened); | ||
| 2438 | extern int finish_no_open(struct file *file, struct dentry *dentry); | 2454 | extern int finish_no_open(struct file *file, struct dentry *dentry); |
| 2439 | 2455 | ||
| 2440 | /* fs/ioctl.c */ | 2456 | /* fs/ioctl.c */ |
| @@ -2622,8 +2638,6 @@ static inline int filemap_fdatawait(struct address_space *mapping) | |||
| 2622 | 2638 | ||
| 2623 | extern bool filemap_range_has_page(struct address_space *, loff_t lstart, | 2639 | extern bool filemap_range_has_page(struct address_space *, loff_t lstart, |
| 2624 | loff_t lend); | 2640 | loff_t lend); |
| 2625 | extern int __must_check file_fdatawait_range(struct file *file, loff_t lstart, | ||
| 2626 | loff_t lend); | ||
| 2627 | extern int filemap_write_and_wait(struct address_space *mapping); | 2641 | extern int filemap_write_and_wait(struct address_space *mapping); |
| 2628 | extern int filemap_write_and_wait_range(struct address_space *mapping, | 2642 | extern int filemap_write_and_wait_range(struct address_space *mapping, |
| 2629 | loff_t lstart, loff_t lend); | 2643 | loff_t lstart, loff_t lend); |
| @@ -2918,6 +2932,7 @@ extern void lockdep_annotate_inode_mutex_key(struct inode *inode); | |||
| 2918 | static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { }; | 2932 | static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { }; |
| 2919 | #endif | 2933 | #endif |
| 2920 | extern void unlock_new_inode(struct inode *); | 2934 | extern void unlock_new_inode(struct inode *); |
| 2935 | extern void discard_new_inode(struct inode *); | ||
| 2921 | extern unsigned int get_next_ino(void); | 2936 | extern unsigned int get_next_ino(void); |
| 2922 | extern void evict_inodes(struct super_block *sb); | 2937 | extern void evict_inodes(struct super_block *sb); |
| 2923 | 2938 | ||
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h index b462d9ea8007..c1f003aadcce 100644 --- a/include/linux/fsl/ptp_qoriq.h +++ b/include/linux/fsl/ptp_qoriq.h | |||
| @@ -11,9 +11,8 @@ | |||
| 11 | 11 | ||
| 12 | /* | 12 | /* |
| 13 | * qoriq ptp registers | 13 | * qoriq ptp registers |
| 14 | * Generated by regen.tcl on Thu May 13 01:38:57 PM CEST 2010 | ||
| 15 | */ | 14 | */ |
| 16 | struct qoriq_ptp_registers { | 15 | struct ctrl_regs { |
| 17 | u32 tmr_ctrl; /* Timer control register */ | 16 | u32 tmr_ctrl; /* Timer control register */ |
| 18 | u32 tmr_tevent; /* Timestamp event register */ | 17 | u32 tmr_tevent; /* Timestamp event register */ |
| 19 | u32 tmr_temask; /* Timer event mask register */ | 18 | u32 tmr_temask; /* Timer event mask register */ |
| @@ -28,22 +27,47 @@ struct qoriq_ptp_registers { | |||
| 28 | u8 res1[4]; | 27 | u8 res1[4]; |
| 29 | u32 tmroff_h; /* Timer offset high */ | 28 | u32 tmroff_h; /* Timer offset high */ |
| 30 | u32 tmroff_l; /* Timer offset low */ | 29 | u32 tmroff_l; /* Timer offset low */ |
| 31 | u8 res2[8]; | 30 | }; |
| 31 | |||
| 32 | struct alarm_regs { | ||
| 32 | u32 tmr_alarm1_h; /* Timer alarm 1 high register */ | 33 | u32 tmr_alarm1_h; /* Timer alarm 1 high register */ |
| 33 | u32 tmr_alarm1_l; /* Timer alarm 1 high register */ | 34 | u32 tmr_alarm1_l; /* Timer alarm 1 high register */ |
| 34 | u32 tmr_alarm2_h; /* Timer alarm 2 high register */ | 35 | u32 tmr_alarm2_h; /* Timer alarm 2 high register */ |
| 35 | u32 tmr_alarm2_l; /* Timer alarm 2 high register */ | 36 | u32 tmr_alarm2_l; /* Timer alarm 2 high register */ |
| 36 | u8 res3[48]; | 37 | }; |
| 38 | |||
| 39 | struct fiper_regs { | ||
| 37 | u32 tmr_fiper1; /* Timer fixed period interval */ | 40 | u32 tmr_fiper1; /* Timer fixed period interval */ |
| 38 | u32 tmr_fiper2; /* Timer fixed period interval */ | 41 | u32 tmr_fiper2; /* Timer fixed period interval */ |
| 39 | u32 tmr_fiper3; /* Timer fixed period interval */ | 42 | u32 tmr_fiper3; /* Timer fixed period interval */ |
| 40 | u8 res4[20]; | 43 | }; |
| 44 | |||
| 45 | struct etts_regs { | ||
| 41 | u32 tmr_etts1_h; /* Timestamp of general purpose external trigger */ | 46 | u32 tmr_etts1_h; /* Timestamp of general purpose external trigger */ |
| 42 | u32 tmr_etts1_l; /* Timestamp of general purpose external trigger */ | 47 | u32 tmr_etts1_l; /* Timestamp of general purpose external trigger */ |
| 43 | u32 tmr_etts2_h; /* Timestamp of general purpose external trigger */ | 48 | u32 tmr_etts2_h; /* Timestamp of general purpose external trigger */ |
| 44 | u32 tmr_etts2_l; /* Timestamp of general purpose external trigger */ | 49 | u32 tmr_etts2_l; /* Timestamp of general purpose external trigger */ |
| 45 | }; | 50 | }; |
| 46 | 51 | ||
| 52 | struct qoriq_ptp_registers { | ||
| 53 | struct ctrl_regs __iomem *ctrl_regs; | ||
| 54 | struct alarm_regs __iomem *alarm_regs; | ||
| 55 | struct fiper_regs __iomem *fiper_regs; | ||
| 56 | struct etts_regs __iomem *etts_regs; | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* Offset definitions for the four register groups */ | ||
| 60 | #define CTRL_REGS_OFFSET 0x0 | ||
| 61 | #define ALARM_REGS_OFFSET 0x40 | ||
| 62 | #define FIPER_REGS_OFFSET 0x80 | ||
| 63 | #define ETTS_REGS_OFFSET 0xa0 | ||
| 64 | |||
| 65 | #define FMAN_CTRL_REGS_OFFSET 0x80 | ||
| 66 | #define FMAN_ALARM_REGS_OFFSET 0xb8 | ||
| 67 | #define FMAN_FIPER_REGS_OFFSET 0xd0 | ||
| 68 | #define FMAN_ETTS_REGS_OFFSET 0xe0 | ||
| 69 | |||
| 70 | |||
| 47 | /* Bit definitions for the TMR_CTRL register */ | 71 | /* Bit definitions for the TMR_CTRL register */ |
| 48 | #define ALM1P (1<<31) /* Alarm1 output polarity */ | 72 | #define ALM1P (1<<31) /* Alarm1 output polarity */ |
| 49 | #define ALM2P (1<<30) /* Alarm2 output polarity */ | 73 | #define ALM2P (1<<30) /* Alarm2 output polarity */ |
| @@ -103,12 +127,16 @@ struct qoriq_ptp_registers { | |||
| 103 | 127 | ||
| 104 | 128 | ||
| 105 | #define DRIVER "ptp_qoriq" | 129 | #define DRIVER "ptp_qoriq" |
| 106 | #define DEFAULT_CKSEL 1 | ||
| 107 | #define N_EXT_TS 2 | 130 | #define N_EXT_TS 2 |
| 108 | #define REG_SIZE sizeof(struct qoriq_ptp_registers) | 131 | |
| 132 | #define DEFAULT_CKSEL 1 | ||
| 133 | #define DEFAULT_TMR_PRSC 2 | ||
| 134 | #define DEFAULT_FIPER1_PERIOD 1000000000 | ||
| 135 | #define DEFAULT_FIPER2_PERIOD 100000 | ||
| 109 | 136 | ||
| 110 | struct qoriq_ptp { | 137 | struct qoriq_ptp { |
| 111 | struct qoriq_ptp_registers __iomem *regs; | 138 | void __iomem *base; |
| 139 | struct qoriq_ptp_registers regs; | ||
| 112 | spinlock_t lock; /* protects regs */ | 140 | spinlock_t lock; /* protects regs */ |
| 113 | struct ptp_clock *clock; | 141 | struct ptp_clock *clock; |
| 114 | struct ptp_clock_info caps; | 142 | struct ptp_clock_info caps; |
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 4fe8f289b3f6..faebf0ca0686 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h | |||
| @@ -45,7 +45,7 @@ struct fwnode_endpoint { | |||
| 45 | struct fwnode_reference_args { | 45 | struct fwnode_reference_args { |
| 46 | struct fwnode_handle *fwnode; | 46 | struct fwnode_handle *fwnode; |
| 47 | unsigned int nargs; | 47 | unsigned int nargs; |
| 48 | unsigned int args[NR_FWNODE_REFERENCE_ARGS]; | 48 | u64 args[NR_FWNODE_REFERENCE_ARGS]; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 6cb8a5789668..57864422a2c8 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | #include <linux/percpu-refcount.h> | 17 | #include <linux/percpu-refcount.h> |
| 18 | #include <linux/uuid.h> | 18 | #include <linux/uuid.h> |
| 19 | #include <linux/blk_types.h> | ||
| 19 | 20 | ||
| 20 | #ifdef CONFIG_BLOCK | 21 | #ifdef CONFIG_BLOCK |
| 21 | 22 | ||
| @@ -82,10 +83,10 @@ struct partition { | |||
| 82 | } __attribute__((packed)); | 83 | } __attribute__((packed)); |
| 83 | 84 | ||
| 84 | struct disk_stats { | 85 | struct disk_stats { |
| 85 | unsigned long sectors[2]; /* READs and WRITEs */ | 86 | unsigned long sectors[NR_STAT_GROUPS]; |
| 86 | unsigned long ios[2]; | 87 | unsigned long ios[NR_STAT_GROUPS]; |
| 87 | unsigned long merges[2]; | 88 | unsigned long merges[NR_STAT_GROUPS]; |
| 88 | unsigned long ticks[2]; | 89 | unsigned long ticks[NR_STAT_GROUPS]; |
| 89 | unsigned long io_ticks; | 90 | unsigned long io_ticks; |
| 90 | unsigned long time_in_queue; | 91 | unsigned long time_in_queue; |
| 91 | }; | 92 | }; |
| @@ -353,6 +354,11 @@ static inline void free_part_stats(struct hd_struct *part) | |||
| 353 | 354 | ||
| 354 | #endif /* CONFIG_SMP */ | 355 | #endif /* CONFIG_SMP */ |
| 355 | 356 | ||
| 357 | #define part_stat_read_accum(part, field) \ | ||
| 358 | (part_stat_read(part, field[STAT_READ]) + \ | ||
| 359 | part_stat_read(part, field[STAT_WRITE]) + \ | ||
| 360 | part_stat_read(part, field[STAT_DISCARD])) | ||
| 361 | |||
| 356 | #define part_stat_add(cpu, part, field, addnd) do { \ | 362 | #define part_stat_add(cpu, part, field, addnd) do { \ |
| 357 | __part_stat_add((cpu), (part), field, addnd); \ | 363 | __part_stat_add((cpu), (part), field, addnd); \ |
| 358 | if ((part)->partno) \ | 364 | if ((part)->partno) \ |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 91ed23468530..39745b8bdd65 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
| 16 | 16 | ||
| 17 | /* see Documentation/gpio/gpio-legacy.txt */ | 17 | /* see Documentation/driver-api/gpio/legacy.rst */ |
| 18 | 18 | ||
| 19 | /* make these flag values available regardless of GPIO kconfig options */ | 19 | /* make these flag values available regardless of GPIO kconfig options */ |
| 20 | #define GPIOF_DIR_OUT (0 << 0) | 20 | #define GPIOF_DIR_OUT (0 << 0) |
diff --git a/include/linux/gpio/aspeed.h b/include/linux/gpio/aspeed.h new file mode 100644 index 000000000000..1bfb3cdc86d0 --- /dev/null +++ b/include/linux/gpio/aspeed.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #ifndef __GPIO_ASPEED_H | ||
| 2 | #define __GPIO_ASPEED_H | ||
| 3 | |||
| 4 | struct aspeed_gpio_copro_ops { | ||
| 5 | int (*request_access)(void *data); | ||
| 6 | int (*release_access)(void *data); | ||
| 7 | }; | ||
| 8 | |||
| 9 | int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc, | ||
| 10 | u16 *vreg_offset, u16 *dreg_offset, u8 *bit); | ||
| 11 | int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc); | ||
| 12 | int aspeed_gpio_copro_set_ops(const struct aspeed_gpio_copro_ops *ops, void *data); | ||
| 13 | |||
| 14 | |||
| 15 | #endif /* __GPIO_ASPEED_H */ | ||
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 243112c7fa7d..21ddbe440030 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h | |||
| @@ -41,11 +41,8 @@ enum gpiod_flags { | |||
| 41 | GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT, | 41 | GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT, |
| 42 | GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT | | 42 | GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT | |
| 43 | GPIOD_FLAGS_BIT_DIR_VAL, | 43 | GPIOD_FLAGS_BIT_DIR_VAL, |
| 44 | GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET | | 44 | GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_OPEN_DRAIN, |
| 45 | GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_OPEN_DRAIN, | 45 | GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_OPEN_DRAIN, |
| 46 | GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET | | ||
| 47 | GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_DIR_VAL | | ||
| 48 | GPIOD_FLAGS_BIT_OPEN_DRAIN, | ||
| 49 | }; | 46 | }; |
| 50 | 47 | ||
| 51 | #ifdef CONFIG_GPIOLIB | 48 | #ifdef CONFIG_GPIOLIB |
| @@ -145,6 +142,7 @@ int gpiod_is_active_low(const struct gpio_desc *desc); | |||
| 145 | int gpiod_cansleep(const struct gpio_desc *desc); | 142 | int gpiod_cansleep(const struct gpio_desc *desc); |
| 146 | 143 | ||
| 147 | int gpiod_to_irq(const struct gpio_desc *desc); | 144 | int gpiod_to_irq(const struct gpio_desc *desc); |
| 145 | void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name); | ||
| 148 | 146 | ||
| 149 | /* Convert between the old gpio_ and new gpiod_ interfaces */ | 147 | /* Convert between the old gpio_ and new gpiod_ interfaces */ |
| 150 | struct gpio_desc *gpio_to_desc(unsigned gpio); | 148 | struct gpio_desc *gpio_to_desc(unsigned gpio); |
| @@ -467,6 +465,12 @@ static inline int gpiod_to_irq(const struct gpio_desc *desc) | |||
| 467 | return -EINVAL; | 465 | return -EINVAL; |
| 468 | } | 466 | } |
| 469 | 467 | ||
| 468 | static inline void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name) | ||
| 469 | { | ||
| 470 | /* GPIO can never have been requested */ | ||
| 471 | WARN_ON(1); | ||
| 472 | } | ||
| 473 | |||
| 470 | static inline struct gpio_desc *gpio_to_desc(unsigned gpio) | 474 | static inline struct gpio_desc *gpio_to_desc(unsigned gpio) |
| 471 | { | 475 | { |
| 472 | return ERR_PTR(-EINVAL); | 476 | return ERR_PTR(-EINVAL); |
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 5382b5183b7e..0ea328e71ec9 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h | |||
| @@ -201,6 +201,8 @@ static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip) | |||
| 201 | * @reg_set: output set register (out=high) for generic GPIO | 201 | * @reg_set: output set register (out=high) for generic GPIO |
| 202 | * @reg_clr: output clear register (out=low) for generic GPIO | 202 | * @reg_clr: output clear register (out=low) for generic GPIO |
| 203 | * @reg_dir: direction setting register for generic GPIO | 203 | * @reg_dir: direction setting register for generic GPIO |
| 204 | * @bgpio_dir_inverted: indicates that the direction register is inverted | ||
| 205 | * (gpiolib private state variable) | ||
| 204 | * @bgpio_bits: number of register bits used for a generic GPIO i.e. | 206 | * @bgpio_bits: number of register bits used for a generic GPIO i.e. |
| 205 | * <register width> * 8 | 207 | * <register width> * 8 |
| 206 | * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep | 208 | * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep |
| @@ -267,6 +269,7 @@ struct gpio_chip { | |||
| 267 | void __iomem *reg_set; | 269 | void __iomem *reg_set; |
| 268 | void __iomem *reg_clr; | 270 | void __iomem *reg_clr; |
| 269 | void __iomem *reg_dir; | 271 | void __iomem *reg_dir; |
| 272 | bool bgpio_dir_inverted; | ||
| 270 | int bgpio_bits; | 273 | int bgpio_bits; |
| 271 | spinlock_t bgpio_lock; | 274 | spinlock_t bgpio_lock; |
| 272 | unsigned long bgpio_data; | 275 | unsigned long bgpio_data; |
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index e5fd2707b6df..9493d4a388db 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h | |||
| @@ -93,6 +93,7 @@ enum hwmon_temp_attributes { | |||
| 93 | #define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm) | 93 | #define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm) |
| 94 | #define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm) | 94 | #define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm) |
| 95 | #define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm) | 95 | #define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm) |
| 96 | #define HWMON_T_LCRIT_ALARM BIT(hwmon_temp_lcrit_alarm) | ||
| 96 | #define HWMON_T_EMERGENCY_ALARM BIT(hwmon_temp_emergency_alarm) | 97 | #define HWMON_T_EMERGENCY_ALARM BIT(hwmon_temp_emergency_alarm) |
| 97 | #define HWMON_T_FAULT BIT(hwmon_temp_fault) | 98 | #define HWMON_T_FAULT BIT(hwmon_temp_fault) |
| 98 | #define HWMON_T_OFFSET BIT(hwmon_temp_offset) | 99 | #define HWMON_T_OFFSET BIT(hwmon_temp_offset) |
| @@ -187,12 +188,16 @@ enum hwmon_power_attributes { | |||
| 187 | hwmon_power_cap_hyst, | 188 | hwmon_power_cap_hyst, |
| 188 | hwmon_power_cap_max, | 189 | hwmon_power_cap_max, |
| 189 | hwmon_power_cap_min, | 190 | hwmon_power_cap_min, |
| 191 | hwmon_power_min, | ||
| 190 | hwmon_power_max, | 192 | hwmon_power_max, |
| 191 | hwmon_power_crit, | 193 | hwmon_power_crit, |
| 194 | hwmon_power_lcrit, | ||
| 192 | hwmon_power_label, | 195 | hwmon_power_label, |
| 193 | hwmon_power_alarm, | 196 | hwmon_power_alarm, |
| 194 | hwmon_power_cap_alarm, | 197 | hwmon_power_cap_alarm, |
| 198 | hwmon_power_min_alarm, | ||
| 195 | hwmon_power_max_alarm, | 199 | hwmon_power_max_alarm, |
| 200 | hwmon_power_lcrit_alarm, | ||
| 196 | hwmon_power_crit_alarm, | 201 | hwmon_power_crit_alarm, |
| 197 | }; | 202 | }; |
| 198 | 203 | ||
| @@ -213,12 +218,16 @@ enum hwmon_power_attributes { | |||
| 213 | #define HWMON_P_CAP_HYST BIT(hwmon_power_cap_hyst) | 218 | #define HWMON_P_CAP_HYST BIT(hwmon_power_cap_hyst) |
| 214 | #define HWMON_P_CAP_MAX BIT(hwmon_power_cap_max) | 219 | #define HWMON_P_CAP_MAX BIT(hwmon_power_cap_max) |
| 215 | #define HWMON_P_CAP_MIN BIT(hwmon_power_cap_min) | 220 | #define HWMON_P_CAP_MIN BIT(hwmon_power_cap_min) |
| 221 | #define HWMON_P_MIN BIT(hwmon_power_min) | ||
| 216 | #define HWMON_P_MAX BIT(hwmon_power_max) | 222 | #define HWMON_P_MAX BIT(hwmon_power_max) |
| 223 | #define HWMON_P_LCRIT BIT(hwmon_power_lcrit) | ||
| 217 | #define HWMON_P_CRIT BIT(hwmon_power_crit) | 224 | #define HWMON_P_CRIT BIT(hwmon_power_crit) |
| 218 | #define HWMON_P_LABEL BIT(hwmon_power_label) | 225 | #define HWMON_P_LABEL BIT(hwmon_power_label) |
| 219 | #define HWMON_P_ALARM BIT(hwmon_power_alarm) | 226 | #define HWMON_P_ALARM BIT(hwmon_power_alarm) |
| 220 | #define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm) | 227 | #define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm) |
| 228 | #define HWMON_P_MIN_ALARM BIT(hwmon_power_max_alarm) | ||
| 221 | #define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm) | 229 | #define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm) |
| 230 | #define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm) | ||
| 222 | #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm) | 231 | #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm) |
| 223 | 232 | ||
| 224 | enum hwmon_energy_attributes { | 233 | enum hwmon_energy_attributes { |
| @@ -389,4 +398,27 @@ devm_hwmon_device_register_with_info(struct device *dev, | |||
| 389 | void hwmon_device_unregister(struct device *dev); | 398 | void hwmon_device_unregister(struct device *dev); |
| 390 | void devm_hwmon_device_unregister(struct device *dev); | 399 | void devm_hwmon_device_unregister(struct device *dev); |
| 391 | 400 | ||
| 401 | /** | ||
| 402 | * hwmon_is_bad_char - Is the char invalid in a hwmon name | ||
| 403 | * @ch: the char to be considered | ||
| 404 | * | ||
| 405 | * hwmon_is_bad_char() can be used to determine if the given character | ||
| 406 | * may not be used in a hwmon name. | ||
| 407 | * | ||
| 408 | * Returns true if the char is invalid, false otherwise. | ||
| 409 | */ | ||
| 410 | static inline bool hwmon_is_bad_char(const char ch) | ||
| 411 | { | ||
| 412 | switch (ch) { | ||
| 413 | case '-': | ||
| 414 | case '*': | ||
| 415 | case ' ': | ||
| 416 | case '\t': | ||
| 417 | case '\n': | ||
| 418 | return true; | ||
| 419 | default: | ||
| 420 | return false; | ||
| 421 | } | ||
| 422 | } | ||
| 423 | |||
| 392 | #endif | 424 | #endif |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 254cd34eeae2..465afb092fa7 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -140,9 +140,14 @@ extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, | |||
| 140 | and probably just as fast. | 140 | and probably just as fast. |
| 141 | Note that we use i2c_adapter here, because you do not need a specific | 141 | Note that we use i2c_adapter here, because you do not need a specific |
| 142 | smbus adapter to call this function. */ | 142 | smbus adapter to call this function. */ |
| 143 | extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | 143 | s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, |
| 144 | unsigned short flags, char read_write, u8 command, | 144 | unsigned short flags, char read_write, u8 command, |
| 145 | int size, union i2c_smbus_data *data); | 145 | int protocol, union i2c_smbus_data *data); |
| 146 | |||
| 147 | /* Unlocked flavor */ | ||
| 148 | s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | ||
| 149 | unsigned short flags, char read_write, u8 command, | ||
| 150 | int protocol, union i2c_smbus_data *data); | ||
| 146 | 151 | ||
| 147 | /* Now follow the 'nice' access routines. These also document the calling | 152 | /* Now follow the 'nice' access routines. These also document the calling |
| 148 | conventions of i2c_smbus_xfer. */ | 153 | conventions of i2c_smbus_xfer. */ |
diff --git a/include/linux/idle_inject.h b/include/linux/idle_inject.h new file mode 100644 index 000000000000..bdc0293fb6cb --- /dev/null +++ b/include/linux/idle_inject.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2018 Linaro Ltd | ||
| 4 | * | ||
| 5 | * Author: Daniel Lezcano <daniel.lezcano@linaro.org> | ||
| 6 | * | ||
| 7 | */ | ||
| 8 | #ifndef __IDLE_INJECT_H__ | ||
| 9 | #define __IDLE_INJECT_H__ | ||
| 10 | |||
| 11 | /* private idle injection device structure */ | ||
| 12 | struct idle_inject_device; | ||
| 13 | |||
| 14 | struct idle_inject_device *idle_inject_register(struct cpumask *cpumask); | ||
| 15 | |||
| 16 | void idle_inject_unregister(struct idle_inject_device *ii_dev); | ||
| 17 | |||
| 18 | int idle_inject_start(struct idle_inject_device *ii_dev); | ||
| 19 | |||
| 20 | void idle_inject_stop(struct idle_inject_device *ii_dev); | ||
| 21 | |||
| 22 | void idle_inject_set_duration(struct idle_inject_device *ii_dev, | ||
| 23 | unsigned int run_duration_ms, | ||
| 24 | unsigned int idle_duration_ms); | ||
| 25 | |||
| 26 | void idle_inject_get_duration(struct idle_inject_device *ii_dev, | ||
| 27 | unsigned int *run_duration_ms, | ||
| 28 | unsigned int *idle_duration_ms); | ||
| 29 | #endif /* __IDLE_INJECT_H__ */ | ||
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 8fe7e4306816..9c03a7d5e400 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
| @@ -1433,11 +1433,13 @@ struct ieee80211_ht_operation { | |||
| 1433 | #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 | 1433 | #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 |
| 1434 | 1434 | ||
| 1435 | /* | 1435 | /* |
| 1436 | * A-PMDU buffer sizes | 1436 | * A-MPDU buffer sizes |
| 1437 | * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) | 1437 | * According to HT size varies from 8 to 64 frames |
| 1438 | * HE adds the ability to have up to 256 frames. | ||
| 1438 | */ | 1439 | */ |
| 1439 | #define IEEE80211_MIN_AMPDU_BUF 0x8 | 1440 | #define IEEE80211_MIN_AMPDU_BUF 0x8 |
| 1440 | #define IEEE80211_MAX_AMPDU_BUF 0x40 | 1441 | #define IEEE80211_MAX_AMPDU_BUF_HT 0x40 |
| 1442 | #define IEEE80211_MAX_AMPDU_BUF 0x100 | ||
| 1441 | 1443 | ||
| 1442 | 1444 | ||
| 1443 | /* Spatial Multiplexing Power Save Modes (for capability) */ | 1445 | /* Spatial Multiplexing Power Save Modes (for capability) */ |
| @@ -1539,6 +1541,106 @@ struct ieee80211_vht_operation { | |||
| 1539 | __le16 basic_mcs_set; | 1541 | __le16 basic_mcs_set; |
| 1540 | } __packed; | 1542 | } __packed; |
| 1541 | 1543 | ||
| 1544 | /** | ||
| 1545 | * struct ieee80211_he_cap_elem - HE capabilities element | ||
| 1546 | * | ||
| 1547 | * This structure is the "HE capabilities element" fixed fields as | ||
| 1548 | * described in P802.11ax_D2.0 section 9.4.2.237.2 and 9.4.2.237.3 | ||
| 1549 | */ | ||
| 1550 | struct ieee80211_he_cap_elem { | ||
| 1551 | u8 mac_cap_info[5]; | ||
| 1552 | u8 phy_cap_info[9]; | ||
| 1553 | } __packed; | ||
| 1554 | |||
| 1555 | #define IEEE80211_TX_RX_MCS_NSS_DESC_MAX_LEN 5 | ||
| 1556 | |||
| 1557 | /** | ||
| 1558 | * enum ieee80211_he_mcs_support - HE MCS support definitions | ||
| 1559 | * @IEEE80211_HE_MCS_SUPPORT_0_7: MCSes 0-7 are supported for the | ||
| 1560 | * number of streams | ||
| 1561 | * @IEEE80211_HE_MCS_SUPPORT_0_9: MCSes 0-9 are supported | ||
| 1562 | * @IEEE80211_HE_MCS_SUPPORT_0_11: MCSes 0-11 are supported | ||
| 1563 | * @IEEE80211_HE_MCS_NOT_SUPPORTED: This number of streams isn't supported | ||
| 1564 | * | ||
| 1565 | * These definitions are used in each 2-bit subfield of the rx_mcs_* | ||
| 1566 | * and tx_mcs_* fields of &struct ieee80211_he_mcs_nss_supp, which are | ||
| 1567 | * both split into 8 subfields by number of streams. These values indicate | ||
| 1568 | * which MCSes are supported for the number of streams the value appears | ||
| 1569 | * for. | ||
| 1570 | */ | ||
| 1571 | enum ieee80211_he_mcs_support { | ||
| 1572 | IEEE80211_HE_MCS_SUPPORT_0_7 = 0, | ||
| 1573 | IEEE80211_HE_MCS_SUPPORT_0_9 = 1, | ||
| 1574 | IEEE80211_HE_MCS_SUPPORT_0_11 = 2, | ||
| 1575 | IEEE80211_HE_MCS_NOT_SUPPORTED = 3, | ||
| 1576 | }; | ||
| 1577 | |||
| 1578 | /** | ||
| 1579 | * struct ieee80211_he_mcs_nss_supp - HE Tx/Rx HE MCS NSS Support Field | ||
| 1580 | * | ||
| 1581 | * This structure holds the data required for the Tx/Rx HE MCS NSS Support Field | ||
| 1582 | * described in P802.11ax_D2.0 section 9.4.2.237.4 | ||
| 1583 | * | ||
| 1584 | * @rx_mcs_80: Rx MCS map 2 bits for each stream, total 8 streams, for channel | ||
| 1585 | * widths less than 80MHz. | ||
| 1586 | * @tx_mcs_80: Tx MCS map 2 bits for each stream, total 8 streams, for channel | ||
| 1587 | * widths less than 80MHz. | ||
| 1588 | * @rx_mcs_160: Rx MCS map 2 bits for each stream, total 8 streams, for channel | ||
| 1589 | * width 160MHz. | ||
| 1590 | * @tx_mcs_160: Tx MCS map 2 bits for each stream, total 8 streams, for channel | ||
| 1591 | * width 160MHz. | ||
| 1592 | * @rx_mcs_80p80: Rx MCS map 2 bits for each stream, total 8 streams, for | ||
| 1593 | * channel width 80p80MHz. | ||
| 1594 | * @tx_mcs_80p80: Tx MCS map 2 bits for each stream, total 8 streams, for | ||
| 1595 | * channel width 80p80MHz. | ||
| 1596 | */ | ||
| 1597 | struct ieee80211_he_mcs_nss_supp { | ||
| 1598 | __le16 rx_mcs_80; | ||
| 1599 | __le16 tx_mcs_80; | ||
| 1600 | __le16 rx_mcs_160; | ||
| 1601 | __le16 tx_mcs_160; | ||
| 1602 | __le16 rx_mcs_80p80; | ||
| 1603 | __le16 tx_mcs_80p80; | ||
| 1604 | } __packed; | ||
| 1605 | |||
| 1606 | /** | ||
| 1607 | * struct ieee80211_he_operation - HE capabilities element | ||
| 1608 | * | ||
| 1609 | * This structure is the "HE operation element" fields as | ||
| 1610 | * described in P802.11ax_D2.0 section 9.4.2.238 | ||
| 1611 | */ | ||
| 1612 | struct ieee80211_he_operation { | ||
| 1613 | __le32 he_oper_params; | ||
| 1614 | __le16 he_mcs_nss_set; | ||
| 1615 | /* Optional 0,1,3 or 4 bytes: depends on @he_oper_params */ | ||
| 1616 | u8 optional[0]; | ||
| 1617 | } __packed; | ||
| 1618 | |||
| 1619 | /** | ||
| 1620 | * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field | ||
| 1621 | * | ||
| 1622 | * This structure is the "MU AC Parameter Record" fields as | ||
| 1623 | * described in P802.11ax_D2.0 section 9.4.2.240 | ||
| 1624 | */ | ||
| 1625 | struct ieee80211_he_mu_edca_param_ac_rec { | ||
| 1626 | u8 aifsn; | ||
| 1627 | u8 ecw_min_max; | ||
| 1628 | u8 mu_edca_timer; | ||
| 1629 | } __packed; | ||
| 1630 | |||
| 1631 | /** | ||
| 1632 | * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element | ||
| 1633 | * | ||
| 1634 | * This structure is the "MU EDCA Parameter Set element" fields as | ||
| 1635 | * described in P802.11ax_D2.0 section 9.4.2.240 | ||
| 1636 | */ | ||
| 1637 | struct ieee80211_mu_edca_param_set { | ||
| 1638 | u8 mu_qos_info; | ||
| 1639 | struct ieee80211_he_mu_edca_param_ac_rec ac_be; | ||
| 1640 | struct ieee80211_he_mu_edca_param_ac_rec ac_bk; | ||
| 1641 | struct ieee80211_he_mu_edca_param_ac_rec ac_vi; | ||
| 1642 | struct ieee80211_he_mu_edca_param_ac_rec ac_vo; | ||
| 1643 | } __packed; | ||
| 1542 | 1644 | ||
| 1543 | /* 802.11ac VHT Capabilities */ | 1645 | /* 802.11ac VHT Capabilities */ |
| 1544 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 | 1646 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 |
| @@ -1577,6 +1679,328 @@ struct ieee80211_vht_operation { | |||
| 1577 | #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 | 1679 | #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 |
| 1578 | #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 | 1680 | #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 |
| 1579 | 1681 | ||
| 1682 | /* 802.11ax HE MAC capabilities */ | ||
| 1683 | #define IEEE80211_HE_MAC_CAP0_HTC_HE 0x01 | ||
| 1684 | #define IEEE80211_HE_MAC_CAP0_TWT_REQ 0x02 | ||
| 1685 | #define IEEE80211_HE_MAC_CAP0_TWT_RES 0x04 | ||
| 1686 | #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_NOT_SUPP 0x00 | ||
| 1687 | #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_1 0x08 | ||
| 1688 | #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_2 0x10 | ||
| 1689 | #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_3 0x18 | ||
| 1690 | #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_MASK 0x18 | ||
| 1691 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_1 0x00 | ||
| 1692 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_2 0x20 | ||
| 1693 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_4 0x40 | ||
| 1694 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_8 0x60 | ||
| 1695 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_16 0x80 | ||
| 1696 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_32 0xa0 | ||
| 1697 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_64 0xc0 | ||
| 1698 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_UNLIMITED 0xe0 | ||
| 1699 | #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_MASK 0xe0 | ||
| 1700 | |||
| 1701 | #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_UNLIMITED 0x00 | ||
| 1702 | #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_128 0x01 | ||
| 1703 | #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_256 0x02 | ||
| 1704 | #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_512 0x03 | ||
| 1705 | #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_MASK 0x03 | ||
| 1706 | #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_0US 0x00 | ||
| 1707 | #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_8US 0x04 | ||
| 1708 | #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x08 | ||
| 1709 | #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK 0x0c | ||
| 1710 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_1 0x00 | ||
| 1711 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_2 0x10 | ||
| 1712 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_3 0x20 | ||
| 1713 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_4 0x30 | ||
| 1714 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_5 0x40 | ||
| 1715 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_6 0x50 | ||
| 1716 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_7 0x60 | ||
| 1717 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_8 0x70 | ||
| 1718 | #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_MASK 0x70 | ||
| 1719 | |||
| 1720 | /* Link adaptation is split between byte HE_MAC_CAP1 and | ||
| 1721 | * HE_MAC_CAP2. It should be set only if IEEE80211_HE_MAC_CAP0_HTC_HE | ||
| 1722 | * in which case the following values apply: | ||
| 1723 | * 0 = No feedback. | ||
| 1724 | * 1 = reserved. | ||
| 1725 | * 2 = Unsolicited feedback. | ||
| 1726 | * 3 = both | ||
| 1727 | */ | ||
| 1728 | #define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION 0x80 | ||
| 1729 | |||
| 1730 | #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x01 | ||
| 1731 | #define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x02 | ||
| 1732 | #define IEEE80211_HE_MAC_CAP2_UL_MU_RESP_SCHED 0x04 | ||
| 1733 | #define IEEE80211_HE_MAC_CAP2_BSR 0x08 | ||
| 1734 | #define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10 | ||
| 1735 | #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x20 | ||
| 1736 | #define IEEE80211_HE_MAC_CAP2_MU_CASCADING 0x40 | ||
| 1737 | #define IEEE80211_HE_MAC_CAP2_ACK_EN 0x80 | ||
| 1738 | |||
| 1739 | #define IEEE80211_HE_MAC_CAP3_GRP_ADDR_MULTI_STA_BA_DL_MU 0x01 | ||
| 1740 | #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x02 | ||
| 1741 | #define IEEE80211_HE_MAC_CAP3_OFDMA_RA 0x04 | ||
| 1742 | |||
| 1743 | /* The maximum length of an A-MDPU is defined by the combination of the Maximum | ||
| 1744 | * A-MDPU Length Exponent field in the HT capabilities, VHT capabilities and the | ||
| 1745 | * same field in the HE capabilities. | ||
| 1746 | */ | ||
| 1747 | #define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_USE_VHT 0x00 | ||
| 1748 | #define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_VHT_1 0x08 | ||
| 1749 | #define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_VHT_2 0x10 | ||
| 1750 | #define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_RESERVED 0x18 | ||
| 1751 | #define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_MASK 0x18 | ||
| 1752 | #define IEEE80211_HE_MAC_CAP3_A_AMSDU_FRAG 0x20 | ||
| 1753 | #define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x40 | ||
| 1754 | #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80 | ||
| 1755 | |||
| 1756 | #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x01 | ||
| 1757 | #define IEEE80211_HE_MAC_CAP4_QTP 0x02 | ||
| 1758 | #define IEEE80211_HE_MAC_CAP4_BQR 0x04 | ||
| 1759 | #define IEEE80211_HE_MAC_CAP4_SR_RESP 0x08 | ||
| 1760 | #define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10 | ||
| 1761 | #define IEEE80211_HE_MAC_CAP4_OPS 0x20 | ||
| 1762 | #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x40 | ||
| 1763 | |||
| 1764 | /* 802.11ax HE PHY capabilities */ | ||
| 1765 | #define IEEE80211_HE_PHY_CAP0_DUAL_BAND 0x01 | ||
| 1766 | #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x02 | ||
| 1767 | #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x04 | ||
| 1768 | #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x08 | ||
| 1769 | #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G 0x10 | ||
| 1770 | #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G 0x20 | ||
| 1771 | #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G 0x40 | ||
| 1772 | #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK 0xfe | ||
| 1773 | |||
| 1774 | #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_80MHZ_ONLY_SECOND_20MHZ 0x01 | ||
| 1775 | #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_80MHZ_ONLY_SECOND_40MHZ 0x02 | ||
| 1776 | #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_160MHZ_ONLY_SECOND_20MHZ 0x04 | ||
| 1777 | #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_160MHZ_ONLY_SECOND_40MHZ 0x08 | ||
| 1778 | #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK 0x0f | ||
| 1779 | #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x10 | ||
| 1780 | #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x20 | ||
| 1781 | #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x40 | ||
| 1782 | /* Midamble RX Max NSTS is split between byte #2 and byte #3 */ | ||
| 1783 | #define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_MAX_NSTS 0x80 | ||
| 1784 | |||
| 1785 | #define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_MAX_NSTS 0x01 | ||
| 1786 | #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x02 | ||
| 1787 | #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x04 | ||
| 1788 | #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x08 | ||
| 1789 | #define IEEE80211_HE_PHY_CAP2_DOPPLER_TX 0x10 | ||
| 1790 | #define IEEE80211_HE_PHY_CAP2_DOPPLER_RX 0x20 | ||
| 1791 | |||
| 1792 | /* Note that the meaning of UL MU below is different between an AP and a non-AP | ||
| 1793 | * sta, where in the AP case it indicates support for Rx and in the non-AP sta | ||
| 1794 | * case it indicates support for Tx. | ||
| 1795 | */ | ||
| 1796 | #define IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO 0x40 | ||
| 1797 | #define IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO 0x80 | ||
| 1798 | |||
| 1799 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM 0x00 | ||
| 1800 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK 0x01 | ||
| 1801 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK 0x02 | ||
| 1802 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM 0x03 | ||
| 1803 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK 0x03 | ||
| 1804 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 0x00 | ||
| 1805 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2 0x04 | ||
| 1806 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM 0x00 | ||
| 1807 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK 0x08 | ||
| 1808 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK 0x10 | ||
| 1809 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM 0x18 | ||
| 1810 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x18 | ||
| 1811 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x00 | ||
| 1812 | #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2 0x20 | ||
| 1813 | #define IEEE80211_HE_PHY_CAP3_RX_HE_MU_PPDU_FROM_NON_AP_STA 0x40 | ||
| 1814 | #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x80 | ||
| 1815 | |||
| 1816 | #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x01 | ||
| 1817 | #define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER 0x02 | ||
| 1818 | |||
| 1819 | /* Minimal allowed value of Max STS under 80MHz is 3 */ | ||
| 1820 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 0x0c | ||
| 1821 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_5 0x10 | ||
| 1822 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_6 0x14 | ||
| 1823 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_7 0x18 | ||
| 1824 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8 0x1c | ||
| 1825 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK 0x1c | ||
| 1826 | |||
| 1827 | /* Minimal allowed value of Max STS above 80MHz is 3 */ | ||
| 1828 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4 0x60 | ||
| 1829 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_5 0x80 | ||
| 1830 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_6 0xa0 | ||
| 1831 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_7 0xc0 | ||
| 1832 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 0xe0 | ||
| 1833 | #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK 0xe0 | ||
| 1834 | |||
| 1835 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_1 0x00 | ||
| 1836 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 0x01 | ||
| 1837 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_3 0x02 | ||
| 1838 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_4 0x03 | ||
| 1839 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_5 0x04 | ||
| 1840 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_6 0x05 | ||
| 1841 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_7 0x06 | ||
| 1842 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_8 0x07 | ||
| 1843 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK 0x07 | ||
| 1844 | |||
| 1845 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_1 0x00 | ||
| 1846 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 0x08 | ||
| 1847 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_3 0x10 | ||
| 1848 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_4 0x18 | ||
| 1849 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_5 0x20 | ||
| 1850 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_6 0x28 | ||
| 1851 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_7 0x30 | ||
| 1852 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_8 0x38 | ||
| 1853 | #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK 0x38 | ||
| 1854 | |||
| 1855 | #define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK 0x40 | ||
| 1856 | #define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK 0x80 | ||
| 1857 | |||
| 1858 | #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x01 | ||
| 1859 | #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x02 | ||
| 1860 | #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB 0x04 | ||
| 1861 | #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB 0x08 | ||
| 1862 | #define IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB 0x10 | ||
| 1863 | #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x20 | ||
| 1864 | #define IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO 0x40 | ||
| 1865 | #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x80 | ||
| 1866 | |||
| 1867 | #define IEEE80211_HE_PHY_CAP7_SRP_BASED_SR 0x01 | ||
| 1868 | #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR 0x02 | ||
| 1869 | #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x04 | ||
| 1870 | #define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x08 | ||
| 1871 | #define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x10 | ||
| 1872 | #define IEEE80211_HE_PHY_CAP7_MAX_NC_3 0x18 | ||
| 1873 | #define IEEE80211_HE_PHY_CAP7_MAX_NC_4 0x20 | ||
| 1874 | #define IEEE80211_HE_PHY_CAP7_MAX_NC_5 0x28 | ||
| 1875 | #define IEEE80211_HE_PHY_CAP7_MAX_NC_6 0x30 | ||
| 1876 | #define IEEE80211_HE_PHY_CAP7_MAX_NC_7 0x38 | ||
| 1877 | #define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK 0x38 | ||
| 1878 | #define IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ 0x40 | ||
| 1879 | #define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ 0x80 | ||
| 1880 | |||
| 1881 | #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI 0x01 | ||
| 1882 | #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G 0x02 | ||
| 1883 | #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x04 | ||
| 1884 | #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x08 | ||
| 1885 | #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x10 | ||
| 1886 | #define IEEE80211_HE_PHY_CAP8_MIDAMBLE_RX_2X_AND_1XLTF 0x20 | ||
| 1887 | |||
| 1888 | /* 802.11ax HE TX/RX MCS NSS Support */ | ||
| 1889 | #define IEEE80211_TX_RX_MCS_NSS_SUPP_HIGHEST_MCS_POS (3) | ||
| 1890 | #define IEEE80211_TX_RX_MCS_NSS_SUPP_TX_BITMAP_POS (6) | ||
| 1891 | #define IEEE80211_TX_RX_MCS_NSS_SUPP_RX_BITMAP_POS (11) | ||
| 1892 | #define IEEE80211_TX_RX_MCS_NSS_SUPP_TX_BITMAP_MASK 0x07c0 | ||
| 1893 | #define IEEE80211_TX_RX_MCS_NSS_SUPP_RX_BITMAP_MASK 0xf800 | ||
| 1894 | |||
| 1895 | /* TX/RX HE MCS Support field Highest MCS subfield encoding */ | ||
| 1896 | enum ieee80211_he_highest_mcs_supported_subfield_enc { | ||
| 1897 | HIGHEST_MCS_SUPPORTED_MCS7 = 0, | ||
| 1898 | HIGHEST_MCS_SUPPORTED_MCS8, | ||
| 1899 | HIGHEST_MCS_SUPPORTED_MCS9, | ||
| 1900 | HIGHEST_MCS_SUPPORTED_MCS10, | ||
| 1901 | HIGHEST_MCS_SUPPORTED_MCS11, | ||
| 1902 | }; | ||
| 1903 | |||
| 1904 | /* Calculate 802.11ax HE capabilities IE Tx/Rx HE MCS NSS Support Field size */ | ||
| 1905 | static inline u8 | ||
| 1906 | ieee80211_he_mcs_nss_size(const struct ieee80211_he_cap_elem *he_cap) | ||
| 1907 | { | ||
| 1908 | u8 count = 4; | ||
| 1909 | |||
| 1910 | if (he_cap->phy_cap_info[0] & | ||
| 1911 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G) | ||
| 1912 | count += 4; | ||
| 1913 | |||
| 1914 | if (he_cap->phy_cap_info[0] & | ||
| 1915 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) | ||
| 1916 | count += 4; | ||
| 1917 | |||
| 1918 | return count; | ||
| 1919 | } | ||
| 1920 | |||
| 1921 | /* 802.11ax HE PPE Thresholds */ | ||
| 1922 | #define IEEE80211_PPE_THRES_NSS_SUPPORT_2NSS (1) | ||
| 1923 | #define IEEE80211_PPE_THRES_NSS_POS (0) | ||
| 1924 | #define IEEE80211_PPE_THRES_NSS_MASK (7) | ||
| 1925 | #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_2x966_AND_966_RU \ | ||
| 1926 | (BIT(5) | BIT(6)) | ||
| 1927 | #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK 0x78 | ||
| 1928 | #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_POS (3) | ||
| 1929 | #define IEEE80211_PPE_THRES_INFO_PPET_SIZE (3) | ||
| 1930 | |||
| 1931 | /* | ||
| 1932 | * Calculate 802.11ax HE capabilities IE PPE field size | ||
| 1933 | * Input: Header byte of ppe_thres (first byte), and HE capa IE's PHY cap u8* | ||
| 1934 | */ | ||
| 1935 | static inline u8 | ||
| 1936 | ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) | ||
| 1937 | { | ||
| 1938 | u8 n; | ||
| 1939 | |||
| 1940 | if ((phy_cap_info[6] & | ||
| 1941 | IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) == 0) | ||
| 1942 | return 0; | ||
| 1943 | |||
| 1944 | n = hweight8(ppe_thres_hdr & | ||
| 1945 | IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK); | ||
| 1946 | n *= (1 + ((ppe_thres_hdr & IEEE80211_PPE_THRES_NSS_MASK) >> | ||
| 1947 | IEEE80211_PPE_THRES_NSS_POS)); | ||
| 1948 | |||
| 1949 | /* | ||
| 1950 | * Each pair is 6 bits, and we need to add the 7 "header" bits to the | ||
| 1951 | * total size. | ||
| 1952 | */ | ||
| 1953 | n = (n * IEEE80211_PPE_THRES_INFO_PPET_SIZE * 2) + 7; | ||
| 1954 | n = DIV_ROUND_UP(n, 8); | ||
| 1955 | |||
| 1956 | return n; | ||
| 1957 | } | ||
| 1958 | |||
| 1959 | /* HE Operation defines */ | ||
| 1960 | #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x0000003f | ||
| 1961 | #define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x000001c0 | ||
| 1962 | #define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_OFFSET 6 | ||
| 1963 | #define IEEE80211_HE_OPERATION_TWT_REQUIRED 0x00000200 | ||
| 1964 | #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK 0x000ffc00 | ||
| 1965 | #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET 10 | ||
| 1966 | #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x000100000 | ||
| 1967 | #define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x000200000 | ||
| 1968 | #define IEEE80211_HE_OPERATION_MULTI_BSSID_AP 0x10000000 | ||
| 1969 | #define IEEE80211_HE_OPERATION_TX_BSSID_INDICATOR 0x20000000 | ||
| 1970 | #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x40000000 | ||
| 1971 | |||
| 1972 | /* | ||
| 1973 | * ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size | ||
| 1974 | * @he_oper_ie: byte data of the He Operations IE, stating from the the byte | ||
| 1975 | * after the ext ID byte. It is assumed that he_oper_ie has at least | ||
| 1976 | * sizeof(struct ieee80211_he_operation) bytes, checked already in | ||
| 1977 | * ieee802_11_parse_elems_crc() | ||
| 1978 | * @return the actual size of the IE data (not including header), or 0 on error | ||
| 1979 | */ | ||
| 1980 | static inline u8 | ||
| 1981 | ieee80211_he_oper_size(const u8 *he_oper_ie) | ||
| 1982 | { | ||
| 1983 | struct ieee80211_he_operation *he_oper = (void *)he_oper_ie; | ||
| 1984 | u8 oper_len = sizeof(struct ieee80211_he_operation); | ||
| 1985 | u32 he_oper_params; | ||
| 1986 | |||
| 1987 | /* Make sure the input is not NULL */ | ||
| 1988 | if (!he_oper_ie) | ||
| 1989 | return 0; | ||
| 1990 | |||
| 1991 | /* Calc required length */ | ||
| 1992 | he_oper_params = le32_to_cpu(he_oper->he_oper_params); | ||
| 1993 | if (he_oper_params & IEEE80211_HE_OPERATION_VHT_OPER_INFO) | ||
| 1994 | oper_len += 3; | ||
| 1995 | if (he_oper_params & IEEE80211_HE_OPERATION_MULTI_BSSID_AP) | ||
| 1996 | oper_len++; | ||
| 1997 | |||
| 1998 | /* Add the first byte (extension ID) to the total length */ | ||
| 1999 | oper_len++; | ||
| 2000 | |||
| 2001 | return oper_len; | ||
| 2002 | } | ||
| 2003 | |||
| 1580 | /* Authentication algorithms */ | 2004 | /* Authentication algorithms */ |
| 1581 | #define WLAN_AUTH_OPEN 0 | 2005 | #define WLAN_AUTH_OPEN 0 |
| 1582 | #define WLAN_AUTH_SHARED_KEY 1 | 2006 | #define WLAN_AUTH_SHARED_KEY 1 |
| @@ -1992,6 +2416,11 @@ enum ieee80211_eid_ext { | |||
| 1992 | WLAN_EID_EXT_FILS_WRAPPED_DATA = 8, | 2416 | WLAN_EID_EXT_FILS_WRAPPED_DATA = 8, |
| 1993 | WLAN_EID_EXT_FILS_PUBLIC_KEY = 12, | 2417 | WLAN_EID_EXT_FILS_PUBLIC_KEY = 12, |
| 1994 | WLAN_EID_EXT_FILS_NONCE = 13, | 2418 | WLAN_EID_EXT_FILS_NONCE = 13, |
| 2419 | WLAN_EID_EXT_FUTURE_CHAN_GUIDANCE = 14, | ||
| 2420 | WLAN_EID_EXT_HE_CAPABILITY = 35, | ||
| 2421 | WLAN_EID_EXT_HE_OPERATION = 36, | ||
| 2422 | WLAN_EID_EXT_UORA = 37, | ||
| 2423 | WLAN_EID_EXT_HE_MU_EDCA = 38, | ||
| 1995 | }; | 2424 | }; |
| 1996 | 2425 | ||
| 1997 | /* Action category code */ | 2426 | /* Action category code */ |
diff --git a/include/linux/if_team.h b/include/linux/if_team.h index d95cae09dea0..ac42da56f7a2 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h | |||
| @@ -74,6 +74,11 @@ struct team_port { | |||
| 74 | long mode_priv[0]; | 74 | long mode_priv[0]; |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | static inline struct team_port *team_port_get_rcu(const struct net_device *dev) | ||
| 78 | { | ||
| 79 | return rcu_dereference(dev->rx_handler_data); | ||
| 80 | } | ||
| 81 | |||
| 77 | static inline bool team_port_enabled(struct team_port *port) | 82 | static inline bool team_port_enabled(struct team_port *port) |
| 78 | { | 83 | { |
| 79 | return port->index != -1; | 84 | return port->index != -1; |
| @@ -84,6 +89,19 @@ static inline bool team_port_txable(struct team_port *port) | |||
| 84 | return port->linkup && team_port_enabled(port); | 89 | return port->linkup && team_port_enabled(port); |
| 85 | } | 90 | } |
| 86 | 91 | ||
| 92 | static inline bool team_port_dev_txable(const struct net_device *port_dev) | ||
| 93 | { | ||
| 94 | struct team_port *port; | ||
| 95 | bool txable; | ||
| 96 | |||
| 97 | rcu_read_lock(); | ||
| 98 | port = team_port_get_rcu(port_dev); | ||
| 99 | txable = port ? team_port_txable(port) : false; | ||
| 100 | rcu_read_unlock(); | ||
| 101 | |||
| 102 | return txable; | ||
| 103 | } | ||
| 104 | |||
| 87 | #ifdef CONFIG_NET_POLL_CONTROLLER | 105 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 88 | static inline void team_netpoll_send_skb(struct team_port *port, | 106 | static inline void team_netpoll_send_skb(struct team_port *port, |
| 89 | struct sk_buff *skb) | 107 | struct sk_buff *skb) |
diff --git a/include/linux/ima.h b/include/linux/ima.h index 0e4647e0eb60..97914a2833d1 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h | |||
| @@ -11,14 +11,16 @@ | |||
| 11 | #define _LINUX_IMA_H | 11 | #define _LINUX_IMA_H |
| 12 | 12 | ||
| 13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
| 14 | #include <linux/security.h> | ||
| 14 | #include <linux/kexec.h> | 15 | #include <linux/kexec.h> |
| 15 | struct linux_binprm; | 16 | struct linux_binprm; |
| 16 | 17 | ||
| 17 | #ifdef CONFIG_IMA | 18 | #ifdef CONFIG_IMA |
| 18 | extern int ima_bprm_check(struct linux_binprm *bprm); | 19 | extern int ima_bprm_check(struct linux_binprm *bprm); |
| 19 | extern int ima_file_check(struct file *file, int mask, int opened); | 20 | extern int ima_file_check(struct file *file, int mask); |
| 20 | extern void ima_file_free(struct file *file); | 21 | extern void ima_file_free(struct file *file); |
| 21 | extern int ima_file_mmap(struct file *file, unsigned long prot); | 22 | extern int ima_file_mmap(struct file *file, unsigned long prot); |
| 23 | extern int ima_load_data(enum kernel_load_data_id id); | ||
| 22 | extern int ima_read_file(struct file *file, enum kernel_read_file_id id); | 24 | extern int ima_read_file(struct file *file, enum kernel_read_file_id id); |
| 23 | extern int ima_post_read_file(struct file *file, void *buf, loff_t size, | 25 | extern int ima_post_read_file(struct file *file, void *buf, loff_t size, |
| 24 | enum kernel_read_file_id id); | 26 | enum kernel_read_file_id id); |
| @@ -34,7 +36,7 @@ static inline int ima_bprm_check(struct linux_binprm *bprm) | |||
| 34 | return 0; | 36 | return 0; |
| 35 | } | 37 | } |
| 36 | 38 | ||
| 37 | static inline int ima_file_check(struct file *file, int mask, int opened) | 39 | static inline int ima_file_check(struct file *file, int mask) |
| 38 | { | 40 | { |
| 39 | return 0; | 41 | return 0; |
| 40 | } | 42 | } |
| @@ -49,6 +51,11 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot) | |||
| 49 | return 0; | 51 | return 0; |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 54 | static inline int ima_load_data(enum kernel_load_data_id id) | ||
| 55 | { | ||
| 56 | return 0; | ||
| 57 | } | ||
| 58 | |||
| 52 | static inline int ima_read_file(struct file *file, enum kernel_read_file_id id) | 59 | static inline int ima_read_file(struct file *file, enum kernel_read_file_id id) |
| 53 | { | 60 | { |
| 54 | return 0; | 61 | return 0; |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 27650f1bff3d..c759d1cbcedd 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
| @@ -93,6 +93,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
| 93 | 93 | ||
| 94 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) | 94 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) |
| 95 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) | 95 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) |
| 96 | #define IN_DEV_BFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), BC_FORWARDING) | ||
| 96 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) | 97 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) |
| 97 | #define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK) | 98 | #define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK) |
| 98 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ | 99 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ |
diff --git a/include/linux/integrity.h b/include/linux/integrity.h index 858d3f4a2241..54c853ec2fd1 100644 --- a/include/linux/integrity.h +++ b/include/linux/integrity.h | |||
| @@ -44,4 +44,17 @@ static inline void integrity_load_keys(void) | |||
| 44 | } | 44 | } |
| 45 | #endif /* CONFIG_INTEGRITY */ | 45 | #endif /* CONFIG_INTEGRITY */ |
| 46 | 46 | ||
| 47 | #ifdef CONFIG_INTEGRITY_ASYMMETRIC_KEYS | ||
| 48 | |||
| 49 | extern int integrity_kernel_module_request(char *kmod_name); | ||
| 50 | |||
| 51 | #else | ||
| 52 | |||
| 53 | static inline int integrity_kernel_module_request(char *kmod_name) | ||
| 54 | { | ||
| 55 | return 0; | ||
| 56 | } | ||
| 57 | |||
| 58 | #endif /* CONFIG_INTEGRITY_ASYMMETRIC_KEYS */ | ||
| 59 | |||
| 47 | #endif /* _LINUX_INTEGRITY_H */ | 60 | #endif /* _LINUX_INTEGRITY_H */ |
diff --git a/include/linux/iomap.h b/include/linux/iomap.h index a044a824da85..3555d54bf79a 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | #ifndef LINUX_IOMAP_H | 2 | #ifndef LINUX_IOMAP_H |
| 3 | #define LINUX_IOMAP_H 1 | 3 | #define LINUX_IOMAP_H 1 |
| 4 | 4 | ||
| 5 | #include <linux/atomic.h> | ||
| 6 | #include <linux/bitmap.h> | ||
| 7 | #include <linux/mm.h> | ||
| 5 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 6 | 9 | ||
| 7 | struct address_space; | 10 | struct address_space; |
| @@ -9,6 +12,7 @@ struct fiemap_extent_info; | |||
| 9 | struct inode; | 12 | struct inode; |
| 10 | struct iov_iter; | 13 | struct iov_iter; |
| 11 | struct kiocb; | 14 | struct kiocb; |
| 15 | struct page; | ||
| 12 | struct vm_area_struct; | 16 | struct vm_area_struct; |
| 13 | struct vm_fault; | 17 | struct vm_fault; |
| 14 | 18 | ||
| @@ -29,6 +33,7 @@ struct vm_fault; | |||
| 29 | */ | 33 | */ |
| 30 | #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ | 34 | #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ |
| 31 | #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ | 35 | #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ |
| 36 | #define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */ | ||
| 32 | 37 | ||
| 33 | /* | 38 | /* |
| 34 | * Flags that only need to be reported for IOMAP_REPORT requests: | 39 | * Flags that only need to be reported for IOMAP_REPORT requests: |
| @@ -55,6 +60,16 @@ struct iomap { | |||
| 55 | u16 flags; /* flags for mapping */ | 60 | u16 flags; /* flags for mapping */ |
| 56 | struct block_device *bdev; /* block device for I/O */ | 61 | struct block_device *bdev; /* block device for I/O */ |
| 57 | struct dax_device *dax_dev; /* dax_dev for dax operations */ | 62 | struct dax_device *dax_dev; /* dax_dev for dax operations */ |
| 63 | void *inline_data; | ||
| 64 | void *private; /* filesystem private */ | ||
| 65 | |||
| 66 | /* | ||
| 67 | * Called when finished processing a page in the mapping returned in | ||
| 68 | * this iomap. At least for now this is only supported in the buffered | ||
| 69 | * write path. | ||
| 70 | */ | ||
| 71 | void (*page_done)(struct inode *inode, loff_t pos, unsigned copied, | ||
| 72 | struct page *page, struct iomap *iomap); | ||
| 58 | }; | 73 | }; |
| 59 | 74 | ||
| 60 | /* | 75 | /* |
| @@ -86,8 +101,40 @@ struct iomap_ops { | |||
| 86 | ssize_t written, unsigned flags, struct iomap *iomap); | 101 | ssize_t written, unsigned flags, struct iomap *iomap); |
| 87 | }; | 102 | }; |
| 88 | 103 | ||
| 104 | /* | ||
| 105 | * Structure allocate for each page when block size < PAGE_SIZE to track | ||
| 106 | * sub-page uptodate status and I/O completions. | ||
| 107 | */ | ||
| 108 | struct iomap_page { | ||
| 109 | atomic_t read_count; | ||
| 110 | atomic_t write_count; | ||
| 111 | DECLARE_BITMAP(uptodate, PAGE_SIZE / 512); | ||
| 112 | }; | ||
| 113 | |||
| 114 | static inline struct iomap_page *to_iomap_page(struct page *page) | ||
| 115 | { | ||
| 116 | if (page_has_private(page)) | ||
| 117 | return (struct iomap_page *)page_private(page); | ||
| 118 | return NULL; | ||
| 119 | } | ||
| 120 | |||
| 89 | ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from, | 121 | ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from, |
| 90 | const struct iomap_ops *ops); | 122 | const struct iomap_ops *ops); |
| 123 | int iomap_readpage(struct page *page, const struct iomap_ops *ops); | ||
| 124 | int iomap_readpages(struct address_space *mapping, struct list_head *pages, | ||
| 125 | unsigned nr_pages, const struct iomap_ops *ops); | ||
| 126 | int iomap_set_page_dirty(struct page *page); | ||
| 127 | int iomap_is_partially_uptodate(struct page *page, unsigned long from, | ||
| 128 | unsigned long count); | ||
| 129 | int iomap_releasepage(struct page *page, gfp_t gfp_mask); | ||
| 130 | void iomap_invalidatepage(struct page *page, unsigned int offset, | ||
| 131 | unsigned int len); | ||
| 132 | #ifdef CONFIG_MIGRATION | ||
| 133 | int iomap_migrate_page(struct address_space *mapping, struct page *newpage, | ||
| 134 | struct page *page, enum migrate_mode mode); | ||
| 135 | #else | ||
| 136 | #define iomap_migrate_page NULL | ||
| 137 | #endif | ||
| 91 | int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, | 138 | int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, |
| 92 | const struct iomap_ops *ops); | 139 | const struct iomap_ops *ops); |
| 93 | int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, | 140 | int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, |
diff --git a/include/linux/ipc.h b/include/linux/ipc.h index 6cc2df7f7ac9..e1c9eea6015b 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <linux/spinlock.h> | 5 | #include <linux/spinlock.h> |
| 6 | #include <linux/uidgid.h> | 6 | #include <linux/uidgid.h> |
| 7 | #include <linux/rhashtable.h> | 7 | #include <linux/rhashtable-types.h> |
| 8 | #include <uapi/linux/ipc.h> | 8 | #include <uapi/linux/ipc.h> |
| 9 | #include <linux/refcount.h> | 9 | #include <linux/refcount.h> |
| 10 | 10 | ||
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index b5630c8eb2f3..6cea726612b7 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include <linux/nsproxy.h> | 9 | #include <linux/nsproxy.h> |
| 10 | #include <linux/ns_common.h> | 10 | #include <linux/ns_common.h> |
| 11 | #include <linux/refcount.h> | 11 | #include <linux/refcount.h> |
| 12 | #include <linux/rhashtable.h> | 12 | #include <linux/rhashtable-types.h> |
| 13 | 13 | ||
| 14 | struct user_namespace; | 14 | struct user_namespace; |
| 15 | 15 | ||
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index cbb872c1b607..9d2ea3e907d0 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h | |||
| @@ -73,6 +73,7 @@ | |||
| 73 | #define GICD_TYPER_MBIS (1U << 16) | 73 | #define GICD_TYPER_MBIS (1U << 16) |
| 74 | 74 | ||
| 75 | #define GICD_TYPER_ID_BITS(typer) ((((typer) >> 19) & 0x1f) + 1) | 75 | #define GICD_TYPER_ID_BITS(typer) ((((typer) >> 19) & 0x1f) + 1) |
| 76 | #define GICD_TYPER_NUM_LPIS(typer) ((((typer) >> 11) & 0x1f) + 1) | ||
| 76 | #define GICD_TYPER_IRQS(typer) ((((typer) & 0x1f) + 1) * 32) | 77 | #define GICD_TYPER_IRQS(typer) ((((typer) & 0x1f) + 1) * 32) |
| 77 | 78 | ||
| 78 | #define GICD_IROUTER_SPI_MODE_ONE (0U << 31) | 79 | #define GICD_IROUTER_SPI_MODE_ONE (0U << 31) |
| @@ -576,8 +577,8 @@ struct rdists { | |||
| 576 | phys_addr_t phys_base; | 577 | phys_addr_t phys_base; |
| 577 | } __percpu *rdist; | 578 | } __percpu *rdist; |
| 578 | struct page *prop_page; | 579 | struct page *prop_page; |
| 579 | int id_bits; | ||
| 580 | u64 flags; | 580 | u64 flags; |
| 581 | u32 gicd_typer; | ||
| 581 | bool has_vlpis; | 582 | bool has_vlpis; |
| 582 | bool has_direct_lpi; | 583 | bool has_direct_lpi; |
| 583 | }; | 584 | }; |
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index b46b541c67c4..1a0b6f17a5d6 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
| @@ -299,12 +299,18 @@ struct static_key_false { | |||
| 299 | #define DEFINE_STATIC_KEY_TRUE(name) \ | 299 | #define DEFINE_STATIC_KEY_TRUE(name) \ |
| 300 | struct static_key_true name = STATIC_KEY_TRUE_INIT | 300 | struct static_key_true name = STATIC_KEY_TRUE_INIT |
| 301 | 301 | ||
| 302 | #define DEFINE_STATIC_KEY_TRUE_RO(name) \ | ||
| 303 | struct static_key_true name __ro_after_init = STATIC_KEY_TRUE_INIT | ||
| 304 | |||
| 302 | #define DECLARE_STATIC_KEY_TRUE(name) \ | 305 | #define DECLARE_STATIC_KEY_TRUE(name) \ |
| 303 | extern struct static_key_true name | 306 | extern struct static_key_true name |
| 304 | 307 | ||
| 305 | #define DEFINE_STATIC_KEY_FALSE(name) \ | 308 | #define DEFINE_STATIC_KEY_FALSE(name) \ |
| 306 | struct static_key_false name = STATIC_KEY_FALSE_INIT | 309 | struct static_key_false name = STATIC_KEY_FALSE_INIT |
| 307 | 310 | ||
| 311 | #define DEFINE_STATIC_KEY_FALSE_RO(name) \ | ||
| 312 | struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT | ||
| 313 | |||
| 308 | #define DECLARE_STATIC_KEY_FALSE(name) \ | 314 | #define DECLARE_STATIC_KEY_FALSE(name) \ |
| 309 | extern struct static_key_false name | 315 | extern struct static_key_false name |
| 310 | 316 | ||
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index ab25c8b6d9e3..814643f7ee52 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/lockdep.h> | 15 | #include <linux/lockdep.h> |
| 16 | #include <linux/rbtree.h> | 16 | #include <linux/rbtree.h> |
| 17 | #include <linux/atomic.h> | 17 | #include <linux/atomic.h> |
| 18 | #include <linux/uidgid.h> | ||
| 18 | #include <linux/wait.h> | 19 | #include <linux/wait.h> |
| 19 | 20 | ||
| 20 | struct file; | 21 | struct file; |
| @@ -325,12 +326,14 @@ void kernfs_destroy_root(struct kernfs_root *root); | |||
| 325 | 326 | ||
| 326 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, | 327 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, |
| 327 | const char *name, umode_t mode, | 328 | const char *name, umode_t mode, |
| 329 | kuid_t uid, kgid_t gid, | ||
| 328 | void *priv, const void *ns); | 330 | void *priv, const void *ns); |
| 329 | struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, | 331 | struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, |
| 330 | const char *name); | 332 | const char *name); |
| 331 | struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, | 333 | struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, |
| 332 | const char *name, | 334 | const char *name, umode_t mode, |
| 333 | umode_t mode, loff_t size, | 335 | kuid_t uid, kgid_t gid, |
| 336 | loff_t size, | ||
| 334 | const struct kernfs_ops *ops, | 337 | const struct kernfs_ops *ops, |
| 335 | void *priv, const void *ns, | 338 | void *priv, const void *ns, |
| 336 | struct lock_class_key *key); | 339 | struct lock_class_key *key); |
| @@ -415,12 +418,14 @@ static inline void kernfs_destroy_root(struct kernfs_root *root) { } | |||
| 415 | 418 | ||
| 416 | static inline struct kernfs_node * | 419 | static inline struct kernfs_node * |
| 417 | kernfs_create_dir_ns(struct kernfs_node *parent, const char *name, | 420 | kernfs_create_dir_ns(struct kernfs_node *parent, const char *name, |
| 418 | umode_t mode, void *priv, const void *ns) | 421 | umode_t mode, kuid_t uid, kgid_t gid, |
| 422 | void *priv, const void *ns) | ||
| 419 | { return ERR_PTR(-ENOSYS); } | 423 | { return ERR_PTR(-ENOSYS); } |
| 420 | 424 | ||
| 421 | static inline struct kernfs_node * | 425 | static inline struct kernfs_node * |
| 422 | __kernfs_create_file(struct kernfs_node *parent, const char *name, | 426 | __kernfs_create_file(struct kernfs_node *parent, const char *name, |
| 423 | umode_t mode, loff_t size, const struct kernfs_ops *ops, | 427 | umode_t mode, kuid_t uid, kgid_t gid, |
| 428 | loff_t size, const struct kernfs_ops *ops, | ||
| 424 | void *priv, const void *ns, struct lock_class_key *key) | 429 | void *priv, const void *ns, struct lock_class_key *key) |
| 425 | { return ERR_PTR(-ENOSYS); } | 430 | { return ERR_PTR(-ENOSYS); } |
| 426 | 431 | ||
| @@ -498,12 +503,15 @@ static inline struct kernfs_node * | |||
| 498 | kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode, | 503 | kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode, |
| 499 | void *priv) | 504 | void *priv) |
| 500 | { | 505 | { |
| 501 | return kernfs_create_dir_ns(parent, name, mode, priv, NULL); | 506 | return kernfs_create_dir_ns(parent, name, mode, |
| 507 | GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, | ||
| 508 | priv, NULL); | ||
| 502 | } | 509 | } |
| 503 | 510 | ||
| 504 | static inline struct kernfs_node * | 511 | static inline struct kernfs_node * |
| 505 | kernfs_create_file_ns(struct kernfs_node *parent, const char *name, | 512 | kernfs_create_file_ns(struct kernfs_node *parent, const char *name, |
| 506 | umode_t mode, loff_t size, const struct kernfs_ops *ops, | 513 | umode_t mode, kuid_t uid, kgid_t gid, |
| 514 | loff_t size, const struct kernfs_ops *ops, | ||
| 507 | void *priv, const void *ns) | 515 | void *priv, const void *ns) |
| 508 | { | 516 | { |
| 509 | struct lock_class_key *key = NULL; | 517 | struct lock_class_key *key = NULL; |
| @@ -511,15 +519,17 @@ kernfs_create_file_ns(struct kernfs_node *parent, const char *name, | |||
| 511 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 519 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 512 | key = (struct lock_class_key *)&ops->lockdep_key; | 520 | key = (struct lock_class_key *)&ops->lockdep_key; |
| 513 | #endif | 521 | #endif |
| 514 | return __kernfs_create_file(parent, name, mode, size, ops, priv, ns, | 522 | return __kernfs_create_file(parent, name, mode, uid, gid, |
| 515 | key); | 523 | size, ops, priv, ns, key); |
| 516 | } | 524 | } |
| 517 | 525 | ||
| 518 | static inline struct kernfs_node * | 526 | static inline struct kernfs_node * |
| 519 | kernfs_create_file(struct kernfs_node *parent, const char *name, umode_t mode, | 527 | kernfs_create_file(struct kernfs_node *parent, const char *name, umode_t mode, |
| 520 | loff_t size, const struct kernfs_ops *ops, void *priv) | 528 | loff_t size, const struct kernfs_ops *ops, void *priv) |
| 521 | { | 529 | { |
| 522 | return kernfs_create_file_ns(parent, name, mode, size, ops, priv, NULL); | 530 | return kernfs_create_file_ns(parent, name, mode, |
| 531 | GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, | ||
| 532 | size, ops, priv, NULL); | ||
| 523 | } | 533 | } |
| 524 | 534 | ||
| 525 | static inline int kernfs_remove_by_name(struct kernfs_node *parent, | 535 | static inline int kernfs_remove_by_name(struct kernfs_node *parent, |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 7f6f93c3df9c..b49ff230beba 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
| 27 | #include <linux/atomic.h> | 27 | #include <linux/atomic.h> |
| 28 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
| 29 | #include <linux/uidgid.h> | ||
| 29 | 30 | ||
| 30 | #define UEVENT_HELPER_PATH_LEN 256 | 31 | #define UEVENT_HELPER_PATH_LEN 256 |
| 31 | #define UEVENT_NUM_ENVP 32 /* number of env pointers */ | 32 | #define UEVENT_NUM_ENVP 32 /* number of env pointers */ |
| @@ -114,6 +115,8 @@ extern struct kobject * __must_check kobject_get_unless_zero( | |||
| 114 | extern void kobject_put(struct kobject *kobj); | 115 | extern void kobject_put(struct kobject *kobj); |
| 115 | 116 | ||
| 116 | extern const void *kobject_namespace(struct kobject *kobj); | 117 | extern const void *kobject_namespace(struct kobject *kobj); |
| 118 | extern void kobject_get_ownership(struct kobject *kobj, | ||
| 119 | kuid_t *uid, kgid_t *gid); | ||
| 117 | extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); | 120 | extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); |
| 118 | 121 | ||
| 119 | struct kobj_type { | 122 | struct kobj_type { |
| @@ -122,6 +125,7 @@ struct kobj_type { | |||
| 122 | struct attribute **default_attrs; | 125 | struct attribute **default_attrs; |
| 123 | const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); | 126 | const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); |
| 124 | const void *(*namespace)(struct kobject *kobj); | 127 | const void *(*namespace)(struct kobject *kobj); |
| 128 | void (*get_ownership)(struct kobject *kobj, kuid_t *uid, kgid_t *gid); | ||
| 125 | }; | 129 | }; |
| 126 | 130 | ||
| 127 | struct kobj_uevent_env { | 131 | struct kobj_uevent_env { |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 9440a2fc8893..e909413e4e38 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
| @@ -63,7 +63,6 @@ struct pt_regs; | |||
| 63 | struct kretprobe; | 63 | struct kretprobe; |
| 64 | struct kretprobe_instance; | 64 | struct kretprobe_instance; |
| 65 | typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *); | 65 | typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *); |
| 66 | typedef int (*kprobe_break_handler_t) (struct kprobe *, struct pt_regs *); | ||
| 67 | typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *, | 66 | typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *, |
| 68 | unsigned long flags); | 67 | unsigned long flags); |
| 69 | typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *, | 68 | typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *, |
| @@ -101,12 +100,6 @@ struct kprobe { | |||
| 101 | */ | 100 | */ |
| 102 | kprobe_fault_handler_t fault_handler; | 101 | kprobe_fault_handler_t fault_handler; |
| 103 | 102 | ||
| 104 | /* | ||
| 105 | * ... called if breakpoint trap occurs in probe handler. | ||
| 106 | * Return 1 if it handled break, otherwise kernel will see it. | ||
| 107 | */ | ||
| 108 | kprobe_break_handler_t break_handler; | ||
| 109 | |||
| 110 | /* Saved opcode (which has been replaced with breakpoint) */ | 103 | /* Saved opcode (which has been replaced with breakpoint) */ |
| 111 | kprobe_opcode_t opcode; | 104 | kprobe_opcode_t opcode; |
| 112 | 105 | ||
| @@ -155,24 +148,6 @@ static inline int kprobe_ftrace(struct kprobe *p) | |||
| 155 | } | 148 | } |
| 156 | 149 | ||
| 157 | /* | 150 | /* |
| 158 | * Special probe type that uses setjmp-longjmp type tricks to resume | ||
| 159 | * execution at a specified entry with a matching prototype corresponding | ||
| 160 | * to the probed function - a trick to enable arguments to become | ||
| 161 | * accessible seamlessly by probe handling logic. | ||
| 162 | * Note: | ||
| 163 | * Because of the way compilers allocate stack space for local variables | ||
| 164 | * etc upfront, regardless of sub-scopes within a function, this mirroring | ||
| 165 | * principle currently works only for probes placed on function entry points. | ||
| 166 | */ | ||
| 167 | struct jprobe { | ||
| 168 | struct kprobe kp; | ||
| 169 | void *entry; /* probe handling code to jump to */ | ||
| 170 | }; | ||
| 171 | |||
| 172 | /* For backward compatibility with old code using JPROBE_ENTRY() */ | ||
| 173 | #define JPROBE_ENTRY(handler) (handler) | ||
| 174 | |||
| 175 | /* | ||
| 176 | * Function-return probe - | 151 | * Function-return probe - |
| 177 | * Note: | 152 | * Note: |
| 178 | * User needs to provide a handler function, and initialize maxactive. | 153 | * User needs to provide a handler function, and initialize maxactive. |
| @@ -389,9 +364,6 @@ int register_kprobe(struct kprobe *p); | |||
| 389 | void unregister_kprobe(struct kprobe *p); | 364 | void unregister_kprobe(struct kprobe *p); |
| 390 | int register_kprobes(struct kprobe **kps, int num); | 365 | int register_kprobes(struct kprobe **kps, int num); |
| 391 | void unregister_kprobes(struct kprobe **kps, int num); | 366 | void unregister_kprobes(struct kprobe **kps, int num); |
| 392 | int setjmp_pre_handler(struct kprobe *, struct pt_regs *); | ||
| 393 | int longjmp_break_handler(struct kprobe *, struct pt_regs *); | ||
| 394 | void jprobe_return(void); | ||
| 395 | unsigned long arch_deref_entry_point(void *); | 367 | unsigned long arch_deref_entry_point(void *); |
| 396 | 368 | ||
| 397 | int register_kretprobe(struct kretprobe *rp); | 369 | int register_kretprobe(struct kretprobe *rp); |
| @@ -439,9 +411,6 @@ static inline void unregister_kprobe(struct kprobe *p) | |||
| 439 | static inline void unregister_kprobes(struct kprobe **kps, int num) | 411 | static inline void unregister_kprobes(struct kprobe **kps, int num) |
| 440 | { | 412 | { |
| 441 | } | 413 | } |
| 442 | static inline void jprobe_return(void) | ||
| 443 | { | ||
| 444 | } | ||
| 445 | static inline int register_kretprobe(struct kretprobe *rp) | 414 | static inline int register_kretprobe(struct kretprobe *rp) |
| 446 | { | 415 | { |
| 447 | return -ENOSYS; | 416 | return -ENOSYS; |
| @@ -468,20 +437,6 @@ static inline int enable_kprobe(struct kprobe *kp) | |||
| 468 | return -ENOSYS; | 437 | return -ENOSYS; |
| 469 | } | 438 | } |
| 470 | #endif /* CONFIG_KPROBES */ | 439 | #endif /* CONFIG_KPROBES */ |
| 471 | static inline int register_jprobe(struct jprobe *p) | ||
| 472 | { | ||
| 473 | return -ENOSYS; | ||
| 474 | } | ||
| 475 | static inline int register_jprobes(struct jprobe **jps, int num) | ||
| 476 | { | ||
| 477 | return -ENOSYS; | ||
| 478 | } | ||
| 479 | static inline void unregister_jprobe(struct jprobe *p) | ||
| 480 | { | ||
| 481 | } | ||
| 482 | static inline void unregister_jprobes(struct jprobe **jps, int num) | ||
| 483 | { | ||
| 484 | } | ||
| 485 | static inline int disable_kretprobe(struct kretprobe *rp) | 440 | static inline int disable_kretprobe(struct kretprobe *rp) |
| 486 | { | 441 | { |
| 487 | return disable_kprobe(&rp->kp); | 442 | return disable_kprobe(&rp->kp); |
| @@ -490,14 +445,6 @@ static inline int enable_kretprobe(struct kretprobe *rp) | |||
| 490 | { | 445 | { |
| 491 | return enable_kprobe(&rp->kp); | 446 | return enable_kprobe(&rp->kp); |
| 492 | } | 447 | } |
| 493 | static inline int disable_jprobe(struct jprobe *jp) | ||
| 494 | { | ||
| 495 | return -ENOSYS; | ||
| 496 | } | ||
| 497 | static inline int enable_jprobe(struct jprobe *jp) | ||
| 498 | { | ||
| 499 | return -ENOSYS; | ||
| 500 | } | ||
| 501 | 448 | ||
| 502 | #ifndef CONFIG_KPROBES | 449 | #ifndef CONFIG_KPROBES |
| 503 | static inline bool is_kprobe_insn_slot(unsigned long addr) | 450 | static inline bool is_kprobe_insn_slot(unsigned long addr) |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 5b9fddbaac41..b2bb44f87f5a 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
| @@ -93,8 +93,11 @@ static inline ktime_t timeval_to_ktime(struct timeval tv) | |||
| 93 | /* Map the ktime_t to timeval conversion to ns_to_timeval function */ | 93 | /* Map the ktime_t to timeval conversion to ns_to_timeval function */ |
| 94 | #define ktime_to_timeval(kt) ns_to_timeval((kt)) | 94 | #define ktime_to_timeval(kt) ns_to_timeval((kt)) |
| 95 | 95 | ||
| 96 | /* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ | 96 | /* Convert ktime_t to nanoseconds */ |
| 97 | #define ktime_to_ns(kt) (kt) | 97 | static inline s64 ktime_to_ns(const ktime_t kt) |
| 98 | { | ||
| 99 | return kt; | ||
| 100 | } | ||
| 98 | 101 | ||
| 99 | /** | 102 | /** |
| 100 | * ktime_compare - Compares two ktime_t variables for less, greater or equal | 103 | * ktime_compare - Compares two ktime_t variables for less, greater or equal |
diff --git a/include/linux/leds.h b/include/linux/leds.h index b7e82550e655..834683d603f9 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
| @@ -253,7 +253,7 @@ static inline bool led_sysfs_is_disabled(struct led_classdev *led_cdev) | |||
| 253 | struct led_trigger { | 253 | struct led_trigger { |
| 254 | /* Trigger Properties */ | 254 | /* Trigger Properties */ |
| 255 | const char *name; | 255 | const char *name; |
| 256 | void (*activate)(struct led_classdev *led_cdev); | 256 | int (*activate)(struct led_classdev *led_cdev); |
| 257 | void (*deactivate)(struct led_classdev *led_cdev); | 257 | void (*deactivate)(struct led_classdev *led_cdev); |
| 258 | 258 | ||
| 259 | /* LEDs under control by this trigger (for simple triggers) */ | 259 | /* LEDs under control by this trigger (for simple triggers) */ |
| @@ -262,8 +262,19 @@ struct led_trigger { | |||
| 262 | 262 | ||
| 263 | /* Link to next registered trigger */ | 263 | /* Link to next registered trigger */ |
| 264 | struct list_head next_trig; | 264 | struct list_head next_trig; |
| 265 | |||
| 266 | const struct attribute_group **groups; | ||
| 265 | }; | 267 | }; |
| 266 | 268 | ||
| 269 | /* | ||
| 270 | * Currently the attributes in struct led_trigger::groups are added directly to | ||
| 271 | * the LED device. As this might change in the future, the following | ||
| 272 | * macros abstract getting the LED device and its trigger_data from the dev | ||
| 273 | * parameter passed to the attribute accessor functions. | ||
| 274 | */ | ||
| 275 | #define led_trigger_get_led(dev) ((struct led_classdev *)dev_get_drvdata((dev))) | ||
| 276 | #define led_trigger_get_drvdata(dev) (led_get_trigger_data(led_trigger_get_led(dev))) | ||
| 277 | |||
| 267 | ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, | 278 | ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, |
| 268 | const char *buf, size_t count); | 279 | const char *buf, size_t count); |
| 269 | ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr, | 280 | ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr, |
| @@ -288,10 +299,16 @@ extern void led_trigger_blink_oneshot(struct led_trigger *trigger, | |||
| 288 | unsigned long *delay_off, | 299 | unsigned long *delay_off, |
| 289 | int invert); | 300 | int invert); |
| 290 | extern void led_trigger_set_default(struct led_classdev *led_cdev); | 301 | extern void led_trigger_set_default(struct led_classdev *led_cdev); |
| 291 | extern void led_trigger_set(struct led_classdev *led_cdev, | 302 | extern int led_trigger_set(struct led_classdev *led_cdev, |
| 292 | struct led_trigger *trigger); | 303 | struct led_trigger *trigger); |
| 293 | extern void led_trigger_remove(struct led_classdev *led_cdev); | 304 | extern void led_trigger_remove(struct led_classdev *led_cdev); |
| 294 | 305 | ||
| 306 | static inline void led_set_trigger_data(struct led_classdev *led_cdev, | ||
| 307 | void *trigger_data) | ||
| 308 | { | ||
| 309 | led_cdev->trigger_data = trigger_data; | ||
| 310 | } | ||
| 311 | |||
| 295 | static inline void *led_get_trigger_data(struct led_classdev *led_cdev) | 312 | static inline void *led_get_trigger_data(struct led_classdev *led_cdev) |
| 296 | { | 313 | { |
| 297 | return led_cdev->trigger_data; | 314 | return led_cdev->trigger_data; |
| @@ -315,6 +332,10 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev) | |||
| 315 | extern void led_trigger_rename_static(const char *name, | 332 | extern void led_trigger_rename_static(const char *name, |
| 316 | struct led_trigger *trig); | 333 | struct led_trigger *trig); |
| 317 | 334 | ||
| 335 | #define module_led_trigger(__led_trigger) \ | ||
| 336 | module_driver(__led_trigger, led_trigger_register, \ | ||
| 337 | led_trigger_unregister) | ||
| 338 | |||
| 318 | #else | 339 | #else |
| 319 | 340 | ||
| 320 | /* Trigger has no members */ | 341 | /* Trigger has no members */ |
| @@ -334,9 +355,14 @@ static inline void led_trigger_blink_oneshot(struct led_trigger *trigger, | |||
| 334 | unsigned long *delay_off, | 355 | unsigned long *delay_off, |
| 335 | int invert) {} | 356 | int invert) {} |
| 336 | static inline void led_trigger_set_default(struct led_classdev *led_cdev) {} | 357 | static inline void led_trigger_set_default(struct led_classdev *led_cdev) {} |
| 337 | static inline void led_trigger_set(struct led_classdev *led_cdev, | 358 | static inline int led_trigger_set(struct led_classdev *led_cdev, |
| 338 | struct led_trigger *trigger) {} | 359 | struct led_trigger *trigger) |
| 360 | { | ||
| 361 | return 0; | ||
| 362 | } | ||
| 363 | |||
| 339 | static inline void led_trigger_remove(struct led_classdev *led_cdev) {} | 364 | static inline void led_trigger_remove(struct led_classdev *led_cdev) {} |
| 365 | static inline void led_set_trigger_data(struct led_classdev *led_cdev) {} | ||
| 340 | static inline void *led_get_trigger_data(struct led_classdev *led_cdev) | 366 | static inline void *led_get_trigger_data(struct led_classdev *led_cdev) |
| 341 | { | 367 | { |
| 342 | return NULL; | 368 | return NULL; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 32f247cb5e9e..bc4f87cbe7f4 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -1111,6 +1111,8 @@ extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); | |||
| 1111 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, | 1111 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
| 1112 | const struct ata_port_info * const * ppi, int n_ports); | 1112 | const struct ata_port_info * const * ppi, int n_ports); |
| 1113 | extern int ata_slave_link_init(struct ata_port *ap); | 1113 | extern int ata_slave_link_init(struct ata_port *ap); |
| 1114 | extern void ata_host_get(struct ata_host *host); | ||
| 1115 | extern void ata_host_put(struct ata_host *host); | ||
| 1114 | extern int ata_host_start(struct ata_host *host); | 1116 | extern int ata_host_start(struct ata_host *host); |
| 1115 | extern int ata_host_register(struct ata_host *host, | 1117 | extern int ata_host_register(struct ata_host *host, |
| 1116 | struct scsi_host_template *sht); | 1118 | struct scsi_host_template *sht); |
diff --git a/include/linux/list.h b/include/linux/list.h index 4b129df4d46b..de04cc5ed536 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -285,6 +285,36 @@ static inline void list_cut_position(struct list_head *list, | |||
| 285 | __list_cut_position(list, head, entry); | 285 | __list_cut_position(list, head, entry); |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | /** | ||
| 289 | * list_cut_before - cut a list into two, before given entry | ||
| 290 | * @list: a new list to add all removed entries | ||
| 291 | * @head: a list with entries | ||
| 292 | * @entry: an entry within head, could be the head itself | ||
| 293 | * | ||
| 294 | * This helper moves the initial part of @head, up to but | ||
| 295 | * excluding @entry, from @head to @list. You should pass | ||
| 296 | * in @entry an element you know is on @head. @list should | ||
| 297 | * be an empty list or a list you do not care about losing | ||
| 298 | * its data. | ||
| 299 | * If @entry == @head, all entries on @head are moved to | ||
| 300 | * @list. | ||
| 301 | */ | ||
| 302 | static inline void list_cut_before(struct list_head *list, | ||
| 303 | struct list_head *head, | ||
| 304 | struct list_head *entry) | ||
| 305 | { | ||
| 306 | if (head->next == entry) { | ||
| 307 | INIT_LIST_HEAD(list); | ||
| 308 | return; | ||
| 309 | } | ||
| 310 | list->next = head->next; | ||
| 311 | list->next->prev = list; | ||
| 312 | list->prev = entry->prev; | ||
| 313 | list->prev->next = list; | ||
| 314 | head->next = entry; | ||
| 315 | entry->prev = head; | ||
| 316 | } | ||
| 317 | |||
| 288 | static inline void __list_splice(const struct list_head *list, | 318 | static inline void __list_splice(const struct list_head *list, |
| 289 | struct list_head *prev, | 319 | struct list_head *prev, |
| 290 | struct list_head *next) | 320 | struct list_head *next) |
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 8f1131c8dd54..97a020c616ad 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h | |||
| @@ -576,6 +576,10 @@ | |||
| 576 | * userspace to load a kernel module with the given name. | 576 | * userspace to load a kernel module with the given name. |
| 577 | * @kmod_name name of the module requested by the kernel | 577 | * @kmod_name name of the module requested by the kernel |
| 578 | * Return 0 if successful. | 578 | * Return 0 if successful. |
| 579 | * @kernel_load_data: | ||
| 580 | * Load data provided by userspace. | ||
| 581 | * @id kernel load data identifier | ||
| 582 | * Return 0 if permission is granted. | ||
| 579 | * @kernel_read_file: | 583 | * @kernel_read_file: |
| 580 | * Read a file specified by userspace. | 584 | * Read a file specified by userspace. |
| 581 | * @file contains the file structure pointing to the file being read | 585 | * @file contains the file structure pointing to the file being read |
| @@ -1569,7 +1573,7 @@ union security_list_options { | |||
| 1569 | int (*file_send_sigiotask)(struct task_struct *tsk, | 1573 | int (*file_send_sigiotask)(struct task_struct *tsk, |
| 1570 | struct fown_struct *fown, int sig); | 1574 | struct fown_struct *fown, int sig); |
| 1571 | int (*file_receive)(struct file *file); | 1575 | int (*file_receive)(struct file *file); |
| 1572 | int (*file_open)(struct file *file, const struct cred *cred); | 1576 | int (*file_open)(struct file *file); |
| 1573 | 1577 | ||
| 1574 | int (*task_alloc)(struct task_struct *task, unsigned long clone_flags); | 1578 | int (*task_alloc)(struct task_struct *task, unsigned long clone_flags); |
| 1575 | void (*task_free)(struct task_struct *task); | 1579 | void (*task_free)(struct task_struct *task); |
| @@ -1582,6 +1586,7 @@ union security_list_options { | |||
| 1582 | int (*kernel_act_as)(struct cred *new, u32 secid); | 1586 | int (*kernel_act_as)(struct cred *new, u32 secid); |
| 1583 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); | 1587 | int (*kernel_create_files_as)(struct cred *new, struct inode *inode); |
| 1584 | int (*kernel_module_request)(char *kmod_name); | 1588 | int (*kernel_module_request)(char *kmod_name); |
| 1589 | int (*kernel_load_data)(enum kernel_load_data_id id); | ||
| 1585 | int (*kernel_read_file)(struct file *file, enum kernel_read_file_id id); | 1590 | int (*kernel_read_file)(struct file *file, enum kernel_read_file_id id); |
| 1586 | int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size, | 1591 | int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size, |
| 1587 | enum kernel_read_file_id id); | 1592 | enum kernel_read_file_id id); |
| @@ -1872,6 +1877,7 @@ struct security_hook_heads { | |||
| 1872 | struct hlist_head cred_getsecid; | 1877 | struct hlist_head cred_getsecid; |
| 1873 | struct hlist_head kernel_act_as; | 1878 | struct hlist_head kernel_act_as; |
| 1874 | struct hlist_head kernel_create_files_as; | 1879 | struct hlist_head kernel_create_files_as; |
| 1880 | struct hlist_head kernel_load_data; | ||
| 1875 | struct hlist_head kernel_read_file; | 1881 | struct hlist_head kernel_read_file; |
| 1876 | struct hlist_head kernel_post_read_file; | 1882 | struct hlist_head kernel_post_read_file; |
| 1877 | struct hlist_head kernel_module_request; | 1883 | struct hlist_head kernel_module_request; |
diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h new file mode 100644 index 000000000000..ccb73422c2fa --- /dev/null +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2018 MediaTek Inc. | ||
| 4 | * | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef __MTK_CMDQ_MAILBOX_H__ | ||
| 8 | #define __MTK_CMDQ_MAILBOX_H__ | ||
| 9 | |||
| 10 | #include <linux/platform_device.h> | ||
| 11 | #include <linux/slab.h> | ||
| 12 | #include <linux/types.h> | ||
| 13 | |||
| 14 | #define CMDQ_INST_SIZE 8 /* instruction is 64-bit */ | ||
| 15 | #define CMDQ_SUBSYS_SHIFT 16 | ||
| 16 | #define CMDQ_OP_CODE_SHIFT 24 | ||
| 17 | #define CMDQ_JUMP_PASS CMDQ_INST_SIZE | ||
| 18 | |||
| 19 | #define CMDQ_WFE_UPDATE BIT(31) | ||
| 20 | #define CMDQ_WFE_WAIT BIT(15) | ||
| 21 | #define CMDQ_WFE_WAIT_VALUE 0x1 | ||
| 22 | |||
| 23 | /* | ||
| 24 | * CMDQ_CODE_MASK: | ||
| 25 | * set write mask | ||
| 26 | * format: op mask | ||
| 27 | * CMDQ_CODE_WRITE: | ||
| 28 | * write value into target register | ||
| 29 | * format: op subsys address value | ||
| 30 | * CMDQ_CODE_JUMP: | ||
| 31 | * jump by offset | ||
| 32 | * format: op offset | ||
| 33 | * CMDQ_CODE_WFE: | ||
| 34 | * wait for event and clear | ||
| 35 | * it is just clear if no wait | ||
| 36 | * format: [wait] op event update:1 to_wait:1 wait:1 | ||
| 37 | * [clear] op event update:1 to_wait:0 wait:0 | ||
| 38 | * CMDQ_CODE_EOC: | ||
| 39 | * end of command | ||
| 40 | * format: op irq_flag | ||
| 41 | */ | ||
| 42 | enum cmdq_code { | ||
| 43 | CMDQ_CODE_MASK = 0x02, | ||
| 44 | CMDQ_CODE_WRITE = 0x04, | ||
| 45 | CMDQ_CODE_JUMP = 0x10, | ||
| 46 | CMDQ_CODE_WFE = 0x20, | ||
| 47 | CMDQ_CODE_EOC = 0x40, | ||
| 48 | }; | ||
| 49 | |||
| 50 | enum cmdq_cb_status { | ||
| 51 | CMDQ_CB_NORMAL = 0, | ||
| 52 | CMDQ_CB_ERROR | ||
| 53 | }; | ||
| 54 | |||
| 55 | struct cmdq_cb_data { | ||
| 56 | enum cmdq_cb_status sta; | ||
| 57 | void *data; | ||
| 58 | }; | ||
| 59 | |||
| 60 | typedef void (*cmdq_async_flush_cb)(struct cmdq_cb_data data); | ||
| 61 | |||
| 62 | struct cmdq_task_cb { | ||
| 63 | cmdq_async_flush_cb cb; | ||
| 64 | void *data; | ||
| 65 | }; | ||
| 66 | |||
| 67 | struct cmdq_pkt { | ||
| 68 | void *va_base; | ||
| 69 | dma_addr_t pa_base; | ||
| 70 | size_t cmd_buf_size; /* command occupied size */ | ||
| 71 | size_t buf_size; /* real buffer size */ | ||
| 72 | struct cmdq_task_cb cb; | ||
| 73 | struct cmdq_task_cb async_cb; | ||
| 74 | void *cl; | ||
| 75 | }; | ||
| 76 | |||
| 77 | #endif /* __MTK_CMDQ_MAILBOX_H__ */ | ||
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index ca59883c8364..516920549378 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
| @@ -20,31 +20,60 @@ | |||
| 20 | #define INIT_MEMBLOCK_REGIONS 128 | 20 | #define INIT_MEMBLOCK_REGIONS 128 |
| 21 | #define INIT_PHYSMEM_REGIONS 4 | 21 | #define INIT_PHYSMEM_REGIONS 4 |
| 22 | 22 | ||
| 23 | /* Definition of memblock flags. */ | 23 | /** |
| 24 | enum { | 24 | * enum memblock_flags - definition of memory region attributes |
| 25 | * @MEMBLOCK_NONE: no special request | ||
| 26 | * @MEMBLOCK_HOTPLUG: hotpluggable region | ||
| 27 | * @MEMBLOCK_MIRROR: mirrored region | ||
| 28 | * @MEMBLOCK_NOMAP: don't add to kernel direct mapping | ||
| 29 | */ | ||
| 30 | enum memblock_flags { | ||
| 25 | MEMBLOCK_NONE = 0x0, /* No special request */ | 31 | MEMBLOCK_NONE = 0x0, /* No special request */ |
| 26 | MEMBLOCK_HOTPLUG = 0x1, /* hotpluggable region */ | 32 | MEMBLOCK_HOTPLUG = 0x1, /* hotpluggable region */ |
| 27 | MEMBLOCK_MIRROR = 0x2, /* mirrored region */ | 33 | MEMBLOCK_MIRROR = 0x2, /* mirrored region */ |
| 28 | MEMBLOCK_NOMAP = 0x4, /* don't add to kernel direct mapping */ | 34 | MEMBLOCK_NOMAP = 0x4, /* don't add to kernel direct mapping */ |
| 29 | }; | 35 | }; |
| 30 | 36 | ||
| 37 | /** | ||
| 38 | * struct memblock_region - represents a memory region | ||
| 39 | * @base: physical address of the region | ||
| 40 | * @size: size of the region | ||
| 41 | * @flags: memory region attributes | ||
| 42 | * @nid: NUMA node id | ||
| 43 | */ | ||
| 31 | struct memblock_region { | 44 | struct memblock_region { |
| 32 | phys_addr_t base; | 45 | phys_addr_t base; |
| 33 | phys_addr_t size; | 46 | phys_addr_t size; |
| 34 | unsigned long flags; | 47 | enum memblock_flags flags; |
| 35 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 48 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
| 36 | int nid; | 49 | int nid; |
| 37 | #endif | 50 | #endif |
| 38 | }; | 51 | }; |
| 39 | 52 | ||
| 53 | /** | ||
| 54 | * struct memblock_type - collection of memory regions of certain type | ||
| 55 | * @cnt: number of regions | ||
| 56 | * @max: size of the allocated array | ||
| 57 | * @total_size: size of all regions | ||
| 58 | * @regions: array of regions | ||
| 59 | * @name: the memory type symbolic name | ||
| 60 | */ | ||
| 40 | struct memblock_type { | 61 | struct memblock_type { |
| 41 | unsigned long cnt; /* number of regions */ | 62 | unsigned long cnt; |
| 42 | unsigned long max; /* size of the allocated array */ | 63 | unsigned long max; |
| 43 | phys_addr_t total_size; /* size of all regions */ | 64 | phys_addr_t total_size; |
| 44 | struct memblock_region *regions; | 65 | struct memblock_region *regions; |
| 45 | char *name; | 66 | char *name; |
| 46 | }; | 67 | }; |
| 47 | 68 | ||
| 69 | /** | ||
| 70 | * struct memblock - memblock allocator metadata | ||
| 71 | * @bottom_up: is bottom up direction? | ||
| 72 | * @current_limit: physical address of the current allocation limit | ||
| 73 | * @memory: usabe memory regions | ||
| 74 | * @reserved: reserved memory regions | ||
| 75 | * @physmem: all physical memory | ||
| 76 | */ | ||
| 48 | struct memblock { | 77 | struct memblock { |
| 49 | bool bottom_up; /* is bottom up direction? */ | 78 | bool bottom_up; /* is bottom up direction? */ |
| 50 | phys_addr_t current_limit; | 79 | phys_addr_t current_limit; |
| @@ -72,7 +101,7 @@ void memblock_discard(void); | |||
| 72 | 101 | ||
| 73 | phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align, | 102 | phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align, |
| 74 | phys_addr_t start, phys_addr_t end, | 103 | phys_addr_t start, phys_addr_t end, |
| 75 | int nid, ulong flags); | 104 | int nid, enum memblock_flags flags); |
| 76 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, | 105 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, |
| 77 | phys_addr_t size, phys_addr_t align); | 106 | phys_addr_t size, phys_addr_t align); |
| 78 | void memblock_allow_resize(void); | 107 | void memblock_allow_resize(void); |
| @@ -89,19 +118,19 @@ int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); | |||
| 89 | int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); | 118 | int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); |
| 90 | int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); | 119 | int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); |
| 91 | int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); | 120 | int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); |
| 92 | ulong choose_memblock_flags(void); | 121 | enum memblock_flags choose_memblock_flags(void); |
| 93 | 122 | ||
| 94 | /* Low level functions */ | 123 | /* Low level functions */ |
| 95 | int memblock_add_range(struct memblock_type *type, | 124 | int memblock_add_range(struct memblock_type *type, |
| 96 | phys_addr_t base, phys_addr_t size, | 125 | phys_addr_t base, phys_addr_t size, |
| 97 | int nid, unsigned long flags); | 126 | int nid, enum memblock_flags flags); |
| 98 | 127 | ||
| 99 | void __next_mem_range(u64 *idx, int nid, ulong flags, | 128 | void __next_mem_range(u64 *idx, int nid, enum memblock_flags flags, |
| 100 | struct memblock_type *type_a, | 129 | struct memblock_type *type_a, |
| 101 | struct memblock_type *type_b, phys_addr_t *out_start, | 130 | struct memblock_type *type_b, phys_addr_t *out_start, |
| 102 | phys_addr_t *out_end, int *out_nid); | 131 | phys_addr_t *out_end, int *out_nid); |
| 103 | 132 | ||
| 104 | void __next_mem_range_rev(u64 *idx, int nid, ulong flags, | 133 | void __next_mem_range_rev(u64 *idx, int nid, enum memblock_flags flags, |
| 105 | struct memblock_type *type_a, | 134 | struct memblock_type *type_a, |
| 106 | struct memblock_type *type_b, phys_addr_t *out_start, | 135 | struct memblock_type *type_b, phys_addr_t *out_start, |
| 107 | phys_addr_t *out_end, int *out_nid); | 136 | phys_addr_t *out_end, int *out_nid); |
| @@ -239,7 +268,6 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, | |||
| 239 | /** | 268 | /** |
| 240 | * for_each_resv_unavail_range - iterate through reserved and unavailable memory | 269 | * for_each_resv_unavail_range - iterate through reserved and unavailable memory |
| 241 | * @i: u64 used as loop variable | 270 | * @i: u64 used as loop variable |
| 242 | * @flags: pick from blocks based on memory attributes | ||
| 243 | * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL | 271 | * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL |
| 244 | * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL | 272 | * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL |
| 245 | * | 273 | * |
| @@ -253,13 +281,13 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, | |||
| 253 | NUMA_NO_NODE, MEMBLOCK_NONE, p_start, p_end, NULL) | 281 | NUMA_NO_NODE, MEMBLOCK_NONE, p_start, p_end, NULL) |
| 254 | 282 | ||
| 255 | static inline void memblock_set_region_flags(struct memblock_region *r, | 283 | static inline void memblock_set_region_flags(struct memblock_region *r, |
| 256 | unsigned long flags) | 284 | enum memblock_flags flags) |
| 257 | { | 285 | { |
| 258 | r->flags |= flags; | 286 | r->flags |= flags; |
| 259 | } | 287 | } |
| 260 | 288 | ||
| 261 | static inline void memblock_clear_region_flags(struct memblock_region *r, | 289 | static inline void memblock_clear_region_flags(struct memblock_region *r, |
| 262 | unsigned long flags) | 290 | enum memblock_flags flags) |
| 263 | { | 291 | { |
| 264 | r->flags &= ~flags; | 292 | r->flags &= ~flags; |
| 265 | } | 293 | } |
| @@ -317,10 +345,10 @@ static inline bool memblock_bottom_up(void) | |||
| 317 | 345 | ||
| 318 | phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, | 346 | phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, |
| 319 | phys_addr_t start, phys_addr_t end, | 347 | phys_addr_t start, phys_addr_t end, |
| 320 | ulong flags); | 348 | enum memblock_flags flags); |
| 321 | phys_addr_t memblock_alloc_base_nid(phys_addr_t size, | 349 | phys_addr_t memblock_alloc_base_nid(phys_addr_t size, |
| 322 | phys_addr_t align, phys_addr_t max_addr, | 350 | phys_addr_t align, phys_addr_t max_addr, |
| 323 | int nid, ulong flags); | 351 | int nid, enum memblock_flags flags); |
| 324 | phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align, | 352 | phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align, |
| 325 | phys_addr_t max_addr); | 353 | phys_addr_t max_addr); |
| 326 | phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, | 354 | phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, |
| @@ -367,8 +395,10 @@ phys_addr_t memblock_get_current_limit(void); | |||
| 367 | */ | 395 | */ |
| 368 | 396 | ||
| 369 | /** | 397 | /** |
| 370 | * memblock_region_memory_base_pfn - Return the lowest pfn intersecting with the memory region | 398 | * memblock_region_memory_base_pfn - get the lowest pfn of the memory region |
| 371 | * @reg: memblock_region structure | 399 | * @reg: memblock_region structure |
| 400 | * | ||
| 401 | * Return: the lowest pfn intersecting with the memory region | ||
| 372 | */ | 402 | */ |
| 373 | static inline unsigned long memblock_region_memory_base_pfn(const struct memblock_region *reg) | 403 | static inline unsigned long memblock_region_memory_base_pfn(const struct memblock_region *reg) |
| 374 | { | 404 | { |
| @@ -376,8 +406,10 @@ static inline unsigned long memblock_region_memory_base_pfn(const struct membloc | |||
| 376 | } | 406 | } |
| 377 | 407 | ||
| 378 | /** | 408 | /** |
| 379 | * memblock_region_memory_end_pfn - Return the end_pfn this region | 409 | * memblock_region_memory_end_pfn - get the end pfn of the memory region |
| 380 | * @reg: memblock_region structure | 410 | * @reg: memblock_region structure |
| 411 | * | ||
| 412 | * Return: the end_pfn of the reserved region | ||
| 381 | */ | 413 | */ |
| 382 | static inline unsigned long memblock_region_memory_end_pfn(const struct memblock_region *reg) | 414 | static inline unsigned long memblock_region_memory_end_pfn(const struct memblock_region *reg) |
| 383 | { | 415 | { |
| @@ -385,8 +417,10 @@ static inline unsigned long memblock_region_memory_end_pfn(const struct memblock | |||
| 385 | } | 417 | } |
| 386 | 418 | ||
| 387 | /** | 419 | /** |
| 388 | * memblock_region_reserved_base_pfn - Return the lowest pfn intersecting with the reserved region | 420 | * memblock_region_reserved_base_pfn - get the lowest pfn of the reserved region |
| 389 | * @reg: memblock_region structure | 421 | * @reg: memblock_region structure |
| 422 | * | ||
| 423 | * Return: the lowest pfn intersecting with the reserved region | ||
| 390 | */ | 424 | */ |
| 391 | static inline unsigned long memblock_region_reserved_base_pfn(const struct memblock_region *reg) | 425 | static inline unsigned long memblock_region_reserved_base_pfn(const struct memblock_region *reg) |
| 392 | { | 426 | { |
| @@ -394,8 +428,10 @@ static inline unsigned long memblock_region_reserved_base_pfn(const struct membl | |||
| 394 | } | 428 | } |
| 395 | 429 | ||
| 396 | /** | 430 | /** |
| 397 | * memblock_region_reserved_end_pfn - Return the end_pfn this region | 431 | * memblock_region_reserved_end_pfn - get the end pfn of the reserved region |
| 398 | * @reg: memblock_region structure | 432 | * @reg: memblock_region structure |
| 433 | * | ||
| 434 | * Return: the end_pfn of the reserved region | ||
| 399 | */ | 435 | */ |
| 400 | static inline unsigned long memblock_region_reserved_end_pfn(const struct memblock_region *reg) | 436 | static inline unsigned long memblock_region_reserved_end_pfn(const struct memblock_region *reg) |
| 401 | { | 437 | { |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 6c6fb116e925..680d3395fc83 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -317,6 +317,9 @@ enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, | |||
| 317 | int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm, | 317 | int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm, |
| 318 | gfp_t gfp_mask, struct mem_cgroup **memcgp, | 318 | gfp_t gfp_mask, struct mem_cgroup **memcgp, |
| 319 | bool compound); | 319 | bool compound); |
| 320 | int mem_cgroup_try_charge_delay(struct page *page, struct mm_struct *mm, | ||
| 321 | gfp_t gfp_mask, struct mem_cgroup **memcgp, | ||
| 322 | bool compound); | ||
| 320 | void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg, | 323 | void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg, |
| 321 | bool lrucare, bool compound); | 324 | bool lrucare, bool compound); |
| 322 | void mem_cgroup_cancel_charge(struct page *page, struct mem_cgroup *memcg, | 325 | void mem_cgroup_cancel_charge(struct page *page, struct mem_cgroup *memcg, |
| @@ -789,6 +792,16 @@ static inline int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm, | |||
| 789 | return 0; | 792 | return 0; |
| 790 | } | 793 | } |
| 791 | 794 | ||
| 795 | static inline int mem_cgroup_try_charge_delay(struct page *page, | ||
| 796 | struct mm_struct *mm, | ||
| 797 | gfp_t gfp_mask, | ||
| 798 | struct mem_cgroup **memcgp, | ||
| 799 | bool compound) | ||
| 800 | { | ||
| 801 | *memcgp = NULL; | ||
| 802 | return 0; | ||
| 803 | } | ||
| 804 | |||
| 792 | static inline void mem_cgroup_commit_charge(struct page *page, | 805 | static inline void mem_cgroup_commit_charge(struct page *page, |
| 793 | struct mem_cgroup *memcg, | 806 | struct mem_cgroup *memcg, |
| 794 | bool lrucare, bool compound) | 807 | bool lrucare, bool compound) |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 122e7e9d3091..dca6ab4eaa99 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -630,6 +630,7 @@ struct mlx4_caps { | |||
| 630 | u32 vf_caps; | 630 | u32 vf_caps; |
| 631 | bool wol_port[MLX4_MAX_PORTS + 1]; | 631 | bool wol_port[MLX4_MAX_PORTS + 1]; |
| 632 | struct mlx4_rate_limit_caps rl_caps; | 632 | struct mlx4_rate_limit_caps rl_caps; |
| 633 | u32 health_buffer_addrs; | ||
| 633 | }; | 634 | }; |
| 634 | 635 | ||
| 635 | struct mlx4_buf_list { | 636 | struct mlx4_buf_list { |
| @@ -851,6 +852,12 @@ struct mlx4_vf_dev { | |||
| 851 | u8 n_ports; | 852 | u8 n_ports; |
| 852 | }; | 853 | }; |
| 853 | 854 | ||
| 855 | struct mlx4_fw_crdump { | ||
| 856 | bool snapshot_enable; | ||
| 857 | struct devlink_region *region_crspace; | ||
| 858 | struct devlink_region *region_fw_health; | ||
| 859 | }; | ||
| 860 | |||
| 854 | enum mlx4_pci_status { | 861 | enum mlx4_pci_status { |
| 855 | MLX4_PCI_STATUS_DISABLED, | 862 | MLX4_PCI_STATUS_DISABLED, |
| 856 | MLX4_PCI_STATUS_ENABLED, | 863 | MLX4_PCI_STATUS_ENABLED, |
| @@ -871,6 +878,7 @@ struct mlx4_dev_persistent { | |||
| 871 | u8 interface_state; | 878 | u8 interface_state; |
| 872 | struct mutex pci_status_mutex; /* sync pci state */ | 879 | struct mutex pci_status_mutex; /* sync pci state */ |
| 873 | enum mlx4_pci_status pci_status; | 880 | enum mlx4_pci_status pci_status; |
| 881 | struct mlx4_fw_crdump crdump; | ||
| 874 | }; | 882 | }; |
| 875 | 883 | ||
| 876 | struct mlx4_dev { | 884 | struct mlx4_dev { |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 0566c6a94805..11fa4e66afc5 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
| @@ -332,6 +332,13 @@ enum mlx5_event { | |||
| 332 | 332 | ||
| 333 | MLX5_EVENT_TYPE_FPGA_ERROR = 0x20, | 333 | MLX5_EVENT_TYPE_FPGA_ERROR = 0x20, |
| 334 | MLX5_EVENT_TYPE_FPGA_QP_ERROR = 0x21, | 334 | MLX5_EVENT_TYPE_FPGA_QP_ERROR = 0x21, |
| 335 | |||
| 336 | MLX5_EVENT_TYPE_DEVICE_TRACER = 0x26, | ||
| 337 | }; | ||
| 338 | |||
| 339 | enum { | ||
| 340 | MLX5_TRACER_SUBTYPE_OWNERSHIP_CHANGE = 0x0, | ||
| 341 | MLX5_TRACER_SUBTYPE_TRACES_AVAILABLE = 0x1, | ||
| 335 | }; | 342 | }; |
| 336 | 343 | ||
| 337 | enum { | 344 | enum { |
| @@ -939,9 +946,9 @@ enum { | |||
| 939 | }; | 946 | }; |
| 940 | 947 | ||
| 941 | enum { | 948 | enum { |
| 942 | MLX5_ESW_VPORT_ADMIN_STATE_DOWN = 0x0, | 949 | MLX5_VPORT_ADMIN_STATE_DOWN = 0x0, |
| 943 | MLX5_ESW_VPORT_ADMIN_STATE_UP = 0x1, | 950 | MLX5_VPORT_ADMIN_STATE_UP = 0x1, |
| 944 | MLX5_ESW_VPORT_ADMIN_STATE_AUTO = 0x2, | 951 | MLX5_VPORT_ADMIN_STATE_AUTO = 0x2, |
| 945 | }; | 952 | }; |
| 946 | 953 | ||
| 947 | enum { | 954 | enum { |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 3723f6d4e2b7..7a452716de4b 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
| @@ -817,6 +817,9 @@ struct mlx5_clock { | |||
| 817 | struct mlx5_pps pps_info; | 817 | struct mlx5_pps pps_info; |
| 818 | }; | 818 | }; |
| 819 | 819 | ||
| 820 | struct mlx5_fw_tracer; | ||
| 821 | struct mlx5_vxlan; | ||
| 822 | |||
| 820 | struct mlx5_core_dev { | 823 | struct mlx5_core_dev { |
| 821 | struct pci_dev *pdev; | 824 | struct pci_dev *pdev; |
| 822 | /* sync pci state */ | 825 | /* sync pci state */ |
| @@ -848,6 +851,7 @@ struct mlx5_core_dev { | |||
| 848 | atomic_t num_qps; | 851 | atomic_t num_qps; |
| 849 | u32 issi; | 852 | u32 issi; |
| 850 | struct mlx5e_resources mlx5e_res; | 853 | struct mlx5e_resources mlx5e_res; |
| 854 | struct mlx5_vxlan *vxlan; | ||
| 851 | struct { | 855 | struct { |
| 852 | struct mlx5_rsvd_gids reserved_gids; | 856 | struct mlx5_rsvd_gids reserved_gids; |
| 853 | u32 roce_en; | 857 | u32 roce_en; |
| @@ -861,6 +865,7 @@ struct mlx5_core_dev { | |||
| 861 | struct mlx5_clock clock; | 865 | struct mlx5_clock clock; |
| 862 | struct mlx5_ib_clock_info *clock_info; | 866 | struct mlx5_ib_clock_info *clock_info; |
| 863 | struct page *clock_info_page; | 867 | struct page *clock_info_page; |
| 868 | struct mlx5_fw_tracer *tracer; | ||
| 864 | }; | 869 | }; |
| 865 | 870 | ||
| 866 | struct mlx5_db { | 871 | struct mlx5_db { |
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h index af0592400499..804516e4f483 100644 --- a/include/linux/mlx5/fs.h +++ b/include/linux/mlx5/fs.h | |||
| @@ -178,7 +178,7 @@ mlx5_add_flow_rules(struct mlx5_flow_table *ft, | |||
| 178 | struct mlx5_flow_spec *spec, | 178 | struct mlx5_flow_spec *spec, |
| 179 | struct mlx5_flow_act *flow_act, | 179 | struct mlx5_flow_act *flow_act, |
| 180 | struct mlx5_flow_destination *dest, | 180 | struct mlx5_flow_destination *dest, |
| 181 | int dest_num); | 181 | int num_dest); |
| 182 | void mlx5_del_flow_rules(struct mlx5_flow_handle *fr); | 182 | void mlx5_del_flow_rules(struct mlx5_flow_handle *fr); |
| 183 | 183 | ||
| 184 | int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler, | 184 | int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler, |
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index c2a5b480b156..f043d65b9bac 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
| @@ -672,7 +672,9 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits { | |||
| 672 | u8 swp[0x1]; | 672 | u8 swp[0x1]; |
| 673 | u8 swp_csum[0x1]; | 673 | u8 swp_csum[0x1]; |
| 674 | u8 swp_lso[0x1]; | 674 | u8 swp_lso[0x1]; |
| 675 | u8 reserved_at_23[0x1b]; | 675 | u8 reserved_at_23[0xd]; |
| 676 | u8 max_vxlan_udp_ports[0x8]; | ||
| 677 | u8 reserved_at_38[0x6]; | ||
| 676 | u8 max_geneve_opt_len[0x1]; | 678 | u8 max_geneve_opt_len[0x1]; |
| 677 | u8 tunnel_stateless_geneve_rx[0x1]; | 679 | u8 tunnel_stateless_geneve_rx[0x1]; |
| 678 | 680 | ||
| @@ -1135,7 +1137,10 @@ struct mlx5_ifc_cmd_hca_cap_bits { | |||
| 1135 | 1137 | ||
| 1136 | u8 general_obj_types[0x40]; | 1138 | u8 general_obj_types[0x40]; |
| 1137 | 1139 | ||
| 1138 | u8 reserved_at_440[0x40]; | 1140 | u8 reserved_at_440[0x20]; |
| 1141 | |||
| 1142 | u8 reserved_at_460[0x10]; | ||
| 1143 | u8 max_num_eqs[0x10]; | ||
| 1139 | 1144 | ||
| 1140 | u8 reserved_at_480[0x3]; | 1145 | u8 reserved_at_480[0x3]; |
| 1141 | u8 log_max_l2_table[0x5]; | 1146 | u8 log_max_l2_table[0x5]; |
| @@ -3764,8 +3769,8 @@ struct mlx5_ifc_query_vport_state_out_bits { | |||
| 3764 | }; | 3769 | }; |
| 3765 | 3770 | ||
| 3766 | enum { | 3771 | enum { |
| 3767 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT = 0x0, | 3772 | MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT = 0x0, |
| 3768 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT = 0x1, | 3773 | MLX5_VPORT_STATE_OP_MOD_ESW_VPORT = 0x1, |
| 3769 | }; | 3774 | }; |
| 3770 | 3775 | ||
| 3771 | struct mlx5_ifc_query_vport_state_in_bits { | 3776 | struct mlx5_ifc_query_vport_state_in_bits { |
diff --git a/include/linux/mlx5/mlx5_ifc_fpga.h b/include/linux/mlx5/mlx5_ifc_fpga.h index 64d0f40d4cc3..37e065a80a43 100644 --- a/include/linux/mlx5/mlx5_ifc_fpga.h +++ b/include/linux/mlx5/mlx5_ifc_fpga.h | |||
| @@ -576,6 +576,7 @@ struct mlx5_ifc_fpga_ipsec_sa { | |||
| 576 | enum fpga_tls_cmds { | 576 | enum fpga_tls_cmds { |
| 577 | CMD_SETUP_STREAM = 0x1001, | 577 | CMD_SETUP_STREAM = 0x1001, |
| 578 | CMD_TEARDOWN_STREAM = 0x1002, | 578 | CMD_TEARDOWN_STREAM = 0x1002, |
| 579 | CMD_RESYNC_RX = 0x1003, | ||
| 579 | }; | 580 | }; |
| 580 | 581 | ||
| 581 | #define MLX5_TLS_1_2 (0) | 582 | #define MLX5_TLS_1_2 (0) |
diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h index 9208cb8809ac..7e7c6dfcfb09 100644 --- a/include/linux/mlx5/vport.h +++ b/include/linux/mlx5/vport.h | |||
| @@ -43,8 +43,6 @@ enum { | |||
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); | 45 | u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); |
| 46 | u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | ||
| 47 | u16 vport); | ||
| 48 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | 46 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, |
| 49 | u16 vport, u8 state); | 47 | u16 vport, u8 state); |
| 50 | int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, | 48 | int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 99ce070e7dcb..efdc24dd9e97 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
| @@ -335,176 +335,183 @@ struct core_state { | |||
| 335 | 335 | ||
| 336 | struct kioctx_table; | 336 | struct kioctx_table; |
| 337 | struct mm_struct { | 337 | struct mm_struct { |
| 338 | struct vm_area_struct *mmap; /* list of VMAs */ | 338 | struct { |
| 339 | struct rb_root mm_rb; | 339 | struct vm_area_struct *mmap; /* list of VMAs */ |
| 340 | u32 vmacache_seqnum; /* per-thread vmacache */ | 340 | struct rb_root mm_rb; |
| 341 | u32 vmacache_seqnum; /* per-thread vmacache */ | ||
| 341 | #ifdef CONFIG_MMU | 342 | #ifdef CONFIG_MMU |
| 342 | unsigned long (*get_unmapped_area) (struct file *filp, | 343 | unsigned long (*get_unmapped_area) (struct file *filp, |
| 343 | unsigned long addr, unsigned long len, | 344 | unsigned long addr, unsigned long len, |
| 344 | unsigned long pgoff, unsigned long flags); | 345 | unsigned long pgoff, unsigned long flags); |
| 345 | #endif | 346 | #endif |
| 346 | unsigned long mmap_base; /* base of mmap area */ | 347 | unsigned long mmap_base; /* base of mmap area */ |
| 347 | unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */ | 348 | unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */ |
| 348 | #ifdef CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES | 349 | #ifdef CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES |
| 349 | /* Base adresses for compatible mmap() */ | 350 | /* Base adresses for compatible mmap() */ |
| 350 | unsigned long mmap_compat_base; | 351 | unsigned long mmap_compat_base; |
| 351 | unsigned long mmap_compat_legacy_base; | 352 | unsigned long mmap_compat_legacy_base; |
| 352 | #endif | 353 | #endif |
| 353 | unsigned long task_size; /* size of task vm space */ | 354 | unsigned long task_size; /* size of task vm space */ |
| 354 | unsigned long highest_vm_end; /* highest vma end address */ | 355 | unsigned long highest_vm_end; /* highest vma end address */ |
| 355 | pgd_t * pgd; | 356 | pgd_t * pgd; |
| 356 | 357 | ||
| 357 | /** | 358 | /** |
| 358 | * @mm_users: The number of users including userspace. | 359 | * @mm_users: The number of users including userspace. |
| 359 | * | 360 | * |
| 360 | * Use mmget()/mmget_not_zero()/mmput() to modify. When this drops | 361 | * Use mmget()/mmget_not_zero()/mmput() to modify. When this |
| 361 | * to 0 (i.e. when the task exits and there are no other temporary | 362 | * drops to 0 (i.e. when the task exits and there are no other |
| 362 | * reference holders), we also release a reference on @mm_count | 363 | * temporary reference holders), we also release a reference on |
| 363 | * (which may then free the &struct mm_struct if @mm_count also | 364 | * @mm_count (which may then free the &struct mm_struct if |
| 364 | * drops to 0). | 365 | * @mm_count also drops to 0). |
| 365 | */ | 366 | */ |
| 366 | atomic_t mm_users; | 367 | atomic_t mm_users; |
| 367 | 368 | ||
| 368 | /** | 369 | /** |
| 369 | * @mm_count: The number of references to &struct mm_struct | 370 | * @mm_count: The number of references to &struct mm_struct |
| 370 | * (@mm_users count as 1). | 371 | * (@mm_users count as 1). |
| 371 | * | 372 | * |
| 372 | * Use mmgrab()/mmdrop() to modify. When this drops to 0, the | 373 | * Use mmgrab()/mmdrop() to modify. When this drops to 0, the |
| 373 | * &struct mm_struct is freed. | 374 | * &struct mm_struct is freed. |
| 374 | */ | 375 | */ |
| 375 | atomic_t mm_count; | 376 | atomic_t mm_count; |
| 376 | 377 | ||
| 377 | #ifdef CONFIG_MMU | 378 | #ifdef CONFIG_MMU |
| 378 | atomic_long_t pgtables_bytes; /* PTE page table pages */ | 379 | atomic_long_t pgtables_bytes; /* PTE page table pages */ |
| 379 | #endif | 380 | #endif |
| 380 | int map_count; /* number of VMAs */ | 381 | int map_count; /* number of VMAs */ |
| 381 | 382 | ||
| 382 | spinlock_t page_table_lock; /* Protects page tables and some counters */ | 383 | spinlock_t page_table_lock; /* Protects page tables and some |
| 383 | struct rw_semaphore mmap_sem; | 384 | * counters |
| 385 | */ | ||
| 386 | struct rw_semaphore mmap_sem; | ||
| 384 | 387 | ||
| 385 | struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung | 388 | struct list_head mmlist; /* List of maybe swapped mm's. These |
| 386 | * together off init_mm.mmlist, and are protected | 389 | * are globally strung together off |
| 387 | * by mmlist_lock | 390 | * init_mm.mmlist, and are protected |
| 388 | */ | 391 | * by mmlist_lock |
| 392 | */ | ||
| 389 | 393 | ||
| 390 | 394 | ||
| 391 | unsigned long hiwater_rss; /* High-watermark of RSS usage */ | 395 | unsigned long hiwater_rss; /* High-watermark of RSS usage */ |
| 392 | unsigned long hiwater_vm; /* High-water virtual memory usage */ | 396 | unsigned long hiwater_vm; /* High-water virtual memory usage */ |
| 393 | 397 | ||
| 394 | unsigned long total_vm; /* Total pages mapped */ | 398 | unsigned long total_vm; /* Total pages mapped */ |
| 395 | unsigned long locked_vm; /* Pages that have PG_mlocked set */ | 399 | unsigned long locked_vm; /* Pages that have PG_mlocked set */ |
| 396 | unsigned long pinned_vm; /* Refcount permanently increased */ | 400 | unsigned long pinned_vm; /* Refcount permanently increased */ |
| 397 | unsigned long data_vm; /* VM_WRITE & ~VM_SHARED & ~VM_STACK */ | 401 | unsigned long data_vm; /* VM_WRITE & ~VM_SHARED & ~VM_STACK */ |
| 398 | unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE & ~VM_STACK */ | 402 | unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE & ~VM_STACK */ |
| 399 | unsigned long stack_vm; /* VM_STACK */ | 403 | unsigned long stack_vm; /* VM_STACK */ |
| 400 | unsigned long def_flags; | 404 | unsigned long def_flags; |
| 401 | 405 | ||
| 402 | spinlock_t arg_lock; /* protect the below fields */ | 406 | spinlock_t arg_lock; /* protect the below fields */ |
| 403 | unsigned long start_code, end_code, start_data, end_data; | 407 | unsigned long start_code, end_code, start_data, end_data; |
| 404 | unsigned long start_brk, brk, start_stack; | 408 | unsigned long start_brk, brk, start_stack; |
| 405 | unsigned long arg_start, arg_end, env_start, env_end; | 409 | unsigned long arg_start, arg_end, env_start, env_end; |
| 406 | 410 | ||
| 407 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | 411 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ |
| 408 | 412 | ||
| 409 | /* | 413 | /* |
| 410 | * Special counters, in some configurations protected by the | 414 | * Special counters, in some configurations protected by the |
| 411 | * page_table_lock, in other configurations by being atomic. | 415 | * page_table_lock, in other configurations by being atomic. |
| 412 | */ | 416 | */ |
| 413 | struct mm_rss_stat rss_stat; | 417 | struct mm_rss_stat rss_stat; |
| 414 | |||
| 415 | struct linux_binfmt *binfmt; | ||
| 416 | 418 | ||
| 417 | cpumask_var_t cpu_vm_mask_var; | 419 | struct linux_binfmt *binfmt; |
| 418 | 420 | ||
| 419 | /* Architecture-specific MM context */ | 421 | /* Architecture-specific MM context */ |
| 420 | mm_context_t context; | 422 | mm_context_t context; |
| 421 | 423 | ||
| 422 | unsigned long flags; /* Must use atomic bitops to access the bits */ | 424 | unsigned long flags; /* Must use atomic bitops to access */ |
| 423 | 425 | ||
| 424 | struct core_state *core_state; /* coredumping support */ | 426 | struct core_state *core_state; /* coredumping support */ |
| 425 | #ifdef CONFIG_MEMBARRIER | 427 | #ifdef CONFIG_MEMBARRIER |
| 426 | atomic_t membarrier_state; | 428 | atomic_t membarrier_state; |
| 427 | #endif | 429 | #endif |
| 428 | #ifdef CONFIG_AIO | 430 | #ifdef CONFIG_AIO |
| 429 | spinlock_t ioctx_lock; | 431 | spinlock_t ioctx_lock; |
| 430 | struct kioctx_table __rcu *ioctx_table; | 432 | struct kioctx_table __rcu *ioctx_table; |
| 431 | #endif | 433 | #endif |
| 432 | #ifdef CONFIG_MEMCG | 434 | #ifdef CONFIG_MEMCG |
| 433 | /* | 435 | /* |
| 434 | * "owner" points to a task that is regarded as the canonical | 436 | * "owner" points to a task that is regarded as the canonical |
| 435 | * user/owner of this mm. All of the following must be true in | 437 | * user/owner of this mm. All of the following must be true in |
| 436 | * order for it to be changed: | 438 | * order for it to be changed: |
| 437 | * | 439 | * |
| 438 | * current == mm->owner | 440 | * current == mm->owner |
| 439 | * current->mm != mm | 441 | * current->mm != mm |
| 440 | * new_owner->mm == mm | 442 | * new_owner->mm == mm |
| 441 | * new_owner->alloc_lock is held | 443 | * new_owner->alloc_lock is held |
| 442 | */ | 444 | */ |
| 443 | struct task_struct __rcu *owner; | 445 | struct task_struct __rcu *owner; |
| 444 | #endif | 446 | #endif |
| 445 | struct user_namespace *user_ns; | 447 | struct user_namespace *user_ns; |
| 446 | 448 | ||
| 447 | /* store ref to file /proc/<pid>/exe symlink points to */ | 449 | /* store ref to file /proc/<pid>/exe symlink points to */ |
| 448 | struct file __rcu *exe_file; | 450 | struct file __rcu *exe_file; |
| 449 | #ifdef CONFIG_MMU_NOTIFIER | 451 | #ifdef CONFIG_MMU_NOTIFIER |
| 450 | struct mmu_notifier_mm *mmu_notifier_mm; | 452 | struct mmu_notifier_mm *mmu_notifier_mm; |
| 451 | #endif | 453 | #endif |
| 452 | #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS | 454 | #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS |
| 453 | pgtable_t pmd_huge_pte; /* protected by page_table_lock */ | 455 | pgtable_t pmd_huge_pte; /* protected by page_table_lock */ |
| 454 | #endif | ||
| 455 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
| 456 | struct cpumask cpumask_allocation; | ||
| 457 | #endif | 456 | #endif |
| 458 | #ifdef CONFIG_NUMA_BALANCING | 457 | #ifdef CONFIG_NUMA_BALANCING |
| 459 | /* | 458 | /* |
| 460 | * numa_next_scan is the next time that the PTEs will be marked | 459 | * numa_next_scan is the next time that the PTEs will be marked |
| 461 | * pte_numa. NUMA hinting faults will gather statistics and migrate | 460 | * pte_numa. NUMA hinting faults will gather statistics and |
| 462 | * pages to new nodes if necessary. | 461 | * migrate pages to new nodes if necessary. |
| 463 | */ | 462 | */ |
| 464 | unsigned long numa_next_scan; | 463 | unsigned long numa_next_scan; |
| 465 | 464 | ||
| 466 | /* Restart point for scanning and setting pte_numa */ | 465 | /* Restart point for scanning and setting pte_numa */ |
| 467 | unsigned long numa_scan_offset; | 466 | unsigned long numa_scan_offset; |
| 468 | 467 | ||
| 469 | /* numa_scan_seq prevents two threads setting pte_numa */ | 468 | /* numa_scan_seq prevents two threads setting pte_numa */ |
| 470 | int numa_scan_seq; | 469 | int numa_scan_seq; |
| 471 | #endif | 470 | #endif |
| 472 | /* | 471 | /* |
| 473 | * An operation with batched TLB flushing is going on. Anything that | 472 | * An operation with batched TLB flushing is going on. Anything |
| 474 | * can move process memory needs to flush the TLB when moving a | 473 | * that can move process memory needs to flush the TLB when |
| 475 | * PROT_NONE or PROT_NUMA mapped page. | 474 | * moving a PROT_NONE or PROT_NUMA mapped page. |
| 476 | */ | 475 | */ |
| 477 | atomic_t tlb_flush_pending; | 476 | atomic_t tlb_flush_pending; |
| 478 | #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH | 477 | #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH |
| 479 | /* See flush_tlb_batched_pending() */ | 478 | /* See flush_tlb_batched_pending() */ |
| 480 | bool tlb_flush_batched; | 479 | bool tlb_flush_batched; |
| 481 | #endif | 480 | #endif |
| 482 | struct uprobes_state uprobes_state; | 481 | struct uprobes_state uprobes_state; |
| 483 | #ifdef CONFIG_HUGETLB_PAGE | 482 | #ifdef CONFIG_HUGETLB_PAGE |
| 484 | atomic_long_t hugetlb_usage; | 483 | atomic_long_t hugetlb_usage; |
| 485 | #endif | 484 | #endif |
| 486 | struct work_struct async_put_work; | 485 | struct work_struct async_put_work; |
| 487 | 486 | ||
| 488 | #if IS_ENABLED(CONFIG_HMM) | 487 | #if IS_ENABLED(CONFIG_HMM) |
| 489 | /* HMM needs to track a few things per mm */ | 488 | /* HMM needs to track a few things per mm */ |
| 490 | struct hmm *hmm; | 489 | struct hmm *hmm; |
| 491 | #endif | 490 | #endif |
| 492 | } __randomize_layout; | 491 | } __randomize_layout; |
| 492 | |||
| 493 | /* | ||
| 494 | * The mm_cpumask needs to be at the end of mm_struct, because it | ||
| 495 | * is dynamically sized based on nr_cpu_ids. | ||
| 496 | */ | ||
| 497 | unsigned long cpu_bitmap[]; | ||
| 498 | }; | ||
| 493 | 499 | ||
| 494 | extern struct mm_struct init_mm; | 500 | extern struct mm_struct init_mm; |
| 495 | 501 | ||
| 502 | /* Pointer magic because the dynamic array size confuses some compilers. */ | ||
| 496 | static inline void mm_init_cpumask(struct mm_struct *mm) | 503 | static inline void mm_init_cpumask(struct mm_struct *mm) |
| 497 | { | 504 | { |
| 498 | #ifdef CONFIG_CPUMASK_OFFSTACK | 505 | unsigned long cpu_bitmap = (unsigned long)mm; |
| 499 | mm->cpu_vm_mask_var = &mm->cpumask_allocation; | 506 | |
| 500 | #endif | 507 | cpu_bitmap += offsetof(struct mm_struct, cpu_bitmap); |
| 501 | cpumask_clear(mm->cpu_vm_mask_var); | 508 | cpumask_clear((struct cpumask *)cpu_bitmap); |
| 502 | } | 509 | } |
| 503 | 510 | ||
| 504 | /* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ | 511 | /* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ |
| 505 | static inline cpumask_t *mm_cpumask(struct mm_struct *mm) | 512 | static inline cpumask_t *mm_cpumask(struct mm_struct *mm) |
| 506 | { | 513 | { |
| 507 | return mm->cpu_vm_mask_var; | 514 | return (struct cpumask *)&mm->cpu_bitmap; |
| 508 | } | 515 | } |
| 509 | 516 | ||
| 510 | struct mmu_gather; | 517 | struct mmu_gather; |
diff --git a/include/linux/mroute_base.h b/include/linux/mroute_base.h index d633f737b3c6..6675b9f81979 100644 --- a/include/linux/mroute_base.h +++ b/include/linux/mroute_base.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define __LINUX_MROUTE_BASE_H | 2 | #define __LINUX_MROUTE_BASE_H |
| 3 | 3 | ||
| 4 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
| 5 | #include <linux/rhashtable.h> | 5 | #include <linux/rhashtable-types.h> |
| 6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
| 7 | #include <net/net_namespace.h> | 7 | #include <net/net_namespace.h> |
| 8 | #include <net/sock.h> | 8 | #include <net/sock.h> |
| @@ -254,6 +254,7 @@ struct mr_table { | |||
| 254 | atomic_t cache_resolve_queue_len; | 254 | atomic_t cache_resolve_queue_len; |
| 255 | bool mroute_do_assert; | 255 | bool mroute_do_assert; |
| 256 | bool mroute_do_pim; | 256 | bool mroute_do_pim; |
| 257 | bool mroute_do_wrvifwhole; | ||
| 257 | int mroute_reg_vif_num; | 258 | int mroute_reg_vif_num; |
| 258 | }; | 259 | }; |
| 259 | 260 | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index a86c4fa93115..cd0be91bdefa 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -67,9 +67,11 @@ struct mtd_erase_region_info { | |||
| 67 | * @datbuf: data buffer - if NULL only oob data are read/written | 67 | * @datbuf: data buffer - if NULL only oob data are read/written |
| 68 | * @oobbuf: oob data buffer | 68 | * @oobbuf: oob data buffer |
| 69 | * | 69 | * |
| 70 | * Note, it is allowed to read more than one OOB area at one go, but not write. | 70 | * Note, some MTD drivers do not allow you to write more than one OOB area at |
| 71 | * The interface assumes that the OOB write requests program only one page's | 71 | * one go. If you try to do that on such an MTD device, -EINVAL will be |
| 72 | * OOB area. | 72 | * returned. If you want to make your implementation portable on all kind of MTD |
| 73 | * devices you should split the write request into several sub-requests when the | ||
| 74 | * request crosses a page boundary. | ||
| 73 | */ | 75 | */ |
| 74 | struct mtd_oob_ops { | 76 | struct mtd_oob_ops { |
| 75 | unsigned int mode; | 77 | unsigned int mode; |
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 3e8ec3b8a39c..efb2345359bb 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h | |||
| @@ -21,11 +21,10 @@ | |||
| 21 | #include <linux/mtd/mtd.h> | 21 | #include <linux/mtd/mtd.h> |
| 22 | #include <linux/mtd/flashchip.h> | 22 | #include <linux/mtd/flashchip.h> |
| 23 | #include <linux/mtd/bbm.h> | 23 | #include <linux/mtd/bbm.h> |
| 24 | #include <linux/of.h> | ||
| 24 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 25 | 26 | ||
| 26 | struct mtd_info; | ||
| 27 | struct nand_flash_dev; | 27 | struct nand_flash_dev; |
| 28 | struct device_node; | ||
| 29 | 28 | ||
| 30 | /* Scan and identify a NAND device */ | 29 | /* Scan and identify a NAND device */ |
| 31 | int nand_scan_with_ids(struct mtd_info *mtd, int max_chips, | 30 | int nand_scan_with_ids(struct mtd_info *mtd, int max_chips, |
| @@ -36,17 +35,6 @@ static inline int nand_scan(struct mtd_info *mtd, int max_chips) | |||
| 36 | return nand_scan_with_ids(mtd, max_chips, NULL); | 35 | return nand_scan_with_ids(mtd, max_chips, NULL); |
| 37 | } | 36 | } |
| 38 | 37 | ||
| 39 | /* | ||
| 40 | * Separate phases of nand_scan(), allowing board driver to intervene | ||
| 41 | * and override command or ECC setup according to flash type. | ||
| 42 | */ | ||
| 43 | int nand_scan_ident(struct mtd_info *mtd, int max_chips, | ||
| 44 | struct nand_flash_dev *table); | ||
| 45 | int nand_scan_tail(struct mtd_info *mtd); | ||
| 46 | |||
| 47 | /* Unregister the MTD device and free resources held by the NAND device */ | ||
| 48 | void nand_release(struct mtd_info *mtd); | ||
| 49 | |||
| 50 | /* Internal helper for board drivers which need to override command function */ | 38 | /* Internal helper for board drivers which need to override command function */ |
| 51 | void nand_wait_ready(struct mtd_info *mtd); | 39 | void nand_wait_ready(struct mtd_info *mtd); |
| 52 | 40 | ||
| @@ -121,6 +109,7 @@ enum nand_ecc_algo { | |||
| 121 | NAND_ECC_UNKNOWN, | 109 | NAND_ECC_UNKNOWN, |
| 122 | NAND_ECC_HAMMING, | 110 | NAND_ECC_HAMMING, |
| 123 | NAND_ECC_BCH, | 111 | NAND_ECC_BCH, |
| 112 | NAND_ECC_RS, | ||
| 124 | }; | 113 | }; |
| 125 | 114 | ||
| 126 | /* | 115 | /* |
| @@ -218,6 +207,12 @@ enum nand_ecc_algo { | |||
| 218 | */ | 207 | */ |
| 219 | #define NAND_WAIT_TCCS 0x00200000 | 208 | #define NAND_WAIT_TCCS 0x00200000 |
| 220 | 209 | ||
| 210 | /* | ||
| 211 | * Whether the NAND chip is a boot medium. Drivers might use this information | ||
| 212 | * to select ECC algorithms supported by the boot ROM or similar restrictions. | ||
| 213 | */ | ||
| 214 | #define NAND_IS_BOOT_MEDIUM 0x00400000 | ||
| 215 | |||
| 221 | /* Options set by nand scan */ | 216 | /* Options set by nand scan */ |
| 222 | /* Nand scan has allocated controller struct */ | 217 | /* Nand scan has allocated controller struct */ |
| 223 | #define NAND_CONTROLLER_ALLOC 0x80000000 | 218 | #define NAND_CONTROLLER_ALLOC 0x80000000 |
| @@ -230,6 +225,17 @@ enum nand_ecc_algo { | |||
| 230 | /* Keep gcc happy */ | 225 | /* Keep gcc happy */ |
| 231 | struct nand_chip; | 226 | struct nand_chip; |
| 232 | 227 | ||
| 228 | /* ONFI version bits */ | ||
| 229 | #define ONFI_VERSION_1_0 BIT(1) | ||
| 230 | #define ONFI_VERSION_2_0 BIT(2) | ||
| 231 | #define ONFI_VERSION_2_1 BIT(3) | ||
| 232 | #define ONFI_VERSION_2_2 BIT(4) | ||
| 233 | #define ONFI_VERSION_2_3 BIT(5) | ||
| 234 | #define ONFI_VERSION_3_0 BIT(6) | ||
| 235 | #define ONFI_VERSION_3_1 BIT(7) | ||
| 236 | #define ONFI_VERSION_3_2 BIT(8) | ||
| 237 | #define ONFI_VERSION_4_0 BIT(9) | ||
| 238 | |||
| 233 | /* ONFI features */ | 239 | /* ONFI features */ |
| 234 | #define ONFI_FEATURE_16_BIT_BUS (1 << 0) | 240 | #define ONFI_FEATURE_16_BIT_BUS (1 << 0) |
| 235 | #define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7) | 241 | #define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7) |
| @@ -470,13 +476,13 @@ struct onfi_params { | |||
| 470 | */ | 476 | */ |
| 471 | struct nand_parameters { | 477 | struct nand_parameters { |
| 472 | /* Generic parameters */ | 478 | /* Generic parameters */ |
| 473 | char model[100]; | 479 | const char *model; |
| 474 | bool supports_set_get_features; | 480 | bool supports_set_get_features; |
| 475 | DECLARE_BITMAP(set_feature_list, ONFI_FEATURE_NUMBER); | 481 | DECLARE_BITMAP(set_feature_list, ONFI_FEATURE_NUMBER); |
| 476 | DECLARE_BITMAP(get_feature_list, ONFI_FEATURE_NUMBER); | 482 | DECLARE_BITMAP(get_feature_list, ONFI_FEATURE_NUMBER); |
| 477 | 483 | ||
| 478 | /* ONFI parameters */ | 484 | /* ONFI parameters */ |
| 479 | struct onfi_params onfi; | 485 | struct onfi_params *onfi; |
| 480 | }; | 486 | }; |
| 481 | 487 | ||
| 482 | /* The maximum expected count of bytes in the NAND ID sequence */ | 488 | /* The maximum expected count of bytes in the NAND ID sequence */ |
| @@ -493,20 +499,42 @@ struct nand_id { | |||
| 493 | }; | 499 | }; |
| 494 | 500 | ||
| 495 | /** | 501 | /** |
| 496 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices | 502 | * struct nand_controller_ops - Controller operations |
| 503 | * | ||
| 504 | * @attach_chip: this method is called after the NAND detection phase after | ||
| 505 | * flash ID and MTD fields such as erase size, page size and OOB | ||
| 506 | * size have been set up. ECC requirements are available if | ||
| 507 | * provided by the NAND chip or device tree. Typically used to | ||
| 508 | * choose the appropriate ECC configuration and allocate | ||
| 509 | * associated resources. | ||
| 510 | * This hook is optional. | ||
| 511 | * @detach_chip: free all resources allocated/claimed in | ||
| 512 | * nand_controller_ops->attach_chip(). | ||
| 513 | * This hook is optional. | ||
| 514 | */ | ||
| 515 | struct nand_controller_ops { | ||
| 516 | int (*attach_chip)(struct nand_chip *chip); | ||
| 517 | void (*detach_chip)(struct nand_chip *chip); | ||
| 518 | }; | ||
| 519 | |||
| 520 | /** | ||
| 521 | * struct nand_controller - Structure used to describe a NAND controller | ||
| 522 | * | ||
| 497 | * @lock: protection lock | 523 | * @lock: protection lock |
| 498 | * @active: the mtd device which holds the controller currently | 524 | * @active: the mtd device which holds the controller currently |
| 499 | * @wq: wait queue to sleep on if a NAND operation is in | 525 | * @wq: wait queue to sleep on if a NAND operation is in |
| 500 | * progress used instead of the per chip wait queue | 526 | * progress used instead of the per chip wait queue |
| 501 | * when a hw controller is available. | 527 | * when a hw controller is available. |
| 528 | * @ops: NAND controller operations. | ||
| 502 | */ | 529 | */ |
| 503 | struct nand_hw_control { | 530 | struct nand_controller { |
| 504 | spinlock_t lock; | 531 | spinlock_t lock; |
| 505 | struct nand_chip *active; | 532 | struct nand_chip *active; |
| 506 | wait_queue_head_t wq; | 533 | wait_queue_head_t wq; |
| 534 | const struct nand_controller_ops *ops; | ||
| 507 | }; | 535 | }; |
| 508 | 536 | ||
| 509 | static inline void nand_hw_control_init(struct nand_hw_control *nfc) | 537 | static inline void nand_controller_init(struct nand_controller *nfc) |
| 510 | { | 538 | { |
| 511 | nfc->active = NULL; | 539 | nfc->active = NULL; |
| 512 | spin_lock_init(&nfc->lock); | 540 | spin_lock_init(&nfc->lock); |
| @@ -778,11 +806,15 @@ nand_get_sdr_timings(const struct nand_data_interface *conf) | |||
| 778 | * implementation) if any. | 806 | * implementation) if any. |
| 779 | * @cleanup: the ->init() function may have allocated resources, ->cleanup() | 807 | * @cleanup: the ->init() function may have allocated resources, ->cleanup() |
| 780 | * is here to let vendor specific code release those resources. | 808 | * is here to let vendor specific code release those resources. |
| 809 | * @fixup_onfi_param_page: apply vendor specific fixups to the ONFI parameter | ||
| 810 | * page. This is called after the checksum is verified. | ||
| 781 | */ | 811 | */ |
| 782 | struct nand_manufacturer_ops { | 812 | struct nand_manufacturer_ops { |
| 783 | void (*detect)(struct nand_chip *chip); | 813 | void (*detect)(struct nand_chip *chip); |
| 784 | int (*init)(struct nand_chip *chip); | 814 | int (*init)(struct nand_chip *chip); |
| 785 | void (*cleanup)(struct nand_chip *chip); | 815 | void (*cleanup)(struct nand_chip *chip); |
| 816 | void (*fixup_onfi_param_page)(struct nand_chip *chip, | ||
| 817 | struct nand_onfi_params *p); | ||
| 786 | }; | 818 | }; |
| 787 | 819 | ||
| 788 | /** | 820 | /** |
| @@ -986,14 +1018,14 @@ struct nand_subop { | |||
| 986 | unsigned int last_instr_end_off; | 1018 | unsigned int last_instr_end_off; |
| 987 | }; | 1019 | }; |
| 988 | 1020 | ||
| 989 | int nand_subop_get_addr_start_off(const struct nand_subop *subop, | 1021 | unsigned int nand_subop_get_addr_start_off(const struct nand_subop *subop, |
| 990 | unsigned int op_id); | 1022 | unsigned int op_id); |
| 991 | int nand_subop_get_num_addr_cyc(const struct nand_subop *subop, | 1023 | unsigned int nand_subop_get_num_addr_cyc(const struct nand_subop *subop, |
| 992 | unsigned int op_id); | 1024 | unsigned int op_id); |
| 993 | int nand_subop_get_data_start_off(const struct nand_subop *subop, | 1025 | unsigned int nand_subop_get_data_start_off(const struct nand_subop *subop, |
| 994 | unsigned int op_id); | 1026 | unsigned int op_id); |
| 995 | int nand_subop_get_data_len(const struct nand_subop *subop, | 1027 | unsigned int nand_subop_get_data_len(const struct nand_subop *subop, |
| 996 | unsigned int op_id); | 1028 | unsigned int op_id); |
| 997 | 1029 | ||
| 998 | /** | 1030 | /** |
| 999 | * struct nand_op_parser_addr_constraints - Constraints for address instructions | 1031 | * struct nand_op_parser_addr_constraints - Constraints for address instructions |
| @@ -1176,9 +1208,9 @@ int nand_op_parser_exec_op(struct nand_chip *chip, | |||
| 1176 | * setting the read-retry mode. Mostly needed for MLC NAND. | 1208 | * setting the read-retry mode. Mostly needed for MLC NAND. |
| 1177 | * @ecc: [BOARDSPECIFIC] ECC control structure | 1209 | * @ecc: [BOARDSPECIFIC] ECC control structure |
| 1178 | * @buf_align: minimum buffer alignment required by a platform | 1210 | * @buf_align: minimum buffer alignment required by a platform |
| 1179 | * @hwcontrol: platform-specific hardware control structure | 1211 | * @dummy_controller: dummy controller implementation for drivers that can |
| 1212 | * only control a single chip | ||
| 1180 | * @erase: [REPLACEABLE] erase function | 1213 | * @erase: [REPLACEABLE] erase function |
| 1181 | * @scan_bbt: [REPLACEABLE] function to scan bad block table | ||
| 1182 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring | 1214 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring |
| 1183 | * data from array to read regs (tR). | 1215 | * data from array to read regs (tR). |
| 1184 | * @state: [INTERN] the current state of the NAND device | 1216 | * @state: [INTERN] the current state of the NAND device |
| @@ -1271,7 +1303,6 @@ struct nand_chip { | |||
| 1271 | const struct nand_operation *op, | 1303 | const struct nand_operation *op, |
| 1272 | bool check_only); | 1304 | bool check_only); |
| 1273 | int (*erase)(struct mtd_info *mtd, int page); | 1305 | int (*erase)(struct mtd_info *mtd, int page); |
| 1274 | int (*scan_bbt)(struct mtd_info *mtd); | ||
| 1275 | int (*set_features)(struct mtd_info *mtd, struct nand_chip *chip, | 1306 | int (*set_features)(struct mtd_info *mtd, struct nand_chip *chip, |
| 1276 | int feature_addr, uint8_t *subfeature_para); | 1307 | int feature_addr, uint8_t *subfeature_para); |
| 1277 | int (*get_features)(struct mtd_info *mtd, struct nand_chip *chip, | 1308 | int (*get_features)(struct mtd_info *mtd, struct nand_chip *chip, |
| @@ -1314,11 +1345,11 @@ struct nand_chip { | |||
| 1314 | flstate_t state; | 1345 | flstate_t state; |
| 1315 | 1346 | ||
| 1316 | uint8_t *oob_poi; | 1347 | uint8_t *oob_poi; |
| 1317 | struct nand_hw_control *controller; | 1348 | struct nand_controller *controller; |
| 1318 | 1349 | ||
| 1319 | struct nand_ecc_ctrl ecc; | 1350 | struct nand_ecc_ctrl ecc; |
| 1320 | unsigned long buf_align; | 1351 | unsigned long buf_align; |
| 1321 | struct nand_hw_control hwcontrol; | 1352 | struct nand_controller dummy_controller; |
| 1322 | 1353 | ||
| 1323 | uint8_t *bbt; | 1354 | uint8_t *bbt; |
| 1324 | struct nand_bbt_descr *bbt_td; | 1355 | struct nand_bbt_descr *bbt_td; |
| @@ -1517,14 +1548,12 @@ extern const struct nand_manufacturer_ops micron_nand_manuf_ops; | |||
| 1517 | extern const struct nand_manufacturer_ops amd_nand_manuf_ops; | 1548 | extern const struct nand_manufacturer_ops amd_nand_manuf_ops; |
| 1518 | extern const struct nand_manufacturer_ops macronix_nand_manuf_ops; | 1549 | extern const struct nand_manufacturer_ops macronix_nand_manuf_ops; |
| 1519 | 1550 | ||
| 1520 | int nand_default_bbt(struct mtd_info *mtd); | 1551 | int nand_create_bbt(struct nand_chip *chip); |
| 1521 | int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs); | 1552 | int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs); |
| 1522 | int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs); | 1553 | int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs); |
| 1523 | int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); | 1554 | int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); |
| 1524 | int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | 1555 | int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, |
| 1525 | int allowbbt); | 1556 | int allowbbt); |
| 1526 | int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, | ||
| 1527 | size_t *retlen, uint8_t *buf); | ||
| 1528 | 1557 | ||
| 1529 | /** | 1558 | /** |
| 1530 | * struct platform_nand_chip - chip level device structure | 1559 | * struct platform_nand_chip - chip level device structure |
| @@ -1555,14 +1584,12 @@ struct platform_device; | |||
| 1555 | * struct platform_nand_ctrl - controller level device structure | 1584 | * struct platform_nand_ctrl - controller level device structure |
| 1556 | * @probe: platform specific function to probe/setup hardware | 1585 | * @probe: platform specific function to probe/setup hardware |
| 1557 | * @remove: platform specific function to remove/teardown hardware | 1586 | * @remove: platform specific function to remove/teardown hardware |
| 1558 | * @hwcontrol: platform specific hardware control structure | ||
| 1559 | * @dev_ready: platform specific function to read ready/busy pin | 1587 | * @dev_ready: platform specific function to read ready/busy pin |
| 1560 | * @select_chip: platform specific chip select function | 1588 | * @select_chip: platform specific chip select function |
| 1561 | * @cmd_ctrl: platform specific function for controlling | 1589 | * @cmd_ctrl: platform specific function for controlling |
| 1562 | * ALE/CLE/nCE. Also used to write command and address | 1590 | * ALE/CLE/nCE. Also used to write command and address |
| 1563 | * @write_buf: platform specific function for write buffer | 1591 | * @write_buf: platform specific function for write buffer |
| 1564 | * @read_buf: platform specific function for read buffer | 1592 | * @read_buf: platform specific function for read buffer |
| 1565 | * @read_byte: platform specific function to read one byte from chip | ||
| 1566 | * @priv: private data to transport driver specific settings | 1593 | * @priv: private data to transport driver specific settings |
| 1567 | * | 1594 | * |
| 1568 | * All fields are optional and depend on the hardware driver requirements | 1595 | * All fields are optional and depend on the hardware driver requirements |
| @@ -1570,13 +1597,11 @@ struct platform_device; | |||
| 1570 | struct platform_nand_ctrl { | 1597 | struct platform_nand_ctrl { |
| 1571 | int (*probe)(struct platform_device *pdev); | 1598 | int (*probe)(struct platform_device *pdev); |
| 1572 | void (*remove)(struct platform_device *pdev); | 1599 | void (*remove)(struct platform_device *pdev); |
| 1573 | void (*hwcontrol)(struct mtd_info *mtd, int cmd); | ||
| 1574 | int (*dev_ready)(struct mtd_info *mtd); | 1600 | int (*dev_ready)(struct mtd_info *mtd); |
| 1575 | void (*select_chip)(struct mtd_info *mtd, int chip); | 1601 | void (*select_chip)(struct mtd_info *mtd, int chip); |
| 1576 | void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl); | 1602 | void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl); |
| 1577 | void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); | 1603 | void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); |
| 1578 | void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); | 1604 | void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); |
| 1579 | unsigned char (*read_byte)(struct mtd_info *mtd); | ||
| 1580 | void *priv; | 1605 | void *priv; |
| 1581 | }; | 1606 | }; |
| 1582 | 1607 | ||
| @@ -1593,10 +1618,10 @@ struct platform_nand_data { | |||
| 1593 | /* return the supported asynchronous timing mode. */ | 1618 | /* return the supported asynchronous timing mode. */ |
| 1594 | static inline int onfi_get_async_timing_mode(struct nand_chip *chip) | 1619 | static inline int onfi_get_async_timing_mode(struct nand_chip *chip) |
| 1595 | { | 1620 | { |
| 1596 | if (!chip->parameters.onfi.version) | 1621 | if (!chip->parameters.onfi) |
| 1597 | return ONFI_TIMING_MODE_UNKNOWN; | 1622 | return ONFI_TIMING_MODE_UNKNOWN; |
| 1598 | 1623 | ||
| 1599 | return chip->parameters.onfi.async_timing_mode; | 1624 | return chip->parameters.onfi->async_timing_mode; |
| 1600 | } | 1625 | } |
| 1601 | 1626 | ||
| 1602 | int onfi_fill_data_interface(struct nand_chip *chip, | 1627 | int onfi_fill_data_interface(struct nand_chip *chip, |
| @@ -1641,14 +1666,8 @@ int nand_check_erased_ecc_chunk(void *data, int datalen, | |||
| 1641 | void *extraoob, int extraooblen, | 1666 | void *extraoob, int extraooblen, |
| 1642 | int threshold); | 1667 | int threshold); |
| 1643 | 1668 | ||
| 1644 | int nand_check_ecc_caps(struct nand_chip *chip, | 1669 | int nand_ecc_choose_conf(struct nand_chip *chip, |
| 1645 | const struct nand_ecc_caps *caps, int oobavail); | 1670 | const struct nand_ecc_caps *caps, int oobavail); |
| 1646 | |||
| 1647 | int nand_match_ecc_req(struct nand_chip *chip, | ||
| 1648 | const struct nand_ecc_caps *caps, int oobavail); | ||
| 1649 | |||
| 1650 | int nand_maximize_ecc(struct nand_chip *chip, | ||
| 1651 | const struct nand_ecc_caps *caps, int oobavail); | ||
| 1652 | 1671 | ||
| 1653 | /* Default write_oob implementation */ | 1672 | /* Default write_oob implementation */ |
| 1654 | int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip, int page); | 1673 | int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip, int page); |
| @@ -1674,10 +1693,14 @@ int nand_get_set_features_notsupp(struct mtd_info *mtd, struct nand_chip *chip, | |||
| 1674 | /* Default read_page_raw implementation */ | 1693 | /* Default read_page_raw implementation */ |
| 1675 | int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, | 1694 | int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, |
| 1676 | uint8_t *buf, int oob_required, int page); | 1695 | uint8_t *buf, int oob_required, int page); |
| 1696 | int nand_read_page_raw_notsupp(struct mtd_info *mtd, struct nand_chip *chip, | ||
| 1697 | u8 *buf, int oob_required, int page); | ||
| 1677 | 1698 | ||
| 1678 | /* Default write_page_raw implementation */ | 1699 | /* Default write_page_raw implementation */ |
| 1679 | int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, | 1700 | int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, |
| 1680 | const uint8_t *buf, int oob_required, int page); | 1701 | const uint8_t *buf, int oob_required, int page); |
| 1702 | int nand_write_page_raw_notsupp(struct mtd_info *mtd, struct nand_chip *chip, | ||
| 1703 | const u8 *buf, int oob_required, int page); | ||
| 1681 | 1704 | ||
| 1682 | /* Reset and initialize a NAND device */ | 1705 | /* Reset and initialize a NAND device */ |
| 1683 | int nand_reset(struct nand_chip *chip, int chipnr); | 1706 | int nand_reset(struct nand_chip *chip, int chipnr); |
| @@ -1711,8 +1734,13 @@ int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len, | |||
| 1711 | int nand_write_data_op(struct nand_chip *chip, const void *buf, | 1734 | int nand_write_data_op(struct nand_chip *chip, const void *buf, |
| 1712 | unsigned int len, bool force_8bit); | 1735 | unsigned int len, bool force_8bit); |
| 1713 | 1736 | ||
| 1714 | /* Free resources held by the NAND device */ | 1737 | /* |
| 1738 | * Free resources held by the NAND device, must be called on error after a | ||
| 1739 | * sucessful nand_scan(). | ||
| 1740 | */ | ||
| 1715 | void nand_cleanup(struct nand_chip *chip); | 1741 | void nand_cleanup(struct nand_chip *chip); |
| 1742 | /* Unregister the MTD device and calls nand_cleanup() */ | ||
| 1743 | void nand_release(struct mtd_info *mtd); | ||
| 1716 | 1744 | ||
| 1717 | /* Default extended ID decoding function */ | 1745 | /* Default extended ID decoding function */ |
| 1718 | void nand_decode_ext_id(struct nand_chip *chip); | 1746 | void nand_decode_ext_id(struct nand_chip *chip); |
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index e60da0d34cc1..c922e97f205a 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h | |||
| @@ -235,6 +235,7 @@ enum spi_nor_option_flags { | |||
| 235 | SNOR_F_S3AN_ADDR_DEFAULT = BIT(3), | 235 | SNOR_F_S3AN_ADDR_DEFAULT = BIT(3), |
| 236 | SNOR_F_READY_XSR_RDY = BIT(4), | 236 | SNOR_F_READY_XSR_RDY = BIT(4), |
| 237 | SNOR_F_USE_CLSR = BIT(5), | 237 | SNOR_F_USE_CLSR = BIT(5), |
| 238 | SNOR_F_BROKEN_RESET = BIT(6), | ||
| 238 | }; | 239 | }; |
| 239 | 240 | ||
| 240 | /** | 241 | /** |
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h new file mode 100644 index 000000000000..088ff96c3eb6 --- /dev/null +++ b/include/linux/mtd/spinand.h | |||
| @@ -0,0 +1,421 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2016-2017 Micron Technology, Inc. | ||
| 4 | * | ||
| 5 | * Authors: | ||
| 6 | * Peter Pan <peterpandong@micron.com> | ||
| 7 | */ | ||
| 8 | #ifndef __LINUX_MTD_SPINAND_H | ||
| 9 | #define __LINUX_MTD_SPINAND_H | ||
| 10 | |||
| 11 | #include <linux/mutex.h> | ||
| 12 | #include <linux/bitops.h> | ||
| 13 | #include <linux/device.h> | ||
| 14 | #include <linux/mtd/mtd.h> | ||
| 15 | #include <linux/mtd/nand.h> | ||
| 16 | #include <linux/spi/spi.h> | ||
| 17 | #include <linux/spi/spi-mem.h> | ||
| 18 | |||
| 19 | /** | ||
| 20 | * Standard SPI NAND flash operations | ||
| 21 | */ | ||
| 22 | |||
| 23 | #define SPINAND_RESET_OP \ | ||
| 24 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xff, 1), \ | ||
| 25 | SPI_MEM_OP_NO_ADDR, \ | ||
| 26 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 27 | SPI_MEM_OP_NO_DATA) | ||
| 28 | |||
| 29 | #define SPINAND_WR_EN_DIS_OP(enable) \ | ||
| 30 | SPI_MEM_OP(SPI_MEM_OP_CMD((enable) ? 0x06 : 0x04, 1), \ | ||
| 31 | SPI_MEM_OP_NO_ADDR, \ | ||
| 32 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 33 | SPI_MEM_OP_NO_DATA) | ||
| 34 | |||
| 35 | #define SPINAND_READID_OP(ndummy, buf, len) \ | ||
| 36 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x9f, 1), \ | ||
| 37 | SPI_MEM_OP_NO_ADDR, \ | ||
| 38 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | ||
| 39 | SPI_MEM_OP_DATA_IN(len, buf, 1)) | ||
| 40 | |||
| 41 | #define SPINAND_SET_FEATURE_OP(reg, valptr) \ | ||
| 42 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x1f, 1), \ | ||
| 43 | SPI_MEM_OP_ADDR(1, reg, 1), \ | ||
| 44 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 45 | SPI_MEM_OP_DATA_OUT(1, valptr, 1)) | ||
| 46 | |||
| 47 | #define SPINAND_GET_FEATURE_OP(reg, valptr) \ | ||
| 48 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x0f, 1), \ | ||
| 49 | SPI_MEM_OP_ADDR(1, reg, 1), \ | ||
| 50 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 51 | SPI_MEM_OP_DATA_IN(1, valptr, 1)) | ||
| 52 | |||
| 53 | #define SPINAND_BLK_ERASE_OP(addr) \ | ||
| 54 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xd8, 1), \ | ||
| 55 | SPI_MEM_OP_ADDR(3, addr, 1), \ | ||
| 56 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 57 | SPI_MEM_OP_NO_DATA) | ||
| 58 | |||
| 59 | #define SPINAND_PAGE_READ_OP(addr) \ | ||
| 60 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x13, 1), \ | ||
| 61 | SPI_MEM_OP_ADDR(3, addr, 1), \ | ||
| 62 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 63 | SPI_MEM_OP_NO_DATA) | ||
| 64 | |||
| 65 | #define SPINAND_PAGE_READ_FROM_CACHE_OP(fast, addr, ndummy, buf, len) \ | ||
| 66 | SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \ | ||
| 67 | SPI_MEM_OP_ADDR(2, addr, 1), \ | ||
| 68 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | ||
| 69 | SPI_MEM_OP_DATA_IN(len, buf, 1)) | ||
| 70 | |||
| 71 | #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \ | ||
| 72 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \ | ||
| 73 | SPI_MEM_OP_ADDR(2, addr, 1), \ | ||
| 74 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | ||
| 75 | SPI_MEM_OP_DATA_IN(len, buf, 2)) | ||
| 76 | |||
| 77 | #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \ | ||
| 78 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ | ||
| 79 | SPI_MEM_OP_ADDR(2, addr, 1), \ | ||
| 80 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | ||
| 81 | SPI_MEM_OP_DATA_IN(len, buf, 4)) | ||
| 82 | |||
| 83 | #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \ | ||
| 84 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ | ||
| 85 | SPI_MEM_OP_ADDR(2, addr, 2), \ | ||
| 86 | SPI_MEM_OP_DUMMY(ndummy, 2), \ | ||
| 87 | SPI_MEM_OP_DATA_IN(len, buf, 2)) | ||
| 88 | |||
| 89 | #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \ | ||
| 90 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ | ||
| 91 | SPI_MEM_OP_ADDR(2, addr, 4), \ | ||
| 92 | SPI_MEM_OP_DUMMY(ndummy, 4), \ | ||
| 93 | SPI_MEM_OP_DATA_IN(len, buf, 4)) | ||
| 94 | |||
| 95 | #define SPINAND_PROG_EXEC_OP(addr) \ | ||
| 96 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \ | ||
| 97 | SPI_MEM_OP_ADDR(3, addr, 1), \ | ||
| 98 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 99 | SPI_MEM_OP_NO_DATA) | ||
| 100 | |||
| 101 | #define SPINAND_PROG_LOAD(reset, addr, buf, len) \ | ||
| 102 | SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0x02 : 0x84, 1), \ | ||
| 103 | SPI_MEM_OP_ADDR(2, addr, 1), \ | ||
| 104 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 105 | SPI_MEM_OP_DATA_OUT(len, buf, 1)) | ||
| 106 | |||
| 107 | #define SPINAND_PROG_LOAD_X4(reset, addr, buf, len) \ | ||
| 108 | SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0x32 : 0x34, 1), \ | ||
| 109 | SPI_MEM_OP_ADDR(2, addr, 1), \ | ||
| 110 | SPI_MEM_OP_NO_DUMMY, \ | ||
| 111 | SPI_MEM_OP_DATA_OUT(len, buf, 4)) | ||
| 112 | |||
| 113 | /** | ||
| 114 | * Standard SPI NAND flash commands | ||
| 115 | */ | ||
| 116 | #define SPINAND_CMD_PROG_LOAD_X4 0x32 | ||
| 117 | #define SPINAND_CMD_PROG_LOAD_RDM_DATA_X4 0x34 | ||
| 118 | |||
| 119 | /* feature register */ | ||
| 120 | #define REG_BLOCK_LOCK 0xa0 | ||
| 121 | #define BL_ALL_UNLOCKED 0x00 | ||
| 122 | |||
| 123 | /* configuration register */ | ||
| 124 | #define REG_CFG 0xb0 | ||
| 125 | #define CFG_OTP_ENABLE BIT(6) | ||
| 126 | #define CFG_ECC_ENABLE BIT(4) | ||
| 127 | #define CFG_QUAD_ENABLE BIT(0) | ||
| 128 | |||
| 129 | /* status register */ | ||
| 130 | #define REG_STATUS 0xc0 | ||
| 131 | #define STATUS_BUSY BIT(0) | ||
| 132 | #define STATUS_ERASE_FAILED BIT(2) | ||
| 133 | #define STATUS_PROG_FAILED BIT(3) | ||
| 134 | #define STATUS_ECC_MASK GENMASK(5, 4) | ||
| 135 | #define STATUS_ECC_NO_BITFLIPS (0 << 4) | ||
| 136 | #define STATUS_ECC_HAS_BITFLIPS (1 << 4) | ||
| 137 | #define STATUS_ECC_UNCOR_ERROR (2 << 4) | ||
| 138 | |||
| 139 | struct spinand_op; | ||
| 140 | struct spinand_device; | ||
| 141 | |||
| 142 | #define SPINAND_MAX_ID_LEN 4 | ||
| 143 | |||
| 144 | /** | ||
| 145 | * struct spinand_id - SPI NAND id structure | ||
| 146 | * @data: buffer containing the id bytes. Currently 4 bytes large, but can | ||
| 147 | * be extended if required | ||
| 148 | * @len: ID length | ||
| 149 | * | ||
| 150 | * struct_spinand_id->data contains all bytes returned after a READ_ID command, | ||
| 151 | * including dummy bytes if the chip does not emit ID bytes right after the | ||
| 152 | * READ_ID command. The responsibility to extract real ID bytes is left to | ||
| 153 | * struct_manufacurer_ops->detect(). | ||
| 154 | */ | ||
| 155 | struct spinand_id { | ||
| 156 | u8 data[SPINAND_MAX_ID_LEN]; | ||
| 157 | int len; | ||
| 158 | }; | ||
| 159 | |||
| 160 | /** | ||
| 161 | * struct manufacurer_ops - SPI NAND manufacturer specific operations | ||
| 162 | * @detect: detect a SPI NAND device. Every time a SPI NAND device is probed | ||
| 163 | * the core calls the struct_manufacurer_ops->detect() hook of each | ||
| 164 | * registered manufacturer until one of them return 1. Note that | ||
| 165 | * the first thing to check in this hook is that the manufacturer ID | ||
| 166 | * in struct_spinand_device->id matches the manufacturer whose | ||
| 167 | * ->detect() hook has been called. Should return 1 if there's a | ||
| 168 | * match, 0 if the manufacturer ID does not match and a negative | ||
| 169 | * error code otherwise. When true is returned, the core assumes | ||
| 170 | * that properties of the NAND chip (spinand->base.memorg and | ||
| 171 | * spinand->base.eccreq) have been filled | ||
| 172 | * @init: initialize a SPI NAND device | ||
| 173 | * @cleanup: cleanup a SPI NAND device | ||
| 174 | * | ||
| 175 | * Each SPI NAND manufacturer driver should implement this interface so that | ||
| 176 | * NAND chips coming from this vendor can be detected and initialized properly. | ||
| 177 | */ | ||
| 178 | struct spinand_manufacturer_ops { | ||
| 179 | int (*detect)(struct spinand_device *spinand); | ||
| 180 | int (*init)(struct spinand_device *spinand); | ||
| 181 | void (*cleanup)(struct spinand_device *spinand); | ||
| 182 | }; | ||
| 183 | |||
| 184 | /** | ||
| 185 | * struct spinand_manufacturer - SPI NAND manufacturer instance | ||
| 186 | * @id: manufacturer ID | ||
| 187 | * @name: manufacturer name | ||
| 188 | * @ops: manufacturer operations | ||
| 189 | */ | ||
| 190 | struct spinand_manufacturer { | ||
| 191 | u8 id; | ||
| 192 | char *name; | ||
| 193 | const struct spinand_manufacturer_ops *ops; | ||
| 194 | }; | ||
| 195 | |||
| 196 | /* SPI NAND manufacturers */ | ||
| 197 | extern const struct spinand_manufacturer macronix_spinand_manufacturer; | ||
| 198 | extern const struct spinand_manufacturer micron_spinand_manufacturer; | ||
| 199 | extern const struct spinand_manufacturer winbond_spinand_manufacturer; | ||
| 200 | |||
| 201 | /** | ||
| 202 | * struct spinand_op_variants - SPI NAND operation variants | ||
| 203 | * @ops: the list of variants for a given operation | ||
| 204 | * @nops: the number of variants | ||
| 205 | * | ||
| 206 | * Some operations like read-from-cache/write-to-cache have several variants | ||
| 207 | * depending on the number of IO lines you use to transfer data or address | ||
| 208 | * cycles. This structure is a way to describe the different variants supported | ||
| 209 | * by a chip and let the core pick the best one based on the SPI mem controller | ||
| 210 | * capabilities. | ||
| 211 | */ | ||
| 212 | struct spinand_op_variants { | ||
| 213 | const struct spi_mem_op *ops; | ||
| 214 | unsigned int nops; | ||
| 215 | }; | ||
| 216 | |||
| 217 | #define SPINAND_OP_VARIANTS(name, ...) \ | ||
| 218 | const struct spinand_op_variants name = { \ | ||
| 219 | .ops = (struct spi_mem_op[]) { __VA_ARGS__ }, \ | ||
| 220 | .nops = sizeof((struct spi_mem_op[]){ __VA_ARGS__ }) / \ | ||
| 221 | sizeof(struct spi_mem_op), \ | ||
| 222 | } | ||
| 223 | |||
| 224 | /** | ||
| 225 | * spinand_ecc_info - description of the on-die ECC implemented by a SPI NAND | ||
| 226 | * chip | ||
| 227 | * @get_status: get the ECC status. Should return a positive number encoding | ||
| 228 | * the number of corrected bitflips if correction was possible or | ||
| 229 | * -EBADMSG if there are uncorrectable errors. I can also return | ||
| 230 | * other negative error codes if the error is not caused by | ||
| 231 | * uncorrectable bitflips | ||
| 232 | * @ooblayout: the OOB layout used by the on-die ECC implementation | ||
| 233 | */ | ||
| 234 | struct spinand_ecc_info { | ||
| 235 | int (*get_status)(struct spinand_device *spinand, u8 status); | ||
| 236 | const struct mtd_ooblayout_ops *ooblayout; | ||
| 237 | }; | ||
| 238 | |||
| 239 | #define SPINAND_HAS_QE_BIT BIT(0) | ||
| 240 | |||
| 241 | /** | ||
| 242 | * struct spinand_info - Structure used to describe SPI NAND chips | ||
| 243 | * @model: model name | ||
| 244 | * @devid: device ID | ||
| 245 | * @flags: OR-ing of the SPINAND_XXX flags | ||
| 246 | * @memorg: memory organization | ||
| 247 | * @eccreq: ECC requirements | ||
| 248 | * @eccinfo: on-die ECC info | ||
| 249 | * @op_variants: operations variants | ||
| 250 | * @op_variants.read_cache: variants of the read-cache operation | ||
| 251 | * @op_variants.write_cache: variants of the write-cache operation | ||
| 252 | * @op_variants.update_cache: variants of the update-cache operation | ||
| 253 | * @select_target: function used to select a target/die. Required only for | ||
| 254 | * multi-die chips | ||
| 255 | * | ||
| 256 | * Each SPI NAND manufacturer driver should have a spinand_info table | ||
| 257 | * describing all the chips supported by the driver. | ||
| 258 | */ | ||
| 259 | struct spinand_info { | ||
| 260 | const char *model; | ||
| 261 | u8 devid; | ||
| 262 | u32 flags; | ||
| 263 | struct nand_memory_organization memorg; | ||
| 264 | struct nand_ecc_req eccreq; | ||
| 265 | struct spinand_ecc_info eccinfo; | ||
| 266 | struct { | ||
| 267 | const struct spinand_op_variants *read_cache; | ||
| 268 | const struct spinand_op_variants *write_cache; | ||
| 269 | const struct spinand_op_variants *update_cache; | ||
| 270 | } op_variants; | ||
| 271 | int (*select_target)(struct spinand_device *spinand, | ||
| 272 | unsigned int target); | ||
| 273 | }; | ||
| 274 | |||
| 275 | #define SPINAND_INFO_OP_VARIANTS(__read, __write, __update) \ | ||
| 276 | { \ | ||
| 277 | .read_cache = __read, \ | ||
| 278 | .write_cache = __write, \ | ||
| 279 | .update_cache = __update, \ | ||
| 280 | } | ||
| 281 | |||
| 282 | #define SPINAND_ECCINFO(__ooblayout, __get_status) \ | ||
| 283 | .eccinfo = { \ | ||
| 284 | .ooblayout = __ooblayout, \ | ||
| 285 | .get_status = __get_status, \ | ||
| 286 | } | ||
| 287 | |||
| 288 | #define SPINAND_SELECT_TARGET(__func) \ | ||
| 289 | .select_target = __func, | ||
| 290 | |||
| 291 | #define SPINAND_INFO(__model, __id, __memorg, __eccreq, __op_variants, \ | ||
| 292 | __flags, ...) \ | ||
| 293 | { \ | ||
| 294 | .model = __model, \ | ||
| 295 | .devid = __id, \ | ||
| 296 | .memorg = __memorg, \ | ||
| 297 | .eccreq = __eccreq, \ | ||
| 298 | .op_variants = __op_variants, \ | ||
| 299 | .flags = __flags, \ | ||
| 300 | __VA_ARGS__ \ | ||
| 301 | } | ||
| 302 | |||
| 303 | /** | ||
| 304 | * struct spinand_device - SPI NAND device instance | ||
| 305 | * @base: NAND device instance | ||
| 306 | * @spimem: pointer to the SPI mem object | ||
| 307 | * @lock: lock used to serialize accesses to the NAND | ||
| 308 | * @id: NAND ID as returned by READ_ID | ||
| 309 | * @flags: NAND flags | ||
| 310 | * @op_templates: various SPI mem op templates | ||
| 311 | * @op_templates.read_cache: read cache op template | ||
| 312 | * @op_templates.write_cache: write cache op template | ||
| 313 | * @op_templates.update_cache: update cache op template | ||
| 314 | * @select_target: select a specific target/die. Usually called before sending | ||
| 315 | * a command addressing a page or an eraseblock embedded in | ||
| 316 | * this die. Only required if your chip exposes several dies | ||
| 317 | * @cur_target: currently selected target/die | ||
| 318 | * @eccinfo: on-die ECC information | ||
| 319 | * @cfg_cache: config register cache. One entry per die | ||
| 320 | * @databuf: bounce buffer for data | ||
| 321 | * @oobbuf: bounce buffer for OOB data | ||
| 322 | * @scratchbuf: buffer used for everything but page accesses. This is needed | ||
| 323 | * because the spi-mem interface explicitly requests that buffers | ||
| 324 | * passed in spi_mem_op be DMA-able, so we can't based the bufs on | ||
| 325 | * the stack | ||
| 326 | * @manufacturer: SPI NAND manufacturer information | ||
| 327 | * @priv: manufacturer private data | ||
| 328 | */ | ||
| 329 | struct spinand_device { | ||
| 330 | struct nand_device base; | ||
| 331 | struct spi_mem *spimem; | ||
| 332 | struct mutex lock; | ||
| 333 | struct spinand_id id; | ||
| 334 | u32 flags; | ||
| 335 | |||
| 336 | struct { | ||
| 337 | const struct spi_mem_op *read_cache; | ||
| 338 | const struct spi_mem_op *write_cache; | ||
| 339 | const struct spi_mem_op *update_cache; | ||
| 340 | } op_templates; | ||
| 341 | |||
| 342 | int (*select_target)(struct spinand_device *spinand, | ||
| 343 | unsigned int target); | ||
| 344 | unsigned int cur_target; | ||
| 345 | |||
| 346 | struct spinand_ecc_info eccinfo; | ||
| 347 | |||
| 348 | u8 *cfg_cache; | ||
| 349 | u8 *databuf; | ||
| 350 | u8 *oobbuf; | ||
| 351 | u8 *scratchbuf; | ||
| 352 | const struct spinand_manufacturer *manufacturer; | ||
| 353 | void *priv; | ||
| 354 | }; | ||
| 355 | |||
| 356 | /** | ||
| 357 | * mtd_to_spinand() - Get the SPI NAND device attached to an MTD instance | ||
| 358 | * @mtd: MTD instance | ||
| 359 | * | ||
| 360 | * Return: the SPI NAND device attached to @mtd. | ||
| 361 | */ | ||
| 362 | static inline struct spinand_device *mtd_to_spinand(struct mtd_info *mtd) | ||
| 363 | { | ||
| 364 | return container_of(mtd_to_nanddev(mtd), struct spinand_device, base); | ||
| 365 | } | ||
| 366 | |||
| 367 | /** | ||
| 368 | * spinand_to_mtd() - Get the MTD device embedded in a SPI NAND device | ||
| 369 | * @spinand: SPI NAND device | ||
| 370 | * | ||
| 371 | * Return: the MTD device embedded in @spinand. | ||
| 372 | */ | ||
| 373 | static inline struct mtd_info *spinand_to_mtd(struct spinand_device *spinand) | ||
| 374 | { | ||
| 375 | return nanddev_to_mtd(&spinand->base); | ||
| 376 | } | ||
| 377 | |||
| 378 | /** | ||
| 379 | * nand_to_spinand() - Get the SPI NAND device embedding an NAND object | ||
| 380 | * @nand: NAND object | ||
| 381 | * | ||
| 382 | * Return: the SPI NAND device embedding @nand. | ||
| 383 | */ | ||
| 384 | static inline struct spinand_device *nand_to_spinand(struct nand_device *nand) | ||
| 385 | { | ||
| 386 | return container_of(nand, struct spinand_device, base); | ||
| 387 | } | ||
| 388 | |||
| 389 | /** | ||
| 390 | * spinand_to_nand() - Get the NAND device embedded in a SPI NAND object | ||
| 391 | * @spinand: SPI NAND device | ||
| 392 | * | ||
| 393 | * Return: the NAND device embedded in @spinand. | ||
| 394 | */ | ||
| 395 | static inline struct nand_device * | ||
| 396 | spinand_to_nand(struct spinand_device *spinand) | ||
| 397 | { | ||
| 398 | return &spinand->base; | ||
| 399 | } | ||
| 400 | |||
| 401 | /** | ||
| 402 | * spinand_set_of_node - Attach a DT node to a SPI NAND device | ||
| 403 | * @spinand: SPI NAND device | ||
| 404 | * @np: DT node | ||
| 405 | * | ||
| 406 | * Attach a DT node to a SPI NAND device. | ||
| 407 | */ | ||
| 408 | static inline void spinand_set_of_node(struct spinand_device *spinand, | ||
| 409 | struct device_node *np) | ||
| 410 | { | ||
| 411 | nanddev_set_of_node(&spinand->base, np); | ||
| 412 | } | ||
| 413 | |||
| 414 | int spinand_match_and_init(struct spinand_device *dev, | ||
| 415 | const struct spinand_info *table, | ||
| 416 | unsigned int table_size, u8 devid); | ||
| 417 | |||
| 418 | int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val); | ||
| 419 | int spinand_select_target(struct spinand_device *spinand, unsigned int target); | ||
| 420 | |||
| 421 | #endif /* __LINUX_MTD_SPINAND_H */ | ||
diff --git a/include/linux/net.h b/include/linux/net.h index 6554d3ba4396..e0930678c8bf 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
| @@ -114,7 +114,7 @@ struct socket { | |||
| 114 | 114 | ||
| 115 | unsigned long flags; | 115 | unsigned long flags; |
| 116 | 116 | ||
| 117 | struct socket_wq __rcu *wq; | 117 | struct socket_wq *wq; |
| 118 | 118 | ||
| 119 | struct file *file; | 119 | struct file *file; |
| 120 | struct sock *sk; | 120 | struct sock *sk; |
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 623bb8ced060..2b2a6dce1630 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h | |||
| @@ -79,6 +79,7 @@ enum { | |||
| 79 | NETIF_F_HW_ESP_TX_CSUM_BIT, /* ESP with TX checksum offload */ | 79 | NETIF_F_HW_ESP_TX_CSUM_BIT, /* ESP with TX checksum offload */ |
| 80 | NETIF_F_RX_UDP_TUNNEL_PORT_BIT, /* Offload of RX port for UDP tunnels */ | 80 | NETIF_F_RX_UDP_TUNNEL_PORT_BIT, /* Offload of RX port for UDP tunnels */ |
| 81 | NETIF_F_HW_TLS_TX_BIT, /* Hardware TLS TX offload */ | 81 | NETIF_F_HW_TLS_TX_BIT, /* Hardware TLS TX offload */ |
| 82 | NETIF_F_HW_TLS_RX_BIT, /* Hardware TLS RX offload */ | ||
| 82 | 83 | ||
| 83 | NETIF_F_GRO_HW_BIT, /* Hardware Generic receive offload */ | 84 | NETIF_F_GRO_HW_BIT, /* Hardware Generic receive offload */ |
| 84 | NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */ | 85 | NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */ |
| @@ -151,6 +152,7 @@ enum { | |||
| 151 | #define NETIF_F_HW_TLS_RECORD __NETIF_F(HW_TLS_RECORD) | 152 | #define NETIF_F_HW_TLS_RECORD __NETIF_F(HW_TLS_RECORD) |
| 152 | #define NETIF_F_GSO_UDP_L4 __NETIF_F(GSO_UDP_L4) | 153 | #define NETIF_F_GSO_UDP_L4 __NETIF_F(GSO_UDP_L4) |
| 153 | #define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) | 154 | #define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) |
| 155 | #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX) | ||
| 154 | 156 | ||
| 155 | #define for_each_netdev_feature(mask_addr, bit) \ | 157 | #define for_each_netdev_feature(mask_addr, bit) \ |
| 156 | for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) | 158 | for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3d0cc0b5cec2..ca5ab98053c8 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -302,6 +302,17 @@ struct netdev_boot_setup { | |||
| 302 | 302 | ||
| 303 | int __init netdev_boot_setup(char *str); | 303 | int __init netdev_boot_setup(char *str); |
| 304 | 304 | ||
| 305 | struct gro_list { | ||
| 306 | struct list_head list; | ||
| 307 | int count; | ||
| 308 | }; | ||
| 309 | |||
| 310 | /* | ||
| 311 | * size of gro hash buckets, must less than bit number of | ||
| 312 | * napi_struct::gro_bitmask | ||
| 313 | */ | ||
| 314 | #define GRO_HASH_BUCKETS 8 | ||
| 315 | |||
| 305 | /* | 316 | /* |
| 306 | * Structure for NAPI scheduling similar to tasklet but with weighting | 317 | * Structure for NAPI scheduling similar to tasklet but with weighting |
| 307 | */ | 318 | */ |
| @@ -316,13 +327,13 @@ struct napi_struct { | |||
| 316 | 327 | ||
| 317 | unsigned long state; | 328 | unsigned long state; |
| 318 | int weight; | 329 | int weight; |
| 319 | unsigned int gro_count; | 330 | unsigned long gro_bitmask; |
| 320 | int (*poll)(struct napi_struct *, int); | 331 | int (*poll)(struct napi_struct *, int); |
| 321 | #ifdef CONFIG_NETPOLL | 332 | #ifdef CONFIG_NETPOLL |
| 322 | int poll_owner; | 333 | int poll_owner; |
| 323 | #endif | 334 | #endif |
| 324 | struct net_device *dev; | 335 | struct net_device *dev; |
| 325 | struct sk_buff *gro_list; | 336 | struct gro_list gro_hash[GRO_HASH_BUCKETS]; |
| 326 | struct sk_buff *skb; | 337 | struct sk_buff *skb; |
| 327 | struct hrtimer timer; | 338 | struct hrtimer timer; |
| 328 | struct list_head dev_list; | 339 | struct list_head dev_list; |
| @@ -569,6 +580,9 @@ struct netdev_queue { | |||
| 569 | * (/sys/class/net/DEV/Q/trans_timeout) | 580 | * (/sys/class/net/DEV/Q/trans_timeout) |
| 570 | */ | 581 | */ |
| 571 | unsigned long trans_timeout; | 582 | unsigned long trans_timeout; |
| 583 | |||
| 584 | /* Subordinate device that the queue has been assigned to */ | ||
| 585 | struct net_device *sb_dev; | ||
| 572 | /* | 586 | /* |
| 573 | * write-mostly part | 587 | * write-mostly part |
| 574 | */ | 588 | */ |
| @@ -730,10 +744,15 @@ struct xps_map { | |||
| 730 | */ | 744 | */ |
| 731 | struct xps_dev_maps { | 745 | struct xps_dev_maps { |
| 732 | struct rcu_head rcu; | 746 | struct rcu_head rcu; |
| 733 | struct xps_map __rcu *cpu_map[0]; | 747 | struct xps_map __rcu *attr_map[0]; /* Either CPUs map or RXQs map */ |
| 734 | }; | 748 | }; |
| 735 | #define XPS_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \ | 749 | |
| 750 | #define XPS_CPU_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \ | ||
| 736 | (nr_cpu_ids * (_tcs) * sizeof(struct xps_map *))) | 751 | (nr_cpu_ids * (_tcs) * sizeof(struct xps_map *))) |
| 752 | |||
| 753 | #define XPS_RXQ_DEV_MAPS_SIZE(_tcs, _rxqs) (sizeof(struct xps_dev_maps) +\ | ||
| 754 | (_rxqs * (_tcs) * sizeof(struct xps_map *))) | ||
| 755 | |||
| 737 | #endif /* CONFIG_XPS */ | 756 | #endif /* CONFIG_XPS */ |
| 738 | 757 | ||
| 739 | #define TC_MAX_QUEUE 16 | 758 | #define TC_MAX_QUEUE 16 |
| @@ -779,7 +798,8 @@ static inline bool netdev_phys_item_id_same(struct netdev_phys_item_id *a, | |||
| 779 | } | 798 | } |
| 780 | 799 | ||
| 781 | typedef u16 (*select_queue_fallback_t)(struct net_device *dev, | 800 | typedef u16 (*select_queue_fallback_t)(struct net_device *dev, |
| 782 | struct sk_buff *skb); | 801 | struct sk_buff *skb, |
| 802 | struct net_device *sb_dev); | ||
| 783 | 803 | ||
| 784 | enum tc_setup_type { | 804 | enum tc_setup_type { |
| 785 | TC_SETUP_QDISC_MQPRIO, | 805 | TC_SETUP_QDISC_MQPRIO, |
| @@ -792,6 +812,7 @@ enum tc_setup_type { | |||
| 792 | TC_SETUP_QDISC_RED, | 812 | TC_SETUP_QDISC_RED, |
| 793 | TC_SETUP_QDISC_PRIO, | 813 | TC_SETUP_QDISC_PRIO, |
| 794 | TC_SETUP_QDISC_MQ, | 814 | TC_SETUP_QDISC_MQ, |
| 815 | TC_SETUP_QDISC_ETF, | ||
| 795 | }; | 816 | }; |
| 796 | 817 | ||
| 797 | /* These structures hold the attributes of bpf state that are being passed | 818 | /* These structures hold the attributes of bpf state that are being passed |
| @@ -807,11 +828,8 @@ enum bpf_netdev_command { | |||
| 807 | */ | 828 | */ |
| 808 | XDP_SETUP_PROG, | 829 | XDP_SETUP_PROG, |
| 809 | XDP_SETUP_PROG_HW, | 830 | XDP_SETUP_PROG_HW, |
| 810 | /* Check if a bpf program is set on the device. The callee should | ||
| 811 | * set @prog_attached to one of XDP_ATTACHED_* values, note that "true" | ||
| 812 | * is equivalent to XDP_ATTACHED_DRV. | ||
| 813 | */ | ||
| 814 | XDP_QUERY_PROG, | 831 | XDP_QUERY_PROG, |
| 832 | XDP_QUERY_PROG_HW, | ||
| 815 | /* BPF program for offload callbacks, invoked at program load time. */ | 833 | /* BPF program for offload callbacks, invoked at program load time. */ |
| 816 | BPF_OFFLOAD_VERIFIER_PREP, | 834 | BPF_OFFLOAD_VERIFIER_PREP, |
| 817 | BPF_OFFLOAD_TRANSLATE, | 835 | BPF_OFFLOAD_TRANSLATE, |
| @@ -835,9 +853,8 @@ struct netdev_bpf { | |||
| 835 | struct bpf_prog *prog; | 853 | struct bpf_prog *prog; |
| 836 | struct netlink_ext_ack *extack; | 854 | struct netlink_ext_ack *extack; |
| 837 | }; | 855 | }; |
| 838 | /* XDP_QUERY_PROG */ | 856 | /* XDP_QUERY_PROG, XDP_QUERY_PROG_HW */ |
| 839 | struct { | 857 | struct { |
| 840 | u8 prog_attached; | ||
| 841 | u32 prog_id; | 858 | u32 prog_id; |
| 842 | /* flags with which program was installed */ | 859 | /* flags with which program was installed */ |
| 843 | u32 prog_flags; | 860 | u32 prog_flags; |
| @@ -855,10 +872,10 @@ struct netdev_bpf { | |||
| 855 | struct { | 872 | struct { |
| 856 | struct bpf_offloaded_map *offmap; | 873 | struct bpf_offloaded_map *offmap; |
| 857 | }; | 874 | }; |
| 858 | /* XDP_SETUP_XSK_UMEM */ | 875 | /* XDP_QUERY_XSK_UMEM, XDP_SETUP_XSK_UMEM */ |
| 859 | struct { | 876 | struct { |
| 860 | struct xdp_umem *umem; | 877 | struct xdp_umem *umem; /* out for query*/ |
| 861 | u16 queue_id; | 878 | u16 queue_id; /* in for query */ |
| 862 | } xsk; | 879 | } xsk; |
| 863 | }; | 880 | }; |
| 864 | }; | 881 | }; |
| @@ -891,6 +908,8 @@ struct tlsdev_ops { | |||
| 891 | void (*tls_dev_del)(struct net_device *netdev, | 908 | void (*tls_dev_del)(struct net_device *netdev, |
| 892 | struct tls_context *ctx, | 909 | struct tls_context *ctx, |
| 893 | enum tls_offload_ctx_dir direction); | 910 | enum tls_offload_ctx_dir direction); |
| 911 | void (*tls_dev_resync_rx)(struct net_device *netdev, | ||
| 912 | struct sock *sk, u32 seq, u64 rcd_sn); | ||
| 894 | }; | 913 | }; |
| 895 | #endif | 914 | #endif |
| 896 | 915 | ||
| @@ -942,7 +961,8 @@ struct dev_ifalias { | |||
| 942 | * those the driver believes to be appropriate. | 961 | * those the driver believes to be appropriate. |
| 943 | * | 962 | * |
| 944 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, | 963 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, |
| 945 | * void *accel_priv, select_queue_fallback_t fallback); | 964 | * struct net_device *sb_dev, |
| 965 | * select_queue_fallback_t fallback); | ||
| 946 | * Called to decide which queue to use when device supports multiple | 966 | * Called to decide which queue to use when device supports multiple |
| 947 | * transmit queues. | 967 | * transmit queues. |
| 948 | * | 968 | * |
| @@ -1214,7 +1234,7 @@ struct net_device_ops { | |||
| 1214 | netdev_features_t features); | 1234 | netdev_features_t features); |
| 1215 | u16 (*ndo_select_queue)(struct net_device *dev, | 1235 | u16 (*ndo_select_queue)(struct net_device *dev, |
| 1216 | struct sk_buff *skb, | 1236 | struct sk_buff *skb, |
| 1217 | void *accel_priv, | 1237 | struct net_device *sb_dev, |
| 1218 | select_queue_fallback_t fallback); | 1238 | select_queue_fallback_t fallback); |
| 1219 | void (*ndo_change_rx_flags)(struct net_device *dev, | 1239 | void (*ndo_change_rx_flags)(struct net_device *dev, |
| 1220 | int flags); | 1240 | int flags); |
| @@ -1909,7 +1929,8 @@ struct net_device { | |||
| 1909 | int watchdog_timeo; | 1929 | int watchdog_timeo; |
| 1910 | 1930 | ||
| 1911 | #ifdef CONFIG_XPS | 1931 | #ifdef CONFIG_XPS |
| 1912 | struct xps_dev_maps __rcu *xps_maps; | 1932 | struct xps_dev_maps __rcu *xps_cpus_map; |
| 1933 | struct xps_dev_maps __rcu *xps_rxqs_map; | ||
| 1913 | #endif | 1934 | #endif |
| 1914 | #ifdef CONFIG_NET_CLS_ACT | 1935 | #ifdef CONFIG_NET_CLS_ACT |
| 1915 | struct mini_Qdisc __rcu *miniq_egress; | 1936 | struct mini_Qdisc __rcu *miniq_egress; |
| @@ -1978,7 +1999,7 @@ struct net_device { | |||
| 1978 | #ifdef CONFIG_DCB | 1999 | #ifdef CONFIG_DCB |
| 1979 | const struct dcbnl_rtnl_ops *dcbnl_ops; | 2000 | const struct dcbnl_rtnl_ops *dcbnl_ops; |
| 1980 | #endif | 2001 | #endif |
| 1981 | u8 num_tc; | 2002 | s16 num_tc; |
| 1982 | struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; | 2003 | struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; |
| 1983 | u8 prio_tc_map[TC_BITMASK + 1]; | 2004 | u8 prio_tc_map[TC_BITMASK + 1]; |
| 1984 | 2005 | ||
| @@ -2032,6 +2053,17 @@ int netdev_get_num_tc(struct net_device *dev) | |||
| 2032 | return dev->num_tc; | 2053 | return dev->num_tc; |
| 2033 | } | 2054 | } |
| 2034 | 2055 | ||
| 2056 | void netdev_unbind_sb_channel(struct net_device *dev, | ||
| 2057 | struct net_device *sb_dev); | ||
| 2058 | int netdev_bind_sb_channel_queue(struct net_device *dev, | ||
| 2059 | struct net_device *sb_dev, | ||
| 2060 | u8 tc, u16 count, u16 offset); | ||
| 2061 | int netdev_set_sb_channel(struct net_device *dev, u16 channel); | ||
| 2062 | static inline int netdev_get_sb_channel(struct net_device *dev) | ||
| 2063 | { | ||
| 2064 | return max_t(int, -dev->num_tc, 0); | ||
| 2065 | } | ||
| 2066 | |||
| 2035 | static inline | 2067 | static inline |
| 2036 | struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, | 2068 | struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, |
| 2037 | unsigned int index) | 2069 | unsigned int index) |
| @@ -2076,7 +2108,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, | |||
| 2076 | 2108 | ||
| 2077 | struct netdev_queue *netdev_pick_tx(struct net_device *dev, | 2109 | struct netdev_queue *netdev_pick_tx(struct net_device *dev, |
| 2078 | struct sk_buff *skb, | 2110 | struct sk_buff *skb, |
| 2079 | void *accel_priv); | 2111 | struct net_device *sb_dev); |
| 2080 | 2112 | ||
| 2081 | /* returns the headroom that the master device needs to take in account | 2113 | /* returns the headroom that the master device needs to take in account |
| 2082 | * when forwarding to this dev | 2114 | * when forwarding to this dev |
| @@ -2255,10 +2287,10 @@ static inline int gro_recursion_inc_test(struct sk_buff *skb) | |||
| 2255 | return ++NAPI_GRO_CB(skb)->recursion_counter == GRO_RECURSION_LIMIT; | 2287 | return ++NAPI_GRO_CB(skb)->recursion_counter == GRO_RECURSION_LIMIT; |
| 2256 | } | 2288 | } |
| 2257 | 2289 | ||
| 2258 | typedef struct sk_buff **(*gro_receive_t)(struct sk_buff **, struct sk_buff *); | 2290 | typedef struct sk_buff *(*gro_receive_t)(struct list_head *, struct sk_buff *); |
| 2259 | static inline struct sk_buff **call_gro_receive(gro_receive_t cb, | 2291 | static inline struct sk_buff *call_gro_receive(gro_receive_t cb, |
| 2260 | struct sk_buff **head, | 2292 | struct list_head *head, |
| 2261 | struct sk_buff *skb) | 2293 | struct sk_buff *skb) |
| 2262 | { | 2294 | { |
| 2263 | if (unlikely(gro_recursion_inc_test(skb))) { | 2295 | if (unlikely(gro_recursion_inc_test(skb))) { |
| 2264 | NAPI_GRO_CB(skb)->flush |= 1; | 2296 | NAPI_GRO_CB(skb)->flush |= 1; |
| @@ -2268,12 +2300,12 @@ static inline struct sk_buff **call_gro_receive(gro_receive_t cb, | |||
| 2268 | return cb(head, skb); | 2300 | return cb(head, skb); |
| 2269 | } | 2301 | } |
| 2270 | 2302 | ||
| 2271 | typedef struct sk_buff **(*gro_receive_sk_t)(struct sock *, struct sk_buff **, | 2303 | typedef struct sk_buff *(*gro_receive_sk_t)(struct sock *, struct list_head *, |
| 2272 | struct sk_buff *); | 2304 | struct sk_buff *); |
| 2273 | static inline struct sk_buff **call_gro_receive_sk(gro_receive_sk_t cb, | 2305 | static inline struct sk_buff *call_gro_receive_sk(gro_receive_sk_t cb, |
| 2274 | struct sock *sk, | 2306 | struct sock *sk, |
| 2275 | struct sk_buff **head, | 2307 | struct list_head *head, |
| 2276 | struct sk_buff *skb) | 2308 | struct sk_buff *skb) |
| 2277 | { | 2309 | { |
| 2278 | if (unlikely(gro_recursion_inc_test(skb))) { | 2310 | if (unlikely(gro_recursion_inc_test(skb))) { |
| 2279 | NAPI_GRO_CB(skb)->flush |= 1; | 2311 | NAPI_GRO_CB(skb)->flush |= 1; |
| @@ -2290,6 +2322,9 @@ struct packet_type { | |||
| 2290 | struct net_device *, | 2322 | struct net_device *, |
| 2291 | struct packet_type *, | 2323 | struct packet_type *, |
| 2292 | struct net_device *); | 2324 | struct net_device *); |
| 2325 | void (*list_func) (struct list_head *, | ||
| 2326 | struct packet_type *, | ||
| 2327 | struct net_device *); | ||
| 2293 | bool (*id_match)(struct packet_type *ptype, | 2328 | bool (*id_match)(struct packet_type *ptype, |
| 2294 | struct sock *sk); | 2329 | struct sock *sk); |
| 2295 | void *af_packet_priv; | 2330 | void *af_packet_priv; |
| @@ -2299,8 +2334,8 @@ struct packet_type { | |||
| 2299 | struct offload_callbacks { | 2334 | struct offload_callbacks { |
| 2300 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, | 2335 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, |
| 2301 | netdev_features_t features); | 2336 | netdev_features_t features); |
| 2302 | struct sk_buff **(*gro_receive)(struct sk_buff **head, | 2337 | struct sk_buff *(*gro_receive)(struct list_head *head, |
| 2303 | struct sk_buff *skb); | 2338 | struct sk_buff *skb); |
| 2304 | int (*gro_complete)(struct sk_buff *skb, int nhoff); | 2339 | int (*gro_complete)(struct sk_buff *skb, int nhoff); |
| 2305 | }; | 2340 | }; |
| 2306 | 2341 | ||
| @@ -2537,8 +2572,14 @@ void dev_close(struct net_device *dev); | |||
| 2537 | void dev_close_many(struct list_head *head, bool unlink); | 2572 | void dev_close_many(struct list_head *head, bool unlink); |
| 2538 | void dev_disable_lro(struct net_device *dev); | 2573 | void dev_disable_lro(struct net_device *dev); |
| 2539 | int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb); | 2574 | int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb); |
| 2575 | u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb, | ||
| 2576 | struct net_device *sb_dev, | ||
| 2577 | select_queue_fallback_t fallback); | ||
| 2578 | u16 dev_pick_tx_cpu_id(struct net_device *dev, struct sk_buff *skb, | ||
| 2579 | struct net_device *sb_dev, | ||
| 2580 | select_queue_fallback_t fallback); | ||
| 2540 | int dev_queue_xmit(struct sk_buff *skb); | 2581 | int dev_queue_xmit(struct sk_buff *skb); |
| 2541 | int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv); | 2582 | int dev_queue_xmit_accel(struct sk_buff *skb, struct net_device *sb_dev); |
| 2542 | int dev_direct_xmit(struct sk_buff *skb, u16 queue_id); | 2583 | int dev_direct_xmit(struct sk_buff *skb, u16 queue_id); |
| 2543 | int register_netdevice(struct net_device *dev); | 2584 | int register_netdevice(struct net_device *dev); |
| 2544 | void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); | 2585 | void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); |
| @@ -2568,7 +2609,7 @@ struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); | |||
| 2568 | struct net_device *dev_get_by_napi_id(unsigned int napi_id); | 2609 | struct net_device *dev_get_by_napi_id(unsigned int napi_id); |
| 2569 | int netdev_get_name(struct net *net, char *name, int ifindex); | 2610 | int netdev_get_name(struct net *net, char *name, int ifindex); |
| 2570 | int dev_restart(struct net_device *dev); | 2611 | int dev_restart(struct net_device *dev); |
| 2571 | int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); | 2612 | int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb); |
| 2572 | 2613 | ||
| 2573 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) | 2614 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) |
| 2574 | { | 2615 | { |
| @@ -2784,13 +2825,13 @@ static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb, | |||
| 2784 | } | 2825 | } |
| 2785 | 2826 | ||
| 2786 | #ifdef CONFIG_XFRM_OFFLOAD | 2827 | #ifdef CONFIG_XFRM_OFFLOAD |
| 2787 | static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff **pp, int flush) | 2828 | static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff *pp, int flush) |
| 2788 | { | 2829 | { |
| 2789 | if (PTR_ERR(pp) != -EINPROGRESS) | 2830 | if (PTR_ERR(pp) != -EINPROGRESS) |
| 2790 | NAPI_GRO_CB(skb)->flush |= flush; | 2831 | NAPI_GRO_CB(skb)->flush |= flush; |
| 2791 | } | 2832 | } |
| 2792 | static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb, | 2833 | static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb, |
| 2793 | struct sk_buff **pp, | 2834 | struct sk_buff *pp, |
| 2794 | int flush, | 2835 | int flush, |
| 2795 | struct gro_remcsum *grc) | 2836 | struct gro_remcsum *grc) |
| 2796 | { | 2837 | { |
| @@ -2801,12 +2842,12 @@ static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb, | |||
| 2801 | } | 2842 | } |
| 2802 | } | 2843 | } |
| 2803 | #else | 2844 | #else |
| 2804 | static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff **pp, int flush) | 2845 | static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff *pp, int flush) |
| 2805 | { | 2846 | { |
| 2806 | NAPI_GRO_CB(skb)->flush |= flush; | 2847 | NAPI_GRO_CB(skb)->flush |= flush; |
| 2807 | } | 2848 | } |
| 2808 | static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb, | 2849 | static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb, |
| 2809 | struct sk_buff **pp, | 2850 | struct sk_buff *pp, |
| 2810 | int flush, | 2851 | int flush, |
| 2811 | struct gro_remcsum *grc) | 2852 | struct gro_remcsum *grc) |
| 2812 | { | 2853 | { |
| @@ -3278,6 +3319,92 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | |||
| 3278 | #ifdef CONFIG_XPS | 3319 | #ifdef CONFIG_XPS |
| 3279 | int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, | 3320 | int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, |
| 3280 | u16 index); | 3321 | u16 index); |
| 3322 | int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask, | ||
| 3323 | u16 index, bool is_rxqs_map); | ||
| 3324 | |||
| 3325 | /** | ||
| 3326 | * netif_attr_test_mask - Test a CPU or Rx queue set in a mask | ||
| 3327 | * @j: CPU/Rx queue index | ||
| 3328 | * @mask: bitmask of all cpus/rx queues | ||
| 3329 | * @nr_bits: number of bits in the bitmask | ||
| 3330 | * | ||
| 3331 | * Test if a CPU or Rx queue index is set in a mask of all CPU/Rx queues. | ||
| 3332 | */ | ||
| 3333 | static inline bool netif_attr_test_mask(unsigned long j, | ||
| 3334 | const unsigned long *mask, | ||
| 3335 | unsigned int nr_bits) | ||
| 3336 | { | ||
| 3337 | cpu_max_bits_warn(j, nr_bits); | ||
| 3338 | return test_bit(j, mask); | ||
| 3339 | } | ||
| 3340 | |||
| 3341 | /** | ||
| 3342 | * netif_attr_test_online - Test for online CPU/Rx queue | ||
| 3343 | * @j: CPU/Rx queue index | ||
| 3344 | * @online_mask: bitmask for CPUs/Rx queues that are online | ||
| 3345 | * @nr_bits: number of bits in the bitmask | ||
| 3346 | * | ||
| 3347 | * Returns true if a CPU/Rx queue is online. | ||
| 3348 | */ | ||
| 3349 | static inline bool netif_attr_test_online(unsigned long j, | ||
| 3350 | const unsigned long *online_mask, | ||
| 3351 | unsigned int nr_bits) | ||
| 3352 | { | ||
| 3353 | cpu_max_bits_warn(j, nr_bits); | ||
| 3354 | |||
| 3355 | if (online_mask) | ||
| 3356 | return test_bit(j, online_mask); | ||
| 3357 | |||
| 3358 | return (j < nr_bits); | ||
| 3359 | } | ||
| 3360 | |||
| 3361 | /** | ||
| 3362 | * netif_attrmask_next - get the next CPU/Rx queue in a cpu/Rx queues mask | ||
| 3363 | * @n: CPU/Rx queue index | ||
| 3364 | * @srcp: the cpumask/Rx queue mask pointer | ||
| 3365 | * @nr_bits: number of bits in the bitmask | ||
| 3366 | * | ||
| 3367 | * Returns >= nr_bits if no further CPUs/Rx queues set. | ||
| 3368 | */ | ||
| 3369 | static inline unsigned int netif_attrmask_next(int n, const unsigned long *srcp, | ||
| 3370 | unsigned int nr_bits) | ||
| 3371 | { | ||
| 3372 | /* -1 is a legal arg here. */ | ||
| 3373 | if (n != -1) | ||
| 3374 | cpu_max_bits_warn(n, nr_bits); | ||
| 3375 | |||
| 3376 | if (srcp) | ||
| 3377 | return find_next_bit(srcp, nr_bits, n + 1); | ||
| 3378 | |||
| 3379 | return n + 1; | ||
| 3380 | } | ||
| 3381 | |||
| 3382 | /** | ||
| 3383 | * netif_attrmask_next_and - get the next CPU/Rx queue in *src1p & *src2p | ||
| 3384 | * @n: CPU/Rx queue index | ||
| 3385 | * @src1p: the first CPUs/Rx queues mask pointer | ||
| 3386 | * @src2p: the second CPUs/Rx queues mask pointer | ||
| 3387 | * @nr_bits: number of bits in the bitmask | ||
| 3388 | * | ||
| 3389 | * Returns >= nr_bits if no further CPUs/Rx queues set in both. | ||
| 3390 | */ | ||
| 3391 | static inline int netif_attrmask_next_and(int n, const unsigned long *src1p, | ||
| 3392 | const unsigned long *src2p, | ||
| 3393 | unsigned int nr_bits) | ||
| 3394 | { | ||
| 3395 | /* -1 is a legal arg here. */ | ||
| 3396 | if (n != -1) | ||
| 3397 | cpu_max_bits_warn(n, nr_bits); | ||
| 3398 | |||
| 3399 | if (src1p && src2p) | ||
| 3400 | return find_next_and_bit(src1p, src2p, nr_bits, n + 1); | ||
| 3401 | else if (src1p) | ||
| 3402 | return find_next_bit(src1p, nr_bits, n + 1); | ||
| 3403 | else if (src2p) | ||
| 3404 | return find_next_bit(src2p, nr_bits, n + 1); | ||
| 3405 | |||
| 3406 | return n + 1; | ||
| 3407 | } | ||
| 3281 | #else | 3408 | #else |
| 3282 | static inline int netif_set_xps_queue(struct net_device *dev, | 3409 | static inline int netif_set_xps_queue(struct net_device *dev, |
| 3283 | const struct cpumask *mask, | 3410 | const struct cpumask *mask, |
| @@ -3285,6 +3412,13 @@ static inline int netif_set_xps_queue(struct net_device *dev, | |||
| 3285 | { | 3412 | { |
| 3286 | return 0; | 3413 | return 0; |
| 3287 | } | 3414 | } |
| 3415 | |||
| 3416 | static inline int __netif_set_xps_queue(struct net_device *dev, | ||
| 3417 | const unsigned long *mask, | ||
| 3418 | u16 index, bool is_rxqs_map) | ||
| 3419 | { | ||
| 3420 | return 0; | ||
| 3421 | } | ||
| 3288 | #endif | 3422 | #endif |
| 3289 | 3423 | ||
| 3290 | /** | 3424 | /** |
| @@ -3304,8 +3438,9 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq); | |||
| 3304 | int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq); | 3438 | int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq); |
| 3305 | #else | 3439 | #else |
| 3306 | static inline int netif_set_real_num_rx_queues(struct net_device *dev, | 3440 | static inline int netif_set_real_num_rx_queues(struct net_device *dev, |
| 3307 | unsigned int rxq) | 3441 | unsigned int rxqs) |
| 3308 | { | 3442 | { |
| 3443 | dev->real_num_rx_queues = rxqs; | ||
| 3309 | return 0; | 3444 | return 0; |
| 3310 | } | 3445 | } |
| 3311 | #endif | 3446 | #endif |
| @@ -3384,6 +3519,7 @@ int netif_rx(struct sk_buff *skb); | |||
| 3384 | int netif_rx_ni(struct sk_buff *skb); | 3519 | int netif_rx_ni(struct sk_buff *skb); |
| 3385 | int netif_receive_skb(struct sk_buff *skb); | 3520 | int netif_receive_skb(struct sk_buff *skb); |
| 3386 | int netif_receive_skb_core(struct sk_buff *skb); | 3521 | int netif_receive_skb_core(struct sk_buff *skb); |
| 3522 | void netif_receive_skb_list(struct list_head *head); | ||
| 3387 | gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); | 3523 | gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); |
| 3388 | void napi_gro_flush(struct napi_struct *napi, bool flush_old); | 3524 | void napi_gro_flush(struct napi_struct *napi, bool flush_old); |
| 3389 | struct sk_buff *napi_get_frags(struct napi_struct *napi); | 3525 | struct sk_buff *napi_get_frags(struct napi_struct *napi); |
| @@ -3418,6 +3554,8 @@ int dev_set_alias(struct net_device *, const char *, size_t); | |||
| 3418 | int dev_get_alias(const struct net_device *, char *, size_t); | 3554 | int dev_get_alias(const struct net_device *, char *, size_t); |
| 3419 | int dev_change_net_namespace(struct net_device *, struct net *, const char *); | 3555 | int dev_change_net_namespace(struct net_device *, struct net *, const char *); |
| 3420 | int __dev_set_mtu(struct net_device *, int); | 3556 | int __dev_set_mtu(struct net_device *, int); |
| 3557 | int dev_set_mtu_ext(struct net_device *dev, int mtu, | ||
| 3558 | struct netlink_ext_ack *extack); | ||
| 3421 | int dev_set_mtu(struct net_device *, int); | 3559 | int dev_set_mtu(struct net_device *, int); |
| 3422 | int dev_change_tx_queue_len(struct net_device *, unsigned long); | 3560 | int dev_change_tx_queue_len(struct net_device *, unsigned long); |
| 3423 | void dev_set_group(struct net_device *, int); | 3561 | void dev_set_group(struct net_device *, int); |
| @@ -3435,8 +3573,9 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
| 3435 | typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf); | 3573 | typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf); |
| 3436 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, | 3574 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, |
| 3437 | int fd, u32 flags); | 3575 | int fd, u32 flags); |
| 3438 | void __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op, | 3576 | u32 __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op, |
| 3439 | struct netdev_bpf *xdp); | 3577 | enum bpf_netdev_command cmd); |
| 3578 | int xdp_umem_query(struct net_device *dev, u16 queue_id); | ||
| 3440 | 3579 | ||
| 3441 | int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); | 3580 | int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); |
| 3442 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); | 3581 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index dd2052f0efb7..07efffd0c759 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
| @@ -288,6 +288,24 @@ NF_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, struct | |||
| 288 | return ret; | 288 | return ret; |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | static inline void | ||
| 292 | NF_HOOK_LIST(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, | ||
| 293 | struct list_head *head, struct net_device *in, struct net_device *out, | ||
| 294 | int (*okfn)(struct net *, struct sock *, struct sk_buff *)) | ||
| 295 | { | ||
| 296 | struct sk_buff *skb, *next; | ||
| 297 | struct list_head sublist; | ||
| 298 | |||
| 299 | INIT_LIST_HEAD(&sublist); | ||
| 300 | list_for_each_entry_safe(skb, next, head, list) { | ||
| 301 | list_del(&skb->list); | ||
| 302 | if (nf_hook(pf, hook, net, sk, skb, in, out, okfn) == 1) | ||
| 303 | list_add_tail(&skb->list, &sublist); | ||
| 304 | } | ||
| 305 | /* Put passed packets back on main list */ | ||
| 306 | list_splice(&sublist, head); | ||
| 307 | } | ||
| 308 | |||
| 291 | /* Call setsockopt() */ | 309 | /* Call setsockopt() */ |
| 292 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, | 310 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
| 293 | unsigned int len); | 311 | unsigned int len); |
| @@ -369,6 +387,14 @@ NF_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, | |||
| 369 | return okfn(net, sk, skb); | 387 | return okfn(net, sk, skb); |
| 370 | } | 388 | } |
| 371 | 389 | ||
| 390 | static inline void | ||
| 391 | NF_HOOK_LIST(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, | ||
| 392 | struct list_head *head, struct net_device *in, struct net_device *out, | ||
| 393 | int (*okfn)(struct net *, struct sock *, struct sk_buff *)) | ||
| 394 | { | ||
| 395 | /* nothing to do */ | ||
| 396 | } | ||
| 397 | |||
| 372 | static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, | 398 | static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, |
| 373 | struct sock *sk, struct sk_buff *skb, | 399 | struct sock *sk, struct sk_buff *skb, |
| 374 | struct net_device *indev, struct net_device *outdev, | 400 | struct net_device *indev, struct net_device *outdev, |
| @@ -388,8 +414,17 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) | |||
| 388 | 414 | ||
| 389 | extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu; | 415 | extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu; |
| 390 | void nf_ct_attach(struct sk_buff *, const struct sk_buff *); | 416 | void nf_ct_attach(struct sk_buff *, const struct sk_buff *); |
| 417 | struct nf_conntrack_tuple; | ||
| 418 | bool nf_ct_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple, | ||
| 419 | const struct sk_buff *skb); | ||
| 391 | #else | 420 | #else |
| 392 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} | 421 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} |
| 422 | struct nf_conntrack_tuple; | ||
| 423 | static inline bool nf_ct_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple, | ||
| 424 | const struct sk_buff *skb) | ||
| 425 | { | ||
| 426 | return false; | ||
| 427 | } | ||
| 393 | #endif | 428 | #endif |
| 394 | 429 | ||
| 395 | struct nf_conn; | 430 | struct nf_conn; |
| @@ -398,6 +433,8 @@ enum ip_conntrack_info; | |||
| 398 | struct nf_ct_hook { | 433 | struct nf_ct_hook { |
| 399 | int (*update)(struct net *net, struct sk_buff *skb); | 434 | int (*update)(struct net *net, struct sk_buff *skb); |
| 400 | void (*destroy)(struct nf_conntrack *); | 435 | void (*destroy)(struct nf_conntrack *); |
| 436 | bool (*get_tuple_skb)(struct nf_conntrack_tuple *, | ||
| 437 | const struct sk_buff *); | ||
| 401 | }; | 438 | }; |
| 402 | extern struct nf_ct_hook __rcu *nf_ct_hook; | 439 | extern struct nf_ct_hook __rcu *nf_ct_hook; |
| 403 | 440 | ||
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 3ecc3050be0e..4a520d3304a2 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
| @@ -29,6 +29,7 @@ struct nfnetlink_subsystem { | |||
| 29 | __u8 subsys_id; /* nfnetlink subsystem ID */ | 29 | __u8 subsys_id; /* nfnetlink subsystem ID */ |
| 30 | __u8 cb_count; /* number of callbacks */ | 30 | __u8 cb_count; /* number of callbacks */ |
| 31 | const struct nfnl_callback *cb; /* callback for individual types */ | 31 | const struct nfnl_callback *cb; /* callback for individual types */ |
| 32 | struct module *owner; | ||
| 32 | int (*commit)(struct net *net, struct sk_buff *skb); | 33 | int (*commit)(struct net *net, struct sk_buff *skb); |
| 33 | int (*abort)(struct net *net, struct sk_buff *skb); | 34 | int (*abort)(struct net *net, struct sk_buff *skb); |
| 34 | void (*cleanup)(struct net *net); | 35 | void (*cleanup)(struct net *net); |
diff --git a/include/linux/netfilter/nf_osf.h b/include/linux/netfilter/nfnetlink_osf.h index 0e114c492fb8..ecf7dab81e9e 100644 --- a/include/linux/netfilter/nf_osf.h +++ b/include/linux/netfilter/nfnetlink_osf.h | |||
| @@ -1,16 +1,8 @@ | |||
| 1 | #include <uapi/linux/netfilter/nf_osf.h> | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef _NFOSF_H | ||
| 3 | #define _NFOSF_H | ||
| 2 | 4 | ||
| 3 | /* Initial window size option state machine: multiple of mss, mtu or | 5 | #include <uapi/linux/netfilter/nfnetlink_osf.h> |
| 4 | * plain numeric value. Can also be made as plain numeric value which | ||
| 5 | * is not a multiple of specified value. | ||
| 6 | */ | ||
| 7 | enum nf_osf_window_size_options { | ||
| 8 | OSF_WSS_PLAIN = 0, | ||
| 9 | OSF_WSS_MSS, | ||
| 10 | OSF_WSS_MTU, | ||
| 11 | OSF_WSS_MODULO, | ||
| 12 | OSF_WSS_MAX, | ||
| 13 | }; | ||
| 14 | 6 | ||
| 15 | enum osf_fmatch_states { | 7 | enum osf_fmatch_states { |
| 16 | /* Packet does not match the fingerprint */ | 8 | /* Packet does not match the fingerprint */ |
| @@ -21,6 +13,8 @@ enum osf_fmatch_states { | |||
| 21 | FMATCH_OPT_WRONG, | 13 | FMATCH_OPT_WRONG, |
| 22 | }; | 14 | }; |
| 23 | 15 | ||
| 16 | extern struct list_head nf_osf_fingers[2]; | ||
| 17 | |||
| 24 | struct nf_osf_finger { | 18 | struct nf_osf_finger { |
| 25 | struct rcu_head rcu_head; | 19 | struct rcu_head rcu_head; |
| 26 | struct list_head finger_entry; | 20 | struct list_head finger_entry; |
| @@ -31,3 +25,8 @@ bool nf_osf_match(const struct sk_buff *skb, u_int8_t family, | |||
| 31 | int hooknum, struct net_device *in, struct net_device *out, | 25 | int hooknum, struct net_device *in, struct net_device *out, |
| 32 | const struct nf_osf_info *info, struct net *net, | 26 | const struct nf_osf_info *info, struct net *net, |
| 33 | const struct list_head *nf_osf_fingers); | 27 | const struct list_head *nf_osf_fingers); |
| 28 | |||
| 29 | const char *nf_osf_find(const struct sk_buff *skb, | ||
| 30 | const struct list_head *nf_osf_fingers); | ||
| 31 | |||
| 32 | #endif /* _NFOSF_H */ | ||
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h index b671fdfd212b..fa0686500970 100644 --- a/include/linux/netfilter_bridge.h +++ b/include/linux/netfilter_bridge.h | |||
| @@ -5,17 +5,6 @@ | |||
| 5 | #include <uapi/linux/netfilter_bridge.h> | 5 | #include <uapi/linux/netfilter_bridge.h> |
| 6 | #include <linux/skbuff.h> | 6 | #include <linux/skbuff.h> |
| 7 | 7 | ||
| 8 | enum nf_br_hook_priorities { | ||
| 9 | NF_BR_PRI_FIRST = INT_MIN, | ||
| 10 | NF_BR_PRI_NAT_DST_BRIDGED = -300, | ||
| 11 | NF_BR_PRI_FILTER_BRIDGED = -200, | ||
| 12 | NF_BR_PRI_BRNF = 0, | ||
| 13 | NF_BR_PRI_NAT_DST_OTHER = 100, | ||
| 14 | NF_BR_PRI_FILTER_OTHER = 200, | ||
| 15 | NF_BR_PRI_NAT_SRC = 300, | ||
| 16 | NF_BR_PRI_LAST = INT_MAX, | ||
| 17 | }; | ||
| 18 | |||
| 19 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) | 8 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 20 | 9 | ||
| 21 | int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb); | 10 | int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb); |
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index b31dabfdb453..95ab5cc64422 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h | |||
| @@ -23,9 +23,6 @@ struct nf_queue_entry; | |||
| 23 | #ifdef CONFIG_INET | 23 | #ifdef CONFIG_INET |
| 24 | __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, | 24 | __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, |
| 25 | unsigned int dataoff, u_int8_t protocol); | 25 | unsigned int dataoff, u_int8_t protocol); |
| 26 | __sum16 nf_ip_checksum_partial(struct sk_buff *skb, unsigned int hook, | ||
| 27 | unsigned int dataoff, unsigned int len, | ||
| 28 | u_int8_t protocol); | ||
| 29 | int nf_ip_route(struct net *net, struct dst_entry **dst, struct flowi *fl, | 26 | int nf_ip_route(struct net *net, struct dst_entry **dst, struct flowi *fl, |
| 30 | bool strict); | 27 | bool strict); |
| 31 | int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry); | 28 | int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry); |
| @@ -35,14 +32,6 @@ static inline __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, | |||
| 35 | { | 32 | { |
| 36 | return 0; | 33 | return 0; |
| 37 | } | 34 | } |
| 38 | static inline __sum16 nf_ip_checksum_partial(struct sk_buff *skb, | ||
| 39 | unsigned int hook, | ||
| 40 | unsigned int dataoff, | ||
| 41 | unsigned int len, | ||
| 42 | u_int8_t protocol) | ||
| 43 | { | ||
| 44 | return 0; | ||
| 45 | } | ||
| 46 | static inline int nf_ip_route(struct net *net, struct dst_entry **dst, | 35 | static inline int nf_ip_route(struct net *net, struct dst_entry **dst, |
| 47 | struct flowi *fl, bool strict) | 36 | struct flowi *fl, bool strict) |
| 48 | { | 37 | { |
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index 288c597e75b3..c0dc4dd78887 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
| @@ -30,11 +30,6 @@ struct nf_ipv6_ops { | |||
| 30 | void (*route_input)(struct sk_buff *skb); | 30 | void (*route_input)(struct sk_buff *skb); |
| 31 | int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, | 31 | int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, |
| 32 | int (*output)(struct net *, struct sock *, struct sk_buff *)); | 32 | int (*output)(struct net *, struct sock *, struct sk_buff *)); |
| 33 | __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, | ||
| 34 | unsigned int dataoff, u_int8_t protocol); | ||
| 35 | __sum16 (*checksum_partial)(struct sk_buff *skb, unsigned int hook, | ||
| 36 | unsigned int dataoff, unsigned int len, | ||
| 37 | u_int8_t protocol); | ||
| 38 | int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl, | 33 | int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl, |
| 39 | bool strict); | 34 | bool strict); |
| 40 | int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry); | 35 | int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry); |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index f3075d6c7e82..71f121b66ca8 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -170,7 +170,6 @@ netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
| 170 | struct netlink_callback { | 170 | struct netlink_callback { |
| 171 | struct sk_buff *skb; | 171 | struct sk_buff *skb; |
| 172 | const struct nlmsghdr *nlh; | 172 | const struct nlmsghdr *nlh; |
| 173 | int (*start)(struct netlink_callback *); | ||
| 174 | int (*dump)(struct sk_buff * skb, | 173 | int (*dump)(struct sk_buff * skb, |
| 175 | struct netlink_callback *cb); | 174 | struct netlink_callback *cb); |
| 176 | int (*done)(struct netlink_callback *cb); | 175 | int (*done)(struct netlink_callback *cb); |
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index b8d868d23e79..08f9247e9827 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
| @@ -45,12 +45,18 @@ extern void touch_softlockup_watchdog(void); | |||
| 45 | extern void touch_softlockup_watchdog_sync(void); | 45 | extern void touch_softlockup_watchdog_sync(void); |
| 46 | extern void touch_all_softlockup_watchdogs(void); | 46 | extern void touch_all_softlockup_watchdogs(void); |
| 47 | extern unsigned int softlockup_panic; | 47 | extern unsigned int softlockup_panic; |
| 48 | #else | 48 | |
| 49 | extern int lockup_detector_online_cpu(unsigned int cpu); | ||
| 50 | extern int lockup_detector_offline_cpu(unsigned int cpu); | ||
| 51 | #else /* CONFIG_SOFTLOCKUP_DETECTOR */ | ||
| 49 | static inline void touch_softlockup_watchdog_sched(void) { } | 52 | static inline void touch_softlockup_watchdog_sched(void) { } |
| 50 | static inline void touch_softlockup_watchdog(void) { } | 53 | static inline void touch_softlockup_watchdog(void) { } |
| 51 | static inline void touch_softlockup_watchdog_sync(void) { } | 54 | static inline void touch_softlockup_watchdog_sync(void) { } |
| 52 | static inline void touch_all_softlockup_watchdogs(void) { } | 55 | static inline void touch_all_softlockup_watchdogs(void) { } |
| 53 | #endif | 56 | |
| 57 | #define lockup_detector_online_cpu NULL | ||
| 58 | #define lockup_detector_offline_cpu NULL | ||
| 59 | #endif /* CONFIG_SOFTLOCKUP_DETECTOR */ | ||
| 54 | 60 | ||
| 55 | #ifdef CONFIG_DETECT_HUNG_TASK | 61 | #ifdef CONFIG_DETECT_HUNG_TASK |
| 56 | void reset_hung_task_detector(void); | 62 | void reset_hung_task_detector(void); |
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 2950ce957656..68e91ef5494c 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
| @@ -242,7 +242,12 @@ struct nvme_id_ctrl { | |||
| 242 | __le32 sanicap; | 242 | __le32 sanicap; |
| 243 | __le32 hmminds; | 243 | __le32 hmminds; |
| 244 | __le16 hmmaxd; | 244 | __le16 hmmaxd; |
| 245 | __u8 rsvd338[174]; | 245 | __u8 rsvd338[4]; |
| 246 | __u8 anatt; | ||
| 247 | __u8 anacap; | ||
| 248 | __le32 anagrpmax; | ||
| 249 | __le32 nanagrpid; | ||
| 250 | __u8 rsvd352[160]; | ||
| 246 | __u8 sqes; | 251 | __u8 sqes; |
| 247 | __u8 cqes; | 252 | __u8 cqes; |
| 248 | __le16 maxcmd; | 253 | __le16 maxcmd; |
| @@ -254,11 +259,12 @@ struct nvme_id_ctrl { | |||
| 254 | __le16 awun; | 259 | __le16 awun; |
| 255 | __le16 awupf; | 260 | __le16 awupf; |
| 256 | __u8 nvscc; | 261 | __u8 nvscc; |
| 257 | __u8 rsvd531; | 262 | __u8 nwpc; |
| 258 | __le16 acwu; | 263 | __le16 acwu; |
| 259 | __u8 rsvd534[2]; | 264 | __u8 rsvd534[2]; |
| 260 | __le32 sgls; | 265 | __le32 sgls; |
| 261 | __u8 rsvd540[228]; | 266 | __le32 mnan; |
| 267 | __u8 rsvd544[224]; | ||
| 262 | char subnqn[256]; | 268 | char subnqn[256]; |
| 263 | __u8 rsvd1024[768]; | 269 | __u8 rsvd1024[768]; |
| 264 | __le32 ioccsz; | 270 | __le32 ioccsz; |
| @@ -312,7 +318,11 @@ struct nvme_id_ns { | |||
| 312 | __le16 nabspf; | 318 | __le16 nabspf; |
| 313 | __le16 noiob; | 319 | __le16 noiob; |
| 314 | __u8 nvmcap[16]; | 320 | __u8 nvmcap[16]; |
| 315 | __u8 rsvd64[40]; | 321 | __u8 rsvd64[28]; |
| 322 | __le32 anagrpid; | ||
| 323 | __u8 rsvd96[3]; | ||
| 324 | __u8 nsattr; | ||
| 325 | __u8 rsvd100[4]; | ||
| 316 | __u8 nguid[16]; | 326 | __u8 nguid[16]; |
| 317 | __u8 eui64[8]; | 327 | __u8 eui64[8]; |
| 318 | struct nvme_lbaf lbaf[16]; | 328 | struct nvme_lbaf lbaf[16]; |
| @@ -425,6 +435,32 @@ struct nvme_effects_log { | |||
| 425 | __u8 resv[2048]; | 435 | __u8 resv[2048]; |
| 426 | }; | 436 | }; |
| 427 | 437 | ||
| 438 | enum nvme_ana_state { | ||
| 439 | NVME_ANA_OPTIMIZED = 0x01, | ||
| 440 | NVME_ANA_NONOPTIMIZED = 0x02, | ||
| 441 | NVME_ANA_INACCESSIBLE = 0x03, | ||
| 442 | NVME_ANA_PERSISTENT_LOSS = 0x04, | ||
| 443 | NVME_ANA_CHANGE = 0x0f, | ||
| 444 | }; | ||
| 445 | |||
| 446 | struct nvme_ana_group_desc { | ||
| 447 | __le32 grpid; | ||
| 448 | __le32 nnsids; | ||
| 449 | __le64 chgcnt; | ||
| 450 | __u8 state; | ||
| 451 | __u8 rsvd17[15]; | ||
| 452 | __le32 nsids[]; | ||
| 453 | }; | ||
| 454 | |||
| 455 | /* flag for the log specific field of the ANA log */ | ||
| 456 | #define NVME_ANA_LOG_RGO (1 << 0) | ||
| 457 | |||
| 458 | struct nvme_ana_rsp_hdr { | ||
| 459 | __le64 chgcnt; | ||
| 460 | __le16 ngrps; | ||
| 461 | __le16 rsvd10[3]; | ||
| 462 | }; | ||
| 463 | |||
| 428 | enum { | 464 | enum { |
| 429 | NVME_SMART_CRIT_SPARE = 1 << 0, | 465 | NVME_SMART_CRIT_SPARE = 1 << 0, |
| 430 | NVME_SMART_CRIT_TEMPERATURE = 1 << 1, | 466 | NVME_SMART_CRIT_TEMPERATURE = 1 << 1, |
| @@ -444,11 +480,13 @@ enum { | |||
| 444 | enum { | 480 | enum { |
| 445 | NVME_AER_NOTICE_NS_CHANGED = 0x00, | 481 | NVME_AER_NOTICE_NS_CHANGED = 0x00, |
| 446 | NVME_AER_NOTICE_FW_ACT_STARTING = 0x01, | 482 | NVME_AER_NOTICE_FW_ACT_STARTING = 0x01, |
| 483 | NVME_AER_NOTICE_ANA = 0x03, | ||
| 447 | }; | 484 | }; |
| 448 | 485 | ||
| 449 | enum { | 486 | enum { |
| 450 | NVME_AEN_CFG_NS_ATTR = 1 << 8, | 487 | NVME_AEN_CFG_NS_ATTR = 1 << 8, |
| 451 | NVME_AEN_CFG_FW_ACT = 1 << 9, | 488 | NVME_AEN_CFG_FW_ACT = 1 << 9, |
| 489 | NVME_AEN_CFG_ANA_CHANGE = 1 << 11, | ||
| 452 | }; | 490 | }; |
| 453 | 491 | ||
| 454 | struct nvme_lba_range_type { | 492 | struct nvme_lba_range_type { |
| @@ -749,15 +787,22 @@ enum { | |||
| 749 | NVME_FEAT_HOST_MEM_BUF = 0x0d, | 787 | NVME_FEAT_HOST_MEM_BUF = 0x0d, |
| 750 | NVME_FEAT_TIMESTAMP = 0x0e, | 788 | NVME_FEAT_TIMESTAMP = 0x0e, |
| 751 | NVME_FEAT_KATO = 0x0f, | 789 | NVME_FEAT_KATO = 0x0f, |
| 790 | NVME_FEAT_HCTM = 0x10, | ||
| 791 | NVME_FEAT_NOPSC = 0x11, | ||
| 792 | NVME_FEAT_RRL = 0x12, | ||
| 793 | NVME_FEAT_PLM_CONFIG = 0x13, | ||
| 794 | NVME_FEAT_PLM_WINDOW = 0x14, | ||
| 752 | NVME_FEAT_SW_PROGRESS = 0x80, | 795 | NVME_FEAT_SW_PROGRESS = 0x80, |
| 753 | NVME_FEAT_HOST_ID = 0x81, | 796 | NVME_FEAT_HOST_ID = 0x81, |
| 754 | NVME_FEAT_RESV_MASK = 0x82, | 797 | NVME_FEAT_RESV_MASK = 0x82, |
| 755 | NVME_FEAT_RESV_PERSIST = 0x83, | 798 | NVME_FEAT_RESV_PERSIST = 0x83, |
| 799 | NVME_FEAT_WRITE_PROTECT = 0x84, | ||
| 756 | NVME_LOG_ERROR = 0x01, | 800 | NVME_LOG_ERROR = 0x01, |
| 757 | NVME_LOG_SMART = 0x02, | 801 | NVME_LOG_SMART = 0x02, |
| 758 | NVME_LOG_FW_SLOT = 0x03, | 802 | NVME_LOG_FW_SLOT = 0x03, |
| 759 | NVME_LOG_CHANGED_NS = 0x04, | 803 | NVME_LOG_CHANGED_NS = 0x04, |
| 760 | NVME_LOG_CMD_EFFECTS = 0x05, | 804 | NVME_LOG_CMD_EFFECTS = 0x05, |
| 805 | NVME_LOG_ANA = 0x0c, | ||
| 761 | NVME_LOG_DISC = 0x70, | 806 | NVME_LOG_DISC = 0x70, |
| 762 | NVME_LOG_RESERVATION = 0x80, | 807 | NVME_LOG_RESERVATION = 0x80, |
| 763 | NVME_FWACT_REPL = (0 << 3), | 808 | NVME_FWACT_REPL = (0 << 3), |
| @@ -765,6 +810,14 @@ enum { | |||
| 765 | NVME_FWACT_ACTV = (2 << 3), | 810 | NVME_FWACT_ACTV = (2 << 3), |
| 766 | }; | 811 | }; |
| 767 | 812 | ||
| 813 | /* NVMe Namespace Write Protect State */ | ||
| 814 | enum { | ||
| 815 | NVME_NS_NO_WRITE_PROTECT = 0, | ||
| 816 | NVME_NS_WRITE_PROTECT, | ||
| 817 | NVME_NS_WRITE_PROTECT_POWER_CYCLE, | ||
| 818 | NVME_NS_WRITE_PROTECT_PERMANENT, | ||
| 819 | }; | ||
| 820 | |||
| 768 | #define NVME_MAX_CHANGED_NAMESPACES 1024 | 821 | #define NVME_MAX_CHANGED_NAMESPACES 1024 |
| 769 | 822 | ||
| 770 | struct nvme_identify { | 823 | struct nvme_identify { |
| @@ -880,7 +933,7 @@ struct nvme_get_log_page_command { | |||
| 880 | __u64 rsvd2[2]; | 933 | __u64 rsvd2[2]; |
| 881 | union nvme_data_ptr dptr; | 934 | union nvme_data_ptr dptr; |
| 882 | __u8 lid; | 935 | __u8 lid; |
| 883 | __u8 rsvd10; | 936 | __u8 lsp; /* upper 4 bits reserved */ |
| 884 | __le16 numdl; | 937 | __le16 numdl; |
| 885 | __le16 numdu; | 938 | __le16 numdu; |
| 886 | __u16 rsvd11; | 939 | __u16 rsvd11; |
| @@ -1111,6 +1164,8 @@ enum { | |||
| 1111 | NVME_SC_SGL_INVALID_OFFSET = 0x16, | 1164 | NVME_SC_SGL_INVALID_OFFSET = 0x16, |
| 1112 | NVME_SC_SGL_INVALID_SUBTYPE = 0x17, | 1165 | NVME_SC_SGL_INVALID_SUBTYPE = 0x17, |
| 1113 | 1166 | ||
| 1167 | NVME_SC_NS_WRITE_PROTECTED = 0x20, | ||
| 1168 | |||
| 1114 | NVME_SC_LBA_RANGE = 0x80, | 1169 | NVME_SC_LBA_RANGE = 0x80, |
| 1115 | NVME_SC_CAP_EXCEEDED = 0x81, | 1170 | NVME_SC_CAP_EXCEEDED = 0x81, |
| 1116 | NVME_SC_NS_NOT_READY = 0x82, | 1171 | NVME_SC_NS_NOT_READY = 0x82, |
| @@ -1180,6 +1235,13 @@ enum { | |||
| 1180 | NVME_SC_ACCESS_DENIED = 0x286, | 1235 | NVME_SC_ACCESS_DENIED = 0x286, |
| 1181 | NVME_SC_UNWRITTEN_BLOCK = 0x287, | 1236 | NVME_SC_UNWRITTEN_BLOCK = 0x287, |
| 1182 | 1237 | ||
| 1238 | /* | ||
| 1239 | * Path-related Errors: | ||
| 1240 | */ | ||
| 1241 | NVME_SC_ANA_PERSISTENT_LOSS = 0x301, | ||
| 1242 | NVME_SC_ANA_INACCESSIBLE = 0x302, | ||
| 1243 | NVME_SC_ANA_TRANSITION = 0x303, | ||
| 1244 | |||
| 1183 | NVME_SC_DNR = 0x4000, | 1245 | NVME_SC_DNR = 0x4000, |
| 1184 | }; | 1246 | }; |
| 1185 | 1247 | ||
diff --git a/include/linux/omap-mailbox.h b/include/linux/omap-mailbox.h index c726bd833761..6dbcd2da0332 100644 --- a/include/linux/omap-mailbox.h +++ b/include/linux/omap-mailbox.h | |||
| @@ -1,9 +1,6 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 1 | /* | 2 | /* |
| 2 | * omap-mailbox: interprocessor communication module for OMAP | 3 | * omap-mailbox: interprocessor communication module for OMAP |
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License version 2 as | ||
| 6 | * published by the Free Software Foundation. | ||
| 7 | */ | 4 | */ |
| 8 | 5 | ||
| 9 | #ifndef OMAP_MAILBOX_H | 6 | #ifndef OMAP_MAILBOX_H |
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h index e6b240b6196c..379affc63e24 100644 --- a/include/linux/openvswitch.h +++ b/include/linux/openvswitch.h | |||
| @@ -21,4 +21,9 @@ | |||
| 21 | 21 | ||
| 22 | #include <uapi/linux/openvswitch.h> | 22 | #include <uapi/linux/openvswitch.h> |
| 23 | 23 | ||
| 24 | #define OVS_CLONE_ATTR_EXEC 0 /* Specify an u32 value. When nonzero, | ||
| 25 | * actions in clone will not change flow | ||
| 26 | * keys. False otherwise. | ||
| 27 | */ | ||
| 28 | |||
| 24 | #endif /* _LINUX_OPENVSWITCH_H */ | 29 | #endif /* _LINUX_OPENVSWITCH_H */ |
diff --git a/include/linux/pci-dma-compat.h b/include/linux/pci-dma-compat.h index 0dd1a3f7b309..c3f1b44ade29 100644 --- a/include/linux/pci-dma-compat.h +++ b/include/linux/pci-dma-compat.h | |||
| @@ -8,10 +8,10 @@ | |||
| 8 | #include <linux/dma-mapping.h> | 8 | #include <linux/dma-mapping.h> |
| 9 | 9 | ||
| 10 | /* This defines the direction arg to the DMA mapping routines. */ | 10 | /* This defines the direction arg to the DMA mapping routines. */ |
| 11 | #define PCI_DMA_BIDIRECTIONAL 0 | 11 | #define PCI_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL |
| 12 | #define PCI_DMA_TODEVICE 1 | 12 | #define PCI_DMA_TODEVICE DMA_TO_DEVICE |
| 13 | #define PCI_DMA_FROMDEVICE 2 | 13 | #define PCI_DMA_FROMDEVICE DMA_FROM_DEVICE |
| 14 | #define PCI_DMA_NONE 3 | 14 | #define PCI_DMA_NONE DMA_NONE |
| 15 | 15 | ||
| 16 | static inline void * | 16 | static inline void * |
| 17 | pci_alloc_consistent(struct pci_dev *hwdev, size_t size, | 17 | pci_alloc_consistent(struct pci_dev *hwdev, size_t size, |
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index 243eaa5a66ff..37dab8116901 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h | |||
| @@ -17,6 +17,7 @@ enum pci_epc_irq_type { | |||
| 17 | PCI_EPC_IRQ_UNKNOWN, | 17 | PCI_EPC_IRQ_UNKNOWN, |
| 18 | PCI_EPC_IRQ_LEGACY, | 18 | PCI_EPC_IRQ_LEGACY, |
| 19 | PCI_EPC_IRQ_MSI, | 19 | PCI_EPC_IRQ_MSI, |
| 20 | PCI_EPC_IRQ_MSIX, | ||
| 20 | }; | 21 | }; |
| 21 | 22 | ||
| 22 | /** | 23 | /** |
| @@ -30,7 +31,11 @@ enum pci_epc_irq_type { | |||
| 30 | * capability register | 31 | * capability register |
| 31 | * @get_msi: ops to get the number of MSI interrupts allocated by the RC from | 32 | * @get_msi: ops to get the number of MSI interrupts allocated by the RC from |
| 32 | * the MSI capability register | 33 | * the MSI capability register |
| 33 | * @raise_irq: ops to raise a legacy or MSI interrupt | 34 | * @set_msix: ops to set the requested number of MSI-X interrupts in the |
| 35 | * MSI-X capability register | ||
| 36 | * @get_msix: ops to get the number of MSI-X interrupts allocated by the RC | ||
| 37 | * from the MSI-X capability register | ||
| 38 | * @raise_irq: ops to raise a legacy, MSI or MSI-X interrupt | ||
| 34 | * @start: ops to start the PCI link | 39 | * @start: ops to start the PCI link |
| 35 | * @stop: ops to stop the PCI link | 40 | * @stop: ops to stop the PCI link |
| 36 | * @owner: the module owner containing the ops | 41 | * @owner: the module owner containing the ops |
| @@ -48,8 +53,10 @@ struct pci_epc_ops { | |||
| 48 | phys_addr_t addr); | 53 | phys_addr_t addr); |
| 49 | int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts); | 54 | int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts); |
| 50 | int (*get_msi)(struct pci_epc *epc, u8 func_no); | 55 | int (*get_msi)(struct pci_epc *epc, u8 func_no); |
| 56 | int (*set_msix)(struct pci_epc *epc, u8 func_no, u16 interrupts); | ||
| 57 | int (*get_msix)(struct pci_epc *epc, u8 func_no); | ||
| 51 | int (*raise_irq)(struct pci_epc *epc, u8 func_no, | 58 | int (*raise_irq)(struct pci_epc *epc, u8 func_no, |
| 52 | enum pci_epc_irq_type type, u8 interrupt_num); | 59 | enum pci_epc_irq_type type, u16 interrupt_num); |
| 53 | int (*start)(struct pci_epc *epc); | 60 | int (*start)(struct pci_epc *epc); |
| 54 | void (*stop)(struct pci_epc *epc); | 61 | void (*stop)(struct pci_epc *epc); |
| 55 | struct module *owner; | 62 | struct module *owner; |
| @@ -95,6 +102,7 @@ struct pci_epc { | |||
| 95 | 102 | ||
| 96 | #define EPC_FEATURE_NO_LINKUP_NOTIFIER BIT(0) | 103 | #define EPC_FEATURE_NO_LINKUP_NOTIFIER BIT(0) |
| 97 | #define EPC_FEATURE_BAR_MASK (BIT(1) | BIT(2) | BIT(3)) | 104 | #define EPC_FEATURE_BAR_MASK (BIT(1) | BIT(2) | BIT(3)) |
| 105 | #define EPC_FEATURE_MSIX_AVAILABLE BIT(4) | ||
| 98 | #define EPC_FEATURE_SET_BAR(features, bar) \ | 106 | #define EPC_FEATURE_SET_BAR(features, bar) \ |
| 99 | (features |= (EPC_FEATURE_BAR_MASK & (bar << 1))) | 107 | (features |= (EPC_FEATURE_BAR_MASK & (bar << 1))) |
| 100 | #define EPC_FEATURE_GET_BAR(features) \ | 108 | #define EPC_FEATURE_GET_BAR(features) \ |
| @@ -144,8 +152,10 @@ void pci_epc_unmap_addr(struct pci_epc *epc, u8 func_no, | |||
| 144 | phys_addr_t phys_addr); | 152 | phys_addr_t phys_addr); |
| 145 | int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts); | 153 | int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts); |
| 146 | int pci_epc_get_msi(struct pci_epc *epc, u8 func_no); | 154 | int pci_epc_get_msi(struct pci_epc *epc, u8 func_no); |
| 155 | int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts); | ||
| 156 | int pci_epc_get_msix(struct pci_epc *epc, u8 func_no); | ||
| 147 | int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, | 157 | int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, |
| 148 | enum pci_epc_irq_type type, u8 interrupt_num); | 158 | enum pci_epc_irq_type type, u16 interrupt_num); |
| 149 | int pci_epc_start(struct pci_epc *epc); | 159 | int pci_epc_start(struct pci_epc *epc); |
| 150 | void pci_epc_stop(struct pci_epc *epc); | 160 | void pci_epc_stop(struct pci_epc *epc); |
| 151 | struct pci_epc *pci_epc_get(const char *epc_name); | 161 | struct pci_epc *pci_epc_get(const char *epc_name); |
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index 4e7764935fa8..ec02f58758c8 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h | |||
| @@ -119,6 +119,7 @@ struct pci_epf { | |||
| 119 | struct pci_epf_header *header; | 119 | struct pci_epf_header *header; |
| 120 | struct pci_epf_bar bar[6]; | 120 | struct pci_epf_bar bar[6]; |
| 121 | u8 msi_interrupts; | 121 | u8 msi_interrupts; |
| 122 | u16 msix_interrupts; | ||
| 122 | u8 func_no; | 123 | u8 func_no; |
| 123 | 124 | ||
| 124 | struct pci_epc *epc; | 125 | struct pci_epc *epc; |
diff --git a/include/linux/pci.h b/include/linux/pci.h index c133ccfa002e..9b87f1936906 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -261,6 +261,9 @@ enum pci_bus_speed { | |||
| 261 | PCI_SPEED_UNKNOWN = 0xff, | 261 | PCI_SPEED_UNKNOWN = 0xff, |
| 262 | }; | 262 | }; |
| 263 | 263 | ||
| 264 | enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev); | ||
| 265 | enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev); | ||
| 266 | |||
| 264 | struct pci_cap_saved_data { | 267 | struct pci_cap_saved_data { |
| 265 | u16 cap_nr; | 268 | u16 cap_nr; |
| 266 | bool cap_extended; | 269 | bool cap_extended; |
| @@ -299,6 +302,7 @@ struct pci_dev { | |||
| 299 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ | 302 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ |
| 300 | #ifdef CONFIG_PCIEAER | 303 | #ifdef CONFIG_PCIEAER |
| 301 | u16 aer_cap; /* AER capability offset */ | 304 | u16 aer_cap; /* AER capability offset */ |
| 305 | struct aer_stats *aer_stats; /* AER stats for this device */ | ||
| 302 | #endif | 306 | #endif |
| 303 | u8 pcie_cap; /* PCIe capability offset */ | 307 | u8 pcie_cap; /* PCIe capability offset */ |
| 304 | u8 msi_cap; /* MSI capability offset */ | 308 | u8 msi_cap; /* MSI capability offset */ |
| @@ -350,6 +354,7 @@ struct pci_dev { | |||
| 350 | unsigned int ltr_path:1; /* Latency Tolerance Reporting | 354 | unsigned int ltr_path:1; /* Latency Tolerance Reporting |
| 351 | supported from root to here */ | 355 | supported from root to here */ |
| 352 | #endif | 356 | #endif |
| 357 | unsigned int eetlp_prefix_path:1; /* End-to-End TLP Prefix */ | ||
| 353 | 358 | ||
| 354 | pci_channel_state_t error_state; /* Current connectivity state */ | 359 | pci_channel_state_t error_state; /* Current connectivity state */ |
| 355 | struct device dev; /* Generic device interface */ | 360 | struct device dev; /* Generic device interface */ |
| @@ -387,6 +392,7 @@ struct pci_dev { | |||
| 387 | unsigned int is_virtfn:1; | 392 | unsigned int is_virtfn:1; |
| 388 | unsigned int reset_fn:1; | 393 | unsigned int reset_fn:1; |
| 389 | unsigned int is_hotplug_bridge:1; | 394 | unsigned int is_hotplug_bridge:1; |
| 395 | unsigned int shpc_managed:1; /* SHPC owned by shpchp */ | ||
| 390 | unsigned int is_thunderbolt:1; /* Thunderbolt controller */ | 396 | unsigned int is_thunderbolt:1; /* Thunderbolt controller */ |
| 391 | unsigned int __aer_firmware_first_valid:1; | 397 | unsigned int __aer_firmware_first_valid:1; |
| 392 | unsigned int __aer_firmware_first:1; | 398 | unsigned int __aer_firmware_first:1; |
| @@ -818,6 +824,21 @@ struct pci_driver { | |||
| 818 | .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ | 824 | .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ |
| 819 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 | 825 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 |
| 820 | 826 | ||
| 827 | /** | ||
| 828 | * PCI_DEVICE_DATA - macro used to describe a specific PCI device in very short form | ||
| 829 | * @vend: the vendor name (without PCI_VENDOR_ID_ prefix) | ||
| 830 | * @dev: the device name (without PCI_DEVICE_ID_<vend>_ prefix) | ||
| 831 | * @data: the driver data to be filled | ||
| 832 | * | ||
| 833 | * This macro is used to create a struct pci_device_id that matches a | ||
| 834 | * specific PCI device. The subvendor, and subdevice fields will be set | ||
| 835 | * to PCI_ANY_ID. | ||
| 836 | */ | ||
| 837 | #define PCI_DEVICE_DATA(vend, dev, data) \ | ||
| 838 | .vendor = PCI_VENDOR_ID_##vend, .device = PCI_DEVICE_ID_##vend##_##dev, \ | ||
| 839 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0, \ | ||
| 840 | .driver_data = (kernel_ulong_t)(data) | ||
| 841 | |||
| 821 | enum { | 842 | enum { |
| 822 | PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */ | 843 | PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */ |
| 823 | PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */ | 844 | PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */ |
| @@ -1088,20 +1109,17 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev, | |||
| 1088 | enum pci_bus_speed *speed, | 1109 | enum pci_bus_speed *speed, |
| 1089 | enum pcie_link_width *width); | 1110 | enum pcie_link_width *width); |
| 1090 | void pcie_print_link_status(struct pci_dev *dev); | 1111 | void pcie_print_link_status(struct pci_dev *dev); |
| 1112 | bool pcie_has_flr(struct pci_dev *dev); | ||
| 1091 | int pcie_flr(struct pci_dev *dev); | 1113 | int pcie_flr(struct pci_dev *dev); |
| 1092 | int __pci_reset_function_locked(struct pci_dev *dev); | 1114 | int __pci_reset_function_locked(struct pci_dev *dev); |
| 1093 | int pci_reset_function(struct pci_dev *dev); | 1115 | int pci_reset_function(struct pci_dev *dev); |
| 1094 | int pci_reset_function_locked(struct pci_dev *dev); | 1116 | int pci_reset_function_locked(struct pci_dev *dev); |
| 1095 | int pci_try_reset_function(struct pci_dev *dev); | 1117 | int pci_try_reset_function(struct pci_dev *dev); |
| 1096 | int pci_probe_reset_slot(struct pci_slot *slot); | 1118 | int pci_probe_reset_slot(struct pci_slot *slot); |
| 1097 | int pci_reset_slot(struct pci_slot *slot); | ||
| 1098 | int pci_try_reset_slot(struct pci_slot *slot); | ||
| 1099 | int pci_probe_reset_bus(struct pci_bus *bus); | 1119 | int pci_probe_reset_bus(struct pci_bus *bus); |
| 1100 | int pci_reset_bus(struct pci_bus *bus); | 1120 | int pci_reset_bus(struct pci_dev *dev); |
| 1101 | int pci_try_reset_bus(struct pci_bus *bus); | ||
| 1102 | void pci_reset_secondary_bus(struct pci_dev *dev); | 1121 | void pci_reset_secondary_bus(struct pci_dev *dev); |
| 1103 | void pcibios_reset_secondary_bus(struct pci_dev *dev); | 1122 | void pcibios_reset_secondary_bus(struct pci_dev *dev); |
| 1104 | int pci_reset_bridge_secondary_bus(struct pci_dev *dev); | ||
| 1105 | void pci_update_resource(struct pci_dev *dev, int resno); | 1123 | void pci_update_resource(struct pci_dev *dev, int resno); |
| 1106 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 1124 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
| 1107 | int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); | 1125 | int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); |
| @@ -1121,7 +1139,6 @@ int pci_enable_rom(struct pci_dev *pdev); | |||
| 1121 | void pci_disable_rom(struct pci_dev *pdev); | 1139 | void pci_disable_rom(struct pci_dev *pdev); |
| 1122 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); | 1140 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
| 1123 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); | 1141 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
| 1124 | size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); | ||
| 1125 | void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); | 1142 | void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); |
| 1126 | 1143 | ||
| 1127 | /* Power management related routines */ | 1144 | /* Power management related routines */ |
| @@ -1469,13 +1486,9 @@ static inline bool pcie_aspm_support_enabled(void) { return false; } | |||
| 1469 | #endif | 1486 | #endif |
| 1470 | 1487 | ||
| 1471 | #ifdef CONFIG_PCIEAER | 1488 | #ifdef CONFIG_PCIEAER |
| 1472 | void pci_no_aer(void); | ||
| 1473 | bool pci_aer_available(void); | 1489 | bool pci_aer_available(void); |
| 1474 | int pci_aer_init(struct pci_dev *dev); | ||
| 1475 | #else | 1490 | #else |
| 1476 | static inline void pci_no_aer(void) { } | ||
| 1477 | static inline bool pci_aer_available(void) { return false; } | 1491 | static inline bool pci_aer_available(void) { return false; } |
| 1478 | static inline int pci_aer_init(struct pci_dev *d) { return -ENODEV; } | ||
| 1479 | #endif | 1492 | #endif |
| 1480 | 1493 | ||
| 1481 | #ifdef CONFIG_PCIE_ECRC | 1494 | #ifdef CONFIG_PCIE_ECRC |
| @@ -1877,20 +1890,9 @@ enum pci_fixup_pass { | |||
| 1877 | 1890 | ||
| 1878 | #ifdef CONFIG_PCI_QUIRKS | 1891 | #ifdef CONFIG_PCI_QUIRKS |
| 1879 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1892 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
| 1880 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); | ||
| 1881 | int pci_dev_specific_enable_acs(struct pci_dev *dev); | ||
| 1882 | #else | 1893 | #else |
| 1883 | static inline void pci_fixup_device(enum pci_fixup_pass pass, | 1894 | static inline void pci_fixup_device(enum pci_fixup_pass pass, |
| 1884 | struct pci_dev *dev) { } | 1895 | struct pci_dev *dev) { } |
| 1885 | static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, | ||
| 1886 | u16 acs_flags) | ||
| 1887 | { | ||
| 1888 | return -ENOTTY; | ||
| 1889 | } | ||
| 1890 | static inline int pci_dev_specific_enable_acs(struct pci_dev *dev) | ||
| 1891 | { | ||
| 1892 | return -ENOTTY; | ||
| 1893 | } | ||
| 1894 | #endif | 1896 | #endif |
| 1895 | 1897 | ||
| 1896 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); | 1898 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index cf5e22103f68..a6d6650a0490 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
| @@ -80,15 +80,12 @@ struct hotplug_slot_info { | |||
| 80 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot | 80 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot |
| 81 | * @info: pointer to the &struct hotplug_slot_info for the initial values for | 81 | * @info: pointer to the &struct hotplug_slot_info for the initial values for |
| 82 | * this slot. | 82 | * this slot. |
| 83 | * @release: called during pci_hp_deregister to free memory allocated in a | ||
| 84 | * hotplug_slot structure. | ||
| 85 | * @private: used by the hotplug pci controller driver to store whatever it | 83 | * @private: used by the hotplug pci controller driver to store whatever it |
| 86 | * needs. | 84 | * needs. |
| 87 | */ | 85 | */ |
| 88 | struct hotplug_slot { | 86 | struct hotplug_slot { |
| 89 | struct hotplug_slot_ops *ops; | 87 | struct hotplug_slot_ops *ops; |
| 90 | struct hotplug_slot_info *info; | 88 | struct hotplug_slot_info *info; |
| 91 | void (*release) (struct hotplug_slot *slot); | ||
| 92 | void *private; | 89 | void *private; |
| 93 | 90 | ||
| 94 | /* Variables below this are for use only by the hotplug pci core. */ | 91 | /* Variables below this are for use only by the hotplug pci core. */ |
| @@ -104,13 +101,23 @@ static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) | |||
| 104 | int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr, | 101 | int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr, |
| 105 | const char *name, struct module *owner, | 102 | const char *name, struct module *owner, |
| 106 | const char *mod_name); | 103 | const char *mod_name); |
| 107 | int pci_hp_deregister(struct hotplug_slot *slot); | 104 | int __pci_hp_initialize(struct hotplug_slot *slot, struct pci_bus *bus, int nr, |
| 105 | const char *name, struct module *owner, | ||
| 106 | const char *mod_name); | ||
| 107 | int pci_hp_add(struct hotplug_slot *slot); | ||
| 108 | |||
| 109 | void pci_hp_del(struct hotplug_slot *slot); | ||
| 110 | void pci_hp_destroy(struct hotplug_slot *slot); | ||
| 111 | void pci_hp_deregister(struct hotplug_slot *slot); | ||
| 112 | |||
| 108 | int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot, | 113 | int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot, |
| 109 | struct hotplug_slot_info *info); | 114 | struct hotplug_slot_info *info); |
| 110 | 115 | ||
| 111 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ | 116 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ |
| 112 | #define pci_hp_register(slot, pbus, devnr, name) \ | 117 | #define pci_hp_register(slot, pbus, devnr, name) \ |
| 113 | __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME) | 118 | __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME) |
| 119 | #define pci_hp_initialize(slot, bus, nr, name) \ | ||
| 120 | __pci_hp_initialize(slot, bus, nr, name, THIS_MODULE, KBUILD_MODNAME) | ||
| 114 | 121 | ||
| 115 | /* PCI Setting Record (Type 0) */ | 122 | /* PCI Setting Record (Type 0) */ |
| 116 | struct hpp_type0 { | 123 | struct hpp_type0 { |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 29502238e510..99d366cb0e9f 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -1668,6 +1668,7 @@ | |||
| 1668 | #define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 | 1668 | #define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 |
| 1669 | 1669 | ||
| 1670 | #define PCI_VENDOR_ID_PMC_Sierra 0x11f8 | 1670 | #define PCI_VENDOR_ID_PMC_Sierra 0x11f8 |
| 1671 | #define PCI_VENDOR_ID_MICROSEMI 0x11f8 | ||
| 1671 | 1672 | ||
| 1672 | #define PCI_VENDOR_ID_RP 0x11fe | 1673 | #define PCI_VENDOR_ID_RP 0x11fe |
| 1673 | #define PCI_DEVICE_ID_RP32INTF 0x0001 | 1674 | #define PCI_DEVICE_ID_RP32INTF 0x0001 |
| @@ -2541,6 +2542,7 @@ | |||
| 2541 | #define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200 | 2542 | #define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200 |
| 2542 | #define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240 | 2543 | #define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240 |
| 2543 | #define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000 | 2544 | #define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000 |
| 2545 | #define PCI_DEVICE_ID_NETRONOME_NFP5000 0x5000 | ||
| 2544 | #define PCI_DEVICE_ID_NETRONOME_NFP6000 0x6000 | 2546 | #define PCI_DEVICE_ID_NETRONOME_NFP6000 0x6000 |
| 2545 | #define PCI_DEVICE_ID_NETRONOME_NFP6000_VF 0x6003 | 2547 | #define PCI_DEVICE_ID_NETRONOME_NFP6000_VF 0x6003 |
| 2546 | 2548 | ||
diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h deleted file mode 100644 index 07d78e4653bc..000000000000 --- a/include/linux/percpu_ida.h +++ /dev/null | |||
| @@ -1,83 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __PERCPU_IDA_H__ | ||
| 3 | #define __PERCPU_IDA_H__ | ||
| 4 | |||
| 5 | #include <linux/types.h> | ||
| 6 | #include <linux/bitops.h> | ||
| 7 | #include <linux/init.h> | ||
| 8 | #include <linux/sched.h> | ||
| 9 | #include <linux/spinlock_types.h> | ||
| 10 | #include <linux/wait.h> | ||
| 11 | #include <linux/cpumask.h> | ||
| 12 | |||
| 13 | struct percpu_ida_cpu; | ||
| 14 | |||
| 15 | struct percpu_ida { | ||
| 16 | /* | ||
| 17 | * number of tags available to be allocated, as passed to | ||
| 18 | * percpu_ida_init() | ||
| 19 | */ | ||
| 20 | unsigned nr_tags; | ||
| 21 | unsigned percpu_max_size; | ||
| 22 | unsigned percpu_batch_size; | ||
| 23 | |||
| 24 | struct percpu_ida_cpu __percpu *tag_cpu; | ||
| 25 | |||
| 26 | /* | ||
| 27 | * Bitmap of cpus that (may) have tags on their percpu freelists: | ||
| 28 | * steal_tags() uses this to decide when to steal tags, and which cpus | ||
| 29 | * to try stealing from. | ||
| 30 | * | ||
| 31 | * It's ok for a freelist to be empty when its bit is set - steal_tags() | ||
| 32 | * will just keep looking - but the bitmap _must_ be set whenever a | ||
| 33 | * percpu freelist does have tags. | ||
| 34 | */ | ||
| 35 | cpumask_t cpus_have_tags; | ||
| 36 | |||
| 37 | struct { | ||
| 38 | spinlock_t lock; | ||
| 39 | /* | ||
| 40 | * When we go to steal tags from another cpu (see steal_tags()), | ||
| 41 | * we want to pick a cpu at random. Cycling through them every | ||
| 42 | * time we steal is a bit easier and more or less equivalent: | ||
| 43 | */ | ||
| 44 | unsigned cpu_last_stolen; | ||
| 45 | |||
| 46 | /* For sleeping on allocation failure */ | ||
| 47 | wait_queue_head_t wait; | ||
| 48 | |||
| 49 | /* | ||
| 50 | * Global freelist - it's a stack where nr_free points to the | ||
| 51 | * top | ||
| 52 | */ | ||
| 53 | unsigned nr_free; | ||
| 54 | unsigned *freelist; | ||
| 55 | } ____cacheline_aligned_in_smp; | ||
| 56 | }; | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Number of tags we move between the percpu freelist and the global freelist at | ||
| 60 | * a time | ||
| 61 | */ | ||
| 62 | #define IDA_DEFAULT_PCPU_BATCH_MOVE 32U | ||
| 63 | /* Max size of percpu freelist, */ | ||
| 64 | #define IDA_DEFAULT_PCPU_SIZE ((IDA_DEFAULT_PCPU_BATCH_MOVE * 3) / 2) | ||
| 65 | |||
| 66 | int percpu_ida_alloc(struct percpu_ida *pool, int state); | ||
| 67 | void percpu_ida_free(struct percpu_ida *pool, unsigned tag); | ||
| 68 | |||
| 69 | void percpu_ida_destroy(struct percpu_ida *pool); | ||
| 70 | int __percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags, | ||
| 71 | unsigned long max_size, unsigned long batch_size); | ||
| 72 | static inline int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags) | ||
| 73 | { | ||
| 74 | return __percpu_ida_init(pool, nr_tags, IDA_DEFAULT_PCPU_SIZE, | ||
| 75 | IDA_DEFAULT_PCPU_BATCH_MOVE); | ||
| 76 | } | ||
| 77 | |||
| 78 | typedef int (*percpu_ida_cb)(unsigned, void *); | ||
| 79 | int percpu_ida_for_each_free(struct percpu_ida *pool, percpu_ida_cb fn, | ||
| 80 | void *data); | ||
| 81 | |||
| 82 | unsigned percpu_ida_free_tags(struct percpu_ida *pool, int cpu); | ||
| 83 | #endif /* __PERCPU_IDA_H__ */ | ||
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index ad5444491975..10f92e1d8e7b 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h | |||
| @@ -25,6 +25,12 @@ | |||
| 25 | */ | 25 | */ |
| 26 | #define ARMPMU_MAX_HWEVENTS 32 | 26 | #define ARMPMU_MAX_HWEVENTS 32 |
| 27 | 27 | ||
| 28 | /* | ||
| 29 | * ARM PMU hw_event flags | ||
| 30 | */ | ||
| 31 | /* Event uses a 64bit counter */ | ||
| 32 | #define ARMPMU_EVT_64BIT 1 | ||
| 33 | |||
| 28 | #define HW_OP_UNSUPPORTED 0xFFFF | 34 | #define HW_OP_UNSUPPORTED 0xFFFF |
| 29 | #define C(_x) PERF_COUNT_HW_CACHE_##_x | 35 | #define C(_x) PERF_COUNT_HW_CACHE_##_x |
| 30 | #define CACHE_OP_UNSUPPORTED 0xFFFF | 36 | #define CACHE_OP_UNSUPPORTED 0xFFFF |
| @@ -87,14 +93,13 @@ struct arm_pmu { | |||
| 87 | struct perf_event *event); | 93 | struct perf_event *event); |
| 88 | int (*set_event_filter)(struct hw_perf_event *evt, | 94 | int (*set_event_filter)(struct hw_perf_event *evt, |
| 89 | struct perf_event_attr *attr); | 95 | struct perf_event_attr *attr); |
| 90 | u32 (*read_counter)(struct perf_event *event); | 96 | u64 (*read_counter)(struct perf_event *event); |
| 91 | void (*write_counter)(struct perf_event *event, u32 val); | 97 | void (*write_counter)(struct perf_event *event, u64 val); |
| 92 | void (*start)(struct arm_pmu *); | 98 | void (*start)(struct arm_pmu *); |
| 93 | void (*stop)(struct arm_pmu *); | 99 | void (*stop)(struct arm_pmu *); |
| 94 | void (*reset)(void *); | 100 | void (*reset)(void *); |
| 95 | int (*map_event)(struct perf_event *event); | 101 | int (*map_event)(struct perf_event *event); |
| 96 | int num_events; | 102 | int num_events; |
| 97 | u64 max_period; | ||
| 98 | bool secure_access; /* 32-bit ARM only */ | 103 | bool secure_access; /* 32-bit ARM only */ |
| 99 | #define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40 | 104 | #define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40 |
| 100 | DECLARE_BITMAP(pmceid_bitmap, ARMV8_PMUV3_MAX_COMMON_EVENTS); | 105 | DECLARE_BITMAP(pmceid_bitmap, ARMV8_PMUV3_MAX_COMMON_EVENTS); |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 87f6db437e4a..53c500f0ca79 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -490,7 +490,7 @@ struct perf_addr_filters_head { | |||
| 490 | }; | 490 | }; |
| 491 | 491 | ||
| 492 | /** | 492 | /** |
| 493 | * enum perf_event_state - the states of a event | 493 | * enum perf_event_state - the states of an event: |
| 494 | */ | 494 | */ |
| 495 | enum perf_event_state { | 495 | enum perf_event_state { |
| 496 | PERF_EVENT_STATE_DEAD = -4, | 496 | PERF_EVENT_STATE_DEAD = -4, |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 6cd09098427c..cd6f637cbbfb 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -825,6 +825,16 @@ static inline bool phy_interrupt_is_valid(struct phy_device *phydev) | |||
| 825 | } | 825 | } |
| 826 | 826 | ||
| 827 | /** | 827 | /** |
| 828 | * phy_polling_mode - Convenience function for testing whether polling is | ||
| 829 | * used to detect PHY status changes | ||
| 830 | * @phydev: the phy_device struct | ||
| 831 | */ | ||
| 832 | static inline bool phy_polling_mode(struct phy_device *phydev) | ||
| 833 | { | ||
| 834 | return phydev->irq == PHY_POLL; | ||
| 835 | } | ||
| 836 | |||
| 837 | /** | ||
| 828 | * phy_is_internal - Convenience function for testing if a PHY is internal | 838 | * phy_is_internal - Convenience function for testing if a PHY is internal |
| 829 | * @phydev: the phy_device struct | 839 | * @phydev: the phy_device struct |
| 830 | */ | 840 | */ |
| @@ -942,6 +952,8 @@ void phy_start(struct phy_device *phydev); | |||
| 942 | void phy_stop(struct phy_device *phydev); | 952 | void phy_stop(struct phy_device *phydev); |
| 943 | int phy_start_aneg(struct phy_device *phydev); | 953 | int phy_start_aneg(struct phy_device *phydev); |
| 944 | int phy_aneg_done(struct phy_device *phydev); | 954 | int phy_aneg_done(struct phy_device *phydev); |
| 955 | int phy_speed_down(struct phy_device *phydev, bool sync); | ||
| 956 | int phy_speed_up(struct phy_device *phydev); | ||
| 945 | 957 | ||
| 946 | int phy_stop_interrupts(struct phy_device *phydev); | 958 | int phy_stop_interrupts(struct phy_device *phydev); |
| 947 | int phy_restart_aneg(struct phy_device *phydev); | 959 | int phy_restart_aneg(struct phy_device *phydev); |
diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 50eeae025f1e..021fc6595856 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h | |||
| @@ -234,5 +234,6 @@ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int); | |||
| 234 | #define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode) | 234 | #define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode) |
| 235 | 235 | ||
| 236 | void phylink_set_port_modes(unsigned long *bits); | 236 | void phylink_set_port_modes(unsigned long *bits); |
| 237 | void phylink_helper_basex_speed(struct phylink_link_state *state); | ||
| 237 | 238 | ||
| 238 | #endif | 239 | #endif |
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h index 09eb80f2574a..8dd85d302b90 100644 --- a/include/linux/pinctrl/pinconf.h +++ b/include/linux/pinctrl/pinconf.h | |||
| @@ -28,7 +28,8 @@ struct seq_file; | |||
| 28 | * is not available on this controller this should return -ENOTSUPP | 28 | * is not available on this controller this should return -ENOTSUPP |
| 29 | * and if it is available but disabled it should return -EINVAL | 29 | * and if it is available but disabled it should return -EINVAL |
| 30 | * @pin_config_set: configure an individual pin | 30 | * @pin_config_set: configure an individual pin |
| 31 | * @pin_config_group_get: get configurations for an entire pin group | 31 | * @pin_config_group_get: get configurations for an entire pin group; should |
| 32 | * return -ENOTSUPP and -EINVAL using the same rules as pin_config_get. | ||
| 32 | * @pin_config_group_set: configure all pins in a group | 33 | * @pin_config_group_set: configure all pins in a group |
| 33 | * @pin_config_dbg_parse_modify: optional debugfs to modify a pin configuration | 34 | * @pin_config_dbg_parse_modify: optional debugfs to modify a pin configuration |
| 34 | * @pin_config_dbg_show: optional debugfs display hook that will provide | 35 | * @pin_config_dbg_show: optional debugfs display hook that will provide |
diff --git a/include/linux/platform_data/bt-nokia-h4p.h b/include/linux/platform_data/bt-nokia-h4p.h deleted file mode 100644 index 30d169dfadf3..000000000000 --- a/include/linux/platform_data/bt-nokia-h4p.h +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of Nokia H4P bluetooth driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010 Nokia Corporation. | ||
| 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 | * version 2 as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but | ||
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 13 | * General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| 18 | * 02110-1301 USA | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | |||
| 23 | /** | ||
| 24 | * struct hci_h4p_platform data - hci_h4p Platform data structure | ||
| 25 | */ | ||
| 26 | struct hci_h4p_platform_data { | ||
| 27 | int chip_type; | ||
| 28 | int bt_sysclk; | ||
| 29 | unsigned int bt_wakeup_gpio; | ||
| 30 | unsigned int host_wakeup_gpio; | ||
| 31 | unsigned int reset_gpio; | ||
| 32 | int reset_gpio_shared; | ||
| 33 | unsigned int uart_irq; | ||
| 34 | phys_addr_t uart_base; | ||
| 35 | const char *uart_iclk; | ||
| 36 | const char *uart_fclk; | ||
| 37 | void (*set_pm_limits)(struct device *dev, bool set); | ||
| 38 | }; | ||
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h index 90ae19ca828f..57a5a35e0073 100644 --- a/include/linux/platform_data/gpio-davinci.h +++ b/include/linux/platform_data/gpio-davinci.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <asm-generic/gpio.h> | 22 | #include <asm-generic/gpio.h> |
| 23 | 23 | ||
| 24 | #define MAX_REGS_BANKS 5 | 24 | #define MAX_REGS_BANKS 5 |
| 25 | #define MAX_INT_PER_BANK 32 | ||
| 25 | 26 | ||
| 26 | struct davinci_gpio_platform_data { | 27 | struct davinci_gpio_platform_data { |
| 27 | u32 ngpio; | 28 | u32 ngpio; |
| @@ -41,7 +42,7 @@ struct davinci_gpio_controller { | |||
| 41 | spinlock_t lock; | 42 | spinlock_t lock; |
| 42 | void __iomem *regs[MAX_REGS_BANKS]; | 43 | void __iomem *regs[MAX_REGS_BANKS]; |
| 43 | int gpio_unbanked; | 44 | int gpio_unbanked; |
| 44 | unsigned int base_irq; | 45 | int irqs[MAX_INT_PER_BANK]; |
| 45 | unsigned int base; | 46 | unsigned int base; |
| 46 | }; | 47 | }; |
| 47 | 48 | ||
diff --git a/include/linux/platform_data/jz4740/jz4740_nand.h b/include/linux/platform_data/jz4740/jz4740_nand.h new file mode 100644 index 000000000000..bc571f6d5ced --- /dev/null +++ b/include/linux/platform_data/jz4740/jz4740_nand.h | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de> | ||
| 3 | * JZ4740 SoC NAND controller driver | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License as published by the | ||
| 7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 8 | * option) any later version. | ||
| 9 | * | ||
| 10 | * You should have received a copy of the GNU General Public License along | ||
| 11 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 12 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __JZ4740_NAND_H__ | ||
| 17 | #define __JZ4740_NAND_H__ | ||
| 18 | |||
| 19 | #include <linux/mtd/rawnand.h> | ||
| 20 | #include <linux/mtd/partitions.h> | ||
| 21 | |||
| 22 | #define JZ_NAND_NUM_BANKS 4 | ||
| 23 | |||
| 24 | struct jz_nand_platform_data { | ||
| 25 | int num_partitions; | ||
| 26 | struct mtd_partition *partitions; | ||
| 27 | |||
| 28 | unsigned char banks[JZ_NAND_NUM_BANKS]; | ||
| 29 | |||
| 30 | void (*ident_callback)(struct platform_device *, struct mtd_info *, | ||
| 31 | struct mtd_partition **, int *num_partitions); | ||
| 32 | }; | ||
| 33 | |||
| 34 | #endif | ||
diff --git a/include/linux/platform_data/media/sii9234.h b/include/linux/platform_data/media/sii9234.h deleted file mode 100644 index 6a4a809fe9a3..000000000000 --- a/include/linux/platform_data/media/sii9234.h +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Driver header for SII9234 MHL converter chip. | ||
| 3 | * | ||
| 4 | * Copyright (c) 2011 Samsung Electronics, Co. Ltd | ||
| 5 | * Contact: Tomasz Stanislawski <t.stanislaws@samsung.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef SII9234_H | ||
| 14 | #define SII9234_H | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @gpio_n_reset: GPIO driving nRESET pin | ||
| 18 | */ | ||
| 19 | |||
| 20 | struct sii9234_platform_data { | ||
| 21 | int gpio_n_reset; | ||
| 22 | }; | ||
| 23 | |||
| 24 | #endif /* SII9234_H */ | ||
diff --git a/include/linux/platform_data/mmp_dma.h b/include/linux/platform_data/mmp_dma.h index d1397c8ed94e..6397b9c8149a 100644 --- a/include/linux/platform_data/mmp_dma.h +++ b/include/linux/platform_data/mmp_dma.h | |||
| @@ -12,9 +12,13 @@ | |||
| 12 | #ifndef MMP_DMA_H | 12 | #ifndef MMP_DMA_H |
| 13 | #define MMP_DMA_H | 13 | #define MMP_DMA_H |
| 14 | 14 | ||
| 15 | struct dma_slave_map; | ||
| 16 | |||
| 15 | struct mmp_dma_platdata { | 17 | struct mmp_dma_platdata { |
| 16 | int dma_channels; | 18 | int dma_channels; |
| 17 | int nb_requestors; | 19 | int nb_requestors; |
| 20 | int slave_map_cnt; | ||
| 21 | const struct dma_slave_map *slave_map; | ||
| 18 | }; | 22 | }; |
| 19 | 23 | ||
| 20 | #endif /* MMP_DMA_H */ | 24 | #endif /* MMP_DMA_H */ |
diff --git a/include/linux/platform_data/mtd-orion_nand.h b/include/linux/platform_data/mtd-orion_nand.h index a7ce77c7c1a8..34828eb85982 100644 --- a/include/linux/platform_data/mtd-orion_nand.h +++ b/include/linux/platform_data/mtd-orion_nand.h | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | */ | 12 | */ |
| 13 | struct orion_nand_data { | 13 | struct orion_nand_data { |
| 14 | struct mtd_partition *parts; | 14 | struct mtd_partition *parts; |
| 15 | int (*dev_ready)(struct mtd_info *mtd); | ||
| 16 | u32 nr_parts; | 15 | u32 nr_parts; |
| 17 | u8 ale; /* address line number connected to ALE */ | 16 | u8 ale; /* address line number connected to ALE */ |
| 18 | u8 cle; /* address line number connected to CLE */ | 17 | u8 cle; /* address line number connected to CLE */ |
diff --git a/include/linux/platform_data/txx9/ndfmc.h b/include/linux/platform_data/txx9/ndfmc.h new file mode 100644 index 000000000000..fc172627d54e --- /dev/null +++ b/include/linux/platform_data/txx9/ndfmc.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | * This program is free software; you can redistribute it and/or modify | ||
| 3 | * it under the terms of the GNU General Public License version 2 as | ||
| 4 | * published by the Free Software Foundation. | ||
| 5 | * | ||
| 6 | * (C) Copyright TOSHIBA CORPORATION 2007 | ||
| 7 | */ | ||
| 8 | #ifndef __TXX9_NDFMC_H | ||
| 9 | #define __TXX9_NDFMC_H | ||
| 10 | |||
| 11 | #define NDFMC_PLAT_FLAG_USE_BSPRT 0x01 | ||
| 12 | #define NDFMC_PLAT_FLAG_NO_RSTR 0x02 | ||
| 13 | #define NDFMC_PLAT_FLAG_HOLDADD 0x04 | ||
| 14 | #define NDFMC_PLAT_FLAG_DUMMYWRITE 0x08 | ||
| 15 | |||
| 16 | struct txx9ndfmc_platform_data { | ||
| 17 | unsigned int shift; | ||
| 18 | unsigned int gbus_clock; | ||
| 19 | unsigned int hold; /* hold time in nanosecond */ | ||
| 20 | unsigned int spw; /* strobe pulse width in nanosecond */ | ||
| 21 | unsigned int flags; | ||
| 22 | unsigned char ch_mask; /* available channel bitmask */ | ||
| 23 | unsigned char wp_mask; /* write-protect bitmask */ | ||
| 24 | unsigned char wide_mask; /* 16bit-nand bitmask */ | ||
| 25 | }; | ||
| 26 | |||
| 27 | void txx9_ndfmc_init(unsigned long baseaddr, | ||
| 28 | const struct txx9ndfmc_platform_data *plat_data); | ||
| 29 | |||
| 30 | #endif /* __TXX9_NDFMC_H */ | ||
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index cb8d84090cfb..776c546d581a 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h | |||
| @@ -239,6 +239,8 @@ unsigned int of_genpd_opp_to_performance_state(struct device *dev, | |||
| 239 | int genpd_dev_pm_attach(struct device *dev); | 239 | int genpd_dev_pm_attach(struct device *dev); |
| 240 | struct device *genpd_dev_pm_attach_by_id(struct device *dev, | 240 | struct device *genpd_dev_pm_attach_by_id(struct device *dev, |
| 241 | unsigned int index); | 241 | unsigned int index); |
| 242 | struct device *genpd_dev_pm_attach_by_name(struct device *dev, | ||
| 243 | char *name); | ||
| 242 | #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ | 244 | #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ |
| 243 | static inline int of_genpd_add_provider_simple(struct device_node *np, | 245 | static inline int of_genpd_add_provider_simple(struct device_node *np, |
| 244 | struct generic_pm_domain *genpd) | 246 | struct generic_pm_domain *genpd) |
| @@ -290,6 +292,12 @@ static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev, | |||
| 290 | return NULL; | 292 | return NULL; |
| 291 | } | 293 | } |
| 292 | 294 | ||
| 295 | static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev, | ||
| 296 | char *name) | ||
| 297 | { | ||
| 298 | return NULL; | ||
| 299 | } | ||
| 300 | |||
| 293 | static inline | 301 | static inline |
| 294 | struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) | 302 | struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) |
| 295 | { | 303 | { |
| @@ -301,6 +309,8 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) | |||
| 301 | int dev_pm_domain_attach(struct device *dev, bool power_on); | 309 | int dev_pm_domain_attach(struct device *dev, bool power_on); |
| 302 | struct device *dev_pm_domain_attach_by_id(struct device *dev, | 310 | struct device *dev_pm_domain_attach_by_id(struct device *dev, |
| 303 | unsigned int index); | 311 | unsigned int index); |
| 312 | struct device *dev_pm_domain_attach_by_name(struct device *dev, | ||
| 313 | char *name); | ||
| 304 | void dev_pm_domain_detach(struct device *dev, bool power_off); | 314 | void dev_pm_domain_detach(struct device *dev, bool power_off); |
| 305 | void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); | 315 | void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); |
| 306 | #else | 316 | #else |
| @@ -313,6 +323,11 @@ static inline struct device *dev_pm_domain_attach_by_id(struct device *dev, | |||
| 313 | { | 323 | { |
| 314 | return NULL; | 324 | return NULL; |
| 315 | } | 325 | } |
| 326 | static inline struct device *dev_pm_domain_attach_by_name(struct device *dev, | ||
| 327 | char *name) | ||
| 328 | { | ||
| 329 | return NULL; | ||
| 330 | } | ||
| 316 | static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {} | 331 | static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {} |
| 317 | static inline void dev_pm_domain_set(struct device *dev, | 332 | static inline void dev_pm_domain_set(struct device *dev, |
| 318 | struct dev_pm_domain *pd) {} | 333 | struct dev_pm_domain *pd) {} |
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index c85704fcdbd2..ee7e987ea1b4 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
| @@ -95,8 +95,8 @@ struct k_itimer { | |||
| 95 | clockid_t it_clock; | 95 | clockid_t it_clock; |
| 96 | timer_t it_id; | 96 | timer_t it_id; |
| 97 | int it_active; | 97 | int it_active; |
| 98 | int it_overrun; | 98 | s64 it_overrun; |
| 99 | int it_overrun_last; | 99 | s64 it_overrun_last; |
| 100 | int it_requeue_pending; | 100 | int it_requeue_pending; |
| 101 | int it_sigev_notify; | 101 | int it_sigev_notify; |
| 102 | ktime_t it_interval; | 102 | ktime_t it_interval; |
diff --git a/include/linux/printk.h b/include/linux/printk.h index 6d7e800affd8..cf3eccfe1543 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
| @@ -50,15 +50,15 @@ static inline const char *printk_skip_headers(const char *buffer) | |||
| 50 | /* We show everything that is MORE important than this.. */ | 50 | /* We show everything that is MORE important than this.. */ |
| 51 | #define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ | 51 | #define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ |
| 52 | #define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ | 52 | #define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ |
| 53 | #define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */ | ||
| 54 | #define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ | 53 | #define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ |
| 55 | #define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ | 54 | #define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ |
| 56 | 55 | ||
| 57 | /* | 56 | /* |
| 58 | * Default used to be hard-coded at 7, we're now allowing it to be set from | 57 | * Default used to be hard-coded at 7, quiet used to be hardcoded at 4, |
| 59 | * kernel config. | 58 | * we're now allowing both to be set from kernel config. |
| 60 | */ | 59 | */ |
| 61 | #define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT | 60 | #define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT |
| 61 | #define CONSOLE_LOGLEVEL_QUIET CONFIG_CONSOLE_LOGLEVEL_QUIET | ||
| 62 | 62 | ||
| 63 | extern int console_printk[]; | 63 | extern int console_printk[]; |
| 64 | 64 | ||
| @@ -148,9 +148,13 @@ void early_printk(const char *s, ...) { } | |||
| 148 | #ifdef CONFIG_PRINTK_NMI | 148 | #ifdef CONFIG_PRINTK_NMI |
| 149 | extern void printk_nmi_enter(void); | 149 | extern void printk_nmi_enter(void); |
| 150 | extern void printk_nmi_exit(void); | 150 | extern void printk_nmi_exit(void); |
| 151 | extern void printk_nmi_direct_enter(void); | ||
| 152 | extern void printk_nmi_direct_exit(void); | ||
| 151 | #else | 153 | #else |
| 152 | static inline void printk_nmi_enter(void) { } | 154 | static inline void printk_nmi_enter(void) { } |
| 153 | static inline void printk_nmi_exit(void) { } | 155 | static inline void printk_nmi_exit(void) { } |
| 156 | static inline void printk_nmi_direct_enter(void) { } | ||
| 157 | static inline void printk_nmi_direct_exit(void) { } | ||
| 154 | #endif /* PRINTK_NMI */ | 158 | #endif /* PRINTK_NMI */ |
| 155 | 159 | ||
| 156 | #ifdef CONFIG_PRINTK | 160 | #ifdef CONFIG_PRINTK |
diff --git a/include/linux/pti.h b/include/linux/pti.h index 0174883a935a..1a941efcaa62 100644 --- a/include/linux/pti.h +++ b/include/linux/pti.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <asm/pti.h> | 6 | #include <asm/pti.h> |
| 7 | #else | 7 | #else |
| 8 | static inline void pti_init(void) { } | 8 | static inline void pti_init(void) { } |
| 9 | static inline void pti_finalize(void) { } | ||
| 9 | #endif | 10 | #endif |
| 10 | 11 | ||
| 11 | #endif | 12 | #endif |
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h index 8461b18e4608..13b4244d44c1 100644 --- a/include/linux/pxa2xx_ssp.h +++ b/include/linux/pxa2xx_ssp.h | |||
| @@ -171,6 +171,14 @@ | |||
| 171 | #define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass */ | 171 | #define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass */ |
| 172 | #define SSACD_ACPS(x) ((x) << 4) /* Audio clock PLL select */ | 172 | #define SSACD_ACPS(x) ((x) << 4) /* Audio clock PLL select */ |
| 173 | #define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */ | 173 | #define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */ |
| 174 | #define SSACD_ACDS_1 (0) | ||
| 175 | #define SSACD_ACDS_2 (1) | ||
| 176 | #define SSACD_ACDS_4 (2) | ||
| 177 | #define SSACD_ACDS_8 (3) | ||
| 178 | #define SSACD_ACDS_16 (4) | ||
| 179 | #define SSACD_ACDS_32 (5) | ||
| 180 | #define SSACD_SCDB_4X (0) | ||
| 181 | #define SSACD_SCDB_1X (1) | ||
| 174 | #define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */ | 182 | #define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */ |
| 175 | 183 | ||
| 176 | /* LPSS SSP */ | 184 | /* LPSS SSP */ |
| @@ -212,8 +220,6 @@ struct ssp_device { | |||
| 212 | int type; | 220 | int type; |
| 213 | int use_count; | 221 | int use_count; |
| 214 | int irq; | 222 | int irq; |
| 215 | int drcmr_rx; | ||
| 216 | int drcmr_tx; | ||
| 217 | 223 | ||
| 218 | struct device_node *of_node; | 224 | struct device_node *of_node; |
| 219 | }; | 225 | }; |
diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index b401b962afff..5d65521260b3 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h | |||
| @@ -87,6 +87,10 @@ static inline int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, | |||
| 87 | static inline int | 87 | static inline int |
| 88 | qcom_scm_pas_auth_and_reset(u32 peripheral) { return -ENODEV; } | 88 | qcom_scm_pas_auth_and_reset(u32 peripheral) { return -ENODEV; } |
| 89 | static inline int qcom_scm_pas_shutdown(u32 peripheral) { return -ENODEV; } | 89 | static inline int qcom_scm_pas_shutdown(u32 peripheral) { return -ENODEV; } |
| 90 | static inline int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, | ||
| 91 | unsigned int *src, | ||
| 92 | struct qcom_scm_vmperm *newvm, | ||
| 93 | int dest_cnt) { return -ENODEV; } | ||
| 90 | static inline void qcom_scm_cpu_power_down(u32 flags) {} | 94 | static inline void qcom_scm_cpu_power_down(u32 flags) {} |
| 91 | static inline u32 qcom_scm_get_version(void) { return 0; } | 95 | static inline u32 qcom_scm_get_version(void) { return 0; } |
| 92 | static inline u32 | 96 | static inline u32 |
diff --git a/include/linux/qed/qed_eth_if.h b/include/linux/qed/qed_eth_if.h index 2978fa4add42..a1310482c4ed 100644 --- a/include/linux/qed/qed_eth_if.h +++ b/include/linux/qed/qed_eth_if.h | |||
| @@ -39,6 +39,10 @@ | |||
| 39 | #include <linux/qed/qed_if.h> | 39 | #include <linux/qed/qed_if.h> |
| 40 | #include <linux/qed/qed_iov_if.h> | 40 | #include <linux/qed/qed_iov_if.h> |
| 41 | 41 | ||
| 42 | /* 64 max queues * (1 rx + 4 tx-cos + 1 xdp) */ | ||
| 43 | #define QED_MIN_L2_CONS (2 + NUM_PHYS_TCS_4PORT_K2) | ||
| 44 | #define QED_MAX_L2_CONS (64 * (QED_MIN_L2_CONS)) | ||
| 45 | |||
| 42 | struct qed_queue_start_common_params { | 46 | struct qed_queue_start_common_params { |
| 43 | /* Should always be relative to entity sending this. */ | 47 | /* Should always be relative to entity sending this. */ |
| 44 | u8 vport_id; | 48 | u8 vport_id; |
| @@ -49,6 +53,8 @@ struct qed_queue_start_common_params { | |||
| 49 | 53 | ||
| 50 | struct qed_sb_info *p_sb; | 54 | struct qed_sb_info *p_sb; |
| 51 | u8 sb_idx; | 55 | u8 sb_idx; |
| 56 | |||
| 57 | u8 tc; | ||
| 52 | }; | 58 | }; |
| 53 | 59 | ||
| 54 | struct qed_rxq_start_ret_params { | 60 | struct qed_rxq_start_ret_params { |
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h index b4040023cbfb..8cd34645e892 100644 --- a/include/linux/qed/qed_if.h +++ b/include/linux/qed/qed_if.h | |||
| @@ -759,6 +759,9 @@ struct qed_generic_tlvs { | |||
| 759 | u8 mac[QED_TLV_MAC_COUNT][ETH_ALEN]; | 759 | u8 mac[QED_TLV_MAC_COUNT][ETH_ALEN]; |
| 760 | }; | 760 | }; |
| 761 | 761 | ||
| 762 | #define QED_I2C_DEV_ADDR_A0 0xA0 | ||
| 763 | #define QED_I2C_DEV_ADDR_A2 0xA2 | ||
| 764 | |||
| 762 | #define QED_NVM_SIGNATURE 0x12435687 | 765 | #define QED_NVM_SIGNATURE 0x12435687 |
| 763 | 766 | ||
| 764 | enum qed_nvm_flash_cmd { | 767 | enum qed_nvm_flash_cmd { |
| @@ -1026,6 +1029,18 @@ struct qed_common_ops { | |||
| 1026 | * @param enabled - true iff WoL should be enabled. | 1029 | * @param enabled - true iff WoL should be enabled. |
| 1027 | */ | 1030 | */ |
| 1028 | int (*update_wol) (struct qed_dev *cdev, bool enabled); | 1031 | int (*update_wol) (struct qed_dev *cdev, bool enabled); |
| 1032 | |||
| 1033 | /** | ||
| 1034 | * @brief read_module_eeprom | ||
| 1035 | * | ||
| 1036 | * @param cdev | ||
| 1037 | * @param buf - buffer | ||
| 1038 | * @param dev_addr - PHY device memory region | ||
| 1039 | * @param offset - offset into eeprom contents to be read | ||
| 1040 | * @param len - buffer length, i.e., max bytes to be read | ||
| 1041 | */ | ||
| 1042 | int (*read_module_eeprom)(struct qed_dev *cdev, | ||
| 1043 | char *buf, u8 dev_addr, u32 offset, u32 len); | ||
| 1029 | }; | 1044 | }; |
| 1030 | 1045 | ||
| 1031 | #define MASK_FIELD(_name, _value) \ | 1046 | #define MASK_FIELD(_name, _value) \ |
diff --git a/include/linux/random.h b/include/linux/random.h index 2ddf13b4281e..445a0ea4ff49 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
| @@ -36,9 +36,10 @@ extern void add_interrupt_randomness(int irq, int irq_flags) __latent_entropy; | |||
| 36 | 36 | ||
| 37 | extern void get_random_bytes(void *buf, int nbytes); | 37 | extern void get_random_bytes(void *buf, int nbytes); |
| 38 | extern int wait_for_random_bytes(void); | 38 | extern int wait_for_random_bytes(void); |
| 39 | extern bool rng_is_initialized(void); | ||
| 39 | extern int add_random_ready_callback(struct random_ready_callback *rdy); | 40 | extern int add_random_ready_callback(struct random_ready_callback *rdy); |
| 40 | extern void del_random_ready_callback(struct random_ready_callback *rdy); | 41 | extern void del_random_ready_callback(struct random_ready_callback *rdy); |
| 41 | extern void get_random_bytes_arch(void *buf, int nbytes); | 42 | extern int __must_check get_random_bytes_arch(void *buf, int nbytes); |
| 42 | 43 | ||
| 43 | #ifndef MODULE | 44 | #ifndef MODULE |
| 44 | extern const struct file_operations random_fops, urandom_fops; | 45 | extern const struct file_operations random_fops, urandom_fops; |
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 36df6ccbc874..4786c2235b98 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h | |||
| @@ -396,7 +396,16 @@ static inline void list_splice_tail_init_rcu(struct list_head *list, | |||
| 396 | * @member: the name of the list_head within the struct. | 396 | * @member: the name of the list_head within the struct. |
| 397 | * | 397 | * |
| 398 | * Continue to iterate over list of given type, continuing after | 398 | * Continue to iterate over list of given type, continuing after |
| 399 | * the current position. | 399 | * the current position which must have been in the list when the RCU read |
| 400 | * lock was taken. | ||
| 401 | * This would typically require either that you obtained the node from a | ||
| 402 | * previous walk of the list in the same RCU read-side critical section, or | ||
| 403 | * that you held some sort of non-RCU reference (such as a reference count) | ||
| 404 | * to keep the node alive *and* in the list. | ||
| 405 | * | ||
| 406 | * This iterator is similar to list_for_each_entry_from_rcu() except | ||
| 407 | * this starts after the given position and that one starts at the given | ||
| 408 | * position. | ||
| 400 | */ | 409 | */ |
| 401 | #define list_for_each_entry_continue_rcu(pos, head, member) \ | 410 | #define list_for_each_entry_continue_rcu(pos, head, member) \ |
| 402 | for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ | 411 | for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ |
| @@ -411,6 +420,14 @@ static inline void list_splice_tail_init_rcu(struct list_head *list, | |||
| 411 | * | 420 | * |
| 412 | * Iterate over the tail of a list starting from a given position, | 421 | * Iterate over the tail of a list starting from a given position, |
| 413 | * which must have been in the list when the RCU read lock was taken. | 422 | * which must have been in the list when the RCU read lock was taken. |
| 423 | * This would typically require either that you obtained the node from a | ||
| 424 | * previous walk of the list in the same RCU read-side critical section, or | ||
| 425 | * that you held some sort of non-RCU reference (such as a reference count) | ||
| 426 | * to keep the node alive *and* in the list. | ||
| 427 | * | ||
| 428 | * This iterator is similar to list_for_each_entry_continue_rcu() except | ||
| 429 | * this starts from the given position and that one starts from the position | ||
| 430 | * after the given position. | ||
| 414 | */ | 431 | */ |
| 415 | #define list_for_each_entry_from_rcu(pos, head, member) \ | 432 | #define list_for_each_entry_from_rcu(pos, head, member) \ |
| 416 | for (; &(pos)->member != (head); \ | 433 | for (; &(pos)->member != (head); \ |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 65163aa0bb04..75e5b393cf44 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -64,7 +64,6 @@ void rcu_barrier_tasks(void); | |||
| 64 | 64 | ||
| 65 | void __rcu_read_lock(void); | 65 | void __rcu_read_lock(void); |
| 66 | void __rcu_read_unlock(void); | 66 | void __rcu_read_unlock(void); |
| 67 | void rcu_read_unlock_special(struct task_struct *t); | ||
| 68 | void synchronize_rcu(void); | 67 | void synchronize_rcu(void); |
| 69 | 68 | ||
| 70 | /* | 69 | /* |
| @@ -159,11 +158,11 @@ static inline void rcu_init_nohz(void) { } | |||
| 159 | } while (0) | 158 | } while (0) |
| 160 | 159 | ||
| 161 | /* | 160 | /* |
| 162 | * Note a voluntary context switch for RCU-tasks benefit. This is a | 161 | * Note a quasi-voluntary context switch for RCU-tasks's benefit. |
| 163 | * macro rather than an inline function to avoid #include hell. | 162 | * This is a macro rather than an inline function to avoid #include hell. |
| 164 | */ | 163 | */ |
| 165 | #ifdef CONFIG_TASKS_RCU | 164 | #ifdef CONFIG_TASKS_RCU |
| 166 | #define rcu_note_voluntary_context_switch_lite(t) \ | 165 | #define rcu_tasks_qs(t) \ |
| 167 | do { \ | 166 | do { \ |
| 168 | if (READ_ONCE((t)->rcu_tasks_holdout)) \ | 167 | if (READ_ONCE((t)->rcu_tasks_holdout)) \ |
| 169 | WRITE_ONCE((t)->rcu_tasks_holdout, false); \ | 168 | WRITE_ONCE((t)->rcu_tasks_holdout, false); \ |
| @@ -171,14 +170,14 @@ static inline void rcu_init_nohz(void) { } | |||
| 171 | #define rcu_note_voluntary_context_switch(t) \ | 170 | #define rcu_note_voluntary_context_switch(t) \ |
| 172 | do { \ | 171 | do { \ |
| 173 | rcu_all_qs(); \ | 172 | rcu_all_qs(); \ |
| 174 | rcu_note_voluntary_context_switch_lite(t); \ | 173 | rcu_tasks_qs(t); \ |
| 175 | } while (0) | 174 | } while (0) |
| 176 | void call_rcu_tasks(struct rcu_head *head, rcu_callback_t func); | 175 | void call_rcu_tasks(struct rcu_head *head, rcu_callback_t func); |
| 177 | void synchronize_rcu_tasks(void); | 176 | void synchronize_rcu_tasks(void); |
| 178 | void exit_tasks_rcu_start(void); | 177 | void exit_tasks_rcu_start(void); |
| 179 | void exit_tasks_rcu_finish(void); | 178 | void exit_tasks_rcu_finish(void); |
| 180 | #else /* #ifdef CONFIG_TASKS_RCU */ | 179 | #else /* #ifdef CONFIG_TASKS_RCU */ |
| 181 | #define rcu_note_voluntary_context_switch_lite(t) do { } while (0) | 180 | #define rcu_tasks_qs(t) do { } while (0) |
| 182 | #define rcu_note_voluntary_context_switch(t) rcu_all_qs() | 181 | #define rcu_note_voluntary_context_switch(t) rcu_all_qs() |
| 183 | #define call_rcu_tasks call_rcu_sched | 182 | #define call_rcu_tasks call_rcu_sched |
| 184 | #define synchronize_rcu_tasks synchronize_sched | 183 | #define synchronize_rcu_tasks synchronize_sched |
| @@ -195,8 +194,8 @@ static inline void exit_tasks_rcu_finish(void) { } | |||
| 195 | */ | 194 | */ |
| 196 | #define cond_resched_tasks_rcu_qs() \ | 195 | #define cond_resched_tasks_rcu_qs() \ |
| 197 | do { \ | 196 | do { \ |
| 198 | if (!cond_resched()) \ | 197 | rcu_tasks_qs(current); \ |
| 199 | rcu_note_voluntary_context_switch_lite(current); \ | 198 | cond_resched(); \ |
| 200 | } while (0) | 199 | } while (0) |
| 201 | 200 | ||
| 202 | /* | 201 | /* |
| @@ -567,8 +566,8 @@ static inline void rcu_preempt_sleep_check(void) { } | |||
| 567 | * This is simply an identity function, but it documents where a pointer | 566 | * This is simply an identity function, but it documents where a pointer |
| 568 | * is handed off from RCU to some other synchronization mechanism, for | 567 | * is handed off from RCU to some other synchronization mechanism, for |
| 569 | * example, reference counting or locking. In C11, it would map to | 568 | * example, reference counting or locking. In C11, it would map to |
| 570 | * kill_dependency(). It could be used as follows: | 569 | * kill_dependency(). It could be used as follows:: |
| 571 | * `` | 570 | * |
| 572 | * rcu_read_lock(); | 571 | * rcu_read_lock(); |
| 573 | * p = rcu_dereference(gp); | 572 | * p = rcu_dereference(gp); |
| 574 | * long_lived = is_long_lived(p); | 573 | * long_lived = is_long_lived(p); |
| @@ -579,7 +578,6 @@ static inline void rcu_preempt_sleep_check(void) { } | |||
| 579 | * p = rcu_pointer_handoff(p); | 578 | * p = rcu_pointer_handoff(p); |
| 580 | * } | 579 | * } |
| 581 | * rcu_read_unlock(); | 580 | * rcu_read_unlock(); |
| 582 | *`` | ||
| 583 | */ | 581 | */ |
| 584 | #define rcu_pointer_handoff(p) (p) | 582 | #define rcu_pointer_handoff(p) (p) |
| 585 | 583 | ||
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index 7b3c82e8a625..8d9a0ea8f0b5 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
| @@ -93,7 +93,7 @@ static inline void kfree_call_rcu(struct rcu_head *head, | |||
| 93 | #define rcu_note_context_switch(preempt) \ | 93 | #define rcu_note_context_switch(preempt) \ |
| 94 | do { \ | 94 | do { \ |
| 95 | rcu_sched_qs(); \ | 95 | rcu_sched_qs(); \ |
| 96 | rcu_note_voluntary_context_switch_lite(current); \ | 96 | rcu_tasks_qs(current); \ |
| 97 | } while (0) | 97 | } while (0) |
| 98 | 98 | ||
| 99 | static inline int rcu_needs_cpu(u64 basemono, u64 *nextevt) | 99 | static inline int rcu_needs_cpu(u64 basemono, u64 *nextevt) |
diff --git a/include/linux/reciprocal_div.h b/include/linux/reciprocal_div.h index e031e9f2f9d8..585ce89c0f33 100644 --- a/include/linux/reciprocal_div.h +++ b/include/linux/reciprocal_div.h | |||
| @@ -25,6 +25,9 @@ struct reciprocal_value { | |||
| 25 | u8 sh1, sh2; | 25 | u8 sh1, sh2; |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | /* "reciprocal_value" and "reciprocal_divide" together implement the basic | ||
| 29 | * version of the algorithm described in Figure 4.1 of the paper. | ||
| 30 | */ | ||
| 28 | struct reciprocal_value reciprocal_value(u32 d); | 31 | struct reciprocal_value reciprocal_value(u32 d); |
| 29 | 32 | ||
| 30 | static inline u32 reciprocal_divide(u32 a, struct reciprocal_value R) | 33 | static inline u32 reciprocal_divide(u32 a, struct reciprocal_value R) |
| @@ -33,4 +36,69 @@ static inline u32 reciprocal_divide(u32 a, struct reciprocal_value R) | |||
| 33 | return (t + ((a - t) >> R.sh1)) >> R.sh2; | 36 | return (t + ((a - t) >> R.sh1)) >> R.sh2; |
| 34 | } | 37 | } |
| 35 | 38 | ||
| 39 | struct reciprocal_value_adv { | ||
| 40 | u32 m; | ||
| 41 | u8 sh, exp; | ||
| 42 | bool is_wide_m; | ||
| 43 | }; | ||
| 44 | |||
| 45 | /* "reciprocal_value_adv" implements the advanced version of the algorithm | ||
| 46 | * described in Figure 4.2 of the paper except when "divisor > (1U << 31)" whose | ||
| 47 | * ceil(log2(d)) result will be 32 which then requires u128 divide on host. The | ||
| 48 | * exception case could be easily handled before calling "reciprocal_value_adv". | ||
| 49 | * | ||
| 50 | * The advanced version requires more complex calculation to get the reciprocal | ||
| 51 | * multiplier and other control variables, but then could reduce the required | ||
| 52 | * emulation operations. | ||
| 53 | * | ||
| 54 | * It makes no sense to use this advanced version for host divide emulation, | ||
| 55 | * those extra complexities for calculating multiplier etc could completely | ||
| 56 | * waive our saving on emulation operations. | ||
| 57 | * | ||
| 58 | * However, it makes sense to use it for JIT divide code generation for which | ||
| 59 | * we are willing to trade performance of JITed code with that of host. As shown | ||
| 60 | * by the following pseudo code, the required emulation operations could go down | ||
| 61 | * from 6 (the basic version) to 3 or 4. | ||
| 62 | * | ||
| 63 | * To use the result of "reciprocal_value_adv", suppose we want to calculate | ||
| 64 | * n/d, the pseudo C code will be: | ||
| 65 | * | ||
| 66 | * struct reciprocal_value_adv rvalue; | ||
| 67 | * u8 pre_shift, exp; | ||
| 68 | * | ||
| 69 | * // handle exception case. | ||
| 70 | * if (d >= (1U << 31)) { | ||
| 71 | * result = n >= d; | ||
| 72 | * return; | ||
| 73 | * } | ||
| 74 | * | ||
| 75 | * rvalue = reciprocal_value_adv(d, 32) | ||
| 76 | * exp = rvalue.exp; | ||
| 77 | * if (rvalue.is_wide_m && !(d & 1)) { | ||
| 78 | * // floor(log2(d & (2^32 -d))) | ||
| 79 | * pre_shift = fls(d & -d) - 1; | ||
| 80 | * rvalue = reciprocal_value_adv(d >> pre_shift, 32 - pre_shift); | ||
| 81 | * } else { | ||
| 82 | * pre_shift = 0; | ||
| 83 | * } | ||
| 84 | * | ||
| 85 | * // code generation starts. | ||
| 86 | * if (imm == 1U << exp) { | ||
| 87 | * result = n >> exp; | ||
| 88 | * } else if (rvalue.is_wide_m) { | ||
| 89 | * // pre_shift must be zero when reached here. | ||
| 90 | * t = (n * rvalue.m) >> 32; | ||
| 91 | * result = n - t; | ||
| 92 | * result >>= 1; | ||
| 93 | * result += t; | ||
| 94 | * result >>= rvalue.sh - 1; | ||
| 95 | * } else { | ||
| 96 | * if (pre_shift) | ||
| 97 | * result = n >> pre_shift; | ||
| 98 | * result = ((u64)result * rvalue.m) >> 32; | ||
| 99 | * result >>= rvalue.sh; | ||
| 100 | * } | ||
| 101 | */ | ||
| 102 | struct reciprocal_value_adv reciprocal_value_adv(u32 d, u8 prec); | ||
| 103 | |||
| 36 | #endif /* _LINUX_RECIPROCAL_DIV_H */ | 104 | #endif /* _LINUX_RECIPROCAL_DIV_H */ |
diff --git a/include/linux/refcount.h b/include/linux/refcount.h index a685da2c4522..e28cce21bad6 100644 --- a/include/linux/refcount.h +++ b/include/linux/refcount.h | |||
| @@ -3,9 +3,10 @@ | |||
| 3 | #define _LINUX_REFCOUNT_H | 3 | #define _LINUX_REFCOUNT_H |
| 4 | 4 | ||
| 5 | #include <linux/atomic.h> | 5 | #include <linux/atomic.h> |
| 6 | #include <linux/mutex.h> | 6 | #include <linux/compiler.h> |
| 7 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock_types.h> |
| 8 | #include <linux/kernel.h> | 8 | |
| 9 | struct mutex; | ||
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| 11 | * struct refcount_t - variant of atomic_t specialized for reference counts | 12 | * struct refcount_t - variant of atomic_t specialized for reference counts |
| @@ -42,17 +43,30 @@ static inline unsigned int refcount_read(const refcount_t *r) | |||
| 42 | return atomic_read(&r->refs); | 43 | return atomic_read(&r->refs); |
| 43 | } | 44 | } |
| 44 | 45 | ||
| 46 | extern __must_check bool refcount_add_not_zero_checked(unsigned int i, refcount_t *r); | ||
| 47 | extern void refcount_add_checked(unsigned int i, refcount_t *r); | ||
| 48 | |||
| 49 | extern __must_check bool refcount_inc_not_zero_checked(refcount_t *r); | ||
| 50 | extern void refcount_inc_checked(refcount_t *r); | ||
| 51 | |||
| 52 | extern __must_check bool refcount_sub_and_test_checked(unsigned int i, refcount_t *r); | ||
| 53 | |||
| 54 | extern __must_check bool refcount_dec_and_test_checked(refcount_t *r); | ||
| 55 | extern void refcount_dec_checked(refcount_t *r); | ||
| 56 | |||
| 45 | #ifdef CONFIG_REFCOUNT_FULL | 57 | #ifdef CONFIG_REFCOUNT_FULL |
| 46 | extern __must_check bool refcount_add_not_zero(unsigned int i, refcount_t *r); | ||
| 47 | extern void refcount_add(unsigned int i, refcount_t *r); | ||
| 48 | 58 | ||
| 49 | extern __must_check bool refcount_inc_not_zero(refcount_t *r); | 59 | #define refcount_add_not_zero refcount_add_not_zero_checked |
| 50 | extern void refcount_inc(refcount_t *r); | 60 | #define refcount_add refcount_add_checked |
| 61 | |||
| 62 | #define refcount_inc_not_zero refcount_inc_not_zero_checked | ||
| 63 | #define refcount_inc refcount_inc_checked | ||
| 64 | |||
| 65 | #define refcount_sub_and_test refcount_sub_and_test_checked | ||
| 51 | 66 | ||
| 52 | extern __must_check bool refcount_sub_and_test(unsigned int i, refcount_t *r); | 67 | #define refcount_dec_and_test refcount_dec_and_test_checked |
| 68 | #define refcount_dec refcount_dec_checked | ||
| 53 | 69 | ||
| 54 | extern __must_check bool refcount_dec_and_test(refcount_t *r); | ||
| 55 | extern void refcount_dec(refcount_t *r); | ||
| 56 | #else | 70 | #else |
| 57 | # ifdef CONFIG_ARCH_HAS_REFCOUNT | 71 | # ifdef CONFIG_ARCH_HAS_REFCOUNT |
| 58 | # include <asm/refcount.h> | 72 | # include <asm/refcount.h> |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 4f38068ffb71..379505a53722 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
| @@ -268,6 +268,13 @@ typedef void (*regmap_unlock)(void *); | |||
| 268 | * field is NULL but precious_table (see below) is not, the | 268 | * field is NULL but precious_table (see below) is not, the |
| 269 | * check is performed on such table (a register is precious if | 269 | * check is performed on such table (a register is precious if |
| 270 | * it belongs to one of the ranges specified by precious_table). | 270 | * it belongs to one of the ranges specified by precious_table). |
| 271 | * @readable_noinc_reg: Optional callback returning true if the register | ||
| 272 | * supports multiple read operations without incrementing | ||
| 273 | * the register number. If this field is NULL but | ||
| 274 | * rd_noinc_table (see below) is not, the check is | ||
| 275 | * performed on such table (a register is no increment | ||
| 276 | * readable if it belongs to one of the ranges specified | ||
| 277 | * by rd_noinc_table). | ||
| 271 | * @disable_locking: This regmap is either protected by external means or | 278 | * @disable_locking: This regmap is either protected by external means or |
| 272 | * is guaranteed not be be accessed from multiple threads. | 279 | * is guaranteed not be be accessed from multiple threads. |
| 273 | * Don't use any locking mechanisms. | 280 | * Don't use any locking mechanisms. |
| @@ -295,6 +302,7 @@ typedef void (*regmap_unlock)(void *); | |||
| 295 | * @rd_table: As above, for read access. | 302 | * @rd_table: As above, for read access. |
| 296 | * @volatile_table: As above, for volatile registers. | 303 | * @volatile_table: As above, for volatile registers. |
| 297 | * @precious_table: As above, for precious registers. | 304 | * @precious_table: As above, for precious registers. |
| 305 | * @rd_noinc_table: As above, for no increment readable registers. | ||
| 298 | * @reg_defaults: Power on reset values for registers (for use with | 306 | * @reg_defaults: Power on reset values for registers (for use with |
| 299 | * register cache support). | 307 | * register cache support). |
| 300 | * @num_reg_defaults: Number of elements in reg_defaults. | 308 | * @num_reg_defaults: Number of elements in reg_defaults. |
| @@ -344,6 +352,7 @@ struct regmap_config { | |||
| 344 | bool (*readable_reg)(struct device *dev, unsigned int reg); | 352 | bool (*readable_reg)(struct device *dev, unsigned int reg); |
| 345 | bool (*volatile_reg)(struct device *dev, unsigned int reg); | 353 | bool (*volatile_reg)(struct device *dev, unsigned int reg); |
| 346 | bool (*precious_reg)(struct device *dev, unsigned int reg); | 354 | bool (*precious_reg)(struct device *dev, unsigned int reg); |
| 355 | bool (*readable_noinc_reg)(struct device *dev, unsigned int reg); | ||
| 347 | 356 | ||
| 348 | bool disable_locking; | 357 | bool disable_locking; |
| 349 | regmap_lock lock; | 358 | regmap_lock lock; |
| @@ -360,6 +369,7 @@ struct regmap_config { | |||
| 360 | const struct regmap_access_table *rd_table; | 369 | const struct regmap_access_table *rd_table; |
| 361 | const struct regmap_access_table *volatile_table; | 370 | const struct regmap_access_table *volatile_table; |
| 362 | const struct regmap_access_table *precious_table; | 371 | const struct regmap_access_table *precious_table; |
| 372 | const struct regmap_access_table *rd_noinc_table; | ||
| 363 | const struct reg_default *reg_defaults; | 373 | const struct reg_default *reg_defaults; |
| 364 | unsigned int num_reg_defaults; | 374 | unsigned int num_reg_defaults; |
| 365 | enum regcache_type cache_type; | 375 | enum regcache_type cache_type; |
| @@ -514,6 +524,10 @@ struct regmap *__regmap_init_i2c(struct i2c_client *i2c, | |||
| 514 | const struct regmap_config *config, | 524 | const struct regmap_config *config, |
| 515 | struct lock_class_key *lock_key, | 525 | struct lock_class_key *lock_key, |
| 516 | const char *lock_name); | 526 | const char *lock_name); |
| 527 | struct regmap *__regmap_init_sccb(struct i2c_client *i2c, | ||
| 528 | const struct regmap_config *config, | ||
| 529 | struct lock_class_key *lock_key, | ||
| 530 | const char *lock_name); | ||
| 517 | struct regmap *__regmap_init_slimbus(struct slim_device *slimbus, | 531 | struct regmap *__regmap_init_slimbus(struct slim_device *slimbus, |
| 518 | const struct regmap_config *config, | 532 | const struct regmap_config *config, |
| 519 | struct lock_class_key *lock_key, | 533 | struct lock_class_key *lock_key, |
| @@ -558,6 +572,10 @@ struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c, | |||
| 558 | const struct regmap_config *config, | 572 | const struct regmap_config *config, |
| 559 | struct lock_class_key *lock_key, | 573 | struct lock_class_key *lock_key, |
| 560 | const char *lock_name); | 574 | const char *lock_name); |
| 575 | struct regmap *__devm_regmap_init_sccb(struct i2c_client *i2c, | ||
| 576 | const struct regmap_config *config, | ||
| 577 | struct lock_class_key *lock_key, | ||
| 578 | const char *lock_name); | ||
| 561 | struct regmap *__devm_regmap_init_spi(struct spi_device *dev, | 579 | struct regmap *__devm_regmap_init_spi(struct spi_device *dev, |
| 562 | const struct regmap_config *config, | 580 | const struct regmap_config *config, |
| 563 | struct lock_class_key *lock_key, | 581 | struct lock_class_key *lock_key, |
| @@ -646,6 +664,19 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
| 646 | i2c, config) | 664 | i2c, config) |
| 647 | 665 | ||
| 648 | /** | 666 | /** |
| 667 | * regmap_init_sccb() - Initialise register map | ||
| 668 | * | ||
| 669 | * @i2c: Device that will be interacted with | ||
| 670 | * @config: Configuration for register map | ||
| 671 | * | ||
| 672 | * The return value will be an ERR_PTR() on error or a valid pointer to | ||
| 673 | * a struct regmap. | ||
| 674 | */ | ||
| 675 | #define regmap_init_sccb(i2c, config) \ | ||
| 676 | __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \ | ||
| 677 | i2c, config) | ||
| 678 | |||
| 679 | /** | ||
| 649 | * regmap_init_slimbus() - Initialise register map | 680 | * regmap_init_slimbus() - Initialise register map |
| 650 | * | 681 | * |
| 651 | * @slimbus: Device that will be interacted with | 682 | * @slimbus: Device that will be interacted with |
| @@ -798,6 +829,20 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
| 798 | i2c, config) | 829 | i2c, config) |
| 799 | 830 | ||
| 800 | /** | 831 | /** |
| 832 | * devm_regmap_init_sccb() - Initialise managed register map | ||
| 833 | * | ||
| 834 | * @i2c: Device that will be interacted with | ||
| 835 | * @config: Configuration for register map | ||
| 836 | * | ||
| 837 | * The return value will be an ERR_PTR() on error or a valid pointer | ||
| 838 | * to a struct regmap. The regmap will be automatically freed by the | ||
| 839 | * device management code. | ||
| 840 | */ | ||
| 841 | #define devm_regmap_init_sccb(i2c, config) \ | ||
| 842 | __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \ | ||
| 843 | i2c, config) | ||
| 844 | |||
| 845 | /** | ||
| 801 | * devm_regmap_init_spi() - Initialise register map | 846 | * devm_regmap_init_spi() - Initialise register map |
| 802 | * | 847 | * |
| 803 | * @dev: Device that will be interacted with | 848 | * @dev: Device that will be interacted with |
| @@ -946,6 +991,8 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg, | |||
| 946 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); | 991 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); |
| 947 | int regmap_raw_read(struct regmap *map, unsigned int reg, | 992 | int regmap_raw_read(struct regmap *map, unsigned int reg, |
| 948 | void *val, size_t val_len); | 993 | void *val, size_t val_len); |
| 994 | int regmap_noinc_read(struct regmap *map, unsigned int reg, | ||
| 995 | void *val, size_t val_len); | ||
| 949 | int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, | 996 | int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, |
| 950 | size_t val_count); | 997 | size_t val_count); |
| 951 | int regmap_update_bits_base(struct regmap *map, unsigned int reg, | 998 | int regmap_update_bits_base(struct regmap *map, unsigned int reg, |
| @@ -1196,6 +1243,13 @@ static inline int regmap_raw_read(struct regmap *map, unsigned int reg, | |||
| 1196 | return -EINVAL; | 1243 | return -EINVAL; |
| 1197 | } | 1244 | } |
| 1198 | 1245 | ||
| 1246 | static inline int regmap_noinc_read(struct regmap *map, unsigned int reg, | ||
| 1247 | void *val, size_t val_len) | ||
| 1248 | { | ||
| 1249 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 1250 | return -EINVAL; | ||
| 1251 | } | ||
| 1252 | |||
| 1199 | static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, | 1253 | static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, |
| 1200 | void *val, size_t val_count) | 1254 | void *val, size_t val_count) |
| 1201 | { | 1255 | { |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index fc2dc8df476f..0fd8fbb74763 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -46,7 +46,7 @@ enum regulator_status { | |||
| 46 | /** | 46 | /** |
| 47 | * struct regulator_linear_range - specify linear voltage ranges | 47 | * struct regulator_linear_range - specify linear voltage ranges |
| 48 | * | 48 | * |
| 49 | * Specify a range of voltages for regulator_map_linar_range() and | 49 | * Specify a range of voltages for regulator_map_linear_range() and |
| 50 | * regulator_list_linear_range(). | 50 | * regulator_list_linear_range(). |
| 51 | * | 51 | * |
| 52 | * @min_uV: Lowest voltage in range | 52 | * @min_uV: Lowest voltage in range |
| @@ -220,7 +220,7 @@ struct regulator_ops { | |||
| 220 | /* set regulator suspend operating mode (defined in consumer.h) */ | 220 | /* set regulator suspend operating mode (defined in consumer.h) */ |
| 221 | int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); | 221 | int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); |
| 222 | 222 | ||
| 223 | int (*resume_early)(struct regulator_dev *rdev); | 223 | int (*resume)(struct regulator_dev *rdev); |
| 224 | 224 | ||
| 225 | int (*set_pull_down) (struct regulator_dev *); | 225 | int (*set_pull_down) (struct regulator_dev *); |
| 226 | }; | 226 | }; |
diff --git a/include/linux/regulator/pfuze100.h b/include/linux/regulator/pfuze100.h index e0ccf46f66cf..cb5aecd40f07 100644 --- a/include/linux/regulator/pfuze100.h +++ b/include/linux/regulator/pfuze100.h | |||
| @@ -64,6 +64,17 @@ | |||
| 64 | #define PFUZE3000_VLDO3 11 | 64 | #define PFUZE3000_VLDO3 11 |
| 65 | #define PFUZE3000_VLDO4 12 | 65 | #define PFUZE3000_VLDO4 12 |
| 66 | 66 | ||
| 67 | #define PFUZE3001_SW1 0 | ||
| 68 | #define PFUZE3001_SW2 1 | ||
| 69 | #define PFUZE3001_SW3 2 | ||
| 70 | #define PFUZE3001_VSNVS 3 | ||
| 71 | #define PFUZE3001_VLDO1 4 | ||
| 72 | #define PFUZE3001_VLDO2 5 | ||
| 73 | #define PFUZE3001_VCCSD 6 | ||
| 74 | #define PFUZE3001_V33 7 | ||
| 75 | #define PFUZE3001_VLDO3 8 | ||
| 76 | #define PFUZE3001_VLDO4 9 | ||
| 77 | |||
| 67 | struct regulator_init_data; | 78 | struct regulator_init_data; |
| 68 | 79 | ||
| 69 | struct pfuze_regulator_platform_data { | 80 | struct pfuze_regulator_platform_data { |
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index e6a0031d1b1f..8ad2487a86d5 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
| @@ -66,7 +66,7 @@ struct rfkill_ops { | |||
| 66 | 66 | ||
| 67 | #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) | 67 | #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) |
| 68 | /** | 68 | /** |
| 69 | * rfkill_alloc - allocate rfkill structure | 69 | * rfkill_alloc - Allocate rfkill structure |
| 70 | * @name: name of the struct -- the string is not copied internally | 70 | * @name: name of the struct -- the string is not copied internally |
| 71 | * @parent: device that has rf switch on it | 71 | * @parent: device that has rf switch on it |
| 72 | * @type: type of the switch (RFKILL_TYPE_*) | 72 | * @type: type of the switch (RFKILL_TYPE_*) |
| @@ -112,7 +112,7 @@ void rfkill_pause_polling(struct rfkill *rfkill); | |||
| 112 | /** | 112 | /** |
| 113 | * rfkill_resume_polling(struct rfkill *rfkill) | 113 | * rfkill_resume_polling(struct rfkill *rfkill) |
| 114 | * | 114 | * |
| 115 | * Pause polling -- say transmitter is off for other reasons. | 115 | * Resume polling |
| 116 | * NOTE: not necessary for suspend/resume -- in that case the | 116 | * NOTE: not necessary for suspend/resume -- in that case the |
| 117 | * core stops polling anyway | 117 | * core stops polling anyway |
| 118 | */ | 118 | */ |
| @@ -130,7 +130,7 @@ void rfkill_resume_polling(struct rfkill *rfkill); | |||
| 130 | void rfkill_unregister(struct rfkill *rfkill); | 130 | void rfkill_unregister(struct rfkill *rfkill); |
| 131 | 131 | ||
| 132 | /** | 132 | /** |
| 133 | * rfkill_destroy - free rfkill structure | 133 | * rfkill_destroy - Free rfkill structure |
| 134 | * @rfkill: rfkill structure to be destroyed | 134 | * @rfkill: rfkill structure to be destroyed |
| 135 | * | 135 | * |
| 136 | * Destroys the rfkill structure. | 136 | * Destroys the rfkill structure. |
| @@ -140,7 +140,7 @@ void rfkill_destroy(struct rfkill *rfkill); | |||
| 140 | /** | 140 | /** |
| 141 | * rfkill_set_hw_state - Set the internal rfkill hardware block state | 141 | * rfkill_set_hw_state - Set the internal rfkill hardware block state |
| 142 | * @rfkill: pointer to the rfkill class to modify. | 142 | * @rfkill: pointer to the rfkill class to modify. |
| 143 | * @state: the current hardware block state to set | 143 | * @blocked: the current hardware block state to set |
| 144 | * | 144 | * |
| 145 | * rfkill drivers that get events when the hard-blocked state changes | 145 | * rfkill drivers that get events when the hard-blocked state changes |
| 146 | * use this function to notify the rfkill core (and through that also | 146 | * use this function to notify the rfkill core (and through that also |
| @@ -161,7 +161,7 @@ bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked); | |||
| 161 | /** | 161 | /** |
| 162 | * rfkill_set_sw_state - Set the internal rfkill software block state | 162 | * rfkill_set_sw_state - Set the internal rfkill software block state |
| 163 | * @rfkill: pointer to the rfkill class to modify. | 163 | * @rfkill: pointer to the rfkill class to modify. |
| 164 | * @state: the current software block state to set | 164 | * @blocked: the current software block state to set |
| 165 | * | 165 | * |
| 166 | * rfkill drivers that get events when the soft-blocked state changes | 166 | * rfkill drivers that get events when the soft-blocked state changes |
| 167 | * (yes, some platforms directly act on input but allow changing again) | 167 | * (yes, some platforms directly act on input but allow changing again) |
| @@ -183,7 +183,7 @@ bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked); | |||
| 183 | /** | 183 | /** |
| 184 | * rfkill_init_sw_state - Initialize persistent software block state | 184 | * rfkill_init_sw_state - Initialize persistent software block state |
| 185 | * @rfkill: pointer to the rfkill class to modify. | 185 | * @rfkill: pointer to the rfkill class to modify. |
| 186 | * @state: the current software block state to set | 186 | * @blocked: the current software block state to set |
| 187 | * | 187 | * |
| 188 | * rfkill drivers that preserve their software block state over power off | 188 | * rfkill drivers that preserve their software block state over power off |
| 189 | * use this function to notify the rfkill core (and through that also | 189 | * use this function to notify the rfkill core (and through that also |
| @@ -208,17 +208,17 @@ void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked); | |||
| 208 | void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw); | 208 | void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw); |
| 209 | 209 | ||
| 210 | /** | 210 | /** |
| 211 | * rfkill_blocked - query rfkill block | 211 | * rfkill_blocked - Query rfkill block state |
| 212 | * | 212 | * |
| 213 | * @rfkill: rfkill struct to query | 213 | * @rfkill: rfkill struct to query |
| 214 | */ | 214 | */ |
| 215 | bool rfkill_blocked(struct rfkill *rfkill); | 215 | bool rfkill_blocked(struct rfkill *rfkill); |
| 216 | 216 | ||
| 217 | /** | 217 | /** |
| 218 | * rfkill_find_type - Helpper for finding rfkill type by name | 218 | * rfkill_find_type - Helper for finding rfkill type by name |
| 219 | * @name: the name of the type | 219 | * @name: the name of the type |
| 220 | * | 220 | * |
| 221 | * Returns enum rfkill_type that conrresponds the name. | 221 | * Returns enum rfkill_type that corresponds to the name. |
| 222 | */ | 222 | */ |
| 223 | enum rfkill_type rfkill_find_type(const char *name); | 223 | enum rfkill_type rfkill_find_type(const char *name); |
| 224 | 224 | ||
| @@ -296,7 +296,7 @@ static inline enum rfkill_type rfkill_find_type(const char *name) | |||
| 296 | const char *rfkill_get_led_trigger_name(struct rfkill *rfkill); | 296 | const char *rfkill_get_led_trigger_name(struct rfkill *rfkill); |
| 297 | 297 | ||
| 298 | /** | 298 | /** |
| 299 | * rfkill_set_led_trigger_name -- set the LED trigger name | 299 | * rfkill_set_led_trigger_name - Set the LED trigger name |
| 300 | * @rfkill: rfkill struct | 300 | * @rfkill: rfkill struct |
| 301 | * @name: LED trigger name | 301 | * @name: LED trigger name |
| 302 | * | 302 | * |
diff --git a/include/linux/rhashtable-types.h b/include/linux/rhashtable-types.h new file mode 100644 index 000000000000..763d613ce2c2 --- /dev/null +++ b/include/linux/rhashtable-types.h | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Resizable, Scalable, Concurrent Hash Table | ||
| 4 | * | ||
| 5 | * Simple structures that might be needed in include | ||
| 6 | * files. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef _LINUX_RHASHTABLE_TYPES_H | ||
| 10 | #define _LINUX_RHASHTABLE_TYPES_H | ||
| 11 | |||
| 12 | #include <linux/atomic.h> | ||
| 13 | #include <linux/compiler.h> | ||
| 14 | #include <linux/mutex.h> | ||
| 15 | #include <linux/workqueue.h> | ||
| 16 | |||
| 17 | struct rhash_head { | ||
| 18 | struct rhash_head __rcu *next; | ||
| 19 | }; | ||
| 20 | |||
| 21 | struct rhlist_head { | ||
| 22 | struct rhash_head rhead; | ||
| 23 | struct rhlist_head __rcu *next; | ||
| 24 | }; | ||
| 25 | |||
| 26 | struct bucket_table; | ||
| 27 | |||
| 28 | /** | ||
| 29 | * struct rhashtable_compare_arg - Key for the function rhashtable_compare | ||
| 30 | * @ht: Hash table | ||
| 31 | * @key: Key to compare against | ||
| 32 | */ | ||
| 33 | struct rhashtable_compare_arg { | ||
| 34 | struct rhashtable *ht; | ||
| 35 | const void *key; | ||
| 36 | }; | ||
| 37 | |||
| 38 | typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); | ||
| 39 | typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 len, u32 seed); | ||
| 40 | typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg, | ||
| 41 | const void *obj); | ||
| 42 | |||
| 43 | /** | ||
| 44 | * struct rhashtable_params - Hash table construction parameters | ||
| 45 | * @nelem_hint: Hint on number of elements, should be 75% of desired size | ||
| 46 | * @key_len: Length of key | ||
| 47 | * @key_offset: Offset of key in struct to be hashed | ||
| 48 | * @head_offset: Offset of rhash_head in struct to be hashed | ||
| 49 | * @max_size: Maximum size while expanding | ||
| 50 | * @min_size: Minimum size while shrinking | ||
| 51 | * @locks_mul: Number of bucket locks to allocate per cpu (default: 32) | ||
| 52 | * @automatic_shrinking: Enable automatic shrinking of tables | ||
| 53 | * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash) | ||
| 54 | * @obj_hashfn: Function to hash object | ||
| 55 | * @obj_cmpfn: Function to compare key with object | ||
| 56 | */ | ||
| 57 | struct rhashtable_params { | ||
| 58 | u16 nelem_hint; | ||
| 59 | u16 key_len; | ||
| 60 | u16 key_offset; | ||
| 61 | u16 head_offset; | ||
| 62 | unsigned int max_size; | ||
| 63 | u16 min_size; | ||
| 64 | bool automatic_shrinking; | ||
| 65 | u8 locks_mul; | ||
| 66 | rht_hashfn_t hashfn; | ||
| 67 | rht_obj_hashfn_t obj_hashfn; | ||
| 68 | rht_obj_cmpfn_t obj_cmpfn; | ||
| 69 | }; | ||
| 70 | |||
| 71 | /** | ||
| 72 | * struct rhashtable - Hash table handle | ||
| 73 | * @tbl: Bucket table | ||
| 74 | * @key_len: Key length for hashfn | ||
| 75 | * @max_elems: Maximum number of elements in table | ||
| 76 | * @p: Configuration parameters | ||
| 77 | * @rhlist: True if this is an rhltable | ||
| 78 | * @run_work: Deferred worker to expand/shrink asynchronously | ||
| 79 | * @mutex: Mutex to protect current/future table swapping | ||
| 80 | * @lock: Spin lock to protect walker list | ||
| 81 | * @nelems: Number of elements in table | ||
| 82 | */ | ||
| 83 | struct rhashtable { | ||
| 84 | struct bucket_table __rcu *tbl; | ||
| 85 | unsigned int key_len; | ||
| 86 | unsigned int max_elems; | ||
| 87 | struct rhashtable_params p; | ||
| 88 | bool rhlist; | ||
| 89 | struct work_struct run_work; | ||
| 90 | struct mutex mutex; | ||
| 91 | spinlock_t lock; | ||
| 92 | atomic_t nelems; | ||
| 93 | }; | ||
| 94 | |||
| 95 | /** | ||
| 96 | * struct rhltable - Hash table with duplicate objects in a list | ||
| 97 | * @ht: Underlying rhtable | ||
| 98 | */ | ||
| 99 | struct rhltable { | ||
| 100 | struct rhashtable ht; | ||
| 101 | }; | ||
| 102 | |||
| 103 | /** | ||
| 104 | * struct rhashtable_walker - Hash table walker | ||
| 105 | * @list: List entry on list of walkers | ||
| 106 | * @tbl: The table that we were walking over | ||
| 107 | */ | ||
| 108 | struct rhashtable_walker { | ||
| 109 | struct list_head list; | ||
| 110 | struct bucket_table *tbl; | ||
| 111 | }; | ||
| 112 | |||
| 113 | /** | ||
| 114 | * struct rhashtable_iter - Hash table iterator | ||
| 115 | * @ht: Table to iterate through | ||
| 116 | * @p: Current pointer | ||
| 117 | * @list: Current hash list pointer | ||
| 118 | * @walker: Associated rhashtable walker | ||
| 119 | * @slot: Current slot | ||
| 120 | * @skip: Number of entries to skip in slot | ||
| 121 | */ | ||
| 122 | struct rhashtable_iter { | ||
| 123 | struct rhashtable *ht; | ||
| 124 | struct rhash_head *p; | ||
| 125 | struct rhlist_head *list; | ||
| 126 | struct rhashtable_walker walker; | ||
| 127 | unsigned int slot; | ||
| 128 | unsigned int skip; | ||
| 129 | bool end_of_table; | ||
| 130 | }; | ||
| 131 | |||
| 132 | int rhashtable_init(struct rhashtable *ht, | ||
| 133 | const struct rhashtable_params *params); | ||
| 134 | int rhltable_init(struct rhltable *hlt, | ||
| 135 | const struct rhashtable_params *params); | ||
| 136 | |||
| 137 | #endif /* _LINUX_RHASHTABLE_TYPES_H */ | ||
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index 4e1f535c2034..eb7111039247 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 1 | /* | 2 | /* |
| 2 | * Resizable, Scalable, Concurrent Hash Table | 3 | * Resizable, Scalable, Concurrent Hash Table |
| 3 | * | 4 | * |
| @@ -17,37 +18,18 @@ | |||
| 17 | #ifndef _LINUX_RHASHTABLE_H | 18 | #ifndef _LINUX_RHASHTABLE_H |
| 18 | #define _LINUX_RHASHTABLE_H | 19 | #define _LINUX_RHASHTABLE_H |
| 19 | 20 | ||
| 20 | #include <linux/atomic.h> | ||
| 21 | #include <linux/compiler.h> | ||
| 22 | #include <linux/err.h> | 21 | #include <linux/err.h> |
| 23 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
| 24 | #include <linux/jhash.h> | 23 | #include <linux/jhash.h> |
| 25 | #include <linux/list_nulls.h> | 24 | #include <linux/list_nulls.h> |
| 26 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
| 27 | #include <linux/mutex.h> | ||
| 28 | #include <linux/rculist.h> | 26 | #include <linux/rculist.h> |
| 29 | 27 | ||
| 28 | #include <linux/rhashtable-types.h> | ||
| 30 | /* | 29 | /* |
| 31 | * The end of the chain is marked with a special nulls marks which has | 30 | * The end of the chain is marked with a special nulls marks which has |
| 32 | * the following format: | 31 | * the least significant bit set. |
| 33 | * | ||
| 34 | * +-------+-----------------------------------------------------+-+ | ||
| 35 | * | Base | Hash |1| | ||
| 36 | * +-------+-----------------------------------------------------+-+ | ||
| 37 | * | ||
| 38 | * Base (4 bits) : Reserved to distinguish between multiple tables. | ||
| 39 | * Specified via &struct rhashtable_params.nulls_base. | ||
| 40 | * Hash (27 bits): Full hash (unmasked) of first element added to bucket | ||
| 41 | * 1 (1 bit) : Nulls marker (always set) | ||
| 42 | * | ||
| 43 | * The remaining bits of the next pointer remain unused for now. | ||
| 44 | */ | 32 | */ |
| 45 | #define RHT_BASE_BITS 4 | ||
| 46 | #define RHT_HASH_BITS 27 | ||
| 47 | #define RHT_BASE_SHIFT RHT_HASH_BITS | ||
| 48 | |||
| 49 | /* Base bits plus 1 bit for nulls marker */ | ||
| 50 | #define RHT_HASH_RESERVED_SPACE (RHT_BASE_BITS + 1) | ||
| 51 | 33 | ||
| 52 | /* Maximum chain length before rehash | 34 | /* Maximum chain length before rehash |
| 53 | * | 35 | * |
| @@ -64,15 +46,6 @@ | |||
| 64 | */ | 46 | */ |
| 65 | #define RHT_ELASTICITY 16u | 47 | #define RHT_ELASTICITY 16u |
| 66 | 48 | ||
| 67 | struct rhash_head { | ||
| 68 | struct rhash_head __rcu *next; | ||
| 69 | }; | ||
| 70 | |||
| 71 | struct rhlist_head { | ||
| 72 | struct rhash_head rhead; | ||
| 73 | struct rhlist_head __rcu *next; | ||
| 74 | }; | ||
| 75 | |||
| 76 | /** | 49 | /** |
| 77 | * struct bucket_table - Table of hash buckets | 50 | * struct bucket_table - Table of hash buckets |
| 78 | * @size: Number of hash buckets | 51 | * @size: Number of hash buckets |
| @@ -102,132 +75,14 @@ struct bucket_table { | |||
| 102 | struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; | 75 | struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; |
| 103 | }; | 76 | }; |
| 104 | 77 | ||
| 105 | /** | 78 | #define INIT_RHT_NULLS_HEAD(ptr) \ |
| 106 | * struct rhashtable_compare_arg - Key for the function rhashtable_compare | 79 | ((ptr) = (typeof(ptr)) NULLS_MARKER(0)) |
| 107 | * @ht: Hash table | ||
| 108 | * @key: Key to compare against | ||
| 109 | */ | ||
| 110 | struct rhashtable_compare_arg { | ||
| 111 | struct rhashtable *ht; | ||
| 112 | const void *key; | ||
| 113 | }; | ||
| 114 | |||
| 115 | typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); | ||
| 116 | typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 len, u32 seed); | ||
| 117 | typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg, | ||
| 118 | const void *obj); | ||
| 119 | |||
| 120 | struct rhashtable; | ||
| 121 | |||
| 122 | /** | ||
| 123 | * struct rhashtable_params - Hash table construction parameters | ||
| 124 | * @nelem_hint: Hint on number of elements, should be 75% of desired size | ||
| 125 | * @key_len: Length of key | ||
| 126 | * @key_offset: Offset of key in struct to be hashed | ||
| 127 | * @head_offset: Offset of rhash_head in struct to be hashed | ||
| 128 | * @max_size: Maximum size while expanding | ||
| 129 | * @min_size: Minimum size while shrinking | ||
| 130 | * @locks_mul: Number of bucket locks to allocate per cpu (default: 32) | ||
| 131 | * @automatic_shrinking: Enable automatic shrinking of tables | ||
| 132 | * @nulls_base: Base value to generate nulls marker | ||
| 133 | * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash) | ||
| 134 | * @obj_hashfn: Function to hash object | ||
| 135 | * @obj_cmpfn: Function to compare key with object | ||
| 136 | */ | ||
| 137 | struct rhashtable_params { | ||
| 138 | u16 nelem_hint; | ||
| 139 | u16 key_len; | ||
| 140 | u16 key_offset; | ||
| 141 | u16 head_offset; | ||
| 142 | unsigned int max_size; | ||
| 143 | u16 min_size; | ||
| 144 | bool automatic_shrinking; | ||
| 145 | u8 locks_mul; | ||
| 146 | u32 nulls_base; | ||
| 147 | rht_hashfn_t hashfn; | ||
| 148 | rht_obj_hashfn_t obj_hashfn; | ||
| 149 | rht_obj_cmpfn_t obj_cmpfn; | ||
| 150 | }; | ||
| 151 | |||
| 152 | /** | ||
| 153 | * struct rhashtable - Hash table handle | ||
| 154 | * @tbl: Bucket table | ||
| 155 | * @key_len: Key length for hashfn | ||
| 156 | * @max_elems: Maximum number of elements in table | ||
| 157 | * @p: Configuration parameters | ||
| 158 | * @rhlist: True if this is an rhltable | ||
| 159 | * @run_work: Deferred worker to expand/shrink asynchronously | ||
| 160 | * @mutex: Mutex to protect current/future table swapping | ||
| 161 | * @lock: Spin lock to protect walker list | ||
| 162 | * @nelems: Number of elements in table | ||
| 163 | */ | ||
| 164 | struct rhashtable { | ||
| 165 | struct bucket_table __rcu *tbl; | ||
| 166 | unsigned int key_len; | ||
| 167 | unsigned int max_elems; | ||
| 168 | struct rhashtable_params p; | ||
| 169 | bool rhlist; | ||
| 170 | struct work_struct run_work; | ||
| 171 | struct mutex mutex; | ||
| 172 | spinlock_t lock; | ||
| 173 | atomic_t nelems; | ||
| 174 | }; | ||
| 175 | |||
| 176 | /** | ||
| 177 | * struct rhltable - Hash table with duplicate objects in a list | ||
| 178 | * @ht: Underlying rhtable | ||
| 179 | */ | ||
| 180 | struct rhltable { | ||
| 181 | struct rhashtable ht; | ||
| 182 | }; | ||
| 183 | |||
| 184 | /** | ||
| 185 | * struct rhashtable_walker - Hash table walker | ||
| 186 | * @list: List entry on list of walkers | ||
| 187 | * @tbl: The table that we were walking over | ||
| 188 | */ | ||
| 189 | struct rhashtable_walker { | ||
| 190 | struct list_head list; | ||
| 191 | struct bucket_table *tbl; | ||
| 192 | }; | ||
| 193 | |||
| 194 | /** | ||
| 195 | * struct rhashtable_iter - Hash table iterator | ||
| 196 | * @ht: Table to iterate through | ||
| 197 | * @p: Current pointer | ||
| 198 | * @list: Current hash list pointer | ||
| 199 | * @walker: Associated rhashtable walker | ||
| 200 | * @slot: Current slot | ||
| 201 | * @skip: Number of entries to skip in slot | ||
| 202 | */ | ||
| 203 | struct rhashtable_iter { | ||
| 204 | struct rhashtable *ht; | ||
| 205 | struct rhash_head *p; | ||
| 206 | struct rhlist_head *list; | ||
| 207 | struct rhashtable_walker walker; | ||
| 208 | unsigned int slot; | ||
| 209 | unsigned int skip; | ||
| 210 | bool end_of_table; | ||
| 211 | }; | ||
| 212 | |||
| 213 | static inline unsigned long rht_marker(const struct rhashtable *ht, u32 hash) | ||
| 214 | { | ||
| 215 | return NULLS_MARKER(ht->p.nulls_base + hash); | ||
| 216 | } | ||
| 217 | |||
| 218 | #define INIT_RHT_NULLS_HEAD(ptr, ht, hash) \ | ||
| 219 | ((ptr) = (typeof(ptr)) rht_marker(ht, hash)) | ||
| 220 | 80 | ||
| 221 | static inline bool rht_is_a_nulls(const struct rhash_head *ptr) | 81 | static inline bool rht_is_a_nulls(const struct rhash_head *ptr) |
| 222 | { | 82 | { |
| 223 | return ((unsigned long) ptr & 1); | 83 | return ((unsigned long) ptr & 1); |
| 224 | } | 84 | } |
| 225 | 85 | ||
| 226 | static inline unsigned long rht_get_nulls_value(const struct rhash_head *ptr) | ||
| 227 | { | ||
| 228 | return ((unsigned long) ptr) >> 1; | ||
| 229 | } | ||
| 230 | |||
| 231 | static inline void *rht_obj(const struct rhashtable *ht, | 86 | static inline void *rht_obj(const struct rhashtable *ht, |
| 232 | const struct rhash_head *he) | 87 | const struct rhash_head *he) |
| 233 | { | 88 | { |
| @@ -237,7 +92,7 @@ static inline void *rht_obj(const struct rhashtable *ht, | |||
| 237 | static inline unsigned int rht_bucket_index(const struct bucket_table *tbl, | 92 | static inline unsigned int rht_bucket_index(const struct bucket_table *tbl, |
| 238 | unsigned int hash) | 93 | unsigned int hash) |
| 239 | { | 94 | { |
| 240 | return (hash >> RHT_HASH_RESERVED_SPACE) & (tbl->size - 1); | 95 | return hash & (tbl->size - 1); |
| 241 | } | 96 | } |
| 242 | 97 | ||
| 243 | static inline unsigned int rht_key_get_hash(struct rhashtable *ht, | 98 | static inline unsigned int rht_key_get_hash(struct rhashtable *ht, |
| @@ -376,11 +231,6 @@ static inline int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, | |||
| 376 | } | 231 | } |
| 377 | #endif /* CONFIG_PROVE_LOCKING */ | 232 | #endif /* CONFIG_PROVE_LOCKING */ |
| 378 | 233 | ||
| 379 | int rhashtable_init(struct rhashtable *ht, | ||
| 380 | const struct rhashtable_params *params); | ||
| 381 | int rhltable_init(struct rhltable *hlt, | ||
| 382 | const struct rhashtable_params *params); | ||
| 383 | |||
| 384 | void *rhashtable_insert_slow(struct rhashtable *ht, const void *key, | 234 | void *rhashtable_insert_slow(struct rhashtable *ht, const void *key, |
| 385 | struct rhash_head *obj); | 235 | struct rhash_head *obj); |
| 386 | 236 | ||
| @@ -745,7 +595,7 @@ static inline void *__rhashtable_insert_fast( | |||
| 745 | lock = rht_bucket_lock(tbl, hash); | 595 | lock = rht_bucket_lock(tbl, hash); |
| 746 | spin_lock_bh(lock); | 596 | spin_lock_bh(lock); |
| 747 | 597 | ||
| 748 | if (unlikely(rht_dereference_bucket(tbl->future_tbl, tbl, hash))) { | 598 | if (unlikely(rcu_access_pointer(tbl->future_tbl))) { |
| 749 | slow_path: | 599 | slow_path: |
| 750 | spin_unlock_bh(lock); | 600 | spin_unlock_bh(lock); |
| 751 | rcu_read_unlock(); | 601 | rcu_read_unlock(); |
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h index e6539536dea9..804a50983ec5 100644 --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | 25 | ||
| 26 | struct seq_file; | ||
| 27 | |||
| 26 | /** | 28 | /** |
| 27 | * struct sbitmap_word - Word in a &struct sbitmap. | 29 | * struct sbitmap_word - Word in a &struct sbitmap. |
| 28 | */ | 30 | */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 43731fe51c97..95a5018c338e 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -167,8 +167,8 @@ struct task_group; | |||
| 167 | * need_sleep = false; | 167 | * need_sleep = false; |
| 168 | * wake_up_state(p, TASK_UNINTERRUPTIBLE); | 168 | * wake_up_state(p, TASK_UNINTERRUPTIBLE); |
| 169 | * | 169 | * |
| 170 | * Where wake_up_state() (and all other wakeup primitives) imply enough | 170 | * where wake_up_state() executes a full memory barrier before accessing the |
| 171 | * barriers to order the store of the variable against wakeup. | 171 | * task state. |
| 172 | * | 172 | * |
| 173 | * Wakeup will do: if (@state & p->state) p->state = TASK_RUNNING, that is, | 173 | * Wakeup will do: if (@state & p->state) p->state = TASK_RUNNING, that is, |
| 174 | * once it observes the TASK_UNINTERRUPTIBLE store the waking CPU can issue a | 174 | * once it observes the TASK_UNINTERRUPTIBLE store the waking CPU can issue a |
| @@ -734,6 +734,10 @@ struct task_struct { | |||
| 734 | /* disallow userland-initiated cgroup migration */ | 734 | /* disallow userland-initiated cgroup migration */ |
| 735 | unsigned no_cgroup_migration:1; | 735 | unsigned no_cgroup_migration:1; |
| 736 | #endif | 736 | #endif |
| 737 | #ifdef CONFIG_BLK_CGROUP | ||
| 738 | /* to be used once the psi infrastructure lands upstream. */ | ||
| 739 | unsigned use_memdelay:1; | ||
| 740 | #endif | ||
| 737 | 741 | ||
| 738 | unsigned long atomic_flags; /* Flags requiring atomic access. */ | 742 | unsigned long atomic_flags; /* Flags requiring atomic access. */ |
| 739 | 743 | ||
| @@ -1017,7 +1021,6 @@ struct task_struct { | |||
| 1017 | u64 last_sum_exec_runtime; | 1021 | u64 last_sum_exec_runtime; |
| 1018 | struct callback_head numa_work; | 1022 | struct callback_head numa_work; |
| 1019 | 1023 | ||
| 1020 | struct list_head numa_entry; | ||
| 1021 | struct numa_group *numa_group; | 1024 | struct numa_group *numa_group; |
| 1022 | 1025 | ||
| 1023 | /* | 1026 | /* |
| @@ -1151,6 +1154,10 @@ struct task_struct { | |||
| 1151 | unsigned int memcg_nr_pages_over_high; | 1154 | unsigned int memcg_nr_pages_over_high; |
| 1152 | #endif | 1155 | #endif |
| 1153 | 1156 | ||
| 1157 | #ifdef CONFIG_BLK_CGROUP | ||
| 1158 | struct request_queue *throttle_queue; | ||
| 1159 | #endif | ||
| 1160 | |||
| 1154 | #ifdef CONFIG_UPROBES | 1161 | #ifdef CONFIG_UPROBES |
| 1155 | struct uprobe_task *utask; | 1162 | struct uprobe_task *utask; |
| 1156 | #endif | 1163 | #endif |
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index 1c1a1512ec55..913488d828cb 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h | |||
| @@ -40,7 +40,6 @@ extern unsigned int sysctl_numa_balancing_scan_size; | |||
| 40 | #ifdef CONFIG_SCHED_DEBUG | 40 | #ifdef CONFIG_SCHED_DEBUG |
| 41 | extern __read_mostly unsigned int sysctl_sched_migration_cost; | 41 | extern __read_mostly unsigned int sysctl_sched_migration_cost; |
| 42 | extern __read_mostly unsigned int sysctl_sched_nr_migrate; | 42 | extern __read_mostly unsigned int sysctl_sched_nr_migrate; |
| 43 | extern __read_mostly unsigned int sysctl_sched_time_avg; | ||
| 44 | 43 | ||
| 45 | int sched_proc_update_handler(struct ctl_table *table, int write, | 44 | int sched_proc_update_handler(struct ctl_table *table, int write, |
| 46 | void __user *buffer, size_t *length, | 45 | void __user *buffer, size_t *length, |
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h index 411b52e424e1..abe28d5cb3f4 100644 --- a/include/linux/sched_clock.h +++ b/include/linux/sched_clock.h | |||
| @@ -9,17 +9,16 @@ | |||
| 9 | #define LINUX_SCHED_CLOCK | 9 | #define LINUX_SCHED_CLOCK |
| 10 | 10 | ||
| 11 | #ifdef CONFIG_GENERIC_SCHED_CLOCK | 11 | #ifdef CONFIG_GENERIC_SCHED_CLOCK |
| 12 | extern void sched_clock_postinit(void); | 12 | extern void generic_sched_clock_init(void); |
| 13 | 13 | ||
| 14 | extern void sched_clock_register(u64 (*read)(void), int bits, | 14 | extern void sched_clock_register(u64 (*read)(void), int bits, |
| 15 | unsigned long rate); | 15 | unsigned long rate); |
| 16 | #else | 16 | #else |
| 17 | static inline void sched_clock_postinit(void) { } | 17 | static inline void generic_sched_clock_init(void) { } |
| 18 | 18 | ||
| 19 | static inline void sched_clock_register(u64 (*read)(void), int bits, | 19 | static inline void sched_clock_register(u64 (*read)(void), int bits, |
| 20 | unsigned long rate) | 20 | unsigned long rate) |
| 21 | { | 21 | { |
| 22 | ; | ||
| 23 | } | 22 | } |
| 24 | #endif | 23 | #endif |
| 25 | 24 | ||
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index b36c76635f18..83d94341e003 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
| @@ -801,4 +801,11 @@ struct sctp_strreset_resptsn { | |||
| 801 | __be32 receivers_next_tsn; | 801 | __be32 receivers_next_tsn; |
| 802 | }; | 802 | }; |
| 803 | 803 | ||
| 804 | enum { | ||
| 805 | SCTP_DSCP_SET_MASK = 0x1, | ||
| 806 | SCTP_DSCP_VAL_MASK = 0xfc, | ||
| 807 | SCTP_FLOWLABEL_SET_MASK = 0x100000, | ||
| 808 | SCTP_FLOWLABEL_VAL_MASK = 0xfffff | ||
| 809 | }; | ||
| 810 | |||
| 804 | #endif /* __LINUX_SCTP_H__ */ | 811 | #endif /* __LINUX_SCTP_H__ */ |
diff --git a/include/linux/security.h b/include/linux/security.h index 63030c85ee19..75f4156c84d7 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -159,6 +159,27 @@ extern int mmap_min_addr_handler(struct ctl_table *table, int write, | |||
| 159 | typedef int (*initxattrs) (struct inode *inode, | 159 | typedef int (*initxattrs) (struct inode *inode, |
| 160 | const struct xattr *xattr_array, void *fs_data); | 160 | const struct xattr *xattr_array, void *fs_data); |
| 161 | 161 | ||
| 162 | |||
| 163 | /* Keep the kernel_load_data_id enum in sync with kernel_read_file_id */ | ||
| 164 | #define __data_id_enumify(ENUM, dummy) LOADING_ ## ENUM, | ||
| 165 | #define __data_id_stringify(dummy, str) #str, | ||
| 166 | |||
| 167 | enum kernel_load_data_id { | ||
| 168 | __kernel_read_file_id(__data_id_enumify) | ||
| 169 | }; | ||
| 170 | |||
| 171 | static const char * const kernel_load_data_str[] = { | ||
| 172 | __kernel_read_file_id(__data_id_stringify) | ||
| 173 | }; | ||
| 174 | |||
| 175 | static inline const char *kernel_load_data_id_str(enum kernel_load_data_id id) | ||
| 176 | { | ||
| 177 | if ((unsigned)id >= LOADING_MAX_ID) | ||
| 178 | return kernel_load_data_str[LOADING_UNKNOWN]; | ||
| 179 | |||
| 180 | return kernel_load_data_str[id]; | ||
| 181 | } | ||
| 182 | |||
| 162 | #ifdef CONFIG_SECURITY | 183 | #ifdef CONFIG_SECURITY |
| 163 | 184 | ||
| 164 | struct security_mnt_opts { | 185 | struct security_mnt_opts { |
| @@ -309,7 +330,7 @@ void security_file_set_fowner(struct file *file); | |||
| 309 | int security_file_send_sigiotask(struct task_struct *tsk, | 330 | int security_file_send_sigiotask(struct task_struct *tsk, |
| 310 | struct fown_struct *fown, int sig); | 331 | struct fown_struct *fown, int sig); |
| 311 | int security_file_receive(struct file *file); | 332 | int security_file_receive(struct file *file); |
| 312 | int security_file_open(struct file *file, const struct cred *cred); | 333 | int security_file_open(struct file *file); |
| 313 | int security_task_alloc(struct task_struct *task, unsigned long clone_flags); | 334 | int security_task_alloc(struct task_struct *task, unsigned long clone_flags); |
| 314 | void security_task_free(struct task_struct *task); | 335 | void security_task_free(struct task_struct *task); |
| 315 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); | 336 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); |
| @@ -320,6 +341,7 @@ void security_cred_getsecid(const struct cred *c, u32 *secid); | |||
| 320 | int security_kernel_act_as(struct cred *new, u32 secid); | 341 | int security_kernel_act_as(struct cred *new, u32 secid); |
| 321 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); | 342 | int security_kernel_create_files_as(struct cred *new, struct inode *inode); |
| 322 | int security_kernel_module_request(char *kmod_name); | 343 | int security_kernel_module_request(char *kmod_name); |
| 344 | int security_kernel_load_data(enum kernel_load_data_id id); | ||
| 323 | int security_kernel_read_file(struct file *file, enum kernel_read_file_id id); | 345 | int security_kernel_read_file(struct file *file, enum kernel_read_file_id id); |
| 324 | int security_kernel_post_read_file(struct file *file, char *buf, loff_t size, | 346 | int security_kernel_post_read_file(struct file *file, char *buf, loff_t size, |
| 325 | enum kernel_read_file_id id); | 347 | enum kernel_read_file_id id); |
| @@ -858,8 +880,7 @@ static inline int security_file_receive(struct file *file) | |||
| 858 | return 0; | 880 | return 0; |
| 859 | } | 881 | } |
| 860 | 882 | ||
| 861 | static inline int security_file_open(struct file *file, | 883 | static inline int security_file_open(struct file *file) |
| 862 | const struct cred *cred) | ||
| 863 | { | 884 | { |
| 864 | return 0; | 885 | return 0; |
| 865 | } | 886 | } |
| @@ -909,6 +930,11 @@ static inline int security_kernel_module_request(char *kmod_name) | |||
| 909 | return 0; | 930 | return 0; |
| 910 | } | 931 | } |
| 911 | 932 | ||
| 933 | static inline int security_kernel_load_data(enum kernel_load_data_id id) | ||
| 934 | { | ||
| 935 | return 0; | ||
| 936 | } | ||
| 937 | |||
| 912 | static inline int security_kernel_read_file(struct file *file, | 938 | static inline int security_kernel_read_file(struct file *file, |
| 913 | enum kernel_read_file_id id) | 939 | enum kernel_read_file_id id) |
| 914 | { | 940 | { |
diff --git a/include/linux/sfp.h b/include/linux/sfp.h index ebce9e24906a..d37518e89db2 100644 --- a/include/linux/sfp.h +++ b/include/linux/sfp.h | |||
| @@ -231,6 +231,50 @@ struct sfp_eeprom_id { | |||
| 231 | struct sfp_eeprom_ext ext; | 231 | struct sfp_eeprom_ext ext; |
| 232 | } __packed; | 232 | } __packed; |
| 233 | 233 | ||
| 234 | struct sfp_diag { | ||
| 235 | __be16 temp_high_alarm; | ||
| 236 | __be16 temp_low_alarm; | ||
| 237 | __be16 temp_high_warn; | ||
| 238 | __be16 temp_low_warn; | ||
| 239 | __be16 volt_high_alarm; | ||
| 240 | __be16 volt_low_alarm; | ||
| 241 | __be16 volt_high_warn; | ||
| 242 | __be16 volt_low_warn; | ||
| 243 | __be16 bias_high_alarm; | ||
| 244 | __be16 bias_low_alarm; | ||
| 245 | __be16 bias_high_warn; | ||
| 246 | __be16 bias_low_warn; | ||
| 247 | __be16 txpwr_high_alarm; | ||
| 248 | __be16 txpwr_low_alarm; | ||
| 249 | __be16 txpwr_high_warn; | ||
| 250 | __be16 txpwr_low_warn; | ||
| 251 | __be16 rxpwr_high_alarm; | ||
| 252 | __be16 rxpwr_low_alarm; | ||
| 253 | __be16 rxpwr_high_warn; | ||
| 254 | __be16 rxpwr_low_warn; | ||
| 255 | __be16 laser_temp_high_alarm; | ||
| 256 | __be16 laser_temp_low_alarm; | ||
| 257 | __be16 laser_temp_high_warn; | ||
| 258 | __be16 laser_temp_low_warn; | ||
| 259 | __be16 tec_cur_high_alarm; | ||
| 260 | __be16 tec_cur_low_alarm; | ||
| 261 | __be16 tec_cur_high_warn; | ||
| 262 | __be16 tec_cur_low_warn; | ||
| 263 | __be32 cal_rxpwr4; | ||
| 264 | __be32 cal_rxpwr3; | ||
| 265 | __be32 cal_rxpwr2; | ||
| 266 | __be32 cal_rxpwr1; | ||
| 267 | __be32 cal_rxpwr0; | ||
| 268 | __be16 cal_txi_slope; | ||
| 269 | __be16 cal_txi_offset; | ||
| 270 | __be16 cal_txpwr_slope; | ||
| 271 | __be16 cal_txpwr_offset; | ||
| 272 | __be16 cal_t_slope; | ||
| 273 | __be16 cal_t_offset; | ||
| 274 | __be16 cal_v_slope; | ||
| 275 | __be16 cal_v_offset; | ||
| 276 | } __packed; | ||
| 277 | |||
| 234 | /* SFP EEPROM registers */ | 278 | /* SFP EEPROM registers */ |
| 235 | enum { | 279 | enum { |
| 236 | SFP_PHYS_ID = 0x00, | 280 | SFP_PHYS_ID = 0x00, |
| @@ -384,7 +428,33 @@ enum { | |||
| 384 | SFP_TEC_CUR = 0x6c, | 428 | SFP_TEC_CUR = 0x6c, |
| 385 | 429 | ||
| 386 | SFP_STATUS = 0x6e, | 430 | SFP_STATUS = 0x6e, |
| 387 | SFP_ALARM = 0x70, | 431 | SFP_ALARM0 = 0x70, |
| 432 | SFP_ALARM0_TEMP_HIGH = BIT(7), | ||
| 433 | SFP_ALARM0_TEMP_LOW = BIT(6), | ||
| 434 | SFP_ALARM0_VCC_HIGH = BIT(5), | ||
| 435 | SFP_ALARM0_VCC_LOW = BIT(4), | ||
| 436 | SFP_ALARM0_TX_BIAS_HIGH = BIT(3), | ||
| 437 | SFP_ALARM0_TX_BIAS_LOW = BIT(2), | ||
| 438 | SFP_ALARM0_TXPWR_HIGH = BIT(1), | ||
| 439 | SFP_ALARM0_TXPWR_LOW = BIT(0), | ||
| 440 | |||
| 441 | SFP_ALARM1 = 0x71, | ||
| 442 | SFP_ALARM1_RXPWR_HIGH = BIT(7), | ||
| 443 | SFP_ALARM1_RXPWR_LOW = BIT(6), | ||
| 444 | |||
| 445 | SFP_WARN0 = 0x74, | ||
| 446 | SFP_WARN0_TEMP_HIGH = BIT(7), | ||
| 447 | SFP_WARN0_TEMP_LOW = BIT(6), | ||
| 448 | SFP_WARN0_VCC_HIGH = BIT(5), | ||
| 449 | SFP_WARN0_VCC_LOW = BIT(4), | ||
| 450 | SFP_WARN0_TX_BIAS_HIGH = BIT(3), | ||
| 451 | SFP_WARN0_TX_BIAS_LOW = BIT(2), | ||
| 452 | SFP_WARN0_TXPWR_HIGH = BIT(1), | ||
| 453 | SFP_WARN0_TXPWR_LOW = BIT(0), | ||
| 454 | |||
| 455 | SFP_WARN1 = 0x75, | ||
| 456 | SFP_WARN1_RXPWR_HIGH = BIT(7), | ||
| 457 | SFP_WARN1_RXPWR_LOW = BIT(6), | ||
| 388 | 458 | ||
| 389 | SFP_EXT_STATUS = 0x76, | 459 | SFP_EXT_STATUS = 0x76, |
| 390 | SFP_VSL = 0x78, | 460 | SFP_VSL = 0x78, |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 610a201126ee..17a13e4785fc 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -641,6 +641,7 @@ typedef unsigned char *sk_buff_data_t; | |||
| 641 | * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS | 641 | * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS |
| 642 | * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL | 642 | * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL |
| 643 | * @dst_pending_confirm: need to confirm neighbour | 643 | * @dst_pending_confirm: need to confirm neighbour |
| 644 | * @decrypted: Decrypted SKB | ||
| 644 | * @napi_id: id of the NAPI struct this skb came from | 645 | * @napi_id: id of the NAPI struct this skb came from |
| 645 | * @secmark: security marking | 646 | * @secmark: security marking |
| 646 | * @mark: Generic packet mark | 647 | * @mark: Generic packet mark |
| @@ -675,12 +676,16 @@ struct sk_buff { | |||
| 675 | * UDP receive path is one user. | 676 | * UDP receive path is one user. |
| 676 | */ | 677 | */ |
| 677 | unsigned long dev_scratch; | 678 | unsigned long dev_scratch; |
| 678 | int ip_defrag_offset; | ||
| 679 | }; | 679 | }; |
| 680 | }; | 680 | }; |
| 681 | struct rb_node rbnode; /* used in netem & tcp stack */ | 681 | struct rb_node rbnode; /* used in netem, ip4 defrag, and tcp stack */ |
| 682 | struct list_head list; | ||
| 683 | }; | ||
| 684 | |||
| 685 | union { | ||
| 686 | struct sock *sk; | ||
| 687 | int ip_defrag_offset; | ||
| 682 | }; | 688 | }; |
| 683 | struct sock *sk; | ||
| 684 | 689 | ||
| 685 | union { | 690 | union { |
| 686 | ktime_t tstamp; | 691 | ktime_t tstamp; |
| @@ -791,6 +796,9 @@ struct sk_buff { | |||
| 791 | __u8 tc_redirected:1; | 796 | __u8 tc_redirected:1; |
| 792 | __u8 tc_from_ingress:1; | 797 | __u8 tc_from_ingress:1; |
| 793 | #endif | 798 | #endif |
| 799 | #ifdef CONFIG_TLS_DEVICE | ||
| 800 | __u8 decrypted:1; | ||
| 801 | #endif | ||
| 794 | 802 | ||
| 795 | #ifdef CONFIG_NET_SCHED | 803 | #ifdef CONFIG_NET_SCHED |
| 796 | __u16 tc_index; /* traffic control index */ | 804 | __u16 tc_index; /* traffic control index */ |
| @@ -1030,6 +1038,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | |||
| 1030 | } | 1038 | } |
| 1031 | 1039 | ||
| 1032 | struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); | 1040 | struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); |
| 1041 | void skb_headers_offset_update(struct sk_buff *skb, int off); | ||
| 1033 | int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); | 1042 | int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); |
| 1034 | struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); | 1043 | struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); |
| 1035 | void skb_copy_header(struct sk_buff *new, const struct sk_buff *old); | 1044 | void skb_copy_header(struct sk_buff *new, const struct sk_buff *old); |
| @@ -2354,7 +2363,7 @@ static inline void skb_probe_transport_header(struct sk_buff *skb, | |||
| 2354 | if (skb_transport_header_was_set(skb)) | 2363 | if (skb_transport_header_was_set(skb)) |
| 2355 | return; | 2364 | return; |
| 2356 | 2365 | ||
| 2357 | if (skb_flow_dissect_flow_keys_basic(skb, &keys, 0, 0, 0, 0, 0)) | 2366 | if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0)) |
| 2358 | skb_set_transport_header(skb, keys.control.thoff); | 2367 | skb_set_transport_header(skb, keys.control.thoff); |
| 2359 | else | 2368 | else |
| 2360 | skb_set_transport_header(skb, offset_hint); | 2369 | skb_set_transport_header(skb, offset_hint); |
| @@ -2580,7 +2589,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list) | |||
| 2580 | kfree_skb(skb); | 2589 | kfree_skb(skb); |
| 2581 | } | 2590 | } |
| 2582 | 2591 | ||
| 2583 | void skb_rbtree_purge(struct rb_root *root); | 2592 | unsigned int skb_rbtree_purge(struct rb_root *root); |
| 2584 | 2593 | ||
| 2585 | void *netdev_alloc_frag(unsigned int fragsz); | 2594 | void *netdev_alloc_frag(unsigned int fragsz); |
| 2586 | 2595 | ||
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h index c174844cf663..d0884b525001 100644 --- a/include/linux/smpboot.h +++ b/include/linux/smpboot.h | |||
| @@ -25,8 +25,6 @@ struct smpboot_thread_data; | |||
| 25 | * parked (cpu offline) | 25 | * parked (cpu offline) |
| 26 | * @unpark: Optional unpark function, called when the thread is | 26 | * @unpark: Optional unpark function, called when the thread is |
| 27 | * unparked (cpu online) | 27 | * unparked (cpu online) |
| 28 | * @cpumask: Internal state. To update which threads are unparked, | ||
| 29 | * call smpboot_update_cpumask_percpu_thread(). | ||
| 30 | * @selfparking: Thread is not parked by the park function. | 28 | * @selfparking: Thread is not parked by the park function. |
| 31 | * @thread_comm: The base name of the thread | 29 | * @thread_comm: The base name of the thread |
| 32 | */ | 30 | */ |
| @@ -40,23 +38,12 @@ struct smp_hotplug_thread { | |||
| 40 | void (*cleanup)(unsigned int cpu, bool online); | 38 | void (*cleanup)(unsigned int cpu, bool online); |
| 41 | void (*park)(unsigned int cpu); | 39 | void (*park)(unsigned int cpu); |
| 42 | void (*unpark)(unsigned int cpu); | 40 | void (*unpark)(unsigned int cpu); |
| 43 | cpumask_var_t cpumask; | ||
| 44 | bool selfparking; | 41 | bool selfparking; |
| 45 | const char *thread_comm; | 42 | const char *thread_comm; |
| 46 | }; | 43 | }; |
| 47 | 44 | ||
| 48 | int smpboot_register_percpu_thread_cpumask(struct smp_hotplug_thread *plug_thread, | 45 | int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread); |
| 49 | const struct cpumask *cpumask); | ||
| 50 | |||
| 51 | static inline int | ||
| 52 | smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread) | ||
| 53 | { | ||
| 54 | return smpboot_register_percpu_thread_cpumask(plug_thread, | ||
| 55 | cpu_possible_mask); | ||
| 56 | } | ||
| 57 | 46 | ||
| 58 | void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread); | 47 | void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread); |
| 59 | void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, | ||
| 60 | const struct cpumask *); | ||
| 61 | 48 | ||
| 62 | #endif | 49 | #endif |
diff --git a/include/linux/soc/qcom/llcc-qcom.h b/include/linux/soc/qcom/llcc-qcom.h new file mode 100644 index 000000000000..7e3b9c605ab2 --- /dev/null +++ b/include/linux/soc/qcom/llcc-qcom.h | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. | ||
| 4 | * | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include <linux/platform_device.h> | ||
| 8 | #ifndef __LLCC_QCOM__ | ||
| 9 | #define __LLCC_QCOM__ | ||
| 10 | |||
| 11 | #define LLCC_CPUSS 1 | ||
| 12 | #define LLCC_VIDSC0 2 | ||
| 13 | #define LLCC_VIDSC1 3 | ||
| 14 | #define LLCC_ROTATOR 4 | ||
| 15 | #define LLCC_VOICE 5 | ||
| 16 | #define LLCC_AUDIO 6 | ||
| 17 | #define LLCC_MDMHPGRW 7 | ||
| 18 | #define LLCC_MDM 8 | ||
| 19 | #define LLCC_CMPT 10 | ||
| 20 | #define LLCC_GPUHTW 11 | ||
| 21 | #define LLCC_GPU 12 | ||
| 22 | #define LLCC_MMUHWT 13 | ||
| 23 | #define LLCC_CMPTDMA 15 | ||
| 24 | #define LLCC_DISP 16 | ||
| 25 | #define LLCC_VIDFW 17 | ||
| 26 | #define LLCC_MDMHPFX 20 | ||
| 27 | #define LLCC_MDMPNG 21 | ||
| 28 | #define LLCC_AUDHW 22 | ||
| 29 | |||
| 30 | /** | ||
| 31 | * llcc_slice_desc - Cache slice descriptor | ||
| 32 | * @slice_id: llcc slice id | ||
| 33 | * @slice_size: Size allocated for the llcc slice | ||
| 34 | */ | ||
| 35 | struct llcc_slice_desc { | ||
| 36 | u32 slice_id; | ||
| 37 | size_t slice_size; | ||
| 38 | }; | ||
| 39 | |||
| 40 | /** | ||
| 41 | * llcc_slice_config - Data associated with the llcc slice | ||
| 42 | * @usecase_id: usecase id for which the llcc slice is used | ||
| 43 | * @slice_id: llcc slice id assigned to each slice | ||
| 44 | * @max_cap: maximum capacity of the llcc slice | ||
| 45 | * @priority: priority of the llcc slice | ||
| 46 | * @fixed_size: whether the llcc slice can grow beyond its size | ||
| 47 | * @bonus_ways: bonus ways associated with llcc slice | ||
| 48 | * @res_ways: reserved ways associated with llcc slice | ||
| 49 | * @cache_mode: mode of the llcc slice | ||
| 50 | * @probe_target_ways: Probe only reserved and bonus ways on a cache miss | ||
| 51 | * @dis_cap_alloc: Disable capacity based allocation | ||
| 52 | * @retain_on_pc: Retain through power collapse | ||
| 53 | * @activate_on_init: activate the slice on init | ||
| 54 | */ | ||
| 55 | struct llcc_slice_config { | ||
| 56 | u32 usecase_id; | ||
| 57 | u32 slice_id; | ||
| 58 | u32 max_cap; | ||
| 59 | u32 priority; | ||
| 60 | bool fixed_size; | ||
| 61 | u32 bonus_ways; | ||
| 62 | u32 res_ways; | ||
| 63 | u32 cache_mode; | ||
| 64 | u32 probe_target_ways; | ||
| 65 | bool dis_cap_alloc; | ||
| 66 | bool retain_on_pc; | ||
| 67 | bool activate_on_init; | ||
| 68 | }; | ||
| 69 | |||
| 70 | /** | ||
| 71 | * llcc_drv_data - Data associated with the llcc driver | ||
| 72 | * @regmap: regmap associated with the llcc device | ||
| 73 | * @cfg: pointer to the data structure for slice configuration | ||
| 74 | * @lock: mutex associated with each slice | ||
| 75 | * @cfg_size: size of the config data table | ||
| 76 | * @max_slices: max slices as read from device tree | ||
| 77 | * @bcast_off: Offset of the broadcast bank | ||
| 78 | * @num_banks: Number of llcc banks | ||
| 79 | * @bitmap: Bit map to track the active slice ids | ||
| 80 | * @offsets: Pointer to the bank offsets array | ||
| 81 | */ | ||
| 82 | struct llcc_drv_data { | ||
| 83 | struct regmap *regmap; | ||
| 84 | const struct llcc_slice_config *cfg; | ||
| 85 | struct mutex lock; | ||
| 86 | u32 cfg_size; | ||
| 87 | u32 max_slices; | ||
| 88 | u32 bcast_off; | ||
| 89 | u32 num_banks; | ||
| 90 | unsigned long *bitmap; | ||
| 91 | u32 *offsets; | ||
| 92 | }; | ||
| 93 | |||
| 94 | #if IS_ENABLED(CONFIG_QCOM_LLCC) | ||
| 95 | /** | ||
| 96 | * llcc_slice_getd - get llcc slice descriptor | ||
| 97 | * @uid: usecase_id of the client | ||
| 98 | */ | ||
| 99 | struct llcc_slice_desc *llcc_slice_getd(u32 uid); | ||
| 100 | |||
| 101 | /** | ||
| 102 | * llcc_slice_putd - llcc slice descritpor | ||
| 103 | * @desc: Pointer to llcc slice descriptor | ||
| 104 | */ | ||
| 105 | void llcc_slice_putd(struct llcc_slice_desc *desc); | ||
| 106 | |||
| 107 | /** | ||
| 108 | * llcc_get_slice_id - get slice id | ||
| 109 | * @desc: Pointer to llcc slice descriptor | ||
| 110 | */ | ||
| 111 | int llcc_get_slice_id(struct llcc_slice_desc *desc); | ||
| 112 | |||
| 113 | /** | ||
| 114 | * llcc_get_slice_size - llcc slice size | ||
| 115 | * @desc: Pointer to llcc slice descriptor | ||
| 116 | */ | ||
| 117 | size_t llcc_get_slice_size(struct llcc_slice_desc *desc); | ||
| 118 | |||
| 119 | /** | ||
| 120 | * llcc_slice_activate - Activate the llcc slice | ||
| 121 | * @desc: Pointer to llcc slice descriptor | ||
| 122 | */ | ||
| 123 | int llcc_slice_activate(struct llcc_slice_desc *desc); | ||
| 124 | |||
| 125 | /** | ||
| 126 | * llcc_slice_deactivate - Deactivate the llcc slice | ||
| 127 | * @desc: Pointer to llcc slice descriptor | ||
| 128 | */ | ||
| 129 | int llcc_slice_deactivate(struct llcc_slice_desc *desc); | ||
| 130 | |||
| 131 | /** | ||
| 132 | * qcom_llcc_probe - program the sct table | ||
| 133 | * @pdev: platform device pointer | ||
| 134 | * @table: soc sct table | ||
| 135 | * @sz: Size of the config table | ||
| 136 | */ | ||
| 137 | int qcom_llcc_probe(struct platform_device *pdev, | ||
| 138 | const struct llcc_slice_config *table, u32 sz); | ||
| 139 | #else | ||
| 140 | static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid) | ||
| 141 | { | ||
| 142 | return NULL; | ||
| 143 | } | ||
| 144 | |||
| 145 | static inline void llcc_slice_putd(struct llcc_slice_desc *desc) | ||
| 146 | { | ||
| 147 | |||
| 148 | }; | ||
| 149 | |||
| 150 | static inline int llcc_get_slice_id(struct llcc_slice_desc *desc) | ||
| 151 | { | ||
| 152 | return -EINVAL; | ||
| 153 | } | ||
| 154 | |||
| 155 | static inline size_t llcc_get_slice_size(struct llcc_slice_desc *desc) | ||
| 156 | { | ||
| 157 | return 0; | ||
| 158 | } | ||
| 159 | static inline int llcc_slice_activate(struct llcc_slice_desc *desc) | ||
| 160 | { | ||
| 161 | return -EINVAL; | ||
| 162 | } | ||
| 163 | |||
| 164 | static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc) | ||
| 165 | { | ||
| 166 | return -EINVAL; | ||
| 167 | } | ||
| 168 | static inline int qcom_llcc_probe(struct platform_device *pdev, | ||
| 169 | const struct llcc_slice_config *table, u32 sz) | ||
| 170 | { | ||
| 171 | return -ENODEV; | ||
| 172 | } | ||
| 173 | |||
| 174 | static inline int qcom_llcc_remove(struct platform_device *pdev) | ||
| 175 | { | ||
| 176 | return -ENODEV; | ||
| 177 | } | ||
| 178 | #endif | ||
| 179 | |||
| 180 | #endif | ||
diff --git a/include/linux/soc/samsung/exynos-regs-pmu.h b/include/linux/soc/samsung/exynos-regs-pmu.h index 66dcb9ec273a..5addaf5ccbce 100644 --- a/include/linux/soc/samsung/exynos-regs-pmu.h +++ b/include/linux/soc/samsung/exynos-regs-pmu.h | |||
| @@ -42,7 +42,9 @@ | |||
| 42 | #define EXYNOS_SWRESET 0x0400 | 42 | #define EXYNOS_SWRESET 0x0400 |
| 43 | 43 | ||
| 44 | #define S5P_WAKEUP_STAT 0x0600 | 44 | #define S5P_WAKEUP_STAT 0x0600 |
| 45 | #define S5P_EINT_WAKEUP_MASK 0x0604 | 45 | /* Value for EXYNOS_EINT_WAKEUP_MASK disabling all external wakeup interrupts */ |
| 46 | #define EXYNOS_EINT_WAKEUP_MASK_DISABLED 0xffffffff | ||
| 47 | #define EXYNOS_EINT_WAKEUP_MASK 0x0604 | ||
| 46 | #define S5P_WAKEUP_MASK 0x0608 | 48 | #define S5P_WAKEUP_MASK 0x0608 |
| 47 | #define S5P_WAKEUP_MASK2 0x0614 | 49 | #define S5P_WAKEUP_MASK2 0x0614 |
| 48 | 50 | ||
| @@ -180,6 +182,9 @@ | |||
| 180 | #define S5P_CORE_WAKEUP_FROM_LOCAL_CFG (0x3 << 8) | 182 | #define S5P_CORE_WAKEUP_FROM_LOCAL_CFG (0x3 << 8) |
| 181 | #define S5P_CORE_AUTOWAKEUP_EN (1 << 31) | 183 | #define S5P_CORE_AUTOWAKEUP_EN (1 << 31) |
| 182 | 184 | ||
| 185 | /* Only for S5Pv210 */ | ||
| 186 | #define S5PV210_EINT_WAKEUP_MASK 0xC004 | ||
| 187 | |||
| 183 | /* Only for EXYNOS4210 */ | 188 | /* Only for EXYNOS4210 */ |
| 184 | #define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154 | 189 | #define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154 |
| 185 | #define S5P_CMU_RESET_LCD1_LOWPWR 0x1174 | 190 | #define S5P_CMU_RESET_LCD1_LOWPWR 0x1174 |
| @@ -641,6 +646,7 @@ | |||
| 641 | | EXYNOS5420_KFC_USE_STANDBY_WFI3) | 646 | | EXYNOS5420_KFC_USE_STANDBY_WFI3) |
| 642 | 647 | ||
| 643 | /* For EXYNOS5433 */ | 648 | /* For EXYNOS5433 */ |
| 649 | #define EXYNOS5433_EINT_WAKEUP_MASK (0x060C) | ||
| 644 | #define EXYNOS5433_USBHOST30_PHY_CONTROL (0x0728) | 650 | #define EXYNOS5433_USBHOST30_PHY_CONTROL (0x0728) |
| 645 | #define EXYNOS5433_PAD_RETENTION_AUD_OPTION (0x3028) | 651 | #define EXYNOS5433_PAD_RETENTION_AUD_OPTION (0x3028) |
| 646 | #define EXYNOS5433_PAD_RETENTION_MMC2_OPTION (0x30C8) | 652 | #define EXYNOS5433_PAD_RETENTION_MMC2_OPTION (0x30C8) |
diff --git a/include/linux/spi/adi_spi3.h b/include/linux/spi/adi_spi3.h deleted file mode 100644 index c84123aa1d06..000000000000 --- a/include/linux/spi/adi_spi3.h +++ /dev/null | |||
| @@ -1,254 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Analog Devices SPI3 controller driver | ||
| 3 | * | ||
| 4 | * Copyright (c) 2014 Analog Devices Inc. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef _ADI_SPI3_H_ | ||
| 17 | #define _ADI_SPI3_H_ | ||
| 18 | |||
| 19 | #include <linux/types.h> | ||
| 20 | |||
| 21 | /* SPI_CONTROL */ | ||
| 22 | #define SPI_CTL_EN 0x00000001 /* Enable */ | ||
| 23 | #define SPI_CTL_MSTR 0x00000002 /* Master/Slave */ | ||
| 24 | #define SPI_CTL_PSSE 0x00000004 /* controls modf error in master mode */ | ||
| 25 | #define SPI_CTL_ODM 0x00000008 /* Open Drain Mode */ | ||
| 26 | #define SPI_CTL_CPHA 0x00000010 /* Clock Phase */ | ||
| 27 | #define SPI_CTL_CPOL 0x00000020 /* Clock Polarity */ | ||
| 28 | #define SPI_CTL_ASSEL 0x00000040 /* Slave Select Pin Control */ | ||
| 29 | #define SPI_CTL_SELST 0x00000080 /* Slave Select Polarity in-between transfers */ | ||
| 30 | #define SPI_CTL_EMISO 0x00000100 /* Enable MISO */ | ||
| 31 | #define SPI_CTL_SIZE 0x00000600 /* Word Transfer Size */ | ||
| 32 | #define SPI_CTL_SIZE08 0x00000000 /* SIZE: 8 bits */ | ||
| 33 | #define SPI_CTL_SIZE16 0x00000200 /* SIZE: 16 bits */ | ||
| 34 | #define SPI_CTL_SIZE32 0x00000400 /* SIZE: 32 bits */ | ||
| 35 | #define SPI_CTL_LSBF 0x00001000 /* LSB First */ | ||
| 36 | #define SPI_CTL_FCEN 0x00002000 /* Flow-Control Enable */ | ||
| 37 | #define SPI_CTL_FCCH 0x00004000 /* Flow-Control Channel Selection */ | ||
| 38 | #define SPI_CTL_FCPL 0x00008000 /* Flow-Control Polarity */ | ||
| 39 | #define SPI_CTL_FCWM 0x00030000 /* Flow-Control Water-Mark */ | ||
| 40 | #define SPI_CTL_FIFO0 0x00000000 /* FCWM: TFIFO empty or RFIFO Full */ | ||
| 41 | #define SPI_CTL_FIFO1 0x00010000 /* FCWM: TFIFO 75% or more empty or RFIFO 75% or more full */ | ||
| 42 | #define SPI_CTL_FIFO2 0x00020000 /* FCWM: TFIFO 50% or more empty or RFIFO 50% or more full */ | ||
| 43 | #define SPI_CTL_FMODE 0x00040000 /* Fast-mode Enable */ | ||
| 44 | #define SPI_CTL_MIOM 0x00300000 /* Multiple I/O Mode */ | ||
| 45 | #define SPI_CTL_MIO_DIS 0x00000000 /* MIOM: Disable */ | ||
| 46 | #define SPI_CTL_MIO_DUAL 0x00100000 /* MIOM: Enable DIOM (Dual I/O Mode) */ | ||
| 47 | #define SPI_CTL_MIO_QUAD 0x00200000 /* MIOM: Enable QUAD (Quad SPI Mode) */ | ||
| 48 | #define SPI_CTL_SOSI 0x00400000 /* Start on MOSI */ | ||
| 49 | /* SPI_RX_CONTROL */ | ||
| 50 | #define SPI_RXCTL_REN 0x00000001 /* Receive Channel Enable */ | ||
| 51 | #define SPI_RXCTL_RTI 0x00000004 /* Receive Transfer Initiate */ | ||
| 52 | #define SPI_RXCTL_RWCEN 0x00000008 /* Receive Word Counter Enable */ | ||
| 53 | #define SPI_RXCTL_RDR 0x00000070 /* Receive Data Request */ | ||
| 54 | #define SPI_RXCTL_RDR_DIS 0x00000000 /* RDR: Disabled */ | ||
| 55 | #define SPI_RXCTL_RDR_NE 0x00000010 /* RDR: RFIFO not empty */ | ||
| 56 | #define SPI_RXCTL_RDR_25 0x00000020 /* RDR: RFIFO 25% full */ | ||
| 57 | #define SPI_RXCTL_RDR_50 0x00000030 /* RDR: RFIFO 50% full */ | ||
| 58 | #define SPI_RXCTL_RDR_75 0x00000040 /* RDR: RFIFO 75% full */ | ||
| 59 | #define SPI_RXCTL_RDR_FULL 0x00000050 /* RDR: RFIFO full */ | ||
| 60 | #define SPI_RXCTL_RDO 0x00000100 /* Receive Data Over-Run */ | ||
| 61 | #define SPI_RXCTL_RRWM 0x00003000 /* FIFO Regular Water-Mark */ | ||
| 62 | #define SPI_RXCTL_RWM_0 0x00000000 /* RRWM: RFIFO Empty */ | ||
| 63 | #define SPI_RXCTL_RWM_25 0x00001000 /* RRWM: RFIFO 25% full */ | ||
| 64 | #define SPI_RXCTL_RWM_50 0x00002000 /* RRWM: RFIFO 50% full */ | ||
| 65 | #define SPI_RXCTL_RWM_75 0x00003000 /* RRWM: RFIFO 75% full */ | ||
| 66 | #define SPI_RXCTL_RUWM 0x00070000 /* FIFO Urgent Water-Mark */ | ||
| 67 | #define SPI_RXCTL_UWM_DIS 0x00000000 /* RUWM: Disabled */ | ||
| 68 | #define SPI_RXCTL_UWM_25 0x00010000 /* RUWM: RFIFO 25% full */ | ||
| 69 | #define SPI_RXCTL_UWM_50 0x00020000 /* RUWM: RFIFO 50% full */ | ||
| 70 | #define SPI_RXCTL_UWM_75 0x00030000 /* RUWM: RFIFO 75% full */ | ||
| 71 | #define SPI_RXCTL_UWM_FULL 0x00040000 /* RUWM: RFIFO full */ | ||
| 72 | /* SPI_TX_CONTROL */ | ||
| 73 | #define SPI_TXCTL_TEN 0x00000001 /* Transmit Channel Enable */ | ||
| 74 | #define SPI_TXCTL_TTI 0x00000004 /* Transmit Transfer Initiate */ | ||
| 75 | #define SPI_TXCTL_TWCEN 0x00000008 /* Transmit Word Counter Enable */ | ||
| 76 | #define SPI_TXCTL_TDR 0x00000070 /* Transmit Data Request */ | ||
| 77 | #define SPI_TXCTL_TDR_DIS 0x00000000 /* TDR: Disabled */ | ||
| 78 | #define SPI_TXCTL_TDR_NF 0x00000010 /* TDR: TFIFO not full */ | ||
| 79 | #define SPI_TXCTL_TDR_25 0x00000020 /* TDR: TFIFO 25% empty */ | ||
| 80 | #define SPI_TXCTL_TDR_50 0x00000030 /* TDR: TFIFO 50% empty */ | ||
| 81 | #define SPI_TXCTL_TDR_75 0x00000040 /* TDR: TFIFO 75% empty */ | ||
| 82 | #define SPI_TXCTL_TDR_EMPTY 0x00000050 /* TDR: TFIFO empty */ | ||
| 83 | #define SPI_TXCTL_TDU 0x00000100 /* Transmit Data Under-Run */ | ||
| 84 | #define SPI_TXCTL_TRWM 0x00003000 /* FIFO Regular Water-Mark */ | ||
| 85 | #define SPI_TXCTL_RWM_FULL 0x00000000 /* TRWM: TFIFO full */ | ||
| 86 | #define SPI_TXCTL_RWM_25 0x00001000 /* TRWM: TFIFO 25% empty */ | ||
| 87 | #define SPI_TXCTL_RWM_50 0x00002000 /* TRWM: TFIFO 50% empty */ | ||
| 88 | #define SPI_TXCTL_RWM_75 0x00003000 /* TRWM: TFIFO 75% empty */ | ||
| 89 | #define SPI_TXCTL_TUWM 0x00070000 /* FIFO Urgent Water-Mark */ | ||
| 90 | #define SPI_TXCTL_UWM_DIS 0x00000000 /* TUWM: Disabled */ | ||
| 91 | #define SPI_TXCTL_UWM_25 0x00010000 /* TUWM: TFIFO 25% empty */ | ||
| 92 | #define SPI_TXCTL_UWM_50 0x00020000 /* TUWM: TFIFO 50% empty */ | ||
| 93 | #define SPI_TXCTL_UWM_75 0x00030000 /* TUWM: TFIFO 75% empty */ | ||
| 94 | #define SPI_TXCTL_UWM_EMPTY 0x00040000 /* TUWM: TFIFO empty */ | ||
| 95 | /* SPI_CLOCK */ | ||
| 96 | #define SPI_CLK_BAUD 0x0000FFFF /* Baud Rate */ | ||
| 97 | /* SPI_DELAY */ | ||
| 98 | #define SPI_DLY_STOP 0x000000FF /* Transfer delay time in multiples of SCK period */ | ||
| 99 | #define SPI_DLY_LEADX 0x00000100 /* Extended (1 SCK) LEAD Control */ | ||
| 100 | #define SPI_DLY_LAGX 0x00000200 /* Extended (1 SCK) LAG control */ | ||
| 101 | /* SPI_SSEL */ | ||
| 102 | #define SPI_SLVSEL_SSE1 0x00000002 /* SPISSEL1 Enable */ | ||
| 103 | #define SPI_SLVSEL_SSE2 0x00000004 /* SPISSEL2 Enable */ | ||
| 104 | #define SPI_SLVSEL_SSE3 0x00000008 /* SPISSEL3 Enable */ | ||
| 105 | #define SPI_SLVSEL_SSE4 0x00000010 /* SPISSEL4 Enable */ | ||
| 106 | #define SPI_SLVSEL_SSE5 0x00000020 /* SPISSEL5 Enable */ | ||
| 107 | #define SPI_SLVSEL_SSE6 0x00000040 /* SPISSEL6 Enable */ | ||
| 108 | #define SPI_SLVSEL_SSE7 0x00000080 /* SPISSEL7 Enable */ | ||
| 109 | #define SPI_SLVSEL_SSEL1 0x00000200 /* SPISSEL1 Value */ | ||
| 110 | #define SPI_SLVSEL_SSEL2 0x00000400 /* SPISSEL2 Value */ | ||
| 111 | #define SPI_SLVSEL_SSEL3 0x00000800 /* SPISSEL3 Value */ | ||
| 112 | #define SPI_SLVSEL_SSEL4 0x00001000 /* SPISSEL4 Value */ | ||
| 113 | #define SPI_SLVSEL_SSEL5 0x00002000 /* SPISSEL5 Value */ | ||
| 114 | #define SPI_SLVSEL_SSEL6 0x00004000 /* SPISSEL6 Value */ | ||
| 115 | #define SPI_SLVSEL_SSEL7 0x00008000 /* SPISSEL7 Value */ | ||
| 116 | /* SPI_RWC */ | ||
| 117 | #define SPI_RWC_VALUE 0x0000FFFF /* Received Word-Count */ | ||
| 118 | /* SPI_RWCR */ | ||
| 119 | #define SPI_RWCR_VALUE 0x0000FFFF /* Received Word-Count Reload */ | ||
| 120 | /* SPI_TWC */ | ||
| 121 | #define SPI_TWC_VALUE 0x0000FFFF /* Transmitted Word-Count */ | ||
| 122 | /* SPI_TWCR */ | ||
| 123 | #define SPI_TWCR_VALUE 0x0000FFFF /* Transmitted Word-Count Reload */ | ||
| 124 | /* SPI_IMASK */ | ||
| 125 | #define SPI_IMSK_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */ | ||
| 126 | #define SPI_IMSK_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */ | ||
| 127 | #define SPI_IMSK_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */ | ||
| 128 | #define SPI_IMSK_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */ | ||
| 129 | #define SPI_IMSK_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */ | ||
| 130 | #define SPI_IMSK_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */ | ||
| 131 | #define SPI_IMSK_RSM 0x00000100 /* Receive Start Interrupt Mask */ | ||
| 132 | #define SPI_IMSK_TSM 0x00000200 /* Transmit Start Interrupt Mask */ | ||
| 133 | #define SPI_IMSK_RFM 0x00000400 /* Receive Finish Interrupt Mask */ | ||
| 134 | #define SPI_IMSK_TFM 0x00000800 /* Transmit Finish Interrupt Mask */ | ||
| 135 | /* SPI_IMASKCL */ | ||
| 136 | #define SPI_IMSK_CLR_RUW 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */ | ||
| 137 | #define SPI_IMSK_CLR_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */ | ||
| 138 | #define SPI_IMSK_CLR_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */ | ||
| 139 | #define SPI_IMSK_CLR_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */ | ||
| 140 | #define SPI_IMSK_CLR_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */ | ||
| 141 | #define SPI_IMSK_CLR_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */ | ||
| 142 | #define SPI_IMSK_CLR_RSM 0x00000100 /* Receive Start Interrupt Mask */ | ||
| 143 | #define SPI_IMSK_CLR_TSM 0x00000200 /* Transmit Start Interrupt Mask */ | ||
| 144 | #define SPI_IMSK_CLR_RFM 0x00000400 /* Receive Finish Interrupt Mask */ | ||
| 145 | #define SPI_IMSK_CLR_TFM 0x00000800 /* Transmit Finish Interrupt Mask */ | ||
| 146 | /* SPI_IMASKST */ | ||
| 147 | #define SPI_IMSK_SET_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */ | ||
| 148 | #define SPI_IMSK_SET_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */ | ||
| 149 | #define SPI_IMSK_SET_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */ | ||
| 150 | #define SPI_IMSK_SET_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */ | ||
| 151 | #define SPI_IMSK_SET_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */ | ||
| 152 | #define SPI_IMSK_SET_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */ | ||
| 153 | #define SPI_IMSK_SET_RSM 0x00000100 /* Receive Start Interrupt Mask */ | ||
| 154 | #define SPI_IMSK_SET_TSM 0x00000200 /* Transmit Start Interrupt Mask */ | ||
| 155 | #define SPI_IMSK_SET_RFM 0x00000400 /* Receive Finish Interrupt Mask */ | ||
| 156 | #define SPI_IMSK_SET_TFM 0x00000800 /* Transmit Finish Interrupt Mask */ | ||
| 157 | /* SPI_STATUS */ | ||
| 158 | #define SPI_STAT_SPIF 0x00000001 /* SPI Finished */ | ||
| 159 | #define SPI_STAT_RUWM 0x00000002 /* Receive Urgent Water-Mark Breached */ | ||
| 160 | #define SPI_STAT_TUWM 0x00000004 /* Transmit Urgent Water-Mark Breached */ | ||
| 161 | #define SPI_STAT_ROE 0x00000010 /* Receive Over-Run Error Indication */ | ||
| 162 | #define SPI_STAT_TUE 0x00000020 /* Transmit Under-Run Error Indication */ | ||
| 163 | #define SPI_STAT_TCE 0x00000040 /* Transmit Collision Error Indication */ | ||
| 164 | #define SPI_STAT_MODF 0x00000080 /* Mode Fault Error Indication */ | ||
| 165 | #define SPI_STAT_RS 0x00000100 /* Receive Start Indication */ | ||
| 166 | #define SPI_STAT_TS 0x00000200 /* Transmit Start Indication */ | ||
| 167 | #define SPI_STAT_RF 0x00000400 /* Receive Finish Indication */ | ||
| 168 | #define SPI_STAT_TF 0x00000800 /* Transmit Finish Indication */ | ||
| 169 | #define SPI_STAT_RFS 0x00007000 /* SPI_RFIFO status */ | ||
| 170 | #define SPI_STAT_RFIFO_EMPTY 0x00000000 /* RFS: RFIFO Empty */ | ||
| 171 | #define SPI_STAT_RFIFO_25 0x00001000 /* RFS: RFIFO 25% Full */ | ||
| 172 | #define SPI_STAT_RFIFO_50 0x00002000 /* RFS: RFIFO 50% Full */ | ||
| 173 | #define SPI_STAT_RFIFO_75 0x00003000 /* RFS: RFIFO 75% Full */ | ||
| 174 | #define SPI_STAT_RFIFO_FULL 0x00004000 /* RFS: RFIFO Full */ | ||
| 175 | #define SPI_STAT_TFS 0x00070000 /* SPI_TFIFO status */ | ||
| 176 | #define SPI_STAT_TFIFO_FULL 0x00000000 /* TFS: TFIFO full */ | ||
| 177 | #define SPI_STAT_TFIFO_25 0x00010000 /* TFS: TFIFO 25% empty */ | ||
| 178 | #define SPI_STAT_TFIFO_50 0x00020000 /* TFS: TFIFO 50% empty */ | ||
| 179 | #define SPI_STAT_TFIFO_75 0x00030000 /* TFS: TFIFO 75% empty */ | ||
| 180 | #define SPI_STAT_TFIFO_EMPTY 0x00040000 /* TFS: TFIFO empty */ | ||
| 181 | #define SPI_STAT_FCS 0x00100000 /* Flow-Control Stall Indication */ | ||
| 182 | #define SPI_STAT_RFE 0x00400000 /* SPI_RFIFO Empty */ | ||
| 183 | #define SPI_STAT_TFF 0x00800000 /* SPI_TFIFO Full */ | ||
| 184 | /* SPI_ILAT */ | ||
| 185 | #define SPI_ILAT_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */ | ||
| 186 | #define SPI_ILAT_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */ | ||
| 187 | #define SPI_ILAT_ROI 0x00000010 /* Receive Over-Run Error Indication */ | ||
| 188 | #define SPI_ILAT_TUI 0x00000020 /* Transmit Under-Run Error Indication */ | ||
| 189 | #define SPI_ILAT_TCI 0x00000040 /* Transmit Collision Error Indication */ | ||
| 190 | #define SPI_ILAT_MFI 0x00000080 /* Mode Fault Error Indication */ | ||
| 191 | #define SPI_ILAT_RSI 0x00000100 /* Receive Start Indication */ | ||
| 192 | #define SPI_ILAT_TSI 0x00000200 /* Transmit Start Indication */ | ||
| 193 | #define SPI_ILAT_RFI 0x00000400 /* Receive Finish Indication */ | ||
| 194 | #define SPI_ILAT_TFI 0x00000800 /* Transmit Finish Indication */ | ||
| 195 | /* SPI_ILATCL */ | ||
| 196 | #define SPI_ILAT_CLR_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */ | ||
| 197 | #define SPI_ILAT_CLR_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */ | ||
| 198 | #define SPI_ILAT_CLR_ROI 0x00000010 /* Receive Over-Run Error Indication */ | ||
| 199 | #define SPI_ILAT_CLR_TUI 0x00000020 /* Transmit Under-Run Error Indication */ | ||
| 200 | #define SPI_ILAT_CLR_TCI 0x00000040 /* Transmit Collision Error Indication */ | ||
| 201 | #define SPI_ILAT_CLR_MFI 0x00000080 /* Mode Fault Error Indication */ | ||
| 202 | #define SPI_ILAT_CLR_RSI 0x00000100 /* Receive Start Indication */ | ||
| 203 | #define SPI_ILAT_CLR_TSI 0x00000200 /* Transmit Start Indication */ | ||
| 204 | #define SPI_ILAT_CLR_RFI 0x00000400 /* Receive Finish Indication */ | ||
| 205 | #define SPI_ILAT_CLR_TFI 0x00000800 /* Transmit Finish Indication */ | ||
| 206 | |||
| 207 | /* | ||
| 208 | * adi spi3 registers layout | ||
| 209 | */ | ||
| 210 | struct adi_spi_regs { | ||
| 211 | u32 revid; | ||
| 212 | u32 control; | ||
| 213 | u32 rx_control; | ||
| 214 | u32 tx_control; | ||
| 215 | u32 clock; | ||
| 216 | u32 delay; | ||
| 217 | u32 ssel; | ||
| 218 | u32 rwc; | ||
| 219 | u32 rwcr; | ||
| 220 | u32 twc; | ||
| 221 | u32 twcr; | ||
| 222 | u32 reserved0; | ||
| 223 | u32 emask; | ||
| 224 | u32 emaskcl; | ||
| 225 | u32 emaskst; | ||
| 226 | u32 reserved1; | ||
| 227 | u32 status; | ||
| 228 | u32 elat; | ||
| 229 | u32 elatcl; | ||
| 230 | u32 reserved2; | ||
| 231 | u32 rfifo; | ||
| 232 | u32 reserved3; | ||
| 233 | u32 tfifo; | ||
| 234 | }; | ||
| 235 | |||
| 236 | #define MAX_CTRL_CS 8 /* cs in spi controller */ | ||
| 237 | |||
| 238 | /* device.platform_data for SSP controller devices */ | ||
| 239 | struct adi_spi3_master { | ||
| 240 | u16 num_chipselect; | ||
| 241 | u16 pin_req[7]; | ||
| 242 | }; | ||
| 243 | |||
| 244 | /* spi_board_info.controller_data for SPI slave devices, | ||
| 245 | * copied to spi_device.platform_data ... mostly for dma tuning | ||
| 246 | */ | ||
| 247 | struct adi_spi3_chip { | ||
| 248 | u32 control; | ||
| 249 | u16 cs_chg_udelay; /* Some devices require 16-bit delays */ | ||
| 250 | u32 tx_dummy_val; /* tx value for rx only transfer */ | ||
| 251 | bool enable_dma; | ||
| 252 | }; | ||
| 253 | |||
| 254 | #endif /* _ADI_SPI3_H_ */ | ||
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h index bb4bd15ae1f6..b2bd4b4127c4 100644 --- a/include/linux/spi/spi-mem.h +++ b/include/linux/spi/spi-mem.h | |||
| @@ -3,7 +3,9 @@ | |||
| 3 | * Copyright (C) 2018 Exceet Electronics GmbH | 3 | * Copyright (C) 2018 Exceet Electronics GmbH |
| 4 | * Copyright (C) 2018 Bootlin | 4 | * Copyright (C) 2018 Bootlin |
| 5 | * | 5 | * |
| 6 | * Author: Boris Brezillon <boris.brezillon@bootlin.com> | 6 | * Author: |
| 7 | * Peter Pan <peterpandong@micron.com> | ||
| 8 | * Boris Brezillon <boris.brezillon@bootlin.com> | ||
| 7 | */ | 9 | */ |
| 8 | 10 | ||
| 9 | #ifndef __LINUX_SPI_MEM_H | 11 | #ifndef __LINUX_SPI_MEM_H |
| @@ -122,7 +124,8 @@ struct spi_mem_op { | |||
| 122 | /** | 124 | /** |
| 123 | * struct spi_mem - describes a SPI memory device | 125 | * struct spi_mem - describes a SPI memory device |
| 124 | * @spi: the underlying SPI device | 126 | * @spi: the underlying SPI device |
| 125 | * @drvpriv: spi_mem_drviver private data | 127 | * @drvpriv: spi_mem_driver private data |
| 128 | * @name: name of the SPI memory device | ||
| 126 | * | 129 | * |
| 127 | * Extra information that describe the SPI memory device and may be needed by | 130 | * Extra information that describe the SPI memory device and may be needed by |
| 128 | * the controller to properly handle this device should be placed here. | 131 | * the controller to properly handle this device should be placed here. |
| @@ -133,6 +136,7 @@ struct spi_mem_op { | |||
| 133 | struct spi_mem { | 136 | struct spi_mem { |
| 134 | struct spi_device *spi; | 137 | struct spi_device *spi; |
| 135 | void *drvpriv; | 138 | void *drvpriv; |
| 139 | const char *name; | ||
| 136 | }; | 140 | }; |
| 137 | 141 | ||
| 138 | /** | 142 | /** |
| @@ -165,6 +169,13 @@ static inline void *spi_mem_get_drvdata(struct spi_mem *mem) | |||
| 165 | * limitations) | 169 | * limitations) |
| 166 | * @supports_op: check if an operation is supported by the controller | 170 | * @supports_op: check if an operation is supported by the controller |
| 167 | * @exec_op: execute a SPI memory operation | 171 | * @exec_op: execute a SPI memory operation |
| 172 | * @get_name: get a custom name for the SPI mem device from the controller. | ||
| 173 | * This might be needed if the controller driver has been ported | ||
| 174 | * to use the SPI mem layer and a custom name is used to keep | ||
| 175 | * mtdparts compatible. | ||
| 176 | * Note that if the implementation of this function allocates memory | ||
| 177 | * dynamically, then it should do so with devm_xxx(), as we don't | ||
| 178 | * have a ->free_name() function. | ||
| 168 | * | 179 | * |
| 169 | * This interface should be implemented by SPI controllers providing an | 180 | * This interface should be implemented by SPI controllers providing an |
| 170 | * high-level interface to execute SPI memory operation, which is usually the | 181 | * high-level interface to execute SPI memory operation, which is usually the |
| @@ -176,6 +187,7 @@ struct spi_controller_mem_ops { | |||
| 176 | const struct spi_mem_op *op); | 187 | const struct spi_mem_op *op); |
| 177 | int (*exec_op)(struct spi_mem *mem, | 188 | int (*exec_op)(struct spi_mem *mem, |
| 178 | const struct spi_mem_op *op); | 189 | const struct spi_mem_op *op); |
| 190 | const char *(*get_name)(struct spi_mem *mem); | ||
| 179 | }; | 191 | }; |
| 180 | 192 | ||
| 181 | /** | 193 | /** |
| @@ -234,6 +246,8 @@ bool spi_mem_supports_op(struct spi_mem *mem, | |||
| 234 | int spi_mem_exec_op(struct spi_mem *mem, | 246 | int spi_mem_exec_op(struct spi_mem *mem, |
| 235 | const struct spi_mem_op *op); | 247 | const struct spi_mem_op *op); |
| 236 | 248 | ||
| 249 | const char *spi_mem_get_name(struct spi_mem *mem); | ||
| 250 | |||
| 237 | int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv, | 251 | int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv, |
| 238 | struct module *owner); | 252 | struct module *owner); |
| 239 | 253 | ||
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index 51d8c060e513..b7e021b274dc 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
| @@ -8,7 +8,7 @@ struct spi_bitbang { | |||
| 8 | struct mutex lock; | 8 | struct mutex lock; |
| 9 | u8 busy; | 9 | u8 busy; |
| 10 | u8 use_dma; | 10 | u8 use_dma; |
| 11 | u8 flags; /* extra spi->mode support */ | 11 | u16 flags; /* extra spi->mode support */ |
| 12 | 12 | ||
| 13 | struct spi_master *master; | 13 | struct spi_master *master; |
| 14 | 14 | ||
| @@ -30,7 +30,8 @@ struct spi_bitbang { | |||
| 30 | /* txrx_word[SPI_MODE_*]() just looks like a shift register */ | 30 | /* txrx_word[SPI_MODE_*]() just looks like a shift register */ |
| 31 | u32 (*txrx_word[4])(struct spi_device *spi, | 31 | u32 (*txrx_word[4])(struct spi_device *spi, |
| 32 | unsigned nsecs, | 32 | unsigned nsecs, |
| 33 | u32 word, u8 bits); | 33 | u32 word, u8 bits, unsigned flags); |
| 34 | int (*set_line_direction)(struct spi_device *spi, bool output); | ||
| 34 | }; | 35 | }; |
| 35 | 36 | ||
| 36 | /* you can call these default bitbang->master methods from your custom | 37 | /* you can call these default bitbang->master methods from your custom |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index fd57888d4942..3190997df9ca 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
| @@ -114,29 +114,48 @@ do { \ | |||
| 114 | #endif /*arch_spin_is_contended*/ | 114 | #endif /*arch_spin_is_contended*/ |
| 115 | 115 | ||
| 116 | /* | 116 | /* |
| 117 | * This barrier must provide two things: | 117 | * smp_mb__after_spinlock() provides the equivalent of a full memory barrier |
| 118 | * between program-order earlier lock acquisitions and program-order later | ||
| 119 | * memory accesses. | ||
| 118 | * | 120 | * |
| 119 | * - it must guarantee a STORE before the spin_lock() is ordered against a | 121 | * This guarantees that the following two properties hold: |
| 120 | * LOAD after it, see the comments at its two usage sites. | ||
| 121 | * | 122 | * |
| 122 | * - it must ensure the critical section is RCsc. | 123 | * 1) Given the snippet: |
| 123 | * | 124 | * |
| 124 | * The latter is important for cases where we observe values written by other | 125 | * { X = 0; Y = 0; } |
| 125 | * CPUs in spin-loops, without barriers, while being subject to scheduling. | ||
| 126 | * | 126 | * |
| 127 | * CPU0 CPU1 CPU2 | 127 | * CPU0 CPU1 |
| 128 | * | 128 | * |
| 129 | * for (;;) { | 129 | * WRITE_ONCE(X, 1); WRITE_ONCE(Y, 1); |
| 130 | * if (READ_ONCE(X)) | 130 | * spin_lock(S); smp_mb(); |
| 131 | * break; | 131 | * smp_mb__after_spinlock(); r1 = READ_ONCE(X); |
| 132 | * } | 132 | * r0 = READ_ONCE(Y); |
| 133 | * X=1 | 133 | * spin_unlock(S); |
| 134 | * <sched-out> | ||
| 135 | * <sched-in> | ||
| 136 | * r = X; | ||
| 137 | * | 134 | * |
| 138 | * without transitivity it could be that CPU1 observes X!=0 breaks the loop, | 135 | * it is forbidden that CPU0 does not observe CPU1's store to Y (r0 = 0) |
| 139 | * we get migrated and CPU2 sees X==0. | 136 | * and CPU1 does not observe CPU0's store to X (r1 = 0); see the comments |
| 137 | * preceding the call to smp_mb__after_spinlock() in __schedule() and in | ||
| 138 | * try_to_wake_up(). | ||
| 139 | * | ||
| 140 | * 2) Given the snippet: | ||
| 141 | * | ||
| 142 | * { X = 0; Y = 0; } | ||
| 143 | * | ||
| 144 | * CPU0 CPU1 CPU2 | ||
| 145 | * | ||
| 146 | * spin_lock(S); spin_lock(S); r1 = READ_ONCE(Y); | ||
| 147 | * WRITE_ONCE(X, 1); smp_mb__after_spinlock(); smp_rmb(); | ||
| 148 | * spin_unlock(S); r0 = READ_ONCE(X); r2 = READ_ONCE(X); | ||
| 149 | * WRITE_ONCE(Y, 1); | ||
| 150 | * spin_unlock(S); | ||
| 151 | * | ||
| 152 | * it is forbidden that CPU0's critical section executes before CPU1's | ||
| 153 | * critical section (r0 = 1), CPU2 observes CPU1's store to Y (r1 = 1) | ||
| 154 | * and CPU2 does not observe CPU0's store to X (r2 = 0); see the comments | ||
| 155 | * preceding the calls to smp_rmb() in try_to_wake_up() for similar | ||
| 156 | * snippets but "projected" onto two CPUs. | ||
| 157 | * | ||
| 158 | * Property (2) upgrades the lock to an RCsc lock. | ||
| 140 | * | 159 | * |
| 141 | * Since most load-store architectures implement ACQUIRE with an smp_mb() after | 160 | * Since most load-store architectures implement ACQUIRE with an smp_mb() after |
| 142 | * the LL/SC loop, they need no further barriers. Similarly all our TSO | 161 | * the LL/SC loop, they need no further barriers. Similarly all our TSO |
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 91494d7e8e41..3e72a291c401 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
| @@ -195,6 +195,16 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
| 195 | return retval; | 195 | return retval; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | /* Used by tracing, cannot be traced and cannot invoke lockdep. */ | ||
| 199 | static inline notrace int | ||
| 200 | srcu_read_lock_notrace(struct srcu_struct *sp) __acquires(sp) | ||
| 201 | { | ||
| 202 | int retval; | ||
| 203 | |||
| 204 | retval = __srcu_read_lock(sp); | ||
| 205 | return retval; | ||
| 206 | } | ||
| 207 | |||
| 198 | /** | 208 | /** |
| 199 | * srcu_read_unlock - unregister a old reader from an SRCU-protected structure. | 209 | * srcu_read_unlock - unregister a old reader from an SRCU-protected structure. |
| 200 | * @sp: srcu_struct in which to unregister the old reader. | 210 | * @sp: srcu_struct in which to unregister the old reader. |
| @@ -209,6 +219,13 @@ static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | |||
| 209 | __srcu_read_unlock(sp, idx); | 219 | __srcu_read_unlock(sp, idx); |
| 210 | } | 220 | } |
| 211 | 221 | ||
| 222 | /* Used by tracing, cannot be traced and cannot call lockdep. */ | ||
| 223 | static inline notrace void | ||
| 224 | srcu_read_unlock_notrace(struct srcu_struct *sp, int idx) __releases(sp) | ||
| 225 | { | ||
| 226 | __srcu_read_unlock(sp, idx); | ||
| 227 | } | ||
| 228 | |||
| 212 | /** | 229 | /** |
| 213 | * smp_mb__after_srcu_read_unlock - ensure full ordering after srcu_read_unlock | 230 | * smp_mb__after_srcu_read_unlock - ensure full ordering after srcu_read_unlock |
| 214 | * | 231 | * |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 3b43655cabe6..0d5a2691e7e9 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
| @@ -499,11 +499,9 @@ struct ssb_bus { | |||
| 499 | 499 | ||
| 500 | /* Internal-only stuff follows. Do not touch. */ | 500 | /* Internal-only stuff follows. Do not touch. */ |
| 501 | struct list_head list; | 501 | struct list_head list; |
| 502 | #ifdef CONFIG_SSB_DEBUG | ||
| 503 | /* Is the bus already powered up? */ | 502 | /* Is the bus already powered up? */ |
| 504 | bool powered_up; | 503 | bool powered_up; |
| 505 | int power_warn_count; | 504 | int power_warn_count; |
| 506 | #endif /* DEBUG */ | ||
| 507 | }; | 505 | }; |
| 508 | 506 | ||
| 509 | enum ssb_quirks { | 507 | enum ssb_quirks { |
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 32feac5bbd75..c43e9a01b892 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h | |||
| @@ -190,5 +190,6 @@ struct plat_stmmacenet_data { | |||
| 190 | bool tso_en; | 190 | bool tso_en; |
| 191 | int mac_port_sel_speed; | 191 | int mac_port_sel_speed; |
| 192 | bool en_tx_lpi_clockgating; | 192 | bool en_tx_lpi_clockgating; |
| 193 | int has_xgmac; | ||
| 193 | }; | 194 | }; |
| 194 | #endif | 195 | #endif |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 440b62f7502e..5a28ac9284f0 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
| @@ -414,7 +414,7 @@ static inline bool hibernation_available(void) { return false; } | |||
| 414 | #define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ | 414 | #define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ |
| 415 | #define PM_POST_RESTORE 0x0006 /* Restore failed */ | 415 | #define PM_POST_RESTORE 0x0006 /* Restore failed */ |
| 416 | 416 | ||
| 417 | extern struct mutex pm_mutex; | 417 | extern struct mutex system_transition_mutex; |
| 418 | 418 | ||
| 419 | #ifdef CONFIG_PM_SLEEP | 419 | #ifdef CONFIG_PM_SLEEP |
| 420 | void save_processor_state(void); | 420 | void save_processor_state(void); |
diff --git a/include/linux/swait.h b/include/linux/swait.h index bf8cb0dee23c..73e06e9986d4 100644 --- a/include/linux/swait.h +++ b/include/linux/swait.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | * wait-queues, but the semantics are actually completely different, and | 16 | * wait-queues, but the semantics are actually completely different, and |
| 17 | * every single user we have ever had has been buggy (or pointless). | 17 | * every single user we have ever had has been buggy (or pointless). |
| 18 | * | 18 | * |
| 19 | * A "swake_up()" only wakes up _one_ waiter, which is not at all what | 19 | * A "swake_up_one()" only wakes up _one_ waiter, which is not at all what |
| 20 | * "wake_up()" does, and has led to problems. In other cases, it has | 20 | * "wake_up()" does, and has led to problems. In other cases, it has |
| 21 | * been fine, because there's only ever one waiter (kvm), but in that | 21 | * been fine, because there's only ever one waiter (kvm), but in that |
| 22 | * case gthe whole "simple" wait-queue is just pointless to begin with, | 22 | * case gthe whole "simple" wait-queue is just pointless to begin with, |
| @@ -38,8 +38,8 @@ | |||
| 38 | * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right | 38 | * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right |
| 39 | * sleeper state. | 39 | * sleeper state. |
| 40 | * | 40 | * |
| 41 | * - the exclusive mode; because this requires preserving the list order | 41 | * - the !exclusive mode; because that leads to O(n) wakeups, everything is |
| 42 | * and this is hard. | 42 | * exclusive. |
| 43 | * | 43 | * |
| 44 | * - custom wake callback functions; because you cannot give any guarantees | 44 | * - custom wake callback functions; because you cannot give any guarantees |
| 45 | * about random code. This also allows swait to be used in RT, such that | 45 | * about random code. This also allows swait to be used in RT, such that |
| @@ -115,7 +115,7 @@ extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name | |||
| 115 | * CPU0 - waker CPU1 - waiter | 115 | * CPU0 - waker CPU1 - waiter |
| 116 | * | 116 | * |
| 117 | * for (;;) { | 117 | * for (;;) { |
| 118 | * @cond = true; prepare_to_swait(&wq_head, &wait, state); | 118 | * @cond = true; prepare_to_swait_exclusive(&wq_head, &wait, state); |
| 119 | * smp_mb(); // smp_mb() from set_current_state() | 119 | * smp_mb(); // smp_mb() from set_current_state() |
| 120 | * if (swait_active(wq_head)) if (@cond) | 120 | * if (swait_active(wq_head)) if (@cond) |
| 121 | * wake_up(wq_head); break; | 121 | * wake_up(wq_head); break; |
| @@ -157,20 +157,20 @@ static inline bool swq_has_sleeper(struct swait_queue_head *wq) | |||
| 157 | return swait_active(wq); | 157 | return swait_active(wq); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | extern void swake_up(struct swait_queue_head *q); | 160 | extern void swake_up_one(struct swait_queue_head *q); |
| 161 | extern void swake_up_all(struct swait_queue_head *q); | 161 | extern void swake_up_all(struct swait_queue_head *q); |
| 162 | extern void swake_up_locked(struct swait_queue_head *q); | 162 | extern void swake_up_locked(struct swait_queue_head *q); |
| 163 | 163 | ||
| 164 | extern void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait); | 164 | extern void prepare_to_swait_exclusive(struct swait_queue_head *q, struct swait_queue *wait, int state); |
| 165 | extern void prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait, int state); | ||
| 166 | extern long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state); | 165 | extern long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state); |
| 167 | 166 | ||
| 168 | extern void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait); | 167 | extern void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait); |
| 169 | extern void finish_swait(struct swait_queue_head *q, struct swait_queue *wait); | 168 | extern void finish_swait(struct swait_queue_head *q, struct swait_queue *wait); |
| 170 | 169 | ||
| 171 | /* as per ___wait_event() but for swait, therefore "exclusive == 0" */ | 170 | /* as per ___wait_event() but for swait, therefore "exclusive == 1" */ |
| 172 | #define ___swait_event(wq, condition, state, ret, cmd) \ | 171 | #define ___swait_event(wq, condition, state, ret, cmd) \ |
| 173 | ({ \ | 172 | ({ \ |
| 173 | __label__ __out; \ | ||
| 174 | struct swait_queue __wait; \ | 174 | struct swait_queue __wait; \ |
| 175 | long __ret = ret; \ | 175 | long __ret = ret; \ |
| 176 | \ | 176 | \ |
| @@ -183,20 +183,20 @@ extern void finish_swait(struct swait_queue_head *q, struct swait_queue *wait); | |||
| 183 | \ | 183 | \ |
| 184 | if (___wait_is_interruptible(state) && __int) { \ | 184 | if (___wait_is_interruptible(state) && __int) { \ |
| 185 | __ret = __int; \ | 185 | __ret = __int; \ |
| 186 | break; \ | 186 | goto __out; \ |
| 187 | } \ | 187 | } \ |
| 188 | \ | 188 | \ |
| 189 | cmd; \ | 189 | cmd; \ |
| 190 | } \ | 190 | } \ |
| 191 | finish_swait(&wq, &__wait); \ | 191 | finish_swait(&wq, &__wait); \ |
| 192 | __ret; \ | 192 | __out: __ret; \ |
| 193 | }) | 193 | }) |
| 194 | 194 | ||
| 195 | #define __swait_event(wq, condition) \ | 195 | #define __swait_event(wq, condition) \ |
| 196 | (void)___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, \ | 196 | (void)___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, \ |
| 197 | schedule()) | 197 | schedule()) |
| 198 | 198 | ||
| 199 | #define swait_event(wq, condition) \ | 199 | #define swait_event_exclusive(wq, condition) \ |
| 200 | do { \ | 200 | do { \ |
| 201 | if (condition) \ | 201 | if (condition) \ |
| 202 | break; \ | 202 | break; \ |
| @@ -208,7 +208,7 @@ do { \ | |||
| 208 | TASK_UNINTERRUPTIBLE, timeout, \ | 208 | TASK_UNINTERRUPTIBLE, timeout, \ |
| 209 | __ret = schedule_timeout(__ret)) | 209 | __ret = schedule_timeout(__ret)) |
| 210 | 210 | ||
| 211 | #define swait_event_timeout(wq, condition, timeout) \ | 211 | #define swait_event_timeout_exclusive(wq, condition, timeout) \ |
| 212 | ({ \ | 212 | ({ \ |
| 213 | long __ret = timeout; \ | 213 | long __ret = timeout; \ |
| 214 | if (!___wait_cond_timeout(condition)) \ | 214 | if (!___wait_cond_timeout(condition)) \ |
| @@ -220,7 +220,7 @@ do { \ | |||
| 220 | ___swait_event(wq, condition, TASK_INTERRUPTIBLE, 0, \ | 220 | ___swait_event(wq, condition, TASK_INTERRUPTIBLE, 0, \ |
| 221 | schedule()) | 221 | schedule()) |
| 222 | 222 | ||
| 223 | #define swait_event_interruptible(wq, condition) \ | 223 | #define swait_event_interruptible_exclusive(wq, condition) \ |
| 224 | ({ \ | 224 | ({ \ |
| 225 | int __ret = 0; \ | 225 | int __ret = 0; \ |
| 226 | if (!(condition)) \ | 226 | if (!(condition)) \ |
| @@ -233,7 +233,7 @@ do { \ | |||
| 233 | TASK_INTERRUPTIBLE, timeout, \ | 233 | TASK_INTERRUPTIBLE, timeout, \ |
| 234 | __ret = schedule_timeout(__ret)) | 234 | __ret = schedule_timeout(__ret)) |
| 235 | 235 | ||
| 236 | #define swait_event_interruptible_timeout(wq, condition, timeout) \ | 236 | #define swait_event_interruptible_timeout_exclusive(wq, condition, timeout)\ |
| 237 | ({ \ | 237 | ({ \ |
| 238 | long __ret = timeout; \ | 238 | long __ret = timeout; \ |
| 239 | if (!___wait_cond_timeout(condition)) \ | 239 | if (!___wait_cond_timeout(condition)) \ |
| @@ -246,7 +246,7 @@ do { \ | |||
| 246 | (void)___swait_event(wq, condition, TASK_IDLE, 0, schedule()) | 246 | (void)___swait_event(wq, condition, TASK_IDLE, 0, schedule()) |
| 247 | 247 | ||
| 248 | /** | 248 | /** |
| 249 | * swait_event_idle - wait without system load contribution | 249 | * swait_event_idle_exclusive - wait without system load contribution |
| 250 | * @wq: the waitqueue to wait on | 250 | * @wq: the waitqueue to wait on |
| 251 | * @condition: a C expression for the event to wait for | 251 | * @condition: a C expression for the event to wait for |
| 252 | * | 252 | * |
| @@ -257,7 +257,7 @@ do { \ | |||
| 257 | * condition and doesn't want to contribute to system load. Signals are | 257 | * condition and doesn't want to contribute to system load. Signals are |
| 258 | * ignored. | 258 | * ignored. |
| 259 | */ | 259 | */ |
| 260 | #define swait_event_idle(wq, condition) \ | 260 | #define swait_event_idle_exclusive(wq, condition) \ |
| 261 | do { \ | 261 | do { \ |
| 262 | if (condition) \ | 262 | if (condition) \ |
| 263 | break; \ | 263 | break; \ |
| @@ -270,7 +270,7 @@ do { \ | |||
| 270 | __ret = schedule_timeout(__ret)) | 270 | __ret = schedule_timeout(__ret)) |
| 271 | 271 | ||
| 272 | /** | 272 | /** |
| 273 | * swait_event_idle_timeout - wait up to timeout without load contribution | 273 | * swait_event_idle_timeout_exclusive - wait up to timeout without load contribution |
| 274 | * @wq: the waitqueue to wait on | 274 | * @wq: the waitqueue to wait on |
| 275 | * @condition: a C expression for the event to wait for | 275 | * @condition: a C expression for the event to wait for |
| 276 | * @timeout: timeout at which we'll give up in jiffies | 276 | * @timeout: timeout at which we'll give up in jiffies |
| @@ -288,7 +288,7 @@ do { \ | |||
| 288 | * or the remaining jiffies (at least 1) if the @condition evaluated | 288 | * or the remaining jiffies (at least 1) if the @condition evaluated |
| 289 | * to %true before the @timeout elapsed. | 289 | * to %true before the @timeout elapsed. |
| 290 | */ | 290 | */ |
| 291 | #define swait_event_idle_timeout(wq, condition, timeout) \ | 291 | #define swait_event_idle_timeout_exclusive(wq, condition, timeout) \ |
| 292 | ({ \ | 292 | ({ \ |
| 293 | long __ret = timeout; \ | 293 | long __ret = timeout; \ |
| 294 | if (!___wait_cond_timeout(condition)) \ | 294 | if (!___wait_cond_timeout(condition)) \ |
diff --git a/include/linux/swap.h b/include/linux/swap.h index c063443d8638..1a8bd05a335e 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -629,7 +629,6 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) | |||
| 629 | 629 | ||
| 630 | return memcg->swappiness; | 630 | return memcg->swappiness; |
| 631 | } | 631 | } |
| 632 | |||
| 633 | #else | 632 | #else |
| 634 | static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) | 633 | static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) |
| 635 | { | 634 | { |
| @@ -637,6 +636,16 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) | |||
| 637 | } | 636 | } |
| 638 | #endif | 637 | #endif |
| 639 | 638 | ||
| 639 | #if defined(CONFIG_SWAP) && defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) | ||
| 640 | extern void mem_cgroup_throttle_swaprate(struct mem_cgroup *memcg, int node, | ||
| 641 | gfp_t gfp_mask); | ||
| 642 | #else | ||
| 643 | static inline void mem_cgroup_throttle_swaprate(struct mem_cgroup *memcg, | ||
| 644 | int node, gfp_t gfp_mask) | ||
| 645 | { | ||
| 646 | } | ||
| 647 | #endif | ||
| 648 | |||
| 640 | #ifdef CONFIG_MEMCG_SWAP | 649 | #ifdef CONFIG_MEMCG_SWAP |
| 641 | extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry); | 650 | extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry); |
| 642 | extern int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry); | 651 | extern int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry); |
diff --git a/include/linux/swapfile.h b/include/linux/swapfile.h index 06bd7b096167..e06febf62978 100644 --- a/include/linux/swapfile.h +++ b/include/linux/swapfile.h | |||
| @@ -10,5 +10,7 @@ extern spinlock_t swap_lock; | |||
| 10 | extern struct plist_head swap_active_head; | 10 | extern struct plist_head swap_active_head; |
| 11 | extern struct swap_info_struct *swap_info[]; | 11 | extern struct swap_info_struct *swap_info[]; |
| 12 | extern int try_to_unuse(unsigned int, bool, unsigned long); | 12 | extern int try_to_unuse(unsigned int, bool, unsigned long); |
| 13 | extern unsigned long generic_max_swapfile_size(void); | ||
| 14 | extern unsigned long max_swapfile_size(void); | ||
| 13 | 15 | ||
| 14 | #endif /* _LINUX_SWAPFILE_H */ | 16 | #endif /* _LINUX_SWAPFILE_H */ |
diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h index ec93e93371fa..ab400af6f0ce 100644 --- a/include/linux/switchtec.h +++ b/include/linux/switchtec.h | |||
| @@ -19,10 +19,6 @@ | |||
| 19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
| 20 | #include <linux/cdev.h> | 20 | #include <linux/cdev.h> |
| 21 | 21 | ||
| 22 | #define MICROSEMI_VENDOR_ID 0x11f8 | ||
| 23 | #define MICROSEMI_NTB_CLASSCODE 0x068000 | ||
| 24 | #define MICROSEMI_MGMT_CLASSCODE 0x058000 | ||
| 25 | |||
| 26 | #define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024 | 22 | #define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024 |
| 27 | #define SWITCHTEC_MAX_PFF_CSR 48 | 23 | #define SWITCHTEC_MAX_PFF_CSR 48 |
| 28 | 24 | ||
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 5c1a0933768e..2ff814c92f7f 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -81,6 +81,7 @@ union bpf_attr; | |||
| 81 | #include <linux/unistd.h> | 81 | #include <linux/unistd.h> |
| 82 | #include <linux/quota.h> | 82 | #include <linux/quota.h> |
| 83 | #include <linux/key.h> | 83 | #include <linux/key.h> |
| 84 | #include <linux/personality.h> | ||
| 84 | #include <trace/syscall.h> | 85 | #include <trace/syscall.h> |
| 85 | 86 | ||
| 86 | #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER | 87 | #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER |
| @@ -506,9 +507,9 @@ asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, | |||
| 506 | /* fs/timerfd.c */ | 507 | /* fs/timerfd.c */ |
| 507 | asmlinkage long sys_timerfd_create(int clockid, int flags); | 508 | asmlinkage long sys_timerfd_create(int clockid, int flags); |
| 508 | asmlinkage long sys_timerfd_settime(int ufd, int flags, | 509 | asmlinkage long sys_timerfd_settime(int ufd, int flags, |
| 509 | const struct itimerspec __user *utmr, | 510 | const struct __kernel_itimerspec __user *utmr, |
| 510 | struct itimerspec __user *otmr); | 511 | struct __kernel_itimerspec __user *otmr); |
| 511 | asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); | 512 | asmlinkage long sys_timerfd_gettime(int ufd, struct __kernel_itimerspec __user *otmr); |
| 512 | 513 | ||
| 513 | /* fs/utimes.c */ | 514 | /* fs/utimes.c */ |
| 514 | asmlinkage long sys_utimensat(int dfd, const char __user *filename, | 515 | asmlinkage long sys_utimensat(int dfd, const char __user *filename, |
| @@ -573,10 +574,10 @@ asmlinkage long sys_timer_create(clockid_t which_clock, | |||
| 573 | struct sigevent __user *timer_event_spec, | 574 | struct sigevent __user *timer_event_spec, |
| 574 | timer_t __user * created_timer_id); | 575 | timer_t __user * created_timer_id); |
| 575 | asmlinkage long sys_timer_gettime(timer_t timer_id, | 576 | asmlinkage long sys_timer_gettime(timer_t timer_id, |
| 576 | struct itimerspec __user *setting); | 577 | struct __kernel_itimerspec __user *setting); |
| 577 | asmlinkage long sys_timer_getoverrun(timer_t timer_id); | 578 | asmlinkage long sys_timer_getoverrun(timer_t timer_id); |
| 578 | asmlinkage long sys_timer_settime(timer_t timer_id, int flags, | 579 | asmlinkage long sys_timer_settime(timer_t timer_id, int flags, |
| 579 | const struct itimerspec __user *new_setting, | 580 | const struct __kernel_itimerspec __user *new_setting, |
| 580 | struct itimerspec __user *old_setting); | 581 | struct itimerspec __user *old_setting); |
| 581 | asmlinkage long sys_timer_delete(timer_t timer_id); | 582 | asmlinkage long sys_timer_delete(timer_t timer_id); |
| 582 | asmlinkage long sys_clock_settime(clockid_t which_clock, | 583 | asmlinkage long sys_clock_settime(clockid_t which_clock, |
| @@ -1282,4 +1283,14 @@ static inline long ksys_truncate(const char __user *pathname, loff_t length) | |||
| 1282 | return do_sys_truncate(pathname, length); | 1283 | return do_sys_truncate(pathname, length); |
| 1283 | } | 1284 | } |
| 1284 | 1285 | ||
| 1286 | static inline unsigned int ksys_personality(unsigned int personality) | ||
| 1287 | { | ||
| 1288 | unsigned int old = current->personality; | ||
| 1289 | |||
| 1290 | if (personality != 0xffffffff) | ||
| 1291 | set_personality(personality); | ||
| 1292 | |||
| 1293 | return old; | ||
| 1294 | } | ||
| 1295 | |||
| 1285 | #endif | 1296 | #endif |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index b8bfdc173ec0..3c12198c0103 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -237,6 +237,9 @@ int __must_check sysfs_create_files(struct kobject *kobj, | |||
| 237 | const struct attribute **attr); | 237 | const struct attribute **attr); |
| 238 | int __must_check sysfs_chmod_file(struct kobject *kobj, | 238 | int __must_check sysfs_chmod_file(struct kobject *kobj, |
| 239 | const struct attribute *attr, umode_t mode); | 239 | const struct attribute *attr, umode_t mode); |
| 240 | struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj, | ||
| 241 | const struct attribute *attr); | ||
| 242 | void sysfs_unbreak_active_protection(struct kernfs_node *kn); | ||
| 240 | void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, | 243 | void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, |
| 241 | const void *ns); | 244 | const void *ns); |
| 242 | bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr); | 245 | bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr); |
| @@ -350,6 +353,17 @@ static inline int sysfs_chmod_file(struct kobject *kobj, | |||
| 350 | return 0; | 353 | return 0; |
| 351 | } | 354 | } |
| 352 | 355 | ||
| 356 | static inline struct kernfs_node * | ||
| 357 | sysfs_break_active_protection(struct kobject *kobj, | ||
| 358 | const struct attribute *attr) | ||
| 359 | { | ||
| 360 | return NULL; | ||
| 361 | } | ||
| 362 | |||
| 363 | static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn) | ||
| 364 | { | ||
| 365 | } | ||
| 366 | |||
| 353 | static inline void sysfs_remove_file_ns(struct kobject *kobj, | 367 | static inline void sysfs_remove_file_ns(struct kobject *kobj, |
| 354 | const struct attribute *attr, | 368 | const struct attribute *attr, |
| 355 | const void *ns) | 369 | const void *ns) |
diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h index c6aa8a3c42ed..b9626aa7e90c 100644 --- a/include/linux/t10-pi.h +++ b/include/linux/t10-pi.h | |||
| @@ -37,9 +37,33 @@ struct t10_pi_tuple { | |||
| 37 | #define T10_PI_APP_ESCAPE cpu_to_be16(0xffff) | 37 | #define T10_PI_APP_ESCAPE cpu_to_be16(0xffff) |
| 38 | #define T10_PI_REF_ESCAPE cpu_to_be32(0xffffffff) | 38 | #define T10_PI_REF_ESCAPE cpu_to_be32(0xffffffff) |
| 39 | 39 | ||
| 40 | static inline u32 t10_pi_ref_tag(struct request *rq) | ||
| 41 | { | ||
| 42 | #ifdef CONFIG_BLK_DEV_INTEGRITY | ||
| 43 | return blk_rq_pos(rq) >> | ||
| 44 | (rq->q->integrity.interval_exp - 9) & 0xffffffff; | ||
| 45 | #else | ||
| 46 | return -1U; | ||
| 47 | #endif | ||
| 48 | } | ||
| 49 | |||
| 40 | extern const struct blk_integrity_profile t10_pi_type1_crc; | 50 | extern const struct blk_integrity_profile t10_pi_type1_crc; |
| 41 | extern const struct blk_integrity_profile t10_pi_type1_ip; | 51 | extern const struct blk_integrity_profile t10_pi_type1_ip; |
| 42 | extern const struct blk_integrity_profile t10_pi_type3_crc; | 52 | extern const struct blk_integrity_profile t10_pi_type3_crc; |
| 43 | extern const struct blk_integrity_profile t10_pi_type3_ip; | 53 | extern const struct blk_integrity_profile t10_pi_type3_ip; |
| 44 | 54 | ||
| 55 | #ifdef CONFIG_BLK_DEV_INTEGRITY | ||
| 56 | extern void t10_pi_prepare(struct request *rq, u8 protection_type); | ||
| 57 | extern void t10_pi_complete(struct request *rq, u8 protection_type, | ||
| 58 | unsigned int intervals); | ||
| 59 | #else | ||
| 60 | static inline void t10_pi_complete(struct request *rq, u8 protection_type, | ||
| 61 | unsigned int intervals) | ||
| 62 | { | ||
| 63 | } | ||
| 64 | static inline void t10_pi_prepare(struct request *rq, u8 protection_type) | ||
| 65 | { | ||
| 66 | } | ||
| 67 | #endif | ||
| 68 | |||
| 45 | #endif | 69 | #endif |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 72705eaf4b84..263e37271afd 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -89,7 +89,7 @@ struct tcp_sack_block { | |||
| 89 | 89 | ||
| 90 | struct tcp_options_received { | 90 | struct tcp_options_received { |
| 91 | /* PAWS/RTTM data */ | 91 | /* PAWS/RTTM data */ |
| 92 | long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ | 92 | int ts_recent_stamp;/* Time we stored ts_recent (for aging) */ |
| 93 | u32 ts_recent; /* Time stamp to echo next */ | 93 | u32 ts_recent; /* Time stamp to echo next */ |
| 94 | u32 rcv_tsval; /* Time stamp value */ | 94 | u32 rcv_tsval; /* Time stamp value */ |
| 95 | u32 rcv_tsecr; /* Time stamp echo reply */ | 95 | u32 rcv_tsecr; /* Time stamp echo reply */ |
| @@ -181,10 +181,16 @@ struct tcp_sock { | |||
| 181 | u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut | 181 | u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut |
| 182 | * total number of data segments sent. | 182 | * total number of data segments sent. |
| 183 | */ | 183 | */ |
| 184 | u64 bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut | ||
| 185 | * total number of data bytes sent. | ||
| 186 | */ | ||
| 184 | u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked | 187 | u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked |
| 185 | * sum(delta(snd_una)), or how many bytes | 188 | * sum(delta(snd_una)), or how many bytes |
| 186 | * were acked. | 189 | * were acked. |
| 187 | */ | 190 | */ |
| 191 | u32 dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups | ||
| 192 | * total number of DSACK blocks received | ||
| 193 | */ | ||
| 188 | u32 snd_una; /* First byte we want an ack for */ | 194 | u32 snd_una; /* First byte we want an ack for */ |
| 189 | u32 snd_sml; /* Last byte of the most recently transmitted small packet */ | 195 | u32 snd_sml; /* Last byte of the most recently transmitted small packet */ |
| 190 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ | 196 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ |
| @@ -214,8 +220,7 @@ struct tcp_sock { | |||
| 214 | #define TCP_RACK_RECOVERY_THRESH 16 | 220 | #define TCP_RACK_RECOVERY_THRESH 16 |
| 215 | u8 reo_wnd_persist:5, /* No. of recovery since last adj */ | 221 | u8 reo_wnd_persist:5, /* No. of recovery since last adj */ |
| 216 | dsack_seen:1, /* Whether DSACK seen after last adj */ | 222 | dsack_seen:1, /* Whether DSACK seen after last adj */ |
| 217 | advanced:1, /* mstamp advanced since last lost marking */ | 223 | advanced:1; /* mstamp advanced since last lost marking */ |
| 218 | reord:1; /* reordering detected */ | ||
| 219 | } rack; | 224 | } rack; |
| 220 | u16 advmss; /* Advertised MSS */ | 225 | u16 advmss; /* Advertised MSS */ |
| 221 | u8 compressed_ack; | 226 | u8 compressed_ack; |
| @@ -261,6 +266,7 @@ struct tcp_sock { | |||
| 261 | u8 ecn_flags; /* ECN status bits. */ | 266 | u8 ecn_flags; /* ECN status bits. */ |
| 262 | u8 keepalive_probes; /* num of allowed keep alive probes */ | 267 | u8 keepalive_probes; /* num of allowed keep alive probes */ |
| 263 | u32 reordering; /* Packet reordering metric. */ | 268 | u32 reordering; /* Packet reordering metric. */ |
| 269 | u32 reord_seen; /* number of data packet reordering events */ | ||
| 264 | u32 snd_up; /* Urgent pointer */ | 270 | u32 snd_up; /* Urgent pointer */ |
| 265 | 271 | ||
| 266 | /* | 272 | /* |
| @@ -330,6 +336,9 @@ struct tcp_sock { | |||
| 330 | * the first SYN. */ | 336 | * the first SYN. */ |
| 331 | u32 undo_marker; /* snd_una upon a new recovery episode. */ | 337 | u32 undo_marker; /* snd_una upon a new recovery episode. */ |
| 332 | int undo_retrans; /* number of undoable retransmissions. */ | 338 | int undo_retrans; /* number of undoable retransmissions. */ |
| 339 | u64 bytes_retrans; /* RFC4898 tcpEStatsPerfOctetsRetrans | ||
| 340 | * Total data bytes retransmitted | ||
| 341 | */ | ||
| 333 | u32 total_retrans; /* Total retransmits for entire connection */ | 342 | u32 total_retrans; /* Total retransmits for entire connection */ |
| 334 | 343 | ||
| 335 | u32 urg_seq; /* Seq of received urgent pointer */ | 344 | u32 urg_seq; /* Seq of received urgent pointer */ |
| @@ -350,6 +359,7 @@ struct tcp_sock { | |||
| 350 | #endif | 359 | #endif |
| 351 | 360 | ||
| 352 | /* Receiver side RTT estimation */ | 361 | /* Receiver side RTT estimation */ |
| 362 | u32 rcv_rtt_last_tsecr; | ||
| 353 | struct { | 363 | struct { |
| 354 | u32 rtt_us; | 364 | u32 rtt_us; |
| 355 | u32 seq; | 365 | u32 seq; |
| @@ -425,7 +435,7 @@ struct tcp_timewait_sock { | |||
| 425 | /* The time we sent the last out-of-window ACK: */ | 435 | /* The time we sent the last out-of-window ACK: */ |
| 426 | u32 tw_last_oow_ack_time; | 436 | u32 tw_last_oow_ack_time; |
| 427 | 437 | ||
| 428 | long tw_ts_recent_stamp; | 438 | int tw_ts_recent_stamp; |
| 429 | #ifdef CONFIG_TCP_MD5SIG | 439 | #ifdef CONFIG_TCP_MD5SIG |
| 430 | struct tcp_md5sig_key *tw_md5_key; | 440 | struct tcp_md5sig_key *tw_md5_key; |
| 431 | #endif | 441 | #endif |
diff --git a/include/linux/time.h b/include/linux/time.h index aed74463592d..27d83fd2ae61 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
| @@ -14,9 +14,9 @@ int get_timespec64(struct timespec64 *ts, | |||
| 14 | int put_timespec64(const struct timespec64 *ts, | 14 | int put_timespec64(const struct timespec64 *ts, |
| 15 | struct __kernel_timespec __user *uts); | 15 | struct __kernel_timespec __user *uts); |
| 16 | int get_itimerspec64(struct itimerspec64 *it, | 16 | int get_itimerspec64(struct itimerspec64 *it, |
| 17 | const struct itimerspec __user *uit); | 17 | const struct __kernel_itimerspec __user *uit); |
| 18 | int put_itimerspec64(const struct itimerspec64 *it, | 18 | int put_itimerspec64(const struct itimerspec64 *it, |
| 19 | struct itimerspec __user *uit); | 19 | struct __kernel_itimerspec __user *uit); |
| 20 | 20 | ||
| 21 | extern time64_t mktime64(const unsigned int year, const unsigned int mon, | 21 | extern time64_t mktime64(const unsigned int year, const unsigned int mon, |
| 22 | const unsigned int day, const unsigned int hour, | 22 | const unsigned int day, const unsigned int hour, |
diff --git a/include/linux/time64.h b/include/linux/time64.h index 0a7b2f79cec7..05634afba0db 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h | |||
| @@ -12,6 +12,7 @@ typedef __u64 timeu64_t; | |||
| 12 | */ | 12 | */ |
| 13 | #ifndef CONFIG_64BIT_TIME | 13 | #ifndef CONFIG_64BIT_TIME |
| 14 | #define __kernel_timespec timespec | 14 | #define __kernel_timespec timespec |
| 15 | #define __kernel_itimerspec itimerspec | ||
| 15 | #endif | 16 | #endif |
| 16 | 17 | ||
| 17 | #include <uapi/linux/time.h> | 18 | #include <uapi/linux/time.h> |
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 86bc2026efce..5d738804e3d6 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
| @@ -21,6 +21,21 @@ extern int do_sys_settimeofday64(const struct timespec64 *tv, | |||
| 21 | const struct timezone *tz); | 21 | const struct timezone *tz); |
| 22 | 22 | ||
| 23 | /* | 23 | /* |
| 24 | * ktime_get() family: read the current time in a multitude of ways, | ||
| 25 | * | ||
| 26 | * The default time reference is CLOCK_MONOTONIC, starting at | ||
| 27 | * boot time but not counting the time spent in suspend. | ||
| 28 | * For other references, use the functions with "real", "clocktai", | ||
| 29 | * "boottime" and "raw" suffixes. | ||
| 30 | * | ||
| 31 | * To get the time in a different format, use the ones wit | ||
| 32 | * "ns", "ts64" and "seconds" suffix. | ||
| 33 | * | ||
| 34 | * See Documentation/core-api/timekeeping.rst for more details. | ||
| 35 | */ | ||
| 36 | |||
| 37 | |||
| 38 | /* | ||
| 24 | * timespec64 based interfaces | 39 | * timespec64 based interfaces |
| 25 | */ | 40 | */ |
| 26 | extern void ktime_get_raw_ts64(struct timespec64 *ts); | 41 | extern void ktime_get_raw_ts64(struct timespec64 *ts); |
| @@ -177,7 +192,7 @@ static inline time64_t ktime_get_clocktai_seconds(void) | |||
| 177 | extern bool timekeeping_rtc_skipsuspend(void); | 192 | extern bool timekeeping_rtc_skipsuspend(void); |
| 178 | extern bool timekeeping_rtc_skipresume(void); | 193 | extern bool timekeeping_rtc_skipresume(void); |
| 179 | 194 | ||
| 180 | extern void timekeeping_inject_sleeptime64(struct timespec64 *delta); | 195 | extern void timekeeping_inject_sleeptime64(const struct timespec64 *delta); |
| 181 | 196 | ||
| 182 | /* | 197 | /* |
| 183 | * struct system_time_snapshot - simultaneous raw/real time capture with | 198 | * struct system_time_snapshot - simultaneous raw/real time capture with |
| @@ -243,7 +258,8 @@ extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot); | |||
| 243 | extern int persistent_clock_is_local; | 258 | extern int persistent_clock_is_local; |
| 244 | 259 | ||
| 245 | extern void read_persistent_clock64(struct timespec64 *ts); | 260 | extern void read_persistent_clock64(struct timespec64 *ts); |
| 246 | extern void read_boot_clock64(struct timespec64 *ts); | 261 | void read_persistent_clock_and_boot_offset(struct timespec64 *wall_clock, |
| 262 | struct timespec64 *boot_offset); | ||
| 247 | extern int update_persistent_clock64(struct timespec64 now); | 263 | extern int update_persistent_clock64(struct timespec64 now); |
| 248 | 264 | ||
| 249 | /* | 265 | /* |
diff --git a/include/linux/torture.h b/include/linux/torture.h index 66272862070b..61dfd93b6ee4 100644 --- a/include/linux/torture.h +++ b/include/linux/torture.h | |||
| @@ -64,6 +64,8 @@ struct torture_random_state { | |||
| 64 | long trs_count; | 64 | long trs_count; |
| 65 | }; | 65 | }; |
| 66 | #define DEFINE_TORTURE_RANDOM(name) struct torture_random_state name = { 0, 0 } | 66 | #define DEFINE_TORTURE_RANDOM(name) struct torture_random_state name = { 0, 0 } |
| 67 | #define DEFINE_TORTURE_RANDOM_PERCPU(name) \ | ||
| 68 | DEFINE_PER_CPU(struct torture_random_state, name) | ||
| 67 | unsigned long torture_random(struct torture_random_state *trsp); | 69 | unsigned long torture_random(struct torture_random_state *trsp); |
| 68 | 70 | ||
| 69 | /* Task shuffler, which causes CPUs to occasionally go idle. */ | 71 | /* Task shuffler, which causes CPUs to occasionally go idle. */ |
| @@ -79,7 +81,7 @@ void stutter_wait(const char *title); | |||
| 79 | int torture_stutter_init(int s); | 81 | int torture_stutter_init(int s); |
| 80 | 82 | ||
| 81 | /* Initialization and cleanup. */ | 83 | /* Initialization and cleanup. */ |
| 82 | bool torture_init_begin(char *ttype, bool v); | 84 | bool torture_init_begin(char *ttype, int v); |
| 83 | void torture_init_end(void); | 85 | void torture_init_end(void); |
| 84 | bool torture_cleanup_begin(void); | 86 | bool torture_cleanup_begin(void); |
| 85 | void torture_cleanup_end(void); | 87 | void torture_cleanup_end(void); |
diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 06639fb6ab85..4609b94142d4 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h | |||
| @@ -43,6 +43,8 @@ struct tpm_class_ops { | |||
| 43 | u8 (*status) (struct tpm_chip *chip); | 43 | u8 (*status) (struct tpm_chip *chip); |
| 44 | bool (*update_timeouts)(struct tpm_chip *chip, | 44 | bool (*update_timeouts)(struct tpm_chip *chip, |
| 45 | unsigned long *timeout_cap); | 45 | unsigned long *timeout_cap); |
| 46 | int (*go_idle)(struct tpm_chip *chip); | ||
| 47 | int (*cmd_ready)(struct tpm_chip *chip); | ||
| 46 | int (*request_locality)(struct tpm_chip *chip, int loc); | 48 | int (*request_locality)(struct tpm_chip *chip, int loc); |
| 47 | int (*relinquish_locality)(struct tpm_chip *chip, int loc); | 49 | int (*relinquish_locality)(struct tpm_chip *chip, int loc); |
| 48 | void (*clk_enable)(struct tpm_chip *chip, bool value); | 50 | void (*clk_enable)(struct tpm_chip *chip, bool value); |
| @@ -61,6 +63,7 @@ extern int tpm_seal_trusted(struct tpm_chip *chip, | |||
| 61 | extern int tpm_unseal_trusted(struct tpm_chip *chip, | 63 | extern int tpm_unseal_trusted(struct tpm_chip *chip, |
| 62 | struct trusted_key_payload *payload, | 64 | struct trusted_key_payload *payload, |
| 63 | struct trusted_key_options *options); | 65 | struct trusted_key_options *options); |
| 66 | extern struct tpm_chip *tpm_default_chip(void); | ||
| 64 | #else | 67 | #else |
| 65 | static inline int tpm_is_tpm2(struct tpm_chip *chip) | 68 | static inline int tpm_is_tpm2(struct tpm_chip *chip) |
| 66 | { | 69 | { |
| @@ -96,5 +99,9 @@ static inline int tpm_unseal_trusted(struct tpm_chip *chip, | |||
| 96 | { | 99 | { |
| 97 | return -ENODEV; | 100 | return -ENODEV; |
| 98 | } | 101 | } |
| 102 | static inline struct tpm_chip *tpm_default_chip(void) | ||
| 103 | { | ||
| 104 | return NULL; | ||
| 105 | } | ||
| 99 | #endif | 106 | #endif |
| 100 | #endif | 107 | #endif |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 4a8841963c2e..05589a3e37f4 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | #include <linux/security.h> | 51 | #include <linux/security.h> |
| 52 | #include <linux/task_work.h> | 52 | #include <linux/task_work.h> |
| 53 | #include <linux/memcontrol.h> | 53 | #include <linux/memcontrol.h> |
| 54 | #include <linux/blk-cgroup.h> | ||
| 54 | struct linux_binprm; | 55 | struct linux_binprm; |
| 55 | 56 | ||
| 56 | /* | 57 | /* |
| @@ -192,6 +193,7 @@ static inline void tracehook_notify_resume(struct pt_regs *regs) | |||
| 192 | task_work_run(); | 193 | task_work_run(); |
| 193 | 194 | ||
| 194 | mem_cgroup_handle_over_high(); | 195 | mem_cgroup_handle_over_high(); |
| 196 | blkcg_maybe_throttle_current(); | ||
| 195 | } | 197 | } |
| 196 | 198 | ||
| 197 | #endif /* <linux/tracehook.h> */ | 199 | #endif /* <linux/tracehook.h> */ |
diff --git a/include/linux/udp.h b/include/linux/udp.h index ca840345571b..320d49d85484 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
| @@ -74,8 +74,8 @@ struct udp_sock { | |||
| 74 | void (*encap_destroy)(struct sock *sk); | 74 | void (*encap_destroy)(struct sock *sk); |
| 75 | 75 | ||
| 76 | /* GRO functions for UDP socket */ | 76 | /* GRO functions for UDP socket */ |
| 77 | struct sk_buff ** (*gro_receive)(struct sock *sk, | 77 | struct sk_buff * (*gro_receive)(struct sock *sk, |
| 78 | struct sk_buff **head, | 78 | struct list_head *head, |
| 79 | struct sk_buff *skb); | 79 | struct sk_buff *skb); |
| 80 | int (*gro_complete)(struct sock *sk, | 80 | int (*gro_complete)(struct sock *sk, |
| 81 | struct sk_buff *skb, | 81 | struct sk_buff *skb, |
diff --git a/include/linux/usb/audio-v3.h b/include/linux/usb/audio-v3.h index a710e28b5215..6b708434b7f9 100644 --- a/include/linux/usb/audio-v3.h +++ b/include/linux/usb/audio-v3.h | |||
| @@ -387,6 +387,12 @@ struct uac3_interrupt_data_msg { | |||
| 387 | #define UAC3_CONNECTORS 0x0f | 387 | #define UAC3_CONNECTORS 0x0f |
| 388 | #define UAC3_POWER_DOMAIN 0x10 | 388 | #define UAC3_POWER_DOMAIN 0x10 |
| 389 | 389 | ||
| 390 | /* A.20 PROCESSING UNIT PROCESS TYPES */ | ||
| 391 | #define UAC3_PROCESS_UNDEFINED 0x00 | ||
| 392 | #define UAC3_PROCESS_UP_DOWNMIX 0x01 | ||
| 393 | #define UAC3_PROCESS_STEREO_EXTENDER 0x02 | ||
| 394 | #define UAC3_PROCESS_MULTI_FUNCTION 0x03 | ||
| 395 | |||
| 390 | /* A.22 AUDIO CLASS-SPECIFIC REQUEST CODES */ | 396 | /* A.22 AUDIO CLASS-SPECIFIC REQUEST CODES */ |
| 391 | /* see audio-v2.h for the rest, which is identical to v2 */ | 397 | /* see audio-v2.h for the rest, which is identical to v2 */ |
| 392 | #define UAC3_CS_REQ_INTEN 0x04 | 398 | #define UAC3_CS_REQ_INTEN 0x04 |
| @@ -406,6 +412,15 @@ struct uac3_interrupt_data_msg { | |||
| 406 | #define UAC3_TE_OVERFLOW 0x04 | 412 | #define UAC3_TE_OVERFLOW 0x04 |
| 407 | #define UAC3_TE_LATENCY 0x05 | 413 | #define UAC3_TE_LATENCY 0x05 |
| 408 | 414 | ||
| 415 | /* A.23.10 PROCESSING UNITS CONTROL SELECTROS */ | ||
| 416 | |||
| 417 | /* Up/Down Mixer */ | ||
| 418 | #define UAC3_UD_MODE_SELECT 0x01 | ||
| 419 | |||
| 420 | /* Stereo Extender */ | ||
| 421 | #define UAC3_EXT_WIDTH_CONTROL 0x01 | ||
| 422 | |||
| 423 | |||
| 409 | /* BADD predefined Unit/Terminal values */ | 424 | /* BADD predefined Unit/Terminal values */ |
| 410 | #define UAC3_BADD_IT_ID1 1 /* Input Terminal ID1: bTerminalID = 1 */ | 425 | #define UAC3_BADD_IT_ID1 1 /* Input Terminal ID1: bTerminalID = 1 */ |
| 411 | #define UAC3_BADD_FU_ID2 2 /* Feature Unit ID2: bUnitID = 2 */ | 426 | #define UAC3_BADD_FU_ID2 2 /* Feature Unit ID2: bUnitID = 2 */ |
| @@ -432,4 +447,8 @@ struct uac3_interrupt_data_msg { | |||
| 432 | /* BADD sample rate is always fixed to 48kHz */ | 447 | /* BADD sample rate is always fixed to 48kHz */ |
| 433 | #define UAC3_BADD_SAMPLING_RATE 48000 | 448 | #define UAC3_BADD_SAMPLING_RATE 48000 |
| 434 | 449 | ||
| 450 | /* BADD power domains recovery times in 50us increments */ | ||
| 451 | #define UAC3_BADD_PD_RECOVER_D1D0 0x0258 /* 30ms */ | ||
| 452 | #define UAC3_BADD_PD_RECOVER_D2D0 0x1770 /* 300ms */ | ||
| 453 | |||
| 435 | #endif /* __LINUX_USB_AUDIO_V3_H */ | 454 | #endif /* __LINUX_USB_AUDIO_V3_H */ |
diff --git a/include/linux/verification.h b/include/linux/verification.h index a10549a6c7cd..cfa4730d607a 100644 --- a/include/linux/verification.h +++ b/include/linux/verification.h | |||
| @@ -13,6 +13,12 @@ | |||
| 13 | #define _LINUX_VERIFICATION_H | 13 | #define _LINUX_VERIFICATION_H |
| 14 | 14 | ||
| 15 | /* | 15 | /* |
| 16 | * Indicate that both builtin trusted keys and secondary trusted keys | ||
| 17 | * should be used. | ||
| 18 | */ | ||
| 19 | #define VERIFY_USE_SECONDARY_KEYRING ((struct key *)1UL) | ||
| 20 | |||
| 21 | /* | ||
| 16 | * The use to which an asymmetric key is being put. | 22 | * The use to which an asymmetric key is being put. |
| 17 | */ | 23 | */ |
| 18 | enum key_being_used_for { | 24 | enum key_being_used_for { |
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h index 77f0f0af3a71..a34539b7f750 100644 --- a/include/linux/vga_switcheroo.h +++ b/include/linux/vga_switcheroo.h | |||
| @@ -84,8 +84,8 @@ enum vga_switcheroo_state { | |||
| 84 | * Client identifier. Audio clients use the same identifier & 0x100. | 84 | * Client identifier. Audio clients use the same identifier & 0x100. |
| 85 | */ | 85 | */ |
| 86 | enum vga_switcheroo_client_id { | 86 | enum vga_switcheroo_client_id { |
| 87 | VGA_SWITCHEROO_UNKNOWN_ID = -1, | 87 | VGA_SWITCHEROO_UNKNOWN_ID = 0x1000, |
| 88 | VGA_SWITCHEROO_IGD, | 88 | VGA_SWITCHEROO_IGD = 0, |
| 89 | VGA_SWITCHEROO_DIS, | 89 | VGA_SWITCHEROO_DIS, |
| 90 | VGA_SWITCHEROO_MAX_CLIENTS, | 90 | VGA_SWITCHEROO_MAX_CLIENTS, |
| 91 | }; | 91 | }; |
| @@ -151,7 +151,7 @@ int vga_switcheroo_register_client(struct pci_dev *dev, | |||
| 151 | bool driver_power_control); | 151 | bool driver_power_control); |
| 152 | int vga_switcheroo_register_audio_client(struct pci_dev *pdev, | 152 | int vga_switcheroo_register_audio_client(struct pci_dev *pdev, |
| 153 | const struct vga_switcheroo_client_ops *ops, | 153 | const struct vga_switcheroo_client_ops *ops, |
| 154 | enum vga_switcheroo_client_id id); | 154 | struct pci_dev *vga_dev); |
| 155 | 155 | ||
| 156 | void vga_switcheroo_client_fb_set(struct pci_dev *dev, | 156 | void vga_switcheroo_client_fb_set(struct pci_dev *dev, |
| 157 | struct fb_info *info); | 157 | struct fb_info *info); |
| @@ -180,7 +180,7 @@ static inline int vga_switcheroo_register_handler(const struct vga_switcheroo_ha | |||
| 180 | enum vga_switcheroo_handler_flags_t handler_flags) { return 0; } | 180 | enum vga_switcheroo_handler_flags_t handler_flags) { return 0; } |
| 181 | static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, | 181 | static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, |
| 182 | const struct vga_switcheroo_client_ops *ops, | 182 | const struct vga_switcheroo_client_ops *ops, |
| 183 | enum vga_switcheroo_client_id id) { return 0; } | 183 | struct pci_dev *vga_dev) { return 0; } |
| 184 | static inline void vga_switcheroo_unregister_handler(void) {} | 184 | static inline void vga_switcheroo_unregister_handler(void) {} |
| 185 | static inline enum vga_switcheroo_handler_flags_t vga_switcheroo_handler_flags(void) { return 0; } | 185 | static inline enum vga_switcheroo_handler_flags_t vga_switcheroo_handler_flags(void) { return 0; } |
| 186 | static inline int vga_switcheroo_lock_ddc(struct pci_dev *pdev) { return -ENODEV; } | 186 | static inline int vga_switcheroo_lock_ddc(struct pci_dev *pdev) { return -ENODEV; } |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 5559a2d31c46..32baf8e26735 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
| @@ -79,7 +79,8 @@ struct virtio_config_ops { | |||
| 79 | u64 (*get_features)(struct virtio_device *vdev); | 79 | u64 (*get_features)(struct virtio_device *vdev); |
| 80 | int (*finalize_features)(struct virtio_device *vdev); | 80 | int (*finalize_features)(struct virtio_device *vdev); |
| 81 | const char *(*bus_name)(struct virtio_device *vdev); | 81 | const char *(*bus_name)(struct virtio_device *vdev); |
| 82 | int (*set_vq_affinity)(struct virtqueue *vq, int cpu); | 82 | int (*set_vq_affinity)(struct virtqueue *vq, |
| 83 | const struct cpumask *cpu_mask); | ||
| 83 | const struct cpumask *(*get_vq_affinity)(struct virtio_device *vdev, | 84 | const struct cpumask *(*get_vq_affinity)(struct virtio_device *vdev, |
| 84 | int index); | 85 | int index); |
| 85 | }; | 86 | }; |
| @@ -236,11 +237,11 @@ const char *virtio_bus_name(struct virtio_device *vdev) | |||
| 236 | * | 237 | * |
| 237 | */ | 238 | */ |
| 238 | static inline | 239 | static inline |
| 239 | int virtqueue_set_affinity(struct virtqueue *vq, int cpu) | 240 | int virtqueue_set_affinity(struct virtqueue *vq, const struct cpumask *cpu_mask) |
| 240 | { | 241 | { |
| 241 | struct virtio_device *vdev = vq->vdev; | 242 | struct virtio_device *vdev = vq->vdev; |
| 242 | if (vdev->config->set_vq_affinity) | 243 | if (vdev->config->set_vq_affinity) |
| 243 | return vdev->config->set_vq_affinity(vq, cpu); | 244 | return vdev->config->set_vq_affinity(vq, cpu_mask); |
| 244 | return 0; | 245 | return 0; |
| 245 | } | 246 | } |
| 246 | 247 | ||
diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h index 39fda195bf78..3af7c0e03be5 100644 --- a/include/linux/ww_mutex.h +++ b/include/linux/ww_mutex.h | |||
| @@ -6,8 +6,10 @@ | |||
| 6 | * | 6 | * |
| 7 | * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 7 | * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 8 | * | 8 | * |
| 9 | * Wound/wait implementation: | 9 | * Wait/Die implementation: |
| 10 | * Copyright (C) 2013 Canonical Ltd. | 10 | * Copyright (C) 2013 Canonical Ltd. |
| 11 | * Choice of algorithm: | ||
| 12 | * Copyright (C) 2018 WMWare Inc. | ||
| 11 | * | 13 | * |
| 12 | * This file contains the main data structure and API definitions. | 14 | * This file contains the main data structure and API definitions. |
| 13 | */ | 15 | */ |
| @@ -23,14 +25,17 @@ struct ww_class { | |||
| 23 | struct lock_class_key mutex_key; | 25 | struct lock_class_key mutex_key; |
| 24 | const char *acquire_name; | 26 | const char *acquire_name; |
| 25 | const char *mutex_name; | 27 | const char *mutex_name; |
| 28 | unsigned int is_wait_die; | ||
| 26 | }; | 29 | }; |
| 27 | 30 | ||
| 28 | struct ww_acquire_ctx { | 31 | struct ww_acquire_ctx { |
| 29 | struct task_struct *task; | 32 | struct task_struct *task; |
| 30 | unsigned long stamp; | 33 | unsigned long stamp; |
| 31 | unsigned acquired; | 34 | unsigned int acquired; |
| 35 | unsigned short wounded; | ||
| 36 | unsigned short is_wait_die; | ||
| 32 | #ifdef CONFIG_DEBUG_MUTEXES | 37 | #ifdef CONFIG_DEBUG_MUTEXES |
| 33 | unsigned done_acquire; | 38 | unsigned int done_acquire; |
| 34 | struct ww_class *ww_class; | 39 | struct ww_class *ww_class; |
| 35 | struct ww_mutex *contending_lock; | 40 | struct ww_mutex *contending_lock; |
| 36 | #endif | 41 | #endif |
| @@ -38,8 +43,8 @@ struct ww_acquire_ctx { | |||
| 38 | struct lockdep_map dep_map; | 43 | struct lockdep_map dep_map; |
| 39 | #endif | 44 | #endif |
| 40 | #ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH | 45 | #ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH |
| 41 | unsigned deadlock_inject_interval; | 46 | unsigned int deadlock_inject_interval; |
| 42 | unsigned deadlock_inject_countdown; | 47 | unsigned int deadlock_inject_countdown; |
| 43 | #endif | 48 | #endif |
| 44 | }; | 49 | }; |
| 45 | 50 | ||
| @@ -58,17 +63,21 @@ struct ww_mutex { | |||
| 58 | # define __WW_CLASS_MUTEX_INITIALIZER(lockname, class) | 63 | # define __WW_CLASS_MUTEX_INITIALIZER(lockname, class) |
| 59 | #endif | 64 | #endif |
| 60 | 65 | ||
| 61 | #define __WW_CLASS_INITIALIZER(ww_class) \ | 66 | #define __WW_CLASS_INITIALIZER(ww_class, _is_wait_die) \ |
| 62 | { .stamp = ATOMIC_LONG_INIT(0) \ | 67 | { .stamp = ATOMIC_LONG_INIT(0) \ |
| 63 | , .acquire_name = #ww_class "_acquire" \ | 68 | , .acquire_name = #ww_class "_acquire" \ |
| 64 | , .mutex_name = #ww_class "_mutex" } | 69 | , .mutex_name = #ww_class "_mutex" \ |
| 70 | , .is_wait_die = _is_wait_die } | ||
| 65 | 71 | ||
| 66 | #define __WW_MUTEX_INITIALIZER(lockname, class) \ | 72 | #define __WW_MUTEX_INITIALIZER(lockname, class) \ |
| 67 | { .base = __MUTEX_INITIALIZER(lockname.base) \ | 73 | { .base = __MUTEX_INITIALIZER(lockname.base) \ |
| 68 | __WW_CLASS_MUTEX_INITIALIZER(lockname, class) } | 74 | __WW_CLASS_MUTEX_INITIALIZER(lockname, class) } |
| 69 | 75 | ||
| 76 | #define DEFINE_WD_CLASS(classname) \ | ||
| 77 | struct ww_class classname = __WW_CLASS_INITIALIZER(classname, 1) | ||
| 78 | |||
| 70 | #define DEFINE_WW_CLASS(classname) \ | 79 | #define DEFINE_WW_CLASS(classname) \ |
| 71 | struct ww_class classname = __WW_CLASS_INITIALIZER(classname) | 80 | struct ww_class classname = __WW_CLASS_INITIALIZER(classname, 0) |
| 72 | 81 | ||
| 73 | #define DEFINE_WW_MUTEX(mutexname, ww_class) \ | 82 | #define DEFINE_WW_MUTEX(mutexname, ww_class) \ |
| 74 | struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class) | 83 | struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class) |
| @@ -102,7 +111,7 @@ static inline void ww_mutex_init(struct ww_mutex *lock, | |||
| 102 | * | 111 | * |
| 103 | * Context-based w/w mutex acquiring can be done in any order whatsoever within | 112 | * Context-based w/w mutex acquiring can be done in any order whatsoever within |
| 104 | * a given lock class. Deadlocks will be detected and handled with the | 113 | * a given lock class. Deadlocks will be detected and handled with the |
| 105 | * wait/wound logic. | 114 | * wait/die logic. |
| 106 | * | 115 | * |
| 107 | * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can | 116 | * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can |
| 108 | * result in undetected deadlocks and is so forbidden. Mixing different contexts | 117 | * result in undetected deadlocks and is so forbidden. Mixing different contexts |
| @@ -123,6 +132,8 @@ static inline void ww_acquire_init(struct ww_acquire_ctx *ctx, | |||
| 123 | ctx->task = current; | 132 | ctx->task = current; |
| 124 | ctx->stamp = atomic_long_inc_return_relaxed(&ww_class->stamp); | 133 | ctx->stamp = atomic_long_inc_return_relaxed(&ww_class->stamp); |
| 125 | ctx->acquired = 0; | 134 | ctx->acquired = 0; |
| 135 | ctx->wounded = false; | ||
| 136 | ctx->is_wait_die = ww_class->is_wait_die; | ||
| 126 | #ifdef CONFIG_DEBUG_MUTEXES | 137 | #ifdef CONFIG_DEBUG_MUTEXES |
| 127 | ctx->ww_class = ww_class; | 138 | ctx->ww_class = ww_class; |
| 128 | ctx->done_acquire = 0; | 139 | ctx->done_acquire = 0; |
| @@ -195,13 +206,13 @@ static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx) | |||
| 195 | * Lock the w/w mutex exclusively for this task. | 206 | * Lock the w/w mutex exclusively for this task. |
| 196 | * | 207 | * |
| 197 | * Deadlocks within a given w/w class of locks are detected and handled with the | 208 | * Deadlocks within a given w/w class of locks are detected and handled with the |
| 198 | * wait/wound algorithm. If the lock isn't immediately avaiable this function | 209 | * wait/die algorithm. If the lock isn't immediately available this function |
| 199 | * will either sleep until it is (wait case). Or it selects the current context | 210 | * will either sleep until it is (wait case). Or it selects the current context |
| 200 | * for backing off by returning -EDEADLK (wound case). Trying to acquire the | 211 | * for backing off by returning -EDEADLK (die case). Trying to acquire the |
| 201 | * same lock with the same context twice is also detected and signalled by | 212 | * same lock with the same context twice is also detected and signalled by |
| 202 | * returning -EALREADY. Returns 0 if the mutex was successfully acquired. | 213 | * returning -EALREADY. Returns 0 if the mutex was successfully acquired. |
| 203 | * | 214 | * |
| 204 | * In the wound case the caller must release all currently held w/w mutexes for | 215 | * In the die case the caller must release all currently held w/w mutexes for |
| 205 | * the given context and then wait for this contending lock to be available by | 216 | * the given context and then wait for this contending lock to be available by |
| 206 | * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this | 217 | * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this |
| 207 | * lock and proceed with trying to acquire further w/w mutexes (e.g. when | 218 | * lock and proceed with trying to acquire further w/w mutexes (e.g. when |
| @@ -226,14 +237,14 @@ extern int /* __must_check */ ww_mutex_lock(struct ww_mutex *lock, struct ww_acq | |||
| 226 | * Lock the w/w mutex exclusively for this task. | 237 | * Lock the w/w mutex exclusively for this task. |
| 227 | * | 238 | * |
| 228 | * Deadlocks within a given w/w class of locks are detected and handled with the | 239 | * Deadlocks within a given w/w class of locks are detected and handled with the |
| 229 | * wait/wound algorithm. If the lock isn't immediately avaiable this function | 240 | * wait/die algorithm. If the lock isn't immediately available this function |
| 230 | * will either sleep until it is (wait case). Or it selects the current context | 241 | * will either sleep until it is (wait case). Or it selects the current context |
| 231 | * for backing off by returning -EDEADLK (wound case). Trying to acquire the | 242 | * for backing off by returning -EDEADLK (die case). Trying to acquire the |
| 232 | * same lock with the same context twice is also detected and signalled by | 243 | * same lock with the same context twice is also detected and signalled by |
| 233 | * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a | 244 | * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a |
| 234 | * signal arrives while waiting for the lock then this function returns -EINTR. | 245 | * signal arrives while waiting for the lock then this function returns -EINTR. |
| 235 | * | 246 | * |
| 236 | * In the wound case the caller must release all currently held w/w mutexes for | 247 | * In the die case the caller must release all currently held w/w mutexes for |
| 237 | * the given context and then wait for this contending lock to be available by | 248 | * the given context and then wait for this contending lock to be available by |
| 238 | * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to | 249 | * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to |
| 239 | * not acquire this lock and proceed with trying to acquire further w/w mutexes | 250 | * not acquire this lock and proceed with trying to acquire further w/w mutexes |
| @@ -256,7 +267,7 @@ extern int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock, | |||
| 256 | * @lock: the mutex to be acquired | 267 | * @lock: the mutex to be acquired |
| 257 | * @ctx: w/w acquire context | 268 | * @ctx: w/w acquire context |
| 258 | * | 269 | * |
| 259 | * Acquires a w/w mutex with the given context after a wound case. This function | 270 | * Acquires a w/w mutex with the given context after a die case. This function |
| 260 | * will sleep until the lock becomes available. | 271 | * will sleep until the lock becomes available. |
| 261 | * | 272 | * |
| 262 | * The caller must have released all w/w mutexes already acquired with the | 273 | * The caller must have released all w/w mutexes already acquired with the |
| @@ -290,7 +301,7 @@ ww_mutex_lock_slow(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) | |||
| 290 | * @lock: the mutex to be acquired | 301 | * @lock: the mutex to be acquired |
| 291 | * @ctx: w/w acquire context | 302 | * @ctx: w/w acquire context |
| 292 | * | 303 | * |
| 293 | * Acquires a w/w mutex with the given context after a wound case. This function | 304 | * Acquires a w/w mutex with the given context after a die case. This function |
| 294 | * will sleep until the lock becomes available and returns 0 when the lock has | 305 | * will sleep until the lock becomes available and returns 0 when the lock has |
| 295 | * been acquired. If a signal arrives while waiting for the lock then this | 306 | * been acquired. If a signal arrives while waiting for the lock then this |
| 296 | * function returns -EINTR. | 307 | * function returns -EINTR. |
