Conflicts: init/main.c lib/Kconfig.debug
Showing the changes to include/linux (317 of 11292 files). Show all
Unified · Split
| @@ -678,6 +678,14 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv) · 677 unmodified lines | ||
| 678 | 678 | return false; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | +struct acpi_device; | |
| 682 | + | |
| 683 | +static inline bool | |
| 684 | +acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2) | |
| 685 | +{ | |
| 686 | + return false; | |
| 687 | +} | |
| 688 | + | |
| 681 | 689 | static inline struct acpi_device * |
| 682 | 690 | acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) |
| 683 | 691 | { |
| @@ -46,6 +46,8 @@ int pci_enable_pcie_error_reporting(struct pci_dev *dev); · 45 unmodified lines | ||
| 46 | 46 | int pci_disable_pcie_error_reporting(struct pci_dev *dev); |
| 47 | 47 | int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); |
| 48 | 48 | int pci_cleanup_aer_error_status_regs(struct pci_dev *dev); |
| 49 | +void pci_save_aer_state(struct pci_dev *dev); | |
| 50 | +void pci_restore_aer_state(struct pci_dev *dev); | |
| 49 | 51 | #else |
| 50 | 52 | static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) |
| 51 | 53 | { |
| @@ -63,6 +65,8 @@ static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) · 11 unmodified lines | ||
| 63 | 65 | { |
| 64 | 66 | return -EINVAL; |
| 65 | 67 | } |
| 68 | +static inline void pci_save_aer_state(struct pci_dev *dev) {} | |
| 69 | +static inline void pci_restore_aer_state(struct pci_dev *dev) {} | |
| 66 | 70 | #endif |
| 67 | 71 | |
| 68 | 72 | void cper_print_aer(struct pci_dev *dev, int aer_severity, |
| @@ -30,8 +30,6 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <linux/agp_backend.h> |
| 31 | 31 | #include <uapi/linux/agpgart.h> |
| 32 | 32 | |
| 33 | −#define AGPGART_MINOR 175 | |
| 34 | − | |
| 35 | 33 | struct agp_info { |
| 36 | 34 | struct agp_version version; /* version of the driver */ |
| 37 | 35 | u32 bridge_id; /* bridge vendor/device */ |
| @@ -19,6 +19,8 @@ struct ahci_host_priv; · 18 unmodified lines | ||
| 19 | 19 | struct platform_device; |
| 20 | 20 | struct scsi_host_template; |
| 21 | 21 | |
| 22 | +int ahci_platform_enable_phys(struct ahci_host_priv *hpriv); | |
| 23 | +void ahci_platform_disable_phys(struct ahci_host_priv *hpriv); | |
| 22 | 24 | int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); |
| 23 | 25 | void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); |
| 24 | 26 | int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv); |
| @@ -57,6 +57,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu); · 56 unmodified lines | ||
| 57 | 57 | void update_siblings_masks(unsigned int cpu); |
| 58 | 58 | void remove_cpu_topology(unsigned int cpuid); |
| 59 | 59 | void reset_cpu_topology(void); |
| 60 | +int parse_acpi_topology(void); | |
| 60 | 61 | #endif |
| 61 | 62 | |
| 62 | 63 | #endif /* _LINUX_ARCH_TOPOLOGY_H_ */ |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #define ARM_SMCCC_OWNER_SIP 2 |
| 46 | 46 | #define ARM_SMCCC_OWNER_OEM 3 |
| 47 | 47 | #define ARM_SMCCC_OWNER_STANDARD 4 |
| 48 | +#define ARM_SMCCC_OWNER_STANDARD_HYP 5 | |
| 48 | 49 | #define ARM_SMCCC_OWNER_TRUSTED_APP 48 |
| 49 | 50 | #define ARM_SMCCC_OWNER_TRUSTED_APP_END 49 |
| 50 | 51 | #define ARM_SMCCC_OWNER_TRUSTED_OS 50 |
| @@ -80,6 +81,22 @@ · 29 unmodified lines | ||
| 80 | 81 | |
| 81 | 82 | #include <linux/linkage.h> |
| 82 | 83 | #include <linux/types.h> |
| 84 | + | |
| 85 | +enum arm_smccc_conduit { | |
| 86 | + SMCCC_CONDUIT_NONE, | |
| 87 | + SMCCC_CONDUIT_SMC, | |
| 88 | + SMCCC_CONDUIT_HVC, | |
| 89 | +}; | |
| 90 | + | |
| 91 | +/** | |
| 92 | + * arm_smccc_1_1_get_conduit() | |
| 93 | + * | |
| 94 | + * Returns the conduit to be used for SMCCCv1.1 or later. | |
| 95 | + * | |
| 96 | + * When SMCCCv1.1 is not present, returns SMCCC_CONDUIT_NONE. | |
| 97 | + */ | |
| 98 | +enum arm_smccc_conduit arm_smccc_1_1_get_conduit(void); | |
| 99 | + | |
| 83 | 100 | /** |
| 84 | 101 | * struct arm_smccc_res - Result from SMC/HVC call |
| 85 | 102 | * @a0-a3 result values from registers 0 to 3 |
| @@ -302,5 +319,63 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, · 216 unmodified lines | ||
| 302 | 319 | #define SMCCC_RET_NOT_SUPPORTED -1 |
| 303 | 320 | #define SMCCC_RET_NOT_REQUIRED -2 |
| 304 | 321 | |
| 322 | +/* | |
| 323 | + * Like arm_smccc_1_1* but always returns SMCCC_RET_NOT_SUPPORTED. | |
| 324 | + * Used when the SMCCC conduit is not defined. The empty asm statement | |
| 325 | + * avoids compiler warnings about unused variables. | |
| 326 | + */ | |
| 327 | +#define __fail_smccc_1_1(...) \ | |
| 328 | + do { \ | |
| 329 | + __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \ | |
| 330 | + asm ("" __constraints(__count_args(__VA_ARGS__))); \ | |
| 331 | + if (___res) \ | |
| 332 | + ___res->a0 = SMCCC_RET_NOT_SUPPORTED; \ | |
| 333 | + } while (0) | |
| 334 | + | |
| 335 | +/* | |
| 336 | + * arm_smccc_1_1_invoke() - make an SMCCC v1.1 compliant call | |
| 337 | + * | |
| 338 | + * This is a variadic macro taking one to eight source arguments, and | |
| 339 | + * an optional return structure. | |
| 340 | + * | |
| 341 | + * @a0-a7: arguments passed in registers 0 to 7 | |
| 342 | + * @res: result values from registers 0 to 3 | |
| 343 | + * | |
| 344 | + * This macro will make either an HVC call or an SMC call depending on the | |
| 345 | + * current SMCCC conduit. If no valid conduit is available then -1 | |
| 346 | + * (SMCCC_RET_NOT_SUPPORTED) is returned in @res.a0 (if supplied). | |
| 347 | + * | |
| 348 | + * The return value also provides the conduit that was used. | |
| 349 | + */ | |
| 350 | +#define arm_smccc_1_1_invoke(...) ({ \ | |
| 351 | + int method = arm_smccc_1_1_get_conduit(); \ | |
| 352 | + switch (method) { \ | |
| 353 | + case SMCCC_CONDUIT_HVC: \ | |
| 354 | + arm_smccc_1_1_hvc(__VA_ARGS__); \ | |
| 355 | + break; \ | |
| 356 | + case SMCCC_CONDUIT_SMC: \ | |
| 357 | + arm_smccc_1_1_smc(__VA_ARGS__); \ | |
| 358 | + break; \ | |
| 359 | + default: \ | |
| 360 | + __fail_smccc_1_1(__VA_ARGS__); \ | |
| 361 | + method = SMCCC_CONDUIT_NONE; \ | |
| 362 | + break; \ | |
| 363 | + } \ | |
| 364 | + method; \ | |
| 365 | + }) | |
| 366 | + | |
| 367 | +/* Paravirtualised time calls (defined by ARM DEN0057A) */ | |
| 368 | +#define ARM_SMCCC_HV_PV_TIME_FEATURES \ | |
| 369 | + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ | |
| 370 | + ARM_SMCCC_SMC_64, \ | |
| 371 | + ARM_SMCCC_OWNER_STANDARD_HYP, \ | |
| 372 | + 0x20) | |
| 373 | + | |
| 374 | +#define ARM_SMCCC_HV_PV_TIME_ST \ | |
| 375 | + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ | |
| 376 | + ARM_SMCCC_SMC_64, \ | |
| 377 | + ARM_SMCCC_OWNER_STANDARD_HYP, \ | |
| 378 | + 0x21) | |
| 379 | + | |
| 305 | 380 | #endif /*__ASSEMBLY__*/ |
| 306 | 381 | #endif /*__LINUX_ARM_SMCCC_H*/ |
| @@ -5,12 +5,6 @@ · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | #include <uapi/linux/arm_sdei.h> |
| 7 | 7 | |
| 8 | −enum sdei_conduit_types { | |
| 9 | − CONDUIT_INVALID = 0, | |
| 10 | − CONDUIT_SMC, | |
| 11 | − CONDUIT_HVC, | |
| 12 | −}; | |
| 13 | − | |
| 14 | 8 | #include <acpi/ghes.h> |
| 15 | 9 | |
| 16 | 10 | #ifdef CONFIG_ARM_SDE_INTERFACE |
| @@ -156,7 +156,8 @@ extern void audit_log_d_path(struct audit_buffer *ab, · 155 unmodified lines | ||
| 156 | 156 | const struct path *path); |
| 157 | 157 | extern void audit_log_key(struct audit_buffer *ab, |
| 158 | 158 | char *key); |
| 159 | −extern void audit_log_link_denied(const char *operation); | |
| 159 | +extern void audit_log_path_denied(int type, | |
| 160 | + const char *operation); | |
| 160 | 161 | extern void audit_log_lost(const char *message); |
| 161 | 162 | |
| 162 | 163 | extern int audit_log_task_context(struct audit_buffer *ab); |
| @@ -217,7 +218,7 @@ static inline void audit_log_d_path(struct audit_buffer *ab, · 54 unmodified lines | ||
| 217 | 218 | { } |
| 218 | 219 | static inline void audit_log_key(struct audit_buffer *ab, char *key) |
| 219 | 220 | { } |
| 220 | −static inline void audit_log_link_denied(const char *string) | |
| 221 | +static inline void audit_log_path_denied(int type, const char *operation) | |
| 221 | 222 | { } |
| 222 | 223 | static inline int audit_log_task_context(struct audit_buffer *ab) |
| 223 | 224 | { |
| @@ -53,6 +53,7 @@ · 52 unmodified lines | ||
| 53 | 53 | * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above |
| 54 | 54 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n |
| 55 | 55 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n |
| 56 | + * bitmap_replace(dst, old, new, mask, nbits) *dst = (*old & ~(*mask)) | (*new & *mask) | |
| 56 | 57 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) |
| 57 | 58 | * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) |
| 58 | 59 | * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap |
| @@ -66,6 +67,8 @@ · 7 unmodified lines | ||
| 66 | 67 | * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region |
| 67 | 68 | * bitmap_from_arr32(dst, buf, nbits) Copy nbits from u32[] buf to dst |
| 68 | 69 | * bitmap_to_arr32(buf, src, nbits) Copy nbits from buf to u32[] dst |
| 70 | + * bitmap_get_value8(map, start) Get 8bit value from map at start | |
| 71 | + * bitmap_set_value8(map, value, start) Set 8bit value to map at start | |
| 69 | 72 | * |
| 70 | 73 | * Note, bitmap_zero() and bitmap_fill() operate over the region of |
| 71 | 74 | * unsigned longs, that is, bits behind bitmap till the unsigned long |
| @@ -138,6 +141,9 @@ extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, · 66 unmodified lines | ||
| 138 | 141 | const unsigned long *bitmap2, unsigned int nbits); |
| 139 | 142 | extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, |
| 140 | 143 | const unsigned long *bitmap2, unsigned int nbits); |
| 144 | +extern void __bitmap_replace(unsigned long *dst, | |
| 145 | + const unsigned long *old, const unsigned long *new, | |
| 146 | + const unsigned long *mask, unsigned int nbits); | |
| 141 | 147 | extern int __bitmap_intersects(const unsigned long *bitmap1, |
| 142 | 148 | const unsigned long *bitmap2, unsigned int nbits); |
| 143 | 149 | extern int __bitmap_subset(const unsigned long *bitmap1, |
| @@ -432,6 +438,18 @@ static inline void bitmap_shift_left(unsigned long *dst, const unsigned long *sr · 288 unmodified lines | ||
| 432 | 438 | __bitmap_shift_left(dst, src, shift, nbits); |
| 433 | 439 | } |
| 434 | 440 | |
| 441 | +static inline void bitmap_replace(unsigned long *dst, | |
| 442 | + const unsigned long *old, | |
| 443 | + const unsigned long *new, | |
| 444 | + const unsigned long *mask, | |
| 445 | + unsigned int nbits) | |
| 446 | +{ | |
| 447 | + if (small_const_nbits(nbits)) | |
| 448 | + *dst = (*old & ~(*mask)) | (*new & *mask); | |
| 449 | + else | |
| 450 | + __bitmap_replace(dst, old, new, mask, nbits); | |
| 451 | +} | |
| 452 | + | |
| 435 | 453 | static inline int bitmap_parse(const char *buf, unsigned int buflen, |
| 436 | 454 | unsigned long *maskp, int nmaskbits) |
| 437 | 455 | { |
| @@ -489,6 +507,39 @@ static inline void bitmap_from_u64(unsigned long *dst, u64 mask) · 51 unmodified lines | ||
| 489 | 507 | dst[1] = mask >> 32; |
| 490 | 508 | } |
| 491 | 509 | |
| 510 | +/** | |
| 511 | + * bitmap_get_value8 - get an 8-bit value within a memory region | |
| 512 | + * @map: address to the bitmap memory region | |
| 513 | + * @start: bit offset of the 8-bit value; must be a multiple of 8 | |
| 514 | + * | |
| 515 | + * Returns the 8-bit value located at the @start bit offset within the @src | |
| 516 | + * memory region. | |
| 517 | + */ | |
| 518 | +static inline unsigned long bitmap_get_value8(const unsigned long *map, | |
| 519 | + unsigned long start) | |
| 520 | +{ | |
| 521 | + const size_t index = BIT_WORD(start); | |
| 522 | + const unsigned long offset = start % BITS_PER_LONG; | |
| 523 | + | |
| 524 | + return (map[index] >> offset) & 0xFF; | |
| 525 | +} | |
| 526 | + | |
| 527 | +/** | |
| 528 | + * bitmap_set_value8 - set an 8-bit value within a memory region | |
| 529 | + * @map: address to the bitmap memory region | |
| 530 | + * @value: the 8-bit value; values wider than 8 bits may clobber bitmap | |
| 531 | + * @start: bit offset of the 8-bit value; must be a multiple of 8 | |
| 532 | + */ | |
| 533 | +static inline void bitmap_set_value8(unsigned long *map, unsigned long value, | |
| 534 | + unsigned long start) | |
| 535 | +{ | |
| 536 | + const size_t index = BIT_WORD(start); | |
| 537 | + const unsigned long offset = start % BITS_PER_LONG; | |
| 538 | + | |
| 539 | + map[index] &= ~(0xFFUL << offset); | |
| 540 | + map[index] |= value << offset; | |
| 541 | +} | |
| 542 | + | |
| 492 | 543 | #endif /* __ASSEMBLY__ */ |
| 493 | 544 | |
| 494 | 545 | #endif /* __LINUX_BITMAP_H */ |
| @@ -47,6 +47,18 @@ extern unsigned long __sw_hweight64(__u64 w); · 46 unmodified lines | ||
| 47 | 47 | (bit) < (size); \ |
| 48 | 48 | (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) |
| 49 | 49 | |
| 50 | +/** | |
| 51 | + * for_each_set_clump8 - iterate over bitmap for each 8-bit clump with set bits | |
| 52 | + * @start: bit offset to start search and to store the current iteration offset | |
| 53 | + * @clump: location to store copy of current 8-bit clump | |
| 54 | + * @bits: bitmap address to base the search on | |
| 55 | + * @size: bitmap size in number of bits | |
| 56 | + */ | |
| 57 | +#define for_each_set_clump8(start, clump, bits, size) \ | |
| 58 | + for ((start) = find_first_clump8(&(clump), (bits), (size)); \ | |
| 59 | + (start) < (size); \ | |
| 60 | + (start) = find_next_clump8(&(clump), (bits), (size), (start) + 8)) | |
| 61 | + | |
| 50 | 62 | static inline int get_bitmask_order(unsigned int count) |
| 51 | 63 | { |
| 52 | 64 | int order; |
| @@ -15,7 +15,9 @@ · 14 unmodified lines | ||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | #include <linux/cgroup.h> |
| 18 | +#include <linux/percpu.h> | |
| 18 | 19 | #include <linux/percpu_counter.h> |
| 20 | +#include <linux/u64_stats_sync.h> | |
| 19 | 21 | #include <linux/seq_file.h> |
| 20 | 22 | #include <linux/radix-tree.h> |
| 21 | 23 | #include <linux/blkdev.h> |
| @@ -31,15 +33,12 @@ · 9 unmodified lines | ||
| 31 | 33 | |
| 32 | 34 | #ifdef CONFIG_BLK_CGROUP |
| 33 | 35 | |
| 34 | −enum blkg_rwstat_type { | |
| 35 | − BLKG_RWSTAT_READ, | |
| 36 | − BLKG_RWSTAT_WRITE, | |
| 37 | − BLKG_RWSTAT_SYNC, | |
| 38 | − BLKG_RWSTAT_ASYNC, | |
| 39 | − BLKG_RWSTAT_DISCARD, | |
| 36 | +enum blkg_iostat_type { | |
| 37 | + BLKG_IOSTAT_READ, | |
| 38 | + BLKG_IOSTAT_WRITE, | |
| 39 | + BLKG_IOSTAT_DISCARD, | |
| 40 | 40 | |
| 41 | − BLKG_RWSTAT_NR, | |
| 42 | − BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR, | |
| 41 | + BLKG_IOSTAT_NR, | |
| 43 | 42 | }; |
| 44 | 43 | |
| 45 | 44 | struct blkcg_gq; |
| @@ -61,17 +60,15 @@ struct blkcg { · 15 unmodified lines | ||
| 61 | 60 | #endif |
| 62 | 61 | }; |
| 63 | 62 | |
| 64 | −/* | |
| 65 | − * blkg_[rw]stat->aux_cnt is excluded for local stats but included for | |
| 66 | − * recursive. Used to carry stats of dead children. | |
| 67 | − */ | |
| 68 | −struct blkg_rwstat { | |
| 69 | − struct percpu_counter cpu_cnt[BLKG_RWSTAT_NR]; | |
| 70 | − atomic64_t aux_cnt[BLKG_RWSTAT_NR]; | |
| 63 | +struct blkg_iostat { | |
| 64 | + u64 bytes[BLKG_IOSTAT_NR]; | |
| 65 | + u64 ios[BLKG_IOSTAT_NR]; | |
| 71 | 66 | }; |
| 72 | 67 | |
| 73 | −struct blkg_rwstat_sample { | |
| 74 | − u64 cnt[BLKG_RWSTAT_NR]; | |
| 68 | +struct blkg_iostat_set { | |
| 69 | + struct u64_stats_sync sync; | |
| 70 | + struct blkg_iostat cur; | |
| 71 | + struct blkg_iostat last; | |
| 75 | 72 | }; |
| 76 | 73 | |
| 77 | 74 | /* |
| @@ -127,8 +124,8 @@ struct blkcg_gq { · 49 unmodified lines | ||
| 127 | 124 | /* is this blkg online? protected by both blkcg and q locks */ |
| 128 | 125 | bool online; |
| 129 | 126 | |
| 130 | − struct blkg_rwstat stat_bytes; | |
| 131 | − struct blkg_rwstat stat_ios; | |
| 127 | + struct blkg_iostat_set __percpu *iostat_cpu; | |
| 128 | + struct blkg_iostat_set iostat; | |
| 132 | 129 | |
| 133 | 130 | struct blkg_policy_data *pd[BLKCG_MAX_POLS]; |
| 134 | 131 | |
| @@ -191,7 +188,6 @@ struct blkcg_gq *__blkg_lookup_create(struct blkcg *blkcg, · 56 unmodified lines | ||
| 191 | 188 | struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, |
| 192 | 189 | struct request_queue *q); |
| 193 | 190 | int blkcg_init_queue(struct request_queue *q); |
| 194 | −void blkcg_drain_queue(struct request_queue *q); | |
| 195 | 191 | void blkcg_exit_queue(struct request_queue *q); |
| 196 | 192 | |
| 197 | 193 | /* Blkio controller policy registration */ |
| @@ -202,13 +198,6 @@ int blkcg_activate_policy(struct request_queue *q, · 4 unmodified lines | ||
| 202 | 198 | void blkcg_deactivate_policy(struct request_queue *q, |
| 203 | 199 | const struct blkcg_policy *pol); |
| 204 | 200 | |
| 205 | −static inline u64 blkg_rwstat_read_counter(struct blkg_rwstat *rwstat, | |
| 206 | − unsigned int idx) | |
| 207 | −{ | |
| 208 | − return atomic64_read(&rwstat->aux_cnt[idx]) + | |
| 209 | − percpu_counter_sum_positive(&rwstat->cpu_cnt[idx]); | |
| 210 | −} | |
| 211 | − | |
| 212 | 201 | const char *blkg_dev_name(struct blkcg_gq *blkg); |
| 213 | 202 | void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, |
| 214 | 203 | u64 (*prfill)(struct seq_file *, |
| @@ -216,17 +205,6 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, · 1 unmodified line | ||
| 216 | 205 | const struct blkcg_policy *pol, int data, |
| 217 | 206 | bool show_total); |
| 218 | 207 | u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v); |
| 219 | −u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, | |
| 220 | − const struct blkg_rwstat_sample *rwstat); | |
| 221 | −u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, | |
| 222 | − int off); | |
| 223 | −int blkg_print_stat_bytes(struct seq_file *sf, void *v); | |
| 224 | −int blkg_print_stat_ios(struct seq_file *sf, void *v); | |
| 225 | −int blkg_print_stat_bytes_recursive(struct seq_file *sf, void *v); | |
| 226 | −int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v); | |
| 227 | − | |
| 228 | −void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, | |
| 229 | − int off, struct blkg_rwstat_sample *sum); | |
| 230 | 208 | |
| 231 | 209 | struct blkg_conf_ctx { |
| 232 | 210 | struct gendisk *disk; |
| @@ -578,128 +556,6 @@ static inline void blkg_put(struct blkcg_gq *blkg) · 345 unmodified lines | ||
| 578 | 556 | if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \ |
| 579 | 557 | (p_blkg)->q, false))) |
| 580 | 558 | |
| 581 | −static inline int blkg_rwstat_init(struct blkg_rwstat *rwstat, gfp_t gfp) | |
| 582 | −{ | |
| 583 | − int i, ret; | |
| 584 | − | |
| 585 | − for (i = 0; i < BLKG_RWSTAT_NR; i++) { | |
| 586 | − ret = percpu_counter_init(&rwstat->cpu_cnt[i], 0, gfp); | |
| 587 | − if (ret) { | |
| 588 | − while (--i >= 0) | |
| 589 | − percpu_counter_destroy(&rwstat->cpu_cnt[i]); | |
| 590 | − return ret; | |
| 591 | − } | |
| 592 | − atomic64_set(&rwstat->aux_cnt[i], 0); | |
| 593 | − } | |
| 594 | − return 0; | |
| 595 | −} | |
| 596 | − | |
| 597 | −static inline void blkg_rwstat_exit(struct blkg_rwstat *rwstat) | |
| 598 | −{ | |
| 599 | − int i; | |
| 600 | − | |
| 601 | − for (i = 0; i < BLKG_RWSTAT_NR; i++) | |
| 602 | − percpu_counter_destroy(&rwstat->cpu_cnt[i]); | |
| 603 | −} | |
| 604 | − | |
| 605 | −/** | |
| 606 | − * blkg_rwstat_add - add a value to a blkg_rwstat | |
| 607 | − * @rwstat: target blkg_rwstat | |
| 608 | − * @op: REQ_OP and flags | |
| 609 | − * @val: value to add | |
| 610 | − * | |
| 611 | − * Add @val to @rwstat. The counters are chosen according to @rw. The | |
| 612 | − * caller is responsible for synchronizing calls to this function. | |
| 613 | − */ | |
| 614 | −static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat, | |
| 615 | − unsigned int op, uint64_t val) | |
| 616 | −{ | |
| 617 | − struct percpu_counter *cnt; | |
| 618 | − | |
| 619 | − if (op_is_discard(op)) | |
| 620 | − cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_DISCARD]; | |
| 621 | − else if (op_is_write(op)) | |
| 622 | − cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_WRITE]; | |
| 623 | − else | |
| 624 | − cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_READ]; | |
| 625 | − | |
| 626 | − percpu_counter_add_batch(cnt, val, BLKG_STAT_CPU_BATCH); | |
| 627 | − | |
| 628 | − if (op_is_sync(op)) | |
| 629 | − cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_SYNC]; | |
| 630 | − else | |
| 631 | − cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_ASYNC]; | |
| 632 | − | |
| 633 | − percpu_counter_add_batch(cnt, val, BLKG_STAT_CPU_BATCH); | |
| 634 | −} | |
| 635 | − | |
| 636 | −/** | |
| 637 | − * blkg_rwstat_read - read the current values of a blkg_rwstat | |
| 638 | − * @rwstat: blkg_rwstat to read | |
| 639 | − * | |
| 640 | − * Read the current snapshot of @rwstat and return it in the aux counts. | |
| 641 | − */ | |
| 642 | −static inline void blkg_rwstat_read(struct blkg_rwstat *rwstat, | |
| 643 | − struct blkg_rwstat_sample *result) | |
| 644 | −{ | |
| 645 | − int i; | |
| 646 | − | |
| 647 | − for (i = 0; i < BLKG_RWSTAT_NR; i++) | |
| 648 | − result->cnt[i] = | |
| 649 | − percpu_counter_sum_positive(&rwstat->cpu_cnt[i]); | |
| 650 | −} | |
| 651 | − | |
| 652 | −/** | |
| 653 | − * blkg_rwstat_total - read the total count of a blkg_rwstat | |
| 654 | − * @rwstat: blkg_rwstat to read | |
| 655 | − * | |
| 656 | − * Return the total count of @rwstat regardless of the IO direction. This | |
| 657 | − * function can be called without synchronization and takes care of u64 | |
| 658 | − * atomicity. | |
| 659 | − */ | |
| 660 | −static inline uint64_t blkg_rwstat_total(struct blkg_rwstat *rwstat) | |
| 661 | −{ | |
| 662 | − struct blkg_rwstat_sample tmp = { }; | |
| 663 | − | |
| 664 | − blkg_rwstat_read(rwstat, &tmp); | |
| 665 | − return tmp.cnt[BLKG_RWSTAT_READ] + tmp.cnt[BLKG_RWSTAT_WRITE]; | |
| 666 | −} | |
| 667 | − | |
| 668 | −/** | |
| 669 | − * blkg_rwstat_reset - reset a blkg_rwstat | |
| 670 | − * @rwstat: blkg_rwstat to reset | |
| 671 | − */ | |
| 672 | −static inline void blkg_rwstat_reset(struct blkg_rwstat *rwstat) | |
| 673 | −{ | |
| 674 | − int i; | |
| 675 | − | |
| 676 | − for (i = 0; i < BLKG_RWSTAT_NR; i++) { | |
| 677 | − percpu_counter_set(&rwstat->cpu_cnt[i], 0); | |
| 678 | − atomic64_set(&rwstat->aux_cnt[i], 0); | |
| 679 | − } | |
| 680 | −} | |
| 681 | − | |
| 682 | −/** | |
| 683 | − * blkg_rwstat_add_aux - add a blkg_rwstat into another's aux count | |
| 684 | − * @to: the destination blkg_rwstat | |
| 685 | − * @from: the source | |
| 686 | − * | |
| 687 | − * Add @from's count including the aux one to @to's aux count. | |
| 688 | − */ | |
| 689 | −static inline void blkg_rwstat_add_aux(struct blkg_rwstat *to, | |
| 690 | − struct blkg_rwstat *from) | |
| 691 | −{ | |
| 692 | − u64 sum[BLKG_RWSTAT_NR]; | |
| 693 | − int i; | |
| 694 | − | |
| 695 | − for (i = 0; i < BLKG_RWSTAT_NR; i++) | |
| 696 | − sum[i] = percpu_counter_sum_positive(&from->cpu_cnt[i]); | |
| 697 | − | |
| 698 | − for (i = 0; i < BLKG_RWSTAT_NR; i++) | |
| 699 | − atomic64_add(sum[i] + atomic64_read(&from->aux_cnt[i]), | |
| 700 | − &to->aux_cnt[i]); | |
| 701 | −} | |
| 702 | − | |
| 703 | 559 | #ifdef CONFIG_BLK_DEV_THROTTLING |
| 704 | 560 | extern bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, |
| 705 | 561 | struct bio *bio); |
| @@ -745,15 +601,33 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, · 39 unmodified lines | ||
| 745 | 601 | throtl = blk_throtl_bio(q, blkg, bio); |
| 746 | 602 | |
| 747 | 603 | if (!throtl) { |
| 604 | + struct blkg_iostat_set *bis; | |
| 605 | + int rwd, cpu; | |
| 606 | + | |
| 607 | + if (op_is_discard(bio->bi_opf)) | |
| 608 | + rwd = BLKG_IOSTAT_DISCARD; | |
| 609 | + else if (op_is_write(bio->bi_opf)) | |
| 610 | + rwd = BLKG_IOSTAT_WRITE; | |
| 611 | + else | |
| 612 | + rwd = BLKG_IOSTAT_READ; | |
| 613 | + | |
| 614 | + cpu = get_cpu(); | |
| 615 | + bis = per_cpu_ptr(blkg->iostat_cpu, cpu); | |
| 616 | + u64_stats_update_begin(&bis->sync); | |
| 617 | + | |
| 748 | 618 | /* |
| 749 | 619 | * If the bio is flagged with BIO_QUEUE_ENTERED it means this |
| 750 | 620 | * is a split bio and we would have already accounted for the |
| 751 | 621 | * size of the bio. |
| 752 | 622 | */ |
| 753 | 623 | if (!bio_flagged(bio, BIO_QUEUE_ENTERED)) |
| 754 | − blkg_rwstat_add(&blkg->stat_bytes, bio->bi_opf, | |
| 755 | − bio->bi_iter.bi_size); | |
| 756 | − blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1); | |
| 624 | + bis->cur.bytes[rwd] += bio->bi_iter.bi_size; | |
| 625 | + bis->cur.ios[rwd]++; | |
| 626 | + | |
| 627 | + u64_stats_update_end(&bis->sync); | |
| 628 | + if (cgroup_subsys_on_dfl(io_cgrp_subsys)) | |
| 629 | + cgroup_rstat_updated(blkg->blkcg->css.cgroup, cpu); | |
| 630 | + put_cpu(); | |
| 757 | 631 | } |
| 758 | 632 | |
| 759 | 633 | blkcg_bio_issue_init(bio); |
| @@ -845,7 +719,6 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { ret · 85 unmodified lines | ||
| 845 | 719 | static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q) |
| 846 | 720 | { return NULL; } |
| 847 | 721 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } |
| 848 | −static inline void blkcg_drain_queue(struct request_queue *q) { } | |
| 849 | 722 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
| 850 | 723 | static inline int blkcg_policy_register(struct blkcg_policy *pol) { return 0; } |
| 851 | 724 | static inline void blkcg_policy_unregister(struct blkcg_policy *pol) { } |
| @@ -10,103 +10,239 @@ struct blk_mq_tags; · 9 unmodified lines | ||
| 10 | 10 | struct blk_flush_queue; |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | − * struct blk_mq_hw_ctx - State for a hardware queue facing the hardware block device | |
| 13 | + * struct blk_mq_hw_ctx - State for a hardware queue facing the hardware | |
| 14 | + * block device | |
| 14 | 15 | */ |
| 15 | 16 | struct blk_mq_hw_ctx { |
| 16 | 17 | struct { |
| 18 | + /** @lock: Protects the dispatch list. */ | |
| 17 | 19 | spinlock_t lock; |
| 20 | + /** | |
| 21 | + * @dispatch: Used for requests that are ready to be | |
| 22 | + * dispatched to the hardware but for some reason (e.g. lack of | |
| 23 | + * resources) could not be sent to the hardware. As soon as the | |
| 24 | + * driver can send new requests, requests at this list will | |
| 25 | + * be sent first for a fairer dispatch. | |
| 26 | + */ | |
| 18 | 27 | struct list_head dispatch; |
| 19 | − unsigned long state; /* BLK_MQ_S_* flags */ | |
| 28 | + /** | |
| 29 | + * @state: BLK_MQ_S_* flags. Defines the state of the hw | |
| 30 | + * queue (active, scheduled to restart, stopped). | |
| 31 | + */ | |
| 32 | + unsigned long state; | |
| 20 | 33 | } ____cacheline_aligned_in_smp; |
| 21 | 34 | |
| 35 | + /** | |
| 36 | + * @run_work: Used for scheduling a hardware queue run at a later time. | |
| 37 | + */ | |
| 22 | 38 | struct delayed_work run_work; |
| 39 | + /** @cpumask: Map of available CPUs where this hctx can run. */ | |
| 23 | 40 | cpumask_var_t cpumask; |
| 41 | + /** | |
| 42 | + * @next_cpu: Used by blk_mq_hctx_next_cpu() for round-robin CPU | |
| 43 | + * selection from @cpumask. | |
| 44 | + */ | |
| 24 | 45 | int next_cpu; |
| 46 | + /** | |
| 47 | + * @next_cpu_batch: Counter of how many works left in the batch before | |
| 48 | + * changing to the next CPU. | |
| 49 | + */ | |
| 25 | 50 | int next_cpu_batch; |
| 26 | 51 | |
| 27 | − unsigned long flags; /* BLK_MQ_F_* flags */ | |
| 52 | + /** @flags: BLK_MQ_F_* flags. Defines the behaviour of the queue. */ | |
| 53 | + unsigned long flags; | |
| 28 | 54 | |
| 55 | + /** | |
| 56 | + * @sched_data: Pointer owned by the IO scheduler attached to a request | |
| 57 | + * queue. It's up to the IO scheduler how to use this pointer. | |
| 58 | + */ | |
| 29 | 59 | void *sched_data; |
| 60 | + /** | |
| 61 | + * @queue: Pointer to the request queue that owns this hardware context. | |
| 62 | + */ | |
| 30 | 63 | struct request_queue *queue; |
| 64 | + /** @fq: Queue of requests that need to perform a flush operation. */ | |
| 31 | 65 | struct blk_flush_queue *fq; |
| 32 | 66 | |
| 67 | + /** | |
| 68 | + * @driver_data: Pointer to data owned by the block driver that created | |
| 69 | + * this hctx | |
| 70 | + */ | |
| 33 | 71 | void *driver_data; |
| 34 | 72 | |
| 73 | + /** | |
| 74 | + * @ctx_map: Bitmap for each software queue. If bit is on, there is a | |
| 75 | + * pending request in that software queue. | |
| 76 | + */ | |
| 35 | 77 | struct sbitmap ctx_map; |
| 36 | 78 | |
| 79 | + /** | |
| 80 | + * @dispatch_from: Software queue to be used when no scheduler was | |
| 81 | + * selected. | |
| 82 | + */ | |
| 37 | 83 | struct blk_mq_ctx *dispatch_from; |
| 84 | + /** | |
| 85 | + * @dispatch_busy: Number used by blk_mq_update_dispatch_busy() to | |
| 86 | + * decide if the hw_queue is busy using Exponential Weighted Moving | |
| 87 | + * Average algorithm. | |
| 88 | + */ | |
| 38 | 89 | unsigned int dispatch_busy; |
| 39 | 90 | |
| 91 | + /** @type: HCTX_TYPE_* flags. Type of hardware queue. */ | |
| 40 | 92 | unsigned short type; |
| 93 | + /** @nr_ctx: Number of software queues. */ | |
| 41 | 94 | unsigned short nr_ctx; |
| 95 | + /** @ctxs: Array of software queues. */ | |
| 42 | 96 | struct blk_mq_ctx **ctxs; |
| 43 | 97 | |
| 98 | + /** @dispatch_wait_lock: Lock for dispatch_wait queue. */ | |
| 44 | 99 | spinlock_t dispatch_wait_lock; |
| 100 | + /** | |
| 101 | + * @dispatch_wait: Waitqueue to put requests when there is no tag | |
| 102 | + * available at the moment, to wait for another try in the future. | |
| 103 | + */ | |
| 45 | 104 | wait_queue_entry_t dispatch_wait; |
| 105 | + | |
| 106 | + /** | |
| 107 | + * @wait_index: Index of next available dispatch_wait queue to insert | |
| 108 | + * requests. | |
| 109 | + */ | |
| 46 | 110 | atomic_t wait_index; |
| 47 | 111 | |
| 112 | + /** | |
| 113 | + * @tags: Tags owned by the block driver. A tag at this set is only | |
| 114 | + * assigned when a request is dispatched from a hardware queue. | |
| 115 | + */ | |
| 48 | 116 | struct blk_mq_tags *tags; |
| 117 | + /** | |
| 118 | + * @sched_tags: Tags owned by I/O scheduler. If there is an I/O | |
| 119 | + * scheduler associated with a request queue, a tag is assigned when | |
| 120 | + * that request is allocated. Else, this member is not used. | |
| 121 | + */ | |
| 49 | 122 | struct blk_mq_tags *sched_tags; |
| 50 | 123 | |
| 124 | + /** @queued: Number of queued requests. */ | |
| 51 | 125 | unsigned long queued; |
| 126 | + /** @run: Number of dispatched requests. */ | |
| 52 | 127 | unsigned long run; |
| 53 | 128 | #define BLK_MQ_MAX_DISPATCH_ORDER 7 |
| 129 | + /** @dispatched: Number of dispatch requests by queue. */ | |
| 54 | 130 | unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER]; |
| 55 | 131 | |
| 132 | + /** @numa_node: NUMA node the storage adapter has been connected to. */ | |
| 56 | 133 | unsigned int numa_node; |
| 134 | + /** @queue_num: Index of this hardware queue. */ | |
| 57 | 135 | unsigned int queue_num; |
| 58 | 136 | |
| 137 | + /** | |
| 138 | + * @nr_active: Number of active requests. Only used when a tag set is | |
| 139 | + * shared across request queues. | |
| 140 | + */ | |
| 59 | 141 | atomic_t nr_active; |
| 60 | 142 | |
| 143 | + /** @cpuhp_dead: List to store request if some CPU die. */ | |
| 61 | 144 | struct hlist_node cpuhp_dead; |
| 145 | + /** @kobj: Kernel object for sysfs. */ | |
| 62 | 146 | struct kobject kobj; |
| 63 | 147 | |
| 148 | + /** @poll_considered: Count times blk_poll() was called. */ | |
| 64 | 149 | unsigned long poll_considered; |
| 150 | + /** @poll_invoked: Count how many requests blk_poll() polled. */ | |
| 65 | 151 | unsigned long poll_invoked; |
| 152 | + /** @poll_success: Count how many polled requests were completed. */ | |
| 66 | 153 | unsigned long poll_success; |
| 67 | 154 | |
| 68 | 155 | #ifdef CONFIG_BLK_DEBUG_FS |
| 156 | + /** | |
| 157 | + * @debugfs_dir: debugfs directory for this hardware queue. Named | |
| 158 | + * as cpu<cpu_number>. | |
| 159 | + */ | |
| 69 | 160 | struct dentry *debugfs_dir; |
| 161 | + /** @sched_debugfs_dir: debugfs directory for the scheduler. */ | |
| 70 | 162 | struct dentry *sched_debugfs_dir; |
| 71 | 163 | #endif |
| 72 | 164 | |
| 165 | + /** @hctx_list: List of all hardware queues. */ | |
| 73 | 166 | struct list_head hctx_list; |
| 74 | 167 | |
| 75 | − /* Must be the last member - see also blk_mq_hw_ctx_size(). */ | |
| 168 | + /** | |
| 169 | + * @srcu: Sleepable RCU. Use as lock when type of the hardware queue is | |
| 170 | + * blocking (BLK_MQ_F_BLOCKING). Must be the last member - see also | |
| 171 | + * blk_mq_hw_ctx_size(). | |
| 172 | + */ | |
| 76 | 173 | struct srcu_struct srcu[0]; |
| 77 | 174 | }; |
| 78 | 175 | |
| 176 | +/** | |
| 177 | + * struct blk_mq_queue_map - Map software queues to hardware queues | |
| 178 | + * @mq_map: CPU ID to hardware queue index map. This is an array | |
| 179 | + * with nr_cpu_ids elements. Each element has a value in the range | |
| 180 | + * [@queue_offset, @queue_offset + @nr_queues). | |
| 181 | + * @nr_queues: Number of hardware queues to map CPU IDs onto. | |
| 182 | + * @queue_offset: First hardware queue to map onto. Used by the PCIe NVMe | |
| 183 | + * driver to map each hardware queue type (enum hctx_type) onto a distinct | |
| 184 | + * set of hardware queues. | |
| 185 | + */ | |
| 79 | 186 | struct blk_mq_queue_map { |
| 80 | 187 | unsigned int *mq_map; |
| 81 | 188 | unsigned int nr_queues; |
| 82 | 189 | unsigned int queue_offset; |
| 83 | 190 | }; |
| 84 | 191 | |
| 192 | +/** | |
| 193 | + * enum hctx_type - Type of hardware queue | |
| 194 | + * @HCTX_TYPE_DEFAULT: All I/O not otherwise accounted for. | |
| 195 | + * @HCTX_TYPE_READ: Just for READ I/O. | |
| 196 | + * @HCTX_TYPE_POLL: Polled I/O of any kind. | |
| 197 | + * @HCTX_MAX_TYPES: Number of types of hctx. | |
| 198 | + */ | |
| 85 | 199 | enum hctx_type { |
| 86 | − HCTX_TYPE_DEFAULT, /* all I/O not otherwise accounted for */ | |
| 87 | − HCTX_TYPE_READ, /* just for READ I/O */ | |
| 88 | − HCTX_TYPE_POLL, /* polled I/O of any kind */ | |
| 200 | + HCTX_TYPE_DEFAULT, | |
| 201 | + HCTX_TYPE_READ, | |
| 202 | + HCTX_TYPE_POLL, | |
| 89 | 203 | |
| 90 | 204 | HCTX_MAX_TYPES, |
| 91 | 205 | }; |
| 92 | 206 | |
| 207 | +/** | |
| 208 | + * struct blk_mq_tag_set - tag set that can be shared between request queues | |
| 209 | + * @map: One or more ctx -> hctx mappings. One map exists for each | |
| 210 | + * hardware queue type (enum hctx_type) that the driver wishes | |
| 211 | + * to support. There are no restrictions on maps being of the | |
| 212 | + * same size, and it's perfectly legal to share maps between | |
| 213 | + * types. | |
| 214 | + * @nr_maps: Number of elements in the @map array. A number in the range | |
| 215 | + * [1, HCTX_MAX_TYPES]. | |
| 216 | + * @ops: Pointers to functions that implement block driver behavior. | |
| 217 | + * @nr_hw_queues: Number of hardware queues supported by the block driver that | |
| 218 | + * owns this data structure. | |
| 219 | + * @queue_depth: Number of tags per hardware queue, reserved tags included. | |
| 220 | + * @reserved_tags: Number of tags to set aside for BLK_MQ_REQ_RESERVED tag | |
| 221 | + * allocations. | |
| 222 | + * @cmd_size: Number of additional bytes to allocate per request. The block | |
| 223 | + * driver owns these additional bytes. | |
| 224 | + * @numa_node: NUMA node the storage adapter has been connected to. | |
| 225 | + * @timeout: Request processing timeout in jiffies. | |
| 226 | + * @flags: Zero or more BLK_MQ_F_* flags. | |
| 227 | + * @driver_data: Pointer to data owned by the block driver that created this | |
| 228 | + * tag set. | |
| 229 | + * @tags: Tag sets. One tag set per hardware queue. Has @nr_hw_queues | |
| 230 | + * elements. | |
| 231 | + * @tag_list_lock: Serializes tag_list accesses. | |
| 232 | + * @tag_list: List of the request queues that use this tag set. See also | |
| 233 | + * request_queue.tag_set_list. | |
| 234 | + */ | |
| 93 | 235 | struct blk_mq_tag_set { |
| 94 | − /* | |
| 95 | − * map[] holds ctx -> hctx mappings, one map exists for each type | |
| 96 | − * that the driver wishes to support. There are no restrictions | |
| 97 | − * on maps being of the same size, and it's perfectly legal to | |
| 98 | − * share maps between types. | |
| 99 | − */ | |
| 100 | 236 | struct blk_mq_queue_map map[HCTX_MAX_TYPES]; |
| 101 | − unsigned int nr_maps; /* nr entries in map[] */ | |
| 237 | + unsigned int nr_maps; | |
| 102 | 238 | const struct blk_mq_ops *ops; |
| 103 | − unsigned int nr_hw_queues; /* nr hw queues across maps */ | |
| 104 | − unsigned int queue_depth; /* max hw supported */ | |
| 239 | + unsigned int nr_hw_queues; | |
| 240 | + unsigned int queue_depth; | |
| 105 | 241 | unsigned int reserved_tags; |
| 106 | − unsigned int cmd_size; /* per-request extra data */ | |
| 242 | + unsigned int cmd_size; | |
| 107 | 243 | int numa_node; |
| 108 | 244 | unsigned int timeout; |
| 109 | − unsigned int flags; /* BLK_MQ_F_* */ | |
| 245 | + unsigned int flags; | |
| 110 | 246 | void *driver_data; |
| 111 | 247 | |
| 112 | 248 | struct blk_mq_tags **tags; |
| @@ -115,6 +251,12 @@ struct blk_mq_tag_set { · 2 unmodified lines | ||
| 115 | 251 | struct list_head tag_list; |
| 116 | 252 | }; |
| 117 | 253 | |
| 254 | +/** | |
| 255 | + * struct blk_mq_queue_data - Data about a request inserted in a queue | |
| 256 | + * | |
| 257 | + * @rq: Request pointer. | |
| 258 | + * @last: If it is the last request in the queue. | |
| 259 | + */ | |
| 118 | 260 | struct blk_mq_queue_data { |
| 119 | 261 | struct request *rq; |
| 120 | 262 | bool last; |
| @@ -142,81 +284,101 @@ typedef bool (busy_fn)(struct request_queue *); · 21 unmodified lines | ||
| 142 | 284 | typedef void (complete_fn)(struct request *); |
| 143 | 285 | typedef void (cleanup_rq_fn)(struct request *); |
| 144 | 286 | |
| 145 | − | |
| 287 | +/** | |
| 288 | + * struct blk_mq_ops - Callback functions that implements block driver | |
| 289 | + * behaviour. | |
| 290 | + */ | |
| 146 | 291 | struct blk_mq_ops { |
| 147 | − /* | |
| 148 | − * Queue request | |
| 292 | + /** | |
| 293 | + * @queue_rq: Queue a new request from block IO. | |
| 149 | 294 | */ |
| 150 | 295 | queue_rq_fn *queue_rq; |
| 151 | 296 | |
| 152 | − /* | |
| 153 | − * If a driver uses bd->last to judge when to submit requests to | |
| 154 | − * hardware, it must define this function. In case of errors that | |
| 155 | − * make us stop issuing further requests, this hook serves the | |
| 297 | + /** | |
| 298 | + * @commit_rqs: If a driver uses bd->last to judge when to submit | |
| 299 | + * requests to hardware, it must define this function. In case of errors | |
| 300 | + * that make us stop issuing further requests, this hook serves the | |
| 156 | 301 | * purpose of kicking the hardware (which the last request otherwise |
| 157 | 302 | * would have done). |
| 158 | 303 | */ |
| 159 | 304 | commit_rqs_fn *commit_rqs; |
| 160 | 305 | |
| 161 | − /* | |
| 162 | − * Reserve budget before queue request, once .queue_rq is | |
| 306 | + /** | |
| 307 | + * @get_budget: Reserve budget before queue request, once .queue_rq is | |
| 163 | 308 | * run, it is driver's responsibility to release the |
| 164 | 309 | * reserved budget. Also we have to handle failure case |
| 165 | 310 | * of .get_budget for avoiding I/O deadlock. |
| 166 | 311 | */ |
| 167 | 312 | get_budget_fn *get_budget; |
| 313 | + /** | |
| 314 | + * @put_budget: Release the reserved budget. | |
| 315 | + */ | |
| 168 | 316 | put_budget_fn *put_budget; |
| 169 | 317 | |
| 170 | − /* | |
| 171 | − * Called on request timeout | |
| 318 | + /** | |
| 319 | + * @timeout: Called on request timeout. | |
| 172 | 320 | */ |
| 173 | 321 | timeout_fn *timeout; |
| 174 | 322 | |
| 175 | − /* | |
| 176 | − * Called to poll for completion of a specific tag. | |
| 323 | + /** | |
| 324 | + * @poll: Called to poll for completion of a specific tag. | |
| 177 | 325 | */ |
| 178 | 326 | poll_fn *poll; |
| 179 | 327 | |
| 328 | + /** | |
| 329 | + * @complete: Mark the request as complete. | |
| 330 | + */ | |
| 180 | 331 | complete_fn *complete; |
| 181 | 332 | |
| 182 | − /* | |
| 183 | − * Called when the block layer side of a hardware queue has been | |
| 184 | − * set up, allowing the driver to allocate/init matching structures. | |
| 185 | − * Ditto for exit/teardown. | |
| 333 | + /** | |
| 334 | + * @init_hctx: Called when the block layer side of a hardware queue has | |
| 335 | + * been set up, allowing the driver to allocate/init matching | |
| 336 | + * structures. | |
| 186 | 337 | */ |
| 187 | 338 | init_hctx_fn *init_hctx; |
| 339 | + /** | |
| 340 | + * @exit_hctx: Ditto for exit/teardown. | |
| 341 | + */ | |
| 188 | 342 | exit_hctx_fn *exit_hctx; |
| 189 | 343 | |
| 190 | − /* | |
| 191 | − * Called for every command allocated by the block layer to allow | |
| 192 | − * the driver to set up driver specific data. | |
| 344 | + /** | |
| 345 | + * @init_request: Called for every command allocated by the block layer | |
| 346 | + * to allow the driver to set up driver specific data. | |
| 193 | 347 | * |
| 194 | 348 | * Tag greater than or equal to queue_depth is for setting up |
| 195 | 349 | * flush request. |
| 196 | − * | |
| 197 | − * Ditto for exit/teardown. | |
| 198 | 350 | */ |
| 199 | 351 | init_request_fn *init_request; |
| 352 | + /** | |
| 353 | + * @exit_request: Ditto for exit/teardown. | |
| 354 | + */ | |
| 200 | 355 | exit_request_fn *exit_request; |
| 201 | − /* Called from inside blk_get_request() */ | |
| 356 | + | |
| 357 | + /** | |
| 358 | + * @initialize_rq_fn: Called from inside blk_get_request(). | |
| 359 | + */ | |
| 202 | 360 | void (*initialize_rq_fn)(struct request *rq); |
| 203 | 361 | |
| 204 | − /* | |
| 205 | − * Called before freeing one request which isn't completed yet, | |
| 206 | − * and usually for freeing the driver private data | |
| 362 | + /** | |
| 363 | + * @cleanup_rq: Called before freeing one request which isn't completed | |
| 364 | + * yet, and usually for freeing the driver private data. | |
| 207 | 365 | */ |
| 208 | 366 | cleanup_rq_fn *cleanup_rq; |
| 209 | 367 | |
| 210 | − /* | |
| 211 | − * If set, returns whether or not this queue currently is busy | |
| 368 | + /** | |
| 369 | + * @busy: If set, returns whether or not this queue currently is busy. | |
| 212 | 370 | */ |
| 213 | 371 | busy_fn *busy; |
| 214 | 372 | |
| 373 | + /** | |
| 374 | + * @map_queues: This allows drivers specify their own queue mapping by | |
| 375 | + * overriding the setup-time function that builds the mq_map. | |
| 376 | + */ | |
| 215 | 377 | map_queues_fn *map_queues; |
| 216 | 378 | |
| 217 | 379 | #ifdef CONFIG_BLK_DEBUG_FS |
| 218 | − /* | |
| 219 | − * Used by the debugfs implementation to show driver-specific | |
| 380 | + /** | |
| 381 | + * @show_rq: Used by the debugfs implementation to show driver-specific | |
| 220 | 382 | * information about a request. |
| 221 | 383 | */ |
| 222 | 384 | void (*show_rq)(struct seq_file *m, struct request *rq); |
| @@ -262,7 +424,6 @@ void blk_mq_free_tag_set(struct blk_mq_tag_set *set); · 39 unmodified lines | ||
| 262 | 424 | void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); |
| 263 | 425 | |
| 264 | 426 | void blk_mq_free_request(struct request *rq); |
| 265 | −bool blk_mq_can_queue(struct blk_mq_hw_ctx *); | |
| 266 | 427 | |
| 267 | 428 | bool blk_mq_queue_inflight(struct request_queue *q); |
| 268 | 429 | |
| @@ -301,9 +462,25 @@ static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag) · 32 unmodified lines | ||
| 301 | 462 | return unique_tag & BLK_MQ_UNIQUE_TAG_MASK; |
| 302 | 463 | } |
| 303 | 464 | |
| 465 | +/** | |
| 466 | + * blk_mq_rq_state() - read the current MQ_RQ_* state of a request | |
| 467 | + * @rq: target request. | |
| 468 | + */ | |
| 469 | +static inline enum mq_rq_state blk_mq_rq_state(struct request *rq) | |
| 470 | +{ | |
| 471 | + return READ_ONCE(rq->state); | |
| 472 | +} | |
| 473 | + | |
| 474 | +static inline int blk_mq_request_started(struct request *rq) | |
| 475 | +{ | |
| 476 | + return blk_mq_rq_state(rq) != MQ_RQ_IDLE; | |
| 477 | +} | |
| 478 | + | |
| 479 | +static inline int blk_mq_request_completed(struct request *rq) | |
| 480 | +{ | |
| 481 | + return blk_mq_rq_state(rq) == MQ_RQ_COMPLETE; | |
| 482 | +} | |
| 304 | 483 | |
| 305 | −int blk_mq_request_started(struct request *rq); | |
| 306 | −int blk_mq_request_completed(struct request *rq); | |
| 307 | 484 | void blk_mq_start_request(struct request *rq); |
| 308 | 485 | void blk_mq_end_request(struct request *rq, blk_status_t error); |
| 309 | 486 | void __blk_mq_end_request(struct request *rq, blk_status_t error); |
| @@ -324,7 +501,7 @@ void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); · 14 unmodified lines | ||
| 324 | 501 | void blk_mq_quiesce_queue(struct request_queue *q); |
| 325 | 502 | void blk_mq_unquiesce_queue(struct request_queue *q); |
| 326 | 503 | void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); |
| 327 | −bool blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); | |
| 504 | +void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); | |
| 328 | 505 | void blk_mq_run_hw_queues(struct request_queue *q, bool async); |
| 329 | 506 | void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, |
| 330 | 507 | busy_tag_iter_fn *fn, void *priv); |
| @@ -343,14 +520,29 @@ void blk_mq_quiesce_queue_nowait(struct request_queue *q); · 12 unmodified lines | ||
| 343 | 520 | |
| 344 | 521 | unsigned int blk_mq_rq_cpu(struct request *rq); |
| 345 | 522 | |
| 346 | −/* | |
| 523 | +/** | |
| 524 | + * blk_mq_rq_from_pdu - cast a PDU to a request | |
| 525 | + * @pdu: the PDU (Protocol Data Unit) to be casted | |
| 526 | + * | |
| 527 | + * Return: request | |
| 528 | + * | |
| 347 | 529 | * Driver command data is immediately after the request. So subtract request |
| 348 | − * size to get back to the original request, add request size to get the PDU. | |
| 530 | + * size to get back to the original request. | |
| 349 | 531 | */ |
| 350 | 532 | static inline struct request *blk_mq_rq_from_pdu(void *pdu) |
| 351 | 533 | { |
| 352 | 534 | return pdu - sizeof(struct request); |
| 353 | 535 | } |
| 536 | + | |
| 537 | +/** | |
| 538 | + * blk_mq_rq_to_pdu - cast a request to a PDU | |
| 539 | + * @rq: the request to be casted | |
| 540 | + * | |
| 541 | + * Return: pointer to the PDU | |
| 542 | + * | |
| 543 | + * Driver command data is immediately after the request. So add request to get | |
| 544 | + * the PDU. | |
| 545 | + */ | |
| 354 | 546 | static inline void *blk_mq_rq_to_pdu(struct request *rq) |
| 355 | 547 | { |
| 356 | 548 | return rq + 1; |
| @@ -153,10 +153,10 @@ struct bio { · 152 unmodified lines | ||
| 153 | 153 | unsigned short bi_write_hint; |
| 154 | 154 | blk_status_t bi_status; |
| 155 | 155 | u8 bi_partno; |
| 156 | + atomic_t __bi_remaining; | |
| 156 | 157 | |
| 157 | 158 | struct bvec_iter bi_iter; |
| 158 | 159 | |
| 159 | − atomic_t __bi_remaining; | |
| 160 | 160 | bio_end_io_t *bi_end_io; |
| 161 | 161 | |
| 162 | 162 | void *bi_private; |
| @@ -290,6 +290,12 @@ enum req_opf { · 127 unmodified lines | ||
| 290 | 290 | REQ_OP_ZONE_RESET_ALL = 8, |
| 291 | 291 | /* write the zero filled sector many times */ |
| 292 | 292 | REQ_OP_WRITE_ZEROES = 9, |
| 293 | + /* Open a zone */ | |
| 294 | + REQ_OP_ZONE_OPEN = 10, | |
| 295 | + /* Close a zone */ | |
| 296 | + REQ_OP_ZONE_CLOSE = 11, | |
| 297 | + /* Transition a zone to full */ | |
| 298 | + REQ_OP_ZONE_FINISH = 12, | |
| 293 | 299 | |
| 294 | 300 | /* SCSI passthrough using struct scsi_request */ |
| 295 | 301 | REQ_OP_SCSI_IN = 32, |
| @@ -371,6 +377,7 @@ enum stat_group { · 75 unmodified lines | ||
| 371 | 377 | STAT_READ, |
| 372 | 378 | STAT_WRITE, |
| 373 | 379 | STAT_DISCARD, |
| 380 | + STAT_FLUSH, | |
| 374 | 381 | |
| 375 | 382 | NR_STAT_GROUPS |
| 376 | 383 | }; |
| @@ -417,6 +424,25 @@ static inline bool op_is_discard(unsigned int op) · 40 unmodified lines | ||
| 417 | 424 | return (op & REQ_OP_MASK) == REQ_OP_DISCARD; |
| 418 | 425 | } |
| 419 | 426 | |
| 427 | +/* | |
| 428 | + * Check if a bio or request operation is a zone management operation, with | |
| 429 | + * the exception of REQ_OP_ZONE_RESET_ALL which is treated as a special case | |
| 430 | + * due to its different handling in the block layer and device response in | |
| 431 | + * case of command failure. | |
| 432 | + */ | |
| 433 | +static inline bool op_is_zone_mgmt(enum req_opf op) | |
| 434 | +{ | |
| 435 | + switch (op & REQ_OP_MASK) { | |
| 436 | + case REQ_OP_ZONE_RESET: | |
| 437 | + case REQ_OP_ZONE_OPEN: | |
| 438 | + case REQ_OP_ZONE_CLOSE: | |
| 439 | + case REQ_OP_ZONE_FINISH: | |
| 440 | + return true; | |
| 441 | + default: | |
| 442 | + return false; | |
| 443 | + } | |
| 444 | +} | |
| 445 | + | |
| 420 | 446 | static inline int op_stat_group(unsigned int op) |
| 421 | 447 | { |
| 422 | 448 | if (op_is_discard(op)) |
| @@ -349,34 +349,28 @@ struct queue_limits { · 348 unmodified lines | ||
| 349 | 349 | enum blk_zoned_model zoned; |
| 350 | 350 | }; |
| 351 | 351 | |
| 352 | +typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx, | |
| 353 | + void *data); | |
| 354 | + | |
| 352 | 355 | #ifdef CONFIG_BLK_DEV_ZONED |
| 353 | 356 | |
| 354 | −/* | |
| 355 | − * Maximum number of zones to report with a single report zones command. | |
| 356 | − */ | |
| 357 | −#define BLK_ZONED_REPORT_MAX_ZONES 8192U | |
| 358 | − | |
| 359 | −extern unsigned int blkdev_nr_zones(struct block_device *bdev); | |
| 360 | −extern int blkdev_report_zones(struct block_device *bdev, | |
| 361 | − sector_t sector, struct blk_zone *zones, | |
| 362 | − unsigned int *nr_zones); | |
| 363 | −extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors, | |
| 364 | − sector_t nr_sectors, gfp_t gfp_mask); | |
| 357 | +#define BLK_ALL_ZONES ((unsigned int)-1) | |
| 358 | +int blkdev_report_zones(struct block_device *bdev, sector_t sector, | |
| 359 | + unsigned int nr_zones, report_zones_cb cb, void *data); | |
| 360 | +unsigned int blkdev_nr_zones(struct gendisk *disk); | |
| 361 | +extern int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, | |
| 362 | + sector_t sectors, sector_t nr_sectors, | |
| 363 | + gfp_t gfp_mask); | |
| 365 | 364 | extern int blk_revalidate_disk_zones(struct gendisk *disk); |
| 366 | 365 | |
| 367 | 366 | extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, |
| 368 | 367 | unsigned int cmd, unsigned long arg); |
| 369 | −extern int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode, | |
| 370 | − unsigned int cmd, unsigned long arg); | |
| 368 | +extern int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, | |
| 369 | + unsigned int cmd, unsigned long arg); | |
| 371 | 370 | |
| 372 | 371 | #else /* CONFIG_BLK_DEV_ZONED */ |
| 373 | 372 | |
| 374 | −static inline unsigned int blkdev_nr_zones(struct block_device *bdev) | |
| 375 | −{ | |
| 376 | − return 0; | |
| 377 | −} | |
| 378 | − | |
| 379 | −static inline int blk_revalidate_disk_zones(struct gendisk *disk) | |
| 373 | +static inline unsigned int blkdev_nr_zones(struct gendisk *disk) | |
| 380 | 374 | { |
| 381 | 375 | return 0; |
| 382 | 376 | } |
| @@ -388,9 +382,9 @@ static inline int blkdev_report_zones_ioctl(struct block_device *bdev, · 5 unmodified lines | ||
| 388 | 382 | return -ENOTTY; |
| 389 | 383 | } |
| 390 | 384 | |
| 391 | −static inline int blkdev_reset_zones_ioctl(struct block_device *bdev, | |
| 392 | − fmode_t mode, unsigned int cmd, | |
| 393 | − unsigned long arg) | |
| 385 | +static inline int blkdev_zone_mgmt_ioctl(struct block_device *bdev, | |
| 386 | + fmode_t mode, unsigned int cmd, | |
| 387 | + unsigned long arg) | |
| 394 | 388 | { |
| 395 | 389 | return -ENOTTY; |
| 396 | 390 | } |
| @@ -411,7 +405,6 @@ struct request_queue { · 14 unmodified lines | ||
| 411 | 405 | |
| 412 | 406 | /* sw queues */ |
| 413 | 407 | struct blk_mq_ctx __percpu *queue_ctx; |
| 414 | − unsigned int nr_queues; | |
| 415 | 408 | |
| 416 | 409 | unsigned int queue_depth; |
| 417 | 410 | |
| @@ -505,9 +498,9 @@ struct request_queue { · 87 unmodified lines | ||
| 505 | 498 | /* |
| 506 | 499 | * Zoned block device information for request dispatch control. |
| 507 | 500 | * nr_zones is the total number of zones of the device. This is always |
| 508 | − * 0 for regular block devices. seq_zones_bitmap is a bitmap of nr_zones | |
| 509 | − * bits which indicates if a zone is conventional (bit clear) or | |
| 510 | − * sequential (bit set). seq_zones_wlock is a bitmap of nr_zones | |
| 501 | + * 0 for regular block devices. conv_zones_bitmap is a bitmap of nr_zones | |
| 502 | + * bits which indicates if a zone is conventional (bit set) or | |
| 503 | + * sequential (bit clear). seq_zones_wlock is a bitmap of nr_zones | |
| 511 | 504 | * bits which indicates if a zone is write locked, that is, if a write |
| 512 | 505 | * request targeting the zone was dispatched. All three fields are |
| 513 | 506 | * initialized by the low level device driver (e.g. scsi/sd.c). |
| @@ -520,7 +513,7 @@ struct request_queue { · 6 unmodified lines | ||
| 520 | 513 | * blk_mq_unfreeze_queue(). |
| 521 | 514 | */ |
| 522 | 515 | unsigned int nr_zones; |
| 523 | − unsigned long *seq_zones_bitmap; | |
| 516 | + unsigned long *conv_zones_bitmap; | |
| 524 | 517 | unsigned long *seq_zones_wlock; |
| 525 | 518 | #endif /* CONFIG_BLK_DEV_ZONED */ |
| 526 | 519 | |
| @@ -725,9 +718,11 @@ static inline unsigned int blk_queue_zone_no(struct request_queue *q, · 198 unmodified lines | ||
| 725 | 718 | static inline bool blk_queue_zone_is_seq(struct request_queue *q, |
| 726 | 719 | sector_t sector) |
| 727 | 720 | { |
| 728 | − if (!blk_queue_is_zoned(q) || !q->seq_zones_bitmap) | |
| 721 | + if (!blk_queue_is_zoned(q)) | |
| 729 | 722 | return false; |
| 730 | − return test_bit(blk_queue_zone_no(q, sector), q->seq_zones_bitmap); | |
| 723 | + if (!q->conv_zones_bitmap) | |
| 724 | + return true; | |
| 725 | + return !test_bit(blk_queue_zone_no(q, sector), q->conv_zones_bitmap); | |
| 731 | 726 | } |
| 732 | 727 | #else /* CONFIG_BLK_DEV_ZONED */ |
| 733 | 728 | static inline unsigned int blk_queue_nr_zones(struct request_queue *q) |
| @@ -870,6 +865,8 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, · 136 unmodified lines | ||
| 870 | 865 | unsigned int, void __user *); |
| 871 | 866 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
| 872 | 867 | struct scsi_ioctl_command __user *); |
| 868 | +extern int get_sg_io_hdr(struct sg_io_hdr *hdr, const void __user *argp); | |
| 869 | +extern int put_sg_io_hdr(const struct sg_io_hdr *hdr, void __user *argp); | |
| 873 | 870 | |
| 874 | 871 | extern int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags); |
| 875 | 872 | extern void blk_queue_exit(struct request_queue *q); |
| @@ -1709,7 +1706,7 @@ struct block_device_operations { · 833 unmodified lines | ||
| 1709 | 1706 | /* this callback is with swap_lock and sometimes page table lock held */ |
| 1710 | 1707 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); |
| 1711 | 1708 | int (*report_zones)(struct gendisk *, sector_t sector, |
| 1712 | − struct blk_zone *zones, unsigned int *nr_zones); | |
| 1709 | + unsigned int nr_zones, report_zones_cb cb, void *data); | |
| 1713 | 1710 | struct module *owner; |
| 1714 | 1711 | const struct pr_ops *pr_ops; |
| 1715 | 1712 | }; |
| @@ -157,8 +157,8 @@ void bpf_cgroup_storage_link(struct bpf_cgroup_storage *storage, · 156 unmodified lines | ||
| 157 | 157 | struct cgroup *cgroup, |
| 158 | 158 | enum bpf_attach_type type); |
| 159 | 159 | void bpf_cgroup_storage_unlink(struct bpf_cgroup_storage *storage); |
| 160 | −int bpf_cgroup_storage_assign(struct bpf_prog *prog, struct bpf_map *map); | |
| 161 | −void bpf_cgroup_storage_release(struct bpf_prog *prog, struct bpf_map *map); | |
| 160 | +int bpf_cgroup_storage_assign(struct bpf_prog_aux *aux, struct bpf_map *map); | |
| 161 | +void bpf_cgroup_storage_release(struct bpf_prog_aux *aux, struct bpf_map *map); | |
| 162 | 162 | |
| 163 | 163 | int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key, void *value); |
| 164 | 164 | int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, |
| @@ -360,9 +360,9 @@ static inline int cgroup_bpf_prog_query(const union bpf_attr *attr, · 195 unmodified lines | ||
| 360 | 360 | |
| 361 | 361 | static inline void bpf_cgroup_storage_set( |
| 362 | 362 | struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE]) {} |
| 363 | −static inline int bpf_cgroup_storage_assign(struct bpf_prog *prog, | |
| 363 | +static inline int bpf_cgroup_storage_assign(struct bpf_prog_aux *aux, | |
| 364 | 364 | struct bpf_map *map) { return 0; } |
| 365 | −static inline void bpf_cgroup_storage_release(struct bpf_prog *prog, | |
| 365 | +static inline void bpf_cgroup_storage_release(struct bpf_prog_aux *aux, | |
| 366 | 366 | struct bpf_map *map) {} |
| 367 | 367 | static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( |
| 368 | 368 | struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; } |
| @@ -12,17 +12,23 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/err.h> |
| 13 | 13 | #include <linux/rbtree_latch.h> |
| 14 | 14 | #include <linux/numa.h> |
| 15 | +#include <linux/mm_types.h> | |
| 15 | 16 | #include <linux/wait.h> |
| 16 | 17 | #include <linux/u64_stats_sync.h> |
| 18 | +#include <linux/refcount.h> | |
| 19 | +#include <linux/mutex.h> | |
| 17 | 20 | |
| 18 | 21 | struct bpf_verifier_env; |
| 22 | +struct bpf_verifier_log; | |
| 19 | 23 | struct perf_event; |
| 20 | 24 | struct bpf_prog; |
| 25 | +struct bpf_prog_aux; | |
| 21 | 26 | struct bpf_map; |
| 22 | 27 | struct sock; |
| 23 | 28 | struct seq_file; |
| 24 | 29 | struct btf; |
| 25 | 30 | struct btf_type; |
| 31 | +struct exception_table_entry; | |
| 26 | 32 | |
| 27 | 33 | extern struct idr btf_idr; |
| 28 | 34 | extern spinlock_t btf_idr_lock; |
| @@ -59,11 +65,18 @@ struct bpf_map_ops { · 30 unmodified lines | ||
| 59 | 65 | const struct btf_type *key_type, |
| 60 | 66 | const struct btf_type *value_type); |
| 61 | 67 | |
| 68 | + /* Prog poke tracking helpers. */ | |
| 69 | + int (*map_poke_track)(struct bpf_map *map, struct bpf_prog_aux *aux); | |
| 70 | + void (*map_poke_untrack)(struct bpf_map *map, struct bpf_prog_aux *aux); | |
| 71 | + void (*map_poke_run)(struct bpf_map *map, u32 key, struct bpf_prog *old, | |
| 72 | + struct bpf_prog *new); | |
| 73 | + | |
| 62 | 74 | /* Direct value access helpers. */ |
| 63 | 75 | int (*map_direct_value_addr)(const struct bpf_map *map, |
| 64 | 76 | u64 *imm, u32 off); |
| 65 | 77 | int (*map_direct_value_meta)(const struct bpf_map *map, |
| 66 | 78 | u64 imm, u32 *off); |
| 79 | + int (*map_mmap)(struct bpf_map *map, struct vm_area_struct *vma); | |
| 67 | 80 | }; |
| 68 | 81 | |
| 69 | 82 | struct bpf_map_memory { |
| @@ -92,17 +105,19 @@ struct bpf_map { · 22 unmodified lines | ||
| 92 | 105 | u32 btf_value_type_id; |
| 93 | 106 | struct btf *btf; |
| 94 | 107 | struct bpf_map_memory memory; |
| 108 | + char name[BPF_OBJ_NAME_LEN]; | |
| 95 | 109 | bool unpriv_array; |
| 96 | − bool frozen; /* write-once */ | |
| 97 | − /* 48 bytes hole */ | |
| 110 | + bool frozen; /* write-once; write-protected by freeze_mutex */ | |
| 111 | + /* 22 bytes hole */ | |
| 98 | 112 | |
| 99 | 113 | /* The 3rd and 4th cacheline with misc members to avoid false sharing |
| 100 | 114 | * particularly with refcounting. |
| 101 | 115 | */ |
| 102 | − atomic_t refcnt ____cacheline_aligned; | |
| 103 | − atomic_t usercnt; | |
| 116 | + atomic64_t refcnt ____cacheline_aligned; | |
| 117 | + atomic64_t usercnt; | |
| 104 | 118 | struct work_struct work; |
| 105 | − char name[BPF_OBJ_NAME_LEN]; | |
| 119 | + struct mutex freeze_mutex; | |
| 120 | + u64 writecnt; /* writable mmap cnt; protected by freeze_mutex */ | |
| 106 | 121 | }; |
| 107 | 122 | |
| 108 | 123 | static inline bool map_value_has_spin_lock(const struct bpf_map *map) |
| @@ -211,6 +226,7 @@ enum bpf_arg_type { · 102 unmodified lines | ||
| 211 | 226 | ARG_PTR_TO_INT, /* pointer to int */ |
| 212 | 227 | ARG_PTR_TO_LONG, /* pointer to long */ |
| 213 | 228 | ARG_PTR_TO_SOCKET, /* pointer to bpf_sock (fullsock) */ |
| 229 | + ARG_PTR_TO_BTF_ID, /* pointer to in-kernel struct */ | |
| 214 | 230 | }; |
| 215 | 231 | |
| 216 | 232 | /* type of values returned from helper functions */ |
| @@ -233,11 +249,17 @@ struct bpf_func_proto { · 16 unmodified lines | ||
| 233 | 249 | bool gpl_only; |
| 234 | 250 | bool pkt_access; |
| 235 | 251 | enum bpf_return_type ret_type; |
| 236 | − enum bpf_arg_type arg1_type; | |
| 237 | − enum bpf_arg_type arg2_type; | |
| 238 | − enum bpf_arg_type arg3_type; | |
| 239 | − enum bpf_arg_type arg4_type; | |
| 240 | − enum bpf_arg_type arg5_type; | |
| 252 | + union { | |
| 253 | + struct { | |
| 254 | + enum bpf_arg_type arg1_type; | |
| 255 | + enum bpf_arg_type arg2_type; | |
| 256 | + enum bpf_arg_type arg3_type; | |
| 257 | + enum bpf_arg_type arg4_type; | |
| 258 | + enum bpf_arg_type arg5_type; | |
| 259 | + }; | |
| 260 | + enum bpf_arg_type arg_type[5]; | |
| 261 | + }; | |
| 262 | + int *btf_id; /* BTF ids of arguments */ | |
| 241 | 263 | }; |
| 242 | 264 | |
| 243 | 265 | /* bpf_context is intentionally undefined structure. Pointer to bpf_context is |
| @@ -281,6 +303,7 @@ enum bpf_reg_type { · 37 unmodified lines | ||
| 281 | 303 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ |
| 282 | 304 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ |
| 283 | 305 | PTR_TO_XDP_SOCK, /* reg points to struct xdp_sock */ |
| 306 | + PTR_TO_BTF_ID, /* reg points to kernel struct */ | |
| 284 | 307 | }; |
| 285 | 308 | |
| 286 | 309 | /* The information passed from prog-specific *_is_valid_access |
| @@ -288,7 +311,11 @@ enum bpf_reg_type { · 1 unmodified line | ||
| 288 | 311 | */ |
| 289 | 312 | struct bpf_insn_access_aux { |
| 290 | 313 | enum bpf_reg_type reg_type; |
| 291 | − int ctx_field_size; | |
| 314 | + union { | |
| 315 | + int ctx_field_size; | |
| 316 | + u32 btf_id; | |
| 317 | + }; | |
| 318 | + struct bpf_verifier_log *log; /* for verbose logs */ | |
| 292 | 319 | }; |
| 293 | 320 | |
| 294 | 321 | static inline void |
| @@ -359,14 +386,136 @@ enum bpf_cgroup_storage_type { · 64 unmodified lines | ||
| 359 | 386 | |
| 360 | 387 | #define MAX_BPF_CGROUP_STORAGE_TYPE __BPF_CGROUP_STORAGE_MAX |
| 361 | 388 | |
| 389 | +/* The longest tracepoint has 12 args. | |
| 390 | + * See include/trace/bpf_probe.h | |
| 391 | + */ | |
| 392 | +#define MAX_BPF_FUNC_ARGS 12 | |
| 393 | + | |
| 362 | 394 | struct bpf_prog_stats { |
| 363 | 395 | u64 cnt; |
| 364 | 396 | u64 nsecs; |
| 365 | 397 | struct u64_stats_sync syncp; |
| 398 | +} __aligned(2 * sizeof(u64)); | |
| 399 | + | |
| 400 | +struct btf_func_model { | |
| 401 | + u8 ret_size; | |
| 402 | + u8 nr_args; | |
| 403 | + u8 arg_size[MAX_BPF_FUNC_ARGS]; | |
| 404 | +}; | |
| 405 | + | |
| 406 | +/* Restore arguments before returning from trampoline to let original function | |
| 407 | + * continue executing. This flag is used for fentry progs when there are no | |
| 408 | + * fexit progs. | |
| 409 | + */ | |
| 410 | +#define BPF_TRAMP_F_RESTORE_REGS BIT(0) | |
| 411 | +/* Call original function after fentry progs, but before fexit progs. | |
| 412 | + * Makes sense for fentry/fexit, normal calls and indirect calls. | |
| 413 | + */ | |
| 414 | +#define BPF_TRAMP_F_CALL_ORIG BIT(1) | |
| 415 | +/* Skip current frame and return to parent. Makes sense for fentry/fexit | |
| 416 | + * programs only. Should not be used with normal calls and indirect calls. | |
| 417 | + */ | |
| 418 | +#define BPF_TRAMP_F_SKIP_FRAME BIT(2) | |
| 419 | + | |
| 420 | +/* Different use cases for BPF trampoline: | |
| 421 | + * 1. replace nop at the function entry (kprobe equivalent) | |
| 422 | + * flags = BPF_TRAMP_F_RESTORE_REGS | |
| 423 | + * fentry = a set of programs to run before returning from trampoline | |
| 424 | + * | |
| 425 | + * 2. replace nop at the function entry (kprobe + kretprobe equivalent) | |
| 426 | + * flags = BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_SKIP_FRAME | |
| 427 | + * orig_call = fentry_ip + MCOUNT_INSN_SIZE | |
| 428 | + * fentry = a set of program to run before calling original function | |
| 429 | + * fexit = a set of program to run after original function | |
| 430 | + * | |
| 431 | + * 3. replace direct call instruction anywhere in the function body | |
| 432 | + * or assign a function pointer for indirect call (like tcp_congestion_ops->cong_avoid) | |
| 433 | + * With flags = 0 | |
| 434 | + * fentry = a set of programs to run before returning from trampoline | |
| 435 | + * With flags = BPF_TRAMP_F_CALL_ORIG | |
| 436 | + * orig_call = original callback addr or direct function addr | |
| 437 | + * fentry = a set of program to run before calling original function | |
| 438 | + * fexit = a set of program to run after original function | |
| 439 | + */ | |
| 440 | +int arch_prepare_bpf_trampoline(void *image, struct btf_func_model *m, u32 flags, | |
| 441 | + struct bpf_prog **fentry_progs, int fentry_cnt, | |
| 442 | + struct bpf_prog **fexit_progs, int fexit_cnt, | |
| 443 | + void *orig_call); | |
| 444 | +/* these two functions are called from generated trampoline */ | |
| 445 | +u64 notrace __bpf_prog_enter(void); | |
| 446 | +void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start); | |
| 447 | + | |
| 448 | +enum bpf_tramp_prog_type { | |
| 449 | + BPF_TRAMP_FENTRY, | |
| 450 | + BPF_TRAMP_FEXIT, | |
| 451 | + BPF_TRAMP_MAX | |
| 452 | +}; | |
| 453 | + | |
| 454 | +struct bpf_trampoline { | |
| 455 | + /* hlist for trampoline_table */ | |
| 456 | + struct hlist_node hlist; | |
| 457 | + /* serializes access to fields of this trampoline */ | |
| 458 | + struct mutex mutex; | |
| 459 | + refcount_t refcnt; | |
| 460 | + u64 key; | |
| 461 | + struct { | |
| 462 | + struct btf_func_model model; | |
| 463 | + void *addr; | |
| 464 | + bool ftrace_managed; | |
| 465 | + } func; | |
| 466 | + /* list of BPF programs using this trampoline */ | |
| 467 | + struct hlist_head progs_hlist[BPF_TRAMP_MAX]; | |
| 468 | + /* Number of attached programs. A counter per kind. */ | |
| 469 | + int progs_cnt[BPF_TRAMP_MAX]; | |
| 470 | + /* Executable image of trampoline */ | |
| 471 | + void *image; | |
| 472 | + u64 selector; | |
| 473 | +}; | |
| 474 | +#ifdef CONFIG_BPF_JIT | |
| 475 | +struct bpf_trampoline *bpf_trampoline_lookup(u64 key); | |
| 476 | +int bpf_trampoline_link_prog(struct bpf_prog *prog); | |
| 477 | +int bpf_trampoline_unlink_prog(struct bpf_prog *prog); | |
| 478 | +void bpf_trampoline_put(struct bpf_trampoline *tr); | |
| 479 | +#else | |
| 480 | +static inline struct bpf_trampoline *bpf_trampoline_lookup(u64 key) | |
| 481 | +{ | |
| 482 | + return NULL; | |
| 483 | +} | |
| 484 | +static inline int bpf_trampoline_link_prog(struct bpf_prog *prog) | |
| 485 | +{ | |
| 486 | + return -ENOTSUPP; | |
| 487 | +} | |
| 488 | +static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog) | |
| 489 | +{ | |
| 490 | + return -ENOTSUPP; | |
| 491 | +} | |
| 492 | +static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {} | |
| 493 | +#endif | |
| 494 | + | |
| 495 | +struct bpf_func_info_aux { | |
| 496 | + bool unreliable; | |
| 497 | +}; | |
| 498 | + | |
| 499 | +enum bpf_jit_poke_reason { | |
| 500 | + BPF_POKE_REASON_TAIL_CALL, | |
| 501 | +}; | |
| 502 | + | |
| 503 | +/* Descriptor of pokes pointing /into/ the JITed image. */ | |
| 504 | +struct bpf_jit_poke_descriptor { | |
| 505 | + void *ip; | |
| 506 | + union { | |
| 507 | + struct { | |
| 508 | + struct bpf_map *map; | |
| 509 | + u32 key; | |
| 510 | + } tail_call; | |
| 511 | + }; | |
| 512 | + bool ip_stable; | |
| 513 | + u8 adj_off; | |
| 514 | + u16 reason; | |
| 366 | 515 | }; |
| 367 | 516 | |
| 368 | 517 | struct bpf_prog_aux { |
| 369 | − atomic_t refcnt; | |
| 518 | + atomic64_t refcnt; | |
| 370 | 519 | u32 used_map_cnt; |
| 371 | 520 | u32 max_ctx_offset; |
| 372 | 521 | u32 max_pkt_offset; |
| @@ -375,10 +524,23 @@ struct bpf_prog_aux { · 2 unmodified lines | ||
| 375 | 524 | u32 id; |
| 376 | 525 | u32 func_cnt; /* used by non-func prog as the number of func progs */ |
| 377 | 526 | u32 func_idx; /* 0 for non-func prog, the index in func array for func prog */ |
| 527 | + u32 attach_btf_id; /* in-kernel BTF type id to attach to */ | |
| 528 | + struct bpf_prog *linked_prog; | |
| 378 | 529 | bool verifier_zext; /* Zero extensions has been inserted by verifier. */ |
| 379 | 530 | bool offload_requested; |
| 531 | + bool attach_btf_trace; /* true if attaching to BTF-enabled raw tp */ | |
| 532 | + bool func_proto_unreliable; | |
| 533 | + enum bpf_tramp_prog_type trampoline_prog_type; | |
| 534 | + struct bpf_trampoline *trampoline; | |
| 535 | + struct hlist_node tramp_hlist; | |
| 536 | + /* BTF_KIND_FUNC_PROTO for valid attach_btf_id */ | |
| 537 | + const struct btf_type *attach_func_proto; | |
| 538 | + /* function name for valid attach_btf_id */ | |
| 539 | + const char *attach_func_name; | |
| 380 | 540 | struct bpf_prog **func; |
| 381 | 541 | void *jit_data; /* JIT specific data. arch dependent */ |
| 542 | + struct bpf_jit_poke_descriptor *poke_tab; | |
| 543 | + u32 size_poke_tab; | |
| 382 | 544 | struct latch_tree_node ksym_tnode; |
| 383 | 545 | struct list_head ksym_lnode; |
| 384 | 546 | const struct bpf_prog_ops *ops; |
| @@ -394,6 +556,7 @@ struct bpf_prog_aux { · 9 unmodified lines | ||
| 394 | 556 | struct bpf_prog_offload *offload; |
| 395 | 557 | struct btf *btf; |
| 396 | 558 | struct bpf_func_info *func_info; |
| 559 | + struct bpf_func_info_aux *func_info_aux; | |
| 397 | 560 | /* bpf_line_info loaded from userspace. linfo->insn_off |
| 398 | 561 | * has the xlated insn offset. |
| 399 | 562 | * Both the main and sub prog share the same linfo. |
| @@ -416,6 +579,8 @@ struct bpf_prog_aux { · 16 unmodified lines | ||
| 416 | 579 | * main prog always has linfo_idx == 0 |
| 417 | 580 | */ |
| 418 | 581 | u32 linfo_idx; |
| 582 | + u32 num_exentries; | |
| 583 | + struct exception_table_entry *extable; | |
| 419 | 584 | struct bpf_prog_stats __percpu *stats; |
| 420 | 585 | union { |
| 421 | 586 | struct work_struct work; |
| @@ -423,17 +588,26 @@ struct bpf_prog_aux { · 1 unmodified line | ||
| 423 | 588 | }; |
| 424 | 589 | }; |
| 425 | 590 | |
| 591 | +struct bpf_array_aux { | |
| 592 | + /* 'Ownership' of prog array is claimed by the first program that | |
| 593 | + * is going to use this map or by the first program which FD is | |
| 594 | + * stored in the map to make sure that all callers and callees have | |
| 595 | + * the same prog type and JITed flag. | |
| 596 | + */ | |
| 597 | + enum bpf_prog_type type; | |
| 598 | + bool jited; | |
| 599 | + /* Programs with direct jumps into programs part of this array. */ | |
| 600 | + struct list_head poke_progs; | |
| 601 | + struct bpf_map *map; | |
| 602 | + struct mutex poke_mutex; | |
| 603 | + struct work_struct work; | |
| 604 | +}; | |
| 605 | + | |
| 426 | 606 | struct bpf_array { |
| 427 | 607 | struct bpf_map map; |
| 428 | 608 | u32 elem_size; |
| 429 | 609 | u32 index_mask; |
| 430 | − /* 'ownership' of prog_array is claimed by the first program that | |
| 431 | − * is going to use this map or by the first program which FD is stored | |
| 432 | − * in the map to make sure that all callers and callees have the same | |
| 433 | − * prog_type and JITed flag | |
| 434 | − */ | |
| 435 | − enum bpf_prog_type owner_prog_type; | |
| 436 | − bool owner_jited; | |
| 610 | + struct bpf_array_aux *aux; | |
| 437 | 611 | union { |
| 438 | 612 | char value[0] __aligned(8); |
| 439 | 613 | void *ptrs[0] __aligned(8); |
| @@ -482,6 +656,7 @@ struct bpf_event_entry { · 42 unmodified lines | ||
| 482 | 656 | |
| 483 | 657 | bool bpf_prog_array_compatible(struct bpf_array *array, const struct bpf_prog *fp); |
| 484 | 658 | int bpf_prog_calc_tag(struct bpf_prog *fp); |
| 659 | +const char *kernel_type_name(u32 btf_type_id); | |
| 485 | 660 | |
| 486 | 661 | const struct bpf_func_proto *bpf_get_trace_printk_proto(void); |
| 487 | 662 | |
| @@ -620,7 +795,7 @@ DECLARE_PER_CPU(int, bpf_prog_active); · 132 unmodified lines | ||
| 620 | 795 | extern const struct file_operations bpf_map_fops; |
| 621 | 796 | extern const struct file_operations bpf_prog_fops; |
| 622 | 797 | |
| 623 | −#define BPF_PROG_TYPE(_id, _name) \ | |
| 798 | +#define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \ | |
| 624 | 799 | extern const struct bpf_prog_ops _name ## _prog_ops; \ |
| 625 | 800 | extern const struct bpf_verifier_ops _name ## _verifier_ops; |
| 626 | 801 | #define BPF_MAP_TYPE(_id, _ops) \ |
| @@ -636,22 +811,24 @@ extern const struct bpf_verifier_ops xdp_analyzer_ops; · 9 unmodified lines | ||
| 636 | 811 | struct bpf_prog *bpf_prog_get(u32 ufd); |
| 637 | 812 | struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, |
| 638 | 813 | bool attach_drv); |
| 639 | −struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, int i); | |
| 814 | +void bpf_prog_add(struct bpf_prog *prog, int i); | |
| 640 | 815 | void bpf_prog_sub(struct bpf_prog *prog, int i); |
| 641 | −struct bpf_prog * __must_check bpf_prog_inc(struct bpf_prog *prog); | |
| 816 | +void bpf_prog_inc(struct bpf_prog *prog); | |
| 642 | 817 | struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog); |
| 643 | 818 | void bpf_prog_put(struct bpf_prog *prog); |
| 644 | 819 | int __bpf_prog_charge(struct user_struct *user, u32 pages); |
| 645 | 820 | void __bpf_prog_uncharge(struct user_struct *user, u32 pages); |
| 821 | +void __bpf_free_used_maps(struct bpf_prog_aux *aux, | |
| 822 | + struct bpf_map **used_maps, u32 len); | |
| 646 | 823 | |
| 647 | 824 | void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock); |
| 648 | 825 | void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock); |
| 649 | 826 | |
| 650 | 827 | struct bpf_map *bpf_map_get_with_uref(u32 ufd); |
| 651 | 828 | struct bpf_map *__bpf_map_get(struct fd f); |
| 652 | −struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref); | |
| 653 | −struct bpf_map * __must_check bpf_map_inc_not_zero(struct bpf_map *map, | |
| 654 | − bool uref); | |
| 829 | +void bpf_map_inc(struct bpf_map *map); | |
| 830 | +void bpf_map_inc_with_uref(struct bpf_map *map); | |
| 831 | +struct bpf_map * __must_check bpf_map_inc_not_zero(struct bpf_map *map); | |
| 655 | 832 | void bpf_map_put_with_uref(struct bpf_map *map); |
| 656 | 833 | void bpf_map_put(struct bpf_map *map); |
| 657 | 834 | int bpf_map_charge_memlock(struct bpf_map *map, u32 pages); |
| @@ -661,6 +838,7 @@ void bpf_map_charge_finish(struct bpf_map_memory *mem); · 3 unmodified lines | ||
| 661 | 838 | void bpf_map_charge_move(struct bpf_map_memory *dst, |
| 662 | 839 | struct bpf_map_memory *src); |
| 663 | 840 | void *bpf_map_area_alloc(u64 size, int numa_node); |
| 841 | +void *bpf_map_area_mmapable_alloc(u64 size, int numa_node); | |
| 664 | 842 | void bpf_map_area_free(void *base); |
| 665 | 843 | void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); |
| 666 | 844 | |
| @@ -747,6 +925,24 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, · 80 unmodified lines | ||
| 747 | 925 | int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, |
| 748 | 926 | const union bpf_attr *kattr, |
| 749 | 927 | union bpf_attr __user *uattr); |
| 928 | +bool btf_ctx_access(int off, int size, enum bpf_access_type type, | |
| 929 | + const struct bpf_prog *prog, | |
| 930 | + struct bpf_insn_access_aux *info); | |
| 931 | +int btf_struct_access(struct bpf_verifier_log *log, | |
| 932 | + const struct btf_type *t, int off, int size, | |
| 933 | + enum bpf_access_type atype, | |
| 934 | + u32 *next_btf_id); | |
| 935 | +int btf_resolve_helper_id(struct bpf_verifier_log *log, | |
| 936 | + const struct bpf_func_proto *fn, int); | |
| 937 | + | |
| 938 | +int btf_distill_func_proto(struct bpf_verifier_log *log, | |
| 939 | + struct btf *btf, | |
| 940 | + const struct btf_type *func_proto, | |
| 941 | + const char *func_name, | |
| 942 | + struct btf_func_model *m); | |
| 943 | + | |
| 944 | +int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog); | |
| 945 | + | |
| 750 | 946 | #else /* !CONFIG_BPF_SYSCALL */ |
| 751 | 947 | static inline struct bpf_prog *bpf_prog_get(u32 ufd) |
| 752 | 948 | { |
| @@ -760,10 +956,8 @@ static inline struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, · 7 unmodified lines | ||
| 760 | 956 | return ERR_PTR(-EOPNOTSUPP); |
| 761 | 957 | } |
| 762 | 958 | |
| 763 | −static inline struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, | |
| 764 | − int i) | |
| 959 | +static inline void bpf_prog_add(struct bpf_prog *prog, int i) | |
| 765 | 960 | { |
| 766 | − return ERR_PTR(-EOPNOTSUPP); | |
| 767 | 961 | } |
| 768 | 962 | |
| 769 | 963 | static inline void bpf_prog_sub(struct bpf_prog *prog, int i) |
| @@ -774,9 +968,8 @@ static inline void bpf_prog_put(struct bpf_prog *prog) · 4 unmodified lines | ||
| 774 | 968 | { |
| 775 | 969 | } |
| 776 | 970 | |
| 777 | −static inline struct bpf_prog * __must_check bpf_prog_inc(struct bpf_prog *prog) | |
| 971 | +static inline void bpf_prog_inc(struct bpf_prog *prog) | |
| 778 | 972 | { |
| 779 | − return ERR_PTR(-EOPNOTSUPP); | |
| 780 | 973 | } |
| 781 | 974 | |
| 782 | 975 | static inline struct bpf_prog *__must_check |
| @@ -877,6 +1070,10 @@ static inline int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, · 94 unmodified lines | ||
| 877 | 1070 | { |
| 878 | 1071 | return -ENOTSUPP; |
| 879 | 1072 | } |
| 1073 | + | |
| 1074 | +static inline void bpf_map_put(struct bpf_map *map) | |
| 1075 | +{ | |
| 1076 | +} | |
| 880 | 1077 | #endif /* CONFIG_BPF_SYSCALL */ |
| 881 | 1078 | |
| 882 | 1079 | static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, |
| @@ -972,31 +1169,6 @@ static inline int sock_map_get_from_fd(const union bpf_attr *attr, · 89 unmodified lines | ||
| 972 | 1169 | } |
| 973 | 1170 | #endif |
| 974 | 1171 | |
| 975 | −#if defined(CONFIG_XDP_SOCKETS) | |
| 976 | −struct xdp_sock; | |
| 977 | −struct xdp_sock *__xsk_map_lookup_elem(struct bpf_map *map, u32 key); | |
| 978 | −int __xsk_map_redirect(struct bpf_map *map, struct xdp_buff *xdp, | |
| 979 | − struct xdp_sock *xs); | |
| 980 | −void __xsk_map_flush(struct bpf_map *map); | |
| 981 | −#else | |
| 982 | −struct xdp_sock; | |
| 983 | −static inline struct xdp_sock *__xsk_map_lookup_elem(struct bpf_map *map, | |
| 984 | − u32 key) | |
| 985 | −{ | |
| 986 | − return NULL; | |
| 987 | −} | |
| 988 | − | |
| 989 | −static inline int __xsk_map_redirect(struct bpf_map *map, struct xdp_buff *xdp, | |
| 990 | − struct xdp_sock *xs) | |
| 991 | −{ | |
| 992 | − return -EOPNOTSUPP; | |
| 993 | −} | |
| 994 | − | |
| 995 | −static inline void __xsk_map_flush(struct bpf_map *map) | |
| 996 | −{ | |
| 997 | −} | |
| 998 | −#endif | |
| 999 | − | |
| 1000 | 1172 | #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) |
| 1001 | 1173 | void bpf_sk_reuseport_detach(struct sock *sk); |
| 1002 | 1174 | int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map, void *key, |
| @@ -1095,6 +1267,15 @@ static inline u32 bpf_sock_convert_ctx_access(enum bpf_access_type type, · 92 unmodified lines | ||
| 1095 | 1267 | #endif |
| 1096 | 1268 | |
| 1097 | 1269 | #ifdef CONFIG_INET |
| 1270 | +struct sk_reuseport_kern { | |
| 1271 | + struct sk_buff *skb; | |
| 1272 | + struct sock *sk; | |
| 1273 | + struct sock *selected_sk; | |
| 1274 | + void *data_end; | |
| 1275 | + u32 hash; | |
| 1276 | + u32 reuseport_id; | |
| 1277 | + bool bind_inany; | |
| 1278 | +}; | |
| 1098 | 1279 | bool bpf_tcp_sock_is_valid_access(int off, int size, enum bpf_access_type type, |
| 1099 | 1280 | struct bpf_insn_access_aux *info); |
| 1100 | 1281 | |
| @@ -1145,4 +1326,12 @@ static inline u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type, · 44 unmodified lines | ||
| 1145 | 1326 | } |
| 1146 | 1327 | #endif /* CONFIG_INET */ |
| 1147 | 1328 | |
| 1329 | +enum bpf_text_poke_type { | |
| 1330 | + BPF_MOD_CALL, | |
| 1331 | + BPF_MOD_JUMP, | |
| 1332 | +}; | |
| 1333 | + | |
| 1334 | +int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t, | |
| 1335 | + void *addr1, void *addr2); | |
| 1336 | + | |
| 1148 | 1337 | #endif /* _LINUX_BPF_H */ |
| @@ -2,41 +2,68 @@ · 1 unmodified line | ||
| 2 | 2 | /* internal file - do not include directly */ |
| 3 | 3 | |
| 4 | 4 | #ifdef CONFIG_NET |
| 5 | −BPF_PROG_TYPE(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter) | |
| 6 | −BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act) | |
| 7 | −BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_ACT, tc_cls_act) | |
| 8 | −BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp) | |
| 5 | +BPF_PROG_TYPE(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter, | |
| 6 | + struct __sk_buff, struct sk_buff) | |
| 7 | +BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act, | |
| 8 | + struct __sk_buff, struct sk_buff) | |
| 9 | +BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_ACT, tc_cls_act, | |
| 10 | + struct __sk_buff, struct sk_buff) | |
| 11 | +BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp, | |
| 12 | + struct xdp_md, struct xdp_buff) | |
| 9 | 13 | #ifdef CONFIG_CGROUP_BPF |
| 10 | −BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb) | |
| 11 | −BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock) | |
| 12 | −BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK_ADDR, cg_sock_addr) | |
| 14 | +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb, | |
| 15 | + struct __sk_buff, struct sk_buff) | |
| 16 | +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock, | |
| 17 | + struct bpf_sock, struct sock) | |
| 18 | +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK_ADDR, cg_sock_addr, | |
| 19 | + struct bpf_sock_addr, struct bpf_sock_addr_kern) | |
| 13 | 20 | #endif |
| 14 | −BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_in) | |
| 15 | −BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_out) | |
| 16 | −BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit) | |
| 17 | −BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_SEG6LOCAL, lwt_seg6local) | |
| 18 | −BPF_PROG_TYPE(BPF_PROG_TYPE_SOCK_OPS, sock_ops) | |
| 19 | −BPF_PROG_TYPE(BPF_PROG_TYPE_SK_SKB, sk_skb) | |
| 20 | −BPF_PROG_TYPE(BPF_PROG_TYPE_SK_MSG, sk_msg) | |
| 21 | −BPF_PROG_TYPE(BPF_PROG_TYPE_FLOW_DISSECTOR, flow_dissector) | |
| 21 | +BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_in, | |
| 22 | + struct __sk_buff, struct sk_buff) | |
| 23 | +BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_out, | |
| 24 | + struct __sk_buff, struct sk_buff) | |
| 25 | +BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit, | |
| 26 | + struct __sk_buff, struct sk_buff) | |
| 27 | +BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_SEG6LOCAL, lwt_seg6local, | |
| 28 | + struct __sk_buff, struct sk_buff) | |
| 29 | +BPF_PROG_TYPE(BPF_PROG_TYPE_SOCK_OPS, sock_ops, | |
| 30 | + struct bpf_sock_ops, struct bpf_sock_ops_kern) | |
| 31 | +BPF_PROG_TYPE(BPF_PROG_TYPE_SK_SKB, sk_skb, | |
| 32 | + struct __sk_buff, struct sk_buff) | |
| 33 | +BPF_PROG_TYPE(BPF_PROG_TYPE_SK_MSG, sk_msg, | |
| 34 | + struct sk_msg_md, struct sk_msg) | |
| 35 | +BPF_PROG_TYPE(BPF_PROG_TYPE_FLOW_DISSECTOR, flow_dissector, | |
| 36 | + struct __sk_buff, struct bpf_flow_dissector) | |
| 22 | 37 | #endif |
| 23 | 38 | #ifdef CONFIG_BPF_EVENTS |
| 24 | −BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe) | |
| 25 | −BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint) | |
| 26 | −BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event) | |
| 27 | −BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint) | |
| 28 | −BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) | |
| 39 | +BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe, | |
| 40 | + bpf_user_pt_regs_t, struct pt_regs) | |
| 41 | +BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint, | |
| 42 | + __u64, u64) | |
| 43 | +BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event, | |
| 44 | + struct bpf_perf_event_data, struct bpf_perf_event_data_kern) | |
| 45 | +BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint, | |
| 46 | + struct bpf_raw_tracepoint_args, u64) | |
| 47 | +BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable, | |
| 48 | + struct bpf_raw_tracepoint_args, u64) | |
| 49 | +BPF_PROG_TYPE(BPF_PROG_TYPE_TRACING, tracing, | |
| 50 | + void *, void *) | |
| 29 | 51 | #endif |
| 30 | 52 | #ifdef CONFIG_CGROUP_BPF |
| 31 | −BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) | |
| 32 | −BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl) | |
| 33 | −BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCKOPT, cg_sockopt) | |
| 53 | +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev, | |
| 54 | + struct bpf_cgroup_dev_ctx, struct bpf_cgroup_dev_ctx) | |
| 55 | +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl, | |
| 56 | + struct bpf_sysctl, struct bpf_sysctl_kern) | |
| 57 | +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCKOPT, cg_sockopt, | |
| 58 | + struct bpf_sockopt, struct bpf_sockopt_kern) | |
| 34 | 59 | #endif |
| 35 | 60 | #ifdef CONFIG_BPF_LIRC_MODE2 |
| 36 | −BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) | |
| 61 | +BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2, | |
| 62 | + __u32, u32) | |
| 37 | 63 | #endif |
| 38 | 64 | #ifdef CONFIG_INET |
| 39 | −BPF_PROG_TYPE(BPF_PROG_TYPE_SK_REUSEPORT, sk_reuseport) | |
| 65 | +BPF_PROG_TYPE(BPF_PROG_TYPE_SK_REUSEPORT, sk_reuseport, | |
| 66 | + struct sk_reuseport_md, struct sk_reuseport_kern) | |
| 40 | 67 | #endif |
| 41 | 68 | |
| 42 | 69 | BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops) |
| @@ -52,6 +52,8 @@ struct bpf_reg_state { · 51 unmodified lines | ||
| 52 | 52 | */ |
| 53 | 53 | struct bpf_map *map_ptr; |
| 54 | 54 | |
| 55 | + u32 btf_id; /* for PTR_TO_BTF_ID */ | |
| 56 | + | |
| 55 | 57 | /* Max size from any of the above. */ |
| 56 | 58 | unsigned long raw; |
| 57 | 59 | }; |
| @@ -291,7 +293,7 @@ struct bpf_verifier_state_list { · 233 unmodified lines | ||
| 291 | 293 | struct bpf_insn_aux_data { |
| 292 | 294 | union { |
| 293 | 295 | enum bpf_reg_type ptr_type; /* pointer type for load/store insns */ |
| 294 | − unsigned long map_state; /* pointer/poison value for maps */ | |
| 296 | + unsigned long map_ptr_state; /* pointer/poison value for maps */ | |
| 295 | 297 | s32 call_imm; /* saved imm field of call insn */ |
| 296 | 298 | u32 alu_limit; /* limit for add/sub register with pointer */ |
| 297 | 299 | struct { |
| @@ -299,6 +301,7 @@ struct bpf_insn_aux_data { · 1 unmodified line | ||
| 299 | 301 | u32 map_off; /* offset from value base address */ |
| 300 | 302 | }; |
| 301 | 303 | }; |
| 304 | + u64 map_key_state; /* constant (32 bit) key tracking for maps */ | |
| 302 | 305 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ |
| 303 | 306 | int sanitize_stack_off; /* stack slot to be cleared */ |
| 304 | 307 | bool seen; /* this insn was processed by the verifier */ |
| @@ -330,15 +333,18 @@ static inline bool bpf_verifier_log_full(const struct bpf_verifier_log *log) · 25 unmodified lines | ||
| 330 | 333 | #define BPF_LOG_STATS 4 |
| 331 | 334 | #define BPF_LOG_LEVEL (BPF_LOG_LEVEL1 | BPF_LOG_LEVEL2) |
| 332 | 335 | #define BPF_LOG_MASK (BPF_LOG_LEVEL | BPF_LOG_STATS) |
| 336 | +#define BPF_LOG_KERNEL (BPF_LOG_MASK + 1) /* kernel internal flag */ | |
| 333 | 337 | |
| 334 | 338 | static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log) |
| 335 | 339 | { |
| 336 | − return log->level && log->ubuf && !bpf_verifier_log_full(log); | |
| 340 | + return (log->level && log->ubuf && !bpf_verifier_log_full(log)) || | |
| 341 | + log->level == BPF_LOG_KERNEL; | |
| 337 | 342 | } |
| 338 | 343 | |
| 339 | 344 | #define BPF_MAX_SUBPROGS 256 |
| 340 | 345 | |
| 341 | 346 | struct bpf_subprog_info { |
| 347 | + /* 'start' has to be the first field otherwise find_subprog() won't work */ | |
| 342 | 348 | u32 start; /* insn idx of function entry point */ |
| 343 | 349 | u32 linfo_idx; /* The idx to the main_prog->aux->linfo */ |
| 344 | 350 | u16 stack_depth; /* max. stack depth used by this function */ |
| @@ -397,6 +403,8 @@ __printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log, · 52 unmodified lines | ||
| 397 | 403 | const char *fmt, va_list args); |
| 398 | 404 | __printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env, |
| 399 | 405 | const char *fmt, ...); |
| 406 | +__printf(2, 3) void bpf_log(struct bpf_verifier_log *log, | |
| 407 | + const char *fmt, ...); | |
| 400 | 408 | |
| 401 | 409 | static inline struct bpf_func_state *cur_func(struct bpf_verifier_env *env) |
| 402 | 410 | { |
| @@ -200,9 +200,15 @@ · 199 unmodified lines | ||
| 200 | 200 | #define BCM5482_SHD_SSD 0x14 /* 10100: Secondary SerDes control */ |
| 201 | 201 | #define BCM5482_SHD_SSD_LEDM 0x0008 /* SSD LED Mode enable */ |
| 202 | 202 | #define BCM5482_SHD_SSD_EN 0x0001 /* SSD enable */ |
| 203 | −#define BCM5482_SHD_MODE 0x1f /* 11111: Mode Control Register */ | |
| 204 | −#define BCM5482_SHD_MODE_1000BX 0x0001 /* Enable 1000BASE-X registers */ | |
| 205 | 203 | |
| 204 | +/* 10011: SerDes 100-FX Control Register */ | |
| 205 | +#define BCM54616S_SHD_100FX_CTRL 0x13 | |
| 206 | +#define BCM54616S_100FX_MODE BIT(0) /* 100-FX SerDes Enable */ | |
| 207 | + | |
| 208 | +/* 11111: Mode Control Register */ | |
| 209 | +#define BCM54XX_SHD_MODE 0x1f | |
| 210 | +#define BCM54XX_SHD_INTF_SEL_MASK GENMASK(2, 1) /* INTERF_SEL[1:0] */ | |
| 211 | +#define BCM54XX_SHD_MODE_1000BX BIT(0) /* Enable 1000-X registers */ | |
| 206 | 212 | |
| 207 | 213 | /* |
| 208 | 214 | * EXPANSION SHADOW ACCESS REGISTERS. (PHY REG 0x15, 0x16, and 0x17) |
| @@ -5,6 +5,6 @@ · 4 unmodified lines | ||
| 5 | 5 | #include <linux/types.h> |
| 6 | 6 | |
| 7 | 7 | void *bsearch(const void *key, const void *base, size_t num, size_t size, |
| 8 | − int (*cmp)(const void *key, const void *elt)); | |
| 8 | + cmp_func_t cmp); | |
| 9 | 9 | |
| 10 | 10 | #endif /* _LINUX_BSEARCH_H */ |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | #define _LINUX_BTF_H 1 |
| 6 | 6 | |
| 7 | 7 | #include <linux/types.h> |
| 8 | +#include <uapi/linux/btf.h> | |
| 8 | 9 | |
| 9 | 10 | struct btf; |
| 10 | 11 | struct btf_member; |
| @@ -53,9 +54,41 @@ bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s, · 42 unmodified lines | ||
| 53 | 54 | int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t); |
| 54 | 55 | bool btf_type_is_void(const struct btf_type *t); |
| 55 | 56 | |
| 57 | +static inline bool btf_type_is_ptr(const struct btf_type *t) | |
| 58 | +{ | |
| 59 | + return BTF_INFO_KIND(t->info) == BTF_KIND_PTR; | |
| 60 | +} | |
| 61 | + | |
| 62 | +static inline bool btf_type_is_int(const struct btf_type *t) | |
| 63 | +{ | |
| 64 | + return BTF_INFO_KIND(t->info) == BTF_KIND_INT; | |
| 65 | +} | |
| 66 | + | |
| 67 | +static inline bool btf_type_is_enum(const struct btf_type *t) | |
| 68 | +{ | |
| 69 | + return BTF_INFO_KIND(t->info) == BTF_KIND_ENUM; | |
| 70 | +} | |
| 71 | + | |
| 72 | +static inline bool btf_type_is_typedef(const struct btf_type *t) | |
| 73 | +{ | |
| 74 | + return BTF_INFO_KIND(t->info) == BTF_KIND_TYPEDEF; | |
| 75 | +} | |
| 76 | + | |
| 77 | +static inline bool btf_type_is_func(const struct btf_type *t) | |
| 78 | +{ | |
| 79 | + return BTF_INFO_KIND(t->info) == BTF_KIND_FUNC; | |
| 80 | +} | |
| 81 | + | |
| 82 | +static inline bool btf_type_is_func_proto(const struct btf_type *t) | |
| 83 | +{ | |
| 84 | + return BTF_INFO_KIND(t->info) == BTF_KIND_FUNC_PROTO; | |
| 85 | +} | |
| 86 | + | |
| 56 | 87 | #ifdef CONFIG_BPF_SYSCALL |
| 57 | 88 | const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id); |
| 58 | 89 | const char *btf_name_by_offset(const struct btf *btf, u32 offset); |
| 90 | +struct btf *btf_parse_vmlinux(void); | |
| 91 | +struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog); | |
| 59 | 92 | #else |
| 60 | 93 | static inline const struct btf_type *btf_type_by_id(const struct btf *btf, |
| 61 | 94 | u32 type_id) |
| @@ -9,11 +9,11 @@ · 8 unmodified lines | ||
| 9 | 9 | #else /* __CHECKER__ */ |
| 10 | 10 | /* |
| 11 | 11 | * Force a compilation error if condition is true, but also produce a |
| 12 | − * result (of value 0 and type size_t), so the expression can be used | |
| 12 | + * result (of value 0 and type int), so the expression can be used | |
| 13 | 13 | * e.g. in a structure initializer (or where-ever else comma expressions |
| 14 | 14 | * aren't permitted). |
| 15 | 15 | */ |
| 16 | −#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); })) | |
| 16 | +#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | |
| 17 | 17 | #endif /* __CHECKER__ */ |
| 18 | 18 | |
| 19 | 19 | /* Force a compilation error if a constant expression is not a power of 2 */ |
| @@ -87,26 +87,24 @@ struct bvec_iter_all { · 86 unmodified lines | ||
| 87 | 87 | static inline bool bvec_iter_advance(const struct bio_vec *bv, |
| 88 | 88 | struct bvec_iter *iter, unsigned bytes) |
| 89 | 89 | { |
| 90 | + unsigned int idx = iter->bi_idx; | |
| 91 | + | |
| 90 | 92 | if (WARN_ONCE(bytes > iter->bi_size, |
| 91 | 93 | "Attempted to advance past end of bvec iter\n")) { |
| 92 | 94 | iter->bi_size = 0; |
| 93 | 95 | return false; |
| 94 | 96 | } |
| 95 | 97 | |
| 96 | − while (bytes) { | |
| 97 | − const struct bio_vec *cur = bv + iter->bi_idx; | |
| 98 | − unsigned len = min3(bytes, iter->bi_size, | |
| 99 | − cur->bv_len - iter->bi_bvec_done); | |
| 100 | − | |
| 101 | − bytes -= len; | |
| 102 | − iter->bi_size -= len; | |
| 103 | − iter->bi_bvec_done += len; | |
| 98 | + iter->bi_size -= bytes; | |
| 99 | + bytes += iter->bi_bvec_done; | |
| 104 | 100 | |
| 105 | − if (iter->bi_bvec_done == cur->bv_len) { | |
| 106 | − iter->bi_bvec_done = 0; | |
| 107 | − iter->bi_idx++; | |
| 108 | − } | |
| 101 | + while (bytes && bytes >= bv[idx].bv_len) { | |
| 102 | + bytes -= bv[idx].bv_len; | |
| 103 | + idx++; | |
| 109 | 104 | } |
| 105 | + | |
| 106 | + iter->bi_idx = idx; | |
| 107 | + iter->bi_bvec_done = bytes; | |
| 110 | 108 | return true; |
| 111 | 109 | } |
| 112 | 110 | |
| @@ -1,22 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef _CAN_PLATFORM_MCP251X_H | |
| 3 | −#define _CAN_PLATFORM_MCP251X_H | |
| 4 | − | |
| 5 | −/* | |
| 6 | − * | |
| 7 | − * CAN bus driver for Microchip 251x CAN Controller with SPI Interface | |
| 8 | − * | |
| 9 | − */ | |
| 10 | − | |
| 11 | −#include <linux/spi/spi.h> | |
| 12 | − | |
| 13 | −/* | |
| 14 | − * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data | |
| 15 | − * @oscillator_frequency: - oscillator frequency in Hz | |
| 16 | − */ | |
| 17 | − | |
| 18 | −struct mcp251x_platform_data { | |
| 19 | − unsigned long oscillator_frequency; | |
| 20 | −}; | |
| 21 | − | |
| 22 | −#endif /* !_CAN_PLATFORM_MCP251X_H */ | |
| @@ -15,9 +15,9 @@ · 14 unmodified lines | ||
| 15 | 15 | struct can_rx_offload { |
| 16 | 16 | struct net_device *dev; |
| 17 | 17 | |
| 18 | − unsigned int (*mailbox_read)(struct can_rx_offload *offload, | |
| 19 | − struct can_frame *cf, | |
| 20 | − u32 *timestamp, unsigned int mb); | |
| 18 | + struct sk_buff *(*mailbox_read)(struct can_rx_offload *offload, | |
| 19 | + unsigned int mb, u32 *timestamp, | |
| 20 | + bool drop); | |
| 21 | 21 | |
| 22 | 22 | struct sk_buff_head skb_queue; |
| 23 | 23 | u32 skb_queue_len_max; |
| @@ -44,7 +44,6 @@ unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, · 20 unmodified lines | ||
| 44 | 44 | unsigned int idx, u32 timestamp); |
| 45 | 45 | int can_rx_offload_queue_tail(struct can_rx_offload *offload, |
| 46 | 46 | struct sk_buff *skb); |
| 47 | −void can_rx_offload_reset(struct can_rx_offload *offload); | |
| 48 | 47 | void can_rx_offload_del(struct can_rx_offload *offload); |
| 49 | 48 | void can_rx_offload_enable(struct can_rx_offload *offload); |
| 50 | 49 | |
| @@ -280,10 +280,12 @@ extern const char *ceph_msg_type_name(int type); · 279 unmodified lines | ||
| 280 | 280 | extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); |
| 281 | 281 | extern void *ceph_kvmalloc(size_t size, gfp_t flags); |
| 282 | 282 | |
| 283 | −extern struct ceph_options *ceph_parse_options(char *options, | |
| 284 | − const char *dev_name, const char *dev_name_end, | |
| 285 | − int (*parse_extra_token)(char *c, void *private), | |
| 286 | − void *private); | |
| 283 | +struct fs_parameter; | |
| 284 | +struct ceph_options *ceph_alloc_options(void); | |
| 285 | +int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt, | |
| 286 | + struct fs_context *fc); | |
| 287 | +int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt, | |
| 288 | + struct fs_context *fc); | |
| 287 | 289 | int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, |
| 288 | 290 | bool show_all); |
| 289 | 291 | extern void ceph_destroy_options(struct ceph_options *opt); |
| @@ -354,16 +354,6 @@ struct cgroup { · 353 unmodified lines | ||
| 354 | 354 | |
| 355 | 355 | unsigned long flags; /* "unsigned long" so bitops work */ |
| 356 | 356 | |
| 357 | − /* | |
| 358 | − * idr allocated in-hierarchy ID. | |
| 359 | − * | |
| 360 | − * ID 0 is not used, the ID of the root cgroup is always 1, and a | |
| 361 | − * new cgroup will be assigned with a smallest available ID. | |
| 362 | − * | |
| 363 | − * Allocating/Removing ID must be protected by cgroup_mutex. | |
| 364 | − */ | |
| 365 | − int id; | |
| 366 | − | |
| 367 | 357 | /* |
| 368 | 358 | * The depth this cgroup is at. The root is at depth zero and each |
| 369 | 359 | * step down the hierarchy increments the level. This along with |
| @@ -458,7 +448,7 @@ struct cgroup { · 88 unmodified lines | ||
| 458 | 448 | struct list_head rstat_css_list; |
| 459 | 449 | |
| 460 | 450 | /* cgroup basic resource statistics */ |
| 461 | − struct cgroup_base_stat pending_bstat; /* pending from children */ | |
| 451 | + struct cgroup_base_stat last_bstat; | |
| 462 | 452 | struct cgroup_base_stat bstat; |
| 463 | 453 | struct prev_cputime prev_cputime; /* for printing out cputime */ |
| 464 | 454 | |
| @@ -488,7 +478,7 @@ struct cgroup { · 23 unmodified lines | ||
| 488 | 478 | struct cgroup_freezer_state freezer; |
| 489 | 479 | |
| 490 | 480 | /* ids of the ancestors at each level including self */ |
| 491 | − int ancestor_ids[]; | |
| 481 | + u64 ancestor_ids[]; | |
| 492 | 482 | }; |
| 493 | 483 | |
| 494 | 484 | /* |
| @@ -509,7 +499,7 @@ struct cgroup_root { · 14 unmodified lines | ||
| 509 | 499 | struct cgroup cgrp; |
| 510 | 500 | |
| 511 | 501 | /* for cgrp->ancestor_ids[0] */ |
| 512 | − int cgrp_ancestor_id_storage; | |
| 502 | + u64 cgrp_ancestor_id_storage; | |
| 513 | 503 | |
| 514 | 504 | /* Number of cgroups in the hierarchy, used only for /proc/cgroups */ |
| 515 | 505 | atomic_t nr_cgrps; |
| @@ -520,9 +510,6 @@ struct cgroup_root { · 4 unmodified lines | ||
| 520 | 510 | /* Hierarchy-specific flags */ |
| 521 | 511 | unsigned int flags; |
| 522 | 512 | |
| 523 | − /* IDs for cgroups in this hierarchy */ | |
| 524 | − struct idr cgroup_idr; | |
| 525 | − | |
| 526 | 513 | /* The path to use for release notifications. */ |
| 527 | 514 | char release_agent_path[PATH_MAX]; |
| 528 | 515 | |
| @@ -150,7 +150,6 @@ struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset, · 149 unmodified lines | ||
| 150 | 150 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset, |
| 151 | 151 | struct cgroup_subsys_state **dst_cssp); |
| 152 | 152 | |
| 153 | −void cgroup_enable_task_cg_lists(void); | |
| 154 | 153 | void css_task_iter_start(struct cgroup_subsys_state *css, unsigned int flags, |
| 155 | 154 | struct css_task_iter *it); |
| 156 | 155 | struct task_struct *css_task_iter_next(struct css_task_iter *it); |
| @@ -305,6 +304,11 @@ void css_task_iter_end(struct css_task_iter *it); · 148 unmodified lines | ||
| 305 | 304 | * Inline functions. |
| 306 | 305 | */ |
| 307 | 306 | |
| 307 | +static inline u64 cgroup_id(struct cgroup *cgrp) | |
| 308 | +{ | |
| 309 | + return cgrp->kn->id; | |
| 310 | +} | |
| 311 | + | |
| 308 | 312 | /** |
| 309 | 313 | * css_get - obtain a reference on the specified css |
| 310 | 314 | * @css: target css |
| @@ -566,7 +570,7 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp, · 255 unmodified lines | ||
| 566 | 570 | { |
| 567 | 571 | if (cgrp->root != ancestor->root || cgrp->level < ancestor->level) |
| 568 | 572 | return false; |
| 569 | − return cgrp->ancestor_ids[ancestor->level] == ancestor->id; | |
| 573 | + return cgrp->ancestor_ids[ancestor->level] == cgroup_id(ancestor); | |
| 570 | 574 | } |
| 571 | 575 | |
| 572 | 576 | /** |
| @@ -617,7 +621,7 @@ static inline bool cgroup_is_populated(struct cgroup *cgrp) · 44 unmodified lines | ||
| 617 | 621 | /* returns ino associated with a cgroup */ |
| 618 | 622 | static inline ino_t cgroup_ino(struct cgroup *cgrp) |
| 619 | 623 | { |
| 620 | − return cgrp->kn->id.ino; | |
| 624 | + return kernfs_ino(cgrp->kn); | |
| 621 | 625 | } |
| 622 | 626 | |
| 623 | 627 | /* cft/css accessors for cftype->write() operation */ |
| @@ -688,18 +692,13 @@ static inline void cgroup_kthread_ready(void) · 64 unmodified lines | ||
| 688 | 692 | current->no_cgroup_migration = 0; |
| 689 | 693 | } |
| 690 | 694 | |
| 691 | −static inline union kernfs_node_id *cgroup_get_kernfs_id(struct cgroup *cgrp) | |
| 692 | −{ | |
| 693 | − return &cgrp->kn->id; | |
| 694 | −} | |
| 695 | − | |
| 696 | −void cgroup_path_from_kernfs_id(const union kernfs_node_id *id, | |
| 697 | − char *buf, size_t buflen); | |
| 695 | +void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen); | |
| 698 | 696 | #else /* !CONFIG_CGROUPS */ |
| 699 | 697 | |
| 700 | 698 | struct cgroup_subsys_state; |
| 701 | 699 | struct cgroup; |
| 702 | 700 | |
| 701 | +static inline u64 cgroup_id(struct cgroup *cgrp) { return 1; } | |
| 703 | 702 | static inline void css_get(struct cgroup_subsys_state *css) {} |
| 704 | 703 | static inline void css_put(struct cgroup_subsys_state *css) {} |
| 705 | 704 | static inline int cgroup_attach_task_all(struct task_struct *from, |
| @@ -719,10 +718,6 @@ static inline int cgroup_init_early(void) { return 0; } · 13 unmodified lines | ||
| 719 | 718 | static inline int cgroup_init(void) { return 0; } |
| 720 | 719 | static inline void cgroup_init_kthreadd(void) {} |
| 721 | 720 | static inline void cgroup_kthread_ready(void) {} |
| 722 | −static inline union kernfs_node_id *cgroup_get_kernfs_id(struct cgroup *cgrp) | |
| 723 | −{ | |
| 724 | − return NULL; | |
| 725 | −} | |
| 726 | 721 | |
| 727 | 722 | static inline struct cgroup *cgroup_parent(struct cgroup *cgrp) |
| 728 | 723 | { |
| @@ -740,8 +735,8 @@ static inline bool task_under_cgroup_hierarchy(struct task_struct *task, · 11 unmodified lines | ||
| 740 | 735 | return true; |
| 741 | 736 | } |
| 742 | 737 | |
| 743 | −static inline void cgroup_path_from_kernfs_id(const union kernfs_node_id *id, | |
| 744 | − char *buf, size_t buflen) {} | |
| 738 | +static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen) | |
| 739 | +{} | |
| 745 | 740 | #endif /* !CONFIG_CGROUPS */ |
| 746 | 741 | |
| 747 | 742 | #ifdef CONFIG_CGROUPS |
| @@ -818,6 +818,7 @@ unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); · 817 unmodified lines | ||
| 818 | 818 | struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw); |
| 819 | 819 | struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw, |
| 820 | 820 | unsigned int index); |
| 821 | +int clk_hw_get_parent_index(struct clk_hw *hw); | |
| 821 | 822 | int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *new_parent); |
| 822 | 823 | unsigned int __clk_get_enable_count(struct clk *clk); |
| 823 | 824 | unsigned long clk_hw_get_rate(const struct clk_hw *hw); |
| @@ -108,6 +108,19 @@ static inline void tegra_cpu_clock_resume(void) · 107 unmodified lines | ||
| 108 | 108 | |
| 109 | 109 | tegra_cpu_car_ops->resume(); |
| 110 | 110 | } |
| 111 | +#else | |
| 112 | +static inline bool tegra_cpu_rail_off_ready(void) | |
| 113 | +{ | |
| 114 | + return false; | |
| 115 | +} | |
| 116 | + | |
| 117 | +static inline void tegra_cpu_clock_suspend(void) | |
| 118 | +{ | |
| 119 | +} | |
| 120 | + | |
| 121 | +static inline void tegra_cpu_clock_resume(void) | |
| 122 | +{ | |
| 123 | +} | |
| 111 | 124 | #endif |
| 112 | 125 | |
| 113 | 126 | extern void tegra210_xusb_pll_hw_control_enable(void); |
| @@ -119,4 +132,15 @@ extern void tegra210_put_utmipll_in_iddq(void); · 5 unmodified lines | ||
| 119 | 132 | extern void tegra210_put_utmipll_out_iddq(void); |
| 120 | 133 | extern int tegra210_clk_handle_mbist_war(unsigned int id); |
| 121 | 134 | |
| 135 | +struct clk; | |
| 136 | + | |
| 137 | +typedef long (tegra20_clk_emc_round_cb)(unsigned long rate, | |
| 138 | + unsigned long min_rate, | |
| 139 | + unsigned long max_rate, | |
| 140 | + void *arg); | |
| 141 | + | |
| 142 | +void tegra20_clk_set_emc_round_callback(tegra20_clk_emc_round_cb *round_cb, | |
| 143 | + void *cb_arg); | |
| 144 | +int tegra20_clk_prepare_emc_mc_same_freq(struct clk *emc_clk, bool same); | |
| 145 | + | |
| 122 | 146 | #endif /* __LINUX_CLK_TEGRA_H_ */ |
| @@ -153,7 +153,7 @@ struct clk_hw_omap { · 152 unmodified lines | ||
| 153 | 153 | u8 fixed_div; |
| 154 | 154 | struct clk_omap_reg enable_reg; |
| 155 | 155 | u8 enable_bit; |
| 156 | − u8 flags; | |
| 156 | + unsigned long flags; | |
| 157 | 157 | struct clk_omap_reg clksel_reg; |
| 158 | 158 | struct dpll_data *dpll_data; |
| 159 | 159 | const char *clkdm_name; |
| @@ -298,6 +298,7 @@ struct ti_clk_features { · 138 unmodified lines | ||
| 298 | 298 | |
| 299 | 299 | void ti_clk_setup_features(struct ti_clk_features *features); |
| 300 | 300 | const struct ti_clk_features *ti_clk_get_features(void); |
| 301 | +bool ti_clk_is_in_standby(struct clk *clk); | |
| 301 | 302 | int omap3_noncore_dpll_save_context(struct clk_hw *hw); |
| 302 | 303 | void omap3_noncore_dpll_restore_context(struct clk_hw *hw); |
| 303 | 304 | |
| @@ -116,14 +116,7 @@ typedef __compat_gid32_t compat_gid_t; · 115 unmodified lines | ||
| 116 | 116 | struct compat_sel_arg_struct; |
| 117 | 117 | struct rusage; |
| 118 | 118 | |
| 119 | −struct compat_itimerval { | |
| 120 | − struct old_timeval32 it_interval; | |
| 121 | − struct old_timeval32 it_value; | |
| 122 | −}; | |
| 123 | − | |
| 124 | −struct itimerval; | |
| 125 | −int get_compat_itimerval(struct itimerval *, const struct compat_itimerval __user *); | |
| 126 | −int put_compat_itimerval(struct compat_itimerval __user *, const struct itimerval *); | |
| 119 | +struct old_itimerval32; | |
| 127 | 120 | |
| 128 | 121 | struct compat_tms { |
| 129 | 122 | compat_clock_t tms_utime; |
| @@ -410,8 +403,6 @@ struct compat_kexec_segment; · 280 unmodified lines | ||
| 410 | 403 | struct compat_mq_attr; |
| 411 | 404 | struct compat_msgbuf; |
| 412 | 405 | |
| 413 | −extern void compat_exit_robust_list(struct task_struct *curr); | |
| 414 | − | |
| 415 | 406 | #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t)) |
| 416 | 407 | |
| 417 | 408 | #define BITS_TO_COMPAT_LONGS(bits) DIV_ROUND_UP(bits, BITS_PER_COMPAT_LONG) |
| @@ -668,10 +659,10 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, · 250 unmodified lines | ||
| 668 | 659 | |
| 669 | 660 | /* kernel/itimer.c */ |
| 670 | 661 | asmlinkage long compat_sys_getitimer(int which, |
| 671 | − struct compat_itimerval __user *it); | |
| 662 | + struct old_itimerval32 __user *it); | |
| 672 | 663 | asmlinkage long compat_sys_setitimer(int which, |
| 673 | − struct compat_itimerval __user *in, | |
| 674 | − struct compat_itimerval __user *out); | |
| 664 | + struct old_itimerval32 __user *in, | |
| 665 | + struct old_itimerval32 __user *out); | |
| 675 | 666 | |
| 676 | 667 | /* kernel/kexec.c */ |
| 677 | 668 | asmlinkage long compat_sys_kexec_load(compat_ulong_t entry, |
| @@ -937,10 +928,10 @@ static inline bool in_compat_syscall(void) { return is_compat_task(); } · 259 unmodified lines | ||
| 937 | 928 | */ |
| 938 | 929 | static inline struct old_timeval32 ns_to_old_timeval32(s64 nsec) |
| 939 | 930 | { |
| 940 | − struct timeval tv; | |
| 931 | + struct __kernel_old_timeval tv; | |
| 941 | 932 | struct old_timeval32 ctv; |
| 942 | 933 | |
| 943 | − tv = ns_to_timeval(nsec); | |
| 934 | + tv = ns_to_kernel_old_timeval(nsec); | |
| 944 | 935 | ctv.tv_sec = tv.tv_sec; |
| 945 | 936 | ctv.tv_usec = tv.tv_usec; |
| 946 | 937 | |
| @@ -22,26 +22,26 @@ extern void context_tracking_user_exit(void); · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | static inline void user_enter(void) |
| 24 | 24 | { |
| 25 | − if (context_tracking_is_enabled()) | |
| 25 | + if (context_tracking_enabled()) | |
| 26 | 26 | context_tracking_enter(CONTEXT_USER); |
| 27 | 27 | |
| 28 | 28 | } |
| 29 | 29 | static inline void user_exit(void) |
| 30 | 30 | { |
| 31 | − if (context_tracking_is_enabled()) | |
| 31 | + if (context_tracking_enabled()) | |
| 32 | 32 | context_tracking_exit(CONTEXT_USER); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /* Called with interrupts disabled. */ |
| 36 | 36 | static inline void user_enter_irqoff(void) |
| 37 | 37 | { |
| 38 | − if (context_tracking_is_enabled()) | |
| 38 | + if (context_tracking_enabled()) | |
| 39 | 39 | __context_tracking_enter(CONTEXT_USER); |
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | static inline void user_exit_irqoff(void) |
| 43 | 43 | { |
| 44 | − if (context_tracking_is_enabled()) | |
| 44 | + if (context_tracking_enabled()) | |
| 45 | 45 | __context_tracking_exit(CONTEXT_USER); |
| 46 | 46 | } |
| 47 | 47 | |
| @@ -49,7 +49,7 @@ static inline enum ctx_state exception_enter(void) · 1 unmodified line | ||
| 49 | 49 | { |
| 50 | 50 | enum ctx_state prev_ctx; |
| 51 | 51 | |
| 52 | − if (!context_tracking_is_enabled()) | |
| 52 | + if (!context_tracking_enabled()) | |
| 53 | 53 | return 0; |
| 54 | 54 | |
| 55 | 55 | prev_ctx = this_cpu_read(context_tracking.state); |
| @@ -61,7 +61,7 @@ static inline enum ctx_state exception_enter(void) · 5 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | static inline void exception_exit(enum ctx_state prev_ctx) |
| 63 | 63 | { |
| 64 | − if (context_tracking_is_enabled()) { | |
| 64 | + if (context_tracking_enabled()) { | |
| 65 | 65 | if (prev_ctx != CONTEXT_KERNEL) |
| 66 | 66 | context_tracking_enter(prev_ctx); |
| 67 | 67 | } |
| @@ -77,7 +77,7 @@ static inline void exception_exit(enum ctx_state prev_ctx) · 9 unmodified lines | ||
| 77 | 77 | */ |
| 78 | 78 | static inline enum ctx_state ct_state(void) |
| 79 | 79 | { |
| 80 | − return context_tracking_is_enabled() ? | |
| 80 | + return context_tracking_enabled() ? | |
| 81 | 81 | this_cpu_read(context_tracking.state) : CONTEXT_DISABLED; |
| 82 | 82 | } |
| 83 | 83 | #else |
| @@ -90,7 +90,7 @@ static inline void exception_exit(enum ctx_state prev_ctx) { } · 6 unmodified lines | ||
| 90 | 90 | static inline enum ctx_state ct_state(void) { return CONTEXT_DISABLED; } |
| 91 | 91 | #endif /* !CONFIG_CONTEXT_TRACKING */ |
| 92 | 92 | |
| 93 | −#define CT_WARN_ON(cond) WARN_ON(context_tracking_is_enabled() && (cond)) | |
| 93 | +#define CT_WARN_ON(cond) WARN_ON(context_tracking_enabled() && (cond)) | |
| 94 | 94 | |
| 95 | 95 | #ifdef CONFIG_CONTEXT_TRACKING_FORCE |
| 96 | 96 | extern void context_tracking_init(void); |
| @@ -103,12 +103,12 @@ static inline void context_tracking_init(void) { } · 6 unmodified lines | ||
| 103 | 103 | /* must be called with irqs disabled */ |
| 104 | 104 | static inline void guest_enter_irqoff(void) |
| 105 | 105 | { |
| 106 | − if (vtime_accounting_cpu_enabled()) | |
| 106 | + if (vtime_accounting_enabled_this_cpu()) | |
| 107 | 107 | vtime_guest_enter(current); |
| 108 | 108 | else |
| 109 | 109 | current->flags |= PF_VCPU; |
| 110 | 110 | |
| 111 | − if (context_tracking_is_enabled()) | |
| 111 | + if (context_tracking_enabled()) | |
| 112 | 112 | __context_tracking_enter(CONTEXT_GUEST); |
| 113 | 113 | |
| 114 | 114 | /* KVM does not hold any references to rcu protected data when it |
| @@ -118,16 +118,16 @@ static inline void guest_enter_irqoff(void) · 3 unmodified lines | ||
| 118 | 118 | * one time slice). Lets treat guest mode as quiescent state, just like |
| 119 | 119 | * we do with user-mode execution. |
| 120 | 120 | */ |
| 121 | − if (!context_tracking_cpu_is_enabled()) | |
| 121 | + if (!context_tracking_enabled_this_cpu()) | |
| 122 | 122 | rcu_virt_note_context_switch(smp_processor_id()); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | static inline void guest_exit_irqoff(void) |
| 126 | 126 | { |
| 127 | − if (context_tracking_is_enabled()) | |
| 127 | + if (context_tracking_enabled()) | |
| 128 | 128 | __context_tracking_exit(CONTEXT_GUEST); |
| 129 | 129 | |
| 130 | − if (vtime_accounting_cpu_enabled()) | |
| 130 | + if (vtime_accounting_enabled_this_cpu()) | |
| 131 | 131 | vtime_guest_exit(current); |
| 132 | 132 | else |
| 133 | 133 | current->flags &= ~PF_VCPU; |
| @@ -141,7 +141,7 @@ static inline void guest_enter_irqoff(void) · 7 unmodified lines | ||
| 141 | 141 | * to assume that it's the stime pending cputime |
| 142 | 142 | * to flush. |
| 143 | 143 | */ |
| 144 | − vtime_account_system(current); | |
| 144 | + vtime_account_kernel(current); | |
| 145 | 145 | current->flags |= PF_VCPU; |
| 146 | 146 | rcu_virt_note_context_switch(smp_processor_id()); |
| 147 | 147 | } |
| @@ -149,7 +149,7 @@ static inline void guest_enter_irqoff(void) · 1 unmodified line | ||
| 149 | 149 | static inline void guest_exit_irqoff(void) |
| 150 | 150 | { |
| 151 | 151 | /* Flush the guest cputime we spent on the guest */ |
| 152 | − vtime_account_system(current); | |
| 152 | + vtime_account_kernel(current); | |
| 153 | 153 | current->flags &= ~PF_VCPU; |
| 154 | 154 | } |
| 155 | 155 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */ |
| @@ -23,17 +23,22 @@ struct context_tracking { · 22 unmodified lines | ||
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | #ifdef CONFIG_CONTEXT_TRACKING |
| 26 | −extern struct static_key_false context_tracking_enabled; | |
| 26 | +extern struct static_key_false context_tracking_key; | |
| 27 | 27 | DECLARE_PER_CPU(struct context_tracking, context_tracking); |
| 28 | 28 | |
| 29 | −static inline bool context_tracking_is_enabled(void) | |
| 29 | +static inline bool context_tracking_enabled(void) | |
| 30 | 30 | { |
| 31 | − return static_branch_unlikely(&context_tracking_enabled); | |
| 31 | + return static_branch_unlikely(&context_tracking_key); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | −static inline bool context_tracking_cpu_is_enabled(void) | |
| 34 | +static inline bool context_tracking_enabled_cpu(int cpu) | |
| 35 | 35 | { |
| 36 | − return __this_cpu_read(context_tracking.active); | |
| 36 | + return context_tracking_enabled() && per_cpu(context_tracking.active, cpu); | |
| 37 | +} | |
| 38 | + | |
| 39 | +static inline bool context_tracking_enabled_this_cpu(void) | |
| 40 | +{ | |
| 41 | + return context_tracking_enabled() && __this_cpu_read(context_tracking.active); | |
| 37 | 42 | } |
| 38 | 43 | |
| 39 | 44 | static inline bool context_tracking_in_user(void) |
| @@ -42,9 +47,9 @@ static inline bool context_tracking_in_user(void) · 2 unmodified lines | ||
| 42 | 47 | } |
| 43 | 48 | #else |
| 44 | 49 | static inline bool context_tracking_in_user(void) { return false; } |
| 45 | −static inline bool context_tracking_active(void) { return false; } | |
| 46 | −static inline bool context_tracking_is_enabled(void) { return false; } | |
| 47 | −static inline bool context_tracking_cpu_is_enabled(void) { return false; } | |
| 50 | +static inline bool context_tracking_enabled(void) { return false; } | |
| 51 | +static inline bool context_tracking_enabled_cpu(int cpu) { return false; } | |
| 52 | +static inline bool context_tracking_enabled_this_cpu(void) { return false; } | |
| 48 | 53 | #endif /* CONFIG_CONTEXT_TRACKING */ |
| 49 | 54 | |
| 50 | 55 | #endif |
| @@ -285,6 +285,8 @@ extern void coresight_disclaim_device(void __iomem *base); · 284 unmodified lines | ||
| 285 | 285 | extern void coresight_disclaim_device_unlocked(void __iomem *base); |
| 286 | 286 | extern char *coresight_alloc_device_name(struct coresight_dev_list *devs, |
| 287 | 287 | struct device *dev); |
| 288 | + | |
| 289 | +extern bool coresight_loses_context_with_cpu(struct device *dev); | |
| 288 | 290 | #else |
| 289 | 291 | static inline struct coresight_device * |
| 290 | 292 | coresight_register(struct coresight_desc *desc) { return NULL; } |
| @@ -307,6 +309,10 @@ static inline int coresight_claim_device(void __iomem *base) · 16 unmodified lines | ||
| 307 | 309 | static inline void coresight_disclaim_device(void __iomem *base) {} |
| 308 | 310 | static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} |
| 309 | 311 | |
| 312 | +static inline bool coresight_loses_context_with_cpu(struct device *dev) | |
| 313 | +{ | |
| 314 | + return false; | |
| 315 | +} | |
| 310 | 316 | #endif |
| 311 | 317 | |
| 312 | 318 | extern int coresight_get_cpu(struct device *dev); |
| @@ -290,53 +290,22 @@ struct counter_device_state { · 289 unmodified lines | ||
| 290 | 290 | const struct attribute_group **groups; |
| 291 | 291 | }; |
| 292 | 292 | |
| 293 | −/** | |
| 294 | − * struct counter_signal_read_value - Opaque Signal read value | |
| 295 | − * @buf: string representation of Signal read value | |
| 296 | − * @len: length of string in @buf | |
| 297 | − */ | |
| 298 | −struct counter_signal_read_value { | |
| 299 | − char *buf; | |
| 300 | − size_t len; | |
| 301 | −}; | |
| 302 | − | |
| 303 | −/** | |
| 304 | − * struct counter_count_read_value - Opaque Count read value | |
| 305 | − * @buf: string representation of Count read value | |
| 306 | − * @len: length of string in @buf | |
| 307 | − */ | |
| 308 | −struct counter_count_read_value { | |
| 309 | − char *buf; | |
| 310 | − size_t len; | |
| 311 | −}; | |
| 312 | − | |
| 313 | −/** | |
| 314 | − * struct counter_count_write_value - Opaque Count write value | |
| 315 | − * @buf: string representation of Count write value | |
| 316 | − */ | |
| 317 | −struct counter_count_write_value { | |
| 318 | − const char *buf; | |
| 293 | +enum counter_signal_value { | |
| 294 | + COUNTER_SIGNAL_LOW = 0, | |
| 295 | + COUNTER_SIGNAL_HIGH | |
| 319 | 296 | }; |
| 320 | 297 | |
| 321 | 298 | /** |
| 322 | 299 | * struct counter_ops - Callbacks from driver |
| 323 | 300 | * @signal_read: optional read callback for Signal attribute. The read |
| 324 | 301 | * value of the respective Signal should be passed back via |
| 325 | − * the val parameter. val points to an opaque type which | |
| 326 | − * should be set only by calling the | |
| 327 | − * counter_signal_read_value_set function from within the | |
| 328 | − * signal_read callback. | |
| 302 | + * the val parameter. | |
| 329 | 303 | * @count_read: optional read callback for Count attribute. The read |
| 330 | 304 | * value of the respective Count should be passed back via |
| 331 | − * the val parameter. val points to an opaque type which | |
| 332 | − * should be set only by calling the | |
| 333 | − * counter_count_read_value_set function from within the | |
| 334 | − * count_read callback. | |
| 305 | + * the val parameter. | |
| 335 | 306 | * @count_write: optional write callback for Count attribute. The write |
| 336 | 307 | * value for the respective Count is passed in via the val |
| 337 | − * parameter. val points to an opaque type which should be | |
| 338 | − * accessed only by calling the | |
| 339 | − * counter_count_write_value_get function. | |
| 308 | + * parameter. | |
| 340 | 309 | * @function_get: function to get the current count function mode. Returns |
| 341 | 310 | * 0 on success and negative error code on error. The index |
| 342 | 311 | * of the respective Count's returned function mode should |
| @@ -346,7 +315,7 @@ struct counter_count_write_value { · 3 unmodified lines | ||
| 346 | 315 | * Count's functions_list array. |
| 347 | 316 | * @action_get: function to get the current action mode. Returns 0 on |
| 348 | 317 | * success and negative error code on error. The index of |
| 349 | − * the respective Signal's returned action mode should be | |
| 318 | + * the respective Synapse's returned action mode should be | |
| 350 | 319 | * passed back via the action parameter. |
| 351 | 320 | * @action_set: function to set the action mode. action is the index of |
| 352 | 321 | * the requested action mode from the respective Synapse's |
| @@ -355,13 +324,11 @@ struct counter_count_write_value { · 2 unmodified lines | ||
| 355 | 324 | struct counter_ops { |
| 356 | 325 | int (*signal_read)(struct counter_device *counter, |
| 357 | 326 | struct counter_signal *signal, |
| 358 | − struct counter_signal_read_value *val); | |
| 327 | + enum counter_signal_value *val); | |
| 359 | 328 | int (*count_read)(struct counter_device *counter, |
| 360 | − struct counter_count *count, | |
| 361 | − struct counter_count_read_value *val); | |
| 329 | + struct counter_count *count, unsigned long *val); | |
| 362 | 330 | int (*count_write)(struct counter_device *counter, |
| 363 | − struct counter_count *count, | |
| 364 | − struct counter_count_write_value *val); | |
| 331 | + struct counter_count *count, unsigned long val); | |
| 365 | 332 | int (*function_get)(struct counter_device *counter, |
| 366 | 333 | struct counter_count *count, size_t *function); |
| 367 | 334 | int (*function_set)(struct counter_device *counter, |
| @@ -477,29 +444,6 @@ struct counter_device { · 109 unmodified lines | ||
| 477 | 444 | void *priv; |
| 478 | 445 | }; |
| 479 | 446 | |
| 480 | −enum counter_signal_level { | |
| 481 | − COUNTER_SIGNAL_LEVEL_LOW = 0, | |
| 482 | − COUNTER_SIGNAL_LEVEL_HIGH | |
| 483 | −}; | |
| 484 | − | |
| 485 | −enum counter_signal_value_type { | |
| 486 | − COUNTER_SIGNAL_LEVEL = 0 | |
| 487 | −}; | |
| 488 | − | |
| 489 | −enum counter_count_value_type { | |
| 490 | − COUNTER_COUNT_POSITION = 0, | |
| 491 | −}; | |
| 492 | − | |
| 493 | −void counter_signal_read_value_set(struct counter_signal_read_value *const val, | |
| 494 | − const enum counter_signal_value_type type, | |
| 495 | − void *const data); | |
| 496 | −void counter_count_read_value_set(struct counter_count_read_value *const val, | |
| 497 | − const enum counter_count_value_type type, | |
| 498 | − void *const data); | |
| 499 | −int counter_count_write_value_get(void *const data, | |
| 500 | − const enum counter_count_value_type type, | |
| 501 | − const struct counter_count_write_value *const val); | |
| 502 | − | |
| 503 | 447 | int counter_register(struct counter_device *const counter); |
| 504 | 448 | void counter_unregister(struct counter_device *const counter); |
| 505 | 449 | int devm_counter_register(struct device *dev, |
| @@ -184,7 +184,12 @@ void arch_cpu_idle_dead(void); · 183 unmodified lines | ||
| 184 | 184 | int cpu_report_state(int cpu); |
| 185 | 185 | int cpu_check_up_prepare(int cpu); |
| 186 | 186 | void cpu_set_state_online(int cpu); |
| 187 | −void play_idle(unsigned long duration_us); | |
| 187 | +void play_idle_precise(u64 duration_ns, u64 latency_ns); | |
| 188 | + | |
| 189 | +static inline void play_idle(unsigned long duration_us) | |
| 190 | +{ | |
| 191 | + play_idle_precise(duration_us * NSEC_PER_USEC, U64_MAX); | |
| 192 | +} | |
| 188 | 193 | |
| 189 | 194 | #ifdef CONFIG_HOTPLUG_CPU |
| 190 | 195 | bool cpu_wait_death(unsigned int cpu, int seconds); |
| @@ -33,6 +33,13 @@ cpufreq_cooling_register(struct cpufreq_policy *policy); · 32 unmodified lines | ||
| 33 | 33 | */ |
| 34 | 34 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); |
| 35 | 35 | |
| 36 | +/** | |
| 37 | + * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. | |
| 38 | + * @policy: cpufreq policy. | |
| 39 | + */ | |
| 40 | +struct thermal_cooling_device * | |
| 41 | +of_cpufreq_cooling_register(struct cpufreq_policy *policy); | |
| 42 | + | |
| 36 | 43 | #else /* !CONFIG_CPU_THERMAL */ |
| 37 | 44 | static inline struct thermal_cooling_device * |
| 38 | 45 | cpufreq_cooling_register(struct cpufreq_policy *policy) |
| @@ -45,21 +52,12 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) · 6 unmodified lines | ||
| 45 | 52 | { |
| 46 | 53 | return; |
| 47 | 54 | } |
| 48 | −#endif /* CONFIG_CPU_THERMAL */ | |
| 49 | 55 | |
| 50 | −#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) | |
| 51 | −/** | |
| 52 | − * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. | |
| 53 | − * @policy: cpufreq policy. | |
| 54 | − */ | |
| 55 | −struct thermal_cooling_device * | |
| 56 | −of_cpufreq_cooling_register(struct cpufreq_policy *policy); | |
| 57 | −#else | |
| 58 | 56 | static inline struct thermal_cooling_device * |
| 59 | 57 | of_cpufreq_cooling_register(struct cpufreq_policy *policy) |
| 60 | 58 | { |
| 61 | 59 | return NULL; |
| 62 | 60 | } |
| 63 | −#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */ | |
| 61 | +#endif /* CONFIG_CPU_THERMAL */ | |
| 64 | 62 | |
| 65 | 63 | #endif /* __CPU_COOLING_H__ */ |
| @@ -595,17 +595,6 @@ struct governor_attr { · 594 unmodified lines | ||
| 595 | 595 | size_t count); |
| 596 | 596 | }; |
| 597 | 597 | |
| 598 | −static inline bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy) | |
| 599 | −{ | |
| 600 | − /* | |
| 601 | − * Allow remote callbacks if: | |
| 602 | − * - dvfs_possible_from_any_cpu flag is set | |
| 603 | − * - the local and remote CPUs share cpufreq policy | |
| 604 | − */ | |
| 605 | − return policy->dvfs_possible_from_any_cpu || | |
| 606 | − cpumask_test_cpu(smp_processor_id(), policy->cpus); | |
| 607 | −} | |
| 608 | − | |
| 609 | 598 | /********************************************************************* |
| 610 | 599 | * FREQUENCY TABLE HELPERS * |
| 611 | 600 | *********************************************************************/ |
| @@ -129,6 +129,7 @@ enum cpuhp_state { · 128 unmodified lines | ||
| 129 | 129 | CPUHP_AP_ARC_TIMER_STARTING, |
| 130 | 130 | CPUHP_AP_RISCV_TIMER_STARTING, |
| 131 | 131 | CPUHP_AP_CSKY_TIMER_STARTING, |
| 132 | + CPUHP_AP_HYPERV_TIMER_STARTING, | |
| 132 | 133 | CPUHP_AP_KVM_STARTING, |
| 133 | 134 | CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING, |
| 134 | 135 | CPUHP_AP_KVM_ARM_VGIC_STARTING, |
| @@ -136,6 +137,7 @@ enum cpuhp_state { · 1 unmodified line | ||
| 136 | 137 | /* Must be the last timer callback */ |
| 137 | 138 | CPUHP_AP_DUMMY_TIMER_STARTING, |
| 138 | 139 | CPUHP_AP_ARM_XEN_STARTING, |
| 140 | + CPUHP_AP_ARM_KVMPV_STARTING, | |
| 139 | 141 | CPUHP_AP_ARM_CORESIGHT_STARTING, |
| 140 | 142 | CPUHP_AP_ARM64_ISNDEP_STARTING, |
| 141 | 143 | CPUHP_AP_SMPCFD_DYING, |
| @@ -29,10 +29,13 @@ struct cpuidle_driver; · 28 unmodified lines | ||
| 29 | 29 | * CPUIDLE DEVICE INTERFACE * |
| 30 | 30 | ****************************/ |
| 31 | 31 | |
| 32 | +#define CPUIDLE_STATE_DISABLED_BY_USER BIT(0) | |
| 33 | +#define CPUIDLE_STATE_DISABLED_BY_DRIVER BIT(1) | |
| 34 | + | |
| 32 | 35 | struct cpuidle_state_usage { |
| 33 | 36 | unsigned long long disable; |
| 34 | 37 | unsigned long long usage; |
| 35 | − unsigned long long time; /* in US */ | |
| 38 | + u64 time_ns; | |
| 36 | 39 | unsigned long long above; /* Number of times it's been too deep */ |
| 37 | 40 | unsigned long long below; /* Number of times it's been too shallow */ |
| 38 | 41 | #ifdef CONFIG_SUSPEND |
| @@ -45,11 +48,12 @@ struct cpuidle_state { · 6 unmodified lines | ||
| 45 | 48 | char name[CPUIDLE_NAME_LEN]; |
| 46 | 49 | char desc[CPUIDLE_DESC_LEN]; |
| 47 | 50 | |
| 51 | + u64 exit_latency_ns; | |
| 52 | + u64 target_residency_ns; | |
| 48 | 53 | unsigned int flags; |
| 49 | 54 | unsigned int exit_latency; /* in US */ |
| 50 | 55 | int power_usage; /* in mW */ |
| 51 | 56 | unsigned int target_residency; /* in US */ |
| 52 | − bool disabled; /* disabled on all CPUs */ | |
| 53 | 57 | |
| 54 | 58 | int (*enter) (struct cpuidle_device *dev, |
| 55 | 59 | struct cpuidle_driver *drv, |
| @@ -72,6 +76,7 @@ struct cpuidle_state { · 16 unmodified lines | ||
| 72 | 76 | #define CPUIDLE_FLAG_POLLING BIT(0) /* polling state */ |
| 73 | 77 | #define CPUIDLE_FLAG_COUPLED BIT(1) /* state applies to multiple cpus */ |
| 74 | 78 | #define CPUIDLE_FLAG_TIMER_STOP BIT(2) /* timer is stopped on this state */ |
| 79 | +#define CPUIDLE_FLAG_UNUSABLE BIT(3) /* avoid using this state */ | |
| 75 | 80 | |
| 76 | 81 | struct cpuidle_device_kobj; |
| 77 | 82 | struct cpuidle_state_kobj; |
| @@ -80,14 +85,14 @@ struct cpuidle_driver_kobj; · 2 unmodified lines | ||
| 80 | 85 | struct cpuidle_device { |
| 81 | 86 | unsigned int registered:1; |
| 82 | 87 | unsigned int enabled:1; |
| 83 | − unsigned int use_deepest_state:1; | |
| 84 | 88 | unsigned int poll_time_limit:1; |
| 85 | 89 | unsigned int cpu; |
| 86 | 90 | ktime_t next_hrtimer; |
| 87 | 91 | |
| 88 | 92 | int last_state_idx; |
| 89 | − int last_residency; | |
| 93 | + u64 last_residency_ns; | |
| 90 | 94 | u64 poll_limit_ns; |
| 95 | + u64 forced_idle_latency_limit_ns; | |
| 91 | 96 | struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; |
| 92 | 97 | struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; |
| 93 | 98 | struct cpuidle_driver_kobj *kobj_driver; |
| @@ -144,6 +149,8 @@ extern int cpuidle_register_driver(struct cpuidle_driver *drv); · 50 unmodified lines | ||
| 144 | 149 | extern struct cpuidle_driver *cpuidle_get_driver(void); |
| 145 | 150 | extern struct cpuidle_driver *cpuidle_driver_ref(void); |
| 146 | 151 | extern void cpuidle_driver_unref(void); |
| 152 | +extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx, | |
| 153 | + bool disable); | |
| 147 | 154 | extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); |
| 148 | 155 | extern int cpuidle_register_device(struct cpuidle_device *dev); |
| 149 | 156 | extern void cpuidle_unregister_device(struct cpuidle_device *dev); |
| @@ -181,6 +188,8 @@ static inline int cpuidle_register_driver(struct cpuidle_driver *drv) · 31 unmodified lines | ||
| 181 | 188 | static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } |
| 182 | 189 | static inline struct cpuidle_driver *cpuidle_driver_ref(void) {return NULL; } |
| 183 | 190 | static inline void cpuidle_driver_unref(void) {} |
| 191 | +static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, | |
| 192 | + int idx, bool disable) { } | |
| 184 | 193 | static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } |
| 185 | 194 | static inline int cpuidle_register_device(struct cpuidle_device *dev) |
| 186 | 195 | {return -ENODEV; } |
| @@ -204,18 +213,20 @@ static inline struct cpuidle_device *cpuidle_get_device(void) {return NULL; } · 17 unmodified lines | ||
| 204 | 213 | |
| 205 | 214 | #ifdef CONFIG_CPU_IDLE |
| 206 | 215 | extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv, |
| 207 | − struct cpuidle_device *dev); | |
| 216 | + struct cpuidle_device *dev, | |
| 217 | + u64 latency_limit_ns); | |
| 208 | 218 | extern int cpuidle_enter_s2idle(struct cpuidle_driver *drv, |
| 209 | 219 | struct cpuidle_device *dev); |
| 210 | −extern void cpuidle_use_deepest_state(bool enable); | |
| 220 | +extern void cpuidle_use_deepest_state(u64 latency_limit_ns); | |
| 211 | 221 | #else |
| 212 | 222 | static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv, |
| 213 | − struct cpuidle_device *dev) | |
| 223 | + struct cpuidle_device *dev, | |
| 224 | + u64 latency_limit_ns) | |
| 214 | 225 | {return -ENODEV; } |
| 215 | 226 | static inline int cpuidle_enter_s2idle(struct cpuidle_driver *drv, |
| 216 | 227 | struct cpuidle_device *dev) |
| 217 | 228 | {return -ENODEV; } |
| 218 | −static inline void cpuidle_use_deepest_state(bool enable) | |
| 229 | +static inline void cpuidle_use_deepest_state(u64 latency_limit_ns) | |
| 219 | 230 | { |
| 220 | 231 | } |
| 221 | 232 | #endif |
| @@ -260,7 +271,7 @@ struct cpuidle_governor { · 38 unmodified lines | ||
| 260 | 271 | |
| 261 | 272 | #ifdef CONFIG_CPU_IDLE |
| 262 | 273 | extern int cpuidle_register_governor(struct cpuidle_governor *gov); |
| 263 | −extern int cpuidle_governor_latency_req(unsigned int cpu); | |
| 274 | +extern s64 cpuidle_governor_latency_req(unsigned int cpu); | |
| 264 | 275 | #else |
| 265 | 276 | static inline int cpuidle_register_governor(struct cpuidle_governor *gov) |
| 266 | 277 | {return 0;} |
| @@ -41,8 +41,6 @@ · 40 unmodified lines | ||
| 41 | 41 | #define CRYPTO_ALG_TYPE_CIPHER 0x00000001 |
| 42 | 42 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000002 |
| 43 | 43 | #define CRYPTO_ALG_TYPE_AEAD 0x00000003 |
| 44 | −#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 | |
| 45 | −#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 | |
| 46 | 44 | #define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005 |
| 47 | 45 | #define CRYPTO_ALG_TYPE_KPP 0x00000008 |
| 48 | 46 | #define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a |
| @@ -55,7 +53,6 @@ · 6 unmodified lines | ||
| 55 | 53 | |
| 56 | 54 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e |
| 57 | 55 | #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e |
| 58 | −#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c | |
| 59 | 56 | #define CRYPTO_ALG_TYPE_ACOMPRESS_MASK 0x0000000e |
| 60 | 57 | |
| 61 | 58 | #define CRYPTO_ALG_LARVAL 0x00000010 |
| @@ -139,9 +136,7 @@ · 77 unmodified lines | ||
| 139 | 136 | #define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) |
| 140 | 137 | |
| 141 | 138 | struct scatterlist; |
| 142 | −struct crypto_ablkcipher; | |
| 143 | 139 | struct crypto_async_request; |
| 144 | −struct crypto_blkcipher; | |
| 145 | 140 | struct crypto_tfm; |
| 146 | 141 | struct crypto_type; |
| 147 | 142 | |
| @@ -163,25 +158,6 @@ struct crypto_async_request { · 15 unmodified lines | ||
| 163 | 158 | u32 flags; |
| 164 | 159 | }; |
| 165 | 160 | |
| 166 | −struct ablkcipher_request { | |
| 167 | − struct crypto_async_request base; | |
| 168 | − | |
| 169 | − unsigned int nbytes; | |
| 170 | − | |
| 171 | − void *info; | |
| 172 | − | |
| 173 | − struct scatterlist *src; | |
| 174 | − struct scatterlist *dst; | |
| 175 | − | |
| 176 | − void *__ctx[] CRYPTO_MINALIGN_ATTR; | |
| 177 | −}; | |
| 178 | − | |
| 179 | −struct blkcipher_desc { | |
| 180 | − struct crypto_blkcipher *tfm; | |
| 181 | − void *info; | |
| 182 | − u32 flags; | |
| 183 | −}; | |
| 184 | − | |
| 185 | 161 | /** |
| 186 | 162 | * DOC: Block Cipher Algorithm Definitions |
| 187 | 163 | * |
| @@ -189,83 +165,6 @@ struct blkcipher_desc { · 1 unmodified line | ||
| 189 | 165 | * managed via crypto_register_alg() and crypto_unregister_alg(). |
| 190 | 166 | */ |
| 191 | 167 | |
| 192 | −/** | |
| 193 | − * struct ablkcipher_alg - asynchronous block cipher definition | |
| 194 | − * @min_keysize: Minimum key size supported by the transformation. This is the | |
| 195 | − * smallest key length supported by this transformation algorithm. | |
| 196 | − * This must be set to one of the pre-defined values as this is | |
| 197 | − * not hardware specific. Possible values for this field can be | |
| 198 | − * found via git grep "_MIN_KEY_SIZE" include/crypto/ | |
| 199 | − * @max_keysize: Maximum key size supported by the transformation. This is the | |
| 200 | − * largest key length supported by this transformation algorithm. | |
| 201 | − * This must be set to one of the pre-defined values as this is | |
| 202 | − * not hardware specific. Possible values for this field can be | |
| 203 | − * found via git grep "_MAX_KEY_SIZE" include/crypto/ | |
| 204 | − * @setkey: Set key for the transformation. This function is used to either | |
| 205 | − * program a supplied key into the hardware or store the key in the | |
| 206 | − * transformation context for programming it later. Note that this | |
| 207 | − * function does modify the transformation context. This function can | |
| 208 | − * be called multiple times during the existence of the transformation | |
| 209 | − * object, so one must make sure the key is properly reprogrammed into | |
| 210 | − * the hardware. This function is also responsible for checking the key | |
| 211 | − * length for validity. In case a software fallback was put in place in | |
| 212 | − * the @cra_init call, this function might need to use the fallback if | |
| 213 | − * the algorithm doesn't support all of the key sizes. | |
| 214 | − * @encrypt: Encrypt a scatterlist of blocks. This function is used to encrypt | |
| 215 | − * the supplied scatterlist containing the blocks of data. The crypto | |
| 216 | − * API consumer is responsible for aligning the entries of the | |
| 217 | − * scatterlist properly and making sure the chunks are correctly | |
| 218 | − * sized. In case a software fallback was put in place in the | |
| 219 | − * @cra_init call, this function might need to use the fallback if | |
| 220 | − * the algorithm doesn't support all of the key sizes. In case the | |
| 221 | − * key was stored in transformation context, the key might need to be | |
| 222 | − * re-programmed into the hardware in this function. This function | |
| 223 | − * shall not modify the transformation context, as this function may | |
| 224 | − * be called in parallel with the same transformation object. | |
| 225 | − * @decrypt: Decrypt a single block. This is a reverse counterpart to @encrypt | |
| 226 | − * and the conditions are exactly the same. | |
| 227 | − * @ivsize: IV size applicable for transformation. The consumer must provide an | |
| 228 | − * IV of exactly that size to perform the encrypt or decrypt operation. | |
| 229 | − * | |
| 230 | − * All fields except @ivsize are mandatory and must be filled. | |
| 231 | − */ | |
| 232 | −struct ablkcipher_alg { | |
| 233 | − int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key, | |
| 234 | − unsigned int keylen); | |
| 235 | − int (*encrypt)(struct ablkcipher_request *req); | |
| 236 | − int (*decrypt)(struct ablkcipher_request *req); | |
| 237 | − | |
| 238 | − unsigned int min_keysize; | |
| 239 | − unsigned int max_keysize; | |
| 240 | − unsigned int ivsize; | |
| 241 | −}; | |
| 242 | − | |
| 243 | −/** | |
| 244 | − * struct blkcipher_alg - synchronous block cipher definition | |
| 245 | − * @min_keysize: see struct ablkcipher_alg | |
| 246 | − * @max_keysize: see struct ablkcipher_alg | |
| 247 | − * @setkey: see struct ablkcipher_alg | |
| 248 | − * @encrypt: see struct ablkcipher_alg | |
| 249 | − * @decrypt: see struct ablkcipher_alg | |
| 250 | − * @ivsize: see struct ablkcipher_alg | |
| 251 | − * | |
| 252 | − * All fields except @ivsize are mandatory and must be filled. | |
| 253 | − */ | |
| 254 | −struct blkcipher_alg { | |
| 255 | − int (*setkey)(struct crypto_tfm *tfm, const u8 *key, | |
| 256 | − unsigned int keylen); | |
| 257 | − int (*encrypt)(struct blkcipher_desc *desc, | |
| 258 | − struct scatterlist *dst, struct scatterlist *src, | |
| 259 | − unsigned int nbytes); | |
| 260 | − int (*decrypt)(struct blkcipher_desc *desc, | |
| 261 | − struct scatterlist *dst, struct scatterlist *src, | |
| 262 | − unsigned int nbytes); | |
| 263 | − | |
| 264 | − unsigned int min_keysize; | |
| 265 | − unsigned int max_keysize; | |
| 266 | − unsigned int ivsize; | |
| 267 | −}; | |
| 268 | − | |
| 269 | 168 | /** |
| 270 | 169 | * struct cipher_alg - single-block symmetric ciphers definition |
| 271 | 170 | * @cia_min_keysize: Minimum key size supported by the transformation. This is |
| @@ -450,8 +349,6 @@ struct crypto_istat_rng { · 178 unmodified lines | ||
| 450 | 349 | }; |
| 451 | 350 | #endif /* CONFIG_CRYPTO_STATS */ |
| 452 | 351 | |
| 453 | −#define cra_ablkcipher cra_u.ablkcipher | |
| 454 | −#define cra_blkcipher cra_u.blkcipher | |
| 455 | 352 | #define cra_cipher cra_u.cipher |
| 456 | 353 | #define cra_compress cra_u.compress |
| 457 | 354 | |
| @@ -499,9 +396,8 @@ struct crypto_istat_rng { · 41 unmodified lines | ||
| 499 | 396 | * transformation algorithm. |
| 500 | 397 | * @cra_type: Type of the cryptographic transformation. This is a pointer to |
| 501 | 398 | * struct crypto_type, which implements callbacks common for all |
| 502 | − * transformation types. There are multiple options: | |
| 503 | − * &crypto_blkcipher_type, &crypto_ablkcipher_type, | |
| 504 | − * &crypto_ahash_type, &crypto_rng_type. | |
| 399 | + * transformation types. There are multiple options, such as | |
| 400 | + * &crypto_skcipher_type, &crypto_ahash_type, &crypto_rng_type. | |
| 505 | 401 | * This field might be empty. In that case, there are no common |
| 506 | 402 | * callbacks. This is the case for: cipher, compress, shash. |
| 507 | 403 | * @cra_u: Callbacks implementing the transformation. This is a union of |
| @@ -520,10 +416,6 @@ struct crypto_istat_rng { · 12 unmodified lines | ||
| 520 | 416 | * @cra_exit: Deinitialize the cryptographic transformation object. This is a |
| 521 | 417 | * counterpart to @cra_init, used to remove various changes set in |
| 522 | 418 | * @cra_init. |
| 523 | − * @cra_u.ablkcipher: Union member which contains an asynchronous block cipher | |
| 524 | − * definition. See @struct @ablkcipher_alg. | |
| 525 | − * @cra_u.blkcipher: Union member which contains a synchronous block cipher | |
| 526 | − * definition See @struct @blkcipher_alg. | |
| 527 | 419 | * @cra_u.cipher: Union member which contains a single-block symmetric cipher |
| 528 | 420 | * definition. See @struct @cipher_alg. |
| 529 | 421 | * @cra_u.compress: Union member which contains a (de)compression algorithm. |
| @@ -565,8 +457,6 @@ struct crypto_alg { · 35 unmodified lines | ||
| 565 | 457 | const struct crypto_type *cra_type; |
| 566 | 458 | |
| 567 | 459 | union { |
| 568 | − struct ablkcipher_alg ablkcipher; | |
| 569 | − struct blkcipher_alg blkcipher; | |
| 570 | 460 | struct cipher_alg cipher; |
| 571 | 461 | struct compress_alg compress; |
| 572 | 462 | } cra_u; |
| @@ -594,8 +484,6 @@ struct crypto_alg { · 21 unmodified lines | ||
| 594 | 484 | #ifdef CONFIG_CRYPTO_STATS |
| 595 | 485 | void crypto_stats_init(struct crypto_alg *alg); |
| 596 | 486 | void crypto_stats_get(struct crypto_alg *alg); |
| 597 | −void crypto_stats_ablkcipher_encrypt(unsigned int nbytes, int ret, struct crypto_alg *alg); | |
| 598 | −void crypto_stats_ablkcipher_decrypt(unsigned int nbytes, int ret, struct crypto_alg *alg); | |
| 599 | 487 | void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret); |
| 600 | 488 | void crypto_stats_aead_decrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret); |
| 601 | 489 | void crypto_stats_ahash_update(unsigned int nbytes, int ret, struct crypto_alg *alg); |
| @@ -618,10 +506,6 @@ static inline void crypto_stats_init(struct crypto_alg *alg) · 16 unmodified lines | ||
| 618 | 506 | {} |
| 619 | 507 | static inline void crypto_stats_get(struct crypto_alg *alg) |
| 620 | 508 | {} |
| 621 | −static inline void crypto_stats_ablkcipher_encrypt(unsigned int nbytes, int ret, struct crypto_alg *alg) | |
| 622 | −{} | |
| 623 | −static inline void crypto_stats_ablkcipher_decrypt(unsigned int nbytes, int ret, struct crypto_alg *alg) | |
| 624 | −{} | |
| 625 | 509 | static inline void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret) |
| 626 | 510 | {} |
| 627 | 511 | static inline void crypto_stats_aead_decrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret) |
| @@ -715,28 +599,6 @@ int crypto_has_alg(const char *name, u32 type, u32 mask); · 87 unmodified lines | ||
| 715 | 599 | * crypto_free_*(), as well as the various helpers below. |
| 716 | 600 | */ |
| 717 | 601 | |
| 718 | −struct ablkcipher_tfm { | |
| 719 | − int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key, | |
| 720 | − unsigned int keylen); | |
| 721 | − int (*encrypt)(struct ablkcipher_request *req); | |
| 722 | − int (*decrypt)(struct ablkcipher_request *req); | |
| 723 | − | |
| 724 | − struct crypto_ablkcipher *base; | |
| 725 | − | |
| 726 | − unsigned int ivsize; | |
| 727 | − unsigned int reqsize; | |
| 728 | −}; | |
| 729 | − | |
| 730 | −struct blkcipher_tfm { | |
| 731 | − void *iv; | |
| 732 | − int (*setkey)(struct crypto_tfm *tfm, const u8 *key, | |
| 733 | − unsigned int keylen); | |
| 734 | − int (*encrypt)(struct blkcipher_desc *desc, struct scatterlist *dst, | |
| 735 | − struct scatterlist *src, unsigned int nbytes); | |
| 736 | − int (*decrypt)(struct blkcipher_desc *desc, struct scatterlist *dst, | |
| 737 | − struct scatterlist *src, unsigned int nbytes); | |
| 738 | −}; | |
| 739 | − | |
| 740 | 602 | struct cipher_tfm { |
| 741 | 603 | int (*cit_setkey)(struct crypto_tfm *tfm, |
| 742 | 604 | const u8 *key, unsigned int keylen); |
| @@ -753,8 +615,6 @@ struct compress_tfm { · 10 unmodified lines | ||
| 753 | 615 | u8 *dst, unsigned int *dlen); |
| 754 | 616 | }; |
| 755 | 617 | |
| 756 | −#define crt_ablkcipher crt_u.ablkcipher | |
| 757 | −#define crt_blkcipher crt_u.blkcipher | |
| 758 | 618 | #define crt_cipher crt_u.cipher |
| 759 | 619 | #define crt_compress crt_u.compress |
| 760 | 620 | |
| @@ -763,8 +623,6 @@ struct crypto_tfm { · 2 unmodified lines | ||
| 763 | 623 | u32 crt_flags; |
| 764 | 624 | |
| 765 | 625 | union { |
| 766 | − struct ablkcipher_tfm ablkcipher; | |
| 767 | − struct blkcipher_tfm blkcipher; | |
| 768 | 626 | struct cipher_tfm cipher; |
| 769 | 627 | struct compress_tfm compress; |
| 770 | 628 | } crt_u; |
| @@ -776,14 +634,6 @@ struct crypto_tfm { · 5 unmodified lines | ||
| 776 | 634 | void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; |
| 777 | 635 | }; |
| 778 | 636 | |
| 779 | −struct crypto_ablkcipher { | |
| 780 | − struct crypto_tfm base; | |
| 781 | −}; | |
| 782 | − | |
| 783 | −struct crypto_blkcipher { | |
| 784 | − struct crypto_tfm base; | |
| 785 | −}; | |
| 786 | − | |
| 787 | 637 | struct crypto_cipher { |
| 788 | 638 | struct crypto_tfm base; |
| 789 | 639 | }; |
| @@ -891,713 +741,6 @@ static inline unsigned int crypto_tfm_ctx_alignment(void) · 101 unmodified lines | ||
| 891 | 741 | return __alignof__(tfm->__crt_ctx); |
| 892 | 742 | } |
| 893 | 743 | |
| 894 | −/* | |
| 895 | − * API wrappers. | |
| 896 | − */ | |
| 897 | −static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast( | |
| 898 | − struct crypto_tfm *tfm) | |
| 899 | −{ | |
| 900 | − return (struct crypto_ablkcipher *)tfm; | |
| 901 | −} | |
| 902 | − | |
| 903 | −static inline u32 crypto_skcipher_type(u32 type) | |
| 904 | −{ | |
| 905 | − type &= ~CRYPTO_ALG_TYPE_MASK; | |
| 906 | − type |= CRYPTO_ALG_TYPE_BLKCIPHER; | |
| 907 | − return type; | |
| 908 | −} | |
| 909 | − | |
| 910 | −static inline u32 crypto_skcipher_mask(u32 mask) | |
| 911 | −{ | |
| 912 | − mask &= ~CRYPTO_ALG_TYPE_MASK; | |
| 913 | − mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK; | |
| 914 | − return mask; | |
| 915 | −} | |
| 916 | − | |
| 917 | −/** | |
| 918 | − * DOC: Asynchronous Block Cipher API | |
| 919 | − * | |
| 920 | − * Asynchronous block cipher API is used with the ciphers of type | |
| 921 | − * CRYPTO_ALG_TYPE_ABLKCIPHER (listed as type "ablkcipher" in /proc/crypto). | |
| 922 | − * | |
| 923 | − * Asynchronous cipher operations imply that the function invocation for a | |
| 924 | − * cipher request returns immediately before the completion of the operation. | |
| 925 | − * The cipher request is scheduled as a separate kernel thread and therefore | |
| 926 | − * load-balanced on the different CPUs via the process scheduler. To allow | |
| 927 | − * the kernel crypto API to inform the caller about the completion of a cipher | |
| 928 | − * request, the caller must provide a callback function. That function is | |
| 929 | − * invoked with the cipher handle when the request completes. | |
| 930 | − * | |
| 931 | − * To support the asynchronous operation, additional information than just the | |
| 932 | − * cipher handle must be supplied to the kernel crypto API. That additional | |
| 933 | − * information is given by filling in the ablkcipher_request data structure. | |
| 934 | − * | |
| 935 | − * For the asynchronous block cipher API, the state is maintained with the tfm | |
| 936 | − * cipher handle. A single tfm can be used across multiple calls and in | |
| 937 | − * parallel. For asynchronous block cipher calls, context data supplied and | |
| 938 | − * only used by the caller can be referenced the request data structure in | |
| 939 | − * addition to the IV used for the cipher request. The maintenance of such | |
| 940 | − * state information would be important for a crypto driver implementer to | |
| 941 | − * have, because when calling the callback function upon completion of the | |
| 942 | − * cipher operation, that callback function may need some information about | |
| 943 | − * which operation just finished if it invoked multiple in parallel. This | |
| 944 | − * state information is unused by the kernel crypto API. | |
| 945 | − */ | |
| 946 | − | |
| 947 | −static inline struct crypto_tfm *crypto_ablkcipher_tfm( | |
| 948 | − struct crypto_ablkcipher *tfm) | |
| 949 | −{ | |
| 950 | − return &tfm->base; | |
| 951 | −} | |
| 952 | − | |
| 953 | −/** | |
| 954 | − * crypto_free_ablkcipher() - zeroize and free cipher handle | |
| 955 | − * @tfm: cipher handle to be freed | |
| 956 | − */ | |
| 957 | −static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm) | |
| 958 | −{ | |
| 959 | − crypto_free_tfm(crypto_ablkcipher_tfm(tfm)); | |
| 960 | −} | |
| 961 | − | |
| 962 | −/** | |
| 963 | − * crypto_has_ablkcipher() - Search for the availability of an ablkcipher. | |
| 964 | − * @alg_name: is the cra_name / name or cra_driver_name / driver name of the | |
| 965 | − * ablkcipher | |
| 966 | − * @type: specifies the type of the cipher | |
| 967 | − * @mask: specifies the mask for the cipher | |
| 968 | − * | |
| 969 | − * Return: true when the ablkcipher is known to the kernel crypto API; false | |
| 970 | − * otherwise | |
| 971 | − */ | |
| 972 | −static inline int crypto_has_ablkcipher(const char *alg_name, u32 type, | |
| 973 | − u32 mask) | |
| 974 | −{ | |
| 975 | − return crypto_has_alg(alg_name, crypto_skcipher_type(type), | |
| 976 | − crypto_skcipher_mask(mask)); | |
| 977 | −} | |
| 978 | − | |
| 979 | −static inline struct ablkcipher_tfm *crypto_ablkcipher_crt( | |
| 980 | − struct crypto_ablkcipher *tfm) | |
| 981 | −{ | |
| 982 | − return &crypto_ablkcipher_tfm(tfm)->crt_ablkcipher; | |
| 983 | −} | |
| 984 | − | |
| 985 | −/** | |
| 986 | − * crypto_ablkcipher_ivsize() - obtain IV size | |
| 987 | − * @tfm: cipher handle | |
| 988 | − * | |
| 989 | − * The size of the IV for the ablkcipher referenced by the cipher handle is | |
| 990 | − * returned. This IV size may be zero if the cipher does not need an IV. | |
| 991 | − * | |
| 992 | − * Return: IV size in bytes | |
| 993 | − */ | |
| 994 | −static inline unsigned int crypto_ablkcipher_ivsize( | |
| 995 | − struct crypto_ablkcipher *tfm) | |
| 996 | −{ | |
| 997 | − return crypto_ablkcipher_crt(tfm)->ivsize; | |
| 998 | −} | |
| 999 | − | |
| 1000 | −/** | |
| 1001 | − * crypto_ablkcipher_blocksize() - obtain block size of cipher | |
| 1002 | − * @tfm: cipher handle | |
| 1003 | − * | |
| 1004 | − * The block size for the ablkcipher referenced with the cipher handle is | |
| 1005 | − * returned. The caller may use that information to allocate appropriate | |
| 1006 | − * memory for the data returned by the encryption or decryption operation | |
| 1007 | − * | |
| 1008 | − * Return: block size of cipher | |
| 1009 | − */ | |
| 1010 | −static inline unsigned int crypto_ablkcipher_blocksize( | |
| 1011 | − struct crypto_ablkcipher *tfm) | |
| 1012 | −{ | |
| 1013 | − return crypto_tfm_alg_blocksize(crypto_ablkcipher_tfm(tfm)); | |
| 1014 | −} | |
| 1015 | − | |
| 1016 | −static inline unsigned int crypto_ablkcipher_alignmask( | |
| 1017 | − struct crypto_ablkcipher *tfm) | |
| 1018 | −{ | |
| 1019 | − return crypto_tfm_alg_alignmask(crypto_ablkcipher_tfm(tfm)); | |
| 1020 | −} | |
| 1021 | − | |
| 1022 | −static inline u32 crypto_ablkcipher_get_flags(struct crypto_ablkcipher *tfm) | |
| 1023 | −{ | |
| 1024 | − return crypto_tfm_get_flags(crypto_ablkcipher_tfm(tfm)); | |
| 1025 | −} | |
| 1026 | − | |
| 1027 | −static inline void crypto_ablkcipher_set_flags(struct crypto_ablkcipher *tfm, | |
| 1028 | − u32 flags) | |
| 1029 | −{ | |
| 1030 | − crypto_tfm_set_flags(crypto_ablkcipher_tfm(tfm), flags); | |
| 1031 | −} | |
| 1032 | − | |
| 1033 | −static inline void crypto_ablkcipher_clear_flags(struct crypto_ablkcipher *tfm, | |
| 1034 | − u32 flags) | |
| 1035 | −{ | |
| 1036 | − crypto_tfm_clear_flags(crypto_ablkcipher_tfm(tfm), flags); | |
| 1037 | −} | |
| 1038 | − | |
| 1039 | −/** | |
| 1040 | − * crypto_ablkcipher_setkey() - set key for cipher | |
| 1041 | − * @tfm: cipher handle | |
| 1042 | − * @key: buffer holding the key | |
| 1043 | − * @keylen: length of the key in bytes | |
| 1044 | − * | |
| 1045 | − * The caller provided key is set for the ablkcipher referenced by the cipher | |
| 1046 | − * handle. | |
| 1047 | − * | |
| 1048 | − * Note, the key length determines the cipher type. Many block ciphers implement | |
| 1049 | − * different cipher modes depending on the key size, such as AES-128 vs AES-192 | |
| 1050 | − * vs. AES-256. When providing a 16 byte key for an AES cipher handle, AES-128 | |
| 1051 | − * is performed. | |
| 1052 | − * | |
| 1053 | − * Return: 0 if the setting of the key was successful; < 0 if an error occurred | |
| 1054 | − */ | |
| 1055 | −static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm, | |
| 1056 | − const u8 *key, unsigned int keylen) | |
| 1057 | −{ | |
| 1058 | − struct ablkcipher_tfm *crt = crypto_ablkcipher_crt(tfm); | |
| 1059 | − | |
| 1060 | − return crt->setkey(crt->base, key, keylen); | |
| 1061 | −} | |
| 1062 | − | |
| 1063 | −/** | |
| 1064 | − * crypto_ablkcipher_reqtfm() - obtain cipher handle from request | |
| 1065 | − * @req: ablkcipher_request out of which the cipher handle is to be obtained | |
| 1066 | − * | |
| 1067 | − * Return the crypto_ablkcipher handle when furnishing an ablkcipher_request | |
| 1068 | − * data structure. | |
| 1069 | − * | |
| 1070 | − * Return: crypto_ablkcipher handle | |
| 1071 | − */ | |
| 1072 | −static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm( | |
| 1073 | − struct ablkcipher_request *req) | |
| 1074 | −{ | |
| 1075 | − return __crypto_ablkcipher_cast(req->base.tfm); | |
| 1076 | −} | |
| 1077 | − | |
| 1078 | −/** | |
| 1079 | − * crypto_ablkcipher_encrypt() - encrypt plaintext | |
| 1080 | − * @req: reference to the ablkcipher_request handle that holds all information | |
| 1081 | − * needed to perform the cipher operation | |
| 1082 | − * | |
| 1083 | − * Encrypt plaintext data using the ablkcipher_request handle. That data | |
| 1084 | − * structure and how it is filled with data is discussed with the | |
| 1085 | − * ablkcipher_request_* functions. | |
| 1086 | − * | |
| 1087 | − * Return: 0 if the cipher operation was successful; < 0 if an error occurred | |
| 1088 | − */ | |
| 1089 | −static inline int crypto_ablkcipher_encrypt(struct ablkcipher_request *req) | |
| 1090 | −{ | |
| 1091 | − struct ablkcipher_tfm *crt = | |
| 1092 | − crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req)); | |
| 1093 | − struct crypto_alg *alg = crt->base->base.__crt_alg; | |
| 1094 | − unsigned int nbytes = req->nbytes; | |
| 1095 | − int ret; | |
| 1096 | − | |
| 1097 | − crypto_stats_get(alg); | |
| 1098 | − ret = crt->encrypt(req); | |
| 1099 | − crypto_stats_ablkcipher_encrypt(nbytes, ret, alg); | |
| 1100 | − return ret; | |
| 1101 | −} | |
| 1102 | − | |
| 1103 | −/** | |
| 1104 | − * crypto_ablkcipher_decrypt() - decrypt ciphertext | |
| 1105 | − * @req: reference to the ablkcipher_request handle that holds all information | |
| 1106 | − * needed to perform the cipher operation | |
| 1107 | − * | |
| 1108 | − * Decrypt ciphertext data using the ablkcipher_request handle. That data | |
| 1109 | − * structure and how it is filled with data is discussed with the | |
| 1110 | − * ablkcipher_request_* functions. | |
| 1111 | − * | |
| 1112 | − * Return: 0 if the cipher operation was successful; < 0 if an error occurred | |
| 1113 | − */ | |
| 1114 | −static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req) | |
| 1115 | −{ | |
| 1116 | − struct ablkcipher_tfm *crt = | |
| 1117 | − crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req)); | |
| 1118 | − struct crypto_alg *alg = crt->base->base.__crt_alg; | |
| 1119 | − unsigned int nbytes = req->nbytes; | |
| 1120 | − int ret; | |
| 1121 | − | |
| 1122 | − crypto_stats_get(alg); | |
| 1123 | − ret = crt->decrypt(req); | |
| 1124 | − crypto_stats_ablkcipher_decrypt(nbytes, ret, alg); | |
| 1125 | − return ret; | |
| 1126 | −} | |
| 1127 | − | |
| 1128 | −/** | |
| 1129 | − * DOC: Asynchronous Cipher Request Handle | |
| 1130 | − * | |
| 1131 | − * The ablkcipher_request data structure contains all pointers to data | |
| 1132 | − * required for the asynchronous cipher operation. This includes the cipher | |
| 1133 | − * handle (which can be used by multiple ablkcipher_request instances), pointer | |
| 1134 | − * to plaintext and ciphertext, asynchronous callback function, etc. It acts | |
| 1135 | − * as a handle to the ablkcipher_request_* API calls in a similar way as | |
| 1136 | − * ablkcipher handle to the crypto_ablkcipher_* API calls. | |
| 1137 | − */ | |
| 1138 | − | |
| 1139 | −/** | |
| 1140 | − * crypto_ablkcipher_reqsize() - obtain size of the request data structure | |
| 1141 | − * @tfm: cipher handle | |
| 1142 | − * | |
| 1143 | − * Return: number of bytes | |
| 1144 | − */ | |
| 1145 | −static inline unsigned int crypto_ablkcipher_reqsize( | |
| 1146 | − struct crypto_ablkcipher *tfm) | |
| 1147 | −{ | |
| 1148 | − return crypto_ablkcipher_crt(tfm)->reqsize; | |
| 1149 | −} | |
| 1150 | − | |
| 1151 | −/** | |
| 1152 | − * ablkcipher_request_set_tfm() - update cipher handle reference in request | |
| 1153 | − * @req: request handle to be modified | |
| 1154 | − * @tfm: cipher handle that shall be added to the request handle | |
| 1155 | − * | |
| 1156 | − * Allow the caller to replace the existing ablkcipher handle in the request | |
| 1157 | − * data structure with a different one. | |
| 1158 | − */ | |
| 1159 | −static inline void ablkcipher_request_set_tfm( | |
| 1160 | − struct ablkcipher_request *req, struct crypto_ablkcipher *tfm) | |
| 1161 | −{ | |
| 1162 | − req->base.tfm = crypto_ablkcipher_tfm(crypto_ablkcipher_crt(tfm)->base); | |
| 1163 | −} | |
| 1164 | − | |
| 1165 | −static inline struct ablkcipher_request *ablkcipher_request_cast( | |
| 1166 | − struct crypto_async_request *req) | |
| 1167 | −{ | |
| 1168 | − return container_of(req, struct ablkcipher_request, base); | |
| 1169 | −} | |
| 1170 | − | |
| 1171 | −/** | |
| 1172 | − * ablkcipher_request_alloc() - allocate request data structure | |
| 1173 | − * @tfm: cipher handle to be registered with the request | |
| 1174 | − * @gfp: memory allocation flag that is handed to kmalloc by the API call. | |
| 1175 | − * | |
| 1176 | − * Allocate the request data structure that must be used with the ablkcipher | |
| 1177 | − * encrypt and decrypt API calls. During the allocation, the provided ablkcipher | |
| 1178 | − * handle is registered in the request data structure. | |
| 1179 | − * | |
| 1180 | − * Return: allocated request handle in case of success, or NULL if out of memory | |
| 1181 | − */ | |
| 1182 | −static inline struct ablkcipher_request *ablkcipher_request_alloc( | |
| 1183 | − struct crypto_ablkcipher *tfm, gfp_t gfp) | |
| 1184 | −{ | |
| 1185 | − struct ablkcipher_request *req; | |
| 1186 | − | |
| 1187 | − req = kmalloc(sizeof(struct ablkcipher_request) + | |
| 1188 | − crypto_ablkcipher_reqsize(tfm), gfp); | |
| 1189 | − | |
| 1190 | − if (likely(req)) | |
| 1191 | − ablkcipher_request_set_tfm(req, tfm); | |
| 1192 | − | |
| 1193 | − return req; | |
| 1194 | −} | |
| 1195 | − | |
| 1196 | −/** | |
| 1197 | − * ablkcipher_request_free() - zeroize and free request data structure | |
| 1198 | − * @req: request data structure cipher handle to be freed | |
| 1199 | − */ | |
| 1200 | −static inline void ablkcipher_request_free(struct ablkcipher_request *req) | |
| 1201 | −{ | |
| 1202 | − kzfree(req); | |
| 1203 | −} | |
| 1204 | − | |
| 1205 | −/** | |
| 1206 | − * ablkcipher_request_set_callback() - set asynchronous callback function | |
| 1207 | − * @req: request handle | |
| 1208 | − * @flags: specify zero or an ORing of the flags | |
| 1209 | − * CRYPTO_TFM_REQ_MAY_BACKLOG the request queue may back log and | |
| 1210 | − * increase the wait queue beyond the initial maximum size; | |
| 1211 | − * CRYPTO_TFM_REQ_MAY_SLEEP the request processing may sleep | |
| 1212 | − * @compl: callback function pointer to be registered with the request handle | |
| 1213 | − * @data: The data pointer refers to memory that is not used by the kernel | |
| 1214 | − * crypto API, but provided to the callback function for it to use. Here, | |
| 1215 | − * the caller can provide a reference to memory the callback function can | |
| 1216 | − * operate on. As the callback function is invoked asynchronously to the | |
| 1217 | − * related functionality, it may need to access data structures of the | |
| 1218 | − * related functionality which can be referenced using this pointer. The | |
| 1219 | − * callback function can access the memory via the "data" field in the | |
| 1220 | − * crypto_async_request data structure provided to the callback function. | |
| 1221 | − * | |
| 1222 | − * This function allows setting the callback function that is triggered once the | |
| 1223 | − * cipher operation completes. | |
| 1224 | − * | |
| 1225 | − * The callback function is registered with the ablkcipher_request handle and | |
| 1226 | − * must comply with the following template:: | |
| 1227 | − * | |
| 1228 | − * void callback_function(struct crypto_async_request *req, int error) | |
| 1229 | − */ | |
| 1230 | −static inline void ablkcipher_request_set_callback( | |
| 1231 | − struct ablkcipher_request *req, | |
| 1232 | − u32 flags, crypto_completion_t compl, void *data) | |
| 1233 | −{ | |
| 1234 | − req->base.complete = compl; | |
| 1235 | − req->base.data = data; | |
| 1236 | − req->base.flags = flags; | |
| 1237 | −} | |
| 1238 | − | |
| 1239 | −/** | |
| 1240 | − * ablkcipher_request_set_crypt() - set data buffers | |
| 1241 | − * @req: request handle | |
| 1242 | − * @src: source scatter / gather list | |
| 1243 | − * @dst: destination scatter / gather list | |
| 1244 | − * @nbytes: number of bytes to process from @src | |
| 1245 | − * @iv: IV for the cipher operation which must comply with the IV size defined | |
| 1246 | − * by crypto_ablkcipher_ivsize | |
| 1247 | − * | |
| 1248 | − * This function allows setting of the source data and destination data | |
| 1249 | − * scatter / gather lists. | |
| 1250 | − * | |
| 1251 | − * For encryption, the source is treated as the plaintext and the | |
| 1252 | − * destination is the ciphertext. For a decryption operation, the use is | |
| 1253 | − * reversed - the source is the ciphertext and the destination is the plaintext. | |
| 1254 | − */ | |
| 1255 | −static inline void ablkcipher_request_set_crypt( | |
| 1256 | − struct ablkcipher_request *req, | |
| 1257 | − struct scatterlist *src, struct scatterlist *dst, | |
| 1258 | − unsigned int nbytes, void *iv) | |
| 1259 | −{ | |
| 1260 | − req->src = src; | |
| 1261 | − req->dst = dst; | |
| 1262 | − req->nbytes = nbytes; | |
| 1263 | − req->info = iv; | |
| 1264 | −} | |
| 1265 | − | |
| 1266 | −/** | |
| 1267 | − * DOC: Synchronous Block Cipher API | |
| 1268 | − * | |
| 1269 | − * The synchronous block cipher API is used with the ciphers of type | |
| 1270 | − * CRYPTO_ALG_TYPE_BLKCIPHER (listed as type "blkcipher" in /proc/crypto) | |
| 1271 | − * | |
| 1272 | − * Synchronous calls, have a context in the tfm. But since a single tfm can be | |
| 1273 | − * used in multiple calls and in parallel, this info should not be changeable | |
| 1274 | − * (unless a lock is used). This applies, for example, to the symmetric key. | |
| 1275 | − * However, the IV is changeable, so there is an iv field in blkcipher_tfm | |
| 1276 | − * structure for synchronous blkcipher api. So, its the only state info that can | |
| 1277 | − * be kept for synchronous calls without using a big lock across a tfm. | |
| 1278 | − * | |
| 1279 | − * The block cipher API allows the use of a complete cipher, i.e. a cipher | |
| 1280 | − * consisting of a template (a block chaining mode) and a single block cipher | |
| 1281 | − * primitive (e.g. AES). | |
| 1282 | − * | |
| 1283 | − * The plaintext data buffer and the ciphertext data buffer are pointed to | |
| 1284 | − * by using scatter/gather lists. The cipher operation is performed | |
| 1285 | − * on all segments of the provided scatter/gather lists. | |
| 1286 | − * | |
| 1287 | − * The kernel crypto API supports a cipher operation "in-place" which means that | |
| 1288 | − * the caller may provide the same scatter/gather list for the plaintext and | |
| 1289 | − * cipher text. After the completion of the cipher operation, the plaintext | |
| 1290 | − * data is replaced with the ciphertext data in case of an encryption and vice | |
| 1291 | − * versa for a decryption. The caller must ensure that the scatter/gather lists | |
| 1292 | − * for the output data point to sufficiently large buffers, i.e. multiples of | |
| 1293 | − * the block size of the cipher. | |
| 1294 | − */ | |
| 1295 | − | |
| 1296 | −static inline struct crypto_blkcipher *__crypto_blkcipher_cast( | |
| 1297 | − struct crypto_tfm *tfm) | |
| 1298 | −{ | |
| 1299 | − return (struct crypto_blkcipher *)tfm; | |
| 1300 | −} | |
| 1301 | − | |
| 1302 | −static inline struct crypto_blkcipher *crypto_blkcipher_cast( | |
| 1303 | − struct crypto_tfm *tfm) | |
| 1304 | −{ | |
| 1305 | − BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_BLKCIPHER); | |
| 1306 | − return __crypto_blkcipher_cast(tfm); | |
| 1307 | −} | |
| 1308 | − | |
| 1309 | −/** | |
| 1310 | − * crypto_alloc_blkcipher() - allocate synchronous block cipher handle | |
| 1311 | − * @alg_name: is the cra_name / name or cra_driver_name / driver name of the | |
| 1312 | − * blkcipher cipher | |
| 1313 | − * @type: specifies the type of the cipher | |
| 1314 | − * @mask: specifies the mask for the cipher | |
| 1315 | − * | |
| 1316 | − * Allocate a cipher handle for a block cipher. The returned struct | |
| 1317 | − * crypto_blkcipher is the cipher handle that is required for any subsequent | |
| 1318 | − * API invocation for that block cipher. | |
| 1319 | − * | |
| 1320 | − * Return: allocated cipher handle in case of success; IS_ERR() is true in case | |
| 1321 | − * of an error, PTR_ERR() returns the error code. | |
| 1322 | − */ | |
| 1323 | −static inline struct crypto_blkcipher *crypto_alloc_blkcipher( | |
| 1324 | − const char *alg_name, u32 type, u32 mask) | |
| 1325 | −{ | |
| 1326 | − type &= ~CRYPTO_ALG_TYPE_MASK; | |
| 1327 | − type |= CRYPTO_ALG_TYPE_BLKCIPHER; | |
| 1328 | − mask |= CRYPTO_ALG_TYPE_MASK; | |
| 1329 | − | |
| 1330 | − return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask)); | |
| 1331 | −} | |
| 1332 | − | |
| 1333 | −static inline struct crypto_tfm *crypto_blkcipher_tfm( | |
| 1334 | − struct crypto_blkcipher *tfm) | |
| 1335 | −{ | |
| 1336 | − return &tfm->base; | |
| 1337 | −} | |
| 1338 | − | |
| 1339 | −/** | |
| 1340 | − * crypto_free_blkcipher() - zeroize and free the block cipher handle | |
| 1341 | − * @tfm: cipher handle to be freed | |
| 1342 | − */ | |
| 1343 | −static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm) | |
| 1344 | −{ | |
| 1345 | − crypto_free_tfm(crypto_blkcipher_tfm(tfm)); | |
| 1346 | −} | |
| 1347 | − | |
| 1348 | −/** | |
| 1349 | − * crypto_has_blkcipher() - Search for the availability of a block cipher | |
| 1350 | − * @alg_name: is the cra_name / name or cra_driver_name / driver name of the | |
| 1351 | − * block cipher | |
| 1352 | − * @type: specifies the type of the cipher | |
| 1353 | − * @mask: specifies the mask for the cipher | |
| 1354 | − * | |
| 1355 | − * Return: true when the block cipher is known to the kernel crypto API; false | |
| 1356 | − * otherwise | |
| 1357 | − */ | |
| 1358 | −static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask) | |
| 1359 | −{ | |
| 1360 | − type &= ~CRYPTO_ALG_TYPE_MASK; | |
| 1361 | − type |= CRYPTO_ALG_TYPE_BLKCIPHER; | |
| 1362 | − mask |= CRYPTO_ALG_TYPE_MASK; | |
| 1363 | − | |
| 1364 | − return crypto_has_alg(alg_name, type, mask); | |
| 1365 | −} | |
| 1366 | − | |
| 1367 | −/** | |
| 1368 | − * crypto_blkcipher_name() - return the name / cra_name from the cipher handle | |
| 1369 | − * @tfm: cipher handle | |
| 1370 | − * | |
| 1371 | − * Return: The character string holding the name of the cipher | |
| 1372 | − */ | |
| 1373 | −static inline const char *crypto_blkcipher_name(struct crypto_blkcipher *tfm) | |
| 1374 | −{ | |
| 1375 | − return crypto_tfm_alg_name(crypto_blkcipher_tfm(tfm)); | |
| 1376 | −} | |
| 1377 | − | |
| 1378 | −static inline struct blkcipher_tfm *crypto_blkcipher_crt( | |
| 1379 | − struct crypto_blkcipher *tfm) | |
| 1380 | −{ | |
| 1381 | − return &crypto_blkcipher_tfm(tfm)->crt_blkcipher; | |
| 1382 | −} | |
| 1383 | − | |
| 1384 | −static inline struct blkcipher_alg *crypto_blkcipher_alg( | |
| 1385 | − struct crypto_blkcipher *tfm) | |
| 1386 | −{ | |
| 1387 | − return &crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher; | |
| 1388 | −} | |
| 1389 | − | |
| 1390 | −/** | |
| 1391 | − * crypto_blkcipher_ivsize() - obtain IV size | |
| 1392 | − * @tfm: cipher handle | |
| 1393 | − * | |
| 1394 | − * The size of the IV for the block cipher referenced by the cipher handle is | |
| 1395 | − * returned. This IV size may be zero if the cipher does not need an IV. | |
| 1396 | − * | |
| 1397 | − * Return: IV size in bytes | |
| 1398 | − */ | |
| 1399 | −static inline unsigned int crypto_blkcipher_ivsize(struct crypto_blkcipher *tfm) | |
| 1400 | −{ | |
| 1401 | − return crypto_blkcipher_alg(tfm)->ivsize; | |
| 1402 | −} | |
| 1403 | − | |
| 1404 | −/** | |
| 1405 | − * crypto_blkcipher_blocksize() - obtain block size of cipher | |
| 1406 | − * @tfm: cipher handle | |
| 1407 | − * | |
| 1408 | − * The block size for the block cipher referenced with the cipher handle is | |
| 1409 | − * returned. The caller may use that information to allocate appropriate | |
| 1410 | − * memory for the data returned by the encryption or decryption operation. | |
| 1411 | − * | |
| 1412 | − * Return: block size of cipher | |
| 1413 | − */ | |
| 1414 | −static inline unsigned int crypto_blkcipher_blocksize( | |
| 1415 | − struct crypto_blkcipher *tfm) | |
| 1416 | −{ | |
| 1417 | − return crypto_tfm_alg_blocksize(crypto_blkcipher_tfm(tfm)); | |
| 1418 | −} | |
| 1419 | − | |
| 1420 | −static inline unsigned int crypto_blkcipher_alignmask( | |
| 1421 | − struct crypto_blkcipher *tfm) | |
| 1422 | −{ | |
| 1423 | − return crypto_tfm_alg_alignmask(crypto_blkcipher_tfm(tfm)); | |
| 1424 | −} | |
| 1425 | − | |
| 1426 | −static inline u32 crypto_blkcipher_get_flags(struct crypto_blkcipher *tfm) | |
| 1427 | −{ | |
| 1428 | − return crypto_tfm_get_flags(crypto_blkcipher_tfm(tfm)); | |
| 1429 | −} | |
| 1430 | − | |
| 1431 | −static inline void crypto_blkcipher_set_flags(struct crypto_blkcipher *tfm, | |
| 1432 | − u32 flags) | |
| 1433 | −{ | |
| 1434 | − crypto_tfm_set_flags(crypto_blkcipher_tfm(tfm), flags); | |
| 1435 | −} | |
| 1436 | − | |
| 1437 | −static inline void crypto_blkcipher_clear_flags(struct crypto_blkcipher *tfm, | |
| 1438 | − u32 flags) | |
| 1439 | −{ | |
| 1440 | − crypto_tfm_clear_flags(crypto_blkcipher_tfm(tfm), flags); | |
| 1441 | −} | |
| 1442 | − | |
| 1443 | −/** | |
| 1444 | − * crypto_blkcipher_setkey() - set key for cipher | |
| 1445 | − * @tfm: cipher handle | |
| 1446 | − * @key: buffer holding the key | |
| 1447 | − * @keylen: length of the key in bytes | |
| 1448 | − * | |
| 1449 | − * The caller provided key is set for the block cipher referenced by the cipher | |
| 1450 | − * handle. | |
| 1451 | − * | |
| 1452 | − * Note, the key length determines the cipher type. Many block ciphers implement | |
| 1453 | − * different cipher modes depending on the key size, such as AES-128 vs AES-192 | |
| 1454 | − * vs. AES-256. When providing a 16 byte key for an AES cipher handle, AES-128 | |
| 1455 | − * is performed. | |
| 1456 | − * | |
| 1457 | − * Return: 0 if the setting of the key was successful; < 0 if an error occurred | |
| 1458 | − */ | |
| 1459 | −static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm, | |
| 1460 | − const u8 *key, unsigned int keylen) | |
| 1461 | −{ | |
| 1462 | − return crypto_blkcipher_crt(tfm)->setkey(crypto_blkcipher_tfm(tfm), | |
| 1463 | − key, keylen); | |
| 1464 | −} | |
| 1465 | − | |
| 1466 | −/** | |
| 1467 | − * crypto_blkcipher_encrypt() - encrypt plaintext | |
| 1468 | − * @desc: reference to the block cipher handle with meta data | |
| 1469 | − * @dst: scatter/gather list that is filled by the cipher operation with the | |
| 1470 | − * ciphertext | |
| 1471 | − * @src: scatter/gather list that holds the plaintext | |
| 1472 | − * @nbytes: number of bytes of the plaintext to encrypt. | |
| 1473 | − * | |
| 1474 | − * Encrypt plaintext data using the IV set by the caller with a preceding | |
| 1475 | − * call of crypto_blkcipher_set_iv. | |
| 1476 | − * | |
| 1477 | − * The blkcipher_desc data structure must be filled by the caller and can | |
| 1478 | − * reside on the stack. The caller must fill desc as follows: desc.tfm is filled | |
| 1479 | − * with the block cipher handle; desc.flags is filled with either | |
| 1480 | − * CRYPTO_TFM_REQ_MAY_SLEEP or 0. | |
| 1481 | − * | |
| 1482 | − * Return: 0 if the cipher operation was successful; < 0 if an error occurred | |
| 1483 | − */ | |
| 1484 | −static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc, | |
| 1485 | − struct scatterlist *dst, | |
| 1486 | − struct scatterlist *src, | |
| 1487 | − unsigned int nbytes) | |
| 1488 | −{ | |
| 1489 | − desc->info = crypto_blkcipher_crt(desc->tfm)->iv; | |
| 1490 | − return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes); | |
| 1491 | −} | |
| 1492 | − | |
| 1493 | −/** | |
| 1494 | − * crypto_blkcipher_encrypt_iv() - encrypt plaintext with dedicated IV | |
| 1495 | − * @desc: reference to the block cipher handle with meta data | |
| 1496 | − * @dst: scatter/gather list that is filled by the cipher operation with the | |
| 1497 | − * ciphertext | |
| 1498 | − * @src: scatter/gather list that holds the plaintext | |
| 1499 | − * @nbytes: number of bytes of the plaintext to encrypt. | |
| 1500 | − * | |
| 1501 | − * Encrypt plaintext data with the use of an IV that is solely used for this | |
| 1502 | − * cipher operation. Any previously set IV is not used. | |
| 1503 | − * | |
| 1504 | − * The blkcipher_desc data structure must be filled by the caller and can | |
| 1505 | − * reside on the stack. The caller must fill desc as follows: desc.tfm is filled | |
| 1506 | − * with the block cipher handle; desc.info is filled with the IV to be used for | |
| 1507 | − * the current operation; desc.flags is filled with either | |
| 1508 | − * CRYPTO_TFM_REQ_MAY_SLEEP or 0. | |
| 1509 | − * | |
| 1510 | − * Return: 0 if the cipher operation was successful; < 0 if an error occurred | |
| 1511 | − */ | |
| 1512 | −static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc, | |
| 1513 | − struct scatterlist *dst, | |
| 1514 | − struct scatterlist *src, | |
| 1515 | − unsigned int nbytes) | |
| 1516 | −{ | |
| 1517 | − return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes); | |
| 1518 | −} | |
| 1519 | − | |
| 1520 | −/** | |
| 1521 | − * crypto_blkcipher_decrypt() - decrypt ciphertext | |
| 1522 | − * @desc: reference to the block cipher handle with meta data | |
| 1523 | − * @dst: scatter/gather list that is filled by the cipher operation with the | |
| 1524 | − * plaintext | |
| 1525 | − * @src: scatter/gather list that holds the ciphertext | |
| 1526 | − * @nbytes: number of bytes of the ciphertext to decrypt. | |
| 1527 | − * | |
| 1528 | − * Decrypt ciphertext data using the IV set by the caller with a preceding | |
| 1529 | − * call of crypto_blkcipher_set_iv. | |
| 1530 | − * | |
| 1531 | − * The blkcipher_desc data structure must be filled by the caller as documented | |
| 1532 | − * for the crypto_blkcipher_encrypt call above. | |
| 1533 | − * | |
| 1534 | − * Return: 0 if the cipher operation was successful; < 0 if an error occurred | |
| 1535 | − * | |
| 1536 | − */ | |
| 1537 | −static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc, | |
| 1538 | − struct scatterlist *dst, | |
| 1539 | − struct scatterlist *src, | |
| 1540 | − unsigned int nbytes) | |
| 1541 | −{ | |
| 1542 | − desc->info = crypto_blkcipher_crt(desc->tfm)->iv; | |
| 1543 | − return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes); | |
| 1544 | −} | |
| 1545 | − | |
| 1546 | −/** | |
| 1547 | − * crypto_blkcipher_decrypt_iv() - decrypt ciphertext with dedicated IV | |
| 1548 | − * @desc: reference to the block cipher handle with meta data | |
| 1549 | − * @dst: scatter/gather list that is filled by the cipher operation with the | |
| 1550 | − * plaintext | |
| 1551 | − * @src: scatter/gather list that holds the ciphertext | |
| 1552 | − * @nbytes: number of bytes of the ciphertext to decrypt. | |
| 1553 | − * | |
| 1554 | − * Decrypt ciphertext data with the use of an IV that is solely used for this | |
| 1555 | − * cipher operation. Any previously set IV is not used. | |
| 1556 | − * | |
| 1557 | − * The blkcipher_desc data structure must be filled by the caller as documented | |
| 1558 | − * for the crypto_blkcipher_encrypt_iv call above. | |
| 1559 | − * | |
| 1560 | − * Return: 0 if the cipher operation was successful; < 0 if an error occurred | |
| 1561 | − */ | |
| 1562 | −static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc, | |
| 1563 | − struct scatterlist *dst, | |
| 1564 | − struct scatterlist *src, | |
| 1565 | − unsigned int nbytes) | |
| 1566 | −{ | |
| 1567 | − return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes); | |
| 1568 | −} | |
| 1569 | − | |
| 1570 | −/** | |
| 1571 | − * crypto_blkcipher_set_iv() - set IV for cipher | |
| 1572 | − * @tfm: cipher handle | |
| 1573 | − * @src: buffer holding the IV | |
| 1574 | − * @len: length of the IV in bytes | |
| 1575 | − * | |
| 1576 | − * The caller provided IV is set for the block cipher referenced by the cipher | |
| 1577 | − * handle. | |
| 1578 | − */ | |
| 1579 | −static inline void crypto_blkcipher_set_iv(struct crypto_blkcipher *tfm, | |
| 1580 | − const u8 *src, unsigned int len) | |
| 1581 | −{ | |
| 1582 | − memcpy(crypto_blkcipher_crt(tfm)->iv, src, len); | |
| 1583 | −} | |
| 1584 | − | |
| 1585 | −/** | |
| 1586 | − * crypto_blkcipher_get_iv() - obtain IV from cipher | |
| 1587 | − * @tfm: cipher handle | |
| 1588 | − * @dst: buffer filled with the IV | |
| 1589 | − * @len: length of the buffer dst | |
| 1590 | − * | |
| 1591 | − * The caller can obtain the IV set for the block cipher referenced by the | |
| 1592 | − * cipher handle and store it into the user-provided buffer. If the buffer | |
| 1593 | − * has an insufficient space, the IV is truncated to fit the buffer. | |
| 1594 | − */ | |
| 1595 | −static inline void crypto_blkcipher_get_iv(struct crypto_blkcipher *tfm, | |
| 1596 | − u8 *dst, unsigned int len) | |
| 1597 | −{ | |
| 1598 | − memcpy(dst, crypto_blkcipher_crt(tfm)->iv, len); | |
| 1599 | −} | |
| 1600 | − | |
| 1601 | 744 | /** |
| 1602 | 745 | * DOC: Single Block Cipher API |
| 1603 | 746 | * |
| @@ -440,6 +440,11 @@ static inline bool d_is_negative(const struct dentry *dentry) · 439 unmodified lines | ||
| 440 | 440 | return d_is_miss(dentry); |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | +static inline bool d_flags_negative(unsigned flags) | |
| 444 | +{ | |
| 445 | + return (flags & DCACHE_ENTRY_TYPE) == DCACHE_MISS_TYPE; | |
| 446 | +} | |
| 447 | + | |
| 443 | 448 | static inline bool d_is_positive(const struct dentry *dentry) |
| 444 | 449 | { |
| 445 | 450 | return !d_is_negative(dentry); |
| @@ -54,6 +54,8 @@ static const struct file_operations __fops = { \ · 53 unmodified lines | ||
| 54 | 54 | .llseek = no_llseek, \ |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | +typedef struct vfsmount *(*debugfs_automount_t)(struct dentry *, void *); | |
| 58 | + | |
| 57 | 59 | #if defined(CONFIG_DEBUG_FS) |
| 58 | 60 | |
| 59 | 61 | struct dentry *debugfs_lookup(const char *name, struct dentry *parent); |
| @@ -75,7 +77,6 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); · 15 unmodified lines | ||
| 75 | 77 | struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, |
| 76 | 78 | const char *dest); |
| 77 | 79 | |
| 78 | −typedef struct vfsmount *(*debugfs_automount_t)(struct dentry *, void *); | |
| 79 | 80 | struct dentry *debugfs_create_automount(const char *name, |
| 80 | 81 | struct dentry *parent, |
| 81 | 82 | debugfs_automount_t f, |
| @@ -97,28 +98,28 @@ ssize_t debugfs_attr_write(struct file *file, const char __user *buf, · 15 unmodified lines | ||
| 97 | 98 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, |
| 98 | 99 | struct dentry *new_dir, const char *new_name); |
| 99 | 100 | |
| 100 | −struct dentry *debugfs_create_u8(const char *name, umode_t mode, | |
| 101 | − struct dentry *parent, u8 *value); | |
| 102 | −struct dentry *debugfs_create_u16(const char *name, umode_t mode, | |
| 103 | − struct dentry *parent, u16 *value); | |
| 101 | +void debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent, | |
| 102 | + u8 *value); | |
| 103 | +void debugfs_create_u16(const char *name, umode_t mode, struct dentry *parent, | |
| 104 | + u16 *value); | |
| 104 | 105 | struct dentry *debugfs_create_u32(const char *name, umode_t mode, |
| 105 | 106 | struct dentry *parent, u32 *value); |
| 106 | −struct dentry *debugfs_create_u64(const char *name, umode_t mode, | |
| 107 | − struct dentry *parent, u64 *value); | |
| 107 | +void debugfs_create_u64(const char *name, umode_t mode, struct dentry *parent, | |
| 108 | + u64 *value); | |
| 108 | 109 | struct dentry *debugfs_create_ulong(const char *name, umode_t mode, |
| 109 | 110 | struct dentry *parent, unsigned long *value); |
| 110 | −struct dentry *debugfs_create_x8(const char *name, umode_t mode, | |
| 111 | − struct dentry *parent, u8 *value); | |
| 112 | −struct dentry *debugfs_create_x16(const char *name, umode_t mode, | |
| 113 | − struct dentry *parent, u16 *value); | |
| 114 | −struct dentry *debugfs_create_x32(const char *name, umode_t mode, | |
| 115 | − struct dentry *parent, u32 *value); | |
| 116 | −struct dentry *debugfs_create_x64(const char *name, umode_t mode, | |
| 117 | − struct dentry *parent, u64 *value); | |
| 118 | −struct dentry *debugfs_create_size_t(const char *name, umode_t mode, | |
| 119 | − struct dentry *parent, size_t *value); | |
| 120 | −struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode, | |
| 121 | − struct dentry *parent, atomic_t *value); | |
| 111 | +void debugfs_create_x8(const char *name, umode_t mode, struct dentry *parent, | |
| 112 | + u8 *value); | |
| 113 | +void debugfs_create_x16(const char *name, umode_t mode, struct dentry *parent, | |
| 114 | + u16 *value); | |
| 115 | +void debugfs_create_x32(const char *name, umode_t mode, struct dentry *parent, | |
| 116 | + u32 *value); | |
| 117 | +void debugfs_create_x64(const char *name, umode_t mode, struct dentry *parent, | |
| 118 | + u64 *value); | |
| 119 | +void debugfs_create_size_t(const char *name, umode_t mode, | |
| 120 | + struct dentry *parent, size_t *value); | |
| 121 | +void debugfs_create_atomic_t(const char *name, umode_t mode, | |
| 122 | + struct dentry *parent, atomic_t *value); | |
| 122 | 123 | struct dentry *debugfs_create_bool(const char *name, umode_t mode, |
| 123 | 124 | struct dentry *parent, bool *value); |
| 124 | 125 | |
| @@ -203,7 +204,7 @@ static inline struct dentry *debugfs_create_symlink(const char *name, · 78 unmodified lines | ||
| 203 | 204 | |
| 204 | 205 | static inline struct dentry *debugfs_create_automount(const char *name, |
| 205 | 206 | struct dentry *parent, |
| 206 | − struct vfsmount *(*f)(void *), | |
| 207 | + debugfs_automount_t f, | |
| 207 | 208 | void *data) |
| 208 | 209 | { |
| 209 | 210 | return ERR_PTR(-ENODEV); |
| @@ -244,19 +245,11 @@ static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentr · 34 unmodified lines | ||
| 244 | 245 | return ERR_PTR(-ENODEV); |
| 245 | 246 | } |
| 246 | 247 | |
| 247 | −static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode, | |
| 248 | − struct dentry *parent, | |
| 249 | − u8 *value) | |
| 250 | −{ | |
| 251 | − return ERR_PTR(-ENODEV); | |
| 252 | −} | |
| 248 | +static inline void debugfs_create_u8(const char *name, umode_t mode, | |
| 249 | + struct dentry *parent, u8 *value) { } | |
| 253 | 250 | |
| 254 | −static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode, | |
| 255 | − struct dentry *parent, | |
| 256 | − u16 *value) | |
| 257 | −{ | |
| 258 | − return ERR_PTR(-ENODEV); | |
| 259 | −} | |
| 251 | +static inline void debugfs_create_u16(const char *name, umode_t mode, | |
| 252 | + struct dentry *parent, u16 *value) { } | |
| 260 | 253 | |
| 261 | 254 | static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode, |
| 262 | 255 | struct dentry *parent, |
| @@ -265,12 +258,8 @@ static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode, · 2 unmodified lines | ||
| 265 | 258 | return ERR_PTR(-ENODEV); |
| 266 | 259 | } |
| 267 | 260 | |
| 268 | −static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode, | |
| 269 | − struct dentry *parent, | |
| 270 | − u64 *value) | |
| 271 | −{ | |
| 272 | − return ERR_PTR(-ENODEV); | |
| 273 | −} | |
| 261 | +static inline void debugfs_create_u64(const char *name, umode_t mode, | |
| 262 | + struct dentry *parent, u64 *value) { } | |
| 274 | 263 | |
| 275 | 264 | static inline struct dentry *debugfs_create_ulong(const char *name, |
| 276 | 265 | umode_t mode, |
| @@ -280,46 +269,26 @@ static inline struct dentry *debugfs_create_ulong(const char *name, · 3 unmodified lines | ||
| 280 | 269 | return ERR_PTR(-ENODEV); |
| 281 | 270 | } |
| 282 | 271 | |
| 283 | −static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode, | |
| 284 | − struct dentry *parent, | |
| 285 | − u8 *value) | |
| 286 | −{ | |
| 287 | − return ERR_PTR(-ENODEV); | |
| 288 | −} | |
| 272 | +static inline void debugfs_create_x8(const char *name, umode_t mode, | |
| 273 | + struct dentry *parent, u8 *value) { } | |
| 289 | 274 | |
| 290 | −static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode, | |
| 291 | − struct dentry *parent, | |
| 292 | − u16 *value) | |
| 293 | −{ | |
| 294 | − return ERR_PTR(-ENODEV); | |
| 295 | −} | |
| 275 | +static inline void debugfs_create_x16(const char *name, umode_t mode, | |
| 276 | + struct dentry *parent, u16 *value) { } | |
| 296 | 277 | |
| 297 | −static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode, | |
| 298 | − struct dentry *parent, | |
| 299 | − u32 *value) | |
| 300 | −{ | |
| 301 | − return ERR_PTR(-ENODEV); | |
| 302 | −} | |
| 278 | +static inline void debugfs_create_x32(const char *name, umode_t mode, | |
| 279 | + struct dentry *parent, u32 *value) { } | |
| 303 | 280 | |
| 304 | −static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode, | |
| 305 | − struct dentry *parent, | |
| 306 | − u64 *value) | |
| 307 | −{ | |
| 308 | − return ERR_PTR(-ENODEV); | |
| 309 | −} | |
| 281 | +static inline void debugfs_create_x64(const char *name, umode_t mode, | |
| 282 | + struct dentry *parent, u64 *value) { } | |
| 310 | 283 | |
| 311 | −static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode, | |
| 312 | − struct dentry *parent, | |
| 313 | − size_t *value) | |
| 314 | −{ | |
| 315 | − return ERR_PTR(-ENODEV); | |
| 316 | −} | |
| 284 | +static inline void debugfs_create_size_t(const char *name, umode_t mode, | |
| 285 | + struct dentry *parent, size_t *value) | |
| 286 | +{ } | |
| 317 | 287 | |
| 318 | −static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode, | |
| 319 | − struct dentry *parent, atomic_t *value) | |
| 320 | −{ | |
| 321 | − return ERR_PTR(-ENODEV); | |
| 322 | −} | |
| 288 | +static inline void debugfs_create_atomic_t(const char *name, umode_t mode, | |
| 289 | + struct dentry *parent, | |
| 290 | + atomic_t *value) | |
| 291 | +{ } | |
| 323 | 292 | |
| 324 | 293 | static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode, |
| 325 | 294 | struct dentry *parent, |
| @@ -383,4 +352,25 @@ static inline ssize_t debugfs_write_file_bool(struct file *file, · 57 unmodified lines | ||
| 383 | 352 | |
| 384 | 353 | #endif |
| 385 | 354 | |
| 355 | +/** | |
| 356 | + * debugfs_create_xul - create a debugfs file that is used to read and write an | |
| 357 | + * unsigned long value, formatted in hexadecimal | |
| 358 | + * @name: a pointer to a string containing the name of the file to create. | |
| 359 | + * @mode: the permission that the file should have | |
| 360 | + * @parent: a pointer to the parent dentry for this file. This should be a | |
| 361 | + * directory dentry if set. If this parameter is %NULL, then the | |
| 362 | + * file will be created in the root of the debugfs filesystem. | |
| 363 | + * @value: a pointer to the variable that the file should read to and write | |
| 364 | + * from. | |
| 365 | + */ | |
| 366 | +static inline void debugfs_create_xul(const char *name, umode_t mode, | |
| 367 | + struct dentry *parent, | |
| 368 | + unsigned long *value) | |
| 369 | +{ | |
| 370 | + if (sizeof(*value) == sizeof(u32)) | |
| 371 | + debugfs_create_x32(name, mode, parent, (u32 *)value); | |
| 372 | + else | |
| 373 | + debugfs_create_x64(name, mode, parent, (u64 *)value); | |
| 374 | +} | |
| 375 | + | |
| 386 | 376 | #endif |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/device.h> |
| 14 | 14 | #include <linux/notifier.h> |
| 15 | 15 | #include <linux/pm_opp.h> |
| 16 | +#include <linux/pm_qos.h> | |
| 16 | 17 | |
| 17 | 18 | #define DEVFREQ_NAME_LEN 16 |
| 18 | 19 | |
| @@ -123,8 +124,8 @@ struct devfreq_dev_profile { · 104 unmodified lines | ||
| 123 | 124 | * @previous_freq: previously configured frequency value. |
| 124 | 125 | * @data: Private data of the governor. The devfreq framework does not |
| 125 | 126 | * touch this. |
| 126 | − * @min_freq: Limit minimum frequency requested by user (0: none) | |
| 127 | − * @max_freq: Limit maximum frequency requested by user (0: none) | |
| 127 | + * @user_min_freq_req: PM QoS minimum frequency request from user (via sysfs) | |
| 128 | + * @user_max_freq_req: PM QoS maximum frequency request from user (via sysfs) | |
| 128 | 129 | * @scaling_min_freq: Limit minimum frequency requested by OPP interface |
| 129 | 130 | * @scaling_max_freq: Limit maximum frequency requested by OPP interface |
| 130 | 131 | * @stop_polling: devfreq polling status of a device. |
| @@ -136,6 +137,8 @@ struct devfreq_dev_profile { · 5 unmodified lines | ||
| 136 | 137 | * @time_in_state: Statistics of devfreq states |
| 137 | 138 | * @last_stat_updated: The last time stat updated |
| 138 | 139 | * @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier |
| 140 | + * @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY | |
| 141 | + * @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY | |
| 139 | 142 | * |
| 140 | 143 | * This structure stores the devfreq information for a give device. |
| 141 | 144 | * |
| @@ -161,8 +164,8 @@ struct devfreq { · 19 unmodified lines | ||
| 161 | 164 | |
| 162 | 165 | void *data; /* private data for governors */ |
| 163 | 166 | |
| 164 | − unsigned long min_freq; | |
| 165 | − unsigned long max_freq; | |
| 167 | + struct dev_pm_qos_request user_min_freq_req; | |
| 168 | + struct dev_pm_qos_request user_max_freq_req; | |
| 166 | 169 | unsigned long scaling_min_freq; |
| 167 | 170 | unsigned long scaling_max_freq; |
| 168 | 171 | bool stop_polling; |
| @@ -178,6 +181,9 @@ struct devfreq { · 9 unmodified lines | ||
| 178 | 181 | unsigned long last_stat_updated; |
| 179 | 182 | |
| 180 | 183 | struct srcu_notifier_head transition_notifier_list; |
| 184 | + | |
| 185 | + struct notifier_block nb_min; | |
| 186 | + struct notifier_block nb_max; | |
| 181 | 187 | }; |
| 182 | 188 | |
| 183 | 189 | struct devfreq_freqs { |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | struct dm_dev; |
| 18 | 18 | struct dm_target; |
| 19 | 19 | struct dm_table; |
| 20 | +struct dm_report_zones_args; | |
| 20 | 21 | struct mapped_device; |
| 21 | 22 | struct bio_vec; |
| 22 | 23 | |
| @@ -93,9 +94,9 @@ typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv, · 70 unmodified lines | ||
| 93 | 94 | |
| 94 | 95 | typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, struct block_device **bdev); |
| 95 | 96 | |
| 96 | −typedef int (*dm_report_zones_fn) (struct dm_target *ti, sector_t sector, | |
| 97 | − struct blk_zone *zones, | |
| 98 | − unsigned int *nr_zones); | |
| 97 | +typedef int (*dm_report_zones_fn) (struct dm_target *ti, | |
| 98 | + struct dm_report_zones_args *args, | |
| 99 | + unsigned int nr_zones); | |
| 99 | 100 | |
| 100 | 101 | /* |
| 101 | 102 | * These iteration functions are typically used to check (and combine) |
| @@ -422,10 +423,23 @@ struct gendisk *dm_disk(struct mapped_device *md); · 320 unmodified lines | ||
| 422 | 423 | int dm_suspended(struct dm_target *ti); |
| 423 | 424 | int dm_noflush_suspending(struct dm_target *ti); |
| 424 | 425 | void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors); |
| 425 | −void dm_remap_zone_report(struct dm_target *ti, sector_t start, | |
| 426 | − struct blk_zone *zones, unsigned int *nr_zones); | |
| 427 | 426 | union map_info *dm_get_rq_mapinfo(struct request *rq); |
| 428 | 427 | |
| 428 | +#ifdef CONFIG_BLK_DEV_ZONED | |
| 429 | +struct dm_report_zones_args { | |
| 430 | + struct dm_target *tgt; | |
| 431 | + sector_t next_sector; | |
| 432 | + | |
| 433 | + void *orig_data; | |
| 434 | + report_zones_cb orig_cb; | |
| 435 | + unsigned int zone_idx; | |
| 436 | + | |
| 437 | + /* must be filled by ->report_zones before calling dm_report_zones_cb */ | |
| 438 | + sector_t start; | |
| 439 | +}; | |
| 440 | +int dm_report_zones_cb(struct blk_zone *zone, unsigned int idx, void *data); | |
| 441 | +#endif /* CONFIG_BLK_DEV_ZONED */ | |
| 442 | + | |
| 429 | 443 | /* |
| 430 | 444 | * Device mapper functions to parse and create devices specified by the |
| 431 | 445 | * parameter "dm-mod.create=" |
| @@ -594,9 +608,6 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · 162 unmodified lines | ||
| 594 | 608 | */ |
| 595 | 609 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) |
| 596 | 610 | |
| 597 | −#define dm_array_too_big(fixed, obj, num) \ | |
| 598 | − ((num) > (UINT_MAX - (fixed)) / (obj)) | |
| 599 | − | |
| 600 | 611 | /* |
| 601 | 612 | * Sector offset taken relative to the start of the target instead of |
| 602 | 613 | * relative to the start of the device. |
| @@ -80,6 +80,13 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *); · 79 unmodified lines | ||
| 80 | 80 | * that generate uevents to add the environment variables. |
| 81 | 81 | * @probe: Called when a new device or driver add to this bus, and callback |
| 82 | 82 | * the specific driver's probe to initial the matched device. |
| 83 | + * @sync_state: Called to sync device state to software state after all the | |
| 84 | + * state tracking consumers linked to this device (present at | |
| 85 | + * the time of late_initcall) have successfully bound to a | |
| 86 | + * driver. If the device has no consumers, this function will | |
| 87 | + * be called at late_initcall_sync level. If the device has | |
| 88 | + * consumers that are never bound to a driver, this function | |
| 89 | + * will never get called until they do. | |
| 83 | 90 | * @remove: Called when a device removed from this bus. |
| 84 | 91 | * @shutdown: Called at shut-down time to quiesce the device. |
| 85 | 92 | * |
| @@ -123,6 +130,7 @@ struct bus_type { · 37 unmodified lines | ||
| 123 | 130 | int (*match)(struct device *dev, struct device_driver *drv); |
| 124 | 131 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
| 125 | 132 | int (*probe)(struct device *dev); |
| 133 | + void (*sync_state)(struct device *dev); | |
| 126 | 134 | int (*remove)(struct device *dev); |
| 127 | 135 | void (*shutdown)(struct device *dev); |
| 128 | 136 | |
| @@ -340,6 +348,13 @@ enum probe_type { · 211 unmodified lines | ||
| 340 | 348 | * @probe: Called to query the existence of a specific device, |
| 341 | 349 | * whether this driver can work with it, and bind the driver |
| 342 | 350 | * to a specific device. |
| 351 | + * @sync_state: Called to sync device state to software state after all the | |
| 352 | + * state tracking consumers linked to this device (present at | |
| 353 | + * the time of late_initcall) have successfully bound to a | |
| 354 | + * driver. If the device has no consumers, this function will | |
| 355 | + * be called at late_initcall_sync level. If the device has | |
| 356 | + * consumers that are never bound to a driver, this function | |
| 357 | + * will never get called until they do. | |
| 343 | 358 | * @remove: Called when the device is removed from the system to |
| 344 | 359 | * unbind a device from this driver. |
| 345 | 360 | * @shutdown: Called at shut-down time to quiesce the device. |
| @@ -379,6 +394,7 @@ struct device_driver { · 33 unmodified lines | ||
| 379 | 394 | const struct acpi_device_id *acpi_match_table; |
| 380 | 395 | |
| 381 | 396 | int (*probe) (struct device *dev); |
| 397 | + void (*sync_state)(struct device *dev); | |
| 382 | 398 | int (*remove) (struct device *dev); |
| 383 | 399 | void (*shutdown) (struct device *dev); |
| 384 | 400 | int (*suspend) (struct device *dev, pm_message_t state); |
| @@ -946,6 +962,8 @@ extern void devm_free_pages(struct device *dev, unsigned long addr); · 561 unmodified lines | ||
| 946 | 962 | |
| 947 | 963 | void __iomem *devm_ioremap_resource(struct device *dev, |
| 948 | 964 | const struct resource *res); |
| 965 | +void __iomem *devm_ioremap_resource_wc(struct device *dev, | |
| 966 | + const struct resource *res); | |
| 949 | 967 | |
| 950 | 968 | void __iomem *devm_of_iomap(struct device *dev, |
| 951 | 969 | struct device_node *node, int index, |
| @@ -1080,6 +1098,7 @@ enum device_link_state { · 128 unmodified lines | ||
| 1080 | 1098 | * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind. |
| 1081 | 1099 | * AUTOPROBE_CONSUMER: Probe consumer driver automatically after supplier binds. |
| 1082 | 1100 | * MANAGED: The core tracks presence of supplier/consumer drivers (internal). |
| 1101 | + * SYNC_STATE_ONLY: Link only affects sync_state() behavior. | |
| 1083 | 1102 | */ |
| 1084 | 1103 | #define DL_FLAG_STATELESS BIT(0) |
| 1085 | 1104 | #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1) |
| @@ -1088,6 +1107,7 @@ enum device_link_state { · 2 unmodified lines | ||
| 1088 | 1107 | #define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4) |
| 1089 | 1108 | #define DL_FLAG_AUTOPROBE_CONSUMER BIT(5) |
| 1090 | 1109 | #define DL_FLAG_MANAGED BIT(6) |
| 1110 | +#define DL_FLAG_SYNC_STATE_ONLY BIT(7) | |
| 1091 | 1111 | |
| 1092 | 1112 | /** |
| 1093 | 1113 | * struct device_link - Device link representation. |
| @@ -1135,11 +1155,18 @@ enum dl_dev_state { · 41 unmodified lines | ||
| 1135 | 1155 | * struct dev_links_info - Device data related to device links. |
| 1136 | 1156 | * @suppliers: List of links to supplier devices. |
| 1137 | 1157 | * @consumers: List of links to consumer devices. |
| 1158 | + * @needs_suppliers: Hook to global list of devices waiting for suppliers. | |
| 1159 | + * @defer_sync: Hook to global list of devices that have deferred sync_state. | |
| 1160 | + * @need_for_probe: If needs_suppliers is on a list, this indicates if the | |
| 1161 | + * suppliers are needed for probe or not. | |
| 1138 | 1162 | * @status: Driver status information. |
| 1139 | 1163 | */ |
| 1140 | 1164 | struct dev_links_info { |
| 1141 | 1165 | struct list_head suppliers; |
| 1142 | 1166 | struct list_head consumers; |
| 1167 | + struct list_head needs_suppliers; | |
| 1168 | + struct list_head defer_sync; | |
| 1169 | + bool need_for_probe; | |
| 1143 | 1170 | enum dl_dev_state status; |
| 1144 | 1171 | }; |
| 1145 | 1172 | |
| @@ -1186,8 +1213,8 @@ struct dev_links_info { · 40 unmodified lines | ||
| 1186 | 1213 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all |
| 1187 | 1214 | * hardware supports 64-bit addresses for consistent allocations |
| 1188 | 1215 | * such descriptors. |
| 1189 | − * @bus_dma_mask: Mask of an upstream bridge or bus which imposes a smaller DMA | |
| 1190 | − * limit than the device itself supports. | |
| 1216 | + * @bus_dma_limit: Limit of an upstream bridge or bus which imposes a smaller | |
| 1217 | + * DMA limit than the device itself supports. | |
| 1191 | 1218 | * @dma_pfn_offset: offset of DMA memory range relatively of RAM |
| 1192 | 1219 | * @dma_parms: A low level driver may set these to teach IOMMU code about |
| 1193 | 1220 | * segment limitations. |
| @@ -1215,6 +1242,9 @@ struct dev_links_info { · 21 unmodified lines | ||
| 1215 | 1242 | * @offline: Set after successful invocation of bus type's .offline(). |
| 1216 | 1243 | * @of_node_reused: Set if the device-tree node is shared with an ancestor |
| 1217 | 1244 | * device. |
| 1245 | + * @state_synced: The hardware state of this device has been synced to match | |
| 1246 | + * the software state of this device by calling the driver/bus | |
| 1247 | + * sync_state() callback. | |
| 1218 | 1248 | * @dma_coherent: this particular device is dma coherent, even if the |
| 1219 | 1249 | * architecture supports non-coherent devices. |
| 1220 | 1250 | * |
| @@ -1270,7 +1300,7 @@ struct device { · 49 unmodified lines | ||
| 1270 | 1300 | not all hardware supports |
| 1271 | 1301 | 64 bit addresses for consistent |
| 1272 | 1302 | allocations such descriptors. */ |
| 1273 | − u64 bus_dma_mask; /* upstream dma_mask constraint */ | |
| 1303 | + u64 bus_dma_limit; /* upstream dma constraint */ | |
| 1274 | 1304 | unsigned long dma_pfn_offset; |
| 1275 | 1305 | |
| 1276 | 1306 | struct device_dma_parameters *dma_parms; |
| @@ -1311,6 +1341,7 @@ struct device { · 34 unmodified lines | ||
| 1311 | 1341 | bool offline_disabled:1; |
| 1312 | 1342 | bool offline:1; |
| 1313 | 1343 | bool of_node_reused:1; |
| 1344 | + bool state_synced:1; | |
| 1314 | 1345 | #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ |
| 1315 | 1346 | defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \ |
| 1316 | 1347 | defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) |
| @@ -1635,11 +1666,11 @@ extern bool kill_device(struct device *dev); · 318 unmodified lines | ||
| 1635 | 1666 | #ifdef CONFIG_DEVTMPFS |
| 1636 | 1667 | extern int devtmpfs_create_node(struct device *dev); |
| 1637 | 1668 | extern int devtmpfs_delete_node(struct device *dev); |
| 1638 | −extern int devtmpfs_mount(const char *mntdir); | |
| 1669 | +extern int devtmpfs_mount(void); | |
| 1639 | 1670 | #else |
| 1640 | 1671 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } |
| 1641 | 1672 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } |
| 1642 | −static inline int devtmpfs_mount(const char *mountpoint) { return 0; } | |
| 1673 | +static inline int devtmpfs_mount(void) { return 0; } | |
| 1643 | 1674 | #endif |
| 1644 | 1675 | |
| 1645 | 1676 | /* drivers/base/power/shutdown.c */ |
| @@ -1653,6 +1684,8 @@ struct device_link *device_link_add(struct device *consumer, · 7 unmodified lines | ||
| 1653 | 1684 | struct device *supplier, u32 flags); |
| 1654 | 1685 | void device_link_del(struct device_link *link); |
| 1655 | 1686 | void device_link_remove(void *consumer, struct device *supplier); |
| 1687 | +void device_links_supplier_sync_state_pause(void); | |
| 1688 | +void device_links_supplier_sync_state_resume(void); | |
| 1656 | 1689 | |
| 1657 | 1690 | #ifndef dev_fmt |
| 1658 | 1691 | #define dev_fmt(fmt) fmt |
| @@ -12,26 +12,15 @@ · 11 unmodified lines | ||
| 12 | 12 | #define DEVCG_DEV_ALL 4 /* this represents all devices */ |
| 13 | 13 | |
| 14 | 14 | #ifdef CONFIG_CGROUP_DEVICE |
| 15 | −extern int __devcgroup_check_permission(short type, u32 major, u32 minor, | |
| 16 | − short access); | |
| 15 | +int devcgroup_check_permission(short type, u32 major, u32 minor, | |
| 16 | + short access); | |
| 17 | 17 | #else |
| 18 | −static inline int __devcgroup_check_permission(short type, u32 major, u32 minor, | |
| 19 | − short access) | |
| 18 | +static inline int devcgroup_check_permission(short type, u32 major, u32 minor, | |
| 19 | + short access) | |
| 20 | 20 | { return 0; } |
| 21 | 21 | #endif |
| 22 | 22 | |
| 23 | 23 | #if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF) |
| 24 | −static inline int devcgroup_check_permission(short type, u32 major, u32 minor, | |
| 25 | − short access) | |
| 26 | −{ | |
| 27 | − int rc = BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type, major, minor, access); | |
| 28 | − | |
| 29 | − if (rc) | |
| 30 | − return -EPERM; | |
| 31 | − | |
| 32 | − return __devcgroup_check_permission(type, major, minor, access); | |
| 33 | −} | |
| 34 | − | |
| 35 | 24 | static inline int devcgroup_inode_permission(struct inode *inode, int mask) |
| 36 | 25 | { |
| 37 | 26 | short type, access = 0; |
| @@ -4,22 +4,26 @@ · 3 unmodified lines | ||
| 4 | 4 | #ifndef DIM_H |
| 5 | 5 | #define DIM_H |
| 6 | 6 | |
| 7 | +#include <linux/bits.h> | |
| 8 | +#include <linux/kernel.h> | |
| 7 | 9 | #include <linux/module.h> |
| 10 | +#include <linux/types.h> | |
| 11 | +#include <linux/workqueue.h> | |
| 8 | 12 | |
| 9 | −/** | |
| 13 | +/* | |
| 10 | 14 | * Number of events between DIM iterations. |
| 11 | 15 | * Causes a moderation of the algorithm run. |
| 12 | 16 | */ |
| 13 | 17 | #define DIM_NEVENTS 64 |
| 14 | 18 | |
| 15 | −/** | |
| 19 | +/* | |
| 16 | 20 | * Is a difference between values justifies taking an action. |
| 17 | 21 | * We consider 10% difference as significant. |
| 18 | 22 | */ |
| 19 | 23 | #define IS_SIGNIFICANT_DIFF(val, ref) \ |
| 20 | 24 | (((100UL * abs((val) - (ref))) / (ref)) > 10) |
| 21 | 25 | |
| 22 | −/** | |
| 26 | +/* | |
| 23 | 27 | * Calculate the gap between two values. |
| 24 | 28 | * Take wrap-around and variable size into consideration. |
| 25 | 29 | */ |
| @@ -27,12 +31,13 @@ · 1 unmodified line | ||
| 27 | 31 | & (BIT_ULL(bits) - 1)) |
| 28 | 32 | |
| 29 | 33 | /** |
| 30 | − * Structure for CQ moderation values. | |
| 34 | + * struct dim_cq_moder - Structure for CQ moderation values. | |
| 31 | 35 | * Used for communications between DIM and its consumer. |
| 32 | 36 | * |
| 33 | 37 | * @usec: CQ timer suggestion (by DIM) |
| 34 | 38 | * @pkts: CQ packet counter suggestion (by DIM) |
| 35 | − * @cq_period_mode: CQ priod count mode (from CQE/EQE) | |
| 39 | + * @comps: Completion counter | |
| 40 | + * @cq_period_mode: CQ period count mode (from CQE/EQE) | |
| 36 | 41 | */ |
| 37 | 42 | struct dim_cq_moder { |
| 38 | 43 | u16 usec; |
| @@ -42,13 +47,14 @@ struct dim_cq_moder { · 3 unmodified lines | ||
| 42 | 47 | }; |
| 43 | 48 | |
| 44 | 49 | /** |
| 45 | − * Structure for DIM sample data. | |
| 50 | + * struct dim_sample - Structure for DIM sample data. | |
| 46 | 51 | * Used for communications between DIM and its consumer. |
| 47 | 52 | * |
| 48 | 53 | * @time: Sample timestamp |
| 49 | 54 | * @pkt_ctr: Number of packets |
| 50 | 55 | * @byte_ctr: Number of bytes |
| 51 | 56 | * @event_ctr: Number of events |
| 57 | + * @comp_ctr: Current completion counter | |
| 52 | 58 | */ |
| 53 | 59 | struct dim_sample { |
| 54 | 60 | ktime_t time; |
| @@ -59,12 +65,14 @@ struct dim_sample { · 4 unmodified lines | ||
| 59 | 65 | }; |
| 60 | 66 | |
| 61 | 67 | /** |
| 62 | − * Structure for DIM stats. | |
| 68 | + * struct dim_stats - Structure for DIM stats. | |
| 63 | 69 | * Used for holding current measured rates. |
| 64 | 70 | * |
| 65 | 71 | * @ppms: Packets per msec |
| 66 | 72 | * @bpms: Bytes per msec |
| 67 | 73 | * @epms: Events per msec |
| 74 | + * @cpms: Completions per msec | |
| 75 | + * @cpe_ratio: Ratio of completions to events | |
| 68 | 76 | */ |
| 69 | 77 | struct dim_stats { |
| 70 | 78 | int ppms; /* packets per msec */ |
| @@ -75,12 +83,13 @@ struct dim_stats { · 4 unmodified lines | ||
| 75 | 83 | }; |
| 76 | 84 | |
| 77 | 85 | /** |
| 78 | − * Main structure for dynamic interrupt moderation (DIM). | |
| 86 | + * struct dim - Main structure for dynamic interrupt moderation (DIM). | |
| 79 | 87 | * Used for holding all information about a specific DIM instance. |
| 80 | 88 | * |
| 81 | 89 | * @state: Algorithm state (see below) |
| 82 | 90 | * @prev_stats: Measured rates from previous iteration (for comparison) |
| 83 | 91 | * @start_sample: Sampled data at start of current iteration |
| 92 | + * @measuring_sample: A &dim_sample that is used to update the current events | |
| 84 | 93 | * @work: Work to perform on action required |
| 85 | 94 | * @priv: A pointer to the struct that points to dim |
| 86 | 95 | * @profile_ix: Current moderation profile |
| @@ -106,24 +115,21 @@ struct dim { · 19 unmodified lines | ||
| 106 | 115 | }; |
| 107 | 116 | |
| 108 | 117 | /** |
| 109 | − * enum dim_cq_period_mode | |
| 110 | − * | |
| 111 | − * These are the modes for CQ period count. | |
| 118 | + * enum dim_cq_period_mode - Modes for CQ period count | |
| 112 | 119 | * |
| 113 | 120 | * @DIM_CQ_PERIOD_MODE_START_FROM_EQE: Start counting from EQE |
| 114 | 121 | * @DIM_CQ_PERIOD_MODE_START_FROM_CQE: Start counting from CQE (implies timer reset) |
| 115 | 122 | * @DIM_CQ_PERIOD_NUM_MODES: Number of modes |
| 116 | 123 | */ |
| 117 | −enum { | |
| 124 | +enum dim_cq_period_mode { | |
| 118 | 125 | DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, |
| 119 | 126 | DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, |
| 120 | 127 | DIM_CQ_PERIOD_NUM_MODES |
| 121 | 128 | }; |
| 122 | 129 | |
| 123 | 130 | /** |
| 124 | − * enum dim_state | |
| 131 | + * enum dim_state - DIM algorithm states | |
| 125 | 132 | * |
| 126 | − * These are the DIM algorithm states. | |
| 127 | 133 | * These will determine if the algorithm is in a valid state to start an iteration. |
| 128 | 134 | * |
| 129 | 135 | * @DIM_START_MEASURE: This is the first iteration (also after applying a new profile) |
| @@ -131,16 +137,15 @@ enum { · 1 unmodified line | ||
| 131 | 137 | * need to perform an action |
| 132 | 138 | * @DIM_APPLY_NEW_PROFILE: DIM consumer is currently applying a profile - no need to measure |
| 133 | 139 | */ |
| 134 | −enum { | |
| 140 | +enum dim_state { | |
| 135 | 141 | DIM_START_MEASURE, |
| 136 | 142 | DIM_MEASURE_IN_PROGRESS, |
| 137 | 143 | DIM_APPLY_NEW_PROFILE, |
| 138 | 144 | }; |
| 139 | 145 | |
| 140 | 146 | /** |
| 141 | − * enum dim_tune_state | |
| 147 | + * enum dim_tune_state - DIM algorithm tune states | |
| 142 | 148 | * |
| 143 | − * These are the DIM algorithm tune states. | |
| 144 | 149 | * These will determine which action the algorithm should perform. |
| 145 | 150 | * |
| 146 | 151 | * @DIM_PARKING_ON_TOP: Algorithm found a local top point - exit on significant difference |
| @@ -148,7 +153,7 @@ enum { · 1 unmodified line | ||
| 148 | 153 | * @DIM_GOING_RIGHT: Algorithm is currently trying higher moderation levels |
| 149 | 154 | * @DIM_GOING_LEFT: Algorithm is currently trying lower moderation levels |
| 150 | 155 | */ |
| 151 | −enum { | |
| 156 | +enum dim_tune_state { | |
| 152 | 157 | DIM_PARKING_ON_TOP, |
| 153 | 158 | DIM_PARKING_TIRED, |
| 154 | 159 | DIM_GOING_RIGHT, |
| @@ -156,25 +161,23 @@ enum { · 1 unmodified line | ||
| 156 | 161 | }; |
| 157 | 162 | |
| 158 | 163 | /** |
| 159 | − * enum dim_stats_state | |
| 164 | + * enum dim_stats_state - DIM algorithm statistics states | |
| 160 | 165 | * |
| 161 | − * These are the DIM algorithm statistics states. | |
| 162 | 166 | * These will determine the verdict of current iteration. |
| 163 | 167 | * |
| 164 | 168 | * @DIM_STATS_WORSE: Current iteration shows worse performance than before |
| 165 | − * @DIM_STATS_WORSE: Current iteration shows same performance than before | |
| 166 | − * @DIM_STATS_WORSE: Current iteration shows better performance than before | |
| 169 | + * @DIM_STATS_SAME: Current iteration shows same performance than before | |
| 170 | + * @DIM_STATS_BETTER: Current iteration shows better performance than before | |
| 167 | 171 | */ |
| 168 | −enum { | |
| 172 | +enum dim_stats_state { | |
| 169 | 173 | DIM_STATS_WORSE, |
| 170 | 174 | DIM_STATS_SAME, |
| 171 | 175 | DIM_STATS_BETTER, |
| 172 | 176 | }; |
| 173 | 177 | |
| 174 | 178 | /** |
| 175 | − * enum dim_step_result | |
| 179 | + * enum dim_step_result - DIM algorithm step results | |
| 176 | 180 | * |
| 177 | − * These are the DIM algorithm step results. | |
| 178 | 181 | * These describe the result of a step. |
| 179 | 182 | * |
| 180 | 183 | * @DIM_STEPPED: Performed a regular step |
| @@ -182,7 +185,7 @@ enum { · 1 unmodified line | ||
| 182 | 185 | * tired parking |
| 183 | 186 | * @DIM_ON_EDGE: Stepped to the most left/right profile |
| 184 | 187 | */ |
| 185 | −enum { | |
| 188 | +enum dim_step_result { | |
| 186 | 189 | DIM_STEPPED, |
| 187 | 190 | DIM_TOO_TIRED, |
| 188 | 191 | DIM_ON_EDGE, |
| @@ -199,7 +202,7 @@ enum { · 10 unmodified lines | ||
| 199 | 202 | bool dim_on_top(struct dim *dim); |
| 200 | 203 | |
| 201 | 204 | /** |
| 202 | − * dim_turn - change profile alterning direction | |
| 205 | + * dim_turn - change profile altering direction | |
| 203 | 206 | * @dim: DIM context |
| 204 | 207 | * |
| 205 | 208 | * Go left if we were going right and vice-versa. |
| @@ -238,7 +241,7 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end, · 32 unmodified lines | ||
| 238 | 241 | struct dim_stats *curr_stats); |
| 239 | 242 | |
| 240 | 243 | /** |
| 241 | − * dim_update_sample - set a sample's fields with give values | |
| 244 | + * dim_update_sample - set a sample's fields with given values | |
| 242 | 245 | * @event_ctr: number of events to set |
| 243 | 246 | * @packets: number of packets to set |
| 244 | 247 | * @bytes: number of bytes to set |
| @@ -304,8 +307,8 @@ struct dim_cq_moder net_dim_get_def_tx_moderation(u8 cq_period_mode); · 59 unmodified lines | ||
| 304 | 307 | * @end_sample: Current data measurement |
| 305 | 308 | * |
| 306 | 309 | * Called by the consumer. |
| 307 | − * This is the main logic of the algorithm, where data is processed in order to decide on next | |
| 308 | − * required action. | |
| 310 | + * This is the main logic of the algorithm, where data is processed in order | |
| 311 | + * to decide on next required action. | |
| 309 | 312 | */ |
| 310 | 313 | void net_dim(struct dim *dim, struct dim_sample end_sample); |
| 311 | 314 | |
| @@ -42,6 +42,18 @@ struct dma_buf_ops { · 41 unmodified lines | ||
| 42 | 42 | */ |
| 43 | 43 | bool cache_sgt_mapping; |
| 44 | 44 | |
| 45 | + /** | |
| 46 | + * @dynamic_mapping: | |
| 47 | + * | |
| 48 | + * If true the framework makes sure that the map/unmap_dma_buf | |
| 49 | + * callbacks are always called with the dma_resv object locked. | |
| 50 | + * | |
| 51 | + * If false the framework makes sure that the map/unmap_dma_buf | |
| 52 | + * callbacks are always called without the dma_resv object locked. | |
| 53 | + * Mutual exclusive with @cache_sgt_mapping. | |
| 54 | + */ | |
| 55 | + bool dynamic_mapping; | |
| 56 | + | |
| 45 | 57 | /** |
| 46 | 58 | * @attach: |
| 47 | 59 | * |
| @@ -109,6 +121,9 @@ struct dma_buf_ops { · 61 unmodified lines | ||
| 109 | 121 | * any other kind of sharing that the exporter might wish to make |
| 110 | 122 | * available to buffer-users. |
| 111 | 123 | * |
| 124 | + * This is always called with the dmabuf->resv object locked when | |
| 125 | + * the dynamic_mapping flag is true. | |
| 126 | + * | |
| 112 | 127 | * Returns: |
| 113 | 128 | * |
| 114 | 129 | * A &sg_table scatter list of or the backing storage of the DMA buffer, |
| @@ -267,14 +282,16 @@ struct dma_buf_ops { · 152 unmodified lines | ||
| 267 | 282 | * struct dma_buf - shared buffer object |
| 268 | 283 | * @size: size of the buffer |
| 269 | 284 | * @file: file pointer used for sharing buffers across, and for refcounting. |
| 270 | − * @attachments: list of dma_buf_attachment that denotes all devices attached. | |
| 285 | + * @attachments: list of dma_buf_attachment that denotes all devices attached, | |
| 286 | + * protected by dma_resv lock. | |
| 271 | 287 | * @ops: dma_buf_ops associated with this buffer object. |
| 272 | 288 | * @lock: used internally to serialize list manipulation, attach/detach and |
| 273 | − * vmap/unmap, and accesses to name | |
| 289 | + * vmap/unmap | |
| 274 | 290 | * @vmapping_counter: used internally to refcnt the vmaps |
| 275 | 291 | * @vmap_ptr: the current vmap ptr if vmapping_counter > 0 |
| 276 | 292 | * @exp_name: name of the exporter; useful for debugging. |
| 277 | − * @name: userspace-provided name; useful for accounting and debugging. | |
| 293 | + * @name: userspace-provided name; useful for accounting and debugging, | |
| 294 | + * protected by @resv. | |
| 278 | 295 | * @owner: pointer to exporter module; used for refcounting when exporter is a |
| 279 | 296 | * kernel module. |
| 280 | 297 | * @list_node: node for dma_buf accounting and debugging. |
| @@ -323,10 +340,12 @@ struct dma_buf { · 42 unmodified lines | ||
| 323 | 340 | * struct dma_buf_attachment - holds device-buffer attachment data |
| 324 | 341 | * @dmabuf: buffer for this attachment. |
| 325 | 342 | * @dev: device attached to the buffer. |
| 326 | − * @node: list of dma_buf_attachment. | |
| 343 | + * @node: list of dma_buf_attachment, protected by dma_resv lock of the dmabuf. | |
| 327 | 344 | * @sgt: cached mapping. |
| 328 | 345 | * @dir: direction of cached mapping. |
| 329 | 346 | * @priv: exporter specific attachment data. |
| 347 | + * @dynamic_mapping: true if dma_buf_map/unmap_attachment() is called with the | |
| 348 | + * dma_resv lock held. | |
| 330 | 349 | * |
| 331 | 350 | * This structure holds the attachment information between the dma_buf buffer |
| 332 | 351 | * and its user device(s). The list contains one attachment struct per device |
| @@ -343,6 +362,7 @@ struct dma_buf_attachment { · 10 unmodified lines | ||
| 343 | 362 | struct list_head node; |
| 344 | 363 | struct sg_table *sgt; |
| 345 | 364 | enum dma_data_direction dir; |
| 365 | + bool dynamic_mapping; | |
| 346 | 366 | void *priv; |
| 347 | 367 | }; |
| 348 | 368 | |
| @@ -394,10 +414,40 @@ static inline void get_dma_buf(struct dma_buf *dmabuf) · 45 unmodified lines | ||
| 394 | 414 | get_file(dmabuf->file); |
| 395 | 415 | } |
| 396 | 416 | |
| 417 | +/** | |
| 418 | + * dma_buf_is_dynamic - check if a DMA-buf uses dynamic mappings. | |
| 419 | + * @dmabuf: the DMA-buf to check | |
| 420 | + * | |
| 421 | + * Returns true if a DMA-buf exporter wants to be called with the dma_resv | |
| 422 | + * locked for the map/unmap callbacks, false if it doesn't wants to be called | |
| 423 | + * with the lock held. | |
| 424 | + */ | |
| 425 | +static inline bool dma_buf_is_dynamic(struct dma_buf *dmabuf) | |
| 426 | +{ | |
| 427 | + return dmabuf->ops->dynamic_mapping; | |
| 428 | +} | |
| 429 | + | |
| 430 | +/** | |
| 431 | + * dma_buf_attachment_is_dynamic - check if a DMA-buf attachment uses dynamic | |
| 432 | + * mappinsg | |
| 433 | + * @attach: the DMA-buf attachment to check | |
| 434 | + * | |
| 435 | + * Returns true if a DMA-buf importer wants to call the map/unmap functions with | |
| 436 | + * the dma_resv lock held. | |
| 437 | + */ | |
| 438 | +static inline bool | |
| 439 | +dma_buf_attachment_is_dynamic(struct dma_buf_attachment *attach) | |
| 440 | +{ | |
| 441 | + return attach->dynamic_mapping; | |
| 442 | +} | |
| 443 | + | |
| 397 | 444 | struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, |
| 398 | − struct device *dev); | |
| 445 | + struct device *dev); | |
| 446 | +struct dma_buf_attachment * | |
| 447 | +dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, | |
| 448 | + bool dynamic_mapping); | |
| 399 | 449 | void dma_buf_detach(struct dma_buf *dmabuf, |
| 400 | − struct dma_buf_attachment *dmabuf_attach); | |
| 450 | + struct dma_buf_attachment *attach); | |
| 401 | 451 | |
| 402 | 452 | struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info); |
| 403 | 453 | |
| @@ -409,6 +459,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *, · 5 unmodified lines | ||
| 409 | 459 | enum dma_data_direction); |
| 410 | 460 | void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *, |
| 411 | 461 | enum dma_data_direction); |
| 462 | +void dma_buf_move_notify(struct dma_buf *dma_buf); | |
| 412 | 463 | int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, |
| 413 | 464 | enum dma_data_direction dir); |
| 414 | 465 | int dma_buf_end_cpu_access(struct dma_buf *dma_buf, |
| @@ -3,8 +3,11 @@ · 2 unmodified lines | ||
| 3 | 3 | #define _LINUX_DMA_DIRECT_H 1 |
| 4 | 4 | |
| 5 | 5 | #include <linux/dma-mapping.h> |
| 6 | +#include <linux/memblock.h> /* for min_low_pfn */ | |
| 6 | 7 | #include <linux/mem_encrypt.h> |
| 7 | 8 | |
| 9 | +extern unsigned int zone_dma_bits; | |
| 10 | + | |
| 8 | 11 | #ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA |
| 9 | 12 | #include <asm/dma-direct.h> |
| 10 | 13 | #else |
| @@ -21,15 +24,6 @@ static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dev_addr) · 10 unmodified lines | ||
| 21 | 24 | |
| 22 | 25 | return paddr + ((phys_addr_t)dev->dma_pfn_offset << PAGE_SHIFT); |
| 23 | 26 | } |
| 24 | − | |
| 25 | −static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | |
| 26 | −{ | |
| 27 | − if (!dev->dma_mask) | |
| 28 | − return false; | |
| 29 | − | |
| 30 | − return addr + size - 1 <= | |
| 31 | − min_not_zero(*dev->dma_mask, dev->bus_dma_mask); | |
| 32 | −} | |
| 33 | 27 | #endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */ |
| 34 | 28 | |
| 35 | 29 | #ifdef CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED |
| @@ -57,6 +51,21 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) · 21 unmodified lines | ||
| 57 | 51 | return __sme_clr(__dma_to_phys(dev, daddr)); |
| 58 | 52 | } |
| 59 | 53 | |
| 54 | +static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size, | |
| 55 | + bool is_ram) | |
| 56 | +{ | |
| 57 | + dma_addr_t end = addr + size - 1; | |
| 58 | + | |
| 59 | + if (!dev->dma_mask) | |
| 60 | + return false; | |
| 61 | + | |
| 62 | + if (is_ram && !IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) && | |
| 63 | + min(addr, end) < phys_to_dma(dev, PFN_PHYS(min_low_pfn))) | |
| 64 | + return false; | |
| 65 | + | |
| 66 | + return end <= min_not_zero(*dev->dma_mask, dev->bus_dma_limit); | |
| 67 | +} | |
| 68 | + | |
| 60 | 69 | u64 dma_direct_get_required_mask(struct device *dev); |
| 61 | 70 | void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, |
| 62 | 71 | gfp_t gfp, unsigned long attrs); |
| @@ -67,7 +76,13 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size, · 4 unmodified lines | ||
| 67 | 76 | void dma_direct_free_pages(struct device *dev, size_t size, void *cpu_addr, |
| 68 | 77 | dma_addr_t dma_addr, unsigned long attrs); |
| 69 | 78 | struct page *__dma_direct_alloc_pages(struct device *dev, size_t size, |
| 70 | − dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs); | |
| 71 | −void __dma_direct_free_pages(struct device *dev, size_t size, struct page *page); | |
| 79 | + gfp_t gfp, unsigned long attrs); | |
| 80 | +int dma_direct_get_sgtable(struct device *dev, struct sg_table *sgt, | |
| 81 | + void *cpu_addr, dma_addr_t dma_addr, size_t size, | |
| 82 | + unsigned long attrs); | |
| 83 | +bool dma_direct_can_mmap(struct device *dev); | |
| 84 | +int dma_direct_mmap(struct device *dev, struct vm_area_struct *vma, | |
| 85 | + void *cpu_addr, dma_addr_t dma_addr, size_t size, | |
| 86 | + unsigned long attrs); | |
| 72 | 87 | int dma_direct_supported(struct device *dev, u64 mask); |
| 73 | 88 | #endif /* _LINUX_DMA_DIRECT_H */ |
| @@ -15,11 +15,8 @@ · 14 unmodified lines | ||
| 15 | 15 | /** |
| 16 | 16 | * List of possible attributes associated with a DMA mapping. The semantics |
| 17 | 17 | * of each attribute should be defined in Documentation/DMA-attributes.txt. |
| 18 | − * | |
| 19 | − * DMA_ATTR_WRITE_BARRIER: DMA to a memory region with this attribute | |
| 20 | − * forces all pending DMA writes to complete. | |
| 21 | 18 | */ |
| 22 | −#define DMA_ATTR_WRITE_BARRIER (1UL << 0) | |
| 19 | + | |
| 23 | 20 | /* |
| 24 | 21 | * DMA_ATTR_WEAK_ORDERING: Specifies that reads and writes to the mapping |
| 25 | 22 | * may be weakly ordered, that is that reads and writes may pass each other. |
| @@ -162,7 +159,7 @@ int dma_release_from_dev_coherent(struct device *dev, int order, void *vaddr); · 136 unmodified lines | ||
| 162 | 159 | int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma, |
| 163 | 160 | void *cpu_addr, size_t size, int *ret); |
| 164 | 161 | |
| 165 | −void *dma_alloc_from_global_coherent(ssize_t size, dma_addr_t *dma_handle); | |
| 162 | +void *dma_alloc_from_global_coherent(struct device *dev, ssize_t size, dma_addr_t *dma_handle); | |
| 166 | 163 | int dma_release_from_global_coherent(int order, void *vaddr); |
| 167 | 164 | int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr, |
| 168 | 165 | size_t size, int *ret); |
| @@ -172,7 +169,7 @@ int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr, · 3 unmodified lines | ||
| 172 | 169 | #define dma_release_from_dev_coherent(dev, order, vaddr) (0) |
| 173 | 170 | #define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0) |
| 174 | 171 | |
| 175 | −static inline void *dma_alloc_from_global_coherent(ssize_t size, | |
| 172 | +static inline void *dma_alloc_from_global_coherent(struct device *dev, ssize_t size, | |
| 176 | 173 | dma_addr_t *dma_handle) |
| 177 | 174 | { |
| 178 | 175 | return NULL; |
| @@ -583,6 +580,10 @@ static inline unsigned long dma_get_merge_boundary(struct device *dev) · 404 unmodified lines | ||
| 583 | 580 | static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, |
| 584 | 581 | size_t size, enum dma_data_direction dir, unsigned long attrs) |
| 585 | 582 | { |
| 583 | + /* DMA must never operate on areas that might be remapped. */ | |
| 584 | + if (dev_WARN_ONCE(dev, is_vmalloc_addr(ptr), | |
| 585 | + "rejecting DMA map of vmalloc memory\n")) | |
| 586 | + return DMA_MAPPING_ERROR; | |
| 586 | 587 | debug_dma_map_single(dev, ptr, size); |
| 587 | 588 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr), |
| 588 | 589 | size, dir, attrs); |
| @@ -693,7 +694,7 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) · 104 unmodified lines | ||
| 693 | 694 | */ |
| 694 | 695 | static inline bool dma_addressing_limited(struct device *dev) |
| 695 | 696 | { |
| 696 | − return min_not_zero(dma_get_mask(dev), dev->bus_dma_mask) < | |
| 697 | + return min_not_zero(dma_get_mask(dev), dev->bus_dma_limit) < | |
| 697 | 698 | dma_get_required_mask(dev); |
| 698 | 699 | } |
| 699 | 700 | |
| @@ -41,8 +41,6 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, · 40 unmodified lines | ||
| 41 | 41 | gfp_t gfp, unsigned long attrs); |
| 42 | 42 | void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, |
| 43 | 43 | dma_addr_t dma_addr, unsigned long attrs); |
| 44 | −long arch_dma_coherent_to_pfn(struct device *dev, void *cpu_addr, | |
| 45 | − dma_addr_t dma_addr); | |
| 46 | 44 | |
| 47 | 45 | #ifdef CONFIG_MMU |
| 48 | 46 | /* |
| @@ -75,29 +73,29 @@ static inline void arch_dma_cache_sync(struct device *dev, void *vaddr, · 26 unmodified lines | ||
| 75 | 73 | #endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */ |
| 76 | 74 | |
| 77 | 75 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE |
| 78 | −void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, | |
| 79 | − size_t size, enum dma_data_direction dir); | |
| 76 | +void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, | |
| 77 | + enum dma_data_direction dir); | |
| 80 | 78 | #else |
| 81 | −static inline void arch_sync_dma_for_device(struct device *dev, | |
| 82 | − phys_addr_t paddr, size_t size, enum dma_data_direction dir) | |
| 79 | +static inline void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, | |
| 80 | + enum dma_data_direction dir) | |
| 83 | 81 | { |
| 84 | 82 | } |
| 85 | 83 | #endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */ |
| 86 | 84 | |
| 87 | 85 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU |
| 88 | −void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, | |
| 89 | − size_t size, enum dma_data_direction dir); | |
| 86 | +void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, | |
| 87 | + enum dma_data_direction dir); | |
| 90 | 88 | #else |
| 91 | −static inline void arch_sync_dma_for_cpu(struct device *dev, | |
| 92 | − phys_addr_t paddr, size_t size, enum dma_data_direction dir) | |
| 89 | +static inline void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, | |
| 90 | + enum dma_data_direction dir) | |
| 93 | 91 | { |
| 94 | 92 | } |
| 95 | 93 | #endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */ |
| 96 | 94 | |
| 97 | 95 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL |
| 98 | −void arch_sync_dma_for_cpu_all(struct device *dev); | |
| 96 | +void arch_sync_dma_for_cpu_all(void); | |
| 99 | 97 | #else |
| 100 | −static inline void arch_sync_dma_for_cpu_all(struct device *dev) | |
| 98 | +static inline void arch_sync_dma_for_cpu_all(void) | |
| 101 | 99 | { |
| 102 | 100 | } |
| 103 | 101 | #endif /* CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL */ |
| @@ -118,6 +118,9 @@ enum sprd_dma_int_type { · 117 unmodified lines | ||
| 118 | 118 | * struct sprd_dma_linklist - DMA link-list address structure |
| 119 | 119 | * @virt_addr: link-list virtual address to configure link-list node |
| 120 | 120 | * @phy_addr: link-list physical address to link DMA transfer |
| 121 | + * @wrap_addr: the wrap address for link-list mode, which means once the | |
| 122 | + * transfer address reaches the wrap address, the next transfer address | |
| 123 | + * will jump to the address specified by wrap_to register. | |
| 121 | 124 | * |
| 122 | 125 | * The Spreadtrum DMA controller supports the link-list mode, that means slaves |
| 123 | 126 | * can supply several groups configurations (each configuration represents one |
| @@ -181,6 +184,7 @@ enum sprd_dma_int_type { · 57 unmodified lines | ||
| 181 | 184 | struct sprd_dma_linklist { |
| 182 | 185 | unsigned long virt_addr; |
| 183 | 186 | phys_addr_t phy_addr; |
| 187 | + phys_addr_t wrap_addr; | |
| 184 | 188 | }; |
| 185 | 189 | |
| 186 | 190 | #endif |
| @@ -129,6 +129,7 @@ static inline int dmar_res_noop(struct acpi_dmar_header *hdr, void *arg) · 128 unmodified lines | ||
| 129 | 129 | #ifdef CONFIG_INTEL_IOMMU |
| 130 | 130 | extern int iommu_detected, no_iommu; |
| 131 | 131 | extern int intel_iommu_init(void); |
| 132 | +extern void intel_iommu_shutdown(void); | |
| 132 | 133 | extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg); |
| 133 | 134 | extern int dmar_parse_one_atsr(struct acpi_dmar_header *header, void *arg); |
| 134 | 135 | extern int dmar_check_one_atsr(struct acpi_dmar_header *hdr, void *arg); |
| @@ -137,6 +138,7 @@ extern int dmar_iommu_hotplug(struct dmar_drhd_unit *dmaru, bool insert); · 2 unmodified lines | ||
| 137 | 138 | extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info); |
| 138 | 139 | #else /* !CONFIG_INTEL_IOMMU: */ |
| 139 | 140 | static inline int intel_iommu_init(void) { return -ENODEV; } |
| 141 | +static inline void intel_iommu_shutdown(void) { } | |
| 140 | 142 | |
| 141 | 143 | #define dmar_parse_one_rmrr dmar_res_noop |
| 142 | 144 | #define dmar_parse_one_atsr dmar_res_noop |
| @@ -113,6 +113,8 @@ extern int dmi_walk(void (*decode)(const struct dmi_header *, void *), · 112 unmodified lines | ||
| 113 | 113 | extern bool dmi_match(enum dmi_field f, const char *str); |
| 114 | 114 | extern void dmi_memdev_name(u16 handle, const char **bank, const char **device); |
| 115 | 115 | extern u64 dmi_memdev_size(u16 handle); |
| 116 | +extern u8 dmi_memdev_type(u16 handle); | |
| 117 | +extern u16 dmi_memdev_handle(int slot); | |
| 116 | 118 | |
| 117 | 119 | #else |
| 118 | 120 | |
| @@ -142,6 +144,8 @@ static inline bool dmi_match(enum dmi_field f, const char *str) · 23 unmodified lines | ||
| 142 | 144 | static inline void dmi_memdev_name(u16 handle, const char **bank, |
| 143 | 145 | const char **device) { } |
| 144 | 146 | static inline u64 dmi_memdev_size(u16 handle) { return ~0ul; } |
| 147 | +static inline u8 dmi_memdev_type(u16 handle) { return 0x0; } | |
| 148 | +static inline u16 dmi_memdev_handle(int slot) { return 0xffff; } | |
| 145 | 149 | static inline const struct dmi_system_id * |
| 146 | 150 | dmi_first_match(const struct dmi_system_id *list) { return NULL; } |
| 147 | 151 | |
| @@ -362,78 +362,6 @@ struct edac_mc_layer { · 361 unmodified lines | ||
| 362 | 362 | */ |
| 363 | 363 | #define EDAC_MAX_LAYERS 3 |
| 364 | 364 | |
| 365 | −/** | |
| 366 | − * EDAC_DIMM_OFF - Macro responsible to get a pointer offset inside a pointer | |
| 367 | − * array for the element given by [layer0,layer1,layer2] | |
| 368 | − * position | |
| 369 | − * | |
| 370 | − * @layers: a struct edac_mc_layer array, describing how many elements | |
| 371 | − * were allocated for each layer | |
| 372 | − * @nlayers: Number of layers at the @layers array | |
| 373 | − * @layer0: layer0 position | |
| 374 | − * @layer1: layer1 position. Unused if n_layers < 2 | |
| 375 | − * @layer2: layer2 position. Unused if n_layers < 3 | |
| 376 | − * | |
| 377 | − * For 1 layer, this macro returns "var[layer0] - var"; | |
| 378 | − * | |
| 379 | − * For 2 layers, this macro is similar to allocate a bi-dimensional array | |
| 380 | − * and to return "var[layer0][layer1] - var"; | |
| 381 | − * | |
| 382 | − * For 3 layers, this macro is similar to allocate a tri-dimensional array | |
| 383 | − * and to return "var[layer0][layer1][layer2] - var". | |
| 384 | − * | |
| 385 | − * A loop could be used here to make it more generic, but, as we only have | |
| 386 | − * 3 layers, this is a little faster. | |
| 387 | − * | |
| 388 | − * By design, layers can never be 0 or more than 3. If that ever happens, | |
| 389 | − * a NULL is returned, causing an OOPS during the memory allocation routine, | |
| 390 | − * with would point to the developer that he's doing something wrong. | |
| 391 | − */ | |
| 392 | −#define EDAC_DIMM_OFF(layers, nlayers, layer0, layer1, layer2) ({ \ | |
| 393 | − int __i; \ | |
| 394 | − if ((nlayers) == 1) \ | |
| 395 | − __i = layer0; \ | |
| 396 | − else if ((nlayers) == 2) \ | |
| 397 | − __i = (layer1) + ((layers[1]).size * (layer0)); \ | |
| 398 | − else if ((nlayers) == 3) \ | |
| 399 | − __i = (layer2) + ((layers[2]).size * ((layer1) + \ | |
| 400 | − ((layers[1]).size * (layer0)))); \ | |
| 401 | − else \ | |
| 402 | − __i = -EINVAL; \ | |
| 403 | − __i; \ | |
| 404 | −}) | |
| 405 | − | |
| 406 | −/** | |
| 407 | − * EDAC_DIMM_PTR - Macro responsible to get a pointer inside a pointer array | |
| 408 | − * for the element given by [layer0,layer1,layer2] position | |
| 409 | − * | |
| 410 | − * @layers: a struct edac_mc_layer array, describing how many elements | |
| 411 | − * were allocated for each layer | |
| 412 | − * @var: name of the var where we want to get the pointer | |
| 413 | − * (like mci->dimms) | |
| 414 | − * @nlayers: Number of layers at the @layers array | |
| 415 | − * @layer0: layer0 position | |
| 416 | − * @layer1: layer1 position. Unused if n_layers < 2 | |
| 417 | − * @layer2: layer2 position. Unused if n_layers < 3 | |
| 418 | − * | |
| 419 | − * For 1 layer, this macro returns "var[layer0]"; | |
| 420 | − * | |
| 421 | − * For 2 layers, this macro is similar to allocate a bi-dimensional array | |
| 422 | − * and to return "var[layer0][layer1]"; | |
| 423 | − * | |
| 424 | − * For 3 layers, this macro is similar to allocate a tri-dimensional array | |
| 425 | − * and to return "var[layer0][layer1][layer2]"; | |
| 426 | − */ | |
| 427 | −#define EDAC_DIMM_PTR(layers, var, nlayers, layer0, layer1, layer2) ({ \ | |
| 428 | − typeof(*var) __p; \ | |
| 429 | − int ___i = EDAC_DIMM_OFF(layers, nlayers, layer0, layer1, layer2); \ | |
| 430 | − if (___i < 0) \ | |
| 431 | − __p = NULL; \ | |
| 432 | − else \ | |
| 433 | − __p = (var)[___i]; \ | |
| 434 | − __p; \ | |
| 435 | −}) | |
| 436 | − | |
| 437 | 365 | struct dimm_info { |
| 438 | 366 | struct device dev; |
| 439 | 367 | |
| @@ -443,6 +371,7 @@ struct dimm_info { · 3 unmodified lines | ||
| 443 | 371 | unsigned int location[EDAC_MAX_LAYERS]; |
| 444 | 372 | |
| 445 | 373 | struct mem_ctl_info *mci; /* the parent */ |
| 374 | + unsigned int idx; /* index within the parent dimm array */ | |
| 446 | 375 | |
| 447 | 376 | u32 grain; /* granularity of reported error in bytes */ |
| 448 | 377 | enum dev_type dtype; /* memory device type */ |
| @@ -528,15 +457,10 @@ struct errcount_attribute_data { · 79 unmodified lines | ||
| 528 | 457 | * (typically, a memory controller error) |
| 529 | 458 | */ |
| 530 | 459 | struct edac_raw_error_desc { |
| 531 | − /* | |
| 532 | − * NOTE: everything before grain won't be cleaned by | |
| 533 | − * edac_raw_error_desc_clean() | |
| 534 | − */ | |
| 535 | 460 | char location[LOCATION_SIZE]; |
| 536 | 461 | char label[(EDAC_MC_LABEL_LEN + 1 + sizeof(OTHER_LABEL)) * EDAC_MAX_LABELS]; |
| 537 | 462 | long grain; |
| 538 | 463 | |
| 539 | − /* the vars below and grain will be cleaned on every new error report */ | |
| 540 | 464 | u16 error_count; |
| 541 | 465 | int top_layer; |
| 542 | 466 | int mid_layer; |
| @@ -669,4 +593,70 @@ struct mem_ctl_info { · 126 unmodified lines | ||
| 669 | 593 | bool fake_inject_ue; |
| 670 | 594 | u16 fake_inject_count; |
| 671 | 595 | }; |
| 672 | −#endif | |
| 596 | + | |
| 597 | +#define mci_for_each_dimm(mci, dimm) \ | |
| 598 | + for ((dimm) = (mci)->dimms[0]; \ | |
| 599 | + (dimm); \ | |
| 600 | + (dimm) = (dimm)->idx + 1 < (mci)->tot_dimms \ | |
| 601 | + ? (mci)->dimms[(dimm)->idx + 1] \ | |
| 602 | + : NULL) | |
| 603 | + | |
| 604 | +/** | |
| 605 | + * edac_get_dimm_by_index - Get DIMM info at @index from a memory | |
| 606 | + * controller | |
| 607 | + * | |
| 608 | + * @mci: MC descriptor struct mem_ctl_info | |
| 609 | + * @index: index in the memory controller's DIMM array | |
| 610 | + * | |
| 611 | + * Returns a struct dimm_info * or NULL on failure. | |
| 612 | + */ | |
| 613 | +static inline struct dimm_info * | |
| 614 | +edac_get_dimm_by_index(struct mem_ctl_info *mci, int index) | |
| 615 | +{ | |
| 616 | + if (index < 0 || index >= mci->tot_dimms) | |
| 617 | + return NULL; | |
| 618 | + | |
| 619 | + if (WARN_ON_ONCE(mci->dimms[index]->idx != index)) | |
| 620 | + return NULL; | |
| 621 | + | |
| 622 | + return mci->dimms[index]; | |
| 623 | +} | |
| 624 | + | |
| 625 | +/** | |
| 626 | + * edac_get_dimm - Get DIMM info from a memory controller given by | |
| 627 | + * [layer0,layer1,layer2] position | |
| 628 | + * | |
| 629 | + * @mci: MC descriptor struct mem_ctl_info | |
| 630 | + * @layer0: layer0 position | |
| 631 | + * @layer1: layer1 position. Unused if n_layers < 2 | |
| 632 | + * @layer2: layer2 position. Unused if n_layers < 3 | |
| 633 | + * | |
| 634 | + * For 1 layer, this function returns "dimms[layer0]"; | |
| 635 | + * | |
| 636 | + * For 2 layers, this function is similar to allocating a two-dimensional | |
| 637 | + * array and returning "dimms[layer0][layer1]"; | |
| 638 | + * | |
| 639 | + * For 3 layers, this function is similar to allocating a tri-dimensional | |
| 640 | + * array and returning "dimms[layer0][layer1][layer2]"; | |
| 641 | + */ | |
| 642 | +static inline struct dimm_info *edac_get_dimm(struct mem_ctl_info *mci, | |
| 643 | + int layer0, int layer1, int layer2) | |
| 644 | +{ | |
| 645 | + int index; | |
| 646 | + | |
| 647 | + if (layer0 < 0 | |
| 648 | + || (mci->n_layers > 1 && layer1 < 0) | |
| 649 | + || (mci->n_layers > 2 && layer2 < 0)) | |
| 650 | + return NULL; | |
| 651 | + | |
| 652 | + index = layer0; | |
| 653 | + | |
| 654 | + if (mci->n_layers > 1) | |
| 655 | + index = index * mci->layers[1].size + layer1; | |
| 656 | + | |
| 657 | + if (mci->n_layers > 2) | |
| 658 | + index = index * mci->layers[2].size + layer2; | |
| 659 | + | |
| 660 | + return edac_get_dimm_by_index(mci, index); | |
| 661 | +} | |
| 662 | +#endif /* _LINUX_EDAC_H_ */ | |
| @@ -112,6 +112,7 @@ typedef struct { · 111 unmodified lines | ||
| 112 | 112 | #define EFI_MEMORY_MORE_RELIABLE \ |
| 113 | 113 | ((u64)0x0000000000010000ULL) /* higher reliability */ |
| 114 | 114 | #define EFI_MEMORY_RO ((u64)0x0000000000020000ULL) /* read-only */ |
| 115 | +#define EFI_MEMORY_SP ((u64)0x0000000000040000ULL) /* soft reserved */ | |
| 115 | 116 | #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL) /* range requires runtime mapping */ |
| 116 | 117 | #define EFI_MEMORY_DESCRIPTOR_VERSION 1 |
| 117 | 118 | |
| @@ -823,7 +824,7 @@ typedef struct { · 705 unmodified lines | ||
| 823 | 824 | __aligned_u64 image_size; |
| 824 | 825 | unsigned int image_code_type; |
| 825 | 826 | unsigned int image_data_type; |
| 826 | − unsigned long unload; | |
| 827 | + u32 unload; | |
| 827 | 828 | } efi_loaded_image_32_t; |
| 828 | 829 | |
| 829 | 830 | typedef struct { |
| @@ -839,14 +840,14 @@ typedef struct { · 9 unmodified lines | ||
| 839 | 840 | __aligned_u64 image_size; |
| 840 | 841 | unsigned int image_code_type; |
| 841 | 842 | unsigned int image_data_type; |
| 842 | − unsigned long unload; | |
| 843 | + u64 unload; | |
| 843 | 844 | } efi_loaded_image_64_t; |
| 844 | 845 | |
| 845 | 846 | typedef struct { |
| 846 | 847 | u32 revision; |
| 847 | − void *parent_handle; | |
| 848 | + efi_handle_t parent_handle; | |
| 848 | 849 | efi_system_table_t *system_table; |
| 849 | − void *device_handle; | |
| 850 | + efi_handle_t device_handle; | |
| 850 | 851 | void *file_path; |
| 851 | 852 | void *reserved; |
| 852 | 853 | u32 load_options_size; |
| @@ -855,7 +856,7 @@ typedef struct { · 2 unmodified lines | ||
| 855 | 856 | __aligned_u64 image_size; |
| 856 | 857 | unsigned int image_code_type; |
| 857 | 858 | unsigned int image_data_type; |
| 858 | − unsigned long unload; | |
| 859 | + efi_status_t (*unload)(efi_handle_t image_handle); | |
| 859 | 860 | } efi_loaded_image_t; |
| 860 | 861 | |
| 861 | 862 | |
| @@ -1044,7 +1045,6 @@ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if pos · 182 unmodified lines | ||
| 1044 | 1045 | extern efi_status_t efi_query_variable_store(u32 attributes, |
| 1045 | 1046 | unsigned long size, |
| 1046 | 1047 | bool nonblocking); |
| 1047 | −extern void efi_find_mirror(void); | |
| 1048 | 1048 | #else |
| 1049 | 1049 | |
| 1050 | 1050 | static inline efi_status_t efi_query_variable_store(u32 attributes, |
| @@ -1202,6 +1202,7 @@ extern int __init efi_setup_pcdp_console(char *); · 151 unmodified lines | ||
| 1202 | 1202 | #define EFI_DBG 8 /* Print additional debug info at runtime */ |
| 1203 | 1203 | #define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */ |
| 1204 | 1204 | #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */ |
| 1205 | +#define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */ | |
| 1205 | 1206 | |
| 1206 | 1207 | #ifdef CONFIG_EFI |
| 1207 | 1208 | /* |
| @@ -1212,6 +1213,14 @@ static inline bool efi_enabled(int feature) · 4 unmodified lines | ||
| 1212 | 1213 | return test_bit(feature, &efi.flags) != 0; |
| 1213 | 1214 | } |
| 1214 | 1215 | extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused); |
| 1216 | + | |
| 1217 | +bool __pure __efi_soft_reserve_enabled(void); | |
| 1218 | + | |
| 1219 | +static inline bool __pure efi_soft_reserve_enabled(void) | |
| 1220 | +{ | |
| 1221 | + return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE) | |
| 1222 | + && __efi_soft_reserve_enabled(); | |
| 1223 | +} | |
| 1215 | 1224 | #else |
| 1216 | 1225 | static inline bool efi_enabled(int feature) |
| 1217 | 1226 | { |
| @@ -1225,6 +1234,11 @@ efi_capsule_pending(int *reset_type) · 7 unmodified lines | ||
| 1225 | 1234 | { |
| 1226 | 1235 | return false; |
| 1227 | 1236 | } |
| 1237 | + | |
| 1238 | +static inline bool efi_soft_reserve_enabled(void) | |
| 1239 | +{ | |
| 1240 | + return false; | |
| 1241 | +} | |
| 1228 | 1242 | #endif |
| 1229 | 1243 | |
| 1230 | 1244 | extern int efi_status_to_err(efi_status_t status); |
| @@ -1645,6 +1659,8 @@ static inline void · 414 unmodified lines | ||
| 1645 | 1659 | efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) { } |
| 1646 | 1660 | #endif |
| 1647 | 1661 | |
| 1662 | +efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg); | |
| 1663 | + | |
| 1648 | 1664 | void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table); |
| 1649 | 1665 | |
| 1650 | 1666 | /* |
| @@ -9,7 +9,6 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <linux/sched/topology.h> |
| 10 | 10 | #include <linux/types.h> |
| 11 | 11 | |
| 12 | −#ifdef CONFIG_ENERGY_MODEL | |
| 13 | 12 | /** |
| 14 | 13 | * em_cap_state - Capacity state of a performance domain |
| 15 | 14 | * @frequency: The CPU frequency in KHz, for consistency with CPUFreq |
| @@ -40,6 +39,7 @@ struct em_perf_domain { · 24 unmodified lines | ||
| 40 | 39 | unsigned long cpus[0]; |
| 41 | 40 | }; |
| 42 | 41 | |
| 42 | +#ifdef CONFIG_ENERGY_MODEL | |
| 43 | 43 | #define EM_CPU_MAX_POWER 0xFFFF |
| 44 | 44 | |
| 45 | 45 | struct em_data_callback { |
| @@ -160,7 +160,6 @@ static inline int em_pd_nr_cap_states(struct em_perf_domain *pd) · 114 unmodified lines | ||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | #else |
| 163 | −struct em_perf_domain {}; | |
| 164 | 163 | struct em_data_callback {}; |
| 165 | 164 | #define EM_DATA_CB(_active_power_cb) { } |
| 166 | 165 | |
| @@ -0,0 +1,16 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_ERRNAME_H | |
| 3 | +#define _LINUX_ERRNAME_H | |
| 4 | + | |
| 5 | +#include <linux/stddef.h> | |
| 6 | + | |
| 7 | +#ifdef CONFIG_SYMBOLIC_ERRNAME | |
| 8 | +const char *errname(int err); | |
| 9 | +#else | |
| 10 | +static inline const char *errname(int err) | |
| 11 | +{ | |
| 12 | + return NULL; | |
| 13 | +} | |
| 14 | +#endif | |
| 15 | + | |
| 16 | +#endif /* _LINUX_ERRNAME_H */ | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 1 | 2 | #ifndef _LINUX_EXPORT_H |
| 2 | 3 | #define _LINUX_EXPORT_H |
| 3 | 4 | |
| @@ -46,7 +47,7 @@ extern struct module __this_module; · 42 unmodified lines | ||
| 46 | 47 | * absolute relocations that require runtime processing on relocatable |
| 47 | 48 | * kernels. |
| 48 | 49 | */ |
| 49 | −#define __KSYMTAB_ENTRY_NS(sym, sec) \ | |
| 50 | +#define __KSYMTAB_ENTRY(sym, sec) \ | |
| 50 | 51 | __ADDRESSABLE(sym) \ |
| 51 | 52 | asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ |
| 52 | 53 | " .balign 4 \n" \ |
| @@ -56,33 +57,17 @@ extern struct module __this_module; · 3 unmodified lines | ||
| 56 | 57 | " .long __kstrtabns_" #sym "- . \n" \ |
| 57 | 58 | " .previous \n") |
| 58 | 59 | |
| 59 | −#define __KSYMTAB_ENTRY(sym, sec) \ | |
| 60 | − __ADDRESSABLE(sym) \ | |
| 61 | − asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ | |
| 62 | − " .balign 4 \n" \ | |
| 63 | − "__ksymtab_" #sym ": \n" \ | |
| 64 | − " .long " #sym "- . \n" \ | |
| 65 | − " .long __kstrtab_" #sym "- . \n" \ | |
| 66 | − " .long 0 \n" \ | |
| 67 | − " .previous \n") | |
| 68 | − | |
| 69 | 60 | struct kernel_symbol { |
| 70 | 61 | int value_offset; |
| 71 | 62 | int name_offset; |
| 72 | 63 | int namespace_offset; |
| 73 | 64 | }; |
| 74 | 65 | #else |
| 75 | −#define __KSYMTAB_ENTRY_NS(sym, sec) \ | |
| 76 | − static const struct kernel_symbol __ksymtab_##sym \ | |
| 77 | − __attribute__((section("___ksymtab" sec "+" #sym), used)) \ | |
| 78 | − __aligned(sizeof(void *)) \ | |
| 79 | − = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } | |
| 80 | − | |
| 81 | 66 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| 82 | 67 | static const struct kernel_symbol __ksymtab_##sym \ |
| 83 | 68 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ |
| 84 | 69 | __aligned(sizeof(void *)) \ |
| 85 | − = { (unsigned long)&sym, __kstrtab_##sym, NULL } | |
| 70 | + = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } | |
| 86 | 71 | |
| 87 | 72 | struct kernel_symbol { |
| 88 | 73 | unsigned long value; |
| @@ -93,28 +78,20 @@ struct kernel_symbol { · 4 unmodified lines | ||
| 93 | 78 | |
| 94 | 79 | #ifdef __GENKSYMS__ |
| 95 | 80 | |
| 96 | −#define ___EXPORT_SYMBOL(sym,sec) __GENKSYMS_EXPORT_SYMBOL(sym) | |
| 97 | −#define ___EXPORT_SYMBOL_NS(sym,sec,ns) __GENKSYMS_EXPORT_SYMBOL(sym) | |
| 81 | +#define ___EXPORT_SYMBOL(sym, sec, ns) __GENKSYMS_EXPORT_SYMBOL(sym) | |
| 98 | 82 | |
| 99 | 83 | #else |
| 100 | 84 | |
| 101 | −#define ___export_symbol_common(sym, sec) \ | |
| 85 | +/* For every exported symbol, place a struct in the __ksymtab section */ | |
| 86 | +#define ___EXPORT_SYMBOL(sym, sec, ns) \ | |
| 102 | 87 | extern typeof(sym) sym; \ |
| 103 | 88 | __CRC_SYMBOL(sym, sec); \ |
| 104 | 89 | static const char __kstrtab_##sym[] \ |
| 105 | 90 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ |
| 106 | − = #sym \ | |
| 107 | − | |
| 108 | −/* For every exported symbol, place a struct in the __ksymtab section */ | |
| 109 | −#define ___EXPORT_SYMBOL_NS(sym, sec, ns) \ | |
| 110 | − ___export_symbol_common(sym, sec); \ | |
| 91 | + = #sym; \ | |
| 111 | 92 | static const char __kstrtabns_##sym[] \ |
| 112 | 93 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ |
| 113 | − = #ns; \ | |
| 114 | − __KSYMTAB_ENTRY_NS(sym, sec) | |
| 115 | − | |
| 116 | −#define ___EXPORT_SYMBOL(sym, sec) \ | |
| 117 | − ___export_symbol_common(sym, sec); \ | |
| 94 | + = ns; \ | |
| 118 | 95 | __KSYMTAB_ENTRY(sym, sec) |
| 119 | 96 | |
| 120 | 97 | #endif |
| @@ -126,8 +103,7 @@ struct kernel_symbol { · 5 unmodified lines | ||
| 126 | 103 | * be reused in other execution contexts such as the UEFI stub or the |
| 127 | 104 | * decompressor. |
| 128 | 105 | */ |
| 129 | −#define __EXPORT_SYMBOL_NS(sym, sec, ns) | |
| 130 | −#define __EXPORT_SYMBOL(sym, sec) | |
| 106 | +#define __EXPORT_SYMBOL(sym, sec, ns) | |
| 131 | 107 | |
| 132 | 108 | #elif defined(CONFIG_TRIM_UNUSED_KSYMS) |
| 133 | 109 | |
| @@ -143,48 +119,38 @@ struct kernel_symbol { · 9 unmodified lines | ||
| 143 | 119 | #define __ksym_marker(sym) \ |
| 144 | 120 | static int __ksym_marker_##sym[0] __section(".discard.ksym") __used |
| 145 | 121 | |
| 146 | −#define __EXPORT_SYMBOL(sym, sec) \ | |
| 147 | − __ksym_marker(sym); \ | |
| 148 | − __cond_export_sym(sym, sec, __is_defined(__KSYM_##sym)) | |
| 149 | −#define __cond_export_sym(sym, sec, conf) \ | |
| 150 | − ___cond_export_sym(sym, sec, conf) | |
| 151 | −#define ___cond_export_sym(sym, sec, enabled) \ | |
| 152 | − __cond_export_sym_##enabled(sym, sec) | |
| 153 | −#define __cond_export_sym_1(sym, sec) ___EXPORT_SYMBOL(sym, sec) | |
| 154 | −#define __cond_export_sym_0(sym, sec) /* nothing */ | |
| 155 | − | |
| 156 | −#define __EXPORT_SYMBOL_NS(sym, sec, ns) \ | |
| 122 | +#define __EXPORT_SYMBOL(sym, sec, ns) \ | |
| 157 | 123 | __ksym_marker(sym); \ |
| 158 | − __cond_export_ns_sym(sym, sec, ns, __is_defined(__KSYM_##sym)) | |
| 159 | −#define __cond_export_ns_sym(sym, sec, ns, conf) \ | |
| 160 | − ___cond_export_ns_sym(sym, sec, ns, conf) | |
| 161 | −#define ___cond_export_ns_sym(sym, sec, ns, enabled) \ | |
| 162 | − __cond_export_ns_sym_##enabled(sym, sec, ns) | |
| 163 | −#define __cond_export_ns_sym_1(sym, sec, ns) ___EXPORT_SYMBOL_NS(sym, sec, ns) | |
| 164 | −#define __cond_export_ns_sym_0(sym, sec, ns) /* nothing */ | |
| 124 | + __cond_export_sym(sym, sec, ns, __is_defined(__KSYM_##sym)) | |
| 125 | +#define __cond_export_sym(sym, sec, ns, conf) \ | |
| 126 | + ___cond_export_sym(sym, sec, ns, conf) | |
| 127 | +#define ___cond_export_sym(sym, sec, ns, enabled) \ | |
| 128 | + __cond_export_sym_##enabled(sym, sec, ns) | |
| 129 | +#define __cond_export_sym_1(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns) | |
| 130 | +#define __cond_export_sym_0(sym, sec, ns) /* nothing */ | |
| 165 | 131 | |
| 166 | 132 | #else |
| 167 | 133 | |
| 168 | −#define __EXPORT_SYMBOL_NS(sym,sec,ns) ___EXPORT_SYMBOL_NS(sym,sec,ns) | |
| 169 | −#define __EXPORT_SYMBOL(sym,sec) ___EXPORT_SYMBOL(sym,sec) | |
| 134 | +#define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns) | |
| 170 | 135 | |
| 171 | 136 | #endif /* CONFIG_MODULES */ |
| 172 | 137 | |
| 173 | 138 | #ifdef DEFAULT_SYMBOL_NAMESPACE |
| 174 | −#undef __EXPORT_SYMBOL | |
| 175 | −#define __EXPORT_SYMBOL(sym, sec) \ | |
| 176 | − __EXPORT_SYMBOL_NS(sym, sec, DEFAULT_SYMBOL_NAMESPACE) | |
| 139 | +#include <linux/stringify.h> | |
| 140 | +#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, __stringify(DEFAULT_SYMBOL_NAMESPACE)) | |
| 141 | +#else | |
| 142 | +#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "") | |
| 177 | 143 | #endif |
| 178 | 144 | |
| 179 | −#define EXPORT_SYMBOL(sym) __EXPORT_SYMBOL(sym, "") | |
| 180 | −#define EXPORT_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_gpl") | |
| 181 | −#define EXPORT_SYMBOL_GPL_FUTURE(sym) __EXPORT_SYMBOL(sym, "_gpl_future") | |
| 182 | −#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL_NS(sym, "", ns) | |
| 183 | −#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL_NS(sym, "_gpl", ns) | |
| 145 | +#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "") | |
| 146 | +#define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl") | |
| 147 | +#define EXPORT_SYMBOL_GPL_FUTURE(sym) _EXPORT_SYMBOL(sym, "_gpl_future") | |
| 148 | +#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns) | |
| 149 | +#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns) | |
| 184 | 150 | |
| 185 | 151 | #ifdef CONFIG_UNUSED_SYMBOLS |
| 186 | −#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") | |
| 187 | −#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") | |
| 152 | +#define EXPORT_UNUSED_SYMBOL(sym) _EXPORT_SYMBOL(sym, "_unused") | |
| 153 | +#define EXPORT_UNUSED_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_unused_gpl") | |
| 188 | 154 | #else |
| 189 | 155 | #define EXPORT_UNUSED_SYMBOL(sym) |
| 190 | 156 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) |
| @@ -104,6 +104,11 @@ enum fid_type { · 103 unmodified lines | ||
| 104 | 104 | */ |
| 105 | 105 | FILEID_LUSTRE = 0x97, |
| 106 | 106 | |
| 107 | + /* | |
| 108 | + * 64 bit unique kernfs id | |
| 109 | + */ | |
| 110 | + FILEID_KERNFS = 0xfe, | |
| 111 | + | |
| 107 | 112 | /* |
| 108 | 113 | * Filesystems must not use 0xff file ID. |
| 109 | 114 | */ |
| @@ -33,4 +33,14 @@ search_module_extables(unsigned long addr) · 32 unmodified lines | ||
| 33 | 33 | } |
| 34 | 34 | #endif /*CONFIG_MODULES*/ |
| 35 | 35 | |
| 36 | +#ifdef CONFIG_BPF_JIT | |
| 37 | +const struct exception_table_entry *search_bpf_extables(unsigned long addr); | |
| 38 | +#else | |
| 39 | +static inline const struct exception_table_entry * | |
| 40 | +search_bpf_extables(unsigned long addr) | |
| 41 | +{ | |
| 42 | + return NULL; | |
| 43 | +} | |
| 44 | +#endif | |
| 45 | + | |
| 36 | 46 | #endif /* _LINUX_EXTABLE_H */ |
| @@ -20,7 +20,10 @@ struct space_resv { · 19 unmodified lines | ||
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | 22 | #define FS_IOC_RESVSP _IOW('X', 40, struct space_resv) |
| 23 | +#define FS_IOC_UNRESVSP _IOW('X', 41, struct space_resv) | |
| 23 | 24 | #define FS_IOC_RESVSP64 _IOW('X', 42, struct space_resv) |
| 25 | +#define FS_IOC_UNRESVSP64 _IOW('X', 43, struct space_resv) | |
| 26 | +#define FS_IOC_ZERO_RANGE _IOW('X', 57, struct space_resv) | |
| 24 | 27 | |
| 25 | 28 | #define FALLOC_FL_SUPPORTED_MASK (FALLOC_FL_KEEP_SIZE | \ |
| 26 | 29 | FALLOC_FL_PUNCH_HOLE | \ |
| @@ -29,4 +32,27 @@ struct space_resv { · 2 unmodified lines | ||
| 29 | 32 | FALLOC_FL_INSERT_RANGE | \ |
| 30 | 33 | FALLOC_FL_UNSHARE_RANGE) |
| 31 | 34 | |
| 35 | +/* on ia32 l_start is on a 32-bit boundary */ | |
| 36 | +#if defined(CONFIG_X86_64) | |
| 37 | +struct space_resv_32 { | |
| 38 | + __s16 l_type; | |
| 39 | + __s16 l_whence; | |
| 40 | + __s64 l_start __attribute__((packed)); | |
| 41 | + /* len == 0 means until end of file */ | |
| 42 | + __s64 l_len __attribute__((packed)); | |
| 43 | + __s32 l_sysid; | |
| 44 | + __u32 l_pid; | |
| 45 | + __s32 l_pad[4]; /* reserve area */ | |
| 46 | +}; | |
| 47 | + | |
| 48 | +#define FS_IOC_RESVSP_32 _IOW ('X', 40, struct space_resv_32) | |
| 49 | +#define FS_IOC_UNRESVSP_32 _IOW ('X', 41, struct space_resv_32) | |
| 50 | +#define FS_IOC_RESVSP64_32 _IOW ('X', 42, struct space_resv_32) | |
| 51 | +#define FS_IOC_UNRESVSP64_32 _IOW ('X', 43, struct space_resv_32) | |
| 52 | +#define FS_IOC_ZERO_RANGE_32 _IOW ('X', 57, struct space_resv_32) | |
| 53 | + | |
| 54 | +int compat_ioctl_preallocate(struct file *, int, struct space_resv_32 __user *); | |
| 55 | + | |
| 56 | +#endif | |
| 57 | + | |
| 32 | 58 | #endif /* _FALLOC_H_ */ |
| @@ -607,7 +607,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, · 606 unmodified lines | ||
| 607 | 607 | extern int register_framebuffer(struct fb_info *fb_info); |
| 608 | 608 | extern void unregister_framebuffer(struct fb_info *fb_info); |
| 609 | 609 | extern void unlink_framebuffer(struct fb_info *fb_info); |
| 610 | −extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, | |
| 610 | +extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, | |
| 611 | 611 | const char *name); |
| 612 | 612 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, |
| 613 | 613 | const char *name, bool primary); |
| @@ -65,6 +65,9 @@ struct ctl_table_header; · 64 unmodified lines | ||
| 65 | 65 | /* unused opcode to mark special call to bpf_tail_call() helper */ |
| 66 | 66 | #define BPF_TAIL_CALL 0xf0 |
| 67 | 67 | |
| 68 | +/* unused opcode to mark special load instruction. Same as BPF_ABS */ | |
| 69 | +#define BPF_PROBE_MEM 0x20 | |
| 70 | + | |
| 68 | 71 | /* unused opcode to mark call to interpreter with arguments */ |
| 69 | 72 | #define BPF_CALL_ARGS 0xe0 |
| 70 | 73 | |
| @@ -417,7 +420,7 @@ static inline bool insn_is_zext(const struct bpf_insn *insn) · 346 unmodified lines | ||
| 417 | 420 | |
| 418 | 421 | #define BPF_FIELD_SIZEOF(type, field) \ |
| 419 | 422 | ({ \ |
| 420 | − const int __size = bytes_to_bpf_size(FIELD_SIZEOF(type, field)); \ | |
| 423 | + const int __size = bytes_to_bpf_size(sizeof_field(type, field)); \ | |
| 421 | 424 | BUILD_BUG_ON(__size < 0); \ |
| 422 | 425 | __size; \ |
| 423 | 426 | }) |
| @@ -464,10 +467,11 @@ static inline bool insn_is_zext(const struct bpf_insn *insn) · 40 unmodified lines | ||
| 464 | 467 | #define BPF_CALL_x(x, name, ...) \ |
| 465 | 468 | static __always_inline \ |
| 466 | 469 | u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ |
| 470 | + typedef u64 (*btf_##name)(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ | |
| 467 | 471 | u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ |
| 468 | 472 | u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ |
| 469 | 473 | { \ |
| 470 | − return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ | |
| 474 | + return ((btf_##name)____##name)(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ | |
| 471 | 475 | } \ |
| 472 | 476 | static __always_inline \ |
| 473 | 477 | u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) |
| @@ -493,7 +497,7 @@ static inline bool insn_is_zext(const struct bpf_insn *insn) · 19 unmodified lines | ||
| 493 | 497 | |
| 494 | 498 | #define bpf_target_off(TYPE, MEMBER, SIZE, PTR_SIZE) \ |
| 495 | 499 | ({ \ |
| 496 | − BUILD_BUG_ON(FIELD_SIZEOF(TYPE, MEMBER) != (SIZE)); \ | |
| 500 | + BUILD_BUG_ON(sizeof_field(TYPE, MEMBER) != (SIZE)); \ | |
| 497 | 501 | *(PTR_SIZE) = (SIZE); \ |
| 498 | 502 | offsetof(TYPE, MEMBER); \ |
| 499 | 503 | }) |
| @@ -511,10 +515,12 @@ struct sock_fprog_kern { · 11 unmodified lines | ||
| 511 | 515 | struct sock_filter *filter; |
| 512 | 516 | }; |
| 513 | 517 | |
| 518 | +/* Some arches need doubleword alignment for their instructions and/or data */ | |
| 519 | +#define BPF_IMAGE_ALIGNMENT 8 | |
| 520 | + | |
| 514 | 521 | struct bpf_binary_header { |
| 515 | 522 | u32 pages; |
| 516 | − /* Some arches need word alignment for their instructions */ | |
| 517 | − u8 image[] __aligned(4); | |
| 523 | + u8 image[] __aligned(BPF_IMAGE_ALIGNMENT); | |
| 518 | 524 | }; |
| 519 | 525 | |
| 520 | 526 | struct bpf_prog { |
| @@ -602,7 +608,7 @@ static inline void bpf_compute_data_pointers(struct sk_buff *skb) · 81 unmodified lines | ||
| 602 | 608 | { |
| 603 | 609 | struct bpf_skb_data_end *cb = (struct bpf_skb_data_end *)skb->cb; |
| 604 | 610 | |
| 605 | − BUILD_BUG_ON(sizeof(*cb) > FIELD_SIZEOF(struct sk_buff, cb)); | |
| 611 | + BUILD_BUG_ON(sizeof(*cb) > sizeof_field(struct sk_buff, cb)); | |
| 606 | 612 | cb->data_meta = skb->data - skb_metadata_len(skb); |
| 607 | 613 | cb->data_end = skb->data + skb_headlen(skb); |
| 608 | 614 | } |
| @@ -640,9 +646,9 @@ static inline u8 *bpf_skb_cb(struct sk_buff *skb) · 31 unmodified lines | ||
| 640 | 646 | * attached to sockets, we need to clear the bpf_skb_cb() area |
| 641 | 647 | * to not leak previous contents to user space. |
| 642 | 648 | */ |
| 643 | − BUILD_BUG_ON(FIELD_SIZEOF(struct __sk_buff, cb) != BPF_SKB_CB_LEN); | |
| 644 | − BUILD_BUG_ON(FIELD_SIZEOF(struct __sk_buff, cb) != | |
| 645 | − FIELD_SIZEOF(struct qdisc_skb_cb, data)); | |
| 649 | + BUILD_BUG_ON(sizeof_field(struct __sk_buff, cb) != BPF_SKB_CB_LEN); | |
| 650 | + BUILD_BUG_ON(sizeof_field(struct __sk_buff, cb) != | |
| 651 | + sizeof_field(struct qdisc_skb_cb, data)); | |
| 646 | 652 | |
| 647 | 653 | return qdisc_skb_cb(skb)->data; |
| 648 | 654 | } |
| @@ -770,8 +776,12 @@ bpf_ctx_narrow_access_offset(u32 off, u32 size, u32 size_default) · 121 unmodified lines | ||
| 770 | 776 | |
| 771 | 777 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) |
| 772 | 778 | { |
| 773 | − set_vm_flush_reset_perms(fp); | |
| 774 | − set_memory_ro((unsigned long)fp, fp->pages); | |
| 779 | +#ifndef CONFIG_BPF_JIT_ALWAYS_ON | |
| 780 | + if (!fp->jited) { | |
| 781 | + set_vm_flush_reset_perms(fp); | |
| 782 | + set_memory_ro((unsigned long)fp, fp->pages); | |
| 783 | + } | |
| 784 | +#endif | |
| 775 | 785 | } |
| 776 | 786 | |
| 777 | 787 | static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) |
| @@ -946,6 +956,9 @@ void *bpf_jit_alloc_exec(unsigned long size); · 168 unmodified lines | ||
| 946 | 956 | void bpf_jit_free_exec(void *addr); |
| 947 | 957 | void bpf_jit_free(struct bpf_prog *fp); |
| 948 | 958 | |
| 959 | +int bpf_jit_add_poke_descriptor(struct bpf_prog *prog, | |
| 960 | + struct bpf_jit_poke_descriptor *poke); | |
| 961 | + | |
| 949 | 962 | int bpf_jit_get_func_addr(const struct bpf_prog *prog, |
| 950 | 963 | const struct bpf_insn *insn, bool extra_pass, |
| 951 | 964 | u64 *func_addr, bool *func_addr_fixed); |
| @@ -1044,11 +1057,23 @@ static inline bool ebpf_jit_enabled(void) · 92 unmodified lines | ||
| 1044 | 1057 | return false; |
| 1045 | 1058 | } |
| 1046 | 1059 | |
| 1060 | +static inline bool bpf_jit_blinding_enabled(struct bpf_prog *prog) | |
| 1061 | +{ | |
| 1062 | + return false; | |
| 1063 | +} | |
| 1064 | + | |
| 1047 | 1065 | static inline bool bpf_prog_ebpf_jited(const struct bpf_prog *fp) |
| 1048 | 1066 | { |
| 1049 | 1067 | return false; |
| 1050 | 1068 | } |
| 1051 | 1069 | |
| 1070 | +static inline int | |
| 1071 | +bpf_jit_add_poke_descriptor(struct bpf_prog *prog, | |
| 1072 | + struct bpf_jit_poke_descriptor *poke) | |
| 1073 | +{ | |
| 1074 | + return -ENOTSUPP; | |
| 1075 | +} | |
| 1076 | + | |
| 1052 | 1077 | static inline void bpf_jit_free(struct bpf_prog *fp) |
| 1053 | 1078 | { |
| 1054 | 1079 | bpf_prog_unlock_free(fp); |
| @@ -0,0 +1,14 @@ | ||
| 1 | +/* SPDX-License-Identifier: BSD-2-Clause */ | |
| 2 | +/* | |
| 3 | + * Copyright 2019 Broadcom. | |
| 4 | + */ | |
| 5 | + | |
| 6 | +#ifndef _BROADCOM_TEE_BNXT_FW_H | |
| 7 | +#define _BROADCOM_TEE_BNXT_FW_H | |
| 8 | + | |
| 9 | +#include <linux/types.h> | |
| 10 | + | |
| 11 | +int tee_bnxt_fw_load(void); | |
| 12 | +int tee_bnxt_copy_coredump(void *buf, u32 offset, u32 size); | |
| 13 | + | |
| 14 | +#endif /* _BROADCOM_TEE_BNXT_FW_H */ | |
| @@ -41,6 +41,12 @@ · 40 unmodified lines | ||
| 41 | 41 | * |
| 42 | 42 | * SVC_STATUS_RSU_OK: |
| 43 | 43 | * Secure firmware accepts the request of remote status update (RSU). |
| 44 | + * | |
| 45 | + * SVC_STATUS_RSU_ERROR: | |
| 46 | + * Error encountered during remote system update. | |
| 47 | + * | |
| 48 | + * SVC_STATUS_RSU_NO_SUPPORT: | |
| 49 | + * Secure firmware doesn't support RSU retry or notify feature. | |
| 44 | 50 | */ |
| 45 | 51 | #define SVC_STATUS_RECONFIG_REQUEST_OK 0 |
| 46 | 52 | #define SVC_STATUS_RECONFIG_BUFFER_SUBMITTED 1 |
| @@ -50,6 +56,8 @@ · 3 unmodified lines | ||
| 50 | 56 | #define SVC_STATUS_RECONFIG_ERROR 5 |
| 51 | 57 | #define SVC_STATUS_RSU_OK 6 |
| 52 | 58 | #define SVC_STATUS_RSU_ERROR 7 |
| 59 | +#define SVC_STATUS_RSU_NO_SUPPORT 8 | |
| 60 | + | |
| 53 | 61 | /** |
| 54 | 62 | * Flag bit for COMMAND_RECONFIG |
| 55 | 63 | * |
| @@ -16,11 +16,14 @@ enum { · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | struct meson_sm_firmware; |
| 18 | 18 | |
| 19 | −int meson_sm_call(unsigned int cmd_index, u32 *ret, u32 arg0, u32 arg1, | |
| 20 | − u32 arg2, u32 arg3, u32 arg4); | |
| 21 | −int meson_sm_call_write(void *buffer, unsigned int b_size, unsigned int cmd_index, | |
| 22 | − u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); | |
| 23 | −int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index, | |
| 24 | − u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); | |
| 19 | +int meson_sm_call(struct meson_sm_firmware *fw, unsigned int cmd_index, | |
| 20 | + u32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); | |
| 21 | +int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer, | |
| 22 | + unsigned int b_size, unsigned int cmd_index, u32 arg0, | |
| 23 | + u32 arg1, u32 arg2, u32 arg3, u32 arg4); | |
| 24 | +int meson_sm_call_read(struct meson_sm_firmware *fw, void *buffer, | |
| 25 | + unsigned int bsize, unsigned int cmd_index, u32 arg0, | |
| 26 | + u32 arg1, u32 arg2, u32 arg3, u32 arg4); | |
| 27 | +struct meson_sm_firmware *meson_sm_get(struct device_node *firmware_node); | |
| 25 | 28 | |
| 26 | 29 | #endif /* _MESON_SM_FW_H_ */ |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | /* |
| 3 | 3 | * Xilinx Zynq MPSoC Firmware layer |
| 4 | 4 | * |
| 5 | − * Copyright (C) 2014-2018 Xilinx | |
| 5 | + * Copyright (C) 2014-2019 Xilinx | |
| 6 | 6 | * |
| 7 | 7 | * Michal Simek <michal.simek@xilinx.com> |
| 8 | 8 | * Davorin Mista <davorin.mista@aggios.com> |
| @@ -46,6 +46,7 @@ · 37 unmodified lines | ||
| 46 | 46 | #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U |
| 47 | 47 | #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U |
| 48 | 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U |
| 49 | +#define ZYNQMP_PM_CAPABILITY_UNUSABLE 0x8U | |
| 49 | 50 | |
| 50 | 51 | /* |
| 51 | 52 | * Firmware FPGA Manager flags |
| @@ -91,7 +92,8 @@ enum pm_ret_status { · 39 unmodified lines | ||
| 91 | 92 | }; |
| 92 | 93 | |
| 93 | 94 | enum pm_ioctl_id { |
| 94 | − IOCTL_SET_PLL_FRAC_MODE = 8, | |
| 95 | + IOCTL_SET_SD_TAPDELAY = 7, | |
| 96 | + IOCTL_SET_PLL_FRAC_MODE, | |
| 95 | 97 | IOCTL_GET_PLL_FRAC_MODE, |
| 96 | 98 | IOCTL_SET_PLL_FRAC_DATA, |
| 97 | 99 | IOCTL_GET_PLL_FRAC_DATA, |
| @@ -250,6 +252,16 @@ enum zynqmp_pm_request_ack { · 152 unmodified lines | ||
| 250 | 252 | ZYNQMP_PM_REQUEST_ACK_NON_BLOCKING, |
| 251 | 253 | }; |
| 252 | 254 | |
| 255 | +enum pm_node_id { | |
| 256 | + NODE_SD_0 = 39, | |
| 257 | + NODE_SD_1, | |
| 258 | +}; | |
| 259 | + | |
| 260 | +enum tap_delay_type { | |
| 261 | + PM_TAPDELAY_INPUT = 0, | |
| 262 | + PM_TAPDELAY_OUTPUT, | |
| 263 | +}; | |
| 264 | + | |
| 253 | 265 | /** |
| 254 | 266 | * struct zynqmp_pm_query_data - PM query data |
| 255 | 267 | * @qid: query ID |
| @@ -1727,6 +1727,13 @@ int vfs_mkobj(struct dentry *, umode_t, · 1726 unmodified lines | ||
| 1727 | 1727 | |
| 1728 | 1728 | extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
| 1729 | 1729 | |
| 1730 | +#ifdef CONFIG_COMPAT | |
| 1731 | +extern long compat_ptr_ioctl(struct file *file, unsigned int cmd, | |
| 1732 | + unsigned long arg); | |
| 1733 | +#else | |
| 1734 | +#define compat_ptr_ioctl NULL | |
| 1735 | +#endif | |
| 1736 | + | |
| 1730 | 1737 | /* |
| 1731 | 1738 | * VFS file helper functions. |
| 1732 | 1739 | */ |
| @@ -2547,7 +2554,7 @@ extern int finish_no_open(struct file *file, struct dentry *dentry); · 814 unmodified lines | ||
| 2547 | 2554 | |
| 2548 | 2555 | /* fs/ioctl.c */ |
| 2549 | 2556 | |
| 2550 | −extern int ioctl_preallocate(struct file *filp, void __user *argp); | |
| 2557 | +extern int ioctl_preallocate(struct file *filp, int mode, void __user *argp); | |
| 2551 | 2558 | |
| 2552 | 2559 | /* fs/dcache.c */ |
| 2553 | 2560 | extern void __init vfs_caches_init_early(void); |
| @@ -2632,8 +2639,6 @@ extern void bd_finish_claiming(struct block_device *bdev, · 78 unmodified lines | ||
| 2632 | 2639 | extern void bd_abort_claiming(struct block_device *bdev, |
| 2633 | 2640 | struct block_device *whole, void *holder); |
| 2634 | 2641 | extern void blkdev_put(struct block_device *bdev, fmode_t mode); |
| 2635 | −extern int __blkdev_reread_part(struct block_device *bdev); | |
| 2636 | −extern int blkdev_reread_part(struct block_device *bdev); | |
| 2637 | 2642 | |
| 2638 | 2643 | #ifdef CONFIG_SYSFS |
| 2639 | 2644 | extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); |
| @@ -2703,8 +2708,6 @@ extern void make_bad_inode(struct inode *); · 63 unmodified lines | ||
| 2703 | 2708 | extern bool is_bad_inode(struct inode *); |
| 2704 | 2709 | |
| 2705 | 2710 | #ifdef CONFIG_BLOCK |
| 2706 | −extern void check_disk_size_change(struct gendisk *disk, | |
| 2707 | − struct block_device *bdev, bool verbose); | |
| 2708 | 2711 | extern int revalidate_disk(struct gendisk *); |
| 2709 | 2712 | extern int check_disk_change(struct block_device *); |
| 2710 | 2713 | extern int __invalidate_device(struct block_device *, bool); |
| @@ -3153,7 +3156,6 @@ enum { · 442 unmodified lines | ||
| 3153 | 3156 | }; |
| 3154 | 3157 | |
| 3155 | 3158 | void dio_end_io(struct bio *bio); |
| 3156 | −void dio_warn_stale_pagecache(struct file *filp); | |
| 3157 | 3159 | |
| 3158 | 3160 | ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, |
| 3159 | 3161 | struct block_device *bdev, struct iov_iter *iter, |
| @@ -3198,6 +3200,11 @@ static inline void inode_dio_end(struct inode *inode) · 38 unmodified lines | ||
| 3198 | 3200 | wake_up_bit(&inode->i_state, __I_DIO_WAKEUP); |
| 3199 | 3201 | } |
| 3200 | 3202 | |
| 3203 | +/* | |
| 3204 | + * Warn about a page cache invalidation failure diring a direct I/O write. | |
| 3205 | + */ | |
| 3206 | +void dio_warn_stale_pagecache(struct file *filp); | |
| 3207 | + | |
| 3201 | 3208 | extern void inode_set_flags(struct inode *inode, unsigned int flags, |
| 3202 | 3209 | unsigned int mask); |
| 3203 | 3210 | |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #define FS_CRYPTO_BLOCK_SIZE 16 |
| 22 | 22 | |
| 23 | −struct fscrypt_ctx; | |
| 24 | 23 | struct fscrypt_info; |
| 25 | 24 | |
| 26 | 25 | struct fscrypt_str { |
| @@ -62,18 +61,9 @@ struct fscrypt_operations { · 35 unmodified lines | ||
| 62 | 61 | bool (*dummy_context)(struct inode *); |
| 63 | 62 | bool (*empty_dir)(struct inode *); |
| 64 | 63 | unsigned int max_namelen; |
| 65 | −}; | |
| 66 | − | |
| 67 | −/* Decryption work */ | |
| 68 | −struct fscrypt_ctx { | |
| 69 | − union { | |
| 70 | − struct { | |
| 71 | − struct bio *bio; | |
| 72 | − struct work_struct work; | |
| 73 | − }; | |
| 74 | − struct list_head free_list; /* Free list */ | |
| 75 | − }; | |
| 76 | − u8 flags; /* Flags */ | |
| 64 | + bool (*has_stable_inodes)(struct super_block *sb); | |
| 65 | + void (*get_ino_and_lblk_bits)(struct super_block *sb, | |
| 66 | + int *ino_bits_ret, int *lblk_bits_ret); | |
| 77 | 67 | }; |
| 78 | 68 | |
| 79 | 69 | static inline bool fscrypt_has_encryption_key(const struct inode *inode) |
| @@ -102,8 +92,6 @@ static inline void fscrypt_handle_d_move(struct dentry *dentry) · 22 unmodified lines | ||
| 102 | 92 | |
| 103 | 93 | /* crypto.c */ |
| 104 | 94 | extern void fscrypt_enqueue_decrypt_work(struct work_struct *); |
| 105 | −extern struct fscrypt_ctx *fscrypt_get_ctx(gfp_t); | |
| 106 | −extern void fscrypt_release_ctx(struct fscrypt_ctx *); | |
| 107 | 95 | |
| 108 | 96 | extern struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, |
| 109 | 97 | unsigned int len, |
| @@ -244,8 +232,6 @@ static inline bool fscrypt_match_name(const struct fscrypt_name *fname, · 134 unmodified lines | ||
| 244 | 232 | |
| 245 | 233 | /* bio.c */ |
| 246 | 234 | extern void fscrypt_decrypt_bio(struct bio *); |
| 247 | −extern void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, | |
| 248 | − struct bio *bio); | |
| 249 | 235 | extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t, |
| 250 | 236 | unsigned int); |
| 251 | 237 | |
| @@ -295,16 +281,6 @@ static inline void fscrypt_enqueue_decrypt_work(struct work_struct *work) · 43 unmodified lines | ||
| 295 | 281 | { |
| 296 | 282 | } |
| 297 | 283 | |
| 298 | −static inline struct fscrypt_ctx *fscrypt_get_ctx(gfp_t gfp_flags) | |
| 299 | −{ | |
| 300 | − return ERR_PTR(-EOPNOTSUPP); | |
| 301 | −} | |
| 302 | − | |
| 303 | −static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx) | |
| 304 | −{ | |
| 305 | − return; | |
| 306 | −} | |
| 307 | − | |
| 308 | 284 | static inline struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, |
| 309 | 285 | unsigned int len, |
| 310 | 286 | unsigned int offs, |
| @@ -484,11 +460,6 @@ static inline void fscrypt_decrypt_bio(struct bio *bio) · 173 unmodified lines | ||
| 484 | 460 | { |
| 485 | 461 | } |
| 486 | 462 | |
| 487 | −static inline void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, | |
| 488 | − struct bio *bio) | |
| 489 | −{ | |
| 490 | −} | |
| 491 | − | |
| 492 | 463 | static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, |
| 493 | 464 | sector_t pblk, unsigned int len) |
| 494 | 465 | { |
| @@ -403,6 +403,8 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); · 402 unmodified lines | ||
| 403 | 403 | |
| 404 | 404 | void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); |
| 405 | 405 | |
| 406 | +struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev); | |
| 407 | + | |
| 406 | 408 | extern struct bus_type fsl_mc_bus_type; |
| 407 | 409 | |
| 408 | 410 | extern struct device_type fsl_mc_bus_dprc_type; |
| @@ -51,6 +51,7 @@ static inline void early_trace_init(void) { } · 50 unmodified lines | ||
| 51 | 51 | |
| 52 | 52 | struct module; |
| 53 | 53 | struct ftrace_hash; |
| 54 | +struct ftrace_direct_func; | |
| 54 | 55 | |
| 55 | 56 | #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \ |
| 56 | 57 | defined(CONFIG_DYNAMIC_FTRACE) |
| @@ -142,24 +143,30 @@ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops); · 85 unmodified lines | ||
| 142 | 143 | * PID - Is affected by set_ftrace_pid (allows filtering on those pids) |
| 143 | 144 | * RCU - Set when the ops can only be called when RCU is watching. |
| 144 | 145 | * TRACE_ARRAY - The ops->private points to a trace_array descriptor. |
| 146 | + * PERMANENT - Set when the ops is permanent and should not be affected by | |
| 147 | + * ftrace_enabled. | |
| 148 | + * DIRECT - Used by the direct ftrace_ops helper for direct functions | |
| 149 | + * (internal ftrace only, should not be used by others) | |
| 145 | 150 | */ |
| 146 | 151 | enum { |
| 147 | − FTRACE_OPS_FL_ENABLED = 1 << 0, | |
| 148 | − FTRACE_OPS_FL_DYNAMIC = 1 << 1, | |
| 149 | − FTRACE_OPS_FL_SAVE_REGS = 1 << 2, | |
| 150 | − FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 3, | |
| 151 | − FTRACE_OPS_FL_RECURSION_SAFE = 1 << 4, | |
| 152 | − FTRACE_OPS_FL_STUB = 1 << 5, | |
| 153 | − FTRACE_OPS_FL_INITIALIZED = 1 << 6, | |
| 154 | − FTRACE_OPS_FL_DELETED = 1 << 7, | |
| 155 | − FTRACE_OPS_FL_ADDING = 1 << 8, | |
| 156 | − FTRACE_OPS_FL_REMOVING = 1 << 9, | |
| 157 | − FTRACE_OPS_FL_MODIFYING = 1 << 10, | |
| 158 | − FTRACE_OPS_FL_ALLOC_TRAMP = 1 << 11, | |
| 159 | − FTRACE_OPS_FL_IPMODIFY = 1 << 12, | |
| 160 | − FTRACE_OPS_FL_PID = 1 << 13, | |
| 161 | − FTRACE_OPS_FL_RCU = 1 << 14, | |
| 162 | − FTRACE_OPS_FL_TRACE_ARRAY = 1 << 15, | |
| 152 | + FTRACE_OPS_FL_ENABLED = BIT(0), | |
| 153 | + FTRACE_OPS_FL_DYNAMIC = BIT(1), | |
| 154 | + FTRACE_OPS_FL_SAVE_REGS = BIT(2), | |
| 155 | + FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = BIT(3), | |
| 156 | + FTRACE_OPS_FL_RECURSION_SAFE = BIT(4), | |
| 157 | + FTRACE_OPS_FL_STUB = BIT(5), | |
| 158 | + FTRACE_OPS_FL_INITIALIZED = BIT(6), | |
| 159 | + FTRACE_OPS_FL_DELETED = BIT(7), | |
| 160 | + FTRACE_OPS_FL_ADDING = BIT(8), | |
| 161 | + FTRACE_OPS_FL_REMOVING = BIT(9), | |
| 162 | + FTRACE_OPS_FL_MODIFYING = BIT(10), | |
| 163 | + FTRACE_OPS_FL_ALLOC_TRAMP = BIT(11), | |
| 164 | + FTRACE_OPS_FL_IPMODIFY = BIT(12), | |
| 165 | + FTRACE_OPS_FL_PID = BIT(13), | |
| 166 | + FTRACE_OPS_FL_RCU = BIT(14), | |
| 167 | + FTRACE_OPS_FL_TRACE_ARRAY = BIT(15), | |
| 168 | + FTRACE_OPS_FL_PERMANENT = BIT(16), | |
| 169 | + FTRACE_OPS_FL_DIRECT = BIT(17), | |
| 163 | 170 | }; |
| 164 | 171 | |
| 165 | 172 | #ifdef CONFIG_DYNAMIC_FTRACE |
| @@ -239,6 +246,75 @@ static inline void ftrace_free_init_mem(void) { } · 73 unmodified lines | ||
| 239 | 246 | static inline void ftrace_free_mem(struct module *mod, void *start, void *end) { } |
| 240 | 247 | #endif /* CONFIG_FUNCTION_TRACER */ |
| 241 | 248 | |
| 249 | +struct ftrace_func_entry { | |
| 250 | + struct hlist_node hlist; | |
| 251 | + unsigned long ip; | |
| 252 | + unsigned long direct; /* for direct lookup only */ | |
| 253 | +}; | |
| 254 | + | |
| 255 | +struct dyn_ftrace; | |
| 256 | + | |
| 257 | +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS | |
| 258 | +extern int ftrace_direct_func_count; | |
| 259 | +int register_ftrace_direct(unsigned long ip, unsigned long addr); | |
| 260 | +int unregister_ftrace_direct(unsigned long ip, unsigned long addr); | |
| 261 | +int modify_ftrace_direct(unsigned long ip, unsigned long old_addr, unsigned long new_addr); | |
| 262 | +struct ftrace_direct_func *ftrace_find_direct_func(unsigned long addr); | |
| 263 | +int ftrace_modify_direct_caller(struct ftrace_func_entry *entry, | |
| 264 | + struct dyn_ftrace *rec, | |
| 265 | + unsigned long old_addr, | |
| 266 | + unsigned long new_addr); | |
| 267 | +unsigned long ftrace_find_rec_direct(unsigned long ip); | |
| 268 | +#else | |
| 269 | +# define ftrace_direct_func_count 0 | |
| 270 | +static inline int register_ftrace_direct(unsigned long ip, unsigned long addr) | |
| 271 | +{ | |
| 272 | + return -ENOTSUPP; | |
| 273 | +} | |
| 274 | +static inline int unregister_ftrace_direct(unsigned long ip, unsigned long addr) | |
| 275 | +{ | |
| 276 | + return -ENOTSUPP; | |
| 277 | +} | |
| 278 | +static inline int modify_ftrace_direct(unsigned long ip, | |
| 279 | + unsigned long old_addr, unsigned long new_addr) | |
| 280 | +{ | |
| 281 | + return -ENOTSUPP; | |
| 282 | +} | |
| 283 | +static inline struct ftrace_direct_func *ftrace_find_direct_func(unsigned long addr) | |
| 284 | +{ | |
| 285 | + return NULL; | |
| 286 | +} | |
| 287 | +static inline int ftrace_modify_direct_caller(struct ftrace_func_entry *entry, | |
| 288 | + struct dyn_ftrace *rec, | |
| 289 | + unsigned long old_addr, | |
| 290 | + unsigned long new_addr) | |
| 291 | +{ | |
| 292 | + return -ENODEV; | |
| 293 | +} | |
| 294 | +static inline unsigned long ftrace_find_rec_direct(unsigned long ip) | |
| 295 | +{ | |
| 296 | + return 0; | |
| 297 | +} | |
| 298 | +#endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */ | |
| 299 | + | |
| 300 | +#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS | |
| 301 | +/* | |
| 302 | + * This must be implemented by the architecture. | |
| 303 | + * It is the way the ftrace direct_ops helper, when called | |
| 304 | + * via ftrace (because there's other callbacks besides the | |
| 305 | + * direct call), can inform the architecture's trampoline that this | |
| 306 | + * routine has a direct caller, and what the caller is. | |
| 307 | + * | |
| 308 | + * For example, in x86, it returns the direct caller | |
| 309 | + * callback function via the regs->orig_ax parameter. | |
| 310 | + * Then in the ftrace trampoline, if this is set, it makes | |
| 311 | + * the return from the trampoline jump to the direct caller | |
| 312 | + * instead of going back to the function it just traced. | |
| 313 | + */ | |
| 314 | +static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs, | |
| 315 | + unsigned long addr) { } | |
| 316 | +#endif /* CONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */ | |
| 317 | + | |
| 242 | 318 | #ifdef CONFIG_STACK_TRACER |
| 243 | 319 | |
| 244 | 320 | extern int stack_tracer_enabled; |
| @@ -291,8 +367,6 @@ static inline void stack_tracer_enable(void) { } · 46 unmodified lines | ||
| 291 | 367 | int ftrace_arch_code_modify_prepare(void); |
| 292 | 368 | int ftrace_arch_code_modify_post_process(void); |
| 293 | 369 | |
| 294 | −struct dyn_ftrace; | |
| 295 | − | |
| 296 | 370 | enum ftrace_bug_type { |
| 297 | 371 | FTRACE_BUG_UNKNOWN, |
| 298 | 372 | FTRACE_BUG_INIT, |
| @@ -330,6 +404,7 @@ bool is_ftrace_trampoline(unsigned long addr); · 31 unmodified lines | ||
| 330 | 404 | * REGS_EN - the function is set up to save regs. |
| 331 | 405 | * IPMODIFY - the record allows for the IP address to be changed. |
| 332 | 406 | * DISABLED - the record is not ready to be touched yet |
| 407 | + * DIRECT - there is a direct function to call | |
| 333 | 408 | * |
| 334 | 409 | * When a new ftrace_ops is registered and wants a function to save |
| 335 | 410 | * pt_regs, the rec->flag REGS is set. When the function has been |
| @@ -345,10 +420,12 @@ enum { · 9 unmodified lines | ||
| 345 | 420 | FTRACE_FL_TRAMP_EN = (1UL << 27), |
| 346 | 421 | FTRACE_FL_IPMODIFY = (1UL << 26), |
| 347 | 422 | FTRACE_FL_DISABLED = (1UL << 25), |
| 423 | + FTRACE_FL_DIRECT = (1UL << 24), | |
| 424 | + FTRACE_FL_DIRECT_EN = (1UL << 23), | |
| 348 | 425 | }; |
| 349 | 426 | |
| 350 | −#define FTRACE_REF_MAX_SHIFT 25 | |
| 351 | −#define FTRACE_FL_BITS 7 | |
| 427 | +#define FTRACE_REF_MAX_SHIFT 23 | |
| 428 | +#define FTRACE_FL_BITS 9 | |
| 352 | 429 | #define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1) |
| 353 | 430 | #define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT) |
| 354 | 431 | #define FTRACE_REF_MAX ((1UL << FTRACE_REF_MAX_SHIFT) - 1) |
| @@ -499,7 +576,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; } · 144 unmodified lines | ||
| 499 | 576 | /** |
| 500 | 577 | * ftrace_make_nop - convert code into nop |
| 501 | 578 | * @mod: module structure if called by module load initialization |
| 502 | − * @rec: the mcount call site record | |
| 579 | + * @rec: the call site record (e.g. mcount/fentry) | |
| 503 | 580 | * @addr: the address that the call site should be calling |
| 504 | 581 | * |
| 505 | 582 | * This is a very sensitive operation and great care needs |
| @@ -520,9 +597,38 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; } · 14 unmodified lines | ||
| 520 | 597 | extern int ftrace_make_nop(struct module *mod, |
| 521 | 598 | struct dyn_ftrace *rec, unsigned long addr); |
| 522 | 599 | |
| 600 | + | |
| 601 | +/** | |
| 602 | + * ftrace_init_nop - initialize a nop call site | |
| 603 | + * @mod: module structure if called by module load initialization | |
| 604 | + * @rec: the call site record (e.g. mcount/fentry) | |
| 605 | + * | |
| 606 | + * This is a very sensitive operation and great care needs | |
| 607 | + * to be taken by the arch. The operation should carefully | |
| 608 | + * read the location, check to see if what is read is indeed | |
| 609 | + * what we expect it to be, and then on success of the compare, | |
| 610 | + * it should write to the location. | |
| 611 | + * | |
| 612 | + * The code segment at @rec->ip should contain the contents created by | |
| 613 | + * the compiler | |
| 614 | + * | |
| 615 | + * Return must be: | |
| 616 | + * 0 on success | |
| 617 | + * -EFAULT on error reading the location | |
| 618 | + * -EINVAL on a failed compare of the contents | |
| 619 | + * -EPERM on error writing to the location | |
| 620 | + * Any other value will be considered a failure. | |
| 621 | + */ | |
| 622 | +#ifndef ftrace_init_nop | |
| 623 | +static inline int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec) | |
| 624 | +{ | |
| 625 | + return ftrace_make_nop(mod, rec, MCOUNT_ADDR); | |
| 626 | +} | |
| 627 | +#endif | |
| 628 | + | |
| 523 | 629 | /** |
| 524 | 630 | * ftrace_make_call - convert a nop call site into a call to addr |
| 525 | − * @rec: the mcount call site record | |
| 631 | + * @rec: the call site record (e.g. mcount/fentry) | |
| 526 | 632 | * @addr: the address that the call site should call |
| 527 | 633 | * |
| 528 | 634 | * This is a very sensitive operation and great care needs |
| @@ -545,7 +651,7 @@ extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); · 16 unmodified lines | ||
| 545 | 651 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS |
| 546 | 652 | /** |
| 547 | 653 | * ftrace_modify_call - convert from one addr to another (no nop) |
| 548 | − * @rec: the mcount call site record | |
| 654 | + * @rec: the call site record (e.g. mcount/fentry) | |
| 549 | 655 | * @old_addr: the address expected to be currently called to |
| 550 | 656 | * @addr: the address to change to |
| 551 | 657 | * |
| @@ -709,6 +815,11 @@ static inline unsigned long get_lock_parent_ip(void) · 157 unmodified lines | ||
| 709 | 815 | |
| 710 | 816 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 711 | 817 | extern void ftrace_init(void); |
| 818 | +#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY | |
| 819 | +#define FTRACE_CALLSITE_SECTION "__patchable_function_entries" | |
| 820 | +#else | |
| 821 | +#define FTRACE_CALLSITE_SECTION "__mcount_loc" | |
| 822 | +#endif | |
| 712 | 823 | #else |
| 713 | 824 | static inline void ftrace_init(void) { } |
| 714 | 825 | #endif |
| @@ -2,7 +2,9 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _LINUX_FUTEX_H |
| 3 | 3 | #define _LINUX_FUTEX_H |
| 4 | 4 | |
| 5 | +#include <linux/sched.h> | |
| 5 | 6 | #include <linux/ktime.h> |
| 7 | + | |
| 6 | 8 | #include <uapi/linux/futex.h> |
| 7 | 9 | |
| 8 | 10 | struct inode; |
| @@ -48,15 +50,35 @@ union futex_key { · 39 unmodified lines | ||
| 48 | 50 | #define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } } |
| 49 | 51 | |
| 50 | 52 | #ifdef CONFIG_FUTEX |
| 51 | −extern void exit_robust_list(struct task_struct *curr); | |
| 53 | +enum { | |
| 54 | + FUTEX_STATE_OK, | |
| 55 | + FUTEX_STATE_EXITING, | |
| 56 | + FUTEX_STATE_DEAD, | |
| 57 | +}; | |
| 52 | 58 | |
| 53 | −long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, | |
| 54 | − u32 __user *uaddr2, u32 val2, u32 val3); | |
| 55 | −#else | |
| 56 | −static inline void exit_robust_list(struct task_struct *curr) | |
| 59 | +static inline void futex_init_task(struct task_struct *tsk) | |
| 57 | 60 | { |
| 61 | + tsk->robust_list = NULL; | |
| 62 | +#ifdef CONFIG_COMPAT | |
| 63 | + tsk->compat_robust_list = NULL; | |
| 64 | +#endif | |
| 65 | + INIT_LIST_HEAD(&tsk->pi_state_list); | |
| 66 | + tsk->pi_state_cache = NULL; | |
| 67 | + tsk->futex_state = FUTEX_STATE_OK; | |
| 68 | + mutex_init(&tsk->futex_exit_mutex); | |
| 58 | 69 | } |
| 59 | 70 | |
| 71 | +void futex_exit_recursive(struct task_struct *tsk); | |
| 72 | +void futex_exit_release(struct task_struct *tsk); | |
| 73 | +void futex_exec_release(struct task_struct *tsk); | |
| 74 | + | |
| 75 | +long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, | |
| 76 | + u32 __user *uaddr2, u32 val2, u32 val3); | |
| 77 | +#else | |
| 78 | +static inline void futex_init_task(struct task_struct *tsk) { } | |
| 79 | +static inline void futex_exit_recursive(struct task_struct *tsk) { } | |
| 80 | +static inline void futex_exit_release(struct task_struct *tsk) { } | |
| 81 | +static inline void futex_exec_release(struct task_struct *tsk) { } | |
| 60 | 82 | static inline long do_futex(u32 __user *uaddr, int op, u32 val, |
| 61 | 83 | ktime_t *timeout, u32 __user *uaddr2, |
| 62 | 84 | u32 val2, u32 val3) |
| @@ -65,12 +87,4 @@ static inline long do_futex(u32 __user *uaddr, int op, u32 val, · 2 unmodified lines | ||
| 65 | 87 | } |
| 66 | 88 | #endif |
| 67 | 89 | |
| 68 | −#ifdef CONFIG_FUTEX_PI | |
| 69 | −extern void exit_pi_state_list(struct task_struct *curr); | |
| 70 | −#else | |
| 71 | −static inline void exit_pi_state_list(struct task_struct *curr) | |
| 72 | −{ | |
| 73 | −} | |
| 74 | −#endif | |
| 75 | − | |
| 76 | 90 | #endif |
| @@ -17,6 +17,7 @@ struct device; · 16 unmodified lines | ||
| 17 | 17 | struct fwnode_handle { |
| 18 | 18 | struct fwnode_handle *secondary; |
| 19 | 19 | const struct fwnode_operations *ops; |
| 20 | + struct device *dev; | |
| 20 | 21 | }; |
| 21 | 22 | |
| 22 | 23 | /** |
| @@ -49,13 +50,15 @@ struct fwnode_reference_args { · 26 unmodified lines | ||
| 49 | 50 | * struct fwnode_operations - Operations for fwnode interface |
| 50 | 51 | * @get: Get a reference to an fwnode. |
| 51 | 52 | * @put: Put a reference to an fwnode. |
| 53 | + * @device_is_available: Return true if the device is available. | |
| 52 | 54 | * @device_get_match_data: Return the device driver match data. |
| 53 | 55 | * @property_present: Return true if a property is present. |
| 54 | − * @property_read_integer_array: Read an array of integer properties. Return | |
| 55 | − * zero on success, a negative error code | |
| 56 | − * otherwise. | |
| 56 | + * @property_read_int_array: Read an array of integer properties. Return zero on | |
| 57 | + * success, a negative error code otherwise. | |
| 57 | 58 | * @property_read_string_array: Read an array of string properties. Return zero |
| 58 | 59 | * on success, a negative error code otherwise. |
| 60 | + * @get_name: Return the name of an fwnode. | |
| 61 | + * @get_name_prefix: Get a prefix for a node (for printing purposes). | |
| 59 | 62 | * @get_parent: Return the parent of an fwnode. |
| 60 | 63 | * @get_next_child_node: Return the next child node in an iteration. |
| 61 | 64 | * @get_named_child_node: Return a child node with a given name. |
| @@ -65,6 +68,44 @@ struct fwnode_reference_args { · 3 unmodified lines | ||
| 65 | 68 | * endpoint node. |
| 66 | 69 | * @graph_get_port_parent: Return the parent node of a port node. |
| 67 | 70 | * @graph_parse_endpoint: Parse endpoint for port and endpoint id. |
| 71 | + * @add_links: Called after the device corresponding to the fwnode is added | |
| 72 | + * using device_add(). The function is expected to create device | |
| 73 | + * links to all the suppliers of the device that are available at | |
| 74 | + * the time this function is called. The function must NOT stop | |
| 75 | + * at the first failed device link if other unlinked supplier | |
| 76 | + * devices are present in the system. This is necessary for the | |
| 77 | + * driver/bus sync_state() callbacks to work correctly. | |
| 78 | + * | |
| 79 | + * For example, say Device-C depends on suppliers Device-S1 and | |
| 80 | + * Device-S2 and the dependency is listed in that order in the | |
| 81 | + * firmware. Say, S1 gets populated from the firmware after | |
| 82 | + * late_initcall_sync(). Say S2 is populated and probed way | |
| 83 | + * before that in device_initcall(). When C is populated, if this | |
| 84 | + * add_links() function doesn't continue past a "failed linking to | |
| 85 | + * S1" and continue linking C to S2, then S2 will get a | |
| 86 | + * sync_state() callback before C is probed. This is because from | |
| 87 | + * the perspective of S2, C was never a consumer when its | |
| 88 | + * sync_state() evaluation is done. To avoid this, the add_links() | |
| 89 | + * function has to go through all available suppliers of the | |
| 90 | + * device (that corresponds to this fwnode) and link to them | |
| 91 | + * before returning. | |
| 92 | + * | |
| 93 | + * If some suppliers are not yet available (indicated by an error | |
| 94 | + * return value), this function will be called again when other | |
| 95 | + * devices are added to allow creating device links to any newly | |
| 96 | + * available suppliers. | |
| 97 | + * | |
| 98 | + * Return 0 if device links have been successfully created to all | |
| 99 | + * the known suppliers of this device or if the supplier | |
| 100 | + * information is not known. | |
| 101 | + * | |
| 102 | + * Return -ENODEV if the suppliers needed for probing this device | |
| 103 | + * have not been registered yet (because device links can only be | |
| 104 | + * created to devices registered with the driver core). | |
| 105 | + * | |
| 106 | + * Return -EAGAIN if some of the suppliers of this device have not | |
| 107 | + * been registered yet, but none of those suppliers are necessary | |
| 108 | + * for probing the device. | |
| 68 | 109 | */ |
| 69 | 110 | struct fwnode_operations { |
| 70 | 111 | struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); |
| @@ -82,6 +123,8 @@ struct fwnode_operations { · 11 unmodified lines | ||
| 82 | 123 | (*property_read_string_array)(const struct fwnode_handle *fwnode_handle, |
| 83 | 124 | const char *propname, const char **val, |
| 84 | 125 | size_t nval); |
| 126 | + const char *(*get_name)(const struct fwnode_handle *fwnode); | |
| 127 | + const char *(*get_name_prefix)(const struct fwnode_handle *fwnode); | |
| 85 | 128 | struct fwnode_handle *(*get_parent)(const struct fwnode_handle *fwnode); |
| 86 | 129 | struct fwnode_handle * |
| 87 | 130 | (*get_next_child_node)(const struct fwnode_handle *fwnode, |
| @@ -102,6 +145,8 @@ struct fwnode_operations { · 14 unmodified lines | ||
| 102 | 145 | (*graph_get_port_parent)(struct fwnode_handle *fwnode); |
| 103 | 146 | int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode, |
| 104 | 147 | struct fwnode_endpoint *endpoint); |
| 148 | + int (*add_links)(const struct fwnode_handle *fwnode, | |
| 149 | + struct device *dev); | |
| 105 | 150 | }; |
| 106 | 151 | |
| 107 | 152 | #define fwnode_has_op(fwnode, op) \ |
| @@ -123,5 +168,6 @@ struct fwnode_operations { · 15 unmodified lines | ||
| 123 | 168 | if (fwnode_has_op(fwnode, op)) \ |
| 124 | 169 | (fwnode)->ops->op(fwnode, ## __VA_ARGS__); \ |
| 125 | 170 | } while (false) |
| 171 | +#define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev) | |
| 126 | 172 | |
| 127 | 173 | #endif |
| @@ -206,7 +206,7 @@ extern struct gen_pool *devm_gen_pool_create(struct device *dev, · 205 unmodified lines | ||
| 206 | 206 | int min_alloc_order, int nid, const char *name); |
| 207 | 207 | extern struct gen_pool *gen_pool_get(struct device *dev, const char *name); |
| 208 | 208 | |
| 209 | −bool addr_in_gen_pool(struct gen_pool *pool, unsigned long start, | |
| 209 | +extern bool gen_pool_has_addr(struct gen_pool *pool, unsigned long start, | |
| 210 | 210 | size_t size); |
| 211 | 211 | |
| 212 | 212 | #ifdef CONFIG_OF |
| @@ -621,9 +621,10 @@ extern void blk_invalidate_devt(dev_t devt); · 620 unmodified lines | ||
| 621 | 621 | extern dev_t blk_lookup_devt(const char *name, int partno); |
| 622 | 622 | extern char *disk_name (struct gendisk *hd, int partno, char *buf); |
| 623 | 623 | |
| 624 | +int bdev_disk_changed(struct block_device *bdev, bool invalidate); | |
| 625 | +int blk_add_partitions(struct gendisk *disk, struct block_device *bdev); | |
| 626 | +int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev); | |
| 624 | 627 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); |
| 625 | −extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | |
| 626 | −extern int invalidate_partitions(struct gendisk *disk, struct block_device *bdev); | |
| 627 | 628 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
| 628 | 629 | int partno, sector_t start, |
| 629 | 630 | sector_t len, int flags, |
| @@ -612,6 +612,8 @@ static inline bool pm_suspended_storage(void) · 611 unmodified lines | ||
| 612 | 612 | /* The below functions must be run on a range from a single zone. */ |
| 613 | 613 | extern int alloc_contig_range(unsigned long start, unsigned long end, |
| 614 | 614 | unsigned migratetype, gfp_t gfp_mask); |
| 615 | +extern struct page *alloc_contig_pages(unsigned long nr_pages, gfp_t gfp_mask, | |
| 616 | + int nid, nodemask_t *nodemask); | |
| 615 | 617 | #endif |
| 616 | 618 | void free_contig_range(unsigned long pfn, unsigned int nr_pages); |
| 617 | 619 | |
| @@ -176,11 +176,15 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, · 175 unmodified lines | ||
| 176 | 176 | const char *propname, int index, |
| 177 | 177 | enum gpiod_flags dflags, |
| 178 | 178 | const char *label); |
| 179 | −struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, | |
| 180 | − const char *con_id, int index, | |
| 181 | − struct fwnode_handle *child, | |
| 182 | − enum gpiod_flags flags, | |
| 183 | − const char *label); | |
| 179 | +struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, | |
| 180 | + const char *con_id, int index, | |
| 181 | + enum gpiod_flags flags, | |
| 182 | + const char *label); | |
| 183 | +struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, | |
| 184 | + struct fwnode_handle *child, | |
| 185 | + const char *con_id, int index, | |
| 186 | + enum gpiod_flags flags, | |
| 187 | + const char *label); | |
| 184 | 188 | |
| 185 | 189 | #else /* CONFIG_GPIOLIB */ |
| 186 | 190 | |
| @@ -531,6 +535,38 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, · 344 unmodified lines | ||
| 531 | 535 | return ERR_PTR(-ENOSYS); |
| 532 | 536 | } |
| 533 | 537 | |
| 538 | +static inline | |
| 539 | +struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, | |
| 540 | + const char *con_id, int index, | |
| 541 | + enum gpiod_flags flags, | |
| 542 | + const char *label) | |
| 543 | +{ | |
| 544 | + return ERR_PTR(-ENOSYS); | |
| 545 | +} | |
| 546 | + | |
| 547 | +static inline | |
| 548 | +struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, | |
| 549 | + struct fwnode_handle *fwnode, | |
| 550 | + const char *con_id, int index, | |
| 551 | + enum gpiod_flags flags, | |
| 552 | + const char *label) | |
| 553 | +{ | |
| 554 | + return ERR_PTR(-ENOSYS); | |
| 555 | +} | |
| 556 | + | |
| 557 | +#endif /* CONFIG_GPIOLIB */ | |
| 558 | + | |
| 559 | +static inline | |
| 560 | +struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev, | |
| 561 | + struct fwnode_handle *fwnode, | |
| 562 | + const char *con_id, | |
| 563 | + enum gpiod_flags flags, | |
| 564 | + const char *label) | |
| 565 | +{ | |
| 566 | + return devm_fwnode_gpiod_get_index(dev, fwnode, con_id, 0, | |
| 567 | + flags, label); | |
| 568 | +} | |
| 569 | + | |
| 534 | 570 | static inline |
| 535 | 571 | struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, |
| 536 | 572 | const char *con_id, int index, |
| @@ -538,11 +574,10 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, · 1 unmodified line | ||
| 538 | 574 | enum gpiod_flags flags, |
| 539 | 575 | const char *label) |
| 540 | 576 | { |
| 541 | − return ERR_PTR(-ENOSYS); | |
| 577 | + return devm_fwnode_gpiod_get_index(dev, child, con_id, index, | |
| 578 | + flags, label); | |
| 542 | 579 | } |
| 543 | 580 | |
| 544 | −#endif /* CONFIG_GPIOLIB */ | |
| 545 | − | |
| 546 | 581 | static inline |
| 547 | 582 | struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev, |
| 548 | 583 | const char *con_id, |
| @@ -550,8 +585,7 @@ struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev, · 1 unmodified line | ||
| 550 | 585 | enum gpiod_flags flags, |
| 551 | 586 | const char *label) |
| 552 | 587 | { |
| 553 | − return devm_fwnode_get_index_gpiod_from_child(dev, con_id, 0, child, | |
| 554 | − flags, label); | |
| 588 | + return devm_fwnode_gpiod_get_index(dev, child, con_id, 0, flags, label); | |
| 555 | 589 | } |
| 556 | 590 | |
| 557 | 591 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO) |
| @@ -22,6 +22,9 @@ enum gpio_lookup_flags; · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | struct gpio_chip; |
| 24 | 24 | |
| 25 | +#define GPIO_LINE_DIRECTION_IN 1 | |
| 26 | +#define GPIO_LINE_DIRECTION_OUT 0 | |
| 27 | + | |
| 25 | 28 | /** |
| 26 | 29 | * struct gpio_irq_chip - GPIO interrupt controller |
| 27 | 30 | */ |
| @@ -286,6 +289,9 @@ struct gpio_irq_chip { · 258 unmodified lines | ||
| 286 | 289 | * state (such as pullup/pulldown configuration). |
| 287 | 290 | * @init_valid_mask: optional routine to initialize @valid_mask, to be used if |
| 288 | 291 | * not all GPIOs are valid. |
| 292 | + * @add_pin_ranges: optional routine to initialize pin ranges, to be used when | |
| 293 | + * requires special mapping of the pins that provides GPIO functionality. | |
| 294 | + * It is called after adding GPIO chip and before adding IRQ chip. | |
| 289 | 295 | * @base: identifies the first GPIO number handled by this chip; |
| 290 | 296 | * or, if negative during registration, requests dynamic ID allocation. |
| 291 | 297 | * DEPRECATION: providing anything non-negative and nailing the base |
| @@ -376,6 +382,8 @@ struct gpio_chip { · 84 unmodified lines | ||
| 376 | 382 | unsigned long *valid_mask, |
| 377 | 383 | unsigned int ngpios); |
| 378 | 384 | |
| 385 | + int (*add_pin_ranges)(struct gpio_chip *chip); | |
| 386 | + | |
| 379 | 387 | int base; |
| 380 | 388 | u16 ngpio; |
| 381 | 389 | const char *const *names; |
| @@ -62,37 +62,12 @@ · 61 unmodified lines | ||
| 62 | 62 | #include <linux/kconfig.h> |
| 63 | 63 | #include <asm/pgtable.h> |
| 64 | 64 | |
| 65 | −#ifdef CONFIG_HMM_MIRROR | |
| 66 | − | |
| 67 | 65 | #include <linux/device.h> |
| 68 | 66 | #include <linux/migrate.h> |
| 69 | 67 | #include <linux/memremap.h> |
| 70 | 68 | #include <linux/completion.h> |
| 71 | 69 | #include <linux/mmu_notifier.h> |
| 72 | 70 | |
| 73 | − | |
| 74 | −/* | |
| 75 | − * struct hmm - HMM per mm struct | |
| 76 | − * | |
| 77 | − * @mm: mm struct this HMM struct is bound to | |
| 78 | − * @lock: lock protecting ranges list | |
| 79 | − * @ranges: list of range being snapshotted | |
| 80 | − * @mirrors: list of mirrors for this mm | |
| 81 | − * @mmu_notifier: mmu notifier to track updates to CPU page table | |
| 82 | − * @mirrors_sem: read/write semaphore protecting the mirrors list | |
| 83 | − * @wq: wait queue for user waiting on a range invalidation | |
| 84 | − * @notifiers: count of active mmu notifiers | |
| 85 | − */ | |
| 86 | −struct hmm { | |
| 87 | − struct mmu_notifier mmu_notifier; | |
| 88 | − spinlock_t ranges_lock; | |
| 89 | − struct list_head ranges; | |
| 90 | − struct list_head mirrors; | |
| 91 | − struct rw_semaphore mirrors_sem; | |
| 92 | − wait_queue_head_t wq; | |
| 93 | − long notifiers; | |
| 94 | −}; | |
| 95 | − | |
| 96 | 71 | /* |
| 97 | 72 | * hmm_pfn_flag_e - HMM flag enums |
| 98 | 73 | * |
| @@ -145,6 +120,8 @@ enum hmm_pfn_value_e { · 46 unmodified lines | ||
| 145 | 120 | /* |
| 146 | 121 | * struct hmm_range - track invalidation lock on virtual address range |
| 147 | 122 | * |
| 123 | + * @notifier: a mmu_interval_notifier that includes the start/end | |
| 124 | + * @notifier_seq: result of mmu_interval_read_begin() | |
| 148 | 125 | * @hmm: the core HMM structure this range is active against |
| 149 | 126 | * @vma: the vm area struct for the range |
| 150 | 127 | * @list: all range lock are on a list |
| @@ -159,8 +136,8 @@ enum hmm_pfn_value_e { · 8 unmodified lines | ||
| 159 | 136 | * @valid: pfns array did not change since it has been fill by an HMM function |
| 160 | 137 | */ |
| 161 | 138 | struct hmm_range { |
| 162 | − struct hmm *hmm; | |
| 163 | − struct list_head list; | |
| 139 | + struct mmu_interval_notifier *notifier; | |
| 140 | + unsigned long notifier_seq; | |
| 164 | 141 | unsigned long start; |
| 165 | 142 | unsigned long end; |
| 166 | 143 | uint64_t *pfns; |
| @@ -169,32 +146,8 @@ struct hmm_range { · 2 unmodified lines | ||
| 169 | 146 | uint64_t default_flags; |
| 170 | 147 | uint64_t pfn_flags_mask; |
| 171 | 148 | uint8_t pfn_shift; |
| 172 | − bool valid; | |
| 173 | 149 | }; |
| 174 | 150 | |
| 175 | −/* | |
| 176 | − * hmm_range_wait_until_valid() - wait for range to be valid | |
| 177 | − * @range: range affected by invalidation to wait on | |
| 178 | − * @timeout: time out for wait in ms (ie abort wait after that period of time) | |
| 179 | − * Return: true if the range is valid, false otherwise. | |
| 180 | − */ | |
| 181 | −static inline bool hmm_range_wait_until_valid(struct hmm_range *range, | |
| 182 | − unsigned long timeout) | |
| 183 | −{ | |
| 184 | − return wait_event_timeout(range->hmm->wq, range->valid, | |
| 185 | − msecs_to_jiffies(timeout)) != 0; | |
| 186 | −} | |
| 187 | − | |
| 188 | −/* | |
| 189 | − * hmm_range_valid() - test if a range is valid or not | |
| 190 | − * @range: range | |
| 191 | − * Return: true if the range is valid, false otherwise. | |
| 192 | − */ | |
| 193 | −static inline bool hmm_range_valid(struct hmm_range *range) | |
| 194 | −{ | |
| 195 | − return range->valid; | |
| 196 | −} | |
| 197 | − | |
| 198 | 151 | /* |
| 199 | 152 | * hmm_device_entry_to_page() - return struct page pointed to by a device entry |
| 200 | 153 | * @range: range use to decode device entry value |
| @@ -264,120 +217,6 @@ static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, · 63 unmodified lines | ||
| 264 | 217 | range->flags[HMM_PFN_VALID]; |
| 265 | 218 | } |
| 266 | 219 | |
| 267 | −/* | |
| 268 | − * Mirroring: how to synchronize device page table with CPU page table. | |
| 269 | − * | |
| 270 | − * A device driver that is participating in HMM mirroring must always | |
| 271 | − * synchronize with CPU page table updates. For this, device drivers can either | |
| 272 | − * directly use mmu_notifier APIs or they can use the hmm_mirror API. Device | |
| 273 | − * drivers can decide to register one mirror per device per process, or just | |
| 274 | − * one mirror per process for a group of devices. The pattern is: | |
| 275 | − * | |
| 276 | − * int device_bind_address_space(..., struct mm_struct *mm, ...) | |
| 277 | − * { | |
| 278 | − * struct device_address_space *das; | |
| 279 | − * | |
| 280 | − * // Device driver specific initialization, and allocation of das | |
| 281 | − * // which contains an hmm_mirror struct as one of its fields. | |
| 282 | − * ... | |
| 283 | − * | |
| 284 | − * ret = hmm_mirror_register(&das->mirror, mm, &device_mirror_ops); | |
| 285 | − * if (ret) { | |
| 286 | − * // Cleanup on error | |
| 287 | − * return ret; | |
| 288 | − * } | |
| 289 | − * | |
| 290 | − * // Other device driver specific initialization | |
| 291 | − * ... | |
| 292 | − * } | |
| 293 | − * | |
| 294 | − * Once an hmm_mirror is registered for an address space, the device driver | |
| 295 | − * will get callbacks through sync_cpu_device_pagetables() operation (see | |
| 296 | − * hmm_mirror_ops struct). | |
| 297 | − * | |
| 298 | − * Device driver must not free the struct containing the hmm_mirror struct | |
| 299 | − * before calling hmm_mirror_unregister(). The expected usage is to do that when | |
| 300 | − * the device driver is unbinding from an address space. | |
| 301 | − * | |
| 302 | − * | |
| 303 | − * void device_unbind_address_space(struct device_address_space *das) | |
| 304 | − * { | |
| 305 | − * // Device driver specific cleanup | |
| 306 | − * ... | |
| 307 | − * | |
| 308 | − * hmm_mirror_unregister(&das->mirror); | |
| 309 | − * | |
| 310 | − * // Other device driver specific cleanup, and now das can be freed | |
| 311 | − * ... | |
| 312 | − * } | |
| 313 | − */ | |
| 314 | − | |
| 315 | −struct hmm_mirror; | |
| 316 | − | |
| 317 | −/* | |
| 318 | − * struct hmm_mirror_ops - HMM mirror device operations callback | |
| 319 | − * | |
| 320 | − * @update: callback to update range on a device | |
| 321 | − */ | |
| 322 | −struct hmm_mirror_ops { | |
| 323 | − /* release() - release hmm_mirror | |
| 324 | − * | |
| 325 | − * @mirror: pointer to struct hmm_mirror | |
| 326 | − * | |
| 327 | − * This is called when the mm_struct is being released. The callback | |
| 328 | − * must ensure that all access to any pages obtained from this mirror | |
| 329 | − * is halted before the callback returns. All future access should | |
| 330 | − * fault. | |
| 331 | − */ | |
| 332 | − void (*release)(struct hmm_mirror *mirror); | |
| 333 | − | |
| 334 | − /* sync_cpu_device_pagetables() - synchronize page tables | |
| 335 | − * | |
| 336 | − * @mirror: pointer to struct hmm_mirror | |
| 337 | − * @update: update information (see struct mmu_notifier_range) | |
| 338 | − * Return: -EAGAIN if mmu_notifier_range_blockable(update) is false | |
| 339 | − * and callback needs to block, 0 otherwise. | |
| 340 | − * | |
| 341 | − * This callback ultimately originates from mmu_notifiers when the CPU | |
| 342 | − * page table is updated. The device driver must update its page table | |
| 343 | − * in response to this callback. The update argument tells what action | |
| 344 | − * to perform. | |
| 345 | − * | |
| 346 | − * The device driver must not return from this callback until the device | |
| 347 | − * page tables are completely updated (TLBs flushed, etc); this is a | |
| 348 | − * synchronous call. | |
| 349 | − */ | |
| 350 | − int (*sync_cpu_device_pagetables)( | |
| 351 | − struct hmm_mirror *mirror, | |
| 352 | − const struct mmu_notifier_range *update); | |
| 353 | −}; | |
| 354 | − | |
| 355 | −/* | |
| 356 | − * struct hmm_mirror - mirror struct for a device driver | |
| 357 | − * | |
| 358 | − * @hmm: pointer to struct hmm (which is unique per mm_struct) | |
| 359 | − * @ops: device driver callback for HMM mirror operations | |
| 360 | − * @list: for list of mirrors of a given mm | |
| 361 | − * | |
| 362 | − * Each address space (mm_struct) being mirrored by a device must register one | |
| 363 | − * instance of an hmm_mirror struct with HMM. HMM will track the list of all | |
| 364 | − * mirrors for each mm_struct. | |
| 365 | − */ | |
| 366 | −struct hmm_mirror { | |
| 367 | − struct hmm *hmm; | |
| 368 | − const struct hmm_mirror_ops *ops; | |
| 369 | − struct list_head list; | |
| 370 | −}; | |
| 371 | − | |
| 372 | −int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm); | |
| 373 | −void hmm_mirror_unregister(struct hmm_mirror *mirror); | |
| 374 | − | |
| 375 | −/* | |
| 376 | − * Please see Documentation/vm/hmm.rst for how to use the range API. | |
| 377 | − */ | |
| 378 | −int hmm_range_register(struct hmm_range *range, struct hmm_mirror *mirror); | |
| 379 | −void hmm_range_unregister(struct hmm_range *range); | |
| 380 | − | |
| 381 | 220 | /* |
| 382 | 221 | * Retry fault if non-blocking, drop mmap_sem and return -EAGAIN in that case. |
| 383 | 222 | */ |
| @@ -386,16 +225,17 @@ void hmm_range_unregister(struct hmm_range *range); · 2 unmodified lines | ||
| 386 | 225 | /* Don't fault in missing PTEs, just snapshot the current state. */ |
| 387 | 226 | #define HMM_FAULT_SNAPSHOT (1 << 1) |
| 388 | 227 | |
| 228 | +#ifdef CONFIG_HMM_MIRROR | |
| 229 | +/* | |
| 230 | + * Please see Documentation/vm/hmm.rst for how to use the range API. | |
| 231 | + */ | |
| 389 | 232 | long hmm_range_fault(struct hmm_range *range, unsigned int flags); |
| 390 | − | |
| 391 | −long hmm_range_dma_map(struct hmm_range *range, | |
| 392 | − struct device *device, | |
| 393 | − dma_addr_t *daddrs, | |
| 394 | − unsigned int flags); | |
| 395 | −long hmm_range_dma_unmap(struct hmm_range *range, | |
| 396 | − struct device *device, | |
| 397 | − dma_addr_t *daddrs, | |
| 398 | − bool dirty); | |
| 233 | +#else | |
| 234 | +static inline long hmm_range_fault(struct hmm_range *range, unsigned int flags) | |
| 235 | +{ | |
| 236 | + return -EOPNOTSUPP; | |
| 237 | +} | |
| 238 | +#endif | |
| 399 | 239 | |
| 400 | 240 | /* |
| 401 | 241 | * HMM_RANGE_DEFAULT_TIMEOUT - default timeout (ms) when waiting for a range |
| @@ -406,6 +246,4 @@ long hmm_range_dma_unmap(struct hmm_range *range, · 4 unmodified lines | ||
| 406 | 246 | */ |
| 407 | 247 | #define HMM_RANGE_DEFAULT_TIMEOUT 1000 |
| 408 | 248 | |
| 409 | −#endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */ | |
| 410 | − | |
| 411 | 249 | #endif /* LINUX_HMM_H */ |
| @@ -18,6 +18,7 @@ enum host1x_class { · 17 unmodified lines | ||
| 18 | 18 | }; |
| 19 | 19 | |
| 20 | 20 | struct host1x_client; |
| 21 | +struct iommu_group; | |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | 24 | * struct host1x_client_ops - host1x client operations |
| @@ -34,6 +35,7 @@ struct host1x_client_ops { · 10 unmodified lines | ||
| 34 | 35 | * @list: list node for the host1x client |
| 35 | 36 | * @parent: pointer to struct device representing the host1x controller |
| 36 | 37 | * @dev: pointer to struct device backing this host1x client |
| 38 | + * @group: IOMMU group that this client is a member of | |
| 37 | 39 | * @ops: host1x client operations |
| 38 | 40 | * @class: host1x class represented by this client |
| 39 | 41 | * @channel: host1x channel associated with this client |
| @@ -44,6 +46,7 @@ struct host1x_client { · 4 unmodified lines | ||
| 44 | 46 | struct list_head list; |
| 45 | 47 | struct device *parent; |
| 46 | 48 | struct device *dev; |
| 49 | + struct iommu_group *group; | |
| 47 | 50 | |
| 48 | 51 | const struct host1x_client_ops *ops; |
| 49 | 52 | |
| @@ -64,8 +67,9 @@ struct sg_table; · 14 unmodified lines | ||
| 64 | 67 | struct host1x_bo_ops { |
| 65 | 68 | struct host1x_bo *(*get)(struct host1x_bo *bo); |
| 66 | 69 | void (*put)(struct host1x_bo *bo); |
| 67 | − dma_addr_t (*pin)(struct host1x_bo *bo, struct sg_table **sgt); | |
| 68 | − void (*unpin)(struct host1x_bo *bo, struct sg_table *sgt); | |
| 70 | + struct sg_table *(*pin)(struct device *dev, struct host1x_bo *bo, | |
| 71 | + dma_addr_t *phys); | |
| 72 | + void (*unpin)(struct device *dev, struct sg_table *sgt); | |
| 69 | 73 | void *(*mmap)(struct host1x_bo *bo); |
| 70 | 74 | void (*munmap)(struct host1x_bo *bo, void *addr); |
| 71 | 75 | void *(*kmap)(struct host1x_bo *bo, unsigned int pagenum); |
| @@ -92,15 +96,17 @@ static inline void host1x_bo_put(struct host1x_bo *bo) · 20 unmodified lines | ||
| 92 | 96 | bo->ops->put(bo); |
| 93 | 97 | } |
| 94 | 98 | |
| 95 | −static inline dma_addr_t host1x_bo_pin(struct host1x_bo *bo, | |
| 96 | − struct sg_table **sgt) | |
| 99 | +static inline struct sg_table *host1x_bo_pin(struct device *dev, | |
| 100 | + struct host1x_bo *bo, | |
| 101 | + dma_addr_t *phys) | |
| 97 | 102 | { |
| 98 | − return bo->ops->pin(bo, sgt); | |
| 103 | + return bo->ops->pin(dev, bo, phys); | |
| 99 | 104 | } |
| 100 | 105 | |
| 101 | −static inline void host1x_bo_unpin(struct host1x_bo *bo, struct sg_table *sgt) | |
| 106 | +static inline void host1x_bo_unpin(struct device *dev, struct host1x_bo *bo, | |
| 107 | + struct sg_table *sgt) | |
| 102 | 108 | { |
| 103 | − bo->ops->unpin(bo, sgt); | |
| 109 | + bo->ops->unpin(dev, sgt); | |
| 104 | 110 | } |
| 105 | 111 | |
| 106 | 112 | static inline void *host1x_bo_mmap(struct host1x_bo *bo) |
| @@ -158,7 +164,7 @@ u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base); · 51 unmodified lines | ||
| 158 | 164 | struct host1x_channel; |
| 159 | 165 | struct host1x_job; |
| 160 | 166 | |
| 161 | −struct host1x_channel *host1x_channel_request(struct device *dev); | |
| 167 | +struct host1x_channel *host1x_channel_request(struct host1x_client *client); | |
| 162 | 168 | struct host1x_channel *host1x_channel_get(struct host1x_channel *channel); |
| 163 | 169 | void host1x_channel_put(struct host1x_channel *channel); |
| 164 | 170 | int host1x_job_submit(struct host1x_job *job); |
| @@ -167,6 +173,9 @@ int host1x_job_submit(struct host1x_job *job); · 2 unmodified lines | ||
| 167 | 173 | * host1x job |
| 168 | 174 | */ |
| 169 | 175 | |
| 176 | +#define HOST1X_RELOC_READ (1 << 0) | |
| 177 | +#define HOST1X_RELOC_WRITE (1 << 1) | |
| 178 | + | |
| 170 | 179 | struct host1x_reloc { |
| 171 | 180 | struct { |
| 172 | 181 | struct host1x_bo *bo; |
| @@ -177,6 +186,7 @@ struct host1x_reloc { · 4 unmodified lines | ||
| 177 | 186 | unsigned long offset; |
| 178 | 187 | } target; |
| 179 | 188 | unsigned long shift; |
| 189 | + unsigned long flags; | |
| 180 | 190 | }; |
| 181 | 191 | |
| 182 | 192 | struct host1x_job { |
| @@ -456,12 +456,18 @@ extern u64 hrtimer_next_event_without(const struct hrtimer *exclude); · 455 unmodified lines | ||
| 456 | 456 | |
| 457 | 457 | extern bool hrtimer_active(const struct hrtimer *timer); |
| 458 | 458 | |
| 459 | −/* | |
| 460 | − * Helper function to check, whether the timer is on one of the queues | |
| 459 | +/** | |
| 460 | + * hrtimer_is_queued = check, whether the timer is on one of the queues | |
| 461 | + * @timer: Timer to check | |
| 462 | + * | |
| 463 | + * Returns: True if the timer is queued, false otherwise | |
| 464 | + * | |
| 465 | + * The function can be used lockless, but it gives only a current snapshot. | |
| 461 | 466 | */ |
| 462 | −static inline int hrtimer_is_queued(struct hrtimer *timer) | |
| 467 | +static inline bool hrtimer_is_queued(struct hrtimer *timer) | |
| 463 | 468 | { |
| 464 | − return timer->state & HRTIMER_STATE_ENQUEUED; | |
| 469 | + /* The READ_ONCE pairs with the update functions of timer->state */ | |
| 470 | + return !!(READ_ONCE(timer->state) & HRTIMER_STATE_ENQUEUED); | |
| 465 | 471 | } |
| 466 | 472 | |
| 467 | 473 | /* |
| @@ -216,7 +216,6 @@ static inline int is_swap_pmd(pmd_t pmd) · 215 unmodified lines | ||
| 216 | 216 | static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, |
| 217 | 217 | struct vm_area_struct *vma) |
| 218 | 218 | { |
| 219 | − VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma); | |
| 220 | 219 | if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) |
| 221 | 220 | return __pmd_trans_huge_lock(pmd, vma); |
| 222 | 221 | else |
| @@ -225,7 +224,6 @@ static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, · 2 unmodified lines | ||
| 225 | 224 | static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, |
| 226 | 225 | struct vm_area_struct *vma) |
| 227 | 226 | { |
| 228 | − VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma); | |
| 229 | 227 | if (pud_trans_huge(*pud) || pud_devmap(*pud)) |
| 230 | 228 | return __pud_trans_huge_lock(pud, vma); |
| 231 | 229 | else |
| @@ -105,8 +105,7 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason); · 104 unmodified lines | ||
| 105 | 105 | void free_huge_page(struct page *page); |
| 106 | 106 | void hugetlb_fix_reserve_counts(struct inode *inode); |
| 107 | 107 | extern struct mutex *hugetlb_fault_mutex_table; |
| 108 | −u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, | |
| 109 | − pgoff_t idx, unsigned long address); | |
| 108 | +u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); | |
| 110 | 109 | |
| 111 | 110 | pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); |
| 112 | 111 | |
| @@ -164,38 +163,130 @@ static inline void adjust_range_if_pmd_sharing_possible( · 51 unmodified lines | ||
| 164 | 163 | { |
| 165 | 164 | } |
| 166 | 165 | |
| 167 | −#define follow_hugetlb_page(m,v,p,vs,a,b,i,w,n) ({ BUG(); 0; }) | |
| 168 | −#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) | |
| 169 | −#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | |
| 166 | +static inline long follow_hugetlb_page(struct mm_struct *mm, | |
| 167 | + struct vm_area_struct *vma, struct page **pages, | |
| 168 | + struct vm_area_struct **vmas, unsigned long *position, | |
| 169 | + unsigned long *nr_pages, long i, unsigned int flags, | |
| 170 | + int *nonblocking) | |
| 171 | +{ | |
| 172 | + BUG(); | |
| 173 | + return 0; | |
| 174 | +} | |
| 175 | + | |
| 176 | +static inline struct page *follow_huge_addr(struct mm_struct *mm, | |
| 177 | + unsigned long address, int write) | |
| 178 | +{ | |
| 179 | + return ERR_PTR(-EINVAL); | |
| 180 | +} | |
| 181 | + | |
| 182 | +static inline int copy_hugetlb_page_range(struct mm_struct *dst, | |
| 183 | + struct mm_struct *src, struct vm_area_struct *vma) | |
| 184 | +{ | |
| 185 | + BUG(); | |
| 186 | + return 0; | |
| 187 | +} | |
| 188 | + | |
| 170 | 189 | static inline void hugetlb_report_meminfo(struct seq_file *m) |
| 171 | 190 | { |
| 172 | 191 | } |
| 173 | −#define hugetlb_report_node_meminfo(n, buf) 0 | |
| 192 | + | |
| 193 | +static inline int hugetlb_report_node_meminfo(int nid, char *buf) | |
| 194 | +{ | |
| 195 | + return 0; | |
| 196 | +} | |
| 197 | + | |
| 174 | 198 | static inline void hugetlb_show_meminfo(void) |
| 175 | 199 | { |
| 176 | 200 | } |
| 177 | −#define follow_huge_pd(vma, addr, hpd, flags, pdshift) NULL | |
| 178 | −#define follow_huge_pmd(mm, addr, pmd, flags) NULL | |
| 179 | −#define follow_huge_pud(mm, addr, pud, flags) NULL | |
| 180 | −#define follow_huge_pgd(mm, addr, pgd, flags) NULL | |
| 181 | −#define prepare_hugepage_range(file, addr, len) (-EINVAL) | |
| 182 | −#define pmd_huge(x) 0 | |
| 183 | −#define pud_huge(x) 0 | |
| 184 | −#define is_hugepage_only_range(mm, addr, len) 0 | |
| 185 | −#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) | |
| 186 | −#define hugetlb_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \ | |
| 187 | − src_addr, pagep) ({ BUG(); 0; }) | |
| 188 | −#define huge_pte_offset(mm, address, sz) 0 | |
| 201 | + | |
| 202 | +static inline struct page *follow_huge_pd(struct vm_area_struct *vma, | |
| 203 | + unsigned long address, hugepd_t hpd, int flags, | |
| 204 | + int pdshift) | |
| 205 | +{ | |
| 206 | + return NULL; | |
| 207 | +} | |
| 208 | + | |
| 209 | +static inline struct page *follow_huge_pmd(struct mm_struct *mm, | |
| 210 | + unsigned long address, pmd_t *pmd, int flags) | |
| 211 | +{ | |
| 212 | + return NULL; | |
| 213 | +} | |
| 214 | + | |
| 215 | +static inline struct page *follow_huge_pud(struct mm_struct *mm, | |
| 216 | + unsigned long address, pud_t *pud, int flags) | |
| 217 | +{ | |
| 218 | + return NULL; | |
| 219 | +} | |
| 220 | + | |
| 221 | +static inline struct page *follow_huge_pgd(struct mm_struct *mm, | |
| 222 | + unsigned long address, pgd_t *pgd, int flags) | |
| 223 | +{ | |
| 224 | + return NULL; | |
| 225 | +} | |
| 226 | + | |
| 227 | +static inline int prepare_hugepage_range(struct file *file, | |
| 228 | + unsigned long addr, unsigned long len) | |
| 229 | +{ | |
| 230 | + return -EINVAL; | |
| 231 | +} | |
| 232 | + | |
| 233 | +static inline int pmd_huge(pmd_t pmd) | |
| 234 | +{ | |
| 235 | + return 0; | |
| 236 | +} | |
| 237 | + | |
| 238 | +static inline int pud_huge(pud_t pud) | |
| 239 | +{ | |
| 240 | + return 0; | |
| 241 | +} | |
| 242 | + | |
| 243 | +static inline int is_hugepage_only_range(struct mm_struct *mm, | |
| 244 | + unsigned long addr, unsigned long len) | |
| 245 | +{ | |
| 246 | + return 0; | |
| 247 | +} | |
| 248 | + | |
| 249 | +static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, | |
| 250 | + unsigned long addr, unsigned long end, | |
| 251 | + unsigned long floor, unsigned long ceiling) | |
| 252 | +{ | |
| 253 | + BUG(); | |
| 254 | +} | |
| 255 | + | |
| 256 | +static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, | |
| 257 | + pte_t *dst_pte, | |
| 258 | + struct vm_area_struct *dst_vma, | |
| 259 | + unsigned long dst_addr, | |
| 260 | + unsigned long src_addr, | |
| 261 | + struct page **pagep) | |
| 262 | +{ | |
| 263 | + BUG(); | |
| 264 | + return 0; | |
| 265 | +} | |
| 266 | + | |
| 267 | +static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, | |
| 268 | + unsigned long sz) | |
| 269 | +{ | |
| 270 | + return NULL; | |
| 271 | +} | |
| 189 | 272 | |
| 190 | 273 | static inline bool isolate_huge_page(struct page *page, struct list_head *list) |
| 191 | 274 | { |
| 192 | 275 | return false; |
| 193 | 276 | } |
| 194 | −#define putback_active_hugepage(p) do {} while (0) | |
| 195 | −#define move_hugetlb_state(old, new, reason) do {} while (0) | |
| 196 | 277 | |
| 197 | −static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma, | |
| 198 | − unsigned long address, unsigned long end, pgprot_t newprot) | |
| 278 | +static inline void putback_active_hugepage(struct page *page) | |
| 279 | +{ | |
| 280 | +} | |
| 281 | + | |
| 282 | +static inline void move_hugetlb_state(struct page *oldpage, | |
| 283 | + struct page *newpage, int reason) | |
| 284 | +{ | |
| 285 | +} | |
| 286 | + | |
| 287 | +static inline unsigned long hugetlb_change_protection( | |
| 288 | + struct vm_area_struct *vma, unsigned long address, | |
| 289 | + unsigned long end, pgprot_t newprot) | |
| 199 | 290 | { |
| 200 | 291 | return 0; |
| 201 | 292 | } |
| @@ -213,9 +304,10 @@ static inline void __unmap_hugepage_range(struct mmu_gather *tlb, · 11 unmodified lines | ||
| 213 | 304 | { |
| 214 | 305 | BUG(); |
| 215 | 306 | } |
| 307 | + | |
| 216 | 308 | static inline vm_fault_t hugetlb_fault(struct mm_struct *mm, |
| 217 | − struct vm_area_struct *vma, unsigned long address, | |
| 218 | − unsigned int flags) | |
| 309 | + struct vm_area_struct *vma, unsigned long address, | |
| 310 | + unsigned int flags) | |
| 219 | 311 | { |
| 220 | 312 | BUG(); |
| 221 | 313 | return 0; |
| @@ -182,19 +182,21 @@ static inline u32 hv_get_avail_to_write_percent( · 181 unmodified lines | ||
| 182 | 182 | * 2 . 4 (Windows 8) |
| 183 | 183 | * 3 . 0 (Windows 8 R2) |
| 184 | 184 | * 4 . 0 (Windows 10) |
| 185 | + * 4 . 1 (Windows 10 RS3) | |
| 185 | 186 | * 5 . 0 (Newer Windows 10) |
| 187 | + * 5 . 1 (Windows 10 RS4) | |
| 188 | + * 5 . 2 (Windows Server 2019, RS5) | |
| 186 | 189 | */ |
| 187 | 190 | |
| 188 | 191 | #define VERSION_WS2008 ((0 << 16) | (13)) |
| 189 | 192 | #define VERSION_WIN7 ((1 << 16) | (1)) |
| 190 | 193 | #define VERSION_WIN8 ((2 << 16) | (4)) |
| 191 | 194 | #define VERSION_WIN8_1 ((3 << 16) | (0)) |
| 192 | −#define VERSION_WIN10 ((4 << 16) | (0)) | |
| 195 | +#define VERSION_WIN10 ((4 << 16) | (0)) | |
| 196 | +#define VERSION_WIN10_V4_1 ((4 << 16) | (1)) | |
| 193 | 197 | #define VERSION_WIN10_V5 ((5 << 16) | (0)) |
| 194 | − | |
| 195 | −#define VERSION_INVAL -1 | |
| 196 | − | |
| 197 | −#define VERSION_CURRENT VERSION_WIN10_V5 | |
| 198 | +#define VERSION_WIN10_V5_1 ((5 << 16) | (1)) | |
| 199 | +#define VERSION_WIN10_V5_2 ((5 << 16) | (2)) | |
| 198 | 200 | |
| 199 | 201 | /* Make maximum size of pipe payload of 16K */ |
| 200 | 202 | #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) |
| @@ -932,6 +934,21 @@ struct vmbus_channel { · 731 unmodified lines | ||
| 932 | 934 | * full outbound ring buffer. |
| 933 | 935 | */ |
| 934 | 936 | u64 out_full_first; |
| 937 | + | |
| 938 | + /* enabling/disabling fuzz testing on the channel (default is false)*/ | |
| 939 | + bool fuzz_testing_state; | |
| 940 | + | |
| 941 | + /* | |
| 942 | + * Interrupt delay will delay the guest from emptying the ring buffer | |
| 943 | + * for a specific amount of time. The delay is in microseconds and will | |
| 944 | + * be between 1 to a maximum of 1000, its default is 0 (no delay). | |
| 945 | + * The Message delay will delay guest reading on a per message basis | |
| 946 | + * in microseconds between 1 to 1000 with the default being 0 | |
| 947 | + * (no delay). | |
| 948 | + */ | |
| 949 | + u32 fuzz_testing_interrupt_delay; | |
| 950 | + u32 fuzz_testing_message_delay; | |
| 951 | + | |
| 935 | 952 | }; |
| 936 | 953 | |
| 937 | 954 | static inline bool is_hvsock_channel(const struct vmbus_channel *c) |
| @@ -1180,6 +1197,10 @@ struct hv_device { · 242 unmodified lines | ||
| 1180 | 1197 | |
| 1181 | 1198 | struct vmbus_channel *channel; |
| 1182 | 1199 | struct kset *channels_kset; |
| 1200 | + | |
| 1201 | + /* place holder to keep track of the dir for hv device in debugfs */ | |
| 1202 | + struct dentry *debug_dir; | |
| 1203 | + | |
| 1183 | 1204 | }; |
| 1184 | 1205 | |
| 1185 | 1206 | |
| @@ -1,18 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef _LINUX_I2C_ALGO_PXA_H | |
| 3 | −#define _LINUX_I2C_ALGO_PXA_H | |
| 4 | − | |
| 5 | −typedef enum i2c_slave_event_e { | |
| 6 | − I2C_SLAVE_EVENT_START_READ, | |
| 7 | − I2C_SLAVE_EVENT_START_WRITE, | |
| 8 | − I2C_SLAVE_EVENT_STOP | |
| 9 | −} i2c_slave_event_t; | |
| 10 | − | |
| 11 | −struct i2c_slave_client { | |
| 12 | − void *data; | |
| 13 | − void (*event)(void *ptr, i2c_slave_event_t event); | |
| 14 | − int (*read) (void *ptr); | |
| 15 | − void (*write)(void *ptr, unsigned int val); | |
| 16 | −}; | |
| 17 | − | |
| 18 | −#endif /* _LINUX_I2C_ALGO_PXA_H */ | |
| @@ -300,6 +300,7 @@ struct i2c_driver { · 299 unmodified lines | ||
| 300 | 300 | * generic enough to hide second-sourcing and compatible revisions. |
| 301 | 301 | * @adapter: manages the bus segment hosting this I2C device |
| 302 | 302 | * @dev: Driver model device node for the slave. |
| 303 | + * @init_irq: IRQ that was set at initialization | |
| 303 | 304 | * @irq: indicates the IRQ generated by this device (if any) |
| 304 | 305 | * @detected: member of an i2c_driver.clients list or i2c-core's |
| 305 | 306 | * userspace_devices list |
| @@ -452,20 +453,20 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf · 146 unmodified lines | ||
| 452 | 453 | * a default probing method is used. |
| 453 | 454 | */ |
| 454 | 455 | extern struct i2c_client * |
| 456 | +i2c_new_scanned_device(struct i2c_adapter *adap, | |
| 457 | + struct i2c_board_info *info, | |
| 458 | + unsigned short const *addr_list, | |
| 459 | + int (*probe)(struct i2c_adapter *adap, unsigned short addr)); | |
| 460 | + | |
| 461 | +extern struct i2c_client * | |
| 455 | 462 | i2c_new_probed_device(struct i2c_adapter *adap, |
| 456 | − struct i2c_board_info *info, | |
| 457 | − unsigned short const *addr_list, | |
| 458 | − int (*probe)(struct i2c_adapter *adap, unsigned short addr)); | |
| 463 | + struct i2c_board_info *info, | |
| 464 | + unsigned short const *addr_list, | |
| 465 | + int (*probe)(struct i2c_adapter *adap, unsigned short addr)); | |
| 459 | 466 | |
| 460 | 467 | /* Common custom probe functions */ |
| 461 | 468 | extern int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); |
| 462 | 469 | |
| 463 | −/* For devices that use several addresses, use i2c_new_dummy() to make | |
| 464 | − * client handles for the extra addresses. | |
| 465 | − */ | |
| 466 | −extern struct i2c_client * | |
| 467 | −i2c_new_dummy(struct i2c_adapter *adap, u16 address); | |
| 468 | − | |
| 469 | 470 | extern struct i2c_client * |
| 470 | 471 | i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address); |
| 471 | 472 | |
| @@ -575,6 +576,10 @@ struct i2c_lock_operations { · 103 unmodified lines | ||
| 575 | 576 | * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns |
| 576 | 577 | * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification |
| 577 | 578 | * @sda_hold_ns: time IP core additionally needs to hold SDA in ns |
| 579 | + * @digital_filter_width_ns: width in ns of spikes on i2c lines that the IP core | |
| 580 | + * digital filter can filter out | |
| 581 | + * @analog_filter_cutoff_freq_hz: threshold frequency for the low pass IP core | |
| 582 | + * analog filter | |
| 578 | 583 | */ |
| 579 | 584 | struct i2c_timings { |
| 580 | 585 | u32 bus_freq_hz; |
| @@ -583,6 +588,8 @@ struct i2c_timings { · 2 unmodified lines | ||
| 583 | 588 | u32 scl_int_delay_ns; |
| 584 | 589 | u32 sda_fall_ns; |
| 585 | 590 | u32 sda_hold_ns; |
| 591 | + u32 digital_filter_width_ns; | |
| 592 | + u32 analog_filter_cutoff_freq_hz; | |
| 586 | 593 | }; |
| 587 | 594 | |
| 588 | 595 | /** |
| @@ -844,8 +851,10 @@ extern void i2c_del_driver(struct i2c_driver *driver); · 255 unmodified lines | ||
| 844 | 851 | #define i2c_add_driver(driver) \ |
| 845 | 852 | i2c_register_driver(THIS_MODULE, driver) |
| 846 | 853 | |
| 847 | −extern struct i2c_client *i2c_use_client(struct i2c_client *client); | |
| 848 | −extern void i2c_release_client(struct i2c_client *client); | |
| 854 | +static inline bool i2c_client_has_driver(struct i2c_client *client) | |
| 855 | +{ | |
| 856 | + return !IS_ERR_OR_NULL(client) && client->dev.driver; | |
| 857 | +} | |
| 849 | 858 | |
| 850 | 859 | /* call the i2c_client->command() of all attached clients with |
| 851 | 860 | * the given arguments */ |
| @@ -20,4 +20,19 @@ static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb) · 19 unmodified lines | ||
| 20 | 20 | { |
| 21 | 21 | return (struct icmphdr *)skb_transport_header(skb); |
| 22 | 22 | } |
| 23 | + | |
| 24 | +static inline bool icmp_is_err(int type) | |
| 25 | +{ | |
| 26 | + switch (type) { | |
| 27 | + case ICMP_DEST_UNREACH: | |
| 28 | + case ICMP_SOURCE_QUENCH: | |
| 29 | + case ICMP_REDIRECT: | |
| 30 | + case ICMP_TIME_EXCEEDED: | |
| 31 | + case ICMP_PARAMETERPROB: | |
| 32 | + return true; | |
| 33 | + } | |
| 34 | + | |
| 35 | + return false; | |
| 36 | +} | |
| 37 | + | |
| 23 | 38 | #endif /* _LINUX_ICMP_H */ |
| @@ -46,4 +46,18 @@ extern void icmpv6_flow_init(struct sock *sk, · 45 unmodified lines | ||
| 46 | 46 | const struct in6_addr *saddr, |
| 47 | 47 | const struct in6_addr *daddr, |
| 48 | 48 | int oif); |
| 49 | + | |
| 50 | +static inline bool icmpv6_is_err(int type) | |
| 51 | +{ | |
| 52 | + switch (type) { | |
| 53 | + case ICMPV6_DEST_UNREACH: | |
| 54 | + case ICMPV6_PKT_TOOBIG: | |
| 55 | + case ICMPV6_TIME_EXCEED: | |
| 56 | + case ICMPV6_PARAMPROB: | |
| 57 | + return true; | |
| 58 | + } | |
| 59 | + | |
| 60 | + return false; | |
| 61 | +} | |
| 62 | + | |
| 49 | 63 | #endif |
| @@ -119,6 +119,8 @@ int ad_sd_reset(struct ad_sigma_delta *sigma_delta, · 118 unmodified lines | ||
| 119 | 119 | |
| 120 | 120 | int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, |
| 121 | 121 | const struct iio_chan_spec *chan, int *val); |
| 122 | +int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, | |
| 123 | + unsigned int mode, unsigned int channel); | |
| 122 | 124 | int ad_sd_calibrate_all(struct ad_sigma_delta *sigma_delta, |
| 123 | 125 | const struct ad_sd_calib_data *cd, unsigned int n); |
| 124 | 126 | int ad_sd_init(struct ad_sigma_delta *sigma_delta, struct iio_dev *indio_dev, |
| @@ -510,6 +510,7 @@ struct iio_buffer_setup_ops { · 509 unmodified lines | ||
| 510 | 510 | * attributes |
| 511 | 511 | * @chan_attr_group: [INTERN] group for all attrs in base directory |
| 512 | 512 | * @name: [DRIVER] name of the device. |
| 513 | + * @label: [DRIVER] unique name to identify which device this is | |
| 513 | 514 | * @info: [DRIVER] callbacks and constant info from driver |
| 514 | 515 | * @clock_id: [INTERN] timestamping clock posix identifier |
| 515 | 516 | * @info_exist_lock: [INTERN] lock to prevent use during removal |
| @@ -553,6 +554,7 @@ struct iio_dev { · 37 unmodified lines | ||
| 553 | 554 | struct list_head channel_attr_list; |
| 554 | 555 | struct attribute_group chan_attr_group; |
| 555 | 556 | const char *name; |
| 557 | + const char *label; | |
| 556 | 558 | const struct iio_info *info; |
| 557 | 559 | clockid_t clock_id; |
| 558 | 560 | struct mutex info_exist_lock; |
| @@ -129,7 +129,8 @@ static inline int adis_read_reg_16(struct adis *adis, unsigned int reg, · 128 unmodified lines | ||
| 129 | 129 | int ret; |
| 130 | 130 | |
| 131 | 131 | ret = adis_read_reg(adis, reg, &tmp, 2); |
| 132 | − *val = tmp; | |
| 132 | + if (ret == 0) | |
| 133 | + *val = tmp; | |
| 133 | 134 | |
| 134 | 135 | return ret; |
| 135 | 136 | } |
| @@ -147,7 +148,8 @@ static inline int adis_read_reg_32(struct adis *adis, unsigned int reg, · 11 unmodified lines | ||
| 147 | 148 | int ret; |
| 148 | 149 | |
| 149 | 150 | ret = adis_read_reg(adis, reg, &tmp, 4); |
| 150 | − *val = tmp; | |
| 151 | + if (ret == 0) | |
| 152 | + *val = tmp; | |
| 151 | 153 | |
| 152 | 154 | return ret; |
| 153 | 155 | } |
| @@ -29,7 +29,8 @@ extern void ima_kexec_cmdline(const void *buf, int size); · 28 unmodified lines | ||
| 29 | 29 | extern void ima_add_kexec_buffer(struct kimage *image); |
| 30 | 30 | #endif |
| 31 | 31 | |
| 32 | −#if (defined(CONFIG_X86) && defined(CONFIG_EFI)) || defined(CONFIG_S390) | |
| 32 | +#if (defined(CONFIG_X86) && defined(CONFIG_EFI)) || defined(CONFIG_S390) \ | |
| 33 | + || defined(CONFIG_PPC_SECURE_BOOT) | |
| 33 | 34 | extern bool arch_ima_get_secureboot(void); |
| 34 | 35 | extern const char * const *arch_get_ima_policy(void); |
| 35 | 36 | #else |
| @@ -28,3 +28,5 @@ extern unsigned int real_root_dev; · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | extern char __initramfs_start[]; |
| 30 | 30 | extern unsigned long __initramfs_size; |
| 31 | + | |
| 32 | +void console_on_rootfs(void); | |
| @@ -383,6 +383,7 @@ int input_setup_polling(struct input_dev *dev, · 382 unmodified lines | ||
| 383 | 383 | void input_set_poll_interval(struct input_dev *dev, unsigned int interval); |
| 384 | 384 | void input_set_min_poll_interval(struct input_dev *dev, unsigned int interval); |
| 385 | 385 | void input_set_max_poll_interval(struct input_dev *dev, unsigned int interval); |
| 386 | +int input_get_poll_interval(struct input_dev *dev); | |
| 386 | 387 | |
| 387 | 388 | int __must_check input_register_handler(struct input_handler *); |
| 388 | 389 | void input_unregister_handler(struct input_handler *); |
| @@ -140,6 +140,19 @@ request_threaded_irq(unsigned int irq, irq_handler_t handler, · 139 unmodified lines | ||
| 140 | 140 | irq_handler_t thread_fn, |
| 141 | 141 | unsigned long flags, const char *name, void *dev); |
| 142 | 142 | |
| 143 | +/** | |
| 144 | + * request_irq - Add a handler for an interrupt line | |
| 145 | + * @irq: The interrupt line to allocate | |
| 146 | + * @handler: Function to be called when the IRQ occurs. | |
| 147 | + * Primary handler for threaded interrupts | |
| 148 | + * If NULL, the default primary handler is installed | |
| 149 | + * @flags: Handling flags | |
| 150 | + * @name: Name of the device generating this interrupt | |
| 151 | + * @dev: A cookie passed to the handler function | |
| 152 | + * | |
| 153 | + * This call allocates an interrupt and establishes a handler; see | |
| 154 | + * the documentation for request_threaded_irq() for details. | |
| 155 | + */ | |
| 143 | 156 | static inline int __must_check |
| 144 | 157 | request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, |
| 145 | 158 | const char *name, void *dev) |
| @@ -520,8 +533,7 @@ enum · 374 unmodified lines | ||
| 520 | 533 | IRQ_POLL_SOFTIRQ, |
| 521 | 534 | TASKLET_SOFTIRQ, |
| 522 | 535 | SCHED_SOFTIRQ, |
| 523 | − HRTIMER_SOFTIRQ, /* Unused, but kept as tools rely on the | |
| 524 | − numbering. Sigh! */ | |
| 536 | + HRTIMER_SOFTIRQ, | |
| 525 | 537 | RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ |
| 526 | 538 | |
| 527 | 539 | NR_SOFTIRQS |
| @@ -102,7 +102,7 @@ struct io_pgtable_cfg { · 101 unmodified lines | ||
| 102 | 102 | struct { |
| 103 | 103 | u64 ttbr[2]; |
| 104 | 104 | u64 tcr; |
| 105 | − u64 mair[2]; | |
| 105 | + u64 mair; | |
| 106 | 106 | } arm_lpae_s1_cfg; |
| 107 | 107 | |
| 108 | 108 | struct { |
| @@ -64,6 +64,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) · 63 unmodified lines | ||
| 64 | 64 | |
| 65 | 65 | void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, |
| 66 | 66 | resource_size_t size); |
| 67 | +void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset, | |
| 68 | + resource_size_t size); | |
| 67 | 69 | void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, |
| 68 | 70 | resource_size_t size); |
| 69 | 71 | void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset, |
| @@ -0,0 +1,76 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __LINUX_IOASID_H | |
| 3 | +#define __LINUX_IOASID_H | |
| 4 | + | |
| 5 | +#include <linux/types.h> | |
| 6 | +#include <linux/errno.h> | |
| 7 | + | |
| 8 | +#define INVALID_IOASID ((ioasid_t)-1) | |
| 9 | +typedef unsigned int ioasid_t; | |
| 10 | +typedef ioasid_t (*ioasid_alloc_fn_t)(ioasid_t min, ioasid_t max, void *data); | |
| 11 | +typedef void (*ioasid_free_fn_t)(ioasid_t ioasid, void *data); | |
| 12 | + | |
| 13 | +struct ioasid_set { | |
| 14 | + int dummy; | |
| 15 | +}; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * struct ioasid_allocator_ops - IOASID allocator helper functions and data | |
| 19 | + * | |
| 20 | + * @alloc: helper function to allocate IOASID | |
| 21 | + * @free: helper function to free IOASID | |
| 22 | + * @list: for tracking ops that share helper functions but not data | |
| 23 | + * @pdata: data belong to the allocator, provided when calling alloc() | |
| 24 | + */ | |
| 25 | +struct ioasid_allocator_ops { | |
| 26 | + ioasid_alloc_fn_t alloc; | |
| 27 | + ioasid_free_fn_t free; | |
| 28 | + struct list_head list; | |
| 29 | + void *pdata; | |
| 30 | +}; | |
| 31 | + | |
| 32 | +#define DECLARE_IOASID_SET(name) struct ioasid_set name = { 0 } | |
| 33 | + | |
| 34 | +#if IS_ENABLED(CONFIG_IOASID) | |
| 35 | +ioasid_t ioasid_alloc(struct ioasid_set *set, ioasid_t min, ioasid_t max, | |
| 36 | + void *private); | |
| 37 | +void ioasid_free(ioasid_t ioasid); | |
| 38 | +void *ioasid_find(struct ioasid_set *set, ioasid_t ioasid, | |
| 39 | + bool (*getter)(void *)); | |
| 40 | +int ioasid_register_allocator(struct ioasid_allocator_ops *allocator); | |
| 41 | +void ioasid_unregister_allocator(struct ioasid_allocator_ops *allocator); | |
| 42 | +int ioasid_set_data(ioasid_t ioasid, void *data); | |
| 43 | + | |
| 44 | +#else /* !CONFIG_IOASID */ | |
| 45 | +static inline ioasid_t ioasid_alloc(struct ioasid_set *set, ioasid_t min, | |
| 46 | + ioasid_t max, void *private) | |
| 47 | +{ | |
| 48 | + return INVALID_IOASID; | |
| 49 | +} | |
| 50 | + | |
| 51 | +static inline void ioasid_free(ioasid_t ioasid) | |
| 52 | +{ | |
| 53 | +} | |
| 54 | + | |
| 55 | +static inline void *ioasid_find(struct ioasid_set *set, ioasid_t ioasid, | |
| 56 | + bool (*getter)(void *)) | |
| 57 | +{ | |
| 58 | + return NULL; | |
| 59 | +} | |
| 60 | + | |
| 61 | +static inline int ioasid_register_allocator(struct ioasid_allocator_ops *allocator) | |
| 62 | +{ | |
| 63 | + return -ENOTSUPP; | |
| 64 | +} | |
| 65 | + | |
| 66 | +static inline void ioasid_unregister_allocator(struct ioasid_allocator_ops *allocator) | |
| 67 | +{ | |
| 68 | +} | |
| 69 | + | |
| 70 | +static inline int ioasid_set_data(ioasid_t ioasid, void *data) | |
| 71 | +{ | |
| 72 | + return -ENOTSUPP; | |
| 73 | +} | |
| 74 | + | |
| 75 | +#endif /* CONFIG_IOASID */ | |
| 76 | +#endif /* __LINUX_IOASID_H */ | |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | #include <linux/atomic.h> |
| 6 | 6 | #include <linux/bitmap.h> |
| 7 | +#include <linux/blk_types.h> | |
| 7 | 8 | #include <linux/mm.h> |
| 8 | 9 | #include <linux/types.h> |
| 9 | 10 | #include <linux/mm_types.h> |
| @@ -12,6 +13,7 @@ · 2 unmodified lines | ||
| 12 | 13 | struct address_space; |
| 13 | 14 | struct fiemap_extent_info; |
| 14 | 15 | struct inode; |
| 16 | +struct iomap_writepage_ctx; | |
| 15 | 17 | struct iov_iter; |
| 16 | 18 | struct kiocb; |
| 17 | 19 | struct page; |
| @@ -21,28 +23,45 @@ struct vm_fault; · 3 unmodified lines | ||
| 21 | 23 | /* |
| 22 | 24 | * Types of block ranges for iomap mappings: |
| 23 | 25 | */ |
| 24 | −#define IOMAP_HOLE 0x01 /* no blocks allocated, need allocation */ | |
| 25 | −#define IOMAP_DELALLOC 0x02 /* delayed allocation blocks */ | |
| 26 | −#define IOMAP_MAPPED 0x03 /* blocks allocated at @addr */ | |
| 27 | −#define IOMAP_UNWRITTEN 0x04 /* blocks allocated at @addr in unwritten state */ | |
| 28 | −#define IOMAP_INLINE 0x05 /* data inline in the inode */ | |
| 26 | +#define IOMAP_HOLE 0 /* no blocks allocated, need allocation */ | |
| 27 | +#define IOMAP_DELALLOC 1 /* delayed allocation blocks */ | |
| 28 | +#define IOMAP_MAPPED 2 /* blocks allocated at @addr */ | |
| 29 | +#define IOMAP_UNWRITTEN 3 /* blocks allocated at @addr in unwritten state */ | |
| 30 | +#define IOMAP_INLINE 4 /* data inline in the inode */ | |
| 29 | 31 | |
| 30 | 32 | /* |
| 31 | − * Flags for all iomap mappings: | |
| 33 | + * Flags reported by the file system from iomap_begin: | |
| 34 | + * | |
| 35 | + * IOMAP_F_NEW indicates that the blocks have been newly allocated and need | |
| 36 | + * zeroing for areas that no data is copied to. | |
| 32 | 37 | * |
| 33 | 38 | * IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access |
| 34 | 39 | * written data and requires fdatasync to commit them to persistent storage. |
| 40 | + * This needs to take into account metadata changes that *may* be made at IO | |
| 41 | + * completion, such as file size updates from direct IO. | |
| 42 | + * | |
| 43 | + * IOMAP_F_SHARED indicates that the blocks are shared, and will need to be | |
| 44 | + * unshared as part a write. | |
| 45 | + * | |
| 46 | + * IOMAP_F_MERGED indicates that the iomap contains the merge of multiple block | |
| 47 | + * mappings. | |
| 48 | + * | |
| 49 | + * IOMAP_F_BUFFER_HEAD indicates that the file system requires the use of | |
| 50 | + * buffer heads for this mapping. | |
| 35 | 51 | */ |
| 36 | −#define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ | |
| 37 | −#define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ | |
| 38 | −#define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */ | |
| 39 | −#define IOMAP_F_SIZE_CHANGED 0x08 /* file size has changed */ | |
| 52 | +#define IOMAP_F_NEW 0x01 | |
| 53 | +#define IOMAP_F_DIRTY 0x02 | |
| 54 | +#define IOMAP_F_SHARED 0x04 | |
| 55 | +#define IOMAP_F_MERGED 0x08 | |
| 56 | +#define IOMAP_F_BUFFER_HEAD 0x10 | |
| 40 | 57 | |
| 41 | 58 | /* |
| 42 | − * Flags that only need to be reported for IOMAP_REPORT requests: | |
| 59 | + * Flags set by the core iomap code during operations: | |
| 60 | + * | |
| 61 | + * IOMAP_F_SIZE_CHANGED indicates to the iomap_end method that the file size | |
| 62 | + * has changed as the result of this write operation. | |
| 43 | 63 | */ |
| 44 | −#define IOMAP_F_MERGED 0x10 /* contains multiple blocks/extents */ | |
| 45 | −#define IOMAP_F_SHARED 0x20 /* block shared with another file */ | |
| 64 | +#define IOMAP_F_SIZE_CHANGED 0x100 | |
| 46 | 65 | |
| 47 | 66 | /* |
| 48 | 67 | * Flags from 0x1000 up are for file system specific usage: |
| @@ -110,7 +129,8 @@ struct iomap_ops { · 61 unmodified lines | ||
| 110 | 129 | * The actual length is returned in iomap->length. |
| 111 | 130 | */ |
| 112 | 131 | int (*iomap_begin)(struct inode *inode, loff_t pos, loff_t length, |
| 113 | − unsigned flags, struct iomap *iomap); | |
| 132 | + unsigned flags, struct iomap *iomap, | |
| 133 | + struct iomap *srcmap); | |
| 114 | 134 | |
| 115 | 135 | /* |
| 116 | 136 | * Commit and/or unreserve space previous allocated using iomap_begin. |
| @@ -126,29 +146,12 @@ struct iomap_ops { · 9 unmodified lines | ||
| 126 | 146 | * Main iomap iterator function. |
| 127 | 147 | */ |
| 128 | 148 | typedef loff_t (*iomap_actor_t)(struct inode *inode, loff_t pos, loff_t len, |
| 129 | − void *data, struct iomap *iomap); | |
| 149 | + void *data, struct iomap *iomap, struct iomap *srcmap); | |
| 130 | 150 | |
| 131 | 151 | loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length, |
| 132 | 152 | unsigned flags, const struct iomap_ops *ops, void *data, |
| 133 | 153 | iomap_actor_t actor); |
| 134 | 154 | |
| 135 | −/* | |
| 136 | − * Structure allocate for each page when block size < PAGE_SIZE to track | |
| 137 | − * sub-page uptodate status and I/O completions. | |
| 138 | − */ | |
| 139 | −struct iomap_page { | |
| 140 | − atomic_t read_count; | |
| 141 | − atomic_t write_count; | |
| 142 | − DECLARE_BITMAP(uptodate, PAGE_SIZE / 512); | |
| 143 | −}; | |
| 144 | − | |
| 145 | −static inline struct iomap_page *to_iomap_page(struct page *page) | |
| 146 | −{ | |
| 147 | − if (page_has_private(page)) | |
| 148 | − return (struct iomap_page *)page_private(page); | |
| 149 | − return NULL; | |
| 150 | −} | |
| 151 | − | |
| 152 | 155 | ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from, |
| 153 | 156 | const struct iomap_ops *ops); |
| 154 | 157 | int iomap_readpage(struct page *page, const struct iomap_ops *ops); |
| @@ -166,7 +169,7 @@ int iomap_migrate_page(struct address_space *mapping, struct page *newpage, · 11 unmodified lines | ||
| 166 | 169 | #else |
| 167 | 170 | #define iomap_migrate_page NULL |
| 168 | 171 | #endif |
| 169 | −int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, | |
| 172 | +int iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len, | |
| 170 | 173 | const struct iomap_ops *ops); |
| 171 | 174 | int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, |
| 172 | 175 | bool *did_zero, const struct iomap_ops *ops); |
| @@ -183,6 +186,63 @@ loff_t iomap_seek_data(struct inode *inode, loff_t offset, · 10 unmodified lines | ||
| 183 | 186 | sector_t iomap_bmap(struct address_space *mapping, sector_t bno, |
| 184 | 187 | const struct iomap_ops *ops); |
| 185 | 188 | |
| 189 | +/* | |
| 190 | + * Structure for writeback I/O completions. | |
| 191 | + */ | |
| 192 | +struct iomap_ioend { | |
| 193 | + struct list_head io_list; /* next ioend in chain */ | |
| 194 | + u16 io_type; | |
| 195 | + u16 io_flags; /* IOMAP_F_* */ | |
| 196 | + struct inode *io_inode; /* file being written to */ | |
| 197 | + size_t io_size; /* size of the extent */ | |
| 198 | + loff_t io_offset; /* offset in the file */ | |
| 199 | + void *io_private; /* file system private data */ | |
| 200 | + struct bio *io_bio; /* bio being built */ | |
| 201 | + struct bio io_inline_bio; /* MUST BE LAST! */ | |
| 202 | +}; | |
| 203 | + | |
| 204 | +struct iomap_writeback_ops { | |
| 205 | + /* | |
| 206 | + * Required, maps the blocks so that writeback can be performed on | |
| 207 | + * the range starting at offset. | |
| 208 | + */ | |
| 209 | + int (*map_blocks)(struct iomap_writepage_ctx *wpc, struct inode *inode, | |
| 210 | + loff_t offset); | |
| 211 | + | |
| 212 | + /* | |
| 213 | + * Optional, allows the file systems to perform actions just before | |
| 214 | + * submitting the bio and/or override the bio end_io handler for complex | |
| 215 | + * operations like copy on write extent manipulation or unwritten extent | |
| 216 | + * conversions. | |
| 217 | + */ | |
| 218 | + int (*prepare_ioend)(struct iomap_ioend *ioend, int status); | |
| 219 | + | |
| 220 | + /* | |
| 221 | + * Optional, allows the file system to discard state on a page where | |
| 222 | + * we failed to submit any I/O. | |
| 223 | + */ | |
| 224 | + void (*discard_page)(struct page *page); | |
| 225 | +}; | |
| 226 | + | |
| 227 | +struct iomap_writepage_ctx { | |
| 228 | + struct iomap iomap; | |
| 229 | + struct iomap_ioend *ioend; | |
| 230 | + const struct iomap_writeback_ops *ops; | |
| 231 | +}; | |
| 232 | + | |
| 233 | +void iomap_finish_ioends(struct iomap_ioend *ioend, int error); | |
| 234 | +void iomap_ioend_try_merge(struct iomap_ioend *ioend, | |
| 235 | + struct list_head *more_ioends, | |
| 236 | + void (*merge_private)(struct iomap_ioend *ioend, | |
| 237 | + struct iomap_ioend *next)); | |
| 238 | +void iomap_sort_ioends(struct list_head *ioend_list); | |
| 239 | +int iomap_writepage(struct page *page, struct writeback_control *wbc, | |
| 240 | + struct iomap_writepage_ctx *wpc, | |
| 241 | + const struct iomap_writeback_ops *ops); | |
| 242 | +int iomap_writepages(struct address_space *mapping, | |
| 243 | + struct writeback_control *wbc, struct iomap_writepage_ctx *wpc, | |
| 244 | + const struct iomap_writeback_ops *ops); | |
| 245 | + | |
| 186 | 246 | /* |
| 187 | 247 | * Flags for direct I/O ->end_io: |
| 188 | 248 | */ |
| @@ -195,7 +255,8 @@ struct iomap_dio_ops { · 6 unmodified lines | ||
| 195 | 255 | }; |
| 196 | 256 | |
| 197 | 257 | ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, |
| 198 | − const struct iomap_ops *ops, const struct iomap_dio_ops *dops); | |
| 258 | + const struct iomap_ops *ops, const struct iomap_dio_ops *dops, | |
| 259 | + bool wait_for_completion); | |
| 199 | 260 | int iomap_dio_iopoll(struct kiocb *kiocb, bool spin); |
| 200 | 261 | |
| 201 | 262 | #ifdef CONFIG_SWAP |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/errno.h> |
| 14 | 14 | #include <linux/err.h> |
| 15 | 15 | #include <linux/of.h> |
| 16 | +#include <linux/ioasid.h> | |
| 16 | 17 | #include <uapi/linux/iommu.h> |
| 17 | 18 | |
| 18 | 19 | #define IOMMU_READ (1 << 0) |
| @@ -31,11 +32,11 @@ · 12 unmodified lines | ||
| 31 | 32 | */ |
| 32 | 33 | #define IOMMU_PRIV (1 << 5) |
| 33 | 34 | /* |
| 34 | − * Non-coherent masters on few Qualcomm SoCs can use this page protection flag | |
| 35 | − * to set correct cacheability attributes to use an outer level of cache - | |
| 36 | − * last level cache, aka system cache. | |
| 35 | + * Non-coherent masters can use this page protection flag to set cacheable | |
| 36 | + * memory attributes for only a transparent outer level of cache, also known as | |
| 37 | + * the last-level or system cache. | |
| 37 | 38 | */ |
| 38 | −#define IOMMU_QCOM_SYS_CACHE (1 << 6) | |
| 39 | +#define IOMMU_SYS_CACHE_ONLY (1 << 6) | |
| 39 | 40 | |
| 40 | 41 | struct iommu_ops; |
| 41 | 42 | struct iommu_group; |
| @@ -244,7 +245,10 @@ struct iommu_iotlb_gather { · 202 unmodified lines | ||
| 244 | 245 | * @sva_unbind: Unbind process address space from device |
| 245 | 246 | * @sva_get_pasid: Get PASID associated to a SVA handle |
| 246 | 247 | * @page_response: handle page request response |
| 248 | + * @cache_invalidate: invalidate translation caches | |
| 247 | 249 | * @pgsize_bitmap: bitmap of all possible supported page sizes |
| 250 | + * @sva_bind_gpasid: bind guest pasid and mm | |
| 251 | + * @sva_unbind_gpasid: unbind guest pasid and mm | |
| 248 | 252 | */ |
| 249 | 253 | struct iommu_ops { |
| 250 | 254 | bool (*capable)(enum iommu_cap); |
| @@ -256,7 +260,7 @@ struct iommu_ops { · 5 unmodified lines | ||
| 256 | 260 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); |
| 257 | 261 | void (*detach_dev)(struct iommu_domain *domain, struct device *dev); |
| 258 | 262 | int (*map)(struct iommu_domain *domain, unsigned long iova, |
| 259 | − phys_addr_t paddr, size_t size, int prot); | |
| 263 | + phys_addr_t paddr, size_t size, int prot, gfp_t gfp); | |
| 260 | 264 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, |
| 261 | 265 | size_t size, struct iommu_iotlb_gather *iotlb_gather); |
| 262 | 266 | void (*flush_iotlb_all)(struct iommu_domain *domain); |
| @@ -306,6 +310,12 @@ struct iommu_ops { · 43 unmodified lines | ||
| 306 | 310 | int (*page_response)(struct device *dev, |
| 307 | 311 | struct iommu_fault_event *evt, |
| 308 | 312 | struct iommu_page_response *msg); |
| 313 | + int (*cache_invalidate)(struct iommu_domain *domain, struct device *dev, | |
| 314 | + struct iommu_cache_invalidate_info *inv_info); | |
| 315 | + int (*sva_bind_gpasid)(struct iommu_domain *domain, | |
| 316 | + struct device *dev, struct iommu_gpasid_bind_data *data); | |
| 317 | + | |
| 318 | + int (*sva_unbind_gpasid)(struct device *dev, int pasid); | |
| 309 | 319 | |
| 310 | 320 | unsigned long pgsize_bitmap; |
| 311 | 321 | }; |
| @@ -417,10 +427,19 @@ extern int iommu_attach_device(struct iommu_domain *domain, · 105 unmodified lines | ||
| 417 | 427 | struct device *dev); |
| 418 | 428 | extern void iommu_detach_device(struct iommu_domain *domain, |
| 419 | 429 | struct device *dev); |
| 430 | +extern int iommu_cache_invalidate(struct iommu_domain *domain, | |
| 431 | + struct device *dev, | |
| 432 | + struct iommu_cache_invalidate_info *inv_info); | |
| 433 | +extern int iommu_sva_bind_gpasid(struct iommu_domain *domain, | |
| 434 | + struct device *dev, struct iommu_gpasid_bind_data *data); | |
| 435 | +extern int iommu_sva_unbind_gpasid(struct iommu_domain *domain, | |
| 436 | + struct device *dev, ioasid_t pasid); | |
| 420 | 437 | extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev); |
| 421 | 438 | extern struct iommu_domain *iommu_get_dma_domain(struct device *dev); |
| 422 | 439 | extern int iommu_map(struct iommu_domain *domain, unsigned long iova, |
| 423 | 440 | phys_addr_t paddr, size_t size, int prot); |
| 441 | +extern int iommu_map_atomic(struct iommu_domain *domain, unsigned long iova, | |
| 442 | + phys_addr_t paddr, size_t size, int prot); | |
| 424 | 443 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, |
| 425 | 444 | size_t size); |
| 426 | 445 | extern size_t iommu_unmap_fast(struct iommu_domain *domain, |
| @@ -428,6 +447,9 @@ extern size_t iommu_unmap_fast(struct iommu_domain *domain, · 1 unmodified line | ||
| 428 | 447 | struct iommu_iotlb_gather *iotlb_gather); |
| 429 | 448 | extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, |
| 430 | 449 | struct scatterlist *sg,unsigned int nents, int prot); |
| 450 | +extern size_t iommu_map_sg_atomic(struct iommu_domain *domain, | |
| 451 | + unsigned long iova, struct scatterlist *sg, | |
| 452 | + unsigned int nents, int prot); | |
| 431 | 453 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); |
| 432 | 454 | extern void iommu_set_fault_handler(struct iommu_domain *domain, |
| 433 | 455 | iommu_fault_handler_t handler, void *token); |
| @@ -662,6 +684,13 @@ static inline int iommu_map(struct iommu_domain *domain, unsigned long iova, · 228 unmodified lines | ||
| 662 | 684 | return -ENODEV; |
| 663 | 685 | } |
| 664 | 686 | |
| 687 | +static inline int iommu_map_atomic(struct iommu_domain *domain, | |
| 688 | + unsigned long iova, phys_addr_t paddr, | |
| 689 | + size_t size, int prot) | |
| 690 | +{ | |
| 691 | + return -ENODEV; | |
| 692 | +} | |
| 693 | + | |
| 665 | 694 | static inline size_t iommu_unmap(struct iommu_domain *domain, |
| 666 | 695 | unsigned long iova, size_t size) |
| 667 | 696 | { |
| @@ -682,6 +711,13 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain, · 14 unmodified lines | ||
| 682 | 711 | return 0; |
| 683 | 712 | } |
| 684 | 713 | |
| 714 | +static inline size_t iommu_map_sg_atomic(struct iommu_domain *domain, | |
| 715 | + unsigned long iova, struct scatterlist *sg, | |
| 716 | + unsigned int nents, int prot) | |
| 717 | +{ | |
| 718 | + return 0; | |
| 719 | +} | |
| 720 | + | |
| 685 | 721 | static inline void iommu_flush_tlb_all(struct iommu_domain *domain) |
| 686 | 722 | { |
| 687 | 723 | } |
| @@ -1005,6 +1041,25 @@ static inline int iommu_sva_get_pasid(struct iommu_sva *handle) · 317 unmodified lines | ||
| 1005 | 1041 | return IOMMU_PASID_INVALID; |
| 1006 | 1042 | } |
| 1007 | 1043 | |
| 1044 | +static inline int | |
| 1045 | +iommu_cache_invalidate(struct iommu_domain *domain, | |
| 1046 | + struct device *dev, | |
| 1047 | + struct iommu_cache_invalidate_info *inv_info) | |
| 1048 | +{ | |
| 1049 | + return -ENODEV; | |
| 1050 | +} | |
| 1051 | +static inline int iommu_sva_bind_gpasid(struct iommu_domain *domain, | |
| 1052 | + struct device *dev, struct iommu_gpasid_bind_data *data) | |
| 1053 | +{ | |
| 1054 | + return -ENODEV; | |
| 1055 | +} | |
| 1056 | + | |
| 1057 | +static inline int iommu_sva_unbind_gpasid(struct iommu_domain *domain, | |
| 1058 | + struct device *dev, int pasid) | |
| 1059 | +{ | |
| 1060 | + return -ENODEV; | |
| 1061 | +} | |
| 1062 | + | |
| 1008 | 1063 | #endif /* CONFIG_IOMMU_API */ |
| 1009 | 1064 | |
| 1010 | 1065 | #ifdef CONFIG_IOMMU_DEBUGFS |
| @@ -134,6 +134,7 @@ enum { · 133 unmodified lines | ||
| 134 | 134 | IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, |
| 135 | 135 | IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, |
| 136 | 136 | IORES_DESC_RESERVED = 7, |
| 137 | + IORES_DESC_SOFT_RESERVED = 8, | |
| 137 | 138 | }; |
| 138 | 139 | |
| 139 | 140 | /* |
| @@ -224,10 +224,14 @@ static inline int ipmi_demangle_device_id(uint8_t netfn, uint8_t cmd, · 223 unmodified lines | ||
| 224 | 224 | * is called, and the lower layer must get the interface from that |
| 225 | 225 | * call. |
| 226 | 226 | */ |
| 227 | −int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, | |
| 228 | − void *send_info, | |
| 229 | − struct device *dev, | |
| 230 | − unsigned char slave_addr); | |
| 227 | +int ipmi_add_smi(struct module *owner, | |
| 228 | + const struct ipmi_smi_handlers *handlers, | |
| 229 | + void *send_info, | |
| 230 | + struct device *dev, | |
| 231 | + unsigned char slave_addr); | |
| 232 | + | |
| 233 | +#define ipmi_register_smi(handlers, send_info, dev, slave_addr) \ | |
| 234 | + ipmi_add_smi(THIS_MODULE, handlers, send_info, dev, slave_addr) | |
| 231 | 235 | |
| 232 | 236 | /* |
| 233 | 237 | * Remove a low-level interface from the IPMI driver. This will |
| @@ -610,6 +610,12 @@ extern int irq_chip_pm_put(struct irq_data *data); · 609 unmodified lines | ||
| 610 | 610 | #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY |
| 611 | 611 | extern void handle_fasteoi_ack_irq(struct irq_desc *desc); |
| 612 | 612 | extern void handle_fasteoi_mask_irq(struct irq_desc *desc); |
| 613 | +extern int irq_chip_set_parent_state(struct irq_data *data, | |
| 614 | + enum irqchip_irq_state which, | |
| 615 | + bool val); | |
| 616 | +extern int irq_chip_get_parent_state(struct irq_data *data, | |
| 617 | + enum irqchip_irq_state which, | |
| 618 | + bool *state); | |
| 613 | 619 | extern void irq_chip_enable_parent(struct irq_data *data); |
| 614 | 620 | extern void irq_chip_disable_parent(struct irq_data *data); |
| 615 | 621 | extern void irq_chip_ack_parent(struct irq_data *data); |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY) |
| 23 | 23 | |
| 24 | 24 | struct irq_work { |
| 25 | − unsigned long flags; | |
| 25 | + atomic_t flags; | |
| 26 | 26 | struct llist_node llnode; |
| 27 | 27 | void (*func)(struct irq_work *); |
| 28 | 28 | }; |
| @@ -30,11 +30,15 @@ struct irq_work { · 1 unmodified line | ||
| 30 | 30 | static inline |
| 31 | 31 | void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *)) |
| 32 | 32 | { |
| 33 | − work->flags = 0; | |
| 33 | + atomic_set(&work->flags, 0); | |
| 34 | 34 | work->func = func; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | −#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), } | |
| 37 | +#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { \ | |
| 38 | + .flags = ATOMIC_INIT(0), \ | |
| 39 | + .func = (_f) \ | |
| 40 | +} | |
| 41 | + | |
| 38 | 42 | |
| 39 | 43 | bool irq_work_queue(struct irq_work *work); |
| 40 | 44 | bool irq_work_queue_on(struct irq_work *work, int cpu); |
| @@ -334,10 +334,10 @@ · 333 unmodified lines | ||
| 334 | 334 | #define GITS_TYPER_PLPIS (1UL << 0) |
| 335 | 335 | #define GITS_TYPER_VLPIS (1UL << 1) |
| 336 | 336 | #define GITS_TYPER_ITT_ENTRY_SIZE_SHIFT 4 |
| 337 | −#define GITS_TYPER_ITT_ENTRY_SIZE(r) ((((r) >> GITS_TYPER_ITT_ENTRY_SIZE_SHIFT) & 0xf) + 1) | |
| 337 | +#define GITS_TYPER_ITT_ENTRY_SIZE GENMASK_ULL(7, 4) | |
| 338 | 338 | #define GITS_TYPER_IDBITS_SHIFT 8 |
| 339 | 339 | #define GITS_TYPER_DEVBITS_SHIFT 13 |
| 340 | −#define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1) | |
| 340 | +#define GITS_TYPER_DEVBITS GENMASK_ULL(17, 13) | |
| 341 | 341 | #define GITS_TYPER_PTA (1UL << 19) |
| 342 | 342 | #define GITS_TYPER_HCC_SHIFT 24 |
| 343 | 343 | #define GITS_TYPER_HCC(r) (((r) >> GITS_TYPER_HCC_SHIFT) & 0xff) |
| @@ -487,6 +487,8 @@ · 143 unmodified lines | ||
| 487 | 487 | #define ICC_CTLR_EL1_EOImode_MASK (1 << ICC_CTLR_EL1_EOImode_SHIFT) |
| 488 | 488 | #define ICC_CTLR_EL1_CBPR_SHIFT 0 |
| 489 | 489 | #define ICC_CTLR_EL1_CBPR_MASK (1 << ICC_CTLR_EL1_CBPR_SHIFT) |
| 490 | +#define ICC_CTLR_EL1_PMHE_SHIFT 6 | |
| 491 | +#define ICC_CTLR_EL1_PMHE_MASK (1 << ICC_CTLR_EL1_PMHE_SHIFT) | |
| 490 | 492 | #define ICC_CTLR_EL1_PRI_BITS_SHIFT 8 |
| 491 | 493 | #define ICC_CTLR_EL1_PRI_BITS_MASK (0x7 << ICC_CTLR_EL1_PRI_BITS_SHIFT) |
| 492 | 494 | #define ICC_CTLR_EL1_ID_BITS_SHIFT 11 |
| @@ -32,9 +32,13 @@ struct its_vm { · 31 unmodified lines | ||
| 32 | 32 | struct its_vpe { |
| 33 | 33 | struct page *vpt_page; |
| 34 | 34 | struct its_vm *its_vm; |
| 35 | + /* per-vPE VLPI tracking */ | |
| 36 | + atomic_t vlpi_count; | |
| 35 | 37 | /* Doorbell interrupt */ |
| 36 | 38 | int irq; |
| 37 | 39 | irq_hw_number_t vpe_db_lpi; |
| 40 | + /* VPE resident */ | |
| 41 | + bool resident; | |
| 38 | 42 | /* VPE proxy mapping */ |
| 39 | 43 | int vpe_proxy_event; |
| 40 | 44 | /* |
| @@ -1,14 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
| 2 | −/* | |
| 3 | − * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> | |
| 4 | − */ | |
| 5 | − | |
| 6 | −#ifndef __LINUX_IRQCHIP_INGENIC_H__ | |
| 7 | −#define __LINUX_IRQCHIP_INGENIC_H__ | |
| 8 | − | |
| 9 | −#include <linux/irq.h> | |
| 10 | − | |
| 11 | −extern void ingenic_intc_irq_suspend(struct irq_data *data); | |
| 12 | −extern void ingenic_intc_irq_resume(struct irq_data *data); | |
| 13 | − | |
| 14 | −#endif | |
| @@ -83,6 +83,7 @@ enum irq_domain_bus_token { · 82 unmodified lines | ||
| 83 | 83 | DOMAIN_BUS_IPI, |
| 84 | 84 | DOMAIN_BUS_FSL_MC_MSI, |
| 85 | 85 | DOMAIN_BUS_TI_SCI_INTA_MSI, |
| 86 | + DOMAIN_BUS_WAKEUP, | |
| 86 | 87 | }; |
| 87 | 88 | |
| 88 | 89 | /** |
| @@ -313,7 +313,6 @@ enum jbd_state_bits { · 312 unmodified lines | ||
| 313 | 313 | BH_Revoked, /* Has been revoked from the log */ |
| 314 | 314 | BH_RevokeValid, /* Revoked flag is valid */ |
| 315 | 315 | BH_JBDDirty, /* Is dirty but journaled */ |
| 316 | − BH_State, /* Pins most journal_head state */ | |
| 317 | 316 | BH_JournalHead, /* Pins bh->b_private and jh->b_bh */ |
| 318 | 317 | BH_Shadow, /* IO on shadow buffer is running */ |
| 319 | 318 | BH_Verified, /* Metadata block has been verified ok */ |
| @@ -342,26 +341,6 @@ static inline struct journal_head *bh2jh(struct buffer_head *bh) · 22 unmodified lines | ||
| 342 | 341 | return bh->b_private; |
| 343 | 342 | } |
| 344 | 343 | |
| 345 | −static inline void jbd_lock_bh_state(struct buffer_head *bh) | |
| 346 | −{ | |
| 347 | − bit_spin_lock(BH_State, &bh->b_state); | |
| 348 | −} | |
| 349 | − | |
| 350 | −static inline int jbd_trylock_bh_state(struct buffer_head *bh) | |
| 351 | −{ | |
| 352 | − return bit_spin_trylock(BH_State, &bh->b_state); | |
| 353 | −} | |
| 354 | − | |
| 355 | −static inline int jbd_is_locked_bh_state(struct buffer_head *bh) | |
| 356 | −{ | |
| 357 | − return bit_spin_is_locked(BH_State, &bh->b_state); | |
| 358 | −} | |
| 359 | − | |
| 360 | −static inline void jbd_unlock_bh_state(struct buffer_head *bh) | |
| 361 | −{ | |
| 362 | − bit_spin_unlock(BH_State, &bh->b_state); | |
| 363 | −} | |
| 364 | − | |
| 365 | 344 | static inline void jbd_lock_bh_journal_head(struct buffer_head *bh) |
| 366 | 345 | { |
| 367 | 346 | bit_spin_lock(BH_JournalHead, &bh->b_state); |
| @@ -477,7 +456,9 @@ struct jbd2_revoke_table_s; · 109 unmodified lines | ||
| 477 | 456 | * @h_transaction: Which compound transaction is this update a part of? |
| 478 | 457 | * @h_journal: Which journal handle belongs to - used iff h_reserved set. |
| 479 | 458 | * @h_rsv_handle: Handle reserved for finishing the logical operation. |
| 480 | − * @h_buffer_credits: Number of remaining buffers we are allowed to dirty. | |
| 459 | + * @h_total_credits: Number of remaining buffers we are allowed to add to | |
| 460 | + * journal. These are dirty buffers and revoke descriptor blocks. | |
| 461 | + * @h_revoke_credits: Number of remaining revoke records available for handle | |
| 481 | 462 | * @h_ref: Reference count on this handle. |
| 482 | 463 | * @h_err: Field for caller's use to track errors through large fs operations. |
| 483 | 464 | * @h_sync: Flag for sync-on-close. |
| @@ -487,7 +468,8 @@ struct jbd2_revoke_table_s; · 3 unmodified lines | ||
| 487 | 468 | * @h_type: For handle statistics. |
| 488 | 469 | * @h_line_no: For handle statistics. |
| 489 | 470 | * @h_start_jiffies: Handle Start time. |
| 490 | − * @h_requested_credits: Holds @h_buffer_credits after handle is started. | |
| 471 | + * @h_requested_credits: Holds @h_total_credits after handle is started. | |
| 472 | + * @h_revoke_credits_requested: Holds @h_revoke_credits after handle is started. | |
| 491 | 473 | * @saved_alloc_context: Saved context while transaction is open. |
| 492 | 474 | **/ |
| 493 | 475 | |
| @@ -504,7 +486,9 @@ struct jbd2_journal_handle · 10 unmodified lines | ||
| 504 | 486 | }; |
| 505 | 487 | |
| 506 | 488 | handle_t *h_rsv_handle; |
| 507 | − int h_buffer_credits; | |
| 489 | + int h_total_credits; | |
| 490 | + int h_revoke_credits; | |
| 491 | + int h_revoke_credits_requested; | |
| 508 | 492 | int h_ref; |
| 509 | 493 | int h_err; |
| 510 | 494 | |
| @@ -556,9 +540,9 @@ struct transaction_chp_stats_s { · 45 unmodified lines | ||
| 556 | 540 | * ->jbd_lock_bh_journal_head() (This is "innermost") |
| 557 | 541 | * |
| 558 | 542 | * j_state_lock |
| 559 | − * ->jbd_lock_bh_state() | |
| 543 | + * ->b_state_lock | |
| 560 | 544 | * |
| 561 | − * jbd_lock_bh_state() | |
| 545 | + * b_state_lock | |
| 562 | 546 | * ->j_list_lock |
| 563 | 547 | * |
| 564 | 548 | * j_state_lock |
| @@ -681,11 +665,24 @@ struct transaction_s · 116 unmodified lines | ||
| 681 | 665 | atomic_t t_updates; |
| 682 | 666 | |
| 683 | 667 | /* |
| 684 | − * Number of buffers reserved for use by all handles in this transaction | |
| 685 | − * handle but not yet modified. [none] | |
| 668 | + * Number of blocks reserved for this transaction in the journal. | |
| 669 | + * This is including all credits reserved when starting transaction | |
| 670 | + * handles as well as all journal descriptor blocks needed for this | |
| 671 | + * transaction. [none] | |
| 686 | 672 | */ |
| 687 | 673 | atomic_t t_outstanding_credits; |
| 688 | 674 | |
| 675 | + /* | |
| 676 | + * Number of revoke records for this transaction added by already | |
| 677 | + * stopped handles. [none] | |
| 678 | + */ | |
| 679 | + atomic_t t_outstanding_revokes; | |
| 680 | + | |
| 681 | + /* | |
| 682 | + * How many handles used this transaction? [none] | |
| 683 | + */ | |
| 684 | + atomic_t t_handle_count; | |
| 685 | + | |
| 689 | 686 | /* |
| 690 | 687 | * Forward and backward links for the circular list of all transactions |
| 691 | 688 | * awaiting checkpoint. [j_list_lock] |
| @@ -703,11 +700,6 @@ struct transaction_s · 11 unmodified lines | ||
| 703 | 700 | */ |
| 704 | 701 | ktime_t t_start_time; |
| 705 | 702 | |
| 706 | − /* | |
| 707 | − * How many handles used this transaction? [none] | |
| 708 | − */ | |
| 709 | − atomic_t t_handle_count; | |
| 710 | − | |
| 711 | 703 | /* |
| 712 | 704 | * This transaction is being forced and some process is |
| 713 | 705 | * waiting for it to finish. |
| @@ -1024,6 +1016,13 @@ struct journal_s · 310 unmodified lines | ||
| 1024 | 1016 | */ |
| 1025 | 1017 | int j_max_transaction_buffers; |
| 1026 | 1018 | |
| 1019 | + /** | |
| 1020 | + * @j_revoke_records_per_block: | |
| 1021 | + * | |
| 1022 | + * Number of revoke records that fit in one descriptor block. | |
| 1023 | + */ | |
| 1024 | + int j_revoke_records_per_block; | |
| 1025 | + | |
| 1027 | 1026 | /** |
| 1028 | 1027 | * @j_commit_interval: |
| 1029 | 1028 | * |
| @@ -1170,7 +1169,7 @@ struct journal_s · 140 unmodified lines | ||
| 1170 | 1169 | #define jbd2_might_wait_for_commit(j) \ |
| 1171 | 1170 | do { \ |
| 1172 | 1171 | rwsem_acquire(&j->j_trans_commit_map, 0, 0, _THIS_IP_); \ |
| 1173 | − rwsem_release(&j->j_trans_commit_map, 1, _THIS_IP_); \ | |
| 1172 | + rwsem_release(&j->j_trans_commit_map, _THIS_IP_); \ | |
| 1174 | 1173 | } while (0) |
| 1175 | 1174 | |
| 1176 | 1175 | /* journal feature predicate functions */ |
| @@ -1257,7 +1256,7 @@ JBD2_FEATURE_INCOMPAT_FUNCS(csum3, CSUM_V3) · 80 unmodified lines | ||
| 1257 | 1256 | |
| 1258 | 1257 | /* Filing buffers */ |
| 1259 | 1258 | extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *); |
| 1260 | −extern void __jbd2_journal_refile_buffer(struct journal_head *); | |
| 1259 | +extern bool __jbd2_journal_refile_buffer(struct journal_head *); | |
| 1261 | 1260 | extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *); |
| 1262 | 1261 | extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); |
| 1263 | 1262 | extern void __journal_free_buffer(struct journal_head *bh); |
| @@ -1358,14 +1357,16 @@ static inline handle_t *journal_current_handle(void) · 94 unmodified lines | ||
| 1358 | 1357 | |
| 1359 | 1358 | extern handle_t *jbd2_journal_start(journal_t *, int nblocks); |
| 1360 | 1359 | extern handle_t *jbd2__journal_start(journal_t *, int blocks, int rsv_blocks, |
| 1361 | − gfp_t gfp_mask, unsigned int type, | |
| 1362 | − unsigned int line_no); | |
| 1360 | + int revoke_records, gfp_t gfp_mask, | |
| 1361 | + unsigned int type, unsigned int line_no); | |
| 1363 | 1362 | extern int jbd2_journal_restart(handle_t *, int nblocks); |
| 1364 | −extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask); | |
| 1363 | +extern int jbd2__journal_restart(handle_t *, int nblocks, | |
| 1364 | + int revoke_records, gfp_t gfp_mask); | |
| 1365 | 1365 | extern int jbd2_journal_start_reserved(handle_t *handle, |
| 1366 | 1366 | unsigned int type, unsigned int line_no); |
| 1367 | 1367 | extern void jbd2_journal_free_reserved(handle_t *handle); |
| 1368 | −extern int jbd2_journal_extend (handle_t *, int nblocks); | |
| 1368 | +extern int jbd2_journal_extend(handle_t *handle, int nblocks, | |
| 1369 | + int revoke_records); | |
| 1369 | 1370 | extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); |
| 1370 | 1371 | extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); |
| 1371 | 1372 | extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); |
| @@ -1560,38 +1561,19 @@ static inline int jbd2_journal_has_csum_v2or3(journal_t *journal) · 188 unmodified lines | ||
| 1560 | 1561 | return journal->j_chksum_driver != NULL; |
| 1561 | 1562 | } |
| 1562 | 1563 | |
| 1563 | −/* | |
| 1564 | − * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for | |
| 1565 | − * transaction control blocks. | |
| 1566 | − */ | |
| 1567 | −#define JBD2_CONTROL_BLOCKS_SHIFT 5 | |
| 1568 | − | |
| 1569 | −/* | |
| 1570 | − * Return the minimum number of blocks which must be free in the journal | |
| 1571 | − * before a new transaction may be started. Must be called under j_state_lock. | |
| 1572 | − */ | |
| 1573 | −static inline int jbd2_space_needed(journal_t *journal) | |
| 1574 | −{ | |
| 1575 | − int nblocks = journal->j_max_transaction_buffers; | |
| 1576 | − return nblocks + (nblocks >> JBD2_CONTROL_BLOCKS_SHIFT); | |
| 1577 | −} | |
| 1578 | − | |
| 1579 | 1564 | /* |
| 1580 | 1565 | * Return number of free blocks in the log. Must be called under j_state_lock. |
| 1581 | 1566 | */ |
| 1582 | 1567 | static inline unsigned long jbd2_log_space_left(journal_t *journal) |
| 1583 | 1568 | { |
| 1584 | 1569 | /* Allow for rounding errors */ |
| 1585 | − unsigned long free = journal->j_free - 32; | |
| 1570 | + long free = journal->j_free - 32; | |
| 1586 | 1571 | |
| 1587 | 1572 | if (journal->j_committing_transaction) { |
| 1588 | − unsigned long committing = atomic_read(&journal-> | |
| 1589 | − j_committing_transaction->t_outstanding_credits); | |
| 1590 | − | |
| 1591 | − /* Transaction + control blocks */ | |
| 1592 | − free -= committing + (committing >> JBD2_CONTROL_BLOCKS_SHIFT); | |
| 1573 | + free -= atomic_read(&journal-> | |
| 1574 | + j_committing_transaction->t_outstanding_credits); | |
| 1593 | 1575 | } |
| 1594 | − return free; | |
| 1576 | + return max_t(long, free, 0); | |
| 1595 | 1577 | } |
| 1596 | 1578 | |
| 1597 | 1579 | /* |
| @@ -1645,6 +1627,20 @@ static inline tid_t jbd2_get_latest_transaction(journal_t *journal) · 47 unmodified lines | ||
| 1645 | 1627 | return tid; |
| 1646 | 1628 | } |
| 1647 | 1629 | |
| 1630 | +static inline int jbd2_handle_buffer_credits(handle_t *handle) | |
| 1631 | +{ | |
| 1632 | + journal_t *journal; | |
| 1633 | + | |
| 1634 | + if (!handle->h_reserved) | |
| 1635 | + journal = handle->h_transaction->t_journal; | |
| 1636 | + else | |
| 1637 | + journal = handle->h_journal; | |
| 1638 | + | |
| 1639 | + return handle->h_total_credits - | |
| 1640 | + DIV_ROUND_UP(handle->h_revoke_credits_requested, | |
| 1641 | + journal->j_revoke_records_per_block); | |
| 1642 | +} | |
| 1643 | + | |
| 1648 | 1644 | #ifdef __KERNEL__ |
| 1649 | 1645 | |
| 1650 | 1646 | #define buffer_trace_init(bh) do {} while (0) |
| @@ -11,6 +11,8 @@ · 10 unmodified lines | ||
| 11 | 11 | #ifndef JOURNAL_HEAD_H_INCLUDED |
| 12 | 12 | #define JOURNAL_HEAD_H_INCLUDED |
| 13 | 13 | |
| 14 | +#include <linux/spinlock.h> | |
| 15 | + | |
| 14 | 16 | typedef unsigned int tid_t; /* Unique transaction ID */ |
| 15 | 17 | typedef struct transaction_s transaction_t; /* Compound transaction type */ |
| 16 | 18 | |
| @@ -23,6 +25,11 @@ struct journal_head { · 6 unmodified lines | ||
| 23 | 25 | */ |
| 24 | 26 | struct buffer_head *b_bh; |
| 25 | 27 | |
| 28 | + /* | |
| 29 | + * Protect the buffer head state | |
| 30 | + */ | |
| 31 | + spinlock_t b_state_lock; | |
| 32 | + | |
| 26 | 33 | /* |
| 27 | 34 | * Reference count - see description in journal.c |
| 28 | 35 | * [jbd_lock_bh_journal_head()] |
| @@ -30,7 +37,7 @@ struct journal_head { · 1 unmodified line | ||
| 30 | 37 | int b_jcount; |
| 31 | 38 | |
| 32 | 39 | /* |
| 33 | − * Journalling list for this buffer [jbd_lock_bh_state()] | |
| 40 | + * Journalling list for this buffer [b_state_lock] | |
| 34 | 41 | * NOTE: We *cannot* combine this with b_modified into a bitfield |
| 35 | 42 | * as gcc would then (which the C standard allows but which is |
| 36 | 43 | * very unuseful) make 64-bit accesses to the bitfield and clobber |
| @@ -41,20 +48,20 @@ struct journal_head { · 4 unmodified lines | ||
| 41 | 48 | /* |
| 42 | 49 | * This flag signals the buffer has been modified by |
| 43 | 50 | * the currently running transaction |
| 44 | − * [jbd_lock_bh_state()] | |
| 51 | + * [b_state_lock] | |
| 45 | 52 | */ |
| 46 | 53 | unsigned b_modified; |
| 47 | 54 | |
| 48 | 55 | /* |
| 49 | 56 | * Copy of the buffer data frozen for writing to the log. |
| 50 | − * [jbd_lock_bh_state()] | |
| 57 | + * [b_state_lock] | |
| 51 | 58 | */ |
| 52 | 59 | char *b_frozen_data; |
| 53 | 60 | |
| 54 | 61 | /* |
| 55 | 62 | * Pointer to a saved copy of the buffer containing no uncommitted |
| 56 | 63 | * deallocation references, so that allocations can avoid overwriting |
| 57 | − * uncommitted deletes. [jbd_lock_bh_state()] | |
| 64 | + * uncommitted deletes. [b_state_lock] | |
| 58 | 65 | */ |
| 59 | 66 | char *b_committed_data; |
| 60 | 67 | |
| @@ -63,7 +70,7 @@ struct journal_head { · 2 unmodified lines | ||
| 63 | 70 | * metadata: either the running transaction or the committing |
| 64 | 71 | * transaction (if there is one). Only applies to buffers on a |
| 65 | 72 | * transaction's data or metadata journaling list. |
| 66 | − * [j_list_lock] [jbd_lock_bh_state()] | |
| 73 | + * [j_list_lock] [b_state_lock] | |
| 67 | 74 | * Either of these locks is enough for reading, both are needed for |
| 68 | 75 | * changes. |
| 69 | 76 | */ |
| @@ -73,13 +80,13 @@ struct journal_head { · 3 unmodified lines | ||
| 73 | 80 | * Pointer to the running compound transaction which is currently |
| 74 | 81 | * modifying the buffer's metadata, if there was already a transaction |
| 75 | 82 | * committing it when the new transaction touched it. |
| 76 | − * [t_list_lock] [jbd_lock_bh_state()] | |
| 83 | + * [t_list_lock] [b_state_lock] | |
| 77 | 84 | */ |
| 78 | 85 | transaction_t *b_next_transaction; |
| 79 | 86 | |
| 80 | 87 | /* |
| 81 | 88 | * Doubly-linked list of buffers on a transaction's data, metadata or |
| 82 | − * forget queue. [t_list_lock] [jbd_lock_bh_state()] | |
| 89 | + * forget queue. [t_list_lock] [b_state_lock] | |
| 83 | 90 | */ |
| 84 | 91 | struct journal_head *b_tnext, *b_tprev; |
| 85 | 92 | |
| @@ -70,8 +70,18 @@ struct kasan_cache { · 69 unmodified lines | ||
| 70 | 70 | int free_meta_offset; |
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | +/* | |
| 74 | + * These functions provide a special case to support backing module | |
| 75 | + * allocations with real shadow memory. With KASAN vmalloc, the special | |
| 76 | + * case is unnecessary, as the work is handled in the generic case. | |
| 77 | + */ | |
| 78 | +#ifndef CONFIG_KASAN_VMALLOC | |
| 73 | 79 | int kasan_module_alloc(void *addr, size_t size); |
| 74 | 80 | void kasan_free_shadow(const struct vm_struct *vm); |
| 81 | +#else | |
| 82 | +static inline int kasan_module_alloc(void *addr, size_t size) { return 0; } | |
| 83 | +static inline void kasan_free_shadow(const struct vm_struct *vm) {} | |
| 84 | +#endif | |
| 75 | 85 | |
| 76 | 86 | int kasan_add_zero_shadow(void *start, unsigned long size); |
| 77 | 87 | void kasan_remove_zero_shadow(void *start, unsigned long size); |
| @@ -194,4 +204,28 @@ static inline void *kasan_reset_tag(const void *addr) · 116 unmodified lines | ||
| 194 | 204 | |
| 195 | 205 | #endif /* CONFIG_KASAN_SW_TAGS */ |
| 196 | 206 | |
| 207 | +#ifdef CONFIG_KASAN_VMALLOC | |
| 208 | +int kasan_populate_vmalloc(unsigned long addr, unsigned long size); | |
| 209 | +void kasan_poison_vmalloc(const void *start, unsigned long size); | |
| 210 | +void kasan_unpoison_vmalloc(const void *start, unsigned long size); | |
| 211 | +void kasan_release_vmalloc(unsigned long start, unsigned long end, | |
| 212 | + unsigned long free_region_start, | |
| 213 | + unsigned long free_region_end); | |
| 214 | +#else | |
| 215 | +static inline int kasan_populate_vmalloc(unsigned long start, | |
| 216 | + unsigned long size) | |
| 217 | +{ | |
| 218 | + return 0; | |
| 219 | +} | |
| 220 | + | |
| 221 | +static inline void kasan_poison_vmalloc(const void *start, unsigned long size) | |
| 222 | +{ } | |
| 223 | +static inline void kasan_unpoison_vmalloc(const void *start, unsigned long size) | |
| 224 | +{ } | |
| 225 | +static inline void kasan_release_vmalloc(unsigned long start, | |
| 226 | + unsigned long end, | |
| 227 | + unsigned long free_region_start, | |
| 228 | + unsigned long free_region_end) {} | |
| 229 | +#endif | |
| 230 | + | |
| 197 | 231 | #endif /* LINUX_KASAN_H */ |
| @@ -37,12 +37,35 @@ do { \ · 36 unmodified lines | ||
| 37 | 37 | (t)->kcov_mode &= ~KCOV_IN_CTXSW; \ |
| 38 | 38 | } while (0) |
| 39 | 39 | |
| 40 | +/* See Documentation/dev-tools/kcov.rst for usage details. */ | |
| 41 | +void kcov_remote_start(u64 handle); | |
| 42 | +void kcov_remote_stop(void); | |
| 43 | +u64 kcov_common_handle(void); | |
| 44 | + | |
| 45 | +static inline void kcov_remote_start_common(u64 id) | |
| 46 | +{ | |
| 47 | + kcov_remote_start(kcov_remote_handle(KCOV_SUBSYSTEM_COMMON, id)); | |
| 48 | +} | |
| 49 | + | |
| 50 | +static inline void kcov_remote_start_usb(u64 id) | |
| 51 | +{ | |
| 52 | + kcov_remote_start(kcov_remote_handle(KCOV_SUBSYSTEM_USB, id)); | |
| 53 | +} | |
| 54 | + | |
| 40 | 55 | #else |
| 41 | 56 | |
| 42 | 57 | static inline void kcov_task_init(struct task_struct *t) {} |
| 43 | 58 | static inline void kcov_task_exit(struct task_struct *t) {} |
| 44 | 59 | static inline void kcov_prepare_switch(struct task_struct *t) {} |
| 45 | 60 | static inline void kcov_finish_switch(struct task_struct *t) {} |
| 61 | +static inline void kcov_remote_start(u64 handle) {} | |
| 62 | +static inline void kcov_remote_stop(void) {} | |
| 63 | +static inline u64 kcov_common_handle(void) | |
| 64 | +{ | |
| 65 | + return 0; | |
| 66 | +} | |
| 67 | +static inline void kcov_remote_start_common(u64 id) {} | |
| 68 | +static inline void kcov_remote_start_usb(u64 id) {} | |
| 46 | 69 | |
| 47 | 70 | #endif /* CONFIG_KCOV */ |
| 48 | 71 | #endif /* _LINUX_KCOV_H */ |
| @@ -328,13 +328,6 @@ extern int oops_may_print(void); · 327 unmodified lines | ||
| 328 | 328 | void do_exit(long error_code) __noreturn; |
| 329 | 329 | void complete_and_exit(struct completion *, long) __noreturn; |
| 330 | 330 | |
| 331 | −#ifdef CONFIG_ARCH_HAS_REFCOUNT | |
| 332 | −void refcount_error_report(struct pt_regs *regs, const char *err); | |
| 333 | −#else | |
| 334 | −static inline void refcount_error_report(struct pt_regs *regs, const char *err) | |
| 335 | −{ } | |
| 336 | −#endif | |
| 337 | − | |
| 338 | 331 | /* Internal, do not use. */ |
| 339 | 332 | int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); |
| 340 | 333 | int __must_check _kstrtol(const char *s, unsigned int base, long *res); |
| @@ -355,8 +348,7 @@ int __must_check kstrtoll(const char *s, unsigned int base, long long *res); · 14 unmodified lines | ||
| 355 | 348 | * @res: Where to write the result of the conversion on success. |
| 356 | 349 | * |
| 357 | 350 | * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. |
| 358 | − * Used as a replacement for the obsolete simple_strtoull. Return code must | |
| 359 | − * be checked. | |
| 351 | + * Used as a replacement for the simple_strtoull. Return code must be checked. | |
| 360 | 352 | */ |
| 361 | 353 | static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res) |
| 362 | 354 | { |
| @@ -384,8 +376,7 @@ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsign · 21 unmodified lines | ||
| 384 | 376 | * @res: Where to write the result of the conversion on success. |
| 385 | 377 | * |
| 386 | 378 | * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. |
| 387 | − * Used as a replacement for the obsolete simple_strtoull. Return code must | |
| 388 | − * be checked. | |
| 379 | + * Used as a replacement for the simple_strtoull. Return code must be checked. | |
| 389 | 380 | */ |
| 390 | 381 | static inline int __must_check kstrtol(const char *s, unsigned int base, long *res) |
| 391 | 382 | { |
| @@ -461,7 +452,18 @@ static inline int __must_check kstrtos32_from_user(const char __user *s, size_t · 69 unmodified lines | ||
| 461 | 452 | return kstrtoint_from_user(s, count, base, res); |
| 462 | 453 | } |
| 463 | 454 | |
| 464 | −/* Obsolete, do not use. Use kstrto<foo> instead */ | |
| 455 | +/* | |
| 456 | + * Use kstrto<foo> instead. | |
| 457 | + * | |
| 458 | + * NOTE: simple_strto<foo> does not check for the range overflow and, | |
| 459 | + * depending on the input, may give interesting results. | |
| 460 | + * | |
| 461 | + * Use these functions if and only if you cannot use kstrto<foo>, because | |
| 462 | + * the conversion ends on the first non-digit character, which may be far | |
| 463 | + * beyond the supported range. It might be useful to parse the strings like | |
| 464 | + * 10x50 or 12:21 without altering original string or temporary buffer in use. | |
| 465 | + * Keep in mind above caveat. | |
| 466 | + */ | |
| 465 | 467 | |
| 466 | 468 | extern unsigned long simple_strtoul(const char *,char **,unsigned int); |
| 467 | 469 | extern long simple_strtol(const char *,char **,unsigned int); |
| @@ -78,6 +78,24 @@ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu) · 77 unmodified lines | ||
| 78 | 78 | return kstat_cpu(cpu).irqs_sum; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | |
| 82 | +extern u64 kcpustat_field(struct kernel_cpustat *kcpustat, | |
| 83 | + enum cpu_usage_stat usage, int cpu); | |
| 84 | +extern void kcpustat_cpu_fetch(struct kernel_cpustat *dst, int cpu); | |
| 85 | +#else | |
| 86 | +static inline u64 kcpustat_field(struct kernel_cpustat *kcpustat, | |
| 87 | + enum cpu_usage_stat usage, int cpu) | |
| 88 | +{ | |
| 89 | + return kcpustat->cpustat[usage]; | |
| 90 | +} | |
| 91 | + | |
| 92 | +static inline void kcpustat_cpu_fetch(struct kernel_cpustat *dst, int cpu) | |
| 93 | +{ | |
| 94 | + *dst = kcpustat_cpu(cpu); | |
| 95 | +} | |
| 96 | + | |
| 97 | +#endif | |
| 98 | + | |
| 81 | 99 | extern void account_user_time(struct task_struct *, u64); |
| 82 | 100 | extern void account_guest_time(struct task_struct *, u64); |
| 83 | 101 | extern void account_system_time(struct task_struct *, int, u64); |
| @@ -104,21 +104,6 @@ struct kernfs_elem_attr { · 103 unmodified lines | ||
| 104 | 104 | struct kernfs_node *notify_next; /* for kernfs_notify() */ |
| 105 | 105 | }; |
| 106 | 106 | |
| 107 | −/* represent a kernfs node */ | |
| 108 | −union kernfs_node_id { | |
| 109 | − struct { | |
| 110 | − /* | |
| 111 | − * blktrace will export this struct as a simplified 'struct | |
| 112 | − * fid' (which is a big data struction), so userspace can use | |
| 113 | − * it to find kernfs node. The layout must match the first two | |
| 114 | − * fields of 'struct fid' exactly. | |
| 115 | − */ | |
| 116 | − u32 ino; | |
| 117 | − u32 generation; | |
| 118 | − }; | |
| 119 | − u64 id; | |
| 120 | −}; | |
| 121 | − | |
| 122 | 107 | /* |
| 123 | 108 | * kernfs_node - the building block of kernfs hierarchy. Each and every |
| 124 | 109 | * kernfs node is represented by single kernfs_node. Most fields are |
| @@ -155,7 +140,12 @@ struct kernfs_node { · 30 unmodified lines | ||
| 155 | 140 | |
| 156 | 141 | void *priv; |
| 157 | 142 | |
| 158 | − union kernfs_node_id id; | |
| 143 | + /* | |
| 144 | + * 64bit unique ID. On 64bit ino setups, id is the ino. On 32bit, | |
| 145 | + * the low 32bits are ino and upper generation. | |
| 146 | + */ | |
| 147 | + u64 id; | |
| 148 | + | |
| 159 | 149 | unsigned short flags; |
| 160 | 150 | umode_t mode; |
| 161 | 151 | struct kernfs_iattrs *iattr; |
| @@ -187,7 +177,8 @@ struct kernfs_root { · 25 unmodified lines | ||
| 187 | 177 | |
| 188 | 178 | /* private fields, do not use outside kernfs proper */ |
| 189 | 179 | struct idr ino_idr; |
| 190 | − u32 next_generation; | |
| 180 | + u32 last_id_lowbits; | |
| 181 | + u32 id_highbits; | |
| 191 | 182 | struct kernfs_syscall_ops *syscall_ops; |
| 192 | 183 | |
| 193 | 184 | /* list of kernfs_super_info of this root, protected by kernfs_mutex */ |
| @@ -291,6 +282,34 @@ static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) · 97 unmodified lines | ||
| 291 | 282 | return kn->flags & KERNFS_TYPE_MASK; |
| 292 | 283 | } |
| 293 | 284 | |
| 285 | +static inline ino_t kernfs_id_ino(u64 id) | |
| 286 | +{ | |
| 287 | + /* id is ino if ino_t is 64bit; otherwise, low 32bits */ | |
| 288 | + if (sizeof(ino_t) >= sizeof(u64)) | |
| 289 | + return id; | |
| 290 | + else | |
| 291 | + return (u32)id; | |
| 292 | +} | |
| 293 | + | |
| 294 | +static inline u32 kernfs_id_gen(u64 id) | |
| 295 | +{ | |
| 296 | + /* gen is fixed at 1 if ino_t is 64bit; otherwise, high 32bits */ | |
| 297 | + if (sizeof(ino_t) >= sizeof(u64)) | |
| 298 | + return 1; | |
| 299 | + else | |
| 300 | + return id >> 32; | |
| 301 | +} | |
| 302 | + | |
| 303 | +static inline ino_t kernfs_ino(struct kernfs_node *kn) | |
| 304 | +{ | |
| 305 | + return kernfs_id_ino(kn->id); | |
| 306 | +} | |
| 307 | + | |
| 308 | +static inline ino_t kernfs_gen(struct kernfs_node *kn) | |
| 309 | +{ | |
| 310 | + return kernfs_id_gen(kn->id); | |
| 311 | +} | |
| 312 | + | |
| 294 | 313 | /** |
| 295 | 314 | * kernfs_enable_ns - enable namespace under a directory |
| 296 | 315 | * @kn: directory of interest, should be empty |
| @@ -382,8 +401,8 @@ void kernfs_kill_sb(struct super_block *sb); · 85 unmodified lines | ||
| 382 | 401 | |
| 383 | 402 | void kernfs_init(void); |
| 384 | 403 | |
| 385 | −struct kernfs_node *kernfs_get_node_by_id(struct kernfs_root *root, | |
| 386 | − const union kernfs_node_id *id); | |
| 404 | +struct kernfs_node *kernfs_find_and_get_node_by_id(struct kernfs_root *root, | |
| 405 | + u64 id); | |
| 387 | 406 | #else /* CONFIG_KERNFS */ |
| 388 | 407 | |
| 389 | 408 | static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) |
| @@ -149,7 +149,7 @@ static inline bool is_error_page(struct page *page) · 148 unmodified lines | ||
| 149 | 149 | #define KVM_REQUEST_ARCH_BASE 8 |
| 150 | 150 | |
| 151 | 151 | #define KVM_ARCH_REQ_FLAGS(nr, flags) ({ \ |
| 152 | − BUILD_BUG_ON((unsigned)(nr) >= (FIELD_SIZEOF(struct kvm_vcpu, requests) * 8) - KVM_REQUEST_ARCH_BASE); \ | |
| 152 | + BUILD_BUG_ON((unsigned)(nr) >= (sizeof_field(struct kvm_vcpu, requests) * 8) - KVM_REQUEST_ARCH_BASE); \ | |
| 153 | 153 | (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \ |
| 154 | 154 | }) |
| 155 | 155 | #define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0) |
| @@ -266,7 +266,8 @@ struct kvm_vcpu { · 110 unmodified lines | ||
| 266 | 266 | struct preempt_notifier preempt_notifier; |
| 267 | 267 | #endif |
| 268 | 268 | int cpu; |
| 269 | − int vcpu_id; | |
| 269 | + int vcpu_id; /* id given by userspace at creation */ | |
| 270 | + int vcpu_idx; /* index in kvm->vcpus array */ | |
| 270 | 271 | int srcu_idx; |
| 271 | 272 | int mode; |
| 272 | 273 | u64 requests; |
| @@ -278,7 +279,6 @@ struct kvm_vcpu { · 5 unmodified lines | ||
| 278 | 279 | struct mutex mutex; |
| 279 | 280 | struct kvm_run *run; |
| 280 | 281 | |
| 281 | − int guest_xcr0_loaded; | |
| 282 | 282 | struct swait_queue_head wq; |
| 283 | 283 | struct pid __rcu *pid; |
| 284 | 284 | int sigset_active; |
| @@ -571,13 +571,7 @@ static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id) · 286 unmodified lines | ||
| 571 | 571 | |
| 572 | 572 | static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) |
| 573 | 573 | { |
| 574 | − struct kvm_vcpu *tmp; | |
| 575 | − int idx; | |
| 576 | − | |
| 577 | − kvm_for_each_vcpu(idx, tmp, vcpu->kvm) | |
| 578 | − if (tmp == vcpu) | |
| 579 | − return idx; | |
| 580 | − BUG(); | |
| 574 | + return vcpu->vcpu_idx; | |
| 581 | 575 | } |
| 582 | 576 | |
| 583 | 577 | #define kvm_for_each_memslot(memslot, slots) \ |
| @@ -622,6 +616,7 @@ void kvm_exit(void); · 38 unmodified lines | ||
| 622 | 616 | |
| 623 | 617 | void kvm_get_kvm(struct kvm *kvm); |
| 624 | 618 | void kvm_put_kvm(struct kvm *kvm); |
| 619 | +void kvm_put_kvm_no_destroy(struct kvm *kvm); | |
| 625 | 620 | |
| 626 | 621 | static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) |
| 627 | 622 | { |
| @@ -746,6 +741,28 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, · 118 unmodified lines | ||
| 746 | 741 | unsigned long len); |
| 747 | 742 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
| 748 | 743 | gpa_t gpa, unsigned long len); |
| 744 | + | |
| 745 | +#define __kvm_put_guest(kvm, gfn, offset, value, type) \ | |
| 746 | +({ \ | |
| 747 | + unsigned long __addr = gfn_to_hva(kvm, gfn); \ | |
| 748 | + type __user *__uaddr = (type __user *)(__addr + offset); \ | |
| 749 | + int __ret = -EFAULT; \ | |
| 750 | + \ | |
| 751 | + if (!kvm_is_error_hva(__addr)) \ | |
| 752 | + __ret = put_user(value, __uaddr); \ | |
| 753 | + if (!__ret) \ | |
| 754 | + mark_page_dirty(kvm, gfn); \ | |
| 755 | + __ret; \ | |
| 756 | +}) | |
| 757 | + | |
| 758 | +#define kvm_put_guest(kvm, gpa, value, type) \ | |
| 759 | +({ \ | |
| 760 | + gpa_t __gpa = gpa; \ | |
| 761 | + struct kvm *__kvm = kvm; \ | |
| 762 | + __kvm_put_guest(__kvm, __gpa >> PAGE_SHIFT, \ | |
| 763 | + offset_in_page(__gpa), (value), type); \ | |
| 764 | +}) | |
| 765 | + | |
| 749 | 766 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); |
| 750 | 767 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); |
| 751 | 768 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); |
| @@ -791,6 +808,8 @@ void kvm_reload_remote_mmus(struct kvm *kvm); · 39 unmodified lines | ||
| 791 | 808 | bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, |
| 792 | 809 | unsigned long *vcpu_bitmap, cpumask_var_t tmp); |
| 793 | 810 | bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req); |
| 811 | +bool kvm_make_cpus_request_mask(struct kvm *kvm, unsigned int req, | |
| 812 | + unsigned long *vcpu_bitmap); | |
| 794 | 813 | |
| 795 | 814 | long kvm_arch_dev_ioctl(struct file *filp, |
| 796 | 815 | unsigned int ioctl, unsigned long arg); |
| @@ -1241,7 +1260,7 @@ extern unsigned int halt_poll_ns_grow_start; · 444 unmodified lines | ||
| 1241 | 1260 | extern unsigned int halt_poll_ns_shrink; |
| 1242 | 1261 | |
| 1243 | 1262 | struct kvm_device { |
| 1244 | − struct kvm_device_ops *ops; | |
| 1263 | + const struct kvm_device_ops *ops; | |
| 1245 | 1264 | struct kvm *kvm; |
| 1246 | 1265 | void *private; |
| 1247 | 1266 | struct list_head vm_node; |
| @@ -1294,7 +1313,7 @@ struct kvm_device_ops { · 46 unmodified lines | ||
| 1294 | 1313 | void kvm_device_get(struct kvm_device *dev); |
| 1295 | 1314 | void kvm_device_put(struct kvm_device *dev); |
| 1296 | 1315 | struct kvm_device *kvm_device_from_filp(struct file *filp); |
| 1297 | −int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type); | |
| 1316 | +int kvm_register_device_ops(const struct kvm_device_ops *ops, u32 type); | |
| 1298 | 1317 | void kvm_unregister_device_ops(u32 type); |
| 1299 | 1318 | |
| 1300 | 1319 | extern struct kvm_device_ops kvm_mpic_ops; |
| @@ -35,6 +35,8 @@ typedef unsigned long gva_t; · 34 unmodified lines | ||
| 35 | 35 | typedef u64 gpa_t; |
| 36 | 36 | typedef u64 gfn_t; |
| 37 | 37 | |
| 38 | +#define GPA_INVALID (~(gpa_t)0) | |
| 39 | + | |
| 38 | 40 | typedef unsigned long hva_t; |
| 39 | 41 | typedef u64 hpa_t; |
| 40 | 42 | typedef u64 hfn_t; |
| @@ -94,12 +94,15 @@ static inline struct led_classdev_flash *lcdev_to_flcdev( · 93 unmodified lines | ||
| 94 | 94 | * |
| 95 | 95 | * Returns: 0 on success or negative error value on failure |
| 96 | 96 | */ |
| 97 | −extern int led_classdev_flash_register_ext(struct device *parent, | |
| 98 | − struct led_classdev_flash *fled_cdev, | |
| 99 | − struct led_init_data *init_data); | |
| 97 | +int led_classdev_flash_register_ext(struct device *parent, | |
| 98 | + struct led_classdev_flash *fled_cdev, | |
| 99 | + struct led_init_data *init_data); | |
| 100 | 100 | |
| 101 | −#define led_classdev_flash_register(parent, fled_cdev) \ | |
| 102 | − led_classdev_flash_register_ext(parent, fled_cdev, NULL) | |
| 101 | +static inline int led_classdev_flash_register(struct device *parent, | |
| 102 | + struct led_classdev_flash *fled_cdev) | |
| 103 | +{ | |
| 104 | + return led_classdev_flash_register_ext(parent, fled_cdev, NULL); | |
| 105 | +} | |
| 103 | 106 | |
| 104 | 107 | /** |
| 105 | 108 | * led_classdev_flash_unregister - unregisters an object of led_classdev class |
| @@ -108,7 +111,21 @@ extern int led_classdev_flash_register_ext(struct device *parent, · 2 unmodified lines | ||
| 108 | 111 | * |
| 109 | 112 | * Unregister a previously registered via led_classdev_flash_register object |
| 110 | 113 | */ |
| 111 | −extern void led_classdev_flash_unregister(struct led_classdev_flash *fled_cdev); | |
| 114 | +void led_classdev_flash_unregister(struct led_classdev_flash *fled_cdev); | |
| 115 | + | |
| 116 | +int devm_led_classdev_flash_register_ext(struct device *parent, | |
| 117 | + struct led_classdev_flash *fled_cdev, | |
| 118 | + struct led_init_data *init_data); | |
| 119 | + | |
| 120 | + | |
| 121 | +static inline int devm_led_classdev_flash_register(struct device *parent, | |
| 122 | + struct led_classdev_flash *fled_cdev) | |
| 123 | +{ | |
| 124 | + return devm_led_classdev_flash_register_ext(parent, fled_cdev, NULL); | |
| 125 | +} | |
| 126 | + | |
| 127 | +void devm_led_classdev_flash_unregister(struct device *parent, | |
| 128 | + struct led_classdev_flash *fled_cdev); | |
| 112 | 129 | |
| 113 | 130 | /** |
| 114 | 131 | * led_set_flash_strobe - setup flash strobe |
| @@ -156,8 +173,8 @@ static inline int led_get_flash_strobe(struct led_classdev_flash *fled_cdev, · 41 unmodified lines | ||
| 156 | 173 | * |
| 157 | 174 | * Returns: 0 on success or negative error value on failure |
| 158 | 175 | */ |
| 159 | −extern int led_set_flash_brightness(struct led_classdev_flash *fled_cdev, | |
| 160 | − u32 brightness); | |
| 176 | +int led_set_flash_brightness(struct led_classdev_flash *fled_cdev, | |
| 177 | + u32 brightness); | |
| 161 | 178 | |
| 162 | 179 | /** |
| 163 | 180 | * led_update_flash_brightness - update flash LED brightness |
| @@ -168,7 +185,7 @@ extern int led_set_flash_brightness(struct led_classdev_flash *fled_cdev, · 4 unmodified lines | ||
| 168 | 185 | * |
| 169 | 186 | * Returns: 0 on success or negative error value on failure |
| 170 | 187 | */ |
| 171 | −extern int led_update_flash_brightness(struct led_classdev_flash *fled_cdev); | |
| 188 | +int led_update_flash_brightness(struct led_classdev_flash *fled_cdev); | |
| 172 | 189 | |
| 173 | 190 | /** |
| 174 | 191 | * led_set_flash_timeout - set flash LED timeout |
| @@ -179,8 +196,7 @@ extern int led_update_flash_brightness(struct led_classdev_flash *fled_cdev); · 4 unmodified lines | ||
| 179 | 196 | * |
| 180 | 197 | * Returns: 0 on success or negative error value on failure |
| 181 | 198 | */ |
| 182 | −extern int led_set_flash_timeout(struct led_classdev_flash *fled_cdev, | |
| 183 | − u32 timeout); | |
| 199 | +int led_set_flash_timeout(struct led_classdev_flash *fled_cdev, u32 timeout); | |
| 184 | 200 | |
| 185 | 201 | /** |
| 186 | 202 | * led_get_flash_fault - get the flash LED fault |
| @@ -191,7 +207,6 @@ extern int led_set_flash_timeout(struct led_classdev_flash *fled_cdev, · 4 unmodified lines | ||
| 191 | 207 | * |
| 192 | 208 | * Returns: 0 on success or negative error value on failure |
| 193 | 209 | */ |
| 194 | −extern int led_get_flash_fault(struct led_classdev_flash *fled_cdev, | |
| 195 | − u32 *fault); | |
| 210 | +int led_get_flash_fault(struct led_classdev_flash *fled_cdev, u32 *fault); | |
| 196 | 211 | |
| 197 | 212 | #endif /* __LINUX_FLASH_LEDS_H_INCLUDED */ |
| @@ -161,7 +161,7 @@ struct led_classdev { · 160 unmodified lines | ||
| 161 | 161 | * |
| 162 | 162 | * Returns: 0 on success or negative error value on failure |
| 163 | 163 | */ |
| 164 | −extern int led_classdev_register_ext(struct device *parent, | |
| 164 | +int led_classdev_register_ext(struct device *parent, | |
| 165 | 165 | struct led_classdev *led_cdev, |
| 166 | 166 | struct led_init_data *init_data); |
| 167 | 167 | |
| @@ -181,7 +181,7 @@ static inline int led_classdev_register(struct device *parent, · 13 unmodified lines | ||
| 181 | 181 | return led_classdev_register_ext(parent, led_cdev, NULL); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | −extern int devm_led_classdev_register_ext(struct device *parent, | |
| 184 | +int devm_led_classdev_register_ext(struct device *parent, | |
| 185 | 185 | struct led_classdev *led_cdev, |
| 186 | 186 | struct led_init_data *init_data); |
| 187 | 187 | |
| @@ -190,11 +190,11 @@ static inline int devm_led_classdev_register(struct device *parent, · 2 unmodified lines | ||
| 190 | 190 | { |
| 191 | 191 | return devm_led_classdev_register_ext(parent, led_cdev, NULL); |
| 192 | 192 | } |
| 193 | −extern void led_classdev_unregister(struct led_classdev *led_cdev); | |
| 194 | −extern void devm_led_classdev_unregister(struct device *parent, | |
| 195 | − struct led_classdev *led_cdev); | |
| 196 | −extern void led_classdev_suspend(struct led_classdev *led_cdev); | |
| 197 | −extern void led_classdev_resume(struct led_classdev *led_cdev); | |
| 193 | +void led_classdev_unregister(struct led_classdev *led_cdev); | |
| 194 | +void devm_led_classdev_unregister(struct device *parent, | |
| 195 | + struct led_classdev *led_cdev); | |
| 196 | +void led_classdev_suspend(struct led_classdev *led_cdev); | |
| 197 | +void led_classdev_resume(struct led_classdev *led_cdev); | |
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * led_blink_set - set blinking with software fallback |
| @@ -211,9 +211,8 @@ extern void led_classdev_resume(struct led_classdev *led_cdev); · 10 unmodified lines | ||
| 211 | 211 | * led_cdev->brightness_set() will not stop the blinking, |
| 212 | 212 | * use led_classdev_brightness_set() instead. |
| 213 | 213 | */ |
| 214 | −extern void led_blink_set(struct led_classdev *led_cdev, | |
| 215 | − unsigned long *delay_on, | |
| 216 | − unsigned long *delay_off); | |
| 214 | +void led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, | |
| 215 | + unsigned long *delay_off); | |
| 217 | 216 | /** |
| 218 | 217 | * led_blink_set_oneshot - do a oneshot software blink |
| 219 | 218 | * @led_cdev: the LED to start blinking |
| @@ -228,10 +227,9 @@ extern void led_blink_set(struct led_classdev *led_cdev, · 8 unmodified lines | ||
| 228 | 227 | * If invert is set, led blinks for delay_off first, then for |
| 229 | 228 | * delay_on and leave the led on after the on-off cycle. |
| 230 | 229 | */ |
| 231 | −extern void led_blink_set_oneshot(struct led_classdev *led_cdev, | |
| 232 | − unsigned long *delay_on, | |
| 233 | − unsigned long *delay_off, | |
| 234 | − int invert); | |
| 230 | +void led_blink_set_oneshot(struct led_classdev *led_cdev, | |
| 231 | + unsigned long *delay_on, unsigned long *delay_off, | |
| 232 | + int invert); | |
| 235 | 233 | /** |
| 236 | 234 | * led_set_brightness - set LED brightness |
| 237 | 235 | * @led_cdev: the LED to set |
| @@ -241,8 +239,8 @@ extern void led_blink_set_oneshot(struct led_classdev *led_cdev, · 3 unmodified lines | ||
| 241 | 239 | * software blink timer that implements blinking when the |
| 242 | 240 | * hardware doesn't. This function is guaranteed not to sleep. |
| 243 | 241 | */ |
| 244 | −extern void led_set_brightness(struct led_classdev *led_cdev, | |
| 245 | − enum led_brightness brightness); | |
| 242 | +void led_set_brightness(struct led_classdev *led_cdev, | |
| 243 | + enum led_brightness brightness); | |
| 246 | 244 | |
| 247 | 245 | /** |
| 248 | 246 | * led_set_brightness_sync - set LED brightness synchronously |
| @@ -255,8 +253,8 @@ extern void led_set_brightness(struct led_classdev *led_cdev, · 6 unmodified lines | ||
| 255 | 253 | * |
| 256 | 254 | * Returns: 0 on success or negative error value on failure |
| 257 | 255 | */ |
| 258 | −extern int led_set_brightness_sync(struct led_classdev *led_cdev, | |
| 259 | − enum led_brightness value); | |
| 256 | +int led_set_brightness_sync(struct led_classdev *led_cdev, | |
| 257 | + enum led_brightness value); | |
| 260 | 258 | |
| 261 | 259 | /** |
| 262 | 260 | * led_update_brightness - update LED brightness |
| @@ -267,7 +265,7 @@ extern int led_set_brightness_sync(struct led_classdev *led_cdev, · 4 unmodified lines | ||
| 267 | 265 | * |
| 268 | 266 | * Returns: 0 on success or negative error value on failure |
| 269 | 267 | */ |
| 270 | −extern int led_update_brightness(struct led_classdev *led_cdev); | |
| 268 | +int led_update_brightness(struct led_classdev *led_cdev); | |
| 271 | 269 | |
| 272 | 270 | /** |
| 273 | 271 | * led_get_default_pattern - return default pattern |
| @@ -279,8 +277,7 @@ extern int led_update_brightness(struct led_classdev *led_cdev); · 5 unmodified lines | ||
| 279 | 277 | * Return: Allocated array of integers with default pattern from device tree |
| 280 | 278 | * or NULL. Caller is responsible for kfree(). |
| 281 | 279 | */ |
| 282 | −extern u32 *led_get_default_pattern(struct led_classdev *led_cdev, | |
| 283 | − unsigned int *size); | |
| 280 | +u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size); | |
| 284 | 281 | |
| 285 | 282 | /** |
| 286 | 283 | * led_sysfs_disable - disable LED sysfs interface |
| @@ -288,7 +285,7 @@ extern u32 *led_get_default_pattern(struct led_classdev *led_cdev, · 1 unmodified line | ||
| 288 | 285 | * |
| 289 | 286 | * Disable the led_cdev's sysfs interface. |
| 290 | 287 | */ |
| 291 | −extern void led_sysfs_disable(struct led_classdev *led_cdev); | |
| 288 | +void led_sysfs_disable(struct led_classdev *led_cdev); | |
| 292 | 289 | |
| 293 | 290 | /** |
| 294 | 291 | * led_sysfs_enable - enable LED sysfs interface |
| @@ -296,7 +293,7 @@ extern void led_sysfs_disable(struct led_classdev *led_cdev); · 1 unmodified line | ||
| 296 | 293 | * |
| 297 | 294 | * Enable the led_cdev's sysfs interface. |
| 298 | 295 | */ |
| 299 | −extern void led_sysfs_enable(struct led_classdev *led_cdev); | |
| 296 | +void led_sysfs_enable(struct led_classdev *led_cdev); | |
| 300 | 297 | |
| 301 | 298 | /** |
| 302 | 299 | * led_compose_name - compose LED class device name |
| @@ -310,8 +307,8 @@ extern void led_sysfs_enable(struct led_classdev *led_cdev); · 7 unmodified lines | ||
| 310 | 307 | * |
| 311 | 308 | * Returns: 0 on success or negative error value on failure |
| 312 | 309 | */ |
| 313 | −extern int led_compose_name(struct device *dev, struct led_init_data *init_data, | |
| 314 | − char *led_classdev_name); | |
| 310 | +int led_compose_name(struct device *dev, struct led_init_data *init_data, | |
| 311 | + char *led_classdev_name); | |
| 315 | 312 | |
| 316 | 313 | /** |
| 317 | 314 | * led_sysfs_is_disabled - check if LED sysfs interface is disabled |
| @@ -360,33 +357,25 @@ struct led_trigger { · 42 unmodified lines | ||
| 360 | 357 | #define led_trigger_get_led(dev) ((struct led_classdev *)dev_get_drvdata((dev))) |
| 361 | 358 | #define led_trigger_get_drvdata(dev) (led_get_trigger_data(led_trigger_get_led(dev))) |
| 362 | 359 | |
| 363 | −ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, | |
| 364 | − const char *buf, size_t count); | |
| 365 | −ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr, | |
| 366 | − char *buf); | |
| 367 | − | |
| 368 | 360 | /* Registration functions for complex triggers */ |
| 369 | −extern int led_trigger_register(struct led_trigger *trigger); | |
| 370 | −extern void led_trigger_unregister(struct led_trigger *trigger); | |
| 371 | −extern int devm_led_trigger_register(struct device *dev, | |
| 361 | +int led_trigger_register(struct led_trigger *trigger); | |
| 362 | +void led_trigger_unregister(struct led_trigger *trigger); | |
| 363 | +int devm_led_trigger_register(struct device *dev, | |
| 372 | 364 | struct led_trigger *trigger); |
| 373 | 365 | |
| 374 | −extern void led_trigger_register_simple(const char *name, | |
| 366 | +void led_trigger_register_simple(const char *name, | |
| 375 | 367 | struct led_trigger **trigger); |
| 376 | −extern void led_trigger_unregister_simple(struct led_trigger *trigger); | |
| 377 | −extern void led_trigger_event(struct led_trigger *trigger, | |
| 378 | − enum led_brightness event); | |
| 379 | −extern void led_trigger_blink(struct led_trigger *trigger, | |
| 380 | − unsigned long *delay_on, | |
| 381 | − unsigned long *delay_off); | |
| 382 | −extern void led_trigger_blink_oneshot(struct led_trigger *trigger, | |
| 383 | − unsigned long *delay_on, | |
| 384 | − unsigned long *delay_off, | |
| 385 | − int invert); | |
| 386 | −extern void led_trigger_set_default(struct led_classdev *led_cdev); | |
| 387 | −extern int led_trigger_set(struct led_classdev *led_cdev, | |
| 388 | − struct led_trigger *trigger); | |
| 389 | −extern void led_trigger_remove(struct led_classdev *led_cdev); | |
| 368 | +void led_trigger_unregister_simple(struct led_trigger *trigger); | |
| 369 | +void led_trigger_event(struct led_trigger *trigger, enum led_brightness event); | |
| 370 | +void led_trigger_blink(struct led_trigger *trigger, unsigned long *delay_on, | |
| 371 | + unsigned long *delay_off); | |
| 372 | +void led_trigger_blink_oneshot(struct led_trigger *trigger, | |
| 373 | + unsigned long *delay_on, | |
| 374 | + unsigned long *delay_off, | |
| 375 | + int invert); | |
| 376 | +void led_trigger_set_default(struct led_classdev *led_cdev); | |
| 377 | +int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger); | |
| 378 | +void led_trigger_remove(struct led_classdev *led_cdev); | |
| 390 | 379 | |
| 391 | 380 | static inline void led_set_trigger_data(struct led_classdev *led_cdev, |
| 392 | 381 | void *trigger_data) |
| @@ -414,8 +403,7 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev) · 21 unmodified lines | ||
| 414 | 403 | * This is meant to be used on triggers with statically |
| 415 | 404 | * allocated name. |
| 416 | 405 | */ |
| 417 | −extern void led_trigger_rename_static(const char *name, | |
| 418 | − struct led_trigger *trig); | |
| 406 | +void led_trigger_rename_static(const char *name, struct led_trigger *trig); | |
| 419 | 407 | |
| 420 | 408 | #define module_led_trigger(__led_trigger) \ |
| 421 | 409 | module_driver(__led_trigger, led_trigger_register, \ |
| @@ -457,20 +445,20 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev) · 35 unmodified lines | ||
| 457 | 445 | |
| 458 | 446 | /* Trigger specific functions */ |
| 459 | 447 | #ifdef CONFIG_LEDS_TRIGGER_DISK |
| 460 | −extern void ledtrig_disk_activity(bool write); | |
| 448 | +void ledtrig_disk_activity(bool write); | |
| 461 | 449 | #else |
| 462 | 450 | static inline void ledtrig_disk_activity(bool write) {} |
| 463 | 451 | #endif |
| 464 | 452 | |
| 465 | 453 | #ifdef CONFIG_LEDS_TRIGGER_MTD |
| 466 | −extern void ledtrig_mtd_activity(void); | |
| 454 | +void ledtrig_mtd_activity(void); | |
| 467 | 455 | #else |
| 468 | 456 | static inline void ledtrig_mtd_activity(void) {} |
| 469 | 457 | #endif |
| 470 | 458 | |
| 471 | 459 | #if defined(CONFIG_LEDS_TRIGGER_CAMERA) || defined(CONFIG_LEDS_TRIGGER_CAMERA_MODULE) |
| 472 | −extern void ledtrig_flash_ctrl(bool on); | |
| 473 | −extern void ledtrig_torch_ctrl(bool on); | |
| 460 | +void ledtrig_flash_ctrl(bool on); | |
| 461 | +void ledtrig_torch_ctrl(bool on); | |
| 474 | 462 | #else |
| 475 | 463 | static inline void ledtrig_flash_ctrl(bool on) {} |
| 476 | 464 | static inline void ledtrig_torch_ctrl(bool on) {} |
| @@ -550,7 +538,7 @@ enum cpu_led_event { · 73 unmodified lines | ||
| 550 | 538 | CPU_LED_HALTED, /* Machine shutdown */ |
| 551 | 539 | }; |
| 552 | 540 | #ifdef CONFIG_LEDS_TRIGGER_CPU |
| 553 | −extern void ledtrig_cpu(enum cpu_led_event evt); | |
| 541 | +void ledtrig_cpu(enum cpu_led_event evt); | |
| 554 | 542 | #else |
| 555 | 543 | static inline void ledtrig_cpu(enum cpu_led_event evt) |
| 556 | 544 | { |
| @@ -559,7 +547,7 @@ static inline void ledtrig_cpu(enum cpu_led_event evt) · 2 unmodified lines | ||
| 559 | 547 | #endif |
| 560 | 548 | |
| 561 | 549 | #ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED |
| 562 | −extern void led_classdev_notify_brightness_hw_changed( | |
| 550 | +void led_classdev_notify_brightness_hw_changed( | |
| 563 | 551 | struct led_classdev *led_cdev, enum led_brightness brightness); |
| 564 | 552 | #else |
| 565 | 553 | static inline void led_classdev_notify_brightness_hw_changed( |
| @@ -484,6 +484,7 @@ enum hsm_task_states { · 483 unmodified lines | ||
| 484 | 484 | }; |
| 485 | 485 | |
| 486 | 486 | enum ata_completion_errors { |
| 487 | + AC_ERR_OK = 0, /* no error */ | |
| 487 | 488 | AC_ERR_DEV = (1 << 0), /* device reported error */ |
| 488 | 489 | AC_ERR_HSM = (1 << 1), /* host state machine violation */ |
| 489 | 490 | AC_ERR_TIMEOUT = (1 << 2), /* timeout */ |
| @@ -891,9 +892,9 @@ struct ata_port_operations { · 401 unmodified lines | ||
| 891 | 892 | /* |
| 892 | 893 | * Command execution |
| 893 | 894 | */ |
| 894 | − int (*qc_defer)(struct ata_queued_cmd *qc); | |
| 895 | − int (*check_atapi_dma)(struct ata_queued_cmd *qc); | |
| 896 | − void (*qc_prep)(struct ata_queued_cmd *qc); | |
| 895 | + int (*qc_defer)(struct ata_queued_cmd *qc); | |
| 896 | + int (*check_atapi_dma)(struct ata_queued_cmd *qc); | |
| 897 | + enum ata_completion_errors (*qc_prep)(struct ata_queued_cmd *qc); | |
| 897 | 898 | unsigned int (*qc_issue)(struct ata_queued_cmd *qc); |
| 898 | 899 | bool (*qc_fill_rtf)(struct ata_queued_cmd *qc); |
| 899 | 900 | |
| @@ -1161,7 +1162,7 @@ extern int ata_xfer_mode2shift(unsigned long xfer_mode); · 261 unmodified lines | ||
| 1161 | 1162 | extern const char *ata_mode_string(unsigned long xfer_mask); |
| 1162 | 1163 | extern unsigned long ata_id_xfermask(const u16 *id); |
| 1163 | 1164 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); |
| 1164 | −extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); | |
| 1165 | +extern enum ata_completion_errors ata_noop_qc_prep(struct ata_queued_cmd *qc); | |
| 1165 | 1166 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
| 1166 | 1167 | unsigned int n_elem); |
| 1167 | 1168 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); |
| @@ -1174,6 +1175,7 @@ extern unsigned int ata_do_dev_read_id(struct ata_device *dev, · 6 unmodified lines | ||
| 1174 | 1175 | struct ata_taskfile *tf, u16 *id); |
| 1175 | 1176 | extern void ata_qc_complete(struct ata_queued_cmd *qc); |
| 1176 | 1177 | extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active); |
| 1178 | +extern u64 ata_qc_get_active(struct ata_port *ap); | |
| 1177 | 1179 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd); |
| 1178 | 1180 | extern int ata_std_bios_param(struct scsi_device *sdev, |
| 1179 | 1181 | struct block_device *bdev, |
| @@ -1893,9 +1895,9 @@ extern const struct ata_port_operations ata_bmdma_port_ops; · 713 unmodified lines | ||
| 1893 | 1895 | .sg_tablesize = LIBATA_MAX_PRD, \ |
| 1894 | 1896 | .dma_boundary = ATA_DMA_BOUNDARY |
| 1895 | 1897 | |
| 1896 | −extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc); | |
| 1898 | +extern enum ata_completion_errors ata_bmdma_qc_prep(struct ata_queued_cmd *qc); | |
| 1897 | 1899 | extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc); |
| 1898 | −extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); | |
| 1900 | +extern enum ata_completion_errors ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); | |
| 1899 | 1901 | extern unsigned int ata_bmdma_port_intr(struct ata_port *ap, |
| 1900 | 1902 | struct ata_queued_cmd *qc); |
| 1901 | 1903 | extern irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance); |
| @@ -2,11 +2,14 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef LIBFDT_ENV_H |
| 3 | 3 | #define LIBFDT_ENV_H |
| 4 | 4 | |
| 5 | −#include <linux/kernel.h> /* For INT_MAX */ | |
| 5 | +#include <linux/limits.h> /* For INT_MAX */ | |
| 6 | 6 | #include <linux/string.h> |
| 7 | 7 | |
| 8 | 8 | #include <asm/byteorder.h> |
| 9 | 9 | |
| 10 | +#define INT32_MAX S32_MAX | |
| 11 | +#define UINT32_MAX U32_MAX | |
| 12 | + | |
| 10 | 13 | typedef __be16 fdt16_t; |
| 11 | 14 | typedef __be32 fdt32_t; |
| 12 | 15 | typedef __be64 fdt64_t; |
| @@ -65,13 +65,6 @@ enum { · 64 unmodified lines | ||
| 65 | 65 | DPA_RESOURCE_ADJUSTED = 1 << 0, |
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | −extern struct attribute_group nvdimm_bus_attribute_group; | |
| 69 | −extern struct attribute_group nvdimm_attribute_group; | |
| 70 | −extern struct attribute_group nd_device_attribute_group; | |
| 71 | −extern struct attribute_group nd_numa_attribute_group; | |
| 72 | −extern struct attribute_group nd_region_attribute_group; | |
| 73 | −extern struct attribute_group nd_mapping_attribute_group; | |
| 74 | − | |
| 75 | 68 | struct nvdimm; |
| 76 | 69 | struct nvdimm_bus_descriptor; |
| 77 | 70 | typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc, |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 1 | 2 | #ifndef __LICENSE_H |
| 2 | 3 | #define __LICENSE_H |
| 3 | 4 | |
| @@ -75,32 +75,61 @@ · 74 unmodified lines | ||
| 75 | 75 | |
| 76 | 76 | #ifdef __ASSEMBLY__ |
| 77 | 77 | |
| 78 | +/* SYM_T_FUNC -- type used by assembler to mark functions */ | |
| 79 | +#ifndef SYM_T_FUNC | |
| 80 | +#define SYM_T_FUNC STT_FUNC | |
| 81 | +#endif | |
| 82 | + | |
| 83 | +/* SYM_T_OBJECT -- type used by assembler to mark data */ | |
| 84 | +#ifndef SYM_T_OBJECT | |
| 85 | +#define SYM_T_OBJECT STT_OBJECT | |
| 86 | +#endif | |
| 87 | + | |
| 88 | +/* SYM_T_NONE -- type used by assembler to mark entries of unknown type */ | |
| 89 | +#ifndef SYM_T_NONE | |
| 90 | +#define SYM_T_NONE STT_NOTYPE | |
| 91 | +#endif | |
| 92 | + | |
| 93 | +/* SYM_A_* -- align the symbol? */ | |
| 94 | +#define SYM_A_ALIGN ALIGN | |
| 95 | +#define SYM_A_NONE /* nothing */ | |
| 96 | + | |
| 97 | +/* SYM_L_* -- linkage of symbols */ | |
| 98 | +#define SYM_L_GLOBAL(name) .globl name | |
| 99 | +#define SYM_L_WEAK(name) .weak name | |
| 100 | +#define SYM_L_LOCAL(name) /* nothing */ | |
| 101 | + | |
| 78 | 102 | #ifndef LINKER_SCRIPT |
| 79 | 103 | #define ALIGN __ALIGN |
| 80 | 104 | #define ALIGN_STR __ALIGN_STR |
| 81 | 105 | |
| 106 | +/* === DEPRECATED annotations === */ | |
| 107 | + | |
| 108 | +#ifndef CONFIG_X86 | |
| 82 | 109 | #ifndef GLOBAL |
| 110 | +/* deprecated, use SYM_DATA*, SYM_ENTRY, or similar */ | |
| 83 | 111 | #define GLOBAL(name) \ |
| 84 | 112 | .globl name ASM_NL \ |
| 85 | 113 | name: |
| 86 | 114 | #endif |
| 87 | 115 | |
| 88 | 116 | #ifndef ENTRY |
| 117 | +/* deprecated, use SYM_FUNC_START */ | |
| 89 | 118 | #define ENTRY(name) \ |
| 90 | − .globl name ASM_NL \ | |
| 91 | − ALIGN ASM_NL \ | |
| 92 | − name: | |
| 119 | + SYM_FUNC_START(name) | |
| 93 | 120 | #endif |
| 121 | +#endif /* CONFIG_X86 */ | |
| 94 | 122 | #endif /* LINKER_SCRIPT */ |
| 95 | 123 | |
| 124 | +#ifndef CONFIG_X86 | |
| 96 | 125 | #ifndef WEAK |
| 126 | +/* deprecated, use SYM_FUNC_START_WEAK* */ | |
| 97 | 127 | #define WEAK(name) \ |
| 98 | − .weak name ASM_NL \ | |
| 99 | − ALIGN ASM_NL \ | |
| 100 | − name: | |
| 128 | + SYM_FUNC_START_WEAK(name) | |
| 101 | 129 | #endif |
| 102 | 130 | |
| 103 | 131 | #ifndef END |
| 132 | +/* deprecated, use SYM_FUNC_END, SYM_DATA_END, or SYM_END */ | |
| 104 | 133 | #define END(name) \ |
| 105 | 134 | .size name, .-name |
| 106 | 135 | #endif |
| @@ -110,11 +139,215 @@ · 3 unmodified lines | ||
| 110 | 139 | * static analysis tools such as stack depth analyzer. |
| 111 | 140 | */ |
| 112 | 141 | #ifndef ENDPROC |
| 142 | +/* deprecated, use SYM_FUNC_END */ | |
| 113 | 143 | #define ENDPROC(name) \ |
| 114 | − .type name, @function ASM_NL \ | |
| 115 | − END(name) | |
| 144 | + SYM_FUNC_END(name) | |
| 145 | +#endif | |
| 146 | +#endif /* CONFIG_X86 */ | |
| 147 | + | |
| 148 | +/* === generic annotations === */ | |
| 149 | + | |
| 150 | +/* SYM_ENTRY -- use only if you have to for non-paired symbols */ | |
| 151 | +#ifndef SYM_ENTRY | |
| 152 | +#define SYM_ENTRY(name, linkage, align...) \ | |
| 153 | + linkage(name) ASM_NL \ | |
| 154 | + align ASM_NL \ | |
| 155 | + name: | |
| 156 | +#endif | |
| 157 | + | |
| 158 | +/* SYM_START -- use only if you have to */ | |
| 159 | +#ifndef SYM_START | |
| 160 | +#define SYM_START(name, linkage, align...) \ | |
| 161 | + SYM_ENTRY(name, linkage, align) | |
| 162 | +#endif | |
| 163 | + | |
| 164 | +/* SYM_END -- use only if you have to */ | |
| 165 | +#ifndef SYM_END | |
| 166 | +#define SYM_END(name, sym_type) \ | |
| 167 | + .type name sym_type ASM_NL \ | |
| 168 | + .size name, .-name | |
| 169 | +#endif | |
| 170 | + | |
| 171 | +/* === code annotations === */ | |
| 172 | + | |
| 173 | +/* | |
| 174 | + * FUNC -- C-like functions (proper stack frame etc.) | |
| 175 | + * CODE -- non-C code (e.g. irq handlers with different, special stack etc.) | |
| 176 | + * | |
| 177 | + * Objtool validates stack for FUNC, but not for CODE. | |
| 178 | + * Objtool generates debug info for both FUNC & CODE, but needs special | |
| 179 | + * annotations for each CODE's start (to describe the actual stack frame). | |
| 180 | + * | |
| 181 | + * ALIAS -- does not generate debug info -- the aliased function will | |
| 182 | + */ | |
| 183 | + | |
| 184 | +/* SYM_INNER_LABEL_ALIGN -- only for labels in the middle of code */ | |
| 185 | +#ifndef SYM_INNER_LABEL_ALIGN | |
| 186 | +#define SYM_INNER_LABEL_ALIGN(name, linkage) \ | |
| 187 | + .type name SYM_T_NONE ASM_NL \ | |
| 188 | + SYM_ENTRY(name, linkage, SYM_A_ALIGN) | |
| 189 | +#endif | |
| 190 | + | |
| 191 | +/* SYM_INNER_LABEL -- only for labels in the middle of code */ | |
| 192 | +#ifndef SYM_INNER_LABEL | |
| 193 | +#define SYM_INNER_LABEL(name, linkage) \ | |
| 194 | + .type name SYM_T_NONE ASM_NL \ | |
| 195 | + SYM_ENTRY(name, linkage, SYM_A_NONE) | |
| 196 | +#endif | |
| 197 | + | |
| 198 | +/* | |
| 199 | + * SYM_FUNC_START_LOCAL_ALIAS -- use where there are two local names for one | |
| 200 | + * function | |
| 201 | + */ | |
| 202 | +#ifndef SYM_FUNC_START_LOCAL_ALIAS | |
| 203 | +#define SYM_FUNC_START_LOCAL_ALIAS(name) \ | |
| 204 | + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) | |
| 205 | +#endif | |
| 206 | + | |
| 207 | +/* | |
| 208 | + * SYM_FUNC_START_ALIAS -- use where there are two global names for one | |
| 209 | + * function | |
| 210 | + */ | |
| 211 | +#ifndef SYM_FUNC_START_ALIAS | |
| 212 | +#define SYM_FUNC_START_ALIAS(name) \ | |
| 213 | + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) | |
| 214 | +#endif | |
| 215 | + | |
| 216 | +/* SYM_FUNC_START -- use for global functions */ | |
| 217 | +#ifndef SYM_FUNC_START | |
| 218 | +/* | |
| 219 | + * The same as SYM_FUNC_START_ALIAS, but we will need to distinguish these two | |
| 220 | + * later. | |
| 221 | + */ | |
| 222 | +#define SYM_FUNC_START(name) \ | |
| 223 | + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) | |
| 224 | +#endif | |
| 225 | + | |
| 226 | +/* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */ | |
| 227 | +#ifndef SYM_FUNC_START_NOALIGN | |
| 228 | +#define SYM_FUNC_START_NOALIGN(name) \ | |
| 229 | + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) | |
| 230 | +#endif | |
| 231 | + | |
| 232 | +/* SYM_FUNC_START_LOCAL -- use for local functions */ | |
| 233 | +#ifndef SYM_FUNC_START_LOCAL | |
| 234 | +/* the same as SYM_FUNC_START_LOCAL_ALIAS, see comment near SYM_FUNC_START */ | |
| 235 | +#define SYM_FUNC_START_LOCAL(name) \ | |
| 236 | + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) | |
| 116 | 237 | #endif |
| 117 | 238 | |
| 239 | +/* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */ | |
| 240 | +#ifndef SYM_FUNC_START_LOCAL_NOALIGN | |
| 241 | +#define SYM_FUNC_START_LOCAL_NOALIGN(name) \ | |
| 242 | + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) | |
| 118 | 243 | #endif |
| 119 | 244 | |
| 245 | +/* SYM_FUNC_START_WEAK -- use for weak functions */ | |
| 246 | +#ifndef SYM_FUNC_START_WEAK | |
| 247 | +#define SYM_FUNC_START_WEAK(name) \ | |
| 248 | + SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN) | |
| 120 | 249 | #endif |
| 250 | + | |
| 251 | +/* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */ | |
| 252 | +#ifndef SYM_FUNC_START_WEAK_NOALIGN | |
| 253 | +#define SYM_FUNC_START_WEAK_NOALIGN(name) \ | |
| 254 | + SYM_START(name, SYM_L_WEAK, SYM_A_NONE) | |
| 255 | +#endif | |
| 256 | + | |
| 257 | +/* SYM_FUNC_END_ALIAS -- the end of LOCAL_ALIASed or ALIASed function */ | |
| 258 | +#ifndef SYM_FUNC_END_ALIAS | |
| 259 | +#define SYM_FUNC_END_ALIAS(name) \ | |
| 260 | + SYM_END(name, SYM_T_FUNC) | |
| 261 | +#endif | |
| 262 | + | |
| 263 | +/* | |
| 264 | + * SYM_FUNC_END -- the end of SYM_FUNC_START_LOCAL, SYM_FUNC_START, | |
| 265 | + * SYM_FUNC_START_WEAK, ... | |
| 266 | + */ | |
| 267 | +#ifndef SYM_FUNC_END | |
| 268 | +/* the same as SYM_FUNC_END_ALIAS, see comment near SYM_FUNC_START */ | |
| 269 | +#define SYM_FUNC_END(name) \ | |
| 270 | + SYM_END(name, SYM_T_FUNC) | |
| 271 | +#endif | |
| 272 | + | |
| 273 | +/* SYM_CODE_START -- use for non-C (special) functions */ | |
| 274 | +#ifndef SYM_CODE_START | |
| 275 | +#define SYM_CODE_START(name) \ | |
| 276 | + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) | |
| 277 | +#endif | |
| 278 | + | |
| 279 | +/* SYM_CODE_START_NOALIGN -- use for non-C (special) functions, w/o alignment */ | |
| 280 | +#ifndef SYM_CODE_START_NOALIGN | |
| 281 | +#define SYM_CODE_START_NOALIGN(name) \ | |
| 282 | + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) | |
| 283 | +#endif | |
| 284 | + | |
| 285 | +/* SYM_CODE_START_LOCAL -- use for local non-C (special) functions */ | |
| 286 | +#ifndef SYM_CODE_START_LOCAL | |
| 287 | +#define SYM_CODE_START_LOCAL(name) \ | |
| 288 | + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) | |
| 289 | +#endif | |
| 290 | + | |
| 291 | +/* | |
| 292 | + * SYM_CODE_START_LOCAL_NOALIGN -- use for local non-C (special) functions, | |
| 293 | + * w/o alignment | |
| 294 | + */ | |
| 295 | +#ifndef SYM_CODE_START_LOCAL_NOALIGN | |
| 296 | +#define SYM_CODE_START_LOCAL_NOALIGN(name) \ | |
| 297 | + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) | |
| 298 | +#endif | |
| 299 | + | |
| 300 | +/* SYM_CODE_END -- the end of SYM_CODE_START_LOCAL, SYM_CODE_START, ... */ | |
| 301 | +#ifndef SYM_CODE_END | |
| 302 | +#define SYM_CODE_END(name) \ | |
| 303 | + SYM_END(name, SYM_T_NONE) | |
| 304 | +#endif | |
| 305 | + | |
| 306 | +/* === data annotations === */ | |
| 307 | + | |
| 308 | +/* SYM_DATA_START -- global data symbol */ | |
| 309 | +#ifndef SYM_DATA_START | |
| 310 | +#define SYM_DATA_START(name) \ | |
| 311 | + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) | |
| 312 | +#endif | |
| 313 | + | |
| 314 | +/* SYM_DATA_START -- local data symbol */ | |
| 315 | +#ifndef SYM_DATA_START_LOCAL | |
| 316 | +#define SYM_DATA_START_LOCAL(name) \ | |
| 317 | + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) | |
| 318 | +#endif | |
| 319 | + | |
| 320 | +/* SYM_DATA_END -- the end of SYM_DATA_START symbol */ | |
| 321 | +#ifndef SYM_DATA_END | |
| 322 | +#define SYM_DATA_END(name) \ | |
| 323 | + SYM_END(name, SYM_T_OBJECT) | |
| 324 | +#endif | |
| 325 | + | |
| 326 | +/* SYM_DATA_END_LABEL -- the labeled end of SYM_DATA_START symbol */ | |
| 327 | +#ifndef SYM_DATA_END_LABEL | |
| 328 | +#define SYM_DATA_END_LABEL(name, linkage, label) \ | |
| 329 | + linkage(label) ASM_NL \ | |
| 330 | + .type label SYM_T_OBJECT ASM_NL \ | |
| 331 | + label: \ | |
| 332 | + SYM_END(name, SYM_T_OBJECT) | |
| 333 | +#endif | |
| 334 | + | |
| 335 | +/* SYM_DATA -- start+end wrapper around simple global data */ | |
| 336 | +#ifndef SYM_DATA | |
| 337 | +#define SYM_DATA(name, data...) \ | |
| 338 | + SYM_DATA_START(name) ASM_NL \ | |
| 339 | + data ASM_NL \ | |
| 340 | + SYM_DATA_END(name) | |
| 341 | +#endif | |
| 342 | + | |
| 343 | +/* SYM_DATA_LOCAL -- start+end wrapper around simple local data */ | |
| 344 | +#ifndef SYM_DATA_LOCAL | |
| 345 | +#define SYM_DATA_LOCAL(name, data...) \ | |
| 346 | + SYM_DATA_START_LOCAL(name) ASM_NL \ | |
| 347 | + data ASM_NL \ | |
| 348 | + SYM_DATA_END(name) | |
| 349 | +#endif | |
| 350 | + | |
| 351 | +#endif /* __ASSEMBLY__ */ | |
| 352 | + | |
| 353 | +#endif /* _LINUX_LINKAGE_H */ | |
| @@ -82,4 +82,10 @@ static inline int linkmode_equal(const unsigned long *src1, · 81 unmodified lines | ||
| 82 | 82 | return bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | +static inline int linkmode_subset(const unsigned long *src1, | |
| 86 | + const unsigned long *src2) | |
| 87 | +{ | |
| 88 | + return bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
| 89 | +} | |
| 90 | + | |
| 85 | 91 | #endif /* __LINKMODE_H */ |
| @@ -130,10 +130,23 @@ struct klp_object { · 129 unmodified lines | ||
| 130 | 130 | bool patched; |
| 131 | 131 | }; |
| 132 | 132 | |
| 133 | +/** | |
| 134 | + * struct klp_state - state of the system modified by the livepatch | |
| 135 | + * @id: system state identifier (non-zero) | |
| 136 | + * @version: version of the change | |
| 137 | + * @data: custom data | |
| 138 | + */ | |
| 139 | +struct klp_state { | |
| 140 | + unsigned long id; | |
| 141 | + unsigned int version; | |
| 142 | + void *data; | |
| 143 | +}; | |
| 144 | + | |
| 133 | 145 | /** |
| 134 | 146 | * struct klp_patch - patch structure for live patching |
| 135 | 147 | * @mod: reference to the live patch module |
| 136 | 148 | * @objs: object entries for kernel objects to be patched |
| 149 | + * @states: system states that can get modified | |
| 137 | 150 | * @replace: replace all actively used patches |
| 138 | 151 | * @list: list node for global list of actively used patches |
| 139 | 152 | * @kobj: kobject for sysfs resources |
| @@ -147,6 +160,7 @@ struct klp_patch { · 7 unmodified lines | ||
| 147 | 160 | /* external */ |
| 148 | 161 | struct module *mod; |
| 149 | 162 | struct klp_object *objs; |
| 163 | + struct klp_state *states; | |
| 150 | 164 | bool replace; |
| 151 | 165 | |
| 152 | 166 | /* internal */ |
| @@ -217,6 +231,9 @@ void *klp_shadow_get_or_alloc(void *obj, unsigned long id, · 64 unmodified lines | ||
| 217 | 231 | void klp_shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor); |
| 218 | 232 | void klp_shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor); |
| 219 | 233 | |
| 234 | +struct klp_state *klp_get_state(struct klp_patch *patch, unsigned long id); | |
| 235 | +struct klp_state *klp_get_prev_state(unsigned long id); | |
| 236 | + | |
| 220 | 237 | #else /* !CONFIG_LIVEPATCH */ |
| 221 | 238 | |
| 222 | 239 | static inline int klp_module_coming(struct module *mod) { return 0; } |
| @@ -10,8 +10,6 @@ · 9 unmodified lines | ||
| 10 | 10 | #ifndef LINUX_LOCKD_DEBUG_H |
| 11 | 11 | #define LINUX_LOCKD_DEBUG_H |
| 12 | 12 | |
| 13 | −#ifdef __KERNEL__ | |
| 14 | − | |
| 15 | 13 | #include <linux/sunrpc/debug.h> |
| 16 | 14 | |
| 17 | 15 | /* |
| @@ -25,8 +23,6 @@ · 7 unmodified lines | ||
| 25 | 23 | # define ifdebug(flag) if (0) |
| 26 | 24 | #endif |
| 27 | 25 | |
| 28 | −#endif /* __KERNEL__ */ | |
| 29 | − | |
| 30 | 26 | /* |
| 31 | 27 | * Debug flags |
| 32 | 28 | */ |
| @@ -10,8 +10,6 @@ · 9 unmodified lines | ||
| 10 | 10 | #ifndef LINUX_LOCKD_LOCKD_H |
| 11 | 11 | #define LINUX_LOCKD_LOCKD_H |
| 12 | 12 | |
| 13 | −#ifdef __KERNEL__ | |
| 14 | − | |
| 15 | 13 | #include <linux/in.h> |
| 16 | 14 | #include <linux/in6.h> |
| 17 | 15 | #include <net/ipv6.h> |
| @@ -373,6 +371,4 @@ static inline int nlm_compare_locks(const struct file_lock *fl1, · 355 unmodified lines | ||
| 373 | 371 | |
| 374 | 372 | extern const struct lock_manager_operations nlmsvc_lock_operations; |
| 375 | 373 | |
| 376 | −#endif /* __KERNEL__ */ | |
| 377 | − | |
| 378 | 374 | #endif /* LINUX_LOCKD_LOCKD_H */ |
| @@ -349,8 +349,7 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass, · 348 unmodified lines | ||
| 349 | 349 | int trylock, int read, int check, |
| 350 | 350 | struct lockdep_map *nest_lock, unsigned long ip); |
| 351 | 351 | |
| 352 | −extern void lock_release(struct lockdep_map *lock, int nested, | |
| 353 | − unsigned long ip); | |
| 352 | +extern void lock_release(struct lockdep_map *lock, unsigned long ip); | |
| 354 | 353 | |
| 355 | 354 | /* |
| 356 | 355 | * Same "read" as for lock_acquire(), except -1 means any. |
| @@ -428,7 +427,7 @@ static inline void lockdep_set_selftest_task(struct task_struct *task) · 71 unmodified lines | ||
| 428 | 427 | } |
| 429 | 428 | |
| 430 | 429 | # define lock_acquire(l, s, t, r, c, n, i) do { } while (0) |
| 431 | −# define lock_release(l, n, i) do { } while (0) | |
| 430 | +# define lock_release(l, i) do { } while (0) | |
| 432 | 431 | # define lock_downgrade(l, i) do { } while (0) |
| 433 | 432 | # define lock_set_class(l, n, k, s, i) do { } while (0) |
| 434 | 433 | # define lock_set_subclass(l, s, i) do { } while (0) |
| @@ -591,42 +590,42 @@ static inline void print_irqtrace_events(struct task_struct *curr) · 156 unmodified lines | ||
| 591 | 590 | |
| 592 | 591 | #define spin_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 593 | 592 | #define spin_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) |
| 594 | −#define spin_release(l, n, i) lock_release(l, n, i) | |
| 593 | +#define spin_release(l, i) lock_release(l, i) | |
| 595 | 594 | |
| 596 | 595 | #define rwlock_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 597 | 596 | #define rwlock_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i) |
| 598 | −#define rwlock_release(l, n, i) lock_release(l, n, i) | |
| 597 | +#define rwlock_release(l, i) lock_release(l, i) | |
| 599 | 598 | |
| 600 | 599 | #define seqcount_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 601 | 600 | #define seqcount_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i) |
| 602 | −#define seqcount_release(l, n, i) lock_release(l, n, i) | |
| 601 | +#define seqcount_release(l, i) lock_release(l, i) | |
| 603 | 602 | |
| 604 | 603 | #define mutex_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 605 | 604 | #define mutex_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) |
| 606 | −#define mutex_release(l, n, i) lock_release(l, n, i) | |
| 605 | +#define mutex_release(l, i) lock_release(l, i) | |
| 607 | 606 | |
| 608 | 607 | #define rwsem_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 609 | 608 | #define rwsem_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) |
| 610 | 609 | #define rwsem_acquire_read(l, s, t, i) lock_acquire_shared(l, s, t, NULL, i) |
| 611 | −#define rwsem_release(l, n, i) lock_release(l, n, i) | |
| 610 | +#define rwsem_release(l, i) lock_release(l, i) | |
| 612 | 611 | |
| 613 | 612 | #define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_) |
| 614 | 613 | #define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_) |
| 615 | 614 | #define lock_map_acquire_tryread(l) lock_acquire_shared_recursive(l, 0, 1, NULL, _THIS_IP_) |
| 616 | −#define lock_map_release(l) lock_release(l, 1, _THIS_IP_) | |
| 615 | +#define lock_map_release(l) lock_release(l, _THIS_IP_) | |
| 617 | 616 | |
| 618 | 617 | #ifdef CONFIG_PROVE_LOCKING |
| 619 | 618 | # define might_lock(lock) \ |
| 620 | 619 | do { \ |
| 621 | 620 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ |
| 622 | 621 | lock_acquire(&(lock)->dep_map, 0, 0, 0, 1, NULL, _THIS_IP_); \ |
| 623 | − lock_release(&(lock)->dep_map, 0, _THIS_IP_); \ | |
| 622 | + lock_release(&(lock)->dep_map, _THIS_IP_); \ | |
| 624 | 623 | } while (0) |
| 625 | 624 | # define might_lock_read(lock) \ |
| 626 | 625 | do { \ |
| 627 | 626 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ |
| 628 | 627 | lock_acquire(&(lock)->dep_map, 0, 0, 1, 1, NULL, _THIS_IP_); \ |
| 629 | − lock_release(&(lock)->dep_map, 0, _THIS_IP_); \ | |
| 628 | + lock_release(&(lock)->dep_map, _THIS_IP_); \ | |
| 630 | 629 | } while (0) |
| 631 | 630 | |
| 632 | 631 | #define lockdep_assert_irqs_enabled() do { \ |
| @@ -108,10 +108,10 @@ void logic_outsl(unsigned long addr, const void *buffer, unsigned int count); · 107 unmodified lines | ||
| 108 | 108 | * area by redefining the macro below. |
| 109 | 109 | */ |
| 110 | 110 | #define PIO_INDIRECT_SIZE 0x4000 |
| 111 | −#define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE) | |
| 112 | 111 | #else |
| 113 | −#define MMIO_UPPER_LIMIT IO_SPACE_LIMIT | |
| 112 | +#define PIO_INDIRECT_SIZE 0 | |
| 114 | 113 | #endif /* CONFIG_INDIRECT_PIO */ |
| 114 | +#define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE) | |
| 115 | 115 | |
| 116 | 116 | struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode); |
| 117 | 117 | unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, |
| @@ -1818,6 +1818,14 @@ union security_list_options { · 1817 unmodified lines | ||
| 1818 | 1818 | void (*bpf_prog_free_security)(struct bpf_prog_aux *aux); |
| 1819 | 1819 | #endif /* CONFIG_BPF_SYSCALL */ |
| 1820 | 1820 | int (*locked_down)(enum lockdown_reason what); |
| 1821 | +#ifdef CONFIG_PERF_EVENTS | |
| 1822 | + int (*perf_event_open)(struct perf_event_attr *attr, int type); | |
| 1823 | + int (*perf_event_alloc)(struct perf_event *event); | |
| 1824 | + void (*perf_event_free)(struct perf_event *event); | |
| 1825 | + int (*perf_event_read)(struct perf_event *event); | |
| 1826 | + int (*perf_event_write)(struct perf_event *event); | |
| 1827 | + | |
| 1828 | +#endif | |
| 1821 | 1829 | }; |
| 1822 | 1830 | |
| 1823 | 1831 | struct security_hook_heads { |
| @@ -2060,6 +2068,13 @@ struct security_hook_heads { · 236 unmodified lines | ||
| 2060 | 2068 | struct hlist_head bpf_prog_free_security; |
| 2061 | 2069 | #endif /* CONFIG_BPF_SYSCALL */ |
| 2062 | 2070 | struct hlist_head locked_down; |
| 2071 | +#ifdef CONFIG_PERF_EVENTS | |
| 2072 | + struct hlist_head perf_event_open; | |
| 2073 | + struct hlist_head perf_event_alloc; | |
| 2074 | + struct hlist_head perf_event_free; | |
| 2075 | + struct hlist_head perf_event_read; | |
| 2076 | + struct hlist_head perf_event_write; | |
| 2077 | +#endif | |
| 2063 | 2078 | } __randomize_layout; |
| 2064 | 2079 | |
| 2065 | 2080 | /* |
| @@ -358,6 +358,9 @@ static inline phys_addr_t memblock_phys_alloc(phys_addr_t size, · 357 unmodified lines | ||
| 358 | 358 | MEMBLOCK_ALLOC_ACCESSIBLE); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | +void *memblock_alloc_exact_nid_raw(phys_addr_t size, phys_addr_t align, | |
| 362 | + phys_addr_t min_addr, phys_addr_t max_addr, | |
| 363 | + int nid); | |
| 361 | 364 | void *memblock_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align, |
| 362 | 365 | phys_addr_t min_addr, phys_addr_t max_addr, |
| 363 | 366 | int nid); |
| @@ -58,7 +58,6 @@ enum mem_cgroup_protection { · 57 unmodified lines | ||
| 58 | 58 | |
| 59 | 59 | struct mem_cgroup_reclaim_cookie { |
| 60 | 60 | pg_data_t *pgdat; |
| 61 | − int priority; | |
| 62 | 61 | unsigned int generation; |
| 63 | 62 | }; |
| 64 | 63 | |
| @@ -81,7 +80,6 @@ struct mem_cgroup_id { · 16 unmodified lines | ||
| 81 | 80 | enum mem_cgroup_events_target { |
| 82 | 81 | MEM_CGROUP_TARGET_THRESH, |
| 83 | 82 | MEM_CGROUP_TARGET_SOFTLIMIT, |
| 84 | − MEM_CGROUP_TARGET_NUMAINFO, | |
| 85 | 83 | MEM_CGROUP_NTARGETS, |
| 86 | 84 | }; |
| 87 | 85 | |
| @@ -112,7 +110,7 @@ struct memcg_shrinker_map { · 24 unmodified lines | ||
| 112 | 110 | }; |
| 113 | 111 | |
| 114 | 112 | /* |
| 115 | − * per-zone information in memory controller. | |
| 113 | + * per-node information in memory controller. | |
| 116 | 114 | */ |
| 117 | 115 | struct mem_cgroup_per_node { |
| 118 | 116 | struct lruvec lruvec; |
| @@ -126,7 +124,7 @@ struct mem_cgroup_per_node { · 7 unmodified lines | ||
| 126 | 124 | |
| 127 | 125 | unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; |
| 128 | 126 | |
| 129 | − struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; | |
| 127 | + struct mem_cgroup_reclaim_iter iter; | |
| 130 | 128 | |
| 131 | 129 | struct memcg_shrinker_map __rcu *shrinker_map; |
| 132 | 130 | |
| @@ -134,9 +132,6 @@ struct mem_cgroup_per_node { · 1 unmodified line | ||
| 134 | 132 | unsigned long usage_in_excess;/* Set to the value by which */ |
| 135 | 133 | /* the soft limit is exceeded*/ |
| 136 | 134 | bool on_tree; |
| 137 | − bool congested; /* memcg has many dirty pages */ | |
| 138 | − /* backed by a congested BDI */ | |
| 139 | − | |
| 140 | 135 | struct mem_cgroup *memcg; /* Back pointer, we cannot */ |
| 141 | 136 | /* use container_of */ |
| 142 | 137 | }; |
| @@ -313,13 +308,6 @@ struct mem_cgroup { · 170 unmodified lines | ||
| 313 | 308 | struct list_head kmem_caches; |
| 314 | 309 | #endif |
| 315 | 310 | |
| 316 | − int last_scanned_node; | |
| 317 | −#if MAX_NUMNODES > 1 | |
| 318 | − nodemask_t scan_nodes; | |
| 319 | − atomic_t numainfo_events; | |
| 320 | − atomic_t numainfo_updating; | |
| 321 | −#endif | |
| 322 | − | |
| 323 | 311 | #ifdef CONFIG_CGROUP_WRITEBACK |
| 324 | 312 | struct list_head cgwb_list; |
| 325 | 313 | struct wb_domain cgwb_domain; |
| @@ -394,25 +382,27 @@ mem_cgroup_nodeinfo(struct mem_cgroup *memcg, int nid) · 68 unmodified lines | ||
| 394 | 382 | } |
| 395 | 383 | |
| 396 | 384 | /** |
| 397 | − * mem_cgroup_lruvec - get the lru list vector for a node or a memcg zone | |
| 398 | − * @node: node of the wanted lruvec | |
| 385 | + * mem_cgroup_lruvec - get the lru list vector for a memcg & node | |
| 399 | 386 | * @memcg: memcg of the wanted lruvec |
| 400 | 387 | * |
| 401 | − * Returns the lru list vector holding pages for a given @node or a given | |
| 402 | − * @memcg and @zone. This can be the node lruvec, if the memory controller | |
| 403 | − * is disabled. | |
| 388 | + * Returns the lru list vector holding pages for a given @memcg & | |
| 389 | + * @node combination. This can be the node lruvec, if the memory | |
| 390 | + * controller is disabled. | |
| 404 | 391 | */ |
| 405 | −static inline struct lruvec *mem_cgroup_lruvec(struct pglist_data *pgdat, | |
| 406 | − struct mem_cgroup *memcg) | |
| 392 | +static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, | |
| 393 | + struct pglist_data *pgdat) | |
| 407 | 394 | { |
| 408 | 395 | struct mem_cgroup_per_node *mz; |
| 409 | 396 | struct lruvec *lruvec; |
| 410 | 397 | |
| 411 | 398 | if (mem_cgroup_disabled()) { |
| 412 | − lruvec = node_lruvec(pgdat); | |
| 399 | + lruvec = &pgdat->__lruvec; | |
| 413 | 400 | goto out; |
| 414 | 401 | } |
| 415 | 402 | |
| 403 | + if (!memcg) | |
| 404 | + memcg = root_mem_cgroup; | |
| 405 | + | |
| 416 | 406 | mz = mem_cgroup_nodeinfo(memcg, pgdat->node_id); |
| 417 | 407 | lruvec = &mz->lruvec; |
| 418 | 408 | out: |
| @@ -728,7 +718,7 @@ static inline void __mod_lruvec_page_state(struct page *page, · 309 unmodified lines | ||
| 728 | 718 | return; |
| 729 | 719 | } |
| 730 | 720 | |
| 731 | − lruvec = mem_cgroup_lruvec(pgdat, page->mem_cgroup); | |
| 721 | + lruvec = mem_cgroup_lruvec(page->mem_cgroup, pgdat); | |
| 732 | 722 | __mod_lruvec_state(lruvec, idx, val); |
| 733 | 723 | } |
| 734 | 724 | |
| @@ -899,16 +889,21 @@ static inline void mem_cgroup_migrate(struct page *old, struct page *new) · 164 unmodified lines | ||
| 899 | 889 | { |
| 900 | 890 | } |
| 901 | 891 | |
| 902 | −static inline struct lruvec *mem_cgroup_lruvec(struct pglist_data *pgdat, | |
| 903 | − struct mem_cgroup *memcg) | |
| 892 | +static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, | |
| 893 | + struct pglist_data *pgdat) | |
| 904 | 894 | { |
| 905 | − return node_lruvec(pgdat); | |
| 895 | + return &pgdat->__lruvec; | |
| 906 | 896 | } |
| 907 | 897 | |
| 908 | 898 | static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page, |
| 909 | 899 | struct pglist_data *pgdat) |
| 910 | 900 | { |
| 911 | − return &pgdat->lruvec; | |
| 901 | + return &pgdat->__lruvec; | |
| 902 | +} | |
| 903 | + | |
| 904 | +static inline struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg) | |
| 905 | +{ | |
| 906 | + return NULL; | |
| 912 | 907 | } |
| 913 | 908 | |
| 914 | 909 | static inline bool mm_match_cgroup(struct mm_struct *mm, |
| @@ -102,13 +102,10 @@ extern unsigned long __offline_isolated_pages(unsigned long start_pfn, · 101 unmodified lines | ||
| 102 | 102 | |
| 103 | 103 | typedef void (*online_page_callback_t)(struct page *page, unsigned int order); |
| 104 | 104 | |
| 105 | +extern void generic_online_page(struct page *page, unsigned int order); | |
| 105 | 106 | extern int set_online_page_callback(online_page_callback_t callback); |
| 106 | 107 | extern int restore_online_page_callback(online_page_callback_t callback); |
| 107 | 108 | |
| 108 | −extern void __online_page_set_limits(struct page *page); | |
| 109 | −extern void __online_page_increment_counters(struct page *page); | |
| 110 | −extern void __online_page_free(struct page *page); | |
| 111 | − | |
| 112 | 109 | extern int try_online_node(int nid); |
| 113 | 110 | |
| 114 | 111 | extern int arch_add_memory(int nid, u64 start, u64 size, |
| @@ -229,9 +226,6 @@ void put_online_mems(void); · 114 unmodified lines | ||
| 229 | 226 | void mem_hotplug_begin(void); |
| 230 | 227 | void mem_hotplug_done(void); |
| 231 | 228 | |
| 232 | −extern void set_zone_contiguous(struct zone *zone); | |
| 233 | −extern void clear_zone_contiguous(struct zone *zone); | |
| 234 | − | |
| 235 | 229 | #else /* ! CONFIG_MEMORY_HOTPLUG */ |
| 236 | 230 | #define pfn_to_online_page(pfn) \ |
| 237 | 231 | ({ \ |
| @@ -339,6 +333,9 @@ static inline int remove_memory(int nid, u64 start, u64 size) · 101 unmodified lines | ||
| 339 | 333 | static inline void __remove_memory(int nid, u64 start, u64 size) {} |
| 340 | 334 | #endif /* CONFIG_MEMORY_HOTREMOVE */ |
| 341 | 335 | |
| 336 | +extern void set_zone_contiguous(struct zone *zone); | |
| 337 | +extern void clear_zone_contiguous(struct zone *zone); | |
| 338 | + | |
| 342 | 339 | extern void __ref free_area_init_core_hotplug(int nid); |
| 343 | 340 | extern int __add_memory(int nid, u64 start, u64 size); |
| 344 | 341 | extern int add_memory(int nid, u64 start, u64 size); |
| @@ -0,0 +1,23 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _MEMREGION_H_ | |
| 3 | +#define _MEMREGION_H_ | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/errno.h> | |
| 6 | + | |
| 7 | +struct memregion_info { | |
| 8 | + int target_node; | |
| 9 | +}; | |
| 10 | + | |
| 11 | +#ifdef CONFIG_MEMREGION | |
| 12 | +int memregion_alloc(gfp_t gfp); | |
| 13 | +void memregion_free(int id); | |
| 14 | +#else | |
| 15 | +static inline int memregion_alloc(gfp_t gfp) | |
| 16 | +{ | |
| 17 | + return -ENOMEM; | |
| 18 | +} | |
| 19 | +void memregion_free(int id) | |
| 20 | +{ | |
| 21 | +} | |
| 22 | +#endif | |
| 23 | +#endif /* _MEMREGION_H_ */ | |
| @@ -1,75 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | −/* | |
| 3 | − * Copyright (C) 2010 ST-Ericsson SA | |
| 4 | − * | |
| 5 | − * Author: Arun R Murthy <arun.murthy@stericsson.com> | |
| 6 | − * Author: Daniel Willerud <daniel.willerud@stericsson.com> | |
| 7 | − * Author: M'boumba Cedric Madianga <cedric.madianga@stericsson.com> | |
| 8 | − */ | |
| 9 | − | |
| 10 | −#ifndef _AB8500_GPADC_H | |
| 11 | −#define _AB8500_GPADC_H | |
| 12 | − | |
| 13 | −/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2 | |
| 14 | − * and ADCHwSel[4:0] in GPADCCtrl3 ) */ | |
| 15 | −#define BAT_CTRL 0x01 | |
| 16 | −#define BTEMP_BALL 0x02 | |
| 17 | −#define MAIN_CHARGER_V 0x03 | |
| 18 | −#define ACC_DETECT1 0x04 | |
| 19 | −#define ACC_DETECT2 0x05 | |
| 20 | −#define ADC_AUX1 0x06 | |
| 21 | −#define ADC_AUX2 0x07 | |
| 22 | −#define MAIN_BAT_V 0x08 | |
| 23 | −#define VBUS_V 0x09 | |
| 24 | −#define MAIN_CHARGER_C 0x0A | |
| 25 | −#define USB_CHARGER_C 0x0B | |
| 26 | −#define BK_BAT_V 0x0C | |
| 27 | −#define DIE_TEMP 0x0D | |
| 28 | −#define USB_ID 0x0E | |
| 29 | −#define XTAL_TEMP 0x12 | |
| 30 | −#define VBAT_TRUE_MEAS 0x13 | |
| 31 | −#define BAT_CTRL_AND_IBAT 0x1C | |
| 32 | −#define VBAT_MEAS_AND_IBAT 0x1D | |
| 33 | −#define VBAT_TRUE_MEAS_AND_IBAT 0x1E | |
| 34 | −#define BAT_TEMP_AND_IBAT 0x1F | |
| 35 | − | |
| 36 | −/* Virtual channel used only for ibat convertion to ampere | |
| 37 | − * Battery current conversion (ibat) cannot be requested as a single conversion | |
| 38 | − * but it is always in combination with other input requests | |
| 39 | − */ | |
| 40 | −#define IBAT_VIRTUAL_CHANNEL 0xFF | |
| 41 | − | |
| 42 | −#define SAMPLE_1 1 | |
| 43 | −#define SAMPLE_4 4 | |
| 44 | −#define SAMPLE_8 8 | |
| 45 | −#define SAMPLE_16 16 | |
| 46 | −#define RISING_EDGE 0 | |
| 47 | −#define FALLING_EDGE 1 | |
| 48 | − | |
| 49 | −/* Arbitrary ADC conversion type constants */ | |
| 50 | −#define ADC_SW 0 | |
| 51 | −#define ADC_HW 1 | |
| 52 | − | |
| 53 | −struct ab8500_gpadc; | |
| 54 | − | |
| 55 | −struct ab8500_gpadc *ab8500_gpadc_get(char *name); | |
| 56 | −int ab8500_gpadc_sw_hw_convert(struct ab8500_gpadc *gpadc, u8 channel, | |
| 57 | − u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); | |
| 58 | −static inline int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel) | |
| 59 | −{ | |
| 60 | − return ab8500_gpadc_sw_hw_convert(gpadc, channel, | |
| 61 | − SAMPLE_16, 0, 0, ADC_SW); | |
| 62 | −} | |
| 63 | − | |
| 64 | −int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel, | |
| 65 | − u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); | |
| 66 | −int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel, | |
| 67 | − u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type, | |
| 68 | − int *ibat); | |
| 69 | −int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, | |
| 70 | − u8 channel, int ad_value); | |
| 71 | −void ab8540_gpadc_get_otp(struct ab8500_gpadc *gpadc, | |
| 72 | − u16 *vmain_l, u16 *vmain_h, u16 *btemp_l, u16 *btemp_h, | |
| 73 | − u16 *vbat_l, u16 *vbat_h, u16 *ibat_l, u16 *ibat_h); | |
| 74 | − | |
| 75 | −#endif /* _AB8500_GPADC_H */ | |
| @@ -1186,13 +1186,6 @@ · 1185 unmodified lines | ||
| 1186 | 1186 | #define ARIZONA_DSP4_SCRATCH_1 0x1441 |
| 1187 | 1187 | #define ARIZONA_DSP4_SCRATCH_2 0x1442 |
| 1188 | 1188 | #define ARIZONA_DSP4_SCRATCH_3 0x1443 |
| 1189 | −#define ARIZONA_FRF_COEFF_1 0x1700 | |
| 1190 | −#define ARIZONA_FRF_COEFF_2 0x1701 | |
| 1191 | −#define ARIZONA_FRF_COEFF_3 0x1702 | |
| 1192 | −#define ARIZONA_FRF_COEFF_4 0x1703 | |
| 1193 | −#define ARIZONA_V2_DAC_COMP_1 0x1704 | |
| 1194 | −#define ARIZONA_V2_DAC_COMP_2 0x1705 | |
| 1195 | − | |
| 1196 | 1189 | |
| 1197 | 1190 | /* |
| 1198 | 1191 | * Field Definitions. |
| @@ -12,6 +12,35 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #include <linux/platform_device.h> |
| 14 | 14 | |
| 15 | +#define MFD_RES_SIZE(arr) (sizeof(arr) / sizeof(struct resource)) | |
| 16 | + | |
| 17 | +#define MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _match)\ | |
| 18 | + { \ | |
| 19 | + .name = (_name), \ | |
| 20 | + .resources = (_res), \ | |
| 21 | + .num_resources = MFD_RES_SIZE((_res)), \ | |
| 22 | + .platform_data = (_pdata), \ | |
| 23 | + .pdata_size = (_pdsize), \ | |
| 24 | + .of_compatible = (_compat), \ | |
| 25 | + .acpi_match = (_match), \ | |
| 26 | + .id = (_id), \ | |
| 27 | + } | |
| 28 | + | |
| 29 | +#define OF_MFD_CELL(_name, _res, _pdata, _pdsize,_id, _compat) \ | |
| 30 | + MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, NULL) \ | |
| 31 | + | |
| 32 | +#define ACPI_MFD_CELL(_name, _res, _pdata, _pdsize, _id, _match) \ | |
| 33 | + MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, _match) \ | |
| 34 | + | |
| 35 | +#define MFD_CELL_BASIC(_name, _res, _pdata, _pdsize, _id) \ | |
| 36 | + MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, NULL) \ | |
| 37 | + | |
| 38 | +#define MFD_CELL_RES(_name, _res) \ | |
| 39 | + MFD_CELL_ALL(_name, _res, NULL, 0, 0, NULL, NULL) \ | |
| 40 | + | |
| 41 | +#define MFD_CELL_NAME(_name) \ | |
| 42 | + MFD_CELL_ALL(_name, NULL, NULL, 0, 0, NULL, NULL) \ | |
| 43 | + | |
| 15 | 44 | struct irq_domain; |
| 16 | 45 | struct property_entry; |
| 17 | 46 | |
| @@ -30,8 +59,6 @@ struct mfd_cell { · 12 unmodified lines | ||
| 30 | 59 | const char *name; |
| 31 | 60 | int id; |
| 32 | 61 | |
| 33 | − /* refcounting for multiple drivers to use a single cell */ | |
| 34 | − atomic_t *usage_count; | |
| 35 | 62 | int (*enable)(struct platform_device *dev); |
| 36 | 63 | int (*disable)(struct platform_device *dev); |
| 37 | 64 | |
| @@ -86,24 +113,6 @@ struct mfd_cell { · 48 unmodified lines | ||
| 86 | 113 | extern int mfd_cell_enable(struct platform_device *pdev); |
| 87 | 114 | extern int mfd_cell_disable(struct platform_device *pdev); |
| 88 | 115 | |
| 89 | −/* | |
| 90 | − * "Clone" multiple platform devices for a single cell. This is to be used | |
| 91 | − * for devices that have multiple users of a cell. For example, if an mfd | |
| 92 | − * driver wants the cell "foo" to be used by a GPIO driver, an MTD driver, | |
| 93 | − * and a platform driver, the following bit of code would be use after first | |
| 94 | − * calling mfd_add_devices(): | |
| 95 | − * | |
| 96 | − * const char *fclones[] = { "foo-gpio", "foo-mtd" }; | |
| 97 | − * err = mfd_clone_cells("foo", fclones, ARRAY_SIZE(fclones)); | |
| 98 | − * | |
| 99 | − * Each driver (MTD, GPIO, and platform driver) would then register | |
| 100 | − * platform_drivers for "foo-mtd", "foo-gpio", and "foo", respectively. | |
| 101 | − * The cell's .enable/.disable hooks should be used to deal with hardware | |
| 102 | − * resource contention. | |
| 103 | − */ | |
| 104 | −extern int mfd_clone_cell(const char *cell, const char **clones, | |
| 105 | − size_t n_clones); | |
| 106 | − | |
| 107 | 116 | /* |
| 108 | 117 | * Given a platform device that's been created by mfd_add_devices(), fetch |
| 109 | 118 | * the mfd_cell that created it. |
| @@ -489,7 +489,7 @@ struct prcmu_auto_pm_config { · 488 unmodified lines | ||
| 489 | 489 | |
| 490 | 490 | #ifdef CONFIG_MFD_DB8500_PRCMU |
| 491 | 491 | |
| 492 | −void db8500_prcmu_early_init(u32 phy_base, u32 size); | |
| 492 | +void db8500_prcmu_early_init(void); | |
| 493 | 493 | int prcmu_set_rc_a2p(enum romcode_write); |
| 494 | 494 | enum romcode_read prcmu_get_rc_p2a(void); |
| 495 | 495 | enum ap_pwrst prcmu_get_xp70_current_state(void); |
| @@ -546,7 +546,7 @@ void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value); · 50 unmodified lines | ||
| 546 | 546 | |
| 547 | 547 | #else /* !CONFIG_MFD_DB8500_PRCMU */ |
| 548 | 548 | |
| 549 | −static inline void db8500_prcmu_early_init(u32 phy_base, u32 size) {} | |
| 549 | +static inline void db8500_prcmu_early_init(void) {} | |
| 550 | 550 | |
| 551 | 551 | static inline int prcmu_set_rc_a2p(enum romcode_write code) |
| 552 | 552 | { |
| @@ -190,6 +190,7 @@ enum ddr_pwrst { · 189 unmodified lines | ||
| 190 | 190 | #define PRCMU_FW_PROJECT_U8500_MBL2 12 /* Customer specific */ |
| 191 | 191 | #define PRCMU_FW_PROJECT_U8520 13 |
| 192 | 192 | #define PRCMU_FW_PROJECT_U8420 14 |
| 193 | +#define PRCMU_FW_PROJECT_U8420_SYSCLK 17 | |
| 193 | 194 | #define PRCMU_FW_PROJECT_A9420 20 |
| 194 | 195 | /* [32..63] 9540 and derivatives */ |
| 195 | 196 | #define PRCMU_FW_PROJECT_U9540 32 |
| @@ -211,9 +212,9 @@ struct prcmu_fw_version { · 15 unmodified lines | ||
| 211 | 212 | |
| 212 | 213 | #if defined(CONFIG_UX500_SOC_DB8500) |
| 213 | 214 | |
| 214 | −static inline void prcmu_early_init(u32 phy_base, u32 size) | |
| 215 | +static inline void prcmu_early_init(void) | |
| 215 | 216 | { |
| 216 | − return db8500_prcmu_early_init(phy_base, size); | |
| 217 | + return db8500_prcmu_early_init(); | |
| 217 | 218 | } |
| 218 | 219 | |
| 219 | 220 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
| @@ -401,7 +402,7 @@ static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) · 181 unmodified lines | ||
| 401 | 402 | } |
| 402 | 403 | #else |
| 403 | 404 | |
| 404 | −static inline void prcmu_early_init(u32 phy_base, u32 size) {} | |
| 405 | +static inline void prcmu_early_init(void) {} | |
| 405 | 406 | |
| 406 | 407 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
| 407 | 408 | bool keep_ap_pll) |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #ifndef MADERA_CORE_H |
| 9 | 9 | #define MADERA_CORE_H |
| 10 | 10 | |
| 11 | +#include <linux/clk.h> | |
| 11 | 12 | #include <linux/gpio/consumer.h> |
| 12 | 13 | #include <linux/interrupt.h> |
| 13 | 14 | #include <linux/mfd/madera/pdata.h> |
| @@ -29,6 +30,13 @@ enum madera_type { · 15 unmodified lines | ||
| 29 | 30 | CS42L92 = 9, |
| 30 | 31 | }; |
| 31 | 32 | |
| 33 | +enum { | |
| 34 | + MADERA_MCLK1, | |
| 35 | + MADERA_MCLK2, | |
| 36 | + MADERA_MCLK3, | |
| 37 | + MADERA_NUM_MCLK | |
| 38 | +}; | |
| 39 | + | |
| 32 | 40 | #define MADERA_MAX_CORE_SUPPLIES 2 |
| 33 | 41 | #define MADERA_MAX_GPIOS 40 |
| 34 | 42 | |
| @@ -155,6 +163,7 @@ struct snd_soc_dapm_context; · 120 unmodified lines | ||
| 155 | 163 | * @irq_dev: the irqchip child driver device |
| 156 | 164 | * @irq_data: pointer to irqchip data for the child irqchip driver |
| 157 | 165 | * @irq: host irq number from SPI or I2C configuration |
| 166 | + * @mclk: Structure holding clock supplies | |
| 158 | 167 | * @out_clamp: indicates output clamp state for each analogue output |
| 159 | 168 | * @out_shorted: indicates short circuit state for each analogue output |
| 160 | 169 | * @hp_ena: bitflags of enable state for the headphone outputs |
| @@ -184,6 +193,8 @@ struct madera { · 23 unmodified lines | ||
| 184 | 193 | struct regmap_irq_chip_data *irq_data; |
| 185 | 194 | int irq; |
| 186 | 195 | |
| 196 | + struct clk_bulk_data mclk[MADERA_NUM_MCLK]; | |
| 197 | + | |
| 187 | 198 | unsigned int num_micbias; |
| 188 | 199 | unsigned int num_childbias[MADERA_MAX_MICBIAS]; |
| 189 | 200 | |
| @@ -329,7 +329,6 @@ struct max77620_chip { · 328 unmodified lines | ||
| 329 | 329 | struct regmap *rmap; |
| 330 | 330 | |
| 331 | 331 | int chip_irq; |
| 332 | − int irq_base; | |
| 333 | 332 | |
| 334 | 333 | /* chip id */ |
| 335 | 334 | enum max77620_chip_id chip_id; |
| @@ -0,0 +1,71 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2014-2019 MediaTek Inc. | |
| 4 | + * | |
| 5 | + * Author: Tianping.Fang <tianping.fang@mediatek.com> | |
| 6 | + * Sean Wang <sean.wang@mediatek.com> | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#ifndef _LINUX_MFD_MT6397_RTC_H_ | |
| 10 | +#define _LINUX_MFD_MT6397_RTC_H_ | |
| 11 | + | |
| 12 | +#include <linux/jiffies.h> | |
| 13 | +#include <linux/mutex.h> | |
| 14 | +#include <linux/regmap.h> | |
| 15 | +#include <linux/rtc.h> | |
| 16 | + | |
| 17 | +#define RTC_BBPU 0x0000 | |
| 18 | +#define RTC_BBPU_CBUSY BIT(6) | |
| 19 | +#define RTC_BBPU_KEY (0x43 << 8) | |
| 20 | + | |
| 21 | +#define RTC_WRTGR 0x003c | |
| 22 | + | |
| 23 | +#define RTC_IRQ_STA 0x0002 | |
| 24 | +#define RTC_IRQ_STA_AL BIT(0) | |
| 25 | +#define RTC_IRQ_STA_LP BIT(3) | |
| 26 | + | |
| 27 | +#define RTC_IRQ_EN 0x0004 | |
| 28 | +#define RTC_IRQ_EN_AL BIT(0) | |
| 29 | +#define RTC_IRQ_EN_ONESHOT BIT(2) | |
| 30 | +#define RTC_IRQ_EN_LP BIT(3) | |
| 31 | +#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) | |
| 32 | + | |
| 33 | +#define RTC_AL_MASK 0x0008 | |
| 34 | +#define RTC_AL_MASK_DOW BIT(4) | |
| 35 | + | |
| 36 | +#define RTC_TC_SEC 0x000a | |
| 37 | +/* Min, Hour, Dom... register offset to RTC_TC_SEC */ | |
| 38 | +#define RTC_OFFSET_SEC 0 | |
| 39 | +#define RTC_OFFSET_MIN 1 | |
| 40 | +#define RTC_OFFSET_HOUR 2 | |
| 41 | +#define RTC_OFFSET_DOM 3 | |
| 42 | +#define RTC_OFFSET_DOW 4 | |
| 43 | +#define RTC_OFFSET_MTH 5 | |
| 44 | +#define RTC_OFFSET_YEAR 6 | |
| 45 | +#define RTC_OFFSET_COUNT 7 | |
| 46 | + | |
| 47 | +#define RTC_AL_SEC 0x0018 | |
| 48 | + | |
| 49 | +#define RTC_PDN2 0x002e | |
| 50 | +#define RTC_PDN2_PWRON_ALARM BIT(4) | |
| 51 | + | |
| 52 | +#define RTC_MIN_YEAR 1968 | |
| 53 | +#define RTC_BASE_YEAR 1900 | |
| 54 | +#define RTC_NUM_YEARS 128 | |
| 55 | +#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR) | |
| 56 | + | |
| 57 | +#define MTK_RTC_POLL_DELAY_US 10 | |
| 58 | +#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ)) | |
| 59 | + | |
| 60 | +struct mt6397_rtc { | |
| 61 | + struct device *dev; | |
| 62 | + struct rtc_device *rtc_dev; | |
| 63 | + | |
| 64 | + /* Protect register access from multiple tasks */ | |
| 65 | + struct mutex lock; | |
| 66 | + struct regmap *regmap; | |
| 67 | + int irq; | |
| 68 | + u32 addr_base; | |
| 69 | +}; | |
| 70 | + | |
| 71 | +#endif /* _LINUX_MFD_MT6397_RTC_H_ */ | |
| @@ -610,7 +610,7 @@ enum { · 609 unmodified lines | ||
| 610 | 610 | RK808_ID = 0x0000, |
| 611 | 611 | RK809_ID = 0x8090, |
| 612 | 612 | RK817_ID = 0x8170, |
| 613 | − RK818_ID = 0x8181, | |
| 613 | + RK818_ID = 0x8180, | |
| 614 | 614 | }; |
| 615 | 615 | |
| 616 | 616 | struct rk808 { |
| @@ -70,14 +70,11 @@ · 69 unmodified lines | ||
| 70 | 70 | #define TIM_CCER_CC4E BIT(12) /* Capt/Comp 4 out Ena */ |
| 71 | 71 | #define TIM_CCER_CC4P BIT(13) /* Capt/Comp 4 Polarity */ |
| 72 | 72 | #define TIM_CCER_CCXE (BIT(0) | BIT(4) | BIT(8) | BIT(12)) |
| 73 | −#define TIM_BDTR_BKE BIT(12) /* Break input enable */ | |
| 74 | −#define TIM_BDTR_BKP BIT(13) /* Break input polarity */ | |
| 73 | +#define TIM_BDTR_BKE(x) BIT(12 + (x) * 12) /* Break input enable */ | |
| 74 | +#define TIM_BDTR_BKP(x) BIT(13 + (x) * 12) /* Break input polarity */ | |
| 75 | 75 | #define TIM_BDTR_AOE BIT(14) /* Automatic Output Enable */ |
| 76 | 76 | #define TIM_BDTR_MOE BIT(15) /* Main Output Enable */ |
| 77 | −#define TIM_BDTR_BKF (BIT(16) | BIT(17) | BIT(18) | BIT(19)) | |
| 78 | −#define TIM_BDTR_BK2F (BIT(20) | BIT(21) | BIT(22) | BIT(23)) | |
| 79 | −#define TIM_BDTR_BK2E BIT(24) /* Break 2 input enable */ | |
| 80 | −#define TIM_BDTR_BK2P BIT(25) /* Break 2 input polarity */ | |
| 77 | +#define TIM_BDTR_BKF(x) (0xf << (16 + (x) * 4)) | |
| 81 | 78 | #define TIM_DCR_DBA GENMASK(4, 0) /* DMA base addr */ |
| 82 | 79 | #define TIM_DCR_DBL GENMASK(12, 8) /* DMA burst len */ |
| 83 | 80 | |
| @@ -87,8 +84,7 @@ · 3 unmodified lines | ||
| 87 | 84 | #define TIM_CR2_MMS2_SHIFT 20 |
| 88 | 85 | #define TIM_SMCR_TS_SHIFT 4 |
| 89 | 86 | #define TIM_BDTR_BKF_MASK 0xF |
| 90 | −#define TIM_BDTR_BKF_SHIFT 16 | |
| 91 | −#define TIM_BDTR_BK2F_SHIFT 20 | |
| 87 | +#define TIM_BDTR_BKF_SHIFT(x) (16 + (x) * 4) | |
| 92 | 88 | |
| 93 | 89 | enum stm32_timers_dmas { |
| 94 | 90 | STM32_TIMERS_DMA_CH1, |
| @@ -106,7 +106,6 @@ · 105 unmodified lines | ||
| 106 | 106 | #define AT91_MATRIX_DDR_IOSR BIT(18) |
| 107 | 107 | #define AT91_MATRIX_NFD0_SELECT BIT(24) |
| 108 | 108 | #define AT91_MATRIX_DDR_MP_EN BIT(25) |
| 109 | −#define AT91_MATRIX_EBI_NUM_CS 8 | |
| 110 | 109 | |
| 111 | 110 | #define AT91_MATRIX_USBPUCR_PUON BIT(30) |
| 112 | 111 | |
| @@ -181,14 +181,18 @@ static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) { · 180 unmodified lines | ||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) { |
| 184 | − val = cpu_to_le16(val); | |
| 185 | − return twl_i2c_write(mod_no, (u8*) &val, reg, 2); | |
| 184 | + __le16 value; | |
| 185 | + | |
| 186 | + value = cpu_to_le16(val); | |
| 187 | + return twl_i2c_write(mod_no, (u8 *) &value, reg, 2); | |
| 186 | 188 | } |
| 187 | 189 | |
| 188 | 190 | static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) { |
| 189 | 191 | int ret; |
| 190 | − ret = twl_i2c_read(mod_no, (u8*) val, reg, 2); | |
| 191 | − *val = le16_to_cpu(*val); | |
| 192 | + __le16 value; | |
| 193 | + | |
| 194 | + ret = twl_i2c_read(mod_no, (u8 *) &value, reg, 2); | |
| 195 | + *val = le16_to_cpu(value); | |
| 192 | 196 | return ret; |
| 193 | 197 | } |
| 194 | 198 | |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #define SGI_MMTIMER 153 |
| 34 | 34 | #define STORE_QUEUE_MINOR 155 /* unused */ |
| 35 | 35 | #define I2O_MINOR 166 |
| 36 | +#define AGPGART_MINOR 175 | |
| 36 | 37 | #define HWRNG_MINOR 183 |
| 37 | 38 | #define MICROCODE_MINOR 184 |
| 38 | 39 | #define IRNET_MINOR 187 |
| @@ -57,6 +58,7 @@ · 18 unmodified lines | ||
| 57 | 58 | #define UHID_MINOR 239 |
| 58 | 59 | #define USERIO_MINOR 240 |
| 59 | 60 | #define VHOST_VSOCK_MINOR 241 |
| 61 | +#define RFKILL_MINOR 242 | |
| 60 | 62 | #define MISC_DYNAMIC_MINOR 255 |
| 61 | 63 | |
| 62 | 64 | struct device; |
| @@ -556,8 +556,6 @@ struct mlx5_priv { · 555 unmodified lines | ||
| 556 | 556 | struct dentry *cmdif_debugfs; |
| 557 | 557 | /* end: qp staff */ |
| 558 | 558 | |
| 559 | − struct xarray mkey_table; | |
| 560 | − | |
| 561 | 559 | /* start: alloc staff */ |
| 562 | 560 | /* protect buffer alocation according to numa node */ |
| 563 | 561 | struct mutex alloc_mutex; |
| @@ -942,8 +940,6 @@ struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev, · 378 unmodified lines | ||
| 942 | 940 | gfp_t flags, int npages); |
| 943 | 941 | void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev, |
| 944 | 942 | struct mlx5_cmd_mailbox *head); |
| 945 | −void mlx5_init_mkey_table(struct mlx5_core_dev *dev); | |
| 946 | −void mlx5_cleanup_mkey_table(struct mlx5_core_dev *dev); | |
| 947 | 943 | int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, |
| 948 | 944 | struct mlx5_core_mkey *mkey, |
| 949 | 945 | struct mlx5_async_ctx *async_ctx, u32 *in, |
| @@ -1121,6 +1117,11 @@ static inline bool mlx5_core_is_pf(const struct mlx5_core_dev *dev) · 171 unmodified lines | ||
| 1121 | 1117 | return dev->coredev_type == MLX5_COREDEV_PF; |
| 1122 | 1118 | } |
| 1123 | 1119 | |
| 1120 | +static inline bool mlx5_core_is_vf(const struct mlx5_core_dev *dev) | |
| 1121 | +{ | |
| 1122 | + return dev->coredev_type == MLX5_COREDEV_VF; | |
| 1123 | +} | |
| 1124 | + | |
| 1124 | 1125 | static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) |
| 1125 | 1126 | { |
| 1126 | 1127 | return dev->caps.embedded_cpu; |
| @@ -1186,4 +1187,15 @@ enum { · 59 unmodified lines | ||
| 1186 | 1187 | MLX5_TRIGGERED_CMD_COMP = (u64)1 << 32, |
| 1187 | 1188 | }; |
| 1188 | 1189 | |
| 1190 | +static inline bool mlx5_is_roce_enabled(struct mlx5_core_dev *dev) | |
| 1191 | +{ | |
| 1192 | + struct devlink *devlink = priv_to_devlink(dev); | |
| 1193 | + union devlink_param_value val; | |
| 1194 | + | |
| 1195 | + devlink_param_driverinit_value_get(devlink, | |
| 1196 | + DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE, | |
| 1197 | + &val); | |
| 1198 | + return val.vbool; | |
| 1199 | +} | |
| 1200 | + | |
| 1189 | 1201 | #endif /* MLX5_DRIVER_H */ |
| @@ -80,7 +80,8 @@ enum mlx5_flow_namespace_type { · 79 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | enum { |
| 82 | 82 | FDB_BYPASS_PATH, |
| 83 | − FDB_FAST_PATH, | |
| 83 | + FDB_TC_OFFLOAD, | |
| 84 | + FDB_FT_OFFLOAD, | |
| 84 | 85 | FDB_SLOW_PATH, |
| 85 | 86 | }; |
| 86 | 87 | |
| @@ -1110,6 +1110,7 @@ enum { · 1109 unmodified lines | ||
| 1110 | 1110 | }; |
| 1111 | 1111 | |
| 1112 | 1112 | enum { |
| 1113 | + MLX5_FLEX_PARSER_GENEVE_ENABLED = 1 << 3, | |
| 1113 | 1114 | MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED = 1 << 7, |
| 1114 | 1115 | MLX5_FLEX_PARSER_ICMP_V4_ENABLED = 1 << 8, |
| 1115 | 1116 | MLX5_FLEX_PARSER_ICMP_V6_ENABLED = 1 << 9, |
| @@ -1153,7 +1154,7 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 37 unmodified lines | ||
| 1153 | 1154 | u8 log_max_srq[0x5]; |
| 1154 | 1155 | u8 reserved_at_b0[0x10]; |
| 1155 | 1156 | |
| 1156 | − u8 reserved_at_c0[0x8]; | |
| 1157 | + u8 max_sgl_for_optimized_performance[0x8]; | |
| 1157 | 1158 | u8 log_max_cq_sz[0x8]; |
| 1158 | 1159 | u8 reserved_at_d0[0xb]; |
| 1159 | 1160 | u8 log_max_cq[0x5]; |
| @@ -564,21 +564,6 @@ int vma_is_stack_for_current(struct vm_area_struct *vma); · 563 unmodified lines | ||
| 564 | 564 | struct mmu_gather; |
| 565 | 565 | struct inode; |
| 566 | 566 | |
| 567 | −#if !defined(CONFIG_ARCH_HAS_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE) | |
| 568 | −static inline int pmd_devmap(pmd_t pmd) | |
| 569 | −{ | |
| 570 | − return 0; | |
| 571 | −} | |
| 572 | −static inline int pud_devmap(pud_t pud) | |
| 573 | −{ | |
| 574 | − return 0; | |
| 575 | −} | |
| 576 | −static inline int pgd_devmap(pgd_t pgd) | |
| 577 | −{ | |
| 578 | − return 0; | |
| 579 | −} | |
| 580 | −#endif | |
| 581 | − | |
| 582 | 567 | /* |
| 583 | 568 | * FIXME: take this include out, include page-flags.h in |
| 584 | 569 | * files which need it (119 of them) |
| @@ -1643,19 +1628,27 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) · 1058 unmodified lines | ||
| 1643 | 1628 | return (unsigned long)val; |
| 1644 | 1629 | } |
| 1645 | 1630 | |
| 1631 | +void mm_trace_rss_stat(struct mm_struct *mm, int member, long count); | |
| 1632 | + | |
| 1646 | 1633 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) |
| 1647 | 1634 | { |
| 1648 | − atomic_long_add(value, &mm->rss_stat.count[member]); | |
| 1635 | + long count = atomic_long_add_return(value, &mm->rss_stat.count[member]); | |
| 1636 | + | |
| 1637 | + mm_trace_rss_stat(mm, member, count); | |
| 1649 | 1638 | } |
| 1650 | 1639 | |
| 1651 | 1640 | static inline void inc_mm_counter(struct mm_struct *mm, int member) |
| 1652 | 1641 | { |
| 1653 | − atomic_long_inc(&mm->rss_stat.count[member]); | |
| 1642 | + long count = atomic_long_inc_return(&mm->rss_stat.count[member]); | |
| 1643 | + | |
| 1644 | + mm_trace_rss_stat(mm, member, count); | |
| 1654 | 1645 | } |
| 1655 | 1646 | |
| 1656 | 1647 | static inline void dec_mm_counter(struct mm_struct *mm, int member) |
| 1657 | 1648 | { |
| 1658 | − atomic_long_dec(&mm->rss_stat.count[member]); | |
| 1649 | + long count = atomic_long_dec_return(&mm->rss_stat.count[member]); | |
| 1650 | + | |
| 1651 | + mm_trace_rss_stat(mm, member, count); | |
| 1659 | 1652 | } |
| 1660 | 1653 | |
| 1661 | 1654 | /* Optimized variant when page is already known not to be PageAnon */ |
| @@ -1845,12 +1838,12 @@ static inline void mm_dec_nr_ptes(struct mm_struct *mm) {} · 183 unmodified lines | ||
| 1845 | 1838 | int __pte_alloc(struct mm_struct *mm, pmd_t *pmd); |
| 1846 | 1839 | int __pte_alloc_kernel(pmd_t *pmd); |
| 1847 | 1840 | |
| 1841 | +#if defined(CONFIG_MMU) | |
| 1842 | + | |
| 1848 | 1843 | /* |
| 1849 | − * The following ifdef needed to get the 4level-fixup.h header to work. | |
| 1850 | − * Remove it when 4level-fixup.h has been removed. | |
| 1844 | + * The following ifdef needed to get the 5level-fixup.h header to work. | |
| 1845 | + * Remove it when 5level-fixup.h has been removed. | |
| 1851 | 1846 | */ |
| 1852 | −#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK) | |
| 1853 | − | |
| 1854 | 1847 | #ifndef __ARCH_HAS_5LEVEL_HACK |
| 1855 | 1848 | static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd, |
| 1856 | 1849 | unsigned long address) |
| @@ -1872,7 +1865,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a · 15 unmodified lines | ||
| 1872 | 1865 | return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))? |
| 1873 | 1866 | NULL: pmd_offset(pud, address); |
| 1874 | 1867 | } |
| 1875 | −#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ | |
| 1868 | +#endif /* CONFIG_MMU */ | |
| 1876 | 1869 | |
| 1877 | 1870 | #if USE_SPLIT_PTE_PTLOCKS |
| 1878 | 1871 | #if ALLOC_SPLIT_PTLOCKS |
| @@ -2214,9 +2207,6 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...); · 335 unmodified lines | ||
| 2214 | 2207 | |
| 2215 | 2208 | extern void setup_per_cpu_pageset(void); |
| 2216 | 2209 | |
| 2217 | −extern void zone_pcp_update(struct zone *zone); | |
| 2218 | −extern void zone_pcp_reset(struct zone *zone); | |
| 2219 | − | |
| 2220 | 2210 | /* page_alloc.c */ |
| 2221 | 2211 | extern int min_free_kbytes; |
| 2222 | 2212 | extern int watermark_boost_factor; |
| @@ -2631,7 +2621,9 @@ static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags) · 408 unmodified lines | ||
| 2631 | 2621 | typedef int (*pte_fn_t)(pte_t *pte, unsigned long addr, void *data); |
| 2632 | 2622 | extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, |
| 2633 | 2623 | unsigned long size, pte_fn_t fn, void *data); |
| 2634 | − | |
| 2624 | +extern int apply_to_existing_page_range(struct mm_struct *mm, | |
| 2625 | + unsigned long address, unsigned long size, | |
| 2626 | + pte_fn_t fn, void *data); | |
| 2635 | 2627 | |
| 2636 | 2628 | #ifdef CONFIG_PAGE_POISONING |
| 2637 | 2629 | extern bool page_poisoning_enabled(void); |
| @@ -2781,7 +2773,7 @@ extern int sysctl_memory_failure_early_kill; · 143 unmodified lines | ||
| 2781 | 2773 | extern int sysctl_memory_failure_recovery; |
| 2782 | 2774 | extern void shake_page(struct page *p, int access); |
| 2783 | 2775 | extern atomic_long_t num_poisoned_pages __read_mostly; |
| 2784 | −extern int soft_offline_page(struct page *page, int flags); | |
| 2776 | +extern int soft_offline_page(unsigned long pfn, int flags); | |
| 2785 | 2777 | |
| 2786 | 2778 | |
| 2787 | 2779 | /* |
| @@ -2873,5 +2865,17 @@ static inline int pages_identical(struct page *page1, struct page *page2) · 85 unmodified lines | ||
| 2873 | 2865 | return !memcmp_pages(page1, page2); |
| 2874 | 2866 | } |
| 2875 | 2867 | |
| 2868 | +#ifdef CONFIG_MAPPING_DIRTY_HELPERS | |
| 2869 | +unsigned long clean_record_shared_mapping_range(struct address_space *mapping, | |
| 2870 | + pgoff_t first_index, pgoff_t nr, | |
| 2871 | + pgoff_t bitmap_pgoff, | |
| 2872 | + unsigned long *bitmap, | |
| 2873 | + pgoff_t *start, | |
| 2874 | + pgoff_t *end); | |
| 2875 | + | |
| 2876 | +unsigned long wp_shared_mapping_range(struct address_space *mapping, | |
| 2877 | + pgoff_t first_index, pgoff_t nr); | |
| 2878 | +#endif | |
| 2879 | + | |
| 2876 | 2880 | #endif /* __KERNEL__ */ |
| 2877 | 2881 | #endif /* _LINUX_MM_H */ |
| @@ -226,7 +226,7 @@ struct mmc_queue_req; · 225 unmodified lines | ||
| 226 | 226 | * MMC Physical partitions |
| 227 | 227 | */ |
| 228 | 228 | struct mmc_part { |
| 229 | − unsigned int size; /* partition size (in bytes) */ | |
| 229 | + u64 size; /* partition size (in bytes) */ | |
| 230 | 230 | unsigned int part_cfg; /* partition type */ |
| 231 | 231 | char name[MAX_MMC_PART_NAME_LEN]; |
| 232 | 232 | bool force_ro; /* to make boot parts RO by default */ |
| @@ -291,6 +291,7 @@ struct mmc_card { · 58 unmodified lines | ||
| 291 | 291 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ |
| 292 | 292 | |
| 293 | 293 | unsigned int sdio_funcs; /* number of SDIO functions */ |
| 294 | + atomic_t sdio_funcs_probed; /* number of probed SDIO funcs */ | |
| 294 | 295 | struct sdio_cccr cccr; /* common card info */ |
| 295 | 296 | struct sdio_cis cis; /* common tuple info */ |
| 296 | 297 | struct sdio_func *sdio_func[SDIO_MAX_FUNCS]; /* SDIO functions (devices) */ |
| @@ -71,6 +71,8 @@ · 70 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | #define SDIO_VENDOR_ID_TI 0x0097 |
| 73 | 73 | #define SDIO_DEVICE_ID_TI_WL1271 0x4076 |
| 74 | +#define SDIO_VENDOR_ID_TI_WL1251 0x104c | |
| 75 | +#define SDIO_DEVICE_ID_TI_WL1251 0x9066 | |
| 74 | 76 | |
| 75 | 77 | #define SDIO_VENDOR_ID_STE 0x0020 |
| 76 | 78 | #define SDIO_DEVICE_ID_STE_CW1200 0x2280 |
| @@ -6,9 +6,12 @@ · 5 unmodified lines | ||
| 6 | 6 | #include <linux/spinlock.h> |
| 7 | 7 | #include <linux/mm_types.h> |
| 8 | 8 | #include <linux/srcu.h> |
| 9 | +#include <linux/interval_tree.h> | |
| 9 | 10 | |
| 11 | +struct mmu_notifier_mm; | |
| 10 | 12 | struct mmu_notifier; |
| 11 | −struct mmu_notifier_ops; | |
| 13 | +struct mmu_notifier_range; | |
| 14 | +struct mmu_interval_notifier; | |
| 12 | 15 | |
| 13 | 16 | /** |
| 14 | 17 | * enum mmu_notifier_event - reason for the mmu notifier callback |
| @@ -31,6 +34,9 @@ struct mmu_notifier_ops; · 16 unmodified lines | ||
| 31 | 34 | * access flags). User should soft dirty the page in the end callback to make |
| 32 | 35 | * sure that anyone relying on soft dirtyness catch pages that might be written |
| 33 | 36 | * through non CPU mappings. |
| 37 | + * | |
| 38 | + * @MMU_NOTIFY_RELEASE: used during mmu_interval_notifier invalidate to signal | |
| 39 | + * that the mm refcount is zero and the range is no longer accessible. | |
| 34 | 40 | */ |
| 35 | 41 | enum mmu_notifier_event { |
| 36 | 42 | MMU_NOTIFY_UNMAP = 0, |
| @@ -38,38 +44,11 @@ enum mmu_notifier_event { · 1 unmodified line | ||
| 38 | 44 | MMU_NOTIFY_PROTECTION_VMA, |
| 39 | 45 | MMU_NOTIFY_PROTECTION_PAGE, |
| 40 | 46 | MMU_NOTIFY_SOFT_DIRTY, |
| 41 | −}; | |
| 42 | − | |
| 43 | −#ifdef CONFIG_MMU_NOTIFIER | |
| 44 | − | |
| 45 | −#ifdef CONFIG_LOCKDEP | |
| 46 | −extern struct lockdep_map __mmu_notifier_invalidate_range_start_map; | |
| 47 | −#endif | |
| 48 | − | |
| 49 | −/* | |
| 50 | − * The mmu notifier_mm structure is allocated and installed in | |
| 51 | − * mm->mmu_notifier_mm inside the mm_take_all_locks() protected | |
| 52 | − * critical section and it's released only when mm_count reaches zero | |
| 53 | − * in mmdrop(). | |
| 54 | − */ | |
| 55 | −struct mmu_notifier_mm { | |
| 56 | − /* all mmu notifiers registerd in this mm are queued in this list */ | |
| 57 | − struct hlist_head list; | |
| 58 | − /* to serialize the list modifications and hlist_unhashed */ | |
| 59 | − spinlock_t lock; | |
| 47 | + MMU_NOTIFY_RELEASE, | |
| 60 | 48 | }; |
| 61 | 49 | |
| 62 | 50 | #define MMU_NOTIFIER_RANGE_BLOCKABLE (1 << 0) |
| 63 | 51 | |
| 64 | −struct mmu_notifier_range { | |
| 65 | − struct vm_area_struct *vma; | |
| 66 | − struct mm_struct *mm; | |
| 67 | − unsigned long start; | |
| 68 | − unsigned long end; | |
| 69 | − unsigned flags; | |
| 70 | − enum mmu_notifier_event event; | |
| 71 | −}; | |
| 72 | − | |
| 73 | 52 | struct mmu_notifier_ops { |
| 74 | 53 | /* |
| 75 | 54 | * Called either by mmu_notifier_unregister or when the mm is |
| @@ -249,6 +228,41 @@ struct mmu_notifier { · 173 unmodified lines | ||
| 249 | 228 | unsigned int users; |
| 250 | 229 | }; |
| 251 | 230 | |
| 231 | +/** | |
| 232 | + * struct mmu_interval_notifier_ops | |
| 233 | + * @invalidate: Upon return the caller must stop using any SPTEs within this | |
| 234 | + * range. This function can sleep. Return false only if sleeping | |
| 235 | + * was required but mmu_notifier_range_blockable(range) is false. | |
| 236 | + */ | |
| 237 | +struct mmu_interval_notifier_ops { | |
| 238 | + bool (*invalidate)(struct mmu_interval_notifier *mni, | |
| 239 | + const struct mmu_notifier_range *range, | |
| 240 | + unsigned long cur_seq); | |
| 241 | +}; | |
| 242 | + | |
| 243 | +struct mmu_interval_notifier { | |
| 244 | + struct interval_tree_node interval_tree; | |
| 245 | + const struct mmu_interval_notifier_ops *ops; | |
| 246 | + struct mm_struct *mm; | |
| 247 | + struct hlist_node deferred_item; | |
| 248 | + unsigned long invalidate_seq; | |
| 249 | +}; | |
| 250 | + | |
| 251 | +#ifdef CONFIG_MMU_NOTIFIER | |
| 252 | + | |
| 253 | +#ifdef CONFIG_LOCKDEP | |
| 254 | +extern struct lockdep_map __mmu_notifier_invalidate_range_start_map; | |
| 255 | +#endif | |
| 256 | + | |
| 257 | +struct mmu_notifier_range { | |
| 258 | + struct vm_area_struct *vma; | |
| 259 | + struct mm_struct *mm; | |
| 260 | + unsigned long start; | |
| 261 | + unsigned long end; | |
| 262 | + unsigned flags; | |
| 263 | + enum mmu_notifier_event event; | |
| 264 | +}; | |
| 265 | + | |
| 252 | 266 | static inline int mm_has_notifiers(struct mm_struct *mm) |
| 253 | 267 | { |
| 254 | 268 | return unlikely(mm->mmu_notifier_mm); |
| @@ -275,6 +289,81 @@ extern int __mmu_notifier_register(struct mmu_notifier *mn, · 20 unmodified lines | ||
| 275 | 289 | struct mm_struct *mm); |
| 276 | 290 | extern void mmu_notifier_unregister(struct mmu_notifier *mn, |
| 277 | 291 | struct mm_struct *mm); |
| 292 | + | |
| 293 | +unsigned long mmu_interval_read_begin(struct mmu_interval_notifier *mni); | |
| 294 | +int mmu_interval_notifier_insert(struct mmu_interval_notifier *mni, | |
| 295 | + struct mm_struct *mm, unsigned long start, | |
| 296 | + unsigned long length, | |
| 297 | + const struct mmu_interval_notifier_ops *ops); | |
| 298 | +int mmu_interval_notifier_insert_locked( | |
| 299 | + struct mmu_interval_notifier *mni, struct mm_struct *mm, | |
| 300 | + unsigned long start, unsigned long length, | |
| 301 | + const struct mmu_interval_notifier_ops *ops); | |
| 302 | +void mmu_interval_notifier_remove(struct mmu_interval_notifier *mni); | |
| 303 | + | |
| 304 | +/** | |
| 305 | + * mmu_interval_set_seq - Save the invalidation sequence | |
| 306 | + * @mni - The mni passed to invalidate | |
| 307 | + * @cur_seq - The cur_seq passed to the invalidate() callback | |
| 308 | + * | |
| 309 | + * This must be called unconditionally from the invalidate callback of a | |
| 310 | + * struct mmu_interval_notifier_ops under the same lock that is used to call | |
| 311 | + * mmu_interval_read_retry(). It updates the sequence number for later use by | |
| 312 | + * mmu_interval_read_retry(). The provided cur_seq will always be odd. | |
| 313 | + * | |
| 314 | + * If the caller does not call mmu_interval_read_begin() or | |
| 315 | + * mmu_interval_read_retry() then this call is not required. | |
| 316 | + */ | |
| 317 | +static inline void mmu_interval_set_seq(struct mmu_interval_notifier *mni, | |
| 318 | + unsigned long cur_seq) | |
| 319 | +{ | |
| 320 | + WRITE_ONCE(mni->invalidate_seq, cur_seq); | |
| 321 | +} | |
| 322 | + | |
| 323 | +/** | |
| 324 | + * mmu_interval_read_retry - End a read side critical section against a VA range | |
| 325 | + * mni: The range | |
| 326 | + * seq: The return of the paired mmu_interval_read_begin() | |
| 327 | + * | |
| 328 | + * This MUST be called under a user provided lock that is also held | |
| 329 | + * unconditionally by op->invalidate() when it calls mmu_interval_set_seq(). | |
| 330 | + * | |
| 331 | + * Each call should be paired with a single mmu_interval_read_begin() and | |
| 332 | + * should be used to conclude the read side. | |
| 333 | + * | |
| 334 | + * Returns true if an invalidation collided with this critical section, and | |
| 335 | + * the caller should retry. | |
| 336 | + */ | |
| 337 | +static inline bool mmu_interval_read_retry(struct mmu_interval_notifier *mni, | |
| 338 | + unsigned long seq) | |
| 339 | +{ | |
| 340 | + return mni->invalidate_seq != seq; | |
| 341 | +} | |
| 342 | + | |
| 343 | +/** | |
| 344 | + * mmu_interval_check_retry - Test if a collision has occurred | |
| 345 | + * mni: The range | |
| 346 | + * seq: The return of the matching mmu_interval_read_begin() | |
| 347 | + * | |
| 348 | + * This can be used in the critical section between mmu_interval_read_begin() | |
| 349 | + * and mmu_interval_read_retry(). A return of true indicates an invalidation | |
| 350 | + * has collided with this critical region and a future | |
| 351 | + * mmu_interval_read_retry() will return true. | |
| 352 | + * | |
| 353 | + * False is not reliable and only suggests a collision may not have | |
| 354 | + * occured. It can be called many times and does not have to hold the user | |
| 355 | + * provided lock. | |
| 356 | + * | |
| 357 | + * This call can be used as part of loops and other expensive operations to | |
| 358 | + * expedite a retry. | |
| 359 | + */ | |
| 360 | +static inline bool mmu_interval_check_retry(struct mmu_interval_notifier *mni, | |
| 361 | + unsigned long seq) | |
| 362 | +{ | |
| 363 | + /* Pairs with the WRITE_ONCE in mmu_interval_set_seq() */ | |
| 364 | + return READ_ONCE(mni->invalidate_seq) != seq; | |
| 365 | +} | |
| 366 | + | |
| 278 | 367 | extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); |
| 279 | 368 | extern void __mmu_notifier_release(struct mm_struct *mm); |
| 280 | 369 | extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, |
| @@ -273,12 +273,12 @@ enum lru_list { · 272 unmodified lines | ||
| 273 | 273 | |
| 274 | 274 | #define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++) |
| 275 | 275 | |
| 276 | −static inline int is_file_lru(enum lru_list lru) | |
| 276 | +static inline bool is_file_lru(enum lru_list lru) | |
| 277 | 277 | { |
| 278 | 278 | return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | −static inline int is_active_lru(enum lru_list lru) | |
| 281 | +static inline bool is_active_lru(enum lru_list lru) | |
| 282 | 282 | { |
| 283 | 283 | return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); |
| 284 | 284 | } |
| @@ -296,6 +296,12 @@ struct zone_reclaim_stat { · 11 unmodified lines | ||
| 296 | 296 | unsigned long recent_scanned[2]; |
| 297 | 297 | }; |
| 298 | 298 | |
| 299 | +enum lruvec_flags { | |
| 300 | + LRUVEC_CONGESTED, /* lruvec has many dirty pages | |
| 301 | + * backed by a congested BDI | |
| 302 | + */ | |
| 303 | +}; | |
| 304 | + | |
| 299 | 305 | struct lruvec { |
| 300 | 306 | struct list_head lists[NR_LRU_LISTS]; |
| 301 | 307 | struct zone_reclaim_stat reclaim_stat; |
| @@ -303,12 +309,14 @@ struct lruvec { · 1 unmodified line | ||
| 303 | 309 | atomic_long_t inactive_age; |
| 304 | 310 | /* Refaults at the time of last reclaim cycle */ |
| 305 | 311 | unsigned long refaults; |
| 312 | + /* Various lruvec state flags (enum lruvec_flags) */ | |
| 313 | + unsigned long flags; | |
| 306 | 314 | #ifdef CONFIG_MEMCG |
| 307 | 315 | struct pglist_data *pgdat; |
| 308 | 316 | #endif |
| 309 | 317 | }; |
| 310 | 318 | |
| 311 | −/* Isolate unmapped file */ | |
| 319 | +/* Isolate unmapped pages */ | |
| 312 | 320 | #define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) |
| 313 | 321 | /* Isolate for asynchronous migration */ |
| 314 | 322 | #define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x4) |
| @@ -359,33 +367,40 @@ struct per_cpu_nodestat { · 44 unmodified lines | ||
| 359 | 367 | #endif /* !__GENERATING_BOUNDS.H */ |
| 360 | 368 | |
| 361 | 369 | enum zone_type { |
| 362 | −#ifdef CONFIG_ZONE_DMA | |
| 363 | 370 | /* |
| 364 | − * ZONE_DMA is used when there are devices that are not able | |
| 365 | − * to do DMA to all of addressable memory (ZONE_NORMAL). Then we | |
| 366 | − * carve out the portion of memory that is needed for these devices. | |
| 367 | − * The range is arch specific. | |
| 371 | + * ZONE_DMA and ZONE_DMA32 are used when there are peripherals not able | |
| 372 | + * to DMA to all of the addressable memory (ZONE_NORMAL). | |
| 373 | + * On architectures where this area covers the whole 32 bit address | |
| 374 | + * space ZONE_DMA32 is used. ZONE_DMA is left for the ones with smaller | |
| 375 | + * DMA addressing constraints. This distinction is important as a 32bit | |
| 376 | + * DMA mask is assumed when ZONE_DMA32 is defined. Some 64-bit | |
| 377 | + * platforms may need both zones as they support peripherals with | |
| 378 | + * different DMA addressing limitations. | |
| 379 | + * | |
| 380 | + * Some examples: | |
| 381 | + * | |
| 382 | + * - i386 and x86_64 have a fixed 16M ZONE_DMA and ZONE_DMA32 for the | |
| 383 | + * rest of the lower 4G. | |
| 368 | 384 | * |
| 369 | − * Some examples | |
| 385 | + * - arm only uses ZONE_DMA, the size, up to 4G, may vary depending on | |
| 386 | + * the specific device. | |
| 370 | 387 | * |
| 371 | − * Architecture Limit | |
| 372 | − * --------------------------- | |
| 373 | − * parisc, ia64, sparc <4G | |
| 374 | − * s390, powerpc <2G | |
| 375 | − * arm Various | |
| 376 | − * alpha Unlimited or 0-16MB. | |
| 388 | + * - arm64 has a fixed 1G ZONE_DMA and ZONE_DMA32 for the rest of the | |
| 389 | + * lower 4G. | |
| 377 | 390 | * |
| 378 | − * i386, x86_64 and multiple other arches | |
| 379 | − * <16M. | |
| 391 | + * - powerpc only uses ZONE_DMA, the size, up to 2G, may vary | |
| 392 | + * depending on the specific device. | |
| 393 | + * | |
| 394 | + * - s390 uses ZONE_DMA fixed to the lower 2G. | |
| 395 | + * | |
| 396 | + * - ia64 and riscv only use ZONE_DMA32. | |
| 397 | + * | |
| 398 | + * - parisc uses neither. | |
| 380 | 399 | */ |
| 400 | +#ifdef CONFIG_ZONE_DMA | |
| 381 | 401 | ZONE_DMA, |
| 382 | 402 | #endif |
| 383 | 403 | #ifdef CONFIG_ZONE_DMA32 |
| 384 | − /* | |
| 385 | − * x86_64 needs two ZONE_DMAs because it supports devices that are | |
| 386 | − * only able to do DMA to the lower 16M but also 32 bit devices that | |
| 387 | − * can only do DMA areas below 4G. | |
| 388 | − */ | |
| 389 | 404 | ZONE_DMA32, |
| 390 | 405 | #endif |
| 391 | 406 | /* |
| @@ -565,9 +580,6 @@ struct zone { · 173 unmodified lines | ||
| 565 | 580 | } ____cacheline_internodealigned_in_smp; |
| 566 | 581 | |
| 567 | 582 | enum pgdat_flags { |
| 568 | − PGDAT_CONGESTED, /* pgdat has many dirty pages backed by | |
| 569 | − * a congested BDI | |
| 570 | − */ | |
| 571 | 583 | PGDAT_DIRTY, /* reclaim scanning has recently found |
| 572 | 584 | * many dirty file pages at the tail |
| 573 | 585 | * of the LRU. |
| @@ -770,7 +782,13 @@ typedef struct pglist_data { · 196 unmodified lines | ||
| 770 | 782 | #endif |
| 771 | 783 | |
| 772 | 784 | /* Fields commonly accessed by the page reclaim scanner */ |
| 773 | − struct lruvec lruvec; | |
| 785 | + | |
| 786 | + /* | |
| 787 | + * NOTE: THIS IS UNUSED IF MEMCG IS ENABLED. | |
| 788 | + * | |
| 789 | + * Use mem_cgroup_lruvec() to look up lruvecs. | |
| 790 | + */ | |
| 791 | + struct lruvec __lruvec; | |
| 774 | 792 | |
| 775 | 793 | unsigned long flags; |
| 776 | 794 | |
| @@ -793,11 +811,6 @@ typedef struct pglist_data { · 16 unmodified lines | ||
| 793 | 811 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
| 794 | 812 | #define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid)) |
| 795 | 813 | |
| 796 | −static inline struct lruvec *node_lruvec(struct pglist_data *pgdat) | |
| 797 | −{ | |
| 798 | − return &pgdat->lruvec; | |
| 799 | −} | |
| 800 | − | |
| 801 | 814 | static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat) |
| 802 | 815 | { |
| 803 | 816 | return pgdat->node_start_pfn + pgdat->node_spanned_pages; |
| @@ -835,7 +848,7 @@ static inline struct pglist_data *lruvec_pgdat(struct lruvec *lruvec) · 31 unmodified lines | ||
| 835 | 848 | #ifdef CONFIG_MEMCG |
| 836 | 849 | return lruvec->pgdat; |
| 837 | 850 | #else |
| 838 | − return container_of(lruvec, struct pglist_data, lruvec); | |
| 851 | + return container_of(lruvec, struct pglist_data, __lruvec); | |
| 839 | 852 | #endif |
| 840 | 853 | } |
| 841 | 854 | |
| @@ -1072,7 +1085,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, · 230 unmodified lines | ||
| 1072 | 1085 | /** |
| 1073 | 1086 | * for_each_zone_zonelist_nodemask - helper macro to iterate over valid zones in a zonelist at or below a given zone index and within a nodemask |
| 1074 | 1087 | * @zone - The current zone in the iterator |
| 1075 | − * @z - The current pointer within zonelist->zones being iterated | |
| 1088 | + * @z - The current pointer within zonelist->_zonerefs being iterated | |
| 1076 | 1089 | * @zlist - The zonelist being iterated |
| 1077 | 1090 | * @highidx - The zone index of the highest zone to return |
| 1078 | 1091 | * @nodemask - Nodemask allowed by the allocator |
| @@ -587,9 +587,9 @@ struct platform_device_id { · 586 unmodified lines | ||
| 587 | 587 | #define MDIO_NAME_SIZE 32 |
| 588 | 588 | #define MDIO_MODULE_PREFIX "mdio:" |
| 589 | 589 | |
| 590 | −#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" | |
| 590 | +#define MDIO_ID_FMT "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u" | |
| 591 | 591 | #define MDIO_ID_ARGS(_id) \ |
| 592 | − (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ | |
| 592 | + ((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ | |
| 593 | 593 | ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ |
| 594 | 594 | ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ |
| 595 | 595 | ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \ |
| @@ -1,11 +1,14 @@ | ||
| 1 | −#ifndef _LINUX_MODULE_H | |
| 2 | −#define _LINUX_MODULE_H | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 3 | 2 | /* |
| 4 | 3 | * Dynamic loading of modules into the kernel. |
| 5 | 4 | * |
| 6 | 5 | * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996 |
| 7 | 6 | * Rewritten again by Rusty Russell, 2002 |
| 8 | 7 | */ |
| 8 | + | |
| 9 | +#ifndef _LINUX_MODULE_H | |
| 10 | +#define _LINUX_MODULE_H | |
| 11 | + | |
| 9 | 12 | #include <linux/list.h> |
| 10 | 13 | #include <linux/stat.h> |
| 11 | 14 | #include <linux/compiler.h> |
| @@ -91,7 +91,7 @@ void module_arch_cleanup(struct module *mod); · 90 unmodified lines | ||
| 91 | 91 | /* Any cleanup before freeing mod->module_init */ |
| 92 | 92 | void module_arch_freeing_init(struct module *mod); |
| 93 | 93 | |
| 94 | −#ifdef CONFIG_KASAN | |
| 94 | +#if defined(CONFIG_KASAN) && !defined(CONFIG_KASAN_VMALLOC) | |
| 95 | 95 | #include <linux/kasan.h> |
| 96 | 96 | #define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT) |
| 97 | 97 | #else |
| @@ -100,11 +100,11 @@ struct kparam_array · 99 unmodified lines | ||
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * module_param - typesafe helper for a module/cmdline parameter |
| 103 | − * @value: the variable to alter, and exposed parameter name. | |
| 103 | + * @name: the variable to alter, and exposed parameter name. | |
| 104 | 104 | * @type: the type of the parameter |
| 105 | 105 | * @perm: visibility in sysfs. |
| 106 | 106 | * |
| 107 | − * @value becomes the module parameter, or (prefixed by KBUILD_MODNAME and a | |
| 107 | + * @name becomes the module parameter, or (prefixed by KBUILD_MODNAME and a | |
| 108 | 108 | * ".") the kernel commandline parameter. Note that - is changed to _, so |
| 109 | 109 | * the user can use "foo-bar=1" even for variable "foo_bar". |
| 110 | 110 | * |
| @@ -47,16 +47,16 @@ struct vif_entry_notifier_info { · 46 unmodified lines | ||
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 | static inline int mr_call_vif_notifier(struct notifier_block *nb, |
| 50 | − struct net *net, | |
| 51 | 50 | unsigned short family, |
| 52 | 51 | enum fib_event_type event_type, |
| 53 | 52 | struct vif_device *vif, |
| 54 | − unsigned short vif_index, u32 tb_id) | |
| 53 | + unsigned short vif_index, u32 tb_id, | |
| 54 | + struct netlink_ext_ack *extack) | |
| 55 | 55 | { |
| 56 | 56 | struct vif_entry_notifier_info info = { |
| 57 | 57 | .info = { |
| 58 | 58 | .family = family, |
| 59 | − .net = net, | |
| 59 | + .extack = extack, | |
| 60 | 60 | }, |
| 61 | 61 | .dev = vif->dev, |
| 62 | 62 | .vif_index = vif_index, |
| @@ -64,7 +64,7 @@ static inline int mr_call_vif_notifier(struct notifier_block *nb, · 1 unmodified line | ||
| 64 | 64 | .tb_id = tb_id, |
| 65 | 65 | }; |
| 66 | 66 | |
| 67 | − return call_fib_notifier(nb, net, event_type, &info.info); | |
| 67 | + return call_fib_notifier(nb, event_type, &info.info); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | static inline int mr_call_vif_notifiers(struct net *net, |
| @@ -77,7 +77,6 @@ static inline int mr_call_vif_notifiers(struct net *net, · 6 unmodified lines | ||
| 77 | 77 | struct vif_entry_notifier_info info = { |
| 78 | 78 | .info = { |
| 79 | 79 | .family = family, |
| 80 | − .net = net, | |
| 81 | 80 | }, |
| 82 | 81 | .dev = vif->dev, |
| 83 | 82 | .vif_index = vif_index, |
| @@ -173,21 +172,21 @@ struct mfc_entry_notifier_info { · 89 unmodified lines | ||
| 173 | 172 | }; |
| 174 | 173 | |
| 175 | 174 | static inline int mr_call_mfc_notifier(struct notifier_block *nb, |
| 176 | − struct net *net, | |
| 177 | 175 | unsigned short family, |
| 178 | 176 | enum fib_event_type event_type, |
| 179 | − struct mr_mfc *mfc, u32 tb_id) | |
| 177 | + struct mr_mfc *mfc, u32 tb_id, | |
| 178 | + struct netlink_ext_ack *extack) | |
| 180 | 179 | { |
| 181 | 180 | struct mfc_entry_notifier_info info = { |
| 182 | 181 | .info = { |
| 183 | 182 | .family = family, |
| 184 | − .net = net, | |
| 183 | + .extack = extack, | |
| 185 | 184 | }, |
| 186 | 185 | .mfc = mfc, |
| 187 | 186 | .tb_id = tb_id |
| 188 | 187 | }; |
| 189 | 188 | |
| 190 | − return call_fib_notifier(nb, net, event_type, &info.info); | |
| 189 | + return call_fib_notifier(nb, event_type, &info.info); | |
| 191 | 190 | } |
| 192 | 191 | |
| 193 | 192 | static inline int mr_call_mfc_notifiers(struct net *net, |
| @@ -199,7 +198,6 @@ static inline int mr_call_mfc_notifiers(struct net *net, · 5 unmodified lines | ||
| 199 | 198 | struct mfc_entry_notifier_info info = { |
| 200 | 199 | .info = { |
| 201 | 200 | .family = family, |
| 202 | − .net = net, | |
| 203 | 201 | }, |
| 204 | 202 | .mfc = mfc, |
| 205 | 203 | .tb_id = tb_id |
| @@ -301,10 +299,11 @@ int mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb, · 95 unmodified lines | ||
| 301 | 299 | |
| 302 | 300 | int mr_dump(struct net *net, struct notifier_block *nb, unsigned short family, |
| 303 | 301 | int (*rules_dump)(struct net *net, |
| 304 | − struct notifier_block *nb), | |
| 302 | + struct notifier_block *nb, | |
| 303 | + struct netlink_ext_ack *extack), | |
| 305 | 304 | struct mr_table *(*mr_iter)(struct net *net, |
| 306 | 305 | struct mr_table *mrt), |
| 307 | − rwlock_t *mrt_lock); | |
| 306 | + rwlock_t *mrt_lock, struct netlink_ext_ack *extack); | |
| 308 | 307 | #else |
| 309 | 308 | static inline void vif_device_init(struct vif_device *v, |
| 310 | 309 | struct net_device *dev, |
| @@ -355,10 +354,11 @@ mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb, · 44 unmodified lines | ||
| 355 | 354 | static inline int mr_dump(struct net *net, struct notifier_block *nb, |
| 356 | 355 | unsigned short family, |
| 357 | 356 | int (*rules_dump)(struct net *net, |
| 358 | − struct notifier_block *nb), | |
| 357 | + struct notifier_block *nb, | |
| 358 | + struct netlink_ext_ack *extack), | |
| 359 | 359 | struct mr_table *(*mr_iter)(struct net *net, |
| 360 | 360 | struct mr_table *mrt), |
| 361 | − rwlock_t *mrt_lock) | |
| 361 | + rwlock_t *mrt_lock, struct netlink_ext_ack *extack) | |
| 362 | 362 | { |
| 363 | 363 | return -EINVAL; |
| 364 | 364 | } |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #define SNOR_MFR_INTEL CFI_MFR_INTEL |
| 23 | 23 | #define SNOR_MFR_ST CFI_MFR_ST /* ST Micro */ |
| 24 | 24 | #define SNOR_MFR_MICRON CFI_MFR_MICRON /* Micron */ |
| 25 | +#define SNOR_MFR_ISSI CFI_MFR_PMC | |
| 25 | 26 | #define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX |
| 26 | 27 | #define SNOR_MFR_SPANSION CFI_MFR_AMD |
| 27 | 28 | #define SNOR_MFR_SST CFI_MFR_SST |
| @@ -133,7 +134,7 @@ · 105 unmodified lines | ||
| 133 | 134 | #define SR_E_ERR BIT(5) |
| 134 | 135 | #define SR_P_ERR BIT(6) |
| 135 | 136 | |
| 136 | −#define SR_QUAD_EN_MX BIT(6) /* Macronix Quad I/O */ | |
| 137 | +#define SR1_QUAD_EN_BIT6 BIT(6) | |
| 137 | 138 | |
| 138 | 139 | /* Enhanced Volatile Configuration Register bits */ |
| 139 | 140 | #define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */ |
| @@ -144,10 +145,8 @@ · 4 unmodified lines | ||
| 144 | 145 | #define FSR_P_ERR BIT(4) /* Program operation status */ |
| 145 | 146 | #define FSR_PT_ERR BIT(1) /* Protection error bit */ |
| 146 | 147 | |
| 147 | −/* Configuration Register bits. */ | |
| 148 | −#define CR_QUAD_EN_SPAN BIT(1) /* Spansion Quad I/O */ | |
| 149 | − | |
| 150 | 148 | /* Status Register 2 bits. */ |
| 149 | +#define SR2_QUAD_EN_BIT1 BIT(1) | |
| 151 | 150 | #define SR2_QUAD_EN_BIT7 BIT(7) |
| 152 | 151 | |
| 153 | 152 | /* Supported SPI protocols */ |
| @@ -243,6 +242,9 @@ enum spi_nor_option_flags { · 89 unmodified lines | ||
| 243 | 242 | SNOR_F_4B_OPCODES = BIT(6), |
| 244 | 243 | SNOR_F_HAS_4BAIT = BIT(7), |
| 245 | 244 | SNOR_F_HAS_LOCK = BIT(8), |
| 245 | + SNOR_F_HAS_16BIT_SR = BIT(9), | |
| 246 | + SNOR_F_NO_READ_CR = BIT(10), | |
| 247 | + | |
| 246 | 248 | }; |
| 247 | 249 | |
| 248 | 250 | /** |
| @@ -465,6 +467,34 @@ enum spi_nor_pp_command_index { · 216 unmodified lines | ||
| 465 | 467 | /* Forward declaration that will be used in 'struct spi_nor_flash_parameter' */ |
| 466 | 468 | struct spi_nor; |
| 467 | 469 | |
| 470 | +/** | |
| 471 | + * struct spi_nor_controller_ops - SPI NOR controller driver specific | |
| 472 | + * operations. | |
| 473 | + * @prepare: [OPTIONAL] do some preparations for the | |
| 474 | + * read/write/erase/lock/unlock operations. | |
| 475 | + * @unprepare: [OPTIONAL] do some post work after the | |
| 476 | + * read/write/erase/lock/unlock operations. | |
| 477 | + * @read_reg: read out the register. | |
| 478 | + * @write_reg: write data to the register. | |
| 479 | + * @read: read data from the SPI NOR. | |
| 480 | + * @write: write data to the SPI NOR. | |
| 481 | + * @erase: erase a sector of the SPI NOR at the offset @offs; if | |
| 482 | + * not provided by the driver, spi-nor will send the erase | |
| 483 | + * opcode via write_reg(). | |
| 484 | + */ | |
| 485 | +struct spi_nor_controller_ops { | |
| 486 | + int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops); | |
| 487 | + void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops); | |
| 488 | + int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, size_t len); | |
| 489 | + int (*write_reg)(struct spi_nor *nor, u8 opcode, const u8 *buf, | |
| 490 | + size_t len); | |
| 491 | + | |
| 492 | + ssize_t (*read)(struct spi_nor *nor, loff_t from, size_t len, u8 *buf); | |
| 493 | + ssize_t (*write)(struct spi_nor *nor, loff_t to, size_t len, | |
| 494 | + const u8 *buf); | |
| 495 | + int (*erase)(struct spi_nor *nor, loff_t offs); | |
| 496 | +}; | |
| 497 | + | |
| 468 | 498 | /** |
| 469 | 499 | * struct spi_nor_locking_ops - SPI NOR locking methods |
| 470 | 500 | * @lock: lock a region of the SPI NOR. |
| @@ -549,19 +579,7 @@ struct flash_info; · 78 unmodified lines | ||
| 549 | 579 | * @read_proto: the SPI protocol for read operations |
| 550 | 580 | * @write_proto: the SPI protocol for write operations |
| 551 | 581 | * @reg_proto the SPI protocol for read_reg/write_reg/erase operations |
| 552 | − * @prepare: [OPTIONAL] do some preparations for the | |
| 553 | − * read/write/erase/lock/unlock operations | |
| 554 | − * @unprepare: [OPTIONAL] do some post work after the | |
| 555 | − * read/write/erase/lock/unlock operations | |
| 556 | − * @read_reg: [DRIVER-SPECIFIC] read out the register | |
| 557 | − * @write_reg: [DRIVER-SPECIFIC] write data to the register | |
| 558 | − * @read: [DRIVER-SPECIFIC] read data from the SPI NOR | |
| 559 | − * @write: [DRIVER-SPECIFIC] write data to the SPI NOR | |
| 560 | − * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR | |
| 561 | − * at the offset @offs; if not provided by the driver, | |
| 562 | − * spi-nor will send the erase opcode via write_reg() | |
| 563 | − * @clear_sr_bp: [FLASH-SPECIFIC] clears the Block Protection Bits from | |
| 564 | − * the SPI NOR Status Register. | |
| 582 | + * @controller_ops: SPI NOR controller driver specific operations. | |
| 565 | 583 | * @params: [FLASH-SPECIFIC] SPI-NOR flash parameters and settings. |
| 566 | 584 | * The structure includes legacy flash parameters and |
| 567 | 585 | * settings that can be overwritten by the spi_nor_fixups |
| @@ -588,18 +606,8 @@ struct spi_nor { · 20 unmodified lines | ||
| 588 | 606 | bool sst_write_second; |
| 589 | 607 | u32 flags; |
| 590 | 608 | |
| 591 | − int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops); | |
| 592 | − void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops); | |
| 593 | − int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); | |
| 594 | − int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); | |
| 595 | − | |
| 596 | − ssize_t (*read)(struct spi_nor *nor, loff_t from, | |
| 597 | − size_t len, u_char *read_buf); | |
| 598 | − ssize_t (*write)(struct spi_nor *nor, loff_t to, | |
| 599 | − size_t len, const u_char *write_buf); | |
| 600 | − int (*erase)(struct spi_nor *nor, loff_t offs); | |
| 609 | + const struct spi_nor_controller_ops *controller_ops; | |
| 601 | 610 | |
| 602 | − int (*clear_sr_bp)(struct spi_nor *nor); | |
| 603 | 611 | struct spi_nor_flash_parameter params; |
| 604 | 612 | |
| 605 | 613 | void *priv; |
| @@ -0,0 +1,60 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_MTIO_COMPAT_H | |
| 3 | +#define _LINUX_MTIO_COMPAT_H | |
| 4 | + | |
| 5 | +#include <linux/compat.h> | |
| 6 | +#include <uapi/linux/mtio.h> | |
| 7 | +#include <linux/uaccess.h> | |
| 8 | + | |
| 9 | +/* | |
| 10 | + * helper functions for implementing compat ioctls on the four tape | |
| 11 | + * drivers: we define the 32-bit layout of each incompatible structure, | |
| 12 | + * plus a wrapper function to copy it to user space in either format. | |
| 13 | + */ | |
| 14 | + | |
| 15 | +struct mtget32 { | |
| 16 | + s32 mt_type; | |
| 17 | + s32 mt_resid; | |
| 18 | + s32 mt_dsreg; | |
| 19 | + s32 mt_gstat; | |
| 20 | + s32 mt_erreg; | |
| 21 | + s32 mt_fileno; | |
| 22 | + s32 mt_blkno; | |
| 23 | +}; | |
| 24 | +#define MTIOCGET32 _IOR('m', 2, struct mtget32) | |
| 25 | + | |
| 26 | +struct mtpos32 { | |
| 27 | + s32 mt_blkno; | |
| 28 | +}; | |
| 29 | +#define MTIOCPOS32 _IOR('m', 3, struct mtpos32) | |
| 30 | + | |
| 31 | +static inline int put_user_mtget(void __user *u, struct mtget *k) | |
| 32 | +{ | |
| 33 | + struct mtget32 k32 = { | |
| 34 | + .mt_type = k->mt_type, | |
| 35 | + .mt_resid = k->mt_resid, | |
| 36 | + .mt_dsreg = k->mt_dsreg, | |
| 37 | + .mt_gstat = k->mt_gstat, | |
| 38 | + .mt_erreg = k->mt_erreg, | |
| 39 | + .mt_fileno = k->mt_fileno, | |
| 40 | + .mt_blkno = k->mt_blkno, | |
| 41 | + }; | |
| 42 | + int ret; | |
| 43 | + | |
| 44 | + if (in_compat_syscall()) | |
| 45 | + ret = copy_to_user(u, &k32, sizeof(k32)); | |
| 46 | + else | |
| 47 | + ret = copy_to_user(u, k, sizeof(*k)); | |
| 48 | + | |
| 49 | + return ret ? -EFAULT : 0; | |
| 50 | +} | |
| 51 | + | |
| 52 | +static inline int put_user_mtpos(void __user *u, struct mtpos *k) | |
| 53 | +{ | |
| 54 | + if (in_compat_syscall()) | |
| 55 | + return put_user(k->mt_blkno, (u32 __user *)u); | |
| 56 | + else | |
| 57 | + return put_user(k->mt_blkno, (long __user *)u); | |
| 58 | +} | |
| 59 | + | |
| 60 | +#endif | |
| @@ -60,6 +60,7 @@ extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int); · 59 unmodified lines | ||
| 60 | 60 | extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int); |
| 61 | 61 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
| 62 | 62 | extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int); |
| 63 | +extern struct dentry *lookup_positive_unlocked(const char *, struct dentry *, int); | |
| 63 | 64 | |
| 64 | 65 | extern int follow_down_one(struct path *); |
| 65 | 66 | extern int follow_down(struct path *); |
| @@ -147,7 +147,7 @@ static inline int nvdimm_read_bytes(struct nd_namespace_common *ndns, · 146 unmodified lines | ||
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * nvdimm_write_bytes() - synchronously write bytes to an nvdimm namespace |
| 150 | − * @ndns: device to read | |
| 150 | + * @ndns: device to write | |
| 151 | 151 | * @offset: namespace-relative starting offset |
| 152 | 152 | * @buf: buffer to drain |
| 153 | 153 | * @size: transfer length |
| @@ -848,6 +848,7 @@ enum tc_setup_type { · 847 unmodified lines | ||
| 848 | 848 | TC_SETUP_ROOT_QDISC, |
| 849 | 849 | TC_SETUP_QDISC_GRED, |
| 850 | 850 | TC_SETUP_QDISC_TAPRIO, |
| 851 | + TC_SETUP_FT, | |
| 851 | 852 | }; |
| 852 | 853 | |
| 853 | 854 | /* These structures hold the attributes of bpf state that are being passed |
| @@ -925,6 +926,15 @@ struct dev_ifalias { · 71 unmodified lines | ||
| 925 | 926 | struct devlink; |
| 926 | 927 | struct tlsdev_ops; |
| 927 | 928 | |
| 929 | +struct netdev_name_node { | |
| 930 | + struct hlist_node hlist; | |
| 931 | + struct list_head list; | |
| 932 | + struct net_device *dev; | |
| 933 | + const char *name; | |
| 934 | +}; | |
| 935 | + | |
| 936 | +int netdev_name_node_alt_create(struct net_device *dev, const char *name); | |
| 937 | +int netdev_name_node_alt_destroy(struct net_device *dev, const char *name); | |
| 928 | 938 | |
| 929 | 939 | /* |
| 930 | 940 | * This structure defines the management hooks for network devices. |
| @@ -1317,6 +1327,10 @@ struct net_device_ops { · 386 unmodified lines | ||
| 1317 | 1327 | struct nlattr *port[]); |
| 1318 | 1328 | int (*ndo_get_vf_port)(struct net_device *dev, |
| 1319 | 1329 | int vf, struct sk_buff *skb); |
| 1330 | + int (*ndo_get_vf_guid)(struct net_device *dev, | |
| 1331 | + int vf, | |
| 1332 | + struct ifla_vf_guid *node_guid, | |
| 1333 | + struct ifla_vf_guid *port_guid); | |
| 1320 | 1334 | int (*ndo_set_vf_guid)(struct net_device *dev, |
| 1321 | 1335 | int vf, u64 guid, |
| 1322 | 1336 | int guid_type); |
| @@ -1564,7 +1578,7 @@ enum netdev_priv_flags { · 241 unmodified lines | ||
| 1564 | 1578 | * (i.e. as seen by users in the "Space.c" file). It is the name |
| 1565 | 1579 | * of the interface. |
| 1566 | 1580 | * |
| 1567 | − * @name_hlist: Device name hash chain, please keep it close to name[] | |
| 1581 | + * @name_node: Name hashlist node | |
| 1568 | 1582 | * @ifalias: SNMP alias |
| 1569 | 1583 | * @mem_end: Shared memory end |
| 1570 | 1584 | * @mem_start: Shared memory start |
| @@ -1761,7 +1775,7 @@ enum netdev_priv_flags { · 190 unmodified lines | ||
| 1761 | 1775 | * for hardware timestamping |
| 1762 | 1776 | * @sfp_bus: attached &struct sfp_bus structure. |
| 1763 | 1777 | * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock |
| 1764 | − spinlock | |
| 1778 | + * spinlock | |
| 1765 | 1779 | * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount |
| 1766 | 1780 | * @qdisc_xmit_lock_key: lockdep class annotating |
| 1767 | 1781 | * netdev_queue->_xmit_lock spinlock |
| @@ -1780,7 +1794,7 @@ enum netdev_priv_flags { · 12 unmodified lines | ||
| 1780 | 1794 | |
| 1781 | 1795 | struct net_device { |
| 1782 | 1796 | char name[IFNAMSIZ]; |
| 1783 | − struct hlist_node name_hlist; | |
| 1797 | + struct netdev_name_node *name_node; | |
| 1784 | 1798 | struct dev_ifalias __rcu *ifalias; |
| 1785 | 1799 | /* |
| 1786 | 1800 | * I/O specific fields |
| @@ -1867,6 +1881,11 @@ struct net_device { · 80 unmodified lines | ||
| 1867 | 1881 | unsigned char if_port; |
| 1868 | 1882 | unsigned char dma; |
| 1869 | 1883 | |
| 1884 | + /* Note : dev->mtu is often read without holding a lock. | |
| 1885 | + * Writers usually hold RTNL. | |
| 1886 | + * It is recommended to use READ_ONCE() to annotate the reads, | |
| 1887 | + * and to use WRITE_ONCE() to annotate the writes. | |
| 1888 | + */ | |
| 1870 | 1889 | unsigned int mtu; |
| 1871 | 1890 | unsigned int min_mtu; |
| 1872 | 1891 | unsigned int max_mtu; |
| @@ -2387,11 +2406,23 @@ struct pcpu_sw_netstats { · 514 unmodified lines | ||
| 2387 | 2406 | } __aligned(4 * sizeof(u64)); |
| 2388 | 2407 | |
| 2389 | 2408 | struct pcpu_lstats { |
| 2390 | − u64 packets; | |
| 2391 | − u64 bytes; | |
| 2409 | + u64_stats_t packets; | |
| 2410 | + u64_stats_t bytes; | |
| 2392 | 2411 | struct u64_stats_sync syncp; |
| 2393 | 2412 | } __aligned(2 * sizeof(u64)); |
| 2394 | 2413 | |
| 2414 | +void dev_lstats_read(struct net_device *dev, u64 *packets, u64 *bytes); | |
| 2415 | + | |
| 2416 | +static inline void dev_lstats_add(struct net_device *dev, unsigned int len) | |
| 2417 | +{ | |
| 2418 | + struct pcpu_lstats *lstats = this_cpu_ptr(dev->lstats); | |
| 2419 | + | |
| 2420 | + u64_stats_update_begin(&lstats->syncp); | |
| 2421 | + u64_stats_add(&lstats->bytes, len); | |
| 2422 | + u64_stats_inc(&lstats->packets); | |
| 2423 | + u64_stats_update_end(&lstats->syncp); | |
| 2424 | +} | |
| 2425 | + | |
| 2395 | 2426 | #define __netdev_alloc_pcpu_stats(type, gfp) \ |
| 2396 | 2427 | ({ \ |
| 2397 | 2428 | typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\ |
| @@ -2487,6 +2518,9 @@ const char *netdev_cmd_to_name(enum netdev_cmd cmd); · 89 unmodified lines | ||
| 2487 | 2518 | |
| 2488 | 2519 | int register_netdevice_notifier(struct notifier_block *nb); |
| 2489 | 2520 | int unregister_netdevice_notifier(struct notifier_block *nb); |
| 2521 | +int register_netdevice_notifier_net(struct net *net, struct notifier_block *nb); | |
| 2522 | +int unregister_netdevice_notifier_net(struct net *net, | |
| 2523 | + struct notifier_block *nb); | |
| 2490 | 2524 | |
| 2491 | 2525 | struct netdev_notifier_info { |
| 2492 | 2526 | struct net_device *dev; |
| @@ -2557,6 +2591,9 @@ extern rwlock_t dev_base_lock; /* Device list lock */ · 64 unmodified lines | ||
| 2557 | 2591 | list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) |
| 2558 | 2592 | #define for_each_netdev_continue(net, d) \ |
| 2559 | 2593 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) |
| 2594 | +#define for_each_netdev_continue_reverse(net, d) \ | |
| 2595 | + list_for_each_entry_continue_reverse(d, &(net)->dev_base_head, \ | |
| 2596 | + dev_list) | |
| 2560 | 2597 | #define for_each_netdev_continue_rcu(net, d) \ |
| 2561 | 2598 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) |
| 2562 | 2599 | #define for_each_netdev_in_bond_rcu(bond, slave) \ |
| @@ -4081,9 +4118,6 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, · 1518 unmodified lines | ||
| 4081 | 4118 | unsigned char name_assign_type, |
| 4082 | 4119 | void (*setup)(struct net_device *), |
| 4083 | 4120 | unsigned int txqs, unsigned int rxqs); |
| 4084 | −int dev_get_valid_name(struct net *net, struct net_device *dev, | |
| 4085 | − const char *name); | |
| 4086 | − | |
| 4087 | 4121 | #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ |
| 4088 | 4122 | alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1) |
| 4089 | 4123 | |
| @@ -199,6 +199,8 @@ extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; · 198 unmodified lines | ||
| 199 | 199 | int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state, |
| 200 | 200 | const struct nf_hook_entries *e, unsigned int i); |
| 201 | 201 | |
| 202 | +void nf_hook_slow_list(struct list_head *head, struct nf_hook_state *state, | |
| 203 | + const struct nf_hook_entries *e); | |
| 202 | 204 | /** |
| 203 | 205 | * nf_hook - call a netfilter hook |
| 204 | 206 | * |
| @@ -311,17 +313,36 @@ NF_HOOK_LIST(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, · 106 unmodified lines | ||
| 311 | 313 | struct list_head *head, struct net_device *in, struct net_device *out, |
| 312 | 314 | int (*okfn)(struct net *, struct sock *, struct sk_buff *)) |
| 313 | 315 | { |
| 314 | − struct sk_buff *skb, *next; | |
| 315 | − struct list_head sublist; | |
| 316 | − | |
| 317 | − INIT_LIST_HEAD(&sublist); | |
| 318 | − list_for_each_entry_safe(skb, next, head, list) { | |
| 319 | − list_del(&skb->list); | |
| 320 | − if (nf_hook(pf, hook, net, sk, skb, in, out, okfn) == 1) | |
| 321 | − list_add_tail(&skb->list, &sublist); | |
| 316 | + struct nf_hook_entries *hook_head = NULL; | |
| 317 | + | |
| 318 | +#ifdef CONFIG_JUMP_LABEL | |
| 319 | + if (__builtin_constant_p(pf) && | |
| 320 | + __builtin_constant_p(hook) && | |
| 321 | + !static_key_false(&nf_hooks_needed[pf][hook])) | |
| 322 | + return; | |
| 323 | +#endif | |
| 324 | + | |
| 325 | + rcu_read_lock(); | |
| 326 | + switch (pf) { | |
| 327 | + case NFPROTO_IPV4: | |
| 328 | + hook_head = rcu_dereference(net->nf.hooks_ipv4[hook]); | |
| 329 | + break; | |
| 330 | + case NFPROTO_IPV6: | |
| 331 | + hook_head = rcu_dereference(net->nf.hooks_ipv6[hook]); | |
| 332 | + break; | |
| 333 | + default: | |
| 334 | + WARN_ON_ONCE(1); | |
| 335 | + break; | |
| 322 | 336 | } |
| 323 | − /* Put passed packets back on main list */ | |
| 324 | − list_splice(&sublist, head); | |
| 337 | + | |
| 338 | + if (hook_head) { | |
| 339 | + struct nf_hook_state state; | |
| 340 | + | |
| 341 | + nf_hook_state_init(&state, hook, pf, in, out, sk, net, okfn); | |
| 342 | + | |
| 343 | + nf_hook_slow_list(head, &state, hook_head); | |
| 344 | + } | |
| 345 | + rcu_read_unlock(); | |
| 325 | 346 | } |
| 326 | 347 | |
| 327 | 348 | /* Call setsockopt() */ |
| @@ -269,34 +269,15 @@ ip_set_ext_destroy(struct ip_set *set, void *data) · 268 unmodified lines | ||
| 269 | 269 | /* Check that the extension is enabled for the set and |
| 270 | 270 | * call it's destroy function for its extension part in data. |
| 271 | 271 | */ |
| 272 | − if (SET_WITH_COMMENT(set)) | |
| 273 | − ip_set_extensions[IPSET_EXT_ID_COMMENT].destroy( | |
| 274 | − set, ext_comment(data, set)); | |
| 275 | −} | |
| 272 | + if (SET_WITH_COMMENT(set)) { | |
| 273 | + struct ip_set_comment *c = ext_comment(data, set); | |
| 276 | 274 | |
| 277 | −static inline int | |
| 278 | −ip_set_put_flags(struct sk_buff *skb, struct ip_set *set) | |
| 279 | −{ | |
| 280 | − u32 cadt_flags = 0; | |
| 281 | − | |
| 282 | − if (SET_WITH_TIMEOUT(set)) | |
| 283 | − if (unlikely(nla_put_net32(skb, IPSET_ATTR_TIMEOUT, | |
| 284 | − htonl(set->timeout)))) | |
| 285 | − return -EMSGSIZE; | |
| 286 | − if (SET_WITH_COUNTER(set)) | |
| 287 | − cadt_flags |= IPSET_FLAG_WITH_COUNTERS; | |
| 288 | − if (SET_WITH_COMMENT(set)) | |
| 289 | − cadt_flags |= IPSET_FLAG_WITH_COMMENT; | |
| 290 | − if (SET_WITH_SKBINFO(set)) | |
| 291 | − cadt_flags |= IPSET_FLAG_WITH_SKBINFO; | |
| 292 | − if (SET_WITH_FORCEADD(set)) | |
| 293 | − cadt_flags |= IPSET_FLAG_WITH_FORCEADD; | |
| 294 | − | |
| 295 | − if (!cadt_flags) | |
| 296 | − return 0; | |
| 297 | − return nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(cadt_flags)); | |
| 275 | + ip_set_extensions[IPSET_EXT_ID_COMMENT].destroy(set, c); | |
| 276 | + } | |
| 298 | 277 | } |
| 299 | 278 | |
| 279 | +int ip_set_put_flags(struct sk_buff *skb, struct ip_set *set); | |
| 280 | + | |
| 300 | 281 | /* Netlink CB args */ |
| 301 | 282 | enum { |
| 302 | 283 | IPSET_CB_NET = 0, /* net namespace */ |
| @@ -506,144 +487,8 @@ ip_set_timeout_set(unsigned long *timeout, u32 value) · 203 unmodified lines | ||
| 506 | 487 | *timeout = t; |
| 507 | 488 | } |
| 508 | 489 | |
| 509 | −static inline u32 | |
| 510 | −ip_set_timeout_get(const unsigned long *timeout) | |
| 511 | −{ | |
| 512 | − u32 t; | |
| 513 | − | |
| 514 | − if (*timeout == IPSET_ELEM_PERMANENT) | |
| 515 | − return 0; | |
| 516 | − | |
| 517 | − t = jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC; | |
| 518 | − /* Zero value in userspace means no timeout */ | |
| 519 | − return t == 0 ? 1 : t; | |
| 520 | −} | |
| 521 | − | |
| 522 | −static inline char* | |
| 523 | −ip_set_comment_uget(struct nlattr *tb) | |
| 524 | −{ | |
| 525 | − return nla_data(tb); | |
| 526 | −} | |
| 527 | − | |
| 528 | −/* Called from uadd only, protected by the set spinlock. | |
| 529 | − * The kadt functions don't use the comment extensions in any way. | |
| 530 | − */ | |
| 531 | −static inline void | |
| 532 | −ip_set_init_comment(struct ip_set *set, struct ip_set_comment *comment, | |
| 533 | − const struct ip_set_ext *ext) | |
| 534 | −{ | |
| 535 | − struct ip_set_comment_rcu *c = rcu_dereference_protected(comment->c, 1); | |
| 536 | − size_t len = ext->comment ? strlen(ext->comment) : 0; | |
| 537 | − | |
| 538 | − if (unlikely(c)) { | |
| 539 | − set->ext_size -= sizeof(*c) + strlen(c->str) + 1; | |
| 540 | − kfree_rcu(c, rcu); | |
| 541 | − rcu_assign_pointer(comment->c, NULL); | |
| 542 | − } | |
| 543 | − if (!len) | |
| 544 | − return; | |
| 545 | − if (unlikely(len > IPSET_MAX_COMMENT_SIZE)) | |
| 546 | − len = IPSET_MAX_COMMENT_SIZE; | |
| 547 | − c = kmalloc(sizeof(*c) + len + 1, GFP_ATOMIC); | |
| 548 | − if (unlikely(!c)) | |
| 549 | − return; | |
| 550 | − strlcpy(c->str, ext->comment, len + 1); | |
| 551 | − set->ext_size += sizeof(*c) + strlen(c->str) + 1; | |
| 552 | − rcu_assign_pointer(comment->c, c); | |
| 553 | −} | |
| 554 | − | |
| 555 | −/* Used only when dumping a set, protected by rcu_read_lock() */ | |
| 556 | −static inline int | |
| 557 | −ip_set_put_comment(struct sk_buff *skb, const struct ip_set_comment *comment) | |
| 558 | −{ | |
| 559 | − struct ip_set_comment_rcu *c = rcu_dereference(comment->c); | |
| 560 | − | |
| 561 | − if (!c) | |
| 562 | − return 0; | |
| 563 | − return nla_put_string(skb, IPSET_ATTR_COMMENT, c->str); | |
| 564 | −} | |
| 565 | − | |
| 566 | −/* Called from uadd/udel, flush or the garbage collectors protected | |
| 567 | − * by the set spinlock. | |
| 568 | − * Called when the set is destroyed and when there can't be any user | |
| 569 | − * of the set data anymore. | |
| 570 | − */ | |
| 571 | −static inline void | |
| 572 | −ip_set_comment_free(struct ip_set *set, struct ip_set_comment *comment) | |
| 573 | −{ | |
| 574 | − struct ip_set_comment_rcu *c; | |
| 575 | − | |
| 576 | − c = rcu_dereference_protected(comment->c, 1); | |
| 577 | − if (unlikely(!c)) | |
| 578 | − return; | |
| 579 | − set->ext_size -= sizeof(*c) + strlen(c->str) + 1; | |
| 580 | − kfree_rcu(c, rcu); | |
| 581 | − rcu_assign_pointer(comment->c, NULL); | |
| 582 | −} | |
| 583 | − | |
| 584 | −static inline void | |
| 585 | −ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter) | |
| 586 | −{ | |
| 587 | − atomic64_add((long long)bytes, &(counter)->bytes); | |
| 588 | −} | |
| 589 | − | |
| 590 | −static inline void | |
| 591 | −ip_set_add_packets(u64 packets, struct ip_set_counter *counter) | |
| 592 | −{ | |
| 593 | − atomic64_add((long long)packets, &(counter)->packets); | |
| 594 | −} | |
| 595 | − | |
| 596 | −static inline u64 | |
| 597 | −ip_set_get_bytes(const struct ip_set_counter *counter) | |
| 598 | −{ | |
| 599 | − return (u64)atomic64_read(&(counter)->bytes); | |
| 600 | −} | |
| 601 | − | |
| 602 | −static inline u64 | |
| 603 | −ip_set_get_packets(const struct ip_set_counter *counter) | |
| 604 | −{ | |
| 605 | − return (u64)atomic64_read(&(counter)->packets); | |
| 606 | −} | |
| 607 | − | |
| 608 | −static inline bool | |
| 609 | −ip_set_match_counter(u64 counter, u64 match, u8 op) | |
| 610 | −{ | |
| 611 | − switch (op) { | |
| 612 | − case IPSET_COUNTER_NONE: | |
| 613 | − return true; | |
| 614 | − case IPSET_COUNTER_EQ: | |
| 615 | − return counter == match; | |
| 616 | − case IPSET_COUNTER_NE: | |
| 617 | − return counter != match; | |
| 618 | − case IPSET_COUNTER_LT: | |
| 619 | − return counter < match; | |
| 620 | − case IPSET_COUNTER_GT: | |
| 621 | − return counter > match; | |
| 622 | − } | |
| 623 | − return false; | |
| 624 | −} | |
| 625 | − | |
| 626 | −static inline void | |
| 627 | −ip_set_update_counter(struct ip_set_counter *counter, | |
| 628 | − const struct ip_set_ext *ext, u32 flags) | |
| 629 | −{ | |
| 630 | − if (ext->packets != ULLONG_MAX && | |
| 631 | − !(flags & IPSET_FLAG_SKIP_COUNTER_UPDATE)) { | |
| 632 | − ip_set_add_bytes(ext->bytes, counter); | |
| 633 | − ip_set_add_packets(ext->packets, counter); | |
| 634 | − } | |
| 635 | −} | |
| 636 | − | |
| 637 | −static inline bool | |
| 638 | −ip_set_put_counter(struct sk_buff *skb, const struct ip_set_counter *counter) | |
| 639 | −{ | |
| 640 | − return nla_put_net64(skb, IPSET_ATTR_BYTES, | |
| 641 | − cpu_to_be64(ip_set_get_bytes(counter)), | |
| 642 | − IPSET_ATTR_PAD) || | |
| 643 | − nla_put_net64(skb, IPSET_ATTR_PACKETS, | |
| 644 | − cpu_to_be64(ip_set_get_packets(counter)), | |
| 645 | − IPSET_ATTR_PAD); | |
| 646 | −} | |
| 490 | +void ip_set_init_comment(struct ip_set *set, struct ip_set_comment *comment, | |
| 491 | + const struct ip_set_ext *ext); | |
| 647 | 492 | |
| 648 | 493 | static inline void |
| 649 | 494 | ip_set_init_counter(struct ip_set_counter *counter, |
| @@ -655,31 +500,6 @@ ip_set_init_counter(struct ip_set_counter *counter, · 5 unmodified lines | ||
| 655 | 500 | atomic64_set(&(counter)->packets, (long long)(ext->packets)); |
| 656 | 501 | } |
| 657 | 502 | |
| 658 | −static inline void | |
| 659 | −ip_set_get_skbinfo(struct ip_set_skbinfo *skbinfo, | |
| 660 | − const struct ip_set_ext *ext, | |
| 661 | − struct ip_set_ext *mext, u32 flags) | |
| 662 | −{ | |
| 663 | − mext->skbinfo = *skbinfo; | |
| 664 | −} | |
| 665 | − | |
| 666 | −static inline bool | |
| 667 | −ip_set_put_skbinfo(struct sk_buff *skb, const struct ip_set_skbinfo *skbinfo) | |
| 668 | −{ | |
| 669 | − /* Send nonzero parameters only */ | |
| 670 | − return ((skbinfo->skbmark || skbinfo->skbmarkmask) && | |
| 671 | − nla_put_net64(skb, IPSET_ATTR_SKBMARK, | |
| 672 | − cpu_to_be64((u64)skbinfo->skbmark << 32 | | |
| 673 | − skbinfo->skbmarkmask), | |
| 674 | − IPSET_ATTR_PAD)) || | |
| 675 | − (skbinfo->skbprio && | |
| 676 | − nla_put_net32(skb, IPSET_ATTR_SKBPRIO, | |
| 677 | − cpu_to_be32(skbinfo->skbprio))) || | |
| 678 | − (skbinfo->skbqueue && | |
| 679 | − nla_put_net16(skb, IPSET_ATTR_SKBQUEUE, | |
| 680 | − cpu_to_be16(skbinfo->skbqueue))); | |
| 681 | −} | |
| 682 | − | |
| 683 | 503 | static inline void |
| 684 | 504 | ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo, |
| 685 | 505 | const struct ip_set_ext *ext) |
| @@ -12,18 +12,4 @@ enum { · 11 unmodified lines | ||
| 12 | 12 | IPSET_ADD_START_STORED_TIMEOUT, |
| 13 | 13 | }; |
| 14 | 14 | |
| 15 | −/* Common functions */ | |
| 16 | − | |
| 17 | −static inline u32 | |
| 18 | −range_to_mask(u32 from, u32 to, u8 *bits) | |
| 19 | −{ | |
| 20 | − u32 mask = 0xFFFFFFFE; | |
| 21 | − | |
| 22 | − *bits = 32; | |
| 23 | − while (--(*bits) > 0 && mask && (to & mask) != from) | |
| 24 | − mask <<= 1; | |
| 25 | − | |
| 26 | − return mask; | |
| 27 | −} | |
| 28 | − | |
| 29 | 15 | #endif /* __IP_SET_BITMAP_H */ |
| @@ -20,9 +20,6 @@ static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src, · 19 unmodified lines | ||
| 20 | 20 | } |
| 21 | 21 | #endif |
| 22 | 22 | |
| 23 | −extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, | |
| 24 | − __be16 *port); | |
| 25 | − | |
| 26 | 23 | static inline bool ip_set_proto_with_ports(u8 proto) |
| 27 | 24 | { |
| 28 | 25 | switch (proto) { |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/list.h> |
| 17 | 17 | #include <linux/uidgid.h> |
| 18 | 18 | #include <uapi/linux/nfs4.h> |
| 19 | +#include <linux/sunrpc/msg_prot.h> | |
| 19 | 20 | |
| 20 | 21 | enum nfs4_acl_whotype { |
| 21 | 22 | NFS4_ACL_WHO_NAMED = 0, |
| @@ -539,6 +540,8 @@ enum { · 517 unmodified lines | ||
| 539 | 540 | |
| 540 | 541 | NFSPROC4_CLNT_LOOKUPP, |
| 541 | 542 | NFSPROC4_CLNT_LAYOUTERROR, |
| 543 | + | |
| 544 | + NFSPROC4_CLNT_COPY_NOTIFY, | |
| 542 | 545 | }; |
| 543 | 546 | |
| 544 | 547 | /* nfs41 types */ |
| @@ -674,4 +677,27 @@ struct nfs4_op_map { · 129 unmodified lines | ||
| 674 | 677 | } u; |
| 675 | 678 | }; |
| 676 | 679 | |
| 680 | +struct nfs42_netaddr { | |
| 681 | + char netid[RPCBIND_MAXNETIDLEN]; | |
| 682 | + char addr[RPCBIND_MAXUADDRLEN + 1]; | |
| 683 | + u32 netid_len; | |
| 684 | + u32 addr_len; | |
| 685 | +}; | |
| 686 | + | |
| 687 | +enum netloc_type4 { | |
| 688 | + NL4_NAME = 1, | |
| 689 | + NL4_URL = 2, | |
| 690 | + NL4_NETADDR = 3, | |
| 691 | +}; | |
| 692 | + | |
| 693 | +struct nl4_server { | |
| 694 | + enum netloc_type4 nl4_type; | |
| 695 | + union { | |
| 696 | + struct { /* NL4_NAME, NL4_URL */ | |
| 697 | + int nl4_str_sz; | |
| 698 | + char nl4_str[NFS4_OPAQUE_LIMIT + 1]; | |
| 699 | + }; | |
| 700 | + struct nfs42_netaddr nl4_addr; /* NL4_NETADDR */ | |
| 701 | + } u; | |
| 702 | +}; | |
| 677 | 703 | #endif |
| @@ -189,13 +189,15 @@ struct nfs_inode { · 188 unmodified lines | ||
| 189 | 189 | |
| 190 | 190 | struct nfs4_copy_state { |
| 191 | 191 | struct list_head copies; |
| 192 | + struct list_head src_copies; | |
| 192 | 193 | nfs4_stateid stateid; |
| 193 | 194 | struct completion completion; |
| 194 | 195 | uint64_t count; |
| 195 | 196 | struct nfs_writeverf verf; |
| 196 | 197 | int error; |
| 197 | 198 | int flags; |
| 198 | − struct nfs4_state *parent_state; | |
| 199 | + struct nfs4_state *parent_src_state; | |
| 200 | + struct nfs4_state *parent_dst_state; | |
| 199 | 201 | }; |
| 200 | 202 | |
| 201 | 203 | /* |
| @@ -45,6 +45,9 @@ struct nfs_client { · 44 unmodified lines | ||
| 45 | 45 | #define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ |
| 46 | 46 | #define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */ |
| 47 | 47 | #define NFS_CS_TSM_POSSIBLE 5 /* - Maybe state migration */ |
| 48 | +#define NFS_CS_NOPING 6 /* - don't ping on connect */ | |
| 49 | +#define NFS_CS_DS 7 /* - Server is a DS */ | |
| 50 | +#define NFS_CS_REUSEPORT 8 /* - reuse src port on reconnect */ | |
| 48 | 51 | struct sockaddr_storage cl_addr; /* server identifier */ |
| 49 | 52 | size_t cl_addrlen; |
| 50 | 53 | char * cl_hostname; /* hostname of server */ |
| @@ -171,7 +174,7 @@ struct nfs_server { · 120 unmodified lines | ||
| 171 | 174 | |
| 172 | 175 | struct nfs_fsid fsid; |
| 173 | 176 | __u64 maxfilesize; /* maximum file size */ |
| 174 | − struct timespec time_delta; /* smallest time granularity */ | |
| 177 | + struct timespec64 time_delta; /* smallest time granularity */ | |
| 175 | 178 | unsigned long mount_time; /* when this fs was mounted */ |
| 176 | 179 | struct super_block *super; /* VFS super block */ |
| 177 | 180 | dev_t s_dev; /* superblock dev numbers */ |
| @@ -276,5 +279,6 @@ struct nfs_server { · 98 unmodified lines | ||
| 276 | 279 | #define NFS_CAP_COPY (1U << 24) |
| 277 | 280 | #define NFS_CAP_OFFLOAD_CANCEL (1U << 25) |
| 278 | 281 | #define NFS_CAP_LAYOUTERROR (1U << 26) |
| 282 | +#define NFS_CAP_COPY_NOTIFY (1U << 27) | |
| 279 | 283 | |
| 280 | 284 | #endif |
| @@ -62,14 +62,14 @@ struct nfs_fattr { · 61 unmodified lines | ||
| 62 | 62 | struct nfs_fsid fsid; |
| 63 | 63 | __u64 fileid; |
| 64 | 64 | __u64 mounted_on_fileid; |
| 65 | − struct timespec atime; | |
| 66 | − struct timespec mtime; | |
| 67 | − struct timespec ctime; | |
| 65 | + struct timespec64 atime; | |
| 66 | + struct timespec64 mtime; | |
| 67 | + struct timespec64 ctime; | |
| 68 | 68 | __u64 change_attr; /* NFSv4 change attribute */ |
| 69 | 69 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ |
| 70 | 70 | __u64 pre_size; /* pre_op_attr.size */ |
| 71 | − struct timespec pre_mtime; /* pre_op_attr.mtime */ | |
| 72 | − struct timespec pre_ctime; /* pre_op_attr.ctime */ | |
| 71 | + struct timespec64 pre_mtime; /* pre_op_attr.mtime */ | |
| 72 | + struct timespec64 pre_ctime; /* pre_op_attr.ctime */ | |
| 73 | 73 | unsigned long time_start; |
| 74 | 74 | unsigned long gencount; |
| 75 | 75 | struct nfs4_string *owner_name; |
| @@ -143,7 +143,7 @@ struct nfs_fsinfo { · 67 unmodified lines | ||
| 143 | 143 | __u32 wtmult; /* writes should be multiple of this */ |
| 144 | 144 | __u32 dtpref; /* pref. readdir transfer size */ |
| 145 | 145 | __u64 maxfilesize; |
| 146 | − struct timespec time_delta; /* server time granularity */ | |
| 146 | + struct timespec64 time_delta; /* server time granularity */ | |
| 147 | 147 | __u32 lease_time; /* in seconds */ |
| 148 | 148 | __u32 nlayouttypes; /* number of layouttypes */ |
| 149 | 149 | __u32 layouttype[NFS_MAX_LAYOUT_TYPES]; /* supported pnfs layout driver */ |
| @@ -869,7 +869,7 @@ struct nfs3_sattrargs { · 719 unmodified lines | ||
| 869 | 869 | struct nfs_fh * fh; |
| 870 | 870 | struct iattr * sattr; |
| 871 | 871 | unsigned int guard; |
| 872 | − struct timespec guardtime; | |
| 872 | + struct timespec64 guardtime; | |
| 873 | 873 | }; |
| 874 | 874 | |
| 875 | 875 | struct nfs3_diropargs { |
| @@ -1435,6 +1435,7 @@ struct nfs42_copy_args { · 559 unmodified lines | ||
| 1435 | 1435 | |
| 1436 | 1436 | u64 count; |
| 1437 | 1437 | bool sync; |
| 1438 | + struct nl4_server *cp_src; | |
| 1438 | 1439 | }; |
| 1439 | 1440 | |
| 1440 | 1441 | struct nfs42_write_res { |
| @@ -1463,6 +1464,22 @@ struct nfs42_offload_status_res { · 22 unmodified lines | ||
| 1463 | 1464 | int osr_status; |
| 1464 | 1465 | }; |
| 1465 | 1466 | |
| 1467 | +struct nfs42_copy_notify_args { | |
| 1468 | + struct nfs4_sequence_args cna_seq_args; | |
| 1469 | + | |
| 1470 | + struct nfs_fh *cna_src_fh; | |
| 1471 | + nfs4_stateid cna_src_stateid; | |
| 1472 | + struct nl4_server cna_dst; | |
| 1473 | +}; | |
| 1474 | + | |
| 1475 | +struct nfs42_copy_notify_res { | |
| 1476 | + struct nfs4_sequence_res cnr_seq_res; | |
| 1477 | + | |
| 1478 | + struct nfstime4 cnr_lease_time; | |
| 1479 | + nfs4_stateid cnr_stateid; | |
| 1480 | + struct nl4_server cnr_src; | |
| 1481 | +}; | |
| 1482 | + | |
| 1466 | 1483 | struct nfs42_seek_args { |
| 1467 | 1484 | struct nfs4_sequence_args seq_args; |
| 1468 | 1485 | |
| @@ -150,10 +150,6 @@ extern int raw_notifier_chain_register(struct raw_notifier_head *nh, · 149 unmodified lines | ||
| 150 | 150 | extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, |
| 151 | 151 | struct notifier_block *nb); |
| 152 | 152 | |
| 153 | −extern int blocking_notifier_chain_cond_register( | |
| 154 | − struct blocking_notifier_head *nh, | |
| 155 | − struct notifier_block *nb); | |
| 156 | − | |
| 157 | 153 | extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, |
| 158 | 154 | struct notifier_block *nb); |
| 159 | 155 | extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, |
| @@ -270,6 +270,8 @@ struct nvme_fc_remote_port { · 269 unmodified lines | ||
| 270 | 270 | * |
| 271 | 271 | * Host/Initiator Transport Entrypoints/Parameters: |
| 272 | 272 | * |
| 273 | + * @module: The LLDD module using the interface | |
| 274 | + * | |
| 273 | 275 | * @localport_delete: The LLDD initiates deletion of a localport via |
| 274 | 276 | * nvme_fc_deregister_localport(). However, the teardown is |
| 275 | 277 | * asynchronous. This routine is called upon the completion of the |
| @@ -383,6 +385,8 @@ struct nvme_fc_remote_port { · 107 unmodified lines | ||
| 383 | 385 | * Value is Mandatory. Allowed to be zero. |
| 384 | 386 | */ |
| 385 | 387 | struct nvme_fc_port_template { |
| 388 | + struct module *module; | |
| 389 | + | |
| 386 | 390 | /* initiator-based functions */ |
| 387 | 391 | void (*localport_delete)(struct nvme_fc_local_port *); |
| 388 | 392 | void (*remoteport_delete)(struct nvme_fc_remote_port *); |
| @@ -4,33 +4,60 @@ · 3 unmodified lines | ||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | /* |
| 7 | − * This file contains definitions relative to FC-NVME r1.14 (16-020vB). | |
| 8 | − * The fcnvme_lsdesc_cr_assoc_cmd struct reflects expected r1.16 content. | |
| 7 | + * This file contains definitions relative to FC-NVME-2 r1.06 | |
| 8 | + * (T11-2019-00210-v001). | |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | #ifndef _NVME_FC_H |
| 12 | 12 | #define _NVME_FC_H 1 |
| 13 | 13 | |
| 14 | +#include <uapi/scsi/fc/fc_fs.h> | |
| 14 | 15 | |
| 15 | −#define NVME_CMD_SCSI_ID 0xFD | |
| 16 | +#define NVME_CMD_FORMAT_ID 0xFD | |
| 16 | 17 | #define NVME_CMD_FC_ID FC_TYPE_NVME |
| 17 | 18 | |
| 18 | 19 | /* FC-NVME Cmd IU Flags */ |
| 19 | −#define FCNVME_CMD_FLAGS_DIRMASK 0x03 | |
| 20 | −#define FCNVME_CMD_FLAGS_WRITE 0x01 | |
| 21 | −#define FCNVME_CMD_FLAGS_READ 0x02 | |
| 20 | +enum { | |
| 21 | + FCNVME_CMD_FLAGS_DIRMASK = 0x03, | |
| 22 | + FCNVME_CMD_FLAGS_WRITE = (1 << 0), | |
| 23 | + FCNVME_CMD_FLAGS_READ = (1 << 1), | |
| 24 | + | |
| 25 | + FCNVME_CMD_FLAGS_PICWP = (1 << 2), | |
| 26 | +}; | |
| 27 | + | |
| 28 | +enum { | |
| 29 | + FCNVME_CMD_CAT_MASK = 0x0F, | |
| 30 | + FCNVME_CMD_CAT_ADMINQ = 0x01, | |
| 31 | + FCNVME_CMD_CAT_CSSMASK = 0x07, | |
| 32 | + FCNVME_CMD_CAT_CSSFLAG = 0x08, | |
| 33 | +}; | |
| 34 | + | |
| 35 | +static inline __u8 fccmnd_set_cat_admin(__u8 rsv_cat) | |
| 36 | +{ | |
| 37 | + return (rsv_cat & ~FCNVME_CMD_CAT_MASK) | FCNVME_CMD_CAT_ADMINQ; | |
| 38 | +} | |
| 39 | + | |
| 40 | +static inline __u8 fccmnd_set_cat_css(__u8 rsv_cat, __u8 css) | |
| 41 | +{ | |
| 42 | + return (rsv_cat & ~FCNVME_CMD_CAT_MASK) | FCNVME_CMD_CAT_CSSFLAG | | |
| 43 | + (css & FCNVME_CMD_CAT_CSSMASK); | |
| 44 | +} | |
| 22 | 45 | |
| 23 | 46 | struct nvme_fc_cmd_iu { |
| 24 | − __u8 scsi_id; | |
| 47 | + __u8 format_id; | |
| 25 | 48 | __u8 fc_id; |
| 26 | 49 | __be16 iu_len; |
| 27 | − __u8 rsvd4[3]; | |
| 50 | + __u8 rsvd4[2]; | |
| 51 | + __u8 rsv_cat; | |
| 28 | 52 | __u8 flags; |
| 29 | 53 | __be64 connection_id; |
| 30 | 54 | __be32 csn; |
| 31 | 55 | __be32 data_len; |
| 32 | 56 | struct nvme_command sqe; |
| 33 | − __be32 rsvd88[2]; | |
| 57 | + __u8 dps; | |
| 58 | + __u8 lbads; | |
| 59 | + __be16 ms; | |
| 60 | + __be32 rsvd92; | |
| 34 | 61 | }; |
| 35 | 62 | |
| 36 | 63 | #define NVME_FC_SIZEOF_ZEROS_RSP 12 |
| @@ -38,11 +65,12 @@ struct nvme_fc_cmd_iu { · 1 unmodified line | ||
| 38 | 65 | enum { |
| 39 | 66 | FCNVME_SC_SUCCESS = 0, |
| 40 | 67 | FCNVME_SC_INVALID_FIELD = 1, |
| 41 | − FCNVME_SC_INVALID_CONNID = 2, | |
| 68 | + /* reserved 2 */ | |
| 69 | + FCNVME_SC_ILL_CONN_PARAMS = 3, | |
| 42 | 70 | }; |
| 43 | 71 | |
| 44 | 72 | struct nvme_fc_ersp_iu { |
| 45 | − __u8 status_code; | |
| 73 | + __u8 ersp_result; | |
| 46 | 74 | __u8 rsvd1; |
| 47 | 75 | __be16 iu_len; |
| 48 | 76 | __be32 rsn; |
| @@ -53,14 +81,44 @@ struct nvme_fc_ersp_iu { · 4 unmodified lines | ||
| 53 | 81 | }; |
| 54 | 82 | |
| 55 | 83 | |
| 56 | −/* FC-NVME Link Services */ | |
| 84 | +#define FCNVME_NVME_SR_OPCODE 0x01 | |
| 85 | + | |
| 86 | +struct nvme_fc_nvme_sr_iu { | |
| 87 | + __u8 fc_id; | |
| 88 | + __u8 opcode; | |
| 89 | + __u8 rsvd2; | |
| 90 | + __u8 retry_rctl; | |
| 91 | + __be32 rsvd4; | |
| 92 | +}; | |
| 93 | + | |
| 94 | + | |
| 95 | +enum { | |
| 96 | + FCNVME_SRSTAT_ACC = 0x0, | |
| 97 | + FCNVME_SRSTAT_INV_FCID = 0x1, | |
| 98 | + /* reserved 0x2 */ | |
| 99 | + FCNVME_SRSTAT_LOGICAL_ERR = 0x3, | |
| 100 | + FCNVME_SRSTAT_INV_QUALIF = 0x4, | |
| 101 | + FCNVME_SRSTAT_UNABL2PERFORM = 0x9, | |
| 102 | +}; | |
| 103 | + | |
| 104 | +struct nvme_fc_nvme_sr_rsp_iu { | |
| 105 | + __u8 fc_id; | |
| 106 | + __u8 opcode; | |
| 107 | + __u8 rsvd2; | |
| 108 | + __u8 status; | |
| 109 | + __be32 rsvd4; | |
| 110 | +}; | |
| 111 | + | |
| 112 | + | |
| 113 | +/* FC-NVME Link Services - LS cmd values (w0 bits 31:24) */ | |
| 57 | 114 | enum { |
| 58 | 115 | FCNVME_LS_RSVD = 0, |
| 59 | 116 | FCNVME_LS_RJT = 1, |
| 60 | 117 | FCNVME_LS_ACC = 2, |
| 61 | − FCNVME_LS_CREATE_ASSOCIATION = 3, | |
| 62 | − FCNVME_LS_CREATE_CONNECTION = 4, | |
| 63 | − FCNVME_LS_DISCONNECT = 5, | |
| 118 | + FCNVME_LS_CREATE_ASSOCIATION = 3, /* Create Association */ | |
| 119 | + FCNVME_LS_CREATE_CONNECTION = 4, /* Create I/O Connection */ | |
| 120 | + FCNVME_LS_DISCONNECT_ASSOC = 5, /* Disconnect Association */ | |
| 121 | + FCNVME_LS_DISCONNECT_CONN = 6, /* Disconnect Connection */ | |
| 64 | 122 | }; |
| 65 | 123 | |
| 66 | 124 | /* FC-NVME Link Service Descriptors */ |
| @@ -117,14 +175,17 @@ enum fcnvme_ls_rjt_reason { · 50 unmodified lines | ||
| 117 | 175 | FCNVME_RJT_RC_UNSUP = 0x0b, |
| 118 | 176 | /* command not supported */ |
| 119 | 177 | |
| 120 | − FCNVME_RJT_RC_INPROG = 0x0e, | |
| 121 | − /* command already in progress */ | |
| 122 | − | |
| 123 | 178 | FCNVME_RJT_RC_INV_ASSOC = 0x40, |
| 124 | − /* Invalid Association ID*/ | |
| 179 | + /* Invalid Association ID */ | |
| 125 | 180 | |
| 126 | 181 | FCNVME_RJT_RC_INV_CONN = 0x41, |
| 127 | − /* Invalid Connection ID*/ | |
| 182 | + /* Invalid Connection ID */ | |
| 183 | + | |
| 184 | + FCNVME_RJT_RC_INV_PARAM = 0x42, | |
| 185 | + /* Invalid Parameters */ | |
| 186 | + | |
| 187 | + FCNVME_RJT_RC_INSUF_RES = 0x43, | |
| 188 | + /* Insufficient Resources */ | |
| 128 | 189 | |
| 129 | 190 | FCNVME_RJT_RC_VENDOR = 0xff, |
| 130 | 191 | /* vendor specific error */ |
| @@ -138,14 +199,32 @@ enum fcnvme_ls_rjt_explan { · 7 unmodified lines | ||
| 138 | 199 | FCNVME_RJT_EXP_OXID_RXID = 0x17, |
| 139 | 200 | /* invalid OX_ID-RX_ID combination */ |
| 140 | 201 | |
| 141 | − FCNVME_RJT_EXP_INSUF_RES = 0x29, | |
| 142 | − /* insufficient resources */ | |
| 143 | − | |
| 144 | 202 | FCNVME_RJT_EXP_UNAB_DATA = 0x2a, |
| 145 | 203 | /* unable to supply requested data */ |
| 146 | 204 | |
| 147 | 205 | FCNVME_RJT_EXP_INV_LEN = 0x2d, |
| 148 | 206 | /* Invalid payload length */ |
| 207 | + | |
| 208 | + FCNVME_RJT_EXP_INV_ERSP_RAT = 0x40, | |
| 209 | + /* Invalid NVMe_ERSP Ratio */ | |
| 210 | + | |
| 211 | + FCNVME_RJT_EXP_INV_CTLR_ID = 0x41, | |
| 212 | + /* Invalid Controller ID */ | |
| 213 | + | |
| 214 | + FCNVME_RJT_EXP_INV_QUEUE_ID = 0x42, | |
| 215 | + /* Invalid Queue ID */ | |
| 216 | + | |
| 217 | + FCNVME_RJT_EXP_INV_SQSIZE = 0x43, | |
| 218 | + /* Invalid Submission Queue Size */ | |
| 219 | + | |
| 220 | + FCNVME_RJT_EXP_INV_HOSTID = 0x44, | |
| 221 | + /* Invalid HOST ID */ | |
| 222 | + | |
| 223 | + FCNVME_RJT_EXP_INV_HOSTNQN = 0x45, | |
| 224 | + /* Invalid HOSTNQN */ | |
| 225 | + | |
| 226 | + FCNVME_RJT_EXP_INV_SUBNQN = 0x46, | |
| 227 | + /* Invalid SUBNQN */ | |
| 149 | 228 | }; |
| 150 | 229 | |
| 151 | 230 | /* FCNVME_LSDESC_RJT */ |
| @@ -209,21 +288,11 @@ struct fcnvme_lsdesc_cr_conn_cmd { · 57 unmodified lines | ||
| 209 | 288 | __be32 rsvd52; |
| 210 | 289 | }; |
| 211 | 290 | |
| 212 | −/* Disconnect Scope Values */ | |
| 213 | −enum { | |
| 214 | − FCNVME_DISCONN_ASSOCIATION = 0, | |
| 215 | − FCNVME_DISCONN_CONNECTION = 1, | |
| 216 | −}; | |
| 217 | − | |
| 218 | 291 | /* FCNVME_LSDESC_DISCONN_CMD */ |
| 219 | 292 | struct fcnvme_lsdesc_disconn_cmd { |
| 220 | 293 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 221 | 294 | __be32 desc_len; |
| 222 | − u8 rsvd8[3]; | |
| 223 | − /* note: scope is really a 1 bit field */ | |
| 224 | − u8 scope; /* FCNVME_DISCONN_xxx */ | |
| 225 | − __be32 rsvd12; | |
| 226 | − __be64 id; | |
| 295 | + __be32 rsvd8[4]; | |
| 227 | 296 | }; |
| 228 | 297 | |
| 229 | 298 | /* FCNVME_LSDESC_CONN_ID */ |
| @@ -242,9 +311,14 @@ struct fcnvme_lsdesc_assoc_id { · 12 unmodified lines | ||
| 242 | 311 | |
| 243 | 312 | /* r_ctl values */ |
| 244 | 313 | enum { |
| 245 | − FCNVME_RS_RCTL_DATA = 1, | |
| 246 | − FCNVME_RS_RCTL_XFER_RDY = 5, | |
| 247 | − FCNVME_RS_RCTL_RSP = 8, | |
| 314 | + FCNVME_RS_RCTL_CMND = 0x6, | |
| 315 | + FCNVME_RS_RCTL_DATA = 0x1, | |
| 316 | + FCNVME_RS_RCTL_CONF = 0x3, | |
| 317 | + FCNVME_RS_RCTL_SR = 0x9, | |
| 318 | + FCNVME_RS_RCTL_XFER_RDY = 0x5, | |
| 319 | + FCNVME_RS_RCTL_RSP = 0x7, | |
| 320 | + FCNVME_RS_RCTL_ERSP = 0x8, | |
| 321 | + FCNVME_RS_RCTL_SR_RSP = 0xA, | |
| 248 | 322 | }; |
| 249 | 323 | |
| 250 | 324 | |
| @@ -264,7 +338,10 @@ struct fcnvme_ls_acc_hdr { · 13 unmodified lines | ||
| 264 | 338 | struct fcnvme_ls_rqst_w0 w0; |
| 265 | 339 | __be32 desc_list_len; |
| 266 | 340 | struct fcnvme_lsdesc_rqst rqst; |
| 267 | − /* Followed by cmd-specific ACC descriptors, see next definitions */ | |
| 341 | + /* | |
| 342 | + * Followed by cmd-specific ACCEPT descriptors, see xxx_acc | |
| 343 | + * definitions below | |
| 344 | + */ | |
| 268 | 345 | }; |
| 269 | 346 | |
| 270 | 347 | /* FCNVME_LS_CREATE_ASSOCIATION */ |
| @@ -302,25 +379,39 @@ struct fcnvme_ls_cr_conn_acc { · 31 unmodified lines | ||
| 302 | 379 | struct fcnvme_lsdesc_conn_id connectid; |
| 303 | 380 | }; |
| 304 | 381 | |
| 305 | −/* FCNVME_LS_DISCONNECT */ | |
| 306 | −struct fcnvme_ls_disconnect_rqst { | |
| 382 | +/* FCNVME_LS_DISCONNECT_ASSOC */ | |
| 383 | +struct fcnvme_ls_disconnect_assoc_rqst { | |
| 307 | 384 | struct fcnvme_ls_rqst_w0 w0; |
| 308 | 385 | __be32 desc_list_len; |
| 309 | 386 | struct fcnvme_lsdesc_assoc_id associd; |
| 310 | 387 | struct fcnvme_lsdesc_disconn_cmd discon_cmd; |
| 311 | 388 | }; |
| 312 | 389 | |
| 313 | −struct fcnvme_ls_disconnect_acc { | |
| 390 | +struct fcnvme_ls_disconnect_assoc_acc { | |
| 391 | + struct fcnvme_ls_acc_hdr hdr; | |
| 392 | +}; | |
| 393 | + | |
| 394 | + | |
| 395 | +/* FCNVME_LS_DISCONNECT_CONN */ | |
| 396 | +struct fcnvme_ls_disconnect_conn_rqst { | |
| 397 | + struct fcnvme_ls_rqst_w0 w0; | |
| 398 | + __be32 desc_list_len; | |
| 399 | + struct fcnvme_lsdesc_assoc_id associd; | |
| 400 | + struct fcnvme_lsdesc_disconn_cmd connectid; | |
| 401 | +}; | |
| 402 | + | |
| 403 | +struct fcnvme_ls_disconnect_conn_acc { | |
| 314 | 404 | struct fcnvme_ls_acc_hdr hdr; |
| 315 | 405 | }; |
| 316 | 406 | |
| 317 | 407 | |
| 318 | 408 | /* |
| 319 | − * Yet to be defined in FC-NVME: | |
| 409 | + * Default R_A_TOV is pulled in from fc_fs.h but needs conversion | |
| 410 | + * from ms to seconds for our use. | |
| 320 | 411 | */ |
| 321 | −#define NVME_FC_CONNECT_TIMEOUT_SEC 2 /* 2 seconds */ | |
| 322 | −#define NVME_FC_LS_TIMEOUT_SEC 2 /* 2 seconds */ | |
| 323 | −#define NVME_FC_TGTOP_TIMEOUT_SEC 2 /* 2 seconds */ | |
| 412 | +#define FC_TWO_TIMES_R_A_TOV (2 * (FC_DEF_R_A_TOV / 1000)) | |
| 413 | +#define NVME_FC_LS_TIMEOUT_SEC FC_TWO_TIMES_R_A_TOV | |
| 414 | +#define NVME_FC_TGTOP_TIMEOUT_SEC FC_TWO_TIMES_R_A_TOV | |
| 324 | 415 | |
| 325 | 416 | /* |
| 326 | 417 | * TRADDR string must be of form "nn-<16hexdigits>:pn-<16hexdigits>" |
| @@ -328,6 +419,7 @@ struct fcnvme_ls_disconnect_acc { · 1 unmodified line | ||
| 328 | 419 | * infront of the <16hexdigits>. Without is considered the "min" string |
| 329 | 420 | * and with is considered the "max" string. The hexdigits may be upper |
| 330 | 421 | * or lower case. |
| 422 | + * Note: FC-NVME-2 standard requires a "0x" prefix. | |
| 331 | 423 | */ |
| 332 | 424 | #define NVME_FC_TRADDR_NNLEN 3 /* "?n-" */ |
| 333 | 425 | #define NVME_FC_TRADDR_OXNNLEN 5 /* "?n-0x" */ |
| @@ -107,8 +107,22 @@ enum { · 106 unmodified lines | ||
| 107 | 107 | NVME_REG_AQA = 0x0024, /* Admin Queue Attributes */ |
| 108 | 108 | NVME_REG_ASQ = 0x0028, /* Admin SQ Base Address */ |
| 109 | 109 | NVME_REG_ACQ = 0x0030, /* Admin CQ Base Address */ |
| 110 | − NVME_REG_CMBLOC = 0x0038, /* Controller Memory Buffer Location */ | |
| 110 | + NVME_REG_CMBLOC = 0x0038, /* Controller Memory Buffer Location */ | |
| 111 | 111 | NVME_REG_CMBSZ = 0x003c, /* Controller Memory Buffer Size */ |
| 112 | + NVME_REG_BPINFO = 0x0040, /* Boot Partition Information */ | |
| 113 | + NVME_REG_BPRSEL = 0x0044, /* Boot Partition Read Select */ | |
| 114 | + NVME_REG_BPMBL = 0x0048, /* Boot Partition Memory Buffer | |
| 115 | + * Location | |
| 116 | + */ | |
| 117 | + NVME_REG_PMRCAP = 0x0e00, /* Persistent Memory Capabilities */ | |
| 118 | + NVME_REG_PMRCTL = 0x0e04, /* Persistent Memory Region Control */ | |
| 119 | + NVME_REG_PMRSTS = 0x0e08, /* Persistent Memory Region Status */ | |
| 120 | + NVME_REG_PMREBS = 0x0e0c, /* Persistent Memory Region Elasticity | |
| 121 | + * Buffer Size | |
| 122 | + */ | |
| 123 | + NVME_REG_PMRSWTP = 0x0e10, /* Persistent Memory Region Sustained | |
| 124 | + * Write Throughput | |
| 125 | + */ | |
| 112 | 126 | NVME_REG_DBS = 0x1000, /* SQ 0 Tail Doorbell */ |
| 113 | 127 | }; |
| 114 | 128 | |
| @@ -295,6 +309,14 @@ enum { · 180 unmodified lines | ||
| 295 | 309 | NVME_CTRL_OACS_DIRECTIVES = 1 << 5, |
| 296 | 310 | NVME_CTRL_OACS_DBBUF_SUPP = 1 << 8, |
| 297 | 311 | NVME_CTRL_LPA_CMD_EFFECTS_LOG = 1 << 1, |
| 312 | + NVME_CTRL_CTRATT_128_ID = 1 << 0, | |
| 313 | + NVME_CTRL_CTRATT_NON_OP_PSP = 1 << 1, | |
| 314 | + NVME_CTRL_CTRATT_NVM_SETS = 1 << 2, | |
| 315 | + NVME_CTRL_CTRATT_READ_RECV_LVLS = 1 << 3, | |
| 316 | + NVME_CTRL_CTRATT_ENDURANCE_GROUPS = 1 << 4, | |
| 317 | + NVME_CTRL_CTRATT_PREDICTABLE_LAT = 1 << 5, | |
| 318 | + NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY = 1 << 7, | |
| 319 | + NVME_CTRL_CTRATT_UUID_LIST = 1 << 9, | |
| 298 | 320 | }; |
| 299 | 321 | |
| 300 | 322 | struct nvme_lbaf { |
| @@ -352,6 +374,9 @@ enum { · 51 unmodified lines | ||
| 352 | 374 | NVME_ID_CNS_NS_PRESENT = 0x11, |
| 353 | 375 | NVME_ID_CNS_CTRL_NS_LIST = 0x12, |
| 354 | 376 | NVME_ID_CNS_CTRL_LIST = 0x13, |
| 377 | + NVME_ID_CNS_SCNDRY_CTRL_LIST = 0x15, | |
| 378 | + NVME_ID_CNS_NS_GRANULARITY = 0x16, | |
| 379 | + NVME_ID_CNS_UUID_LIST = 0x17, | |
| 355 | 380 | }; |
| 356 | 381 | |
| 357 | 382 | enum { |
| @@ -409,7 +434,8 @@ struct nvme_smart_log { · 51 unmodified lines | ||
| 409 | 434 | __u8 avail_spare; |
| 410 | 435 | __u8 spare_thresh; |
| 411 | 436 | __u8 percent_used; |
| 412 | − __u8 rsvd6[26]; | |
| 437 | + __u8 endu_grp_crit_warn_sumry; | |
| 438 | + __u8 rsvd7[25]; | |
| 413 | 439 | __u8 data_units_read[16]; |
| 414 | 440 | __u8 data_units_written[16]; |
| 415 | 441 | __u8 host_reads[16]; |
| @@ -423,7 +449,11 @@ struct nvme_smart_log { · 7 unmodified lines | ||
| 423 | 449 | __le32 warning_temp_time; |
| 424 | 450 | __le32 critical_comp_time; |
| 425 | 451 | __le16 temp_sensor[8]; |
| 426 | − __u8 rsvd216[296]; | |
| 452 | + __le32 thm_temp1_trans_count; | |
| 453 | + __le32 thm_temp2_trans_count; | |
| 454 | + __le32 thm_temp1_total_time; | |
| 455 | + __le32 thm_temp2_total_time; | |
| 456 | + __u8 rsvd232[280]; | |
| 427 | 457 | }; |
| 428 | 458 | |
| 429 | 459 | struct nvme_fw_slot_info_log { |
| @@ -440,6 +470,7 @@ enum { · 10 unmodified lines | ||
| 440 | 470 | NVME_CMD_EFFECTS_NIC = 1 << 3, |
| 441 | 471 | NVME_CMD_EFFECTS_CCC = 1 << 4, |
| 442 | 472 | NVME_CMD_EFFECTS_CSE_MASK = 3 << 16, |
| 473 | + NVME_CMD_EFFECTS_UUID_SEL = 1 << 19, | |
| 443 | 474 | }; |
| 444 | 475 | |
| 445 | 476 | struct nvme_effects_log { |
| @@ -563,6 +594,7 @@ enum nvme_opcode { · 117 unmodified lines | ||
| 563 | 594 | nvme_cmd_compare = 0x05, |
| 564 | 595 | nvme_cmd_write_zeroes = 0x08, |
| 565 | 596 | nvme_cmd_dsm = 0x09, |
| 597 | + nvme_cmd_verify = 0x0c, | |
| 566 | 598 | nvme_cmd_resv_register = 0x0d, |
| 567 | 599 | nvme_cmd_resv_report = 0x0e, |
| 568 | 600 | nvme_cmd_resv_acquire = 0x11, |
| @@ -772,6 +804,12 @@ struct nvme_write_zeroes_cmd { · 203 unmodified lines | ||
| 772 | 804 | |
| 773 | 805 | /* Features */ |
| 774 | 806 | |
| 807 | +enum { | |
| 808 | + NVME_TEMP_THRESH_MASK = 0xffff, | |
| 809 | + NVME_TEMP_THRESH_SELECT_SHIFT = 16, | |
| 810 | + NVME_TEMP_THRESH_TYPE_UNDER = 0x100000, | |
| 811 | +}; | |
| 812 | + | |
| 775 | 813 | struct nvme_feat_auto_pst { |
| 776 | 814 | __le64 entries[32]; |
| 777 | 815 | }; |
| @@ -806,10 +844,14 @@ enum nvme_admin_opcode { · 28 unmodified lines | ||
| 806 | 844 | nvme_admin_ns_mgmt = 0x0d, |
| 807 | 845 | nvme_admin_activate_fw = 0x10, |
| 808 | 846 | nvme_admin_download_fw = 0x11, |
| 847 | + nvme_admin_dev_self_test = 0x14, | |
| 809 | 848 | nvme_admin_ns_attach = 0x15, |
| 810 | 849 | nvme_admin_keep_alive = 0x18, |
| 811 | 850 | nvme_admin_directive_send = 0x19, |
| 812 | 851 | nvme_admin_directive_recv = 0x1a, |
| 852 | + nvme_admin_virtual_mgmt = 0x1c, | |
| 853 | + nvme_admin_nvme_mi_send = 0x1d, | |
| 854 | + nvme_admin_nvme_mi_recv = 0x1e, | |
| 813 | 855 | nvme_admin_dbbuf = 0x7C, |
| 814 | 856 | nvme_admin_format_nvm = 0x80, |
| 815 | 857 | nvme_admin_security_send = 0x81, |
| @@ -873,6 +915,7 @@ enum { · 57 unmodified lines | ||
| 873 | 915 | NVME_FEAT_PLM_CONFIG = 0x13, |
| 874 | 916 | NVME_FEAT_PLM_WINDOW = 0x14, |
| 875 | 917 | NVME_FEAT_HOST_BEHAVIOR = 0x16, |
| 918 | + NVME_FEAT_SANITIZE = 0x17, | |
| 876 | 919 | NVME_FEAT_SW_PROGRESS = 0x80, |
| 877 | 920 | NVME_FEAT_HOST_ID = 0x81, |
| 878 | 921 | NVME_FEAT_RESV_MASK = 0x82, |
| @@ -883,6 +926,10 @@ enum { · 4 unmodified lines | ||
| 883 | 926 | NVME_LOG_FW_SLOT = 0x03, |
| 884 | 927 | NVME_LOG_CHANGED_NS = 0x04, |
| 885 | 928 | NVME_LOG_CMD_EFFECTS = 0x05, |
| 929 | + NVME_LOG_DEVICE_SELF_TEST = 0x06, | |
| 930 | + NVME_LOG_TELEMETRY_HOST = 0x07, | |
| 931 | + NVME_LOG_TELEMETRY_CTRL = 0x08, | |
| 932 | + NVME_LOG_ENDURANCE_GROUP = 0x09, | |
| 886 | 933 | NVME_LOG_ANA = 0x0c, |
| 887 | 934 | NVME_LOG_DISC = 0x70, |
| 888 | 935 | NVME_LOG_RESERVATION = 0x80, |
| @@ -1290,7 +1337,11 @@ enum { · 401 unmodified lines | ||
| 1290 | 1337 | NVME_SC_SGL_INVALID_OFFSET = 0x16, |
| 1291 | 1338 | NVME_SC_SGL_INVALID_SUBTYPE = 0x17, |
| 1292 | 1339 | |
| 1340 | + NVME_SC_SANITIZE_FAILED = 0x1C, | |
| 1341 | + NVME_SC_SANITIZE_IN_PROGRESS = 0x1D, | |
| 1342 | + | |
| 1293 | 1343 | NVME_SC_NS_WRITE_PROTECTED = 0x20, |
| 1344 | + NVME_SC_CMD_INTERRUPTED = 0x21, | |
| 1294 | 1345 | |
| 1295 | 1346 | NVME_SC_LBA_RANGE = 0x80, |
| 1296 | 1347 | NVME_SC_CAP_EXCEEDED = 0x81, |
| @@ -1328,6 +1379,8 @@ enum { · 31 unmodified lines | ||
| 1328 | 1379 | NVME_SC_NS_NOT_ATTACHED = 0x11a, |
| 1329 | 1380 | NVME_SC_THIN_PROV_NOT_SUPP = 0x11b, |
| 1330 | 1381 | NVME_SC_CTRL_LIST_INVALID = 0x11c, |
| 1382 | + NVME_SC_BP_WRITE_PROHIBITED = 0x11e, | |
| 1383 | + NVME_SC_PMR_SAN_PROHIBITED = 0x123, | |
| 1331 | 1384 | |
| 1332 | 1385 | /* |
| 1333 | 1386 | * I/O Command Set Specific - NVM commands: |
| @@ -1368,6 +1421,7 @@ enum { · 34 unmodified lines | ||
| 1368 | 1421 | NVME_SC_ANA_INACCESSIBLE = 0x302, |
| 1369 | 1422 | NVME_SC_ANA_TRANSITION = 0x303, |
| 1370 | 1423 | NVME_SC_HOST_PATH_ERROR = 0x370, |
| 1424 | + NVME_SC_HOST_ABORTED_CMD = 0x371, | |
| 1371 | 1425 | |
| 1372 | 1426 | NVME_SC_CRD = 0x1800, |
| 1373 | 1427 | NVME_SC_DNR = 0x4000, |
| @@ -89,6 +89,9 @@ void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, · 88 unmodified lines | ||
| 89 | 89 | int nvmem_register_notifier(struct notifier_block *nb); |
| 90 | 90 | int nvmem_unregister_notifier(struct notifier_block *nb); |
| 91 | 91 | |
| 92 | +struct nvmem_device *nvmem_device_find(void *data, | |
| 93 | + int (*match)(struct device *dev, const void *data)); | |
| 94 | + | |
| 92 | 95 | #else |
| 93 | 96 | |
| 94 | 97 | static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, |
| @@ -118,7 +121,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) · 23 unmodified lines | ||
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | static inline int nvmem_cell_write(struct nvmem_cell *cell, |
| 121 | − const char *buf, size_t len) | |
| 124 | + void *buf, size_t len) | |
| 122 | 125 | { |
| 123 | 126 | return -EOPNOTSUPP; |
| 124 | 127 | } |
| @@ -204,6 +207,12 @@ static inline int nvmem_unregister_notifier(struct notifier_block *nb) · 79 unmodified lines | ||
| 204 | 207 | return -EOPNOTSUPP; |
| 205 | 208 | } |
| 206 | 209 | |
| 210 | +static inline struct nvmem_device *nvmem_device_find(void *data, | |
| 211 | + int (*match)(struct device *dev, const void *data)) | |
| 212 | +{ | |
| 213 | + return NULL; | |
| 214 | +} | |
| 215 | + | |
| 207 | 216 | #endif /* CONFIG_NVMEM */ |
| 208 | 217 | |
| 209 | 218 | #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) |
| @@ -12,6 +12,7 @@ struct of_pci_range_parser { · 11 unmodified lines | ||
| 12 | 12 | const __be32 *end; |
| 13 | 13 | int np; |
| 14 | 14 | int pna; |
| 15 | + bool dma; | |
| 15 | 16 | }; |
| 16 | 17 | |
| 17 | 18 | struct of_pci_range { |
| @@ -33,10 +34,6 @@ extern u64 of_translate_dma_address(struct device_node *dev, · 15 unmodified lines | ||
| 33 | 34 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); |
| 34 | 35 | extern int of_address_to_resource(struct device_node *dev, int index, |
| 35 | 36 | struct resource *r); |
| 36 | −extern struct device_node *of_find_matching_node_by_address( | |
| 37 | − struct device_node *from, | |
| 38 | − const struct of_device_id *matches, | |
| 39 | − u64 base_address); | |
| 40 | 37 | extern void __iomem *of_iomap(struct device_node *device, int index); |
| 41 | 38 | void __iomem *of_io_request_and_map(struct device_node *device, |
| 42 | 39 | int index, const char *name); |
| @@ -55,8 +52,6 @@ extern int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, · 12 unmodified lines | ||
| 55 | 52 | extern struct of_pci_range *of_pci_range_parser_one( |
| 56 | 53 | struct of_pci_range_parser *parser, |
| 57 | 54 | struct of_pci_range *range); |
| 58 | −extern int of_dma_get_range(struct device_node *np, u64 *dma_addr, | |
| 59 | − u64 *paddr, u64 *size); | |
| 60 | 55 | extern bool of_dma_is_coherent(struct device_node *np); |
| 61 | 56 | #else /* CONFIG_OF_ADDRESS */ |
| 62 | 57 | static inline void __iomem *of_io_request_and_map(struct device_node *device, |
| @@ -71,14 +66,6 @@ static inline u64 of_translate_address(struct device_node *np, · 8 unmodified lines | ||
| 71 | 66 | return OF_BAD_ADDR; |
| 72 | 67 | } |
| 73 | 68 | |
| 74 | −static inline struct device_node *of_find_matching_node_by_address( | |
| 75 | − struct device_node *from, | |
| 76 | − const struct of_device_id *matches, | |
| 77 | − u64 base_address) | |
| 78 | −{ | |
| 79 | − return NULL; | |
| 80 | −} | |
| 81 | − | |
| 82 | 69 | static inline const __be32 *of_get_address(struct device_node *dev, int index, |
| 83 | 70 | u64 *size, unsigned int *flags) |
| 84 | 71 | { |
| @@ -104,12 +91,6 @@ static inline struct of_pci_range *of_pci_range_parser_one( · 19 unmodified lines | ||
| 104 | 91 | return NULL; |
| 105 | 92 | } |
| 106 | 93 | |
| 107 | −static inline int of_dma_get_range(struct device_node *np, u64 *dma_addr, | |
| 108 | − u64 *paddr, u64 *size) | |
| 109 | −{ | |
| 110 | − return -ENODEV; | |
| 111 | −} | |
| 112 | − | |
| 113 | 94 | static inline bool of_dma_is_coherent(struct device_node *np) |
| 114 | 95 | { |
| 115 | 96 | return false; |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/of.h> |
| 13 | 13 | |
| 14 | 14 | #if IS_ENABLED(CONFIG_OF_MDIO) |
| 15 | +extern bool of_mdiobus_child_is_phy(struct device_node *child); | |
| 15 | 16 | extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); |
| 16 | 17 | extern struct phy_device *of_phy_find_device(struct device_node *phy_np); |
| 17 | 18 | extern struct phy_device *of_phy_connect(struct net_device *dev, |
| @@ -54,6 +55,11 @@ static inline int of_mdio_parse_addr(struct device *dev, · 36 unmodified lines | ||
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | #else /* CONFIG_OF_MDIO */ |
| 58 | +static bool of_mdiobus_child_is_phy(struct device_node *child) | |
| 59 | +{ | |
| 60 | + return false; | |
| 61 | +} | |
| 62 | + | |
| 57 | 63 | static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) |
| 58 | 64 | { |
| 59 | 65 | /* |
| @@ -6,15 +6,18 @@ · 5 unmodified lines | ||
| 6 | 6 | #ifndef __LINUX_OF_NET_H |
| 7 | 7 | #define __LINUX_OF_NET_H |
| 8 | 8 | |
| 9 | +#include <linux/phy.h> | |
| 10 | + | |
| 9 | 11 | #ifdef CONFIG_OF_NET |
| 10 | 12 | #include <linux/of.h> |
| 11 | 13 | |
| 12 | 14 | struct net_device; |
| 13 | −extern int of_get_phy_mode(struct device_node *np); | |
| 15 | +extern int of_get_phy_mode(struct device_node *np, phy_interface_t *interface); | |
| 14 | 16 | extern const void *of_get_mac_address(struct device_node *np); |
| 15 | 17 | extern struct net_device *of_find_net_device_by_node(struct device_node *np); |
| 16 | 18 | #else |
| 17 | −static inline int of_get_phy_mode(struct device_node *np) | |
| 19 | +static inline int of_get_phy_mode(struct device_node *np, | |
| 20 | + phy_interface_t *interface) | |
| 18 | 21 | { |
| 19 | 22 | return -ENODEV; |
| 20 | 23 | } |
| @@ -2,11 +2,10 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef __OF_PCI_H |
| 3 | 3 | #define __OF_PCI_H |
| 4 | 4 | |
| 5 | −#include <linux/pci.h> | |
| 6 | −#include <linux/msi.h> | |
| 5 | +#include <linux/types.h> | |
| 6 | +#include <linux/errno.h> | |
| 7 | 7 | |
| 8 | 8 | struct pci_dev; |
| 9 | −struct of_phandle_args; | |
| 10 | 9 | struct device_node; |
| 11 | 10 | |
| 12 | 11 | #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI) |
| @@ -30,7 +30,7 @@ static inline bool is_migrate_isolate(int migratetype) · 29 unmodified lines | ||
| 30 | 30 | } |
| 31 | 31 | #endif |
| 32 | 32 | |
| 33 | −#define SKIP_HWPOISON 0x1 | |
| 33 | +#define MEMORY_OFFLINE 0x1 | |
| 34 | 34 | #define REPORT_FAILURE 0x2 |
| 35 | 35 | |
| 36 | 36 | bool has_unmovable_pages(struct zone *zone, struct page *page, int count, |
| @@ -58,7 +58,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, · 21 unmodified lines | ||
| 58 | 58 | * Test all pages in [start_pfn, end_pfn) are isolated or not. |
| 59 | 59 | */ |
| 60 | 60 | int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, |
| 61 | − bool skip_hwpoisoned_pages); | |
| 61 | + int isol_flags); | |
| 62 | 62 | |
| 63 | 63 | struct page *alloc_migrate_target(struct page *page, unsigned long private); |
| 64 | 64 | |
| @@ -24,6 +24,9 @@ struct mm_walk; · 23 unmodified lines | ||
| 24 | 24 | * "do page table walk over the current vma", returning |
| 25 | 25 | * a negative value means "abort current page table walk |
| 26 | 26 | * right now" and returning 1 means "skip the current vma" |
| 27 | + * @pre_vma: if set, called before starting walk on a non-null vma. | |
| 28 | + * @post_vma: if set, called after a walk on a non-null vma, provided | |
| 29 | + * that @pre_vma and the vma walk succeeded. | |
| 27 | 30 | */ |
| 28 | 31 | struct mm_walk_ops { |
| 29 | 32 | int (*pud_entry)(pud_t *pud, unsigned long addr, |
| @@ -39,6 +42,9 @@ struct mm_walk_ops { · 9 unmodified lines | ||
| 39 | 42 | struct mm_walk *walk); |
| 40 | 43 | int (*test_walk)(unsigned long addr, unsigned long next, |
| 41 | 44 | struct mm_walk *walk); |
| 45 | + int (*pre_vma)(unsigned long start, unsigned long end, | |
| 46 | + struct mm_walk *walk); | |
| 47 | + void (*post_vma)(struct mm_walk *walk); | |
| 42 | 48 | }; |
| 43 | 49 | |
| 44 | 50 | /** |
| @@ -62,5 +68,8 @@ int walk_page_range(struct mm_struct *mm, unsigned long start, · 17 unmodified lines | ||
| 62 | 68 | void *private); |
| 63 | 69 | int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops, |
| 64 | 70 | void *private); |
| 71 | +int walk_page_mapping(struct address_space *mapping, pgoff_t first_index, | |
| 72 | + pgoff_t nr, const struct mm_walk_ops *ops, | |
| 73 | + void *private); | |
| 65 | 74 | |
| 66 | 75 | #endif /* _LINUX_PAGEWALK_H */ |
| @@ -460,6 +460,7 @@ extern size_t parport_ieee1284_epp_read_addr (struct parport *, · 459 unmodified lines | ||
| 460 | 460 | void *, size_t, int); |
| 461 | 461 | |
| 462 | 462 | /* IEEE1284.3 functions */ |
| 463 | +#define daisy_dev_name "Device ID probe" | |
| 463 | 464 | extern int parport_daisy_init (struct parport *port); |
| 464 | 465 | extern void parport_daisy_fini (struct parport *port); |
| 465 | 466 | extern struct pardevice *parport_open (int devnum, const char *name); |
| @@ -4,74 +4,39 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | #include <linux/pci.h> |
| 6 | 6 | |
| 7 | −#ifdef CONFIG_PCI_PRI | |
| 7 | +#ifdef CONFIG_PCI_ATS | |
| 8 | +/* Address Translation Service */ | |
| 9 | +int pci_enable_ats(struct pci_dev *dev, int ps); | |
| 10 | +void pci_disable_ats(struct pci_dev *dev); | |
| 11 | +int pci_ats_queue_depth(struct pci_dev *dev); | |
| 12 | +int pci_ats_page_aligned(struct pci_dev *dev); | |
| 13 | +#else /* CONFIG_PCI_ATS */ | |
| 14 | +static inline int pci_enable_ats(struct pci_dev *d, int ps) | |
| 15 | +{ return -ENODEV; } | |
| 16 | +static inline void pci_disable_ats(struct pci_dev *d) { } | |
| 17 | +static inline int pci_ats_queue_depth(struct pci_dev *d) | |
| 18 | +{ return -ENODEV; } | |
| 19 | +static inline int pci_ats_page_aligned(struct pci_dev *dev) | |
| 20 | +{ return 0; } | |
| 21 | +#endif /* CONFIG_PCI_ATS */ | |
| 8 | 22 | |
| 23 | +#ifdef CONFIG_PCI_PRI | |
| 9 | 24 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); |
| 10 | 25 | void pci_disable_pri(struct pci_dev *pdev); |
| 11 | −void pci_restore_pri_state(struct pci_dev *pdev); | |
| 12 | 26 | int pci_reset_pri(struct pci_dev *pdev); |
| 13 | − | |
| 14 | −#else /* CONFIG_PCI_PRI */ | |
| 15 | − | |
| 16 | −static inline int pci_enable_pri(struct pci_dev *pdev, u32 reqs) | |
| 17 | −{ | |
| 18 | − return -ENODEV; | |
| 19 | −} | |
| 20 | − | |
| 21 | −static inline void pci_disable_pri(struct pci_dev *pdev) | |
| 22 | −{ | |
| 23 | −} | |
| 24 | − | |
| 25 | −static inline void pci_restore_pri_state(struct pci_dev *pdev) | |
| 26 | −{ | |
| 27 | −} | |
| 28 | − | |
| 29 | −static inline int pci_reset_pri(struct pci_dev *pdev) | |
| 30 | −{ | |
| 31 | − return -ENODEV; | |
| 32 | −} | |
| 33 | − | |
| 27 | +int pci_prg_resp_pasid_required(struct pci_dev *pdev); | |
| 34 | 28 | #endif /* CONFIG_PCI_PRI */ |
| 35 | 29 | |
| 36 | 30 | #ifdef CONFIG_PCI_PASID |
| 37 | − | |
| 38 | 31 | int pci_enable_pasid(struct pci_dev *pdev, int features); |
| 39 | 32 | void pci_disable_pasid(struct pci_dev *pdev); |
| 40 | −void pci_restore_pasid_state(struct pci_dev *pdev); | |
| 41 | 33 | int pci_pasid_features(struct pci_dev *pdev); |
| 42 | 34 | int pci_max_pasids(struct pci_dev *pdev); |
| 43 | −int pci_prg_resp_pasid_required(struct pci_dev *pdev); | |
| 44 | − | |
| 45 | −#else /* CONFIG_PCI_PASID */ | |
| 46 | − | |
| 47 | −static inline int pci_enable_pasid(struct pci_dev *pdev, int features) | |
| 48 | −{ | |
| 49 | − return -EINVAL; | |
| 50 | −} | |
| 51 | − | |
| 52 | −static inline void pci_disable_pasid(struct pci_dev *pdev) | |
| 53 | −{ | |
| 54 | −} | |
| 55 | − | |
| 56 | −static inline void pci_restore_pasid_state(struct pci_dev *pdev) | |
| 57 | −{ | |
| 58 | −} | |
| 59 | − | |
| 35 | +#else /* CONFIG_PCI_PASID */ | |
| 60 | 36 | static inline int pci_pasid_features(struct pci_dev *pdev) |
| 61 | −{ | |
| 62 | − return -EINVAL; | |
| 63 | −} | |
| 64 | − | |
| 37 | +{ return -EINVAL; } | |
| 65 | 38 | static inline int pci_max_pasids(struct pci_dev *pdev) |
| 66 | −{ | |
| 67 | − return -EINVAL; | |
| 68 | −} | |
| 69 | − | |
| 70 | −static inline int pci_prg_resp_pasid_required(struct pci_dev *pdev) | |
| 71 | −{ | |
| 72 | − return 0; | |
| 73 | −} | |
| 39 | +{ return -EINVAL; } | |
| 74 | 40 | #endif /* CONFIG_PCI_PASID */ |
| 75 | 41 | |
| 76 | − | |
| 77 | −#endif /* LINUX_PCI_ATS_H*/ | |
| 42 | +#endif /* LINUX_PCI_ATS_H */ | |
| @@ -117,7 +117,7 @@ struct pci_epc_features { · 116 unmodified lines | ||
| 117 | 117 | unsigned int msix_capable : 1; |
| 118 | 118 | u8 reserved_bar; |
| 119 | 119 | u8 bar_fixed_64bit; |
| 120 | − u64 bar_fixed_size[BAR_5 + 1]; | |
| 120 | + u64 bar_fixed_size[PCI_STD_NUM_BARS]; | |
| 121 | 121 | size_t align; |
| 122 | 122 | }; |
| 123 | 123 | |
| @@ -82,7 +82,7 @@ enum pci_mmap_state { · 81 unmodified lines | ||
| 82 | 82 | enum { |
| 83 | 83 | /* #0-5: standard PCI resources */ |
| 84 | 84 | PCI_STD_RESOURCES, |
| 85 | − PCI_STD_RESOURCE_END = 5, | |
| 85 | + PCI_STD_RESOURCE_END = PCI_STD_RESOURCES + PCI_STD_NUM_BARS - 1, | |
| 86 | 86 | |
| 87 | 87 | /* #6: expansion ROM resource */ |
| 88 | 88 | PCI_ROM_RESOURCE, |
| @@ -284,7 +284,6 @@ struct irq_affinity; · 195 unmodified lines | ||
| 284 | 284 | struct pcie_link_state; |
| 285 | 285 | struct pci_vpd; |
| 286 | 286 | struct pci_sriov; |
| 287 | −struct pci_ats; | |
| 288 | 287 | struct pci_p2pdma; |
| 289 | 288 | |
| 290 | 289 | /* The pci_dev structure describes PCI devices */ |
| @@ -452,12 +451,14 @@ struct pci_dev { · 161 unmodified lines | ||
| 452 | 451 | }; |
| 453 | 452 | u16 ats_cap; /* ATS Capability offset */ |
| 454 | 453 | u8 ats_stu; /* ATS Smallest Translation Unit */ |
| 455 | − atomic_t ats_ref_cnt; /* Number of VFs with ATS enabled */ | |
| 456 | 454 | #endif |
| 457 | 455 | #ifdef CONFIG_PCI_PRI |
| 456 | + u16 pri_cap; /* PRI Capability offset */ | |
| 458 | 457 | u32 pri_reqs_alloc; /* Number of PRI requests allocated */ |
| 458 | + unsigned int pasid_required:1; /* PRG Response PASID Required */ | |
| 459 | 459 | #endif |
| 460 | 460 | #ifdef CONFIG_PCI_PASID |
| 461 | + u16 pasid_cap; /* PASID Capability offset */ | |
| 461 | 462 | u16 pasid_features; |
| 462 | 463 | #endif |
| 463 | 464 | #ifdef CONFIG_PCI_P2PDMA |
| @@ -805,8 +806,6 @@ struct module; · 341 unmodified lines | ||
| 805 | 806 | * The remove function always gets called from process |
| 806 | 807 | * context, so it can sleep. |
| 807 | 808 | * @suspend: Put device into low power state. |
| 808 | − * @suspend_late: Put device into low power state. | |
| 809 | − * @resume_early: Wake device from low power state. | |
| 810 | 809 | * @resume: Wake device from low power state. |
| 811 | 810 | * (Please see Documentation/power/pci.rst for descriptions |
| 812 | 811 | * of PCI Power Management and the related functions.) |
| @@ -829,8 +828,6 @@ struct pci_driver { · 16 unmodified lines | ||
| 829 | 828 | int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ |
| 830 | 829 | void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ |
| 831 | 830 | int (*suspend)(struct pci_dev *dev, pm_message_t state); /* Device suspended */ |
| 832 | − int (*suspend_late)(struct pci_dev *dev, pm_message_t state); | |
| 833 | − int (*resume_early)(struct pci_dev *dev); | |
| 834 | 831 | int (*resume)(struct pci_dev *dev); /* Device woken up */ |
| 835 | 832 | void (*shutdown)(struct pci_dev *dev); |
| 836 | 833 | int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */ |
| @@ -1232,7 +1229,7 @@ struct pci_cap_saved_state *pci_find_saved_ext_cap(struct pci_dev *dev, · 395 unmodified lines | ||
| 1232 | 1229 | int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size); |
| 1233 | 1230 | int pci_add_ext_cap_save_buffer(struct pci_dev *dev, |
| 1234 | 1231 | u16 cap, unsigned int size); |
| 1235 | −int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); | |
| 1232 | +int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state); | |
| 1236 | 1233 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); |
| 1237 | 1234 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
| 1238 | 1235 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); |
| @@ -1454,7 +1451,6 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, · 215 unmodified lines | ||
| 1454 | 1451 | void pci_free_irq_vectors(struct pci_dev *dev); |
| 1455 | 1452 | int pci_irq_vector(struct pci_dev *dev, unsigned int nr); |
| 1456 | 1453 | const struct cpumask *pci_irq_get_affinity(struct pci_dev *pdev, int vec); |
| 1457 | −int pci_irq_get_node(struct pci_dev *pdev, int vec); | |
| 1458 | 1454 | |
| 1459 | 1455 | #else |
| 1460 | 1456 | static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } |
| @@ -1497,11 +1493,6 @@ static inline const struct cpumask *pci_irq_get_affinity(struct pci_dev *pdev, · 36 unmodified lines | ||
| 1497 | 1493 | { |
| 1498 | 1494 | return cpu_possible_mask; |
| 1499 | 1495 | } |
| 1500 | − | |
| 1501 | −static inline int pci_irq_get_node(struct pci_dev *pdev, int vec) | |
| 1502 | −{ | |
| 1503 | − return first_online_node; | |
| 1504 | −} | |
| 1505 | 1496 | #endif |
| 1506 | 1497 | |
| 1507 | 1498 | /** |
| @@ -1544,9 +1535,13 @@ extern bool pcie_ports_native; · 36 unmodified lines | ||
| 1544 | 1535 | #define pcie_ports_native false |
| 1545 | 1536 | #endif |
| 1546 | 1537 | |
| 1547 | −#define PCIE_LINK_STATE_L0S 1 | |
| 1548 | −#define PCIE_LINK_STATE_L1 2 | |
| 1549 | −#define PCIE_LINK_STATE_CLKPM 4 | |
| 1538 | +#define PCIE_LINK_STATE_L0S BIT(0) | |
| 1539 | +#define PCIE_LINK_STATE_L1 BIT(1) | |
| 1540 | +#define PCIE_LINK_STATE_CLKPM BIT(2) | |
| 1541 | +#define PCIE_LINK_STATE_L1_1 BIT(3) | |
| 1542 | +#define PCIE_LINK_STATE_L1_2 BIT(4) | |
| 1543 | +#define PCIE_LINK_STATE_L1_1_PCIPM BIT(5) | |
| 1544 | +#define PCIE_LINK_STATE_L1_2_PCIPM BIT(6) | |
| 1550 | 1545 | |
| 1551 | 1546 | #ifdef CONFIG_PCIEASPM |
| 1552 | 1547 | int pci_disable_link_state(struct pci_dev *pdev, int state); |
| @@ -1686,6 +1681,7 @@ static inline struct pci_dev *pci_get_class(unsigned int class, · 133 unmodified lines | ||
| 1686 | 1681 | static inline void pci_set_master(struct pci_dev *dev) { } |
| 1687 | 1682 | static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } |
| 1688 | 1683 | static inline void pci_disable_device(struct pci_dev *dev) { } |
| 1684 | +static inline int pcim_enable_device(struct pci_dev *pdev) { return -EIO; } | |
| 1689 | 1685 | static inline int pci_assign_resource(struct pci_dev *dev, int i) |
| 1690 | 1686 | { return -EBUSY; } |
| 1691 | 1687 | static inline int __pci_register_driver(struct pci_driver *drv, |
| @@ -1776,19 +1772,6 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, · 84 unmodified lines | ||
| 1776 | 1772 | NULL); |
| 1777 | 1773 | } |
| 1778 | 1774 | |
| 1779 | −#ifdef CONFIG_PCI_ATS | |
| 1780 | −/* Address Translation Service */ | |
| 1781 | −int pci_enable_ats(struct pci_dev *dev, int ps); | |
| 1782 | −void pci_disable_ats(struct pci_dev *dev); | |
| 1783 | −int pci_ats_queue_depth(struct pci_dev *dev); | |
| 1784 | −int pci_ats_page_aligned(struct pci_dev *dev); | |
| 1785 | −#else | |
| 1786 | −static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; } | |
| 1787 | −static inline void pci_disable_ats(struct pci_dev *d) { } | |
| 1788 | −static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; } | |
| 1789 | −static inline int pci_ats_page_aligned(struct pci_dev *dev) { return 0; } | |
| 1790 | −#endif | |
| 1791 | − | |
| 1792 | 1775 | /* Include architecture-dependent settings and functions */ |
| 1793 | 1776 | |
| 1794 | 1777 | #include <asm/pci.h> |
| @@ -2278,6 +2261,7 @@ struct irq_domain; · 483 unmodified lines | ||
| 2278 | 2261 | struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus); |
| 2279 | 2262 | int pci_parse_request_of_pci_ranges(struct device *dev, |
| 2280 | 2263 | struct list_head *resources, |
| 2264 | + struct list_head *ib_resources, | |
| 2281 | 2265 | struct resource **bus_range); |
| 2282 | 2266 | |
| 2283 | 2267 | /* Arch may override this (weak) */ |
| @@ -2286,9 +2270,11 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); · 2 unmodified lines | ||
| 2286 | 2270 | #else /* CONFIG_OF */ |
| 2287 | 2271 | static inline struct irq_domain * |
| 2288 | 2272 | pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; } |
| 2289 | −static inline int pci_parse_request_of_pci_ranges(struct device *dev, | |
| 2290 | − struct list_head *resources, | |
| 2291 | − struct resource **bus_range) | |
| 2273 | +static inline int | |
| 2274 | +pci_parse_request_of_pci_ranges(struct device *dev, | |
| 2275 | + struct list_head *resources, | |
| 2276 | + struct list_head *ib_resources, | |
| 2277 | + struct resource **bus_range) | |
| 2292 | 2278 | { |
| 2293 | 2279 | return -EINVAL; |
| 2294 | 2280 | } |
| @@ -2310,9 +2296,11 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus); · 15 unmodified lines | ||
| 2310 | 2296 | |
| 2311 | 2297 | void |
| 2312 | 2298 | pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *)); |
| 2299 | +bool pci_pr3_present(struct pci_dev *pdev); | |
| 2313 | 2300 | #else |
| 2314 | 2301 | static inline struct irq_domain * |
| 2315 | 2302 | pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) { return NULL; } |
| 2303 | +static inline bool pci_pr3_present(struct pci_dev *pdev) { return false; } | |
| 2316 | 2304 | #endif |
| 2317 | 2305 | |
| 2318 | 2306 | #ifdef CONFIG_EEH |
| @@ -2400,4 +2388,12 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type); · 81 unmodified lines | ||
| 2400 | 2388 | #define pci_info_ratelimited(pdev, fmt, arg...) \ |
| 2401 | 2389 | dev_info_ratelimited(&(pdev)->dev, fmt, ##arg) |
| 2402 | 2390 | |
| 2391 | +#define pci_WARN(pdev, condition, fmt, arg...) \ | |
| 2392 | + WARN(condition, "%s %s: " fmt, \ | |
| 2393 | + dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg) | |
| 2394 | + | |
| 2395 | +#define pci_WARN_ONCE(pdev, condition, fmt, arg...) \ | |
| 2396 | + WARN_ONCE(condition, "%s %s: " fmt, \ | |
| 2397 | + dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg) | |
| 2398 | + | |
| 2403 | 2399 | #endif /* LINUX_PCI_H */ |
| @@ -3006,6 +3006,7 @@ · 3005 unmodified lines | ||
| 3006 | 3006 | #define PCI_DEVICE_ID_INTEL_84460GX 0x84ea |
| 3007 | 3007 | #define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500 |
| 3008 | 3008 | #define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 |
| 3009 | +#define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b | |
| 3009 | 3010 | #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 |
| 3010 | 3011 | |
| 3011 | 3012 | #define PCI_VENDOR_ID_SCALEMP 0x8686 |
| @@ -186,14 +186,14 @@ static inline void percpu_ref_get_many(struct percpu_ref *ref, unsigned long nr) · 185 unmodified lines | ||
| 186 | 186 | { |
| 187 | 187 | unsigned long __percpu *percpu_count; |
| 188 | 188 | |
| 189 | − rcu_read_lock_sched(); | |
| 189 | + rcu_read_lock(); | |
| 190 | 190 | |
| 191 | 191 | if (__ref_is_percpu(ref, &percpu_count)) |
| 192 | 192 | this_cpu_add(*percpu_count, nr); |
| 193 | 193 | else |
| 194 | 194 | atomic_long_add(nr, &ref->count); |
| 195 | 195 | |
| 196 | − rcu_read_unlock_sched(); | |
| 196 | + rcu_read_unlock(); | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
| @@ -223,7 +223,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref) · 23 unmodified lines | ||
| 223 | 223 | unsigned long __percpu *percpu_count; |
| 224 | 224 | bool ret; |
| 225 | 225 | |
| 226 | − rcu_read_lock_sched(); | |
| 226 | + rcu_read_lock(); | |
| 227 | 227 | |
| 228 | 228 | if (__ref_is_percpu(ref, &percpu_count)) { |
| 229 | 229 | this_cpu_inc(*percpu_count); |
| @@ -232,7 +232,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref) · 2 unmodified lines | ||
| 232 | 232 | ret = atomic_long_inc_not_zero(&ref->count); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | − rcu_read_unlock_sched(); | |
| 235 | + rcu_read_unlock(); | |
| 236 | 236 | |
| 237 | 237 | return ret; |
| 238 | 238 | } |
| @@ -257,7 +257,7 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) · 18 unmodified lines | ||
| 257 | 257 | unsigned long __percpu *percpu_count; |
| 258 | 258 | bool ret = false; |
| 259 | 259 | |
| 260 | − rcu_read_lock_sched(); | |
| 260 | + rcu_read_lock(); | |
| 261 | 261 | |
| 262 | 262 | if (__ref_is_percpu(ref, &percpu_count)) { |
| 263 | 263 | this_cpu_inc(*percpu_count); |
| @@ -266,7 +266,7 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) · 2 unmodified lines | ||
| 266 | 266 | ret = atomic_long_inc_not_zero(&ref->count); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | − rcu_read_unlock_sched(); | |
| 269 | + rcu_read_unlock(); | |
| 270 | 270 | |
| 271 | 271 | return ret; |
| 272 | 272 | } |
| @@ -285,14 +285,14 @@ static inline void percpu_ref_put_many(struct percpu_ref *ref, unsigned long nr) · 12 unmodified lines | ||
| 285 | 285 | { |
| 286 | 286 | unsigned long __percpu *percpu_count; |
| 287 | 287 | |
| 288 | − rcu_read_lock_sched(); | |
| 288 | + rcu_read_lock(); | |
| 289 | 289 | |
| 290 | 290 | if (__ref_is_percpu(ref, &percpu_count)) |
| 291 | 291 | this_cpu_sub(*percpu_count, nr); |
| 292 | 292 | else if (unlikely(atomic_long_sub_and_test(nr, &ref->count))) |
| 293 | 293 | ref->release(ref); |
| 294 | 294 | |
| 295 | − rcu_read_unlock_sched(); | |
| 295 | + rcu_read_unlock(); | |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
| @@ -93,7 +93,7 @@ static inline void percpu_up_read(struct percpu_rw_semaphore *sem) · 92 unmodified lines | ||
| 93 | 93 | __percpu_up_read(sem); /* Unconditional memory barrier */ |
| 94 | 94 | preempt_enable(); |
| 95 | 95 | |
| 96 | − rwsem_release(&sem->rw_sem.dep_map, 1, _RET_IP_); | |
| 96 | + rwsem_release(&sem->rw_sem.dep_map, _RET_IP_); | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | extern void percpu_down_write(struct percpu_rw_semaphore *); |
| @@ -118,7 +118,7 @@ extern void percpu_free_rwsem(struct percpu_rw_semaphore *); · 18 unmodified lines | ||
| 118 | 118 | static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem, |
| 119 | 119 | bool read, unsigned long ip) |
| 120 | 120 | { |
| 121 | − lock_release(&sem->rw_sem.dep_map, 1, ip); | |
| 121 | + lock_release(&sem->rw_sem.dep_map, ip); | |
| 122 | 122 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 123 | 123 | if (!read) |
| 124 | 124 | atomic_long_set(&sem->rw_sem.owner, RWSEM_OWNER_UNKNOWN); |
| @@ -56,6 +56,7 @@ struct perf_guest_info_callbacks { · 55 unmodified lines | ||
| 56 | 56 | #include <linux/perf_regs.h> |
| 57 | 57 | #include <linux/cgroup.h> |
| 58 | 58 | #include <linux/refcount.h> |
| 59 | +#include <linux/security.h> | |
| 59 | 60 | #include <asm/local.h> |
| 60 | 61 | |
| 61 | 62 | struct perf_callchain_entry { |
| @@ -248,6 +249,8 @@ struct perf_event; · 186 unmodified lines | ||
| 248 | 249 | #define PERF_PMU_CAP_NO_EXCLUDE 0x80 |
| 249 | 250 | #define PERF_PMU_CAP_AUX_OUTPUT 0x100 |
| 250 | 251 | |
| 252 | +struct perf_output_handle; | |
| 253 | + | |
| 251 | 254 | /** |
| 252 | 255 | * struct pmu - generic performance monitoring unit |
| 253 | 256 | */ |
| @@ -409,6 +412,15 @@ struct pmu { · 155 unmodified lines | ||
| 409 | 412 | */ |
| 410 | 413 | size_t task_ctx_size; |
| 411 | 414 | |
| 415 | + /* | |
| 416 | + * PMU specific parts of task perf event context (i.e. ctx->task_ctx_data) | |
| 417 | + * can be synchronized using this function. See Intel LBR callstack support | |
| 418 | + * implementation and Perf core context switch handling callbacks for usage | |
| 419 | + * examples. | |
| 420 | + */ | |
| 421 | + void (*swap_task_ctx) (struct perf_event_context *prev, | |
| 422 | + struct perf_event_context *next); | |
| 423 | + /* optional */ | |
| 412 | 424 | |
| 413 | 425 | /* |
| 414 | 426 | * Set up pmu-private data structures for an AUX area |
| @@ -422,6 +434,19 @@ struct pmu { · 7 unmodified lines | ||
| 422 | 434 | */ |
| 423 | 435 | void (*free_aux) (void *aux); /* optional */ |
| 424 | 436 | |
| 437 | + /* | |
| 438 | + * Take a snapshot of the AUX buffer without touching the event | |
| 439 | + * state, so that preempting ->start()/->stop() callbacks does | |
| 440 | + * not interfere with their logic. Called in PMI context. | |
| 441 | + * | |
| 442 | + * Returns the size of AUX data copied to the output handle. | |
| 443 | + * | |
| 444 | + * Optional. | |
| 445 | + */ | |
| 446 | + long (*snapshot_aux) (struct perf_event *event, | |
| 447 | + struct perf_output_handle *handle, | |
| 448 | + unsigned long size); | |
| 449 | + | |
| 425 | 450 | /* |
| 426 | 451 | * Validate address range filters: make sure the HW supports the |
| 427 | 452 | * requested configuration and number of filters; return 0 if the |
| @@ -721,6 +746,9 @@ struct perf_event { · 293 unmodified lines | ||
| 721 | 746 | struct perf_cgroup *cgrp; /* cgroup event is attach to */ |
| 722 | 747 | #endif |
| 723 | 748 | |
| 749 | +#ifdef CONFIG_SECURITY | |
| 750 | + void *security; | |
| 751 | +#endif | |
| 724 | 752 | struct list_head sb_list; |
| 725 | 753 | #endif /* CONFIG_PERF_EVENTS */ |
| 726 | 754 | }; |
| @@ -960,6 +988,7 @@ struct perf_sample_data { · 233 unmodified lines | ||
| 960 | 988 | u32 reserved; |
| 961 | 989 | } cpu_entry; |
| 962 | 990 | struct perf_callchain_entry *callchain; |
| 991 | + u64 aux_size; | |
| 963 | 992 | |
| 964 | 993 | /* |
| 965 | 994 | * regs_user may point to task_pt_regs or to regs_user_copy, depending |
| @@ -1241,19 +1270,41 @@ extern int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, · 275 unmodified lines | ||
| 1241 | 1270 | int perf_event_max_stack_handler(struct ctl_table *table, int write, |
| 1242 | 1271 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 1243 | 1272 | |
| 1244 | −static inline bool perf_paranoid_tracepoint_raw(void) | |
| 1273 | +/* Access to perf_event_open(2) syscall. */ | |
| 1274 | +#define PERF_SECURITY_OPEN 0 | |
| 1275 | + | |
| 1276 | +/* Finer grained perf_event_open(2) access control. */ | |
| 1277 | +#define PERF_SECURITY_CPU 1 | |
| 1278 | +#define PERF_SECURITY_KERNEL 2 | |
| 1279 | +#define PERF_SECURITY_TRACEPOINT 3 | |
| 1280 | + | |
| 1281 | +static inline int perf_is_paranoid(void) | |
| 1245 | 1282 | { |
| 1246 | 1283 | return sysctl_perf_event_paranoid > -1; |
| 1247 | 1284 | } |
| 1248 | 1285 | |
| 1249 | −static inline bool perf_paranoid_cpu(void) | |
| 1286 | +static inline int perf_allow_kernel(struct perf_event_attr *attr) | |
| 1287 | +{ | |
| 1288 | + if (sysctl_perf_event_paranoid > 1 && !capable(CAP_SYS_ADMIN)) | |
| 1289 | + return -EACCES; | |
| 1290 | + | |
| 1291 | + return security_perf_event_open(attr, PERF_SECURITY_KERNEL); | |
| 1292 | +} | |
| 1293 | + | |
| 1294 | +static inline int perf_allow_cpu(struct perf_event_attr *attr) | |
| 1250 | 1295 | { |
| 1251 | − return sysctl_perf_event_paranoid > 0; | |
| 1296 | + if (sysctl_perf_event_paranoid > 0 && !capable(CAP_SYS_ADMIN)) | |
| 1297 | + return -EACCES; | |
| 1298 | + | |
| 1299 | + return security_perf_event_open(attr, PERF_SECURITY_CPU); | |
| 1252 | 1300 | } |
| 1253 | 1301 | |
| 1254 | −static inline bool perf_paranoid_kernel(void) | |
| 1302 | +static inline int perf_allow_tracepoint(struct perf_event_attr *attr) | |
| 1255 | 1303 | { |
| 1256 | − return sysctl_perf_event_paranoid > 1; | |
| 1304 | + if (sysctl_perf_event_paranoid > -1 && !capable(CAP_SYS_ADMIN)) | |
| 1305 | + return -EPERM; | |
| 1306 | + | |
| 1307 | + return security_perf_event_open(attr, PERF_SECURITY_TRACEPOINT); | |
| 1257 | 1308 | } |
| 1258 | 1309 | |
| 1259 | 1310 | extern void perf_event_init(void); |
| @@ -1327,6 +1378,9 @@ extern unsigned int perf_output_copy(struct perf_output_handle *handle, · 67 unmodified lines | ||
| 1327 | 1378 | const void *buf, unsigned int len); |
| 1328 | 1379 | extern unsigned int perf_output_skip(struct perf_output_handle *handle, |
| 1329 | 1380 | unsigned int len); |
| 1381 | +extern long perf_output_copy_aux(struct perf_output_handle *aux_handle, | |
| 1382 | + struct perf_output_handle *handle, | |
| 1383 | + unsigned long from, unsigned long to); | |
| 1330 | 1384 | extern int perf_swevent_get_recursion_context(void); |
| 1331 | 1385 | extern void perf_swevent_put_recursion_context(int rctx); |
| 1332 | 1386 | extern u64 perf_swevent_set_period(struct perf_event *event); |
| @@ -1336,6 +1390,8 @@ extern void perf_event_disable_local(struct perf_event *event); · 3 unmodified lines | ||
| 1336 | 1390 | extern void perf_event_disable_inatomic(struct perf_event *event); |
| 1337 | 1391 | extern void perf_event_task_tick(void); |
| 1338 | 1392 | extern int perf_event_account_interrupt(struct perf_event *event); |
| 1393 | +extern int perf_event_period(struct perf_event *event, u64 value); | |
| 1394 | +extern u64 perf_event_pause(struct perf_event *event, bool reset); | |
| 1339 | 1395 | #else /* !CONFIG_PERF_EVENTS: */ |
| 1340 | 1396 | static inline void * |
| 1341 | 1397 | perf_aux_output_begin(struct perf_output_handle *handle, |
| @@ -1415,6 +1471,14 @@ static inline void perf_event_disable(struct perf_event *event) { } · 73 unmodified lines | ||
| 1415 | 1471 | static inline int __perf_event_disable(void *info) { return -1; } |
| 1416 | 1472 | static inline void perf_event_task_tick(void) { } |
| 1417 | 1473 | static inline int perf_event_release_kernel(struct perf_event *event) { return 0; } |
| 1474 | +static inline int perf_event_period(struct perf_event *event, u64 value) | |
| 1475 | +{ | |
| 1476 | + return -EINVAL; | |
| 1477 | +} | |
| 1478 | +static inline u64 perf_event_pause(struct perf_event *event, bool reset) | |
| 1479 | +{ | |
| 1480 | + return 0; | |
| 1481 | +} | |
| 1418 | 1482 | #endif |
| 1419 | 1483 | |
| 1420 | 1484 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) |
| @@ -203,6 +203,8 @@ static inline const char *phy_modes(phy_interface_t interface) · 202 unmodified lines | ||
| 203 | 203 | |
| 204 | 204 | struct device; |
| 205 | 205 | struct phylink; |
| 206 | +struct sfp_bus; | |
| 207 | +struct sfp_upstream_ops; | |
| 206 | 208 | struct sk_buff; |
| 207 | 209 | |
| 208 | 210 | /* |
| @@ -342,6 +344,8 @@ struct phy_c45_device_ids { · 133 unmodified lines | ||
| 342 | 344 | * dev_flags: Device-specific flags used by the PHY driver. |
| 343 | 345 | * irq: IRQ number of the PHY's interrupt (-1 if none) |
| 344 | 346 | * phy_timer: The timer for handling the state machine |
| 347 | + * sfp_bus_attached: flag indicating whether the SFP bus has been attached | |
| 348 | + * sfp_bus: SFP bus attached to this PHY's fiber port | |
| 345 | 349 | * attached_dev: The attached enet driver's device instance ptr |
| 346 | 350 | * adjust_link: Callback for the enet controller to respond to |
| 347 | 351 | * changes in the link state. |
| @@ -432,6 +436,9 @@ struct phy_device { · 84 unmodified lines | ||
| 432 | 436 | |
| 433 | 437 | struct mutex lock; |
| 434 | 438 | |
| 439 | + /* This may be modified under the rtnl lock */ | |
| 440 | + bool sfp_bus_attached; | |
| 441 | + struct sfp_bus *sfp_bus; | |
| 435 | 442 | struct phylink *phylink; |
| 436 | 443 | struct net_device *attached_dev; |
| 437 | 444 | |
| @@ -993,7 +1000,7 @@ int phy_modify_paged_changed(struct phy_device *phydev, int page, u32 regnum, · 555 unmodified lines | ||
| 993 | 1000 | int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum, |
| 994 | 1001 | u16 mask, u16 set); |
| 995 | 1002 | |
| 996 | −struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, | |
| 1003 | +struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, | |
| 997 | 1004 | bool is_c45, |
| 998 | 1005 | struct phy_c45_device_ids *c45_ids); |
| 999 | 1006 | #if IS_ENABLED(CONFIG_PHYLIB) |
| @@ -1020,6 +1027,10 @@ int phy_suspend(struct phy_device *phydev); · 20 unmodified lines | ||
| 1020 | 1027 | int phy_resume(struct phy_device *phydev); |
| 1021 | 1028 | int __phy_resume(struct phy_device *phydev); |
| 1022 | 1029 | int phy_loopback(struct phy_device *phydev, bool enable); |
| 1030 | +void phy_sfp_attach(void *upstream, struct sfp_bus *bus); | |
| 1031 | +void phy_sfp_detach(void *upstream, struct sfp_bus *bus); | |
| 1032 | +int phy_sfp_probe(struct phy_device *phydev, | |
| 1033 | + const struct sfp_upstream_ops *ops); | |
| 1023 | 1034 | struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, |
| 1024 | 1035 | phy_interface_t interface); |
| 1025 | 1036 | struct phy_device *phy_find_first(struct mii_bus *bus); |
| @@ -1065,6 +1076,16 @@ static inline const char *phydev_name(const struct phy_device *phydev) · 39 unmodified lines | ||
| 1065 | 1076 | return dev_name(&phydev->mdio.dev); |
| 1066 | 1077 | } |
| 1067 | 1078 | |
| 1079 | +static inline void phy_lock_mdio_bus(struct phy_device *phydev) | |
| 1080 | +{ | |
| 1081 | + mutex_lock(&phydev->mdio.bus->mdio_lock); | |
| 1082 | +} | |
| 1083 | + | |
| 1084 | +static inline void phy_unlock_mdio_bus(struct phy_device *phydev) | |
| 1085 | +{ | |
| 1086 | + mutex_unlock(&phydev->mdio.bus->mdio_lock); | |
| 1087 | +} | |
| 1088 | + | |
| 1068 | 1089 | void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) |
| 1069 | 1090 | __printf(2, 3); |
| 1070 | 1091 | void phy_attached_info(struct phy_device *phydev); |
| @@ -1106,6 +1127,10 @@ int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad, · 35 unmodified lines | ||
| 1106 | 1127 | int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum, |
| 1107 | 1128 | u16 regnum, u16 val); |
| 1108 | 1129 | |
| 1130 | +/* Clause 37 */ | |
| 1131 | +int genphy_c37_config_aneg(struct phy_device *phydev); | |
| 1132 | +int genphy_c37_read_status(struct phy_device *phydev); | |
| 1133 | + | |
| 1109 | 1134 | /* Clause 45 PHY */ |
| 1110 | 1135 | int genphy_c45_restart_aneg(struct phy_device *phydev); |
| 1111 | 1136 | int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart); |
| @@ -1145,7 +1170,6 @@ void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies); · 33 unmodified lines | ||
| 1145 | 1170 | void phy_mac_interrupt(struct phy_device *phydev); |
| 1146 | 1171 | void phy_start_machine(struct phy_device *phydev); |
| 1147 | 1172 | void phy_stop_machine(struct phy_device *phydev); |
| 1148 | −int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); | |
| 1149 | 1173 | void phy_ethtool_ksettings_get(struct phy_device *phydev, |
| 1150 | 1174 | struct ethtool_link_ksettings *cmd); |
| 1151 | 1175 | int phy_ethtool_ksettings_set(struct phy_device *phydev, |
| @@ -38,7 +38,8 @@ enum phy_mode { · 37 unmodified lines | ||
| 38 | 38 | PHY_MODE_PCIE, |
| 39 | 39 | PHY_MODE_ETHERNET, |
| 40 | 40 | PHY_MODE_MIPI_DPHY, |
| 41 | − PHY_MODE_SATA | |
| 41 | + PHY_MODE_SATA, | |
| 42 | + PHY_MODE_LVDS, | |
| 42 | 43 | }; |
| 43 | 44 | |
| 44 | 45 | /** |
| @@ -18,5 +18,7 @@ int tegra_xusb_padctl_hsic_set_idle(struct tegra_xusb_padctl *padctl, · 17 unmodified lines | ||
| 18 | 18 | unsigned int port, bool idle); |
| 19 | 19 | int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl, |
| 20 | 20 | unsigned int port, bool enable); |
| 21 | − | |
| 21 | +int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl, | |
| 22 | + bool val); | |
| 23 | +int tegra_phy_xusb_utmi_port_reset(struct phy *phy); | |
| 22 | 24 | #endif /* PHY_TEGRA_XUSB_H */ |
| @@ -14,7 +14,7 @@ struct phy_device; · 13 unmodified lines | ||
| 14 | 14 | #define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 11 |
| 15 | 15 | |
| 16 | 16 | #define PHY_LINK_LED_TRIGGER_NAME_SIZE (MII_BUS_ID_SIZE + \ |
| 17 | − FIELD_SIZEOF(struct mdio_device, addr)+\ | |
| 17 | + sizeof_field(struct mdio_device, addr)+\ | |
| 18 | 18 | PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE) |
| 19 | 19 | |
| 20 | 20 | struct phy_led_trigger { |
| @@ -72,7 +72,7 @@ struct phylink_config { · 71 unmodified lines | ||
| 72 | 72 | /** |
| 73 | 73 | * struct phylink_mac_ops - MAC operations structure. |
| 74 | 74 | * @validate: Validate and update the link configuration. |
| 75 | − * @mac_link_state: Read the current link state from the hardware. | |
| 75 | + * @mac_pcs_get_state: Read the current link state from the hardware. | |
| 76 | 76 | * @mac_config: configure the MAC for the selected mode and state. |
| 77 | 77 | * @mac_an_restart: restart 802.3z BaseX autonegotiation. |
| 78 | 78 | * @mac_link_down: take the link down. |
| @@ -84,8 +84,8 @@ struct phylink_mac_ops { · 5 unmodified lines | ||
| 84 | 84 | void (*validate)(struct phylink_config *config, |
| 85 | 85 | unsigned long *supported, |
| 86 | 86 | struct phylink_link_state *state); |
| 87 | − int (*mac_link_state)(struct phylink_config *config, | |
| 88 | − struct phylink_link_state *state); | |
| 87 | + void (*mac_pcs_get_state)(struct phylink_config *config, | |
| 88 | + struct phylink_link_state *state); | |
| 89 | 89 | void (*mac_config)(struct phylink_config *config, unsigned int mode, |
| 90 | 90 | const struct phylink_link_state *state); |
| 91 | 91 | void (*mac_an_restart)(struct phylink_config *config); |
| @@ -127,18 +127,19 @@ void validate(struct phylink_config *config, unsigned long *supported, · 35 unmodified lines | ||
| 127 | 127 | struct phylink_link_state *state); |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | − * mac_link_state() - Read the current link state from the hardware | |
| 130 | + * mac_pcs_get_state() - Read the current inband link state from the hardware | |
| 131 | 131 | * @config: a pointer to a &struct phylink_config. |
| 132 | 132 | * @state: a pointer to a &struct phylink_link_state. |
| 133 | 133 | * |
| 134 | − * Read the current link state from the MAC, reporting the current | |
| 135 | − * speed in @state->speed, duplex mode in @state->duplex, pause mode | |
| 136 | − * in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits, | |
| 137 | − * negotiation completion state in @state->an_complete, and link | |
| 138 | − * up state in @state->link. | |
| 134 | + * Read the current inband link state from the MAC PCS, reporting the | |
| 135 | + * current speed in @state->speed, duplex mode in @state->duplex, pause | |
| 136 | + * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits, | |
| 137 | + * negotiation completion state in @state->an_complete, and link up state | |
| 138 | + * in @state->link. If possible, @state->lp_advertising should also be | |
| 139 | + * populated. | |
| 139 | 140 | */ |
| 140 | −int mac_link_state(struct phylink_config *config, | |
| 141 | − struct phylink_link_state *state); | |
| 141 | +void mac_pcs_get_state(struct phylink_config *config, | |
| 142 | + struct phylink_link_state *state); | |
| 142 | 143 | |
| 143 | 144 | /** |
| 144 | 145 | * mac_config() - configure the MAC for the selected mode and state |
| @@ -166,7 +167,7 @@ int mac_link_state(struct phylink_config *config, · 21 unmodified lines | ||
| 166 | 167 | * 1000base-X or Cisco SGMII mode depending on the @state->interface |
| 167 | 168 | * mode). In both cases, link state management (whether the link |
| 168 | 169 | * is up or not) is performed by the MAC, and reported via the |
| 169 | − * mac_link_state() callback. Changes in link state must be made | |
| 170 | + * mac_pcs_get_state() callback. Changes in link state must be made | |
| 170 | 171 | * by calling phylink_mac_change(). |
| 171 | 172 | * |
| 172 | 173 | * If in 802.3z mode, the link speed is fixed, dependent on the |
| @@ -85,6 +85,10 @@ static inline struct pid *get_pid(struct pid *pid) · 84 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | extern void put_pid(struct pid *pid); |
| 87 | 87 | extern struct task_struct *pid_task(struct pid *pid, enum pid_type); |
| 88 | +static inline bool pid_has_task(struct pid *pid, enum pid_type type) | |
| 89 | +{ | |
| 90 | + return !hlist_empty(&pid->tasks[type]); | |
| 91 | +} | |
| 88 | 92 | extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type); |
| 89 | 93 | |
| 90 | 94 | extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); |
| @@ -120,7 +124,8 @@ extern struct pid *find_vpid(int nr); · 29 unmodified lines | ||
| 120 | 124 | extern struct pid *find_get_pid(int nr); |
| 121 | 125 | extern struct pid *find_ge_pid(int nr, struct pid_namespace *); |
| 122 | 126 | |
| 123 | −extern struct pid *alloc_pid(struct pid_namespace *ns); | |
| 127 | +extern struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid, | |
| 128 | + size_t set_tid_size); | |
| 124 | 129 | extern void free_pid(struct pid *pid); |
| 125 | 130 | extern void disable_pid_allocation(struct pid_namespace *ns); |
| 126 | 131 | |
| @@ -12,6 +12,8 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/ns_common.h> |
| 13 | 13 | #include <linux/idr.h> |
| 14 | 14 | |
| 15 | +/* MAX_PID_NS_LEVEL is needed for limiting size of 'struct pid' */ | |
| 16 | +#define MAX_PID_NS_LEVEL 32 | |
| 15 | 17 | |
| 16 | 18 | struct fs_pin; |
| 17 | 19 | |
| @@ -30,14 +30,14 @@ struct pipe_buffer { · 29 unmodified lines | ||
| 30 | 30 | * struct pipe_inode_info - a linux kernel pipe |
| 31 | 31 | * @mutex: mutex protecting the whole thing |
| 32 | 32 | * @wait: reader/writer wait point in case of empty/full pipe |
| 33 | − * @nrbufs: the number of non-empty pipe buffers in this pipe | |
| 34 | − * @buffers: total number of buffers (should be a power of 2) | |
| 35 | − * @curbuf: the current pipe buffer entry | |
| 33 | + * @head: The point of buffer production | |
| 34 | + * @tail: The point of buffer consumption | |
| 35 | + * @max_usage: The maximum number of slots that may be used in the ring | |
| 36 | + * @ring_size: total number of buffers (should be a power of 2) | |
| 36 | 37 | * @tmp_page: cached released page |
| 37 | 38 | * @readers: number of current readers of this pipe |
| 38 | 39 | * @writers: number of current writers of this pipe |
| 39 | 40 | * @files: number of struct file referring this pipe (protected by ->i_lock) |
| 40 | − * @waiting_writers: number of writers blocked waiting for room | |
| 41 | 41 | * @r_counter: reader counter |
| 42 | 42 | * @w_counter: writer counter |
| 43 | 43 | * @fasync_readers: reader side fasync |
| @@ -48,11 +48,13 @@ struct pipe_buffer { · 4 unmodified lines | ||
| 48 | 48 | struct pipe_inode_info { |
| 49 | 49 | struct mutex mutex; |
| 50 | 50 | wait_queue_head_t wait; |
| 51 | − unsigned int nrbufs, curbuf, buffers; | |
| 51 | + unsigned int head; | |
| 52 | + unsigned int tail; | |
| 53 | + unsigned int max_usage; | |
| 54 | + unsigned int ring_size; | |
| 52 | 55 | unsigned int readers; |
| 53 | 56 | unsigned int writers; |
| 54 | 57 | unsigned int files; |
| 55 | − unsigned int waiting_writers; | |
| 56 | 58 | unsigned int r_counter; |
| 57 | 59 | unsigned int w_counter; |
| 58 | 60 | struct page *tmp_page; |
| @@ -104,6 +106,58 @@ struct pipe_buf_operations { · 45 unmodified lines | ||
| 104 | 106 | bool (*get)(struct pipe_inode_info *, struct pipe_buffer *); |
| 105 | 107 | }; |
| 106 | 108 | |
| 109 | +/** | |
| 110 | + * pipe_empty - Return true if the pipe is empty | |
| 111 | + * @head: The pipe ring head pointer | |
| 112 | + * @tail: The pipe ring tail pointer | |
| 113 | + */ | |
| 114 | +static inline bool pipe_empty(unsigned int head, unsigned int tail) | |
| 115 | +{ | |
| 116 | + return head == tail; | |
| 117 | +} | |
| 118 | + | |
| 119 | +/** | |
| 120 | + * pipe_occupancy - Return number of slots used in the pipe | |
| 121 | + * @head: The pipe ring head pointer | |
| 122 | + * @tail: The pipe ring tail pointer | |
| 123 | + */ | |
| 124 | +static inline unsigned int pipe_occupancy(unsigned int head, unsigned int tail) | |
| 125 | +{ | |
| 126 | + return head - tail; | |
| 127 | +} | |
| 128 | + | |
| 129 | +/** | |
| 130 | + * pipe_full - Return true if the pipe is full | |
| 131 | + * @head: The pipe ring head pointer | |
| 132 | + * @tail: The pipe ring tail pointer | |
| 133 | + * @limit: The maximum amount of slots available. | |
| 134 | + */ | |
| 135 | +static inline bool pipe_full(unsigned int head, unsigned int tail, | |
| 136 | + unsigned int limit) | |
| 137 | +{ | |
| 138 | + return pipe_occupancy(head, tail) >= limit; | |
| 139 | +} | |
| 140 | + | |
| 141 | +/** | |
| 142 | + * pipe_space_for_user - Return number of slots available to userspace | |
| 143 | + * @head: The pipe ring head pointer | |
| 144 | + * @tail: The pipe ring tail pointer | |
| 145 | + * @pipe: The pipe info structure | |
| 146 | + */ | |
| 147 | +static inline unsigned int pipe_space_for_user(unsigned int head, unsigned int tail, | |
| 148 | + struct pipe_inode_info *pipe) | |
| 149 | +{ | |
| 150 | + unsigned int p_occupancy, p_space; | |
| 151 | + | |
| 152 | + p_occupancy = pipe_occupancy(head, tail); | |
| 153 | + if (p_occupancy >= pipe->max_usage) | |
| 154 | + return 0; | |
| 155 | + p_space = pipe->ring_size - p_occupancy; | |
| 156 | + if (p_space > pipe->max_usage) | |
| 157 | + p_space = pipe->max_usage; | |
| 158 | + return p_space; | |
| 159 | +} | |
| 160 | + | |
| 107 | 161 | /** |
| 108 | 162 | * pipe_buf_get - get a reference to a pipe_buffer |
| 109 | 163 | * @pipe: the pipe that the buffer belongs to |
| @@ -556,6 +556,9 @@ enum host_event_code { · 555 unmodified lines | ||
| 556 | 556 | /* Keyboard recovery combo with hardware reinitialization */ |
| 557 | 557 | EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT = 30, |
| 558 | 558 | |
| 559 | + /* WoV */ | |
| 560 | + EC_HOST_EVENT_WOV = 31, | |
| 561 | + | |
| 559 | 562 | /* |
| 560 | 563 | * The high bit of the event mask is not used as a host event code. If |
| 561 | 564 | * it reads back as set, then the entire event mask should be |
| @@ -1277,8 +1280,6 @@ enum ec_feature_code { · 715 unmodified lines | ||
| 1277 | 1280 | * MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. |
| 1278 | 1281 | */ |
| 1279 | 1282 | EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, |
| 1280 | − /* EC supports audio codec. */ | |
| 1281 | − EC_FEATURE_AUDIO_CODEC = 38, | |
| 1282 | 1283 | /* The MCU is a System Companion Processor (SCP). */ |
| 1283 | 1284 | EC_FEATURE_SCP = 39, |
| 1284 | 1285 | /* The MCU is an Integrated Sensor Hub */ |
| @@ -4468,92 +4469,246 @@ enum mkbp_cec_event { · 3183 unmodified lines | ||
| 4468 | 4469 | |
| 4469 | 4470 | /*****************************************************************************/ |
| 4470 | 4471 | |
| 4471 | −/* Commands for I2S recording on audio codec. */ | |
| 4472 | +/* Commands for audio codec. */ | |
| 4473 | +#define EC_CMD_EC_CODEC 0x00BC | |
| 4472 | 4474 | |
| 4473 | −#define EC_CMD_CODEC_I2S 0x00BC | |
| 4474 | −#define EC_WOV_I2S_SAMPLE_RATE 48000 | |
| 4475 | +enum ec_codec_subcmd { | |
| 4476 | + EC_CODEC_GET_CAPABILITIES = 0x0, | |
| 4477 | + EC_CODEC_GET_SHM_ADDR = 0x1, | |
| 4478 | + EC_CODEC_SET_SHM_ADDR = 0x2, | |
| 4479 | + EC_CODEC_SUBCMD_COUNT, | |
| 4480 | +}; | |
| 4475 | 4481 | |
| 4476 | −enum ec_codec_i2s_subcmd { | |
| 4477 | − EC_CODEC_SET_SAMPLE_DEPTH = 0x0, | |
| 4478 | − EC_CODEC_SET_GAIN = 0x1, | |
| 4479 | − EC_CODEC_GET_GAIN = 0x2, | |
| 4480 | − EC_CODEC_I2S_ENABLE = 0x3, | |
| 4481 | − EC_CODEC_I2S_SET_CONFIG = 0x4, | |
| 4482 | − EC_CODEC_I2S_SET_TDM_CONFIG = 0x5, | |
| 4483 | − EC_CODEC_I2S_SET_BCLK = 0x6, | |
| 4484 | − EC_CODEC_I2S_SUBCMD_COUNT = 0x7, | |
| 4482 | +enum ec_codec_cap { | |
| 4483 | + EC_CODEC_CAP_WOV_AUDIO_SHM = 0, | |
| 4484 | + EC_CODEC_CAP_WOV_LANG_SHM = 1, | |
| 4485 | + EC_CODEC_CAP_LAST = 32, | |
| 4485 | 4486 | }; |
| 4486 | 4487 | |
| 4487 | −enum ec_sample_depth_value { | |
| 4488 | − EC_CODEC_SAMPLE_DEPTH_16 = 0, | |
| 4489 | − EC_CODEC_SAMPLE_DEPTH_24 = 1, | |
| 4488 | +enum ec_codec_shm_id { | |
| 4489 | + EC_CODEC_SHM_ID_WOV_AUDIO = 0x0, | |
| 4490 | + EC_CODEC_SHM_ID_WOV_LANG = 0x1, | |
| 4491 | + EC_CODEC_SHM_ID_LAST, | |
| 4490 | 4492 | }; |
| 4491 | 4493 | |
| 4492 | −enum ec_i2s_config { | |
| 4493 | − EC_DAI_FMT_I2S = 0, | |
| 4494 | − EC_DAI_FMT_RIGHT_J = 1, | |
| 4495 | − EC_DAI_FMT_LEFT_J = 2, | |
| 4496 | − EC_DAI_FMT_PCM_A = 3, | |
| 4497 | − EC_DAI_FMT_PCM_B = 4, | |
| 4498 | − EC_DAI_FMT_PCM_TDM = 5, | |
| 4494 | +enum ec_codec_shm_type { | |
| 4495 | + EC_CODEC_SHM_TYPE_EC_RAM = 0x0, | |
| 4496 | + EC_CODEC_SHM_TYPE_SYSTEM_RAM = 0x1, | |
| 4499 | 4497 | }; |
| 4500 | 4498 | |
| 4501 | −/* | |
| 4502 | − * For subcommand EC_CODEC_GET_GAIN. | |
| 4503 | − */ | |
| 4504 | −struct __ec_align1 ec_codec_i2s_gain { | |
| 4499 | +struct __ec_align1 ec_param_ec_codec_get_shm_addr { | |
| 4500 | + uint8_t shm_id; | |
| 4501 | + uint8_t reserved[3]; | |
| 4502 | +}; | |
| 4503 | + | |
| 4504 | +struct __ec_align4 ec_param_ec_codec_set_shm_addr { | |
| 4505 | + uint64_t phys_addr; | |
| 4506 | + uint32_t len; | |
| 4507 | + uint8_t shm_id; | |
| 4508 | + uint8_t reserved[3]; | |
| 4509 | +}; | |
| 4510 | + | |
| 4511 | +struct __ec_align4 ec_param_ec_codec { | |
| 4512 | + uint8_t cmd; /* enum ec_codec_subcmd */ | |
| 4513 | + uint8_t reserved[3]; | |
| 4514 | + | |
| 4515 | + union { | |
| 4516 | + struct ec_param_ec_codec_get_shm_addr | |
| 4517 | + get_shm_addr_param; | |
| 4518 | + struct ec_param_ec_codec_set_shm_addr | |
| 4519 | + set_shm_addr_param; | |
| 4520 | + }; | |
| 4521 | +}; | |
| 4522 | + | |
| 4523 | +struct __ec_align4 ec_response_ec_codec_get_capabilities { | |
| 4524 | + uint32_t capabilities; | |
| 4525 | +}; | |
| 4526 | + | |
| 4527 | +struct __ec_align4 ec_response_ec_codec_get_shm_addr { | |
| 4528 | + uint64_t phys_addr; | |
| 4529 | + uint32_t len; | |
| 4530 | + uint8_t type; | |
| 4531 | + uint8_t reserved[3]; | |
| 4532 | +}; | |
| 4533 | + | |
| 4534 | +/*****************************************************************************/ | |
| 4535 | + | |
| 4536 | +/* Commands for DMIC on audio codec. */ | |
| 4537 | +#define EC_CMD_EC_CODEC_DMIC 0x00BD | |
| 4538 | + | |
| 4539 | +enum ec_codec_dmic_subcmd { | |
| 4540 | + EC_CODEC_DMIC_GET_MAX_GAIN = 0x0, | |
| 4541 | + EC_CODEC_DMIC_SET_GAIN_IDX = 0x1, | |
| 4542 | + EC_CODEC_DMIC_GET_GAIN_IDX = 0x2, | |
| 4543 | + EC_CODEC_DMIC_SUBCMD_COUNT, | |
| 4544 | +}; | |
| 4545 | + | |
| 4546 | +enum ec_codec_dmic_channel { | |
| 4547 | + EC_CODEC_DMIC_CHANNEL_0 = 0x0, | |
| 4548 | + EC_CODEC_DMIC_CHANNEL_1 = 0x1, | |
| 4549 | + EC_CODEC_DMIC_CHANNEL_2 = 0x2, | |
| 4550 | + EC_CODEC_DMIC_CHANNEL_3 = 0x3, | |
| 4551 | + EC_CODEC_DMIC_CHANNEL_4 = 0x4, | |
| 4552 | + EC_CODEC_DMIC_CHANNEL_5 = 0x5, | |
| 4553 | + EC_CODEC_DMIC_CHANNEL_6 = 0x6, | |
| 4554 | + EC_CODEC_DMIC_CHANNEL_7 = 0x7, | |
| 4555 | + EC_CODEC_DMIC_CHANNEL_COUNT, | |
| 4556 | +}; | |
| 4557 | + | |
| 4558 | +struct __ec_align1 ec_param_ec_codec_dmic_set_gain_idx { | |
| 4559 | + uint8_t channel; /* enum ec_codec_dmic_channel */ | |
| 4560 | + uint8_t gain; | |
| 4561 | + uint8_t reserved[2]; | |
| 4562 | +}; | |
| 4563 | + | |
| 4564 | +struct __ec_align1 ec_param_ec_codec_dmic_get_gain_idx { | |
| 4565 | + uint8_t channel; /* enum ec_codec_dmic_channel */ | |
| 4566 | + uint8_t reserved[3]; | |
| 4567 | +}; | |
| 4568 | + | |
| 4569 | +struct __ec_align4 ec_param_ec_codec_dmic { | |
| 4570 | + uint8_t cmd; /* enum ec_codec_dmic_subcmd */ | |
| 4571 | + uint8_t reserved[3]; | |
| 4572 | + | |
| 4573 | + union { | |
| 4574 | + struct ec_param_ec_codec_dmic_set_gain_idx | |
| 4575 | + set_gain_idx_param; | |
| 4576 | + struct ec_param_ec_codec_dmic_get_gain_idx | |
| 4577 | + get_gain_idx_param; | |
| 4578 | + }; | |
| 4579 | +}; | |
| 4580 | + | |
| 4581 | +struct __ec_align1 ec_response_ec_codec_dmic_get_max_gain { | |
| 4582 | + uint8_t max_gain; | |
| 4583 | +}; | |
| 4584 | + | |
| 4585 | +struct __ec_align1 ec_response_ec_codec_dmic_get_gain_idx { | |
| 4586 | + uint8_t gain; | |
| 4587 | +}; | |
| 4588 | + | |
| 4589 | +/*****************************************************************************/ | |
| 4590 | + | |
| 4591 | +/* Commands for I2S RX on audio codec. */ | |
| 4592 | + | |
| 4593 | +#define EC_CMD_EC_CODEC_I2S_RX 0x00BE | |
| 4594 | + | |
| 4595 | +enum ec_codec_i2s_rx_subcmd { | |
| 4596 | + EC_CODEC_I2S_RX_ENABLE = 0x0, | |
| 4597 | + EC_CODEC_I2S_RX_DISABLE = 0x1, | |
| 4598 | + EC_CODEC_I2S_RX_SET_SAMPLE_DEPTH = 0x2, | |
| 4599 | + EC_CODEC_I2S_RX_SET_DAIFMT = 0x3, | |
| 4600 | + EC_CODEC_I2S_RX_SET_BCLK = 0x4, | |
| 4601 | + EC_CODEC_I2S_RX_SUBCMD_COUNT, | |
| 4602 | +}; | |
| 4603 | + | |
| 4604 | +enum ec_codec_i2s_rx_sample_depth { | |
| 4605 | + EC_CODEC_I2S_RX_SAMPLE_DEPTH_16 = 0x0, | |
| 4606 | + EC_CODEC_I2S_RX_SAMPLE_DEPTH_24 = 0x1, | |
| 4607 | + EC_CODEC_I2S_RX_SAMPLE_DEPTH_COUNT, | |
| 4608 | +}; | |
| 4609 | + | |
| 4610 | +enum ec_codec_i2s_rx_daifmt { | |
| 4611 | + EC_CODEC_I2S_RX_DAIFMT_I2S = 0x0, | |
| 4612 | + EC_CODEC_I2S_RX_DAIFMT_RIGHT_J = 0x1, | |
| 4613 | + EC_CODEC_I2S_RX_DAIFMT_LEFT_J = 0x2, | |
| 4614 | + EC_CODEC_I2S_RX_DAIFMT_COUNT, | |
| 4615 | +}; | |
| 4616 | + | |
| 4617 | +struct __ec_align1 ec_param_ec_codec_i2s_rx_set_sample_depth { | |
| 4618 | + uint8_t depth; | |
| 4619 | + uint8_t reserved[3]; | |
| 4620 | +}; | |
| 4621 | + | |
| 4622 | +struct __ec_align1 ec_param_ec_codec_i2s_rx_set_gain { | |
| 4505 | 4623 | uint8_t left; |
| 4506 | 4624 | uint8_t right; |
| 4625 | + uint8_t reserved[2]; | |
| 4507 | 4626 | }; |
| 4508 | 4627 | |
| 4509 | −struct __ec_todo_unpacked ec_param_codec_i2s_tdm { | |
| 4510 | − int16_t ch0_delay; /* 0 to 496 */ | |
| 4511 | − int16_t ch1_delay; /* -1 to 496 */ | |
| 4512 | − uint8_t adjacent_to_ch0; | |
| 4513 | − uint8_t adjacent_to_ch1; | |
| 4628 | +struct __ec_align1 ec_param_ec_codec_i2s_rx_set_daifmt { | |
| 4629 | + uint8_t daifmt; | |
| 4630 | + uint8_t reserved[3]; | |
| 4514 | 4631 | }; |
| 4515 | 4632 | |
| 4516 | −struct __ec_todo_packed ec_param_codec_i2s { | |
| 4517 | − /* enum ec_codec_i2s_subcmd */ | |
| 4518 | − uint8_t cmd; | |
| 4633 | +struct __ec_align4 ec_param_ec_codec_i2s_rx_set_bclk { | |
| 4634 | + uint32_t bclk; | |
| 4635 | +}; | |
| 4636 | + | |
| 4637 | +struct __ec_align4 ec_param_ec_codec_i2s_rx { | |
| 4638 | + uint8_t cmd; /* enum ec_codec_i2s_rx_subcmd */ | |
| 4639 | + uint8_t reserved[3]; | |
| 4640 | + | |
| 4519 | 4641 | union { |
| 4520 | − /* | |
| 4521 | − * EC_CODEC_SET_SAMPLE_DEPTH | |
| 4522 | − * Value should be one of ec_sample_depth_value. | |
| 4523 | − */ | |
| 4524 | − uint8_t depth; | |
| 4642 | + struct ec_param_ec_codec_i2s_rx_set_sample_depth | |
| 4643 | + set_sample_depth_param; | |
| 4644 | + struct ec_param_ec_codec_i2s_rx_set_daifmt | |
| 4645 | + set_daifmt_param; | |
| 4646 | + struct ec_param_ec_codec_i2s_rx_set_bclk | |
| 4647 | + set_bclk_param; | |
| 4648 | + }; | |
| 4649 | +}; | |
| 4525 | 4650 | |
| 4526 | − /* | |
| 4527 | − * EC_CODEC_SET_GAIN | |
| 4528 | − * Value should be 0~43 for both channels. | |
| 4529 | − */ | |
| 4530 | − struct ec_codec_i2s_gain gain; | |
| 4651 | +/*****************************************************************************/ | |
| 4652 | +/* Commands for WoV on audio codec. */ | |
| 4653 | + | |
| 4654 | +#define EC_CMD_EC_CODEC_WOV 0x00BF | |
| 4655 | + | |
| 4656 | +enum ec_codec_wov_subcmd { | |
| 4657 | + EC_CODEC_WOV_SET_LANG = 0x0, | |
| 4658 | + EC_CODEC_WOV_SET_LANG_SHM = 0x1, | |
| 4659 | + EC_CODEC_WOV_GET_LANG = 0x2, | |
| 4660 | + EC_CODEC_WOV_ENABLE = 0x3, | |
| 4661 | + EC_CODEC_WOV_DISABLE = 0x4, | |
| 4662 | + EC_CODEC_WOV_READ_AUDIO = 0x5, | |
| 4663 | + EC_CODEC_WOV_READ_AUDIO_SHM = 0x6, | |
| 4664 | + EC_CODEC_WOV_SUBCMD_COUNT, | |
| 4665 | +}; | |
| 4531 | 4666 | |
| 4532 | − /* | |
| 4533 | − * EC_CODEC_I2S_ENABLE | |
| 4534 | − * 1 to enable, 0 to disable. | |
| 4535 | − */ | |
| 4536 | − uint8_t i2s_enable; | |
| 4667 | +/* | |
| 4668 | + * @hash is SHA256 of the whole language model. | |
| 4669 | + * @total_len indicates the length of whole language model. | |
| 4670 | + * @offset is the cursor from the beginning of the model. | |
| 4671 | + * @buf is the packet buffer. | |
| 4672 | + * @len denotes how many bytes in the buf. | |
| 4673 | + */ | |
| 4674 | +struct __ec_align4 ec_param_ec_codec_wov_set_lang { | |
| 4675 | + uint8_t hash[32]; | |
| 4676 | + uint32_t total_len; | |
| 4677 | + uint32_t offset; | |
| 4678 | + uint8_t buf[128]; | |
| 4679 | + uint32_t len; | |
| 4680 | +}; | |
| 4537 | 4681 | |
| 4538 | − /* | |
| 4539 | − * EC_CODEC_I2S_SET_CONFIG | |
| 4540 | − * Value should be one of ec_i2s_config. | |
| 4541 | − */ | |
| 4542 | − uint8_t i2s_config; | |
| 4682 | +struct __ec_align4 ec_param_ec_codec_wov_set_lang_shm { | |
| 4683 | + uint8_t hash[32]; | |
| 4684 | + uint32_t total_len; | |
| 4685 | +}; | |
| 4543 | 4686 | |
| 4544 | − /* | |
| 4545 | − * EC_CODEC_I2S_SET_TDM_CONFIG | |
| 4546 | − * Value should be one of ec_i2s_config. | |
| 4547 | − */ | |
| 4548 | − struct ec_param_codec_i2s_tdm tdm_param; | |
| 4687 | +struct __ec_align4 ec_param_ec_codec_wov { | |
| 4688 | + uint8_t cmd; /* enum ec_codec_wov_subcmd */ | |
| 4689 | + uint8_t reserved[3]; | |
| 4549 | 4690 | |
| 4550 | − /* | |
| 4551 | − * EC_CODEC_I2S_SET_BCLK | |
| 4552 | − */ | |
| 4553 | − uint32_t bclk; | |
| 4691 | + union { | |
| 4692 | + struct ec_param_ec_codec_wov_set_lang | |
| 4693 | + set_lang_param; | |
| 4694 | + struct ec_param_ec_codec_wov_set_lang_shm | |
| 4695 | + set_lang_shm_param; | |
| 4554 | 4696 | }; |
| 4555 | 4697 | }; |
| 4556 | 4698 | |
| 4699 | +struct __ec_align4 ec_response_ec_codec_wov_get_lang { | |
| 4700 | + uint8_t hash[32]; | |
| 4701 | +}; | |
| 4702 | + | |
| 4703 | +struct __ec_align4 ec_response_ec_codec_wov_read_audio { | |
| 4704 | + uint8_t buf[128]; | |
| 4705 | + uint32_t len; | |
| 4706 | +}; | |
| 4707 | + | |
| 4708 | +struct __ec_align4 ec_response_ec_codec_wov_read_audio_shm { | |
| 4709 | + uint32_t offset; | |
| 4710 | + uint32_t len; | |
| 4711 | +}; | |
| 4557 | 4712 | |
| 4558 | 4713 | /*****************************************************************************/ |
| 4559 | 4714 | /* System commands */ |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/mutex.h> |
| 13 | 13 | #include <linux/notifier.h> |
| 14 | 14 | |
| 15 | +#include <linux/mfd/cros_ec.h> | |
| 15 | 16 | #include <linux/platform_data/cros_ec_commands.h> |
| 16 | 17 | |
| 17 | 18 | #define CROS_EC_DEV_NAME "cros_ec" |
| @@ -115,12 +116,16 @@ struct cros_ec_command { · 97 unmodified lines | ||
| 115 | 116 | * code. |
| 116 | 117 | * @pkt_xfer: Send packet to EC and get response. |
| 117 | 118 | * @lock: One transaction at a time. |
| 118 | − * @mkbp_event_supported: True if this EC supports the MKBP event protocol. | |
| 119 | + * @mkbp_event_supported: 0 if MKBP not supported. Otherwise its value is | |
| 120 | + * the maximum supported version of the MKBP host event | |
| 121 | + * command + 1. | |
| 119 | 122 | * @host_sleep_v1: True if this EC supports the sleep v1 command. |
| 120 | 123 | * @event_notifier: Interrupt event notifier for transport devices. |
| 121 | 124 | * @event_data: Raw payload transferred with the MKBP event. |
| 122 | 125 | * @event_size: Size in bytes of the event data. |
| 123 | 126 | * @host_event_wake_mask: Mask of host events that cause wake from suspend. |
| 127 | + * @last_event_time: exact time from the hard irq when we got notified of | |
| 128 | + * a new event. | |
| 124 | 129 | * @ec: The platform_device used by the mfd driver to interface with the |
| 125 | 130 | * main EC. |
| 126 | 131 | * @pd: The platform_device used by the mfd driver to interface with the |
| @@ -153,7 +158,7 @@ struct cros_ec_device { · 26 unmodified lines | ||
| 153 | 158 | int (*pkt_xfer)(struct cros_ec_device *ec, |
| 154 | 159 | struct cros_ec_command *msg); |
| 155 | 160 | struct mutex lock; |
| 156 | − bool mkbp_event_supported; | |
| 161 | + u8 mkbp_event_supported; | |
| 157 | 162 | bool host_sleep_v1; |
| 158 | 163 | struct blocking_notifier_head event_notifier; |
| 159 | 164 | |
| @@ -161,20 +166,13 @@ struct cros_ec_device { · 1 unmodified line | ||
| 161 | 166 | int event_size; |
| 162 | 167 | u32 host_event_wake_mask; |
| 163 | 168 | u32 last_resume_result; |
| 169 | + ktime_t last_event_time; | |
| 164 | 170 | |
| 165 | 171 | /* The platform devices used by the mfd driver */ |
| 166 | 172 | struct platform_device *ec; |
| 167 | 173 | struct platform_device *pd; |
| 168 | 174 | }; |
| 169 | 175 | |
| 170 | −/** | |
| 171 | − * struct cros_ec_sensor_platform - ChromeOS EC sensor platform information. | |
| 172 | − * @sensor_num: Id of the sensor, as reported by the EC. | |
| 173 | − */ | |
| 174 | −struct cros_ec_sensor_platform { | |
| 175 | − u8 sensor_num; | |
| 176 | −}; | |
| 177 | − | |
| 178 | 176 | /** |
| 179 | 177 | * struct cros_ec_platform - ChromeOS EC platform information. |
| 180 | 178 | * @ec_name: Name of EC device (e.g. 'cros-ec', 'cros-pd', ...) |
| @@ -187,133 +185,51 @@ struct cros_ec_platform { · 6 unmodified lines | ||
| 187 | 185 | u16 cmd_offset; |
| 188 | 186 | }; |
| 189 | 187 | |
| 190 | −/** | |
| 191 | − * cros_ec_suspend() - Handle a suspend operation for the ChromeOS EC device. | |
| 192 | − * @ec_dev: Device to suspend. | |
| 193 | − * | |
| 194 | − * This can be called by drivers to handle a suspend event. | |
| 195 | − * | |
| 196 | − * Return: 0 on success or negative error code. | |
| 197 | − */ | |
| 198 | 188 | int cros_ec_suspend(struct cros_ec_device *ec_dev); |
| 199 | 189 | |
| 200 | −/** | |
| 201 | − * cros_ec_resume() - Handle a resume operation for the ChromeOS EC device. | |
| 202 | − * @ec_dev: Device to resume. | |
| 203 | − * | |
| 204 | − * This can be called by drivers to handle a resume event. | |
| 205 | − * | |
| 206 | − * Return: 0 on success or negative error code. | |
| 207 | − */ | |
| 208 | 190 | int cros_ec_resume(struct cros_ec_device *ec_dev); |
| 209 | 191 | |
| 210 | −/** | |
| 211 | − * cros_ec_prepare_tx() - Prepare an outgoing message in the output buffer. | |
| 212 | − * @ec_dev: Device to register. | |
| 213 | − * @msg: Message to write. | |
| 214 | − * | |
| 215 | − * This is intended to be used by all ChromeOS EC drivers, but at present | |
| 216 | − * only SPI uses it. Once LPC uses the same protocol it can start using it. | |
| 217 | − * I2C could use it now, with a refactor of the existing code. | |
| 218 | − * | |
| 219 | − * Return: 0 on success or negative error code. | |
| 220 | − */ | |
| 221 | 192 | int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, |
| 222 | 193 | struct cros_ec_command *msg); |
| 223 | 194 | |
| 224 | −/** | |
| 225 | − * cros_ec_check_result() - Check ec_msg->result. | |
| 226 | − * @ec_dev: EC device. | |
| 227 | − * @msg: Message to check. | |
| 228 | − * | |
| 229 | − * This is used by ChromeOS EC drivers to check the ec_msg->result for | |
| 230 | − * errors and to warn about them. | |
| 231 | − * | |
| 232 | − * Return: 0 on success or negative error code. | |
| 233 | − */ | |
| 234 | 195 | int cros_ec_check_result(struct cros_ec_device *ec_dev, |
| 235 | 196 | struct cros_ec_command *msg); |
| 236 | 197 | |
| 237 | −/** | |
| 238 | − * cros_ec_cmd_xfer() - Send a command to the ChromeOS EC. | |
| 239 | − * @ec_dev: EC device. | |
| 240 | − * @msg: Message to write. | |
| 241 | − * | |
| 242 | − * Call this to send a command to the ChromeOS EC. This should be used | |
| 243 | − * instead of calling the EC's cmd_xfer() callback directly. | |
| 244 | − * | |
| 245 | − * Return: 0 on success or negative error code. | |
| 246 | − */ | |
| 247 | 198 | int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev, |
| 248 | 199 | struct cros_ec_command *msg); |
| 249 | 200 | |
| 250 | −/** | |
| 251 | − * cros_ec_cmd_xfer_status() - Send a command to the ChromeOS EC. | |
| 252 | − * @ec_dev: EC device. | |
| 253 | − * @msg: Message to write. | |
| 254 | − * | |
| 255 | − * This function is identical to cros_ec_cmd_xfer, except it returns success | |
| 256 | − * status only if both the command was transmitted successfully and the EC | |
| 257 | − * replied with success status. It's not necessary to check msg->result when | |
| 258 | − * using this function. | |
| 259 | − * | |
| 260 | − * Return: The number of bytes transferred on success or negative error code. | |
| 261 | − */ | |
| 262 | 201 | int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev, |
| 263 | 202 | struct cros_ec_command *msg); |
| 264 | 203 | |
| 265 | −/** | |
| 266 | − * cros_ec_register() - Register a new ChromeOS EC, using the provided info. | |
| 267 | − * @ec_dev: Device to register. | |
| 268 | − * | |
| 269 | − * Before calling this, allocate a pointer to a new device and then fill | |
| 270 | − * in all the fields up to the --private-- marker. | |
| 271 | − * | |
| 272 | − * Return: 0 on success or negative error code. | |
| 273 | − */ | |
| 274 | 204 | int cros_ec_register(struct cros_ec_device *ec_dev); |
| 275 | 205 | |
| 276 | −/** | |
| 277 | − * cros_ec_unregister() - Remove a ChromeOS EC. | |
| 278 | − * @ec_dev: Device to unregister. | |
| 279 | − * | |
| 280 | − * Call this to deregister a ChromeOS EC, then clean up any private data. | |
| 281 | − * | |
| 282 | − * Return: 0 on success or negative error code. | |
| 283 | − */ | |
| 284 | 206 | int cros_ec_unregister(struct cros_ec_device *ec_dev); |
| 285 | 207 | |
| 286 | −/** | |
| 287 | − * cros_ec_query_all() - Query the protocol version supported by the | |
| 288 | − * ChromeOS EC. | |
| 289 | − * @ec_dev: Device to register. | |
| 290 | − * | |
| 291 | − * Return: 0 on success or negative error code. | |
| 292 | − */ | |
| 293 | 208 | int cros_ec_query_all(struct cros_ec_device *ec_dev); |
| 294 | 209 | |
| 295 | −/** | |
| 296 | − * cros_ec_get_next_event() - Fetch next event from the ChromeOS EC. | |
| 297 | − * @ec_dev: Device to fetch event from. | |
| 298 | − * @wake_event: Pointer to a bool set to true upon return if the event might be | |
| 299 | − * treated as a wake event. Ignored if null. | |
| 300 | − * | |
| 301 | − * Return: negative error code on errors; 0 for no data; or else number of | |
| 302 | − * bytes received (i.e., an event was retrieved successfully). Event types are | |
| 303 | − * written out to @ec_dev->event_data.event_type on success. | |
| 304 | − */ | |
| 305 | −int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event); | |
| 210 | +int cros_ec_get_next_event(struct cros_ec_device *ec_dev, | |
| 211 | + bool *wake_event, | |
| 212 | + bool *has_more_events); | |
| 213 | + | |
| 214 | +u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev); | |
| 215 | + | |
| 216 | +int cros_ec_check_features(struct cros_ec_dev *ec, int feature); | |
| 217 | + | |
| 218 | +int cros_ec_get_sensor_count(struct cros_ec_dev *ec); | |
| 219 | + | |
| 220 | +bool cros_ec_handle_event(struct cros_ec_device *ec_dev); | |
| 306 | 221 | |
| 307 | 222 | /** |
| 308 | − * cros_ec_get_host_event() - Return a mask of event set by the ChromeOS EC. | |
| 309 | − * @ec_dev: Device to fetch event from. | |
| 223 | + * cros_ec_get_time_ns() - Return time in ns. | |
| 310 | 224 | * |
| 311 | − * When MKBP is supported, when the EC raises an interrupt, we collect the | |
| 312 | − * events raised and call the functions in the ec notifier. This function | |
| 313 | − * is a helper to know which events are raised. | |
| 225 | + * This is the function used to record the time for last_event_time in struct | |
| 226 | + * cros_ec_device during the hard irq. | |
| 314 | 227 | * |
| 315 | − * Return: 0 on error or non-zero bitmask of one or more EC_HOST_EVENT_*. | |
| 228 | + * Return: ktime_t format since boot. | |
| 316 | 229 | */ |
| 317 | −u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev); | |
| 230 | +static inline ktime_t cros_ec_get_time_ns(void) | |
| 231 | +{ | |
| 232 | + return ktime_get_boottime_ns(); | |
| 233 | +} | |
| 318 | 234 | |
| 319 | 235 | #endif /* __LINUX_CROS_EC_PROTO_H */ |
| @@ -0,0 +1,30 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Chrome OS EC MEMS Sensor Hub driver. | |
| 4 | + * | |
| 5 | + * Copyright 2019 Google LLC | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H | |
| 9 | +#define __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H | |
| 10 | + | |
| 11 | +#include <linux/platform_data/cros_ec_commands.h> | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * struct cros_ec_sensor_platform - ChromeOS EC sensor platform information. | |
| 15 | + * @sensor_num: Id of the sensor, as reported by the EC. | |
| 16 | + */ | |
| 17 | +struct cros_ec_sensor_platform { | |
| 18 | + u8 sensor_num; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * struct cros_ec_sensorhub - Sensor Hub device data. | |
| 23 | + * | |
| 24 | + * @ec: Embedded Controller where the hub is located. | |
| 25 | + */ | |
| 26 | +struct cros_ec_sensorhub { | |
| 27 | + struct cros_ec_dev *ec; | |
| 28 | +}; | |
| 29 | + | |
| 30 | +#endif /* __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H */ | |
| @@ -9,9 +9,6 @@ struct device; · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | struct gpio_backlight_platform_data { |
| 11 | 11 | struct device *fbdev; |
| 12 | − int gpio; | |
| 13 | − int def_value; | |
| 14 | − const char *name; | |
| 15 | 12 | }; |
| 16 | 13 | |
| 17 | 14 | #endif |
| @@ -67,9 +67,6 @@ struct omap_hsmmc_platform_data { · 66 unmodified lines | ||
| 67 | 67 | /* string specifying a particular variant of hardware */ |
| 68 | 68 | char *version; |
| 69 | 69 | |
| 70 | − /* if we have special card, init it using this callback */ | |
| 71 | − void (*init_card)(struct mmc_card *card); | |
| 72 | − | |
| 73 | 70 | const char *name; |
| 74 | 71 | u32 ocr_mask; |
| 75 | 72 | }; |
| @@ -55,11 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | */ |
| 56 | 56 | #define I2C_ISR_INIT 0x7FF /* status register init */ |
| 57 | 57 | |
| 58 | −struct i2c_slave_client; | |
| 59 | − | |
| 60 | 58 | struct i2c_pxa_platform_data { |
| 61 | − unsigned int slave_addr; | |
| 62 | − struct i2c_slave_client *slave; | |
| 63 | 59 | unsigned int class; |
| 64 | 60 | unsigned int use_pio :1; |
| 65 | 61 | unsigned int fast_mode :1; |
| @@ -13,6 +13,7 @@ enum intel_spi_type { · 12 unmodified lines | ||
| 13 | 13 | INTEL_SPI_BYT = 1, |
| 14 | 14 | INTEL_SPI_LPT, |
| 15 | 15 | INTEL_SPI_BXT, |
| 16 | + INTEL_SPI_CNL, | |
| 16 | 17 | }; |
| 17 | 18 | |
| 18 | 19 | /** |
| @@ -1,64 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef _PIXCIR_I2C_TS_H | |
| 3 | −#define _PIXCIR_I2C_TS_H | |
| 4 | − | |
| 5 | −/* | |
| 6 | − * Register map | |
| 7 | − */ | |
| 8 | −#define PIXCIR_REG_POWER_MODE 51 | |
| 9 | −#define PIXCIR_REG_INT_MODE 52 | |
| 10 | − | |
| 11 | −/* | |
| 12 | − * Power modes: | |
| 13 | − * active: max scan speed | |
| 14 | − * idle: lower scan speed with automatic transition to active on touch | |
| 15 | − * halt: datasheet says sleep but this is more like halt as the chip | |
| 16 | − * clocks are cut and it can only be brought out of this mode | |
| 17 | − * using the RESET pin. | |
| 18 | − */ | |
| 19 | −enum pixcir_power_mode { | |
| 20 | − PIXCIR_POWER_ACTIVE, | |
| 21 | − PIXCIR_POWER_IDLE, | |
| 22 | − PIXCIR_POWER_HALT, | |
| 23 | −}; | |
| 24 | − | |
| 25 | −#define PIXCIR_POWER_MODE_MASK 0x03 | |
| 26 | −#define PIXCIR_POWER_ALLOW_IDLE (1UL << 2) | |
| 27 | − | |
| 28 | −/* | |
| 29 | − * Interrupt modes: | |
| 30 | − * periodical: interrupt is asserted periodicaly | |
| 31 | − * diff coordinates: interrupt is asserted when coordinates change | |
| 32 | − * level on touch: interrupt level asserted during touch | |
| 33 | − * pulse on touch: interrupt pulse asserted druing touch | |
| 34 | − * | |
| 35 | − */ | |
| 36 | −enum pixcir_int_mode { | |
| 37 | − PIXCIR_INT_PERIODICAL, | |
| 38 | − PIXCIR_INT_DIFF_COORD, | |
| 39 | − PIXCIR_INT_LEVEL_TOUCH, | |
| 40 | − PIXCIR_INT_PULSE_TOUCH, | |
| 41 | −}; | |
| 42 | − | |
| 43 | −#define PIXCIR_INT_MODE_MASK 0x03 | |
| 44 | −#define PIXCIR_INT_ENABLE (1UL << 3) | |
| 45 | −#define PIXCIR_INT_POL_HIGH (1UL << 2) | |
| 46 | − | |
| 47 | −/** | |
| 48 | − * struct pixcir_irc_chip_data - chip related data | |
| 49 | − * @max_fingers: Max number of fingers reported simultaneously by h/w | |
| 50 | − * @has_hw_ids: Hardware supports finger tracking IDs | |
| 51 | − * | |
| 52 | − */ | |
| 53 | −struct pixcir_i2c_chip_data { | |
| 54 | − u8 max_fingers; | |
| 55 | − bool has_hw_ids; | |
| 56 | −}; | |
| 57 | − | |
| 58 | −struct pixcir_ts_platform_data { | |
| 59 | − int x_max; | |
| 60 | − int y_max; | |
| 61 | − struct pixcir_i2c_chip_data chip; | |
| 62 | −}; | |
| 63 | − | |
| 64 | −#endif | |
| @@ -11,7 +11,6 @@ · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | /* Board specific platform_data */ |
| 13 | 13 | struct mtk_chip_config { |
| 14 | − u32 cs_pol; | |
| 15 | 14 | u32 sample_sel; |
| 16 | 15 | }; |
| 17 | 16 | #endif |
| @@ -18,12 +18,14 @@ · 17 unmodified lines | ||
| 18 | 18 | * @open_drain: set the interrupt line to be open drain if possible. |
| 19 | 19 | * @spi_3wire: enable spi-3wire mode. |
| 20 | 20 | * @pullups: enable/disable i2c controller pullup resistors. |
| 21 | + * @wakeup_source: enable/disable device as wakeup generator. | |
| 21 | 22 | */ |
| 22 | 23 | struct st_sensors_platform_data { |
| 23 | 24 | u8 drdy_int_pin; |
| 24 | 25 | bool open_drain; |
| 25 | 26 | bool spi_3wire; |
| 26 | 27 | bool pullups; |
| 28 | + bool wakeup_source; | |
| 27 | 29 | }; |
| 28 | 30 | |
| 29 | 31 | #endif /* ST_SENSORS_PDATA_H */ |
| @@ -0,0 +1,21 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | +/* | |
| 3 | + * TI PRM (Power & Reset Manager) platform data | |
| 4 | + * | |
| 5 | + * Copyright (C) 2019 Texas Instruments, Inc. | |
| 6 | + * | |
| 7 | + * Tero Kristo <t-kristo@ti.com> | |
| 8 | + */ | |
| 9 | + | |
| 10 | +#ifndef _LINUX_PLATFORM_DATA_TI_PRM_H | |
| 11 | +#define _LINUX_PLATFORM_DATA_TI_PRM_H | |
| 12 | + | |
| 13 | +struct clockdomain; | |
| 14 | + | |
| 15 | +struct ti_prm_platform_data { | |
| 16 | + void (*clkdm_deny_idle)(struct clockdomain *clkdm); | |
| 17 | + void (*clkdm_allow_idle)(struct clockdomain *clkdm); | |
| 18 | + struct clockdomain * (*clkdm_lookup)(const char *name); | |
| 19 | +}; | |
| 20 | + | |
| 21 | +#endif /* _LINUX_PLATFORM_DATA_TI_PRM_H */ | |
| @@ -49,6 +49,8 @@ struct sysc_regbits { · 48 unmodified lines | ||
| 49 | 49 | s8 emufree_shift; |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | +#define SYSC_QUIRK_FORCE_MSTANDBY BIT(20) | |
| 53 | +#define SYSC_MODULE_QUIRK_AESS BIT(19) | |
| 52 | 54 | #define SYSC_MODULE_QUIRK_SGX BIT(18) |
| 53 | 55 | #define SYSC_MODULE_QUIRK_HDQ1W BIT(17) |
| 54 | 56 | #define SYSC_MODULE_QUIRK_I2C BIT(16) |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | * @data_size: Size of the data buffer used for EC communication. |
| 30 | 30 | * @debugfs_pdev: The child platform_device used by the debugfs sub-driver. |
| 31 | 31 | * @rtc_pdev: The child platform_device used by the RTC sub-driver. |
| 32 | + * @charger_pdev: Child platform_device used by the charger config sub-driver. | |
| 32 | 33 | * @telem_pdev: The child platform_device used by the telemetry sub-driver. |
| 33 | 34 | */ |
| 34 | 35 | struct wilco_ec_device { |
| @@ -41,6 +42,7 @@ struct wilco_ec_device { · 6 unmodified lines | ||
| 41 | 42 | size_t data_size; |
| 42 | 43 | struct platform_device *debugfs_pdev; |
| 43 | 44 | struct platform_device *rtc_pdev; |
| 45 | + struct platform_device *charger_pdev; | |
| 44 | 46 | struct platform_device *telem_pdev; |
| 45 | 47 | }; |
| 46 | 48 | |
| @@ -120,6 +122,19 @@ struct wilco_ec_message { · 73 unmodified lines | ||
| 120 | 122 | */ |
| 121 | 123 | int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg); |
| 122 | 124 | |
| 125 | +/** | |
| 126 | + * wilco_keyboard_leds_init() - Set up the keyboard backlight LEDs. | |
| 127 | + * @ec: EC device to query. | |
| 128 | + * | |
| 129 | + * After this call, the keyboard backlight will be exposed through a an LED | |
| 130 | + * device at /sys/class/leds. | |
| 131 | + * | |
| 132 | + * This may sleep because it uses wilco_ec_mailbox(). | |
| 133 | + * | |
| 134 | + * Return: 0 on success, negative error code on failure. | |
| 135 | + */ | |
| 136 | +int wilco_keyboard_leds_init(struct wilco_ec_device *ec); | |
| 137 | + | |
| 123 | 138 | /* |
| 124 | 139 | * A Property is typically a data item that is stored to NVRAM |
| 125 | 140 | * by the EC. Each of these data items has an index associated |
| @@ -57,6 +57,12 @@ platform_find_device_by_driver(struct device *start, · 56 unmodified lines | ||
| 57 | 57 | extern void __iomem * |
| 58 | 58 | devm_platform_ioremap_resource(struct platform_device *pdev, |
| 59 | 59 | unsigned int index); |
| 60 | +extern void __iomem * | |
| 61 | +devm_platform_ioremap_resource_wc(struct platform_device *pdev, | |
| 62 | + unsigned int index); | |
| 63 | +extern void __iomem * | |
| 64 | +devm_platform_ioremap_resource_byname(struct platform_device *pdev, | |
| 65 | + const char *name); | |
| 60 | 66 | extern int platform_get_irq(struct platform_device *, unsigned int); |
| 61 | 67 | extern int platform_get_irq_optional(struct platform_device *, unsigned int); |
| 62 | 68 | extern int platform_irq_count(struct platform_device *); |
| @@ -294,58 +300,6 @@ void platform_unregister_drivers(struct platform_driver * const *drivers, · 231 unmodified lines | ||
| 294 | 300 | #define platform_register_drivers(drivers, count) \ |
| 295 | 301 | __platform_register_drivers(drivers, count, THIS_MODULE) |
| 296 | 302 | |
| 297 | −/* early platform driver interface */ | |
| 298 | −struct early_platform_driver { | |
| 299 | − const char *class_str; | |
| 300 | − struct platform_driver *pdrv; | |
| 301 | − struct list_head list; | |
| 302 | − int requested_id; | |
| 303 | − char *buffer; | |
| 304 | − int bufsize; | |
| 305 | −}; | |
| 306 | − | |
| 307 | −#define EARLY_PLATFORM_ID_UNSET -2 | |
| 308 | −#define EARLY_PLATFORM_ID_ERROR -3 | |
| 309 | − | |
| 310 | −extern int early_platform_driver_register(struct early_platform_driver *epdrv, | |
| 311 | − char *buf); | |
| 312 | −extern void early_platform_add_devices(struct platform_device **devs, int num); | |
| 313 | − | |
| 314 | −static inline int is_early_platform_device(struct platform_device *pdev) | |
| 315 | −{ | |
| 316 | − return !pdev->dev.driver; | |
| 317 | −} | |
| 318 | − | |
| 319 | −extern void early_platform_driver_register_all(char *class_str); | |
| 320 | −extern int early_platform_driver_probe(char *class_str, | |
| 321 | − int nr_probe, int user_only); | |
| 322 | −extern void early_platform_cleanup(void); | |
| 323 | − | |
| 324 | −#define early_platform_init(class_string, platdrv) \ | |
| 325 | − early_platform_init_buffer(class_string, platdrv, NULL, 0) | |
| 326 | − | |
| 327 | −#ifndef MODULE | |
| 328 | −#define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \ | |
| 329 | −static __initdata struct early_platform_driver early_driver = { \ | |
| 330 | − .class_str = class_string, \ | |
| 331 | − .buffer = buf, \ | |
| 332 | − .bufsize = bufsiz, \ | |
| 333 | − .pdrv = platdrv, \ | |
| 334 | − .requested_id = EARLY_PLATFORM_ID_UNSET, \ | |
| 335 | −}; \ | |
| 336 | −static int __init early_platform_driver_setup_func(char *buffer) \ | |
| 337 | −{ \ | |
| 338 | − return early_platform_driver_register(&early_driver, buffer); \ | |
| 339 | −} \ | |
| 340 | −early_param(class_string, early_platform_driver_setup_func) | |
| 341 | −#else /* MODULE */ | |
| 342 | −#define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \ | |
| 343 | −static inline char *early_platform_driver_setup_func(void) \ | |
| 344 | −{ \ | |
| 345 | − return bufsiz ? buf : NULL; \ | |
| 346 | −} | |
| 347 | −#endif /* MODULE */ | |
| 348 | − | |
| 349 | 303 | #ifdef CONFIG_SUSPEND |
| 350 | 304 | extern int platform_pm_suspend(struct device *dev); |
| 351 | 305 | extern int platform_pm_resume(struct device *dev); |
| @@ -380,4 +334,16 @@ extern int platform_dma_configure(struct device *dev); · 28 unmodified lines | ||
| 380 | 334 | #define USE_PLATFORM_PM_SLEEP_OPS |
| 381 | 335 | #endif |
| 382 | 336 | |
| 337 | +#ifndef CONFIG_SUPERH | |
| 338 | +/* | |
| 339 | + * REVISIT: This stub is needed for all non-SuperH users of early platform | |
| 340 | + * drivers. It should go away once we introduce the new platform_device-based | |
| 341 | + * early driver framework. | |
| 342 | + */ | |
| 343 | +static inline int is_sh_early_platform_device(struct platform_device *pdev) | |
| 344 | +{ | |
| 345 | + return 0; | |
| 346 | +} | |
| 347 | +#endif /* CONFIG_SUPERH */ | |
| 348 | + | |
| 383 | 349 | #endif /* _PLATFORM_DEVICE_H_ */ |
| @@ -637,6 +637,7 @@ extern void dev_pm_put_subsys_data(struct device *dev); · 636 unmodified lines | ||
| 637 | 637 | * struct dev_pm_domain - power management domain representation. |
| 638 | 638 | * |
| 639 | 639 | * @ops: Power management operations associated with this domain. |
| 640 | + * @start: Called when a user needs to start the device via the domain. | |
| 640 | 641 | * @detach: Called when removing a device from the domain. |
| 641 | 642 | * @activate: Called before executing probe routines for bus types and drivers. |
| 642 | 643 | * @sync: Called after successful driver probe. |
| @@ -648,6 +649,7 @@ extern void dev_pm_put_subsys_data(struct device *dev); · 5 unmodified lines | ||
| 648 | 649 | */ |
| 649 | 650 | struct dev_pm_domain { |
| 650 | 651 | struct dev_pm_ops ops; |
| 652 | + int (*start)(struct device *dev); | |
| 651 | 653 | void (*detach)(struct device *dev, bool power_off); |
| 652 | 654 | int (*activate)(struct device *dev); |
| 653 | 655 | void (*sync)(struct device *dev); |
| @@ -366,6 +366,7 @@ struct device *dev_pm_domain_attach_by_id(struct device *dev, · 365 unmodified lines | ||
| 366 | 366 | struct device *dev_pm_domain_attach_by_name(struct device *dev, |
| 367 | 367 | const char *name); |
| 368 | 368 | void dev_pm_domain_detach(struct device *dev, bool power_off); |
| 369 | +int dev_pm_domain_start(struct device *dev); | |
| 369 | 370 | void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); |
| 370 | 371 | #else |
| 371 | 372 | static inline int dev_pm_domain_attach(struct device *dev, bool power_on) |
| @@ -383,6 +384,10 @@ static inline struct device *dev_pm_domain_attach_by_name(struct device *dev, · 11 unmodified lines | ||
| 383 | 384 | return NULL; |
| 384 | 385 | } |
| 385 | 386 | static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {} |
| 387 | +static inline int dev_pm_domain_start(struct device *dev) | |
| 388 | +{ | |
| 389 | + return 0; | |
| 390 | +} | |
| 386 | 391 | static inline void dev_pm_domain_set(struct device *dev, |
| 387 | 392 | struct dev_pm_domain *pd) {} |
| 388 | 393 | #endif |
| @@ -22,6 +22,7 @@ struct opp_table; · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | enum dev_pm_opp_event { |
| 24 | 24 | OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, |
| 25 | + OPP_EVENT_ADJUST_VOLTAGE, | |
| 25 | 26 | }; |
| 26 | 27 | |
| 27 | 28 | /** |
| @@ -113,6 +114,10 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, · 85 unmodified lines | ||
| 113 | 114 | void dev_pm_opp_remove(struct device *dev, unsigned long freq); |
| 114 | 115 | void dev_pm_opp_remove_all_dynamic(struct device *dev); |
| 115 | 116 | |
| 117 | +int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq, | |
| 118 | + unsigned long u_volt, unsigned long u_volt_min, | |
| 119 | + unsigned long u_volt_max); | |
| 120 | + | |
| 116 | 121 | int dev_pm_opp_enable(struct device *dev, unsigned long freq); |
| 117 | 122 | |
| 118 | 123 | int dev_pm_opp_disable(struct device *dev, unsigned long freq); |
| @@ -242,6 +247,14 @@ static inline void dev_pm_opp_remove_all_dynamic(struct device *dev) · 123 unmodified lines | ||
| 242 | 247 | { |
| 243 | 248 | } |
| 244 | 249 | |
| 250 | +static inline int | |
| 251 | +dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq, | |
| 252 | + unsigned long u_volt, unsigned long u_volt_min, | |
| 253 | + unsigned long u_volt_max) | |
| 254 | +{ | |
| 255 | + return 0; | |
| 256 | +} | |
| 257 | + | |
| 245 | 258 | static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) |
| 246 | 259 | { |
| 247 | 260 | return 0; |
| @@ -34,6 +34,8 @@ enum pm_qos_flags_status { · 33 unmodified lines | ||
| 34 | 34 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY |
| 35 | 35 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS |
| 36 | 36 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 |
| 37 | +#define PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE 0 | |
| 38 | +#define PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE FREQ_QOS_MAX_DEFAULT_VALUE | |
| 37 | 39 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) |
| 38 | 40 | |
| 39 | 41 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) |
| @@ -49,21 +51,6 @@ struct pm_qos_flags_request { · 9 unmodified lines | ||
| 49 | 51 | s32 flags; /* Do not change to 64 bit */ |
| 50 | 52 | }; |
| 51 | 53 | |
| 52 | −enum dev_pm_qos_req_type { | |
| 53 | − DEV_PM_QOS_RESUME_LATENCY = 1, | |
| 54 | − DEV_PM_QOS_LATENCY_TOLERANCE, | |
| 55 | − DEV_PM_QOS_FLAGS, | |
| 56 | −}; | |
| 57 | − | |
| 58 | −struct dev_pm_qos_request { | |
| 59 | − enum dev_pm_qos_req_type type; | |
| 60 | − union { | |
| 61 | − struct plist_node pnode; | |
| 62 | − struct pm_qos_flags_request flr; | |
| 63 | − } data; | |
| 64 | − struct device *dev; | |
| 65 | −}; | |
| 66 | − | |
| 67 | 54 | enum pm_qos_type { |
| 68 | 55 | PM_QOS_UNITIALIZED, |
| 69 | 56 | PM_QOS_MAX, /* return the largest value */ |
| @@ -90,9 +77,51 @@ struct pm_qos_flags { · 20 unmodified lines | ||
| 90 | 77 | s32 effective_flags; /* Do not change to 64 bit */ |
| 91 | 78 | }; |
| 92 | 79 | |
| 80 | + | |
| 81 | +#define FREQ_QOS_MIN_DEFAULT_VALUE 0 | |
| 82 | +#define FREQ_QOS_MAX_DEFAULT_VALUE S32_MAX | |
| 83 | + | |
| 84 | +enum freq_qos_req_type { | |
| 85 | + FREQ_QOS_MIN = 1, | |
| 86 | + FREQ_QOS_MAX, | |
| 87 | +}; | |
| 88 | + | |
| 89 | +struct freq_constraints { | |
| 90 | + struct pm_qos_constraints min_freq; | |
| 91 | + struct blocking_notifier_head min_freq_notifiers; | |
| 92 | + struct pm_qos_constraints max_freq; | |
| 93 | + struct blocking_notifier_head max_freq_notifiers; | |
| 94 | +}; | |
| 95 | + | |
| 96 | +struct freq_qos_request { | |
| 97 | + enum freq_qos_req_type type; | |
| 98 | + struct plist_node pnode; | |
| 99 | + struct freq_constraints *qos; | |
| 100 | +}; | |
| 101 | + | |
| 102 | + | |
| 103 | +enum dev_pm_qos_req_type { | |
| 104 | + DEV_PM_QOS_RESUME_LATENCY = 1, | |
| 105 | + DEV_PM_QOS_LATENCY_TOLERANCE, | |
| 106 | + DEV_PM_QOS_MIN_FREQUENCY, | |
| 107 | + DEV_PM_QOS_MAX_FREQUENCY, | |
| 108 | + DEV_PM_QOS_FLAGS, | |
| 109 | +}; | |
| 110 | + | |
| 111 | +struct dev_pm_qos_request { | |
| 112 | + enum dev_pm_qos_req_type type; | |
| 113 | + union { | |
| 114 | + struct plist_node pnode; | |
| 115 | + struct pm_qos_flags_request flr; | |
| 116 | + struct freq_qos_request freq; | |
| 117 | + } data; | |
| 118 | + struct device *dev; | |
| 119 | +}; | |
| 120 | + | |
| 93 | 121 | struct dev_pm_qos { |
| 94 | 122 | struct pm_qos_constraints resume_latency; |
| 95 | 123 | struct pm_qos_constraints latency_tolerance; |
| 124 | + struct freq_constraints freq; | |
| 96 | 125 | struct pm_qos_flags flags; |
| 97 | 126 | struct dev_pm_qos_request *resume_latency_req; |
| 98 | 127 | struct dev_pm_qos_request *latency_tolerance_req; |
| @@ -191,6 +220,10 @@ static inline s32 dev_pm_qos_read_value(struct device *dev, · 92 unmodified lines | ||
| 191 | 220 | switch (type) { |
| 192 | 221 | case DEV_PM_QOS_RESUME_LATENCY: |
| 193 | 222 | return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; |
| 223 | + case DEV_PM_QOS_MIN_FREQUENCY: | |
| 224 | + return PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; | |
| 225 | + case DEV_PM_QOS_MAX_FREQUENCY: | |
| 226 | + return PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; | |
| 194 | 227 | default: |
| 195 | 228 | WARN_ON(1); |
| 196 | 229 | return 0; |
| @@ -255,27 +288,6 @@ static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev) · 58 unmodified lines | ||
| 255 | 288 | } |
| 256 | 289 | #endif |
| 257 | 290 | |
| 258 | −#define FREQ_QOS_MIN_DEFAULT_VALUE 0 | |
| 259 | −#define FREQ_QOS_MAX_DEFAULT_VALUE (-1) | |
| 260 | − | |
| 261 | −enum freq_qos_req_type { | |
| 262 | − FREQ_QOS_MIN = 1, | |
| 263 | − FREQ_QOS_MAX, | |
| 264 | −}; | |
| 265 | − | |
| 266 | −struct freq_constraints { | |
| 267 | − struct pm_qos_constraints min_freq; | |
| 268 | − struct blocking_notifier_head min_freq_notifiers; | |
| 269 | − struct pm_qos_constraints max_freq; | |
| 270 | − struct blocking_notifier_head max_freq_notifiers; | |
| 271 | −}; | |
| 272 | − | |
| 273 | −struct freq_qos_request { | |
| 274 | − enum freq_qos_req_type type; | |
| 275 | − struct plist_node pnode; | |
| 276 | − struct freq_constraints *qos; | |
| 277 | −}; | |
| 278 | − | |
| 279 | 291 | static inline int freq_qos_request_active(struct freq_qos_request *req) |
| 280 | 292 | { |
| 281 | 293 | return !IS_ERR_OR_NULL(req->qos); |
| @@ -291,6 +303,8 @@ int freq_qos_add_request(struct freq_constraints *qos, · 9 unmodified lines | ||
| 291 | 303 | enum freq_qos_req_type type, s32 value); |
| 292 | 304 | int freq_qos_update_request(struct freq_qos_request *req, s32 new_value); |
| 293 | 305 | int freq_qos_remove_request(struct freq_qos_request *req); |
| 306 | +int freq_qos_apply(struct freq_qos_request *req, | |
| 307 | + enum pm_qos_req_action action, s32 value); | |
| 294 | 308 | |
| 295 | 309 | int freq_qos_add_notifier(struct freq_constraints *qos, |
| 296 | 310 | enum freq_qos_req_type type, |
| @@ -63,6 +63,11 @@ struct wakeup_source { · 62 unmodified lines | ||
| 63 | 63 | bool autosleep_enabled:1; |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | +#define for_each_wakeup_source(ws) \ | |
| 67 | + for ((ws) = wakeup_sources_walk_start(); \ | |
| 68 | + (ws); \ | |
| 69 | + (ws) = wakeup_sources_walk_next((ws))) | |
| 70 | + | |
| 66 | 71 | #ifdef CONFIG_PM_SLEEP |
| 67 | 72 | |
| 68 | 73 | /* |
| @@ -92,6 +97,10 @@ extern void wakeup_source_remove(struct wakeup_source *ws); · 23 unmodified lines | ||
| 92 | 97 | extern struct wakeup_source *wakeup_source_register(struct device *dev, |
| 93 | 98 | const char *name); |
| 94 | 99 | extern void wakeup_source_unregister(struct wakeup_source *ws); |
| 100 | +extern int wakeup_sources_read_lock(void); | |
| 101 | +extern void wakeup_sources_read_unlock(int idx); | |
| 102 | +extern struct wakeup_source *wakeup_sources_walk_start(void); | |
| 103 | +extern struct wakeup_source *wakeup_sources_walk_next(struct wakeup_source *ws); | |
| 95 | 104 | extern int device_wakeup_enable(struct device *dev); |
| 96 | 105 | extern int device_wakeup_disable(struct device *dev); |
| 97 | 106 | extern void device_set_wakeup_capable(struct device *dev, bool capable); |
| @@ -293,6 +293,9 @@ struct omap_sr_data { · 292 unmodified lines | ||
| 293 | 293 | struct voltagedomain *voltdm; |
| 294 | 294 | }; |
| 295 | 295 | |
| 296 | + | |
| 297 | +extern struct omap_sr_data omap_sr_pdata[OMAP_SR_NR]; | |
| 298 | + | |
| 296 | 299 | #ifdef CONFIG_POWER_AVS_OMAP |
| 297 | 300 | |
| 298 | 301 | /* Smartreflex module enable/disable interface */ |
| @@ -302,9 +302,8 @@ extern int kptr_restrict; · 301 unmodified lines | ||
| 302 | 302 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
| 303 | 303 | #define pr_err(fmt, ...) \ |
| 304 | 304 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
| 305 | −#define pr_warning(fmt, ...) \ | |
| 305 | +#define pr_warn(fmt, ...) \ | |
| 306 | 306 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
| 307 | −#define pr_warn pr_warning | |
| 308 | 307 | #define pr_notice(fmt, ...) \ |
| 309 | 308 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
| 310 | 309 | #define pr_info(fmt, ...) \ |
| @@ -58,8 +58,8 @@ extern int remove_proc_subtree(const char *, struct proc_dir_entry *); · 57 unmodified lines | ||
| 58 | 58 | struct proc_dir_entry *proc_create_net_data(const char *name, umode_t mode, |
| 59 | 59 | struct proc_dir_entry *parent, const struct seq_operations *ops, |
| 60 | 60 | unsigned int state_size, void *data); |
| 61 | −#define proc_create_net(name, mode, parent, state_size, ops) \ | |
| 62 | − proc_create_net_data(name, mode, parent, state_size, ops, NULL) | |
| 61 | +#define proc_create_net(name, mode, parent, ops, state_size) \ | |
| 62 | + proc_create_net_data(name, mode, parent, ops, state_size, NULL) | |
| 63 | 63 | struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode, |
| 64 | 64 | struct proc_dir_entry *parent, |
| 65 | 65 | int (*show)(struct seq_file *, void *), void *data); |
| @@ -22,7 +22,6 @@ enum dev_prop_type { · 21 unmodified lines | ||
| 22 | 22 | DEV_PROP_U32, |
| 23 | 23 | DEV_PROP_U64, |
| 24 | 24 | DEV_PROP_STRING, |
| 25 | − DEV_PROP_MAX, | |
| 26 | 25 | }; |
| 27 | 26 | |
| 28 | 27 | enum dev_dma_attr { |
| @@ -80,9 +79,14 @@ struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode, · 51 unmodified lines | ||
| 80 | 79 | const char *name, |
| 81 | 80 | unsigned int index); |
| 82 | 81 | |
| 82 | +const char *fwnode_get_name(const struct fwnode_handle *fwnode); | |
| 83 | +const char *fwnode_get_name_prefix(const struct fwnode_handle *fwnode); | |
| 83 | 84 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); |
| 84 | 85 | struct fwnode_handle *fwnode_get_next_parent( |
| 85 | 86 | struct fwnode_handle *fwnode); |
| 87 | +unsigned int fwnode_count_parents(const struct fwnode_handle *fwn); | |
| 88 | +struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwn, | |
| 89 | + unsigned int depth); | |
| 86 | 90 | struct fwnode_handle *fwnode_get_next_child_node( |
| 87 | 91 | const struct fwnode_handle *fwnode, struct fwnode_handle *child); |
| 88 | 92 | struct fwnode_handle *fwnode_get_next_available_child_node( |
| @@ -234,13 +238,7 @@ struct property_entry { · 145 unmodified lines | ||
| 234 | 238 | bool is_array; |
| 235 | 239 | enum dev_prop_type type; |
| 236 | 240 | union { |
| 237 | − union { | |
| 238 | − const u8 *u8_data; | |
| 239 | − const u16 *u16_data; | |
| 240 | − const u32 *u32_data; | |
| 241 | − const u64 *u64_data; | |
| 242 | − const char * const *str; | |
| 243 | − } pointer; | |
| 241 | + const void *pointer; | |
| 244 | 242 | union { |
| 245 | 243 | u8 u8_data; |
| 246 | 244 | u16 u16_data; |
| @@ -252,62 +250,63 @@ struct property_entry { · 5 unmodified lines | ||
| 252 | 250 | }; |
| 253 | 251 | |
| 254 | 252 | /* |
| 255 | − * Note: the below four initializers for the anonymous union are carefully | |
| 253 | + * Note: the below initializers for the anonymous union are carefully | |
| 256 | 254 | * crafted to avoid gcc-4.4.4's problems with initialization of anon unions |
| 257 | 255 | * and structs. |
| 258 | 256 | */ |
| 259 | 257 | |
| 260 | −#define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _Type_, _val_) \ | |
| 258 | +#define __PROPERTY_ENTRY_ELEMENT_SIZE(_elem_) \ | |
| 259 | + sizeof(((struct property_entry *)NULL)->value._elem_) | |
| 260 | + | |
| 261 | +#define __PROPERTY_ENTRY_ARRAY_LEN(_name_, _elem_, _Type_, _val_, _len_)\ | |
| 261 | 262 | (struct property_entry) { \ |
| 262 | 263 | .name = _name_, \ |
| 263 | − .length = ARRAY_SIZE(_val_) * sizeof(_type_), \ | |
| 264 | + .length = (_len_) * __PROPERTY_ENTRY_ELEMENT_SIZE(_elem_), \ | |
| 264 | 265 | .is_array = true, \ |
| 265 | 266 | .type = DEV_PROP_##_Type_, \ |
| 266 | − { .pointer = { ._type_##_data = _val_ } }, \ | |
| 267 | + { .pointer = _val_ }, \ | |
| 267 | 268 | } |
| 268 | 269 | |
| 269 | −#define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \ | |
| 270 | − PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u8, U8, _val_) | |
| 271 | −#define PROPERTY_ENTRY_U16_ARRAY(_name_, _val_) \ | |
| 272 | − PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u16, U16, _val_) | |
| 273 | −#define PROPERTY_ENTRY_U32_ARRAY(_name_, _val_) \ | |
| 274 | − PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u32, U32, _val_) | |
| 275 | −#define PROPERTY_ENTRY_U64_ARRAY(_name_, _val_) \ | |
| 276 | − PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, U64, _val_) | |
| 277 | − | |
| 278 | −#define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_) \ | |
| 279 | −(struct property_entry) { \ | |
| 280 | − .name = _name_, \ | |
| 281 | − .length = ARRAY_SIZE(_val_) * sizeof(const char *), \ | |
| 282 | − .is_array = true, \ | |
| 283 | − .type = DEV_PROP_STRING, \ | |
| 284 | − { .pointer = { .str = _val_ } }, \ | |
| 285 | −} | |
| 286 | − | |
| 287 | −#define PROPERTY_ENTRY_INTEGER(_name_, _type_, _Type_, _val_) \ | |
| 288 | −(struct property_entry) { \ | |
| 289 | − .name = _name_, \ | |
| 290 | − .length = sizeof(_type_), \ | |
| 291 | − .type = DEV_PROP_##_Type_, \ | |
| 292 | − { .value = { ._type_##_data = _val_ } }, \ | |
| 270 | +#define PROPERTY_ENTRY_U8_ARRAY_LEN(_name_, _val_, _len_) \ | |
| 271 | + __PROPERTY_ENTRY_ARRAY_LEN(_name_, u8_data, U8, _val_, _len_) | |
| 272 | +#define PROPERTY_ENTRY_U16_ARRAY_LEN(_name_, _val_, _len_) \ | |
| 273 | + __PROPERTY_ENTRY_ARRAY_LEN(_name_, u16_data, U16, _val_, _len_) | |
| 274 | +#define PROPERTY_ENTRY_U32_ARRAY_LEN(_name_, _val_, _len_) \ | |
| 275 | + __PROPERTY_ENTRY_ARRAY_LEN(_name_, u32_data, U32, _val_, _len_) | |
| 276 | +#define PROPERTY_ENTRY_U64_ARRAY_LEN(_name_, _val_, _len_) \ | |
| 277 | + __PROPERTY_ENTRY_ARRAY_LEN(_name_, u64_data, U64, _val_, _len_) | |
| 278 | +#define PROPERTY_ENTRY_STRING_ARRAY_LEN(_name_, _val_, _len_) \ | |
| 279 | + __PROPERTY_ENTRY_ARRAY_LEN(_name_, str, STRING, _val_, _len_) | |
| 280 | + | |
| 281 | +#define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \ | |
| 282 | + PROPERTY_ENTRY_U8_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) | |
| 283 | +#define PROPERTY_ENTRY_U16_ARRAY(_name_, _val_) \ | |
| 284 | + PROPERTY_ENTRY_U16_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) | |
| 285 | +#define PROPERTY_ENTRY_U32_ARRAY(_name_, _val_) \ | |
| 286 | + PROPERTY_ENTRY_U32_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) | |
| 287 | +#define PROPERTY_ENTRY_U64_ARRAY(_name_, _val_) \ | |
| 288 | + PROPERTY_ENTRY_U64_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) | |
| 289 | +#define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_) \ | |
| 290 | + PROPERTY_ENTRY_STRING_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) | |
| 291 | + | |
| 292 | +#define __PROPERTY_ENTRY_ELEMENT(_name_, _elem_, _Type_, _val_) \ | |
| 293 | +(struct property_entry) { \ | |
| 294 | + .name = _name_, \ | |
| 295 | + .length = __PROPERTY_ENTRY_ELEMENT_SIZE(_elem_), \ | |
| 296 | + .type = DEV_PROP_##_Type_, \ | |
| 297 | + { .value = { ._elem_ = _val_ } }, \ | |
| 293 | 298 | } |
| 294 | 299 | |
| 295 | −#define PROPERTY_ENTRY_U8(_name_, _val_) \ | |
| 296 | − PROPERTY_ENTRY_INTEGER(_name_, u8, U8, _val_) | |
| 297 | −#define PROPERTY_ENTRY_U16(_name_, _val_) \ | |
| 298 | − PROPERTY_ENTRY_INTEGER(_name_, u16, U16, _val_) | |
| 299 | −#define PROPERTY_ENTRY_U32(_name_, _val_) \ | |
| 300 | − PROPERTY_ENTRY_INTEGER(_name_, u32, U32, _val_) | |
| 301 | −#define PROPERTY_ENTRY_U64(_name_, _val_) \ | |
| 302 | − PROPERTY_ENTRY_INTEGER(_name_, u64, U64, _val_) | |
| 303 | − | |
| 304 | −#define PROPERTY_ENTRY_STRING(_name_, _val_) \ | |
| 305 | −(struct property_entry) { \ | |
| 306 | − .name = _name_, \ | |
| 307 | − .length = sizeof(const char *), \ | |
| 308 | − .type = DEV_PROP_STRING, \ | |
| 309 | − { .value = { .str = _val_ } }, \ | |
| 310 | −} | |
| 300 | +#define PROPERTY_ENTRY_U8(_name_, _val_) \ | |
| 301 | + __PROPERTY_ENTRY_ELEMENT(_name_, u8_data, U8, _val_) | |
| 302 | +#define PROPERTY_ENTRY_U16(_name_, _val_) \ | |
| 303 | + __PROPERTY_ENTRY_ELEMENT(_name_, u16_data, U16, _val_) | |
| 304 | +#define PROPERTY_ENTRY_U32(_name_, _val_) \ | |
| 305 | + __PROPERTY_ENTRY_ELEMENT(_name_, u32_data, U32, _val_) | |
| 306 | +#define PROPERTY_ENTRY_U64(_name_, _val_) \ | |
| 307 | + __PROPERTY_ENTRY_ELEMENT(_name_, u64_data, U64, _val_) | |
| 308 | +#define PROPERTY_ENTRY_STRING(_name_, _val_) \ | |
| 309 | + __PROPERTY_ENTRY_ELEMENT(_name_, str, STRING, _val_) | |
| 311 | 310 | |
| 312 | 311 | #define PROPERTY_ENTRY_BOOL(_name_) \ |
| 313 | 312 | (struct property_entry) { \ |
| @@ -418,7 +417,8 @@ struct software_node { · 104 unmodified lines | ||
| 418 | 417 | }; |
| 419 | 418 | |
| 420 | 419 | bool is_software_node(const struct fwnode_handle *fwnode); |
| 421 | −const struct software_node *to_software_node(struct fwnode_handle *fwnode); | |
| 420 | +const struct software_node * | |
| 421 | +to_software_node(const struct fwnode_handle *fwnode); | |
| 422 | 422 | struct fwnode_handle *software_node_fwnode(const struct software_node *node); |
| 423 | 423 | |
| 424 | 424 | const struct software_node * |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #ifndef __LINUX_PSCI_H |
| 8 | 8 | #define __LINUX_PSCI_H |
| 9 | 9 | |
| 10 | +#include <linux/arm-smccc.h> | |
| 10 | 11 | #include <linux/init.h> |
| 11 | 12 | #include <linux/types.h> |
| 12 | 13 | |
| @@ -18,12 +19,6 @@ bool psci_tos_resident_on(int cpu); · 5 unmodified lines | ||
| 18 | 19 | int psci_cpu_suspend_enter(u32 state); |
| 19 | 20 | bool psci_power_state_is_valid(u32 state); |
| 20 | 21 | |
| 21 | −enum psci_conduit { | |
| 22 | − PSCI_CONDUIT_NONE, | |
| 23 | − PSCI_CONDUIT_SMC, | |
| 24 | − PSCI_CONDUIT_HVC, | |
| 25 | −}; | |
| 26 | − | |
| 27 | 22 | enum smccc_version { |
| 28 | 23 | SMCCC_VERSION_1_0, |
| 29 | 24 | SMCCC_VERSION_1_1, |
| @@ -38,7 +33,7 @@ struct psci_operations { · 8 unmodified lines | ||
| 38 | 33 | int (*affinity_info)(unsigned long target_affinity, |
| 39 | 34 | unsigned long lowest_affinity_level); |
| 40 | 35 | int (*migrate_info_type)(void); |
| 41 | − enum psci_conduit conduit; | |
| 36 | + enum arm_smccc_conduit conduit; | |
| 42 | 37 | enum smccc_version smccc_version; |
| 43 | 38 | }; |
| 44 | 39 | |
| @@ -243,10 +243,7 @@ pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle, · 242 unmodified lines | ||
| 243 | 243 | * @request: optional hook for requesting a PWM |
| 244 | 244 | * @free: optional hook for freeing a PWM |
| 245 | 245 | * @capture: capture and report PWM signal |
| 246 | − * @apply: atomically apply a new PWM config. The state argument | |
| 247 | − * should be adjusted with the real hardware config (if the | |
| 248 | − * approximate the period or duty_cycle value, state should | |
| 249 | − * reflect it) | |
| 246 | + * @apply: atomically apply a new PWM config | |
| 250 | 247 | * @get_state: get the current PWM state. This function is only |
| 251 | 248 | * called once per PWM device when the PWM chip is |
| 252 | 249 | * registered. |
| @@ -206,7 +206,7 @@ enum pxa_ssp_type { · 205 unmodified lines | ||
| 206 | 206 | }; |
| 207 | 207 | |
| 208 | 208 | struct ssp_device { |
| 209 | − struct platform_device *pdev; | |
| 209 | + struct device *dev; | |
| 210 | 210 | struct list_head node; |
| 211 | 211 | |
| 212 | 212 | struct clk *clk; |
| @@ -24,6 +24,26 @@ struct qcom_scm_vmperm { · 23 unmodified lines | ||
| 24 | 24 | int perm; |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | +enum qcom_scm_ocmem_client { | |
| 28 | + QCOM_SCM_OCMEM_UNUSED_ID = 0x0, | |
| 29 | + QCOM_SCM_OCMEM_GRAPHICS_ID, | |
| 30 | + QCOM_SCM_OCMEM_VIDEO_ID, | |
| 31 | + QCOM_SCM_OCMEM_LP_AUDIO_ID, | |
| 32 | + QCOM_SCM_OCMEM_SENSORS_ID, | |
| 33 | + QCOM_SCM_OCMEM_OTHER_OS_ID, | |
| 34 | + QCOM_SCM_OCMEM_DEBUG_ID, | |
| 35 | +}; | |
| 36 | + | |
| 37 | +enum qcom_scm_sec_dev_id { | |
| 38 | + QCOM_SCM_MDSS_DEV_ID = 1, | |
| 39 | + QCOM_SCM_OCMEM_DEV_ID = 5, | |
| 40 | + QCOM_SCM_PCIE0_DEV_ID = 11, | |
| 41 | + QCOM_SCM_PCIE1_DEV_ID = 12, | |
| 42 | + QCOM_SCM_GFX_DEV_ID = 18, | |
| 43 | + QCOM_SCM_UFS_DEV_ID = 19, | |
| 44 | + QCOM_SCM_ICE_DEV_ID = 20, | |
| 45 | +}; | |
| 46 | + | |
| 27 | 47 | #define QCOM_SCM_VMID_HLOS 0x3 |
| 28 | 48 | #define QCOM_SCM_VMID_MSS_MSA 0xF |
| 29 | 49 | #define QCOM_SCM_VMID_WLAN 0x18 |
| @@ -41,6 +61,11 @@ extern bool qcom_scm_is_available(void); · 11 unmodified lines | ||
| 41 | 61 | extern bool qcom_scm_hdcp_available(void); |
| 42 | 62 | extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, |
| 43 | 63 | u32 *resp); |
| 64 | +extern bool qcom_scm_ocmem_lock_available(void); | |
| 65 | +extern int qcom_scm_ocmem_lock(enum qcom_scm_ocmem_client id, u32 offset, | |
| 66 | + u32 size, u32 mode); | |
| 67 | +extern int qcom_scm_ocmem_unlock(enum qcom_scm_ocmem_client id, u32 offset, | |
| 68 | + u32 size); | |
| 44 | 69 | extern bool qcom_scm_pas_supported(u32 peripheral); |
| 45 | 70 | extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, |
| 46 | 71 | size_t size); |
| @@ -55,9 +80,11 @@ extern int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, · 8 unmodified lines | ||
| 55 | 80 | extern void qcom_scm_cpu_power_down(u32 flags); |
| 56 | 81 | extern u32 qcom_scm_get_version(void); |
| 57 | 82 | extern int qcom_scm_set_remote_state(u32 state, u32 id); |
| 83 | +extern bool qcom_scm_restore_sec_cfg_available(void); | |
| 58 | 84 | extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); |
| 59 | 85 | extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size); |
| 60 | 86 | extern int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare); |
| 87 | +extern int qcom_scm_qsmmu500_wait_safe_toggle(bool en); | |
| 61 | 88 | extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); |
| 62 | 89 | extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val); |
| 63 | 90 | #else |
| @@ -97,6 +124,7 @@ qcom_scm_set_remote_state(u32 state,u32 id) { return -ENODEV; } · 33 unmodified lines | ||
| 97 | 124 | static inline int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) { return -ENODEV; } |
| 98 | 125 | static inline int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size) { return -ENODEV; } |
| 99 | 126 | static inline int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) { return -ENODEV; } |
| 127 | +static inline int qcom_scm_qsmmu500_wait_safe_toggle(bool en) { return -ENODEV; } | |
| 100 | 128 | static inline int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val) { return -ENODEV; } |
| 101 | 129 | static inline int qcom_scm_io_writel(phys_addr_t addr, unsigned int val) { return -ENODEV; } |
| 102 | 130 | #endif |
| @@ -263,7 +263,7 @@ enum { · 262 unmodified lines | ||
| 263 | 263 | }; |
| 264 | 264 | |
| 265 | 265 | struct dqstats { |
| 266 | − int stat[_DQST_DQSTAT_LAST]; | |
| 266 | + unsigned long stat[_DQST_DQSTAT_LAST]; | |
| 267 | 267 | struct percpu_counter counter[_DQST_DQSTAT_LAST]; |
| 268 | 268 | }; |
| 269 | 269 | |
| @@ -54,6 +54,16 @@ static inline struct dquot *dqgrab(struct dquot *dquot) · 53 unmodified lines | ||
| 54 | 54 | atomic_inc(&dquot->dq_count); |
| 55 | 55 | return dquot; |
| 56 | 56 | } |
| 57 | + | |
| 58 | +static inline bool dquot_is_busy(struct dquot *dquot) | |
| 59 | +{ | |
| 60 | + if (test_bit(DQ_MOD_B, &dquot->dq_flags)) | |
| 61 | + return true; | |
| 62 | + if (atomic_read(&dquot->dq_count) > 1) | |
| 63 | + return true; | |
| 64 | + return false; | |
| 65 | +} | |
| 66 | + | |
| 57 | 67 | void dqput(struct dquot *dquot); |
| 58 | 68 | int dquot_scan_active(struct super_block *sb, |
| 59 | 69 | int (*fn)(struct dquot *dquot, unsigned long priv), |
| @@ -87,7 +97,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot); · 27 unmodified lines | ||
| 87 | 97 | |
| 88 | 98 | int dquot_file_open(struct inode *inode, struct file *file); |
| 89 | 99 | |
| 90 | −int dquot_enable(struct inode *inode, int type, int format_id, | |
| 100 | +int dquot_load_quota_sb(struct super_block *sb, int type, int format_id, | |
| 101 | + unsigned int flags); | |
| 102 | +int dquot_load_quota_inode(struct inode *inode, int type, int format_id, | |
| 91 | 103 | unsigned int flags); |
| 92 | 104 | int dquot_quota_on(struct super_block *sb, int type, int format_id, |
| 93 | 105 | const struct path *path); |
| @@ -283,14 +283,12 @@ __rb_erase_augmented(struct rb_node *node, struct rb_root *root, · 282 unmodified lines | ||
| 283 | 283 | __rb_change_child(node, successor, tmp, root); |
| 284 | 284 | |
| 285 | 285 | if (child2) { |
| 286 | − successor->__rb_parent_color = pc; | |
| 287 | 286 | rb_set_parent_color(child2, parent, RB_BLACK); |
| 288 | 287 | rebalance = NULL; |
| 289 | 288 | } else { |
| 290 | − unsigned long pc2 = successor->__rb_parent_color; | |
| 291 | − successor->__rb_parent_color = pc; | |
| 292 | − rebalance = __rb_is_black(pc2) ? parent : NULL; | |
| 289 | + rebalance = rb_is_black(successor) ? parent : NULL; | |
| 293 | 290 | } |
| 291 | + successor->__rb_parent_color = pc; | |
| 294 | 292 | tmp = successor; |
| 295 | 293 | } |
| 296 | 294 | |
| @@ -24,34 +24,6 @@ static inline struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h) · 23 unmodified lines | ||
| 24 | 24 | ((unsigned long)rcu_dereference_check(h->first, hlist_bl_is_locked(h)) & ~LIST_BL_LOCKMASK); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | −/** | |
| 28 | − * hlist_bl_del_init_rcu - deletes entry from hash list with re-initialization | |
| 29 | − * @n: the element to delete from the hash list. | |
| 30 | − * | |
| 31 | − * Note: hlist_bl_unhashed() on the node returns true after this. It is | |
| 32 | − * useful for RCU based read lockfree traversal if the writer side | |
| 33 | − * must know if the list entry is still hashed or already unhashed. | |
| 34 | − * | |
| 35 | − * In particular, it means that we can not poison the forward pointers | |
| 36 | − * that may still be used for walking the hash list and we can only | |
| 37 | − * zero the pprev pointer so list_unhashed() will return true after | |
| 38 | − * this. | |
| 39 | − * | |
| 40 | − * The caller must take whatever precautions are necessary (such as | |
| 41 | − * holding appropriate locks) to avoid racing with another | |
| 42 | − * list-mutation primitive, such as hlist_bl_add_head_rcu() or | |
| 43 | − * hlist_bl_del_rcu(), running on this same list. However, it is | |
| 44 | − * perfectly legal to run concurrently with the _rcu list-traversal | |
| 45 | − * primitives, such as hlist_bl_for_each_entry_rcu(). | |
| 46 | − */ | |
| 47 | −static inline void hlist_bl_del_init_rcu(struct hlist_bl_node *n) | |
| 48 | −{ | |
| 49 | − if (!hlist_bl_unhashed(n)) { | |
| 50 | − __hlist_bl_del(n); | |
| 51 | − n->pprev = NULL; | |
| 52 | − } | |
| 53 | −} | |
| 54 | − | |
| 55 | 27 | /** |
| 56 | 28 | * hlist_bl_del_rcu - deletes entry from hash list without re-initialization |
| 57 | 29 | * @n: the element to delete from the hash list. |
| @@ -100,6 +100,43 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n, · 99 unmodified lines | ||
| 100 | 100 | first->pprev = &n->next; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | +/** | |
| 104 | + * hlist_nulls_add_tail_rcu | |
| 105 | + * @n: the element to add to the hash list. | |
| 106 | + * @h: the list to add to. | |
| 107 | + * | |
| 108 | + * Description: | |
| 109 | + * Adds the specified element to the specified hlist_nulls, | |
| 110 | + * while permitting racing traversals. | |
| 111 | + * | |
| 112 | + * The caller must take whatever precautions are necessary | |
| 113 | + * (such as holding appropriate locks) to avoid racing | |
| 114 | + * with another list-mutation primitive, such as hlist_nulls_add_head_rcu() | |
| 115 | + * or hlist_nulls_del_rcu(), running on this same list. | |
| 116 | + * However, it is perfectly legal to run concurrently with | |
| 117 | + * the _rcu list-traversal primitives, such as | |
| 118 | + * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency | |
| 119 | + * problems on Alpha CPUs. Regardless of the type of CPU, the | |
| 120 | + * list-traversal primitive must be guarded by rcu_read_lock(). | |
| 121 | + */ | |
| 122 | +static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n, | |
| 123 | + struct hlist_nulls_head *h) | |
| 124 | +{ | |
| 125 | + struct hlist_nulls_node *i, *last = NULL; | |
| 126 | + | |
| 127 | + /* Note: write side code, so rcu accessors are not needed. */ | |
| 128 | + for (i = h->first; !is_a_nulls(i); i = i->next) | |
| 129 | + last = i; | |
| 130 | + | |
| 131 | + if (last) { | |
| 132 | + n->next = last->next; | |
| 133 | + n->pprev = &last->next; | |
| 134 | + rcu_assign_pointer(hlist_next_rcu(last), n); | |
| 135 | + } else { | |
| 136 | + hlist_nulls_add_head_rcu(n, h); | |
| 137 | + } | |
| 138 | +} | |
| 139 | + | |
| 103 | 140 | /** |
| 104 | 141 | * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type |
| 105 | 142 | * @tpos: the type * to use as a loop cursor. |
| @@ -210,7 +210,7 @@ static inline void rcu_lock_acquire(struct lockdep_map *map) · 209 unmodified lines | ||
| 210 | 210 | |
| 211 | 211 | static inline void rcu_lock_release(struct lockdep_map *map) |
| 212 | 212 | { |
| 213 | − lock_release(map, 1, _THIS_IP_); | |
| 213 | + lock_release(map, _THIS_IP_); | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | extern struct lockdep_map rcu_lock_map; |
| @@ -382,6 +382,24 @@ do { \ · 165 unmodified lines | ||
| 382 | 382 | smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \ |
| 383 | 383 | } while (0) |
| 384 | 384 | |
| 385 | +/** | |
| 386 | + * rcu_replace_pointer() - replace an RCU pointer, returning its old value | |
| 387 | + * @rcu_ptr: RCU pointer, whose old value is returned | |
| 388 | + * @ptr: regular pointer | |
| 389 | + * @c: the lockdep conditions under which the dereference will take place | |
| 390 | + * | |
| 391 | + * Perform a replacement, where @rcu_ptr is an RCU-annotated | |
| 392 | + * pointer and @c is the lockdep argument that is passed to the | |
| 393 | + * rcu_dereference_protected() call used to read that pointer. The old | |
| 394 | + * value of @rcu_ptr is returned, and @rcu_ptr is set to @ptr. | |
| 395 | + */ | |
| 396 | +#define rcu_replace_pointer(rcu_ptr, ptr, c) \ | |
| 397 | +({ \ | |
| 398 | + typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c)); \ | |
| 399 | + rcu_assign_pointer((rcu_ptr), (ptr)); \ | |
| 400 | + __tmp; \ | |
| 401 | +}) | |
| 402 | + | |
| 385 | 403 | /** |
| 386 | 404 | * rcu_swap_protected() - swap an RCU and a regular pointer |
| 387 | 405 | * @rcu_ptr: RCU pointer |
| @@ -84,6 +84,7 @@ static inline void rcu_scheduler_starting(void) { } · 83 unmodified lines | ||
| 84 | 84 | #endif /* #else #ifndef CONFIG_SRCU */ |
| 85 | 85 | static inline void rcu_end_inkernel_boot(void) { } |
| 86 | 86 | static inline bool rcu_is_watching(void) { return true; } |
| 87 | +static inline void rcu_momentary_dyntick_idle(void) { } | |
| 87 | 88 | |
| 88 | 89 | /* Avoid RCU read-side critical sections leaking across. */ |
| 89 | 90 | static inline void rcu_all_qs(void) { barrier(); } |
| @@ -37,6 +37,7 @@ void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func); · 36 unmodified lines | ||
| 37 | 37 | |
| 38 | 38 | void rcu_barrier(void); |
| 39 | 39 | bool rcu_eqs_special_set(int cpu); |
| 40 | +void rcu_momentary_dyntick_idle(void); | |
| 40 | 41 | unsigned long get_state_synchronize_rcu(void); |
| 41 | 42 | void cond_synchronize_rcu(unsigned long oldstate); |
| 42 | 43 | |
| @@ -1,9 +1,88 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | +/* | |
| 3 | + * Variant of atomic_t specialized for reference counts. | |
| 4 | + * | |
| 5 | + * The interface matches the atomic_t interface (to aid in porting) but only | |
| 6 | + * provides the few functions one should use for reference counting. | |
| 7 | + * | |
| 8 | + * Saturation semantics | |
| 9 | + * ==================== | |
| 10 | + * | |
| 11 | + * refcount_t differs from atomic_t in that the counter saturates at | |
| 12 | + * REFCOUNT_SATURATED and will not move once there. This avoids wrapping the | |
| 13 | + * counter and causing 'spurious' use-after-free issues. In order to avoid the | |
| 14 | + * cost associated with introducing cmpxchg() loops into all of the saturating | |
| 15 | + * operations, we temporarily allow the counter to take on an unchecked value | |
| 16 | + * and then explicitly set it to REFCOUNT_SATURATED on detecting that underflow | |
| 17 | + * or overflow has occurred. Although this is racy when multiple threads | |
| 18 | + * access the refcount concurrently, by placing REFCOUNT_SATURATED roughly | |
| 19 | + * equidistant from 0 and INT_MAX we minimise the scope for error: | |
| 20 | + * | |
| 21 | + * INT_MAX REFCOUNT_SATURATED UINT_MAX | |
| 22 | + * 0 (0x7fff_ffff) (0xc000_0000) (0xffff_ffff) | |
| 23 | + * +--------------------------------+----------------+----------------+ | |
| 24 | + * <---------- bad value! ----------> | |
| 25 | + * | |
| 26 | + * (in a signed view of the world, the "bad value" range corresponds to | |
| 27 | + * a negative counter value). | |
| 28 | + * | |
| 29 | + * As an example, consider a refcount_inc() operation that causes the counter | |
| 30 | + * to overflow: | |
| 31 | + * | |
| 32 | + * int old = atomic_fetch_add_relaxed(r); | |
| 33 | + * // old is INT_MAX, refcount now INT_MIN (0x8000_0000) | |
| 34 | + * if (old < 0) | |
| 35 | + * atomic_set(r, REFCOUNT_SATURATED); | |
| 36 | + * | |
| 37 | + * If another thread also performs a refcount_inc() operation between the two | |
| 38 | + * atomic operations, then the count will continue to edge closer to 0. If it | |
| 39 | + * reaches a value of 1 before /any/ of the threads reset it to the saturated | |
| 40 | + * value, then a concurrent refcount_dec_and_test() may erroneously free the | |
| 41 | + * underlying object. Given the precise timing details involved with the | |
| 42 | + * round-robin scheduling of each thread manipulating the refcount and the need | |
| 43 | + * to hit the race multiple times in succession, there doesn't appear to be a | |
| 44 | + * practical avenue of attack even if using refcount_add() operations with | |
| 45 | + * larger increments. | |
| 46 | + * | |
| 47 | + * Memory ordering | |
| 48 | + * =============== | |
| 49 | + * | |
| 50 | + * Memory ordering rules are slightly relaxed wrt regular atomic_t functions | |
| 51 | + * and provide only what is strictly required for refcounts. | |
| 52 | + * | |
| 53 | + * The increments are fully relaxed; these will not provide ordering. The | |
| 54 | + * rationale is that whatever is used to obtain the object we're increasing the | |
| 55 | + * reference count on will provide the ordering. For locked data structures, | |
| 56 | + * its the lock acquire, for RCU/lockless data structures its the dependent | |
| 57 | + * load. | |
| 58 | + * | |
| 59 | + * Do note that inc_not_zero() provides a control dependency which will order | |
| 60 | + * future stores against the inc, this ensures we'll never modify the object | |
| 61 | + * if we did not in fact acquire a reference. | |
| 62 | + * | |
| 63 | + * The decrements will provide release order, such that all the prior loads and | |
| 64 | + * stores will be issued before, it also provides a control dependency, which | |
| 65 | + * will order us against the subsequent free(). | |
| 66 | + * | |
| 67 | + * The control dependency is against the load of the cmpxchg (ll/sc) that | |
| 68 | + * succeeded. This means the stores aren't fully ordered, but this is fine | |
| 69 | + * because the 1->0 transition indicates no concurrency. | |
| 70 | + * | |
| 71 | + * Note that the allocator is responsible for ordering things between free() | |
| 72 | + * and alloc(). | |
| 73 | + * | |
| 74 | + * The decrements dec_and_test() and sub_and_test() also provide acquire | |
| 75 | + * ordering on success. | |
| 76 | + * | |
| 77 | + */ | |
| 78 | + | |
| 2 | 79 | #ifndef _LINUX_REFCOUNT_H |
| 3 | 80 | #define _LINUX_REFCOUNT_H |
| 4 | 81 | |
| 5 | 82 | #include <linux/atomic.h> |
| 83 | +#include <linux/bug.h> | |
| 6 | 84 | #include <linux/compiler.h> |
| 85 | +#include <linux/limits.h> | |
| 7 | 86 | #include <linux/spinlock_types.h> |
| 8 | 87 | |
| 9 | 88 | struct mutex; |
| @@ -12,7 +91,7 @@ struct mutex; · 2 unmodified lines | ||
| 12 | 91 | * struct refcount_t - variant of atomic_t specialized for reference counts |
| 13 | 92 | * @refs: atomic_t counter field |
| 14 | 93 | * |
| 15 | − * The counter saturates at UINT_MAX and will not move once | |
| 94 | + * The counter saturates at REFCOUNT_SATURATED and will not move once | |
| 16 | 95 | * there. This avoids wrapping the counter and causing 'spurious' |
| 17 | 96 | * use-after-free bugs. |
| 18 | 97 | */ |
| @@ -21,13 +100,25 @@ typedef struct refcount_struct { · 2 unmodified lines | ||
| 21 | 100 | } refcount_t; |
| 22 | 101 | |
| 23 | 102 | #define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), } |
| 103 | +#define REFCOUNT_MAX INT_MAX | |
| 104 | +#define REFCOUNT_SATURATED (INT_MIN / 2) | |
| 105 | + | |
| 106 | +enum refcount_saturation_type { | |
| 107 | + REFCOUNT_ADD_NOT_ZERO_OVF, | |
| 108 | + REFCOUNT_ADD_OVF, | |
| 109 | + REFCOUNT_ADD_UAF, | |
| 110 | + REFCOUNT_SUB_UAF, | |
| 111 | + REFCOUNT_DEC_LEAK, | |
| 112 | +}; | |
| 113 | + | |
| 114 | +void refcount_warn_saturate(refcount_t *r, enum refcount_saturation_type t); | |
| 24 | 115 | |
| 25 | 116 | /** |
| 26 | 117 | * refcount_set - set a refcount's value |
| 27 | 118 | * @r: the refcount |
| 28 | 119 | * @n: value to which the refcount will be set |
| 29 | 120 | */ |
| 30 | −static inline void refcount_set(refcount_t *r, unsigned int n) | |
| 121 | +static inline void refcount_set(refcount_t *r, int n) | |
| 31 | 122 | { |
| 32 | 123 | atomic_set(&r->refs, n); |
| 33 | 124 | } |
| @@ -43,70 +134,168 @@ static inline unsigned int refcount_read(const refcount_t *r) · 9 unmodified lines | ||
| 43 | 134 | return atomic_read(&r->refs); |
| 44 | 135 | } |
| 45 | 136 | |
| 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 | − | |
| 57 | −#ifdef CONFIG_REFCOUNT_FULL | |
| 58 | − | |
| 59 | −#define refcount_add_not_zero refcount_add_not_zero_checked | |
| 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 | |
| 137 | +/** | |
| 138 | + * refcount_add_not_zero - add a value to a refcount unless it is 0 | |
| 139 | + * @i: the value to add to the refcount | |
| 140 | + * @r: the refcount | |
| 141 | + * | |
| 142 | + * Will saturate at REFCOUNT_SATURATED and WARN. | |
| 143 | + * | |
| 144 | + * Provides no memory ordering, it is assumed the caller has guaranteed the | |
| 145 | + * object memory to be stable (RCU, etc.). It does provide a control dependency | |
| 146 | + * and thereby orders future stores. See the comment on top. | |
| 147 | + * | |
| 148 | + * Use of this function is not recommended for the normal reference counting | |
| 149 | + * use case in which references are taken and released one at a time. In these | |
| 150 | + * cases, refcount_inc(), or one of its variants, should instead be used to | |
| 151 | + * increment a reference count. | |
| 152 | + * | |
| 153 | + * Return: false if the passed refcount is 0, true otherwise | |
| 154 | + */ | |
| 155 | +static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r) | |
| 156 | +{ | |
| 157 | + int old = refcount_read(r); | |
| 64 | 158 | |
| 65 | −#define refcount_sub_and_test refcount_sub_and_test_checked | |
| 159 | + do { | |
| 160 | + if (!old) | |
| 161 | + break; | |
| 162 | + } while (!atomic_try_cmpxchg_relaxed(&r->refs, &old, old + i)); | |
| 66 | 163 | |
| 67 | −#define refcount_dec_and_test refcount_dec_and_test_checked | |
| 68 | −#define refcount_dec refcount_dec_checked | |
| 164 | + if (unlikely(old < 0 || old + i < 0)) | |
| 165 | + refcount_warn_saturate(r, REFCOUNT_ADD_NOT_ZERO_OVF); | |
| 69 | 166 | |
| 70 | −#else | |
| 71 | −# ifdef CONFIG_ARCH_HAS_REFCOUNT | |
| 72 | −# include <asm/refcount.h> | |
| 73 | −# else | |
| 74 | −static inline __must_check bool refcount_add_not_zero(unsigned int i, refcount_t *r) | |
| 75 | −{ | |
| 76 | − return atomic_add_unless(&r->refs, i, 0); | |
| 167 | + return old; | |
| 77 | 168 | } |
| 78 | 169 | |
| 79 | −static inline void refcount_add(unsigned int i, refcount_t *r) | |
| 170 | +/** | |
| 171 | + * refcount_add - add a value to a refcount | |
| 172 | + * @i: the value to add to the refcount | |
| 173 | + * @r: the refcount | |
| 174 | + * | |
| 175 | + * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN. | |
| 176 | + * | |
| 177 | + * Provides no memory ordering, it is assumed the caller has guaranteed the | |
| 178 | + * object memory to be stable (RCU, etc.). It does provide a control dependency | |
| 179 | + * and thereby orders future stores. See the comment on top. | |
| 180 | + * | |
| 181 | + * Use of this function is not recommended for the normal reference counting | |
| 182 | + * use case in which references are taken and released one at a time. In these | |
| 183 | + * cases, refcount_inc(), or one of its variants, should instead be used to | |
| 184 | + * increment a reference count. | |
| 185 | + */ | |
| 186 | +static inline void refcount_add(int i, refcount_t *r) | |
| 80 | 187 | { |
| 81 | − atomic_add(i, &r->refs); | |
| 188 | + int old = atomic_fetch_add_relaxed(i, &r->refs); | |
| 189 | + | |
| 190 | + if (unlikely(!old)) | |
| 191 | + refcount_warn_saturate(r, REFCOUNT_ADD_UAF); | |
| 192 | + else if (unlikely(old < 0 || old + i < 0)) | |
| 193 | + refcount_warn_saturate(r, REFCOUNT_ADD_OVF); | |
| 82 | 194 | } |
| 83 | 195 | |
| 196 | +/** | |
| 197 | + * refcount_inc_not_zero - increment a refcount unless it is 0 | |
| 198 | + * @r: the refcount to increment | |
| 199 | + * | |
| 200 | + * Similar to atomic_inc_not_zero(), but will saturate at REFCOUNT_SATURATED | |
| 201 | + * and WARN. | |
| 202 | + * | |
| 203 | + * Provides no memory ordering, it is assumed the caller has guaranteed the | |
| 204 | + * object memory to be stable (RCU, etc.). It does provide a control dependency | |
| 205 | + * and thereby orders future stores. See the comment on top. | |
| 206 | + * | |
| 207 | + * Return: true if the increment was successful, false otherwise | |
| 208 | + */ | |
| 84 | 209 | static inline __must_check bool refcount_inc_not_zero(refcount_t *r) |
| 85 | 210 | { |
| 86 | − return atomic_add_unless(&r->refs, 1, 0); | |
| 211 | + return refcount_add_not_zero(1, r); | |
| 87 | 212 | } |
| 88 | 213 | |
| 214 | +/** | |
| 215 | + * refcount_inc - increment a refcount | |
| 216 | + * @r: the refcount to increment | |
| 217 | + * | |
| 218 | + * Similar to atomic_inc(), but will saturate at REFCOUNT_SATURATED and WARN. | |
| 219 | + * | |
| 220 | + * Provides no memory ordering, it is assumed the caller already has a | |
| 221 | + * reference on the object. | |
| 222 | + * | |
| 223 | + * Will WARN if the refcount is 0, as this represents a possible use-after-free | |
| 224 | + * condition. | |
| 225 | + */ | |
| 89 | 226 | static inline void refcount_inc(refcount_t *r) |
| 90 | 227 | { |
| 91 | − atomic_inc(&r->refs); | |
| 228 | + refcount_add(1, r); | |
| 92 | 229 | } |
| 93 | 230 | |
| 94 | −static inline __must_check bool refcount_sub_and_test(unsigned int i, refcount_t *r) | |
| 231 | +/** | |
| 232 | + * refcount_sub_and_test - subtract from a refcount and test if it is 0 | |
| 233 | + * @i: amount to subtract from the refcount | |
| 234 | + * @r: the refcount | |
| 235 | + * | |
| 236 | + * Similar to atomic_dec_and_test(), but it will WARN, return false and | |
| 237 | + * ultimately leak on underflow and will fail to decrement when saturated | |
| 238 | + * at REFCOUNT_SATURATED. | |
| 239 | + * | |
| 240 | + * Provides release memory ordering, such that prior loads and stores are done | |
| 241 | + * before, and provides an acquire ordering on success such that free() | |
| 242 | + * must come after. | |
| 243 | + * | |
| 244 | + * Use of this function is not recommended for the normal reference counting | |
| 245 | + * use case in which references are taken and released one at a time. In these | |
| 246 | + * cases, refcount_dec(), or one of its variants, should instead be used to | |
| 247 | + * decrement a reference count. | |
| 248 | + * | |
| 249 | + * Return: true if the resulting refcount is 0, false otherwise | |
| 250 | + */ | |
| 251 | +static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r) | |
| 95 | 252 | { |
| 96 | − return atomic_sub_and_test(i, &r->refs); | |
| 253 | + int old = atomic_fetch_sub_release(i, &r->refs); | |
| 254 | + | |
| 255 | + if (old == i) { | |
| 256 | + smp_acquire__after_ctrl_dep(); | |
| 257 | + return true; | |
| 258 | + } | |
| 259 | + | |
| 260 | + if (unlikely(old < 0 || old - i < 0)) | |
| 261 | + refcount_warn_saturate(r, REFCOUNT_SUB_UAF); | |
| 262 | + | |
| 263 | + return false; | |
| 97 | 264 | } |
| 98 | 265 | |
| 266 | +/** | |
| 267 | + * refcount_dec_and_test - decrement a refcount and test if it is 0 | |
| 268 | + * @r: the refcount | |
| 269 | + * | |
| 270 | + * Similar to atomic_dec_and_test(), it will WARN on underflow and fail to | |
| 271 | + * decrement when saturated at REFCOUNT_SATURATED. | |
| 272 | + * | |
| 273 | + * Provides release memory ordering, such that prior loads and stores are done | |
| 274 | + * before, and provides an acquire ordering on success such that free() | |
| 275 | + * must come after. | |
| 276 | + * | |
| 277 | + * Return: true if the resulting refcount is 0, false otherwise | |
| 278 | + */ | |
| 99 | 279 | static inline __must_check bool refcount_dec_and_test(refcount_t *r) |
| 100 | 280 | { |
| 101 | − return atomic_dec_and_test(&r->refs); | |
| 281 | + return refcount_sub_and_test(1, r); | |
| 102 | 282 | } |
| 103 | 283 | |
| 284 | +/** | |
| 285 | + * refcount_dec - decrement a refcount | |
| 286 | + * @r: the refcount | |
| 287 | + * | |
| 288 | + * Similar to atomic_dec(), it will WARN on underflow and fail to decrement | |
| 289 | + * when saturated at REFCOUNT_SATURATED. | |
| 290 | + * | |
| 291 | + * Provides release memory ordering, such that prior loads and stores are done | |
| 292 | + * before. | |
| 293 | + */ | |
| 104 | 294 | static inline void refcount_dec(refcount_t *r) |
| 105 | 295 | { |
| 106 | − atomic_dec(&r->refs); | |
| 296 | + if (unlikely(atomic_fetch_sub_release(1, &r->refs) <= 1)) | |
| 297 | + refcount_warn_saturate(r, REFCOUNT_DEC_LEAK); | |
| 107 | 298 | } |
| 108 | −# endif /* !CONFIG_ARCH_HAS_REFCOUNT */ | |
| 109 | −#endif /* CONFIG_REFCOUNT_FULL */ | |
| 110 | 299 | |
| 111 | 300 | extern __must_check bool refcount_dec_if_one(refcount_t *r); |
| 112 | 301 | extern __must_check bool refcount_dec_not_one(refcount_t *r); |
| @@ -37,14 +37,11 @@ enum ab8505_regulator_id { · 36 unmodified lines | ||
| 37 | 37 | AB8505_LDO_AUX6, |
| 38 | 38 | AB8505_LDO_INTCORE, |
| 39 | 39 | AB8505_LDO_ADC, |
| 40 | − AB8505_LDO_USB, | |
| 41 | 40 | AB8505_LDO_AUDIO, |
| 42 | 41 | AB8505_LDO_ANAMIC1, |
| 43 | 42 | AB8505_LDO_ANAMIC2, |
| 44 | 43 | AB8505_LDO_AUX8, |
| 45 | 44 | AB8505_LDO_ANA, |
| 46 | − AB8505_SYSCLKREQ_2, | |
| 47 | − AB8505_SYSCLKREQ_4, | |
| 48 | 45 | AB8505_NUM_REGULATORS, |
| 49 | 46 | }; |
| 50 | 47 | |
| @@ -36,6 +36,7 @@ struct fixed_voltage_config { · 35 unmodified lines | ||
| 36 | 36 | const char *input_supply; |
| 37 | 37 | int microvolts; |
| 38 | 38 | unsigned startup_delay; |
| 39 | + unsigned int off_on_delay; | |
| 39 | 40 | unsigned enabled_at_boot:1; |
| 40 | 41 | struct regulator_init_data *init_data; |
| 41 | 42 | }; |
| @@ -62,7 +62,8 @@ struct reset_control_lookup { · 61 unmodified lines | ||
| 62 | 62 | * @of_node: corresponding device tree node as phandle target |
| 63 | 63 | * @of_reset_n_cells: number of cells in reset line specifiers |
| 64 | 64 | * @of_xlate: translation function to translate from specifier as found in the |
| 65 | − * device tree to id as given to the reset control ops | |
| 65 | + * device tree to id as given to the reset control ops, defaults | |
| 66 | + * to :c:func:`of_reset_simple_xlate`. | |
| 66 | 67 | * @nr_resets: number of reset controls in this reset controller device |
| 67 | 68 | */ |
| 68 | 69 | struct reset_controller_dev { |
| @@ -203,12 +203,34 @@ static inline struct reset_control *reset_control_get_shared( · 202 unmodified lines | ||
| 203 | 203 | return __reset_control_get(dev, id, 0, true, false, false); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | +/** | |
| 207 | + * reset_control_get_optional_exclusive - optional reset_control_get_exclusive() | |
| 208 | + * @dev: device to be reset by the controller | |
| 209 | + * @id: reset line name | |
| 210 | + * | |
| 211 | + * Optional variant of reset_control_get_exclusive(). If the requested reset | |
| 212 | + * is not specified in the device tree, this function returns NULL instead of | |
| 213 | + * an error. | |
| 214 | + * | |
| 215 | + * See reset_control_get_exclusive() for more information. | |
| 216 | + */ | |
| 206 | 217 | static inline struct reset_control *reset_control_get_optional_exclusive( |
| 207 | 218 | struct device *dev, const char *id) |
| 208 | 219 | { |
| 209 | 220 | return __reset_control_get(dev, id, 0, false, true, true); |
| 210 | 221 | } |
| 211 | 222 | |
| 223 | +/** | |
| 224 | + * reset_control_get_optional_shared - optional reset_control_get_shared() | |
| 225 | + * @dev: device to be reset by the controller | |
| 226 | + * @id: reset line name | |
| 227 | + * | |
| 228 | + * Optional variant of reset_control_get_shared(). If the requested reset | |
| 229 | + * is not specified in the device tree, this function returns NULL instead of | |
| 230 | + * an error. | |
| 231 | + * | |
| 232 | + * See reset_control_get_shared() for more information. | |
| 233 | + */ | |
| 212 | 234 | static inline struct reset_control *reset_control_get_optional_shared( |
| 213 | 235 | struct device *dev, const char *id) |
| 214 | 236 | { |
| @@ -354,12 +376,36 @@ static inline struct reset_control *devm_reset_control_get_shared( · 139 unmodified lines | ||
| 354 | 376 | return __devm_reset_control_get(dev, id, 0, true, false, false); |
| 355 | 377 | } |
| 356 | 378 | |
| 379 | +/** | |
| 380 | + * devm_reset_control_get_optional_exclusive - resource managed | |
| 381 | + * reset_control_get_optional_exclusive() | |
| 382 | + * @dev: device to be reset by the controller | |
| 383 | + * @id: reset line name | |
| 384 | + * | |
| 385 | + * Managed reset_control_get_optional_exclusive(). For reset controllers | |
| 386 | + * returned from this function, reset_control_put() is called automatically on | |
| 387 | + * driver detach. | |
| 388 | + * | |
| 389 | + * See reset_control_get_optional_exclusive() for more information. | |
| 390 | + */ | |
| 357 | 391 | static inline struct reset_control *devm_reset_control_get_optional_exclusive( |
| 358 | 392 | struct device *dev, const char *id) |
| 359 | 393 | { |
| 360 | 394 | return __devm_reset_control_get(dev, id, 0, false, true, true); |
| 361 | 395 | } |
| 362 | 396 | |
| 397 | +/** | |
| 398 | + * devm_reset_control_get_optional_shared - resource managed | |
| 399 | + * reset_control_get_optional_shared() | |
| 400 | + * @dev: device to be reset by the controller | |
| 401 | + * @id: reset line name | |
| 402 | + * | |
| 403 | + * Managed reset_control_get_optional_shared(). For reset controllers returned | |
| 404 | + * from this function, reset_control_put() is called automatically on driver | |
| 405 | + * detach. | |
| 406 | + * | |
| 407 | + * See reset_control_get_optional_shared() for more information. | |
| 408 | + */ | |
| 363 | 409 | static inline struct reset_control *devm_reset_control_get_optional_shared( |
| 364 | 410 | struct device *dev, const char *id) |
| 365 | 411 | { |
| @@ -66,4 +66,16 @@ resource_list_destroy_entry(struct resource_entry *entry) · 65 unmodified lines | ||
| 66 | 66 | #define resource_list_for_each_entry_safe(entry, tmp, list) \ |
| 67 | 67 | list_for_each_entry_safe((entry), (tmp), (list), node) |
| 68 | 68 | |
| 69 | +static inline struct resource_entry * | |
| 70 | +resource_list_first_type(struct list_head *list, unsigned long type) | |
| 71 | +{ | |
| 72 | + struct resource_entry *entry; | |
| 73 | + | |
| 74 | + resource_list_for_each_entry(entry, list) { | |
| 75 | + if (resource_type(entry->res) == type) | |
| 76 | + return entry; | |
| 77 | + } | |
| 78 | + return NULL; | |
| 79 | +} | |
| 80 | + | |
| 69 | 81 | #endif /* _LINUX_RESOURCE_EXT_H */ |
| @@ -159,11 +159,16 @@ struct rtc_device { · 158 unmodified lines | ||
| 159 | 159 | }; |
| 160 | 160 | #define to_rtc_device(d) container_of(d, struct rtc_device, dev) |
| 161 | 161 | |
| 162 | +#define rtc_lock(d) mutex_lock(&d->ops_lock) | |
| 163 | +#define rtc_unlock(d) mutex_unlock(&d->ops_lock) | |
| 164 | + | |
| 162 | 165 | /* useful timestamps */ |
| 166 | +#define RTC_TIMESTAMP_BEGIN_0000 -62167219200ULL /* 0000-01-01 00:00:00 */ | |
| 163 | 167 | #define RTC_TIMESTAMP_BEGIN_1900 -2208988800LL /* 1900-01-01 00:00:00 */ |
| 164 | 168 | #define RTC_TIMESTAMP_BEGIN_2000 946684800LL /* 2000-01-01 00:00:00 */ |
| 165 | 169 | #define RTC_TIMESTAMP_END_2063 2966371199LL /* 2063-12-31 23:59:59 */ |
| 166 | 170 | #define RTC_TIMESTAMP_END_2099 4102444799LL /* 2099-12-31 23:59:59 */ |
| 171 | +#define RTC_TIMESTAMP_END_2199 7258118399LL /* 2199-12-31 23:59:59 */ | |
| 167 | 172 | #define RTC_TIMESTAMP_END_9999 253402300799LL /* 9999-12-31 23:59:59 */ |
| 168 | 173 | |
| 169 | 174 | extern struct rtc_device *devm_rtc_device_register(struct device *dev, |
| @@ -42,14 +42,11 @@ · 41 unmodified lines | ||
| 42 | 42 | struct ds1685_priv { |
| 43 | 43 | struct rtc_device *dev; |
| 44 | 44 | void __iomem *regs; |
| 45 | + void __iomem *data; | |
| 45 | 46 | u32 regstep; |
| 46 | − resource_size_t baseaddr; | |
| 47 | − size_t size; | |
| 48 | 47 | int irq_num; |
| 49 | 48 | bool bcd_mode; |
| 50 | 49 | bool no_irq; |
| 51 | − bool uie_unsupported; | |
| 52 | − bool alloc_io_resources; | |
| 53 | 50 | u8 (*read)(struct ds1685_priv *, int); |
| 54 | 51 | void (*write)(struct ds1685_priv *, int, u8); |
| 55 | 52 | void (*prepare_poweroff)(void); |
| @@ -74,12 +71,13 @@ struct ds1685_rtc_platform_data { · 18 unmodified lines | ||
| 74 | 71 | const bool bcd_mode; |
| 75 | 72 | const bool no_irq; |
| 76 | 73 | const bool uie_unsupported; |
| 77 | − const bool alloc_io_resources; | |
| 78 | − u8 (*plat_read)(struct ds1685_priv *, int); | |
| 79 | − void (*plat_write)(struct ds1685_priv *, int, u8); | |
| 80 | 74 | void (*plat_prepare_poweroff)(void); |
| 81 | 75 | void (*plat_wake_alarm)(void); |
| 82 | 76 | void (*plat_post_ram_clear)(void); |
| 77 | + enum { | |
| 78 | + ds1685_reg_direct, | |
| 79 | + ds1685_reg_indirect | |
| 80 | + } access_type; | |
| 83 | 81 | }; |
| 84 | 82 | |
| 85 | 83 | |
| @@ -1262,6 +1262,7 @@ struct rtsx_pcr { · 1261 unmodified lines | ||
| 1262 | 1262 | #define PID_5250 0x5250 |
| 1263 | 1263 | #define PID_525A 0x525A |
| 1264 | 1264 | #define PID_5260 0x5260 |
| 1265 | +#define PID_5261 0x5261 | |
| 1265 | 1266 | |
| 1266 | 1267 | #define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid)) |
| 1267 | 1268 | #define PCI_VID(pcr) ((pcr)->pci->vendor) |
| @@ -215,14 +215,14 @@ static inline void __raw_write_lock(rwlock_t *lock) · 214 unmodified lines | ||
| 215 | 215 | |
| 216 | 216 | static inline void __raw_write_unlock(rwlock_t *lock) |
| 217 | 217 | { |
| 218 | − rwlock_release(&lock->dep_map, 1, _RET_IP_); | |
| 218 | + rwlock_release(&lock->dep_map, _RET_IP_); | |
| 219 | 219 | do_raw_write_unlock(lock); |
| 220 | 220 | preempt_enable(); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | static inline void __raw_read_unlock(rwlock_t *lock) |
| 224 | 224 | { |
| 225 | − rwlock_release(&lock->dep_map, 1, _RET_IP_); | |
| 225 | + rwlock_release(&lock->dep_map, _RET_IP_); | |
| 226 | 226 | do_raw_read_unlock(lock); |
| 227 | 227 | preempt_enable(); |
| 228 | 228 | } |
| @@ -230,7 +230,7 @@ static inline void __raw_read_unlock(rwlock_t *lock) · 1 unmodified line | ||
| 230 | 230 | static inline void |
| 231 | 231 | __raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) |
| 232 | 232 | { |
| 233 | − rwlock_release(&lock->dep_map, 1, _RET_IP_); | |
| 233 | + rwlock_release(&lock->dep_map, _RET_IP_); | |
| 234 | 234 | do_raw_read_unlock(lock); |
| 235 | 235 | local_irq_restore(flags); |
| 236 | 236 | preempt_enable(); |
| @@ -238,7 +238,7 @@ __raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) · 1 unmodified line | ||
| 238 | 238 | |
| 239 | 239 | static inline void __raw_read_unlock_irq(rwlock_t *lock) |
| 240 | 240 | { |
| 241 | − rwlock_release(&lock->dep_map, 1, _RET_IP_); | |
| 241 | + rwlock_release(&lock->dep_map, _RET_IP_); | |
| 242 | 242 | do_raw_read_unlock(lock); |
| 243 | 243 | local_irq_enable(); |
| 244 | 244 | preempt_enable(); |
| @@ -246,7 +246,7 @@ static inline void __raw_read_unlock_irq(rwlock_t *lock) · 1 unmodified line | ||
| 246 | 246 | |
| 247 | 247 | static inline void __raw_read_unlock_bh(rwlock_t *lock) |
| 248 | 248 | { |
| 249 | − rwlock_release(&lock->dep_map, 1, _RET_IP_); | |
| 249 | + rwlock_release(&lock->dep_map, _RET_IP_); | |
| 250 | 250 | do_raw_read_unlock(lock); |
| 251 | 251 | __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); |
| 252 | 252 | } |
| @@ -254,7 +254,7 @@ static inline void __raw_read_unlock_bh(rwlock_t *lock) · 1 unmodified line | ||
| 254 | 254 | static inline void __raw_write_unlock_irqrestore(rwlock_t *lock, |
| 255 | 255 | unsigned long flags) |
| 256 | 256 | { |
| 257 | − rwlock_release(&lock->dep_map, 1, _RET_IP_); | |
| 257 | + rwlock_release(&lock->dep_map, _RET_IP_); | |
| 258 | 258 | do_raw_write_unlock(lock); |
| 259 | 259 | local_irq_restore(flags); |
| 260 | 260 | preempt_enable(); |
| @@ -262,7 +262,7 @@ static inline void __raw_write_unlock_irqrestore(rwlock_t *lock, · 1 unmodified line | ||
| 262 | 262 | |
| 263 | 263 | static inline void __raw_write_unlock_irq(rwlock_t *lock) |
| 264 | 264 | { |
| 265 | − rwlock_release(&lock->dep_map, 1, _RET_IP_); | |
| 265 | + rwlock_release(&lock->dep_map, _RET_IP_); | |
| 266 | 266 | do_raw_write_unlock(lock); |
| 267 | 267 | local_irq_enable(); |
| 268 | 268 | preempt_enable(); |
| @@ -270,7 +270,7 @@ static inline void __raw_write_unlock_irq(rwlock_t *lock) · 1 unmodified line | ||
| 270 | 270 | |
| 271 | 271 | static inline void __raw_write_unlock_bh(rwlock_t *lock) |
| 272 | 272 | { |
| 273 | − rwlock_release(&lock->dep_map, 1, _RET_IP_); | |
| 273 | + rwlock_release(&lock->dep_map, _RET_IP_); | |
| 274 | 274 | do_raw_write_unlock(lock); |
| 275 | 275 | __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); |
| 276 | 276 | } |
| @@ -216,15 +216,6 @@ int sbitmap_get_shallow(struct sbitmap *sb, unsigned int alloc_hint, · 215 unmodified lines | ||
| 216 | 216 | */ |
| 217 | 217 | bool sbitmap_any_bit_set(const struct sbitmap *sb); |
| 218 | 218 | |
| 219 | −/** | |
| 220 | − * sbitmap_any_bit_clear() - Check for an unset bit in a &struct | |
| 221 | − * sbitmap. | |
| 222 | − * @sb: Bitmap to check. | |
| 223 | − * | |
| 224 | − * Return: true if any bit in the bitmap is clear, false otherwise. | |
| 225 | − */ | |
| 226 | −bool sbitmap_any_bit_clear(const struct sbitmap *sb); | |
| 227 | − | |
| 228 | 219 | #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) |
| 229 | 220 | #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U)) |
| 230 | 221 | |
| @@ -251,16 +251,21 @@ struct prev_cputime { · 250 unmodified lines | ||
| 251 | 251 | enum vtime_state { |
| 252 | 252 | /* Task is sleeping or running in a CPU with VTIME inactive: */ |
| 253 | 253 | VTIME_INACTIVE = 0, |
| 254 | − /* Task runs in userspace in a CPU with VTIME active: */ | |
| 255 | − VTIME_USER, | |
| 254 | + /* Task is idle */ | |
| 255 | + VTIME_IDLE, | |
| 256 | 256 | /* Task runs in kernelspace in a CPU with VTIME active: */ |
| 257 | 257 | VTIME_SYS, |
| 258 | + /* Task runs in userspace in a CPU with VTIME active: */ | |
| 259 | + VTIME_USER, | |
| 260 | + /* Task runs as guests in a CPU with VTIME active: */ | |
| 261 | + VTIME_GUEST, | |
| 258 | 262 | }; |
| 259 | 263 | |
| 260 | 264 | struct vtime { |
| 261 | 265 | seqcount_t seqcount; |
| 262 | 266 | unsigned long long starttime; |
| 263 | 267 | enum vtime_state state; |
| 268 | + unsigned int cpu; | |
| 264 | 269 | u64 utime; |
| 265 | 270 | u64 stime; |
| 266 | 271 | u64 gtime; |
| @@ -858,7 +863,7 @@ struct task_struct { · 591 unmodified lines | ||
| 858 | 863 | u64 start_time; |
| 859 | 864 | |
| 860 | 865 | /* Boot based time in nsecs: */ |
| 861 | − u64 real_start_time; | |
| 866 | + u64 start_boottime; | |
| 862 | 867 | |
| 863 | 868 | /* MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific: */ |
| 864 | 869 | unsigned long min_flt; |
| @@ -1055,6 +1060,8 @@ struct task_struct { · 190 unmodified lines | ||
| 1055 | 1060 | #endif |
| 1056 | 1061 | struct list_head pi_state_list; |
| 1057 | 1062 | struct futex_pi_state *pi_state_cache; |
| 1063 | + struct mutex futex_exit_mutex; | |
| 1064 | + unsigned int futex_state; | |
| 1058 | 1065 | #endif |
| 1059 | 1066 | #ifdef CONFIG_PERF_EVENTS |
| 1060 | 1067 | struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; |
| @@ -1207,6 +1214,8 @@ struct task_struct { · 146 unmodified lines | ||
| 1207 | 1214 | #endif /* CONFIG_TRACING */ |
| 1208 | 1215 | |
| 1209 | 1216 | #ifdef CONFIG_KCOV |
| 1217 | + /* See kernel/kcov.c for more details. */ | |
| 1218 | + | |
| 1210 | 1219 | /* Coverage collection mode enabled for this task (0 if disabled): */ |
| 1211 | 1220 | unsigned int kcov_mode; |
| 1212 | 1221 | |
| @@ -1218,6 +1227,12 @@ struct task_struct { · 5 unmodified lines | ||
| 1218 | 1227 | |
| 1219 | 1228 | /* KCOV descriptor wired with this task or NULL: */ |
| 1220 | 1229 | struct kcov *kcov; |
| 1230 | + | |
| 1231 | + /* KCOV common handle for remote coverage collection: */ | |
| 1232 | + u64 kcov_handle; | |
| 1233 | + | |
| 1234 | + /* KCOV sequence number: */ | |
| 1235 | + int kcov_sequence; | |
| 1221 | 1236 | #endif |
| 1222 | 1237 | |
| 1223 | 1238 | #ifdef CONFIG_MEMCG |
| @@ -1446,7 +1461,6 @@ extern struct pid *cad_pid; · 222 unmodified lines | ||
| 1446 | 1461 | */ |
| 1447 | 1462 | #define PF_IDLE 0x00000002 /* I am an IDLE thread */ |
| 1448 | 1463 | #define PF_EXITING 0x00000004 /* Getting shut down */ |
| 1449 | −#define PF_EXITPIDONE 0x00000008 /* PI exit done on shut down */ | |
| 1450 | 1464 | #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ |
| 1451 | 1465 | #define PF_WQ_WORKER 0x00000020 /* I'm a workqueue worker */ |
| 1452 | 1466 | #define PF_FORKNOEXEC 0x00000040 /* Forked but didn't exec */ |
| @@ -1472,6 +1486,7 @@ extern struct pid *cad_pid; · 19 unmodified lines | ||
| 1472 | 1486 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ |
| 1473 | 1487 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
| 1474 | 1488 | #define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ |
| 1489 | +#define PF_IO_WORKER 0x20000000 /* Task is an IO worker */ | |
| 1475 | 1490 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ |
| 1476 | 1491 | #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */ |
| 1477 | 1492 | |
| @@ -12,6 +12,8 @@ · 11 unmodified lines | ||
| 12 | 12 | #define SCHED_CPUFREQ_MIGRATION (1U << 1) |
| 13 | 13 | |
| 14 | 14 | #ifdef CONFIG_CPU_FREQ |
| 15 | +struct cpufreq_policy; | |
| 16 | + | |
| 15 | 17 | struct update_util_data { |
| 16 | 18 | void (*func)(struct update_util_data *data, u64 time, unsigned int flags); |
| 17 | 19 | }; |
| @@ -20,6 +22,7 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data, · 2 unmodified lines | ||
| 20 | 22 | void (*func)(struct update_util_data *data, u64 time, |
| 21 | 23 | unsigned int flags)); |
| 22 | 24 | void cpufreq_remove_update_util_hook(int cpu); |
| 25 | +bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy); | |
| 23 | 26 | |
| 24 | 27 | static inline unsigned long map_util_freq(unsigned long util, |
| 25 | 28 | unsigned long freq, unsigned long cap) |
| @@ -117,8 +117,10 @@ extern struct mm_struct *get_task_mm(struct task_struct *task); · 116 unmodified lines | ||
| 117 | 117 | * succeeds. |
| 118 | 118 | */ |
| 119 | 119 | extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode); |
| 120 | −/* Remove the current tasks stale references to the old mm_struct */ | |
| 121 | −extern void mm_release(struct task_struct *, struct mm_struct *); | |
| 120 | +/* Remove the current tasks stale references to the old mm_struct on exit() */ | |
| 121 | +extern void exit_mm_release(struct task_struct *, struct mm_struct *); | |
| 122 | +/* Remove the current tasks stale references to the old mm_struct on exec() */ | |
| 123 | +extern void exec_mm_release(struct task_struct *, struct mm_struct *); | |
| 122 | 124 | |
| 123 | 125 | #ifdef CONFIG_MEMCG |
| 124 | 126 | extern void mm_update_next_owner(struct mm_struct *mm); |
| @@ -26,6 +26,9 @@ struct kernel_clone_args { · 25 unmodified lines | ||
| 26 | 26 | unsigned long stack; |
| 27 | 27 | unsigned long stack_size; |
| 28 | 28 | unsigned long tls; |
| 29 | + pid_t *set_tid; | |
| 30 | + /* Number of elements in *set_tid */ | |
| 31 | + size_t set_tid_size; | |
| 29 | 32 | }; |
| 30 | 33 | |
| 31 | 34 | /* |
| @@ -33,10 +33,10 @@ struct seccomp { · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER |
| 35 | 35 | extern int __secure_computing(const struct seccomp_data *sd); |
| 36 | −static inline int secure_computing(const struct seccomp_data *sd) | |
| 36 | +static inline int secure_computing(void) | |
| 37 | 37 | { |
| 38 | 38 | if (unlikely(test_thread_flag(TIF_SECCOMP))) |
| 39 | − return __secure_computing(sd); | |
| 39 | + return __secure_computing(NULL); | |
| 40 | 40 | return 0; |
| 41 | 41 | } |
| 42 | 42 | #else |
| @@ -59,7 +59,7 @@ struct seccomp { }; · 16 unmodified lines | ||
| 59 | 59 | struct seccomp_filter { }; |
| 60 | 60 | |
| 61 | 61 | #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER |
| 62 | −static inline int secure_computing(struct seccomp_data *sd) { return 0; } | |
| 62 | +static inline int secure_computing(void) { return 0; } | |
| 63 | 63 | #else |
| 64 | 64 | static inline void secure_computing_strict(int this_syscall) { return; } |
| 65 | 65 | #endif |
| @@ -117,12 +117,14 @@ enum lockdown_reason { · 116 unmodified lines | ||
| 117 | 117 | LOCKDOWN_MODULE_PARAMETERS, |
| 118 | 118 | LOCKDOWN_MMIOTRACE, |
| 119 | 119 | LOCKDOWN_DEBUGFS, |
| 120 | + LOCKDOWN_XMON_WR, | |
| 120 | 121 | LOCKDOWN_INTEGRITY_MAX, |
| 121 | 122 | LOCKDOWN_KCORE, |
| 122 | 123 | LOCKDOWN_KPROBES, |
| 123 | 124 | LOCKDOWN_BPF_READ, |
| 124 | 125 | LOCKDOWN_PERF, |
| 125 | 126 | LOCKDOWN_TRACEFS, |
| 127 | + LOCKDOWN_XMON_RW, | |
| 126 | 128 | LOCKDOWN_CONFIDENTIALITY_MAX, |
| 127 | 129 | }; |
| 128 | 130 | |
| @@ -1895,5 +1897,42 @@ static inline void security_bpf_prog_free(struct bpf_prog_aux *aux) · 1766 unmodified lines | ||
| 1895 | 1897 | #endif /* CONFIG_SECURITY */ |
| 1896 | 1898 | #endif /* CONFIG_BPF_SYSCALL */ |
| 1897 | 1899 | |
| 1898 | −#endif /* ! __LINUX_SECURITY_H */ | |
| 1900 | +#ifdef CONFIG_PERF_EVENTS | |
| 1901 | +struct perf_event_attr; | |
| 1902 | +struct perf_event; | |
| 1903 | + | |
| 1904 | +#ifdef CONFIG_SECURITY | |
| 1905 | +extern int security_perf_event_open(struct perf_event_attr *attr, int type); | |
| 1906 | +extern int security_perf_event_alloc(struct perf_event *event); | |
| 1907 | +extern void security_perf_event_free(struct perf_event *event); | |
| 1908 | +extern int security_perf_event_read(struct perf_event *event); | |
| 1909 | +extern int security_perf_event_write(struct perf_event *event); | |
| 1910 | +#else | |
| 1911 | +static inline int security_perf_event_open(struct perf_event_attr *attr, | |
| 1912 | + int type) | |
| 1913 | +{ | |
| 1914 | + return 0; | |
| 1915 | +} | |
| 1916 | + | |
| 1917 | +static inline int security_perf_event_alloc(struct perf_event *event) | |
| 1918 | +{ | |
| 1919 | + return 0; | |
| 1920 | +} | |
| 1921 | + | |
| 1922 | +static inline void security_perf_event_free(struct perf_event *event) | |
| 1923 | +{ | |
| 1924 | +} | |
| 1925 | + | |
| 1926 | +static inline int security_perf_event_read(struct perf_event *event) | |
| 1927 | +{ | |
| 1928 | + return 0; | |
| 1929 | +} | |
| 1899 | 1930 | |
| 1931 | +static inline int security_perf_event_write(struct perf_event *event) | |
| 1932 | +{ | |
| 1933 | + return 0; | |
| 1934 | +} | |
| 1935 | +#endif /* CONFIG_SECURITY */ | |
| 1936 | +#endif /* CONFIG_PERF_EVENTS */ | |
| 1937 | + | |
| 1938 | +#endif /* ! __LINUX_SECURITY_H */ | |
| @@ -42,6 +42,7 @@ static inline bool is_sed_ioctl(unsigned int cmd) · 41 unmodified lines | ||
| 42 | 42 | case IOC_OPAL_PSID_REVERT_TPR: |
| 43 | 43 | case IOC_OPAL_MBR_DONE: |
| 44 | 44 | case IOC_OPAL_WRITE_SHADOW_MBR: |
| 45 | + case IOC_OPAL_GENERIC_TABLE_RW: | |
| 45 | 46 | return true; |
| 46 | 47 | } |
| 47 | 48 | return false; |
| @@ -125,6 +125,9 @@ extern int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len); · 124 unmodified lines | ||
| 125 | 125 | extern int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, |
| 126 | 126 | unsigned int len); |
| 127 | 127 | extern int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc); |
| 128 | +extern int seq_buf_hex_dump(struct seq_buf *s, const char *prefix_str, | |
| 129 | + int prefix_type, int rowsize, int groupsize, | |
| 130 | + const void *buf, size_t len, bool ascii); | |
| 128 | 131 | |
| 129 | 132 | #ifdef CONFIG_BINARY_PRINTF |
| 130 | 133 | extern int |
| @@ -95,7 +95,7 @@ static inline void seqcount_lockdep_reader_access(const seqcount_t *s) · 94 unmodified lines | ||
| 95 | 95 | |
| 96 | 96 | local_irq_save(flags); |
| 97 | 97 | seqcount_acquire_read(&l->dep_map, 0, 0, _RET_IP_); |
| 98 | − seqcount_release(&l->dep_map, 1, _RET_IP_); | |
| 98 | + seqcount_release(&l->dep_map, _RET_IP_); | |
| 99 | 99 | local_irq_restore(flags); |
| 100 | 100 | } |
| 101 | 101 | |
| @@ -415,7 +415,7 @@ static inline void write_seqcount_begin(seqcount_t *s) · 313 unmodified lines | ||
| 415 | 415 | |
| 416 | 416 | static inline void write_seqcount_end(seqcount_t *s) |
| 417 | 417 | { |
| 418 | − seqcount_release(&s->dep_map, 1, _RET_IP_); | |
| 418 | + seqcount_release(&s->dep_map, _RET_IP_); | |
| 419 | 419 | raw_write_seqcount_end(s); |
| 420 | 420 | } |
| 421 | 421 | |
| @@ -428,6 +428,10 @@ enum { · 427 unmodified lines | ||
| 428 | 428 | SFP_TEC_CUR = 0x6c, |
| 429 | 429 | |
| 430 | 430 | SFP_STATUS = 0x6e, |
| 431 | + SFP_STATUS_TX_DISABLE = BIT(7), | |
| 432 | + SFP_STATUS_TX_DISABLE_FORCE = BIT(6), | |
| 433 | + SFP_STATUS_TX_FAULT = BIT(2), | |
| 434 | + SFP_STATUS_RX_LOS = BIT(1), | |
| 431 | 435 | SFP_ALARM0 = 0x70, |
| 432 | 436 | SFP_ALARM0_TEMP_HIGH = BIT(7), |
| 433 | 437 | SFP_ALARM0_TEMP_LOW = BIT(6), |
| @@ -508,10 +512,11 @@ int sfp_get_module_eeprom(struct sfp_bus *bus, struct ethtool_eeprom *ee, · 74 unmodified lines | ||
| 508 | 512 | u8 *data); |
| 509 | 513 | void sfp_upstream_start(struct sfp_bus *bus); |
| 510 | 514 | void sfp_upstream_stop(struct sfp_bus *bus); |
| 511 | −struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode, | |
| 512 | − void *upstream, | |
| 513 | − const struct sfp_upstream_ops *ops); | |
| 514 | −void sfp_unregister_upstream(struct sfp_bus *bus); | |
| 515 | +void sfp_bus_put(struct sfp_bus *bus); | |
| 516 | +struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode); | |
| 517 | +int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream, | |
| 518 | + const struct sfp_upstream_ops *ops); | |
| 519 | +void sfp_bus_del_upstream(struct sfp_bus *bus); | |
| 515 | 520 | #else |
| 516 | 521 | static inline int sfp_parse_port(struct sfp_bus *bus, |
| 517 | 522 | const struct sfp_eeprom_id *id, |
| @@ -553,14 +558,22 @@ static inline void sfp_upstream_stop(struct sfp_bus *bus) · 35 unmodified lines | ||
| 553 | 558 | { |
| 554 | 559 | } |
| 555 | 560 | |
| 556 | −static inline struct sfp_bus *sfp_register_upstream( | |
| 557 | − struct fwnode_handle *fwnode, void *upstream, | |
| 558 | − const struct sfp_upstream_ops *ops) | |
| 561 | +static inline void sfp_bus_put(struct sfp_bus *bus) | |
| 559 | 562 | { |
| 560 | − return (struct sfp_bus *)-1; | |
| 561 | 563 | } |
| 562 | 564 | |
| 563 | −static inline void sfp_unregister_upstream(struct sfp_bus *bus) | |
| 565 | +static inline struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode) | |
| 566 | +{ | |
| 567 | + return NULL; | |
| 568 | +} | |
| 569 | + | |
| 570 | +static inline int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream, | |
| 571 | + const struct sfp_upstream_ops *ops) | |
| 572 | +{ | |
| 573 | + return 0; | |
| 574 | +} | |
| 575 | + | |
| 576 | +static inline void sfp_bus_del_upstream(struct sfp_bus *bus) | |
| 564 | 577 | { |
| 565 | 578 | } |
| 566 | 579 | #endif |
| @@ -1795,7 +1795,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, · 1794 unmodified lines | ||
| 1795 | 1795 | */ |
| 1796 | 1796 | static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_) |
| 1797 | 1797 | { |
| 1798 | − struct sk_buff *skb = list_->prev; | |
| 1798 | + struct sk_buff *skb = READ_ONCE(list_->prev); | |
| 1799 | 1799 | |
| 1800 | 1800 | if (skb == (struct sk_buff *)list_) |
| 1801 | 1801 | skb = NULL; |
| @@ -1861,7 +1861,9 @@ static inline void __skb_insert(struct sk_buff *newsk, · 59 unmodified lines | ||
| 1861 | 1861 | struct sk_buff *prev, struct sk_buff *next, |
| 1862 | 1862 | struct sk_buff_head *list) |
| 1863 | 1863 | { |
| 1864 | − /* see skb_queue_empty_lockless() for the opposite READ_ONCE() */ | |
| 1864 | + /* See skb_queue_empty_lockless() and skb_peek_tail() | |
| 1865 | + * for the opposite READ_ONCE() | |
| 1866 | + */ | |
| 1865 | 1867 | WRITE_ONCE(newsk->next, next); |
| 1866 | 1868 | WRITE_ONCE(newsk->prev, prev); |
| 1867 | 1869 | WRITE_ONCE(next->prev, newsk); |
| @@ -2277,12 +2279,12 @@ static inline void *pskb_pull(struct sk_buff *skb, unsigned int len) · 409 unmodified lines | ||
| 2277 | 2279 | return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len); |
| 2278 | 2280 | } |
| 2279 | 2281 | |
| 2280 | −static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len) | |
| 2282 | +static inline bool pskb_may_pull(struct sk_buff *skb, unsigned int len) | |
| 2281 | 2283 | { |
| 2282 | 2284 | if (likely(len <= skb_headlen(skb))) |
| 2283 | − return 1; | |
| 2285 | + return true; | |
| 2284 | 2286 | if (unlikely(len > skb->len)) |
| 2285 | − return 0; | |
| 2287 | + return false; | |
| 2286 | 2288 | return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL; |
| 2287 | 2289 | } |
| 2288 | 2290 | |
| @@ -3527,8 +3529,9 @@ int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci); · 1238 unmodified lines | ||
| 3527 | 3529 | int skb_vlan_pop(struct sk_buff *skb); |
| 3528 | 3530 | int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); |
| 3529 | 3531 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, |
| 3530 | − int mac_len); | |
| 3531 | −int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len); | |
| 3532 | + int mac_len, bool ethernet); | |
| 3533 | +int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len, | |
| 3534 | + bool ethernet); | |
| 3532 | 3535 | int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); |
| 3533 | 3536 | int skb_mpls_dec_ttl(struct sk_buff *skb); |
| 3534 | 3537 | struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, |
| @@ -3656,9 +3659,12 @@ static inline void skb_get_new_timestamp(const struct sk_buff *skb, · 121 unmodified lines | ||
| 3656 | 3659 | } |
| 3657 | 3660 | |
| 3658 | 3661 | static inline void skb_get_timestampns(const struct sk_buff *skb, |
| 3659 | − struct timespec *stamp) | |
| 3662 | + struct __kernel_old_timespec *stamp) | |
| 3660 | 3663 | { |
| 3661 | − *stamp = ktime_to_timespec(skb->tstamp); | |
| 3664 | + struct timespec64 ts = ktime_to_timespec64(skb->tstamp); | |
| 3665 | + | |
| 3666 | + stamp->tv_sec = ts.tv_sec; | |
| 3667 | + stamp->tv_nsec = ts.tv_nsec; | |
| 3662 | 3668 | } |
| 3663 | 3669 | |
| 3664 | 3670 | static inline void skb_get_new_timestampns(const struct sk_buff *skb, |
| @@ -4169,12 +4175,18 @@ static inline void skb_ext_reset(struct sk_buff *skb) · 504 unmodified lines | ||
| 4169 | 4175 | skb->active_extensions = 0; |
| 4170 | 4176 | } |
| 4171 | 4177 | } |
| 4178 | + | |
| 4179 | +static inline bool skb_has_extensions(struct sk_buff *skb) | |
| 4180 | +{ | |
| 4181 | + return unlikely(skb->active_extensions); | |
| 4182 | +} | |
| 4172 | 4183 | #else |
| 4173 | 4184 | static inline void skb_ext_put(struct sk_buff *skb) {} |
| 4174 | 4185 | static inline void skb_ext_reset(struct sk_buff *skb) {} |
| 4175 | 4186 | static inline void skb_ext_del(struct sk_buff *skb, int unused) {} |
| 4176 | 4187 | static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} |
| 4177 | 4188 | static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} |
| 4189 | +static inline bool skb_has_extensions(struct sk_buff *skb) { return false; } | |
| 4178 | 4190 | #endif /* CONFIG_SKB_EXTENSIONS */ |
| 4179 | 4191 | |
| 4180 | 4192 | static inline void nf_reset_ct(struct sk_buff *skb) |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <net/strparser.h> |
| 15 | 15 | |
| 16 | 16 | #define MAX_MSG_FRAGS MAX_SKB_FRAGS |
| 17 | +#define NR_MSG_FRAG_IDS (MAX_MSG_FRAGS + 1) | |
| 17 | 18 | |
| 18 | 19 | enum __sk_action { |
| 19 | 20 | __SK_DROP = 0, |
| @@ -28,13 +29,16 @@ struct sk_msg_sg { · 8 unmodified lines | ||
| 28 | 29 | u32 end; |
| 29 | 30 | u32 size; |
| 30 | 31 | u32 copybreak; |
| 31 | − bool copy[MAX_MSG_FRAGS]; | |
| 32 | − /* The extra element is used for chaining the front and sections when | |
| 33 | − * the list becomes partitioned (e.g. end < start). The crypto APIs | |
| 34 | − * require the chaining. | |
| 32 | + unsigned long copy; | |
| 33 | + /* The extra two elements: | |
| 34 | + * 1) used for chaining the front and sections when the list becomes | |
| 35 | + * partitioned (e.g. end < start). The crypto APIs require the | |
| 36 | + * chaining; | |
| 37 | + * 2) to chain tailer SG entries after the message. | |
| 35 | 38 | */ |
| 36 | − struct scatterlist data[MAX_MSG_FRAGS + 1]; | |
| 39 | + struct scatterlist data[MAX_MSG_FRAGS + 2]; | |
| 37 | 40 | }; |
| 41 | +static_assert(BITS_PER_LONG >= NR_MSG_FRAG_IDS); | |
| 38 | 42 | |
| 39 | 43 | /* UAPI in filter.c depends on struct sk_msg_sg being first element. */ |
| 40 | 44 | struct sk_msg { |
| @@ -141,13 +145,13 @@ static inline void sk_msg_apply_bytes(struct sk_psock *psock, u32 bytes) · 100 unmodified lines | ||
| 141 | 145 | |
| 142 | 146 | static inline u32 sk_msg_iter_dist(u32 start, u32 end) |
| 143 | 147 | { |
| 144 | − return end >= start ? end - start : end + (MAX_MSG_FRAGS - start); | |
| 148 | + return end >= start ? end - start : end + (NR_MSG_FRAG_IDS - start); | |
| 145 | 149 | } |
| 146 | 150 | |
| 147 | 151 | #define sk_msg_iter_var_prev(var) \ |
| 148 | 152 | do { \ |
| 149 | 153 | if (var == 0) \ |
| 150 | − var = MAX_MSG_FRAGS - 1; \ | |
| 154 | + var = NR_MSG_FRAG_IDS - 1; \ | |
| 151 | 155 | else \ |
| 152 | 156 | var--; \ |
| 153 | 157 | } while (0) |
| @@ -155,7 +159,7 @@ static inline u32 sk_msg_iter_dist(u32 start, u32 end) · 1 unmodified line | ||
| 155 | 159 | #define sk_msg_iter_var_next(var) \ |
| 156 | 160 | do { \ |
| 157 | 161 | var++; \ |
| 158 | − if (var == MAX_MSG_FRAGS) \ | |
| 162 | + if (var == NR_MSG_FRAG_IDS) \ | |
| 159 | 163 | var = 0; \ |
| 160 | 164 | } while (0) |
| 161 | 165 | |
| @@ -172,9 +176,9 @@ static inline void sk_msg_clear_meta(struct sk_msg *msg) · 10 unmodified lines | ||
| 172 | 176 | |
| 173 | 177 | static inline void sk_msg_init(struct sk_msg *msg) |
| 174 | 178 | { |
| 175 | − BUILD_BUG_ON(ARRAY_SIZE(msg->sg.data) - 1 != MAX_MSG_FRAGS); | |
| 179 | + BUILD_BUG_ON(ARRAY_SIZE(msg->sg.data) - 1 != NR_MSG_FRAG_IDS); | |
| 176 | 180 | memset(msg, 0, sizeof(*msg)); |
| 177 | − sg_init_marker(msg->sg.data, MAX_MSG_FRAGS); | |
| 181 | + sg_init_marker(msg->sg.data, NR_MSG_FRAG_IDS); | |
| 178 | 182 | } |
| 179 | 183 | |
| 180 | 184 | static inline void sk_msg_xfer(struct sk_msg *dst, struct sk_msg *src, |
| @@ -195,14 +199,11 @@ static inline void sk_msg_xfer_full(struct sk_msg *dst, struct sk_msg *src) · 14 unmodified lines | ||
| 195 | 199 | |
| 196 | 200 | static inline bool sk_msg_full(const struct sk_msg *msg) |
| 197 | 201 | { |
| 198 | − return (msg->sg.end == msg->sg.start) && msg->sg.size; | |
| 202 | + return sk_msg_iter_dist(msg->sg.start, msg->sg.end) == MAX_MSG_FRAGS; | |
| 199 | 203 | } |
| 200 | 204 | |
| 201 | 205 | static inline u32 sk_msg_elem_used(const struct sk_msg *msg) |
| 202 | 206 | { |
| 203 | − if (sk_msg_full(msg)) | |
| 204 | − return MAX_MSG_FRAGS; | |
| 205 | − | |
| 206 | 207 | return sk_msg_iter_dist(msg->sg.start, msg->sg.end); |
| 207 | 208 | } |
| 208 | 209 | |
| @@ -230,7 +231,7 @@ static inline void sk_msg_compute_data_pointers(struct sk_msg *msg) · 21 unmodified lines | ||
| 230 | 231 | { |
| 231 | 232 | struct scatterlist *sge = sk_msg_elem(msg, msg->sg.start); |
| 232 | 233 | |
| 233 | − if (msg->sg.copy[msg->sg.start]) { | |
| 234 | + if (test_bit(msg->sg.start, &msg->sg.copy)) { | |
| 234 | 235 | msg->data = NULL; |
| 235 | 236 | msg->data_end = NULL; |
| 236 | 237 | } else { |
| @@ -249,7 +250,7 @@ static inline void sk_msg_page_add(struct sk_msg *msg, struct page *page, · 12 unmodified lines | ||
| 249 | 250 | sg_set_page(sge, page, len, offset); |
| 250 | 251 | sg_unmark_end(sge); |
| 251 | 252 | |
| 252 | − msg->sg.copy[msg->sg.end] = true; | |
| 253 | + __set_bit(msg->sg.end, &msg->sg.copy); | |
| 253 | 254 | msg->sg.size += len; |
| 254 | 255 | sk_msg_iter_next(msg, end); |
| 255 | 256 | } |
| @@ -257,7 +258,10 @@ static inline void sk_msg_page_add(struct sk_msg *msg, struct page *page, · 1 unmodified line | ||
| 257 | 258 | static inline void sk_msg_sg_copy(struct sk_msg *msg, u32 i, bool copy_state) |
| 258 | 259 | { |
| 259 | 260 | do { |
| 260 | − msg->sg.copy[i] = copy_state; | |
| 261 | + if (copy_state) | |
| 262 | + __set_bit(i, &msg->sg.copy); | |
| 263 | + else | |
| 264 | + __clear_bit(i, &msg->sg.copy); | |
| 261 | 265 | sk_msg_iter_var_next(i); |
| 262 | 266 | if (i == msg->sg.end) |
| 263 | 267 | break; |
| @@ -561,26 +561,6 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) · 560 unmodified lines | ||
| 561 | 561 | return __kmalloc(size, flags); |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | −/* | |
| 565 | − * Determine size used for the nth kmalloc cache. | |
| 566 | − * return size or 0 if a kmalloc cache for that | |
| 567 | − * size does not exist | |
| 568 | − */ | |
| 569 | −static __always_inline unsigned int kmalloc_size(unsigned int n) | |
| 570 | −{ | |
| 571 | −#ifndef CONFIG_SLOB | |
| 572 | − if (n > 2) | |
| 573 | − return 1U << n; | |
| 574 | − | |
| 575 | − if (n == 1 && KMALLOC_MIN_SIZE <= 32) | |
| 576 | − return 96; | |
| 577 | − | |
| 578 | − if (n == 2 && KMALLOC_MIN_SIZE <= 64) | |
| 579 | − return 192; | |
| 580 | −#endif | |
| 581 | − return 0; | |
| 582 | −} | |
| 583 | − | |
| 584 | 564 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
| 585 | 565 | { |
| 586 | 566 | #ifndef CONFIG_SLOB |
| @@ -0,0 +1,87 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __ASM_MACH_CPUTYPE_H | |
| 3 | +#define __ASM_MACH_CPUTYPE_H | |
| 4 | + | |
| 5 | +#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) | |
| 6 | +#include <asm/cputype.h> | |
| 7 | +#endif | |
| 8 | + | |
| 9 | +/* | |
| 10 | + * CPU Stepping CPU_ID CHIP_ID | |
| 11 | + * | |
| 12 | + * PXA168 S0 0x56158400 0x0000C910 | |
| 13 | + * PXA168 A0 0x56158400 0x00A0A168 | |
| 14 | + * PXA910 Y1 0x56158400 0x00F2C920 | |
| 15 | + * PXA910 A0 0x56158400 0x00F2C910 | |
| 16 | + * PXA910 A1 0x56158400 0x00A0C910 | |
| 17 | + * PXA920 Y0 0x56158400 0x00F2C920 | |
| 18 | + * PXA920 A0 0x56158400 0x00A0C920 | |
| 19 | + * PXA920 A1 0x56158400 0x00A1C920 | |
| 20 | + * MMP2 Z0 0x560f5811 0x00F00410 | |
| 21 | + * MMP2 Z1 0x560f5811 0x00E00410 | |
| 22 | + * MMP2 A0 0x560f5811 0x00A0A610 | |
| 23 | + * MMP3 A0 0x562f5842 0x00A02128 | |
| 24 | + * MMP3 B0 0x562f5842 0x00B02128 | |
| 25 | + */ | |
| 26 | + | |
| 27 | +extern unsigned int mmp_chip_id; | |
| 28 | + | |
| 29 | +#ifdef CONFIG_CPU_PXA168 | |
| 30 | +static inline int cpu_is_pxa168(void) | |
| 31 | +{ | |
| 32 | + return (((read_cpuid_id() >> 8) & 0xff) == 0x84) && | |
| 33 | + ((mmp_chip_id & 0xfff) == 0x168); | |
| 34 | +} | |
| 35 | +#else | |
| 36 | +#define cpu_is_pxa168() (0) | |
| 37 | +#endif | |
| 38 | + | |
| 39 | +/* cpu_is_pxa910() is shared on both pxa910 and pxa920 */ | |
| 40 | +#ifdef CONFIG_CPU_PXA910 | |
| 41 | +static inline int cpu_is_pxa910(void) | |
| 42 | +{ | |
| 43 | + return (((read_cpuid_id() >> 8) & 0xff) == 0x84) && | |
| 44 | + (((mmp_chip_id & 0xfff) == 0x910) || | |
| 45 | + ((mmp_chip_id & 0xfff) == 0x920)); | |
| 46 | +} | |
| 47 | +#else | |
| 48 | +#define cpu_is_pxa910() (0) | |
| 49 | +#endif | |
| 50 | + | |
| 51 | +#if defined(CONFIG_CPU_MMP2) || defined(CONFIG_MACH_MMP2_DT) | |
| 52 | +static inline int cpu_is_mmp2(void) | |
| 53 | +{ | |
| 54 | + return (((read_cpuid_id() >> 8) & 0xff) == 0x58) && | |
| 55 | + (((mmp_chip_id & 0xfff) == 0x410) || | |
| 56 | + ((mmp_chip_id & 0xfff) == 0x610)); | |
| 57 | +} | |
| 58 | +#else | |
| 59 | +#define cpu_is_mmp2() (0) | |
| 60 | +#endif | |
| 61 | + | |
| 62 | +#ifdef CONFIG_MACH_MMP3_DT | |
| 63 | +static inline int cpu_is_mmp3(void) | |
| 64 | +{ | |
| 65 | + return (((read_cpuid_id() >> 8) & 0xff) == 0x58) && | |
| 66 | + ((mmp_chip_id & 0xffff) == 0x2128); | |
| 67 | +} | |
| 68 | + | |
| 69 | +static inline int cpu_is_mmp3_a0(void) | |
| 70 | +{ | |
| 71 | + return (cpu_is_mmp3() && | |
| 72 | + ((mmp_chip_id & 0x00ff0000) == 0x00a00000)); | |
| 73 | +} | |
| 74 | + | |
| 75 | +static inline int cpu_is_mmp3_b0(void) | |
| 76 | +{ | |
| 77 | + return (cpu_is_mmp3() && | |
| 78 | + ((mmp_chip_id & 0x00ff0000) == 0x00b00000)); | |
| 79 | +} | |
| 80 | + | |
| 81 | +#else | |
| 82 | +#define cpu_is_mmp3() (0) | |
| 83 | +#define cpu_is_mmp3_a0() (0) | |
| 84 | +#define cpu_is_mmp3_b0() (0) | |
| 85 | +#endif | |
| 86 | + | |
| 87 | +#endif /* __ASM_MACH_CPUTYPE_H */ | |
| @@ -0,0 +1,34 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | + | |
| 3 | +#ifndef __QCOM_IRQ_H | |
| 4 | +#define __QCOM_IRQ_H | |
| 5 | + | |
| 6 | +#include <linux/irqdomain.h> | |
| 7 | + | |
| 8 | +#define GPIO_NO_WAKE_IRQ ~0U | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * QCOM specific IRQ domain flags that distinguishes the handling of wakeup | |
| 12 | + * capable interrupts by different interrupt controllers. | |
| 13 | + * | |
| 14 | + * IRQ_DOMAIN_FLAG_QCOM_PDC_WAKEUP: Line must be masked at TLMM and the | |
| 15 | + * interrupt configuration is done at PDC | |
| 16 | + * IRQ_DOMAIN_FLAG_QCOM_MPM_WAKEUP: Interrupt configuration is handled at TLMM | |
| 17 | + */ | |
| 18 | +#define IRQ_DOMAIN_FLAG_QCOM_PDC_WAKEUP (IRQ_DOMAIN_FLAG_NONCORE << 0) | |
| 19 | +#define IRQ_DOMAIN_FLAG_QCOM_MPM_WAKEUP (IRQ_DOMAIN_FLAG_NONCORE << 1) | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * irq_domain_qcom_handle_wakeup: Return if the domain handles interrupt | |
| 23 | + * configuration | |
| 24 | + * @d: irq domain | |
| 25 | + * | |
| 26 | + * This QCOM specific irq domain call returns if the interrupt controller | |
| 27 | + * requires the interrupt be masked at the child interrupt controller. | |
| 28 | + */ | |
| 29 | +static inline bool irq_domain_qcom_handle_wakeup(const struct irq_domain *d) | |
| 30 | +{ | |
| 31 | + return (d->flags & IRQ_DOMAIN_FLAG_QCOM_PDC_WAKEUP); | |
| 32 | +} | |
| 33 | + | |
| 34 | +#endif | |
| @@ -38,33 +38,27 @@ struct llcc_slice_desc { · 37 unmodified lines | ||
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | 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 | |
| 41 | + * llcc_edac_reg_data - llcc edac registers data for each error type | |
| 42 | + * @name: Name of the error | |
| 43 | + * @synd_reg: Syndrome register address | |
| 44 | + * @count_status_reg: Status register address to read the error count | |
| 45 | + * @ways_status_reg: Status register address to read the error ways | |
| 46 | + * @reg_cnt: Number of registers | |
| 47 | + * @count_mask: Mask value to get the error count | |
| 48 | + * @ways_mask: Mask value to get the error ways | |
| 49 | + * @count_shift: Shift value to get the error count | |
| 50 | + * @ways_shift: Shift value to get the error ways | |
| 54 | 51 | */ |
| 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; | |
| 52 | +struct llcc_edac_reg_data { | |
| 53 | + char *name; | |
| 54 | + u64 synd_reg; | |
| 55 | + u64 count_status_reg; | |
| 56 | + u64 ways_status_reg; | |
| 57 | + u32 reg_cnt; | |
| 58 | + u32 count_mask; | |
| 59 | + u32 ways_mask; | |
| 60 | + u8 count_shift; | |
| 61 | + u8 ways_shift; | |
| 68 | 62 | }; |
| 69 | 63 | |
| 70 | 64 | /** |
| @@ -93,30 +87,6 @@ struct llcc_drv_data { · 22 unmodified lines | ||
| 93 | 87 | int ecc_irq; |
| 94 | 88 | }; |
| 95 | 89 | |
| 96 | −/** | |
| 97 | − * llcc_edac_reg_data - llcc edac registers data for each error type | |
| 98 | − * @name: Name of the error | |
| 99 | − * @synd_reg: Syndrome register address | |
| 100 | − * @count_status_reg: Status register address to read the error count | |
| 101 | − * @ways_status_reg: Status register address to read the error ways | |
| 102 | − * @reg_cnt: Number of registers | |
| 103 | − * @count_mask: Mask value to get the error count | |
| 104 | − * @ways_mask: Mask value to get the error ways | |
| 105 | − * @count_shift: Shift value to get the error count | |
| 106 | − * @ways_shift: Shift value to get the error ways | |
| 107 | − */ | |
| 108 | −struct llcc_edac_reg_data { | |
| 109 | − char *name; | |
| 110 | − u64 synd_reg; | |
| 111 | − u64 count_status_reg; | |
| 112 | − u64 ways_status_reg; | |
| 113 | − u32 reg_cnt; | |
| 114 | − u32 count_mask; | |
| 115 | − u32 ways_mask; | |
| 116 | − u8 count_shift; | |
| 117 | − u8 ways_shift; | |
| 118 | −}; | |
| 119 | − | |
| 120 | 90 | #if IS_ENABLED(CONFIG_QCOM_LLCC) |
| 121 | 91 | /** |
| 122 | 92 | * llcc_slice_getd - get llcc slice descriptor |
| @@ -154,20 +124,6 @@ int llcc_slice_activate(struct llcc_slice_desc *desc); · 31 unmodified lines | ||
| 154 | 124 | */ |
| 155 | 125 | int llcc_slice_deactivate(struct llcc_slice_desc *desc); |
| 156 | 126 | |
| 157 | −/** | |
| 158 | − * qcom_llcc_probe - program the sct table | |
| 159 | − * @pdev: platform device pointer | |
| 160 | − * @table: soc sct table | |
| 161 | − * @sz: Size of the config table | |
| 162 | − */ | |
| 163 | −int qcom_llcc_probe(struct platform_device *pdev, | |
| 164 | − const struct llcc_slice_config *table, u32 sz); | |
| 165 | − | |
| 166 | −/** | |
| 167 | − * qcom_llcc_remove - remove the sct table | |
| 168 | − * @pdev: Platform device pointer | |
| 169 | − */ | |
| 170 | −int qcom_llcc_remove(struct platform_device *pdev); | |
| 171 | 127 | #else |
| 172 | 128 | static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid) |
| 173 | 129 | { |
| @@ -197,16 +153,6 @@ static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc) · 23 unmodified lines | ||
| 197 | 153 | { |
| 198 | 154 | return -EINVAL; |
| 199 | 155 | } |
| 200 | −static inline int qcom_llcc_probe(struct platform_device *pdev, | |
| 201 | − const struct llcc_slice_config *table, u32 sz) | |
| 202 | −{ | |
| 203 | − return -ENODEV; | |
| 204 | −} | |
| 205 | − | |
| 206 | −static inline int qcom_llcc_remove(struct platform_device *pdev) | |
| 207 | −{ | |
| 208 | − return -ENODEV; | |
| 209 | −} | |
| 210 | 156 | #endif |
| 211 | 157 | |
| 212 | 158 | #endif |
| @@ -378,12 +378,19 @@ extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, · 377 unmodified lines | ||
| 378 | 378 | extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, |
| 379 | 379 | unsigned int vlen, unsigned int flags, |
| 380 | 380 | bool forbid_cmsg_compat); |
| 381 | −extern long __sys_sendmsg_sock(struct socket *sock, | |
| 382 | − struct user_msghdr __user *msg, | |
| 381 | +extern long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg, | |
| 383 | 382 | unsigned int flags); |
| 384 | −extern long __sys_recvmsg_sock(struct socket *sock, | |
| 385 | − struct user_msghdr __user *msg, | |
| 383 | +extern long __sys_recvmsg_sock(struct socket *sock, struct msghdr *msg, | |
| 384 | + struct user_msghdr __user *umsg, | |
| 385 | + struct sockaddr __user *uaddr, | |
| 386 | 386 | unsigned int flags); |
| 387 | +extern int sendmsg_copy_msghdr(struct msghdr *msg, | |
| 388 | + struct user_msghdr __user *umsg, unsigned flags, | |
| 389 | + struct iovec **iov); | |
| 390 | +extern int recvmsg_copy_msghdr(struct msghdr *msg, | |
| 391 | + struct user_msghdr __user *umsg, unsigned flags, | |
| 392 | + struct sockaddr __user **uaddr, | |
| 393 | + struct iovec **iov); | |
| 387 | 394 | |
| 388 | 395 | /* helpers which do the actual work for syscalls */ |
| 389 | 396 | extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size, |
| @@ -392,10 +399,15 @@ extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size, · 2 unmodified lines | ||
| 392 | 399 | extern int __sys_sendto(int fd, void __user *buff, size_t len, |
| 393 | 400 | unsigned int flags, struct sockaddr __user *addr, |
| 394 | 401 | int addr_len); |
| 402 | +extern int __sys_accept4_file(struct file *file, unsigned file_flags, | |
| 403 | + struct sockaddr __user *upeer_sockaddr, | |
| 404 | + int __user *upeer_addrlen, int flags); | |
| 395 | 405 | extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, |
| 396 | 406 | int __user *upeer_addrlen, int flags); |
| 397 | 407 | extern int __sys_socket(int family, int type, int protocol); |
| 398 | 408 | extern int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen); |
| 409 | +extern int __sys_connect_file(struct file *file, struct sockaddr_storage *addr, | |
| 410 | + int addrlen, int file_flags); | |
| 399 | 411 | extern int __sys_connect(int fd, struct sockaddr __user *uservaddr, |
| 400 | 412 | int addrlen); |
| 401 | 413 | extern int __sys_listen(int fd, int backlog); |
| @@ -5,12 +5,12 @@ · 4 unmodified lines | ||
| 5 | 5 | #include <linux/types.h> |
| 6 | 6 | |
| 7 | 7 | void sort_r(void *base, size_t num, size_t size, |
| 8 | − int (*cmp)(const void *, const void *, const void *), | |
| 9 | − void (*swap)(void *, void *, int), | |
| 8 | + cmp_r_func_t cmp_func, | |
| 9 | + swap_func_t swap_func, | |
| 10 | 10 | const void *priv); |
| 11 | 11 | |
| 12 | 12 | void sort(void *base, size_t num, size_t size, |
| 13 | − int (*cmp)(const void *, const void *), | |
| 14 | − void (*swap)(void *, void *, int)); | |
| 13 | + cmp_func_t cmp_func, | |
| 14 | + swap_func_t swap_func); | |
| 15 | 15 | |
| 16 | 16 | #endif |
| @@ -40,9 +40,6 @@ struct sdw_slave; · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | #define SDW_VALID_PORT_RANGE(n) ((n) <= 14 && (n) >= 1) |
| 42 | 42 | |
| 43 | −#define SDW_DAI_ID_RANGE_START 100 | |
| 44 | −#define SDW_DAI_ID_RANGE_END 200 | |
| 45 | − | |
| 46 | 43 | enum { |
| 47 | 44 | SDW_PORT_DIRN_SINK = 0, |
| 48 | 45 | SDW_PORT_DIRN_SOURCE, |
| @@ -406,6 +403,8 @@ int sdw_slave_read_prop(struct sdw_slave *slave); · 357 unmodified lines | ||
| 406 | 403 | * SDW Slave Structures and APIs |
| 407 | 404 | */ |
| 408 | 405 | |
| 406 | +#define SDW_IGNORED_UNIQUE_ID 0xFF | |
| 407 | + | |
| 409 | 408 | /** |
| 410 | 409 | * struct sdw_slave_id - Slave ID |
| 411 | 410 | * @mfg_id: MIPI Manufacturer ID |
| @@ -421,7 +420,7 @@ struct sdw_slave_id { · 9 unmodified lines | ||
| 421 | 420 | __u16 mfg_id; |
| 422 | 421 | __u16 part_id; |
| 423 | 422 | __u8 class_id; |
| 424 | − __u8 unique_id:4; | |
| 423 | + __u8 unique_id; | |
| 425 | 424 | __u8 sdw_version:4; |
| 426 | 425 | }; |
| 427 | 426 | |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/completion.h> |
| 14 | 14 | #include <linux/scatterlist.h> |
| 15 | 15 | #include <linux/gpio/consumer.h> |
| 16 | +#include <linux/ptp_clock_kernel.h> | |
| 16 | 17 | |
| 17 | 18 | struct dma_chan; |
| 18 | 19 | struct property_entry; |
| @@ -89,6 +90,22 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, · 70 unmodified lines | ||
| 89 | 90 | #define SPI_STATISTICS_INCREMENT_FIELD(stats, field) \ |
| 90 | 91 | SPI_STATISTICS_ADD_TO_FIELD(stats, field, 1) |
| 91 | 92 | |
| 93 | +/** | |
| 94 | + * struct spi_delay - SPI delay information | |
| 95 | + * @value: Value for the delay | |
| 96 | + * @unit: Unit for the delay | |
| 97 | + */ | |
| 98 | +struct spi_delay { | |
| 99 | +#define SPI_DELAY_UNIT_USECS 0 | |
| 100 | +#define SPI_DELAY_UNIT_NSECS 1 | |
| 101 | +#define SPI_DELAY_UNIT_SCK 2 | |
| 102 | + u16 value; | |
| 103 | + u8 unit; | |
| 104 | +}; | |
| 105 | + | |
| 106 | +extern int spi_delay_to_ns(struct spi_delay *_delay, struct spi_transfer *xfer); | |
| 107 | +extern int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer); | |
| 108 | + | |
| 92 | 109 | /** |
| 93 | 110 | * struct spi_device - Controller side proxy for an SPI slave device |
| 94 | 111 | * @dev: Driver model representation of the device. |
| @@ -123,7 +140,7 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, · 28 unmodified lines | ||
| 123 | 140 | * the spi_master. |
| 124 | 141 | * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when |
| 125 | 142 | * not using a GPIO line) |
| 126 | − * @word_delay_usecs: microsecond delay to be inserted between consecutive | |
| 143 | + * @word_delay: delay to be inserted between consecutive | |
| 127 | 144 | * words of a transfer |
| 128 | 145 | * |
| 129 | 146 | * @statistics: statistics for the spi_device |
| @@ -173,7 +190,7 @@ struct spi_device { · 43 unmodified lines | ||
| 173 | 190 | const char *driver_override; |
| 174 | 191 | int cs_gpio; /* LEGACY: chip select gpio */ |
| 175 | 192 | struct gpio_desc *cs_gpiod; /* chip select gpio desc */ |
| 176 | − uint8_t word_delay_usecs; /* inter-word delay */ | |
| 193 | + struct spi_delay word_delay; /* inter-word delay */ | |
| 177 | 194 | |
| 178 | 195 | /* the statistics */ |
| 179 | 196 | struct spi_statistics statistics; |
| @@ -390,6 +407,11 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 210 unmodified lines | ||
| 390 | 407 | * controller has native support for memory like operations. |
| 391 | 408 | * @unprepare_message: undo any work done by prepare_message(). |
| 392 | 409 | * @slave_abort: abort the ongoing transfer request on an SPI slave controller |
| 410 | + * @cs_setup: delay to be introduced by the controller after CS is asserted | |
| 411 | + * @cs_hold: delay to be introduced by the controller before CS is deasserted | |
| 412 | + * @cs_inactive: delay to be introduced by the controller after CS is | |
| 413 | + * deasserted. If @cs_change_delay is used from @spi_transfer, then the | |
| 414 | + * two delays will be added up. | |
| 393 | 415 | * @cs_gpios: LEGACY: array of GPIO descs to use as chip select lines; one per |
| 394 | 416 | * CS number. Any individual value may be -ENOENT for CS lines that |
| 395 | 417 | * are not GPIOs (driven by the SPI controller itself). Use the cs_gpiods |
| @@ -409,6 +431,12 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 13 unmodified lines | ||
| 409 | 431 | * @fw_translate_cs: If the boot firmware uses different numbering scheme |
| 410 | 432 | * what Linux expects, this optional hook can be used to translate |
| 411 | 433 | * between the two. |
| 434 | + * @ptp_sts_supported: If the driver sets this to true, it must provide a | |
| 435 | + * time snapshot in @spi_transfer->ptp_sts as close as possible to the | |
| 436 | + * moment in time when @spi_transfer->ptp_sts_word_pre and | |
| 437 | + * @spi_transfer->ptp_sts_word_post were transmitted. | |
| 438 | + * If the driver does not set this, the SPI core takes the snapshot as | |
| 439 | + * close to the driver hand-over as possible. | |
| 412 | 440 | * |
| 413 | 441 | * Each SPI controller can communicate with one or more @spi_device |
| 414 | 442 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
| @@ -502,8 +530,8 @@ struct spi_controller { · 87 unmodified lines | ||
| 502 | 530 | * to configure specific CS timing through spi_set_cs_timing() after |
| 503 | 531 | * spi_setup(). |
| 504 | 532 | */ |
| 505 | − void (*set_cs_timing)(struct spi_device *spi, u8 setup_clk_cycles, | |
| 506 | − u8 hold_clk_cycles, u8 inactive_clk_cycles); | |
| 533 | + int (*set_cs_timing)(struct spi_device *spi, struct spi_delay *setup, | |
| 534 | + struct spi_delay *hold, struct spi_delay *inactive); | |
| 507 | 535 | |
| 508 | 536 | /* bidirectional bulk transfers |
| 509 | 537 | * |
| @@ -587,6 +615,11 @@ struct spi_controller { · 77 unmodified lines | ||
| 587 | 615 | /* Optimized handlers for SPI memory-like operations. */ |
| 588 | 616 | const struct spi_controller_mem_ops *mem_ops; |
| 589 | 617 | |
| 618 | + /* CS delays */ | |
| 619 | + struct spi_delay cs_setup; | |
| 620 | + struct spi_delay cs_hold; | |
| 621 | + struct spi_delay cs_inactive; | |
| 622 | + | |
| 590 | 623 | /* gpio chip select */ |
| 591 | 624 | int *cs_gpios; |
| 592 | 625 | struct gpio_desc **cs_gpiods; |
| @@ -604,6 +637,15 @@ struct spi_controller { · 11 unmodified lines | ||
| 604 | 637 | void *dummy_tx; |
| 605 | 638 | |
| 606 | 639 | int (*fw_translate_cs)(struct spi_controller *ctlr, unsigned cs); |
| 640 | + | |
| 641 | + /* | |
| 642 | + * Driver sets this field to indicate it is able to snapshot SPI | |
| 643 | + * transfers (needed e.g. for reading the time of POSIX clocks) | |
| 644 | + */ | |
| 645 | + bool ptp_sts_supported; | |
| 646 | + | |
| 647 | + /* Interrupt enable state during PTP system timestamping */ | |
| 648 | + unsigned long irq_flags; | |
| 607 | 649 | }; |
| 608 | 650 | |
| 609 | 651 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr) |
| @@ -644,6 +686,14 @@ extern struct spi_message *spi_get_next_queued_message(struct spi_controller *ct · 34 unmodified lines | ||
| 644 | 686 | extern void spi_finalize_current_message(struct spi_controller *ctlr); |
| 645 | 687 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr); |
| 646 | 688 | |
| 689 | +/* Helper calls for driver to timestamp transfer */ | |
| 690 | +void spi_take_timestamp_pre(struct spi_controller *ctlr, | |
| 691 | + struct spi_transfer *xfer, | |
| 692 | + const void *tx, bool irqs_off); | |
| 693 | +void spi_take_timestamp_post(struct spi_controller *ctlr, | |
| 694 | + struct spi_transfer *xfer, | |
| 695 | + const void *tx, bool irqs_off); | |
| 696 | + | |
| 647 | 697 | /* the spi driver core manages memory for the spi_controller classdev */ |
| 648 | 698 | extern struct spi_controller *__spi_alloc_controller(struct device *host, |
| 649 | 699 | unsigned int size, bool slave); |
| @@ -739,13 +789,13 @@ extern void spi_res_release(struct spi_controller *ctlr, · 89 unmodified lines | ||
| 739 | 789 | * @cs_change: affects chipselect after this transfer completes |
| 740 | 790 | * @cs_change_delay: delay between cs deassert and assert when |
| 741 | 791 | * @cs_change is set and @spi_transfer is not the last in @spi_message |
| 742 | − * @cs_change_delay_unit: unit of cs_change_delay | |
| 792 | + * @delay: delay to be introduced after this transfer before | |
| 793 | + * (optionally) changing the chipselect status, then starting | |
| 794 | + * the next transfer or completing this @spi_message. | |
| 743 | 795 | * @delay_usecs: microseconds to delay after this transfer before |
| 744 | 796 | * (optionally) changing the chipselect status, then starting |
| 745 | 797 | * the next transfer or completing this @spi_message. |
| 746 | − * @word_delay_usecs: microseconds to inter word delay after each word size | |
| 747 | − * (set by bits_per_word) transmission. | |
| 748 | − * @word_delay: clock cycles to inter word delay after each word size | |
| 798 | + * @word_delay: inter word delay to be introduced after each word size | |
| 749 | 799 | * (set by bits_per_word) transmission. |
| 750 | 800 | * @effective_speed_hz: the effective SCK-speed that was used to |
| 751 | 801 | * transfer this transfer. Set to 0 if the spi bus driver does |
| @@ -753,6 +803,35 @@ extern void spi_res_release(struct spi_controller *ctlr, · 1 unmodified line | ||
| 753 | 803 | * @transfer_list: transfers are sequenced through @spi_message.transfers |
| 754 | 804 | * @tx_sg: Scatterlist for transmit, currently not for client use |
| 755 | 805 | * @rx_sg: Scatterlist for receive, currently not for client use |
| 806 | + * @ptp_sts_word_pre: The word (subject to bits_per_word semantics) offset | |
| 807 | + * within @tx_buf for which the SPI device is requesting that the time | |
| 808 | + * snapshot for this transfer begins. Upon completing the SPI transfer, | |
| 809 | + * this value may have changed compared to what was requested, depending | |
| 810 | + * on the available snapshotting resolution (DMA transfer, | |
| 811 | + * @ptp_sts_supported is false, etc). | |
| 812 | + * @ptp_sts_word_post: See @ptp_sts_word_post. The two can be equal (meaning | |
| 813 | + * that a single byte should be snapshotted). | |
| 814 | + * If the core takes care of the timestamp (if @ptp_sts_supported is false | |
| 815 | + * for this controller), it will set @ptp_sts_word_pre to 0, and | |
| 816 | + * @ptp_sts_word_post to the length of the transfer. This is done | |
| 817 | + * purposefully (instead of setting to spi_transfer->len - 1) to denote | |
| 818 | + * that a transfer-level snapshot taken from within the driver may still | |
| 819 | + * be of higher quality. | |
| 820 | + * @ptp_sts: Pointer to a memory location held by the SPI slave device where a | |
| 821 | + * PTP system timestamp structure may lie. If drivers use PIO or their | |
| 822 | + * hardware has some sort of assist for retrieving exact transfer timing, | |
| 823 | + * they can (and should) assert @ptp_sts_supported and populate this | |
| 824 | + * structure using the ptp_read_system_*ts helper functions. | |
| 825 | + * The timestamp must represent the time at which the SPI slave device has | |
| 826 | + * processed the word, i.e. the "pre" timestamp should be taken before | |
| 827 | + * transmitting the "pre" word, and the "post" timestamp after receiving | |
| 828 | + * transmit confirmation from the controller for the "post" word. | |
| 829 | + * @timestamped_pre: Set by the SPI controller driver to denote it has acted | |
| 830 | + * upon the @ptp_sts request. Not set when the SPI core has taken care of | |
| 831 | + * the task. SPI device drivers are free to print a warning if this comes | |
| 832 | + * back unset and they need the better resolution. | |
| 833 | + * @timestamped_post: See above. The reason why both exist is that these | |
| 834 | + * booleans are also used to keep state in the core SPI logic. | |
| 756 | 835 | * |
| 757 | 836 | * SPI transfers always write the same number of bytes as they read. |
| 758 | 837 | * Protocol drivers should always provide @rx_buf and/or @tx_buf. |
| @@ -830,18 +909,22 @@ struct spi_transfer { · 71 unmodified lines | ||
| 830 | 909 | #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ |
| 831 | 910 | #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ |
| 832 | 911 | u8 bits_per_word; |
| 833 | − u8 word_delay_usecs; | |
| 834 | 912 | u16 delay_usecs; |
| 835 | − u16 cs_change_delay; | |
| 836 | − u8 cs_change_delay_unit; | |
| 837 | −#define SPI_DELAY_UNIT_USECS 0 | |
| 838 | −#define SPI_DELAY_UNIT_NSECS 1 | |
| 839 | −#define SPI_DELAY_UNIT_SCK 2 | |
| 913 | + struct spi_delay delay; | |
| 914 | + struct spi_delay cs_change_delay; | |
| 915 | + struct spi_delay word_delay; | |
| 840 | 916 | u32 speed_hz; |
| 841 | − u16 word_delay; | |
| 842 | 917 | |
| 843 | 918 | u32 effective_speed_hz; |
| 844 | 919 | |
| 920 | + unsigned int ptp_sts_word_pre; | |
| 921 | + unsigned int ptp_sts_word_post; | |
| 922 | + | |
| 923 | + struct ptp_system_timestamp *ptp_sts; | |
| 924 | + | |
| 925 | + bool timestamped_pre; | |
| 926 | + bool timestamped_post; | |
| 927 | + | |
| 845 | 928 | struct list_head transfer_list; |
| 846 | 929 | }; |
| 847 | 930 | |
| @@ -935,6 +1018,20 @@ spi_transfer_del(struct spi_transfer *t) · 87 unmodified lines | ||
| 935 | 1018 | list_del(&t->transfer_list); |
| 936 | 1019 | } |
| 937 | 1020 | |
| 1021 | +static inline int | |
| 1022 | +spi_transfer_delay_exec(struct spi_transfer *t) | |
| 1023 | +{ | |
| 1024 | + struct spi_delay d; | |
| 1025 | + | |
| 1026 | + if (t->delay_usecs) { | |
| 1027 | + d.value = t->delay_usecs; | |
| 1028 | + d.unit = SPI_DELAY_UNIT_USECS; | |
| 1029 | + return spi_delay_exec(&d, NULL); | |
| 1030 | + } | |
| 1031 | + | |
| 1032 | + return spi_delay_exec(&t->delay, t); | |
| 1033 | +} | |
| 1034 | + | |
| 938 | 1035 | /** |
| 939 | 1036 | * spi_message_init_with_transfers - Initialize spi_message and append transfers |
| 940 | 1037 | * @m: spi_message to be initialized |
| @@ -982,7 +1079,10 @@ static inline void spi_message_free(struct spi_message *m) · 41 unmodified lines | ||
| 982 | 1079 | kfree(m); |
| 983 | 1080 | } |
| 984 | 1081 | |
| 985 | −extern void spi_set_cs_timing(struct spi_device *spi, u8 setup, u8 hold, u8 inactive_dly); | |
| 1082 | +extern int spi_set_cs_timing(struct spi_device *spi, | |
| 1083 | + struct spi_delay *setup, | |
| 1084 | + struct spi_delay *hold, | |
| 1085 | + struct spi_delay *inactive); | |
| 986 | 1086 | |
| 987 | 1087 | extern int spi_setup(struct spi_device *spi); |
| 988 | 1088 | extern int spi_async(struct spi_device *spi, struct spi_message *message); |
| @@ -147,7 +147,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock) · 146 unmodified lines | ||
| 147 | 147 | |
| 148 | 148 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
| 149 | 149 | { |
| 150 | − spin_release(&lock->dep_map, 1, _RET_IP_); | |
| 150 | + spin_release(&lock->dep_map, _RET_IP_); | |
| 151 | 151 | do_raw_spin_unlock(lock); |
| 152 | 152 | preempt_enable(); |
| 153 | 153 | } |
| @@ -155,7 +155,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) · 1 unmodified line | ||
| 155 | 155 | static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, |
| 156 | 156 | unsigned long flags) |
| 157 | 157 | { |
| 158 | − spin_release(&lock->dep_map, 1, _RET_IP_); | |
| 158 | + spin_release(&lock->dep_map, _RET_IP_); | |
| 159 | 159 | do_raw_spin_unlock(lock); |
| 160 | 160 | local_irq_restore(flags); |
| 161 | 161 | preempt_enable(); |
| @@ -163,7 +163,7 @@ static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, · 1 unmodified line | ||
| 163 | 163 | |
| 164 | 164 | static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock) |
| 165 | 165 | { |
| 166 | − spin_release(&lock->dep_map, 1, _RET_IP_); | |
| 166 | + spin_release(&lock->dep_map, _RET_IP_); | |
| 167 | 167 | do_raw_spin_unlock(lock); |
| 168 | 168 | local_irq_enable(); |
| 169 | 169 | preempt_enable(); |
| @@ -171,7 +171,7 @@ static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock) · 1 unmodified line | ||
| 171 | 171 | |
| 172 | 172 | static inline void __raw_spin_unlock_bh(raw_spinlock_t *lock) |
| 173 | 173 | { |
| 174 | − spin_release(&lock->dep_map, 1, _RET_IP_); | |
| 174 | + spin_release(&lock->dep_map, _RET_IP_); | |
| 175 | 175 | do_raw_spin_unlock(lock); |
| 176 | 176 | __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); |
| 177 | 177 | } |
| @@ -33,7 +33,8 @@ struct kstat { · 32 unmodified lines | ||
| 33 | 33 | STATX_ATTR_IMMUTABLE | \ |
| 34 | 34 | STATX_ATTR_APPEND | \ |
| 35 | 35 | STATX_ATTR_NODUMP | \ |
| 36 | − STATX_ATTR_ENCRYPTED \ | |
| 36 | + STATX_ATTR_ENCRYPTED | \ | |
| 37 | + STATX_ATTR_VERITY \ | |
| 37 | 38 | )/* Attrs corresponding to FS_*_FL flags */ |
| 38 | 39 | u64 ino; |
| 39 | 40 | dev_t dev; |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #define __STMMAC_PLATFORM_DATA |
| 14 | 14 | |
| 15 | 15 | #include <linux/platform_device.h> |
| 16 | +#include <linux/phy.h> | |
| 16 | 17 | |
| 17 | 18 | #define MTL_MAX_RX_QUEUES 8 |
| 18 | 19 | #define MTL_MAX_TX_QUEUES 8 |
| @@ -92,6 +93,7 @@ struct stmmac_dma_cfg { · 73 unmodified lines | ||
| 92 | 93 | int fixed_burst; |
| 93 | 94 | int mixed_burst; |
| 94 | 95 | bool aal; |
| 96 | + bool eame; | |
| 95 | 97 | }; |
| 96 | 98 | |
| 97 | 99 | #define AXI_BLEN 7 |
| @@ -131,7 +133,7 @@ struct plat_stmmacenet_data { · 33 unmodified lines | ||
| 131 | 133 | int bus_id; |
| 132 | 134 | int phy_addr; |
| 133 | 135 | int interface; |
| 134 | − int phy_interface; | |
| 136 | + phy_interface_t phy_interface; | |
| 135 | 137 | struct stmmac_mdio_bus_data *mdio_bus_data; |
| 136 | 138 | struct device_node *phy_node; |
| 137 | 139 | struct device_node *phylink_node; |
| @@ -216,6 +216,8 @@ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); · 215 unmodified lines | ||
| 216 | 216 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
| 217 | 217 | const void *from, size_t available); |
| 218 | 218 | |
| 219 | +int ptr_to_hashval(const void *ptr, unsigned long *hashval_out); | |
| 220 | + | |
| 219 | 221 | /** |
| 220 | 222 | * strstarts - does @str start with @prefix? |
| 221 | 223 | * @str: string to examine |
| @@ -10,8 +10,6 @@ · 9 unmodified lines | ||
| 10 | 10 | #ifndef _LINUX_SUNRPC_AUTH_H |
| 11 | 11 | #define _LINUX_SUNRPC_AUTH_H |
| 12 | 12 | |
| 13 | −#ifdef __KERNEL__ | |
| 14 | − | |
| 15 | 13 | #include <linux/sunrpc/sched.h> |
| 16 | 14 | #include <linux/sunrpc/msg_prot.h> |
| 17 | 15 | #include <linux/sunrpc/xdr.h> |
| @@ -194,5 +192,4 @@ struct rpc_cred *get_rpccred(struct rpc_cred *cred) · 176 unmodified lines | ||
| 194 | 192 | return NULL; |
| 195 | 193 | } |
| 196 | 194 | |
| 197 | −#endif /* __KERNEL__ */ | |
| 198 | 195 | #endif /* _LINUX_SUNRPC_AUTH_H */ |
| @@ -13,7 +13,6 @@ · 12 unmodified lines | ||
| 13 | 13 | #ifndef _LINUX_SUNRPC_AUTH_GSS_H |
| 14 | 14 | #define _LINUX_SUNRPC_AUTH_GSS_H |
| 15 | 15 | |
| 16 | −#ifdef __KERNEL__ | |
| 17 | 16 | #include <linux/refcount.h> |
| 18 | 17 | #include <linux/sunrpc/auth.h> |
| 19 | 18 | #include <linux/sunrpc/svc.h> |
| @@ -90,6 +89,5 @@ struct gss_cred { · 70 unmodified lines | ||
| 90 | 89 | unsigned long gc_upcall_timestamp; |
| 91 | 90 | }; |
| 92 | 91 | |
| 93 | −#endif /* __KERNEL__ */ | |
| 94 | 92 | #endif /* _LINUX_SUNRPC_AUTH_GSS_H */ |
| 95 | 93 | |
| @@ -109,8 +109,6 @@ struct rpc_procinfo { · 108 unmodified lines | ||
| 109 | 109 | const char * p_name; /* name of procedure */ |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | −#ifdef __KERNEL__ | |
| 113 | − | |
| 114 | 112 | struct rpc_create_args { |
| 115 | 113 | struct net *net; |
| 116 | 114 | int protocol; |
| @@ -149,6 +147,7 @@ struct rpc_add_xprt_test { · 32 unmodified lines | ||
| 149 | 147 | #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) |
| 150 | 148 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) |
| 151 | 149 | #define RPC_CLNT_CREATE_SOFTERR (1UL << 10) |
| 150 | +#define RPC_CLNT_CREATE_REUSEPORT (1UL << 11) | |
| 152 | 151 | |
| 153 | 152 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
| 154 | 153 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
| @@ -237,5 +236,4 @@ static inline int rpc_reply_expected(struct rpc_task *task) · 82 unmodified lines | ||
| 237 | 236 | (task->tk_msg.rpc_proc->p_decode != NULL); |
| 238 | 237 | } |
| 239 | 238 | |
| 240 | −#endif /* __KERNEL__ */ | |
| 241 | 239 | #endif /* _LINUX_SUNRPC_CLNT_H */ |
| @@ -13,7 +13,6 @@ · 12 unmodified lines | ||
| 13 | 13 | #ifndef _LINUX_SUNRPC_GSS_API_H |
| 14 | 14 | #define _LINUX_SUNRPC_GSS_API_H |
| 15 | 15 | |
| 16 | −#ifdef __KERNEL__ | |
| 17 | 16 | #include <linux/sunrpc/xdr.h> |
| 18 | 17 | #include <linux/sunrpc/msg_prot.h> |
| 19 | 18 | #include <linux/uio.h> |
| @@ -160,6 +159,5 @@ struct gss_api_mech * gss_mech_get(struct gss_api_mech *); · 140 unmodified lines | ||
| 160 | 159 | * corresponding call to gss_mech_put. */ |
| 161 | 160 | void gss_mech_put(struct gss_api_mech *); |
| 162 | 161 | |
| 163 | −#endif /* __KERNEL__ */ | |
| 164 | 162 | #endif /* _LINUX_SUNRPC_GSS_API_H */ |
| 165 | 163 | |
| @@ -34,8 +34,6 @@ · 33 unmodified lines | ||
| 34 | 34 | #ifndef _LINUX_SUNRPC_GSS_ERR_H |
| 35 | 35 | #define _LINUX_SUNRPC_GSS_ERR_H |
| 36 | 36 | |
| 37 | −#ifdef __KERNEL__ | |
| 38 | − | |
| 39 | 37 | typedef unsigned int OM_uint32; |
| 40 | 38 | |
| 41 | 39 | /* |
| @@ -163,5 +161,4 @@ typedef unsigned int OM_uint32; · 121 unmodified lines | ||
| 163 | 161 | /* XXXX This is a necessary evil until the spec is fixed */ |
| 164 | 162 | #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE |
| 165 | 163 | |
| 166 | −#endif /* __KERNEL__ */ | |
| 167 | 164 | #endif /* __LINUX_SUNRPC_GSS_ERR_H */ |
| @@ -8,8 +8,6 @@ · 7 unmodified lines | ||
| 8 | 8 | #ifndef _LINUX_SUNRPC_MSGPROT_H_ |
| 9 | 9 | #define _LINUX_SUNRPC_MSGPROT_H_ |
| 10 | 10 | |
| 11 | −#ifdef __KERNEL__ /* user programs should get these from the rpc header files */ | |
| 12 | − | |
| 13 | 11 | #define RPC_VERSION 2 |
| 14 | 12 | |
| 15 | 13 | /* size of an XDR encoding unit in bytes, i.e. 32bit */ |
| @@ -217,5 +215,4 @@ typedef __be32 rpc_fraghdr; · 201 unmodified lines | ||
| 217 | 215 | /* Assume INET6_ADDRSTRLEN will always be larger than INET_ADDRSTRLEN... */ |
| 218 | 216 | #define RPCBIND_MAXUADDRLEN RPCBIND_MAXUADDR6LEN |
| 219 | 217 | |
| 220 | −#endif /* __KERNEL__ */ | |
| 221 | 218 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ |
| @@ -2,8 +2,6 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H |
| 3 | 3 | #define _LINUX_SUNRPC_RPC_PIPE_FS_H |
| 4 | 4 | |
| 5 | −#ifdef __KERNEL__ | |
| 6 | − | |
| 7 | 5 | #include <linux/workqueue.h> |
| 8 | 6 | |
| 9 | 7 | struct rpc_pipe_dir_head { |
| @@ -133,4 +131,3 @@ extern void unregister_rpc_pipefs(void); · 123 unmodified lines | ||
| 133 | 131 | extern bool gssd_running(struct net *net); |
| 134 | 132 | |
| 135 | 133 | #endif |
| 136 | −#endif | |
| @@ -10,8 +10,6 @@ · 9 unmodified lines | ||
| 10 | 10 | #ifndef _LINUX_SUNRPC_SVCAUTH_H_ |
| 11 | 11 | #define _LINUX_SUNRPC_SVCAUTH_H_ |
| 12 | 12 | |
| 13 | −#ifdef __KERNEL__ | |
| 14 | − | |
| 15 | 13 | #include <linux/string.h> |
| 16 | 14 | #include <linux/sunrpc/msg_prot.h> |
| 17 | 15 | #include <linux/sunrpc/cache.h> |
| @@ -185,6 +183,4 @@ static inline unsigned long hash_mem(char const *buf, int length, int bits) · 167 unmodified lines | ||
| 185 | 183 | return full_name_hash(NULL, buf, length) >> (32 - bits); |
| 186 | 184 | } |
| 187 | 185 | |
| 188 | −#endif /* __KERNEL__ */ | |
| 189 | − | |
| 190 | 186 | #endif /* _LINUX_SUNRPC_SVCAUTH_H_ */ |
| @@ -9,7 +9,6 @@ · 8 unmodified lines | ||
| 9 | 9 | #ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H |
| 10 | 10 | #define _LINUX_SUNRPC_SVCAUTH_GSS_H |
| 11 | 11 | |
| 12 | −#ifdef __KERNEL__ | |
| 13 | 12 | #include <linux/sched.h> |
| 14 | 13 | #include <linux/sunrpc/types.h> |
| 15 | 14 | #include <linux/sunrpc/xdr.h> |
| @@ -24,5 +23,4 @@ void gss_svc_shutdown_net(struct net *net); · 8 unmodified lines | ||
| 24 | 23 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); |
| 25 | 24 | u32 svcauth_gss_flavor(struct auth_domain *dom); |
| 26 | 25 | |
| 27 | −#endif /* __KERNEL__ */ | |
| 28 | 26 | #endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ |
| @@ -11,8 +11,6 @@ · 10 unmodified lines | ||
| 11 | 11 | #ifndef _SUNRPC_XDR_H_ |
| 12 | 12 | #define _SUNRPC_XDR_H_ |
| 13 | 13 | |
| 14 | −#ifdef __KERNEL__ | |
| 15 | − | |
| 16 | 14 | #include <linux/uio.h> |
| 17 | 15 | #include <asm/byteorder.h> |
| 18 | 16 | #include <asm/unaligned.h> |
| @@ -552,6 +550,5 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr, · 533 unmodified lines | ||
| 552 | 550 | *array = be32_to_cpup(p); |
| 553 | 551 | return retval; |
| 554 | 552 | } |
| 555 | −#endif /* __KERNEL__ */ | |
| 556 | 553 | |
| 557 | 554 | #endif /* _SUNRPC_XDR_H_ */ |
| @@ -19,8 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <linux/sunrpc/xdr.h> |
| 20 | 20 | #include <linux/sunrpc/msg_prot.h> |
| 21 | 21 | |
| 22 | −#ifdef __KERNEL__ | |
| 23 | − | |
| 24 | 22 | #define RPC_MIN_SLOT_TABLE (2U) |
| 25 | 23 | #define RPC_DEF_SLOT_TABLE (16U) |
| 26 | 24 | #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) |
| @@ -207,7 +205,8 @@ struct rpc_xprt { · 180 unmodified lines | ||
| 207 | 205 | unsigned int min_reqs; /* min number of slots */ |
| 208 | 206 | unsigned int num_reqs; /* total slots */ |
| 209 | 207 | unsigned long state; /* transport state */ |
| 210 | − unsigned char resvport : 1; /* use a reserved port */ | |
| 208 | + unsigned char resvport : 1, /* use a reserved port */ | |
| 209 | + reuseport : 1; /* reuse port on reconnect */ | |
| 211 | 210 | atomic_t swapper; /* we're swapping over this |
| 212 | 211 | transport */ |
| 213 | 212 | unsigned int bind_index; /* bind function index */ |
| @@ -505,6 +504,4 @@ static inline void xprt_inject_disconnect(struct rpc_xprt *xprt) · 291 unmodified lines | ||
| 505 | 504 | } |
| 506 | 505 | #endif |
| 507 | 506 | |
| 508 | −#endif /* __KERNEL__*/ | |
| 509 | − | |
| 510 | 507 | #endif /* _LINUX_SUNRPC_XPRT_H */ |
| @@ -8,8 +8,6 @@ · 7 unmodified lines | ||
| 8 | 8 | #ifndef _LINUX_SUNRPC_XPRTSOCK_H |
| 9 | 9 | #define _LINUX_SUNRPC_XPRTSOCK_H |
| 10 | 10 | |
| 11 | −#ifdef __KERNEL__ | |
| 12 | − | |
| 13 | 11 | int init_socket_xprt(void); |
| 14 | 12 | void cleanup_socket_xprt(void); |
| 15 | 13 | |
| @@ -91,6 +89,4 @@ struct sock_xprt { · 75 unmodified lines | ||
| 91 | 89 | #define XPRT_SOCK_WAKE_PENDING (6) |
| 92 | 90 | #define XPRT_SOCK_WAKE_DISCONNECT (7) |
| 93 | 91 | |
| 94 | −#endif /* __KERNEL__ */ | |
| 95 | − | |
| 96 | 92 | #endif /* _LINUX_SUNRPC_XPRTSOCK_H */ |
| @@ -307,7 +307,7 @@ struct vma_swap_readahead { · 306 unmodified lines | ||
| 307 | 307 | }; |
| 308 | 308 | |
| 309 | 309 | /* linux/mm/workingset.c */ |
| 310 | −void *workingset_eviction(struct page *page); | |
| 310 | +void *workingset_eviction(struct page *page, struct mem_cgroup *target_memcg); | |
| 311 | 311 | void workingset_refault(struct page *page, void *shadow); |
| 312 | 312 | void workingset_activation(struct page *page); |
| 313 | 313 | |
| @@ -10,6 +10,8 @@ · 9 unmodified lines | ||
| 10 | 10 | #ifndef __SXGBE_PLATFORM_H__ |
| 11 | 11 | #define __SXGBE_PLATFORM_H__ |
| 12 | 12 | |
| 13 | +#include <linux/phy.h> | |
| 14 | + | |
| 13 | 15 | /* MDC Clock Selection define*/ |
| 14 | 16 | #define SXGBE_CSR_100_150M 0x0 /* MDC = clk_scr_i/62 */ |
| 15 | 17 | #define SXGBE_CSR_150_250M 0x1 /* MDC = clk_scr_i/102 */ |
| @@ -38,7 +40,7 @@ struct sxgbe_plat_data { · 22 unmodified lines | ||
| 38 | 40 | char *phy_bus_name; |
| 39 | 41 | int bus_id; |
| 40 | 42 | int phy_addr; |
| 41 | − int interface; | |
| 43 | + phy_interface_t interface; | |
| 42 | 44 | struct sxgbe_mdio_bus_data *mdio_bus_data; |
| 43 | 45 | struct sxgbe_dma_cfg *dma_cfg; |
| 44 | 46 | int clk_csr; |
| @@ -15,6 +15,7 @@ struct soc_device_attribute { · 14 unmodified lines | ||
| 15 | 15 | const char *serial_number; |
| 16 | 16 | const char *soc_id; |
| 17 | 17 | const void *data; |
| 18 | + const struct attribute_group *custom_attr_group; | |
| 18 | 19 | }; |
| 19 | 20 | |
| 20 | 21 | /** |
| @@ -51,7 +51,7 @@ struct statx; · 50 unmodified lines | ||
| 51 | 51 | struct __sysctl_args; |
| 52 | 52 | struct sysinfo; |
| 53 | 53 | struct timespec; |
| 54 | −struct timeval; | |
| 54 | +struct __kernel_old_timeval; | |
| 55 | 55 | struct __kernel_timex; |
| 56 | 56 | struct timezone; |
| 57 | 57 | struct tms; |
| @@ -732,9 +732,9 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, · 674 unmodified lines | ||
| 732 | 732 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); |
| 733 | 733 | |
| 734 | 734 | /* kernel/time.c */ |
| 735 | −asmlinkage long sys_gettimeofday(struct timeval __user *tv, | |
| 735 | +asmlinkage long sys_gettimeofday(struct __kernel_old_timeval __user *tv, | |
| 736 | 736 | struct timezone __user *tz); |
| 737 | −asmlinkage long sys_settimeofday(struct timeval __user *tv, | |
| 737 | +asmlinkage long sys_settimeofday(struct __kernel_old_timeval __user *tv, | |
| 738 | 738 | struct timezone __user *tz); |
| 739 | 739 | asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p); |
| 740 | 740 | asmlinkage long sys_adjtimex_time32(struct old_timex32 __user *txc_p); |
| @@ -1076,15 +1076,15 @@ asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice); · 335 unmodified lines | ||
| 1076 | 1076 | asmlinkage long sys_alarm(unsigned int seconds); |
| 1077 | 1077 | asmlinkage long sys_getpgrp(void); |
| 1078 | 1078 | asmlinkage long sys_pause(void); |
| 1079 | −asmlinkage long sys_time(time_t __user *tloc); | |
| 1079 | +asmlinkage long sys_time(__kernel_old_time_t __user *tloc); | |
| 1080 | 1080 | asmlinkage long sys_time32(old_time32_t __user *tloc); |
| 1081 | 1081 | #ifdef __ARCH_WANT_SYS_UTIME |
| 1082 | 1082 | asmlinkage long sys_utime(char __user *filename, |
| 1083 | 1083 | struct utimbuf __user *times); |
| 1084 | 1084 | asmlinkage long sys_utimes(char __user *filename, |
| 1085 | − struct timeval __user *utimes); | |
| 1085 | + struct __kernel_old_timeval __user *utimes); | |
| 1086 | 1086 | asmlinkage long sys_futimesat(int dfd, const char __user *filename, |
| 1087 | − struct timeval __user *utimes); | |
| 1087 | + struct __kernel_old_timeval __user *utimes); | |
| 1088 | 1088 | #endif |
| 1089 | 1089 | asmlinkage long sys_futimesat_time32(unsigned int dfd, |
| 1090 | 1090 | const char __user *filename, |
| @@ -1098,7 +1098,7 @@ asmlinkage long sys_getdents(unsigned int fd, · 7 unmodified lines | ||
| 1098 | 1098 | struct linux_dirent __user *dirent, |
| 1099 | 1099 | unsigned int count); |
| 1100 | 1100 | asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, |
| 1101 | − fd_set __user *exp, struct timeval __user *tvp); | |
| 1101 | + fd_set __user *exp, struct __kernel_old_timeval __user *tvp); | |
| 1102 | 1102 | asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, |
| 1103 | 1103 | int timeout); |
| 1104 | 1104 | asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, |
| @@ -1116,7 +1116,7 @@ asmlinkage long sys_sysfs(int option, · 11 unmodified lines | ||
| 1116 | 1116 | asmlinkage long sys_fork(void); |
| 1117 | 1117 | |
| 1118 | 1118 | /* obsolete: kernel/time/time.c */ |
| 1119 | −asmlinkage long sys_stime(time_t __user *tptr); | |
| 1119 | +asmlinkage long sys_stime(__kernel_old_time_t __user *tptr); | |
| 1120 | 1120 | asmlinkage long sys_stime32(old_time32_t __user *tptr); |
| 1121 | 1121 | |
| 1122 | 1122 | /* obsolete: kernel/signal.c */ |
| @@ -1231,10 +1231,7 @@ asmlinkage long sys_ni_syscall(void); · 108 unmodified lines | ||
| 1231 | 1231 | * the ksys_xyzyyz() functions prototyped below. |
| 1232 | 1232 | */ |
| 1233 | 1233 | |
| 1234 | −int ksys_mount(const char __user *dev_name, const char __user *dir_name, | |
| 1235 | − const char __user *type, unsigned long flags, void __user *data); | |
| 1236 | 1234 | int ksys_umount(char __user *name, int flags); |
| 1237 | −int ksys_dup(unsigned int fildes); | |
| 1238 | 1235 | int ksys_chroot(const char __user *filename); |
| 1239 | 1236 | ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count); |
| 1240 | 1237 | int ksys_chdir(const char __user *filename); |
| @@ -120,8 +120,7 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll) · 119 unmodified lines | ||
| 120 | 120 | struct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name) |
| 121 | 121 | |
| 122 | 122 | /* A sysctl table is an array of struct ctl_table: */ |
| 123 | −struct ctl_table | |
| 124 | −{ | |
| 123 | +struct ctl_table { | |
| 125 | 124 | const char *procname; /* Text ID for /proc/sys, or zero */ |
| 126 | 125 | void *data; |
| 127 | 126 | int maxlen; |
| @@ -140,8 +139,7 @@ struct ctl_node { · 12 unmodified lines | ||
| 140 | 139 | |
| 141 | 140 | /* struct ctl_table_header is used to maintain dynamic lists of |
| 142 | 141 | struct ctl_table trees. */ |
| 143 | −struct ctl_table_header | |
| 144 | −{ | |
| 142 | +struct ctl_table_header { | |
| 145 | 143 | union { |
| 146 | 144 | struct { |
| 147 | 145 | struct ctl_table *ctl_table; |
| @@ -223,7 +223,7 @@ struct tcp_sock { · 222 unmodified lines | ||
| 223 | 223 | fastopen_connect:1, /* FASTOPEN_CONNECT sockopt */ |
| 224 | 224 | fastopen_no_cookie:1, /* Allow send/recv SYN+data without a cookie */ |
| 225 | 225 | is_sack_reneg:1, /* in recovery from loss with SACK reneg? */ |
| 226 | − unused:2; | |
| 226 | + fastopen_client_fail:2; /* reason why fastopen failed */ | |
| 227 | 227 | u8 nonagle : 4,/* Disable Nagle algorithm? */ |
| 228 | 228 | thin_lto : 1,/* Use linear timeouts for thin streams */ |
| 229 | 229 | recvmsg_inq : 1,/* Indicate # of bytes in queue upon recvmsg */ |
| @@ -544,15 +544,4 @@ static inline void thermal_notify_framework(struct thermal_zone_device *tz, · 543 unmodified lines | ||
| 544 | 544 | { } |
| 545 | 545 | #endif /* CONFIG_THERMAL */ |
| 546 | 546 | |
| 547 | −#if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL) | |
| 548 | −extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, | |
| 549 | − enum events event); | |
| 550 | −#else | |
| 551 | −static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz, | |
| 552 | − enum events event) | |
| 553 | −{ | |
| 554 | − return 0; | |
| 555 | −} | |
| 556 | −#endif | |
| 557 | − | |
| 558 | 547 | #endif /* __THERMAL_H__ */ |
| @@ -147,6 +147,8 @@ check_copy_size(const void *addr, size_t bytes, bool is_source) · 146 unmodified lines | ||
| 147 | 147 | __bad_copy_to(); |
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | + if (WARN_ON_ONCE(bytes > INT_MAX)) | |
| 151 | + return false; | |
| 150 | 152 | check_object_size(addr, bytes, is_source); |
| 151 | 153 | return true; |
| 152 | 154 | } |
| @@ -108,7 +108,8 @@ enum tick_dep_bits { · 107 unmodified lines | ||
| 108 | 108 | TICK_DEP_BIT_POSIX_TIMER = 0, |
| 109 | 109 | TICK_DEP_BIT_PERF_EVENTS = 1, |
| 110 | 110 | TICK_DEP_BIT_SCHED = 2, |
| 111 | − TICK_DEP_BIT_CLOCK_UNSTABLE = 3 | |
| 111 | + TICK_DEP_BIT_CLOCK_UNSTABLE = 3, | |
| 112 | + TICK_DEP_BIT_RCU = 4 | |
| 112 | 113 | }; |
| 113 | 114 | |
| 114 | 115 | #define TICK_DEP_MASK_NONE 0 |
| @@ -116,6 +117,7 @@ enum tick_dep_bits { · 1 unmodified line | ||
| 116 | 117 | #define TICK_DEP_MASK_PERF_EVENTS (1 << TICK_DEP_BIT_PERF_EVENTS) |
| 117 | 118 | #define TICK_DEP_MASK_SCHED (1 << TICK_DEP_BIT_SCHED) |
| 118 | 119 | #define TICK_DEP_MASK_CLOCK_UNSTABLE (1 << TICK_DEP_BIT_CLOCK_UNSTABLE) |
| 120 | +#define TICK_DEP_MASK_RCU (1 << TICK_DEP_BIT_RCU) | |
| 119 | 121 | |
| 120 | 122 | #ifdef CONFIG_NO_HZ_COMMON |
| 121 | 123 | extern bool tick_nohz_enabled; |
| @@ -174,7 +176,7 @@ extern cpumask_var_t tick_nohz_full_mask; · 52 unmodified lines | ||
| 174 | 176 | |
| 175 | 177 | static inline bool tick_nohz_full_enabled(void) |
| 176 | 178 | { |
| 177 | − if (!context_tracking_is_enabled()) | |
| 179 | + if (!context_tracking_enabled()) | |
| 178 | 180 | return false; |
| 179 | 181 | |
| 180 | 182 | return tick_nohz_full_running; |
| @@ -268,6 +270,9 @@ static inline bool tick_nohz_full_enabled(void) { return false; } · 87 unmodified lines | ||
| 268 | 270 | static inline bool tick_nohz_full_cpu(int cpu) { return false; } |
| 269 | 271 | static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { } |
| 270 | 272 | |
| 273 | +static inline void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit) { } | |
| 274 | +static inline void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit) { } | |
| 275 | + | |
| 271 | 276 | static inline void tick_dep_set(enum tick_dep_bits bit) { } |
| 272 | 277 | static inline void tick_dep_clear(enum tick_dep_bits bit) { } |
| 273 | 278 | static inline void tick_dep_set_cpu(int cpu, enum tick_dep_bits bit) { } |
| @@ -35,10 +35,11 @@ extern time64_t mktime64(const unsigned int year, const unsigned int mon, · 34 unmodified lines | ||
| 35 | 35 | extern u32 (*arch_gettimeoffset)(void); |
| 36 | 36 | #endif |
| 37 | 37 | |
| 38 | −struct itimerval; | |
| 39 | −extern int do_setitimer(int which, struct itimerval *value, | |
| 40 | − struct itimerval *ovalue); | |
| 41 | −extern int do_getitimer(int which, struct itimerval *value); | |
| 38 | +#ifdef CONFIG_POSIX_TIMERS | |
| 39 | +extern void clear_itimer(void); | |
| 40 | +#else | |
| 41 | +static inline void clear_itimer(void) {} | |
| 42 | +#endif | |
| 42 | 43 | |
| 43 | 44 | extern long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, int flags); |
| 44 | 45 | |
| @@ -96,4 +97,17 @@ static inline bool itimerspec64_valid(const struct itimerspec64 *its) · 51 unmodified lines | ||
| 96 | 97 | */ |
| 97 | 98 | #define time_after32(a, b) ((s32)((u32)(b) - (u32)(a)) < 0) |
| 98 | 99 | #define time_before32(b, a) time_after32(a, b) |
| 100 | + | |
| 101 | +/** | |
| 102 | + * time_between32 - check if a 32-bit timestamp is within a given time range | |
| 103 | + * @t: the time which may be within [l,h] | |
| 104 | + * @l: the lower bound of the range | |
| 105 | + * @h: the higher bound of the range | |
| 106 | + * | |
| 107 | + * time_before32(t, l, h) returns true if @l <= @t <= @h. All operands are | |
| 108 | + * treated as 32-bit integers. | |
| 109 | + * | |
| 110 | + * Equivalent to !(time_before32(@t, @l) || time_after32(@t, @h)). | |
| 111 | + */ | |
| 112 | +#define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l)) | |
| 99 | 113 | #endif |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/time64.h> |
| 13 | 13 | #include <linux/timex.h> |
| 14 | 14 | |
| 15 | −#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) | |
| 15 | +#define TIME_T_MAX (__kernel_old_time_t)((1UL << ((sizeof(__kernel_old_time_t) << 3) - 1)) - 1) | |
| 16 | 16 | |
| 17 | 17 | typedef s32 old_time32_t; |
| 18 | 18 | |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <linux/acpi.h> |
| 22 | 22 | #include <linux/cdev.h> |
| 23 | 23 | #include <linux/fs.h> |
| 24 | +#include <linux/highmem.h> | |
| 24 | 25 | #include <crypto/hash_info.h> |
| 25 | 26 | |
| 26 | 27 | #define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */ |
| @@ -67,6 +68,8 @@ struct tpm_class_ops { · 40 unmodified lines | ||
| 67 | 68 | u8 (*status) (struct tpm_chip *chip); |
| 68 | 69 | void (*update_timeouts)(struct tpm_chip *chip, |
| 69 | 70 | unsigned long *timeout_cap); |
| 71 | + void (*update_durations)(struct tpm_chip *chip, | |
| 72 | + unsigned long *duration_cap); | |
| 70 | 73 | int (*go_idle)(struct tpm_chip *chip); |
| 71 | 74 | int (*cmd_ready)(struct tpm_chip *chip); |
| 72 | 75 | int (*request_locality)(struct tpm_chip *chip, int loc); |
| @@ -161,6 +164,235 @@ struct tpm_chip { · 88 unmodified lines | ||
| 161 | 164 | int locality; |
| 162 | 165 | }; |
| 163 | 166 | |
| 167 | +#define TPM_HEADER_SIZE 10 | |
| 168 | + | |
| 169 | +enum tpm2_const { | |
| 170 | + TPM2_PLATFORM_PCR = 24, | |
| 171 | + TPM2_PCR_SELECT_MIN = ((TPM2_PLATFORM_PCR + 7) / 8), | |
| 172 | +}; | |
| 173 | + | |
| 174 | +enum tpm2_timeouts { | |
| 175 | + TPM2_TIMEOUT_A = 750, | |
| 176 | + TPM2_TIMEOUT_B = 2000, | |
| 177 | + TPM2_TIMEOUT_C = 200, | |
| 178 | + TPM2_TIMEOUT_D = 30, | |
| 179 | + TPM2_DURATION_SHORT = 20, | |
| 180 | + TPM2_DURATION_MEDIUM = 750, | |
| 181 | + TPM2_DURATION_LONG = 2000, | |
| 182 | + TPM2_DURATION_LONG_LONG = 300000, | |
| 183 | + TPM2_DURATION_DEFAULT = 120000, | |
| 184 | +}; | |
| 185 | + | |
| 186 | +enum tpm2_structures { | |
| 187 | + TPM2_ST_NO_SESSIONS = 0x8001, | |
| 188 | + TPM2_ST_SESSIONS = 0x8002, | |
| 189 | +}; | |
| 190 | + | |
| 191 | +/* Indicates from what layer of the software stack the error comes from */ | |
| 192 | +#define TSS2_RC_LAYER_SHIFT 16 | |
| 193 | +#define TSS2_RESMGR_TPM_RC_LAYER (11 << TSS2_RC_LAYER_SHIFT) | |
| 194 | + | |
| 195 | +enum tpm2_return_codes { | |
| 196 | + TPM2_RC_SUCCESS = 0x0000, | |
| 197 | + TPM2_RC_HASH = 0x0083, /* RC_FMT1 */ | |
| 198 | + TPM2_RC_HANDLE = 0x008B, | |
| 199 | + TPM2_RC_INITIALIZE = 0x0100, /* RC_VER1 */ | |
| 200 | + TPM2_RC_FAILURE = 0x0101, | |
| 201 | + TPM2_RC_DISABLED = 0x0120, | |
| 202 | + TPM2_RC_COMMAND_CODE = 0x0143, | |
| 203 | + TPM2_RC_TESTING = 0x090A, /* RC_WARN */ | |
| 204 | + TPM2_RC_REFERENCE_H0 = 0x0910, | |
| 205 | + TPM2_RC_RETRY = 0x0922, | |
| 206 | +}; | |
| 207 | + | |
| 208 | +enum tpm2_command_codes { | |
| 209 | + TPM2_CC_FIRST = 0x011F, | |
| 210 | + TPM2_CC_HIERARCHY_CONTROL = 0x0121, | |
| 211 | + TPM2_CC_HIERARCHY_CHANGE_AUTH = 0x0129, | |
| 212 | + TPM2_CC_CREATE_PRIMARY = 0x0131, | |
| 213 | + TPM2_CC_SEQUENCE_COMPLETE = 0x013E, | |
| 214 | + TPM2_CC_SELF_TEST = 0x0143, | |
| 215 | + TPM2_CC_STARTUP = 0x0144, | |
| 216 | + TPM2_CC_SHUTDOWN = 0x0145, | |
| 217 | + TPM2_CC_NV_READ = 0x014E, | |
| 218 | + TPM2_CC_CREATE = 0x0153, | |
| 219 | + TPM2_CC_LOAD = 0x0157, | |
| 220 | + TPM2_CC_SEQUENCE_UPDATE = 0x015C, | |
| 221 | + TPM2_CC_UNSEAL = 0x015E, | |
| 222 | + TPM2_CC_CONTEXT_LOAD = 0x0161, | |
| 223 | + TPM2_CC_CONTEXT_SAVE = 0x0162, | |
| 224 | + TPM2_CC_FLUSH_CONTEXT = 0x0165, | |
| 225 | + TPM2_CC_VERIFY_SIGNATURE = 0x0177, | |
| 226 | + TPM2_CC_GET_CAPABILITY = 0x017A, | |
| 227 | + TPM2_CC_GET_RANDOM = 0x017B, | |
| 228 | + TPM2_CC_PCR_READ = 0x017E, | |
| 229 | + TPM2_CC_PCR_EXTEND = 0x0182, | |
| 230 | + TPM2_CC_EVENT_SEQUENCE_COMPLETE = 0x0185, | |
| 231 | + TPM2_CC_HASH_SEQUENCE_START = 0x0186, | |
| 232 | + TPM2_CC_CREATE_LOADED = 0x0191, | |
| 233 | + TPM2_CC_LAST = 0x0193, /* Spec 1.36 */ | |
| 234 | +}; | |
| 235 | + | |
| 236 | +enum tpm2_permanent_handles { | |
| 237 | + TPM2_RS_PW = 0x40000009, | |
| 238 | +}; | |
| 239 | + | |
| 240 | +enum tpm2_capabilities { | |
| 241 | + TPM2_CAP_HANDLES = 1, | |
| 242 | + TPM2_CAP_COMMANDS = 2, | |
| 243 | + TPM2_CAP_PCRS = 5, | |
| 244 | + TPM2_CAP_TPM_PROPERTIES = 6, | |
| 245 | +}; | |
| 246 | + | |
| 247 | +enum tpm2_properties { | |
| 248 | + TPM_PT_TOTAL_COMMANDS = 0x0129, | |
| 249 | +}; | |
| 250 | + | |
| 251 | +enum tpm2_startup_types { | |
| 252 | + TPM2_SU_CLEAR = 0x0000, | |
| 253 | + TPM2_SU_STATE = 0x0001, | |
| 254 | +}; | |
| 255 | + | |
| 256 | +enum tpm2_cc_attrs { | |
| 257 | + TPM2_CC_ATTR_CHANDLES = 25, | |
| 258 | + TPM2_CC_ATTR_RHANDLE = 28, | |
| 259 | +}; | |
| 260 | + | |
| 261 | +#define TPM_VID_INTEL 0x8086 | |
| 262 | +#define TPM_VID_WINBOND 0x1050 | |
| 263 | +#define TPM_VID_STM 0x104A | |
| 264 | + | |
| 265 | +enum tpm_chip_flags { | |
| 266 | + TPM_CHIP_FLAG_TPM2 = BIT(1), | |
| 267 | + TPM_CHIP_FLAG_IRQ = BIT(2), | |
| 268 | + TPM_CHIP_FLAG_VIRTUAL = BIT(3), | |
| 269 | + TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), | |
| 270 | + TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), | |
| 271 | + TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED = BIT(6), | |
| 272 | +}; | |
| 273 | + | |
| 274 | +#define to_tpm_chip(d) container_of(d, struct tpm_chip, dev) | |
| 275 | + | |
| 276 | +struct tpm_header { | |
| 277 | + __be16 tag; | |
| 278 | + __be32 length; | |
| 279 | + union { | |
| 280 | + __be32 ordinal; | |
| 281 | + __be32 return_code; | |
| 282 | + }; | |
| 283 | +} __packed; | |
| 284 | + | |
| 285 | +/* A string buffer type for constructing TPM commands. This is based on the | |
| 286 | + * ideas of string buffer code in security/keys/trusted.h but is heap based | |
| 287 | + * in order to keep the stack usage minimal. | |
| 288 | + */ | |
| 289 | + | |
| 290 | +enum tpm_buf_flags { | |
| 291 | + TPM_BUF_OVERFLOW = BIT(0), | |
| 292 | +}; | |
| 293 | + | |
| 294 | +struct tpm_buf { | |
| 295 | + unsigned int flags; | |
| 296 | + u8 *data; | |
| 297 | +}; | |
| 298 | + | |
| 299 | +enum tpm2_object_attributes { | |
| 300 | + TPM2_OA_USER_WITH_AUTH = BIT(6), | |
| 301 | +}; | |
| 302 | + | |
| 303 | +enum tpm2_session_attributes { | |
| 304 | + TPM2_SA_CONTINUE_SESSION = BIT(0), | |
| 305 | +}; | |
| 306 | + | |
| 307 | +struct tpm2_hash { | |
| 308 | + unsigned int crypto_id; | |
| 309 | + unsigned int tpm_id; | |
| 310 | +}; | |
| 311 | + | |
| 312 | +static inline void tpm_buf_reset(struct tpm_buf *buf, u16 tag, u32 ordinal) | |
| 313 | +{ | |
| 314 | + struct tpm_header *head = (struct tpm_header *)buf->data; | |
| 315 | + | |
| 316 | + head->tag = cpu_to_be16(tag); | |
| 317 | + head->length = cpu_to_be32(sizeof(*head)); | |
| 318 | + head->ordinal = cpu_to_be32(ordinal); | |
| 319 | +} | |
| 320 | + | |
| 321 | +static inline int tpm_buf_init(struct tpm_buf *buf, u16 tag, u32 ordinal) | |
| 322 | +{ | |
| 323 | + buf->data = (u8 *)__get_free_page(GFP_KERNEL); | |
| 324 | + if (!buf->data) | |
| 325 | + return -ENOMEM; | |
| 326 | + | |
| 327 | + buf->flags = 0; | |
| 328 | + tpm_buf_reset(buf, tag, ordinal); | |
| 329 | + return 0; | |
| 330 | +} | |
| 331 | + | |
| 332 | +static inline void tpm_buf_destroy(struct tpm_buf *buf) | |
| 333 | +{ | |
| 334 | + free_page((unsigned long)buf->data); | |
| 335 | +} | |
| 336 | + | |
| 337 | +static inline u32 tpm_buf_length(struct tpm_buf *buf) | |
| 338 | +{ | |
| 339 | + struct tpm_header *head = (struct tpm_header *)buf->data; | |
| 340 | + | |
| 341 | + return be32_to_cpu(head->length); | |
| 342 | +} | |
| 343 | + | |
| 344 | +static inline u16 tpm_buf_tag(struct tpm_buf *buf) | |
| 345 | +{ | |
| 346 | + struct tpm_header *head = (struct tpm_header *)buf->data; | |
| 347 | + | |
| 348 | + return be16_to_cpu(head->tag); | |
| 349 | +} | |
| 350 | + | |
| 351 | +static inline void tpm_buf_append(struct tpm_buf *buf, | |
| 352 | + const unsigned char *new_data, | |
| 353 | + unsigned int new_len) | |
| 354 | +{ | |
| 355 | + struct tpm_header *head = (struct tpm_header *)buf->data; | |
| 356 | + u32 len = tpm_buf_length(buf); | |
| 357 | + | |
| 358 | + /* Return silently if overflow has already happened. */ | |
| 359 | + if (buf->flags & TPM_BUF_OVERFLOW) | |
| 360 | + return; | |
| 361 | + | |
| 362 | + if ((len + new_len) > PAGE_SIZE) { | |
| 363 | + WARN(1, "tpm_buf: overflow\n"); | |
| 364 | + buf->flags |= TPM_BUF_OVERFLOW; | |
| 365 | + return; | |
| 366 | + } | |
| 367 | + | |
| 368 | + memcpy(&buf->data[len], new_data, new_len); | |
| 369 | + head->length = cpu_to_be32(len + new_len); | |
| 370 | +} | |
| 371 | + | |
| 372 | +static inline void tpm_buf_append_u8(struct tpm_buf *buf, const u8 value) | |
| 373 | +{ | |
| 374 | + tpm_buf_append(buf, &value, 1); | |
| 375 | +} | |
| 376 | + | |
| 377 | +static inline void tpm_buf_append_u16(struct tpm_buf *buf, const u16 value) | |
| 378 | +{ | |
| 379 | + __be16 value2 = cpu_to_be16(value); | |
| 380 | + | |
| 381 | + tpm_buf_append(buf, (u8 *) &value2, 2); | |
| 382 | +} | |
| 383 | + | |
| 384 | +static inline void tpm_buf_append_u32(struct tpm_buf *buf, const u32 value) | |
| 385 | +{ | |
| 386 | + __be32 value2 = cpu_to_be32(value); | |
| 387 | + | |
| 388 | + tpm_buf_append(buf, (u8 *) &value2, 4); | |
| 389 | +} | |
| 390 | + | |
| 391 | +static inline u32 tpm2_rc_value(u32 rc) | |
| 392 | +{ | |
| 393 | + return (rc & BIT(7)) ? rc & 0xff : rc; | |
| 394 | +} | |
| 395 | + | |
| 164 | 396 | #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) |
| 165 | 397 | |
| 166 | 398 | extern int tpm_is_tpm2(struct tpm_chip *chip); |
| @@ -170,13 +402,8 @@ extern int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, · 3 unmodified lines | ||
| 170 | 402 | struct tpm_digest *digests); |
| 171 | 403 | extern int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen); |
| 172 | 404 | extern int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max); |
| 173 | −extern int tpm_seal_trusted(struct tpm_chip *chip, | |
| 174 | − struct trusted_key_payload *payload, | |
| 175 | − struct trusted_key_options *options); | |
| 176 | −extern int tpm_unseal_trusted(struct tpm_chip *chip, | |
| 177 | − struct trusted_key_payload *payload, | |
| 178 | − struct trusted_key_options *options); | |
| 179 | 405 | extern struct tpm_chip *tpm_default_chip(void); |
| 406 | +void tpm2_flush_context(struct tpm_chip *chip, u32 handle); | |
| 180 | 407 | #else |
| 181 | 408 | static inline int tpm_is_tpm2(struct tpm_chip *chip) |
| 182 | 409 | { |
| @@ -204,18 +431,6 @@ static inline int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max) · 21 unmodified lines | ||
| 204 | 431 | return -ENODEV; |
| 205 | 432 | } |
| 206 | 433 | |
| 207 | −static inline int tpm_seal_trusted(struct tpm_chip *chip, | |
| 208 | − struct trusted_key_payload *payload, | |
| 209 | − struct trusted_key_options *options) | |
| 210 | −{ | |
| 211 | − return -ENODEV; | |
| 212 | −} | |
| 213 | −static inline int tpm_unseal_trusted(struct tpm_chip *chip, | |
| 214 | − struct trusted_key_payload *payload, | |
| 215 | − struct trusted_key_options *options) | |
| 216 | −{ | |
| 217 | − return -ENODEV; | |
| 218 | −} | |
| 219 | 434 | static inline struct tpm_chip *tpm_default_chip(void) |
| 220 | 435 | { |
| 221 | 436 | return NULL; |
| @@ -24,6 +24,14 @@ struct trace_export { · 23 unmodified lines | ||
| 24 | 24 | int register_ftrace_export(struct trace_export *export); |
| 25 | 25 | int unregister_ftrace_export(struct trace_export *export); |
| 26 | 26 | |
| 27 | +struct trace_array; | |
| 28 | + | |
| 29 | +void trace_printk_init_buffers(void); | |
| 30 | +int trace_array_printk(struct trace_array *tr, unsigned long ip, | |
| 31 | + const char *fmt, ...); | |
| 32 | +void trace_array_put(struct trace_array *tr); | |
| 33 | +struct trace_array *trace_array_get_by_name(const char *name); | |
| 34 | +int trace_array_destroy(struct trace_array *tr); | |
| 27 | 35 | #endif /* CONFIG_TRACING */ |
| 28 | 36 | |
| 29 | 37 | #endif /* _LINUX_TRACE_H */ |
| @@ -45,6 +45,11 @@ const char *trace_print_array_seq(struct trace_seq *p, · 44 unmodified lines | ||
| 45 | 45 | const void *buf, int count, |
| 46 | 46 | size_t el_size); |
| 47 | 47 | |
| 48 | +const char * | |
| 49 | +trace_print_hex_dump_seq(struct trace_seq *p, const char *prefix_str, | |
| 50 | + int prefix_type, int rowsize, int groupsize, | |
| 51 | + const void *buf, size_t len, bool ascii); | |
| 52 | + | |
| 48 | 53 | struct trace_iterator; |
| 49 | 54 | struct trace_event; |
| 50 | 55 | |
| @@ -550,7 +555,8 @@ extern int trace_event_get_offsets(struct trace_event_call *call); · 499 unmodified lines | ||
| 550 | 555 | |
| 551 | 556 | int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set); |
| 552 | 557 | int trace_set_clr_event(const char *system, const char *event, int set); |
| 553 | − | |
| 558 | +int trace_array_set_clr_event(struct trace_array *tr, const char *system, | |
| 559 | + const char *event, bool enable); | |
| 554 | 560 | /* |
| 555 | 561 | * The double __builtin_constant_p is because gcc will give us an error |
| 556 | 562 | * if we try to allocate the static variable to fmt if it is not a |
| @@ -92,6 +92,10 @@ extern int trace_seq_path(struct trace_seq *s, const struct path *path); · 91 unmodified lines | ||
| 92 | 92 | extern void trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, |
| 93 | 93 | int nmaskbits); |
| 94 | 94 | |
| 95 | +extern int trace_seq_hex_dump(struct trace_seq *s, const char *prefix_str, | |
| 96 | + int prefix_type, int rowsize, int groupsize, | |
| 97 | + const void *buf, size_t len, bool ascii); | |
| 98 | + | |
| 95 | 99 | #else /* CONFIG_TRACING */ |
| 96 | 100 | static inline void trace_seq_printf(struct trace_seq *s, const char *fmt, ...) |
| 97 | 101 | { |
| @@ -67,7 +67,7 @@ typedef __kernel_ptrdiff_t ptrdiff_t; · 66 unmodified lines | ||
| 67 | 67 | |
| 68 | 68 | #ifndef _TIME_T |
| 69 | 69 | #define _TIME_T |
| 70 | −typedef __kernel_time_t time_t; | |
| 70 | +typedef __kernel_old_time_t time_t; | |
| 71 | 71 | #endif |
| 72 | 72 | |
| 73 | 73 | #ifndef _CLOCK_T |
| @@ -225,5 +225,10 @@ struct callback_head { · 151 unmodified lines | ||
| 225 | 225 | typedef void (*rcu_callback_t)(struct rcu_head *head); |
| 226 | 226 | typedef void (*call_rcu_func_t)(struct rcu_head *head, rcu_callback_t func); |
| 227 | 227 | |
| 228 | +typedef void (*swap_func_t)(void *a, void *b, int size); | |
| 229 | + | |
| 230 | +typedef int (*cmp_r_func_t)(const void *a, const void *b, const void *priv); | |
| 231 | +typedef int (*cmp_func_t)(const void *a, const void *b); | |
| 232 | + | |
| 228 | 233 | #endif /* __ASSEMBLY__ */ |
| 229 | 234 | #endif /* _LINUX_TYPES_H */ |
| @@ -40,8 +40,8 @@ · 39 unmodified lines | ||
| 40 | 40 | * spin_lock_bh(...) or other synchronization to get exclusive access |
| 41 | 41 | * ... |
| 42 | 42 | * u64_stats_update_begin(&stats->syncp); |
| 43 | − * stats->bytes64 += len; // non atomic operation | |
| 44 | − * stats->packets64++; // non atomic operation | |
| 43 | + * u64_stats_add(&stats->bytes64, len); // non atomic operation | |
| 44 | + * u64_stats_inc(&stats->packets64); // non atomic operation | |
| 45 | 45 | * u64_stats_update_end(&stats->syncp); |
| 46 | 46 | * |
| 47 | 47 | * While a consumer (reader) should use following template to get consistent |
| @@ -52,8 +52,8 @@ · 4 unmodified lines | ||
| 52 | 52 | * |
| 53 | 53 | * do { |
| 54 | 54 | * start = u64_stats_fetch_begin(&stats->syncp); |
| 55 | − * tbytes = stats->bytes64; // non atomic operation | |
| 56 | − * tpackets = stats->packets64; // non atomic operation | |
| 55 | + * tbytes = u64_stats_read(&stats->bytes64); // non atomic operation | |
| 56 | + * tpackets = u64_stats_read(&stats->packets64); // non atomic operation | |
| 57 | 57 | * } while (u64_stats_fetch_retry(&stats->syncp, start)); |
| 58 | 58 | * |
| 59 | 59 | * |
| @@ -68,6 +68,49 @@ struct u64_stats_sync { · 8 unmodified lines | ||
| 68 | 68 | #endif |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | +#if BITS_PER_LONG == 64 | |
| 72 | +#include <asm/local64.h> | |
| 73 | + | |
| 74 | +typedef struct { | |
| 75 | + local64_t v; | |
| 76 | +} u64_stats_t ; | |
| 77 | + | |
| 78 | +static inline u64 u64_stats_read(const u64_stats_t *p) | |
| 79 | +{ | |
| 80 | + return local64_read(&p->v); | |
| 81 | +} | |
| 82 | + | |
| 83 | +static inline void u64_stats_add(u64_stats_t *p, unsigned long val) | |
| 84 | +{ | |
| 85 | + local64_add(val, &p->v); | |
| 86 | +} | |
| 87 | + | |
| 88 | +static inline void u64_stats_inc(u64_stats_t *p) | |
| 89 | +{ | |
| 90 | + local64_inc(&p->v); | |
| 91 | +} | |
| 92 | + | |
| 93 | +#else | |
| 94 | + | |
| 95 | +typedef struct { | |
| 96 | + u64 v; | |
| 97 | +} u64_stats_t; | |
| 98 | + | |
| 99 | +static inline u64 u64_stats_read(const u64_stats_t *p) | |
| 100 | +{ | |
| 101 | + return p->v; | |
| 102 | +} | |
| 103 | + | |
| 104 | +static inline void u64_stats_add(u64_stats_t *p, unsigned long val) | |
| 105 | +{ | |
| 106 | + p->v += val; | |
| 107 | +} | |
| 108 | + | |
| 109 | +static inline void u64_stats_inc(u64_stats_t *p) | |
| 110 | +{ | |
| 111 | + p->v++; | |
| 112 | +} | |
| 113 | +#endif | |
| 71 | 114 | |
| 72 | 115 | static inline void u64_stats_init(struct u64_stats_sync *syncp) |
| 73 | 116 | { |
| @@ -311,6 +311,7 @@ copy_struct_from_user(void *dst, size_t ksize, const void __user *src, · 310 unmodified lines | ||
| 311 | 311 | * happens, handle that and return -EFAULT. |
| 312 | 312 | */ |
| 313 | 313 | extern long probe_kernel_read(void *dst, const void *src, size_t size); |
| 314 | +extern long probe_kernel_read_strict(void *dst, const void *src, size_t size); | |
| 314 | 315 | extern long __probe_kernel_read(void *dst, const void *src, size_t size); |
| 315 | 316 | |
| 316 | 317 | /* |
| @@ -337,7 +338,22 @@ extern long __probe_user_read(void *dst, const void __user *src, size_t size); · 20 unmodified lines | ||
| 337 | 338 | extern long notrace probe_kernel_write(void *dst, const void *src, size_t size); |
| 338 | 339 | extern long notrace __probe_kernel_write(void *dst, const void *src, size_t size); |
| 339 | 340 | |
| 341 | +/* | |
| 342 | + * probe_user_write(): safely attempt to write to a location in user space | |
| 343 | + * @dst: address to write to | |
| 344 | + * @src: pointer to the data that shall be written | |
| 345 | + * @size: size of the data chunk | |
| 346 | + * | |
| 347 | + * Safely write to address @dst from the buffer at @src. If a kernel fault | |
| 348 | + * happens, handle that and return -EFAULT. | |
| 349 | + */ | |
| 350 | +extern long notrace probe_user_write(void __user *dst, const void *src, size_t size); | |
| 351 | +extern long notrace __probe_user_write(void __user *dst, const void *src, size_t size); | |
| 352 | + | |
| 340 | 353 | extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count); |
| 354 | +extern long strncpy_from_unsafe_strict(char *dst, const void *unsafe_addr, | |
| 355 | + long count); | |
| 356 | +extern long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count); | |
| 341 | 357 | extern long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr, |
| 342 | 358 | long count); |
| 343 | 359 | extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count); |
| @@ -45,8 +45,8 @@ struct iov_iter { · 44 unmodified lines | ||
| 45 | 45 | union { |
| 46 | 46 | unsigned long nr_segs; |
| 47 | 47 | struct { |
| 48 | − int idx; | |
| 49 | − int start_idx; | |
| 48 | + unsigned int head; | |
| 49 | + unsigned int start_head; | |
| 50 | 50 | }; |
| 51 | 51 | }; |
| 52 | 52 | }; |
| @@ -50,6 +50,9 @@ struct usb_role_switch *usb_role_switch_get(struct device *dev); · 49 unmodified lines | ||
| 50 | 50 | struct usb_role_switch *fwnode_usb_role_switch_get(struct fwnode_handle *node); |
| 51 | 51 | void usb_role_switch_put(struct usb_role_switch *sw); |
| 52 | 52 | |
| 53 | +struct usb_role_switch * | |
| 54 | +usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode); | |
| 55 | + | |
| 53 | 56 | struct usb_role_switch * |
| 54 | 57 | usb_role_switch_register(struct device *parent, |
| 55 | 58 | const struct usb_role_switch_desc *desc); |
| @@ -46,45 +46,6 @@ enum tcpm_transmit_type { · 45 unmodified lines | ||
| 46 | 46 | TCPC_TX_BIST_MODE_2 = 7 |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | −/** | |
| 50 | − * struct tcpc_config - Port configuration | |
| 51 | − * @src_pdo: PDO parameters sent to port partner as response to | |
| 52 | − * PD_CTRL_GET_SOURCE_CAP message | |
| 53 | − * @nr_src_pdo: Number of entries in @src_pdo | |
| 54 | − * @snk_pdo: PDO parameters sent to partner as response to | |
| 55 | − * PD_CTRL_GET_SINK_CAP message | |
| 56 | − * @nr_snk_pdo: Number of entries in @snk_pdo | |
| 57 | − * @operating_snk_mw: | |
| 58 | − * Required operating sink power in mW | |
| 59 | − * @type: Port type (TYPEC_PORT_DFP, TYPEC_PORT_UFP, or | |
| 60 | − * TYPEC_PORT_DRP) | |
| 61 | − * @default_role: | |
| 62 | − * Default port role (TYPEC_SINK or TYPEC_SOURCE). | |
| 63 | − * Set to TYPEC_NO_PREFERRED_ROLE if no default role. | |
| 64 | − * @try_role_hw:True if try.{Src,Snk} is implemented in hardware | |
| 65 | − * @alt_modes: List of supported alternate modes | |
| 66 | − */ | |
| 67 | −struct tcpc_config { | |
| 68 | − const u32 *src_pdo; | |
| 69 | − unsigned int nr_src_pdo; | |
| 70 | − | |
| 71 | − const u32 *snk_pdo; | |
| 72 | − unsigned int nr_snk_pdo; | |
| 73 | − | |
| 74 | − const u32 *snk_vdo; | |
| 75 | − unsigned int nr_snk_vdo; | |
| 76 | − | |
| 77 | − unsigned int operating_snk_mw; | |
| 78 | − | |
| 79 | − enum typec_port_type type; | |
| 80 | − enum typec_port_data data; | |
| 81 | − enum typec_role default_role; | |
| 82 | − bool try_role_hw; /* try.{src,snk} implemented in hardware */ | |
| 83 | − bool self_powered; /* port belongs to a self powered device */ | |
| 84 | − | |
| 85 | − const struct typec_altmode_desc *alt_modes; | |
| 86 | −}; | |
| 87 | − | |
| 88 | 49 | /* Mux state attributes */ |
| 89 | 50 | #define TCPC_MUX_USB_ENABLED BIT(0) /* USB enabled */ |
| 90 | 51 | #define TCPC_MUX_DP_ENABLED BIT(1) /* DP enabled */ |
| @@ -92,7 +53,6 @@ struct tcpc_config { · 1 unmodified line | ||
| 92 | 53 | |
| 93 | 54 | /** |
| 94 | 55 | * struct tcpc_dev - Port configuration and callback functions |
| 95 | − * @config: Pointer to port configuration | |
| 96 | 56 | * @fwnode: Pointer to port fwnode |
| 97 | 57 | * @get_vbus: Called to read current VBUS state |
| 98 | 58 | * @get_current_limit: |
| @@ -121,7 +81,6 @@ struct tcpc_config { · 22 unmodified lines | ||
| 121 | 81 | * @mux: Pointer to multiplexer data |
| 122 | 82 | */ |
| 123 | 83 | struct tcpc_dev { |
| 124 | − const struct tcpc_config *config; | |
| 125 | 84 | struct fwnode_handle *fwnode; |
| 126 | 85 | |
| 127 | 86 | int (*init)(struct tcpc_dev *dev); |
| @@ -168,6 +168,23 @@ struct typec_partner_desc { · 167 unmodified lines | ||
| 168 | 168 | struct usb_pd_identity *identity; |
| 169 | 169 | }; |
| 170 | 170 | |
| 171 | +/** | |
| 172 | + * struct typec_operations - USB Type-C Port Operations | |
| 173 | + * @try_role: Set data role preference for DRP port | |
| 174 | + * @dr_set: Set Data Role | |
| 175 | + * @pr_set: Set Power Role | |
| 176 | + * @vconn_set: Source VCONN | |
| 177 | + * @port_type_set: Set port type | |
| 178 | + */ | |
| 179 | +struct typec_operations { | |
| 180 | + int (*try_role)(struct typec_port *port, int role); | |
| 181 | + int (*dr_set)(struct typec_port *port, enum typec_data_role role); | |
| 182 | + int (*pr_set)(struct typec_port *port, enum typec_role role); | |
| 183 | + int (*vconn_set)(struct typec_port *port, enum typec_role role); | |
| 184 | + int (*port_type_set)(struct typec_port *port, | |
| 185 | + enum typec_port_type type); | |
| 186 | +}; | |
| 187 | + | |
| 171 | 188 | /* |
| 172 | 189 | * struct typec_capability - USB Type-C Port Capabilities |
| 173 | 190 | * @type: Supported power role of the port |
| @@ -179,11 +196,8 @@ struct typec_partner_desc { · 5 unmodified lines | ||
| 179 | 196 | * @sw: Cable plug orientation switch |
| 180 | 197 | * @mux: Multiplexer switch for Alternate/Accessory Modes |
| 181 | 198 | * @fwnode: Optional fwnode of the port |
| 182 | − * @try_role: Set data role preference for DRP port | |
| 183 | − * @dr_set: Set Data Role | |
| 184 | − * @pr_set: Set Power Role | |
| 185 | − * @vconn_set: Set VCONN Role | |
| 186 | − * @port_type_set: Set port type | |
| 199 | + * @driver_data: Private pointer for driver specific info | |
| 200 | + * @ops: Port operations vector | |
| 187 | 201 | * |
| 188 | 202 | * Static capabilities of a single USB Type-C port. |
| 189 | 203 | */ |
| @@ -195,21 +209,10 @@ struct typec_capability { · 5 unmodified lines | ||
| 195 | 209 | int prefer_role; |
| 196 | 210 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; |
| 197 | 211 | |
| 198 | − struct typec_switch *sw; | |
| 199 | − struct typec_mux *mux; | |
| 200 | 212 | struct fwnode_handle *fwnode; |
| 213 | + void *driver_data; | |
| 201 | 214 | |
| 202 | − int (*try_role)(const struct typec_capability *, | |
| 203 | − int role); | |
| 204 | − | |
| 205 | − int (*dr_set)(const struct typec_capability *, | |
| 206 | − enum typec_data_role); | |
| 207 | − int (*pr_set)(const struct typec_capability *, | |
| 208 | − enum typec_role); | |
| 209 | − int (*vconn_set)(const struct typec_capability *, | |
| 210 | − enum typec_role); | |
| 211 | − int (*port_type_set)(const struct typec_capability *, | |
| 212 | − enum typec_port_type); | |
| 215 | + const struct typec_operations *ops; | |
| 213 | 216 | }; |
| 214 | 217 | |
| 215 | 218 | /* Specific to try_role(). Indicates the user want's to clear the preference. */ |
| @@ -241,6 +244,8 @@ int typec_set_orientation(struct typec_port *port, · 25 unmodified lines | ||
| 241 | 244 | enum typec_orientation typec_get_orientation(struct typec_port *port); |
| 242 | 245 | int typec_set_mode(struct typec_port *port, int mode); |
| 243 | 246 | |
| 247 | +void *typec_get_drvdata(struct typec_port *port); | |
| 248 | + | |
| 244 | 249 | int typec_find_port_power_role(const char *name); |
| 245 | 250 | int typec_find_power_role(const char *name); |
| 246 | 251 | int typec_find_port_data_role(const char *name); |
| @@ -7,9 +7,6 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <net/sock.h> |
| 8 | 8 | #include <net/af_vsock.h> |
| 9 | 9 | |
| 10 | −#define VIRTIO_VSOCK_DEFAULT_MIN_BUF_SIZE 128 | |
| 11 | −#define VIRTIO_VSOCK_DEFAULT_BUF_SIZE (1024 * 256) | |
| 12 | −#define VIRTIO_VSOCK_DEFAULT_MAX_BUF_SIZE (1024 * 256) | |
| 13 | 10 | #define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4) |
| 14 | 11 | #define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL |
| 15 | 12 | #define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64) |
| @@ -25,11 +22,6 @@ enum { · 9 unmodified lines | ||
| 25 | 22 | struct virtio_vsock_sock { |
| 26 | 23 | struct vsock_sock *vsk; |
| 27 | 24 | |
| 28 | − /* Protected by lock_sock(sk_vsock(trans->vsk)) */ | |
| 29 | − u32 buf_size; | |
| 30 | − u32 buf_size_min; | |
| 31 | − u32 buf_size_max; | |
| 32 | − | |
| 33 | 25 | spinlock_t tx_lock; |
| 34 | 26 | spinlock_t rx_lock; |
| 35 | 27 | |
| @@ -92,12 +84,6 @@ s64 virtio_transport_stream_has_space(struct vsock_sock *vsk); · 56 unmodified lines | ||
| 92 | 84 | |
| 93 | 85 | int virtio_transport_do_socket_init(struct vsock_sock *vsk, |
| 94 | 86 | struct vsock_sock *psk); |
| 95 | −u64 virtio_transport_get_buffer_size(struct vsock_sock *vsk); | |
| 96 | −u64 virtio_transport_get_min_buffer_size(struct vsock_sock *vsk); | |
| 97 | −u64 virtio_transport_get_max_buffer_size(struct vsock_sock *vsk); | |
| 98 | −void virtio_transport_set_buffer_size(struct vsock_sock *vsk, u64 val); | |
| 99 | −void virtio_transport_set_min_buffer_size(struct vsock_sock *vsk, u64 val); | |
| 100 | −void virtio_transport_set_max_buffer_size(struct vsock_sock *vs, u64 val); | |
| 101 | 87 | int |
| 102 | 88 | virtio_transport_notify_poll_in(struct vsock_sock *vsk, |
| 103 | 89 | size_t target, |
| @@ -124,6 +110,7 @@ int virtio_transport_notify_send_pre_enqueue(struct vsock_sock *vsk, · 20 unmodified lines | ||
| 124 | 110 | struct vsock_transport_send_notify_data *data); |
| 125 | 111 | int virtio_transport_notify_send_post_enqueue(struct vsock_sock *vsk, |
| 126 | 112 | ssize_t written, struct vsock_transport_send_notify_data *data); |
| 113 | +void virtio_transport_notify_buffer_size(struct vsock_sock *vsk, u64 *val); | |
| 127 | 114 | |
| 128 | 115 | u64 virtio_transport_stream_rcvhiwat(struct vsock_sock *vsk); |
| 129 | 116 | bool virtio_transport_stream_is_active(struct vsock_sock *vsk); |
| @@ -150,7 +137,8 @@ virtio_transport_dgram_enqueue(struct vsock_sock *vsk, · 20 unmodified lines | ||
| 150 | 137 | |
| 151 | 138 | void virtio_transport_destruct(struct vsock_sock *vsk); |
| 152 | 139 | |
| 153 | −void virtio_transport_recv_pkt(struct virtio_vsock_pkt *pkt); | |
| 140 | +void virtio_transport_recv_pkt(struct virtio_transport *t, | |
| 141 | + struct virtio_vsock_pkt *pkt); | |
| 154 | 142 | void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt); |
| 155 | 143 | void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vsock_pkt *pkt); |
| 156 | 144 | u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); |
| @@ -1,15 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | −/* | |
| 3 | − * VMware vSockets Driver | |
| 4 | − * | |
| 5 | − * Copyright (C) 2007-2013 VMware, Inc. All rights reserved. | |
| 6 | − */ | |
| 7 | − | |
| 8 | −#ifndef _VM_SOCKETS_H | |
| 9 | −#define _VM_SOCKETS_H | |
| 10 | − | |
| 11 | −#include <uapi/linux/vm_sockets.h> | |
| 12 | − | |
| 13 | −int vm_sockets_get_local_cid(void); | |
| 14 | − | |
| 15 | −#endif /* _VM_SOCKETS_H */ | |
| @@ -22,6 +22,18 @@ struct notifier_block; /* in notifier.h */ · 21 unmodified lines | ||
| 22 | 22 | #define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ |
| 23 | 23 | #define VM_NO_GUARD 0x00000040 /* don't add guard page */ |
| 24 | 24 | #define VM_KASAN 0x00000080 /* has allocated kasan shadow memory */ |
| 25 | + | |
| 26 | +/* | |
| 27 | + * VM_KASAN is used slighly differently depending on CONFIG_KASAN_VMALLOC. | |
| 28 | + * | |
| 29 | + * If IS_ENABLED(CONFIG_KASAN_VMALLOC), VM_KASAN is set on a vm_struct after | |
| 30 | + * shadow memory has been mapped. It's used to handle allocation errors so that | |
| 31 | + * we don't try to poision shadow on free if it was never allocated. | |
| 32 | + * | |
| 33 | + * Otherwise, VM_KASAN is set for kasan_module_alloc() allocations and used to | |
| 34 | + * determine which allocations need the module shadow freed. | |
| 35 | + */ | |
| 36 | + | |
| 25 | 37 | /* |
| 26 | 38 | * Memory with VM_FLUSH_RESET_PERMS cannot be freed in an interrupt or with |
| 27 | 39 | * vfree_atomic(). |
| @@ -93,6 +105,7 @@ extern void *vzalloc(unsigned long size); · 65 unmodified lines | ||
| 93 | 105 | extern void *vmalloc_user(unsigned long size); |
| 94 | 106 | extern void *vmalloc_node(unsigned long size, int node); |
| 95 | 107 | extern void *vzalloc_node(unsigned long size, int node); |
| 108 | +extern void *vmalloc_user_node_flags(unsigned long size, int node, gfp_t flags); | |
| 96 | 109 | extern void *vmalloc_exec(unsigned long size); |
| 97 | 110 | extern void *vmalloc_32(unsigned long size); |
| 98 | 111 | extern void *vmalloc_32_user(unsigned long size); |
| @@ -31,6 +31,12 @@ struct reclaim_stat { · 30 unmodified lines | ||
| 31 | 31 | unsigned nr_unmap_fail; |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | +enum writeback_stat_item { | |
| 35 | + NR_DIRTY_THRESHOLD, | |
| 36 | + NR_DIRTY_BG_THRESHOLD, | |
| 37 | + NR_VM_WRITEBACK_STAT_ITEMS, | |
| 38 | +}; | |
| 39 | + | |
| 34 | 40 | #ifdef CONFIG_VM_EVENT_COUNTERS |
| 35 | 41 | /* |
| 36 | 42 | * Light weight per cpu counter implementation. |
| @@ -381,4 +387,48 @@ static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages, · 344 unmodified lines | ||
| 381 | 387 | |
| 382 | 388 | extern const char * const vmstat_text[]; |
| 383 | 389 | |
| 390 | +static inline const char *zone_stat_name(enum zone_stat_item item) | |
| 391 | +{ | |
| 392 | + return vmstat_text[item]; | |
| 393 | +} | |
| 394 | + | |
| 395 | +#ifdef CONFIG_NUMA | |
| 396 | +static inline const char *numa_stat_name(enum numa_stat_item item) | |
| 397 | +{ | |
| 398 | + return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | |
| 399 | + item]; | |
| 400 | +} | |
| 401 | +#endif /* CONFIG_NUMA */ | |
| 402 | + | |
| 403 | +static inline const char *node_stat_name(enum node_stat_item item) | |
| 404 | +{ | |
| 405 | + return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | |
| 406 | + NR_VM_NUMA_STAT_ITEMS + | |
| 407 | + item]; | |
| 408 | +} | |
| 409 | + | |
| 410 | +static inline const char *lru_list_name(enum lru_list lru) | |
| 411 | +{ | |
| 412 | + return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | |
| 413 | +} | |
| 414 | + | |
| 415 | +static inline const char *writeback_stat_name(enum writeback_stat_item item) | |
| 416 | +{ | |
| 417 | + return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | |
| 418 | + NR_VM_NUMA_STAT_ITEMS + | |
| 419 | + NR_VM_NODE_STAT_ITEMS + | |
| 420 | + item]; | |
| 421 | +} | |
| 422 | + | |
| 423 | +#if defined(CONFIG_VM_EVENT_COUNTERS) || defined(CONFIG_MEMCG) | |
| 424 | +static inline const char *vm_event_name(enum vm_event_item item) | |
| 425 | +{ | |
| 426 | + return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | |
| 427 | + NR_VM_NUMA_STAT_ITEMS + | |
| 428 | + NR_VM_NODE_STAT_ITEMS + | |
| 429 | + NR_VM_WRITEBACK_STAT_ITEMS + | |
| 430 | + item]; | |
| 431 | +} | |
| 432 | +#endif /* CONFIG_VM_EVENT_COUNTERS || CONFIG_MEMCG */ | |
| 433 | + | |
| 384 | 434 | #endif /* _LINUX_VMSTAT_H */ |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | struct msghdr; |
| 20 | 20 | typedef void (vmci_device_shutdown_fn) (void *device_registration, |
| 21 | 21 | void *user_data); |
| 22 | +typedef void (*vmci_vsock_cb) (bool is_host); | |
| 22 | 23 | |
| 23 | 24 | int vmci_datagram_create_handle(u32 resource_id, u32 flags, |
| 24 | 25 | vmci_datagram_recv_cb recv_cb, |
| @@ -37,6 +38,7 @@ int vmci_doorbell_destroy(struct vmci_handle handle); · 12 unmodified lines | ||
| 37 | 38 | int vmci_doorbell_notify(struct vmci_handle handle, u32 priv_flags); |
| 38 | 39 | u32 vmci_get_context_id(void); |
| 39 | 40 | bool vmci_is_context_owner(u32 context_id, kuid_t uid); |
| 41 | +int vmci_register_vsock_callback(vmci_vsock_cb callback); | |
| 40 | 42 | |
| 41 | 43 | int vmci_event_subscribe(u32 event, |
| 42 | 44 | vmci_event_cb callback, void *callback_data, |
| @@ -11,11 +11,15 @@ · 10 unmodified lines | ||
| 11 | 11 | struct task_struct; |
| 12 | 12 | |
| 13 | 13 | /* |
| 14 | − * vtime_accounting_cpu_enabled() definitions/declarations | |
| 14 | + * vtime_accounting_enabled_this_cpu() definitions/declarations | |
| 15 | 15 | */ |
| 16 | 16 | #if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) |
| 17 | −static inline bool vtime_accounting_cpu_enabled(void) { return true; } | |
| 17 | + | |
| 18 | +static inline bool vtime_accounting_enabled_this_cpu(void) { return true; } | |
| 19 | +extern void vtime_task_switch(struct task_struct *prev); | |
| 20 | + | |
| 18 | 21 | #elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN) |
| 22 | + | |
| 19 | 23 | /* |
| 20 | 24 | * Checks if vtime is enabled on some CPU. Cputime readers want to be careful |
| 21 | 25 | * in that case and compute the tickless cputime. |
| @@ -24,46 +28,43 @@ static inline bool vtime_accounting_cpu_enabled(void) { return true; } · 2 unmodified lines | ||
| 24 | 28 | */ |
| 25 | 29 | static inline bool vtime_accounting_enabled(void) |
| 26 | 30 | { |
| 27 | − return context_tracking_is_enabled(); | |
| 31 | + return context_tracking_enabled(); | |
| 28 | 32 | } |
| 29 | 33 | |
| 30 | −static inline bool vtime_accounting_cpu_enabled(void) | |
| 34 | +static inline bool vtime_accounting_enabled_cpu(int cpu) | |
| 31 | 35 | { |
| 32 | − if (vtime_accounting_enabled()) { | |
| 33 | − if (context_tracking_cpu_is_enabled()) | |
| 34 | − return true; | |
| 35 | − } | |
| 36 | − | |
| 37 | − return false; | |
| 36 | + return context_tracking_enabled_cpu(cpu); | |
| 38 | 37 | } |
| 39 | −#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ | |
| 40 | −static inline bool vtime_accounting_cpu_enabled(void) { return false; } | |
| 41 | −#endif | |
| 42 | 38 | |
| 39 | +static inline bool vtime_accounting_enabled_this_cpu(void) | |
| 40 | +{ | |
| 41 | + return context_tracking_enabled_this_cpu(); | |
| 42 | +} | |
| 43 | 43 | |
| 44 | −/* | |
| 45 | − * Common vtime APIs | |
| 46 | − */ | |
| 47 | −#ifdef CONFIG_VIRT_CPU_ACCOUNTING | |
| 44 | +extern void vtime_task_switch_generic(struct task_struct *prev); | |
| 48 | 45 | |
| 49 | −#ifdef __ARCH_HAS_VTIME_TASK_SWITCH | |
| 50 | −extern void vtime_task_switch(struct task_struct *prev); | |
| 51 | −#else | |
| 52 | −extern void vtime_common_task_switch(struct task_struct *prev); | |
| 53 | 46 | static inline void vtime_task_switch(struct task_struct *prev) |
| 54 | 47 | { |
| 55 | − if (vtime_accounting_cpu_enabled()) | |
| 56 | − vtime_common_task_switch(prev); | |
| 48 | + if (vtime_accounting_enabled_this_cpu()) | |
| 49 | + vtime_task_switch_generic(prev); | |
| 57 | 50 | } |
| 58 | −#endif /* __ARCH_HAS_VTIME_TASK_SWITCH */ | |
| 59 | − | |
| 60 | −extern void vtime_account_system(struct task_struct *tsk); | |
| 61 | −extern void vtime_account_idle(struct task_struct *tsk); | |
| 62 | 51 | |
| 63 | 52 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
| 64 | 53 | |
| 54 | +static inline bool vtime_accounting_enabled_cpu(int cpu) {return false; } | |
| 55 | +static inline bool vtime_accounting_enabled_this_cpu(void) { return false; } | |
| 65 | 56 | static inline void vtime_task_switch(struct task_struct *prev) { } |
| 66 | −static inline void vtime_account_system(struct task_struct *tsk) { } | |
| 57 | + | |
| 58 | +#endif | |
| 59 | + | |
| 60 | +/* | |
| 61 | + * Common vtime APIs | |
| 62 | + */ | |
| 63 | +#ifdef CONFIG_VIRT_CPU_ACCOUNTING | |
| 64 | +extern void vtime_account_kernel(struct task_struct *tsk); | |
| 65 | +extern void vtime_account_idle(struct task_struct *tsk); | |
| 66 | +#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ | |
| 67 | +static inline void vtime_account_kernel(struct task_struct *tsk) { } | |
| 67 | 68 | #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
| 68 | 69 | |
| 69 | 70 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN |
| @@ -86,7 +87,7 @@ extern void vtime_account_irq_enter(struct task_struct *tsk); · 16 unmodified lines | ||
| 86 | 87 | static inline void vtime_account_irq_exit(struct task_struct *tsk) |
| 87 | 88 | { |
| 88 | 89 | /* On hard|softirq exit we always account to hard|softirq cputime */ |
| 89 | − vtime_account_system(tsk); | |
| 90 | + vtime_account_kernel(tsk); | |
| 90 | 91 | } |
| 91 | 92 | extern void vtime_flush(struct task_struct *tsk); |
| 92 | 93 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ |
| @@ -262,6 +262,7 @@ struct w1_family_ops { · 261 unmodified lines | ||
| 262 | 262 | * @family_entry: family linked list |
| 263 | 263 | * @fid: 8 bit family identifier |
| 264 | 264 | * @fops: operations for this family |
| 265 | + * @of_match_table: open firmware match table | |
| 265 | 266 | * @refcnt: reference counter |
| 266 | 267 | */ |
| 267 | 268 | struct w1_family { |
| @@ -201,9 +201,10 @@ void __wake_up(struct wait_queue_head *wq_head, unsigned int mode, int nr, void · 200 unmodified lines | ||
| 201 | 201 | void __wake_up_locked_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); |
| 202 | 202 | void __wake_up_locked_key_bookmark(struct wait_queue_head *wq_head, |
| 203 | 203 | unsigned int mode, void *key, wait_queue_entry_t *bookmark); |
| 204 | −void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode, int nr, void *key); | |
| 204 | +void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); | |
| 205 | +void __wake_up_locked_sync_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); | |
| 205 | 206 | void __wake_up_locked(struct wait_queue_head *wq_head, unsigned int mode, int nr); |
| 206 | −void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr); | |
| 207 | +void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode); | |
| 207 | 208 | |
| 208 | 209 | #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) |
| 209 | 210 | #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) |
| @@ -214,7 +215,7 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr); · 4 unmodified lines | ||
| 214 | 215 | #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) |
| 215 | 216 | #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) |
| 216 | 217 | #define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) |
| 217 | −#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) | |
| 218 | +#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE) | |
| 218 | 219 | |
| 219 | 220 | /* |
| 220 | 221 | * Wakeup macros to be used to report events to the targets. |
| @@ -228,7 +229,9 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr); · 7 unmodified lines | ||
| 228 | 229 | #define wake_up_interruptible_poll(x, m) \ |
| 229 | 230 | __wake_up(x, TASK_INTERRUPTIBLE, 1, poll_to_key(m)) |
| 230 | 231 | #define wake_up_interruptible_sync_poll(x, m) \ |
| 231 | − __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, poll_to_key(m)) | |
| 232 | + __wake_up_sync_key((x), TASK_INTERRUPTIBLE, poll_to_key(m)) | |
| 233 | +#define wake_up_interruptible_sync_poll_locked(x, m) \ | |
| 234 | + __wake_up_locked_sync_key((x), TASK_INTERRUPTIBLE, poll_to_key(m)) | |
| 232 | 235 | |
| 233 | 236 | #define ___wait_cond_timeout(condition) \ |
| 234 | 237 | ({ \ |
| @@ -182,7 +182,7 @@ static inline void ww_acquire_done(struct ww_acquire_ctx *ctx) · 181 unmodified lines | ||
| 182 | 182 | static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx) |
| 183 | 183 | { |
| 184 | 184 | #ifdef CONFIG_DEBUG_MUTEXES |
| 185 | − mutex_release(&ctx->dep_map, 0, _THIS_IP_); | |
| 185 | + mutex_release(&ctx->dep_map, _THIS_IP_); | |
| 186 | 186 | |
| 187 | 187 | DEBUG_LOCKS_WARN_ON(ctx->acquired); |
| 188 | 188 | if (!IS_ENABLED(CONFIG_PROVE_LOCKING)) |