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 | return false; | 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 | static inline struct acpi_device * | 689 | static inline struct acpi_device * |
| 682 | acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) | 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 | int pci_disable_pcie_error_reporting(struct pci_dev *dev); | 46 | int pci_disable_pcie_error_reporting(struct pci_dev *dev); |
| 47 | int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); | 47 | int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); |
| 48 | int pci_cleanup_aer_error_status_regs(struct pci_dev *dev); | 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 | #else | 51 | #else |
| 50 | static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) | 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 | return -EINVAL; | 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 | #endif | 70 | #endif |
| 67 | 71 | ||
| 68 | void cper_print_aer(struct pci_dev *dev, int aer_severity, | 72 | void cper_print_aer(struct pci_dev *dev, int aer_severity, |
| @@ -30,8 +30,6 @@ · 29 unmodified lines | |||
| 30 | #include <linux/agp_backend.h> | 30 | #include <linux/agp_backend.h> |
| 31 | #include <uapi/linux/agpgart.h> | 31 | #include <uapi/linux/agpgart.h> |
| 32 | 32 | ||
| 33 | #define AGPGART_MINOR 175 | ||
| 34 | |||
| 35 | struct agp_info { | 33 | struct agp_info { |
| 36 | struct agp_version version; /* version of the driver */ | 34 | struct agp_version version; /* version of the driver */ |
| 37 | u32 bridge_id; /* bridge vendor/device */ | 35 | u32 bridge_id; /* bridge vendor/device */ |
| @@ -19,6 +19,8 @@ struct ahci_host_priv; · 18 unmodified lines | |||
| 19 | struct platform_device; | 19 | struct platform_device; |
| 20 | struct scsi_host_template; | 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 | int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); | 24 | int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); |
| 23 | void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); | 25 | void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); |
| 24 | int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv); | 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 | void update_siblings_masks(unsigned int cpu); | 57 | void update_siblings_masks(unsigned int cpu); |
| 58 | void remove_cpu_topology(unsigned int cpuid); | 58 | void remove_cpu_topology(unsigned int cpuid); |
| 59 | void reset_cpu_topology(void); | 59 | void reset_cpu_topology(void); |
| 60 | int parse_acpi_topology(void); | ||
| 60 | #endif | 61 | #endif |
| 61 | 62 | ||
| 62 | #endif /* _LINUX_ARCH_TOPOLOGY_H_ */ | 63 | #endif /* _LINUX_ARCH_TOPOLOGY_H_ */ |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | |||
| 45 | #define ARM_SMCCC_OWNER_SIP 2 | 45 | #define ARM_SMCCC_OWNER_SIP 2 |
| 46 | #define ARM_SMCCC_OWNER_OEM 3 | 46 | #define ARM_SMCCC_OWNER_OEM 3 |
| 47 | #define ARM_SMCCC_OWNER_STANDARD 4 | 47 | #define ARM_SMCCC_OWNER_STANDARD 4 |
| 48 | #define ARM_SMCCC_OWNER_STANDARD_HYP 5 | ||
| 48 | #define ARM_SMCCC_OWNER_TRUSTED_APP 48 | 49 | #define ARM_SMCCC_OWNER_TRUSTED_APP 48 |
| 49 | #define ARM_SMCCC_OWNER_TRUSTED_APP_END 49 | 50 | #define ARM_SMCCC_OWNER_TRUSTED_APP_END 49 |
| 50 | #define ARM_SMCCC_OWNER_TRUSTED_OS 50 | 51 | #define ARM_SMCCC_OWNER_TRUSTED_OS 50 |
| @@ -80,6 +81,22 @@ · 29 unmodified lines | |||
| 80 | 81 | ||
| 81 | #include <linux/linkage.h> | 82 | #include <linux/linkage.h> |
| 82 | #include <linux/types.h> | 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 | * struct arm_smccc_res - Result from SMC/HVC call | 101 | * struct arm_smccc_res - Result from SMC/HVC call |
| 85 | * @a0-a3 result values from registers 0 to 3 | 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 | #define SMCCC_RET_NOT_SUPPORTED -1 | 319 | #define SMCCC_RET_NOT_SUPPORTED -1 |
| 303 | #define SMCCC_RET_NOT_REQUIRED -2 | 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 | #endif /*__ASSEMBLY__*/ | 380 | #endif /*__ASSEMBLY__*/ |
| 306 | #endif /*__LINUX_ARM_SMCCC_H*/ | 381 | #endif /*__LINUX_ARM_SMCCC_H*/ |
| @@ -5,12 +5,6 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | #include <uapi/linux/arm_sdei.h> | 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 | #include <acpi/ghes.h> | 8 | #include <acpi/ghes.h> |
| 15 | 9 | ||
| 16 | #ifdef CONFIG_ARM_SDE_INTERFACE | 10 | #ifdef CONFIG_ARM_SDE_INTERFACE |
| @@ -156,7 +156,8 @@ extern void audit_log_d_path(struct audit_buffer *ab, · 155 unmodified lines | |||
| 156 | const struct path *path); | 156 | const struct path *path); |
| 157 | extern void audit_log_key(struct audit_buffer *ab, | 157 | extern void audit_log_key(struct audit_buffer *ab, |
| 158 | char *key); | 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 | extern void audit_log_lost(const char *message); | 161 | extern void audit_log_lost(const char *message); |
| 161 | 162 | ||
| 162 | extern int audit_log_task_context(struct audit_buffer *ab); | 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 | static inline void audit_log_key(struct audit_buffer *ab, char *key) | 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 | static inline int audit_log_task_context(struct audit_buffer *ab) | 223 | static inline int audit_log_task_context(struct audit_buffer *ab) |
| 223 | { | 224 | { |
| @@ -53,6 +53,7 @@ · 52 unmodified lines | |||
| 53 | * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above | 53 | * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above |
| 54 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n | 54 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n |
| 55 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n | 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 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) | 57 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) |
| 57 | * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) | 58 | * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) |
| 58 | * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap | 59 | * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap |
| @@ -66,6 +67,8 @@ · 7 unmodified lines | |||
| 66 | * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region | 67 | * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region |
| 67 | * bitmap_from_arr32(dst, buf, nbits) Copy nbits from u32[] buf to dst | 68 | * bitmap_from_arr32(dst, buf, nbits) Copy nbits from u32[] buf to dst |
| 68 | * bitmap_to_arr32(buf, src, nbits) Copy nbits from buf to u32[] dst | 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 | * Note, bitmap_zero() and bitmap_fill() operate over the region of | 73 | * Note, bitmap_zero() and bitmap_fill() operate over the region of |
| 71 | * unsigned longs, that is, bits behind bitmap till the unsigned long | 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 | const unsigned long *bitmap2, unsigned int nbits); | 141 | const unsigned long *bitmap2, unsigned int nbits); |
| 139 | extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, | 142 | extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, |
| 140 | const unsigned long *bitmap2, unsigned int nbits); | 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 | extern int __bitmap_intersects(const unsigned long *bitmap1, | 147 | extern int __bitmap_intersects(const unsigned long *bitmap1, |
| 142 | const unsigned long *bitmap2, unsigned int nbits); | 148 | const unsigned long *bitmap2, unsigned int nbits); |
| 143 | extern int __bitmap_subset(const unsigned long *bitmap1, | 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 | __bitmap_shift_left(dst, src, shift, nbits); | 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 | static inline int bitmap_parse(const char *buf, unsigned int buflen, | 453 | static inline int bitmap_parse(const char *buf, unsigned int buflen, |
| 436 | unsigned long *maskp, int nmaskbits) | 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 | dst[1] = mask >> 32; | 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 | #endif /* __ASSEMBLY__ */ | 543 | #endif /* __ASSEMBLY__ */ |
| 493 | 544 | ||
| 494 | #endif /* __LINUX_BITMAP_H */ | 545 | #endif /* __LINUX_BITMAP_H */ |
| @@ -47,6 +47,18 @@ extern unsigned long __sw_hweight64(__u64 w); · 46 unmodified lines | |||
| 47 | (bit) < (size); \ | 47 | (bit) < (size); \ |
| 48 | (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) | 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 | static inline int get_bitmask_order(unsigned int count) | 62 | static inline int get_bitmask_order(unsigned int count) |
| 51 | { | 63 | { |
| 52 | int order; | 64 | int order; |
| @@ -15,7 +15,9 @@ · 14 unmodified lines | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <linux/cgroup.h> | 17 | #include <linux/cgroup.h> |
| 18 | #include <linux/percpu.h> | ||
| 18 | #include <linux/percpu_counter.h> | 19 | #include <linux/percpu_counter.h> |
| 20 | #include <linux/u64_stats_sync.h> | ||
| 19 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
| 20 | #include <linux/radix-tree.h> | 22 | #include <linux/radix-tree.h> |
| 21 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
| @@ -31,15 +33,12 @@ · 9 unmodified lines | |||
| 31 | 33 | ||
| 32 | #ifdef CONFIG_BLK_CGROUP | 34 | #ifdef CONFIG_BLK_CGROUP |
| 33 | 35 | ||
| 34 | enum blkg_rwstat_type { | 36 | enum blkg_iostat_type { |
| 35 | BLKG_RWSTAT_READ, | 37 | BLKG_IOSTAT_READ, |
| 36 | BLKG_RWSTAT_WRITE, | 38 | BLKG_IOSTAT_WRITE, |
| 37 | BLKG_RWSTAT_SYNC, | 39 | BLKG_IOSTAT_DISCARD, |
| 38 | BLKG_RWSTAT_ASYNC, | ||
| 39 | BLKG_RWSTAT_DISCARD, | ||
| 40 | 40 | ||
| 41 | BLKG_RWSTAT_NR, | 41 | BLKG_IOSTAT_NR, |
| 42 | BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR, | ||
| 43 | }; | 42 | }; |
| 44 | 43 | ||
| 45 | struct blkcg_gq; | 44 | struct blkcg_gq; |
| @@ -61,17 +60,15 @@ struct blkcg { · 15 unmodified lines | |||
| 61 | #endif | 60 | #endif |
| 62 | }; | 61 | }; |
| 63 | 62 | ||
| 64 | /* | 63 | struct blkg_iostat { |
| 65 | * blkg_[rw]stat->aux_cnt is excluded for local stats but included for | 64 | u64 bytes[BLKG_IOSTAT_NR]; |
| 66 | * recursive. Used to carry stats of dead children. | 65 | u64 ios[BLKG_IOSTAT_NR]; |
| 67 | */ | ||
| 68 | struct blkg_rwstat { | ||
| 69 | struct percpu_counter cpu_cnt[BLKG_RWSTAT_NR]; | ||
| 70 | atomic64_t aux_cnt[BLKG_RWSTAT_NR]; | ||
| 71 | }; | 66 | }; |
| 72 | 67 | ||
| 73 | struct blkg_rwstat_sample { | 68 | struct blkg_iostat_set { |
| 74 | u64 cnt[BLKG_RWSTAT_NR]; | 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 | /* is this blkg online? protected by both blkcg and q locks */ | 124 | /* is this blkg online? protected by both blkcg and q locks */ |
| 128 | bool online; | 125 | bool online; |
| 129 | 126 | ||
| 130 | struct blkg_rwstat stat_bytes; | 127 | struct blkg_iostat_set __percpu *iostat_cpu; |
| 131 | struct blkg_rwstat stat_ios; | 128 | struct blkg_iostat_set iostat; |
| 132 | 129 | ||
| 133 | struct blkg_policy_data *pd[BLKCG_MAX_POLS]; | 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 | struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, | 188 | struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, |
| 192 | struct request_queue *q); | 189 | struct request_queue *q); |
| 193 | int blkcg_init_queue(struct request_queue *q); | 190 | int blkcg_init_queue(struct request_queue *q); |
| 194 | void blkcg_drain_queue(struct request_queue *q); | ||
| 195 | void blkcg_exit_queue(struct request_queue *q); | 191 | void blkcg_exit_queue(struct request_queue *q); |
| 196 | 192 | ||
| 197 | /* Blkio controller policy registration */ | 193 | /* Blkio controller policy registration */ |
| @@ -202,13 +198,6 @@ int blkcg_activate_policy(struct request_queue *q, · 4 unmodified lines | |||
| 202 | void blkcg_deactivate_policy(struct request_queue *q, | 198 | void blkcg_deactivate_policy(struct request_queue *q, |
| 203 | const struct blkcg_policy *pol); | 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 | const char *blkg_dev_name(struct blkcg_gq *blkg); | 201 | const char *blkg_dev_name(struct blkcg_gq *blkg); |
| 213 | void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, | 202 | void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, |
| 214 | u64 (*prfill)(struct seq_file *, | 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 | const struct blkcg_policy *pol, int data, | 205 | const struct blkcg_policy *pol, int data, |
| 217 | bool show_total); | 206 | bool show_total); |
| 218 | u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v); | 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 | struct blkg_conf_ctx { | 209 | struct blkg_conf_ctx { |
| 232 | struct gendisk *disk; | 210 | struct gendisk *disk; |
| @@ -578,128 +556,6 @@ static inline void blkg_put(struct blkcg_gq *blkg) · 345 unmodified lines | |||
| 578 | if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \ | 556 | if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \ |
| 579 | (p_blkg)->q, false))) | 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 | #ifdef CONFIG_BLK_DEV_THROTTLING | 559 | #ifdef CONFIG_BLK_DEV_THROTTLING |
| 704 | extern bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, | 560 | extern bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, |
| 705 | struct bio *bio); | 561 | struct bio *bio); |
| @@ -745,15 +601,33 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, · 39 unmodified lines | |||
| 745 | throtl = blk_throtl_bio(q, blkg, bio); | 601 | throtl = blk_throtl_bio(q, blkg, bio); |
| 746 | 602 | ||
| 747 | if (!throtl) { | 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 | * If the bio is flagged with BIO_QUEUE_ENTERED it means this | 619 | * If the bio is flagged with BIO_QUEUE_ENTERED it means this |
| 750 | * is a split bio and we would have already accounted for the | 620 | * is a split bio and we would have already accounted for the |
| 751 | * size of the bio. | 621 | * size of the bio. |
| 752 | */ | 622 | */ |
| 753 | if (!bio_flagged(bio, BIO_QUEUE_ENTERED)) | 623 | if (!bio_flagged(bio, BIO_QUEUE_ENTERED)) |
| 754 | blkg_rwstat_add(&blkg->stat_bytes, bio->bi_opf, | 624 | bis->cur.bytes[rwd] += bio->bi_iter.bi_size; |
| 755 | bio->bi_iter.bi_size); | 625 | bis->cur.ios[rwd]++; |
| 756 | blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1); | 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 | blkcg_bio_issue_init(bio); | 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 | static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q) | 719 | static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q) |
| 846 | { return NULL; } | 720 | { return NULL; } |
| 847 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } | 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 | static inline void blkcg_exit_queue(struct request_queue *q) { } | 722 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
| 850 | static inline int blkcg_policy_register(struct blkcg_policy *pol) { return 0; } | 723 | static inline int blkcg_policy_register(struct blkcg_policy *pol) { return 0; } |
| 851 | static inline void blkcg_policy_unregister(struct blkcg_policy *pol) { } | 724 | static inline void blkcg_policy_unregister(struct blkcg_policy *pol) { } |
| @@ -10,103 +10,239 @@ struct blk_mq_tags; · 9 unmodified lines | |||
| 10 | struct blk_flush_queue; | 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 | struct blk_mq_hw_ctx { | 16 | struct blk_mq_hw_ctx { |
| 16 | struct { | 17 | struct { |
| 18 | /** @lock: Protects the dispatch list. */ | ||
| 17 | spinlock_t lock; | 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 | struct list_head dispatch; | 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 | } ____cacheline_aligned_in_smp; | 33 | } ____cacheline_aligned_in_smp; |
| 21 | 34 | ||
| 35 | /** | ||
| 36 | * @run_work: Used for scheduling a hardware queue run at a later time. | ||
| 37 | */ | ||
| 22 | struct delayed_work run_work; | 38 | struct delayed_work run_work; |
| 39 | /** @cpumask: Map of available CPUs where this hctx can run. */ | ||
| 23 | cpumask_var_t cpumask; | 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 | int next_cpu; | 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 | int next_cpu_batch; | 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 | void *sched_data; | 59 | void *sched_data; |
| 60 | /** | ||
| 61 | * @queue: Pointer to the request queue that owns this hardware context. | ||
| 62 | */ | ||
| 30 | struct request_queue *queue; | 63 | struct request_queue *queue; |
| 64 | /** @fq: Queue of requests that need to perform a flush operation. */ | ||
| 31 | struct blk_flush_queue *fq; | 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 | void *driver_data; | 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 | struct sbitmap ctx_map; | 77 | struct sbitmap ctx_map; |
| 36 | 78 | ||
| 79 | /** | ||
| 80 | * @dispatch_from: Software queue to be used when no scheduler was | ||
| 81 | * selected. | ||
| 82 | */ | ||
| 37 | struct blk_mq_ctx *dispatch_from; | 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 | unsigned int dispatch_busy; | 89 | unsigned int dispatch_busy; |
| 39 | 90 | ||
| 91 | /** @type: HCTX_TYPE_* flags. Type of hardware queue. */ | ||
| 40 | unsigned short type; | 92 | unsigned short type; |
| 93 | /** @nr_ctx: Number of software queues. */ | ||
| 41 | unsigned short nr_ctx; | 94 | unsigned short nr_ctx; |
| 95 | /** @ctxs: Array of software queues. */ | ||
| 42 | struct blk_mq_ctx **ctxs; | 96 | struct blk_mq_ctx **ctxs; |
| 43 | 97 | ||
| 98 | /** @dispatch_wait_lock: Lock for dispatch_wait queue. */ | ||
| 44 | spinlock_t dispatch_wait_lock; | 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 | wait_queue_entry_t dispatch_wait; | 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 | atomic_t wait_index; | 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 | struct blk_mq_tags *tags; | 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 | struct blk_mq_tags *sched_tags; | 122 | struct blk_mq_tags *sched_tags; |
| 50 | 123 | ||
| 124 | /** @queued: Number of queued requests. */ | ||
| 51 | unsigned long queued; | 125 | unsigned long queued; |
| 126 | /** @run: Number of dispatched requests. */ | ||
| 52 | unsigned long run; | 127 | unsigned long run; |
| 53 | #define BLK_MQ_MAX_DISPATCH_ORDER 7 | 128 | #define BLK_MQ_MAX_DISPATCH_ORDER 7 |
| 129 | /** @dispatched: Number of dispatch requests by queue. */ | ||
| 54 | unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER]; | 130 | unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER]; |
| 55 | 131 | ||
| 132 | /** @numa_node: NUMA node the storage adapter has been connected to. */ | ||
| 56 | unsigned int numa_node; | 133 | unsigned int numa_node; |
| 134 | /** @queue_num: Index of this hardware queue. */ | ||
| 57 | unsigned int queue_num; | 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 | atomic_t nr_active; | 141 | atomic_t nr_active; |
| 60 | 142 | ||
| 143 | /** @cpuhp_dead: List to store request if some CPU die. */ | ||
| 61 | struct hlist_node cpuhp_dead; | 144 | struct hlist_node cpuhp_dead; |
| 145 | /** @kobj: Kernel object for sysfs. */ | ||
| 62 | struct kobject kobj; | 146 | struct kobject kobj; |
| 63 | 147 | ||
| 148 | /** @poll_considered: Count times blk_poll() was called. */ | ||
| 64 | unsigned long poll_considered; | 149 | unsigned long poll_considered; |
| 150 | /** @poll_invoked: Count how many requests blk_poll() polled. */ | ||
| 65 | unsigned long poll_invoked; | 151 | unsigned long poll_invoked; |
| 152 | /** @poll_success: Count how many polled requests were completed. */ | ||
| 66 | unsigned long poll_success; | 153 | unsigned long poll_success; |
| 67 | 154 | ||
| 68 | #ifdef CONFIG_BLK_DEBUG_FS | 155 | #ifdef CONFIG_BLK_DEBUG_FS |
| 156 | /** | ||
| 157 | * @debugfs_dir: debugfs directory for this hardware queue. Named | ||
| 158 | * as cpu<cpu_number>. | ||
| 159 | */ | ||
| 69 | struct dentry *debugfs_dir; | 160 | struct dentry *debugfs_dir; |
| 161 | /** @sched_debugfs_dir: debugfs directory for the scheduler. */ | ||
| 70 | struct dentry *sched_debugfs_dir; | 162 | struct dentry *sched_debugfs_dir; |
| 71 | #endif | 163 | #endif |
| 72 | 164 | ||
| 165 | /** @hctx_list: List of all hardware queues. */ | ||
| 73 | struct list_head hctx_list; | 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 | struct srcu_struct srcu[0]; | 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 | struct blk_mq_queue_map { | 186 | struct blk_mq_queue_map { |
| 80 | unsigned int *mq_map; | 187 | unsigned int *mq_map; |
| 81 | unsigned int nr_queues; | 188 | unsigned int nr_queues; |
| 82 | unsigned int queue_offset; | 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 | enum hctx_type { | 199 | enum hctx_type { |
| 86 | HCTX_TYPE_DEFAULT, /* all I/O not otherwise accounted for */ | 200 | HCTX_TYPE_DEFAULT, |
| 87 | HCTX_TYPE_READ, /* just for READ I/O */ | 201 | HCTX_TYPE_READ, |
| 88 | HCTX_TYPE_POLL, /* polled I/O of any kind */ | 202 | HCTX_TYPE_POLL, |
| 89 | 203 | ||
| 90 | HCTX_MAX_TYPES, | 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 | struct blk_mq_tag_set { | 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 | struct blk_mq_queue_map map[HCTX_MAX_TYPES]; | 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 | const struct blk_mq_ops *ops; | 238 | const struct blk_mq_ops *ops; |
| 103 | unsigned int nr_hw_queues; /* nr hw queues across maps */ | 239 | unsigned int nr_hw_queues; |
| 104 | unsigned int queue_depth; /* max hw supported */ | 240 | unsigned int queue_depth; |
| 105 | unsigned int reserved_tags; | 241 | unsigned int reserved_tags; |
| 106 | unsigned int cmd_size; /* per-request extra data */ | 242 | unsigned int cmd_size; |
| 107 | int numa_node; | 243 | int numa_node; |
| 108 | unsigned int timeout; | 244 | unsigned int timeout; |
| 109 | unsigned int flags; /* BLK_MQ_F_* */ | 245 | unsigned int flags; |
| 110 | void *driver_data; | 246 | void *driver_data; |
| 111 | 247 | ||
| 112 | struct blk_mq_tags **tags; | 248 | struct blk_mq_tags **tags; |
| @@ -115,6 +251,12 @@ struct blk_mq_tag_set { · 2 unmodified lines | |||
| 115 | struct list_head tag_list; | 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 | struct blk_mq_queue_data { | 260 | struct blk_mq_queue_data { |
| 119 | struct request *rq; | 261 | struct request *rq; |
| 120 | bool last; | 262 | bool last; |
| @@ -142,81 +284,101 @@ typedef bool (busy_fn)(struct request_queue *); · 21 unmodified lines | |||
| 142 | typedef void (complete_fn)(struct request *); | 284 | typedef void (complete_fn)(struct request *); |
| 143 | typedef void (cleanup_rq_fn)(struct request *); | 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 | struct blk_mq_ops { | 291 | struct blk_mq_ops { |
| 147 | /* | 292 | /** |
| 148 | * Queue request | 293 | * @queue_rq: Queue a new request from block IO. |
| 149 | */ | 294 | */ |
| 150 | queue_rq_fn *queue_rq; | 295 | queue_rq_fn *queue_rq; |
| 151 | 296 | ||
| 152 | /* | 297 | /** |
| 153 | * If a driver uses bd->last to judge when to submit requests to | 298 | * @commit_rqs: If a driver uses bd->last to judge when to submit |
| 154 | * hardware, it must define this function. In case of errors that | 299 | * requests to hardware, it must define this function. In case of errors |
| 155 | * make us stop issuing further requests, this hook serves the | 300 | * that make us stop issuing further requests, this hook serves the |
| 156 | * purpose of kicking the hardware (which the last request otherwise | 301 | * purpose of kicking the hardware (which the last request otherwise |
| 157 | * would have done). | 302 | * would have done). |
| 158 | */ | 303 | */ |
| 159 | commit_rqs_fn *commit_rqs; | 304 | commit_rqs_fn *commit_rqs; |
| 160 | 305 | ||
| 161 | /* | 306 | /** |
| 162 | * Reserve budget before queue request, once .queue_rq is | 307 | * @get_budget: Reserve budget before queue request, once .queue_rq is |
| 163 | * run, it is driver's responsibility to release the | 308 | * run, it is driver's responsibility to release the |
| 164 | * reserved budget. Also we have to handle failure case | 309 | * reserved budget. Also we have to handle failure case |
| 165 | * of .get_budget for avoiding I/O deadlock. | 310 | * of .get_budget for avoiding I/O deadlock. |
| 166 | */ | 311 | */ |
| 167 | get_budget_fn *get_budget; | 312 | get_budget_fn *get_budget; |
| 313 | /** | ||
| 314 | * @put_budget: Release the reserved budget. | ||
| 315 | */ | ||
| 168 | put_budget_fn *put_budget; | 316 | put_budget_fn *put_budget; |
| 169 | 317 | ||
| 170 | /* | 318 | /** |
| 171 | * Called on request timeout | 319 | * @timeout: Called on request timeout. |
| 172 | */ | 320 | */ |
| 173 | timeout_fn *timeout; | 321 | timeout_fn *timeout; |
| 174 | 322 | ||
| 175 | /* | 323 | /** |
| 176 | * Called to poll for completion of a specific tag. | 324 | * @poll: Called to poll for completion of a specific tag. |
| 177 | */ | 325 | */ |
| 178 | poll_fn *poll; | 326 | poll_fn *poll; |
| 179 | 327 | ||
| 328 | /** | ||
| 329 | * @complete: Mark the request as complete. | ||
| 330 | */ | ||
| 180 | complete_fn *complete; | 331 | complete_fn *complete; |
| 181 | 332 | ||
| 182 | /* | 333 | /** |
| 183 | * Called when the block layer side of a hardware queue has been | 334 | * @init_hctx: Called when the block layer side of a hardware queue has |
| 184 | * set up, allowing the driver to allocate/init matching structures. | 335 | * been set up, allowing the driver to allocate/init matching |
| 185 | * Ditto for exit/teardown. | 336 | * structures. |
| 186 | */ | 337 | */ |
| 187 | init_hctx_fn *init_hctx; | 338 | init_hctx_fn *init_hctx; |
| 339 | /** | ||
| 340 | * @exit_hctx: Ditto for exit/teardown. | ||
| 341 | */ | ||
| 188 | exit_hctx_fn *exit_hctx; | 342 | exit_hctx_fn *exit_hctx; |
| 189 | 343 | ||
| 190 | /* | 344 | /** |
| 191 | * Called for every command allocated by the block layer to allow | 345 | * @init_request: Called for every command allocated by the block layer |
| 192 | * the driver to set up driver specific data. | 346 | * to allow the driver to set up driver specific data. |
| 193 | * | 347 | * |
| 194 | * Tag greater than or equal to queue_depth is for setting up | 348 | * Tag greater than or equal to queue_depth is for setting up |
| 195 | * flush request. | 349 | * flush request. |
| 196 | * | ||
| 197 | * Ditto for exit/teardown. | ||
| 198 | */ | 350 | */ |
| 199 | init_request_fn *init_request; | 351 | init_request_fn *init_request; |
| 352 | /** | ||
| 353 | * @exit_request: Ditto for exit/teardown. | ||
| 354 | */ | ||
| 200 | exit_request_fn *exit_request; | 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 | void (*initialize_rq_fn)(struct request *rq); | 360 | void (*initialize_rq_fn)(struct request *rq); |
| 203 | 361 | ||
| 204 | /* | 362 | /** |
| 205 | * Called before freeing one request which isn't completed yet, | 363 | * @cleanup_rq: Called before freeing one request which isn't completed |
| 206 | * and usually for freeing the driver private data | 364 | * yet, and usually for freeing the driver private data. |
| 207 | */ | 365 | */ |
| 208 | cleanup_rq_fn *cleanup_rq; | 366 | cleanup_rq_fn *cleanup_rq; |
| 209 | 367 | ||
| 210 | /* | 368 | /** |
| 211 | * If set, returns whether or not this queue currently is busy | 369 | * @busy: If set, returns whether or not this queue currently is busy. |
| 212 | */ | 370 | */ |
| 213 | busy_fn *busy; | 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 | map_queues_fn *map_queues; | 377 | map_queues_fn *map_queues; |
| 216 | 378 | ||
| 217 | #ifdef CONFIG_BLK_DEBUG_FS | 379 | #ifdef CONFIG_BLK_DEBUG_FS |
| 218 | /* | 380 | /** |
| 219 | * Used by the debugfs implementation to show driver-specific | 381 | * @show_rq: Used by the debugfs implementation to show driver-specific |
| 220 | * information about a request. | 382 | * information about a request. |
| 221 | */ | 383 | */ |
| 222 | void (*show_rq)(struct seq_file *m, struct request *rq); | 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 | void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); | 424 | void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); |
| 263 | 425 | ||
| 264 | void blk_mq_free_request(struct request *rq); | 426 | void blk_mq_free_request(struct request *rq); |
| 265 | bool blk_mq_can_queue(struct blk_mq_hw_ctx *); | ||
| 266 | 427 | ||
| 267 | bool blk_mq_queue_inflight(struct request_queue *q); | 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 | return unique_tag & BLK_MQ_UNIQUE_TAG_MASK; | 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 | void blk_mq_start_request(struct request *rq); | 484 | void blk_mq_start_request(struct request *rq); |
| 308 | void blk_mq_end_request(struct request *rq, blk_status_t error); | 485 | void blk_mq_end_request(struct request *rq, blk_status_t error); |
| 309 | void __blk_mq_end_request(struct request *rq, blk_status_t error); | 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 | void blk_mq_quiesce_queue(struct request_queue *q); | 501 | void blk_mq_quiesce_queue(struct request_queue *q); |
| 325 | void blk_mq_unquiesce_queue(struct request_queue *q); | 502 | void blk_mq_unquiesce_queue(struct request_queue *q); |
| 326 | void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); | 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 | void blk_mq_run_hw_queues(struct request_queue *q, bool async); | 505 | void blk_mq_run_hw_queues(struct request_queue *q, bool async); |
| 329 | void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, | 506 | void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, |
| 330 | busy_tag_iter_fn *fn, void *priv); | 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 | unsigned int blk_mq_rq_cpu(struct request *rq); | 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 | * Driver command data is immediately after the request. So subtract request | 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 | static inline struct request *blk_mq_rq_from_pdu(void *pdu) | 532 | static inline struct request *blk_mq_rq_from_pdu(void *pdu) |
| 351 | { | 533 | { |
| 352 | return pdu - sizeof(struct request); | 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 | static inline void *blk_mq_rq_to_pdu(struct request *rq) | 546 | static inline void *blk_mq_rq_to_pdu(struct request *rq) |
| 355 | { | 547 | { |
| 356 | return rq + 1; | 548 | return rq + 1; |
| @@ -153,10 +153,10 @@ struct bio { · 152 unmodified lines | |||
| 153 | unsigned short bi_write_hint; | 153 | unsigned short bi_write_hint; |
| 154 | blk_status_t bi_status; | 154 | blk_status_t bi_status; |
| 155 | u8 bi_partno; | 155 | u8 bi_partno; |
| 156 | atomic_t __bi_remaining; | ||
| 156 | 157 | ||
| 157 | struct bvec_iter bi_iter; | 158 | struct bvec_iter bi_iter; |
| 158 | 159 | ||
| 159 | atomic_t __bi_remaining; | ||
| 160 | bio_end_io_t *bi_end_io; | 160 | bio_end_io_t *bi_end_io; |
| 161 | 161 | ||
| 162 | void *bi_private; | 162 | void *bi_private; |
| @@ -290,6 +290,12 @@ enum req_opf { · 127 unmodified lines | |||
| 290 | REQ_OP_ZONE_RESET_ALL = 8, | 290 | REQ_OP_ZONE_RESET_ALL = 8, |
| 291 | /* write the zero filled sector many times */ | 291 | /* write the zero filled sector many times */ |
| 292 | REQ_OP_WRITE_ZEROES = 9, | 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 | /* SCSI passthrough using struct scsi_request */ | 300 | /* SCSI passthrough using struct scsi_request */ |
| 295 | REQ_OP_SCSI_IN = 32, | 301 | REQ_OP_SCSI_IN = 32, |
| @@ -371,6 +377,7 @@ enum stat_group { · 75 unmodified lines | |||
| 371 | STAT_READ, | 377 | STAT_READ, |
| 372 | STAT_WRITE, | 378 | STAT_WRITE, |
| 373 | STAT_DISCARD, | 379 | STAT_DISCARD, |
| 380 | STAT_FLUSH, | ||
| 374 | 381 | ||
| 375 | NR_STAT_GROUPS | 382 | NR_STAT_GROUPS |
| 376 | }; | 383 | }; |
| @@ -417,6 +424,25 @@ static inline bool op_is_discard(unsigned int op) · 40 unmodified lines | |||
| 417 | return (op & REQ_OP_MASK) == REQ_OP_DISCARD; | 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 | static inline int op_stat_group(unsigned int op) | 446 | static inline int op_stat_group(unsigned int op) |
| 421 | { | 447 | { |
| 422 | if (op_is_discard(op)) | 448 | if (op_is_discard(op)) |
| @@ -349,34 +349,28 @@ struct queue_limits { · 348 unmodified lines | |||
| 349 | enum blk_zoned_model zoned; | 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 | #ifdef CONFIG_BLK_DEV_ZONED | 355 | #ifdef CONFIG_BLK_DEV_ZONED |
| 353 | 356 | ||
| 354 | /* | 357 | #define BLK_ALL_ZONES ((unsigned int)-1) |
| 355 | * Maximum number of zones to report with a single report zones command. | 358 | int blkdev_report_zones(struct block_device *bdev, sector_t sector, |
| 356 | */ | 359 | unsigned int nr_zones, report_zones_cb cb, void *data); |
| 357 | #define BLK_ZONED_REPORT_MAX_ZONES 8192U | 360 | unsigned int blkdev_nr_zones(struct gendisk *disk); |
| 358 | 361 | extern int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, | |
| 359 | extern unsigned int blkdev_nr_zones(struct block_device *bdev); | 362 | sector_t sectors, sector_t nr_sectors, |
| 360 | extern int blkdev_report_zones(struct block_device *bdev, | 363 | gfp_t gfp_mask); |
| 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); | ||
| 365 | extern int blk_revalidate_disk_zones(struct gendisk *disk); | 364 | extern int blk_revalidate_disk_zones(struct gendisk *disk); |
| 366 | 365 | ||
| 367 | extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, | 366 | extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, |
| 368 | unsigned int cmd, unsigned long arg); | 367 | unsigned int cmd, unsigned long arg); |
| 369 | extern int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode, | 368 | extern int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, |
| 370 | unsigned int cmd, unsigned long arg); | 369 | unsigned int cmd, unsigned long arg); |
| 371 | 370 | ||
| 372 | #else /* CONFIG_BLK_DEV_ZONED */ | 371 | #else /* CONFIG_BLK_DEV_ZONED */ |
| 373 | 372 | ||
| 374 | static inline unsigned int blkdev_nr_zones(struct block_device *bdev) | 373 | static inline unsigned int blkdev_nr_zones(struct gendisk *disk) |
| 375 | { | ||
| 376 | return 0; | ||
| 377 | } | ||
| 378 | |||
| 379 | static inline int blk_revalidate_disk_zones(struct gendisk *disk) | ||
| 380 | { | 374 | { |
| 381 | return 0; | 375 | return 0; |
| 382 | } | 376 | } |
| @@ -388,9 +382,9 @@ static inline int blkdev_report_zones_ioctl(struct block_device *bdev, · 5 unmodified lines | |||
| 388 | return -ENOTTY; | 382 | return -ENOTTY; |
| 389 | } | 383 | } |
| 390 | 384 | ||
| 391 | static inline int blkdev_reset_zones_ioctl(struct block_device *bdev, | 385 | static inline int blkdev_zone_mgmt_ioctl(struct block_device *bdev, |
| 392 | fmode_t mode, unsigned int cmd, | 386 | fmode_t mode, unsigned int cmd, |
| 393 | unsigned long arg) | 387 | unsigned long arg) |
| 394 | { | 388 | { |
| 395 | return -ENOTTY; | 389 | return -ENOTTY; |
| 396 | } | 390 | } |
| @@ -411,7 +405,6 @@ struct request_queue { · 14 unmodified lines | |||
| 411 | 405 | ||
| 412 | /* sw queues */ | 406 | /* sw queues */ |
| 413 | struct blk_mq_ctx __percpu *queue_ctx; | 407 | struct blk_mq_ctx __percpu *queue_ctx; |
| 414 | unsigned int nr_queues; | ||
| 415 | 408 | ||
| 416 | unsigned int queue_depth; | 409 | unsigned int queue_depth; |
| 417 | 410 | ||
| @@ -505,9 +498,9 @@ struct request_queue { · 87 unmodified lines | |||
| 505 | /* | 498 | /* |
| 506 | * Zoned block device information for request dispatch control. | 499 | * Zoned block device information for request dispatch control. |
| 507 | * nr_zones is the total number of zones of the device. This is always | 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 | 501 | * 0 for regular block devices. conv_zones_bitmap is a bitmap of nr_zones |
| 509 | * bits which indicates if a zone is conventional (bit clear) or | 502 | * bits which indicates if a zone is conventional (bit set) or |
| 510 | * sequential (bit set). seq_zones_wlock is a bitmap of nr_zones | 503 | * sequential (bit clear). seq_zones_wlock is a bitmap of nr_zones |
| 511 | * bits which indicates if a zone is write locked, that is, if a write | 504 | * bits which indicates if a zone is write locked, that is, if a write |
| 512 | * request targeting the zone was dispatched. All three fields are | 505 | * request targeting the zone was dispatched. All three fields are |
| 513 | * initialized by the low level device driver (e.g. scsi/sd.c). | 506 | * initialized by the low level device driver (e.g. scsi/sd.c). |
| @@ -520,7 +513,7 @@ struct request_queue { · 6 unmodified lines | |||
| 520 | * blk_mq_unfreeze_queue(). | 513 | * blk_mq_unfreeze_queue(). |
| 521 | */ | 514 | */ |
| 522 | unsigned int nr_zones; | 515 | unsigned int nr_zones; |
| 523 | unsigned long *seq_zones_bitmap; | 516 | unsigned long *conv_zones_bitmap; |
| 524 | unsigned long *seq_zones_wlock; | 517 | unsigned long *seq_zones_wlock; |
| 525 | #endif /* CONFIG_BLK_DEV_ZONED */ | 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 | static inline bool blk_queue_zone_is_seq(struct request_queue *q, | 718 | static inline bool blk_queue_zone_is_seq(struct request_queue *q, |
| 726 | sector_t sector) | 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 | return false; | 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 | #else /* CONFIG_BLK_DEV_ZONED */ | 727 | #else /* CONFIG_BLK_DEV_ZONED */ |
| 733 | static inline unsigned int blk_queue_nr_zones(struct request_queue *q) | 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 | unsigned int, void __user *); | 865 | unsigned int, void __user *); |
| 871 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, | 866 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
| 872 | struct scsi_ioctl_command __user *); | 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 | extern int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags); | 871 | extern int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags); |
| 875 | extern void blk_queue_exit(struct request_queue *q); | 872 | extern void blk_queue_exit(struct request_queue *q); |
| @@ -1709,7 +1706,7 @@ struct block_device_operations { · 833 unmodified lines | |||
| 1709 | /* this callback is with swap_lock and sometimes page table lock held */ | 1706 | /* this callback is with swap_lock and sometimes page table lock held */ |
| 1710 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); | 1707 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); |
| 1711 | int (*report_zones)(struct gendisk *, sector_t sector, | 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 | struct module *owner; | 1710 | struct module *owner; |
| 1714 | const struct pr_ops *pr_ops; | 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 | struct cgroup *cgroup, | 157 | struct cgroup *cgroup, |
| 158 | enum bpf_attach_type type); | 158 | enum bpf_attach_type type); |
| 159 | void bpf_cgroup_storage_unlink(struct bpf_cgroup_storage *storage); | 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); | 160 | int bpf_cgroup_storage_assign(struct bpf_prog_aux *aux, struct bpf_map *map); |
| 161 | void bpf_cgroup_storage_release(struct bpf_prog *prog, struct bpf_map *map); | 161 | void bpf_cgroup_storage_release(struct bpf_prog_aux *aux, struct bpf_map *map); |
| 162 | 162 | ||
| 163 | int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key, void *value); | 163 | int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key, void *value); |
| 164 | int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, | 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 | static inline void bpf_cgroup_storage_set( | 361 | static inline void bpf_cgroup_storage_set( |
| 362 | struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE]) {} | 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 | struct bpf_map *map) { return 0; } | 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 | struct bpf_map *map) {} | 366 | struct bpf_map *map) {} |
| 367 | static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( | 367 | static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( |
| 368 | struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; } | 368 | struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; } |
| @@ -12,17 +12,23 @@ · 11 unmodified lines | |||
| 12 | #include <linux/err.h> | 12 | #include <linux/err.h> |
| 13 | #include <linux/rbtree_latch.h> | 13 | #include <linux/rbtree_latch.h> |
| 14 | #include <linux/numa.h> | 14 | #include <linux/numa.h> |
| 15 | #include <linux/mm_types.h> | ||
| 15 | #include <linux/wait.h> | 16 | #include <linux/wait.h> |
| 16 | #include <linux/u64_stats_sync.h> | 17 | #include <linux/u64_stats_sync.h> |
| 18 | #include <linux/refcount.h> | ||
| 19 | #include <linux/mutex.h> | ||
| 17 | 20 | ||
| 18 | struct bpf_verifier_env; | 21 | struct bpf_verifier_env; |
| 22 | struct bpf_verifier_log; | ||
| 19 | struct perf_event; | 23 | struct perf_event; |
| 20 | struct bpf_prog; | 24 | struct bpf_prog; |
| 25 | struct bpf_prog_aux; | ||
| 21 | struct bpf_map; | 26 | struct bpf_map; |
| 22 | struct sock; | 27 | struct sock; |
| 23 | struct seq_file; | 28 | struct seq_file; |
| 24 | struct btf; | 29 | struct btf; |
| 25 | struct btf_type; | 30 | struct btf_type; |
| 31 | struct exception_table_entry; | ||
| 26 | 32 | ||
| 27 | extern struct idr btf_idr; | 33 | extern struct idr btf_idr; |
| 28 | extern spinlock_t btf_idr_lock; | 34 | extern spinlock_t btf_idr_lock; |
| @@ -59,11 +65,18 @@ struct bpf_map_ops { · 30 unmodified lines | |||
| 59 | const struct btf_type *key_type, | 65 | const struct btf_type *key_type, |
| 60 | const struct btf_type *value_type); | 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 | /* Direct value access helpers. */ | 74 | /* Direct value access helpers. */ |
| 63 | int (*map_direct_value_addr)(const struct bpf_map *map, | 75 | int (*map_direct_value_addr)(const struct bpf_map *map, |
| 64 | u64 *imm, u32 off); | 76 | u64 *imm, u32 off); |
| 65 | int (*map_direct_value_meta)(const struct bpf_map *map, | 77 | int (*map_direct_value_meta)(const struct bpf_map *map, |
| 66 | u64 imm, u32 *off); | 78 | u64 imm, u32 *off); |
| 79 | int (*map_mmap)(struct bpf_map *map, struct vm_area_struct *vma); | ||
| 67 | }; | 80 | }; |
| 68 | 81 | ||
| 69 | struct bpf_map_memory { | 82 | struct bpf_map_memory { |
| @@ -92,17 +105,19 @@ struct bpf_map { · 22 unmodified lines | |||
| 92 | u32 btf_value_type_id; | 105 | u32 btf_value_type_id; |
| 93 | struct btf *btf; | 106 | struct btf *btf; |
| 94 | struct bpf_map_memory memory; | 107 | struct bpf_map_memory memory; |
| 108 | char name[BPF_OBJ_NAME_LEN]; | ||
| 95 | bool unpriv_array; | 109 | bool unpriv_array; |
| 96 | bool frozen; /* write-once */ | 110 | bool frozen; /* write-once; write-protected by freeze_mutex */ |
| 97 | /* 48 bytes hole */ | 111 | /* 22 bytes hole */ |
| 98 | 112 | ||
| 99 | /* The 3rd and 4th cacheline with misc members to avoid false sharing | 113 | /* The 3rd and 4th cacheline with misc members to avoid false sharing |
| 100 | * particularly with refcounting. | 114 | * particularly with refcounting. |
| 101 | */ | 115 | */ |
| 102 | atomic_t refcnt ____cacheline_aligned; | 116 | atomic64_t refcnt ____cacheline_aligned; |
| 103 | atomic_t usercnt; | 117 | atomic64_t usercnt; |
| 104 | struct work_struct work; | 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 | static inline bool map_value_has_spin_lock(const struct bpf_map *map) | 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 | ARG_PTR_TO_INT, /* pointer to int */ | 226 | ARG_PTR_TO_INT, /* pointer to int */ |
| 212 | ARG_PTR_TO_LONG, /* pointer to long */ | 227 | ARG_PTR_TO_LONG, /* pointer to long */ |
| 213 | ARG_PTR_TO_SOCKET, /* pointer to bpf_sock (fullsock) */ | 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 | /* type of values returned from helper functions */ | 232 | /* type of values returned from helper functions */ |
| @@ -233,11 +249,17 @@ struct bpf_func_proto { · 16 unmodified lines | |||
| 233 | bool gpl_only; | 249 | bool gpl_only; |
| 234 | bool pkt_access; | 250 | bool pkt_access; |
| 235 | enum bpf_return_type ret_type; | 251 | enum bpf_return_type ret_type; |
| 236 | enum bpf_arg_type arg1_type; | 252 | union { |
| 237 | enum bpf_arg_type arg2_type; | 253 | struct { |
| 238 | enum bpf_arg_type arg3_type; | 254 | enum bpf_arg_type arg1_type; |
| 239 | enum bpf_arg_type arg4_type; | 255 | enum bpf_arg_type arg2_type; |
| 240 | enum bpf_arg_type arg5_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 | /* bpf_context is intentionally undefined structure. Pointer to bpf_context is | 265 | /* bpf_context is intentionally undefined structure. Pointer to bpf_context is |
| @@ -281,6 +303,7 @@ enum bpf_reg_type { · 37 unmodified lines | |||
| 281 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ | 303 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ |
| 282 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ | 304 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ |
| 283 | PTR_TO_XDP_SOCK, /* reg points to struct xdp_sock */ | 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 | /* The information passed from prog-specific *_is_valid_access | 309 | /* The information passed from prog-specific *_is_valid_access |
| @@ -288,7 +311,11 @@ enum bpf_reg_type { · 1 unmodified line | |||
| 288 | */ | 311 | */ |
| 289 | struct bpf_insn_access_aux { | 312 | struct bpf_insn_access_aux { |
| 290 | enum bpf_reg_type reg_type; | 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 | static inline void | 321 | static inline void |
| @@ -359,14 +386,136 @@ enum bpf_cgroup_storage_type { · 64 unmodified lines | |||
| 359 | 386 | ||
| 360 | #define MAX_BPF_CGROUP_STORAGE_TYPE __BPF_CGROUP_STORAGE_MAX | 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 | struct bpf_prog_stats { | 394 | struct bpf_prog_stats { |
| 363 | u64 cnt; | 395 | u64 cnt; |
| 364 | u64 nsecs; | 396 | u64 nsecs; |
| 365 | struct u64_stats_sync syncp; | 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 | struct bpf_prog_aux { | 517 | struct bpf_prog_aux { |
| 369 | atomic_t refcnt; | 518 | atomic64_t refcnt; |
| 370 | u32 used_map_cnt; | 519 | u32 used_map_cnt; |
| 371 | u32 max_ctx_offset; | 520 | u32 max_ctx_offset; |
| 372 | u32 max_pkt_offset; | 521 | u32 max_pkt_offset; |
| @@ -375,10 +524,23 @@ struct bpf_prog_aux { · 2 unmodified lines | |||
| 375 | u32 id; | 524 | u32 id; |
| 376 | u32 func_cnt; /* used by non-func prog as the number of func progs */ | 525 | u32 func_cnt; /* used by non-func prog as the number of func progs */ |
| 377 | u32 func_idx; /* 0 for non-func prog, the index in func array for func prog */ | 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 | bool verifier_zext; /* Zero extensions has been inserted by verifier. */ | 529 | bool verifier_zext; /* Zero extensions has been inserted by verifier. */ |
| 379 | bool offload_requested; | 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 | struct bpf_prog **func; | 540 | struct bpf_prog **func; |
| 381 | void *jit_data; /* JIT specific data. arch dependent */ | 541 | void *jit_data; /* JIT specific data. arch dependent */ |
| 542 | struct bpf_jit_poke_descriptor *poke_tab; | ||
| 543 | u32 size_poke_tab; | ||
| 382 | struct latch_tree_node ksym_tnode; | 544 | struct latch_tree_node ksym_tnode; |
| 383 | struct list_head ksym_lnode; | 545 | struct list_head ksym_lnode; |
| 384 | const struct bpf_prog_ops *ops; | 546 | const struct bpf_prog_ops *ops; |
| @@ -394,6 +556,7 @@ struct bpf_prog_aux { · 9 unmodified lines | |||
| 394 | struct bpf_prog_offload *offload; | 556 | struct bpf_prog_offload *offload; |
| 395 | struct btf *btf; | 557 | struct btf *btf; |
| 396 | struct bpf_func_info *func_info; | 558 | struct bpf_func_info *func_info; |
| 559 | struct bpf_func_info_aux *func_info_aux; | ||
| 397 | /* bpf_line_info loaded from userspace. linfo->insn_off | 560 | /* bpf_line_info loaded from userspace. linfo->insn_off |
| 398 | * has the xlated insn offset. | 561 | * has the xlated insn offset. |
| 399 | * Both the main and sub prog share the same linfo. | 562 | * Both the main and sub prog share the same linfo. |
| @@ -416,6 +579,8 @@ struct bpf_prog_aux { · 16 unmodified lines | |||
| 416 | * main prog always has linfo_idx == 0 | 579 | * main prog always has linfo_idx == 0 |
| 417 | */ | 580 | */ |
| 418 | u32 linfo_idx; | 581 | u32 linfo_idx; |
| 582 | u32 num_exentries; | ||
| 583 | struct exception_table_entry *extable; | ||
| 419 | struct bpf_prog_stats __percpu *stats; | 584 | struct bpf_prog_stats __percpu *stats; |
| 420 | union { | 585 | union { |
| 421 | struct work_struct work; | 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 | struct bpf_array { | 606 | struct bpf_array { |
| 427 | struct bpf_map map; | 607 | struct bpf_map map; |
| 428 | u32 elem_size; | 608 | u32 elem_size; |
| 429 | u32 index_mask; | 609 | u32 index_mask; |
| 430 | /* 'ownership' of prog_array is claimed by the first program that | 610 | struct bpf_array_aux *aux; |
| 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; | ||
| 437 | union { | 611 | union { |
| 438 | char value[0] __aligned(8); | 612 | char value[0] __aligned(8); |
| 439 | void *ptrs[0] __aligned(8); | 613 | void *ptrs[0] __aligned(8); |
| @@ -482,6 +656,7 @@ struct bpf_event_entry { · 42 unmodified lines | |||
| 482 | 656 | ||
| 483 | bool bpf_prog_array_compatible(struct bpf_array *array, const struct bpf_prog *fp); | 657 | bool bpf_prog_array_compatible(struct bpf_array *array, const struct bpf_prog *fp); |
| 484 | int bpf_prog_calc_tag(struct bpf_prog *fp); | 658 | int bpf_prog_calc_tag(struct bpf_prog *fp); |
| 659 | const char *kernel_type_name(u32 btf_type_id); | ||
| 485 | 660 | ||
| 486 | const struct bpf_func_proto *bpf_get_trace_printk_proto(void); | 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 | extern const struct file_operations bpf_map_fops; | 795 | extern const struct file_operations bpf_map_fops; |
| 621 | extern const struct file_operations bpf_prog_fops; | 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 | extern const struct bpf_prog_ops _name ## _prog_ops; \ | 799 | extern const struct bpf_prog_ops _name ## _prog_ops; \ |
| 625 | extern const struct bpf_verifier_ops _name ## _verifier_ops; | 800 | extern const struct bpf_verifier_ops _name ## _verifier_ops; |
| 626 | #define BPF_MAP_TYPE(_id, _ops) \ | 801 | #define BPF_MAP_TYPE(_id, _ops) \ |
| @@ -636,22 +811,24 @@ extern const struct bpf_verifier_ops xdp_analyzer_ops; · 9 unmodified lines | |||
| 636 | struct bpf_prog *bpf_prog_get(u32 ufd); | 811 | struct bpf_prog *bpf_prog_get(u32 ufd); |
| 637 | struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, | 812 | struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, |
| 638 | bool attach_drv); | 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 | void bpf_prog_sub(struct bpf_prog *prog, int i); | 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 | struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog); | 817 | struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog); |
| 643 | void bpf_prog_put(struct bpf_prog *prog); | 818 | void bpf_prog_put(struct bpf_prog *prog); |
| 644 | int __bpf_prog_charge(struct user_struct *user, u32 pages); | 819 | int __bpf_prog_charge(struct user_struct *user, u32 pages); |
| 645 | void __bpf_prog_uncharge(struct user_struct *user, u32 pages); | 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 | void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock); | 824 | void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock); |
| 648 | void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock); | 825 | void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock); |
| 649 | 826 | ||
| 650 | struct bpf_map *bpf_map_get_with_uref(u32 ufd); | 827 | struct bpf_map *bpf_map_get_with_uref(u32 ufd); |
| 651 | struct bpf_map *__bpf_map_get(struct fd f); | 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); | 829 | void bpf_map_inc(struct bpf_map *map); |
| 653 | struct bpf_map * __must_check bpf_map_inc_not_zero(struct bpf_map *map, | 830 | void bpf_map_inc_with_uref(struct bpf_map *map); |
| 654 | bool uref); | 831 | struct bpf_map * __must_check bpf_map_inc_not_zero(struct bpf_map *map); |
| 655 | void bpf_map_put_with_uref(struct bpf_map *map); | 832 | void bpf_map_put_with_uref(struct bpf_map *map); |
| 656 | void bpf_map_put(struct bpf_map *map); | 833 | void bpf_map_put(struct bpf_map *map); |
| 657 | int bpf_map_charge_memlock(struct bpf_map *map, u32 pages); | 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 | void bpf_map_charge_move(struct bpf_map_memory *dst, | 838 | void bpf_map_charge_move(struct bpf_map_memory *dst, |
| 662 | struct bpf_map_memory *src); | 839 | struct bpf_map_memory *src); |
| 663 | void *bpf_map_area_alloc(u64 size, int numa_node); | 840 | void *bpf_map_area_alloc(u64 size, int numa_node); |
| 841 | void *bpf_map_area_mmapable_alloc(u64 size, int numa_node); | ||
| 664 | void bpf_map_area_free(void *base); | 842 | void bpf_map_area_free(void *base); |
| 665 | void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); | 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 | int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, | 925 | int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, |
| 748 | const union bpf_attr *kattr, | 926 | const union bpf_attr *kattr, |
| 749 | union bpf_attr __user *uattr); | 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 | #else /* !CONFIG_BPF_SYSCALL */ | 946 | #else /* !CONFIG_BPF_SYSCALL */ |
| 751 | static inline struct bpf_prog *bpf_prog_get(u32 ufd) | 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 | return ERR_PTR(-EOPNOTSUPP); | 956 | return ERR_PTR(-EOPNOTSUPP); |
| 761 | } | 957 | } |
| 762 | 958 | ||
| 763 | static inline struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, | 959 | static inline void bpf_prog_add(struct bpf_prog *prog, int i) |
| 764 | int i) | ||
| 765 | { | 960 | { |
| 766 | return ERR_PTR(-EOPNOTSUPP); | ||
| 767 | } | 961 | } |
| 768 | 962 | ||
| 769 | static inline void bpf_prog_sub(struct bpf_prog *prog, int i) | 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 | static inline struct bpf_prog *__must_check | 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 | return -ENOTSUPP; | 1071 | return -ENOTSUPP; |
| 879 | } | 1072 | } |
| 1073 | |||
| 1074 | static inline void bpf_map_put(struct bpf_map *map) | ||
| 1075 | { | ||
| 1076 | } | ||
| 880 | #endif /* CONFIG_BPF_SYSCALL */ | 1077 | #endif /* CONFIG_BPF_SYSCALL */ |
| 881 | 1078 | ||
| 882 | static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, | 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 | #endif | 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 | #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) | 1172 | #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) |
| 1001 | void bpf_sk_reuseport_detach(struct sock *sk); | 1173 | void bpf_sk_reuseport_detach(struct sock *sk); |
| 1002 | int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map, void *key, | 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 | #endif | 1267 | #endif |
| 1096 | 1268 | ||
| 1097 | #ifdef CONFIG_INET | 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 | bool bpf_tcp_sock_is_valid_access(int off, int size, enum bpf_access_type type, | 1279 | bool bpf_tcp_sock_is_valid_access(int off, int size, enum bpf_access_type type, |
| 1099 | struct bpf_insn_access_aux *info); | 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 | #endif /* CONFIG_INET */ | 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 | #endif /* _LINUX_BPF_H */ | 1337 | #endif /* _LINUX_BPF_H */ |
| @@ -2,41 +2,68 @@ · 1 unmodified line | |||
| 2 | /* internal file - do not include directly */ | 2 | /* internal file - do not include directly */ |
| 3 | 3 | ||
| 4 | #ifdef CONFIG_NET | 4 | #ifdef CONFIG_NET |
| 5 | BPF_PROG_TYPE(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter) | 5 | BPF_PROG_TYPE(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter, |
| 6 | BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act) | 6 | struct __sk_buff, struct sk_buff) |
| 7 | BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_ACT, tc_cls_act) | 7 | BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act, |
| 8 | BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp) | 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 | #ifdef CONFIG_CGROUP_BPF | 13 | #ifdef CONFIG_CGROUP_BPF |
| 10 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb) | 14 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb, |
| 11 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock) | 15 | struct __sk_buff, struct sk_buff) |
| 12 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK_ADDR, cg_sock_addr) | 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 | #endif | 20 | #endif |
| 14 | BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_in) | 21 | BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_in, |
| 15 | BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_out) | 22 | struct __sk_buff, struct sk_buff) |
| 16 | BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit) | 23 | BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_out, |
| 17 | BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_SEG6LOCAL, lwt_seg6local) | 24 | struct __sk_buff, struct sk_buff) |
| 18 | BPF_PROG_TYPE(BPF_PROG_TYPE_SOCK_OPS, sock_ops) | 25 | BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit, |
| 19 | BPF_PROG_TYPE(BPF_PROG_TYPE_SK_SKB, sk_skb) | 26 | struct __sk_buff, struct sk_buff) |
| 20 | BPF_PROG_TYPE(BPF_PROG_TYPE_SK_MSG, sk_msg) | 27 | BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_SEG6LOCAL, lwt_seg6local, |
| 21 | BPF_PROG_TYPE(BPF_PROG_TYPE_FLOW_DISSECTOR, flow_dissector) | 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 | #endif | 37 | #endif |
| 23 | #ifdef CONFIG_BPF_EVENTS | 38 | #ifdef CONFIG_BPF_EVENTS |
| 24 | BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe) | 39 | BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe, |
| 25 | BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint) | 40 | bpf_user_pt_regs_t, struct pt_regs) |
| 26 | BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event) | 41 | BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint, |
| 27 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint) | 42 | __u64, u64) |
| 28 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) | 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 | #endif | 51 | #endif |
| 30 | #ifdef CONFIG_CGROUP_BPF | 52 | #ifdef CONFIG_CGROUP_BPF |
| 31 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) | 53 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev, |
| 32 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl) | 54 | struct bpf_cgroup_dev_ctx, struct bpf_cgroup_dev_ctx) |
| 33 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCKOPT, cg_sockopt) | 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 | #endif | 59 | #endif |
| 35 | #ifdef CONFIG_BPF_LIRC_MODE2 | 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 | #endif | 63 | #endif |
| 38 | #ifdef CONFIG_INET | 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 | #endif | 67 | #endif |
| 41 | 68 | ||
| 42 | BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops) | 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 | struct bpf_map *map_ptr; | 53 | struct bpf_map *map_ptr; |
| 54 | 54 | ||
| 55 | u32 btf_id; /* for PTR_TO_BTF_ID */ | ||
| 56 | |||
| 55 | /* Max size from any of the above. */ | 57 | /* Max size from any of the above. */ |
| 56 | unsigned long raw; | 58 | unsigned long raw; |
| 57 | }; | 59 | }; |
| @@ -291,7 +293,7 @@ struct bpf_verifier_state_list { · 233 unmodified lines | |||
| 291 | struct bpf_insn_aux_data { | 293 | struct bpf_insn_aux_data { |
| 292 | union { | 294 | union { |
| 293 | enum bpf_reg_type ptr_type; /* pointer type for load/store insns */ | 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 | s32 call_imm; /* saved imm field of call insn */ | 297 | s32 call_imm; /* saved imm field of call insn */ |
| 296 | u32 alu_limit; /* limit for add/sub register with pointer */ | 298 | u32 alu_limit; /* limit for add/sub register with pointer */ |
| 297 | struct { | 299 | struct { |
| @@ -299,6 +301,7 @@ struct bpf_insn_aux_data { · 1 unmodified line | |||
| 299 | u32 map_off; /* offset from value base address */ | 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 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ | 305 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ |
| 303 | int sanitize_stack_off; /* stack slot to be cleared */ | 306 | int sanitize_stack_off; /* stack slot to be cleared */ |
| 304 | bool seen; /* this insn was processed by the verifier */ | 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 | #define BPF_LOG_STATS 4 | 333 | #define BPF_LOG_STATS 4 |
| 331 | #define BPF_LOG_LEVEL (BPF_LOG_LEVEL1 | BPF_LOG_LEVEL2) | 334 | #define BPF_LOG_LEVEL (BPF_LOG_LEVEL1 | BPF_LOG_LEVEL2) |
| 332 | #define BPF_LOG_MASK (BPF_LOG_LEVEL | BPF_LOG_STATS) | 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 | static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log) | 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 | #define BPF_MAX_SUBPROGS 256 | 344 | #define BPF_MAX_SUBPROGS 256 |
| 340 | 345 | ||
| 341 | struct bpf_subprog_info { | 346 | struct bpf_subprog_info { |
| 347 | /* 'start' has to be the first field otherwise find_subprog() won't work */ | ||
| 342 | u32 start; /* insn idx of function entry point */ | 348 | u32 start; /* insn idx of function entry point */ |
| 343 | u32 linfo_idx; /* The idx to the main_prog->aux->linfo */ | 349 | u32 linfo_idx; /* The idx to the main_prog->aux->linfo */ |
| 344 | u16 stack_depth; /* max. stack depth used by this function */ | 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 | const char *fmt, va_list args); | 403 | const char *fmt, va_list args); |
| 398 | __printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env, | 404 | __printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env, |
| 399 | const char *fmt, ...); | 405 | const char *fmt, ...); |
| 406 | __printf(2, 3) void bpf_log(struct bpf_verifier_log *log, | ||
| 407 | const char *fmt, ...); | ||
| 400 | 408 | ||
| 401 | static inline struct bpf_func_state *cur_func(struct bpf_verifier_env *env) | 409 | static inline struct bpf_func_state *cur_func(struct bpf_verifier_env *env) |
| 402 | { | 410 | { |
| @@ -200,9 +200,15 @@ · 199 unmodified lines | |||
| 200 | #define BCM5482_SHD_SSD 0x14 /* 10100: Secondary SerDes control */ | 200 | #define BCM5482_SHD_SSD 0x14 /* 10100: Secondary SerDes control */ |
| 201 | #define BCM5482_SHD_SSD_LEDM 0x0008 /* SSD LED Mode enable */ | 201 | #define BCM5482_SHD_SSD_LEDM 0x0008 /* SSD LED Mode enable */ |
| 202 | #define BCM5482_SHD_SSD_EN 0x0001 /* SSD enable */ | 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 | * EXPANSION SHADOW ACCESS REGISTERS. (PHY REG 0x15, 0x16, and 0x17) | 214 | * EXPANSION SHADOW ACCESS REGISTERS. (PHY REG 0x15, 0x16, and 0x17) |
| @@ -5,6 +5,6 @@ · 4 unmodified lines | |||
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | 6 | ||
| 7 | void *bsearch(const void *key, const void *base, size_t num, size_t size, | 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 | #endif /* _LINUX_BSEARCH_H */ | 10 | #endif /* _LINUX_BSEARCH_H */ |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | #define _LINUX_BTF_H 1 | 5 | #define _LINUX_BTF_H 1 |
| 6 | 6 | ||
| 7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
| 8 | #include <uapi/linux/btf.h> | ||
| 8 | 9 | ||
| 9 | struct btf; | 10 | struct btf; |
| 10 | struct btf_member; | 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 | int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t); | 54 | int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t); |
| 54 | bool btf_type_is_void(const struct btf_type *t); | 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 | #ifdef CONFIG_BPF_SYSCALL | 87 | #ifdef CONFIG_BPF_SYSCALL |
| 57 | const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id); | 88 | const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id); |
| 58 | const char *btf_name_by_offset(const struct btf *btf, u32 offset); | 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 | #else | 92 | #else |
| 60 | static inline const struct btf_type *btf_type_by_id(const struct btf *btf, | 93 | static inline const struct btf_type *btf_type_by_id(const struct btf *btf, |
| 61 | u32 type_id) | 94 | u32 type_id) |
| @@ -9,11 +9,11 @@ · 8 unmodified lines | |||
| 9 | #else /* __CHECKER__ */ | 9 | #else /* __CHECKER__ */ |
| 10 | /* | 10 | /* |
| 11 | * Force a compilation error if condition is true, but also produce a | 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 | * e.g. in a structure initializer (or where-ever else comma expressions | 13 | * e.g. in a structure initializer (or where-ever else comma expressions |
| 14 | * aren't permitted). | 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 | #endif /* __CHECKER__ */ | 17 | #endif /* __CHECKER__ */ |
| 18 | 18 | ||
| 19 | /* Force a compilation error if a constant expression is not a power of 2 */ | 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 | static inline bool bvec_iter_advance(const struct bio_vec *bv, | 87 | static inline bool bvec_iter_advance(const struct bio_vec *bv, |
| 88 | struct bvec_iter *iter, unsigned bytes) | 88 | struct bvec_iter *iter, unsigned bytes) |
| 89 | { | 89 | { |
| 90 | unsigned int idx = iter->bi_idx; | ||
| 91 | |||
| 90 | if (WARN_ONCE(bytes > iter->bi_size, | 92 | if (WARN_ONCE(bytes > iter->bi_size, |
| 91 | "Attempted to advance past end of bvec iter\n")) { | 93 | "Attempted to advance past end of bvec iter\n")) { |
| 92 | iter->bi_size = 0; | 94 | iter->bi_size = 0; |
| 93 | return false; | 95 | return false; |
| 94 | } | 96 | } |
| 95 | 97 | ||
| 96 | while (bytes) { | 98 | iter->bi_size -= bytes; |
| 97 | const struct bio_vec *cur = bv + iter->bi_idx; | 99 | bytes += iter->bi_bvec_done; |
| 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; | ||
| 104 | 100 | ||
| 105 | if (iter->bi_bvec_done == cur->bv_len) { | 101 | while (bytes && bytes >= bv[idx].bv_len) { |
| 106 | iter->bi_bvec_done = 0; | 102 | bytes -= bv[idx].bv_len; |
| 107 | iter->bi_idx++; | 103 | idx++; |
| 108 | } | ||
| 109 | } | 104 | } |
| 105 | |||
| 106 | iter->bi_idx = idx; | ||
| 107 | iter->bi_bvec_done = bytes; | ||
| 110 | return true; | 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 | struct can_rx_offload { | 15 | struct can_rx_offload { |
| 16 | struct net_device *dev; | 16 | struct net_device *dev; |
| 17 | 17 | ||
| 18 | unsigned int (*mailbox_read)(struct can_rx_offload *offload, | 18 | struct sk_buff *(*mailbox_read)(struct can_rx_offload *offload, |
| 19 | struct can_frame *cf, | 19 | unsigned int mb, u32 *timestamp, |
| 20 | u32 *timestamp, unsigned int mb); | 20 | bool drop); |
| 21 | 21 | ||
| 22 | struct sk_buff_head skb_queue; | 22 | struct sk_buff_head skb_queue; |
| 23 | u32 skb_queue_len_max; | 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 | unsigned int idx, u32 timestamp); | 44 | unsigned int idx, u32 timestamp); |
| 45 | int can_rx_offload_queue_tail(struct can_rx_offload *offload, | 45 | int can_rx_offload_queue_tail(struct can_rx_offload *offload, |
| 46 | struct sk_buff *skb); | 46 | struct sk_buff *skb); |
| 47 | void can_rx_offload_reset(struct can_rx_offload *offload); | ||
| 48 | void can_rx_offload_del(struct can_rx_offload *offload); | 47 | void can_rx_offload_del(struct can_rx_offload *offload); |
| 49 | void can_rx_offload_enable(struct can_rx_offload *offload); | 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 | extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); | 280 | extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); |
| 281 | extern void *ceph_kvmalloc(size_t size, gfp_t flags); | 281 | extern void *ceph_kvmalloc(size_t size, gfp_t flags); |
| 282 | 282 | ||
| 283 | extern struct ceph_options *ceph_parse_options(char *options, | 283 | struct fs_parameter; |
| 284 | const char *dev_name, const char *dev_name_end, | 284 | struct ceph_options *ceph_alloc_options(void); |
| 285 | int (*parse_extra_token)(char *c, void *private), | 285 | int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt, |
| 286 | void *private); | 286 | struct fs_context *fc); |
| 287 | int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt, | ||
| 288 | struct fs_context *fc); | ||
| 287 | int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, | 289 | int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, |
| 288 | bool show_all); | 290 | bool show_all); |
| 289 | extern void ceph_destroy_options(struct ceph_options *opt); | 291 | extern void ceph_destroy_options(struct ceph_options *opt); |
| @@ -354,16 +354,6 @@ struct cgroup { · 353 unmodified lines | |||
| 354 | 354 | ||
| 355 | unsigned long flags; /* "unsigned long" so bitops work */ | 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 | * The depth this cgroup is at. The root is at depth zero and each | 358 | * The depth this cgroup is at. The root is at depth zero and each |
| 369 | * step down the hierarchy increments the level. This along with | 359 | * step down the hierarchy increments the level. This along with |
| @@ -458,7 +448,7 @@ struct cgroup { · 88 unmodified lines | |||
| 458 | struct list_head rstat_css_list; | 448 | struct list_head rstat_css_list; |
| 459 | 449 | ||
| 460 | /* cgroup basic resource statistics */ | 450 | /* cgroup basic resource statistics */ |
| 461 | struct cgroup_base_stat pending_bstat; /* pending from children */ | 451 | struct cgroup_base_stat last_bstat; |
| 462 | struct cgroup_base_stat bstat; | 452 | struct cgroup_base_stat bstat; |
| 463 | struct prev_cputime prev_cputime; /* for printing out cputime */ | 453 | struct prev_cputime prev_cputime; /* for printing out cputime */ |
| 464 | 454 | ||
| @@ -488,7 +478,7 @@ struct cgroup { · 23 unmodified lines | |||
| 488 | struct cgroup_freezer_state freezer; | 478 | struct cgroup_freezer_state freezer; |
| 489 | 479 | ||
| 490 | /* ids of the ancestors at each level including self */ | 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 | struct cgroup cgrp; | 499 | struct cgroup cgrp; |
| 510 | 500 | ||
| 511 | /* for cgrp->ancestor_ids[0] */ | 501 | /* for cgrp->ancestor_ids[0] */ |
| 512 | int cgrp_ancestor_id_storage; | 502 | u64 cgrp_ancestor_id_storage; |
| 513 | 503 | ||
| 514 | /* Number of cgroups in the hierarchy, used only for /proc/cgroups */ | 504 | /* Number of cgroups in the hierarchy, used only for /proc/cgroups */ |
| 515 | atomic_t nr_cgrps; | 505 | atomic_t nr_cgrps; |
| @@ -520,9 +510,6 @@ struct cgroup_root { · 4 unmodified lines | |||
| 520 | /* Hierarchy-specific flags */ | 510 | /* Hierarchy-specific flags */ |
| 521 | unsigned int flags; | 511 | unsigned int flags; |
| 522 | 512 | ||
| 523 | /* IDs for cgroups in this hierarchy */ | ||
| 524 | struct idr cgroup_idr; | ||
| 525 | |||
| 526 | /* The path to use for release notifications. */ | 513 | /* The path to use for release notifications. */ |
| 527 | char release_agent_path[PATH_MAX]; | 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 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset, | 150 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset, |
| 151 | struct cgroup_subsys_state **dst_cssp); | 151 | struct cgroup_subsys_state **dst_cssp); |
| 152 | 152 | ||
| 153 | void cgroup_enable_task_cg_lists(void); | ||
| 154 | void css_task_iter_start(struct cgroup_subsys_state *css, unsigned int flags, | 153 | void css_task_iter_start(struct cgroup_subsys_state *css, unsigned int flags, |
| 155 | struct css_task_iter *it); | 154 | struct css_task_iter *it); |
| 156 | struct task_struct *css_task_iter_next(struct css_task_iter *it); | 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 | * Inline functions. | 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 | * css_get - obtain a reference on the specified css | 313 | * css_get - obtain a reference on the specified css |
| 310 | * @css: target css | 314 | * @css: target css |
| @@ -566,7 +570,7 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp, · 255 unmodified lines | |||
| 566 | { | 570 | { |
| 567 | if (cgrp->root != ancestor->root || cgrp->level < ancestor->level) | 571 | if (cgrp->root != ancestor->root || cgrp->level < ancestor->level) |
| 568 | return false; | 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 | /* returns ino associated with a cgroup */ | 621 | /* returns ino associated with a cgroup */ |
| 618 | static inline ino_t cgroup_ino(struct cgroup *cgrp) | 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 | /* cft/css accessors for cftype->write() operation */ | 627 | /* cft/css accessors for cftype->write() operation */ |
| @@ -688,18 +692,13 @@ static inline void cgroup_kthread_ready(void) · 64 unmodified lines | |||
| 688 | current->no_cgroup_migration = 0; | 692 | current->no_cgroup_migration = 0; |
| 689 | } | 693 | } |
| 690 | 694 | ||
| 691 | static inline union kernfs_node_id *cgroup_get_kernfs_id(struct cgroup *cgrp) | 695 | void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen); |
| 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); | ||
| 698 | #else /* !CONFIG_CGROUPS */ | 696 | #else /* !CONFIG_CGROUPS */ |
| 699 | 697 | ||
| 700 | struct cgroup_subsys_state; | 698 | struct cgroup_subsys_state; |
| 701 | struct cgroup; | 699 | struct cgroup; |
| 702 | 700 | ||
| 701 | static inline u64 cgroup_id(struct cgroup *cgrp) { return 1; } | ||
| 703 | static inline void css_get(struct cgroup_subsys_state *css) {} | 702 | static inline void css_get(struct cgroup_subsys_state *css) {} |
| 704 | static inline void css_put(struct cgroup_subsys_state *css) {} | 703 | static inline void css_put(struct cgroup_subsys_state *css) {} |
| 705 | static inline int cgroup_attach_task_all(struct task_struct *from, | 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 | static inline int cgroup_init(void) { return 0; } | 718 | static inline int cgroup_init(void) { return 0; } |
| 720 | static inline void cgroup_init_kthreadd(void) {} | 719 | static inline void cgroup_init_kthreadd(void) {} |
| 721 | static inline void cgroup_kthread_ready(void) {} | 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 | static inline struct cgroup *cgroup_parent(struct cgroup *cgrp) | 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 | return true; | 735 | return true; |
| 741 | } | 736 | } |
| 742 | 737 | ||
| 743 | static inline void cgroup_path_from_kernfs_id(const union kernfs_node_id *id, | 738 | static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen) |
| 744 | char *buf, size_t buflen) {} | 739 | {} |
| 745 | #endif /* !CONFIG_CGROUPS */ | 740 | #endif /* !CONFIG_CGROUPS */ |
| 746 | 741 | ||
| 747 | #ifdef CONFIG_CGROUPS | 742 | #ifdef CONFIG_CGROUPS |
| @@ -818,6 +818,7 @@ unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); · 817 unmodified lines | |||
| 818 | struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw); | 818 | struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw); |
| 819 | struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw, | 819 | struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw, |
| 820 | unsigned int index); | 820 | unsigned int index); |
| 821 | int clk_hw_get_parent_index(struct clk_hw *hw); | ||
| 821 | int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *new_parent); | 822 | int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *new_parent); |
| 822 | unsigned int __clk_get_enable_count(struct clk *clk); | 823 | unsigned int __clk_get_enable_count(struct clk *clk); |
| 823 | unsigned long clk_hw_get_rate(const struct clk_hw *hw); | 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 | tegra_cpu_car_ops->resume(); | 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 | #endif | 124 | #endif |
| 112 | 125 | ||
| 113 | extern void tegra210_xusb_pll_hw_control_enable(void); | 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 | extern void tegra210_put_utmipll_out_iddq(void); | 132 | extern void tegra210_put_utmipll_out_iddq(void); |
| 120 | extern int tegra210_clk_handle_mbist_war(unsigned int id); | 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 | #endif /* __LINUX_CLK_TEGRA_H_ */ | 146 | #endif /* __LINUX_CLK_TEGRA_H_ */ |
| @@ -153,7 +153,7 @@ struct clk_hw_omap { · 152 unmodified lines | |||
| 153 | u8 fixed_div; | 153 | u8 fixed_div; |
| 154 | struct clk_omap_reg enable_reg; | 154 | struct clk_omap_reg enable_reg; |
| 155 | u8 enable_bit; | 155 | u8 enable_bit; |
| 156 | u8 flags; | 156 | unsigned long flags; |
| 157 | struct clk_omap_reg clksel_reg; | 157 | struct clk_omap_reg clksel_reg; |
| 158 | struct dpll_data *dpll_data; | 158 | struct dpll_data *dpll_data; |
| 159 | const char *clkdm_name; | 159 | const char *clkdm_name; |
| @@ -298,6 +298,7 @@ struct ti_clk_features { · 138 unmodified lines | |||
| 298 | 298 | ||
| 299 | void ti_clk_setup_features(struct ti_clk_features *features); | 299 | void ti_clk_setup_features(struct ti_clk_features *features); |
| 300 | const struct ti_clk_features *ti_clk_get_features(void); | 300 | const struct ti_clk_features *ti_clk_get_features(void); |
| 301 | bool ti_clk_is_in_standby(struct clk *clk); | ||
| 301 | int omap3_noncore_dpll_save_context(struct clk_hw *hw); | 302 | int omap3_noncore_dpll_save_context(struct clk_hw *hw); |
| 302 | void omap3_noncore_dpll_restore_context(struct clk_hw *hw); | 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 | struct compat_sel_arg_struct; | 116 | struct compat_sel_arg_struct; |
| 117 | struct rusage; | 117 | struct rusage; |
| 118 | 118 | ||
| 119 | struct compat_itimerval { | 119 | struct old_itimerval32; |
| 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 *); | ||
| 127 | 120 | ||
| 128 | struct compat_tms { | 121 | struct compat_tms { |
| 129 | compat_clock_t tms_utime; | 122 | compat_clock_t tms_utime; |
| @@ -410,8 +403,6 @@ struct compat_kexec_segment; · 280 unmodified lines | |||
| 410 | struct compat_mq_attr; | 403 | struct compat_mq_attr; |
| 411 | struct compat_msgbuf; | 404 | struct compat_msgbuf; |
| 412 | 405 | ||
| 413 | extern void compat_exit_robust_list(struct task_struct *curr); | ||
| 414 | |||
| 415 | #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t)) | 406 | #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t)) |
| 416 | 407 | ||
| 417 | #define BITS_TO_COMPAT_LONGS(bits) DIV_ROUND_UP(bits, BITS_PER_COMPAT_LONG) | 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 | /* kernel/itimer.c */ | 660 | /* kernel/itimer.c */ |
| 670 | asmlinkage long compat_sys_getitimer(int which, | 661 | asmlinkage long compat_sys_getitimer(int which, |
| 671 | struct compat_itimerval __user *it); | 662 | struct old_itimerval32 __user *it); |
| 672 | asmlinkage long compat_sys_setitimer(int which, | 663 | asmlinkage long compat_sys_setitimer(int which, |
| 673 | struct compat_itimerval __user *in, | 664 | struct old_itimerval32 __user *in, |
| 674 | struct compat_itimerval __user *out); | 665 | struct old_itimerval32 __user *out); |
| 675 | 666 | ||
| 676 | /* kernel/kexec.c */ | 667 | /* kernel/kexec.c */ |
| 677 | asmlinkage long compat_sys_kexec_load(compat_ulong_t entry, | 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 | static inline struct old_timeval32 ns_to_old_timeval32(s64 nsec) | 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 | struct old_timeval32 ctv; | 932 | struct old_timeval32 ctv; |
| 942 | 933 | ||
| 943 | tv = ns_to_timeval(nsec); | 934 | tv = ns_to_kernel_old_timeval(nsec); |
| 944 | ctv.tv_sec = tv.tv_sec; | 935 | ctv.tv_sec = tv.tv_sec; |
| 945 | ctv.tv_usec = tv.tv_usec; | 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 | static inline void user_enter(void) | 23 | static inline void user_enter(void) |
| 24 | { | 24 | { |
| 25 | if (context_tracking_is_enabled()) | 25 | if (context_tracking_enabled()) |
| 26 | context_tracking_enter(CONTEXT_USER); | 26 | context_tracking_enter(CONTEXT_USER); |
| 27 | 27 | ||
| 28 | } | 28 | } |
| 29 | static inline void user_exit(void) | 29 | static inline void user_exit(void) |
| 30 | { | 30 | { |
| 31 | if (context_tracking_is_enabled()) | 31 | if (context_tracking_enabled()) |
| 32 | context_tracking_exit(CONTEXT_USER); | 32 | context_tracking_exit(CONTEXT_USER); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | /* Called with interrupts disabled. */ | 35 | /* Called with interrupts disabled. */ |
| 36 | static inline void user_enter_irqoff(void) | 36 | static inline void user_enter_irqoff(void) |
| 37 | { | 37 | { |
| 38 | if (context_tracking_is_enabled()) | 38 | if (context_tracking_enabled()) |
| 39 | __context_tracking_enter(CONTEXT_USER); | 39 | __context_tracking_enter(CONTEXT_USER); |
| 40 | 40 | ||
| 41 | } | 41 | } |
| 42 | static inline void user_exit_irqoff(void) | 42 | static inline void user_exit_irqoff(void) |
| 43 | { | 43 | { |
| 44 | if (context_tracking_is_enabled()) | 44 | if (context_tracking_enabled()) |
| 45 | __context_tracking_exit(CONTEXT_USER); | 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 | enum ctx_state prev_ctx; | 50 | enum ctx_state prev_ctx; |
| 51 | 51 | ||
| 52 | if (!context_tracking_is_enabled()) | 52 | if (!context_tracking_enabled()) |
| 53 | return 0; | 53 | return 0; |
| 54 | 54 | ||
| 55 | prev_ctx = this_cpu_read(context_tracking.state); | 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 | static inline void exception_exit(enum ctx_state prev_ctx) | 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 | if (prev_ctx != CONTEXT_KERNEL) | 65 | if (prev_ctx != CONTEXT_KERNEL) |
| 66 | context_tracking_enter(prev_ctx); | 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 | static inline enum ctx_state ct_state(void) | 78 | static inline enum ctx_state ct_state(void) |
| 79 | { | 79 | { |
| 80 | return context_tracking_is_enabled() ? | 80 | return context_tracking_enabled() ? |
| 81 | this_cpu_read(context_tracking.state) : CONTEXT_DISABLED; | 81 | this_cpu_read(context_tracking.state) : CONTEXT_DISABLED; |
| 82 | } | 82 | } |
| 83 | #else | 83 | #else |
| @@ -90,7 +90,7 @@ static inline void exception_exit(enum ctx_state prev_ctx) { } · 6 unmodified lines | |||
| 90 | static inline enum ctx_state ct_state(void) { return CONTEXT_DISABLED; } | 90 | static inline enum ctx_state ct_state(void) { return CONTEXT_DISABLED; } |
| 91 | #endif /* !CONFIG_CONTEXT_TRACKING */ | 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 | #ifdef CONFIG_CONTEXT_TRACKING_FORCE | 95 | #ifdef CONFIG_CONTEXT_TRACKING_FORCE |
| 96 | extern void context_tracking_init(void); | 96 | extern void context_tracking_init(void); |
| @@ -103,12 +103,12 @@ static inline void context_tracking_init(void) { } · 6 unmodified lines | |||
| 103 | /* must be called with irqs disabled */ | 103 | /* must be called with irqs disabled */ |
| 104 | static inline void guest_enter_irqoff(void) | 104 | static inline void guest_enter_irqoff(void) |
| 105 | { | 105 | { |
| 106 | if (vtime_accounting_cpu_enabled()) | 106 | if (vtime_accounting_enabled_this_cpu()) |
| 107 | vtime_guest_enter(current); | 107 | vtime_guest_enter(current); |
| 108 | else | 108 | else |
| 109 | current->flags |= PF_VCPU; | 109 | current->flags |= PF_VCPU; |
| 110 | 110 | ||
| 111 | if (context_tracking_is_enabled()) | 111 | if (context_tracking_enabled()) |
| 112 | __context_tracking_enter(CONTEXT_GUEST); | 112 | __context_tracking_enter(CONTEXT_GUEST); |
| 113 | 113 | ||
| 114 | /* KVM does not hold any references to rcu protected data when it | 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 | * one time slice). Lets treat guest mode as quiescent state, just like | 118 | * one time slice). Lets treat guest mode as quiescent state, just like |
| 119 | * we do with user-mode execution. | 119 | * we do with user-mode execution. |
| 120 | */ | 120 | */ |
| 121 | if (!context_tracking_cpu_is_enabled()) | 121 | if (!context_tracking_enabled_this_cpu()) |
| 122 | rcu_virt_note_context_switch(smp_processor_id()); | 122 | rcu_virt_note_context_switch(smp_processor_id()); |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static inline void guest_exit_irqoff(void) | 125 | static inline void guest_exit_irqoff(void) |
| 126 | { | 126 | { |
| 127 | if (context_tracking_is_enabled()) | 127 | if (context_tracking_enabled()) |
| 128 | __context_tracking_exit(CONTEXT_GUEST); | 128 | __context_tracking_exit(CONTEXT_GUEST); |
| 129 | 129 | ||
| 130 | if (vtime_accounting_cpu_enabled()) | 130 | if (vtime_accounting_enabled_this_cpu()) |
| 131 | vtime_guest_exit(current); | 131 | vtime_guest_exit(current); |
| 132 | else | 132 | else |
| 133 | current->flags &= ~PF_VCPU; | 133 | current->flags &= ~PF_VCPU; |
| @@ -141,7 +141,7 @@ static inline void guest_enter_irqoff(void) · 7 unmodified lines | |||
| 141 | * to assume that it's the stime pending cputime | 141 | * to assume that it's the stime pending cputime |
| 142 | * to flush. | 142 | * to flush. |
| 143 | */ | 143 | */ |
| 144 | vtime_account_system(current); | 144 | vtime_account_kernel(current); |
| 145 | current->flags |= PF_VCPU; | 145 | current->flags |= PF_VCPU; |
| 146 | rcu_virt_note_context_switch(smp_processor_id()); | 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 | static inline void guest_exit_irqoff(void) | 149 | static inline void guest_exit_irqoff(void) |
| 150 | { | 150 | { |
| 151 | /* Flush the guest cputime we spent on the guest */ | 151 | /* Flush the guest cputime we spent on the guest */ |
| 152 | vtime_account_system(current); | 152 | vtime_account_kernel(current); |
| 153 | current->flags &= ~PF_VCPU; | 153 | current->flags &= ~PF_VCPU; |
| 154 | } | 154 | } |
| 155 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */ | 155 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */ |
| @@ -23,17 +23,22 @@ struct context_tracking { · 22 unmodified lines | |||
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_CONTEXT_TRACKING | 25 | #ifdef CONFIG_CONTEXT_TRACKING |
| 26 | extern struct static_key_false context_tracking_enabled; | 26 | extern struct static_key_false context_tracking_key; |
| 27 | DECLARE_PER_CPU(struct context_tracking, context_tracking); | 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 | static inline bool context_tracking_in_user(void) | 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 | #else | 48 | #else |
| 44 | static inline bool context_tracking_in_user(void) { return false; } | 49 | static inline bool context_tracking_in_user(void) { return false; } |
| 45 | static inline bool context_tracking_active(void) { return false; } | 50 | static inline bool context_tracking_enabled(void) { return false; } |
| 46 | static inline bool context_tracking_is_enabled(void) { return false; } | 51 | static inline bool context_tracking_enabled_cpu(int cpu) { return false; } |
| 47 | static inline bool context_tracking_cpu_is_enabled(void) { return false; } | 52 | static inline bool context_tracking_enabled_this_cpu(void) { return false; } |
| 48 | #endif /* CONFIG_CONTEXT_TRACKING */ | 53 | #endif /* CONFIG_CONTEXT_TRACKING */ |
| 49 | 54 | ||
| 50 | #endif | 55 | #endif |
| @@ -285,6 +285,8 @@ extern void coresight_disclaim_device(void __iomem *base); · 284 unmodified lines | |||
| 285 | extern void coresight_disclaim_device_unlocked(void __iomem *base); | 285 | extern void coresight_disclaim_device_unlocked(void __iomem *base); |
| 286 | extern char *coresight_alloc_device_name(struct coresight_dev_list *devs, | 286 | extern char *coresight_alloc_device_name(struct coresight_dev_list *devs, |
| 287 | struct device *dev); | 287 | struct device *dev); |
| 288 | |||
| 289 | extern bool coresight_loses_context_with_cpu(struct device *dev); | ||
| 288 | #else | 290 | #else |
| 289 | static inline struct coresight_device * | 291 | static inline struct coresight_device * |
| 290 | coresight_register(struct coresight_desc *desc) { return NULL; } | 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 | static inline void coresight_disclaim_device(void __iomem *base) {} | 309 | static inline void coresight_disclaim_device(void __iomem *base) {} |
| 308 | static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} | 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 | #endif | 316 | #endif |
| 311 | 317 | ||
| 312 | extern int coresight_get_cpu(struct device *dev); | 318 | extern int coresight_get_cpu(struct device *dev); |
| @@ -290,53 +290,22 @@ struct counter_device_state { · 289 unmodified lines | |||
| 290 | const struct attribute_group **groups; | 290 | const struct attribute_group **groups; |
| 291 | }; | 291 | }; |
| 292 | 292 | ||
| 293 | /** | 293 | enum counter_signal_value { |
| 294 | * struct counter_signal_read_value - Opaque Signal read value | 294 | COUNTER_SIGNAL_LOW = 0, |
| 295 | * @buf: string representation of Signal read value | 295 | COUNTER_SIGNAL_HIGH |
| 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; | ||
| 319 | }; | 296 | }; |
| 320 | 297 | ||
| 321 | /** | 298 | /** |
| 322 | * struct counter_ops - Callbacks from driver | 299 | * struct counter_ops - Callbacks from driver |
| 323 | * @signal_read: optional read callback for Signal attribute. The read | 300 | * @signal_read: optional read callback for Signal attribute. The read |
| 324 | * value of the respective Signal should be passed back via | 301 | * value of the respective Signal should be passed back via |
| 325 | * the val parameter. val points to an opaque type which | 302 | * the val parameter. |
| 326 | * should be set only by calling the | ||
| 327 | * counter_signal_read_value_set function from within the | ||
| 328 | * signal_read callback. | ||
| 329 | * @count_read: optional read callback for Count attribute. The read | 303 | * @count_read: optional read callback for Count attribute. The read |
| 330 | * value of the respective Count should be passed back via | 304 | * value of the respective Count should be passed back via |
| 331 | * the val parameter. val points to an opaque type which | 305 | * the val parameter. |
| 332 | * should be set only by calling the | ||
| 333 | * counter_count_read_value_set function from within the | ||
| 334 | * count_read callback. | ||
| 335 | * @count_write: optional write callback for Count attribute. The write | 306 | * @count_write: optional write callback for Count attribute. The write |
| 336 | * value for the respective Count is passed in via the val | 307 | * value for the respective Count is passed in via the val |
| 337 | * parameter. val points to an opaque type which should be | 308 | * parameter. |
| 338 | * accessed only by calling the | ||
| 339 | * counter_count_write_value_get function. | ||
| 340 | * @function_get: function to get the current count function mode. Returns | 309 | * @function_get: function to get the current count function mode. Returns |
| 341 | * 0 on success and negative error code on error. The index | 310 | * 0 on success and negative error code on error. The index |
| 342 | * of the respective Count's returned function mode should | 311 | * of the respective Count's returned function mode should |
| @@ -346,7 +315,7 @@ struct counter_count_write_value { · 3 unmodified lines | |||
| 346 | * Count's functions_list array. | 315 | * Count's functions_list array. |
| 347 | * @action_get: function to get the current action mode. Returns 0 on | 316 | * @action_get: function to get the current action mode. Returns 0 on |
| 348 | * success and negative error code on error. The index of | 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 | * passed back via the action parameter. | 319 | * passed back via the action parameter. |
| 351 | * @action_set: function to set the action mode. action is the index of | 320 | * @action_set: function to set the action mode. action is the index of |
| 352 | * the requested action mode from the respective Synapse's | 321 | * the requested action mode from the respective Synapse's |
| @@ -355,13 +324,11 @@ struct counter_count_write_value { · 2 unmodified lines | |||
| 355 | struct counter_ops { | 324 | struct counter_ops { |
| 356 | int (*signal_read)(struct counter_device *counter, | 325 | int (*signal_read)(struct counter_device *counter, |
| 357 | struct counter_signal *signal, | 326 | struct counter_signal *signal, |
| 358 | struct counter_signal_read_value *val); | 327 | enum counter_signal_value *val); |
| 359 | int (*count_read)(struct counter_device *counter, | 328 | int (*count_read)(struct counter_device *counter, |
| 360 | struct counter_count *count, | 329 | struct counter_count *count, unsigned long *val); |
| 361 | struct counter_count_read_value *val); | ||
| 362 | int (*count_write)(struct counter_device *counter, | 330 | int (*count_write)(struct counter_device *counter, |
| 363 | struct counter_count *count, | 331 | struct counter_count *count, unsigned long val); |
| 364 | struct counter_count_write_value *val); | ||
| 365 | int (*function_get)(struct counter_device *counter, | 332 | int (*function_get)(struct counter_device *counter, |
| 366 | struct counter_count *count, size_t *function); | 333 | struct counter_count *count, size_t *function); |
| 367 | int (*function_set)(struct counter_device *counter, | 334 | int (*function_set)(struct counter_device *counter, |
| @@ -477,29 +444,6 @@ struct counter_device { · 109 unmodified lines | |||
| 477 | void *priv; | 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 | int counter_register(struct counter_device *const counter); | 447 | int counter_register(struct counter_device *const counter); |
| 504 | void counter_unregister(struct counter_device *const counter); | 448 | void counter_unregister(struct counter_device *const counter); |
| 505 | int devm_counter_register(struct device *dev, | 449 | int devm_counter_register(struct device *dev, |
| @@ -184,7 +184,12 @@ void arch_cpu_idle_dead(void); · 183 unmodified lines | |||
| 184 | int cpu_report_state(int cpu); | 184 | int cpu_report_state(int cpu); |
| 185 | int cpu_check_up_prepare(int cpu); | 185 | int cpu_check_up_prepare(int cpu); |
| 186 | void cpu_set_state_online(int cpu); | 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 | #ifdef CONFIG_HOTPLUG_CPU | 194 | #ifdef CONFIG_HOTPLUG_CPU |
| 190 | bool cpu_wait_death(unsigned int cpu, int seconds); | 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 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); | 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 | #else /* !CONFIG_CPU_THERMAL */ | 43 | #else /* !CONFIG_CPU_THERMAL */ |
| 37 | static inline struct thermal_cooling_device * | 44 | static inline struct thermal_cooling_device * |
| 38 | cpufreq_cooling_register(struct cpufreq_policy *policy) | 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 | return; | 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 | static inline struct thermal_cooling_device * | 56 | static inline struct thermal_cooling_device * |
| 59 | of_cpufreq_cooling_register(struct cpufreq_policy *policy) | 57 | of_cpufreq_cooling_register(struct cpufreq_policy *policy) |
| 60 | { | 58 | { |
| 61 | return NULL; | 59 | return NULL; |
| 62 | } | 60 | } |
| 63 | #endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */ | 61 | #endif /* CONFIG_CPU_THERMAL */ |
| 64 | 62 | ||
| 65 | #endif /* __CPU_COOLING_H__ */ | 63 | #endif /* __CPU_COOLING_H__ */ |
| @@ -595,17 +595,6 @@ struct governor_attr { · 594 unmodified lines | |||
| 595 | size_t count); | 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 | * FREQUENCY TABLE HELPERS * | 599 | * FREQUENCY TABLE HELPERS * |
| 611 | *********************************************************************/ | 600 | *********************************************************************/ |
| @@ -129,6 +129,7 @@ enum cpuhp_state { · 128 unmodified lines | |||
| 129 | CPUHP_AP_ARC_TIMER_STARTING, | 129 | CPUHP_AP_ARC_TIMER_STARTING, |
| 130 | CPUHP_AP_RISCV_TIMER_STARTING, | 130 | CPUHP_AP_RISCV_TIMER_STARTING, |
| 131 | CPUHP_AP_CSKY_TIMER_STARTING, | 131 | CPUHP_AP_CSKY_TIMER_STARTING, |
| 132 | CPUHP_AP_HYPERV_TIMER_STARTING, | ||
| 132 | CPUHP_AP_KVM_STARTING, | 133 | CPUHP_AP_KVM_STARTING, |
| 133 | CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING, | 134 | CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING, |
| 134 | CPUHP_AP_KVM_ARM_VGIC_STARTING, | 135 | CPUHP_AP_KVM_ARM_VGIC_STARTING, |
| @@ -136,6 +137,7 @@ enum cpuhp_state { · 1 unmodified line | |||
| 136 | /* Must be the last timer callback */ | 137 | /* Must be the last timer callback */ |
| 137 | CPUHP_AP_DUMMY_TIMER_STARTING, | 138 | CPUHP_AP_DUMMY_TIMER_STARTING, |
| 138 | CPUHP_AP_ARM_XEN_STARTING, | 139 | CPUHP_AP_ARM_XEN_STARTING, |
| 140 | CPUHP_AP_ARM_KVMPV_STARTING, | ||
| 139 | CPUHP_AP_ARM_CORESIGHT_STARTING, | 141 | CPUHP_AP_ARM_CORESIGHT_STARTING, |
| 140 | CPUHP_AP_ARM64_ISNDEP_STARTING, | 142 | CPUHP_AP_ARM64_ISNDEP_STARTING, |
| 141 | CPUHP_AP_SMPCFD_DYING, | 143 | CPUHP_AP_SMPCFD_DYING, |
| @@ -29,10 +29,13 @@ struct cpuidle_driver; · 28 unmodified lines | |||
| 29 | * CPUIDLE DEVICE INTERFACE * | 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 | struct cpuidle_state_usage { | 35 | struct cpuidle_state_usage { |
| 33 | unsigned long long disable; | 36 | unsigned long long disable; |
| 34 | unsigned long long usage; | 37 | unsigned long long usage; |
| 35 | unsigned long long time; /* in US */ | 38 | u64 time_ns; |
| 36 | unsigned long long above; /* Number of times it's been too deep */ | 39 | unsigned long long above; /* Number of times it's been too deep */ |
| 37 | unsigned long long below; /* Number of times it's been too shallow */ | 40 | unsigned long long below; /* Number of times it's been too shallow */ |
| 38 | #ifdef CONFIG_SUSPEND | 41 | #ifdef CONFIG_SUSPEND |
| @@ -45,11 +48,12 @@ struct cpuidle_state { · 6 unmodified lines | |||
| 45 | char name[CPUIDLE_NAME_LEN]; | 48 | char name[CPUIDLE_NAME_LEN]; |
| 46 | char desc[CPUIDLE_DESC_LEN]; | 49 | char desc[CPUIDLE_DESC_LEN]; |
| 47 | 50 | ||
| 51 | u64 exit_latency_ns; | ||
| 52 | u64 target_residency_ns; | ||
| 48 | unsigned int flags; | 53 | unsigned int flags; |
| 49 | unsigned int exit_latency; /* in US */ | 54 | unsigned int exit_latency; /* in US */ |
| 50 | int power_usage; /* in mW */ | 55 | int power_usage; /* in mW */ |
| 51 | unsigned int target_residency; /* in US */ | 56 | unsigned int target_residency; /* in US */ |
| 52 | bool disabled; /* disabled on all CPUs */ | ||
| 53 | 57 | ||
| 54 | int (*enter) (struct cpuidle_device *dev, | 58 | int (*enter) (struct cpuidle_device *dev, |
| 55 | struct cpuidle_driver *drv, | 59 | struct cpuidle_driver *drv, |
| @@ -72,6 +76,7 @@ struct cpuidle_state { · 16 unmodified lines | |||
| 72 | #define CPUIDLE_FLAG_POLLING BIT(0) /* polling state */ | 76 | #define CPUIDLE_FLAG_POLLING BIT(0) /* polling state */ |
| 73 | #define CPUIDLE_FLAG_COUPLED BIT(1) /* state applies to multiple cpus */ | 77 | #define CPUIDLE_FLAG_COUPLED BIT(1) /* state applies to multiple cpus */ |
| 74 | #define CPUIDLE_FLAG_TIMER_STOP BIT(2) /* timer is stopped on this state */ | 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 | struct cpuidle_device_kobj; | 81 | struct cpuidle_device_kobj; |
| 77 | struct cpuidle_state_kobj; | 82 | struct cpuidle_state_kobj; |
| @@ -80,14 +85,14 @@ struct cpuidle_driver_kobj; · 2 unmodified lines | |||
| 80 | struct cpuidle_device { | 85 | struct cpuidle_device { |
| 81 | unsigned int registered:1; | 86 | unsigned int registered:1; |
| 82 | unsigned int enabled:1; | 87 | unsigned int enabled:1; |
| 83 | unsigned int use_deepest_state:1; | ||
| 84 | unsigned int poll_time_limit:1; | 88 | unsigned int poll_time_limit:1; |
| 85 | unsigned int cpu; | 89 | unsigned int cpu; |
| 86 | ktime_t next_hrtimer; | 90 | ktime_t next_hrtimer; |
| 87 | 91 | ||
| 88 | int last_state_idx; | 92 | int last_state_idx; |
| 89 | int last_residency; | 93 | u64 last_residency_ns; |
| 90 | u64 poll_limit_ns; | 94 | u64 poll_limit_ns; |
| 95 | u64 forced_idle_latency_limit_ns; | ||
| 91 | struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; | 96 | struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; |
| 92 | struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; | 97 | struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; |
| 93 | struct cpuidle_driver_kobj *kobj_driver; | 98 | struct cpuidle_driver_kobj *kobj_driver; |
| @@ -144,6 +149,8 @@ extern int cpuidle_register_driver(struct cpuidle_driver *drv); · 50 unmodified lines | |||
| 144 | extern struct cpuidle_driver *cpuidle_get_driver(void); | 149 | extern struct cpuidle_driver *cpuidle_get_driver(void); |
| 145 | extern struct cpuidle_driver *cpuidle_driver_ref(void); | 150 | extern struct cpuidle_driver *cpuidle_driver_ref(void); |
| 146 | extern void cpuidle_driver_unref(void); | 151 | extern void cpuidle_driver_unref(void); |
| 152 | extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx, | ||
| 153 | bool disable); | ||
| 147 | extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); | 154 | extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); |
| 148 | extern int cpuidle_register_device(struct cpuidle_device *dev); | 155 | extern int cpuidle_register_device(struct cpuidle_device *dev); |
| 149 | extern void cpuidle_unregister_device(struct cpuidle_device *dev); | 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 | static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } | 188 | static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } |
| 182 | static inline struct cpuidle_driver *cpuidle_driver_ref(void) {return NULL; } | 189 | static inline struct cpuidle_driver *cpuidle_driver_ref(void) {return NULL; } |
| 183 | static inline void cpuidle_driver_unref(void) {} | 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 | static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } | 193 | static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } |
| 185 | static inline int cpuidle_register_device(struct cpuidle_device *dev) | 194 | static inline int cpuidle_register_device(struct cpuidle_device *dev) |
| 186 | {return -ENODEV; } | 195 | {return -ENODEV; } |
| @@ -204,18 +213,20 @@ static inline struct cpuidle_device *cpuidle_get_device(void) {return NULL; } · 17 unmodified lines | |||
| 204 | 213 | ||
| 205 | #ifdef CONFIG_CPU_IDLE | 214 | #ifdef CONFIG_CPU_IDLE |
| 206 | extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | 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 | extern int cpuidle_enter_s2idle(struct cpuidle_driver *drv, | 218 | extern int cpuidle_enter_s2idle(struct cpuidle_driver *drv, |
| 209 | struct cpuidle_device *dev); | 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 | #else | 221 | #else |
| 212 | static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | 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 | {return -ENODEV; } | 225 | {return -ENODEV; } |
| 215 | static inline int cpuidle_enter_s2idle(struct cpuidle_driver *drv, | 226 | static inline int cpuidle_enter_s2idle(struct cpuidle_driver *drv, |
| 216 | struct cpuidle_device *dev) | 227 | struct cpuidle_device *dev) |
| 217 | {return -ENODEV; } | 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 | #endif | 232 | #endif |
| @@ -260,7 +271,7 @@ struct cpuidle_governor { · 38 unmodified lines | |||
| 260 | 271 | ||
| 261 | #ifdef CONFIG_CPU_IDLE | 272 | #ifdef CONFIG_CPU_IDLE |
| 262 | extern int cpuidle_register_governor(struct cpuidle_governor *gov); | 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 | #else | 275 | #else |
| 265 | static inline int cpuidle_register_governor(struct cpuidle_governor *gov) | 276 | static inline int cpuidle_register_governor(struct cpuidle_governor *gov) |
| 266 | {return 0;} | 277 | {return 0;} |
| @@ -41,8 +41,6 @@ · 40 unmodified lines | |||
| 41 | #define CRYPTO_ALG_TYPE_CIPHER 0x00000001 | 41 | #define CRYPTO_ALG_TYPE_CIPHER 0x00000001 |
| 42 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000002 | 42 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000002 |
| 43 | #define CRYPTO_ALG_TYPE_AEAD 0x00000003 | 43 | #define CRYPTO_ALG_TYPE_AEAD 0x00000003 |
| 44 | #define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 | ||
| 45 | #define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 | ||
| 46 | #define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005 | 44 | #define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005 |
| 47 | #define CRYPTO_ALG_TYPE_KPP 0x00000008 | 45 | #define CRYPTO_ALG_TYPE_KPP 0x00000008 |
| 48 | #define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a | 46 | #define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a |
| @@ -55,7 +53,6 @@ · 6 unmodified lines | |||
| 55 | 53 | ||
| 56 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e | 54 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e |
| 57 | #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e | 55 | #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e |
| 58 | #define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c | ||
| 59 | #define CRYPTO_ALG_TYPE_ACOMPRESS_MASK 0x0000000e | 56 | #define CRYPTO_ALG_TYPE_ACOMPRESS_MASK 0x0000000e |
| 60 | 57 | ||
| 61 | #define CRYPTO_ALG_LARVAL 0x00000010 | 58 | #define CRYPTO_ALG_LARVAL 0x00000010 |
| @@ -139,9 +136,7 @@ · 77 unmodified lines | |||
| 139 | #define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) | 136 | #define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) |
| 140 | 137 | ||
| 141 | struct scatterlist; | 138 | struct scatterlist; |
| 142 | struct crypto_ablkcipher; | ||
| 143 | struct crypto_async_request; | 139 | struct crypto_async_request; |
| 144 | struct crypto_blkcipher; | ||
| 145 | struct crypto_tfm; | 140 | struct crypto_tfm; |
| 146 | struct crypto_type; | 141 | struct crypto_type; |
| 147 | 142 | ||
| @@ -163,25 +158,6 @@ struct crypto_async_request { · 15 unmodified lines | |||
| 163 | u32 flags; | 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 | * DOC: Block Cipher Algorithm Definitions | 162 | * DOC: Block Cipher Algorithm Definitions |
| 187 | * | 163 | * |
| @@ -189,83 +165,6 @@ struct blkcipher_desc { · 1 unmodified line | |||
| 189 | * managed via crypto_register_alg() and crypto_unregister_alg(). | 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 | * struct cipher_alg - single-block symmetric ciphers definition | 169 | * struct cipher_alg - single-block symmetric ciphers definition |
| 271 | * @cia_min_keysize: Minimum key size supported by the transformation. This is | 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 | #endif /* CONFIG_CRYPTO_STATS */ | 350 | #endif /* CONFIG_CRYPTO_STATS */ |
| 452 | 351 | ||
| 453 | #define cra_ablkcipher cra_u.ablkcipher | ||
| 454 | #define cra_blkcipher cra_u.blkcipher | ||
| 455 | #define cra_cipher cra_u.cipher | 352 | #define cra_cipher cra_u.cipher |
| 456 | #define cra_compress cra_u.compress | 353 | #define cra_compress cra_u.compress |
| 457 | 354 | ||
| @@ -499,9 +396,8 @@ struct crypto_istat_rng { · 41 unmodified lines | |||
| 499 | * transformation algorithm. | 396 | * transformation algorithm. |
| 500 | * @cra_type: Type of the cryptographic transformation. This is a pointer to | 397 | * @cra_type: Type of the cryptographic transformation. This is a pointer to |
| 501 | * struct crypto_type, which implements callbacks common for all | 398 | * struct crypto_type, which implements callbacks common for all |
| 502 | * transformation types. There are multiple options: | 399 | * transformation types. There are multiple options, such as |
| 503 | * &crypto_blkcipher_type, &crypto_ablkcipher_type, | 400 | * &crypto_skcipher_type, &crypto_ahash_type, &crypto_rng_type. |
| 504 | * &crypto_ahash_type, &crypto_rng_type. | ||
| 505 | * This field might be empty. In that case, there are no common | 401 | * This field might be empty. In that case, there are no common |
| 506 | * callbacks. This is the case for: cipher, compress, shash. | 402 | * callbacks. This is the case for: cipher, compress, shash. |
| 507 | * @cra_u: Callbacks implementing the transformation. This is a union of | 403 | * @cra_u: Callbacks implementing the transformation. This is a union of |
| @@ -520,10 +416,6 @@ struct crypto_istat_rng { · 12 unmodified lines | |||
| 520 | * @cra_exit: Deinitialize the cryptographic transformation object. This is a | 416 | * @cra_exit: Deinitialize the cryptographic transformation object. This is a |
| 521 | * counterpart to @cra_init, used to remove various changes set in | 417 | * counterpart to @cra_init, used to remove various changes set in |
| 522 | * @cra_init. | 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 | * @cra_u.cipher: Union member which contains a single-block symmetric cipher | 419 | * @cra_u.cipher: Union member which contains a single-block symmetric cipher |
| 528 | * definition. See @struct @cipher_alg. | 420 | * definition. See @struct @cipher_alg. |
| 529 | * @cra_u.compress: Union member which contains a (de)compression algorithm. | 421 | * @cra_u.compress: Union member which contains a (de)compression algorithm. |
| @@ -565,8 +457,6 @@ struct crypto_alg { · 35 unmodified lines | |||
| 565 | const struct crypto_type *cra_type; | 457 | const struct crypto_type *cra_type; |
| 566 | 458 | ||
| 567 | union { | 459 | union { |
| 568 | struct ablkcipher_alg ablkcipher; | ||
| 569 | struct blkcipher_alg blkcipher; | ||
| 570 | struct cipher_alg cipher; | 460 | struct cipher_alg cipher; |
| 571 | struct compress_alg compress; | 461 | struct compress_alg compress; |
| 572 | } cra_u; | 462 | } cra_u; |
| @@ -594,8 +484,6 @@ struct crypto_alg { · 21 unmodified lines | |||
| 594 | #ifdef CONFIG_CRYPTO_STATS | 484 | #ifdef CONFIG_CRYPTO_STATS |
| 595 | void crypto_stats_init(struct crypto_alg *alg); | 485 | void crypto_stats_init(struct crypto_alg *alg); |
| 596 | void crypto_stats_get(struct crypto_alg *alg); | 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 | void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret); | 487 | void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret); |
| 600 | void crypto_stats_aead_decrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret); | 488 | void crypto_stats_aead_decrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret); |
| 601 | void crypto_stats_ahash_update(unsigned int nbytes, int ret, struct crypto_alg *alg); | 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 | static inline void crypto_stats_get(struct crypto_alg *alg) | 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 | static inline void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret) | 509 | static inline void crypto_stats_aead_encrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret) |
| 626 | {} | 510 | {} |
| 627 | static inline void crypto_stats_aead_decrypt(unsigned int cryptlen, struct crypto_alg *alg, int ret) | 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 | * crypto_free_*(), as well as the various helpers below. | 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 | struct cipher_tfm { | 602 | struct cipher_tfm { |
| 741 | int (*cit_setkey)(struct crypto_tfm *tfm, | 603 | int (*cit_setkey)(struct crypto_tfm *tfm, |
| 742 | const u8 *key, unsigned int keylen); | 604 | const u8 *key, unsigned int keylen); |
| @@ -753,8 +615,6 @@ struct compress_tfm { · 10 unmodified lines | |||
| 753 | u8 *dst, unsigned int *dlen); | 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 | #define crt_cipher crt_u.cipher | 618 | #define crt_cipher crt_u.cipher |
| 759 | #define crt_compress crt_u.compress | 619 | #define crt_compress crt_u.compress |
| 760 | 620 | ||
| @@ -763,8 +623,6 @@ struct crypto_tfm { · 2 unmodified lines | |||
| 763 | u32 crt_flags; | 623 | u32 crt_flags; |
| 764 | 624 | ||
| 765 | union { | 625 | union { |
| 766 | struct ablkcipher_tfm ablkcipher; | ||
| 767 | struct blkcipher_tfm blkcipher; | ||
| 768 | struct cipher_tfm cipher; | 626 | struct cipher_tfm cipher; |
| 769 | struct compress_tfm compress; | 627 | struct compress_tfm compress; |
| 770 | } crt_u; | 628 | } crt_u; |
| @@ -776,14 +634,6 @@ struct crypto_tfm { · 5 unmodified lines | |||
| 776 | void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; | 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 | struct crypto_cipher { | 637 | struct crypto_cipher { |
| 788 | struct crypto_tfm base; | 638 | struct crypto_tfm base; |
| 789 | }; | 639 | }; |
| @@ -891,713 +741,6 @@ static inline unsigned int crypto_tfm_ctx_alignment(void) · 101 unmodified lines | |||
| 891 | return __alignof__(tfm->__crt_ctx); | 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 | * DOC: Single Block Cipher API | 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 | return d_is_miss(dentry); | 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 | static inline bool d_is_positive(const struct dentry *dentry) | 448 | static inline bool d_is_positive(const struct dentry *dentry) |
| 444 | { | 449 | { |
| 445 | return !d_is_negative(dentry); | 450 | return !d_is_negative(dentry); |
| @@ -54,6 +54,8 @@ static const struct file_operations __fops = { \ · 53 unmodified lines | |||
| 54 | .llseek = no_llseek, \ | 54 | .llseek = no_llseek, \ |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | typedef struct vfsmount *(*debugfs_automount_t)(struct dentry *, void *); | ||
| 58 | |||
| 57 | #if defined(CONFIG_DEBUG_FS) | 59 | #if defined(CONFIG_DEBUG_FS) |
| 58 | 60 | ||
| 59 | struct dentry *debugfs_lookup(const char *name, struct dentry *parent); | 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 | struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, | 77 | struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, |
| 76 | const char *dest); | 78 | const char *dest); |
| 77 | 79 | ||
| 78 | typedef struct vfsmount *(*debugfs_automount_t)(struct dentry *, void *); | ||
| 79 | struct dentry *debugfs_create_automount(const char *name, | 80 | struct dentry *debugfs_create_automount(const char *name, |
| 80 | struct dentry *parent, | 81 | struct dentry *parent, |
| 81 | debugfs_automount_t f, | 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 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | 98 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, |
| 98 | struct dentry *new_dir, const char *new_name); | 99 | struct dentry *new_dir, const char *new_name); |
| 99 | 100 | ||
| 100 | struct dentry *debugfs_create_u8(const char *name, umode_t mode, | 101 | void debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent, |
| 101 | struct dentry *parent, u8 *value); | 102 | u8 *value); |
| 102 | struct dentry *debugfs_create_u16(const char *name, umode_t mode, | 103 | void debugfs_create_u16(const char *name, umode_t mode, struct dentry *parent, |
| 103 | struct dentry *parent, u16 *value); | 104 | u16 *value); |
| 104 | struct dentry *debugfs_create_u32(const char *name, umode_t mode, | 105 | struct dentry *debugfs_create_u32(const char *name, umode_t mode, |
| 105 | struct dentry *parent, u32 *value); | 106 | struct dentry *parent, u32 *value); |
| 106 | struct dentry *debugfs_create_u64(const char *name, umode_t mode, | 107 | void debugfs_create_u64(const char *name, umode_t mode, struct dentry *parent, |
| 107 | struct dentry *parent, u64 *value); | 108 | u64 *value); |
| 108 | struct dentry *debugfs_create_ulong(const char *name, umode_t mode, | 109 | struct dentry *debugfs_create_ulong(const char *name, umode_t mode, |
| 109 | struct dentry *parent, unsigned long *value); | 110 | struct dentry *parent, unsigned long *value); |
| 110 | struct dentry *debugfs_create_x8(const char *name, umode_t mode, | 111 | void debugfs_create_x8(const char *name, umode_t mode, struct dentry *parent, |
| 111 | struct dentry *parent, u8 *value); | 112 | u8 *value); |
| 112 | struct dentry *debugfs_create_x16(const char *name, umode_t mode, | 113 | void debugfs_create_x16(const char *name, umode_t mode, struct dentry *parent, |
| 113 | struct dentry *parent, u16 *value); | 114 | u16 *value); |
| 114 | struct dentry *debugfs_create_x32(const char *name, umode_t mode, | 115 | void debugfs_create_x32(const char *name, umode_t mode, struct dentry *parent, |
| 115 | struct dentry *parent, u32 *value); | 116 | u32 *value); |
| 116 | struct dentry *debugfs_create_x64(const char *name, umode_t mode, | 117 | void debugfs_create_x64(const char *name, umode_t mode, struct dentry *parent, |
| 117 | struct dentry *parent, u64 *value); | 118 | u64 *value); |
| 118 | struct dentry *debugfs_create_size_t(const char *name, umode_t mode, | 119 | void debugfs_create_size_t(const char *name, umode_t mode, |
| 119 | struct dentry *parent, size_t *value); | 120 | struct dentry *parent, size_t *value); |
| 120 | struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode, | 121 | void debugfs_create_atomic_t(const char *name, umode_t mode, |
| 121 | struct dentry *parent, atomic_t *value); | 122 | struct dentry *parent, atomic_t *value); |
| 122 | struct dentry *debugfs_create_bool(const char *name, umode_t mode, | 123 | struct dentry *debugfs_create_bool(const char *name, umode_t mode, |
| 123 | struct dentry *parent, bool *value); | 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 | static inline struct dentry *debugfs_create_automount(const char *name, | 205 | static inline struct dentry *debugfs_create_automount(const char *name, |
| 205 | struct dentry *parent, | 206 | struct dentry *parent, |
| 206 | struct vfsmount *(*f)(void *), | 207 | debugfs_automount_t f, |
| 207 | void *data) | 208 | void *data) |
| 208 | { | 209 | { |
| 209 | return ERR_PTR(-ENODEV); | 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 | return ERR_PTR(-ENODEV); | 245 | return ERR_PTR(-ENODEV); |
| 245 | } | 246 | } |
| 246 | 247 | ||
| 247 | static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode, | 248 | static inline void debugfs_create_u8(const char *name, umode_t mode, |
| 248 | struct dentry *parent, | 249 | struct dentry *parent, u8 *value) { } |
| 249 | u8 *value) | ||
| 250 | { | ||
| 251 | return ERR_PTR(-ENODEV); | ||
| 252 | } | ||
| 253 | 250 | ||
| 254 | static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode, | 251 | static inline void debugfs_create_u16(const char *name, umode_t mode, |
| 255 | struct dentry *parent, | 252 | struct dentry *parent, u16 *value) { } |
| 256 | u16 *value) | ||
| 257 | { | ||
| 258 | return ERR_PTR(-ENODEV); | ||
| 259 | } | ||
| 260 | 253 | ||
| 261 | static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode, | 254 | static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode, |
| 262 | struct dentry *parent, | 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 | return ERR_PTR(-ENODEV); | 258 | return ERR_PTR(-ENODEV); |
| 266 | } | 259 | } |
| 267 | 260 | ||
| 268 | static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode, | 261 | static inline void debugfs_create_u64(const char *name, umode_t mode, |
| 269 | struct dentry *parent, | 262 | struct dentry *parent, u64 *value) { } |
| 270 | u64 *value) | ||
| 271 | { | ||
| 272 | return ERR_PTR(-ENODEV); | ||
| 273 | } | ||
| 274 | 263 | ||
| 275 | static inline struct dentry *debugfs_create_ulong(const char *name, | 264 | static inline struct dentry *debugfs_create_ulong(const char *name, |
| 276 | umode_t mode, | 265 | umode_t mode, |
| @@ -280,46 +269,26 @@ static inline struct dentry *debugfs_create_ulong(const char *name, · 3 unmodified lines | |||
| 280 | return ERR_PTR(-ENODEV); | 269 | return ERR_PTR(-ENODEV); |
| 281 | } | 270 | } |
| 282 | 271 | ||
| 283 | static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode, | 272 | static inline void debugfs_create_x8(const char *name, umode_t mode, |
| 284 | struct dentry *parent, | 273 | struct dentry *parent, u8 *value) { } |
| 285 | u8 *value) | ||
| 286 | { | ||
| 287 | return ERR_PTR(-ENODEV); | ||
| 288 | } | ||
| 289 | 274 | ||
| 290 | static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode, | 275 | static inline void debugfs_create_x16(const char *name, umode_t mode, |
| 291 | struct dentry *parent, | 276 | struct dentry *parent, u16 *value) { } |
| 292 | u16 *value) | ||
| 293 | { | ||
| 294 | return ERR_PTR(-ENODEV); | ||
| 295 | } | ||
| 296 | 277 | ||
| 297 | static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode, | 278 | static inline void debugfs_create_x32(const char *name, umode_t mode, |
| 298 | struct dentry *parent, | 279 | struct dentry *parent, u32 *value) { } |
| 299 | u32 *value) | ||
| 300 | { | ||
| 301 | return ERR_PTR(-ENODEV); | ||
| 302 | } | ||
| 303 | 280 | ||
| 304 | static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode, | 281 | static inline void debugfs_create_x64(const char *name, umode_t mode, |
| 305 | struct dentry *parent, | 282 | struct dentry *parent, u64 *value) { } |
| 306 | u64 *value) | ||
| 307 | { | ||
| 308 | return ERR_PTR(-ENODEV); | ||
| 309 | } | ||
| 310 | 283 | ||
| 311 | static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode, | 284 | static inline void debugfs_create_size_t(const char *name, umode_t mode, |
| 312 | struct dentry *parent, | 285 | struct dentry *parent, size_t *value) |
| 313 | size_t *value) | 286 | { } |
| 314 | { | ||
| 315 | return ERR_PTR(-ENODEV); | ||
| 316 | } | ||
| 317 | 287 | ||
| 318 | static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode, | 288 | static inline void debugfs_create_atomic_t(const char *name, umode_t mode, |
| 319 | struct dentry *parent, atomic_t *value) | 289 | struct dentry *parent, |
| 320 | { | 290 | atomic_t *value) |
| 321 | return ERR_PTR(-ENODEV); | 291 | { } |
| 322 | } | ||
| 323 | 292 | ||
| 324 | static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode, | 293 | static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode, |
| 325 | struct dentry *parent, | 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 | #endif | 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 | #endif | 376 | #endif |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
| 14 | #include <linux/notifier.h> | 14 | #include <linux/notifier.h> |
| 15 | #include <linux/pm_opp.h> | 15 | #include <linux/pm_opp.h> |
| 16 | #include <linux/pm_qos.h> | ||
| 16 | 17 | ||
| 17 | #define DEVFREQ_NAME_LEN 16 | 18 | #define DEVFREQ_NAME_LEN 16 |
| 18 | 19 | ||
| @@ -123,8 +124,8 @@ struct devfreq_dev_profile { · 104 unmodified lines | |||
| 123 | * @previous_freq: previously configured frequency value. | 124 | * @previous_freq: previously configured frequency value. |
| 124 | * @data: Private data of the governor. The devfreq framework does not | 125 | * @data: Private data of the governor. The devfreq framework does not |
| 125 | * touch this. | 126 | * touch this. |
| 126 | * @min_freq: Limit minimum frequency requested by user (0: none) | 127 | * @user_min_freq_req: PM QoS minimum frequency request from user (via sysfs) |
| 127 | * @max_freq: Limit maximum frequency requested by user (0: none) | 128 | * @user_max_freq_req: PM QoS maximum frequency request from user (via sysfs) |
| 128 | * @scaling_min_freq: Limit minimum frequency requested by OPP interface | 129 | * @scaling_min_freq: Limit minimum frequency requested by OPP interface |
| 129 | * @scaling_max_freq: Limit maximum frequency requested by OPP interface | 130 | * @scaling_max_freq: Limit maximum frequency requested by OPP interface |
| 130 | * @stop_polling: devfreq polling status of a device. | 131 | * @stop_polling: devfreq polling status of a device. |
| @@ -136,6 +137,8 @@ struct devfreq_dev_profile { · 5 unmodified lines | |||
| 136 | * @time_in_state: Statistics of devfreq states | 137 | * @time_in_state: Statistics of devfreq states |
| 137 | * @last_stat_updated: The last time stat updated | 138 | * @last_stat_updated: The last time stat updated |
| 138 | * @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier | 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 | * This structure stores the devfreq information for a give device. | 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 | void *data; /* private data for governors */ | 165 | void *data; /* private data for governors */ |
| 163 | 166 | ||
| 164 | unsigned long min_freq; | 167 | struct dev_pm_qos_request user_min_freq_req; |
| 165 | unsigned long max_freq; | 168 | struct dev_pm_qos_request user_max_freq_req; |
| 166 | unsigned long scaling_min_freq; | 169 | unsigned long scaling_min_freq; |
| 167 | unsigned long scaling_max_freq; | 170 | unsigned long scaling_max_freq; |
| 168 | bool stop_polling; | 171 | bool stop_polling; |
| @@ -178,6 +181,9 @@ struct devfreq { · 9 unmodified lines | |||
| 178 | unsigned long last_stat_updated; | 181 | unsigned long last_stat_updated; |
| 179 | 182 | ||
| 180 | struct srcu_notifier_head transition_notifier_list; | 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 | struct devfreq_freqs { | 189 | struct devfreq_freqs { |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | struct dm_dev; | 17 | struct dm_dev; |
| 18 | struct dm_target; | 18 | struct dm_target; |
| 19 | struct dm_table; | 19 | struct dm_table; |
| 20 | struct dm_report_zones_args; | ||
| 20 | struct mapped_device; | 21 | struct mapped_device; |
| 21 | struct bio_vec; | 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 | typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, struct block_device **bdev); | 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 | typedef int (*dm_report_zones_fn) (struct dm_target *ti, |
| 97 | struct blk_zone *zones, | 98 | struct dm_report_zones_args *args, |
| 98 | unsigned int *nr_zones); | 99 | unsigned int nr_zones); |
| 99 | 100 | ||
| 100 | /* | 101 | /* |
| 101 | * These iteration functions are typically used to check (and combine) | 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 | int dm_suspended(struct dm_target *ti); | 423 | int dm_suspended(struct dm_target *ti); |
| 423 | int dm_noflush_suspending(struct dm_target *ti); | 424 | int dm_noflush_suspending(struct dm_target *ti); |
| 424 | void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors); | 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 | union map_info *dm_get_rq_mapinfo(struct request *rq); | 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 | * Device mapper functions to parse and create devices specified by the | 444 | * Device mapper functions to parse and create devices specified by the |
| 431 | * parameter "dm-mod.create=" | 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 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) | 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 | * Sector offset taken relative to the start of the target instead of | 612 | * Sector offset taken relative to the start of the target instead of |
| 602 | * relative to the start of the device. | 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 | * that generate uevents to add the environment variables. | 80 | * that generate uevents to add the environment variables. |
| 81 | * @probe: Called when a new device or driver add to this bus, and callback | 81 | * @probe: Called when a new device or driver add to this bus, and callback |
| 82 | * the specific driver's probe to initial the matched device. | 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 | * @remove: Called when a device removed from this bus. | 90 | * @remove: Called when a device removed from this bus. |
| 84 | * @shutdown: Called at shut-down time to quiesce the device. | 91 | * @shutdown: Called at shut-down time to quiesce the device. |
| 85 | * | 92 | * |
| @@ -123,6 +130,7 @@ struct bus_type { · 37 unmodified lines | |||
| 123 | int (*match)(struct device *dev, struct device_driver *drv); | 130 | int (*match)(struct device *dev, struct device_driver *drv); |
| 124 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); | 131 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
| 125 | int (*probe)(struct device *dev); | 132 | int (*probe)(struct device *dev); |
| 133 | void (*sync_state)(struct device *dev); | ||
| 126 | int (*remove)(struct device *dev); | 134 | int (*remove)(struct device *dev); |
| 127 | void (*shutdown)(struct device *dev); | 135 | void (*shutdown)(struct device *dev); |
| 128 | 136 | ||
| @@ -340,6 +348,13 @@ enum probe_type { · 211 unmodified lines | |||
| 340 | * @probe: Called to query the existence of a specific device, | 348 | * @probe: Called to query the existence of a specific device, |
| 341 | * whether this driver can work with it, and bind the driver | 349 | * whether this driver can work with it, and bind the driver |
| 342 | * to a specific device. | 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 | * @remove: Called when the device is removed from the system to | 358 | * @remove: Called when the device is removed from the system to |
| 344 | * unbind a device from this driver. | 359 | * unbind a device from this driver. |
| 345 | * @shutdown: Called at shut-down time to quiesce the device. | 360 | * @shutdown: Called at shut-down time to quiesce the device. |
| @@ -379,6 +394,7 @@ struct device_driver { · 33 unmodified lines | |||
| 379 | const struct acpi_device_id *acpi_match_table; | 394 | const struct acpi_device_id *acpi_match_table; |
| 380 | 395 | ||
| 381 | int (*probe) (struct device *dev); | 396 | int (*probe) (struct device *dev); |
| 397 | void (*sync_state)(struct device *dev); | ||
| 382 | int (*remove) (struct device *dev); | 398 | int (*remove) (struct device *dev); |
| 383 | void (*shutdown) (struct device *dev); | 399 | void (*shutdown) (struct device *dev); |
| 384 | int (*suspend) (struct device *dev, pm_message_t state); | 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 | void __iomem *devm_ioremap_resource(struct device *dev, | 963 | void __iomem *devm_ioremap_resource(struct device *dev, |
| 948 | const struct resource *res); | 964 | const struct resource *res); |
| 965 | void __iomem *devm_ioremap_resource_wc(struct device *dev, | ||
| 966 | const struct resource *res); | ||
| 949 | 967 | ||
| 950 | void __iomem *devm_of_iomap(struct device *dev, | 968 | void __iomem *devm_of_iomap(struct device *dev, |
| 951 | struct device_node *node, int index, | 969 | struct device_node *node, int index, |
| @@ -1080,6 +1098,7 @@ enum device_link_state { · 128 unmodified lines | |||
| 1080 | * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind. | 1098 | * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind. |
| 1081 | * AUTOPROBE_CONSUMER: Probe consumer driver automatically after supplier binds. | 1099 | * AUTOPROBE_CONSUMER: Probe consumer driver automatically after supplier binds. |
| 1082 | * MANAGED: The core tracks presence of supplier/consumer drivers (internal). | 1100 | * MANAGED: The core tracks presence of supplier/consumer drivers (internal). |
| 1101 | * SYNC_STATE_ONLY: Link only affects sync_state() behavior. | ||
| 1083 | */ | 1102 | */ |
| 1084 | #define DL_FLAG_STATELESS BIT(0) | 1103 | #define DL_FLAG_STATELESS BIT(0) |
| 1085 | #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1) | 1104 | #define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1) |
| @@ -1088,6 +1107,7 @@ enum device_link_state { · 2 unmodified lines | |||
| 1088 | #define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4) | 1107 | #define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4) |
| 1089 | #define DL_FLAG_AUTOPROBE_CONSUMER BIT(5) | 1108 | #define DL_FLAG_AUTOPROBE_CONSUMER BIT(5) |
| 1090 | #define DL_FLAG_MANAGED BIT(6) | 1109 | #define DL_FLAG_MANAGED BIT(6) |
| 1110 | #define DL_FLAG_SYNC_STATE_ONLY BIT(7) | ||
| 1091 | 1111 | ||
| 1092 | /** | 1112 | /** |
| 1093 | * struct device_link - Device link representation. | 1113 | * struct device_link - Device link representation. |
| @@ -1135,11 +1155,18 @@ enum dl_dev_state { · 41 unmodified lines | |||
| 1135 | * struct dev_links_info - Device data related to device links. | 1155 | * struct dev_links_info - Device data related to device links. |
| 1136 | * @suppliers: List of links to supplier devices. | 1156 | * @suppliers: List of links to supplier devices. |
| 1137 | * @consumers: List of links to consumer devices. | 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 | * @status: Driver status information. | 1162 | * @status: Driver status information. |
| 1139 | */ | 1163 | */ |
| 1140 | struct dev_links_info { | 1164 | struct dev_links_info { |
| 1141 | struct list_head suppliers; | 1165 | struct list_head suppliers; |
| 1142 | struct list_head consumers; | 1166 | struct list_head consumers; |
| 1167 | struct list_head needs_suppliers; | ||
| 1168 | struct list_head defer_sync; | ||
| 1169 | bool need_for_probe; | ||
| 1143 | enum dl_dev_state status; | 1170 | enum dl_dev_state status; |
| 1144 | }; | 1171 | }; |
| 1145 | 1172 | ||
| @@ -1186,8 +1213,8 @@ struct dev_links_info { · 40 unmodified lines | |||
| 1186 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all | 1213 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all |
| 1187 | * hardware supports 64-bit addresses for consistent allocations | 1214 | * hardware supports 64-bit addresses for consistent allocations |
| 1188 | * such descriptors. | 1215 | * such descriptors. |
| 1189 | * @bus_dma_mask: Mask of an upstream bridge or bus which imposes a smaller DMA | 1216 | * @bus_dma_limit: Limit of an upstream bridge or bus which imposes a smaller |
| 1190 | * limit than the device itself supports. | 1217 | * DMA limit than the device itself supports. |
| 1191 | * @dma_pfn_offset: offset of DMA memory range relatively of RAM | 1218 | * @dma_pfn_offset: offset of DMA memory range relatively of RAM |
| 1192 | * @dma_parms: A low level driver may set these to teach IOMMU code about | 1219 | * @dma_parms: A low level driver may set these to teach IOMMU code about |
| 1193 | * segment limitations. | 1220 | * segment limitations. |
| @@ -1215,6 +1242,9 @@ struct dev_links_info { · 21 unmodified lines | |||
| 1215 | * @offline: Set after successful invocation of bus type's .offline(). | 1242 | * @offline: Set after successful invocation of bus type's .offline(). |
| 1216 | * @of_node_reused: Set if the device-tree node is shared with an ancestor | 1243 | * @of_node_reused: Set if the device-tree node is shared with an ancestor |
| 1217 | * device. | 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 | * @dma_coherent: this particular device is dma coherent, even if the | 1248 | * @dma_coherent: this particular device is dma coherent, even if the |
| 1219 | * architecture supports non-coherent devices. | 1249 | * architecture supports non-coherent devices. |
| 1220 | * | 1250 | * |
| @@ -1270,7 +1300,7 @@ struct device { · 49 unmodified lines | |||
| 1270 | not all hardware supports | 1300 | not all hardware supports |
| 1271 | 64 bit addresses for consistent | 1301 | 64 bit addresses for consistent |
| 1272 | allocations such descriptors. */ | 1302 | allocations such descriptors. */ |
| 1273 | u64 bus_dma_mask; /* upstream dma_mask constraint */ | 1303 | u64 bus_dma_limit; /* upstream dma constraint */ |
| 1274 | unsigned long dma_pfn_offset; | 1304 | unsigned long dma_pfn_offset; |
| 1275 | 1305 | ||
| 1276 | struct device_dma_parameters *dma_parms; | 1306 | struct device_dma_parameters *dma_parms; |
| @@ -1311,6 +1341,7 @@ struct device { · 34 unmodified lines | |||
| 1311 | bool offline_disabled:1; | 1341 | bool offline_disabled:1; |
| 1312 | bool offline:1; | 1342 | bool offline:1; |
| 1313 | bool of_node_reused:1; | 1343 | bool of_node_reused:1; |
| 1344 | bool state_synced:1; | ||
| 1314 | #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ | 1345 | #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ |
| 1315 | defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \ | 1346 | defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \ |
| 1316 | defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) | 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 | #ifdef CONFIG_DEVTMPFS | 1666 | #ifdef CONFIG_DEVTMPFS |
| 1636 | extern int devtmpfs_create_node(struct device *dev); | 1667 | extern int devtmpfs_create_node(struct device *dev); |
| 1637 | extern int devtmpfs_delete_node(struct device *dev); | 1668 | extern int devtmpfs_delete_node(struct device *dev); |
| 1638 | extern int devtmpfs_mount(const char *mntdir); | 1669 | extern int devtmpfs_mount(void); |
| 1639 | #else | 1670 | #else |
| 1640 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } | 1671 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } |
| 1641 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } | 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 | #endif | 1674 | #endif |
| 1644 | 1675 | ||
| 1645 | /* drivers/base/power/shutdown.c */ | 1676 | /* drivers/base/power/shutdown.c */ |
| @@ -1653,6 +1684,8 @@ struct device_link *device_link_add(struct device *consumer, · 7 unmodified lines | |||
| 1653 | struct device *supplier, u32 flags); | 1684 | struct device *supplier, u32 flags); |
| 1654 | void device_link_del(struct device_link *link); | 1685 | void device_link_del(struct device_link *link); |
| 1655 | void device_link_remove(void *consumer, struct device *supplier); | 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 | #ifndef dev_fmt | 1690 | #ifndef dev_fmt |
| 1658 | #define dev_fmt(fmt) fmt | 1691 | #define dev_fmt(fmt) fmt |
| @@ -12,26 +12,15 @@ · 11 unmodified lines | |||
| 12 | #define DEVCG_DEV_ALL 4 /* this represents all devices */ | 12 | #define DEVCG_DEV_ALL 4 /* this represents all devices */ |
| 13 | 13 | ||
| 14 | #ifdef CONFIG_CGROUP_DEVICE | 14 | #ifdef CONFIG_CGROUP_DEVICE |
| 15 | extern int __devcgroup_check_permission(short type, u32 major, u32 minor, | 15 | int devcgroup_check_permission(short type, u32 major, u32 minor, |
| 16 | short access); | 16 | short access); |
| 17 | #else | 17 | #else |
| 18 | static inline int __devcgroup_check_permission(short type, u32 major, u32 minor, | 18 | static inline int devcgroup_check_permission(short type, u32 major, u32 minor, |
| 19 | short access) | 19 | short access) |
| 20 | { return 0; } | 20 | { return 0; } |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | #if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF) | 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 | static inline int devcgroup_inode_permission(struct inode *inode, int mask) | 24 | static inline int devcgroup_inode_permission(struct inode *inode, int mask) |
| 36 | { | 25 | { |
| 37 | short type, access = 0; | 26 | short type, access = 0; |
| @@ -4,22 +4,26 @@ · 3 unmodified lines | |||
| 4 | #ifndef DIM_H | 4 | #ifndef DIM_H |
| 5 | #define DIM_H | 5 | #define DIM_H |
| 6 | 6 | ||
| 7 | #include <linux/bits.h> | ||
| 8 | #include <linux/kernel.h> | ||
| 7 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| 10 | #include <linux/types.h> | ||
| 11 | #include <linux/workqueue.h> | ||
| 8 | 12 | ||
| 9 | /** | 13 | /* |
| 10 | * Number of events between DIM iterations. | 14 | * Number of events between DIM iterations. |
| 11 | * Causes a moderation of the algorithm run. | 15 | * Causes a moderation of the algorithm run. |
| 12 | */ | 16 | */ |
| 13 | #define DIM_NEVENTS 64 | 17 | #define DIM_NEVENTS 64 |
| 14 | 18 | ||
| 15 | /** | 19 | /* |
| 16 | * Is a difference between values justifies taking an action. | 20 | * Is a difference between values justifies taking an action. |
| 17 | * We consider 10% difference as significant. | 21 | * We consider 10% difference as significant. |
| 18 | */ | 22 | */ |
| 19 | #define IS_SIGNIFICANT_DIFF(val, ref) \ | 23 | #define IS_SIGNIFICANT_DIFF(val, ref) \ |
| 20 | (((100UL * abs((val) - (ref))) / (ref)) > 10) | 24 | (((100UL * abs((val) - (ref))) / (ref)) > 10) |
| 21 | 25 | ||
| 22 | /** | 26 | /* |
| 23 | * Calculate the gap between two values. | 27 | * Calculate the gap between two values. |
| 24 | * Take wrap-around and variable size into consideration. | 28 | * Take wrap-around and variable size into consideration. |
| 25 | */ | 29 | */ |
| @@ -27,12 +31,13 @@ · 1 unmodified line | |||
| 27 | & (BIT_ULL(bits) - 1)) | 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 | * Used for communications between DIM and its consumer. | 35 | * Used for communications between DIM and its consumer. |
| 32 | * | 36 | * |
| 33 | * @usec: CQ timer suggestion (by DIM) | 37 | * @usec: CQ timer suggestion (by DIM) |
| 34 | * @pkts: CQ packet counter suggestion (by DIM) | 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 | struct dim_cq_moder { | 42 | struct dim_cq_moder { |
| 38 | u16 usec; | 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 | * Used for communications between DIM and its consumer. | 51 | * Used for communications between DIM and its consumer. |
| 47 | * | 52 | * |
| 48 | * @time: Sample timestamp | 53 | * @time: Sample timestamp |
| 49 | * @pkt_ctr: Number of packets | 54 | * @pkt_ctr: Number of packets |
| 50 | * @byte_ctr: Number of bytes | 55 | * @byte_ctr: Number of bytes |
| 51 | * @event_ctr: Number of events | 56 | * @event_ctr: Number of events |
| 57 | * @comp_ctr: Current completion counter | ||
| 52 | */ | 58 | */ |
| 53 | struct dim_sample { | 59 | struct dim_sample { |
| 54 | ktime_t time; | 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 | * Used for holding current measured rates. | 69 | * Used for holding current measured rates. |
| 64 | * | 70 | * |
| 65 | * @ppms: Packets per msec | 71 | * @ppms: Packets per msec |
| 66 | * @bpms: Bytes per msec | 72 | * @bpms: Bytes per msec |
| 67 | * @epms: Events per msec | 73 | * @epms: Events per msec |
| 74 | * @cpms: Completions per msec | ||
| 75 | * @cpe_ratio: Ratio of completions to events | ||
| 68 | */ | 76 | */ |
| 69 | struct dim_stats { | 77 | struct dim_stats { |
| 70 | int ppms; /* packets per msec */ | 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 | * Used for holding all information about a specific DIM instance. | 87 | * Used for holding all information about a specific DIM instance. |
| 80 | * | 88 | * |
| 81 | * @state: Algorithm state (see below) | 89 | * @state: Algorithm state (see below) |
| 82 | * @prev_stats: Measured rates from previous iteration (for comparison) | 90 | * @prev_stats: Measured rates from previous iteration (for comparison) |
| 83 | * @start_sample: Sampled data at start of current iteration | 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 | * @work: Work to perform on action required | 93 | * @work: Work to perform on action required |
| 85 | * @priv: A pointer to the struct that points to dim | 94 | * @priv: A pointer to the struct that points to dim |
| 86 | * @profile_ix: Current moderation profile | 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 | 118 | * enum dim_cq_period_mode - Modes for CQ period count |
| 110 | * | ||
| 111 | * These are the modes for CQ period count. | ||
| 112 | * | 119 | * |
| 113 | * @DIM_CQ_PERIOD_MODE_START_FROM_EQE: Start counting from EQE | 120 | * @DIM_CQ_PERIOD_MODE_START_FROM_EQE: Start counting from EQE |
| 114 | * @DIM_CQ_PERIOD_MODE_START_FROM_CQE: Start counting from CQE (implies timer reset) | 121 | * @DIM_CQ_PERIOD_MODE_START_FROM_CQE: Start counting from CQE (implies timer reset) |
| 115 | * @DIM_CQ_PERIOD_NUM_MODES: Number of modes | 122 | * @DIM_CQ_PERIOD_NUM_MODES: Number of modes |
| 116 | */ | 123 | */ |
| 117 | enum { | 124 | enum dim_cq_period_mode { |
| 118 | DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, | 125 | DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, |
| 119 | DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, | 126 | DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, |
| 120 | DIM_CQ_PERIOD_NUM_MODES | 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 | * These will determine if the algorithm is in a valid state to start an iteration. | 133 | * These will determine if the algorithm is in a valid state to start an iteration. |
| 128 | * | 134 | * |
| 129 | * @DIM_START_MEASURE: This is the first iteration (also after applying a new profile) | 135 | * @DIM_START_MEASURE: This is the first iteration (also after applying a new profile) |
| @@ -131,16 +137,15 @@ enum { · 1 unmodified line | |||
| 131 | * need to perform an action | 137 | * need to perform an action |
| 132 | * @DIM_APPLY_NEW_PROFILE: DIM consumer is currently applying a profile - no need to measure | 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 | DIM_START_MEASURE, | 141 | DIM_START_MEASURE, |
| 136 | DIM_MEASURE_IN_PROGRESS, | 142 | DIM_MEASURE_IN_PROGRESS, |
| 137 | DIM_APPLY_NEW_PROFILE, | 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 | * These will determine which action the algorithm should perform. | 149 | * These will determine which action the algorithm should perform. |
| 145 | * | 150 | * |
| 146 | * @DIM_PARKING_ON_TOP: Algorithm found a local top point - exit on significant difference | 151 | * @DIM_PARKING_ON_TOP: Algorithm found a local top point - exit on significant difference |
| @@ -148,7 +153,7 @@ enum { · 1 unmodified line | |||
| 148 | * @DIM_GOING_RIGHT: Algorithm is currently trying higher moderation levels | 153 | * @DIM_GOING_RIGHT: Algorithm is currently trying higher moderation levels |
| 149 | * @DIM_GOING_LEFT: Algorithm is currently trying lower moderation levels | 154 | * @DIM_GOING_LEFT: Algorithm is currently trying lower moderation levels |
| 150 | */ | 155 | */ |
| 151 | enum { | 156 | enum dim_tune_state { |
| 152 | DIM_PARKING_ON_TOP, | 157 | DIM_PARKING_ON_TOP, |
| 153 | DIM_PARKING_TIRED, | 158 | DIM_PARKING_TIRED, |
| 154 | DIM_GOING_RIGHT, | 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 | * These will determine the verdict of current iteration. | 166 | * These will determine the verdict of current iteration. |
| 163 | * | 167 | * |
| 164 | * @DIM_STATS_WORSE: Current iteration shows worse performance than before | 168 | * @DIM_STATS_WORSE: Current iteration shows worse performance than before |
| 165 | * @DIM_STATS_WORSE: Current iteration shows same performance than before | 169 | * @DIM_STATS_SAME: Current iteration shows same performance than before |
| 166 | * @DIM_STATS_WORSE: Current iteration shows better performance than before | 170 | * @DIM_STATS_BETTER: Current iteration shows better performance than before |
| 167 | */ | 171 | */ |
| 168 | enum { | 172 | enum dim_stats_state { |
| 169 | DIM_STATS_WORSE, | 173 | DIM_STATS_WORSE, |
| 170 | DIM_STATS_SAME, | 174 | DIM_STATS_SAME, |
| 171 | DIM_STATS_BETTER, | 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 | * These describe the result of a step. | 181 | * These describe the result of a step. |
| 179 | * | 182 | * |
| 180 | * @DIM_STEPPED: Performed a regular step | 183 | * @DIM_STEPPED: Performed a regular step |
| @@ -182,7 +185,7 @@ enum { · 1 unmodified line | |||
| 182 | * tired parking | 185 | * tired parking |
| 183 | * @DIM_ON_EDGE: Stepped to the most left/right profile | 186 | * @DIM_ON_EDGE: Stepped to the most left/right profile |
| 184 | */ | 187 | */ |
| 185 | enum { | 188 | enum dim_step_result { |
| 186 | DIM_STEPPED, | 189 | DIM_STEPPED, |
| 187 | DIM_TOO_TIRED, | 190 | DIM_TOO_TIRED, |
| 188 | DIM_ON_EDGE, | 191 | DIM_ON_EDGE, |
| @@ -199,7 +202,7 @@ enum { · 10 unmodified lines | |||
| 199 | bool dim_on_top(struct dim *dim); | 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 | * @dim: DIM context | 206 | * @dim: DIM context |
| 204 | * | 207 | * |
| 205 | * Go left if we were going right and vice-versa. | 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 | struct dim_stats *curr_stats); | 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 | * @event_ctr: number of events to set | 245 | * @event_ctr: number of events to set |
| 243 | * @packets: number of packets to set | 246 | * @packets: number of packets to set |
| 244 | * @bytes: number of bytes to set | 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 | * @end_sample: Current data measurement | 307 | * @end_sample: Current data measurement |
| 305 | * | 308 | * |
| 306 | * Called by the consumer. | 309 | * Called by the consumer. |
| 307 | * This is the main logic of the algorithm, where data is processed in order to decide on next | 310 | * This is the main logic of the algorithm, where data is processed in order |
| 308 | * required action. | 311 | * to decide on next required action. |
| 309 | */ | 312 | */ |
| 310 | void net_dim(struct dim *dim, struct dim_sample end_sample); | 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 | bool cache_sgt_mapping; | 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 | * @attach: | 58 | * @attach: |
| 47 | * | 59 | * |
| @@ -109,6 +121,9 @@ struct dma_buf_ops { · 61 unmodified lines | |||
| 109 | * any other kind of sharing that the exporter might wish to make | 121 | * any other kind of sharing that the exporter might wish to make |
| 110 | * available to buffer-users. | 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 | * Returns: | 127 | * Returns: |
| 113 | * | 128 | * |
| 114 | * A &sg_table scatter list of or the backing storage of the DMA buffer, | 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 | * struct dma_buf - shared buffer object | 282 | * struct dma_buf - shared buffer object |
| 268 | * @size: size of the buffer | 283 | * @size: size of the buffer |
| 269 | * @file: file pointer used for sharing buffers across, and for refcounting. | 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 | * @ops: dma_buf_ops associated with this buffer object. | 287 | * @ops: dma_buf_ops associated with this buffer object. |
| 272 | * @lock: used internally to serialize list manipulation, attach/detach and | 288 | * @lock: used internally to serialize list manipulation, attach/detach and |
| 273 | * vmap/unmap, and accesses to name | 289 | * vmap/unmap |
| 274 | * @vmapping_counter: used internally to refcnt the vmaps | 290 | * @vmapping_counter: used internally to refcnt the vmaps |
| 275 | * @vmap_ptr: the current vmap ptr if vmapping_counter > 0 | 291 | * @vmap_ptr: the current vmap ptr if vmapping_counter > 0 |
| 276 | * @exp_name: name of the exporter; useful for debugging. | 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 | * @owner: pointer to exporter module; used for refcounting when exporter is a | 295 | * @owner: pointer to exporter module; used for refcounting when exporter is a |
| 279 | * kernel module. | 296 | * kernel module. |
| 280 | * @list_node: node for dma_buf accounting and debugging. | 297 | * @list_node: node for dma_buf accounting and debugging. |
| @@ -323,10 +340,12 @@ struct dma_buf { · 42 unmodified lines | |||
| 323 | * struct dma_buf_attachment - holds device-buffer attachment data | 340 | * struct dma_buf_attachment - holds device-buffer attachment data |
| 324 | * @dmabuf: buffer for this attachment. | 341 | * @dmabuf: buffer for this attachment. |
| 325 | * @dev: device attached to the buffer. | 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 | * @sgt: cached mapping. | 344 | * @sgt: cached mapping. |
| 328 | * @dir: direction of cached mapping. | 345 | * @dir: direction of cached mapping. |
| 329 | * @priv: exporter specific attachment data. | 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 | * This structure holds the attachment information between the dma_buf buffer | 350 | * This structure holds the attachment information between the dma_buf buffer |
| 332 | * and its user device(s). The list contains one attachment struct per device | 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 | struct list_head node; | 362 | struct list_head node; |
| 344 | struct sg_table *sgt; | 363 | struct sg_table *sgt; |
| 345 | enum dma_data_direction dir; | 364 | enum dma_data_direction dir; |
| 365 | bool dynamic_mapping; | ||
| 346 | void *priv; | 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 | get_file(dmabuf->file); | 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 | struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, | 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 | void dma_buf_detach(struct dma_buf *dmabuf, | 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 | struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info); | 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 | enum dma_data_direction); | 459 | enum dma_data_direction); |
| 410 | void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *, | 460 | void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *, |
| 411 | enum dma_data_direction); | 461 | enum dma_data_direction); |
| 462 | void dma_buf_move_notify(struct dma_buf *dma_buf); | ||
| 412 | int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, | 463 | int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, |
| 413 | enum dma_data_direction dir); | 464 | enum dma_data_direction dir); |
| 414 | int dma_buf_end_cpu_access(struct dma_buf *dma_buf, | 465 | int dma_buf_end_cpu_access(struct dma_buf *dma_buf, |
| @@ -3,8 +3,11 @@ · 2 unmodified lines | |||
| 3 | #define _LINUX_DMA_DIRECT_H 1 | 3 | #define _LINUX_DMA_DIRECT_H 1 |
| 4 | 4 | ||
| 5 | #include <linux/dma-mapping.h> | 5 | #include <linux/dma-mapping.h> |
| 6 | #include <linux/memblock.h> /* for min_low_pfn */ | ||
| 6 | #include <linux/mem_encrypt.h> | 7 | #include <linux/mem_encrypt.h> |
| 7 | 8 | ||
| 9 | extern unsigned int zone_dma_bits; | ||
| 10 | |||
| 8 | #ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA | 11 | #ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA |
| 9 | #include <asm/dma-direct.h> | 12 | #include <asm/dma-direct.h> |
| 10 | #else | 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 | return paddr + ((phys_addr_t)dev->dma_pfn_offset << PAGE_SHIFT); | 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 | #endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */ | 27 | #endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */ |
| 34 | 28 | ||
| 35 | #ifdef CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED | 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 | return __sme_clr(__dma_to_phys(dev, daddr)); | 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 | u64 dma_direct_get_required_mask(struct device *dev); | 69 | u64 dma_direct_get_required_mask(struct device *dev); |
| 61 | void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, | 70 | void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, |
| 62 | gfp_t gfp, unsigned long attrs); | 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 | void dma_direct_free_pages(struct device *dev, size_t size, void *cpu_addr, | 76 | void dma_direct_free_pages(struct device *dev, size_t size, void *cpu_addr, |
| 68 | dma_addr_t dma_addr, unsigned long attrs); | 77 | dma_addr_t dma_addr, unsigned long attrs); |
| 69 | struct page *__dma_direct_alloc_pages(struct device *dev, size_t size, | 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); | 79 | gfp_t gfp, unsigned long attrs); |
| 71 | void __dma_direct_free_pages(struct device *dev, size_t size, struct page *page); | 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 | int dma_direct_supported(struct device *dev, u64 mask); | 87 | int dma_direct_supported(struct device *dev, u64 mask); |
| 73 | #endif /* _LINUX_DMA_DIRECT_H */ | 88 | #endif /* _LINUX_DMA_DIRECT_H */ |
| @@ -15,11 +15,8 @@ · 14 unmodified lines | |||
| 15 | /** | 15 | /** |
| 16 | * List of possible attributes associated with a DMA mapping. The semantics | 16 | * List of possible attributes associated with a DMA mapping. The semantics |
| 17 | * of each attribute should be defined in Documentation/DMA-attributes.txt. | 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 | * DMA_ATTR_WEAK_ORDERING: Specifies that reads and writes to the mapping | 21 | * DMA_ATTR_WEAK_ORDERING: Specifies that reads and writes to the mapping |
| 25 | * may be weakly ordered, that is that reads and writes may pass each other. | 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 | int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma, | 159 | int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma, |
| 163 | void *cpu_addr, size_t size, int *ret); | 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 | int dma_release_from_global_coherent(int order, void *vaddr); | 163 | int dma_release_from_global_coherent(int order, void *vaddr); |
| 167 | int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr, | 164 | int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr, |
| 168 | size_t size, int *ret); | 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 | #define dma_release_from_dev_coherent(dev, order, vaddr) (0) | 169 | #define dma_release_from_dev_coherent(dev, order, vaddr) (0) |
| 173 | #define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0) | 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 | dma_addr_t *dma_handle) | 173 | dma_addr_t *dma_handle) |
| 177 | { | 174 | { |
| 178 | return NULL; | 175 | return NULL; |
| @@ -583,6 +580,10 @@ static inline unsigned long dma_get_merge_boundary(struct device *dev) · 404 unmodified lines | |||
| 583 | static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, | 580 | static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, |
| 584 | size_t size, enum dma_data_direction dir, unsigned long attrs) | 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 | debug_dma_map_single(dev, ptr, size); | 587 | debug_dma_map_single(dev, ptr, size); |
| 587 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr), | 588 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr), |
| 588 | size, dir, attrs); | 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 | static inline bool dma_addressing_limited(struct device *dev) | 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 | dma_get_required_mask(dev); | 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 | gfp_t gfp, unsigned long attrs); | 41 | gfp_t gfp, unsigned long attrs); |
| 42 | void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, | 42 | void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, |
| 43 | dma_addr_t dma_addr, unsigned long attrs); | 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 | #ifdef CONFIG_MMU | 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 | #endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */ | 73 | #endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */ |
| 76 | 74 | ||
| 77 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE | 75 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE |
| 78 | void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, | 76 | void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, |
| 79 | size_t size, enum dma_data_direction dir); | 77 | enum dma_data_direction dir); |
| 80 | #else | 78 | #else |
| 81 | static inline void arch_sync_dma_for_device(struct device *dev, | 79 | static inline void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, |
| 82 | phys_addr_t paddr, size_t size, enum dma_data_direction dir) | 80 | enum dma_data_direction dir) |
| 83 | { | 81 | { |
| 84 | } | 82 | } |
| 85 | #endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */ | 83 | #endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */ |
| 86 | 84 | ||
| 87 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU | 85 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU |
| 88 | void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, | 86 | void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, |
| 89 | size_t size, enum dma_data_direction dir); | 87 | enum dma_data_direction dir); |
| 90 | #else | 88 | #else |
| 91 | static inline void arch_sync_dma_for_cpu(struct device *dev, | 89 | static inline void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, |
| 92 | phys_addr_t paddr, size_t size, enum dma_data_direction dir) | 90 | enum dma_data_direction dir) |
| 93 | { | 91 | { |
| 94 | } | 92 | } |
| 95 | #endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */ | 93 | #endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */ |
| 96 | 94 | ||
| 97 | #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL | 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 | #else | 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 | #endif /* CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL */ | 101 | #endif /* CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL */ |
| @@ -118,6 +118,9 @@ enum sprd_dma_int_type { · 117 unmodified lines | |||
| 118 | * struct sprd_dma_linklist - DMA link-list address structure | 118 | * struct sprd_dma_linklist - DMA link-list address structure |
| 119 | * @virt_addr: link-list virtual address to configure link-list node | 119 | * @virt_addr: link-list virtual address to configure link-list node |
| 120 | * @phy_addr: link-list physical address to link DMA transfer | 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 | * The Spreadtrum DMA controller supports the link-list mode, that means slaves | 125 | * The Spreadtrum DMA controller supports the link-list mode, that means slaves |
| 123 | * can supply several groups configurations (each configuration represents one | 126 | * can supply several groups configurations (each configuration represents one |
| @@ -181,6 +184,7 @@ enum sprd_dma_int_type { · 57 unmodified lines | |||
| 181 | struct sprd_dma_linklist { | 184 | struct sprd_dma_linklist { |
| 182 | unsigned long virt_addr; | 185 | unsigned long virt_addr; |
| 183 | phys_addr_t phy_addr; | 186 | phys_addr_t phy_addr; |
| 187 | phys_addr_t wrap_addr; | ||
| 184 | }; | 188 | }; |
| 185 | 189 | ||
| 186 | #endif | 190 | #endif |
| @@ -129,6 +129,7 @@ static inline int dmar_res_noop(struct acpi_dmar_header *hdr, void *arg) · 128 unmodified lines | |||
| 129 | #ifdef CONFIG_INTEL_IOMMU | 129 | #ifdef CONFIG_INTEL_IOMMU |
| 130 | extern int iommu_detected, no_iommu; | 130 | extern int iommu_detected, no_iommu; |
| 131 | extern int intel_iommu_init(void); | 131 | extern int intel_iommu_init(void); |
| 132 | extern void intel_iommu_shutdown(void); | ||
| 132 | extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg); | 133 | extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg); |
| 133 | extern int dmar_parse_one_atsr(struct acpi_dmar_header *header, void *arg); | 134 | extern int dmar_parse_one_atsr(struct acpi_dmar_header *header, void *arg); |
| 134 | extern int dmar_check_one_atsr(struct acpi_dmar_header *hdr, void *arg); | 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 | extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info); | 138 | extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info); |
| 138 | #else /* !CONFIG_INTEL_IOMMU: */ | 139 | #else /* !CONFIG_INTEL_IOMMU: */ |
| 139 | static inline int intel_iommu_init(void) { return -ENODEV; } | 140 | static inline int intel_iommu_init(void) { return -ENODEV; } |
| 141 | static inline void intel_iommu_shutdown(void) { } | ||
| 140 | 142 | ||
| 141 | #define dmar_parse_one_rmrr dmar_res_noop | 143 | #define dmar_parse_one_rmrr dmar_res_noop |
| 142 | #define dmar_parse_one_atsr dmar_res_noop | 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 | extern bool dmi_match(enum dmi_field f, const char *str); | 113 | extern bool dmi_match(enum dmi_field f, const char *str); |
| 114 | extern void dmi_memdev_name(u16 handle, const char **bank, const char **device); | 114 | extern void dmi_memdev_name(u16 handle, const char **bank, const char **device); |
| 115 | extern u64 dmi_memdev_size(u16 handle); | 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 | #else | 119 | #else |
| 118 | 120 | ||
| @@ -142,6 +144,8 @@ static inline bool dmi_match(enum dmi_field f, const char *str) · 23 unmodified lines | |||
| 142 | static inline void dmi_memdev_name(u16 handle, const char **bank, | 144 | static inline void dmi_memdev_name(u16 handle, const char **bank, |
| 143 | const char **device) { } | 145 | const char **device) { } |
| 144 | static inline u64 dmi_memdev_size(u16 handle) { return ~0ul; } | 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 | static inline const struct dmi_system_id * | 149 | static inline const struct dmi_system_id * |
| 146 | dmi_first_match(const struct dmi_system_id *list) { return NULL; } | 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 | #define EDAC_MAX_LAYERS 3 | 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 | struct dimm_info { | 365 | struct dimm_info { |
| 438 | struct device dev; | 366 | struct device dev; |
| 439 | 367 | ||
| @@ -443,6 +371,7 @@ struct dimm_info { · 3 unmodified lines | |||
| 443 | unsigned int location[EDAC_MAX_LAYERS]; | 371 | unsigned int location[EDAC_MAX_LAYERS]; |
| 444 | 372 | ||
| 445 | struct mem_ctl_info *mci; /* the parent */ | 373 | struct mem_ctl_info *mci; /* the parent */ |
| 374 | unsigned int idx; /* index within the parent dimm array */ | ||
| 446 | 375 | ||
| 447 | u32 grain; /* granularity of reported error in bytes */ | 376 | u32 grain; /* granularity of reported error in bytes */ |
| 448 | enum dev_type dtype; /* memory device type */ | 377 | enum dev_type dtype; /* memory device type */ |
| @@ -528,15 +457,10 @@ struct errcount_attribute_data { · 79 unmodified lines | |||
| 528 | * (typically, a memory controller error) | 457 | * (typically, a memory controller error) |
| 529 | */ | 458 | */ |
| 530 | struct edac_raw_error_desc { | 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 | char location[LOCATION_SIZE]; | 460 | char location[LOCATION_SIZE]; |
| 536 | char label[(EDAC_MC_LABEL_LEN + 1 + sizeof(OTHER_LABEL)) * EDAC_MAX_LABELS]; | 461 | char label[(EDAC_MC_LABEL_LEN + 1 + sizeof(OTHER_LABEL)) * EDAC_MAX_LABELS]; |
| 537 | long grain; | 462 | long grain; |
| 538 | 463 | ||
| 539 | /* the vars below and grain will be cleaned on every new error report */ | ||
| 540 | u16 error_count; | 464 | u16 error_count; |
| 541 | int top_layer; | 465 | int top_layer; |
| 542 | int mid_layer; | 466 | int mid_layer; |
| @@ -669,4 +593,70 @@ struct mem_ctl_info { · 126 unmodified lines | |||
| 669 | bool fake_inject_ue; | 593 | bool fake_inject_ue; |
| 670 | u16 fake_inject_count; | 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 | #define EFI_MEMORY_MORE_RELIABLE \ | 112 | #define EFI_MEMORY_MORE_RELIABLE \ |
| 113 | ((u64)0x0000000000010000ULL) /* higher reliability */ | 113 | ((u64)0x0000000000010000ULL) /* higher reliability */ |
| 114 | #define EFI_MEMORY_RO ((u64)0x0000000000020000ULL) /* read-only */ | 114 | #define EFI_MEMORY_RO ((u64)0x0000000000020000ULL) /* read-only */ |
| 115 | #define EFI_MEMORY_SP ((u64)0x0000000000040000ULL) /* soft reserved */ | ||
| 115 | #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL) /* range requires runtime mapping */ | 116 | #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL) /* range requires runtime mapping */ |
| 116 | #define EFI_MEMORY_DESCRIPTOR_VERSION 1 | 117 | #define EFI_MEMORY_DESCRIPTOR_VERSION 1 |
| 117 | 118 | ||
| @@ -823,7 +824,7 @@ typedef struct { · 705 unmodified lines | |||
| 823 | __aligned_u64 image_size; | 824 | __aligned_u64 image_size; |
| 824 | unsigned int image_code_type; | 825 | unsigned int image_code_type; |
| 825 | unsigned int image_data_type; | 826 | unsigned int image_data_type; |
| 826 | unsigned long unload; | 827 | u32 unload; |
| 827 | } efi_loaded_image_32_t; | 828 | } efi_loaded_image_32_t; |
| 828 | 829 | ||
| 829 | typedef struct { | 830 | typedef struct { |
| @@ -839,14 +840,14 @@ typedef struct { · 9 unmodified lines | |||
| 839 | __aligned_u64 image_size; | 840 | __aligned_u64 image_size; |
| 840 | unsigned int image_code_type; | 841 | unsigned int image_code_type; |
| 841 | unsigned int image_data_type; | 842 | unsigned int image_data_type; |
| 842 | unsigned long unload; | 843 | u64 unload; |
| 843 | } efi_loaded_image_64_t; | 844 | } efi_loaded_image_64_t; |
| 844 | 845 | ||
| 845 | typedef struct { | 846 | typedef struct { |
| 846 | u32 revision; | 847 | u32 revision; |
| 847 | void *parent_handle; | 848 | efi_handle_t parent_handle; |
| 848 | efi_system_table_t *system_table; | 849 | efi_system_table_t *system_table; |
| 849 | void *device_handle; | 850 | efi_handle_t device_handle; |
| 850 | void *file_path; | 851 | void *file_path; |
| 851 | void *reserved; | 852 | void *reserved; |
| 852 | u32 load_options_size; | 853 | u32 load_options_size; |
| @@ -855,7 +856,7 @@ typedef struct { · 2 unmodified lines | |||
| 855 | __aligned_u64 image_size; | 856 | __aligned_u64 image_size; |
| 856 | unsigned int image_code_type; | 857 | unsigned int image_code_type; |
| 857 | unsigned int image_data_type; | 858 | unsigned int image_data_type; |
| 858 | unsigned long unload; | 859 | efi_status_t (*unload)(efi_handle_t image_handle); |
| 859 | } efi_loaded_image_t; | 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 | extern efi_status_t efi_query_variable_store(u32 attributes, | 1045 | extern efi_status_t efi_query_variable_store(u32 attributes, |
| 1045 | unsigned long size, | 1046 | unsigned long size, |
| 1046 | bool nonblocking); | 1047 | bool nonblocking); |
| 1047 | extern void efi_find_mirror(void); | ||
| 1048 | #else | 1048 | #else |
| 1049 | 1049 | ||
| 1050 | static inline efi_status_t efi_query_variable_store(u32 attributes, | 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 | #define EFI_DBG 8 /* Print additional debug info at runtime */ | 1202 | #define EFI_DBG 8 /* Print additional debug info at runtime */ |
| 1203 | #define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */ | 1203 | #define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */ |
| 1204 | #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */ | 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 | #ifdef CONFIG_EFI | 1207 | #ifdef CONFIG_EFI |
| 1207 | /* | 1208 | /* |
| @@ -1212,6 +1213,14 @@ static inline bool efi_enabled(int feature) · 4 unmodified lines | |||
| 1212 | return test_bit(feature, &efi.flags) != 0; | 1213 | return test_bit(feature, &efi.flags) != 0; |
| 1213 | } | 1214 | } |
| 1214 | extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused); | 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 | #else | 1224 | #else |
| 1216 | static inline bool efi_enabled(int feature) | 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 | return false; | 1235 | return false; |
| 1227 | } | 1236 | } |
| 1237 | |||
| 1238 | static inline bool efi_soft_reserve_enabled(void) | ||
| 1239 | { | ||
| 1240 | return false; | ||
| 1241 | } | ||
| 1228 | #endif | 1242 | #endif |
| 1229 | 1243 | ||
| 1230 | extern int efi_status_to_err(efi_status_t status); | 1244 | extern int efi_status_to_err(efi_status_t status); |
| @@ -1645,6 +1659,8 @@ static inline void · 414 unmodified lines | |||
| 1645 | efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) { } | 1659 | efi_enable_reset_attack_mitigation(efi_system_table_t *sys_table_arg) { } |
| 1646 | #endif | 1660 | #endif |
| 1647 | 1661 | ||
| 1662 | efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg); | ||
| 1663 | |||
| 1648 | void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table); | 1664 | void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table); |
| 1649 | 1665 | ||
| 1650 | /* | 1666 | /* |
| @@ -9,7 +9,6 @@ · 8 unmodified lines | |||
| 9 | #include <linux/sched/topology.h> | 9 | #include <linux/sched/topology.h> |
| 10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
| 11 | 11 | ||
| 12 | #ifdef CONFIG_ENERGY_MODEL | ||
| 13 | /** | 12 | /** |
| 14 | * em_cap_state - Capacity state of a performance domain | 13 | * em_cap_state - Capacity state of a performance domain |
| 15 | * @frequency: The CPU frequency in KHz, for consistency with CPUFreq | 14 | * @frequency: The CPU frequency in KHz, for consistency with CPUFreq |
| @@ -40,6 +39,7 @@ struct em_perf_domain { · 24 unmodified lines | |||
| 40 | unsigned long cpus[0]; | 39 | unsigned long cpus[0]; |
| 41 | }; | 40 | }; |
| 42 | 41 | ||
| 42 | #ifdef CONFIG_ENERGY_MODEL | ||
| 43 | #define EM_CPU_MAX_POWER 0xFFFF | 43 | #define EM_CPU_MAX_POWER 0xFFFF |
| 44 | 44 | ||
| 45 | struct em_data_callback { | 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 | #else | 162 | #else |
| 163 | struct em_perf_domain {}; | ||
| 164 | struct em_data_callback {}; | 163 | struct em_data_callback {}; |
| 165 | #define EM_DATA_CB(_active_power_cb) { } | 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 | #ifndef _LINUX_EXPORT_H | 2 | #ifndef _LINUX_EXPORT_H |
| 2 | #define _LINUX_EXPORT_H | 3 | #define _LINUX_EXPORT_H |
| 3 | 4 | ||
| @@ -46,7 +47,7 @@ extern struct module __this_module; · 42 unmodified lines | |||
| 46 | * absolute relocations that require runtime processing on relocatable | 47 | * absolute relocations that require runtime processing on relocatable |
| 47 | * kernels. | 48 | * kernels. |
| 48 | */ | 49 | */ |
| 49 | #define __KSYMTAB_ENTRY_NS(sym, sec) \ | 50 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| 50 | __ADDRESSABLE(sym) \ | 51 | __ADDRESSABLE(sym) \ |
| 51 | asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ | 52 | asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ |
| 52 | " .balign 4 \n" \ | 53 | " .balign 4 \n" \ |
| @@ -56,33 +57,17 @@ extern struct module __this_module; · 3 unmodified lines | |||
| 56 | " .long __kstrtabns_" #sym "- . \n" \ | 57 | " .long __kstrtabns_" #sym "- . \n" \ |
| 57 | " .previous \n") | 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 | struct kernel_symbol { | 60 | struct kernel_symbol { |
| 70 | int value_offset; | 61 | int value_offset; |
| 71 | int name_offset; | 62 | int name_offset; |
| 72 | int namespace_offset; | 63 | int namespace_offset; |
| 73 | }; | 64 | }; |
| 74 | #else | 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 | #define __KSYMTAB_ENTRY(sym, sec) \ | 66 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| 82 | static const struct kernel_symbol __ksymtab_##sym \ | 67 | static const struct kernel_symbol __ksymtab_##sym \ |
| 83 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ | 68 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ |
| 84 | __aligned(sizeof(void *)) \ | 69 | __aligned(sizeof(void *)) \ |
| 85 | = { (unsigned long)&sym, __kstrtab_##sym, NULL } | 70 | = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } |
| 86 | 71 | ||
| 87 | struct kernel_symbol { | 72 | struct kernel_symbol { |
| 88 | unsigned long value; | 73 | unsigned long value; |
| @@ -93,28 +78,20 @@ struct kernel_symbol { · 4 unmodified lines | |||
| 93 | 78 | ||
| 94 | #ifdef __GENKSYMS__ | 79 | #ifdef __GENKSYMS__ |
| 95 | 80 | ||
| 96 | #define ___EXPORT_SYMBOL(sym,sec) __GENKSYMS_EXPORT_SYMBOL(sym) | 81 | #define ___EXPORT_SYMBOL(sym, sec, ns) __GENKSYMS_EXPORT_SYMBOL(sym) |
| 97 | #define ___EXPORT_SYMBOL_NS(sym,sec,ns) __GENKSYMS_EXPORT_SYMBOL(sym) | ||
| 98 | 82 | ||
| 99 | #else | 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 | extern typeof(sym) sym; \ | 87 | extern typeof(sym) sym; \ |
| 103 | __CRC_SYMBOL(sym, sec); \ | 88 | __CRC_SYMBOL(sym, sec); \ |
| 104 | static const char __kstrtab_##sym[] \ | 89 | static const char __kstrtab_##sym[] \ |
| 105 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ | 90 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ |
| 106 | = #sym \ | 91 | = #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); \ | ||
| 111 | static const char __kstrtabns_##sym[] \ | 92 | static const char __kstrtabns_##sym[] \ |
| 112 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ | 93 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ |
| 113 | = #ns; \ | 94 | = ns; \ |
| 114 | __KSYMTAB_ENTRY_NS(sym, sec) | ||
| 115 | |||
| 116 | #define ___EXPORT_SYMBOL(sym, sec) \ | ||
| 117 | ___export_symbol_common(sym, sec); \ | ||
| 118 | __KSYMTAB_ENTRY(sym, sec) | 95 | __KSYMTAB_ENTRY(sym, sec) |
| 119 | 96 | ||
| 120 | #endif | 97 | #endif |
| @@ -126,8 +103,7 @@ struct kernel_symbol { · 5 unmodified lines | |||
| 126 | * be reused in other execution contexts such as the UEFI stub or the | 103 | * be reused in other execution contexts such as the UEFI stub or the |
| 127 | * decompressor. | 104 | * decompressor. |
| 128 | */ | 105 | */ |
| 129 | #define __EXPORT_SYMBOL_NS(sym, sec, ns) | 106 | #define __EXPORT_SYMBOL(sym, sec, ns) |
| 130 | #define __EXPORT_SYMBOL(sym, sec) | ||
| 131 | 107 | ||
| 132 | #elif defined(CONFIG_TRIM_UNUSED_KSYMS) | 108 | #elif defined(CONFIG_TRIM_UNUSED_KSYMS) |
| 133 | 109 | ||
| @@ -143,48 +119,38 @@ struct kernel_symbol { · 9 unmodified lines | |||
| 143 | #define __ksym_marker(sym) \ | 119 | #define __ksym_marker(sym) \ |
| 144 | static int __ksym_marker_##sym[0] __section(".discard.ksym") __used | 120 | static int __ksym_marker_##sym[0] __section(".discard.ksym") __used |
| 145 | 121 | ||
| 146 | #define __EXPORT_SYMBOL(sym, sec) \ | 122 | #define __EXPORT_SYMBOL(sym, sec, ns) \ |
| 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) \ | ||
| 157 | __ksym_marker(sym); \ | 123 | __ksym_marker(sym); \ |
| 158 | __cond_export_ns_sym(sym, sec, ns, __is_defined(__KSYM_##sym)) | 124 | __cond_export_sym(sym, sec, ns, __is_defined(__KSYM_##sym)) |
| 159 | #define __cond_export_ns_sym(sym, sec, ns, conf) \ | 125 | #define __cond_export_sym(sym, sec, ns, conf) \ |
| 160 | ___cond_export_ns_sym(sym, sec, ns, conf) | 126 | ___cond_export_sym(sym, sec, ns, conf) |
| 161 | #define ___cond_export_ns_sym(sym, sec, ns, enabled) \ | 127 | #define ___cond_export_sym(sym, sec, ns, enabled) \ |
| 162 | __cond_export_ns_sym_##enabled(sym, sec, ns) | 128 | __cond_export_sym_##enabled(sym, sec, ns) |
| 163 | #define __cond_export_ns_sym_1(sym, sec, ns) ___EXPORT_SYMBOL_NS(sym, sec, ns) | 129 | #define __cond_export_sym_1(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns) |
| 164 | #define __cond_export_ns_sym_0(sym, sec, ns) /* nothing */ | 130 | #define __cond_export_sym_0(sym, sec, ns) /* nothing */ |
| 165 | 131 | ||
| 166 | #else | 132 | #else |
| 167 | 133 | ||
| 168 | #define __EXPORT_SYMBOL_NS(sym,sec,ns) ___EXPORT_SYMBOL_NS(sym,sec,ns) | 134 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns) |
| 169 | #define __EXPORT_SYMBOL(sym,sec) ___EXPORT_SYMBOL(sym,sec) | ||
| 170 | 135 | ||
| 171 | #endif /* CONFIG_MODULES */ | 136 | #endif /* CONFIG_MODULES */ |
| 172 | 137 | ||
| 173 | #ifdef DEFAULT_SYMBOL_NAMESPACE | 138 | #ifdef DEFAULT_SYMBOL_NAMESPACE |
| 174 | #undef __EXPORT_SYMBOL | 139 | #include <linux/stringify.h> |
| 175 | #define __EXPORT_SYMBOL(sym, sec) \ | 140 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, __stringify(DEFAULT_SYMBOL_NAMESPACE)) |
| 176 | __EXPORT_SYMBOL_NS(sym, sec, DEFAULT_SYMBOL_NAMESPACE) | 141 | #else |
| 142 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "") | ||
| 177 | #endif | 143 | #endif |
| 178 | 144 | ||
| 179 | #define EXPORT_SYMBOL(sym) __EXPORT_SYMBOL(sym, "") | 145 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "") |
| 180 | #define EXPORT_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_gpl") | 146 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl") |
| 181 | #define EXPORT_SYMBOL_GPL_FUTURE(sym) __EXPORT_SYMBOL(sym, "_gpl_future") | 147 | #define EXPORT_SYMBOL_GPL_FUTURE(sym) _EXPORT_SYMBOL(sym, "_gpl_future") |
| 182 | #define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL_NS(sym, "", ns) | 148 | #define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns) |
| 183 | #define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL_NS(sym, "_gpl", ns) | 149 | #define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns) |
| 184 | 150 | ||
| 185 | #ifdef CONFIG_UNUSED_SYMBOLS | 151 | #ifdef CONFIG_UNUSED_SYMBOLS |
| 186 | #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") | 152 | #define EXPORT_UNUSED_SYMBOL(sym) _EXPORT_SYMBOL(sym, "_unused") |
| 187 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") | 153 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_unused_gpl") |
| 188 | #else | 154 | #else |
| 189 | #define EXPORT_UNUSED_SYMBOL(sym) | 155 | #define EXPORT_UNUSED_SYMBOL(sym) |
| 190 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) | 156 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) |
| @@ -104,6 +104,11 @@ enum fid_type { · 103 unmodified lines | |||
| 104 | */ | 104 | */ |
| 105 | FILEID_LUSTRE = 0x97, | 105 | FILEID_LUSTRE = 0x97, |
| 106 | 106 | ||
| 107 | /* | ||
| 108 | * 64 bit unique kernfs id | ||
| 109 | */ | ||
| 110 | FILEID_KERNFS = 0xfe, | ||
| 111 | |||
| 107 | /* | 112 | /* |
| 108 | * Filesystems must not use 0xff file ID. | 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 | #endif /*CONFIG_MODULES*/ | 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 | #endif /* _LINUX_EXTABLE_H */ | 46 | #endif /* _LINUX_EXTABLE_H */ |
| @@ -20,7 +20,10 @@ struct space_resv { · 19 unmodified lines | |||
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | #define FS_IOC_RESVSP _IOW('X', 40, struct space_resv) | 22 | #define FS_IOC_RESVSP _IOW('X', 40, struct space_resv) |
| 23 | #define FS_IOC_UNRESVSP _IOW('X', 41, struct space_resv) | ||
| 23 | #define FS_IOC_RESVSP64 _IOW('X', 42, struct space_resv) | 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 | #define FALLOC_FL_SUPPORTED_MASK (FALLOC_FL_KEEP_SIZE | \ | 28 | #define FALLOC_FL_SUPPORTED_MASK (FALLOC_FL_KEEP_SIZE | \ |
| 26 | FALLOC_FL_PUNCH_HOLE | \ | 29 | FALLOC_FL_PUNCH_HOLE | \ |
| @@ -29,4 +32,27 @@ struct space_resv { · 2 unmodified lines | |||
| 29 | FALLOC_FL_INSERT_RANGE | \ | 32 | FALLOC_FL_INSERT_RANGE | \ |
| 30 | FALLOC_FL_UNSHARE_RANGE) | 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 | #endif /* _FALLOC_H_ */ | 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 | extern int register_framebuffer(struct fb_info *fb_info); | 607 | extern int register_framebuffer(struct fb_info *fb_info); |
| 608 | extern void unregister_framebuffer(struct fb_info *fb_info); | 608 | extern void unregister_framebuffer(struct fb_info *fb_info); |
| 609 | extern void unlink_framebuffer(struct fb_info *fb_info); | 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 | const char *name); | 611 | const char *name); |
| 612 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, | 612 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, |
| 613 | const char *name, bool primary); | 613 | const char *name, bool primary); |
| @@ -65,6 +65,9 @@ struct ctl_table_header; · 64 unmodified lines | |||
| 65 | /* unused opcode to mark special call to bpf_tail_call() helper */ | 65 | /* unused opcode to mark special call to bpf_tail_call() helper */ |
| 66 | #define BPF_TAIL_CALL 0xf0 | 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 | /* unused opcode to mark call to interpreter with arguments */ | 71 | /* unused opcode to mark call to interpreter with arguments */ |
| 69 | #define BPF_CALL_ARGS 0xe0 | 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 | #define BPF_FIELD_SIZEOF(type, field) \ | 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 | BUILD_BUG_ON(__size < 0); \ | 424 | BUILD_BUG_ON(__size < 0); \ |
| 422 | __size; \ | 425 | __size; \ |
| 423 | }) | 426 | }) |
| @@ -464,10 +467,11 @@ static inline bool insn_is_zext(const struct bpf_insn *insn) · 40 unmodified lines | |||
| 464 | #define BPF_CALL_x(x, name, ...) \ | 467 | #define BPF_CALL_x(x, name, ...) \ |
| 465 | static __always_inline \ | 468 | static __always_inline \ |
| 466 | u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ | 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 | u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ | 471 | u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ |
| 468 | u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ | 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 | static __always_inline \ | 476 | static __always_inline \ |
| 473 | u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) | 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 | #define bpf_target_off(TYPE, MEMBER, SIZE, PTR_SIZE) \ | 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 | *(PTR_SIZE) = (SIZE); \ | 501 | *(PTR_SIZE) = (SIZE); \ |
| 498 | offsetof(TYPE, MEMBER); \ | 502 | offsetof(TYPE, MEMBER); \ |
| 499 | }) | 503 | }) |
| @@ -511,10 +515,12 @@ struct sock_fprog_kern { · 11 unmodified lines | |||
| 511 | struct sock_filter *filter; | 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 | struct bpf_binary_header { | 521 | struct bpf_binary_header { |
| 515 | u32 pages; | 522 | u32 pages; |
| 516 | /* Some arches need word alignment for their instructions */ | 523 | u8 image[] __aligned(BPF_IMAGE_ALIGNMENT); |
| 517 | u8 image[] __aligned(4); | ||
| 518 | }; | 524 | }; |
| 519 | 525 | ||
| 520 | struct bpf_prog { | 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 | struct bpf_skb_data_end *cb = (struct bpf_skb_data_end *)skb->cb; | 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 | cb->data_meta = skb->data - skb_metadata_len(skb); | 612 | cb->data_meta = skb->data - skb_metadata_len(skb); |
| 607 | cb->data_end = skb->data + skb_headlen(skb); | 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 | * attached to sockets, we need to clear the bpf_skb_cb() area | 646 | * attached to sockets, we need to clear the bpf_skb_cb() area |
| 641 | * to not leak previous contents to user space. | 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); | 649 | BUILD_BUG_ON(sizeof_field(struct __sk_buff, cb) != BPF_SKB_CB_LEN); |
| 644 | BUILD_BUG_ON(FIELD_SIZEOF(struct __sk_buff, cb) != | 650 | BUILD_BUG_ON(sizeof_field(struct __sk_buff, cb) != |
| 645 | FIELD_SIZEOF(struct qdisc_skb_cb, data)); | 651 | sizeof_field(struct qdisc_skb_cb, data)); |
| 646 | 652 | ||
| 647 | return qdisc_skb_cb(skb)->data; | 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 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) | 777 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) |
| 772 | { | 778 | { |
| 773 | set_vm_flush_reset_perms(fp); | 779 | #ifndef CONFIG_BPF_JIT_ALWAYS_ON |
| 774 | set_memory_ro((unsigned long)fp, fp->pages); | 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 | static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) | 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 | void bpf_jit_free_exec(void *addr); | 956 | void bpf_jit_free_exec(void *addr); |
| 947 | void bpf_jit_free(struct bpf_prog *fp); | 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 | int bpf_jit_get_func_addr(const struct bpf_prog *prog, | 962 | int bpf_jit_get_func_addr(const struct bpf_prog *prog, |
| 950 | const struct bpf_insn *insn, bool extra_pass, | 963 | const struct bpf_insn *insn, bool extra_pass, |
| 951 | u64 *func_addr, bool *func_addr_fixed); | 964 | u64 *func_addr, bool *func_addr_fixed); |
| @@ -1044,11 +1057,23 @@ static inline bool ebpf_jit_enabled(void) · 92 unmodified lines | |||
| 1044 | return false; | 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 | static inline bool bpf_prog_ebpf_jited(const struct bpf_prog *fp) | 1065 | static inline bool bpf_prog_ebpf_jited(const struct bpf_prog *fp) |
| 1048 | { | 1066 | { |
| 1049 | return false; | 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 | static inline void bpf_jit_free(struct bpf_prog *fp) | 1077 | static inline void bpf_jit_free(struct bpf_prog *fp) |
| 1053 | { | 1078 | { |
| 1054 | bpf_prog_unlock_free(fp); | 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 | * SVC_STATUS_RSU_OK: | 42 | * SVC_STATUS_RSU_OK: |
| 43 | * Secure firmware accepts the request of remote status update (RSU). | 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 | #define SVC_STATUS_RECONFIG_REQUEST_OK 0 | 51 | #define SVC_STATUS_RECONFIG_REQUEST_OK 0 |
| 46 | #define SVC_STATUS_RECONFIG_BUFFER_SUBMITTED 1 | 52 | #define SVC_STATUS_RECONFIG_BUFFER_SUBMITTED 1 |
| @@ -50,6 +56,8 @@ · 3 unmodified lines | |||
| 50 | #define SVC_STATUS_RECONFIG_ERROR 5 | 56 | #define SVC_STATUS_RECONFIG_ERROR 5 |
| 51 | #define SVC_STATUS_RSU_OK 6 | 57 | #define SVC_STATUS_RSU_OK 6 |
| 52 | #define SVC_STATUS_RSU_ERROR 7 | 58 | #define SVC_STATUS_RSU_ERROR 7 |
| 59 | #define SVC_STATUS_RSU_NO_SUPPORT 8 | ||
| 60 | |||
| 53 | /** | 61 | /** |
| 54 | * Flag bit for COMMAND_RECONFIG | 62 | * Flag bit for COMMAND_RECONFIG |
| 55 | * | 63 | * |
| @@ -16,11 +16,14 @@ enum { · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | struct meson_sm_firmware; | 17 | struct meson_sm_firmware; |
| 18 | 18 | ||
| 19 | int meson_sm_call(unsigned int cmd_index, u32 *ret, u32 arg0, u32 arg1, | 19 | int meson_sm_call(struct meson_sm_firmware *fw, unsigned int cmd_index, |
| 20 | u32 arg2, u32 arg3, u32 arg4); | 20 | u32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); |
| 21 | int meson_sm_call_write(void *buffer, unsigned int b_size, unsigned int cmd_index, | 21 | int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer, |
| 22 | u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); | 22 | unsigned int b_size, unsigned int cmd_index, u32 arg0, |
| 23 | int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index, | 23 | u32 arg1, u32 arg2, u32 arg3, u32 arg4); |
| 24 | u32 arg0, 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 | #endif /* _MESON_SM_FW_H_ */ | 29 | #endif /* _MESON_SM_FW_H_ */ |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | /* | 2 | /* |
| 3 | * Xilinx Zynq MPSoC Firmware layer | 3 | * Xilinx Zynq MPSoC Firmware layer |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2014-2018 Xilinx | 5 | * Copyright (C) 2014-2019 Xilinx |
| 6 | * | 6 | * |
| 7 | * Michal Simek <michal.simek@xilinx.com> | 7 | * Michal Simek <michal.simek@xilinx.com> |
| 8 | * Davorin Mista <davorin.mista@aggios.com> | 8 | * Davorin Mista <davorin.mista@aggios.com> |
| @@ -46,6 +46,7 @@ · 37 unmodified lines | |||
| 46 | #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U | 46 | #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U |
| 47 | #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U | 47 | #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U |
| 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U | 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U |
| 49 | #define ZYNQMP_PM_CAPABILITY_UNUSABLE 0x8U | ||
| 49 | 50 | ||
| 50 | /* | 51 | /* |
| 51 | * Firmware FPGA Manager flags | 52 | * Firmware FPGA Manager flags |
| @@ -91,7 +92,8 @@ enum pm_ret_status { · 39 unmodified lines | |||
| 91 | }; | 92 | }; |
| 92 | 93 | ||
| 93 | enum pm_ioctl_id { | 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 | IOCTL_GET_PLL_FRAC_MODE, | 97 | IOCTL_GET_PLL_FRAC_MODE, |
| 96 | IOCTL_SET_PLL_FRAC_DATA, | 98 | IOCTL_SET_PLL_FRAC_DATA, |
| 97 | IOCTL_GET_PLL_FRAC_DATA, | 99 | IOCTL_GET_PLL_FRAC_DATA, |
| @@ -250,6 +252,16 @@ enum zynqmp_pm_request_ack { · 152 unmodified lines | |||
| 250 | ZYNQMP_PM_REQUEST_ACK_NON_BLOCKING, | 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 | * struct zynqmp_pm_query_data - PM query data | 266 | * struct zynqmp_pm_query_data - PM query data |
| 255 | * @qid: query ID | 267 | * @qid: query ID |
| @@ -1727,6 +1727,13 @@ int vfs_mkobj(struct dentry *, umode_t, · 1726 unmodified lines | |||
| 1727 | 1727 | ||
| 1728 | extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 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 | * VFS file helper functions. | 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 | /* fs/ioctl.c */ | 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 | /* fs/dcache.c */ | 2559 | /* fs/dcache.c */ |
| 2553 | extern void __init vfs_caches_init_early(void); | 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 | extern void bd_abort_claiming(struct block_device *bdev, | 2639 | extern void bd_abort_claiming(struct block_device *bdev, |
| 2633 | struct block_device *whole, void *holder); | 2640 | struct block_device *whole, void *holder); |
| 2634 | extern void blkdev_put(struct block_device *bdev, fmode_t mode); | 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 | #ifdef CONFIG_SYSFS | 2643 | #ifdef CONFIG_SYSFS |
| 2639 | extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); | 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 | extern bool is_bad_inode(struct inode *); | 2708 | extern bool is_bad_inode(struct inode *); |
| 2704 | 2709 | ||
| 2705 | #ifdef CONFIG_BLOCK | 2710 | #ifdef CONFIG_BLOCK |
| 2706 | extern void check_disk_size_change(struct gendisk *disk, | ||
| 2707 | struct block_device *bdev, bool verbose); | ||
| 2708 | extern int revalidate_disk(struct gendisk *); | 2711 | extern int revalidate_disk(struct gendisk *); |
| 2709 | extern int check_disk_change(struct block_device *); | 2712 | extern int check_disk_change(struct block_device *); |
| 2710 | extern int __invalidate_device(struct block_device *, bool); | 2713 | extern int __invalidate_device(struct block_device *, bool); |
| @@ -3153,7 +3156,6 @@ enum { · 442 unmodified lines | |||
| 3153 | }; | 3156 | }; |
| 3154 | 3157 | ||
| 3155 | void dio_end_io(struct bio *bio); | 3158 | void dio_end_io(struct bio *bio); |
| 3156 | void dio_warn_stale_pagecache(struct file *filp); | ||
| 3157 | 3159 | ||
| 3158 | ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, | 3160 | ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, |
| 3159 | struct block_device *bdev, struct iov_iter *iter, | 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 | wake_up_bit(&inode->i_state, __I_DIO_WAKEUP); | 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 | extern void inode_set_flags(struct inode *inode, unsigned int flags, | 3208 | extern void inode_set_flags(struct inode *inode, unsigned int flags, |
| 3202 | unsigned int mask); | 3209 | unsigned int mask); |
| 3203 | 3210 | ||
| @@ -20,7 +20,6 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | #define FS_CRYPTO_BLOCK_SIZE 16 | 21 | #define FS_CRYPTO_BLOCK_SIZE 16 |
| 22 | 22 | ||
| 23 | struct fscrypt_ctx; | ||
| 24 | struct fscrypt_info; | 23 | struct fscrypt_info; |
| 25 | 24 | ||
| 26 | struct fscrypt_str { | 25 | struct fscrypt_str { |
| @@ -62,18 +61,9 @@ struct fscrypt_operations { · 35 unmodified lines | |||
| 62 | bool (*dummy_context)(struct inode *); | 61 | bool (*dummy_context)(struct inode *); |
| 63 | bool (*empty_dir)(struct inode *); | 62 | bool (*empty_dir)(struct inode *); |
| 64 | unsigned int max_namelen; | 63 | unsigned int max_namelen; |
| 65 | }; | 64 | bool (*has_stable_inodes)(struct super_block *sb); |
| 66 | 65 | void (*get_ino_and_lblk_bits)(struct super_block *sb, | |
| 67 | /* Decryption work */ | 66 | int *ino_bits_ret, int *lblk_bits_ret); |
| 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 */ | ||
| 77 | }; | 67 | }; |
| 78 | 68 | ||
| 79 | static inline bool fscrypt_has_encryption_key(const struct inode *inode) | 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 | /* crypto.c */ | 93 | /* crypto.c */ |
| 104 | extern void fscrypt_enqueue_decrypt_work(struct work_struct *); | 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 | extern struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, | 96 | extern struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, |
| 109 | unsigned int len, | 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 | /* bio.c */ | 233 | /* bio.c */ |
| 246 | extern void fscrypt_decrypt_bio(struct bio *); | 234 | extern void fscrypt_decrypt_bio(struct bio *); |
| 247 | extern void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, | ||
| 248 | struct bio *bio); | ||
| 249 | extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t, | 235 | extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t, |
| 250 | unsigned int); | 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 | static inline struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, | 284 | static inline struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, |
| 309 | unsigned int len, | 285 | unsigned int len, |
| 310 | unsigned int offs, | 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 | static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, | 463 | static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, |
| 493 | sector_t pblk, unsigned int len) | 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 | void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); | 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 | extern struct bus_type fsl_mc_bus_type; | 408 | extern struct bus_type fsl_mc_bus_type; |
| 407 | 409 | ||
| 408 | extern struct device_type fsl_mc_bus_dprc_type; | 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 | struct module; | 52 | struct module; |
| 53 | struct ftrace_hash; | 53 | struct ftrace_hash; |
| 54 | struct ftrace_direct_func; | ||
| 54 | 55 | ||
| 55 | #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \ | 56 | #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \ |
| 56 | defined(CONFIG_DYNAMIC_FTRACE) | 57 | defined(CONFIG_DYNAMIC_FTRACE) |
| @@ -142,24 +143,30 @@ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops); · 85 unmodified lines | |||
| 142 | * PID - Is affected by set_ftrace_pid (allows filtering on those pids) | 143 | * PID - Is affected by set_ftrace_pid (allows filtering on those pids) |
| 143 | * RCU - Set when the ops can only be called when RCU is watching. | 144 | * RCU - Set when the ops can only be called when RCU is watching. |
| 144 | * TRACE_ARRAY - The ops->private points to a trace_array descriptor. | 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 | enum { | 151 | enum { |
| 147 | FTRACE_OPS_FL_ENABLED = 1 << 0, | 152 | FTRACE_OPS_FL_ENABLED = BIT(0), |
| 148 | FTRACE_OPS_FL_DYNAMIC = 1 << 1, | 153 | FTRACE_OPS_FL_DYNAMIC = BIT(1), |
| 149 | FTRACE_OPS_FL_SAVE_REGS = 1 << 2, | 154 | FTRACE_OPS_FL_SAVE_REGS = BIT(2), |
| 150 | FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 3, | 155 | FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = BIT(3), |
| 151 | FTRACE_OPS_FL_RECURSION_SAFE = 1 << 4, | 156 | FTRACE_OPS_FL_RECURSION_SAFE = BIT(4), |
| 152 | FTRACE_OPS_FL_STUB = 1 << 5, | 157 | FTRACE_OPS_FL_STUB = BIT(5), |
| 153 | FTRACE_OPS_FL_INITIALIZED = 1 << 6, | 158 | FTRACE_OPS_FL_INITIALIZED = BIT(6), |
| 154 | FTRACE_OPS_FL_DELETED = 1 << 7, | 159 | FTRACE_OPS_FL_DELETED = BIT(7), |
| 155 | FTRACE_OPS_FL_ADDING = 1 << 8, | 160 | FTRACE_OPS_FL_ADDING = BIT(8), |
| 156 | FTRACE_OPS_FL_REMOVING = 1 << 9, | 161 | FTRACE_OPS_FL_REMOVING = BIT(9), |
| 157 | FTRACE_OPS_FL_MODIFYING = 1 << 10, | 162 | FTRACE_OPS_FL_MODIFYING = BIT(10), |
| 158 | FTRACE_OPS_FL_ALLOC_TRAMP = 1 << 11, | 163 | FTRACE_OPS_FL_ALLOC_TRAMP = BIT(11), |
| 159 | FTRACE_OPS_FL_IPMODIFY = 1 << 12, | 164 | FTRACE_OPS_FL_IPMODIFY = BIT(12), |
| 160 | FTRACE_OPS_FL_PID = 1 << 13, | 165 | FTRACE_OPS_FL_PID = BIT(13), |
| 161 | FTRACE_OPS_FL_RCU = 1 << 14, | 166 | FTRACE_OPS_FL_RCU = BIT(14), |
| 162 | FTRACE_OPS_FL_TRACE_ARRAY = 1 << 15, | 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 | #ifdef CONFIG_DYNAMIC_FTRACE | 172 | #ifdef CONFIG_DYNAMIC_FTRACE |
| @@ -239,6 +246,75 @@ static inline void ftrace_free_init_mem(void) { } · 73 unmodified lines | |||
| 239 | static inline void ftrace_free_mem(struct module *mod, void *start, void *end) { } | 246 | static inline void ftrace_free_mem(struct module *mod, void *start, void *end) { } |
| 240 | #endif /* CONFIG_FUNCTION_TRACER */ | 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 | #ifdef CONFIG_STACK_TRACER | 318 | #ifdef CONFIG_STACK_TRACER |
| 243 | 319 | ||
| 244 | extern int stack_tracer_enabled; | 320 | extern int stack_tracer_enabled; |
| @@ -291,8 +367,6 @@ static inline void stack_tracer_enable(void) { } · 46 unmodified lines | |||
| 291 | int ftrace_arch_code_modify_prepare(void); | 367 | int ftrace_arch_code_modify_prepare(void); |
| 292 | int ftrace_arch_code_modify_post_process(void); | 368 | int ftrace_arch_code_modify_post_process(void); |
| 293 | 369 | ||
| 294 | struct dyn_ftrace; | ||
| 295 | |||
| 296 | enum ftrace_bug_type { | 370 | enum ftrace_bug_type { |
| 297 | FTRACE_BUG_UNKNOWN, | 371 | FTRACE_BUG_UNKNOWN, |
| 298 | FTRACE_BUG_INIT, | 372 | FTRACE_BUG_INIT, |
| @@ -330,6 +404,7 @@ bool is_ftrace_trampoline(unsigned long addr); · 31 unmodified lines | |||
| 330 | * REGS_EN - the function is set up to save regs. | 404 | * REGS_EN - the function is set up to save regs. |
| 331 | * IPMODIFY - the record allows for the IP address to be changed. | 405 | * IPMODIFY - the record allows for the IP address to be changed. |
| 332 | * DISABLED - the record is not ready to be touched yet | 406 | * DISABLED - the record is not ready to be touched yet |
| 407 | * DIRECT - there is a direct function to call | ||
| 333 | * | 408 | * |
| 334 | * When a new ftrace_ops is registered and wants a function to save | 409 | * When a new ftrace_ops is registered and wants a function to save |
| 335 | * pt_regs, the rec->flag REGS is set. When the function has been | 410 | * pt_regs, the rec->flag REGS is set. When the function has been |
| @@ -345,10 +420,12 @@ enum { · 9 unmodified lines | |||
| 345 | FTRACE_FL_TRAMP_EN = (1UL << 27), | 420 | FTRACE_FL_TRAMP_EN = (1UL << 27), |
| 346 | FTRACE_FL_IPMODIFY = (1UL << 26), | 421 | FTRACE_FL_IPMODIFY = (1UL << 26), |
| 347 | FTRACE_FL_DISABLED = (1UL << 25), | 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 | 427 | #define FTRACE_REF_MAX_SHIFT 23 |
| 351 | #define FTRACE_FL_BITS 7 | 428 | #define FTRACE_FL_BITS 9 |
| 352 | #define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1) | 429 | #define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1) |
| 353 | #define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT) | 430 | #define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT) |
| 354 | #define FTRACE_REF_MAX ((1UL << FTRACE_REF_MAX_SHIFT) - 1) | 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 | * ftrace_make_nop - convert code into nop | 577 | * ftrace_make_nop - convert code into nop |
| 501 | * @mod: module structure if called by module load initialization | 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 | * @addr: the address that the call site should be calling | 580 | * @addr: the address that the call site should be calling |
| 504 | * | 581 | * |
| 505 | * This is a very sensitive operation and great care needs | 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 | extern int ftrace_make_nop(struct module *mod, | 597 | extern int ftrace_make_nop(struct module *mod, |
| 521 | struct dyn_ftrace *rec, unsigned long addr); | 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 | * ftrace_make_call - convert a nop call site into a call to addr | 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 | * @addr: the address that the call site should call | 632 | * @addr: the address that the call site should call |
| 527 | * | 633 | * |
| 528 | * This is a very sensitive operation and great care needs | 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 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS | 651 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS |
| 546 | /** | 652 | /** |
| 547 | * ftrace_modify_call - convert from one addr to another (no nop) | 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 | * @old_addr: the address expected to be currently called to | 655 | * @old_addr: the address expected to be currently called to |
| 550 | * @addr: the address to change to | 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 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 816 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 711 | extern void ftrace_init(void); | 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 | #else | 823 | #else |
| 713 | static inline void ftrace_init(void) { } | 824 | static inline void ftrace_init(void) { } |
| 714 | #endif | 825 | #endif |
| @@ -2,7 +2,9 @@ · 1 unmodified line | |||
| 2 | #ifndef _LINUX_FUTEX_H | 2 | #ifndef _LINUX_FUTEX_H |
| 3 | #define _LINUX_FUTEX_H | 3 | #define _LINUX_FUTEX_H |
| 4 | 4 | ||
| 5 | #include <linux/sched.h> | ||
| 5 | #include <linux/ktime.h> | 6 | #include <linux/ktime.h> |
| 7 | |||
| 6 | #include <uapi/linux/futex.h> | 8 | #include <uapi/linux/futex.h> |
| 7 | 9 | ||
| 8 | struct inode; | 10 | struct inode; |
| @@ -48,15 +50,35 @@ union futex_key { · 39 unmodified lines | |||
| 48 | #define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } } | 50 | #define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } } |
| 49 | 51 | ||
| 50 | #ifdef CONFIG_FUTEX | 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, | 59 | static inline void futex_init_task(struct task_struct *tsk) |
| 54 | u32 __user *uaddr2, u32 val2, u32 val3); | ||
| 55 | #else | ||
| 56 | static inline void exit_robust_list(struct task_struct *curr) | ||
| 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 | static inline long do_futex(u32 __user *uaddr, int op, u32 val, | 82 | static inline long do_futex(u32 __user *uaddr, int op, u32 val, |
| 61 | ktime_t *timeout, u32 __user *uaddr2, | 83 | ktime_t *timeout, u32 __user *uaddr2, |
| 62 | u32 val2, u32 val3) | 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 | #endif | 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 | #endif | 90 | #endif |
| @@ -17,6 +17,7 @@ struct device; · 16 unmodified lines | |||
| 17 | struct fwnode_handle { | 17 | struct fwnode_handle { |
| 18 | struct fwnode_handle *secondary; | 18 | struct fwnode_handle *secondary; |
| 19 | const struct fwnode_operations *ops; | 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 | * struct fwnode_operations - Operations for fwnode interface | 50 | * struct fwnode_operations - Operations for fwnode interface |
| 50 | * @get: Get a reference to an fwnode. | 51 | * @get: Get a reference to an fwnode. |
| 51 | * @put: Put a reference to an fwnode. | 52 | * @put: Put a reference to an fwnode. |
| 53 | * @device_is_available: Return true if the device is available. | ||
| 52 | * @device_get_match_data: Return the device driver match data. | 54 | * @device_get_match_data: Return the device driver match data. |
| 53 | * @property_present: Return true if a property is present. | 55 | * @property_present: Return true if a property is present. |
| 54 | * @property_read_integer_array: Read an array of integer properties. Return | 56 | * @property_read_int_array: Read an array of integer properties. Return zero on |
| 55 | * zero on success, a negative error code | 57 | * success, a negative error code otherwise. |
| 56 | * otherwise. | ||
| 57 | * @property_read_string_array: Read an array of string properties. Return zero | 58 | * @property_read_string_array: Read an array of string properties. Return zero |
| 58 | * on success, a negative error code otherwise. | 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 | * @get_parent: Return the parent of an fwnode. | 62 | * @get_parent: Return the parent of an fwnode. |
| 60 | * @get_next_child_node: Return the next child node in an iteration. | 63 | * @get_next_child_node: Return the next child node in an iteration. |
| 61 | * @get_named_child_node: Return a child node with a given name. | 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 | * endpoint node. | 68 | * endpoint node. |
| 66 | * @graph_get_port_parent: Return the parent node of a port node. | 69 | * @graph_get_port_parent: Return the parent node of a port node. |
| 67 | * @graph_parse_endpoint: Parse endpoint for port and endpoint id. | 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 | struct fwnode_operations { | 110 | struct fwnode_operations { |
| 70 | struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); | 111 | struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); |
| @@ -82,6 +123,8 @@ struct fwnode_operations { · 11 unmodified lines | |||
| 82 | (*property_read_string_array)(const struct fwnode_handle *fwnode_handle, | 123 | (*property_read_string_array)(const struct fwnode_handle *fwnode_handle, |
| 83 | const char *propname, const char **val, | 124 | const char *propname, const char **val, |
| 84 | size_t nval); | 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 | struct fwnode_handle *(*get_parent)(const struct fwnode_handle *fwnode); | 128 | struct fwnode_handle *(*get_parent)(const struct fwnode_handle *fwnode); |
| 86 | struct fwnode_handle * | 129 | struct fwnode_handle * |
| 87 | (*get_next_child_node)(const struct fwnode_handle *fwnode, | 130 | (*get_next_child_node)(const struct fwnode_handle *fwnode, |
| @@ -102,6 +145,8 @@ struct fwnode_operations { · 14 unmodified lines | |||
| 102 | (*graph_get_port_parent)(struct fwnode_handle *fwnode); | 145 | (*graph_get_port_parent)(struct fwnode_handle *fwnode); |
| 103 | int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode, | 146 | int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode, |
| 104 | struct fwnode_endpoint *endpoint); | 147 | struct fwnode_endpoint *endpoint); |
| 148 | int (*add_links)(const struct fwnode_handle *fwnode, | ||
| 149 | struct device *dev); | ||
| 105 | }; | 150 | }; |
| 106 | 151 | ||
| 107 | #define fwnode_has_op(fwnode, op) \ | 152 | #define fwnode_has_op(fwnode, op) \ |
| @@ -123,5 +168,6 @@ struct fwnode_operations { · 15 unmodified lines | |||
| 123 | if (fwnode_has_op(fwnode, op)) \ | 168 | if (fwnode_has_op(fwnode, op)) \ |
| 124 | (fwnode)->ops->op(fwnode, ## __VA_ARGS__); \ | 169 | (fwnode)->ops->op(fwnode, ## __VA_ARGS__); \ |
| 125 | } while (false) | 170 | } while (false) |
| 171 | #define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev) | ||
| 126 | 172 | ||
| 127 | #endif | 173 | #endif |
| @@ -206,7 +206,7 @@ extern struct gen_pool *devm_gen_pool_create(struct device *dev, · 205 unmodified lines | |||
| 206 | int min_alloc_order, int nid, const char *name); | 206 | int min_alloc_order, int nid, const char *name); |
| 207 | extern struct gen_pool *gen_pool_get(struct device *dev, const char *name); | 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 | size_t size); | 210 | size_t size); |
| 211 | 211 | ||
| 212 | #ifdef CONFIG_OF | 212 | #ifdef CONFIG_OF |
| @@ -621,9 +621,10 @@ extern void blk_invalidate_devt(dev_t devt); · 620 unmodified lines | |||
| 621 | extern dev_t blk_lookup_devt(const char *name, int partno); | 621 | extern dev_t blk_lookup_devt(const char *name, int partno); |
| 622 | extern char *disk_name (struct gendisk *hd, int partno, char *buf); | 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 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); | 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 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, | 628 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
| 628 | int partno, sector_t start, | 629 | int partno, sector_t start, |
| 629 | sector_t len, int flags, | 630 | sector_t len, int flags, |
| @@ -612,6 +612,8 @@ static inline bool pm_suspended_storage(void) · 611 unmodified lines | |||
| 612 | /* The below functions must be run on a range from a single zone. */ | 612 | /* The below functions must be run on a range from a single zone. */ |
| 613 | extern int alloc_contig_range(unsigned long start, unsigned long end, | 613 | extern int alloc_contig_range(unsigned long start, unsigned long end, |
| 614 | unsigned migratetype, gfp_t gfp_mask); | 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 | #endif | 617 | #endif |
| 616 | void free_contig_range(unsigned long pfn, unsigned int nr_pages); | 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 | const char *propname, int index, | 176 | const char *propname, int index, |
| 177 | enum gpiod_flags dflags, | 177 | enum gpiod_flags dflags, |
| 178 | const char *label); | 178 | const char *label); |
| 179 | struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, | 179 | struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, |
| 180 | const char *con_id, int index, | 180 | const char *con_id, int index, |
| 181 | struct fwnode_handle *child, | 181 | enum gpiod_flags flags, |
| 182 | enum gpiod_flags flags, | 182 | const char *label); |
| 183 | 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 | #else /* CONFIG_GPIOLIB */ | 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 | return ERR_PTR(-ENOSYS); | 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 | static inline | 570 | static inline |
| 535 | struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, | 571 | struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, |
| 536 | const char *con_id, int index, | 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 | enum gpiod_flags flags, | 574 | enum gpiod_flags flags, |
| 539 | const char *label) | 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 | static inline | 581 | static inline |
| 547 | struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev, | 582 | struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev, |
| 548 | const char *con_id, | 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 | enum gpiod_flags flags, | 585 | enum gpiod_flags flags, |
| 551 | const char *label) | 586 | const char *label) |
| 552 | { | 587 | { |
| 553 | return devm_fwnode_get_index_gpiod_from_child(dev, con_id, 0, child, | 588 | return devm_fwnode_gpiod_get_index(dev, child, con_id, 0, flags, label); |
| 554 | flags, label); | ||
| 555 | } | 589 | } |
| 556 | 590 | ||
| 557 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO) | 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 | struct gpio_chip; | 23 | struct gpio_chip; |
| 24 | 24 | ||
| 25 | #define GPIO_LINE_DIRECTION_IN 1 | ||
| 26 | #define GPIO_LINE_DIRECTION_OUT 0 | ||
| 27 | |||
| 25 | /** | 28 | /** |
| 26 | * struct gpio_irq_chip - GPIO interrupt controller | 29 | * struct gpio_irq_chip - GPIO interrupt controller |
| 27 | */ | 30 | */ |
| @@ -286,6 +289,9 @@ struct gpio_irq_chip { · 258 unmodified lines | |||
| 286 | * state (such as pullup/pulldown configuration). | 289 | * state (such as pullup/pulldown configuration). |
| 287 | * @init_valid_mask: optional routine to initialize @valid_mask, to be used if | 290 | * @init_valid_mask: optional routine to initialize @valid_mask, to be used if |
| 288 | * not all GPIOs are valid. | 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 | * @base: identifies the first GPIO number handled by this chip; | 295 | * @base: identifies the first GPIO number handled by this chip; |
| 290 | * or, if negative during registration, requests dynamic ID allocation. | 296 | * or, if negative during registration, requests dynamic ID allocation. |
| 291 | * DEPRECATION: providing anything non-negative and nailing the base | 297 | * DEPRECATION: providing anything non-negative and nailing the base |
| @@ -376,6 +382,8 @@ struct gpio_chip { · 84 unmodified lines | |||
| 376 | unsigned long *valid_mask, | 382 | unsigned long *valid_mask, |
| 377 | unsigned int ngpios); | 383 | unsigned int ngpios); |
| 378 | 384 | ||
| 385 | int (*add_pin_ranges)(struct gpio_chip *chip); | ||
| 386 | |||
| 379 | int base; | 387 | int base; |
| 380 | u16 ngpio; | 388 | u16 ngpio; |
| 381 | const char *const *names; | 389 | const char *const *names; |
| @@ -62,37 +62,12 @@ · 61 unmodified lines | |||
| 62 | #include <linux/kconfig.h> | 62 | #include <linux/kconfig.h> |
| 63 | #include <asm/pgtable.h> | 63 | #include <asm/pgtable.h> |
| 64 | 64 | ||
| 65 | #ifdef CONFIG_HMM_MIRROR | ||
| 66 | |||
| 67 | #include <linux/device.h> | 65 | #include <linux/device.h> |
| 68 | #include <linux/migrate.h> | 66 | #include <linux/migrate.h> |
| 69 | #include <linux/memremap.h> | 67 | #include <linux/memremap.h> |
| 70 | #include <linux/completion.h> | 68 | #include <linux/completion.h> |
| 71 | #include <linux/mmu_notifier.h> | 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 | * hmm_pfn_flag_e - HMM flag enums | 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 | * struct hmm_range - track invalidation lock on virtual address range | 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 | * @hmm: the core HMM structure this range is active against | 125 | * @hmm: the core HMM structure this range is active against |
| 149 | * @vma: the vm area struct for the range | 126 | * @vma: the vm area struct for the range |
| 150 | * @list: all range lock are on a list | 127 | * @list: all range lock are on a list |
| @@ -159,8 +136,8 @@ enum hmm_pfn_value_e { · 8 unmodified lines | |||
| 159 | * @valid: pfns array did not change since it has been fill by an HMM function | 136 | * @valid: pfns array did not change since it has been fill by an HMM function |
| 160 | */ | 137 | */ |
| 161 | struct hmm_range { | 138 | struct hmm_range { |
| 162 | struct hmm *hmm; | 139 | struct mmu_interval_notifier *notifier; |
| 163 | struct list_head list; | 140 | unsigned long notifier_seq; |
| 164 | unsigned long start; | 141 | unsigned long start; |
| 165 | unsigned long end; | 142 | unsigned long end; |
| 166 | uint64_t *pfns; | 143 | uint64_t *pfns; |
| @@ -169,32 +146,8 @@ struct hmm_range { · 2 unmodified lines | |||
| 169 | uint64_t default_flags; | 146 | uint64_t default_flags; |
| 170 | uint64_t pfn_flags_mask; | 147 | uint64_t pfn_flags_mask; |
| 171 | uint8_t pfn_shift; | 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 | * hmm_device_entry_to_page() - return struct page pointed to by a device entry | 152 | * hmm_device_entry_to_page() - return struct page pointed to by a device entry |
| 200 | * @range: range use to decode device entry value | 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 | range->flags[HMM_PFN_VALID]; | 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 | * Retry fault if non-blocking, drop mmap_sem and return -EAGAIN in that case. | 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 | /* Don't fault in missing PTEs, just snapshot the current state. */ | 225 | /* Don't fault in missing PTEs, just snapshot the current state. */ |
| 387 | #define HMM_FAULT_SNAPSHOT (1 << 1) | 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 | long hmm_range_fault(struct hmm_range *range, unsigned int flags); | 232 | long hmm_range_fault(struct hmm_range *range, unsigned int flags); |
| 390 | 233 | #else | |
| 391 | long hmm_range_dma_map(struct hmm_range *range, | 234 | static inline long hmm_range_fault(struct hmm_range *range, unsigned int flags) |
| 392 | struct device *device, | 235 | { |
| 393 | dma_addr_t *daddrs, | 236 | return -EOPNOTSUPP; |
| 394 | unsigned int flags); | 237 | } |
| 395 | long hmm_range_dma_unmap(struct hmm_range *range, | 238 | #endif |
| 396 | struct device *device, | ||
| 397 | dma_addr_t *daddrs, | ||
| 398 | bool dirty); | ||
| 399 | 239 | ||
| 400 | /* | 240 | /* |
| 401 | * HMM_RANGE_DEFAULT_TIMEOUT - default timeout (ms) when waiting for a range | 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 | #define HMM_RANGE_DEFAULT_TIMEOUT 1000 | 247 | #define HMM_RANGE_DEFAULT_TIMEOUT 1000 |
| 408 | 248 | ||
| 409 | #endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */ | ||
| 410 | |||
| 411 | #endif /* LINUX_HMM_H */ | 249 | #endif /* LINUX_HMM_H */ |
| @@ -18,6 +18,7 @@ enum host1x_class { · 17 unmodified lines | |||
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | struct host1x_client; | 20 | struct host1x_client; |
| 21 | struct iommu_group; | ||
| 21 | 22 | ||
| 22 | /** | 23 | /** |
| 23 | * struct host1x_client_ops - host1x client operations | 24 | * struct host1x_client_ops - host1x client operations |
| @@ -34,6 +35,7 @@ struct host1x_client_ops { · 10 unmodified lines | |||
| 34 | * @list: list node for the host1x client | 35 | * @list: list node for the host1x client |
| 35 | * @parent: pointer to struct device representing the host1x controller | 36 | * @parent: pointer to struct device representing the host1x controller |
| 36 | * @dev: pointer to struct device backing this host1x client | 37 | * @dev: pointer to struct device backing this host1x client |
| 38 | * @group: IOMMU group that this client is a member of | ||
| 37 | * @ops: host1x client operations | 39 | * @ops: host1x client operations |
| 38 | * @class: host1x class represented by this client | 40 | * @class: host1x class represented by this client |
| 39 | * @channel: host1x channel associated with this client | 41 | * @channel: host1x channel associated with this client |
| @@ -44,6 +46,7 @@ struct host1x_client { · 4 unmodified lines | |||
| 44 | struct list_head list; | 46 | struct list_head list; |
| 45 | struct device *parent; | 47 | struct device *parent; |
| 46 | struct device *dev; | 48 | struct device *dev; |
| 49 | struct iommu_group *group; | ||
| 47 | 50 | ||
| 48 | const struct host1x_client_ops *ops; | 51 | const struct host1x_client_ops *ops; |
| 49 | 52 | ||
| @@ -64,8 +67,9 @@ struct sg_table; · 14 unmodified lines | |||
| 64 | struct host1x_bo_ops { | 67 | struct host1x_bo_ops { |
| 65 | struct host1x_bo *(*get)(struct host1x_bo *bo); | 68 | struct host1x_bo *(*get)(struct host1x_bo *bo); |
| 66 | void (*put)(struct host1x_bo *bo); | 69 | void (*put)(struct host1x_bo *bo); |
| 67 | dma_addr_t (*pin)(struct host1x_bo *bo, struct sg_table **sgt); | 70 | struct sg_table *(*pin)(struct device *dev, struct host1x_bo *bo, |
| 68 | void (*unpin)(struct host1x_bo *bo, struct sg_table *sgt); | 71 | dma_addr_t *phys); |
| 72 | void (*unpin)(struct device *dev, struct sg_table *sgt); | ||
| 69 | void *(*mmap)(struct host1x_bo *bo); | 73 | void *(*mmap)(struct host1x_bo *bo); |
| 70 | void (*munmap)(struct host1x_bo *bo, void *addr); | 74 | void (*munmap)(struct host1x_bo *bo, void *addr); |
| 71 | void *(*kmap)(struct host1x_bo *bo, unsigned int pagenum); | 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 | bo->ops->put(bo); | 96 | bo->ops->put(bo); |
| 93 | } | 97 | } |
| 94 | 98 | ||
| 95 | static inline dma_addr_t host1x_bo_pin(struct host1x_bo *bo, | 99 | static inline struct sg_table *host1x_bo_pin(struct device *dev, |
| 96 | struct sg_table **sgt) | 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 | static inline void *host1x_bo_mmap(struct host1x_bo *bo) | 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 | struct host1x_channel; | 164 | struct host1x_channel; |
| 159 | struct host1x_job; | 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 | struct host1x_channel *host1x_channel_get(struct host1x_channel *channel); | 168 | struct host1x_channel *host1x_channel_get(struct host1x_channel *channel); |
| 163 | void host1x_channel_put(struct host1x_channel *channel); | 169 | void host1x_channel_put(struct host1x_channel *channel); |
| 164 | int host1x_job_submit(struct host1x_job *job); | 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 | * host1x job | 173 | * host1x job |
| 168 | */ | 174 | */ |
| 169 | 175 | ||
| 176 | #define HOST1X_RELOC_READ (1 << 0) | ||
| 177 | #define HOST1X_RELOC_WRITE (1 << 1) | ||
| 178 | |||
| 170 | struct host1x_reloc { | 179 | struct host1x_reloc { |
| 171 | struct { | 180 | struct { |
| 172 | struct host1x_bo *bo; | 181 | struct host1x_bo *bo; |
| @@ -177,6 +186,7 @@ struct host1x_reloc { · 4 unmodified lines | |||
| 177 | unsigned long offset; | 186 | unsigned long offset; |
| 178 | } target; | 187 | } target; |
| 179 | unsigned long shift; | 188 | unsigned long shift; |
| 189 | unsigned long flags; | ||
| 180 | }; | 190 | }; |
| 181 | 191 | ||
| 182 | struct host1x_job { | 192 | struct host1x_job { |
| @@ -456,12 +456,18 @@ extern u64 hrtimer_next_event_without(const struct hrtimer *exclude); · 455 unmodified lines | |||
| 456 | 456 | ||
| 457 | extern bool hrtimer_active(const struct hrtimer *timer); | 457 | extern bool hrtimer_active(const struct hrtimer *timer); |
| 458 | 458 | ||
| 459 | /* | 459 | /** |
| 460 | * Helper function to check, whether the timer is on one of the queues | 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 | static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, | 216 | static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, |
| 217 | struct vm_area_struct *vma) | 217 | struct vm_area_struct *vma) |
| 218 | { | 218 | { |
| 219 | VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma); | ||
| 220 | if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) | 219 | if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) |
| 221 | return __pmd_trans_huge_lock(pmd, vma); | 220 | return __pmd_trans_huge_lock(pmd, vma); |
| 222 | else | 221 | else |
| @@ -225,7 +224,6 @@ static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, · 2 unmodified lines | |||
| 225 | static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, | 224 | static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, |
| 226 | struct vm_area_struct *vma) | 225 | struct vm_area_struct *vma) |
| 227 | { | 226 | { |
| 228 | VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma); | ||
| 229 | if (pud_trans_huge(*pud) || pud_devmap(*pud)) | 227 | if (pud_trans_huge(*pud) || pud_devmap(*pud)) |
| 230 | return __pud_trans_huge_lock(pud, vma); | 228 | return __pud_trans_huge_lock(pud, vma); |
| 231 | else | 229 | else |
| @@ -105,8 +105,7 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason); · 104 unmodified lines | |||
| 105 | void free_huge_page(struct page *page); | 105 | void free_huge_page(struct page *page); |
| 106 | void hugetlb_fix_reserve_counts(struct inode *inode); | 106 | void hugetlb_fix_reserve_counts(struct inode *inode); |
| 107 | extern struct mutex *hugetlb_fault_mutex_table; | 107 | extern struct mutex *hugetlb_fault_mutex_table; |
| 108 | u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, | 108 | u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); |
| 109 | pgoff_t idx, unsigned long address); | ||
| 110 | 109 | ||
| 111 | pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); | 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; }) | 166 | static inline long follow_hugetlb_page(struct mm_struct *mm, |
| 168 | #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) | 167 | struct vm_area_struct *vma, struct page **pages, |
| 169 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | 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 | static inline void hugetlb_report_meminfo(struct seq_file *m) | 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 | static inline void hugetlb_show_meminfo(void) | 198 | static inline void hugetlb_show_meminfo(void) |
| 175 | { | 199 | { |
| 176 | } | 200 | } |
| 177 | #define follow_huge_pd(vma, addr, hpd, flags, pdshift) NULL | 201 | |
| 178 | #define follow_huge_pmd(mm, addr, pmd, flags) NULL | 202 | static inline struct page *follow_huge_pd(struct vm_area_struct *vma, |
| 179 | #define follow_huge_pud(mm, addr, pud, flags) NULL | 203 | unsigned long address, hugepd_t hpd, int flags, |
| 180 | #define follow_huge_pgd(mm, addr, pgd, flags) NULL | 204 | int pdshift) |
| 181 | #define prepare_hugepage_range(file, addr, len) (-EINVAL) | 205 | { |
| 182 | #define pmd_huge(x) 0 | 206 | return NULL; |
| 183 | #define pud_huge(x) 0 | 207 | } |
| 184 | #define is_hugepage_only_range(mm, addr, len) 0 | 208 | |
| 185 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) | 209 | static inline struct page *follow_huge_pmd(struct mm_struct *mm, |
| 186 | #define hugetlb_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \ | 210 | unsigned long address, pmd_t *pmd, int flags) |
| 187 | src_addr, pagep) ({ BUG(); 0; }) | 211 | { |
| 188 | #define huge_pte_offset(mm, address, sz) 0 | 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 | static inline bool isolate_huge_page(struct page *page, struct list_head *list) | 273 | static inline bool isolate_huge_page(struct page *page, struct list_head *list) |
| 191 | { | 274 | { |
| 192 | return false; | 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, | 278 | static inline void putback_active_hugepage(struct page *page) |
| 198 | unsigned long address, unsigned long end, pgprot_t newprot) | 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 | return 0; | 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 | BUG(); | 305 | BUG(); |
| 215 | } | 306 | } |
| 307 | |||
| 216 | static inline vm_fault_t hugetlb_fault(struct mm_struct *mm, | 308 | static inline vm_fault_t hugetlb_fault(struct mm_struct *mm, |
| 217 | struct vm_area_struct *vma, unsigned long address, | 309 | struct vm_area_struct *vma, unsigned long address, |
| 218 | unsigned int flags) | 310 | unsigned int flags) |
| 219 | { | 311 | { |
| 220 | BUG(); | 312 | BUG(); |
| 221 | return 0; | 313 | return 0; |
| @@ -182,19 +182,21 @@ static inline u32 hv_get_avail_to_write_percent( · 181 unmodified lines | |||
| 182 | * 2 . 4 (Windows 8) | 182 | * 2 . 4 (Windows 8) |
| 183 | * 3 . 0 (Windows 8 R2) | 183 | * 3 . 0 (Windows 8 R2) |
| 184 | * 4 . 0 (Windows 10) | 184 | * 4 . 0 (Windows 10) |
| 185 | * 4 . 1 (Windows 10 RS3) | ||
| 185 | * 5 . 0 (Newer Windows 10) | 186 | * 5 . 0 (Newer Windows 10) |
| 187 | * 5 . 1 (Windows 10 RS4) | ||
| 188 | * 5 . 2 (Windows Server 2019, RS5) | ||
| 186 | */ | 189 | */ |
| 187 | 190 | ||
| 188 | #define VERSION_WS2008 ((0 << 16) | (13)) | 191 | #define VERSION_WS2008 ((0 << 16) | (13)) |
| 189 | #define VERSION_WIN7 ((1 << 16) | (1)) | 192 | #define VERSION_WIN7 ((1 << 16) | (1)) |
| 190 | #define VERSION_WIN8 ((2 << 16) | (4)) | 193 | #define VERSION_WIN8 ((2 << 16) | (4)) |
| 191 | #define VERSION_WIN8_1 ((3 << 16) | (0)) | 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 | #define VERSION_WIN10_V5 ((5 << 16) | (0)) | 197 | #define VERSION_WIN10_V5 ((5 << 16) | (0)) |
| 194 | 198 | #define VERSION_WIN10_V5_1 ((5 << 16) | (1)) | |
| 195 | #define VERSION_INVAL -1 | 199 | #define VERSION_WIN10_V5_2 ((5 << 16) | (2)) |
| 196 | |||
| 197 | #define VERSION_CURRENT VERSION_WIN10_V5 | ||
| 198 | 200 | ||
| 199 | /* Make maximum size of pipe payload of 16K */ | 201 | /* Make maximum size of pipe payload of 16K */ |
| 200 | #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) | 202 | #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) |
| @@ -932,6 +934,21 @@ struct vmbus_channel { · 731 unmodified lines | |||
| 932 | * full outbound ring buffer. | 934 | * full outbound ring buffer. |
| 933 | */ | 935 | */ |
| 934 | u64 out_full_first; | 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 | static inline bool is_hvsock_channel(const struct vmbus_channel *c) | 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 | struct vmbus_channel *channel; | 1198 | struct vmbus_channel *channel; |
| 1182 | struct kset *channels_kset; | 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 | * generic enough to hide second-sourcing and compatible revisions. | 300 | * generic enough to hide second-sourcing and compatible revisions. |
| 301 | * @adapter: manages the bus segment hosting this I2C device | 301 | * @adapter: manages the bus segment hosting this I2C device |
| 302 | * @dev: Driver model device node for the slave. | 302 | * @dev: Driver model device node for the slave. |
| 303 | * @init_irq: IRQ that was set at initialization | ||
| 303 | * @irq: indicates the IRQ generated by this device (if any) | 304 | * @irq: indicates the IRQ generated by this device (if any) |
| 304 | * @detected: member of an i2c_driver.clients list or i2c-core's | 305 | * @detected: member of an i2c_driver.clients list or i2c-core's |
| 305 | * userspace_devices list | 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 | * a default probing method is used. | 453 | * a default probing method is used. |
| 453 | */ | 454 | */ |
| 454 | extern struct i2c_client * | 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 | i2c_new_probed_device(struct i2c_adapter *adap, | 462 | i2c_new_probed_device(struct i2c_adapter *adap, |
| 456 | struct i2c_board_info *info, | 463 | struct i2c_board_info *info, |
| 457 | unsigned short const *addr_list, | 464 | unsigned short const *addr_list, |
| 458 | int (*probe)(struct i2c_adapter *adap, unsigned short addr)); | 465 | int (*probe)(struct i2c_adapter *adap, unsigned short addr)); |
| 459 | 466 | ||
| 460 | /* Common custom probe functions */ | 467 | /* Common custom probe functions */ |
| 461 | extern int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); | 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 | extern struct i2c_client * | 470 | extern struct i2c_client * |
| 470 | i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address); | 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 | * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns | 576 | * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns |
| 576 | * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification | 577 | * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification |
| 577 | * @sda_hold_ns: time IP core additionally needs to hold SDA in ns | 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 | struct i2c_timings { | 584 | struct i2c_timings { |
| 580 | u32 bus_freq_hz; | 585 | u32 bus_freq_hz; |
| @@ -583,6 +588,8 @@ struct i2c_timings { · 2 unmodified lines | |||
| 583 | u32 scl_int_delay_ns; | 588 | u32 scl_int_delay_ns; |
| 584 | u32 sda_fall_ns; | 589 | u32 sda_fall_ns; |
| 585 | u32 sda_hold_ns; | 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 | #define i2c_add_driver(driver) \ | 851 | #define i2c_add_driver(driver) \ |
| 845 | i2c_register_driver(THIS_MODULE, driver) | 852 | i2c_register_driver(THIS_MODULE, driver) |
| 846 | 853 | ||
| 847 | extern struct i2c_client *i2c_use_client(struct i2c_client *client); | 854 | static inline bool i2c_client_has_driver(struct i2c_client *client) |
| 848 | extern void i2c_release_client(struct i2c_client *client); | 855 | { |
| 856 | return !IS_ERR_OR_NULL(client) && client->dev.driver; | ||
| 857 | } | ||
| 849 | 858 | ||
| 850 | /* call the i2c_client->command() of all attached clients with | 859 | /* call the i2c_client->command() of all attached clients with |
| 851 | * the given arguments */ | 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 | return (struct icmphdr *)skb_transport_header(skb); | 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 | #endif /* _LINUX_ICMP_H */ | 38 | #endif /* _LINUX_ICMP_H */ |
| @@ -46,4 +46,18 @@ extern void icmpv6_flow_init(struct sock *sk, · 45 unmodified lines | |||
| 46 | const struct in6_addr *saddr, | 46 | const struct in6_addr *saddr, |
| 47 | const struct in6_addr *daddr, | 47 | const struct in6_addr *daddr, |
| 48 | int oif); | 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 | #endif | 63 | #endif |
| @@ -119,6 +119,8 @@ int ad_sd_reset(struct ad_sigma_delta *sigma_delta, · 118 unmodified lines | |||
| 119 | 119 | ||
| 120 | int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, | 120 | int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, |
| 121 | const struct iio_chan_spec *chan, int *val); | 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 | int ad_sd_calibrate_all(struct ad_sigma_delta *sigma_delta, | 124 | int ad_sd_calibrate_all(struct ad_sigma_delta *sigma_delta, |
| 123 | const struct ad_sd_calib_data *cd, unsigned int n); | 125 | const struct ad_sd_calib_data *cd, unsigned int n); |
| 124 | int ad_sd_init(struct ad_sigma_delta *sigma_delta, struct iio_dev *indio_dev, | 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 | * attributes | 510 | * attributes |
| 511 | * @chan_attr_group: [INTERN] group for all attrs in base directory | 511 | * @chan_attr_group: [INTERN] group for all attrs in base directory |
| 512 | * @name: [DRIVER] name of the device. | 512 | * @name: [DRIVER] name of the device. |
| 513 | * @label: [DRIVER] unique name to identify which device this is | ||
| 513 | * @info: [DRIVER] callbacks and constant info from driver | 514 | * @info: [DRIVER] callbacks and constant info from driver |
| 514 | * @clock_id: [INTERN] timestamping clock posix identifier | 515 | * @clock_id: [INTERN] timestamping clock posix identifier |
| 515 | * @info_exist_lock: [INTERN] lock to prevent use during removal | 516 | * @info_exist_lock: [INTERN] lock to prevent use during removal |
| @@ -553,6 +554,7 @@ struct iio_dev { · 37 unmodified lines | |||
| 553 | struct list_head channel_attr_list; | 554 | struct list_head channel_attr_list; |
| 554 | struct attribute_group chan_attr_group; | 555 | struct attribute_group chan_attr_group; |
| 555 | const char *name; | 556 | const char *name; |
| 557 | const char *label; | ||
| 556 | const struct iio_info *info; | 558 | const struct iio_info *info; |
| 557 | clockid_t clock_id; | 559 | clockid_t clock_id; |
| 558 | struct mutex info_exist_lock; | 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 | int ret; | 129 | int ret; |
| 130 | 130 | ||
| 131 | ret = adis_read_reg(adis, reg, &tmp, 2); | 131 | ret = adis_read_reg(adis, reg, &tmp, 2); |
| 132 | *val = tmp; | 132 | if (ret == 0) |
| 133 | *val = tmp; | ||
| 133 | 134 | ||
| 134 | return ret; | 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 | int ret; | 148 | int ret; |
| 148 | 149 | ||
| 149 | ret = adis_read_reg(adis, reg, &tmp, 4); | 150 | ret = adis_read_reg(adis, reg, &tmp, 4); |
| 150 | *val = tmp; | 151 | if (ret == 0) |
| 152 | *val = tmp; | ||
| 151 | 153 | ||
| 152 | return ret; | 154 | return ret; |
| 153 | } | 155 | } |
| @@ -29,7 +29,8 @@ extern void ima_kexec_cmdline(const void *buf, int size); · 28 unmodified lines | |||
| 29 | extern void ima_add_kexec_buffer(struct kimage *image); | 29 | extern void ima_add_kexec_buffer(struct kimage *image); |
| 30 | #endif | 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 | extern bool arch_ima_get_secureboot(void); | 34 | extern bool arch_ima_get_secureboot(void); |
| 34 | extern const char * const *arch_get_ima_policy(void); | 35 | extern const char * const *arch_get_ima_policy(void); |
| 35 | #else | 36 | #else |
| @@ -28,3 +28,5 @@ extern unsigned int real_root_dev; · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | extern char __initramfs_start[]; | 29 | extern char __initramfs_start[]; |
| 30 | extern unsigned long __initramfs_size; | 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 | void input_set_poll_interval(struct input_dev *dev, unsigned int interval); | 383 | void input_set_poll_interval(struct input_dev *dev, unsigned int interval); |
| 384 | void input_set_min_poll_interval(struct input_dev *dev, unsigned int interval); | 384 | void input_set_min_poll_interval(struct input_dev *dev, unsigned int interval); |
| 385 | void input_set_max_poll_interval(struct input_dev *dev, unsigned int interval); | 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 | int __must_check input_register_handler(struct input_handler *); | 388 | int __must_check input_register_handler(struct input_handler *); |
| 388 | void input_unregister_handler(struct input_handler *); | 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 | irq_handler_t thread_fn, | 140 | irq_handler_t thread_fn, |
| 141 | unsigned long flags, const char *name, void *dev); | 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 | static inline int __must_check | 156 | static inline int __must_check |
| 144 | request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, | 157 | request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, |
| 145 | const char *name, void *dev) | 158 | const char *name, void *dev) |
| @@ -520,8 +533,7 @@ enum · 374 unmodified lines | |||
| 520 | IRQ_POLL_SOFTIRQ, | 533 | IRQ_POLL_SOFTIRQ, |
| 521 | TASKLET_SOFTIRQ, | 534 | TASKLET_SOFTIRQ, |
| 522 | SCHED_SOFTIRQ, | 535 | SCHED_SOFTIRQ, |
| 523 | HRTIMER_SOFTIRQ, /* Unused, but kept as tools rely on the | 536 | HRTIMER_SOFTIRQ, |
| 524 | numbering. Sigh! */ | ||
| 525 | RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ | 537 | RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ |
| 526 | 538 | ||
| 527 | NR_SOFTIRQS | 539 | NR_SOFTIRQS |
| @@ -102,7 +102,7 @@ struct io_pgtable_cfg { · 101 unmodified lines | |||
| 102 | struct { | 102 | struct { |
| 103 | u64 ttbr[2]; | 103 | u64 ttbr[2]; |
| 104 | u64 tcr; | 104 | u64 tcr; |
| 105 | u64 mair[2]; | 105 | u64 mair; |
| 106 | } arm_lpae_s1_cfg; | 106 | } arm_lpae_s1_cfg; |
| 107 | 107 | ||
| 108 | struct { | 108 | struct { |
| @@ -64,6 +64,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, | 65 | void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, |
| 66 | resource_size_t size); | 66 | resource_size_t size); |
| 67 | void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset, | ||
| 68 | resource_size_t size); | ||
| 67 | void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, | 69 | void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, |
| 68 | resource_size_t size); | 70 | resource_size_t size); |
| 69 | void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset, | 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 | #include <linux/atomic.h> | 5 | #include <linux/atomic.h> |
| 6 | #include <linux/bitmap.h> | 6 | #include <linux/bitmap.h> |
| 7 | #include <linux/blk_types.h> | ||
| 7 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
| 8 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 9 | #include <linux/mm_types.h> | 10 | #include <linux/mm_types.h> |
| @@ -12,6 +13,7 @@ · 2 unmodified lines | |||
| 12 | struct address_space; | 13 | struct address_space; |
| 13 | struct fiemap_extent_info; | 14 | struct fiemap_extent_info; |
| 14 | struct inode; | 15 | struct inode; |
| 16 | struct iomap_writepage_ctx; | ||
| 15 | struct iov_iter; | 17 | struct iov_iter; |
| 16 | struct kiocb; | 18 | struct kiocb; |
| 17 | struct page; | 19 | struct page; |
| @@ -21,28 +23,45 @@ struct vm_fault; · 3 unmodified lines | |||
| 21 | /* | 23 | /* |
| 22 | * Types of block ranges for iomap mappings: | 24 | * Types of block ranges for iomap mappings: |
| 23 | */ | 25 | */ |
| 24 | #define IOMAP_HOLE 0x01 /* no blocks allocated, need allocation */ | 26 | #define IOMAP_HOLE 0 /* no blocks allocated, need allocation */ |
| 25 | #define IOMAP_DELALLOC 0x02 /* delayed allocation blocks */ | 27 | #define IOMAP_DELALLOC 1 /* delayed allocation blocks */ |
| 26 | #define IOMAP_MAPPED 0x03 /* blocks allocated at @addr */ | 28 | #define IOMAP_MAPPED 2 /* blocks allocated at @addr */ |
| 27 | #define IOMAP_UNWRITTEN 0x04 /* blocks allocated at @addr in unwritten state */ | 29 | #define IOMAP_UNWRITTEN 3 /* blocks allocated at @addr in unwritten state */ |
| 28 | #define IOMAP_INLINE 0x05 /* data inline in the inode */ | 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 | * IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access | 38 | * IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access |
| 34 | * written data and requires fdatasync to commit them to persistent storage. | 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 */ | 52 | #define IOMAP_F_NEW 0x01 |
| 37 | #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ | 53 | #define IOMAP_F_DIRTY 0x02 |
| 38 | #define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */ | 54 | #define IOMAP_F_SHARED 0x04 |
| 39 | #define IOMAP_F_SIZE_CHANGED 0x08 /* file size has changed */ | 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 */ | 64 | #define IOMAP_F_SIZE_CHANGED 0x100 |
| 45 | #define IOMAP_F_SHARED 0x20 /* block shared with another file */ | ||
| 46 | 65 | ||
| 47 | /* | 66 | /* |
| 48 | * Flags from 0x1000 up are for file system specific usage: | 67 | * Flags from 0x1000 up are for file system specific usage: |
| @@ -110,7 +129,8 @@ struct iomap_ops { · 61 unmodified lines | |||
| 110 | * The actual length is returned in iomap->length. | 129 | * The actual length is returned in iomap->length. |
| 111 | */ | 130 | */ |
| 112 | int (*iomap_begin)(struct inode *inode, loff_t pos, loff_t length, | 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 | * Commit and/or unreserve space previous allocated using iomap_begin. | 136 | * Commit and/or unreserve space previous allocated using iomap_begin. |
| @@ -126,29 +146,12 @@ struct iomap_ops { · 9 unmodified lines | |||
| 126 | * Main iomap iterator function. | 146 | * Main iomap iterator function. |
| 127 | */ | 147 | */ |
| 128 | typedef loff_t (*iomap_actor_t)(struct inode *inode, loff_t pos, loff_t len, | 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 | loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length, | 151 | loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length, |
| 132 | unsigned flags, const struct iomap_ops *ops, void *data, | 152 | unsigned flags, const struct iomap_ops *ops, void *data, |
| 133 | iomap_actor_t actor); | 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 | ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from, | 155 | ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from, |
| 153 | const struct iomap_ops *ops); | 156 | const struct iomap_ops *ops); |
| 154 | int iomap_readpage(struct page *page, const struct iomap_ops *ops); | 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 | #else | 169 | #else |
| 167 | #define iomap_migrate_page NULL | 170 | #define iomap_migrate_page NULL |
| 168 | #endif | 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 | const struct iomap_ops *ops); | 173 | const struct iomap_ops *ops); |
| 171 | int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, | 174 | int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, |
| 172 | bool *did_zero, const struct iomap_ops *ops); | 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 | sector_t iomap_bmap(struct address_space *mapping, sector_t bno, | 186 | sector_t iomap_bmap(struct address_space *mapping, sector_t bno, |
| 184 | const struct iomap_ops *ops); | 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 | * Flags for direct I/O ->end_io: | 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 | ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, | 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 | int iomap_dio_iopoll(struct kiocb *kiocb, bool spin); | 260 | int iomap_dio_iopoll(struct kiocb *kiocb, bool spin); |
| 200 | 261 | ||
| 201 | #ifdef CONFIG_SWAP | 262 | #ifdef CONFIG_SWAP |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
| 14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
| 15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
| 16 | #include <linux/ioasid.h> | ||
| 16 | #include <uapi/linux/iommu.h> | 17 | #include <uapi/linux/iommu.h> |
| 17 | 18 | ||
| 18 | #define IOMMU_READ (1 << 0) | 19 | #define IOMMU_READ (1 << 0) |
| @@ -31,11 +32,11 @@ · 12 unmodified lines | |||
| 31 | */ | 32 | */ |
| 32 | #define IOMMU_PRIV (1 << 5) | 33 | #define IOMMU_PRIV (1 << 5) |
| 33 | /* | 34 | /* |
| 34 | * Non-coherent masters on few Qualcomm SoCs can use this page protection flag | 35 | * Non-coherent masters can use this page protection flag to set cacheable |
| 35 | * to set correct cacheability attributes to use an outer level of cache - | 36 | * memory attributes for only a transparent outer level of cache, also known as |
| 36 | * last level cache, aka system cache. | 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 | struct iommu_ops; | 41 | struct iommu_ops; |
| 41 | struct iommu_group; | 42 | struct iommu_group; |
| @@ -244,7 +245,10 @@ struct iommu_iotlb_gather { · 202 unmodified lines | |||
| 244 | * @sva_unbind: Unbind process address space from device | 245 | * @sva_unbind: Unbind process address space from device |
| 245 | * @sva_get_pasid: Get PASID associated to a SVA handle | 246 | * @sva_get_pasid: Get PASID associated to a SVA handle |
| 246 | * @page_response: handle page request response | 247 | * @page_response: handle page request response |
| 248 | * @cache_invalidate: invalidate translation caches | ||
| 247 | * @pgsize_bitmap: bitmap of all possible supported page sizes | 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 | struct iommu_ops { | 253 | struct iommu_ops { |
| 250 | bool (*capable)(enum iommu_cap); | 254 | bool (*capable)(enum iommu_cap); |
| @@ -256,7 +260,7 @@ struct iommu_ops { · 5 unmodified lines | |||
| 256 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); | 260 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); |
| 257 | void (*detach_dev)(struct iommu_domain *domain, struct device *dev); | 261 | void (*detach_dev)(struct iommu_domain *domain, struct device *dev); |
| 258 | int (*map)(struct iommu_domain *domain, unsigned long iova, | 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 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, | 264 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, |
| 261 | size_t size, struct iommu_iotlb_gather *iotlb_gather); | 265 | size_t size, struct iommu_iotlb_gather *iotlb_gather); |
| 262 | void (*flush_iotlb_all)(struct iommu_domain *domain); | 266 | void (*flush_iotlb_all)(struct iommu_domain *domain); |
| @@ -306,6 +310,12 @@ struct iommu_ops { · 43 unmodified lines | |||
| 306 | int (*page_response)(struct device *dev, | 310 | int (*page_response)(struct device *dev, |
| 307 | struct iommu_fault_event *evt, | 311 | struct iommu_fault_event *evt, |
| 308 | struct iommu_page_response *msg); | 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 | unsigned long pgsize_bitmap; | 320 | unsigned long pgsize_bitmap; |
| 311 | }; | 321 | }; |
| @@ -417,10 +427,19 @@ extern int iommu_attach_device(struct iommu_domain *domain, · 105 unmodified lines | |||
| 417 | struct device *dev); | 427 | struct device *dev); |
| 418 | extern void iommu_detach_device(struct iommu_domain *domain, | 428 | extern void iommu_detach_device(struct iommu_domain *domain, |
| 419 | struct device *dev); | 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 | extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev); | 437 | extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev); |
| 421 | extern struct iommu_domain *iommu_get_dma_domain(struct device *dev); | 438 | extern struct iommu_domain *iommu_get_dma_domain(struct device *dev); |
| 422 | extern int iommu_map(struct iommu_domain *domain, unsigned long iova, | 439 | extern int iommu_map(struct iommu_domain *domain, unsigned long iova, |
| 423 | phys_addr_t paddr, size_t size, int prot); | 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 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, | 443 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, |
| 425 | size_t size); | 444 | size_t size); |
| 426 | extern size_t iommu_unmap_fast(struct iommu_domain *domain, | 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 | struct iommu_iotlb_gather *iotlb_gather); | 447 | struct iommu_iotlb_gather *iotlb_gather); |
| 429 | extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, | 448 | extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, |
| 430 | struct scatterlist *sg,unsigned int nents, int prot); | 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 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); | 453 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); |
| 432 | extern void iommu_set_fault_handler(struct iommu_domain *domain, | 454 | extern void iommu_set_fault_handler(struct iommu_domain *domain, |
| 433 | iommu_fault_handler_t handler, void *token); | 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 | return -ENODEV; | 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 | static inline size_t iommu_unmap(struct iommu_domain *domain, | 694 | static inline size_t iommu_unmap(struct iommu_domain *domain, |
| 666 | unsigned long iova, size_t size) | 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 | return 0; | 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 | static inline void iommu_flush_tlb_all(struct iommu_domain *domain) | 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 | return IOMMU_PASID_INVALID; | 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 | #endif /* CONFIG_IOMMU_API */ | 1063 | #endif /* CONFIG_IOMMU_API */ |
| 1009 | 1064 | ||
| 1010 | #ifdef CONFIG_IOMMU_DEBUGFS | 1065 | #ifdef CONFIG_IOMMU_DEBUGFS |
| @@ -134,6 +134,7 @@ enum { · 133 unmodified lines | |||
| 134 | IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, | 134 | IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, |
| 135 | IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, | 135 | IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, |
| 136 | IORES_DESC_RESERVED = 7, | 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 | * is called, and the lower layer must get the interface from that | 224 | * is called, and the lower layer must get the interface from that |
| 225 | * call. | 225 | * call. |
| 226 | */ | 226 | */ |
| 227 | int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, | 227 | int ipmi_add_smi(struct module *owner, |
| 228 | void *send_info, | 228 | const struct ipmi_smi_handlers *handlers, |
| 229 | struct device *dev, | 229 | void *send_info, |
| 230 | unsigned char slave_addr); | 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 | * Remove a low-level interface from the IPMI driver. This will | 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 | #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY | 610 | #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY |
| 611 | extern void handle_fasteoi_ack_irq(struct irq_desc *desc); | 611 | extern void handle_fasteoi_ack_irq(struct irq_desc *desc); |
| 612 | extern void handle_fasteoi_mask_irq(struct irq_desc *desc); | 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 | extern void irq_chip_enable_parent(struct irq_data *data); | 619 | extern void irq_chip_enable_parent(struct irq_data *data); |
| 614 | extern void irq_chip_disable_parent(struct irq_data *data); | 620 | extern void irq_chip_disable_parent(struct irq_data *data); |
| 615 | extern void irq_chip_ack_parent(struct irq_data *data); | 621 | extern void irq_chip_ack_parent(struct irq_data *data); |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | #define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY) | 22 | #define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY) |
| 23 | 23 | ||
| 24 | struct irq_work { | 24 | struct irq_work { |
| 25 | unsigned long flags; | 25 | atomic_t flags; |
| 26 | struct llist_node llnode; | 26 | struct llist_node llnode; |
| 27 | void (*func)(struct irq_work *); | 27 | void (*func)(struct irq_work *); |
| 28 | }; | 28 | }; |
| @@ -30,11 +30,15 @@ struct irq_work { · 1 unmodified line | |||
| 30 | static inline | 30 | static inline |
| 31 | void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *)) | 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 | work->func = func; | 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 | bool irq_work_queue(struct irq_work *work); | 43 | bool irq_work_queue(struct irq_work *work); |
| 40 | bool irq_work_queue_on(struct irq_work *work, int cpu); | 44 | bool irq_work_queue_on(struct irq_work *work, int cpu); |
| @@ -334,10 +334,10 @@ · 333 unmodified lines | |||
| 334 | #define GITS_TYPER_PLPIS (1UL << 0) | 334 | #define GITS_TYPER_PLPIS (1UL << 0) |
| 335 | #define GITS_TYPER_VLPIS (1UL << 1) | 335 | #define GITS_TYPER_VLPIS (1UL << 1) |
| 336 | #define GITS_TYPER_ITT_ENTRY_SIZE_SHIFT 4 | 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 | #define GITS_TYPER_IDBITS_SHIFT 8 | 338 | #define GITS_TYPER_IDBITS_SHIFT 8 |
| 339 | #define GITS_TYPER_DEVBITS_SHIFT 13 | 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 | #define GITS_TYPER_PTA (1UL << 19) | 341 | #define GITS_TYPER_PTA (1UL << 19) |
| 342 | #define GITS_TYPER_HCC_SHIFT 24 | 342 | #define GITS_TYPER_HCC_SHIFT 24 |
| 343 | #define GITS_TYPER_HCC(r) (((r) >> GITS_TYPER_HCC_SHIFT) & 0xff) | 343 | #define GITS_TYPER_HCC(r) (((r) >> GITS_TYPER_HCC_SHIFT) & 0xff) |
| @@ -487,6 +487,8 @@ · 143 unmodified lines | |||
| 487 | #define ICC_CTLR_EL1_EOImode_MASK (1 << ICC_CTLR_EL1_EOImode_SHIFT) | 487 | #define ICC_CTLR_EL1_EOImode_MASK (1 << ICC_CTLR_EL1_EOImode_SHIFT) |
| 488 | #define ICC_CTLR_EL1_CBPR_SHIFT 0 | 488 | #define ICC_CTLR_EL1_CBPR_SHIFT 0 |
| 489 | #define ICC_CTLR_EL1_CBPR_MASK (1 << ICC_CTLR_EL1_CBPR_SHIFT) | 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 | #define ICC_CTLR_EL1_PRI_BITS_SHIFT 8 | 492 | #define ICC_CTLR_EL1_PRI_BITS_SHIFT 8 |
| 491 | #define ICC_CTLR_EL1_PRI_BITS_MASK (0x7 << ICC_CTLR_EL1_PRI_BITS_SHIFT) | 493 | #define ICC_CTLR_EL1_PRI_BITS_MASK (0x7 << ICC_CTLR_EL1_PRI_BITS_SHIFT) |
| 492 | #define ICC_CTLR_EL1_ID_BITS_SHIFT 11 | 494 | #define ICC_CTLR_EL1_ID_BITS_SHIFT 11 |
| @@ -32,9 +32,13 @@ struct its_vm { · 31 unmodified lines | |||
| 32 | struct its_vpe { | 32 | struct its_vpe { |
| 33 | struct page *vpt_page; | 33 | struct page *vpt_page; |
| 34 | struct its_vm *its_vm; | 34 | struct its_vm *its_vm; |
| 35 | /* per-vPE VLPI tracking */ | ||
| 36 | atomic_t vlpi_count; | ||
| 35 | /* Doorbell interrupt */ | 37 | /* Doorbell interrupt */ |
| 36 | int irq; | 38 | int irq; |
| 37 | irq_hw_number_t vpe_db_lpi; | 39 | irq_hw_number_t vpe_db_lpi; |
| 40 | /* VPE resident */ | ||
| 41 | bool resident; | ||
| 38 | /* VPE proxy mapping */ | 42 | /* VPE proxy mapping */ |
| 39 | int vpe_proxy_event; | 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 | DOMAIN_BUS_IPI, | 83 | DOMAIN_BUS_IPI, |
| 84 | DOMAIN_BUS_FSL_MC_MSI, | 84 | DOMAIN_BUS_FSL_MC_MSI, |
| 85 | DOMAIN_BUS_TI_SCI_INTA_MSI, | 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 | BH_Revoked, /* Has been revoked from the log */ | 313 | BH_Revoked, /* Has been revoked from the log */ |
| 314 | BH_RevokeValid, /* Revoked flag is valid */ | 314 | BH_RevokeValid, /* Revoked flag is valid */ |
| 315 | BH_JBDDirty, /* Is dirty but journaled */ | 315 | BH_JBDDirty, /* Is dirty but journaled */ |
| 316 | BH_State, /* Pins most journal_head state */ | ||
| 317 | BH_JournalHead, /* Pins bh->b_private and jh->b_bh */ | 316 | BH_JournalHead, /* Pins bh->b_private and jh->b_bh */ |
| 318 | BH_Shadow, /* IO on shadow buffer is running */ | 317 | BH_Shadow, /* IO on shadow buffer is running */ |
| 319 | BH_Verified, /* Metadata block has been verified ok */ | 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 | return bh->b_private; | 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 | static inline void jbd_lock_bh_journal_head(struct buffer_head *bh) | 344 | static inline void jbd_lock_bh_journal_head(struct buffer_head *bh) |
| 366 | { | 345 | { |
| 367 | bit_spin_lock(BH_JournalHead, &bh->b_state); | 346 | bit_spin_lock(BH_JournalHead, &bh->b_state); |
| @@ -477,7 +456,9 @@ struct jbd2_revoke_table_s; · 109 unmodified lines | |||
| 477 | * @h_transaction: Which compound transaction is this update a part of? | 456 | * @h_transaction: Which compound transaction is this update a part of? |
| 478 | * @h_journal: Which journal handle belongs to - used iff h_reserved set. | 457 | * @h_journal: Which journal handle belongs to - used iff h_reserved set. |
| 479 | * @h_rsv_handle: Handle reserved for finishing the logical operation. | 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 | * @h_ref: Reference count on this handle. | 462 | * @h_ref: Reference count on this handle. |
| 482 | * @h_err: Field for caller's use to track errors through large fs operations. | 463 | * @h_err: Field for caller's use to track errors through large fs operations. |
| 483 | * @h_sync: Flag for sync-on-close. | 464 | * @h_sync: Flag for sync-on-close. |
| @@ -487,7 +468,8 @@ struct jbd2_revoke_table_s; · 3 unmodified lines | |||
| 487 | * @h_type: For handle statistics. | 468 | * @h_type: For handle statistics. |
| 488 | * @h_line_no: For handle statistics. | 469 | * @h_line_no: For handle statistics. |
| 489 | * @h_start_jiffies: Handle Start time. | 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 | * @saved_alloc_context: Saved context while transaction is open. | 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 | handle_t *h_rsv_handle; | 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 | int h_ref; | 492 | int h_ref; |
| 509 | int h_err; | 493 | int h_err; |
| 510 | 494 | ||
| @@ -556,9 +540,9 @@ struct transaction_chp_stats_s { · 45 unmodified lines | |||
| 556 | * ->jbd_lock_bh_journal_head() (This is "innermost") | 540 | * ->jbd_lock_bh_journal_head() (This is "innermost") |
| 557 | * | 541 | * |
| 558 | * j_state_lock | 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 | * ->j_list_lock | 546 | * ->j_list_lock |
| 563 | * | 547 | * |
| 564 | * j_state_lock | 548 | * j_state_lock |
| @@ -681,11 +665,24 @@ struct transaction_s · 116 unmodified lines | |||
| 681 | atomic_t t_updates; | 665 | atomic_t t_updates; |
| 682 | 666 | ||
| 683 | /* | 667 | /* |
| 684 | * Number of buffers reserved for use by all handles in this transaction | 668 | * Number of blocks reserved for this transaction in the journal. |
| 685 | * handle but not yet modified. [none] | 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 | atomic_t t_outstanding_credits; | 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 | * Forward and backward links for the circular list of all transactions | 687 | * Forward and backward links for the circular list of all transactions |
| 691 | * awaiting checkpoint. [j_list_lock] | 688 | * awaiting checkpoint. [j_list_lock] |
| @@ -703,11 +700,6 @@ struct transaction_s · 11 unmodified lines | |||
| 703 | */ | 700 | */ |
| 704 | ktime_t t_start_time; | 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 | * This transaction is being forced and some process is | 704 | * This transaction is being forced and some process is |
| 713 | * waiting for it to finish. | 705 | * waiting for it to finish. |
| @@ -1024,6 +1016,13 @@ struct journal_s · 310 unmodified lines | |||
| 1024 | */ | 1016 | */ |
| 1025 | int j_max_transaction_buffers; | 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 | * @j_commit_interval: | 1027 | * @j_commit_interval: |
| 1029 | * | 1028 | * |
| @@ -1170,7 +1169,7 @@ struct journal_s · 140 unmodified lines | |||
| 1170 | #define jbd2_might_wait_for_commit(j) \ | 1169 | #define jbd2_might_wait_for_commit(j) \ |
| 1171 | do { \ | 1170 | do { \ |
| 1172 | rwsem_acquire(&j->j_trans_commit_map, 0, 0, _THIS_IP_); \ | 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 | } while (0) | 1173 | } while (0) |
| 1175 | 1174 | ||
| 1176 | /* journal feature predicate functions */ | 1175 | /* journal feature predicate functions */ |
| @@ -1257,7 +1256,7 @@ JBD2_FEATURE_INCOMPAT_FUNCS(csum3, CSUM_V3) · 80 unmodified lines | |||
| 1257 | 1256 | ||
| 1258 | /* Filing buffers */ | 1257 | /* Filing buffers */ |
| 1259 | extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *); | 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 | extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *); | 1260 | extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *); |
| 1262 | extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); | 1261 | extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); |
| 1263 | extern void __journal_free_buffer(struct journal_head *bh); | 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 | extern handle_t *jbd2_journal_start(journal_t *, int nblocks); | 1358 | extern handle_t *jbd2_journal_start(journal_t *, int nblocks); |
| 1360 | extern handle_t *jbd2__journal_start(journal_t *, int blocks, int rsv_blocks, | 1359 | extern handle_t *jbd2__journal_start(journal_t *, int blocks, int rsv_blocks, |
| 1361 | gfp_t gfp_mask, unsigned int type, | 1360 | int revoke_records, gfp_t gfp_mask, |
| 1362 | unsigned int line_no); | 1361 | unsigned int type, unsigned int line_no); |
| 1363 | extern int jbd2_journal_restart(handle_t *, int nblocks); | 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 | extern int jbd2_journal_start_reserved(handle_t *handle, | 1365 | extern int jbd2_journal_start_reserved(handle_t *handle, |
| 1366 | unsigned int type, unsigned int line_no); | 1366 | unsigned int type, unsigned int line_no); |
| 1367 | extern void jbd2_journal_free_reserved(handle_t *handle); | 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 | extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); | 1370 | extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); |
| 1370 | extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); | 1371 | extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); |
| 1371 | extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); | 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 | return journal->j_chksum_driver != NULL; | 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 | * Return number of free blocks in the log. Must be called under j_state_lock. | 1565 | * Return number of free blocks in the log. Must be called under j_state_lock. |
| 1581 | */ | 1566 | */ |
| 1582 | static inline unsigned long jbd2_log_space_left(journal_t *journal) | 1567 | static inline unsigned long jbd2_log_space_left(journal_t *journal) |
| 1583 | { | 1568 | { |
| 1584 | /* Allow for rounding errors */ | 1569 | /* Allow for rounding errors */ |
| 1585 | unsigned long free = journal->j_free - 32; | 1570 | long free = journal->j_free - 32; |
| 1586 | 1571 | ||
| 1587 | if (journal->j_committing_transaction) { | 1572 | if (journal->j_committing_transaction) { |
| 1588 | unsigned long committing = atomic_read(&journal-> | 1573 | free -= atomic_read(&journal-> |
| 1589 | j_committing_transaction->t_outstanding_credits); | 1574 | j_committing_transaction->t_outstanding_credits); |
| 1590 | |||
| 1591 | /* Transaction + control blocks */ | ||
| 1592 | free -= committing + (committing >> JBD2_CONTROL_BLOCKS_SHIFT); | ||
| 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 | return tid; | 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 | #ifdef __KERNEL__ | 1644 | #ifdef __KERNEL__ |
| 1649 | 1645 | ||
| 1650 | #define buffer_trace_init(bh) do {} while (0) | 1646 | #define buffer_trace_init(bh) do {} while (0) |
| @@ -11,6 +11,8 @@ · 10 unmodified lines | |||
| 11 | #ifndef JOURNAL_HEAD_H_INCLUDED | 11 | #ifndef JOURNAL_HEAD_H_INCLUDED |
| 12 | #define JOURNAL_HEAD_H_INCLUDED | 12 | #define JOURNAL_HEAD_H_INCLUDED |
| 13 | 13 | ||
| 14 | #include <linux/spinlock.h> | ||
| 15 | |||
| 14 | typedef unsigned int tid_t; /* Unique transaction ID */ | 16 | typedef unsigned int tid_t; /* Unique transaction ID */ |
| 15 | typedef struct transaction_s transaction_t; /* Compound transaction type */ | 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 | struct buffer_head *b_bh; | 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 | * Reference count - see description in journal.c | 34 | * Reference count - see description in journal.c |
| 28 | * [jbd_lock_bh_journal_head()] | 35 | * [jbd_lock_bh_journal_head()] |
| @@ -30,7 +37,7 @@ struct journal_head { · 1 unmodified line | |||
| 30 | int b_jcount; | 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 | * NOTE: We *cannot* combine this with b_modified into a bitfield | 41 | * NOTE: We *cannot* combine this with b_modified into a bitfield |
| 35 | * as gcc would then (which the C standard allows but which is | 42 | * as gcc would then (which the C standard allows but which is |
| 36 | * very unuseful) make 64-bit accesses to the bitfield and clobber | 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 | * This flag signals the buffer has been modified by | 49 | * This flag signals the buffer has been modified by |
| 43 | * the currently running transaction | 50 | * the currently running transaction |
| 44 | * [jbd_lock_bh_state()] | 51 | * [b_state_lock] |
| 45 | */ | 52 | */ |
| 46 | unsigned b_modified; | 53 | unsigned b_modified; |
| 47 | 54 | ||
| 48 | /* | 55 | /* |
| 49 | * Copy of the buffer data frozen for writing to the log. | 56 | * Copy of the buffer data frozen for writing to the log. |
| 50 | * [jbd_lock_bh_state()] | 57 | * [b_state_lock] |
| 51 | */ | 58 | */ |
| 52 | char *b_frozen_data; | 59 | char *b_frozen_data; |
| 53 | 60 | ||
| 54 | /* | 61 | /* |
| 55 | * Pointer to a saved copy of the buffer containing no uncommitted | 62 | * Pointer to a saved copy of the buffer containing no uncommitted |
| 56 | * deallocation references, so that allocations can avoid overwriting | 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 | char *b_committed_data; | 66 | char *b_committed_data; |
| 60 | 67 | ||
| @@ -63,7 +70,7 @@ struct journal_head { · 2 unmodified lines | |||
| 63 | * metadata: either the running transaction or the committing | 70 | * metadata: either the running transaction or the committing |
| 64 | * transaction (if there is one). Only applies to buffers on a | 71 | * transaction (if there is one). Only applies to buffers on a |
| 65 | * transaction's data or metadata journaling list. | 72 | * transaction's data or metadata journaling list. |
| 66 | * [j_list_lock] [jbd_lock_bh_state()] | 73 | * [j_list_lock] [b_state_lock] |
| 67 | * Either of these locks is enough for reading, both are needed for | 74 | * Either of these locks is enough for reading, both are needed for |
| 68 | * changes. | 75 | * changes. |
| 69 | */ | 76 | */ |
| @@ -73,13 +80,13 @@ struct journal_head { · 3 unmodified lines | |||
| 73 | * Pointer to the running compound transaction which is currently | 80 | * Pointer to the running compound transaction which is currently |
| 74 | * modifying the buffer's metadata, if there was already a transaction | 81 | * modifying the buffer's metadata, if there was already a transaction |
| 75 | * committing it when the new transaction touched it. | 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 | transaction_t *b_next_transaction; | 85 | transaction_t *b_next_transaction; |
| 79 | 86 | ||
| 80 | /* | 87 | /* |
| 81 | * Doubly-linked list of buffers on a transaction's data, metadata or | 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 | struct journal_head *b_tnext, *b_tprev; | 91 | struct journal_head *b_tnext, *b_tprev; |
| 85 | 92 | ||
| @@ -70,8 +70,18 @@ struct kasan_cache { · 69 unmodified lines | |||
| 70 | int free_meta_offset; | 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 | int kasan_module_alloc(void *addr, size_t size); | 79 | int kasan_module_alloc(void *addr, size_t size); |
| 74 | void kasan_free_shadow(const struct vm_struct *vm); | 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 | int kasan_add_zero_shadow(void *start, unsigned long size); | 86 | int kasan_add_zero_shadow(void *start, unsigned long size); |
| 77 | void kasan_remove_zero_shadow(void *start, unsigned long size); | 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 | #endif /* CONFIG_KASAN_SW_TAGS */ | 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 | #endif /* LINUX_KASAN_H */ | 231 | #endif /* LINUX_KASAN_H */ |
| @@ -37,12 +37,35 @@ do { \ · 36 unmodified lines | |||
| 37 | (t)->kcov_mode &= ~KCOV_IN_CTXSW; \ | 37 | (t)->kcov_mode &= ~KCOV_IN_CTXSW; \ |
| 38 | } while (0) | 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 | #else | 55 | #else |
| 41 | 56 | ||
| 42 | static inline void kcov_task_init(struct task_struct *t) {} | 57 | static inline void kcov_task_init(struct task_struct *t) {} |
| 43 | static inline void kcov_task_exit(struct task_struct *t) {} | 58 | static inline void kcov_task_exit(struct task_struct *t) {} |
| 44 | static inline void kcov_prepare_switch(struct task_struct *t) {} | 59 | static inline void kcov_prepare_switch(struct task_struct *t) {} |
| 45 | static inline void kcov_finish_switch(struct task_struct *t) {} | 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 | #endif /* CONFIG_KCOV */ | 70 | #endif /* CONFIG_KCOV */ |
| 48 | #endif /* _LINUX_KCOV_H */ | 71 | #endif /* _LINUX_KCOV_H */ |
| @@ -328,13 +328,6 @@ extern int oops_may_print(void); · 327 unmodified lines | |||
| 328 | void do_exit(long error_code) __noreturn; | 328 | void do_exit(long error_code) __noreturn; |
| 329 | void complete_and_exit(struct completion *, long) __noreturn; | 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 | /* Internal, do not use. */ | 331 | /* Internal, do not use. */ |
| 339 | int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); | 332 | int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); |
| 340 | int __must_check _kstrtol(const char *s, unsigned int base, long *res); | 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 | * @res: Where to write the result of the conversion on success. | 348 | * @res: Where to write the result of the conversion on success. |
| 356 | * | 349 | * |
| 357 | * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. | 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 | 351 | * Used as a replacement for the simple_strtoull. Return code must be checked. |
| 359 | * be checked. | ||
| 360 | */ | 352 | */ |
| 361 | static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res) | 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 | * @res: Where to write the result of the conversion on success. | 376 | * @res: Where to write the result of the conversion on success. |
| 385 | * | 377 | * |
| 386 | * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. | 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 | 379 | * Used as a replacement for the simple_strtoull. Return code must be checked. |
| 388 | * be checked. | ||
| 389 | */ | 380 | */ |
| 390 | static inline int __must_check kstrtol(const char *s, unsigned int base, long *res) | 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 | return kstrtoint_from_user(s, count, base, res); | 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 | extern unsigned long simple_strtoul(const char *,char **,unsigned int); | 468 | extern unsigned long simple_strtoul(const char *,char **,unsigned int); |
| 467 | extern long simple_strtol(const char *,char **,unsigned int); | 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 | return kstat_cpu(cpu).irqs_sum; | 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 | extern void account_user_time(struct task_struct *, u64); | 99 | extern void account_user_time(struct task_struct *, u64); |
| 82 | extern void account_guest_time(struct task_struct *, u64); | 100 | extern void account_guest_time(struct task_struct *, u64); |
| 83 | extern void account_system_time(struct task_struct *, int, u64); | 101 | extern void account_system_time(struct task_struct *, int, u64); |
| @@ -104,21 +104,6 @@ struct kernfs_elem_attr { · 103 unmodified lines | |||
| 104 | struct kernfs_node *notify_next; /* for kernfs_notify() */ | 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 | * kernfs_node - the building block of kernfs hierarchy. Each and every | 108 | * kernfs_node - the building block of kernfs hierarchy. Each and every |
| 124 | * kernfs node is represented by single kernfs_node. Most fields are | 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 | void *priv; | 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 | unsigned short flags; | 149 | unsigned short flags; |
| 160 | umode_t mode; | 150 | umode_t mode; |
| 161 | struct kernfs_iattrs *iattr; | 151 | struct kernfs_iattrs *iattr; |
| @@ -187,7 +177,8 @@ struct kernfs_root { · 25 unmodified lines | |||
| 187 | 177 | ||
| 188 | /* private fields, do not use outside kernfs proper */ | 178 | /* private fields, do not use outside kernfs proper */ |
| 189 | struct idr ino_idr; | 179 | struct idr ino_idr; |
| 190 | u32 next_generation; | 180 | u32 last_id_lowbits; |
| 181 | u32 id_highbits; | ||
| 191 | struct kernfs_syscall_ops *syscall_ops; | 182 | struct kernfs_syscall_ops *syscall_ops; |
| 192 | 183 | ||
| 193 | /* list of kernfs_super_info of this root, protected by kernfs_mutex */ | 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 | return kn->flags & KERNFS_TYPE_MASK; | 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 | * kernfs_enable_ns - enable namespace under a directory | 314 | * kernfs_enable_ns - enable namespace under a directory |
| 296 | * @kn: directory of interest, should be empty | 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 | void kernfs_init(void); | 402 | void kernfs_init(void); |
| 384 | 403 | ||
| 385 | struct kernfs_node *kernfs_get_node_by_id(struct kernfs_root *root, | 404 | struct kernfs_node *kernfs_find_and_get_node_by_id(struct kernfs_root *root, |
| 386 | const union kernfs_node_id *id); | 405 | u64 id); |
| 387 | #else /* CONFIG_KERNFS */ | 406 | #else /* CONFIG_KERNFS */ |
| 388 | 407 | ||
| 389 | static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) | 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 | #define KVM_REQUEST_ARCH_BASE 8 | 149 | #define KVM_REQUEST_ARCH_BASE 8 |
| 150 | 150 | ||
| 151 | #define KVM_ARCH_REQ_FLAGS(nr, flags) ({ \ | 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 | (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \ | 153 | (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \ |
| 154 | }) | 154 | }) |
| 155 | #define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0) | 155 | #define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0) |
| @@ -266,7 +266,8 @@ struct kvm_vcpu { · 110 unmodified lines | |||
| 266 | struct preempt_notifier preempt_notifier; | 266 | struct preempt_notifier preempt_notifier; |
| 267 | #endif | 267 | #endif |
| 268 | int cpu; | 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 | int srcu_idx; | 271 | int srcu_idx; |
| 271 | int mode; | 272 | int mode; |
| 272 | u64 requests; | 273 | u64 requests; |
| @@ -278,7 +279,6 @@ struct kvm_vcpu { · 5 unmodified lines | |||
| 278 | struct mutex mutex; | 279 | struct mutex mutex; |
| 279 | struct kvm_run *run; | 280 | struct kvm_run *run; |
| 280 | 281 | ||
| 281 | int guest_xcr0_loaded; | ||
| 282 | struct swait_queue_head wq; | 282 | struct swait_queue_head wq; |
| 283 | struct pid __rcu *pid; | 283 | struct pid __rcu *pid; |
| 284 | int sigset_active; | 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 | static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) | 572 | static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) |
| 573 | { | 573 | { |
| 574 | struct kvm_vcpu *tmp; | 574 | return vcpu->vcpu_idx; |
| 575 | int idx; | ||
| 576 | |||
| 577 | kvm_for_each_vcpu(idx, tmp, vcpu->kvm) | ||
| 578 | if (tmp == vcpu) | ||
| 579 | return idx; | ||
| 580 | BUG(); | ||
| 581 | } | 575 | } |
| 582 | 576 | ||
| 583 | #define kvm_for_each_memslot(memslot, slots) \ | 577 | #define kvm_for_each_memslot(memslot, slots) \ |
| @@ -622,6 +616,7 @@ void kvm_exit(void); · 38 unmodified lines | |||
| 622 | 616 | ||
| 623 | void kvm_get_kvm(struct kvm *kvm); | 617 | void kvm_get_kvm(struct kvm *kvm); |
| 624 | void kvm_put_kvm(struct kvm *kvm); | 618 | void kvm_put_kvm(struct kvm *kvm); |
| 619 | void kvm_put_kvm_no_destroy(struct kvm *kvm); | ||
| 625 | 620 | ||
| 626 | static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) | 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 | unsigned long len); | 741 | unsigned long len); |
| 747 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | 742 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
| 748 | gpa_t gpa, unsigned long len); | 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 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); | 766 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); |
| 750 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); | 767 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); |
| 751 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); | 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 | bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, | 808 | bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, |
| 792 | unsigned long *vcpu_bitmap, cpumask_var_t tmp); | 809 | unsigned long *vcpu_bitmap, cpumask_var_t tmp); |
| 793 | bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req); | 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 | long kvm_arch_dev_ioctl(struct file *filp, | 814 | long kvm_arch_dev_ioctl(struct file *filp, |
| 796 | unsigned int ioctl, unsigned long arg); | 815 | unsigned int ioctl, unsigned long arg); |
| @@ -1241,7 +1260,7 @@ extern unsigned int halt_poll_ns_grow_start; · 444 unmodified lines | |||
| 1241 | extern unsigned int halt_poll_ns_shrink; | 1260 | extern unsigned int halt_poll_ns_shrink; |
| 1242 | 1261 | ||
| 1243 | struct kvm_device { | 1262 | struct kvm_device { |
| 1244 | struct kvm_device_ops *ops; | 1263 | const struct kvm_device_ops *ops; |
| 1245 | struct kvm *kvm; | 1264 | struct kvm *kvm; |
| 1246 | void *private; | 1265 | void *private; |
| 1247 | struct list_head vm_node; | 1266 | struct list_head vm_node; |
| @@ -1294,7 +1313,7 @@ struct kvm_device_ops { · 46 unmodified lines | |||
| 1294 | void kvm_device_get(struct kvm_device *dev); | 1313 | void kvm_device_get(struct kvm_device *dev); |
| 1295 | void kvm_device_put(struct kvm_device *dev); | 1314 | void kvm_device_put(struct kvm_device *dev); |
| 1296 | struct kvm_device *kvm_device_from_filp(struct file *filp); | 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 | void kvm_unregister_device_ops(u32 type); | 1317 | void kvm_unregister_device_ops(u32 type); |
| 1299 | 1318 | ||
| 1300 | extern struct kvm_device_ops kvm_mpic_ops; | 1319 | extern struct kvm_device_ops kvm_mpic_ops; |
| @@ -35,6 +35,8 @@ typedef unsigned long gva_t; · 34 unmodified lines | |||
| 35 | typedef u64 gpa_t; | 35 | typedef u64 gpa_t; |
| 36 | typedef u64 gfn_t; | 36 | typedef u64 gfn_t; |
| 37 | 37 | ||
| 38 | #define GPA_INVALID (~(gpa_t)0) | ||
| 39 | |||
| 38 | typedef unsigned long hva_t; | 40 | typedef unsigned long hva_t; |
| 39 | typedef u64 hpa_t; | 41 | typedef u64 hpa_t; |
| 40 | typedef u64 hfn_t; | 42 | typedef u64 hfn_t; |
| @@ -94,12 +94,15 @@ static inline struct led_classdev_flash *lcdev_to_flcdev( · 93 unmodified lines | |||
| 94 | * | 94 | * |
| 95 | * Returns: 0 on success or negative error value on failure | 95 | * Returns: 0 on success or negative error value on failure |
| 96 | */ | 96 | */ |
| 97 | extern int led_classdev_flash_register_ext(struct device *parent, | 97 | int led_classdev_flash_register_ext(struct device *parent, |
| 98 | struct led_classdev_flash *fled_cdev, | 98 | struct led_classdev_flash *fled_cdev, |
| 99 | struct led_init_data *init_data); | 99 | struct led_init_data *init_data); |
| 100 | 100 | ||
| 101 | #define led_classdev_flash_register(parent, fled_cdev) \ | 101 | static inline int led_classdev_flash_register(struct device *parent, |
| 102 | led_classdev_flash_register_ext(parent, fled_cdev, NULL) | 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 | * led_classdev_flash_unregister - unregisters an object of led_classdev class | 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 | * Unregister a previously registered via led_classdev_flash_register object | 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 | * led_set_flash_strobe - setup flash strobe | 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 | * Returns: 0 on success or negative error value on failure | 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, | 176 | int led_set_flash_brightness(struct led_classdev_flash *fled_cdev, |
| 160 | u32 brightness); | 177 | u32 brightness); |
| 161 | 178 | ||
| 162 | /** | 179 | /** |
| 163 | * led_update_flash_brightness - update flash LED brightness | 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 | * Returns: 0 on success or negative error value on failure | 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 | * led_set_flash_timeout - set flash LED timeout | 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 | * Returns: 0 on success or negative error value on failure | 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, | 199 | int led_set_flash_timeout(struct led_classdev_flash *fled_cdev, u32 timeout); |
| 183 | u32 timeout); | ||
| 184 | 200 | ||
| 185 | /** | 201 | /** |
| 186 | * led_get_flash_fault - get the flash LED fault | 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 | * Returns: 0 on success or negative error value on failure | 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, | 210 | int led_get_flash_fault(struct led_classdev_flash *fled_cdev, u32 *fault); |
| 195 | u32 *fault); | ||
| 196 | 211 | ||
| 197 | #endif /* __LINUX_FLASH_LEDS_H_INCLUDED */ | 212 | #endif /* __LINUX_FLASH_LEDS_H_INCLUDED */ |
| @@ -161,7 +161,7 @@ struct led_classdev { · 160 unmodified lines | |||
| 161 | * | 161 | * |
| 162 | * Returns: 0 on success or negative error value on failure | 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 | struct led_classdev *led_cdev, | 165 | struct led_classdev *led_cdev, |
| 166 | struct led_init_data *init_data); | 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 | return led_classdev_register_ext(parent, led_cdev, NULL); | 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 | struct led_classdev *led_cdev, | 185 | struct led_classdev *led_cdev, |
| 186 | struct led_init_data *init_data); | 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 | return devm_led_classdev_register_ext(parent, led_cdev, NULL); | 191 | return devm_led_classdev_register_ext(parent, led_cdev, NULL); |
| 192 | } | 192 | } |
| 193 | extern void led_classdev_unregister(struct led_classdev *led_cdev); | 193 | void led_classdev_unregister(struct led_classdev *led_cdev); |
| 194 | extern void devm_led_classdev_unregister(struct device *parent, | 194 | void devm_led_classdev_unregister(struct device *parent, |
| 195 | struct led_classdev *led_cdev); | 195 | struct led_classdev *led_cdev); |
| 196 | extern void led_classdev_suspend(struct led_classdev *led_cdev); | 196 | void led_classdev_suspend(struct led_classdev *led_cdev); |
| 197 | extern void led_classdev_resume(struct led_classdev *led_cdev); | 197 | void led_classdev_resume(struct led_classdev *led_cdev); |
| 198 | 198 | ||
| 199 | /** | 199 | /** |
| 200 | * led_blink_set - set blinking with software fallback | 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 | * led_cdev->brightness_set() will not stop the blinking, | 211 | * led_cdev->brightness_set() will not stop the blinking, |
| 212 | * use led_classdev_brightness_set() instead. | 212 | * use led_classdev_brightness_set() instead. |
| 213 | */ | 213 | */ |
| 214 | extern void led_blink_set(struct led_classdev *led_cdev, | 214 | void led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, |
| 215 | unsigned long *delay_on, | 215 | unsigned long *delay_off); |
| 216 | unsigned long *delay_off); | ||
| 217 | /** | 216 | /** |
| 218 | * led_blink_set_oneshot - do a oneshot software blink | 217 | * led_blink_set_oneshot - do a oneshot software blink |
| 219 | * @led_cdev: the LED to start blinking | 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 | * If invert is set, led blinks for delay_off first, then for | 227 | * If invert is set, led blinks for delay_off first, then for |
| 229 | * delay_on and leave the led on after the on-off cycle. | 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, | 230 | void led_blink_set_oneshot(struct led_classdev *led_cdev, |
| 232 | unsigned long *delay_on, | 231 | unsigned long *delay_on, unsigned long *delay_off, |
| 233 | unsigned long *delay_off, | 232 | int invert); |
| 234 | int invert); | ||
| 235 | /** | 233 | /** |
| 236 | * led_set_brightness - set LED brightness | 234 | * led_set_brightness - set LED brightness |
| 237 | * @led_cdev: the LED to set | 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 | * software blink timer that implements blinking when the | 239 | * software blink timer that implements blinking when the |
| 242 | * hardware doesn't. This function is guaranteed not to sleep. | 240 | * hardware doesn't. This function is guaranteed not to sleep. |
| 243 | */ | 241 | */ |
| 244 | extern void led_set_brightness(struct led_classdev *led_cdev, | 242 | void led_set_brightness(struct led_classdev *led_cdev, |
| 245 | enum led_brightness brightness); | 243 | enum led_brightness brightness); |
| 246 | 244 | ||
| 247 | /** | 245 | /** |
| 248 | * led_set_brightness_sync - set LED brightness synchronously | 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 | * Returns: 0 on success or negative error value on failure | 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, | 256 | int led_set_brightness_sync(struct led_classdev *led_cdev, |
| 259 | enum led_brightness value); | 257 | enum led_brightness value); |
| 260 | 258 | ||
| 261 | /** | 259 | /** |
| 262 | * led_update_brightness - update LED brightness | 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 | * Returns: 0 on success or negative error value on failure | 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 | * led_get_default_pattern - return default pattern | 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 | * Return: Allocated array of integers with default pattern from device tree | 277 | * Return: Allocated array of integers with default pattern from device tree |
| 280 | * or NULL. Caller is responsible for kfree(). | 278 | * or NULL. Caller is responsible for kfree(). |
| 281 | */ | 279 | */ |
| 282 | extern u32 *led_get_default_pattern(struct led_classdev *led_cdev, | 280 | u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size); |
| 283 | unsigned int *size); | ||
| 284 | 281 | ||
| 285 | /** | 282 | /** |
| 286 | * led_sysfs_disable - disable LED sysfs interface | 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 | * Disable the led_cdev's sysfs interface. | 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 | * led_sysfs_enable - enable LED sysfs interface | 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 | * Enable the led_cdev's sysfs interface. | 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 | * led_compose_name - compose LED class device name | 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 | * Returns: 0 on success or negative error value on failure | 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, | 310 | int led_compose_name(struct device *dev, struct led_init_data *init_data, |
| 314 | char *led_classdev_name); | 311 | char *led_classdev_name); |
| 315 | 312 | ||
| 316 | /** | 313 | /** |
| 317 | * led_sysfs_is_disabled - check if LED sysfs interface is disabled | 314 | * led_sysfs_is_disabled - check if LED sysfs interface is disabled |
| @@ -360,33 +357,25 @@ struct led_trigger { · 42 unmodified lines | |||
| 360 | #define led_trigger_get_led(dev) ((struct led_classdev *)dev_get_drvdata((dev))) | 357 | #define led_trigger_get_led(dev) ((struct led_classdev *)dev_get_drvdata((dev))) |
| 361 | #define led_trigger_get_drvdata(dev) (led_get_trigger_data(led_trigger_get_led(dev))) | 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 | /* Registration functions for complex triggers */ | 360 | /* Registration functions for complex triggers */ |
| 369 | extern int led_trigger_register(struct led_trigger *trigger); | 361 | int led_trigger_register(struct led_trigger *trigger); |
| 370 | extern void led_trigger_unregister(struct led_trigger *trigger); | 362 | void led_trigger_unregister(struct led_trigger *trigger); |
| 371 | extern int devm_led_trigger_register(struct device *dev, | 363 | int devm_led_trigger_register(struct device *dev, |
| 372 | struct led_trigger *trigger); | 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 | struct led_trigger **trigger); | 367 | struct led_trigger **trigger); |
| 376 | extern void led_trigger_unregister_simple(struct led_trigger *trigger); | 368 | void led_trigger_unregister_simple(struct led_trigger *trigger); |
| 377 | extern void led_trigger_event(struct led_trigger *trigger, | 369 | void led_trigger_event(struct led_trigger *trigger, enum led_brightness event); |
| 378 | enum led_brightness event); | 370 | void led_trigger_blink(struct led_trigger *trigger, unsigned long *delay_on, |
| 379 | extern void led_trigger_blink(struct led_trigger *trigger, | 371 | unsigned long *delay_off); |
| 380 | unsigned long *delay_on, | 372 | void led_trigger_blink_oneshot(struct led_trigger *trigger, |
| 381 | unsigned long *delay_off); | 373 | unsigned long *delay_on, |
| 382 | extern void led_trigger_blink_oneshot(struct led_trigger *trigger, | 374 | unsigned long *delay_off, |
| 383 | unsigned long *delay_on, | 375 | int invert); |
| 384 | unsigned long *delay_off, | 376 | void led_trigger_set_default(struct led_classdev *led_cdev); |
| 385 | int invert); | 377 | int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger); |
| 386 | extern void led_trigger_set_default(struct led_classdev *led_cdev); | 378 | void led_trigger_remove(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); | ||
| 390 | 379 | ||
| 391 | static inline void led_set_trigger_data(struct led_classdev *led_cdev, | 380 | static inline void led_set_trigger_data(struct led_classdev *led_cdev, |
| 392 | void *trigger_data) | 381 | void *trigger_data) |
| @@ -414,8 +403,7 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev) · 21 unmodified lines | |||
| 414 | * This is meant to be used on triggers with statically | 403 | * This is meant to be used on triggers with statically |
| 415 | * allocated name. | 404 | * allocated name. |
| 416 | */ | 405 | */ |
| 417 | extern void led_trigger_rename_static(const char *name, | 406 | void led_trigger_rename_static(const char *name, struct led_trigger *trig); |
| 418 | struct led_trigger *trig); | ||
| 419 | 407 | ||
| 420 | #define module_led_trigger(__led_trigger) \ | 408 | #define module_led_trigger(__led_trigger) \ |
| 421 | module_driver(__led_trigger, led_trigger_register, \ | 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 | /* Trigger specific functions */ | 446 | /* Trigger specific functions */ |
| 459 | #ifdef CONFIG_LEDS_TRIGGER_DISK | 447 | #ifdef CONFIG_LEDS_TRIGGER_DISK |
| 460 | extern void ledtrig_disk_activity(bool write); | 448 | void ledtrig_disk_activity(bool write); |
| 461 | #else | 449 | #else |
| 462 | static inline void ledtrig_disk_activity(bool write) {} | 450 | static inline void ledtrig_disk_activity(bool write) {} |
| 463 | #endif | 451 | #endif |
| 464 | 452 | ||
| 465 | #ifdef CONFIG_LEDS_TRIGGER_MTD | 453 | #ifdef CONFIG_LEDS_TRIGGER_MTD |
| 466 | extern void ledtrig_mtd_activity(void); | 454 | void ledtrig_mtd_activity(void); |
| 467 | #else | 455 | #else |
| 468 | static inline void ledtrig_mtd_activity(void) {} | 456 | static inline void ledtrig_mtd_activity(void) {} |
| 469 | #endif | 457 | #endif |
| 470 | 458 | ||
| 471 | #if defined(CONFIG_LEDS_TRIGGER_CAMERA) || defined(CONFIG_LEDS_TRIGGER_CAMERA_MODULE) | 459 | #if defined(CONFIG_LEDS_TRIGGER_CAMERA) || defined(CONFIG_LEDS_TRIGGER_CAMERA_MODULE) |
| 472 | extern void ledtrig_flash_ctrl(bool on); | 460 | void ledtrig_flash_ctrl(bool on); |
| 473 | extern void ledtrig_torch_ctrl(bool on); | 461 | void ledtrig_torch_ctrl(bool on); |
| 474 | #else | 462 | #else |
| 475 | static inline void ledtrig_flash_ctrl(bool on) {} | 463 | static inline void ledtrig_flash_ctrl(bool on) {} |
| 476 | static inline void ledtrig_torch_ctrl(bool on) {} | 464 | static inline void ledtrig_torch_ctrl(bool on) {} |
| @@ -550,7 +538,7 @@ enum cpu_led_event { · 73 unmodified lines | |||
| 550 | CPU_LED_HALTED, /* Machine shutdown */ | 538 | CPU_LED_HALTED, /* Machine shutdown */ |
| 551 | }; | 539 | }; |
| 552 | #ifdef CONFIG_LEDS_TRIGGER_CPU | 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 | #else | 542 | #else |
| 555 | static inline void ledtrig_cpu(enum cpu_led_event evt) | 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 | #endif | 547 | #endif |
| 560 | 548 | ||
| 561 | #ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED | 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 | struct led_classdev *led_cdev, enum led_brightness brightness); | 551 | struct led_classdev *led_cdev, enum led_brightness brightness); |
| 564 | #else | 552 | #else |
| 565 | static inline void led_classdev_notify_brightness_hw_changed( | 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 | enum ata_completion_errors { | 486 | enum ata_completion_errors { |
| 487 | AC_ERR_OK = 0, /* no error */ | ||
| 487 | AC_ERR_DEV = (1 << 0), /* device reported error */ | 488 | AC_ERR_DEV = (1 << 0), /* device reported error */ |
| 488 | AC_ERR_HSM = (1 << 1), /* host state machine violation */ | 489 | AC_ERR_HSM = (1 << 1), /* host state machine violation */ |
| 489 | AC_ERR_TIMEOUT = (1 << 2), /* timeout */ | 490 | AC_ERR_TIMEOUT = (1 << 2), /* timeout */ |
| @@ -891,9 +892,9 @@ struct ata_port_operations { · 401 unmodified lines | |||
| 891 | /* | 892 | /* |
| 892 | * Command execution | 893 | * Command execution |
| 893 | */ | 894 | */ |
| 894 | int (*qc_defer)(struct ata_queued_cmd *qc); | 895 | int (*qc_defer)(struct ata_queued_cmd *qc); |
| 895 | int (*check_atapi_dma)(struct ata_queued_cmd *qc); | 896 | int (*check_atapi_dma)(struct ata_queued_cmd *qc); |
| 896 | void (*qc_prep)(struct ata_queued_cmd *qc); | 897 | enum ata_completion_errors (*qc_prep)(struct ata_queued_cmd *qc); |
| 897 | unsigned int (*qc_issue)(struct ata_queued_cmd *qc); | 898 | unsigned int (*qc_issue)(struct ata_queued_cmd *qc); |
| 898 | bool (*qc_fill_rtf)(struct ata_queued_cmd *qc); | 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 | extern const char *ata_mode_string(unsigned long xfer_mask); | 1162 | extern const char *ata_mode_string(unsigned long xfer_mask); |
| 1162 | extern unsigned long ata_id_xfermask(const u16 *id); | 1163 | extern unsigned long ata_id_xfermask(const u16 *id); |
| 1163 | extern int ata_std_qc_defer(struct ata_queued_cmd *qc); | 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 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 1166 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
| 1166 | unsigned int n_elem); | 1167 | unsigned int n_elem); |
| 1167 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); | 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 | struct ata_taskfile *tf, u16 *id); | 1175 | struct ata_taskfile *tf, u16 *id); |
| 1175 | extern void ata_qc_complete(struct ata_queued_cmd *qc); | 1176 | extern void ata_qc_complete(struct ata_queued_cmd *qc); |
| 1176 | extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active); | 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 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd); | 1179 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd); |
| 1178 | extern int ata_std_bios_param(struct scsi_device *sdev, | 1180 | extern int ata_std_bios_param(struct scsi_device *sdev, |
| 1179 | struct block_device *bdev, | 1181 | struct block_device *bdev, |
| @@ -1893,9 +1895,9 @@ extern const struct ata_port_operations ata_bmdma_port_ops; · 713 unmodified lines | |||
| 1893 | .sg_tablesize = LIBATA_MAX_PRD, \ | 1895 | .sg_tablesize = LIBATA_MAX_PRD, \ |
| 1894 | .dma_boundary = ATA_DMA_BOUNDARY | 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 | extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc); | 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 | extern unsigned int ata_bmdma_port_intr(struct ata_port *ap, | 1901 | extern unsigned int ata_bmdma_port_intr(struct ata_port *ap, |
| 1900 | struct ata_queued_cmd *qc); | 1902 | struct ata_queued_cmd *qc); |
| 1901 | extern irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance); | 1903 | extern irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance); |
| @@ -2,11 +2,14 @@ · 1 unmodified line | |||
| 2 | #ifndef LIBFDT_ENV_H | 2 | #ifndef LIBFDT_ENV_H |
| 3 | #define LIBFDT_ENV_H | 3 | #define LIBFDT_ENV_H |
| 4 | 4 | ||
| 5 | #include <linux/kernel.h> /* For INT_MAX */ | 5 | #include <linux/limits.h> /* For INT_MAX */ |
| 6 | #include <linux/string.h> | 6 | #include <linux/string.h> |
| 7 | 7 | ||
| 8 | #include <asm/byteorder.h> | 8 | #include <asm/byteorder.h> |
| 9 | 9 | ||
| 10 | #define INT32_MAX S32_MAX | ||
| 11 | #define UINT32_MAX U32_MAX | ||
| 12 | |||
| 10 | typedef __be16 fdt16_t; | 13 | typedef __be16 fdt16_t; |
| 11 | typedef __be32 fdt32_t; | 14 | typedef __be32 fdt32_t; |
| 12 | typedef __be64 fdt64_t; | 15 | typedef __be64 fdt64_t; |
| @@ -65,13 +65,6 @@ enum { · 64 unmodified lines | |||
| 65 | DPA_RESOURCE_ADJUSTED = 1 << 0, | 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 | struct nvdimm; | 68 | struct nvdimm; |
| 76 | struct nvdimm_bus_descriptor; | 69 | struct nvdimm_bus_descriptor; |
| 77 | typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc, | 70 | typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc, |
| @@ -1,3 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 1 | #ifndef __LICENSE_H | 2 | #ifndef __LICENSE_H |
| 2 | #define __LICENSE_H | 3 | #define __LICENSE_H |
| 3 | 4 | ||
| @@ -75,32 +75,61 @@ · 74 unmodified lines | |||
| 75 | 75 | ||
| 76 | #ifdef __ASSEMBLY__ | 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 | #ifndef LINKER_SCRIPT | 102 | #ifndef LINKER_SCRIPT |
| 79 | #define ALIGN __ALIGN | 103 | #define ALIGN __ALIGN |
| 80 | #define ALIGN_STR __ALIGN_STR | 104 | #define ALIGN_STR __ALIGN_STR |
| 81 | 105 | ||
| 106 | /* === DEPRECATED annotations === */ | ||
| 107 | |||
| 108 | #ifndef CONFIG_X86 | ||
| 82 | #ifndef GLOBAL | 109 | #ifndef GLOBAL |
| 110 | /* deprecated, use SYM_DATA*, SYM_ENTRY, or similar */ | ||
| 83 | #define GLOBAL(name) \ | 111 | #define GLOBAL(name) \ |
| 84 | .globl name ASM_NL \ | 112 | .globl name ASM_NL \ |
| 85 | name: | 113 | name: |
| 86 | #endif | 114 | #endif |
| 87 | 115 | ||
| 88 | #ifndef ENTRY | 116 | #ifndef ENTRY |
| 117 | /* deprecated, use SYM_FUNC_START */ | ||
| 89 | #define ENTRY(name) \ | 118 | #define ENTRY(name) \ |
| 90 | .globl name ASM_NL \ | 119 | SYM_FUNC_START(name) |
| 91 | ALIGN ASM_NL \ | ||
| 92 | name: | ||
| 93 | #endif | 120 | #endif |
| 121 | #endif /* CONFIG_X86 */ | ||
| 94 | #endif /* LINKER_SCRIPT */ | 122 | #endif /* LINKER_SCRIPT */ |
| 95 | 123 | ||
| 124 | #ifndef CONFIG_X86 | ||
| 96 | #ifndef WEAK | 125 | #ifndef WEAK |
| 126 | /* deprecated, use SYM_FUNC_START_WEAK* */ | ||
| 97 | #define WEAK(name) \ | 127 | #define WEAK(name) \ |
| 98 | .weak name ASM_NL \ | 128 | SYM_FUNC_START_WEAK(name) |
| 99 | ALIGN ASM_NL \ | ||
| 100 | name: | ||
| 101 | #endif | 129 | #endif |
| 102 | 130 | ||
| 103 | #ifndef END | 131 | #ifndef END |
| 132 | /* deprecated, use SYM_FUNC_END, SYM_DATA_END, or SYM_END */ | ||
| 104 | #define END(name) \ | 133 | #define END(name) \ |
| 105 | .size name, .-name | 134 | .size name, .-name |
| 106 | #endif | 135 | #endif |
| @@ -110,11 +139,215 @@ · 3 unmodified lines | |||
| 110 | * static analysis tools such as stack depth analyzer. | 139 | * static analysis tools such as stack depth analyzer. |
| 111 | */ | 140 | */ |
| 112 | #ifndef ENDPROC | 141 | #ifndef ENDPROC |
| 142 | /* deprecated, use SYM_FUNC_END */ | ||
| 113 | #define ENDPROC(name) \ | 143 | #define ENDPROC(name) \ |
| 114 | .type name, @function ASM_NL \ | 144 | SYM_FUNC_END(name) |
| 115 | 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 | #endif | 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 | #endif | 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 | #endif | 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 | return bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); | 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 | #endif /* __LINKMODE_H */ | 91 | #endif /* __LINKMODE_H */ |
| @@ -130,10 +130,23 @@ struct klp_object { · 129 unmodified lines | |||
| 130 | bool patched; | 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 | * struct klp_patch - patch structure for live patching | 146 | * struct klp_patch - patch structure for live patching |
| 135 | * @mod: reference to the live patch module | 147 | * @mod: reference to the live patch module |
| 136 | * @objs: object entries for kernel objects to be patched | 148 | * @objs: object entries for kernel objects to be patched |
| 149 | * @states: system states that can get modified | ||
| 137 | * @replace: replace all actively used patches | 150 | * @replace: replace all actively used patches |
| 138 | * @list: list node for global list of actively used patches | 151 | * @list: list node for global list of actively used patches |
| 139 | * @kobj: kobject for sysfs resources | 152 | * @kobj: kobject for sysfs resources |
| @@ -147,6 +160,7 @@ struct klp_patch { · 7 unmodified lines | |||
| 147 | /* external */ | 160 | /* external */ |
| 148 | struct module *mod; | 161 | struct module *mod; |
| 149 | struct klp_object *objs; | 162 | struct klp_object *objs; |
| 163 | struct klp_state *states; | ||
| 150 | bool replace; | 164 | bool replace; |
| 151 | 165 | ||
| 152 | /* internal */ | 166 | /* internal */ |
| @@ -217,6 +231,9 @@ void *klp_shadow_get_or_alloc(void *obj, unsigned long id, · 64 unmodified lines | |||
| 217 | void klp_shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor); | 231 | void klp_shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor); |
| 218 | void klp_shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor); | 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 | #else /* !CONFIG_LIVEPATCH */ | 237 | #else /* !CONFIG_LIVEPATCH */ |
| 221 | 238 | ||
| 222 | static inline int klp_module_coming(struct module *mod) { return 0; } | 239 | static inline int klp_module_coming(struct module *mod) { return 0; } |
| @@ -10,8 +10,6 @@ · 9 unmodified lines | |||
| 10 | #ifndef LINUX_LOCKD_DEBUG_H | 10 | #ifndef LINUX_LOCKD_DEBUG_H |
| 11 | #define LINUX_LOCKD_DEBUG_H | 11 | #define LINUX_LOCKD_DEBUG_H |
| 12 | 12 | ||
| 13 | #ifdef __KERNEL__ | ||
| 14 | |||
| 15 | #include <linux/sunrpc/debug.h> | 13 | #include <linux/sunrpc/debug.h> |
| 16 | 14 | ||
| 17 | /* | 15 | /* |
| @@ -25,8 +23,6 @@ · 7 unmodified lines | |||
| 25 | # define ifdebug(flag) if (0) | 23 | # define ifdebug(flag) if (0) |
| 26 | #endif | 24 | #endif |
| 27 | 25 | ||
| 28 | #endif /* __KERNEL__ */ | ||
| 29 | |||
| 30 | /* | 26 | /* |
| 31 | * Debug flags | 27 | * Debug flags |
| 32 | */ | 28 | */ |
| @@ -10,8 +10,6 @@ · 9 unmodified lines | |||
| 10 | #ifndef LINUX_LOCKD_LOCKD_H | 10 | #ifndef LINUX_LOCKD_LOCKD_H |
| 11 | #define LINUX_LOCKD_LOCKD_H | 11 | #define LINUX_LOCKD_LOCKD_H |
| 12 | 12 | ||
| 13 | #ifdef __KERNEL__ | ||
| 14 | |||
| 15 | #include <linux/in.h> | 13 | #include <linux/in.h> |
| 16 | #include <linux/in6.h> | 14 | #include <linux/in6.h> |
| 17 | #include <net/ipv6.h> | 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 | extern const struct lock_manager_operations nlmsvc_lock_operations; | 372 | extern const struct lock_manager_operations nlmsvc_lock_operations; |
| 375 | 373 | ||
| 376 | #endif /* __KERNEL__ */ | ||
| 377 | |||
| 378 | #endif /* LINUX_LOCKD_LOCKD_H */ | 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 | int trylock, int read, int check, | 349 | int trylock, int read, int check, |
| 350 | struct lockdep_map *nest_lock, unsigned long ip); | 350 | struct lockdep_map *nest_lock, unsigned long ip); |
| 351 | 351 | ||
| 352 | extern void lock_release(struct lockdep_map *lock, int nested, | 352 | extern void lock_release(struct lockdep_map *lock, unsigned long ip); |
| 353 | unsigned long ip); | ||
| 354 | 353 | ||
| 355 | /* | 354 | /* |
| 356 | * Same "read" as for lock_acquire(), except -1 means any. | 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 | # define lock_acquire(l, s, t, r, c, n, i) do { } while (0) | 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 | # define lock_downgrade(l, i) do { } while (0) | 431 | # define lock_downgrade(l, i) do { } while (0) |
| 433 | # define lock_set_class(l, n, k, s, i) do { } while (0) | 432 | # define lock_set_class(l, n, k, s, i) do { } while (0) |
| 434 | # define lock_set_subclass(l, s, i) do { } while (0) | 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 | #define spin_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) | 591 | #define spin_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 593 | #define spin_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) | 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 | #define rwlock_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) | 595 | #define rwlock_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 597 | #define rwlock_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i) | 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 | #define seqcount_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) | 599 | #define seqcount_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 601 | #define seqcount_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i) | 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 | #define mutex_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) | 603 | #define mutex_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 605 | #define mutex_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) | 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 | #define rwsem_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) | 607 | #define rwsem_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i) |
| 609 | #define rwsem_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) | 608 | #define rwsem_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i) |
| 610 | #define rwsem_acquire_read(l, s, t, i) lock_acquire_shared(l, s, t, NULL, i) | 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 | #define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_) | 612 | #define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_) |
| 614 | #define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_) | 613 | #define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_) |
| 615 | #define lock_map_acquire_tryread(l) lock_acquire_shared_recursive(l, 0, 1, NULL, _THIS_IP_) | 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 | #ifdef CONFIG_PROVE_LOCKING | 617 | #ifdef CONFIG_PROVE_LOCKING |
| 619 | # define might_lock(lock) \ | 618 | # define might_lock(lock) \ |
| 620 | do { \ | 619 | do { \ |
| 621 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ | 620 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ |
| 622 | lock_acquire(&(lock)->dep_map, 0, 0, 0, 1, NULL, _THIS_IP_); \ | 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 | } while (0) | 623 | } while (0) |
| 625 | # define might_lock_read(lock) \ | 624 | # define might_lock_read(lock) \ |
| 626 | do { \ | 625 | do { \ |
| 627 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ | 626 | typecheck(struct lockdep_map *, &(lock)->dep_map); \ |
| 628 | lock_acquire(&(lock)->dep_map, 0, 0, 1, 1, NULL, _THIS_IP_); \ | 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 | } while (0) | 629 | } while (0) |
| 631 | 630 | ||
| 632 | #define lockdep_assert_irqs_enabled() do { \ | 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 | * area by redefining the macro below. | 108 | * area by redefining the macro below. |
| 109 | */ | 109 | */ |
| 110 | #define PIO_INDIRECT_SIZE 0x4000 | 110 | #define PIO_INDIRECT_SIZE 0x4000 |
| 111 | #define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE) | ||
| 112 | #else | 111 | #else |
| 113 | #define MMIO_UPPER_LIMIT IO_SPACE_LIMIT | 112 | #define PIO_INDIRECT_SIZE 0 |
| 114 | #endif /* CONFIG_INDIRECT_PIO */ | 113 | #endif /* CONFIG_INDIRECT_PIO */ |
| 114 | #define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE) | ||
| 115 | 115 | ||
| 116 | struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode); | 116 | struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode); |
| 117 | unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, | 117 | unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, |
| @@ -1818,6 +1818,14 @@ union security_list_options { · 1817 unmodified lines | |||
| 1818 | void (*bpf_prog_free_security)(struct bpf_prog_aux *aux); | 1818 | void (*bpf_prog_free_security)(struct bpf_prog_aux *aux); |
| 1819 | #endif /* CONFIG_BPF_SYSCALL */ | 1819 | #endif /* CONFIG_BPF_SYSCALL */ |
| 1820 | int (*locked_down)(enum lockdown_reason what); | 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 | struct security_hook_heads { | 1831 | struct security_hook_heads { |
| @@ -2060,6 +2068,13 @@ struct security_hook_heads { · 236 unmodified lines | |||
| 2060 | struct hlist_head bpf_prog_free_security; | 2068 | struct hlist_head bpf_prog_free_security; |
| 2061 | #endif /* CONFIG_BPF_SYSCALL */ | 2069 | #endif /* CONFIG_BPF_SYSCALL */ |
| 2062 | struct hlist_head locked_down; | 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 | } __randomize_layout; | 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 | MEMBLOCK_ALLOC_ACCESSIBLE); | 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 | void *memblock_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align, | 364 | void *memblock_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align, |
| 362 | phys_addr_t min_addr, phys_addr_t max_addr, | 365 | phys_addr_t min_addr, phys_addr_t max_addr, |
| 363 | int nid); | 366 | int nid); |
| @@ -58,7 +58,6 @@ enum mem_cgroup_protection { · 57 unmodified lines | |||
| 58 | 58 | ||
| 59 | struct mem_cgroup_reclaim_cookie { | 59 | struct mem_cgroup_reclaim_cookie { |
| 60 | pg_data_t *pgdat; | 60 | pg_data_t *pgdat; |
| 61 | int priority; | ||
| 62 | unsigned int generation; | 61 | unsigned int generation; |
| 63 | }; | 62 | }; |
| 64 | 63 | ||
| @@ -81,7 +80,6 @@ struct mem_cgroup_id { · 16 unmodified lines | |||
| 81 | enum mem_cgroup_events_target { | 80 | enum mem_cgroup_events_target { |
| 82 | MEM_CGROUP_TARGET_THRESH, | 81 | MEM_CGROUP_TARGET_THRESH, |
| 83 | MEM_CGROUP_TARGET_SOFTLIMIT, | 82 | MEM_CGROUP_TARGET_SOFTLIMIT, |
| 84 | MEM_CGROUP_TARGET_NUMAINFO, | ||
| 85 | MEM_CGROUP_NTARGETS, | 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 | struct mem_cgroup_per_node { | 115 | struct mem_cgroup_per_node { |
| 118 | struct lruvec lruvec; | 116 | struct lruvec lruvec; |
| @@ -126,7 +124,7 @@ struct mem_cgroup_per_node { · 7 unmodified lines | |||
| 126 | 124 | ||
| 127 | unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; | 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 | struct memcg_shrinker_map __rcu *shrinker_map; | 129 | struct memcg_shrinker_map __rcu *shrinker_map; |
| 132 | 130 | ||
| @@ -134,9 +132,6 @@ struct mem_cgroup_per_node { · 1 unmodified line | |||
| 134 | unsigned long usage_in_excess;/* Set to the value by which */ | 132 | unsigned long usage_in_excess;/* Set to the value by which */ |
| 135 | /* the soft limit is exceeded*/ | 133 | /* the soft limit is exceeded*/ |
| 136 | bool on_tree; | 134 | bool on_tree; |
| 137 | bool congested; /* memcg has many dirty pages */ | ||
| 138 | /* backed by a congested BDI */ | ||
| 139 | |||
| 140 | struct mem_cgroup *memcg; /* Back pointer, we cannot */ | 135 | struct mem_cgroup *memcg; /* Back pointer, we cannot */ |
| 141 | /* use container_of */ | 136 | /* use container_of */ |
| 142 | }; | 137 | }; |
| @@ -313,13 +308,6 @@ struct mem_cgroup { · 170 unmodified lines | |||
| 313 | struct list_head kmem_caches; | 308 | struct list_head kmem_caches; |
| 314 | #endif | 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 | #ifdef CONFIG_CGROUP_WRITEBACK | 311 | #ifdef CONFIG_CGROUP_WRITEBACK |
| 324 | struct list_head cgwb_list; | 312 | struct list_head cgwb_list; |
| 325 | struct wb_domain cgwb_domain; | 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 | 385 | * mem_cgroup_lruvec - get the lru list vector for a memcg & node |
| 398 | * @node: node of the wanted lruvec | ||
| 399 | * @memcg: memcg of the wanted lruvec | 386 | * @memcg: memcg of the wanted lruvec |
| 400 | * | 387 | * |
| 401 | * Returns the lru list vector holding pages for a given @node or a given | 388 | * Returns the lru list vector holding pages for a given @memcg & |
| 402 | * @memcg and @zone. This can be the node lruvec, if the memory controller | 389 | * @node combination. This can be the node lruvec, if the memory |
| 403 | * is disabled. | 390 | * controller is disabled. |
| 404 | */ | 391 | */ |
| 405 | static inline struct lruvec *mem_cgroup_lruvec(struct pglist_data *pgdat, | 392 | static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, |
| 406 | struct mem_cgroup *memcg) | 393 | struct pglist_data *pgdat) |
| 407 | { | 394 | { |
| 408 | struct mem_cgroup_per_node *mz; | 395 | struct mem_cgroup_per_node *mz; |
| 409 | struct lruvec *lruvec; | 396 | struct lruvec *lruvec; |
| 410 | 397 | ||
| 411 | if (mem_cgroup_disabled()) { | 398 | if (mem_cgroup_disabled()) { |
| 412 | lruvec = node_lruvec(pgdat); | 399 | lruvec = &pgdat->__lruvec; |
| 413 | goto out; | 400 | goto out; |
| 414 | } | 401 | } |
| 415 | 402 | ||
| 403 | if (!memcg) | ||
| 404 | memcg = root_mem_cgroup; | ||
| 405 | |||
| 416 | mz = mem_cgroup_nodeinfo(memcg, pgdat->node_id); | 406 | mz = mem_cgroup_nodeinfo(memcg, pgdat->node_id); |
| 417 | lruvec = &mz->lruvec; | 407 | lruvec = &mz->lruvec; |
| 418 | out: | 408 | out: |
| @@ -728,7 +718,7 @@ static inline void __mod_lruvec_page_state(struct page *page, · 309 unmodified lines | |||
| 728 | return; | 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 | __mod_lruvec_state(lruvec, idx, val); | 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, | 892 | static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, |
| 903 | 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 | static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page, | 898 | static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page, |
| 909 | struct pglist_data *pgdat) | 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 | static inline bool mm_match_cgroup(struct mm_struct *mm, | 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 | typedef void (*online_page_callback_t)(struct page *page, unsigned int order); | 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 | extern int set_online_page_callback(online_page_callback_t callback); | 106 | extern int set_online_page_callback(online_page_callback_t callback); |
| 106 | extern int restore_online_page_callback(online_page_callback_t callback); | 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 | extern int try_online_node(int nid); | 109 | extern int try_online_node(int nid); |
| 113 | 110 | ||
| 114 | extern int arch_add_memory(int nid, u64 start, u64 size, | 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 | void mem_hotplug_begin(void); | 226 | void mem_hotplug_begin(void); |
| 230 | void mem_hotplug_done(void); | 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 | #else /* ! CONFIG_MEMORY_HOTPLUG */ | 229 | #else /* ! CONFIG_MEMORY_HOTPLUG */ |
| 236 | #define pfn_to_online_page(pfn) \ | 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 | static inline void __remove_memory(int nid, u64 start, u64 size) {} | 333 | static inline void __remove_memory(int nid, u64 start, u64 size) {} |
| 340 | #endif /* CONFIG_MEMORY_HOTREMOVE */ | 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 | extern void __ref free_area_init_core_hotplug(int nid); | 339 | extern void __ref free_area_init_core_hotplug(int nid); |
| 343 | extern int __add_memory(int nid, u64 start, u64 size); | 340 | extern int __add_memory(int nid, u64 start, u64 size); |
| 344 | extern int add_memory(int nid, u64 start, u64 size); | 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 | #define ARIZONA_DSP4_SCRATCH_1 0x1441 | 1186 | #define ARIZONA_DSP4_SCRATCH_1 0x1441 |
| 1187 | #define ARIZONA_DSP4_SCRATCH_2 0x1442 | 1187 | #define ARIZONA_DSP4_SCRATCH_2 0x1442 |
| 1188 | #define ARIZONA_DSP4_SCRATCH_3 0x1443 | 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 | * Field Definitions. | 1191 | * Field Definitions. |
| @@ -12,6 +12,35 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | #include <linux/platform_device.h> | 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 | struct irq_domain; | 44 | struct irq_domain; |
| 16 | struct property_entry; | 45 | struct property_entry; |
| 17 | 46 | ||
| @@ -30,8 +59,6 @@ struct mfd_cell { · 12 unmodified lines | |||
| 30 | const char *name; | 59 | const char *name; |
| 31 | int id; | 60 | int id; |
| 32 | 61 | ||
| 33 | /* refcounting for multiple drivers to use a single cell */ | ||
| 34 | atomic_t *usage_count; | ||
| 35 | int (*enable)(struct platform_device *dev); | 62 | int (*enable)(struct platform_device *dev); |
| 36 | int (*disable)(struct platform_device *dev); | 63 | int (*disable)(struct platform_device *dev); |
| 37 | 64 | ||
| @@ -86,24 +113,6 @@ struct mfd_cell { · 48 unmodified lines | |||
| 86 | extern int mfd_cell_enable(struct platform_device *pdev); | 113 | extern int mfd_cell_enable(struct platform_device *pdev); |
| 87 | extern int mfd_cell_disable(struct platform_device *pdev); | 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 | * Given a platform device that's been created by mfd_add_devices(), fetch | 117 | * Given a platform device that's been created by mfd_add_devices(), fetch |
| 109 | * the mfd_cell that created it. | 118 | * the mfd_cell that created it. |
| @@ -489,7 +489,7 @@ struct prcmu_auto_pm_config { · 488 unmodified lines | |||
| 489 | 489 | ||
| 490 | #ifdef CONFIG_MFD_DB8500_PRCMU | 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 | int prcmu_set_rc_a2p(enum romcode_write); | 493 | int prcmu_set_rc_a2p(enum romcode_write); |
| 494 | enum romcode_read prcmu_get_rc_p2a(void); | 494 | enum romcode_read prcmu_get_rc_p2a(void); |
| 495 | enum ap_pwrst prcmu_get_xp70_current_state(void); | 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 | #else /* !CONFIG_MFD_DB8500_PRCMU */ | 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 | static inline int prcmu_set_rc_a2p(enum romcode_write code) | 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 | #define PRCMU_FW_PROJECT_U8500_MBL2 12 /* Customer specific */ | 190 | #define PRCMU_FW_PROJECT_U8500_MBL2 12 /* Customer specific */ |
| 191 | #define PRCMU_FW_PROJECT_U8520 13 | 191 | #define PRCMU_FW_PROJECT_U8520 13 |
| 192 | #define PRCMU_FW_PROJECT_U8420 14 | 192 | #define PRCMU_FW_PROJECT_U8420 14 |
| 193 | #define PRCMU_FW_PROJECT_U8420_SYSCLK 17 | ||
| 193 | #define PRCMU_FW_PROJECT_A9420 20 | 194 | #define PRCMU_FW_PROJECT_A9420 20 |
| 194 | /* [32..63] 9540 and derivatives */ | 195 | /* [32..63] 9540 and derivatives */ |
| 195 | #define PRCMU_FW_PROJECT_U9540 32 | 196 | #define PRCMU_FW_PROJECT_U9540 32 |
| @@ -211,9 +212,9 @@ struct prcmu_fw_version { · 15 unmodified lines | |||
| 211 | 212 | ||
| 212 | #if defined(CONFIG_UX500_SOC_DB8500) | 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 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, | 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 | #else | 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 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, | 407 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
| 407 | bool keep_ap_pll) | 408 | bool keep_ap_pll) |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | |||
| 8 | #ifndef MADERA_CORE_H | 8 | #ifndef MADERA_CORE_H |
| 9 | #define MADERA_CORE_H | 9 | #define MADERA_CORE_H |
| 10 | 10 | ||
| 11 | #include <linux/clk.h> | ||
| 11 | #include <linux/gpio/consumer.h> | 12 | #include <linux/gpio/consumer.h> |
| 12 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
| 13 | #include <linux/mfd/madera/pdata.h> | 14 | #include <linux/mfd/madera/pdata.h> |
| @@ -29,6 +30,13 @@ enum madera_type { · 15 unmodified lines | |||
| 29 | CS42L92 = 9, | 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 | #define MADERA_MAX_CORE_SUPPLIES 2 | 40 | #define MADERA_MAX_CORE_SUPPLIES 2 |
| 33 | #define MADERA_MAX_GPIOS 40 | 41 | #define MADERA_MAX_GPIOS 40 |
| 34 | 42 | ||
| @@ -155,6 +163,7 @@ struct snd_soc_dapm_context; · 120 unmodified lines | |||
| 155 | * @irq_dev: the irqchip child driver device | 163 | * @irq_dev: the irqchip child driver device |
| 156 | * @irq_data: pointer to irqchip data for the child irqchip driver | 164 | * @irq_data: pointer to irqchip data for the child irqchip driver |
| 157 | * @irq: host irq number from SPI or I2C configuration | 165 | * @irq: host irq number from SPI or I2C configuration |
| 166 | * @mclk: Structure holding clock supplies | ||
| 158 | * @out_clamp: indicates output clamp state for each analogue output | 167 | * @out_clamp: indicates output clamp state for each analogue output |
| 159 | * @out_shorted: indicates short circuit state for each analogue output | 168 | * @out_shorted: indicates short circuit state for each analogue output |
| 160 | * @hp_ena: bitflags of enable state for the headphone outputs | 169 | * @hp_ena: bitflags of enable state for the headphone outputs |
| @@ -184,6 +193,8 @@ struct madera { · 23 unmodified lines | |||
| 184 | struct regmap_irq_chip_data *irq_data; | 193 | struct regmap_irq_chip_data *irq_data; |
| 185 | int irq; | 194 | int irq; |
| 186 | 195 | ||
| 196 | struct clk_bulk_data mclk[MADERA_NUM_MCLK]; | ||
| 197 | |||
| 187 | unsigned int num_micbias; | 198 | unsigned int num_micbias; |
| 188 | unsigned int num_childbias[MADERA_MAX_MICBIAS]; | 199 | unsigned int num_childbias[MADERA_MAX_MICBIAS]; |
| 189 | 200 | ||
| @@ -329,7 +329,6 @@ struct max77620_chip { · 328 unmodified lines | |||
| 329 | struct regmap *rmap; | 329 | struct regmap *rmap; |
| 330 | 330 | ||
| 331 | int chip_irq; | 331 | int chip_irq; |
| 332 | int irq_base; | ||
| 333 | 332 | ||
| 334 | /* chip id */ | 333 | /* chip id */ |
| 335 | enum max77620_chip_id chip_id; | 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 | RK808_ID = 0x0000, | 610 | RK808_ID = 0x0000, |
| 611 | RK809_ID = 0x8090, | 611 | RK809_ID = 0x8090, |
| 612 | RK817_ID = 0x8170, | 612 | RK817_ID = 0x8170, |
| 613 | RK818_ID = 0x8181, | 613 | RK818_ID = 0x8180, |
| 614 | }; | 614 | }; |
| 615 | 615 | ||
| 616 | struct rk808 { | 616 | struct rk808 { |
| @@ -70,14 +70,11 @@ · 69 unmodified lines | |||
| 70 | #define TIM_CCER_CC4E BIT(12) /* Capt/Comp 4 out Ena */ | 70 | #define TIM_CCER_CC4E BIT(12) /* Capt/Comp 4 out Ena */ |
| 71 | #define TIM_CCER_CC4P BIT(13) /* Capt/Comp 4 Polarity */ | 71 | #define TIM_CCER_CC4P BIT(13) /* Capt/Comp 4 Polarity */ |
| 72 | #define TIM_CCER_CCXE (BIT(0) | BIT(4) | BIT(8) | BIT(12)) | 72 | #define TIM_CCER_CCXE (BIT(0) | BIT(4) | BIT(8) | BIT(12)) |
| 73 | #define TIM_BDTR_BKE BIT(12) /* Break input enable */ | 73 | #define TIM_BDTR_BKE(x) BIT(12 + (x) * 12) /* Break input enable */ |
| 74 | #define TIM_BDTR_BKP BIT(13) /* Break input polarity */ | 74 | #define TIM_BDTR_BKP(x) BIT(13 + (x) * 12) /* Break input polarity */ |
| 75 | #define TIM_BDTR_AOE BIT(14) /* Automatic Output Enable */ | 75 | #define TIM_BDTR_AOE BIT(14) /* Automatic Output Enable */ |
| 76 | #define TIM_BDTR_MOE BIT(15) /* Main Output Enable */ | 76 | #define TIM_BDTR_MOE BIT(15) /* Main Output Enable */ |
| 77 | #define TIM_BDTR_BKF (BIT(16) | BIT(17) | BIT(18) | BIT(19)) | 77 | #define TIM_BDTR_BKF(x) (0xf << (16 + (x) * 4)) |
| 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 */ | ||
| 81 | #define TIM_DCR_DBA GENMASK(4, 0) /* DMA base addr */ | 78 | #define TIM_DCR_DBA GENMASK(4, 0) /* DMA base addr */ |
| 82 | #define TIM_DCR_DBL GENMASK(12, 8) /* DMA burst len */ | 79 | #define TIM_DCR_DBL GENMASK(12, 8) /* DMA burst len */ |
| 83 | 80 | ||
| @@ -87,8 +84,7 @@ · 3 unmodified lines | |||
| 87 | #define TIM_CR2_MMS2_SHIFT 20 | 84 | #define TIM_CR2_MMS2_SHIFT 20 |
| 88 | #define TIM_SMCR_TS_SHIFT 4 | 85 | #define TIM_SMCR_TS_SHIFT 4 |
| 89 | #define TIM_BDTR_BKF_MASK 0xF | 86 | #define TIM_BDTR_BKF_MASK 0xF |
| 90 | #define TIM_BDTR_BKF_SHIFT 16 | 87 | #define TIM_BDTR_BKF_SHIFT(x) (16 + (x) * 4) |
| 91 | #define TIM_BDTR_BK2F_SHIFT 20 | ||
| 92 | 88 | ||
| 93 | enum stm32_timers_dmas { | 89 | enum stm32_timers_dmas { |
| 94 | STM32_TIMERS_DMA_CH1, | 90 | STM32_TIMERS_DMA_CH1, |
| @@ -106,7 +106,6 @@ · 105 unmodified lines | |||
| 106 | #define AT91_MATRIX_DDR_IOSR BIT(18) | 106 | #define AT91_MATRIX_DDR_IOSR BIT(18) |
| 107 | #define AT91_MATRIX_NFD0_SELECT BIT(24) | 107 | #define AT91_MATRIX_NFD0_SELECT BIT(24) |
| 108 | #define AT91_MATRIX_DDR_MP_EN BIT(25) | 108 | #define AT91_MATRIX_DDR_MP_EN BIT(25) |
| 109 | #define AT91_MATRIX_EBI_NUM_CS 8 | ||
| 110 | 109 | ||
| 111 | #define AT91_MATRIX_USBPUCR_PUON BIT(30) | 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 | static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) { | 183 | static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) { |
| 184 | val = cpu_to_le16(val); | 184 | __le16 value; |
| 185 | return twl_i2c_write(mod_no, (u8*) &val, reg, 2); | 185 | |
| 186 | value = cpu_to_le16(val); | ||
| 187 | return twl_i2c_write(mod_no, (u8 *) &value, reg, 2); | ||
| 186 | } | 188 | } |
| 187 | 189 | ||
| 188 | static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) { | 190 | static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) { |
| 189 | int ret; | 191 | int ret; |
| 190 | ret = twl_i2c_read(mod_no, (u8*) val, reg, 2); | 192 | __le16 value; |
| 191 | *val = le16_to_cpu(*val); | 193 | |
| 194 | ret = twl_i2c_read(mod_no, (u8 *) &value, reg, 2); | ||
| 195 | *val = le16_to_cpu(value); | ||
| 192 | return ret; | 196 | return ret; |
| 193 | } | 197 | } |
| 194 | 198 | ||
| @@ -33,6 +33,7 @@ · 32 unmodified lines | |||
| 33 | #define SGI_MMTIMER 153 | 33 | #define SGI_MMTIMER 153 |
| 34 | #define STORE_QUEUE_MINOR 155 /* unused */ | 34 | #define STORE_QUEUE_MINOR 155 /* unused */ |
| 35 | #define I2O_MINOR 166 | 35 | #define I2O_MINOR 166 |
| 36 | #define AGPGART_MINOR 175 | ||
| 36 | #define HWRNG_MINOR 183 | 37 | #define HWRNG_MINOR 183 |
| 37 | #define MICROCODE_MINOR 184 | 38 | #define MICROCODE_MINOR 184 |
| 38 | #define IRNET_MINOR 187 | 39 | #define IRNET_MINOR 187 |
| @@ -57,6 +58,7 @@ · 18 unmodified lines | |||
| 57 | #define UHID_MINOR 239 | 58 | #define UHID_MINOR 239 |
| 58 | #define USERIO_MINOR 240 | 59 | #define USERIO_MINOR 240 |
| 59 | #define VHOST_VSOCK_MINOR 241 | 60 | #define VHOST_VSOCK_MINOR 241 |
| 61 | #define RFKILL_MINOR 242 | ||
| 60 | #define MISC_DYNAMIC_MINOR 255 | 62 | #define MISC_DYNAMIC_MINOR 255 |
| 61 | 63 | ||
| 62 | struct device; | 64 | struct device; |
| @@ -556,8 +556,6 @@ struct mlx5_priv { · 555 unmodified lines | |||
| 556 | struct dentry *cmdif_debugfs; | 556 | struct dentry *cmdif_debugfs; |
| 557 | /* end: qp staff */ | 557 | /* end: qp staff */ |
| 558 | 558 | ||
| 559 | struct xarray mkey_table; | ||
| 560 | |||
| 561 | /* start: alloc staff */ | 559 | /* start: alloc staff */ |
| 562 | /* protect buffer alocation according to numa node */ | 560 | /* protect buffer alocation according to numa node */ |
| 563 | struct mutex alloc_mutex; | 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 | gfp_t flags, int npages); | 940 | gfp_t flags, int npages); |
| 943 | void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev, | 941 | void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev, |
| 944 | struct mlx5_cmd_mailbox *head); | 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 | int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, | 943 | int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, |
| 948 | struct mlx5_core_mkey *mkey, | 944 | struct mlx5_core_mkey *mkey, |
| 949 | struct mlx5_async_ctx *async_ctx, u32 *in, | 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 | return dev->coredev_type == MLX5_COREDEV_PF; | 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 | static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) | 1125 | static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) |
| 1125 | { | 1126 | { |
| 1126 | return dev->caps.embedded_cpu; | 1127 | return dev->caps.embedded_cpu; |
| @@ -1186,4 +1187,15 @@ enum { · 59 unmodified lines | |||
| 1186 | MLX5_TRIGGERED_CMD_COMP = (u64)1 << 32, | 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 | #endif /* MLX5_DRIVER_H */ | 1201 | #endif /* MLX5_DRIVER_H */ |
| @@ -80,7 +80,8 @@ enum mlx5_flow_namespace_type { · 79 unmodified lines | |||
| 80 | 80 | ||
| 81 | enum { | 81 | enum { |
| 82 | FDB_BYPASS_PATH, | 82 | FDB_BYPASS_PATH, |
| 83 | FDB_FAST_PATH, | 83 | FDB_TC_OFFLOAD, |
| 84 | FDB_FT_OFFLOAD, | ||
| 84 | FDB_SLOW_PATH, | 85 | FDB_SLOW_PATH, |
| 85 | }; | 86 | }; |
| 86 | 87 | ||
| @@ -1110,6 +1110,7 @@ enum { · 1109 unmodified lines | |||
| 1110 | }; | 1110 | }; |
| 1111 | 1111 | ||
| 1112 | enum { | 1112 | enum { |
| 1113 | MLX5_FLEX_PARSER_GENEVE_ENABLED = 1 << 3, | ||
| 1113 | MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED = 1 << 7, | 1114 | MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED = 1 << 7, |
| 1114 | MLX5_FLEX_PARSER_ICMP_V4_ENABLED = 1 << 8, | 1115 | MLX5_FLEX_PARSER_ICMP_V4_ENABLED = 1 << 8, |
| 1115 | MLX5_FLEX_PARSER_ICMP_V6_ENABLED = 1 << 9, | 1116 | MLX5_FLEX_PARSER_ICMP_V6_ENABLED = 1 << 9, |
| @@ -1153,7 +1154,7 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 37 unmodified lines | |||
| 1153 | u8 log_max_srq[0x5]; | 1154 | u8 log_max_srq[0x5]; |
| 1154 | u8 reserved_at_b0[0x10]; | 1155 | u8 reserved_at_b0[0x10]; |
| 1155 | 1156 | ||
| 1156 | u8 reserved_at_c0[0x8]; | 1157 | u8 max_sgl_for_optimized_performance[0x8]; |
| 1157 | u8 log_max_cq_sz[0x8]; | 1158 | u8 log_max_cq_sz[0x8]; |
| 1158 | u8 reserved_at_d0[0xb]; | 1159 | u8 reserved_at_d0[0xb]; |
| 1159 | u8 log_max_cq[0x5]; | 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 | struct mmu_gather; | 564 | struct mmu_gather; |
| 565 | struct inode; | 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 | * FIXME: take this include out, include page-flags.h in | 568 | * FIXME: take this include out, include page-flags.h in |
| 584 | * files which need it (119 of them) | 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 | return (unsigned long)val; | 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 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) | 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 | static inline void inc_mm_counter(struct mm_struct *mm, int member) | 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 | static inline void dec_mm_counter(struct mm_struct *mm, int member) | 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 | /* Optimized variant when page is already known not to be PageAnon */ | 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 | int __pte_alloc(struct mm_struct *mm, pmd_t *pmd); | 1838 | int __pte_alloc(struct mm_struct *mm, pmd_t *pmd); |
| 1846 | int __pte_alloc_kernel(pmd_t *pmd); | 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. | 1844 | * The following ifdef needed to get the 5level-fixup.h header to work. |
| 1850 | * Remove it when 4level-fixup.h has been removed. | 1845 | * Remove it when 5level-fixup.h has been removed. |
| 1851 | */ | 1846 | */ |
| 1852 | #if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK) | ||
| 1853 | |||
| 1854 | #ifndef __ARCH_HAS_5LEVEL_HACK | 1847 | #ifndef __ARCH_HAS_5LEVEL_HACK |
| 1855 | static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd, | 1848 | static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd, |
| 1856 | unsigned long address) | 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 | return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))? | 1865 | return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))? |
| 1873 | NULL: pmd_offset(pud, address); | 1866 | NULL: pmd_offset(pud, address); |
| 1874 | } | 1867 | } |
| 1875 | #endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ | 1868 | #endif /* CONFIG_MMU */ |
| 1876 | 1869 | ||
| 1877 | #if USE_SPLIT_PTE_PTLOCKS | 1870 | #if USE_SPLIT_PTE_PTLOCKS |
| 1878 | #if ALLOC_SPLIT_PTLOCKS | 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 | extern void setup_per_cpu_pageset(void); | 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 | /* page_alloc.c */ | 2210 | /* page_alloc.c */ |
| 2221 | extern int min_free_kbytes; | 2211 | extern int min_free_kbytes; |
| 2222 | extern int watermark_boost_factor; | 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 | typedef int (*pte_fn_t)(pte_t *pte, unsigned long addr, void *data); | 2621 | typedef int (*pte_fn_t)(pte_t *pte, unsigned long addr, void *data); |
| 2632 | extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, | 2622 | extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, |
| 2633 | unsigned long size, pte_fn_t fn, void *data); | 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 | #ifdef CONFIG_PAGE_POISONING | 2628 | #ifdef CONFIG_PAGE_POISONING |
| 2637 | extern bool page_poisoning_enabled(void); | 2629 | extern bool page_poisoning_enabled(void); |
| @@ -2781,7 +2773,7 @@ extern int sysctl_memory_failure_early_kill; · 143 unmodified lines | |||
| 2781 | extern int sysctl_memory_failure_recovery; | 2773 | extern int sysctl_memory_failure_recovery; |
| 2782 | extern void shake_page(struct page *p, int access); | 2774 | extern void shake_page(struct page *p, int access); |
| 2783 | extern atomic_long_t num_poisoned_pages __read_mostly; | 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 | return !memcmp_pages(page1, page2); | 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 | #endif /* __KERNEL__ */ | 2880 | #endif /* __KERNEL__ */ |
| 2877 | #endif /* _LINUX_MM_H */ | 2881 | #endif /* _LINUX_MM_H */ |
| @@ -226,7 +226,7 @@ struct mmc_queue_req; · 225 unmodified lines | |||
| 226 | * MMC Physical partitions | 226 | * MMC Physical partitions |
| 227 | */ | 227 | */ |
| 228 | struct mmc_part { | 228 | struct mmc_part { |
| 229 | unsigned int size; /* partition size (in bytes) */ | 229 | u64 size; /* partition size (in bytes) */ |
| 230 | unsigned int part_cfg; /* partition type */ | 230 | unsigned int part_cfg; /* partition type */ |
| 231 | char name[MAX_MMC_PART_NAME_LEN]; | 231 | char name[MAX_MMC_PART_NAME_LEN]; |
| 232 | bool force_ro; /* to make boot parts RO by default */ | 232 | bool force_ro; /* to make boot parts RO by default */ |
| @@ -291,6 +291,7 @@ struct mmc_card { · 58 unmodified lines | |||
| 291 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ | 291 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ |
| 292 | 292 | ||
| 293 | unsigned int sdio_funcs; /* number of SDIO functions */ | 293 | unsigned int sdio_funcs; /* number of SDIO functions */ |
| 294 | atomic_t sdio_funcs_probed; /* number of probed SDIO funcs */ | ||
| 294 | struct sdio_cccr cccr; /* common card info */ | 295 | struct sdio_cccr cccr; /* common card info */ |
| 295 | struct sdio_cis cis; /* common tuple info */ | 296 | struct sdio_cis cis; /* common tuple info */ |
| 296 | struct sdio_func *sdio_func[SDIO_MAX_FUNCS]; /* SDIO functions (devices) */ | 297 | struct sdio_func *sdio_func[SDIO_MAX_FUNCS]; /* SDIO functions (devices) */ |
| @@ -71,6 +71,8 @@ · 70 unmodified lines | |||
| 71 | 71 | ||
| 72 | #define SDIO_VENDOR_ID_TI 0x0097 | 72 | #define SDIO_VENDOR_ID_TI 0x0097 |
| 73 | #define SDIO_DEVICE_ID_TI_WL1271 0x4076 | 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 | #define SDIO_VENDOR_ID_STE 0x0020 | 77 | #define SDIO_VENDOR_ID_STE 0x0020 |
| 76 | #define SDIO_DEVICE_ID_STE_CW1200 0x2280 | 78 | #define SDIO_DEVICE_ID_STE_CW1200 0x2280 |
| @@ -6,9 +6,12 @@ · 5 unmodified lines | |||
| 6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
| 7 | #include <linux/mm_types.h> | 7 | #include <linux/mm_types.h> |
| 8 | #include <linux/srcu.h> | 8 | #include <linux/srcu.h> |
| 9 | #include <linux/interval_tree.h> | ||
| 9 | 10 | ||
| 11 | struct mmu_notifier_mm; | ||
| 10 | struct mmu_notifier; | 12 | struct mmu_notifier; |
| 11 | struct mmu_notifier_ops; | 13 | struct mmu_notifier_range; |
| 14 | struct mmu_interval_notifier; | ||
| 12 | 15 | ||
| 13 | /** | 16 | /** |
| 14 | * enum mmu_notifier_event - reason for the mmu notifier callback | 17 | * enum mmu_notifier_event - reason for the mmu notifier callback |
| @@ -31,6 +34,9 @@ struct mmu_notifier_ops; · 16 unmodified lines | |||
| 31 | * access flags). User should soft dirty the page in the end callback to make | 34 | * access flags). User should soft dirty the page in the end callback to make |
| 32 | * sure that anyone relying on soft dirtyness catch pages that might be written | 35 | * sure that anyone relying on soft dirtyness catch pages that might be written |
| 33 | * through non CPU mappings. | 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 | enum mmu_notifier_event { | 41 | enum mmu_notifier_event { |
| 36 | MMU_NOTIFY_UNMAP = 0, | 42 | MMU_NOTIFY_UNMAP = 0, |
| @@ -38,38 +44,11 @@ enum mmu_notifier_event { · 1 unmodified line | |||
| 38 | MMU_NOTIFY_PROTECTION_VMA, | 44 | MMU_NOTIFY_PROTECTION_VMA, |
| 39 | MMU_NOTIFY_PROTECTION_PAGE, | 45 | MMU_NOTIFY_PROTECTION_PAGE, |
| 40 | MMU_NOTIFY_SOFT_DIRTY, | 46 | MMU_NOTIFY_SOFT_DIRTY, |
| 41 | }; | 47 | MMU_NOTIFY_RELEASE, |
| 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; | ||
| 60 | }; | 48 | }; |
| 61 | 49 | ||
| 62 | #define MMU_NOTIFIER_RANGE_BLOCKABLE (1 << 0) | 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 | struct mmu_notifier_ops { | 52 | struct mmu_notifier_ops { |
| 74 | /* | 53 | /* |
| 75 | * Called either by mmu_notifier_unregister or when the mm is | 54 | * Called either by mmu_notifier_unregister or when the mm is |
| @@ -249,6 +228,41 @@ struct mmu_notifier { · 173 unmodified lines | |||
| 249 | unsigned int users; | 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 | static inline int mm_has_notifiers(struct mm_struct *mm) | 266 | static inline int mm_has_notifiers(struct mm_struct *mm) |
| 253 | { | 267 | { |
| 254 | return unlikely(mm->mmu_notifier_mm); | 268 | return unlikely(mm->mmu_notifier_mm); |
| @@ -275,6 +289,81 @@ extern int __mmu_notifier_register(struct mmu_notifier *mn, · 20 unmodified lines | |||
| 275 | struct mm_struct *mm); | 289 | struct mm_struct *mm); |
| 276 | extern void mmu_notifier_unregister(struct mmu_notifier *mn, | 290 | extern void mmu_notifier_unregister(struct mmu_notifier *mn, |
| 277 | struct mm_struct *mm); | 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 | extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); | 367 | extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); |
| 279 | extern void __mmu_notifier_release(struct mm_struct *mm); | 368 | extern void __mmu_notifier_release(struct mm_struct *mm); |
| 280 | extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, | 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 | #define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++) | 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 | return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE); | 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 | return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); | 283 | return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); |
| 284 | } | 284 | } |
| @@ -296,6 +296,12 @@ struct zone_reclaim_stat { · 11 unmodified lines | |||
| 296 | unsigned long recent_scanned[2]; | 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 | struct lruvec { | 305 | struct lruvec { |
| 300 | struct list_head lists[NR_LRU_LISTS]; | 306 | struct list_head lists[NR_LRU_LISTS]; |
| 301 | struct zone_reclaim_stat reclaim_stat; | 307 | struct zone_reclaim_stat reclaim_stat; |
| @@ -303,12 +309,14 @@ struct lruvec { · 1 unmodified line | |||
| 303 | atomic_long_t inactive_age; | 309 | atomic_long_t inactive_age; |
| 304 | /* Refaults at the time of last reclaim cycle */ | 310 | /* Refaults at the time of last reclaim cycle */ |
| 305 | unsigned long refaults; | 311 | unsigned long refaults; |
| 312 | /* Various lruvec state flags (enum lruvec_flags) */ | ||
| 313 | unsigned long flags; | ||
| 306 | #ifdef CONFIG_MEMCG | 314 | #ifdef CONFIG_MEMCG |
| 307 | struct pglist_data *pgdat; | 315 | struct pglist_data *pgdat; |
| 308 | #endif | 316 | #endif |
| 309 | }; | 317 | }; |
| 310 | 318 | ||
| 311 | /* Isolate unmapped file */ | 319 | /* Isolate unmapped pages */ |
| 312 | #define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) | 320 | #define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) |
| 313 | /* Isolate for asynchronous migration */ | 321 | /* Isolate for asynchronous migration */ |
| 314 | #define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x4) | 322 | #define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x4) |
| @@ -359,33 +367,40 @@ struct per_cpu_nodestat { · 44 unmodified lines | |||
| 359 | #endif /* !__GENERATING_BOUNDS.H */ | 367 | #endif /* !__GENERATING_BOUNDS.H */ |
| 360 | 368 | ||
| 361 | enum zone_type { | 369 | enum zone_type { |
| 362 | #ifdef CONFIG_ZONE_DMA | ||
| 363 | /* | 370 | /* |
| 364 | * ZONE_DMA is used when there are devices that are not able | 371 | * ZONE_DMA and ZONE_DMA32 are used when there are peripherals not able |
| 365 | * to do DMA to all of addressable memory (ZONE_NORMAL). Then we | 372 | * to DMA to all of the addressable memory (ZONE_NORMAL). |
| 366 | * carve out the portion of memory that is needed for these devices. | 373 | * On architectures where this area covers the whole 32 bit address |
| 367 | * The range is arch specific. | 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 | 388 | * - arm64 has a fixed 1G ZONE_DMA and ZONE_DMA32 for the rest of the |
| 372 | * --------------------------- | 389 | * lower 4G. |
| 373 | * parisc, ia64, sparc <4G | ||
| 374 | * s390, powerpc <2G | ||
| 375 | * arm Various | ||
| 376 | * alpha Unlimited or 0-16MB. | ||
| 377 | * | 390 | * |
| 378 | * i386, x86_64 and multiple other arches | 391 | * - powerpc only uses ZONE_DMA, the size, up to 2G, may vary |
| 379 | * <16M. | 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 | ZONE_DMA, | 401 | ZONE_DMA, |
| 382 | #endif | 402 | #endif |
| 383 | #ifdef CONFIG_ZONE_DMA32 | 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 | ZONE_DMA32, | 404 | ZONE_DMA32, |
| 390 | #endif | 405 | #endif |
| 391 | /* | 406 | /* |
| @@ -565,9 +580,6 @@ struct zone { · 173 unmodified lines | |||
| 565 | } ____cacheline_internodealigned_in_smp; | 580 | } ____cacheline_internodealigned_in_smp; |
| 566 | 581 | ||
| 567 | enum pgdat_flags { | 582 | enum pgdat_flags { |
| 568 | PGDAT_CONGESTED, /* pgdat has many dirty pages backed by | ||
| 569 | * a congested BDI | ||
| 570 | */ | ||
| 571 | PGDAT_DIRTY, /* reclaim scanning has recently found | 583 | PGDAT_DIRTY, /* reclaim scanning has recently found |
| 572 | * many dirty file pages at the tail | 584 | * many dirty file pages at the tail |
| 573 | * of the LRU. | 585 | * of the LRU. |
| @@ -770,7 +782,13 @@ typedef struct pglist_data { · 196 unmodified lines | |||
| 770 | #endif | 782 | #endif |
| 771 | 783 | ||
| 772 | /* Fields commonly accessed by the page reclaim scanner */ | 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 | unsigned long flags; | 793 | unsigned long flags; |
| 776 | 794 | ||
| @@ -793,11 +811,6 @@ typedef struct pglist_data { · 16 unmodified lines | |||
| 793 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 811 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
| 794 | #define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid)) | 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 | static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat) | 814 | static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat) |
| 802 | { | 815 | { |
| 803 | return pgdat->node_start_pfn + pgdat->node_spanned_pages; | 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 | #ifdef CONFIG_MEMCG | 848 | #ifdef CONFIG_MEMCG |
| 836 | return lruvec->pgdat; | 849 | return lruvec->pgdat; |
| 837 | #else | 850 | #else |
| 838 | return container_of(lruvec, struct pglist_data, lruvec); | 851 | return container_of(lruvec, struct pglist_data, __lruvec); |
| 839 | #endif | 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 | * 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 | 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 | * @zone - The current zone in the iterator | 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 | * @zlist - The zonelist being iterated | 1089 | * @zlist - The zonelist being iterated |
| 1077 | * @highidx - The zone index of the highest zone to return | 1090 | * @highidx - The zone index of the highest zone to return |
| 1078 | * @nodemask - Nodemask allowed by the allocator | 1091 | * @nodemask - Nodemask allowed by the allocator |
| @@ -587,9 +587,9 @@ struct platform_device_id { · 586 unmodified lines | |||
| 587 | #define MDIO_NAME_SIZE 32 | 587 | #define MDIO_NAME_SIZE 32 |
| 588 | #define MDIO_MODULE_PREFIX "mdio:" | 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 | #define MDIO_ID_ARGS(_id) \ | 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 | ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ | 593 | ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ |
| 594 | ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ | 594 | ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ |
| 595 | ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \ | 595 | ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \ |
| @@ -1,11 +1,14 @@ | |||
| 1 | #ifndef _LINUX_MODULE_H | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | #define _LINUX_MODULE_H | ||
| 3 | /* | 2 | /* |
| 4 | * Dynamic loading of modules into the kernel. | 3 | * Dynamic loading of modules into the kernel. |
| 5 | * | 4 | * |
| 6 | * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996 | 5 | * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996 |
| 7 | * Rewritten again by Rusty Russell, 2002 | 6 | * Rewritten again by Rusty Russell, 2002 |
| 8 | */ | 7 | */ |
| 8 | |||
| 9 | #ifndef _LINUX_MODULE_H | ||
| 10 | #define _LINUX_MODULE_H | ||
| 11 | |||
| 9 | #include <linux/list.h> | 12 | #include <linux/list.h> |
| 10 | #include <linux/stat.h> | 13 | #include <linux/stat.h> |
| 11 | #include <linux/compiler.h> | 14 | #include <linux/compiler.h> |
| @@ -91,7 +91,7 @@ void module_arch_cleanup(struct module *mod); · 90 unmodified lines | |||
| 91 | /* Any cleanup before freeing mod->module_init */ | 91 | /* Any cleanup before freeing mod->module_init */ |
| 92 | void module_arch_freeing_init(struct module *mod); | 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 | #include <linux/kasan.h> | 95 | #include <linux/kasan.h> |
| 96 | #define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT) | 96 | #define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT) |
| 97 | #else | 97 | #else |
| @@ -100,11 +100,11 @@ struct kparam_array · 99 unmodified lines | |||
| 100 | 100 | ||
| 101 | /** | 101 | /** |
| 102 | * module_param - typesafe helper for a module/cmdline parameter | 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 | * @type: the type of the parameter | 104 | * @type: the type of the parameter |
| 105 | * @perm: visibility in sysfs. | 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 | * ".") the kernel commandline parameter. Note that - is changed to _, so | 108 | * ".") the kernel commandline parameter. Note that - is changed to _, so |
| 109 | * the user can use "foo-bar=1" even for variable "foo_bar". | 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 | static inline int mr_call_vif_notifier(struct notifier_block *nb, | 49 | static inline int mr_call_vif_notifier(struct notifier_block *nb, |
| 50 | struct net *net, | ||
| 51 | unsigned short family, | 50 | unsigned short family, |
| 52 | enum fib_event_type event_type, | 51 | enum fib_event_type event_type, |
| 53 | struct vif_device *vif, | 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 | struct vif_entry_notifier_info info = { | 56 | struct vif_entry_notifier_info info = { |
| 57 | .info = { | 57 | .info = { |
| 58 | .family = family, | 58 | .family = family, |
| 59 | .net = net, | 59 | .extack = extack, |
| 60 | }, | 60 | }, |
| 61 | .dev = vif->dev, | 61 | .dev = vif->dev, |
| 62 | .vif_index = vif_index, | 62 | .vif_index = vif_index, |
| @@ -64,7 +64,7 @@ static inline int mr_call_vif_notifier(struct notifier_block *nb, · 1 unmodified line | |||
| 64 | .tb_id = tb_id, | 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 | static inline int mr_call_vif_notifiers(struct net *net, | 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 | struct vif_entry_notifier_info info = { | 77 | struct vif_entry_notifier_info info = { |
| 78 | .info = { | 78 | .info = { |
| 79 | .family = family, | 79 | .family = family, |
| 80 | .net = net, | ||
| 81 | }, | 80 | }, |
| 82 | .dev = vif->dev, | 81 | .dev = vif->dev, |
| 83 | .vif_index = vif_index, | 82 | .vif_index = vif_index, |
| @@ -173,21 +172,21 @@ struct mfc_entry_notifier_info { · 89 unmodified lines | |||
| 173 | }; | 172 | }; |
| 174 | 173 | ||
| 175 | static inline int mr_call_mfc_notifier(struct notifier_block *nb, | 174 | static inline int mr_call_mfc_notifier(struct notifier_block *nb, |
| 176 | struct net *net, | ||
| 177 | unsigned short family, | 175 | unsigned short family, |
| 178 | enum fib_event_type event_type, | 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 | struct mfc_entry_notifier_info info = { | 180 | struct mfc_entry_notifier_info info = { |
| 182 | .info = { | 181 | .info = { |
| 183 | .family = family, | 182 | .family = family, |
| 184 | .net = net, | 183 | .extack = extack, |
| 185 | }, | 184 | }, |
| 186 | .mfc = mfc, | 185 | .mfc = mfc, |
| 187 | .tb_id = tb_id | 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 | static inline int mr_call_mfc_notifiers(struct net *net, | 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 | struct mfc_entry_notifier_info info = { | 198 | struct mfc_entry_notifier_info info = { |
| 200 | .info = { | 199 | .info = { |
| 201 | .family = family, | 200 | .family = family, |
| 202 | .net = net, | ||
| 203 | }, | 201 | }, |
| 204 | .mfc = mfc, | 202 | .mfc = mfc, |
| 205 | .tb_id = tb_id | 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 | int mr_dump(struct net *net, struct notifier_block *nb, unsigned short family, | 300 | int mr_dump(struct net *net, struct notifier_block *nb, unsigned short family, |
| 303 | int (*rules_dump)(struct net *net, | 301 | int (*rules_dump)(struct net *net, |
| 304 | struct notifier_block *nb), | 302 | struct notifier_block *nb, |
| 303 | struct netlink_ext_ack *extack), | ||
| 305 | struct mr_table *(*mr_iter)(struct net *net, | 304 | struct mr_table *(*mr_iter)(struct net *net, |
| 306 | struct mr_table *mrt), | 305 | struct mr_table *mrt), |
| 307 | rwlock_t *mrt_lock); | 306 | rwlock_t *mrt_lock, struct netlink_ext_ack *extack); |
| 308 | #else | 307 | #else |
| 309 | static inline void vif_device_init(struct vif_device *v, | 308 | static inline void vif_device_init(struct vif_device *v, |
| 310 | struct net_device *dev, | 309 | struct net_device *dev, |
| @@ -355,10 +354,11 @@ mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb, · 44 unmodified lines | |||
| 355 | static inline int mr_dump(struct net *net, struct notifier_block *nb, | 354 | static inline int mr_dump(struct net *net, struct notifier_block *nb, |
| 356 | unsigned short family, | 355 | unsigned short family, |
| 357 | int (*rules_dump)(struct net *net, | 356 | int (*rules_dump)(struct net *net, |
| 358 | struct notifier_block *nb), | 357 | struct notifier_block *nb, |
| 358 | struct netlink_ext_ack *extack), | ||
| 359 | struct mr_table *(*mr_iter)(struct net *net, | 359 | struct mr_table *(*mr_iter)(struct net *net, |
| 360 | struct mr_table *mrt), | 360 | struct mr_table *mrt), |
| 361 | rwlock_t *mrt_lock) | 361 | rwlock_t *mrt_lock, struct netlink_ext_ack *extack) |
| 362 | { | 362 | { |
| 363 | return -EINVAL; | 363 | return -EINVAL; |
| 364 | } | 364 | } |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | #define SNOR_MFR_INTEL CFI_MFR_INTEL | 22 | #define SNOR_MFR_INTEL CFI_MFR_INTEL |
| 23 | #define SNOR_MFR_ST CFI_MFR_ST /* ST Micro */ | 23 | #define SNOR_MFR_ST CFI_MFR_ST /* ST Micro */ |
| 24 | #define SNOR_MFR_MICRON CFI_MFR_MICRON /* Micron */ | 24 | #define SNOR_MFR_MICRON CFI_MFR_MICRON /* Micron */ |
| 25 | #define SNOR_MFR_ISSI CFI_MFR_PMC | ||
| 25 | #define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX | 26 | #define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX |
| 26 | #define SNOR_MFR_SPANSION CFI_MFR_AMD | 27 | #define SNOR_MFR_SPANSION CFI_MFR_AMD |
| 27 | #define SNOR_MFR_SST CFI_MFR_SST | 28 | #define SNOR_MFR_SST CFI_MFR_SST |
| @@ -133,7 +134,7 @@ · 105 unmodified lines | |||
| 133 | #define SR_E_ERR BIT(5) | 134 | #define SR_E_ERR BIT(5) |
| 134 | #define SR_P_ERR BIT(6) | 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 | /* Enhanced Volatile Configuration Register bits */ | 139 | /* Enhanced Volatile Configuration Register bits */ |
| 139 | #define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */ | 140 | #define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */ |
| @@ -144,10 +145,8 @@ · 4 unmodified lines | |||
| 144 | #define FSR_P_ERR BIT(4) /* Program operation status */ | 145 | #define FSR_P_ERR BIT(4) /* Program operation status */ |
| 145 | #define FSR_PT_ERR BIT(1) /* Protection error bit */ | 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 | /* Status Register 2 bits. */ | 148 | /* Status Register 2 bits. */ |
| 149 | #define SR2_QUAD_EN_BIT1 BIT(1) | ||
| 151 | #define SR2_QUAD_EN_BIT7 BIT(7) | 150 | #define SR2_QUAD_EN_BIT7 BIT(7) |
| 152 | 151 | ||
| 153 | /* Supported SPI protocols */ | 152 | /* Supported SPI protocols */ |
| @@ -243,6 +242,9 @@ enum spi_nor_option_flags { · 89 unmodified lines | |||
| 243 | SNOR_F_4B_OPCODES = BIT(6), | 242 | SNOR_F_4B_OPCODES = BIT(6), |
| 244 | SNOR_F_HAS_4BAIT = BIT(7), | 243 | SNOR_F_HAS_4BAIT = BIT(7), |
| 245 | SNOR_F_HAS_LOCK = BIT(8), | 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 | /* Forward declaration that will be used in 'struct spi_nor_flash_parameter' */ | 467 | /* Forward declaration that will be used in 'struct spi_nor_flash_parameter' */ |
| 466 | struct spi_nor; | 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 | * struct spi_nor_locking_ops - SPI NOR locking methods | 499 | * struct spi_nor_locking_ops - SPI NOR locking methods |
| 470 | * @lock: lock a region of the SPI NOR. | 500 | * @lock: lock a region of the SPI NOR. |
| @@ -549,19 +579,7 @@ struct flash_info; · 78 unmodified lines | |||
| 549 | * @read_proto: the SPI protocol for read operations | 579 | * @read_proto: the SPI protocol for read operations |
| 550 | * @write_proto: the SPI protocol for write operations | 580 | * @write_proto: the SPI protocol for write operations |
| 551 | * @reg_proto the SPI protocol for read_reg/write_reg/erase operations | 581 | * @reg_proto the SPI protocol for read_reg/write_reg/erase operations |
| 552 | * @prepare: [OPTIONAL] do some preparations for the | 582 | * @controller_ops: SPI NOR controller driver specific operations. |
| 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. | ||
| 565 | * @params: [FLASH-SPECIFIC] SPI-NOR flash parameters and settings. | 583 | * @params: [FLASH-SPECIFIC] SPI-NOR flash parameters and settings. |
| 566 | * The structure includes legacy flash parameters and | 584 | * The structure includes legacy flash parameters and |
| 567 | * settings that can be overwritten by the spi_nor_fixups | 585 | * settings that can be overwritten by the spi_nor_fixups |
| @@ -588,18 +606,8 @@ struct spi_nor { · 20 unmodified lines | |||
| 588 | bool sst_write_second; | 606 | bool sst_write_second; |
| 589 | u32 flags; | 607 | u32 flags; |
| 590 | 608 | ||
| 591 | int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops); | 609 | const struct spi_nor_controller_ops *controller_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); | ||
| 601 | 610 | ||
| 602 | int (*clear_sr_bp)(struct spi_nor *nor); | ||
| 603 | struct spi_nor_flash_parameter params; | 611 | struct spi_nor_flash_parameter params; |
| 604 | 612 | ||
| 605 | void *priv; | 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 | extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int); | 60 | extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int); |
| 61 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); | 61 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
| 62 | extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int); | 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 | extern int follow_down_one(struct path *); | 65 | extern int follow_down_one(struct path *); |
| 65 | extern int follow_down(struct path *); | 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 | * nvdimm_write_bytes() - synchronously write bytes to an nvdimm namespace | 149 | * nvdimm_write_bytes() - synchronously write bytes to an nvdimm namespace |
| 150 | * @ndns: device to read | 150 | * @ndns: device to write |
| 151 | * @offset: namespace-relative starting offset | 151 | * @offset: namespace-relative starting offset |
| 152 | * @buf: buffer to drain | 152 | * @buf: buffer to drain |
| 153 | * @size: transfer length | 153 | * @size: transfer length |
| @@ -848,6 +848,7 @@ enum tc_setup_type { · 847 unmodified lines | |||
| 848 | TC_SETUP_ROOT_QDISC, | 848 | TC_SETUP_ROOT_QDISC, |
| 849 | TC_SETUP_QDISC_GRED, | 849 | TC_SETUP_QDISC_GRED, |
| 850 | TC_SETUP_QDISC_TAPRIO, | 850 | TC_SETUP_QDISC_TAPRIO, |
| 851 | TC_SETUP_FT, | ||
| 851 | }; | 852 | }; |
| 852 | 853 | ||
| 853 | /* These structures hold the attributes of bpf state that are being passed | 854 | /* These structures hold the attributes of bpf state that are being passed |
| @@ -925,6 +926,15 @@ struct dev_ifalias { · 71 unmodified lines | |||
| 925 | struct devlink; | 926 | struct devlink; |
| 926 | struct tlsdev_ops; | 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 | * This structure defines the management hooks for network devices. | 940 | * This structure defines the management hooks for network devices. |
| @@ -1317,6 +1327,10 @@ struct net_device_ops { · 386 unmodified lines | |||
| 1317 | struct nlattr *port[]); | 1327 | struct nlattr *port[]); |
| 1318 | int (*ndo_get_vf_port)(struct net_device *dev, | 1328 | int (*ndo_get_vf_port)(struct net_device *dev, |
| 1319 | int vf, struct sk_buff *skb); | 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 | int (*ndo_set_vf_guid)(struct net_device *dev, | 1334 | int (*ndo_set_vf_guid)(struct net_device *dev, |
| 1321 | int vf, u64 guid, | 1335 | int vf, u64 guid, |
| 1322 | int guid_type); | 1336 | int guid_type); |
| @@ -1564,7 +1578,7 @@ enum netdev_priv_flags { · 241 unmodified lines | |||
| 1564 | * (i.e. as seen by users in the "Space.c" file). It is the name | 1578 | * (i.e. as seen by users in the "Space.c" file). It is the name |
| 1565 | * of the interface. | 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 | * @ifalias: SNMP alias | 1582 | * @ifalias: SNMP alias |
| 1569 | * @mem_end: Shared memory end | 1583 | * @mem_end: Shared memory end |
| 1570 | * @mem_start: Shared memory start | 1584 | * @mem_start: Shared memory start |
| @@ -1761,7 +1775,7 @@ enum netdev_priv_flags { · 190 unmodified lines | |||
| 1761 | * for hardware timestamping | 1775 | * for hardware timestamping |
| 1762 | * @sfp_bus: attached &struct sfp_bus structure. | 1776 | * @sfp_bus: attached &struct sfp_bus structure. |
| 1763 | * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock | 1777 | * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock |
| 1764 | spinlock | 1778 | * spinlock |
| 1765 | * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount | 1779 | * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount |
| 1766 | * @qdisc_xmit_lock_key: lockdep class annotating | 1780 | * @qdisc_xmit_lock_key: lockdep class annotating |
| 1767 | * netdev_queue->_xmit_lock spinlock | 1781 | * netdev_queue->_xmit_lock spinlock |
| @@ -1780,7 +1794,7 @@ enum netdev_priv_flags { · 12 unmodified lines | |||
| 1780 | 1794 | ||
| 1781 | struct net_device { | 1795 | struct net_device { |
| 1782 | char name[IFNAMSIZ]; | 1796 | char name[IFNAMSIZ]; |
| 1783 | struct hlist_node name_hlist; | 1797 | struct netdev_name_node *name_node; |
| 1784 | struct dev_ifalias __rcu *ifalias; | 1798 | struct dev_ifalias __rcu *ifalias; |
| 1785 | /* | 1799 | /* |
| 1786 | * I/O specific fields | 1800 | * I/O specific fields |
| @@ -1867,6 +1881,11 @@ struct net_device { · 80 unmodified lines | |||
| 1867 | unsigned char if_port; | 1881 | unsigned char if_port; |
| 1868 | unsigned char dma; | 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 | unsigned int mtu; | 1889 | unsigned int mtu; |
| 1871 | unsigned int min_mtu; | 1890 | unsigned int min_mtu; |
| 1872 | unsigned int max_mtu; | 1891 | unsigned int max_mtu; |
| @@ -2387,11 +2406,23 @@ struct pcpu_sw_netstats { · 514 unmodified lines | |||
| 2387 | } __aligned(4 * sizeof(u64)); | 2406 | } __aligned(4 * sizeof(u64)); |
| 2388 | 2407 | ||
| 2389 | struct pcpu_lstats { | 2408 | struct pcpu_lstats { |
| 2390 | u64 packets; | 2409 | u64_stats_t packets; |
| 2391 | u64 bytes; | 2410 | u64_stats_t bytes; |
| 2392 | struct u64_stats_sync syncp; | 2411 | struct u64_stats_sync syncp; |
| 2393 | } __aligned(2 * sizeof(u64)); | 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 | #define __netdev_alloc_pcpu_stats(type, gfp) \ | 2426 | #define __netdev_alloc_pcpu_stats(type, gfp) \ |
| 2396 | ({ \ | 2427 | ({ \ |
| 2397 | typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\ | 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 | int register_netdevice_notifier(struct notifier_block *nb); | 2519 | int register_netdevice_notifier(struct notifier_block *nb); |
| 2489 | int unregister_netdevice_notifier(struct notifier_block *nb); | 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 | struct netdev_notifier_info { | 2525 | struct netdev_notifier_info { |
| 2492 | struct net_device *dev; | 2526 | struct net_device *dev; |
| @@ -2557,6 +2591,9 @@ extern rwlock_t dev_base_lock; /* Device list lock */ · 64 unmodified lines | |||
| 2557 | list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) | 2591 | list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list) |
| 2558 | #define for_each_netdev_continue(net, d) \ | 2592 | #define for_each_netdev_continue(net, d) \ |
| 2559 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) | 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 | #define for_each_netdev_continue_rcu(net, d) \ | 2597 | #define for_each_netdev_continue_rcu(net, d) \ |
| 2561 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) | 2598 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) |
| 2562 | #define for_each_netdev_in_bond_rcu(bond, slave) \ | 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 | unsigned char name_assign_type, | 4118 | unsigned char name_assign_type, |
| 4082 | void (*setup)(struct net_device *), | 4119 | void (*setup)(struct net_device *), |
| 4083 | unsigned int txqs, unsigned int rxqs); | 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 | #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ | 4121 | #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ |
| 4088 | alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1) | 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 | int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state, | 199 | int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state, |
| 200 | const struct nf_hook_entries *e, unsigned int i); | 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 | * nf_hook - call a netfilter hook | 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 | struct list_head *head, struct net_device *in, struct net_device *out, | 313 | struct list_head *head, struct net_device *in, struct net_device *out, |
| 312 | int (*okfn)(struct net *, struct sock *, struct sk_buff *)) | 314 | int (*okfn)(struct net *, struct sock *, struct sk_buff *)) |
| 313 | { | 315 | { |
| 314 | struct sk_buff *skb, *next; | 316 | struct nf_hook_entries *hook_head = NULL; |
| 315 | struct list_head sublist; | 317 | |
| 316 | 318 | #ifdef CONFIG_JUMP_LABEL | |
| 317 | INIT_LIST_HEAD(&sublist); | 319 | if (__builtin_constant_p(pf) && |
| 318 | list_for_each_entry_safe(skb, next, head, list) { | 320 | __builtin_constant_p(hook) && |
| 319 | list_del(&skb->list); | 321 | !static_key_false(&nf_hooks_needed[pf][hook])) |
| 320 | if (nf_hook(pf, hook, net, sk, skb, in, out, okfn) == 1) | 322 | return; |
| 321 | list_add_tail(&skb->list, &sublist); | 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 */ | 337 | |
| 324 | list_splice(&sublist, head); | 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 | /* Call setsockopt() */ | 348 | /* Call setsockopt() */ |
| @@ -269,34 +269,15 @@ ip_set_ext_destroy(struct ip_set *set, void *data) · 268 unmodified lines | |||
| 269 | /* Check that the extension is enabled for the set and | 269 | /* Check that the extension is enabled for the set and |
| 270 | * call it's destroy function for its extension part in data. | 270 | * call it's destroy function for its extension part in data. |
| 271 | */ | 271 | */ |
| 272 | if (SET_WITH_COMMENT(set)) | 272 | if (SET_WITH_COMMENT(set)) { |
| 273 | ip_set_extensions[IPSET_EXT_ID_COMMENT].destroy( | 273 | struct ip_set_comment *c = ext_comment(data, set); |
| 274 | set, ext_comment(data, set)); | ||
| 275 | } | ||
| 276 | 274 | ||
| 277 | static inline int | 275 | ip_set_extensions[IPSET_EXT_ID_COMMENT].destroy(set, c); |
| 278 | ip_set_put_flags(struct sk_buff *skb, struct ip_set *set) | 276 | } |
| 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)); | ||
| 298 | } | 277 | } |
| 299 | 278 | ||
| 279 | int ip_set_put_flags(struct sk_buff *skb, struct ip_set *set); | ||
| 280 | |||
| 300 | /* Netlink CB args */ | 281 | /* Netlink CB args */ |
| 301 | enum { | 282 | enum { |
| 302 | IPSET_CB_NET = 0, /* net namespace */ | 283 | IPSET_CB_NET = 0, /* net namespace */ |
| @@ -506,144 +487,8 @@ ip_set_timeout_set(unsigned long *timeout, u32 value) · 203 unmodified lines | |||
| 506 | *timeout = t; | 487 | *timeout = t; |
| 507 | } | 488 | } |
| 508 | 489 | ||
| 509 | static inline u32 | 490 | void ip_set_init_comment(struct ip_set *set, struct ip_set_comment *comment, |
| 510 | ip_set_timeout_get(const unsigned long *timeout) | 491 | const struct ip_set_ext *ext); |
| 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 | } | ||
| 647 | 492 | ||
| 648 | static inline void | 493 | static inline void |
| 649 | ip_set_init_counter(struct ip_set_counter *counter, | 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 | atomic64_set(&(counter)->packets, (long long)(ext->packets)); | 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 | static inline void | 503 | static inline void |
| 684 | ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo, | 504 | ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo, |
| 685 | const struct ip_set_ext *ext) | 505 | const struct ip_set_ext *ext) |
| @@ -12,18 +12,4 @@ enum { · 11 unmodified lines | |||
| 12 | IPSET_ADD_START_STORED_TIMEOUT, | 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 | #endif /* __IP_SET_BITMAP_H */ | 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 | #endif | 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 | static inline bool ip_set_proto_with_ports(u8 proto) | 23 | static inline bool ip_set_proto_with_ports(u8 proto) |
| 27 | { | 24 | { |
| 28 | switch (proto) { | 25 | switch (proto) { |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | |||
| 16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
| 17 | #include <linux/uidgid.h> | 17 | #include <linux/uidgid.h> |
| 18 | #include <uapi/linux/nfs4.h> | 18 | #include <uapi/linux/nfs4.h> |
| 19 | #include <linux/sunrpc/msg_prot.h> | ||
| 19 | 20 | ||
| 20 | enum nfs4_acl_whotype { | 21 | enum nfs4_acl_whotype { |
| 21 | NFS4_ACL_WHO_NAMED = 0, | 22 | NFS4_ACL_WHO_NAMED = 0, |
| @@ -539,6 +540,8 @@ enum { · 517 unmodified lines | |||
| 539 | 540 | ||
| 540 | NFSPROC4_CLNT_LOOKUPP, | 541 | NFSPROC4_CLNT_LOOKUPP, |
| 541 | NFSPROC4_CLNT_LAYOUTERROR, | 542 | NFSPROC4_CLNT_LAYOUTERROR, |
| 543 | |||
| 544 | NFSPROC4_CLNT_COPY_NOTIFY, | ||
| 542 | }; | 545 | }; |
| 543 | 546 | ||
| 544 | /* nfs41 types */ | 547 | /* nfs41 types */ |
| @@ -674,4 +677,27 @@ struct nfs4_op_map { · 129 unmodified lines | |||
| 674 | } u; | 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 | #endif | 703 | #endif |
| @@ -189,13 +189,15 @@ struct nfs_inode { · 188 unmodified lines | |||
| 189 | 189 | ||
| 190 | struct nfs4_copy_state { | 190 | struct nfs4_copy_state { |
| 191 | struct list_head copies; | 191 | struct list_head copies; |
| 192 | struct list_head src_copies; | ||
| 192 | nfs4_stateid stateid; | 193 | nfs4_stateid stateid; |
| 193 | struct completion completion; | 194 | struct completion completion; |
| 194 | uint64_t count; | 195 | uint64_t count; |
| 195 | struct nfs_writeverf verf; | 196 | struct nfs_writeverf verf; |
| 196 | int error; | 197 | int error; |
| 197 | int flags; | 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 | #define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ | 45 | #define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ |
| 46 | #define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */ | 46 | #define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */ |
| 47 | #define NFS_CS_TSM_POSSIBLE 5 /* - Maybe state migration */ | 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 | struct sockaddr_storage cl_addr; /* server identifier */ | 51 | struct sockaddr_storage cl_addr; /* server identifier */ |
| 49 | size_t cl_addrlen; | 52 | size_t cl_addrlen; |
| 50 | char * cl_hostname; /* hostname of server */ | 53 | char * cl_hostname; /* hostname of server */ |
| @@ -171,7 +174,7 @@ struct nfs_server { · 120 unmodified lines | |||
| 171 | 174 | ||
| 172 | struct nfs_fsid fsid; | 175 | struct nfs_fsid fsid; |
| 173 | __u64 maxfilesize; /* maximum file size */ | 176 | __u64 maxfilesize; /* maximum file size */ |
| 174 | struct timespec time_delta; /* smallest time granularity */ | 177 | struct timespec64 time_delta; /* smallest time granularity */ |
| 175 | unsigned long mount_time; /* when this fs was mounted */ | 178 | unsigned long mount_time; /* when this fs was mounted */ |
| 176 | struct super_block *super; /* VFS super block */ | 179 | struct super_block *super; /* VFS super block */ |
| 177 | dev_t s_dev; /* superblock dev numbers */ | 180 | dev_t s_dev; /* superblock dev numbers */ |
| @@ -276,5 +279,6 @@ struct nfs_server { · 98 unmodified lines | |||
| 276 | #define NFS_CAP_COPY (1U << 24) | 279 | #define NFS_CAP_COPY (1U << 24) |
| 277 | #define NFS_CAP_OFFLOAD_CANCEL (1U << 25) | 280 | #define NFS_CAP_OFFLOAD_CANCEL (1U << 25) |
| 278 | #define NFS_CAP_LAYOUTERROR (1U << 26) | 281 | #define NFS_CAP_LAYOUTERROR (1U << 26) |
| 282 | #define NFS_CAP_COPY_NOTIFY (1U << 27) | ||
| 279 | 283 | ||
| 280 | #endif | 284 | #endif |
| @@ -62,14 +62,14 @@ struct nfs_fattr { · 61 unmodified lines | |||
| 62 | struct nfs_fsid fsid; | 62 | struct nfs_fsid fsid; |
| 63 | __u64 fileid; | 63 | __u64 fileid; |
| 64 | __u64 mounted_on_fileid; | 64 | __u64 mounted_on_fileid; |
| 65 | struct timespec atime; | 65 | struct timespec64 atime; |
| 66 | struct timespec mtime; | 66 | struct timespec64 mtime; |
| 67 | struct timespec ctime; | 67 | struct timespec64 ctime; |
| 68 | __u64 change_attr; /* NFSv4 change attribute */ | 68 | __u64 change_attr; /* NFSv4 change attribute */ |
| 69 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ | 69 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ |
| 70 | __u64 pre_size; /* pre_op_attr.size */ | 70 | __u64 pre_size; /* pre_op_attr.size */ |
| 71 | struct timespec pre_mtime; /* pre_op_attr.mtime */ | 71 | struct timespec64 pre_mtime; /* pre_op_attr.mtime */ |
| 72 | struct timespec pre_ctime; /* pre_op_attr.ctime */ | 72 | struct timespec64 pre_ctime; /* pre_op_attr.ctime */ |
| 73 | unsigned long time_start; | 73 | unsigned long time_start; |
| 74 | unsigned long gencount; | 74 | unsigned long gencount; |
| 75 | struct nfs4_string *owner_name; | 75 | struct nfs4_string *owner_name; |
| @@ -143,7 +143,7 @@ struct nfs_fsinfo { · 67 unmodified lines | |||
| 143 | __u32 wtmult; /* writes should be multiple of this */ | 143 | __u32 wtmult; /* writes should be multiple of this */ |
| 144 | __u32 dtpref; /* pref. readdir transfer size */ | 144 | __u32 dtpref; /* pref. readdir transfer size */ |
| 145 | __u64 maxfilesize; | 145 | __u64 maxfilesize; |
| 146 | struct timespec time_delta; /* server time granularity */ | 146 | struct timespec64 time_delta; /* server time granularity */ |
| 147 | __u32 lease_time; /* in seconds */ | 147 | __u32 lease_time; /* in seconds */ |
| 148 | __u32 nlayouttypes; /* number of layouttypes */ | 148 | __u32 nlayouttypes; /* number of layouttypes */ |
| 149 | __u32 layouttype[NFS_MAX_LAYOUT_TYPES]; /* supported pnfs layout driver */ | 149 | __u32 layouttype[NFS_MAX_LAYOUT_TYPES]; /* supported pnfs layout driver */ |
| @@ -869,7 +869,7 @@ struct nfs3_sattrargs { · 719 unmodified lines | |||
| 869 | struct nfs_fh * fh; | 869 | struct nfs_fh * fh; |
| 870 | struct iattr * sattr; | 870 | struct iattr * sattr; |
| 871 | unsigned int guard; | 871 | unsigned int guard; |
| 872 | struct timespec guardtime; | 872 | struct timespec64 guardtime; |
| 873 | }; | 873 | }; |
| 874 | 874 | ||
| 875 | struct nfs3_diropargs { | 875 | struct nfs3_diropargs { |
| @@ -1435,6 +1435,7 @@ struct nfs42_copy_args { · 559 unmodified lines | |||
| 1435 | 1435 | ||
| 1436 | u64 count; | 1436 | u64 count; |
| 1437 | bool sync; | 1437 | bool sync; |
| 1438 | struct nl4_server *cp_src; | ||
| 1438 | }; | 1439 | }; |
| 1439 | 1440 | ||
| 1440 | struct nfs42_write_res { | 1441 | struct nfs42_write_res { |
| @@ -1463,6 +1464,22 @@ struct nfs42_offload_status_res { · 22 unmodified lines | |||
| 1463 | int osr_status; | 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 | struct nfs42_seek_args { | 1483 | struct nfs42_seek_args { |
| 1467 | struct nfs4_sequence_args seq_args; | 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 | extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, | 150 | extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, |
| 151 | struct notifier_block *nb); | 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 | extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, | 153 | extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, |
| 158 | struct notifier_block *nb); | 154 | struct notifier_block *nb); |
| 159 | extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, | 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 | * Host/Initiator Transport Entrypoints/Parameters: | 271 | * Host/Initiator Transport Entrypoints/Parameters: |
| 272 | * | 272 | * |
| 273 | * @module: The LLDD module using the interface | ||
| 274 | * | ||
| 273 | * @localport_delete: The LLDD initiates deletion of a localport via | 275 | * @localport_delete: The LLDD initiates deletion of a localport via |
| 274 | * nvme_fc_deregister_localport(). However, the teardown is | 276 | * nvme_fc_deregister_localport(). However, the teardown is |
| 275 | * asynchronous. This routine is called upon the completion of the | 277 | * asynchronous. This routine is called upon the completion of the |
| @@ -383,6 +385,8 @@ struct nvme_fc_remote_port { · 107 unmodified lines | |||
| 383 | * Value is Mandatory. Allowed to be zero. | 385 | * Value is Mandatory. Allowed to be zero. |
| 384 | */ | 386 | */ |
| 385 | struct nvme_fc_port_template { | 387 | struct nvme_fc_port_template { |
| 388 | struct module *module; | ||
| 389 | |||
| 386 | /* initiator-based functions */ | 390 | /* initiator-based functions */ |
| 387 | void (*localport_delete)(struct nvme_fc_local_port *); | 391 | void (*localport_delete)(struct nvme_fc_local_port *); |
| 388 | void (*remoteport_delete)(struct nvme_fc_remote_port *); | 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). | 7 | * This file contains definitions relative to FC-NVME-2 r1.06 |
| 8 | * The fcnvme_lsdesc_cr_assoc_cmd struct reflects expected r1.16 content. | 8 | * (T11-2019-00210-v001). |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #ifndef _NVME_FC_H | 11 | #ifndef _NVME_FC_H |
| 12 | #define _NVME_FC_H 1 | 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 | #define NVME_CMD_FC_ID FC_TYPE_NVME | 17 | #define NVME_CMD_FC_ID FC_TYPE_NVME |
| 17 | 18 | ||
| 18 | /* FC-NVME Cmd IU Flags */ | 19 | /* FC-NVME Cmd IU Flags */ |
| 19 | #define FCNVME_CMD_FLAGS_DIRMASK 0x03 | 20 | enum { |
| 20 | #define FCNVME_CMD_FLAGS_WRITE 0x01 | 21 | FCNVME_CMD_FLAGS_DIRMASK = 0x03, |
| 21 | #define FCNVME_CMD_FLAGS_READ 0x02 | 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 | struct nvme_fc_cmd_iu { | 46 | struct nvme_fc_cmd_iu { |
| 24 | __u8 scsi_id; | 47 | __u8 format_id; |
| 25 | __u8 fc_id; | 48 | __u8 fc_id; |
| 26 | __be16 iu_len; | 49 | __be16 iu_len; |
| 27 | __u8 rsvd4[3]; | 50 | __u8 rsvd4[2]; |
| 51 | __u8 rsv_cat; | ||
| 28 | __u8 flags; | 52 | __u8 flags; |
| 29 | __be64 connection_id; | 53 | __be64 connection_id; |
| 30 | __be32 csn; | 54 | __be32 csn; |
| 31 | __be32 data_len; | 55 | __be32 data_len; |
| 32 | struct nvme_command sqe; | 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 | #define NVME_FC_SIZEOF_ZEROS_RSP 12 | 63 | #define NVME_FC_SIZEOF_ZEROS_RSP 12 |
| @@ -38,11 +65,12 @@ struct nvme_fc_cmd_iu { · 1 unmodified line | |||
| 38 | enum { | 65 | enum { |
| 39 | FCNVME_SC_SUCCESS = 0, | 66 | FCNVME_SC_SUCCESS = 0, |
| 40 | FCNVME_SC_INVALID_FIELD = 1, | 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 | struct nvme_fc_ersp_iu { | 72 | struct nvme_fc_ersp_iu { |
| 45 | __u8 status_code; | 73 | __u8 ersp_result; |
| 46 | __u8 rsvd1; | 74 | __u8 rsvd1; |
| 47 | __be16 iu_len; | 75 | __be16 iu_len; |
| 48 | __be32 rsn; | 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 | enum { | 114 | enum { |
| 58 | FCNVME_LS_RSVD = 0, | 115 | FCNVME_LS_RSVD = 0, |
| 59 | FCNVME_LS_RJT = 1, | 116 | FCNVME_LS_RJT = 1, |
| 60 | FCNVME_LS_ACC = 2, | 117 | FCNVME_LS_ACC = 2, |
| 61 | FCNVME_LS_CREATE_ASSOCIATION = 3, | 118 | FCNVME_LS_CREATE_ASSOCIATION = 3, /* Create Association */ |
| 62 | FCNVME_LS_CREATE_CONNECTION = 4, | 119 | FCNVME_LS_CREATE_CONNECTION = 4, /* Create I/O Connection */ |
| 63 | FCNVME_LS_DISCONNECT = 5, | 120 | FCNVME_LS_DISCONNECT_ASSOC = 5, /* Disconnect Association */ |
| 121 | FCNVME_LS_DISCONNECT_CONN = 6, /* Disconnect Connection */ | ||
| 64 | }; | 122 | }; |
| 65 | 123 | ||
| 66 | /* FC-NVME Link Service Descriptors */ | 124 | /* FC-NVME Link Service Descriptors */ |
| @@ -117,14 +175,17 @@ enum fcnvme_ls_rjt_reason { · 50 unmodified lines | |||
| 117 | FCNVME_RJT_RC_UNSUP = 0x0b, | 175 | FCNVME_RJT_RC_UNSUP = 0x0b, |
| 118 | /* command not supported */ | 176 | /* command not supported */ |
| 119 | 177 | ||
| 120 | FCNVME_RJT_RC_INPROG = 0x0e, | ||
| 121 | /* command already in progress */ | ||
| 122 | |||
| 123 | FCNVME_RJT_RC_INV_ASSOC = 0x40, | 178 | FCNVME_RJT_RC_INV_ASSOC = 0x40, |
| 124 | /* Invalid Association ID*/ | 179 | /* Invalid Association ID */ |
| 125 | 180 | ||
| 126 | FCNVME_RJT_RC_INV_CONN = 0x41, | 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 | FCNVME_RJT_RC_VENDOR = 0xff, | 190 | FCNVME_RJT_RC_VENDOR = 0xff, |
| 130 | /* vendor specific error */ | 191 | /* vendor specific error */ |
| @@ -138,14 +199,32 @@ enum fcnvme_ls_rjt_explan { · 7 unmodified lines | |||
| 138 | FCNVME_RJT_EXP_OXID_RXID = 0x17, | 199 | FCNVME_RJT_EXP_OXID_RXID = 0x17, |
| 139 | /* invalid OX_ID-RX_ID combination */ | 200 | /* invalid OX_ID-RX_ID combination */ |
| 140 | 201 | ||
| 141 | FCNVME_RJT_EXP_INSUF_RES = 0x29, | ||
| 142 | /* insufficient resources */ | ||
| 143 | |||
| 144 | FCNVME_RJT_EXP_UNAB_DATA = 0x2a, | 202 | FCNVME_RJT_EXP_UNAB_DATA = 0x2a, |
| 145 | /* unable to supply requested data */ | 203 | /* unable to supply requested data */ |
| 146 | 204 | ||
| 147 | FCNVME_RJT_EXP_INV_LEN = 0x2d, | 205 | FCNVME_RJT_EXP_INV_LEN = 0x2d, |
| 148 | /* Invalid payload length */ | 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 | /* FCNVME_LSDESC_RJT */ | 230 | /* FCNVME_LSDESC_RJT */ |
| @@ -209,21 +288,11 @@ struct fcnvme_lsdesc_cr_conn_cmd { · 57 unmodified lines | |||
| 209 | __be32 rsvd52; | 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 | /* FCNVME_LSDESC_DISCONN_CMD */ | 291 | /* FCNVME_LSDESC_DISCONN_CMD */ |
| 219 | struct fcnvme_lsdesc_disconn_cmd { | 292 | struct fcnvme_lsdesc_disconn_cmd { |
| 220 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ | 293 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 221 | __be32 desc_len; | 294 | __be32 desc_len; |
| 222 | u8 rsvd8[3]; | 295 | __be32 rsvd8[4]; |
| 223 | /* note: scope is really a 1 bit field */ | ||
| 224 | u8 scope; /* FCNVME_DISCONN_xxx */ | ||
| 225 | __be32 rsvd12; | ||
| 226 | __be64 id; | ||
| 227 | }; | 296 | }; |
| 228 | 297 | ||
| 229 | /* FCNVME_LSDESC_CONN_ID */ | 298 | /* FCNVME_LSDESC_CONN_ID */ |
| @@ -242,9 +311,14 @@ struct fcnvme_lsdesc_assoc_id { · 12 unmodified lines | |||
| 242 | 311 | ||
| 243 | /* r_ctl values */ | 312 | /* r_ctl values */ |
| 244 | enum { | 313 | enum { |
| 245 | FCNVME_RS_RCTL_DATA = 1, | 314 | FCNVME_RS_RCTL_CMND = 0x6, |
| 246 | FCNVME_RS_RCTL_XFER_RDY = 5, | 315 | FCNVME_RS_RCTL_DATA = 0x1, |
| 247 | FCNVME_RS_RCTL_RSP = 8, | 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 | struct fcnvme_ls_rqst_w0 w0; | 338 | struct fcnvme_ls_rqst_w0 w0; |
| 265 | __be32 desc_list_len; | 339 | __be32 desc_list_len; |
| 266 | struct fcnvme_lsdesc_rqst rqst; | 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 | /* FCNVME_LS_CREATE_ASSOCIATION */ | 347 | /* FCNVME_LS_CREATE_ASSOCIATION */ |
| @@ -302,25 +379,39 @@ struct fcnvme_ls_cr_conn_acc { · 31 unmodified lines | |||
| 302 | struct fcnvme_lsdesc_conn_id connectid; | 379 | struct fcnvme_lsdesc_conn_id connectid; |
| 303 | }; | 380 | }; |
| 304 | 381 | ||
| 305 | /* FCNVME_LS_DISCONNECT */ | 382 | /* FCNVME_LS_DISCONNECT_ASSOC */ |
| 306 | struct fcnvme_ls_disconnect_rqst { | 383 | struct fcnvme_ls_disconnect_assoc_rqst { |
| 307 | struct fcnvme_ls_rqst_w0 w0; | 384 | struct fcnvme_ls_rqst_w0 w0; |
| 308 | __be32 desc_list_len; | 385 | __be32 desc_list_len; |
| 309 | struct fcnvme_lsdesc_assoc_id associd; | 386 | struct fcnvme_lsdesc_assoc_id associd; |
| 310 | struct fcnvme_lsdesc_disconn_cmd discon_cmd; | 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 | struct fcnvme_ls_acc_hdr hdr; | 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 */ | 412 | #define FC_TWO_TIMES_R_A_TOV (2 * (FC_DEF_R_A_TOV / 1000)) |
| 322 | #define NVME_FC_LS_TIMEOUT_SEC 2 /* 2 seconds */ | 413 | #define NVME_FC_LS_TIMEOUT_SEC FC_TWO_TIMES_R_A_TOV |
| 323 | #define NVME_FC_TGTOP_TIMEOUT_SEC 2 /* 2 seconds */ | 414 | #define NVME_FC_TGTOP_TIMEOUT_SEC FC_TWO_TIMES_R_A_TOV |
| 324 | 415 | ||
| 325 | /* | 416 | /* |
| 326 | * TRADDR string must be of form "nn-<16hexdigits>:pn-<16hexdigits>" | 417 | * TRADDR string must be of form "nn-<16hexdigits>:pn-<16hexdigits>" |
| @@ -328,6 +419,7 @@ struct fcnvme_ls_disconnect_acc { · 1 unmodified line | |||
| 328 | * infront of the <16hexdigits>. Without is considered the "min" string | 419 | * infront of the <16hexdigits>. Without is considered the "min" string |
| 329 | * and with is considered the "max" string. The hexdigits may be upper | 420 | * and with is considered the "max" string. The hexdigits may be upper |
| 330 | * or lower case. | 421 | * or lower case. |
| 422 | * Note: FC-NVME-2 standard requires a "0x" prefix. | ||
| 331 | */ | 423 | */ |
| 332 | #define NVME_FC_TRADDR_NNLEN 3 /* "?n-" */ | 424 | #define NVME_FC_TRADDR_NNLEN 3 /* "?n-" */ |
| 333 | #define NVME_FC_TRADDR_OXNNLEN 5 /* "?n-0x" */ | 425 | #define NVME_FC_TRADDR_OXNNLEN 5 /* "?n-0x" */ |
| @@ -107,8 +107,22 @@ enum { · 106 unmodified lines | |||
| 107 | NVME_REG_AQA = 0x0024, /* Admin Queue Attributes */ | 107 | NVME_REG_AQA = 0x0024, /* Admin Queue Attributes */ |
| 108 | NVME_REG_ASQ = 0x0028, /* Admin SQ Base Address */ | 108 | NVME_REG_ASQ = 0x0028, /* Admin SQ Base Address */ |
| 109 | NVME_REG_ACQ = 0x0030, /* Admin CQ Base Address */ | 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 | NVME_REG_CMBSZ = 0x003c, /* Controller Memory Buffer Size */ | 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 | NVME_REG_DBS = 0x1000, /* SQ 0 Tail Doorbell */ | 126 | NVME_REG_DBS = 0x1000, /* SQ 0 Tail Doorbell */ |
| 113 | }; | 127 | }; |
| 114 | 128 | ||
| @@ -295,6 +309,14 @@ enum { · 180 unmodified lines | |||
| 295 | NVME_CTRL_OACS_DIRECTIVES = 1 << 5, | 309 | NVME_CTRL_OACS_DIRECTIVES = 1 << 5, |
| 296 | NVME_CTRL_OACS_DBBUF_SUPP = 1 << 8, | 310 | NVME_CTRL_OACS_DBBUF_SUPP = 1 << 8, |
| 297 | NVME_CTRL_LPA_CMD_EFFECTS_LOG = 1 << 1, | 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 | struct nvme_lbaf { | 322 | struct nvme_lbaf { |
| @@ -352,6 +374,9 @@ enum { · 51 unmodified lines | |||
| 352 | NVME_ID_CNS_NS_PRESENT = 0x11, | 374 | NVME_ID_CNS_NS_PRESENT = 0x11, |
| 353 | NVME_ID_CNS_CTRL_NS_LIST = 0x12, | 375 | NVME_ID_CNS_CTRL_NS_LIST = 0x12, |
| 354 | NVME_ID_CNS_CTRL_LIST = 0x13, | 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 | enum { | 382 | enum { |
| @@ -409,7 +434,8 @@ struct nvme_smart_log { · 51 unmodified lines | |||
| 409 | __u8 avail_spare; | 434 | __u8 avail_spare; |
| 410 | __u8 spare_thresh; | 435 | __u8 spare_thresh; |
| 411 | __u8 percent_used; | 436 | __u8 percent_used; |
| 412 | __u8 rsvd6[26]; | 437 | __u8 endu_grp_crit_warn_sumry; |
| 438 | __u8 rsvd7[25]; | ||
| 413 | __u8 data_units_read[16]; | 439 | __u8 data_units_read[16]; |
| 414 | __u8 data_units_written[16]; | 440 | __u8 data_units_written[16]; |
| 415 | __u8 host_reads[16]; | 441 | __u8 host_reads[16]; |
| @@ -423,7 +449,11 @@ struct nvme_smart_log { · 7 unmodified lines | |||
| 423 | __le32 warning_temp_time; | 449 | __le32 warning_temp_time; |
| 424 | __le32 critical_comp_time; | 450 | __le32 critical_comp_time; |
| 425 | __le16 temp_sensor[8]; | 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 | struct nvme_fw_slot_info_log { | 459 | struct nvme_fw_slot_info_log { |
| @@ -440,6 +470,7 @@ enum { · 10 unmodified lines | |||
| 440 | NVME_CMD_EFFECTS_NIC = 1 << 3, | 470 | NVME_CMD_EFFECTS_NIC = 1 << 3, |
| 441 | NVME_CMD_EFFECTS_CCC = 1 << 4, | 471 | NVME_CMD_EFFECTS_CCC = 1 << 4, |
| 442 | NVME_CMD_EFFECTS_CSE_MASK = 3 << 16, | 472 | NVME_CMD_EFFECTS_CSE_MASK = 3 << 16, |
| 473 | NVME_CMD_EFFECTS_UUID_SEL = 1 << 19, | ||
| 443 | }; | 474 | }; |
| 444 | 475 | ||
| 445 | struct nvme_effects_log { | 476 | struct nvme_effects_log { |
| @@ -563,6 +594,7 @@ enum nvme_opcode { · 117 unmodified lines | |||
| 563 | nvme_cmd_compare = 0x05, | 594 | nvme_cmd_compare = 0x05, |
| 564 | nvme_cmd_write_zeroes = 0x08, | 595 | nvme_cmd_write_zeroes = 0x08, |
| 565 | nvme_cmd_dsm = 0x09, | 596 | nvme_cmd_dsm = 0x09, |
| 597 | nvme_cmd_verify = 0x0c, | ||
| 566 | nvme_cmd_resv_register = 0x0d, | 598 | nvme_cmd_resv_register = 0x0d, |
| 567 | nvme_cmd_resv_report = 0x0e, | 599 | nvme_cmd_resv_report = 0x0e, |
| 568 | nvme_cmd_resv_acquire = 0x11, | 600 | nvme_cmd_resv_acquire = 0x11, |
| @@ -772,6 +804,12 @@ struct nvme_write_zeroes_cmd { · 203 unmodified lines | |||
| 772 | 804 | ||
| 773 | /* Features */ | 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 | struct nvme_feat_auto_pst { | 813 | struct nvme_feat_auto_pst { |
| 776 | __le64 entries[32]; | 814 | __le64 entries[32]; |
| 777 | }; | 815 | }; |
| @@ -806,10 +844,14 @@ enum nvme_admin_opcode { · 28 unmodified lines | |||
| 806 | nvme_admin_ns_mgmt = 0x0d, | 844 | nvme_admin_ns_mgmt = 0x0d, |
| 807 | nvme_admin_activate_fw = 0x10, | 845 | nvme_admin_activate_fw = 0x10, |
| 808 | nvme_admin_download_fw = 0x11, | 846 | nvme_admin_download_fw = 0x11, |
| 847 | nvme_admin_dev_self_test = 0x14, | ||
| 809 | nvme_admin_ns_attach = 0x15, | 848 | nvme_admin_ns_attach = 0x15, |
| 810 | nvme_admin_keep_alive = 0x18, | 849 | nvme_admin_keep_alive = 0x18, |
| 811 | nvme_admin_directive_send = 0x19, | 850 | nvme_admin_directive_send = 0x19, |
| 812 | nvme_admin_directive_recv = 0x1a, | 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 | nvme_admin_dbbuf = 0x7C, | 855 | nvme_admin_dbbuf = 0x7C, |
| 814 | nvme_admin_format_nvm = 0x80, | 856 | nvme_admin_format_nvm = 0x80, |
| 815 | nvme_admin_security_send = 0x81, | 857 | nvme_admin_security_send = 0x81, |
| @@ -873,6 +915,7 @@ enum { · 57 unmodified lines | |||
| 873 | NVME_FEAT_PLM_CONFIG = 0x13, | 915 | NVME_FEAT_PLM_CONFIG = 0x13, |
| 874 | NVME_FEAT_PLM_WINDOW = 0x14, | 916 | NVME_FEAT_PLM_WINDOW = 0x14, |
| 875 | NVME_FEAT_HOST_BEHAVIOR = 0x16, | 917 | NVME_FEAT_HOST_BEHAVIOR = 0x16, |
| 918 | NVME_FEAT_SANITIZE = 0x17, | ||
| 876 | NVME_FEAT_SW_PROGRESS = 0x80, | 919 | NVME_FEAT_SW_PROGRESS = 0x80, |
| 877 | NVME_FEAT_HOST_ID = 0x81, | 920 | NVME_FEAT_HOST_ID = 0x81, |
| 878 | NVME_FEAT_RESV_MASK = 0x82, | 921 | NVME_FEAT_RESV_MASK = 0x82, |
| @@ -883,6 +926,10 @@ enum { · 4 unmodified lines | |||
| 883 | NVME_LOG_FW_SLOT = 0x03, | 926 | NVME_LOG_FW_SLOT = 0x03, |
| 884 | NVME_LOG_CHANGED_NS = 0x04, | 927 | NVME_LOG_CHANGED_NS = 0x04, |
| 885 | NVME_LOG_CMD_EFFECTS = 0x05, | 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 | NVME_LOG_ANA = 0x0c, | 933 | NVME_LOG_ANA = 0x0c, |
| 887 | NVME_LOG_DISC = 0x70, | 934 | NVME_LOG_DISC = 0x70, |
| 888 | NVME_LOG_RESERVATION = 0x80, | 935 | NVME_LOG_RESERVATION = 0x80, |
| @@ -1290,7 +1337,11 @@ enum { · 401 unmodified lines | |||
| 1290 | NVME_SC_SGL_INVALID_OFFSET = 0x16, | 1337 | NVME_SC_SGL_INVALID_OFFSET = 0x16, |
| 1291 | NVME_SC_SGL_INVALID_SUBTYPE = 0x17, | 1338 | NVME_SC_SGL_INVALID_SUBTYPE = 0x17, |
| 1292 | 1339 | ||
| 1340 | NVME_SC_SANITIZE_FAILED = 0x1C, | ||
| 1341 | NVME_SC_SANITIZE_IN_PROGRESS = 0x1D, | ||
| 1342 | |||
| 1293 | NVME_SC_NS_WRITE_PROTECTED = 0x20, | 1343 | NVME_SC_NS_WRITE_PROTECTED = 0x20, |
| 1344 | NVME_SC_CMD_INTERRUPTED = 0x21, | ||
| 1294 | 1345 | ||
| 1295 | NVME_SC_LBA_RANGE = 0x80, | 1346 | NVME_SC_LBA_RANGE = 0x80, |
| 1296 | NVME_SC_CAP_EXCEEDED = 0x81, | 1347 | NVME_SC_CAP_EXCEEDED = 0x81, |
| @@ -1328,6 +1379,8 @@ enum { · 31 unmodified lines | |||
| 1328 | NVME_SC_NS_NOT_ATTACHED = 0x11a, | 1379 | NVME_SC_NS_NOT_ATTACHED = 0x11a, |
| 1329 | NVME_SC_THIN_PROV_NOT_SUPP = 0x11b, | 1380 | NVME_SC_THIN_PROV_NOT_SUPP = 0x11b, |
| 1330 | NVME_SC_CTRL_LIST_INVALID = 0x11c, | 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 | * I/O Command Set Specific - NVM commands: | 1386 | * I/O Command Set Specific - NVM commands: |
| @@ -1368,6 +1421,7 @@ enum { · 34 unmodified lines | |||
| 1368 | NVME_SC_ANA_INACCESSIBLE = 0x302, | 1421 | NVME_SC_ANA_INACCESSIBLE = 0x302, |
| 1369 | NVME_SC_ANA_TRANSITION = 0x303, | 1422 | NVME_SC_ANA_TRANSITION = 0x303, |
| 1370 | NVME_SC_HOST_PATH_ERROR = 0x370, | 1423 | NVME_SC_HOST_PATH_ERROR = 0x370, |
| 1424 | NVME_SC_HOST_ABORTED_CMD = 0x371, | ||
| 1371 | 1425 | ||
| 1372 | NVME_SC_CRD = 0x1800, | 1426 | NVME_SC_CRD = 0x1800, |
| 1373 | NVME_SC_DNR = 0x4000, | 1427 | NVME_SC_DNR = 0x4000, |
| @@ -89,6 +89,9 @@ void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, · 88 unmodified lines | |||
| 89 | int nvmem_register_notifier(struct notifier_block *nb); | 89 | int nvmem_register_notifier(struct notifier_block *nb); |
| 90 | int nvmem_unregister_notifier(struct notifier_block *nb); | 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 | #else | 95 | #else |
| 93 | 96 | ||
| 94 | static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, | 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 | static inline int nvmem_cell_write(struct nvmem_cell *cell, | 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 | return -EOPNOTSUPP; | 126 | return -EOPNOTSUPP; |
| 124 | } | 127 | } |
| @@ -204,6 +207,12 @@ static inline int nvmem_unregister_notifier(struct notifier_block *nb) · 79 unmodified lines | |||
| 204 | return -EOPNOTSUPP; | 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 | #endif /* CONFIG_NVMEM */ | 216 | #endif /* CONFIG_NVMEM */ |
| 208 | 217 | ||
| 209 | #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) | 218 | #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) |
| @@ -12,6 +12,7 @@ struct of_pci_range_parser { · 11 unmodified lines | |||
| 12 | const __be32 *end; | 12 | const __be32 *end; |
| 13 | int np; | 13 | int np; |
| 14 | int pna; | 14 | int pna; |
| 15 | bool dma; | ||
| 15 | }; | 16 | }; |
| 16 | 17 | ||
| 17 | struct of_pci_range { | 18 | struct of_pci_range { |
| @@ -33,10 +34,6 @@ extern u64 of_translate_dma_address(struct device_node *dev, · 15 unmodified lines | |||
| 33 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); | 34 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); |
| 34 | extern int of_address_to_resource(struct device_node *dev, int index, | 35 | extern int of_address_to_resource(struct device_node *dev, int index, |
| 35 | struct resource *r); | 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 | extern void __iomem *of_iomap(struct device_node *device, int index); | 37 | extern void __iomem *of_iomap(struct device_node *device, int index); |
| 41 | void __iomem *of_io_request_and_map(struct device_node *device, | 38 | void __iomem *of_io_request_and_map(struct device_node *device, |
| 42 | int index, const char *name); | 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 | extern struct of_pci_range *of_pci_range_parser_one( | 52 | extern struct of_pci_range *of_pci_range_parser_one( |
| 56 | struct of_pci_range_parser *parser, | 53 | struct of_pci_range_parser *parser, |
| 57 | struct of_pci_range *range); | 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 | extern bool of_dma_is_coherent(struct device_node *np); | 55 | extern bool of_dma_is_coherent(struct device_node *np); |
| 61 | #else /* CONFIG_OF_ADDRESS */ | 56 | #else /* CONFIG_OF_ADDRESS */ |
| 62 | static inline void __iomem *of_io_request_and_map(struct device_node *device, | 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 | return OF_BAD_ADDR; | 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 | static inline const __be32 *of_get_address(struct device_node *dev, int index, | 69 | static inline const __be32 *of_get_address(struct device_node *dev, int index, |
| 83 | u64 *size, unsigned int *flags) | 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 | return NULL; | 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 | static inline bool of_dma_is_coherent(struct device_node *np) | 94 | static inline bool of_dma_is_coherent(struct device_node *np) |
| 114 | { | 95 | { |
| 115 | return false; | 96 | return false; |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/of.h> | 12 | #include <linux/of.h> |
| 13 | 13 | ||
| 14 | #if IS_ENABLED(CONFIG_OF_MDIO) | 14 | #if IS_ENABLED(CONFIG_OF_MDIO) |
| 15 | extern bool of_mdiobus_child_is_phy(struct device_node *child); | ||
| 15 | extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); | 16 | extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); |
| 16 | extern struct phy_device *of_phy_find_device(struct device_node *phy_np); | 17 | extern struct phy_device *of_phy_find_device(struct device_node *phy_np); |
| 17 | extern struct phy_device *of_phy_connect(struct net_device *dev, | 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 | #else /* CONFIG_OF_MDIO */ | 57 | #else /* CONFIG_OF_MDIO */ |
| 58 | static bool of_mdiobus_child_is_phy(struct device_node *child) | ||
| 59 | { | ||
| 60 | return false; | ||
| 61 | } | ||
| 62 | |||
| 57 | static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | 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 | #ifndef __LINUX_OF_NET_H | 6 | #ifndef __LINUX_OF_NET_H |
| 7 | #define __LINUX_OF_NET_H | 7 | #define __LINUX_OF_NET_H |
| 8 | 8 | ||
| 9 | #include <linux/phy.h> | ||
| 10 | |||
| 9 | #ifdef CONFIG_OF_NET | 11 | #ifdef CONFIG_OF_NET |
| 10 | #include <linux/of.h> | 12 | #include <linux/of.h> |
| 11 | 13 | ||
| 12 | struct net_device; | 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 | extern const void *of_get_mac_address(struct device_node *np); | 16 | extern const void *of_get_mac_address(struct device_node *np); |
| 15 | extern struct net_device *of_find_net_device_by_node(struct device_node *np); | 17 | extern struct net_device *of_find_net_device_by_node(struct device_node *np); |
| 16 | #else | 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 | return -ENODEV; | 22 | return -ENODEV; |
| 20 | } | 23 | } |
| @@ -2,11 +2,10 @@ · 1 unmodified line | |||
| 2 | #ifndef __OF_PCI_H | 2 | #ifndef __OF_PCI_H |
| 3 | #define __OF_PCI_H | 3 | #define __OF_PCI_H |
| 4 | 4 | ||
| 5 | #include <linux/pci.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/msi.h> | 6 | #include <linux/errno.h> |
| 7 | 7 | ||
| 8 | struct pci_dev; | 8 | struct pci_dev; |
| 9 | struct of_phandle_args; | ||
| 10 | struct device_node; | 9 | struct device_node; |
| 11 | 10 | ||
| 12 | #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI) | 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 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #define SKIP_HWPOISON 0x1 | 33 | #define MEMORY_OFFLINE 0x1 |
| 34 | #define REPORT_FAILURE 0x2 | 34 | #define REPORT_FAILURE 0x2 |
| 35 | 35 | ||
| 36 | bool has_unmovable_pages(struct zone *zone, struct page *page, int count, | 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 | * Test all pages in [start_pfn, end_pfn) are isolated or not. | 58 | * Test all pages in [start_pfn, end_pfn) are isolated or not. |
| 59 | */ | 59 | */ |
| 60 | int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, | 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 | struct page *alloc_migrate_target(struct page *page, unsigned long private); | 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 | * "do page table walk over the current vma", returning | 24 | * "do page table walk over the current vma", returning |
| 25 | * a negative value means "abort current page table walk | 25 | * a negative value means "abort current page table walk |
| 26 | * right now" and returning 1 means "skip the current vma" | 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 | struct mm_walk_ops { | 31 | struct mm_walk_ops { |
| 29 | int (*pud_entry)(pud_t *pud, unsigned long addr, | 32 | int (*pud_entry)(pud_t *pud, unsigned long addr, |
| @@ -39,6 +42,9 @@ struct mm_walk_ops { · 9 unmodified lines | |||
| 39 | struct mm_walk *walk); | 42 | struct mm_walk *walk); |
| 40 | int (*test_walk)(unsigned long addr, unsigned long next, | 43 | int (*test_walk)(unsigned long addr, unsigned long next, |
| 41 | struct mm_walk *walk); | 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 | void *private); | 68 | void *private); |
| 63 | int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops, | 69 | int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops, |
| 64 | void *private); | 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 | #endif /* _LINUX_PAGEWALK_H */ | 75 | #endif /* _LINUX_PAGEWALK_H */ |
| @@ -460,6 +460,7 @@ extern size_t parport_ieee1284_epp_read_addr (struct parport *, · 459 unmodified lines | |||
| 460 | void *, size_t, int); | 460 | void *, size_t, int); |
| 461 | 461 | ||
| 462 | /* IEEE1284.3 functions */ | 462 | /* IEEE1284.3 functions */ |
| 463 | #define daisy_dev_name "Device ID probe" | ||
| 463 | extern int parport_daisy_init (struct parport *port); | 464 | extern int parport_daisy_init (struct parport *port); |
| 464 | extern void parport_daisy_fini (struct parport *port); | 465 | extern void parport_daisy_fini (struct parport *port); |
| 465 | extern struct pardevice *parport_open (int devnum, const char *name); | 466 | extern struct pardevice *parport_open (int devnum, const char *name); |
| @@ -4,74 +4,39 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | #include <linux/pci.h> | 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 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); | 24 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); |
| 10 | void pci_disable_pri(struct pci_dev *pdev); | 25 | void pci_disable_pri(struct pci_dev *pdev); |
| 11 | void pci_restore_pri_state(struct pci_dev *pdev); | ||
| 12 | int pci_reset_pri(struct pci_dev *pdev); | 26 | int pci_reset_pri(struct pci_dev *pdev); |
| 13 | 27 | int pci_prg_resp_pasid_required(struct pci_dev *pdev); | |
| 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 | |||
| 34 | #endif /* CONFIG_PCI_PRI */ | 28 | #endif /* CONFIG_PCI_PRI */ |
| 35 | 29 | ||
| 36 | #ifdef CONFIG_PCI_PASID | 30 | #ifdef CONFIG_PCI_PASID |
| 37 | |||
| 38 | int pci_enable_pasid(struct pci_dev *pdev, int features); | 31 | int pci_enable_pasid(struct pci_dev *pdev, int features); |
| 39 | void pci_disable_pasid(struct pci_dev *pdev); | 32 | void pci_disable_pasid(struct pci_dev *pdev); |
| 40 | void pci_restore_pasid_state(struct pci_dev *pdev); | ||
| 41 | int pci_pasid_features(struct pci_dev *pdev); | 33 | int pci_pasid_features(struct pci_dev *pdev); |
| 42 | int pci_max_pasids(struct pci_dev *pdev); | 34 | int pci_max_pasids(struct pci_dev *pdev); |
| 43 | int pci_prg_resp_pasid_required(struct pci_dev *pdev); | 35 | #else /* CONFIG_PCI_PASID */ |
| 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 | |||
| 60 | static inline int pci_pasid_features(struct pci_dev *pdev) | 36 | static inline int pci_pasid_features(struct pci_dev *pdev) |
| 61 | { | 37 | { return -EINVAL; } |
| 62 | return -EINVAL; | ||
| 63 | } | ||
| 64 | |||
| 65 | static inline int pci_max_pasids(struct pci_dev *pdev) | 38 | static inline int pci_max_pasids(struct pci_dev *pdev) |
| 66 | { | 39 | { return -EINVAL; } |
| 67 | return -EINVAL; | ||
| 68 | } | ||
| 69 | |||
| 70 | static inline int pci_prg_resp_pasid_required(struct pci_dev *pdev) | ||
| 71 | { | ||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | #endif /* CONFIG_PCI_PASID */ | 40 | #endif /* CONFIG_PCI_PASID */ |
| 75 | 41 | ||
| 76 | 42 | #endif /* LINUX_PCI_ATS_H */ | |
| 77 | #endif /* LINUX_PCI_ATS_H*/ | ||
| @@ -117,7 +117,7 @@ struct pci_epc_features { · 116 unmodified lines | |||
| 117 | unsigned int msix_capable : 1; | 117 | unsigned int msix_capable : 1; |
| 118 | u8 reserved_bar; | 118 | u8 reserved_bar; |
| 119 | u8 bar_fixed_64bit; | 119 | u8 bar_fixed_64bit; |
| 120 | u64 bar_fixed_size[BAR_5 + 1]; | 120 | u64 bar_fixed_size[PCI_STD_NUM_BARS]; |
| 121 | size_t align; | 121 | size_t align; |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| @@ -82,7 +82,7 @@ enum pci_mmap_state { · 81 unmodified lines | |||
| 82 | enum { | 82 | enum { |
| 83 | /* #0-5: standard PCI resources */ | 83 | /* #0-5: standard PCI resources */ |
| 84 | PCI_STD_RESOURCES, | 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 | /* #6: expansion ROM resource */ | 87 | /* #6: expansion ROM resource */ |
| 88 | PCI_ROM_RESOURCE, | 88 | PCI_ROM_RESOURCE, |
| @@ -284,7 +284,6 @@ struct irq_affinity; · 195 unmodified lines | |||
| 284 | struct pcie_link_state; | 284 | struct pcie_link_state; |
| 285 | struct pci_vpd; | 285 | struct pci_vpd; |
| 286 | struct pci_sriov; | 286 | struct pci_sriov; |
| 287 | struct pci_ats; | ||
| 288 | struct pci_p2pdma; | 287 | struct pci_p2pdma; |
| 289 | 288 | ||
| 290 | /* The pci_dev structure describes PCI devices */ | 289 | /* The pci_dev structure describes PCI devices */ |
| @@ -452,12 +451,14 @@ struct pci_dev { · 161 unmodified lines | |||
| 452 | }; | 451 | }; |
| 453 | u16 ats_cap; /* ATS Capability offset */ | 452 | u16 ats_cap; /* ATS Capability offset */ |
| 454 | u8 ats_stu; /* ATS Smallest Translation Unit */ | 453 | u8 ats_stu; /* ATS Smallest Translation Unit */ |
| 455 | atomic_t ats_ref_cnt; /* Number of VFs with ATS enabled */ | ||
| 456 | #endif | 454 | #endif |
| 457 | #ifdef CONFIG_PCI_PRI | 455 | #ifdef CONFIG_PCI_PRI |
| 456 | u16 pri_cap; /* PRI Capability offset */ | ||
| 458 | u32 pri_reqs_alloc; /* Number of PRI requests allocated */ | 457 | u32 pri_reqs_alloc; /* Number of PRI requests allocated */ |
| 458 | unsigned int pasid_required:1; /* PRG Response PASID Required */ | ||
| 459 | #endif | 459 | #endif |
| 460 | #ifdef CONFIG_PCI_PASID | 460 | #ifdef CONFIG_PCI_PASID |
| 461 | u16 pasid_cap; /* PASID Capability offset */ | ||
| 461 | u16 pasid_features; | 462 | u16 pasid_features; |
| 462 | #endif | 463 | #endif |
| 463 | #ifdef CONFIG_PCI_P2PDMA | 464 | #ifdef CONFIG_PCI_P2PDMA |
| @@ -805,8 +806,6 @@ struct module; · 341 unmodified lines | |||
| 805 | * The remove function always gets called from process | 806 | * The remove function always gets called from process |
| 806 | * context, so it can sleep. | 807 | * context, so it can sleep. |
| 807 | * @suspend: Put device into low power state. | 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 | * @resume: Wake device from low power state. | 809 | * @resume: Wake device from low power state. |
| 811 | * (Please see Documentation/power/pci.rst for descriptions | 810 | * (Please see Documentation/power/pci.rst for descriptions |
| 812 | * of PCI Power Management and the related functions.) | 811 | * of PCI Power Management and the related functions.) |
| @@ -829,8 +828,6 @@ struct pci_driver { · 16 unmodified lines | |||
| 829 | int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ | 828 | int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ |
| 830 | void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ | 829 | void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ |
| 831 | int (*suspend)(struct pci_dev *dev, pm_message_t state); /* Device suspended */ | 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 | int (*resume)(struct pci_dev *dev); /* Device woken up */ | 831 | int (*resume)(struct pci_dev *dev); /* Device woken up */ |
| 835 | void (*shutdown)(struct pci_dev *dev); | 832 | void (*shutdown)(struct pci_dev *dev); |
| 836 | int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */ | 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 | int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size); | 1229 | int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size); |
| 1233 | int pci_add_ext_cap_save_buffer(struct pci_dev *dev, | 1230 | int pci_add_ext_cap_save_buffer(struct pci_dev *dev, |
| 1234 | u16 cap, unsigned int size); | 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 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | 1233 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); |
| 1237 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 1234 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
| 1238 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | 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 | void pci_free_irq_vectors(struct pci_dev *dev); | 1451 | void pci_free_irq_vectors(struct pci_dev *dev); |
| 1455 | int pci_irq_vector(struct pci_dev *dev, unsigned int nr); | 1452 | int pci_irq_vector(struct pci_dev *dev, unsigned int nr); |
| 1456 | const struct cpumask *pci_irq_get_affinity(struct pci_dev *pdev, int vec); | 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 | #else | 1455 | #else |
| 1460 | static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } | 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 | return cpu_possible_mask; | 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 | #endif | 1496 | #endif |
| 1506 | 1497 | ||
| 1507 | /** | 1498 | /** |
| @@ -1544,9 +1535,13 @@ extern bool pcie_ports_native; · 36 unmodified lines | |||
| 1544 | #define pcie_ports_native false | 1535 | #define pcie_ports_native false |
| 1545 | #endif | 1536 | #endif |
| 1546 | 1537 | ||
| 1547 | #define PCIE_LINK_STATE_L0S 1 | 1538 | #define PCIE_LINK_STATE_L0S BIT(0) |
| 1548 | #define PCIE_LINK_STATE_L1 2 | 1539 | #define PCIE_LINK_STATE_L1 BIT(1) |
| 1549 | #define PCIE_LINK_STATE_CLKPM 4 | 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 | #ifdef CONFIG_PCIEASPM | 1546 | #ifdef CONFIG_PCIEASPM |
| 1552 | int pci_disable_link_state(struct pci_dev *pdev, int state); | 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 | static inline void pci_set_master(struct pci_dev *dev) { } | 1681 | static inline void pci_set_master(struct pci_dev *dev) { } |
| 1687 | static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } | 1682 | static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } |
| 1688 | static inline void pci_disable_device(struct pci_dev *dev) { } | 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 | static inline int pci_assign_resource(struct pci_dev *dev, int i) | 1685 | static inline int pci_assign_resource(struct pci_dev *dev, int i) |
| 1690 | { return -EBUSY; } | 1686 | { return -EBUSY; } |
| 1691 | static inline int __pci_register_driver(struct pci_driver *drv, | 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 | NULL); | 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 | /* Include architecture-dependent settings and functions */ | 1775 | /* Include architecture-dependent settings and functions */ |
| 1793 | 1776 | ||
| 1794 | #include <asm/pci.h> | 1777 | #include <asm/pci.h> |
| @@ -2278,6 +2261,7 @@ struct irq_domain; · 483 unmodified lines | |||
| 2278 | struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus); | 2261 | struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus); |
| 2279 | int pci_parse_request_of_pci_ranges(struct device *dev, | 2262 | int pci_parse_request_of_pci_ranges(struct device *dev, |
| 2280 | struct list_head *resources, | 2263 | struct list_head *resources, |
| 2264 | struct list_head *ib_resources, | ||
| 2281 | struct resource **bus_range); | 2265 | struct resource **bus_range); |
| 2282 | 2266 | ||
| 2283 | /* Arch may override this (weak) */ | 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 | #else /* CONFIG_OF */ | 2270 | #else /* CONFIG_OF */ |
| 2287 | static inline struct irq_domain * | 2271 | static inline struct irq_domain * |
| 2288 | pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; } | 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, | 2273 | static inline int |
| 2290 | struct list_head *resources, | 2274 | pci_parse_request_of_pci_ranges(struct device *dev, |
| 2291 | struct resource **bus_range) | 2275 | struct list_head *resources, |
| 2276 | struct list_head *ib_resources, | ||
| 2277 | struct resource **bus_range) | ||
| 2292 | { | 2278 | { |
| 2293 | return -EINVAL; | 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 | void | 2297 | void |
| 2312 | pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *)); | 2298 | pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *)); |
| 2299 | bool pci_pr3_present(struct pci_dev *pdev); | ||
| 2313 | #else | 2300 | #else |
| 2314 | static inline struct irq_domain * | 2301 | static inline struct irq_domain * |
| 2315 | pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) { return NULL; } | 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 | #endif | 2304 | #endif |
| 2317 | 2305 | ||
| 2318 | #ifdef CONFIG_EEH | 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 | #define pci_info_ratelimited(pdev, fmt, arg...) \ | 2388 | #define pci_info_ratelimited(pdev, fmt, arg...) \ |
| 2401 | dev_info_ratelimited(&(pdev)->dev, fmt, ##arg) | 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 | #endif /* LINUX_PCI_H */ | 2399 | #endif /* LINUX_PCI_H */ |
| @@ -3006,6 +3006,7 @@ · 3005 unmodified lines | |||
| 3006 | #define PCI_DEVICE_ID_INTEL_84460GX 0x84ea | 3006 | #define PCI_DEVICE_ID_INTEL_84460GX 0x84ea |
| 3007 | #define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500 | 3007 | #define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500 |
| 3008 | #define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 | 3008 | #define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 |
| 3009 | #define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b | ||
| 3009 | #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 | 3010 | #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 |
| 3010 | 3011 | ||
| 3011 | #define PCI_VENDOR_ID_SCALEMP 0x8686 | 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 | unsigned long __percpu *percpu_count; | 187 | unsigned long __percpu *percpu_count; |
| 188 | 188 | ||
| 189 | rcu_read_lock_sched(); | 189 | rcu_read_lock(); |
| 190 | 190 | ||
| 191 | if (__ref_is_percpu(ref, &percpu_count)) | 191 | if (__ref_is_percpu(ref, &percpu_count)) |
| 192 | this_cpu_add(*percpu_count, nr); | 192 | this_cpu_add(*percpu_count, nr); |
| 193 | else | 193 | else |
| 194 | atomic_long_add(nr, &ref->count); | 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 | unsigned long __percpu *percpu_count; | 223 | unsigned long __percpu *percpu_count; |
| 224 | bool ret; | 224 | bool ret; |
| 225 | 225 | ||
| 226 | rcu_read_lock_sched(); | 226 | rcu_read_lock(); |
| 227 | 227 | ||
| 228 | if (__ref_is_percpu(ref, &percpu_count)) { | 228 | if (__ref_is_percpu(ref, &percpu_count)) { |
| 229 | this_cpu_inc(*percpu_count); | 229 | this_cpu_inc(*percpu_count); |
| @@ -232,7 +232,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref) · 2 unmodified lines | |||
| 232 | ret = atomic_long_inc_not_zero(&ref->count); | 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 | return ret; | 237 | return ret; |
| 238 | } | 238 | } |
| @@ -257,7 +257,7 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) · 18 unmodified lines | |||
| 257 | unsigned long __percpu *percpu_count; | 257 | unsigned long __percpu *percpu_count; |
| 258 | bool ret = false; | 258 | bool ret = false; |
| 259 | 259 | ||
| 260 | rcu_read_lock_sched(); | 260 | rcu_read_lock(); |
| 261 | 261 | ||
| 262 | if (__ref_is_percpu(ref, &percpu_count)) { | 262 | if (__ref_is_percpu(ref, &percpu_count)) { |
| 263 | this_cpu_inc(*percpu_count); | 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 | ret = atomic_long_inc_not_zero(&ref->count); | 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 | return ret; | 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 | unsigned long __percpu *percpu_count; | 286 | unsigned long __percpu *percpu_count; |
| 287 | 287 | ||
| 288 | rcu_read_lock_sched(); | 288 | rcu_read_lock(); |
| 289 | 289 | ||
| 290 | if (__ref_is_percpu(ref, &percpu_count)) | 290 | if (__ref_is_percpu(ref, &percpu_count)) |
| 291 | this_cpu_sub(*percpu_count, nr); | 291 | this_cpu_sub(*percpu_count, nr); |
| 292 | else if (unlikely(atomic_long_sub_and_test(nr, &ref->count))) | 292 | else if (unlikely(atomic_long_sub_and_test(nr, &ref->count))) |
| 293 | ref->release(ref); | 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 | __percpu_up_read(sem); /* Unconditional memory barrier */ | 93 | __percpu_up_read(sem); /* Unconditional memory barrier */ |
| 94 | preempt_enable(); | 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 | extern void percpu_down_write(struct percpu_rw_semaphore *); | 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 | static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem, | 118 | static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem, |
| 119 | bool read, unsigned long ip) | 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 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | 122 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 123 | if (!read) | 123 | if (!read) |
| 124 | atomic_long_set(&sem->rw_sem.owner, RWSEM_OWNER_UNKNOWN); | 124 | atomic_long_set(&sem->rw_sem.owner, RWSEM_OWNER_UNKNOWN); |
| @@ -56,6 +56,7 @@ struct perf_guest_info_callbacks { · 55 unmodified lines | |||
| 56 | #include <linux/perf_regs.h> | 56 | #include <linux/perf_regs.h> |
| 57 | #include <linux/cgroup.h> | 57 | #include <linux/cgroup.h> |
| 58 | #include <linux/refcount.h> | 58 | #include <linux/refcount.h> |
| 59 | #include <linux/security.h> | ||
| 59 | #include <asm/local.h> | 60 | #include <asm/local.h> |
| 60 | 61 | ||
| 61 | struct perf_callchain_entry { | 62 | struct perf_callchain_entry { |
| @@ -248,6 +249,8 @@ struct perf_event; · 186 unmodified lines | |||
| 248 | #define PERF_PMU_CAP_NO_EXCLUDE 0x80 | 249 | #define PERF_PMU_CAP_NO_EXCLUDE 0x80 |
| 249 | #define PERF_PMU_CAP_AUX_OUTPUT 0x100 | 250 | #define PERF_PMU_CAP_AUX_OUTPUT 0x100 |
| 250 | 251 | ||
| 252 | struct perf_output_handle; | ||
| 253 | |||
| 251 | /** | 254 | /** |
| 252 | * struct pmu - generic performance monitoring unit | 255 | * struct pmu - generic performance monitoring unit |
| 253 | */ | 256 | */ |
| @@ -409,6 +412,15 @@ struct pmu { · 155 unmodified lines | |||
| 409 | */ | 412 | */ |
| 410 | size_t task_ctx_size; | 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 | * Set up pmu-private data structures for an AUX area | 426 | * Set up pmu-private data structures for an AUX area |
| @@ -422,6 +434,19 @@ struct pmu { · 7 unmodified lines | |||
| 422 | */ | 434 | */ |
| 423 | void (*free_aux) (void *aux); /* optional */ | 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 | * Validate address range filters: make sure the HW supports the | 451 | * Validate address range filters: make sure the HW supports the |
| 427 | * requested configuration and number of filters; return 0 if the | 452 | * requested configuration and number of filters; return 0 if the |
| @@ -721,6 +746,9 @@ struct perf_event { · 293 unmodified lines | |||
| 721 | struct perf_cgroup *cgrp; /* cgroup event is attach to */ | 746 | struct perf_cgroup *cgrp; /* cgroup event is attach to */ |
| 722 | #endif | 747 | #endif |
| 723 | 748 | ||
| 749 | #ifdef CONFIG_SECURITY | ||
| 750 | void *security; | ||
| 751 | #endif | ||
| 724 | struct list_head sb_list; | 752 | struct list_head sb_list; |
| 725 | #endif /* CONFIG_PERF_EVENTS */ | 753 | #endif /* CONFIG_PERF_EVENTS */ |
| 726 | }; | 754 | }; |
| @@ -960,6 +988,7 @@ struct perf_sample_data { · 233 unmodified lines | |||
| 960 | u32 reserved; | 988 | u32 reserved; |
| 961 | } cpu_entry; | 989 | } cpu_entry; |
| 962 | struct perf_callchain_entry *callchain; | 990 | struct perf_callchain_entry *callchain; |
| 991 | u64 aux_size; | ||
| 963 | 992 | ||
| 964 | /* | 993 | /* |
| 965 | * regs_user may point to task_pt_regs or to regs_user_copy, depending | 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 | int perf_event_max_stack_handler(struct ctl_table *table, int write, | 1270 | int perf_event_max_stack_handler(struct ctl_table *table, int write, |
| 1242 | void __user *buffer, size_t *lenp, loff_t *ppos); | 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 | return sysctl_perf_event_paranoid > -1; | 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 | extern void perf_event_init(void); | 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 | const void *buf, unsigned int len); | 1378 | const void *buf, unsigned int len); |
| 1328 | extern unsigned int perf_output_skip(struct perf_output_handle *handle, | 1379 | extern unsigned int perf_output_skip(struct perf_output_handle *handle, |
| 1329 | unsigned int len); | 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 | extern int perf_swevent_get_recursion_context(void); | 1384 | extern int perf_swevent_get_recursion_context(void); |
| 1331 | extern void perf_swevent_put_recursion_context(int rctx); | 1385 | extern void perf_swevent_put_recursion_context(int rctx); |
| 1332 | extern u64 perf_swevent_set_period(struct perf_event *event); | 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 | extern void perf_event_disable_inatomic(struct perf_event *event); | 1390 | extern void perf_event_disable_inatomic(struct perf_event *event); |
| 1337 | extern void perf_event_task_tick(void); | 1391 | extern void perf_event_task_tick(void); |
| 1338 | extern int perf_event_account_interrupt(struct perf_event *event); | 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 | #else /* !CONFIG_PERF_EVENTS: */ | 1395 | #else /* !CONFIG_PERF_EVENTS: */ |
| 1340 | static inline void * | 1396 | static inline void * |
| 1341 | perf_aux_output_begin(struct perf_output_handle *handle, | 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 | static inline int __perf_event_disable(void *info) { return -1; } | 1471 | static inline int __perf_event_disable(void *info) { return -1; } |
| 1416 | static inline void perf_event_task_tick(void) { } | 1472 | static inline void perf_event_task_tick(void) { } |
| 1417 | static inline int perf_event_release_kernel(struct perf_event *event) { return 0; } | 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 | #endif | 1482 | #endif |
| 1419 | 1483 | ||
| 1420 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) | 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 | struct device; | 204 | struct device; |
| 205 | struct phylink; | 205 | struct phylink; |
| 206 | struct sfp_bus; | ||
| 207 | struct sfp_upstream_ops; | ||
| 206 | struct sk_buff; | 208 | struct sk_buff; |
| 207 | 209 | ||
| 208 | /* | 210 | /* |
| @@ -342,6 +344,8 @@ struct phy_c45_device_ids { · 133 unmodified lines | |||
| 342 | * dev_flags: Device-specific flags used by the PHY driver. | 344 | * dev_flags: Device-specific flags used by the PHY driver. |
| 343 | * irq: IRQ number of the PHY's interrupt (-1 if none) | 345 | * irq: IRQ number of the PHY's interrupt (-1 if none) |
| 344 | * phy_timer: The timer for handling the state machine | 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 | * attached_dev: The attached enet driver's device instance ptr | 349 | * attached_dev: The attached enet driver's device instance ptr |
| 346 | * adjust_link: Callback for the enet controller to respond to | 350 | * adjust_link: Callback for the enet controller to respond to |
| 347 | * changes in the link state. | 351 | * changes in the link state. |
| @@ -432,6 +436,9 @@ struct phy_device { · 84 unmodified lines | |||
| 432 | 436 | ||
| 433 | struct mutex lock; | 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 | struct phylink *phylink; | 442 | struct phylink *phylink; |
| 436 | struct net_device *attached_dev; | 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 | int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum, | 1000 | int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum, |
| 994 | u16 mask, u16 set); | 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 | bool is_c45, | 1004 | bool is_c45, |
| 998 | struct phy_c45_device_ids *c45_ids); | 1005 | struct phy_c45_device_ids *c45_ids); |
| 999 | #if IS_ENABLED(CONFIG_PHYLIB) | 1006 | #if IS_ENABLED(CONFIG_PHYLIB) |
| @@ -1020,6 +1027,10 @@ int phy_suspend(struct phy_device *phydev); · 20 unmodified lines | |||
| 1020 | int phy_resume(struct phy_device *phydev); | 1027 | int phy_resume(struct phy_device *phydev); |
| 1021 | int __phy_resume(struct phy_device *phydev); | 1028 | int __phy_resume(struct phy_device *phydev); |
| 1022 | int phy_loopback(struct phy_device *phydev, bool enable); | 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 | struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, | 1034 | struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, |
| 1024 | phy_interface_t interface); | 1035 | phy_interface_t interface); |
| 1025 | struct phy_device *phy_find_first(struct mii_bus *bus); | 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 | return dev_name(&phydev->mdio.dev); | 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 | void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) | 1089 | void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) |
| 1069 | __printf(2, 3); | 1090 | __printf(2, 3); |
| 1070 | void phy_attached_info(struct phy_device *phydev); | 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 | int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum, | 1127 | int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum, |
| 1107 | u16 regnum, u16 val); | 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 | /* Clause 45 PHY */ | 1134 | /* Clause 45 PHY */ |
| 1110 | int genphy_c45_restart_aneg(struct phy_device *phydev); | 1135 | int genphy_c45_restart_aneg(struct phy_device *phydev); |
| 1111 | int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart); | 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 | void phy_mac_interrupt(struct phy_device *phydev); | 1170 | void phy_mac_interrupt(struct phy_device *phydev); |
| 1146 | void phy_start_machine(struct phy_device *phydev); | 1171 | void phy_start_machine(struct phy_device *phydev); |
| 1147 | void phy_stop_machine(struct phy_device *phydev); | 1172 | void phy_stop_machine(struct phy_device *phydev); |
| 1148 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); | ||
| 1149 | void phy_ethtool_ksettings_get(struct phy_device *phydev, | 1173 | void phy_ethtool_ksettings_get(struct phy_device *phydev, |
| 1150 | struct ethtool_link_ksettings *cmd); | 1174 | struct ethtool_link_ksettings *cmd); |
| 1151 | int phy_ethtool_ksettings_set(struct phy_device *phydev, | 1175 | int phy_ethtool_ksettings_set(struct phy_device *phydev, |
| @@ -38,7 +38,8 @@ enum phy_mode { · 37 unmodified lines | |||
| 38 | PHY_MODE_PCIE, | 38 | PHY_MODE_PCIE, |
| 39 | PHY_MODE_ETHERNET, | 39 | PHY_MODE_ETHERNET, |
| 40 | PHY_MODE_MIPI_DPHY, | 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 | unsigned int port, bool idle); | 18 | unsigned int port, bool idle); |
| 19 | int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl, | 19 | int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl, |
| 20 | unsigned int port, bool enable); | 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 | #endif /* PHY_TEGRA_XUSB_H */ | 24 | #endif /* PHY_TEGRA_XUSB_H */ |
| @@ -14,7 +14,7 @@ struct phy_device; · 13 unmodified lines | |||
| 14 | #define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 11 | 14 | #define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 11 |
| 15 | 15 | ||
| 16 | #define PHY_LINK_LED_TRIGGER_NAME_SIZE (MII_BUS_ID_SIZE + \ | 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 | PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE) | 18 | PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE) |
| 19 | 19 | ||
| 20 | struct phy_led_trigger { | 20 | struct phy_led_trigger { |
| @@ -72,7 +72,7 @@ struct phylink_config { · 71 unmodified lines | |||
| 72 | /** | 72 | /** |
| 73 | * struct phylink_mac_ops - MAC operations structure. | 73 | * struct phylink_mac_ops - MAC operations structure. |
| 74 | * @validate: Validate and update the link configuration. | 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 | * @mac_config: configure the MAC for the selected mode and state. | 76 | * @mac_config: configure the MAC for the selected mode and state. |
| 77 | * @mac_an_restart: restart 802.3z BaseX autonegotiation. | 77 | * @mac_an_restart: restart 802.3z BaseX autonegotiation. |
| 78 | * @mac_link_down: take the link down. | 78 | * @mac_link_down: take the link down. |
| @@ -84,8 +84,8 @@ struct phylink_mac_ops { · 5 unmodified lines | |||
| 84 | void (*validate)(struct phylink_config *config, | 84 | void (*validate)(struct phylink_config *config, |
| 85 | unsigned long *supported, | 85 | unsigned long *supported, |
| 86 | struct phylink_link_state *state); | 86 | struct phylink_link_state *state); |
| 87 | int (*mac_link_state)(struct phylink_config *config, | 87 | void (*mac_pcs_get_state)(struct phylink_config *config, |
| 88 | struct phylink_link_state *state); | 88 | struct phylink_link_state *state); |
| 89 | void (*mac_config)(struct phylink_config *config, unsigned int mode, | 89 | void (*mac_config)(struct phylink_config *config, unsigned int mode, |
| 90 | const struct phylink_link_state *state); | 90 | const struct phylink_link_state *state); |
| 91 | void (*mac_an_restart)(struct phylink_config *config); | 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 | struct phylink_link_state *state); | 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 | * @config: a pointer to a &struct phylink_config. | 131 | * @config: a pointer to a &struct phylink_config. |
| 132 | * @state: a pointer to a &struct phylink_link_state. | 132 | * @state: a pointer to a &struct phylink_link_state. |
| 133 | * | 133 | * |
| 134 | * Read the current link state from the MAC, reporting the current | 134 | * Read the current inband link state from the MAC PCS, reporting the |
| 135 | * speed in @state->speed, duplex mode in @state->duplex, pause mode | 135 | * current speed in @state->speed, duplex mode in @state->duplex, pause |
| 136 | * in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits, | 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 | 137 | * negotiation completion state in @state->an_complete, and link up state |
| 138 | * up state in @state->link. | 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 | void mac_pcs_get_state(struct phylink_config *config, |
| 141 | struct phylink_link_state *state); | 142 | struct phylink_link_state *state); |
| 142 | 143 | ||
| 143 | /** | 144 | /** |
| 144 | * mac_config() - configure the MAC for the selected mode and state | 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 | * 1000base-X or Cisco SGMII mode depending on the @state->interface | 167 | * 1000base-X or Cisco SGMII mode depending on the @state->interface |
| 167 | * mode). In both cases, link state management (whether the link | 168 | * mode). In both cases, link state management (whether the link |
| 168 | * is up or not) is performed by the MAC, and reported via the | 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 | * by calling phylink_mac_change(). | 171 | * by calling phylink_mac_change(). |
| 171 | * | 172 | * |
| 172 | * If in 802.3z mode, the link speed is fixed, dependent on the | 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 | extern void put_pid(struct pid *pid); | 86 | extern void put_pid(struct pid *pid); |
| 87 | extern struct task_struct *pid_task(struct pid *pid, enum pid_type); | 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 | extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type); | 92 | extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type); |
| 89 | 93 | ||
| 90 | extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); | 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 | extern struct pid *find_get_pid(int nr); | 124 | extern struct pid *find_get_pid(int nr); |
| 121 | extern struct pid *find_ge_pid(int nr, struct pid_namespace *); | 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 | extern void free_pid(struct pid *pid); | 129 | extern void free_pid(struct pid *pid); |
| 125 | extern void disable_pid_allocation(struct pid_namespace *ns); | 130 | extern void disable_pid_allocation(struct pid_namespace *ns); |
| 126 | 131 | ||
| @@ -12,6 +12,8 @@ · 11 unmodified lines | |||
| 12 | #include <linux/ns_common.h> | 12 | #include <linux/ns_common.h> |
| 13 | #include <linux/idr.h> | 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 | struct fs_pin; | 18 | struct fs_pin; |
| 17 | 19 | ||
| @@ -30,14 +30,14 @@ struct pipe_buffer { · 29 unmodified lines | |||
| 30 | * struct pipe_inode_info - a linux kernel pipe | 30 | * struct pipe_inode_info - a linux kernel pipe |
| 31 | * @mutex: mutex protecting the whole thing | 31 | * @mutex: mutex protecting the whole thing |
| 32 | * @wait: reader/writer wait point in case of empty/full pipe | 32 | * @wait: reader/writer wait point in case of empty/full pipe |
| 33 | * @nrbufs: the number of non-empty pipe buffers in this pipe | 33 | * @head: The point of buffer production |
| 34 | * @buffers: total number of buffers (should be a power of 2) | 34 | * @tail: The point of buffer consumption |
| 35 | * @curbuf: the current pipe buffer entry | 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 | * @tmp_page: cached released page | 37 | * @tmp_page: cached released page |
| 37 | * @readers: number of current readers of this pipe | 38 | * @readers: number of current readers of this pipe |
| 38 | * @writers: number of current writers of this pipe | 39 | * @writers: number of current writers of this pipe |
| 39 | * @files: number of struct file referring this pipe (protected by ->i_lock) | 40 | * @files: number of struct file referring this pipe (protected by ->i_lock) |
| 40 | * @waiting_writers: number of writers blocked waiting for room | ||
| 41 | * @r_counter: reader counter | 41 | * @r_counter: reader counter |
| 42 | * @w_counter: writer counter | 42 | * @w_counter: writer counter |
| 43 | * @fasync_readers: reader side fasync | 43 | * @fasync_readers: reader side fasync |
| @@ -48,11 +48,13 @@ struct pipe_buffer { · 4 unmodified lines | |||
| 48 | struct pipe_inode_info { | 48 | struct pipe_inode_info { |
| 49 | struct mutex mutex; | 49 | struct mutex mutex; |
| 50 | wait_queue_head_t wait; | 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 | unsigned int readers; | 55 | unsigned int readers; |
| 53 | unsigned int writers; | 56 | unsigned int writers; |
| 54 | unsigned int files; | 57 | unsigned int files; |
| 55 | unsigned int waiting_writers; | ||
| 56 | unsigned int r_counter; | 58 | unsigned int r_counter; |
| 57 | unsigned int w_counter; | 59 | unsigned int w_counter; |
| 58 | struct page *tmp_page; | 60 | struct page *tmp_page; |
| @@ -104,6 +106,58 @@ struct pipe_buf_operations { · 45 unmodified lines | |||
| 104 | bool (*get)(struct pipe_inode_info *, struct pipe_buffer *); | 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 | * pipe_buf_get - get a reference to a pipe_buffer | 162 | * pipe_buf_get - get a reference to a pipe_buffer |
| 109 | * @pipe: the pipe that the buffer belongs to | 163 | * @pipe: the pipe that the buffer belongs to |
| @@ -556,6 +556,9 @@ enum host_event_code { · 555 unmodified lines | |||
| 556 | /* Keyboard recovery combo with hardware reinitialization */ | 556 | /* Keyboard recovery combo with hardware reinitialization */ |
| 557 | EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT = 30, | 557 | EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT = 30, |
| 558 | 558 | ||
| 559 | /* WoV */ | ||
| 560 | EC_HOST_EVENT_WOV = 31, | ||
| 561 | |||
| 559 | /* | 562 | /* |
| 560 | * The high bit of the event mask is not used as a host event code. If | 563 | * The high bit of the event mask is not used as a host event code. If |
| 561 | * it reads back as set, then the entire event mask should be | 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 | * MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. | 1280 | * MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. |
| 1278 | */ | 1281 | */ |
| 1279 | EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, | 1282 | EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, |
| 1280 | /* EC supports audio codec. */ | ||
| 1281 | EC_FEATURE_AUDIO_CODEC = 38, | ||
| 1282 | /* The MCU is a System Companion Processor (SCP). */ | 1283 | /* The MCU is a System Companion Processor (SCP). */ |
| 1283 | EC_FEATURE_SCP = 39, | 1284 | EC_FEATURE_SCP = 39, |
| 1284 | /* The MCU is an Integrated Sensor Hub */ | 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 | 4475 | enum ec_codec_subcmd { |
| 4474 | #define EC_WOV_I2S_SAMPLE_RATE 48000 | 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 { | 4482 | enum ec_codec_cap { |
| 4477 | EC_CODEC_SET_SAMPLE_DEPTH = 0x0, | 4483 | EC_CODEC_CAP_WOV_AUDIO_SHM = 0, |
| 4478 | EC_CODEC_SET_GAIN = 0x1, | 4484 | EC_CODEC_CAP_WOV_LANG_SHM = 1, |
| 4479 | EC_CODEC_GET_GAIN = 0x2, | 4485 | EC_CODEC_CAP_LAST = 32, |
| 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, | ||
| 4485 | }; | 4486 | }; |
| 4486 | 4487 | ||
| 4487 | enum ec_sample_depth_value { | 4488 | enum ec_codec_shm_id { |
| 4488 | EC_CODEC_SAMPLE_DEPTH_16 = 0, | 4489 | EC_CODEC_SHM_ID_WOV_AUDIO = 0x0, |
| 4489 | EC_CODEC_SAMPLE_DEPTH_24 = 1, | 4490 | EC_CODEC_SHM_ID_WOV_LANG = 0x1, |
| 4491 | EC_CODEC_SHM_ID_LAST, | ||
| 4490 | }; | 4492 | }; |
| 4491 | 4493 | ||
| 4492 | enum ec_i2s_config { | 4494 | enum ec_codec_shm_type { |
| 4493 | EC_DAI_FMT_I2S = 0, | 4495 | EC_CODEC_SHM_TYPE_EC_RAM = 0x0, |
| 4494 | EC_DAI_FMT_RIGHT_J = 1, | 4496 | EC_CODEC_SHM_TYPE_SYSTEM_RAM = 0x1, |
| 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, | ||
| 4499 | }; | 4497 | }; |
| 4500 | 4498 | ||
| 4501 | /* | 4499 | struct __ec_align1 ec_param_ec_codec_get_shm_addr { |
| 4502 | * For subcommand EC_CODEC_GET_GAIN. | 4500 | uint8_t shm_id; |
| 4503 | */ | 4501 | uint8_t reserved[3]; |
| 4504 | struct __ec_align1 ec_codec_i2s_gain { | 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 | uint8_t left; | 4623 | uint8_t left; |
| 4506 | uint8_t right; | 4624 | uint8_t right; |
| 4625 | uint8_t reserved[2]; | ||
| 4507 | }; | 4626 | }; |
| 4508 | 4627 | ||
| 4509 | struct __ec_todo_unpacked ec_param_codec_i2s_tdm { | 4628 | struct __ec_align1 ec_param_ec_codec_i2s_rx_set_daifmt { |
| 4510 | int16_t ch0_delay; /* 0 to 496 */ | 4629 | uint8_t daifmt; |
| 4511 | int16_t ch1_delay; /* -1 to 496 */ | 4630 | uint8_t reserved[3]; |
| 4512 | uint8_t adjacent_to_ch0; | ||
| 4513 | uint8_t adjacent_to_ch1; | ||
| 4514 | }; | 4631 | }; |
| 4515 | 4632 | ||
| 4516 | struct __ec_todo_packed ec_param_codec_i2s { | 4633 | struct __ec_align4 ec_param_ec_codec_i2s_rx_set_bclk { |
| 4517 | /* enum ec_codec_i2s_subcmd */ | 4634 | uint32_t bclk; |
| 4518 | uint8_t cmd; | 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 | union { | 4641 | union { |
| 4520 | /* | 4642 | struct ec_param_ec_codec_i2s_rx_set_sample_depth |
| 4521 | * EC_CODEC_SET_SAMPLE_DEPTH | 4643 | set_sample_depth_param; |
| 4522 | * Value should be one of ec_sample_depth_value. | 4644 | struct ec_param_ec_codec_i2s_rx_set_daifmt |
| 4523 | */ | 4645 | set_daifmt_param; |
| 4524 | uint8_t depth; | 4646 | struct ec_param_ec_codec_i2s_rx_set_bclk |
| 4647 | set_bclk_param; | ||
| 4648 | }; | ||
| 4649 | }; | ||
| 4525 | 4650 | ||
| 4526 | /* | 4651 | /*****************************************************************************/ |
| 4527 | * EC_CODEC_SET_GAIN | 4652 | /* Commands for WoV on audio codec. */ |
| 4528 | * Value should be 0~43 for both channels. | 4653 | |
| 4529 | */ | 4654 | #define EC_CMD_EC_CODEC_WOV 0x00BF |
| 4530 | struct ec_codec_i2s_gain gain; | 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 | /* | 4667 | /* |
| 4533 | * EC_CODEC_I2S_ENABLE | 4668 | * @hash is SHA256 of the whole language model. |
| 4534 | * 1 to enable, 0 to disable. | 4669 | * @total_len indicates the length of whole language model. |
| 4535 | */ | 4670 | * @offset is the cursor from the beginning of the model. |
| 4536 | uint8_t i2s_enable; | 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 | /* | 4682 | struct __ec_align4 ec_param_ec_codec_wov_set_lang_shm { |
| 4539 | * EC_CODEC_I2S_SET_CONFIG | 4683 | uint8_t hash[32]; |
| 4540 | * Value should be one of ec_i2s_config. | 4684 | uint32_t total_len; |
| 4541 | */ | 4685 | }; |
| 4542 | uint8_t i2s_config; | ||
| 4543 | 4686 | ||
| 4544 | /* | 4687 | struct __ec_align4 ec_param_ec_codec_wov { |
| 4545 | * EC_CODEC_I2S_SET_TDM_CONFIG | 4688 | uint8_t cmd; /* enum ec_codec_wov_subcmd */ |
| 4546 | * Value should be one of ec_i2s_config. | 4689 | uint8_t reserved[3]; |
| 4547 | */ | ||
| 4548 | struct ec_param_codec_i2s_tdm tdm_param; | ||
| 4549 | 4690 | ||
| 4550 | /* | 4691 | union { |
| 4551 | * EC_CODEC_I2S_SET_BCLK | 4692 | struct ec_param_ec_codec_wov_set_lang |
| 4552 | */ | 4693 | set_lang_param; |
| 4553 | uint32_t bclk; | 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 | /* System commands */ | 4714 | /* System commands */ |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/mutex.h> | 12 | #include <linux/mutex.h> |
| 13 | #include <linux/notifier.h> | 13 | #include <linux/notifier.h> |
| 14 | 14 | ||
| 15 | #include <linux/mfd/cros_ec.h> | ||
| 15 | #include <linux/platform_data/cros_ec_commands.h> | 16 | #include <linux/platform_data/cros_ec_commands.h> |
| 16 | 17 | ||
| 17 | #define CROS_EC_DEV_NAME "cros_ec" | 18 | #define CROS_EC_DEV_NAME "cros_ec" |
| @@ -115,12 +116,16 @@ struct cros_ec_command { · 97 unmodified lines | |||
| 115 | * code. | 116 | * code. |
| 116 | * @pkt_xfer: Send packet to EC and get response. | 117 | * @pkt_xfer: Send packet to EC and get response. |
| 117 | * @lock: One transaction at a time. | 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 | * @host_sleep_v1: True if this EC supports the sleep v1 command. | 122 | * @host_sleep_v1: True if this EC supports the sleep v1 command. |
| 120 | * @event_notifier: Interrupt event notifier for transport devices. | 123 | * @event_notifier: Interrupt event notifier for transport devices. |
| 121 | * @event_data: Raw payload transferred with the MKBP event. | 124 | * @event_data: Raw payload transferred with the MKBP event. |
| 122 | * @event_size: Size in bytes of the event data. | 125 | * @event_size: Size in bytes of the event data. |
| 123 | * @host_event_wake_mask: Mask of host events that cause wake from suspend. | 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 | * @ec: The platform_device used by the mfd driver to interface with the | 129 | * @ec: The platform_device used by the mfd driver to interface with the |
| 125 | * main EC. | 130 | * main EC. |
| 126 | * @pd: The platform_device used by the mfd driver to interface with the | 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 | int (*pkt_xfer)(struct cros_ec_device *ec, | 158 | int (*pkt_xfer)(struct cros_ec_device *ec, |
| 154 | struct cros_ec_command *msg); | 159 | struct cros_ec_command *msg); |
| 155 | struct mutex lock; | 160 | struct mutex lock; |
| 156 | bool mkbp_event_supported; | 161 | u8 mkbp_event_supported; |
| 157 | bool host_sleep_v1; | 162 | bool host_sleep_v1; |
| 158 | struct blocking_notifier_head event_notifier; | 163 | struct blocking_notifier_head event_notifier; |
| 159 | 164 | ||
| @@ -161,20 +166,13 @@ struct cros_ec_device { · 1 unmodified line | |||
| 161 | int event_size; | 166 | int event_size; |
| 162 | u32 host_event_wake_mask; | 167 | u32 host_event_wake_mask; |
| 163 | u32 last_resume_result; | 168 | u32 last_resume_result; |
| 169 | ktime_t last_event_time; | ||
| 164 | 170 | ||
| 165 | /* The platform devices used by the mfd driver */ | 171 | /* The platform devices used by the mfd driver */ |
| 166 | struct platform_device *ec; | 172 | struct platform_device *ec; |
| 167 | struct platform_device *pd; | 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 | * struct cros_ec_platform - ChromeOS EC platform information. | 177 | * struct cros_ec_platform - ChromeOS EC platform information. |
| 180 | * @ec_name: Name of EC device (e.g. 'cros-ec', 'cros-pd', ...) | 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 | u16 cmd_offset; | 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 | int cros_ec_suspend(struct cros_ec_device *ec_dev); | 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 | int cros_ec_resume(struct cros_ec_device *ec_dev); | 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 | int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, | 192 | int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, |
| 222 | struct cros_ec_command *msg); | 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 | int cros_ec_check_result(struct cros_ec_device *ec_dev, | 195 | int cros_ec_check_result(struct cros_ec_device *ec_dev, |
| 235 | struct cros_ec_command *msg); | 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 | int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev, | 198 | int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev, |
| 248 | struct cros_ec_command *msg); | 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 | int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev, | 201 | int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev, |
| 263 | struct cros_ec_command *msg); | 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 | int cros_ec_register(struct cros_ec_device *ec_dev); | 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 | int cros_ec_unregister(struct cros_ec_device *ec_dev); | 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 | int cros_ec_query_all(struct cros_ec_device *ec_dev); | 208 | int cros_ec_query_all(struct cros_ec_device *ec_dev); |
| 294 | 209 | ||
| 295 | /** | 210 | int cros_ec_get_next_event(struct cros_ec_device *ec_dev, |
| 296 | * cros_ec_get_next_event() - Fetch next event from the ChromeOS EC. | 211 | bool *wake_event, |
| 297 | * @ec_dev: Device to fetch event from. | 212 | bool *has_more_events); |
| 298 | * @wake_event: Pointer to a bool set to true upon return if the event might be | 213 | |
| 299 | * treated as a wake event. Ignored if null. | 214 | u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev); |
| 300 | * | 215 | |
| 301 | * Return: negative error code on errors; 0 for no data; or else number of | 216 | int cros_ec_check_features(struct cros_ec_dev *ec, int feature); |
| 302 | * bytes received (i.e., an event was retrieved successfully). Event types are | 217 | |
| 303 | * written out to @ec_dev->event_data.event_type on success. | 218 | int cros_ec_get_sensor_count(struct cros_ec_dev *ec); |
| 304 | */ | 219 | |
| 305 | int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event); | 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. | 223 | * cros_ec_get_time_ns() - Return time in ns. |
| 309 | * @ec_dev: Device to fetch event from. | ||
| 310 | * | 224 | * |
| 311 | * When MKBP is supported, when the EC raises an interrupt, we collect the | 225 | * This is the function used to record the time for last_event_time in struct |
| 312 | * events raised and call the functions in the ec notifier. This function | 226 | * cros_ec_device during the hard irq. |
| 313 | * is a helper to know which events are raised. | ||
| 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 | #endif /* __LINUX_CROS_EC_PROTO_H */ | 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 | struct gpio_backlight_platform_data { | 10 | struct gpio_backlight_platform_data { |
| 11 | struct device *fbdev; | 11 | struct device *fbdev; |
| 12 | int gpio; | ||
| 13 | int def_value; | ||
| 14 | const char *name; | ||
| 15 | }; | 12 | }; |
| 16 | 13 | ||
| 17 | #endif | 14 | #endif |
| @@ -67,9 +67,6 @@ struct omap_hsmmc_platform_data { · 66 unmodified lines | |||
| 67 | /* string specifying a particular variant of hardware */ | 67 | /* string specifying a particular variant of hardware */ |
| 68 | char *version; | 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 | const char *name; | 70 | const char *name; |
| 74 | u32 ocr_mask; | 71 | u32 ocr_mask; |
| 75 | }; | 72 | }; |
| @@ -55,11 +55,7 @@ · 54 unmodified lines | |||
| 55 | */ | 55 | */ |
| 56 | #define I2C_ISR_INIT 0x7FF /* status register init */ | 56 | #define I2C_ISR_INIT 0x7FF /* status register init */ |
| 57 | 57 | ||
| 58 | struct i2c_slave_client; | ||
| 59 | |||
| 60 | struct i2c_pxa_platform_data { | 58 | struct i2c_pxa_platform_data { |
| 61 | unsigned int slave_addr; | ||
| 62 | struct i2c_slave_client *slave; | ||
| 63 | unsigned int class; | 59 | unsigned int class; |
| 64 | unsigned int use_pio :1; | 60 | unsigned int use_pio :1; |
| 65 | unsigned int fast_mode :1; | 61 | unsigned int fast_mode :1; |
| @@ -13,6 +13,7 @@ enum intel_spi_type { · 12 unmodified lines | |||
| 13 | INTEL_SPI_BYT = 1, | 13 | INTEL_SPI_BYT = 1, |
| 14 | INTEL_SPI_LPT, | 14 | INTEL_SPI_LPT, |
| 15 | INTEL_SPI_BXT, | 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 | /* Board specific platform_data */ | 12 | /* Board specific platform_data */ |
| 13 | struct mtk_chip_config { | 13 | struct mtk_chip_config { |
| 14 | u32 cs_pol; | ||
| 15 | u32 sample_sel; | 14 | u32 sample_sel; |
| 16 | }; | 15 | }; |
| 17 | #endif | 16 | #endif |
| @@ -18,12 +18,14 @@ · 17 unmodified lines | |||
| 18 | * @open_drain: set the interrupt line to be open drain if possible. | 18 | * @open_drain: set the interrupt line to be open drain if possible. |
| 19 | * @spi_3wire: enable spi-3wire mode. | 19 | * @spi_3wire: enable spi-3wire mode. |
| 20 | * @pullups: enable/disable i2c controller pullup resistors. | 20 | * @pullups: enable/disable i2c controller pullup resistors. |
| 21 | * @wakeup_source: enable/disable device as wakeup generator. | ||
| 21 | */ | 22 | */ |
| 22 | struct st_sensors_platform_data { | 23 | struct st_sensors_platform_data { |
| 23 | u8 drdy_int_pin; | 24 | u8 drdy_int_pin; |
| 24 | bool open_drain; | 25 | bool open_drain; |
| 25 | bool spi_3wire; | 26 | bool spi_3wire; |
| 26 | bool pullups; | 27 | bool pullups; |
| 28 | bool wakeup_source; | ||
| 27 | }; | 29 | }; |
| 28 | 30 | ||
| 29 | #endif /* ST_SENSORS_PDATA_H */ | 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 | s8 emufree_shift; | 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 | #define SYSC_MODULE_QUIRK_SGX BIT(18) | 54 | #define SYSC_MODULE_QUIRK_SGX BIT(18) |
| 53 | #define SYSC_MODULE_QUIRK_HDQ1W BIT(17) | 55 | #define SYSC_MODULE_QUIRK_HDQ1W BIT(17) |
| 54 | #define SYSC_MODULE_QUIRK_I2C BIT(16) | 56 | #define SYSC_MODULE_QUIRK_I2C BIT(16) |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | * @data_size: Size of the data buffer used for EC communication. | 29 | * @data_size: Size of the data buffer used for EC communication. |
| 30 | * @debugfs_pdev: The child platform_device used by the debugfs sub-driver. | 30 | * @debugfs_pdev: The child platform_device used by the debugfs sub-driver. |
| 31 | * @rtc_pdev: The child platform_device used by the RTC sub-driver. | 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 | * @telem_pdev: The child platform_device used by the telemetry sub-driver. | 33 | * @telem_pdev: The child platform_device used by the telemetry sub-driver. |
| 33 | */ | 34 | */ |
| 34 | struct wilco_ec_device { | 35 | struct wilco_ec_device { |
| @@ -41,6 +42,7 @@ struct wilco_ec_device { · 6 unmodified lines | |||
| 41 | size_t data_size; | 42 | size_t data_size; |
| 42 | struct platform_device *debugfs_pdev; | 43 | struct platform_device *debugfs_pdev; |
| 43 | struct platform_device *rtc_pdev; | 44 | struct platform_device *rtc_pdev; |
| 45 | struct platform_device *charger_pdev; | ||
| 44 | struct platform_device *telem_pdev; | 46 | struct platform_device *telem_pdev; |
| 45 | }; | 47 | }; |
| 46 | 48 | ||
| @@ -120,6 +122,19 @@ struct wilco_ec_message { · 73 unmodified lines | |||
| 120 | */ | 122 | */ |
| 121 | int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg); | 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 | * A Property is typically a data item that is stored to NVRAM | 139 | * A Property is typically a data item that is stored to NVRAM |
| 125 | * by the EC. Each of these data items has an index associated | 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 | extern void __iomem * | 57 | extern void __iomem * |
| 58 | devm_platform_ioremap_resource(struct platform_device *pdev, | 58 | devm_platform_ioremap_resource(struct platform_device *pdev, |
| 59 | unsigned int index); | 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 | extern int platform_get_irq(struct platform_device *, unsigned int); | 66 | extern int platform_get_irq(struct platform_device *, unsigned int); |
| 61 | extern int platform_get_irq_optional(struct platform_device *, unsigned int); | 67 | extern int platform_get_irq_optional(struct platform_device *, unsigned int); |
| 62 | extern int platform_irq_count(struct platform_device *); | 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 | #define platform_register_drivers(drivers, count) \ | 300 | #define platform_register_drivers(drivers, count) \ |
| 295 | __platform_register_drivers(drivers, count, THIS_MODULE) | 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 | #ifdef CONFIG_SUSPEND | 303 | #ifdef CONFIG_SUSPEND |
| 350 | extern int platform_pm_suspend(struct device *dev); | 304 | extern int platform_pm_suspend(struct device *dev); |
| 351 | extern int platform_pm_resume(struct device *dev); | 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 | #define USE_PLATFORM_PM_SLEEP_OPS | 334 | #define USE_PLATFORM_PM_SLEEP_OPS |
| 381 | #endif | 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 | #endif /* _PLATFORM_DEVICE_H_ */ | 349 | #endif /* _PLATFORM_DEVICE_H_ */ |
| @@ -637,6 +637,7 @@ extern void dev_pm_put_subsys_data(struct device *dev); · 636 unmodified lines | |||
| 637 | * struct dev_pm_domain - power management domain representation. | 637 | * struct dev_pm_domain - power management domain representation. |
| 638 | * | 638 | * |
| 639 | * @ops: Power management operations associated with this domain. | 639 | * @ops: Power management operations associated with this domain. |
| 640 | * @start: Called when a user needs to start the device via the domain. | ||
| 640 | * @detach: Called when removing a device from the domain. | 641 | * @detach: Called when removing a device from the domain. |
| 641 | * @activate: Called before executing probe routines for bus types and drivers. | 642 | * @activate: Called before executing probe routines for bus types and drivers. |
| 642 | * @sync: Called after successful driver probe. | 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 | struct dev_pm_domain { | 650 | struct dev_pm_domain { |
| 650 | struct dev_pm_ops ops; | 651 | struct dev_pm_ops ops; |
| 652 | int (*start)(struct device *dev); | ||
| 651 | void (*detach)(struct device *dev, bool power_off); | 653 | void (*detach)(struct device *dev, bool power_off); |
| 652 | int (*activate)(struct device *dev); | 654 | int (*activate)(struct device *dev); |
| 653 | void (*sync)(struct device *dev); | 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 | struct device *dev_pm_domain_attach_by_name(struct device *dev, | 366 | struct device *dev_pm_domain_attach_by_name(struct device *dev, |
| 367 | const char *name); | 367 | const char *name); |
| 368 | void dev_pm_domain_detach(struct device *dev, bool power_off); | 368 | void dev_pm_domain_detach(struct device *dev, bool power_off); |
| 369 | int dev_pm_domain_start(struct device *dev); | ||
| 369 | void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); | 370 | void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); |
| 370 | #else | 371 | #else |
| 371 | static inline int dev_pm_domain_attach(struct device *dev, bool power_on) | 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 | return NULL; | 384 | return NULL; |
| 384 | } | 385 | } |
| 385 | static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {} | 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 | static inline void dev_pm_domain_set(struct device *dev, | 391 | static inline void dev_pm_domain_set(struct device *dev, |
| 387 | struct dev_pm_domain *pd) {} | 392 | struct dev_pm_domain *pd) {} |
| 388 | #endif | 393 | #endif |
| @@ -22,6 +22,7 @@ struct opp_table; · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | enum dev_pm_opp_event { | 23 | enum dev_pm_opp_event { |
| 24 | OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, | 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 | void dev_pm_opp_remove(struct device *dev, unsigned long freq); | 114 | void dev_pm_opp_remove(struct device *dev, unsigned long freq); |
| 114 | void dev_pm_opp_remove_all_dynamic(struct device *dev); | 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 | int dev_pm_opp_enable(struct device *dev, unsigned long freq); | 121 | int dev_pm_opp_enable(struct device *dev, unsigned long freq); |
| 117 | 122 | ||
| 118 | int dev_pm_opp_disable(struct device *dev, unsigned long freq); | 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 | static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) | 258 | static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) |
| 246 | { | 259 | { |
| 247 | return 0; | 260 | return 0; |
| @@ -34,6 +34,8 @@ enum pm_qos_flags_status { · 33 unmodified lines | |||
| 34 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY | 34 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY |
| 35 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS | 35 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS |
| 36 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 | 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 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) | 39 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) |
| 38 | 40 | ||
| 39 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) | 41 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) |
| @@ -49,21 +51,6 @@ struct pm_qos_flags_request { · 9 unmodified lines | |||
| 49 | s32 flags; /* Do not change to 64 bit */ | 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 | enum pm_qos_type { | 54 | enum pm_qos_type { |
| 68 | PM_QOS_UNITIALIZED, | 55 | PM_QOS_UNITIALIZED, |
| 69 | PM_QOS_MAX, /* return the largest value */ | 56 | PM_QOS_MAX, /* return the largest value */ |
| @@ -90,9 +77,51 @@ struct pm_qos_flags { · 20 unmodified lines | |||
| 90 | s32 effective_flags; /* Do not change to 64 bit */ | 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 | struct dev_pm_qos { | 121 | struct dev_pm_qos { |
| 94 | struct pm_qos_constraints resume_latency; | 122 | struct pm_qos_constraints resume_latency; |
| 95 | struct pm_qos_constraints latency_tolerance; | 123 | struct pm_qos_constraints latency_tolerance; |
| 124 | struct freq_constraints freq; | ||
| 96 | struct pm_qos_flags flags; | 125 | struct pm_qos_flags flags; |
| 97 | struct dev_pm_qos_request *resume_latency_req; | 126 | struct dev_pm_qos_request *resume_latency_req; |
| 98 | struct dev_pm_qos_request *latency_tolerance_req; | 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 | switch (type) { | 220 | switch (type) { |
| 192 | case DEV_PM_QOS_RESUME_LATENCY: | 221 | case DEV_PM_QOS_RESUME_LATENCY: |
| 193 | return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; | 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 | default: | 227 | default: |
| 195 | WARN_ON(1); | 228 | WARN_ON(1); |
| 196 | return 0; | 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 | #endif | 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 | static inline int freq_qos_request_active(struct freq_qos_request *req) | 291 | static inline int freq_qos_request_active(struct freq_qos_request *req) |
| 280 | { | 292 | { |
| 281 | return !IS_ERR_OR_NULL(req->qos); | 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 | enum freq_qos_req_type type, s32 value); | 303 | enum freq_qos_req_type type, s32 value); |
| 292 | int freq_qos_update_request(struct freq_qos_request *req, s32 new_value); | 304 | int freq_qos_update_request(struct freq_qos_request *req, s32 new_value); |
| 293 | int freq_qos_remove_request(struct freq_qos_request *req); | 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 | int freq_qos_add_notifier(struct freq_constraints *qos, | 309 | int freq_qos_add_notifier(struct freq_constraints *qos, |
| 296 | enum freq_qos_req_type type, | 310 | enum freq_qos_req_type type, |
| @@ -63,6 +63,11 @@ struct wakeup_source { · 62 unmodified lines | |||
| 63 | bool autosleep_enabled:1; | 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 | #ifdef CONFIG_PM_SLEEP | 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 | extern struct wakeup_source *wakeup_source_register(struct device *dev, | 97 | extern struct wakeup_source *wakeup_source_register(struct device *dev, |
| 93 | const char *name); | 98 | const char *name); |
| 94 | extern void wakeup_source_unregister(struct wakeup_source *ws); | 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 | extern int device_wakeup_enable(struct device *dev); | 104 | extern int device_wakeup_enable(struct device *dev); |
| 96 | extern int device_wakeup_disable(struct device *dev); | 105 | extern int device_wakeup_disable(struct device *dev); |
| 97 | extern void device_set_wakeup_capable(struct device *dev, bool capable); | 106 | extern void device_set_wakeup_capable(struct device *dev, bool capable); |
| @@ -293,6 +293,9 @@ struct omap_sr_data { · 292 unmodified lines | |||
| 293 | struct voltagedomain *voltdm; | 293 | struct voltagedomain *voltdm; |
| 294 | }; | 294 | }; |
| 295 | 295 | ||
| 296 | |||
| 297 | extern struct omap_sr_data omap_sr_pdata[OMAP_SR_NR]; | ||
| 298 | |||
| 296 | #ifdef CONFIG_POWER_AVS_OMAP | 299 | #ifdef CONFIG_POWER_AVS_OMAP |
| 297 | 300 | ||
| 298 | /* Smartreflex module enable/disable interface */ | 301 | /* Smartreflex module enable/disable interface */ |
| @@ -302,9 +302,8 @@ extern int kptr_restrict; · 301 unmodified lines | |||
| 302 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) | 302 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
| 303 | #define pr_err(fmt, ...) \ | 303 | #define pr_err(fmt, ...) \ |
| 304 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | 304 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
| 305 | #define pr_warning(fmt, ...) \ | 305 | #define pr_warn(fmt, ...) \ |
| 306 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | 306 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
| 307 | #define pr_warn pr_warning | ||
| 308 | #define pr_notice(fmt, ...) \ | 307 | #define pr_notice(fmt, ...) \ |
| 309 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) | 308 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
| 310 | #define pr_info(fmt, ...) \ | 309 | #define pr_info(fmt, ...) \ |
| @@ -58,8 +58,8 @@ extern int remove_proc_subtree(const char *, struct proc_dir_entry *); · 57 unmodified lines | |||
| 58 | struct proc_dir_entry *proc_create_net_data(const char *name, umode_t mode, | 58 | struct proc_dir_entry *proc_create_net_data(const char *name, umode_t mode, |
| 59 | struct proc_dir_entry *parent, const struct seq_operations *ops, | 59 | struct proc_dir_entry *parent, const struct seq_operations *ops, |
| 60 | unsigned int state_size, void *data); | 60 | unsigned int state_size, void *data); |
| 61 | #define proc_create_net(name, mode, parent, state_size, ops) \ | 61 | #define proc_create_net(name, mode, parent, ops, state_size) \ |
| 62 | proc_create_net_data(name, mode, parent, state_size, ops, NULL) | 62 | proc_create_net_data(name, mode, parent, ops, state_size, NULL) |
| 63 | struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode, | 63 | struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode, |
| 64 | struct proc_dir_entry *parent, | 64 | struct proc_dir_entry *parent, |
| 65 | int (*show)(struct seq_file *, void *), void *data); | 65 | int (*show)(struct seq_file *, void *), void *data); |
| @@ -22,7 +22,6 @@ enum dev_prop_type { · 21 unmodified lines | |||
| 22 | DEV_PROP_U32, | 22 | DEV_PROP_U32, |
| 23 | DEV_PROP_U64, | 23 | DEV_PROP_U64, |
| 24 | DEV_PROP_STRING, | 24 | DEV_PROP_STRING, |
| 25 | DEV_PROP_MAX, | ||
| 26 | }; | 25 | }; |
| 27 | 26 | ||
| 28 | enum dev_dma_attr { | 27 | enum dev_dma_attr { |
| @@ -80,9 +79,14 @@ struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode, · 51 unmodified lines | |||
| 80 | const char *name, | 79 | const char *name, |
| 81 | unsigned int index); | 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 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); | 84 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); |
| 84 | struct fwnode_handle *fwnode_get_next_parent( | 85 | struct fwnode_handle *fwnode_get_next_parent( |
| 85 | struct fwnode_handle *fwnode); | 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 | struct fwnode_handle *fwnode_get_next_child_node( | 90 | struct fwnode_handle *fwnode_get_next_child_node( |
| 87 | const struct fwnode_handle *fwnode, struct fwnode_handle *child); | 91 | const struct fwnode_handle *fwnode, struct fwnode_handle *child); |
| 88 | struct fwnode_handle *fwnode_get_next_available_child_node( | 92 | struct fwnode_handle *fwnode_get_next_available_child_node( |
| @@ -234,13 +238,7 @@ struct property_entry { · 145 unmodified lines | |||
| 234 | bool is_array; | 238 | bool is_array; |
| 235 | enum dev_prop_type type; | 239 | enum dev_prop_type type; |
| 236 | union { | 240 | union { |
| 237 | union { | 241 | const void *pointer; |
| 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; | ||
| 244 | union { | 242 | union { |
| 245 | u8 u8_data; | 243 | u8 u8_data; |
| 246 | u16 u16_data; | 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 | * crafted to avoid gcc-4.4.4's problems with initialization of anon unions | 254 | * crafted to avoid gcc-4.4.4's problems with initialization of anon unions |
| 257 | * and structs. | 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 | (struct property_entry) { \ | 262 | (struct property_entry) { \ |
| 262 | .name = _name_, \ | 263 | .name = _name_, \ |
| 263 | .length = ARRAY_SIZE(_val_) * sizeof(_type_), \ | 264 | .length = (_len_) * __PROPERTY_ENTRY_ELEMENT_SIZE(_elem_), \ |
| 264 | .is_array = true, \ | 265 | .is_array = true, \ |
| 265 | .type = DEV_PROP_##_Type_, \ | 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 | #define PROPERTY_ENTRY_U8_ARRAY_LEN(_name_, _val_, _len_) \ |
| 270 | PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u8, U8, _val_) | 271 | __PROPERTY_ENTRY_ARRAY_LEN(_name_, u8_data, U8, _val_, _len_) |
| 271 | #define PROPERTY_ENTRY_U16_ARRAY(_name_, _val_) \ | 272 | #define PROPERTY_ENTRY_U16_ARRAY_LEN(_name_, _val_, _len_) \ |
| 272 | PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u16, U16, _val_) | 273 | __PROPERTY_ENTRY_ARRAY_LEN(_name_, u16_data, U16, _val_, _len_) |
| 273 | #define PROPERTY_ENTRY_U32_ARRAY(_name_, _val_) \ | 274 | #define PROPERTY_ENTRY_U32_ARRAY_LEN(_name_, _val_, _len_) \ |
| 274 | PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u32, U32, _val_) | 275 | __PROPERTY_ENTRY_ARRAY_LEN(_name_, u32_data, U32, _val_, _len_) |
| 275 | #define PROPERTY_ENTRY_U64_ARRAY(_name_, _val_) \ | 276 | #define PROPERTY_ENTRY_U64_ARRAY_LEN(_name_, _val_, _len_) \ |
| 276 | PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, U64, _val_) | 277 | __PROPERTY_ENTRY_ARRAY_LEN(_name_, u64_data, U64, _val_, _len_) |
| 277 | 278 | #define PROPERTY_ENTRY_STRING_ARRAY_LEN(_name_, _val_, _len_) \ | |
| 278 | #define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_) \ | 279 | __PROPERTY_ENTRY_ARRAY_LEN(_name_, str, STRING, _val_, _len_) |
| 279 | (struct property_entry) { \ | 280 | |
| 280 | .name = _name_, \ | 281 | #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \ |
| 281 | .length = ARRAY_SIZE(_val_) * sizeof(const char *), \ | 282 | PROPERTY_ENTRY_U8_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) |
| 282 | .is_array = true, \ | 283 | #define PROPERTY_ENTRY_U16_ARRAY(_name_, _val_) \ |
| 283 | .type = DEV_PROP_STRING, \ | 284 | PROPERTY_ENTRY_U16_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) |
| 284 | { .pointer = { .str = _val_ } }, \ | 285 | #define PROPERTY_ENTRY_U32_ARRAY(_name_, _val_) \ |
| 285 | } | 286 | PROPERTY_ENTRY_U32_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) |
| 286 | 287 | #define PROPERTY_ENTRY_U64_ARRAY(_name_, _val_) \ | |
| 287 | #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _Type_, _val_) \ | 288 | PROPERTY_ENTRY_U64_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) |
| 288 | (struct property_entry) { \ | 289 | #define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_) \ |
| 289 | .name = _name_, \ | 290 | PROPERTY_ENTRY_STRING_ARRAY_LEN(_name_, _val_, ARRAY_SIZE(_val_)) |
| 290 | .length = sizeof(_type_), \ | 291 | |
| 291 | .type = DEV_PROP_##_Type_, \ | 292 | #define __PROPERTY_ENTRY_ELEMENT(_name_, _elem_, _Type_, _val_) \ |
| 292 | { .value = { ._type_##_data = _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_) \ | 300 | #define PROPERTY_ENTRY_U8(_name_, _val_) \ |
| 296 | PROPERTY_ENTRY_INTEGER(_name_, u8, U8, _val_) | 301 | __PROPERTY_ENTRY_ELEMENT(_name_, u8_data, U8, _val_) |
| 297 | #define PROPERTY_ENTRY_U16(_name_, _val_) \ | 302 | #define PROPERTY_ENTRY_U16(_name_, _val_) \ |
| 298 | PROPERTY_ENTRY_INTEGER(_name_, u16, U16, _val_) | 303 | __PROPERTY_ENTRY_ELEMENT(_name_, u16_data, U16, _val_) |
| 299 | #define PROPERTY_ENTRY_U32(_name_, _val_) \ | 304 | #define PROPERTY_ENTRY_U32(_name_, _val_) \ |
| 300 | PROPERTY_ENTRY_INTEGER(_name_, u32, U32, _val_) | 305 | __PROPERTY_ENTRY_ELEMENT(_name_, u32_data, U32, _val_) |
| 301 | #define PROPERTY_ENTRY_U64(_name_, _val_) \ | 306 | #define PROPERTY_ENTRY_U64(_name_, _val_) \ |
| 302 | PROPERTY_ENTRY_INTEGER(_name_, u64, U64, _val_) | 307 | __PROPERTY_ENTRY_ELEMENT(_name_, u64_data, U64, _val_) |
| 303 | 308 | #define PROPERTY_ENTRY_STRING(_name_, _val_) \ | |
| 304 | #define PROPERTY_ENTRY_STRING(_name_, _val_) \ | 309 | __PROPERTY_ENTRY_ELEMENT(_name_, str, STRING, _val_) |
| 305 | (struct property_entry) { \ | ||
| 306 | .name = _name_, \ | ||
| 307 | .length = sizeof(const char *), \ | ||
| 308 | .type = DEV_PROP_STRING, \ | ||
| 309 | { .value = { .str = _val_ } }, \ | ||
| 310 | } | ||
| 311 | 310 | ||
| 312 | #define PROPERTY_ENTRY_BOOL(_name_) \ | 311 | #define PROPERTY_ENTRY_BOOL(_name_) \ |
| 313 | (struct property_entry) { \ | 312 | (struct property_entry) { \ |
| @@ -418,7 +417,8 @@ struct software_node { · 104 unmodified lines | |||
| 418 | }; | 417 | }; |
| 419 | 418 | ||
| 420 | bool is_software_node(const struct fwnode_handle *fwnode); | 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 | struct fwnode_handle *software_node_fwnode(const struct software_node *node); | 422 | struct fwnode_handle *software_node_fwnode(const struct software_node *node); |
| 423 | 423 | ||
| 424 | const struct software_node * | 424 | const struct software_node * |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | #ifndef __LINUX_PSCI_H | 7 | #ifndef __LINUX_PSCI_H |
| 8 | #define __LINUX_PSCI_H | 8 | #define __LINUX_PSCI_H |
| 9 | 9 | ||
| 10 | #include <linux/arm-smccc.h> | ||
| 10 | #include <linux/init.h> | 11 | #include <linux/init.h> |
| 11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 12 | 13 | ||
| @@ -18,12 +19,6 @@ bool psci_tos_resident_on(int cpu); · 5 unmodified lines | |||
| 18 | int psci_cpu_suspend_enter(u32 state); | 19 | int psci_cpu_suspend_enter(u32 state); |
| 19 | bool psci_power_state_is_valid(u32 state); | 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 | enum smccc_version { | 22 | enum smccc_version { |
| 28 | SMCCC_VERSION_1_0, | 23 | SMCCC_VERSION_1_0, |
| 29 | SMCCC_VERSION_1_1, | 24 | SMCCC_VERSION_1_1, |
| @@ -38,7 +33,7 @@ struct psci_operations { · 8 unmodified lines | |||
| 38 | int (*affinity_info)(unsigned long target_affinity, | 33 | int (*affinity_info)(unsigned long target_affinity, |
| 39 | unsigned long lowest_affinity_level); | 34 | unsigned long lowest_affinity_level); |
| 40 | int (*migrate_info_type)(void); | 35 | int (*migrate_info_type)(void); |
| 41 | enum psci_conduit conduit; | 36 | enum arm_smccc_conduit conduit; |
| 42 | enum smccc_version smccc_version; | 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 | * @request: optional hook for requesting a PWM | 243 | * @request: optional hook for requesting a PWM |
| 244 | * @free: optional hook for freeing a PWM | 244 | * @free: optional hook for freeing a PWM |
| 245 | * @capture: capture and report PWM signal | 245 | * @capture: capture and report PWM signal |
| 246 | * @apply: atomically apply a new PWM config. The state argument | 246 | * @apply: atomically apply a new PWM config |
| 247 | * should be adjusted with the real hardware config (if the | ||
| 248 | * approximate the period or duty_cycle value, state should | ||
| 249 | * reflect it) | ||
| 250 | * @get_state: get the current PWM state. This function is only | 247 | * @get_state: get the current PWM state. This function is only |
| 251 | * called once per PWM device when the PWM chip is | 248 | * called once per PWM device when the PWM chip is |
| 252 | * registered. | 249 | * registered. |
| @@ -206,7 +206,7 @@ enum pxa_ssp_type { · 205 unmodified lines | |||
| 206 | }; | 206 | }; |
| 207 | 207 | ||
| 208 | struct ssp_device { | 208 | struct ssp_device { |
| 209 | struct platform_device *pdev; | 209 | struct device *dev; |
| 210 | struct list_head node; | 210 | struct list_head node; |
| 211 | 211 | ||
| 212 | struct clk *clk; | 212 | struct clk *clk; |
| @@ -24,6 +24,26 @@ struct qcom_scm_vmperm { · 23 unmodified lines | |||
| 24 | int perm; | 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 | #define QCOM_SCM_VMID_HLOS 0x3 | 47 | #define QCOM_SCM_VMID_HLOS 0x3 |
| 28 | #define QCOM_SCM_VMID_MSS_MSA 0xF | 48 | #define QCOM_SCM_VMID_MSS_MSA 0xF |
| 29 | #define QCOM_SCM_VMID_WLAN 0x18 | 49 | #define QCOM_SCM_VMID_WLAN 0x18 |
| @@ -41,6 +61,11 @@ extern bool qcom_scm_is_available(void); · 11 unmodified lines | |||
| 41 | extern bool qcom_scm_hdcp_available(void); | 61 | extern bool qcom_scm_hdcp_available(void); |
| 42 | extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, | 62 | extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, |
| 43 | u32 *resp); | 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 | extern bool qcom_scm_pas_supported(u32 peripheral); | 69 | extern bool qcom_scm_pas_supported(u32 peripheral); |
| 45 | extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, | 70 | extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, |
| 46 | size_t size); | 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 | extern void qcom_scm_cpu_power_down(u32 flags); | 80 | extern void qcom_scm_cpu_power_down(u32 flags); |
| 56 | extern u32 qcom_scm_get_version(void); | 81 | extern u32 qcom_scm_get_version(void); |
| 57 | extern int qcom_scm_set_remote_state(u32 state, u32 id); | 82 | extern int qcom_scm_set_remote_state(u32 state, u32 id); |
| 83 | extern bool qcom_scm_restore_sec_cfg_available(void); | ||
| 58 | extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); | 84 | extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); |
| 59 | extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size); | 85 | extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size); |
| 60 | extern int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare); | 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 | extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); | 88 | extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); |
| 62 | extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val); | 89 | extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val); |
| 63 | #else | 90 | #else |
| @@ -97,6 +124,7 @@ qcom_scm_set_remote_state(u32 state,u32 id) { return -ENODEV; } · 33 unmodified lines | |||
| 97 | static inline int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) { return -ENODEV; } | 124 | static inline int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) { return -ENODEV; } |
| 98 | static inline int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size) { return -ENODEV; } | 125 | static inline int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size) { return -ENODEV; } |
| 99 | static inline int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) { return -ENODEV; } | 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 | static inline int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val) { return -ENODEV; } | 128 | static inline int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val) { return -ENODEV; } |
| 101 | static inline int qcom_scm_io_writel(phys_addr_t addr, unsigned int val) { return -ENODEV; } | 129 | static inline int qcom_scm_io_writel(phys_addr_t addr, unsigned int val) { return -ENODEV; } |
| 102 | #endif | 130 | #endif |
| @@ -263,7 +263,7 @@ enum { · 262 unmodified lines | |||
| 263 | }; | 263 | }; |
| 264 | 264 | ||
| 265 | struct dqstats { | 265 | struct dqstats { |
| 266 | int stat[_DQST_DQSTAT_LAST]; | 266 | unsigned long stat[_DQST_DQSTAT_LAST]; |
| 267 | struct percpu_counter counter[_DQST_DQSTAT_LAST]; | 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 | atomic_inc(&dquot->dq_count); | 54 | atomic_inc(&dquot->dq_count); |
| 55 | return dquot; | 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 | void dqput(struct dquot *dquot); | 67 | void dqput(struct dquot *dquot); |
| 58 | int dquot_scan_active(struct super_block *sb, | 68 | int dquot_scan_active(struct super_block *sb, |
| 59 | int (*fn)(struct dquot *dquot, unsigned long priv), | 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 | int dquot_file_open(struct inode *inode, struct file *file); | 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 | unsigned int flags); | 103 | unsigned int flags); |
| 92 | int dquot_quota_on(struct super_block *sb, int type, int format_id, | 104 | int dquot_quota_on(struct super_block *sb, int type, int format_id, |
| 93 | const struct path *path); | 105 | const struct path *path); |
| @@ -283,14 +283,12 @@ __rb_erase_augmented(struct rb_node *node, struct rb_root *root, · 282 unmodified lines | |||
| 283 | __rb_change_child(node, successor, tmp, root); | 283 | __rb_change_child(node, successor, tmp, root); |
| 284 | 284 | ||
| 285 | if (child2) { | 285 | if (child2) { |
| 286 | successor->__rb_parent_color = pc; | ||
| 287 | rb_set_parent_color(child2, parent, RB_BLACK); | 286 | rb_set_parent_color(child2, parent, RB_BLACK); |
| 288 | rebalance = NULL; | 287 | rebalance = NULL; |
| 289 | } else { | 288 | } else { |
| 290 | unsigned long pc2 = successor->__rb_parent_color; | 289 | rebalance = rb_is_black(successor) ? parent : NULL; |
| 291 | successor->__rb_parent_color = pc; | ||
| 292 | rebalance = __rb_is_black(pc2) ? parent : NULL; | ||
| 293 | } | 290 | } |
| 291 | successor->__rb_parent_color = pc; | ||
| 294 | tmp = successor; | 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 | ((unsigned long)rcu_dereference_check(h->first, hlist_bl_is_locked(h)) & ~LIST_BL_LOCKMASK); | 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 | * hlist_bl_del_rcu - deletes entry from hash list without re-initialization | 28 | * hlist_bl_del_rcu - deletes entry from hash list without re-initialization |
| 57 | * @n: the element to delete from the hash list. | 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 | first->pprev = &n->next; | 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 | * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type | 141 | * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type |
| 105 | * @tpos: the type * to use as a loop cursor. | 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 | static inline void rcu_lock_release(struct lockdep_map *map) | 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 | extern struct lockdep_map rcu_lock_map; | 216 | extern struct lockdep_map rcu_lock_map; |
| @@ -382,6 +382,24 @@ do { \ · 165 unmodified lines | |||
| 382 | smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \ | 382 | smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \ |
| 383 | } while (0) | 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 | * rcu_swap_protected() - swap an RCU and a regular pointer | 404 | * rcu_swap_protected() - swap an RCU and a regular pointer |
| 387 | * @rcu_ptr: RCU pointer | 405 | * @rcu_ptr: RCU pointer |
| @@ -84,6 +84,7 @@ static inline void rcu_scheduler_starting(void) { } · 83 unmodified lines | |||
| 84 | #endif /* #else #ifndef CONFIG_SRCU */ | 84 | #endif /* #else #ifndef CONFIG_SRCU */ |
| 85 | static inline void rcu_end_inkernel_boot(void) { } | 85 | static inline void rcu_end_inkernel_boot(void) { } |
| 86 | static inline bool rcu_is_watching(void) { return true; } | 86 | static inline bool rcu_is_watching(void) { return true; } |
| 87 | static inline void rcu_momentary_dyntick_idle(void) { } | ||
| 87 | 88 | ||
| 88 | /* Avoid RCU read-side critical sections leaking across. */ | 89 | /* Avoid RCU read-side critical sections leaking across. */ |
| 89 | static inline void rcu_all_qs(void) { barrier(); } | 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 | void rcu_barrier(void); | 38 | void rcu_barrier(void); |
| 39 | bool rcu_eqs_special_set(int cpu); | 39 | bool rcu_eqs_special_set(int cpu); |
| 40 | void rcu_momentary_dyntick_idle(void); | ||
| 40 | unsigned long get_state_synchronize_rcu(void); | 41 | unsigned long get_state_synchronize_rcu(void); |
| 41 | void cond_synchronize_rcu(unsigned long oldstate); | 42 | void cond_synchronize_rcu(unsigned long oldstate); |
| 42 | 43 | ||
| @@ -1,9 +1,88 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 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 | #ifndef _LINUX_REFCOUNT_H | 79 | #ifndef _LINUX_REFCOUNT_H |
| 3 | #define _LINUX_REFCOUNT_H | 80 | #define _LINUX_REFCOUNT_H |
| 4 | 81 | ||
| 5 | #include <linux/atomic.h> | 82 | #include <linux/atomic.h> |
| 83 | #include <linux/bug.h> | ||
| 6 | #include <linux/compiler.h> | 84 | #include <linux/compiler.h> |
| 85 | #include <linux/limits.h> | ||
| 7 | #include <linux/spinlock_types.h> | 86 | #include <linux/spinlock_types.h> |
| 8 | 87 | ||
| 9 | struct mutex; | 88 | struct mutex; |
| @@ -12,7 +91,7 @@ struct mutex; · 2 unmodified lines | |||
| 12 | * struct refcount_t - variant of atomic_t specialized for reference counts | 91 | * struct refcount_t - variant of atomic_t specialized for reference counts |
| 13 | * @refs: atomic_t counter field | 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 | * there. This avoids wrapping the counter and causing 'spurious' | 95 | * there. This avoids wrapping the counter and causing 'spurious' |
| 17 | * use-after-free bugs. | 96 | * use-after-free bugs. |
| 18 | */ | 97 | */ |
| @@ -21,13 +100,25 @@ typedef struct refcount_struct { · 2 unmodified lines | |||
| 21 | } refcount_t; | 100 | } refcount_t; |
| 22 | 101 | ||
| 23 | #define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), } | 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 | * refcount_set - set a refcount's value | 117 | * refcount_set - set a refcount's value |
| 27 | * @r: the refcount | 118 | * @r: the refcount |
| 28 | * @n: value to which the refcount will be set | 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 | atomic_set(&r->refs, n); | 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 | return atomic_read(&r->refs); | 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); | 137 | /** |
| 47 | extern void refcount_add_checked(unsigned int i, refcount_t *r); | 138 | * refcount_add_not_zero - add a value to a refcount unless it is 0 |
| 48 | 139 | * @i: the value to add to the refcount | |
| 49 | extern __must_check bool refcount_inc_not_zero_checked(refcount_t *r); | 140 | * @r: the refcount |
| 50 | extern void refcount_inc_checked(refcount_t *r); | 141 | * |
| 51 | 142 | * Will saturate at REFCOUNT_SATURATED and WARN. | |
| 52 | extern __must_check bool refcount_sub_and_test_checked(unsigned int i, refcount_t *r); | 143 | * |
| 53 | 144 | * Provides no memory ordering, it is assumed the caller has guaranteed the | |
| 54 | extern __must_check bool refcount_dec_and_test_checked(refcount_t *r); | 145 | * object memory to be stable (RCU, etc.). It does provide a control dependency |
| 55 | extern void refcount_dec_checked(refcount_t *r); | 146 | * and thereby orders future stores. See the comment on top. |
| 56 | 147 | * | |
| 57 | #ifdef CONFIG_REFCOUNT_FULL | 148 | * Use of this function is not recommended for the normal reference counting |
| 58 | 149 | * use case in which references are taken and released one at a time. In these | |
| 59 | #define refcount_add_not_zero refcount_add_not_zero_checked | 150 | * cases, refcount_inc(), or one of its variants, should instead be used to |
| 60 | #define refcount_add refcount_add_checked | 151 | * increment a reference count. |
| 61 | 152 | * | |
| 62 | #define refcount_inc_not_zero refcount_inc_not_zero_checked | 153 | * Return: false if the passed refcount is 0, true otherwise |
| 63 | #define refcount_inc refcount_inc_checked | 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 | 164 | if (unlikely(old < 0 || old + i < 0)) |
| 68 | #define refcount_dec refcount_dec_checked | 165 | refcount_warn_saturate(r, REFCOUNT_ADD_NOT_ZERO_OVF); |
| 69 | 166 | ||
| 70 | #else | 167 | return old; |
| 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); | ||
| 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 | static inline __must_check bool refcount_inc_not_zero(refcount_t *r) | 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 | static inline void refcount_inc(refcount_t *r) | 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 | static inline __must_check bool refcount_dec_and_test(refcount_t *r) | 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 | static inline void refcount_dec(refcount_t *r) | 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 | extern __must_check bool refcount_dec_if_one(refcount_t *r); | 300 | extern __must_check bool refcount_dec_if_one(refcount_t *r); |
| 112 | extern __must_check bool refcount_dec_not_one(refcount_t *r); | 301 | extern __must_check bool refcount_dec_not_one(refcount_t *r); |
| @@ -37,14 +37,11 @@ enum ab8505_regulator_id { · 36 unmodified lines | |||
| 37 | AB8505_LDO_AUX6, | 37 | AB8505_LDO_AUX6, |
| 38 | AB8505_LDO_INTCORE, | 38 | AB8505_LDO_INTCORE, |
| 39 | AB8505_LDO_ADC, | 39 | AB8505_LDO_ADC, |
| 40 | AB8505_LDO_USB, | ||
| 41 | AB8505_LDO_AUDIO, | 40 | AB8505_LDO_AUDIO, |
| 42 | AB8505_LDO_ANAMIC1, | 41 | AB8505_LDO_ANAMIC1, |
| 43 | AB8505_LDO_ANAMIC2, | 42 | AB8505_LDO_ANAMIC2, |
| 44 | AB8505_LDO_AUX8, | 43 | AB8505_LDO_AUX8, |
| 45 | AB8505_LDO_ANA, | 44 | AB8505_LDO_ANA, |
| 46 | AB8505_SYSCLKREQ_2, | ||
| 47 | AB8505_SYSCLKREQ_4, | ||
| 48 | AB8505_NUM_REGULATORS, | 45 | AB8505_NUM_REGULATORS, |
| 49 | }; | 46 | }; |
| 50 | 47 | ||
| @@ -36,6 +36,7 @@ struct fixed_voltage_config { · 35 unmodified lines | |||
| 36 | const char *input_supply; | 36 | const char *input_supply; |
| 37 | int microvolts; | 37 | int microvolts; |
| 38 | unsigned startup_delay; | 38 | unsigned startup_delay; |
| 39 | unsigned int off_on_delay; | ||
| 39 | unsigned enabled_at_boot:1; | 40 | unsigned enabled_at_boot:1; |
| 40 | struct regulator_init_data *init_data; | 41 | struct regulator_init_data *init_data; |
| 41 | }; | 42 | }; |
| @@ -62,7 +62,8 @@ struct reset_control_lookup { · 61 unmodified lines | |||
| 62 | * @of_node: corresponding device tree node as phandle target | 62 | * @of_node: corresponding device tree node as phandle target |
| 63 | * @of_reset_n_cells: number of cells in reset line specifiers | 63 | * @of_reset_n_cells: number of cells in reset line specifiers |
| 64 | * @of_xlate: translation function to translate from specifier as found in the | 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 | * @nr_resets: number of reset controls in this reset controller device | 67 | * @nr_resets: number of reset controls in this reset controller device |
| 67 | */ | 68 | */ |
| 68 | struct reset_controller_dev { | 69 | struct reset_controller_dev { |
| @@ -203,12 +203,34 @@ static inline struct reset_control *reset_control_get_shared( · 202 unmodified lines | |||
| 203 | return __reset_control_get(dev, id, 0, true, false, false); | 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 | static inline struct reset_control *reset_control_get_optional_exclusive( | 217 | static inline struct reset_control *reset_control_get_optional_exclusive( |
| 207 | struct device *dev, const char *id) | 218 | struct device *dev, const char *id) |
| 208 | { | 219 | { |
| 209 | return __reset_control_get(dev, id, 0, false, true, true); | 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 | static inline struct reset_control *reset_control_get_optional_shared( | 234 | static inline struct reset_control *reset_control_get_optional_shared( |
| 213 | struct device *dev, const char *id) | 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 | return __devm_reset_control_get(dev, id, 0, true, false, false); | 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 | static inline struct reset_control *devm_reset_control_get_optional_exclusive( | 391 | static inline struct reset_control *devm_reset_control_get_optional_exclusive( |
| 358 | struct device *dev, const char *id) | 392 | struct device *dev, const char *id) |
| 359 | { | 393 | { |
| 360 | return __devm_reset_control_get(dev, id, 0, false, true, true); | 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 | static inline struct reset_control *devm_reset_control_get_optional_shared( | 409 | static inline struct reset_control *devm_reset_control_get_optional_shared( |
| 364 | struct device *dev, const char *id) | 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 | #define resource_list_for_each_entry_safe(entry, tmp, list) \ | 66 | #define resource_list_for_each_entry_safe(entry, tmp, list) \ |
| 67 | list_for_each_entry_safe((entry), (tmp), (list), node) | 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 | #endif /* _LINUX_RESOURCE_EXT_H */ | 81 | #endif /* _LINUX_RESOURCE_EXT_H */ |
| @@ -159,11 +159,16 @@ struct rtc_device { · 158 unmodified lines | |||
| 159 | }; | 159 | }; |
| 160 | #define to_rtc_device(d) container_of(d, struct rtc_device, dev) | 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 | /* useful timestamps */ | 165 | /* useful timestamps */ |
| 166 | #define RTC_TIMESTAMP_BEGIN_0000 -62167219200ULL /* 0000-01-01 00:00:00 */ | ||
| 163 | #define RTC_TIMESTAMP_BEGIN_1900 -2208988800LL /* 1900-01-01 00:00:00 */ | 167 | #define RTC_TIMESTAMP_BEGIN_1900 -2208988800LL /* 1900-01-01 00:00:00 */ |
| 164 | #define RTC_TIMESTAMP_BEGIN_2000 946684800LL /* 2000-01-01 00:00:00 */ | 168 | #define RTC_TIMESTAMP_BEGIN_2000 946684800LL /* 2000-01-01 00:00:00 */ |
| 165 | #define RTC_TIMESTAMP_END_2063 2966371199LL /* 2063-12-31 23:59:59 */ | 169 | #define RTC_TIMESTAMP_END_2063 2966371199LL /* 2063-12-31 23:59:59 */ |
| 166 | #define RTC_TIMESTAMP_END_2099 4102444799LL /* 2099-12-31 23:59:59 */ | 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 | #define RTC_TIMESTAMP_END_9999 253402300799LL /* 9999-12-31 23:59:59 */ | 172 | #define RTC_TIMESTAMP_END_9999 253402300799LL /* 9999-12-31 23:59:59 */ |
| 168 | 173 | ||
| 169 | extern struct rtc_device *devm_rtc_device_register(struct device *dev, | 174 | extern struct rtc_device *devm_rtc_device_register(struct device *dev, |
| @@ -42,14 +42,11 @@ · 41 unmodified lines | |||
| 42 | struct ds1685_priv { | 42 | struct ds1685_priv { |
| 43 | struct rtc_device *dev; | 43 | struct rtc_device *dev; |
| 44 | void __iomem *regs; | 44 | void __iomem *regs; |
| 45 | void __iomem *data; | ||
| 45 | u32 regstep; | 46 | u32 regstep; |
| 46 | resource_size_t baseaddr; | ||
| 47 | size_t size; | ||
| 48 | int irq_num; | 47 | int irq_num; |
| 49 | bool bcd_mode; | 48 | bool bcd_mode; |
| 50 | bool no_irq; | 49 | bool no_irq; |
| 51 | bool uie_unsupported; | ||
| 52 | bool alloc_io_resources; | ||
| 53 | u8 (*read)(struct ds1685_priv *, int); | 50 | u8 (*read)(struct ds1685_priv *, int); |
| 54 | void (*write)(struct ds1685_priv *, int, u8); | 51 | void (*write)(struct ds1685_priv *, int, u8); |
| 55 | void (*prepare_poweroff)(void); | 52 | void (*prepare_poweroff)(void); |
| @@ -74,12 +71,13 @@ struct ds1685_rtc_platform_data { · 18 unmodified lines | |||
| 74 | const bool bcd_mode; | 71 | const bool bcd_mode; |
| 75 | const bool no_irq; | 72 | const bool no_irq; |
| 76 | const bool uie_unsupported; | 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 | void (*plat_prepare_poweroff)(void); | 74 | void (*plat_prepare_poweroff)(void); |
| 81 | void (*plat_wake_alarm)(void); | 75 | void (*plat_wake_alarm)(void); |
| 82 | void (*plat_post_ram_clear)(void); | 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 | #define PID_5250 0x5250 | 1262 | #define PID_5250 0x5250 |
| 1263 | #define PID_525A 0x525A | 1263 | #define PID_525A 0x525A |
| 1264 | #define PID_5260 0x5260 | 1264 | #define PID_5260 0x5260 |
| 1265 | #define PID_5261 0x5261 | ||
| 1265 | 1266 | ||
| 1266 | #define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid)) | 1267 | #define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid)) |
| 1267 | #define PCI_VID(pcr) ((pcr)->pci->vendor) | 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 | static inline void __raw_write_unlock(rwlock_t *lock) | 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 | do_raw_write_unlock(lock); | 219 | do_raw_write_unlock(lock); |
| 220 | preempt_enable(); | 220 | preempt_enable(); |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | static inline void __raw_read_unlock(rwlock_t *lock) | 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 | do_raw_read_unlock(lock); | 226 | do_raw_read_unlock(lock); |
| 227 | preempt_enable(); | 227 | preempt_enable(); |
| 228 | } | 228 | } |
| @@ -230,7 +230,7 @@ static inline void __raw_read_unlock(rwlock_t *lock) · 1 unmodified line | |||
| 230 | static inline void | 230 | static inline void |
| 231 | __raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | 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 | do_raw_read_unlock(lock); | 234 | do_raw_read_unlock(lock); |
| 235 | local_irq_restore(flags); | 235 | local_irq_restore(flags); |
| 236 | preempt_enable(); | 236 | preempt_enable(); |
| @@ -238,7 +238,7 @@ __raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) · 1 unmodified line | |||
| 238 | 238 | ||
| 239 | static inline void __raw_read_unlock_irq(rwlock_t *lock) | 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 | do_raw_read_unlock(lock); | 242 | do_raw_read_unlock(lock); |
| 243 | local_irq_enable(); | 243 | local_irq_enable(); |
| 244 | preempt_enable(); | 244 | preempt_enable(); |
| @@ -246,7 +246,7 @@ static inline void __raw_read_unlock_irq(rwlock_t *lock) · 1 unmodified line | |||
| 246 | 246 | ||
| 247 | static inline void __raw_read_unlock_bh(rwlock_t *lock) | 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 | do_raw_read_unlock(lock); | 250 | do_raw_read_unlock(lock); |
| 251 | __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); | 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 | static inline void __raw_write_unlock_irqrestore(rwlock_t *lock, | 254 | static inline void __raw_write_unlock_irqrestore(rwlock_t *lock, |
| 255 | unsigned long flags) | 255 | unsigned long flags) |
| 256 | { | 256 | { |
| 257 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | 257 | rwlock_release(&lock->dep_map, _RET_IP_); |
| 258 | do_raw_write_unlock(lock); | 258 | do_raw_write_unlock(lock); |
| 259 | local_irq_restore(flags); | 259 | local_irq_restore(flags); |
| 260 | preempt_enable(); | 260 | preempt_enable(); |
| @@ -262,7 +262,7 @@ static inline void __raw_write_unlock_irqrestore(rwlock_t *lock, · 1 unmodified line | |||
| 262 | 262 | ||
| 263 | static inline void __raw_write_unlock_irq(rwlock_t *lock) | 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 | do_raw_write_unlock(lock); | 266 | do_raw_write_unlock(lock); |
| 267 | local_irq_enable(); | 267 | local_irq_enable(); |
| 268 | preempt_enable(); | 268 | preempt_enable(); |
| @@ -270,7 +270,7 @@ static inline void __raw_write_unlock_irq(rwlock_t *lock) · 1 unmodified line | |||
| 270 | 270 | ||
| 271 | static inline void __raw_write_unlock_bh(rwlock_t *lock) | 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 | do_raw_write_unlock(lock); | 274 | do_raw_write_unlock(lock); |
| 275 | __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); | 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 | bool sbitmap_any_bit_set(const struct sbitmap *sb); | 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 | #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) | 219 | #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) |
| 229 | #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U)) | 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 | enum vtime_state { | 251 | enum vtime_state { |
| 252 | /* Task is sleeping or running in a CPU with VTIME inactive: */ | 252 | /* Task is sleeping or running in a CPU with VTIME inactive: */ |
| 253 | VTIME_INACTIVE = 0, | 253 | VTIME_INACTIVE = 0, |
| 254 | /* Task runs in userspace in a CPU with VTIME active: */ | 254 | /* Task is idle */ |
| 255 | VTIME_USER, | 255 | VTIME_IDLE, |
| 256 | /* Task runs in kernelspace in a CPU with VTIME active: */ | 256 | /* Task runs in kernelspace in a CPU with VTIME active: */ |
| 257 | VTIME_SYS, | 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 | struct vtime { | 264 | struct vtime { |
| 261 | seqcount_t seqcount; | 265 | seqcount_t seqcount; |
| 262 | unsigned long long starttime; | 266 | unsigned long long starttime; |
| 263 | enum vtime_state state; | 267 | enum vtime_state state; |
| 268 | unsigned int cpu; | ||
| 264 | u64 utime; | 269 | u64 utime; |
| 265 | u64 stime; | 270 | u64 stime; |
| 266 | u64 gtime; | 271 | u64 gtime; |
| @@ -858,7 +863,7 @@ struct task_struct { · 591 unmodified lines | |||
| 858 | u64 start_time; | 863 | u64 start_time; |
| 859 | 864 | ||
| 860 | /* Boot based time in nsecs: */ | 865 | /* Boot based time in nsecs: */ |
| 861 | u64 real_start_time; | 866 | u64 start_boottime; |
| 862 | 867 | ||
| 863 | /* MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific: */ | 868 | /* MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific: */ |
| 864 | unsigned long min_flt; | 869 | unsigned long min_flt; |
| @@ -1055,6 +1060,8 @@ struct task_struct { · 190 unmodified lines | |||
| 1055 | #endif | 1060 | #endif |
| 1056 | struct list_head pi_state_list; | 1061 | struct list_head pi_state_list; |
| 1057 | struct futex_pi_state *pi_state_cache; | 1062 | struct futex_pi_state *pi_state_cache; |
| 1063 | struct mutex futex_exit_mutex; | ||
| 1064 | unsigned int futex_state; | ||
| 1058 | #endif | 1065 | #endif |
| 1059 | #ifdef CONFIG_PERF_EVENTS | 1066 | #ifdef CONFIG_PERF_EVENTS |
| 1060 | struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; | 1067 | struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; |
| @@ -1207,6 +1214,8 @@ struct task_struct { · 146 unmodified lines | |||
| 1207 | #endif /* CONFIG_TRACING */ | 1214 | #endif /* CONFIG_TRACING */ |
| 1208 | 1215 | ||
| 1209 | #ifdef CONFIG_KCOV | 1216 | #ifdef CONFIG_KCOV |
| 1217 | /* See kernel/kcov.c for more details. */ | ||
| 1218 | |||
| 1210 | /* Coverage collection mode enabled for this task (0 if disabled): */ | 1219 | /* Coverage collection mode enabled for this task (0 if disabled): */ |
| 1211 | unsigned int kcov_mode; | 1220 | unsigned int kcov_mode; |
| 1212 | 1221 | ||
| @@ -1218,6 +1227,12 @@ struct task_struct { · 5 unmodified lines | |||
| 1218 | 1227 | ||
| 1219 | /* KCOV descriptor wired with this task or NULL: */ | 1228 | /* KCOV descriptor wired with this task or NULL: */ |
| 1220 | struct kcov *kcov; | 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 | #endif | 1236 | #endif |
| 1222 | 1237 | ||
| 1223 | #ifdef CONFIG_MEMCG | 1238 | #ifdef CONFIG_MEMCG |
| @@ -1446,7 +1461,6 @@ extern struct pid *cad_pid; · 222 unmodified lines | |||
| 1446 | */ | 1461 | */ |
| 1447 | #define PF_IDLE 0x00000002 /* I am an IDLE thread */ | 1462 | #define PF_IDLE 0x00000002 /* I am an IDLE thread */ |
| 1448 | #define PF_EXITING 0x00000004 /* Getting shut down */ | 1463 | #define PF_EXITING 0x00000004 /* Getting shut down */ |
| 1449 | #define PF_EXITPIDONE 0x00000008 /* PI exit done on shut down */ | ||
| 1450 | #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ | 1464 | #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ |
| 1451 | #define PF_WQ_WORKER 0x00000020 /* I'm a workqueue worker */ | 1465 | #define PF_WQ_WORKER 0x00000020 /* I'm a workqueue worker */ |
| 1452 | #define PF_FORKNOEXEC 0x00000040 /* Forked but didn't exec */ | 1466 | #define PF_FORKNOEXEC 0x00000040 /* Forked but didn't exec */ |
| @@ -1472,6 +1486,7 @@ extern struct pid *cad_pid; · 19 unmodified lines | |||
| 1472 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ | 1486 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ |
| 1473 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ | 1487 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
| 1474 | #define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ | 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 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ | 1490 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ |
| 1476 | #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */ | 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 | #define SCHED_CPUFREQ_MIGRATION (1U << 1) | 12 | #define SCHED_CPUFREQ_MIGRATION (1U << 1) |
| 13 | 13 | ||
| 14 | #ifdef CONFIG_CPU_FREQ | 14 | #ifdef CONFIG_CPU_FREQ |
| 15 | struct cpufreq_policy; | ||
| 16 | |||
| 15 | struct update_util_data { | 17 | struct update_util_data { |
| 16 | void (*func)(struct update_util_data *data, u64 time, unsigned int flags); | 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 | void (*func)(struct update_util_data *data, u64 time, | 22 | void (*func)(struct update_util_data *data, u64 time, |
| 21 | unsigned int flags)); | 23 | unsigned int flags)); |
| 22 | void cpufreq_remove_update_util_hook(int cpu); | 24 | void cpufreq_remove_update_util_hook(int cpu); |
| 25 | bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy); | ||
| 23 | 26 | ||
| 24 | static inline unsigned long map_util_freq(unsigned long util, | 27 | static inline unsigned long map_util_freq(unsigned long util, |
| 25 | unsigned long freq, unsigned long cap) | 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 | * succeeds. | 117 | * succeeds. |
| 118 | */ | 118 | */ |
| 119 | extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode); | 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 */ | 120 | /* Remove the current tasks stale references to the old mm_struct on exit() */ |
| 121 | extern void mm_release(struct task_struct *, struct mm_struct *); | 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 | #ifdef CONFIG_MEMCG | 125 | #ifdef CONFIG_MEMCG |
| 124 | extern void mm_update_next_owner(struct mm_struct *mm); | 126 | extern void mm_update_next_owner(struct mm_struct *mm); |
| @@ -26,6 +26,9 @@ struct kernel_clone_args { · 25 unmodified lines | |||
| 26 | unsigned long stack; | 26 | unsigned long stack; |
| 27 | unsigned long stack_size; | 27 | unsigned long stack_size; |
| 28 | unsigned long tls; | 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 | #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER | 34 | #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER |
| 35 | extern int __secure_computing(const struct seccomp_data *sd); | 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 | if (unlikely(test_thread_flag(TIF_SECCOMP))) | 38 | if (unlikely(test_thread_flag(TIF_SECCOMP))) |
| 39 | return __secure_computing(sd); | 39 | return __secure_computing(NULL); |
| 40 | return 0; | 40 | return 0; |
| 41 | } | 41 | } |
| 42 | #else | 42 | #else |
| @@ -59,7 +59,7 @@ struct seccomp { }; · 16 unmodified lines | |||
| 59 | struct seccomp_filter { }; | 59 | struct seccomp_filter { }; |
| 60 | 60 | ||
| 61 | #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER | 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 | #else | 63 | #else |
| 64 | static inline void secure_computing_strict(int this_syscall) { return; } | 64 | static inline void secure_computing_strict(int this_syscall) { return; } |
| 65 | #endif | 65 | #endif |
| @@ -117,12 +117,14 @@ enum lockdown_reason { · 116 unmodified lines | |||
| 117 | LOCKDOWN_MODULE_PARAMETERS, | 117 | LOCKDOWN_MODULE_PARAMETERS, |
| 118 | LOCKDOWN_MMIOTRACE, | 118 | LOCKDOWN_MMIOTRACE, |
| 119 | LOCKDOWN_DEBUGFS, | 119 | LOCKDOWN_DEBUGFS, |
| 120 | LOCKDOWN_XMON_WR, | ||
| 120 | LOCKDOWN_INTEGRITY_MAX, | 121 | LOCKDOWN_INTEGRITY_MAX, |
| 121 | LOCKDOWN_KCORE, | 122 | LOCKDOWN_KCORE, |
| 122 | LOCKDOWN_KPROBES, | 123 | LOCKDOWN_KPROBES, |
| 123 | LOCKDOWN_BPF_READ, | 124 | LOCKDOWN_BPF_READ, |
| 124 | LOCKDOWN_PERF, | 125 | LOCKDOWN_PERF, |
| 125 | LOCKDOWN_TRACEFS, | 126 | LOCKDOWN_TRACEFS, |
| 127 | LOCKDOWN_XMON_RW, | ||
| 126 | LOCKDOWN_CONFIDENTIALITY_MAX, | 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 | #endif /* CONFIG_SECURITY */ | 1897 | #endif /* CONFIG_SECURITY */ |
| 1896 | #endif /* CONFIG_BPF_SYSCALL */ | 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 | case IOC_OPAL_PSID_REVERT_TPR: | 42 | case IOC_OPAL_PSID_REVERT_TPR: |
| 43 | case IOC_OPAL_MBR_DONE: | 43 | case IOC_OPAL_MBR_DONE: |
| 44 | case IOC_OPAL_WRITE_SHADOW_MBR: | 44 | case IOC_OPAL_WRITE_SHADOW_MBR: |
| 45 | case IOC_OPAL_GENERIC_TABLE_RW: | ||
| 45 | return true; | 46 | return true; |
| 46 | } | 47 | } |
| 47 | return false; | 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 | extern int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, | 125 | extern int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, |
| 126 | unsigned int len); | 126 | unsigned int len); |
| 127 | extern int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc); | 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 | #ifdef CONFIG_BINARY_PRINTF | 132 | #ifdef CONFIG_BINARY_PRINTF |
| 130 | extern int | 133 | extern int |
| @@ -95,7 +95,7 @@ static inline void seqcount_lockdep_reader_access(const seqcount_t *s) · 94 unmodified lines | |||
| 95 | 95 | ||
| 96 | local_irq_save(flags); | 96 | local_irq_save(flags); |
| 97 | seqcount_acquire_read(&l->dep_map, 0, 0, _RET_IP_); | 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 | local_irq_restore(flags); | 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 | static inline void write_seqcount_end(seqcount_t *s) | 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 | raw_write_seqcount_end(s); | 419 | raw_write_seqcount_end(s); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| @@ -428,6 +428,10 @@ enum { · 427 unmodified lines | |||
| 428 | SFP_TEC_CUR = 0x6c, | 428 | SFP_TEC_CUR = 0x6c, |
| 429 | 429 | ||
| 430 | SFP_STATUS = 0x6e, | 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 | SFP_ALARM0 = 0x70, | 435 | SFP_ALARM0 = 0x70, |
| 432 | SFP_ALARM0_TEMP_HIGH = BIT(7), | 436 | SFP_ALARM0_TEMP_HIGH = BIT(7), |
| 433 | SFP_ALARM0_TEMP_LOW = BIT(6), | 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 | u8 *data); | 512 | u8 *data); |
| 509 | void sfp_upstream_start(struct sfp_bus *bus); | 513 | void sfp_upstream_start(struct sfp_bus *bus); |
| 510 | void sfp_upstream_stop(struct sfp_bus *bus); | 514 | void sfp_upstream_stop(struct sfp_bus *bus); |
| 511 | struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode, | 515 | void sfp_bus_put(struct sfp_bus *bus); |
| 512 | void *upstream, | 516 | struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode); |
| 513 | const struct sfp_upstream_ops *ops); | 517 | int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream, |
| 514 | void sfp_unregister_upstream(struct sfp_bus *bus); | 518 | const struct sfp_upstream_ops *ops); |
| 519 | void sfp_bus_del_upstream(struct sfp_bus *bus); | ||
| 515 | #else | 520 | #else |
| 516 | static inline int sfp_parse_port(struct sfp_bus *bus, | 521 | static inline int sfp_parse_port(struct sfp_bus *bus, |
| 517 | const struct sfp_eeprom_id *id, | 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( | 561 | static inline void sfp_bus_put(struct sfp_bus *bus) |
| 557 | struct fwnode_handle *fwnode, void *upstream, | ||
| 558 | const struct sfp_upstream_ops *ops) | ||
| 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 | #endif | 579 | #endif |
| @@ -1795,7 +1795,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, · 1794 unmodified lines | |||
| 1795 | */ | 1795 | */ |
| 1796 | static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_) | 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 | if (skb == (struct sk_buff *)list_) | 1800 | if (skb == (struct sk_buff *)list_) |
| 1801 | skb = NULL; | 1801 | skb = NULL; |
| @@ -1861,7 +1861,9 @@ static inline void __skb_insert(struct sk_buff *newsk, · 59 unmodified lines | |||
| 1861 | struct sk_buff *prev, struct sk_buff *next, | 1861 | struct sk_buff *prev, struct sk_buff *next, |
| 1862 | struct sk_buff_head *list) | 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 | WRITE_ONCE(newsk->next, next); | 1867 | WRITE_ONCE(newsk->next, next); |
| 1866 | WRITE_ONCE(newsk->prev, prev); | 1868 | WRITE_ONCE(newsk->prev, prev); |
| 1867 | WRITE_ONCE(next->prev, newsk); | 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 | return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len); | 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 | if (likely(len <= skb_headlen(skb))) | 2284 | if (likely(len <= skb_headlen(skb))) |
| 2283 | return 1; | 2285 | return true; |
| 2284 | if (unlikely(len > skb->len)) | 2286 | if (unlikely(len > skb->len)) |
| 2285 | return 0; | 2287 | return false; |
| 2286 | return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL; | 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 | int skb_vlan_pop(struct sk_buff *skb); | 3529 | int skb_vlan_pop(struct sk_buff *skb); |
| 3528 | int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); | 3530 | int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); |
| 3529 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, | 3531 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, |
| 3530 | int mac_len); | 3532 | int mac_len, bool ethernet); |
| 3531 | int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len); | 3533 | int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len, |
| 3534 | bool ethernet); | ||
| 3532 | int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); | 3535 | int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); |
| 3533 | int skb_mpls_dec_ttl(struct sk_buff *skb); | 3536 | int skb_mpls_dec_ttl(struct sk_buff *skb); |
| 3534 | struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, | 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 | static inline void skb_get_timestampns(const struct sk_buff *skb, | 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 | static inline void skb_get_new_timestampns(const struct sk_buff *skb, | 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 | skb->active_extensions = 0; | 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 | #else | 4183 | #else |
| 4173 | static inline void skb_ext_put(struct sk_buff *skb) {} | 4184 | static inline void skb_ext_put(struct sk_buff *skb) {} |
| 4174 | static inline void skb_ext_reset(struct sk_buff *skb) {} | 4185 | static inline void skb_ext_reset(struct sk_buff *skb) {} |
| 4175 | static inline void skb_ext_del(struct sk_buff *skb, int unused) {} | 4186 | static inline void skb_ext_del(struct sk_buff *skb, int unused) {} |
| 4176 | static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} | 4187 | static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} |
| 4177 | static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} | 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 | #endif /* CONFIG_SKB_EXTENSIONS */ | 4190 | #endif /* CONFIG_SKB_EXTENSIONS */ |
| 4179 | 4191 | ||
| 4180 | static inline void nf_reset_ct(struct sk_buff *skb) | 4192 | static inline void nf_reset_ct(struct sk_buff *skb) |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #include <net/strparser.h> | 14 | #include <net/strparser.h> |
| 15 | 15 | ||
| 16 | #define MAX_MSG_FRAGS MAX_SKB_FRAGS | 16 | #define MAX_MSG_FRAGS MAX_SKB_FRAGS |
| 17 | #define NR_MSG_FRAG_IDS (MAX_MSG_FRAGS + 1) | ||
| 17 | 18 | ||
| 18 | enum __sk_action { | 19 | enum __sk_action { |
| 19 | __SK_DROP = 0, | 20 | __SK_DROP = 0, |
| @@ -28,13 +29,16 @@ struct sk_msg_sg { · 8 unmodified lines | |||
| 28 | u32 end; | 29 | u32 end; |
| 29 | u32 size; | 30 | u32 size; |
| 30 | u32 copybreak; | 31 | u32 copybreak; |
| 31 | bool copy[MAX_MSG_FRAGS]; | 32 | unsigned long copy; |
| 32 | /* The extra element is used for chaining the front and sections when | 33 | /* The extra two elements: |
| 33 | * the list becomes partitioned (e.g. end < start). The crypto APIs | 34 | * 1) used for chaining the front and sections when the list becomes |
| 34 | * require the chaining. | 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 | /* UAPI in filter.c depends on struct sk_msg_sg being first element. */ | 43 | /* UAPI in filter.c depends on struct sk_msg_sg being first element. */ |
| 40 | struct sk_msg { | 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 | static inline u32 sk_msg_iter_dist(u32 start, u32 end) | 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 | #define sk_msg_iter_var_prev(var) \ | 151 | #define sk_msg_iter_var_prev(var) \ |
| 148 | do { \ | 152 | do { \ |
| 149 | if (var == 0) \ | 153 | if (var == 0) \ |
| 150 | var = MAX_MSG_FRAGS - 1; \ | 154 | var = NR_MSG_FRAG_IDS - 1; \ |
| 151 | else \ | 155 | else \ |
| 152 | var--; \ | 156 | var--; \ |
| 153 | } while (0) | 157 | } while (0) |
| @@ -155,7 +159,7 @@ static inline u32 sk_msg_iter_dist(u32 start, u32 end) · 1 unmodified line | |||
| 155 | #define sk_msg_iter_var_next(var) \ | 159 | #define sk_msg_iter_var_next(var) \ |
| 156 | do { \ | 160 | do { \ |
| 157 | var++; \ | 161 | var++; \ |
| 158 | if (var == MAX_MSG_FRAGS) \ | 162 | if (var == NR_MSG_FRAG_IDS) \ |
| 159 | var = 0; \ | 163 | var = 0; \ |
| 160 | } while (0) | 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 | static inline void sk_msg_init(struct sk_msg *msg) | 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 | memset(msg, 0, sizeof(*msg)); | 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 | static inline void sk_msg_xfer(struct sk_msg *dst, struct sk_msg *src, | 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 | static inline bool sk_msg_full(const struct sk_msg *msg) | 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 | static inline u32 sk_msg_elem_used(const struct sk_msg *msg) | 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 | return sk_msg_iter_dist(msg->sg.start, msg->sg.end); | 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 | struct scatterlist *sge = sk_msg_elem(msg, msg->sg.start); | 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 | msg->data = NULL; | 235 | msg->data = NULL; |
| 235 | msg->data_end = NULL; | 236 | msg->data_end = NULL; |
| 236 | } else { | 237 | } else { |
| @@ -249,7 +250,7 @@ static inline void sk_msg_page_add(struct sk_msg *msg, struct page *page, · 12 unmodified lines | |||
| 249 | sg_set_page(sge, page, len, offset); | 250 | sg_set_page(sge, page, len, offset); |
| 250 | sg_unmark_end(sge); | 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 | msg->sg.size += len; | 254 | msg->sg.size += len; |
| 254 | sk_msg_iter_next(msg, end); | 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 | static inline void sk_msg_sg_copy(struct sk_msg *msg, u32 i, bool copy_state) | 258 | static inline void sk_msg_sg_copy(struct sk_msg *msg, u32 i, bool copy_state) |
| 258 | { | 259 | { |
| 259 | do { | 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 | sk_msg_iter_var_next(i); | 265 | sk_msg_iter_var_next(i); |
| 262 | if (i == msg->sg.end) | 266 | if (i == msg->sg.end) |
| 263 | break; | 267 | break; |
| @@ -561,26 +561,6 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) · 560 unmodified lines | |||
| 561 | return __kmalloc(size, flags); | 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 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | 564 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
| 585 | { | 565 | { |
| 586 | #ifndef CONFIG_SLOB | 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 | 41 | * llcc_edac_reg_data - llcc edac registers data for each error type |
| 42 | * @usecase_id: usecase id for which the llcc slice is used | 42 | * @name: Name of the error |
| 43 | * @slice_id: llcc slice id assigned to each slice | 43 | * @synd_reg: Syndrome register address |
| 44 | * @max_cap: maximum capacity of the llcc slice | 44 | * @count_status_reg: Status register address to read the error count |
| 45 | * @priority: priority of the llcc slice | 45 | * @ways_status_reg: Status register address to read the error ways |
| 46 | * @fixed_size: whether the llcc slice can grow beyond its size | 46 | * @reg_cnt: Number of registers |
| 47 | * @bonus_ways: bonus ways associated with llcc slice | 47 | * @count_mask: Mask value to get the error count |
| 48 | * @res_ways: reserved ways associated with llcc slice | 48 | * @ways_mask: Mask value to get the error ways |
| 49 | * @cache_mode: mode of the llcc slice | 49 | * @count_shift: Shift value to get the error count |
| 50 | * @probe_target_ways: Probe only reserved and bonus ways on a cache miss | 50 | * @ways_shift: Shift value to get the error ways |
| 51 | * @dis_cap_alloc: Disable capacity based allocation | ||
| 52 | * @retain_on_pc: Retain through power collapse | ||
| 53 | * @activate_on_init: activate the slice on init | ||
| 54 | */ | 51 | */ |
| 55 | struct llcc_slice_config { | 52 | struct llcc_edac_reg_data { |
| 56 | u32 usecase_id; | 53 | char *name; |
| 57 | u32 slice_id; | 54 | u64 synd_reg; |
| 58 | u32 max_cap; | 55 | u64 count_status_reg; |
| 59 | u32 priority; | 56 | u64 ways_status_reg; |
| 60 | bool fixed_size; | 57 | u32 reg_cnt; |
| 61 | u32 bonus_ways; | 58 | u32 count_mask; |
| 62 | u32 res_ways; | 59 | u32 ways_mask; |
| 63 | u32 cache_mode; | 60 | u8 count_shift; |
| 64 | u32 probe_target_ways; | 61 | u8 ways_shift; |
| 65 | bool dis_cap_alloc; | ||
| 66 | bool retain_on_pc; | ||
| 67 | bool activate_on_init; | ||
| 68 | }; | 62 | }; |
| 69 | 63 | ||
| 70 | /** | 64 | /** |
| @@ -93,30 +87,6 @@ struct llcc_drv_data { · 22 unmodified lines | |||
| 93 | int ecc_irq; | 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 | #if IS_ENABLED(CONFIG_QCOM_LLCC) | 90 | #if IS_ENABLED(CONFIG_QCOM_LLCC) |
| 121 | /** | 91 | /** |
| 122 | * llcc_slice_getd - get llcc slice descriptor | 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 | int llcc_slice_deactivate(struct llcc_slice_desc *desc); | 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 | #else | 127 | #else |
| 172 | static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid) | 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 | return -EINVAL; | 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 | #endif | 156 | #endif |
| 211 | 157 | ||
| 212 | #endif | 158 | #endif |
| @@ -378,12 +378,19 @@ extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, · 377 unmodified lines | |||
| 378 | extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, | 378 | extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, |
| 379 | unsigned int vlen, unsigned int flags, | 379 | unsigned int vlen, unsigned int flags, |
| 380 | bool forbid_cmsg_compat); | 380 | bool forbid_cmsg_compat); |
| 381 | extern long __sys_sendmsg_sock(struct socket *sock, | 381 | extern long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg, |
| 382 | struct user_msghdr __user *msg, | ||
| 383 | unsigned int flags); | 382 | unsigned int flags); |
| 384 | extern long __sys_recvmsg_sock(struct socket *sock, | 383 | extern long __sys_recvmsg_sock(struct socket *sock, struct msghdr *msg, |
| 385 | struct user_msghdr __user *msg, | 384 | struct user_msghdr __user *umsg, |
| 385 | struct sockaddr __user *uaddr, | ||
| 386 | unsigned int flags); | 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 | /* helpers which do the actual work for syscalls */ | 395 | /* helpers which do the actual work for syscalls */ |
| 389 | extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size, | 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 | extern int __sys_sendto(int fd, void __user *buff, size_t len, | 399 | extern int __sys_sendto(int fd, void __user *buff, size_t len, |
| 393 | unsigned int flags, struct sockaddr __user *addr, | 400 | unsigned int flags, struct sockaddr __user *addr, |
| 394 | int addr_len); | 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 | extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, | 405 | extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, |
| 396 | int __user *upeer_addrlen, int flags); | 406 | int __user *upeer_addrlen, int flags); |
| 397 | extern int __sys_socket(int family, int type, int protocol); | 407 | extern int __sys_socket(int family, int type, int protocol); |
| 398 | extern int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen); | 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 | extern int __sys_connect(int fd, struct sockaddr __user *uservaddr, | 411 | extern int __sys_connect(int fd, struct sockaddr __user *uservaddr, |
| 400 | int addrlen); | 412 | int addrlen); |
| 401 | extern int __sys_listen(int fd, int backlog); | 413 | extern int __sys_listen(int fd, int backlog); |
| @@ -5,12 +5,12 @@ · 4 unmodified lines | |||
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | 6 | ||
| 7 | void sort_r(void *base, size_t num, size_t size, | 7 | void sort_r(void *base, size_t num, size_t size, |
| 8 | int (*cmp)(const void *, const void *, const void *), | 8 | cmp_r_func_t cmp_func, |
| 9 | void (*swap)(void *, void *, int), | 9 | swap_func_t swap_func, |
| 10 | const void *priv); | 10 | const void *priv); |
| 11 | 11 | ||
| 12 | void sort(void *base, size_t num, size_t size, | 12 | void sort(void *base, size_t num, size_t size, |
| 13 | int (*cmp)(const void *, const void *), | 13 | cmp_func_t cmp_func, |
| 14 | void (*swap)(void *, void *, int)); | 14 | swap_func_t swap_func); |
| 15 | 15 | ||
| 16 | #endif | 16 | #endif |
| @@ -40,9 +40,6 @@ struct sdw_slave; · 39 unmodified lines | |||
| 40 | 40 | ||
| 41 | #define SDW_VALID_PORT_RANGE(n) ((n) <= 14 && (n) >= 1) | 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 | enum { | 43 | enum { |
| 47 | SDW_PORT_DIRN_SINK = 0, | 44 | SDW_PORT_DIRN_SINK = 0, |
| 48 | SDW_PORT_DIRN_SOURCE, | 45 | SDW_PORT_DIRN_SOURCE, |
| @@ -406,6 +403,8 @@ int sdw_slave_read_prop(struct sdw_slave *slave); · 357 unmodified lines | |||
| 406 | * SDW Slave Structures and APIs | 403 | * SDW Slave Structures and APIs |
| 407 | */ | 404 | */ |
| 408 | 405 | ||
| 406 | #define SDW_IGNORED_UNIQUE_ID 0xFF | ||
| 407 | |||
| 409 | /** | 408 | /** |
| 410 | * struct sdw_slave_id - Slave ID | 409 | * struct sdw_slave_id - Slave ID |
| 411 | * @mfg_id: MIPI Manufacturer ID | 410 | * @mfg_id: MIPI Manufacturer ID |
| @@ -421,7 +420,7 @@ struct sdw_slave_id { · 9 unmodified lines | |||
| 421 | __u16 mfg_id; | 420 | __u16 mfg_id; |
| 422 | __u16 part_id; | 421 | __u16 part_id; |
| 423 | __u8 class_id; | 422 | __u8 class_id; |
| 424 | __u8 unique_id:4; | 423 | __u8 unique_id; |
| 425 | __u8 sdw_version:4; | 424 | __u8 sdw_version:4; |
| 426 | }; | 425 | }; |
| 427 | 426 | ||
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
| 14 | #include <linux/scatterlist.h> | 14 | #include <linux/scatterlist.h> |
| 15 | #include <linux/gpio/consumer.h> | 15 | #include <linux/gpio/consumer.h> |
| 16 | #include <linux/ptp_clock_kernel.h> | ||
| 16 | 17 | ||
| 17 | struct dma_chan; | 18 | struct dma_chan; |
| 18 | struct property_entry; | 19 | struct property_entry; |
| @@ -89,6 +90,22 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, · 70 unmodified lines | |||
| 89 | #define SPI_STATISTICS_INCREMENT_FIELD(stats, field) \ | 90 | #define SPI_STATISTICS_INCREMENT_FIELD(stats, field) \ |
| 90 | SPI_STATISTICS_ADD_TO_FIELD(stats, field, 1) | 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 | * struct spi_device - Controller side proxy for an SPI slave device | 110 | * struct spi_device - Controller side proxy for an SPI slave device |
| 94 | * @dev: Driver model representation of the device. | 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 | * the spi_master. | 140 | * the spi_master. |
| 124 | * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when | 141 | * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when |
| 125 | * not using a GPIO line) | 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 | * words of a transfer | 144 | * words of a transfer |
| 128 | * | 145 | * |
| 129 | * @statistics: statistics for the spi_device | 146 | * @statistics: statistics for the spi_device |
| @@ -173,7 +190,7 @@ struct spi_device { · 43 unmodified lines | |||
| 173 | const char *driver_override; | 190 | const char *driver_override; |
| 174 | int cs_gpio; /* LEGACY: chip select gpio */ | 191 | int cs_gpio; /* LEGACY: chip select gpio */ |
| 175 | struct gpio_desc *cs_gpiod; /* chip select gpio desc */ | 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 | /* the statistics */ | 195 | /* the statistics */ |
| 179 | struct spi_statistics statistics; | 196 | struct spi_statistics statistics; |
| @@ -390,6 +407,11 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 210 unmodified lines | |||
| 390 | * controller has native support for memory like operations. | 407 | * controller has native support for memory like operations. |
| 391 | * @unprepare_message: undo any work done by prepare_message(). | 408 | * @unprepare_message: undo any work done by prepare_message(). |
| 392 | * @slave_abort: abort the ongoing transfer request on an SPI slave controller | 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 | * @cs_gpios: LEGACY: array of GPIO descs to use as chip select lines; one per | 415 | * @cs_gpios: LEGACY: array of GPIO descs to use as chip select lines; one per |
| 394 | * CS number. Any individual value may be -ENOENT for CS lines that | 416 | * CS number. Any individual value may be -ENOENT for CS lines that |
| 395 | * are not GPIOs (driven by the SPI controller itself). Use the cs_gpiods | 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 | * @fw_translate_cs: If the boot firmware uses different numbering scheme | 431 | * @fw_translate_cs: If the boot firmware uses different numbering scheme |
| 410 | * what Linux expects, this optional hook can be used to translate | 432 | * what Linux expects, this optional hook can be used to translate |
| 411 | * between the two. | 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 | * Each SPI controller can communicate with one or more @spi_device | 441 | * Each SPI controller can communicate with one or more @spi_device |
| 414 | * children. These make a small bus, sharing MOSI, MISO and SCK signals | 442 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
| @@ -502,8 +530,8 @@ struct spi_controller { · 87 unmodified lines | |||
| 502 | * to configure specific CS timing through spi_set_cs_timing() after | 530 | * to configure specific CS timing through spi_set_cs_timing() after |
| 503 | * spi_setup(). | 531 | * spi_setup(). |
| 504 | */ | 532 | */ |
| 505 | void (*set_cs_timing)(struct spi_device *spi, u8 setup_clk_cycles, | 533 | int (*set_cs_timing)(struct spi_device *spi, struct spi_delay *setup, |
| 506 | u8 hold_clk_cycles, u8 inactive_clk_cycles); | 534 | struct spi_delay *hold, struct spi_delay *inactive); |
| 507 | 535 | ||
| 508 | /* bidirectional bulk transfers | 536 | /* bidirectional bulk transfers |
| 509 | * | 537 | * |
| @@ -587,6 +615,11 @@ struct spi_controller { · 77 unmodified lines | |||
| 587 | /* Optimized handlers for SPI memory-like operations. */ | 615 | /* Optimized handlers for SPI memory-like operations. */ |
| 588 | const struct spi_controller_mem_ops *mem_ops; | 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 | /* gpio chip select */ | 623 | /* gpio chip select */ |
| 591 | int *cs_gpios; | 624 | int *cs_gpios; |
| 592 | struct gpio_desc **cs_gpiods; | 625 | struct gpio_desc **cs_gpiods; |
| @@ -604,6 +637,15 @@ struct spi_controller { · 11 unmodified lines | |||
| 604 | void *dummy_tx; | 637 | void *dummy_tx; |
| 605 | 638 | ||
| 606 | int (*fw_translate_cs)(struct spi_controller *ctlr, unsigned cs); | 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 | static inline void *spi_controller_get_devdata(struct spi_controller *ctlr) | 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 | extern void spi_finalize_current_message(struct spi_controller *ctlr); | 686 | extern void spi_finalize_current_message(struct spi_controller *ctlr); |
| 645 | extern void spi_finalize_current_transfer(struct spi_controller *ctlr); | 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 | /* the spi driver core manages memory for the spi_controller classdev */ | 697 | /* the spi driver core manages memory for the spi_controller classdev */ |
| 648 | extern struct spi_controller *__spi_alloc_controller(struct device *host, | 698 | extern struct spi_controller *__spi_alloc_controller(struct device *host, |
| 649 | unsigned int size, bool slave); | 699 | unsigned int size, bool slave); |
| @@ -739,13 +789,13 @@ extern void spi_res_release(struct spi_controller *ctlr, · 89 unmodified lines | |||
| 739 | * @cs_change: affects chipselect after this transfer completes | 789 | * @cs_change: affects chipselect after this transfer completes |
| 740 | * @cs_change_delay: delay between cs deassert and assert when | 790 | * @cs_change_delay: delay between cs deassert and assert when |
| 741 | * @cs_change is set and @spi_transfer is not the last in @spi_message | 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 | * @delay_usecs: microseconds to delay after this transfer before | 795 | * @delay_usecs: microseconds to delay after this transfer before |
| 744 | * (optionally) changing the chipselect status, then starting | 796 | * (optionally) changing the chipselect status, then starting |
| 745 | * the next transfer or completing this @spi_message. | 797 | * the next transfer or completing this @spi_message. |
| 746 | * @word_delay_usecs: microseconds to inter word delay after each word size | 798 | * @word_delay: inter word delay to be introduced after each word size |
| 747 | * (set by bits_per_word) transmission. | ||
| 748 | * @word_delay: clock cycles to inter word delay after each word size | ||
| 749 | * (set by bits_per_word) transmission. | 799 | * (set by bits_per_word) transmission. |
| 750 | * @effective_speed_hz: the effective SCK-speed that was used to | 800 | * @effective_speed_hz: the effective SCK-speed that was used to |
| 751 | * transfer this transfer. Set to 0 if the spi bus driver does | 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 | * @transfer_list: transfers are sequenced through @spi_message.transfers | 803 | * @transfer_list: transfers are sequenced through @spi_message.transfers |
| 754 | * @tx_sg: Scatterlist for transmit, currently not for client use | 804 | * @tx_sg: Scatterlist for transmit, currently not for client use |
| 755 | * @rx_sg: Scatterlist for receive, currently not for client use | 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 | * SPI transfers always write the same number of bytes as they read. | 836 | * SPI transfers always write the same number of bytes as they read. |
| 758 | * Protocol drivers should always provide @rx_buf and/or @tx_buf. | 837 | * Protocol drivers should always provide @rx_buf and/or @tx_buf. |
| @@ -830,18 +909,22 @@ struct spi_transfer { · 71 unmodified lines | |||
| 830 | #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ | 909 | #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ |
| 831 | #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ | 910 | #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ |
| 832 | u8 bits_per_word; | 911 | u8 bits_per_word; |
| 833 | u8 word_delay_usecs; | ||
| 834 | u16 delay_usecs; | 912 | u16 delay_usecs; |
| 835 | u16 cs_change_delay; | 913 | struct spi_delay delay; |
| 836 | u8 cs_change_delay_unit; | 914 | struct spi_delay cs_change_delay; |
| 837 | #define SPI_DELAY_UNIT_USECS 0 | 915 | struct spi_delay word_delay; |
| 838 | #define SPI_DELAY_UNIT_NSECS 1 | ||
| 839 | #define SPI_DELAY_UNIT_SCK 2 | ||
| 840 | u32 speed_hz; | 916 | u32 speed_hz; |
| 841 | u16 word_delay; | ||
| 842 | 917 | ||
| 843 | u32 effective_speed_hz; | 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 | struct list_head transfer_list; | 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 | list_del(&t->transfer_list); | 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 | * spi_message_init_with_transfers - Initialize spi_message and append transfers | 1036 | * spi_message_init_with_transfers - Initialize spi_message and append transfers |
| 940 | * @m: spi_message to be initialized | 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 | kfree(m); | 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 | extern int spi_setup(struct spi_device *spi); | 1087 | extern int spi_setup(struct spi_device *spi); |
| 988 | extern int spi_async(struct spi_device *spi, struct spi_message *message); | 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 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 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 | do_raw_spin_unlock(lock); | 151 | do_raw_spin_unlock(lock); |
| 152 | preempt_enable(); | 152 | preempt_enable(); |
| 153 | } | 153 | } |
| @@ -155,7 +155,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) · 1 unmodified line | |||
| 155 | static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, | 155 | static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, |
| 156 | unsigned long flags) | 156 | unsigned long flags) |
| 157 | { | 157 | { |
| 158 | spin_release(&lock->dep_map, 1, _RET_IP_); | 158 | spin_release(&lock->dep_map, _RET_IP_); |
| 159 | do_raw_spin_unlock(lock); | 159 | do_raw_spin_unlock(lock); |
| 160 | local_irq_restore(flags); | 160 | local_irq_restore(flags); |
| 161 | preempt_enable(); | 161 | preempt_enable(); |
| @@ -163,7 +163,7 @@ static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, · 1 unmodified line | |||
| 163 | 163 | ||
| 164 | static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock) | 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 | do_raw_spin_unlock(lock); | 167 | do_raw_spin_unlock(lock); |
| 168 | local_irq_enable(); | 168 | local_irq_enable(); |
| 169 | preempt_enable(); | 169 | preempt_enable(); |
| @@ -171,7 +171,7 @@ static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock) · 1 unmodified line | |||
| 171 | 171 | ||
| 172 | static inline void __raw_spin_unlock_bh(raw_spinlock_t *lock) | 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 | do_raw_spin_unlock(lock); | 175 | do_raw_spin_unlock(lock); |
| 176 | __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); | 176 | __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); |
| 177 | } | 177 | } |
| @@ -33,7 +33,8 @@ struct kstat { · 32 unmodified lines | |||
| 33 | STATX_ATTR_IMMUTABLE | \ | 33 | STATX_ATTR_IMMUTABLE | \ |
| 34 | STATX_ATTR_APPEND | \ | 34 | STATX_ATTR_APPEND | \ |
| 35 | STATX_ATTR_NODUMP | \ | 35 | STATX_ATTR_NODUMP | \ |
| 36 | STATX_ATTR_ENCRYPTED \ | 36 | STATX_ATTR_ENCRYPTED | \ |
| 37 | STATX_ATTR_VERITY \ | ||
| 37 | )/* Attrs corresponding to FS_*_FL flags */ | 38 | )/* Attrs corresponding to FS_*_FL flags */ |
| 38 | u64 ino; | 39 | u64 ino; |
| 39 | dev_t dev; | 40 | dev_t dev; |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #define __STMMAC_PLATFORM_DATA | 13 | #define __STMMAC_PLATFORM_DATA |
| 14 | 14 | ||
| 15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/phy.h> | ||
| 16 | 17 | ||
| 17 | #define MTL_MAX_RX_QUEUES 8 | 18 | #define MTL_MAX_RX_QUEUES 8 |
| 18 | #define MTL_MAX_TX_QUEUES 8 | 19 | #define MTL_MAX_TX_QUEUES 8 |
| @@ -92,6 +93,7 @@ struct stmmac_dma_cfg { · 73 unmodified lines | |||
| 92 | int fixed_burst; | 93 | int fixed_burst; |
| 93 | int mixed_burst; | 94 | int mixed_burst; |
| 94 | bool aal; | 95 | bool aal; |
| 96 | bool eame; | ||
| 95 | }; | 97 | }; |
| 96 | 98 | ||
| 97 | #define AXI_BLEN 7 | 99 | #define AXI_BLEN 7 |
| @@ -131,7 +133,7 @@ struct plat_stmmacenet_data { · 33 unmodified lines | |||
| 131 | int bus_id; | 133 | int bus_id; |
| 132 | int phy_addr; | 134 | int phy_addr; |
| 133 | int interface; | 135 | int interface; |
| 134 | int phy_interface; | 136 | phy_interface_t phy_interface; |
| 135 | struct stmmac_mdio_bus_data *mdio_bus_data; | 137 | struct stmmac_mdio_bus_data *mdio_bus_data; |
| 136 | struct device_node *phy_node; | 138 | struct device_node *phy_node; |
| 137 | struct device_node *phylink_node; | 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 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | 216 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
| 217 | const void *from, size_t available); | 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 | * strstarts - does @str start with @prefix? | 222 | * strstarts - does @str start with @prefix? |
| 221 | * @str: string to examine | 223 | * @str: string to examine |
| @@ -10,8 +10,6 @@ · 9 unmodified lines | |||
| 10 | #ifndef _LINUX_SUNRPC_AUTH_H | 10 | #ifndef _LINUX_SUNRPC_AUTH_H |
| 11 | #define _LINUX_SUNRPC_AUTH_H | 11 | #define _LINUX_SUNRPC_AUTH_H |
| 12 | 12 | ||
| 13 | #ifdef __KERNEL__ | ||
| 14 | |||
| 15 | #include <linux/sunrpc/sched.h> | 13 | #include <linux/sunrpc/sched.h> |
| 16 | #include <linux/sunrpc/msg_prot.h> | 14 | #include <linux/sunrpc/msg_prot.h> |
| 17 | #include <linux/sunrpc/xdr.h> | 15 | #include <linux/sunrpc/xdr.h> |
| @@ -194,5 +192,4 @@ struct rpc_cred *get_rpccred(struct rpc_cred *cred) · 176 unmodified lines | |||
| 194 | return NULL; | 192 | return NULL; |
| 195 | } | 193 | } |
| 196 | 194 | ||
| 197 | #endif /* __KERNEL__ */ | ||
| 198 | #endif /* _LINUX_SUNRPC_AUTH_H */ | 195 | #endif /* _LINUX_SUNRPC_AUTH_H */ |
| @@ -13,7 +13,6 @@ · 12 unmodified lines | |||
| 13 | #ifndef _LINUX_SUNRPC_AUTH_GSS_H | 13 | #ifndef _LINUX_SUNRPC_AUTH_GSS_H |
| 14 | #define _LINUX_SUNRPC_AUTH_GSS_H | 14 | #define _LINUX_SUNRPC_AUTH_GSS_H |
| 15 | 15 | ||
| 16 | #ifdef __KERNEL__ | ||
| 17 | #include <linux/refcount.h> | 16 | #include <linux/refcount.h> |
| 18 | #include <linux/sunrpc/auth.h> | 17 | #include <linux/sunrpc/auth.h> |
| 19 | #include <linux/sunrpc/svc.h> | 18 | #include <linux/sunrpc/svc.h> |
| @@ -90,6 +89,5 @@ struct gss_cred { · 70 unmodified lines | |||
| 90 | unsigned long gc_upcall_timestamp; | 89 | unsigned long gc_upcall_timestamp; |
| 91 | }; | 90 | }; |
| 92 | 91 | ||
| 93 | #endif /* __KERNEL__ */ | ||
| 94 | #endif /* _LINUX_SUNRPC_AUTH_GSS_H */ | 92 | #endif /* _LINUX_SUNRPC_AUTH_GSS_H */ |
| 95 | 93 | ||
| @@ -109,8 +109,6 @@ struct rpc_procinfo { · 108 unmodified lines | |||
| 109 | const char * p_name; /* name of procedure */ | 109 | const char * p_name; /* name of procedure */ |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | #ifdef __KERNEL__ | ||
| 113 | |||
| 114 | struct rpc_create_args { | 112 | struct rpc_create_args { |
| 115 | struct net *net; | 113 | struct net *net; |
| 116 | int protocol; | 114 | int protocol; |
| @@ -149,6 +147,7 @@ struct rpc_add_xprt_test { · 32 unmodified lines | |||
| 149 | #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) | 147 | #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) |
| 150 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) | 148 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) |
| 151 | #define RPC_CLNT_CREATE_SOFTERR (1UL << 10) | 149 | #define RPC_CLNT_CREATE_SOFTERR (1UL << 10) |
| 150 | #define RPC_CLNT_CREATE_REUSEPORT (1UL << 11) | ||
| 152 | 151 | ||
| 153 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | 152 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
| 154 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 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 | (task->tk_msg.rpc_proc->p_decode != NULL); | 236 | (task->tk_msg.rpc_proc->p_decode != NULL); |
| 238 | } | 237 | } |
| 239 | 238 | ||
| 240 | #endif /* __KERNEL__ */ | ||
| 241 | #endif /* _LINUX_SUNRPC_CLNT_H */ | 239 | #endif /* _LINUX_SUNRPC_CLNT_H */ |
| @@ -13,7 +13,6 @@ · 12 unmodified lines | |||
| 13 | #ifndef _LINUX_SUNRPC_GSS_API_H | 13 | #ifndef _LINUX_SUNRPC_GSS_API_H |
| 14 | #define _LINUX_SUNRPC_GSS_API_H | 14 | #define _LINUX_SUNRPC_GSS_API_H |
| 15 | 15 | ||
| 16 | #ifdef __KERNEL__ | ||
| 17 | #include <linux/sunrpc/xdr.h> | 16 | #include <linux/sunrpc/xdr.h> |
| 18 | #include <linux/sunrpc/msg_prot.h> | 17 | #include <linux/sunrpc/msg_prot.h> |
| 19 | #include <linux/uio.h> | 18 | #include <linux/uio.h> |
| @@ -160,6 +159,5 @@ struct gss_api_mech * gss_mech_get(struct gss_api_mech *); · 140 unmodified lines | |||
| 160 | * corresponding call to gss_mech_put. */ | 159 | * corresponding call to gss_mech_put. */ |
| 161 | void gss_mech_put(struct gss_api_mech *); | 160 | void gss_mech_put(struct gss_api_mech *); |
| 162 | 161 | ||
| 163 | #endif /* __KERNEL__ */ | ||
| 164 | #endif /* _LINUX_SUNRPC_GSS_API_H */ | 162 | #endif /* _LINUX_SUNRPC_GSS_API_H */ |
| 165 | 163 | ||
| @@ -34,8 +34,6 @@ · 33 unmodified lines | |||
| 34 | #ifndef _LINUX_SUNRPC_GSS_ERR_H | 34 | #ifndef _LINUX_SUNRPC_GSS_ERR_H |
| 35 | #define _LINUX_SUNRPC_GSS_ERR_H | 35 | #define _LINUX_SUNRPC_GSS_ERR_H |
| 36 | 36 | ||
| 37 | #ifdef __KERNEL__ | ||
| 38 | |||
| 39 | typedef unsigned int OM_uint32; | 37 | typedef unsigned int OM_uint32; |
| 40 | 38 | ||
| 41 | /* | 39 | /* |
| @@ -163,5 +161,4 @@ typedef unsigned int OM_uint32; · 121 unmodified lines | |||
| 163 | /* XXXX This is a necessary evil until the spec is fixed */ | 161 | /* XXXX This is a necessary evil until the spec is fixed */ |
| 164 | #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE | 162 | #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE |
| 165 | 163 | ||
| 166 | #endif /* __KERNEL__ */ | ||
| 167 | #endif /* __LINUX_SUNRPC_GSS_ERR_H */ | 164 | #endif /* __LINUX_SUNRPC_GSS_ERR_H */ |
| @@ -8,8 +8,6 @@ · 7 unmodified lines | |||
| 8 | #ifndef _LINUX_SUNRPC_MSGPROT_H_ | 8 | #ifndef _LINUX_SUNRPC_MSGPROT_H_ |
| 9 | #define _LINUX_SUNRPC_MSGPROT_H_ | 9 | #define _LINUX_SUNRPC_MSGPROT_H_ |
| 10 | 10 | ||
| 11 | #ifdef __KERNEL__ /* user programs should get these from the rpc header files */ | ||
| 12 | |||
| 13 | #define RPC_VERSION 2 | 11 | #define RPC_VERSION 2 |
| 14 | 12 | ||
| 15 | /* size of an XDR encoding unit in bytes, i.e. 32bit */ | 13 | /* size of an XDR encoding unit in bytes, i.e. 32bit */ |
| @@ -217,5 +215,4 @@ typedef __be32 rpc_fraghdr; · 201 unmodified lines | |||
| 217 | /* Assume INET6_ADDRSTRLEN will always be larger than INET_ADDRSTRLEN... */ | 215 | /* Assume INET6_ADDRSTRLEN will always be larger than INET_ADDRSTRLEN... */ |
| 218 | #define RPCBIND_MAXUADDRLEN RPCBIND_MAXUADDR6LEN | 216 | #define RPCBIND_MAXUADDRLEN RPCBIND_MAXUADDR6LEN |
| 219 | 217 | ||
| 220 | #endif /* __KERNEL__ */ | ||
| 221 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ | 218 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ |
| @@ -2,8 +2,6 @@ · 1 unmodified line | |||
| 2 | #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H | 2 | #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H |
| 3 | #define _LINUX_SUNRPC_RPC_PIPE_FS_H | 3 | #define _LINUX_SUNRPC_RPC_PIPE_FS_H |
| 4 | 4 | ||
| 5 | #ifdef __KERNEL__ | ||
| 6 | |||
| 7 | #include <linux/workqueue.h> | 5 | #include <linux/workqueue.h> |
| 8 | 6 | ||
| 9 | struct rpc_pipe_dir_head { | 7 | struct rpc_pipe_dir_head { |
| @@ -133,4 +131,3 @@ extern void unregister_rpc_pipefs(void); · 123 unmodified lines | |||
| 133 | extern bool gssd_running(struct net *net); | 131 | extern bool gssd_running(struct net *net); |
| 134 | 132 | ||
| 135 | #endif | 133 | #endif |
| 136 | #endif | ||
| @@ -10,8 +10,6 @@ · 9 unmodified lines | |||
| 10 | #ifndef _LINUX_SUNRPC_SVCAUTH_H_ | 10 | #ifndef _LINUX_SUNRPC_SVCAUTH_H_ |
| 11 | #define _LINUX_SUNRPC_SVCAUTH_H_ | 11 | #define _LINUX_SUNRPC_SVCAUTH_H_ |
| 12 | 12 | ||
| 13 | #ifdef __KERNEL__ | ||
| 14 | |||
| 15 | #include <linux/string.h> | 13 | #include <linux/string.h> |
| 16 | #include <linux/sunrpc/msg_prot.h> | 14 | #include <linux/sunrpc/msg_prot.h> |
| 17 | #include <linux/sunrpc/cache.h> | 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 | return full_name_hash(NULL, buf, length) >> (32 - bits); | 183 | return full_name_hash(NULL, buf, length) >> (32 - bits); |
| 186 | } | 184 | } |
| 187 | 185 | ||
| 188 | #endif /* __KERNEL__ */ | ||
| 189 | |||
| 190 | #endif /* _LINUX_SUNRPC_SVCAUTH_H_ */ | 186 | #endif /* _LINUX_SUNRPC_SVCAUTH_H_ */ |
| @@ -9,7 +9,6 @@ · 8 unmodified lines | |||
| 9 | #ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H | 9 | #ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H |
| 10 | #define _LINUX_SUNRPC_SVCAUTH_GSS_H | 10 | #define _LINUX_SUNRPC_SVCAUTH_GSS_H |
| 11 | 11 | ||
| 12 | #ifdef __KERNEL__ | ||
| 13 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
| 14 | #include <linux/sunrpc/types.h> | 13 | #include <linux/sunrpc/types.h> |
| 15 | #include <linux/sunrpc/xdr.h> | 14 | #include <linux/sunrpc/xdr.h> |
| @@ -24,5 +23,4 @@ void gss_svc_shutdown_net(struct net *net); · 8 unmodified lines | |||
| 24 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); | 23 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); |
| 25 | u32 svcauth_gss_flavor(struct auth_domain *dom); | 24 | u32 svcauth_gss_flavor(struct auth_domain *dom); |
| 26 | 25 | ||
| 27 | #endif /* __KERNEL__ */ | ||
| 28 | #endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ | 26 | #endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ |
| @@ -11,8 +11,6 @@ · 10 unmodified lines | |||
| 11 | #ifndef _SUNRPC_XDR_H_ | 11 | #ifndef _SUNRPC_XDR_H_ |
| 12 | #define _SUNRPC_XDR_H_ | 12 | #define _SUNRPC_XDR_H_ |
| 13 | 13 | ||
| 14 | #ifdef __KERNEL__ | ||
| 15 | |||
| 16 | #include <linux/uio.h> | 14 | #include <linux/uio.h> |
| 17 | #include <asm/byteorder.h> | 15 | #include <asm/byteorder.h> |
| 18 | #include <asm/unaligned.h> | 16 | #include <asm/unaligned.h> |
| @@ -552,6 +550,5 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr, · 533 unmodified lines | |||
| 552 | *array = be32_to_cpup(p); | 550 | *array = be32_to_cpup(p); |
| 553 | return retval; | 551 | return retval; |
| 554 | } | 552 | } |
| 555 | #endif /* __KERNEL__ */ | ||
| 556 | 553 | ||
| 557 | #endif /* _SUNRPC_XDR_H_ */ | 554 | #endif /* _SUNRPC_XDR_H_ */ |
| @@ -19,8 +19,6 @@ · 18 unmodified lines | |||
| 19 | #include <linux/sunrpc/xdr.h> | 19 | #include <linux/sunrpc/xdr.h> |
| 20 | #include <linux/sunrpc/msg_prot.h> | 20 | #include <linux/sunrpc/msg_prot.h> |
| 21 | 21 | ||
| 22 | #ifdef __KERNEL__ | ||
| 23 | |||
| 24 | #define RPC_MIN_SLOT_TABLE (2U) | 22 | #define RPC_MIN_SLOT_TABLE (2U) |
| 25 | #define RPC_DEF_SLOT_TABLE (16U) | 23 | #define RPC_DEF_SLOT_TABLE (16U) |
| 26 | #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) | 24 | #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) |
| @@ -207,7 +205,8 @@ struct rpc_xprt { · 180 unmodified lines | |||
| 207 | unsigned int min_reqs; /* min number of slots */ | 205 | unsigned int min_reqs; /* min number of slots */ |
| 208 | unsigned int num_reqs; /* total slots */ | 206 | unsigned int num_reqs; /* total slots */ |
| 209 | unsigned long state; /* transport state */ | 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 | atomic_t swapper; /* we're swapping over this | 210 | atomic_t swapper; /* we're swapping over this |
| 212 | transport */ | 211 | transport */ |
| 213 | unsigned int bind_index; /* bind function index */ | 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 | #endif | 505 | #endif |
| 507 | 506 | ||
| 508 | #endif /* __KERNEL__*/ | ||
| 509 | |||
| 510 | #endif /* _LINUX_SUNRPC_XPRT_H */ | 507 | #endif /* _LINUX_SUNRPC_XPRT_H */ |
| @@ -8,8 +8,6 @@ · 7 unmodified lines | |||
| 8 | #ifndef _LINUX_SUNRPC_XPRTSOCK_H | 8 | #ifndef _LINUX_SUNRPC_XPRTSOCK_H |
| 9 | #define _LINUX_SUNRPC_XPRTSOCK_H | 9 | #define _LINUX_SUNRPC_XPRTSOCK_H |
| 10 | 10 | ||
| 11 | #ifdef __KERNEL__ | ||
| 12 | |||
| 13 | int init_socket_xprt(void); | 11 | int init_socket_xprt(void); |
| 14 | void cleanup_socket_xprt(void); | 12 | void cleanup_socket_xprt(void); |
| 15 | 13 | ||
| @@ -91,6 +89,4 @@ struct sock_xprt { · 75 unmodified lines | |||
| 91 | #define XPRT_SOCK_WAKE_PENDING (6) | 89 | #define XPRT_SOCK_WAKE_PENDING (6) |
| 92 | #define XPRT_SOCK_WAKE_DISCONNECT (7) | 90 | #define XPRT_SOCK_WAKE_DISCONNECT (7) |
| 93 | 91 | ||
| 94 | #endif /* __KERNEL__ */ | ||
| 95 | |||
| 96 | #endif /* _LINUX_SUNRPC_XPRTSOCK_H */ | 92 | #endif /* _LINUX_SUNRPC_XPRTSOCK_H */ |
| @@ -307,7 +307,7 @@ struct vma_swap_readahead { · 306 unmodified lines | |||
| 307 | }; | 307 | }; |
| 308 | 308 | ||
| 309 | /* linux/mm/workingset.c */ | 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 | void workingset_refault(struct page *page, void *shadow); | 311 | void workingset_refault(struct page *page, void *shadow); |
| 312 | void workingset_activation(struct page *page); | 312 | void workingset_activation(struct page *page); |
| 313 | 313 | ||
| @@ -10,6 +10,8 @@ · 9 unmodified lines | |||
| 10 | #ifndef __SXGBE_PLATFORM_H__ | 10 | #ifndef __SXGBE_PLATFORM_H__ |
| 11 | #define __SXGBE_PLATFORM_H__ | 11 | #define __SXGBE_PLATFORM_H__ |
| 12 | 12 | ||
| 13 | #include <linux/phy.h> | ||
| 14 | |||
| 13 | /* MDC Clock Selection define*/ | 15 | /* MDC Clock Selection define*/ |
| 14 | #define SXGBE_CSR_100_150M 0x0 /* MDC = clk_scr_i/62 */ | 16 | #define SXGBE_CSR_100_150M 0x0 /* MDC = clk_scr_i/62 */ |
| 15 | #define SXGBE_CSR_150_250M 0x1 /* MDC = clk_scr_i/102 */ | 17 | #define SXGBE_CSR_150_250M 0x1 /* MDC = clk_scr_i/102 */ |
| @@ -38,7 +40,7 @@ struct sxgbe_plat_data { · 22 unmodified lines | |||
| 38 | char *phy_bus_name; | 40 | char *phy_bus_name; |
| 39 | int bus_id; | 41 | int bus_id; |
| 40 | int phy_addr; | 42 | int phy_addr; |
| 41 | int interface; | 43 | phy_interface_t interface; |
| 42 | struct sxgbe_mdio_bus_data *mdio_bus_data; | 44 | struct sxgbe_mdio_bus_data *mdio_bus_data; |
| 43 | struct sxgbe_dma_cfg *dma_cfg; | 45 | struct sxgbe_dma_cfg *dma_cfg; |
| 44 | int clk_csr; | 46 | int clk_csr; |
| @@ -15,6 +15,7 @@ struct soc_device_attribute { · 14 unmodified lines | |||
| 15 | const char *serial_number; | 15 | const char *serial_number; |
| 16 | const char *soc_id; | 16 | const char *soc_id; |
| 17 | const void *data; | 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 | struct __sysctl_args; | 51 | struct __sysctl_args; |
| 52 | struct sysinfo; | 52 | struct sysinfo; |
| 53 | struct timespec; | 53 | struct timespec; |
| 54 | struct timeval; | 54 | struct __kernel_old_timeval; |
| 55 | struct __kernel_timex; | 55 | struct __kernel_timex; |
| 56 | struct timezone; | 56 | struct timezone; |
| 57 | struct tms; | 57 | struct tms; |
| @@ -732,9 +732,9 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, · 674 unmodified lines | |||
| 732 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); | 732 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); |
| 733 | 733 | ||
| 734 | /* kernel/time.c */ | 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 | struct timezone __user *tz); | 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 | struct timezone __user *tz); | 738 | struct timezone __user *tz); |
| 739 | asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p); | 739 | asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p); |
| 740 | asmlinkage long sys_adjtimex_time32(struct old_timex32 __user *txc_p); | 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 | asmlinkage long sys_alarm(unsigned int seconds); | 1076 | asmlinkage long sys_alarm(unsigned int seconds); |
| 1077 | asmlinkage long sys_getpgrp(void); | 1077 | asmlinkage long sys_getpgrp(void); |
| 1078 | asmlinkage long sys_pause(void); | 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 | asmlinkage long sys_time32(old_time32_t __user *tloc); | 1080 | asmlinkage long sys_time32(old_time32_t __user *tloc); |
| 1081 | #ifdef __ARCH_WANT_SYS_UTIME | 1081 | #ifdef __ARCH_WANT_SYS_UTIME |
| 1082 | asmlinkage long sys_utime(char __user *filename, | 1082 | asmlinkage long sys_utime(char __user *filename, |
| 1083 | struct utimbuf __user *times); | 1083 | struct utimbuf __user *times); |
| 1084 | asmlinkage long sys_utimes(char __user *filename, | 1084 | asmlinkage long sys_utimes(char __user *filename, |
| 1085 | struct timeval __user *utimes); | 1085 | struct __kernel_old_timeval __user *utimes); |
| 1086 | asmlinkage long sys_futimesat(int dfd, const char __user *filename, | 1086 | asmlinkage long sys_futimesat(int dfd, const char __user *filename, |
| 1087 | struct timeval __user *utimes); | 1087 | struct __kernel_old_timeval __user *utimes); |
| 1088 | #endif | 1088 | #endif |
| 1089 | asmlinkage long sys_futimesat_time32(unsigned int dfd, | 1089 | asmlinkage long sys_futimesat_time32(unsigned int dfd, |
| 1090 | const char __user *filename, | 1090 | const char __user *filename, |
| @@ -1098,7 +1098,7 @@ asmlinkage long sys_getdents(unsigned int fd, · 7 unmodified lines | |||
| 1098 | struct linux_dirent __user *dirent, | 1098 | struct linux_dirent __user *dirent, |
| 1099 | unsigned int count); | 1099 | unsigned int count); |
| 1100 | asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, | 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 | asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, | 1102 | asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, |
| 1103 | int timeout); | 1103 | int timeout); |
| 1104 | asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, | 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 | asmlinkage long sys_fork(void); | 1116 | asmlinkage long sys_fork(void); |
| 1117 | 1117 | ||
| 1118 | /* obsolete: kernel/time/time.c */ | 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 | asmlinkage long sys_stime32(old_time32_t __user *tptr); | 1120 | asmlinkage long sys_stime32(old_time32_t __user *tptr); |
| 1121 | 1121 | ||
| 1122 | /* obsolete: kernel/signal.c */ | 1122 | /* obsolete: kernel/signal.c */ |
| @@ -1231,10 +1231,7 @@ asmlinkage long sys_ni_syscall(void); · 108 unmodified lines | |||
| 1231 | * the ksys_xyzyyz() functions prototyped below. | 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 | int ksys_umount(char __user *name, int flags); | 1234 | int ksys_umount(char __user *name, int flags); |
| 1237 | int ksys_dup(unsigned int fildes); | ||
| 1238 | int ksys_chroot(const char __user *filename); | 1235 | int ksys_chroot(const char __user *filename); |
| 1239 | ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count); | 1236 | ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count); |
| 1240 | int ksys_chdir(const char __user *filename); | 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 | struct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name) | 120 | struct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name) |
| 121 | 121 | ||
| 122 | /* A sysctl table is an array of struct ctl_table: */ | 122 | /* A sysctl table is an array of struct ctl_table: */ |
| 123 | struct ctl_table | 123 | struct ctl_table { |
| 124 | { | ||
| 125 | const char *procname; /* Text ID for /proc/sys, or zero */ | 124 | const char *procname; /* Text ID for /proc/sys, or zero */ |
| 126 | void *data; | 125 | void *data; |
| 127 | int maxlen; | 126 | int maxlen; |
| @@ -140,8 +139,7 @@ struct ctl_node { · 12 unmodified lines | |||
| 140 | 139 | ||
| 141 | /* struct ctl_table_header is used to maintain dynamic lists of | 140 | /* struct ctl_table_header is used to maintain dynamic lists of |
| 142 | struct ctl_table trees. */ | 141 | struct ctl_table trees. */ |
| 143 | struct ctl_table_header | 142 | struct ctl_table_header { |
| 144 | { | ||
| 145 | union { | 143 | union { |
| 146 | struct { | 144 | struct { |
| 147 | struct ctl_table *ctl_table; | 145 | struct ctl_table *ctl_table; |
| @@ -223,7 +223,7 @@ struct tcp_sock { · 222 unmodified lines | |||
| 223 | fastopen_connect:1, /* FASTOPEN_CONNECT sockopt */ | 223 | fastopen_connect:1, /* FASTOPEN_CONNECT sockopt */ |
| 224 | fastopen_no_cookie:1, /* Allow send/recv SYN+data without a cookie */ | 224 | fastopen_no_cookie:1, /* Allow send/recv SYN+data without a cookie */ |
| 225 | is_sack_reneg:1, /* in recovery from loss with SACK reneg? */ | 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 | u8 nonagle : 4,/* Disable Nagle algorithm? */ | 227 | u8 nonagle : 4,/* Disable Nagle algorithm? */ |
| 228 | thin_lto : 1,/* Use linear timeouts for thin streams */ | 228 | thin_lto : 1,/* Use linear timeouts for thin streams */ |
| 229 | recvmsg_inq : 1,/* Indicate # of bytes in queue upon recvmsg */ | 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 | #endif /* CONFIG_THERMAL */ | 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 | #endif /* __THERMAL_H__ */ | 547 | #endif /* __THERMAL_H__ */ |
| @@ -147,6 +147,8 @@ check_copy_size(const void *addr, size_t bytes, bool is_source) · 146 unmodified lines | |||
| 147 | __bad_copy_to(); | 147 | __bad_copy_to(); |
| 148 | return false; | 148 | return false; |
| 149 | } | 149 | } |
| 150 | if (WARN_ON_ONCE(bytes > INT_MAX)) | ||
| 151 | return false; | ||
| 150 | check_object_size(addr, bytes, is_source); | 152 | check_object_size(addr, bytes, is_source); |
| 151 | return true; | 153 | return true; |
| 152 | } | 154 | } |
| @@ -108,7 +108,8 @@ enum tick_dep_bits { · 107 unmodified lines | |||
| 108 | TICK_DEP_BIT_POSIX_TIMER = 0, | 108 | TICK_DEP_BIT_POSIX_TIMER = 0, |
| 109 | TICK_DEP_BIT_PERF_EVENTS = 1, | 109 | TICK_DEP_BIT_PERF_EVENTS = 1, |
| 110 | TICK_DEP_BIT_SCHED = 2, | 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 | #define TICK_DEP_MASK_NONE 0 | 115 | #define TICK_DEP_MASK_NONE 0 |
| @@ -116,6 +117,7 @@ enum tick_dep_bits { · 1 unmodified line | |||
| 116 | #define TICK_DEP_MASK_PERF_EVENTS (1 << TICK_DEP_BIT_PERF_EVENTS) | 117 | #define TICK_DEP_MASK_PERF_EVENTS (1 << TICK_DEP_BIT_PERF_EVENTS) |
| 117 | #define TICK_DEP_MASK_SCHED (1 << TICK_DEP_BIT_SCHED) | 118 | #define TICK_DEP_MASK_SCHED (1 << TICK_DEP_BIT_SCHED) |
| 118 | #define TICK_DEP_MASK_CLOCK_UNSTABLE (1 << TICK_DEP_BIT_CLOCK_UNSTABLE) | 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 | #ifdef CONFIG_NO_HZ_COMMON | 122 | #ifdef CONFIG_NO_HZ_COMMON |
| 121 | extern bool tick_nohz_enabled; | 123 | extern bool tick_nohz_enabled; |
| @@ -174,7 +176,7 @@ extern cpumask_var_t tick_nohz_full_mask; · 52 unmodified lines | |||
| 174 | 176 | ||
| 175 | static inline bool tick_nohz_full_enabled(void) | 177 | static inline bool tick_nohz_full_enabled(void) |
| 176 | { | 178 | { |
| 177 | if (!context_tracking_is_enabled()) | 179 | if (!context_tracking_enabled()) |
| 178 | return false; | 180 | return false; |
| 179 | 181 | ||
| 180 | return tick_nohz_full_running; | 182 | return tick_nohz_full_running; |
| @@ -268,6 +270,9 @@ static inline bool tick_nohz_full_enabled(void) { return false; } · 87 unmodified lines | |||
| 268 | static inline bool tick_nohz_full_cpu(int cpu) { return false; } | 270 | static inline bool tick_nohz_full_cpu(int cpu) { return false; } |
| 269 | static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { } | 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 | static inline void tick_dep_set(enum tick_dep_bits bit) { } | 276 | static inline void tick_dep_set(enum tick_dep_bits bit) { } |
| 272 | static inline void tick_dep_clear(enum tick_dep_bits bit) { } | 277 | static inline void tick_dep_clear(enum tick_dep_bits bit) { } |
| 273 | static inline void tick_dep_set_cpu(int cpu, enum tick_dep_bits bit) { } | 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 | extern u32 (*arch_gettimeoffset)(void); | 35 | extern u32 (*arch_gettimeoffset)(void); |
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | struct itimerval; | 38 | #ifdef CONFIG_POSIX_TIMERS |
| 39 | extern int do_setitimer(int which, struct itimerval *value, | 39 | extern void clear_itimer(void); |
| 40 | struct itimerval *ovalue); | 40 | #else |
| 41 | extern int do_getitimer(int which, struct itimerval *value); | 41 | static inline void clear_itimer(void) {} |
| 42 | #endif | ||
| 42 | 43 | ||
| 43 | extern long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, int flags); | 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 | #define time_after32(a, b) ((s32)((u32)(b) - (u32)(a)) < 0) | 98 | #define time_after32(a, b) ((s32)((u32)(b) - (u32)(a)) < 0) |
| 98 | #define time_before32(b, a) time_after32(a, b) | 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 | #endif | 113 | #endif |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/time64.h> | 12 | #include <linux/time64.h> |
| 13 | #include <linux/timex.h> | 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 | typedef s32 old_time32_t; | 17 | typedef s32 old_time32_t; |
| 18 | 18 | ||
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <linux/acpi.h> | 21 | #include <linux/acpi.h> |
| 22 | #include <linux/cdev.h> | 22 | #include <linux/cdev.h> |
| 23 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
| 24 | #include <linux/highmem.h> | ||
| 24 | #include <crypto/hash_info.h> | 25 | #include <crypto/hash_info.h> |
| 25 | 26 | ||
| 26 | #define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */ | 27 | #define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */ |
| @@ -67,6 +68,8 @@ struct tpm_class_ops { · 40 unmodified lines | |||
| 67 | u8 (*status) (struct tpm_chip *chip); | 68 | u8 (*status) (struct tpm_chip *chip); |
| 68 | void (*update_timeouts)(struct tpm_chip *chip, | 69 | void (*update_timeouts)(struct tpm_chip *chip, |
| 69 | unsigned long *timeout_cap); | 70 | unsigned long *timeout_cap); |
| 71 | void (*update_durations)(struct tpm_chip *chip, | ||
| 72 | unsigned long *duration_cap); | ||
| 70 | int (*go_idle)(struct tpm_chip *chip); | 73 | int (*go_idle)(struct tpm_chip *chip); |
| 71 | int (*cmd_ready)(struct tpm_chip *chip); | 74 | int (*cmd_ready)(struct tpm_chip *chip); |
| 72 | int (*request_locality)(struct tpm_chip *chip, int loc); | 75 | int (*request_locality)(struct tpm_chip *chip, int loc); |
| @@ -161,6 +164,235 @@ struct tpm_chip { · 88 unmodified lines | |||
| 161 | int locality; | 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 | #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) | 396 | #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) |
| 165 | 397 | ||
| 166 | extern int tpm_is_tpm2(struct tpm_chip *chip); | 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 | struct tpm_digest *digests); | 402 | struct tpm_digest *digests); |
| 171 | extern int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen); | 403 | extern int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen); |
| 172 | extern int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max); | 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 | extern struct tpm_chip *tpm_default_chip(void); | 405 | extern struct tpm_chip *tpm_default_chip(void); |
| 406 | void tpm2_flush_context(struct tpm_chip *chip, u32 handle); | ||
| 180 | #else | 407 | #else |
| 181 | static inline int tpm_is_tpm2(struct tpm_chip *chip) | 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 | return -ENODEV; | 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 | static inline struct tpm_chip *tpm_default_chip(void) | 434 | static inline struct tpm_chip *tpm_default_chip(void) |
| 220 | { | 435 | { |
| 221 | return NULL; | 436 | return NULL; |
| @@ -24,6 +24,14 @@ struct trace_export { · 23 unmodified lines | |||
| 24 | int register_ftrace_export(struct trace_export *export); | 24 | int register_ftrace_export(struct trace_export *export); |
| 25 | int unregister_ftrace_export(struct trace_export *export); | 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 | #endif /* CONFIG_TRACING */ | 35 | #endif /* CONFIG_TRACING */ |
| 28 | 36 | ||
| 29 | #endif /* _LINUX_TRACE_H */ | 37 | #endif /* _LINUX_TRACE_H */ |
| @@ -45,6 +45,11 @@ const char *trace_print_array_seq(struct trace_seq *p, · 44 unmodified lines | |||
| 45 | const void *buf, int count, | 45 | const void *buf, int count, |
| 46 | size_t el_size); | 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 | struct trace_iterator; | 53 | struct trace_iterator; |
| 49 | struct trace_event; | 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 | int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set); | 556 | int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set); |
| 552 | int trace_set_clr_event(const char *system, const char *event, int set); | 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 | * The double __builtin_constant_p is because gcc will give us an error | 561 | * The double __builtin_constant_p is because gcc will give us an error |
| 556 | * if we try to allocate the static variable to fmt if it is not a | 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 | extern void trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, | 92 | extern void trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, |
| 93 | int nmaskbits); | 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 | #else /* CONFIG_TRACING */ | 99 | #else /* CONFIG_TRACING */ |
| 96 | static inline void trace_seq_printf(struct trace_seq *s, const char *fmt, ...) | 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 | #ifndef _TIME_T | 68 | #ifndef _TIME_T |
| 69 | #define _TIME_T | 69 | #define _TIME_T |
| 70 | typedef __kernel_time_t time_t; | 70 | typedef __kernel_old_time_t time_t; |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | #ifndef _CLOCK_T | 73 | #ifndef _CLOCK_T |
| @@ -225,5 +225,10 @@ struct callback_head { · 151 unmodified lines | |||
| 225 | typedef void (*rcu_callback_t)(struct rcu_head *head); | 225 | typedef void (*rcu_callback_t)(struct rcu_head *head); |
| 226 | typedef void (*call_rcu_func_t)(struct rcu_head *head, rcu_callback_t func); | 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 | #endif /* __ASSEMBLY__ */ | 233 | #endif /* __ASSEMBLY__ */ |
| 229 | #endif /* _LINUX_TYPES_H */ | 234 | #endif /* _LINUX_TYPES_H */ |
| @@ -40,8 +40,8 @@ · 39 unmodified lines | |||
| 40 | * spin_lock_bh(...) or other synchronization to get exclusive access | 40 | * spin_lock_bh(...) or other synchronization to get exclusive access |
| 41 | * ... | 41 | * ... |
| 42 | * u64_stats_update_begin(&stats->syncp); | 42 | * u64_stats_update_begin(&stats->syncp); |
| 43 | * stats->bytes64 += len; // non atomic operation | 43 | * u64_stats_add(&stats->bytes64, len); // non atomic operation |
| 44 | * stats->packets64++; // non atomic operation | 44 | * u64_stats_inc(&stats->packets64); // non atomic operation |
| 45 | * u64_stats_update_end(&stats->syncp); | 45 | * u64_stats_update_end(&stats->syncp); |
| 46 | * | 46 | * |
| 47 | * While a consumer (reader) should use following template to get consistent | 47 | * While a consumer (reader) should use following template to get consistent |
| @@ -52,8 +52,8 @@ · 4 unmodified lines | |||
| 52 | * | 52 | * |
| 53 | * do { | 53 | * do { |
| 54 | * start = u64_stats_fetch_begin(&stats->syncp); | 54 | * start = u64_stats_fetch_begin(&stats->syncp); |
| 55 | * tbytes = stats->bytes64; // non atomic operation | 55 | * tbytes = u64_stats_read(&stats->bytes64); // non atomic operation |
| 56 | * tpackets = stats->packets64; // non atomic operation | 56 | * tpackets = u64_stats_read(&stats->packets64); // non atomic operation |
| 57 | * } while (u64_stats_fetch_retry(&stats->syncp, start)); | 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 | #endif | 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 | static inline void u64_stats_init(struct u64_stats_sync *syncp) | 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 | * happens, handle that and return -EFAULT. | 311 | * happens, handle that and return -EFAULT. |
| 312 | */ | 312 | */ |
| 313 | extern long probe_kernel_read(void *dst, const void *src, size_t size); | 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 | extern long __probe_kernel_read(void *dst, const void *src, size_t size); | 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 | extern long notrace probe_kernel_write(void *dst, const void *src, size_t size); | 338 | extern long notrace probe_kernel_write(void *dst, const void *src, size_t size); |
| 338 | extern long notrace __probe_kernel_write(void *dst, const void *src, size_t size); | 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 | extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count); | 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 | extern long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr, | 357 | extern long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr, |
| 342 | long count); | 358 | long count); |
| 343 | extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count); | 359 | extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count); |
| @@ -45,8 +45,8 @@ struct iov_iter { · 44 unmodified lines | |||
| 45 | union { | 45 | union { |
| 46 | unsigned long nr_segs; | 46 | unsigned long nr_segs; |
| 47 | struct { | 47 | struct { |
| 48 | int idx; | 48 | unsigned int head; |
| 49 | int start_idx; | 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 | struct usb_role_switch *fwnode_usb_role_switch_get(struct fwnode_handle *node); | 50 | struct usb_role_switch *fwnode_usb_role_switch_get(struct fwnode_handle *node); |
| 51 | void usb_role_switch_put(struct usb_role_switch *sw); | 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 | struct usb_role_switch * | 56 | struct usb_role_switch * |
| 54 | usb_role_switch_register(struct device *parent, | 57 | usb_role_switch_register(struct device *parent, |
| 55 | const struct usb_role_switch_desc *desc); | 58 | const struct usb_role_switch_desc *desc); |
| @@ -46,45 +46,6 @@ enum tcpm_transmit_type { · 45 unmodified lines | |||
| 46 | TCPC_TX_BIST_MODE_2 = 7 | 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 | /* Mux state attributes */ | 49 | /* Mux state attributes */ |
| 89 | #define TCPC_MUX_USB_ENABLED BIT(0) /* USB enabled */ | 50 | #define TCPC_MUX_USB_ENABLED BIT(0) /* USB enabled */ |
| 90 | #define TCPC_MUX_DP_ENABLED BIT(1) /* DP enabled */ | 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 | * struct tcpc_dev - Port configuration and callback functions | 55 | * struct tcpc_dev - Port configuration and callback functions |
| 95 | * @config: Pointer to port configuration | ||
| 96 | * @fwnode: Pointer to port fwnode | 56 | * @fwnode: Pointer to port fwnode |
| 97 | * @get_vbus: Called to read current VBUS state | 57 | * @get_vbus: Called to read current VBUS state |
| 98 | * @get_current_limit: | 58 | * @get_current_limit: |
| @@ -121,7 +81,6 @@ struct tcpc_config { · 22 unmodified lines | |||
| 121 | * @mux: Pointer to multiplexer data | 81 | * @mux: Pointer to multiplexer data |
| 122 | */ | 82 | */ |
| 123 | struct tcpc_dev { | 83 | struct tcpc_dev { |
| 124 | const struct tcpc_config *config; | ||
| 125 | struct fwnode_handle *fwnode; | 84 | struct fwnode_handle *fwnode; |
| 126 | 85 | ||
| 127 | int (*init)(struct tcpc_dev *dev); | 86 | int (*init)(struct tcpc_dev *dev); |
| @@ -168,6 +168,23 @@ struct typec_partner_desc { · 167 unmodified lines | |||
| 168 | struct usb_pd_identity *identity; | 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 | * struct typec_capability - USB Type-C Port Capabilities | 189 | * struct typec_capability - USB Type-C Port Capabilities |
| 173 | * @type: Supported power role of the port | 190 | * @type: Supported power role of the port |
| @@ -179,11 +196,8 @@ struct typec_partner_desc { · 5 unmodified lines | |||
| 179 | * @sw: Cable plug orientation switch | 196 | * @sw: Cable plug orientation switch |
| 180 | * @mux: Multiplexer switch for Alternate/Accessory Modes | 197 | * @mux: Multiplexer switch for Alternate/Accessory Modes |
| 181 | * @fwnode: Optional fwnode of the port | 198 | * @fwnode: Optional fwnode of the port |
| 182 | * @try_role: Set data role preference for DRP port | 199 | * @driver_data: Private pointer for driver specific info |
| 183 | * @dr_set: Set Data Role | 200 | * @ops: Port operations vector |
| 184 | * @pr_set: Set Power Role | ||
| 185 | * @vconn_set: Set VCONN Role | ||
| 186 | * @port_type_set: Set port type | ||
| 187 | * | 201 | * |
| 188 | * Static capabilities of a single USB Type-C port. | 202 | * Static capabilities of a single USB Type-C port. |
| 189 | */ | 203 | */ |
| @@ -195,21 +209,10 @@ struct typec_capability { · 5 unmodified lines | |||
| 195 | int prefer_role; | 209 | int prefer_role; |
| 196 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; | 210 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; |
| 197 | 211 | ||
| 198 | struct typec_switch *sw; | ||
| 199 | struct typec_mux *mux; | ||
| 200 | struct fwnode_handle *fwnode; | 212 | struct fwnode_handle *fwnode; |
| 213 | void *driver_data; | ||
| 201 | 214 | ||
| 202 | int (*try_role)(const struct typec_capability *, | 215 | const struct typec_operations *ops; |
| 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); | ||
| 213 | }; | 216 | }; |
| 214 | 217 | ||
| 215 | /* Specific to try_role(). Indicates the user want's to clear the preference. */ | 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 | enum typec_orientation typec_get_orientation(struct typec_port *port); | 244 | enum typec_orientation typec_get_orientation(struct typec_port *port); |
| 242 | int typec_set_mode(struct typec_port *port, int mode); | 245 | int typec_set_mode(struct typec_port *port, int mode); |
| 243 | 246 | ||
| 247 | void *typec_get_drvdata(struct typec_port *port); | ||
| 248 | |||
| 244 | int typec_find_port_power_role(const char *name); | 249 | int typec_find_port_power_role(const char *name); |
| 245 | int typec_find_power_role(const char *name); | 250 | int typec_find_power_role(const char *name); |
| 246 | int typec_find_port_data_role(const char *name); | 251 | int typec_find_port_data_role(const char *name); |
| @@ -7,9 +7,6 @@ · 6 unmodified lines | |||
| 7 | #include <net/sock.h> | 7 | #include <net/sock.h> |
| 8 | #include <net/af_vsock.h> | 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 | #define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4) | 10 | #define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4) |
| 14 | #define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL | 11 | #define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL |
| 15 | #define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64) | 12 | #define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64) |
| @@ -25,11 +22,6 @@ enum { · 9 unmodified lines | |||
| 25 | struct virtio_vsock_sock { | 22 | struct virtio_vsock_sock { |
| 26 | struct vsock_sock *vsk; | 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 | spinlock_t tx_lock; | 25 | spinlock_t tx_lock; |
| 34 | spinlock_t rx_lock; | 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 | int virtio_transport_do_socket_init(struct vsock_sock *vsk, | 85 | int virtio_transport_do_socket_init(struct vsock_sock *vsk, |
| 94 | struct vsock_sock *psk); | 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 | int | 87 | int |
| 102 | virtio_transport_notify_poll_in(struct vsock_sock *vsk, | 88 | virtio_transport_notify_poll_in(struct vsock_sock *vsk, |
| 103 | size_t target, | 89 | size_t target, |
| @@ -124,6 +110,7 @@ int virtio_transport_notify_send_pre_enqueue(struct vsock_sock *vsk, · 20 unmodified lines | |||
| 124 | struct vsock_transport_send_notify_data *data); | 110 | struct vsock_transport_send_notify_data *data); |
| 125 | int virtio_transport_notify_send_post_enqueue(struct vsock_sock *vsk, | 111 | int virtio_transport_notify_send_post_enqueue(struct vsock_sock *vsk, |
| 126 | ssize_t written, struct vsock_transport_send_notify_data *data); | 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 | u64 virtio_transport_stream_rcvhiwat(struct vsock_sock *vsk); | 115 | u64 virtio_transport_stream_rcvhiwat(struct vsock_sock *vsk); |
| 129 | bool virtio_transport_stream_is_active(struct vsock_sock *vsk); | 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 | void virtio_transport_destruct(struct vsock_sock *vsk); | 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 | void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt); | 142 | void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt); |
| 155 | void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vsock_pkt *pkt); | 143 | void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vsock_pkt *pkt); |
| 156 | u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); | 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 | #define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ | 22 | #define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ |
| 23 | #define VM_NO_GUARD 0x00000040 /* don't add guard page */ | 23 | #define VM_NO_GUARD 0x00000040 /* don't add guard page */ |
| 24 | #define VM_KASAN 0x00000080 /* has allocated kasan shadow memory */ | 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 | * Memory with VM_FLUSH_RESET_PERMS cannot be freed in an interrupt or with | 38 | * Memory with VM_FLUSH_RESET_PERMS cannot be freed in an interrupt or with |
| 27 | * vfree_atomic(). | 39 | * vfree_atomic(). |
| @@ -93,6 +105,7 @@ extern void *vzalloc(unsigned long size); · 65 unmodified lines | |||
| 93 | extern void *vmalloc_user(unsigned long size); | 105 | extern void *vmalloc_user(unsigned long size); |
| 94 | extern void *vmalloc_node(unsigned long size, int node); | 106 | extern void *vmalloc_node(unsigned long size, int node); |
| 95 | extern void *vzalloc_node(unsigned long size, int node); | 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 | extern void *vmalloc_exec(unsigned long size); | 109 | extern void *vmalloc_exec(unsigned long size); |
| 97 | extern void *vmalloc_32(unsigned long size); | 110 | extern void *vmalloc_32(unsigned long size); |
| 98 | extern void *vmalloc_32_user(unsigned long size); | 111 | extern void *vmalloc_32_user(unsigned long size); |
| @@ -31,6 +31,12 @@ struct reclaim_stat { · 30 unmodified lines | |||
| 31 | unsigned nr_unmap_fail; | 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 | #ifdef CONFIG_VM_EVENT_COUNTERS | 40 | #ifdef CONFIG_VM_EVENT_COUNTERS |
| 35 | /* | 41 | /* |
| 36 | * Light weight per cpu counter implementation. | 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 | extern const char * const vmstat_text[]; | 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 | #endif /* _LINUX_VMSTAT_H */ | 434 | #endif /* _LINUX_VMSTAT_H */ |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | struct msghdr; | 19 | struct msghdr; |
| 20 | typedef void (vmci_device_shutdown_fn) (void *device_registration, | 20 | typedef void (vmci_device_shutdown_fn) (void *device_registration, |
| 21 | void *user_data); | 21 | void *user_data); |
| 22 | typedef void (*vmci_vsock_cb) (bool is_host); | ||
| 22 | 23 | ||
| 23 | int vmci_datagram_create_handle(u32 resource_id, u32 flags, | 24 | int vmci_datagram_create_handle(u32 resource_id, u32 flags, |
| 24 | vmci_datagram_recv_cb recv_cb, | 25 | vmci_datagram_recv_cb recv_cb, |
| @@ -37,6 +38,7 @@ int vmci_doorbell_destroy(struct vmci_handle handle); · 12 unmodified lines | |||
| 37 | int vmci_doorbell_notify(struct vmci_handle handle, u32 priv_flags); | 38 | int vmci_doorbell_notify(struct vmci_handle handle, u32 priv_flags); |
| 38 | u32 vmci_get_context_id(void); | 39 | u32 vmci_get_context_id(void); |
| 39 | bool vmci_is_context_owner(u32 context_id, kuid_t uid); | 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 | int vmci_event_subscribe(u32 event, | 43 | int vmci_event_subscribe(u32 event, |
| 42 | vmci_event_cb callback, void *callback_data, | 44 | vmci_event_cb callback, void *callback_data, |
| @@ -11,11 +11,15 @@ · 10 unmodified lines | |||
| 11 | struct task_struct; | 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 | #if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) | 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 | #elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN) | 21 | #elif defined(CONFIG_VIRT_CPU_ACCOUNTING_GEN) |
| 22 | |||
| 19 | /* | 23 | /* |
| 20 | * Checks if vtime is enabled on some CPU. Cputime readers want to be careful | 24 | * Checks if vtime is enabled on some CPU. Cputime readers want to be careful |
| 21 | * in that case and compute the tickless cputime. | 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 | static inline bool vtime_accounting_enabled(void) | 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()) { | 36 | return context_tracking_enabled_cpu(cpu); |
| 33 | if (context_tracking_cpu_is_enabled()) | ||
| 34 | return true; | ||
| 35 | } | ||
| 36 | |||
| 37 | return false; | ||
| 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 | /* | 44 | extern void vtime_task_switch_generic(struct task_struct *prev); |
| 45 | * Common vtime APIs | ||
| 46 | */ | ||
| 47 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
| 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 | static inline void vtime_task_switch(struct task_struct *prev) | 46 | static inline void vtime_task_switch(struct task_struct *prev) |
| 54 | { | 47 | { |
| 55 | if (vtime_accounting_cpu_enabled()) | 48 | if (vtime_accounting_enabled_this_cpu()) |
| 56 | vtime_common_task_switch(prev); | 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 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ | 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 | static inline void vtime_task_switch(struct task_struct *prev) { } | 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 | #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ | 68 | #endif /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
| 68 | 69 | ||
| 69 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | 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 | static inline void vtime_account_irq_exit(struct task_struct *tsk) | 87 | static inline void vtime_account_irq_exit(struct task_struct *tsk) |
| 87 | { | 88 | { |
| 88 | /* On hard|softirq exit we always account to hard|softirq cputime */ | 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 | extern void vtime_flush(struct task_struct *tsk); | 92 | extern void vtime_flush(struct task_struct *tsk); |
| 92 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ | 93 | #else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ |
| @@ -262,6 +262,7 @@ struct w1_family_ops { · 261 unmodified lines | |||
| 262 | * @family_entry: family linked list | 262 | * @family_entry: family linked list |
| 263 | * @fid: 8 bit family identifier | 263 | * @fid: 8 bit family identifier |
| 264 | * @fops: operations for this family | 264 | * @fops: operations for this family |
| 265 | * @of_match_table: open firmware match table | ||
| 265 | * @refcnt: reference counter | 266 | * @refcnt: reference counter |
| 266 | */ | 267 | */ |
| 267 | struct w1_family { | 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 | void __wake_up_locked_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); | 201 | void __wake_up_locked_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); |
| 202 | void __wake_up_locked_key_bookmark(struct wait_queue_head *wq_head, | 202 | void __wake_up_locked_key_bookmark(struct wait_queue_head *wq_head, |
| 203 | unsigned int mode, void *key, wait_queue_entry_t *bookmark); | 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 | void __wake_up_locked(struct wait_queue_head *wq_head, unsigned int mode, int nr); | 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 | #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) | 209 | #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) |
| 209 | #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) | 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 | #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) | 215 | #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) |
| 215 | #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) | 216 | #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) |
| 216 | #define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) | 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 | * Wakeup macros to be used to report events to the targets. | 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 | #define wake_up_interruptible_poll(x, m) \ | 229 | #define wake_up_interruptible_poll(x, m) \ |
| 229 | __wake_up(x, TASK_INTERRUPTIBLE, 1, poll_to_key(m)) | 230 | __wake_up(x, TASK_INTERRUPTIBLE, 1, poll_to_key(m)) |
| 230 | #define wake_up_interruptible_sync_poll(x, m) \ | 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 | #define ___wait_cond_timeout(condition) \ | 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 | static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx) | 182 | static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx) |
| 183 | { | 183 | { |
| 184 | #ifdef CONFIG_DEBUG_MUTEXES | 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 | DEBUG_LOCKS_WARN_ON(ctx->acquired); | 187 | DEBUG_LOCKS_WARN_ON(ctx->acquired); |
| 188 | if (!IS_ENABLED(CONFIG_PROVE_LOCKING)) | 188 | if (!IS_ENABLED(CONFIG_PROVE_LOCKING)) |