Backmerging required to pull topic/phy-compliance.
Showing the changes to include/linux (350 of 10045 files). Show all
Unified · Split
| @@ -416,9 +416,30 @@ extern void acpi_osi_setup(char *str); · 415 unmodified lines | ||
| 416 | 416 | extern bool acpi_osi_is_win8(void); |
| 417 | 417 | |
| 418 | 418 | #ifdef CONFIG_ACPI_NUMA |
| 419 | −int acpi_map_pxm_to_online_node(int pxm); | |
| 420 | 419 | int acpi_map_pxm_to_node(int pxm); |
| 421 | 420 | int acpi_get_node(acpi_handle handle); |
| 421 | + | |
| 422 | +/** | |
| 423 | + * acpi_map_pxm_to_online_node - Map proximity ID to online node | |
| 424 | + * @pxm: ACPI proximity ID | |
| 425 | + * | |
| 426 | + * This is similar to acpi_map_pxm_to_node(), but always returns an online | |
| 427 | + * node. When the mapped node from a given proximity ID is offline, it | |
| 428 | + * looks up the node distance table and returns the nearest online node. | |
| 429 | + * | |
| 430 | + * ACPI device drivers, which are called after the NUMA initialization has | |
| 431 | + * completed in the kernel, can call this interface to obtain their device | |
| 432 | + * NUMA topology from ACPI tables. Such drivers do not have to deal with | |
| 433 | + * offline nodes. A node may be offline when a device proximity ID is | |
| 434 | + * unique, SRAT memory entry does not exist, or NUMA is disabled, ex. | |
| 435 | + * "numa=off" on x86. | |
| 436 | + */ | |
| 437 | +static inline int acpi_map_pxm_to_online_node(int pxm) | |
| 438 | +{ | |
| 439 | + int node = acpi_map_pxm_to_node(pxm); | |
| 440 | + | |
| 441 | + return numa_map_to_online_node(node); | |
| 442 | +} | |
| 422 | 443 | #else |
| 423 | 444 | static inline int acpi_map_pxm_to_online_node(int pxm) |
| 424 | 445 | { |
| @@ -488,6 +509,11 @@ void __init acpi_nvs_nosave_s3(void); · 63 unmodified lines | ||
| 488 | 509 | void __init acpi_sleep_no_blacklist(void); |
| 489 | 510 | #endif /* CONFIG_PM_SLEEP */ |
| 490 | 511 | |
| 512 | +int acpi_register_wakeup_handler( | |
| 513 | + int wake_irq, bool (*wakeup)(void *context), void *context); | |
| 514 | +void acpi_unregister_wakeup_handler( | |
| 515 | + bool (*wakeup)(void *context), void *context); | |
| 516 | + | |
| 491 | 517 | struct acpi_osc_context { |
| 492 | 518 | char *uuid_str; /* UUID string */ |
| 493 | 519 | int rev; |
| @@ -530,8 +556,9 @@ extern bool osc_pc_lpi_support_confirmed; · 36 unmodified lines | ||
| 530 | 556 | #define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004 |
| 531 | 557 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008 |
| 532 | 558 | #define OSC_PCI_MSI_SUPPORT 0x00000010 |
| 559 | +#define OSC_PCI_EDR_SUPPORT 0x00000080 | |
| 533 | 560 | #define OSC_PCI_HPX_TYPE_3_SUPPORT 0x00000100 |
| 534 | −#define OSC_PCI_SUPPORT_MASKS 0x0000011f | |
| 561 | +#define OSC_PCI_SUPPORT_MASKS 0x0000019f | |
| 535 | 562 | |
| 536 | 563 | /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */ |
| 537 | 564 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001 |
| @@ -540,7 +567,8 @@ extern bool osc_pc_lpi_support_confirmed; · 2 unmodified lines | ||
| 540 | 567 | #define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008 |
| 541 | 568 | #define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 |
| 542 | 569 | #define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020 |
| 543 | −#define OSC_PCI_CONTROL_MASKS 0x0000003f | |
| 570 | +#define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080 | |
| 571 | +#define OSC_PCI_CONTROL_MASKS 0x000000bf | |
| 544 | 572 | |
| 545 | 573 | #define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002 |
| 546 | 574 | #define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004 |
| @@ -44,8 +44,7 @@ struct aer_capability_regs { · 43 unmodified lines | ||
| 44 | 44 | /* PCIe port driver needs this function to enable AER */ |
| 45 | 45 | int pci_enable_pcie_error_reporting(struct pci_dev *dev); |
| 46 | 46 | int pci_disable_pcie_error_reporting(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); | |
| 47 | +int pci_aer_clear_nonfatal_status(struct pci_dev *dev); | |
| 49 | 48 | void pci_save_aer_state(struct pci_dev *dev); |
| 50 | 49 | void pci_restore_aer_state(struct pci_dev *dev); |
| 51 | 50 | #else |
| @@ -57,11 +56,7 @@ static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) · 5 unmodified lines | ||
| 57 | 56 | { |
| 58 | 57 | return -EINVAL; |
| 59 | 58 | } |
| 60 | −static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) | |
| 61 | −{ | |
| 62 | − return -EINVAL; | |
| 63 | −} | |
| 64 | −static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) | |
| 59 | +static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev) | |
| 65 | 60 | { |
| 66 | 61 | return -EINVAL; |
| 67 | 62 | } |
| @@ -16,9 +16,7 @@ bool topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu); · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | DECLARE_PER_CPU(unsigned long, cpu_scale); |
| 18 | 18 | |
| 19 | −struct sched_domain; | |
| 20 | −static inline | |
| 21 | −unsigned long topology_get_cpu_scale(int cpu) | |
| 19 | +static inline unsigned long topology_get_cpu_scale(int cpu) | |
| 22 | 20 | { |
| 23 | 21 | return per_cpu(cpu_scale, cpu); |
| 24 | 22 | } |
| @@ -27,12 +25,23 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity); · 2 unmodified lines | ||
| 27 | 25 | |
| 28 | 26 | DECLARE_PER_CPU(unsigned long, freq_scale); |
| 29 | 27 | |
| 30 | −static inline | |
| 31 | −unsigned long topology_get_freq_scale(int cpu) | |
| 28 | +static inline unsigned long topology_get_freq_scale(int cpu) | |
| 32 | 29 | { |
| 33 | 30 | return per_cpu(freq_scale, cpu); |
| 34 | 31 | } |
| 35 | 32 | |
| 33 | +bool arch_freq_counters_available(struct cpumask *cpus); | |
| 34 | + | |
| 35 | +DECLARE_PER_CPU(unsigned long, thermal_pressure); | |
| 36 | + | |
| 37 | +static inline unsigned long topology_get_thermal_pressure(int cpu) | |
| 38 | +{ | |
| 39 | + return per_cpu(thermal_pressure, cpu); | |
| 40 | +} | |
| 41 | + | |
| 42 | +void arch_set_thermal_pressure(struct cpumask *cpus, | |
| 43 | + unsigned long th_pressure); | |
| 44 | + | |
| 36 | 45 | struct cpu_topology { |
| 37 | 46 | int thread_id; |
| 38 | 47 | int core_id; |
| @@ -0,0 +1,58 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | +/* | |
| 3 | + * Copyright (c) 2019 Microchip Technology Inc. and its subsidiaries | |
| 4 | + * | |
| 5 | + * Author: Eugen Hristev <eugen.hristev@microchip.com> | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __LINUX_ATMEL_ISC_MEDIA_H__ | |
| 9 | +#define __LINUX_ATMEL_ISC_MEDIA_H__ | |
| 10 | + | |
| 11 | +/* | |
| 12 | + * There are 8 controls available: | |
| 13 | + * 4 gain controls, sliders, for each of the BAYER components: R, B, GR, GB. | |
| 14 | + * These gains are multipliers for each component, in format unsigned 0:4:9 with | |
| 15 | + * a default value of 512 (1.0 multiplier). | |
| 16 | + * 4 offset controls, sliders, for each of the BAYER components: R, B, GR, GB. | |
| 17 | + * These offsets are added/substracted from each component, in format signed | |
| 18 | + * 1:12:0 with a default value of 0 (+/- 0) | |
| 19 | + * | |
| 20 | + * To expose this to userspace, added 8 custom controls, in an auto cluster. | |
| 21 | + * | |
| 22 | + * To summarize the functionality: | |
| 23 | + * The auto cluster switch is the auto white balance control, and it works | |
| 24 | + * like this: | |
| 25 | + * AWB == 1: autowhitebalance is on, the do_white_balance button is inactive, | |
| 26 | + * the gains/offsets are inactive, but volatile and readable. | |
| 27 | + * Thus, the results of the whitebalance algorithm are available to userspace to | |
| 28 | + * read at any time. | |
| 29 | + * AWB == 0: autowhitebalance is off, cluster is in manual mode, user can | |
| 30 | + * configure the gain/offsets directly. | |
| 31 | + * More than that, if the do_white_balance button is | |
| 32 | + * pressed, the driver will perform one-time-adjustment, (preferably with color | |
| 33 | + * checker card) and the userspace can read again the new values. | |
| 34 | + * | |
| 35 | + * With this feature, the userspace can save the coefficients and reinstall them | |
| 36 | + * for example after reboot or reprobing the driver. | |
| 37 | + */ | |
| 38 | + | |
| 39 | +enum atmel_isc_ctrl_id { | |
| 40 | + /* Red component gain control */ | |
| 41 | + ISC_CID_R_GAIN = (V4L2_CID_USER_ATMEL_ISC_BASE + 0), | |
| 42 | + /* Blue component gain control */ | |
| 43 | + ISC_CID_B_GAIN, | |
| 44 | + /* Green Red component gain control */ | |
| 45 | + ISC_CID_GR_GAIN, | |
| 46 | + /* Green Blue gain control */ | |
| 47 | + ISC_CID_GB_GAIN, | |
| 48 | + /* Red component offset control */ | |
| 49 | + ISC_CID_R_OFFSET, | |
| 50 | + /* Blue component offset control */ | |
| 51 | + ISC_CID_B_OFFSET, | |
| 52 | + /* Green Red component offset control */ | |
| 53 | + ISC_CID_GR_OFFSET, | |
| 54 | + /* Green Blue component offset control */ | |
| 55 | + ISC_CID_GB_OFFSET, | |
| 56 | +}; | |
| 57 | + | |
| 58 | +#endif | |
| @@ -44,7 +44,13 @@ struct linux_binprm { · 43 unmodified lines | ||
| 44 | 44 | * exec has happened. Used to sanitize execution environment |
| 45 | 45 | * and to set AT_SECURE auxv for glibc. |
| 46 | 46 | */ |
| 47 | − secureexec:1; | |
| 47 | + secureexec:1, | |
| 48 | + /* | |
| 49 | + * Set by flush_old_exec, when exec_mmap has been called. | |
| 50 | + * This is past the point of no return, when the | |
| 51 | + * exec_update_mutex has been taken. | |
| 52 | + */ | |
| 53 | + called_exec_mmap:1; | |
| 48 | 54 | #ifdef __alpha__ |
| 49 | 55 | unsigned int taso:1; |
| 50 | 56 | #endif |
| @@ -441,14 +441,6 @@ void __bio_add_page(struct bio *bio, struct page *page, · 440 unmodified lines | ||
| 441 | 441 | unsigned int len, unsigned int off); |
| 442 | 442 | int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); |
| 443 | 443 | void bio_release_pages(struct bio *bio, bool mark_dirty); |
| 444 | −struct rq_map_data; | |
| 445 | −extern struct bio *bio_map_user_iov(struct request_queue *, | |
| 446 | − struct iov_iter *, gfp_t); | |
| 447 | −extern void bio_unmap_user(struct bio *); | |
| 448 | −extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, | |
| 449 | − gfp_t); | |
| 450 | −extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int, | |
| 451 | − gfp_t, int); | |
| 452 | 444 | extern void bio_set_pages_dirty(struct bio *bio); |
| 453 | 445 | extern void bio_check_pages_dirty(struct bio *bio); |
| 454 | 446 | |
| @@ -463,14 +455,9 @@ extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, · 8 unmodified lines | ||
| 463 | 455 | extern void bio_copy_data(struct bio *dst, struct bio *src); |
| 464 | 456 | extern void bio_list_copy_data(struct bio *dst, struct bio *src); |
| 465 | 457 | extern void bio_free_pages(struct bio *bio); |
| 466 | − | |
| 467 | −extern struct bio *bio_copy_user_iov(struct request_queue *, | |
| 468 | − struct rq_map_data *, | |
| 469 | − struct iov_iter *, | |
| 470 | − gfp_t); | |
| 471 | −extern int bio_uncopy_user(struct bio *); | |
| 472 | 458 | void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter); |
| 473 | 459 | void bio_truncate(struct bio *bio, unsigned new_size); |
| 460 | +void guard_bio_eod(struct bio *bio); | |
| 474 | 461 | |
| 475 | 462 | static inline void zero_fill_bio(struct bio *bio) |
| 476 | 463 | { |
| @@ -55,6 +55,19 @@ · 54 unmodified lines | ||
| 55 | 55 | (1ULL << __bf_shf(_mask))); \ |
| 56 | 56 | }) |
| 57 | 57 | |
| 58 | +/** | |
| 59 | + * FIELD_MAX() - produce the maximum value representable by a field | |
| 60 | + * @_mask: shifted mask defining the field's length and position | |
| 61 | + * | |
| 62 | + * FIELD_MAX() returns the maximum value that can be held in the field | |
| 63 | + * specified by @_mask. | |
| 64 | + */ | |
| 65 | +#define FIELD_MAX(_mask) \ | |
| 66 | + ({ \ | |
| 67 | + __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_MAX: "); \ | |
| 68 | + (typeof(_mask))((_mask) >> __bf_shf(_mask)); \ | |
| 69 | + }) | |
| 70 | + | |
| 58 | 71 | /** |
| 59 | 72 | * FIELD_FIT() - check if value fits in the field |
| 60 | 73 | * @_mask: shifted mask defining the field's length and position |
| @@ -110,6 +123,7 @@ static __always_inline u64 field_mask(u64 field) · 49 unmodified lines | ||
| 110 | 123 | { |
| 111 | 124 | return field / field_multiplier(field); |
| 112 | 125 | } |
| 126 | +#define field_max(field) ((typeof(field))field_mask(field)) | |
| 113 | 127 | #define ____MAKE_OP(type,base,to,from) \ |
| 114 | 128 | static __always_inline __##type type##_encode_bits(base v, base field) \ |
| 115 | 129 | { \ |
| @@ -50,7 +50,13 @@ · 49 unmodified lines | ||
| 50 | 50 | * bitmap_set(dst, pos, nbits) Set specified bit area |
| 51 | 51 | * bitmap_clear(dst, pos, nbits) Clear specified bit area |
| 52 | 52 | * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area |
| 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, mask_off) as above | |
| 54 | + * bitmap_next_clear_region(map, &start, &end, nbits) Find next clear region | |
| 55 | + * bitmap_next_set_region(map, &start, &end, nbits) Find next set region | |
| 56 | + * bitmap_for_each_clear_region(map, rs, re, start, end) | |
| 57 | + * Iterate over all clear regions | |
| 58 | + * bitmap_for_each_set_region(map, rs, re, start, end) | |
| 59 | + * Iterate over all set regions | |
| 54 | 60 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n |
| 55 | 61 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n |
| 56 | 62 | * bitmap_cut(dst, src, first, n, nbits) Cut n bits from first, copy rest |
| @@ -162,7 +162,7 @@ static inline __u8 ror8(__u8 word, unsigned int shift) · 161 unmodified lines | ||
| 162 | 162 | * |
| 163 | 163 | * This is safe to use for 16- and 8-bit types as well. |
| 164 | 164 | */ |
| 165 | −static inline __s32 sign_extend32(__u32 value, int index) | |
| 165 | +static __always_inline __s32 sign_extend32(__u32 value, int index) | |
| 166 | 166 | { |
| 167 | 167 | __u8 shift = 31 - index; |
| 168 | 168 | return (__s32)(value << shift) >> shift; |
| @@ -173,7 +173,7 @@ static inline __s32 sign_extend32(__u32 value, int index) · 4 unmodified lines | ||
| 173 | 173 | * @value: value to sign extend |
| 174 | 174 | * @index: 0 based bit index (0<=index<64) to sign bit |
| 175 | 175 | */ |
| 176 | −static inline __s64 sign_extend64(__u64 value, int index) | |
| 176 | +static __always_inline __s64 sign_extend64(__u64 value, int index) | |
| 177 | 177 | { |
| 178 | 178 | __u8 shift = 63 - index; |
| 179 | 179 | return (__s64)(value << shift) >> shift; |
| @@ -3,9 +3,9 @@ · 2 unmodified lines | ||
| 3 | 3 | #define __LINUX_BITS_H |
| 4 | 4 | |
| 5 | 5 | #include <linux/const.h> |
| 6 | +#include <vdso/bits.h> | |
| 6 | 7 | #include <asm/bitsperlong.h> |
| 7 | 8 | |
| 8 | −#define BIT(nr) (UL(1) << (nr)) | |
| 9 | 9 | #define BIT_ULL(nr) (ULL(1) << (nr)) |
| 10 | 10 | #define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG)) |
| 11 | 11 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) |
| @@ -18,12 +18,30 @@ · 6 unmodified lines | ||
| 18 | 18 | * position @h. For example |
| 19 | 19 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. |
| 20 | 20 | */ |
| 21 | −#define GENMASK(h, l) \ | |
| 21 | +#if !defined(__ASSEMBLY__) && \ | |
| 22 | + (!defined(CONFIG_CC_IS_GCC) || CONFIG_GCC_VERSION >= 49000) | |
| 23 | +#include <linux/build_bug.h> | |
| 24 | +#define GENMASK_INPUT_CHECK(h, l) \ | |
| 25 | + (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ | |
| 26 | + __builtin_constant_p((l) > (h)), (l) > (h), 0))) | |
| 27 | +#else | |
| 28 | +/* | |
| 29 | + * BUILD_BUG_ON_ZERO is not available in h files included from asm files, | |
| 30 | + * disable the input check if that is the case. | |
| 31 | + */ | |
| 32 | +#define GENMASK_INPUT_CHECK(h, l) 0 | |
| 33 | +#endif | |
| 34 | + | |
| 35 | +#define __GENMASK(h, l) \ | |
| 22 | 36 | (((~UL(0)) - (UL(1) << (l)) + 1) & \ |
| 23 | 37 | (~UL(0) >> (BITS_PER_LONG - 1 - (h)))) |
| 38 | +#define GENMASK(h, l) \ | |
| 39 | + (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | |
| 24 | 40 | |
| 25 | −#define GENMASK_ULL(h, l) \ | |
| 41 | +#define __GENMASK_ULL(h, l) \ | |
| 26 | 42 | (((~ULL(0)) - (ULL(1) << (l)) + 1) & \ |
| 27 | 43 | (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h)))) |
| 44 | +#define GENMASK_ULL(h, l) \ | |
| 45 | + (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) | |
| 28 | 46 | |
| 29 | 47 | #endif /* __LINUX_BITS_H */ |
| @@ -46,6 +46,7 @@ struct blkcg_gq; · 45 unmodified lines | ||
| 46 | 46 | struct blkcg { |
| 47 | 47 | struct cgroup_subsys_state css; |
| 48 | 48 | spinlock_t lock; |
| 49 | + refcount_t online_pin; | |
| 49 | 50 | |
| 50 | 51 | struct radix_tree_root blkg_tree; |
| 51 | 52 | struct blkcg_gq __rcu *blkg_hint; |
| @@ -56,7 +57,6 @@ struct blkcg { · 4 unmodified lines | ||
| 56 | 57 | struct list_head all_blkcgs_node; |
| 57 | 58 | #ifdef CONFIG_CGROUP_WRITEBACK |
| 58 | 59 | struct list_head cgwb_list; |
| 59 | − refcount_t cgwb_refcnt; | |
| 60 | 60 | #endif |
| 61 | 61 | }; |
| 62 | 62 | |
| @@ -412,47 +412,38 @@ static inline struct blkcg *cpd_to_blkcg(struct blkcg_policy_data *cpd) · 349 unmodified lines | ||
| 412 | 412 | |
| 413 | 413 | extern void blkcg_destroy_blkgs(struct blkcg *blkcg); |
| 414 | 414 | |
| 415 | −#ifdef CONFIG_CGROUP_WRITEBACK | |
| 416 | − | |
| 417 | 415 | /** |
| 418 | − * blkcg_cgwb_get - get a reference for blkcg->cgwb_list | |
| 416 | + * blkcg_pin_online - pin online state | |
| 419 | 417 | * @blkcg: blkcg of interest |
| 420 | 418 | * |
| 421 | − * This is used to track the number of active wb's related to a blkcg. | |
| 419 | + * While pinned, a blkcg is kept online. This is primarily used to | |
| 420 | + * impedance-match blkg and cgwb lifetimes so that blkg doesn't go offline | |
| 421 | + * while an associated cgwb is still active. | |
| 422 | 422 | */ |
| 423 | −static inline void blkcg_cgwb_get(struct blkcg *blkcg) | |
| 423 | +static inline void blkcg_pin_online(struct blkcg *blkcg) | |
| 424 | 424 | { |
| 425 | − refcount_inc(&blkcg->cgwb_refcnt); | |
| 425 | + refcount_inc(&blkcg->online_pin); | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
| 429 | − * blkcg_cgwb_put - put a reference for @blkcg->cgwb_list | |
| 429 | + * blkcg_unpin_online - unpin online state | |
| 430 | 430 | * @blkcg: blkcg of interest |
| 431 | 431 | * |
| 432 | − * This is used to track the number of active wb's related to a blkcg. | |
| 433 | − * When this count goes to zero, all active wb has finished so the | |
| 432 | + * This is primarily used to impedance-match blkg and cgwb lifetimes so | |
| 433 | + * that blkg doesn't go offline while an associated cgwb is still active. | |
| 434 | + * When this count goes to zero, all active cgwbs have finished so the | |
| 434 | 435 | * blkcg can continue destruction by calling blkcg_destroy_blkgs(). |
| 435 | − * This work may occur in cgwb_release_workfn() on the cgwb_release | |
| 436 | − * workqueue. | |
| 437 | 436 | */ |
| 438 | −static inline void blkcg_cgwb_put(struct blkcg *blkcg) | |
| 437 | +static inline void blkcg_unpin_online(struct blkcg *blkcg) | |
| 439 | 438 | { |
| 440 | − if (refcount_dec_and_test(&blkcg->cgwb_refcnt)) | |
| 439 | + do { | |
| 440 | + if (!refcount_dec_and_test(&blkcg->online_pin)) | |
| 441 | + break; | |
| 441 | 442 | blkcg_destroy_blkgs(blkcg); |
| 443 | + blkcg = blkcg_parent(blkcg); | |
| 444 | + } while (blkcg); | |
| 442 | 445 | } |
| 443 | 446 | |
| 444 | −#else | |
| 445 | − | |
| 446 | −static inline void blkcg_cgwb_get(struct blkcg *blkcg) { } | |
| 447 | − | |
| 448 | −static inline void blkcg_cgwb_put(struct blkcg *blkcg) | |
| 449 | −{ | |
| 450 | − /* wb isn't being accounted, so trigger destruction right away */ | |
| 451 | − blkcg_destroy_blkgs(blkcg); | |
| 452 | −} | |
| 453 | − | |
| 454 | −#endif | |
| 455 | − | |
| 456 | 447 | /** |
| 457 | 448 | * blkg_path - format cgroup path of blkg |
| 458 | 449 | * @blkg: blkg of interest |
| @@ -162,7 +162,10 @@ struct blk_mq_hw_ctx { · 161 unmodified lines | ||
| 162 | 162 | struct dentry *sched_debugfs_dir; |
| 163 | 163 | #endif |
| 164 | 164 | |
| 165 | − /** @hctx_list: List of all hardware queues. */ | |
| 165 | + /** | |
| 166 | + * @hctx_list: if this hctx is not in use, this is an entry in | |
| 167 | + * q->unused_hctx_list. | |
| 168 | + */ | |
| 166 | 169 | struct list_head hctx_list; |
| 167 | 170 | |
| 168 | 171 | /** |
| @@ -409,6 +412,8 @@ enum { · 240 unmodified lines | ||
| 409 | 412 | << BLK_MQ_F_ALLOC_POLICY_START_BIT) |
| 410 | 413 | |
| 411 | 414 | struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); |
| 415 | +struct request_queue *blk_mq_init_queue_data(struct blk_mq_tag_set *set, | |
| 416 | + void *queuedata); | |
| 412 | 417 | struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, |
| 413 | 418 | struct request_queue *q, |
| 414 | 419 | bool elevator_init); |
| @@ -952,6 +952,10 @@ static inline unsigned int blk_rq_stats_sectors(const struct request *rq) · 951 unmodified lines | ||
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | #ifdef CONFIG_BLK_DEV_ZONED |
| 955 | + | |
| 956 | +/* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */ | |
| 957 | +const char *blk_zone_cond_str(enum blk_zone_cond zone_cond); | |
| 958 | + | |
| 955 | 959 | static inline unsigned int blk_rq_zone_no(struct request *rq) |
| 956 | 960 | { |
| 957 | 961 | return blk_queue_zone_no(rq->q, blk_rq_pos(rq)); |
| @@ -1063,7 +1067,6 @@ extern void blk_abort_request(struct request *); · 105 unmodified lines | ||
| 1063 | 1067 | * Access functions for manipulating queue properties |
| 1064 | 1068 | */ |
| 1065 | 1069 | extern void blk_cleanup_queue(struct request_queue *); |
| 1066 | −extern void blk_queue_make_request(struct request_queue *, make_request_fn *); | |
| 1067 | 1070 | extern void blk_queue_bounce_limit(struct request_queue *, u64); |
| 1068 | 1071 | extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); |
| 1069 | 1072 | extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int); |
| @@ -1140,8 +1143,7 @@ extern void blk_dump_rq_flags(struct request *, char *); · 70 unmodified lines | ||
| 1140 | 1143 | extern long nr_blockdev_pages(void); |
| 1141 | 1144 | |
| 1142 | 1145 | bool __must_check blk_get_queue(struct request_queue *); |
| 1143 | −struct request_queue *blk_alloc_queue(gfp_t); | |
| 1144 | −struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id); | |
| 1146 | +struct request_queue *blk_alloc_queue(make_request_fn make_request, int node_id); | |
| 1145 | 1147 | extern void blk_put_queue(struct request_queue *); |
| 1146 | 1148 | extern void blk_set_queue_dying(struct request_queue *); |
| 1147 | 1149 | |
| @@ -1484,15 +1486,6 @@ static inline unsigned int block_size(struct block_device *bdev) · 336 unmodified lines | ||
| 1484 | 1486 | return bdev->bd_block_size; |
| 1485 | 1487 | } |
| 1486 | 1488 | |
| 1487 | −typedef struct {struct page *v;} Sector; | |
| 1488 | − | |
| 1489 | −unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *); | |
| 1490 | − | |
| 1491 | −static inline void put_dev_sector(Sector p) | |
| 1492 | −{ | |
| 1493 | − put_page(p.v); | |
| 1494 | −} | |
| 1495 | − | |
| 1496 | 1489 | int kblockd_schedule_work(struct work_struct *work); |
| 1497 | 1490 | int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay); |
| 1498 | 1491 | |
| @@ -1706,6 +1699,7 @@ struct block_device_operations { · 207 unmodified lines | ||
| 1706 | 1699 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); |
| 1707 | 1700 | int (*report_zones)(struct gendisk *, sector_t sector, |
| 1708 | 1701 | unsigned int nr_zones, report_zones_cb cb, void *data); |
| 1702 | + char *(*devnode)(struct gendisk *disk, umode_t *mode); | |
| 1709 | 1703 | struct module *owner; |
| 1710 | 1704 | const struct pr_ops *pr_ops; |
| 1711 | 1705 | }; |
| @@ -216,7 +216,8 @@ static inline int __init xbc_node_compose_key(struct xbc_node *node, · 215 unmodified lines | ||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /* XBC node initializer */ |
| 219 | −int __init xbc_init(char *buf); | |
| 219 | +int __init xbc_init(char *buf, const char **emsg, int *epos); | |
| 220 | + | |
| 220 | 221 | |
| 221 | 222 | /* XBC cleanup data structures */ |
| 222 | 223 | void __init xbc_destroy_all(void); |
| @@ -36,7 +36,7 @@ struct bpf_cgroup_storage_map; · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | struct bpf_storage_buffer { |
| 38 | 38 | struct rcu_head rcu; |
| 39 | − char data[0]; | |
| 39 | + char data[]; | |
| 40 | 40 | }; |
| 41 | 41 | |
| 42 | 42 | struct bpf_cgroup_storage { |
| @@ -51,9 +51,18 @@ struct bpf_cgroup_storage { · 8 unmodified lines | ||
| 51 | 51 | struct rcu_head rcu; |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | +struct bpf_cgroup_link { | |
| 55 | + struct bpf_link link; | |
| 56 | + struct cgroup *cgroup; | |
| 57 | + enum bpf_attach_type type; | |
| 58 | +}; | |
| 59 | + | |
| 60 | +extern const struct bpf_link_ops bpf_cgroup_link_lops; | |
| 61 | + | |
| 54 | 62 | struct bpf_prog_list { |
| 55 | 63 | struct list_head node; |
| 56 | 64 | struct bpf_prog *prog; |
| 65 | + struct bpf_cgroup_link *link; | |
| 57 | 66 | struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE]; |
| 58 | 67 | }; |
| 59 | 68 | |
| @@ -84,20 +93,27 @@ struct cgroup_bpf { · 24 unmodified lines | ||
| 84 | 93 | int cgroup_bpf_inherit(struct cgroup *cgrp); |
| 85 | 94 | void cgroup_bpf_offline(struct cgroup *cgrp); |
| 86 | 95 | |
| 87 | −int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, | |
| 88 | − struct bpf_prog *replace_prog, | |
| 96 | +int __cgroup_bpf_attach(struct cgroup *cgrp, | |
| 97 | + struct bpf_prog *prog, struct bpf_prog *replace_prog, | |
| 98 | + struct bpf_cgroup_link *link, | |
| 89 | 99 | enum bpf_attach_type type, u32 flags); |
| 90 | 100 | int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, |
| 101 | + struct bpf_cgroup_link *link, | |
| 91 | 102 | enum bpf_attach_type type); |
| 103 | +int __cgroup_bpf_replace(struct cgroup *cgrp, struct bpf_cgroup_link *link, | |
| 104 | + struct bpf_prog *new_prog); | |
| 92 | 105 | int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, |
| 93 | 106 | union bpf_attr __user *uattr); |
| 94 | 107 | |
| 95 | 108 | /* Wrapper for __cgroup_bpf_*() protected by cgroup_mutex */ |
| 96 | −int cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, | |
| 97 | − struct bpf_prog *replace_prog, enum bpf_attach_type type, | |
| 109 | +int cgroup_bpf_attach(struct cgroup *cgrp, | |
| 110 | + struct bpf_prog *prog, struct bpf_prog *replace_prog, | |
| 111 | + struct bpf_cgroup_link *link, enum bpf_attach_type type, | |
| 98 | 112 | u32 flags); |
| 99 | 113 | int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, |
| 100 | − enum bpf_attach_type type, u32 flags); | |
| 114 | + enum bpf_attach_type type); | |
| 115 | +int cgroup_bpf_replace(struct bpf_link *link, struct bpf_prog *old_prog, | |
| 116 | + struct bpf_prog *new_prog); | |
| 101 | 117 | int cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, |
| 102 | 118 | union bpf_attr __user *uattr); |
| 103 | 119 | |
| @@ -332,11 +348,13 @@ int cgroup_bpf_prog_attach(const union bpf_attr *attr, · 228 unmodified lines | ||
| 332 | 348 | enum bpf_prog_type ptype, struct bpf_prog *prog); |
| 333 | 349 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, |
| 334 | 350 | enum bpf_prog_type ptype); |
| 351 | +int cgroup_bpf_link_attach(const union bpf_attr *attr, struct bpf_prog *prog); | |
| 335 | 352 | int cgroup_bpf_prog_query(const union bpf_attr *attr, |
| 336 | 353 | union bpf_attr __user *uattr); |
| 337 | 354 | #else |
| 338 | 355 | |
| 339 | 356 | struct bpf_prog; |
| 357 | +struct bpf_link; | |
| 340 | 358 | struct cgroup_bpf {}; |
| 341 | 359 | static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } |
| 342 | 360 | static inline void cgroup_bpf_offline(struct cgroup *cgrp) {} |
| @@ -354,6 +372,19 @@ static inline int cgroup_bpf_prog_detach(const union bpf_attr *attr, · 11 unmodified lines | ||
| 354 | 372 | return -EINVAL; |
| 355 | 373 | } |
| 356 | 374 | |
| 375 | +static inline int cgroup_bpf_link_attach(const union bpf_attr *attr, | |
| 376 | + struct bpf_prog *prog) | |
| 377 | +{ | |
| 378 | + return -EINVAL; | |
| 379 | +} | |
| 380 | + | |
| 381 | +static inline int cgroup_bpf_replace(struct bpf_link *link, | |
| 382 | + struct bpf_prog *old_prog, | |
| 383 | + struct bpf_prog *new_prog) | |
| 384 | +{ | |
| 385 | + return -EINVAL; | |
| 386 | +} | |
| 387 | + | |
| 357 | 388 | static inline int cgroup_bpf_prog_query(const union bpf_attr *attr, |
| 358 | 389 | union bpf_attr __user *uattr) |
| 359 | 390 | { |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/refcount.h> |
| 19 | 19 | #include <linux/mutex.h> |
| 20 | 20 | #include <linux/module.h> |
| 21 | +#include <linux/kallsyms.h> | |
| 21 | 22 | |
| 22 | 23 | struct bpf_verifier_env; |
| 23 | 24 | struct bpf_verifier_log; |
| @@ -160,6 +161,7 @@ static inline void copy_map_value(struct bpf_map *map, void *dst, void *src) · 136 unmodified lines | ||
| 160 | 161 | } |
| 161 | 162 | void copy_map_value_locked(struct bpf_map *map, void *dst, void *src, |
| 162 | 163 | bool lock_src); |
| 164 | +int bpf_obj_name_cpy(char *dst, const char *src, unsigned int size); | |
| 163 | 165 | |
| 164 | 166 | struct bpf_offload_dev; |
| 165 | 167 | struct bpf_offloaded_map; |
| @@ -232,6 +234,7 @@ enum bpf_arg_type { · 66 unmodified lines | ||
| 232 | 234 | ARG_CONST_SIZE_OR_ZERO, /* number of bytes accessed from memory or 0 */ |
| 233 | 235 | |
| 234 | 236 | ARG_PTR_TO_CTX, /* pointer to context */ |
| 237 | + ARG_PTR_TO_CTX_OR_NULL, /* pointer to context or NULL */ | |
| 235 | 238 | ARG_ANYTHING, /* any (initialized) argument is ok */ |
| 236 | 239 | ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */ |
| 237 | 240 | ARG_PTR_TO_SOCK_COMMON, /* pointer to sock_common */ |
| @@ -433,6 +436,16 @@ struct btf_func_model { · 195 unmodified lines | ||
| 433 | 436 | */ |
| 434 | 437 | #define BPF_TRAMP_F_SKIP_FRAME BIT(2) |
| 435 | 438 | |
| 439 | +/* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50 | |
| 440 | + * bytes on x86. Pick a number to fit into BPF_IMAGE_SIZE / 2 | |
| 441 | + */ | |
| 442 | +#define BPF_MAX_TRAMP_PROGS 40 | |
| 443 | + | |
| 444 | +struct bpf_tramp_progs { | |
| 445 | + struct bpf_prog *progs[BPF_MAX_TRAMP_PROGS]; | |
| 446 | + int nr_progs; | |
| 447 | +}; | |
| 448 | + | |
| 436 | 449 | /* Different use cases for BPF trampoline: |
| 437 | 450 | * 1. replace nop at the function entry (kprobe equivalent) |
| 438 | 451 | * flags = BPF_TRAMP_F_RESTORE_REGS |
| @@ -455,16 +468,25 @@ struct btf_func_model { · 16 unmodified lines | ||
| 455 | 468 | */ |
| 456 | 469 | int arch_prepare_bpf_trampoline(void *image, void *image_end, |
| 457 | 470 | const struct btf_func_model *m, u32 flags, |
| 458 | − struct bpf_prog **fentry_progs, int fentry_cnt, | |
| 459 | − struct bpf_prog **fexit_progs, int fexit_cnt, | |
| 471 | + struct bpf_tramp_progs *tprogs, | |
| 460 | 472 | void *orig_call); |
| 461 | 473 | /* these two functions are called from generated trampoline */ |
| 462 | 474 | u64 notrace __bpf_prog_enter(void); |
| 463 | 475 | void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start); |
| 464 | 476 | |
| 477 | +struct bpf_ksym { | |
| 478 | + unsigned long start; | |
| 479 | + unsigned long end; | |
| 480 | + char name[KSYM_NAME_LEN]; | |
| 481 | + struct list_head lnode; | |
| 482 | + struct latch_tree_node tnode; | |
| 483 | + bool prog; | |
| 484 | +}; | |
| 485 | + | |
| 465 | 486 | enum bpf_tramp_prog_type { |
| 466 | 487 | BPF_TRAMP_FENTRY, |
| 467 | 488 | BPF_TRAMP_FEXIT, |
| 489 | + BPF_TRAMP_MODIFY_RETURN, | |
| 468 | 490 | BPF_TRAMP_MAX, |
| 469 | 491 | BPF_TRAMP_REPLACE, /* more than MAX */ |
| 470 | 492 | }; |
| @@ -493,6 +515,7 @@ struct bpf_trampoline { · 22 unmodified lines | ||
| 493 | 515 | /* Executable image of trampoline */ |
| 494 | 516 | void *image; |
| 495 | 517 | u64 selector; |
| 518 | + struct bpf_ksym ksym; | |
| 496 | 519 | }; |
| 497 | 520 | |
| 498 | 521 | #define BPF_DISPATCHER_MAX 48 /* Fits in 2048B */ |
| @@ -510,9 +533,10 @@ struct bpf_dispatcher { · 11 unmodified lines | ||
| 510 | 533 | int num_progs; |
| 511 | 534 | void *image; |
| 512 | 535 | u32 image_off; |
| 536 | + struct bpf_ksym ksym; | |
| 513 | 537 | }; |
| 514 | 538 | |
| 515 | −static __always_inline unsigned int bpf_dispatcher_nopfunc( | |
| 539 | +static __always_inline unsigned int bpf_dispatcher_nop_func( | |
| 516 | 540 | const void *ctx, |
| 517 | 541 | const struct bpf_insn *insnsi, |
| 518 | 542 | unsigned int (*bpf_func)(const void *, |
| @@ -525,17 +549,21 @@ struct bpf_trampoline *bpf_trampoline_lookup(u64 key); · 6 unmodified lines | ||
| 525 | 549 | int bpf_trampoline_link_prog(struct bpf_prog *prog); |
| 526 | 550 | int bpf_trampoline_unlink_prog(struct bpf_prog *prog); |
| 527 | 551 | void bpf_trampoline_put(struct bpf_trampoline *tr); |
| 528 | −#define BPF_DISPATCHER_INIT(name) { \ | |
| 529 | − .mutex = __MUTEX_INITIALIZER(name.mutex), \ | |
| 530 | − .func = &name##func, \ | |
| 531 | − .progs = {}, \ | |
| 532 | − .num_progs = 0, \ | |
| 533 | − .image = NULL, \ | |
| 534 | − .image_off = 0 \ | |
| 552 | +#define BPF_DISPATCHER_INIT(_name) { \ | |
| 553 | + .mutex = __MUTEX_INITIALIZER(_name.mutex), \ | |
| 554 | + .func = &_name##_func, \ | |
| 555 | + .progs = {}, \ | |
| 556 | + .num_progs = 0, \ | |
| 557 | + .image = NULL, \ | |
| 558 | + .image_off = 0, \ | |
| 559 | + .ksym = { \ | |
| 560 | + .name = #_name, \ | |
| 561 | + .lnode = LIST_HEAD_INIT(_name.ksym.lnode), \ | |
| 562 | + }, \ | |
| 535 | 563 | } |
| 536 | 564 | |
| 537 | 565 | #define DEFINE_BPF_DISPATCHER(name) \ |
| 538 | − noinline unsigned int name##func( \ | |
| 566 | + noinline unsigned int bpf_dispatcher_##name##_func( \ | |
| 539 | 567 | const void *ctx, \ |
| 540 | 568 | const struct bpf_insn *insnsi, \ |
| 541 | 569 | unsigned int (*bpf_func)(const void *, \ |
| @@ -543,26 +571,26 @@ void bpf_trampoline_put(struct bpf_trampoline *tr); · 1 unmodified line | ||
| 543 | 571 | { \ |
| 544 | 572 | return bpf_func(ctx, insnsi); \ |
| 545 | 573 | } \ |
| 546 | − EXPORT_SYMBOL(name##func); \ | |
| 547 | − struct bpf_dispatcher name = BPF_DISPATCHER_INIT(name); | |
| 574 | + EXPORT_SYMBOL(bpf_dispatcher_##name##_func); \ | |
| 575 | + struct bpf_dispatcher bpf_dispatcher_##name = \ | |
| 576 | + BPF_DISPATCHER_INIT(bpf_dispatcher_##name); | |
| 548 | 577 | #define DECLARE_BPF_DISPATCHER(name) \ |
| 549 | − unsigned int name##func( \ | |
| 578 | + unsigned int bpf_dispatcher_##name##_func( \ | |
| 550 | 579 | const void *ctx, \ |
| 551 | 580 | const struct bpf_insn *insnsi, \ |
| 552 | 581 | unsigned int (*bpf_func)(const void *, \ |
| 553 | 582 | const struct bpf_insn *)); \ |
| 554 | − extern struct bpf_dispatcher name; | |
| 555 | −#define BPF_DISPATCHER_FUNC(name) name##func | |
| 556 | −#define BPF_DISPATCHER_PTR(name) (&name) | |
| 583 | + extern struct bpf_dispatcher bpf_dispatcher_##name; | |
| 584 | +#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_##name##_func | |
| 585 | +#define BPF_DISPATCHER_PTR(name) (&bpf_dispatcher_##name) | |
| 557 | 586 | void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from, |
| 558 | 587 | struct bpf_prog *to); |
| 559 | −struct bpf_image { | |
| 560 | − struct latch_tree_node tnode; | |
| 561 | − unsigned char data[]; | |
| 562 | −}; | |
| 563 | −#define BPF_IMAGE_SIZE (PAGE_SIZE - sizeof(struct bpf_image)) | |
| 564 | −bool is_bpf_image_address(unsigned long address); | |
| 565 | −void *bpf_image_alloc(void); | |
| 588 | +/* Called only from JIT-enabled code, so there's no need for stubs. */ | |
| 589 | +void *bpf_jit_alloc_exec_page(void); | |
| 590 | +void bpf_image_ksym_add(void *data, struct bpf_ksym *ksym); | |
| 591 | +void bpf_image_ksym_del(struct bpf_ksym *ksym); | |
| 592 | +void bpf_ksym_add(struct bpf_ksym *ksym); | |
| 593 | +void bpf_ksym_del(struct bpf_ksym *ksym); | |
| 566 | 594 | #else |
| 567 | 595 | static inline struct bpf_trampoline *bpf_trampoline_lookup(u64 key) |
| 568 | 596 | { |
| @@ -579,7 +607,7 @@ static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog) · 10 unmodified lines | ||
| 579 | 607 | static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {} |
| 580 | 608 | #define DEFINE_BPF_DISPATCHER(name) |
| 581 | 609 | #define DECLARE_BPF_DISPATCHER(name) |
| 582 | −#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_nopfunc | |
| 610 | +#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_nop_func | |
| 583 | 611 | #define BPF_DISPATCHER_PTR(name) NULL |
| 584 | 612 | static inline void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, |
| 585 | 613 | struct bpf_prog *from, |
| @@ -640,8 +668,7 @@ struct bpf_prog_aux { · 54 unmodified lines | ||
| 640 | 668 | void *jit_data; /* JIT specific data. arch dependent */ |
| 641 | 669 | struct bpf_jit_poke_descriptor *poke_tab; |
| 642 | 670 | u32 size_poke_tab; |
| 643 | − struct latch_tree_node ksym_tnode; | |
| 644 | − struct list_head ksym_lnode; | |
| 671 | + struct bpf_ksym ksym; | |
| 645 | 672 | const struct bpf_prog_ops *ops; |
| 646 | 673 | struct bpf_map **used_maps; |
| 647 | 674 | struct bpf_prog *prog; |
| @@ -859,7 +886,7 @@ struct bpf_prog_array_item { · 211 unmodified lines | ||
| 859 | 886 | |
| 860 | 887 | struct bpf_prog_array { |
| 861 | 888 | struct rcu_head rcu; |
| 862 | − struct bpf_prog_array_item items[0]; | |
| 889 | + struct bpf_prog_array_item items[]; | |
| 863 | 890 | }; |
| 864 | 891 | |
| 865 | 892 | struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); |
| @@ -885,7 +912,7 @@ int bpf_prog_array_copy(struct bpf_prog_array *old_array, · 19 unmodified lines | ||
| 885 | 912 | struct bpf_prog *_prog; \ |
| 886 | 913 | struct bpf_prog_array *_array; \ |
| 887 | 914 | u32 _ret = 1; \ |
| 888 | − preempt_disable(); \ | |
| 915 | + migrate_disable(); \ | |
| 889 | 916 | rcu_read_lock(); \ |
| 890 | 917 | _array = rcu_dereference(array); \ |
| 891 | 918 | if (unlikely(check_non_null && !_array))\ |
| @@ -898,7 +925,7 @@ int bpf_prog_array_copy(struct bpf_prog_array *old_array, · 6 unmodified lines | ||
| 898 | 925 | } \ |
| 899 | 926 | _out: \ |
| 900 | 927 | rcu_read_unlock(); \ |
| 901 | − preempt_enable(); \ | |
| 928 | + migrate_enable(); \ | |
| 902 | 929 | _ret; \ |
| 903 | 930 | }) |
| 904 | 931 | |
| @@ -932,7 +959,7 @@ _out: \ · 27 unmodified lines | ||
| 932 | 959 | u32 ret; \ |
| 933 | 960 | u32 _ret = 1; \ |
| 934 | 961 | u32 _cn = 0; \ |
| 935 | − preempt_disable(); \ | |
| 962 | + migrate_disable(); \ | |
| 936 | 963 | rcu_read_lock(); \ |
| 937 | 964 | _array = rcu_dereference(array); \ |
| 938 | 965 | _item = &_array->items[0]; \ |
| @@ -944,7 +971,7 @@ _out: \ · 5 unmodified lines | ||
| 944 | 971 | _item++; \ |
| 945 | 972 | } \ |
| 946 | 973 | rcu_read_unlock(); \ |
| 947 | − preempt_enable(); \ | |
| 974 | + migrate_enable(); \ | |
| 948 | 975 | if (_ret) \ |
| 949 | 976 | _ret = (_cn ? NET_XMIT_CN : NET_XMIT_SUCCESS); \ |
| 950 | 977 | else \ |
| @@ -961,6 +988,36 @@ _out: \ · 10 unmodified lines | ||
| 961 | 988 | #ifdef CONFIG_BPF_SYSCALL |
| 962 | 989 | DECLARE_PER_CPU(int, bpf_prog_active); |
| 963 | 990 | |
| 991 | +/* | |
| 992 | + * Block execution of BPF programs attached to instrumentation (perf, | |
| 993 | + * kprobes, tracepoints) to prevent deadlocks on map operations as any of | |
| 994 | + * these events can happen inside a region which holds a map bucket lock | |
| 995 | + * and can deadlock on it. | |
| 996 | + * | |
| 997 | + * Use the preemption safe inc/dec variants on RT because migrate disable | |
| 998 | + * is preemptible on RT and preemption in the middle of the RMW operation | |
| 999 | + * might lead to inconsistent state. Use the raw variants for non RT | |
| 1000 | + * kernels as migrate_disable() maps to preempt_disable() so the slightly | |
| 1001 | + * more expensive save operation can be avoided. | |
| 1002 | + */ | |
| 1003 | +static inline void bpf_disable_instrumentation(void) | |
| 1004 | +{ | |
| 1005 | + migrate_disable(); | |
| 1006 | + if (IS_ENABLED(CONFIG_PREEMPT_RT)) | |
| 1007 | + this_cpu_inc(bpf_prog_active); | |
| 1008 | + else | |
| 1009 | + __this_cpu_inc(bpf_prog_active); | |
| 1010 | +} | |
| 1011 | + | |
| 1012 | +static inline void bpf_enable_instrumentation(void) | |
| 1013 | +{ | |
| 1014 | + if (IS_ENABLED(CONFIG_PREEMPT_RT)) | |
| 1015 | + this_cpu_dec(bpf_prog_active); | |
| 1016 | + else | |
| 1017 | + __this_cpu_dec(bpf_prog_active); | |
| 1018 | + migrate_enable(); | |
| 1019 | +} | |
| 1020 | + | |
| 964 | 1021 | extern const struct file_operations bpf_map_fops; |
| 965 | 1022 | extern const struct file_operations bpf_prog_fops; |
| 966 | 1023 | |
| @@ -993,6 +1050,7 @@ void __bpf_free_used_maps(struct bpf_prog_aux *aux, · 26 unmodified lines | ||
| 993 | 1050 | void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock); |
| 994 | 1051 | void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock); |
| 995 | 1052 | |
| 1053 | +struct bpf_map *bpf_map_get(u32 ufd); | |
| 996 | 1054 | struct bpf_map *bpf_map_get_with_uref(u32 ufd); |
| 997 | 1055 | struct bpf_map *__bpf_map_get(struct fd f); |
| 998 | 1056 | void bpf_map_inc(struct bpf_map *map); |
| @@ -1025,6 +1083,29 @@ extern int sysctl_unprivileged_bpf_disabled; · 26 unmodified lines | ||
| 1025 | 1083 | int bpf_map_new_fd(struct bpf_map *map, int flags); |
| 1026 | 1084 | int bpf_prog_new_fd(struct bpf_prog *prog); |
| 1027 | 1085 | |
| 1086 | +struct bpf_link { | |
| 1087 | + atomic64_t refcnt; | |
| 1088 | + const struct bpf_link_ops *ops; | |
| 1089 | + struct bpf_prog *prog; | |
| 1090 | + struct work_struct work; | |
| 1091 | +}; | |
| 1092 | + | |
| 1093 | +struct bpf_link_ops { | |
| 1094 | + void (*release)(struct bpf_link *link); | |
| 1095 | + void (*dealloc)(struct bpf_link *link); | |
| 1096 | + | |
| 1097 | +}; | |
| 1098 | + | |
| 1099 | +void bpf_link_init(struct bpf_link *link, const struct bpf_link_ops *ops, | |
| 1100 | + struct bpf_prog *prog); | |
| 1101 | +void bpf_link_cleanup(struct bpf_link *link, struct file *link_file, | |
| 1102 | + int link_fd); | |
| 1103 | +void bpf_link_inc(struct bpf_link *link); | |
| 1104 | +void bpf_link_put(struct bpf_link *link); | |
| 1105 | +int bpf_link_new_fd(struct bpf_link *link); | |
| 1106 | +struct file *bpf_link_new_file(struct bpf_link *link, int *reserved_fd); | |
| 1107 | +struct bpf_link *bpf_link_get_from_fd(u32 ufd); | |
| 1108 | + | |
| 1028 | 1109 | int bpf_obj_pin_user(u32 ufd, const char __user *pathname); |
| 1029 | 1110 | int bpf_obj_get_user(const char __user *pathname, int flags); |
| 1030 | 1111 | |
| @@ -1102,6 +1183,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, · 71 unmodified lines | ||
| 1102 | 1183 | union bpf_attr __user *uattr); |
| 1103 | 1184 | int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, |
| 1104 | 1185 | union bpf_attr __user *uattr); |
| 1186 | +int bpf_prog_test_run_tracing(struct bpf_prog *prog, | |
| 1187 | + const union bpf_attr *kattr, | |
| 1188 | + union bpf_attr __user *uattr); | |
| 1105 | 1189 | int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, |
| 1106 | 1190 | const union bpf_attr *kattr, |
| 1107 | 1191 | union bpf_attr __user *uattr); |
| @@ -1259,6 +1343,13 @@ static inline int bpf_prog_test_run_skb(struct bpf_prog *prog, · 151 unmodified lines | ||
| 1259 | 1343 | return -ENOTSUPP; |
| 1260 | 1344 | } |
| 1261 | 1345 | |
| 1346 | +static inline int bpf_prog_test_run_tracing(struct bpf_prog *prog, | |
| 1347 | + const union bpf_attr *kattr, | |
| 1348 | + union bpf_attr __user *uattr) | |
| 1349 | +{ | |
| 1350 | + return -ENOTSUPP; | |
| 1351 | +} | |
| 1352 | + | |
| 1262 | 1353 | static inline int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog, |
| 1263 | 1354 | const union bpf_attr *kattr, |
| 1264 | 1355 | union bpf_attr __user *uattr) |
| @@ -1355,6 +1446,8 @@ static inline void bpf_map_offload_map_free(struct bpf_map *map) · 90 unmodified lines | ||
| 1355 | 1446 | #if defined(CONFIG_BPF_STREAM_PARSER) |
| 1356 | 1447 | int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which); |
| 1357 | 1448 | int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog); |
| 1449 | +void sock_map_unhash(struct sock *sk); | |
| 1450 | +void sock_map_close(struct sock *sk, long timeout); | |
| 1358 | 1451 | #else |
| 1359 | 1452 | static inline int sock_map_prog_update(struct bpf_map *map, |
| 1360 | 1453 | struct bpf_prog *prog, u32 which) |
| @@ -1367,7 +1460,7 @@ static inline int sock_map_get_from_fd(const union bpf_attr *attr, · 6 unmodified lines | ||
| 1367 | 1460 | { |
| 1368 | 1461 | return -EINVAL; |
| 1369 | 1462 | } |
| 1370 | −#endif | |
| 1463 | +#endif /* CONFIG_BPF_STREAM_PARSER */ | |
| 1371 | 1464 | |
| 1372 | 1465 | #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) |
| 1373 | 1466 | void bpf_sk_reuseport_detach(struct sock *sk); |
| @@ -1417,6 +1510,7 @@ extern const struct bpf_func_proto bpf_get_stack_proto; · 43 unmodified lines | ||
| 1417 | 1510 | extern const struct bpf_func_proto bpf_sock_map_update_proto; |
| 1418 | 1511 | extern const struct bpf_func_proto bpf_sock_hash_update_proto; |
| 1419 | 1512 | extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto; |
| 1513 | +extern const struct bpf_func_proto bpf_get_current_ancestor_cgroup_id_proto; | |
| 1420 | 1514 | extern const struct bpf_func_proto bpf_msg_redirect_hash_proto; |
| 1421 | 1515 | extern const struct bpf_func_proto bpf_msg_redirect_map_proto; |
| 1422 | 1516 | extern const struct bpf_func_proto bpf_sk_redirect_hash_proto; |
| @@ -1428,6 +1522,10 @@ extern const struct bpf_func_proto bpf_strtol_proto; · 5 unmodified lines | ||
| 1428 | 1522 | extern const struct bpf_func_proto bpf_strtoul_proto; |
| 1429 | 1523 | extern const struct bpf_func_proto bpf_tcp_sock_proto; |
| 1430 | 1524 | extern const struct bpf_func_proto bpf_jiffies64_proto; |
| 1525 | +extern const struct bpf_func_proto bpf_get_ns_current_pid_tgid_proto; | |
| 1526 | + | |
| 1527 | +const struct bpf_func_proto *bpf_tracing_func_proto( | |
| 1528 | + enum bpf_func_id func_id, const struct bpf_prog *prog); | |
| 1431 | 1529 | |
| 1432 | 1530 | /* Shared helpers among cBPF and eBPF. */ |
| 1433 | 1531 | void bpf_user_rnd_init_once(void); |
| @@ -0,0 +1,33 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | + | |
| 3 | +/* | |
| 4 | + * Copyright (C) 2020 Google LLC. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +#ifndef _LINUX_BPF_LSM_H | |
| 8 | +#define _LINUX_BPF_LSM_H | |
| 9 | + | |
| 10 | +#include <linux/bpf.h> | |
| 11 | +#include <linux/lsm_hooks.h> | |
| 12 | + | |
| 13 | +#ifdef CONFIG_BPF_LSM | |
| 14 | + | |
| 15 | +#define LSM_HOOK(RET, DEFAULT, NAME, ...) \ | |
| 16 | + RET bpf_lsm_##NAME(__VA_ARGS__); | |
| 17 | +#include <linux/lsm_hook_defs.h> | |
| 18 | +#undef LSM_HOOK | |
| 19 | + | |
| 20 | +int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog, | |
| 21 | + const struct bpf_prog *prog); | |
| 22 | + | |
| 23 | +#else /* !CONFIG_BPF_LSM */ | |
| 24 | + | |
| 25 | +static inline int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog, | |
| 26 | + const struct bpf_prog *prog) | |
| 27 | +{ | |
| 28 | + return -EOPNOTSUPP; | |
| 29 | +} | |
| 30 | + | |
| 31 | +#endif /* CONFIG_BPF_LSM */ | |
| 32 | + | |
| 33 | +#endif /* _LINUX_BPF_LSM_H */ | |
| @@ -70,6 +70,10 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_STRUCT_OPS, bpf_struct_ops, · 69 unmodified lines | ||
| 70 | 70 | void *, void *) |
| 71 | 71 | BPF_PROG_TYPE(BPF_PROG_TYPE_EXT, bpf_extension, |
| 72 | 72 | void *, void *) |
| 73 | +#ifdef CONFIG_BPF_LSM | |
| 74 | +BPF_PROG_TYPE(BPF_PROG_TYPE_LSM, lsm, | |
| 75 | + void *, void *) | |
| 76 | +#endif /* CONFIG_BPF_LSM */ | |
| 73 | 77 | #endif |
| 74 | 78 | |
| 75 | 79 | BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops) |
| @@ -123,6 +123,10 @@ struct bpf_reg_state { · 122 unmodified lines | ||
| 123 | 123 | s64 smax_value; /* maximum possible (s64)value */ |
| 124 | 124 | u64 umin_value; /* minimum possible (u64)value */ |
| 125 | 125 | u64 umax_value; /* maximum possible (u64)value */ |
| 126 | + s32 s32_min_value; /* minimum possible (s32)value */ | |
| 127 | + s32 s32_max_value; /* maximum possible (s32)value */ | |
| 128 | + u32 u32_min_value; /* minimum possible (u32)value */ | |
| 129 | + u32 u32_max_value; /* maximum possible (u32)value */ | |
| 126 | 130 | /* parentage chain for liveness checking */ |
| 127 | 131 | struct bpf_reg_state *parent; |
| 128 | 132 | /* Inside the callee two registers can be both PTR_TO_STACK like |
| @@ -79,6 +79,7 @@ · 78 unmodified lines | ||
| 79 | 79 | #define MII_BCM54XX_ECR 0x10 /* BCM54xx extended control register */ |
| 80 | 80 | #define MII_BCM54XX_ECR_IM 0x1000 /* Interrupt mask */ |
| 81 | 81 | #define MII_BCM54XX_ECR_IF 0x0800 /* Interrupt force */ |
| 82 | +#define MII_BCM54XX_ECR_FIFOE 0x0001 /* FIFO elasticity */ | |
| 82 | 83 | |
| 83 | 84 | #define MII_BCM54XX_ESR 0x11 /* BCM54xx extended status register */ |
| 84 | 85 | #define MII_BCM54XX_ESR_IS 0x1000 /* Interrupt status */ |
| @@ -119,6 +120,7 @@ · 34 unmodified lines | ||
| 119 | 120 | #define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x00 |
| 120 | 121 | #define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400 |
| 121 | 122 | #define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800 |
| 123 | +#define MII_BCM54XX_AUXCTL_ACTL_EXT_PKT_LEN 0x4000 | |
| 122 | 124 | |
| 123 | 125 | #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07 |
| 124 | 126 | #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010 |
| @@ -22,9 +22,6 @@ enum bh_state_bits { · 21 unmodified lines | ||
| 22 | 22 | BH_Dirty, /* Is dirty */ |
| 23 | 23 | BH_Lock, /* Is locked */ |
| 24 | 24 | BH_Req, /* Has been submitted for I/O */ |
| 25 | − BH_Uptodate_Lock,/* Used by the first bh in a page, to serialise | |
| 26 | − * IO completion of other buffers in the page | |
| 27 | − */ | |
| 28 | 25 | |
| 29 | 26 | BH_Mapped, /* Has a disk mapping */ |
| 30 | 27 | BH_New, /* Disk mapping was newly created by get_block */ |
| @@ -76,6 +73,9 @@ struct buffer_head { · 45 unmodified lines | ||
| 76 | 73 | struct address_space *b_assoc_map; /* mapping this buffer is |
| 77 | 74 | associated with */ |
| 78 | 75 | atomic_t b_count; /* users using this buffer_head */ |
| 76 | + spinlock_t b_uptodate_lock; /* Used by the first bh in a page, to | |
| 77 | + * serialise IO completion of other | |
| 78 | + * buffers in the page */ | |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | 81 | /* |
| @@ -444,8 +444,9 @@ union ceph_mds_request_args { · 443 unmodified lines | ||
| 444 | 444 | } __attribute__ ((packed)) lookupino; |
| 445 | 445 | } __attribute__ ((packed)); |
| 446 | 446 | |
| 447 | −#define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */ | |
| 448 | −#define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */ | |
| 447 | +#define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */ | |
| 448 | +#define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */ | |
| 449 | +#define CEPH_MDS_FLAG_ASYNC 4 /* request is asynchronous */ | |
| 449 | 450 | |
| 450 | 451 | struct ceph_mds_request_head { |
| 451 | 452 | __le64 oldest_client_tid; |
| @@ -530,6 +531,9 @@ struct ceph_mds_reply_lease { · 78 unmodified lines | ||
| 530 | 531 | __le32 seq; |
| 531 | 532 | } __attribute__ ((packed)); |
| 532 | 533 | |
| 534 | +#define CEPH_LEASE_VALID (1 | 2) /* old and new bit values */ | |
| 535 | +#define CEPH_LEASE_PRIMARY_LINK 4 /* primary linkage */ | |
| 536 | + | |
| 533 | 537 | struct ceph_mds_reply_dirfrag { |
| 534 | 538 | __le32 frag; /* fragment */ |
| 535 | 539 | __le32 auth; /* auth mds, if this is a delegation point */ |
| @@ -564,6 +568,7 @@ struct ceph_filelock { · 28 unmodified lines | ||
| 564 | 568 | #define CEPH_FILE_MODE_RDWR 3 /* RD | WR */ |
| 565 | 569 | #define CEPH_FILE_MODE_LAZY 4 /* lazy io */ |
| 566 | 570 | #define CEPH_FILE_MODE_BITS 4 |
| 571 | +#define CEPH_FILE_MODE_MASK ((1 << CEPH_FILE_MODE_BITS) - 1) | |
| 567 | 572 | |
| 568 | 573 | int ceph_flags_to_mode(int flags); |
| 569 | 574 | |
| @@ -655,10 +660,19 @@ int ceph_flags_to_mode(int flags); · 85 unmodified lines | ||
| 655 | 660 | #define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \ |
| 656 | 661 | CEPH_CAP_ANY_FILE_WR | CEPH_CAP_FILE_LAZYIO | \ |
| 657 | 662 | CEPH_CAP_PIN) |
| 663 | +#define CEPH_CAP_ALL_FILE (CEPH_CAP_PIN | CEPH_CAP_ANY_SHARED | \ | |
| 664 | + CEPH_CAP_AUTH_EXCL | CEPH_CAP_XATTR_EXCL | \ | |
| 665 | + CEPH_CAP_ANY_FILE_RD | CEPH_CAP_ANY_FILE_WR) | |
| 658 | 666 | |
| 659 | 667 | #define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \ |
| 660 | 668 | CEPH_LOCK_IXATTR) |
| 661 | 669 | |
| 670 | +/* cap masks async dir operations */ | |
| 671 | +#define CEPH_CAP_DIR_CREATE CEPH_CAP_FILE_CACHE | |
| 672 | +#define CEPH_CAP_DIR_UNLINK CEPH_CAP_FILE_RD | |
| 673 | +#define CEPH_CAP_ANY_DIR_OPS (CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_RD | \ | |
| 674 | + CEPH_CAP_FILE_WREXTEND | CEPH_CAP_FILE_LAZYIO) | |
| 675 | + | |
| 662 | 676 | int ceph_caps_for_mode(int mode); |
| 663 | 677 | |
| 664 | 678 | enum { |
| @@ -2,22 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _FS_CEPH_DEBUGFS_H |
| 3 | 3 | #define _FS_CEPH_DEBUGFS_H |
| 4 | 4 | |
| 5 | −#include <linux/ceph/ceph_debug.h> | |
| 6 | 5 | #include <linux/ceph/types.h> |
| 7 | 6 | |
| 8 | −#define CEPH_DEFINE_SHOW_FUNC(name) \ | |
| 9 | −static int name##_open(struct inode *inode, struct file *file) \ | |
| 10 | −{ \ | |
| 11 | − return single_open(file, name, inode->i_private); \ | |
| 12 | −} \ | |
| 13 | − \ | |
| 14 | −static const struct file_operations name##_fops = { \ | |
| 15 | − .open = name##_open, \ | |
| 16 | − .read = seq_read, \ | |
| 17 | − .llseek = seq_lseek, \ | |
| 18 | − .release = single_release, \ | |
| 19 | −}; | |
| 20 | − | |
| 21 | 7 | /* debugfs.c */ |
| 22 | 8 | extern void ceph_debugfs_init(void); |
| 23 | 9 | extern void ceph_debugfs_cleanup(void); |
| @@ -272,6 +272,7 @@ extern struct kmem_cache *ceph_cap_flush_cachep; · 271 unmodified lines | ||
| 272 | 272 | extern struct kmem_cache *ceph_dentry_cachep; |
| 273 | 273 | extern struct kmem_cache *ceph_file_cachep; |
| 274 | 274 | extern struct kmem_cache *ceph_dir_file_cachep; |
| 275 | +extern struct kmem_cache *ceph_mds_request_cachep; | |
| 275 | 276 | |
| 276 | 277 | /* ceph_common.c */ |
| 277 | 278 | extern bool libceph_compatible(void *data); |
| @@ -175,9 +175,10 @@ struct ceph_msg_data { · 174 unmodified lines | ||
| 175 | 175 | #endif /* CONFIG_BLOCK */ |
| 176 | 176 | struct ceph_bvec_iter bvec_pos; |
| 177 | 177 | struct { |
| 178 | − struct page **pages; /* NOT OWNER. */ | |
| 178 | + struct page **pages; | |
| 179 | 179 | size_t length; /* total # bytes */ |
| 180 | 180 | unsigned int alignment; /* first page */ |
| 181 | + bool own_pages; | |
| 181 | 182 | }; |
| 182 | 183 | struct ceph_pagelist *pagelist; |
| 183 | 184 | }; |
| @@ -356,8 +357,8 @@ extern void ceph_con_keepalive(struct ceph_connection *con); · 172 unmodified lines | ||
| 356 | 357 | extern bool ceph_con_keepalive_expired(struct ceph_connection *con, |
| 357 | 358 | unsigned long interval); |
| 358 | 359 | |
| 359 | −extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, | |
| 360 | − size_t length, size_t alignment); | |
| 360 | +void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, | |
| 361 | + size_t length, size_t alignment, bool own_pages); | |
| 361 | 362 | extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg, |
| 362 | 363 | struct ceph_pagelist *pagelist); |
| 363 | 364 | #ifdef CONFIG_BLOCK |
| @@ -509,23 +509,6 @@ int ceph_osdc_call(struct ceph_osd_client *osdc, · 508 unmodified lines | ||
| 509 | 509 | struct page *req_page, size_t req_len, |
| 510 | 510 | struct page **resp_pages, size_t *resp_len); |
| 511 | 511 | |
| 512 | −extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, | |
| 513 | − struct ceph_vino vino, | |
| 514 | − struct ceph_file_layout *layout, | |
| 515 | − u64 off, u64 *plen, | |
| 516 | − u32 truncate_seq, u64 truncate_size, | |
| 517 | − struct page **pages, int nr_pages, | |
| 518 | − int page_align); | |
| 519 | − | |
| 520 | −extern int ceph_osdc_writepages(struct ceph_osd_client *osdc, | |
| 521 | − struct ceph_vino vino, | |
| 522 | − struct ceph_file_layout *layout, | |
| 523 | − struct ceph_snap_context *sc, | |
| 524 | − u64 off, u64 len, | |
| 525 | − u32 truncate_seq, u64 truncate_size, | |
| 526 | − struct timespec64 *mtime, | |
| 527 | − struct page **pages, int nr_pages); | |
| 528 | − | |
| 529 | 512 | int ceph_osdc_copy_from(struct ceph_osd_client *osdc, |
| 530 | 513 | u64 src_snapid, u64 src_version, |
| 531 | 514 | struct ceph_object_id *src_oid, |
| @@ -37,6 +37,9 @@ int ceph_spg_compare(const struct ceph_spg *lhs, const struct ceph_spg *rhs); · 36 unmodified lines | ||
| 37 | 37 | #define CEPH_POOL_FLAG_HASHPSPOOL (1ULL << 0) /* hash pg seed and pool id |
| 38 | 38 | together */ |
| 39 | 39 | #define CEPH_POOL_FLAG_FULL (1ULL << 1) /* pool is full */ |
| 40 | +#define CEPH_POOL_FLAG_FULL_QUOTA (1ULL << 10) /* pool ran out of quota, | |
| 41 | + will set FULL too */ | |
| 42 | +#define CEPH_POOL_FLAG_NEARFULL (1ULL << 11) /* pool is nearfull */ | |
| 40 | 43 | |
| 41 | 44 | struct ceph_pg_pool_info { |
| 42 | 45 | struct rb_node node; |
| @@ -304,5 +307,6 @@ extern struct ceph_pg_pool_info *ceph_pg_pool_by_id(struct ceph_osdmap *map, · 261 unmodified lines | ||
| 304 | 307 | |
| 305 | 308 | extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id); |
| 306 | 309 | extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name); |
| 310 | +u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id); | |
| 307 | 311 | |
| 308 | 312 | #endif |
| @@ -143,8 +143,10 @@ extern const char *ceph_osd_state_name(int s); · 142 unmodified lines | ||
| 143 | 143 | /* |
| 144 | 144 | * osd map flag bits |
| 145 | 145 | */ |
| 146 | −#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */ | |
| 147 | −#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */ | |
| 146 | +#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC), | |
| 147 | + not set since ~luminous */ | |
| 148 | +#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC), | |
| 149 | + not set since ~luminous */ | |
| 148 | 150 | #define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */ |
| 149 | 151 | #define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */ |
| 150 | 152 | #define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */ |
| @@ -94,6 +94,11 @@ enum { · 93 unmodified lines | ||
| 94 | 94 | * Enable legacy local memory.events. |
| 95 | 95 | */ |
| 96 | 96 | CGRP_ROOT_MEMORY_LOCAL_EVENTS = (1 << 5), |
| 97 | + | |
| 98 | + /* | |
| 99 | + * Enable recursive subtree protection | |
| 100 | + */ | |
| 101 | + CGRP_ROOT_MEMORY_RECURSIVE_PROT = (1 << 6), | |
| 97 | 102 | }; |
| 98 | 103 | |
| 99 | 104 | /* cftype->flags */ |
| @@ -628,8 +633,9 @@ struct cgroup_subsys { · 528 unmodified lines | ||
| 628 | 633 | void (*cancel_attach)(struct cgroup_taskset *tset); |
| 629 | 634 | void (*attach)(struct cgroup_taskset *tset); |
| 630 | 635 | void (*post_attach)(void); |
| 631 | − int (*can_fork)(struct task_struct *task); | |
| 632 | − void (*cancel_fork)(struct task_struct *task); | |
| 636 | + int (*can_fork)(struct task_struct *task, | |
| 637 | + struct css_set *cset); | |
| 638 | + void (*cancel_fork)(struct task_struct *task, struct css_set *cset); | |
| 633 | 639 | void (*fork)(struct task_struct *task); |
| 634 | 640 | void (*exit)(struct task_struct *task); |
| 635 | 641 | void (*release)(struct task_struct *task); |
| @@ -27,6 +27,8 @@ · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | #include <linux/cgroup-defs.h> |
| 29 | 29 | |
| 30 | +struct kernel_clone_args; | |
| 31 | + | |
| 30 | 32 | #ifdef CONFIG_CGROUPS |
| 31 | 33 | |
| 32 | 34 | /* |
| @@ -58,10 +60,8 @@ struct css_task_iter { · 25 unmodified lines | ||
| 58 | 60 | struct list_head *tcset_head; |
| 59 | 61 | |
| 60 | 62 | struct list_head *task_pos; |
| 61 | − struct list_head *tasks_head; | |
| 62 | − struct list_head *mg_tasks_head; | |
| 63 | − struct list_head *dying_tasks_head; | |
| 64 | 63 | |
| 64 | + struct list_head *cur_tasks_head; | |
| 65 | 65 | struct css_set *cur_cset; |
| 66 | 66 | struct css_set *cur_dcset; |
| 67 | 67 | struct task_struct *cur_task; |
| @@ -121,9 +121,12 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, · 53 unmodified lines | ||
| 121 | 121 | struct pid *pid, struct task_struct *tsk); |
| 122 | 122 | |
| 123 | 123 | void cgroup_fork(struct task_struct *p); |
| 124 | −extern int cgroup_can_fork(struct task_struct *p); | |
| 125 | −extern void cgroup_cancel_fork(struct task_struct *p); | |
| 126 | −extern void cgroup_post_fork(struct task_struct *p); | |
| 124 | +extern int cgroup_can_fork(struct task_struct *p, | |
| 125 | + struct kernel_clone_args *kargs); | |
| 126 | +extern void cgroup_cancel_fork(struct task_struct *p, | |
| 127 | + struct kernel_clone_args *kargs); | |
| 128 | +extern void cgroup_post_fork(struct task_struct *p, | |
| 129 | + struct kernel_clone_args *kargs); | |
| 127 | 130 | void cgroup_exit(struct task_struct *p); |
| 128 | 131 | void cgroup_release(struct task_struct *p); |
| 129 | 132 | void cgroup_free(struct task_struct *p); |
| @@ -707,9 +710,12 @@ static inline int cgroupstats_build(struct cgroupstats *stats, · 577 unmodified lines | ||
| 707 | 710 | struct dentry *dentry) { return -EINVAL; } |
| 708 | 711 | |
| 709 | 712 | static inline void cgroup_fork(struct task_struct *p) {} |
| 710 | −static inline int cgroup_can_fork(struct task_struct *p) { return 0; } | |
| 711 | −static inline void cgroup_cancel_fork(struct task_struct *p) {} | |
| 712 | −static inline void cgroup_post_fork(struct task_struct *p) {} | |
| 713 | +static inline int cgroup_can_fork(struct task_struct *p, | |
| 714 | + struct kernel_clone_args *kargs) { return 0; } | |
| 715 | +static inline void cgroup_cancel_fork(struct task_struct *p, | |
| 716 | + struct kernel_clone_args *kargs) {} | |
| 717 | +static inline void cgroup_post_fork(struct task_struct *p, | |
| 718 | + struct kernel_clone_args *kargs) {} | |
| 713 | 719 | static inline void cgroup_exit(struct task_struct *p) {} |
| 714 | 720 | static inline void cgroup_release(struct task_struct *p) {} |
| 715 | 721 | static inline void cgroup_free(struct task_struct *p) {} |
| @@ -522,9 +522,9 @@ struct clk *clk_register_gate(struct device *dev, const char *name, · 521 unmodified lines | ||
| 522 | 522 | * @clk_gate_flags: gate-specific flags for this clock |
| 523 | 523 | * @lock: shared register lock for this clock |
| 524 | 524 | */ |
| 525 | −#define clk_hw_register_gate_parent_hw(dev, name, parent_name, flags, reg, \ | |
| 525 | +#define clk_hw_register_gate_parent_hw(dev, name, parent_hw, flags, reg, \ | |
| 526 | 526 | bit_idx, clk_gate_flags, lock) \ |
| 527 | − __clk_hw_register_gate((dev), NULL, (name), (parent_name), NULL, \ | |
| 527 | + __clk_hw_register_gate((dev), NULL, (name), NULL, (parent_hw), \ | |
| 528 | 528 | NULL, (flags), (reg), (bit_idx), \ |
| 529 | 529 | (clk_gate_flags), (lock)) |
| 530 | 530 | /** |
| @@ -539,10 +539,10 @@ struct clk *clk_register_gate(struct device *dev, const char *name, · 8 unmodified lines | ||
| 539 | 539 | * @clk_gate_flags: gate-specific flags for this clock |
| 540 | 540 | * @lock: shared register lock for this clock |
| 541 | 541 | */ |
| 542 | −#define clk_hw_register_gate_parent_data(dev, name, parent_name, flags, reg, \ | |
| 542 | +#define clk_hw_register_gate_parent_data(dev, name, parent_data, flags, reg, \ | |
| 543 | 543 | bit_idx, clk_gate_flags, lock) \ |
| 544 | − __clk_hw_register_gate((dev), NULL, (name), (parent_name), NULL, \ | |
| 545 | − NULL, (flags), (reg), (bit_idx), \ | |
| 544 | + __clk_hw_register_gate((dev), NULL, (name), NULL, NULL, (parent_data), \ | |
| 545 | + (flags), (reg), (bit_idx), \ | |
| 546 | 546 | (clk_gate_flags), (lock)) |
| 547 | 547 | void clk_unregister_gate(struct clk *clk); |
| 548 | 548 | void clk_hw_unregister_gate(struct clk_hw *hw); |
| @@ -12,6 +12,9 @@ · 11 unmodified lines | ||
| 12 | 12 | #ifndef AT91_PMC_H |
| 13 | 13 | #define AT91_PMC_H |
| 14 | 14 | |
| 15 | +#define AT91_PMC_V1 (1) /* PMC version 1 */ | |
| 16 | +#define AT91_PMC_V2 (2) /* PMC version 2 [SAM9X60] */ | |
| 17 | + | |
| 15 | 18 | #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ |
| 16 | 19 | #define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */ |
| 17 | 20 | |
| @@ -30,16 +33,34 @@ · 12 unmodified lines | ||
| 30 | 33 | #define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */ |
| 31 | 34 | #define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */ |
| 32 | 35 | |
| 36 | +#define AT91_PMC_PLL_CTRL0 0x0C /* PLL Control Register 0 [for SAM9X60] */ | |
| 37 | +#define AT91_PMC_PLL_CTRL0_ENPLL (1 << 28) /* Enable PLL */ | |
| 38 | +#define AT91_PMC_PLL_CTRL0_ENPLLCK (1 << 29) /* Enable PLL clock for PMC */ | |
| 39 | +#define AT91_PMC_PLL_CTRL0_ENLOCK (1 << 31) /* Enable PLL lock */ | |
| 40 | + | |
| 41 | +#define AT91_PMC_PLL_CTRL1 0x10 /* PLL Control Register 1 [for SAM9X60] */ | |
| 42 | + | |
| 33 | 43 | #define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */ |
| 34 | 44 | #define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */ |
| 35 | 45 | #define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */ |
| 36 | 46 | |
| 47 | +#define AT91_PMC_PLL_ACR 0x18 /* PLL Analog Control Register [for SAM9X60] */ | |
| 48 | +#define AT91_PMC_PLL_ACR_DEFAULT_UPLL 0x12020010UL /* Default PLL ACR value for UPLL */ | |
| 49 | +#define AT91_PMC_PLL_ACR_DEFAULT_PLLA 0x00020010UL /* Default PLL ACR value for PLLA */ | |
| 50 | +#define AT91_PMC_PLL_ACR_UTMIVR (1 << 12) /* UPLL Voltage regulator Control */ | |
| 51 | +#define AT91_PMC_PLL_ACR_UTMIBG (1 << 13) /* UPLL Bandgap Control */ | |
| 52 | + | |
| 37 | 53 | #define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */ |
| 38 | 54 | #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ |
| 39 | 55 | #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ |
| 40 | 56 | #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ |
| 41 | 57 | #define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */ |
| 42 | 58 | |
| 59 | +#define AT91_PMC_PLL_UPDT 0x1C /* PMC PLL update register [for SAM9X60] */ | |
| 60 | +#define AT91_PMC_PLL_UPDT_UPDATE (1 << 8) /* Update PLL settings */ | |
| 61 | +#define AT91_PMC_PLL_UPDT_ID (1 << 0) /* PLL ID */ | |
| 62 | +#define AT91_PMC_PLL_UPDT_STUPTIM (0xff << 16) /* Startup time */ | |
| 63 | + | |
| 43 | 64 | #define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */ |
| 44 | 65 | #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ |
| 45 | 66 | #define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */ |
| @@ -180,6 +201,8 @@ · 134 unmodified lines | ||
| 180 | 201 | #define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */ |
| 181 | 202 | #define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */ |
| 182 | 203 | |
| 204 | +#define AT91_PMC_PLL_ISR0 0xEC /* PLL Interrupt Status Register 0 [SAM9X60 only] */ | |
| 205 | + | |
| 183 | 206 | #define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/ |
| 184 | 207 | #define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */ |
| 185 | 208 | #define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */ |
| @@ -23,18 +23,31 @@ · 22 unmodified lines | ||
| 23 | 23 | struct clocksource; |
| 24 | 24 | struct module; |
| 25 | 25 | |
| 26 | −#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA | |
| 26 | +#if defined(CONFIG_ARCH_CLOCKSOURCE_DATA) || \ | |
| 27 | + defined(CONFIG_GENERIC_GETTIMEOFDAY) | |
| 27 | 28 | #include <asm/clocksource.h> |
| 28 | 29 | #endif |
| 29 | 30 | |
| 31 | +#include <vdso/clocksource.h> | |
| 32 | + | |
| 30 | 33 | /** |
| 31 | 34 | * struct clocksource - hardware abstraction for a free running counter |
| 32 | 35 | * Provides mostly state-free accessors to the underlying hardware. |
| 33 | 36 | * This is the structure used for system time. |
| 34 | 37 | * |
| 35 | − * @name: ptr to clocksource name | |
| 36 | − * @list: list head for registration | |
| 37 | − * @rating: rating value for selection (higher is better) | |
| 38 | + * @read: Returns a cycle value, passes clocksource as argument | |
| 39 | + * @mask: Bitmask for two's complement | |
| 40 | + * subtraction of non 64 bit counters | |
| 41 | + * @mult: Cycle to nanosecond multiplier | |
| 42 | + * @shift: Cycle to nanosecond divisor (power of two) | |
| 43 | + * @max_idle_ns: Maximum idle time permitted by the clocksource (nsecs) | |
| 44 | + * @maxadj: Maximum adjustment value to mult (~11%) | |
| 45 | + * @archdata: Optional arch-specific data | |
| 46 | + * @max_cycles: Maximum safe cycle value which won't overflow on | |
| 47 | + * multiplication | |
| 48 | + * @name: Pointer to clocksource name | |
| 49 | + * @list: List head for registration (internal) | |
| 50 | + * @rating: Rating value for selection (higher is better) | |
| 38 | 51 | * To avoid rating inflation the following |
| 39 | 52 | * list should give you a guide as to how |
| 40 | 53 | * to assign your clocksource a rating |
| @@ -49,27 +62,23 @@ struct module; · 8 unmodified lines | ||
| 49 | 62 | * 400-499: Perfect |
| 50 | 63 | * The ideal clocksource. A must-use where |
| 51 | 64 | * available. |
| 52 | − * @read: returns a cycle value, passes clocksource as argument | |
| 53 | − * @enable: optional function to enable the clocksource | |
| 54 | − * @disable: optional function to disable the clocksource | |
| 55 | − * @mask: bitmask for two's complement | |
| 56 | − * subtraction of non 64 bit counters | |
| 57 | − * @mult: cycle to nanosecond multiplier | |
| 58 | − * @shift: cycle to nanosecond divisor (power of two) | |
| 59 | − * @max_idle_ns: max idle time permitted by the clocksource (nsecs) | |
| 60 | − * @maxadj: maximum adjustment value to mult (~11%) | |
| 61 | − * @max_cycles: maximum safe cycle value which won't overflow on multiplication | |
| 62 | − * @flags: flags describing special properties | |
| 63 | − * @archdata: arch-specific data | |
| 64 | − * @suspend: suspend function for the clocksource, if necessary | |
| 65 | − * @resume: resume function for the clocksource, if necessary | |
| 65 | + * @flags: Flags describing special properties | |
| 66 | + * @enable: Optional function to enable the clocksource | |
| 67 | + * @disable: Optional function to disable the clocksource | |
| 68 | + * @suspend: Optional suspend function for the clocksource | |
| 69 | + * @resume: Optional resume function for the clocksource | |
| 66 | 70 | * @mark_unstable: Optional function to inform the clocksource driver that |
| 67 | 71 | * the watchdog marked the clocksource unstable |
| 68 | − * @owner: module reference, must be set by clocksource in modules | |
| 72 | + * @tick_stable: Optional function called periodically from the watchdog | |
| 73 | + * code to provide stable syncrhonization points | |
| 74 | + * @wd_list: List head to enqueue into the watchdog list (internal) | |
| 75 | + * @cs_last: Last clocksource value for clocksource watchdog | |
| 76 | + * @wd_last: Last watchdog value corresponding to @cs_last | |
| 77 | + * @owner: Module reference, must be set by clocksource in modules | |
| 69 | 78 | * |
| 70 | 79 | * Note: This struct is not used in hotpathes of the timekeeping code |
| 71 | 80 | * because the timekeeper caches the hot path fields in its own data |
| 72 | − * structure, so no line cache alignment is required, | |
| 81 | + * structure, so no cache line alignment is required, | |
| 73 | 82 | * |
| 74 | 83 | * The pointer to the clocksource itself is handed to the read |
| 75 | 84 | * callback. If you need extra information there you can wrap struct |
| @@ -78,35 +87,37 @@ struct module; · 2 unmodified lines | ||
| 78 | 87 | * structure. |
| 79 | 88 | */ |
| 80 | 89 | struct clocksource { |
| 81 | − u64 (*read)(struct clocksource *cs); | |
| 82 | − u64 mask; | |
| 83 | − u32 mult; | |
| 84 | − u32 shift; | |
| 85 | − u64 max_idle_ns; | |
| 86 | − u32 maxadj; | |
| 90 | + u64 (*read)(struct clocksource *cs); | |
| 91 | + u64 mask; | |
| 92 | + u32 mult; | |
| 93 | + u32 shift; | |
| 94 | + u64 max_idle_ns; | |
| 95 | + u32 maxadj; | |
| 87 | 96 | #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA |
| 88 | 97 | struct arch_clocksource_data archdata; |
| 89 | 98 | #endif |
| 90 | − u64 max_cycles; | |
| 91 | − const char *name; | |
| 92 | − struct list_head list; | |
| 93 | − int rating; | |
| 94 | − int (*enable)(struct clocksource *cs); | |
| 95 | − void (*disable)(struct clocksource *cs); | |
| 96 | − unsigned long flags; | |
| 97 | − void (*suspend)(struct clocksource *cs); | |
| 98 | − void (*resume)(struct clocksource *cs); | |
| 99 | − void (*mark_unstable)(struct clocksource *cs); | |
| 100 | − void (*tick_stable)(struct clocksource *cs); | |
| 99 | + u64 max_cycles; | |
| 100 | + const char *name; | |
| 101 | + struct list_head list; | |
| 102 | + int rating; | |
| 103 | + enum vdso_clock_mode vdso_clock_mode; | |
| 104 | + unsigned long flags; | |
| 105 | + | |
| 106 | + int (*enable)(struct clocksource *cs); | |
| 107 | + void (*disable)(struct clocksource *cs); | |
| 108 | + void (*suspend)(struct clocksource *cs); | |
| 109 | + void (*resume)(struct clocksource *cs); | |
| 110 | + void (*mark_unstable)(struct clocksource *cs); | |
| 111 | + void (*tick_stable)(struct clocksource *cs); | |
| 101 | 112 | |
| 102 | 113 | /* private: */ |
| 103 | 114 | #ifdef CONFIG_CLOCKSOURCE_WATCHDOG |
| 104 | 115 | /* Watchdog related data, used by the framework */ |
| 105 | − struct list_head wd_list; | |
| 106 | − u64 cs_last; | |
| 107 | − u64 wd_last; | |
| 116 | + struct list_head wd_list; | |
| 117 | + u64 cs_last; | |
| 118 | + u64 wd_last; | |
| 108 | 119 | #endif |
| 109 | − struct module *owner; | |
| 120 | + struct module *owner; | |
| 110 | 121 | }; |
| 111 | 122 | |
| 112 | 123 | /* |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | #include <linux/init.h> |
| 6 | 6 | #include <linux/types.h> |
| 7 | +#include <linux/numa.h> | |
| 7 | 8 | |
| 8 | 9 | /* |
| 9 | 10 | * There is always at least global CMA area and a few optional |
| @@ -24,10 +25,19 @@ extern phys_addr_t cma_get_base(const struct cma *cma); · 14 unmodified lines | ||
| 24 | 25 | extern unsigned long cma_get_size(const struct cma *cma); |
| 25 | 26 | extern const char *cma_get_name(const struct cma *cma); |
| 26 | 27 | |
| 27 | −extern int __init cma_declare_contiguous(phys_addr_t base, | |
| 28 | +extern int __init cma_declare_contiguous_nid(phys_addr_t base, | |
| 28 | 29 | phys_addr_t size, phys_addr_t limit, |
| 29 | 30 | phys_addr_t alignment, unsigned int order_per_bit, |
| 30 | − bool fixed, const char *name, struct cma **res_cma); | |
| 31 | + bool fixed, const char *name, struct cma **res_cma, | |
| 32 | + int nid); | |
| 33 | +static inline int __init cma_declare_contiguous(phys_addr_t base, | |
| 34 | + phys_addr_t size, phys_addr_t limit, | |
| 35 | + phys_addr_t alignment, unsigned int order_per_bit, | |
| 36 | + bool fixed, const char *name, struct cma **res_cma) | |
| 37 | +{ | |
| 38 | + return cma_declare_contiguous_nid(base, size, limit, alignment, | |
| 39 | + order_per_bit, fixed, name, res_cma, NUMA_NO_NODE); | |
| 40 | +} | |
| 31 | 41 | extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, |
| 32 | 42 | unsigned int order_per_bit, |
| 33 | 43 | const char *name, |
| @@ -454,12 +454,13 @@ extern void __user *compat_alloc_user_space(unsigned long len); · 453 unmodified lines | ||
| 454 | 454 | |
| 455 | 455 | int compat_restore_altstack(const compat_stack_t __user *uss); |
| 456 | 456 | int __compat_save_altstack(compat_stack_t __user *, unsigned long); |
| 457 | −#define compat_save_altstack_ex(uss, sp) do { \ | |
| 457 | +#define unsafe_compat_save_altstack(uss, sp, label) do { \ | |
| 458 | 458 | compat_stack_t __user *__uss = uss; \ |
| 459 | 459 | struct task_struct *t = current; \ |
| 460 | − put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \ | |
| 461 | − put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \ | |
| 462 | − put_user_ex(t->sas_ss_size, &__uss->ss_size); \ | |
| 460 | + unsafe_put_user(ptr_to_compat((void __user *)t->sas_ss_sp), \ | |
| 461 | + &__uss->ss_sp, label); \ | |
| 462 | + unsafe_put_user(t->sas_ss_flags, &__uss->ss_flags, label); \ | |
| 463 | + unsafe_put_user(t->sas_ss_size, &__uss->ss_size, label); \ | |
| 463 | 464 | if (t->sas_ss_flags & SS_AUTODISARM) \ |
| 464 | 465 | sas_ss_reset(t); \ |
| 465 | 466 | } while (0); |
| @@ -347,7 +347,7 @@ static inline void *offset_to_ptr(const int *off) · 346 unmodified lines | ||
| 347 | 347 | * compiler has support to do so. |
| 348 | 348 | */ |
| 349 | 349 | #define compiletime_assert(condition, msg) \ |
| 350 | − _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) | |
| 350 | + _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | |
| 351 | 351 | |
| 352 | 352 | #define compiletime_assert_atomic_type(t) \ |
| 353 | 353 | compiletime_assert(__native_word(t), \ |
| @@ -129,22 +129,13 @@ struct ftrace_likely_data { · 128 unmodified lines | ||
| 129 | 129 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) |
| 130 | 130 | |
| 131 | 131 | /* |
| 132 | − * Force always-inline if the user requests it so via the .config. | |
| 133 | 132 | * Prefer gnu_inline, so that extern inline functions do not emit an |
| 134 | 133 | * externally visible function. This makes extern inline behave as per gnu89 |
| 135 | 134 | * semantics rather than c99. This prevents multiple symbol definition errors |
| 136 | 135 | * of extern inline functions at link time. |
| 137 | 136 | * A lot of inline functions can cause havoc with function tracing. |
| 138 | − * Do not use __always_inline here, since currently it expands to inline again | |
| 139 | − * (which would break users of __always_inline). | |
| 140 | 137 | */ |
| 141 | −#if !defined(CONFIG_OPTIMIZE_INLINING) | |
| 142 | −#define inline inline __attribute__((__always_inline__)) __gnu_inline \ | |
| 143 | − __inline_maybe_unused notrace | |
| 144 | −#else | |
| 145 | −#define inline inline __gnu_inline \ | |
| 146 | − __inline_maybe_unused notrace | |
| 147 | −#endif | |
| 138 | +#define inline inline __gnu_inline __inline_maybe_unused notrace | |
| 148 | 139 | |
| 149 | 140 | /* |
| 150 | 141 | * gcc provides both __inline__ and __inline as alternate spellings of |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | * See kernel/sched/completion.c for details. |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | −#include <linux/wait.h> | |
| 12 | +#include <linux/swait.h> | |
| 13 | 13 | |
| 14 | 14 | /* |
| 15 | 15 | * struct completion - structure used to maintain state for a "completion" |
| @@ -25,7 +25,7 @@ · 9 unmodified lines | ||
| 25 | 25 | */ |
| 26 | 26 | struct completion { |
| 27 | 27 | unsigned int done; |
| 28 | − wait_queue_head_t wait; | |
| 28 | + struct swait_queue_head wait; | |
| 29 | 29 | }; |
| 30 | 30 | |
| 31 | 31 | #define init_completion_map(x, m) __init_completion(x) |
| @@ -34,7 +34,7 @@ static inline void complete_acquire(struct completion *x) {} · 2 unmodified lines | ||
| 34 | 34 | static inline void complete_release(struct completion *x) {} |
| 35 | 35 | |
| 36 | 36 | #define COMPLETION_INITIALIZER(work) \ |
| 37 | − { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } | |
| 37 | + { 0, __SWAIT_QUEUE_HEAD_INITIALIZER((work).wait) } | |
| 38 | 38 | |
| 39 | 39 | #define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \ |
| 40 | 40 | (*({ init_completion_map(&(work), &(map)); &(work); })) |
| @@ -85,7 +85,7 @@ static inline void complete_release(struct completion *x) {} · 44 unmodified lines | ||
| 85 | 85 | static inline void __init_completion(struct completion *x) |
| 86 | 86 | { |
| 87 | 87 | x->done = 0; |
| 88 | − init_waitqueue_head(&x->wait); | |
| 88 | + init_swait_queue_head(&x->wait); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
| @@ -148,6 +148,7 @@ struct console { · 147 unmodified lines | ||
| 148 | 148 | struct tty_driver *(*device)(struct console *, int *); |
| 149 | 149 | void (*unblank)(void); |
| 150 | 150 | int (*setup)(struct console *, char *); |
| 151 | + int (*exit)(struct console *); | |
| 151 | 152 | int (*match)(struct console *, char *name, int idx, char *options); |
| 152 | 153 | short flags; |
| 153 | 154 | short index; |
| @@ -1,9 +1,6 @@ | ||
| 1 | 1 | #ifndef _LINUX_CONST_H |
| 2 | 2 | #define _LINUX_CONST_H |
| 3 | 3 | |
| 4 | −#include <uapi/linux/const.h> | |
| 5 | − | |
| 6 | −#define UL(x) (_UL(x)) | |
| 7 | −#define ULL(x) (_ULL(x)) | |
| 4 | +#include <vdso/const.h> | |
| 8 | 5 | |
| 9 | 6 | #endif /* _LINUX_CONST_H */ |
| @@ -41,6 +41,7 @@ enum coresight_dev_type { · 40 unmodified lines | ||
| 41 | 41 | CORESIGHT_DEV_TYPE_LINKSINK, |
| 42 | 42 | CORESIGHT_DEV_TYPE_SOURCE, |
| 43 | 43 | CORESIGHT_DEV_TYPE_HELPER, |
| 44 | + CORESIGHT_DEV_TYPE_ECT, | |
| 44 | 45 | }; |
| 45 | 46 | |
| 46 | 47 | enum coresight_dev_subtype_sink { |
| @@ -68,6 +69,12 @@ enum coresight_dev_subtype_helper { · 21 unmodified lines | ||
| 68 | 69 | CORESIGHT_DEV_SUBTYPE_HELPER_CATU, |
| 69 | 70 | }; |
| 70 | 71 | |
| 72 | +/* Embedded Cross Trigger (ECT) sub-types */ | |
| 73 | +enum coresight_dev_subtype_ect { | |
| 74 | + CORESIGHT_DEV_SUBTYPE_ECT_NONE, | |
| 75 | + CORESIGHT_DEV_SUBTYPE_ECT_CTI, | |
| 76 | +}; | |
| 77 | + | |
| 71 | 78 | /** |
| 72 | 79 | * union coresight_dev_subtype - further characterisation of a type |
| 73 | 80 | * @sink_subtype: type of sink this component is, as defined |
| @@ -78,6 +85,8 @@ enum coresight_dev_subtype_helper { · 4 unmodified lines | ||
| 78 | 85 | * by @coresight_dev_subtype_source. |
| 79 | 86 | * @helper_subtype: type of helper this component is, as defined |
| 80 | 87 | * by @coresight_dev_subtype_helper. |
| 88 | + * @ect_subtype: type of cross trigger this component is, as | |
| 89 | + * defined by @coresight_dev_subtype_ect | |
| 81 | 90 | */ |
| 82 | 91 | union coresight_dev_subtype { |
| 83 | 92 | /* We have some devices which acts as LINK and SINK */ |
| @@ -87,6 +96,7 @@ union coresight_dev_subtype { · 3 unmodified lines | ||
| 87 | 96 | }; |
| 88 | 97 | enum coresight_dev_subtype_source source_subtype; |
| 89 | 98 | enum coresight_dev_subtype_helper helper_subtype; |
| 99 | + enum coresight_dev_subtype_ect ect_subtype; | |
| 90 | 100 | }; |
| 91 | 101 | |
| 92 | 102 | /** |
| @@ -153,6 +163,8 @@ struct coresight_connection { · 60 unmodified lines | ||
| 153 | 163 | * activated but not yet enabled. Enabling for a _sink_ |
| 154 | 164 | * appens when a source has been selected for that it. |
| 155 | 165 | * @ea: Device attribute for sink representation under PMU directory. |
| 166 | + * @ect_dev: Associated cross trigger device. Not part of the trace data | |
| 167 | + * path or connections. | |
| 156 | 168 | */ |
| 157 | 169 | struct coresight_device { |
| 158 | 170 | struct coresight_platform_data *pdata; |
| @@ -166,6 +178,8 @@ struct coresight_device { · 7 unmodified lines | ||
| 166 | 178 | /* sink specific fields */ |
| 167 | 179 | bool activated; /* true only if a sink is part of a path */ |
| 168 | 180 | struct dev_ext_attribute *ea; |
| 181 | + /* cross trigger handling */ | |
| 182 | + struct coresight_device *ect_dev; | |
| 169 | 183 | }; |
| 170 | 184 | |
| 171 | 185 | /* |
| @@ -196,6 +210,7 @@ static struct coresight_dev_list (var) = { \ · 24 unmodified lines | ||
| 196 | 210 | #define sink_ops(csdev) csdev->ops->sink_ops |
| 197 | 211 | #define link_ops(csdev) csdev->ops->link_ops |
| 198 | 212 | #define helper_ops(csdev) csdev->ops->helper_ops |
| 213 | +#define ect_ops(csdev) csdev->ops->ect_ops | |
| 199 | 214 | |
| 200 | 215 | /** |
| 201 | 216 | * struct coresight_ops_sink - basic operations for a sink |
| @@ -262,11 +277,23 @@ struct coresight_ops_helper { · 60 unmodified lines | ||
| 262 | 277 | int (*disable)(struct coresight_device *csdev, void *data); |
| 263 | 278 | }; |
| 264 | 279 | |
| 280 | +/** | |
| 281 | + * struct coresight_ops_ect - Ops for an embedded cross trigger device | |
| 282 | + * | |
| 283 | + * @enable : Enable the device | |
| 284 | + * @disable : Disable the device | |
| 285 | + */ | |
| 286 | +struct coresight_ops_ect { | |
| 287 | + int (*enable)(struct coresight_device *csdev); | |
| 288 | + int (*disable)(struct coresight_device *csdev); | |
| 289 | +}; | |
| 290 | + | |
| 265 | 291 | struct coresight_ops { |
| 266 | 292 | const struct coresight_ops_sink *sink_ops; |
| 267 | 293 | const struct coresight_ops_link *link_ops; |
| 268 | 294 | const struct coresight_ops_source *source_ops; |
| 269 | 295 | const struct coresight_ops_helper *helper_ops; |
| 296 | + const struct coresight_ops_ect *ect_ops; | |
| 270 | 297 | }; |
| 271 | 298 | |
| 272 | 299 | #ifdef CONFIG_CORESIGHT |
| @@ -88,10 +88,13 @@ extern ssize_t arch_cpu_release(const char *, size_t); · 87 unmodified lines | ||
| 88 | 88 | |
| 89 | 89 | #ifdef CONFIG_SMP |
| 90 | 90 | extern bool cpuhp_tasks_frozen; |
| 91 | −int cpu_up(unsigned int cpu); | |
| 91 | +int add_cpu(unsigned int cpu); | |
| 92 | +int cpu_device_up(struct device *dev); | |
| 92 | 93 | void notify_cpu_starting(unsigned int cpu); |
| 93 | 94 | extern void cpu_maps_update_begin(void); |
| 94 | 95 | extern void cpu_maps_update_done(void); |
| 96 | +int bringup_hibernate_cpu(unsigned int sleep_cpu); | |
| 97 | +void bringup_nonboot_cpus(unsigned int setup_max_cpus); | |
| 95 | 98 | |
| 96 | 99 | #else /* CONFIG_SMP */ |
| 97 | 100 | #define cpuhp_tasks_frozen 0 |
| @@ -117,7 +120,9 @@ extern void lockdep_assert_cpus_held(void); · 19 unmodified lines | ||
| 117 | 120 | extern void cpu_hotplug_disable(void); |
| 118 | 121 | extern void cpu_hotplug_enable(void); |
| 119 | 122 | void clear_tasks_mm_cpumask(int cpu); |
| 120 | −int cpu_down(unsigned int cpu); | |
| 123 | +int remove_cpu(unsigned int cpu); | |
| 124 | +int cpu_device_down(struct device *dev); | |
| 125 | +extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu); | |
| 121 | 126 | |
| 122 | 127 | #else /* CONFIG_HOTPLUG_CPU */ |
| 123 | 128 | |
| @@ -129,6 +134,7 @@ static inline int cpus_read_trylock(void) { return true; } · 5 unmodified lines | ||
| 129 | 134 | static inline void lockdep_assert_cpus_held(void) { } |
| 130 | 135 | static inline void cpu_hotplug_disable(void) { } |
| 131 | 136 | static inline void cpu_hotplug_enable(void) { } |
| 137 | +static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } | |
| 132 | 138 | #endif /* !CONFIG_HOTPLUG_CPU */ |
| 133 | 139 | |
| 134 | 140 | /* Wrappers which go away once all code is converted */ |
| @@ -138,12 +144,18 @@ static inline void get_online_cpus(void) { cpus_read_lock(); } · 3 unmodified lines | ||
| 138 | 144 | static inline void put_online_cpus(void) { cpus_read_unlock(); } |
| 139 | 145 | |
| 140 | 146 | #ifdef CONFIG_PM_SLEEP_SMP |
| 141 | −extern int freeze_secondary_cpus(int primary); | |
| 147 | +int __freeze_secondary_cpus(int primary, bool suspend); | |
| 148 | +static inline int freeze_secondary_cpus(int primary) | |
| 149 | +{ | |
| 150 | + return __freeze_secondary_cpus(primary, true); | |
| 151 | +} | |
| 152 | + | |
| 142 | 153 | static inline int disable_nonboot_cpus(void) |
| 143 | 154 | { |
| 144 | − return freeze_secondary_cpus(0); | |
| 155 | + return __freeze_secondary_cpus(0, false); | |
| 145 | 156 | } |
| 146 | −extern void enable_nonboot_cpus(void); | |
| 157 | + | |
| 158 | +void enable_nonboot_cpus(void); | |
| 147 | 159 | |
| 148 | 160 | static inline int suspend_disable_secondary_cpus(void) |
| 149 | 161 | { |
| @@ -205,6 +205,7 @@ static inline bool policy_is_shared(struct cpufreq_policy *policy) · 204 unmodified lines | ||
| 205 | 205 | unsigned int cpufreq_get(unsigned int cpu); |
| 206 | 206 | unsigned int cpufreq_quick_get(unsigned int cpu); |
| 207 | 207 | unsigned int cpufreq_quick_get_max(unsigned int cpu); |
| 208 | +unsigned int cpufreq_get_hw_max_freq(unsigned int cpu); | |
| 208 | 209 | void disable_cpufreq(void); |
| 209 | 210 | |
| 210 | 211 | u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy); |
| @@ -232,6 +233,10 @@ static inline unsigned int cpufreq_quick_get_max(unsigned int cpu) · 21 unmodified lines | ||
| 232 | 233 | { |
| 233 | 234 | return 0; |
| 234 | 235 | } |
| 236 | +static inline unsigned int cpufreq_get_hw_max_freq(unsigned int cpu) | |
| 237 | +{ | |
| 238 | + return 0; | |
| 239 | +} | |
| 235 | 240 | static inline void disable_cpufreq(void) { } |
| 236 | 241 | #endif |
| 237 | 242 | |
| @@ -102,6 +102,7 @@ enum cpuhp_state { · 101 unmodified lines | ||
| 102 | 102 | CPUHP_AP_IRQ_ARMADA_XP_STARTING, |
| 103 | 103 | CPUHP_AP_IRQ_BCM2836_STARTING, |
| 104 | 104 | CPUHP_AP_IRQ_MIPS_GIC_STARTING, |
| 105 | + CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING, | |
| 105 | 106 | CPUHP_AP_ARM_MVEBU_COHERENCY, |
| 106 | 107 | CPUHP_AP_MICROCODE_LOADER, |
| 107 | 108 | CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, |
| @@ -194,6 +194,11 @@ static inline unsigned int cpumask_local_spread(unsigned int i, int node) · 193 unmodified lines | ||
| 194 | 194 | return 0; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | +static inline int cpumask_any_and_distribute(const struct cpumask *src1p, | |
| 198 | + const struct cpumask *src2p) { | |
| 199 | + return cpumask_next_and(-1, src1p, src2p); | |
| 200 | +} | |
| 201 | + | |
| 197 | 202 | #define for_each_cpu(cpu, mask) \ |
| 198 | 203 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) |
| 199 | 204 | #define for_each_cpu_not(cpu, mask) \ |
| @@ -245,6 +250,8 @@ static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) · 45 unmodified lines | ||
| 245 | 250 | int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); |
| 246 | 251 | int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); |
| 247 | 252 | unsigned int cpumask_local_spread(unsigned int i, int node); |
| 253 | +int cpumask_any_and_distribute(const struct cpumask *src1p, | |
| 254 | + const struct cpumask *src2p); | |
| 248 | 255 | |
| 249 | 256 | /** |
| 250 | 257 | * for_each_cpu - iterate over every cpu in a mask |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | typedef unsigned long dax_entry_t; |
| 14 | 14 | |
| 15 | 15 | struct iomap_ops; |
| 16 | +struct iomap; | |
| 16 | 17 | struct dax_device; |
| 17 | 18 | struct dax_operations { |
| 18 | 19 | /* |
| @@ -34,6 +35,8 @@ struct dax_operations { · 15 unmodified lines | ||
| 34 | 35 | /* copy_to_iter: required operation for fs-dax direct-i/o */ |
| 35 | 36 | size_t (*copy_to_iter)(struct dax_device *, pgoff_t, void *, size_t, |
| 36 | 37 | struct iov_iter *); |
| 38 | + /* zero_page_range: required operation. Zero page range */ | |
| 39 | + int (*zero_page_range)(struct dax_device *, pgoff_t, size_t); | |
| 37 | 40 | }; |
| 38 | 41 | |
| 39 | 42 | extern struct attribute_group dax_attribute_group; |
| @@ -199,6 +202,8 @@ size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, · 159 unmodified lines | ||
| 199 | 202 | size_t bytes, struct iov_iter *i); |
| 200 | 203 | size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, |
| 201 | 204 | size_t bytes, struct iov_iter *i); |
| 205 | +int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, | |
| 206 | + size_t nr_pages); | |
| 202 | 207 | void dax_flush(struct dax_device *dax_dev, void *addr, size_t size); |
| 203 | 208 | |
| 204 | 209 | ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, |
| @@ -210,20 +215,8 @@ vm_fault_t dax_finish_sync_fault(struct vm_fault *vmf, · 5 unmodified lines | ||
| 210 | 215 | int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index); |
| 211 | 216 | int dax_invalidate_mapping_entry_sync(struct address_space *mapping, |
| 212 | 217 | pgoff_t index); |
| 213 | − | |
| 214 | −#ifdef CONFIG_FS_DAX | |
| 215 | −int __dax_zero_page_range(struct block_device *bdev, | |
| 216 | − struct dax_device *dax_dev, sector_t sector, | |
| 217 | − unsigned int offset, unsigned int length); | |
| 218 | −#else | |
| 219 | −static inline int __dax_zero_page_range(struct block_device *bdev, | |
| 220 | − struct dax_device *dax_dev, sector_t sector, | |
| 221 | − unsigned int offset, unsigned int length) | |
| 222 | −{ | |
| 223 | − return -ENXIO; | |
| 224 | −} | |
| 225 | −#endif | |
| 226 | − | |
| 218 | +int dax_iomap_zero(loff_t pos, unsigned offset, unsigned size, | |
| 219 | + struct iomap *iomap); | |
| 227 | 220 | static inline bool dax_mapping(struct address_space *mapping) |
| 228 | 221 | { |
| 229 | 222 | return mapping->host && IS_DAX(mapping->host); |
| @@ -198,7 +198,7 @@ enum dccp_role { · 197 unmodified lines | ||
| 198 | 198 | |
| 199 | 199 | struct dccp_service_list { |
| 200 | 200 | __u32 dccpsl_nr; |
| 201 | − __be32 dccpsl_list[0]; | |
| 201 | + __be32 dccpsl_list[]; | |
| 202 | 202 | }; |
| 203 | 203 | |
| 204 | 204 | #define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) |
| @@ -35,6 +35,7 @@ struct debugfs_regset32 { · 34 unmodified lines | ||
| 35 | 35 | const struct debugfs_reg32 *regs; |
| 36 | 36 | int nregs; |
| 37 | 37 | void __iomem *base; |
| 38 | + struct device *dev; /* Optional device for Runtime PM */ | |
| 38 | 39 | }; |
| 39 | 40 | |
| 40 | 41 | extern struct dentry *arch_debugfs_dir; |
| @@ -67,10 +68,10 @@ struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode, · 26 unmodified lines | ||
| 67 | 68 | struct dentry *parent, void *data, |
| 68 | 69 | const struct file_operations *fops); |
| 69 | 70 | |
| 70 | −struct dentry *debugfs_create_file_size(const char *name, umode_t mode, | |
| 71 | − struct dentry *parent, void *data, | |
| 72 | − const struct file_operations *fops, | |
| 73 | − loff_t file_size); | |
| 71 | +void debugfs_create_file_size(const char *name, umode_t mode, | |
| 72 | + struct dentry *parent, void *data, | |
| 73 | + const struct file_operations *fops, | |
| 74 | + loff_t file_size); | |
| 74 | 75 | |
| 75 | 76 | struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); |
| 76 | 77 | |
| @@ -181,13 +182,11 @@ static inline struct dentry *debugfs_create_file_unsafe(const char *name, · 104 unmodified lines | ||
| 181 | 182 | return ERR_PTR(-ENODEV); |
| 182 | 183 | } |
| 183 | 184 | |
| 184 | −static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode, | |
| 185 | − struct dentry *parent, void *data, | |
| 186 | − const struct file_operations *fops, | |
| 187 | − loff_t file_size) | |
| 188 | −{ | |
| 189 | − return ERR_PTR(-ENODEV); | |
| 190 | −} | |
| 185 | +static inline void debugfs_create_file_size(const char *name, umode_t mode, | |
| 186 | + struct dentry *parent, void *data, | |
| 187 | + const struct file_operations *fops, | |
| 188 | + loff_t file_size) | |
| 189 | +{ } | |
| 191 | 190 | |
| 192 | 191 | static inline struct dentry *debugfs_create_dir(const char *name, |
| 193 | 192 | struct dentry *parent) |
| @@ -158,7 +158,7 @@ struct devfreq_stats { · 157 unmodified lines | ||
| 158 | 158 | * functions except for the context of callbacks defined in struct |
| 159 | 159 | * devfreq_governor, the governor should protect its access with the |
| 160 | 160 | * struct mutex lock in struct devfreq. A governor may use this mutex |
| 161 | − * to protect its own private data in void *data as well. | |
| 161 | + * to protect its own private data in ``void *data`` as well. | |
| 162 | 162 | */ |
| 163 | 163 | struct devfreq { |
| 164 | 164 | struct list_head node; |
| @@ -201,24 +201,23 @@ struct devfreq_freqs { · 36 unmodified lines | ||
| 201 | 201 | }; |
| 202 | 202 | |
| 203 | 203 | #if defined(CONFIG_PM_DEVFREQ) |
| 204 | −extern struct devfreq *devfreq_add_device(struct device *dev, | |
| 205 | − struct devfreq_dev_profile *profile, | |
| 206 | − const char *governor_name, | |
| 207 | − void *data); | |
| 208 | −extern int devfreq_remove_device(struct devfreq *devfreq); | |
| 209 | −extern struct devfreq *devm_devfreq_add_device(struct device *dev, | |
| 210 | − struct devfreq_dev_profile *profile, | |
| 211 | − const char *governor_name, | |
| 212 | − void *data); | |
| 213 | −extern void devm_devfreq_remove_device(struct device *dev, | |
| 214 | − struct devfreq *devfreq); | |
| 204 | +struct devfreq *devfreq_add_device(struct device *dev, | |
| 205 | + struct devfreq_dev_profile *profile, | |
| 206 | + const char *governor_name, | |
| 207 | + void *data); | |
| 208 | +int devfreq_remove_device(struct devfreq *devfreq); | |
| 209 | +struct devfreq *devm_devfreq_add_device(struct device *dev, | |
| 210 | + struct devfreq_dev_profile *profile, | |
| 211 | + const char *governor_name, | |
| 212 | + void *data); | |
| 213 | +void devm_devfreq_remove_device(struct device *dev, struct devfreq *devfreq); | |
| 215 | 214 | |
| 216 | 215 | /* Supposed to be called by PM callbacks */ |
| 217 | −extern int devfreq_suspend_device(struct devfreq *devfreq); | |
| 218 | −extern int devfreq_resume_device(struct devfreq *devfreq); | |
| 216 | +int devfreq_suspend_device(struct devfreq *devfreq); | |
| 217 | +int devfreq_resume_device(struct devfreq *devfreq); | |
| 219 | 218 | |
| 220 | −extern void devfreq_suspend(void); | |
| 221 | −extern void devfreq_resume(void); | |
| 219 | +void devfreq_suspend(void); | |
| 220 | +void devfreq_resume(void); | |
| 222 | 221 | |
| 223 | 222 | /** |
| 224 | 223 | * update_devfreq() - Reevaluate the device and configure frequency |
| @@ -226,39 +225,38 @@ extern void devfreq_resume(void); · 1 unmodified line | ||
| 226 | 225 | * |
| 227 | 226 | * Note: devfreq->lock must be held |
| 228 | 227 | */ |
| 229 | −extern int update_devfreq(struct devfreq *devfreq); | |
| 228 | +int update_devfreq(struct devfreq *devfreq); | |
| 230 | 229 | |
| 231 | 230 | /* Helper functions for devfreq user device driver with OPP. */ |
| 232 | −extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, | |
| 233 | − unsigned long *freq, u32 flags); | |
| 234 | −extern int devfreq_register_opp_notifier(struct device *dev, | |
| 235 | − struct devfreq *devfreq); | |
| 236 | −extern int devfreq_unregister_opp_notifier(struct device *dev, | |
| 237 | − struct devfreq *devfreq); | |
| 238 | −extern int devm_devfreq_register_opp_notifier(struct device *dev, | |
| 239 | − struct devfreq *devfreq); | |
| 240 | −extern void devm_devfreq_unregister_opp_notifier(struct device *dev, | |
| 241 | − struct devfreq *devfreq); | |
| 242 | −extern int devfreq_register_notifier(struct devfreq *devfreq, | |
| 243 | − struct notifier_block *nb, | |
| 244 | − unsigned int list); | |
| 245 | −extern int devfreq_unregister_notifier(struct devfreq *devfreq, | |
| 246 | − struct notifier_block *nb, | |
| 247 | − unsigned int list); | |
| 248 | −extern int devm_devfreq_register_notifier(struct device *dev, | |
| 231 | +struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, | |
| 232 | + unsigned long *freq, u32 flags); | |
| 233 | +int devfreq_register_opp_notifier(struct device *dev, | |
| 234 | + struct devfreq *devfreq); | |
| 235 | +int devfreq_unregister_opp_notifier(struct device *dev, | |
| 236 | + struct devfreq *devfreq); | |
| 237 | +int devm_devfreq_register_opp_notifier(struct device *dev, | |
| 238 | + struct devfreq *devfreq); | |
| 239 | +void devm_devfreq_unregister_opp_notifier(struct device *dev, | |
| 240 | + struct devfreq *devfreq); | |
| 241 | +int devfreq_register_notifier(struct devfreq *devfreq, | |
| 242 | + struct notifier_block *nb, | |
| 243 | + unsigned int list); | |
| 244 | +int devfreq_unregister_notifier(struct devfreq *devfreq, | |
| 245 | + struct notifier_block *nb, | |
| 246 | + unsigned int list); | |
| 247 | +int devm_devfreq_register_notifier(struct device *dev, | |
| 249 | 248 | struct devfreq *devfreq, |
| 250 | 249 | struct notifier_block *nb, |
| 251 | 250 | unsigned int list); |
| 252 | −extern void devm_devfreq_unregister_notifier(struct device *dev, | |
| 251 | +void devm_devfreq_unregister_notifier(struct device *dev, | |
| 253 | 252 | struct devfreq *devfreq, |
| 254 | 253 | struct notifier_block *nb, |
| 255 | 254 | unsigned int list); |
| 256 | −extern struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, | |
| 257 | − int index); | |
| 255 | +struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index); | |
| 258 | 256 | |
| 259 | 257 | #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) |
| 260 | 258 | /** |
| 261 | − * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq | |
| 259 | + * struct devfreq_simple_ondemand_data - ``void *data`` fed to struct devfreq | |
| 262 | 260 | * and devfreq_add_device |
| 263 | 261 | * @upthreshold: If the load is over this value, the frequency jumps. |
| 264 | 262 | * Specify 0 to use the default. Valid value = 0 to 100. |
| @@ -278,7 +276,7 @@ struct devfreq_simple_ondemand_data { · 13 unmodified lines | ||
| 278 | 276 | |
| 279 | 277 | #if IS_ENABLED(CONFIG_DEVFREQ_GOV_PASSIVE) |
| 280 | 278 | /** |
| 281 | − * struct devfreq_passive_data - void *data fed to struct devfreq | |
| 279 | + * struct devfreq_passive_data - ``void *data`` fed to struct devfreq | |
| 282 | 280 | * and devfreq_add_device |
| 283 | 281 | * @parent: the devfreq instance of parent device. |
| 284 | 282 | * @get_target_freq: Optional callback, Returns desired operating frequency |
| @@ -311,9 +309,9 @@ struct devfreq_passive_data { · 26 unmodified lines | ||
| 311 | 309 | |
| 312 | 310 | #else /* !CONFIG_PM_DEVFREQ */ |
| 313 | 311 | static inline struct devfreq *devfreq_add_device(struct device *dev, |
| 314 | − struct devfreq_dev_profile *profile, | |
| 315 | − const char *governor_name, | |
| 316 | − void *data) | |
| 312 | + struct devfreq_dev_profile *profile, | |
| 313 | + const char *governor_name, | |
| 314 | + void *data) | |
| 317 | 315 | { |
| 318 | 316 | return ERR_PTR(-ENOSYS); |
| 319 | 317 | } |
| @@ -350,31 +348,31 @@ static inline void devfreq_suspend(void) {} · 30 unmodified lines | ||
| 350 | 348 | static inline void devfreq_resume(void) {} |
| 351 | 349 | |
| 352 | 350 | static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, |
| 353 | − unsigned long *freq, u32 flags) | |
| 351 | + unsigned long *freq, u32 flags) | |
| 354 | 352 | { |
| 355 | 353 | return ERR_PTR(-EINVAL); |
| 356 | 354 | } |
| 357 | 355 | |
| 358 | 356 | static inline int devfreq_register_opp_notifier(struct device *dev, |
| 359 | − struct devfreq *devfreq) | |
| 357 | + struct devfreq *devfreq) | |
| 360 | 358 | { |
| 361 | 359 | return -EINVAL; |
| 362 | 360 | } |
| 363 | 361 | |
| 364 | 362 | static inline int devfreq_unregister_opp_notifier(struct device *dev, |
| 365 | − struct devfreq *devfreq) | |
| 363 | + struct devfreq *devfreq) | |
| 366 | 364 | { |
| 367 | 365 | return -EINVAL; |
| 368 | 366 | } |
| 369 | 367 | |
| 370 | 368 | static inline int devm_devfreq_register_opp_notifier(struct device *dev, |
| 371 | − struct devfreq *devfreq) | |
| 369 | + struct devfreq *devfreq) | |
| 372 | 370 | { |
| 373 | 371 | return -EINVAL; |
| 374 | 372 | } |
| 375 | 373 | |
| 376 | 374 | static inline void devm_devfreq_unregister_opp_notifier(struct device *dev, |
| 377 | − struct devfreq *devfreq) | |
| 375 | + struct devfreq *devfreq) | |
| 378 | 376 | { |
| 379 | 377 | } |
| 380 | 378 | |
| @@ -393,22 +391,22 @@ static inline int devfreq_unregister_notifier(struct devfreq *devfreq, · 12 unmodified lines | ||
| 393 | 391 | } |
| 394 | 392 | |
| 395 | 393 | static inline int devm_devfreq_register_notifier(struct device *dev, |
| 396 | − struct devfreq *devfreq, | |
| 397 | − struct notifier_block *nb, | |
| 398 | − unsigned int list) | |
| 394 | + struct devfreq *devfreq, | |
| 395 | + struct notifier_block *nb, | |
| 396 | + unsigned int list) | |
| 399 | 397 | { |
| 400 | 398 | return 0; |
| 401 | 399 | } |
| 402 | 400 | |
| 403 | 401 | static inline void devm_devfreq_unregister_notifier(struct device *dev, |
| 404 | − struct devfreq *devfreq, | |
| 405 | − struct notifier_block *nb, | |
| 406 | − unsigned int list) | |
| 402 | + struct devfreq *devfreq, | |
| 403 | + struct notifier_block *nb, | |
| 404 | + unsigned int list) | |
| 407 | 405 | { |
| 408 | 406 | } |
| 409 | 407 | |
| 410 | 408 | static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, |
| 411 | − int index) | |
| 409 | + int index) | |
| 412 | 410 | { |
| 413 | 411 | return ERR_PTR(-ENODEV); |
| 414 | 412 | } |
| @@ -75,7 +75,7 @@ void devfreq_cooling_unregister(struct thermal_cooling_device *dfc); · 74 unmodified lines | ||
| 75 | 75 | |
| 76 | 76 | #else /* !CONFIG_DEVFREQ_THERMAL */ |
| 77 | 77 | |
| 78 | −struct thermal_cooling_device * | |
| 78 | +static inline struct thermal_cooling_device * | |
| 79 | 79 | of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df, |
| 80 | 80 | struct devfreq_cooling_power *dfc_power) |
| 81 | 81 | { |
| @@ -141,6 +141,8 @@ typedef long (*dm_dax_direct_access_fn) (struct dm_target *ti, pgoff_t pgoff, · 140 unmodified lines | ||
| 141 | 141 | long nr_pages, void **kaddr, pfn_t *pfn); |
| 142 | 142 | typedef size_t (*dm_dax_copy_iter_fn)(struct dm_target *ti, pgoff_t pgoff, |
| 143 | 143 | void *addr, size_t bytes, struct iov_iter *i); |
| 144 | +typedef int (*dm_dax_zero_page_range_fn)(struct dm_target *ti, pgoff_t pgoff, | |
| 145 | + size_t nr_pages); | |
| 144 | 146 | #define PAGE_SECTORS (PAGE_SIZE / 512) |
| 145 | 147 | |
| 146 | 148 | void dm_error(const char *message); |
| @@ -195,6 +197,7 @@ struct target_type { · 48 unmodified lines | ||
| 195 | 197 | dm_dax_direct_access_fn direct_access; |
| 196 | 198 | dm_dax_copy_iter_fn dax_copy_from_iter; |
| 197 | 199 | dm_dax_copy_iter_fn dax_copy_to_iter; |
| 200 | + dm_dax_zero_page_range_fn dax_zero_page_range; | |
| 198 | 201 | |
| 199 | 202 | /* For internal device-mapper use. */ |
| 200 | 203 | struct list_head list; |
| @@ -42,9 +42,8 @@ struct device_node; · 41 unmodified lines | ||
| 42 | 42 | struct fwnode_handle; |
| 43 | 43 | struct iommu_ops; |
| 44 | 44 | struct iommu_group; |
| 45 | −struct iommu_fwspec; | |
| 46 | 45 | struct dev_pin_info; |
| 47 | −struct iommu_param; | |
| 46 | +struct dev_iommu; | |
| 48 | 47 | |
| 49 | 48 | /** |
| 50 | 49 | * struct subsys_interface - interfaces to device functions |
| @@ -513,8 +512,7 @@ struct dev_links_info { · 462 unmodified lines | ||
| 513 | 512 | * gone away. This should be set by the allocator of the |
| 514 | 513 | * device (i.e. the bus driver that discovered the device). |
| 515 | 514 | * @iommu_group: IOMMU group the device belongs to. |
| 516 | − * @iommu_fwspec: IOMMU-specific properties supplied by firmware. | |
| 517 | − * @iommu_param: Per device generic IOMMU runtime data | |
| 515 | + * @iommu: Per device generic IOMMU runtime data | |
| 518 | 516 | * |
| 519 | 517 | * @offline_disabled: If set, the device is permanently online. |
| 520 | 518 | * @offline: Set after successful invocation of bus type's .offline(). |
| @@ -613,8 +611,7 @@ struct device { · 92 unmodified lines | ||
| 613 | 611 | |
| 614 | 612 | void (*release)(struct device *dev); |
| 615 | 613 | struct iommu_group *iommu_group; |
| 616 | − struct iommu_fwspec *iommu_fwspec; | |
| 617 | − struct iommu_param *iommu_param; | |
| 614 | + struct dev_iommu *iommu; | |
| 618 | 615 | |
| 619 | 616 | bool offline_disabled:1; |
| 620 | 617 | bool offline:1; |
| @@ -828,6 +825,7 @@ extern struct device *device_find_child_by_name(struct device *parent, · 207 unmodified lines | ||
| 828 | 825 | extern int device_rename(struct device *dev, const char *new_name); |
| 829 | 826 | extern int device_move(struct device *dev, struct device *new_parent, |
| 830 | 827 | enum dpm_order dpm_order); |
| 828 | +extern int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid); | |
| 831 | 829 | extern const char *device_get_devnode(struct device *dev, |
| 832 | 830 | umode_t *mode, kuid_t *uid, kgid_t *gid, |
| 833 | 831 | const char **tmp); |
| @@ -236,9 +236,9 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) · 235 unmodified lines | ||
| 236 | 236 | } |
| 237 | 237 | #endif |
| 238 | 238 | |
| 239 | +extern int driver_deferred_probe_timeout; | |
| 239 | 240 | void driver_deferred_probe_add(struct device *dev); |
| 240 | 241 | int driver_deferred_probe_check_state(struct device *dev); |
| 241 | −int driver_deferred_probe_check_state_continue(struct device *dev); | |
| 242 | 242 | void driver_init(void); |
| 243 | 243 | |
| 244 | 244 | /** |
| @@ -247,11 +247,6 @@ extern int dio_create_sysfs_dev_files(struct dio_dev *); · 246 unmodified lines | ||
| 247 | 247 | /* New-style probing */ |
| 248 | 248 | extern int dio_register_driver(struct dio_driver *); |
| 249 | 249 | extern void dio_unregister_driver(struct dio_driver *); |
| 250 | −extern const struct dio_device_id *dio_match_device(const struct dio_device_id *ids, const struct dio_dev *z); | |
| 251 | −static inline struct dio_driver *dio_dev_driver(const struct dio_dev *d) | |
| 252 | −{ | |
| 253 | − return d->driver; | |
| 254 | −} | |
| 255 | 250 | |
| 256 | 251 | #define dio_resource_start(d) ((d)->resource.start) |
| 257 | 252 | #define dio_resource_end(d) ((d)->resource.end) |
| @@ -108,7 +108,7 @@ static inline void arch_dma_prep_coherent(struct page *page, size_t size) · 107 unmodified lines | ||
| 108 | 108 | } |
| 109 | 109 | #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */ |
| 110 | 110 | |
| 111 | −void *uncached_kernel_address(void *addr); | |
| 112 | −void *cached_kernel_address(void *addr); | |
| 111 | +void *arch_dma_set_uncached(void *addr, size_t size); | |
| 112 | +void arch_dma_clear_uncached(void *addr, size_t size); | |
| 113 | 113 | |
| 114 | 114 | #endif /* _LINUX_DMA_NONCOHERENT_H */ |
| @@ -300,6 +300,8 @@ struct dma_router { · 299 unmodified lines | ||
| 300 | 300 | * @chan_id: channel ID for sysfs |
| 301 | 301 | * @dev: class device for sysfs |
| 302 | 302 | * @name: backlink name for sysfs |
| 303 | + * @dbg_client_name: slave name for debugfs in format: | |
| 304 | + * dev_name(requester's dev):channel name, for example: "2b00000.mcasp:tx" | |
| 303 | 305 | * @device_node: used to add this to the device chan list |
| 304 | 306 | * @local: per-cpu pointer to a struct dma_chan_percpu |
| 305 | 307 | * @client_count: how many clients are using this channel |
| @@ -318,6 +320,9 @@ struct dma_chan { · 12 unmodified lines | ||
| 318 | 320 | int chan_id; |
| 319 | 321 | struct dma_chan_dev *dev; |
| 320 | 322 | const char *name; |
| 323 | +#ifdef CONFIG_DEBUG_FS | |
| 324 | + char *dbg_client_name; | |
| 325 | +#endif | |
| 321 | 326 | |
| 322 | 327 | struct list_head device_node; |
| 323 | 328 | struct dma_chan_percpu __percpu *local; |
| @@ -618,10 +623,11 @@ static inline void dmaengine_unmap_put(struct dmaengine_unmap_data *unmap) · 294 unmodified lines | ||
| 618 | 623 | |
| 619 | 624 | static inline void dma_descriptor_unmap(struct dma_async_tx_descriptor *tx) |
| 620 | 625 | { |
| 621 | − if (tx->unmap) { | |
| 622 | − dmaengine_unmap_put(tx->unmap); | |
| 623 | − tx->unmap = NULL; | |
| 624 | − } | |
| 626 | + if (!tx->unmap) | |
| 627 | + return; | |
| 628 | + | |
| 629 | + dmaengine_unmap_put(tx->unmap); | |
| 630 | + tx->unmap = NULL; | |
| 625 | 631 | } |
| 626 | 632 | |
| 627 | 633 | #ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH |
| @@ -805,7 +811,9 @@ struct dma_filter { · 177 unmodified lines | ||
| 805 | 811 | * called and there are no further references to this structure. This |
| 806 | 812 | * must be implemented to free resources however many existing drivers |
| 807 | 813 | * do not and are therefore not safe to unbind while in use. |
| 808 | − * | |
| 814 | + * @dbg_summary_show: optional routine to show contents in debugfs; default code | |
| 815 | + * will be used when this is omitted, but custom code can show extra, | |
| 816 | + * controller specific information. | |
| 809 | 817 | */ |
| 810 | 818 | struct dma_device { |
| 811 | 819 | struct kref ref; |
| @@ -891,6 +899,11 @@ struct dma_device { · 79 unmodified lines | ||
| 891 | 899 | struct dma_tx_state *txstate); |
| 892 | 900 | void (*device_issue_pending)(struct dma_chan *chan); |
| 893 | 901 | void (*device_release)(struct dma_device *dev); |
| 902 | + /* debugfs support */ | |
| 903 | +#ifdef CONFIG_DEBUG_FS | |
| 904 | + void (*dbg_summary_show)(struct seq_file *s, struct dma_device *dev); | |
| 905 | + struct dentry *dbg_dev_root; | |
| 906 | +#endif | |
| 894 | 907 | }; |
| 895 | 908 | |
| 896 | 909 | static inline int dmaengine_slave_config(struct dma_chan *chan, |
| @@ -1155,14 +1168,7 @@ static inline dma_cookie_t dmaengine_submit(struct dma_async_tx_descriptor *desc · 258 unmodified lines | ||
| 1155 | 1168 | static inline bool dmaengine_check_align(enum dmaengine_alignment align, |
| 1156 | 1169 | size_t off1, size_t off2, size_t len) |
| 1157 | 1170 | { |
| 1158 | − size_t mask; | |
| 1159 | − | |
| 1160 | − if (!align) | |
| 1161 | − return true; | |
| 1162 | − mask = (1 << align) - 1; | |
| 1163 | − if (mask & (off1 | off2 | len)) | |
| 1164 | − return false; | |
| 1165 | − return true; | |
| 1171 | + return !(((1 << align) - 1) & (off1 | off2 | len)); | |
| 1166 | 1172 | } |
| 1167 | 1173 | |
| 1168 | 1174 | static inline bool is_dma_copy_aligned(struct dma_device *dev, size_t off1, |
| @@ -1236,9 +1242,9 @@ static inline int dma_maxpq(struct dma_device *dma, enum dma_ctrl_flags flags) · 67 unmodified lines | ||
| 1236 | 1242 | { |
| 1237 | 1243 | if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags)) |
| 1238 | 1244 | return dma_dev_to_maxpq(dma); |
| 1239 | − else if (dmaf_p_disabled_continue(flags)) | |
| 1245 | + if (dmaf_p_disabled_continue(flags)) | |
| 1240 | 1246 | return dma_dev_to_maxpq(dma) - 1; |
| 1241 | − else if (dmaf_continue(flags)) | |
| 1247 | + if (dmaf_continue(flags)) | |
| 1242 | 1248 | return dma_dev_to_maxpq(dma) - 3; |
| 1243 | 1249 | BUG(); |
| 1244 | 1250 | } |
| @@ -1249,7 +1255,7 @@ static inline size_t dmaengine_get_icg(bool inc, bool sgl, size_t icg, · 4 unmodified lines | ||
| 1249 | 1255 | if (inc) { |
| 1250 | 1256 | if (dir_icg) |
| 1251 | 1257 | return dir_icg; |
| 1252 | − else if (sgl) | |
| 1258 | + if (sgl) | |
| 1253 | 1259 | return icg; |
| 1254 | 1260 | } |
| 1255 | 1261 | |
| @@ -1415,11 +1421,12 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie, · 159 unmodified lines | ||
| 1415 | 1421 | static inline void |
| 1416 | 1422 | dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue) |
| 1417 | 1423 | { |
| 1418 | − if (st) { | |
| 1419 | − st->last = last; | |
| 1420 | − st->used = used; | |
| 1421 | − st->residue = residue; | |
| 1422 | − } | |
| 1424 | + if (!st) | |
| 1425 | + return; | |
| 1426 | + | |
| 1427 | + st->last = last; | |
| 1428 | + st->used = used; | |
| 1429 | + st->residue = residue; | |
| 1423 | 1430 | } |
| 1424 | 1431 | |
| 1425 | 1432 | #ifdef CONFIG_DMA_ENGINE |
| @@ -1496,12 +1503,11 @@ static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx) · 70 unmodified lines | ||
| 1496 | 1503 | if (ret) |
| 1497 | 1504 | return ret; |
| 1498 | 1505 | |
| 1499 | − if (caps.descriptor_reuse) { | |
| 1500 | − tx->flags |= DMA_CTRL_REUSE; | |
| 1501 | − return 0; | |
| 1502 | − } else { | |
| 1506 | + if (!caps.descriptor_reuse) | |
| 1503 | 1507 | return -EPERM; |
| 1504 | − } | |
| 1508 | + | |
| 1509 | + tx->flags |= DMA_CTRL_REUSE; | |
| 1510 | + return 0; | |
| 1505 | 1511 | } |
| 1506 | 1512 | |
| 1507 | 1513 | static inline void dmaengine_desc_clear_reuse(struct dma_async_tx_descriptor *tx) |
| @@ -1517,10 +1523,10 @@ static inline bool dmaengine_desc_test_reuse(struct dma_async_tx_descriptor *tx) · 9 unmodified lines | ||
| 1517 | 1523 | static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc) |
| 1518 | 1524 | { |
| 1519 | 1525 | /* this is supported for reusable desc, so check that */ |
| 1520 | − if (dmaengine_desc_test_reuse(desc)) | |
| 1521 | − return desc->desc_free(desc); | |
| 1522 | − else | |
| 1526 | + if (!dmaengine_desc_test_reuse(desc)) | |
| 1523 | 1527 | return -EPERM; |
| 1528 | + | |
| 1529 | + return desc->desc_free(desc); | |
| 1524 | 1530 | } |
| 1525 | 1531 | |
| 1526 | 1532 | /* --- DMA device --- */ |
| @@ -1566,9 +1572,7 @@ dmaengine_get_direction_text(enum dma_transfer_direction dir) · 39 unmodified lines | ||
| 1566 | 1572 | case DMA_DEV_TO_DEV: |
| 1567 | 1573 | return "DEV_TO_DEV"; |
| 1568 | 1574 | default: |
| 1569 | − break; | |
| 1575 | + return "invalid"; | |
| 1570 | 1576 | } |
| 1571 | − | |
| 1572 | − return "invalid"; | |
| 1573 | 1577 | } |
| 1574 | 1578 | #endif /* DMAENGINE_H */ |
| @@ -69,19 +69,23 @@ struct dmar_pci_notify_info { · 68 unmodified lines | ||
| 69 | 69 | extern struct rw_semaphore dmar_global_lock; |
| 70 | 70 | extern struct list_head dmar_drhd_units; |
| 71 | 71 | |
| 72 | −#define for_each_drhd_unit(drhd) \ | |
| 73 | − list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) | |
| 72 | +#define for_each_drhd_unit(drhd) \ | |
| 73 | + list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ | |
| 74 | + dmar_rcu_check()) | |
| 74 | 75 | |
| 75 | 76 | #define for_each_active_drhd_unit(drhd) \ |
| 76 | − list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ | |
| 77 | + list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ | |
| 78 | + dmar_rcu_check()) \ | |
| 77 | 79 | if (drhd->ignored) {} else |
| 78 | 80 | |
| 79 | 81 | #define for_each_active_iommu(i, drhd) \ |
| 80 | − list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ | |
| 82 | + list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ | |
| 83 | + dmar_rcu_check()) \ | |
| 81 | 84 | if (i=drhd->iommu, drhd->ignored) {} else |
| 82 | 85 | |
| 83 | 86 | #define for_each_iommu(i, drhd) \ |
| 84 | − list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ | |
| 87 | + list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ | |
| 88 | + dmar_rcu_check()) \ | |
| 85 | 89 | if (i=drhd->iommu, 0) {} else |
| 86 | 90 | |
| 87 | 91 | static inline bool dmar_rcu_check(void) |
| @@ -28,8 +28,6 @@ int dsa_8021q_rx_switch_id(u16 vid); · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | int dsa_8021q_rx_source_port(u16 vid); |
| 30 | 30 | |
| 31 | −struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb); | |
| 32 | − | |
| 33 | 31 | #else |
| 34 | 32 | |
| 35 | 33 | int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, |
| @@ -64,11 +62,6 @@ int dsa_8021q_rx_source_port(u16 vid) · 28 unmodified lines | ||
| 64 | 62 | return 0; |
| 65 | 63 | } |
| 66 | 64 | |
| 67 | −struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb) | |
| 68 | −{ | |
| 69 | − return NULL; | |
| 70 | −} | |
| 71 | − | |
| 72 | 65 | #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ |
| 73 | 66 | |
| 74 | 67 | #endif /* _NET_DSA_8021Q_H */ |
| @@ -25,7 +25,6 @@ struct dw_apb_timer { · 24 unmodified lines | ||
| 25 | 25 | struct dw_apb_clock_event_device { |
| 26 | 26 | struct clock_event_device ced; |
| 27 | 27 | struct dw_apb_timer timer; |
| 28 | − struct irqaction irqaction; | |
| 29 | 28 | void (*eoi)(struct dw_apb_timer *); |
| 30 | 29 | }; |
| 31 | 30 | |
| @@ -383,6 +383,9 @@ struct dimm_info { · 382 unmodified lines | ||
| 383 | 383 | unsigned int csrow, cschannel; /* Points to the old API data */ |
| 384 | 384 | |
| 385 | 385 | u16 smbios_handle; /* Handle for SMBIOS type 17 */ |
| 386 | + | |
| 387 | + u32 ce_count; | |
| 388 | + u32 ue_count; | |
| 386 | 389 | }; |
| 387 | 390 | |
| 388 | 391 | /** |
| @@ -442,6 +445,7 @@ struct errcount_attribute_data { · 53 unmodified lines | ||
| 442 | 445 | * struct edac_raw_error_desc - Raw error report structure |
| 443 | 446 | * @grain: minimum granularity for an error report, in bytes |
| 444 | 447 | * @error_count: number of errors of the same type |
| 448 | + * @type: severity of the error (CE/UE/Fatal) | |
| 445 | 449 | * @top_layer: top layer of the error (layer[0]) |
| 446 | 450 | * @mid_layer: middle layer of the error (layer[1]) |
| 447 | 451 | * @low_layer: low layer of the error (layer[2]) |
| @@ -453,8 +457,6 @@ struct errcount_attribute_data { · 5 unmodified lines | ||
| 453 | 457 | * @location: location of the error |
| 454 | 458 | * @label: label of the affected DIMM(s) |
| 455 | 459 | * @other_detail: other driver-specific detail about the error |
| 456 | − * @enable_per_layer_report: if false, the error affects all layers | |
| 457 | − * (typically, a memory controller error) | |
| 458 | 460 | */ |
| 459 | 461 | struct edac_raw_error_desc { |
| 460 | 462 | char location[LOCATION_SIZE]; |
| @@ -462,6 +464,7 @@ struct edac_raw_error_desc { · 1 unmodified line | ||
| 462 | 464 | long grain; |
| 463 | 465 | |
| 464 | 466 | u16 error_count; |
| 467 | + enum hw_event_mc_err_type type; | |
| 465 | 468 | int top_layer; |
| 466 | 469 | int mid_layer; |
| 467 | 470 | int low_layer; |
| @@ -470,7 +473,6 @@ struct edac_raw_error_desc { · 2 unmodified lines | ||
| 470 | 473 | unsigned long syndrome; |
| 471 | 474 | const char *msg; |
| 472 | 475 | const char *other_detail; |
| 473 | − bool enable_per_layer_report; | |
| 474 | 476 | }; |
| 475 | 477 | |
| 476 | 478 | /* MEMORY controller information structure |
| @@ -560,7 +562,6 @@ struct mem_ctl_info { · 83 unmodified lines | ||
| 560 | 562 | */ |
| 561 | 563 | u32 ce_noinfo_count, ue_noinfo_count; |
| 562 | 564 | u32 ue_mc, ce_mc; |
| 563 | − u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS]; | |
| 564 | 565 | |
| 565 | 566 | struct completion complete; |
| 566 | 567 | |
| @@ -56,19 +56,6 @@ typedef void *efi_handle_t; · 55 unmodified lines | ||
| 56 | 56 | #define __efiapi |
| 57 | 57 | #endif |
| 58 | 58 | |
| 59 | −#define efi_get_handle_at(array, idx) \ | |
| 60 | − (efi_is_native() ? (array)[idx] \ | |
| 61 | − : (efi_handle_t)(unsigned long)((u32 *)(array))[idx]) | |
| 62 | − | |
| 63 | −#define efi_get_handle_num(size) \ | |
| 64 | − ((size) / (efi_is_native() ? sizeof(efi_handle_t) : sizeof(u32))) | |
| 65 | − | |
| 66 | −#define for_each_efi_handle(handle, array, size, i) \ | |
| 67 | − for (i = 0; \ | |
| 68 | − i < efi_get_handle_num(size) && \ | |
| 69 | − ((handle = efi_get_handle_at((array), i)) || true); \ | |
| 70 | − i++) | |
| 71 | − | |
| 72 | 59 | /* |
| 73 | 60 | * The UEFI spec and EDK2 reference implementation both define EFI_GUID as |
| 74 | 61 | * struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment |
| @@ -157,15 +144,6 @@ typedef struct { · 82 unmodified lines | ||
| 157 | 144 | u32 imagesize; |
| 158 | 145 | } efi_capsule_header_t; |
| 159 | 146 | |
| 160 | −struct efi_boot_memmap { | |
| 161 | − efi_memory_desc_t **map; | |
| 162 | − unsigned long *map_size; | |
| 163 | − unsigned long *desc_size; | |
| 164 | − u32 *desc_ver; | |
| 165 | − unsigned long *key_ptr; | |
| 166 | − unsigned long *buff_size; | |
| 167 | −}; | |
| 168 | − | |
| 169 | 147 | /* |
| 170 | 148 | * EFI capsule flags |
| 171 | 149 | */ |
| @@ -187,14 +165,6 @@ struct capsule_info { · 15 unmodified lines | ||
| 187 | 165 | |
| 188 | 166 | int __efi_capsule_setup_info(struct capsule_info *cap_info); |
| 189 | 167 | |
| 190 | −/* | |
| 191 | − * Allocation types for calls to boottime->allocate_pages. | |
| 192 | − */ | |
| 193 | −#define EFI_ALLOCATE_ANY_PAGES 0 | |
| 194 | −#define EFI_ALLOCATE_MAX_ADDRESS 1 | |
| 195 | −#define EFI_ALLOCATE_ADDRESS 2 | |
| 196 | −#define EFI_MAX_ALLOCATE_TYPE 3 | |
| 197 | − | |
| 198 | 168 | typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); |
| 199 | 169 | |
| 200 | 170 | /* |
| @@ -224,291 +194,7 @@ typedef struct { · 23 unmodified lines | ||
| 224 | 194 | u8 sets_to_zero; |
| 225 | 195 | } efi_time_cap_t; |
| 226 | 196 | |
| 227 | −typedef struct { | |
| 228 | − efi_table_hdr_t hdr; | |
| 229 | − u32 raise_tpl; | |
| 230 | − u32 restore_tpl; | |
| 231 | − u32 allocate_pages; | |
| 232 | − u32 free_pages; | |
| 233 | − u32 get_memory_map; | |
| 234 | − u32 allocate_pool; | |
| 235 | − u32 free_pool; | |
| 236 | − u32 create_event; | |
| 237 | − u32 set_timer; | |
| 238 | − u32 wait_for_event; | |
| 239 | − u32 signal_event; | |
| 240 | − u32 close_event; | |
| 241 | − u32 check_event; | |
| 242 | − u32 install_protocol_interface; | |
| 243 | − u32 reinstall_protocol_interface; | |
| 244 | − u32 uninstall_protocol_interface; | |
| 245 | − u32 handle_protocol; | |
| 246 | − u32 __reserved; | |
| 247 | − u32 register_protocol_notify; | |
| 248 | − u32 locate_handle; | |
| 249 | − u32 locate_device_path; | |
| 250 | − u32 install_configuration_table; | |
| 251 | − u32 load_image; | |
| 252 | − u32 start_image; | |
| 253 | − u32 exit; | |
| 254 | − u32 unload_image; | |
| 255 | − u32 exit_boot_services; | |
| 256 | − u32 get_next_monotonic_count; | |
| 257 | − u32 stall; | |
| 258 | − u32 set_watchdog_timer; | |
| 259 | − u32 connect_controller; | |
| 260 | − u32 disconnect_controller; | |
| 261 | − u32 open_protocol; | |
| 262 | − u32 close_protocol; | |
| 263 | − u32 open_protocol_information; | |
| 264 | − u32 protocols_per_handle; | |
| 265 | − u32 locate_handle_buffer; | |
| 266 | − u32 locate_protocol; | |
| 267 | − u32 install_multiple_protocol_interfaces; | |
| 268 | − u32 uninstall_multiple_protocol_interfaces; | |
| 269 | − u32 calculate_crc32; | |
| 270 | − u32 copy_mem; | |
| 271 | − u32 set_mem; | |
| 272 | − u32 create_event_ex; | |
| 273 | −} __packed efi_boot_services_32_t; | |
| 274 | − | |
| 275 | −/* | |
| 276 | − * EFI Boot Services table | |
| 277 | − */ | |
| 278 | −typedef union { | |
| 279 | − struct { | |
| 280 | − efi_table_hdr_t hdr; | |
| 281 | − void *raise_tpl; | |
| 282 | − void *restore_tpl; | |
| 283 | − efi_status_t (__efiapi *allocate_pages)(int, int, unsigned long, | |
| 284 | − efi_physical_addr_t *); | |
| 285 | − efi_status_t (__efiapi *free_pages)(efi_physical_addr_t, | |
| 286 | − unsigned long); | |
| 287 | − efi_status_t (__efiapi *get_memory_map)(unsigned long *, void *, | |
| 288 | − unsigned long *, | |
| 289 | − unsigned long *, u32 *); | |
| 290 | − efi_status_t (__efiapi *allocate_pool)(int, unsigned long, | |
| 291 | − void **); | |
| 292 | − efi_status_t (__efiapi *free_pool)(void *); | |
| 293 | − void *create_event; | |
| 294 | − void *set_timer; | |
| 295 | − void *wait_for_event; | |
| 296 | − void *signal_event; | |
| 297 | − void *close_event; | |
| 298 | − void *check_event; | |
| 299 | − void *install_protocol_interface; | |
| 300 | − void *reinstall_protocol_interface; | |
| 301 | − void *uninstall_protocol_interface; | |
| 302 | − efi_status_t (__efiapi *handle_protocol)(efi_handle_t, | |
| 303 | − efi_guid_t *, void **); | |
| 304 | − void *__reserved; | |
| 305 | − void *register_protocol_notify; | |
| 306 | − efi_status_t (__efiapi *locate_handle)(int, efi_guid_t *, | |
| 307 | − void *, unsigned long *, | |
| 308 | − efi_handle_t *); | |
| 309 | − void *locate_device_path; | |
| 310 | − efi_status_t (__efiapi *install_configuration_table)(efi_guid_t *, | |
| 311 | − void *); | |
| 312 | − void *load_image; | |
| 313 | − void *start_image; | |
| 314 | − void *exit; | |
| 315 | − void *unload_image; | |
| 316 | − efi_status_t (__efiapi *exit_boot_services)(efi_handle_t, | |
| 317 | − unsigned long); | |
| 318 | − void *get_next_monotonic_count; | |
| 319 | − void *stall; | |
| 320 | − void *set_watchdog_timer; | |
| 321 | − void *connect_controller; | |
| 322 | − efi_status_t (__efiapi *disconnect_controller)(efi_handle_t, | |
| 323 | − efi_handle_t, | |
| 324 | − efi_handle_t); | |
| 325 | − void *open_protocol; | |
| 326 | − void *close_protocol; | |
| 327 | − void *open_protocol_information; | |
| 328 | − void *protocols_per_handle; | |
| 329 | − void *locate_handle_buffer; | |
| 330 | − efi_status_t (__efiapi *locate_protocol)(efi_guid_t *, void *, | |
| 331 | − void **); | |
| 332 | − void *install_multiple_protocol_interfaces; | |
| 333 | − void *uninstall_multiple_protocol_interfaces; | |
| 334 | − void *calculate_crc32; | |
| 335 | − void *copy_mem; | |
| 336 | − void *set_mem; | |
| 337 | − void *create_event_ex; | |
| 338 | − }; | |
| 339 | − efi_boot_services_32_t mixed_mode; | |
| 340 | −} efi_boot_services_t; | |
| 341 | − | |
| 342 | −typedef enum { | |
| 343 | − EfiPciIoWidthUint8, | |
| 344 | − EfiPciIoWidthUint16, | |
| 345 | − EfiPciIoWidthUint32, | |
| 346 | − EfiPciIoWidthUint64, | |
| 347 | − EfiPciIoWidthFifoUint8, | |
| 348 | − EfiPciIoWidthFifoUint16, | |
| 349 | − EfiPciIoWidthFifoUint32, | |
| 350 | − EfiPciIoWidthFifoUint64, | |
| 351 | − EfiPciIoWidthFillUint8, | |
| 352 | − EfiPciIoWidthFillUint16, | |
| 353 | − EfiPciIoWidthFillUint32, | |
| 354 | − EfiPciIoWidthFillUint64, | |
| 355 | − EfiPciIoWidthMaximum | |
| 356 | −} EFI_PCI_IO_PROTOCOL_WIDTH; | |
| 357 | − | |
| 358 | −typedef enum { | |
| 359 | − EfiPciIoAttributeOperationGet, | |
| 360 | − EfiPciIoAttributeOperationSet, | |
| 361 | − EfiPciIoAttributeOperationEnable, | |
| 362 | − EfiPciIoAttributeOperationDisable, | |
| 363 | − EfiPciIoAttributeOperationSupported, | |
| 364 | − EfiPciIoAttributeOperationMaximum | |
| 365 | −} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION; | |
| 366 | − | |
| 367 | −typedef struct { | |
| 368 | − u32 read; | |
| 369 | − u32 write; | |
| 370 | −} efi_pci_io_protocol_access_32_t; | |
| 371 | − | |
| 372 | −typedef union efi_pci_io_protocol efi_pci_io_protocol_t; | |
| 373 | − | |
| 374 | −typedef | |
| 375 | −efi_status_t (__efiapi *efi_pci_io_protocol_cfg_t)(efi_pci_io_protocol_t *, | |
| 376 | − EFI_PCI_IO_PROTOCOL_WIDTH, | |
| 377 | − u32 offset, | |
| 378 | − unsigned long count, | |
| 379 | − void *buffer); | |
| 380 | − | |
| 381 | −typedef struct { | |
| 382 | − void *read; | |
| 383 | − void *write; | |
| 384 | −} efi_pci_io_protocol_access_t; | |
| 385 | − | |
| 386 | −typedef struct { | |
| 387 | − efi_pci_io_protocol_cfg_t read; | |
| 388 | − efi_pci_io_protocol_cfg_t write; | |
| 389 | −} efi_pci_io_protocol_config_access_t; | |
| 390 | − | |
| 391 | −union efi_pci_io_protocol { | |
| 392 | − struct { | |
| 393 | − void *poll_mem; | |
| 394 | − void *poll_io; | |
| 395 | − efi_pci_io_protocol_access_t mem; | |
| 396 | − efi_pci_io_protocol_access_t io; | |
| 397 | − efi_pci_io_protocol_config_access_t pci; | |
| 398 | − void *copy_mem; | |
| 399 | − void *map; | |
| 400 | − void *unmap; | |
| 401 | − void *allocate_buffer; | |
| 402 | − void *free_buffer; | |
| 403 | − void *flush; | |
| 404 | − efi_status_t (__efiapi *get_location)(efi_pci_io_protocol_t *, | |
| 405 | − unsigned long *segment_nr, | |
| 406 | − unsigned long *bus_nr, | |
| 407 | − unsigned long *device_nr, | |
| 408 | − unsigned long *func_nr); | |
| 409 | − void *attributes; | |
| 410 | − void *get_bar_attributes; | |
| 411 | − void *set_bar_attributes; | |
| 412 | − uint64_t romsize; | |
| 413 | − void *romimage; | |
| 414 | − }; | |
| 415 | − struct { | |
| 416 | − u32 poll_mem; | |
| 417 | − u32 poll_io; | |
| 418 | − efi_pci_io_protocol_access_32_t mem; | |
| 419 | − efi_pci_io_protocol_access_32_t io; | |
| 420 | − efi_pci_io_protocol_access_32_t pci; | |
| 421 | − u32 copy_mem; | |
| 422 | − u32 map; | |
| 423 | − u32 unmap; | |
| 424 | − u32 allocate_buffer; | |
| 425 | − u32 free_buffer; | |
| 426 | − u32 flush; | |
| 427 | − u32 get_location; | |
| 428 | − u32 attributes; | |
| 429 | − u32 get_bar_attributes; | |
| 430 | − u32 set_bar_attributes; | |
| 431 | − u64 romsize; | |
| 432 | − u32 romimage; | |
| 433 | − } mixed_mode; | |
| 434 | −}; | |
| 435 | − | |
| 436 | −#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 | |
| 437 | −#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 | |
| 438 | −#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 | |
| 439 | −#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 | |
| 440 | −#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 | |
| 441 | −#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 | |
| 442 | −#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 | |
| 443 | −#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 | |
| 444 | −#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 | |
| 445 | −#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 | |
| 446 | −#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 | |
| 447 | −#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 | |
| 448 | −#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 | |
| 449 | −#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 | |
| 450 | −#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 | |
| 451 | −#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 | |
| 452 | −#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 | |
| 453 | −#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 | |
| 454 | −#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000 | |
| 455 | − | |
| 456 | −struct efi_dev_path; | |
| 457 | − | |
| 458 | −typedef union apple_properties_protocol apple_properties_protocol_t; | |
| 459 | − | |
| 460 | −union apple_properties_protocol { | |
| 461 | − struct { | |
| 462 | − unsigned long version; | |
| 463 | − efi_status_t (__efiapi *get)(apple_properties_protocol_t *, | |
| 464 | − struct efi_dev_path *, | |
| 465 | − efi_char16_t *, void *, u32 *); | |
| 466 | − efi_status_t (__efiapi *set)(apple_properties_protocol_t *, | |
| 467 | − struct efi_dev_path *, | |
| 468 | − efi_char16_t *, void *, u32); | |
| 469 | − efi_status_t (__efiapi *del)(apple_properties_protocol_t *, | |
| 470 | − struct efi_dev_path *, | |
| 471 | − efi_char16_t *); | |
| 472 | − efi_status_t (__efiapi *get_all)(apple_properties_protocol_t *, | |
| 473 | − void *buffer, u32 *); | |
| 474 | − }; | |
| 475 | − struct { | |
| 476 | − u32 version; | |
| 477 | − u32 get; | |
| 478 | − u32 set; | |
| 479 | − u32 del; | |
| 480 | − u32 get_all; | |
| 481 | − } mixed_mode; | |
| 482 | −}; | |
| 483 | − | |
| 484 | −typedef u32 efi_tcg2_event_log_format; | |
| 485 | − | |
| 486 | −typedef union efi_tcg2_protocol efi_tcg2_protocol_t; | |
| 487 | − | |
| 488 | −union efi_tcg2_protocol { | |
| 489 | − struct { | |
| 490 | − void *get_capability; | |
| 491 | − efi_status_t (__efiapi *get_event_log)(efi_handle_t, | |
| 492 | − efi_tcg2_event_log_format, | |
| 493 | − efi_physical_addr_t *, | |
| 494 | − efi_physical_addr_t *, | |
| 495 | − efi_bool_t *); | |
| 496 | − void *hash_log_extend_event; | |
| 497 | − void *submit_command; | |
| 498 | − void *get_active_pcr_banks; | |
| 499 | − void *set_active_pcr_banks; | |
| 500 | − void *get_result_of_set_active_pcr_banks; | |
| 501 | − }; | |
| 502 | − struct { | |
| 503 | − u32 get_capability; | |
| 504 | − u32 get_event_log; | |
| 505 | − u32 hash_log_extend_event; | |
| 506 | − u32 submit_command; | |
| 507 | − u32 get_active_pcr_banks; | |
| 508 | − u32 set_active_pcr_banks; | |
| 509 | − u32 get_result_of_set_active_pcr_banks; | |
| 510 | − } mixed_mode; | |
| 511 | −}; | |
| 197 | +typedef union efi_boot_services efi_boot_services_t; | |
| 512 | 198 | |
| 513 | 199 | /* |
| 514 | 200 | * Types and defines for EFI ResetSystem |
| @@ -646,6 +332,9 @@ void efi_native_runtime_setup(void); · 131 unmodified lines | ||
| 646 | 332 | #define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) |
| 647 | 333 | #define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0) |
| 648 | 334 | #define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f) |
| 335 | +#define EFI_LOAD_FILE_PROTOCOL_GUID EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) | |
| 336 | +#define EFI_LOAD_FILE2_PROTOCOL_GUID EFI_GUID(0x4006c0c1, 0xfcb3, 0x403e, 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d) | |
| 337 | +#define EFI_RT_PROPERTIES_TABLE_GUID EFI_GUID(0xeb66918a, 0x7eef, 0x402a, 0x84, 0x2e, 0x93, 0x1d, 0x21, 0xc3, 0x8a, 0xe9) | |
| 649 | 338 | |
| 650 | 339 | #define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f) |
| 651 | 340 | #define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23) |
| @@ -665,6 +354,7 @@ void efi_native_runtime_setup(void); · 13 unmodified lines | ||
| 665 | 354 | #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa) |
| 666 | 355 | #define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25) |
| 667 | 356 | #define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2) |
| 357 | +#define LINUX_EFI_INITRD_MEDIA_GUID EFI_GUID(0x5568e427, 0x68fc, 0x4f3d, 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68) | |
| 668 | 358 | |
| 669 | 359 | /* OEM GUIDs */ |
| 670 | 360 | #define DELLEMC_EFI_RCI2_TABLE_GUID EFI_GUID(0x2d9f28a2, 0xa886, 0x456a, 0x97, 0xa8, 0xf1, 0x1e, 0xf2, 0x4f, 0xf4, 0x55) |
| @@ -788,74 +478,6 @@ struct efi_mem_range { · 117 unmodified lines | ||
| 788 | 478 | u64 attribute; |
| 789 | 479 | }; |
| 790 | 480 | |
| 791 | −struct efi_fdt_params { | |
| 792 | − u64 system_table; | |
| 793 | − u64 mmap; | |
| 794 | − u32 mmap_size; | |
| 795 | − u32 desc_size; | |
| 796 | − u32 desc_ver; | |
| 797 | −}; | |
| 798 | − | |
| 799 | −typedef struct { | |
| 800 | − u32 revision; | |
| 801 | − efi_handle_t parent_handle; | |
| 802 | − efi_system_table_t *system_table; | |
| 803 | − efi_handle_t device_handle; | |
| 804 | − void *file_path; | |
| 805 | − void *reserved; | |
| 806 | − u32 load_options_size; | |
| 807 | − void *load_options; | |
| 808 | − void *image_base; | |
| 809 | − __aligned_u64 image_size; | |
| 810 | − unsigned int image_code_type; | |
| 811 | − unsigned int image_data_type; | |
| 812 | − efi_status_t ( __efiapi *unload)(efi_handle_t image_handle); | |
| 813 | −} efi_loaded_image_t; | |
| 814 | − | |
| 815 | −typedef struct { | |
| 816 | − u64 size; | |
| 817 | − u64 file_size; | |
| 818 | − u64 phys_size; | |
| 819 | − efi_time_t create_time; | |
| 820 | − efi_time_t last_access_time; | |
| 821 | − efi_time_t modification_time; | |
| 822 | − __aligned_u64 attribute; | |
| 823 | − efi_char16_t filename[1]; | |
| 824 | −} efi_file_info_t; | |
| 825 | − | |
| 826 | −typedef struct efi_file_handle efi_file_handle_t; | |
| 827 | − | |
| 828 | −struct efi_file_handle { | |
| 829 | − u64 revision; | |
| 830 | − efi_status_t (__efiapi *open)(efi_file_handle_t *, | |
| 831 | − efi_file_handle_t **, | |
| 832 | − efi_char16_t *, u64, u64); | |
| 833 | − efi_status_t (__efiapi *close)(efi_file_handle_t *); | |
| 834 | − void *delete; | |
| 835 | − efi_status_t (__efiapi *read)(efi_file_handle_t *, | |
| 836 | − unsigned long *, void *); | |
| 837 | − void *write; | |
| 838 | − void *get_position; | |
| 839 | − void *set_position; | |
| 840 | − efi_status_t (__efiapi *get_info)(efi_file_handle_t *, | |
| 841 | − efi_guid_t *, unsigned long *, | |
| 842 | − void *); | |
| 843 | − void *set_info; | |
| 844 | − void *flush; | |
| 845 | −}; | |
| 846 | − | |
| 847 | −typedef struct efi_file_io_interface efi_file_io_interface_t; | |
| 848 | − | |
| 849 | −struct efi_file_io_interface { | |
| 850 | − u64 revision; | |
| 851 | − int (__efiapi *open_volume)(efi_file_io_interface_t *, | |
| 852 | − efi_file_handle_t **); | |
| 853 | −}; | |
| 854 | − | |
| 855 | −#define EFI_FILE_MODE_READ 0x0000000000000001 | |
| 856 | −#define EFI_FILE_MODE_WRITE 0x0000000000000002 | |
| 857 | −#define EFI_FILE_MODE_CREATE 0x8000000000000000 | |
| 858 | − | |
| 859 | 481 | typedef struct { |
| 860 | 482 | u32 version; |
| 861 | 483 | u32 length; |
| @@ -865,6 +487,14 @@ typedef struct { · 3 unmodified lines | ||
| 865 | 487 | #define EFI_PROPERTIES_TABLE_VERSION 0x00010000 |
| 866 | 488 | #define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA 0x1 |
| 867 | 489 | |
| 490 | +typedef struct { | |
| 491 | + u16 version; | |
| 492 | + u16 length; | |
| 493 | + u32 runtime_services_supported; | |
| 494 | +} efi_rt_properties_table_t; | |
| 495 | + | |
| 496 | +#define EFI_RT_PROPERTIES_TABLE_VERSION 0x1 | |
| 497 | + | |
| 868 | 498 | #define EFI_INVALID_TABLE_ADDR (~0UL) |
| 869 | 499 | |
| 870 | 500 | typedef struct { |
| @@ -896,48 +526,63 @@ typedef struct { · 25 unmodified lines | ||
| 896 | 526 | efi_time_t time_of_revocation; |
| 897 | 527 | } efi_cert_x509_sha256_t; |
| 898 | 528 | |
| 529 | +extern unsigned long __ro_after_init efi_rng_seed; /* RNG Seed table */ | |
| 530 | + | |
| 899 | 531 | /* |
| 900 | 532 | * All runtime access to EFI goes through this structure: |
| 901 | 533 | */ |
| 902 | 534 | extern struct efi { |
| 903 | − efi_system_table_t *systab; /* EFI system table */ | |
| 904 | − unsigned int runtime_version; /* Runtime services version */ | |
| 905 | − unsigned long mps; /* MPS table */ | |
| 906 | − unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ | |
| 907 | − unsigned long acpi20; /* ACPI table (ACPI 2.0) */ | |
| 908 | − unsigned long smbios; /* SMBIOS table (32 bit entry point) */ | |
| 909 | − unsigned long smbios3; /* SMBIOS table (64 bit entry point) */ | |
| 910 | − unsigned long boot_info; /* boot info table */ | |
| 911 | − unsigned long hcdp; /* HCDP table */ | |
| 912 | − unsigned long uga; /* UGA table */ | |
| 913 | − unsigned long fw_vendor; /* fw_vendor */ | |
| 914 | − unsigned long runtime; /* runtime table */ | |
| 915 | − unsigned long config_table; /* config tables */ | |
| 916 | − unsigned long esrt; /* ESRT table */ | |
| 917 | − unsigned long properties_table; /* properties table */ | |
| 918 | − unsigned long mem_attr_table; /* memory attributes table */ | |
| 919 | − unsigned long rng_seed; /* UEFI firmware random seed */ | |
| 920 | − unsigned long tpm_log; /* TPM2 Event Log table */ | |
| 921 | − unsigned long tpm_final_log; /* TPM2 Final Events Log table */ | |
| 922 | − unsigned long mem_reserve; /* Linux EFI memreserve table */ | |
| 923 | − efi_get_time_t *get_time; | |
| 924 | − efi_set_time_t *set_time; | |
| 925 | − efi_get_wakeup_time_t *get_wakeup_time; | |
| 926 | − efi_set_wakeup_time_t *set_wakeup_time; | |
| 927 | − efi_get_variable_t *get_variable; | |
| 928 | − efi_get_next_variable_t *get_next_variable; | |
| 929 | − efi_set_variable_t *set_variable; | |
| 930 | − efi_set_variable_t *set_variable_nonblocking; | |
| 931 | − efi_query_variable_info_t *query_variable_info; | |
| 932 | − efi_query_variable_info_t *query_variable_info_nonblocking; | |
| 933 | − efi_update_capsule_t *update_capsule; | |
| 934 | − efi_query_capsule_caps_t *query_capsule_caps; | |
| 935 | − efi_get_next_high_mono_count_t *get_next_high_mono_count; | |
| 936 | − efi_reset_system_t *reset_system; | |
| 937 | − struct efi_memory_map memmap; | |
| 938 | − unsigned long flags; | |
| 535 | + const efi_runtime_services_t *runtime; /* EFI runtime services table */ | |
| 536 | + unsigned int runtime_version; /* Runtime services version */ | |
| 537 | + unsigned int runtime_supported_mask; | |
| 538 | + | |
| 539 | + unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ | |
| 540 | + unsigned long acpi20; /* ACPI table (ACPI 2.0) */ | |
| 541 | + unsigned long smbios; /* SMBIOS table (32 bit entry point) */ | |
| 542 | + unsigned long smbios3; /* SMBIOS table (64 bit entry point) */ | |
| 543 | + unsigned long esrt; /* ESRT table */ | |
| 544 | + unsigned long tpm_log; /* TPM2 Event Log table */ | |
| 545 | + unsigned long tpm_final_log; /* TPM2 Final Events Log table */ | |
| 546 | + | |
| 547 | + efi_get_time_t *get_time; | |
| 548 | + efi_set_time_t *set_time; | |
| 549 | + efi_get_wakeup_time_t *get_wakeup_time; | |
| 550 | + efi_set_wakeup_time_t *set_wakeup_time; | |
| 551 | + efi_get_variable_t *get_variable; | |
| 552 | + efi_get_next_variable_t *get_next_variable; | |
| 553 | + efi_set_variable_t *set_variable; | |
| 554 | + efi_set_variable_t *set_variable_nonblocking; | |
| 555 | + efi_query_variable_info_t *query_variable_info; | |
| 556 | + efi_query_variable_info_t *query_variable_info_nonblocking; | |
| 557 | + efi_update_capsule_t *update_capsule; | |
| 558 | + efi_query_capsule_caps_t *query_capsule_caps; | |
| 559 | + efi_get_next_high_mono_count_t *get_next_high_mono_count; | |
| 560 | + efi_reset_system_t *reset_system; | |
| 561 | + | |
| 562 | + struct efi_memory_map memmap; | |
| 563 | + unsigned long flags; | |
| 939 | 564 | } efi; |
| 940 | 565 | |
| 566 | +#define EFI_RT_SUPPORTED_GET_TIME 0x0001 | |
| 567 | +#define EFI_RT_SUPPORTED_SET_TIME 0x0002 | |
| 568 | +#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME 0x0004 | |
| 569 | +#define EFI_RT_SUPPORTED_SET_WAKEUP_TIME 0x0008 | |
| 570 | +#define EFI_RT_SUPPORTED_GET_VARIABLE 0x0010 | |
| 571 | +#define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME 0x0020 | |
| 572 | +#define EFI_RT_SUPPORTED_SET_VARIABLE 0x0040 | |
| 573 | +#define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP 0x0080 | |
| 574 | +#define EFI_RT_SUPPORTED_CONVERT_POINTER 0x0100 | |
| 575 | +#define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT 0x0200 | |
| 576 | +#define EFI_RT_SUPPORTED_RESET_SYSTEM 0x0400 | |
| 577 | +#define EFI_RT_SUPPORTED_UPDATE_CAPSULE 0x0800 | |
| 578 | +#define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES 0x1000 | |
| 579 | +#define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO 0x2000 | |
| 580 | + | |
| 581 | +#define EFI_RT_SUPPORTED_ALL 0x3fff | |
| 582 | + | |
| 583 | +#define EFI_RT_SUPPORTED_TIME_SERVICES 0x000f | |
| 584 | +#define EFI_RT_SUPPORTED_VARIABLE_SERVICES 0x0070 | |
| 585 | + | |
| 941 | 586 | extern struct mm_struct efi_mm; |
| 942 | 587 | |
| 943 | 588 | static inline int |
| @@ -987,14 +632,18 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md, · 43 unmodified lines | ||
| 987 | 632 | extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap, |
| 988 | 633 | void *buf, struct efi_mem_range *mem); |
| 989 | 634 | |
| 990 | −extern int efi_config_init(efi_config_table_type_t *arch_tables); | |
| 991 | 635 | #ifdef CONFIG_EFI_ESRT |
| 992 | 636 | extern void __init efi_esrt_init(void); |
| 993 | 637 | #else |
| 994 | 638 | static inline void efi_esrt_init(void) { } |
| 995 | 639 | #endif |
| 996 | −extern int efi_config_parse_tables(void *config_tables, int count, int sz, | |
| 997 | − efi_config_table_type_t *arch_tables); | |
| 640 | +extern int efi_config_parse_tables(const efi_config_table_t *config_tables, | |
| 641 | + int count, | |
| 642 | + const efi_config_table_type_t *arch_tables); | |
| 643 | +extern int efi_systab_check_header(const efi_table_hdr_t *systab_hdr, | |
| 644 | + int min_major_version); | |
| 645 | +extern void efi_systab_report_header(const efi_table_hdr_t *systab_hdr, | |
| 646 | + unsigned long fw_vendor); | |
| 998 | 647 | extern u64 efi_get_iobase (void); |
| 999 | 648 | extern int efi_mem_type(unsigned long phys_addr); |
| 1000 | 649 | extern u64 efi_mem_attributes (unsigned long phys_addr); |
| @@ -1006,7 +655,7 @@ extern void efi_mem_reserve(phys_addr_t addr, u64 size); · 5 unmodified lines | ||
| 1006 | 655 | extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size); |
| 1007 | 656 | extern void efi_initialize_iomem_resources(struct resource *code_resource, |
| 1008 | 657 | struct resource *data_resource, struct resource *bss_resource); |
| 1009 | −extern int efi_get_fdt_params(struct efi_fdt_params *params); | |
| 658 | +extern u64 efi_get_fdt_params(struct efi_memory_map_data *data); | |
| 1010 | 659 | extern struct kobject *efi_kobj; |
| 1011 | 660 | |
| 1012 | 661 | extern int efi_reboot_quirk_mode; |
| @@ -1018,6 +667,8 @@ extern void __init efi_fake_memmap(void); · 5 unmodified lines | ||
| 1018 | 667 | static inline void efi_fake_memmap(void) { } |
| 1019 | 668 | #endif |
| 1020 | 669 | |
| 670 | +extern unsigned long efi_mem_attr_table; | |
| 671 | + | |
| 1021 | 672 | /* |
| 1022 | 673 | * efi_memattr_perm_setter - arch specific callback function passed into |
| 1023 | 674 | * efi_memattr_apply_permissions() that updates the |
| @@ -1124,6 +775,7 @@ extern int __init efi_setup_pcdp_console(char *); · 100 unmodified lines | ||
| 1124 | 775 | #define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */ |
| 1125 | 776 | #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */ |
| 1126 | 777 | #define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */ |
| 778 | +#define EFI_PRESERVE_BS_REGIONS 12 /* Are EFI boot-services memory segments available? */ | |
| 1127 | 779 | |
| 1128 | 780 | #ifdef CONFIG_EFI |
| 1129 | 781 | /* |
| @@ -1142,6 +794,11 @@ static inline bool __pure efi_soft_reserve_enabled(void) · 12 unmodified lines | ||
| 1142 | 794 | return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE) |
| 1143 | 795 | && __efi_soft_reserve_enabled(); |
| 1144 | 796 | } |
| 797 | + | |
| 798 | +static inline bool efi_rt_services_supported(unsigned int mask) | |
| 799 | +{ | |
| 800 | + return (efi.runtime_supported_mask & mask) == mask; | |
| 801 | +} | |
| 1145 | 802 | #else |
| 1146 | 803 | static inline bool efi_enabled(int feature) |
| 1147 | 804 | { |
| @@ -1160,6 +817,11 @@ static inline bool efi_soft_reserve_enabled(void) · 12 unmodified lines | ||
| 1160 | 817 | { |
| 1161 | 818 | return false; |
| 1162 | 819 | } |
| 820 | + | |
| 821 | +static inline bool efi_rt_services_supported(unsigned int mask) | |
| 822 | +{ | |
| 823 | + return false; | |
| 824 | +} | |
| 1163 | 825 | #endif |
| 1164 | 826 | |
| 1165 | 827 | extern int efi_status_to_err(efi_status_t status); |
| @@ -1188,13 +850,6 @@ extern int efi_status_to_err(efi_status_t status); · 22 unmodified lines | ||
| 1188 | 850 | */ |
| 1189 | 851 | #define EFI_VARIABLE_GUID_LEN UUID_STRING_LEN |
| 1190 | 852 | |
| 1191 | −/* | |
| 1192 | − * The type of search to perform when calling boottime->locate_handle | |
| 1193 | − */ | |
| 1194 | −#define EFI_LOCATE_ALL_HANDLES 0 | |
| 1195 | −#define EFI_LOCATE_BY_REGISTER_NOTIFY 1 | |
| 1196 | −#define EFI_LOCATE_BY_PROTOCOL 2 | |
| 1197 | − | |
| 1198 | 853 | /* |
| 1199 | 854 | * EFI Device Path information |
| 1200 | 855 | */ |
| @@ -1234,30 +889,40 @@ extern int efi_status_to_err(efi_status_t status); · 33 unmodified lines | ||
| 1234 | 889 | #define EFI_DEV_END_ENTIRE 0xFF |
| 1235 | 890 | |
| 1236 | 891 | struct efi_generic_dev_path { |
| 1237 | − u8 type; | |
| 1238 | − u8 sub_type; | |
| 1239 | − u16 length; | |
| 1240 | −} __attribute ((packed)); | |
| 892 | + u8 type; | |
| 893 | + u8 sub_type; | |
| 894 | + u16 length; | |
| 895 | +} __packed; | |
| 896 | + | |
| 897 | +struct efi_acpi_dev_path { | |
| 898 | + struct efi_generic_dev_path header; | |
| 899 | + u32 hid; | |
| 900 | + u32 uid; | |
| 901 | +} __packed; | |
| 902 | + | |
| 903 | +struct efi_pci_dev_path { | |
| 904 | + struct efi_generic_dev_path header; | |
| 905 | + u8 fn; | |
| 906 | + u8 dev; | |
| 907 | +} __packed; | |
| 908 | + | |
| 909 | +struct efi_vendor_dev_path { | |
| 910 | + struct efi_generic_dev_path header; | |
| 911 | + efi_guid_t vendorguid; | |
| 912 | + u8 vendordata[]; | |
| 913 | +} __packed; | |
| 1241 | 914 | |
| 1242 | 915 | struct efi_dev_path { |
| 1243 | − u8 type; /* can be replaced with unnamed */ | |
| 1244 | − u8 sub_type; /* struct efi_generic_dev_path; */ | |
| 1245 | − u16 length; /* once we've moved to -std=c11 */ | |
| 1246 | 916 | union { |
| 1247 | − struct { | |
| 1248 | − u32 hid; | |
| 1249 | − u32 uid; | |
| 1250 | − } acpi; | |
| 1251 | − struct { | |
| 1252 | − u8 fn; | |
| 1253 | − u8 dev; | |
| 1254 | − } pci; | |
| 917 | + struct efi_generic_dev_path header; | |
| 918 | + struct efi_acpi_dev_path acpi; | |
| 919 | + struct efi_pci_dev_path pci; | |
| 920 | + struct efi_vendor_dev_path vendor; | |
| 1255 | 921 | }; |
| 1256 | −} __attribute ((packed)); | |
| 922 | +} __packed; | |
| 1257 | 923 | |
| 1258 | −#if IS_ENABLED(CONFIG_EFI_DEV_PATH_PARSER) | |
| 1259 | −struct device *efi_get_device_by_path(struct efi_dev_path **node, size_t *len); | |
| 1260 | −#endif | |
| 924 | +struct device *efi_get_device_by_path(const struct efi_dev_path **node, | |
| 925 | + size_t *len); | |
| 1261 | 926 | |
| 1262 | 927 | static inline void memrange_efi_to_native(u64 *addr, u64 *npages) |
| 1263 | 928 | { |
| @@ -1312,80 +977,6 @@ struct efivar_entry { · 48 unmodified lines | ||
| 1312 | 977 | bool deleting; |
| 1313 | 978 | }; |
| 1314 | 979 | |
| 1315 | −union efi_simple_text_output_protocol { | |
| 1316 | − struct { | |
| 1317 | − void *reset; | |
| 1318 | − efi_status_t (__efiapi *output_string)(efi_simple_text_output_protocol_t *, | |
| 1319 | − efi_char16_t *); | |
| 1320 | − void *test_string; | |
| 1321 | − }; | |
| 1322 | − struct { | |
| 1323 | − u32 reset; | |
| 1324 | − u32 output_string; | |
| 1325 | − u32 test_string; | |
| 1326 | − } mixed_mode; | |
| 1327 | −}; | |
| 1328 | − | |
| 1329 | −#define PIXEL_RGB_RESERVED_8BIT_PER_COLOR 0 | |
| 1330 | −#define PIXEL_BGR_RESERVED_8BIT_PER_COLOR 1 | |
| 1331 | −#define PIXEL_BIT_MASK 2 | |
| 1332 | −#define PIXEL_BLT_ONLY 3 | |
| 1333 | −#define PIXEL_FORMAT_MAX 4 | |
| 1334 | − | |
| 1335 | −typedef struct { | |
| 1336 | − u32 red_mask; | |
| 1337 | − u32 green_mask; | |
| 1338 | − u32 blue_mask; | |
| 1339 | − u32 reserved_mask; | |
| 1340 | −} efi_pixel_bitmask_t; | |
| 1341 | − | |
| 1342 | −typedef struct { | |
| 1343 | − u32 version; | |
| 1344 | − u32 horizontal_resolution; | |
| 1345 | − u32 vertical_resolution; | |
| 1346 | − int pixel_format; | |
| 1347 | − efi_pixel_bitmask_t pixel_information; | |
| 1348 | − u32 pixels_per_scan_line; | |
| 1349 | −} efi_graphics_output_mode_info_t; | |
| 1350 | − | |
| 1351 | −typedef union efi_graphics_output_protocol_mode efi_graphics_output_protocol_mode_t; | |
| 1352 | − | |
| 1353 | −union efi_graphics_output_protocol_mode { | |
| 1354 | − struct { | |
| 1355 | − u32 max_mode; | |
| 1356 | − u32 mode; | |
| 1357 | − efi_graphics_output_mode_info_t *info; | |
| 1358 | − unsigned long size_of_info; | |
| 1359 | − efi_physical_addr_t frame_buffer_base; | |
| 1360 | − unsigned long frame_buffer_size; | |
| 1361 | − }; | |
| 1362 | − struct { | |
| 1363 | − u32 max_mode; | |
| 1364 | − u32 mode; | |
| 1365 | − u32 info; | |
| 1366 | − u32 size_of_info; | |
| 1367 | − u64 frame_buffer_base; | |
| 1368 | − u32 frame_buffer_size; | |
| 1369 | − } mixed_mode; | |
| 1370 | −}; | |
| 1371 | − | |
| 1372 | −typedef union efi_graphics_output_protocol efi_graphics_output_protocol_t; | |
| 1373 | − | |
| 1374 | −union efi_graphics_output_protocol { | |
| 1375 | − struct { | |
| 1376 | − void *query_mode; | |
| 1377 | − void *set_mode; | |
| 1378 | − void *blt; | |
| 1379 | − efi_graphics_output_protocol_mode_t *mode; | |
| 1380 | − }; | |
| 1381 | − struct { | |
| 1382 | − u32 query_mode; | |
| 1383 | − u32 set_mode; | |
| 1384 | − u32 blt; | |
| 1385 | − u32 mode; | |
| 1386 | − } mixed_mode; | |
| 1387 | −}; | |
| 1388 | − | |
| 1389 | 980 | extern struct list_head efivar_sysfs_list; |
| 1390 | 981 | |
| 1391 | 982 | static inline void |
| @@ -1483,52 +1074,6 @@ static inline int efi_runtime_map_copy(void *buf, size_t bufsz) · 91 unmodified lines | ||
| 1483 | 1074 | |
| 1484 | 1075 | #endif |
| 1485 | 1076 | |
| 1486 | −/* prototypes shared between arch specific and generic stub code */ | |
| 1487 | − | |
| 1488 | −void efi_printk(char *str); | |
| 1489 | − | |
| 1490 | −void efi_free(unsigned long size, unsigned long addr); | |
| 1491 | − | |
| 1492 | −char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len); | |
| 1493 | − | |
| 1494 | −efi_status_t efi_get_memory_map(struct efi_boot_memmap *map); | |
| 1495 | − | |
| 1496 | −efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align, | |
| 1497 | − unsigned long *addr, unsigned long min); | |
| 1498 | − | |
| 1499 | −static inline | |
| 1500 | −efi_status_t efi_low_alloc(unsigned long size, unsigned long align, | |
| 1501 | − unsigned long *addr) | |
| 1502 | −{ | |
| 1503 | − /* | |
| 1504 | − * Don't allocate at 0x0. It will confuse code that | |
| 1505 | − * checks pointers against NULL. Skip the first 8 | |
| 1506 | − * bytes so we start at a nice even number. | |
| 1507 | − */ | |
| 1508 | − return efi_low_alloc_above(size, align, addr, 0x8); | |
| 1509 | −} | |
| 1510 | − | |
| 1511 | −efi_status_t efi_high_alloc(unsigned long size, unsigned long align, | |
| 1512 | − unsigned long *addr, unsigned long max); | |
| 1513 | − | |
| 1514 | −efi_status_t efi_relocate_kernel(unsigned long *image_addr, | |
| 1515 | − unsigned long image_size, | |
| 1516 | − unsigned long alloc_size, | |
| 1517 | − unsigned long preferred_addr, | |
| 1518 | − unsigned long alignment, | |
| 1519 | − unsigned long min_addr); | |
| 1520 | − | |
| 1521 | −efi_status_t handle_cmdline_files(efi_loaded_image_t *image, | |
| 1522 | − char *cmd_line, char *option_string, | |
| 1523 | − unsigned long max_addr, | |
| 1524 | − unsigned long *load_addr, | |
| 1525 | − unsigned long *load_size); | |
| 1526 | − | |
| 1527 | −efi_status_t efi_parse_options(char const *cmdline); | |
| 1528 | − | |
| 1529 | −efi_status_t efi_setup_gop(struct screen_info *si, efi_guid_t *proto, | |
| 1530 | − unsigned long size); | |
| 1531 | − | |
| 1532 | 1077 | #ifdef CONFIG_EFI |
| 1533 | 1078 | extern bool efi_runtime_disabled(void); |
| 1534 | 1079 | #else |
| @@ -1553,6 +1098,12 @@ static inline void · 18 unmodified lines | ||
| 1553 | 1098 | efi_enable_reset_attack_mitigation(void) { } |
| 1554 | 1099 | #endif |
| 1555 | 1100 | |
| 1101 | +#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE | |
| 1102 | +void efi_check_for_embedded_firmwares(void); | |
| 1103 | +#else | |
| 1104 | +static inline void efi_check_for_embedded_firmwares(void) { } | |
| 1105 | +#endif | |
| 1106 | + | |
| 1556 | 1107 | efi_status_t efi_random_get_seed(void); |
| 1557 | 1108 | |
| 1558 | 1109 | void efi_retrieve_tpm2_eventlog(void); |
| @@ -1606,15 +1157,6 @@ void efi_retrieve_tpm2_eventlog(void); · 47 unmodified lines | ||
| 1606 | 1157 | arch_efi_call_virt_teardown(); \ |
| 1607 | 1158 | }) |
| 1608 | 1159 | |
| 1609 | −typedef efi_status_t (*efi_exit_boot_map_processing)( | |
| 1610 | − struct efi_boot_memmap *map, | |
| 1611 | − void *priv); | |
| 1612 | − | |
| 1613 | −efi_status_t efi_exit_boot_services(void *handle, | |
| 1614 | − struct efi_boot_memmap *map, | |
| 1615 | − void *priv, | |
| 1616 | − efi_exit_boot_map_processing priv_func); | |
| 1617 | − | |
| 1618 | 1160 | #define EFI_RANDOM_SEED_SIZE 64U |
| 1619 | 1161 | |
| 1620 | 1162 | struct linux_efi_random_seed { |
| @@ -1701,6 +1243,6 @@ struct linux_efi_memreserve { · 80 unmodified lines | ||
| 1701 | 1243 | #define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \ |
| 1702 | 1244 | / sizeof(((struct linux_efi_memreserve *)0)->entry[0])) |
| 1703 | 1245 | |
| 1704 | −void efi_pci_disable_bridge_busmaster(void); | |
| 1246 | +void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size); | |
| 1705 | 1247 | |
| 1706 | 1248 | #endif /* _LINUX_EFI_H */ |
| @@ -0,0 +1,43 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_EFI_EMBEDDED_FW_H | |
| 3 | +#define _LINUX_EFI_EMBEDDED_FW_H | |
| 4 | + | |
| 5 | +#include <linux/list.h> | |
| 6 | +#include <linux/mod_devicetable.h> | |
| 7 | + | |
| 8 | +#define EFI_EMBEDDED_FW_PREFIX_LEN 8 | |
| 9 | + | |
| 10 | +/* | |
| 11 | + * This struct and efi_embedded_fw_list are private to the efi-embedded fw | |
| 12 | + * implementation they are in this header for use by lib/test_firmware.c only! | |
| 13 | + */ | |
| 14 | +struct efi_embedded_fw { | |
| 15 | + struct list_head list; | |
| 16 | + const char *name; | |
| 17 | + const u8 *data; | |
| 18 | + size_t length; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +extern struct list_head efi_embedded_fw_list; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw | |
| 25 | + * code to search for embedded firmwares. | |
| 26 | + * | |
| 27 | + * @name: Name to register the firmware with if found | |
| 28 | + * @prefix: First 8 bytes of the firmware | |
| 29 | + * @length: Length of the firmware in bytes including prefix | |
| 30 | + * @sha256: SHA256 of the firmware | |
| 31 | + */ | |
| 32 | +struct efi_embedded_fw_desc { | |
| 33 | + const char *name; | |
| 34 | + u8 prefix[EFI_EMBEDDED_FW_PREFIX_LEN]; | |
| 35 | + u32 length; | |
| 36 | + u8 sha256[32]; | |
| 37 | +}; | |
| 38 | + | |
| 39 | +extern const struct dmi_system_id touchscreen_dmi_table[]; | |
| 40 | + | |
| 41 | +int efi_get_embedded_fw(const char *name, const u8 **dat, size_t *sz); | |
| 42 | + | |
| 43 | +#endif | |
| @@ -59,7 +59,7 @@ · 58 unmodified lines | ||
| 59 | 59 | ELFNOTE_END |
| 60 | 60 | |
| 61 | 61 | #else /* !__ASSEMBLER__ */ |
| 62 | −#include <linux/elf.h> | |
| 62 | +#include <uapi/linux/elf.h> | |
| 63 | 63 | /* |
| 64 | 64 | * Use an anonymous structure which matches the shape of |
| 65 | 65 | * Elf{32,64}_Nhdr, but includes the name and desc data. The size and |
| @@ -62,9 +62,6 @@ static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) · 61 unmodified lines | ||
| 62 | 62 | return 0; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | −/* Deprecated */ | |
| 66 | −#define PTR_RET(p) PTR_ERR_OR_ZERO(p) | |
| 67 | − | |
| 68 | 65 | #endif |
| 69 | 66 | |
| 70 | 67 | #endif /* _LINUX_ERR_H */ |
| @@ -177,8 +177,57 @@ void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst, · 176 unmodified lines | ||
| 177 | 177 | bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, |
| 178 | 178 | const unsigned long *src); |
| 179 | 179 | |
| 180 | +#define ETHTOOL_COALESCE_RX_USECS BIT(0) | |
| 181 | +#define ETHTOOL_COALESCE_RX_MAX_FRAMES BIT(1) | |
| 182 | +#define ETHTOOL_COALESCE_RX_USECS_IRQ BIT(2) | |
| 183 | +#define ETHTOOL_COALESCE_RX_MAX_FRAMES_IRQ BIT(3) | |
| 184 | +#define ETHTOOL_COALESCE_TX_USECS BIT(4) | |
| 185 | +#define ETHTOOL_COALESCE_TX_MAX_FRAMES BIT(5) | |
| 186 | +#define ETHTOOL_COALESCE_TX_USECS_IRQ BIT(6) | |
| 187 | +#define ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ BIT(7) | |
| 188 | +#define ETHTOOL_COALESCE_STATS_BLOCK_USECS BIT(8) | |
| 189 | +#define ETHTOOL_COALESCE_USE_ADAPTIVE_RX BIT(9) | |
| 190 | +#define ETHTOOL_COALESCE_USE_ADAPTIVE_TX BIT(10) | |
| 191 | +#define ETHTOOL_COALESCE_PKT_RATE_LOW BIT(11) | |
| 192 | +#define ETHTOOL_COALESCE_RX_USECS_LOW BIT(12) | |
| 193 | +#define ETHTOOL_COALESCE_RX_MAX_FRAMES_LOW BIT(13) | |
| 194 | +#define ETHTOOL_COALESCE_TX_USECS_LOW BIT(14) | |
| 195 | +#define ETHTOOL_COALESCE_TX_MAX_FRAMES_LOW BIT(15) | |
| 196 | +#define ETHTOOL_COALESCE_PKT_RATE_HIGH BIT(16) | |
| 197 | +#define ETHTOOL_COALESCE_RX_USECS_HIGH BIT(17) | |
| 198 | +#define ETHTOOL_COALESCE_RX_MAX_FRAMES_HIGH BIT(18) | |
| 199 | +#define ETHTOOL_COALESCE_TX_USECS_HIGH BIT(19) | |
| 200 | +#define ETHTOOL_COALESCE_TX_MAX_FRAMES_HIGH BIT(20) | |
| 201 | +#define ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL BIT(21) | |
| 202 | + | |
| 203 | +#define ETHTOOL_COALESCE_USECS \ | |
| 204 | + (ETHTOOL_COALESCE_RX_USECS | ETHTOOL_COALESCE_TX_USECS) | |
| 205 | +#define ETHTOOL_COALESCE_MAX_FRAMES \ | |
| 206 | + (ETHTOOL_COALESCE_RX_MAX_FRAMES | ETHTOOL_COALESCE_TX_MAX_FRAMES) | |
| 207 | +#define ETHTOOL_COALESCE_USECS_IRQ \ | |
| 208 | + (ETHTOOL_COALESCE_RX_USECS_IRQ | ETHTOOL_COALESCE_TX_USECS_IRQ) | |
| 209 | +#define ETHTOOL_COALESCE_MAX_FRAMES_IRQ \ | |
| 210 | + (ETHTOOL_COALESCE_RX_MAX_FRAMES_IRQ | \ | |
| 211 | + ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ) | |
| 212 | +#define ETHTOOL_COALESCE_USE_ADAPTIVE \ | |
| 213 | + (ETHTOOL_COALESCE_USE_ADAPTIVE_RX | ETHTOOL_COALESCE_USE_ADAPTIVE_TX) | |
| 214 | +#define ETHTOOL_COALESCE_USECS_LOW_HIGH \ | |
| 215 | + (ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_TX_USECS_LOW | \ | |
| 216 | + ETHTOOL_COALESCE_RX_USECS_HIGH | ETHTOOL_COALESCE_TX_USECS_HIGH) | |
| 217 | +#define ETHTOOL_COALESCE_MAX_FRAMES_LOW_HIGH \ | |
| 218 | + (ETHTOOL_COALESCE_RX_MAX_FRAMES_LOW | \ | |
| 219 | + ETHTOOL_COALESCE_TX_MAX_FRAMES_LOW | \ | |
| 220 | + ETHTOOL_COALESCE_RX_MAX_FRAMES_HIGH | \ | |
| 221 | + ETHTOOL_COALESCE_TX_MAX_FRAMES_HIGH) | |
| 222 | +#define ETHTOOL_COALESCE_PKT_RATE_RX_USECS \ | |
| 223 | + (ETHTOOL_COALESCE_USE_ADAPTIVE_RX | \ | |
| 224 | + ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_RX_USECS_HIGH | \ | |
| 225 | + ETHTOOL_COALESCE_PKT_RATE_LOW | ETHTOOL_COALESCE_PKT_RATE_HIGH | \ | |
| 226 | + ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL) | |
| 227 | + | |
| 180 | 228 | /** |
| 181 | 229 | * struct ethtool_ops - optional netdev operations |
| 230 | + * @supported_coalesce_params: supported types of interrupt coalescing. | |
| 182 | 231 | * @get_drvinfo: Report driver/device information. Should only set the |
| 183 | 232 | * @driver, @version, @fw_version and @bus_info fields. If not |
| 184 | 233 | * implemented, the @driver and @bus_info fields will be filled in |
| @@ -207,8 +256,9 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 22 unmodified lines | ||
| 207 | 256 | * or zero. |
| 208 | 257 | * @get_coalesce: Get interrupt coalescing parameters. Returns a negative |
| 209 | 258 | * error code or zero. |
| 210 | − * @set_coalesce: Set interrupt coalescing parameters. Returns a negative | |
| 211 | − * error code or zero. | |
| 259 | + * @set_coalesce: Set interrupt coalescing parameters. Supported coalescing | |
| 260 | + * types should be set in @supported_coalesce_params. | |
| 261 | + * Returns a negative error code or zero. | |
| 212 | 262 | * @get_ringparam: Report ring sizes |
| 213 | 263 | * @set_ringparam: Set ring sizes. Returns a negative error code or zero. |
| 214 | 264 | * @get_pauseparam: Report pause parameters |
| @@ -292,7 +342,8 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 77 unmodified lines | ||
| 292 | 342 | * @set_per_queue_coalesce: Set interrupt coalescing parameters per queue. |
| 293 | 343 | * It must check that the given queue number is valid. If neither a RX nor |
| 294 | 344 | * a TX queue has this number, return -EINVAL. If only a RX queue or a TX |
| 295 | − * queue has this number, ignore the inapplicable fields. | |
| 345 | + * queue has this number, ignore the inapplicable fields. Supported | |
| 346 | + * coalescing types should be set in @supported_coalesce_params. | |
| 296 | 347 | * Returns a negative error code or zero. |
| 297 | 348 | * @get_link_ksettings: Get various device settings including Ethernet link |
| 298 | 349 | * settings. The %cmd and %link_mode_masks_nwords fields should be |
| @@ -323,6 +374,7 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 24 unmodified lines | ||
| 323 | 374 | * of the generic netdev features interface. |
| 324 | 375 | */ |
| 325 | 376 | struct ethtool_ops { |
| 377 | + u32 supported_coalesce_params; | |
| 326 | 378 | void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); |
| 327 | 379 | int (*get_regs_len)(struct net_device *); |
| 328 | 380 | void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); |
| @@ -406,6 +458,8 @@ struct ethtool_ops { · 77 unmodified lines | ||
| 406 | 458 | struct ethtool_stats *, u64 *); |
| 407 | 459 | }; |
| 408 | 460 | |
| 461 | +int ethtool_check_ops(const struct ethtool_ops *ops); | |
| 462 | + | |
| 409 | 463 | struct ethtool_rx_flow_rule { |
| 410 | 464 | struct flow_rule *rule; |
| 411 | 465 | unsigned long priv[0]; |
| @@ -420,4 +474,10 @@ struct ethtool_rx_flow_rule * · 8 unmodified lines | ||
| 420 | 474 | ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input); |
| 421 | 475 | void ethtool_rx_flow_rule_destroy(struct ethtool_rx_flow_rule *rule); |
| 422 | 476 | |
| 477 | +bool ethtool_virtdev_validate_cmd(const struct ethtool_link_ksettings *cmd); | |
| 478 | +int ethtool_virtdev_set_link_ksettings(struct net_device *dev, | |
| 479 | + const struct ethtool_link_ksettings *cmd, | |
| 480 | + u32 *dev_speed, u8 *dev_duplex); | |
| 481 | + | |
| 482 | + | |
| 423 | 483 | #endif /* _LINUX_ETHTOOL_H */ |
| @@ -17,30 +17,30 @@ struct extcon_dev; · 16 unmodified lines | ||
| 17 | 17 | #if IS_ENABLED(CONFIG_EXTCON) |
| 18 | 18 | |
| 19 | 19 | /* Following APIs register/unregister the extcon device. */ |
| 20 | −extern int extcon_dev_register(struct extcon_dev *edev); | |
| 21 | −extern void extcon_dev_unregister(struct extcon_dev *edev); | |
| 22 | −extern int devm_extcon_dev_register(struct device *dev, | |
| 20 | +int extcon_dev_register(struct extcon_dev *edev); | |
| 21 | +void extcon_dev_unregister(struct extcon_dev *edev); | |
| 22 | +int devm_extcon_dev_register(struct device *dev, | |
| 23 | 23 | struct extcon_dev *edev); |
| 24 | −extern void devm_extcon_dev_unregister(struct device *dev, | |
| 24 | +void devm_extcon_dev_unregister(struct device *dev, | |
| 25 | 25 | struct extcon_dev *edev); |
| 26 | 26 | |
| 27 | 27 | /* Following APIs allocate/free the memory of the extcon device. */ |
| 28 | −extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable); | |
| 29 | −extern void extcon_dev_free(struct extcon_dev *edev); | |
| 30 | −extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, | |
| 28 | +struct extcon_dev *extcon_dev_allocate(const unsigned int *cable); | |
| 29 | +void extcon_dev_free(struct extcon_dev *edev); | |
| 30 | +struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, | |
| 31 | 31 | const unsigned int *cable); |
| 32 | −extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); | |
| 32 | +void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); | |
| 33 | 33 | |
| 34 | 34 | /* Synchronize the state and property value for each external connector. */ |
| 35 | −extern int extcon_sync(struct extcon_dev *edev, unsigned int id); | |
| 35 | +int extcon_sync(struct extcon_dev *edev, unsigned int id); | |
| 36 | 36 | |
| 37 | 37 | /* |
| 38 | 38 | * Following APIs set the connected state of each external connector. |
| 39 | 39 | * The 'id' argument indicates the defined external connector. |
| 40 | 40 | */ |
| 41 | −extern int extcon_set_state(struct extcon_dev *edev, unsigned int id, | |
| 41 | +int extcon_set_state(struct extcon_dev *edev, unsigned int id, | |
| 42 | 42 | bool state); |
| 43 | −extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, | |
| 43 | +int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, | |
| 44 | 44 | bool state); |
| 45 | 45 | |
| 46 | 46 | /* |
| @@ -52,13 +52,13 @@ extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, · 5 unmodified lines | ||
| 52 | 52 | * for each external connector. They are used to set the capability of the |
| 53 | 53 | * property of each external connector based on the id and property. |
| 54 | 54 | */ |
| 55 | −extern int extcon_set_property(struct extcon_dev *edev, unsigned int id, | |
| 55 | +int extcon_set_property(struct extcon_dev *edev, unsigned int id, | |
| 56 | 56 | unsigned int prop, |
| 57 | 57 | union extcon_property_value prop_val); |
| 58 | −extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id, | |
| 58 | +int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id, | |
| 59 | 59 | unsigned int prop, |
| 60 | 60 | union extcon_property_value prop_val); |
| 61 | −extern int extcon_set_property_capability(struct extcon_dev *edev, | |
| 61 | +int extcon_set_property_capability(struct extcon_dev *edev, | |
| 62 | 62 | unsigned int id, unsigned int prop); |
| 63 | 63 | |
| 64 | 64 | #else /* CONFIG_EXTCON */ |
| @@ -286,6 +286,11 @@ static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, · 285 unmodified lines | ||
| 286 | 286 | { |
| 287 | 287 | return ERR_PTR(-ENODEV); |
| 288 | 288 | } |
| 289 | + | |
| 290 | +static inline const char *extcon_get_edev_name(struct extcon_dev *edev) | |
| 291 | +{ | |
| 292 | + return NULL; | |
| 293 | +} | |
| 289 | 294 | #endif /* CONFIG_EXTCON */ |
| 290 | 295 | |
| 291 | 296 | /* |
| @@ -125,6 +125,7 @@ struct f2fs_super_block { · 124 unmodified lines | ||
| 125 | 125 | /* |
| 126 | 126 | * For checkpoint |
| 127 | 127 | */ |
| 128 | +#define CP_RESIZEFS_FLAG 0x00004000 | |
| 128 | 129 | #define CP_DISABLED_QUICK_FLAG 0x00002000 |
| 129 | 130 | #define CP_DISABLED_FLAG 0x00001000 |
| 130 | 131 | #define CP_QUOTA_NEED_FSCK_FLAG 0x00000800 |
| @@ -47,7 +47,8 @@ · 46 unmodified lines | ||
| 47 | 47 | * Directory entry modification events - reported only to directory |
| 48 | 48 | * where entry is modified and not to a watching parent. |
| 49 | 49 | */ |
| 50 | −#define FANOTIFY_DIRENT_EVENTS (FAN_MOVE | FAN_CREATE | FAN_DELETE) | |
| 50 | +#define FANOTIFY_DIRENT_EVENTS (FAN_MOVE | FAN_CREATE | FAN_DELETE | \ | |
| 51 | + FAN_DIR_MODIFY) | |
| 51 | 52 | |
| 52 | 53 | /* Events that can only be reported with data type FSNOTIFY_EVENT_INODE */ |
| 53 | 54 | #define FANOTIFY_INODE_EVENTS (FANOTIFY_DIRENT_EVENTS | \ |
| @@ -85,6 +85,7 @@ extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); · 84 unmodified lines | ||
| 85 | 85 | extern int replace_fd(unsigned fd, struct file *file, unsigned flags); |
| 86 | 86 | extern void set_close_on_exec(unsigned int fd, int flag); |
| 87 | 87 | extern bool get_close_on_exec(unsigned int fd); |
| 88 | +extern int __get_unused_fd_flags(unsigned flags, unsigned long nofile); | |
| 88 | 89 | extern int get_unused_fd_flags(unsigned flags); |
| 89 | 90 | extern void put_unused_fd(unsigned int fd); |
| 90 | 91 | |
| @@ -561,7 +561,7 @@ DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key); · 560 unmodified lines | ||
| 561 | 561 | |
| 562 | 562 | #define __BPF_PROG_RUN(prog, ctx, dfunc) ({ \ |
| 563 | 563 | u32 ret; \ |
| 564 | − cant_sleep(); \ | |
| 564 | + cant_migrate(); \ | |
| 565 | 565 | if (static_branch_unlikely(&bpf_stats_enabled_key)) { \ |
| 566 | 566 | struct bpf_prog_stats *stats; \ |
| 567 | 567 | u64 start = sched_clock(); \ |
| @@ -576,8 +576,30 @@ DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key); · 8 unmodified lines | ||
| 576 | 576 | } \ |
| 577 | 577 | ret; }) |
| 578 | 578 | |
| 579 | −#define BPF_PROG_RUN(prog, ctx) __BPF_PROG_RUN(prog, ctx, \ | |
| 580 | − bpf_dispatcher_nopfunc) | |
| 579 | +#define BPF_PROG_RUN(prog, ctx) \ | |
| 580 | + __BPF_PROG_RUN(prog, ctx, bpf_dispatcher_nop_func) | |
| 581 | + | |
| 582 | +/* | |
| 583 | + * Use in preemptible and therefore migratable context to make sure that | |
| 584 | + * the execution of the BPF program runs on one CPU. | |
| 585 | + * | |
| 586 | + * This uses migrate_disable/enable() explicitly to document that the | |
| 587 | + * invocation of a BPF program does not require reentrancy protection | |
| 588 | + * against a BPF program which is invoked from a preempting task. | |
| 589 | + * | |
| 590 | + * For non RT enabled kernels migrate_disable/enable() maps to | |
| 591 | + * preempt_disable/enable(), i.e. it disables also preemption. | |
| 592 | + */ | |
| 593 | +static inline u32 bpf_prog_run_pin_on_cpu(const struct bpf_prog *prog, | |
| 594 | + const void *ctx) | |
| 595 | +{ | |
| 596 | + u32 ret; | |
| 597 | + | |
| 598 | + migrate_disable(); | |
| 599 | + ret = __BPF_PROG_RUN(prog, ctx, bpf_dispatcher_nop_func); | |
| 600 | + migrate_enable(); | |
| 601 | + return ret; | |
| 602 | +} | |
| 581 | 603 | |
| 582 | 604 | #define BPF_SKB_CB_LEN QDISC_CB_PRIV_LEN |
| 583 | 605 | |
| @@ -655,6 +677,7 @@ static inline u8 *bpf_skb_cb(struct sk_buff *skb) · 71 unmodified lines | ||
| 655 | 677 | return qdisc_skb_cb(skb)->data; |
| 656 | 678 | } |
| 657 | 679 | |
| 680 | +/* Must be invoked with migration disabled */ | |
| 658 | 681 | static inline u32 __bpf_prog_run_save_cb(const struct bpf_prog *prog, |
| 659 | 682 | struct sk_buff *skb) |
| 660 | 683 | { |
| @@ -680,9 +703,9 @@ static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog, · 19 unmodified lines | ||
| 680 | 703 | { |
| 681 | 704 | u32 res; |
| 682 | 705 | |
| 683 | − preempt_disable(); | |
| 706 | + migrate_disable(); | |
| 684 | 707 | res = __bpf_prog_run_save_cb(prog, skb); |
| 685 | − preempt_enable(); | |
| 708 | + migrate_enable(); | |
| 686 | 709 | return res; |
| 687 | 710 | } |
| 688 | 711 | |
| @@ -695,13 +718,11 @@ static inline u32 bpf_prog_run_clear_cb(const struct bpf_prog *prog, · 6 unmodified lines | ||
| 695 | 718 | if (unlikely(prog->cb_access)) |
| 696 | 719 | memset(cb_data, 0, BPF_SKB_CB_LEN); |
| 697 | 720 | |
| 698 | − preempt_disable(); | |
| 699 | − res = BPF_PROG_RUN(prog, skb); | |
| 700 | − preempt_enable(); | |
| 721 | + res = bpf_prog_run_pin_on_cpu(prog, skb); | |
| 701 | 722 | return res; |
| 702 | 723 | } |
| 703 | 724 | |
| 704 | −DECLARE_BPF_DISPATCHER(bpf_dispatcher_xdp) | |
| 725 | +DECLARE_BPF_DISPATCHER(xdp) | |
| 705 | 726 | |
| 706 | 727 | static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog, |
| 707 | 728 | struct xdp_buff *xdp) |
| @@ -712,8 +733,7 @@ static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog, · 4 unmodified lines | ||
| 712 | 733 | * already takes rcu_read_lock() when fetching the program, so |
| 713 | 734 | * it's not necessary here anymore. |
| 714 | 735 | */ |
| 715 | − return __BPF_PROG_RUN(prog, xdp, | |
| 716 | − BPF_DISPATCHER_FUNC(bpf_dispatcher_xdp)); | |
| 736 | + return __BPF_PROG_RUN(prog, xdp, BPF_DISPATCHER_FUNC(xdp)); | |
| 717 | 737 | } |
| 718 | 738 | |
| 719 | 739 | void bpf_prog_change_xdp(struct bpf_prog *prev_prog, struct bpf_prog *prog); |
| @@ -1063,7 +1083,6 @@ bpf_address_lookup(unsigned long addr, unsigned long *size, · 343 unmodified lines | ||
| 1063 | 1083 | |
| 1064 | 1084 | void bpf_prog_kallsyms_add(struct bpf_prog *fp); |
| 1065 | 1085 | void bpf_prog_kallsyms_del(struct bpf_prog *fp); |
| 1066 | −void bpf_get_prog_name(const struct bpf_prog *prog, char *sym); | |
| 1067 | 1086 | |
| 1068 | 1087 | #else /* CONFIG_BPF_JIT */ |
| 1069 | 1088 | |
| @@ -1132,11 +1151,6 @@ static inline void bpf_prog_kallsyms_del(struct bpf_prog *fp) · 62 unmodified lines | ||
| 1132 | 1151 | { |
| 1133 | 1152 | } |
| 1134 | 1153 | |
| 1135 | −static inline void bpf_get_prog_name(const struct bpf_prog *prog, char *sym) | |
| 1136 | −{ | |
| 1137 | − sym[0] = '\0'; | |
| 1138 | −} | |
| 1139 | − | |
| 1140 | 1154 | #endif /* CONFIG_BPF_JIT */ |
| 1141 | 1155 | |
| 1142 | 1156 | void bpf_prog_kallsyms_del_all(struct bpf_prog *fp); |
| @@ -44,6 +44,8 @@ int request_firmware(const struct firmware **fw, const char *name, · 43 unmodified lines | ||
| 44 | 44 | struct device *device); |
| 45 | 45 | int firmware_request_nowarn(const struct firmware **fw, const char *name, |
| 46 | 46 | struct device *device); |
| 47 | +int firmware_request_platform(const struct firmware **fw, const char *name, | |
| 48 | + struct device *device); | |
| 47 | 49 | int request_firmware_nowait( |
| 48 | 50 | struct module *module, bool uevent, |
| 49 | 51 | const char *name, struct device *device, gfp_t gfp, void *context, |
| @@ -69,6 +71,13 @@ static inline int firmware_request_nowarn(const struct firmware **fw, · 19 unmodified lines | ||
| 69 | 71 | return -EINVAL; |
| 70 | 72 | } |
| 71 | 73 | |
| 74 | +static inline int firmware_request_platform(const struct firmware **fw, | |
| 75 | + const char *name, | |
| 76 | + struct device *device) | |
| 77 | +{ | |
| 78 | + return -EINVAL; | |
| 79 | +} | |
| 80 | + | |
| 72 | 81 | static inline int request_firmware_nowait( |
| 73 | 82 | struct module *module, bool uevent, |
| 74 | 83 | const char *name, struct device *device, gfp_t gfp, void *context, |
| @@ -25,7 +25,6 @@ enum imx_sc_rpc_svc { · 24 unmodified lines | ||
| 25 | 25 | IMX_SC_RPC_SVC_PAD = 6, |
| 26 | 26 | IMX_SC_RPC_SVC_MISC = 7, |
| 27 | 27 | IMX_SC_RPC_SVC_IRQ = 8, |
| 28 | − IMX_SC_RPC_SVC_ABORT = 9 | |
| 29 | 28 | }; |
| 30 | 29 | |
| 31 | 30 | struct imx_sc_rpc_msg { |
| @@ -12,6 +12,8 @@ enum { · 11 unmodified lines | ||
| 12 | 12 | SM_EFUSE_WRITE, |
| 13 | 13 | SM_EFUSE_USER_MAX, |
| 14 | 14 | SM_GET_CHIP_ID, |
| 15 | + SM_A1_PWRC_SET, | |
| 16 | + SM_A1_PWRC_GET, | |
| 15 | 17 | }; |
| 16 | 18 | |
| 17 | 19 | struct meson_sm_firmware; |
| @@ -82,6 +82,7 @@ enum pm_api_id { · 81 unmodified lines | ||
| 82 | 82 | PM_CLOCK_GETRATE, |
| 83 | 83 | PM_CLOCK_SETPARENT, |
| 84 | 84 | PM_CLOCK_GETPARENT, |
| 85 | + PM_SECURE_AES = 47, | |
| 85 | 86 | PM_FEATURE_CHECK = 63, |
| 86 | 87 | PM_API_MAX, |
| 87 | 88 | }; |
| @@ -100,7 +101,8 @@ enum pm_ret_status { · 12 unmodified lines | ||
| 100 | 101 | }; |
| 101 | 102 | |
| 102 | 103 | enum pm_ioctl_id { |
| 103 | − IOCTL_SET_SD_TAPDELAY = 7, | |
| 104 | + IOCTL_SD_DLL_RESET = 6, | |
| 105 | + IOCTL_SET_SD_TAPDELAY, | |
| 104 | 106 | IOCTL_SET_PLL_FRAC_MODE, |
| 105 | 107 | IOCTL_GET_PLL_FRAC_MODE, |
| 106 | 108 | IOCTL_SET_PLL_FRAC_DATA, |
| @@ -271,6 +273,12 @@ enum tap_delay_type { · 164 unmodified lines | ||
| 271 | 273 | PM_TAPDELAY_OUTPUT, |
| 272 | 274 | }; |
| 273 | 275 | |
| 276 | +enum dll_reset_type { | |
| 277 | + PM_DLL_RESET_ASSERT, | |
| 278 | + PM_DLL_RESET_RELEASE, | |
| 279 | + PM_DLL_RESET_PULSE, | |
| 280 | +}; | |
| 281 | + | |
| 274 | 282 | /** |
| 275 | 283 | * struct zynqmp_pm_query_data - PM query data |
| 276 | 284 | * @qid: query ID |
| @@ -315,12 +323,13 @@ struct zynqmp_eemi_ops { · 38 unmodified lines | ||
| 315 | 323 | const u32 capabilities, |
| 316 | 324 | const u32 qos, |
| 317 | 325 | const enum zynqmp_pm_request_ack ack); |
| 326 | + int (*aes)(const u64 address, u32 *out); | |
| 318 | 327 | }; |
| 319 | 328 | |
| 320 | 329 | int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1, |
| 321 | 330 | u32 arg2, u32 arg3, u32 *ret_payload); |
| 322 | 331 | |
| 323 | −#if IS_REACHABLE(CONFIG_ARCH_ZYNQMP) | |
| 332 | +#if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE) | |
| 324 | 333 | const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void); |
| 325 | 334 | #else |
| 326 | 335 | static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void) |
| @@ -526,6 +526,11 @@ static inline void i_mmap_lock_write(struct address_space *mapping) · 525 unmodified lines | ||
| 526 | 526 | down_write(&mapping->i_mmap_rwsem); |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | +static inline int i_mmap_trylock_write(struct address_space *mapping) | |
| 530 | +{ | |
| 531 | + return down_write_trylock(&mapping->i_mmap_rwsem); | |
| 532 | +} | |
| 533 | + | |
| 529 | 534 | static inline void i_mmap_unlock_write(struct address_space *mapping) |
| 530 | 535 | { |
| 531 | 536 | up_write(&mapping->i_mmap_rwsem); |
| @@ -698,6 +703,7 @@ struct inode { · 166 unmodified lines | ||
| 698 | 703 | struct rcu_head i_rcu; |
| 699 | 704 | }; |
| 700 | 705 | atomic64_t i_version; |
| 706 | + atomic64_t i_sequence; /* see futex */ | |
| 701 | 707 | atomic_t i_count; |
| 702 | 708 | atomic_t i_dio_count; |
| 703 | 709 | atomic_t i_writecount; |
| @@ -2699,7 +2705,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name) · 1995 unmodified lines | ||
| 2699 | 2705 | |
| 2700 | 2706 | #ifdef CONFIG_BLOCK |
| 2701 | 2707 | #define BLKDEV_MAJOR_MAX 512 |
| 2702 | −extern const char *__bdevname(dev_t, char *buffer); | |
| 2703 | 2708 | extern const char *bdevname(struct block_device *bdev, char *buffer); |
| 2704 | 2709 | extern struct block_device *lookup_bdev(const char *); |
| 2705 | 2710 | extern void blkdev_show(struct seq_file *,off_t); |
| @@ -2982,6 +2987,7 @@ extern int do_pipe_flags(int *, int); · 276 unmodified lines | ||
| 2982 | 2987 | id(UNKNOWN, unknown) \ |
| 2983 | 2988 | id(FIRMWARE, firmware) \ |
| 2984 | 2989 | id(FIRMWARE_PREALLOC_BUFFER, firmware) \ |
| 2990 | + id(FIRMWARE_EFI_EMBEDDED, firmware) \ | |
| 2985 | 2991 | id(MODULE, kernel-module) \ |
| 2986 | 2992 | id(KEXEC_IMAGE, kexec-image) \ |
| 2987 | 2993 | id(KEXEC_INITRAMFS, kexec-initramfs) \ |
| @@ -3012,6 +3018,8 @@ extern int kernel_read_file(struct file *, void **, loff_t *, loff_t, · 24 unmodified lines | ||
| 3012 | 3018 | enum kernel_read_file_id); |
| 3013 | 3019 | extern int kernel_read_file_from_path(const char *, void **, loff_t *, loff_t, |
| 3014 | 3020 | enum kernel_read_file_id); |
| 3021 | +extern int kernel_read_file_from_path_initns(const char *, void **, loff_t *, loff_t, | |
| 3022 | + enum kernel_read_file_id); | |
| 3015 | 3023 | extern int kernel_read_file_from_fd(int, void **, loff_t *, loff_t, |
| 3016 | 3024 | enum kernel_read_file_id); |
| 3017 | 3025 | extern ssize_t kernel_read(struct file *, void *, size_t, loff_t *); |
| @@ -3391,7 +3399,7 @@ static inline bool io_is_direct(struct file *filp) · 373 unmodified lines | ||
| 3391 | 3399 | return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host); |
| 3392 | 3400 | } |
| 3393 | 3401 | |
| 3394 | −static inline bool vma_is_dax(struct vm_area_struct *vma) | |
| 3402 | +static inline bool vma_is_dax(const struct vm_area_struct *vma) | |
| 3395 | 3403 | { |
| 3396 | 3404 | return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host); |
| 3397 | 3405 | } |
| @@ -139,6 +139,7 @@ extern void fscrypt_free_bounce_page(struct page *bounce_page); · 138 unmodified lines | ||
| 139 | 139 | extern int fscrypt_ioctl_set_policy(struct file *, const void __user *); |
| 140 | 140 | extern int fscrypt_ioctl_get_policy(struct file *, void __user *); |
| 141 | 141 | extern int fscrypt_ioctl_get_policy_ex(struct file *, void __user *); |
| 142 | +extern int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg); | |
| 142 | 143 | extern int fscrypt_has_permitted_context(struct inode *, struct inode *); |
| 143 | 144 | extern int fscrypt_inherit_context(struct inode *, struct inode *, |
| 144 | 145 | void *, bool); |
| @@ -300,6 +301,11 @@ static inline int fscrypt_ioctl_get_policy_ex(struct file *filp, · 155 unmodified lines | ||
| 300 | 301 | return -EOPNOTSUPP; |
| 301 | 302 | } |
| 302 | 303 | |
| 304 | +static inline int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg) | |
| 305 | +{ | |
| 306 | + return -EOPNOTSUPP; | |
| 307 | +} | |
| 308 | + | |
| 303 | 309 | static inline int fscrypt_has_permitted_context(struct inode *parent, |
| 304 | 310 | struct inode *child) |
| 305 | 311 | { |
| @@ -381,6 +381,22 @@ int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver, · 380 unmodified lines | ||
| 381 | 381 | |
| 382 | 382 | void fsl_mc_driver_unregister(struct fsl_mc_driver *driver); |
| 383 | 383 | |
| 384 | +/** | |
| 385 | + * struct fsl_mc_version | |
| 386 | + * @major: Major version number: incremented on API compatibility changes | |
| 387 | + * @minor: Minor version number: incremented on API additions (that are | |
| 388 | + * backward compatible); reset when major version is incremented | |
| 389 | + * @revision: Internal revision number: incremented on implementation changes | |
| 390 | + * and/or bug fixes that have no impact on API | |
| 391 | + */ | |
| 392 | +struct fsl_mc_version { | |
| 393 | + u32 major; | |
| 394 | + u32 minor; | |
| 395 | + u32 revision; | |
| 396 | +}; | |
| 397 | + | |
| 398 | +struct fsl_mc_version *fsl_mc_get_version(void); | |
| 399 | + | |
| 384 | 400 | int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev, |
| 385 | 401 | u16 mc_io_flags, |
| 386 | 402 | struct fsl_mc_io **new_mc_io); |
| @@ -149,8 +149,6 @@ struct ptp_qoriq { · 148 unmodified lines | ||
| 149 | 149 | bool extts_fifo_support; |
| 150 | 150 | int irq; |
| 151 | 151 | int phc_index; |
| 152 | − u64 alarm_interval; /* for periodic alarm */ | |
| 153 | − u64 alarm_value; | |
| 154 | 152 | u32 tclk_period; /* nanoseconds */ |
| 155 | 153 | u32 tmr_prsc; |
| 156 | 154 | u32 tmr_add; |
| @@ -18,39 +18,63 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/bug.h> |
| 19 | 19 | |
| 20 | 20 | /* |
| 21 | − * Notify this @dir inode about a change in the directory entry @dentry. | |
| 21 | + * Notify this @dir inode about a change in a child directory entry. | |
| 22 | + * The directory entry may have turned positive or negative or its inode may | |
| 23 | + * have changed (i.e. renamed over). | |
| 22 | 24 | * |
| 23 | 25 | * Unlike fsnotify_parent(), the event will be reported regardless of the |
| 24 | 26 | * FS_EVENT_ON_CHILD mask on the parent inode. |
| 25 | 27 | */ |
| 26 | −static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry, | |
| 27 | − __u32 mask) | |
| 28 | +static inline void fsnotify_name(struct inode *dir, __u32 mask, | |
| 29 | + struct inode *child, | |
| 30 | + const struct qstr *name, u32 cookie) | |
| 28 | 31 | { |
| 29 | − return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, | |
| 30 | − &dentry->d_name, 0); | |
| 32 | + fsnotify(dir, mask, child, FSNOTIFY_EVENT_INODE, name, cookie); | |
| 33 | + /* | |
| 34 | + * Send another flavor of the event without child inode data and | |
| 35 | + * without the specific event type (e.g. FS_CREATE|FS_IS_DIR). | |
| 36 | + * The name is relative to the dir inode the event is reported to. | |
| 37 | + */ | |
| 38 | + fsnotify(dir, FS_DIR_MODIFY, dir, FSNOTIFY_EVENT_INODE, name, 0); | |
| 31 | 39 | } |
| 32 | 40 | |
| 33 | −/* Notify this dentry's parent about a child's events. */ | |
| 34 | −static inline int fsnotify_parent(const struct path *path, | |
| 35 | − struct dentry *dentry, __u32 mask) | |
| 41 | +static inline void fsnotify_dirent(struct inode *dir, struct dentry *dentry, | |
| 42 | + __u32 mask) | |
| 36 | 43 | { |
| 37 | − if (!dentry) | |
| 38 | − dentry = path->dentry; | |
| 39 | − | |
| 40 | − return __fsnotify_parent(path, dentry, mask); | |
| 44 | + fsnotify_name(dir, mask, d_inode(dentry), &dentry->d_name, 0); | |
| 41 | 45 | } |
| 42 | 46 | |
| 43 | 47 | /* |
| 44 | − * Simple wrapper to consolidate calls fsnotify_parent()/fsnotify() when | |
| 45 | − * an event is on a path. | |
| 48 | + * Simple wrappers to consolidate calls fsnotify_parent()/fsnotify() when | |
| 49 | + * an event is on a file/dentry. | |
| 46 | 50 | */ |
| 47 | −static inline int fsnotify_path(struct inode *inode, const struct path *path, | |
| 48 | − __u32 mask) | |
| 51 | +static inline void fsnotify_dentry(struct dentry *dentry, __u32 mask) | |
| 52 | +{ | |
| 53 | + struct inode *inode = d_inode(dentry); | |
| 54 | + | |
| 55 | + if (S_ISDIR(inode->i_mode)) | |
| 56 | + mask |= FS_ISDIR; | |
| 57 | + | |
| 58 | + fsnotify_parent(dentry, mask, inode, FSNOTIFY_EVENT_INODE); | |
| 59 | + fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | |
| 60 | +} | |
| 61 | + | |
| 62 | +static inline int fsnotify_file(struct file *file, __u32 mask) | |
| 49 | 63 | { |
| 50 | − int ret = fsnotify_parent(path, NULL, mask); | |
| 64 | + const struct path *path = &file->f_path; | |
| 65 | + struct inode *inode = file_inode(file); | |
| 66 | + int ret; | |
| 67 | + | |
| 68 | + if (file->f_mode & FMODE_NONOTIFY) | |
| 69 | + return 0; | |
| 70 | + | |
| 71 | + if (S_ISDIR(inode->i_mode)) | |
| 72 | + mask |= FS_ISDIR; | |
| 51 | 73 | |
| 74 | + ret = fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH); | |
| 52 | 75 | if (ret) |
| 53 | 76 | return ret; |
| 77 | + | |
| 54 | 78 | return fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); |
| 55 | 79 | } |
| 56 | 80 | |
| @@ -58,19 +82,16 @@ static inline int fsnotify_path(struct inode *inode, const struct path *path, · 1 unmodified line | ||
| 58 | 82 | static inline int fsnotify_perm(struct file *file, int mask) |
| 59 | 83 | { |
| 60 | 84 | int ret; |
| 61 | − const struct path *path = &file->f_path; | |
| 62 | − struct inode *inode = file_inode(file); | |
| 63 | 85 | __u32 fsnotify_mask = 0; |
| 64 | 86 | |
| 65 | − if (file->f_mode & FMODE_NONOTIFY) | |
| 66 | − return 0; | |
| 67 | 87 | if (!(mask & (MAY_READ | MAY_OPEN))) |
| 68 | 88 | return 0; |
| 89 | + | |
| 69 | 90 | if (mask & MAY_OPEN) { |
| 70 | 91 | fsnotify_mask = FS_OPEN_PERM; |
| 71 | 92 | |
| 72 | 93 | if (file->f_flags & __FMODE_EXEC) { |
| 73 | − ret = fsnotify_path(inode, path, FS_OPEN_EXEC_PERM); | |
| 94 | + ret = fsnotify_file(file, FS_OPEN_EXEC_PERM); | |
| 74 | 95 | |
| 75 | 96 | if (ret) |
| 76 | 97 | return ret; |
| @@ -79,10 +100,7 @@ static inline int fsnotify_perm(struct file *file, int mask) · 2 unmodified lines | ||
| 79 | 100 | fsnotify_mask = FS_ACCESS_PERM; |
| 80 | 101 | } |
| 81 | 102 | |
| 82 | − if (S_ISDIR(inode->i_mode)) | |
| 83 | − fsnotify_mask |= FS_ISDIR; | |
| 84 | − | |
| 85 | − return fsnotify_path(inode, path, fsnotify_mask); | |
| 103 | + return fsnotify_file(file, fsnotify_mask); | |
| 86 | 104 | } |
| 87 | 105 | |
| 88 | 106 | /* |
| @@ -122,10 +140,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, · 33 unmodified lines | ||
| 122 | 140 | mask |= FS_ISDIR; |
| 123 | 141 | } |
| 124 | 142 | |
| 125 | − fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name, | |
| 126 | − fs_cookie); | |
| 127 | − fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name, | |
| 128 | − fs_cookie); | |
| 143 | + fsnotify_name(old_dir, old_dir_mask, source, old_name, fs_cookie); | |
| 144 | + fsnotify_name(new_dir, new_dir_mask, source, new_name, fs_cookie); | |
| 129 | 145 | |
| 130 | 146 | if (target) |
| 131 | 147 | fsnotify_link_count(target); |
| @@ -180,12 +196,13 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) · 48 unmodified lines | ||
| 180 | 196 | * Note: We have to pass also the linked inode ptr as some filesystems leave |
| 181 | 197 | * new_dentry->d_inode NULL and instantiate inode pointer later |
| 182 | 198 | */ |
| 183 | −static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) | |
| 199 | +static inline void fsnotify_link(struct inode *dir, struct inode *inode, | |
| 200 | + struct dentry *new_dentry) | |
| 184 | 201 | { |
| 185 | 202 | fsnotify_link_count(inode); |
| 186 | 203 | audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE); |
| 187 | 204 | |
| 188 | − fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0); | |
| 205 | + fsnotify_name(dir, FS_CREATE, inode, &new_dentry->d_name, 0); | |
| 189 | 206 | } |
| 190 | 207 | |
| 191 | 208 | /* |
| @@ -229,15 +246,7 @@ static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) · 37 unmodified lines | ||
| 229 | 246 | */ |
| 230 | 247 | static inline void fsnotify_access(struct file *file) |
| 231 | 248 | { |
| 232 | − const struct path *path = &file->f_path; | |
| 233 | − struct inode *inode = file_inode(file); | |
| 234 | − __u32 mask = FS_ACCESS; | |
| 235 | − | |
| 236 | − if (S_ISDIR(inode->i_mode)) | |
| 237 | − mask |= FS_ISDIR; | |
| 238 | − | |
| 239 | − if (!(file->f_mode & FMODE_NONOTIFY)) | |
| 240 | − fsnotify_path(inode, path, mask); | |
| 249 | + fsnotify_file(file, FS_ACCESS); | |
| 241 | 250 | } |
| 242 | 251 | |
| 243 | 252 | /* |
| @@ -245,15 +254,7 @@ static inline void fsnotify_access(struct file *file) · 1 unmodified line | ||
| 245 | 254 | */ |
| 246 | 255 | static inline void fsnotify_modify(struct file *file) |
| 247 | 256 | { |
| 248 | − const struct path *path = &file->f_path; | |
| 249 | − struct inode *inode = file_inode(file); | |
| 250 | − __u32 mask = FS_MODIFY; | |
| 251 | − | |
| 252 | − if (S_ISDIR(inode->i_mode)) | |
| 253 | − mask |= FS_ISDIR; | |
| 254 | − | |
| 255 | − if (!(file->f_mode & FMODE_NONOTIFY)) | |
| 256 | − fsnotify_path(inode, path, mask); | |
| 257 | + fsnotify_file(file, FS_MODIFY); | |
| 257 | 258 | } |
| 258 | 259 | |
| 259 | 260 | /* |
| @@ -261,16 +262,12 @@ static inline void fsnotify_modify(struct file *file) · 1 unmodified line | ||
| 261 | 262 | */ |
| 262 | 263 | static inline void fsnotify_open(struct file *file) |
| 263 | 264 | { |
| 264 | − const struct path *path = &file->f_path; | |
| 265 | − struct inode *inode = file_inode(file); | |
| 266 | 265 | __u32 mask = FS_OPEN; |
| 267 | 266 | |
| 268 | − if (S_ISDIR(inode->i_mode)) | |
| 269 | − mask |= FS_ISDIR; | |
| 270 | 267 | if (file->f_flags & __FMODE_EXEC) |
| 271 | 268 | mask |= FS_OPEN_EXEC; |
| 272 | 269 | |
| 273 | − fsnotify_path(inode, path, mask); | |
| 270 | + fsnotify_file(file, mask); | |
| 274 | 271 | } |
| 275 | 272 | |
| 276 | 273 | /* |
| @@ -278,16 +275,10 @@ static inline void fsnotify_open(struct file *file) · 1 unmodified line | ||
| 278 | 275 | */ |
| 279 | 276 | static inline void fsnotify_close(struct file *file) |
| 280 | 277 | { |
| 281 | − const struct path *path = &file->f_path; | |
| 282 | − struct inode *inode = file_inode(file); | |
| 283 | − fmode_t mode = file->f_mode; | |
| 284 | − __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; | |
| 278 | + __u32 mask = (file->f_mode & FMODE_WRITE) ? FS_CLOSE_WRITE : | |
| 279 | + FS_CLOSE_NOWRITE; | |
| 285 | 280 | |
| 286 | − if (S_ISDIR(inode->i_mode)) | |
| 287 | − mask |= FS_ISDIR; | |
| 288 | − | |
| 289 | − if (!(file->f_mode & FMODE_NONOTIFY)) | |
| 290 | − fsnotify_path(inode, path, mask); | |
| 281 | + fsnotify_file(file, mask); | |
| 291 | 282 | } |
| 292 | 283 | |
| 293 | 284 | /* |
| @@ -295,14 +286,7 @@ static inline void fsnotify_close(struct file *file) · 1 unmodified line | ||
| 295 | 286 | */ |
| 296 | 287 | static inline void fsnotify_xattr(struct dentry *dentry) |
| 297 | 288 | { |
| 298 | − struct inode *inode = dentry->d_inode; | |
| 299 | − __u32 mask = FS_ATTRIB; | |
| 300 | − | |
| 301 | − if (S_ISDIR(inode->i_mode)) | |
| 302 | − mask |= FS_ISDIR; | |
| 303 | − | |
| 304 | − fsnotify_parent(NULL, dentry, mask); | |
| 305 | − fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | |
| 289 | + fsnotify_dentry(dentry, FS_ATTRIB); | |
| 306 | 290 | } |
| 307 | 291 | |
| 308 | 292 | /* |
| @@ -311,7 +295,6 @@ static inline void fsnotify_xattr(struct dentry *dentry) · 2 unmodified lines | ||
| 311 | 295 | */ |
| 312 | 296 | static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) |
| 313 | 297 | { |
| 314 | − struct inode *inode = dentry->d_inode; | |
| 315 | 298 | __u32 mask = 0; |
| 316 | 299 | |
| 317 | 300 | if (ia_valid & ATTR_UID) |
| @@ -332,13 +315,8 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) · 14 unmodified lines | ||
| 332 | 315 | if (ia_valid & ATTR_MODE) |
| 333 | 316 | mask |= FS_ATTRIB; |
| 334 | 317 | |
| 335 | − if (mask) { | |
| 336 | − if (S_ISDIR(inode->i_mode)) | |
| 337 | − mask |= FS_ISDIR; | |
| 338 | − | |
| 339 | − fsnotify_parent(NULL, dentry, mask); | |
| 340 | − fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | |
| 341 | − } | |
| 318 | + if (mask) | |
| 319 | + fsnotify_dentry(dentry, mask); | |
| 342 | 320 | } |
| 343 | 321 | |
| 344 | 322 | #endif /* _LINUX_FS_NOTIFY_H */ |
| @@ -47,18 +47,18 @@ · 46 unmodified lines | ||
| 47 | 47 | #define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */ |
| 48 | 48 | #define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */ |
| 49 | 49 | #define FS_OPEN_EXEC_PERM 0x00040000 /* open/exec event in a permission hook */ |
| 50 | +#define FS_DIR_MODIFY 0x00080000 /* Directory entry was modified */ | |
| 50 | 51 | |
| 51 | 52 | #define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */ |
| 52 | −#define FS_ISDIR 0x40000000 /* event occurred against dir */ | |
| 53 | −#define FS_IN_ONESHOT 0x80000000 /* only send event once */ | |
| 54 | − | |
| 55 | −#define FS_DN_RENAME 0x10000000 /* file renamed */ | |
| 56 | −#define FS_DN_MULTISHOT 0x20000000 /* dnotify multishot */ | |
| 57 | − | |
| 58 | 53 | /* This inode cares about things that happen to its children. Always set for |
| 59 | 54 | * dnotify and inotify. */ |
| 60 | 55 | #define FS_EVENT_ON_CHILD 0x08000000 |
| 61 | 56 | |
| 57 | +#define FS_DN_RENAME 0x10000000 /* file renamed */ | |
| 58 | +#define FS_DN_MULTISHOT 0x20000000 /* dnotify multishot */ | |
| 59 | +#define FS_ISDIR 0x40000000 /* event occurred against dir */ | |
| 60 | +#define FS_IN_ONESHOT 0x80000000 /* only send event once */ | |
| 61 | + | |
| 62 | 62 | #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) |
| 63 | 63 | |
| 64 | 64 | /* |
| @@ -67,7 +67,8 @@ · 2 unmodified lines | ||
| 67 | 67 | * The watching parent may get an FS_ATTRIB|FS_EVENT_ON_CHILD event |
| 68 | 68 | * when a directory entry inside a child subdir changes. |
| 69 | 69 | */ |
| 70 | −#define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE) | |
| 70 | +#define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE | \ | |
| 71 | + FS_DIR_MODIFY) | |
| 71 | 72 | |
| 72 | 73 | #define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM | \ |
| 73 | 74 | FS_OPEN_EXEC_PERM) |
| @@ -133,8 +134,7 @@ struct fsnotify_ops { · 59 unmodified lines | ||
| 133 | 134 | */ |
| 134 | 135 | struct fsnotify_event { |
| 135 | 136 | struct list_head list; |
| 136 | − /* inode may ONLY be dereferenced during handle_event(). */ | |
| 137 | − struct inode *inode; /* either the inode the event happened to or its parent */ | |
| 137 | + unsigned long objectid; /* identifier for queue merges */ | |
| 138 | 138 | }; |
| 139 | 139 | |
| 140 | 140 | /* |
| @@ -213,10 +213,36 @@ struct fsnotify_group { · 72 unmodified lines | ||
| 213 | 213 | }; |
| 214 | 214 | }; |
| 215 | 215 | |
| 216 | −/* when calling fsnotify tell it if the data is a path or inode */ | |
| 217 | −#define FSNOTIFY_EVENT_NONE 0 | |
| 218 | −#define FSNOTIFY_EVENT_PATH 1 | |
| 219 | −#define FSNOTIFY_EVENT_INODE 2 | |
| 216 | +/* When calling fsnotify tell it if the data is a path or inode */ | |
| 217 | +enum fsnotify_data_type { | |
| 218 | + FSNOTIFY_EVENT_NONE, | |
| 219 | + FSNOTIFY_EVENT_PATH, | |
| 220 | + FSNOTIFY_EVENT_INODE, | |
| 221 | +}; | |
| 222 | + | |
| 223 | +static inline const struct inode *fsnotify_data_inode(const void *data, | |
| 224 | + int data_type) | |
| 225 | +{ | |
| 226 | + switch (data_type) { | |
| 227 | + case FSNOTIFY_EVENT_INODE: | |
| 228 | + return data; | |
| 229 | + case FSNOTIFY_EVENT_PATH: | |
| 230 | + return d_inode(((const struct path *)data)->dentry); | |
| 231 | + default: | |
| 232 | + return NULL; | |
| 233 | + } | |
| 234 | +} | |
| 235 | + | |
| 236 | +static inline const struct path *fsnotify_data_path(const void *data, | |
| 237 | + int data_type) | |
| 238 | +{ | |
| 239 | + switch (data_type) { | |
| 240 | + case FSNOTIFY_EVENT_PATH: | |
| 241 | + return data; | |
| 242 | + default: | |
| 243 | + return NULL; | |
| 244 | + } | |
| 245 | +} | |
| 220 | 246 | |
| 221 | 247 | enum fsnotify_obj_type { |
| 222 | 248 | FSNOTIFY_OBJ_TYPE_INODE, |
| @@ -351,9 +377,10 @@ struct fsnotify_mark { · 128 unmodified lines | ||
| 351 | 377 | /* called from the vfs helpers */ |
| 352 | 378 | |
| 353 | 379 | /* main fsnotify call to send events */ |
| 354 | −extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, | |
| 355 | − const struct qstr *name, u32 cookie); | |
| 356 | −extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask); | |
| 380 | +extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, | |
| 381 | + int data_type, const struct qstr *name, u32 cookie); | |
| 382 | +extern int fsnotify_parent(struct dentry *dentry, __u32 mask, const void *data, | |
| 383 | + int data_type); | |
| 357 | 384 | extern void __fsnotify_inode_delete(struct inode *inode); |
| 358 | 385 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); |
| 359 | 386 | extern void fsnotify_sb_delete(struct super_block *sb); |
| @@ -500,21 +527,22 @@ extern void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info); · 140 unmodified lines | ||
| 500 | 527 | extern bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info); |
| 501 | 528 | |
| 502 | 529 | static inline void fsnotify_init_event(struct fsnotify_event *event, |
| 503 | − struct inode *inode) | |
| 530 | + unsigned long objectid) | |
| 504 | 531 | { |
| 505 | 532 | INIT_LIST_HEAD(&event->list); |
| 506 | − event->inode = inode; | |
| 533 | + event->objectid = objectid; | |
| 507 | 534 | } |
| 508 | 535 | |
| 509 | 536 | #else |
| 510 | 537 | |
| 511 | −static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, | |
| 512 | − const struct qstr *name, u32 cookie) | |
| 538 | +static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, | |
| 539 | + int data_type, const struct qstr *name, u32 cookie) | |
| 513 | 540 | { |
| 514 | 541 | return 0; |
| 515 | 542 | } |
| 516 | 543 | |
| 517 | −static inline int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask) | |
| 544 | +static inline int fsnotify_parent(struct dentry *dentry, __u32 mask, | |
| 545 | + const void *data, int data_type) | |
| 518 | 546 | { |
| 519 | 547 | return 0; |
| 520 | 548 | } |
| @@ -31,23 +31,26 @@ struct task_struct; · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | union futex_key { |
| 33 | 33 | struct { |
| 34 | + u64 i_seq; | |
| 34 | 35 | unsigned long pgoff; |
| 35 | − struct inode *inode; | |
| 36 | − int offset; | |
| 36 | + unsigned int offset; | |
| 37 | 37 | } shared; |
| 38 | 38 | struct { |
| 39 | + union { | |
| 40 | + struct mm_struct *mm; | |
| 41 | + u64 __tmp; | |
| 42 | + }; | |
| 39 | 43 | unsigned long address; |
| 40 | − struct mm_struct *mm; | |
| 41 | − int offset; | |
| 44 | + unsigned int offset; | |
| 42 | 45 | } private; |
| 43 | 46 | struct { |
| 47 | + u64 ptr; | |
| 44 | 48 | unsigned long word; |
| 45 | − void *ptr; | |
| 46 | − int offset; | |
| 49 | + unsigned int offset; | |
| 47 | 50 | } both; |
| 48 | 51 | }; |
| 49 | 52 | |
| 50 | −#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } } | |
| 53 | +#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = 0ULL } } | |
| 51 | 54 | |
| 52 | 55 | #ifdef CONFIG_FUTEX |
| 53 | 56 | enum { |
| @@ -170,4 +170,6 @@ struct fwnode_operations { · 169 unmodified lines | ||
| 170 | 170 | } while (false) |
| 171 | 171 | #define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev) |
| 172 | 172 | |
| 173 | +extern u32 fw_devlink_get_flags(void); | |
| 174 | + | |
| 173 | 175 | #endif |
| @@ -27,39 +27,8 @@ · 26 unmodified lines | ||
| 27 | 27 | #define part_to_dev(part) (&((part)->__dev)) |
| 28 | 28 | |
| 29 | 29 | extern struct device_type part_type; |
| 30 | −extern struct kobject *block_depr; | |
| 31 | 30 | extern struct class block_class; |
| 32 | 31 | |
| 33 | −enum { | |
| 34 | −/* These three have identical behaviour; use the second one if DOS FDISK gets | |
| 35 | − confused about extended/logical partitions starting past cylinder 1023. */ | |
| 36 | − DOS_EXTENDED_PARTITION = 5, | |
| 37 | − LINUX_EXTENDED_PARTITION = 0x85, | |
| 38 | − WIN98_EXTENDED_PARTITION = 0x0f, | |
| 39 | − | |
| 40 | − SUN_WHOLE_DISK = DOS_EXTENDED_PARTITION, | |
| 41 | − | |
| 42 | − LINUX_SWAP_PARTITION = 0x82, | |
| 43 | − LINUX_DATA_PARTITION = 0x83, | |
| 44 | − LINUX_LVM_PARTITION = 0x8e, | |
| 45 | − LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */ | |
| 46 | − | |
| 47 | − SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION, | |
| 48 | − NEW_SOLARIS_X86_PARTITION = 0xbf, | |
| 49 | − | |
| 50 | − DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */ | |
| 51 | − DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */ | |
| 52 | − DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */ | |
| 53 | − EZD_PARTITION = 0x55, /* EZ-DRIVE */ | |
| 54 | − | |
| 55 | − FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */ | |
| 56 | − OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */ | |
| 57 | − NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */ | |
| 58 | − BSDI_PARTITION = 0xb7, /* BSDI Partition ID */ | |
| 59 | − MINIX_PARTITION = 0x81, /* Minix Partition ID */ | |
| 60 | − UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ | |
| 61 | −}; | |
| 62 | − | |
| 63 | 32 | #define DISK_MAX_PARTS 256 |
| 64 | 33 | #define DISK_NAME_LEN 32 |
| 65 | 34 | |
| @@ -70,26 +39,12 @@ enum { · 4 unmodified lines | ||
| 70 | 39 | #include <linux/fs.h> |
| 71 | 40 | #include <linux/workqueue.h> |
| 72 | 41 | |
| 73 | −struct partition { | |
| 74 | − unsigned char boot_ind; /* 0x80 - active */ | |
| 75 | − unsigned char head; /* starting head */ | |
| 76 | − unsigned char sector; /* starting sector */ | |
| 77 | − unsigned char cyl; /* starting cylinder */ | |
| 78 | − unsigned char sys_ind; /* What partition type */ | |
| 79 | − unsigned char end_head; /* end head */ | |
| 80 | − unsigned char end_sector; /* end sector */ | |
| 81 | − unsigned char end_cyl; /* end cylinder */ | |
| 82 | − __le32 start_sect; /* starting sector counting from 0 */ | |
| 83 | − __le32 nr_sects; /* nr of sectors in partition */ | |
| 84 | −} __attribute__((packed)); | |
| 85 | − | |
| 86 | 42 | struct disk_stats { |
| 87 | 43 | u64 nsecs[NR_STAT_GROUPS]; |
| 88 | 44 | unsigned long sectors[NR_STAT_GROUPS]; |
| 89 | 45 | unsigned long ios[NR_STAT_GROUPS]; |
| 90 | 46 | unsigned long merges[NR_STAT_GROUPS]; |
| 91 | 47 | unsigned long io_ticks; |
| 92 | − unsigned long time_in_queue; | |
| 93 | 48 | local_t in_flight[2]; |
| 94 | 49 | }; |
| 95 | 50 | |
| @@ -133,17 +88,64 @@ struct hd_struct { · 37 unmodified lines | ||
| 133 | 88 | struct rcu_work rcu_work; |
| 134 | 89 | }; |
| 135 | 90 | |
| 136 | −#define GENHD_FL_REMOVABLE 1 | |
| 137 | −/* 2 is unused */ | |
| 138 | −#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4 | |
| 139 | −#define GENHD_FL_CD 8 | |
| 140 | −#define GENHD_FL_UP 16 | |
| 141 | −#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | |
| 142 | −#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ | |
| 143 | −#define GENHD_FL_NATIVE_CAPACITY 128 | |
| 144 | −#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256 | |
| 145 | −#define GENHD_FL_NO_PART_SCAN 512 | |
| 146 | −#define GENHD_FL_HIDDEN 1024 | |
| 91 | +/** | |
| 92 | + * DOC: genhd capability flags | |
| 93 | + * | |
| 94 | + * ``GENHD_FL_REMOVABLE`` (0x0001): indicates that the block device | |
| 95 | + * gives access to removable media. | |
| 96 | + * When set, the device remains present even when media is not | |
| 97 | + * inserted. | |
| 98 | + * Must not be set for devices which are removed entirely when the | |
| 99 | + * media is removed. | |
| 100 | + * | |
| 101 | + * ``GENHD_FL_CD`` (0x0008): the block device is a CD-ROM-style | |
| 102 | + * device. | |
| 103 | + * Affects responses to the ``CDROM_GET_CAPABILITY`` ioctl. | |
| 104 | + * | |
| 105 | + * ``GENHD_FL_UP`` (0x0010): indicates that the block device is "up", | |
| 106 | + * with a similar meaning to network interfaces. | |
| 107 | + * | |
| 108 | + * ``GENHD_FL_SUPPRESS_PARTITION_INFO`` (0x0020): don't include | |
| 109 | + * partition information in ``/proc/partitions`` or in the output of | |
| 110 | + * printk_all_partitions(). | |
| 111 | + * Used for the null block device and some MMC devices. | |
| 112 | + * | |
| 113 | + * ``GENHD_FL_EXT_DEVT`` (0x0040): the driver supports extended | |
| 114 | + * dynamic ``dev_t``, i.e. it wants extended device numbers | |
| 115 | + * (``BLOCK_EXT_MAJOR``). | |
| 116 | + * This affects the maximum number of partitions. | |
| 117 | + * | |
| 118 | + * ``GENHD_FL_NATIVE_CAPACITY`` (0x0080): based on information in the | |
| 119 | + * partition table, the device's capacity has been extended to its | |
| 120 | + * native capacity; i.e. the device has hidden capacity used by one | |
| 121 | + * of the partitions (this is a flag used so that native capacity is | |
| 122 | + * only ever unlocked once). | |
| 123 | + * | |
| 124 | + * ``GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE`` (0x0100): event polling is | |
| 125 | + * blocked whenever a writer holds an exclusive lock. | |
| 126 | + * | |
| 127 | + * ``GENHD_FL_NO_PART_SCAN`` (0x0200): partition scanning is disabled. | |
| 128 | + * Used for loop devices in their default settings and some MMC | |
| 129 | + * devices. | |
| 130 | + * | |
| 131 | + * ``GENHD_FL_HIDDEN`` (0x0400): the block device is hidden; it | |
| 132 | + * doesn't produce events, doesn't appear in sysfs, and doesn't have | |
| 133 | + * an associated ``bdev``. | |
| 134 | + * Implies ``GENHD_FL_SUPPRESS_PARTITION_INFO`` and | |
| 135 | + * ``GENHD_FL_NO_PART_SCAN``. | |
| 136 | + * Used for multipath devices. | |
| 137 | + */ | |
| 138 | +#define GENHD_FL_REMOVABLE 0x0001 | |
| 139 | +/* 2 is unused (used to be GENHD_FL_DRIVERFS) */ | |
| 140 | +/* 4 is unused (used to be GENHD_FL_MEDIA_CHANGE_NOTIFY) */ | |
| 141 | +#define GENHD_FL_CD 0x0008 | |
| 142 | +#define GENHD_FL_UP 0x0010 | |
| 143 | +#define GENHD_FL_SUPPRESS_PARTITION_INFO 0x0020 | |
| 144 | +#define GENHD_FL_EXT_DEVT 0x0040 | |
| 145 | +#define GENHD_FL_NATIVE_CAPACITY 0x0080 | |
| 146 | +#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 0x0100 | |
| 147 | +#define GENHD_FL_NO_PART_SCAN 0x0200 | |
| 148 | +#define GENHD_FL_HIDDEN 0x0400 | |
| 147 | 149 | |
| 148 | 150 | enum { |
| 149 | 151 | DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ |
| @@ -189,7 +191,6 @@ struct gendisk { · 39 unmodified lines | ||
| 189 | 191 | * disks that can't be partitioned. */ |
| 190 | 192 | |
| 191 | 193 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ |
| 192 | − char *(*devnode)(struct gendisk *gd, umode_t *mode); | |
| 193 | 194 | |
| 194 | 195 | unsigned short events; /* supported events */ |
| 195 | 196 | unsigned short event_flags; /* flags related to event processing */ |
| @@ -245,18 +246,6 @@ static inline bool disk_part_scan_enabled(struct gendisk *disk) · 49 unmodified lines | ||
| 245 | 246 | !(disk->flags & GENHD_FL_NO_PART_SCAN); |
| 246 | 247 | } |
| 247 | 248 | |
| 248 | −static inline bool disk_has_partitions(struct gendisk *disk) | |
| 249 | −{ | |
| 250 | − bool ret = false; | |
| 251 | − | |
| 252 | − rcu_read_lock(); | |
| 253 | − if (rcu_dereference(disk->part_tbl)->len > 1) | |
| 254 | − ret = true; | |
| 255 | − rcu_read_unlock(); | |
| 256 | − | |
| 257 | − return ret; | |
| 258 | −} | |
| 259 | − | |
| 260 | 249 | static inline dev_t disk_devt(struct gendisk *disk) |
| 261 | 250 | { |
| 262 | 251 | return MKDEV(disk->major, disk->first_minor); |
| @@ -295,143 +284,7 @@ extern void disk_part_iter_init(struct disk_part_iter *piter, · 32 unmodified lines | ||
| 295 | 284 | struct gendisk *disk, unsigned int flags); |
| 296 | 285 | extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter); |
| 297 | 286 | extern void disk_part_iter_exit(struct disk_part_iter *piter); |
| 298 | − | |
| 299 | −extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, | |
| 300 | − sector_t sector); | |
| 301 | − | |
| 302 | −/* | |
| 303 | − * Macros to operate on percpu disk statistics: | |
| 304 | − * | |
| 305 | − * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters | |
| 306 | − * and should be called between disk_stat_lock() and | |
| 307 | − * disk_stat_unlock(). | |
| 308 | − * | |
| 309 | − * part_stat_read() can be called at any time. | |
| 310 | − * | |
| 311 | − * part_stat_{add|set_all}() and {init|free}_part_stats are for | |
| 312 | − * internal use only. | |
| 313 | − */ | |
| 314 | −#ifdef CONFIG_SMP | |
| 315 | −#define part_stat_lock() ({ rcu_read_lock(); get_cpu(); }) | |
| 316 | −#define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0) | |
| 317 | − | |
| 318 | −#define part_stat_get_cpu(part, field, cpu) \ | |
| 319 | − (per_cpu_ptr((part)->dkstats, (cpu))->field) | |
| 320 | − | |
| 321 | −#define part_stat_get(part, field) \ | |
| 322 | − part_stat_get_cpu(part, field, smp_processor_id()) | |
| 323 | − | |
| 324 | −#define part_stat_read(part, field) \ | |
| 325 | −({ \ | |
| 326 | − typeof((part)->dkstats->field) res = 0; \ | |
| 327 | − unsigned int _cpu; \ | |
| 328 | − for_each_possible_cpu(_cpu) \ | |
| 329 | − res += per_cpu_ptr((part)->dkstats, _cpu)->field; \ | |
| 330 | − res; \ | |
| 331 | −}) | |
| 332 | − | |
| 333 | −static inline void part_stat_set_all(struct hd_struct *part, int value) | |
| 334 | −{ | |
| 335 | − int i; | |
| 336 | − | |
| 337 | − for_each_possible_cpu(i) | |
| 338 | − memset(per_cpu_ptr(part->dkstats, i), value, | |
| 339 | − sizeof(struct disk_stats)); | |
| 340 | −} | |
| 341 | − | |
| 342 | −static inline int init_part_stats(struct hd_struct *part) | |
| 343 | −{ | |
| 344 | − part->dkstats = alloc_percpu(struct disk_stats); | |
| 345 | − if (!part->dkstats) | |
| 346 | − return 0; | |
| 347 | − return 1; | |
| 348 | −} | |
| 349 | − | |
| 350 | −static inline void free_part_stats(struct hd_struct *part) | |
| 351 | −{ | |
| 352 | − free_percpu(part->dkstats); | |
| 353 | −} | |
| 354 | − | |
| 355 | −#else /* !CONFIG_SMP */ | |
| 356 | −#define part_stat_lock() ({ rcu_read_lock(); 0; }) | |
| 357 | −#define part_stat_unlock() rcu_read_unlock() | |
| 358 | − | |
| 359 | −#define part_stat_get(part, field) ((part)->dkstats.field) | |
| 360 | −#define part_stat_get_cpu(part, field, cpu) part_stat_get(part, field) | |
| 361 | −#define part_stat_read(part, field) part_stat_get(part, field) | |
| 362 | − | |
| 363 | −static inline void part_stat_set_all(struct hd_struct *part, int value) | |
| 364 | −{ | |
| 365 | − memset(&part->dkstats, value, sizeof(struct disk_stats)); | |
| 366 | −} | |
| 367 | − | |
| 368 | −static inline int init_part_stats(struct hd_struct *part) | |
| 369 | −{ | |
| 370 | − return 1; | |
| 371 | −} | |
| 372 | − | |
| 373 | −static inline void free_part_stats(struct hd_struct *part) | |
| 374 | −{ | |
| 375 | −} | |
| 376 | − | |
| 377 | −#endif /* CONFIG_SMP */ | |
| 378 | − | |
| 379 | −#define part_stat_read_msecs(part, which) \ | |
| 380 | − div_u64(part_stat_read(part, nsecs[which]), NSEC_PER_MSEC) | |
| 381 | − | |
| 382 | −#define part_stat_read_accum(part, field) \ | |
| 383 | − (part_stat_read(part, field[STAT_READ]) + \ | |
| 384 | − part_stat_read(part, field[STAT_WRITE]) + \ | |
| 385 | − part_stat_read(part, field[STAT_DISCARD])) | |
| 386 | − | |
| 387 | −#define __part_stat_add(part, field, addnd) \ | |
| 388 | − (part_stat_get(part, field) += (addnd)) | |
| 389 | − | |
| 390 | −#define part_stat_add(part, field, addnd) do { \ | |
| 391 | − __part_stat_add((part), field, addnd); \ | |
| 392 | − if ((part)->partno) \ | |
| 393 | − __part_stat_add(&part_to_disk((part))->part0, \ | |
| 394 | − field, addnd); \ | |
| 395 | −} while (0) | |
| 396 | − | |
| 397 | −#define part_stat_dec(gendiskp, field) \ | |
| 398 | − part_stat_add(gendiskp, field, -1) | |
| 399 | −#define part_stat_inc(gendiskp, field) \ | |
| 400 | − part_stat_add(gendiskp, field, 1) | |
| 401 | −#define part_stat_sub(gendiskp, field, subnd) \ | |
| 402 | − part_stat_add(gendiskp, field, -subnd) | |
| 403 | − | |
| 404 | −#define part_stat_local_dec(gendiskp, field) \ | |
| 405 | − local_dec(&(part_stat_get(gendiskp, field))) | |
| 406 | −#define part_stat_local_inc(gendiskp, field) \ | |
| 407 | − local_inc(&(part_stat_get(gendiskp, field))) | |
| 408 | −#define part_stat_local_read(gendiskp, field) \ | |
| 409 | − local_read(&(part_stat_get(gendiskp, field))) | |
| 410 | −#define part_stat_local_read_cpu(gendiskp, field, cpu) \ | |
| 411 | − local_read(&(part_stat_get_cpu(gendiskp, field, cpu))) | |
| 412 | − | |
| 413 | −unsigned int part_in_flight(struct request_queue *q, struct hd_struct *part); | |
| 414 | −void part_in_flight_rw(struct request_queue *q, struct hd_struct *part, | |
| 415 | − unsigned int inflight[2]); | |
| 416 | −void part_dec_in_flight(struct request_queue *q, struct hd_struct *part, | |
| 417 | − int rw); | |
| 418 | −void part_inc_in_flight(struct request_queue *q, struct hd_struct *part, | |
| 419 | − int rw); | |
| 420 | − | |
| 421 | −static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) | |
| 422 | −{ | |
| 423 | − if (disk) | |
| 424 | − return kzalloc_node(sizeof(struct partition_meta_info), | |
| 425 | − GFP_KERNEL, disk->node_id); | |
| 426 | − return kzalloc(sizeof(struct partition_meta_info), GFP_KERNEL); | |
| 427 | −} | |
| 428 | − | |
| 429 | −static inline void free_part_info(struct hd_struct *part) | |
| 430 | −{ | |
| 431 | − kfree(part->info); | |
| 432 | −} | |
| 433 | − | |
| 434 | −void update_io_ticks(struct hd_struct *part, unsigned long now); | |
| 287 | +extern bool disk_has_partitions(struct gendisk *disk); | |
| 435 | 288 | |
| 436 | 289 | /* block/genhd.c */ |
| 437 | 290 | extern void device_add_disk(struct device *parent, struct gendisk *disk, |
| @@ -461,6 +314,8 @@ static inline int get_disk_ro(struct gendisk *disk) · 23 unmodified lines | ||
| 461 | 314 | extern void disk_block_events(struct gendisk *disk); |
| 462 | 315 | extern void disk_unblock_events(struct gendisk *disk); |
| 463 | 316 | extern void disk_flush_events(struct gendisk *disk, unsigned int mask); |
| 317 | +extern void set_capacity_revalidate_and_notify(struct gendisk *disk, | |
| 318 | + sector_t size, bool revalidate); | |
| 464 | 319 | extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask); |
| 465 | 320 | |
| 466 | 321 | /* drivers/char/random.c */ |
| @@ -480,170 +335,11 @@ static inline void set_capacity(struct gendisk *disk, sector_t size) · 13 unmodified lines | ||
| 480 | 335 | disk->part0.nr_sects = size; |
| 481 | 336 | } |
| 482 | 337 | |
| 483 | −#ifdef CONFIG_SOLARIS_X86_PARTITION | |
| 484 | − | |
| 485 | −#define SOLARIS_X86_NUMSLICE 16 | |
| 486 | −#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL) | |
| 487 | − | |
| 488 | −struct solaris_x86_slice { | |
| 489 | − __le16 s_tag; /* ID tag of partition */ | |
| 490 | − __le16 s_flag; /* permission flags */ | |
| 491 | − __le32 s_start; /* start sector no of partition */ | |
| 492 | − __le32 s_size; /* # of blocks in partition */ | |
| 493 | −}; | |
| 494 | − | |
| 495 | −struct solaris_x86_vtoc { | |
| 496 | − unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */ | |
| 497 | − __le32 v_sanity; /* to verify vtoc sanity */ | |
| 498 | − __le32 v_version; /* layout version */ | |
| 499 | − char v_volume[8]; /* volume name */ | |
| 500 | − __le16 v_sectorsz; /* sector size in bytes */ | |
| 501 | − __le16 v_nparts; /* number of partitions */ | |
| 502 | − unsigned int v_reserved[10]; /* free space */ | |
| 503 | − struct solaris_x86_slice | |
| 504 | − v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */ | |
| 505 | − unsigned int timestamp[SOLARIS_X86_NUMSLICE]; /* timestamp (unsupported) */ | |
| 506 | − char v_asciilabel[128]; /* for compatibility */ | |
| 507 | −}; | |
| 508 | − | |
| 509 | −#endif /* CONFIG_SOLARIS_X86_PARTITION */ | |
| 510 | − | |
| 511 | −#ifdef CONFIG_BSD_DISKLABEL | |
| 512 | −/* | |
| 513 | − * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il> | |
| 514 | − * updated by Marc Espie <Marc.Espie@openbsd.org> | |
| 515 | − */ | |
| 516 | − | |
| 517 | −/* check against BSD src/sys/sys/disklabel.h for consistency */ | |
| 518 | − | |
| 519 | −#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */ | |
| 520 | −#define BSD_MAXPARTITIONS 16 | |
| 521 | −#define OPENBSD_MAXPARTITIONS 16 | |
| 522 | −#define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */ | |
| 523 | −struct bsd_disklabel { | |
| 524 | − __le32 d_magic; /* the magic number */ | |
| 525 | − __s16 d_type; /* drive type */ | |
| 526 | − __s16 d_subtype; /* controller/d_type specific */ | |
| 527 | − char d_typename[16]; /* type name, e.g. "eagle" */ | |
| 528 | − char d_packname[16]; /* pack identifier */ | |
| 529 | − __u32 d_secsize; /* # of bytes per sector */ | |
| 530 | − __u32 d_nsectors; /* # of data sectors per track */ | |
| 531 | − __u32 d_ntracks; /* # of tracks per cylinder */ | |
| 532 | − __u32 d_ncylinders; /* # of data cylinders per unit */ | |
| 533 | − __u32 d_secpercyl; /* # of data sectors per cylinder */ | |
| 534 | − __u32 d_secperunit; /* # of data sectors per unit */ | |
| 535 | − __u16 d_sparespertrack; /* # of spare sectors per track */ | |
| 536 | − __u16 d_sparespercyl; /* # of spare sectors per cylinder */ | |
| 537 | − __u32 d_acylinders; /* # of alt. cylinders per unit */ | |
| 538 | − __u16 d_rpm; /* rotational speed */ | |
| 539 | − __u16 d_interleave; /* hardware sector interleave */ | |
| 540 | − __u16 d_trackskew; /* sector 0 skew, per track */ | |
| 541 | − __u16 d_cylskew; /* sector 0 skew, per cylinder */ | |
| 542 | − __u32 d_headswitch; /* head switch time, usec */ | |
| 543 | − __u32 d_trkseek; /* track-to-track seek, usec */ | |
| 544 | − __u32 d_flags; /* generic flags */ | |
| 545 | −#define NDDATA 5 | |
| 546 | − __u32 d_drivedata[NDDATA]; /* drive-type specific information */ | |
| 547 | −#define NSPARE 5 | |
| 548 | − __u32 d_spare[NSPARE]; /* reserved for future use */ | |
| 549 | − __le32 d_magic2; /* the magic number (again) */ | |
| 550 | − __le16 d_checksum; /* xor of data incl. partitions */ | |
| 551 | − | |
| 552 | − /* filesystem and partition information: */ | |
| 553 | − __le16 d_npartitions; /* number of partitions in following */ | |
| 554 | − __le32 d_bbsize; /* size of boot area at sn0, bytes */ | |
| 555 | − __le32 d_sbsize; /* max size of fs superblock, bytes */ | |
| 556 | − struct bsd_partition { /* the partition table */ | |
| 557 | − __le32 p_size; /* number of sectors in partition */ | |
| 558 | − __le32 p_offset; /* starting sector */ | |
| 559 | − __le32 p_fsize; /* filesystem basic fragment size */ | |
| 560 | − __u8 p_fstype; /* filesystem type, see below */ | |
| 561 | − __u8 p_frag; /* filesystem fragments per block */ | |
| 562 | − __le16 p_cpg; /* filesystem cylinders per group */ | |
| 563 | − } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */ | |
| 564 | −}; | |
| 565 | − | |
| 566 | −#endif /* CONFIG_BSD_DISKLABEL */ | |
| 567 | − | |
| 568 | −#ifdef CONFIG_UNIXWARE_DISKLABEL | |
| 569 | −/* | |
| 570 | − * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl> | |
| 571 | − * and Krzysztof G. Baranowski <kgb@knm.org.pl> | |
| 572 | − */ | |
| 573 | − | |
| 574 | −#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */ | |
| 575 | −#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */ | |
| 576 | −#define UNIXWARE_NUMSLICE 16 | |
| 577 | −#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */ | |
| 578 | − | |
| 579 | −struct unixware_slice { | |
| 580 | − __le16 s_label; /* label */ | |
| 581 | − __le16 s_flags; /* permission flags */ | |
| 582 | − __le32 start_sect; /* starting sector */ | |
| 583 | − __le32 nr_sects; /* number of sectors in slice */ | |
| 584 | −}; | |
| 585 | − | |
| 586 | −struct unixware_disklabel { | |
| 587 | − __le32 d_type; /* drive type */ | |
| 588 | − __le32 d_magic; /* the magic number */ | |
| 589 | − __le32 d_version; /* version number */ | |
| 590 | − char d_serial[12]; /* serial number of the device */ | |
| 591 | − __le32 d_ncylinders; /* # of data cylinders per device */ | |
| 592 | − __le32 d_ntracks; /* # of tracks per cylinder */ | |
| 593 | − __le32 d_nsectors; /* # of data sectors per track */ | |
| 594 | − __le32 d_secsize; /* # of bytes per sector */ | |
| 595 | − __le32 d_part_start; /* # of first sector of this partition */ | |
| 596 | − __le32 d_unknown1[12]; /* ? */ | |
| 597 | − __le32 d_alt_tbl; /* byte offset of alternate table */ | |
| 598 | − __le32 d_alt_len; /* byte length of alternate table */ | |
| 599 | − __le32 d_phys_cyl; /* # of physical cylinders per device */ | |
| 600 | − __le32 d_phys_trk; /* # of physical tracks per cylinder */ | |
| 601 | − __le32 d_phys_sec; /* # of physical sectors per track */ | |
| 602 | − __le32 d_phys_bytes; /* # of physical bytes per sector */ | |
| 603 | − __le32 d_unknown2; /* ? */ | |
| 604 | − __le32 d_unknown3; /* ? */ | |
| 605 | − __le32 d_pad[8]; /* pad */ | |
| 606 | − | |
| 607 | − struct unixware_vtoc { | |
| 608 | − __le32 v_magic; /* the magic number */ | |
| 609 | − __le32 v_version; /* version number */ | |
| 610 | − char v_name[8]; /* volume name */ | |
| 611 | − __le16 v_nslices; /* # of slices */ | |
| 612 | − __le16 v_unknown1; /* ? */ | |
| 613 | − __le32 v_reserved[10]; /* reserved */ | |
| 614 | − struct unixware_slice | |
| 615 | − v_slice[UNIXWARE_NUMSLICE]; /* slice headers */ | |
| 616 | − } vtoc; | |
| 617 | − | |
| 618 | −}; /* 408 */ | |
| 619 | − | |
| 620 | −#endif /* CONFIG_UNIXWARE_DISKLABEL */ | |
| 621 | − | |
| 622 | −#ifdef CONFIG_MINIX_SUBPARTITION | |
| 623 | −# define MINIX_NR_SUBPARTITIONS 4 | |
| 624 | −#endif /* CONFIG_MINIX_SUBPARTITION */ | |
| 625 | − | |
| 626 | −#define ADDPART_FLAG_NONE 0 | |
| 627 | −#define ADDPART_FLAG_RAID 1 | |
| 628 | −#define ADDPART_FLAG_WHOLEDISK 2 | |
| 629 | − | |
| 630 | −extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt); | |
| 631 | −extern void blk_free_devt(dev_t devt); | |
| 632 | −extern void blk_invalidate_devt(dev_t devt); | |
| 633 | 338 | extern dev_t blk_lookup_devt(const char *name, int partno); |
| 634 | −extern char *disk_name (struct gendisk *hd, int partno, char *buf); | |
| 635 | 339 | |
| 636 | 340 | int bdev_disk_changed(struct block_device *bdev, bool invalidate); |
| 637 | 341 | int blk_add_partitions(struct gendisk *disk, struct block_device *bdev); |
| 638 | 342 | int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev); |
| 639 | −extern int disk_expand_part_tbl(struct gendisk *disk, int target); | |
| 640 | −extern struct hd_struct * __must_check add_partition(struct gendisk *disk, | |
| 641 | − int partno, sector_t start, | |
| 642 | − sector_t len, int flags, | |
| 643 | − struct partition_meta_info | |
| 644 | − *info); | |
| 645 | −extern void __delete_partition(struct percpu_ref *); | |
| 646 | −extern void delete_partition(struct gendisk *, int); | |
| 647 | 343 | extern void printk_all_partitions(void); |
| 648 | 344 | |
| 649 | 345 | extern struct gendisk *__alloc_disk_node(int minors, int node_id); |
| @@ -657,20 +353,6 @@ extern void blk_register_region(dev_t devt, unsigned long range, · 7 unmodified lines | ||
| 657 | 353 | void *data); |
| 658 | 354 | extern void blk_unregister_region(dev_t devt, unsigned long range); |
| 659 | 355 | |
| 660 | −extern ssize_t part_size_show(struct device *dev, | |
| 661 | − struct device_attribute *attr, char *buf); | |
| 662 | −extern ssize_t part_stat_show(struct device *dev, | |
| 663 | − struct device_attribute *attr, char *buf); | |
| 664 | −extern ssize_t part_inflight_show(struct device *dev, | |
| 665 | − struct device_attribute *attr, char *buf); | |
| 666 | −#ifdef CONFIG_FAIL_MAKE_REQUEST | |
| 667 | −extern ssize_t part_fail_show(struct device *dev, | |
| 668 | − struct device_attribute *attr, char *buf); | |
| 669 | −extern ssize_t part_fail_store(struct device *dev, | |
| 670 | − struct device_attribute *attr, | |
| 671 | − const char *buf, size_t count); | |
| 672 | −#endif /* CONFIG_FAIL_MAKE_REQUEST */ | |
| 673 | − | |
| 674 | 356 | #define alloc_disk_node(minors, node_id) \ |
| 675 | 357 | ({ \ |
| 676 | 358 | static struct lock_class_key __key; \ |
| @@ -689,100 +371,6 @@ extern ssize_t part_fail_store(struct device *dev, · 12 unmodified lines | ||
| 689 | 371 | |
| 690 | 372 | #define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE) |
| 691 | 373 | |
| 692 | −static inline int hd_ref_init(struct hd_struct *part) | |
| 693 | −{ | |
| 694 | − if (percpu_ref_init(&part->ref, __delete_partition, 0, | |
| 695 | − GFP_KERNEL)) | |
| 696 | − return -ENOMEM; | |
| 697 | − return 0; | |
| 698 | −} | |
| 699 | − | |
| 700 | −static inline void hd_struct_get(struct hd_struct *part) | |
| 701 | −{ | |
| 702 | − percpu_ref_get(&part->ref); | |
| 703 | −} | |
| 704 | − | |
| 705 | −static inline int hd_struct_try_get(struct hd_struct *part) | |
| 706 | −{ | |
| 707 | − return percpu_ref_tryget_live(&part->ref); | |
| 708 | −} | |
| 709 | − | |
| 710 | −static inline void hd_struct_put(struct hd_struct *part) | |
| 711 | −{ | |
| 712 | − percpu_ref_put(&part->ref); | |
| 713 | −} | |
| 714 | − | |
| 715 | −static inline void hd_struct_kill(struct hd_struct *part) | |
| 716 | −{ | |
| 717 | − percpu_ref_kill(&part->ref); | |
| 718 | −} | |
| 719 | − | |
| 720 | −static inline void hd_free_part(struct hd_struct *part) | |
| 721 | −{ | |
| 722 | − free_part_stats(part); | |
| 723 | − free_part_info(part); | |
| 724 | − percpu_ref_exit(&part->ref); | |
| 725 | −} | |
| 726 | − | |
| 727 | −/* | |
| 728 | − * Any access of part->nr_sects which is not protected by partition | |
| 729 | − * bd_mutex or gendisk bdev bd_mutex, should be done using this | |
| 730 | − * accessor function. | |
| 731 | − * | |
| 732 | − * Code written along the lines of i_size_read() and i_size_write(). | |
| 733 | − * CONFIG_PREEMPTION case optimizes the case of UP kernel with preemption | |
| 734 | − * on. | |
| 735 | − */ | |
| 736 | −static inline sector_t part_nr_sects_read(struct hd_struct *part) | |
| 737 | −{ | |
| 738 | −#if BITS_PER_LONG==32 && defined(CONFIG_SMP) | |
| 739 | − sector_t nr_sects; | |
| 740 | − unsigned seq; | |
| 741 | − do { | |
| 742 | − seq = read_seqcount_begin(&part->nr_sects_seq); | |
| 743 | − nr_sects = part->nr_sects; | |
| 744 | − } while (read_seqcount_retry(&part->nr_sects_seq, seq)); | |
| 745 | − return nr_sects; | |
| 746 | −#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION) | |
| 747 | − sector_t nr_sects; | |
| 748 | − | |
| 749 | − preempt_disable(); | |
| 750 | − nr_sects = part->nr_sects; | |
| 751 | − preempt_enable(); | |
| 752 | − return nr_sects; | |
| 753 | −#else | |
| 754 | − return part->nr_sects; | |
| 755 | −#endif | |
| 756 | −} | |
| 757 | − | |
| 758 | −/* | |
| 759 | − * Should be called with mutex lock held (typically bd_mutex) of partition | |
| 760 | − * to provide mutual exlusion among writers otherwise seqcount might be | |
| 761 | − * left in wrong state leaving the readers spinning infinitely. | |
| 762 | − */ | |
| 763 | −static inline void part_nr_sects_write(struct hd_struct *part, sector_t size) | |
| 764 | −{ | |
| 765 | −#if BITS_PER_LONG==32 && defined(CONFIG_SMP) | |
| 766 | − write_seqcount_begin(&part->nr_sects_seq); | |
| 767 | − part->nr_sects = size; | |
| 768 | − write_seqcount_end(&part->nr_sects_seq); | |
| 769 | −#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION) | |
| 770 | − preempt_disable(); | |
| 771 | − part->nr_sects = size; | |
| 772 | − preempt_enable(); | |
| 773 | −#else | |
| 774 | − part->nr_sects = size; | |
| 775 | −#endif | |
| 776 | −} | |
| 777 | − | |
| 778 | −#if defined(CONFIG_BLK_DEV_INTEGRITY) | |
| 779 | −extern void blk_integrity_add(struct gendisk *); | |
| 780 | −extern void blk_integrity_del(struct gendisk *); | |
| 781 | −#else /* CONFIG_BLK_DEV_INTEGRITY */ | |
| 782 | −static inline void blk_integrity_add(struct gendisk *disk) { } | |
| 783 | −static inline void blk_integrity_del(struct gendisk *disk) { } | |
| 784 | −#endif /* CONFIG_BLK_DEV_INTEGRITY */ | |
| 785 | − | |
| 786 | 374 | #else /* CONFIG_BLOCK */ |
| 787 | 375 | |
| 788 | 376 | static inline void printk_all_partitions(void) { } |
| @@ -124,6 +124,8 @@ struct vm_area_struct; · 123 unmodified lines | ||
| 124 | 124 | * |
| 125 | 125 | * Reclaim modifiers |
| 126 | 126 | * ~~~~~~~~~~~~~~~~~ |
| 127 | + * Please note that all the following flags are only applicable to sleepable | |
| 128 | + * allocations (e.g. %GFP_NOWAIT and %GFP_ATOMIC will ignore them). | |
| 127 | 129 | * |
| 128 | 130 | * %__GFP_IO can start physical IO. |
| 129 | 131 | * |
| @@ -485,6 +487,12 @@ static inline void arch_free_page(struct page *page, int order) { } · 355 unmodified lines | ||
| 485 | 487 | #ifndef HAVE_ARCH_ALLOC_PAGE |
| 486 | 488 | static inline void arch_alloc_page(struct page *page, int order) { } |
| 487 | 489 | #endif |
| 490 | +#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE | |
| 491 | +static inline int arch_make_page_accessible(struct page *page) | |
| 492 | +{ | |
| 493 | + return 0; | |
| 494 | +} | |
| 495 | +#endif | |
| 488 | 496 | |
| 489 | 497 | struct page * |
| 490 | 498 | __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, |
| @@ -102,11 +102,9 @@ void devm_gpio_free(struct device *dev, unsigned int gpio); · 101 unmodified lines | ||
| 102 | 102 | #include <linux/kernel.h> |
| 103 | 103 | #include <linux/types.h> |
| 104 | 104 | #include <linux/bug.h> |
| 105 | −#include <linux/pinctrl/pinctrl.h> | |
| 106 | 105 | |
| 107 | 106 | struct device; |
| 108 | 107 | struct gpio_chip; |
| 109 | −struct pinctrl_dev; | |
| 110 | 108 | |
| 111 | 109 | static inline bool gpio_is_valid(int number) |
| 112 | 110 | { |
| @@ -2,9 +2,10 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef __LINUX_GPIO_CONSUMER_H |
| 3 | 3 | #define __LINUX_GPIO_CONSUMER_H |
| 4 | 4 | |
| 5 | +#include <linux/bits.h> | |
| 5 | 6 | #include <linux/bug.h> |
| 7 | +#include <linux/compiler_types.h> | |
| 6 | 8 | #include <linux/err.h> |
| 7 | −#include <linux/kernel.h> | |
| 8 | 9 | |
| 9 | 10 | struct device; |
| 10 | 11 | |
| @@ -156,6 +157,7 @@ int gpiod_set_raw_array_value_cansleep(unsigned int array_size, · 145 unmodified lines | ||
| 156 | 157 | struct gpio_array *array_info, |
| 157 | 158 | unsigned long *value_bitmap); |
| 158 | 159 | |
| 160 | +int gpiod_set_config(struct gpio_desc *desc, unsigned long config); | |
| 159 | 161 | int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce); |
| 160 | 162 | int gpiod_set_transitory(struct gpio_desc *desc, bool transitory); |
| 161 | 163 | void gpiod_toggle_active_low(struct gpio_desc *desc); |
| @@ -189,6 +191,8 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, · 27 unmodified lines | ||
| 189 | 191 | |
| 190 | 192 | #else /* CONFIG_GPIOLIB */ |
| 191 | 193 | |
| 194 | +#include <linux/kernel.h> | |
| 195 | + | |
| 192 | 196 | static inline int gpiod_count(struct device *dev, const char *con_id) |
| 193 | 197 | { |
| 194 | 198 | return 0; |
| @@ -470,6 +474,13 @@ static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, · 275 unmodified lines | ||
| 470 | 474 | return 0; |
| 471 | 475 | } |
| 472 | 476 | |
| 477 | +static inline int gpiod_set_config(struct gpio_desc *desc, unsigned long config) | |
| 478 | +{ | |
| 479 | + /* GPIO can never have been requested */ | |
| 480 | + WARN_ON(desc); | |
| 481 | + return -ENOSYS; | |
| 482 | +} | |
| 483 | + | |
| 473 | 484 | static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) |
| 474 | 485 | { |
| 475 | 486 | /* GPIO can never have been requested */ |
| @@ -87,7 +87,7 @@ struct gpio_irq_chip { · 86 unmodified lines | ||
| 87 | 87 | * @need_valid_mask to make these GPIO lines unavailable for |
| 88 | 88 | * translation. |
| 89 | 89 | */ |
| 90 | − int (*child_to_parent_hwirq)(struct gpio_chip *chip, | |
| 90 | + int (*child_to_parent_hwirq)(struct gpio_chip *gc, | |
| 91 | 91 | unsigned int child_hwirq, |
| 92 | 92 | unsigned int child_type, |
| 93 | 93 | unsigned int *parent_hwirq, |
| @@ -102,7 +102,7 @@ struct gpio_irq_chip { · 8 unmodified lines | ||
| 102 | 102 | * variant named &gpiochip_populate_parent_fwspec_fourcell is also |
| 103 | 103 | * available. |
| 104 | 104 | */ |
| 105 | − void *(*populate_parent_alloc_arg)(struct gpio_chip *chip, | |
| 105 | + void *(*populate_parent_alloc_arg)(struct gpio_chip *gc, | |
| 106 | 106 | unsigned int parent_hwirq, |
| 107 | 107 | unsigned int parent_type); |
| 108 | 108 | |
| @@ -114,7 +114,7 @@ struct gpio_irq_chip { · 5 unmodified lines | ||
| 114 | 114 | * callback. If this is not specified, then a default callback will be |
| 115 | 115 | * provided that returns the line offset. |
| 116 | 116 | */ |
| 117 | − unsigned int (*child_offset_to_irq)(struct gpio_chip *chip, | |
| 117 | + unsigned int (*child_offset_to_irq)(struct gpio_chip *gc, | |
| 118 | 118 | unsigned int pin); |
| 119 | 119 | |
| 120 | 120 | /** |
| @@ -209,7 +209,7 @@ struct gpio_irq_chip { · 88 unmodified lines | ||
| 209 | 209 | * a particular driver wants to clear IRQ related registers |
| 210 | 210 | * in order to avoid undesired events. |
| 211 | 211 | */ |
| 212 | − int (*init_hw)(struct gpio_chip *chip); | |
| 212 | + int (*init_hw)(struct gpio_chip *gc); | |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | 215 | * @init_valid_mask: optional routine to initialize @valid_mask, to be |
| @@ -220,7 +220,7 @@ struct gpio_irq_chip { · 4 unmodified lines | ||
| 220 | 220 | * then directly set some bits to "0" if they cannot be used for |
| 221 | 221 | * interrupts. |
| 222 | 222 | */ |
| 223 | − void (*init_valid_mask)(struct gpio_chip *chip, | |
| 223 | + void (*init_valid_mask)(struct gpio_chip *gc, | |
| 224 | 224 | unsigned long *valid_mask, |
| 225 | 225 | unsigned int ngpios); |
| 226 | 226 | |
| @@ -348,40 +348,40 @@ struct gpio_chip { · 121 unmodified lines | ||
| 348 | 348 | struct device *parent; |
| 349 | 349 | struct module *owner; |
| 350 | 350 | |
| 351 | − int (*request)(struct gpio_chip *chip, | |
| 351 | + int (*request)(struct gpio_chip *gc, | |
| 352 | 352 | unsigned offset); |
| 353 | − void (*free)(struct gpio_chip *chip, | |
| 353 | + void (*free)(struct gpio_chip *gc, | |
| 354 | 354 | unsigned offset); |
| 355 | − int (*get_direction)(struct gpio_chip *chip, | |
| 355 | + int (*get_direction)(struct gpio_chip *gc, | |
| 356 | 356 | unsigned offset); |
| 357 | − int (*direction_input)(struct gpio_chip *chip, | |
| 357 | + int (*direction_input)(struct gpio_chip *gc, | |
| 358 | 358 | unsigned offset); |
| 359 | − int (*direction_output)(struct gpio_chip *chip, | |
| 359 | + int (*direction_output)(struct gpio_chip *gc, | |
| 360 | 360 | unsigned offset, int value); |
| 361 | − int (*get)(struct gpio_chip *chip, | |
| 361 | + int (*get)(struct gpio_chip *gc, | |
| 362 | 362 | unsigned offset); |
| 363 | − int (*get_multiple)(struct gpio_chip *chip, | |
| 363 | + int (*get_multiple)(struct gpio_chip *gc, | |
| 364 | 364 | unsigned long *mask, |
| 365 | 365 | unsigned long *bits); |
| 366 | − void (*set)(struct gpio_chip *chip, | |
| 366 | + void (*set)(struct gpio_chip *gc, | |
| 367 | 367 | unsigned offset, int value); |
| 368 | − void (*set_multiple)(struct gpio_chip *chip, | |
| 368 | + void (*set_multiple)(struct gpio_chip *gc, | |
| 369 | 369 | unsigned long *mask, |
| 370 | 370 | unsigned long *bits); |
| 371 | − int (*set_config)(struct gpio_chip *chip, | |
| 371 | + int (*set_config)(struct gpio_chip *gc, | |
| 372 | 372 | unsigned offset, |
| 373 | 373 | unsigned long config); |
| 374 | − int (*to_irq)(struct gpio_chip *chip, | |
| 374 | + int (*to_irq)(struct gpio_chip *gc, | |
| 375 | 375 | unsigned offset); |
| 376 | 376 | |
| 377 | 377 | void (*dbg_show)(struct seq_file *s, |
| 378 | − struct gpio_chip *chip); | |
| 378 | + struct gpio_chip *gc); | |
| 379 | 379 | |
| 380 | − int (*init_valid_mask)(struct gpio_chip *chip, | |
| 380 | + int (*init_valid_mask)(struct gpio_chip *gc, | |
| 381 | 381 | unsigned long *valid_mask, |
| 382 | 382 | unsigned int ngpios); |
| 383 | 383 | |
| 384 | − int (*add_pin_ranges)(struct gpio_chip *chip); | |
| 384 | + int (*add_pin_ranges)(struct gpio_chip *gc); | |
| 385 | 385 | |
| 386 | 386 | int base; |
| 387 | 387 | u16 ngpio; |
| @@ -458,11 +458,11 @@ struct gpio_chip { · 70 unmodified lines | ||
| 458 | 458 | #endif /* CONFIG_OF_GPIO */ |
| 459 | 459 | }; |
| 460 | 460 | |
| 461 | −extern const char *gpiochip_is_requested(struct gpio_chip *chip, | |
| 461 | +extern const char *gpiochip_is_requested(struct gpio_chip *gc, | |
| 462 | 462 | unsigned offset); |
| 463 | 463 | |
| 464 | 464 | /* add/remove chips */ |
| 465 | −extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | |
| 465 | +extern int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, | |
| 466 | 466 | struct lock_class_key *lock_key, |
| 467 | 467 | struct lock_class_key *request_key); |
| 468 | 468 | |
| @@ -490,43 +490,43 @@ extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 21 unmodified lines | ||
| 490 | 490 | * Otherwise it returns zero as a success code. |
| 491 | 491 | */ |
| 492 | 492 | #ifdef CONFIG_LOCKDEP |
| 493 | −#define gpiochip_add_data(chip, data) ({ \ | |
| 493 | +#define gpiochip_add_data(gc, data) ({ \ | |
| 494 | 494 | static struct lock_class_key lock_key; \ |
| 495 | 495 | static struct lock_class_key request_key; \ |
| 496 | − gpiochip_add_data_with_key(chip, data, &lock_key, \ | |
| 496 | + gpiochip_add_data_with_key(gc, data, &lock_key, \ | |
| 497 | 497 | &request_key); \ |
| 498 | 498 | }) |
| 499 | 499 | #else |
| 500 | −#define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL) | |
| 500 | +#define gpiochip_add_data(gc, data) gpiochip_add_data_with_key(gc, data, NULL, NULL) | |
| 501 | 501 | #endif /* CONFIG_LOCKDEP */ |
| 502 | 502 | |
| 503 | −static inline int gpiochip_add(struct gpio_chip *chip) | |
| 503 | +static inline int gpiochip_add(struct gpio_chip *gc) | |
| 504 | 504 | { |
| 505 | − return gpiochip_add_data(chip, NULL); | |
| 505 | + return gpiochip_add_data(gc, NULL); | |
| 506 | 506 | } |
| 507 | −extern void gpiochip_remove(struct gpio_chip *chip); | |
| 508 | −extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip, | |
| 507 | +extern void gpiochip_remove(struct gpio_chip *gc); | |
| 508 | +extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, | |
| 509 | 509 | void *data); |
| 510 | 510 | |
| 511 | 511 | extern struct gpio_chip *gpiochip_find(void *data, |
| 512 | − int (*match)(struct gpio_chip *chip, void *data)); | |
| 512 | + int (*match)(struct gpio_chip *gc, void *data)); | |
| 513 | 513 | |
| 514 | −bool gpiochip_line_is_irq(struct gpio_chip *chip, unsigned int offset); | |
| 515 | −int gpiochip_reqres_irq(struct gpio_chip *chip, unsigned int offset); | |
| 516 | −void gpiochip_relres_irq(struct gpio_chip *chip, unsigned int offset); | |
| 517 | −void gpiochip_disable_irq(struct gpio_chip *chip, unsigned int offset); | |
| 518 | −void gpiochip_enable_irq(struct gpio_chip *chip, unsigned int offset); | |
| 514 | +bool gpiochip_line_is_irq(struct gpio_chip *gc, unsigned int offset); | |
| 515 | +int gpiochip_reqres_irq(struct gpio_chip *gc, unsigned int offset); | |
| 516 | +void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset); | |
| 517 | +void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset); | |
| 518 | +void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset); | |
| 519 | 519 | |
| 520 | 520 | /* Line status inquiry for drivers */ |
| 521 | −bool gpiochip_line_is_open_drain(struct gpio_chip *chip, unsigned int offset); | |
| 522 | −bool gpiochip_line_is_open_source(struct gpio_chip *chip, unsigned int offset); | |
| 521 | +bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset); | |
| 522 | +bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset); | |
| 523 | 523 | |
| 524 | 524 | /* Sleep persistence inquiry for drivers */ |
| 525 | −bool gpiochip_line_is_persistent(struct gpio_chip *chip, unsigned int offset); | |
| 526 | −bool gpiochip_line_is_valid(const struct gpio_chip *chip, unsigned int offset); | |
| 525 | +bool gpiochip_line_is_persistent(struct gpio_chip *gc, unsigned int offset); | |
| 526 | +bool gpiochip_line_is_valid(const struct gpio_chip *gc, unsigned int offset); | |
| 527 | 527 | |
| 528 | 528 | /* get driver data */ |
| 529 | −void *gpiochip_get_data(struct gpio_chip *chip); | |
| 529 | +void *gpiochip_get_data(struct gpio_chip *gc); | |
| 530 | 530 | |
| 531 | 531 | struct bgpio_pdata { |
| 532 | 532 | const char *label; |
| @@ -536,23 +536,23 @@ struct bgpio_pdata { · 3 unmodified lines | ||
| 536 | 536 | |
| 537 | 537 | #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY |
| 538 | 538 | |
| 539 | −void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip, | |
| 539 | +void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc, | |
| 540 | 540 | unsigned int parent_hwirq, |
| 541 | 541 | unsigned int parent_type); |
| 542 | −void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip, | |
| 542 | +void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *gc, | |
| 543 | 543 | unsigned int parent_hwirq, |
| 544 | 544 | unsigned int parent_type); |
| 545 | 545 | |
| 546 | 546 | #else |
| 547 | 547 | |
| 548 | −static inline void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip, | |
| 548 | +static inline void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc, | |
| 549 | 549 | unsigned int parent_hwirq, |
| 550 | 550 | unsigned int parent_type) |
| 551 | 551 | { |
| 552 | 552 | return NULL; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | −static inline void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip, | |
| 555 | +static inline void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *gc, | |
| 556 | 556 | unsigned int parent_hwirq, |
| 557 | 557 | unsigned int parent_type) |
| 558 | 558 | { |
| @@ -572,6 +572,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, · 13 unmodified lines | ||
| 572 | 572 | #define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3) |
| 573 | 573 | #define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */ |
| 574 | 574 | #define BGPIOF_NO_OUTPUT BIT(5) /* only input */ |
| 575 | +#define BGPIOF_NO_SET_ON_INPUT BIT(6) | |
| 575 | 576 | |
| 576 | 577 | int gpiochip_irq_map(struct irq_domain *d, unsigned int irq, |
| 577 | 578 | irq_hw_number_t hwirq); |
| @@ -582,11 +583,11 @@ int gpiochip_irq_domain_activate(struct irq_domain *domain, · 4 unmodified lines | ||
| 582 | 583 | void gpiochip_irq_domain_deactivate(struct irq_domain *domain, |
| 583 | 584 | struct irq_data *data); |
| 584 | 585 | |
| 585 | −void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip, | |
| 586 | +void gpiochip_set_nested_irqchip(struct gpio_chip *gc, | |
| 586 | 587 | struct irq_chip *irqchip, |
| 587 | 588 | unsigned int parent_irq); |
| 588 | 589 | |
| 589 | −int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, | |
| 590 | +int gpiochip_irqchip_add_key(struct gpio_chip *gc, | |
| 590 | 591 | struct irq_chip *irqchip, |
| 591 | 592 | unsigned int first_irq, |
| 592 | 593 | irq_flow_handler_t handler, |
| @@ -595,7 +596,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, · 2 unmodified lines | ||
| 595 | 596 | struct lock_class_key *lock_key, |
| 596 | 597 | struct lock_class_key *request_key); |
| 597 | 598 | |
| 598 | −bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip, | |
| 599 | +bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc, | |
| 599 | 600 | unsigned int offset); |
| 600 | 601 | |
| 601 | 602 | #ifdef CONFIG_LOCKDEP |
| @@ -606,7 +607,7 @@ bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip, · 4 unmodified lines | ||
| 606 | 607 | * boilerplate static inlines provides such a key for each |
| 607 | 608 | * unique instance. |
| 608 | 609 | */ |
| 609 | −static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, | |
| 610 | +static inline int gpiochip_irqchip_add(struct gpio_chip *gc, | |
| 610 | 611 | struct irq_chip *irqchip, |
| 611 | 612 | unsigned int first_irq, |
| 612 | 613 | irq_flow_handler_t handler, |
| @@ -615,12 +616,12 @@ static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, · 2 unmodified lines | ||
| 615 | 616 | static struct lock_class_key lock_key; |
| 616 | 617 | static struct lock_class_key request_key; |
| 617 | 618 | |
| 618 | − return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq, | |
| 619 | + return gpiochip_irqchip_add_key(gc, irqchip, first_irq, | |
| 619 | 620 | handler, type, false, |
| 620 | 621 | &lock_key, &request_key); |
| 621 | 622 | } |
| 622 | 623 | |
| 623 | −static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, | |
| 624 | +static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gc, | |
| 624 | 625 | struct irq_chip *irqchip, |
| 625 | 626 | unsigned int first_irq, |
| 626 | 627 | irq_flow_handler_t handler, |
| @@ -630,35 +631,35 @@ static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, · 3 unmodified lines | ||
| 630 | 631 | static struct lock_class_key lock_key; |
| 631 | 632 | static struct lock_class_key request_key; |
| 632 | 633 | |
| 633 | − return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq, | |
| 634 | + return gpiochip_irqchip_add_key(gc, irqchip, first_irq, | |
| 634 | 635 | handler, type, true, |
| 635 | 636 | &lock_key, &request_key); |
| 636 | 637 | } |
| 637 | 638 | #else /* ! CONFIG_LOCKDEP */ |
| 638 | −static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, | |
| 639 | +static inline int gpiochip_irqchip_add(struct gpio_chip *gc, | |
| 639 | 640 | struct irq_chip *irqchip, |
| 640 | 641 | unsigned int first_irq, |
| 641 | 642 | irq_flow_handler_t handler, |
| 642 | 643 | unsigned int type) |
| 643 | 644 | { |
| 644 | − return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq, | |
| 645 | + return gpiochip_irqchip_add_key(gc, irqchip, first_irq, | |
| 645 | 646 | handler, type, false, NULL, NULL); |
| 646 | 647 | } |
| 647 | 648 | |
| 648 | −static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, | |
| 649 | +static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gc, | |
| 649 | 650 | struct irq_chip *irqchip, |
| 650 | 651 | unsigned int first_irq, |
| 651 | 652 | irq_flow_handler_t handler, |
| 652 | 653 | unsigned int type) |
| 653 | 654 | { |
| 654 | − return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq, | |
| 655 | + return gpiochip_irqchip_add_key(gc, irqchip, first_irq, | |
| 655 | 656 | handler, type, true, NULL, NULL); |
| 656 | 657 | } |
| 657 | 658 | #endif /* CONFIG_LOCKDEP */ |
| 658 | 659 | |
| 659 | −int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset); | |
| 660 | −void gpiochip_generic_free(struct gpio_chip *chip, unsigned offset); | |
| 661 | −int gpiochip_generic_config(struct gpio_chip *chip, unsigned offset, | |
| 660 | +int gpiochip_generic_request(struct gpio_chip *gc, unsigned offset); | |
| 661 | +void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset); | |
| 662 | +int gpiochip_generic_config(struct gpio_chip *gc, unsigned offset, | |
| 662 | 663 | unsigned long config); |
| 663 | 664 | |
| 664 | 665 | /** |
| @@ -675,25 +676,25 @@ struct gpio_pin_range { · 10 unmodified lines | ||
| 675 | 676 | |
| 676 | 677 | #ifdef CONFIG_PINCTRL |
| 677 | 678 | |
| 678 | −int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | |
| 679 | +int gpiochip_add_pin_range(struct gpio_chip *gc, const char *pinctl_name, | |
| 679 | 680 | unsigned int gpio_offset, unsigned int pin_offset, |
| 680 | 681 | unsigned int npins); |
| 681 | −int gpiochip_add_pingroup_range(struct gpio_chip *chip, | |
| 682 | +int gpiochip_add_pingroup_range(struct gpio_chip *gc, | |
| 682 | 683 | struct pinctrl_dev *pctldev, |
| 683 | 684 | unsigned int gpio_offset, const char *pin_group); |
| 684 | −void gpiochip_remove_pin_ranges(struct gpio_chip *chip); | |
| 685 | +void gpiochip_remove_pin_ranges(struct gpio_chip *gc); | |
| 685 | 686 | |
| 686 | 687 | #else /* ! CONFIG_PINCTRL */ |
| 687 | 688 | |
| 688 | 689 | static inline int |
| 689 | −gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | |
| 690 | +gpiochip_add_pin_range(struct gpio_chip *gc, const char *pinctl_name, | |
| 690 | 691 | unsigned int gpio_offset, unsigned int pin_offset, |
| 691 | 692 | unsigned int npins) |
| 692 | 693 | { |
| 693 | 694 | return 0; |
| 694 | 695 | } |
| 695 | 696 | static inline int |
| 696 | −gpiochip_add_pingroup_range(struct gpio_chip *chip, | |
| 697 | +gpiochip_add_pingroup_range(struct gpio_chip *gc, | |
| 697 | 698 | struct pinctrl_dev *pctldev, |
| 698 | 699 | unsigned int gpio_offset, const char *pin_group) |
| 699 | 700 | { |
| @@ -701,27 +702,27 @@ gpiochip_add_pingroup_range(struct gpio_chip *chip, · 1 unmodified line | ||
| 701 | 702 | } |
| 702 | 703 | |
| 703 | 704 | static inline void |
| 704 | −gpiochip_remove_pin_ranges(struct gpio_chip *chip) | |
| 705 | +gpiochip_remove_pin_ranges(struct gpio_chip *gc) | |
| 705 | 706 | { |
| 706 | 707 | } |
| 707 | 708 | |
| 708 | 709 | #endif /* CONFIG_PINCTRL */ |
| 709 | 710 | |
| 710 | −struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, | |
| 711 | +struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc, | |
| 711 | 712 | unsigned int hwnum, |
| 712 | 713 | const char *label, |
| 713 | 714 | enum gpio_lookup_flags lflags, |
| 714 | 715 | enum gpiod_flags dflags); |
| 715 | 716 | void gpiochip_free_own_desc(struct gpio_desc *desc); |
| 716 | 717 | |
| 717 | −void devprop_gpiochip_set_names(struct gpio_chip *chip, | |
| 718 | +void devprop_gpiochip_set_names(struct gpio_chip *gc, | |
| 718 | 719 | const struct fwnode_handle *fwnode); |
| 719 | 720 | |
| 720 | 721 | #ifdef CONFIG_GPIOLIB |
| 721 | 722 | |
| 722 | 723 | /* lock/unlock as IRQ */ |
| 723 | −int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset); | |
| 724 | −void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); | |
| 724 | +int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset); | |
| 725 | +void gpiochip_unlock_as_irq(struct gpio_chip *gc, unsigned int offset); | |
| 725 | 726 | |
| 726 | 727 | |
| 727 | 728 | struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); |
| @@ -735,14 +736,14 @@ static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) · 7 unmodified lines | ||
| 735 | 736 | return ERR_PTR(-ENODEV); |
| 736 | 737 | } |
| 737 | 738 | |
| 738 | −static inline int gpiochip_lock_as_irq(struct gpio_chip *chip, | |
| 739 | +static inline int gpiochip_lock_as_irq(struct gpio_chip *gc, | |
| 739 | 740 | unsigned int offset) |
| 740 | 741 | { |
| 741 | 742 | WARN_ON(1); |
| 742 | 743 | return -EINVAL; |
| 743 | 744 | } |
| 744 | 745 | |
| 745 | −static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip, | |
| 746 | +static inline void gpiochip_unlock_as_irq(struct gpio_chip *gc, | |
| 746 | 747 | unsigned int offset) |
| 747 | 748 | { |
| 748 | 749 | WARN_ON(1); |
| @@ -37,7 +37,7 @@ extern void rcu_nmi_exit(void); · 36 unmodified lines | ||
| 37 | 37 | do { \ |
| 38 | 38 | account_irq_enter_time(current); \ |
| 39 | 39 | preempt_count_add(HARDIRQ_OFFSET); \ |
| 40 | − trace_hardirq_enter(); \ | |
| 40 | + lockdep_hardirq_enter(); \ | |
| 41 | 41 | } while (0) |
| 42 | 42 | |
| 43 | 43 | /* |
| @@ -50,7 +50,7 @@ extern void irq_enter(void); · 6 unmodified lines | ||
| 50 | 50 | */ |
| 51 | 51 | #define __irq_exit() \ |
| 52 | 52 | do { \ |
| 53 | − trace_hardirq_exit(); \ | |
| 53 | + lockdep_hardirq_exit(); \ | |
| 54 | 54 | account_irq_exit_time(current); \ |
| 55 | 55 | preempt_count_sub(HARDIRQ_OFFSET); \ |
| 56 | 56 | } while (0) |
| @@ -74,12 +74,12 @@ extern void irq_exit(void); · 17 unmodified lines | ||
| 74 | 74 | BUG_ON(in_nmi()); \ |
| 75 | 75 | preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \ |
| 76 | 76 | rcu_nmi_enter(); \ |
| 77 | − trace_hardirq_enter(); \ | |
| 77 | + lockdep_hardirq_enter(); \ | |
| 78 | 78 | } while (0) |
| 79 | 79 | |
| 80 | 80 | #define nmi_exit() \ |
| 81 | 81 | do { \ |
| 82 | − trace_hardirq_exit(); \ | |
| 82 | + lockdep_hardirq_exit(); \ | |
| 83 | 83 | rcu_nmi_exit(); \ |
| 84 | 84 | BUG_ON(!in_nmi()); \ |
| 85 | 85 | preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \ |
| @@ -145,7 +145,7 @@ static inline void hash_del_rcu(struct hlist_node *node) · 144 unmodified lines | ||
| 145 | 145 | * hash entry |
| 146 | 146 | * @name: hashtable to iterate |
| 147 | 147 | * @bkt: integer to use as bucket loop cursor |
| 148 | − * @tmp: a &struct used for temporary storage | |
| 148 | + * @tmp: a &struct hlist_node used for temporary storage | |
| 149 | 149 | * @obj: the type * to use as a loop cursor for each entry |
| 150 | 150 | * @member: the name of the hlist_node within the struct |
| 151 | 151 | */ |
| @@ -197,7 +197,7 @@ static inline void hash_del_rcu(struct hlist_node *node) · 45 unmodified lines | ||
| 197 | 197 | * same bucket safe against removals |
| 198 | 198 | * @name: hashtable to iterate |
| 199 | 199 | * @obj: the type * to use as a loop cursor for each entry |
| 200 | − * @tmp: a &struct used for temporary storage | |
| 200 | + * @tmp: a &struct hlist_node used for temporary storage | |
| 201 | 201 | * @member: the name of the hlist_node within the struct |
| 202 | 202 | * @key: the key of the objects to iterate over |
| 203 | 203 | */ |
| @@ -3,58 +3,8 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright 2013 Red Hat Inc. |
| 4 | 4 | * |
| 5 | 5 | * Authors: Jérôme Glisse <jglisse@redhat.com> |
| 6 | − */ | |
| 7 | −/* | |
| 8 | − * Heterogeneous Memory Management (HMM) | |
| 9 | − * | |
| 10 | − * See Documentation/vm/hmm.rst for reasons and overview of what HMM is and it | |
| 11 | − * is for. Here we focus on the HMM API description, with some explanation of | |
| 12 | − * the underlying implementation. | |
| 13 | − * | |
| 14 | − * Short description: HMM provides a set of helpers to share a virtual address | |
| 15 | − * space between CPU and a device, so that the device can access any valid | |
| 16 | − * address of the process (while still obeying memory protection). HMM also | |
| 17 | − * provides helpers to migrate process memory to device memory, and back. Each | |
| 18 | − * set of functionality (address space mirroring, and migration to and from | |
| 19 | − * device memory) can be used independently of the other. | |
| 20 | − * | |
| 21 | − * | |
| 22 | − * HMM address space mirroring API: | |
| 23 | − * | |
| 24 | − * Use HMM address space mirroring if you want to mirror a range of the CPU | |
| 25 | − * page tables of a process into a device page table. Here, "mirror" means "keep | |
| 26 | − * synchronized". Prerequisites: the device must provide the ability to write- | |
| 27 | − * protect its page tables (at PAGE_SIZE granularity), and must be able to | |
| 28 | − * recover from the resulting potential page faults. | |
| 29 | − * | |
| 30 | − * HMM guarantees that at any point in time, a given virtual address points to | |
| 31 | − * either the same memory in both CPU and device page tables (that is: CPU and | |
| 32 | − * device page tables each point to the same pages), or that one page table (CPU | |
| 33 | − * or device) points to no entry, while the other still points to the old page | |
| 34 | − * for the address. The latter case happens when the CPU page table update | |
| 35 | − * happens first, and then the update is mirrored over to the device page table. | |
| 36 | − * This does not cause any issue, because the CPU page table cannot start | |
| 37 | − * pointing to a new page until the device page table is invalidated. | |
| 38 | − * | |
| 39 | − * HMM uses mmu_notifiers to monitor the CPU page tables, and forwards any | |
| 40 | − * updates to each device driver that has registered a mirror. It also provides | |
| 41 | − * some API calls to help with taking a snapshot of the CPU page table, and to | |
| 42 | − * synchronize with any updates that might happen concurrently. | |
| 43 | 6 | * |
| 44 | − * | |
| 45 | − * HMM migration to and from device memory: | |
| 46 | − * | |
| 47 | − * HMM provides a set of helpers to hotplug device memory as ZONE_DEVICE, with | |
| 48 | − * a new MEMORY_DEVICE_PRIVATE type. This provides a struct page for each page | |
| 49 | − * of the device memory, and allows the device driver to manage its memory | |
| 50 | − * using those struct pages. Having struct pages for device memory makes | |
| 51 | − * migration easier. Because that memory is not addressable by the CPU it must | |
| 52 | − * never be pinned to the device; in other words, any CPU page fault can always | |
| 53 | − * cause the device memory to be migrated (copied/moved) back to regular memory. | |
| 54 | − * | |
| 55 | − * A new migrate helper (migrate_vma()) has been added (see mm/migrate.c) that | |
| 56 | − * allows use of a device DMA engine to perform the copy operation between | |
| 57 | − * regular system memory and device memory. | |
| 7 | + * See Documentation/vm/hmm.rst for reasons and overview of what HMM is. | |
| 58 | 8 | */ |
| 59 | 9 | #ifndef LINUX_HMM_H |
| 60 | 10 | #define LINUX_HMM_H |
| @@ -74,7 +24,6 @@ · 13 unmodified lines | ||
| 74 | 24 | * Flags: |
| 75 | 25 | * HMM_PFN_VALID: pfn is valid. It has, at least, read permission. |
| 76 | 26 | * HMM_PFN_WRITE: CPU page table has write permission set |
| 77 | − * HMM_PFN_DEVICE_PRIVATE: private device memory (ZONE_DEVICE) | |
| 78 | 27 | * |
| 79 | 28 | * The driver provides a flags array for mapping page protections to device |
| 80 | 29 | * PTE bits. If the driver valid bit for an entry is bit 3, |
| @@ -86,7 +35,6 @@ · 5 unmodified lines | ||
| 86 | 35 | enum hmm_pfn_flag_e { |
| 87 | 36 | HMM_PFN_VALID = 0, |
| 88 | 37 | HMM_PFN_WRITE, |
| 89 | − HMM_PFN_DEVICE_PRIVATE, | |
| 90 | 38 | HMM_PFN_FLAG_MAX |
| 91 | 39 | }; |
| 92 | 40 | |
| @@ -122,9 +70,6 @@ enum hmm_pfn_value_e { · 29 unmodified lines | ||
| 122 | 70 | * |
| 123 | 71 | * @notifier: a mmu_interval_notifier that includes the start/end |
| 124 | 72 | * @notifier_seq: result of mmu_interval_read_begin() |
| 125 | − * @hmm: the core HMM structure this range is active against | |
| 126 | − * @vma: the vm area struct for the range | |
| 127 | − * @list: all range lock are on a list | |
| 128 | 73 | * @start: range virtual start address (inclusive) |
| 129 | 74 | * @end: range virtual end address (exclusive) |
| 130 | 75 | * @pfns: array of pfns (big enough for the range) |
| @@ -132,8 +77,8 @@ enum hmm_pfn_value_e { · 1 unmodified line | ||
| 132 | 77 | * @values: pfn value for some special case (none, special, error, ...) |
| 133 | 78 | * @default_flags: default flags for the range (write, read, ... see hmm doc) |
| 134 | 79 | * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter |
| 135 | − * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT) | |
| 136 | − * @valid: pfns array did not change since it has been fill by an HMM function | |
| 80 | + * @pfn_shift: pfn shift value (should be <= PAGE_SHIFT) | |
| 81 | + * @dev_private_owner: owner of device private pages | |
| 137 | 82 | */ |
| 138 | 83 | struct hmm_range { |
| 139 | 84 | struct mmu_interval_notifier *notifier; |
| @@ -146,6 +91,7 @@ struct hmm_range { · 6 unmodified lines | ||
| 146 | 91 | uint64_t default_flags; |
| 147 | 92 | uint64_t pfn_flags_mask; |
| 148 | 93 | uint8_t pfn_shift; |
| 94 | + void *dev_private_owner; | |
| 149 | 95 | }; |
| 150 | 96 | |
| 151 | 97 | /* |
| @@ -171,71 +117,10 @@ static inline struct page *hmm_device_entry_to_page(const struct hmm_range *rang · 19 unmodified lines | ||
| 171 | 117 | return pfn_to_page(entry >> range->pfn_shift); |
| 172 | 118 | } |
| 173 | 119 | |
| 174 | −/* | |
| 175 | − * hmm_device_entry_to_pfn() - return pfn value store in a device entry | |
| 176 | − * @range: range use to decode device entry value | |
| 177 | − * @entry: device entry to extract pfn from | |
| 178 | − * Return: pfn value if device entry is valid, -1UL otherwise | |
| 179 | − */ | |
| 180 | −static inline unsigned long | |
| 181 | −hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn) | |
| 182 | −{ | |
| 183 | − if (pfn == range->values[HMM_PFN_NONE]) | |
| 184 | − return -1UL; | |
| 185 | − if (pfn == range->values[HMM_PFN_ERROR]) | |
| 186 | − return -1UL; | |
| 187 | − if (pfn == range->values[HMM_PFN_SPECIAL]) | |
| 188 | − return -1UL; | |
| 189 | − if (!(pfn & range->flags[HMM_PFN_VALID])) | |
| 190 | − return -1UL; | |
| 191 | − return (pfn >> range->pfn_shift); | |
| 192 | −} | |
| 193 | − | |
| 194 | −/* | |
| 195 | − * hmm_device_entry_from_page() - create a valid device entry for a page | |
| 196 | − * @range: range use to encode HMM pfn value | |
| 197 | − * @page: page for which to create the device entry | |
| 198 | − * Return: valid device entry for the page | |
| 199 | − */ | |
| 200 | −static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, | |
| 201 | − struct page *page) | |
| 202 | −{ | |
| 203 | − return (page_to_pfn(page) << range->pfn_shift) | | |
| 204 | − range->flags[HMM_PFN_VALID]; | |
| 205 | −} | |
| 206 | − | |
| 207 | −/* | |
| 208 | − * hmm_device_entry_from_pfn() - create a valid device entry value from pfn | |
| 209 | − * @range: range use to encode HMM pfn value | |
| 210 | − * @pfn: pfn value for which to create the device entry | |
| 211 | − * Return: valid device entry for the pfn | |
| 212 | − */ | |
| 213 | −static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, | |
| 214 | − unsigned long pfn) | |
| 215 | −{ | |
| 216 | − return (pfn << range->pfn_shift) | | |
| 217 | − range->flags[HMM_PFN_VALID]; | |
| 218 | −} | |
| 219 | − | |
| 220 | −/* | |
| 221 | − * Retry fault if non-blocking, drop mmap_sem and return -EAGAIN in that case. | |
| 222 | − */ | |
| 223 | −#define HMM_FAULT_ALLOW_RETRY (1 << 0) | |
| 224 | − | |
| 225 | −/* Don't fault in missing PTEs, just snapshot the current state. */ | |
| 226 | −#define HMM_FAULT_SNAPSHOT (1 << 1) | |
| 227 | − | |
| 228 | −#ifdef CONFIG_HMM_MIRROR | |
| 229 | 120 | /* |
| 230 | 121 | * Please see Documentation/vm/hmm.rst for how to use the range API. |
| 231 | 122 | */ |
| 232 | −long hmm_range_fault(struct hmm_range *range, unsigned int flags); | |
| 233 | −#else | |
| 234 | −static inline long hmm_range_fault(struct hmm_range *range, unsigned int flags) | |
| 235 | −{ | |
| 236 | − return -EOPNOTSUPP; | |
| 237 | −} | |
| 238 | −#endif | |
| 123 | +long hmm_range_fault(struct hmm_range *range); | |
| 239 | 124 | |
| 240 | 125 | /* |
| 241 | 126 | * HMM_RANGE_DEFAULT_TIMEOUT - default timeout (ms) when waiting for a range |
| @@ -46,9 +46,46 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, · 45 unmodified lines | ||
| 46 | 46 | pmd_t *old_pmd, pmd_t *new_pmd); |
| 47 | 47 | extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
| 48 | 48 | unsigned long addr, pgprot_t newprot, |
| 49 | − int prot_numa); | |
| 50 | −vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write); | |
| 51 | −vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write); | |
| 49 | + unsigned long cp_flags); | |
| 50 | +vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn, | |
| 51 | + pgprot_t pgprot, bool write); | |
| 52 | + | |
| 53 | +/** | |
| 54 | + * vmf_insert_pfn_pmd - insert a pmd size pfn | |
| 55 | + * @vmf: Structure describing the fault | |
| 56 | + * @pfn: pfn to insert | |
| 57 | + * @pgprot: page protection to use | |
| 58 | + * @write: whether it's a write fault | |
| 59 | + * | |
| 60 | + * Insert a pmd size pfn. See vmf_insert_pfn() for additional info. | |
| 61 | + * | |
| 62 | + * Return: vm_fault_t value. | |
| 63 | + */ | |
| 64 | +static inline vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, | |
| 65 | + bool write) | |
| 66 | +{ | |
| 67 | + return vmf_insert_pfn_pmd_prot(vmf, pfn, vmf->vma->vm_page_prot, write); | |
| 68 | +} | |
| 69 | +vm_fault_t vmf_insert_pfn_pud_prot(struct vm_fault *vmf, pfn_t pfn, | |
| 70 | + pgprot_t pgprot, bool write); | |
| 71 | + | |
| 72 | +/** | |
| 73 | + * vmf_insert_pfn_pud - insert a pud size pfn | |
| 74 | + * @vmf: Structure describing the fault | |
| 75 | + * @pfn: pfn to insert | |
| 76 | + * @pgprot: page protection to use | |
| 77 | + * @write: whether it's a write fault | |
| 78 | + * | |
| 79 | + * Insert a pud size pfn. See vmf_insert_pfn() for additional info. | |
| 80 | + * | |
| 81 | + * Return: vm_fault_t value. | |
| 82 | + */ | |
| 83 | +static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, | |
| 84 | + bool write) | |
| 85 | +{ | |
| 86 | + return vmf_insert_pfn_pud_prot(vmf, pfn, vmf->vma->vm_page_prot, write); | |
| 87 | +} | |
| 88 | + | |
| 52 | 89 | enum transparent_hugepage_flag { |
| 53 | 90 | TRANSPARENT_HUGEPAGE_FLAG, |
| 54 | 91 | TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, |
| @@ -87,8 +124,6 @@ extern struct kobj_attribute shmem_enabled_attr; · 32 unmodified lines | ||
| 87 | 124 | #define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT) |
| 88 | 125 | #define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1)) |
| 89 | 126 | |
| 90 | −extern bool is_vma_temporary_stack(struct vm_area_struct *vma); | |
| 91 | − | |
| 92 | 127 | extern unsigned long transparent_hugepage_flags; |
| 93 | 128 | |
| 94 | 129 | /* |
| @@ -100,7 +135,7 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) · 5 unmodified lines | ||
| 100 | 135 | if (vma->vm_flags & VM_NOHUGEPAGE) |
| 101 | 136 | return false; |
| 102 | 137 | |
| 103 | − if (is_vma_temporary_stack(vma)) | |
| 138 | + if (vma_is_temporary_stack(vma)) | |
| 104 | 139 | return false; |
| 105 | 140 | |
| 106 | 141 | if (test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)) |
| @@ -289,7 +324,11 @@ static inline struct list_head *page_deferred_list(struct page *page) · 182 unmodified lines | ||
| 289 | 324 | #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; }) |
| 290 | 325 | #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; }) |
| 291 | 326 | |
| 292 | −#define hpage_nr_pages(x) 1 | |
| 327 | +static inline int hpage_nr_pages(struct page *page) | |
| 328 | +{ | |
| 329 | + VM_BUG_ON_PAGE(PageTail(page), page); | |
| 330 | + return 1; | |
| 331 | +} | |
| 293 | 332 | |
| 294 | 333 | static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) |
| 295 | 334 | { |
| @@ -46,7 +46,52 @@ struct resv_map { · 45 unmodified lines | ||
| 46 | 46 | long adds_in_progress; |
| 47 | 47 | struct list_head region_cache; |
| 48 | 48 | long region_cache_count; |
| 49 | +#ifdef CONFIG_CGROUP_HUGETLB | |
| 50 | + /* | |
| 51 | + * On private mappings, the counter to uncharge reservations is stored | |
| 52 | + * here. If these fields are 0, then either the mapping is shared, or | |
| 53 | + * cgroup accounting is disabled for this resv_map. | |
| 54 | + */ | |
| 55 | + struct page_counter *reservation_counter; | |
| 56 | + unsigned long pages_per_hpage; | |
| 57 | + struct cgroup_subsys_state *css; | |
| 58 | +#endif | |
| 59 | +}; | |
| 60 | + | |
| 61 | +/* | |
| 62 | + * Region tracking -- allows tracking of reservations and instantiated pages | |
| 63 | + * across the pages in a mapping. | |
| 64 | + * | |
| 65 | + * The region data structures are embedded into a resv_map and protected | |
| 66 | + * by a resv_map's lock. The set of regions within the resv_map represent | |
| 67 | + * reservations for huge pages, or huge pages that have already been | |
| 68 | + * instantiated within the map. The from and to elements are huge page | |
| 69 | + * indicies into the associated mapping. from indicates the starting index | |
| 70 | + * of the region. to represents the first index past the end of the region. | |
| 71 | + * | |
| 72 | + * For example, a file region structure with from == 0 and to == 4 represents | |
| 73 | + * four huge pages in a mapping. It is important to note that the to element | |
| 74 | + * represents the first element past the end of the region. This is used in | |
| 75 | + * arithmetic as 4(to) - 0(from) = 4 huge pages in the region. | |
| 76 | + * | |
| 77 | + * Interval notation of the form [from, to) will be used to indicate that | |
| 78 | + * the endpoint from is inclusive and to is exclusive. | |
| 79 | + */ | |
| 80 | +struct file_region { | |
| 81 | + struct list_head link; | |
| 82 | + long from; | |
| 83 | + long to; | |
| 84 | +#ifdef CONFIG_CGROUP_HUGETLB | |
| 85 | + /* | |
| 86 | + * On shared mappings, each reserved region appears as a struct | |
| 87 | + * file_region in resv_map. These fields hold the info needed to | |
| 88 | + * uncharge each reservation. | |
| 89 | + */ | |
| 90 | + struct page_counter *reservation_counter; | |
| 91 | + struct cgroup_subsys_state *css; | |
| 92 | +#endif | |
| 49 | 93 | }; |
| 94 | + | |
| 50 | 95 | extern struct resv_map *resv_map_alloc(void); |
| 51 | 96 | void resv_map_release(struct kref *ref); |
| 52 | 97 | |
| @@ -109,6 +154,8 @@ u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); · 56 unmodified lines | ||
| 109 | 154 | |
| 110 | 155 | pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); |
| 111 | 156 | |
| 157 | +struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage); | |
| 158 | + | |
| 112 | 159 | extern int sysctl_hugetlb_shm_group; |
| 113 | 160 | extern struct list_head huge_boot_pages; |
| 114 | 161 | |
| @@ -151,6 +198,12 @@ static inline unsigned long hugetlb_total_pages(void) · 36 unmodified lines | ||
| 151 | 198 | return 0; |
| 152 | 199 | } |
| 153 | 200 | |
| 201 | +static inline struct address_space *hugetlb_page_mapping_lock_write( | |
| 202 | + struct page *hpage) | |
| 203 | +{ | |
| 204 | + return NULL; | |
| 205 | +} | |
| 206 | + | |
| 154 | 207 | static inline int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, |
| 155 | 208 | pte_t *ptep) |
| 156 | 209 | { |
| @@ -390,7 +443,10 @@ static inline bool is_file_hugepages(struct file *file) · 233 unmodified lines | ||
| 390 | 443 | return is_file_shm_hugepages(file); |
| 391 | 444 | } |
| 392 | 445 | |
| 393 | − | |
| 446 | +static inline struct hstate *hstate_inode(struct inode *i) | |
| 447 | +{ | |
| 448 | + return HUGETLBFS_SB(i->i_sb)->hstate; | |
| 449 | +} | |
| 394 | 450 | #else /* !CONFIG_HUGETLBFS */ |
| 395 | 451 | |
| 396 | 452 | #define is_file_hugepages(file) false |
| @@ -402,6 +458,10 @@ hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, · 5 unmodified lines | ||
| 402 | 458 | return ERR_PTR(-ENOSYS); |
| 403 | 459 | } |
| 404 | 460 | |
| 461 | +static inline struct hstate *hstate_inode(struct inode *i) | |
| 462 | +{ | |
| 463 | + return NULL; | |
| 464 | +} | |
| 405 | 465 | #endif /* !CONFIG_HUGETLBFS */ |
| 406 | 466 | |
| 407 | 467 | #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
| @@ -432,8 +492,8 @@ struct hstate { · 24 unmodified lines | ||
| 432 | 492 | unsigned int surplus_huge_pages_node[MAX_NUMNODES]; |
| 433 | 493 | #ifdef CONFIG_CGROUP_HUGETLB |
| 434 | 494 | /* cgroup control files */ |
| 435 | − struct cftype cgroup_files_dfl[5]; | |
| 436 | − struct cftype cgroup_files_legacy[5]; | |
| 495 | + struct cftype cgroup_files_dfl[7]; | |
| 496 | + struct cftype cgroup_files_legacy[9]; | |
| 437 | 497 | #endif |
| 438 | 498 | char name[HSTATE_NAME_LEN]; |
| 439 | 499 | }; |
| @@ -472,11 +532,6 @@ extern unsigned int default_hstate_idx; · 32 unmodified lines | ||
| 472 | 532 | |
| 473 | 533 | #define default_hstate (hstates[default_hstate_idx]) |
| 474 | 534 | |
| 475 | −static inline struct hstate *hstate_inode(struct inode *i) | |
| 476 | −{ | |
| 477 | − return HUGETLBFS_SB(i->i_sb)->hstate; | |
| 478 | −} | |
| 479 | − | |
| 480 | 535 | static inline struct hstate *hstate_file(struct file *f) |
| 481 | 536 | { |
| 482 | 537 | return hstate_inode(file_inode(f)); |
| @@ -729,11 +784,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) · 246 unmodified lines | ||
| 729 | 784 | return NULL; |
| 730 | 785 | } |
| 731 | 786 | |
| 732 | −static inline struct hstate *hstate_inode(struct inode *i) | |
| 733 | −{ | |
| 734 | − return NULL; | |
| 735 | −} | |
| 736 | − | |
| 737 | 787 | static inline struct hstate *page_hstate(struct page *page) |
| 738 | 788 | { |
| 739 | 789 | return NULL; |
| @@ -845,4 +895,16 @@ static inline spinlock_t *huge_pte_lock(struct hstate *h, · 105 unmodified lines | ||
| 845 | 895 | return ptl; |
| 846 | 896 | } |
| 847 | 897 | |
| 898 | +#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_CMA) | |
| 899 | +extern void __init hugetlb_cma_reserve(int order); | |
| 900 | +extern void __init hugetlb_cma_check(void); | |
| 901 | +#else | |
| 902 | +static inline __init void hugetlb_cma_reserve(int order) | |
| 903 | +{ | |
| 904 | +} | |
| 905 | +static inline __init void hugetlb_cma_check(void) | |
| 906 | +{ | |
| 907 | +} | |
| 908 | +#endif | |
| 909 | + | |
| 848 | 910 | #endif /* _LINUX_HUGETLB_H */ |
| @@ -18,34 +18,96 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/mmdebug.h> |
| 19 | 19 | |
| 20 | 20 | struct hugetlb_cgroup; |
| 21 | +struct resv_map; | |
| 22 | +struct file_region; | |
| 23 | + | |
| 21 | 24 | /* |
| 22 | 25 | * Minimum page order trackable by hugetlb cgroup. |
| 23 | − * At least 3 pages are necessary for all the tracking information. | |
| 26 | + * At least 4 pages are necessary for all the tracking information. | |
| 27 | + * The second tail page (hpage[2]) is the fault usage cgroup. | |
| 28 | + * The third tail page (hpage[3]) is the reservation usage cgroup. | |
| 24 | 29 | */ |
| 25 | 30 | #define HUGETLB_CGROUP_MIN_ORDER 2 |
| 26 | 31 | |
| 27 | 32 | #ifdef CONFIG_CGROUP_HUGETLB |
| 33 | +enum hugetlb_memory_event { | |
| 34 | + HUGETLB_MAX, | |
| 35 | + HUGETLB_NR_MEMORY_EVENTS, | |
| 36 | +}; | |
| 28 | 37 | |
| 29 | −static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page) | |
| 38 | +struct hugetlb_cgroup { | |
| 39 | + struct cgroup_subsys_state css; | |
| 40 | + | |
| 41 | + /* | |
| 42 | + * the counter to account for hugepages from hugetlb. | |
| 43 | + */ | |
| 44 | + struct page_counter hugepage[HUGE_MAX_HSTATE]; | |
| 45 | + | |
| 46 | + /* | |
| 47 | + * the counter to account for hugepage reservations from hugetlb. | |
| 48 | + */ | |
| 49 | + struct page_counter rsvd_hugepage[HUGE_MAX_HSTATE]; | |
| 50 | + | |
| 51 | + atomic_long_t events[HUGE_MAX_HSTATE][HUGETLB_NR_MEMORY_EVENTS]; | |
| 52 | + atomic_long_t events_local[HUGE_MAX_HSTATE][HUGETLB_NR_MEMORY_EVENTS]; | |
| 53 | + | |
| 54 | + /* Handle for "hugetlb.events" */ | |
| 55 | + struct cgroup_file events_file[HUGE_MAX_HSTATE]; | |
| 56 | + | |
| 57 | + /* Handle for "hugetlb.events.local" */ | |
| 58 | + struct cgroup_file events_local_file[HUGE_MAX_HSTATE]; | |
| 59 | +}; | |
| 60 | + | |
| 61 | +static inline struct hugetlb_cgroup * | |
| 62 | +__hugetlb_cgroup_from_page(struct page *page, bool rsvd) | |
| 30 | 63 | { |
| 31 | 64 | VM_BUG_ON_PAGE(!PageHuge(page), page); |
| 32 | 65 | |
| 33 | 66 | if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER) |
| 34 | 67 | return NULL; |
| 35 | − return (struct hugetlb_cgroup *)page[2].private; | |
| 68 | + if (rsvd) | |
| 69 | + return (struct hugetlb_cgroup *)page[3].private; | |
| 70 | + else | |
| 71 | + return (struct hugetlb_cgroup *)page[2].private; | |
| 72 | +} | |
| 73 | + | |
| 74 | +static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page) | |
| 75 | +{ | |
| 76 | + return __hugetlb_cgroup_from_page(page, false); | |
| 77 | +} | |
| 78 | + | |
| 79 | +static inline struct hugetlb_cgroup * | |
| 80 | +hugetlb_cgroup_from_page_rsvd(struct page *page) | |
| 81 | +{ | |
| 82 | + return __hugetlb_cgroup_from_page(page, true); | |
| 36 | 83 | } |
| 37 | 84 | |
| 38 | −static inline | |
| 39 | −int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg) | |
| 85 | +static inline int __set_hugetlb_cgroup(struct page *page, | |
| 86 | + struct hugetlb_cgroup *h_cg, bool rsvd) | |
| 40 | 87 | { |
| 41 | 88 | VM_BUG_ON_PAGE(!PageHuge(page), page); |
| 42 | 89 | |
| 43 | 90 | if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER) |
| 44 | 91 | return -1; |
| 45 | − page[2].private = (unsigned long)h_cg; | |
| 92 | + if (rsvd) | |
| 93 | + page[3].private = (unsigned long)h_cg; | |
| 94 | + else | |
| 95 | + page[2].private = (unsigned long)h_cg; | |
| 46 | 96 | return 0; |
| 47 | 97 | } |
| 48 | 98 | |
| 99 | +static inline int set_hugetlb_cgroup(struct page *page, | |
| 100 | + struct hugetlb_cgroup *h_cg) | |
| 101 | +{ | |
| 102 | + return __set_hugetlb_cgroup(page, h_cg, false); | |
| 103 | +} | |
| 104 | + | |
| 105 | +static inline int set_hugetlb_cgroup_rsvd(struct page *page, | |
| 106 | + struct hugetlb_cgroup *h_cg) | |
| 107 | +{ | |
| 108 | + return __set_hugetlb_cgroup(page, h_cg, true); | |
| 109 | +} | |
| 110 | + | |
| 49 | 111 | static inline bool hugetlb_cgroup_disabled(void) |
| 50 | 112 | { |
| 51 | 113 | return !cgroup_subsys_enabled(hugetlb_cgrp_subsys); |
| @@ -53,25 +115,67 @@ static inline bool hugetlb_cgroup_disabled(void) · 1 unmodified line | ||
| 53 | 115 | |
| 54 | 116 | extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, |
| 55 | 117 | struct hugetlb_cgroup **ptr); |
| 118 | +extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, | |
| 119 | + struct hugetlb_cgroup **ptr); | |
| 56 | 120 | extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, |
| 57 | 121 | struct hugetlb_cgroup *h_cg, |
| 58 | 122 | struct page *page); |
| 123 | +extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, | |
| 124 | + struct hugetlb_cgroup *h_cg, | |
| 125 | + struct page *page); | |
| 59 | 126 | extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, |
| 60 | 127 | struct page *page); |
| 128 | +extern void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages, | |
| 129 | + struct page *page); | |
| 130 | + | |
| 61 | 131 | extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, |
| 62 | 132 | struct hugetlb_cgroup *h_cg); |
| 133 | +extern void hugetlb_cgroup_uncharge_cgroup_rsvd(int idx, unsigned long nr_pages, | |
| 134 | + struct hugetlb_cgroup *h_cg); | |
| 135 | +extern void hugetlb_cgroup_uncharge_counter(struct resv_map *resv, | |
| 136 | + unsigned long start, | |
| 137 | + unsigned long end); | |
| 138 | + | |
| 139 | +extern void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, | |
| 140 | + struct file_region *rg, | |
| 141 | + unsigned long nr_pages); | |
| 142 | + | |
| 63 | 143 | extern void hugetlb_cgroup_file_init(void) __init; |
| 64 | 144 | extern void hugetlb_cgroup_migrate(struct page *oldhpage, |
| 65 | 145 | struct page *newhpage); |
| 66 | 146 | |
| 67 | 147 | #else |
| 148 | +static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, | |
| 149 | + struct file_region *rg, | |
| 150 | + unsigned long nr_pages) | |
| 151 | +{ | |
| 152 | +} | |
| 153 | + | |
| 68 | 154 | static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page) |
| 69 | 155 | { |
| 70 | 156 | return NULL; |
| 71 | 157 | } |
| 72 | 158 | |
| 73 | −static inline | |
| 74 | −int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg) | |
| 159 | +static inline struct hugetlb_cgroup * | |
| 160 | +hugetlb_cgroup_from_page_resv(struct page *page) | |
| 161 | +{ | |
| 162 | + return NULL; | |
| 163 | +} | |
| 164 | + | |
| 165 | +static inline struct hugetlb_cgroup * | |
| 166 | +hugetlb_cgroup_from_page_rsvd(struct page *page) | |
| 167 | +{ | |
| 168 | + return NULL; | |
| 169 | +} | |
| 170 | + | |
| 171 | +static inline int set_hugetlb_cgroup(struct page *page, | |
| 172 | + struct hugetlb_cgroup *h_cg) | |
| 173 | +{ | |
| 174 | + return 0; | |
| 175 | +} | |
| 176 | + | |
| 177 | +static inline int set_hugetlb_cgroup_rsvd(struct page *page, | |
| 178 | + struct hugetlb_cgroup *h_cg) | |
| 75 | 179 | { |
| 76 | 180 | return 0; |
| 77 | 181 | } |
| @@ -81,28 +185,57 @@ static inline bool hugetlb_cgroup_disabled(void) · 3 unmodified lines | ||
| 81 | 185 | return true; |
| 82 | 186 | } |
| 83 | 187 | |
| 84 | −static inline int | |
| 85 | −hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, | |
| 86 | − struct hugetlb_cgroup **ptr) | |
| 188 | +static inline int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, | |
| 189 | + struct hugetlb_cgroup **ptr) | |
| 87 | 190 | { |
| 88 | 191 | return 0; |
| 89 | 192 | } |
| 90 | 193 | |
| 91 | −static inline void | |
| 92 | −hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, | |
| 93 | − struct hugetlb_cgroup *h_cg, | |
| 94 | − struct page *page) | |
| 194 | +static inline int hugetlb_cgroup_charge_cgroup_rsvd(int idx, | |
| 195 | + unsigned long nr_pages, | |
| 196 | + struct hugetlb_cgroup **ptr) | |
| 197 | +{ | |
| 198 | + return 0; | |
| 199 | +} | |
| 200 | + | |
| 201 | +static inline void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, | |
| 202 | + struct hugetlb_cgroup *h_cg, | |
| 203 | + struct page *page) | |
| 95 | 204 | { |
| 96 | 205 | } |
| 97 | 206 | |
| 98 | 207 | static inline void |
| 99 | −hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, struct page *page) | |
| 208 | +hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, | |
| 209 | + struct hugetlb_cgroup *h_cg, | |
| 210 | + struct page *page) | |
| 211 | +{ | |
| 212 | +} | |
| 213 | + | |
| 214 | +static inline void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, | |
| 215 | + struct page *page) | |
| 216 | +{ | |
| 217 | +} | |
| 218 | + | |
| 219 | +static inline void hugetlb_cgroup_uncharge_page_rsvd(int idx, | |
| 220 | + unsigned long nr_pages, | |
| 221 | + struct page *page) | |
| 222 | +{ | |
| 223 | +} | |
| 224 | +static inline void hugetlb_cgroup_uncharge_cgroup(int idx, | |
| 225 | + unsigned long nr_pages, | |
| 226 | + struct hugetlb_cgroup *h_cg) | |
| 100 | 227 | { |
| 101 | 228 | } |
| 102 | 229 | |
| 103 | 230 | static inline void |
| 104 | −hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, | |
| 105 | − struct hugetlb_cgroup *h_cg) | |
| 231 | +hugetlb_cgroup_uncharge_cgroup_rsvd(int idx, unsigned long nr_pages, | |
| 232 | + struct hugetlb_cgroup *h_cg) | |
| 233 | +{ | |
| 234 | +} | |
| 235 | + | |
| 236 | +static inline void hugetlb_cgroup_uncharge_counter(struct resv_map *resv, | |
| 237 | + unsigned long start, | |
| 238 | + unsigned long end) | |
| 106 | 239 | { |
| 107 | 240 | } |
| 108 | 241 | |
| @@ -15,24 +15,19 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client |
| 18 | − * @alert_edge_triggered: whether the alert interrupt is edge (1) or level (0) | |
| 19 | − * triggered | |
| 20 | 18 | * @irq: IRQ number, if the smbus_alert driver should take care of interrupt |
| 21 | 19 | * handling |
| 22 | 20 | * |
| 23 | 21 | * If irq is not specified, the smbus_alert driver doesn't take care of |
| 24 | 22 | * interrupt handling. In that case it is up to the I2C bus driver to either |
| 25 | 23 | * handle the interrupts or to poll for alerts. |
| 26 | − * | |
| 27 | − * If irq is specified then it it crucial that alert_edge_triggered is | |
| 28 | − * properly set. | |
| 29 | 24 | */ |
| 30 | 25 | struct i2c_smbus_alert_setup { |
| 31 | 26 | int irq; |
| 32 | 27 | }; |
| 33 | 28 | |
| 34 | −struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter, | |
| 35 | − struct i2c_smbus_alert_setup *setup); | |
| 29 | +struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter, | |
| 30 | + struct i2c_smbus_alert_setup *setup); | |
| 36 | 31 | int i2c_handle_smbus_alert(struct i2c_client *ara); |
| 37 | 32 | |
| 38 | 33 | #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF) |
| @@ -39,6 +39,14 @@ enum i2c_slave_event; · 38 unmodified lines | ||
| 39 | 39 | typedef int (*i2c_slave_cb_t)(struct i2c_client *client, |
| 40 | 40 | enum i2c_slave_event event, u8 *val); |
| 41 | 41 | |
| 42 | +/* I2C Frequency Modes */ | |
| 43 | +#define I2C_MAX_STANDARD_MODE_FREQ 100000 | |
| 44 | +#define I2C_MAX_FAST_MODE_FREQ 400000 | |
| 45 | +#define I2C_MAX_FAST_MODE_PLUS_FREQ 1000000 | |
| 46 | +#define I2C_MAX_TURBO_MODE_FREQ 1400000 | |
| 47 | +#define I2C_MAX_HIGH_SPEED_MODE_FREQ 3400000 | |
| 48 | +#define I2C_MAX_ULTRA_FAST_MODE_FREQ 5000000 | |
| 49 | + | |
| 42 | 50 | struct module; |
| 43 | 51 | struct property_entry; |
| 44 | 52 | |
| @@ -506,7 +514,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, · 461 unmodified lines | ||
| 506 | 514 | * @smbus_xfer_atomic: same as @smbus_xfer. Yet, only using atomic context |
| 507 | 515 | * so e.g. PMICs can be accessed very late before shutdown. Optional. |
| 508 | 516 | * @functionality: Return the flags that this algorithm/adapter pair supports |
| 509 | − * from the I2C_FUNC_* flags. | |
| 517 | + * from the ``I2C_FUNC_*`` flags. | |
| 510 | 518 | * @reg_slave: Register given client to I2C slave mode of this adapter |
| 511 | 519 | * @unreg_slave: Unregister given client from I2C slave mode of this adapter |
| 512 | 520 | * |
| @@ -515,7 +523,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, · 2 unmodified lines | ||
| 515 | 523 | * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584 |
| 516 | 524 | * to name two of the most common. |
| 517 | 525 | * |
| 518 | − * The return codes from the @master_xfer{_atomic} fields should indicate the | |
| 526 | + * The return codes from the ``master_xfer{_atomic}`` fields should indicate the | |
| 519 | 527 | * type of error code that occurred during the transfer, as documented in the |
| 520 | 528 | * Kernel Documentation file Documentation/i2c/fault-codes.rst. |
| 521 | 529 | */ |
| @@ -619,6 +619,15 @@ static inline bool ieee80211_is_qos_nullfunc(__le16 fc) · 618 unmodified lines | ||
| 619 | 619 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | +/** | |
| 623 | + * ieee80211_is_any_nullfunc - check if frame is regular or QoS nullfunc frame | |
| 624 | + * @fc: frame control bytes in little-endian byteorder | |
| 625 | + */ | |
| 626 | +static inline bool ieee80211_is_any_nullfunc(__le16 fc) | |
| 627 | +{ | |
| 628 | + return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)); | |
| 629 | +} | |
| 630 | + | |
| 622 | 631 | /** |
| 623 | 632 | * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU |
| 624 | 633 | * @fc: frame control field in little-endian byteorder |
| @@ -2047,13 +2056,13 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) · 1422 unmodified lines | ||
| 2047 | 2056 | #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000 |
| 2048 | 2057 | #define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000 |
| 2049 | 2058 | #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000 |
| 2050 | −#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24 | |
| 2059 | +#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24 | |
| 2051 | 2060 | #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000 |
| 2052 | 2061 | #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x80000000 |
| 2053 | 2062 | |
| 2054 | 2063 | /* |
| 2055 | 2064 | * ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size |
| 2056 | − * @he_oper_ie: byte data of the He Operations IE, stating from the the byte | |
| 2065 | + * @he_oper_ie: byte data of the He Operations IE, stating from the byte | |
| 2057 | 2066 | * after the ext ID byte. It is assumed that he_oper_ie has at least |
| 2058 | 2067 | * sizeof(struct ieee80211_he_operation) bytes, the caller must have |
| 2059 | 2068 | * validated this. |
| @@ -2091,7 +2100,7 @@ ieee80211_he_oper_size(const u8 *he_oper_ie) · 31 unmodified lines | ||
| 2091 | 2100 | |
| 2092 | 2101 | /* |
| 2093 | 2102 | * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size |
| 2094 | − * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the the byte | |
| 2103 | + * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the byte | |
| 2095 | 2104 | * after the ext ID byte. It is assumed that he_spr_ie has at least |
| 2096 | 2105 | * sizeof(struct ieee80211_he_spr) bytes, the caller must have validated |
| 2097 | 2106 | * this |
| @@ -2102,14 +2111,14 @@ ieee80211_he_spr_size(const u8 *he_spr_ie) · 4 unmodified lines | ||
| 2102 | 2111 | { |
| 2103 | 2112 | struct ieee80211_he_spr *he_spr = (void *)he_spr_ie; |
| 2104 | 2113 | u8 spr_len = sizeof(struct ieee80211_he_spr); |
| 2105 | − u32 he_spr_params; | |
| 2114 | + u8 he_spr_params; | |
| 2106 | 2115 | |
| 2107 | 2116 | /* Make sure the input is not NULL */ |
| 2108 | 2117 | if (!he_spr_ie) |
| 2109 | 2118 | return 0; |
| 2110 | 2119 | |
| 2111 | 2120 | /* Calc required length */ |
| 2112 | − he_spr_params = le32_to_cpu(he_spr->he_sr_control); | |
| 2121 | + he_spr_params = he_spr->he_sr_control; | |
| 2113 | 2122 | if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) |
| 2114 | 2123 | spr_len++; |
| 2115 | 2124 | if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) |
| @@ -2523,6 +2532,7 @@ enum ieee80211_eid { · 407 unmodified lines | ||
| 2523 | 2532 | WLAN_EID_FILS_INDICATION = 240, |
| 2524 | 2533 | WLAN_EID_DILS = 241, |
| 2525 | 2534 | WLAN_EID_FRAGMENT = 242, |
| 2535 | + WLAN_EID_RSNX = 244, | |
| 2526 | 2536 | WLAN_EID_EXTENSION = 255 |
| 2527 | 2537 | }; |
| 2528 | 2538 | |
| @@ -2734,7 +2744,7 @@ enum ieee80211_tdls_actioncode { · 205 unmodified lines | ||
| 2734 | 2744 | */ |
| 2735 | 2745 | #define WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT BIT(6) |
| 2736 | 2746 | |
| 2737 | −/* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */ | |
| 2747 | +/* TDLS capabilities in the 4th byte of @WLAN_EID_EXT_CAPABILITY */ | |
| 2738 | 2748 | #define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4) |
| 2739 | 2749 | #define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5) |
| 2740 | 2750 | #define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6) |
| @@ -3034,6 +3044,7 @@ struct ieee80211_multiple_bssid_configuration { · 293 unmodified lines | ||
| 3034 | 3044 | #define WLAN_AKM_SUITE_FILS_SHA384 SUITE(0x000FAC, 15) |
| 3035 | 3045 | #define WLAN_AKM_SUITE_FT_FILS_SHA256 SUITE(0x000FAC, 16) |
| 3036 | 3046 | #define WLAN_AKM_SUITE_FT_FILS_SHA384 SUITE(0x000FAC, 17) |
| 3047 | +#define WLAN_AKM_SUITE_OWE SUITE(0x000FAC, 18) | |
| 3037 | 3048 | |
| 3038 | 3049 | #define WLAN_MAX_KEY_LEN 32 |
| 3039 | 3050 | |
| @@ -3412,4 +3423,11 @@ static inline bool for_each_element_completed(const struct element *element, · 372 unmodified lines | ||
| 3412 | 3423 | return (const u8 *)element == (const u8 *)data + datalen; |
| 3413 | 3424 | } |
| 3414 | 3425 | |
| 3426 | +/** | |
| 3427 | + * RSNX Capabilities: | |
| 3428 | + * bits 0-3: Field length (n-1) | |
| 3429 | + */ | |
| 3430 | +#define WLAN_RSNX_CAPA_PROTECTED_TWT BIT(4) | |
| 3431 | +#define WLAN_RSNX_CAPA_SAE_H2E BIT(5) | |
| 3432 | + | |
| 3415 | 3433 | #endif /* LINUX_IEEE80211_H */ |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/irqreturn.h> |
| 13 | 13 | #include <linux/platform_data/cros_ec_commands.h> |
| 14 | 14 | #include <linux/platform_data/cros_ec_proto.h> |
| 15 | +#include <linux/platform_data/cros_ec_sensorhub.h> | |
| 15 | 16 | |
| 16 | 17 | enum { |
| 17 | 18 | CROS_EC_SENSOR_X, |
| @@ -29,8 +30,7 @@ enum { · 11 unmodified lines | ||
| 29 | 30 | */ |
| 30 | 31 | #define CROS_EC_SAMPLE_SIZE (sizeof(s64) * 2) |
| 31 | 32 | |
| 32 | −/* Minimum sampling period to use when device is suspending */ | |
| 33 | −#define CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY 1000 /* 1 second */ | |
| 33 | +typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p); | |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver |
| @@ -50,7 +50,9 @@ enum { · 13 unmodified lines | ||
| 50 | 50 | * the timestamp. The timestamp is always last and |
| 51 | 51 | * is always 8-byte aligned. |
| 52 | 52 | * @read_ec_sensors_data: function used for accessing sensors values |
| 53 | − * @cuur_sampl_freq: current sampling period | |
| 53 | + * @fifo_max_event_count: Size of the EC sensor FIFO | |
| 54 | + * @frequencies: Table of known available frequencies: | |
| 55 | + * 0, Min and Max in mHz | |
| 54 | 56 | */ |
| 55 | 57 | struct cros_ec_sensors_core_state { |
| 56 | 58 | struct cros_ec_device *ec; |
| @@ -73,101 +75,34 @@ struct cros_ec_sensors_core_state { · 16 unmodified lines | ||
| 73 | 75 | int (*read_ec_sensors_data)(struct iio_dev *indio_dev, |
| 74 | 76 | unsigned long scan_mask, s16 *data); |
| 75 | 77 | |
| 76 | − int curr_sampl_freq; | |
| 77 | − | |
| 78 | − /* Table of known available frequencies : 0, Min and Max in mHz */ | |
| 79 | − int frequencies[3]; | |
| 78 | + u32 fifo_max_event_count; | |
| 79 | + int frequencies[6]; | |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | −/** | |
| 83 | − * cros_ec_sensors_read_lpc() - retrieve data from EC shared memory | |
| 84 | − * @indio_dev: pointer to IIO device | |
| 85 | − * @scan_mask: bitmap of the sensor indices to scan | |
| 86 | − * @data: location to store data | |
| 87 | − * | |
| 88 | − * This is the safe function for reading the EC data. It guarantees that the | |
| 89 | − * data sampled was not modified by the EC while being read. | |
| 90 | − * | |
| 91 | − * Return: 0 on success, -errno on failure. | |
| 92 | − */ | |
| 93 | 82 | int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev, unsigned long scan_mask, |
| 94 | 83 | s16 *data); |
| 95 | 84 | |
| 96 | −/** | |
| 97 | − * cros_ec_sensors_read_cmd() - retrieve data using the EC command protocol | |
| 98 | − * @indio_dev: pointer to IIO device | |
| 99 | − * @scan_mask: bitmap of the sensor indices to scan | |
| 100 | − * @data: location to store data | |
| 101 | − * | |
| 102 | − * Return: 0 on success, -errno on failure. | |
| 103 | − */ | |
| 104 | 85 | int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask, |
| 105 | 86 | s16 *data); |
| 106 | 87 | |
| 107 | 88 | struct platform_device; |
| 108 | −/** | |
| 109 | − * cros_ec_sensors_core_init() - basic initialization of the core structure | |
| 110 | − * @pdev: platform device created for the sensors | |
| 111 | − * @indio_dev: iio device structure of the device | |
| 112 | − * @physical_device: true if the device refers to a physical device | |
| 113 | − * | |
| 114 | − * Return: 0 on success, -errno on failure. | |
| 115 | − */ | |
| 116 | 89 | int cros_ec_sensors_core_init(struct platform_device *pdev, |
| 117 | − struct iio_dev *indio_dev, bool physical_device); | |
| 90 | + struct iio_dev *indio_dev, bool physical_device, | |
| 91 | + cros_ec_sensors_capture_t trigger_capture, | |
| 92 | + cros_ec_sensorhub_push_data_cb_t push_data); | |
| 118 | 93 | |
| 119 | −/** | |
| 120 | − * cros_ec_sensors_capture() - the trigger handler function | |
| 121 | − * @irq: the interrupt number. | |
| 122 | − * @p: a pointer to the poll function. | |
| 123 | − * | |
| 124 | − * On a trigger event occurring, if the pollfunc is attached then this | |
| 125 | − * handler is called as a threaded interrupt (and hence may sleep). It | |
| 126 | − * is responsible for grabbing data from the device and pushing it into | |
| 127 | − * the associated buffer. | |
| 128 | − * | |
| 129 | − * Return: IRQ_HANDLED | |
| 130 | − */ | |
| 131 | 94 | irqreturn_t cros_ec_sensors_capture(int irq, void *p); |
| 95 | +int cros_ec_sensors_push_data(struct iio_dev *indio_dev, | |
| 96 | + s16 *data, | |
| 97 | + s64 timestamp); | |
| 132 | 98 | |
| 133 | −/** | |
| 134 | − * cros_ec_motion_send_host_cmd() - send motion sense host command | |
| 135 | − * @st: pointer to state information for device | |
| 136 | − * @opt_length: optional length to reduce the response size, useful on the data | |
| 137 | − * path. Otherwise, the maximal allowed response size is used | |
| 138 | − * | |
| 139 | − * When called, the sub-command is assumed to be set in param->cmd. | |
| 140 | − * | |
| 141 | − * Return: 0 on success, -errno on failure. | |
| 142 | − */ | |
| 143 | 99 | int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st, |
| 144 | 100 | u16 opt_length); |
| 145 | 101 | |
| 146 | −/** | |
| 147 | − * cros_ec_sensors_core_read() - function to request a value from the sensor | |
| 148 | − * @st: pointer to state information for device | |
| 149 | − * @chan: channel specification structure table | |
| 150 | − * @val: will contain one element making up the returned value | |
| 151 | − * @val2: will contain another element making up the returned value | |
| 152 | − * @mask: specifies which values to be requested | |
| 153 | − * | |
| 154 | − * Return: the type of value returned by the device | |
| 155 | − */ | |
| 156 | 102 | int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st, |
| 157 | 103 | struct iio_chan_spec const *chan, |
| 158 | 104 | int *val, int *val2, long mask); |
| 159 | 105 | |
| 160 | −/** | |
| 161 | − * cros_ec_sensors_core_read_avail() - get available values | |
| 162 | − * @indio_dev: pointer to state information for device | |
| 163 | − * @chan: channel specification structure table | |
| 164 | − * @vals: list of available values | |
| 165 | − * @type: type of data returned | |
| 166 | − * @length: number of data returned in the array | |
| 167 | − * @mask: specifies which values to be requested | |
| 168 | − * | |
| 169 | − * Return: an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST | |
| 170 | − */ | |
| 171 | 106 | int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, |
| 172 | 107 | struct iio_chan_spec const *chan, |
| 173 | 108 | const int **vals, |
| @@ -175,23 +110,12 @@ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, · 1 unmodified line | ||
| 175 | 110 | int *length, |
| 176 | 111 | long mask); |
| 177 | 112 | |
| 178 | −/** | |
| 179 | − * cros_ec_sensors_core_write() - function to write a value to the sensor | |
| 180 | − * @st: pointer to state information for device | |
| 181 | − * @chan: channel specification structure table | |
| 182 | − * @val: first part of value to write | |
| 183 | − * @val2: second part of value to write | |
| 184 | − * @mask: specifies which values to write | |
| 185 | − * | |
| 186 | − * Return: the type of value returned by the device | |
| 187 | − */ | |
| 188 | 113 | int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, |
| 189 | 114 | struct iio_chan_spec const *chan, |
| 190 | 115 | int val, int val2, long mask); |
| 191 | 116 | |
| 192 | −extern const struct dev_pm_ops cros_ec_sensors_pm_ops; | |
| 193 | − | |
| 194 | 117 | /* List of extended channel specification for all sensors */ |
| 195 | 118 | extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[]; |
| 119 | +extern const struct attribute *cros_ec_sensor_fifo_attributes[]; | |
| 196 | 120 | |
| 197 | 121 | #endif /* __CROS_EC_SENSORS_CORE_H */ |
| @@ -568,6 +568,8 @@ struct iio_dev { · 567 unmodified lines | ||
| 568 | 568 | #if defined(CONFIG_DEBUG_FS) |
| 569 | 569 | struct dentry *debugfs_dentry; |
| 570 | 570 | unsigned cached_reg_addr; |
| 571 | + char read_buf[20]; | |
| 572 | + unsigned int read_buf_len; | |
| 571 | 573 | #endif |
| 572 | 574 | }; |
| 573 | 575 | |
| @@ -627,6 +629,8 @@ static inline clockid_t iio_device_get_clock(const struct iio_dev *indio_dev) · 53 unmodified lines | ||
| 627 | 629 | return indio_dev->clock_id; |
| 628 | 630 | } |
| 629 | 631 | |
| 632 | +int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id); | |
| 633 | + | |
| 630 | 634 | /** |
| 631 | 635 | * dev_to_iio_dev() - Get IIO device struct from a device struct |
| 632 | 636 | * @dev: The device embedded in the IIO device |
| @@ -41,9 +41,16 @@ struct adis_timeout { · 40 unmodified lines | ||
| 41 | 41 | * @glob_cmd_reg: Register address of the GLOB_CMD register |
| 42 | 42 | * @msc_ctrl_reg: Register address of the MSC_CTRL register |
| 43 | 43 | * @diag_stat_reg: Register address of the DIAG_STAT register |
| 44 | + * @prod_id_reg: Register address of the PROD_ID register | |
| 45 | + * @prod_id: Product ID code that should be expected when reading @prod_id_reg | |
| 46 | + * @self_test_mask: Bitmask of supported self-test operations | |
| 47 | + * @self_test_reg: Register address to request self test command | |
| 48 | + * @self_test_no_autoclear: True if device's self-test needs clear of ctrl reg | |
| 44 | 49 | * @status_error_msgs: Array of error messgaes |
| 45 | − * @status_error_mask: | |
| 50 | + * @status_error_mask: Bitmask of errors supported by the device | |
| 46 | 51 | * @timeouts: Chip specific delays |
| 52 | + * @enable_irq: Hook for ADIS devices that have a special IRQ enable/disable | |
| 53 | + * @has_paging: True if ADIS device has paged registers | |
| 47 | 54 | */ |
| 48 | 55 | struct adis_data { |
| 49 | 56 | unsigned int read_delay; |
| @@ -53,8 +60,12 @@ struct adis_data { · 3 unmodified lines | ||
| 53 | 60 | unsigned int glob_cmd_reg; |
| 54 | 61 | unsigned int msc_ctrl_reg; |
| 55 | 62 | unsigned int diag_stat_reg; |
| 63 | + unsigned int prod_id_reg; | |
| 64 | + | |
| 65 | + unsigned int prod_id; | |
| 56 | 66 | |
| 57 | 67 | unsigned int self_test_mask; |
| 68 | + unsigned int self_test_reg; | |
| 58 | 69 | bool self_test_no_autoclear; |
| 59 | 70 | const struct adis_timeout *timeouts; |
| 60 | 71 | |
| @@ -66,6 +77,20 @@ struct adis_data { · 5 unmodified lines | ||
| 66 | 77 | bool has_paging; |
| 67 | 78 | }; |
| 68 | 79 | |
| 80 | +/** | |
| 81 | + * struct adis - ADIS device instance data | |
| 82 | + * @spi: Reference to SPI device which owns this ADIS IIO device | |
| 83 | + * @trig: IIO trigger object data | |
| 84 | + * @data: ADIS chip variant specific data | |
| 85 | + * @burst: ADIS burst transfer information | |
| 86 | + * @state_lock: Lock used by the device to protect state | |
| 87 | + * @msg: SPI message object | |
| 88 | + * @xfer: SPI transfer objects to be used for a @msg | |
| 89 | + * @current_page: Some ADIS devices have registers, this selects current page | |
| 90 | + * @buffer: Data buffer for information read from the device | |
| 91 | + * @tx: DMA safe TX buffer for SPI transfers | |
| 92 | + * @rx: DMA safe RX buffer for SPI transfers | |
| 93 | + */ | |
| 69 | 94 | struct adis { |
| 70 | 95 | struct spi_device *spi; |
| 71 | 96 | struct iio_trigger *trig; |
| @@ -73,6 +98,17 @@ struct adis { · 1 unmodified line | ||
| 73 | 98 | const struct adis_data *data; |
| 74 | 99 | struct adis_burst *burst; |
| 75 | 100 | |
| 101 | + /** | |
| 102 | + * The state_lock is meant to be used during operations that require | |
| 103 | + * a sequence of SPI R/W in order to protect the SPI transfer | |
| 104 | + * information (fields 'xfer', 'msg' & 'current_page') between | |
| 105 | + * potential concurrent accesses. | |
| 106 | + * This lock is used by all "adis_{functions}" that have to read/write | |
| 107 | + * registers. These functions also have unlocked variants | |
| 108 | + * (see "__adis_{functions}"), which don't hold this lock. | |
| 109 | + * This allows users of the ADIS library to group SPI R/W into | |
| 110 | + * the drivers, but they also must manage this lock themselves. | |
| 111 | + */ | |
| 76 | 112 | struct mutex state_lock; |
| 77 | 113 | struct spi_message msg; |
| 78 | 114 | struct spi_transfer *xfer; |
| @@ -297,6 +333,7 @@ static inline int adis_read_reg_32(struct adis *adis, unsigned int reg, · 218 unmodified lines | ||
| 297 | 333 | |
| 298 | 334 | int adis_enable_irq(struct adis *adis, bool enable); |
| 299 | 335 | int __adis_check_status(struct adis *adis); |
| 336 | +int __adis_initial_startup(struct adis *adis); | |
| 300 | 337 | |
| 301 | 338 | static inline int adis_check_status(struct adis *adis) |
| 302 | 339 | { |
| @@ -309,7 +346,17 @@ static inline int adis_check_status(struct adis *adis) · 6 unmodified lines | ||
| 309 | 346 | return ret; |
| 310 | 347 | } |
| 311 | 348 | |
| 312 | −int adis_initial_startup(struct adis *adis); | |
| 349 | +/* locked version of __adis_initial_startup() */ | |
| 350 | +static inline int adis_initial_startup(struct adis *adis) | |
| 351 | +{ | |
| 352 | + int ret; | |
| 353 | + | |
| 354 | + mutex_lock(&adis->state_lock); | |
| 355 | + ret = __adis_initial_startup(adis); | |
| 356 | + mutex_unlock(&adis->state_lock); | |
| 357 | + | |
| 358 | + return ret; | |
| 359 | +} | |
| 313 | 360 | |
| 314 | 361 | int adis_single_conversion(struct iio_dev *indio_dev, |
| 315 | 362 | const struct iio_chan_spec *chan, unsigned int error_mask, |
| @@ -30,8 +30,7 @@ extern void ima_kexec_cmdline(const void *buf, int size); · 29 unmodified lines | ||
| 30 | 30 | extern void ima_add_kexec_buffer(struct kimage *image); |
| 31 | 31 | #endif |
| 32 | 32 | |
| 33 | −#if (defined(CONFIG_X86) && defined(CONFIG_EFI)) || defined(CONFIG_S390) \ | |
| 34 | − || defined(CONFIG_PPC_SECURE_BOOT) | |
| 33 | +#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT | |
| 35 | 34 | extern bool arch_ima_get_secureboot(void); |
| 36 | 35 | extern const char * const *arch_get_ima_policy(void); |
| 37 | 36 | #else |
| @@ -2,24 +2,17 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _INET_DIAG_H_ |
| 3 | 3 | #define _INET_DIAG_H_ 1 |
| 4 | 4 | |
| 5 | +#include <net/netlink.h> | |
| 5 | 6 | #include <uapi/linux/inet_diag.h> |
| 6 | 7 | |
| 7 | −struct net; | |
| 8 | −struct sock; | |
| 9 | 8 | struct inet_hashinfo; |
| 10 | −struct nlattr; | |
| 11 | −struct nlmsghdr; | |
| 12 | −struct sk_buff; | |
| 13 | −struct netlink_callback; | |
| 14 | 9 | |
| 15 | 10 | struct inet_diag_handler { |
| 16 | 11 | void (*dump)(struct sk_buff *skb, |
| 17 | 12 | struct netlink_callback *cb, |
| 18 | − const struct inet_diag_req_v2 *r, | |
| 19 | − struct nlattr *bc); | |
| 13 | + const struct inet_diag_req_v2 *r); | |
| 20 | 14 | |
| 21 | − int (*dump_one)(struct sk_buff *in_skb, | |
| 22 | − const struct nlmsghdr *nlh, | |
| 15 | + int (*dump_one)(struct netlink_callback *cb, | |
| 23 | 16 | const struct inet_diag_req_v2 *req); |
| 24 | 17 | |
| 25 | 18 | void (*idiag_get_info)(struct sock *sk, |
| @@ -40,18 +33,25 @@ struct inet_diag_handler { · 14 unmodified lines | ||
| 40 | 33 | __u16 idiag_info_size; |
| 41 | 34 | }; |
| 42 | 35 | |
| 36 | +struct bpf_sk_storage_diag; | |
| 37 | +struct inet_diag_dump_data { | |
| 38 | + struct nlattr *req_nlas[__INET_DIAG_REQ_MAX]; | |
| 39 | +#define inet_diag_nla_bc req_nlas[INET_DIAG_REQ_BYTECODE] | |
| 40 | +#define inet_diag_nla_bpf_stgs req_nlas[INET_DIAG_REQ_SK_BPF_STORAGES] | |
| 41 | + | |
| 42 | + struct bpf_sk_storage_diag *bpf_stg_diag; | |
| 43 | +}; | |
| 44 | + | |
| 43 | 45 | struct inet_connection_sock; |
| 44 | 46 | int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, |
| 45 | − struct sk_buff *skb, const struct inet_diag_req_v2 *req, | |
| 46 | − struct user_namespace *user_ns, | |
| 47 | − u32 pid, u32 seq, u16 nlmsg_flags, | |
| 48 | − const struct nlmsghdr *unlh, bool net_admin); | |
| 47 | + struct sk_buff *skb, struct netlink_callback *cb, | |
| 48 | + const struct inet_diag_req_v2 *req, | |
| 49 | + u16 nlmsg_flags, bool net_admin); | |
| 49 | 50 | void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, |
| 50 | 51 | struct netlink_callback *cb, |
| 51 | − const struct inet_diag_req_v2 *r, | |
| 52 | − struct nlattr *bc); | |
| 52 | + const struct inet_diag_req_v2 *r); | |
| 53 | 53 | int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, |
| 54 | − struct sk_buff *in_skb, const struct nlmsghdr *nlh, | |
| 54 | + struct netlink_callback *cb, | |
| 55 | 55 | const struct inet_diag_req_v2 *req); |
| 56 | 56 | |
| 57 | 57 | struct sock *inet_diag_find_one_icsk(struct net *net, |
| @@ -62,6 +62,17 @@ int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); · 4 unmodified lines | ||
| 62 | 62 | |
| 63 | 63 | void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk); |
| 64 | 64 | |
| 65 | +static inline size_t inet_diag_msg_attrs_size(void) | |
| 66 | +{ | |
| 67 | + return nla_total_size(1) /* INET_DIAG_SHUTDOWN */ | |
| 68 | + + nla_total_size(1) /* INET_DIAG_TOS */ | |
| 69 | +#if IS_ENABLED(CONFIG_IPV6) | |
| 70 | + + nla_total_size(1) /* INET_DIAG_TCLASS */ | |
| 71 | + + nla_total_size(1) /* INET_DIAG_SKV6ONLY */ | |
| 72 | +#endif | |
| 73 | + + nla_total_size(4) /* INET_DIAG_MARK */ | |
| 74 | + + nla_total_size(4); /* INET_DIAG_CLASS_ID */ | |
| 75 | +} | |
| 65 | 76 | int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb, |
| 66 | 77 | struct inet_diag_msg *r, int ext, |
| 67 | 78 | struct user_namespace *user_ns, bool net_admin); |
| @@ -123,6 +123,8 @@ · 122 unmodified lines | ||
| 123 | 123 | |
| 124 | 124 | #define dmar_readq(a) readq(a) |
| 125 | 125 | #define dmar_writeq(a,v) writeq(v,a) |
| 126 | +#define dmar_readl(a) readl(a) | |
| 127 | +#define dmar_writel(a, v) writel(v, a) | |
| 126 | 128 | |
| 127 | 129 | #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4) |
| 128 | 130 | #define DMAR_VER_MINOR(v) ((v) & 0x0f) |
| @@ -248,6 +248,8 @@ extern void enable_percpu_nmi(unsigned int irq, unsigned int type); · 247 unmodified lines | ||
| 248 | 248 | extern int prepare_percpu_nmi(unsigned int irq); |
| 249 | 249 | extern void teardown_percpu_nmi(unsigned int irq); |
| 250 | 250 | |
| 251 | +extern int irq_inject_interrupt(unsigned int irq); | |
| 252 | + | |
| 251 | 253 | /* The following three functions are for the core kernel use only. */ |
| 252 | 254 | extern void suspend_device_irqs(void); |
| 253 | 255 | extern void resume_device_irqs(void); |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | * The io_mapping mechanism provides an abstraction for mapping |
| 17 | 17 | * individual pages from an io device to the CPU in an efficient fashion. |
| 18 | 18 | * |
| 19 | − * See Documentation/io-mapping.txt | |
| 19 | + * See Documentation/driver-api/io-mapping.rst | |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | struct io_mapping { |
| @@ -77,8 +77,6 @@ void *devm_memremap(struct device *dev, resource_size_t offset, · 76 unmodified lines | ||
| 77 | 77 | size_t size, unsigned long flags); |
| 78 | 78 | void devm_memunmap(struct device *dev, void *addr); |
| 79 | 79 | |
| 80 | −void *__devm_memremap_pages(struct device *dev, struct resource *res); | |
| 81 | − | |
| 82 | 80 | #ifdef CONFIG_PCI |
| 83 | 81 | /* |
| 84 | 82 | * The PCI specifications (Rev 3.0, 3.2.5 "Transaction Ordering and |
| @@ -1,93 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * This file is subject to the terms and conditions of the GNU General Public | |
| 3 | − * License. See the file "COPYING" in the main directory of this archive | |
| 4 | − * for more details. | |
| 5 | − * | |
| 6 | − * Copyright (c) 2005 Stanislaw Skowronek <skylark@linux-mips.org> | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#ifndef _LINUX_IOC3_H | |
| 10 | −#define _LINUX_IOC3_H | |
| 11 | − | |
| 12 | −#include <asm/sn/ioc3.h> | |
| 13 | − | |
| 14 | −#define IOC3_MAX_SUBMODULES 32 | |
| 15 | − | |
| 16 | −#define IOC3_CLASS_NONE 0 | |
| 17 | −#define IOC3_CLASS_BASE_IP27 1 | |
| 18 | −#define IOC3_CLASS_BASE_IP30 2 | |
| 19 | −#define IOC3_CLASS_MENET_123 3 | |
| 20 | −#define IOC3_CLASS_MENET_4 4 | |
| 21 | −#define IOC3_CLASS_CADDUO 5 | |
| 22 | −#define IOC3_CLASS_SERIAL 6 | |
| 23 | − | |
| 24 | −/* One of these per IOC3 */ | |
| 25 | −struct ioc3_driver_data { | |
| 26 | − struct list_head list; | |
| 27 | − int id; /* IOC3 sequence number */ | |
| 28 | − /* PCI mapping */ | |
| 29 | − unsigned long pma; /* physical address */ | |
| 30 | − struct ioc3 __iomem *vma; /* pointer to registers */ | |
| 31 | − struct pci_dev *pdev; /* PCI device */ | |
| 32 | − /* IRQ stuff */ | |
| 33 | − int dual_irq; /* set if separate IRQs are used */ | |
| 34 | − int irq_io, irq_eth; /* IRQ numbers */ | |
| 35 | − /* GPIO magic */ | |
| 36 | − spinlock_t gpio_lock; | |
| 37 | − unsigned int gpdr_shadow; | |
| 38 | − /* NIC identifiers */ | |
| 39 | − char nic_part[32]; | |
| 40 | − char nic_serial[16]; | |
| 41 | − char nic_mac[6]; | |
| 42 | − /* submodule set */ | |
| 43 | − int class; | |
| 44 | − void *data[IOC3_MAX_SUBMODULES]; /* for submodule use */ | |
| 45 | − int active[IOC3_MAX_SUBMODULES]; /* set if probe succeeds */ | |
| 46 | − /* is_ir_lock must be held while | |
| 47 | − * modifying sio_ie values, so | |
| 48 | − * we can be sure that sio_ie is | |
| 49 | − * not changing when we read it | |
| 50 | − * along with sio_ir. | |
| 51 | − */ | |
| 52 | − spinlock_t ir_lock; /* SIO_IE[SC] mod lock */ | |
| 53 | −}; | |
| 54 | − | |
| 55 | −/* One per submodule */ | |
| 56 | −struct ioc3_submodule { | |
| 57 | − char *name; /* descriptive submodule name */ | |
| 58 | − struct module *owner; /* owning kernel module */ | |
| 59 | − int ethernet; /* set for ethernet drivers */ | |
| 60 | − int (*probe) (struct ioc3_submodule *, struct ioc3_driver_data *); | |
| 61 | − int (*remove) (struct ioc3_submodule *, struct ioc3_driver_data *); | |
| 62 | − int id; /* assigned by IOC3, index for the "data" array */ | |
| 63 | − /* IRQ stuff */ | |
| 64 | − unsigned int irq_mask; /* IOC3 IRQ mask, leave clear for Ethernet */ | |
| 65 | − int reset_mask; /* non-zero if you want the ioc3.c module to reset interrupts */ | |
| 66 | − int (*intr) (struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int); | |
| 67 | − /* private submodule data */ | |
| 68 | − void *data; /* assigned by submodule */ | |
| 69 | −}; | |
| 70 | − | |
| 71 | −/********************************** | |
| 72 | − * Functions needed by submodules * | |
| 73 | − **********************************/ | |
| 74 | − | |
| 75 | −#define IOC3_W_IES 0 | |
| 76 | −#define IOC3_W_IEC 1 | |
| 77 | − | |
| 78 | −/* registers a submodule for all existing and future IOC3 chips */ | |
| 79 | −extern int ioc3_register_submodule(struct ioc3_submodule *); | |
| 80 | −/* unregisters a submodule */ | |
| 81 | −extern void ioc3_unregister_submodule(struct ioc3_submodule *); | |
| 82 | −/* enables IRQs indicated by irq_mask for a specified IOC3 chip */ | |
| 83 | −extern void ioc3_enable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int); | |
| 84 | −/* ackowledges specified IRQs */ | |
| 85 | −extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int); | |
| 86 | −/* disables IRQs indicated by irq_mask for a specified IOC3 chip */ | |
| 87 | −extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int); | |
| 88 | −/* atomically sets GPCR bits */ | |
| 89 | −extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int); | |
| 90 | −/* general ireg writer */ | |
| 91 | −extern void ioc3_write_ireg(struct ioc3_driver_data *idd, uint32_t value, int reg); | |
| 92 | − | |
| 93 | −#endif | |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | enum { |
| 10 | 10 | ICQ_EXITED = 1 << 2, |
| 11 | + ICQ_DESTROYED = 1 << 3, | |
| 11 | 12 | }; |
| 12 | 13 | |
| 13 | 14 | /* |
| @@ -365,17 +365,20 @@ struct iommu_fault_param { · 364 unmodified lines | ||
| 365 | 365 | }; |
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | − * struct iommu_param - collection of per-device IOMMU data | |
| 368 | + * struct dev_iommu - Collection of per-device IOMMU data | |
| 369 | 369 | * |
| 370 | 370 | * @fault_param: IOMMU detected device fault reporting data |
| 371 | + * @fwspec: IOMMU fwspec data | |
| 372 | + * @priv: IOMMU Driver private data | |
| 371 | 373 | * |
| 372 | 374 | * TODO: migrate other per device data pointers under iommu_dev_data, e.g. |
| 373 | 375 | * struct iommu_group *iommu_group; |
| 374 | − * struct iommu_fwspec *iommu_fwspec; | |
| 375 | 376 | */ |
| 376 | −struct iommu_param { | |
| 377 | +struct dev_iommu { | |
| 377 | 378 | struct mutex lock; |
| 378 | − struct iommu_fault_param *fault_param; | |
| 379 | + struct iommu_fault_param *fault_param; | |
| 380 | + struct iommu_fwspec *fwspec; | |
| 381 | + void *priv; | |
| 379 | 382 | }; |
| 380 | 383 | |
| 381 | 384 | int iommu_device_register(struct iommu_device *iommu); |
| @@ -588,11 +591,10 @@ struct iommu_group *fsl_mc_device_group(struct device *dev); · 206 unmodified lines | ||
| 588 | 591 | struct iommu_fwspec { |
| 589 | 592 | const struct iommu_ops *ops; |
| 590 | 593 | struct fwnode_handle *iommu_fwnode; |
| 591 | − void *iommu_priv; | |
| 592 | 594 | u32 flags; |
| 593 | 595 | u32 num_pasid_bits; |
| 594 | 596 | unsigned int num_ids; |
| 595 | − u32 ids[1]; | |
| 597 | + u32 ids[]; | |
| 596 | 598 | }; |
| 597 | 599 | |
| 598 | 600 | /* ATS is supported */ |
| @@ -614,13 +616,26 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode); · 15 unmodified lines | ||
| 614 | 616 | |
| 615 | 617 | static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev) |
| 616 | 618 | { |
| 617 | − return dev->iommu_fwspec; | |
| 619 | + if (dev->iommu) | |
| 620 | + return dev->iommu->fwspec; | |
| 621 | + else | |
| 622 | + return NULL; | |
| 618 | 623 | } |
| 619 | 624 | |
| 620 | 625 | static inline void dev_iommu_fwspec_set(struct device *dev, |
| 621 | 626 | struct iommu_fwspec *fwspec) |
| 622 | 627 | { |
| 623 | − dev->iommu_fwspec = fwspec; | |
| 628 | + dev->iommu->fwspec = fwspec; | |
| 629 | +} | |
| 630 | + | |
| 631 | +static inline void *dev_iommu_priv_get(struct device *dev) | |
| 632 | +{ | |
| 633 | + return dev->iommu->priv; | |
| 634 | +} | |
| 635 | + | |
| 636 | +static inline void dev_iommu_priv_set(struct device *dev, void *priv) | |
| 637 | +{ | |
| 638 | + dev->iommu->priv = priv; | |
| 624 | 639 | } |
| 625 | 640 | |
| 626 | 641 | int iommu_probe_device(struct device *dev); |
| @@ -1073,6 +1088,10 @@ static inline int iommu_sva_unbind_gpasid(struct iommu_domain *domain, · 446 unmodified lines | ||
| 1073 | 1088 | return -ENODEV; |
| 1074 | 1089 | } |
| 1075 | 1090 | |
| 1091 | +static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev) | |
| 1092 | +{ | |
| 1093 | + return NULL; | |
| 1094 | +} | |
| 1076 | 1095 | #endif /* CONFIG_IOMMU_API */ |
| 1077 | 1096 | |
| 1078 | 1097 | #ifdef CONFIG_IOMMU_DEBUGFS |
| @@ -14,36 +14,41 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/io.h> |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | − * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs | |
| 18 | − * @op: accessor function (takes @addr as its only argument) | |
| 19 | − * @addr: Address to poll | |
| 17 | + * read_poll_timeout - Periodically poll an address until a condition is | |
| 18 | + * met or a timeout occurs | |
| 19 | + * @op: accessor function (takes @args as its arguments) | |
| 20 | 20 | * @val: Variable to read the value into |
| 21 | 21 | * @cond: Break condition (usually involving @val) |
| 22 | 22 | * @sleep_us: Maximum time to sleep between reads in us (0 |
| 23 | 23 | * tight-loops). Should be less than ~20ms since usleep_range |
| 24 | 24 | * is used (see Documentation/timers/timers-howto.rst). |
| 25 | 25 | * @timeout_us: Timeout in us, 0 means never timeout |
| 26 | + * @sleep_before_read: if it is true, sleep @sleep_us before read. | |
| 27 | + * @args: arguments for @op poll | |
| 26 | 28 | * |
| 27 | 29 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either |
| 28 | − * case, the last read value at @addr is stored in @val. Must not | |
| 30 | + * case, the last read value at @args is stored in @val. Must not | |
| 29 | 31 | * be called from atomic context if sleep_us or timeout_us are used. |
| 30 | 32 | * |
| 31 | 33 | * When available, you'll probably want to use one of the specialized |
| 32 | 34 | * macros defined below rather than this macro directly. |
| 33 | 35 | */ |
| 34 | −#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \ | |
| 36 | +#define read_poll_timeout(op, val, cond, sleep_us, timeout_us, \ | |
| 37 | + sleep_before_read, args...) \ | |
| 35 | 38 | ({ \ |
| 36 | 39 | u64 __timeout_us = (timeout_us); \ |
| 37 | 40 | unsigned long __sleep_us = (sleep_us); \ |
| 38 | 41 | ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \ |
| 39 | 42 | might_sleep_if((__sleep_us) != 0); \ |
| 43 | + if (sleep_before_read && __sleep_us) \ | |
| 44 | + usleep_range((__sleep_us >> 2) + 1, __sleep_us); \ | |
| 40 | 45 | for (;;) { \ |
| 41 | − (val) = op(addr); \ | |
| 46 | + (val) = op(args); \ | |
| 42 | 47 | if (cond) \ |
| 43 | 48 | break; \ |
| 44 | 49 | if (__timeout_us && \ |
| 45 | 50 | ktime_compare(ktime_get(), __timeout) > 0) { \ |
| 46 | − (val) = op(addr); \ | |
| 51 | + (val) = op(args); \ | |
| 47 | 52 | break; \ |
| 48 | 53 | } \ |
| 49 | 54 | if (__sleep_us) \ |
| @@ -52,6 +57,27 @@ · 2 unmodified lines | ||
| 52 | 57 | (cond) ? 0 : -ETIMEDOUT; \ |
| 53 | 58 | }) |
| 54 | 59 | |
| 60 | +/** | |
| 61 | + * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs | |
| 62 | + * @op: accessor function (takes @addr as its only argument) | |
| 63 | + * @addr: Address to poll | |
| 64 | + * @val: Variable to read the value into | |
| 65 | + * @cond: Break condition (usually involving @val) | |
| 66 | + * @sleep_us: Maximum time to sleep between reads in us (0 | |
| 67 | + * tight-loops). Should be less than ~20ms since usleep_range | |
| 68 | + * is used (see Documentation/timers/timers-howto.rst). | |
| 69 | + * @timeout_us: Timeout in us, 0 means never timeout | |
| 70 | + * | |
| 71 | + * Returns 0 on success and -ETIMEDOUT upon a timeout. In either | |
| 72 | + * case, the last read value at @addr is stored in @val. Must not | |
| 73 | + * be called from atomic context if sleep_us or timeout_us are used. | |
| 74 | + * | |
| 75 | + * When available, you'll probably want to use one of the specialized | |
| 76 | + * macros defined below rather than this macro directly. | |
| 77 | + */ | |
| 78 | +#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \ | |
| 79 | + read_poll_timeout(op, val, cond, sleep_us, timeout_us, false, addr) | |
| 80 | + | |
| 55 | 81 | /** |
| 56 | 82 | * readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs |
| 57 | 83 | * @op: accessor function (takes @addr as its only argument) |
| @@ -74,6 +74,7 @@ struct ipv6_devconf { · 73 unmodified lines | ||
| 74 | 74 | __u32 addr_gen_mode; |
| 75 | 75 | __s32 disable_policy; |
| 76 | 76 | __s32 ndisc_tclass; |
| 77 | + __s32 rpl_seg_enabled; | |
| 77 | 78 | |
| 78 | 79 | struct ctl_table_header *sysctl_header; |
| 79 | 80 | }; |
| @@ -211,6 +211,8 @@ struct irq_data { · 210 unmodified lines | ||
| 211 | 211 | * IRQD_CAN_RESERVE - Can use reservation mode |
| 212 | 212 | * IRQD_MSI_NOMASK_QUIRK - Non-maskable MSI quirk for affinity change |
| 213 | 213 | * required |
| 214 | + * IRQD_HANDLE_ENFORCE_IRQCTX - Enforce that handle_irq_*() is only invoked | |
| 215 | + * from actual interrupt context. | |
| 214 | 216 | */ |
| 215 | 217 | enum { |
| 216 | 218 | IRQD_TRIGGER_MASK = 0xf, |
| @@ -234,6 +236,7 @@ enum { · 17 unmodified lines | ||
| 234 | 236 | IRQD_DEFAULT_TRIGGER_SET = (1 << 25), |
| 235 | 237 | IRQD_CAN_RESERVE = (1 << 26), |
| 236 | 238 | IRQD_MSI_NOMASK_QUIRK = (1 << 27), |
| 239 | + IRQD_HANDLE_ENFORCE_IRQCTX = (1 << 28), | |
| 237 | 240 | }; |
| 238 | 241 | |
| 239 | 242 | #define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors) |
| @@ -303,6 +306,16 @@ static inline bool irqd_is_single_target(struct irq_data *d) · 63 unmodified lines | ||
| 303 | 306 | return __irqd_to_state(d) & IRQD_SINGLE_TARGET; |
| 304 | 307 | } |
| 305 | 308 | |
| 309 | +static inline void irqd_set_handle_enforce_irqctx(struct irq_data *d) | |
| 310 | +{ | |
| 311 | + __irqd_to_state(d) |= IRQD_HANDLE_ENFORCE_IRQCTX; | |
| 312 | +} | |
| 313 | + | |
| 314 | +static inline bool irqd_is_handle_enforce_irqctx(struct irq_data *d) | |
| 315 | +{ | |
| 316 | + return __irqd_to_state(d) & IRQD_HANDLE_ENFORCE_IRQCTX; | |
| 317 | +} | |
| 318 | + | |
| 306 | 319 | static inline bool irqd_is_wakeup_set(struct irq_data *d) |
| 307 | 320 | { |
| 308 | 321 | return __irqd_to_state(d) & IRQD_WAKEUP_STATE; |
| @@ -18,6 +18,8 @@ · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | /* Doesn't want IPI, wait for tick: */ |
| 20 | 20 | #define IRQ_WORK_LAZY BIT(2) |
| 21 | +/* Run hard IRQ context, even on RT */ | |
| 22 | +#define IRQ_WORK_HARD_IRQ BIT(3) | |
| 21 | 23 | |
| 22 | 24 | #define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY) |
| 23 | 25 | |
| @@ -32,6 +32,8 @@ struct gic_kvm_info { · 31 unmodified lines | ||
| 32 | 32 | struct resource vctrl; |
| 33 | 33 | /* vlpi support */ |
| 34 | 34 | bool has_v4; |
| 35 | + /* rvpeid support */ | |
| 36 | + bool has_v4_1; | |
| 35 | 37 | }; |
| 36 | 38 | |
| 37 | 39 | const struct gic_kvm_info *gic_get_kvm_info(void); |
| @@ -57,6 +57,7 @@ · 56 unmodified lines | ||
| 57 | 57 | #define GICD_SPENDSGIR 0x0F20 |
| 58 | 58 | |
| 59 | 59 | #define GICD_CTLR_RWP (1U << 31) |
| 60 | +#define GICD_CTLR_nASSGIreq (1U << 8) | |
| 60 | 61 | #define GICD_CTLR_DS (1U << 6) |
| 61 | 62 | #define GICD_CTLR_ARE_NS (1U << 4) |
| 62 | 63 | #define GICD_CTLR_ENABLE_G1A (1U << 1) |
| @@ -90,6 +91,7 @@ · 27 unmodified lines | ||
| 90 | 91 | #define GICD_TYPER_ESPIS(typer) \ |
| 91 | 92 | (((typer) & GICD_TYPER_ESPI) ? GICD_TYPER_SPIS((typer) >> 27) : 0) |
| 92 | 93 | |
| 94 | +#define GICD_TYPER2_nASSGIcap (1U << 8) | |
| 93 | 95 | #define GICD_TYPER2_VIL (1U << 7) |
| 94 | 96 | #define GICD_TYPER2_VID GENMASK(4, 0) |
| 95 | 97 | |
| @@ -320,6 +322,9 @@ · 224 unmodified lines | ||
| 320 | 322 | #define GICR_VPENDBASER_NonShareable \ |
| 321 | 323 | GIC_BASER_SHAREABILITY(GICR_VPENDBASER, NonShareable) |
| 322 | 324 | |
| 325 | +#define GICR_VPENDBASER_InnerShareable \ | |
| 326 | + GIC_BASER_SHAREABILITY(GICR_VPENDBASER, InnerShareable) | |
| 327 | + | |
| 323 | 328 | #define GICR_VPENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB) |
| 324 | 329 | #define GICR_VPENDBASER_nC GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC) |
| 325 | 330 | #define GICR_VPENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt) |
| @@ -343,6 +348,15 @@ · 17 unmodified lines | ||
| 343 | 348 | #define GICR_VPENDBASER_4_1_VGRP1EN (1ULL << 58) |
| 344 | 349 | #define GICR_VPENDBASER_4_1_VPEID GENMASK_ULL(15, 0) |
| 345 | 350 | |
| 351 | +#define GICR_VSGIR 0x0080 | |
| 352 | + | |
| 353 | +#define GICR_VSGIR_VPEID GENMASK(15, 0) | |
| 354 | + | |
| 355 | +#define GICR_VSGIPENDR 0x0088 | |
| 356 | + | |
| 357 | +#define GICR_VSGIPENDR_BUSY (1U << 31) | |
| 358 | +#define GICR_VSGIPENDR_PENDING GENMASK(15, 0) | |
| 359 | + | |
| 346 | 360 | /* |
| 347 | 361 | * ITS registers, offsets from ITS_base |
| 348 | 362 | */ |
| @@ -366,6 +380,11 @@ · 17 unmodified lines | ||
| 366 | 380 | |
| 367 | 381 | #define GITS_TRANSLATER 0x10040 |
| 368 | 382 | |
| 383 | +#define GITS_SGIR 0x20020 | |
| 384 | + | |
| 385 | +#define GITS_SGIR_VPEID GENMASK_ULL(47, 32) | |
| 386 | +#define GITS_SGIR_VINTID GENMASK_ULL(3, 0) | |
| 387 | + | |
| 369 | 388 | #define GITS_CTLR_ENABLE (1U << 0) |
| 370 | 389 | #define GITS_CTLR_ImDe (1U << 1) |
| 371 | 390 | #define GITS_CTLR_ITS_NUMBER_SHIFT 4 |
| @@ -500,8 +519,9 @@ · 128 unmodified lines | ||
| 500 | 519 | #define GITS_CMD_VMAPTI GITS_CMD_GICv4(GITS_CMD_MAPTI) |
| 501 | 520 | #define GITS_CMD_VMOVI GITS_CMD_GICv4(GITS_CMD_MOVI) |
| 502 | 521 | #define GITS_CMD_VSYNC GITS_CMD_GICv4(GITS_CMD_SYNC) |
| 503 | −/* VMOVP and INVDB are the odd ones, as they dont have a physical counterpart */ | |
| 522 | +/* VMOVP, VSGI and INVDB are the odd ones, as they dont have a physical counterpart */ | |
| 504 | 523 | #define GITS_CMD_VMOVP GITS_CMD_GICv4(2) |
| 524 | +#define GITS_CMD_VSGI GITS_CMD_GICv4(3) | |
| 505 | 525 | #define GITS_CMD_INVDB GITS_CMD_GICv4(0xe) |
| 506 | 526 | |
| 507 | 527 | /* |
| @@ -650,6 +670,7 @@ · 142 unmodified lines | ||
| 650 | 670 | |
| 651 | 671 | struct rdists { |
| 652 | 672 | struct { |
| 673 | + raw_spinlock_t rd_lock; | |
| 653 | 674 | void __iomem *rd_base; |
| 654 | 675 | struct page *pend_page; |
| 655 | 676 | phys_addr_t phys_base; |
| @@ -49,10 +49,22 @@ struct its_vpe { · 48 unmodified lines | ||
| 49 | 49 | }; |
| 50 | 50 | /* GICv4.1 implementations */ |
| 51 | 51 | struct { |
| 52 | + struct fwnode_handle *fwnode; | |
| 53 | + struct irq_domain *sgi_domain; | |
| 54 | + struct { | |
| 55 | + u8 priority; | |
| 56 | + bool enabled; | |
| 57 | + bool group; | |
| 58 | + } sgi_config[16]; | |
| 52 | 59 | atomic_t vmapp_count; |
| 53 | 60 | }; |
| 54 | 61 | }; |
| 55 | 62 | |
| 63 | + /* | |
| 64 | + * Ensures mutual exclusion between affinity setting of the | |
| 65 | + * vPE and vLPI operations using vpe->col_idx. | |
| 66 | + */ | |
| 67 | + raw_spinlock_t vpe_lock; | |
| 56 | 68 | /* |
| 57 | 69 | * This collection ID is used to indirect the target |
| 58 | 70 | * redistributor for this VPE. The ID itself isn't involved in |
| @@ -93,6 +105,7 @@ enum its_vcpu_info_cmd_type { · 34 unmodified lines | ||
| 93 | 105 | SCHEDULE_VPE, |
| 94 | 106 | DESCHEDULE_VPE, |
| 95 | 107 | INVALL_VPE, |
| 108 | + PROP_UPDATE_VSGI, | |
| 96 | 109 | }; |
| 97 | 110 | |
| 98 | 111 | struct its_cmd_info { |
| @@ -105,19 +118,27 @@ struct its_cmd_info { · 6 unmodified lines | ||
| 105 | 118 | bool g0en; |
| 106 | 119 | bool g1en; |
| 107 | 120 | }; |
| 121 | + struct { | |
| 122 | + u8 priority; | |
| 123 | + bool group; | |
| 124 | + }; | |
| 108 | 125 | }; |
| 109 | 126 | }; |
| 110 | 127 | |
| 111 | 128 | int its_alloc_vcpu_irqs(struct its_vm *vm); |
| 112 | 129 | void its_free_vcpu_irqs(struct its_vm *vm); |
| 113 | −int its_schedule_vpe(struct its_vpe *vpe, bool on); | |
| 130 | +int its_make_vpe_resident(struct its_vpe *vpe, bool g0en, bool g1en); | |
| 131 | +int its_make_vpe_non_resident(struct its_vpe *vpe, bool db); | |
| 114 | 132 | int its_invall_vpe(struct its_vpe *vpe); |
| 115 | 133 | int its_map_vlpi(int irq, struct its_vlpi_map *map); |
| 116 | 134 | int its_get_vlpi(int irq, struct its_vlpi_map *map); |
| 117 | 135 | int its_unmap_vlpi(int irq); |
| 118 | 136 | int its_prop_update_vlpi(int irq, u8 config, bool inv); |
| 137 | +int its_prop_update_vsgi(int irq, u8 priority, bool group); | |
| 119 | 138 | |
| 120 | 139 | struct irq_domain_ops; |
| 121 | −int its_init_v4(struct irq_domain *domain, const struct irq_domain_ops *ops); | |
| 140 | +int its_init_v4(struct irq_domain *domain, | |
| 141 | + const struct irq_domain_ops *vpe_ops, | |
| 142 | + const struct irq_domain_ops *sgi_ops); | |
| 122 | 143 | |
| 123 | 144 | #endif |
| @@ -24,7 +24,7 @@ struct pt_regs; · 23 unmodified lines | ||
| 24 | 24 | * @handle_irq: highlevel irq-events handler |
| 25 | 25 | * @preflow_handler: handler called before the flow handler (currently used by sparc) |
| 26 | 26 | * @action: the irq action chain |
| 27 | − * @status: status information | |
| 27 | + * @status_use_accessors: status information | |
| 28 | 28 | * @core_internal_state__do_not_mess_with_it: core internal status information |
| 29 | 29 | * @depth: disable-depth, for nested irq_disable() calls |
| 30 | 30 | * @wake_depth: enable depth, for multiple irq_set_irq_wake() callers |
| @@ -15,15 +15,15 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/typecheck.h> |
| 16 | 16 | #include <asm/irqflags.h> |
| 17 | 17 | |
| 18 | −/* Currently trace_softirqs_on/off is used only by lockdep */ | |
| 18 | +/* Currently lockdep_softirqs_on/off is used only by lockdep */ | |
| 19 | 19 | #ifdef CONFIG_PROVE_LOCKING |
| 20 | − extern void trace_softirqs_on(unsigned long ip); | |
| 21 | − extern void trace_softirqs_off(unsigned long ip); | |
| 20 | + extern void lockdep_softirqs_on(unsigned long ip); | |
| 21 | + extern void lockdep_softirqs_off(unsigned long ip); | |
| 22 | 22 | extern void lockdep_hardirqs_on(unsigned long ip); |
| 23 | 23 | extern void lockdep_hardirqs_off(unsigned long ip); |
| 24 | 24 | #else |
| 25 | − static inline void trace_softirqs_on(unsigned long ip) { } | |
| 26 | − static inline void trace_softirqs_off(unsigned long ip) { } | |
| 25 | + static inline void lockdep_softirqs_on(unsigned long ip) { } | |
| 26 | + static inline void lockdep_softirqs_off(unsigned long ip) { } | |
| 27 | 27 | static inline void lockdep_hardirqs_on(unsigned long ip) { } |
| 28 | 28 | static inline void lockdep_hardirqs_off(unsigned long ip) { } |
| 29 | 29 | #endif |
| @@ -31,15 +31,20 @@ · 1 unmodified line | ||
| 31 | 31 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 32 | 32 | extern void trace_hardirqs_on(void); |
| 33 | 33 | extern void trace_hardirqs_off(void); |
| 34 | −# define trace_hardirq_context(p) ((p)->hardirq_context) | |
| 35 | −# define trace_softirq_context(p) ((p)->softirq_context) | |
| 36 | −# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled) | |
| 37 | −# define trace_softirqs_enabled(p) ((p)->softirqs_enabled) | |
| 38 | −# define trace_hardirq_enter() \ | |
| 34 | +# define lockdep_hardirq_context(p) ((p)->hardirq_context) | |
| 35 | +# define lockdep_softirq_context(p) ((p)->softirq_context) | |
| 36 | +# define lockdep_hardirqs_enabled(p) ((p)->hardirqs_enabled) | |
| 37 | +# define lockdep_softirqs_enabled(p) ((p)->softirqs_enabled) | |
| 38 | +# define lockdep_hardirq_enter() \ | |
| 39 | 39 | do { \ |
| 40 | − current->hardirq_context++; \ | |
| 40 | + if (!current->hardirq_context++) \ | |
| 41 | + current->hardirq_threaded = 0; \ | |
| 41 | 42 | } while (0) |
| 42 | −# define trace_hardirq_exit() \ | |
| 43 | +# define lockdep_hardirq_threaded() \ | |
| 44 | +do { \ | |
| 45 | + current->hardirq_threaded = 1; \ | |
| 46 | +} while (0) | |
| 47 | +# define lockdep_hardirq_exit() \ | |
| 43 | 48 | do { \ |
| 44 | 49 | current->hardirq_context--; \ |
| 45 | 50 | } while (0) |
| @@ -51,17 +56,63 @@ do { \ · 5 unmodified lines | ||
| 51 | 56 | do { \ |
| 52 | 57 | current->softirq_context--; \ |
| 53 | 58 | } while (0) |
| 59 | + | |
| 60 | +# define lockdep_hrtimer_enter(__hrtimer) \ | |
| 61 | +({ \ | |
| 62 | + bool __expires_hardirq = true; \ | |
| 63 | + \ | |
| 64 | + if (!__hrtimer->is_hard) { \ | |
| 65 | + current->irq_config = 1; \ | |
| 66 | + __expires_hardirq = false; \ | |
| 67 | + } \ | |
| 68 | + __expires_hardirq; \ | |
| 69 | +}) | |
| 70 | + | |
| 71 | +# define lockdep_hrtimer_exit(__expires_hardirq) \ | |
| 72 | + do { \ | |
| 73 | + if (!__expires_hardirq) \ | |
| 74 | + current->irq_config = 0; \ | |
| 75 | + } while (0) | |
| 76 | + | |
| 77 | +# define lockdep_posixtimer_enter() \ | |
| 78 | + do { \ | |
| 79 | + current->irq_config = 1; \ | |
| 80 | + } while (0) | |
| 81 | + | |
| 82 | +# define lockdep_posixtimer_exit() \ | |
| 83 | + do { \ | |
| 84 | + current->irq_config = 0; \ | |
| 85 | + } while (0) | |
| 86 | + | |
| 87 | +# define lockdep_irq_work_enter(__work) \ | |
| 88 | + do { \ | |
| 89 | + if (!(atomic_read(&__work->flags) & IRQ_WORK_HARD_IRQ))\ | |
| 90 | + current->irq_config = 1; \ | |
| 91 | + } while (0) | |
| 92 | +# define lockdep_irq_work_exit(__work) \ | |
| 93 | + do { \ | |
| 94 | + if (!(atomic_read(&__work->flags) & IRQ_WORK_HARD_IRQ))\ | |
| 95 | + current->irq_config = 0; \ | |
| 96 | + } while (0) | |
| 97 | + | |
| 54 | 98 | #else |
| 55 | 99 | # define trace_hardirqs_on() do { } while (0) |
| 56 | 100 | # define trace_hardirqs_off() do { } while (0) |
| 57 | −# define trace_hardirq_context(p) 0 | |
| 58 | −# define trace_softirq_context(p) 0 | |
| 59 | −# define trace_hardirqs_enabled(p) 0 | |
| 60 | −# define trace_softirqs_enabled(p) 0 | |
| 61 | −# define trace_hardirq_enter() do { } while (0) | |
| 62 | −# define trace_hardirq_exit() do { } while (0) | |
| 101 | +# define lockdep_hardirq_context(p) 0 | |
| 102 | +# define lockdep_softirq_context(p) 0 | |
| 103 | +# define lockdep_hardirqs_enabled(p) 0 | |
| 104 | +# define lockdep_softirqs_enabled(p) 0 | |
| 105 | +# define lockdep_hardirq_enter() do { } while (0) | |
| 106 | +# define lockdep_hardirq_threaded() do { } while (0) | |
| 107 | +# define lockdep_hardirq_exit() do { } while (0) | |
| 63 | 108 | # define lockdep_softirq_enter() do { } while (0) |
| 64 | 109 | # define lockdep_softirq_exit() do { } while (0) |
| 110 | +# define lockdep_hrtimer_enter(__hrtimer) false | |
| 111 | +# define lockdep_hrtimer_exit(__context) do { } while (0) | |
| 112 | +# define lockdep_posixtimer_enter() do { } while (0) | |
| 113 | +# define lockdep_posixtimer_exit() do { } while (0) | |
| 114 | +# define lockdep_irq_work_enter(__work) do { } while (0) | |
| 115 | +# define lockdep_irq_work_exit(__work) do { } while (0) | |
| 65 | 116 | #endif |
| 66 | 117 | |
| 67 | 118 | #if defined(CONFIG_IRQSOFF_TRACER) || \ |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/types.h> |
| 9 | 9 | #include <linux/time.h> |
| 10 | 10 | #include <linux/timex.h> |
| 11 | +#include <vdso/jiffies.h> | |
| 11 | 12 | #include <asm/param.h> /* for HZ */ |
| 12 | 13 | #include <generated/timeconst.h> |
| 13 | 14 | |
| @@ -59,9 +60,6 @@ · 45 unmodified lines | ||
| 59 | 60 | |
| 60 | 61 | extern int register_refined_jiffies(long clock_tick_rate); |
| 61 | 62 | |
| 62 | −/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */ | |
| 63 | −#define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ) | |
| 64 | − | |
| 65 | 63 | /* TICK_USEC is the time between ticks in usec assuming SHIFTED_HZ */ |
| 66 | 64 | #define TICK_USEC ((USEC_PER_SEC + HZ/2) / HZ) |
| 67 | 65 | |
| @@ -190,7 +190,7 @@ void kasan_init_tags(void); · 189 unmodified lines | ||
| 190 | 190 | |
| 191 | 191 | void *kasan_reset_tag(const void *addr); |
| 192 | 192 | |
| 193 | −void kasan_report(unsigned long addr, size_t size, | |
| 193 | +bool kasan_report(unsigned long addr, size_t size, | |
| 194 | 194 | bool is_write, unsigned long ip); |
| 195 | 195 | |
| 196 | 196 | #else /* CONFIG_KASAN_SW_TAGS */ |
| @@ -257,6 +257,13 @@ extern void __cant_sleep(const char *file, int line, int preempt_offset); · 256 unmodified lines | ||
| 257 | 257 | |
| 258 | 258 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) |
| 259 | 259 | |
| 260 | +#ifndef CONFIG_PREEMPT_RT | |
| 261 | +# define cant_migrate() cant_sleep() | |
| 262 | +#else | |
| 263 | + /* Placeholder for now */ | |
| 264 | +# define cant_migrate() do { } while (0) | |
| 265 | +#endif | |
| 266 | + | |
| 260 | 267 | /** |
| 261 | 268 | * abs - return absolute value of an argument |
| 262 | 269 | * @x: the value. If it is unsigned type, it is converted to signed type first. |
| @@ -37,8 +37,10 @@ enum kernfs_node_type { · 36 unmodified lines | ||
| 37 | 37 | KERNFS_LINK = 0x0004, |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | −#define KERNFS_TYPE_MASK 0x000f | |
| 41 | −#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK | |
| 40 | +#define KERNFS_TYPE_MASK 0x000f | |
| 41 | +#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK | |
| 42 | +#define KERNFS_MAX_USER_XATTRS 128 | |
| 43 | +#define KERNFS_USER_XATTR_SIZE_LIMIT (128 << 10) | |
| 42 | 44 | |
| 43 | 45 | enum kernfs_node_flag { |
| 44 | 46 | KERNFS_ACTIVATED = 0x0010, |
| @@ -78,6 +80,11 @@ enum kernfs_root_flag { · 33 unmodified lines | ||
| 78 | 80 | * fhandle to access nodes of the fs. |
| 79 | 81 | */ |
| 80 | 82 | KERNFS_ROOT_SUPPORT_EXPORTOP = 0x0004, |
| 83 | + | |
| 84 | + /* | |
| 85 | + * Support user xattrs to be written to nodes rooted at this root. | |
| 86 | + */ | |
| 87 | + KERNFS_ROOT_SUPPORT_USER_XATTR = 0x0008, | |
| 81 | 88 | }; |
| 82 | 89 | |
| 83 | 90 | /* type-specific structures for kernfs_node union members */ |
| @@ -127,7 +127,7 @@ struct key_type { · 126 unmodified lines | ||
| 127 | 127 | * much is copied into the buffer |
| 128 | 128 | * - shouldn't do the copy if the buffer is NULL |
| 129 | 129 | */ |
| 130 | − long (*read)(const struct key *key, char __user *buffer, size_t buflen); | |
| 130 | + long (*read)(const struct key *key, char *buffer, size_t buflen); | |
| 131 | 131 | |
| 132 | 132 | /* handle request_key() for this type instead of invoking |
| 133 | 133 | * /sbin/request-key (optional) |
| @@ -246,6 +246,37 @@ __kfifo_int_must_check_helper(int val) · 245 unmodified lines | ||
| 246 | 246 | __tmpq->kfifo.in == __tmpq->kfifo.out; \ |
| 247 | 247 | }) |
| 248 | 248 | |
| 249 | +/** | |
| 250 | + * kfifo_is_empty_spinlocked - returns true if the fifo is empty using | |
| 251 | + * a spinlock for locking | |
| 252 | + * @fifo: address of the fifo to be used | |
| 253 | + * @lock: spinlock to be used for locking | |
| 254 | + */ | |
| 255 | +#define kfifo_is_empty_spinlocked(fifo, lock) \ | |
| 256 | +({ \ | |
| 257 | + unsigned long __flags; \ | |
| 258 | + bool __ret; \ | |
| 259 | + spin_lock_irqsave(lock, __flags); \ | |
| 260 | + __ret = kfifo_is_empty(fifo); \ | |
| 261 | + spin_unlock_irqrestore(lock, __flags); \ | |
| 262 | + __ret; \ | |
| 263 | +}) | |
| 264 | + | |
| 265 | +/** | |
| 266 | + * kfifo_is_empty_spinlocked_noirqsave - returns true if the fifo is empty | |
| 267 | + * using a spinlock for locking, doesn't disable interrupts | |
| 268 | + * @fifo: address of the fifo to be used | |
| 269 | + * @lock: spinlock to be used for locking | |
| 270 | + */ | |
| 271 | +#define kfifo_is_empty_spinlocked_noirqsave(fifo, lock) \ | |
| 272 | +({ \ | |
| 273 | + bool __ret; \ | |
| 274 | + spin_lock(lock); \ | |
| 275 | + __ret = kfifo_is_empty(fifo); \ | |
| 276 | + spin_unlock(lock); \ | |
| 277 | + __ret; \ | |
| 278 | +}) | |
| 279 | + | |
| 249 | 280 | /** |
| 250 | 281 | * kfifo_is_full - returns true if the fifo is full |
| 251 | 282 | * @fifo: address of the fifo to be used |
| @@ -517,6 +548,26 @@ __kfifo_uint_must_check_helper( \ · 265 unmodified lines | ||
| 517 | 548 | __ret; \ |
| 518 | 549 | }) |
| 519 | 550 | |
| 551 | +/** | |
| 552 | + * kfifo_in_spinlocked_noirqsave - put data into fifo using a spinlock for | |
| 553 | + * locking, don't disable interrupts | |
| 554 | + * @fifo: address of the fifo to be used | |
| 555 | + * @buf: the data to be added | |
| 556 | + * @n: number of elements to be added | |
| 557 | + * @lock: pointer to the spinlock to use for locking | |
| 558 | + * | |
| 559 | + * This is a variant of kfifo_in_spinlocked() but uses spin_lock/unlock() | |
| 560 | + * for locking and doesn't disable interrupts. | |
| 561 | + */ | |
| 562 | +#define kfifo_in_spinlocked_noirqsave(fifo, buf, n, lock) \ | |
| 563 | +({ \ | |
| 564 | + unsigned int __ret; \ | |
| 565 | + spin_lock(lock); \ | |
| 566 | + __ret = kfifo_in(fifo, buf, n); \ | |
| 567 | + spin_unlock(lock); \ | |
| 568 | + __ret; \ | |
| 569 | +}) | |
| 570 | + | |
| 520 | 571 | /* alias for kfifo_in_spinlocked, will be removed in a future release */ |
| 521 | 572 | #define kfifo_in_locked(fifo, buf, n, lock) \ |
| 522 | 573 | kfifo_in_spinlocked(fifo, buf, n, lock) |
| @@ -569,6 +620,28 @@ __kfifo_uint_must_check_helper( \ · 46 unmodified lines | ||
| 569 | 620 | }) \ |
| 570 | 621 | ) |
| 571 | 622 | |
| 623 | +/** | |
| 624 | + * kfifo_out_spinlocked_noirqsave - get data from the fifo using a spinlock | |
| 625 | + * for locking, don't disable interrupts | |
| 626 | + * @fifo: address of the fifo to be used | |
| 627 | + * @buf: pointer to the storage buffer | |
| 628 | + * @n: max. number of elements to get | |
| 629 | + * @lock: pointer to the spinlock to use for locking | |
| 630 | + * | |
| 631 | + * This is a variant of kfifo_out_spinlocked() which uses spin_lock/unlock() | |
| 632 | + * for locking and doesn't disable interrupts. | |
| 633 | + */ | |
| 634 | +#define kfifo_out_spinlocked_noirqsave(fifo, buf, n, lock) \ | |
| 635 | +__kfifo_uint_must_check_helper( \ | |
| 636 | +({ \ | |
| 637 | + unsigned int __ret; \ | |
| 638 | + spin_lock(lock); \ | |
| 639 | + __ret = kfifo_out(fifo, buf, n); \ | |
| 640 | + spin_unlock(lock); \ | |
| 641 | + __ret; \ | |
| 642 | +}) \ | |
| 643 | +) | |
| 644 | + | |
| 572 | 645 | /* alias for kfifo_out_spinlocked, will be removed in a future release */ |
| 573 | 646 | #define kfifo_out_locked(fifo, buf, n, lock) \ |
| 574 | 647 | kfifo_out_spinlocked(fifo, buf, n, lock) |
| @@ -165,7 +165,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker, · 164 unmodified lines | ||
| 165 | 165 | do { \ |
| 166 | 166 | kthread_init_work(&(dwork)->work, (fn)); \ |
| 167 | 167 | timer_setup(&(dwork)->timer, \ |
| 168 | − kthread_delayed_work_timer_fn, 0); \ | |
| 168 | + kthread_delayed_work_timer_fn, \ | |
| 169 | + TIMER_IRQSAFE); \ | |
| 169 | 170 | } while (0) |
| 170 | 171 | |
| 171 | 172 | int kthread_worker_fn(void *worker_ptr); |
| @@ -216,14 +216,7 @@ static inline __must_check bool ktime_to_timespec64_cond(const ktime_t kt, · 215 unmodified lines | ||
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | −/* | |
| 220 | − * The resolution of the clocks. The resolution value is returned in | |
| 221 | − * the clock_getres() system call to give application programmers an | |
| 222 | − * idea of the (in)accuracy of timers. Timer values are rounded up to | |
| 223 | − * this resolution values. | |
| 224 | − */ | |
| 225 | −#define LOW_RES_NSEC TICK_NSEC | |
| 226 | −#define KTIME_LOW_RES (LOW_RES_NSEC) | |
| 219 | +#include <vdso/ktime.h> | |
| 227 | 220 | |
| 228 | 221 | static inline ktime_t ns_to_ktime(u64 ns) |
| 229 | 222 | { |
| @@ -360,6 +360,10 @@ static inline unsigned long *kvm_second_dirty_bitmap(struct kvm_memory_slot *mem · 359 unmodified lines | ||
| 360 | 360 | return memslot->dirty_bitmap + len / sizeof(*memslot->dirty_bitmap); |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | +#ifndef KVM_DIRTY_LOG_MANUAL_CAPS | |
| 364 | +#define KVM_DIRTY_LOG_MANUAL_CAPS KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | |
| 365 | +#endif | |
| 366 | + | |
| 363 | 367 | struct kvm_s390_adapter_int { |
| 364 | 368 | u64 ind_addr; |
| 365 | 369 | u64 summary_addr; |
| @@ -431,11 +435,11 @@ static inline int kvm_arch_vcpu_memslots_id(struct kvm_vcpu *vcpu) · 65 unmodified lines | ||
| 431 | 435 | */ |
| 432 | 436 | struct kvm_memslots { |
| 433 | 437 | u64 generation; |
| 434 | − struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM]; | |
| 435 | 438 | /* The mapping table from slot id to the index in memslots[]. */ |
| 436 | 439 | short id_to_index[KVM_MEM_SLOTS_NUM]; |
| 437 | 440 | atomic_t lru_slot; |
| 438 | 441 | int used_slots; |
| 442 | + struct kvm_memory_slot memslots[]; | |
| 439 | 443 | }; |
| 440 | 444 | |
| 441 | 445 | struct kvm { |
| @@ -493,7 +497,7 @@ struct kvm { · 51 unmodified lines | ||
| 493 | 497 | #endif |
| 494 | 498 | long tlbs_dirty; |
| 495 | 499 | struct list_head devices; |
| 496 | − bool manual_dirty_log_protect; | |
| 500 | + u64 manual_dirty_log_protect; | |
| 497 | 501 | struct dentry *debugfs_dentry; |
| 498 | 502 | struct kvm_stat_data **debugfs_stat_data; |
| 499 | 503 | struct srcu_struct srcu; |
| @@ -527,6 +531,11 @@ struct kvm { · 27 unmodified lines | ||
| 527 | 531 | #define vcpu_err(vcpu, fmt, ...) \ |
| 528 | 532 | kvm_err("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__) |
| 529 | 533 | |
| 534 | +static inline bool kvm_dirty_log_manual_protect_and_init_set(struct kvm *kvm) | |
| 535 | +{ | |
| 536 | + return !!(kvm->manual_dirty_log_protect & KVM_DIRTY_LOG_INITIALLY_SET); | |
| 537 | +} | |
| 538 | + | |
| 530 | 539 | static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx) |
| 531 | 540 | { |
| 532 | 541 | return srcu_dereference_check(kvm->buses[idx], &kvm->srcu, |
| @@ -572,10 +581,11 @@ static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) · 39 unmodified lines | ||
| 572 | 581 | return vcpu->vcpu_idx; |
| 573 | 582 | } |
| 574 | 583 | |
| 575 | −#define kvm_for_each_memslot(memslot, slots) \ | |
| 576 | − for (memslot = &slots->memslots[0]; \ | |
| 577 | − memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\ | |
| 578 | − memslot++) | |
| 584 | +#define kvm_for_each_memslot(memslot, slots) \ | |
| 585 | + for (memslot = &slots->memslots[0]; \ | |
| 586 | + memslot < slots->memslots + slots->used_slots; memslot++) \ | |
| 587 | + if (WARN_ON_ONCE(!memslot->npages)) { \ | |
| 588 | + } else | |
| 579 | 589 | |
| 580 | 590 | void kvm_vcpu_destroy(struct kvm_vcpu *vcpu); |
| 581 | 591 | |
| @@ -635,12 +645,15 @@ static inline struct kvm_memslots *kvm_vcpu_memslots(struct kvm_vcpu *vcpu) · 53 unmodified lines | ||
| 635 | 645 | return __kvm_memslots(vcpu->kvm, as_id); |
| 636 | 646 | } |
| 637 | 647 | |
| 638 | −static inline struct kvm_memory_slot * | |
| 639 | −id_to_memslot(struct kvm_memslots *slots, int id) | |
| 648 | +static inline | |
| 649 | +struct kvm_memory_slot *id_to_memslot(struct kvm_memslots *slots, int id) | |
| 640 | 650 | { |
| 641 | 651 | int index = slots->id_to_index[id]; |
| 642 | 652 | struct kvm_memory_slot *slot; |
| 643 | 653 | |
| 654 | + if (index < 0) | |
| 655 | + return NULL; | |
| 656 | + | |
| 644 | 657 | slot = &slots->memslots[index]; |
| 645 | 658 | |
| 646 | 659 | WARN_ON(slot->id != id); |
| @@ -669,10 +682,7 @@ int kvm_set_memory_region(struct kvm *kvm, · 22 unmodified lines | ||
| 669 | 682 | const struct kvm_userspace_memory_region *mem); |
| 670 | 683 | int __kvm_set_memory_region(struct kvm *kvm, |
| 671 | 684 | const struct kvm_userspace_memory_region *mem); |
| 672 | −void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free, | |
| 673 | − struct kvm_memory_slot *dont); | |
| 674 | −int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot, | |
| 675 | − unsigned long npages); | |
| 685 | +void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot); | |
| 676 | 686 | void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen); |
| 677 | 687 | int kvm_arch_prepare_memory_region(struct kvm *kvm, |
| 678 | 688 | struct kvm_memory_slot *memslot, |
| @@ -680,11 +690,9 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, · 1 unmodified line | ||
| 680 | 690 | enum kvm_mr_change change); |
| 681 | 691 | void kvm_arch_commit_memory_region(struct kvm *kvm, |
| 682 | 692 | const struct kvm_userspace_memory_region *mem, |
| 683 | − const struct kvm_memory_slot *old, | |
| 693 | + struct kvm_memory_slot *old, | |
| 684 | 694 | const struct kvm_memory_slot *new, |
| 685 | 695 | enum kvm_mr_change change); |
| 686 | −bool kvm_largepages_enabled(void); | |
| 687 | −void kvm_disable_largepages(void); | |
| 688 | 696 | /* flush all memory translations */ |
| 689 | 697 | void kvm_arch_flush_shadow_all(struct kvm *kvm); |
| 690 | 698 | /* flush memory translations pointing to 'slot' */ |
| @@ -704,7 +712,6 @@ void kvm_release_page_clean(struct page *page); · 13 unmodified lines | ||
| 704 | 712 | void kvm_release_page_dirty(struct page *page); |
| 705 | 713 | void kvm_set_page_accessed(struct page *page); |
| 706 | 714 | |
| 707 | −kvm_pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn); | |
| 708 | 715 | kvm_pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); |
| 709 | 716 | kvm_pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault, |
| 710 | 717 | bool *writable); |
| @@ -819,23 +826,20 @@ vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf); · 108 unmodified lines | ||
| 819 | 826 | |
| 820 | 827 | int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext); |
| 821 | 828 | |
| 822 | −int kvm_get_dirty_log(struct kvm *kvm, | |
| 823 | − struct kvm_dirty_log *log, int *is_dirty); | |
| 824 | − | |
| 825 | −int kvm_get_dirty_log_protect(struct kvm *kvm, | |
| 826 | − struct kvm_dirty_log *log, bool *flush); | |
| 827 | −int kvm_clear_dirty_log_protect(struct kvm *kvm, | |
| 828 | − struct kvm_clear_dirty_log *log, bool *flush); | |
| 829 | − | |
| 830 | 829 | void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm, |
| 831 | 830 | struct kvm_memory_slot *slot, |
| 832 | 831 | gfn_t gfn_offset, |
| 833 | 832 | unsigned long mask); |
| 834 | − | |
| 835 | −int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |
| 836 | − struct kvm_dirty_log *log); | |
| 837 | −int kvm_vm_ioctl_clear_dirty_log(struct kvm *kvm, | |
| 838 | − struct kvm_clear_dirty_log *log); | |
| 833 | +void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot); | |
| 834 | + | |
| 835 | +#ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT | |
| 836 | +void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm, | |
| 837 | + struct kvm_memory_slot *memslot); | |
| 838 | +#else /* !CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT */ | |
| 839 | +int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log); | |
| 840 | +int kvm_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log, | |
| 841 | + int *is_dirty, struct kvm_memory_slot **memslot); | |
| 842 | +#endif | |
| 839 | 843 | |
| 840 | 844 | int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level, |
| 841 | 845 | bool line_status); |
| @@ -882,9 +886,9 @@ void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu); · 40 unmodified lines | ||
| 882 | 886 | |
| 883 | 887 | int kvm_arch_hardware_enable(void); |
| 884 | 888 | void kvm_arch_hardware_disable(void); |
| 885 | −int kvm_arch_hardware_setup(void); | |
| 889 | +int kvm_arch_hardware_setup(void *opaque); | |
| 886 | 890 | void kvm_arch_hardware_unsetup(void); |
| 887 | −int kvm_arch_check_processor_compat(void); | |
| 891 | +int kvm_arch_check_processor_compat(void *opaque); | |
| 888 | 892 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); |
| 889 | 893 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); |
| 890 | 894 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); |
| @@ -1018,6 +1022,8 @@ bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args); · 127 unmodified lines | ||
| 1018 | 1022 | * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c. |
| 1019 | 1023 | * gfn_to_memslot() itself isn't here as an inline because that would |
| 1020 | 1024 | * bloat other code too much. |
| 1025 | + * | |
| 1026 | + * IMPORTANT: Slots are sorted from highest GFN to lowest GFN! | |
| 1021 | 1027 | */ |
| 1022 | 1028 | static inline struct kvm_memory_slot * |
| 1023 | 1029 | search_memslots(struct kvm_memslots *slots, gfn_t gfn) |
| @@ -1026,6 +1032,9 @@ search_memslots(struct kvm_memslots *slots, gfn_t gfn) · 2 unmodified lines | ||
| 1026 | 1032 | int slot = atomic_read(&slots->lru_slot); |
| 1027 | 1033 | struct kvm_memory_slot *memslots = slots->memslots; |
| 1028 | 1034 | |
| 1035 | + if (unlikely(!slots->used_slots)) | |
| 1036 | + return NULL; | |
| 1037 | + | |
| 1029 | 1038 | if (gfn >= memslots[slot].base_gfn && |
| 1030 | 1039 | gfn < memslots[slot].base_gfn + memslots[slot].npages) |
| 1031 | 1040 | return &memslots[slot]; |
| @@ -25,6 +25,7 @@ struct device_node; · 24 unmodified lines | ||
| 25 | 25 | * LED Core |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | +/* This is obsolete/useless. We now support variable maximum brightness. */ | |
| 28 | 29 | enum led_brightness { |
| 29 | 30 | LED_OFF = 0, |
| 30 | 31 | LED_ON = 1, |
| @@ -1,22 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −/* | |
| 3 | − * PWM LED driver data - see drivers/leds/leds-pwm.c | |
| 4 | − */ | |
| 5 | −#ifndef __LINUX_LEDS_PWM_H | |
| 6 | −#define __LINUX_LEDS_PWM_H | |
| 7 | − | |
| 8 | −struct led_pwm { | |
| 9 | − const char *name; | |
| 10 | − const char *default_trigger; | |
| 11 | − unsigned pwm_id __deprecated; | |
| 12 | − u8 active_low; | |
| 13 | − unsigned max_brightness; | |
| 14 | − unsigned pwm_period_ns; | |
| 15 | −}; | |
| 16 | − | |
| 17 | −struct led_pwm_platform_data { | |
| 18 | − int num_leds; | |
| 19 | − struct led_pwm *leds; | |
| 20 | −}; | |
| 21 | − | |
| 22 | −#endif | |
| @@ -57,8 +57,6 @@ · 56 unmodified lines | ||
| 57 | 57 | #define VPRINTK(fmt, args...) |
| 58 | 58 | #endif /* ATA_DEBUG */ |
| 59 | 59 | |
| 60 | −#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args) | |
| 61 | − | |
| 62 | 60 | #define ata_print_version_once(dev, version) \ |
| 63 | 61 | ({ \ |
| 64 | 62 | static bool __print_once; \ |
| @@ -176,6 +174,7 @@ enum { · 111 unmodified lines | ||
| 176 | 174 | ATA_DEV_NONE = 11, /* no device */ |
| 177 | 175 | |
| 178 | 176 | /* struct ata_link flags */ |
| 177 | + /* NOTE: struct ata_force_param currently stores lflags in u16 */ | |
| 179 | 178 | ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */ |
| 180 | 179 | ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ |
| 181 | 180 | ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ |
| @@ -531,12 +530,14 @@ typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes, · 349 unmodified lines | ||
| 531 | 530 | unsigned long deadline); |
| 532 | 531 | typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes); |
| 533 | 532 | |
| 534 | −extern struct device_attribute dev_attr_link_power_management_policy; | |
| 535 | 533 | extern struct device_attribute dev_attr_unload_heads; |
| 534 | +#ifdef CONFIG_SATA_HOST | |
| 535 | +extern struct device_attribute dev_attr_link_power_management_policy; | |
| 536 | 536 | extern struct device_attribute dev_attr_ncq_prio_enable; |
| 537 | 537 | extern struct device_attribute dev_attr_em_message_type; |
| 538 | 538 | extern struct device_attribute dev_attr_em_message; |
| 539 | 539 | extern struct device_attribute dev_attr_sw_activity; |
| 540 | +#endif | |
| 540 | 541 | |
| 541 | 542 | enum sw_activity { |
| 542 | 543 | OFF, |
| @@ -1020,10 +1021,6 @@ struct ata_timing { · 477 unmodified lines | ||
| 1020 | 1021 | /* |
| 1021 | 1022 | * Core layer - drivers/ata/libata-core.c |
| 1022 | 1023 | */ |
| 1023 | −extern const unsigned long sata_deb_timing_normal[]; | |
| 1024 | −extern const unsigned long sata_deb_timing_hotplug[]; | |
| 1025 | −extern const unsigned long sata_deb_timing_long[]; | |
| 1026 | − | |
| 1027 | 1024 | extern struct ata_port_operations ata_dummy_port_ops; |
| 1028 | 1025 | extern const struct ata_port_info ata_dummy_port_info; |
| 1029 | 1026 | |
| @@ -1061,33 +1058,14 @@ static inline int is_multi_taskfile(struct ata_taskfile *tf) · 31 unmodified lines | ||
| 1061 | 1058 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); |
| 1062 | 1059 | } |
| 1063 | 1060 | |
| 1064 | −static inline const unsigned long * | |
| 1065 | −sata_ehc_deb_timing(struct ata_eh_context *ehc) | |
| 1066 | −{ | |
| 1067 | − if (ehc->i.flags & ATA_EHI_HOTPLUGGED) | |
| 1068 | − return sata_deb_timing_hotplug; | |
| 1069 | − else | |
| 1070 | − return sata_deb_timing_normal; | |
| 1071 | −} | |
| 1072 | − | |
| 1073 | 1061 | static inline int ata_port_is_dummy(struct ata_port *ap) |
| 1074 | 1062 | { |
| 1075 | 1063 | return ap->ops == &ata_dummy_port_ops; |
| 1076 | 1064 | } |
| 1077 | 1065 | |
| 1078 | −extern int sata_set_spd(struct ata_link *link); | |
| 1079 | 1066 | extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); |
| 1080 | 1067 | extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, |
| 1081 | 1068 | int (*check_ready)(struct ata_link *link)); |
| 1082 | −extern int sata_link_debounce(struct ata_link *link, | |
| 1083 | − const unsigned long *params, unsigned long deadline); | |
| 1084 | −extern int sata_link_resume(struct ata_link *link, const unsigned long *params, | |
| 1085 | − unsigned long deadline); | |
| 1086 | −extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |
| 1087 | − bool spm_wakeup); | |
| 1088 | −extern int sata_link_hardreset(struct ata_link *link, | |
| 1089 | − const unsigned long *timing, unsigned long deadline, | |
| 1090 | − bool *online, int (*check_ready)(struct ata_link *)); | |
| 1091 | 1069 | extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, |
| 1092 | 1070 | unsigned long deadline); |
| 1093 | 1071 | extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); |
| @@ -1095,7 +1073,6 @@ extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); · 1 unmodified line | ||
| 1095 | 1073 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); |
| 1096 | 1074 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
| 1097 | 1075 | const struct ata_port_info * const * ppi, int n_ports); |
| 1098 | −extern int ata_slave_link_init(struct ata_port *ap); | |
| 1099 | 1076 | extern void ata_host_get(struct ata_host *host); |
| 1100 | 1077 | extern void ata_host_put(struct ata_host *host); |
| 1101 | 1078 | extern int ata_host_start(struct ata_host *host); |
| @@ -1117,22 +1094,6 @@ extern int ata_scsi_ioctl(struct scsi_device *dev, unsigned int cmd, · 15 unmodified lines | ||
| 1117 | 1094 | extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd); |
| 1118 | 1095 | extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev, |
| 1119 | 1096 | unsigned int cmd, void __user *arg); |
| 1120 | −extern void ata_sas_port_destroy(struct ata_port *); | |
| 1121 | −extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | |
| 1122 | − struct ata_port_info *, struct Scsi_Host *); | |
| 1123 | −extern void ata_sas_async_probe(struct ata_port *ap); | |
| 1124 | −extern int ata_sas_sync_probe(struct ata_port *ap); | |
| 1125 | −extern int ata_sas_port_init(struct ata_port *); | |
| 1126 | −extern int ata_sas_port_start(struct ata_port *ap); | |
| 1127 | −extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); | |
| 1128 | −extern void ata_sas_tport_delete(struct ata_port *ap); | |
| 1129 | −extern void ata_sas_port_stop(struct ata_port *ap); | |
| 1130 | −extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | |
| 1131 | −extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap); | |
| 1132 | −extern int sata_scr_valid(struct ata_link *link); | |
| 1133 | −extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); | |
| 1134 | −extern int sata_scr_write(struct ata_link *link, int reg, u32 val); | |
| 1135 | −extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); | |
| 1136 | 1097 | extern bool ata_link_online(struct ata_link *link); |
| 1137 | 1098 | extern bool ata_link_offline(struct ata_link *link); |
| 1138 | 1099 | #ifdef CONFIG_PM |
| @@ -1153,9 +1114,6 @@ extern void ata_msleep(struct ata_port *ap, unsigned int msecs); · 14 unmodified lines | ||
| 1153 | 1114 | extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, |
| 1154 | 1115 | u32 val, unsigned long interval, unsigned long timeout); |
| 1155 | 1116 | extern int atapi_cmd_type(u8 opcode); |
| 1156 | −extern void ata_tf_to_fis(const struct ata_taskfile *tf, | |
| 1157 | − u8 pmp, int is_cmd, u8 *fis); | |
| 1158 | −extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); | |
| 1159 | 1117 | extern unsigned long ata_pack_xfermask(unsigned long pio_mask, |
| 1160 | 1118 | unsigned long mwdma_mask, unsigned long udma_mask); |
| 1161 | 1119 | extern void ata_unpack_xfermask(unsigned long xfer_mask, |
| @@ -1179,7 +1137,6 @@ extern void ata_id_c_string(const u16 *id, unsigned char *s, · 17 unmodified lines | ||
| 1179 | 1137 | extern unsigned int ata_do_dev_read_id(struct ata_device *dev, |
| 1180 | 1138 | struct ata_taskfile *tf, u16 *id); |
| 1181 | 1139 | extern void ata_qc_complete(struct ata_queued_cmd *qc); |
| 1182 | −extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active); | |
| 1183 | 1140 | extern u64 ata_qc_get_active(struct ata_port *ap); |
| 1184 | 1141 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd); |
| 1185 | 1142 | extern int ata_std_bios_param(struct scsi_device *sdev, |
| @@ -1196,7 +1153,96 @@ extern struct ata_device *ata_dev_pair(struct ata_device *adev); · 10 unmodified lines | ||
| 1196 | 1153 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
| 1197 | 1154 | extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); |
| 1198 | 1155 | extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q); |
| 1156 | + | |
| 1157 | +/* | |
| 1158 | + * SATA specific code - drivers/ata/libata-sata.c | |
| 1159 | + */ | |
| 1160 | +#ifdef CONFIG_SATA_HOST | |
| 1161 | +extern const unsigned long sata_deb_timing_normal[]; | |
| 1162 | +extern const unsigned long sata_deb_timing_hotplug[]; | |
| 1163 | +extern const unsigned long sata_deb_timing_long[]; | |
| 1164 | + | |
| 1165 | +static inline const unsigned long * | |
| 1166 | +sata_ehc_deb_timing(struct ata_eh_context *ehc) | |
| 1167 | +{ | |
| 1168 | + if (ehc->i.flags & ATA_EHI_HOTPLUGGED) | |
| 1169 | + return sata_deb_timing_hotplug; | |
| 1170 | + else | |
| 1171 | + return sata_deb_timing_normal; | |
| 1172 | +} | |
| 1173 | + | |
| 1174 | +extern int sata_scr_valid(struct ata_link *link); | |
| 1175 | +extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); | |
| 1176 | +extern int sata_scr_write(struct ata_link *link, int reg, u32 val); | |
| 1177 | +extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); | |
| 1178 | +extern int sata_set_spd(struct ata_link *link); | |
| 1179 | +extern int sata_link_hardreset(struct ata_link *link, | |
| 1180 | + const unsigned long *timing, unsigned long deadline, | |
| 1181 | + bool *online, int (*check_ready)(struct ata_link *)); | |
| 1182 | +extern int sata_link_resume(struct ata_link *link, const unsigned long *params, | |
| 1183 | + unsigned long deadline); | |
| 1184 | +extern void ata_eh_analyze_ncq_error(struct ata_link *link); | |
| 1185 | +#else | |
| 1186 | +static inline const unsigned long * | |
| 1187 | +sata_ehc_deb_timing(struct ata_eh_context *ehc) | |
| 1188 | +{ | |
| 1189 | + return NULL; | |
| 1190 | +} | |
| 1191 | +static inline int sata_scr_valid(struct ata_link *link) { return 0; } | |
| 1192 | +static inline int sata_scr_read(struct ata_link *link, int reg, u32 *val) | |
| 1193 | +{ | |
| 1194 | + return -EOPNOTSUPP; | |
| 1195 | +} | |
| 1196 | +static inline int sata_scr_write(struct ata_link *link, int reg, u32 val) | |
| 1197 | +{ | |
| 1198 | + return -EOPNOTSUPP; | |
| 1199 | +} | |
| 1200 | +static inline int sata_scr_write_flush(struct ata_link *link, int reg, u32 val) | |
| 1201 | +{ | |
| 1202 | + return -EOPNOTSUPP; | |
| 1203 | +} | |
| 1204 | +static inline int sata_set_spd(struct ata_link *link) { return -EOPNOTSUPP; } | |
| 1205 | +static inline int sata_link_hardreset(struct ata_link *link, | |
| 1206 | + const unsigned long *timing, | |
| 1207 | + unsigned long deadline, | |
| 1208 | + bool *online, | |
| 1209 | + int (*check_ready)(struct ata_link *)) | |
| 1210 | +{ | |
| 1211 | + if (online) | |
| 1212 | + *online = false; | |
| 1213 | + return -EOPNOTSUPP; | |
| 1214 | +} | |
| 1215 | +static inline int sata_link_resume(struct ata_link *link, | |
| 1216 | + const unsigned long *params, | |
| 1217 | + unsigned long deadline) | |
| 1218 | +{ | |
| 1219 | + return -EOPNOTSUPP; | |
| 1220 | +} | |
| 1221 | +static inline void ata_eh_analyze_ncq_error(struct ata_link *link) { } | |
| 1222 | +#endif | |
| 1223 | +extern int sata_link_debounce(struct ata_link *link, | |
| 1224 | + const unsigned long *params, unsigned long deadline); | |
| 1225 | +extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |
| 1226 | + bool spm_wakeup); | |
| 1227 | +extern int ata_slave_link_init(struct ata_port *ap); | |
| 1228 | +extern void ata_sas_port_destroy(struct ata_port *); | |
| 1229 | +extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | |
| 1230 | + struct ata_port_info *, struct Scsi_Host *); | |
| 1231 | +extern void ata_sas_async_probe(struct ata_port *ap); | |
| 1232 | +extern int ata_sas_sync_probe(struct ata_port *ap); | |
| 1233 | +extern int ata_sas_port_init(struct ata_port *); | |
| 1234 | +extern int ata_sas_port_start(struct ata_port *ap); | |
| 1235 | +extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); | |
| 1236 | +extern void ata_sas_tport_delete(struct ata_port *ap); | |
| 1237 | +extern void ata_sas_port_stop(struct ata_port *ap); | |
| 1238 | +extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | |
| 1239 | +extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap); | |
| 1240 | +extern void ata_tf_to_fis(const struct ata_taskfile *tf, | |
| 1241 | + u8 pmp, int is_cmd, u8 *fis); | |
| 1242 | +extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); | |
| 1243 | +extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active); | |
| 1199 | 1244 | extern bool sata_lpm_ignore_phy_events(struct ata_link *link); |
| 1245 | +extern int sata_async_notification(struct ata_port *ap); | |
| 1200 | 1246 | |
| 1201 | 1247 | extern int ata_cable_40wire(struct ata_port *ap); |
| 1202 | 1248 | extern int ata_cable_80wire(struct ata_port *ap); |
| @@ -1206,12 +1252,6 @@ extern int ata_cable_unknown(struct ata_port *ap); · 3 unmodified lines | ||
| 1206 | 1252 | |
| 1207 | 1253 | /* Timing helpers */ |
| 1208 | 1254 | extern unsigned int ata_pio_need_iordy(const struct ata_device *); |
| 1209 | −extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); | |
| 1210 | −extern int ata_timing_compute(struct ata_device *, unsigned short, | |
| 1211 | − struct ata_timing *, int, int); | |
| 1212 | −extern void ata_timing_merge(const struct ata_timing *, | |
| 1213 | − const struct ata_timing *, struct ata_timing *, | |
| 1214 | − unsigned int); | |
| 1215 | 1255 | extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle); |
| 1216 | 1256 | |
| 1217 | 1257 | /* PCI */ |
| @@ -1295,14 +1335,12 @@ extern void ata_port_wait_eh(struct ata_port *ap); · 77 unmodified lines | ||
| 1295 | 1335 | extern int ata_link_abort(struct ata_link *link); |
| 1296 | 1336 | extern int ata_port_abort(struct ata_port *ap); |
| 1297 | 1337 | extern int ata_port_freeze(struct ata_port *ap); |
| 1298 | −extern int sata_async_notification(struct ata_port *ap); | |
| 1299 | 1338 | |
| 1300 | 1339 | extern void ata_eh_freeze_port(struct ata_port *ap); |
| 1301 | 1340 | extern void ata_eh_thaw_port(struct ata_port *ap); |
| 1302 | 1341 | |
| 1303 | 1342 | extern void ata_eh_qc_complete(struct ata_queued_cmd *qc); |
| 1304 | 1343 | extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); |
| 1305 | −extern void ata_eh_analyze_ncq_error(struct ata_link *link); | |
| 1306 | 1344 | |
| 1307 | 1345 | extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, |
| 1308 | 1346 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
| @@ -1343,7 +1381,7 @@ extern struct device_attribute *ata_common_sdev_attrs[]; · 34 unmodified lines | ||
| 1343 | 1381 | * edge driver's module reference, otherwise the driver can be unloaded |
| 1344 | 1382 | * even if the scsi_device is being accessed. |
| 1345 | 1383 | */ |
| 1346 | −#define ATA_BASE_SHT(drv_name) \ | |
| 1384 | +#define __ATA_BASE_SHT(drv_name) \ | |
| 1347 | 1385 | .module = THIS_MODULE, \ |
| 1348 | 1386 | .name = drv_name, \ |
| 1349 | 1387 | .ioctl = ata_scsi_ioctl, \ |
| @@ -1357,12 +1395,20 @@ extern struct device_attribute *ata_common_sdev_attrs[]; · 7 unmodified lines | ||
| 1357 | 1395 | .slave_configure = ata_scsi_slave_config, \ |
| 1358 | 1396 | .slave_destroy = ata_scsi_slave_destroy, \ |
| 1359 | 1397 | .bios_param = ata_std_bios_param, \ |
| 1360 | − .unlock_native_capacity = ata_scsi_unlock_native_capacity, \ | |
| 1398 | + .unlock_native_capacity = ata_scsi_unlock_native_capacity | |
| 1399 | + | |
| 1400 | +#define ATA_BASE_SHT(drv_name) \ | |
| 1401 | + __ATA_BASE_SHT(drv_name), \ | |
| 1361 | 1402 | .sdev_attrs = ata_common_sdev_attrs |
| 1362 | 1403 | |
| 1404 | +#ifdef CONFIG_SATA_HOST | |
| 1405 | +extern struct device_attribute *ata_ncq_sdev_attrs[]; | |
| 1406 | + | |
| 1363 | 1407 | #define ATA_NCQ_SHT(drv_name) \ |
| 1364 | − ATA_BASE_SHT(drv_name), \ | |
| 1408 | + __ATA_BASE_SHT(drv_name), \ | |
| 1409 | + .sdev_attrs = ata_ncq_sdev_attrs, \ | |
| 1365 | 1410 | .change_queue_depth = ata_scsi_change_queue_depth |
| 1411 | +#endif | |
| 1366 | 1412 | |
| 1367 | 1413 | /* |
| 1368 | 1414 | * PMP helpers |
| @@ -1635,6 +1681,8 @@ extern struct ata_device *ata_dev_next(struct ata_device *dev, · 266 unmodified lines | ||
| 1635 | 1681 | */ |
| 1636 | 1682 | static inline int ata_ncq_enabled(struct ata_device *dev) |
| 1637 | 1683 | { |
| 1684 | + if (!IS_ENABLED(CONFIG_SATA_HOST)) | |
| 1685 | + return 0; | |
| 1638 | 1686 | return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF | |
| 1639 | 1687 | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; |
| 1640 | 1688 | } |
| @@ -1803,6 +1851,16 @@ static inline int ata_dma_enabled(struct ata_device *adev) · 162 unmodified lines | ||
| 1803 | 1851 | return (adev->dma_mode == 0xFF ? 0 : 1); |
| 1804 | 1852 | } |
| 1805 | 1853 | |
| 1854 | +/************************************************************************** | |
| 1855 | + * PATA timings - drivers/ata/libata-pata-timings.c | |
| 1856 | + */ | |
| 1857 | +extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); | |
| 1858 | +extern int ata_timing_compute(struct ata_device *, unsigned short, | |
| 1859 | + struct ata_timing *, int, int); | |
| 1860 | +extern void ata_timing_merge(const struct ata_timing *, | |
| 1861 | + const struct ata_timing *, struct ata_timing *, | |
| 1862 | + unsigned int); | |
| 1863 | + | |
| 1806 | 1864 | /************************************************************************** |
| 1807 | 1865 | * PMP - drivers/ata/libata-pmp.c |
| 1808 | 1866 | */ |
| @@ -37,6 +37,8 @@ enum { · 36 unmodified lines | ||
| 37 | 37 | NDD_WORK_PENDING = 4, |
| 38 | 38 | /* ignore / filter NSLABEL_FLAG_LOCAL for this DIMM, i.e. no aliasing */ |
| 39 | 39 | NDD_NOBLK = 5, |
| 40 | + /* dimm supports namespace labels */ | |
| 41 | + NDD_LABELING = 6, | |
| 40 | 42 | |
| 41 | 43 | /* need to set a limit somewhere, but yes, this is likely overkill */ |
| 42 | 44 | ND_IOCTL_MAX_BUFLEN = SZ_4M, |
| @@ -4,19 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | #include <uapi/linux/limits.h> |
| 6 | 6 | #include <linux/types.h> |
| 7 | +#include <vdso/limits.h> | |
| 7 | 8 | |
| 8 | −#define USHRT_MAX ((unsigned short)~0U) | |
| 9 | −#define SHRT_MAX ((short)(USHRT_MAX >> 1)) | |
| 10 | −#define SHRT_MIN ((short)(-SHRT_MAX - 1)) | |
| 11 | −#define INT_MAX ((int)(~0U >> 1)) | |
| 12 | −#define INT_MIN (-INT_MAX - 1) | |
| 13 | −#define UINT_MAX (~0U) | |
| 14 | −#define LONG_MAX ((long)(~0UL >> 1)) | |
| 15 | −#define LONG_MIN (-LONG_MAX - 1) | |
| 16 | −#define ULONG_MAX (~0UL) | |
| 17 | −#define LLONG_MAX ((long long)(~0ULL >> 1)) | |
| 18 | −#define LLONG_MIN (-LLONG_MAX - 1) | |
| 19 | −#define ULLONG_MAX (~0ULL) | |
| 20 | 9 | #define SIZE_MAX (~(size_t)0) |
| 21 | 10 | #define PHYS_ADDR_MAX (~(phys_addr_t)0) |
| 22 | 11 | |
| @@ -27,6 +16,7 @@ · 4 unmodified lines | ||
| 27 | 16 | #define S16_MAX ((s16)(U16_MAX >> 1)) |
| 28 | 17 | #define S16_MIN ((s16)(-S16_MAX - 1)) |
| 29 | 18 | #define U32_MAX ((u32)~0U) |
| 19 | +#define U32_MIN ((u32)0) | |
| 30 | 20 | #define S32_MAX ((s32)(U32_MAX >> 1)) |
| 31 | 21 | #define S32_MIN ((s32)(-S32_MAX - 1)) |
| 32 | 22 | #define U64_MAX ((u64)~0ULL) |
| @@ -71,7 +71,7 @@ static inline void linkmode_change_bit(int nr, volatile unsigned long *addr) · 70 unmodified lines | ||
| 71 | 71 | __change_bit(nr, addr); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | −static inline int linkmode_test_bit(int nr, volatile unsigned long *addr) | |
| 74 | +static inline int linkmode_test_bit(int nr, const volatile unsigned long *addr) | |
| 75 | 75 | { |
| 76 | 76 | return test_bit(nr, addr); |
| 77 | 77 | } |
| @@ -88,4 +88,10 @@ static inline int linkmode_subset(const unsigned long *src1, · 10 unmodified lines | ||
| 88 | 88 | return bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | +void linkmode_resolve_pause(const unsigned long *local_adv, | |
| 92 | + const unsigned long *partner_adv, | |
| 93 | + bool *tx_pause, bool *rx_pause); | |
| 94 | + | |
| 95 | +void linkmode_set_pause(unsigned long *advertisement, bool tx, bool rx); | |
| 96 | + | |
| 91 | 97 | #endif /* __LINKMODE_H */ |
| @@ -989,7 +989,7 @@ static inline void hlist_move_list(struct hlist_head *old, · 988 unmodified lines | ||
| 989 | 989 | /** |
| 990 | 990 | * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry |
| 991 | 991 | * @pos: the type * to use as a loop cursor. |
| 992 | − * @n: another &struct hlist_node to use as temporary storage | |
| 992 | + * @n: a &struct hlist_node to use as temporary storage | |
| 993 | 993 | * @head: the head for your list. |
| 994 | 994 | * @member: the name of the hlist_node within the struct. |
| 995 | 995 | */ |
| @@ -21,6 +21,22 @@ extern int lock_stat; · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | #include <linux/types.h> |
| 23 | 23 | |
| 24 | +enum lockdep_wait_type { | |
| 25 | + LD_WAIT_INV = 0, /* not checked, catch all */ | |
| 26 | + | |
| 27 | + LD_WAIT_FREE, /* wait free, rcu etc.. */ | |
| 28 | + LD_WAIT_SPIN, /* spin loops, raw_spinlock_t etc.. */ | |
| 29 | + | |
| 30 | +#ifdef CONFIG_PROVE_RAW_LOCK_NESTING | |
| 31 | + LD_WAIT_CONFIG, /* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */ | |
| 32 | +#else | |
| 33 | + LD_WAIT_CONFIG = LD_WAIT_SPIN, | |
| 34 | +#endif | |
| 35 | + LD_WAIT_SLEEP, /* sleeping locks, mutex_t etc.. */ | |
| 36 | + | |
| 37 | + LD_WAIT_MAX, /* must be last */ | |
| 38 | +}; | |
| 39 | + | |
| 24 | 40 | #ifdef CONFIG_LOCKDEP |
| 25 | 41 | |
| 26 | 42 | #include <linux/linkage.h> |
| @@ -111,6 +127,9 @@ struct lock_class { · 84 unmodified lines | ||
| 111 | 127 | int name_version; |
| 112 | 128 | const char *name; |
| 113 | 129 | |
| 130 | + short wait_type_inner; | |
| 131 | + short wait_type_outer; | |
| 132 | + | |
| 114 | 133 | #ifdef CONFIG_LOCK_STAT |
| 115 | 134 | unsigned long contention_point[LOCKSTAT_POINTS]; |
| 116 | 135 | unsigned long contending_point[LOCKSTAT_POINTS]; |
| @@ -158,6 +177,8 @@ struct lockdep_map { · 41 unmodified lines | ||
| 158 | 177 | struct lock_class_key *key; |
| 159 | 178 | struct lock_class *class_cache[NR_LOCKDEP_CACHING_CLASSES]; |
| 160 | 179 | const char *name; |
| 180 | + short wait_type_outer; /* can be taken in this context */ | |
| 181 | + short wait_type_inner; /* presents this context */ | |
| 161 | 182 | #ifdef CONFIG_LOCK_STAT |
| 162 | 183 | int cpu; |
| 163 | 184 | unsigned long ip; |
| @@ -299,8 +320,21 @@ extern void lockdep_unregister_key(struct lock_class_key *key); · 135 unmodified lines | ||
| 299 | 320 | * to lockdep: |
| 300 | 321 | */ |
| 301 | 322 | |
| 302 | −extern void lockdep_init_map(struct lockdep_map *lock, const char *name, | |
| 303 | − struct lock_class_key *key, int subclass); | |
| 323 | +extern void lockdep_init_map_waits(struct lockdep_map *lock, const char *name, | |
| 324 | + struct lock_class_key *key, int subclass, short inner, short outer); | |
| 325 | + | |
| 326 | +static inline void | |
| 327 | +lockdep_init_map_wait(struct lockdep_map *lock, const char *name, | |
| 328 | + struct lock_class_key *key, int subclass, short inner) | |
| 329 | +{ | |
| 330 | + lockdep_init_map_waits(lock, name, key, subclass, inner, LD_WAIT_INV); | |
| 331 | +} | |
| 332 | + | |
| 333 | +static inline void lockdep_init_map(struct lockdep_map *lock, const char *name, | |
| 334 | + struct lock_class_key *key, int subclass) | |
| 335 | +{ | |
| 336 | + lockdep_init_map_wait(lock, name, key, subclass, LD_WAIT_INV); | |
| 337 | +} | |
| 304 | 338 | |
| 305 | 339 | /* |
| 306 | 340 | * Reinitialize a lock key - for cases where there is special locking or |
| @@ -308,18 +342,29 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, · 1 unmodified line | ||
| 308 | 342 | * of dependencies wrong: they are either too broad (they need a class-split) |
| 309 | 343 | * or they are too narrow (they suffer from a false class-split): |
| 310 | 344 | */ |
| 311 | −#define lockdep_set_class(lock, key) \ | |
| 312 | − lockdep_init_map(&(lock)->dep_map, #key, key, 0) | |
| 313 | −#define lockdep_set_class_and_name(lock, key, name) \ | |
| 314 | − lockdep_init_map(&(lock)->dep_map, name, key, 0) | |
| 315 | −#define lockdep_set_class_and_subclass(lock, key, sub) \ | |
| 316 | − lockdep_init_map(&(lock)->dep_map, #key, key, sub) | |
| 317 | −#define lockdep_set_subclass(lock, sub) \ | |
| 318 | − lockdep_init_map(&(lock)->dep_map, #lock, \ | |
| 319 | − (lock)->dep_map.key, sub) | |
| 345 | +#define lockdep_set_class(lock, key) \ | |
| 346 | + lockdep_init_map_waits(&(lock)->dep_map, #key, key, 0, \ | |
| 347 | + (lock)->dep_map.wait_type_inner, \ | |
| 348 | + (lock)->dep_map.wait_type_outer) | |
| 349 | + | |
| 350 | +#define lockdep_set_class_and_name(lock, key, name) \ | |
| 351 | + lockdep_init_map_waits(&(lock)->dep_map, name, key, 0, \ | |
| 352 | + (lock)->dep_map.wait_type_inner, \ | |
| 353 | + (lock)->dep_map.wait_type_outer) | |
| 354 | + | |
| 355 | +#define lockdep_set_class_and_subclass(lock, key, sub) \ | |
| 356 | + lockdep_init_map_waits(&(lock)->dep_map, #key, key, sub,\ | |
| 357 | + (lock)->dep_map.wait_type_inner, \ | |
| 358 | + (lock)->dep_map.wait_type_outer) | |
| 359 | + | |
| 360 | +#define lockdep_set_subclass(lock, sub) \ | |
| 361 | + lockdep_init_map_waits(&(lock)->dep_map, #lock, (lock)->dep_map.key, sub,\ | |
| 362 | + (lock)->dep_map.wait_type_inner, \ | |
| 363 | + (lock)->dep_map.wait_type_outer) | |
| 320 | 364 | |
| 321 | 365 | #define lockdep_set_novalidate_class(lock) \ |
| 322 | 366 | lockdep_set_class_and_name(lock, &__lockdep_no_validate__, #lock) |
| 367 | + | |
| 323 | 368 | /* |
| 324 | 369 | * Compare locking classes |
| 325 | 370 | */ |
| @@ -432,6 +477,10 @@ static inline void lockdep_set_selftest_task(struct task_struct *task) · 106 unmodified lines | ||
| 432 | 477 | # define lock_set_class(l, n, k, s, i) do { } while (0) |
| 433 | 478 | # define lock_set_subclass(l, s, i) do { } while (0) |
| 434 | 479 | # define lockdep_init() do { } while (0) |
| 480 | +# define lockdep_init_map_waits(lock, name, key, sub, inner, outer) \ | |
| 481 | + do { (void)(name); (void)(key); } while (0) | |
| 482 | +# define lockdep_init_map_wait(lock, name, key, sub, inner) \ | |
| 483 | + do { (void)(name); (void)(key); } while (0) | |
| 435 | 484 | # define lockdep_init_map(lock, name, key, sub) \ |
| 436 | 485 | do { (void)(name); (void)(key); } while (0) |
| 437 | 486 | # define lockdep_set_class(lock, key) do { (void)(key); } while (0) |
| @@ -662,6 +711,21 @@ do { \ · 224 unmodified lines | ||
| 662 | 711 | # define lockdep_assert_in_irq() do { } while (0) |
| 663 | 712 | #endif |
| 664 | 713 | |
| 714 | +#ifdef CONFIG_PROVE_RAW_LOCK_NESTING | |
| 715 | + | |
| 716 | +# define lockdep_assert_RT_in_threaded_ctx() do { \ | |
| 717 | + WARN_ONCE(debug_locks && !current->lockdep_recursion && \ | |
| 718 | + current->hardirq_context && \ | |
| 719 | + !(current->hardirq_threaded || current->irq_config), \ | |
| 720 | + "Not in threaded context on PREEMPT_RT as expected\n"); \ | |
| 721 | +} while (0) | |
| 722 | + | |
| 723 | +#else | |
| 724 | + | |
| 725 | +# define lockdep_assert_RT_in_threaded_ctx() do { } while (0) | |
| 726 | + | |
| 727 | +#endif | |
| 728 | + | |
| 665 | 729 | #ifdef CONFIG_LOCKDEP |
| 666 | 730 | void lockdep_rcu_suspicious(const char *file, const int line, const char *s); |
| 667 | 731 | #else |
| @@ -0,0 +1,381 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | + | |
| 3 | +/* | |
| 4 | + * Linux Security Module Hook declarations. | |
| 5 | + * | |
| 6 | + * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com> | |
| 7 | + * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com> | |
| 8 | + * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com> | |
| 9 | + * Copyright (C) 2001 James Morris <jmorris@intercode.com.au> | |
| 10 | + * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group) | |
| 11 | + * Copyright (C) 2015 Intel Corporation. | |
| 12 | + * Copyright (C) 2015 Casey Schaufler <casey@schaufler-ca.com> | |
| 13 | + * Copyright (C) 2016 Mellanox Techonologies | |
| 14 | + * Copyright (C) 2020 Google LLC. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +/* | |
| 18 | + * The macro LSM_HOOK is used to define the data structures required by the | |
| 19 | + * the LSM framework using the pattern: | |
| 20 | + * | |
| 21 | + * LSM_HOOK(<return_type>, <default_value>, <hook_name>, args...) | |
| 22 | + * | |
| 23 | + * struct security_hook_heads { | |
| 24 | + * #define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME; | |
| 25 | + * #include <linux/lsm_hook_defs.h> | |
| 26 | + * #undef LSM_HOOK | |
| 27 | + * }; | |
| 28 | + */ | |
| 29 | +LSM_HOOK(int, 0, binder_set_context_mgr, struct task_struct *mgr) | |
| 30 | +LSM_HOOK(int, 0, binder_transaction, struct task_struct *from, | |
| 31 | + struct task_struct *to) | |
| 32 | +LSM_HOOK(int, 0, binder_transfer_binder, struct task_struct *from, | |
| 33 | + struct task_struct *to) | |
| 34 | +LSM_HOOK(int, 0, binder_transfer_file, struct task_struct *from, | |
| 35 | + struct task_struct *to, struct file *file) | |
| 36 | +LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child, | |
| 37 | + unsigned int mode) | |
| 38 | +LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent) | |
| 39 | +LSM_HOOK(int, 0, capget, struct task_struct *target, kernel_cap_t *effective, | |
| 40 | + kernel_cap_t *inheritable, kernel_cap_t *permitted) | |
| 41 | +LSM_HOOK(int, 0, capset, struct cred *new, const struct cred *old, | |
| 42 | + const kernel_cap_t *effective, const kernel_cap_t *inheritable, | |
| 43 | + const kernel_cap_t *permitted) | |
| 44 | +LSM_HOOK(int, 0, capable, const struct cred *cred, struct user_namespace *ns, | |
| 45 | + int cap, unsigned int opts) | |
| 46 | +LSM_HOOK(int, 0, quotactl, int cmds, int type, int id, struct super_block *sb) | |
| 47 | +LSM_HOOK(int, 0, quota_on, struct dentry *dentry) | |
| 48 | +LSM_HOOK(int, 0, syslog, int type) | |
| 49 | +LSM_HOOK(int, 0, settime, const struct timespec64 *ts, | |
| 50 | + const struct timezone *tz) | |
| 51 | +LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages) | |
| 52 | +LSM_HOOK(int, 0, bprm_set_creds, struct linux_binprm *bprm) | |
| 53 | +LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm) | |
| 54 | +LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm) | |
| 55 | +LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm) | |
| 56 | +LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc, | |
| 57 | + struct fs_context *src_sc) | |
| 58 | +LSM_HOOK(int, 0, fs_context_parse_param, struct fs_context *fc, | |
| 59 | + struct fs_parameter *param) | |
| 60 | +LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb) | |
| 61 | +LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb) | |
| 62 | +LSM_HOOK(void, LSM_RET_VOID, sb_free_mnt_opts, void *mnt_opts) | |
| 63 | +LSM_HOOK(int, 0, sb_eat_lsm_opts, char *orig, void **mnt_opts) | |
| 64 | +LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts) | |
| 65 | +LSM_HOOK(int, 0, sb_kern_mount, struct super_block *sb) | |
| 66 | +LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb) | |
| 67 | +LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry) | |
| 68 | +LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path, | |
| 69 | + const char *type, unsigned long flags, void *data) | |
| 70 | +LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags) | |
| 71 | +LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path, | |
| 72 | + const struct path *new_path) | |
| 73 | +LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts, | |
| 74 | + unsigned long kern_flags, unsigned long *set_kern_flags) | |
| 75 | +LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb, | |
| 76 | + struct super_block *newsb, unsigned long kern_flags, | |
| 77 | + unsigned long *set_kern_flags) | |
| 78 | +LSM_HOOK(int, 0, sb_add_mnt_opt, const char *option, const char *val, | |
| 79 | + int len, void **mnt_opts) | |
| 80 | +LSM_HOOK(int, 0, move_mount, const struct path *from_path, | |
| 81 | + const struct path *to_path) | |
| 82 | +LSM_HOOK(int, 0, dentry_init_security, struct dentry *dentry, | |
| 83 | + int mode, const struct qstr *name, void **ctx, u32 *ctxlen) | |
| 84 | +LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode, | |
| 85 | + struct qstr *name, const struct cred *old, struct cred *new) | |
| 86 | + | |
| 87 | +#ifdef CONFIG_SECURITY_PATH | |
| 88 | +LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry) | |
| 89 | +LSM_HOOK(int, 0, path_mkdir, const struct path *dir, struct dentry *dentry, | |
| 90 | + umode_t mode) | |
| 91 | +LSM_HOOK(int, 0, path_rmdir, const struct path *dir, struct dentry *dentry) | |
| 92 | +LSM_HOOK(int, 0, path_mknod, const struct path *dir, struct dentry *dentry, | |
| 93 | + umode_t mode, unsigned int dev) | |
| 94 | +LSM_HOOK(int, 0, path_truncate, const struct path *path) | |
| 95 | +LSM_HOOK(int, 0, path_symlink, const struct path *dir, struct dentry *dentry, | |
| 96 | + const char *old_name) | |
| 97 | +LSM_HOOK(int, 0, path_link, struct dentry *old_dentry, | |
| 98 | + const struct path *new_dir, struct dentry *new_dentry) | |
| 99 | +LSM_HOOK(int, 0, path_rename, const struct path *old_dir, | |
| 100 | + struct dentry *old_dentry, const struct path *new_dir, | |
| 101 | + struct dentry *new_dentry) | |
| 102 | +LSM_HOOK(int, 0, path_chmod, const struct path *path, umode_t mode) | |
| 103 | +LSM_HOOK(int, 0, path_chown, const struct path *path, kuid_t uid, kgid_t gid) | |
| 104 | +LSM_HOOK(int, 0, path_chroot, const struct path *path) | |
| 105 | +#endif /* CONFIG_SECURITY_PATH */ | |
| 106 | + | |
| 107 | +/* Needed for inode based security check */ | |
| 108 | +LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask, | |
| 109 | + unsigned int obj_type) | |
| 110 | +LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode) | |
| 111 | +LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode) | |
| 112 | +LSM_HOOK(int, 0, inode_init_security, struct inode *inode, | |
| 113 | + struct inode *dir, const struct qstr *qstr, const char **name, | |
| 114 | + void **value, size_t *len) | |
| 115 | +LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentry, | |
| 116 | + umode_t mode) | |
| 117 | +LSM_HOOK(int, 0, inode_link, struct dentry *old_dentry, struct inode *dir, | |
| 118 | + struct dentry *new_dentry) | |
| 119 | +LSM_HOOK(int, 0, inode_unlink, struct inode *dir, struct dentry *dentry) | |
| 120 | +LSM_HOOK(int, 0, inode_symlink, struct inode *dir, struct dentry *dentry, | |
| 121 | + const char *old_name) | |
| 122 | +LSM_HOOK(int, 0, inode_mkdir, struct inode *dir, struct dentry *dentry, | |
| 123 | + umode_t mode) | |
| 124 | +LSM_HOOK(int, 0, inode_rmdir, struct inode *dir, struct dentry *dentry) | |
| 125 | +LSM_HOOK(int, 0, inode_mknod, struct inode *dir, struct dentry *dentry, | |
| 126 | + umode_t mode, dev_t dev) | |
| 127 | +LSM_HOOK(int, 0, inode_rename, struct inode *old_dir, struct dentry *old_dentry, | |
| 128 | + struct inode *new_dir, struct dentry *new_dentry) | |
| 129 | +LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry) | |
| 130 | +LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode, | |
| 131 | + bool rcu) | |
| 132 | +LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask) | |
| 133 | +LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr) | |
| 134 | +LSM_HOOK(int, 0, inode_getattr, const struct path *path) | |
| 135 | +LSM_HOOK(int, 0, inode_setxattr, struct dentry *dentry, const char *name, | |
| 136 | + const void *value, size_t size, int flags) | |
| 137 | +LSM_HOOK(void, LSM_RET_VOID, inode_post_setxattr, struct dentry *dentry, | |
| 138 | + const char *name, const void *value, size_t size, int flags) | |
| 139 | +LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name) | |
| 140 | +LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry) | |
| 141 | +LSM_HOOK(int, 0, inode_removexattr, struct dentry *dentry, const char *name) | |
| 142 | +LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry) | |
| 143 | +LSM_HOOK(int, 0, inode_killpriv, struct dentry *dentry) | |
| 144 | +LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct inode *inode, | |
| 145 | + const char *name, void **buffer, bool alloc) | |
| 146 | +LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode, | |
| 147 | + const char *name, const void *value, size_t size, int flags) | |
| 148 | +LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer, | |
| 149 | + size_t buffer_size) | |
| 150 | +LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid) | |
| 151 | +LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new) | |
| 152 | +LSM_HOOK(int, 0, inode_copy_up_xattr, const char *name) | |
| 153 | +LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir, | |
| 154 | + struct kernfs_node *kn) | |
| 155 | +LSM_HOOK(int, 0, file_permission, struct file *file, int mask) | |
| 156 | +LSM_HOOK(int, 0, file_alloc_security, struct file *file) | |
| 157 | +LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file) | |
| 158 | +LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd, | |
| 159 | + unsigned long arg) | |
| 160 | +LSM_HOOK(int, 0, mmap_addr, unsigned long addr) | |
| 161 | +LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot, | |
| 162 | + unsigned long prot, unsigned long flags) | |
| 163 | +LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma, | |
| 164 | + unsigned long reqprot, unsigned long prot) | |
| 165 | +LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd) | |
| 166 | +LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd, | |
| 167 | + unsigned long arg) | |
| 168 | +LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file) | |
| 169 | +LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk, | |
| 170 | + struct fown_struct *fown, int sig) | |
| 171 | +LSM_HOOK(int, 0, file_receive, struct file *file) | |
| 172 | +LSM_HOOK(int, 0, file_open, struct file *file) | |
| 173 | +LSM_HOOK(int, 0, task_alloc, struct task_struct *task, | |
| 174 | + unsigned long clone_flags) | |
| 175 | +LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task) | |
| 176 | +LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp) | |
| 177 | +LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred) | |
| 178 | +LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old, | |
| 179 | + gfp_t gfp) | |
| 180 | +LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new, | |
| 181 | + const struct cred *old) | |
| 182 | +LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid) | |
| 183 | +LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid) | |
| 184 | +LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode) | |
| 185 | +LSM_HOOK(int, 0, kernel_module_request, char *kmod_name) | |
| 186 | +LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id) | |
| 187 | +LSM_HOOK(int, 0, kernel_read_file, struct file *file, | |
| 188 | + enum kernel_read_file_id id) | |
| 189 | +LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf, | |
| 190 | + loff_t size, enum kernel_read_file_id id) | |
| 191 | +LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old, | |
| 192 | + int flags) | |
| 193 | +LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid) | |
| 194 | +LSM_HOOK(int, 0, task_getpgid, struct task_struct *p) | |
| 195 | +LSM_HOOK(int, 0, task_getsid, struct task_struct *p) | |
| 196 | +LSM_HOOK(void, LSM_RET_VOID, task_getsecid, struct task_struct *p, u32 *secid) | |
| 197 | +LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice) | |
| 198 | +LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio) | |
| 199 | +LSM_HOOK(int, 0, task_getioprio, struct task_struct *p) | |
| 200 | +LSM_HOOK(int, 0, task_prlimit, const struct cred *cred, | |
| 201 | + const struct cred *tcred, unsigned int flags) | |
| 202 | +LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource, | |
| 203 | + struct rlimit *new_rlim) | |
| 204 | +LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p) | |
| 205 | +LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p) | |
| 206 | +LSM_HOOK(int, 0, task_movememory, struct task_struct *p) | |
| 207 | +LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info, | |
| 208 | + int sig, const struct cred *cred) | |
| 209 | +LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2, | |
| 210 | + unsigned long arg3, unsigned long arg4, unsigned long arg5) | |
| 211 | +LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p, | |
| 212 | + struct inode *inode) | |
| 213 | +LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag) | |
| 214 | +LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp, | |
| 215 | + u32 *secid) | |
| 216 | +LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg) | |
| 217 | +LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg) | |
| 218 | +LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm) | |
| 219 | +LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security, | |
| 220 | + struct kern_ipc_perm *perm) | |
| 221 | +LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg) | |
| 222 | +LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd) | |
| 223 | +LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm, | |
| 224 | + struct msg_msg *msg, int msqflg) | |
| 225 | +LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm, | |
| 226 | + struct msg_msg *msg, struct task_struct *target, long type, int mode) | |
| 227 | +LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm) | |
| 228 | +LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm) | |
| 229 | +LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg) | |
| 230 | +LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd) | |
| 231 | +LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr, | |
| 232 | + int shmflg) | |
| 233 | +LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm) | |
| 234 | +LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm) | |
| 235 | +LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg) | |
| 236 | +LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd) | |
| 237 | +LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops, | |
| 238 | + unsigned nsops, int alter) | |
| 239 | +LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb) | |
| 240 | +LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry, | |
| 241 | + struct inode *inode) | |
| 242 | +LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name, | |
| 243 | + char **value) | |
| 244 | +LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size) | |
| 245 | +LSM_HOOK(int, 0, ismaclabel, const char *name) | |
| 246 | +LSM_HOOK(int, 0, secid_to_secctx, u32 secid, char **secdata, | |
| 247 | + u32 *seclen) | |
| 248 | +LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid) | |
| 249 | +LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen) | |
| 250 | +LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode) | |
| 251 | +LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen) | |
| 252 | +LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen) | |
| 253 | +LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx, | |
| 254 | + u32 *ctxlen) | |
| 255 | + | |
| 256 | +#ifdef CONFIG_SECURITY_NETWORK | |
| 257 | +LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other, | |
| 258 | + struct sock *newsk) | |
| 259 | +LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other) | |
| 260 | +LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern) | |
| 261 | +LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type, | |
| 262 | + int protocol, int kern) | |
| 263 | +LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb) | |
| 264 | +LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address, | |
| 265 | + int addrlen) | |
| 266 | +LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address, | |
| 267 | + int addrlen) | |
| 268 | +LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog) | |
| 269 | +LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock) | |
| 270 | +LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg, | |
| 271 | + int size) | |
| 272 | +LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg, | |
| 273 | + int size, int flags) | |
| 274 | +LSM_HOOK(int, 0, socket_getsockname, struct socket *sock) | |
| 275 | +LSM_HOOK(int, 0, socket_getpeername, struct socket *sock) | |
| 276 | +LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname) | |
| 277 | +LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname) | |
| 278 | +LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how) | |
| 279 | +LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb) | |
| 280 | +LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock, | |
| 281 | + char __user *optval, int __user *optlen, unsigned len) | |
| 282 | +LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock, | |
| 283 | + struct sk_buff *skb, u32 *secid) | |
| 284 | +LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority) | |
| 285 | +LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk) | |
| 286 | +LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk, | |
| 287 | + struct sock *newsk) | |
| 288 | +LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, struct sock *sk, u32 *secid) | |
| 289 | +LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent) | |
| 290 | +LSM_HOOK(int, 0, inet_conn_request, struct sock *sk, struct sk_buff *skb, | |
| 291 | + struct request_sock *req) | |
| 292 | +LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk, | |
| 293 | + const struct request_sock *req) | |
| 294 | +LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk, | |
| 295 | + struct sk_buff *skb) | |
| 296 | +LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid) | |
| 297 | +LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void) | |
| 298 | +LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void) | |
| 299 | +LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req, | |
| 300 | + struct flowi *fl) | |
| 301 | +LSM_HOOK(int, 0, tun_dev_alloc_security, void **security) | |
| 302 | +LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security) | |
| 303 | +LSM_HOOK(int, 0, tun_dev_create, void) | |
| 304 | +LSM_HOOK(int, 0, tun_dev_attach_queue, void *security) | |
| 305 | +LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security) | |
| 306 | +LSM_HOOK(int, 0, tun_dev_open, void *security) | |
| 307 | +LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_endpoint *ep, | |
| 308 | + struct sk_buff *skb) | |
| 309 | +LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname, | |
| 310 | + struct sockaddr *address, int addrlen) | |
| 311 | +LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_endpoint *ep, | |
| 312 | + struct sock *sk, struct sock *newsk) | |
| 313 | +#endif /* CONFIG_SECURITY_NETWORK */ | |
| 314 | + | |
| 315 | +#ifdef CONFIG_SECURITY_INFINIBAND | |
| 316 | +LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey) | |
| 317 | +LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name, | |
| 318 | + u8 port_num) | |
| 319 | +LSM_HOOK(int, 0, ib_alloc_security, void **sec) | |
| 320 | +LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec) | |
| 321 | +#endif /* CONFIG_SECURITY_INFINIBAND */ | |
| 322 | + | |
| 323 | +#ifdef CONFIG_SECURITY_NETWORK_XFRM | |
| 324 | +LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp, | |
| 325 | + struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp) | |
| 326 | +LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx, | |
| 327 | + struct xfrm_sec_ctx **new_ctx) | |
| 328 | +LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security, | |
| 329 | + struct xfrm_sec_ctx *ctx) | |
| 330 | +LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx) | |
| 331 | +LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x, | |
| 332 | + struct xfrm_user_sec_ctx *sec_ctx) | |
| 333 | +LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x, | |
| 334 | + struct xfrm_sec_ctx *polsec, u32 secid) | |
| 335 | +LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x) | |
| 336 | +LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x) | |
| 337 | +LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid, | |
| 338 | + u8 dir) | |
| 339 | +LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x, | |
| 340 | + struct xfrm_policy *xp, const struct flowi *fl) | |
| 341 | +LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid, | |
| 342 | + int ckall) | |
| 343 | +#endif /* CONFIG_SECURITY_NETWORK_XFRM */ | |
| 344 | + | |
| 345 | +/* key management security hooks */ | |
| 346 | +#ifdef CONFIG_KEYS | |
| 347 | +LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred, | |
| 348 | + unsigned long flags) | |
| 349 | +LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key) | |
| 350 | +LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred, | |
| 351 | + unsigned perm) | |
| 352 | +LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **_buffer) | |
| 353 | +#endif /* CONFIG_KEYS */ | |
| 354 | + | |
| 355 | +#ifdef CONFIG_AUDIT | |
| 356 | +LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr, | |
| 357 | + void **lsmrule) | |
| 358 | +LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule) | |
| 359 | +LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule) | |
| 360 | +LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule) | |
| 361 | +#endif /* CONFIG_AUDIT */ | |
| 362 | + | |
| 363 | +#ifdef CONFIG_BPF_SYSCALL | |
| 364 | +LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size) | |
| 365 | +LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode) | |
| 366 | +LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog) | |
| 367 | +LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map) | |
| 368 | +LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map) | |
| 369 | +LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux) | |
| 370 | +LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux) | |
| 371 | +#endif /* CONFIG_BPF_SYSCALL */ | |
| 372 | + | |
| 373 | +LSM_HOOK(int, 0, locked_down, enum lockdown_reason what) | |
| 374 | + | |
| 375 | +#ifdef CONFIG_PERF_EVENTS | |
| 376 | +LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type) | |
| 377 | +LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event) | |
| 378 | +LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event) | |
| 379 | +LSM_HOOK(int, 0, perf_event_read, struct perf_event *event) | |
| 380 | +LSM_HOOK(int, 0, perf_event_write, struct perf_event *event) | |
| 381 | +#endif /* CONFIG_PERF_EVENTS */ | |
| @@ -103,6 +103,10 @@ · 102 unmodified lines | ||
| 103 | 103 | * @sb_free_security: |
| 104 | 104 | * Deallocate and clear the sb->s_security field. |
| 105 | 105 | * @sb contains the super_block structure to be modified. |
| 106 | + * @sb_free_mnt_opts: | |
| 107 | + * Free memory associated with @mnt_ops. | |
| 108 | + * @sb_eat_lsm_opts: | |
| 109 | + * Eat (scan @orig options) and save them in @mnt_opts. | |
| 106 | 110 | * @sb_statfs: |
| 107 | 111 | * Check permission before obtaining filesystem statistics for the @mnt |
| 108 | 112 | * mountpoint. |
| @@ -136,6 +140,10 @@ · 27 unmodified lines | ||
| 136 | 140 | * @sb superblock being remounted |
| 137 | 141 | * @data contains the filesystem-specific data. |
| 138 | 142 | * Return 0 if permission is granted. |
| 143 | + * @sb_kern_mount: | |
| 144 | + * Mount this @sb if allowed by permissions. | |
| 145 | + * @sb_show_options: | |
| 146 | + * Show (print on @m) mount options for this @sb. | |
| 139 | 147 | * @sb_umount: |
| 140 | 148 | * Check permission before the @mnt file system is unmounted. |
| 141 | 149 | * @mnt contains the mounted file system. |
| @@ -155,6 +163,8 @@ · 13 unmodified lines | ||
| 155 | 163 | * Copy all security options from a given superblock to another |
| 156 | 164 | * @oldsb old superblock which contain information to clone |
| 157 | 165 | * @newsb new superblock which needs filled in |
| 166 | + * @sb_add_mnt_opt: | |
| 167 | + * Add one mount @option to @mnt_opts. | |
| 158 | 168 | * @sb_parse_opts_str: |
| 159 | 169 | * Parse a string of security data filling in the opts structure |
| 160 | 170 | * @options string containing all mount options known by the LSM |
| @@ -451,6 +461,12 @@ · 290 unmodified lines | ||
| 451 | 461 | * security module does not know about attribute or a negative error code |
| 452 | 462 | * to abort the copy up. Note that the caller is responsible for reading |
| 453 | 463 | * and writing the xattrs as this hook is merely a filter. |
| 464 | + * @d_instantiate: | |
| 465 | + * Fill in @inode security information for a @dentry if allowed. | |
| 466 | + * @getprocattr: | |
| 467 | + * Read attribute @name for process @p and store it into @value if allowed. | |
| 468 | + * @setprocattr: | |
| 469 | + * Write (set) attribute @name to @value, size @size if allowed. | |
| 454 | 470 | * |
| 455 | 471 | * Security hooks for kernfs node operations |
| 456 | 472 | * |
| @@ -1113,6 +1129,7 @@ · 656 unmodified lines | ||
| 1113 | 1129 | * In case of failure, @secid will be set to zero. |
| 1114 | 1130 | * |
| 1115 | 1131 | * Security hooks for individual messages held in System V IPC message queues |
| 1132 | + * | |
| 1116 | 1133 | * @msg_msg_alloc_security: |
| 1117 | 1134 | * Allocate and attach a security structure to the msg->security field. |
| 1118 | 1135 | * The security field is initialized to NULL when the structure is first |
| @@ -1302,6 +1319,10 @@ · 183 unmodified lines | ||
| 1302 | 1319 | * @cap contains the capability <include/linux/capability.h>. |
| 1303 | 1320 | * @opts contains options for the capable check <include/linux/security.h> |
| 1304 | 1321 | * Return 0 if the capability is granted for @tsk. |
| 1322 | + * @quotactl: | |
| 1323 | + * Check whether the quotactl syscall is allowed for this @sb. | |
| 1324 | + * @quota_on: | |
| 1325 | + * Check whether QUOTAON is allowed for this @dentry. | |
| 1305 | 1326 | * @syslog: |
| 1306 | 1327 | * Check permission before accessing the kernel message ring or changing |
| 1307 | 1328 | * logging to the console. |
| @@ -1449,632 +1470,35 @@ · 141 unmodified lines | ||
| 1449 | 1470 | * @bpf_prog_free_security: |
| 1450 | 1471 | * Clean up the security information stored inside bpf prog. |
| 1451 | 1472 | * |
| 1452 | − * @locked_down | |
| 1473 | + * @locked_down: | |
| 1453 | 1474 | * Determine whether a kernel feature that potentially enables arbitrary |
| 1454 | 1475 | * code execution in kernel space should be permitted. |
| 1455 | 1476 | * |
| 1456 | 1477 | * @what: kernel feature being accessed |
| 1478 | + * | |
| 1479 | + * Security hooks for perf events | |
| 1480 | + * | |
| 1481 | + * @perf_event_open: | |
| 1482 | + * Check whether the @type of perf_event_open syscall is allowed. | |
| 1483 | + * @perf_event_alloc: | |
| 1484 | + * Allocate and save perf_event security info. | |
| 1485 | + * @perf_event_free: | |
| 1486 | + * Release (free) perf_event security info. | |
| 1487 | + * @perf_event_read: | |
| 1488 | + * Read perf_event security info if allowed. | |
| 1489 | + * @perf_event_write: | |
| 1490 | + * Write perf_event security info if allowed. | |
| 1457 | 1491 | */ |
| 1458 | 1492 | union security_list_options { |
| 1459 | − int (*binder_set_context_mgr)(struct task_struct *mgr); | |
| 1460 | − int (*binder_transaction)(struct task_struct *from, | |
| 1461 | − struct task_struct *to); | |
| 1462 | − int (*binder_transfer_binder)(struct task_struct *from, | |
| 1463 | − struct task_struct *to); | |
| 1464 | − int (*binder_transfer_file)(struct task_struct *from, | |
| 1465 | − struct task_struct *to, | |
| 1466 | − struct file *file); | |
| 1467 | − | |
| 1468 | − int (*ptrace_access_check)(struct task_struct *child, | |
| 1469 | − unsigned int mode); | |
| 1470 | − int (*ptrace_traceme)(struct task_struct *parent); | |
| 1471 | − int (*capget)(struct task_struct *target, kernel_cap_t *effective, | |
| 1472 | − kernel_cap_t *inheritable, kernel_cap_t *permitted); | |
| 1473 | − int (*capset)(struct cred *new, const struct cred *old, | |
| 1474 | − const kernel_cap_t *effective, | |
| 1475 | − const kernel_cap_t *inheritable, | |
| 1476 | − const kernel_cap_t *permitted); | |
| 1477 | − int (*capable)(const struct cred *cred, | |
| 1478 | − struct user_namespace *ns, | |
| 1479 | − int cap, | |
| 1480 | − unsigned int opts); | |
| 1481 | − int (*quotactl)(int cmds, int type, int id, struct super_block *sb); | |
| 1482 | − int (*quota_on)(struct dentry *dentry); | |
| 1483 | − int (*syslog)(int type); | |
| 1484 | − int (*settime)(const struct timespec64 *ts, const struct timezone *tz); | |
| 1485 | − int (*vm_enough_memory)(struct mm_struct *mm, long pages); | |
| 1486 | − | |
| 1487 | − int (*bprm_set_creds)(struct linux_binprm *bprm); | |
| 1488 | − int (*bprm_check_security)(struct linux_binprm *bprm); | |
| 1489 | − void (*bprm_committing_creds)(struct linux_binprm *bprm); | |
| 1490 | − void (*bprm_committed_creds)(struct linux_binprm *bprm); | |
| 1491 | − | |
| 1492 | − int (*fs_context_dup)(struct fs_context *fc, struct fs_context *src_sc); | |
| 1493 | − int (*fs_context_parse_param)(struct fs_context *fc, struct fs_parameter *param); | |
| 1494 | − | |
| 1495 | − int (*sb_alloc_security)(struct super_block *sb); | |
| 1496 | − void (*sb_free_security)(struct super_block *sb); | |
| 1497 | − void (*sb_free_mnt_opts)(void *mnt_opts); | |
| 1498 | − int (*sb_eat_lsm_opts)(char *orig, void **mnt_opts); | |
| 1499 | − int (*sb_remount)(struct super_block *sb, void *mnt_opts); | |
| 1500 | − int (*sb_kern_mount)(struct super_block *sb); | |
| 1501 | − int (*sb_show_options)(struct seq_file *m, struct super_block *sb); | |
| 1502 | − int (*sb_statfs)(struct dentry *dentry); | |
| 1503 | − int (*sb_mount)(const char *dev_name, const struct path *path, | |
| 1504 | − const char *type, unsigned long flags, void *data); | |
| 1505 | − int (*sb_umount)(struct vfsmount *mnt, int flags); | |
| 1506 | − int (*sb_pivotroot)(const struct path *old_path, const struct path *new_path); | |
| 1507 | − int (*sb_set_mnt_opts)(struct super_block *sb, | |
| 1508 | − void *mnt_opts, | |
| 1509 | − unsigned long kern_flags, | |
| 1510 | − unsigned long *set_kern_flags); | |
| 1511 | − int (*sb_clone_mnt_opts)(const struct super_block *oldsb, | |
| 1512 | − struct super_block *newsb, | |
| 1513 | − unsigned long kern_flags, | |
| 1514 | − unsigned long *set_kern_flags); | |
| 1515 | − int (*sb_add_mnt_opt)(const char *option, const char *val, int len, | |
| 1516 | − void **mnt_opts); | |
| 1517 | − int (*move_mount)(const struct path *from_path, const struct path *to_path); | |
| 1518 | − int (*dentry_init_security)(struct dentry *dentry, int mode, | |
| 1519 | − const struct qstr *name, void **ctx, | |
| 1520 | − u32 *ctxlen); | |
| 1521 | − int (*dentry_create_files_as)(struct dentry *dentry, int mode, | |
| 1522 | − struct qstr *name, | |
| 1523 | − const struct cred *old, | |
| 1524 | − struct cred *new); | |
| 1525 | − | |
| 1526 | − | |
| 1527 | −#ifdef CONFIG_SECURITY_PATH | |
| 1528 | − int (*path_unlink)(const struct path *dir, struct dentry *dentry); | |
| 1529 | − int (*path_mkdir)(const struct path *dir, struct dentry *dentry, | |
| 1530 | − umode_t mode); | |
| 1531 | − int (*path_rmdir)(const struct path *dir, struct dentry *dentry); | |
| 1532 | − int (*path_mknod)(const struct path *dir, struct dentry *dentry, | |
| 1533 | − umode_t mode, unsigned int dev); | |
| 1534 | − int (*path_truncate)(const struct path *path); | |
| 1535 | − int (*path_symlink)(const struct path *dir, struct dentry *dentry, | |
| 1536 | − const char *old_name); | |
| 1537 | − int (*path_link)(struct dentry *old_dentry, const struct path *new_dir, | |
| 1538 | − struct dentry *new_dentry); | |
| 1539 | − int (*path_rename)(const struct path *old_dir, struct dentry *old_dentry, | |
| 1540 | − const struct path *new_dir, | |
| 1541 | − struct dentry *new_dentry); | |
| 1542 | − int (*path_chmod)(const struct path *path, umode_t mode); | |
| 1543 | − int (*path_chown)(const struct path *path, kuid_t uid, kgid_t gid); | |
| 1544 | − int (*path_chroot)(const struct path *path); | |
| 1545 | −#endif | |
| 1546 | − /* Needed for inode based security check */ | |
| 1547 | − int (*path_notify)(const struct path *path, u64 mask, | |
| 1548 | − unsigned int obj_type); | |
| 1549 | − int (*inode_alloc_security)(struct inode *inode); | |
| 1550 | − void (*inode_free_security)(struct inode *inode); | |
| 1551 | − int (*inode_init_security)(struct inode *inode, struct inode *dir, | |
| 1552 | − const struct qstr *qstr, | |
| 1553 | − const char **name, void **value, | |
| 1554 | − size_t *len); | |
| 1555 | − int (*inode_create)(struct inode *dir, struct dentry *dentry, | |
| 1556 | − umode_t mode); | |
| 1557 | − int (*inode_link)(struct dentry *old_dentry, struct inode *dir, | |
| 1558 | − struct dentry *new_dentry); | |
| 1559 | − int (*inode_unlink)(struct inode *dir, struct dentry *dentry); | |
| 1560 | − int (*inode_symlink)(struct inode *dir, struct dentry *dentry, | |
| 1561 | − const char *old_name); | |
| 1562 | − int (*inode_mkdir)(struct inode *dir, struct dentry *dentry, | |
| 1563 | − umode_t mode); | |
| 1564 | − int (*inode_rmdir)(struct inode *dir, struct dentry *dentry); | |
| 1565 | − int (*inode_mknod)(struct inode *dir, struct dentry *dentry, | |
| 1566 | − umode_t mode, dev_t dev); | |
| 1567 | − int (*inode_rename)(struct inode *old_dir, struct dentry *old_dentry, | |
| 1568 | − struct inode *new_dir, | |
| 1569 | − struct dentry *new_dentry); | |
| 1570 | − int (*inode_readlink)(struct dentry *dentry); | |
| 1571 | − int (*inode_follow_link)(struct dentry *dentry, struct inode *inode, | |
| 1572 | − bool rcu); | |
| 1573 | − int (*inode_permission)(struct inode *inode, int mask); | |
| 1574 | − int (*inode_setattr)(struct dentry *dentry, struct iattr *attr); | |
| 1575 | − int (*inode_getattr)(const struct path *path); | |
| 1576 | − int (*inode_setxattr)(struct dentry *dentry, const char *name, | |
| 1577 | − const void *value, size_t size, int flags); | |
| 1578 | − void (*inode_post_setxattr)(struct dentry *dentry, const char *name, | |
| 1579 | − const void *value, size_t size, | |
| 1580 | − int flags); | |
| 1581 | − int (*inode_getxattr)(struct dentry *dentry, const char *name); | |
| 1582 | − int (*inode_listxattr)(struct dentry *dentry); | |
| 1583 | − int (*inode_removexattr)(struct dentry *dentry, const char *name); | |
| 1584 | − int (*inode_need_killpriv)(struct dentry *dentry); | |
| 1585 | − int (*inode_killpriv)(struct dentry *dentry); | |
| 1586 | − int (*inode_getsecurity)(struct inode *inode, const char *name, | |
| 1587 | − void **buffer, bool alloc); | |
| 1588 | − int (*inode_setsecurity)(struct inode *inode, const char *name, | |
| 1589 | − const void *value, size_t size, | |
| 1590 | − int flags); | |
| 1591 | − int (*inode_listsecurity)(struct inode *inode, char *buffer, | |
| 1592 | − size_t buffer_size); | |
| 1593 | − void (*inode_getsecid)(struct inode *inode, u32 *secid); | |
| 1594 | − int (*inode_copy_up)(struct dentry *src, struct cred **new); | |
| 1595 | − int (*inode_copy_up_xattr)(const char *name); | |
| 1596 | − | |
| 1597 | − int (*kernfs_init_security)(struct kernfs_node *kn_dir, | |
| 1598 | − struct kernfs_node *kn); | |
| 1599 | − | |
| 1600 | − int (*file_permission)(struct file *file, int mask); | |
| 1601 | − int (*file_alloc_security)(struct file *file); | |
| 1602 | − void (*file_free_security)(struct file *file); | |
| 1603 | − int (*file_ioctl)(struct file *file, unsigned int cmd, | |
| 1604 | − unsigned long arg); | |
| 1605 | − int (*mmap_addr)(unsigned long addr); | |
| 1606 | − int (*mmap_file)(struct file *file, unsigned long reqprot, | |
| 1607 | − unsigned long prot, unsigned long flags); | |
| 1608 | − int (*file_mprotect)(struct vm_area_struct *vma, unsigned long reqprot, | |
| 1609 | − unsigned long prot); | |
| 1610 | − int (*file_lock)(struct file *file, unsigned int cmd); | |
| 1611 | − int (*file_fcntl)(struct file *file, unsigned int cmd, | |
| 1612 | − unsigned long arg); | |
| 1613 | − void (*file_set_fowner)(struct file *file); | |
| 1614 | − int (*file_send_sigiotask)(struct task_struct *tsk, | |
| 1615 | − struct fown_struct *fown, int sig); | |
| 1616 | − int (*file_receive)(struct file *file); | |
| 1617 | − int (*file_open)(struct file *file); | |
| 1618 | − | |
| 1619 | − int (*task_alloc)(struct task_struct *task, unsigned long clone_flags); | |
| 1620 | − void (*task_free)(struct task_struct *task); | |
| 1621 | − int (*cred_alloc_blank)(struct cred *cred, gfp_t gfp); | |
| 1622 | − void (*cred_free)(struct cred *cred); | |
| 1623 | − int (*cred_prepare)(struct cred *new, const struct cred *old, | |
| 1624 | − gfp_t gfp); | |
| 1625 | − void (*cred_transfer)(struct cred *new, const struct cred *old); | |
| 1626 | − void (*cred_getsecid)(const struct cred *c, u32 *secid); | |
| 1627 | − int (*kernel_act_as)(struct cred *new, u32 secid); | |
| 1628 | − int (*kernel_create_files_as)(struct cred *new, struct inode *inode); | |
| 1629 | − int (*kernel_module_request)(char *kmod_name); | |
| 1630 | − int (*kernel_load_data)(enum kernel_load_data_id id); | |
| 1631 | − int (*kernel_read_file)(struct file *file, enum kernel_read_file_id id); | |
| 1632 | − int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size, | |
| 1633 | − enum kernel_read_file_id id); | |
| 1634 | − int (*task_fix_setuid)(struct cred *new, const struct cred *old, | |
| 1635 | − int flags); | |
| 1636 | − int (*task_setpgid)(struct task_struct *p, pid_t pgid); | |
| 1637 | − int (*task_getpgid)(struct task_struct *p); | |
| 1638 | − int (*task_getsid)(struct task_struct *p); | |
| 1639 | − void (*task_getsecid)(struct task_struct *p, u32 *secid); | |
| 1640 | − int (*task_setnice)(struct task_struct *p, int nice); | |
| 1641 | − int (*task_setioprio)(struct task_struct *p, int ioprio); | |
| 1642 | − int (*task_getioprio)(struct task_struct *p); | |
| 1643 | − int (*task_prlimit)(const struct cred *cred, const struct cred *tcred, | |
| 1644 | − unsigned int flags); | |
| 1645 | − int (*task_setrlimit)(struct task_struct *p, unsigned int resource, | |
| 1646 | − struct rlimit *new_rlim); | |
| 1647 | − int (*task_setscheduler)(struct task_struct *p); | |
| 1648 | − int (*task_getscheduler)(struct task_struct *p); | |
| 1649 | − int (*task_movememory)(struct task_struct *p); | |
| 1650 | − int (*task_kill)(struct task_struct *p, struct kernel_siginfo *info, | |
| 1651 | − int sig, const struct cred *cred); | |
| 1652 | − int (*task_prctl)(int option, unsigned long arg2, unsigned long arg3, | |
| 1653 | − unsigned long arg4, unsigned long arg5); | |
| 1654 | − void (*task_to_inode)(struct task_struct *p, struct inode *inode); | |
| 1655 | − | |
| 1656 | − int (*ipc_permission)(struct kern_ipc_perm *ipcp, short flag); | |
| 1657 | − void (*ipc_getsecid)(struct kern_ipc_perm *ipcp, u32 *secid); | |
| 1658 | − | |
| 1659 | − int (*msg_msg_alloc_security)(struct msg_msg *msg); | |
| 1660 | − void (*msg_msg_free_security)(struct msg_msg *msg); | |
| 1661 | − | |
| 1662 | − int (*msg_queue_alloc_security)(struct kern_ipc_perm *perm); | |
| 1663 | − void (*msg_queue_free_security)(struct kern_ipc_perm *perm); | |
| 1664 | − int (*msg_queue_associate)(struct kern_ipc_perm *perm, int msqflg); | |
| 1665 | − int (*msg_queue_msgctl)(struct kern_ipc_perm *perm, int cmd); | |
| 1666 | − int (*msg_queue_msgsnd)(struct kern_ipc_perm *perm, struct msg_msg *msg, | |
| 1667 | − int msqflg); | |
| 1668 | − int (*msg_queue_msgrcv)(struct kern_ipc_perm *perm, struct msg_msg *msg, | |
| 1669 | − struct task_struct *target, long type, | |
| 1670 | − int mode); | |
| 1671 | − | |
| 1672 | − int (*shm_alloc_security)(struct kern_ipc_perm *perm); | |
| 1673 | − void (*shm_free_security)(struct kern_ipc_perm *perm); | |
| 1674 | − int (*shm_associate)(struct kern_ipc_perm *perm, int shmflg); | |
| 1675 | − int (*shm_shmctl)(struct kern_ipc_perm *perm, int cmd); | |
| 1676 | − int (*shm_shmat)(struct kern_ipc_perm *perm, char __user *shmaddr, | |
| 1677 | − int shmflg); | |
| 1678 | − | |
| 1679 | − int (*sem_alloc_security)(struct kern_ipc_perm *perm); | |
| 1680 | − void (*sem_free_security)(struct kern_ipc_perm *perm); | |
| 1681 | − int (*sem_associate)(struct kern_ipc_perm *perm, int semflg); | |
| 1682 | − int (*sem_semctl)(struct kern_ipc_perm *perm, int cmd); | |
| 1683 | − int (*sem_semop)(struct kern_ipc_perm *perm, struct sembuf *sops, | |
| 1684 | − unsigned nsops, int alter); | |
| 1685 | − | |
| 1686 | − int (*netlink_send)(struct sock *sk, struct sk_buff *skb); | |
| 1687 | − | |
| 1688 | − void (*d_instantiate)(struct dentry *dentry, struct inode *inode); | |
| 1689 | − | |
| 1690 | − int (*getprocattr)(struct task_struct *p, char *name, char **value); | |
| 1691 | − int (*setprocattr)(const char *name, void *value, size_t size); | |
| 1692 | − int (*ismaclabel)(const char *name); | |
| 1693 | − int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); | |
| 1694 | − int (*secctx_to_secid)(const char *secdata, u32 seclen, u32 *secid); | |
| 1695 | − void (*release_secctx)(char *secdata, u32 seclen); | |
| 1696 | − | |
| 1697 | − void (*inode_invalidate_secctx)(struct inode *inode); | |
| 1698 | − int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen); | |
| 1699 | − int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen); | |
| 1700 | − int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); | |
| 1701 | − | |
| 1702 | −#ifdef CONFIG_SECURITY_NETWORK | |
| 1703 | − int (*unix_stream_connect)(struct sock *sock, struct sock *other, | |
| 1704 | − struct sock *newsk); | |
| 1705 | − int (*unix_may_send)(struct socket *sock, struct socket *other); | |
| 1706 | − | |
| 1707 | − int (*socket_create)(int family, int type, int protocol, int kern); | |
| 1708 | − int (*socket_post_create)(struct socket *sock, int family, int type, | |
| 1709 | − int protocol, int kern); | |
| 1710 | − int (*socket_socketpair)(struct socket *socka, struct socket *sockb); | |
| 1711 | − int (*socket_bind)(struct socket *sock, struct sockaddr *address, | |
| 1712 | − int addrlen); | |
| 1713 | − int (*socket_connect)(struct socket *sock, struct sockaddr *address, | |
| 1714 | − int addrlen); | |
| 1715 | − int (*socket_listen)(struct socket *sock, int backlog); | |
| 1716 | − int (*socket_accept)(struct socket *sock, struct socket *newsock); | |
| 1717 | − int (*socket_sendmsg)(struct socket *sock, struct msghdr *msg, | |
| 1718 | − int size); | |
| 1719 | − int (*socket_recvmsg)(struct socket *sock, struct msghdr *msg, | |
| 1720 | − int size, int flags); | |
| 1721 | − int (*socket_getsockname)(struct socket *sock); | |
| 1722 | − int (*socket_getpeername)(struct socket *sock); | |
| 1723 | − int (*socket_getsockopt)(struct socket *sock, int level, int optname); | |
| 1724 | − int (*socket_setsockopt)(struct socket *sock, int level, int optname); | |
| 1725 | − int (*socket_shutdown)(struct socket *sock, int how); | |
| 1726 | − int (*socket_sock_rcv_skb)(struct sock *sk, struct sk_buff *skb); | |
| 1727 | − int (*socket_getpeersec_stream)(struct socket *sock, | |
| 1728 | − char __user *optval, | |
| 1729 | − int __user *optlen, unsigned len); | |
| 1730 | − int (*socket_getpeersec_dgram)(struct socket *sock, | |
| 1731 | − struct sk_buff *skb, u32 *secid); | |
| 1732 | − int (*sk_alloc_security)(struct sock *sk, int family, gfp_t priority); | |
| 1733 | − void (*sk_free_security)(struct sock *sk); | |
| 1734 | − void (*sk_clone_security)(const struct sock *sk, struct sock *newsk); | |
| 1735 | − void (*sk_getsecid)(struct sock *sk, u32 *secid); | |
| 1736 | − void (*sock_graft)(struct sock *sk, struct socket *parent); | |
| 1737 | − int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, | |
| 1738 | − struct request_sock *req); | |
| 1739 | − void (*inet_csk_clone)(struct sock *newsk, | |
| 1740 | − const struct request_sock *req); | |
| 1741 | − void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb); | |
| 1742 | − int (*secmark_relabel_packet)(u32 secid); | |
| 1743 | − void (*secmark_refcount_inc)(void); | |
| 1744 | − void (*secmark_refcount_dec)(void); | |
| 1745 | − void (*req_classify_flow)(const struct request_sock *req, | |
| 1746 | − struct flowi *fl); | |
| 1747 | − int (*tun_dev_alloc_security)(void **security); | |
| 1748 | − void (*tun_dev_free_security)(void *security); | |
| 1749 | − int (*tun_dev_create)(void); | |
| 1750 | − int (*tun_dev_attach_queue)(void *security); | |
| 1751 | − int (*tun_dev_attach)(struct sock *sk, void *security); | |
| 1752 | − int (*tun_dev_open)(void *security); | |
| 1753 | − int (*sctp_assoc_request)(struct sctp_endpoint *ep, | |
| 1754 | − struct sk_buff *skb); | |
| 1755 | − int (*sctp_bind_connect)(struct sock *sk, int optname, | |
| 1756 | − struct sockaddr *address, int addrlen); | |
| 1757 | − void (*sctp_sk_clone)(struct sctp_endpoint *ep, struct sock *sk, | |
| 1758 | − struct sock *newsk); | |
| 1759 | −#endif /* CONFIG_SECURITY_NETWORK */ | |
| 1760 | − | |
| 1761 | −#ifdef CONFIG_SECURITY_INFINIBAND | |
| 1762 | − int (*ib_pkey_access)(void *sec, u64 subnet_prefix, u16 pkey); | |
| 1763 | − int (*ib_endport_manage_subnet)(void *sec, const char *dev_name, | |
| 1764 | − u8 port_num); | |
| 1765 | − int (*ib_alloc_security)(void **sec); | |
| 1766 | − void (*ib_free_security)(void *sec); | |
| 1767 | −#endif /* CONFIG_SECURITY_INFINIBAND */ | |
| 1768 | − | |
| 1769 | −#ifdef CONFIG_SECURITY_NETWORK_XFRM | |
| 1770 | − int (*xfrm_policy_alloc_security)(struct xfrm_sec_ctx **ctxp, | |
| 1771 | − struct xfrm_user_sec_ctx *sec_ctx, | |
| 1772 | − gfp_t gfp); | |
| 1773 | − int (*xfrm_policy_clone_security)(struct xfrm_sec_ctx *old_ctx, | |
| 1774 | − struct xfrm_sec_ctx **new_ctx); | |
| 1775 | − void (*xfrm_policy_free_security)(struct xfrm_sec_ctx *ctx); | |
| 1776 | − int (*xfrm_policy_delete_security)(struct xfrm_sec_ctx *ctx); | |
| 1777 | − int (*xfrm_state_alloc)(struct xfrm_state *x, | |
| 1778 | − struct xfrm_user_sec_ctx *sec_ctx); | |
| 1779 | − int (*xfrm_state_alloc_acquire)(struct xfrm_state *x, | |
| 1780 | − struct xfrm_sec_ctx *polsec, | |
| 1781 | − u32 secid); | |
| 1782 | − void (*xfrm_state_free_security)(struct xfrm_state *x); | |
| 1783 | − int (*xfrm_state_delete_security)(struct xfrm_state *x); | |
| 1784 | − int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, | |
| 1785 | − u8 dir); | |
| 1786 | − int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, | |
| 1787 | − struct xfrm_policy *xp, | |
| 1788 | − const struct flowi *fl); | |
| 1789 | − int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); | |
| 1790 | −#endif /* CONFIG_SECURITY_NETWORK_XFRM */ | |
| 1791 | − | |
| 1792 | − /* key management security hooks */ | |
| 1793 | −#ifdef CONFIG_KEYS | |
| 1794 | − int (*key_alloc)(struct key *key, const struct cred *cred, | |
| 1795 | − unsigned long flags); | |
| 1796 | − void (*key_free)(struct key *key); | |
| 1797 | − int (*key_permission)(key_ref_t key_ref, const struct cred *cred, | |
| 1798 | − unsigned perm); | |
| 1799 | − int (*key_getsecurity)(struct key *key, char **_buffer); | |
| 1800 | −#endif /* CONFIG_KEYS */ | |
| 1801 | − | |
| 1802 | −#ifdef CONFIG_AUDIT | |
| 1803 | − int (*audit_rule_init)(u32 field, u32 op, char *rulestr, | |
| 1804 | − void **lsmrule); | |
| 1805 | − int (*audit_rule_known)(struct audit_krule *krule); | |
| 1806 | − int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule); | |
| 1807 | − void (*audit_rule_free)(void *lsmrule); | |
| 1808 | −#endif /* CONFIG_AUDIT */ | |
| 1809 | − | |
| 1810 | −#ifdef CONFIG_BPF_SYSCALL | |
| 1811 | − int (*bpf)(int cmd, union bpf_attr *attr, | |
| 1812 | − unsigned int size); | |
| 1813 | − int (*bpf_map)(struct bpf_map *map, fmode_t fmode); | |
| 1814 | − int (*bpf_prog)(struct bpf_prog *prog); | |
| 1815 | − int (*bpf_map_alloc_security)(struct bpf_map *map); | |
| 1816 | − void (*bpf_map_free_security)(struct bpf_map *map); | |
| 1817 | − int (*bpf_prog_alloc_security)(struct bpf_prog_aux *aux); | |
| 1818 | − void (*bpf_prog_free_security)(struct bpf_prog_aux *aux); | |
| 1819 | −#endif /* CONFIG_BPF_SYSCALL */ | |
| 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 | |
| 1493 | + #define LSM_HOOK(RET, DEFAULT, NAME, ...) RET (*NAME)(__VA_ARGS__); | |
| 1494 | + #include "lsm_hook_defs.h" | |
| 1495 | + #undef LSM_HOOK | |
| 1829 | 1496 | }; |
| 1830 | 1497 | |
| 1831 | 1498 | struct security_hook_heads { |
| 1832 | − struct hlist_head binder_set_context_mgr; | |
| 1833 | − struct hlist_head binder_transaction; | |
| 1834 | − struct hlist_head binder_transfer_binder; | |
| 1835 | − struct hlist_head binder_transfer_file; | |
| 1836 | − struct hlist_head ptrace_access_check; | |
| 1837 | − struct hlist_head ptrace_traceme; | |
| 1838 | − struct hlist_head capget; | |
| 1839 | − struct hlist_head capset; | |
| 1840 | − struct hlist_head capable; | |
| 1841 | − struct hlist_head quotactl; | |
| 1842 | − struct hlist_head quota_on; | |
| 1843 | − struct hlist_head syslog; | |
| 1844 | − struct hlist_head settime; | |
| 1845 | − struct hlist_head vm_enough_memory; | |
| 1846 | − struct hlist_head bprm_set_creds; | |
| 1847 | − struct hlist_head bprm_check_security; | |
| 1848 | − struct hlist_head bprm_committing_creds; | |
| 1849 | − struct hlist_head bprm_committed_creds; | |
| 1850 | − struct hlist_head fs_context_dup; | |
| 1851 | − struct hlist_head fs_context_parse_param; | |
| 1852 | − struct hlist_head sb_alloc_security; | |
| 1853 | − struct hlist_head sb_free_security; | |
| 1854 | − struct hlist_head sb_free_mnt_opts; | |
| 1855 | − struct hlist_head sb_eat_lsm_opts; | |
| 1856 | − struct hlist_head sb_remount; | |
| 1857 | − struct hlist_head sb_kern_mount; | |
| 1858 | − struct hlist_head sb_show_options; | |
| 1859 | − struct hlist_head sb_statfs; | |
| 1860 | − struct hlist_head sb_mount; | |
| 1861 | − struct hlist_head sb_umount; | |
| 1862 | − struct hlist_head sb_pivotroot; | |
| 1863 | − struct hlist_head sb_set_mnt_opts; | |
| 1864 | − struct hlist_head sb_clone_mnt_opts; | |
| 1865 | − struct hlist_head sb_add_mnt_opt; | |
| 1866 | − struct hlist_head move_mount; | |
| 1867 | − struct hlist_head dentry_init_security; | |
| 1868 | − struct hlist_head dentry_create_files_as; | |
| 1869 | −#ifdef CONFIG_SECURITY_PATH | |
| 1870 | − struct hlist_head path_unlink; | |
| 1871 | − struct hlist_head path_mkdir; | |
| 1872 | − struct hlist_head path_rmdir; | |
| 1873 | − struct hlist_head path_mknod; | |
| 1874 | − struct hlist_head path_truncate; | |
| 1875 | − struct hlist_head path_symlink; | |
| 1876 | − struct hlist_head path_link; | |
| 1877 | − struct hlist_head path_rename; | |
| 1878 | − struct hlist_head path_chmod; | |
| 1879 | − struct hlist_head path_chown; | |
| 1880 | − struct hlist_head path_chroot; | |
| 1881 | −#endif | |
| 1882 | − /* Needed for inode based modules as well */ | |
| 1883 | − struct hlist_head path_notify; | |
| 1884 | − struct hlist_head inode_alloc_security; | |
| 1885 | − struct hlist_head inode_free_security; | |
| 1886 | − struct hlist_head inode_init_security; | |
| 1887 | − struct hlist_head inode_create; | |
| 1888 | − struct hlist_head inode_link; | |
| 1889 | − struct hlist_head inode_unlink; | |
| 1890 | − struct hlist_head inode_symlink; | |
| 1891 | − struct hlist_head inode_mkdir; | |
| 1892 | − struct hlist_head inode_rmdir; | |
| 1893 | − struct hlist_head inode_mknod; | |
| 1894 | − struct hlist_head inode_rename; | |
| 1895 | − struct hlist_head inode_readlink; | |
| 1896 | − struct hlist_head inode_follow_link; | |
| 1897 | − struct hlist_head inode_permission; | |
| 1898 | − struct hlist_head inode_setattr; | |
| 1899 | − struct hlist_head inode_getattr; | |
| 1900 | − struct hlist_head inode_setxattr; | |
| 1901 | − struct hlist_head inode_post_setxattr; | |
| 1902 | − struct hlist_head inode_getxattr; | |
| 1903 | − struct hlist_head inode_listxattr; | |
| 1904 | − struct hlist_head inode_removexattr; | |
| 1905 | − struct hlist_head inode_need_killpriv; | |
| 1906 | − struct hlist_head inode_killpriv; | |
| 1907 | − struct hlist_head inode_getsecurity; | |
| 1908 | − struct hlist_head inode_setsecurity; | |
| 1909 | − struct hlist_head inode_listsecurity; | |
| 1910 | − struct hlist_head inode_getsecid; | |
| 1911 | − struct hlist_head inode_copy_up; | |
| 1912 | − struct hlist_head inode_copy_up_xattr; | |
| 1913 | − struct hlist_head kernfs_init_security; | |
| 1914 | − struct hlist_head file_permission; | |
| 1915 | − struct hlist_head file_alloc_security; | |
| 1916 | − struct hlist_head file_free_security; | |
| 1917 | − struct hlist_head file_ioctl; | |
| 1918 | − struct hlist_head mmap_addr; | |
| 1919 | − struct hlist_head mmap_file; | |
| 1920 | − struct hlist_head file_mprotect; | |
| 1921 | − struct hlist_head file_lock; | |
| 1922 | − struct hlist_head file_fcntl; | |
| 1923 | − struct hlist_head file_set_fowner; | |
| 1924 | − struct hlist_head file_send_sigiotask; | |
| 1925 | − struct hlist_head file_receive; | |
| 1926 | − struct hlist_head file_open; | |
| 1927 | − struct hlist_head task_alloc; | |
| 1928 | − struct hlist_head task_free; | |
| 1929 | − struct hlist_head cred_alloc_blank; | |
| 1930 | − struct hlist_head cred_free; | |
| 1931 | − struct hlist_head cred_prepare; | |
| 1932 | − struct hlist_head cred_transfer; | |
| 1933 | − struct hlist_head cred_getsecid; | |
| 1934 | − struct hlist_head kernel_act_as; | |
| 1935 | − struct hlist_head kernel_create_files_as; | |
| 1936 | − struct hlist_head kernel_load_data; | |
| 1937 | − struct hlist_head kernel_read_file; | |
| 1938 | − struct hlist_head kernel_post_read_file; | |
| 1939 | − struct hlist_head kernel_module_request; | |
| 1940 | − struct hlist_head task_fix_setuid; | |
| 1941 | − struct hlist_head task_setpgid; | |
| 1942 | − struct hlist_head task_getpgid; | |
| 1943 | − struct hlist_head task_getsid; | |
| 1944 | − struct hlist_head task_getsecid; | |
| 1945 | − struct hlist_head task_setnice; | |
| 1946 | − struct hlist_head task_setioprio; | |
| 1947 | − struct hlist_head task_getioprio; | |
| 1948 | − struct hlist_head task_prlimit; | |
| 1949 | − struct hlist_head task_setrlimit; | |
| 1950 | − struct hlist_head task_setscheduler; | |
| 1951 | − struct hlist_head task_getscheduler; | |
| 1952 | − struct hlist_head task_movememory; | |
| 1953 | − struct hlist_head task_kill; | |
| 1954 | − struct hlist_head task_prctl; | |
| 1955 | − struct hlist_head task_to_inode; | |
| 1956 | − struct hlist_head ipc_permission; | |
| 1957 | − struct hlist_head ipc_getsecid; | |
| 1958 | − struct hlist_head msg_msg_alloc_security; | |
| 1959 | − struct hlist_head msg_msg_free_security; | |
| 1960 | − struct hlist_head msg_queue_alloc_security; | |
| 1961 | − struct hlist_head msg_queue_free_security; | |
| 1962 | − struct hlist_head msg_queue_associate; | |
| 1963 | − struct hlist_head msg_queue_msgctl; | |
| 1964 | − struct hlist_head msg_queue_msgsnd; | |
| 1965 | − struct hlist_head msg_queue_msgrcv; | |
| 1966 | − struct hlist_head shm_alloc_security; | |
| 1967 | − struct hlist_head shm_free_security; | |
| 1968 | − struct hlist_head shm_associate; | |
| 1969 | − struct hlist_head shm_shmctl; | |
| 1970 | − struct hlist_head shm_shmat; | |
| 1971 | − struct hlist_head sem_alloc_security; | |
| 1972 | − struct hlist_head sem_free_security; | |
| 1973 | − struct hlist_head sem_associate; | |
| 1974 | − struct hlist_head sem_semctl; | |
| 1975 | − struct hlist_head sem_semop; | |
| 1976 | − struct hlist_head netlink_send; | |
| 1977 | − struct hlist_head d_instantiate; | |
| 1978 | − struct hlist_head getprocattr; | |
| 1979 | − struct hlist_head setprocattr; | |
| 1980 | − struct hlist_head ismaclabel; | |
| 1981 | − struct hlist_head secid_to_secctx; | |
| 1982 | − struct hlist_head secctx_to_secid; | |
| 1983 | − struct hlist_head release_secctx; | |
| 1984 | − struct hlist_head inode_invalidate_secctx; | |
| 1985 | − struct hlist_head inode_notifysecctx; | |
| 1986 | − struct hlist_head inode_setsecctx; | |
| 1987 | − struct hlist_head inode_getsecctx; | |
| 1988 | −#ifdef CONFIG_SECURITY_NETWORK | |
| 1989 | − struct hlist_head unix_stream_connect; | |
| 1990 | − struct hlist_head unix_may_send; | |
| 1991 | − struct hlist_head socket_create; | |
| 1992 | − struct hlist_head socket_post_create; | |
| 1993 | − struct hlist_head socket_socketpair; | |
| 1994 | − struct hlist_head socket_bind; | |
| 1995 | − struct hlist_head socket_connect; | |
| 1996 | − struct hlist_head socket_listen; | |
| 1997 | − struct hlist_head socket_accept; | |
| 1998 | − struct hlist_head socket_sendmsg; | |
| 1999 | − struct hlist_head socket_recvmsg; | |
| 2000 | − struct hlist_head socket_getsockname; | |
| 2001 | − struct hlist_head socket_getpeername; | |
| 2002 | − struct hlist_head socket_getsockopt; | |
| 2003 | − struct hlist_head socket_setsockopt; | |
| 2004 | − struct hlist_head socket_shutdown; | |
| 2005 | − struct hlist_head socket_sock_rcv_skb; | |
| 2006 | − struct hlist_head socket_getpeersec_stream; | |
| 2007 | − struct hlist_head socket_getpeersec_dgram; | |
| 2008 | − struct hlist_head sk_alloc_security; | |
| 2009 | − struct hlist_head sk_free_security; | |
| 2010 | − struct hlist_head sk_clone_security; | |
| 2011 | − struct hlist_head sk_getsecid; | |
| 2012 | − struct hlist_head sock_graft; | |
| 2013 | − struct hlist_head inet_conn_request; | |
| 2014 | − struct hlist_head inet_csk_clone; | |
| 2015 | − struct hlist_head inet_conn_established; | |
| 2016 | − struct hlist_head secmark_relabel_packet; | |
| 2017 | − struct hlist_head secmark_refcount_inc; | |
| 2018 | − struct hlist_head secmark_refcount_dec; | |
| 2019 | − struct hlist_head req_classify_flow; | |
| 2020 | − struct hlist_head tun_dev_alloc_security; | |
| 2021 | − struct hlist_head tun_dev_free_security; | |
| 2022 | − struct hlist_head tun_dev_create; | |
| 2023 | − struct hlist_head tun_dev_attach_queue; | |
| 2024 | − struct hlist_head tun_dev_attach; | |
| 2025 | − struct hlist_head tun_dev_open; | |
| 2026 | − struct hlist_head sctp_assoc_request; | |
| 2027 | − struct hlist_head sctp_bind_connect; | |
| 2028 | − struct hlist_head sctp_sk_clone; | |
| 2029 | −#endif /* CONFIG_SECURITY_NETWORK */ | |
| 2030 | −#ifdef CONFIG_SECURITY_INFINIBAND | |
| 2031 | − struct hlist_head ib_pkey_access; | |
| 2032 | − struct hlist_head ib_endport_manage_subnet; | |
| 2033 | − struct hlist_head ib_alloc_security; | |
| 2034 | − struct hlist_head ib_free_security; | |
| 2035 | −#endif /* CONFIG_SECURITY_INFINIBAND */ | |
| 2036 | −#ifdef CONFIG_SECURITY_NETWORK_XFRM | |
| 2037 | − struct hlist_head xfrm_policy_alloc_security; | |
| 2038 | − struct hlist_head xfrm_policy_clone_security; | |
| 2039 | − struct hlist_head xfrm_policy_free_security; | |
| 2040 | − struct hlist_head xfrm_policy_delete_security; | |
| 2041 | − struct hlist_head xfrm_state_alloc; | |
| 2042 | − struct hlist_head xfrm_state_alloc_acquire; | |
| 2043 | − struct hlist_head xfrm_state_free_security; | |
| 2044 | − struct hlist_head xfrm_state_delete_security; | |
| 2045 | − struct hlist_head xfrm_policy_lookup; | |
| 2046 | − struct hlist_head xfrm_state_pol_flow_match; | |
| 2047 | − struct hlist_head xfrm_decode_session; | |
| 2048 | −#endif /* CONFIG_SECURITY_NETWORK_XFRM */ | |
| 2049 | −#ifdef CONFIG_KEYS | |
| 2050 | − struct hlist_head key_alloc; | |
| 2051 | − struct hlist_head key_free; | |
| 2052 | − struct hlist_head key_permission; | |
| 2053 | − struct hlist_head key_getsecurity; | |
| 2054 | −#endif /* CONFIG_KEYS */ | |
| 2055 | −#ifdef CONFIG_AUDIT | |
| 2056 | − struct hlist_head audit_rule_init; | |
| 2057 | − struct hlist_head audit_rule_known; | |
| 2058 | − struct hlist_head audit_rule_match; | |
| 2059 | − struct hlist_head audit_rule_free; | |
| 2060 | −#endif /* CONFIG_AUDIT */ | |
| 2061 | −#ifdef CONFIG_BPF_SYSCALL | |
| 2062 | − struct hlist_head bpf; | |
| 2063 | − struct hlist_head bpf_map; | |
| 2064 | − struct hlist_head bpf_prog; | |
| 2065 | − struct hlist_head bpf_map_alloc_security; | |
| 2066 | − struct hlist_head bpf_map_free_security; | |
| 2067 | − struct hlist_head bpf_prog_alloc_security; | |
| 2068 | − struct hlist_head bpf_prog_free_security; | |
| 2069 | −#endif /* CONFIG_BPF_SYSCALL */ | |
| 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 | |
| 1499 | + #define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME; | |
| 1500 | + #include "lsm_hook_defs.h" | |
| 1501 | + #undef LSM_HOOK | |
| 2078 | 1502 | } __randomize_layout; |
| 2079 | 1503 | |
| 2080 | 1504 | /* |
| @@ -2100,6 +1524,12 @@ struct lsm_blob_sizes { · 19 unmodified lines | ||
| 2100 | 1524 | int lbs_task; |
| 2101 | 1525 | }; |
| 2102 | 1526 | |
| 1527 | +/* | |
| 1528 | + * LSM_RET_VOID is used as the default value in LSM_HOOK definitions for void | |
| 1529 | + * LSM hooks (in include/linux/lsm_hook_defs.h). | |
| 1530 | + */ | |
| 1531 | +#define LSM_RET_VOID ((void) 0) | |
| 1532 | + | |
| 2103 | 1533 | /* |
| 2104 | 1534 | * Initializing a security_hook_list structure takes |
| 2105 | 1535 | * up a lot of space in a source file. This macro takes |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #define _LINUX_MATH64_H |
| 4 | 4 | |
| 5 | 5 | #include <linux/types.h> |
| 6 | +#include <vdso/math64.h> | |
| 6 | 7 | #include <asm/div64.h> |
| 7 | 8 | |
| 8 | 9 | #if BITS_PER_LONG == 64 |
| @@ -142,25 +143,6 @@ static inline s64 div_s64(s64 dividend, s32 divisor) · 133 unmodified lines | ||
| 142 | 143 | |
| 143 | 144 | u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder); |
| 144 | 145 | |
| 145 | −static __always_inline u32 | |
| 146 | −__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) | |
| 147 | −{ | |
| 148 | − u32 ret = 0; | |
| 149 | − | |
| 150 | − while (dividend >= divisor) { | |
| 151 | − /* The following asm() prevents the compiler from | |
| 152 | − optimising this loop into a modulo operation. */ | |
| 153 | − asm("" : "+rm"(dividend)); | |
| 154 | − | |
| 155 | − dividend -= divisor; | |
| 156 | − ret++; | |
| 157 | − } | |
| 158 | − | |
| 159 | − *remainder = dividend; | |
| 160 | − | |
| 161 | − return ret; | |
| 162 | −} | |
| 163 | − | |
| 164 | 146 | #ifndef mul_u32_u32 |
| 165 | 147 | /* |
| 166 | 148 | * Many a GCC version messes this up and generates a 64x64 mult :-( |
| @@ -0,0 +1,41 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (c) 2020 Synopsys, Inc. and/or its affiliates. | |
| 4 | + * Synopsys DesignWare XPCS helpers | |
| 5 | + */ | |
| 6 | + | |
| 7 | +#ifndef __LINUX_MDIO_XPCS_H | |
| 8 | +#define __LINUX_MDIO_XPCS_H | |
| 9 | + | |
| 10 | +#include <linux/phy.h> | |
| 11 | +#include <linux/phylink.h> | |
| 12 | + | |
| 13 | +struct mdio_xpcs_args { | |
| 14 | + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); | |
| 15 | + struct mii_bus *bus; | |
| 16 | + int addr; | |
| 17 | +}; | |
| 18 | + | |
| 19 | +struct mdio_xpcs_ops { | |
| 20 | + int (*validate)(struct mdio_xpcs_args *xpcs, | |
| 21 | + unsigned long *supported, | |
| 22 | + struct phylink_link_state *state); | |
| 23 | + int (*config)(struct mdio_xpcs_args *xpcs, | |
| 24 | + const struct phylink_link_state *state); | |
| 25 | + int (*get_state)(struct mdio_xpcs_args *xpcs, | |
| 26 | + struct phylink_link_state *state); | |
| 27 | + int (*link_up)(struct mdio_xpcs_args *xpcs, int speed, | |
| 28 | + phy_interface_t interface); | |
| 29 | + int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface); | |
| 30 | +}; | |
| 31 | + | |
| 32 | +#if IS_ENABLED(CONFIG_MDIO_XPCS) | |
| 33 | +struct mdio_xpcs_ops *mdio_xpcs_get_ops(void); | |
| 34 | +#else | |
| 35 | +static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void) | |
| 36 | +{ | |
| 37 | + return NULL; | |
| 38 | +} | |
| 39 | +#endif | |
| 40 | + | |
| 41 | +#endif /* __LINUX_MDIO_XPCS_H */ | |
| @@ -316,11 +316,15 @@ static inline void mii_10gbt_stat_mod_linkmode_lpa_t(unsigned long *advertising, · 315 unmodified lines | ||
| 316 | 316 | |
| 317 | 317 | int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); |
| 318 | 318 | int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); |
| 319 | +int __mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum, | |
| 320 | + u16 mask, u16 set); | |
| 319 | 321 | |
| 320 | 322 | int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); |
| 321 | 323 | int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum); |
| 322 | 324 | int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); |
| 323 | 325 | int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val); |
| 326 | +int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask, | |
| 327 | + u16 set); | |
| 324 | 328 | |
| 325 | 329 | int mdiobus_register_device(struct mdio_device *mdiodev); |
| 326 | 330 | int mdiobus_unregister_device(struct mdio_device *mdiodev); |
| @@ -348,6 +348,9 @@ static inline int memblock_get_region_node(const struct memblock_region *r) · 347 unmodified lines | ||
| 348 | 348 | |
| 349 | 349 | phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align, |
| 350 | 350 | phys_addr_t start, phys_addr_t end); |
| 351 | +phys_addr_t memblock_alloc_range_nid(phys_addr_t size, | |
| 352 | + phys_addr_t align, phys_addr_t start, | |
| 353 | + phys_addr_t end, int nid, bool exact_nid); | |
| 351 | 354 | phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid); |
| 352 | 355 | |
| 353 | 356 | static inline phys_addr_t memblock_phys_alloc(phys_addr_t size, |
| @@ -695,6 +695,7 @@ static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec, · 694 unmodified lines | ||
| 695 | 695 | void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, |
| 696 | 696 | int val); |
| 697 | 697 | void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val); |
| 698 | +void mod_memcg_obj_state(void *p, int idx, int val); | |
| 698 | 699 | |
| 699 | 700 | static inline void mod_lruvec_state(struct lruvec *lruvec, |
| 700 | 701 | enum node_stat_item idx, int val) |
| @@ -1123,6 +1124,10 @@ static inline void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, · 422 unmodified lines | ||
| 1123 | 1124 | __mod_node_page_state(page_pgdat(page), idx, val); |
| 1124 | 1125 | } |
| 1125 | 1126 | |
| 1127 | +static inline void mod_memcg_obj_state(void *p, int idx, int val) | |
| 1128 | +{ | |
| 1129 | +} | |
| 1130 | + | |
| 1126 | 1131 | static inline |
| 1127 | 1132 | unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, |
| 1128 | 1133 | gfp_t gfp_mask, |
| @@ -1362,12 +1367,11 @@ struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep); · 233 unmodified lines | ||
| 1362 | 1367 | void memcg_kmem_put_cache(struct kmem_cache *cachep); |
| 1363 | 1368 | |
| 1364 | 1369 | #ifdef CONFIG_MEMCG_KMEM |
| 1365 | −int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order); | |
| 1366 | −void __memcg_kmem_uncharge(struct page *page, int order); | |
| 1367 | −int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order, | |
| 1368 | − struct mem_cgroup *memcg); | |
| 1369 | −void __memcg_kmem_uncharge_memcg(struct mem_cgroup *memcg, | |
| 1370 | − unsigned int nr_pages); | |
| 1370 | +int __memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp, | |
| 1371 | + unsigned int nr_pages); | |
| 1372 | +void __memcg_kmem_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages); | |
| 1373 | +int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order); | |
| 1374 | +void __memcg_kmem_uncharge_page(struct page *page, int order); | |
| 1371 | 1375 | |
| 1372 | 1376 | extern struct static_key_false memcg_kmem_enabled_key; |
| 1373 | 1377 | extern struct workqueue_struct *memcg_kmem_cache_wq; |
| @@ -1389,32 +1393,33 @@ static inline bool memcg_kmem_enabled(void) · 15 unmodified lines | ||
| 1389 | 1393 | return static_branch_unlikely(&memcg_kmem_enabled_key); |
| 1390 | 1394 | } |
| 1391 | 1395 | |
| 1392 | −static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order) | |
| 1396 | +static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp, | |
| 1397 | + int order) | |
| 1393 | 1398 | { |
| 1394 | 1399 | if (memcg_kmem_enabled()) |
| 1395 | − return __memcg_kmem_charge(page, gfp, order); | |
| 1400 | + return __memcg_kmem_charge_page(page, gfp, order); | |
| 1396 | 1401 | return 0; |
| 1397 | 1402 | } |
| 1398 | 1403 | |
| 1399 | −static inline void memcg_kmem_uncharge(struct page *page, int order) | |
| 1404 | +static inline void memcg_kmem_uncharge_page(struct page *page, int order) | |
| 1400 | 1405 | { |
| 1401 | 1406 | if (memcg_kmem_enabled()) |
| 1402 | − __memcg_kmem_uncharge(page, order); | |
| 1407 | + __memcg_kmem_uncharge_page(page, order); | |
| 1403 | 1408 | } |
| 1404 | 1409 | |
| 1405 | −static inline int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, | |
| 1406 | − int order, struct mem_cgroup *memcg) | |
| 1410 | +static inline int memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp, | |
| 1411 | + unsigned int nr_pages) | |
| 1407 | 1412 | { |
| 1408 | 1413 | if (memcg_kmem_enabled()) |
| 1409 | − return __memcg_kmem_charge_memcg(page, gfp, order, memcg); | |
| 1414 | + return __memcg_kmem_charge(memcg, gfp, nr_pages); | |
| 1410 | 1415 | return 0; |
| 1411 | 1416 | } |
| 1412 | 1417 | |
| 1413 | −static inline void memcg_kmem_uncharge_memcg(struct page *page, int order, | |
| 1414 | − struct mem_cgroup *memcg) | |
| 1418 | +static inline void memcg_kmem_uncharge(struct mem_cgroup *memcg, | |
| 1419 | + unsigned int nr_pages) | |
| 1415 | 1420 | { |
| 1416 | 1421 | if (memcg_kmem_enabled()) |
| 1417 | − __memcg_kmem_uncharge_memcg(memcg, 1 << order); | |
| 1422 | + __memcg_kmem_uncharge(memcg, nr_pages); | |
| 1418 | 1423 | } |
| 1419 | 1424 | |
| 1420 | 1425 | /* |
| @@ -1427,23 +1432,27 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) · 6 unmodified lines | ||
| 1427 | 1432 | return memcg ? memcg->kmemcg_id : -1; |
| 1428 | 1433 | } |
| 1429 | 1434 | |
| 1435 | +struct mem_cgroup *mem_cgroup_from_obj(void *p); | |
| 1436 | + | |
| 1430 | 1437 | #else |
| 1431 | 1438 | |
| 1432 | −static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order) | |
| 1439 | +static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp, | |
| 1440 | + int order) | |
| 1433 | 1441 | { |
| 1434 | 1442 | return 0; |
| 1435 | 1443 | } |
| 1436 | 1444 | |
| 1437 | −static inline void memcg_kmem_uncharge(struct page *page, int order) | |
| 1445 | +static inline void memcg_kmem_uncharge_page(struct page *page, int order) | |
| 1438 | 1446 | { |
| 1439 | 1447 | } |
| 1440 | 1448 | |
| 1441 | −static inline int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order) | |
| 1449 | +static inline int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, | |
| 1450 | + int order) | |
| 1442 | 1451 | { |
| 1443 | 1452 | return 0; |
| 1444 | 1453 | } |
| 1445 | 1454 | |
| 1446 | −static inline void __memcg_kmem_uncharge(struct page *page, int order) | |
| 1455 | +static inline void __memcg_kmem_uncharge_page(struct page *page, int order) | |
| 1447 | 1456 | { |
| 1448 | 1457 | } |
| 1449 | 1458 | |
| @@ -1468,6 +1477,11 @@ static inline void memcg_put_cache_ids(void) · 18 unmodified lines | ||
| 1468 | 1477 | { |
| 1469 | 1478 | } |
| 1470 | 1479 | |
| 1480 | +static inline struct mem_cgroup *mem_cgroup_from_obj(void *p) | |
| 1481 | +{ | |
| 1482 | + return NULL; | |
| 1483 | +} | |
| 1484 | + | |
| 1471 | 1485 | #endif /* CONFIG_MEMCG_KMEM */ |
| 1472 | 1486 | |
| 1473 | 1487 | #endif /* _LINUX_MEMCONTROL_H */ |
| @@ -26,7 +26,6 @@ · 25 unmodified lines | ||
| 26 | 26 | struct memory_block { |
| 27 | 27 | unsigned long start_section_nr; |
| 28 | 28 | unsigned long state; /* serialized by the dev->lock */ |
| 29 | − int section_count; /* serialized by mem_sysfs_mutex */ | |
| 30 | 29 | int online_type; /* for passing data to online routine */ |
| 31 | 30 | int phys_device; /* to which fru does this belong? */ |
| 32 | 31 | struct device dev; |
| @@ -47,20 +47,25 @@ enum { · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | /* Types for control the zone type of onlined and offlined memory */ |
| 49 | 49 | enum { |
| 50 | − MMOP_OFFLINE = -1, | |
| 51 | − MMOP_ONLINE_KEEP, | |
| 50 | + /* Offline the memory. */ | |
| 51 | + MMOP_OFFLINE = 0, | |
| 52 | + /* Online the memory. Zone depends, see default_zone_for_pfn(). */ | |
| 53 | + MMOP_ONLINE, | |
| 54 | + /* Online the memory to ZONE_NORMAL. */ | |
| 52 | 55 | MMOP_ONLINE_KERNEL, |
| 56 | + /* Online the memory to ZONE_MOVABLE. */ | |
| 53 | 57 | MMOP_ONLINE_MOVABLE, |
| 54 | 58 | }; |
| 55 | 59 | |
| 56 | 60 | /* |
| 57 | − * Restrictions for the memory hotplug: | |
| 58 | − * flags: MHP_ flags | |
| 59 | − * altmap: alternative allocator for memmap array | |
| 61 | + * Extended parameters for memory hotplug: | |
| 62 | + * altmap: alternative allocator for memmap array (optional) | |
| 63 | + * pgprot: page protection flags to apply to newly created page tables | |
| 64 | + * (required) | |
| 60 | 65 | */ |
| 61 | −struct mhp_restrictions { | |
| 62 | − unsigned long flags; | |
| 66 | +struct mhp_params { | |
| 63 | 67 | struct vmem_altmap *altmap; |
| 68 | + pgprot_t pgprot; | |
| 64 | 69 | }; |
| 65 | 70 | |
| 66 | 71 | /* |
| @@ -110,10 +115,13 @@ extern int restore_online_page_callback(online_page_callback_t callback); · 43 unmodified lines | ||
| 110 | 115 | extern int try_online_node(int nid); |
| 111 | 116 | |
| 112 | 117 | extern int arch_add_memory(int nid, u64 start, u64 size, |
| 113 | − struct mhp_restrictions *restrictions); | |
| 118 | + struct mhp_params *params); | |
| 114 | 119 | extern u64 max_mem_size; |
| 115 | 120 | |
| 116 | −extern bool memhp_auto_online; | |
| 121 | +extern int memhp_online_type_from_str(const char *str); | |
| 122 | + | |
| 123 | +/* Default online_type (MMOP_*) when new memory blocks are added. */ | |
| 124 | +extern int memhp_default_online_type; | |
| 117 | 125 | /* If movable_node boot option specified */ |
| 118 | 126 | extern bool movable_node_enabled; |
| 119 | 127 | static inline bool movable_node_is_enabled(void) |
| @@ -128,17 +136,17 @@ extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages, · 8 unmodified lines | ||
| 128 | 136 | |
| 129 | 137 | /* reasonably generic interface to expand the physical pages */ |
| 130 | 138 | extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, |
| 131 | − struct mhp_restrictions *restrictions); | |
| 139 | + struct mhp_params *params); | |
| 132 | 140 | |
| 133 | 141 | #ifndef CONFIG_ARCH_HAS_ADD_PAGES |
| 134 | 142 | static inline int add_pages(int nid, unsigned long start_pfn, |
| 135 | − unsigned long nr_pages, struct mhp_restrictions *restrictions) | |
| 143 | + unsigned long nr_pages, struct mhp_params *params) | |
| 136 | 144 | { |
| 137 | − return __add_pages(nid, start_pfn, nr_pages, restrictions); | |
| 145 | + return __add_pages(nid, start_pfn, nr_pages, params); | |
| 138 | 146 | } |
| 139 | 147 | #else /* ARCH_HAS_ADD_PAGES */ |
| 140 | 148 | int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, |
| 141 | − struct mhp_restrictions *restrictions); | |
| 149 | + struct mhp_params *params); | |
| 142 | 150 | #endif /* ARCH_HAS_ADD_PAGES */ |
| 143 | 151 | |
| 144 | 152 | #ifdef CONFIG_NUMA |
| @@ -173,34 +173,7 @@ extern int mpol_parse_str(char *str, struct mempolicy **mpol); · 172 unmodified lines | ||
| 173 | 173 | extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol); |
| 174 | 174 | |
| 175 | 175 | /* Check if a vma is migratable */ |
| 176 | −static inline bool vma_migratable(struct vm_area_struct *vma) | |
| 177 | −{ | |
| 178 | − if (vma->vm_flags & (VM_IO | VM_PFNMAP)) | |
| 179 | − return false; | |
| 180 | − | |
| 181 | − /* | |
| 182 | − * DAX device mappings require predictable access latency, so avoid | |
| 183 | − * incurring periodic faults. | |
| 184 | − */ | |
| 185 | − if (vma_is_dax(vma)) | |
| 186 | − return false; | |
| 187 | − | |
| 188 | −#ifndef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION | |
| 189 | − if (vma->vm_flags & VM_HUGETLB) | |
| 190 | − return false; | |
| 191 | −#endif | |
| 192 | − | |
| 193 | − /* | |
| 194 | − * Migration allocates pages in the highest zone. If we cannot | |
| 195 | − * do so then migration (at least from node to node) is not | |
| 196 | − * possible. | |
| 197 | − */ | |
| 198 | − if (vma->vm_file && | |
| 199 | − gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping)) | |
| 200 | − < policy_zone) | |
| 201 | − return false; | |
| 202 | − return true; | |
| 203 | −} | |
| 176 | +extern bool vma_migratable(struct vm_area_struct *vma); | |
| 204 | 177 | |
| 205 | 178 | extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long); |
| 206 | 179 | extern void mpol_put_task_policy(struct task_struct *); |
| @@ -98,11 +98,12 @@ struct dev_pagemap_ops { · 97 unmodified lines | ||
| 98 | 98 | * @ref: reference count that pins the devm_memremap_pages() mapping |
| 99 | 99 | * @internal_ref: internal reference if @ref is not provided by the caller |
| 100 | 100 | * @done: completion for @internal_ref |
| 101 | − * @dev: host device of the mapping for debug | |
| 102 | − * @data: private data pointer for page_free() | |
| 103 | 101 | * @type: memory type: see MEMORY_* in memory_hotplug.h |
| 104 | 102 | * @flags: PGMAP_* flags to specify defailed behavior |
| 105 | 103 | * @ops: method table |
| 104 | + * @owner: an opaque pointer identifying the entity that manages this | |
| 105 | + * instance. Used by various helpers to make sure that no | |
| 106 | + * foreign ZONE_DEVICE memory is accessed. | |
| 106 | 107 | */ |
| 107 | 108 | struct dev_pagemap { |
| 108 | 109 | struct vmem_altmap altmap; |
| @@ -113,6 +114,7 @@ struct dev_pagemap { · 4 unmodified lines | ||
| 113 | 114 | enum memory_type type; |
| 114 | 115 | unsigned int flags; |
| 115 | 116 | const struct dev_pagemap_ops *ops; |
| 117 | + void *owner; | |
| 116 | 118 | }; |
| 117 | 119 | |
| 118 | 120 | static inline struct vmem_altmap *pgmap_altmap(struct dev_pagemap *pgmap) |
| @@ -132,6 +134,7 @@ struct dev_pagemap *get_dev_pagemap(unsigned long pfn, · 13 unmodified lines | ||
| 132 | 134 | |
| 133 | 135 | unsigned long vmem_altmap_offset(struct vmem_altmap *altmap); |
| 134 | 136 | void vmem_altmap_free(struct vmem_altmap *altmap, unsigned long nr_pfns); |
| 137 | +unsigned long memremap_compat_align(void); | |
| 135 | 138 | #else |
| 136 | 139 | static inline void *devm_memremap_pages(struct device *dev, |
| 137 | 140 | struct dev_pagemap *pgmap) |
| @@ -165,6 +168,12 @@ static inline void vmem_altmap_free(struct vmem_altmap *altmap, · 27 unmodified lines | ||
| 165 | 168 | unsigned long nr_pfns) |
| 166 | 169 | { |
| 167 | 170 | } |
| 171 | + | |
| 172 | +/* when memremap_pages() is disabled all archs can remap a single page */ | |
| 173 | +static inline unsigned long memremap_compat_align(void) | |
| 174 | +{ | |
| 175 | + return PAGE_SIZE; | |
| 176 | +} | |
| 168 | 177 | #endif /* CONFIG_ZONE_DEVICE */ |
| 169 | 178 | |
| 170 | 179 | static inline void put_dev_pagemap(struct dev_pagemap *pgmap) |
| @@ -172,4 +181,5 @@ static inline void put_dev_pagemap(struct dev_pagemap *pgmap) · 1 unmodified line | ||
| 172 | 181 | if (pgmap) |
| 173 | 182 | percpu_ref_put(pgmap->ref); |
| 174 | 183 | } |
| 184 | + | |
| 175 | 185 | #endif /* _LINUX_MEMREMAP_H_ */ |
| @@ -0,0 +1,139 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 2 | +/* | |
| 3 | + * Azoteq IQS620A/621/622/624/625 Multi-Function Sensors | |
| 4 | + * | |
| 5 | + * Copyright (C) 2019 Jeff LaBundy <jeff@labundy.com> | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __LINUX_MFD_IQS62X_H | |
| 9 | +#define __LINUX_MFD_IQS62X_H | |
| 10 | + | |
| 11 | +#define IQS620_PROD_NUM 0x41 | |
| 12 | +#define IQS621_PROD_NUM 0x46 | |
| 13 | +#define IQS622_PROD_NUM 0x42 | |
| 14 | +#define IQS624_PROD_NUM 0x43 | |
| 15 | +#define IQS625_PROD_NUM 0x4E | |
| 16 | + | |
| 17 | +#define IQS621_ALS_FLAGS 0x16 | |
| 18 | +#define IQS622_ALS_FLAGS 0x14 | |
| 19 | + | |
| 20 | +#define IQS624_HALL_UI 0x70 | |
| 21 | +#define IQS624_HALL_UI_WHL_EVENT BIT(4) | |
| 22 | +#define IQS624_HALL_UI_INT_EVENT BIT(3) | |
| 23 | +#define IQS624_HALL_UI_AUTO_CAL BIT(2) | |
| 24 | + | |
| 25 | +#define IQS624_INTERVAL_DIV 0x7D | |
| 26 | + | |
| 27 | +#define IQS620_GLBL_EVENT_MASK 0xD7 | |
| 28 | +#define IQS620_GLBL_EVENT_MASK_PMU BIT(6) | |
| 29 | + | |
| 30 | +#define IQS62X_NUM_KEYS 16 | |
| 31 | +#define IQS62X_NUM_EVENTS (IQS62X_NUM_KEYS + 5) | |
| 32 | + | |
| 33 | +#define IQS62X_EVENT_SIZE 10 | |
| 34 | + | |
| 35 | +enum iqs62x_ui_sel { | |
| 36 | + IQS62X_UI_PROX, | |
| 37 | + IQS62X_UI_SAR1, | |
| 38 | +}; | |
| 39 | + | |
| 40 | +enum iqs62x_event_reg { | |
| 41 | + IQS62X_EVENT_NONE, | |
| 42 | + IQS62X_EVENT_SYS, | |
| 43 | + IQS62X_EVENT_PROX, | |
| 44 | + IQS62X_EVENT_HYST, | |
| 45 | + IQS62X_EVENT_HALL, | |
| 46 | + IQS62X_EVENT_ALS, | |
| 47 | + IQS62X_EVENT_IR, | |
| 48 | + IQS62X_EVENT_WHEEL, | |
| 49 | + IQS62X_EVENT_INTER, | |
| 50 | + IQS62X_EVENT_UI_LO, | |
| 51 | + IQS62X_EVENT_UI_HI, | |
| 52 | +}; | |
| 53 | + | |
| 54 | +enum iqs62x_event_flag { | |
| 55 | + /* keys */ | |
| 56 | + IQS62X_EVENT_PROX_CH0_T, | |
| 57 | + IQS62X_EVENT_PROX_CH0_P, | |
| 58 | + IQS62X_EVENT_PROX_CH1_T, | |
| 59 | + IQS62X_EVENT_PROX_CH1_P, | |
| 60 | + IQS62X_EVENT_PROX_CH2_T, | |
| 61 | + IQS62X_EVENT_PROX_CH2_P, | |
| 62 | + IQS62X_EVENT_HYST_POS_T, | |
| 63 | + IQS62X_EVENT_HYST_POS_P, | |
| 64 | + IQS62X_EVENT_HYST_NEG_T, | |
| 65 | + IQS62X_EVENT_HYST_NEG_P, | |
| 66 | + IQS62X_EVENT_SAR1_ACT, | |
| 67 | + IQS62X_EVENT_SAR1_QRD, | |
| 68 | + IQS62X_EVENT_SAR1_MOVE, | |
| 69 | + IQS62X_EVENT_SAR1_HALT, | |
| 70 | + IQS62X_EVENT_WHEEL_UP, | |
| 71 | + IQS62X_EVENT_WHEEL_DN, | |
| 72 | + | |
| 73 | + /* switches */ | |
| 74 | + IQS62X_EVENT_HALL_N_T, | |
| 75 | + IQS62X_EVENT_HALL_N_P, | |
| 76 | + IQS62X_EVENT_HALL_S_T, | |
| 77 | + IQS62X_EVENT_HALL_S_P, | |
| 78 | + | |
| 79 | + /* everything else */ | |
| 80 | + IQS62X_EVENT_SYS_RESET, | |
| 81 | +}; | |
| 82 | + | |
| 83 | +struct iqs62x_event_data { | |
| 84 | + u16 ui_data; | |
| 85 | + u8 als_flags; | |
| 86 | + u8 ir_flags; | |
| 87 | + u8 interval; | |
| 88 | +}; | |
| 89 | + | |
| 90 | +struct iqs62x_event_desc { | |
| 91 | + enum iqs62x_event_reg reg; | |
| 92 | + u8 mask; | |
| 93 | + u8 val; | |
| 94 | +}; | |
| 95 | + | |
| 96 | +struct iqs62x_dev_desc { | |
| 97 | + const char *dev_name; | |
| 98 | + const struct mfd_cell *sub_devs; | |
| 99 | + int num_sub_devs; | |
| 100 | + | |
| 101 | + u8 prod_num; | |
| 102 | + u8 sw_num; | |
| 103 | + const u8 *cal_regs; | |
| 104 | + int num_cal_regs; | |
| 105 | + | |
| 106 | + u8 prox_mask; | |
| 107 | + u8 sar_mask; | |
| 108 | + u8 hall_mask; | |
| 109 | + u8 hyst_mask; | |
| 110 | + u8 temp_mask; | |
| 111 | + u8 als_mask; | |
| 112 | + u8 ir_mask; | |
| 113 | + | |
| 114 | + u8 prox_settings; | |
| 115 | + u8 als_flags; | |
| 116 | + u8 hall_flags; | |
| 117 | + u8 hyst_shift; | |
| 118 | + | |
| 119 | + u8 interval; | |
| 120 | + u8 interval_div; | |
| 121 | + | |
| 122 | + u8 clk_div; | |
| 123 | + const char *fw_name; | |
| 124 | + const enum iqs62x_event_reg (*event_regs)[IQS62X_EVENT_SIZE]; | |
| 125 | +}; | |
| 126 | + | |
| 127 | +struct iqs62x_core { | |
| 128 | + const struct iqs62x_dev_desc *dev_desc; | |
| 129 | + struct i2c_client *client; | |
| 130 | + struct regmap *regmap; | |
| 131 | + struct blocking_notifier_head nh; | |
| 132 | + struct list_head fw_blk_head; | |
| 133 | + struct completion fw_done; | |
| 134 | + enum iqs62x_ui_sel ui_sel; | |
| 135 | +}; | |
| 136 | + | |
| 137 | +extern const struct iqs62x_event_desc iqs62x_events[IQS62X_NUM_EVENTS]; | |
| 138 | + | |
| 139 | +#endif /* __LINUX_MFD_IQS62X_H */ | |
| @@ -620,7 +620,5 @@ struct rk808 { · 619 unmodified lines | ||
| 620 | 620 | long variant; |
| 621 | 621 | const struct regmap_config *regmap_cfg; |
| 622 | 622 | const struct regmap_irq_chip *regmap_irq_chip; |
| 623 | − void (*pm_pwroff_fn)(void); | |
| 624 | − void (*pm_pwroff_prep_fn)(void); | |
| 625 | 623 | }; |
| 626 | 624 | #endif /* __LINUX_REGULATOR_RK808_H */ |
| @@ -139,6 +139,17 @@ · 138 unmodified lines | ||
| 139 | 139 | #define RN5T618_INTPOL 0x9c |
| 140 | 140 | #define RN5T618_INTEN 0x9d |
| 141 | 141 | #define RN5T618_INTMON 0x9e |
| 142 | + | |
| 143 | +#define RN5T618_RTC_SECONDS 0xA0 | |
| 144 | +#define RN5T618_RTC_MDAY 0xA4 | |
| 145 | +#define RN5T618_RTC_MONTH 0xA5 | |
| 146 | +#define RN5T618_RTC_YEAR 0xA6 | |
| 147 | +#define RN5T618_RTC_ADJUST 0xA7 | |
| 148 | +#define RN5T618_RTC_ALARM_Y_SEC 0xA8 | |
| 149 | +#define RN5T618_RTC_DAL_MONTH 0xAC | |
| 150 | +#define RN5T618_RTC_CTRL1 0xAE | |
| 151 | +#define RN5T618_RTC_CTRL2 0xAF | |
| 152 | + | |
| 142 | 153 | #define RN5T618_PREVINDAC 0xb0 |
| 143 | 154 | #define RN5T618_BATDAC 0xb1 |
| 144 | 155 | #define RN5T618_CHGCTL1 0xb3 |
| @@ -242,9 +253,24 @@ enum { · 97 unmodified lines | ||
| 242 | 253 | RC5T619, |
| 243 | 254 | }; |
| 244 | 255 | |
| 256 | +/* RN5T618 IRQ definitions */ | |
| 257 | +enum { | |
| 258 | + RN5T618_IRQ_SYS = 0, | |
| 259 | + RN5T618_IRQ_DCDC, | |
| 260 | + RN5T618_IRQ_RTC, | |
| 261 | + RN5T618_IRQ_ADC, | |
| 262 | + RN5T618_IRQ_GPIO, | |
| 263 | + RN5T618_IRQ_CHG, | |
| 264 | + RN5T618_NR_IRQS, | |
| 265 | +}; | |
| 266 | + | |
| 245 | 267 | struct rn5t618 { |
| 246 | 268 | struct regmap *regmap; |
| 269 | + struct device *dev; | |
| 247 | 270 | long variant; |
| 271 | + | |
| 272 | + int irq; | |
| 273 | + struct regmap_irq_chip_data *irq_data; | |
| 248 | 274 | }; |
| 249 | 275 | |
| 250 | 276 | #endif /* __LINUX_MFD_RN5T618_H */ |
| @@ -0,0 +1,7 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __LINUX_MFD_SC27XX_PMIC_H | |
| 3 | +#define __LINUX_MFD_SC27XX_PMIC_H | |
| 4 | + | |
| 5 | +extern enum usb_charger_type sprd_pmic_detect_charger_type(struct device *dev); | |
| 6 | + | |
| 7 | +#endif /* __LINUX_MFD_SC27XX_PMIC_H */ | |
| @@ -89,7 +89,6 @@ enum wm831x_watchdog_action { · 88 unmodified lines | ||
| 89 | 89 | |
| 90 | 90 | struct wm831x_watchdog_pdata { |
| 91 | 91 | enum wm831x_watchdog_action primary, secondary; |
| 92 | − int update_gpio; | |
| 93 | 92 | unsigned int software:1; |
| 94 | 93 | }; |
| 95 | 94 | |
| @@ -33,7 +33,7 @@ struct wm8994_ldo_pdata { · 32 unmodified lines | ||
| 33 | 33 | * DRC configurations are specified with a label and a set of register |
| 34 | 34 | * values to write (the enable bits will be ignored). At runtime an |
| 35 | 35 | * enumerated control will be presented for each DRC block allowing |
| 36 | − * the user to choose the configration to use. | |
| 36 | + * the user to choose the configuration to use. | |
| 37 | 37 | * |
| 38 | 38 | * Configurations may be generated by hand or by using the DRC control |
| 39 | 39 | * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/ |
| @@ -0,0 +1,700 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. | |
| 4 | + * | |
| 5 | + */ | |
| 6 | +#ifndef _MHI_H_ | |
| 7 | +#define _MHI_H_ | |
| 8 | + | |
| 9 | +#include <linux/device.h> | |
| 10 | +#include <linux/dma-direction.h> | |
| 11 | +#include <linux/mutex.h> | |
| 12 | +#include <linux/rwlock_types.h> | |
| 13 | +#include <linux/skbuff.h> | |
| 14 | +#include <linux/slab.h> | |
| 15 | +#include <linux/spinlock_types.h> | |
| 16 | +#include <linux/wait.h> | |
| 17 | +#include <linux/workqueue.h> | |
| 18 | + | |
| 19 | +struct mhi_chan; | |
| 20 | +struct mhi_event; | |
| 21 | +struct mhi_ctxt; | |
| 22 | +struct mhi_cmd; | |
| 23 | +struct mhi_buf_info; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * enum mhi_callback - MHI callback | |
| 27 | + * @MHI_CB_IDLE: MHI entered idle state | |
| 28 | + * @MHI_CB_PENDING_DATA: New data available for client to process | |
| 29 | + * @MHI_CB_LPM_ENTER: MHI host entered low power mode | |
| 30 | + * @MHI_CB_LPM_EXIT: MHI host about to exit low power mode | |
| 31 | + * @MHI_CB_EE_RDDM: MHI device entered RDDM exec env | |
| 32 | + * @MHI_CB_EE_MISSION_MODE: MHI device entered Mission Mode exec env | |
| 33 | + * @MHI_CB_SYS_ERROR: MHI device entered error state (may recover) | |
| 34 | + * @MHI_CB_FATAL_ERROR: MHI device entered fatal error state | |
| 35 | + * @MHI_CB_BW_REQ: Received a bandwidth switch request from device | |
| 36 | + */ | |
| 37 | +enum mhi_callback { | |
| 38 | + MHI_CB_IDLE, | |
| 39 | + MHI_CB_PENDING_DATA, | |
| 40 | + MHI_CB_LPM_ENTER, | |
| 41 | + MHI_CB_LPM_EXIT, | |
| 42 | + MHI_CB_EE_RDDM, | |
| 43 | + MHI_CB_EE_MISSION_MODE, | |
| 44 | + MHI_CB_SYS_ERROR, | |
| 45 | + MHI_CB_FATAL_ERROR, | |
| 46 | + MHI_CB_BW_REQ, | |
| 47 | +}; | |
| 48 | + | |
| 49 | +/** | |
| 50 | + * enum mhi_flags - Transfer flags | |
| 51 | + * @MHI_EOB: End of buffer for bulk transfer | |
| 52 | + * @MHI_EOT: End of transfer | |
| 53 | + * @MHI_CHAIN: Linked transfer | |
| 54 | + */ | |
| 55 | +enum mhi_flags { | |
| 56 | + MHI_EOB, | |
| 57 | + MHI_EOT, | |
| 58 | + MHI_CHAIN, | |
| 59 | +}; | |
| 60 | + | |
| 61 | +/** | |
| 62 | + * enum mhi_device_type - Device types | |
| 63 | + * @MHI_DEVICE_XFER: Handles data transfer | |
| 64 | + * @MHI_DEVICE_CONTROLLER: Control device | |
| 65 | + */ | |
| 66 | +enum mhi_device_type { | |
| 67 | + MHI_DEVICE_XFER, | |
| 68 | + MHI_DEVICE_CONTROLLER, | |
| 69 | +}; | |
| 70 | + | |
| 71 | +/** | |
| 72 | + * enum mhi_ch_type - Channel types | |
| 73 | + * @MHI_CH_TYPE_INVALID: Invalid channel type | |
| 74 | + * @MHI_CH_TYPE_OUTBOUND: Outbound channel to the device | |
| 75 | + * @MHI_CH_TYPE_INBOUND: Inbound channel from the device | |
| 76 | + * @MHI_CH_TYPE_INBOUND_COALESCED: Coalesced channel for the device to combine | |
| 77 | + * multiple packets and send them as a single | |
| 78 | + * large packet to reduce CPU consumption | |
| 79 | + */ | |
| 80 | +enum mhi_ch_type { | |
| 81 | + MHI_CH_TYPE_INVALID = 0, | |
| 82 | + MHI_CH_TYPE_OUTBOUND = DMA_TO_DEVICE, | |
| 83 | + MHI_CH_TYPE_INBOUND = DMA_FROM_DEVICE, | |
| 84 | + MHI_CH_TYPE_INBOUND_COALESCED = 3, | |
| 85 | +}; | |
| 86 | + | |
| 87 | +/** | |
| 88 | + * struct image_info - Firmware and RDDM table table | |
| 89 | + * @mhi_buf - Buffer for firmware and RDDM table | |
| 90 | + * @entries - # of entries in table | |
| 91 | + */ | |
| 92 | +struct image_info { | |
| 93 | + struct mhi_buf *mhi_buf; | |
| 94 | + struct bhi_vec_entry *bhi_vec; | |
| 95 | + u32 entries; | |
| 96 | +}; | |
| 97 | + | |
| 98 | +/** | |
| 99 | + * struct mhi_link_info - BW requirement | |
| 100 | + * target_link_speed - Link speed as defined by TLS bits in LinkControl reg | |
| 101 | + * target_link_width - Link width as defined by NLW bits in LinkStatus reg | |
| 102 | + */ | |
| 103 | +struct mhi_link_info { | |
| 104 | + unsigned int target_link_speed; | |
| 105 | + unsigned int target_link_width; | |
| 106 | +}; | |
| 107 | + | |
| 108 | +/** | |
| 109 | + * enum mhi_ee_type - Execution environment types | |
| 110 | + * @MHI_EE_PBL: Primary Bootloader | |
| 111 | + * @MHI_EE_SBL: Secondary Bootloader | |
| 112 | + * @MHI_EE_AMSS: Modem, aka the primary runtime EE | |
| 113 | + * @MHI_EE_RDDM: Ram dump download mode | |
| 114 | + * @MHI_EE_WFW: WLAN firmware mode | |
| 115 | + * @MHI_EE_PTHRU: Passthrough | |
| 116 | + * @MHI_EE_EDL: Embedded downloader | |
| 117 | + */ | |
| 118 | +enum mhi_ee_type { | |
| 119 | + MHI_EE_PBL, | |
| 120 | + MHI_EE_SBL, | |
| 121 | + MHI_EE_AMSS, | |
| 122 | + MHI_EE_RDDM, | |
| 123 | + MHI_EE_WFW, | |
| 124 | + MHI_EE_PTHRU, | |
| 125 | + MHI_EE_EDL, | |
| 126 | + MHI_EE_MAX_SUPPORTED = MHI_EE_EDL, | |
| 127 | + MHI_EE_DISABLE_TRANSITION, /* local EE, not related to mhi spec */ | |
| 128 | + MHI_EE_NOT_SUPPORTED, | |
| 129 | + MHI_EE_MAX, | |
| 130 | +}; | |
| 131 | + | |
| 132 | +/** | |
| 133 | + * enum mhi_state - MHI states | |
| 134 | + * @MHI_STATE_RESET: Reset state | |
| 135 | + * @MHI_STATE_READY: Ready state | |
| 136 | + * @MHI_STATE_M0: M0 state | |
| 137 | + * @MHI_STATE_M1: M1 state | |
| 138 | + * @MHI_STATE_M2: M2 state | |
| 139 | + * @MHI_STATE_M3: M3 state | |
| 140 | + * @MHI_STATE_M3_FAST: M3 Fast state | |
| 141 | + * @MHI_STATE_BHI: BHI state | |
| 142 | + * @MHI_STATE_SYS_ERR: System Error state | |
| 143 | + */ | |
| 144 | +enum mhi_state { | |
| 145 | + MHI_STATE_RESET = 0x0, | |
| 146 | + MHI_STATE_READY = 0x1, | |
| 147 | + MHI_STATE_M0 = 0x2, | |
| 148 | + MHI_STATE_M1 = 0x3, | |
| 149 | + MHI_STATE_M2 = 0x4, | |
| 150 | + MHI_STATE_M3 = 0x5, | |
| 151 | + MHI_STATE_M3_FAST = 0x6, | |
| 152 | + MHI_STATE_BHI = 0x7, | |
| 153 | + MHI_STATE_SYS_ERR = 0xFF, | |
| 154 | + MHI_STATE_MAX, | |
| 155 | +}; | |
| 156 | + | |
| 157 | +/** | |
| 158 | + * enum mhi_ch_ee_mask - Execution environment mask for channel | |
| 159 | + * @MHI_CH_EE_PBL: Allow channel to be used in PBL EE | |
| 160 | + * @MHI_CH_EE_SBL: Allow channel to be used in SBL EE | |
| 161 | + * @MHI_CH_EE_AMSS: Allow channel to be used in AMSS EE | |
| 162 | + * @MHI_CH_EE_RDDM: Allow channel to be used in RDDM EE | |
| 163 | + * @MHI_CH_EE_PTHRU: Allow channel to be used in PTHRU EE | |
| 164 | + * @MHI_CH_EE_WFW: Allow channel to be used in WFW EE | |
| 165 | + * @MHI_CH_EE_EDL: Allow channel to be used in EDL EE | |
| 166 | + */ | |
| 167 | +enum mhi_ch_ee_mask { | |
| 168 | + MHI_CH_EE_PBL = BIT(MHI_EE_PBL), | |
| 169 | + MHI_CH_EE_SBL = BIT(MHI_EE_SBL), | |
| 170 | + MHI_CH_EE_AMSS = BIT(MHI_EE_AMSS), | |
| 171 | + MHI_CH_EE_RDDM = BIT(MHI_EE_RDDM), | |
| 172 | + MHI_CH_EE_PTHRU = BIT(MHI_EE_PTHRU), | |
| 173 | + MHI_CH_EE_WFW = BIT(MHI_EE_WFW), | |
| 174 | + MHI_CH_EE_EDL = BIT(MHI_EE_EDL), | |
| 175 | +}; | |
| 176 | + | |
| 177 | +/** | |
| 178 | + * enum mhi_er_data_type - Event ring data types | |
| 179 | + * @MHI_ER_DATA: Only client data over this ring | |
| 180 | + * @MHI_ER_CTRL: MHI control data and client data | |
| 181 | + */ | |
| 182 | +enum mhi_er_data_type { | |
| 183 | + MHI_ER_DATA, | |
| 184 | + MHI_ER_CTRL, | |
| 185 | +}; | |
| 186 | + | |
| 187 | +/** | |
| 188 | + * enum mhi_db_brst_mode - Doorbell mode | |
| 189 | + * @MHI_DB_BRST_DISABLE: Burst mode disable | |
| 190 | + * @MHI_DB_BRST_ENABLE: Burst mode enable | |
| 191 | + */ | |
| 192 | +enum mhi_db_brst_mode { | |
| 193 | + MHI_DB_BRST_DISABLE = 0x2, | |
| 194 | + MHI_DB_BRST_ENABLE = 0x3, | |
| 195 | +}; | |
| 196 | + | |
| 197 | +/** | |
| 198 | + * struct mhi_channel_config - Channel configuration structure for controller | |
| 199 | + * @name: The name of this channel | |
| 200 | + * @num: The number assigned to this channel | |
| 201 | + * @num_elements: The number of elements that can be queued to this channel | |
| 202 | + * @local_elements: The local ring length of the channel | |
| 203 | + * @event_ring: The event rung index that services this channel | |
| 204 | + * @dir: Direction that data may flow on this channel | |
| 205 | + * @type: Channel type | |
| 206 | + * @ee_mask: Execution Environment mask for this channel | |
| 207 | + * @pollcfg: Polling configuration for burst mode. 0 is default. milliseconds | |
| 208 | + for UL channels, multiple of 8 ring elements for DL channels | |
| 209 | + * @doorbell: Doorbell mode | |
| 210 | + * @lpm_notify: The channel master requires low power mode notifications | |
| 211 | + * @offload_channel: The client manages the channel completely | |
| 212 | + * @doorbell_mode_switch: Channel switches to doorbell mode on M0 transition | |
| 213 | + * @auto_queue: Framework will automatically queue buffers for DL traffic | |
| 214 | + * @auto_start: Automatically start (open) this channel | |
| 215 | + * @wake-capable: Channel capable of waking up the system | |
| 216 | + */ | |
| 217 | +struct mhi_channel_config { | |
| 218 | + char *name; | |
| 219 | + u32 num; | |
| 220 | + u32 num_elements; | |
| 221 | + u32 local_elements; | |
| 222 | + u32 event_ring; | |
| 223 | + enum dma_data_direction dir; | |
| 224 | + enum mhi_ch_type type; | |
| 225 | + u32 ee_mask; | |
| 226 | + u32 pollcfg; | |
| 227 | + enum mhi_db_brst_mode doorbell; | |
| 228 | + bool lpm_notify; | |
| 229 | + bool offload_channel; | |
| 230 | + bool doorbell_mode_switch; | |
| 231 | + bool auto_queue; | |
| 232 | + bool auto_start; | |
| 233 | + bool wake_capable; | |
| 234 | +}; | |
| 235 | + | |
| 236 | +/** | |
| 237 | + * struct mhi_event_config - Event ring configuration structure for controller | |
| 238 | + * @num_elements: The number of elements that can be queued to this ring | |
| 239 | + * @irq_moderation_ms: Delay irq for additional events to be aggregated | |
| 240 | + * @irq: IRQ associated with this ring | |
| 241 | + * @channel: Dedicated channel number. U32_MAX indicates a non-dedicated ring | |
| 242 | + * @priority: Priority of this ring. Use 1 for now | |
| 243 | + * @mode: Doorbell mode | |
| 244 | + * @data_type: Type of data this ring will process | |
| 245 | + * @hardware_event: This ring is associated with hardware channels | |
| 246 | + * @client_managed: This ring is client managed | |
| 247 | + * @offload_channel: This ring is associated with an offloaded channel | |
| 248 | + */ | |
| 249 | +struct mhi_event_config { | |
| 250 | + u32 num_elements; | |
| 251 | + u32 irq_moderation_ms; | |
| 252 | + u32 irq; | |
| 253 | + u32 channel; | |
| 254 | + u32 priority; | |
| 255 | + enum mhi_db_brst_mode mode; | |
| 256 | + enum mhi_er_data_type data_type; | |
| 257 | + bool hardware_event; | |
| 258 | + bool client_managed; | |
| 259 | + bool offload_channel; | |
| 260 | +}; | |
| 261 | + | |
| 262 | +/** | |
| 263 | + * struct mhi_controller_config - Root MHI controller configuration | |
| 264 | + * @max_channels: Maximum number of channels supported | |
| 265 | + * @timeout_ms: Timeout value for operations. 0 means use default | |
| 266 | + * @buf_len: Size of automatically allocated buffers. 0 means use default | |
| 267 | + * @num_channels: Number of channels defined in @ch_cfg | |
| 268 | + * @ch_cfg: Array of defined channels | |
| 269 | + * @num_events: Number of event rings defined in @event_cfg | |
| 270 | + * @event_cfg: Array of defined event rings | |
| 271 | + * @use_bounce_buf: Use a bounce buffer pool due to limited DDR access | |
| 272 | + * @m2_no_db: Host is not allowed to ring DB in M2 state | |
| 273 | + */ | |
| 274 | +struct mhi_controller_config { | |
| 275 | + u32 max_channels; | |
| 276 | + u32 timeout_ms; | |
| 277 | + u32 buf_len; | |
| 278 | + u32 num_channels; | |
| 279 | + struct mhi_channel_config *ch_cfg; | |
| 280 | + u32 num_events; | |
| 281 | + struct mhi_event_config *event_cfg; | |
| 282 | + bool use_bounce_buf; | |
| 283 | + bool m2_no_db; | |
| 284 | +}; | |
| 285 | + | |
| 286 | +/** | |
| 287 | + * struct mhi_controller - Master MHI controller structure | |
| 288 | + * @cntrl_dev: Pointer to the struct device of physical bus acting as the MHI | |
| 289 | + * controller (required) | |
| 290 | + * @mhi_dev: MHI device instance for the controller | |
| 291 | + * @regs: Base address of MHI MMIO register space (required) | |
| 292 | + * @bhi: Points to base of MHI BHI register space | |
| 293 | + * @bhie: Points to base of MHI BHIe register space | |
| 294 | + * @wake_db: MHI WAKE doorbell register address | |
| 295 | + * @iova_start: IOMMU starting address for data (required) | |
| 296 | + * @iova_stop: IOMMU stop address for data (required) | |
| 297 | + * @fw_image: Firmware image name for normal booting (required) | |
| 298 | + * @edl_image: Firmware image name for emergency download mode (optional) | |
| 299 | + * @rddm_size: RAM dump size that host should allocate for debugging purpose | |
| 300 | + * @sbl_size: SBL image size downloaded through BHIe (optional) | |
| 301 | + * @seg_len: BHIe vector size (optional) | |
| 302 | + * @fbc_image: Points to firmware image buffer | |
| 303 | + * @rddm_image: Points to RAM dump buffer | |
| 304 | + * @mhi_chan: Points to the channel configuration table | |
| 305 | + * @lpm_chans: List of channels that require LPM notifications | |
| 306 | + * @irq: base irq # to request (required) | |
| 307 | + * @max_chan: Maximum number of channels the controller supports | |
| 308 | + * @total_ev_rings: Total # of event rings allocated | |
| 309 | + * @hw_ev_rings: Number of hardware event rings | |
| 310 | + * @sw_ev_rings: Number of software event rings | |
| 311 | + * @nr_irqs_req: Number of IRQs required to operate (optional) | |
| 312 | + * @nr_irqs: Number of IRQ allocated by bus master (required) | |
| 313 | + * @family_number: MHI controller family number | |
| 314 | + * @device_number: MHI controller device number | |
| 315 | + * @major_version: MHI controller major revision number | |
| 316 | + * @minor_version: MHI controller minor revision number | |
| 317 | + * @mhi_event: MHI event ring configurations table | |
| 318 | + * @mhi_cmd: MHI command ring configurations table | |
| 319 | + * @mhi_ctxt: MHI device context, shared memory between host and device | |
| 320 | + * @pm_mutex: Mutex for suspend/resume operation | |
| 321 | + * @pm_lock: Lock for protecting MHI power management state | |
| 322 | + * @timeout_ms: Timeout in ms for state transitions | |
| 323 | + * @pm_state: MHI power management state | |
| 324 | + * @db_access: DB access states | |
| 325 | + * @ee: MHI device execution environment | |
| 326 | + * @dev_state: MHI device state | |
| 327 | + * @dev_wake: Device wakeup count | |
| 328 | + * @pending_pkts: Pending packets for the controller | |
| 329 | + * @transition_list: List of MHI state transitions | |
| 330 | + * @transition_lock: Lock for protecting MHI state transition list | |
| 331 | + * @wlock: Lock for protecting device wakeup | |
| 332 | + * @mhi_link_info: Device bandwidth info | |
| 333 | + * @st_worker: State transition worker | |
| 334 | + * @fw_worker: Firmware download worker | |
| 335 | + * @syserr_worker: System error worker | |
| 336 | + * @state_event: State change event | |
| 337 | + * @status_cb: CB function to notify power states of the device (required) | |
| 338 | + * @link_status: CB function to query link status of the device (required) | |
| 339 | + * @wake_get: CB function to assert device wake (optional) | |
| 340 | + * @wake_put: CB function to de-assert device wake (optional) | |
| 341 | + * @wake_toggle: CB function to assert and de-assert device wake (optional) | |
| 342 | + * @runtime_get: CB function to controller runtime resume (required) | |
| 343 | + * @runtimet_put: CB function to decrement pm usage (required) | |
| 344 | + * @map_single: CB function to create TRE buffer | |
| 345 | + * @unmap_single: CB function to destroy TRE buffer | |
| 346 | + * @buffer_len: Bounce buffer length | |
| 347 | + * @bounce_buf: Use of bounce buffer | |
| 348 | + * @fbc_download: MHI host needs to do complete image transfer (optional) | |
| 349 | + * @pre_init: MHI host needs to do pre-initialization before power up | |
| 350 | + * @wake_set: Device wakeup set flag | |
| 351 | + * | |
| 352 | + * Fields marked as (required) need to be populated by the controller driver | |
| 353 | + * before calling mhi_register_controller(). For the fields marked as (optional) | |
| 354 | + * they can be populated depending on the usecase. | |
| 355 | + * | |
| 356 | + * The following fields are present for the purpose of implementing any device | |
| 357 | + * specific quirks or customizations for specific MHI revisions used in device | |
| 358 | + * by the controller drivers. The MHI stack will just populate these fields | |
| 359 | + * during mhi_register_controller(): | |
| 360 | + * family_number | |
| 361 | + * device_number | |
| 362 | + * major_version | |
| 363 | + * minor_version | |
| 364 | + */ | |
| 365 | +struct mhi_controller { | |
| 366 | + struct device *cntrl_dev; | |
| 367 | + struct mhi_device *mhi_dev; | |
| 368 | + void __iomem *regs; | |
| 369 | + void __iomem *bhi; | |
| 370 | + void __iomem *bhie; | |
| 371 | + void __iomem *wake_db; | |
| 372 | + | |
| 373 | + dma_addr_t iova_start; | |
| 374 | + dma_addr_t iova_stop; | |
| 375 | + const char *fw_image; | |
| 376 | + const char *edl_image; | |
| 377 | + size_t rddm_size; | |
| 378 | + size_t sbl_size; | |
| 379 | + size_t seg_len; | |
| 380 | + struct image_info *fbc_image; | |
| 381 | + struct image_info *rddm_image; | |
| 382 | + struct mhi_chan *mhi_chan; | |
| 383 | + struct list_head lpm_chans; | |
| 384 | + int *irq; | |
| 385 | + u32 max_chan; | |
| 386 | + u32 total_ev_rings; | |
| 387 | + u32 hw_ev_rings; | |
| 388 | + u32 sw_ev_rings; | |
| 389 | + u32 nr_irqs_req; | |
| 390 | + u32 nr_irqs; | |
| 391 | + u32 family_number; | |
| 392 | + u32 device_number; | |
| 393 | + u32 major_version; | |
| 394 | + u32 minor_version; | |
| 395 | + | |
| 396 | + struct mhi_event *mhi_event; | |
| 397 | + struct mhi_cmd *mhi_cmd; | |
| 398 | + struct mhi_ctxt *mhi_ctxt; | |
| 399 | + | |
| 400 | + struct mutex pm_mutex; | |
| 401 | + rwlock_t pm_lock; | |
| 402 | + u32 timeout_ms; | |
| 403 | + u32 pm_state; | |
| 404 | + u32 db_access; | |
| 405 | + enum mhi_ee_type ee; | |
| 406 | + enum mhi_state dev_state; | |
| 407 | + atomic_t dev_wake; | |
| 408 | + atomic_t pending_pkts; | |
| 409 | + struct list_head transition_list; | |
| 410 | + spinlock_t transition_lock; | |
| 411 | + spinlock_t wlock; | |
| 412 | + struct mhi_link_info mhi_link_info; | |
| 413 | + struct work_struct st_worker; | |
| 414 | + struct work_struct fw_worker; | |
| 415 | + struct work_struct syserr_worker; | |
| 416 | + wait_queue_head_t state_event; | |
| 417 | + | |
| 418 | + void (*status_cb)(struct mhi_controller *mhi_cntrl, | |
| 419 | + enum mhi_callback cb); | |
| 420 | + int (*link_status)(struct mhi_controller *mhi_cntrl); | |
| 421 | + void (*wake_get)(struct mhi_controller *mhi_cntrl, bool override); | |
| 422 | + void (*wake_put)(struct mhi_controller *mhi_cntrl, bool override); | |
| 423 | + void (*wake_toggle)(struct mhi_controller *mhi_cntrl); | |
| 424 | + int (*runtime_get)(struct mhi_controller *mhi_cntrl); | |
| 425 | + void (*runtime_put)(struct mhi_controller *mhi_cntrl); | |
| 426 | + int (*map_single)(struct mhi_controller *mhi_cntrl, | |
| 427 | + struct mhi_buf_info *buf); | |
| 428 | + void (*unmap_single)(struct mhi_controller *mhi_cntrl, | |
| 429 | + struct mhi_buf_info *buf); | |
| 430 | + | |
| 431 | + size_t buffer_len; | |
| 432 | + bool bounce_buf; | |
| 433 | + bool fbc_download; | |
| 434 | + bool pre_init; | |
| 435 | + bool wake_set; | |
| 436 | +}; | |
| 437 | + | |
| 438 | +/** | |
| 439 | + * struct mhi_device - Structure representing a MHI device which binds | |
| 440 | + * to channels | |
| 441 | + * @id: Pointer to MHI device ID struct | |
| 442 | + * @chan_name: Name of the channel to which the device binds | |
| 443 | + * @mhi_cntrl: Controller the device belongs to | |
| 444 | + * @ul_chan: UL channel for the device | |
| 445 | + * @dl_chan: DL channel for the device | |
| 446 | + * @dev: Driver model device node for the MHI device | |
| 447 | + * @dev_type: MHI device type | |
| 448 | + * @ul_chan_id: MHI channel id for UL transfer | |
| 449 | + * @dl_chan_id: MHI channel id for DL transfer | |
| 450 | + * @dev_wake: Device wakeup counter | |
| 451 | + */ | |
| 452 | +struct mhi_device { | |
| 453 | + const struct mhi_device_id *id; | |
| 454 | + const char *chan_name; | |
| 455 | + struct mhi_controller *mhi_cntrl; | |
| 456 | + struct mhi_chan *ul_chan; | |
| 457 | + struct mhi_chan *dl_chan; | |
| 458 | + struct device dev; | |
| 459 | + enum mhi_device_type dev_type; | |
| 460 | + int ul_chan_id; | |
| 461 | + int dl_chan_id; | |
| 462 | + u32 dev_wake; | |
| 463 | +}; | |
| 464 | + | |
| 465 | +/** | |
| 466 | + * struct mhi_result - Completed buffer information | |
| 467 | + * @buf_addr: Address of data buffer | |
| 468 | + * @bytes_xferd: # of bytes transferred | |
| 469 | + * @dir: Channel direction | |
| 470 | + * @transaction_status: Status of last transaction | |
| 471 | + */ | |
| 472 | +struct mhi_result { | |
| 473 | + void *buf_addr; | |
| 474 | + size_t bytes_xferd; | |
| 475 | + enum dma_data_direction dir; | |
| 476 | + int transaction_status; | |
| 477 | +}; | |
| 478 | + | |
| 479 | +/** | |
| 480 | + * struct mhi_buf - MHI Buffer description | |
| 481 | + * @buf: Virtual address of the buffer | |
| 482 | + * @name: Buffer label. For offload channel, configurations name must be: | |
| 483 | + * ECA - Event context array data | |
| 484 | + * CCA - Channel context array data | |
| 485 | + * @dma_addr: IOMMU address of the buffer | |
| 486 | + * @len: # of bytes | |
| 487 | + */ | |
| 488 | +struct mhi_buf { | |
| 489 | + void *buf; | |
| 490 | + const char *name; | |
| 491 | + dma_addr_t dma_addr; | |
| 492 | + size_t len; | |
| 493 | +}; | |
| 494 | + | |
| 495 | +/** | |
| 496 | + * struct mhi_driver - Structure representing a MHI client driver | |
| 497 | + * @probe: CB function for client driver probe function | |
| 498 | + * @remove: CB function for client driver remove function | |
| 499 | + * @ul_xfer_cb: CB function for UL data transfer | |
| 500 | + * @dl_xfer_cb: CB function for DL data transfer | |
| 501 | + * @status_cb: CB functions for asynchronous status | |
| 502 | + * @driver: Device driver model driver | |
| 503 | + */ | |
| 504 | +struct mhi_driver { | |
| 505 | + const struct mhi_device_id *id_table; | |
| 506 | + int (*probe)(struct mhi_device *mhi_dev, | |
| 507 | + const struct mhi_device_id *id); | |
| 508 | + void (*remove)(struct mhi_device *mhi_dev); | |
| 509 | + void (*ul_xfer_cb)(struct mhi_device *mhi_dev, | |
| 510 | + struct mhi_result *result); | |
| 511 | + void (*dl_xfer_cb)(struct mhi_device *mhi_dev, | |
| 512 | + struct mhi_result *result); | |
| 513 | + void (*status_cb)(struct mhi_device *mhi_dev, enum mhi_callback mhi_cb); | |
| 514 | + struct device_driver driver; | |
| 515 | +}; | |
| 516 | + | |
| 517 | +#define to_mhi_driver(drv) container_of(drv, struct mhi_driver, driver) | |
| 518 | +#define to_mhi_device(dev) container_of(dev, struct mhi_device, dev) | |
| 519 | + | |
| 520 | +/** | |
| 521 | + * mhi_register_controller - Register MHI controller | |
| 522 | + * @mhi_cntrl: MHI controller to register | |
| 523 | + * @config: Configuration to use for the controller | |
| 524 | + */ | |
| 525 | +int mhi_register_controller(struct mhi_controller *mhi_cntrl, | |
| 526 | + struct mhi_controller_config *config); | |
| 527 | + | |
| 528 | +/** | |
| 529 | + * mhi_unregister_controller - Unregister MHI controller | |
| 530 | + * @mhi_cntrl: MHI controller to unregister | |
| 531 | + */ | |
| 532 | +void mhi_unregister_controller(struct mhi_controller *mhi_cntrl); | |
| 533 | + | |
| 534 | +/* | |
| 535 | + * module_mhi_driver() - Helper macro for drivers that don't do | |
| 536 | + * anything special other than using default mhi_driver_register() and | |
| 537 | + * mhi_driver_unregister(). This eliminates a lot of boilerplate. | |
| 538 | + * Each module may only use this macro once. | |
| 539 | + */ | |
| 540 | +#define module_mhi_driver(mhi_drv) \ | |
| 541 | + module_driver(mhi_drv, mhi_driver_register, \ | |
| 542 | + mhi_driver_unregister) | |
| 543 | + | |
| 544 | +/* | |
| 545 | + * Macro to avoid include chaining to get THIS_MODULE | |
| 546 | + */ | |
| 547 | +#define mhi_driver_register(mhi_drv) \ | |
| 548 | + __mhi_driver_register(mhi_drv, THIS_MODULE) | |
| 549 | + | |
| 550 | +/** | |
| 551 | + * __mhi_driver_register - Register driver with MHI framework | |
| 552 | + * @mhi_drv: Driver associated with the device | |
| 553 | + * @owner: The module owner | |
| 554 | + */ | |
| 555 | +int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner); | |
| 556 | + | |
| 557 | +/** | |
| 558 | + * mhi_driver_unregister - Unregister a driver for mhi_devices | |
| 559 | + * @mhi_drv: Driver associated with the device | |
| 560 | + */ | |
| 561 | +void mhi_driver_unregister(struct mhi_driver *mhi_drv); | |
| 562 | + | |
| 563 | +/** | |
| 564 | + * mhi_set_mhi_state - Set MHI device state | |
| 565 | + * @mhi_cntrl: MHI controller | |
| 566 | + * @state: State to set | |
| 567 | + */ | |
| 568 | +void mhi_set_mhi_state(struct mhi_controller *mhi_cntrl, | |
| 569 | + enum mhi_state state); | |
| 570 | + | |
| 571 | +/** | |
| 572 | + * mhi_prepare_for_power_up - Do pre-initialization before power up. | |
| 573 | + * This is optional, call this before power up if | |
| 574 | + * the controller does not want bus framework to | |
| 575 | + * automatically free any allocated memory during | |
| 576 | + * shutdown process. | |
| 577 | + * @mhi_cntrl: MHI controller | |
| 578 | + */ | |
| 579 | +int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl); | |
| 580 | + | |
| 581 | +/** | |
| 582 | + * mhi_async_power_up - Start MHI power up sequence | |
| 583 | + * @mhi_cntrl: MHI controller | |
| 584 | + */ | |
| 585 | +int mhi_async_power_up(struct mhi_controller *mhi_cntrl); | |
| 586 | + | |
| 587 | +/** | |
| 588 | + * mhi_sync_power_up - Start MHI power up sequence and wait till the device | |
| 589 | + * device enters valid EE state | |
| 590 | + * @mhi_cntrl: MHI controller | |
| 591 | + */ | |
| 592 | +int mhi_sync_power_up(struct mhi_controller *mhi_cntrl); | |
| 593 | + | |
| 594 | +/** | |
| 595 | + * mhi_power_down - Start MHI power down sequence | |
| 596 | + * @mhi_cntrl: MHI controller | |
| 597 | + * @graceful: Link is still accessible, so do a graceful shutdown process | |
| 598 | + */ | |
| 599 | +void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful); | |
| 600 | + | |
| 601 | +/** | |
| 602 | + * mhi_unprepare_after_power_down - Free any allocated memory after power down | |
| 603 | + * @mhi_cntrl: MHI controller | |
| 604 | + */ | |
| 605 | +void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl); | |
| 606 | + | |
| 607 | +/** | |
| 608 | + * mhi_download_rddm_img - Download ramdump image from device for | |
| 609 | + * debugging purpose. | |
| 610 | + * @mhi_cntrl: MHI controller | |
| 611 | + * @in_panic: Download rddm image during kernel panic | |
| 612 | + */ | |
| 613 | +int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic); | |
| 614 | + | |
| 615 | +/** | |
| 616 | + * mhi_force_rddm_mode - Force device into rddm mode | |
| 617 | + * @mhi_cntrl: MHI controller | |
| 618 | + */ | |
| 619 | +int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl); | |
| 620 | + | |
| 621 | +/** | |
| 622 | + * mhi_get_mhi_state - Get MHI state of the device | |
| 623 | + * @mhi_cntrl: MHI controller | |
| 624 | + */ | |
| 625 | +enum mhi_state mhi_get_mhi_state(struct mhi_controller *mhi_cntrl); | |
| 626 | + | |
| 627 | +/** | |
| 628 | + * mhi_device_get - Disable device low power mode | |
| 629 | + * @mhi_dev: Device associated with the channel | |
| 630 | + */ | |
| 631 | +void mhi_device_get(struct mhi_device *mhi_dev); | |
| 632 | + | |
| 633 | +/** | |
| 634 | + * mhi_device_get_sync - Disable device low power mode. Synchronously | |
| 635 | + * take the controller out of suspended state | |
| 636 | + * @mhi_dev: Device associated with the channel | |
| 637 | + */ | |
| 638 | +int mhi_device_get_sync(struct mhi_device *mhi_dev); | |
| 639 | + | |
| 640 | +/** | |
| 641 | + * mhi_device_put - Re-enable device low power mode | |
| 642 | + * @mhi_dev: Device associated with the channel | |
| 643 | + */ | |
| 644 | +void mhi_device_put(struct mhi_device *mhi_dev); | |
| 645 | + | |
| 646 | +/** | |
| 647 | + * mhi_prepare_for_transfer - Setup channel for data transfer | |
| 648 | + * @mhi_dev: Device associated with the channels | |
| 649 | + */ | |
| 650 | +int mhi_prepare_for_transfer(struct mhi_device *mhi_dev); | |
| 651 | + | |
| 652 | +/** | |
| 653 | + * mhi_unprepare_from_transfer - Unprepare the channels | |
| 654 | + * @mhi_dev: Device associated with the channels | |
| 655 | + */ | |
| 656 | +void mhi_unprepare_from_transfer(struct mhi_device *mhi_dev); | |
| 657 | + | |
| 658 | +/** | |
| 659 | + * mhi_poll - Poll for any available data in DL direction | |
| 660 | + * @mhi_dev: Device associated with the channels | |
| 661 | + * @budget: # of events to process | |
| 662 | + */ | |
| 663 | +int mhi_poll(struct mhi_device *mhi_dev, u32 budget); | |
| 664 | + | |
| 665 | +/** | |
| 666 | + * mhi_queue_dma - Send or receive DMA mapped buffers from client device | |
| 667 | + * over MHI channel | |
| 668 | + * @mhi_dev: Device associated with the channels | |
| 669 | + * @dir: DMA direction for the channel | |
| 670 | + * @mhi_buf: Buffer for holding the DMA mapped data | |
| 671 | + * @len: Buffer length | |
| 672 | + * @mflags: MHI transfer flags used for the transfer | |
| 673 | + */ | |
| 674 | +int mhi_queue_dma(struct mhi_device *mhi_dev, enum dma_data_direction dir, | |
| 675 | + struct mhi_buf *mhi_buf, size_t len, enum mhi_flags mflags); | |
| 676 | + | |
| 677 | +/** | |
| 678 | + * mhi_queue_buf - Send or receive raw buffers from client device over MHI | |
| 679 | + * channel | |
| 680 | + * @mhi_dev: Device associated with the channels | |
| 681 | + * @dir: DMA direction for the channel | |
| 682 | + * @buf: Buffer for holding the data | |
| 683 | + * @len: Buffer length | |
| 684 | + * @mflags: MHI transfer flags used for the transfer | |
| 685 | + */ | |
| 686 | +int mhi_queue_buf(struct mhi_device *mhi_dev, enum dma_data_direction dir, | |
| 687 | + void *buf, size_t len, enum mhi_flags mflags); | |
| 688 | + | |
| 689 | +/** | |
| 690 | + * mhi_queue_skb - Send or receive SKBs from client device over MHI channel | |
| 691 | + * @mhi_dev: Device associated with the channels | |
| 692 | + * @dir: DMA direction for the channel | |
| 693 | + * @skb: Buffer for holding SKBs | |
| 694 | + * @len: Buffer length | |
| 695 | + * @mflags: MHI transfer flags used for the transfer | |
| 696 | + */ | |
| 697 | +int mhi_queue_skb(struct mhi_device *mhi_dev, enum dma_data_direction dir, | |
| 698 | + struct sk_buff *skb, size_t len, enum mhi_flags mflags); | |
| 699 | + | |
| 700 | +#endif /* _MHI_H_ */ | |
| @@ -196,6 +196,14 @@ struct migrate_vma { · 195 unmodified lines | ||
| 196 | 196 | unsigned long npages; |
| 197 | 197 | unsigned long start; |
| 198 | 198 | unsigned long end; |
| 199 | + | |
| 200 | + /* | |
| 201 | + * Set to the owner value also stored in page->pgmap->owner for | |
| 202 | + * migrating out of device private memory. If set only device | |
| 203 | + * private pages with this owner are migrated. If not set | |
| 204 | + * device private pages are not migrated at all. | |
| 205 | + */ | |
| 206 | + void *src_owner; | |
| 199 | 207 | }; |
| 200 | 208 | |
| 201 | 209 | int migrate_vma_setup(struct migrate_vma *args); |
| @@ -354,24 +354,6 @@ static inline u32 mii_adv_to_ethtool_adv_x(u32 adv) · 353 unmodified lines | ||
| 354 | 354 | return result; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | −/** | |
| 358 | − * mii_lpa_to_ethtool_lpa_x | |
| 359 | − * @adv: value of the MII_LPA register | |
| 360 | − * | |
| 361 | − * A small helper function that translates MII_LPA | |
| 362 | − * bits, when in 1000Base-X mode, to ethtool | |
| 363 | − * LP advertisement settings. | |
| 364 | − */ | |
| 365 | −static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa) | |
| 366 | −{ | |
| 367 | − u32 result = 0; | |
| 368 | − | |
| 369 | − if (lpa & LPA_LPACK) | |
| 370 | − result |= ADVERTISED_Autoneg; | |
| 371 | − | |
| 372 | − return result | mii_adv_to_ethtool_adv_x(lpa); | |
| 373 | −} | |
| 374 | − | |
| 375 | 357 | /** |
| 376 | 358 | * mii_lpa_mod_linkmode_adv_sgmii |
| 377 | 359 | * @lp_advertising: pointer to destination link mode. |
| @@ -535,6 +517,45 @@ static inline u32 linkmode_adv_to_lcl_adv_t(unsigned long *advertising) · 157 unmodified lines | ||
| 535 | 517 | return lcl_adv; |
| 536 | 518 | } |
| 537 | 519 | |
| 520 | +/** | |
| 521 | + * mii_lpa_mod_linkmode_x - decode the link partner's config_reg to linkmodes | |
| 522 | + * @linkmodes: link modes array | |
| 523 | + * @lpa: config_reg word from link partner | |
| 524 | + * @fd_bit: link mode for 1000XFULL bit | |
| 525 | + */ | |
| 526 | +static inline void mii_lpa_mod_linkmode_x(unsigned long *linkmodes, u16 lpa, | |
| 527 | + int fd_bit) | |
| 528 | +{ | |
| 529 | + linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, linkmodes, | |
| 530 | + lpa & LPA_LPACK); | |
| 531 | + linkmode_mod_bit(ETHTOOL_LINK_MODE_Pause_BIT, linkmodes, | |
| 532 | + lpa & LPA_1000XPAUSE); | |
| 533 | + linkmode_mod_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, linkmodes, | |
| 534 | + lpa & LPA_1000XPAUSE_ASYM); | |
| 535 | + linkmode_mod_bit(fd_bit, linkmodes, | |
| 536 | + lpa & LPA_1000XFULL); | |
| 537 | +} | |
| 538 | + | |
| 539 | +/** | |
| 540 | + * linkmode_adv_to_mii_adv_x - encode a linkmode to config_reg | |
| 541 | + * @linkmodes: linkmodes | |
| 542 | + * @fd_bit: full duplex bit | |
| 543 | + */ | |
| 544 | +static inline u16 linkmode_adv_to_mii_adv_x(const unsigned long *linkmodes, | |
| 545 | + int fd_bit) | |
| 546 | +{ | |
| 547 | + u16 adv = 0; | |
| 548 | + | |
| 549 | + if (linkmode_test_bit(fd_bit, linkmodes)) | |
| 550 | + adv |= ADVERTISE_1000XFULL; | |
| 551 | + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, linkmodes)) | |
| 552 | + adv |= ADVERTISE_1000XPAUSE; | |
| 553 | + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, linkmodes)) | |
| 554 | + adv |= ADVERTISE_1000XPSE_ASYM; | |
| 555 | + | |
| 556 | + return adv; | |
| 557 | +} | |
| 558 | + | |
| 538 | 559 | /** |
| 539 | 560 | * mii_advertise_flowctrl - get flow control advertisement flags |
| 540 | 561 | * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both) |
| @@ -0,0 +1,134 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_MIN_HEAP_H | |
| 3 | +#define _LINUX_MIN_HEAP_H | |
| 4 | + | |
| 5 | +#include <linux/bug.h> | |
| 6 | +#include <linux/string.h> | |
| 7 | +#include <linux/types.h> | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * struct min_heap - Data structure to hold a min-heap. | |
| 11 | + * @data: Start of array holding the heap elements. | |
| 12 | + * @nr: Number of elements currently in the heap. | |
| 13 | + * @size: Maximum number of elements that can be held in current storage. | |
| 14 | + */ | |
| 15 | +struct min_heap { | |
| 16 | + void *data; | |
| 17 | + int nr; | |
| 18 | + int size; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * struct min_heap_callbacks - Data/functions to customise the min_heap. | |
| 23 | + * @elem_size: The nr of each element in bytes. | |
| 24 | + * @less: Partial order function for this heap. | |
| 25 | + * @swp: Swap elements function. | |
| 26 | + */ | |
| 27 | +struct min_heap_callbacks { | |
| 28 | + int elem_size; | |
| 29 | + bool (*less)(const void *lhs, const void *rhs); | |
| 30 | + void (*swp)(void *lhs, void *rhs); | |
| 31 | +}; | |
| 32 | + | |
| 33 | +/* Sift the element at pos down the heap. */ | |
| 34 | +static __always_inline | |
| 35 | +void min_heapify(struct min_heap *heap, int pos, | |
| 36 | + const struct min_heap_callbacks *func) | |
| 37 | +{ | |
| 38 | + void *left, *right, *parent, *smallest; | |
| 39 | + void *data = heap->data; | |
| 40 | + | |
| 41 | + for (;;) { | |
| 42 | + if (pos * 2 + 1 >= heap->nr) | |
| 43 | + break; | |
| 44 | + | |
| 45 | + left = data + ((pos * 2 + 1) * func->elem_size); | |
| 46 | + parent = data + (pos * func->elem_size); | |
| 47 | + smallest = parent; | |
| 48 | + if (func->less(left, smallest)) | |
| 49 | + smallest = left; | |
| 50 | + | |
| 51 | + if (pos * 2 + 2 < heap->nr) { | |
| 52 | + right = data + ((pos * 2 + 2) * func->elem_size); | |
| 53 | + if (func->less(right, smallest)) | |
| 54 | + smallest = right; | |
| 55 | + } | |
| 56 | + if (smallest == parent) | |
| 57 | + break; | |
| 58 | + func->swp(smallest, parent); | |
| 59 | + if (smallest == left) | |
| 60 | + pos = (pos * 2) + 1; | |
| 61 | + else | |
| 62 | + pos = (pos * 2) + 2; | |
| 63 | + } | |
| 64 | +} | |
| 65 | + | |
| 66 | +/* Floyd's approach to heapification that is O(nr). */ | |
| 67 | +static __always_inline | |
| 68 | +void min_heapify_all(struct min_heap *heap, | |
| 69 | + const struct min_heap_callbacks *func) | |
| 70 | +{ | |
| 71 | + int i; | |
| 72 | + | |
| 73 | + for (i = heap->nr / 2; i >= 0; i--) | |
| 74 | + min_heapify(heap, i, func); | |
| 75 | +} | |
| 76 | + | |
| 77 | +/* Remove minimum element from the heap, O(log2(nr)). */ | |
| 78 | +static __always_inline | |
| 79 | +void min_heap_pop(struct min_heap *heap, | |
| 80 | + const struct min_heap_callbacks *func) | |
| 81 | +{ | |
| 82 | + void *data = heap->data; | |
| 83 | + | |
| 84 | + if (WARN_ONCE(heap->nr <= 0, "Popping an empty heap")) | |
| 85 | + return; | |
| 86 | + | |
| 87 | + /* Place last element at the root (position 0) and then sift down. */ | |
| 88 | + heap->nr--; | |
| 89 | + memcpy(data, data + (heap->nr * func->elem_size), func->elem_size); | |
| 90 | + min_heapify(heap, 0, func); | |
| 91 | +} | |
| 92 | + | |
| 93 | +/* | |
| 94 | + * Remove the minimum element and then push the given element. The | |
| 95 | + * implementation performs 1 sift (O(log2(nr))) and is therefore more | |
| 96 | + * efficient than a pop followed by a push that does 2. | |
| 97 | + */ | |
| 98 | +static __always_inline | |
| 99 | +void min_heap_pop_push(struct min_heap *heap, | |
| 100 | + const void *element, | |
| 101 | + const struct min_heap_callbacks *func) | |
| 102 | +{ | |
| 103 | + memcpy(heap->data, element, func->elem_size); | |
| 104 | + min_heapify(heap, 0, func); | |
| 105 | +} | |
| 106 | + | |
| 107 | +/* Push an element on to the heap, O(log2(nr)). */ | |
| 108 | +static __always_inline | |
| 109 | +void min_heap_push(struct min_heap *heap, const void *element, | |
| 110 | + const struct min_heap_callbacks *func) | |
| 111 | +{ | |
| 112 | + void *data = heap->data; | |
| 113 | + void *child, *parent; | |
| 114 | + int pos; | |
| 115 | + | |
| 116 | + if (WARN_ONCE(heap->nr >= heap->size, "Pushing on a full heap")) | |
| 117 | + return; | |
| 118 | + | |
| 119 | + /* Place at the end of data. */ | |
| 120 | + pos = heap->nr; | |
| 121 | + memcpy(data + (pos * func->elem_size), element, func->elem_size); | |
| 122 | + heap->nr++; | |
| 123 | + | |
| 124 | + /* Sift child at pos up. */ | |
| 125 | + for (; pos > 0; pos = (pos - 1) / 2) { | |
| 126 | + child = data + (pos * func->elem_size); | |
| 127 | + parent = data + ((pos - 1) / 2) * func->elem_size; | |
| 128 | + if (func->less(parent, child)) | |
| 129 | + break; | |
| 130 | + func->swp(parent, child); | |
| 131 | + } | |
| 132 | +} | |
| 133 | + | |
| 134 | +#endif /* _LINUX_MIN_HEAP_H */ | |
| @@ -25,20 +25,31 @@ · 24 unmodified lines | ||
| 25 | 25 | #define TEMP_MINOR 131 /* Temperature Sensor */ |
| 26 | 26 | #define APM_MINOR_DEV 134 |
| 27 | 27 | #define RTC_MINOR 135 |
| 28 | −#define EFI_RTC_MINOR 136 /* EFI Time services */ | |
| 28 | +/*#define EFI_RTC_MINOR 136 was EFI Time services */ | |
| 29 | 29 | #define VHCI_MINOR 137 |
| 30 | 30 | #define SUN_OPENPROM_MINOR 139 |
| 31 | 31 | #define DMAPI_MINOR 140 /* unused */ |
| 32 | 32 | #define NVRAM_MINOR 144 |
| 33 | +#define SBUS_FLASH_MINOR 152 | |
| 33 | 34 | #define SGI_MMTIMER 153 |
| 35 | +#define PMU_MINOR 154 | |
| 34 | 36 | #define STORE_QUEUE_MINOR 155 /* unused */ |
| 37 | +#define LCD_MINOR 156 | |
| 38 | +#define AC_MINOR 157 | |
| 39 | +#define BUTTON_MINOR 158 /* Major 10, Minor 158, /dev/nwbutton */ | |
| 40 | +#define NWFLASH_MINOR 160 /* MAJOR is 10 - miscdevice */ | |
| 41 | +#define ENVCTRL_MINOR 162 | |
| 35 | 42 | #define I2O_MINOR 166 |
| 43 | +#define UCTRL_MINOR 174 | |
| 36 | 44 | #define AGPGART_MINOR 175 |
| 45 | +#define TOSH_MINOR_DEV 181 | |
| 37 | 46 | #define HWRNG_MINOR 183 |
| 38 | 47 | #define MICROCODE_MINOR 184 |
| 48 | +#define KEYPAD_MINOR 185 | |
| 39 | 49 | #define IRNET_MINOR 187 |
| 40 | 50 | #define D7S_MINOR 193 |
| 41 | 51 | #define VFIO_MINOR 196 |
| 52 | +#define PXA3XX_GCU_MINOR 197 | |
| 42 | 53 | #define TUN_MINOR 200 |
| 43 | 54 | #define CUSE_MINOR 203 |
| 44 | 55 | #define MWAVE_MINOR 219 /* ACP/Mwave Modem */ |
| @@ -49,6 +60,7 @@ · 4 unmodified lines | ||
| 49 | 60 | #define MISC_MCELOG_MINOR 227 |
| 50 | 61 | #define HPET_MINOR 228 |
| 51 | 62 | #define FUSE_MINOR 229 |
| 63 | +#define SNAPSHOT_MINOR 231 | |
| 52 | 64 | #define KVM_MINOR 232 |
| 53 | 65 | #define BTRFS_MINOR 234 |
| 54 | 66 | #define AUTOFS_MINOR 235 |
| @@ -1211,6 +1211,12 @@ enum mlx5_qcam_feature_groups { · 1210 unmodified lines | ||
| 1211 | 1211 | #define MLX5_CAP_FLOWTABLE_RDMA_RX_MAX(mdev, cap) \ |
| 1212 | 1212 | MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive_rdma.cap) |
| 1213 | 1213 | |
| 1214 | +#define MLX5_CAP_FLOWTABLE_RDMA_TX(mdev, cap) \ | |
| 1215 | + MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_transmit_rdma.cap) | |
| 1216 | + | |
| 1217 | +#define MLX5_CAP_FLOWTABLE_RDMA_TX_MAX(mdev, cap) \ | |
| 1218 | + MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit_rdma.cap) | |
| 1219 | + | |
| 1214 | 1220 | #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \ |
| 1215 | 1221 | MLX5_GET(flow_table_eswitch_cap, \ |
| 1216 | 1222 | mdev->caps.hca_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap) |
| @@ -213,23 +213,6 @@ enum mlx5_port_status { · 212 unmodified lines | ||
| 213 | 213 | MLX5_PORT_DOWN = 2, |
| 214 | 214 | }; |
| 215 | 215 | |
| 216 | −struct mlx5_bfreg_info { | |
| 217 | − u32 *sys_pages; | |
| 218 | − int num_low_latency_bfregs; | |
| 219 | − unsigned int *count; | |
| 220 | − | |
| 221 | − /* | |
| 222 | − * protect bfreg allocation data structs | |
| 223 | − */ | |
| 224 | − struct mutex lock; | |
| 225 | − u32 ver; | |
| 226 | − bool lib_uar_4k; | |
| 227 | − u32 num_sys_pages; | |
| 228 | − u32 num_static_sys_pages; | |
| 229 | − u32 total_num_bfregs; | |
| 230 | − u32 num_dyn_bfregs; | |
| 231 | −}; | |
| 232 | − | |
| 233 | 216 | struct mlx5_cmd_first { |
| 234 | 217 | __be32 data[4]; |
| 235 | 218 | }; |
| @@ -518,9 +501,11 @@ struct mlx5_rate_limit { · 282 unmodified lines | ||
| 518 | 501 | }; |
| 519 | 502 | |
| 520 | 503 | struct mlx5_rl_entry { |
| 521 | − struct mlx5_rate_limit rl; | |
| 522 | − u16 index; | |
| 523 | − u16 refcount; | |
| 504 | + u8 rl_raw[MLX5_ST_SZ_BYTES(set_pp_rate_limit_context)]; | |
| 505 | + u16 index; | |
| 506 | + u64 refcount; | |
| 507 | + u16 uid; | |
| 508 | + u8 dedicated : 1; | |
| 524 | 509 | }; |
| 525 | 510 | |
| 526 | 511 | struct mlx5_rl_table { |
| @@ -573,10 +558,6 @@ struct mlx5_priv { · 46 unmodified lines | ||
| 573 | 558 | /* end: alloc staff */ |
| 574 | 559 | struct dentry *dbg_root; |
| 575 | 560 | |
| 576 | − /* protect mkey key part */ | |
| 577 | − spinlock_t mkey_lock; | |
| 578 | − u8 mkey_key; | |
| 579 | − | |
| 580 | 561 | struct list_head dev_list; |
| 581 | 562 | struct list_head ctx_list; |
| 582 | 563 | spinlock_t ctx_lock; |
| @@ -722,6 +703,7 @@ struct mlx5_core_dev { · 139 unmodified lines | ||
| 722 | 703 | struct mlx5_clock clock; |
| 723 | 704 | struct mlx5_ib_clock_info *clock_info; |
| 724 | 705 | struct mlx5_fw_tracer *tracer; |
| 706 | + struct mlx5_rsc_dump *rsc_dump; | |
| 725 | 707 | u32 vsc_addr; |
| 726 | 708 | struct mlx5_hv_vhca *hv_vhca; |
| 727 | 709 | }; |
| @@ -945,12 +927,6 @@ struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev, · 217 unmodified lines | ||
| 945 | 927 | gfp_t flags, int npages); |
| 946 | 928 | void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev, |
| 947 | 929 | struct mlx5_cmd_mailbox *head); |
| 948 | −int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, | |
| 949 | − struct mlx5_core_mkey *mkey, | |
| 950 | − struct mlx5_async_ctx *async_ctx, u32 *in, | |
| 951 | − int inlen, u32 *out, int outlen, | |
| 952 | − mlx5_async_cbk_t callback, | |
| 953 | − struct mlx5_async_work *context); | |
| 954 | 930 | int mlx5_core_create_mkey(struct mlx5_core_dev *dev, |
| 955 | 931 | struct mlx5_core_mkey *mkey, |
| 956 | 932 | u32 *in, int inlen); |
| @@ -1007,6 +983,9 @@ int mlx5_rl_add_rate(struct mlx5_core_dev *dev, u16 *index, · 50 unmodified lines | ||
| 1007 | 983 | struct mlx5_rate_limit *rl); |
| 1008 | 984 | void mlx5_rl_remove_rate(struct mlx5_core_dev *dev, struct mlx5_rate_limit *rl); |
| 1009 | 985 | bool mlx5_rl_is_in_range(struct mlx5_core_dev *dev, u32 rate); |
| 986 | +int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid, | |
| 987 | + bool dedicated_entry, u16 *index); | |
| 988 | +void mlx5_rl_remove_rate_raw(struct mlx5_core_dev *dev, u16 index); | |
| 1010 | 989 | bool mlx5_rl_are_equal(struct mlx5_rate_limit *rl_0, |
| 1011 | 990 | struct mlx5_rate_limit *rl_1); |
| 1012 | 991 | int mlx5_alloc_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg, |
| @@ -70,8 +70,30 @@ u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev); · 69 unmodified lines | ||
| 70 | 70 | enum devlink_eswitch_encap_mode |
| 71 | 71 | mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev); |
| 72 | 72 | |
| 73 | +bool mlx5_eswitch_reg_c1_loopback_enabled(const struct mlx5_eswitch *esw); | |
| 73 | 74 | bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw); |
| 74 | −u32 mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw, | |
| 75 | + | |
| 76 | +/* Reg C0 usage: | |
| 77 | + * Reg C0 = < ESW_VHCA_ID_BITS(8) | ESW_VPORT BITS(8) | ESW_CHAIN_TAG(16) > | |
| 78 | + * | |
| 79 | + * Highest 8 bits of the reg c0 is the vhca_id, next 8 bits is vport_num, | |
| 80 | + * the rest (lowest 16 bits) is left for tc chain tag restoration. | |
| 81 | + * VHCA_ID + VPORT comprise the SOURCE_PORT matching. | |
| 82 | + */ | |
| 83 | +#define ESW_VHCA_ID_BITS 8 | |
| 84 | +#define ESW_VPORT_BITS 8 | |
| 85 | +#define ESW_SOURCE_PORT_METADATA_BITS (ESW_VHCA_ID_BITS + ESW_VPORT_BITS) | |
| 86 | +#define ESW_SOURCE_PORT_METADATA_OFFSET (32 - ESW_SOURCE_PORT_METADATA_BITS) | |
| 87 | +#define ESW_CHAIN_TAG_METADATA_BITS (32 - ESW_SOURCE_PORT_METADATA_BITS) | |
| 88 | +#define ESW_CHAIN_TAG_METADATA_MASK GENMASK(ESW_CHAIN_TAG_METADATA_BITS - 1,\ | |
| 89 | + 0) | |
| 90 | + | |
| 91 | +static inline u32 mlx5_eswitch_get_vport_metadata_mask(void) | |
| 92 | +{ | |
| 93 | + return GENMASK(31, 32 - ESW_SOURCE_PORT_METADATA_BITS); | |
| 94 | +} | |
| 95 | + | |
| 96 | +u32 mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw, | |
| 75 | 97 | u16 vport_num); |
| 76 | 98 | u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw); |
| 77 | 99 | #else /* CONFIG_MLX5_ESWITCH */ |
| @@ -87,6 +109,12 @@ mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev) · 9 unmodified lines | ||
| 87 | 109 | return DEVLINK_ESWITCH_ENCAP_MODE_NONE; |
| 88 | 110 | } |
| 89 | 111 | |
| 112 | +static inline bool | |
| 113 | +mlx5_eswitch_reg_c1_loopback_enabled(const struct mlx5_eswitch *esw) | |
| 114 | +{ | |
| 115 | + return false; | |
| 116 | +}; | |
| 117 | + | |
| 90 | 118 | static inline bool |
| 91 | 119 | mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw) |
| 92 | 120 | { |
| @@ -94,11 +122,17 @@ mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw) · 1 unmodified line | ||
| 94 | 122 | }; |
| 95 | 123 | |
| 96 | 124 | static inline u32 |
| 97 | −mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw, | |
| 125 | +mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw, | |
| 98 | 126 | int vport_num) |
| 99 | 127 | { |
| 100 | 128 | return 0; |
| 101 | 129 | }; |
| 130 | + | |
| 131 | +static inline u32 | |
| 132 | +mlx5_eswitch_get_vport_metadata_mask(void) | |
| 133 | +{ | |
| 134 | + return 0; | |
| 135 | +} | |
| 102 | 136 | #endif /* CONFIG_MLX5_ESWITCH */ |
| 103 | 137 | |
| 104 | 138 | #endif |
| @@ -77,6 +77,7 @@ enum mlx5_flow_namespace_type { · 76 unmodified lines | ||
| 77 | 77 | MLX5_FLOW_NAMESPACE_EGRESS, |
| 78 | 78 | MLX5_FLOW_NAMESPACE_RDMA_RX, |
| 79 | 79 | MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL, |
| 80 | + MLX5_FLOW_NAMESPACE_RDMA_TX, | |
| 80 | 81 | }; |
| 81 | 82 | |
| 82 | 83 | enum { |
| @@ -84,6 +85,7 @@ enum { · 1 unmodified line | ||
| 84 | 85 | FDB_TC_OFFLOAD, |
| 85 | 86 | FDB_FT_OFFLOAD, |
| 86 | 87 | FDB_SLOW_PATH, |
| 88 | + FDB_PER_VPORT, | |
| 87 | 89 | }; |
| 88 | 90 | |
| 89 | 91 | struct mlx5_pkt_reformat; |
| @@ -414,8 +414,10 @@ struct mlx5_ifc_flow_table_prop_layout_bits { · 413 unmodified lines | ||
| 414 | 414 | u8 reserved_at_16[0x1]; |
| 415 | 415 | u8 table_miss_action_domain[0x1]; |
| 416 | 416 | u8 termination_table[0x1]; |
| 417 | − u8 reserved_at_19[0x7]; | |
| 418 | − u8 reserved_at_20[0x2]; | |
| 417 | + u8 reformat_and_fwd_to_table[0x1]; | |
| 418 | + u8 reserved_at_1a[0x6]; | |
| 419 | + u8 termination_table_raw_traffic[0x1]; | |
| 420 | + u8 reserved_at_21[0x1]; | |
| 419 | 421 | u8 log_max_ft_size[0x6]; |
| 420 | 422 | u8 log_max_modify_header_context[0x8]; |
| 421 | 423 | u8 max_modify_header_actions[0x8]; |
| @@ -707,7 +709,7 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 285 unmodified lines | ||
| 707 | 709 | |
| 708 | 710 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit; |
| 709 | 711 | |
| 710 | − u8 reserved_at_a00[0x200]; | |
| 712 | + struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_rdma; | |
| 711 | 713 | |
| 712 | 714 | struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_sniffer; |
| 713 | 715 | |
| @@ -741,7 +743,7 @@ struct mlx5_ifc_flow_table_eswitch_cap_bits { · 27 unmodified lines | ||
| 741 | 743 | u8 flow_source[0x1]; |
| 742 | 744 | u8 reserved_at_18[0x2]; |
| 743 | 745 | u8 multi_fdb_encap[0x1]; |
| 744 | − u8 reserved_at_1b[0x1]; | |
| 746 | + u8 egress_acl_forward_to_vport[0x1]; | |
| 745 | 747 | u8 fdb_multi_path_to_table[0x1]; |
| 746 | 748 | u8 reserved_at_1d[0x3]; |
| 747 | 749 | |
| @@ -813,7 +815,9 @@ struct mlx5_ifc_qos_cap_bits { · 65 unmodified lines | ||
| 813 | 815 | u8 reserved_at_4[0x1]; |
| 814 | 816 | u8 packet_pacing_burst_bound[0x1]; |
| 815 | 817 | u8 packet_pacing_typical_size[0x1]; |
| 816 | − u8 reserved_at_7[0x19]; | |
| 818 | + u8 reserved_at_7[0x4]; | |
| 819 | + u8 packet_pacing_uid[0x1]; | |
| 820 | + u8 reserved_at_c[0x14]; | |
| 817 | 821 | |
| 818 | 822 | u8 reserved_at_20[0x20]; |
| 819 | 823 | |
| @@ -875,7 +879,11 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits { · 55 unmodified lines | ||
| 875 | 879 | u8 swp_csum[0x1]; |
| 876 | 880 | u8 swp_lso[0x1]; |
| 877 | 881 | u8 cqe_checksum_full[0x1]; |
| 878 | − u8 reserved_at_24[0x5]; | |
| 882 | + u8 tunnel_stateless_geneve_tx[0x1]; | |
| 883 | + u8 tunnel_stateless_mpls_over_udp[0x1]; | |
| 884 | + u8 tunnel_stateless_mpls_over_gre[0x1]; | |
| 885 | + u8 tunnel_stateless_vxlan_gpe[0x1]; | |
| 886 | + u8 tunnel_stateless_ipv4_over_vxlan[0x1]; | |
| 879 | 887 | u8 tunnel_stateless_ip_over_ip[0x1]; |
| 880 | 888 | u8 reserved_at_2a[0x6]; |
| 881 | 889 | u8 max_vxlan_udp_ports[0x8]; |
| @@ -8265,9 +8273,20 @@ struct mlx5_ifc_set_pp_rate_limit_out_bits { · 7383 unmodified lines | ||
| 8265 | 8273 | u8 reserved_at_40[0x40]; |
| 8266 | 8274 | }; |
| 8267 | 8275 | |
| 8276 | +struct mlx5_ifc_set_pp_rate_limit_context_bits { | |
| 8277 | + u8 rate_limit[0x20]; | |
| 8278 | + | |
| 8279 | + u8 burst_upper_bound[0x20]; | |
| 8280 | + | |
| 8281 | + u8 reserved_at_40[0x10]; | |
| 8282 | + u8 typical_packet_size[0x10]; | |
| 8283 | + | |
| 8284 | + u8 reserved_at_60[0x120]; | |
| 8285 | +}; | |
| 8286 | + | |
| 8268 | 8287 | struct mlx5_ifc_set_pp_rate_limit_in_bits { |
| 8269 | 8288 | u8 opcode[0x10]; |
| 8270 | − u8 reserved_at_10[0x10]; | |
| 8289 | + u8 uid[0x10]; | |
| 8271 | 8290 | |
| 8272 | 8291 | u8 reserved_at_20[0x10]; |
| 8273 | 8292 | u8 op_mod[0x10]; |
| @@ -8277,14 +8296,7 @@ struct mlx5_ifc_set_pp_rate_limit_in_bits { · 3 unmodified lines | ||
| 8277 | 8296 | |
| 8278 | 8297 | u8 reserved_at_60[0x20]; |
| 8279 | 8298 | |
| 8280 | − u8 rate_limit[0x20]; | |
| 8281 | − | |
| 8282 | − u8 burst_upper_bound[0x20]; | |
| 8283 | − | |
| 8284 | − u8 reserved_at_c0[0x10]; | |
| 8285 | − u8 typical_packet_size[0x10]; | |
| 8286 | − | |
| 8287 | − u8 reserved_at_e0[0x120]; | |
| 8299 | + struct mlx5_ifc_set_pp_rate_limit_context_bits ctx; | |
| 8288 | 8300 | }; |
| 8289 | 8301 | |
| 8290 | 8302 | struct mlx5_ifc_access_register_out_bits { |
| @@ -8420,7 +8432,8 @@ struct mlx5_ifc_ptys_reg_bits { · 129 unmodified lines | ||
| 8420 | 8432 | u8 proto_mask[0x3]; |
| 8421 | 8433 | |
| 8422 | 8434 | u8 an_status[0x4]; |
| 8423 | − u8 reserved_at_24[0x1c]; | |
| 8435 | + u8 reserved_at_24[0xc]; | |
| 8436 | + u8 data_rate_oper[0x10]; | |
| 8424 | 8437 | |
| 8425 | 8438 | u8 ext_eth_proto_capability[0x20]; |
| 8426 | 8439 | |
| @@ -10486,7 +10499,8 @@ enum { · 2059 unmodified lines | ||
| 10486 | 10499 | }; |
| 10487 | 10500 | |
| 10488 | 10501 | enum { |
| 10489 | − MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_DEK = 0x1, | |
| 10502 | + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_TLS = 0x1, | |
| 10503 | + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_IPSEC = 0x2, | |
| 10490 | 10504 | }; |
| 10491 | 10505 | |
| 10492 | 10506 | struct mlx5_ifc_tls_static_params_bits { |
| @@ -608,7 +608,7 @@ struct mlx5_ifc_tls_cmd_bits { · 607 unmodified lines | ||
| 608 | 608 | struct mlx5_ifc_tls_resp_bits { |
| 609 | 609 | u8 syndrome[0x20]; |
| 610 | 610 | u8 stream_id[0x20]; |
| 611 | − u8 reserverd[0x40]; | |
| 611 | + u8 reserved[0x40]; | |
| 612 | 612 | }; |
| 613 | 613 | |
| 614 | 614 | #define MLX5_TLS_COMMAND_SIZE (0x100) |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/memremap.h> |
| 28 | 28 | #include <linux/overflow.h> |
| 29 | 29 | #include <linux/sizes.h> |
| 30 | +#include <linux/sched.h> | |
| 30 | 31 | |
| 31 | 32 | struct mempolicy; |
| 32 | 33 | struct anon_vma; |
| @@ -342,6 +343,20 @@ extern unsigned int kobjsize(const void *objp); · 309 unmodified lines | ||
| 342 | 343 | /* Bits set in the VMA until the stack is in its final location */ |
| 343 | 344 | #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ) |
| 344 | 345 | |
| 346 | +#define TASK_EXEC ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | |
| 347 | + | |
| 348 | +/* Common data flag combinations */ | |
| 349 | +#define VM_DATA_FLAGS_TSK_EXEC (VM_READ | VM_WRITE | TASK_EXEC | \ | |
| 350 | + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | |
| 351 | +#define VM_DATA_FLAGS_NON_EXEC (VM_READ | VM_WRITE | VM_MAYREAD | \ | |
| 352 | + VM_MAYWRITE | VM_MAYEXEC) | |
| 353 | +#define VM_DATA_FLAGS_EXEC (VM_READ | VM_WRITE | VM_EXEC | \ | |
| 354 | + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | |
| 355 | + | |
| 356 | +#ifndef VM_DATA_DEFAULT_FLAGS /* arch can override this */ | |
| 357 | +#define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_EXEC | |
| 358 | +#endif | |
| 359 | + | |
| 345 | 360 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ |
| 346 | 361 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS |
| 347 | 362 | #endif |
| @@ -354,12 +369,18 @@ extern unsigned int kobjsize(const void *objp); · 6 unmodified lines | ||
| 354 | 369 | |
| 355 | 370 | #define VM_STACK_FLAGS (VM_STACK | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) |
| 356 | 371 | |
| 372 | +/* VMA basic access permission flags */ | |
| 373 | +#define VM_ACCESS_FLAGS (VM_READ | VM_WRITE | VM_EXEC) | |
| 374 | + | |
| 375 | + | |
| 357 | 376 | /* |
| 358 | 377 | * Special vmas that are non-mergable, non-mlock()able. |
| 359 | − * Note: mm/huge_memory.c VM_NO_THP depends on this definition. | |
| 360 | 378 | */ |
| 361 | 379 | #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP) |
| 362 | 380 | |
| 381 | +/* This mask prevents VMA from being scanned with khugepaged */ | |
| 382 | +#define VM_NO_KHUGEPAGED (VM_SPECIAL | VM_HUGETLB) | |
| 383 | + | |
| 363 | 384 | /* This mask defines which mm->def_flags a process can inherit its parent */ |
| 364 | 385 | #define VM_INIT_DEF_MASK VM_NOHUGEPAGE |
| 365 | 386 | |
| @@ -378,15 +399,75 @@ extern unsigned int kobjsize(const void *objp); · 12 unmodified lines | ||
| 378 | 399 | */ |
| 379 | 400 | extern pgprot_t protection_map[16]; |
| 380 | 401 | |
| 381 | −#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */ | |
| 382 | −#define FAULT_FLAG_MKWRITE 0x02 /* Fault was mkwrite of existing pte */ | |
| 383 | −#define FAULT_FLAG_ALLOW_RETRY 0x04 /* Retry fault if blocking */ | |
| 384 | −#define FAULT_FLAG_RETRY_NOWAIT 0x08 /* Don't drop mmap_sem and wait when retrying */ | |
| 385 | −#define FAULT_FLAG_KILLABLE 0x10 /* The fault task is in SIGKILL killable region */ | |
| 386 | −#define FAULT_FLAG_TRIED 0x20 /* Second try */ | |
| 387 | −#define FAULT_FLAG_USER 0x40 /* The fault originated in userspace */ | |
| 388 | −#define FAULT_FLAG_REMOTE 0x80 /* faulting for non current tsk/mm */ | |
| 389 | −#define FAULT_FLAG_INSTRUCTION 0x100 /* The fault was during an instruction fetch */ | |
| 402 | +/** | |
| 403 | + * Fault flag definitions. | |
| 404 | + * | |
| 405 | + * @FAULT_FLAG_WRITE: Fault was a write fault. | |
| 406 | + * @FAULT_FLAG_MKWRITE: Fault was mkwrite of existing PTE. | |
| 407 | + * @FAULT_FLAG_ALLOW_RETRY: Allow to retry the fault if blocked. | |
| 408 | + * @FAULT_FLAG_RETRY_NOWAIT: Don't drop mmap_sem and wait when retrying. | |
| 409 | + * @FAULT_FLAG_KILLABLE: The fault task is in SIGKILL killable region. | |
| 410 | + * @FAULT_FLAG_TRIED: The fault has been tried once. | |
| 411 | + * @FAULT_FLAG_USER: The fault originated in userspace. | |
| 412 | + * @FAULT_FLAG_REMOTE: The fault is not for current task/mm. | |
| 413 | + * @FAULT_FLAG_INSTRUCTION: The fault was during an instruction fetch. | |
| 414 | + * @FAULT_FLAG_INTERRUPTIBLE: The fault can be interrupted by non-fatal signals. | |
| 415 | + * | |
| 416 | + * About @FAULT_FLAG_ALLOW_RETRY and @FAULT_FLAG_TRIED: we can specify | |
| 417 | + * whether we would allow page faults to retry by specifying these two | |
| 418 | + * fault flags correctly. Currently there can be three legal combinations: | |
| 419 | + * | |
| 420 | + * (a) ALLOW_RETRY and !TRIED: this means the page fault allows retry, and | |
| 421 | + * this is the first try | |
| 422 | + * | |
| 423 | + * (b) ALLOW_RETRY and TRIED: this means the page fault allows retry, and | |
| 424 | + * we've already tried at least once | |
| 425 | + * | |
| 426 | + * (c) !ALLOW_RETRY and !TRIED: this means the page fault does not allow retry | |
| 427 | + * | |
| 428 | + * The unlisted combination (!ALLOW_RETRY && TRIED) is illegal and should never | |
| 429 | + * be used. Note that page faults can be allowed to retry for multiple times, | |
| 430 | + * in which case we'll have an initial fault with flags (a) then later on | |
| 431 | + * continuous faults with flags (b). We should always try to detect pending | |
| 432 | + * signals before a retry to make sure the continuous page faults can still be | |
| 433 | + * interrupted if necessary. | |
| 434 | + */ | |
| 435 | +#define FAULT_FLAG_WRITE 0x01 | |
| 436 | +#define FAULT_FLAG_MKWRITE 0x02 | |
| 437 | +#define FAULT_FLAG_ALLOW_RETRY 0x04 | |
| 438 | +#define FAULT_FLAG_RETRY_NOWAIT 0x08 | |
| 439 | +#define FAULT_FLAG_KILLABLE 0x10 | |
| 440 | +#define FAULT_FLAG_TRIED 0x20 | |
| 441 | +#define FAULT_FLAG_USER 0x40 | |
| 442 | +#define FAULT_FLAG_REMOTE 0x80 | |
| 443 | +#define FAULT_FLAG_INSTRUCTION 0x100 | |
| 444 | +#define FAULT_FLAG_INTERRUPTIBLE 0x200 | |
| 445 | + | |
| 446 | +/* | |
| 447 | + * The default fault flags that should be used by most of the | |
| 448 | + * arch-specific page fault handlers. | |
| 449 | + */ | |
| 450 | +#define FAULT_FLAG_DEFAULT (FAULT_FLAG_ALLOW_RETRY | \ | |
| 451 | + FAULT_FLAG_KILLABLE | \ | |
| 452 | + FAULT_FLAG_INTERRUPTIBLE) | |
| 453 | + | |
| 454 | +/** | |
| 455 | + * fault_flag_allow_retry_first - check ALLOW_RETRY the first time | |
| 456 | + * | |
| 457 | + * This is mostly used for places where we want to try to avoid taking | |
| 458 | + * the mmap_sem for too long a time when waiting for another condition | |
| 459 | + * to change, in which case we can try to be polite to release the | |
| 460 | + * mmap_sem in the first round to avoid potential starvation of other | |
| 461 | + * processes that would also want the mmap_sem. | |
| 462 | + * | |
| 463 | + * Return: true if the page fault allows retry and this is the first | |
| 464 | + * attempt of the fault handling; false otherwise. | |
| 465 | + */ | |
| 466 | +static inline bool fault_flag_allow_retry_first(unsigned int flags) | |
| 467 | +{ | |
| 468 | + return (flags & FAULT_FLAG_ALLOW_RETRY) && | |
| 469 | + (!(flags & FAULT_FLAG_TRIED)); | |
| 470 | +} | |
| 390 | 471 | |
| 391 | 472 | #define FAULT_FLAG_TRACE \ |
| 392 | 473 | { FAULT_FLAG_WRITE, "WRITE" }, \ |
| @@ -397,7 +478,8 @@ extern pgprot_t protection_map[16]; · 4 unmodified lines | ||
| 397 | 478 | { FAULT_FLAG_TRIED, "TRIED" }, \ |
| 398 | 479 | { FAULT_FLAG_USER, "USER" }, \ |
| 399 | 480 | { FAULT_FLAG_REMOTE, "REMOTE" }, \ |
| 400 | − { FAULT_FLAG_INSTRUCTION, "INSTRUCTION" } | |
| 481 | + { FAULT_FLAG_INSTRUCTION, "INSTRUCTION" }, \ | |
| 482 | + { FAULT_FLAG_INTERRUPTIBLE, "INTERRUPTIBLE" } | |
| 401 | 483 | |
| 402 | 484 | /* |
| 403 | 485 | * vm_fault is filled by the the pagefault handler and passed to the vma's |
| @@ -541,6 +623,36 @@ static inline bool vma_is_anonymous(struct vm_area_struct *vma) · 137 unmodified lines | ||
| 541 | 623 | return !vma->vm_ops; |
| 542 | 624 | } |
| 543 | 625 | |
| 626 | +static inline bool vma_is_temporary_stack(struct vm_area_struct *vma) | |
| 627 | +{ | |
| 628 | + int maybe_stack = vma->vm_flags & (VM_GROWSDOWN | VM_GROWSUP); | |
| 629 | + | |
| 630 | + if (!maybe_stack) | |
| 631 | + return false; | |
| 632 | + | |
| 633 | + if ((vma->vm_flags & VM_STACK_INCOMPLETE_SETUP) == | |
| 634 | + VM_STACK_INCOMPLETE_SETUP) | |
| 635 | + return true; | |
| 636 | + | |
| 637 | + return false; | |
| 638 | +} | |
| 639 | + | |
| 640 | +static inline bool vma_is_foreign(struct vm_area_struct *vma) | |
| 641 | +{ | |
| 642 | + if (!current->mm) | |
| 643 | + return true; | |
| 644 | + | |
| 645 | + if (current->mm != vma->vm_mm) | |
| 646 | + return true; | |
| 647 | + | |
| 648 | + return false; | |
| 649 | +} | |
| 650 | + | |
| 651 | +static inline bool vma_is_accessible(struct vm_area_struct *vma) | |
| 652 | +{ | |
| 653 | + return vma->vm_flags & VM_ACCESS_FLAGS; | |
| 654 | +} | |
| 655 | + | |
| 544 | 656 | #ifdef CONFIG_SHMEM |
| 545 | 657 | /* |
| 546 | 658 | * The vma_is_shmem is not inline because it is used only by slow |
| @@ -770,6 +882,24 @@ static inline unsigned int compound_order(struct page *page) · 223 unmodified lines | ||
| 770 | 882 | return page[1].compound_order; |
| 771 | 883 | } |
| 772 | 884 | |
| 885 | +static inline bool hpage_pincount_available(struct page *page) | |
| 886 | +{ | |
| 887 | + /* | |
| 888 | + * Can the page->hpage_pinned_refcount field be used? That field is in | |
| 889 | + * the 3rd page of the compound page, so the smallest (2-page) compound | |
| 890 | + * pages cannot support it. | |
| 891 | + */ | |
| 892 | + page = compound_head(page); | |
| 893 | + return PageCompound(page) && compound_order(page) > 1; | |
| 894 | +} | |
| 895 | + | |
| 896 | +static inline int compound_pincount(struct page *page) | |
| 897 | +{ | |
| 898 | + VM_BUG_ON_PAGE(!hpage_pincount_available(page), page); | |
| 899 | + page = compound_head(page); | |
| 900 | + return atomic_read(compound_pincount_ptr(page)); | |
| 901 | +} | |
| 902 | + | |
| 773 | 903 | static inline void set_compound_order(struct page *page, unsigned int order) |
| 774 | 904 | { |
| 775 | 905 | page[1].compound_order = order; |
| @@ -1001,6 +1131,8 @@ static inline void get_page(struct page *page) · 225 unmodified lines | ||
| 1001 | 1131 | page_ref_inc(page); |
| 1002 | 1132 | } |
| 1003 | 1133 | |
| 1134 | +bool __must_check try_grab_page(struct page *page, unsigned int flags); | |
| 1135 | + | |
| 1004 | 1136 | static inline __must_check bool try_get_page(struct page *page) |
| 1005 | 1137 | { |
| 1006 | 1138 | page = compound_head(page); |
| @@ -1029,29 +1161,87 @@ static inline void put_page(struct page *page) · 22 unmodified lines | ||
| 1029 | 1161 | __put_page(page); |
| 1030 | 1162 | } |
| 1031 | 1163 | |
| 1032 | −/** | |
| 1033 | − * unpin_user_page() - release a gup-pinned page | |
| 1034 | − * @page: pointer to page to be released | |
| 1164 | +/* | |
| 1165 | + * GUP_PIN_COUNTING_BIAS, and the associated functions that use it, overload | |
| 1166 | + * the page's refcount so that two separate items are tracked: the original page | |
| 1167 | + * reference count, and also a new count of how many pin_user_pages() calls were | |
| 1168 | + * made against the page. ("gup-pinned" is another term for the latter). | |
| 1169 | + * | |
| 1170 | + * With this scheme, pin_user_pages() becomes special: such pages are marked as | |
| 1171 | + * distinct from normal pages. As such, the unpin_user_page() call (and its | |
| 1172 | + * variants) must be used in order to release gup-pinned pages. | |
| 1173 | + * | |
| 1174 | + * Choice of value: | |
| 1175 | + * | |
| 1176 | + * By making GUP_PIN_COUNTING_BIAS a power of two, debugging of page reference | |
| 1177 | + * counts with respect to pin_user_pages() and unpin_user_page() becomes | |
| 1178 | + * simpler, due to the fact that adding an even power of two to the page | |
| 1179 | + * refcount has the effect of using only the upper N bits, for the code that | |
| 1180 | + * counts up using the bias value. This means that the lower bits are left for | |
| 1181 | + * the exclusive use of the original code that increments and decrements by one | |
| 1182 | + * (or at least, by much smaller values than the bias value). | |
| 1035 | 1183 | * |
| 1036 | − * Pages that were pinned via pin_user_pages*() must be released via either | |
| 1037 | − * unpin_user_page(), or one of the unpin_user_pages*() routines. This is so | |
| 1038 | − * that eventually such pages can be separately tracked and uniquely handled. In | |
| 1039 | − * particular, interactions with RDMA and filesystems need special handling. | |
| 1184 | + * Of course, once the lower bits overflow into the upper bits (and this is | |
| 1185 | + * OK, because subtraction recovers the original values), then visual inspection | |
| 1186 | + * no longer suffices to directly view the separate counts. However, for normal | |
| 1187 | + * applications that don't have huge page reference counts, this won't be an | |
| 1188 | + * issue. | |
| 1040 | 1189 | * |
| 1041 | − * unpin_user_page() and put_page() are not interchangeable, despite this early | |
| 1042 | − * implementation that makes them look the same. unpin_user_page() calls must | |
| 1043 | − * be perfectly matched up with pin*() calls. | |
| 1190 | + * Locking: the lockless algorithm described in page_cache_get_speculative() | |
| 1191 | + * and page_cache_gup_pin_speculative() provides safe operation for | |
| 1192 | + * get_user_pages and page_mkclean and other calls that race to set up page | |
| 1193 | + * table entries. | |
| 1044 | 1194 | */ |
| 1045 | −static inline void unpin_user_page(struct page *page) | |
| 1046 | −{ | |
| 1047 | − put_page(page); | |
| 1048 | −} | |
| 1195 | +#define GUP_PIN_COUNTING_BIAS (1U << 10) | |
| 1049 | 1196 | |
| 1197 | +void unpin_user_page(struct page *page); | |
| 1050 | 1198 | void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages, |
| 1051 | 1199 | bool make_dirty); |
| 1052 | − | |
| 1053 | 1200 | void unpin_user_pages(struct page **pages, unsigned long npages); |
| 1054 | 1201 | |
| 1202 | +/** | |
| 1203 | + * page_maybe_dma_pinned() - report if a page is pinned for DMA. | |
| 1204 | + * | |
| 1205 | + * This function checks if a page has been pinned via a call to | |
| 1206 | + * pin_user_pages*(). | |
| 1207 | + * | |
| 1208 | + * For non-huge pages, the return value is partially fuzzy: false is not fuzzy, | |
| 1209 | + * because it means "definitely not pinned for DMA", but true means "probably | |
| 1210 | + * pinned for DMA, but possibly a false positive due to having at least | |
| 1211 | + * GUP_PIN_COUNTING_BIAS worth of normal page references". | |
| 1212 | + * | |
| 1213 | + * False positives are OK, because: a) it's unlikely for a page to get that many | |
| 1214 | + * refcounts, and b) all the callers of this routine are expected to be able to | |
| 1215 | + * deal gracefully with a false positive. | |
| 1216 | + * | |
| 1217 | + * For huge pages, the result will be exactly correct. That's because we have | |
| 1218 | + * more tracking data available: the 3rd struct page in the compound page is | |
| 1219 | + * used to track the pincount (instead using of the GUP_PIN_COUNTING_BIAS | |
| 1220 | + * scheme). | |
| 1221 | + * | |
| 1222 | + * For more information, please see Documentation/vm/pin_user_pages.rst. | |
| 1223 | + * | |
| 1224 | + * @page: pointer to page to be queried. | |
| 1225 | + * @Return: True, if it is likely that the page has been "dma-pinned". | |
| 1226 | + * False, if the page is definitely not dma-pinned. | |
| 1227 | + */ | |
| 1228 | +static inline bool page_maybe_dma_pinned(struct page *page) | |
| 1229 | +{ | |
| 1230 | + if (hpage_pincount_available(page)) | |
| 1231 | + return compound_pincount(page) > 0; | |
| 1232 | + | |
| 1233 | + /* | |
| 1234 | + * page_ref_count() is signed. If that refcount overflows, then | |
| 1235 | + * page_ref_count() returns a negative value, and callers will avoid | |
| 1236 | + * further incrementing the refcount. | |
| 1237 | + * | |
| 1238 | + * Here, for that overflow case, use the signed bit to count a little | |
| 1239 | + * bit higher via unsigned math, and thus still get an accurate result. | |
| 1240 | + */ | |
| 1241 | + return ((unsigned int)page_ref_count(compound_head(page))) >= | |
| 1242 | + GUP_PIN_COUNTING_BIAS; | |
| 1243 | +} | |
| 1244 | + | |
| 1055 | 1245 | #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) |
| 1056 | 1246 | #define SECTION_IN_PAGE_FLAGS |
| 1057 | 1247 | #endif |
| @@ -1599,9 +1789,26 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma, · 541 unmodified lines | ||
| 1599 | 1789 | unsigned long old_addr, struct vm_area_struct *new_vma, |
| 1600 | 1790 | unsigned long new_addr, unsigned long len, |
| 1601 | 1791 | bool need_rmap_locks); |
| 1792 | + | |
| 1793 | +/* | |
| 1794 | + * Flags used by change_protection(). For now we make it a bitmap so | |
| 1795 | + * that we can pass in multiple flags just like parameters. However | |
| 1796 | + * for now all the callers are only use one of the flags at the same | |
| 1797 | + * time. | |
| 1798 | + */ | |
| 1799 | +/* Whether we should allow dirty bit accounting */ | |
| 1800 | +#define MM_CP_DIRTY_ACCT (1UL << 0) | |
| 1801 | +/* Whether this protection change is for NUMA hints */ | |
| 1802 | +#define MM_CP_PROT_NUMA (1UL << 1) | |
| 1803 | +/* Whether this change is for write protecting */ | |
| 1804 | +#define MM_CP_UFFD_WP (1UL << 2) /* do wp */ | |
| 1805 | +#define MM_CP_UFFD_WP_RESOLVE (1UL << 3) /* Resolve wp */ | |
| 1806 | +#define MM_CP_UFFD_WP_ALL (MM_CP_UFFD_WP | \ | |
| 1807 | + MM_CP_UFFD_WP_RESOLVE) | |
| 1808 | + | |
| 1602 | 1809 | extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, |
| 1603 | 1810 | unsigned long end, pgprot_t newprot, |
| 1604 | − int dirty_accountable, int prot_numa); | |
| 1811 | + unsigned long cp_flags); | |
| 1605 | 1812 | extern int mprotect_fixup(struct vm_area_struct *vma, |
| 1606 | 1813 | struct vm_area_struct **pprev, unsigned long start, |
| 1607 | 1814 | unsigned long end, unsigned long newflags); |
| @@ -1720,6 +1927,18 @@ static inline void sync_mm_rss(struct mm_struct *mm) · 112 unmodified lines | ||
| 1720 | 1927 | } |
| 1721 | 1928 | #endif |
| 1722 | 1929 | |
| 1930 | +#ifndef CONFIG_ARCH_HAS_PTE_SPECIAL | |
| 1931 | +static inline int pte_special(pte_t pte) | |
| 1932 | +{ | |
| 1933 | + return 0; | |
| 1934 | +} | |
| 1935 | + | |
| 1936 | +static inline pte_t pte_mkspecial(pte_t pte) | |
| 1937 | +{ | |
| 1938 | + return pte; | |
| 1939 | +} | |
| 1940 | +#endif | |
| 1941 | + | |
| 1723 | 1942 | #ifndef CONFIG_ARCH_HAS_PTE_DEVMAP |
| 1724 | 1943 | static inline int pte_devmap(pte_t pte) |
| 1725 | 1944 | { |
| @@ -2364,26 +2583,7 @@ struct vm_unmapped_area_info { · 638 unmodified lines | ||
| 2364 | 2583 | unsigned long align_offset; |
| 2365 | 2584 | }; |
| 2366 | 2585 | |
| 2367 | −extern unsigned long unmapped_area(struct vm_unmapped_area_info *info); | |
| 2368 | −extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info); | |
| 2369 | − | |
| 2370 | −/* | |
| 2371 | − * Search for an unmapped address range. | |
| 2372 | − * | |
| 2373 | − * We are looking for a range that: | |
| 2374 | − * - does not intersect with any VMA; | |
| 2375 | − * - is contained within the [low_limit, high_limit) interval; | |
| 2376 | − * - is at least the desired size. | |
| 2377 | − * - satisfies (begin_addr & align_mask) == (align_offset & align_mask) | |
| 2378 | − */ | |
| 2379 | −static inline unsigned long | |
| 2380 | −vm_unmapped_area(struct vm_unmapped_area_info *info) | |
| 2381 | −{ | |
| 2382 | − if (info->flags & VM_UNMAPPED_AREA_TOPDOWN) | |
| 2383 | − return unmapped_area_topdown(info); | |
| 2384 | − else | |
| 2385 | − return unmapped_area(info); | |
| 2386 | −} | |
| 2586 | +extern unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info); | |
| 2387 | 2587 | |
| 2388 | 2588 | /* truncate.c */ |
| 2389 | 2589 | extern void truncate_inode_pages(struct address_space *, loff_t); |
| @@ -2519,6 +2719,8 @@ struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); · 129 unmodified lines | ||
| 2519 | 2719 | int remap_pfn_range(struct vm_area_struct *, unsigned long addr, |
| 2520 | 2720 | unsigned long pfn, unsigned long size, pgprot_t); |
| 2521 | 2721 | int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); |
| 2722 | +int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr, | |
| 2723 | + struct page **pages, unsigned long *num); | |
| 2522 | 2724 | int vm_map_pages(struct vm_area_struct *vma, struct page **pages, |
| 2523 | 2725 | unsigned long num); |
| 2524 | 2726 | int vm_map_pages_zero(struct vm_area_struct *vma, struct page **pages, |
| @@ -2867,6 +3069,23 @@ extern long copy_huge_page_from_user(struct page *dst_page, · 342 unmodified lines | ||
| 2867 | 3069 | const void __user *usr_src, |
| 2868 | 3070 | unsigned int pages_per_huge_page, |
| 2869 | 3071 | bool allow_pagefault); |
| 3072 | + | |
| 3073 | +/** | |
| 3074 | + * vma_is_special_huge - Are transhuge page-table entries considered special? | |
| 3075 | + * @vma: Pointer to the struct vm_area_struct to consider | |
| 3076 | + * | |
| 3077 | + * Whether transhuge page-table entries are considered "special" following | |
| 3078 | + * the definition in vm_normal_page(). | |
| 3079 | + * | |
| 3080 | + * Return: true if transhuge page-table entries should be considered special, | |
| 3081 | + * false otherwise. | |
| 3082 | + */ | |
| 3083 | +static inline bool vma_is_special_huge(const struct vm_area_struct *vma) | |
| 3084 | +{ | |
| 3085 | + return vma_is_dax(vma) || (vma->vm_file && | |
| 3086 | + (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP))); | |
| 3087 | +} | |
| 3088 | + | |
| 2870 | 3089 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ |
| 2871 | 3090 | |
| 2872 | 3091 | #ifdef CONFIG_DEBUG_PAGEALLOC |
| @@ -6,19 +6,20 @@ · 5 unmodified lines | ||
| 6 | 6 | #include <linux/swap.h> |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | − * page_is_file_cache - should the page be on a file LRU or anon LRU? | |
| 9 | + * page_is_file_lru - should the page be on a file LRU or anon LRU? | |
| 10 | 10 | * @page: the page to test |
| 11 | 11 | * |
| 12 | − * Returns 1 if @page is page cache page backed by a regular filesystem, | |
| 13 | − * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. | |
| 14 | − * Used by functions that manipulate the LRU lists, to sort a page | |
| 15 | − * onto the right LRU list. | |
| 12 | + * Returns 1 if @page is a regular filesystem backed page cache page or a lazily | |
| 13 | + * freed anonymous page (e.g. via MADV_FREE). Returns 0 if @page is a normal | |
| 14 | + * anonymous page, a tmpfs page or otherwise ram or swap backed page. Used by | |
| 15 | + * functions that manipulate the LRU lists, to sort a page onto the right LRU | |
| 16 | + * list. | |
| 16 | 17 | * |
| 17 | 18 | * We would like to get this info without a page flag, but the state |
| 18 | 19 | * needs to survive until the page is last deleted from the LRU, which |
| 19 | 20 | * could be as far down as __page_cache_release. |
| 20 | 21 | */ |
| 21 | −static inline int page_is_file_cache(struct page *page) | |
| 22 | +static inline int page_is_file_lru(struct page *page) | |
| 22 | 23 | { |
| 23 | 24 | return !PageSwapBacked(page); |
| 24 | 25 | } |
| @@ -75,7 +76,7 @@ static __always_inline void del_page_from_lru_list(struct page *page, · 50 unmodified lines | ||
| 75 | 76 | */ |
| 76 | 77 | static inline enum lru_list page_lru_base_type(struct page *page) |
| 77 | 78 | { |
| 78 | − if (page_is_file_cache(page)) | |
| 79 | + if (page_is_file_lru(page)) | |
| 79 | 80 | return LRU_INACTIVE_FILE; |
| 80 | 81 | return LRU_INACTIVE_ANON; |
| 81 | 82 | } |
| @@ -137,7 +137,7 @@ struct page { · 136 unmodified lines | ||
| 137 | 137 | }; |
| 138 | 138 | struct { /* Second tail page of compound page */ |
| 139 | 139 | unsigned long _compound_pad_1; /* compound_head */ |
| 140 | − unsigned long _compound_pad_2; | |
| 140 | + atomic_t hpage_pinned_refcount; | |
| 141 | 141 | /* For both global and memcg */ |
| 142 | 142 | struct list_head deferred_list; |
| 143 | 143 | }; |
| @@ -226,6 +226,11 @@ static inline atomic_t *compound_mapcount_ptr(struct page *page) · 82 unmodified lines | ||
| 226 | 226 | return &page[1].compound_mapcount; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | +static inline atomic_t *compound_pincount_ptr(struct page *page) | |
| 230 | +{ | |
| 231 | + return &page[2].hpage_pinned_refcount; | |
| 232 | +} | |
| 233 | + | |
| 229 | 234 | /* |
| 230 | 235 | * Used for sizing the vmemmap region on some architectures |
| 231 | 236 | */ |
| @@ -284,8 +289,8 @@ struct vm_userfaultfd_ctx {}; · 52 unmodified lines | ||
| 284 | 289 | #endif /* CONFIG_USERFAULTFD */ |
| 285 | 290 | |
| 286 | 291 | /* |
| 287 | − * This struct defines a memory VMM memory area. There is one of these | |
| 288 | − * per VM-area/task. A VM area is any part of the process virtual memory | |
| 292 | + * This struct describes a virtual memory area. There is one of these | |
| 293 | + * per VM-area/task. A VM area is any part of the process virtual memory | |
| 289 | 294 | * space that has a special rule for the page-fault handlers (ie a shared |
| 290 | 295 | * library, the executable area etc). |
| 291 | 296 | */ |
| @@ -107,9 +107,6 @@ struct mmc_command { · 106 unmodified lines | ||
| 107 | 107 | */ |
| 108 | 108 | |
| 109 | 109 | unsigned int busy_timeout; /* busy detect timeout in ms */ |
| 110 | − /* Set this flag only for blocking sanitize request */ | |
| 111 | − bool sanitize_busy; | |
| 112 | − | |
| 113 | 110 | struct mmc_data *data; /* data segment associated with cmd */ |
| 114 | 111 | struct mmc_request *mrq; /* associated request */ |
| 115 | 112 | }; |
| @@ -322,6 +322,8 @@ struct mmc_host { · 321 unmodified lines | ||
| 322 | 322 | #define MMC_CAP_3_3V_DDR (1 << 11) /* Host supports eMMC DDR 3.3V */ |
| 323 | 323 | #define MMC_CAP_1_8V_DDR (1 << 12) /* Host supports eMMC DDR 1.8V */ |
| 324 | 324 | #define MMC_CAP_1_2V_DDR (1 << 13) /* Host supports eMMC DDR 1.2V */ |
| 325 | +#define MMC_CAP_DDR (MMC_CAP_3_3V_DDR | MMC_CAP_1_8V_DDR | \ | |
| 326 | + MMC_CAP_1_2V_DDR) | |
| 325 | 327 | #define MMC_CAP_POWER_OFF_CARD (1 << 14) /* Can power off after boot */ |
| 326 | 328 | #define MMC_CAP_BUS_WIDTH_TEST (1 << 15) /* CMD14/CMD19 bus width ok */ |
| 327 | 329 | #define MMC_CAP_UHS_SDR12 (1 << 16) /* Host supports UHS SDR12 mode */ |
| @@ -333,6 +335,7 @@ struct mmc_host { · 5 unmodified lines | ||
| 333 | 335 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \ |
| 334 | 336 | MMC_CAP_UHS_DDR50) |
| 335 | 337 | #define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */ |
| 338 | +#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */ | |
| 336 | 339 | #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ |
| 337 | 340 | #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ |
| 338 | 341 | #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ |
| @@ -462,7 +465,10 @@ struct mmc_host { · 123 unmodified lines | ||
| 462 | 465 | bool cqe_enabled; |
| 463 | 466 | bool cqe_on; |
| 464 | 467 | |
| 465 | − unsigned long private[0] ____cacheline_aligned; | |
| 468 | + /* Host Software Queue support */ | |
| 469 | + bool hsq_enabled; | |
| 470 | + | |
| 471 | + unsigned long private[] ____cacheline_aligned; | |
| 466 | 472 | }; |
| 467 | 473 | |
| 468 | 474 | struct device_node; |
| @@ -161,6 +161,16 @@ static inline bool mmc_op_multi(u32 opcode) · 160 unmodified lines | ||
| 161 | 161 | #define R1_STATE_PRG 7 |
| 162 | 162 | #define R1_STATE_DIS 8 |
| 163 | 163 | |
| 164 | +static inline bool mmc_ready_for_data(u32 status) | |
| 165 | +{ | |
| 166 | + /* | |
| 167 | + * Some cards mishandle the status bits, so make sure to check both the | |
| 168 | + * busy indication and the card state. | |
| 169 | + */ | |
| 170 | + return status & R1_READY_FOR_DATA && | |
| 171 | + R1_CURRENT_STATE(status) == R1_STATE_TRAN; | |
| 172 | +} | |
| 173 | + | |
| 164 | 174 | /* |
| 165 | 175 | * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS |
| 166 | 176 | * R1 is the low order byte; R2 is the next highest byte, when present. |
| @@ -25,7 +25,7 @@ struct sdio_func_tuple { · 24 unmodified lines | ||
| 25 | 25 | struct sdio_func_tuple *next; |
| 26 | 26 | unsigned char code; |
| 27 | 27 | unsigned char size; |
| 28 | − unsigned char data[0]; | |
| 28 | + unsigned char data[]; | |
| 29 | 29 | }; |
| 30 | 30 | |
| 31 | 31 | /* |
| @@ -100,41 +100,6 @@ struct free_area { · 99 unmodified lines | ||
| 100 | 100 | unsigned long nr_free; |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | −/* Used for pages not on another list */ | |
| 104 | −static inline void add_to_free_area(struct page *page, struct free_area *area, | |
| 105 | − int migratetype) | |
| 106 | −{ | |
| 107 | − list_add(&page->lru, &area->free_list[migratetype]); | |
| 108 | − area->nr_free++; | |
| 109 | −} | |
| 110 | − | |
| 111 | −/* Used for pages not on another list */ | |
| 112 | −static inline void add_to_free_area_tail(struct page *page, struct free_area *area, | |
| 113 | − int migratetype) | |
| 114 | −{ | |
| 115 | − list_add_tail(&page->lru, &area->free_list[migratetype]); | |
| 116 | − area->nr_free++; | |
| 117 | −} | |
| 118 | − | |
| 119 | −#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR | |
| 120 | −/* Used to preserve page allocation order entropy */ | |
| 121 | −void add_to_free_area_random(struct page *page, struct free_area *area, | |
| 122 | − int migratetype); | |
| 123 | −#else | |
| 124 | −static inline void add_to_free_area_random(struct page *page, | |
| 125 | − struct free_area *area, int migratetype) | |
| 126 | −{ | |
| 127 | − add_to_free_area(page, area, migratetype); | |
| 128 | −} | |
| 129 | −#endif | |
| 130 | − | |
| 131 | −/* Used for pages which are on another list */ | |
| 132 | −static inline void move_to_free_area(struct page *page, struct free_area *area, | |
| 133 | − int migratetype) | |
| 134 | −{ | |
| 135 | − list_move(&page->lru, &area->free_list[migratetype]); | |
| 136 | −} | |
| 137 | − | |
| 138 | 103 | static inline struct page *get_page_from_free_area(struct free_area *area, |
| 139 | 104 | int migratetype) |
| 140 | 105 | { |
| @@ -142,15 +107,6 @@ static inline struct page *get_page_from_free_area(struct free_area *area, · 1 unmodified line | ||
| 142 | 107 | struct page, lru); |
| 143 | 108 | } |
| 144 | 109 | |
| 145 | −static inline void del_page_from_free_area(struct page *page, | |
| 146 | − struct free_area *area) | |
| 147 | −{ | |
| 148 | − list_del(&page->lru); | |
| 149 | − __ClearPageBuddy(page); | |
| 150 | − set_page_private(page, 0); | |
| 151 | − area->nr_free--; | |
| 152 | −} | |
| 153 | − | |
| 154 | 110 | static inline bool free_area_empty(struct free_area *area, int migratetype) |
| 155 | 111 | { |
| 156 | 112 | return list_empty(&area->free_list[migratetype]); |
| @@ -243,6 +199,8 @@ enum node_stat_item { · 86 unmodified lines | ||
| 243 | 199 | NR_DIRTIED, /* page dirtyings since bootup */ |
| 244 | 200 | NR_WRITTEN, /* page writings since bootup */ |
| 245 | 201 | NR_KERNEL_MISC_RECLAIMABLE, /* reclaimable non-slab kernel pages */ |
| 202 | + NR_FOLL_PIN_ACQUIRED, /* via: pin_user_page(), gup flag: FOLL_PIN */ | |
| 203 | + NR_FOLL_PIN_RELEASED, /* pages returned via unpin_user_page() */ | |
| 246 | 204 | NR_VM_NODE_STAT_ITEMS |
| 247 | 205 | }; |
| 248 | 206 | |
| @@ -706,7 +664,6 @@ struct deferred_split { · 457 unmodified lines | ||
| 706 | 664 | * Memory statistics and page replacement data structures are maintained on a |
| 707 | 665 | * per-zone basis. |
| 708 | 666 | */ |
| 709 | −struct bootmem_data; | |
| 710 | 667 | typedef struct pglist_data { |
| 711 | 668 | struct zone node_zones[MAX_NR_ZONES]; |
| 712 | 669 | struct zonelist node_zonelists[MAX_ZONELISTS]; |
| @@ -1170,6 +1127,7 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec) · 457 unmodified lines | ||
| 1170 | 1127 | #define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK) |
| 1171 | 1128 | |
| 1172 | 1129 | #define SUBSECTION_SHIFT 21 |
| 1130 | +#define SUBSECTION_SIZE (1UL << SUBSECTION_SHIFT) | |
| 1173 | 1131 | |
| 1174 | 1132 | #define PFN_SUBSECTION_SHIFT (SUBSECTION_SHIFT - PAGE_SHIFT) |
| 1175 | 1133 | #define PAGES_PER_SUBSECTION (1UL << PFN_SUBSECTION_SHIFT) |
| @@ -1185,7 +1143,9 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec) · 9 unmodified lines | ||
| 1185 | 1143 | #define SUBSECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SUBSECTION_MASK) |
| 1186 | 1144 | |
| 1187 | 1145 | struct mem_section_usage { |
| 1146 | +#ifdef CONFIG_SPARSEMEM_VMEMMAP | |
| 1188 | 1147 | DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION); |
| 1148 | +#endif | |
| 1189 | 1149 | /* See declaration of similar field in struct zone */ |
| 1190 | 1150 | unsigned long pageblock_flags[0]; |
| 1191 | 1151 | }; |
| @@ -1372,7 +1332,7 @@ static inline int pfn_valid(unsigned long pfn) · 180 unmodified lines | ||
| 1372 | 1332 | } |
| 1373 | 1333 | #endif |
| 1374 | 1334 | |
| 1375 | −static inline int pfn_present(unsigned long pfn) | |
| 1335 | +static inline int pfn_in_present_section(unsigned long pfn) | |
| 1376 | 1336 | { |
| 1377 | 1337 | if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) |
| 1378 | 1338 | return 0; |
| @@ -1409,7 +1369,7 @@ void sparse_init(void); · 30 unmodified lines | ||
| 1409 | 1369 | #else |
| 1410 | 1370 | #define sparse_init() do {} while (0) |
| 1411 | 1371 | #define sparse_index_init(_sec, _nid) do {} while (0) |
| 1412 | −#define pfn_present pfn_valid | |
| 1372 | +#define pfn_in_present_section pfn_valid | |
| 1413 | 1373 | #define subsection_map_init(_pfn, _nr_pages) do {} while (0) |
| 1414 | 1374 | #endif /* CONFIG_SPARSEMEM */ |
| 1415 | 1375 | |
| @@ -667,9 +667,7 @@ struct x86_cpu_id { · 666 unmodified lines | ||
| 667 | 667 | kernel_ulong_t driver_data; |
| 668 | 668 | }; |
| 669 | 669 | |
| 670 | −#define X86_FEATURE_MATCH(x) \ | |
| 671 | − { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x } | |
| 672 | − | |
| 670 | +/* Wild cards for x86_cpu_id::vendor, family, model and feature */ | |
| 673 | 671 | #define X86_VENDOR_ANY 0xffff |
| 674 | 672 | #define X86_FAMILY_ANY 0 |
| 675 | 673 | #define X86_MODEL_ANY 0 |
| @@ -821,4 +819,17 @@ struct wmi_device_id { · 145 unmodified lines | ||
| 821 | 819 | const void *context; |
| 822 | 820 | }; |
| 823 | 821 | |
| 822 | +#define MHI_DEVICE_MODALIAS_FMT "mhi:%s" | |
| 823 | +#define MHI_NAME_SIZE 32 | |
| 824 | + | |
| 825 | +/** | |
| 826 | + * struct mhi_device_id - MHI device identification | |
| 827 | + * @chan: MHI channel name | |
| 828 | + * @driver_data: driver data; | |
| 829 | + */ | |
| 830 | +struct mhi_device_id { | |
| 831 | + const char chan[MHI_NAME_SIZE]; | |
| 832 | + kernel_ulong_t driver_data; | |
| 833 | +}; | |
| 834 | + | |
| 824 | 835 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
| @@ -0,0 +1,337 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * most.h - API for component and adapter drivers | |
| 4 | + * | |
| 5 | + * Copyright (C) 2013-2015, Microchip Technology Germany II GmbH & Co. KG | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __MOST_CORE_H__ | |
| 9 | +#define __MOST_CORE_H__ | |
| 10 | + | |
| 11 | +#include <linux/types.h> | |
| 12 | +#include <linux/device.h> | |
| 13 | + | |
| 14 | +struct module; | |
| 15 | +struct interface_private; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * Interface type | |
| 19 | + */ | |
| 20 | +enum most_interface_type { | |
| 21 | + ITYPE_LOOPBACK = 1, | |
| 22 | + ITYPE_I2C, | |
| 23 | + ITYPE_I2S, | |
| 24 | + ITYPE_TSI, | |
| 25 | + ITYPE_HBI, | |
| 26 | + ITYPE_MEDIALB_DIM, | |
| 27 | + ITYPE_MEDIALB_DIM2, | |
| 28 | + ITYPE_USB, | |
| 29 | + ITYPE_PCIE | |
| 30 | +}; | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * Channel direction. | |
| 34 | + */ | |
| 35 | +enum most_channel_direction { | |
| 36 | + MOST_CH_RX = 1 << 0, | |
| 37 | + MOST_CH_TX = 1 << 1, | |
| 38 | +}; | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * Channel data type. | |
| 42 | + */ | |
| 43 | +enum most_channel_data_type { | |
| 44 | + MOST_CH_CONTROL = 1 << 0, | |
| 45 | + MOST_CH_ASYNC = 1 << 1, | |
| 46 | + MOST_CH_ISOC = 1 << 2, | |
| 47 | + MOST_CH_SYNC = 1 << 5, | |
| 48 | +}; | |
| 49 | + | |
| 50 | +enum most_status_flags { | |
| 51 | + /* MBO was processed successfully (data was send or received )*/ | |
| 52 | + MBO_SUCCESS = 0, | |
| 53 | + /* The MBO contains wrong or missing information. */ | |
| 54 | + MBO_E_INVAL, | |
| 55 | + /* MBO was completed as HDM Channel will be closed */ | |
| 56 | + MBO_E_CLOSE, | |
| 57 | +}; | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * struct most_channel_capability - Channel capability | |
| 61 | + * @direction: Supported channel directions. | |
| 62 | + * The value is bitwise OR-combination of the values from the | |
| 63 | + * enumeration most_channel_direction. Zero is allowed value and means | |
| 64 | + * "channel may not be used". | |
| 65 | + * @data_type: Supported channel data types. | |
| 66 | + * The value is bitwise OR-combination of the values from the | |
| 67 | + * enumeration most_channel_data_type. Zero is allowed value and means | |
| 68 | + * "channel may not be used". | |
| 69 | + * @num_buffers_packet: Maximum number of buffers supported by this channel | |
| 70 | + * for packet data types (Async,Control,QoS) | |
| 71 | + * @buffer_size_packet: Maximum buffer size supported by this channel | |
| 72 | + * for packet data types (Async,Control,QoS) | |
| 73 | + * @num_buffers_streaming: Maximum number of buffers supported by this channel | |
| 74 | + * for streaming data types (Sync,AV Packetized) | |
| 75 | + * @buffer_size_streaming: Maximum buffer size supported by this channel | |
| 76 | + * for streaming data types (Sync,AV Packetized) | |
| 77 | + * @name_suffix: Optional suffix providean by an HDM that is attached to the | |
| 78 | + * regular channel name. | |
| 79 | + * | |
| 80 | + * Describes the capabilities of a MOST channel like supported Data Types | |
| 81 | + * and directions. This information is provided by an HDM for the MostCore. | |
| 82 | + * | |
| 83 | + * The Core creates read only sysfs attribute files in | |
| 84 | + * /sys/devices/most/mdev#/<channel>/ with the | |
| 85 | + * following attributes: | |
| 86 | + * -available_directions | |
| 87 | + * -available_datatypes | |
| 88 | + * -number_of_packet_buffers | |
| 89 | + * -number_of_stream_buffers | |
| 90 | + * -size_of_packet_buffer | |
| 91 | + * -size_of_stream_buffer | |
| 92 | + * where content of each file is a string with all supported properties of this | |
| 93 | + * very channel attribute. | |
| 94 | + */ | |
| 95 | +struct most_channel_capability { | |
| 96 | + u16 direction; | |
| 97 | + u16 data_type; | |
| 98 | + u16 num_buffers_packet; | |
| 99 | + u16 buffer_size_packet; | |
| 100 | + u16 num_buffers_streaming; | |
| 101 | + u16 buffer_size_streaming; | |
| 102 | + const char *name_suffix; | |
| 103 | +}; | |
| 104 | + | |
| 105 | +/** | |
| 106 | + * struct most_channel_config - stores channel configuration | |
| 107 | + * @direction: direction of the channel | |
| 108 | + * @data_type: data type travelling over this channel | |
| 109 | + * @num_buffers: number of buffers | |
| 110 | + * @buffer_size: size of a buffer for AIM. | |
| 111 | + * Buffer size may be cutted down by HDM in a configure callback | |
| 112 | + * to match to a given interface and channel type. | |
| 113 | + * @extra_len: additional buffer space for internal HDM purposes like padding. | |
| 114 | + * May be set by HDM in a configure callback if needed. | |
| 115 | + * @subbuffer_size: size of a subbuffer | |
| 116 | + * @packets_per_xact: number of MOST frames that are packet inside one USB | |
| 117 | + * packet. This is USB specific | |
| 118 | + * | |
| 119 | + * Describes the configuration for a MOST channel. This information is | |
| 120 | + * provided from the MostCore to a HDM (like the Medusa PCIe Interface) as a | |
| 121 | + * parameter of the "configure" function call. | |
| 122 | + */ | |
| 123 | +struct most_channel_config { | |
| 124 | + enum most_channel_direction direction; | |
| 125 | + enum most_channel_data_type data_type; | |
| 126 | + u16 num_buffers; | |
| 127 | + u16 buffer_size; | |
| 128 | + u16 extra_len; | |
| 129 | + u16 subbuffer_size; | |
| 130 | + u16 packets_per_xact; | |
| 131 | + u16 dbr_size; | |
| 132 | +}; | |
| 133 | + | |
| 134 | +/* | |
| 135 | + * struct mbo - MOST Buffer Object. | |
| 136 | + * @context: context for core completion handler | |
| 137 | + * @priv: private data for HDM | |
| 138 | + * | |
| 139 | + * public: documented fields that are used for the communications | |
| 140 | + * between MostCore and HDMs | |
| 141 | + * | |
| 142 | + * @list: list head for use by the mbo's current owner | |
| 143 | + * @ifp: (in) associated interface instance | |
| 144 | + * @num_buffers_ptr: amount of pool buffers | |
| 145 | + * @hdm_channel_id: (in) HDM channel instance | |
| 146 | + * @virt_address: (in) kernel virtual address of the buffer | |
| 147 | + * @bus_address: (in) bus address of the buffer | |
| 148 | + * @buffer_length: (in) buffer payload length | |
| 149 | + * @processed_length: (out) processed length | |
| 150 | + * @status: (out) transfer status | |
| 151 | + * @complete: (in) completion routine | |
| 152 | + * | |
| 153 | + * The core allocates and initializes the MBO. | |
| 154 | + * | |
| 155 | + * The HDM receives MBO for transfer from the core with the call to enqueue(). | |
| 156 | + * The HDM copies the data to- or from the buffer depending on configured | |
| 157 | + * channel direction, set "processed_length" and "status" and completes | |
| 158 | + * the transfer procedure by calling the completion routine. | |
| 159 | + * | |
| 160 | + * Finally, the MBO is being deallocated or recycled for further | |
| 161 | + * transfers of the same or a different HDM. | |
| 162 | + * | |
| 163 | + * Directions of usage: | |
| 164 | + * The core driver should never access any MBO fields (even if marked | |
| 165 | + * as "public") while the MBO is owned by an HDM. The ownership starts with | |
| 166 | + * the call of enqueue() and ends with the call of its complete() routine. | |
| 167 | + * | |
| 168 | + * II. | |
| 169 | + * Every HDM attached to the core driver _must_ ensure that it returns any MBO | |
| 170 | + * it owns (due to a previous call to enqueue() by the core driver) before it | |
| 171 | + * de-registers an interface or gets unloaded from the kernel. If this direction | |
| 172 | + * is violated memory leaks will occur, since the core driver does _not_ track | |
| 173 | + * MBOs it is currently not in control of. | |
| 174 | + * | |
| 175 | + */ | |
| 176 | +struct mbo { | |
| 177 | + void *context; | |
| 178 | + void *priv; | |
| 179 | + struct list_head list; | |
| 180 | + struct most_interface *ifp; | |
| 181 | + int *num_buffers_ptr; | |
| 182 | + u16 hdm_channel_id; | |
| 183 | + void *virt_address; | |
| 184 | + dma_addr_t bus_address; | |
| 185 | + u16 buffer_length; | |
| 186 | + u16 processed_length; | |
| 187 | + enum most_status_flags status; | |
| 188 | + void (*complete)(struct mbo *mbo); | |
| 189 | +}; | |
| 190 | + | |
| 191 | +/** | |
| 192 | + * Interface instance description. | |
| 193 | + * | |
| 194 | + * Describes an interface of a MOST device the core driver is bound to. | |
| 195 | + * This structure is allocated and initialized in the HDM. MostCore may not | |
| 196 | + * modify this structure. | |
| 197 | + * | |
| 198 | + * @dev: the actual device | |
| 199 | + * @mod: module | |
| 200 | + * @interface Interface type. \sa most_interface_type. | |
| 201 | + * @description PRELIMINARY. | |
| 202 | + * Unique description of the device instance from point of view of the | |
| 203 | + * interface in free text form (ASCII). | |
| 204 | + * It may be a hexadecimal presentation of the memory address for the MediaLB | |
| 205 | + * IP or USB device ID with USB properties for USB interface, etc. | |
| 206 | + * @num_channels Number of channels and size of the channel_vector. | |
| 207 | + * @channel_vector Properties of the channels. | |
| 208 | + * Array index represents channel ID by the driver. | |
| 209 | + * @configure Callback to change data type for the channel of the | |
| 210 | + * interface instance. May be zero if the instance of the interface is not | |
| 211 | + * configurable. Parameter channel_config describes direction and data | |
| 212 | + * type for the channel, configured by the higher level. The content of | |
| 213 | + * @enqueue Delivers MBO to the HDM for processing. | |
| 214 | + * After HDM completes Rx- or Tx- operation the processed MBO shall | |
| 215 | + * be returned back to the MostCore using completion routine. | |
| 216 | + * The reason to get the MBO delivered from the MostCore after the channel | |
| 217 | + * is poisoned is the re-opening of the channel by the application. | |
| 218 | + * In this case the HDM shall hold MBOs and service the channel as usual. | |
| 219 | + * The HDM must be able to hold at least one MBO for each channel. | |
| 220 | + * The callback returns a negative value on error, otherwise 0. | |
| 221 | + * @poison_channel Informs HDM about closing the channel. The HDM shall | |
| 222 | + * cancel all transfers and synchronously or asynchronously return | |
| 223 | + * all enqueued for this channel MBOs using the completion routine. | |
| 224 | + * The callback returns a negative value on error, otherwise 0. | |
| 225 | + * @request_netinfo: triggers retrieving of network info from the HDM by | |
| 226 | + * means of "Message exchange over MDP/MEP" | |
| 227 | + * The call of the function request_netinfo with the parameter on_netinfo as | |
| 228 | + * NULL prohibits use of the previously obtained function pointer. | |
| 229 | + * @priv Private field used by mostcore to store context information. | |
| 230 | + */ | |
| 231 | +struct most_interface { | |
| 232 | + struct device *dev; | |
| 233 | + struct device *driver_dev; | |
| 234 | + struct module *mod; | |
| 235 | + enum most_interface_type interface; | |
| 236 | + const char *description; | |
| 237 | + unsigned int num_channels; | |
| 238 | + struct most_channel_capability *channel_vector; | |
| 239 | + void *(*dma_alloc)(struct mbo *mbo, u32 size); | |
| 240 | + void (*dma_free)(struct mbo *mbo, u32 size); | |
| 241 | + int (*configure)(struct most_interface *iface, int channel_idx, | |
| 242 | + struct most_channel_config *channel_config); | |
| 243 | + int (*enqueue)(struct most_interface *iface, int channel_idx, | |
| 244 | + struct mbo *mbo); | |
| 245 | + int (*poison_channel)(struct most_interface *iface, int channel_idx); | |
| 246 | + void (*request_netinfo)(struct most_interface *iface, int channel_idx, | |
| 247 | + void (*on_netinfo)(struct most_interface *iface, | |
| 248 | + unsigned char link_stat, | |
| 249 | + unsigned char *mac_addr)); | |
| 250 | + void *priv; | |
| 251 | + struct interface_private *p; | |
| 252 | +}; | |
| 253 | + | |
| 254 | +/** | |
| 255 | + * struct most_component - identifies a loadable component for the mostcore | |
| 256 | + * @list: list_head | |
| 257 | + * @name: component name | |
| 258 | + * @probe_channel: function for core to notify driver about channel connection | |
| 259 | + * @disconnect_channel: callback function to disconnect a certain channel | |
| 260 | + * @rx_completion: completion handler for received packets | |
| 261 | + * @tx_completion: completion handler for transmitted packets | |
| 262 | + */ | |
| 263 | +struct most_component { | |
| 264 | + struct list_head list; | |
| 265 | + const char *name; | |
| 266 | + struct module *mod; | |
| 267 | + int (*probe_channel)(struct most_interface *iface, int channel_idx, | |
| 268 | + struct most_channel_config *cfg, char *name, | |
| 269 | + char *param); | |
| 270 | + int (*disconnect_channel)(struct most_interface *iface, | |
| 271 | + int channel_idx); | |
| 272 | + int (*rx_completion)(struct mbo *mbo); | |
| 273 | + int (*tx_completion)(struct most_interface *iface, int channel_idx); | |
| 274 | + int (*cfg_complete)(void); | |
| 275 | +}; | |
| 276 | + | |
| 277 | +/** | |
| 278 | + * most_register_interface - Registers instance of the interface. | |
| 279 | + * @iface: Pointer to the interface instance description. | |
| 280 | + * | |
| 281 | + * Returns a pointer to the kobject of the generated instance. | |
| 282 | + * | |
| 283 | + * Note: HDM has to ensure that any reference held on the kobj is | |
| 284 | + * released before deregistering the interface. | |
| 285 | + */ | |
| 286 | +int most_register_interface(struct most_interface *iface); | |
| 287 | + | |
| 288 | +/** | |
| 289 | + * Deregisters instance of the interface. | |
| 290 | + * @intf_instance Pointer to the interface instance description. | |
| 291 | + */ | |
| 292 | +void most_deregister_interface(struct most_interface *iface); | |
| 293 | +void most_submit_mbo(struct mbo *mbo); | |
| 294 | + | |
| 295 | +/** | |
| 296 | + * most_stop_enqueue - prevents core from enqueing MBOs | |
| 297 | + * @iface: pointer to interface | |
| 298 | + * @channel_idx: channel index | |
| 299 | + */ | |
| 300 | +void most_stop_enqueue(struct most_interface *iface, int channel_idx); | |
| 301 | + | |
| 302 | +/** | |
| 303 | + * most_resume_enqueue - allow core to enqueue MBOs again | |
| 304 | + * @iface: pointer to interface | |
| 305 | + * @channel_idx: channel index | |
| 306 | + * | |
| 307 | + * This clears the enqueue halt flag and enqueues all MBOs currently | |
| 308 | + * in wait fifo. | |
| 309 | + */ | |
| 310 | +void most_resume_enqueue(struct most_interface *iface, int channel_idx); | |
| 311 | +int most_register_component(struct most_component *comp); | |
| 312 | +int most_deregister_component(struct most_component *comp); | |
| 313 | +struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx, | |
| 314 | + struct most_component *comp); | |
| 315 | +void most_put_mbo(struct mbo *mbo); | |
| 316 | +int channel_has_mbo(struct most_interface *iface, int channel_idx, | |
| 317 | + struct most_component *comp); | |
| 318 | +int most_start_channel(struct most_interface *iface, int channel_idx, | |
| 319 | + struct most_component *comp); | |
| 320 | +int most_stop_channel(struct most_interface *iface, int channel_idx, | |
| 321 | + struct most_component *comp); | |
| 322 | +int __init configfs_init(void); | |
| 323 | +int most_register_configfs_subsys(struct most_component *comp); | |
| 324 | +void most_deregister_configfs_subsys(struct most_component *comp); | |
| 325 | +int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name, | |
| 326 | + char *comp_param); | |
| 327 | +int most_remove_link(char *mdev, char *mdev_ch, char *comp_name); | |
| 328 | +int most_set_cfg_buffer_size(char *mdev, char *mdev_ch, u16 val); | |
| 329 | +int most_set_cfg_subbuffer_size(char *mdev, char *mdev_ch, u16 val); | |
| 330 | +int most_set_cfg_dbr_size(char *mdev, char *mdev_ch, u16 val); | |
| 331 | +int most_set_cfg_num_buffers(char *mdev, char *mdev_ch, u16 val); | |
| 332 | +int most_set_cfg_datatype(char *mdev, char *mdev_ch, char *buf); | |
| 333 | +int most_set_cfg_direction(char *mdev, char *mdev_ch, char *buf); | |
| 334 | +int most_set_cfg_packets_xact(char *mdev, char *mdev_ch, u16 val); | |
| 335 | +int most_cfg_complete(char *comp_name); | |
| 336 | +void most_interface_register_notify(const char *mdev_name); | |
| 337 | +#endif /* MOST_CORE_H_ */ | |
| @@ -0,0 +1,50 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_MSDOS_PARTITION_H | |
| 3 | +#define _LINUX_MSDOS_PARTITION_H | |
| 4 | + | |
| 5 | +#define MSDOS_LABEL_MAGIC 0xAA55 | |
| 6 | + | |
| 7 | +struct msdos_partition { | |
| 8 | + u8 boot_ind; /* 0x80 - active */ | |
| 9 | + u8 head; /* starting head */ | |
| 10 | + u8 sector; /* starting sector */ | |
| 11 | + u8 cyl; /* starting cylinder */ | |
| 12 | + u8 sys_ind; /* What partition type */ | |
| 13 | + u8 end_head; /* end head */ | |
| 14 | + u8 end_sector; /* end sector */ | |
| 15 | + u8 end_cyl; /* end cylinder */ | |
| 16 | + __le32 start_sect; /* starting sector counting from 0 */ | |
| 17 | + __le32 nr_sects; /* nr of sectors in partition */ | |
| 18 | +} __packed; | |
| 19 | + | |
| 20 | +enum msdos_sys_ind { | |
| 21 | + /* | |
| 22 | + * These three have identical behaviour; use the second one if DOS FDISK | |
| 23 | + * gets confused about extended/logical partitions starting past | |
| 24 | + * cylinder 1023. | |
| 25 | + */ | |
| 26 | + DOS_EXTENDED_PARTITION = 5, | |
| 27 | + LINUX_EXTENDED_PARTITION = 0x85, | |
| 28 | + WIN98_EXTENDED_PARTITION = 0x0f, | |
| 29 | + | |
| 30 | + LINUX_DATA_PARTITION = 0x83, | |
| 31 | + LINUX_LVM_PARTITION = 0x8e, | |
| 32 | + LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */ | |
| 33 | + | |
| 34 | + SOLARIS_X86_PARTITION = 0x82, /* also Linux swap partitions */ | |
| 35 | + NEW_SOLARIS_X86_PARTITION = 0xbf, | |
| 36 | + | |
| 37 | + DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */ | |
| 38 | + DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */ | |
| 39 | + DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */ | |
| 40 | + EZD_PARTITION = 0x55, /* EZ-DRIVE */ | |
| 41 | + | |
| 42 | + FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */ | |
| 43 | + OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */ | |
| 44 | + NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */ | |
| 45 | + BSDI_PARTITION = 0xb7, /* BSDI Partition ID */ | |
| 46 | + MINIX_PARTITION = 0x81, /* Minix Partition ID */ | |
| 47 | + UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ | |
| 48 | +}; | |
| 49 | + | |
| 50 | +#endif /* LINUX_MSDOS_PARTITION_H */ | |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #include <linux/types.h> |
| 10 | 10 | #include <linux/uio.h> |
| 11 | +#include <linux/list.h> | |
| 11 | 12 | #include <linux/notifier.h> |
| 12 | 13 | #include <linux/device.h> |
| 13 | 14 | #include <linux/of.h> |
| @@ -194,10 +195,43 @@ struct mtd_debug_info { · 180 unmodified lines | ||
| 194 | 195 | const char *partid; |
| 195 | 196 | }; |
| 196 | 197 | |
| 198 | +/** | |
| 199 | + * struct mtd_part - MTD partition specific fields | |
| 200 | + * | |
| 201 | + * @node: list node used to add an MTD partition to the parent partition list | |
| 202 | + * @offset: offset of the partition relatively to the parent offset | |
| 203 | + * @flags: original flags (before the mtdpart logic decided to tweak them based | |
| 204 | + * on flash constraints, like eraseblock/pagesize alignment) | |
| 205 | + * | |
| 206 | + * This struct is embedded in mtd_info and contains partition-specific | |
| 207 | + * properties/fields. | |
| 208 | + */ | |
| 209 | +struct mtd_part { | |
| 210 | + struct list_head node; | |
| 211 | + u64 offset; | |
| 212 | + u32 flags; | |
| 213 | +}; | |
| 214 | + | |
| 215 | +/** | |
| 216 | + * struct mtd_master - MTD master specific fields | |
| 217 | + * | |
| 218 | + * @partitions_lock: lock protecting accesses to the partition list. Protects | |
| 219 | + * not only the master partition list, but also all | |
| 220 | + * sub-partitions. | |
| 221 | + * @suspended: et to 1 when the device is suspended, 0 otherwise | |
| 222 | + * | |
| 223 | + * This struct is embedded in mtd_info and contains master-specific | |
| 224 | + * properties/fields. The master is the root MTD device from the MTD partition | |
| 225 | + * point of view. | |
| 226 | + */ | |
| 227 | +struct mtd_master { | |
| 228 | + struct mutex partitions_lock; | |
| 229 | + unsigned int suspended : 1; | |
| 230 | +}; | |
| 231 | + | |
| 197 | 232 | struct mtd_info { |
| 198 | 233 | u_char type; |
| 199 | 234 | uint32_t flags; |
| 200 | − uint32_t orig_flags; /* Flags as before running mtd checks */ | |
| 201 | 235 | uint64_t size; // Total size of the MTD |
| 202 | 236 | |
| 203 | 237 | /* "Major" erase size for the device. Naïve users may take this |
| @@ -339,8 +373,52 @@ struct mtd_info { · 135 unmodified lines | ||
| 339 | 373 | int usecount; |
| 340 | 374 | struct mtd_debug_info dbg; |
| 341 | 375 | struct nvmem_device *nvmem; |
| 376 | + | |
| 377 | + /* | |
| 378 | + * Parent device from the MTD partition point of view. | |
| 379 | + * | |
| 380 | + * MTD masters do not have any parent, MTD partitions do. The parent | |
| 381 | + * MTD device can itself be a partition. | |
| 382 | + */ | |
| 383 | + struct mtd_info *parent; | |
| 384 | + | |
| 385 | + /* List of partitions attached to this MTD device */ | |
| 386 | + struct list_head partitions; | |
| 387 | + | |
| 388 | + union { | |
| 389 | + struct mtd_part part; | |
| 390 | + struct mtd_master master; | |
| 391 | + }; | |
| 342 | 392 | }; |
| 343 | 393 | |
| 394 | +static inline struct mtd_info *mtd_get_master(struct mtd_info *mtd) | |
| 395 | +{ | |
| 396 | + while (mtd->parent) | |
| 397 | + mtd = mtd->parent; | |
| 398 | + | |
| 399 | + return mtd; | |
| 400 | +} | |
| 401 | + | |
| 402 | +static inline u64 mtd_get_master_ofs(struct mtd_info *mtd, u64 ofs) | |
| 403 | +{ | |
| 404 | + while (mtd->parent) { | |
| 405 | + ofs += mtd->part.offset; | |
| 406 | + mtd = mtd->parent; | |
| 407 | + } | |
| 408 | + | |
| 409 | + return ofs; | |
| 410 | +} | |
| 411 | + | |
| 412 | +static inline bool mtd_is_partition(const struct mtd_info *mtd) | |
| 413 | +{ | |
| 414 | + return mtd->parent; | |
| 415 | +} | |
| 416 | + | |
| 417 | +static inline bool mtd_has_partitions(const struct mtd_info *mtd) | |
| 418 | +{ | |
| 419 | + return !list_empty(&mtd->partitions); | |
| 420 | +} | |
| 421 | + | |
| 344 | 422 | int mtd_ooblayout_ecc(struct mtd_info *mtd, int section, |
| 345 | 423 | struct mtd_oob_region *oobecc); |
| 346 | 424 | int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte, |
| @@ -392,13 +470,16 @@ static inline u32 mtd_oobavail(struct mtd_info *mtd, struct mtd_oob_ops *ops) · 45 unmodified lines | ||
| 392 | 470 | static inline int mtd_max_bad_blocks(struct mtd_info *mtd, |
| 393 | 471 | loff_t ofs, size_t len) |
| 394 | 472 | { |
| 395 | − if (!mtd->_max_bad_blocks) | |
| 473 | + struct mtd_info *master = mtd_get_master(mtd); | |
| 474 | + | |
| 475 | + if (!master->_max_bad_blocks) | |
| 396 | 476 | return -ENOTSUPP; |
| 397 | 477 | |
| 398 | 478 | if (mtd->size < (len + ofs) || ofs < 0) |
| 399 | 479 | return -EINVAL; |
| 400 | 480 | |
| 401 | − return mtd->_max_bad_blocks(mtd, ofs, len); | |
| 481 | + return master->_max_bad_blocks(master, mtd_get_master_ofs(mtd, ofs), | |
| 482 | + len); | |
| 402 | 483 | } |
| 403 | 484 | |
| 404 | 485 | int mtd_wunit_to_pairing_info(struct mtd_info *mtd, int wunit, |
| @@ -439,8 +520,10 @@ int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, · 34 unmodified lines | ||
| 439 | 520 | |
| 440 | 521 | static inline void mtd_sync(struct mtd_info *mtd) |
| 441 | 522 | { |
| 442 | − if (mtd->_sync) | |
| 443 | − mtd->_sync(mtd); | |
| 523 | + struct mtd_info *master = mtd_get_master(mtd); | |
| 524 | + | |
| 525 | + if (master->_sync) | |
| 526 | + master->_sync(master); | |
| 444 | 527 | } |
| 445 | 528 | |
| 446 | 529 | int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
| @@ -452,13 +535,31 @@ int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs); · 5 unmodified lines | ||
| 452 | 535 | |
| 453 | 536 | static inline int mtd_suspend(struct mtd_info *mtd) |
| 454 | 537 | { |
| 455 | − return mtd->_suspend ? mtd->_suspend(mtd) : 0; | |
| 538 | + struct mtd_info *master = mtd_get_master(mtd); | |
| 539 | + int ret; | |
| 540 | + | |
| 541 | + if (master->master.suspended) | |
| 542 | + return 0; | |
| 543 | + | |
| 544 | + ret = master->_suspend ? master->_suspend(master) : 0; | |
| 545 | + if (ret) | |
| 546 | + return ret; | |
| 547 | + | |
| 548 | + master->master.suspended = 1; | |
| 549 | + return 0; | |
| 456 | 550 | } |
| 457 | 551 | |
| 458 | 552 | static inline void mtd_resume(struct mtd_info *mtd) |
| 459 | 553 | { |
| 460 | − if (mtd->_resume) | |
| 461 | − mtd->_resume(mtd); | |
| 554 | + struct mtd_info *master = mtd_get_master(mtd); | |
| 555 | + | |
| 556 | + if (!master->master.suspended) | |
| 557 | + return; | |
| 558 | + | |
| 559 | + if (master->_resume) | |
| 560 | + master->_resume(master); | |
| 561 | + | |
| 562 | + master->master.suspended = 0; | |
| 462 | 563 | } |
| 463 | 564 | |
| 464 | 565 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) |
| @@ -538,7 +639,9 @@ static inline loff_t mtd_wunit_to_offset(struct mtd_info *mtd, loff_t base, · 73 unmodified lines | ||
| 538 | 639 | |
| 539 | 640 | static inline int mtd_has_oob(const struct mtd_info *mtd) |
| 540 | 641 | { |
| 541 | − return mtd->_read_oob && mtd->_write_oob; | |
| 642 | + struct mtd_info *master = mtd_get_master((struct mtd_info *)mtd); | |
| 643 | + | |
| 644 | + return master->_read_oob && master->_write_oob; | |
| 542 | 645 | } |
| 543 | 646 | |
| 544 | 647 | static inline int mtd_type_is_nand(const struct mtd_info *mtd) |
| @@ -548,7 +651,9 @@ static inline int mtd_type_is_nand(const struct mtd_info *mtd) · 3 unmodified lines | ||
| 548 | 651 | |
| 549 | 652 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) |
| 550 | 653 | { |
| 551 | − return !!mtd->_block_isbad; | |
| 654 | + struct mtd_info *master = mtd_get_master((struct mtd_info *)mtd); | |
| 655 | + | |
| 656 | + return !!master->_block_isbad; | |
| 552 | 657 | } |
| 553 | 658 | |
| 554 | 659 | /* Kernel-side ioctl definitions */ |
| @@ -105,7 +105,6 @@ extern void deregister_mtd_parser(struct mtd_part_parser *parser); · 104 unmodified lines | ||
| 105 | 105 | module_driver(__mtd_part_parser, register_mtd_parser, \ |
| 106 | 106 | deregister_mtd_parser) |
| 107 | 107 | |
| 108 | −int mtd_is_partition(const struct mtd_info *mtd); | |
| 109 | 108 | int mtd_add_partition(struct mtd_info *master, const char *name, |
| 110 | 109 | long long offset, long long length); |
| 111 | 110 | int mtd_del_partition(struct mtd_info *master, int partno); |
| @@ -1064,6 +1064,8 @@ struct nand_legacy { · 1063 unmodified lines | ||
| 1064 | 1064 | * @lock: lock protecting the suspended field. Also used to |
| 1065 | 1065 | * serialize accesses to the NAND device. |
| 1066 | 1066 | * @suspended: set to 1 when the device is suspended, 0 when it's not. |
| 1067 | + * @suspend: [REPLACEABLE] specific NAND device suspend operation | |
| 1068 | + * @resume: [REPLACEABLE] specific NAND device resume operation | |
| 1067 | 1069 | * @bbt: [INTERN] bad block table pointer |
| 1068 | 1070 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash |
| 1069 | 1071 | * lookup. |
| @@ -1077,6 +1079,8 @@ struct nand_legacy { · 7 unmodified lines | ||
| 1077 | 1079 | * @manufacturer: [INTERN] Contains manufacturer information |
| 1078 | 1080 | * @manufacturer.desc: [INTERN] Contains manufacturer's description |
| 1079 | 1081 | * @manufacturer.priv: [INTERN] Contains manufacturer private information |
| 1082 | + * @lock_area: [REPLACEABLE] specific NAND chip lock operation | |
| 1083 | + * @unlock_area: [REPLACEABLE] specific NAND chip unlock operation | |
| 1080 | 1084 | */ |
| 1081 | 1085 | |
| 1082 | 1086 | struct nand_chip { |
| @@ -1117,6 +1121,8 @@ struct nand_chip { · 34 unmodified lines | ||
| 1117 | 1121 | |
| 1118 | 1122 | struct mutex lock; |
| 1119 | 1123 | unsigned int suspended : 1; |
| 1124 | + int (*suspend)(struct nand_chip *chip); | |
| 1125 | + void (*resume)(struct nand_chip *chip); | |
| 1120 | 1126 | |
| 1121 | 1127 | uint8_t *oob_poi; |
| 1122 | 1128 | struct nand_controller *controller; |
| @@ -1136,6 +1142,9 @@ struct nand_chip { · 13 unmodified lines | ||
| 1136 | 1142 | const struct nand_manufacturer *desc; |
| 1137 | 1143 | void *priv; |
| 1138 | 1144 | } manufacturer; |
| 1145 | + | |
| 1146 | + int (*lock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len); | |
| 1147 | + int (*unlock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len); | |
| 1139 | 1148 | }; |
| 1140 | 1149 | |
| 1141 | 1150 | extern const struct mtd_ooblayout_ops nand_ooblayout_sp_ops; |
| @@ -1215,7 +1224,7 @@ static inline struct device_node *nand_get_flash_node(struct nand_chip *chip) · 73 unmodified lines | ||
| 1215 | 1224 | * struct nand_flash_dev - NAND Flash Device ID Structure |
| 1216 | 1225 | * @name: a human-readable name of the NAND chip |
| 1217 | 1226 | * @dev_id: the device ID (the second byte of the full chip ID array) |
| 1218 | − * @mfr_id: manufecturer ID part of the full chip ID array (refers the same | |
| 1227 | + * @mfr_id: manufacturer ID part of the full chip ID array (refers the same | |
| 1219 | 1228 | * memory address as ``id[0]``) |
| 1220 | 1229 | * @dev_id: device ID part of the full chip ID array (refers the same memory |
| 1221 | 1230 | * address as ``id[1]``) |
| @@ -11,23 +11,6 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/mtd/mtd.h> |
| 12 | 12 | #include <linux/spi/spi-mem.h> |
| 13 | 13 | |
| 14 | −/* | |
| 15 | − * Manufacturer IDs | |
| 16 | − * | |
| 17 | − * The first byte returned from the flash after sending opcode SPINOR_OP_RDID. | |
| 18 | − * Sometimes these are the same as CFI IDs, but sometimes they aren't. | |
| 19 | − */ | |
| 20 | −#define SNOR_MFR_ATMEL CFI_MFR_ATMEL | |
| 21 | −#define SNOR_MFR_GIGADEVICE 0xc8 | |
| 22 | −#define SNOR_MFR_INTEL CFI_MFR_INTEL | |
| 23 | −#define SNOR_MFR_ST CFI_MFR_ST /* ST Micro */ | |
| 24 | −#define SNOR_MFR_MICRON CFI_MFR_MICRON /* Micron */ | |
| 25 | −#define SNOR_MFR_ISSI CFI_MFR_PMC | |
| 26 | −#define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX | |
| 27 | −#define SNOR_MFR_SPANSION CFI_MFR_AMD | |
| 28 | −#define SNOR_MFR_SST CFI_MFR_SST | |
| 29 | −#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */ | |
| 30 | − | |
| 31 | 14 | /* |
| 32 | 15 | * Note on opcode nomenclature: some opcodes have a format like |
| 33 | 16 | * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number |
| @@ -128,7 +111,9 @@ · 94 unmodified lines | ||
| 128 | 111 | #define SR_BP0 BIT(2) /* Block protect 0 */ |
| 129 | 112 | #define SR_BP1 BIT(3) /* Block protect 1 */ |
| 130 | 113 | #define SR_BP2 BIT(4) /* Block protect 2 */ |
| 114 | +#define SR_BP3 BIT(5) /* Block protect 3 */ | |
| 131 | 115 | #define SR_TB_BIT5 BIT(5) /* Top/Bottom protect */ |
| 116 | +#define SR_BP3_BIT6 BIT(6) /* Block protect 3 */ | |
| 132 | 117 | #define SR_TB_BIT6 BIT(6) /* Top/Bottom protect */ |
| 133 | 118 | #define SR_SRWD BIT(7) /* SR write protect */ |
| 134 | 119 | /* Spansion/Cypress specific status bits */ |
| @@ -137,6 +122,8 @@ · 2 unmodified lines | ||
| 137 | 122 | |
| 138 | 123 | #define SR1_QUAD_EN_BIT6 BIT(6) |
| 139 | 124 | |
| 125 | +#define SR_BP_SHIFT 2 | |
| 126 | + | |
| 140 | 127 | /* Enhanced Volatile Configuration Register bits */ |
| 141 | 128 | #define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */ |
| 142 | 129 | |
| @@ -225,110 +212,6 @@ static inline u8 spi_nor_get_protocol_width(enum spi_nor_protocol proto) · 82 unmodified lines | ||
| 225 | 212 | return spi_nor_get_protocol_data_nbits(proto); |
| 226 | 213 | } |
| 227 | 214 | |
| 228 | −enum spi_nor_option_flags { | |
| 229 | − SNOR_F_USE_FSR = BIT(0), | |
| 230 | − SNOR_F_HAS_SR_TB = BIT(1), | |
| 231 | − SNOR_F_NO_OP_CHIP_ERASE = BIT(2), | |
| 232 | − SNOR_F_READY_XSR_RDY = BIT(3), | |
| 233 | − SNOR_F_USE_CLSR = BIT(4), | |
| 234 | − SNOR_F_BROKEN_RESET = BIT(5), | |
| 235 | − SNOR_F_4B_OPCODES = BIT(6), | |
| 236 | − SNOR_F_HAS_4BAIT = BIT(7), | |
| 237 | − SNOR_F_HAS_LOCK = BIT(8), | |
| 238 | − SNOR_F_HAS_16BIT_SR = BIT(9), | |
| 239 | − SNOR_F_NO_READ_CR = BIT(10), | |
| 240 | − SNOR_F_HAS_SR_TB_BIT6 = BIT(11), | |
| 241 | − | |
| 242 | −}; | |
| 243 | − | |
| 244 | −/** | |
| 245 | − * struct spi_nor_erase_type - Structure to describe a SPI NOR erase type | |
| 246 | − * @size: the size of the sector/block erased by the erase type. | |
| 247 | − * JEDEC JESD216B imposes erase sizes to be a power of 2. | |
| 248 | − * @size_shift: @size is a power of 2, the shift is stored in | |
| 249 | − * @size_shift. | |
| 250 | − * @size_mask: the size mask based on @size_shift. | |
| 251 | − * @opcode: the SPI command op code to erase the sector/block. | |
| 252 | − * @idx: Erase Type index as sorted in the Basic Flash Parameter | |
| 253 | − * Table. It will be used to synchronize the supported | |
| 254 | − * Erase Types with the ones identified in the SFDP | |
| 255 | − * optional tables. | |
| 256 | − */ | |
| 257 | −struct spi_nor_erase_type { | |
| 258 | − u32 size; | |
| 259 | − u32 size_shift; | |
| 260 | − u32 size_mask; | |
| 261 | − u8 opcode; | |
| 262 | − u8 idx; | |
| 263 | −}; | |
| 264 | − | |
| 265 | −/** | |
| 266 | − * struct spi_nor_erase_command - Used for non-uniform erases | |
| 267 | − * The structure is used to describe a list of erase commands to be executed | |
| 268 | − * once we validate that the erase can be performed. The elements in the list | |
| 269 | − * are run-length encoded. | |
| 270 | − * @list: for inclusion into the list of erase commands. | |
| 271 | − * @count: how many times the same erase command should be | |
| 272 | − * consecutively used. | |
| 273 | − * @size: the size of the sector/block erased by the command. | |
| 274 | − * @opcode: the SPI command op code to erase the sector/block. | |
| 275 | − */ | |
| 276 | −struct spi_nor_erase_command { | |
| 277 | − struct list_head list; | |
| 278 | − u32 count; | |
| 279 | − u32 size; | |
| 280 | − u8 opcode; | |
| 281 | −}; | |
| 282 | − | |
| 283 | −/** | |
| 284 | − * struct spi_nor_erase_region - Structure to describe a SPI NOR erase region | |
| 285 | − * @offset: the offset in the data array of erase region start. | |
| 286 | − * LSB bits are used as a bitmask encoding flags to | |
| 287 | − * determine if this region is overlaid, if this region is | |
| 288 | − * the last in the SPI NOR flash memory and to indicate | |
| 289 | − * all the supported erase commands inside this region. | |
| 290 | − * The erase types are sorted in ascending order with the | |
| 291 | − * smallest Erase Type size being at BIT(0). | |
| 292 | − * @size: the size of the region in bytes. | |
| 293 | − */ | |
| 294 | −struct spi_nor_erase_region { | |
| 295 | − u64 offset; | |
| 296 | − u64 size; | |
| 297 | −}; | |
| 298 | − | |
| 299 | −#define SNOR_ERASE_TYPE_MAX 4 | |
| 300 | −#define SNOR_ERASE_TYPE_MASK GENMASK_ULL(SNOR_ERASE_TYPE_MAX - 1, 0) | |
| 301 | − | |
| 302 | −#define SNOR_LAST_REGION BIT(4) | |
| 303 | −#define SNOR_OVERLAID_REGION BIT(5) | |
| 304 | − | |
| 305 | −#define SNOR_ERASE_FLAGS_MAX 6 | |
| 306 | −#define SNOR_ERASE_FLAGS_MASK GENMASK_ULL(SNOR_ERASE_FLAGS_MAX - 1, 0) | |
| 307 | − | |
| 308 | −/** | |
| 309 | − * struct spi_nor_erase_map - Structure to describe the SPI NOR erase map | |
| 310 | − * @regions: array of erase regions. The regions are consecutive in | |
| 311 | − * address space. Walking through the regions is done | |
| 312 | − * incrementally. | |
| 313 | − * @uniform_region: a pre-allocated erase region for SPI NOR with a uniform | |
| 314 | − * sector size (legacy implementation). | |
| 315 | − * @erase_type: an array of erase types shared by all the regions. | |
| 316 | − * The erase types are sorted in ascending order, with the | |
| 317 | − * smallest Erase Type size being the first member in the | |
| 318 | − * erase_type array. | |
| 319 | − * @uniform_erase_type: bitmask encoding erase types that can erase the | |
| 320 | − * entire memory. This member is completed at init by | |
| 321 | − * uniform and non-uniform SPI NOR flash memories if they | |
| 322 | − * support at least one erase type that can erase the | |
| 323 | − * entire memory. | |
| 324 | − */ | |
| 325 | −struct spi_nor_erase_map { | |
| 326 | − struct spi_nor_erase_region *regions; | |
| 327 | − struct spi_nor_erase_region uniform_region; | |
| 328 | − struct spi_nor_erase_type erase_type[SNOR_ERASE_TYPE_MAX]; | |
| 329 | − u8 uniform_erase_type; | |
| 330 | −}; | |
| 331 | − | |
| 332 | 215 | /** |
| 333 | 216 | * struct spi_nor_hwcaps - Structure for describing the hardware capabilies |
| 334 | 217 | * supported by the SPI controller (bus master). |
| @@ -404,61 +287,7 @@ struct spi_nor_hwcaps { · 69 unmodified lines | ||
| 404 | 287 | #define SNOR_HWCAPS_ALL (SNOR_HWCAPS_READ_MASK | \ |
| 405 | 288 | SNOR_HWCAPS_PP_MASK) |
| 406 | 289 | |
| 407 | −struct spi_nor_read_command { | |
| 408 | − u8 num_mode_clocks; | |
| 409 | − u8 num_wait_states; | |
| 410 | − u8 opcode; | |
| 411 | − enum spi_nor_protocol proto; | |
| 412 | −}; | |
| 413 | − | |
| 414 | −struct spi_nor_pp_command { | |
| 415 | − u8 opcode; | |
| 416 | − enum spi_nor_protocol proto; | |
| 417 | −}; | |
| 418 | − | |
| 419 | −enum spi_nor_read_command_index { | |
| 420 | − SNOR_CMD_READ, | |
| 421 | − SNOR_CMD_READ_FAST, | |
| 422 | − SNOR_CMD_READ_1_1_1_DTR, | |
| 423 | − | |
| 424 | − /* Dual SPI */ | |
| 425 | − SNOR_CMD_READ_1_1_2, | |
| 426 | − SNOR_CMD_READ_1_2_2, | |
| 427 | − SNOR_CMD_READ_2_2_2, | |
| 428 | − SNOR_CMD_READ_1_2_2_DTR, | |
| 429 | − | |
| 430 | − /* Quad SPI */ | |
| 431 | − SNOR_CMD_READ_1_1_4, | |
| 432 | − SNOR_CMD_READ_1_4_4, | |
| 433 | − SNOR_CMD_READ_4_4_4, | |
| 434 | − SNOR_CMD_READ_1_4_4_DTR, | |
| 435 | − | |
| 436 | − /* Octal SPI */ | |
| 437 | − SNOR_CMD_READ_1_1_8, | |
| 438 | − SNOR_CMD_READ_1_8_8, | |
| 439 | − SNOR_CMD_READ_8_8_8, | |
| 440 | − SNOR_CMD_READ_1_8_8_DTR, | |
| 441 | − | |
| 442 | − SNOR_CMD_READ_MAX | |
| 443 | −}; | |
| 444 | − | |
| 445 | −enum spi_nor_pp_command_index { | |
| 446 | − SNOR_CMD_PP, | |
| 447 | − | |
| 448 | − /* Quad SPI */ | |
| 449 | − SNOR_CMD_PP_1_1_4, | |
| 450 | − SNOR_CMD_PP_1_4_4, | |
| 451 | − SNOR_CMD_PP_4_4_4, | |
| 452 | − | |
| 453 | − /* Octal SPI */ | |
| 454 | − SNOR_CMD_PP_1_1_8, | |
| 455 | − SNOR_CMD_PP_1_8_8, | |
| 456 | − SNOR_CMD_PP_8_8_8, | |
| 457 | − | |
| 458 | − SNOR_CMD_PP_MAX | |
| 459 | −}; | |
| 460 | − | |
| 461 | −/* Forward declaration that will be used in 'struct spi_nor_flash_parameter' */ | |
| 290 | +/* Forward declaration that is used in 'struct spi_nor_controller_ops' */ | |
| 462 | 291 | struct spi_nor; |
| 463 | 292 | |
| 464 | 293 | /** |
| @@ -489,68 +318,13 @@ struct spi_nor_controller_ops { · 24 unmodified lines | ||
| 489 | 318 | int (*erase)(struct spi_nor *nor, loff_t offs); |
| 490 | 319 | }; |
| 491 | 320 | |
| 492 | −/** | |
| 493 | − * struct spi_nor_locking_ops - SPI NOR locking methods | |
| 494 | − * @lock: lock a region of the SPI NOR. | |
| 495 | − * @unlock: unlock a region of the SPI NOR. | |
| 496 | − * @is_locked: check if a region of the SPI NOR is completely locked | |
| 497 | − */ | |
| 498 | −struct spi_nor_locking_ops { | |
| 499 | − int (*lock)(struct spi_nor *nor, loff_t ofs, uint64_t len); | |
| 500 | − int (*unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len); | |
| 501 | − int (*is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); | |
| 502 | −}; | |
| 503 | − | |
| 504 | −/** | |
| 505 | − * struct spi_nor_flash_parameter - SPI NOR flash parameters and settings. | |
| 506 | − * Includes legacy flash parameters and settings that can be overwritten | |
| 507 | − * by the spi_nor_fixups hooks, or dynamically when parsing the JESD216 | |
| 508 | − * Serial Flash Discoverable Parameters (SFDP) tables. | |
| 509 | − * | |
| 510 | − * @size: the flash memory density in bytes. | |
| 511 | − * @page_size: the page size of the SPI NOR flash memory. | |
| 512 | − * @hwcaps: describes the read and page program hardware | |
| 513 | − * capabilities. | |
| 514 | − * @reads: read capabilities ordered by priority: the higher index | |
| 515 | − * in the array, the higher priority. | |
| 516 | − * @page_programs: page program capabilities ordered by priority: the | |
| 517 | − * higher index in the array, the higher priority. | |
| 518 | − * @erase_map: the erase map parsed from the SFDP Sector Map Parameter | |
| 519 | − * Table. | |
| 520 | − * @quad_enable: enables SPI NOR quad mode. | |
| 521 | − * @set_4byte: puts the SPI NOR in 4 byte addressing mode. | |
| 522 | − * @convert_addr: converts an absolute address into something the flash | |
| 523 | − * will understand. Particularly useful when pagesize is | |
| 524 | − * not a power-of-2. | |
| 525 | − * @setup: configures the SPI NOR memory. Useful for SPI NOR | |
| 526 | − * flashes that have peculiarities to the SPI NOR standard | |
| 527 | − * e.g. different opcodes, specific address calculation, | |
| 528 | − * page size, etc. | |
| 529 | − * @locking_ops: SPI NOR locking methods. | |
| 530 | − */ | |
| 531 | −struct spi_nor_flash_parameter { | |
| 532 | − u64 size; | |
| 533 | − u32 page_size; | |
| 534 | − | |
| 535 | − struct spi_nor_hwcaps hwcaps; | |
| 536 | − struct spi_nor_read_command reads[SNOR_CMD_READ_MAX]; | |
| 537 | − struct spi_nor_pp_command page_programs[SNOR_CMD_PP_MAX]; | |
| 538 | − | |
| 539 | − struct spi_nor_erase_map erase_map; | |
| 540 | − | |
| 541 | − int (*quad_enable)(struct spi_nor *nor); | |
| 542 | − int (*set_4byte)(struct spi_nor *nor, bool enable); | |
| 543 | − u32 (*convert_addr)(struct spi_nor *nor, u32 addr); | |
| 544 | − int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps); | |
| 545 | − | |
| 546 | − const struct spi_nor_locking_ops *locking_ops; | |
| 547 | −}; | |
| 548 | − | |
| 549 | −/** | |
| 550 | − * struct flash_info - Forward declaration of a structure used internally by | |
| 551 | − * spi_nor_scan() | |
| 321 | +/* | |
| 322 | + * Forward declarations that are used internally by the core and manufacturer | |
| 323 | + * drivers. | |
| 552 | 324 | */ |
| 553 | 325 | struct flash_info; |
| 326 | +struct spi_nor_manufacturer; | |
| 327 | +struct spi_nor_flash_parameter; | |
| 554 | 328 | |
| 555 | 329 | /** |
| 556 | 330 | * struct spi_nor - Structure for defining a the SPI NOR layer |
| @@ -562,6 +336,7 @@ struct flash_info; · 5 unmodified lines | ||
| 562 | 336 | * layer is not DMA-able |
| 563 | 337 | * @bouncebuf_size: size of the bounce buffer |
| 564 | 338 | * @info: spi-nor part JDEC MFR id and other info |
| 339 | + * @manufacturer: spi-nor manufacturer | |
| 565 | 340 | * @page_size: the page size of the SPI NOR |
| 566 | 341 | * @addr_width: number of address bytes |
| 567 | 342 | * @erase_opcode: the opcode for erasing a sector |
| @@ -578,6 +353,7 @@ struct flash_info; · 10 unmodified lines | ||
| 578 | 353 | * The structure includes legacy flash parameters and |
| 579 | 354 | * settings that can be overwritten by the spi_nor_fixups |
| 580 | 355 | * hooks, or dynamically when parsing the SFDP tables. |
| 356 | + * @dirmap: pointers to struct spi_mem_dirmap_desc for reads/writes. | |
| 581 | 357 | * @priv: the private data |
| 582 | 358 | */ |
| 583 | 359 | struct spi_nor { |
| @@ -588,6 +364,7 @@ struct spi_nor { · 4 unmodified lines | ||
| 588 | 364 | u8 *bouncebuf; |
| 589 | 365 | size_t bouncebuf_size; |
| 590 | 366 | const struct flash_info *info; |
| 367 | + const struct spi_nor_manufacturer *manufacturer; | |
| 591 | 368 | u32 page_size; |
| 592 | 369 | u8 addr_width; |
| 593 | 370 | u8 erase_opcode; |
| @@ -602,40 +379,16 @@ struct spi_nor { · 8 unmodified lines | ||
| 602 | 379 | |
| 603 | 380 | const struct spi_nor_controller_ops *controller_ops; |
| 604 | 381 | |
| 605 | − struct spi_nor_flash_parameter params; | |
| 382 | + struct spi_nor_flash_parameter *params; | |
| 383 | + | |
| 384 | + struct { | |
| 385 | + struct spi_mem_dirmap_desc *rdesc; | |
| 386 | + struct spi_mem_dirmap_desc *wdesc; | |
| 387 | + } dirmap; | |
| 606 | 388 | |
| 607 | 389 | void *priv; |
| 608 | 390 | }; |
| 609 | 391 | |
| 610 | −static u64 __maybe_unused | |
| 611 | −spi_nor_region_is_last(const struct spi_nor_erase_region *region) | |
| 612 | −{ | |
| 613 | − return region->offset & SNOR_LAST_REGION; | |
| 614 | −} | |
| 615 | − | |
| 616 | −static u64 __maybe_unused | |
| 617 | −spi_nor_region_end(const struct spi_nor_erase_region *region) | |
| 618 | −{ | |
| 619 | − return (region->offset & ~SNOR_ERASE_FLAGS_MASK) + region->size; | |
| 620 | −} | |
| 621 | − | |
| 622 | −static void __maybe_unused | |
| 623 | −spi_nor_region_mark_end(struct spi_nor_erase_region *region) | |
| 624 | −{ | |
| 625 | − region->offset |= SNOR_LAST_REGION; | |
| 626 | −} | |
| 627 | − | |
| 628 | −static void __maybe_unused | |
| 629 | −spi_nor_region_mark_overlay(struct spi_nor_erase_region *region) | |
| 630 | −{ | |
| 631 | − region->offset |= SNOR_OVERLAID_REGION; | |
| 632 | −} | |
| 633 | − | |
| 634 | −static bool __maybe_unused spi_nor_has_uniform_erase(const struct spi_nor *nor) | |
| 635 | −{ | |
| 636 | − return !!nor->params.erase_map.uniform_erase_type; | |
| 637 | −} | |
| 638 | − | |
| 639 | 392 | static inline void spi_nor_set_flash_node(struct spi_nor *nor, |
| 640 | 393 | struct device_node *np) |
| 641 | 394 | { |
| @@ -32,9 +32,9 @@ · 31 unmodified lines | ||
| 32 | 32 | SPI_MEM_OP_NO_DUMMY, \ |
| 33 | 33 | SPI_MEM_OP_NO_DATA) |
| 34 | 34 | |
| 35 | −#define SPINAND_READID_OP(ndummy, buf, len) \ | |
| 35 | +#define SPINAND_READID_OP(naddr, ndummy, buf, len) \ | |
| 36 | 36 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x9f, 1), \ |
| 37 | − SPI_MEM_OP_NO_ADDR, \ | |
| 37 | + SPI_MEM_OP_ADDR(naddr, 0, 1), \ | |
| 38 | 38 | SPI_MEM_OP_DUMMY(ndummy, 1), \ |
| 39 | 39 | SPI_MEM_OP_DATA_IN(len, buf, 1)) |
| 40 | 40 | |
| @@ -176,37 +176,46 @@ struct spinand_device; · 135 unmodified lines | ||
| 176 | 176 | * @data: buffer containing the id bytes. Currently 4 bytes large, but can |
| 177 | 177 | * be extended if required |
| 178 | 178 | * @len: ID length |
| 179 | − * | |
| 180 | − * struct_spinand_id->data contains all bytes returned after a READ_ID command, | |
| 181 | − * including dummy bytes if the chip does not emit ID bytes right after the | |
| 182 | − * READ_ID command. The responsibility to extract real ID bytes is left to | |
| 183 | − * struct_manufacurer_ops->detect(). | |
| 184 | 179 | */ |
| 185 | 180 | struct spinand_id { |
| 186 | 181 | u8 data[SPINAND_MAX_ID_LEN]; |
| 187 | 182 | int len; |
| 188 | 183 | }; |
| 189 | 184 | |
| 185 | +enum spinand_readid_method { | |
| 186 | + SPINAND_READID_METHOD_OPCODE, | |
| 187 | + SPINAND_READID_METHOD_OPCODE_ADDR, | |
| 188 | + SPINAND_READID_METHOD_OPCODE_DUMMY, | |
| 189 | +}; | |
| 190 | + | |
| 191 | +/** | |
| 192 | + * struct spinand_devid - SPI NAND device id structure | |
| 193 | + * @id: device id of current chip | |
| 194 | + * @len: number of bytes in device id | |
| 195 | + * @method: method to read chip id | |
| 196 | + * There are 3 possible variants: | |
| 197 | + * SPINAND_READID_METHOD_OPCODE: chip id is returned immediately | |
| 198 | + * after read_id opcode. | |
| 199 | + * SPINAND_READID_METHOD_OPCODE_ADDR: chip id is returned after | |
| 200 | + * read_id opcode + 1-byte address. | |
| 201 | + * SPINAND_READID_METHOD_OPCODE_DUMMY: chip id is returned after | |
| 202 | + * read_id opcode + 1 dummy byte. | |
| 203 | + */ | |
| 204 | +struct spinand_devid { | |
| 205 | + const u8 *id; | |
| 206 | + const u8 len; | |
| 207 | + const enum spinand_readid_method method; | |
| 208 | +}; | |
| 209 | + | |
| 190 | 210 | /** |
| 191 | 211 | * struct manufacurer_ops - SPI NAND manufacturer specific operations |
| 192 | − * @detect: detect a SPI NAND device. Every time a SPI NAND device is probed | |
| 193 | − * the core calls the struct_manufacurer_ops->detect() hook of each | |
| 194 | − * registered manufacturer until one of them return 1. Note that | |
| 195 | − * the first thing to check in this hook is that the manufacturer ID | |
| 196 | − * in struct_spinand_device->id matches the manufacturer whose | |
| 197 | − * ->detect() hook has been called. Should return 1 if there's a | |
| 198 | − * match, 0 if the manufacturer ID does not match and a negative | |
| 199 | − * error code otherwise. When true is returned, the core assumes | |
| 200 | − * that properties of the NAND chip (spinand->base.memorg and | |
| 201 | − * spinand->base.eccreq) have been filled | |
| 202 | 212 | * @init: initialize a SPI NAND device |
| 203 | 213 | * @cleanup: cleanup a SPI NAND device |
| 204 | 214 | * |
| 205 | 215 | * Each SPI NAND manufacturer driver should implement this interface so that |
| 206 | − * NAND chips coming from this vendor can be detected and initialized properly. | |
| 216 | + * NAND chips coming from this vendor can be initialized properly. | |
| 207 | 217 | */ |
| 208 | 218 | struct spinand_manufacturer_ops { |
| 209 | − int (*detect)(struct spinand_device *spinand); | |
| 210 | 219 | int (*init)(struct spinand_device *spinand); |
| 211 | 220 | void (*cleanup)(struct spinand_device *spinand); |
| 212 | 221 | }; |
| @@ -215,11 +224,16 @@ struct spinand_manufacturer_ops { · 2 unmodified lines | ||
| 215 | 224 | * struct spinand_manufacturer - SPI NAND manufacturer instance |
| 216 | 225 | * @id: manufacturer ID |
| 217 | 226 | * @name: manufacturer name |
| 227 | + * @devid_len: number of bytes in device ID | |
| 228 | + * @chips: supported SPI NANDs under current manufacturer | |
| 229 | + * @nchips: number of SPI NANDs available in chips array | |
| 218 | 230 | * @ops: manufacturer operations |
| 219 | 231 | */ |
| 220 | 232 | struct spinand_manufacturer { |
| 221 | 233 | u8 id; |
| 222 | 234 | char *name; |
| 235 | + const struct spinand_info *chips; | |
| 236 | + const size_t nchips; | |
| 223 | 237 | const struct spinand_manufacturer_ops *ops; |
| 224 | 238 | }; |
| 225 | 239 | |
| @@ -270,6 +284,7 @@ struct spinand_ecc_info { · 44 unmodified lines | ||
| 270 | 284 | }; |
| 271 | 285 | |
| 272 | 286 | #define SPINAND_HAS_QE_BIT BIT(0) |
| 287 | +#define SPINAND_HAS_CR_FEAT_BIT BIT(1) | |
| 273 | 288 | |
| 274 | 289 | /** |
| 275 | 290 | * struct spinand_info - Structure used to describe SPI NAND chips |
| @@ -291,7 +306,7 @@ struct spinand_ecc_info { · 15 unmodified lines | ||
| 291 | 306 | */ |
| 292 | 307 | struct spinand_info { |
| 293 | 308 | const char *model; |
| 294 | − u16 devid; | |
| 309 | + struct spinand_devid devid; | |
| 295 | 310 | u32 flags; |
| 296 | 311 | struct nand_memory_organization memorg; |
| 297 | 312 | struct nand_ecc_req eccreq; |
| @@ -305,6 +320,13 @@ struct spinand_info { · 7 unmodified lines | ||
| 305 | 320 | unsigned int target); |
| 306 | 321 | }; |
| 307 | 322 | |
| 323 | +#define SPINAND_ID(__method, ...) \ | |
| 324 | + { \ | |
| 325 | + .id = (const u8[]){ __VA_ARGS__ }, \ | |
| 326 | + .len = sizeof((u8[]){ __VA_ARGS__ }), \ | |
| 327 | + .method = __method, \ | |
| 328 | + } | |
| 329 | + | |
| 308 | 330 | #define SPINAND_INFO_OP_VARIANTS(__read, __write, __update) \ |
| 309 | 331 | { \ |
| 310 | 332 | .read_cache = __read, \ |
| @@ -451,9 +473,10 @@ static inline void spinand_set_of_node(struct spinand_device *spinand, · 140 unmodified lines | ||
| 451 | 473 | nanddev_set_of_node(&spinand->base, np); |
| 452 | 474 | } |
| 453 | 475 | |
| 454 | −int spinand_match_and_init(struct spinand_device *dev, | |
| 476 | +int spinand_match_and_init(struct spinand_device *spinand, | |
| 455 | 477 | const struct spinand_info *table, |
| 456 | − unsigned int table_size, u16 devid); | |
| 478 | + unsigned int table_size, | |
| 479 | + enum spinand_readid_method rdid_method); | |
| 457 | 480 | |
| 458 | 481 | int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val); |
| 459 | 482 | int spinand_select_target(struct spinand_device *spinand, unsigned int target); |
| @@ -109,8 +109,11 @@ do { \ · 108 unmodified lines | ||
| 109 | 109 | } while (0) |
| 110 | 110 | |
| 111 | 111 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 112 | −# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ | |
| 113 | − , .dep_map = { .name = #lockname } | |
| 112 | +# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ | |
| 113 | + , .dep_map = { \ | |
| 114 | + .name = #lockname, \ | |
| 115 | + .wait_type_inner = LD_WAIT_SLEEP, \ | |
| 116 | + } | |
| 114 | 117 | #else |
| 115 | 118 | # define __DEP_MAP_MUTEX_INITIALIZER(lockname) |
| 116 | 119 | #endif |
| @@ -15,7 +15,7 @@ enum { MAX_NESTED_LINKS = 8 }; · 14 unmodified lines | ||
| 15 | 15 | /* |
| 16 | 16 | * Type of the last component on LOOKUP_PARENT |
| 17 | 17 | */ |
| 18 | −enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; | |
| 18 | +enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT}; | |
| 19 | 19 | |
| 20 | 20 | /* pathwalk mode */ |
| 21 | 21 | #define LOOKUP_FOLLOW 0x0001 /* follow links at the end */ |
| @@ -23,6 +23,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; · 1 unmodified line | ||
| 23 | 23 | #define LOOKUP_AUTOMOUNT 0x0004 /* force terminal automount */ |
| 24 | 24 | #define LOOKUP_EMPTY 0x4000 /* accept empty path [user_... only] */ |
| 25 | 25 | #define LOOKUP_DOWN 0x8000 /* follow mounts in the starting point */ |
| 26 | +#define LOOKUP_MOUNTPOINT 0x0080 /* follow mounts in the end */ | |
| 26 | 27 | |
| 27 | 28 | #define LOOKUP_REVAL 0x0020 /* tell ->d_revalidate() to trust no cache */ |
| 28 | 29 | #define LOOKUP_RCU 0x0040 /* RCU pathwalk mode; semi-internal */ |
| @@ -64,7 +65,6 @@ extern struct dentry *kern_path_create(int, const char *, struct path *, unsigne · 35 unmodified lines | ||
| 64 | 65 | extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); |
| 65 | 66 | extern void done_path_create(struct path *, struct dentry *); |
| 66 | 67 | extern struct dentry *kern_path_locked(const char *, struct path *); |
| 67 | −extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int); | |
| 68 | 68 | |
| 69 | 69 | extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int); |
| 70 | 70 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
| @@ -83,6 +83,8 @@ enum { · 82 unmodified lines | ||
| 83 | 83 | NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */ |
| 84 | 84 | NETIF_F_GRO_FRAGLIST_BIT, /* Fraglist GRO */ |
| 85 | 85 | |
| 86 | + NETIF_F_HW_MACSEC_BIT, /* Offload MACsec operations */ | |
| 87 | + | |
| 86 | 88 | /* |
| 87 | 89 | * Add your fresh new feature above and remember to update |
| 88 | 90 | * netdev_features_strings[] in net/core/ethtool.c and maybe |
| @@ -154,6 +156,7 @@ enum { · 65 unmodified lines | ||
| 154 | 156 | #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX) |
| 155 | 157 | #define NETIF_F_GRO_FRAGLIST __NETIF_F(GRO_FRAGLIST) |
| 156 | 158 | #define NETIF_F_GSO_FRAGLIST __NETIF_F(GSO_FRAGLIST) |
| 159 | +#define NETIF_F_HW_MACSEC __NETIF_F(HW_MACSEC) | |
| 157 | 160 | |
| 158 | 161 | /* Finds the next feature with the highest number of the range of start till 0. |
| 159 | 162 | */ |
| @@ -53,6 +53,8 @@ struct netpoll_info; · 52 unmodified lines | ||
| 53 | 53 | struct device; |
| 54 | 54 | struct phy_device; |
| 55 | 55 | struct dsa_port; |
| 56 | +struct macsec_context; | |
| 57 | +struct macsec_ops; | |
| 56 | 58 | |
| 57 | 59 | struct sfp_bus; |
| 58 | 60 | /* 802.11 specific */ |
| @@ -664,7 +666,7 @@ static inline void netdev_queue_numa_node_write(struct netdev_queue *q, int node · 605 unmodified lines | ||
| 664 | 666 | struct rps_map { |
| 665 | 667 | unsigned int len; |
| 666 | 668 | struct rcu_head rcu; |
| 667 | − u16 cpus[0]; | |
| 669 | + u16 cpus[]; | |
| 668 | 670 | }; |
| 669 | 671 | #define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16))) |
| 670 | 672 | |
| @@ -686,7 +688,7 @@ struct rps_dev_flow { · 15 unmodified lines | ||
| 686 | 688 | struct rps_dev_flow_table { |
| 687 | 689 | unsigned int mask; |
| 688 | 690 | struct rcu_head rcu; |
| 689 | − struct rps_dev_flow flows[0]; | |
| 691 | + struct rps_dev_flow flows[]; | |
| 690 | 692 | }; |
| 691 | 693 | #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ |
| 692 | 694 | ((_num) * sizeof(struct rps_dev_flow))) |
| @@ -704,7 +706,7 @@ struct rps_dev_flow_table { · 11 unmodified lines | ||
| 704 | 706 | struct rps_sock_flow_table { |
| 705 | 707 | u32 mask; |
| 706 | 708 | |
| 707 | − u32 ents[0] ____cacheline_aligned_in_smp; | |
| 709 | + u32 ents[] ____cacheline_aligned_in_smp; | |
| 708 | 710 | }; |
| 709 | 711 | #define RPS_SOCK_FLOW_TABLE_SIZE(_num) (offsetof(struct rps_sock_flow_table, ents[_num])) |
| 710 | 712 | |
| @@ -767,7 +769,7 @@ struct xps_map { · 56 unmodified lines | ||
| 767 | 769 | unsigned int len; |
| 768 | 770 | unsigned int alloc_len; |
| 769 | 771 | struct rcu_head rcu; |
| 770 | − u16 queues[0]; | |
| 772 | + u16 queues[]; | |
| 771 | 773 | }; |
| 772 | 774 | #define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16))) |
| 773 | 775 | #define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \ |
| @@ -778,7 +780,7 @@ struct xps_map { · 4 unmodified lines | ||
| 778 | 780 | */ |
| 779 | 781 | struct xps_dev_maps { |
| 780 | 782 | struct rcu_head rcu; |
| 781 | − struct xps_map __rcu *attr_map[0]; /* Either CPUs map or RXQs map */ | |
| 783 | + struct xps_map __rcu *attr_map[]; /* Either CPUs map or RXQs map */ | |
| 782 | 784 | }; |
| 783 | 785 | |
| 784 | 786 | #define XPS_CPU_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \ |
| @@ -853,6 +855,7 @@ enum tc_setup_type { · 68 unmodified lines | ||
| 853 | 855 | TC_SETUP_FT, |
| 854 | 856 | TC_SETUP_QDISC_ETS, |
| 855 | 857 | TC_SETUP_QDISC_TBF, |
| 858 | + TC_SETUP_QDISC_FIFO, | |
| 856 | 859 | }; |
| 857 | 860 | |
| 858 | 861 | /* These structures hold the attributes of bpf state that are being passed |
| @@ -1818,6 +1821,8 @@ enum netdev_priv_flags { · 959 unmodified lines | ||
| 1818 | 1821 | * that follow this device when it is moved |
| 1819 | 1822 | * to another network namespace. |
| 1820 | 1823 | * |
| 1824 | + * @macsec_ops: MACsec offloading ops | |
| 1825 | + * | |
| 1821 | 1826 | * FIXME: cleanup struct net_device such that network protocol info |
| 1822 | 1827 | * moves out. |
| 1823 | 1828 | */ |
| @@ -2112,6 +2117,11 @@ struct net_device { · 288 unmodified lines | ||
| 2112 | 2117 | unsigned wol_enabled:1; |
| 2113 | 2118 | |
| 2114 | 2119 | struct list_head net_notifier_list; |
| 2120 | + | |
| 2121 | +#if IS_ENABLED(CONFIG_MACSEC) | |
| 2122 | + /* MACsec management functions */ | |
| 2123 | + const struct macsec_ops *macsec_ops; | |
| 2124 | +#endif | |
| 2115 | 2125 | }; |
| 2116 | 2126 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
| 2117 | 2127 | |
| @@ -3767,7 +3777,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, · 1649 unmodified lines | ||
| 3767 | 3777 | |
| 3768 | 3778 | typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf); |
| 3769 | 3779 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, |
| 3770 | − int fd, u32 flags); | |
| 3780 | + int fd, int expected_fd, u32 flags); | |
| 3771 | 3781 | u32 __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op, |
| 3772 | 3782 | enum bpf_netdev_command cmd); |
| 3773 | 3783 | int xdp_umem_query(struct net_device *dev, u16 queue_id); |
| @@ -98,7 +98,7 @@ struct ip_set_counter { · 97 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | struct ip_set_comment_rcu { |
| 100 | 100 | struct rcu_head rcu; |
| 101 | − char str[0]; | |
| 101 | + char str[]; | |
| 102 | 102 | }; |
| 103 | 103 | |
| 104 | 104 | struct ip_set_comment { |
| @@ -264,7 +264,7 @@ struct xt_table_info { · 263 unmodified lines | ||
| 264 | 264 | unsigned int stacksize; |
| 265 | 265 | void ***jumpstack; |
| 266 | 266 | |
| 267 | − unsigned char entries[0] __aligned(8); | |
| 267 | + unsigned char entries[] __aligned(8); | |
| 268 | 268 | }; |
| 269 | 269 | |
| 270 | 270 | int xt_register_target(struct xt_target *target); |
| @@ -464,7 +464,7 @@ struct compat_xt_entry_match { · 193 unmodified lines | ||
| 464 | 464 | } kernel; |
| 465 | 465 | u_int16_t match_size; |
| 466 | 466 | } u; |
| 467 | − unsigned char data[0]; | |
| 467 | + unsigned char data[]; | |
| 468 | 468 | }; |
| 469 | 469 | |
| 470 | 470 | struct compat_xt_entry_target { |
| @@ -480,7 +480,7 @@ struct compat_xt_entry_target { · 9 unmodified lines | ||
| 480 | 480 | } kernel; |
| 481 | 481 | u_int16_t target_size; |
| 482 | 482 | } u; |
| 483 | − unsigned char data[0]; | |
| 483 | + unsigned char data[]; | |
| 484 | 484 | }; |
| 485 | 485 | |
| 486 | 486 | /* FIXME: this works only on 32 bit tasks |
| @@ -494,7 +494,7 @@ struct compat_xt_counters { · 7 unmodified lines | ||
| 494 | 494 | struct compat_xt_counters_info { |
| 495 | 495 | char name[XT_TABLE_MAXNAMELEN]; |
| 496 | 496 | compat_uint_t num_counters; |
| 497 | − struct compat_xt_counters counters[0]; | |
| 497 | + struct compat_xt_counters counters[]; | |
| 498 | 498 | }; |
| 499 | 499 | |
| 500 | 500 | struct _compat_xt_align { |
| @@ -67,7 +67,7 @@ struct compat_arpt_entry { · 66 unmodified lines | ||
| 67 | 67 | __u16 next_offset; |
| 68 | 68 | compat_uint_t comefrom; |
| 69 | 69 | struct compat_xt_counters counters; |
| 70 | − unsigned char elems[0]; | |
| 70 | + unsigned char elems[]; | |
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | 73 | static inline struct xt_entry_target * |
| @@ -85,7 +85,7 @@ struct ebt_table_info { · 84 unmodified lines | ||
| 85 | 85 | /* room to maintain the stack used for jumping from and into udc */ |
| 86 | 86 | struct ebt_chainstack **chainstack; |
| 87 | 87 | char *entries; |
| 88 | − struct ebt_counter counters[0] ____cacheline_aligned; | |
| 88 | + struct ebt_counter counters[] ____cacheline_aligned; | |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | 91 | struct ebt_table { |
| @@ -76,7 +76,7 @@ struct compat_ipt_entry { · 75 unmodified lines | ||
| 76 | 76 | __u16 next_offset; |
| 77 | 77 | compat_uint_t comefrom; |
| 78 | 78 | struct compat_xt_counters counters; |
| 79 | − unsigned char elems[0]; | |
| 79 | + unsigned char elems[]; | |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | 82 | /* Helper functions */ |
| @@ -43,7 +43,7 @@ struct compat_ip6t_entry { · 42 unmodified lines | ||
| 43 | 43 | __u16 next_offset; |
| 44 | 44 | compat_uint_t comefrom; |
| 45 | 45 | struct compat_xt_counters counters; |
| 46 | − unsigned char elems[0]; | |
| 46 | + unsigned char elems[]; | |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 | static inline struct xt_entry_target * |
| @@ -115,6 +115,19 @@ static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack, · 114 unmodified lines | ||
| 115 | 115 | { |
| 116 | 116 | u64 __cookie = cookie; |
| 117 | 117 | |
| 118 | + if (!extack) | |
| 119 | + return; | |
| 120 | + memcpy(extack->cookie, &__cookie, sizeof(__cookie)); | |
| 121 | + extack->cookie_len = sizeof(__cookie); | |
| 122 | +} | |
| 123 | + | |
| 124 | +static inline void nl_set_extack_cookie_u32(struct netlink_ext_ack *extack, | |
| 125 | + u32 cookie) | |
| 126 | +{ | |
| 127 | + u32 __cookie = cookie; | |
| 128 | + | |
| 129 | + if (!extack) | |
| 130 | + return; | |
| 118 | 131 | memcpy(extack->cookie, &__cookie, sizeof(__cookie)); |
| 119 | 132 | extack->cookie_len = sizeof(__cookie); |
| 120 | 133 | } |
| @@ -188,10 +201,10 @@ struct netlink_callback { · 67 unmodified lines | ||
| 188 | 201 | struct module *module; |
| 189 | 202 | struct netlink_ext_ack *extack; |
| 190 | 203 | u16 family; |
| 191 | − u16 min_dump_alloc; | |
| 192 | − bool strict_check; | |
| 193 | 204 | u16 answer_flags; |
| 205 | + u32 min_dump_alloc; | |
| 194 | 206 | unsigned int prev_seq, seq; |
| 207 | + bool strict_check; | |
| 195 | 208 | union { |
| 196 | 209 | u8 ctx[48]; |
| 197 | 210 | |
| @@ -354,6 +354,7 @@ static inline unsigned long nfs_save_change_attribute(struct inode *dir) · 353 unmodified lines | ||
| 354 | 354 | extern int nfs_sync_mapping(struct address_space *mapping); |
| 355 | 355 | extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); |
| 356 | 356 | extern void nfs_zap_caches(struct inode *); |
| 357 | +extern void nfs_set_inode_stale(struct inode *inode); | |
| 357 | 358 | extern void nfs_invalidate_atime(struct inode *); |
| 358 | 359 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, |
| 359 | 360 | struct nfs_fattr *, struct nfs4_label *); |
| @@ -139,9 +139,14 @@ extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, · 138 unmodified lines | ||
| 139 | 139 | extern int nfs_wait_on_request(struct nfs_page *); |
| 140 | 140 | extern void nfs_unlock_request(struct nfs_page *req); |
| 141 | 141 | extern void nfs_unlock_and_release_request(struct nfs_page *); |
| 142 | +extern struct nfs_page *nfs_page_group_lock_head(struct nfs_page *req); | |
| 143 | +extern int nfs_page_group_lock_subrequests(struct nfs_page *head); | |
| 144 | +extern void nfs_join_page_group(struct nfs_page *head, struct inode *inode); | |
| 142 | 145 | extern int nfs_page_group_lock(struct nfs_page *); |
| 143 | 146 | extern void nfs_page_group_unlock(struct nfs_page *); |
| 144 | 147 | extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); |
| 148 | +extern int nfs_page_set_headlock(struct nfs_page *req); | |
| 149 | +extern void nfs_page_clear_headlock(struct nfs_page *req); | |
| 145 | 150 | extern bool nfs_async_iocounter_wait(struct rpc_task *, struct nfs_lock_context *); |
| 146 | 151 | |
| 147 | 152 | /* |
| @@ -75,6 +75,7 @@ struct nfs_fattr { · 74 unmodified lines | ||
| 75 | 75 | struct nfs4_string *owner_name; |
| 76 | 76 | struct nfs4_string *group_name; |
| 77 | 77 | struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */ |
| 78 | + struct nfs4_label *label; | |
| 78 | 79 | }; |
| 79 | 80 | |
| 80 | 81 | #define NFS_ATTR_FATTR_TYPE (1U << 0) |
| @@ -1265,16 +1266,25 @@ struct nfstime4 { · 1184 unmodified lines | ||
| 1265 | 1266 | struct pnfs_commit_bucket { |
| 1266 | 1267 | struct list_head written; |
| 1267 | 1268 | struct list_head committing; |
| 1268 | − struct pnfs_layout_segment *wlseg; | |
| 1269 | − struct pnfs_layout_segment *clseg; | |
| 1269 | + struct pnfs_layout_segment *lseg; | |
| 1270 | 1270 | struct nfs_writeverf direct_verf; |
| 1271 | 1271 | }; |
| 1272 | 1272 | |
| 1273 | +struct pnfs_commit_array { | |
| 1274 | + struct list_head cinfo_list; | |
| 1275 | + struct list_head lseg_list; | |
| 1276 | + struct pnfs_layout_segment *lseg; | |
| 1277 | + struct rcu_head rcu; | |
| 1278 | + refcount_t refcount; | |
| 1279 | + unsigned int nbuckets; | |
| 1280 | + struct pnfs_commit_bucket buckets[]; | |
| 1281 | +}; | |
| 1282 | + | |
| 1273 | 1283 | struct pnfs_ds_commit_info { |
| 1274 | − int nwritten; | |
| 1275 | − int ncommitting; | |
| 1276 | − int nbuckets; | |
| 1277 | − struct pnfs_commit_bucket *buckets; | |
| 1284 | + struct list_head commits; | |
| 1285 | + unsigned int nwritten; | |
| 1286 | + unsigned int ncommitting; | |
| 1287 | + const struct pnfs_commit_ops *ops; | |
| 1278 | 1288 | }; |
| 1279 | 1289 | |
| 1280 | 1290 | struct nfs41_state_protection { |
| @@ -1385,22 +1395,11 @@ struct nfs41_free_stateid_res { · 104 unmodified lines | ||
| 1385 | 1395 | unsigned int status; |
| 1386 | 1396 | }; |
| 1387 | 1397 | |
| 1388 | −static inline void | |
| 1389 | −nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) | |
| 1390 | −{ | |
| 1391 | − kfree(cinfo->buckets); | |
| 1392 | −} | |
| 1393 | − | |
| 1394 | 1398 | #else |
| 1395 | 1399 | |
| 1396 | 1400 | struct pnfs_ds_commit_info { |
| 1397 | 1401 | }; |
| 1398 | 1402 | |
| 1399 | −static inline void | |
| 1400 | −nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) | |
| 1401 | −{ | |
| 1402 | −} | |
| 1403 | − | |
| 1404 | 1403 | #endif /* CONFIG_NFS_V4_1 */ |
| 1405 | 1404 | |
| 1406 | 1405 | #ifdef CONFIG_NFS_V4_2 |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | 2 | #ifndef _LINUX_NUMA_H |
| 3 | 3 | #define _LINUX_NUMA_H |
| 4 | − | |
| 4 | +#include <linux/types.h> | |
| 5 | 5 | |
| 6 | 6 | #ifdef CONFIG_NODES_SHIFT |
| 7 | 7 | #define NODES_SHIFT CONFIG_NODES_SHIFT |
| @@ -13,4 +13,32 @@ · 5 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | #define NUMA_NO_NODE (-1) |
| 15 | 15 | |
| 16 | +/* optionally keep NUMA memory info available post init */ | |
| 17 | +#ifdef CONFIG_NUMA_KEEP_MEMINFO | |
| 18 | +#define __initdata_or_meminfo | |
| 19 | +#else | |
| 20 | +#define __initdata_or_meminfo __initdata | |
| 21 | +#endif | |
| 22 | + | |
| 23 | +#ifdef CONFIG_NUMA | |
| 24 | +/* Generic implementation available */ | |
| 25 | +int numa_map_to_online_node(int node); | |
| 26 | + | |
| 27 | +/* | |
| 28 | + * Optional architecture specific implementation, users need a "depends | |
| 29 | + * on $ARCH" | |
| 30 | + */ | |
| 31 | +int phys_to_target_node(phys_addr_t addr); | |
| 32 | +#else | |
| 33 | +static inline int numa_map_to_online_node(int node) | |
| 34 | +{ | |
| 35 | + return NUMA_NO_NODE; | |
| 36 | +} | |
| 37 | + | |
| 38 | +static inline int phys_to_target_node(phys_addr_t addr) | |
| 39 | +{ | |
| 40 | + return NUMA_NO_NODE; | |
| 41 | +} | |
| 42 | +#endif | |
| 43 | + | |
| 16 | 44 | #endif /* _LINUX_NUMA_H */ |
| @@ -270,8 +270,6 @@ struct nvme_fc_remote_port { · 269 unmodified lines | ||
| 270 | 270 | * |
| 271 | 271 | * Host/Initiator Transport Entrypoints/Parameters: |
| 272 | 272 | * |
| 273 | − * @module: The LLDD module using the interface | |
| 274 | − * | |
| 275 | 273 | * @localport_delete: The LLDD initiates deletion of a localport via |
| 276 | 274 | * nvme_fc_deregister_localport(). However, the teardown is |
| 277 | 275 | * asynchronous. This routine is called upon the completion of the |
| @@ -385,8 +383,6 @@ struct nvme_fc_remote_port { · 107 unmodified lines | ||
| 385 | 383 | * Value is Mandatory. Allowed to be zero. |
| 386 | 384 | */ |
| 387 | 385 | struct nvme_fc_port_template { |
| 388 | − struct module *module; | |
| 389 | − | |
| 390 | 386 | /* initiator-based functions */ |
| 391 | 387 | void (*localport_delete)(struct nvme_fc_local_port *); |
| 392 | 388 | void (*remoteport_delete)(struct nvme_fc_remote_port *); |
| @@ -63,6 +63,7 @@ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); · 62 unmodified lines | ||
| 63 | 63 | int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len); |
| 64 | 64 | int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); |
| 65 | 65 | int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); |
| 66 | +int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val); | |
| 66 | 67 | |
| 67 | 68 | /* direct nvmem device read/write interface */ |
| 68 | 69 | struct nvmem_device *nvmem_device_get(struct device *dev, const char *name); |
| @@ -138,6 +139,12 @@ static inline int nvmem_cell_read_u32(struct device *dev, · 69 unmodified lines | ||
| 138 | 139 | return -EOPNOTSUPP; |
| 139 | 140 | } |
| 140 | 141 | |
| 142 | +static inline int nvmem_cell_read_u64(struct device *dev, | |
| 143 | + const char *cell_id, u64 *val) | |
| 144 | +{ | |
| 145 | + return -EOPNOTSUPP; | |
| 146 | +} | |
| 147 | + | |
| 141 | 148 | static inline struct nvmem_device *nvmem_device_get(struct device *dev, |
| 142 | 149 | const char *name) |
| 143 | 150 | { |
| @@ -10,21 +10,27 @@ struct of_pci_range_parser { · 9 unmodified lines | ||
| 10 | 10 | struct device_node *node; |
| 11 | 11 | const __be32 *range; |
| 12 | 12 | const __be32 *end; |
| 13 | − int np; | |
| 13 | + int na; | |
| 14 | + int ns; | |
| 14 | 15 | int pna; |
| 15 | 16 | bool dma; |
| 16 | 17 | }; |
| 18 | +#define of_range_parser of_pci_range_parser | |
| 17 | 19 | |
| 18 | 20 | struct of_pci_range { |
| 19 | − u32 pci_space; | |
| 20 | − u64 pci_addr; | |
| 21 | + union { | |
| 22 | + u64 pci_addr; | |
| 23 | + u64 bus_addr; | |
| 24 | + }; | |
| 21 | 25 | u64 cpu_addr; |
| 22 | 26 | u64 size; |
| 23 | 27 | u32 flags; |
| 24 | 28 | }; |
| 29 | +#define of_range of_pci_range | |
| 25 | 30 | |
| 26 | 31 | #define for_each_of_pci_range(parser, range) \ |
| 27 | 32 | for (; of_pci_range_parser_one(parser, range);) |
| 33 | +#define for_each_of_range for_each_of_pci_range | |
| 28 | 34 | |
| 29 | 35 | /* Translate a DMA address from device space to CPU space */ |
| 30 | 36 | extern u64 of_translate_dma_address(struct device_node *dev, |
| @@ -143,4 +149,3 @@ static inline int of_pci_range_to_resource(struct of_pci_range *range, · 112 unmodified lines | ||
| 143 | 149 | #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
| 144 | 150 | |
| 145 | 151 | #endif /* __OF_ADDRESS_H */ |
| 146 | − | |
| @@ -11,17 +11,17 @@ struct of_device_id; · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | #if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF) |
| 13 | 13 | |
| 14 | −unsigned int of_clk_get_parent_count(struct device_node *np); | |
| 15 | −const char *of_clk_get_parent_name(struct device_node *np, int index); | |
| 14 | +unsigned int of_clk_get_parent_count(const struct device_node *np); | |
| 15 | +const char *of_clk_get_parent_name(const struct device_node *np, int index); | |
| 16 | 16 | void of_clk_init(const struct of_device_id *matches); |
| 17 | 17 | |
| 18 | 18 | #else /* !CONFIG_COMMON_CLK || !CONFIG_OF */ |
| 19 | 19 | |
| 20 | −static inline unsigned int of_clk_get_parent_count(struct device_node *np) | |
| 20 | +static inline unsigned int of_clk_get_parent_count(const struct device_node *np) | |
| 21 | 21 | { |
| 22 | 22 | return 0; |
| 23 | 23 | } |
| 24 | −static inline const char *of_clk_get_parent_name(struct device_node *np, | |
| 24 | +static inline const char *of_clk_get_parent_name(const struct device_node *np, | |
| 25 | 25 | int index) |
| 26 | 26 | { |
| 27 | 27 | return NULL; |
| @@ -11,9 +11,8 @@ · 10 unmodified lines | ||
| 11 | 11 | #define __LINUX_OF_GPIO_H |
| 12 | 12 | |
| 13 | 13 | #include <linux/compiler.h> |
| 14 | −#include <linux/kernel.h> | |
| 15 | −#include <linux/errno.h> | |
| 16 | −#include <linux/gpio.h> | |
| 14 | +#include <linux/gpio/driver.h> | |
| 15 | +#include <linux/gpio.h> /* FIXME: Shouldn't be here */ | |
| 17 | 16 | #include <linux/of.h> |
| 18 | 17 | |
| 19 | 18 | struct device_node; |
| @@ -34,6 +33,8 @@ enum of_gpio_flags { · 14 unmodified lines | ||
| 34 | 33 | |
| 35 | 34 | #ifdef CONFIG_OF_GPIO |
| 36 | 35 | |
| 36 | +#include <linux/kernel.h> | |
| 37 | + | |
| 37 | 38 | /* |
| 38 | 39 | * OF GPIO chip for memory mapped banks |
| 39 | 40 | */ |
| @@ -63,6 +64,8 @@ extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc); · 23 unmodified lines | ||
| 63 | 64 | |
| 64 | 65 | #else /* CONFIG_OF_GPIO */ |
| 65 | 66 | |
| 67 | +#include <linux/errno.h> | |
| 68 | + | |
| 66 | 69 | /* Drivers may not strictly depend on the GPIO support, so let them link. */ |
| 67 | 70 | static inline int of_get_named_gpio_flags(struct device_node *np, |
| 68 | 71 | const char *list_name, int index, enum of_gpio_flags *flags) |
| @@ -63,6 +63,11 @@ · 62 unmodified lines | ||
| 63 | 63 | * page_waitqueue(page) is a wait queue of all tasks waiting for the page |
| 64 | 64 | * to become unlocked. |
| 65 | 65 | * |
| 66 | + * PG_swapbacked is set when a page uses swap as a backing storage. This are | |
| 67 | + * usually PageAnon or shmem pages but please note that even anonymous pages | |
| 68 | + * might lose their PG_swapbacked flag when they simply can be dropped (e.g. as | |
| 69 | + * a result of MADV_FREE). | |
| 70 | + * | |
| 66 | 71 | * PG_uptodate tells whether the page's contents is valid. When a read |
| 67 | 72 | * completes, the page becomes uptodate, unless a disk I/O error happened. |
| 68 | 73 | * |
| @@ -163,6 +168,9 @@ enum pageflags { · 94 unmodified lines | ||
| 163 | 168 | |
| 164 | 169 | /* non-lru isolated movable page */ |
| 165 | 170 | PG_isolated = PG_reclaim, |
| 171 | + | |
| 172 | + /* Only valid for buddy pages. Used to track pages that are reported */ | |
| 173 | + PG_reported = PG_uptodate, | |
| 166 | 174 | }; |
| 167 | 175 | |
| 168 | 176 | #ifndef __GENERATING_BOUNDS_H |
| @@ -311,7 +319,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } · 142 unmodified lines | ||
| 311 | 319 | |
| 312 | 320 | __PAGEFLAG(Locked, locked, PF_NO_TAIL) |
| 313 | 321 | PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) |
| 314 | −PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND) | |
| 322 | +PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL) | |
| 315 | 323 | PAGEFLAG(Referenced, referenced, PF_HEAD) |
| 316 | 324 | TESTCLEARFLAG(Referenced, referenced, PF_HEAD) |
| 317 | 325 | __SETPAGEFLAG(Referenced, referenced, PF_HEAD) |
| @@ -431,6 +439,14 @@ TESTCLEARFLAG(Young, young, PF_ANY) · 113 unmodified lines | ||
| 431 | 439 | PAGEFLAG(Idle, idle, PF_ANY) |
| 432 | 440 | #endif |
| 433 | 441 | |
| 442 | +/* | |
| 443 | + * PageReported() is used to track reported free pages within the Buddy | |
| 444 | + * allocator. We can use the non-atomic version of the test and set | |
| 445 | + * operations as both should be shielded with the zone lock to prevent | |
| 446 | + * any possible races on the setting or clearing of the bit. | |
| 447 | + */ | |
| 448 | +__PAGEFLAG(Reported, reported, PF_NO_COMPOUND) | |
| 449 | + | |
| 434 | 450 | /* |
| 435 | 451 | * On an anonymous page mapped into a user virtual memory area, |
| 436 | 452 | * page->mapping points to its anon_vma, not to a struct address_space; |
| @@ -102,6 +102,15 @@ static inline void page_ref_sub(struct page *page, int nr) · 101 unmodified lines | ||
| 102 | 102 | __page_ref_mod(page, -nr); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | +static inline int page_ref_sub_return(struct page *page, int nr) | |
| 106 | +{ | |
| 107 | + int ret = atomic_sub_return(nr, &page->_refcount); | |
| 108 | + | |
| 109 | + if (page_ref_tracepoint_active(__tracepoint_page_ref_mod_and_return)) | |
| 110 | + __page_ref_mod_and_return(page, -nr, ret); | |
| 111 | + return ret; | |
| 112 | +} | |
| 113 | + | |
| 105 | 114 | static inline void page_ref_inc(struct page *page) |
| 106 | 115 | { |
| 107 | 116 | atomic_inc(&page->_refcount); |
| @@ -0,0 +1,26 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_PAGE_REPORTING_H | |
| 3 | +#define _LINUX_PAGE_REPORTING_H | |
| 4 | + | |
| 5 | +#include <linux/mmzone.h> | |
| 6 | +#include <linux/scatterlist.h> | |
| 7 | + | |
| 8 | +/* This value should always be a power of 2, see page_reporting_cycle() */ | |
| 9 | +#define PAGE_REPORTING_CAPACITY 32 | |
| 10 | + | |
| 11 | +struct page_reporting_dev_info { | |
| 12 | + /* function that alters pages to make them "reported" */ | |
| 13 | + int (*report)(struct page_reporting_dev_info *prdev, | |
| 14 | + struct scatterlist *sg, unsigned int nents); | |
| 15 | + | |
| 16 | + /* work struct for processing reports */ | |
| 17 | + struct delayed_work work; | |
| 18 | + | |
| 19 | + /* Current state of page reporting */ | |
| 20 | + atomic_t state; | |
| 21 | +}; | |
| 22 | + | |
| 23 | +/* Tear-down and bring-up for page reporting devices */ | |
| 24 | +void page_reporting_unregister(struct page_reporting_dev_info *prdev); | |
| 25 | +int page_reporting_register(struct page_reporting_dev_info *prdev); | |
| 26 | +#endif /*_LINUX_PAGE_REPORTING_H */ | |
| @@ -33,8 +33,8 @@ enum mapping_flags { · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * mapping_set_error - record a writeback error in the address_space |
| 36 | − * @mapping - the mapping in which an error should be set | |
| 37 | − * @error - the error to set in the mapping | |
| 36 | + * @mapping: the mapping in which an error should be set | |
| 37 | + * @error: the error to set in the mapping | |
| 38 | 38 | * |
| 39 | 39 | * When writeback fails in some way, we must record that error so that |
| 40 | 40 | * userspace can be informed when fsync and the like are called. We endeavor |
| @@ -70,11 +70,9 @@ static inline void mapping_clear_unevictable(struct address_space *mapping) · 29 unmodified lines | ||
| 70 | 70 | clear_bit(AS_UNEVICTABLE, &mapping->flags); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | −static inline int mapping_unevictable(struct address_space *mapping) | |
| 73 | +static inline bool mapping_unevictable(struct address_space *mapping) | |
| 74 | 74 | { |
| 75 | − if (mapping) | |
| 76 | − return test_bit(AS_UNEVICTABLE, &mapping->flags); | |
| 77 | − return !!mapping; | |
| 75 | + return mapping && test_bit(AS_UNEVICTABLE, &mapping->flags); | |
| 78 | 76 | } |
| 79 | 77 | |
| 80 | 78 | static inline void mapping_set_exiting(struct address_space *mapping) |
| @@ -305,9 +303,9 @@ static inline struct page *find_lock_page(struct address_space *mapping, · 224 unmodified lines | ||
| 305 | 303 | * atomic allocation! |
| 306 | 304 | */ |
| 307 | 305 | static inline struct page *find_or_create_page(struct address_space *mapping, |
| 308 | − pgoff_t offset, gfp_t gfp_mask) | |
| 306 | + pgoff_t index, gfp_t gfp_mask) | |
| 309 | 307 | { |
| 310 | − return pagecache_get_page(mapping, offset, | |
| 308 | + return pagecache_get_page(mapping, index, | |
| 311 | 309 | FGP_LOCK|FGP_ACCESSED|FGP_CREAT, |
| 312 | 310 | gfp_mask); |
| 313 | 311 | } |
| @@ -333,14 +331,17 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, · 19 unmodified lines | ||
| 333 | 331 | mapping_gfp_mask(mapping)); |
| 334 | 332 | } |
| 335 | 333 | |
| 336 | −static inline struct page *find_subpage(struct page *page, pgoff_t offset) | |
| 334 | +/* | |
| 335 | + * Given the page we found in the page cache, return the page corresponding | |
| 336 | + * to this index in the file | |
| 337 | + */ | |
| 338 | +static inline struct page *find_subpage(struct page *head, pgoff_t index) | |
| 337 | 339 | { |
| 338 | − if (PageHuge(page)) | |
| 339 | − return page; | |
| 340 | − | |
| 341 | − VM_BUG_ON_PAGE(PageTail(page), page); | |
| 340 | + /* HugeTLBfs wants the head page regardless */ | |
| 341 | + if (PageHuge(head)) | |
| 342 | + return head; | |
| 342 | 343 | |
| 343 | − return page + (offset & (compound_nr(page) - 1)); | |
| 344 | + return head + (index & (hpage_nr_pages(head) - 1)); | |
| 344 | 345 | } |
| 345 | 346 | |
| 346 | 347 | struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); |
| @@ -0,0 +1,115 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_PART_STAT_H | |
| 3 | +#define _LINUX_PART_STAT_H | |
| 4 | + | |
| 5 | +#include <linux/genhd.h> | |
| 6 | + | |
| 7 | +/* | |
| 8 | + * Macros to operate on percpu disk statistics: | |
| 9 | + * | |
| 10 | + * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters | |
| 11 | + * and should be called between disk_stat_lock() and | |
| 12 | + * disk_stat_unlock(). | |
| 13 | + * | |
| 14 | + * part_stat_read() can be called at any time. | |
| 15 | + * | |
| 16 | + * part_stat_{add|set_all}() and {init|free}_part_stats are for | |
| 17 | + * internal use only. | |
| 18 | + */ | |
| 19 | +#ifdef CONFIG_SMP | |
| 20 | +#define part_stat_lock() ({ rcu_read_lock(); get_cpu(); }) | |
| 21 | +#define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0) | |
| 22 | + | |
| 23 | +#define part_stat_get_cpu(part, field, cpu) \ | |
| 24 | + (per_cpu_ptr((part)->dkstats, (cpu))->field) | |
| 25 | + | |
| 26 | +#define part_stat_get(part, field) \ | |
| 27 | + part_stat_get_cpu(part, field, smp_processor_id()) | |
| 28 | + | |
| 29 | +#define part_stat_read(part, field) \ | |
| 30 | +({ \ | |
| 31 | + typeof((part)->dkstats->field) res = 0; \ | |
| 32 | + unsigned int _cpu; \ | |
| 33 | + for_each_possible_cpu(_cpu) \ | |
| 34 | + res += per_cpu_ptr((part)->dkstats, _cpu)->field; \ | |
| 35 | + res; \ | |
| 36 | +}) | |
| 37 | + | |
| 38 | +static inline void part_stat_set_all(struct hd_struct *part, int value) | |
| 39 | +{ | |
| 40 | + int i; | |
| 41 | + | |
| 42 | + for_each_possible_cpu(i) | |
| 43 | + memset(per_cpu_ptr(part->dkstats, i), value, | |
| 44 | + sizeof(struct disk_stats)); | |
| 45 | +} | |
| 46 | + | |
| 47 | +static inline int init_part_stats(struct hd_struct *part) | |
| 48 | +{ | |
| 49 | + part->dkstats = alloc_percpu(struct disk_stats); | |
| 50 | + if (!part->dkstats) | |
| 51 | + return 0; | |
| 52 | + return 1; | |
| 53 | +} | |
| 54 | + | |
| 55 | +static inline void free_part_stats(struct hd_struct *part) | |
| 56 | +{ | |
| 57 | + free_percpu(part->dkstats); | |
| 58 | +} | |
| 59 | + | |
| 60 | +#else /* !CONFIG_SMP */ | |
| 61 | +#define part_stat_lock() ({ rcu_read_lock(); 0; }) | |
| 62 | +#define part_stat_unlock() rcu_read_unlock() | |
| 63 | + | |
| 64 | +#define part_stat_get(part, field) ((part)->dkstats.field) | |
| 65 | +#define part_stat_get_cpu(part, field, cpu) part_stat_get(part, field) | |
| 66 | +#define part_stat_read(part, field) part_stat_get(part, field) | |
| 67 | + | |
| 68 | +static inline void part_stat_set_all(struct hd_struct *part, int value) | |
| 69 | +{ | |
| 70 | + memset(&part->dkstats, value, sizeof(struct disk_stats)); | |
| 71 | +} | |
| 72 | + | |
| 73 | +static inline int init_part_stats(struct hd_struct *part) | |
| 74 | +{ | |
| 75 | + return 1; | |
| 76 | +} | |
| 77 | + | |
| 78 | +static inline void free_part_stats(struct hd_struct *part) | |
| 79 | +{ | |
| 80 | +} | |
| 81 | + | |
| 82 | +#endif /* CONFIG_SMP */ | |
| 83 | + | |
| 84 | +#define part_stat_read_accum(part, field) \ | |
| 85 | + (part_stat_read(part, field[STAT_READ]) + \ | |
| 86 | + part_stat_read(part, field[STAT_WRITE]) + \ | |
| 87 | + part_stat_read(part, field[STAT_DISCARD])) | |
| 88 | + | |
| 89 | +#define __part_stat_add(part, field, addnd) \ | |
| 90 | + (part_stat_get(part, field) += (addnd)) | |
| 91 | + | |
| 92 | +#define part_stat_add(part, field, addnd) do { \ | |
| 93 | + __part_stat_add((part), field, addnd); \ | |
| 94 | + if ((part)->partno) \ | |
| 95 | + __part_stat_add(&part_to_disk((part))->part0, \ | |
| 96 | + field, addnd); \ | |
| 97 | +} while (0) | |
| 98 | + | |
| 99 | +#define part_stat_dec(gendiskp, field) \ | |
| 100 | + part_stat_add(gendiskp, field, -1) | |
| 101 | +#define part_stat_inc(gendiskp, field) \ | |
| 102 | + part_stat_add(gendiskp, field, 1) | |
| 103 | +#define part_stat_sub(gendiskp, field, subnd) \ | |
| 104 | + part_stat_add(gendiskp, field, -subnd) | |
| 105 | + | |
| 106 | +#define part_stat_local_dec(gendiskp, field) \ | |
| 107 | + local_dec(&(part_stat_get(gendiskp, field))) | |
| 108 | +#define part_stat_local_inc(gendiskp, field) \ | |
| 109 | + local_inc(&(part_stat_get(gendiskp, field))) | |
| 110 | +#define part_stat_local_read(gendiskp, field) \ | |
| 111 | + local_read(&(part_stat_get(gendiskp, field))) | |
| 112 | +#define part_stat_local_read_cpu(gendiskp, field, cpu) \ | |
| 113 | + local_read(&(part_stat_get_cpu(gendiskp, field, cpu))) | |
| 114 | + | |
| 115 | +#endif /* _LINUX_PART_STAT_H */ | |
| @@ -112,6 +112,14 @@ extern const guid_t pci_acpi_dsm_guid; · 111 unmodified lines | ||
| 112 | 112 | #define RESET_DELAY_DSM 0x08 |
| 113 | 113 | #define FUNCTION_DELAY_DSM 0x09 |
| 114 | 114 | |
| 115 | +#ifdef CONFIG_PCIE_EDR | |
| 116 | +void pci_acpi_add_edr_notifier(struct pci_dev *pdev); | |
| 117 | +void pci_acpi_remove_edr_notifier(struct pci_dev *pdev); | |
| 118 | +#else | |
| 119 | +static inline void pci_acpi_add_edr_notifier(struct pci_dev *pdev) { } | |
| 120 | +static inline void pci_acpi_remove_edr_notifier(struct pci_dev *pdev) { } | |
| 121 | +#endif /* CONFIG_PCIE_EDR */ | |
| 122 | + | |
| 115 | 123 | #else /* CONFIG_ACPI */ |
| 116 | 124 | static inline void acpi_pci_add_bus(struct pci_bus *bus) { } |
| 117 | 125 | static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } |
| @@ -53,7 +53,8 @@ struct pci_epc_ops { · 52 unmodified lines | ||
| 53 | 53 | phys_addr_t addr); |
| 54 | 54 | int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts); |
| 55 | 55 | int (*get_msi)(struct pci_epc *epc, u8 func_no); |
| 56 | − int (*set_msix)(struct pci_epc *epc, u8 func_no, u16 interrupts); | |
| 56 | + int (*set_msix)(struct pci_epc *epc, u8 func_no, u16 interrupts, | |
| 57 | + enum pci_barno, u32 offset); | |
| 57 | 58 | int (*get_msix)(struct pci_epc *epc, u8 func_no); |
| 58 | 59 | int (*raise_irq)(struct pci_epc *epc, u8 func_no, |
| 59 | 60 | enum pci_epc_irq_type type, u16 interrupt_num); |
| @@ -71,6 +72,7 @@ struct pci_epc_ops { · 11 unmodified lines | ||
| 71 | 72 | * @bitmap: bitmap to manage the PCI address space |
| 72 | 73 | * @pages: number of bits representing the address region |
| 73 | 74 | * @page_size: size of each page |
| 75 | + * @lock: mutex to protect bitmap | |
| 74 | 76 | */ |
| 75 | 77 | struct pci_epc_mem { |
| 76 | 78 | phys_addr_t phys_base; |
| @@ -78,6 +80,8 @@ struct pci_epc_mem { · 1 unmodified line | ||
| 78 | 80 | unsigned long *bitmap; |
| 79 | 81 | size_t page_size; |
| 80 | 82 | int pages; |
| 83 | + /* mutex to protect against concurrent access for memory allocation*/ | |
| 84 | + struct mutex lock; | |
| 81 | 85 | }; |
| 82 | 86 | |
| 83 | 87 | /** |
| @@ -88,7 +92,9 @@ struct pci_epc_mem { · 4 unmodified lines | ||
| 88 | 92 | * @mem: address space of the endpoint controller |
| 89 | 93 | * @max_functions: max number of functions that can be configured in this EPC |
| 90 | 94 | * @group: configfs group representing the PCI EPC device |
| 91 | − * @lock: spinlock to protect pci_epc ops | |
| 95 | + * @lock: mutex to protect pci_epc ops | |
| 96 | + * @function_num_map: bitmap to manage physical function number | |
| 97 | + * @notifier: used to notify EPF of any EPC events (like linkup) | |
| 92 | 98 | */ |
| 93 | 99 | struct pci_epc { |
| 94 | 100 | struct device dev; |
| @@ -97,8 +103,10 @@ struct pci_epc { · 2 unmodified lines | ||
| 97 | 103 | struct pci_epc_mem *mem; |
| 98 | 104 | u8 max_functions; |
| 99 | 105 | struct config_group *group; |
| 100 | − /* spinlock to protect against concurrent access of EP controller */ | |
| 101 | − spinlock_t lock; | |
| 106 | + /* mutex to protect against concurrent access of EP controller */ | |
| 107 | + struct mutex lock; | |
| 108 | + unsigned long function_num_map; | |
| 109 | + struct atomic_notifier_head notifier; | |
| 102 | 110 | }; |
| 103 | 111 | |
| 104 | 112 | /** |
| @@ -113,6 +121,7 @@ struct pci_epc { · 8 unmodified lines | ||
| 113 | 121 | */ |
| 114 | 122 | struct pci_epc_features { |
| 115 | 123 | unsigned int linkup_notifier : 1; |
| 124 | + unsigned int core_init_notifier : 1; | |
| 116 | 125 | unsigned int msi_capable : 1; |
| 117 | 126 | unsigned int msix_capable : 1; |
| 118 | 127 | u8 reserved_bar; |
| @@ -141,6 +150,12 @@ static inline void *epc_get_drvdata(struct pci_epc *epc) · 22 unmodified lines | ||
| 141 | 150 | return dev_get_drvdata(&epc->dev); |
| 142 | 151 | } |
| 143 | 152 | |
| 153 | +static inline int | |
| 154 | +pci_epc_register_notifier(struct pci_epc *epc, struct notifier_block *nb) | |
| 155 | +{ | |
| 156 | + return atomic_notifier_chain_register(&epc->notifier, nb); | |
| 157 | +} | |
| 158 | + | |
| 144 | 159 | struct pci_epc * |
| 145 | 160 | __devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops, |
| 146 | 161 | struct module *owner); |
| @@ -151,6 +166,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc); · 4 unmodified lines | ||
| 151 | 166 | void pci_epc_destroy(struct pci_epc *epc); |
| 152 | 167 | int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf); |
| 153 | 168 | void pci_epc_linkup(struct pci_epc *epc); |
| 169 | +void pci_epc_init_notify(struct pci_epc *epc); | |
| 154 | 170 | void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf); |
| 155 | 171 | int pci_epc_write_header(struct pci_epc *epc, u8 func_no, |
| 156 | 172 | struct pci_epf_header *hdr); |
| @@ -165,7 +181,8 @@ void pci_epc_unmap_addr(struct pci_epc *epc, u8 func_no, · 8 unmodified lines | ||
| 165 | 181 | phys_addr_t phys_addr); |
| 166 | 182 | int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts); |
| 167 | 183 | int pci_epc_get_msi(struct pci_epc *epc, u8 func_no); |
| 168 | −int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts); | |
| 184 | +int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts, | |
| 185 | + enum pci_barno, u32 offset); | |
| 169 | 186 | int pci_epc_get_msix(struct pci_epc *epc, u8 func_no); |
| 170 | 187 | int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, |
| 171 | 188 | enum pci_epc_irq_type type, u16 interrupt_num); |
| @@ -15,6 +15,11 @@ · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | struct pci_epf; |
| 17 | 17 | |
| 18 | +enum pci_notify_event { | |
| 19 | + CORE_INIT, | |
| 20 | + LINK_UP, | |
| 21 | +}; | |
| 22 | + | |
| 18 | 23 | enum pci_barno { |
| 19 | 24 | BAR_0, |
| 20 | 25 | BAR_1, |
| @@ -55,13 +60,10 @@ struct pci_epf_header { · 34 unmodified lines | ||
| 55 | 60 | * @bind: ops to perform when a EPC device has been bound to EPF device |
| 56 | 61 | * @unbind: ops to perform when a binding has been lost between a EPC device |
| 57 | 62 | * and EPF device |
| 58 | − * @linkup: ops to perform when the EPC device has established a connection with | |
| 59 | − * a host system | |
| 60 | 63 | */ |
| 61 | 64 | struct pci_epf_ops { |
| 62 | 65 | int (*bind)(struct pci_epf *epf); |
| 63 | 66 | void (*unbind)(struct pci_epf *epf); |
| 64 | − void (*linkup)(struct pci_epf *epf); | |
| 65 | 67 | }; |
| 66 | 68 | |
| 67 | 69 | /** |
| @@ -92,10 +94,12 @@ struct pci_epf_driver { · 24 unmodified lines | ||
| 92 | 94 | /** |
| 93 | 95 | * struct pci_epf_bar - represents the BAR of EPF device |
| 94 | 96 | * @phys_addr: physical address that should be mapped to the BAR |
| 97 | + * @addr: virtual address corresponding to the @phys_addr | |
| 95 | 98 | * @size: the size of the address space present in BAR |
| 96 | 99 | */ |
| 97 | 100 | struct pci_epf_bar { |
| 98 | 101 | dma_addr_t phys_addr; |
| 102 | + void *addr; | |
| 99 | 103 | size_t size; |
| 100 | 104 | enum pci_barno barno; |
| 101 | 105 | int flags; |
| @@ -112,6 +116,8 @@ struct pci_epf_bar { · 10 unmodified lines | ||
| 112 | 116 | * @epc: the EPC device to which this EPF device is bound |
| 113 | 117 | * @driver: the EPF driver to which this EPF device is bound |
| 114 | 118 | * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc |
| 119 | + * @nb: notifier block to notify EPF of any EPC events (like linkup) | |
| 120 | + * @lock: mutex to protect pci_epf_ops | |
| 115 | 121 | */ |
| 116 | 122 | struct pci_epf { |
| 117 | 123 | struct device dev; |
| @@ -125,6 +131,22 @@ struct pci_epf { · 7 unmodified lines | ||
| 125 | 131 | struct pci_epc *epc; |
| 126 | 132 | struct pci_epf_driver *driver; |
| 127 | 133 | struct list_head list; |
| 134 | + struct notifier_block nb; | |
| 135 | + /* mutex to protect against concurrent access of pci_epf_ops */ | |
| 136 | + struct mutex lock; | |
| 137 | +}; | |
| 138 | + | |
| 139 | +/** | |
| 140 | + * struct pci_epf_msix_tbl - represents the MSIX table entry structure | |
| 141 | + * @msg_addr: Writes to this address will trigger MSIX interrupt in host | |
| 142 | + * @msg_data: Data that should be written to @msg_addr to trigger MSIX interrupt | |
| 143 | + * @vector_ctrl: Identifies if the function is prohibited from sending a message | |
| 144 | + * using this MSIX table entry | |
| 145 | + */ | |
| 146 | +struct pci_epf_msix_tbl { | |
| 147 | + u64 msg_addr; | |
| 148 | + u32 msg_data; | |
| 149 | + u32 vector_ctrl; | |
| 128 | 150 | }; |
| 129 | 151 | |
| 130 | 152 | #define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev) |
| @@ -154,5 +176,4 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, · 23 unmodified lines | ||
| 154 | 176 | void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar); |
| 155 | 177 | int pci_epf_bind(struct pci_epf *epf); |
| 156 | 178 | void pci_epf_unbind(struct pci_epf *epf); |
| 157 | −void pci_epf_linkup(struct pci_epf *epf); | |
| 158 | 179 | #endif /* __LINUX_PCI_EPF_H */ |
| @@ -42,6 +42,13 @@ · 41 unmodified lines | ||
| 42 | 42 | |
| 43 | 43 | #include <linux/pci_ids.h> |
| 44 | 44 | |
| 45 | +#define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \ | |
| 46 | + PCI_STATUS_SIG_SYSTEM_ERROR | \ | |
| 47 | + PCI_STATUS_REC_MASTER_ABORT | \ | |
| 48 | + PCI_STATUS_REC_TARGET_ABORT | \ | |
| 49 | + PCI_STATUS_SIG_TARGET_ABORT | \ | |
| 50 | + PCI_STATUS_PARITY) | |
| 51 | + | |
| 45 | 52 | /* |
| 46 | 53 | * The PCI interface treats multi-function devices as independent |
| 47 | 54 | * devices. The slot/function address of each device is encoded |
| @@ -236,7 +243,7 @@ enum pcie_link_width { · 188 unmodified lines | ||
| 236 | 243 | PCIE_LNK_WIDTH_UNKNOWN = 0xff, |
| 237 | 244 | }; |
| 238 | 245 | |
| 239 | −/* Based on the PCI Hotplug Spec, but some values are made up by us */ | |
| 246 | +/* See matching string table in pci_speed_string() */ | |
| 240 | 247 | enum pci_bus_speed { |
| 241 | 248 | PCI_SPEED_33MHz = 0x00, |
| 242 | 249 | PCI_SPEED_66MHz = 0x01, |
| @@ -444,6 +451,11 @@ struct pci_dev { · 201 unmodified lines | ||
| 444 | 451 | const struct attribute_group **msi_irq_groups; |
| 445 | 452 | #endif |
| 446 | 453 | struct pci_vpd *vpd; |
| 454 | +#ifdef CONFIG_PCIE_DPC | |
| 455 | + u16 dpc_cap; | |
| 456 | + unsigned int dpc_rp_extensions:1; | |
| 457 | + u8 dpc_rp_log_size; | |
| 458 | +#endif | |
| 447 | 459 | #ifdef CONFIG_PCI_ATS |
| 448 | 460 | union { |
| 449 | 461 | struct pci_sriov *sriov; /* PF: SR-IOV info */ |
| @@ -510,7 +522,9 @@ struct pci_host_bridge { · 60 unmodified lines | ||
| 510 | 522 | unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */ |
| 511 | 523 | unsigned int native_pme:1; /* OS may use PCIe PME */ |
| 512 | 524 | unsigned int native_ltr:1; /* OS may use PCIe LTR */ |
| 525 | + unsigned int native_dpc:1; /* OS may use PCIe DPC */ | |
| 513 | 526 | unsigned int preserve_config:1; /* Preserve FW resource setup */ |
| 527 | + unsigned int size_windows:1; /* Enable root bus sizing */ | |
| 514 | 528 | |
| 515 | 529 | /* Resource alignment requirements */ |
| 516 | 530 | resource_size_t (*align_resource)(struct pci_dev *dev, |
| @@ -1045,6 +1059,8 @@ int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); · 528 unmodified lines | ||
| 1045 | 1059 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); |
| 1046 | 1060 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
| 1047 | 1061 | |
| 1062 | +u64 pci_get_dsn(struct pci_dev *dev); | |
| 1063 | + | |
| 1048 | 1064 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, |
| 1049 | 1065 | struct pci_dev *from); |
| 1050 | 1066 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
| @@ -1203,6 +1219,7 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags); · 152 unmodified lines | ||
| 1203 | 1219 | bool pci_device_is_present(struct pci_dev *pdev); |
| 1204 | 1220 | void pci_ignore_hotplug(struct pci_dev *dev); |
| 1205 | 1221 | struct pci_dev *pci_real_dma_dev(struct pci_dev *dev); |
| 1222 | +int pci_status_get_and_clear_errors(struct pci_dev *pdev); | |
| 1206 | 1223 | |
| 1207 | 1224 | int __printf(6, 7) pci_request_irq(struct pci_dev *dev, unsigned int nr, |
| 1208 | 1225 | irq_handler_t handler, irq_handler_t thread_fn, void *dev_id, |
| @@ -1214,7 +1231,6 @@ int pci_enable_rom(struct pci_dev *pdev); · 5 unmodified lines | ||
| 1214 | 1231 | void pci_disable_rom(struct pci_dev *pdev); |
| 1215 | 1232 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
| 1216 | 1233 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
| 1217 | −void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); | |
| 1218 | 1234 | |
| 1219 | 1235 | /* Power management related routines */ |
| 1220 | 1236 | int pci_save_state(struct pci_dev *dev); |
| @@ -1699,6 +1715,9 @@ static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, · 478 unmodified lines | ||
| 1699 | 1715 | static inline int pci_find_ext_capability(struct pci_dev *dev, int cap) |
| 1700 | 1716 | { return 0; } |
| 1701 | 1717 | |
| 1718 | +static inline u64 pci_get_dsn(struct pci_dev *dev) | |
| 1719 | +{ return 0; } | |
| 1720 | + | |
| 1702 | 1721 | /* Power management related routines */ |
| 1703 | 1722 | static inline int pci_save_state(struct pci_dev *dev) { return 0; } |
| 1704 | 1723 | static inline void pci_restore_state(struct pci_dev *dev) { } |
| @@ -2171,6 +2190,7 @@ int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask); · 466 unmodified lines | ||
| 2171 | 2190 | #define PCI_VPD_INFO_FLD_HDR_SIZE 3 |
| 2172 | 2191 | |
| 2173 | 2192 | #define PCI_VPD_RO_KEYWORD_PARTNO "PN" |
| 2193 | +#define PCI_VPD_RO_KEYWORD_SERIALNO "SN" | |
| 2174 | 2194 | #define PCI_VPD_RO_KEYWORD_MFR_ID "MN" |
| 2175 | 2195 | #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" |
| 2176 | 2196 | #define PCI_VPD_RO_KEYWORD_CHKSUM "RV" |
| @@ -148,6 +148,8 @@ · 147 unmodified lines | ||
| 148 | 148 | |
| 149 | 149 | /* Vendors and devices. Sort key: vendor first, device next. */ |
| 150 | 150 | |
| 151 | +#define PCI_VENDOR_ID_LOONGSON 0x0014 | |
| 152 | + | |
| 151 | 153 | #define PCI_VENDOR_ID_TTTECH 0x0357 |
| 152 | 154 | #define PCI_DEVICE_ID_TTTECH_MC322 0x000a |
| 153 | 155 | |
| @@ -2583,6 +2585,8 @@ · 2429 unmodified lines | ||
| 2583 | 2585 | |
| 2584 | 2586 | #define PCI_VENDOR_ID_AMAZON 0x1d0f |
| 2585 | 2587 | |
| 2588 | +#define PCI_VENDOR_ID_ZHAOXIN 0x1d17 | |
| 2589 | + | |
| 2586 | 2590 | #define PCI_VENDOR_ID_HYGON 0x1d94 |
| 2587 | 2591 | |
| 2588 | 2592 | #define PCI_VENDOR_ID_HXT 0x1dbf |
| @@ -10,6 +10,27 @@ · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | #include <linux/types.h> |
| 12 | 12 | |
| 13 | +/* | |
| 14 | + * Linux EFI stub v1.0 adds the following functionality: | |
| 15 | + * - Loading initrd from the LINUX_EFI_INITRD_MEDIA_GUID device path, | |
| 16 | + * - Loading/starting the kernel from firmware that targets a different | |
| 17 | + * machine type, via the entrypoint exposed in the .compat PE/COFF section. | |
| 18 | + * | |
| 19 | + * The recommended way of loading and starting v1.0 or later kernels is to use | |
| 20 | + * the LoadImage() and StartImage() EFI boot services, and expose the initrd | |
| 21 | + * via the LINUX_EFI_INITRD_MEDIA_GUID device path. | |
| 22 | + * | |
| 23 | + * Versions older than v1.0 support initrd loading via the image load options | |
| 24 | + * (using initrd=, limited to the volume from which the kernel itself was | |
| 25 | + * loaded), or via arch specific means (bootparams, DT, etc). | |
| 26 | + * | |
| 27 | + * On x86, LoadImage() and StartImage() can be omitted if the EFI handover | |
| 28 | + * protocol is implemented, which can be inferred from the version, | |
| 29 | + * handover_offset and xloadflags fields in the bootparams structure. | |
| 30 | + */ | |
| 31 | +#define LINUX_EFISTUB_MAJOR_VERSION 0x1 | |
| 32 | +#define LINUX_EFISTUB_MINOR_VERSION 0x0 | |
| 33 | + | |
| 13 | 34 | #define MZ_MAGIC 0x5a4d /* "MZ" */ |
| 14 | 35 | |
| 15 | 36 | #define PE_MAGIC 0x00004550 /* "PE\0\0" */ |
| @@ -3,41 +3,52 @@ · 2 unmodified lines | ||
| 3 | 3 | #define _LINUX_PERCPU_RWSEM_H |
| 4 | 4 | |
| 5 | 5 | #include <linux/atomic.h> |
| 6 | −#include <linux/rwsem.h> | |
| 7 | 6 | #include <linux/percpu.h> |
| 8 | 7 | #include <linux/rcuwait.h> |
| 8 | +#include <linux/wait.h> | |
| 9 | 9 | #include <linux/rcu_sync.h> |
| 10 | 10 | #include <linux/lockdep.h> |
| 11 | 11 | |
| 12 | 12 | struct percpu_rw_semaphore { |
| 13 | 13 | struct rcu_sync rss; |
| 14 | 14 | unsigned int __percpu *read_count; |
| 15 | − struct rw_semaphore rw_sem; /* slowpath */ | |
| 16 | − struct rcuwait writer; /* blocked writer */ | |
| 17 | − int readers_block; | |
| 15 | + struct rcuwait writer; | |
| 16 | + wait_queue_head_t waiters; | |
| 17 | + atomic_t block; | |
| 18 | +#ifdef CONFIG_DEBUG_LOCK_ALLOC | |
| 19 | + struct lockdep_map dep_map; | |
| 20 | +#endif | |
| 18 | 21 | }; |
| 19 | 22 | |
| 23 | +#ifdef CONFIG_DEBUG_LOCK_ALLOC | |
| 24 | +#define __PERCPU_RWSEM_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }, | |
| 25 | +#else | |
| 26 | +#define __PERCPU_RWSEM_DEP_MAP_INIT(lockname) | |
| 27 | +#endif | |
| 28 | + | |
| 20 | 29 | #define __DEFINE_PERCPU_RWSEM(name, is_static) \ |
| 21 | 30 | static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \ |
| 22 | 31 | is_static struct percpu_rw_semaphore name = { \ |
| 23 | 32 | .rss = __RCU_SYNC_INITIALIZER(name.rss), \ |
| 24 | 33 | .read_count = &__percpu_rwsem_rc_##name, \ |
| 25 | − .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \ | |
| 26 | 34 | .writer = __RCUWAIT_INITIALIZER(name.writer), \ |
| 35 | + .waiters = __WAIT_QUEUE_HEAD_INITIALIZER(name.waiters), \ | |
| 36 | + .block = ATOMIC_INIT(0), \ | |
| 37 | + __PERCPU_RWSEM_DEP_MAP_INIT(name) \ | |
| 27 | 38 | } |
| 39 | + | |
| 28 | 40 | #define DEFINE_PERCPU_RWSEM(name) \ |
| 29 | 41 | __DEFINE_PERCPU_RWSEM(name, /* not static */) |
| 30 | 42 | #define DEFINE_STATIC_PERCPU_RWSEM(name) \ |
| 31 | 43 | __DEFINE_PERCPU_RWSEM(name, static) |
| 32 | 44 | |
| 33 | −extern int __percpu_down_read(struct percpu_rw_semaphore *, int); | |
| 34 | −extern void __percpu_up_read(struct percpu_rw_semaphore *); | |
| 45 | +extern bool __percpu_down_read(struct percpu_rw_semaphore *, bool); | |
| 35 | 46 | |
| 36 | 47 | static inline void percpu_down_read(struct percpu_rw_semaphore *sem) |
| 37 | 48 | { |
| 38 | 49 | might_sleep(); |
| 39 | 50 | |
| 40 | − rwsem_acquire_read(&sem->rw_sem.dep_map, 0, 0, _RET_IP_); | |
| 51 | + rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); | |
| 41 | 52 | |
| 42 | 53 | preempt_disable(); |
| 43 | 54 | /* |
| @@ -48,8 +59,9 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem) · 4 unmodified lines | ||
| 48 | 59 | * and that once the synchronize_rcu() is done, the writer will see |
| 49 | 60 | * anything we did within this RCU-sched read-size critical section. |
| 50 | 61 | */ |
| 51 | − __this_cpu_inc(*sem->read_count); | |
| 52 | − if (unlikely(!rcu_sync_is_idle(&sem->rss))) | |
| 62 | + if (likely(rcu_sync_is_idle(&sem->rss))) | |
| 63 | + __this_cpu_inc(*sem->read_count); | |
| 64 | + else | |
| 53 | 65 | __percpu_down_read(sem, false); /* Unconditional memory barrier */ |
| 54 | 66 | /* |
| 55 | 67 | * The preempt_enable() prevents the compiler from |
| @@ -58,16 +70,17 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem) · 2 unmodified lines | ||
| 58 | 70 | preempt_enable(); |
| 59 | 71 | } |
| 60 | 72 | |
| 61 | −static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem) | |
| 73 | +static inline bool percpu_down_read_trylock(struct percpu_rw_semaphore *sem) | |
| 62 | 74 | { |
| 63 | − int ret = 1; | |
| 75 | + bool ret = true; | |
| 64 | 76 | |
| 65 | 77 | preempt_disable(); |
| 66 | 78 | /* |
| 67 | 79 | * Same as in percpu_down_read(). |
| 68 | 80 | */ |
| 69 | − __this_cpu_inc(*sem->read_count); | |
| 70 | − if (unlikely(!rcu_sync_is_idle(&sem->rss))) | |
| 81 | + if (likely(rcu_sync_is_idle(&sem->rss))) | |
| 82 | + __this_cpu_inc(*sem->read_count); | |
| 83 | + else | |
| 71 | 84 | ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */ |
| 72 | 85 | preempt_enable(); |
| 73 | 86 | /* |
| @@ -76,24 +89,36 @@ static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem) · 2 unmodified lines | ||
| 76 | 89 | */ |
| 77 | 90 | |
| 78 | 91 | if (ret) |
| 79 | − rwsem_acquire_read(&sem->rw_sem.dep_map, 0, 1, _RET_IP_); | |
| 92 | + rwsem_acquire_read(&sem->dep_map, 0, 1, _RET_IP_); | |
| 80 | 93 | |
| 81 | 94 | return ret; |
| 82 | 95 | } |
| 83 | 96 | |
| 84 | 97 | static inline void percpu_up_read(struct percpu_rw_semaphore *sem) |
| 85 | 98 | { |
| 99 | + rwsem_release(&sem->dep_map, _RET_IP_); | |
| 100 | + | |
| 86 | 101 | preempt_disable(); |
| 87 | 102 | /* |
| 88 | 103 | * Same as in percpu_down_read(). |
| 89 | 104 | */ |
| 90 | − if (likely(rcu_sync_is_idle(&sem->rss))) | |
| 105 | + if (likely(rcu_sync_is_idle(&sem->rss))) { | |
| 91 | 106 | __this_cpu_dec(*sem->read_count); |
| 92 | − else | |
| 93 | − __percpu_up_read(sem); /* Unconditional memory barrier */ | |
| 107 | + } else { | |
| 108 | + /* | |
| 109 | + * slowpath; reader will only ever wake a single blocked | |
| 110 | + * writer. | |
| 111 | + */ | |
| 112 | + smp_mb(); /* B matches C */ | |
| 113 | + /* | |
| 114 | + * In other words, if they see our decrement (presumably to | |
| 115 | + * aggregate zero, as that is the only time it matters) they | |
| 116 | + * will also see our critical section. | |
| 117 | + */ | |
| 118 | + __this_cpu_dec(*sem->read_count); | |
| 119 | + rcuwait_wake_up(&sem->writer); | |
| 120 | + } | |
| 94 | 121 | preempt_enable(); |
| 95 | − | |
| 96 | − rwsem_release(&sem->rw_sem.dep_map, _RET_IP_); | |
| 97 | 122 | } |
| 98 | 123 | |
| 99 | 124 | extern void percpu_down_write(struct percpu_rw_semaphore *); |
| @@ -110,29 +135,19 @@ extern void percpu_free_rwsem(struct percpu_rw_semaphore *); · 10 unmodified lines | ||
| 110 | 135 | __percpu_init_rwsem(sem, #sem, &rwsem_key); \ |
| 111 | 136 | }) |
| 112 | 137 | |
| 113 | −#define percpu_rwsem_is_held(sem) lockdep_is_held(&(sem)->rw_sem) | |
| 114 | − | |
| 115 | −#define percpu_rwsem_assert_held(sem) \ | |
| 116 | − lockdep_assert_held(&(sem)->rw_sem) | |
| 138 | +#define percpu_rwsem_is_held(sem) lockdep_is_held(sem) | |
| 139 | +#define percpu_rwsem_assert_held(sem) lockdep_assert_held(sem) | |
| 117 | 140 | |
| 118 | 141 | static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem, |
| 119 | 142 | bool read, unsigned long ip) |
| 120 | 143 | { |
| 121 | − lock_release(&sem->rw_sem.dep_map, ip); | |
| 122 | −#ifdef CONFIG_RWSEM_SPIN_ON_OWNER | |
| 123 | − if (!read) | |
| 124 | − atomic_long_set(&sem->rw_sem.owner, RWSEM_OWNER_UNKNOWN); | |
| 125 | −#endif | |
| 144 | + lock_release(&sem->dep_map, ip); | |
| 126 | 145 | } |
| 127 | 146 | |
| 128 | 147 | static inline void percpu_rwsem_acquire(struct percpu_rw_semaphore *sem, |
| 129 | 148 | bool read, unsigned long ip) |
| 130 | 149 | { |
| 131 | − lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip); | |
| 132 | −#ifdef CONFIG_RWSEM_SPIN_ON_OWNER | |
| 133 | − if (!read) | |
| 134 | − atomic_long_set(&sem->rw_sem.owner, (long)current); | |
| 135 | −#endif | |
| 150 | + lock_acquire(&sem->dep_map, 0, 1, read, 1, NULL, ip); | |
| 136 | 151 | } |
| 137 | 152 | |
| 138 | 153 | #endif |
| @@ -78,9 +78,9 @@ static inline s64 percpu_counter_read(struct percpu_counter *fbc) · 77 unmodified lines | ||
| 78 | 78 | */ |
| 79 | 79 | static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc) |
| 80 | 80 | { |
| 81 | − s64 ret = fbc->count; | |
| 81 | + /* Prevent reloads of fbc->count */ | |
| 82 | + s64 ret = READ_ONCE(fbc->count); | |
| 82 | 83 | |
| 83 | − barrier(); /* Prevent reloads of fbc->count */ | |
| 84 | 84 | if (ret >= 0) |
| 85 | 85 | return ret; |
| 86 | 86 | return 0; |
| @@ -80,6 +80,7 @@ struct arm_pmu { · 79 unmodified lines | ||
| 80 | 80 | struct pmu pmu; |
| 81 | 81 | cpumask_t supported_cpus; |
| 82 | 82 | char *name; |
| 83 | + int pmuver; | |
| 83 | 84 | irqreturn_t (*handle_irq)(struct arm_pmu *pmu); |
| 84 | 85 | void (*enable)(struct perf_event *event); |
| 85 | 86 | void (*disable)(struct perf_event *event); |
| @@ -93,14 +93,26 @@ struct perf_raw_record { · 92 unmodified lines | ||
| 93 | 93 | /* |
| 94 | 94 | * branch stack layout: |
| 95 | 95 | * nr: number of taken branches stored in entries[] |
| 96 | + * hw_idx: The low level index of raw branch records | |
| 97 | + * for the most recent branch. | |
| 98 | + * -1ULL means invalid/unknown. | |
| 96 | 99 | * |
| 97 | 100 | * Note that nr can vary from sample to sample |
| 98 | 101 | * branches (to, from) are stored from most recent |
| 99 | 102 | * to least recent, i.e., entries[0] contains the most |
| 100 | 103 | * recent branch. |
| 104 | + * The entries[] is an abstraction of raw branch records, | |
| 105 | + * which may not be stored in age order in HW, e.g. Intel LBR. | |
| 106 | + * The hw_idx is to expose the low level index of raw | |
| 107 | + * branch record for the most recent branch aka entries[0]. | |
| 108 | + * The hw_idx index is between -1 (unknown) and max depth, | |
| 109 | + * which can be retrieved in /sys/devices/cpu/caps/branches. | |
| 110 | + * For the architectures whose raw branch records are | |
| 111 | + * already stored in age order, the hw_idx should be 0. | |
| 101 | 112 | */ |
| 102 | 113 | struct perf_branch_stack { |
| 103 | 114 | __u64 nr; |
| 115 | + __u64 hw_idx; | |
| 104 | 116 | struct perf_branch_entry entries[0]; |
| 105 | 117 | }; |
| 106 | 118 | |
| @@ -850,6 +862,13 @@ struct perf_cpu_context { · 743 unmodified lines | ||
| 850 | 862 | int sched_cb_usage; |
| 851 | 863 | |
| 852 | 864 | int online; |
| 865 | + /* | |
| 866 | + * Per-CPU storage for iterators used in visit_groups_merge. The default | |
| 867 | + * storage is of size 2 to hold the CPU and any CPU event iterators. | |
| 868 | + */ | |
| 869 | + int heap_size; | |
| 870 | + struct perf_event **heap; | |
| 871 | + struct perf_event *heap_default[2]; | |
| 853 | 872 | }; |
| 854 | 873 | |
| 855 | 874 | struct perf_output_handle { |
| @@ -1001,6 +1020,7 @@ struct perf_sample_data { · 145 unmodified lines | ||
| 1001 | 1020 | u64 stack_user_size; |
| 1002 | 1021 | |
| 1003 | 1022 | u64 phys_addr; |
| 1023 | + u64 cgroup; | |
| 1004 | 1024 | } ____cacheline_aligned; |
| 1005 | 1025 | |
| 1006 | 1026 | /* default value for data source */ |
| @@ -23,6 +23,8 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/workqueue.h> |
| 24 | 24 | #include <linux/mod_devicetable.h> |
| 25 | 25 | #include <linux/u64_stats_sync.h> |
| 26 | +#include <linux/irqreturn.h> | |
| 27 | +#include <linux/iopoll.h> | |
| 26 | 28 | |
| 27 | 29 | #include <linux/atomic.h> |
| 28 | 30 | |
| @@ -94,6 +96,7 @@ typedef enum { · 65 unmodified lines | ||
| 94 | 96 | PHY_INTERFACE_MODE_RTBI, |
| 95 | 97 | PHY_INTERFACE_MODE_SMII, |
| 96 | 98 | PHY_INTERFACE_MODE_XGMII, |
| 99 | + PHY_INTERFACE_MODE_XLGMII, | |
| 97 | 100 | PHY_INTERFACE_MODE_MOCA, |
| 98 | 101 | PHY_INTERFACE_MODE_QSGMII, |
| 99 | 102 | PHY_INTERFACE_MODE_TRGMII, |
| @@ -165,6 +168,8 @@ static inline const char *phy_modes(phy_interface_t interface) · 65 unmodified lines | ||
| 165 | 168 | return "smii"; |
| 166 | 169 | case PHY_INTERFACE_MODE_XGMII: |
| 167 | 170 | return "xgmii"; |
| 171 | + case PHY_INTERFACE_MODE_XLGMII: | |
| 172 | + return "xlgmii"; | |
| 168 | 173 | case PHY_INTERFACE_MODE_MOCA: |
| 169 | 174 | return "moca"; |
| 170 | 175 | case PHY_INTERFACE_MODE_QSGMII: |
| @@ -289,6 +294,7 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev) · 118 unmodified lines | ||
| 289 | 294 | return devm_mdiobus_alloc_size(dev, 0); |
| 290 | 295 | } |
| 291 | 296 | |
| 297 | +struct mii_bus *mdio_find_bus(const char *mdio_name); | |
| 292 | 298 | void devm_mdiobus_free(struct device *dev, struct mii_bus *bus); |
| 293 | 299 | struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); |
| 294 | 300 | |
| @@ -357,8 +363,10 @@ struct macsec_ops; · 62 unmodified lines | ||
| 357 | 363 | * is_gigabit_capable: Set to true if PHY supports 1000Mbps |
| 358 | 364 | * has_fixups: Set to true if this phy has fixups/quirks. |
| 359 | 365 | * suspended: Set to true if this phy has been suspended successfully. |
| 366 | + * suspended_by_mdio_bus: Set to true if this phy was suspended by MDIO bus. | |
| 360 | 367 | * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal. |
| 361 | 368 | * loopback_enabled: Set true if this phy has been loopbacked successfully. |
| 369 | + * downshifted_rate: Set true if link speed has been downshifted. | |
| 362 | 370 | * state: state of the PHY for management purposes |
| 363 | 371 | * dev_flags: Device-specific flags used by the PHY driver. |
| 364 | 372 | * irq: IRQ number of the PHY's interrupt (-1 if none) |
| @@ -396,8 +404,10 @@ struct phy_device { · 31 unmodified lines | ||
| 396 | 404 | unsigned is_gigabit_capable:1; |
| 397 | 405 | unsigned has_fixups:1; |
| 398 | 406 | unsigned suspended:1; |
| 407 | + unsigned suspended_by_mdio_bus:1; | |
| 399 | 408 | unsigned sysfs_links:1; |
| 400 | 409 | unsigned loopback_enabled:1; |
| 410 | + unsigned downshifted_rate:1; | |
| 401 | 411 | |
| 402 | 412 | unsigned autoneg:1; |
| 403 | 413 | /* The most recently read link state */ |
| @@ -557,11 +567,12 @@ struct phy_driver { · 153 unmodified lines | ||
| 557 | 567 | /* |
| 558 | 568 | * Checks if the PHY generated an interrupt. |
| 559 | 569 | * For multi-PHY devices with shared PHY interrupt pin |
| 570 | + * Set interrupt bits have to be cleared. | |
| 560 | 571 | */ |
| 561 | 572 | int (*did_interrupt)(struct phy_device *phydev); |
| 562 | 573 | |
| 563 | 574 | /* Override default interrupt handling */ |
| 564 | − int (*handle_interrupt)(struct phy_device *phydev); | |
| 575 | + irqreturn_t (*handle_interrupt)(struct phy_device *phydev); | |
| 565 | 576 | |
| 566 | 577 | /* Clears up any memory if needed */ |
| 567 | 578 | void (*remove)(struct phy_device *phydev); |
| @@ -690,6 +701,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 122 unmodified lines | ||
| 690 | 701 | |
| 691 | 702 | void phy_resolve_aneg_pause(struct phy_device *phydev); |
| 692 | 703 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); |
| 704 | +void phy_check_downshift(struct phy_device *phydev); | |
| 693 | 705 | |
| 694 | 706 | /** |
| 695 | 707 | * phy_read - Convenience function for reading a given PHY register |
| @@ -705,6 +717,19 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum) · 9 unmodified lines | ||
| 705 | 717 | return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum); |
| 706 | 718 | } |
| 707 | 719 | |
| 720 | +#define phy_read_poll_timeout(phydev, regnum, val, cond, sleep_us, \ | |
| 721 | + timeout_us, sleep_before_read) \ | |
| 722 | +({ \ | |
| 723 | + int __ret = read_poll_timeout(phy_read, val, (cond) || val < 0, \ | |
| 724 | + sleep_us, timeout_us, sleep_before_read, phydev, regnum); \ | |
| 725 | + if (val < 0) \ | |
| 726 | + __ret = val; \ | |
| 727 | + if (__ret) \ | |
| 728 | + phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \ | |
| 729 | + __ret; \ | |
| 730 | +}) | |
| 731 | + | |
| 732 | + | |
| 708 | 733 | /** |
| 709 | 734 | * __phy_read - convenience function for reading a given PHY register |
| 710 | 735 | * @phydev: the phy_device struct |
| @@ -746,6 +771,25 @@ static inline int __phy_write(struct phy_device *phydev, u32 regnum, u16 val) · 35 unmodified lines | ||
| 746 | 771 | val); |
| 747 | 772 | } |
| 748 | 773 | |
| 774 | +/** | |
| 775 | + * __phy_modify_changed() - Convenience function for modifying a PHY register | |
| 776 | + * @phydev: a pointer to a &struct phy_device | |
| 777 | + * @regnum: register number | |
| 778 | + * @mask: bit mask of bits to clear | |
| 779 | + * @set: bit mask of bits to set | |
| 780 | + * | |
| 781 | + * Unlocked helper function which allows a PHY register to be modified as | |
| 782 | + * new register value = (old register value & ~mask) | set | |
| 783 | + * | |
| 784 | + * Returns negative errno, 0 if there was no change, and 1 in case of change | |
| 785 | + */ | |
| 786 | +static inline int __phy_modify_changed(struct phy_device *phydev, u32 regnum, | |
| 787 | + u16 mask, u16 set) | |
| 788 | +{ | |
| 789 | + return __mdiobus_modify_changed(phydev->mdio.bus, phydev->mdio.addr, | |
| 790 | + regnum, mask, set); | |
| 791 | +} | |
| 792 | + | |
| 749 | 793 | /** |
| 750 | 794 | * phy_read_mmd - Convenience function for reading a register |
| 751 | 795 | * from an MMD on a given PHY. |
| @@ -757,6 +801,19 @@ static inline int __phy_write(struct phy_device *phydev, u32 regnum, u16 val) · 5 unmodified lines | ||
| 757 | 801 | */ |
| 758 | 802 | int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); |
| 759 | 803 | |
| 804 | +#define phy_read_mmd_poll_timeout(phydev, devaddr, regnum, val, cond, \ | |
| 805 | + sleep_us, timeout_us, sleep_before_read) \ | |
| 806 | +({ \ | |
| 807 | + int __ret = read_poll_timeout(phy_read_mmd, val, (cond) || val < 0, \ | |
| 808 | + sleep_us, timeout_us, sleep_before_read, \ | |
| 809 | + phydev, devaddr, regnum); \ | |
| 810 | + if (val < 0) \ | |
| 811 | + __ret = val; \ | |
| 812 | + if (__ret) \ | |
| 813 | + phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \ | |
| 814 | + __ret; \ | |
| 815 | +}) | |
| 816 | + | |
| 760 | 817 | /** |
| 761 | 818 | * __phy_read_mmd - Convenience function for reading a register |
| 762 | 819 | * from an MMD on a given PHY. |
| @@ -1257,6 +1314,9 @@ void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx, · 494 unmodified lines | ||
| 1257 | 1314 | void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx); |
| 1258 | 1315 | bool phy_validate_pause(struct phy_device *phydev, |
| 1259 | 1316 | struct ethtool_pauseparam *pp); |
| 1317 | +void phy_get_pause(struct phy_device *phydev, bool *tx_pause, bool *rx_pause); | |
| 1318 | +void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_adv, | |
| 1319 | + bool *tx_pause, bool *rx_pause); | |
| 1260 | 1320 | |
| 1261 | 1321 | int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask, |
| 1262 | 1322 | int (*run)(struct phy_device *)); |
| @@ -21,4 +21,6 @@ int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl, · 20 unmodified lines | ||
| 21 | 21 | int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl, |
| 22 | 22 | bool val); |
| 23 | 23 | int tegra_phy_xusb_utmi_port_reset(struct phy *phy); |
| 24 | +int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl, | |
| 25 | + unsigned int port); | |
| 24 | 26 | #endif /* PHY_TEGRA_XUSB_H */ |
| @@ -12,12 +12,10 @@ struct net_device; · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | enum { |
| 14 | 14 | MLO_PAUSE_NONE, |
| 15 | − MLO_PAUSE_ASYM = BIT(0), | |
| 16 | − MLO_PAUSE_SYM = BIT(1), | |
| 17 | − MLO_PAUSE_RX = BIT(2), | |
| 18 | − MLO_PAUSE_TX = BIT(3), | |
| 15 | + MLO_PAUSE_RX = BIT(0), | |
| 16 | + MLO_PAUSE_TX = BIT(1), | |
| 19 | 17 | MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX, |
| 20 | − MLO_PAUSE_AN = BIT(4), | |
| 18 | + MLO_PAUSE_AN = BIT(2), | |
| 21 | 19 | |
| 22 | 20 | MLO_AN_PHY = 0, /* Conventional PHY */ |
| 23 | 21 | MLO_AN_FIXED, /* Fixed-link mode */ |
| @@ -93,9 +91,10 @@ struct phylink_mac_ops { · 69 unmodified lines | ||
| 93 | 91 | void (*mac_an_restart)(struct phylink_config *config); |
| 94 | 92 | void (*mac_link_down)(struct phylink_config *config, unsigned int mode, |
| 95 | 93 | phy_interface_t interface); |
| 96 | − void (*mac_link_up)(struct phylink_config *config, unsigned int mode, | |
| 97 | − phy_interface_t interface, | |
| 98 | − struct phy_device *phy); | |
| 94 | + void (*mac_link_up)(struct phylink_config *config, | |
| 95 | + struct phy_device *phy, unsigned int mode, | |
| 96 | + phy_interface_t interface, int speed, int duplex, | |
| 97 | + bool tx_pause, bool rx_pause); | |
| 99 | 98 | }; |
| 100 | 99 | |
| 101 | 100 | #if 0 /* For kernel-doc purposes only. */ |
| @@ -154,15 +153,33 @@ void mac_pcs_get_state(struct phylink_config *config, · 52 unmodified lines | ||
| 154 | 153 | * guaranteed to be correct, and so any mac_config() implementation must |
| 155 | 154 | * never reference these fields. |
| 156 | 155 | * |
| 156 | + * (this requires a rewrite - please refer to mac_link_up() for situations | |
| 157 | + * where the PCS and MAC are not tightly integrated.) | |
| 158 | + * | |
| 159 | + * In all negotiation modes, as defined by @mode, @state->pause indicates the | |
| 160 | + * pause settings which should be applied as follows. If %MLO_PAUSE_AN is not | |
| 161 | + * set, %MLO_PAUSE_TX and %MLO_PAUSE_RX indicate whether the MAC should send | |
| 162 | + * pause frames and/or act on received pause frames respectively. Otherwise, | |
| 163 | + * the results of in-band negotiation/status from the MAC PCS should be used | |
| 164 | + * to control the MAC pause mode settings. | |
| 165 | + * | |
| 157 | 166 | * The action performed depends on the currently selected mode: |
| 158 | 167 | * |
| 159 | 168 | * %MLO_AN_FIXED, %MLO_AN_PHY: |
| 160 | − * Configure the specified @state->speed, @state->duplex and | |
| 161 | − * @state->pause (%MLO_PAUSE_TX / %MLO_PAUSE_RX) modes over a link | |
| 162 | − * specified by @state->interface. @state->advertising may be used, | |
| 163 | − * but is not required. Other members of @state must be ignored. | |
| 169 | + * Configure for non-inband negotiation mode, where the link settings | |
| 170 | + * are completely communicated via mac_link_up(). The physical link | |
| 171 | + * protocol from the MAC is specified by @state->interface. | |
| 172 | + * | |
| 173 | + * @state->advertising may be used, but is not required. | |
| 174 | + * | |
| 175 | + * Older drivers (prior to the mac_link_up() change) may use @state->speed, | |
| 176 | + * @state->duplex and @state->pause to configure the MAC, but this is | |
| 177 | + * deprecated; such drivers should be converted to use mac_link_up(). | |
| 164 | 178 | * |
| 165 | − * Valid state members: interface, speed, duplex, pause, advertising. | |
| 179 | + * Other members of @state must be ignored. | |
| 180 | + * | |
| 181 | + * Valid state members: interface, advertising. | |
| 182 | + * Deprecated state members: speed, duplex, pause. | |
| 166 | 183 | * |
| 167 | 184 | * %MLO_AN_INBAND: |
| 168 | 185 | * place the link in an inband negotiation mode (such as 802.3z |
| @@ -172,11 +189,14 @@ void mac_pcs_get_state(struct phylink_config *config, · 3 unmodified lines | ||
| 172 | 189 | * mac_pcs_get_state() callback. Changes in link state must be made |
| 173 | 190 | * by calling phylink_mac_change(). |
| 174 | 191 | * |
| 192 | + * Interface mode specific details are mentioned below. | |
| 193 | + * | |
| 175 | 194 | * If in 802.3z mode, the link speed is fixed, dependent on the |
| 176 | − * @state->interface. Duplex is negotiated, and pause is advertised | |
| 177 | − * according to @state->an_enabled, @state->pause and | |
| 178 | − * @state->advertising flags. Beware of MACs which only support full | |
| 179 | − * duplex at gigabit and higher speeds. | |
| 195 | + * @state->interface. Duplex and pause modes are negotiated via | |
| 196 | + * the in-band configuration word. Advertised pause modes are set | |
| 197 | + * according to the @state->an_enabled and @state->advertising | |
| 198 | + * flags. Beware of MACs which only support full duplex at gigabit | |
| 199 | + * and higher speeds. | |
| 180 | 200 | * |
| 181 | 201 | * If in Cisco SGMII mode, the link speed and duplex mode are passed |
| 182 | 202 | * in the serial bitstream 16-bit configuration word, and the MAC |
| @@ -220,24 +240,127 @@ void mac_link_down(struct phylink_config *config, unsigned int mode, · 37 unmodified lines | ||
| 220 | 240 | /** |
| 221 | 241 | * mac_link_up() - allow the link to come up |
| 222 | 242 | * @config: a pointer to a &struct phylink_config. |
| 243 | + * @phy: any attached phy | |
| 223 | 244 | * @mode: link autonegotiation mode |
| 224 | 245 | * @interface: link &typedef phy_interface_t mode |
| 225 | − * @phy: any attached phy | |
| 246 | + * @speed: link speed | |
| 247 | + * @duplex: link duplex | |
| 248 | + * @tx_pause: link transmit pause enablement status | |
| 249 | + * @rx_pause: link receive pause enablement status | |
| 226 | 250 | * |
| 227 | − * If @mode is not an in-band negotiation mode (as defined by | |
| 228 | − * phylink_autoneg_inband()), allow the link to come up. If @phy | |
| 229 | − * is non-%NULL, configure Energy Efficient Ethernet by calling | |
| 251 | + * Configure the MAC for an established link. | |
| 252 | + * | |
| 253 | + * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link | |
| 254 | + * settings, and should be used to configure the MAC block appropriately | |
| 255 | + * where these settings are not automatically conveyed from the PCS block, | |
| 256 | + * or if in-band negotiation (as defined by phylink_autoneg_inband(@mode)) | |
| 257 | + * is disabled. | |
| 258 | + * | |
| 259 | + * Note that when 802.3z in-band negotiation is in use, it is possible | |
| 260 | + * that the user wishes to override the pause settings, and this should | |
| 261 | + * be allowed when considering the implementation of this method. | |
| 262 | + * | |
| 263 | + * If in-band negotiation mode is disabled, allow the link to come up. If | |
| 264 | + * @phy is non-%NULL, configure Energy Efficient Ethernet by calling | |
| 230 | 265 | * phy_init_eee() and perform appropriate MAC configuration for EEE. |
| 231 | 266 | * Interface type selection must be done in mac_config(). |
| 232 | 267 | */ |
| 233 | −void mac_link_up(struct phylink_config *config, unsigned int mode, | |
| 234 | − phy_interface_t interface, | |
| 235 | − struct phy_device *phy); | |
| 268 | +void mac_link_up(struct phylink_config *config, struct phy_device *phy, | |
| 269 | + unsigned int mode, phy_interface_t interface, | |
| 270 | + int speed, int duplex, bool tx_pause, bool rx_pause); | |
| 271 | +#endif | |
| 272 | + | |
| 273 | +/** | |
| 274 | + * struct phylink_pcs_ops - MAC PCS operations structure. | |
| 275 | + * @pcs_get_state: read the current MAC PCS link state from the hardware. | |
| 276 | + * @pcs_config: configure the MAC PCS for the selected mode and state. | |
| 277 | + * @pcs_an_restart: restart 802.3z BaseX autonegotiation. | |
| 278 | + * @pcs_link_up: program the PCS for the resolved link configuration | |
| 279 | + * (where necessary). | |
| 280 | + */ | |
| 281 | +struct phylink_pcs_ops { | |
| 282 | + void (*pcs_get_state)(struct phylink_config *config, | |
| 283 | + struct phylink_link_state *state); | |
| 284 | + int (*pcs_config)(struct phylink_config *config, unsigned int mode, | |
| 285 | + phy_interface_t interface, | |
| 286 | + const unsigned long *advertising); | |
| 287 | + void (*pcs_an_restart)(struct phylink_config *config); | |
| 288 | + void (*pcs_link_up)(struct phylink_config *config, unsigned int mode, | |
| 289 | + phy_interface_t interface, int speed, int duplex); | |
| 290 | +}; | |
| 291 | + | |
| 292 | +#if 0 /* For kernel-doc purposes only. */ | |
| 293 | +/** | |
| 294 | + * pcs_get_state() - Read the current inband link state from the hardware | |
| 295 | + * @config: a pointer to a &struct phylink_config. | |
| 296 | + * @state: a pointer to a &struct phylink_link_state. | |
| 297 | + * | |
| 298 | + * Read the current inband link state from the MAC PCS, reporting the | |
| 299 | + * current speed in @state->speed, duplex mode in @state->duplex, pause | |
| 300 | + * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits, | |
| 301 | + * negotiation completion state in @state->an_complete, and link up state | |
| 302 | + * in @state->link. If possible, @state->lp_advertising should also be | |
| 303 | + * populated. | |
| 304 | + * | |
| 305 | + * When present, this overrides mac_pcs_get_state() in &struct | |
| 306 | + * phylink_mac_ops. | |
| 307 | + */ | |
| 308 | +void pcs_get_state(struct phylink_config *config, | |
| 309 | + struct phylink_link_state *state); | |
| 310 | + | |
| 311 | +/** | |
| 312 | + * pcs_config() - Configure the PCS mode and advertisement | |
| 313 | + * @config: a pointer to a &struct phylink_config. | |
| 314 | + * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. | |
| 315 | + * @interface: interface mode to be used | |
| 316 | + * @advertising: adertisement ethtool link mode mask | |
| 317 | + * | |
| 318 | + * Configure the PCS for the operating mode, the interface mode, and set | |
| 319 | + * the advertisement mask. | |
| 320 | + * | |
| 321 | + * When operating in %MLO_AN_INBAND, inband should always be enabled, | |
| 322 | + * otherwise inband should be disabled. | |
| 323 | + * | |
| 324 | + * For SGMII, there is no advertisement from the MAC side, the PCS should | |
| 325 | + * be programmed to acknowledge the inband word from the PHY. | |
| 326 | + * | |
| 327 | + * For 1000BASE-X, the advertisement should be programmed into the PCS. | |
| 328 | + * | |
| 329 | + * For most 10GBASE-R, there is no advertisement. | |
| 330 | + */ | |
| 331 | +int (*pcs_config)(struct phylink_config *config, unsigned int mode, | |
| 332 | + phy_interface_t interface, const unsigned long *advertising); | |
| 333 | + | |
| 334 | +/** | |
| 335 | + * pcs_an_restart() - restart 802.3z BaseX autonegotiation | |
| 336 | + * @config: a pointer to a &struct phylink_config. | |
| 337 | + * | |
| 338 | + * When PCS ops are present, this overrides mac_an_restart() in &struct | |
| 339 | + * phylink_mac_ops. | |
| 340 | + */ | |
| 341 | +void (*pcs_an_restart)(struct phylink_config *config); | |
| 342 | + | |
| 343 | +/** | |
| 344 | + * pcs_link_up() - program the PCS for the resolved link configuration | |
| 345 | + * @config: a pointer to a &struct phylink_config. | |
| 346 | + * @mode: link autonegotiation mode | |
| 347 | + * @interface: link &typedef phy_interface_t mode | |
| 348 | + * @speed: link speed | |
| 349 | + * @duplex: link duplex | |
| 350 | + * | |
| 351 | + * This call will be made just before mac_link_up() to inform the PCS of | |
| 352 | + * the resolved link parameters. For example, a PCS operating in SGMII | |
| 353 | + * mode without in-band AN needs to be manually configured for the link | |
| 354 | + * and duplex setting. Otherwise, this should be a no-op. | |
| 355 | + */ | |
| 356 | +void (*pcs_link_up)(struct phylink_config *config, unsigned int mode, | |
| 357 | + phy_interface_t interface, int speed, int duplex); | |
| 236 | 358 | #endif |
| 237 | 359 | |
| 238 | 360 | struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *, |
| 239 | 361 | phy_interface_t iface, |
| 240 | − const struct phylink_mac_ops *ops); | |
| 362 | + const struct phylink_mac_ops *mac_ops); | |
| 363 | +void phylink_add_pcs(struct phylink *, const struct phylink_pcs_ops *ops); | |
| 241 | 364 | void phylink_destroy(struct phylink *); |
| 242 | 365 | |
| 243 | 366 | int phylink_connect_phy(struct phylink *, struct phy_device *); |
| @@ -282,4 +405,13 @@ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int); · 38 unmodified lines | ||
| 282 | 405 | void phylink_set_port_modes(unsigned long *bits); |
| 283 | 406 | void phylink_helper_basex_speed(struct phylink_link_state *state); |
| 284 | 407 | |
| 408 | +void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, | |
| 409 | + struct phylink_link_state *state); | |
| 410 | +int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs, | |
| 411 | + phy_interface_t interface, | |
| 412 | + const unsigned long *advertising); | |
| 413 | +void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs); | |
| 414 | + | |
| 415 | +void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs, | |
| 416 | + struct phylink_link_state *state); | |
| 285 | 417 | #endif |
| @@ -60,8 +60,10 @@ struct pid · 59 unmodified lines | ||
| 60 | 60 | { |
| 61 | 61 | refcount_t count; |
| 62 | 62 | unsigned int level; |
| 63 | + spinlock_t lock; | |
| 63 | 64 | /* lists of tasks that use this pid */ |
| 64 | 65 | struct hlist_head tasks[PIDTYPE_MAX]; |
| 66 | + struct hlist_head inodes; | |
| 65 | 67 | /* wait queue for pidfd notifications */ |
| 66 | 68 | wait_queue_head_t wait_pidfd; |
| 67 | 69 | struct rcu_head rcu; |
| @@ -33,7 +33,6 @@ struct pid_namespace { · 32 unmodified lines | ||
| 33 | 33 | unsigned int level; |
| 34 | 34 | struct pid_namespace *parent; |
| 35 | 35 | #ifdef CONFIG_PROC_FS |
| 36 | − struct vfsmount *proc_mnt; | |
| 37 | 36 | struct dentry *proc_self; |
| 38 | 37 | struct dentry *proc_thread_self; |
| 39 | 38 | #endif |
| @@ -42,7 +41,6 @@ struct pid_namespace { · 2 unmodified lines | ||
| 42 | 41 | #endif |
| 43 | 42 | struct user_namespace *user_ns; |
| 44 | 43 | struct ucounts *ucounts; |
| 45 | − struct work_struct proc_work; | |
| 46 | 44 | kgid_t pid_gid; |
| 47 | 45 | int hide_pid; |
| 48 | 46 | int reboot; /* group exit code if this pidns was rebooted */ |
| @@ -186,7 +186,7 @@ extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev, · 185 unmodified lines | ||
| 186 | 186 | const char *pin_group, const unsigned **pins, |
| 187 | 187 | unsigned *num_pins); |
| 188 | 188 | |
| 189 | −#ifdef CONFIG_OF | |
| 189 | +#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL) | |
| 190 | 190 | extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np); |
| 191 | 191 | #else |
| 192 | 192 | static inline |
| @@ -125,6 +125,9 @@ struct cros_ec_command { · 124 unmodified lines | ||
| 125 | 125 | * @host_event_wake_mask: Mask of host events that cause wake from suspend. |
| 126 | 126 | * @last_event_time: exact time from the hard irq when we got notified of |
| 127 | 127 | * a new event. |
| 128 | + * @notifier_ready: The notifier_block to let the kernel re-query EC | |
| 129 | + * communication protocol when the EC sends | |
| 130 | + * EC_HOST_EVENT_INTERFACE_READY. | |
| 128 | 131 | * @ec: The platform_device used by the mfd driver to interface with the |
| 129 | 132 | * main EC. |
| 130 | 133 | * @pd: The platform_device used by the mfd driver to interface with the |
| @@ -166,6 +169,7 @@ struct cros_ec_device { · 35 unmodified lines | ||
| 166 | 169 | u32 host_event_wake_mask; |
| 167 | 170 | u32 last_resume_result; |
| 168 | 171 | ktime_t last_event_time; |
| 172 | + struct notifier_block notifier_ready; | |
| 169 | 173 | |
| 170 | 174 | /* The platform devices used by the mfd driver */ |
| 171 | 175 | struct platform_device *ec; |
| @@ -8,8 +8,13 @@ · 7 unmodified lines | ||
| 8 | 8 | #ifndef __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H |
| 9 | 9 | #define __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H |
| 10 | 10 | |
| 11 | +#include <linux/ktime.h> | |
| 12 | +#include <linux/mutex.h> | |
| 13 | +#include <linux/notifier.h> | |
| 11 | 14 | #include <linux/platform_data/cros_ec_commands.h> |
| 12 | 15 | |
| 16 | +struct iio_dev; | |
| 17 | + | |
| 13 | 18 | /** |
| 14 | 19 | * struct cros_ec_sensor_platform - ChromeOS EC sensor platform information. |
| 15 | 20 | * @sensor_num: Id of the sensor, as reported by the EC. |
| @@ -19,12 +24,170 @@ struct cros_ec_sensor_platform { · 3 unmodified lines | ||
| 19 | 24 | }; |
| 20 | 25 | |
| 21 | 26 | /** |
| 27 | + * typedef cros_ec_sensorhub_push_data_cb_t - Callback function to send datum | |
| 28 | + * to specific sensors. | |
| 29 | + * | |
| 30 | + * @indio_dev: The IIO device that will process the sample. | |
| 31 | + * @data: Vector array of the ring sample. | |
| 32 | + * @timestamp: Timestamp in host timespace when the sample was acquired by | |
| 33 | + * the EC. | |
| 34 | + */ | |
| 35 | +typedef int (*cros_ec_sensorhub_push_data_cb_t)(struct iio_dev *indio_dev, | |
| 36 | + s16 *data, | |
| 37 | + s64 timestamp); | |
| 38 | + | |
| 39 | +struct cros_ec_sensorhub_sensor_push_data { | |
| 40 | + struct iio_dev *indio_dev; | |
| 41 | + cros_ec_sensorhub_push_data_cb_t push_data_cb; | |
| 42 | +}; | |
| 43 | + | |
| 44 | +enum { | |
| 45 | + CROS_EC_SENSOR_LAST_TS, | |
| 46 | + CROS_EC_SENSOR_NEW_TS, | |
| 47 | + CROS_EC_SENSOR_ALL_TS | |
| 48 | +}; | |
| 49 | + | |
| 50 | +struct cros_ec_sensors_ring_sample { | |
| 51 | + u8 sensor_id; | |
| 52 | + u8 flag; | |
| 53 | + s16 vector[3]; | |
| 54 | + s64 timestamp; | |
| 55 | +} __packed; | |
| 56 | + | |
| 57 | +/* State used for cros_ec_ring_fix_overflow */ | |
| 58 | +struct cros_ec_sensors_ec_overflow_state { | |
| 59 | + s64 offset; | |
| 60 | + s64 last; | |
| 61 | +}; | |
| 62 | + | |
| 63 | +/* Length of the filter, how long to remember entries for */ | |
| 64 | +#define CROS_EC_SENSORHUB_TS_HISTORY_SIZE 64 | |
| 65 | + | |
| 66 | +/** | |
| 67 | + * struct cros_ec_sensors_ts_filter_state - Timestamp filetr state. | |
| 68 | + * | |
| 69 | + * @x_offset: x is EC interrupt time. x_offset its last value. | |
| 70 | + * @y_offset: y is the difference between AP and EC time, y_offset its last | |
| 71 | + * value. | |
| 72 | + * @x_history: The past history of x, relative to x_offset. | |
| 73 | + * @y_history: The past history of y, relative to y_offset. | |
| 74 | + * @m_history: rate between y and x. | |
| 75 | + * @history_len: Amount of valid historic data in the arrays. | |
| 76 | + * @temp_buf: Temporary buffer used when updating the filter. | |
| 77 | + * @median_m: median value of m_history | |
| 78 | + * @median_error: final error to apply to AP interrupt timestamp to get the | |
| 79 | + * "true timestamp" the event occurred. | |
| 80 | + */ | |
| 81 | +struct cros_ec_sensors_ts_filter_state { | |
| 82 | + s64 x_offset, y_offset; | |
| 83 | + s64 x_history[CROS_EC_SENSORHUB_TS_HISTORY_SIZE]; | |
| 84 | + s64 y_history[CROS_EC_SENSORHUB_TS_HISTORY_SIZE]; | |
| 85 | + s64 m_history[CROS_EC_SENSORHUB_TS_HISTORY_SIZE]; | |
| 86 | + int history_len; | |
| 87 | + | |
| 88 | + s64 temp_buf[CROS_EC_SENSORHUB_TS_HISTORY_SIZE]; | |
| 89 | + | |
| 90 | + s64 median_m; | |
| 91 | + s64 median_error; | |
| 92 | +}; | |
| 93 | + | |
| 94 | +/* struct cros_ec_sensors_ts_batch_state - State of batch of a single sensor. | |
| 95 | + * | |
| 96 | + * Use to store information to batch data using median fileter information. | |
| 97 | + * | |
| 98 | + * @penul_ts: last but one batch timestamp (penultimate timestamp). | |
| 99 | + * Used for timestamp spreading calculations | |
| 100 | + * when a batch shows up. | |
| 101 | + * @penul_len: last but one batch length. | |
| 102 | + * @last_ts: Last batch timestam. | |
| 103 | + * @last_len: Last batch length. | |
| 104 | + * @newest_sensor_event: Last sensor timestamp. | |
| 105 | + */ | |
| 106 | +struct cros_ec_sensors_ts_batch_state { | |
| 107 | + s64 penul_ts; | |
| 108 | + int penul_len; | |
| 109 | + s64 last_ts; | |
| 110 | + int last_len; | |
| 111 | + s64 newest_sensor_event; | |
| 112 | +}; | |
| 113 | + | |
| 114 | +/* | |
| 22 | 115 | * struct cros_ec_sensorhub - Sensor Hub device data. |
| 23 | 116 | * |
| 117 | + * @dev: Device object, mostly used for logging. | |
| 24 | 118 | * @ec: Embedded Controller where the hub is located. |
| 119 | + * @sensor_num: Number of MEMS sensors present in the EC. | |
| 120 | + * @msg: Structure to send FIFO requests. | |
| 121 | + * @params: Pointer to parameters in msg. | |
| 122 | + * @resp: Pointer to responses in msg. | |
| 123 | + * @cmd_lock : Lock for sending msg. | |
| 124 | + * @notifier: Notifier to kick the FIFO interrupt. | |
| 125 | + * @ring: Preprocessed ring to store events. | |
| 126 | + * @fifo_timestamp: Array for event timestamp and spreading. | |
| 127 | + * @fifo_info: Copy of FIFO information coming from the EC. | |
| 128 | + * @fifo_size: Size of the ring. | |
| 129 | + * @batch_state: Per sensor information of the last batches received. | |
| 130 | + * @overflow_a: For handling timestamp overflow for a time (sensor events) | |
| 131 | + * @overflow_b: For handling timestamp overflow for b time (ec interrupts) | |
| 132 | + * @filter: Medium fileter structure. | |
| 133 | + * @tight_timestamps: Set to truen when EC support tight timestamping: | |
| 134 | + * The timestamps reported from the EC have low jitter. | |
| 135 | + * Timestamps also come before every sample. Set either | |
| 136 | + * by feature bits coming from the EC or userspace. | |
| 137 | + * @future_timestamp_count: Statistics used to compute shaved time. | |
| 138 | + * This occurs when timestamp interpolation from EC | |
| 139 | + * time to AP time accidentally puts timestamps in | |
| 140 | + * the future. These timestamps are clamped to | |
| 141 | + * `now` and these count/total_ns maintain the | |
| 142 | + * statistics for how much time was removed in a | |
| 143 | + * given period. | |
| 144 | + * @future_timestamp_total_ns: Total amount of time shaved. | |
| 145 | + * @push_data: Array of callback to send datums to iio sensor object. | |
| 25 | 146 | */ |
| 26 | 147 | struct cros_ec_sensorhub { |
| 148 | + struct device *dev; | |
| 27 | 149 | struct cros_ec_dev *ec; |
| 150 | + int sensor_num; | |
| 151 | + | |
| 152 | + struct cros_ec_command *msg; | |
| 153 | + struct ec_params_motion_sense *params; | |
| 154 | + struct ec_response_motion_sense *resp; | |
| 155 | + struct mutex cmd_lock; /* Lock for protecting msg structure. */ | |
| 156 | + | |
| 157 | + struct notifier_block notifier; | |
| 158 | + | |
| 159 | + struct cros_ec_sensors_ring_sample *ring; | |
| 160 | + | |
| 161 | + ktime_t fifo_timestamp[CROS_EC_SENSOR_ALL_TS]; | |
| 162 | + struct ec_response_motion_sense_fifo_info *fifo_info; | |
| 163 | + int fifo_size; | |
| 164 | + | |
| 165 | + struct cros_ec_sensors_ts_batch_state *batch_state; | |
| 166 | + | |
| 167 | + struct cros_ec_sensors_ec_overflow_state overflow_a; | |
| 168 | + struct cros_ec_sensors_ec_overflow_state overflow_b; | |
| 169 | + | |
| 170 | + struct cros_ec_sensors_ts_filter_state filter; | |
| 171 | + | |
| 172 | + int tight_timestamps; | |
| 173 | + | |
| 174 | + s32 future_timestamp_count; | |
| 175 | + s64 future_timestamp_total_ns; | |
| 176 | + | |
| 177 | + struct cros_ec_sensorhub_sensor_push_data *push_data; | |
| 28 | 178 | }; |
| 29 | 179 | |
| 180 | +int cros_ec_sensorhub_register_push_data(struct cros_ec_sensorhub *sensorhub, | |
| 181 | + u8 sensor_num, | |
| 182 | + struct iio_dev *indio_dev, | |
| 183 | + cros_ec_sensorhub_push_data_cb_t cb); | |
| 184 | + | |
| 185 | +void cros_ec_sensorhub_unregister_push_data(struct cros_ec_sensorhub *sensorhub, | |
| 186 | + u8 sensor_num); | |
| 187 | + | |
| 188 | +int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub); | |
| 189 | +void cros_ec_sensorhub_ring_remove(void *arg); | |
| 190 | +int cros_ec_sensorhub_ring_fifo_enable(struct cros_ec_sensorhub *sensorhub, | |
| 191 | + bool on); | |
| 192 | + | |
| 30 | 193 | #endif /* __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H */ |
| @@ -0,0 +1,17 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +/* | |
| 3 | + * ChromeOS EC Power Delivery Notifier Driver | |
| 4 | + * | |
| 5 | + * Copyright 2020 Google LLC | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __LINUX_PLATFORM_DATA_CROS_USBPD_NOTIFY_H | |
| 9 | +#define __LINUX_PLATFORM_DATA_CROS_USBPD_NOTIFY_H | |
| 10 | + | |
| 11 | +#include <linux/notifier.h> | |
| 12 | + | |
| 13 | +int cros_usbpd_register_notify(struct notifier_block *nb); | |
| 14 | + | |
| 15 | +void cros_usbpd_unregister_notify(struct notifier_block *nb); | |
| 16 | + | |
| 17 | +#endif /* __LINUX_PLATFORM_DATA_CROS_USBPD_NOTIFY_H */ | |
| @@ -30,12 +30,12 @@ struct omap_dm_timer_ops { · 29 unmodified lines | ||
| 30 | 30 | int (*stop)(struct omap_dm_timer *timer); |
| 31 | 31 | int (*set_source)(struct omap_dm_timer *timer, int source); |
| 32 | 32 | |
| 33 | − int (*set_load)(struct omap_dm_timer *timer, int autoreload, | |
| 34 | − unsigned int value); | |
| 33 | + int (*set_load)(struct omap_dm_timer *timer, unsigned int value); | |
| 35 | 34 | int (*set_match)(struct omap_dm_timer *timer, int enable, |
| 36 | 35 | unsigned int match); |
| 37 | 36 | int (*set_pwm)(struct omap_dm_timer *timer, int def_on, |
| 38 | − int toggle, int trigger); | |
| 37 | + int toggle, int trigger, int autoreload); | |
| 38 | + int (*get_pwm_status)(struct omap_dm_timer *timer); | |
| 39 | 39 | int (*set_prescaler)(struct omap_dm_timer *timer, int prescaler); |
| 40 | 40 | |
| 41 | 41 | unsigned int (*read_counter)(struct omap_dm_timer *timer); |
| @@ -1,38 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Platform data structure for Network Space v2 LED driver | |
| 3 | − * | |
| 4 | − * This file is licensed under the terms of the GNU General Public | |
| 5 | − * License version 2. This program is licensed "as is" without any | |
| 6 | − * warranty of any kind, whether express or implied. | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#ifndef __LEDS_KIRKWOOD_NS2_H | |
| 10 | −#define __LEDS_KIRKWOOD_NS2_H | |
| 11 | − | |
| 12 | −enum ns2_led_modes { | |
| 13 | − NS_V2_LED_OFF, | |
| 14 | − NS_V2_LED_ON, | |
| 15 | − NS_V2_LED_SATA, | |
| 16 | −}; | |
| 17 | − | |
| 18 | −struct ns2_led_modval { | |
| 19 | − enum ns2_led_modes mode; | |
| 20 | − int cmd_level; | |
| 21 | − int slow_level; | |
| 22 | −}; | |
| 23 | − | |
| 24 | −struct ns2_led { | |
| 25 | − const char *name; | |
| 26 | − const char *default_trigger; | |
| 27 | − unsigned cmd; | |
| 28 | − unsigned slow; | |
| 29 | − int num_modes; | |
| 30 | − struct ns2_led_modval *modval; | |
| 31 | −}; | |
| 32 | − | |
| 33 | −struct ns2_led_platform_data { | |
| 34 | − int num_leds; | |
| 35 | − struct ns2_led *leds; | |
| 36 | −}; | |
| 37 | − | |
| 38 | −#endif /* __LEDS_KIRKWOOD_NS2_H */ | |
| @@ -37,5 +37,6 @@ struct esdhc_platform_data { · 36 unmodified lines | ||
| 37 | 37 | unsigned int delay_line; |
| 38 | 38 | unsigned int tuning_step; /* The delay cell steps in tuning procedure */ |
| 39 | 39 | unsigned int tuning_start_tap; /* The start delay cell point in tuning procedure */ |
| 40 | + unsigned int strobe_dll_delay_target; /* The delay cell for strobe pad (read clock) */ | |
| 40 | 41 | }; |
| 41 | 42 | #endif /* __ASM_ARCH_IMX_ESDHC_H */ |
| @@ -46,9 +46,13 @@ struct am33xx_pm_sram_addr { · 45 unmodified lines | ||
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | struct am33xx_pm_platform_data { |
| 49 | − int (*init)(void); | |
| 49 | + int (*init)(int (*idle)(u32 wfi_flags)); | |
| 50 | + int (*deinit)(void); | |
| 50 | 51 | int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long), |
| 51 | 52 | unsigned long args); |
| 53 | + int (*cpu_suspend)(int (*fn)(unsigned long), unsigned long args); | |
| 54 | + void (*begin_suspend)(void); | |
| 55 | + void (*finish_suspend)(void); | |
| 52 | 56 | struct am33xx_pm_sram_addr *(*get_sram_addrs)(void); |
| 53 | 57 | void __iomem *(*get_rtc_base_addr)(void); |
| 54 | 58 | void (*save_context)(void); |
| @@ -1,90 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * include/linux/platform_data/pwm_omap_dmtimer.h | |
| 3 | − * | |
| 4 | − * OMAP Dual-Mode Timer PWM platform data | |
| 5 | − * | |
| 6 | − * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | |
| 7 | − * Tarun Kanti DebBarma <tarun.kanti@ti.com> | |
| 8 | − * Thara Gopinath <thara@ti.com> | |
| 9 | − * | |
| 10 | − * Platform device conversion and hwmod support. | |
| 11 | − * | |
| 12 | − * Copyright (C) 2005 Nokia Corporation | |
| 13 | − * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com> | |
| 14 | − * PWM and clock framework support by Timo Teras. | |
| 15 | − * | |
| 16 | − * This program is free software; you can redistribute it and/or modify it | |
| 17 | − * under the terms of the GNU General Public License as published by the | |
| 18 | − * Free Software Foundation; either version 2 of the License, or (at your | |
| 19 | − * option) any later version. | |
| 20 | − * | |
| 21 | − * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
| 22 | − * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
| 23 | − * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | |
| 24 | − * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 25 | − * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 26 | − * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 | − * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 28 | − * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | − * | |
| 30 | − * You should have received a copy of the GNU General Public License along | |
| 31 | − * with this program; if not, write to the Free Software Foundation, Inc., | |
| 32 | − * 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 33 | − */ | |
| 34 | − | |
| 35 | −#ifndef __PWM_OMAP_DMTIMER_PDATA_H | |
| 36 | −#define __PWM_OMAP_DMTIMER_PDATA_H | |
| 37 | − | |
| 38 | −/* clock sources */ | |
| 39 | −#define PWM_OMAP_DMTIMER_SRC_SYS_CLK 0x00 | |
| 40 | −#define PWM_OMAP_DMTIMER_SRC_32_KHZ 0x01 | |
| 41 | −#define PWM_OMAP_DMTIMER_SRC_EXT_CLK 0x02 | |
| 42 | − | |
| 43 | −/* timer interrupt enable bits */ | |
| 44 | −#define PWM_OMAP_DMTIMER_INT_CAPTURE (1 << 2) | |
| 45 | −#define PWM_OMAP_DMTIMER_INT_OVERFLOW (1 << 1) | |
| 46 | −#define PWM_OMAP_DMTIMER_INT_MATCH (1 << 0) | |
| 47 | − | |
| 48 | −/* trigger types */ | |
| 49 | −#define PWM_OMAP_DMTIMER_TRIGGER_NONE 0x00 | |
| 50 | −#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW 0x01 | |
| 51 | −#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02 | |
| 52 | − | |
| 53 | −struct omap_dm_timer; | |
| 54 | −typedef struct omap_dm_timer pwm_omap_dmtimer; | |
| 55 | − | |
| 56 | −struct pwm_omap_dmtimer_pdata { | |
| 57 | − pwm_omap_dmtimer *(*request_by_node)(struct device_node *np); | |
| 58 | − pwm_omap_dmtimer *(*request_specific)(int timer_id); | |
| 59 | − pwm_omap_dmtimer *(*request)(void); | |
| 60 | − | |
| 61 | − int (*free)(pwm_omap_dmtimer *timer); | |
| 62 | − | |
| 63 | − void (*enable)(pwm_omap_dmtimer *timer); | |
| 64 | − void (*disable)(pwm_omap_dmtimer *timer); | |
| 65 | − | |
| 66 | − int (*get_irq)(pwm_omap_dmtimer *timer); | |
| 67 | − int (*set_int_enable)(pwm_omap_dmtimer *timer, unsigned int value); | |
| 68 | − int (*set_int_disable)(pwm_omap_dmtimer *timer, u32 mask); | |
| 69 | − | |
| 70 | − struct clk *(*get_fclk)(pwm_omap_dmtimer *timer); | |
| 71 | − | |
| 72 | − int (*start)(pwm_omap_dmtimer *timer); | |
| 73 | − int (*stop)(pwm_omap_dmtimer *timer); | |
| 74 | − int (*set_source)(pwm_omap_dmtimer *timer, int source); | |
| 75 | − | |
| 76 | − int (*set_load)(pwm_omap_dmtimer *timer, int autoreload, | |
| 77 | − unsigned int value); | |
| 78 | − int (*set_match)(pwm_omap_dmtimer *timer, int enable, | |
| 79 | − unsigned int match); | |
| 80 | − int (*set_pwm)(pwm_omap_dmtimer *timer, int def_on, | |
| 81 | − int toggle, int trigger); | |
| 82 | − int (*set_prescaler)(pwm_omap_dmtimer *timer, int prescaler); | |
| 83 | − | |
| 84 | − unsigned int (*read_counter)(pwm_omap_dmtimer *timer); | |
| 85 | − int (*write_counter)(pwm_omap_dmtimer *timer, unsigned int value); | |
| 86 | − unsigned int (*read_status)(pwm_omap_dmtimer *timer); | |
| 87 | − int (*write_status)(pwm_omap_dmtimer *timer, unsigned int value); | |
| 88 | −}; | |
| 89 | − | |
| 90 | −#endif /* __PWM_OMAP_DMTIMER_PDATA_H */ | |
| @@ -1,51 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | −/* | |
| 3 | − * Remote Processor - omap-specific bits | |
| 4 | − * | |
| 5 | − * Copyright (C) 2011 Texas Instruments, Inc. | |
| 6 | − * Copyright (C) 2011 Google, Inc. | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#ifndef _PLAT_REMOTEPROC_H | |
| 10 | −#define _PLAT_REMOTEPROC_H | |
| 11 | − | |
| 12 | −struct rproc_ops; | |
| 13 | −struct platform_device; | |
| 14 | − | |
| 15 | −/* | |
| 16 | − * struct omap_rproc_pdata - omap remoteproc's platform data | |
| 17 | − * @name: the remoteproc's name | |
| 18 | − * @oh_name: omap hwmod device | |
| 19 | − * @oh_name_opt: optional, secondary omap hwmod device | |
| 20 | − * @firmware: name of firmware file to load | |
| 21 | − * @mbox_name: name of omap mailbox device to use with this rproc | |
| 22 | − * @ops: start/stop rproc handlers | |
| 23 | − * @device_enable: omap-specific handler for enabling a device | |
| 24 | − * @device_shutdown: omap-specific handler for shutting down a device | |
| 25 | − * @set_bootaddr: omap-specific handler for setting the rproc boot address | |
| 26 | − */ | |
| 27 | −struct omap_rproc_pdata { | |
| 28 | − const char *name; | |
| 29 | − const char *oh_name; | |
| 30 | − const char *oh_name_opt; | |
| 31 | − const char *firmware; | |
| 32 | − const char *mbox_name; | |
| 33 | − const struct rproc_ops *ops; | |
| 34 | − int (*device_enable)(struct platform_device *pdev); | |
| 35 | − int (*device_shutdown)(struct platform_device *pdev); | |
| 36 | − void (*set_bootaddr)(u32); | |
| 37 | −}; | |
| 38 | − | |
| 39 | −#if defined(CONFIG_OMAP_REMOTEPROC) || defined(CONFIG_OMAP_REMOTEPROC_MODULE) | |
| 40 | − | |
| 41 | −void __init omap_rproc_reserve_cma(void); | |
| 42 | − | |
| 43 | −#else | |
| 44 | − | |
| 45 | −static inline void __init omap_rproc_reserve_cma(void) | |
| 46 | −{ | |
| 47 | −} | |
| 48 | − | |
| 49 | −#endif | |
| 50 | − | |
| 51 | −#endif /* _PLAT_REMOTEPROC_H */ | |
| @@ -17,6 +17,7 @@ enum ti_sysc_module_type { · 16 unmodified lines | ||
| 17 | 17 | TI_SYSC_OMAP4_MCASP, |
| 18 | 18 | TI_SYSC_OMAP4_USB_HOST_FS, |
| 19 | 19 | TI_SYSC_DRA7_MCAN, |
| 20 | + TI_SYSC_PRUSS, | |
| 20 | 21 | }; |
| 21 | 22 | |
| 22 | 23 | struct ti_sysc_cookie { |
| @@ -49,6 +50,9 @@ struct sysc_regbits { · 26 unmodified lines | ||
| 49 | 50 | s8 emufree_shift; |
| 50 | 51 | }; |
| 51 | 52 | |
| 53 | +#define SYSC_MODULE_QUIRK_PRUSS BIT(24) | |
| 54 | +#define SYSC_MODULE_QUIRK_DSS_RESET BIT(23) | |
| 55 | +#define SYSC_MODULE_QUIRK_RTC_UNLOCK BIT(22) | |
| 52 | 56 | #define SYSC_QUIRK_CLKDM_NOAUTO BIT(21) |
| 53 | 57 | #define SYSC_QUIRK_FORCE_MSTANDBY BIT(20) |
| 54 | 58 | #define SYSC_MODULE_QUIRK_AESS BIT(19) |
| @@ -141,6 +145,7 @@ struct clk; · 86 unmodified lines | ||
| 141 | 145 | |
| 142 | 146 | struct ti_sysc_platform_data { |
| 143 | 147 | struct of_dev_auxdata *auxdata; |
| 148 | + bool (*soc_type_gp)(void); | |
| 144 | 149 | int (*init_clockdomain)(struct device *dev, struct clk *fck, |
| 145 | 150 | struct clk *ick, struct ti_sysc_cookie *cookie); |
| 146 | 151 | void (*clkdm_deny_idle)(struct device *dev, |
| @@ -8,8 +8,8 @@ · 7 unmodified lines | ||
| 8 | 8 | #ifndef WILCO_EC_H |
| 9 | 9 | #define WILCO_EC_H |
| 10 | 10 | |
| 11 | −#include <linux/device.h> | |
| 12 | −#include <linux/kernel.h> | |
| 11 | +#include <linux/mutex.h> | |
| 12 | +#include <linux/types.h> | |
| 13 | 13 | |
| 14 | 14 | /* Message flags for using the mailbox() interface */ |
| 15 | 15 | #define WILCO_EC_FLAG_NO_RESPONSE BIT(0) /* EC does not respond */ |
| @@ -17,6 +17,10 @@ · 1 unmodified line | ||
| 17 | 17 | /* Normal commands have a maximum 32 bytes of data */ |
| 18 | 18 | #define EC_MAILBOX_DATA_SIZE 32 |
| 19 | 19 | |
| 20 | +struct device; | |
| 21 | +struct resource; | |
| 22 | +struct platform_device; | |
| 23 | + | |
| 20 | 24 | /** |
| 21 | 25 | * struct wilco_ec_device - Wilco Embedded Controller handle. |
| 22 | 26 | * @dev: Device handle. |
| @@ -24,7 +24,7 @@ struct platform_device { · 23 unmodified lines | ||
| 24 | 24 | int id; |
| 25 | 25 | bool id_auto; |
| 26 | 26 | struct device dev; |
| 27 | − u64 dma_mask; | |
| 27 | + u64 platform_dma_mask; | |
| 28 | 28 | u32 num_resources; |
| 29 | 29 | struct resource *resource; |
| 30 | 30 | |
| @@ -55,6 +55,9 @@ extern struct device * · 24 unmodified lines | ||
| 55 | 55 | platform_find_device_by_driver(struct device *start, |
| 56 | 56 | const struct device_driver *drv); |
| 57 | 57 | extern void __iomem * |
| 58 | +devm_platform_get_and_ioremap_resource(struct platform_device *pdev, | |
| 59 | + unsigned int index, struct resource **res); | |
| 60 | +extern void __iomem * | |
| 58 | 61 | devm_platform_ioremap_resource(struct platform_device *pdev, |
| 59 | 62 | unsigned int index); |
| 60 | 63 | extern void __iomem * |
| @@ -89,7 +92,7 @@ struct platform_device_info { · 28 unmodified lines | ||
| 89 | 92 | size_t size_data; |
| 90 | 93 | u64 dma_mask; |
| 91 | 94 | |
| 92 | − struct property_entry *properties; | |
| 95 | + const struct property_entry *properties; | |
| 93 | 96 | }; |
| 94 | 97 | extern struct platform_device *platform_device_register_full( |
| 95 | 98 | const struct platform_device_info *pdevinfo); |
| @@ -1,22 +1,20 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | −#ifndef _LINUX_PM_QOS_H | |
| 3 | −#define _LINUX_PM_QOS_H | |
| 4 | −/* interface for the pm_qos_power infrastructure of the linux kernel. | |
| 2 | +/* | |
| 3 | + * Definitions related to Power Management Quality of Service (PM QoS). | |
| 5 | 4 | * |
| 6 | − * Mark Gross <mgross@linux.intel.com> | |
| 5 | + * Copyright (C) 2020 Intel Corporation | |
| 6 | + * | |
| 7 | + * Authors: | |
| 8 | + * Mark Gross <mgross@linux.intel.com> | |
| 9 | + * Rafael J. Wysocki <rafael.j.wysocki@intel.com> | |
| 7 | 10 | */ |
| 11 | + | |
| 12 | +#ifndef _LINUX_PM_QOS_H | |
| 13 | +#define _LINUX_PM_QOS_H | |
| 14 | + | |
| 8 | 15 | #include <linux/plist.h> |
| 9 | 16 | #include <linux/notifier.h> |
| 10 | 17 | #include <linux/device.h> |
| 11 | −#include <linux/workqueue.h> | |
| 12 | − | |
| 13 | −enum { | |
| 14 | − PM_QOS_RESERVED = 0, | |
| 15 | − PM_QOS_CPU_DMA_LATENCY, | |
| 16 | − | |
| 17 | − /* insert new class ID */ | |
| 18 | − PM_QOS_NUM_CLASSES, | |
| 19 | −}; | |
| 20 | 18 | |
| 21 | 19 | enum pm_qos_flags_status { |
| 22 | 20 | PM_QOS_FLAGS_UNDEFINED = -1, |
| @@ -29,7 +27,7 @@ enum pm_qos_flags_status { · 6 unmodified lines | ||
| 29 | 27 | #define PM_QOS_LATENCY_ANY S32_MAX |
| 30 | 28 | #define PM_QOS_LATENCY_ANY_NS ((s64)PM_QOS_LATENCY_ANY * NSEC_PER_USEC) |
| 31 | 29 | |
| 32 | −#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | |
| 30 | +#define PM_QOS_CPU_LATENCY_DEFAULT_VALUE (2000 * USEC_PER_SEC) | |
| 33 | 31 | #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE PM_QOS_LATENCY_ANY |
| 34 | 32 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY |
| 35 | 33 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS |
| @@ -40,22 +38,10 @@ enum pm_qos_flags_status { · 4 unmodified lines | ||
| 40 | 38 | |
| 41 | 39 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) |
| 42 | 40 | |
| 43 | −struct pm_qos_request { | |
| 44 | − struct plist_node node; | |
| 45 | − int pm_qos_class; | |
| 46 | − struct delayed_work work; /* for pm_qos_update_request_timeout */ | |
| 47 | −}; | |
| 48 | − | |
| 49 | −struct pm_qos_flags_request { | |
| 50 | − struct list_head node; | |
| 51 | − s32 flags; /* Do not change to 64 bit */ | |
| 52 | −}; | |
| 53 | − | |
| 54 | 41 | enum pm_qos_type { |
| 55 | 42 | PM_QOS_UNITIALIZED, |
| 56 | 43 | PM_QOS_MAX, /* return the largest value */ |
| 57 | 44 | PM_QOS_MIN, /* return the smallest value */ |
| 58 | − PM_QOS_SUM /* return the sum */ | |
| 59 | 45 | }; |
| 60 | 46 | |
| 61 | 47 | /* |
| @@ -72,6 +58,16 @@ struct pm_qos_constraints { · 10 unmodified lines | ||
| 72 | 58 | struct blocking_notifier_head *notifiers; |
| 73 | 59 | }; |
| 74 | 60 | |
| 61 | +struct pm_qos_request { | |
| 62 | + struct plist_node node; | |
| 63 | + struct pm_qos_constraints *qos; | |
| 64 | +}; | |
| 65 | + | |
| 66 | +struct pm_qos_flags_request { | |
| 67 | + struct list_head node; | |
| 68 | + s32 flags; /* Do not change to 64 bit */ | |
| 69 | +}; | |
| 70 | + | |
| 75 | 71 | struct pm_qos_flags { |
| 76 | 72 | struct list_head list; |
| 77 | 73 | s32 effective_flags; /* Do not change to 64 bit */ |
| @@ -140,24 +136,31 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req) · 62 unmodified lines | ||
| 140 | 136 | return req->dev != NULL; |
| 141 | 137 | } |
| 142 | 138 | |
| 139 | +s32 pm_qos_read_value(struct pm_qos_constraints *c); | |
| 143 | 140 | int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, |
| 144 | 141 | enum pm_qos_req_action action, int value); |
| 145 | 142 | bool pm_qos_update_flags(struct pm_qos_flags *pqf, |
| 146 | 143 | struct pm_qos_flags_request *req, |
| 147 | 144 | enum pm_qos_req_action action, s32 val); |
| 148 | −void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, | |
| 149 | − s32 value); | |
| 150 | −void pm_qos_update_request(struct pm_qos_request *req, | |
| 151 | − s32 new_value); | |
| 152 | −void pm_qos_update_request_timeout(struct pm_qos_request *req, | |
| 153 | − s32 new_value, unsigned long timeout_us); | |
| 154 | −void pm_qos_remove_request(struct pm_qos_request *req); | |
| 155 | − | |
| 156 | −int pm_qos_request(int pm_qos_class); | |
| 157 | −int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier); | |
| 158 | −int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); | |
| 159 | −int pm_qos_request_active(struct pm_qos_request *req); | |
| 160 | −s32 pm_qos_read_value(struct pm_qos_constraints *c); | |
| 145 | + | |
| 146 | +#ifdef CONFIG_CPU_IDLE | |
| 147 | +s32 cpu_latency_qos_limit(void); | |
| 148 | +bool cpu_latency_qos_request_active(struct pm_qos_request *req); | |
| 149 | +void cpu_latency_qos_add_request(struct pm_qos_request *req, s32 value); | |
| 150 | +void cpu_latency_qos_update_request(struct pm_qos_request *req, s32 new_value); | |
| 151 | +void cpu_latency_qos_remove_request(struct pm_qos_request *req); | |
| 152 | +#else | |
| 153 | +static inline s32 cpu_latency_qos_limit(void) { return INT_MAX; } | |
| 154 | +static inline bool cpu_latency_qos_request_active(struct pm_qos_request *req) | |
| 155 | +{ | |
| 156 | + return false; | |
| 157 | +} | |
| 158 | +static inline void cpu_latency_qos_add_request(struct pm_qos_request *req, | |
| 159 | + s32 value) {} | |
| 160 | +static inline void cpu_latency_qos_update_request(struct pm_qos_request *req, | |
| 161 | + s32 new_value) {} | |
| 162 | +static inline void cpu_latency_qos_remove_request(struct pm_qos_request *req) {} | |
| 163 | +#endif | |
| 161 | 164 | |
| 162 | 165 | #ifdef CONFIG_PM |
| 163 | 166 | enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask); |
| @@ -38,7 +38,7 @@ extern int pm_runtime_force_resume(struct device *dev); · 37 unmodified lines | ||
| 38 | 38 | extern int __pm_runtime_idle(struct device *dev, int rpmflags); |
| 39 | 39 | extern int __pm_runtime_suspend(struct device *dev, int rpmflags); |
| 40 | 40 | extern int __pm_runtime_resume(struct device *dev, int rpmflags); |
| 41 | −extern int pm_runtime_get_if_in_use(struct device *dev); | |
| 41 | +extern int pm_runtime_get_if_active(struct device *dev, bool ign_usage_count); | |
| 42 | 42 | extern int pm_schedule_suspend(struct device *dev, unsigned int delay); |
| 43 | 43 | extern int __pm_runtime_set_status(struct device *dev, unsigned int status); |
| 44 | 44 | extern int pm_runtime_barrier(struct device *dev); |
| @@ -60,6 +60,11 @@ extern void pm_runtime_put_suppliers(struct device *dev); · 15 unmodified lines | ||
| 60 | 60 | extern void pm_runtime_new_link(struct device *dev); |
| 61 | 61 | extern void pm_runtime_drop_link(struct device *dev); |
| 62 | 62 | |
| 63 | +static inline int pm_runtime_get_if_in_use(struct device *dev) | |
| 64 | +{ | |
| 65 | + return pm_runtime_get_if_active(dev, false); | |
| 66 | +} | |
| 67 | + | |
| 63 | 68 | static inline void pm_suspend_ignore_children(struct device *dev, bool enable) |
| 64 | 69 | { |
| 65 | 70 | dev->power.ignore_children = enable; |
| @@ -143,6 +148,11 @@ static inline int pm_runtime_get_if_in_use(struct device *dev) · 77 unmodified lines | ||
| 143 | 148 | { |
| 144 | 149 | return -EINVAL; |
| 145 | 150 | } |
| 151 | +static inline int pm_runtime_get_if_active(struct device *dev, | |
| 152 | + bool ign_usage_count) | |
| 153 | +{ | |
| 154 | + return -EINVAL; | |
| 155 | +} | |
| 146 | 156 | static inline int __pm_runtime_set_status(struct device *dev, |
| 147 | 157 | unsigned int status) { return 0; } |
| 148 | 158 | static inline int pm_runtime_barrier(struct device *dev) { return 0; } |
| @@ -379,7 +379,7 @@ struct pnp_id { · 378 unmodified lines | ||
| 379 | 379 | }; |
| 380 | 380 | |
| 381 | 381 | struct pnp_driver { |
| 382 | − char *name; | |
| 382 | + const char *name; | |
| 383 | 383 | const struct pnp_device_id *id_table; |
| 384 | 384 | unsigned int flags; |
| 385 | 385 | int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); |
| @@ -69,7 +69,7 @@ static inline int clockid_to_fd(const clockid_t clk) · 68 unmodified lines | ||
| 69 | 69 | struct cpu_timer { |
| 70 | 70 | struct timerqueue_node node; |
| 71 | 71 | struct timerqueue_head *head; |
| 72 | − struct task_struct *task; | |
| 72 | + struct pid *pid; | |
| 73 | 73 | struct list_head elist; |
| 74 | 74 | int firing; |
| 75 | 75 | }; |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | /* |
| 3 | 3 | * bq2415x charger driver |
| 4 | 4 | * |
| 5 | − * Copyright (C) 2011-2013 Pali Rohár <pali.rohar@gmail.com> | |
| 5 | + * Copyright (C) 2011-2013 Pali Rohár <pali@kernel.org> | |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | #ifndef BQ2415X_CHARGER_H |
| @@ -248,7 +248,7 @@ struct charger_manager { · 247 unmodified lines | ||
| 248 | 248 | u64 charging_end_time; |
| 249 | 249 | }; |
| 250 | 250 | |
| 251 | −#ifdef CONFIG_CHARGER_MANAGER | |
| 251 | +#if IS_ENABLED(CONFIG_CHARGER_MANAGER) | |
| 252 | 252 | extern void cm_notify_event(struct power_supply *psy, |
| 253 | 253 | enum cm_event_types type, char *msg); |
| 254 | 254 | #else |
| @@ -322,4 +322,34 @@ static inline void preempt_notifier_init(struct preempt_notifier *notifier, · 321 unmodified lines | ||
| 322 | 322 | |
| 323 | 323 | #endif |
| 324 | 324 | |
| 325 | +/** | |
| 326 | + * migrate_disable - Prevent migration of the current task | |
| 327 | + * | |
| 328 | + * Maps to preempt_disable() which also disables preemption. Use | |
| 329 | + * migrate_disable() to annotate that the intent is to prevent migration, | |
| 330 | + * but not necessarily preemption. | |
| 331 | + * | |
| 332 | + * Can be invoked nested like preempt_disable() and needs the corresponding | |
| 333 | + * number of migrate_enable() invocations. | |
| 334 | + */ | |
| 335 | +static __always_inline void migrate_disable(void) | |
| 336 | +{ | |
| 337 | + preempt_disable(); | |
| 338 | +} | |
| 339 | + | |
| 340 | +/** | |
| 341 | + * migrate_enable - Allow migration of the current task | |
| 342 | + * | |
| 343 | + * Counterpart to migrate_disable(). | |
| 344 | + * | |
| 345 | + * As migrate_disable() can be invoked nested, only the outermost invocation | |
| 346 | + * reenables migration. | |
| 347 | + * | |
| 348 | + * Currently mapped to preempt_enable(). | |
| 349 | + */ | |
| 350 | +static __always_inline void migrate_enable(void) | |
| 351 | +{ | |
| 352 | + preempt_enable(); | |
| 353 | +} | |
| 354 | + | |
| 325 | 355 | #endif /* __LINUX_PREEMPT_H */ |
| @@ -202,7 +202,6 @@ __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...); · 201 unmodified lines | ||
| 202 | 202 | void dump_stack_print_info(const char *log_lvl); |
| 203 | 203 | void show_regs_print_info(const char *log_lvl); |
| 204 | 204 | extern asmlinkage void dump_stack(void) __cold; |
| 205 | −extern void printk_safe_init(void); | |
| 206 | 205 | extern void printk_safe_flush(void); |
| 207 | 206 | extern void printk_safe_flush_on_panic(void); |
| 208 | 207 | #else |
| @@ -269,10 +268,6 @@ static inline void dump_stack(void) · 60 unmodified lines | ||
| 269 | 268 | { |
| 270 | 269 | } |
| 271 | 270 | |
| 272 | −static inline void printk_safe_init(void) | |
| 273 | −{ | |
| 274 | −} | |
| 275 | − | |
| 276 | 271 | static inline void printk_safe_flush(void) |
| 277 | 272 | { |
| 278 | 273 | } |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | #ifndef _LINUX_PROC_FS_H |
| 6 | 6 | #define _LINUX_PROC_FS_H |
| 7 | 7 | |
| 8 | +#include <linux/compiler.h> | |
| 8 | 9 | #include <linux/types.h> |
| 9 | 10 | #include <linux/fs.h> |
| 10 | 11 | |
| @@ -12,7 +13,21 @@ struct proc_dir_entry; · 1 unmodified line | ||
| 12 | 13 | struct seq_file; |
| 13 | 14 | struct seq_operations; |
| 14 | 15 | |
| 16 | +enum { | |
| 17 | + /* | |
| 18 | + * All /proc entries using this ->proc_ops instance are never removed. | |
| 19 | + * | |
| 20 | + * If in doubt, ignore this flag. | |
| 21 | + */ | |
| 22 | +#ifdef MODULE | |
| 23 | + PROC_ENTRY_PERMANENT = 0U, | |
| 24 | +#else | |
| 25 | + PROC_ENTRY_PERMANENT = 1U << 0, | |
| 26 | +#endif | |
| 27 | +}; | |
| 28 | + | |
| 15 | 29 | struct proc_ops { |
| 30 | + unsigned int proc_flags; | |
| 16 | 31 | int (*proc_open)(struct inode *, struct file *); |
| 17 | 32 | ssize_t (*proc_read)(struct file *, char __user *, size_t, loff_t *); |
| 18 | 33 | ssize_t (*proc_write)(struct file *, const char __user *, size_t, loff_t *); |
| @@ -25,14 +40,14 @@ struct proc_ops { · 6 unmodified lines | ||
| 25 | 40 | #endif |
| 26 | 41 | int (*proc_mmap)(struct file *, struct vm_area_struct *); |
| 27 | 42 | unsigned long (*proc_get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); |
| 28 | −}; | |
| 43 | +} __randomize_layout; | |
| 29 | 44 | |
| 30 | 45 | #ifdef CONFIG_PROC_FS |
| 31 | 46 | |
| 32 | 47 | typedef int (*proc_write_t)(struct file *, char *, size_t); |
| 33 | 48 | |
| 34 | 49 | extern void proc_root_init(void); |
| 35 | −extern void proc_flush_task(struct task_struct *); | |
| 50 | +extern void proc_flush_pid(struct pid *); | |
| 36 | 51 | |
| 37 | 52 | extern struct proc_dir_entry *proc_symlink(const char *, |
| 38 | 53 | struct proc_dir_entry *, const char *); |
| @@ -105,7 +120,7 @@ static inline void proc_root_init(void) · 66 unmodified lines | ||
| 105 | 120 | { |
| 106 | 121 | } |
| 107 | 122 | |
| 108 | −static inline void proc_flush_task(struct task_struct *task) | |
| 123 | +static inline void proc_flush_pid(struct pid *pid) | |
| 109 | 124 | { |
| 110 | 125 | } |
| 111 | 126 | |
| @@ -50,16 +50,11 @@ enum { · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | #ifdef CONFIG_PROC_FS |
| 52 | 52 | |
| 53 | −extern int pid_ns_prepare_proc(struct pid_namespace *ns); | |
| 54 | −extern void pid_ns_release_proc(struct pid_namespace *ns); | |
| 55 | 53 | extern int proc_alloc_inum(unsigned int *pino); |
| 56 | 54 | extern void proc_free_inum(unsigned int inum); |
| 57 | 55 | |
| 58 | 56 | #else /* CONFIG_PROC_FS */ |
| 59 | 57 | |
| 60 | −static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; } | |
| 61 | −static inline void pid_ns_release_proc(struct pid_namespace *ns) {} | |
| 62 | − | |
| 63 | 58 | static inline int proc_alloc_inum(unsigned int *inum) |
| 64 | 59 | { |
| 65 | 60 | *inum = 1; |
| @@ -85,6 +80,8 @@ typedef struct ns_common *ns_get_path_helper_t(void *); · 19 unmodified lines | ||
| 85 | 80 | extern int ns_get_path_cb(struct path *path, ns_get_path_helper_t ns_get_cb, |
| 86 | 81 | void *private_data); |
| 87 | 82 | |
| 83 | +extern bool ns_match(const struct ns_common *ns, dev_t dev, ino_t ino); | |
| 84 | + | |
| 88 | 85 | extern int ns_get_name(char *buf, size_t size, struct task_struct *task, |
| 89 | 86 | const struct proc_ns_operations *ns_ops); |
| 90 | 87 | extern void nsfs_init(void); |
| @@ -17,6 +17,8 @@ extern struct psi_group psi_system; · 16 unmodified lines | ||
| 17 | 17 | void psi_init(void); |
| 18 | 18 | |
| 19 | 19 | void psi_task_change(struct task_struct *task, int clear, int set); |
| 20 | +void psi_task_switch(struct task_struct *prev, struct task_struct *next, | |
| 21 | + bool sleep); | |
| 20 | 22 | |
| 21 | 23 | void psi_memstall_tick(struct task_struct *task, int cpu); |
| 22 | 24 | void psi_memstall_enter(unsigned long *flags); |
| @@ -14,13 +14,21 @@ enum psi_task_count { · 13 unmodified lines | ||
| 14 | 14 | NR_IOWAIT, |
| 15 | 15 | NR_MEMSTALL, |
| 16 | 16 | NR_RUNNING, |
| 17 | − NR_PSI_TASK_COUNTS = 3, | |
| 17 | + /* | |
| 18 | + * This can't have values other than 0 or 1 and could be | |
| 19 | + * implemented as a bit flag. But for now we still have room | |
| 20 | + * in the first cacheline of psi_group_cpu, and this way we | |
| 21 | + * don't have to special case any state tracking for it. | |
| 22 | + */ | |
| 23 | + NR_ONCPU, | |
| 24 | + NR_PSI_TASK_COUNTS = 4, | |
| 18 | 25 | }; |
| 19 | 26 | |
| 20 | 27 | /* Task state bitmasks */ |
| 21 | 28 | #define TSK_IOWAIT (1 << NR_IOWAIT) |
| 22 | 29 | #define TSK_MEMSTALL (1 << NR_MEMSTALL) |
| 23 | 30 | #define TSK_RUNNING (1 << NR_RUNNING) |
| 31 | +#define TSK_ONCPU (1 << NR_ONCPU) | |
| 24 | 32 | |
| 25 | 33 | /* Resources that workloads could be stalled on */ |
| 26 | 34 | enum psi_res { |
| @@ -223,6 +223,12 @@ extern s32 scaled_ppm_to_ppb(long ppm); · 222 unmodified lines | ||
| 223 | 223 | /** |
| 224 | 224 | * ptp_find_pin() - obtain the pin index of a given auxiliary function |
| 225 | 225 | * |
| 226 | + * The caller must hold ptp_clock::pincfg_mux. Drivers do not have | |
| 227 | + * access to that mutex as ptp_clock is an opaque type. However, the | |
| 228 | + * core code acquires the mutex before invoking the driver's | |
| 229 | + * ptp_clock_info::enable() callback, and so drivers may call this | |
| 230 | + * function from that context. | |
| 231 | + * | |
| 226 | 232 | * @ptp: The clock obtained from ptp_clock_register(). |
| 227 | 233 | * @func: One of the ptp_pin_function enumerated values. |
| 228 | 234 | * @chan: The particular functional channel to find. |
| @@ -233,6 +239,19 @@ extern s32 scaled_ppm_to_ppb(long ppm); · 4 unmodified lines | ||
| 233 | 239 | int ptp_find_pin(struct ptp_clock *ptp, |
| 234 | 240 | enum ptp_pin_function func, unsigned int chan); |
| 235 | 241 | |
| 242 | +/** | |
| 243 | + * ptp_find_pin_unlocked() - wrapper for ptp_find_pin() | |
| 244 | + * | |
| 245 | + * This function acquires the ptp_clock::pincfg_mux mutex before | |
| 246 | + * invoking ptp_find_pin(). Instead of using this function, drivers | |
| 247 | + * should most likely call ptp_find_pin() directly from their | |
| 248 | + * ptp_clock_info::enable() method. | |
| 249 | + * | |
| 250 | + */ | |
| 251 | + | |
| 252 | +int ptp_find_pin_unlocked(struct ptp_clock *ptp, | |
| 253 | + enum ptp_pin_function func, unsigned int chan); | |
| 254 | + | |
| 236 | 255 | /** |
| 237 | 256 | * ptp_schedule_worker() - schedule ptp auxiliary work |
| 238 | 257 | * |
| @@ -71,7 +71,8 @@ struct pwm_state { · 70 unmodified lines | ||
| 71 | 71 | * @chip: PWM chip providing this PWM device |
| 72 | 72 | * @chip_data: chip-private data associated with the PWM device |
| 73 | 73 | * @args: PWM arguments |
| 74 | − * @state: curent PWM channel state | |
| 74 | + * @state: last applied state | |
| 75 | + * @last: last implemented state (for PWM_DEBUG) | |
| 75 | 76 | */ |
| 76 | 77 | struct pwm_device { |
| 77 | 78 | const char *label; |
| @@ -83,6 +84,7 @@ struct pwm_device { · 5 unmodified lines | ||
| 83 | 84 | |
| 84 | 85 | struct pwm_args args; |
| 85 | 86 | struct pwm_state state; |
| 87 | + struct pwm_state last; | |
| 86 | 88 | }; |
| 87 | 89 | |
| 88 | 90 | /** |
| @@ -16,8 +16,6 @@ struct platform_pwm_backlight_data { · 15 unmodified lines | ||
| 16 | 16 | unsigned int *levels; |
| 17 | 17 | unsigned int post_pwm_on_delay; |
| 18 | 18 | unsigned int pwm_off_delay; |
| 19 | − /* TODO remove once all users are switched to gpiod_* API */ | |
| 20 | − int enable_gpio; | |
| 21 | 19 | int (*init)(struct device *dev); |
| 22 | 20 | int (*notify)(struct device *dev, int brightness); |
| 23 | 21 | void (*notify_after)(struct device *dev, int brightness); |
| @@ -97,6 +97,11 @@ struct qed_chain_u32 { · 96 unmodified lines | ||
| 97 | 97 | u32 cons_idx; |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | +struct addr_tbl_entry { | |
| 101 | + void *virt_addr; | |
| 102 | + dma_addr_t dma_map; | |
| 103 | +}; | |
| 104 | + | |
| 100 | 105 | struct qed_chain { |
| 101 | 106 | /* fastpath portion of the chain - required for commands such |
| 102 | 107 | * as produce / consume. |
| @@ -107,10 +112,11 @@ struct qed_chain { · 4 unmodified lines | ||
| 107 | 112 | |
| 108 | 113 | /* Fastpath portions of the PBL [if exists] */ |
| 109 | 114 | struct { |
| 110 | − /* Table for keeping the virtual addresses of the chain pages, | |
| 111 | − * respectively to the physical addresses in the pbl table. | |
| 115 | + /* Table for keeping the virtual and physical addresses of the | |
| 116 | + * chain pages, respectively to the physical addresses | |
| 117 | + * in the pbl table. | |
| 112 | 118 | */ |
| 113 | − void **pp_virt_addr_tbl; | |
| 119 | + struct addr_tbl_entry *pp_addr_tbl; | |
| 114 | 120 | |
| 115 | 121 | union { |
| 116 | 122 | struct qed_chain_pbl_u16 u16; |
| @@ -287,7 +293,7 @@ qed_chain_advance_page(struct qed_chain *p_chain, · 170 unmodified lines | ||
| 287 | 293 | *(u32 *)page_to_inc = 0; |
| 288 | 294 | page_index = *(u32 *)page_to_inc; |
| 289 | 295 | } |
| 290 | − *p_next_elem = p_chain->pbl.pp_virt_addr_tbl[page_index]; | |
| 296 | + *p_next_elem = p_chain->pbl.pp_addr_tbl[page_index].virt_addr; | |
| 291 | 297 | } |
| 292 | 298 | } |
| 293 | 299 | |
| @@ -537,7 +543,7 @@ static inline void qed_chain_init_params(struct qed_chain *p_chain, · 243 unmodified lines | ||
| 537 | 543 | |
| 538 | 544 | p_chain->pbl_sp.p_phys_table = 0; |
| 539 | 545 | p_chain->pbl_sp.p_virt_table = NULL; |
| 540 | − p_chain->pbl.pp_virt_addr_tbl = NULL; | |
| 546 | + p_chain->pbl.pp_addr_tbl = NULL; | |
| 541 | 547 | } |
| 542 | 548 | |
| 543 | 549 | /** |
| @@ -575,11 +581,11 @@ static inline void qed_chain_init_mem(struct qed_chain *p_chain, · 31 unmodified lines | ||
| 575 | 581 | static inline void qed_chain_init_pbl_mem(struct qed_chain *p_chain, |
| 576 | 582 | void *p_virt_pbl, |
| 577 | 583 | dma_addr_t p_phys_pbl, |
| 578 | − void **pp_virt_addr_tbl) | |
| 584 | + struct addr_tbl_entry *pp_addr_tbl) | |
| 579 | 585 | { |
| 580 | 586 | p_chain->pbl_sp.p_phys_table = p_phys_pbl; |
| 581 | 587 | p_chain->pbl_sp.p_virt_table = p_virt_pbl; |
| 582 | − p_chain->pbl.pp_virt_addr_tbl = pp_virt_addr_tbl; | |
| 588 | + p_chain->pbl.pp_addr_tbl = pp_addr_tbl; | |
| 583 | 589 | } |
| 584 | 590 | |
| 585 | 591 | /** |
| @@ -644,7 +650,7 @@ static inline void *qed_chain_get_last_elem(struct qed_chain *p_chain) · 58 unmodified lines | ||
| 644 | 650 | break; |
| 645 | 651 | case QED_CHAIN_MODE_PBL: |
| 646 | 652 | last_page_idx = p_chain->page_cnt - 1; |
| 647 | − p_virt_addr = p_chain->pbl.pp_virt_addr_tbl[last_page_idx]; | |
| 653 | + p_virt_addr = p_chain->pbl.pp_addr_tbl[last_page_idx].virt_addr; | |
| 648 | 654 | break; |
| 649 | 655 | } |
| 650 | 656 | /* p_virt_addr points at this stage to the last page of the chain */ |
| @@ -716,7 +722,7 @@ static inline void qed_chain_pbl_zero_mem(struct qed_chain *p_chain) · 65 unmodified lines | ||
| 716 | 722 | page_cnt = qed_chain_get_page_cnt(p_chain); |
| 717 | 723 | |
| 718 | 724 | for (i = 0; i < page_cnt; i++) |
| 719 | − memset(p_chain->pbl.pp_virt_addr_tbl[i], 0, | |
| 725 | + memset(p_chain->pbl.pp_addr_tbl[i].virt_addr, 0, | |
| 720 | 726 | QED_CHAIN_PAGE_SIZE); |
| 721 | 727 | } |
| 722 | 728 | |
| @@ -0,0 +1,3 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | + | |
| 3 | +void md_autodetect_dev(dev_t dev); | |
| @@ -7,6 +7,8 @@ · 6 unmodified lines | ||
| 7 | 7 | #ifndef _LINUX_RANDOM_H |
| 8 | 8 | #define _LINUX_RANDOM_H |
| 9 | 9 | |
| 10 | +#include <linux/bug.h> | |
| 11 | +#include <linux/kernel.h> | |
| 10 | 12 | #include <linux/list.h> |
| 11 | 13 | #include <linux/once.h> |
| 12 | 14 | |
| @@ -185,6 +187,26 @@ static inline bool __must_check arch_get_random_seed_int(unsigned int *v) · 172 unmodified lines | ||
| 185 | 187 | } |
| 186 | 188 | #endif |
| 187 | 189 | |
| 190 | +/* | |
| 191 | + * Called from the boot CPU during startup; not valid to call once | |
| 192 | + * secondary CPUs are up and preemption is possible. | |
| 193 | + */ | |
| 194 | +#ifndef arch_get_random_seed_long_early | |
| 195 | +static inline bool __init arch_get_random_seed_long_early(unsigned long *v) | |
| 196 | +{ | |
| 197 | + WARN_ON(system_state != SYSTEM_BOOTING); | |
| 198 | + return arch_get_random_seed_long(v); | |
| 199 | +} | |
| 200 | +#endif | |
| 201 | + | |
| 202 | +#ifndef arch_get_random_long_early | |
| 203 | +static inline bool __init arch_get_random_long_early(unsigned long *v) | |
| 204 | +{ | |
| 205 | + WARN_ON(system_state != SYSTEM_BOOTING); | |
| 206 | + return arch_get_random_long(v); | |
| 207 | +} | |
| 208 | +#endif | |
| 209 | + | |
| 188 | 210 | /* Pseudo random number generator from numerical recipes. */ |
| 189 | 211 | static inline u32 next_pseudo_random32(u32 seed) |
| 190 | 212 | { |
| @@ -60,9 +60,9 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list) · 59 unmodified lines | ||
| 60 | 60 | #define __list_check_rcu(dummy, cond, extra...) \ |
| 61 | 61 | ({ \ |
| 62 | 62 | check_arg_count_one(extra); \ |
| 63 | − RCU_LOCKDEP_WARN(!cond && !rcu_read_lock_any_held(), \ | |
| 63 | + RCU_LOCKDEP_WARN(!(cond) && !rcu_read_lock_any_held(), \ | |
| 64 | 64 | "RCU-list traversed in non-reader section!"); \ |
| 65 | − }) | |
| 65 | + }) | |
| 66 | 66 | #else |
| 67 | 67 | #define __list_check_rcu(dummy, cond, extra...) \ |
| 68 | 68 | ({ check_arg_count_one(extra); }) |
| @@ -83,6 +83,7 @@ void rcu_scheduler_starting(void); · 82 unmodified lines | ||
| 83 | 83 | static inline void rcu_scheduler_starting(void) { } |
| 84 | 84 | #endif /* #else #ifndef CONFIG_SRCU */ |
| 85 | 85 | static inline void rcu_end_inkernel_boot(void) { } |
| 86 | +static inline bool rcu_inkernel_boot_has_ended(void) { return true; } | |
| 86 | 87 | static inline bool rcu_is_watching(void) { return true; } |
| 87 | 88 | static inline void rcu_momentary_dyntick_idle(void) { } |
| 88 | 89 | static inline void kfree_rcu_scheduler_running(void) { } |
| @@ -54,6 +54,7 @@ void exit_rcu(void); · 53 unmodified lines | ||
| 54 | 54 | void rcu_scheduler_starting(void); |
| 55 | 55 | extern int rcu_scheduler_active __read_mostly; |
| 56 | 56 | void rcu_end_inkernel_boot(void); |
| 57 | +bool rcu_inkernel_boot_has_ended(void); | |
| 57 | 58 | bool rcu_is_watching(void); |
| 58 | 59 | #ifndef CONFIG_PREEMPTION |
| 59 | 60 | void rcu_all_qs(void); |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #define _LINUX_RCUWAIT_H_ |
| 4 | 4 | |
| 5 | 5 | #include <linux/rcupdate.h> |
| 6 | +#include <linux/sched/signal.h> | |
| 6 | 7 | |
| 7 | 8 | /* |
| 8 | 9 | * rcuwait provides a way of blocking and waking up a single |
| @@ -30,23 +31,30 @@ extern void rcuwait_wake_up(struct rcuwait *w); · 21 unmodified lines | ||
| 30 | 31 | * The caller is responsible for locking around rcuwait_wait_event(), |
| 31 | 32 | * such that writes to @task are properly serialized. |
| 32 | 33 | */ |
| 33 | −#define rcuwait_wait_event(w, condition) \ | |
| 34 | +#define rcuwait_wait_event(w, condition, state) \ | |
| 34 | 35 | ({ \ |
| 36 | + int __ret = 0; \ | |
| 35 | 37 | rcu_assign_pointer((w)->task, current); \ |
| 36 | 38 | for (;;) { \ |
| 37 | 39 | /* \ |
| 38 | 40 | * Implicit barrier (A) pairs with (B) in \ |
| 39 | 41 | * rcuwait_wake_up(). \ |
| 40 | 42 | */ \ |
| 41 | − set_current_state(TASK_UNINTERRUPTIBLE); \ | |
| 43 | + set_current_state(state); \ | |
| 42 | 44 | if (condition) \ |
| 43 | 45 | break; \ |
| 44 | 46 | \ |
| 47 | + if (signal_pending_state(state, current)) { \ | |
| 48 | + __ret = -EINTR; \ | |
| 49 | + break; \ | |
| 50 | + } \ | |
| 51 | + \ | |
| 45 | 52 | schedule(); \ |
| 46 | 53 | } \ |
| 47 | 54 | \ |
| 48 | 55 | WRITE_ONCE((w)->task, NULL); \ |
| 49 | 56 | __set_current_state(TASK_RUNNING); \ |
| 57 | + __ret; \ | |
| 50 | 58 | }) |
| 51 | 59 | |
| 52 | 60 | #endif /* _LINUX_RCUWAIT_H_ */ |
| @@ -38,11 +38,24 @@ · 37 unmodified lines | ||
| 38 | 38 | * atomic operations, then the count will continue to edge closer to 0. If it |
| 39 | 39 | * reaches a value of 1 before /any/ of the threads reset it to the saturated |
| 40 | 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. | |
| 41 | + * underlying object. | |
| 42 | + * Linux limits the maximum number of tasks to PID_MAX_LIMIT, which is currently | |
| 43 | + * 0x400000 (and can't easily be raised in the future beyond FUTEX_TID_MASK). | |
| 44 | + * With the current PID limit, if no batched refcounting operations are used and | |
| 45 | + * the attacker can't repeatedly trigger kernel oopses in the middle of refcount | |
| 46 | + * operations, this makes it impossible for a saturated refcount to leave the | |
| 47 | + * saturation range, even if it is possible for multiple uses of the same | |
| 48 | + * refcount to nest in the context of a single task: | |
| 49 | + * | |
| 50 | + * (UINT_MAX+1-REFCOUNT_SATURATED) / PID_MAX_LIMIT = | |
| 51 | + * 0x40000000 / 0x400000 = 0x100 = 256 | |
| 52 | + * | |
| 53 | + * If hundreds of references are added/removed with a single refcounting | |
| 54 | + * operation, it may potentially be possible to leave the saturation range; but | |
| 55 | + * given the precise timing details involved with the round-robin scheduling of | |
| 56 | + * each thread manipulating the refcount and the need to hit the race multiple | |
| 57 | + * times in succession, there doesn't appear to be a practical avenue of attack | |
| 58 | + * even if using refcount_add() operations with larger increments. | |
| 46 | 59 | * |
| 47 | 60 | * Memory ordering |
| 48 | 61 | * =============== |
| @@ -461,8 +461,8 @@ struct regmap_config { · 460 unmodified lines | ||
| 461 | 461 | * @range_max: Address of the highest register in virtual range. |
| 462 | 462 | * |
| 463 | 463 | * @selector_reg: Register with selector field. |
| 464 | − * @selector_mask: Bit shift for selector value. | |
| 465 | − * @selector_shift: Bit mask for selector value. | |
| 464 | + * @selector_mask: Bit mask for selector value. | |
| 465 | + * @selector_shift: Bit shift for selector value. | |
| 466 | 466 | * |
| 467 | 467 | * @window_start: Address of first (lowest) register in data window. |
| 468 | 468 | * @window_len: Number of registers in data window. |
| @@ -277,9 +277,9 @@ enum regulator_type { · 276 unmodified lines | ||
| 277 | 277 | * @curr_table: Current limit mapping table (if table based mapping) |
| 278 | 278 | * |
| 279 | 279 | * @vsel_range_reg: Register for range selector when using pickable ranges |
| 280 | − * and regulator_regmap_X_voltage_X_pickable functions. | |
| 280 | + * and ``regulator_map_*_voltage_*_pickable`` functions. | |
| 281 | 281 | * @vsel_range_mask: Mask for register bitfield used for range selector |
| 282 | − * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ | |
| 282 | + * @vsel_reg: Register for selector when using ``regulator_map_*_voltage_*`` | |
| 283 | 283 | * @vsel_mask: Mask for register bitfield used for selector |
| 284 | 284 | * @vsel_step: Specify the resolution of selector stepping when setting |
| 285 | 285 | * voltage. If 0, then no stepping is done (requested selector is |
| @@ -329,7 +329,7 @@ struct rproc; · 328 unmodified lines | ||
| 329 | 329 | struct rproc_mem_entry { |
| 330 | 330 | void *va; |
| 331 | 331 | dma_addr_t dma; |
| 332 | − int len; | |
| 332 | + size_t len; | |
| 333 | 333 | u32 da; |
| 334 | 334 | void *priv; |
| 335 | 335 | char name[32]; |
| @@ -369,12 +369,14 @@ enum rsc_handling_status { · 33 unmodified lines | ||
| 369 | 369 | * expects to find it |
| 370 | 370 | * @sanity_check: sanity check the fw image |
| 371 | 371 | * @get_boot_addr: get boot address to entry point specified in firmware |
| 372 | + * @panic: optional callback to react to system panic, core will delay | |
| 373 | + * panic at least the returned number of milliseconds | |
| 372 | 374 | */ |
| 373 | 375 | struct rproc_ops { |
| 374 | 376 | int (*start)(struct rproc *rproc); |
| 375 | 377 | int (*stop)(struct rproc *rproc); |
| 376 | 378 | void (*kick)(struct rproc *rproc, int vqid); |
| 377 | − void * (*da_to_va)(struct rproc *rproc, u64 da, int len); | |
| 379 | + void * (*da_to_va)(struct rproc *rproc, u64 da, size_t len); | |
| 378 | 380 | int (*parse_fw)(struct rproc *rproc, const struct firmware *fw); |
| 379 | 381 | int (*handle_rsc)(struct rproc *rproc, u32 rsc_type, void *rsc, |
| 380 | 382 | int offset, int avail); |
| @@ -382,7 +384,8 @@ struct rproc_ops { · 1 unmodified line | ||
| 382 | 384 | struct rproc *rproc, const struct firmware *fw); |
| 383 | 385 | int (*load)(struct rproc *rproc, const struct firmware *fw); |
| 384 | 386 | int (*sanity_check)(struct rproc *rproc, const struct firmware *fw); |
| 385 | − u32 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); | |
| 387 | + u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); | |
| 388 | + unsigned long (*panic)(struct rproc *rproc); | |
| 386 | 389 | }; |
| 387 | 390 | |
| 388 | 391 | /** |
| @@ -498,7 +501,7 @@ struct rproc { · 109 unmodified lines | ||
| 498 | 501 | int num_traces; |
| 499 | 502 | struct list_head carveouts; |
| 500 | 503 | struct list_head mappings; |
| 501 | − u32 bootaddr; | |
| 504 | + u64 bootaddr; | |
| 502 | 505 | struct list_head rvdevs; |
| 503 | 506 | struct list_head subdevs; |
| 504 | 507 | struct idr notifyids; |
| @@ -514,6 +517,7 @@ struct rproc { · 9 unmodified lines | ||
| 514 | 517 | bool auto_boot; |
| 515 | 518 | struct list_head dump_segments; |
| 516 | 519 | int nb_vdev; |
| 520 | + u8 elf_class; | |
| 517 | 521 | }; |
| 518 | 522 | |
| 519 | 523 | /** |
| @@ -599,13 +603,13 @@ void rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem); · 79 unmodified lines | ||
| 599 | 603 | |
| 600 | 604 | struct rproc_mem_entry * |
| 601 | 605 | rproc_mem_entry_init(struct device *dev, |
| 602 | − void *va, dma_addr_t dma, int len, u32 da, | |
| 606 | + void *va, dma_addr_t dma, size_t len, u32 da, | |
| 603 | 607 | int (*alloc)(struct rproc *, struct rproc_mem_entry *), |
| 604 | 608 | int (*release)(struct rproc *, struct rproc_mem_entry *), |
| 605 | 609 | const char *name, ...); |
| 606 | 610 | |
| 607 | 611 | struct rproc_mem_entry * |
| 608 | −rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len, | |
| 612 | +rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len, | |
| 609 | 613 | u32 da, const char *name, ...); |
| 610 | 614 | |
| 611 | 615 | int rproc_boot(struct rproc *rproc); |
| @@ -0,0 +1,82 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | + | |
| 3 | +/* Copyright (C) 2019 Linaro Ltd. */ | |
| 4 | + | |
| 5 | +#ifndef __QCOM_Q6V5_IPA_NOTIFY_H__ | |
| 6 | +#define __QCOM_Q6V5_IPA_NOTIFY_H__ | |
| 7 | + | |
| 8 | +#if IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY) | |
| 9 | + | |
| 10 | +#include <linux/remoteproc.h> | |
| 11 | + | |
| 12 | +enum qcom_rproc_event { | |
| 13 | + MODEM_STARTING = 0, /* Modem is about to be started */ | |
| 14 | + MODEM_RUNNING = 1, /* Startup complete; modem is operational */ | |
| 15 | + MODEM_STOPPING = 2, /* Modem is about to shut down */ | |
| 16 | + MODEM_CRASHED = 3, /* Modem has crashed (implies stopping) */ | |
| 17 | + MODEM_OFFLINE = 4, /* Modem is now offline */ | |
| 18 | + MODEM_REMOVING = 5, /* Modem is about to be removed */ | |
| 19 | +}; | |
| 20 | + | |
| 21 | +typedef void (*qcom_ipa_notify_t)(void *data, enum qcom_rproc_event event); | |
| 22 | + | |
| 23 | +struct qcom_rproc_ipa_notify { | |
| 24 | + struct rproc_subdev subdev; | |
| 25 | + | |
| 26 | + qcom_ipa_notify_t notify; | |
| 27 | + void *data; | |
| 28 | +}; | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * qcom_add_ipa_notify_subdev() - Register IPA notification subdevice | |
| 32 | + * @rproc: rproc handle | |
| 33 | + * @ipa_notify: IPA notification subdevice handle | |
| 34 | + * | |
| 35 | + * Register the @ipa_notify subdevice with the @rproc so modem events | |
| 36 | + * can be sent to IPA when they occur. | |
| 37 | + * | |
| 38 | + * This is defined in "qcom_q6v5_ipa_notify.c". | |
| 39 | + */ | |
| 40 | +void qcom_add_ipa_notify_subdev(struct rproc *rproc, | |
| 41 | + struct qcom_rproc_ipa_notify *ipa_notify); | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * qcom_remove_ipa_notify_subdev() - Remove IPA SSR subdevice | |
| 45 | + * @rproc: rproc handle | |
| 46 | + * @ipa_notify: IPA notification subdevice handle | |
| 47 | + * | |
| 48 | + * This is defined in "qcom_q6v5_ipa_notify.c". | |
| 49 | + */ | |
| 50 | +void qcom_remove_ipa_notify_subdev(struct rproc *rproc, | |
| 51 | + struct qcom_rproc_ipa_notify *ipa_notify); | |
| 52 | + | |
| 53 | +/** | |
| 54 | + * qcom_register_ipa_notify() - Register IPA notification function | |
| 55 | + * @rproc: Remote processor handle | |
| 56 | + * @notify: Non-null IPA notification callback function pointer | |
| 57 | + * @data: Data supplied to IPA notification callback function | |
| 58 | + * | |
| 59 | + * @Return: 0 if successful, or a negative error code otherwise | |
| 60 | + * | |
| 61 | + * This is defined in "qcom_q6v5_mss.c". | |
| 62 | + */ | |
| 63 | +int qcom_register_ipa_notify(struct rproc *rproc, qcom_ipa_notify_t notify, | |
| 64 | + void *data); | |
| 65 | +/** | |
| 66 | + * qcom_deregister_ipa_notify() - Deregister IPA notification function | |
| 67 | + * @rproc: Remote processor handle | |
| 68 | + * | |
| 69 | + * This is defined in "qcom_q6v5_mss.c". | |
| 70 | + */ | |
| 71 | +void qcom_deregister_ipa_notify(struct rproc *rproc); | |
| 72 | + | |
| 73 | +#else /* !IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY) */ | |
| 74 | + | |
| 75 | +struct qcom_rproc_ipa_notify { /* empty */ }; | |
| 76 | + | |
| 77 | +#define qcom_add_ipa_notify_subdev(rproc, ipa_notify) /* no-op */ | |
| 78 | +#define qcom_remove_ipa_notify_subdev(rproc, ipa_notify) /* no-op */ | |
| 79 | + | |
| 80 | +#endif /* !IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY) */ | |
| 81 | + | |
| 82 | +#endif /* !__QCOM_Q6V5_IPA_NOTIFY_H__ */ | |
| @@ -972,9 +972,9 @@ static inline int rhashtable_lookup_insert_key( · 971 unmodified lines | ||
| 972 | 972 | /** |
| 973 | 973 | * rhashtable_lookup_get_insert_key - lookup and insert object into hash table |
| 974 | 974 | * @ht: hash table |
| 975 | + * @key: key | |
| 975 | 976 | * @obj: pointer to hash head inside object |
| 976 | 977 | * @params: hash table parameters |
| 977 | − * @data: pointer to element data already in hashes | |
| 978 | 978 | * |
| 979 | 979 | * Just like rhashtable_lookup_insert_key(), but this function returns the |
| 980 | 980 | * object if it exists, NULL if it does not and the insertion was successful, |
| @@ -135,10 +135,10 @@ void ring_buffer_read_finish(struct ring_buffer_iter *iter); · 134 unmodified lines | ||
| 135 | 135 | |
| 136 | 136 | struct ring_buffer_event * |
| 137 | 137 | ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts); |
| 138 | −struct ring_buffer_event * | |
| 139 | −ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts); | |
| 138 | +void ring_buffer_iter_advance(struct ring_buffer_iter *iter); | |
| 140 | 139 | void ring_buffer_iter_reset(struct ring_buffer_iter *iter); |
| 141 | 140 | int ring_buffer_iter_empty(struct ring_buffer_iter *iter); |
| 141 | +bool ring_buffer_iter_dropped(struct ring_buffer_iter *iter); | |
| 142 | 142 | |
| 143 | 143 | unsigned long ring_buffer_size(struct trace_buffer *buffer, int cpu); |
| 144 | 144 | |
| @@ -34,18 +34,6 @@ static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs) · 33 unmodified lines | ||
| 34 | 34 | return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | −static inline void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) | |
| 38 | −{ | |
| 39 | − rtc_time64_to_tm(time, tm); | |
| 40 | −} | |
| 41 | − | |
| 42 | −static inline int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time) | |
| 43 | −{ | |
| 44 | − *time = rtc_tm_to_time64(tm); | |
| 45 | − | |
| 46 | − return 0; | |
| 47 | −} | |
| 48 | − | |
| 49 | 37 | #include <linux/device.h> |
| 50 | 38 | #include <linux/seq_file.h> |
| 51 | 39 | #include <linux/cdev.h> |
| @@ -22,7 +22,11 @@ typedef struct { · 21 unmodified lines | ||
| 22 | 22 | #define RWLOCK_MAGIC 0xdeaf1eed |
| 23 | 23 | |
| 24 | 24 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 25 | −# define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } | |
| 25 | +# define RW_DEP_MAP_INIT(lockname) \ | |
| 26 | + .dep_map = { \ | |
| 27 | + .name = #lockname, \ | |
| 28 | + .wait_type_inner = LD_WAIT_CONFIG, \ | |
| 29 | + } | |
| 26 | 30 | #else |
| 27 | 31 | # define RW_DEP_MAP_INIT(lockname) |
| 28 | 32 | #endif |
| @@ -53,12 +53,6 @@ struct rw_semaphore { · 52 unmodified lines | ||
| 53 | 53 | #endif |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | −/* | |
| 57 | − * Setting all bits of the owner field except bit 0 will indicate | |
| 58 | − * that the rwsem is writer-owned with an unknown owner. | |
| 59 | − */ | |
| 60 | −#define RWSEM_OWNER_UNKNOWN (-2L) | |
| 61 | − | |
| 62 | 56 | /* In all implementations count != 0 means locked */ |
| 63 | 57 | static inline int rwsem_is_locked(struct rw_semaphore *sem) |
| 64 | 58 | { |
| @@ -71,7 +65,11 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) · 6 unmodified lines | ||
| 71 | 65 | /* Common initializer macros and functions */ |
| 72 | 66 | |
| 73 | 67 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 74 | −# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | |
| 68 | +# define __RWSEM_DEP_MAP_INIT(lockname) \ | |
| 69 | + , .dep_map = { \ | |
| 70 | + .name = #lockname, \ | |
| 71 | + .wait_type_inner = LD_WAIT_SLEEP, \ | |
| 72 | + } | |
| 75 | 73 | #else |
| 76 | 74 | # define __RWSEM_DEP_MAP_INIT(lockname) |
| 77 | 75 | #endif |
| @@ -356,28 +356,30 @@ struct util_est { · 355 unmodified lines | ||
| 356 | 356 | } __attribute__((__aligned__(sizeof(u64)))); |
| 357 | 357 | |
| 358 | 358 | /* |
| 359 | − * The load_avg/util_avg accumulates an infinite geometric series | |
| 360 | − * (see __update_load_avg() in kernel/sched/fair.c). | |
| 359 | + * The load/runnable/util_avg accumulates an infinite geometric series | |
| 360 | + * (see __update_load_avg_cfs_rq() in kernel/sched/pelt.c). | |
| 361 | 361 | * |
| 362 | 362 | * [load_avg definition] |
| 363 | 363 | * |
| 364 | 364 | * load_avg = runnable% * scale_load_down(load) |
| 365 | 365 | * |
| 366 | − * where runnable% is the time ratio that a sched_entity is runnable. | |
| 367 | − * For cfs_rq, it is the aggregated load_avg of all runnable and | |
| 368 | − * blocked sched_entities. | |
| 366 | + * [runnable_avg definition] | |
| 367 | + * | |
| 368 | + * runnable_avg = runnable% * SCHED_CAPACITY_SCALE | |
| 369 | 369 | * |
| 370 | 370 | * [util_avg definition] |
| 371 | 371 | * |
| 372 | 372 | * util_avg = running% * SCHED_CAPACITY_SCALE |
| 373 | 373 | * |
| 374 | − * where running% is the time ratio that a sched_entity is running on | |
| 375 | − * a CPU. For cfs_rq, it is the aggregated util_avg of all runnable | |
| 376 | − * and blocked sched_entities. | |
| 374 | + * where runnable% is the time ratio that a sched_entity is runnable and | |
| 375 | + * running% the time ratio that a sched_entity is running. | |
| 376 | + * | |
| 377 | + * For cfs_rq, they are the aggregated values of all runnable and blocked | |
| 378 | + * sched_entities. | |
| 377 | 379 | * |
| 378 | − * load_avg and util_avg don't direcly factor frequency scaling and CPU | |
| 379 | − * capacity scaling. The scaling is done through the rq_clock_pelt that | |
| 380 | − * is used for computing those signals (see update_rq_clock_pelt()) | |
| 380 | + * The load/runnable/util_avg doesn't direcly factor frequency scaling and CPU | |
| 381 | + * capacity scaling. The scaling is done through the rq_clock_pelt that is used | |
| 382 | + * for computing those signals (see update_rq_clock_pelt()) | |
| 381 | 383 | * |
| 382 | 384 | * N.B., the above ratios (runnable% and running%) themselves are in the |
| 383 | 385 | * range of [0, 1]. To do fixed point arithmetics, we therefore scale them |
| @@ -401,11 +403,11 @@ struct util_est { · 17 unmodified lines | ||
| 401 | 403 | struct sched_avg { |
| 402 | 404 | u64 last_update_time; |
| 403 | 405 | u64 load_sum; |
| 404 | − u64 runnable_load_sum; | |
| 406 | + u64 runnable_sum; | |
| 405 | 407 | u32 util_sum; |
| 406 | 408 | u32 period_contrib; |
| 407 | 409 | unsigned long load_avg; |
| 408 | − unsigned long runnable_load_avg; | |
| 410 | + unsigned long runnable_avg; | |
| 409 | 411 | unsigned long util_avg; |
| 410 | 412 | struct util_est util_est; |
| 411 | 413 | } ____cacheline_aligned; |
| @@ -449,7 +451,6 @@ struct sched_statistics { · 37 unmodified lines | ||
| 449 | 451 | struct sched_entity { |
| 450 | 452 | /* For load-balancing: */ |
| 451 | 453 | struct load_weight load; |
| 452 | − unsigned long runnable_weight; | |
| 453 | 454 | struct rb_node run_node; |
| 454 | 455 | struct list_head group_node; |
| 455 | 456 | unsigned int on_rq; |
| @@ -470,6 +471,8 @@ struct sched_entity { · 14 unmodified lines | ||
| 470 | 471 | struct cfs_rq *cfs_rq; |
| 471 | 472 | /* rq "owned" by this entity/group: */ |
| 472 | 473 | struct cfs_rq *my_q; |
| 474 | + /* cached value of my_q->h_nr_running */ | |
| 475 | + unsigned long runnable_weight; | |
| 473 | 476 | #endif |
| 474 | 477 | |
| 475 | 478 | #ifdef CONFIG_SMP |
| @@ -782,9 +785,12 @@ struct task_struct { · 306 unmodified lines | ||
| 782 | 785 | unsigned frozen:1; |
| 783 | 786 | #endif |
| 784 | 787 | #ifdef CONFIG_BLK_CGROUP |
| 785 | − /* to be used once the psi infrastructure lands upstream. */ | |
| 786 | 788 | unsigned use_memdelay:1; |
| 787 | 789 | #endif |
| 790 | +#ifdef CONFIG_PSI | |
| 791 | + /* Stalled due to lack of memory */ | |
| 792 | + unsigned in_memstall:1; | |
| 793 | +#endif | |
| 788 | 794 | |
| 789 | 795 | unsigned long atomic_flags; /* Flags requiring atomic access. */ |
| 790 | 796 | |
| @@ -939,8 +945,8 @@ struct task_struct { · 148 unmodified lines | ||
| 939 | 945 | struct seccomp seccomp; |
| 940 | 946 | |
| 941 | 947 | /* Thread group tracking: */ |
| 942 | − u32 parent_exec_id; | |
| 943 | − u32 self_exec_id; | |
| 948 | + u64 parent_exec_id; | |
| 949 | + u64 self_exec_id; | |
| 944 | 950 | |
| 945 | 951 | /* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */ |
| 946 | 952 | spinlock_t alloc_lock; |
| @@ -970,6 +976,7 @@ struct task_struct { · 23 unmodified lines | ||
| 970 | 976 | |
| 971 | 977 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 972 | 978 | unsigned int irq_events; |
| 979 | + unsigned int hardirq_threaded; | |
| 973 | 980 | unsigned long hardirq_enable_ip; |
| 974 | 981 | unsigned long hardirq_disable_ip; |
| 975 | 982 | unsigned int hardirq_enable_event; |
| @@ -982,6 +989,7 @@ struct task_struct { · 6 unmodified lines | ||
| 982 | 989 | unsigned int softirq_enable_event; |
| 983 | 990 | int softirqs_enabled; |
| 984 | 991 | int softirq_context; |
| 992 | + int irq_config; | |
| 985 | 993 | #endif |
| 986 | 994 | |
| 987 | 995 | #ifdef CONFIG_LOCKDEP |
| @@ -1477,7 +1485,6 @@ extern struct pid *cad_pid; · 489 unmodified lines | ||
| 1477 | 1485 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ |
| 1478 | 1486 | #define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */ |
| 1479 | 1487 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
| 1480 | −#define PF_MEMSTALL 0x01000000 /* Stalled due to lack of memory */ | |
| 1481 | 1488 | #define PF_UMH 0x02000000 /* I'm an Usermodehelper process */ |
| 1482 | 1489 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ |
| 1483 | 1490 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
| @@ -10,6 +10,8 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <linux/cred.h> |
| 11 | 11 | #include <linux/refcount.h> |
| 12 | 12 | #include <linux/posix-timers.h> |
| 13 | +#include <linux/mm_types.h> | |
| 14 | +#include <asm/ptrace.h> | |
| 13 | 15 | |
| 14 | 16 | /* |
| 15 | 17 | * Types defining task->signal and task->sighand and APIs using them: |
| @@ -224,7 +226,14 @@ struct signal_struct { · 208 unmodified lines | ||
| 224 | 226 | |
| 225 | 227 | struct mutex cred_guard_mutex; /* guard against foreign influences on |
| 226 | 228 | * credential calculations |
| 227 | − * (notably. ptrace) */ | |
| 229 | + * (notably. ptrace) | |
| 230 | + * Deprecated do not use in new code. | |
| 231 | + * Use exec_update_mutex instead. | |
| 232 | + */ | |
| 233 | + struct mutex exec_update_mutex; /* Held while task_struct is being | |
| 234 | + * updated during exec, and may have | |
| 235 | + * inconsistent permissions. | |
| 236 | + */ | |
| 228 | 237 | } __randomize_layout; |
| 229 | 238 | |
| 230 | 239 | /* |
| @@ -369,6 +378,20 @@ static inline int signal_pending_state(long state, struct task_struct *p) · 138 unmodified lines | ||
| 369 | 378 | return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p); |
| 370 | 379 | } |
| 371 | 380 | |
| 381 | +/* | |
| 382 | + * This should only be used in fault handlers to decide whether we | |
| 383 | + * should stop the current fault routine to handle the signals | |
| 384 | + * instead, especially with the case where we've got interrupted with | |
| 385 | + * a VM_FAULT_RETRY. | |
| 386 | + */ | |
| 387 | +static inline bool fault_signal_pending(vm_fault_t fault_flags, | |
| 388 | + struct pt_regs *regs) | |
| 389 | +{ | |
| 390 | + return unlikely((fault_flags & VM_FAULT_RETRY) && | |
| 391 | + (fatal_signal_pending(current) || | |
| 392 | + (user_mode(regs) && signal_pending(current)))); | |
| 393 | +} | |
| 394 | + | |
| 372 | 395 | /* |
| 373 | 396 | * Reevaluate whether the task has signals pending delivery. |
| 374 | 397 | * Wake the task if so. |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | struct task_struct; |
| 14 | 14 | struct rusage; |
| 15 | 15 | union thread_union; |
| 16 | +struct css_set; | |
| 16 | 17 | |
| 17 | 18 | /* All the bits taken by the old clone syscall. */ |
| 18 | 19 | #define CLONE_LEGACY_FLAGS 0xffffffffULL |
| @@ -29,6 +30,9 @@ struct kernel_clone_args { · 10 unmodified lines | ||
| 29 | 30 | pid_t *set_tid; |
| 30 | 31 | /* Number of elements in *set_tid */ |
| 31 | 32 | size_t set_tid_size; |
| 33 | + int cgroup; | |
| 34 | + struct cgroup *cgrp; | |
| 35 | + struct css_set *cset; | |
| 32 | 36 | }; |
| 33 | 37 | |
| 34 | 38 | /* |
| @@ -225,6 +225,14 @@ unsigned long arch_scale_cpu_capacity(int cpu) · 224 unmodified lines | ||
| 225 | 225 | } |
| 226 | 226 | #endif |
| 227 | 227 | |
| 228 | +#ifndef arch_scale_thermal_pressure | |
| 229 | +static __always_inline | |
| 230 | +unsigned long arch_scale_thermal_pressure(int cpu) | |
| 231 | +{ | |
| 232 | + return 0; | |
| 233 | +} | |
| 234 | +#endif | |
| 235 | + | |
| 228 | 236 | static inline int task_node(const struct task_struct *p) |
| 229 | 237 | { |
| 230 | 238 | return cpu_to_node(task_cpu(p)); |
| @@ -7,7 +7,8 @@ · 6 unmodified lines | ||
| 7 | 7 | #define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \ |
| 8 | 8 | SECCOMP_FILTER_FLAG_LOG | \ |
| 9 | 9 | SECCOMP_FILTER_FLAG_SPEC_ALLOW | \ |
| 10 | − SECCOMP_FILTER_FLAG_NEW_LISTENER) | |
| 10 | + SECCOMP_FILTER_FLAG_NEW_LISTENER | \ | |
| 11 | + SECCOMP_FILTER_FLAG_TSYNC_ESRCH) | |
| 11 | 12 | |
| 12 | 13 | #ifdef CONFIG_SECCOMP |
| 13 | 14 | |
| @@ -30,7 +30,6 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <linux/err.h> |
| 31 | 31 | #include <linux/string.h> |
| 32 | 32 | #include <linux/mm.h> |
| 33 | −#include <linux/fs.h> | |
| 34 | 33 | |
| 35 | 34 | struct linux_binprm; |
| 36 | 35 | struct cred; |
| @@ -11,8 +11,8 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/tiocl.h> |
| 12 | 12 | #include <linux/vt_buffer.h> |
| 13 | 13 | |
| 14 | −extern struct vc_data *sel_cons; | |
| 15 | 14 | struct tty_struct; |
| 15 | +struct vc_data; | |
| 16 | 16 | |
| 17 | 17 | extern void clear_selection(void); |
| 18 | 18 | extern int set_selection_user(const struct tiocl_selection __user *sel, |
| @@ -24,6 +24,8 @@ extern int sel_loadlut(char __user *p); · 5 unmodified lines | ||
| 24 | 24 | extern int mouse_reporting(void); |
| 25 | 25 | extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry); |
| 26 | 26 | |
| 27 | +bool vc_is_sel(struct vc_data *vc); | |
| 28 | + | |
| 27 | 29 | extern int console_blanked; |
| 28 | 30 | |
| 29 | 31 | extern const unsigned char color_table[]; |
| @@ -21,7 +21,6 @@ struct seq_file { · 20 unmodified lines | ||
| 21 | 21 | size_t pad_until; |
| 22 | 22 | loff_t index; |
| 23 | 23 | loff_t read_pos; |
| 24 | − u64 version; | |
| 25 | 24 | struct mutex lock; |
| 26 | 25 | const struct seq_operations *op; |
| 27 | 26 | int poll_event; |
| @@ -81,6 +81,7 @@ struct uart_8250_em485 { · 80 unmodified lines | ||
| 81 | 81 | struct hrtimer stop_tx_timer; /* "rs485 stop tx" timer */ |
| 82 | 82 | struct hrtimer *active_timer; /* pointer to active timer */ |
| 83 | 83 | struct uart_8250_port *port; /* for hrtimer callbacks */ |
| 84 | + unsigned int tx_stopped:1; /* tx is currently stopped */ | |
| 84 | 85 | }; |
| 85 | 86 | |
| 86 | 87 | /* |
| @@ -132,6 +133,8 @@ struct uart_8250_port { · 45 unmodified lines | ||
| 132 | 133 | void (*dl_write)(struct uart_8250_port *, int); |
| 133 | 134 | |
| 134 | 135 | struct uart_8250_em485 *em485; |
| 136 | + void (*rs485_start_tx)(struct uart_8250_port *); | |
| 137 | + void (*rs485_stop_tx)(struct uart_8250_port *); | |
| 135 | 138 | |
| 136 | 139 | /* Serial port overrun backoff */ |
| 137 | 140 | struct delayed_work overrun_backoff; |
| @@ -176,6 +179,7 @@ void serial8250_set_defaults(struct uart_8250_port *up); · 38 unmodified lines | ||
| 176 | 179 | void serial8250_console_write(struct uart_8250_port *up, const char *s, |
| 177 | 180 | unsigned int count); |
| 178 | 181 | int serial8250_console_setup(struct uart_port *port, char *options, bool probe); |
| 182 | +int serial8250_console_exit(struct uart_port *port); | |
| 179 | 183 | |
| 180 | 184 | extern void serial8250_set_isa_configurator(void (*v) |
| 181 | 185 | (int port, struct uart_port *up, |
| @@ -243,6 +243,7 @@ struct uart_port { · 242 unmodified lines | ||
| 243 | 243 | unsigned long sysrq; /* sysrq timeout */ |
| 244 | 244 | unsigned int sysrq_ch; /* char for sysrq */ |
| 245 | 245 | unsigned char has_sysrq; |
| 246 | + unsigned char sysrq_seq; /* index in sysrq_toggle_seq */ | |
| 246 | 247 | |
| 247 | 248 | unsigned char hub6; /* this should be in the 8250 driver */ |
| 248 | 249 | unsigned char suspended; |
| @@ -461,8 +462,7 @@ extern void uart_insert_char(struct uart_port *port, unsigned int status, · 212 unmodified lines | ||
| 461 | 462 | |
| 462 | 463 | extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch); |
| 463 | 464 | extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch); |
| 464 | −extern void uart_unlock_and_check_sysrq(struct uart_port *port, | |
| 465 | − unsigned long irqflags); | |
| 465 | +extern void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags); | |
| 466 | 466 | extern int uart_handle_break(struct uart_port *port); |
| 467 | 467 | |
| 468 | 468 | /* |
| @@ -78,6 +78,7 @@ extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); · 77 unmodified lines | ||
| 78 | 78 | extern int shmem_unuse(unsigned int type, bool frontswap, |
| 79 | 79 | unsigned long *fs_pages_to_unuse); |
| 80 | 80 | |
| 81 | +extern bool shmem_huge_enabled(struct vm_area_struct *vma); | |
| 81 | 82 | extern unsigned long shmem_swap_usage(struct vm_area_struct *vma); |
| 82 | 83 | extern unsigned long shmem_partial_swap_usage(struct address_space *mapping, |
| 83 | 84 | pgoff_t start, pgoff_t end); |
| @@ -114,15 +115,6 @@ static inline bool shmem_file(struct file *file) · 30 unmodified lines | ||
| 114 | 115 | extern bool shmem_charge(struct inode *inode, long pages); |
| 115 | 116 | extern void shmem_uncharge(struct inode *inode, long pages); |
| 116 | 117 | |
| 117 | −#ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE | |
| 118 | −extern bool shmem_huge_enabled(struct vm_area_struct *vma); | |
| 119 | −#else | |
| 120 | −static inline bool shmem_huge_enabled(struct vm_area_struct *vma) | |
| 121 | −{ | |
| 122 | − return false; | |
| 123 | −} | |
| 124 | −#endif | |
| 125 | − | |
| 126 | 118 | #ifdef CONFIG_SHMEM |
| 127 | 119 | extern int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd, |
| 128 | 120 | struct vm_area_struct *dst_vma, |
| @@ -444,12 +444,12 @@ void signals_init(void); · 443 unmodified lines | ||
| 444 | 444 | int restore_altstack(const stack_t __user *); |
| 445 | 445 | int __save_altstack(stack_t __user *, unsigned long); |
| 446 | 446 | |
| 447 | −#define save_altstack_ex(uss, sp) do { \ | |
| 447 | +#define unsafe_save_altstack(uss, sp, label) do { \ | |
| 448 | 448 | stack_t __user *__uss = uss; \ |
| 449 | 449 | struct task_struct *t = current; \ |
| 450 | − put_user_ex((void __user *)t->sas_ss_sp, &__uss->ss_sp); \ | |
| 451 | − put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \ | |
| 452 | − put_user_ex(t->sas_ss_size, &__uss->ss_size); \ | |
| 450 | + unsafe_put_user((void __user *)t->sas_ss_sp, &__uss->ss_sp, label); \ | |
| 451 | + unsafe_put_user(t->sas_ss_flags, &__uss->ss_flags, label); \ | |
| 452 | + unsafe_put_user(t->sas_ss_size, &__uss->ss_size, label); \ | |
| 453 | 453 | if (t->sas_ss_flags & SS_AUTODISARM) \ |
| 454 | 454 | sas_ss_reset(t); \ |
| 455 | 455 | } while (0); |
| @@ -47,8 +47,8 @@ · 46 unmodified lines | ||
| 47 | 47 | * A. IP checksum related features |
| 48 | 48 | * |
| 49 | 49 | * Drivers advertise checksum offload capabilities in the features of a device. |
| 50 | − * From the stack's point of view these are capabilities offered by the driver, | |
| 51 | − * a driver typically only advertises features that it is capable of offloading | |
| 50 | + * From the stack's point of view these are capabilities offered by the driver. | |
| 51 | + * A driver typically only advertises features that it is capable of offloading | |
| 52 | 52 | * to its device. |
| 53 | 53 | * |
| 54 | 54 | * The checksum related features are: |
| @@ -63,7 +63,7 @@ · 8 unmodified lines | ||
| 63 | 63 | * TCP or UDP packets over IPv4. These are specifically |
| 64 | 64 | * unencapsulated packets of the form IPv4|TCP or |
| 65 | 65 | * IPv4|UDP where the Protocol field in the IPv4 header |
| 66 | − * is TCP or UDP. The IPv4 header may contain IP options | |
| 66 | + * is TCP or UDP. The IPv4 header may contain IP options. | |
| 67 | 67 | * This feature cannot be set in features for a device |
| 68 | 68 | * with NETIF_F_HW_CSUM also set. This feature is being |
| 69 | 69 | * DEPRECATED (see below). |
| @@ -79,13 +79,13 @@ · 9 unmodified lines | ||
| 79 | 79 | * DEPRECATED (see below). |
| 80 | 80 | * |
| 81 | 81 | * NETIF_F_RXCSUM - Driver (device) performs receive checksum offload. |
| 82 | − * This flag is used only used to disable the RX checksum | |
| 82 | + * This flag is only used to disable the RX checksum | |
| 83 | 83 | * feature for a device. The stack will accept receive |
| 84 | 84 | * checksum indication in packets received on a device |
| 85 | 85 | * regardless of whether NETIF_F_RXCSUM is set. |
| 86 | 86 | * |
| 87 | 87 | * B. Checksumming of received packets by device. Indication of checksum |
| 88 | − * verification is in set skb->ip_summed. Possible values are: | |
| 88 | + * verification is set in skb->ip_summed. Possible values are: | |
| 89 | 89 | * |
| 90 | 90 | * CHECKSUM_NONE: |
| 91 | 91 | * |
| @@ -115,16 +115,16 @@ · 23 unmodified lines | ||
| 115 | 115 | * the packet minus one that have been verified as CHECKSUM_UNNECESSARY. |
| 116 | 116 | * For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet |
| 117 | 117 | * and a device is able to verify the checksums for UDP (possibly zero), |
| 118 | − * GRE (checksum flag is set), and TCP-- skb->csum_level would be set to | |
| 118 | + * GRE (checksum flag is set) and TCP, skb->csum_level would be set to | |
| 119 | 119 | * two. If the device were only able to verify the UDP checksum and not |
| 120 | − * GRE, either because it doesn't support GRE checksum of because GRE | |
| 120 | + * GRE, either because it doesn't support GRE checksum or because GRE | |
| 121 | 121 | * checksum is bad, skb->csum_level would be set to zero (TCP checksum is |
| 122 | 122 | * not considered in this case). |
| 123 | 123 | * |
| 124 | 124 | * CHECKSUM_COMPLETE: |
| 125 | 125 | * |
| 126 | 126 | * This is the most generic way. The device supplied checksum of the _whole_ |
| 127 | − * packet as seen by netif_rx() and fills out in skb->csum. Meaning, the | |
| 127 | + * packet as seen by netif_rx() and fills in skb->csum. This means the | |
| 128 | 128 | * hardware doesn't need to parse L3/L4 headers to implement this. |
| 129 | 129 | * |
| 130 | 130 | * Notes: |
| @@ -153,8 +153,8 @@ · 22 unmodified lines | ||
| 153 | 153 | * from skb->csum_start up to the end, and to record/write the checksum at |
| 154 | 154 | * offset skb->csum_start + skb->csum_offset. A driver may verify that the |
| 155 | 155 | * csum_start and csum_offset values are valid values given the length and |
| 156 | − * offset of the packet, however they should not attempt to validate that the | |
| 157 | − * checksum refers to a legitimate transport layer checksum-- it is the | |
| 156 | + * offset of the packet, but it should not attempt to validate that the | |
| 157 | + * checksum refers to a legitimate transport layer checksum -- it is the | |
| 158 | 158 | * purview of the stack to validate that csum_start and csum_offset are set |
| 159 | 159 | * correctly. |
| 160 | 160 | * |
| @@ -178,18 +178,18 @@ · 17 unmodified lines | ||
| 178 | 178 | * |
| 179 | 179 | * CHECKSUM_UNNECESSARY: |
| 180 | 180 | * |
| 181 | − * This has the same meaning on as CHECKSUM_NONE for checksum offload on | |
| 181 | + * This has the same meaning as CHECKSUM_NONE for checksum offload on | |
| 182 | 182 | * output. |
| 183 | 183 | * |
| 184 | 184 | * CHECKSUM_COMPLETE: |
| 185 | 185 | * Not used in checksum output. If a driver observes a packet with this value |
| 186 | − * set in skbuff, if should treat as CHECKSUM_NONE being set. | |
| 186 | + * set in skbuff, it should treat the packet as if CHECKSUM_NONE were set. | |
| 187 | 187 | * |
| 188 | 188 | * D. Non-IP checksum (CRC) offloads |
| 189 | 189 | * |
| 190 | 190 | * NETIF_F_SCTP_CRC - This feature indicates that a device is capable of |
| 191 | 191 | * offloading the SCTP CRC in a packet. To perform this offload the stack |
| 192 | − * will set set csum_start and csum_offset accordingly, set ip_summed to | |
| 192 | + * will set csum_start and csum_offset accordingly, set ip_summed to | |
| 193 | 193 | * CHECKSUM_PARTIAL and set csum_not_inet to 1, to provide an indication in |
| 194 | 194 | * the skbuff that the CHECKSUM_PARTIAL refers to CRC32c. |
| 195 | 195 | * A driver that supports both IP checksum offload and SCTP CRC32c offload |
| @@ -200,10 +200,10 @@ · 4 unmodified lines | ||
| 200 | 200 | * NETIF_F_FCOE_CRC - This feature indicates that a device is capable of |
| 201 | 201 | * offloading the FCOE CRC in a packet. To perform this offload the stack |
| 202 | 202 | * will set ip_summed to CHECKSUM_PARTIAL and set csum_start and csum_offset |
| 203 | − * accordingly. Note the there is no indication in the skbuff that the | |
| 204 | − * CHECKSUM_PARTIAL refers to an FCOE checksum, a driver that supports | |
| 203 | + * accordingly. Note that there is no indication in the skbuff that the | |
| 204 | + * CHECKSUM_PARTIAL refers to an FCOE checksum, so a driver that supports | |
| 205 | 205 | * both IP checksum offload and FCOE CRC offload must verify which offload |
| 206 | − * is configured for a packet presumably by inspecting packet headers. | |
| 206 | + * is configured for a packet, presumably by inspecting packet headers. | |
| 207 | 207 | * |
| 208 | 208 | * E. Checksumming on output with GSO. |
| 209 | 209 | * |
| @@ -211,9 +211,9 @@ · 1 unmodified line | ||
| 211 | 211 | * is implied by the SKB_GSO_* flags in gso_type. Most obviously, if the |
| 212 | 212 | * gso_type is SKB_GSO_TCPV4 or SKB_GSO_TCPV6, TCP checksum offload as |
| 213 | 213 | * part of the GSO operation is implied. If a checksum is being offloaded |
| 214 | − * with GSO then ip_summed is CHECKSUM_PARTIAL, csum_start and csum_offset | |
| 215 | − * are set to refer to the outermost checksum being offload (two offloaded | |
| 216 | − * checksums are possible with UDP encapsulation). | |
| 214 | + * with GSO then ip_summed is CHECKSUM_PARTIAL, and both csum_start and | |
| 215 | + * csum_offset are set to refer to the outermost checksum being offloaded | |
| 216 | + * (two offloaded checksums are possible with UDP encapsulation). | |
| 217 | 217 | */ |
| 218 | 218 | |
| 219 | 219 | /* Don't change this without changing skb_csum_unnecessary! */ |
| @@ -645,8 +645,8 @@ typedef unsigned char *sk_buff_data_t; · 425 unmodified lines | ||
| 645 | 645 | * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware |
| 646 | 646 | * @tc_skip_classify: do not classify packet. set by IFB device |
| 647 | 647 | * @tc_at_ingress: used within tc_classify to distinguish in/egress |
| 648 | − * @tc_redirected: packet was redirected by a tc action | |
| 649 | − * @tc_from_ingress: if tc_redirected, tc_at_ingress at time of redirect | |
| 648 | + * @redirected: packet was redirected by packet classifier | |
| 649 | + * @from_ingress: packet was redirected from the ingress path | |
| 650 | 650 | * @peeked: this packet has been seen already, so stats have been |
| 651 | 651 | * done for it, don't do them again |
| 652 | 652 | * @nf_trace: netfilter packet trace flag |
| @@ -848,8 +848,10 @@ struct sk_buff { · 195 unmodified lines | ||
| 848 | 848 | #ifdef CONFIG_NET_CLS_ACT |
| 849 | 849 | __u8 tc_skip_classify:1; |
| 850 | 850 | __u8 tc_at_ingress:1; |
| 851 | − __u8 tc_redirected:1; | |
| 852 | − __u8 tc_from_ingress:1; | |
| 851 | +#endif | |
| 852 | +#ifdef CONFIG_NET_REDIRECT | |
| 853 | + __u8 redirected:1; | |
| 854 | + __u8 from_ingress:1; | |
| 853 | 855 | #endif |
| 854 | 856 | #ifdef CONFIG_TLS_DEVICE |
| 855 | 857 | __u8 decrypted:1; |
| @@ -3514,23 +3516,15 @@ int __skb_wait_for_more_packets(struct sock *sk, struct sk_buff_head *queue, · 2658 unmodified lines | ||
| 3514 | 3516 | struct sk_buff *__skb_try_recv_from_queue(struct sock *sk, |
| 3515 | 3517 | struct sk_buff_head *queue, |
| 3516 | 3518 | unsigned int flags, |
| 3517 | − void (*destructor)(struct sock *sk, | |
| 3518 | − struct sk_buff *skb), | |
| 3519 | 3519 | int *off, int *err, |
| 3520 | 3520 | struct sk_buff **last); |
| 3521 | 3521 | struct sk_buff *__skb_try_recv_datagram(struct sock *sk, |
| 3522 | 3522 | struct sk_buff_head *queue, |
| 3523 | − unsigned int flags, | |
| 3524 | − void (*destructor)(struct sock *sk, | |
| 3525 | − struct sk_buff *skb), | |
| 3526 | − int *off, int *err, | |
| 3523 | + unsigned int flags, int *off, int *err, | |
| 3527 | 3524 | struct sk_buff **last); |
| 3528 | 3525 | struct sk_buff *__skb_recv_datagram(struct sock *sk, |
| 3529 | 3526 | struct sk_buff_head *sk_queue, |
| 3530 | − unsigned int flags, | |
| 3531 | − void (*destructor)(struct sock *sk, | |
| 3532 | − struct sk_buff *skb), | |
| 3533 | − int *off, int *err); | |
| 3527 | + unsigned int flags, int *off, int *err); | |
| 3534 | 3528 | struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock, |
| 3535 | 3529 | int *err); |
| 3536 | 3530 | __poll_t datagram_poll(struct file *file, struct socket *sock, |
| @@ -4395,8 +4389,8 @@ struct skb_gso_cb { · 858 unmodified lines | ||
| 4395 | 4389 | __wsum csum; |
| 4396 | 4390 | __u16 csum_start; |
| 4397 | 4391 | }; |
| 4398 | −#define SKB_SGO_CB_OFFSET 32 | |
| 4399 | −#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET)) | |
| 4392 | +#define SKB_GSO_CB_OFFSET 32 | |
| 4393 | +#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_GSO_CB_OFFSET)) | |
| 4400 | 4394 | |
| 4401 | 4395 | static inline int skb_tnl_header_len(const struct sk_buff *inner_skb) |
| 4402 | 4396 | { |
| @@ -4579,5 +4573,31 @@ static inline __wsum lco_csum(struct sk_buff *skb) · 176 unmodified lines | ||
| 4579 | 4573 | return csum_partial(l4_hdr, csum_start - l4_hdr, partial); |
| 4580 | 4574 | } |
| 4581 | 4575 | |
| 4576 | +static inline bool skb_is_redirected(const struct sk_buff *skb) | |
| 4577 | +{ | |
| 4578 | +#ifdef CONFIG_NET_REDIRECT | |
| 4579 | + return skb->redirected; | |
| 4580 | +#else | |
| 4581 | + return false; | |
| 4582 | +#endif | |
| 4583 | +} | |
| 4584 | + | |
| 4585 | +static inline void skb_set_redirected(struct sk_buff *skb, bool from_ingress) | |
| 4586 | +{ | |
| 4587 | +#ifdef CONFIG_NET_REDIRECT | |
| 4588 | + skb->redirected = 1; | |
| 4589 | + skb->from_ingress = from_ingress; | |
| 4590 | + if (skb->from_ingress) | |
| 4591 | + skb->tstamp = 0; | |
| 4592 | +#endif | |
| 4593 | +} | |
| 4594 | + | |
| 4595 | +static inline void skb_reset_redirect(struct sk_buff *skb) | |
| 4596 | +{ | |
| 4597 | +#ifdef CONFIG_NET_REDIRECT | |
| 4598 | + skb->redirected = 0; | |
| 4599 | +#endif | |
| 4600 | +} | |
| 4601 | + | |
| 4582 | 4602 | #endif /* __KERNEL__ */ |
| 4583 | 4603 | #endif /* _LINUX_SKBUFF_H */ |
| @@ -323,14 +323,6 @@ static inline void sk_psock_free_link(struct sk_psock_link *link) · 322 unmodified lines | ||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | struct sk_psock_link *sk_psock_link_pop(struct sk_psock *psock); |
| 326 | −#if defined(CONFIG_BPF_STREAM_PARSER) | |
| 327 | −void sk_psock_unlink(struct sock *sk, struct sk_psock_link *link); | |
| 328 | −#else | |
| 329 | −static inline void sk_psock_unlink(struct sock *sk, | |
| 330 | − struct sk_psock_link *link) | |
| 331 | −{ | |
| 332 | −} | |
| 333 | −#endif | |
| 334 | 326 | |
| 335 | 327 | void __sk_psock_purge_ingress_msg(struct sk_psock *psock); |
| 336 | 328 | |
| @@ -347,33 +339,37 @@ static inline void sk_psock_update_proto(struct sock *sk, · 10 unmodified lines | ||
| 347 | 339 | struct sk_psock *psock, |
| 348 | 340 | struct proto *ops) |
| 349 | 341 | { |
| 350 | − psock->saved_unhash = sk->sk_prot->unhash; | |
| 351 | − psock->saved_close = sk->sk_prot->close; | |
| 352 | − psock->saved_write_space = sk->sk_write_space; | |
| 342 | + /* Initialize saved callbacks and original proto only once, since this | |
| 343 | + * function may be called multiple times for a psock, e.g. when | |
| 344 | + * psock->progs.msg_parser is updated. | |
| 345 | + * | |
| 346 | + * Since we've not installed the new proto, psock is not yet in use and | |
| 347 | + * we can initialize it without synchronization. | |
| 348 | + */ | |
| 349 | + if (!psock->sk_proto) { | |
| 350 | + struct proto *orig = READ_ONCE(sk->sk_prot); | |
| 353 | 351 | |
| 354 | − psock->sk_proto = sk->sk_prot; | |
| 355 | − sk->sk_prot = ops; | |
| 352 | + psock->saved_unhash = orig->unhash; | |
| 353 | + psock->saved_close = orig->close; | |
| 354 | + psock->saved_write_space = sk->sk_write_space; | |
| 355 | + | |
| 356 | + psock->sk_proto = orig; | |
| 357 | + } | |
| 358 | + | |
| 359 | + /* Pairs with lockless read in sk_clone_lock() */ | |
| 360 | + WRITE_ONCE(sk->sk_prot, ops); | |
| 356 | 361 | } |
| 357 | 362 | |
| 358 | 363 | static inline void sk_psock_restore_proto(struct sock *sk, |
| 359 | 364 | struct sk_psock *psock) |
| 360 | 365 | { |
| 361 | 366 | sk->sk_prot->unhash = psock->saved_unhash; |
| 362 | − | |
| 363 | − if (psock->sk_proto) { | |
| 364 | − struct inet_connection_sock *icsk = inet_csk(sk); | |
| 365 | − bool has_ulp = !!icsk->icsk_ulp_data; | |
| 366 | − | |
| 367 | − if (has_ulp) { | |
| 368 | − tcp_update_ulp(sk, psock->sk_proto, | |
| 369 | − psock->saved_write_space); | |
| 370 | − } else { | |
| 371 | − sk->sk_prot = psock->sk_proto; | |
| 372 | − sk->sk_write_space = psock->saved_write_space; | |
| 373 | − } | |
| 374 | − psock->sk_proto = NULL; | |
| 367 | + if (inet_csk_has_ulp(sk)) { | |
| 368 | + tcp_update_ulp(sk, psock->sk_proto, psock->saved_write_space); | |
| 375 | 369 | } else { |
| 376 | 370 | sk->sk_write_space = psock->saved_write_space; |
| 371 | + /* Pairs with lockless read in sk_clone_lock() */ | |
| 372 | + WRITE_ONCE(sk->sk_prot, psock->sk_proto); | |
| 377 | 373 | } |
| 378 | 374 | } |
| 379 | 375 | |
| @@ -395,26 +391,6 @@ static inline bool sk_psock_test_state(const struct sk_psock *psock, · 15 unmodified lines | ||
| 395 | 391 | return test_bit(bit, &psock->state); |
| 396 | 392 | } |
| 397 | 393 | |
| 398 | −static inline struct sk_psock *sk_psock_get_checked(struct sock *sk) | |
| 399 | −{ | |
| 400 | − struct sk_psock *psock; | |
| 401 | − | |
| 402 | − rcu_read_lock(); | |
| 403 | − psock = sk_psock(sk); | |
| 404 | − if (psock) { | |
| 405 | − if (sk->sk_prot->recvmsg != tcp_bpf_recvmsg) { | |
| 406 | − psock = ERR_PTR(-EBUSY); | |
| 407 | − goto out; | |
| 408 | − } | |
| 409 | − | |
| 410 | − if (!refcount_inc_not_zero(&psock->refcnt)) | |
| 411 | − psock = ERR_PTR(-EBUSY); | |
| 412 | − } | |
| 413 | −out: | |
| 414 | − rcu_read_unlock(); | |
| 415 | − return psock; | |
| 416 | −} | |
| 417 | − | |
| 418 | 394 | static inline struct sk_psock *sk_psock_get(struct sock *sk) |
| 419 | 395 | { |
| 420 | 396 | struct sk_psock *psock; |
| @@ -501,7 +501,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) · 500 unmodified lines | ||
| 501 | 501 | * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>` |
| 502 | 502 | * |
| 503 | 503 | * The recommended usage of the @flags is described at |
| 504 | − * :ref:`Documentation/core-api/memory-allocation.rst <memory-allocation>` | |
| 504 | + * :ref:`Documentation/core-api/memory-allocation.rst <memory_allocation>` | |
| 505 | 505 | * |
| 506 | 506 | * Below is a brief outline of the most useful GFP flags |
| 507 | 507 | * |
| @@ -85,6 +85,7 @@ struct apr_device { · 84 unmodified lines | ||
| 85 | 85 | uint16_t domain_id; |
| 86 | 86 | uint32_t version; |
| 87 | 87 | char name[APR_NAME_SIZE]; |
| 88 | + const char *service_path; | |
| 88 | 89 | spinlock_t lock; |
| 89 | 90 | struct list_head node; |
| 90 | 91 | }; |
| @@ -0,0 +1,29 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __QCOM_PDR_HELPER__ | |
| 3 | +#define __QCOM_PDR_HELPER__ | |
| 4 | + | |
| 5 | +#include <linux/soc/qcom/qmi.h> | |
| 6 | + | |
| 7 | +#define SERVREG_NAME_LENGTH 64 | |
| 8 | + | |
| 9 | +struct pdr_service; | |
| 10 | +struct pdr_handle; | |
| 11 | + | |
| 12 | +enum servreg_service_state { | |
| 13 | + SERVREG_LOCATOR_ERR = 0x1, | |
| 14 | + SERVREG_SERVICE_STATE_DOWN = 0x0FFFFFFF, | |
| 15 | + SERVREG_SERVICE_STATE_UP = 0x1FFFFFFF, | |
| 16 | + SERVREG_SERVICE_STATE_EARLY_DOWN = 0x2FFFFFFF, | |
| 17 | + SERVREG_SERVICE_STATE_UNINIT = 0x7FFFFFFF, | |
| 18 | +}; | |
| 19 | + | |
| 20 | +struct pdr_handle *pdr_handle_alloc(void (*status)(int state, | |
| 21 | + char *service_path, | |
| 22 | + void *priv), void *priv); | |
| 23 | +struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr, | |
| 24 | + const char *service_name, | |
| 25 | + const char *service_path); | |
| 26 | +int pdr_restart_pd(struct pdr_handle *pdr, struct pdr_service *pds); | |
| 27 | +void pdr_handle_release(struct pdr_handle *pdr); | |
| 28 | + | |
| 29 | +#endif | |
| @@ -88,6 +88,7 @@ struct qmi_elem_info { · 87 unmodified lines | ||
| 88 | 88 | #define QMI_ERR_CLIENT_IDS_EXHAUSTED_V01 5 |
| 89 | 89 | #define QMI_ERR_INVALID_ID_V01 41 |
| 90 | 90 | #define QMI_ERR_ENCODING_V01 58 |
| 91 | +#define QMI_ERR_DISABLED_V01 69 | |
| 91 | 92 | #define QMI_ERR_INCOMPATIBLE_STATE_V01 90 |
| 92 | 93 | #define QMI_ERR_NOT_SUPPORTED_V01 94 |
| 93 | 94 | |
| @@ -10,6 +10,7 @@ struct qcom_smd_rpm; · 9 unmodified lines | ||
| 10 | 10 | /* |
| 11 | 11 | * Constants used for addressing resources in the RPM. |
| 12 | 12 | */ |
| 13 | +#define QCOM_SMD_RPM_BBYB 0x62796262 | |
| 13 | 14 | #define QCOM_SMD_RPM_BOBB 0x62626f62 |
| 14 | 15 | #define QCOM_SMD_RPM_BOOST 0x61747362 |
| 15 | 16 | #define QCOM_SMD_RPM_BUS_CLK 0x316b6c63 |
| @@ -391,6 +391,10 @@ extern int recvmsg_copy_msghdr(struct msghdr *msg, · 390 unmodified lines | ||
| 391 | 391 | struct user_msghdr __user *umsg, unsigned flags, |
| 392 | 392 | struct sockaddr __user **uaddr, |
| 393 | 393 | struct iovec **iov); |
| 394 | +extern int __copy_msghdr_from_user(struct msghdr *kmsg, | |
| 395 | + struct user_msghdr __user *umsg, | |
| 396 | + struct sockaddr __user **save_addr, | |
| 397 | + struct iovec __user **uiov, size_t *nsegs); | |
| 394 | 398 | |
| 395 | 399 | /* helpers which do the actual work for syscalls */ |
| 396 | 400 | extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size, |
| @@ -401,7 +405,8 @@ extern int __sys_sendto(int fd, void __user *buff, size_t len, · 4 unmodified lines | ||
| 401 | 405 | int addr_len); |
| 402 | 406 | extern int __sys_accept4_file(struct file *file, unsigned file_flags, |
| 403 | 407 | struct sockaddr __user *upeer_sockaddr, |
| 404 | − int __user *upeer_addrlen, int flags); | |
| 408 | + int __user *upeer_addrlen, int flags, | |
| 409 | + unsigned long nofile); | |
| 405 | 410 | extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, |
| 406 | 411 | int __user *upeer_addrlen, int flags); |
| 407 | 412 | extern int __sys_socket(int family, int type, int protocol); |
| @@ -79,6 +79,21 @@ enum sdw_slave_status { · 78 unmodified lines | ||
| 79 | 79 | SDW_SLAVE_RESERVED = 3, |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | +/** | |
| 83 | + * enum sdw_clk_stop_type: clock stop operations | |
| 84 | + * | |
| 85 | + * @SDW_CLK_PRE_PREPARE: pre clock stop prepare | |
| 86 | + * @SDW_CLK_POST_PREPARE: post clock stop prepare | |
| 87 | + * @SDW_CLK_PRE_DEPREPARE: pre clock stop de-prepare | |
| 88 | + * @SDW_CLK_POST_DEPREPARE: post clock stop de-prepare | |
| 89 | + */ | |
| 90 | +enum sdw_clk_stop_type { | |
| 91 | + SDW_CLK_PRE_PREPARE = 0, | |
| 92 | + SDW_CLK_POST_PREPARE, | |
| 93 | + SDW_CLK_PRE_DEPREPARE, | |
| 94 | + SDW_CLK_POST_DEPREPARE, | |
| 95 | +}; | |
| 96 | + | |
| 82 | 97 | /** |
| 83 | 98 | * enum sdw_command_response - Command response as defined by SDW spec |
| 84 | 99 | * @SDW_CMD_OK: cmd was successful |
| @@ -284,6 +299,7 @@ struct sdw_dpn_audio_mode { · 199 unmodified lines | ||
| 284 | 299 | * @max_async_buffer: Number of samples that this port can buffer in |
| 285 | 300 | * asynchronous modes |
| 286 | 301 | * @block_pack_mode: Type of block port mode supported |
| 302 | + * @read_only_wordlength: Read Only wordlength field in DPN_BlockCtrl1 register | |
| 287 | 303 | * @port_encoding: Payload Channel Sample encoding schemes supported |
| 288 | 304 | * @audio_modes: Audio modes supported |
| 289 | 305 | */ |
| @@ -307,6 +323,7 @@ struct sdw_dpn_prop { · 17 unmodified lines | ||
| 307 | 323 | u32 modes; |
| 308 | 324 | u32 max_async_buffer; |
| 309 | 325 | bool block_pack_mode; |
| 326 | + bool read_only_wordlength; | |
| 310 | 327 | u32 port_encoding; |
| 311 | 328 | struct sdw_dpn_audio_mode *audio_modes; |
| 312 | 329 | }; |
| @@ -424,6 +441,29 @@ struct sdw_slave_id { · 111 unmodified lines | ||
| 424 | 441 | __u8 sdw_version:4; |
| 425 | 442 | }; |
| 426 | 443 | |
| 444 | +/* | |
| 445 | + * Helper macros to extract the MIPI-defined IDs | |
| 446 | + * | |
| 447 | + * Spec definition | |
| 448 | + * Register Bit Contents | |
| 449 | + * DevId_0 [7:4] 47:44 sdw_version | |
| 450 | + * DevId_0 [3:0] 43:40 unique_id | |
| 451 | + * DevId_1 39:32 mfg_id [15:8] | |
| 452 | + * DevId_2 31:24 mfg_id [7:0] | |
| 453 | + * DevId_3 23:16 part_id [15:8] | |
| 454 | + * DevId_4 15:08 part_id [7:0] | |
| 455 | + * DevId_5 07:00 class_id | |
| 456 | + * | |
| 457 | + * The MIPI DisCo for SoundWire defines in addition the link_id as bits 51:48 | |
| 458 | + */ | |
| 459 | + | |
| 460 | +#define SDW_DISCO_LINK_ID(adr) (((adr) >> 48) & GENMASK(3, 0)) | |
| 461 | +#define SDW_VERSION(adr) (((adr) >> 44) & GENMASK(3, 0)) | |
| 462 | +#define SDW_UNIQUE_ID(adr) (((adr) >> 40) & GENMASK(3, 0)) | |
| 463 | +#define SDW_MFG_ID(adr) (((adr) >> 24) & GENMASK(15, 0)) | |
| 464 | +#define SDW_PART_ID(adr) (((adr) >> 8) & GENMASK(15, 0)) | |
| 465 | +#define SDW_CLASS_ID(adr) ((adr) & GENMASK(7, 0)) | |
| 466 | + | |
| 427 | 467 | /** |
| 428 | 468 | * struct sdw_slave_intr_status - Slave interrupt status |
| 429 | 469 | * @control_port: control port status |
| @@ -533,6 +573,11 @@ struct sdw_slave_ops { · 103 unmodified lines | ||
| 533 | 573 | int (*port_prep)(struct sdw_slave *slave, |
| 534 | 574 | struct sdw_prepare_ch *prepare_ch, |
| 535 | 575 | enum sdw_port_prep_ops pre_ops); |
| 576 | + int (*get_clk_stop_mode)(struct sdw_slave *slave); | |
| 577 | + int (*clk_stop)(struct sdw_slave *slave, | |
| 578 | + enum sdw_clk_stop_mode mode, | |
| 579 | + enum sdw_clk_stop_type type); | |
| 580 | + | |
| 536 | 581 | }; |
| 537 | 582 | |
| 538 | 583 | /** |
| @@ -575,6 +620,7 @@ struct sdw_slave { · 36 unmodified lines | ||
| 575 | 620 | #endif |
| 576 | 621 | struct list_head node; |
| 577 | 622 | struct completion *port_ready; |
| 623 | + enum sdw_clk_stop_mode curr_clk_stop_mode; | |
| 578 | 624 | u16 dev_num; |
| 579 | 625 | u16 dev_num_sticky; |
| 580 | 626 | bool probed; |
| @@ -892,6 +938,9 @@ int sdw_prepare_stream(struct sdw_stream_runtime *stream); · 311 unmodified lines | ||
| 892 | 938 | int sdw_enable_stream(struct sdw_stream_runtime *stream); |
| 893 | 939 | int sdw_disable_stream(struct sdw_stream_runtime *stream); |
| 894 | 940 | int sdw_deprepare_stream(struct sdw_stream_runtime *stream); |
| 941 | +int sdw_bus_prep_clk_stop(struct sdw_bus *bus); | |
| 942 | +int sdw_bus_clk_stop(struct sdw_bus *bus); | |
| 943 | +int sdw_bus_exit_clk_stop(struct sdw_bus *bus); | |
| 895 | 944 | |
| 896 | 945 | /* messaging and data APIs */ |
| 897 | 946 | |
| @@ -11,9 +11,6 @@ struct corgi_lcd_platform_data { · 10 unmodified lines | ||
| 11 | 11 | int default_intensity; |
| 12 | 12 | int limit_mask; |
| 13 | 13 | |
| 14 | − int gpio_backlight_on; /* -1 if n/a */ | |
| 15 | − int gpio_backlight_cont; /* -1 if n/a */ | |
| 16 | − | |
| 17 | 14 | void (*notify)(int intensity); |
| 18 | 15 | void (*kick_battery)(void); |
| 19 | 16 | }; |
| @@ -3,12 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #define LINUX_IFX_MODEM_H |
| 4 | 4 | |
| 5 | 5 | struct ifx_modem_platform_data { |
| 6 | − unsigned short rst_out; /* modem reset out */ | |
| 7 | − unsigned short pwr_on; /* power on */ | |
| 8 | − unsigned short rst_pmu; /* reset modem */ | |
| 9 | 6 | unsigned short tx_pwr; /* modem power threshold */ |
| 10 | − unsigned short srdy; /* SRDY */ | |
| 11 | − unsigned short mrdy; /* MRDY */ | |
| 12 | 7 | unsigned char modem_type; /* Modem type */ |
| 13 | 8 | unsigned long max_hz; /* max SPI frequency */ |
| 14 | 9 | unsigned short use_dma:1; /* spi protocol driver supplies |
| @@ -135,6 +135,8 @@ extern int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer); · 134 unmodified lines | ||
| 135 | 135 | * @modalias: Name of the driver to use with this device, or an alias |
| 136 | 136 | * for that name. This appears in the sysfs "modalias" attribute |
| 137 | 137 | * for driver coldplugging, and in uevents used for hotplugging |
| 138 | + * @driver_override: If the name of a driver is written to this attribute, then | |
| 139 | + * the device will bind to the named driver and only the named driver. | |
| 138 | 140 | * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when |
| 139 | 141 | * not using a GPIO line) use cs_gpiod in new drivers by opting in on |
| 140 | 142 | * the spi_master. |
| @@ -443,6 +445,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 302 unmodified lines | ||
| 443 | 445 | * @spi_transfer->ptp_sts_word_post were transmitted. |
| 444 | 446 | * If the driver does not set this, the SPI core takes the snapshot as |
| 445 | 447 | * close to the driver hand-over as possible. |
| 448 | + * @irq_flags: Interrupt enable state during PTP system timestamping | |
| 446 | 449 | * |
| 447 | 450 | * Each SPI controller can communicate with one or more @spi_device |
| 448 | 451 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
| @@ -481,6 +484,9 @@ struct spi_controller { · 32 unmodified lines | ||
| 481 | 484 | /* spi_device.mode flags understood by this controller driver */ |
| 482 | 485 | u32 mode_bits; |
| 483 | 486 | |
| 487 | + /* spi_device.mode flags override flags for this controller */ | |
| 488 | + u32 buswidth_override_bits; | |
| 489 | + | |
| 484 | 490 | /* bitmask of supported bits_per_word for transfers */ |
| 485 | 491 | u32 bits_per_word_mask; |
| 486 | 492 | #define SPI_BPW_MASK(bits) BIT((bits) - 1) |
| @@ -930,8 +936,7 @@ struct spi_transfer { · 443 unmodified lines | ||
| 930 | 936 | |
| 931 | 937 | struct ptp_system_timestamp *ptp_sts; |
| 932 | 938 | |
| 933 | − bool timestamped_pre; | |
| 934 | − bool timestamped_post; | |
| 939 | + bool timestamped; | |
| 935 | 940 | |
| 936 | 941 | struct list_head transfer_list; |
| 937 | 942 | }; |
| @@ -93,12 +93,13 @@ · 92 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | #ifdef CONFIG_DEBUG_SPINLOCK |
| 95 | 95 | extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, |
| 96 | − struct lock_class_key *key); | |
| 97 | −# define raw_spin_lock_init(lock) \ | |
| 98 | −do { \ | |
| 99 | − static struct lock_class_key __key; \ | |
| 100 | − \ | |
| 101 | − __raw_spin_lock_init((lock), #lock, &__key); \ | |
| 96 | + struct lock_class_key *key, short inner); | |
| 97 | + | |
| 98 | +# define raw_spin_lock_init(lock) \ | |
| 99 | +do { \ | |
| 100 | + static struct lock_class_key __key; \ | |
| 101 | + \ | |
| 102 | + __raw_spin_lock_init((lock), #lock, &__key, LD_WAIT_SPIN); \ | |
| 102 | 103 | } while (0) |
| 103 | 104 | |
| 104 | 105 | #else |
| @@ -327,12 +328,26 @@ static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) · 222 unmodified lines | ||
| 327 | 328 | return &lock->rlock; |
| 328 | 329 | } |
| 329 | 330 | |
| 330 | −#define spin_lock_init(_lock) \ | |
| 331 | −do { \ | |
| 332 | − spinlock_check(_lock); \ | |
| 333 | − raw_spin_lock_init(&(_lock)->rlock); \ | |
| 331 | +#ifdef CONFIG_DEBUG_SPINLOCK | |
| 332 | + | |
| 333 | +# define spin_lock_init(lock) \ | |
| 334 | +do { \ | |
| 335 | + static struct lock_class_key __key; \ | |
| 336 | + \ | |
| 337 | + __raw_spin_lock_init(spinlock_check(lock), \ | |
| 338 | + #lock, &__key, LD_WAIT_CONFIG); \ | |
| 339 | +} while (0) | |
| 340 | + | |
| 341 | +#else | |
| 342 | + | |
| 343 | +# define spin_lock_init(_lock) \ | |
| 344 | +do { \ | |
| 345 | + spinlock_check(_lock); \ | |
| 346 | + *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \ | |
| 334 | 347 | } while (0) |
| 335 | 348 | |
| 349 | +#endif | |
| 350 | + | |
| 336 | 351 | static __always_inline void spin_lock(spinlock_t *lock) |
| 337 | 352 | { |
| 338 | 353 | raw_spin_lock(&lock->rlock); |
| @@ -33,8 +33,18 @@ typedef struct raw_spinlock { · 32 unmodified lines | ||
| 33 | 33 | #define SPINLOCK_OWNER_INIT ((void *)-1L) |
| 34 | 34 | |
| 35 | 35 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 36 | −# define SPIN_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } | |
| 36 | +# define RAW_SPIN_DEP_MAP_INIT(lockname) \ | |
| 37 | + .dep_map = { \ | |
| 38 | + .name = #lockname, \ | |
| 39 | + .wait_type_inner = LD_WAIT_SPIN, \ | |
| 40 | + } | |
| 41 | +# define SPIN_DEP_MAP_INIT(lockname) \ | |
| 42 | + .dep_map = { \ | |
| 43 | + .name = #lockname, \ | |
| 44 | + .wait_type_inner = LD_WAIT_CONFIG, \ | |
| 45 | + } | |
| 37 | 46 | #else |
| 47 | +# define RAW_SPIN_DEP_MAP_INIT(lockname) | |
| 38 | 48 | # define SPIN_DEP_MAP_INIT(lockname) |
| 39 | 49 | #endif |
| 40 | 50 | |
| @@ -51,7 +61,7 @@ typedef struct raw_spinlock { · 10 unmodified lines | ||
| 51 | 61 | { \ |
| 52 | 62 | .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \ |
| 53 | 63 | SPIN_DEBUG_INIT(lockname) \ |
| 54 | − SPIN_DEP_MAP_INIT(lockname) } | |
| 64 | + RAW_SPIN_DEP_MAP_INIT(lockname) } | |
| 55 | 65 | |
| 56 | 66 | #define __RAW_SPIN_LOCK_UNLOCKED(lockname) \ |
| 57 | 67 | (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname) |
| @@ -72,11 +82,17 @@ typedef struct spinlock { · 14 unmodified lines | ||
| 72 | 82 | }; |
| 73 | 83 | } spinlock_t; |
| 74 | 84 | |
| 85 | +#define ___SPIN_LOCK_INITIALIZER(lockname) \ | |
| 86 | + { \ | |
| 87 | + .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \ | |
| 88 | + SPIN_DEBUG_INIT(lockname) \ | |
| 89 | + SPIN_DEP_MAP_INIT(lockname) } | |
| 90 | + | |
| 75 | 91 | #define __SPIN_LOCK_INITIALIZER(lockname) \ |
| 76 | − { { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } } | |
| 92 | + { { .rlock = ___SPIN_LOCK_INITIALIZER(lockname) } } | |
| 77 | 93 | |
| 78 | 94 | #define __SPIN_LOCK_UNLOCKED(lockname) \ |
| 79 | − (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) | |
| 95 | + (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname) | |
| 80 | 96 | |
| 81 | 97 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) |
| 82 | 98 | |
| @@ -78,6 +78,9 @@ extern ssize_t add_to_pipe(struct pipe_inode_info *, · 77 unmodified lines | ||
| 78 | 78 | struct pipe_buffer *); |
| 79 | 79 | extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, |
| 80 | 80 | splice_direct_actor *); |
| 81 | +extern long do_splice(struct file *in, loff_t __user *off_in, | |
| 82 | + struct file *out, loff_t __user *off_out, | |
| 83 | + size_t len, unsigned int flags); | |
| 81 | 84 | |
| 82 | 85 | /* |
| 83 | 86 | * for dynamic pipe sizing |
| @@ -19,4 +19,6 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries, · 18 unmodified lines | ||
| 19 | 19 | unsigned int stack_depot_fetch(depot_stack_handle_t handle, |
| 20 | 20 | unsigned long **entries); |
| 21 | 21 | |
| 22 | +unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries); | |
| 23 | + | |
| 22 | 24 | #endif |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | #include <linux/sched.h> |
| 7 | 7 | #include <linux/random.h> |
| 8 | 8 | |
| 9 | −#ifdef CONFIG_STACKPROTECTOR | |
| 9 | +#if defined(CONFIG_STACKPROTECTOR) || defined(CONFIG_ARM64_PTR_AUTH) | |
| 10 | 10 | # include <asm/stackprotector.h> |
| 11 | 11 | #else |
| 12 | 12 | static inline void boot_init_stack_canary(void) |
| @@ -80,6 +80,7 @@ · 79 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | struct stmmac_mdio_bus_data { |
| 82 | 82 | unsigned int phy_mask; |
| 83 | + unsigned int has_xpcs; | |
| 83 | 84 | int *irqs; |
| 84 | 85 | int probed_phy_irq; |
| 85 | 86 | bool needs_reset; |
| @@ -179,6 +179,9 @@ sunrpc_cache_update(struct cache_detail *detail, · 178 unmodified lines | ||
| 179 | 179 | |
| 180 | 180 | extern int |
| 181 | 181 | sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h); |
| 182 | +extern int | |
| 183 | +sunrpc_cache_pipe_upcall_timeout(struct cache_detail *detail, | |
| 184 | + struct cache_head *h); | |
| 182 | 185 | |
| 183 | 186 | |
| 184 | 187 | extern void cache_clean_deferred(void *owner); |
| @@ -206,11 +209,11 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd) · 21 unmodified lines | ||
| 206 | 209 | |
| 207 | 210 | static inline bool cache_is_expired(struct cache_detail *detail, struct cache_head *h) |
| 208 | 211 | { |
| 212 | + if (h->expiry_time < seconds_since_boot()) | |
| 213 | + return true; | |
| 209 | 214 | if (!test_bit(CACHE_VALID, &h->flags)) |
| 210 | 215 | return false; |
| 211 | − | |
| 212 | − return (h->expiry_time < seconds_since_boot()) || | |
| 213 | − (detail->flush_time >= h->last_refresh); | |
| 216 | + return detail->flush_time >= h->last_refresh; | |
| 214 | 217 | } |
| 215 | 218 | |
| 216 | 219 | extern int cache_check(struct cache_detail *detail, |
| @@ -58,7 +58,8 @@ enum { · 57 unmodified lines | ||
| 58 | 58 | enum { |
| 59 | 59 | rpcrdma_fixed_maxsz = 4, |
| 60 | 60 | rpcrdma_segment_maxsz = 4, |
| 61 | − rpcrdma_readchunk_maxsz = 2 + rpcrdma_segment_maxsz, | |
| 61 | + rpcrdma_readseg_maxsz = 1 + rpcrdma_segment_maxsz, | |
| 62 | + rpcrdma_readchunk_maxsz = 1 + rpcrdma_readseg_maxsz, | |
| 62 | 63 | }; |
| 63 | 64 | |
| 64 | 65 | /* |
| @@ -132,6 +132,7 @@ struct rpc_task_setup { · 131 unmodified lines | ||
| 132 | 132 | #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ |
| 133 | 133 | #define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ |
| 134 | 134 | #define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */ |
| 135 | +#define RPC_TASK_CRED_NOREF 0x8000 /* No refcount on the credential */ | |
| 135 | 136 | |
| 136 | 137 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) |
| 137 | 138 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
| @@ -380,7 +380,7 @@ struct svc_deferred_req { · 379 unmodified lines | ||
| 380 | 380 | struct cache_deferred_req handle; |
| 381 | 381 | size_t xprt_hlen; |
| 382 | 382 | int argslen; |
| 383 | − __be32 args[0]; | |
| 383 | + __be32 args[]; | |
| 384 | 384 | }; |
| 385 | 385 | |
| 386 | 386 | struct svc_process_info { |
| @@ -517,6 +517,9 @@ void svc_wake_up(struct svc_serv *); · 130 unmodified lines | ||
| 517 | 517 | void svc_reserve(struct svc_rqst *rqstp, int space); |
| 518 | 518 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); |
| 519 | 519 | char * svc_print_addr(struct svc_rqst *, char *, size_t); |
| 520 | +int svc_encode_read_payload(struct svc_rqst *rqstp, | |
| 521 | + unsigned int offset, | |
| 522 | + unsigned int length); | |
| 520 | 523 | unsigned int svc_fill_write_vector(struct svc_rqst *rqstp, |
| 521 | 524 | struct page **pages, |
| 522 | 525 | struct kvec *first, size_t total); |
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | /* Default and maximum inline threshold sizes */ |
| 54 | 54 | enum { |
| 55 | + RPCRDMA_PULLUP_THRESH = RPCRDMA_V1_DEF_INLINE_SIZE >> 1, | |
| 55 | 56 | RPCRDMA_DEF_INLINE_THRESH = 4096, |
| 56 | 57 | RPCRDMA_MAX_INLINE_THRESH = 65536 |
| 57 | 58 | }; |
| @@ -132,11 +133,16 @@ struct svc_rdma_recv_ctxt { · 74 unmodified lines | ||
| 132 | 133 | struct ib_sge rc_recv_sge; |
| 133 | 134 | void *rc_recv_buf; |
| 134 | 135 | struct xdr_buf rc_arg; |
| 136 | + struct xdr_stream rc_stream; | |
| 135 | 137 | bool rc_temp; |
| 136 | 138 | u32 rc_byte_len; |
| 137 | 139 | unsigned int rc_page_count; |
| 138 | 140 | unsigned int rc_hdr_count; |
| 139 | 141 | u32 rc_inv_rkey; |
| 142 | + __be32 *rc_write_list; | |
| 143 | + __be32 *rc_reply_chunk; | |
| 144 | + unsigned int rc_read_payload_offset; | |
| 145 | + unsigned int rc_read_payload_length; | |
| 140 | 146 | struct page *rc_pages[RPCSVC_MAXPAGES]; |
| 141 | 147 | }; |
| 142 | 148 | |
| @@ -144,6 +150,8 @@ struct svc_rdma_send_ctxt { · 1 unmodified line | ||
| 144 | 150 | struct list_head sc_list; |
| 145 | 151 | struct ib_send_wr sc_send_wr; |
| 146 | 152 | struct ib_cqe sc_cqe; |
| 153 | + struct xdr_buf sc_hdrbuf; | |
| 154 | + struct xdr_stream sc_stream; | |
| 147 | 155 | void *sc_xprt_buf; |
| 148 | 156 | int sc_page_count; |
| 149 | 157 | int sc_cur_sge_no; |
| @@ -170,9 +178,11 @@ extern int svc_rdma_recv_read_chunk(struct svcxprt_rdma *rdma, · 20 unmodified lines | ||
| 170 | 178 | struct svc_rqst *rqstp, |
| 171 | 179 | struct svc_rdma_recv_ctxt *head, __be32 *p); |
| 172 | 180 | extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma, |
| 173 | − __be32 *wr_ch, struct xdr_buf *xdr); | |
| 181 | + __be32 *wr_ch, struct xdr_buf *xdr, | |
| 182 | + unsigned int offset, | |
| 183 | + unsigned long length); | |
| 174 | 184 | extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, |
| 175 | − __be32 *rp_ch, bool writelist, | |
| 185 | + const struct svc_rdma_recv_ctxt *rctxt, | |
| 176 | 186 | struct xdr_buf *xdr); |
| 177 | 187 | |
| 178 | 188 | /* svc_rdma_sendto.c */ |
| @@ -182,13 +192,13 @@ extern struct svc_rdma_send_ctxt * · 3 unmodified lines | ||
| 182 | 192 | extern void svc_rdma_send_ctxt_put(struct svcxprt_rdma *rdma, |
| 183 | 193 | struct svc_rdma_send_ctxt *ctxt); |
| 184 | 194 | extern int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr); |
| 185 | −extern void svc_rdma_sync_reply_hdr(struct svcxprt_rdma *rdma, | |
| 186 | − struct svc_rdma_send_ctxt *ctxt, | |
| 187 | − unsigned int len); | |
| 188 | 195 | extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma, |
| 189 | − struct svc_rdma_send_ctxt *ctxt, | |
| 190 | − struct xdr_buf *xdr, __be32 *wr_lst); | |
| 196 | + struct svc_rdma_send_ctxt *sctxt, | |
| 197 | + const struct svc_rdma_recv_ctxt *rctxt, | |
| 198 | + struct xdr_buf *xdr); | |
| 191 | 199 | extern int svc_rdma_sendto(struct svc_rqst *); |
| 200 | +extern int svc_rdma_read_payload(struct svc_rqst *rqstp, unsigned int offset, | |
| 201 | + unsigned int length); | |
| 192 | 202 | |
| 193 | 203 | /* svc_rdma_transport.c */ |
| 194 | 204 | extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); |
| @@ -21,6 +21,8 @@ struct svc_xprt_ops { · 20 unmodified lines | ||
| 21 | 21 | int (*xpo_has_wspace)(struct svc_xprt *); |
| 22 | 22 | int (*xpo_recvfrom)(struct svc_rqst *); |
| 23 | 23 | int (*xpo_sendto)(struct svc_rqst *); |
| 24 | + int (*xpo_read_payload)(struct svc_rqst *, unsigned int, | |
| 25 | + unsigned int); | |
| 24 | 26 | void (*xpo_release_rqst)(struct svc_rqst *); |
| 25 | 27 | void (*xpo_detach)(struct svc_xprt *); |
| 26 | 28 | void (*xpo_free)(struct svc_xprt *); |
| @@ -184,24 +184,9 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p) · 183 unmodified lines | ||
| 184 | 184 | extern void xdr_shift_buf(struct xdr_buf *, size_t); |
| 185 | 185 | extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); |
| 186 | 186 | extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int); |
| 187 | −extern int xdr_buf_read_mic(struct xdr_buf *, struct xdr_netobj *, unsigned int); | |
| 188 | 187 | extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); |
| 189 | 188 | extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); |
| 190 | 189 | |
| 191 | −/* | |
| 192 | − * Helper structure for copying from an sk_buff. | |
| 193 | − */ | |
| 194 | −struct xdr_skb_reader { | |
| 195 | − struct sk_buff *skb; | |
| 196 | − unsigned int offset; | |
| 197 | − size_t count; | |
| 198 | − __wsum csum; | |
| 199 | −}; | |
| 200 | − | |
| 201 | −typedef size_t (*xdr_skb_read_actor)(struct xdr_skb_reader *desc, void *to, size_t len); | |
| 202 | − | |
| 203 | −extern int csum_partial_copy_to_xdr(struct xdr_buf *, struct sk_buff *); | |
| 204 | − | |
| 205 | 190 | extern int xdr_encode_word(struct xdr_buf *, unsigned int, u32); |
| 206 | 191 | extern int xdr_decode_word(struct xdr_buf *, unsigned int, u32 *); |
| 207 | 192 | |
| @@ -300,6 +285,59 @@ xdr_align_size(size_t n) · 92 unmodified lines | ||
| 300 | 285 | return (n + mask) & ~mask; |
| 301 | 286 | } |
| 302 | 287 | |
| 288 | +/** | |
| 289 | + * xdr_pad_size - Calculate size of an object's pad | |
| 290 | + * @n: Size of an object being XDR encoded (in bytes) | |
| 291 | + * | |
| 292 | + * This implementation avoids the need for conditional | |
| 293 | + * branches or modulo division. | |
| 294 | + * | |
| 295 | + * Return value: | |
| 296 | + * Size (in bytes) of the needed XDR pad | |
| 297 | + */ | |
| 298 | +static inline size_t xdr_pad_size(size_t n) | |
| 299 | +{ | |
| 300 | + return xdr_align_size(n) - n; | |
| 301 | +} | |
| 302 | + | |
| 303 | +/** | |
| 304 | + * xdr_stream_encode_item_present - Encode a "present" list item | |
| 305 | + * @xdr: pointer to xdr_stream | |
| 306 | + * | |
| 307 | + * Return values: | |
| 308 | + * On success, returns length in bytes of XDR buffer consumed | |
| 309 | + * %-EMSGSIZE on XDR buffer overflow | |
| 310 | + */ | |
| 311 | +static inline ssize_t xdr_stream_encode_item_present(struct xdr_stream *xdr) | |
| 312 | +{ | |
| 313 | + const size_t len = sizeof(__be32); | |
| 314 | + __be32 *p = xdr_reserve_space(xdr, len); | |
| 315 | + | |
| 316 | + if (unlikely(!p)) | |
| 317 | + return -EMSGSIZE; | |
| 318 | + *p = xdr_one; | |
| 319 | + return len; | |
| 320 | +} | |
| 321 | + | |
| 322 | +/** | |
| 323 | + * xdr_stream_encode_item_absent - Encode a "not present" list item | |
| 324 | + * @xdr: pointer to xdr_stream | |
| 325 | + * | |
| 326 | + * Return values: | |
| 327 | + * On success, returns length in bytes of XDR buffer consumed | |
| 328 | + * %-EMSGSIZE on XDR buffer overflow | |
| 329 | + */ | |
| 330 | +static inline int xdr_stream_encode_item_absent(struct xdr_stream *xdr) | |
| 331 | +{ | |
| 332 | + const size_t len = sizeof(__be32); | |
| 333 | + __be32 *p = xdr_reserve_space(xdr, len); | |
| 334 | + | |
| 335 | + if (unlikely(!p)) | |
| 336 | + return -EMSGSIZE; | |
| 337 | + *p = xdr_zero; | |
| 338 | + return len; | |
| 339 | +} | |
| 340 | + | |
| 303 | 341 | /** |
| 304 | 342 | * xdr_stream_encode_u32 - Encode a 32-bit integer |
| 305 | 343 | * @xdr: pointer to xdr_stream |
| @@ -566,38 +566,4 @@ static inline void queue_up_suspend_work(void) {} · 565 unmodified lines | ||
| 566 | 566 | |
| 567 | 567 | #endif /* !CONFIG_PM_AUTOSLEEP */ |
| 568 | 568 | |
| 569 | −#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS | |
| 570 | −/* | |
| 571 | − * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture | |
| 572 | − * to save/restore additional information to/from the array of page | |
| 573 | − * frame numbers in the hibernation image. For s390 this is used to | |
| 574 | − * save and restore the storage key for each page that is included | |
| 575 | − * in the hibernation image. | |
| 576 | − */ | |
| 577 | −unsigned long page_key_additional_pages(unsigned long pages); | |
| 578 | −int page_key_alloc(unsigned long pages); | |
| 579 | −void page_key_free(void); | |
| 580 | −void page_key_read(unsigned long *pfn); | |
| 581 | −void page_key_memorize(unsigned long *pfn); | |
| 582 | −void page_key_write(void *address); | |
| 583 | − | |
| 584 | −#else /* !CONFIG_ARCH_SAVE_PAGE_KEYS */ | |
| 585 | − | |
| 586 | −static inline unsigned long page_key_additional_pages(unsigned long pages) | |
| 587 | −{ | |
| 588 | − return 0; | |
| 589 | −} | |
| 590 | − | |
| 591 | −static inline int page_key_alloc(unsigned long pages) | |
| 592 | −{ | |
| 593 | − return 0; | |
| 594 | −} | |
| 595 | − | |
| 596 | −static inline void page_key_free(void) {} | |
| 597 | −static inline void page_key_read(unsigned long *pfn) {} | |
| 598 | −static inline void page_key_memorize(unsigned long *pfn) {} | |
| 599 | −static inline void page_key_write(void *address) {} | |
| 600 | − | |
| 601 | −#endif /* !CONFIG_ARCH_SAVE_PAGE_KEYS */ | |
| 602 | − | |
| 603 | 569 | #endif /* _LINUX_SUSPEND_H */ |
| @@ -374,7 +374,6 @@ extern int sysctl_min_slab_ratio; · 373 unmodified lines | ||
| 374 | 374 | #define node_reclaim_mode 0 |
| 375 | 375 | #endif |
| 376 | 376 | |
| 377 | −extern int page_evictable(struct page *page); | |
| 378 | 377 | extern void check_move_unevictable_pages(struct pagevec *pvec); |
| 379 | 378 | |
| 380 | 379 | extern int kswapd_run(int nid); |
| @@ -68,6 +68,8 @@ static inline swp_entry_t pte_to_swp_entry(pte_t pte) · 67 unmodified lines | ||
| 68 | 68 | |
| 69 | 69 | if (pte_swp_soft_dirty(pte)) |
| 70 | 70 | pte = pte_swp_clear_soft_dirty(pte); |
| 71 | + if (pte_swp_uffd_wp(pte)) | |
| 72 | + pte = pte_swp_clear_uffd_wp(pte); | |
| 71 | 73 | arch_entry = __pte_to_swp_entry(pte); |
| 72 | 74 | return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry)); |
| 73 | 75 | } |
| @@ -348,7 +350,8 @@ static inline void num_poisoned_pages_inc(void) · 274 unmodified lines | ||
| 348 | 350 | } |
| 349 | 351 | #endif |
| 350 | 352 | |
| 351 | −#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) | |
| 353 | +#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) || \ | |
| 354 | + defined(CONFIG_DEVICE_PRIVATE) | |
| 352 | 355 | static inline int non_swap_entry(swp_entry_t entry) |
| 353 | 356 | { |
| 354 | 357 | return swp_type(entry) >= MAX_SWAPFILES; |
| @@ -297,9 +297,10 @@ int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name, · 296 unmodified lines | ||
| 297 | 297 | struct kobject *target, const char *link_name); |
| 298 | 298 | void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name, |
| 299 | 299 | const char *link_name); |
| 300 | −int __compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj, | |
| 301 | − struct kobject *target_kobj, | |
| 302 | − const char *target_name); | |
| 300 | +int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj, | |
| 301 | + struct kobject *target_kobj, | |
| 302 | + const char *target_name, | |
| 303 | + const char *symlink_name); | |
| 303 | 304 | |
| 304 | 305 | void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); |
| 305 | 306 | |
| @@ -310,6 +311,18 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) · 4 unmodified lines | ||
| 310 | 311 | return kernfs_enable_ns(kn); |
| 311 | 312 | } |
| 312 | 313 | |
| 314 | +int sysfs_file_change_owner(struct kobject *kobj, const char *name, kuid_t kuid, | |
| 315 | + kgid_t kgid); | |
| 316 | +int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid); | |
| 317 | +int sysfs_link_change_owner(struct kobject *kobj, struct kobject *targ, | |
| 318 | + const char *name, kuid_t kuid, kgid_t kgid); | |
| 319 | +int sysfs_groups_change_owner(struct kobject *kobj, | |
| 320 | + const struct attribute_group **groups, | |
| 321 | + kuid_t kuid, kgid_t kgid); | |
| 322 | +int sysfs_group_change_owner(struct kobject *kobj, | |
| 323 | + const struct attribute_group *groups, kuid_t kuid, | |
| 324 | + kgid_t kgid); | |
| 325 | + | |
| 313 | 326 | #else /* CONFIG_SYSFS */ |
| 314 | 327 | |
| 315 | 328 | static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) |
| @@ -500,10 +513,10 @@ static inline void sysfs_remove_link_from_group(struct kobject *kobj, · 184 unmodified lines | ||
| 500 | 513 | { |
| 501 | 514 | } |
| 502 | 515 | |
| 503 | −static inline int __compat_only_sysfs_link_entry_to_kobj( | |
| 504 | − struct kobject *kobj, | |
| 505 | − struct kobject *target_kobj, | |
| 506 | − const char *target_name) | |
| 516 | +static inline int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj, | |
| 517 | + struct kobject *target_kobj, | |
| 518 | + const char *target_name, | |
| 519 | + const char *symlink_name) | |
| 507 | 520 | { |
| 508 | 521 | return 0; |
| 509 | 522 | } |
| @@ -522,6 +535,40 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) · 12 unmodified lines | ||
| 522 | 535 | { |
| 523 | 536 | } |
| 524 | 537 | |
| 538 | +static inline int sysfs_file_change_owner(struct kobject *kobj, | |
| 539 | + const char *name, kuid_t kuid, | |
| 540 | + kgid_t kgid) | |
| 541 | +{ | |
| 542 | + return 0; | |
| 543 | +} | |
| 544 | + | |
| 545 | +static inline int sysfs_link_change_owner(struct kobject *kobj, | |
| 546 | + struct kobject *targ, | |
| 547 | + const char *name, kuid_t kuid, | |
| 548 | + kgid_t kgid) | |
| 549 | +{ | |
| 550 | + return 0; | |
| 551 | +} | |
| 552 | + | |
| 553 | +static inline int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid) | |
| 554 | +{ | |
| 555 | + return 0; | |
| 556 | +} | |
| 557 | + | |
| 558 | +static inline int sysfs_groups_change_owner(struct kobject *kobj, | |
| 559 | + const struct attribute_group **groups, | |
| 560 | + kuid_t kuid, kgid_t kgid) | |
| 561 | +{ | |
| 562 | + return 0; | |
| 563 | +} | |
| 564 | + | |
| 565 | +static inline int sysfs_group_change_owner(struct kobject *kobj, | |
| 566 | + const struct attribute_group *groups, | |
| 567 | + kuid_t kuid, kgid_t kgid) | |
| 568 | +{ | |
| 569 | + return 0; | |
| 570 | +} | |
| 571 | + | |
| 525 | 572 | #endif /* CONFIG_SYSFS */ |
| 526 | 573 | |
| 527 | 574 | static inline int __must_check sysfs_create_file(struct kobject *kobj, |
| @@ -50,6 +50,7 @@ int unregister_sysrq_key(int key, struct sysrq_key_op *op); · 49 unmodified lines | ||
| 50 | 50 | struct sysrq_key_op *__sysrq_get_key_op(int key); |
| 51 | 51 | |
| 52 | 52 | int sysrq_toggle_support(int enable_mask); |
| 53 | +int sysrq_mask(void); | |
| 53 | 54 | |
| 54 | 55 | #else |
| 55 | 56 | |
| @@ -71,6 +72,12 @@ static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op) · 15 unmodified lines | ||
| 71 | 72 | return -EINVAL; |
| 72 | 73 | } |
| 73 | 74 | |
| 75 | +static inline int sysrq_mask(void) | |
| 76 | +{ | |
| 77 | + /* Magic SysRq disabled mask */ | |
| 78 | + return 0; | |
| 79 | +} | |
| 80 | + | |
| 74 | 81 | #endif |
| 75 | 82 | |
| 76 | 83 | #endif /* _LINUX_SYSRQ_H */ |
| @@ -86,9 +86,19 @@ struct mptcp_options_received { · 85 unmodified lines | ||
| 86 | 86 | u64 data_seq; |
| 87 | 87 | u32 subflow_seq; |
| 88 | 88 | u16 data_len; |
| 89 | − u8 mp_capable : 1, | |
| 89 | + u16 mp_capable : 1, | |
| 90 | 90 | mp_join : 1, |
| 91 | − dss : 1; | |
| 91 | + dss : 1, | |
| 92 | + add_addr : 1, | |
| 93 | + rm_addr : 1, | |
| 94 | + family : 4, | |
| 95 | + echo : 1, | |
| 96 | + backup : 1; | |
| 97 | + u32 token; | |
| 98 | + u32 nonce; | |
| 99 | + u64 thmac; | |
| 100 | + u8 hmac[20]; | |
| 101 | + u8 join_id; | |
| 92 | 102 | u8 use_map:1, |
| 93 | 103 | dsn64:1, |
| 94 | 104 | data_fin:1, |
| @@ -96,6 +106,16 @@ struct mptcp_options_received { · 1 unmodified line | ||
| 96 | 106 | ack64:1, |
| 97 | 107 | mpc_map:1, |
| 98 | 108 | __unused:2; |
| 109 | + u8 addr_id; | |
| 110 | + u8 rm_id; | |
| 111 | + union { | |
| 112 | + struct in_addr addr; | |
| 113 | +#if IS_ENABLED(CONFIG_MPTCP_IPV6) | |
| 114 | + struct in6_addr addr6; | |
| 115 | +#endif | |
| 116 | + }; | |
| 117 | + u64 ahmac; | |
| 118 | + u16 port; | |
| 99 | 119 | }; |
| 100 | 120 | #endif |
| 101 | 121 | |
| @@ -131,6 +151,8 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt) · 29 unmodified lines | ||
| 131 | 151 | #if IS_ENABLED(CONFIG_MPTCP) |
| 132 | 152 | rx_opt->mptcp.mp_capable = 0; |
| 133 | 153 | rx_opt->mptcp.mp_join = 0; |
| 154 | + rx_opt->mptcp.add_addr = 0; | |
| 155 | + rx_opt->mptcp.rm_addr = 0; | |
| 134 | 156 | rx_opt->mptcp.dss = 0; |
| 135 | 157 | #endif |
| 136 | 158 | } |
| @@ -49,7 +49,6 @@ struct tee_shm_pool; · 48 unmodified lines | ||
| 49 | 49 | */ |
| 50 | 50 | struct tee_context { |
| 51 | 51 | struct tee_device *teedev; |
| 52 | − struct list_head list_shm; | |
| 53 | 52 | void *data; |
| 54 | 53 | struct kref refcount; |
| 55 | 54 | bool releasing; |
| @@ -168,9 +167,7 @@ void tee_device_unregister(struct tee_device *teedev); · 112 unmodified lines | ||
| 168 | 167 | |
| 169 | 168 | /** |
| 170 | 169 | * struct tee_shm - shared memory object |
| 171 | − * @teedev: device used to allocate the object | |
| 172 | − * @ctx: context using the object, if NULL the context is gone | |
| 173 | − * @link link element | |
| 170 | + * @ctx: context using the object | |
| 174 | 171 | * @paddr: physical address of the shared memory |
| 175 | 172 | * @kaddr: virtual address of the shared memory |
| 176 | 173 | * @size: size of shared memory |
| @@ -185,9 +182,7 @@ void tee_device_unregister(struct tee_device *teedev); · 8 unmodified lines | ||
| 185 | 182 | * subsystem and from drivers that implements their own shm pool manager. |
| 186 | 183 | */ |
| 187 | 184 | struct tee_shm { |
| 188 | − struct tee_device *teedev; | |
| 189 | 185 | struct tee_context *ctx; |
| 190 | − struct list_head link; | |
| 191 | 186 | phys_addr_t paddr; |
| 192 | 187 | void *kaddr; |
| 193 | 188 | size_t size; |
| @@ -318,18 +313,6 @@ void *tee_get_drvdata(struct tee_device *teedev); · 124 unmodified lines | ||
| 318 | 313 | */ |
| 319 | 314 | struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags); |
| 320 | 315 | |
| 321 | −/** | |
| 322 | − * tee_shm_priv_alloc() - Allocate shared memory privately | |
| 323 | − * @dev: Device that allocates the shared memory | |
| 324 | − * @size: Requested size of shared memory | |
| 325 | − * | |
| 326 | − * Allocates shared memory buffer that is not associated with any client | |
| 327 | − * context. Such buffers are owned by TEE driver and used for internal calls. | |
| 328 | − * | |
| 329 | − * @returns a pointer to 'struct tee_shm' | |
| 330 | − */ | |
| 331 | −struct tee_shm *tee_shm_priv_alloc(struct tee_device *teedev, size_t size); | |
| 332 | − | |
| 333 | 316 | /** |
| 334 | 317 | * tee_shm_register() - Register shared memory buffer |
| 335 | 318 | * @ctx: Context that registers the shared memory |
| @@ -364,6 +364,9 @@ struct thermal_trip { · 363 unmodified lines | ||
| 364 | 364 | |
| 365 | 365 | /* Function declarations */ |
| 366 | 366 | #ifdef CONFIG_THERMAL_OF |
| 367 | +int thermal_zone_of_get_sensor_id(struct device_node *tz_np, | |
| 368 | + struct device_node *sensor_np, | |
| 369 | + u32 *id); | |
| 367 | 370 | struct thermal_zone_device * |
| 368 | 371 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, |
| 369 | 372 | const struct thermal_zone_of_device_ops *ops); |
| @@ -375,6 +378,13 @@ struct thermal_zone_device *devm_thermal_zone_of_sensor_register( · 5 unmodified lines | ||
| 375 | 378 | void devm_thermal_zone_of_sensor_unregister(struct device *dev, |
| 376 | 379 | struct thermal_zone_device *tz); |
| 377 | 380 | #else |
| 381 | + | |
| 382 | +static inline int thermal_zone_of_get_sensor_id(struct device_node *tz_np, | |
| 383 | + struct device_node *sensor_np, | |
| 384 | + u32 *id) | |
| 385 | +{ | |
| 386 | + return -ENOENT; | |
| 387 | +} | |
| 378 | 388 | static inline struct thermal_zone_device * |
| 379 | 389 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, |
| 380 | 390 | const struct thermal_zone_of_device_ops *ops) |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | /* |
| 31 | 31 | * A maximum of 4 million PIDs should be enough for a while. |
| 32 | − * [NOTE: PID/TIDs are limited to 2^29 ~= 500+ million, see futex.h.] | |
| 32 | + * [NOTE: PID/TIDs are limited to 2^30 ~= 1 billion, see FUTEX_TID_MASK.] | |
| 33 | 33 | */ |
| 34 | 34 | #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ |
| 35 | 35 | (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) |
| @@ -111,9 +111,6 @@ static inline bool itimerspec64_valid(const struct itimerspec64 *its) · 110 unmodified lines | ||
| 111 | 111 | */ |
| 112 | 112 | #define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l)) |
| 113 | 113 | |
| 114 | −struct timens_offset { | |
| 115 | − s64 sec; | |
| 116 | − u64 nsec; | |
| 117 | −}; | |
| 114 | +# include <vdso/time.h> | |
| 118 | 115 | |
| 119 | 116 | #endif |
| @@ -12,17 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/time64.h> |
| 13 | 13 | #include <linux/timex.h> |
| 14 | 14 | |
| 15 | −typedef s32 old_time32_t; | |
| 16 | − | |
| 17 | −struct old_timespec32 { | |
| 18 | − old_time32_t tv_sec; | |
| 19 | − s32 tv_nsec; | |
| 20 | −}; | |
| 21 | − | |
| 22 | −struct old_timeval32 { | |
| 23 | − old_time32_t tv_sec; | |
| 24 | − s32 tv_usec; | |
| 25 | −}; | |
| 15 | +#include <vdso/time32.h> | |
| 26 | 16 | |
| 27 | 17 | struct old_itimerspec32 { |
| 28 | 18 | struct old_timespec32 it_interval; |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #define _LINUX_TIME64_H |
| 4 | 4 | |
| 5 | 5 | #include <linux/math64.h> |
| 6 | +#include <vdso/time64.h> | |
| 6 | 7 | |
| 7 | 8 | typedef __s64 time64_t; |
| 8 | 9 | typedef __u64 timeu64_t; |
| @@ -19,15 +20,6 @@ struct itimerspec64 { · 10 unmodified lines | ||
| 19 | 20 | struct timespec64 it_value; |
| 20 | 21 | }; |
| 21 | 22 | |
| 22 | −/* Parameters used to convert the timespec values: */ | |
| 23 | −#define MSEC_PER_SEC 1000L | |
| 24 | −#define USEC_PER_MSEC 1000L | |
| 25 | −#define NSEC_PER_USEC 1000L | |
| 26 | −#define NSEC_PER_MSEC 1000000L | |
| 27 | −#define USEC_PER_SEC 1000000L | |
| 28 | −#define NSEC_PER_SEC 1000000000L | |
| 29 | −#define FSEC_PER_SEC 1000000000000000LL | |
| 30 | − | |
| 31 | 23 | /* Located here for timespec[64]_valid_strict */ |
| 32 | 24 | #define TIME64_MAX ((s64)~((u64)1 << 63)) |
| 33 | 25 | #define TIME64_MIN (-TIME64_MAX - 1) |
| @@ -164,7 +164,7 @@ static inline void destroy_timer_on_stack(struct timer_list *timer) { } · 163 unmodified lines | ||
| 164 | 164 | */ |
| 165 | 165 | static inline int timer_pending(const struct timer_list * timer) |
| 166 | 166 | { |
| 167 | − return timer->entry.pprev != NULL; | |
| 167 | + return !hlist_unhashed_lockless(&timer->entry); | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | extern void add_timer_on(struct timer_list *timer, int cpu); |
| @@ -86,4 +86,16 @@ int tnum_strn(char *str, size_t size, struct tnum a); · 85 unmodified lines | ||
| 86 | 86 | /* Format a tnum as tristate binary expansion */ |
| 87 | 87 | int tnum_sbin(char *str, size_t size, struct tnum a); |
| 88 | 88 | |
| 89 | +/* Returns the 32-bit subreg */ | |
| 90 | +struct tnum tnum_subreg(struct tnum a); | |
| 91 | +/* Returns the tnum with the lower 32-bit subreg cleared */ | |
| 92 | +struct tnum tnum_clear_subreg(struct tnum a); | |
| 93 | +/* Returns the tnum with the lower 32-bit subreg set to value */ | |
| 94 | +struct tnum tnum_const_subreg(struct tnum a, u32 value); | |
| 95 | +/* Returns true if 32-bit subreg @a is a known constant*/ | |
| 96 | +static inline bool tnum_subreg_is_const(struct tnum a) | |
| 97 | +{ | |
| 98 | + return !(tnum_subreg(a)).mask; | |
| 99 | +} | |
| 100 | + | |
| 89 | 101 | #endif /* _LINUX_TNUM_H */ |
| @@ -130,20 +130,11 @@ static inline int numa_node_id(void) · 129 unmodified lines | ||
| 130 | 130 | * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem(). |
| 131 | 131 | */ |
| 132 | 132 | DECLARE_PER_CPU(int, _numa_mem_); |
| 133 | −extern int _node_numa_mem_[MAX_NUMNODES]; | |
| 134 | 133 | |
| 135 | 134 | #ifndef set_numa_mem |
| 136 | 135 | static inline void set_numa_mem(int node) |
| 137 | 136 | { |
| 138 | 137 | this_cpu_write(_numa_mem_, node); |
| 139 | − _node_numa_mem_[numa_node_id()] = node; | |
| 140 | −} | |
| 141 | −#endif | |
| 142 | − | |
| 143 | −#ifndef node_to_mem_node | |
| 144 | −static inline int node_to_mem_node(int node) | |
| 145 | −{ | |
| 146 | − return _node_numa_mem_[node]; | |
| 147 | 138 | } |
| 148 | 139 | #endif |
| 149 | 140 | |
| @@ -166,7 +157,6 @@ static inline int cpu_to_mem(int cpu) · 16 unmodified lines | ||
| 166 | 157 | static inline void set_cpu_numa_mem(int cpu, int node) |
| 167 | 158 | { |
| 168 | 159 | per_cpu(_numa_mem_, cpu) = node; |
| 169 | − _node_numa_mem_[cpu_to_node(cpu)] = node; | |
| 170 | 160 | } |
| 171 | 161 | #endif |
| 172 | 162 | |
| @@ -180,13 +170,6 @@ static inline int numa_mem_id(void) · 7 unmodified lines | ||
| 180 | 170 | } |
| 181 | 171 | #endif |
| 182 | 172 | |
| 183 | −#ifndef node_to_mem_node | |
| 184 | −static inline int node_to_mem_node(int node) | |
| 185 | −{ | |
| 186 | − return node; | |
| 187 | −} | |
| 188 | −#endif | |
| 189 | − | |
| 190 | 173 | #ifndef cpu_to_mem |
| 191 | 174 | static inline int cpu_to_mem(int cpu) |
| 192 | 175 | { |
| @@ -85,6 +85,8 @@ struct trace_iterator { · 84 unmodified lines | ||
| 85 | 85 | struct mutex mutex; |
| 86 | 86 | struct ring_buffer_iter **buffer_iter; |
| 87 | 87 | unsigned long iter_flags; |
| 88 | + void *temp; /* temp holder */ | |
| 89 | + unsigned int temp_size; | |
| 88 | 90 | |
| 89 | 91 | /* trace_seq for __print_flags() and __print_symbolic() etc. */ |
| 90 | 92 | struct trace_seq tmp_seq; |
| @@ -0,0 +1,163 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
| 2 | +#ifndef _LINUX_UACCE_H | |
| 3 | +#define _LINUX_UACCE_H | |
| 4 | + | |
| 5 | +#include <linux/cdev.h> | |
| 6 | +#include <uapi/misc/uacce/uacce.h> | |
| 7 | + | |
| 8 | +#define UACCE_NAME "uacce" | |
| 9 | +#define UACCE_MAX_REGION 2 | |
| 10 | +#define UACCE_MAX_NAME_SIZE 64 | |
| 11 | + | |
| 12 | +struct uacce_queue; | |
| 13 | +struct uacce_device; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * struct uacce_qfile_region - structure of queue file region | |
| 17 | + * @type: type of the region | |
| 18 | + */ | |
| 19 | +struct uacce_qfile_region { | |
| 20 | + enum uacce_qfrt type; | |
| 21 | +}; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * struct uacce_ops - uacce device operations | |
| 25 | + * @get_available_instances: get available instances left of the device | |
| 26 | + * @get_queue: get a queue from the device | |
| 27 | + * @put_queue: free a queue to the device | |
| 28 | + * @start_queue: make the queue start work after get_queue | |
| 29 | + * @stop_queue: make the queue stop work before put_queue | |
| 30 | + * @is_q_updated: check whether the task is finished | |
| 31 | + * @mmap: mmap addresses of queue to user space | |
| 32 | + * @ioctl: ioctl for user space users of the queue | |
| 33 | + */ | |
| 34 | +struct uacce_ops { | |
| 35 | + int (*get_available_instances)(struct uacce_device *uacce); | |
| 36 | + int (*get_queue)(struct uacce_device *uacce, unsigned long arg, | |
| 37 | + struct uacce_queue *q); | |
| 38 | + void (*put_queue)(struct uacce_queue *q); | |
| 39 | + int (*start_queue)(struct uacce_queue *q); | |
| 40 | + void (*stop_queue)(struct uacce_queue *q); | |
| 41 | + int (*is_q_updated)(struct uacce_queue *q); | |
| 42 | + int (*mmap)(struct uacce_queue *q, struct vm_area_struct *vma, | |
| 43 | + struct uacce_qfile_region *qfr); | |
| 44 | + long (*ioctl)(struct uacce_queue *q, unsigned int cmd, | |
| 45 | + unsigned long arg); | |
| 46 | +}; | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * struct uacce_interface - interface required for uacce_register() | |
| 50 | + * @name: the uacce device name. Will show up in sysfs | |
| 51 | + * @flags: uacce device attributes | |
| 52 | + * @ops: pointer to the struct uacce_ops | |
| 53 | + */ | |
| 54 | +struct uacce_interface { | |
| 55 | + char name[UACCE_MAX_NAME_SIZE]; | |
| 56 | + unsigned int flags; | |
| 57 | + const struct uacce_ops *ops; | |
| 58 | +}; | |
| 59 | + | |
| 60 | +enum uacce_q_state { | |
| 61 | + UACCE_Q_ZOMBIE = 0, | |
| 62 | + UACCE_Q_INIT, | |
| 63 | + UACCE_Q_STARTED, | |
| 64 | +}; | |
| 65 | + | |
| 66 | +/** | |
| 67 | + * struct uacce_queue | |
| 68 | + * @uacce: pointer to uacce | |
| 69 | + * @priv: private pointer | |
| 70 | + * @wait: wait queue head | |
| 71 | + * @list: index into uacce_mm | |
| 72 | + * @uacce_mm: the corresponding mm | |
| 73 | + * @qfrs: pointer of qfr regions | |
| 74 | + * @state: queue state machine | |
| 75 | + */ | |
| 76 | +struct uacce_queue { | |
| 77 | + struct uacce_device *uacce; | |
| 78 | + void *priv; | |
| 79 | + wait_queue_head_t wait; | |
| 80 | + struct list_head list; | |
| 81 | + struct uacce_mm *uacce_mm; | |
| 82 | + struct uacce_qfile_region *qfrs[UACCE_MAX_REGION]; | |
| 83 | + enum uacce_q_state state; | |
| 84 | +}; | |
| 85 | + | |
| 86 | +/** | |
| 87 | + * struct uacce_device | |
| 88 | + * @algs: supported algorithms | |
| 89 | + * @api_ver: api version | |
| 90 | + * @ops: pointer to the struct uacce_ops | |
| 91 | + * @qf_pg_num: page numbers of the queue file regions | |
| 92 | + * @parent: pointer to the parent device | |
| 93 | + * @is_vf: whether virtual function | |
| 94 | + * @flags: uacce attributes | |
| 95 | + * @dev_id: id of the uacce device | |
| 96 | + * @cdev: cdev of the uacce | |
| 97 | + * @dev: dev of the uacce | |
| 98 | + * @priv: private pointer of the uacce | |
| 99 | + * @mm_list: list head of uacce_mm->list | |
| 100 | + * @mm_lock: lock for mm_list | |
| 101 | + * @inode: core vfs | |
| 102 | + */ | |
| 103 | +struct uacce_device { | |
| 104 | + const char *algs; | |
| 105 | + const char *api_ver; | |
| 106 | + const struct uacce_ops *ops; | |
| 107 | + unsigned long qf_pg_num[UACCE_MAX_REGION]; | |
| 108 | + struct device *parent; | |
| 109 | + bool is_vf; | |
| 110 | + u32 flags; | |
| 111 | + u32 dev_id; | |
| 112 | + struct cdev *cdev; | |
| 113 | + struct device dev; | |
| 114 | + void *priv; | |
| 115 | + struct list_head mm_list; | |
| 116 | + struct mutex mm_lock; | |
| 117 | + struct inode *inode; | |
| 118 | +}; | |
| 119 | + | |
| 120 | +/** | |
| 121 | + * struct uacce_mm - keep track of queues bound to a process | |
| 122 | + * @list: index into uacce_device | |
| 123 | + * @queues: list of queues | |
| 124 | + * @mm: the mm struct | |
| 125 | + * @lock: protects the list of queues | |
| 126 | + * @pasid: pasid of the uacce_mm | |
| 127 | + * @handle: iommu_sva handle return from iommu_sva_bind_device | |
| 128 | + */ | |
| 129 | +struct uacce_mm { | |
| 130 | + struct list_head list; | |
| 131 | + struct list_head queues; | |
| 132 | + struct mm_struct *mm; | |
| 133 | + struct mutex lock; | |
| 134 | + int pasid; | |
| 135 | + struct iommu_sva *handle; | |
| 136 | +}; | |
| 137 | + | |
| 138 | +#if IS_ENABLED(CONFIG_UACCE) | |
| 139 | + | |
| 140 | +struct uacce_device *uacce_alloc(struct device *parent, | |
| 141 | + struct uacce_interface *interface); | |
| 142 | +int uacce_register(struct uacce_device *uacce); | |
| 143 | +void uacce_remove(struct uacce_device *uacce); | |
| 144 | + | |
| 145 | +#else /* CONFIG_UACCE */ | |
| 146 | + | |
| 147 | +static inline | |
| 148 | +struct uacce_device *uacce_alloc(struct device *parent, | |
| 149 | + struct uacce_interface *interface) | |
| 150 | +{ | |
| 151 | + return ERR_PTR(-ENODEV); | |
| 152 | +} | |
| 153 | + | |
| 154 | +static inline int uacce_register(struct uacce_device *uacce) | |
| 155 | +{ | |
| 156 | + return -EINVAL; | |
| 157 | +} | |
| 158 | + | |
| 159 | +static inline void uacce_remove(struct uacce_device *uacce) {} | |
| 160 | + | |
| 161 | +#endif /* CONFIG_UACCE */ | |
| 162 | + | |
| 163 | +#endif /* _LINUX_UACCE_H */ | |
| @@ -24,10 +24,10 @@ struct uio_map; · 23 unmodified lines | ||
| 24 | 24 | * struct uio_mem - description of a UIO memory region |
| 25 | 25 | * @name: name of the memory region for identification |
| 26 | 26 | * @addr: address of the device's memory rounded to page |
| 27 | − * size (phys_addr is used since addr can be | |
| 28 | − * logical, virtual, or physical & phys_addr_t | |
| 29 | − * should always be large enough to handle any of | |
| 30 | − * the address types) | |
| 27 | + * size (phys_addr is used since addr can be | |
| 28 | + * logical, virtual, or physical & phys_addr_t | |
| 29 | + * should always be large enough to handle any of | |
| 30 | + * the address types) | |
| 31 | 31 | * @offs: offset of device memory within the page |
| 32 | 32 | * @size: size of IO (multiple of page size) |
| 33 | 33 | * @memtype: type of memory addr points to |
| @@ -67,16 +67,16 @@ struct uio_port { · 33 unmodified lines | ||
| 67 | 67 | #define MAX_UIO_PORT_REGIONS 5 |
| 68 | 68 | |
| 69 | 69 | struct uio_device { |
| 70 | − struct module *owner; | |
| 70 | + struct module *owner; | |
| 71 | 71 | struct device dev; |
| 72 | − int minor; | |
| 73 | − atomic_t event; | |
| 74 | − struct fasync_struct *async_queue; | |
| 75 | − wait_queue_head_t wait; | |
| 76 | − struct uio_info *info; | |
| 72 | + int minor; | |
| 73 | + atomic_t event; | |
| 74 | + struct fasync_struct *async_queue; | |
| 75 | + wait_queue_head_t wait; | |
| 76 | + struct uio_info *info; | |
| 77 | 77 | struct mutex info_lock; |
| 78 | − struct kobject *map_dir; | |
| 79 | − struct kobject *portio_dir; | |
| 78 | + struct kobject *map_dir; | |
| 79 | + struct kobject *portio_dir; | |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | 82 | /** |
| @@ -123,6 +123,15 @@ extern int __must_check · 40 unmodified lines | ||
| 123 | 123 | extern void uio_unregister_device(struct uio_info *info); |
| 124 | 124 | extern void uio_event_notify(struct uio_info *info); |
| 125 | 125 | |
| 126 | +extern int __must_check | |
| 127 | + __devm_uio_register_device(struct module *owner, | |
| 128 | + struct device *parent, | |
| 129 | + struct uio_info *info); | |
| 130 | + | |
| 131 | +/* use a define to avoid include chaining to get THIS_MODULE */ | |
| 132 | +#define devm_uio_register_device(parent, info) \ | |
| 133 | + __devm_uio_register_device(THIS_MODULE, parent, info) | |
| 134 | + | |
| 126 | 135 | /* defines for uio_info->irq */ |
| 127 | 136 | #define UIO_IRQ_CUSTOM -1 |
| 128 | 137 | #define UIO_IRQ_NONE 0 |
| @@ -40,17 +40,17 @@ static inline void __put_unaligned_be64(u64 val, u8 *p) · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | static inline u16 get_unaligned_be16(const void *p) |
| 42 | 42 | { |
| 43 | − return __get_unaligned_be16((const u8 *)p); | |
| 43 | + return __get_unaligned_be16(p); | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | static inline u32 get_unaligned_be32(const void *p) |
| 47 | 47 | { |
| 48 | − return __get_unaligned_be32((const u8 *)p); | |
| 48 | + return __get_unaligned_be32(p); | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | static inline u64 get_unaligned_be64(const void *p) |
| 52 | 52 | { |
| 53 | − return __get_unaligned_be64((const u8 *)p); | |
| 53 | + return __get_unaligned_be64(p); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | static inline void put_unaligned_be16(u16 val, void *p) |
| @@ -2,6 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _LINUX_UNALIGNED_GENERIC_H |
| 3 | 3 | #define _LINUX_UNALIGNED_GENERIC_H |
| 4 | 4 | |
| 5 | +#include <linux/types.h> | |
| 6 | + | |
| 5 | 7 | /* |
| 6 | 8 | * Cause a link-time error if we try an unaligned access other than |
| 7 | 9 | * 1,2,4 or 8 bytes long |
| @@ -66,4 +68,48 @@ extern void __bad_unaligned_access_size(void); · 58 unmodified lines | ||
| 66 | 68 | } \ |
| 67 | 69 | (void)0; }) |
| 68 | 70 | |
| 71 | +static inline u32 __get_unaligned_be24(const u8 *p) | |
| 72 | +{ | |
| 73 | + return p[0] << 16 | p[1] << 8 | p[2]; | |
| 74 | +} | |
| 75 | + | |
| 76 | +static inline u32 get_unaligned_be24(const void *p) | |
| 77 | +{ | |
| 78 | + return __get_unaligned_be24(p); | |
| 79 | +} | |
| 80 | + | |
| 81 | +static inline u32 __get_unaligned_le24(const u8 *p) | |
| 82 | +{ | |
| 83 | + return p[0] | p[1] << 8 | p[2] << 16; | |
| 84 | +} | |
| 85 | + | |
| 86 | +static inline u32 get_unaligned_le24(const void *p) | |
| 87 | +{ | |
| 88 | + return __get_unaligned_le24(p); | |
| 89 | +} | |
| 90 | + | |
| 91 | +static inline void __put_unaligned_be24(const u32 val, u8 *p) | |
| 92 | +{ | |
| 93 | + *p++ = val >> 16; | |
| 94 | + *p++ = val >> 8; | |
| 95 | + *p++ = val; | |
| 96 | +} | |
| 97 | + | |
| 98 | +static inline void put_unaligned_be24(const u32 val, void *p) | |
| 99 | +{ | |
| 100 | + __put_unaligned_be24(val, p); | |
| 101 | +} | |
| 102 | + | |
| 103 | +static inline void __put_unaligned_le24(const u32 val, u8 *p) | |
| 104 | +{ | |
| 105 | + *p++ = val; | |
| 106 | + *p++ = val >> 8; | |
| 107 | + *p++ = val >> 16; | |
| 108 | +} | |
| 109 | + | |
| 110 | +static inline void put_unaligned_le24(const u32 val, void *p) | |
| 111 | +{ | |
| 112 | + __put_unaligned_le24(val, p); | |
| 113 | +} | |
| 114 | + | |
| 69 | 115 | #endif /* _LINUX_UNALIGNED_GENERIC_H */ |
| @@ -40,17 +40,17 @@ static inline void __put_unaligned_le64(u64 val, u8 *p) · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | static inline u16 get_unaligned_le16(const void *p) |
| 42 | 42 | { |
| 43 | − return __get_unaligned_le16((const u8 *)p); | |
| 43 | + return __get_unaligned_le16(p); | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | static inline u32 get_unaligned_le32(const void *p) |
| 47 | 47 | { |
| 48 | − return __get_unaligned_le32((const u8 *)p); | |
| 48 | + return __get_unaligned_le32(p); | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | static inline u64 get_unaligned_le64(const void *p) |
| 52 | 52 | { |
| 53 | − return __get_unaligned_le64((const u8 *)p); | |
| 53 | + return __get_unaligned_le64(p); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | static inline void put_unaligned_le16(u16 val, void *p) |
| @@ -325,7 +325,7 @@ struct usb_interface_cache { · 324 unmodified lines | ||
| 325 | 325 | |
| 326 | 326 | /* variable-length array of alternate settings for this interface, |
| 327 | 327 | * stored in no particular order */ |
| 328 | − struct usb_host_interface altsetting[0]; | |
| 328 | + struct usb_host_interface altsetting[]; | |
| 329 | 329 | }; |
| 330 | 330 | #define ref_to_usb_interface_cache(r) \ |
| 331 | 331 | container_of(r, struct usb_interface_cache, ref) |
| @@ -708,6 +708,7 @@ struct usb_device { · 376 unmodified lines | ||
| 708 | 708 | unsigned lpm_disable_count; |
| 709 | 709 | |
| 710 | 710 | u16 hub_delay; |
| 711 | + unsigned use_generic_driver:1; | |
| 711 | 712 | }; |
| 712 | 713 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
| 713 | 714 | |
| @@ -1228,12 +1229,16 @@ struct usb_driver { · 514 unmodified lines | ||
| 1228 | 1229 | * @drvwrap: Driver-model core structure wrapper. |
| 1229 | 1230 | * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend |
| 1230 | 1231 | * for devices bound to this driver. |
| 1232 | + * @generic_subclass: if set to 1, the generic USB driver's probe, disconnect, | |
| 1233 | + * resume and suspend functions will be called in addition to the driver's | |
| 1234 | + * own, so this part of the setup does not need to be replicated. | |
| 1231 | 1235 | * |
| 1232 | 1236 | * USB drivers must provide all the fields listed above except drvwrap. |
| 1233 | 1237 | */ |
| 1234 | 1238 | struct usb_device_driver { |
| 1235 | 1239 | const char *name; |
| 1236 | 1240 | |
| 1241 | + bool (*match) (struct usb_device *udev); | |
| 1237 | 1242 | int (*probe) (struct usb_device *udev); |
| 1238 | 1243 | void (*disconnect) (struct usb_device *udev); |
| 1239 | 1244 | |
| @@ -1241,7 +1246,9 @@ struct usb_device_driver { · 1 unmodified line | ||
| 1241 | 1246 | int (*resume) (struct usb_device *udev, pm_message_t message); |
| 1242 | 1247 | const struct attribute_group **dev_groups; |
| 1243 | 1248 | struct usbdrv_wrap drvwrap; |
| 1249 | + const struct usb_device_id *id_table; | |
| 1244 | 1250 | unsigned int supports_autosuspend:1; |
| 1251 | + unsigned int generic_subclass:1; | |
| 1245 | 1252 | }; |
| 1246 | 1253 | #define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \ |
| 1247 | 1254 | drvwrap.driver) |
| @@ -1582,7 +1589,7 @@ struct urb { · 334 unmodified lines | ||
| 1582 | 1589 | int error_count; /* (return) number of ISO errors */ |
| 1583 | 1590 | void *context; /* (in) context for completion */ |
| 1584 | 1591 | usb_complete_t complete; /* (in) completion routine */ |
| 1585 | − struct usb_iso_packet_descriptor iso_frame_desc[0]; | |
| 1592 | + struct usb_iso_packet_descriptor iso_frame_desc[]; | |
| 1586 | 1593 | /* (in) ISO ONLY */ |
| 1587 | 1594 | }; |
| 1588 | 1595 | |
| @@ -153,7 +153,19 @@ struct uac2_feature_unit_descriptor { · 152 unmodified lines | ||
| 153 | 153 | __u8 bSourceID; |
| 154 | 154 | /* bmaControls is actually u32, |
| 155 | 155 | * but u8 is needed for the hybrid parser */ |
| 156 | − __u8 bmaControls[0]; /* variable length */ | |
| 156 | + __u8 bmaControls[]; /* variable length */ | |
| 157 | +} __attribute__((packed)); | |
| 158 | + | |
| 159 | +/* 4.7.2.10 Effect Unit Descriptor */ | |
| 160 | + | |
| 161 | +struct uac2_effect_unit_descriptor { | |
| 162 | + __u8 bLength; | |
| 163 | + __u8 bDescriptorType; | |
| 164 | + __u8 bDescriptorSubtype; | |
| 165 | + __u8 bUnitID; | |
| 166 | + __le16 wEffectType; | |
| 167 | + __u8 bSourceID; | |
| 168 | + __u8 bmaControls[]; /* variable length */ | |
| 157 | 169 | } __attribute__((packed)); |
| 158 | 170 | |
| 159 | 171 | /* 4.9.2 Class-Specific AS Interface Descriptor */ |
| @@ -109,7 +109,7 @@ struct uac3_feature_unit_descriptor { · 108 unmodified lines | ||
| 109 | 109 | __u8 bSourceID; |
| 110 | 110 | /* bmaControls is actually u32, |
| 111 | 111 | * but u8 is needed for the hybrid parser */ |
| 112 | − __u8 bmaControls[0]; /* variable length */ | |
| 112 | + __u8 bmaControls[]; /* variable length */ | |
| 113 | 113 | /* wFeatureDescrStr omitted */ |
| 114 | 114 | } __attribute__((packed)); |
| 115 | 115 | |
| @@ -46,9 +46,12 @@ · 45 unmodified lines | ||
| 46 | 46 | #define CDC_NCM_DATA_ALTSETTING_NCM 1 |
| 47 | 47 | #define CDC_NCM_DATA_ALTSETTING_MBIM 2 |
| 48 | 48 | |
| 49 | −/* CDC NCM subclass 3.2.1 */ | |
| 49 | +/* CDC NCM subclass 3.3.1 */ | |
| 50 | 50 | #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 |
| 51 | 51 | |
| 52 | +/* CDC NCM subclass 3.3.2 */ | |
| 53 | +#define USB_CDC_NCM_NDP32_LENGTH_MIN 0x20 | |
| 54 | + | |
| 52 | 55 | /* Maximum NTB length */ |
| 53 | 56 | #define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */ |
| 54 | 57 | #define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */ |
| @@ -84,7 +87,7 @@ · 29 unmodified lines | ||
| 84 | 87 | /* Driver flags */ |
| 85 | 88 | #define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */ |
| 86 | 89 | #define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */ |
| 87 | −#define CDC_NCM_FLAG_RESET_NTB16 0x08 /* set NDP16 one more time after altsetting switch */ | |
| 90 | +#define CDC_NCM_FLAG_PREFER_NTB32 0x08 /* prefer NDP32 over NDP16 */ | |
| 88 | 91 | |
| 89 | 92 | #define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ |
| 90 | 93 | (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) |
| @@ -113,7 +116,11 @@ struct cdc_ncm_ctx { · 22 unmodified lines | ||
| 113 | 116 | |
| 114 | 117 | u32 timer_interval; |
| 115 | 118 | u32 max_ndp_size; |
| 116 | − struct usb_cdc_ncm_ndp16 *delayed_ndp16; | |
| 119 | + u8 is_ndp16; | |
| 120 | + union { | |
| 121 | + struct usb_cdc_ncm_ndp16 *delayed_ndp16; | |
| 122 | + struct usb_cdc_ncm_ndp32 *delayed_ndp32; | |
| 123 | + }; | |
| 117 | 124 | |
| 118 | 125 | u32 tx_timer_pending; |
| 119 | 126 | u32 tx_curr_frame_num; |
| @@ -150,6 +157,8 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); · 30 unmodified lines | ||
| 150 | 157 | struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); |
| 151 | 158 | int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); |
| 152 | 159 | int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset); |
| 160 | +int cdc_ncm_rx_verify_nth32(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); | |
| 161 | +int cdc_ncm_rx_verify_ndp32(struct sk_buff *skb_in, int ndpoffset); | |
| 153 | 162 | struct sk_buff * |
| 154 | 163 | cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags); |
| 155 | 164 | int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in); |
| @@ -151,7 +151,7 @@ struct ehci_regs { · 150 unmodified lines | ||
| 151 | 151 | #define PORT_OWNER (1<<13) /* true: companion hc owns this port */ |
| 152 | 152 | #define PORT_POWER (1<<12) /* true: has power (see PPC) */ |
| 153 | 153 | #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ |
| 154 | −/* 11:10 for detecting lowspeed devices (reset vs release ownership) */ | |
| 154 | +#define PORT_LS_MASK (3<<10) /* Link status (SE0, K or J */ | |
| 155 | 155 | /* 9 reserved */ |
| 156 | 156 | #define PORT_LPM (1<<9) /* LPM transaction */ |
| 157 | 157 | #define PORT_RESET (1<<8) /* reset port */ |
| @@ -767,7 +767,7 @@ struct usb_gadget_strings { · 766 unmodified lines | ||
| 767 | 767 | |
| 768 | 768 | struct usb_gadget_string_container { |
| 769 | 769 | struct list_head list; |
| 770 | − u8 *stash[0]; | |
| 770 | + u8 *stash[]; | |
| 771 | 771 | }; |
| 772 | 772 | |
| 773 | 773 | /* put descriptor for string with that id into buf (buflen >= 256) */ |
| @@ -228,7 +228,7 @@ struct usb_hcd { · 227 unmodified lines | ||
| 228 | 228 | /* The HC driver's private data is stored at the end of |
| 229 | 229 | * this structure. |
| 230 | 230 | */ |
| 231 | − unsigned long hcd_priv[0] | |
| 231 | + unsigned long hcd_priv[] | |
| 232 | 232 | __attribute__ ((aligned(sizeof(s64)))); |
| 233 | 233 | }; |
| 234 | 234 | |
| @@ -13,8 +13,9 @@ enum usb_role { · 12 unmodified lines | ||
| 13 | 13 | USB_ROLE_DEVICE, |
| 14 | 14 | }; |
| 15 | 15 | |
| 16 | −typedef int (*usb_role_switch_set_t)(struct device *dev, enum usb_role role); | |
| 17 | −typedef enum usb_role (*usb_role_switch_get_t)(struct device *dev); | |
| 16 | +typedef int (*usb_role_switch_set_t)(struct usb_role_switch *sw, | |
| 17 | + enum usb_role role); | |
| 18 | +typedef enum usb_role (*usb_role_switch_get_t)(struct usb_role_switch *sw); | |
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * struct usb_role_switch_desc - USB Role Switch Descriptor |
| @@ -25,6 +26,8 @@ typedef enum usb_role (*usb_role_switch_get_t)(struct device *dev); · 4 unmodified lines | ||
| 25 | 26 | * @set: Callback for setting the role |
| 26 | 27 | * @get: Callback for getting the role (optional) |
| 27 | 28 | * @allow_userspace_control: If true userspace may change the role through sysfs |
| 29 | + * @driver_data: Private data pointer | |
| 30 | + * @name: Name for the switch (optional) | |
| 28 | 31 | * |
| 29 | 32 | * @usb2_port and @usb3_port will point to the USB host port and @udc to the USB |
| 30 | 33 | * device controller behind the USB connector with the role switch. If |
| @@ -40,6 +43,8 @@ struct usb_role_switch_desc { · 9 unmodified lines | ||
| 40 | 43 | usb_role_switch_set_t set; |
| 41 | 44 | usb_role_switch_get_t get; |
| 42 | 45 | bool allow_userspace_control; |
| 46 | + void *driver_data; | |
| 47 | + const char *name; | |
| 43 | 48 | }; |
| 44 | 49 | |
| 45 | 50 | |
| @@ -57,6 +62,9 @@ struct usb_role_switch * · 11 unmodified lines | ||
| 57 | 62 | usb_role_switch_register(struct device *parent, |
| 58 | 63 | const struct usb_role_switch_desc *desc); |
| 59 | 64 | void usb_role_switch_unregister(struct usb_role_switch *sw); |
| 65 | + | |
| 66 | +void usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data); | |
| 67 | +void *usb_role_switch_get_drvdata(struct usb_role_switch *sw); | |
| 60 | 68 | #else |
| 61 | 69 | static inline int usb_role_switch_set_role(struct usb_role_switch *sw, |
| 62 | 70 | enum usb_role role) |
| @@ -90,6 +98,17 @@ usb_role_switch_register(struct device *parent, · 27 unmodified lines | ||
| 90 | 98 | } |
| 91 | 99 | |
| 92 | 100 | static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { } |
| 101 | + | |
| 102 | +static inline void | |
| 103 | +usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data) | |
| 104 | +{ | |
| 105 | +} | |
| 106 | + | |
| 107 | +static inline void *usb_role_switch_get_drvdata(struct usb_role_switch *sw) | |
| 108 | +{ | |
| 109 | + return NULL; | |
| 110 | +} | |
| 111 | + | |
| 93 | 112 | #endif |
| 94 | 113 | |
| 95 | 114 | #endif /* __LINUX_USB_ROLE_H */ |
| @@ -198,8 +198,6 @@ struct typec_operations { · 197 unmodified lines | ||
| 198 | 198 | * @pd_revision: USB Power Delivery Specification revision if supported |
| 199 | 199 | * @prefer_role: Initial role preference (DRP ports). |
| 200 | 200 | * @accessory: Supported Accessory Modes |
| 201 | − * @sw: Cable plug orientation switch | |
| 202 | − * @mux: Multiplexer switch for Alternate/Accessory Modes | |
| 203 | 201 | * @fwnode: Optional fwnode of the port |
| 204 | 202 | * @driver_data: Private pointer for driver specific info |
| 205 | 203 | * @ops: Port operations vector |
| @@ -213,6 +211,7 @@ struct typec_capability { · 7 unmodified lines | ||
| 213 | 211 | u16 pd_revision; /* 0300H = "3.0" */ |
| 214 | 212 | int prefer_role; |
| 215 | 213 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; |
| 214 | + unsigned int orientation_aware:1; | |
| 216 | 215 | |
| 217 | 216 | struct fwnode_handle *fwnode; |
| 218 | 217 | void *driver_data; |
| @@ -126,13 +126,6 @@ void typec_altmode_put_plug(struct typec_altmode *plug); · 125 unmodified lines | ||
| 126 | 126 | struct typec_altmode *typec_match_altmode(struct typec_altmode **altmodes, |
| 127 | 127 | size_t n, u16 svid, u8 mode); |
| 128 | 128 | |
| 129 | −struct typec_altmode * | |
| 130 | −typec_altmode_register_notifier(struct device *dev, u16 svid, u8 mode, | |
| 131 | − struct notifier_block *nb); | |
| 132 | − | |
| 133 | −void typec_altmode_unregister_notifier(struct typec_altmode *adev, | |
| 134 | − struct notifier_block *nb); | |
| 135 | − | |
| 136 | 129 | /** |
| 137 | 130 | * typec_altmode_get_orientation - Get cable plug orientation |
| 138 | 131 | * altmode: Handle to the alternate mode |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #ifndef __USB_TYPEC_MUX |
| 4 | 4 | #define __USB_TYPEC_MUX |
| 5 | 5 | |
| 6 | +#include <linux/property.h> | |
| 6 | 7 | #include <linux/usb/typec.h> |
| 7 | 8 | |
| 8 | 9 | struct device; |
| @@ -17,11 +18,20 @@ typedef int (*typec_switch_set_fn_t)(struct typec_switch *sw, · 8 unmodified lines | ||
| 17 | 18 | struct typec_switch_desc { |
| 18 | 19 | struct fwnode_handle *fwnode; |
| 19 | 20 | typec_switch_set_fn_t set; |
| 21 | + const char *name; | |
| 20 | 22 | void *drvdata; |
| 21 | 23 | }; |
| 22 | 24 | |
| 23 | −struct typec_switch *typec_switch_get(struct device *dev); | |
| 25 | +struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode); | |
| 24 | 26 | void typec_switch_put(struct typec_switch *sw); |
| 27 | +int typec_switch_set(struct typec_switch *sw, | |
| 28 | + enum typec_orientation orientation); | |
| 29 | + | |
| 30 | +static inline struct typec_switch *typec_switch_get(struct device *dev) | |
| 31 | +{ | |
| 32 | + return fwnode_typec_switch_get(dev_fwnode(dev)); | |
| 33 | +} | |
| 34 | + | |
| 25 | 35 | struct typec_switch * |
| 26 | 36 | typec_switch_register(struct device *parent, |
| 27 | 37 | const struct typec_switch_desc *desc); |
| @@ -42,12 +52,21 @@ typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux, · 14 unmodified lines | ||
| 42 | 52 | struct typec_mux_desc { |
| 43 | 53 | struct fwnode_handle *fwnode; |
| 44 | 54 | typec_mux_set_fn_t set; |
| 55 | + const char *name; | |
| 45 | 56 | void *drvdata; |
| 46 | 57 | }; |
| 47 | 58 | |
| 48 | −struct typec_mux * | |
| 49 | −typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc); | |
| 59 | +struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode, | |
| 60 | + const struct typec_altmode_desc *desc); | |
| 50 | 61 | void typec_mux_put(struct typec_mux *mux); |
| 62 | +int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state); | |
| 63 | + | |
| 64 | +static inline struct typec_mux * | |
| 65 | +typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc) | |
| 66 | +{ | |
| 67 | + return fwnode_typec_mux_get(dev_fwnode(dev), desc); | |
| 68 | +} | |
| 69 | + | |
| 51 | 70 | struct typec_mux * |
| 52 | 71 | typec_mux_register(struct device *parent, const struct typec_mux_desc *desc); |
| 53 | 72 | void typec_mux_unregister(struct typec_mux *mux); |
| @@ -0,0 +1,53 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __USB_TYPEC_TBT_H | |
| 3 | +#define __USB_TYPEC_TBT_H | |
| 4 | + | |
| 5 | +#include <linux/usb/typec_altmode.h> | |
| 6 | + | |
| 7 | +#define USB_TYPEC_VENDOR_INTEL 0x8087 | |
| 8 | +/* Alias for convenience */ | |
| 9 | +#define USB_TYPEC_TBT_SID USB_TYPEC_VENDOR_INTEL | |
| 10 | + | |
| 11 | +/* Connector state for Thunderbolt3 */ | |
| 12 | +#define TYPEC_TBT_MODE TYPEC_STATE_MODAL | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * struct typec_thunderbolt_data - Thundebolt3 Alt Mode specific data | |
| 16 | + * @device_mode: Device Discover Mode VDO | |
| 17 | + * @cable_mode: Cable Discover Mode VDO | |
| 18 | + * @enter_vdo: Enter Mode VDO | |
| 19 | + */ | |
| 20 | +struct typec_thunderbolt_data { | |
| 21 | + u32 device_mode; | |
| 22 | + u32 cable_mode; | |
| 23 | + u32 enter_vdo; | |
| 24 | +}; | |
| 25 | + | |
| 26 | +/* TBT3 Device Discover Mode VDO bits */ | |
| 27 | +#define TBT_MODE BIT(0) | |
| 28 | +#define TBT_ADAPTER(_vdo_) (((_vdo_) & BIT(16)) >> 16) | |
| 29 | +#define TBT_ADAPTER_LEGACY 0 | |
| 30 | +#define TBT_ADAPTER_TBT3 1 | |
| 31 | +#define TBT_INTEL_SPECIFIC_B0 BIT(26) | |
| 32 | +#define TBT_VENDOR_SPECIFIC_B0 BIT(30) | |
| 33 | +#define TBT_VENDOR_SPECIFIC_B1 BIT(31) | |
| 34 | + | |
| 35 | +#define TBT_SET_ADAPTER(a) (((a) & 1) << 16) | |
| 36 | + | |
| 37 | +/* TBT3 Cable Discover Mode VDO bits */ | |
| 38 | +#define TBT_CABLE_SPEED(_vdo_) (((_vdo_) & GENMASK(18, 16)) >> 16) | |
| 39 | +#define TBT_CABLE_USB3_GEN1 1 | |
| 40 | +#define TBT_CABLE_USB3_PASSIVE 2 | |
| 41 | +#define TBT_CABLE_10_AND_20GBPS 3 | |
| 42 | +#define TBT_CABLE_ROUNDED BIT(19) | |
| 43 | +#define TBT_CABLE_OPTICAL BIT(21) | |
| 44 | +#define TBT_CABLE_RETIMER BIT(22) | |
| 45 | +#define TBT_CABLE_LINK_TRAINING BIT(23) | |
| 46 | + | |
| 47 | +#define TBT_SET_CABLE_SPEED(_s_) (((_s_) & GENMASK(2, 0)) << 16) | |
| 48 | + | |
| 49 | +/* TBT3 Device Enter Mode VDO bits */ | |
| 50 | +#define TBT_ENTER_MODE_CABLE_SPEED(s) TBT_SET_CABLE_SPEED(s) | |
| 51 | +#define TBT_ENTER_MODE_ACTIVE_CABLE BIT(24) | |
| 52 | + | |
| 53 | +#endif /* __USB_TYPEC_TBT_H */ | |
| @@ -92,6 +92,6 @@ enum { US_DO_ALL_FLAGS }; · 91 unmodified lines | ||
| 92 | 92 | #include <linux/usb/storage.h> |
| 93 | 93 | |
| 94 | 94 | extern int usb_usual_ignore_device(struct usb_interface *intf); |
| 95 | −extern struct usb_device_id usb_storage_usb_ids[]; | |
| 95 | +extern const struct usb_device_id usb_storage_usb_ids[]; | |
| 96 | 96 | |
| 97 | 97 | #endif /* __LINUX_USB_USUAL_H */ |
| @@ -69,7 +69,7 @@ struct usbdevfs_urb32 { · 68 unmodified lines | ||
| 69 | 69 | compat_int_t error_count; |
| 70 | 70 | compat_uint_t signr; |
| 71 | 71 | compat_caddr_t usercontext; /* unused */ |
| 72 | − struct usbdevfs_iso_packet_desc iso_frame_desc[0]; | |
| 72 | + struct usbdevfs_iso_packet_desc iso_frame_desc[]; | |
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | 75 | struct usbdevfs_ioctl32 { |
| @@ -14,6 +14,8 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/userfaultfd.h> /* linux/include/uapi/linux/userfaultfd.h */ |
| 15 | 15 | |
| 16 | 16 | #include <linux/fcntl.h> |
| 17 | +#include <linux/mm.h> | |
| 18 | +#include <asm-generic/pgtable_uffd.h> | |
| 17 | 19 | |
| 18 | 20 | /* |
| 19 | 21 | * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining |
| @@ -34,11 +36,14 @@ extern vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason); · 14 unmodified lines | ||
| 34 | 36 | |
| 35 | 37 | extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start, |
| 36 | 38 | unsigned long src_start, unsigned long len, |
| 37 | − bool *mmap_changing); | |
| 39 | + bool *mmap_changing, __u64 mode); | |
| 38 | 40 | extern ssize_t mfill_zeropage(struct mm_struct *dst_mm, |
| 39 | 41 | unsigned long dst_start, |
| 40 | 42 | unsigned long len, |
| 41 | 43 | bool *mmap_changing); |
| 44 | +extern int mwriteprotect_range(struct mm_struct *dst_mm, | |
| 45 | + unsigned long start, unsigned long len, | |
| 46 | + bool enable_wp, bool *mmap_changing); | |
| 42 | 47 | |
| 43 | 48 | /* mm helpers */ |
| 44 | 49 | static inline bool is_mergeable_vm_userfaultfd_ctx(struct vm_area_struct *vma, |
| @@ -52,6 +57,23 @@ static inline bool userfaultfd_missing(struct vm_area_struct *vma) · 7 unmodified lines | ||
| 52 | 57 | return vma->vm_flags & VM_UFFD_MISSING; |
| 53 | 58 | } |
| 54 | 59 | |
| 60 | +static inline bool userfaultfd_wp(struct vm_area_struct *vma) | |
| 61 | +{ | |
| 62 | + return vma->vm_flags & VM_UFFD_WP; | |
| 63 | +} | |
| 64 | + | |
| 65 | +static inline bool userfaultfd_pte_wp(struct vm_area_struct *vma, | |
| 66 | + pte_t pte) | |
| 67 | +{ | |
| 68 | + return userfaultfd_wp(vma) && pte_uffd_wp(pte); | |
| 69 | +} | |
| 70 | + | |
| 71 | +static inline bool userfaultfd_huge_pmd_wp(struct vm_area_struct *vma, | |
| 72 | + pmd_t pmd) | |
| 73 | +{ | |
| 74 | + return userfaultfd_wp(vma) && pmd_uffd_wp(pmd); | |
| 75 | +} | |
| 76 | + | |
| 55 | 77 | static inline bool userfaultfd_armed(struct vm_area_struct *vma) |
| 56 | 78 | { |
| 57 | 79 | return vma->vm_flags & (VM_UFFD_MISSING | VM_UFFD_WP); |
| @@ -96,6 +118,24 @@ static inline bool userfaultfd_missing(struct vm_area_struct *vma) · 38 unmodified lines | ||
| 96 | 118 | return false; |
| 97 | 119 | } |
| 98 | 120 | |
| 121 | +static inline bool userfaultfd_wp(struct vm_area_struct *vma) | |
| 122 | +{ | |
| 123 | + return false; | |
| 124 | +} | |
| 125 | + | |
| 126 | +static inline bool userfaultfd_pte_wp(struct vm_area_struct *vma, | |
| 127 | + pte_t pte) | |
| 128 | +{ | |
| 129 | + return false; | |
| 130 | +} | |
| 131 | + | |
| 132 | +static inline bool userfaultfd_huge_pmd_wp(struct vm_area_struct *vma, | |
| 133 | + pmd_t pmd) | |
| 134 | +{ | |
| 135 | + return false; | |
| 136 | +} | |
| 137 | + | |
| 138 | + | |
| 99 | 139 | static inline bool userfaultfd_armed(struct vm_area_struct *vma) |
| 100 | 140 | { |
| 101 | 141 | return false; |
| @@ -43,6 +43,16 @@ static inline void guid_copy(guid_t *dst, const guid_t *src) · 42 unmodified lines | ||
| 43 | 43 | memcpy(dst, src, sizeof(guid_t)); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | +static inline void import_guid(guid_t *dst, const __u8 *src) | |
| 47 | +{ | |
| 48 | + memcpy(dst, src, sizeof(guid_t)); | |
| 49 | +} | |
| 50 | + | |
| 51 | +static inline void export_guid(__u8 *dst, const guid_t *src) | |
| 52 | +{ | |
| 53 | + memcpy(dst, src, sizeof(guid_t)); | |
| 54 | +} | |
| 55 | + | |
| 46 | 56 | static inline bool guid_is_null(const guid_t *guid) |
| 47 | 57 | { |
| 48 | 58 | return guid_equal(guid, &guid_null); |
| @@ -58,12 +68,23 @@ static inline void uuid_copy(uuid_t *dst, const uuid_t *src) · 9 unmodified lines | ||
| 58 | 68 | memcpy(dst, src, sizeof(uuid_t)); |
| 59 | 69 | } |
| 60 | 70 | |
| 71 | +static inline void import_uuid(uuid_t *dst, const __u8 *src) | |
| 72 | +{ | |
| 73 | + memcpy(dst, src, sizeof(uuid_t)); | |
| 74 | +} | |
| 75 | + | |
| 76 | +static inline void export_uuid(__u8 *dst, const uuid_t *src) | |
| 77 | +{ | |
| 78 | + memcpy(dst, src, sizeof(uuid_t)); | |
| 79 | +} | |
| 80 | + | |
| 61 | 81 | static inline bool uuid_is_null(const uuid_t *uuid) |
| 62 | 82 | { |
| 63 | 83 | return uuid_equal(uuid, &uuid_null); |
| 64 | 84 | } |
| 65 | 85 | |
| 66 | 86 | void generate_random_uuid(unsigned char uuid[16]); |
| 87 | +void generate_random_guid(unsigned char guid[16]); | |
| 67 | 88 | |
| 68 | 89 | extern void guid_gen(guid_t *u); |
| 69 | 90 | extern void uuid_gen(uuid_t *u); |
| @@ -77,7 +98,6 @@ int guid_parse(const char *uuid, guid_t *u); · 7 unmodified lines | ||
| 77 | 98 | int uuid_parse(const char *uuid, uuid_t *u); |
| 78 | 99 | |
| 79 | 100 | /* backwards compatibility, don't use in new code */ |
| 80 | −#define uuid_le_gen(u) guid_gen(u) | |
| 81 | 101 | #define uuid_le_to_bin(guid, u) guid_parse(guid, u) |
| 82 | 102 | |
| 83 | 103 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2) |
| @@ -0,0 +1,253 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_VDPA_H | |
| 3 | +#define _LINUX_VDPA_H | |
| 4 | + | |
| 5 | +#include <linux/kernel.h> | |
| 6 | +#include <linux/device.h> | |
| 7 | +#include <linux/interrupt.h> | |
| 8 | +#include <linux/vhost_iotlb.h> | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * vDPA callback definition. | |
| 12 | + * @callback: interrupt callback function | |
| 13 | + * @private: the data passed to the callback function | |
| 14 | + */ | |
| 15 | +struct vdpa_callback { | |
| 16 | + irqreturn_t (*callback)(void *data); | |
| 17 | + void *private; | |
| 18 | +}; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * vDPA device - representation of a vDPA device | |
| 22 | + * @dev: underlying device | |
| 23 | + * @dma_dev: the actual device that is performing DMA | |
| 24 | + * @config: the configuration ops for this device. | |
| 25 | + * @index: device index | |
| 26 | + */ | |
| 27 | +struct vdpa_device { | |
| 28 | + struct device dev; | |
| 29 | + struct device *dma_dev; | |
| 30 | + const struct vdpa_config_ops *config; | |
| 31 | + unsigned int index; | |
| 32 | +}; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * vDPA_config_ops - operations for configuring a vDPA device. | |
| 36 | + * Note: vDPA device drivers are required to implement all of the | |
| 37 | + * operations unless it is mentioned to be optional in the following | |
| 38 | + * list. | |
| 39 | + * | |
| 40 | + * @set_vq_address: Set the address of virtqueue | |
| 41 | + * @vdev: vdpa device | |
| 42 | + * @idx: virtqueue index | |
| 43 | + * @desc_area: address of desc area | |
| 44 | + * @driver_area: address of driver area | |
| 45 | + * @device_area: address of device area | |
| 46 | + * Returns integer: success (0) or error (< 0) | |
| 47 | + * @set_vq_num: Set the size of virtqueue | |
| 48 | + * @vdev: vdpa device | |
| 49 | + * @idx: virtqueue index | |
| 50 | + * @num: the size of virtqueue | |
| 51 | + * @kick_vq: Kick the virtqueue | |
| 52 | + * @vdev: vdpa device | |
| 53 | + * @idx: virtqueue index | |
| 54 | + * @set_vq_cb: Set the interrupt callback function for | |
| 55 | + * a virtqueue | |
| 56 | + * @vdev: vdpa device | |
| 57 | + * @idx: virtqueue index | |
| 58 | + * @cb: virtio-vdev interrupt callback structure | |
| 59 | + * @set_vq_ready: Set ready status for a virtqueue | |
| 60 | + * @vdev: vdpa device | |
| 61 | + * @idx: virtqueue index | |
| 62 | + * @ready: ready (true) not ready(false) | |
| 63 | + * @get_vq_ready: Get ready status for a virtqueue | |
| 64 | + * @vdev: vdpa device | |
| 65 | + * @idx: virtqueue index | |
| 66 | + * Returns boolean: ready (true) or not (false) | |
| 67 | + * @set_vq_state: Set the state for a virtqueue | |
| 68 | + * @vdev: vdpa device | |
| 69 | + * @idx: virtqueue index | |
| 70 | + * @state: virtqueue state (last_avail_idx) | |
| 71 | + * Returns integer: success (0) or error (< 0) | |
| 72 | + * @get_vq_state: Get the state for a virtqueue | |
| 73 | + * @vdev: vdpa device | |
| 74 | + * @idx: virtqueue index | |
| 75 | + * Returns virtqueue state (last_avail_idx) | |
| 76 | + * @get_vq_align: Get the virtqueue align requirement | |
| 77 | + * for the device | |
| 78 | + * @vdev: vdpa device | |
| 79 | + * Returns virtqueue algin requirement | |
| 80 | + * @get_features: Get virtio features supported by the device | |
| 81 | + * @vdev: vdpa device | |
| 82 | + * Returns the virtio features support by the | |
| 83 | + * device | |
| 84 | + * @set_features: Set virtio features supported by the driver | |
| 85 | + * @vdev: vdpa device | |
| 86 | + * @features: feature support by the driver | |
| 87 | + * Returns integer: success (0) or error (< 0) | |
| 88 | + * @set_config_cb: Set the config interrupt callback | |
| 89 | + * @vdev: vdpa device | |
| 90 | + * @cb: virtio-vdev interrupt callback structure | |
| 91 | + * @get_vq_num_max: Get the max size of virtqueue | |
| 92 | + * @vdev: vdpa device | |
| 93 | + * Returns u16: max size of virtqueue | |
| 94 | + * @get_device_id: Get virtio device id | |
| 95 | + * @vdev: vdpa device | |
| 96 | + * Returns u32: virtio device id | |
| 97 | + * @get_vendor_id: Get id for the vendor that provides this device | |
| 98 | + * @vdev: vdpa device | |
| 99 | + * Returns u32: virtio vendor id | |
| 100 | + * @get_status: Get the device status | |
| 101 | + * @vdev: vdpa device | |
| 102 | + * Returns u8: virtio device status | |
| 103 | + * @set_status: Set the device status | |
| 104 | + * @vdev: vdpa device | |
| 105 | + * @status: virtio device status | |
| 106 | + * @get_config: Read from device specific configuration space | |
| 107 | + * @vdev: vdpa device | |
| 108 | + * @offset: offset from the beginning of | |
| 109 | + * configuration space | |
| 110 | + * @buf: buffer used to read to | |
| 111 | + * @len: the length to read from | |
| 112 | + * configuration space | |
| 113 | + * @set_config: Write to device specific configuration space | |
| 114 | + * @vdev: vdpa device | |
| 115 | + * @offset: offset from the beginning of | |
| 116 | + * configuration space | |
| 117 | + * @buf: buffer used to write from | |
| 118 | + * @len: the length to write to | |
| 119 | + * configuration space | |
| 120 | + * @get_generation: Get device config generation (optional) | |
| 121 | + * @vdev: vdpa device | |
| 122 | + * Returns u32: device generation | |
| 123 | + * @set_map: Set device memory mapping (optional) | |
| 124 | + * Needed for device that using device | |
| 125 | + * specific DMA translation (on-chip IOMMU) | |
| 126 | + * @vdev: vdpa device | |
| 127 | + * @iotlb: vhost memory mapping to be | |
| 128 | + * used by the vDPA | |
| 129 | + * Returns integer: success (0) or error (< 0) | |
| 130 | + * @dma_map: Map an area of PA to IOVA (optional) | |
| 131 | + * Needed for device that using device | |
| 132 | + * specific DMA translation (on-chip IOMMU) | |
| 133 | + * and preferring incremental map. | |
| 134 | + * @vdev: vdpa device | |
| 135 | + * @iova: iova to be mapped | |
| 136 | + * @size: size of the area | |
| 137 | + * @pa: physical address for the map | |
| 138 | + * @perm: device access permission (VHOST_MAP_XX) | |
| 139 | + * Returns integer: success (0) or error (< 0) | |
| 140 | + * @dma_unmap: Unmap an area of IOVA (optional but | |
| 141 | + * must be implemented with dma_map) | |
| 142 | + * Needed for device that using device | |
| 143 | + * specific DMA translation (on-chip IOMMU) | |
| 144 | + * and preferring incremental unmap. | |
| 145 | + * @vdev: vdpa device | |
| 146 | + * @iova: iova to be unmapped | |
| 147 | + * @size: size of the area | |
| 148 | + * Returns integer: success (0) or error (< 0) | |
| 149 | + * @free: Free resources that belongs to vDPA (optional) | |
| 150 | + * @vdev: vdpa device | |
| 151 | + */ | |
| 152 | +struct vdpa_config_ops { | |
| 153 | + /* Virtqueue ops */ | |
| 154 | + int (*set_vq_address)(struct vdpa_device *vdev, | |
| 155 | + u16 idx, u64 desc_area, u64 driver_area, | |
| 156 | + u64 device_area); | |
| 157 | + void (*set_vq_num)(struct vdpa_device *vdev, u16 idx, u32 num); | |
| 158 | + void (*kick_vq)(struct vdpa_device *vdev, u16 idx); | |
| 159 | + void (*set_vq_cb)(struct vdpa_device *vdev, u16 idx, | |
| 160 | + struct vdpa_callback *cb); | |
| 161 | + void (*set_vq_ready)(struct vdpa_device *vdev, u16 idx, bool ready); | |
| 162 | + bool (*get_vq_ready)(struct vdpa_device *vdev, u16 idx); | |
| 163 | + int (*set_vq_state)(struct vdpa_device *vdev, u16 idx, u64 state); | |
| 164 | + u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx); | |
| 165 | + | |
| 166 | + /* Device ops */ | |
| 167 | + u16 (*get_vq_align)(struct vdpa_device *vdev); | |
| 168 | + u64 (*get_features)(struct vdpa_device *vdev); | |
| 169 | + int (*set_features)(struct vdpa_device *vdev, u64 features); | |
| 170 | + void (*set_config_cb)(struct vdpa_device *vdev, | |
| 171 | + struct vdpa_callback *cb); | |
| 172 | + u16 (*get_vq_num_max)(struct vdpa_device *vdev); | |
| 173 | + u32 (*get_device_id)(struct vdpa_device *vdev); | |
| 174 | + u32 (*get_vendor_id)(struct vdpa_device *vdev); | |
| 175 | + u8 (*get_status)(struct vdpa_device *vdev); | |
| 176 | + void (*set_status)(struct vdpa_device *vdev, u8 status); | |
| 177 | + void (*get_config)(struct vdpa_device *vdev, unsigned int offset, | |
| 178 | + void *buf, unsigned int len); | |
| 179 | + void (*set_config)(struct vdpa_device *vdev, unsigned int offset, | |
| 180 | + const void *buf, unsigned int len); | |
| 181 | + u32 (*get_generation)(struct vdpa_device *vdev); | |
| 182 | + | |
| 183 | + /* DMA ops */ | |
| 184 | + int (*set_map)(struct vdpa_device *vdev, struct vhost_iotlb *iotlb); | |
| 185 | + int (*dma_map)(struct vdpa_device *vdev, u64 iova, u64 size, | |
| 186 | + u64 pa, u32 perm); | |
| 187 | + int (*dma_unmap)(struct vdpa_device *vdev, u64 iova, u64 size); | |
| 188 | + | |
| 189 | + /* Free device resources */ | |
| 190 | + void (*free)(struct vdpa_device *vdev); | |
| 191 | +}; | |
| 192 | + | |
| 193 | +struct vdpa_device *__vdpa_alloc_device(struct device *parent, | |
| 194 | + const struct vdpa_config_ops *config, | |
| 195 | + size_t size); | |
| 196 | + | |
| 197 | +#define vdpa_alloc_device(dev_struct, member, parent, config) \ | |
| 198 | + container_of(__vdpa_alloc_device( \ | |
| 199 | + parent, config, \ | |
| 200 | + sizeof(dev_struct) + \ | |
| 201 | + BUILD_BUG_ON_ZERO(offsetof( \ | |
| 202 | + dev_struct, member))), \ | |
| 203 | + dev_struct, member) | |
| 204 | + | |
| 205 | +int vdpa_register_device(struct vdpa_device *vdev); | |
| 206 | +void vdpa_unregister_device(struct vdpa_device *vdev); | |
| 207 | + | |
| 208 | +/** | |
| 209 | + * vdpa_driver - operations for a vDPA driver | |
| 210 | + * @driver: underlying device driver | |
| 211 | + * @probe: the function to call when a device is found. Returns 0 or -errno. | |
| 212 | + * @remove: the function to call when a device is removed. | |
| 213 | + */ | |
| 214 | +struct vdpa_driver { | |
| 215 | + struct device_driver driver; | |
| 216 | + int (*probe)(struct vdpa_device *vdev); | |
| 217 | + void (*remove)(struct vdpa_device *vdev); | |
| 218 | +}; | |
| 219 | + | |
| 220 | +#define vdpa_register_driver(drv) \ | |
| 221 | + __vdpa_register_driver(drv, THIS_MODULE) | |
| 222 | +int __vdpa_register_driver(struct vdpa_driver *drv, struct module *owner); | |
| 223 | +void vdpa_unregister_driver(struct vdpa_driver *drv); | |
| 224 | + | |
| 225 | +#define module_vdpa_driver(__vdpa_driver) \ | |
| 226 | + module_driver(__vdpa_driver, vdpa_register_driver, \ | |
| 227 | + vdpa_unregister_driver) | |
| 228 | + | |
| 229 | +static inline struct vdpa_driver *drv_to_vdpa(struct device_driver *driver) | |
| 230 | +{ | |
| 231 | + return container_of(driver, struct vdpa_driver, driver); | |
| 232 | +} | |
| 233 | + | |
| 234 | +static inline struct vdpa_device *dev_to_vdpa(struct device *_dev) | |
| 235 | +{ | |
| 236 | + return container_of(_dev, struct vdpa_device, dev); | |
| 237 | +} | |
| 238 | + | |
| 239 | +static inline void *vdpa_get_drvdata(const struct vdpa_device *vdev) | |
| 240 | +{ | |
| 241 | + return dev_get_drvdata(&vdev->dev); | |
| 242 | +} | |
| 243 | + | |
| 244 | +static inline void vdpa_set_drvdata(struct vdpa_device *vdev, void *data) | |
| 245 | +{ | |
| 246 | + dev_set_drvdata(&vdev->dev, data); | |
| 247 | +} | |
| 248 | + | |
| 249 | +static inline struct device *vdpa_get_dma_dev(struct vdpa_device *vdev) | |
| 250 | +{ | |
| 251 | + return vdev->dma_dev; | |
| 252 | +} | |
| 253 | +#endif /* _LINUX_VDPA_H */ | |
| @@ -26,6 +26,9 @@ · 25 unmodified lines | ||
| 26 | 26 | * operations documented below |
| 27 | 27 | * @mmap: Perform mmap(2) on a region of the device file descriptor |
| 28 | 28 | * @request: Request for the bus driver to release the device |
| 29 | + * @match: Optional device name match callback (return: 0 for no-match, >0 for | |
| 30 | + * match, -errno for abort (ex. match with insufficient or incorrect | |
| 31 | + * additional args) | |
| 29 | 32 | */ |
| 30 | 33 | struct vfio_device_ops { |
| 31 | 34 | char *name; |
| @@ -39,6 +42,7 @@ struct vfio_device_ops { · 7 unmodified lines | ||
| 39 | 42 | unsigned long arg); |
| 40 | 43 | int (*mmap)(void *device_data, struct vm_area_struct *vma); |
| 41 | 44 | void (*request)(void *device_data, unsigned int count); |
| 45 | + int (*match)(void *device_data, char *buf); | |
| 42 | 46 | }; |
| 43 | 47 | |
| 44 | 48 | extern struct iommu_group *vfio_iommu_group_get(struct device *dev); |
| @@ -82,6 +86,8 @@ struct vfio_iommu_driver_ops { · 37 unmodified lines | ||
| 82 | 86 | struct notifier_block *nb); |
| 83 | 87 | int (*unregister_notifier)(void *iommu_data, |
| 84 | 88 | struct notifier_block *nb); |
| 89 | + int (*dma_rw)(void *iommu_data, dma_addr_t user_iova, | |
| 90 | + void *data, size_t count, bool write); | |
| 85 | 91 | }; |
| 86 | 92 | |
| 87 | 93 | extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops); |
| @@ -94,6 +100,8 @@ extern void vfio_unregister_iommu_driver( · 6 unmodified lines | ||
| 94 | 100 | */ |
| 95 | 101 | extern struct vfio_group *vfio_group_get_external_user(struct file *filep); |
| 96 | 102 | extern void vfio_group_put_external_user(struct vfio_group *group); |
| 103 | +extern struct vfio_group *vfio_group_get_external_user_from_dev(struct device | |
| 104 | + *dev); | |
| 97 | 105 | extern bool vfio_external_group_match_file(struct vfio_group *group, |
| 98 | 106 | struct file *filep); |
| 99 | 107 | extern int vfio_external_user_iommu_id(struct vfio_group *group); |
| @@ -107,6 +115,15 @@ extern int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, · 7 unmodified lines | ||
| 107 | 115 | extern int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn, |
| 108 | 116 | int npage); |
| 109 | 117 | |
| 118 | +extern int vfio_group_pin_pages(struct vfio_group *group, | |
| 119 | + unsigned long *user_iova_pfn, int npage, | |
| 120 | + int prot, unsigned long *phys_pfn); | |
| 121 | +extern int vfio_group_unpin_pages(struct vfio_group *group, | |
| 122 | + unsigned long *user_iova_pfn, int npage); | |
| 123 | + | |
| 124 | +extern int vfio_dma_rw(struct vfio_group *group, dma_addr_t user_iova, | |
| 125 | + void *data, size_t len, bool write); | |
| 126 | + | |
| 110 | 127 | /* each type has independent events */ |
| 111 | 128 | enum vfio_notify_type { |
| 112 | 129 | VFIO_IOMMU_NOTIFY = 0, |
| @@ -0,0 +1,47 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_VHOST_IOTLB_H | |
| 3 | +#define _LINUX_VHOST_IOTLB_H | |
| 4 | + | |
| 5 | +#include <linux/interval_tree_generic.h> | |
| 6 | + | |
| 7 | +struct vhost_iotlb_map { | |
| 8 | + struct rb_node rb; | |
| 9 | + struct list_head link; | |
| 10 | + u64 start; | |
| 11 | + u64 last; | |
| 12 | + u64 size; | |
| 13 | + u64 addr; | |
| 14 | +#define VHOST_MAP_RO 0x1 | |
| 15 | +#define VHOST_MAP_WO 0x2 | |
| 16 | +#define VHOST_MAP_RW 0x3 | |
| 17 | + u32 perm; | |
| 18 | + u32 flags_padding; | |
| 19 | + u64 __subtree_last; | |
| 20 | +}; | |
| 21 | + | |
| 22 | +#define VHOST_IOTLB_FLAG_RETIRE 0x1 | |
| 23 | + | |
| 24 | +struct vhost_iotlb { | |
| 25 | + struct rb_root_cached root; | |
| 26 | + struct list_head list; | |
| 27 | + unsigned int limit; | |
| 28 | + unsigned int nmaps; | |
| 29 | + unsigned int flags; | |
| 30 | +}; | |
| 31 | + | |
| 32 | +int vhost_iotlb_add_range(struct vhost_iotlb *iotlb, u64 start, u64 last, | |
| 33 | + u64 addr, unsigned int perm); | |
| 34 | +void vhost_iotlb_del_range(struct vhost_iotlb *iotlb, u64 start, u64 last); | |
| 35 | + | |
| 36 | +struct vhost_iotlb *vhost_iotlb_alloc(unsigned int limit, unsigned int flags); | |
| 37 | +void vhost_iotlb_free(struct vhost_iotlb *iotlb); | |
| 38 | +void vhost_iotlb_reset(struct vhost_iotlb *iotlb); | |
| 39 | + | |
| 40 | +struct vhost_iotlb_map * | |
| 41 | +vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last); | |
| 42 | +struct vhost_iotlb_map * | |
| 43 | +vhost_iotlb_itree_next(struct vhost_iotlb_map *map, u64 start, u64 last); | |
| 44 | + | |
| 45 | +void vhost_iotlb_map_free(struct vhost_iotlb *iotlb, | |
| 46 | + struct vhost_iotlb_map *map); | |
| 47 | +#endif | |
| @@ -73,9 +73,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 72 unmodified lines | ||
| 73 | 73 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| 74 | 74 | THP_FAULT_ALLOC, |
| 75 | 75 | THP_FAULT_FALLBACK, |
| 76 | + THP_FAULT_FALLBACK_CHARGE, | |
| 76 | 77 | THP_COLLAPSE_ALLOC, |
| 77 | 78 | THP_COLLAPSE_ALLOC_FAILED, |
| 78 | 79 | THP_FILE_ALLOC, |
| 80 | + THP_FILE_FALLBACK, | |
| 81 | + THP_FILE_FALLBACK_CHARGE, | |
| 79 | 82 | THP_FILE_MAPPED, |
| 80 | 83 | THP_SPLIT_PAGE, |
| 81 | 84 | THP_SPLIT_PAGE_FAILED, |
| @@ -115,6 +118,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 33 unmodified lines | ||
| 115 | 118 | |
| 116 | 119 | #ifndef CONFIG_TRANSPARENT_HUGEPAGE |
| 117 | 120 | #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; }) |
| 121 | +#define THP_FILE_FALLBACK ({ BUILD_BUG(); 0; }) | |
| 122 | +#define THP_FILE_FALLBACK_CHARGE ({ BUILD_BUG(); 0; }) | |
| 118 | 123 | #define THP_FILE_MAPPED ({ BUILD_BUG(); 0; }) |
| 119 | 124 | #endif |
| 120 | 125 | |
| @@ -141,8 +141,9 @@ extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, · 140 unmodified lines | ||
| 141 | 141 | |
| 142 | 142 | extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
| 143 | 143 | unsigned long pgoff); |
| 144 | −void vmalloc_sync_all(void); | |
| 145 | − | |
| 144 | +void vmalloc_sync_mappings(void); | |
| 145 | +void vmalloc_sync_unmappings(void); | |
| 146 | + | |
| 146 | 147 | /* |
| 147 | 148 | * Lowlevel-APIs (not for driver use!) |
| 148 | 149 | */ |
| @@ -14,6 +14,8 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/virtio_byteorder.h> |
| 15 | 15 | #include <linux/uio.h> |
| 16 | 16 | #include <linux/slab.h> |
| 17 | +#include <linux/dma-direction.h> | |
| 18 | +#include <linux/vhost_iotlb.h> | |
| 17 | 19 | #include <asm/barrier.h> |
| 18 | 20 | |
| 19 | 21 | /* virtio_ring with information needed for host access. */ |
| @@ -39,6 +41,9 @@ struct vringh { · 19 unmodified lines | ||
| 39 | 41 | /* The vring (note: it may contain user pointers!) */ |
| 40 | 42 | struct vring vring; |
| 41 | 43 | |
| 44 | + /* IOTLB for this vring */ | |
| 45 | + struct vhost_iotlb *iotlb; | |
| 46 | + | |
| 42 | 47 | /* The function to call to notify the guest about added buffers */ |
| 43 | 48 | void (*notify)(struct vringh *); |
| 44 | 49 | }; |
| @@ -248,4 +253,35 @@ static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val) · 203 unmodified lines | ||
| 248 | 253 | { |
| 249 | 254 | return __cpu_to_virtio64(vringh_is_little_endian(vrh), val); |
| 250 | 255 | } |
| 256 | + | |
| 257 | +void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb); | |
| 258 | + | |
| 259 | +int vringh_init_iotlb(struct vringh *vrh, u64 features, | |
| 260 | + unsigned int num, bool weak_barriers, | |
| 261 | + struct vring_desc *desc, | |
| 262 | + struct vring_avail *avail, | |
| 263 | + struct vring_used *used); | |
| 264 | + | |
| 265 | +int vringh_getdesc_iotlb(struct vringh *vrh, | |
| 266 | + struct vringh_kiov *riov, | |
| 267 | + struct vringh_kiov *wiov, | |
| 268 | + u16 *head, | |
| 269 | + gfp_t gfp); | |
| 270 | + | |
| 271 | +ssize_t vringh_iov_pull_iotlb(struct vringh *vrh, | |
| 272 | + struct vringh_kiov *riov, | |
| 273 | + void *dst, size_t len); | |
| 274 | +ssize_t vringh_iov_push_iotlb(struct vringh *vrh, | |
| 275 | + struct vringh_kiov *wiov, | |
| 276 | + const void *src, size_t len); | |
| 277 | + | |
| 278 | +void vringh_abandon_iotlb(struct vringh *vrh, unsigned int num); | |
| 279 | + | |
| 280 | +int vringh_complete_iotlb(struct vringh *vrh, u16 head, u32 len); | |
| 281 | + | |
| 282 | +bool vringh_notify_enable_iotlb(struct vringh *vrh); | |
| 283 | +void vringh_notify_disable_iotlb(struct vringh *vrh); | |
| 284 | + | |
| 285 | +int vringh_need_notify_iotlb(struct vringh *vrh); | |
| 286 | + | |
| 251 | 287 | #endif /* _LINUX_VRINGH_H */ |
| @@ -28,8 +28,9 @@ · 27 unmodified lines | ||
| 28 | 28 | #define BROKEN_GRAPHICS_PROGRAMS 1 |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | −extern void kd_mksound(unsigned int hz, unsigned int ticks); | |
| 32 | −extern int kbd_rate(struct kbd_repeat *rep); | |
| 31 | +void kd_mksound(unsigned int hz, unsigned int ticks); | |
| 32 | +int kbd_rate(struct kbd_repeat *rep); | |
| 33 | + | |
| 33 | 34 | extern int fg_console, last_console, want_console; |
| 34 | 35 | |
| 35 | 36 | /* console.c */ |
| @@ -131,11 +132,11 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new); · 95 unmodified lines | ||
| 131 | 132 | int vt_waitactive(int n); |
| 132 | 133 | void change_console(struct vc_data *new_vc); |
| 133 | 134 | void reset_vc(struct vc_data *vc); |
| 134 | −extern int do_unbind_con_driver(const struct consw *csw, int first, int last, | |
| 135 | − int deflt); | |
| 135 | +int do_unbind_con_driver(const struct consw *csw, int first, int last, | |
| 136 | + int deflt); | |
| 136 | 137 | int vty_init(const struct file_operations *console_fops); |
| 137 | 138 | |
| 138 | −extern char vt_dont_switch; | |
| 139 | +extern bool vt_dont_switch; | |
| 139 | 140 | extern int default_utf8; |
| 140 | 141 | extern int global_cursor_default; |
| 141 | 142 | |
| @@ -146,7 +147,7 @@ struct vt_spawn_console { · 4 unmodified lines | ||
| 146 | 147 | }; |
| 147 | 148 | extern struct vt_spawn_console vt_spawn_con; |
| 148 | 149 | |
| 149 | −extern int vt_move_to_console(unsigned int vt, int alloc); | |
| 150 | +int vt_move_to_console(unsigned int vt, int alloc); | |
| 150 | 151 | |
| 151 | 152 | /* Interfaces for VC notification of character events (for accessibility etc) */ |
| 152 | 153 | |
| @@ -155,35 +156,34 @@ struct vt_notifier_param { · 2 unmodified lines | ||
| 155 | 156 | unsigned int c; /* Printed char */ |
| 156 | 157 | }; |
| 157 | 158 | |
| 158 | −extern int register_vt_notifier(struct notifier_block *nb); | |
| 159 | −extern int unregister_vt_notifier(struct notifier_block *nb); | |
| 159 | +int register_vt_notifier(struct notifier_block *nb); | |
| 160 | +int unregister_vt_notifier(struct notifier_block *nb); | |
| 160 | 161 | |
| 161 | −extern void hide_boot_cursor(bool hide); | |
| 162 | +void hide_boot_cursor(bool hide); | |
| 162 | 163 | |
| 163 | 164 | /* keyboard provided interfaces */ |
| 164 | −extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm); | |
| 165 | −extern int vt_do_kdskbmode(int console, unsigned int arg); | |
| 166 | −extern int vt_do_kdskbmeta(int console, unsigned int arg); | |
| 167 | −extern int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, | |
| 168 | − int perm); | |
| 169 | −extern int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, | |
| 170 | − int perm, int console); | |
| 171 | −extern int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, | |
| 172 | − int perm); | |
| 173 | −extern int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm); | |
| 174 | −extern int vt_do_kdgkbmode(int console); | |
| 175 | −extern int vt_do_kdgkbmeta(int console); | |
| 176 | −extern void vt_reset_unicode(int console); | |
| 177 | −extern int vt_get_shift_state(void); | |
| 178 | −extern void vt_reset_keyboard(int console); | |
| 179 | −extern int vt_get_leds(int console, int flag); | |
| 180 | −extern int vt_get_kbd_mode_bit(int console, int bit); | |
| 181 | −extern void vt_set_kbd_mode_bit(int console, int bit); | |
| 182 | −extern void vt_clr_kbd_mode_bit(int console, int bit); | |
| 183 | −extern void vt_set_led_state(int console, int leds); | |
| 184 | −extern void vt_set_led_state(int console, int leds); | |
| 185 | −extern void vt_kbd_con_start(int console); | |
| 186 | −extern void vt_kbd_con_stop(int console); | |
| 165 | +int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm); | |
| 166 | +int vt_do_kdskbmode(int console, unsigned int arg); | |
| 167 | +int vt_do_kdskbmeta(int console, unsigned int arg); | |
| 168 | +int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, | |
| 169 | + int perm); | |
| 170 | +int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, | |
| 171 | + int console); | |
| 172 | +int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm); | |
| 173 | +int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm); | |
| 174 | +int vt_do_kdgkbmode(int console); | |
| 175 | +int vt_do_kdgkbmeta(int console); | |
| 176 | +void vt_reset_unicode(int console); | |
| 177 | +int vt_get_shift_state(void); | |
| 178 | +void vt_reset_keyboard(int console); | |
| 179 | +int vt_get_leds(int console, int flag); | |
| 180 | +int vt_get_kbd_mode_bit(int console, int bit); | |
| 181 | +void vt_set_kbd_mode_bit(int console, int bit); | |
| 182 | +void vt_clr_kbd_mode_bit(int console, int bit); | |
| 183 | +void vt_set_led_state(int console, int leds); | |
| 184 | +void vt_set_led_state(int console, int leds); | |
| 185 | +void vt_kbd_con_start(int console); | |
| 186 | +void vt_kbd_con_stop(int console); | |
| 187 | 187 | |
| 188 | 188 | void vc_scrolldelta_helper(struct vc_data *c, int lines, |
| 189 | 189 | unsigned int rolled_over, void *_base, unsigned int size); |
| @@ -20,6 +20,7 @@ int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int · 19 unmodified lines | ||
| 20 | 20 | #define WQ_FLAG_EXCLUSIVE 0x01 |
| 21 | 21 | #define WQ_FLAG_WOKEN 0x02 |
| 22 | 22 | #define WQ_FLAG_BOOKMARK 0x04 |
| 23 | +#define WQ_FLAG_CUSTOM 0x08 | |
| 23 | 24 | |
| 24 | 25 | /* |
| 25 | 26 | * A single wait-queue entry structure: |
| @@ -487,6 +487,19 @@ extern void wq_worker_comm(char *buf, size_t size, struct task_struct *task); · 486 unmodified lines | ||
| 487 | 487 | * |
| 488 | 488 | * We queue the work to the CPU on which it was submitted, but if the CPU dies |
| 489 | 489 | * it can be processed by another CPU. |
| 490 | + * | |
| 491 | + * Memory-ordering properties: If it returns %true, guarantees that all stores | |
| 492 | + * preceding the call to queue_work() in the program order will be visible from | |
| 493 | + * the CPU which will execute @work by the time such work executes, e.g., | |
| 494 | + * | |
| 495 | + * { x is initially 0 } | |
| 496 | + * | |
| 497 | + * CPU0 CPU1 | |
| 498 | + * | |
| 499 | + * WRITE_ONCE(x, 1); [ @work is being executed ] | |
| 500 | + * r0 = queue_work(wq, work); r1 = READ_ONCE(x); | |
| 501 | + * | |
| 502 | + * Forbids: r0 == true && r1 == 0 | |
| 490 | 503 | */ |
| 491 | 504 | static inline bool queue_work(struct workqueue_struct *wq, |
| 492 | 505 | struct work_struct *work) |
| @@ -546,6 +559,9 @@ static inline bool schedule_work_on(int cpu, struct work_struct *work) · 53 unmodified lines | ||
| 546 | 559 | * This puts a job in the kernel-global workqueue if it was not already |
| 547 | 560 | * queued and leaves it in the same position on the kernel-global |
| 548 | 561 | * workqueue otherwise. |
| 562 | + * | |
| 563 | + * Shares the same memory-ordering properties of queue_work(), cf. the | |
| 564 | + * DocBook header of queue_work(). | |
| 549 | 565 | */ |
| 550 | 566 | static inline bool schedule_work(struct work_struct *work) |
| 551 | 567 | { |
| @@ -649,7 +665,7 @@ int workqueue_online_cpu(unsigned int cpu); · 97 unmodified lines | ||
| 649 | 665 | int workqueue_offline_cpu(unsigned int cpu); |
| 650 | 666 | #endif |
| 651 | 667 | |
| 652 | −int __init workqueue_init_early(void); | |
| 653 | −int __init workqueue_init(void); | |
| 668 | +void __init workqueue_init_early(void); | |
| 669 | +void __init workqueue_init(void); | |
| 654 | 670 | |
| 655 | 671 | #endif |
| @@ -32,8 +32,8 @@ · 31 unmodified lines | ||
| 32 | 32 | * The following internal entries have a special meaning: |
| 33 | 33 | * |
| 34 | 34 | * 0-62: Sibling entries |
| 35 | − * 256: Zero entry | |
| 36 | − * 257: Retry entry | |
| 35 | + * 256: Retry entry | |
| 36 | + * 257: Zero entry | |
| 37 | 37 | * |
| 38 | 38 | * Errors are also represented as internal entries, but use the negative |
| 39 | 39 | * space (-4094 to -2). They're never stored in the slots array; only |
| @@ -1648,6 +1648,7 @@ static inline void *xas_next_marked(struct xa_state *xas, unsigned long max, · 1608 unmodified lines | ||
| 1648 | 1648 | xa_mark_t mark) |
| 1649 | 1649 | { |
| 1650 | 1650 | struct xa_node *node = xas->xa_node; |
| 1651 | + void *entry; | |
| 1651 | 1652 | unsigned int offset; |
| 1652 | 1653 | |
| 1653 | 1654 | if (unlikely(xas_not_node(node) || node->shift)) |
| @@ -1659,7 +1660,10 @@ static inline void *xas_next_marked(struct xa_state *xas, unsigned long max, · 5 unmodified lines | ||
| 1659 | 1660 | return NULL; |
| 1660 | 1661 | if (offset == XA_CHUNK_SIZE) |
| 1661 | 1662 | return xas_find_marked(xas, max, mark); |
| 1662 | − return xa_entry(xas->xa, node, offset); | |
| 1663 | + entry = xa_entry(xas->xa, node, offset); | |
| 1664 | + if (!entry) | |
| 1665 | + return xas_find_marked(xas, max, mark); | |
| 1666 | + return entry; | |
| 1663 | 1667 | } |
| 1664 | 1668 | |
| 1665 | 1669 | /* |
| @@ -102,7 +102,8 @@ struct simple_xattr *simple_xattr_alloc(const void *value, size_t size); · 101 unmodified lines | ||
| 102 | 102 | int simple_xattr_get(struct simple_xattrs *xattrs, const char *name, |
| 103 | 103 | void *buffer, size_t size); |
| 104 | 104 | int simple_xattr_set(struct simple_xattrs *xattrs, const char *name, |
| 105 | − const void *value, size_t size, int flags); | |
| 105 | + const void *value, size_t size, int flags, | |
| 106 | + ssize_t *removed_size); | |
| 106 | 107 | ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs, char *buffer, |
| 107 | 108 | size_t size); |
| 108 | 109 | void simple_xattr_list_add(struct simple_xattrs *xattrs, |
| @@ -40,13 +40,6 @@ struct zorro_dev { · 39 unmodified lines | ||
| 40 | 40 | #define to_zorro_dev(n) container_of(n, struct zorro_dev, dev) |
| 41 | 41 | |
| 42 | 42 | |
| 43 | − /* | |
| 44 | − * Zorro bus | |
| 45 | − */ | |
| 46 | − | |
| 47 | −extern struct bus_type zorro_bus_type; | |
| 48 | − | |
| 49 | − | |
| 50 | 43 | /* |
| 51 | 44 | * Zorro device drivers |
| 52 | 45 | */ |
| @@ -70,11 +63,6 @@ struct zorro_driver { · 17 unmodified lines | ||
| 70 | 63 | /* New-style probing */ |
| 71 | 64 | extern int zorro_register_driver(struct zorro_driver *); |
| 72 | 65 | extern void zorro_unregister_driver(struct zorro_driver *); |
| 73 | −extern const struct zorro_device_id *zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z); | |
| 74 | −static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z) | |
| 75 | −{ | |
| 76 | − return z->driver; | |
| 77 | −} | |
| 78 | 66 | |
| 79 | 67 | |
| 80 | 68 | extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */ |