diff options
Diffstat (limited to 'include/linux')
163 files changed, 3196 insertions, 1051 deletions
| diff --git a/include/linux/acpi.h b/include/linux/acpi.h index fd8849ae4a8e..640f1c07c894 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -70,19 +70,6 @@ static inline void acpi_free_fwnode_static(struct fwnode_handle *fwnode)  	kfree(fwnode);  } -/** - * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with - * the PCI-defined class-code information - * - * @_cls : the class, subclass, prog-if triple for this device - * @_msk : the class mask for this device - * - * This macro is used to create a struct acpi_device_id that matches a - * specific PCI class. The .id and .driver_data fields will be left - * initialized with the default value. - */ -#define ACPI_DEVICE_CLASS(_cls, _msk)	.cls = (_cls), .cls_msk = (_msk), -  static inline bool has_acpi_companion(struct device *dev)  {  	return is_acpi_device_node(dev->fwnode); @@ -414,6 +401,8 @@ extern bool acpi_is_pnp_device(struct acpi_device *);  typedef void (*wmi_notify_handler) (u32 value, void *context); +int wmi_instance_count(const char *guid); +  extern acpi_status wmi_evaluate_method(const char *guid, u8 instance,  					u32 method_id,  					const struct acpi_buffer *in, @@ -780,7 +769,6 @@ const char *acpi_get_subsystem_id(acpi_handle handle);  #define ACPI_COMPANION_SET(dev, adev)	do { } while (0)  #define ACPI_HANDLE(dev)		(NULL)  #define ACPI_HANDLE_FWNODE(fwnode)	(NULL) -#define ACPI_DEVICE_CLASS(_cls, _msk)	.cls = (0), .cls_msk = (0),  #include <acpi/acpi_numa.h> diff --git a/include/linux/aer.h b/include/linux/aer.h index 97f64ba1b34a..3a3ab05e13fd 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -45,8 +45,6 @@ struct aer_capability_regs {  int pci_enable_pcie_error_reporting(struct pci_dev *dev);  int pci_disable_pcie_error_reporting(struct pci_dev *dev);  int pci_aer_clear_nonfatal_status(struct pci_dev *dev); -void pci_save_aer_state(struct pci_dev *dev); -void pci_restore_aer_state(struct pci_dev *dev);  #else  static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)  { @@ -60,8 +58,6 @@ static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)  {  	return -EINVAL;  } -static inline void pci_save_aer_state(struct pci_dev *dev) {} -static inline void pci_restore_aer_state(struct pci_dev *dev) {}  #endif  void cper_print_aer(struct pci_dev *dev, int aer_severity, diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 5001e14c5c06..c60a6a14638c 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h @@ -107,7 +107,7 @@ enum amba_vendor {  extern struct bus_type amba_bustype; -#define to_amba_device(d)	container_of(d, struct amba_device, dev) +#define to_amba_device(d)	container_of_const(d, struct amba_device, dev)  #define amba_get_drvdata(d)	dev_get_drvdata(&d->dev)  #define amba_set_drvdata(d,p)	dev_set_drvdata(&d->dev, p) diff --git a/include/linux/aperture.h b/include/linux/aperture.h index 442f15a57cad..1a9a88b11584 100644 --- a/include/linux/aperture.h +++ b/include/linux/aperture.h @@ -14,7 +14,9 @@ int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,  					      resource_size_t size);  int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, -					bool primary, const char *name); +					const char *name); + +int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev);  int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name);  #else @@ -26,7 +28,12 @@ static inline int devm_aperture_acquire_for_platform_device(struct platform_devi  }  static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, -						      bool primary, const char *name) +						      const char *name) +{ +	return 0; +} + +static inline int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev)  {  	return 0;  } @@ -39,7 +46,6 @@ static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev,  /**   * aperture_remove_all_conflicting_devices - remove all existing framebuffers - * @primary: also kick vga16fb if present; only relevant for VGA devices   * @name: a descriptive name of the requesting driver   *   * This function removes all graphics device drivers. Use this function on systems @@ -48,9 +54,9 @@ static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev,   * Returns:   * 0 on success, or a negative errno code otherwise   */ -static inline int aperture_remove_all_conflicting_devices(bool primary, const char *name) +static inline int aperture_remove_all_conflicting_devices(const char *name)  { -	return aperture_remove_conflicting_devices(0, (resource_size_t)-1, primary, name); +	return aperture_remove_conflicting_devices(0, (resource_size_t)-1, name);  }  #endif diff --git a/include/linux/arm-cci.h b/include/linux/arm-cci.h index d0e44201d855..7f7a576267bc 100644 --- a/include/linux/arm-cci.h +++ b/include/linux/arm-cci.h @@ -43,6 +43,8 @@ static inline int __cci_control_port_by_index(u32 port, bool enable)  }  #endif +void cci_enable_port_for_self(void); +  #define cci_disable_port_by_device(dev) \  	__cci_control_port_by_device(dev, false)  #define cci_enable_port_by_device(dev) \ diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index 583fe3b49a49..cc060da51bec 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -94,6 +94,14 @@   */  #define FFA_PAGE_SIZE		SZ_4K +/* + * Minimum buffer size/alignment encodings returned by an FFA_FEATURES + * query for FFA_RXTX_MAP. + */ +#define FFA_FEAT_RXTX_MIN_SZ_4K		0 +#define FFA_FEAT_RXTX_MIN_SZ_64K	1 +#define FFA_FEAT_RXTX_MIN_SZ_16K	2 +  /* FFA Bus/Device/Driver related */  struct ffa_device {  	u32 id; diff --git a/include/linux/ata.h b/include/linux/ata.h index c224dbddb9b2..792e10a09787 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -322,15 +322,21 @@ enum {  	ATA_LOG_SATA_NCQ	= 0x10,  	ATA_LOG_NCQ_NON_DATA	= 0x12,  	ATA_LOG_NCQ_SEND_RECV	= 0x13, +	ATA_LOG_CDL		= 0x18, +	ATA_LOG_CDL_SIZE	= ATA_SECT_SIZE,  	ATA_LOG_IDENTIFY_DEVICE	= 0x30, +	ATA_LOG_SENSE_NCQ	= 0x0F, +	ATA_LOG_SENSE_NCQ_SIZE	= ATA_SECT_SIZE * 2,  	ATA_LOG_CONCURRENT_POSITIONING_RANGES = 0x47,  	/* Identify device log pages: */ +	ATA_LOG_SUPPORTED_CAPABILITIES	= 0x03, +	ATA_LOG_CURRENT_SETTINGS  = 0x04,  	ATA_LOG_SECURITY	  = 0x06,  	ATA_LOG_SATA_SETTINGS	  = 0x08,  	ATA_LOG_ZONED_INFORMATION = 0x09, -	/* Identify device SATA settings log:*/ +	/* Identify device SATA settings log: */  	ATA_LOG_DEVSLP_OFFSET	  = 0x30,  	ATA_LOG_DEVSLP_SIZE	  = 0x08,  	ATA_LOG_DEVSLP_MDAT	  = 0x00, @@ -415,6 +421,8 @@ enum {  	SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */  	SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */ +	SETFEATURES_CDL		= 0x0d, /* Enable/disable cmd duration limits */ +  	/* SETFEATURE Sector counts for SATA features */  	SATA_FPDMA_OFFSET	= 0x01,	/* FPDMA non-zero buffer offsets */  	SATA_FPDMA_AA		= 0x02, /* FPDMA Setup FIS Auto-Activate */ @@ -425,6 +433,7 @@ enum {  	SATA_DEVSLP		= 0x09,	/* Device Sleep */  	SETFEATURE_SENSE_DATA	= 0xC3, /* Sense Data Reporting feature */ +	SETFEATURE_SENSE_DATA_SUCC_NCQ = 0xC4, /* Sense Data for successful NCQ commands */  	/* feature values for SET_MAX */  	ATA_SET_MAX_ADDR	= 0x00, diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 752a54e3284b..0bad62cca3d0 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -103,7 +103,7 @@ typedef u16 blk_short_t;  #define BLK_STS_NOSPC		((__force blk_status_t)3)  #define BLK_STS_TRANSPORT	((__force blk_status_t)4)  #define BLK_STS_TARGET		((__force blk_status_t)5) -#define BLK_STS_NEXUS		((__force blk_status_t)6) +#define BLK_STS_RESV_CONFLICT	((__force blk_status_t)6)  #define BLK_STS_MEDIUM		((__force blk_status_t)7)  #define BLK_STS_PROTECTION	((__force blk_status_t)8)  #define BLK_STS_RESOURCE	((__force blk_status_t)9) @@ -173,6 +173,12 @@ typedef u16 blk_short_t;   */  #define BLK_STS_OFFLINE		((__force blk_status_t)17) +/* + * BLK_STS_DURATION_LIMIT is returned from the driver when the target device + * aborted the command because it exceeded one of its Command Duration Limits. + */ +#define BLK_STS_DURATION_LIMIT	((__force blk_status_t)18) +  /**   * blk_path_error - returns true if error may be path related   * @error: status the request was completed with @@ -191,7 +197,7 @@ static inline bool blk_path_error(blk_status_t error)  	case BLK_STS_NOTSUPP:  	case BLK_STS_NOSPC:  	case BLK_STS_TARGET: -	case BLK_STS_NEXUS: +	case BLK_STS_RESV_CONFLICT:  	case BLK_STS_MEDIUM:  	case BLK_STS_PROTECTION:  		return false; diff --git a/include/linux/bpf.h b/include/linux/bpf.h index e53ceee1df37..f58895830ada 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -1125,7 +1125,6 @@ struct bpf_trampoline {  	int progs_cnt[BPF_TRAMP_MAX];  	/* Executable image of trampoline */  	struct bpf_tramp_image *cur_image; -	u64 selector;  	struct module *mod;  }; @@ -1197,7 +1196,7 @@ enum bpf_dynptr_type {  };  int bpf_dynptr_check_size(u32 size); -u32 bpf_dynptr_get_size(const struct bpf_dynptr_kern *ptr); +u32 __bpf_dynptr_size(const struct bpf_dynptr_kern *ptr);  #ifdef CONFIG_BPF_JIT  int bpf_trampoline_link_prog(struct bpf_tramp_link *link, struct bpf_trampoline *tr); @@ -2078,8 +2077,8 @@ struct file *bpf_link_new_file(struct bpf_link *link, int *reserved_fd);  struct bpf_link *bpf_link_get_from_fd(u32 ufd);  struct bpf_link *bpf_link_get_curr_or_next(u32 *id); -int bpf_obj_pin_user(u32 ufd, const char __user *pathname); -int bpf_obj_get_user(const char __user *pathname, int flags); +int bpf_obj_pin_user(u32 ufd, int path_fd, const char __user *pathname); +int bpf_obj_get_user(int path_fd, const char __user *pathname, int flags);  #define BPF_ITER_FUNC_PREFIX "bpf_iter_"  #define DEFINE_BPF_ITER_FUNC(target, args...)			\ diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 3dd29a53b711..f70f9ac884d2 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -18,8 +18,11 @@   * that converting umax_value to int cannot overflow.   */  #define BPF_MAX_VAR_SIZ	(1 << 29) -/* size of type_str_buf in bpf_verifier. */ -#define TYPE_STR_BUF_LEN 128 +/* size of tmp_str_buf in bpf_verifier. + * we need at least 306 bytes to fit full stack mask representation + * (in the "-8,-16,...,-512" form) + */ +#define TMP_STR_BUF_LEN 320  /* Liveness marks, used for registers and spilled-regs (in stack slots).   * Read marks propagate upwards until they find a write mark; they record that @@ -238,6 +241,10 @@ enum bpf_stack_slot_type {  #define BPF_REG_SIZE 8	/* size of eBPF register in bytes */ +#define BPF_REGMASK_ARGS ((1 << BPF_REG_1) | (1 << BPF_REG_2) | \ +			  (1 << BPF_REG_3) | (1 << BPF_REG_4) | \ +			  (1 << BPF_REG_5)) +  #define BPF_DYNPTR_SIZE		sizeof(struct bpf_dynptr_kern)  #define BPF_DYNPTR_NR_SLOTS		(BPF_DYNPTR_SIZE / BPF_REG_SIZE) @@ -306,11 +313,6 @@ struct bpf_idx_pair {  	u32 idx;  }; -struct bpf_id_pair { -	u32 old; -	u32 cur; -}; -  #define MAX_CALL_FRAMES 8  /* Maximum number of register states that can exist at once */  #define BPF_ID_MAP_SIZE ((MAX_BPF_REG + MAX_BPF_STACK / BPF_REG_SIZE) * MAX_CALL_FRAMES) @@ -541,6 +543,30 @@ struct bpf_subprog_info {  	bool is_async_cb;  }; +struct bpf_verifier_env; + +struct backtrack_state { +	struct bpf_verifier_env *env; +	u32 frame; +	u32 reg_masks[MAX_CALL_FRAMES]; +	u64 stack_masks[MAX_CALL_FRAMES]; +}; + +struct bpf_id_pair { +	u32 old; +	u32 cur; +}; + +struct bpf_idmap { +	u32 tmp_id_gen; +	struct bpf_id_pair map[BPF_ID_MAP_SIZE]; +}; + +struct bpf_idset { +	u32 count; +	u32 ids[BPF_ID_MAP_SIZE]; +}; +  /* single container for all structs   * one verifier_env per bpf_check() call   */ @@ -572,12 +598,16 @@ struct bpf_verifier_env {  	const struct bpf_line_info *prev_linfo;  	struct bpf_verifier_log log;  	struct bpf_subprog_info subprog_info[BPF_MAX_SUBPROGS + 1]; -	struct bpf_id_pair idmap_scratch[BPF_ID_MAP_SIZE]; +	union { +		struct bpf_idmap idmap_scratch; +		struct bpf_idset idset_scratch; +	};  	struct {  		int *insn_state;  		int *insn_stack;  		int cur_stack;  	} cfg; +	struct backtrack_state bt;  	u32 pass_cnt; /* number of times do_check() was called */  	u32 subprog_cnt;  	/* number of instructions analyzed by the verifier */ @@ -606,8 +636,10 @@ struct bpf_verifier_env {  	/* Same as scratched_regs but for stack slots */  	u64 scratched_stack_slots;  	u64 prev_log_pos, prev_insn_print_pos; -	/* buffer used in reg_type_str() to generate reg_type string */ -	char type_str_buf[TYPE_STR_BUF_LEN]; +	/* buffer used to generate temporary string representations, +	 * e.g., in reg_type_str() to generate reg_type string +	 */ +	char tmp_str_buf[TMP_STR_BUF_LEN];  };  __printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log, diff --git a/include/linux/bpfilter.h b/include/linux/bpfilter.h index 2ae3c8e1d83c..736ded4905e0 100644 --- a/include/linux/bpfilter.h +++ b/include/linux/bpfilter.h @@ -11,7 +11,6 @@ int bpfilter_ip_set_sockopt(struct sock *sk, int optname, sockptr_t optval,  			    unsigned int optlen);  int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char __user *optval,  			    int __user *optlen); -void bpfilter_umh_cleanup(struct umd_info *info);  struct bpfilter_umh_ops {  	struct umd_info info; diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 9e77165f3ef6..5d732f48f787 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -89,6 +89,7 @@  #define MII_BCM54XX_EXP_SEL	0x17	/* Expansion register select */  #define MII_BCM54XX_EXP_SEL_TOP	0x0d00	/* TOP_MISC expansion register select */  #define MII_BCM54XX_EXP_SEL_SSD	0x0e00	/* Secondary SerDes select */ +#define MII_BCM54XX_EXP_SEL_WOL	0x0e00	/* Wake-on-LAN expansion select register */  #define MII_BCM54XX_EXP_SEL_ER	0x0f00	/* Expansion register select */  #define MII_BCM54XX_EXP_SEL_ETC	0x0d00	/* Expansion register spare + 2k mem */ @@ -160,6 +161,7 @@  #define BCM_LED_SRC_OPENSHORT	0xb  #define BCM_LED_SRC_OFF		0xe	/* Tied high */  #define BCM_LED_SRC_ON		0xf	/* Tied low */ +#define BCM_LED_SRC_MASK	GENMASK(3, 0)  /*   * Broadcom Multicolor LED configurations (expansion register 4) @@ -205,11 +207,13 @@  #define  BCM_NO_ANEG_APD_EN		0x0060 /* bits 5 & 6 */  #define  BCM_APD_SINGLELP_EN	0x0100 /* Bit 8 */ -#define BCM5482_SHD_LEDS1	0x0d	/* 01101: LED Selector 1 */ +#define BCM54XX_SHD_LEDS1	0x0d	/* 01101: LED Selector 1 */  					/* LED3 / ~LINKSPD[2] selector */ -#define BCM5482_SHD_LEDS1_LED3(src)	((src & 0xf) << 4) +#define BCM54XX_SHD_LEDS_SHIFT(led)	(4 * (led)) +#define BCM54XX_SHD_LEDS1_LED3(src)	((src & 0xf) << 4)  					/* LED1 / ~LINKSPD[1] selector */ -#define BCM5482_SHD_LEDS1_LED1(src)	((src & 0xf) << 0) +#define BCM54XX_SHD_LEDS1_LED1(src)	((src & 0xf) << 0) +#define BCM54XX_SHD_LEDS2	0x0e	/* 01110: LED Selector 2 */  #define BCM54XX_SHD_RGMII_MODE	0x0b	/* 01011: RGMII Mode Selector */  #define BCM5482_SHD_SSD		0x14	/* 10100: Secondary SerDes control */  #define BCM5482_SHD_SSD_LEDM	0x0008	/* SSD LED Mode enable */ @@ -253,6 +257,9 @@  #define BCM54XX_TOP_MISC_IDDQ_SD		(1 << 2)  #define BCM54XX_TOP_MISC_IDDQ_SR		(1 << 3) +#define BCM54XX_TOP_MISC_LED_CTL		(MII_BCM54XX_EXP_SEL_TOP + 0x0C) +#define  BCM54XX_LED4_SEL_INTR			BIT(1) +  /*   * BCM5482: Secondary SerDes registers   */ @@ -272,6 +279,57 @@  #define BCM54612E_EXP_SPARE0		(MII_BCM54XX_EXP_SEL_ETC + 0x34)  #define BCM54612E_LED4_CLK125OUT_EN	(1 << 1) + +/* Wake-on-LAN registers */ +#define BCM54XX_WOL_MAIN_CTL		(MII_BCM54XX_EXP_SEL_WOL + 0x80) +#define  BCM54XX_WOL_EN			BIT(0) +#define  BCM54XX_WOL_MODE_SINGLE_MPD	0 +#define  BCM54XX_WOL_MODE_SINGLE_MPDSEC	1 +#define  BCM54XX_WOL_MODE_DUAL		2 +#define  BCM54XX_WOL_MODE_SHIFT		1 +#define  BCM54XX_WOL_MODE_MASK		0x3 +#define  BCM54XX_WOL_MP_MSB_FF_EN	BIT(3) +#define  BCM54XX_WOL_SECKEY_OPT_4B	0 +#define  BCM54XX_WOL_SECKEY_OPT_6B	1 +#define  BCM54XX_WOL_SECKEY_OPT_8B	2 +#define  BCM54XX_WOL_SECKEY_OPT_SHIFT	4 +#define  BCM54XX_WOL_SECKEY_OPT_MASK	0x3 +#define  BCM54XX_WOL_L2_TYPE_CHK	BIT(6) +#define  BCM54XX_WOL_L4IPV4UDP_CHK	BIT(7) +#define  BCM54XX_WOL_L4IPV6UDP_CHK	BIT(8) +#define  BCM54XX_WOL_UDPPORT_CHK	BIT(9) +#define  BCM54XX_WOL_CRC_CHK		BIT(10) +#define  BCM54XX_WOL_SECKEY_MODE	BIT(11) +#define  BCM54XX_WOL_RST		BIT(12) +#define  BCM54XX_WOL_DIR_PKT_EN		BIT(13) +#define  BCM54XX_WOL_MASK_MODE_DA_FF	0 +#define  BCM54XX_WOL_MASK_MODE_DA_MPD	1 +#define  BCM54XX_WOL_MASK_MODE_DA_ONLY	2 +#define  BCM54XX_WOL_MASK_MODE_MPD	3 +#define  BCM54XX_WOL_MASK_MODE_SHIFT	14 +#define  BCM54XX_WOL_MASK_MODE_MASK	0x3 + +#define BCM54XX_WOL_INNER_PROTO		(MII_BCM54XX_EXP_SEL_WOL + 0x81) +#define BCM54XX_WOL_OUTER_PROTO		(MII_BCM54XX_EXP_SEL_WOL + 0x82) +#define BCM54XX_WOL_OUTER_PROTO2	(MII_BCM54XX_EXP_SEL_WOL + 0x83) + +#define BCM54XX_WOL_MPD_DATA1(x)	(MII_BCM54XX_EXP_SEL_WOL + 0x84 + (x)) +#define BCM54XX_WOL_MPD_DATA2(x)	(MII_BCM54XX_EXP_SEL_WOL + 0x87 + (x)) +#define BCM54XX_WOL_SEC_KEY_8B		(MII_BCM54XX_EXP_SEL_WOL + 0x8A) +#define BCM54XX_WOL_MASK(x)		(MII_BCM54XX_EXP_SEL_WOL + 0x8B + (x)) +#define BCM54XX_SEC_KEY_STORE(x)	(MII_BCM54XX_EXP_SEL_WOL + 0x8E) +#define BCM54XX_WOL_SHARED_CNT		(MII_BCM54XX_EXP_SEL_WOL + 0x92) + +#define BCM54XX_WOL_INT_MASK		(MII_BCM54XX_EXP_SEL_WOL + 0x93) +#define  BCM54XX_WOL_PKT1		BIT(0) +#define  BCM54XX_WOL_PKT2		BIT(1) +#define  BCM54XX_WOL_DIR		BIT(2) +#define  BCM54XX_WOL_ALL_INTRS		(BCM54XX_WOL_PKT1 | \ +					 BCM54XX_WOL_PKT2 | \ +					 BCM54XX_WOL_DIR) + +#define BCM54XX_WOL_INT_STATUS		(MII_BCM54XX_EXP_SEL_WOL + 0x94) +  /*****************************************************************************/  /* Fast Ethernet Transceiver definitions. */  /*****************************************************************************/ @@ -304,6 +362,8 @@  #define LPI_FEATURE_EN			0x8000  #define LPI_FEATURE_EN_DIG1000X		0x4000 +#define BRCM_CL45VEN_EEE_LPI_CNT	0x803f +  /* Core register definitions*/  #define MII_BRCM_CORE_BASE12	0x12  #define MII_BRCM_CORE_BASE13	0x13 diff --git a/include/linux/btf.h b/include/linux/btf.h index 508199e38415..cac9f304e27a 100644 --- a/include/linux/btf.h +++ b/include/linux/btf.h @@ -98,10 +98,14 @@ struct btf_type;  union bpf_attr;  struct btf_show;  struct btf_id_set; +struct bpf_prog; + +typedef int (*btf_kfunc_filter_t)(const struct bpf_prog *prog, u32 kfunc_id);  struct btf_kfunc_id_set {  	struct module *owner;  	struct btf_id_set8 *set; +	btf_kfunc_filter_t filter;  };  struct btf_id_dtor_kfunc { @@ -479,7 +483,6 @@ static inline void *btf_id_set8_contains(const struct btf_id_set8 *set, u32 id)  	return bsearch(&id, set->pairs, set->cnt, sizeof(set->pairs[0]), btf_id_cmp_func);  } -struct bpf_prog;  struct bpf_verifier_log;  #ifdef CONFIG_BPF_SYSCALL @@ -487,10 +490,10 @@ const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id);  const char *btf_name_by_offset(const struct btf *btf, u32 offset);  struct btf *btf_parse_vmlinux(void);  struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog); -u32 *btf_kfunc_id_set_contains(const struct btf *btf, -			       enum bpf_prog_type prog_type, -			       u32 kfunc_btf_id); -u32 *btf_kfunc_is_modify_return(const struct btf *btf, u32 kfunc_btf_id); +u32 *btf_kfunc_id_set_contains(const struct btf *btf, u32 kfunc_btf_id, +			       const struct bpf_prog *prog); +u32 *btf_kfunc_is_modify_return(const struct btf *btf, u32 kfunc_btf_id, +				const struct bpf_prog *prog);  int register_btf_kfunc_id_set(enum bpf_prog_type prog_type,  			      const struct btf_kfunc_id_set *s);  int register_btf_fmodret_id_set(const struct btf_kfunc_id_set *kset); @@ -517,8 +520,9 @@ static inline const char *btf_name_by_offset(const struct btf *btf,  	return NULL;  }  static inline u32 *btf_kfunc_id_set_contains(const struct btf *btf, -					     enum bpf_prog_type prog_type, -					     u32 kfunc_btf_id) +					     u32 kfunc_btf_id, +					     struct bpf_prog *prog) +  {  	return NULL;  } diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index c794ea7096ba..6cb3e9af78c9 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -217,6 +217,10 @@ int inode_has_buffers(struct inode *);  void invalidate_inode_buffers(struct inode *);  int remove_inode_buffers(struct inode *inode);  int sync_mapping_buffers(struct address_space *mapping); +int generic_buffers_fsync_noflush(struct file *file, loff_t start, loff_t end, +				  bool datasync); +int generic_buffers_fsync(struct file *file, loff_t start, loff_t end, +			  bool datasync);  void clean_bdev_aliases(struct block_device *bdev, sector_t block,  			sector_t len);  static inline void clean_bdev_bh_alias(struct buffer_head *bh) diff --git a/include/linux/can/length.h b/include/linux/can/length.h index 6995092b774e..abc978b38f79 100644 --- a/include/linux/can/length.h +++ b/include/linux/can/length.h @@ -1,126 +1,258 @@  /* SPDX-License-Identifier: GPL-2.0 */  /* Copyright (C) 2020 Oliver Hartkopp <[email protected]>   * Copyright (C) 2020 Marc Kleine-Budde <[email protected]> + * Copyright (C) 2020, 2023 Vincent Mailhol <[email protected]>   */  #ifndef _CAN_LENGTH_H  #define _CAN_LENGTH_H +#include <linux/bits.h> +#include <linux/can.h> +#include <linux/can/netlink.h> +#include <linux/math.h> +  /* - * Size of a Classical CAN Standard Frame + * Size of a Classical CAN Standard Frame header in bits   * - * Name of Field			Bits + * Name of Field				Bits   * --------------------------------------------------------- - * Start-of-frame			1 - * Identifier				11 - * Remote transmission request (RTR)	1 - * Identifier extension bit (IDE)	1 - * Reserved bit (r0)			1 - * Data length code (DLC)		4 - * Data field				0...64 - * CRC					15 - * CRC delimiter			1 - * ACK slot				1 - * ACK delimiter			1 - * End-of-frame (EOF)			7 - * Inter frame spacing			3 + * Start Of Frame (SOF)				1 + * Arbitration field: + *	base ID					11 + *	Remote Transmission Request (RTR)	1 + * Control field: + *	IDentifier Extension bit (IDE)		1 + *	FD Format indicator (FDF)		1 + *	Data Length Code (DLC)			4 + * + * including all fields preceding the data field, ignoring bitstuffing + */ +#define CAN_FRAME_HEADER_SFF_BITS 19 + +/* + * Size of a Classical CAN Extended Frame header in bits + * + * Name of Field				Bits + * --------------------------------------------------------- + * Start Of Frame (SOF)				1 + * Arbitration field: + *	base ID					11 + *	Substitute Remote Request (SRR)		1 + *	IDentifier Extension bit (IDE)		1 + *	ID extension				18 + *	Remote Transmission Request (RTR)	1 + * Control field: + *	FD Format indicator (FDF)		1 + *	Reserved bit (r0)			1 + *	Data length code (DLC)			4 + * + * including all fields preceding the data field, ignoring bitstuffing + */ +#define CAN_FRAME_HEADER_EFF_BITS 39 + +/* + * Size of a CAN-FD Standard Frame in bits   * - * rounded up and ignoring bitstuffing + * Name of Field				Bits + * --------------------------------------------------------- + * Start Of Frame (SOF)				1 + * Arbitration field: + *	base ID					11 + *	Remote Request Substitution (RRS)	1 + * Control field: + *	IDentifier Extension bit (IDE)		1 + *	FD Format indicator (FDF)		1 + *	Reserved bit (res)			1 + *	Bit Rate Switch (BRS)			1 + *	Error Status Indicator (ESI)		1 + *	Data length code (DLC)			4 + * + * including all fields preceding the data field, ignoring bitstuffing + */ +#define CANFD_FRAME_HEADER_SFF_BITS 22 + +/* + * Size of a CAN-FD Extended Frame in bits + * + * Name of Field				Bits + * --------------------------------------------------------- + * Start Of Frame (SOF)				1 + * Arbitration field: + *	base ID					11 + *	Substitute Remote Request (SRR)		1 + *	IDentifier Extension bit (IDE)		1 + *	ID extension				18 + *	Remote Request Substitution (RRS)	1 + * Control field: + *	FD Format indicator (FDF)		1 + *	Reserved bit (res)			1 + *	Bit Rate Switch (BRS)			1 + *	Error Status Indicator (ESI)		1 + *	Data length code (DLC)			4 + * + * including all fields preceding the data field, ignoring bitstuffing   */ -#define CAN_FRAME_OVERHEAD_SFF DIV_ROUND_UP(47, 8) +#define CANFD_FRAME_HEADER_EFF_BITS 41  /* - * Size of a Classical CAN Extended Frame + * Size of a CAN CRC Field in bits   *   * Name of Field			Bits   * --------------------------------------------------------- - * Start-of-frame			1 - * Identifier A				11 - * Substitute remote request (SRR)	1 - * Identifier extension bit (IDE)	1 - * Identifier B				18 - * Remote transmission request (RTR)	1 - * Reserved bits (r1, r0)		2 - * Data length code (DLC)		4 - * Data field				0...64 - * CRC					15 - * CRC delimiter			1 - * ACK slot				1 - * ACK delimiter			1 - * End-of-frame (EOF)			7 - * Inter frame spacing			3 + * CRC sequence (CRC15)			15 + * CRC Delimiter			1   * - * rounded up and ignoring bitstuffing + * ignoring bitstuffing   */ -#define CAN_FRAME_OVERHEAD_EFF DIV_ROUND_UP(67, 8) +#define CAN_FRAME_CRC_FIELD_BITS 16  /* - * Size of a CAN-FD Standard Frame + * Size of a CAN-FD CRC17 Field in bits (length: 0..16)   *   * Name of Field			Bits   * --------------------------------------------------------- - * Start-of-frame			1 - * Identifier				11 - * Reserved bit (r1)			1 - * Identifier extension bit (IDE)	1 - * Flexible data rate format (FDF)	1 - * Reserved bit (r0)			1 - * Bit Rate Switch (BRS)		1 - * Error Status Indicator (ESI)		1 - * Data length code (DLC)		4 - * Data field				0...512 - * Stuff Bit Count (SBC)		0...16: 4 20...64:5 - * CRC					0...16: 17 20...64:21 - * CRC delimiter (CD)			1 - * ACK slot (AS)			1 - * ACK delimiter (AD)			1 - * End-of-frame (EOF)			7 - * Inter frame spacing			3 - * - * assuming CRC21, rounded up and ignoring bitstuffing - */ -#define CANFD_FRAME_OVERHEAD_SFF DIV_ROUND_UP(61, 8) + * Stuff Count				4 + * CRC Sequence (CRC17)			17 + * CRC Delimiter			1 + * Fixed stuff bits			6 + */ +#define CANFD_FRAME_CRC17_FIELD_BITS 28  /* - * Size of a CAN-FD Extended Frame + * Size of a CAN-FD CRC21 Field in bits (length: 20..64)   *   * Name of Field			Bits   * --------------------------------------------------------- - * Start-of-frame			1 - * Identifier A				11 - * Substitute remote request (SRR)	1 - * Identifier extension bit (IDE)	1 - * Identifier B				18 - * Reserved bit (r1)			1 - * Flexible data rate format (FDF)	1 - * Reserved bit (r0)			1 - * Bit Rate Switch (BRS)		1 - * Error Status Indicator (ESI)		1 - * Data length code (DLC)		4 - * Data field				0...512 - * Stuff Bit Count (SBC)		0...16: 4 20...64:5 - * CRC					0...16: 17 20...64:21 - * CRC delimiter (CD)			1 - * ACK slot (AS)			1 - * ACK delimiter (AD)			1 - * End-of-frame (EOF)			7 - * Inter frame spacing			3 - * - * assuming CRC21, rounded up and ignoring bitstuffing - */ -#define CANFD_FRAME_OVERHEAD_EFF DIV_ROUND_UP(80, 8) + * Stuff Count				4 + * CRC sequence (CRC21)			21 + * CRC Delimiter			1 + * Fixed stuff bits			7 + */ +#define CANFD_FRAME_CRC21_FIELD_BITS 33 + +/* + * Size of a CAN(-FD) Frame footer in bits + * + * Name of Field			Bits + * --------------------------------------------------------- + * ACK slot				1 + * ACK delimiter			1 + * End Of Frame (EOF)			7 + * + * including all fields following the CRC field + */ +#define CAN_FRAME_FOOTER_BITS 9 + +/* + * First part of the Inter Frame Space + * (a.k.a. IMF - intermission field) + */ +#define CAN_INTERMISSION_BITS 3 + +/** + * can_bitstuffing_len() - Calculate the maximum length with bitstuffing + * @destuffed_len: length of a destuffed bit stream + * + * The worst bit stuffing case is a sequence in which dominant and + * recessive bits alternate every four bits: + * + *   Destuffed: 1 1111  0000  1111  0000  1111 + *   Stuffed:   1 1111o 0000i 1111o 0000i 1111o + * + * Nomenclature + * + *  - "0": dominant bit + *  - "o": dominant stuff bit + *  - "1": recessive bit + *  - "i": recessive stuff bit + * + * Aside from the first bit, one stuff bit is added every four bits. + * + * Return: length of the stuffed bit stream in the worst case scenario. + */ +#define can_bitstuffing_len(destuffed_len)			\ +	(destuffed_len + (destuffed_len - 1) / 4) + +#define __can_bitstuffing_len(bitstuffing, destuffed_len)	\ +	(bitstuffing ? can_bitstuffing_len(destuffed_len) :	\ +		       destuffed_len) + +#define __can_cc_frame_bits(is_eff, bitstuffing,		\ +			    intermission, data_len)		\ +(								\ +	__can_bitstuffing_len(bitstuffing,			\ +		(is_eff ? CAN_FRAME_HEADER_EFF_BITS :		\ +			  CAN_FRAME_HEADER_SFF_BITS) +		\ +		(data_len) * BITS_PER_BYTE +			\ +		CAN_FRAME_CRC_FIELD_BITS) +			\ +	CAN_FRAME_FOOTER_BITS +					\ +	(intermission ? CAN_INTERMISSION_BITS : 0)		\ +) + +#define __can_fd_frame_bits(is_eff, bitstuffing,		\ +			    intermission, data_len)		\ +(								\ +	__can_bitstuffing_len(bitstuffing,			\ +		(is_eff ? CANFD_FRAME_HEADER_EFF_BITS :		\ +			  CANFD_FRAME_HEADER_SFF_BITS) +	\ +		(data_len) * BITS_PER_BYTE) +			\ +	((data_len) <= 16 ?					\ +		CANFD_FRAME_CRC17_FIELD_BITS :			\ +		CANFD_FRAME_CRC21_FIELD_BITS) +			\ +	CAN_FRAME_FOOTER_BITS +					\ +	(intermission ? CAN_INTERMISSION_BITS : 0)		\ +) + +/** + * can_frame_bits() - Calculate the number of bits on the wire in a + *	CAN frame + * @is_fd: true: CAN-FD frame; false: Classical CAN frame. + * @is_eff: true: Extended frame; false: Standard frame. + * @bitstuffing: true: calculate the bitstuffing worst case; false: + *	calculate the bitstuffing best case (no dynamic + *	bitstuffing). CAN-FD's fixed stuff bits are always included. + * @intermission: if and only if true, include the inter frame space + *	assuming no bus idle (i.e. only the intermission). Strictly + *	speaking, the inter frame space is not part of the + *	frame. However, it is needed when calculating the delay + *	between the Start Of Frame of two consecutive frames. + * @data_len: length of the data field in bytes. Correspond to + *	can(fd)_frame->len. Should be zero for remote frames. No + *	sanitization is done on @data_len and it shall have no side + *	effects. + * + * Return: the numbers of bits on the wire of a CAN frame. + */ +#define can_frame_bits(is_fd, is_eff, bitstuffing,		\ +		       intermission, data_len)			\ +(								\ +	is_fd ? __can_fd_frame_bits(is_eff, bitstuffing,	\ +				    intermission, data_len) :	\ +		__can_cc_frame_bits(is_eff, bitstuffing,	\ +				    intermission, data_len)	\ +) + +/* + * Number of bytes in a CAN frame + * (rounded up, including intermission) + */ +#define can_frame_bytes(is_fd, is_eff, bitstuffing, data_len)	\ +	DIV_ROUND_UP(can_frame_bits(is_fd, is_eff, bitstuffing,	\ +				    true, data_len),		\ +		     BITS_PER_BYTE)  /*   * Maximum size of a Classical CAN frame - * (rounded up and ignoring bitstuffing) + * (rounded up, ignoring bitstuffing but including intermission)   */ -#define CAN_FRAME_LEN_MAX (CAN_FRAME_OVERHEAD_EFF + CAN_MAX_DLEN) +#define CAN_FRAME_LEN_MAX can_frame_bytes(false, true, false, CAN_MAX_DLEN)  /*   * Maximum size of a CAN-FD frame - * (rounded up and ignoring bitstuffing) + * (rounded up, ignoring dynamic bitstuffing but including intermission)   */ -#define CANFD_FRAME_LEN_MAX (CANFD_FRAME_OVERHEAD_EFF + CANFD_MAX_DLEN) +#define CANFD_FRAME_LEN_MAX can_frame_bytes(true, true, false, CANFD_MAX_DLEN)  /*   * can_cc_dlc2len(value) - convert a given data length code (dlc) of a diff --git a/include/linux/cdx/cdx_bus.h b/include/linux/cdx/cdx_bus.h index 35ef41d8a61a..bead71b7bc73 100644 --- a/include/linux/cdx/cdx_bus.h +++ b/include/linux/cdx/cdx_bus.h @@ -14,7 +14,6 @@  #include <linux/mod_devicetable.h>  #define MAX_CDX_DEV_RESOURCES	4 -#define CDX_ANY_ID (0xFFFF)  #define CDX_CONTROLLER_ID_SHIFT 4  #define CDX_BUS_NUM_MASK 0xF diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 28ff6f1a6ada..0f0cd01906b4 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -415,7 +415,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,   * @flags: framework-specific flags   * @fixed_rate: non-adjustable clock rate   */ -#define clk_hw_register_fixed_rate_parent_data(dev, name, parent_hw, flags,   \ +#define clk_hw_register_fixed_rate_parent_data(dev, name, parent_data, flags, \  					     fixed_rate)		      \  	__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL,	      \  				     (parent_data), (flags), (fixed_rate), 0, \ @@ -1333,6 +1333,8 @@ int __clk_mux_determine_rate_closest(struct clk_hw *hw,  int clk_mux_determine_rate_flags(struct clk_hw *hw,  				 struct clk_rate_request *req,  				 unsigned long flags); +int clk_hw_determine_rate_no_reparent(struct clk_hw *hw, +				      struct clk_rate_request *req);  void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent);  void clk_hw_get_rate_range(struct clk_hw *hw, unsigned long *min_rate,  			   unsigned long *max_rate); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index f19a47b9bb5a..bf70987240e4 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -41,10 +41,11 @@ enum coresight_dev_type {  	CORESIGHT_DEV_TYPE_LINKSINK,  	CORESIGHT_DEV_TYPE_SOURCE,  	CORESIGHT_DEV_TYPE_HELPER, -	CORESIGHT_DEV_TYPE_ECT, +	CORESIGHT_DEV_TYPE_MAX  };  enum coresight_dev_subtype_sink { +	CORESIGHT_DEV_SUBTYPE_SINK_DUMMY,  	CORESIGHT_DEV_SUBTYPE_SINK_PORT,  	CORESIGHT_DEV_SUBTYPE_SINK_BUFFER,  	CORESIGHT_DEV_SUBTYPE_SINK_SYSMEM, @@ -66,12 +67,7 @@ enum coresight_dev_subtype_source {  enum coresight_dev_subtype_helper {  	CORESIGHT_DEV_SUBTYPE_HELPER_CATU, -}; - -/* Embedded Cross Trigger (ECT) sub-types */ -enum coresight_dev_subtype_ect { -	CORESIGHT_DEV_SUBTYPE_ECT_NONE, -	CORESIGHT_DEV_SUBTYPE_ECT_CTI, +	CORESIGHT_DEV_SUBTYPE_HELPER_ECT_CTI  };  /** @@ -84,8 +80,6 @@ enum coresight_dev_subtype_ect {   *			by @coresight_dev_subtype_source.   * @helper_subtype:	type of helper this component is, as defined   *			by @coresight_dev_subtype_helper. - * @ect_subtype:        type of cross trigger this component is, as - *			defined by @coresight_dev_subtype_ect   */  union coresight_dev_subtype {  	/* We have some devices which acts as LINK and SINK */ @@ -95,21 +89,25 @@ union coresight_dev_subtype {  	};  	enum coresight_dev_subtype_source source_subtype;  	enum coresight_dev_subtype_helper helper_subtype; -	enum coresight_dev_subtype_ect ect_subtype;  };  /**   * struct coresight_platform_data - data harvested from the firmware   * specification.   * - * @nr_inport:	Number of elements for the input connections. - * @nr_outport:	Number of elements for the output connections. - * @conns:	Sparse array of nr_outport connections from this component. + * @nr_inconns: Number of elements for the input connections. + * @nr_outconns: Number of elements for the output connections. + * @out_conns: Array of nr_outconns pointers to connections from this + *	       component. + * @in_conns: Sparse array of pointers to input connections. Sparse + *            because the source device owns the connection so when it's + *            unloaded the connection leaves an empty slot.   */  struct coresight_platform_data { -	int nr_inport; -	int nr_outport; -	struct coresight_connection *conns; +	int nr_inconns; +	int nr_outconns; +	struct coresight_connection **out_conns; +	struct coresight_connection **in_conns;  };  /** @@ -164,19 +162,42 @@ struct coresight_desc {  /**   * struct coresight_connection - representation of a single connection - * @outport:	a connection's output port number. - * @child_port:	remote component's port number @output is connected to. - * @chid_fwnode: remote component's fwnode handle. - * @child_dev:	a @coresight_device representation of the component -		connected to @outport. + * @src_port:	a connection's output port number. + * @dest_port:	destination's input port number @src_port is connected to. + * @dest_fwnode: destination component's fwnode handle. + * @dest_dev:	a @coresight_device representation of the component +		connected to @src_port. NULL until the device is created   * @link: Representation of the connection as a sysfs link. + * + * The full connection structure looks like this, where in_conns store + * references to same connection as the source device's out_conns. + * + * +-----------------------------+   +-----------------------------+ + * |coresight_device             |   |coresight_connection         | + * |-----------------------------|   |-----------------------------| + * |                             |   |                             | + * |                             |   |                    dest_dev*|<-- + * |pdata->out_conns[nr_outconns]|<->|src_dev*                     |   | + * |                             |   |                             |   | + * +-----------------------------+   +-----------------------------+   | + *                                                                     | + *                                   +-----------------------------+   | + *                                   |coresight_device             |   | + *                                   |------------------------------   | + *                                   |                             |   | + *                                   |  pdata->in_conns[nr_inconns]|<-- + *                                   |                             | + *                                   +-----------------------------+   */  struct coresight_connection { -	int outport; -	int child_port; -	struct fwnode_handle *child_fwnode; -	struct coresight_device *child_dev; +	int src_port; +	int dest_port; +	struct fwnode_handle *dest_fwnode; +	struct coresight_device *dest_dev;  	struct coresight_sysfs_link *link; +	struct coresight_device *src_dev; +	atomic_t src_refcnt; +	atomic_t dest_refcnt;  };  /** @@ -211,8 +232,6 @@ struct coresight_sysfs_link {   *		from source to that sink.   * @ea:		Device attribute for sink representation under PMU directory.   * @def_sink:	cached reference to default sink found for this device. - * @ect_dev:	Associated cross trigger device. Not part of the trace data - *		path or connections.   * @nr_links:   number of sysfs links created to other components from this   *		device. These will appear in the "connections" group.   * @has_conns_grp: Have added a "connections" group for sysfs links. @@ -228,19 +247,16 @@ struct coresight_device {  	const struct coresight_ops *ops;  	struct csdev_access access;  	struct device dev; -	atomic_t *refcnt; +	atomic_t refcnt;  	bool orphan;  	bool enable;	/* true only if configured as part of a path */  	/* sink specific fields */  	bool activated;	/* true only if a sink is part of a path */  	struct dev_ext_attribute *ea;  	struct coresight_device *def_sink; -	/* cross trigger handling */ -	struct coresight_device *ect_dev;  	/* sysfs links between components */  	int nr_links;  	bool has_conns_grp; -	bool ect_enabled; /* true only if associated ect device is enabled */  	/* system configuration and feature lists */  	struct list_head feature_csdev_list;  	struct list_head config_csdev_list; @@ -272,6 +288,12 @@ static struct coresight_dev_list (var) = {				\  #define to_coresight_device(d) container_of(d, struct coresight_device, dev) +enum cs_mode { +	CS_MODE_DISABLED, +	CS_MODE_SYSFS, +	CS_MODE_PERF, +}; +  #define source_ops(csdev)	csdev->ops->source_ops  #define sink_ops(csdev)		csdev->ops->sink_ops  #define link_ops(csdev)		csdev->ops->link_ops @@ -288,7 +310,8 @@ static struct coresight_dev_list (var) = {				\   * @update_buffer:	update buffer pointers after a trace session.   */  struct coresight_ops_sink { -	int (*enable)(struct coresight_device *csdev, u32 mode, void *data); +	int (*enable)(struct coresight_device *csdev, enum cs_mode mode, +		      void *data);  	int (*disable)(struct coresight_device *csdev);  	void *(*alloc_buffer)(struct coresight_device *csdev,  			      struct perf_event *event, void **pages, @@ -306,8 +329,12 @@ struct coresight_ops_sink {   * @disable:	disables flow between iport and oport.   */  struct coresight_ops_link { -	int (*enable)(struct coresight_device *csdev, int iport, int oport); -	void (*disable)(struct coresight_device *csdev, int iport, int oport); +	int (*enable)(struct coresight_device *csdev, +		      struct coresight_connection *in, +		      struct coresight_connection *out); +	void (*disable)(struct coresight_device *csdev, +			struct coresight_connection *in, +			struct coresight_connection *out);  };  /** @@ -320,8 +347,8 @@ struct coresight_ops_link {   */  struct coresight_ops_source {  	int (*cpu_id)(struct coresight_device *csdev); -	int (*enable)(struct coresight_device *csdev, -		      struct perf_event *event,  u32 mode); +	int (*enable)(struct coresight_device *csdev, struct perf_event *event, +		      enum cs_mode mode);  	void (*disable)(struct coresight_device *csdev,  			struct perf_event *event);  }; @@ -336,27 +363,16 @@ struct coresight_ops_source {   * @disable	: Disable the device   */  struct coresight_ops_helper { -	int (*enable)(struct coresight_device *csdev, void *data); +	int (*enable)(struct coresight_device *csdev, enum cs_mode mode, +		      void *data);  	int (*disable)(struct coresight_device *csdev, void *data);  }; -/** - * struct coresight_ops_ect - Ops for an embedded cross trigger device - * - * @enable	: Enable the device - * @disable	: Disable the device - */ -struct coresight_ops_ect { -	int (*enable)(struct coresight_device *csdev); -	int (*disable)(struct coresight_device *csdev); -}; -  struct coresight_ops {  	const struct coresight_ops_sink *sink_ops;  	const struct coresight_ops_link *link_ops;  	const struct coresight_ops_source *source_ops;  	const struct coresight_ops_helper *helper_ops; -	const struct coresight_ops_ect *ect_ops;  };  #if IS_ENABLED(CONFIG_CORESIGHT) @@ -602,5 +618,18 @@ static inline void coresight_write64(struct coresight_device *csdev, u64 val, u3  extern int coresight_get_cpu(struct device *dev);  struct coresight_platform_data *coresight_get_platform_data(struct device *dev); +struct coresight_connection * +coresight_add_out_conn(struct device *dev, +		       struct coresight_platform_data *pdata, +		       const struct coresight_connection *new_conn); +int coresight_add_in_conn(struct coresight_connection *conn); +struct coresight_device * +coresight_find_input_type(struct coresight_platform_data *pdata, +			  enum coresight_dev_type type, +			  union coresight_dev_subtype subtype); +struct coresight_device * +coresight_find_output_type(struct coresight_platform_data *pdata, +			   enum coresight_dev_type type, +			   union coresight_dev_subtype subtype);  #endif		/* _LINUX_COREISGHT_H */ diff --git a/include/linux/crypto.h b/include/linux/crypto.h index fa310ac1db59..31f6fee0c36c 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -25,11 +25,12 @@  #define CRYPTO_ALG_TYPE_COMPRESS	0x00000002  #define CRYPTO_ALG_TYPE_AEAD		0x00000003  #define CRYPTO_ALG_TYPE_SKCIPHER	0x00000005 +#define CRYPTO_ALG_TYPE_AKCIPHER	0x00000006 +#define CRYPTO_ALG_TYPE_SIG		0x00000007  #define CRYPTO_ALG_TYPE_KPP		0x00000008  #define CRYPTO_ALG_TYPE_ACOMPRESS	0x0000000a  #define CRYPTO_ALG_TYPE_SCOMPRESS	0x0000000b  #define CRYPTO_ALG_TYPE_RNG		0x0000000c -#define CRYPTO_ALG_TYPE_AKCIPHER	0x0000000d  #define CRYPTO_ALG_TYPE_HASH		0x0000000e  #define CRYPTO_ALG_TYPE_SHASH		0x0000000e  #define CRYPTO_ALG_TYPE_AHASH		0x0000000f diff --git a/include/linux/dax.h b/include/linux/dax.h index bf6258472e49..261944ec0887 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -261,6 +261,19 @@ static inline bool dax_mapping(struct address_space *mapping)  	return mapping->host && IS_DAX(mapping->host);  } +/* + * Due to dax's memory and block duo personalities, hwpoison reporting + * takes into consideration which personality is presently visible. + * When dax acts like a block device, such as in block IO, an encounter of + * dax hwpoison is reported as -EIO. + * When dax acts like memory, such as in page fault, a detection of hwpoison + * is reported as -EHWPOISON which leads to VM_FAULT_HWPOISON. + */ +static inline int dax_mem2blk_err(int err) +{ +	return (err == -EHWPOISON) ? -EIO : err; +} +  #ifdef CONFIG_DEV_DAX_HMEM_DEVICES  void hmem_register_resource(int target_nid, struct resource *r);  #else diff --git a/include/linux/device.h b/include/linux/device.h index 472dd24d4823..66c13965153d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -96,7 +96,12 @@ struct device_type {  	const struct dev_pm_ops *pm;  }; -/* interface for exporting device attributes */ +/** + * struct device_attribute - Interface for exporting device attributes. + * @attr: sysfs attribute definition. + * @show: Show handler. + * @store: Store handler. + */  struct device_attribute {  	struct attribute	attr;  	ssize_t (*show)(struct device *dev, struct device_attribute *attr, @@ -105,6 +110,11 @@ struct device_attribute {  			 const char *buf, size_t count);  }; +/** + * struct dev_ext_attribute - Exported device attribute with extra context. + * @attr: Exported device attribute. + * @var: Pointer to context. + */  struct dev_ext_attribute {  	struct device_attribute attr;  	void *var; @@ -123,30 +133,124 @@ ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,  ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,  			 const char *buf, size_t count); +/** + * DEVICE_ATTR - Define a device attribute. + * @_name: Attribute name. + * @_mode: File mode. + * @_show: Show handler. Optional, but mandatory if attribute is readable. + * @_store: Store handler. Optional, but mandatory if attribute is writable. + * + * Convenience macro for defining a struct device_attribute. + * + * For example, ``DEVICE_ATTR(foo, 0644, foo_show, foo_store);`` expands to: + * + * .. code-block:: c + * + *	struct device_attribute dev_attr_foo = { + *		.attr	= { .name = "foo", .mode = 0644 }, + *		.show	= foo_show, + *		.store	= foo_store, + *	}; + */  #define DEVICE_ATTR(_name, _mode, _show, _store) \  	struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) + +/** + * DEVICE_ATTR_PREALLOC - Define a preallocated device attribute. + * @_name: Attribute name. + * @_mode: File mode. + * @_show: Show handler. Optional, but mandatory if attribute is readable. + * @_store: Store handler. Optional, but mandatory if attribute is writable. + * + * Like DEVICE_ATTR(), but ``SYSFS_PREALLOC`` is set on @_mode. + */  #define DEVICE_ATTR_PREALLOC(_name, _mode, _show, _store) \  	struct device_attribute dev_attr_##_name = \  		__ATTR_PREALLOC(_name, _mode, _show, _store) + +/** + * DEVICE_ATTR_RW - Define a read-write device attribute. + * @_name: Attribute name. + * + * Like DEVICE_ATTR(), but @_mode is 0644, @_show is <_name>_show, + * and @_store is <_name>_store. + */  #define DEVICE_ATTR_RW(_name) \  	struct device_attribute dev_attr_##_name = __ATTR_RW(_name) + +/** + * DEVICE_ATTR_ADMIN_RW - Define an admin-only read-write device attribute. + * @_name: Attribute name. + * + * Like DEVICE_ATTR_RW(), but @_mode is 0600. + */  #define DEVICE_ATTR_ADMIN_RW(_name) \  	struct device_attribute dev_attr_##_name = __ATTR_RW_MODE(_name, 0600) + +/** + * DEVICE_ATTR_RO - Define a readable device attribute. + * @_name: Attribute name. + * + * Like DEVICE_ATTR(), but @_mode is 0444 and @_show is <_name>_show. + */  #define DEVICE_ATTR_RO(_name) \  	struct device_attribute dev_attr_##_name = __ATTR_RO(_name) + +/** + * DEVICE_ATTR_ADMIN_RO - Define an admin-only readable device attribute. + * @_name: Attribute name. + * + * Like DEVICE_ATTR_RO(), but @_mode is 0400. + */  #define DEVICE_ATTR_ADMIN_RO(_name) \  	struct device_attribute dev_attr_##_name = __ATTR_RO_MODE(_name, 0400) + +/** + * DEVICE_ATTR_WO - Define an admin-only writable device attribute. + * @_name: Attribute name. + * + * Like DEVICE_ATTR(), but @_mode is 0200 and @_store is <_name>_store. + */  #define DEVICE_ATTR_WO(_name) \  	struct device_attribute dev_attr_##_name = __ATTR_WO(_name) + +/** + * DEVICE_ULONG_ATTR - Define a device attribute backed by an unsigned long. + * @_name: Attribute name. + * @_mode: File mode. + * @_var: Identifier of unsigned long. + * + * Like DEVICE_ATTR(), but @_show and @_store are automatically provided + * such that reads and writes to the attribute from userspace affect @_var. + */  #define DEVICE_ULONG_ATTR(_name, _mode, _var) \  	struct dev_ext_attribute dev_attr_##_name = \  		{ __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } + +/** + * DEVICE_INT_ATTR - Define a device attribute backed by an int. + * @_name: Attribute name. + * @_mode: File mode. + * @_var: Identifier of int. + * + * Like DEVICE_ULONG_ATTR(), but @_var is an int. + */  #define DEVICE_INT_ATTR(_name, _mode, _var) \  	struct dev_ext_attribute dev_attr_##_name = \  		{ __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } + +/** + * DEVICE_BOOL_ATTR - Define a device attribute backed by a bool. + * @_name: Attribute name. + * @_mode: File mode. + * @_var: Identifier of bool. + * + * Like DEVICE_ULONG_ATTR(), but @_var is a bool. + */  #define DEVICE_BOOL_ATTR(_name, _mode, _var) \  	struct dev_ext_attribute dev_attr_##_name = \  		{ __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) } +  #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \  	struct device_attribute dev_attr_##_name =		\  		__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) @@ -223,6 +327,17 @@ static inline void *devm_kcalloc(struct device *dev,  {  	return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);  } +static inline __realloc_size(3, 4) void * __must_check +devm_krealloc_array(struct device *dev, void *p, size_t new_n, size_t new_size, gfp_t flags) +{ +	size_t bytes; + +	if (unlikely(check_mul_overflow(new_n, new_size, &bytes))) +		return NULL; + +	return devm_krealloc(dev, p, bytes, flags); +} +  void devm_kfree(struct device *dev, const void *p);  char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc;  const char *devm_kstrdup_const(struct device *dev, const char *s, gfp_t gfp); @@ -700,6 +815,11 @@ static inline bool device_iommu_mapped(struct device *dev)  /* Get the wakeup routines, which depend on struct device */  #include <linux/pm_wakeup.h> +/** + * dev_name - Return a device's name. + * @dev: Device with name to get. + * Return: The kobject name of the device, or its initial name if unavailable. + */  static inline const char *dev_name(const struct device *dev)  {  	/* Use the init name until the kobject becomes available */ diff --git a/include/linux/dm-bufio.h b/include/linux/dm-bufio.h index 681656a1c03d..75e7d8cbb532 100644 --- a/include/linux/dm-bufio.h +++ b/include/linux/dm-bufio.h @@ -38,6 +38,8 @@ dm_bufio_client_create(struct block_device *bdev, unsigned int block_size,   */  void dm_bufio_client_destroy(struct dm_bufio_client *c); +void dm_bufio_client_reset(struct dm_bufio_client *c); +  /*   * Set the sector range.   * When this function is called, there must be no I/O in progress on the bufio diff --git a/include/linux/efi.h b/include/linux/efi.h index 18d83a613635..ab088c662e88 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -1056,6 +1056,7 @@ struct efivar_operations {  	efi_set_variable_t *set_variable;  	efi_set_variable_t *set_variable_nonblocking;  	efi_query_variable_store_t *query_variable_store; +	efi_query_variable_info_t *query_variable_info;  };  struct efivars { @@ -1063,6 +1064,12 @@ struct efivars {  	const struct efivar_operations *ops;  }; +#ifdef CONFIG_X86 +u64 __attribute_const__ efivar_reserved_space(void); +#else +static inline u64 efivar_reserved_space(void) { return 0; } +#endif +  /*   * The maximum size of VariableName + Data = 1024   * Therefore, it's reasonable to save that much @@ -1101,6 +1108,10 @@ efi_status_t efivar_set_variable_locked(efi_char16_t *name, efi_guid_t *vendor,  efi_status_t efivar_set_variable(efi_char16_t *name, efi_guid_t *vendor,  				 u32 attr, unsigned long data_size, void *data); +efi_status_t efivar_query_variable_info(u32 attr, u64 *storage_space, +					u64 *remaining_space, +					u64 *max_variable_size); +  #if IS_ENABLED(CONFIG_EFI_CAPSULE_LOADER)  extern bool efi_capsule_pending(int *reset_type); diff --git a/include/linux/export-internal.h b/include/linux/export-internal.h index fe7e6ba918f1..1c849db953a5 100644 --- a/include/linux/export-internal.h +++ b/include/linux/export-internal.h @@ -10,6 +10,55 @@  #include <linux/compiler.h>  #include <linux/types.h> +#if defined(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS) +/* + * relative reference: this reduces the size by half on 64-bit architectures, + * and eliminates the need for absolute relocations that require runtime + * processing on relocatable kernels. + */ +#define __KSYM_REF(sym)		".long " #sym "- ." +#elif defined(CONFIG_64BIT) +#define __KSYM_REF(sym)		".quad " #sym +#else +#define __KSYM_REF(sym)		".long " #sym +#endif + +/* + * For every exported symbol, do the following: + * + * - Put the name of the symbol and namespace (empty string "" for none) in + *   __ksymtab_strings. + * - Place a struct kernel_symbol entry in the __ksymtab section. + * + * Note on .section use: we specify progbits since usage of the "M" (SHF_MERGE) + * section flag requires it. Use '%progbits' instead of '@progbits' since the + * former apparently works on all arches according to the binutils source. + */ +#define __KSYMTAB(name, sym, sec, ns)						\ +	asm("	.section \"__ksymtab_strings\",\"aMS\",%progbits,1"	"\n"	\ +	    "__kstrtab_" #name ":"					"\n"	\ +	    "	.asciz \"" #name "\""					"\n"	\ +	    "__kstrtabns_" #name ":"					"\n"	\ +	    "	.asciz \"" ns "\""					"\n"	\ +	    "	.previous"						"\n"	\ +	    "	.section \"___ksymtab" sec "+" #name "\", \"a\""	"\n"	\ +	    "	.balign	4"						"\n"	\ +	    "__ksymtab_" #name ":"					"\n"	\ +		__KSYM_REF(sym)						"\n"	\ +		__KSYM_REF(__kstrtab_ ##name)				"\n"	\ +		__KSYM_REF(__kstrtabns_ ##name)				"\n"	\ +	    "	.previous"						"\n"	\ +	) + +#ifdef CONFIG_IA64 +#define KSYM_FUNC(name)		@fptr(name) +#else +#define KSYM_FUNC(name)		name +#endif + +#define KSYMTAB_FUNC(name, sec, ns)	__KSYMTAB(name, KSYM_FUNC(name), sec, ns) +#define KSYMTAB_DATA(name, sec, ns)	__KSYMTAB(name, name, sec, ns) +  #define SYMBOL_CRC(sym, crc, sec)   \  	asm(".section \"___kcrctab" sec "+" #sym "\",\"a\""	"\n" \  	    "__crc_" #sym ":"					"\n" \ diff --git a/include/linux/export.h b/include/linux/export.h index 3f31ced0d977..beed8387e0a4 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -2,6 +2,8 @@  #ifndef _LINUX_EXPORT_H  #define _LINUX_EXPORT_H +#include <linux/compiler.h> +#include <linux/linkage.h>  #include <linux/stringify.h>  /* @@ -28,74 +30,25 @@ extern struct module __this_module;  #else  #define THIS_MODULE ((struct module *)0)  #endif +#endif /* __ASSEMBLY__ */ -#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS -#include <linux/compiler.h> -/* - * Emit the ksymtab entry as a pair of relative references: this reduces - * the size by half on 64-bit architectures, and eliminates the need for - * absolute relocations that require runtime processing on relocatable - * kernels. - */ -#define __KSYMTAB_ENTRY(sym, sec)					\ -	__ADDRESSABLE(sym)						\ -	asm("	.section \"___ksymtab" sec "+" #sym "\", \"a\"	\n"	\ -	    "	.balign	4					\n"	\ -	    "__ksymtab_" #sym ":				\n"	\ -	    "	.long	" #sym "- .				\n"	\ -	    "	.long	__kstrtab_" #sym "- .			\n"	\ -	    "	.long	__kstrtabns_" #sym "- .			\n"	\ -	    "	.previous					\n") - -struct kernel_symbol { -	int value_offset; -	int name_offset; -	int namespace_offset; -}; +#ifdef CONFIG_64BIT +#define __EXPORT_SYMBOL_REF(sym)			\ +	.balign 8				ASM_NL	\ +	.quad sym  #else -#define __KSYMTAB_ENTRY(sym, sec)					\ -	static const struct kernel_symbol __ksymtab_##sym		\ -	__attribute__((section("___ksymtab" sec "+" #sym), used))	\ -	__aligned(sizeof(void *))					\ -	= { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } - -struct kernel_symbol { -	unsigned long value; -	const char *name; -	const char *namespace; -}; +#define __EXPORT_SYMBOL_REF(sym)			\ +	.balign 4				ASM_NL	\ +	.long sym  #endif -#ifdef __GENKSYMS__ - -#define ___EXPORT_SYMBOL(sym, sec, ns)	__GENKSYMS_EXPORT_SYMBOL(sym) - -#else - -/* - * For every exported symbol, do the following: - * - * - Put the name of the symbol and namespace (empty string "" for none) in - *   __ksymtab_strings. - * - Place a struct kernel_symbol entry in the __ksymtab section. - * - * note on .section use: we specify progbits since usage of the "M" (SHF_MERGE) - * section flag requires it. Use '%progbits' instead of '@progbits' since the - * former apparently works on all arches according to the binutils source. - */ -#define ___EXPORT_SYMBOL(sym, sec, ns)						\ -	extern typeof(sym) sym;							\ -	extern const char __kstrtab_##sym[];					\ -	extern const char __kstrtabns_##sym[];					\ -	asm("	.section \"__ksymtab_strings\",\"aMS\",%progbits,1	\n"	\ -	    "__kstrtab_" #sym ":					\n"	\ -	    "	.asciz 	\"" #sym "\"					\n"	\ -	    "__kstrtabns_" #sym ":					\n"	\ -	    "	.asciz 	\"" ns "\"					\n"	\ -	    "	.previous						\n");	\ -	__KSYMTAB_ENTRY(sym, sec) - -#endif +#define ___EXPORT_SYMBOL(sym, license, ns)		\ +	.section ".export_symbol","a"		ASM_NL	\ +	__export_symbol_##sym:			ASM_NL	\ +		.asciz license			ASM_NL	\ +		.asciz ns			ASM_NL	\ +		__EXPORT_SYMBOL_REF(sym)	ASM_NL	\ +	.previous  #if !defined(CONFIG_MODULES) || defined(__DISABLE_EXPORTS) @@ -104,54 +57,35 @@ struct kernel_symbol {   * be reused in other execution contexts such as the UEFI stub or the   * decompressor.   */ -#define __EXPORT_SYMBOL(sym, sec, ns) +#define __EXPORT_SYMBOL(sym, license, ns) -#elif defined(CONFIG_TRIM_UNUSED_KSYMS) +#elif defined(__GENKSYMS__) -#include <generated/autoksyms.h> +#define __EXPORT_SYMBOL(sym, license, ns)	__GENKSYMS_EXPORT_SYMBOL(sym) -/* - * For fine grained build dependencies, we want to tell the build system - * about each possible exported symbol even if they're not actually exported. - * We use a symbol pattern __ksym_marker_<symbol> that the build system filters - * from the $(NM) output (see scripts/gen_ksymdeps.sh). These symbols are - * discarded in the final link stage. - */ -#define __ksym_marker(sym)	\ -	static int __ksym_marker_##sym[0] __section(".discard.ksym") __used - -#define __EXPORT_SYMBOL(sym, sec, ns)					\ -	__ksym_marker(sym);						\ -	__cond_export_sym(sym, sec, ns, __is_defined(__KSYM_##sym)) -#define __cond_export_sym(sym, sec, ns, conf)				\ -	___cond_export_sym(sym, sec, ns, conf) -#define ___cond_export_sym(sym, sec, ns, enabled)			\ -	__cond_export_sym_##enabled(sym, sec, ns) -#define __cond_export_sym_1(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns) - -#ifdef __GENKSYMS__ -#define __cond_export_sym_0(sym, sec, ns) __GENKSYMS_EXPORT_SYMBOL(sym) -#else -#define __cond_export_sym_0(sym, sec, ns) /* nothing */ -#endif +#elif defined(__ASSEMBLY__) + +#define __EXPORT_SYMBOL(sym, license, ns) \ +	___EXPORT_SYMBOL(sym, license, ns)  #else -#define __EXPORT_SYMBOL(sym, sec, ns)	___EXPORT_SYMBOL(sym, sec, ns) +#define __EXPORT_SYMBOL(sym, license, ns)			\ +	extern typeof(sym) sym;					\ +	__ADDRESSABLE(sym)					\ +	asm(__stringify(___EXPORT_SYMBOL(sym, license, ns)))  #endif /* CONFIG_MODULES */  #ifdef DEFAULT_SYMBOL_NAMESPACE -#define _EXPORT_SYMBOL(sym, sec)	__EXPORT_SYMBOL(sym, sec, __stringify(DEFAULT_SYMBOL_NAMESPACE)) +#define _EXPORT_SYMBOL(sym, license)	__EXPORT_SYMBOL(sym, license, __stringify(DEFAULT_SYMBOL_NAMESPACE))  #else -#define _EXPORT_SYMBOL(sym, sec)	__EXPORT_SYMBOL(sym, sec, "") +#define _EXPORT_SYMBOL(sym, license)	__EXPORT_SYMBOL(sym, license, "")  #endif  #define EXPORT_SYMBOL(sym)		_EXPORT_SYMBOL(sym, "") -#define EXPORT_SYMBOL_GPL(sym)		_EXPORT_SYMBOL(sym, "_gpl") +#define EXPORT_SYMBOL_GPL(sym)		_EXPORT_SYMBOL(sym, "GPL")  #define EXPORT_SYMBOL_NS(sym, ns)	__EXPORT_SYMBOL(sym, "", __stringify(ns)) -#define EXPORT_SYMBOL_NS_GPL(sym, ns)	__EXPORT_SYMBOL(sym, "_gpl", __stringify(ns)) - -#endif /* !__ASSEMBLY__ */ +#define EXPORT_SYMBOL_NS_GPL(sym, ns)	__EXPORT_SYMBOL(sym, "GPL", __stringify(ns))  #endif /* _LINUX_EXPORT_H */ diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 9edb29101ec8..11fbd0ee1370 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -135,6 +135,9 @@ struct fid {  	};  }; +#define EXPORT_FH_CONNECTABLE	0x1 /* Encode file handle with parent */ +#define EXPORT_FH_FID		0x2 /* File handle may be non-decodeable */ +  /**   * struct export_operations - for nfsd to communicate with file systems   * @encode_fh:      encode a file handle fragment from a dentry @@ -150,7 +153,7 @@ struct fid {   * encode_fh:   *    @encode_fh should store in the file handle fragment @fh (using at most   *    @max_len bytes) information that can be used by @decode_fh to recover the - *    file referred to by the &struct dentry @de.  If the @connectable flag is + *    file referred to by the &struct dentry @de.  If @flag has CONNECTABLE bit   *    set, the encode_fh() should store sufficient information so that a good   *    attempt can be made to find not only the file but also it's place in the   *    filesystem.   This typically means storing a reference to de->d_parent in @@ -225,9 +228,18 @@ struct export_operations {  };  extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, -				    int *max_len, struct inode *parent); +				    int *max_len, struct inode *parent, +				    int flags);  extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, -	int *max_len, int connectable); +			      int *max_len, int flags); + +static inline int exportfs_encode_fid(struct inode *inode, struct fid *fid, +				      int *max_len) +{ +	return exportfs_encode_inode_fh(inode, fid, max_len, NULL, +					EXPORT_FH_FID); +} +  extern struct dentry *exportfs_decode_fh_raw(struct vfsmount *mnt,  					     struct fid *fid, int fh_len,  					     int fileid_type, diff --git a/include/linux/fb.h b/include/linux/fb.h index 08cb47da71f8..ce7d588edc3e 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -15,7 +15,8 @@  #include <linux/list.h>  #include <linux/backlight.h>  #include <linux/slab.h> -#include <asm/io.h> + +#include <asm/fb.h>  struct vm_area_struct;  struct fb_info; @@ -511,58 +512,6 @@ struct fb_info {   */  #define STUPID_ACCELF_TEXT_SHIT -// This will go away -#if defined(__sparc__) - -/* We map all of our framebuffers such that big-endian accesses - * are what we want, so the following is sufficient. - */ - -// This will go away -#define fb_readb sbus_readb -#define fb_readw sbus_readw -#define fb_readl sbus_readl -#define fb_readq sbus_readq -#define fb_writeb sbus_writeb -#define fb_writew sbus_writew -#define fb_writel sbus_writel -#define fb_writeq sbus_writeq -#define fb_memset sbus_memset_io -#define fb_memcpy_fromfb sbus_memcpy_fromio -#define fb_memcpy_tofb sbus_memcpy_toio - -#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) ||	\ -	defined(__hppa__) || defined(__sh__) || defined(__powerpc__) ||	\ -	defined(__arm__) || defined(__aarch64__) || defined(__mips__) - -#define fb_readb __raw_readb -#define fb_readw __raw_readw -#define fb_readl __raw_readl -#define fb_readq __raw_readq -#define fb_writeb __raw_writeb -#define fb_writew __raw_writew -#define fb_writel __raw_writel -#define fb_writeq __raw_writeq -#define fb_memset memset_io -#define fb_memcpy_fromfb memcpy_fromio -#define fb_memcpy_tofb memcpy_toio - -#else - -#define fb_readb(addr) (*(volatile u8 *) (addr)) -#define fb_readw(addr) (*(volatile u16 *) (addr)) -#define fb_readl(addr) (*(volatile u32 *) (addr)) -#define fb_readq(addr) (*(volatile u64 *) (addr)) -#define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b)) -#define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b)) -#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) -#define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b)) -#define fb_memset memset -#define fb_memcpy_fromfb memcpy -#define fb_memcpy_tofb memcpy - -#endif -  #define FB_LEFT_POS(p, bpp)          (fb_be_math(p) ? (32 - (bpp)) : 0)  #define FB_SHIFT_HIGH(p, val, bits)  (fb_be_math(p) ? (val) >> (bits) : \  						      (val) << (bits)) @@ -576,12 +525,44 @@ struct fb_info {  extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var);  extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var);  extern int fb_blank(struct fb_info *info, int blank); + +/* + * Drawing operations where framebuffer is in I/O memory + */ +  extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);  extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);  extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); +extern ssize_t fb_io_read(struct fb_info *info, char __user *buf, +			  size_t count, loff_t *ppos); +extern ssize_t fb_io_write(struct fb_info *info, const char __user *buf, +			   size_t count, loff_t *ppos); + +/* + * Initializes struct fb_ops for framebuffers in I/O memory. + */ + +#define __FB_DEFAULT_IO_OPS_RDWR \ +	.fb_read	= fb_io_read, \ +	.fb_write	= fb_io_write + +#define __FB_DEFAULT_IO_OPS_DRAW \ +	.fb_fillrect	= cfb_fillrect, \ +	.fb_copyarea	= cfb_copyarea, \ +	.fb_imageblit	= cfb_imageblit + +#define __FB_DEFAULT_IO_OPS_MMAP \ +	.fb_mmap	= NULL /* default implementation */ + +#define FB_DEFAULT_IO_OPS \ +	__FB_DEFAULT_IO_OPS_RDWR, \ +	__FB_DEFAULT_IO_OPS_DRAW, \ +	__FB_DEFAULT_IO_OPS_MMAP +  /*   * Drawing operations where framebuffer is in system RAM   */ +  extern void sys_fillrect(struct fb_info *info, const struct fb_fillrect *rect);  extern void sys_copyarea(struct fb_info *info, const struct fb_copyarea *area);  extern void sys_imageblit(struct fb_info *info, const struct fb_image *image); @@ -590,6 +571,27 @@ extern ssize_t fb_sys_read(struct fb_info *info, char __user *buf,  extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,  			    size_t count, loff_t *ppos); +/* + * Initializes struct fb_ops for framebuffers in system memory. + */ + +#define __FB_DEFAULT_SYS_OPS_RDWR \ +	.fb_read	= fb_sys_read, \ +	.fb_write	= fb_sys_write + +#define __FB_DEFAULT_SYS_OPS_DRAW \ +	.fb_fillrect	= sys_fillrect, \ +	.fb_copyarea	= sys_copyarea, \ +	.fb_imageblit	= sys_imageblit + +#define __FB_DEFAULT_SYS_OPS_MMAP \ +	.fb_mmap	= NULL /* default implementation */ + +#define FB_DEFAULT_SYS_OPS \ +	__FB_DEFAULT_SYS_OPS_RDWR, \ +	__FB_DEFAULT_SYS_OPS_DRAW, \ +	__FB_DEFAULT_SYS_OPS_MMAP +  /* drivers/video/fbmem.c */  extern int register_framebuffer(struct fb_info *fb_info);  extern void unregister_framebuffer(struct fb_info *fb_info); @@ -645,6 +647,75 @@ extern void fb_deferred_io_cleanup(struct fb_info *info);  extern int fb_deferred_io_fsync(struct file *file, loff_t start,  				loff_t end, int datasync); +/* + * Generate callbacks for deferred I/O + */ + +#define __FB_GEN_DEFAULT_DEFERRED_OPS_RDWR(__prefix, __damage_range, __mode) \ +	static ssize_t __prefix ## _defio_read(struct fb_info *info, char __user *buf, \ +					       size_t count, loff_t *ppos) \ +	{ \ +		return fb_ ## __mode ## _read(info, buf, count, ppos); \ +	} \ +	static ssize_t __prefix ## _defio_write(struct fb_info *info, const char __user *buf, \ +						size_t count, loff_t *ppos) \ +	{ \ +		unsigned long offset = *ppos; \ +		ssize_t ret = fb_ ## __mode ## _write(info, buf, count, ppos); \ +		if (ret > 0) \ +			__damage_range(info, offset, ret); \ +		return ret; \ +	} + +#define __FB_GEN_DEFAULT_DEFERRED_OPS_DRAW(__prefix, __damage_area, __mode) \ +	static void __prefix ## _defio_fillrect(struct fb_info *info, \ +						const struct fb_fillrect *rect) \ +	{ \ +		__mode ## _fillrect(info, rect); \ +		__damage_area(info, rect->dx, rect->dy, rect->width, rect->height); \ +	} \ +	static void __prefix ## _defio_copyarea(struct fb_info *info, \ +						const struct fb_copyarea *area) \ +	{ \ +		__mode ## _copyarea(info, area); \ +		__damage_area(info, area->dx, area->dy, area->width, area->height); \ +	} \ +	static void __prefix ## _defio_imageblit(struct fb_info *info, \ +						 const struct fb_image *image) \ +	{ \ +		__mode ## _imageblit(info, image); \ +		__damage_area(info, image->dx, image->dy, image->width, image->height); \ +	} + +#define FB_GEN_DEFAULT_DEFERRED_IO_OPS(__prefix, __damage_range, __damage_area) \ +	__FB_GEN_DEFAULT_DEFERRED_OPS_RDWR(__prefix, __damage_range, io) \ +	__FB_GEN_DEFAULT_DEFERRED_OPS_DRAW(__prefix, __damage_area, cfb) + +#define FB_GEN_DEFAULT_DEFERRED_SYS_OPS(__prefix, __damage_range, __damage_area) \ +	__FB_GEN_DEFAULT_DEFERRED_OPS_RDWR(__prefix, __damage_range, sys) \ +	__FB_GEN_DEFAULT_DEFERRED_OPS_DRAW(__prefix, __damage_area, sys) + +/* + * Initializes struct fb_ops for deferred I/O. + */ + +#define __FB_DEFAULT_DEFERRED_OPS_RDWR(__prefix) \ +	.fb_read	= __prefix ## _defio_read, \ +	.fb_write	= __prefix ## _defio_write + +#define __FB_DEFAULT_DEFERRED_OPS_DRAW(__prefix) \ +	.fb_fillrect	= __prefix ## _defio_fillrect, \ +	.fb_copyarea	= __prefix ## _defio_copyarea, \ +	.fb_imageblit	= __prefix ## _defio_imageblit + +#define __FB_DEFAULT_DEFERRED_OPS_MMAP(__prefix) \ +	.fb_mmap	= fb_deferred_io_mmap + +#define FB_DEFAULT_DEFERRED_OPS(__prefix) \ +	__FB_DEFAULT_DEFERRED_OPS_RDWR(__prefix), \ +	__FB_DEFAULT_DEFERRED_OPS_DRAW(__prefix), \ +	__FB_DEFAULT_DEFERRED_OPS_MMAP(__prefix) +  static inline bool fb_be_math(struct fb_info *info)  {  #ifdef CONFIG_FB_FOREIGN_ENDIAN diff --git a/include/linux/filter.h b/include/linux/filter.h index bbce89937fde..f69114083ec7 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -874,7 +874,6 @@ void bpf_prog_free(struct bpf_prog *fp);  bool bpf_opcode_in_insntable(u8 code); -void bpf_prog_free_linfo(struct bpf_prog *prog);  void bpf_prog_fill_jited_linfo(struct bpf_prog *prog,  			       const u32 *insn_to_jit_off);  int bpf_prog_alloc_jited_linfo(struct bpf_prog *prog); diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index f5da51677069..9dda7d9898ff 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -4,7 +4,7 @@   *   *  Copyright (C) 2014-2021 Xilinx   * - *  Michal Simek <[email protected]> + *  Michal Simek <[email protected]>   *  Davorin Mista <[email protected]>   *  Jolly Shah <[email protected]>   *  Rajan Vaja <[email protected]> diff --git a/include/linux/fprobe.h b/include/linux/fprobe.h index 47fefc7f363b..3e03758151f4 100644 --- a/include/linux/fprobe.h +++ b/include/linux/fprobe.h @@ -35,9 +35,11 @@ struct fprobe {  	int			nr_maxactive;  	int (*entry_handler)(struct fprobe *fp, unsigned long entry_ip, -			     struct pt_regs *regs, void *entry_data); +			     unsigned long ret_ip, struct pt_regs *regs, +			     void *entry_data);  	void (*exit_handler)(struct fprobe *fp, unsigned long entry_ip, -			     struct pt_regs *regs, void *entry_data); +			     unsigned long ret_ip, struct pt_regs *regs, +			     void *entry_data);  };  /* This fprobe is soft-disabled. */ @@ -64,6 +66,7 @@ int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter  int register_fprobe_ips(struct fprobe *fp, unsigned long *addrs, int num);  int register_fprobe_syms(struct fprobe *fp, const char **syms, int num);  int unregister_fprobe(struct fprobe *fp); +bool fprobe_is_registered(struct fprobe *fp);  #else  static inline int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter)  { @@ -81,6 +84,10 @@ static inline int unregister_fprobe(struct fprobe *fp)  {  	return -EOPNOTSUPP;  } +static inline bool fprobe_is_registered(struct fprobe *fp) +{ +	return false; +}  #endif  /** diff --git a/include/linux/fs.h b/include/linux/fs.h index 122b218b66c9..6867512907d6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1148,7 +1148,6 @@ enum {  struct sb_writers {  	int				frozen;		/* Is sb frozen? */ -	wait_queue_head_t		wait_unfrozen;	/* wait for thaw */  	struct percpu_rw_semaphore	rw_sem[SB_FREEZE_LEVELS];  }; @@ -1794,12 +1793,12 @@ struct file_operations {  	int (*fsync) (struct file *, loff_t, loff_t, int datasync);  	int (*fasync) (int, struct file *, int);  	int (*lock) (struct file *, int, struct file_lock *); -	ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);  	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);  	int (*check_flags)(int);  	int (*flock) (struct file *, int, struct file_lock *);  	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);  	ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); +	void (*splice_eof)(struct file *file);  	int (*setlease)(struct file *, long, struct file_lock **, void **);  	long (*fallocate)(struct file *file, int mode, loff_t offset,  			  loff_t len); @@ -2784,8 +2783,6 @@ ssize_t copy_splice_read(struct file *in, loff_t *ppos,  			 size_t len, unsigned int flags);  extern ssize_t iter_file_splice_write(struct pipe_inode_info *,  		struct file *, loff_t *, size_t, unsigned int); -extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, -		struct file *out, loff_t *, size_t len, unsigned int flags);  extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,  		loff_t *opos, size_t len, unsigned int flags); diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h index a86115bc799c..a1b3de87a3d1 100644 --- a/include/linux/fsl/mc.h +++ b/include/linux/fsl/mc.h @@ -48,7 +48,7 @@ struct fsl_mc_driver {  	struct device_driver driver;  	const struct fsl_mc_device_id *match_id_table;  	int (*probe)(struct fsl_mc_device *dev); -	int (*remove)(struct fsl_mc_device *dev); +	void (*remove)(struct fsl_mc_device *dev);  	void (*shutdown)(struct fsl_mc_device *dev);  	int (*suspend)(struct fsl_mc_device *dev, pm_message_t state);  	int (*resume)(struct fsl_mc_device *dev); diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index b23bdd414394..8e59bd954153 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -633,6 +633,7 @@ enum {  	FTRACE_ITER_MOD		= (1 << 5),  	FTRACE_ITER_ENABLED	= (1 << 6),  	FTRACE_ITER_TOUCHED	= (1 << 7), +	FTRACE_ITER_ADDRS	= (1 << 8),  };  void arch_ftrace_update_code(int command); @@ -1018,6 +1019,9 @@ struct ftrace_graph_ent {   */  struct ftrace_graph_ret {  	unsigned long func; /* Current function */ +#ifdef CONFIG_FUNCTION_GRAPH_RETVAL +	unsigned long retval; +#endif  	int depth;  	/* Number of functions that overran the depth limit for current task */  	unsigned int overrun; diff --git a/include/linux/gameport.h b/include/linux/gameport.h index 8c2f00018e89..0a221e768ea4 100644 --- a/include/linux/gameport.h +++ b/include/linux/gameport.h @@ -5,7 +5,6 @@  #ifndef _GAMEPORT_H  #define _GAMEPORT_H -#include <asm/io.h>  #include <linux/types.h>  #include <linux/list.h>  #include <linux/mutex.h> @@ -165,18 +164,12 @@ void gameport_unregister_driver(struct gameport_driver *drv);  static inline void gameport_trigger(struct gameport *gameport)  { -	if (gameport->trigger) -		gameport->trigger(gameport); -	else -		outb(0xff, gameport->io); +	gameport->trigger(gameport);  }  static inline unsigned char gameport_read(struct gameport *gameport)  { -	if (gameport->read) -		return gameport->read(gameport); -	else -		return inb(gameport->io); +	return gameport->read(gameport);  }  static inline int gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons) diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 8528353e073b..7ecc25c543ce 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -32,17 +32,6 @@ struct device;  /* Gpio pin is active-low */  #define GPIOF_ACTIVE_LOW        (1 << 2) -/* Gpio pin is open drain */ -#define GPIOF_OPEN_DRAIN	(1 << 3) - -/* Gpio pin is open source */ -#define GPIOF_OPEN_SOURCE	(1 << 4) - -#define GPIOF_EXPORT		(1 << 5) -#define GPIOF_EXPORT_CHANGEABLE	(1 << 6) -#define GPIOF_EXPORT_DIR_FIXED	(GPIOF_EXPORT) -#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) -  /**   * struct gpio - a structure describing a GPIO with configuration   * @gpio:	the GPIO number @@ -119,11 +108,6 @@ static inline void gpio_set_value(unsigned gpio, int value)  	return gpiod_set_raw_value(gpio_to_desc(gpio), value);  } -static inline int gpio_cansleep(unsigned gpio) -{ -	return gpiod_cansleep(gpio_to_desc(gpio)); -} -  static inline int gpio_to_irq(unsigned gpio)  {  	return gpiod_to_irq(gpio_to_desc(gpio)); @@ -206,13 +190,6 @@ static inline void gpio_set_value(unsigned gpio, int value)  	WARN_ON(1);  } -static inline int gpio_cansleep(unsigned gpio) -{ -	/* GPIO can never have been requested or set as {in,out}put */ -	WARN_ON(1); -	return 0; -} -  static inline int gpio_get_value_cansleep(unsigned gpio)  {  	/* GPIO can never have been requested or set as {in,out}put */ diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 67b8774eed8f..4f0c5d62c8f3 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -61,13 +61,6 @@ struct gpio_irq_chip {  	 */  	struct irq_domain *domain; -	/** -	 * @domain_ops: -	 * -	 * Table of interrupt domain operations for this IRQ chip. -	 */ -	const struct irq_domain_ops *domain_ops; -  #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY  	/**  	 * @fwnode: diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index 2f4dcc8d060e..3bb87bf6bc65 100644 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h @@ -170,19 +170,19 @@ struct hdmi_avi_infoframe {  	enum hdmi_infoframe_type type;  	unsigned char version;  	unsigned char length; +	bool itc; +	unsigned char pixel_repeat;  	enum hdmi_colorspace colorspace;  	enum hdmi_scan_mode scan_mode;  	enum hdmi_colorimetry colorimetry;  	enum hdmi_picture_aspect picture_aspect;  	enum hdmi_active_aspect active_aspect; -	bool itc;  	enum hdmi_extended_colorimetry extended_colorimetry;  	enum hdmi_quantization_range quantization_range;  	enum hdmi_nups nups;  	unsigned char video_code;  	enum hdmi_ycc_quantization_range ycc_quantization_range;  	enum hdmi_content_type content_type; -	unsigned char pixel_repeat;  	unsigned short top_bar;  	unsigned short bottom_bar;  	unsigned short left_bar; diff --git a/include/linux/hid.h b/include/linux/hid.h index 4e4c4fe36911..39e21e3815ad 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -597,6 +597,7 @@ struct hid_device {							/* device report descriptor */  	struct semaphore driver_input_lock;				/* protects the current driver */  	struct device dev;						/* device */  	struct hid_driver *driver; +	void *devres_group_id;						/* ID of probe devres group	*/  	const struct hid_ll_driver *ll_driver;  	struct mutex ll_open_lock; diff --git a/include/linux/hsi/ssi_protocol.h b/include/linux/hsi/ssi_protocol.h index 2d6f3cfa7dea..972434daa000 100644 --- a/include/linux/hsi/ssi_protocol.h +++ b/include/linux/hsi/ssi_protocol.h @@ -24,6 +24,7 @@ int ssip_slave_stop_tx(struct hsi_client *master);  void ssip_reset_event(struct hsi_client *master);  int ssip_slave_running(struct hsi_client *master); +void ssi_waketest(struct hsi_client *cl, unsigned int enable);  #endif /* __LINUX_SSIP_SLAVE_H__ */ diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 492dd27a5dd8..8cd6a6b33593 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h @@ -44,6 +44,7 @@ enum hwmon_chip_attributes {  	hwmon_chip_in_samples,  	hwmon_chip_power_samples,  	hwmon_chip_temp_samples, +	hwmon_chip_beep_enable,  };  #define HWMON_C_TEMP_RESET_HISTORY	BIT(hwmon_chip_temp_reset_history) @@ -58,6 +59,7 @@ enum hwmon_chip_attributes {  #define HWMON_C_IN_SAMPLES		BIT(hwmon_chip_in_samples)  #define HWMON_C_POWER_SAMPLES		BIT(hwmon_chip_power_samples)  #define HWMON_C_TEMP_SAMPLES		BIT(hwmon_chip_temp_samples) +#define HWMON_C_BEEP_ENABLE		BIT(hwmon_chip_beep_enable)  enum hwmon_temp_attributes {  	hwmon_temp_enable, @@ -87,6 +89,7 @@ enum hwmon_temp_attributes {  	hwmon_temp_reset_history,  	hwmon_temp_rated_min,  	hwmon_temp_rated_max, +	hwmon_temp_beep,  };  #define HWMON_T_ENABLE		BIT(hwmon_temp_enable) @@ -116,6 +119,7 @@ enum hwmon_temp_attributes {  #define HWMON_T_RESET_HISTORY	BIT(hwmon_temp_reset_history)  #define HWMON_T_RATED_MIN	BIT(hwmon_temp_rated_min)  #define HWMON_T_RATED_MAX	BIT(hwmon_temp_rated_max) +#define HWMON_T_BEEP		BIT(hwmon_temp_beep)  enum hwmon_in_attributes {  	hwmon_in_enable, @@ -136,6 +140,7 @@ enum hwmon_in_attributes {  	hwmon_in_crit_alarm,  	hwmon_in_rated_min,  	hwmon_in_rated_max, +	hwmon_in_beep,  };  #define HWMON_I_ENABLE		BIT(hwmon_in_enable) @@ -156,6 +161,7 @@ enum hwmon_in_attributes {  #define HWMON_I_CRIT_ALARM	BIT(hwmon_in_crit_alarm)  #define HWMON_I_RATED_MIN	BIT(hwmon_in_rated_min)  #define HWMON_I_RATED_MAX	BIT(hwmon_in_rated_max) +#define HWMON_I_BEEP		BIT(hwmon_in_beep)  enum hwmon_curr_attributes {  	hwmon_curr_enable, @@ -176,6 +182,7 @@ enum hwmon_curr_attributes {  	hwmon_curr_crit_alarm,  	hwmon_curr_rated_min,  	hwmon_curr_rated_max, +	hwmon_curr_beep,  };  #define HWMON_C_ENABLE		BIT(hwmon_curr_enable) @@ -196,6 +203,7 @@ enum hwmon_curr_attributes {  #define HWMON_C_CRIT_ALARM	BIT(hwmon_curr_crit_alarm)  #define HWMON_C_RATED_MIN	BIT(hwmon_curr_rated_min)  #define HWMON_C_RATED_MAX	BIT(hwmon_curr_rated_max) +#define HWMON_C_BEEP		BIT(hwmon_curr_beep)  enum hwmon_power_attributes {  	hwmon_power_enable, @@ -312,6 +320,7 @@ enum hwmon_fan_attributes {  	hwmon_fan_min_alarm,  	hwmon_fan_max_alarm,  	hwmon_fan_fault, +	hwmon_fan_beep,  };  #define HWMON_F_ENABLE			BIT(hwmon_fan_enable) @@ -326,6 +335,7 @@ enum hwmon_fan_attributes {  #define HWMON_F_MIN_ALARM		BIT(hwmon_fan_min_alarm)  #define HWMON_F_MAX_ALARM		BIT(hwmon_fan_max_alarm)  #define HWMON_F_FAULT			BIT(hwmon_fan_fault) +#define HWMON_F_BEEP			BIT(hwmon_fan_beep)  enum hwmon_pwm_attributes {  	hwmon_pwm_input, diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 13a1ce38cb0c..3430cc2b05a6 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -367,6 +367,8 @@ struct i2c_adapter *i2c_verify_adapter(struct device *dev);  const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,  					 const struct i2c_client *client); +const void *i2c_get_match_data(const struct i2c_client *client); +  static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)  {  	struct device * const dev = kobj_to_dev(kobj); diff --git a/include/linux/i8042.h b/include/linux/i8042.h index 0261e2fb3636..95b07f8b77fe 100644 --- a/include/linux/i8042.h +++ b/include/linux/i8042.h @@ -3,6 +3,7 @@  #define _LINUX_I8042_H +#include <linux/errno.h>  #include <linux/types.h>  /* diff --git a/include/linux/i8254.h b/include/linux/i8254.h new file mode 100644 index 000000000000..a675c309232b --- /dev/null +++ b/include/linux/i8254.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) William Breathitt Gray */ +#ifndef _I8254_H_ +#define _I8254_H_ + +struct device; +struct regmap; + +/** + * struct i8254_regmap_config - Configuration for the register map of an i8254 + * @parent:	parent device + * @map:	regmap for the i8254 + */ +struct i8254_regmap_config { +	struct device *parent; +	struct regmap *map; +}; + +int devm_i8254_regmap_register(struct device *dev, const struct i8254_regmap_config *config); + +#endif /* _I8254_H_ */ diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index c4cf296e7eaf..4b998090898e 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -1349,8 +1349,11 @@ struct ieee80211_mgmt {  /* Supported rates membership selectors */  #define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127  #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY	126 -#define BSS_MEMBERSHIP_SELECTOR_HE_PHY	122 +#define BSS_MEMBERSHIP_SELECTOR_GLK	125 +#define BSS_MEMBERSHIP_SELECTOR_EPS	124  #define BSS_MEMBERSHIP_SELECTOR_SAE_H2E 123 +#define BSS_MEMBERSHIP_SELECTOR_HE_PHY	122 +#define BSS_MEMBERSHIP_SELECTOR_EHT_PHY	121  /* mgmt header + 1 byte category code */  #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) @@ -1993,12 +1996,18 @@ struct ieee80211_mu_edca_param_set {   * @rx_tx_mcs13_max_nss: indicates the maximum number of spatial streams   *     supported for reception and the maximum number of spatial streams   *     supported for transmission for MCS 12 - 13. + * @rx_tx_max_nss: array of the previous fields for easier loop access   */  struct ieee80211_eht_mcs_nss_supp_20mhz_only { -	u8 rx_tx_mcs7_max_nss; -	u8 rx_tx_mcs9_max_nss; -	u8 rx_tx_mcs11_max_nss; -	u8 rx_tx_mcs13_max_nss; +	union { +		struct { +			u8 rx_tx_mcs7_max_nss; +			u8 rx_tx_mcs9_max_nss; +			u8 rx_tx_mcs11_max_nss; +			u8 rx_tx_mcs13_max_nss; +		}; +		u8 rx_tx_max_nss[4]; +	};  };  /** @@ -2018,11 +2027,17 @@ struct ieee80211_eht_mcs_nss_supp_20mhz_only {   * @rx_tx_mcs13_max_nss: indicates the maximum number of spatial streams   *     supported for reception and the maximum number of spatial streams   *     supported for transmission for MCS 12 - 13. + * @rx_tx_max_nss: array of the previous fields for easier loop access   */  struct ieee80211_eht_mcs_nss_supp_bw { -	u8 rx_tx_mcs9_max_nss; -	u8 rx_tx_mcs11_max_nss; -	u8 rx_tx_mcs13_max_nss; +	union { +		struct { +			u8 rx_tx_mcs9_max_nss; +			u8 rx_tx_mcs11_max_nss; +			u8 rx_tx_mcs13_max_nss; +		}; +		u8 rx_tx_max_nss[3]; +	};  };  /** @@ -2075,7 +2090,7 @@ struct ieee80211_eht_cap_elem {   */  struct ieee80211_eht_operation {  	u8 params; -	__le32 basic_mcs_nss; +	struct ieee80211_eht_mcs_nss_supp_20mhz_only basic_mcs_nss;  	u8 optional[];  } __packed; @@ -2856,6 +2871,7 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)  /* Maximum number of supported EHT LTF is split */  #define IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK	0xc0 +#define IEEE80211_EHT_PHY_CAP5_SUPP_EXTRA_EHT_LTF		0x40  #define IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK	0x07  #define IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK			0x78 @@ -4477,8 +4493,8 @@ static inline bool for_each_element_completed(const struct element *element,  #define IEEE80211_AP_INFO_TBTT_HDR_FILTERED			0x04  #define IEEE80211_AP_INFO_TBTT_HDR_COLOC			0x08  #define IEEE80211_AP_INFO_TBTT_HDR_COUNT			0xF0 -#define IEEE80211_TBTT_INFO_OFFSET_BSSID_BSS_PARAM		9 -#define IEEE80211_TBTT_INFO_OFFSET_BSSID_SSSID_BSS_PARAM	13 +#define IEEE80211_TBTT_INFO_TYPE_TBTT				0 +#define IEEE80211_TBTT_INFO_TYPE_MLD				1  #define IEEE80211_RNR_TBTT_PARAMS_OCT_RECOMMENDED		0x01  #define IEEE80211_RNR_TBTT_PARAMS_SAME_SSID			0x02 @@ -4488,6 +4504,9 @@ static inline bool for_each_element_completed(const struct element *element,  #define IEEE80211_RNR_TBTT_PARAMS_PROBE_ACTIVE			0x20  #define IEEE80211_RNR_TBTT_PARAMS_COLOC_AP			0x40 +#define IEEE80211_RNR_TBTT_PARAMS_PSD_NO_LIMIT			127 +#define IEEE80211_RNR_TBTT_PARAMS_PSD_RESERVED			-128 +  struct ieee80211_neighbor_ap_info {  	u8 tbtt_info_hdr;  	u8 tbtt_info_len; @@ -4502,6 +4521,42 @@ enum ieee80211_range_params_max_total_ltf {  	IEEE80211_RANGE_PARAMS_MAX_TOTAL_LTF_UNSPECIFIED,  }; +/* + * reduced neighbor report, based on Draft P802.11be_D3.0, + * section 9.4.2.170.2. + */ +struct ieee80211_rnr_mld_params { +	u8 mld_id; +	__le16 params; +} __packed; + +#define IEEE80211_RNR_MLD_PARAMS_LINK_ID			0x000F +#define IEEE80211_RNR_MLD_PARAMS_BSS_CHANGE_COUNT		0x0FF0 +#define IEEE80211_RNR_MLD_PARAMS_UPDATES_INCLUDED		0x1000 +#define IEEE80211_RNR_MLD_PARAMS_DISABLED_LINK			0x2000 + +/* Format of the TBTT information element if it has 7, 8 or 9 bytes */ +struct ieee80211_tbtt_info_7_8_9 { +	u8 tbtt_offset; +	u8 bssid[ETH_ALEN]; + +	/* The following element is optional, structure may not grow */ +	u8 bss_params; +	s8 psd_20; +} __packed; + +/* Format of the TBTT information element if it has >= 11 bytes */ +struct ieee80211_tbtt_info_ge_11 { +	u8 tbtt_offset; +	u8 bssid[ETH_ALEN]; +	__le32 short_ssid; + +	/* The following elements are optional, structure may grow */ +	u8 bss_params; +	s8 psd_20; +	struct ieee80211_rnr_mld_params mld_params; +} __packed; +  /* multi-link device */  #define IEEE80211_MLD_MAX_NUM_LINKS	15 @@ -4529,6 +4584,14 @@ struct ieee80211_multi_link_elem {  #define IEEE80211_MED_SYNC_DELAY_SYNC_OFDM_ED_THRESH	0x0f00  #define IEEE80211_MED_SYNC_DELAY_SYNC_MAX_NUM_TXOPS	0xf000 +/* + * Described in P802.11be_D3.0 + * dot11MSDTimerDuration should default to 5484 (i.e. 171.375) + * dot11MSDOFDMEDthreshold defaults to -72 (i.e. 0) + * dot11MSDTXOPMAX defaults to 1 + */ +#define IEEE80211_MED_SYNC_DELAY_DEFAULT		0x10ac +  #define IEEE80211_EML_CAP_EMLSR_SUPP			0x0001  #define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY		0x000e  #define  IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_0US		0 @@ -4611,15 +4674,12 @@ static inline u8 ieee80211_mle_common_size(const u8 *data)  	case IEEE80211_ML_CONTROL_TYPE_BASIC:  	case IEEE80211_ML_CONTROL_TYPE_PREQ:  	case IEEE80211_ML_CONTROL_TYPE_TDLS: +	case IEEE80211_ML_CONTROL_TYPE_RECONF:  		/*  		 * The length is the first octet pointed by mle->variable so no  		 * need to add anything  		 */  		break; -	case IEEE80211_ML_CONTROL_TYPE_RECONF: -		if (control & IEEE80211_MLC_RECONF_PRES_MLD_MAC_ADDR) -			common += ETH_ALEN; -		return common;  	case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS:  		if (control & IEEE80211_MLC_PRIO_ACCESS_PRES_AP_MLD_MAC_ADDR)  			common += ETH_ALEN; @@ -4633,6 +4693,95 @@ static inline u8 ieee80211_mle_common_size(const u8 *data)  }  /** + * ieee80211_mle_get_bss_param_ch_cnt - returns the BSS parameter change count + * @mle: the basic multi link element + * + * The element is assumed to be of the correct type (BASIC) and big enough, + * this must be checked using ieee80211_mle_type_ok(). + * + * If the BSS parameter change count value can't be found (the presence bit + * for it is clear), 0 will be returned. + */ +static inline u8 +ieee80211_mle_get_bss_param_ch_cnt(const struct ieee80211_multi_link_elem *mle) +{ +	u16 control = le16_to_cpu(mle->control); +	const u8 *common = mle->variable; + +	/* common points now at the beginning of ieee80211_mle_basic_common_info */ +	common += sizeof(struct ieee80211_mle_basic_common_info); + +	if (!(control & IEEE80211_MLC_BASIC_PRES_BSS_PARAM_CH_CNT)) +		return 0; + +	if (control & IEEE80211_MLC_BASIC_PRES_LINK_ID) +		common += 1; + +	return *common; +} + +/** + * ieee80211_mle_get_eml_sync_delay - returns the medium sync delay + * @data: pointer to the multi link EHT IE + * + * The element is assumed to be of the correct type (BASIC) and big enough, + * this must be checked using ieee80211_mle_type_ok(). + * + * If the medium synchronization is not present, then the default value is + * returned. + */ +static inline u16 ieee80211_mle_get_eml_med_sync_delay(const u8 *data) +{ +	const struct ieee80211_multi_link_elem *mle = (const void *)data; +	u16 control = le16_to_cpu(mle->control); +	const u8 *common = mle->variable; + +	/* common points now at the beginning of ieee80211_mle_basic_common_info */ +	common += sizeof(struct ieee80211_mle_basic_common_info); + +	if (!(control & IEEE80211_MLC_BASIC_PRES_MED_SYNC_DELAY)) +		return IEEE80211_MED_SYNC_DELAY_DEFAULT; + +	if (control & IEEE80211_MLC_BASIC_PRES_LINK_ID) +		common += 1; +	if (control & IEEE80211_MLC_BASIC_PRES_BSS_PARAM_CH_CNT) +		common += 1; + +	return get_unaligned_le16(common); +} + +/** + * ieee80211_mle_get_eml_cap - returns the EML capability + * @data: pointer to the multi link EHT IE + * + * The element is assumed to be of the correct type (BASIC) and big enough, + * this must be checked using ieee80211_mle_type_ok(). + * + * If the EML capability is not present, 0 will be returned. + */ +static inline u16 ieee80211_mle_get_eml_cap(const u8 *data) +{ +	const struct ieee80211_multi_link_elem *mle = (const void *)data; +	u16 control = le16_to_cpu(mle->control); +	const u8 *common = mle->variable; + +	/* common points now at the beginning of ieee80211_mle_basic_common_info */ +	common += sizeof(struct ieee80211_mle_basic_common_info); + +	if (!(control & IEEE80211_MLC_BASIC_PRES_EML_CAPA)) +		return 0; + +	if (control & IEEE80211_MLC_BASIC_PRES_LINK_ID) +		common += 1; +	if (control & IEEE80211_MLC_BASIC_PRES_BSS_PARAM_CH_CNT) +		common += 1; +	if (control & IEEE80211_MLC_BASIC_PRES_MED_SYNC_DELAY) +		common += 2; + +	return get_unaligned_le16(common); +} + +/**   * ieee80211_mle_size_ok - validate multi-link element size   * @data: pointer to the element data   * @len: length of the containing element @@ -4700,6 +4849,28 @@ static inline bool ieee80211_mle_size_ok(const u8 *data, size_t len)  	return mle->variable[0] >= common;  } +/** + * ieee80211_mle_type_ok - validate multi-link element type and size + * @data: pointer to the element data + * @type: expected type of the element + * @len: length of the containing element + */ +static inline bool ieee80211_mle_type_ok(const u8 *data, u8 type, size_t len) +{ +	const struct ieee80211_multi_link_elem *mle = (const void *)data; +	u16 control; + +	if (!ieee80211_mle_size_ok(data, len)) +		return false; + +	control = le16_to_cpu(mle->control); + +	if (u16_get_bits(control, IEEE80211_ML_CONTROL_TYPE) == type) +		return true; + +	return false; +} +  enum ieee80211_mle_subelems {  	IEEE80211_MLE_SUBELEM_PER_STA_PROFILE		= 0,  	IEEE80211_MLE_SUBELEM_FRAGMENT		        = 254, @@ -4722,11 +4893,13 @@ struct ieee80211_mle_per_sta_profile {  } __packed;  /** - * ieee80211_mle_sta_prof_size_ok - validate multi-link element sta profile size + * ieee80211_mle_basic_sta_prof_size_ok - validate basic multi-link element sta + *	profile size   * @data: pointer to the sub element data   * @len: length of the containing sub element   */ -static inline bool ieee80211_mle_sta_prof_size_ok(const u8 *data, size_t len) +static inline bool ieee80211_mle_basic_sta_prof_size_ok(const u8 *data, +							size_t len)  {  	const struct ieee80211_mle_per_sta_profile *prof = (const void *)data;  	u16 control; @@ -4746,21 +4919,93 @@ static inline bool ieee80211_mle_sta_prof_size_ok(const u8 *data, size_t len)  		info_len += 8;  	if (control & IEEE80211_MLE_STA_CONTROL_DTIM_INFO_PRESENT)  		info_len += 2; -	if (control & IEEE80211_MLE_STA_CONTROL_BSS_PARAM_CHANGE_CNT_PRESENT) -		info_len += 1; -  	if (control & IEEE80211_MLE_STA_CONTROL_COMPLETE_PROFILE && -	    control & IEEE80211_MLE_STA_CONTROL_NSTR_BITMAP_SIZE) { +	    control & IEEE80211_MLE_STA_CONTROL_NSTR_LINK_PAIR_PRESENT) {  		if (control & IEEE80211_MLE_STA_CONTROL_NSTR_BITMAP_SIZE)  			info_len += 2;  		else  			info_len += 1;  	} +	if (control & IEEE80211_MLE_STA_CONTROL_BSS_PARAM_CHANGE_CNT_PRESENT) +		info_len += 1;  	return prof->sta_info_len >= info_len &&  	       fixed + prof->sta_info_len <= len;  } +/** + * ieee80211_mle_basic_sta_prof_bss_param_ch_cnt - get per-STA profile BSS + *	parameter change count + * @prof: the per-STA profile, having been checked with + *	ieee80211_mle_basic_sta_prof_size_ok() for the correct length + * + * Return: The BSS parameter change count value if present, 0 otherwise. + */ +static inline u8 +ieee80211_mle_basic_sta_prof_bss_param_ch_cnt(const struct ieee80211_mle_per_sta_profile *prof) +{ +	u16 control = le16_to_cpu(prof->control); +	const u8 *pos = prof->variable; + +	if (!(control & IEEE80211_MLE_STA_CONTROL_BSS_PARAM_CHANGE_CNT_PRESENT)) +		return 0; + +	if (control & IEEE80211_MLE_STA_CONTROL_STA_MAC_ADDR_PRESENT) +		pos += 6; +	if (control & IEEE80211_MLE_STA_CONTROL_BEACON_INT_PRESENT) +		pos += 2; +	if (control & IEEE80211_MLE_STA_CONTROL_TSF_OFFS_PRESENT) +		pos += 8; +	if (control & IEEE80211_MLE_STA_CONTROL_DTIM_INFO_PRESENT) +		pos += 2; +	if (control & IEEE80211_MLE_STA_CONTROL_COMPLETE_PROFILE && +	    control & IEEE80211_MLE_STA_CONTROL_NSTR_LINK_PAIR_PRESENT) { +		if (control & IEEE80211_MLE_STA_CONTROL_NSTR_BITMAP_SIZE) +			pos += 2; +		else +			pos += 1; +	} + +	return *pos; +} + +#define IEEE80211_MLE_STA_RECONF_CONTROL_LINK_ID			0x000f +#define IEEE80211_MLE_STA_RECONF_CONTROL_COMPLETE_PROFILE		0x0010 +#define IEEE80211_MLE_STA_RECONF_CONTROL_STA_MAC_ADDR_PRESENT		0x0020 +#define IEEE80211_MLE_STA_RECONF_CONTROL_AP_REM_TIMER_PRESENT		0x0040 +#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_UPDATE_TYPE		0x0780 +#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_PARAMS_PRESENT	0x0800 + +/** + * ieee80211_mle_reconf_sta_prof_size_ok - validate reconfiguration multi-link + *	element sta profile size. + * @data: pointer to the sub element data + * @len: length of the containing sub element + */ +static inline bool ieee80211_mle_reconf_sta_prof_size_ok(const u8 *data, +							 size_t len) +{ +	const struct ieee80211_mle_per_sta_profile *prof = (const void *)data; +	u16 control; +	u8 fixed = sizeof(*prof); +	u8 info_len = 1; + +	if (len < fixed) +		return false; + +	control = le16_to_cpu(prof->control); + +	if (control & IEEE80211_MLE_STA_RECONF_CONTROL_STA_MAC_ADDR_PRESENT) +		info_len += ETH_ALEN; +	if (control & IEEE80211_MLE_STA_RECONF_CONTROL_AP_REM_TIMER_PRESENT) +		info_len += 2; +	if (control & IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_PARAMS_PRESENT) +		info_len += 2; + +	return prof->sta_info_len >= info_len && +	       fixed + prof->sta_info_len - 1 <= len; +} +  #define for_each_mle_subelement(_elem, _data, _len)			\  	if (ieee80211_mle_size_ok(_data, _len))				\  		for_each_element(_elem,					\ diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index f5f3ee57bc70..607c3a89a647 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h @@ -22,6 +22,7 @@  #include <linux/platform_data/st_sensors_pdata.h>  #define LSM9DS0_IMU_DEV_NAME		"lsm9ds0" +#define LSM303D_IMU_DEV_NAME		"lsm303d"  /*   * Buffer size max case: 2bytes per channel, 3 channels in total + diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index d28a5e8097e4..202e55b0a28b 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -221,6 +221,9 @@ struct iio_event_spec {   * @extend_name:	Allows labeling of channel attributes with an   *			informative name. Note this has no effect codes etc,   *			unlike modifiers. + *			This field is deprecated in favour of providing + *			iio_info->read_label() to override the label, which + *			unlike @extend_name does not affect sysfs filenames.   * @datasheet_name:	A name used in in-kernel mapping of channels. It should   *			correspond to the first name that the channel is referred   *			to by in the datasheet (e.g. IND), or the nearest diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index 51f52c5c6092..bce3b1788199 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h @@ -171,6 +171,7 @@ void iio_trigger_free(struct iio_trigger *trig);   */  bool iio_trigger_using_own(struct iio_dev *indio_dev); +int iio_validate_own_trigger(struct iio_dev *idev, struct iio_trigger *trig);  int iio_trigger_validate_own_device(struct iio_trigger *trig,  				     struct iio_dev *indio_dev); diff --git a/include/linux/interconnect-clk.h b/include/linux/interconnect-clk.h new file mode 100644 index 000000000000..0cd80112bea5 --- /dev/null +++ b/include/linux/interconnect-clk.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2023, Linaro Ltd. + */ + +#ifndef __LINUX_INTERCONNECT_CLK_H +#define __LINUX_INTERCONNECT_CLK_H + +struct device; + +struct icc_clk_data { +	struct clk *clk; +	const char *name; +}; + +struct icc_provider *icc_clk_register(struct device *dev, +				      unsigned int first_id, +				      unsigned int num_clocks, +				      const struct icc_clk_data *data); +void icc_clk_unregister(struct icc_provider *provider); + +#endif diff --git a/include/linux/interconnect.h b/include/linux/interconnect.h index 2b0e784ba771..97ac253df62c 100644 --- a/include/linux/interconnect.h +++ b/include/linux/interconnect.h @@ -40,8 +40,6 @@ struct icc_bulk_data {  #if IS_ENABLED(CONFIG_INTERCONNECT) -struct icc_path *icc_get(struct device *dev, const int src_id, -			 const int dst_id);  struct icc_path *of_icc_get(struct device *dev, const char *name);  struct icc_path *devm_of_icc_get(struct device *dev, const char *name);  int devm_of_icc_bulk_get(struct device *dev, int num_paths, struct icc_bulk_data *paths); @@ -61,12 +59,6 @@ void icc_bulk_disable(int num_paths, const struct icc_bulk_data *paths);  #else -static inline struct icc_path *icc_get(struct device *dev, const int src_id, -				       const int dst_id) -{ -	return NULL; -} -  static inline struct icc_path *of_icc_get(struct device *dev,  					  const char *name)  { diff --git a/include/linux/iommu.h b/include/linux/iommu.h index e8c9a7da1060..d31642596675 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -65,6 +65,7 @@ struct iommu_domain_geometry {  #define __IOMMU_DOMAIN_SVA	(1U << 4)  /* Shared process address space */ +#define IOMMU_DOMAIN_ALLOC_FLAGS ~__IOMMU_DOMAIN_DMA_FQ  /*   * This are the possible domain-types   * @@ -127,6 +128,11 @@ enum iommu_cap {  	 * this device.  	 */  	IOMMU_CAP_ENFORCE_CACHE_COHERENCY, +	/* +	 * IOMMU driver does not issue TLB maintenance during .unmap, so can +	 * usefully support the non-strict DMA flush queue. +	 */ +	IOMMU_CAP_DEFERRED_FLUSH,  };  /* These are the possible reserved region types */ diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index 2c8860e406bd..19a7b00baff4 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h @@ -53,6 +53,7 @@  		} \  		if (__sleep_us) \  			usleep_range((__sleep_us >> 2) + 1, __sleep_us); \ +		cpu_relax(); \  	} \  	(cond) ? 0 : -ETIMEDOUT; \  }) @@ -73,6 +74,10 @@   * Returns 0 on success and -ETIMEDOUT upon a timeout. In either   * case, the last read value at @args is stored in @val.   * + * This macro does not rely on timekeeping.  Hence it is safe to call even when + * timekeeping is suspended, at the expense of an underestimation of wall clock + * time, which is rather minimal with a non-zero delay_us. + *   * When available, you'll probably want to use one of the specialized   * macros defined below rather than this macro directly.   */ @@ -80,21 +85,30 @@  					delay_before_read, args...) \  ({ \  	u64 __timeout_us = (timeout_us); \ +	s64 __left_ns = __timeout_us * NSEC_PER_USEC; \  	unsigned long __delay_us = (delay_us); \ -	ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \ -	if (delay_before_read && __delay_us) \ +	u64 __delay_ns = __delay_us * NSEC_PER_USEC; \ +	if (delay_before_read && __delay_us) { \  		udelay(__delay_us); \ +		if (__timeout_us) \ +			__left_ns -= __delay_ns; \ +	} \  	for (;;) { \  		(val) = op(args); \  		if (cond) \  			break; \ -		if (__timeout_us && \ -		    ktime_compare(ktime_get(), __timeout) > 0) { \ +		if (__timeout_us && __left_ns < 0) { \  			(val) = op(args); \  			break; \  		} \ -		if (__delay_us) \ +		if (__delay_us) { \  			udelay(__delay_us); \ +			if (__timeout_us) \ +				__left_ns -= __delay_ns; \ +		} \ +		cpu_relax(); \ +		if (__timeout_us) \ +			__left_ns--; \  	} \  	(cond) ? 0 : -ETIMEDOUT; \  }) diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index f619bae1dcc5..d860499e15e4 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -265,8 +265,10 @@ typedef struct journal_superblock_s  	__u8	s_padding2[3];  /* 0x0054 */  	__be32	s_num_fc_blks;		/* Number of fast commit blocks */ -/* 0x0058 */ -	__u32	s_padding[41]; +	__be32	s_head;			/* blocknr of head of log, only uptodate +					 * while the filesystem is clean */ +/* 0x005C */ +	__u32	s_padding[40];  	__be32	s_checksum;		/* crc32c(superblock) */  /* 0x0100 */ @@ -274,17 +276,6 @@ typedef struct journal_superblock_s  /* 0x0400 */  } journal_superblock_t; -/* Use the jbd2_{has,set,clear}_feature_* helpers; these will be removed */ -#define JBD2_HAS_COMPAT_FEATURE(j,mask)					\ -	((j)->j_format_version >= 2 &&					\ -	 ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask)))) -#define JBD2_HAS_RO_COMPAT_FEATURE(j,mask)				\ -	((j)->j_format_version >= 2 &&					\ -	 ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask)))) -#define JBD2_HAS_INCOMPAT_FEATURE(j,mask)				\ -	((j)->j_format_version >= 2 &&					\ -	 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) -  #define JBD2_FEATURE_COMPAT_CHECKSUM		0x00000001  #define JBD2_FEATURE_INCOMPAT_REVOKE		0x00000001 @@ -804,11 +795,6 @@ struct journal_s  	journal_superblock_t	*j_superblock;  	/** -	 * @j_format_version: Version of the superblock format. -	 */ -	int			j_format_version; - -	/**  	 * @j_state_lock: Protect the various scalars in the journal.  	 */  	rwlock_t		j_state_lock; @@ -1324,11 +1310,22 @@ struct journal_s  		rwsem_release(&j->j_trans_commit_map, _THIS_IP_); \  	} while (0) +/* + * We can support any known requested features iff the + * superblock is not in version 1.  Otherwise we fail to support any + * extended sb features. + */ +static inline bool jbd2_format_support_feature(journal_t *j) +{ +	return j->j_superblock->s_header.h_blocktype != +					cpu_to_be32(JBD2_SUPERBLOCK_V1); +} +  /* journal feature predicate functions */  #define JBD2_FEATURE_COMPAT_FUNCS(name, flagname) \  static inline bool jbd2_has_feature_##name(journal_t *j) \  { \ -	return ((j)->j_format_version >= 2 && \ +	return (jbd2_format_support_feature(j) && \  		((j)->j_superblock->s_feature_compat & \  		 cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname)) != 0); \  } \ @@ -1346,7 +1343,7 @@ static inline void jbd2_clear_feature_##name(journal_t *j) \  #define JBD2_FEATURE_RO_COMPAT_FUNCS(name, flagname) \  static inline bool jbd2_has_feature_##name(journal_t *j) \  { \ -	return ((j)->j_format_version >= 2 && \ +	return (jbd2_format_support_feature(j) && \  		((j)->j_superblock->s_feature_ro_compat & \  		 cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname)) != 0); \  } \ @@ -1364,7 +1361,7 @@ static inline void jbd2_clear_feature_##name(journal_t *j) \  #define JBD2_FEATURE_INCOMPAT_FUNCS(name, flagname) \  static inline bool jbd2_has_feature_##name(journal_t *j) \  { \ -	return ((j)->j_format_version >= 2 && \ +	return (jbd2_format_support_feature(j) && \  		((j)->j_superblock->s_feature_incompat & \  		 cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname)) != 0); \  } \ @@ -1400,6 +1397,9 @@ JBD2_FEATURE_INCOMPAT_FUNCS(fast_commit,	FAST_COMMIT)  #define JBD2_ABORT_ON_SYNCDATA_ERR	0x040	/* Abort the journal on file  						 * data write error in ordered  						 * mode */ +#define JBD2_CYCLE_RECORD		0x080	/* Journal cycled record log on +						 * clean and empty filesystem +						 * logging area */  #define JBD2_FAST_COMMIT_ONGOING	0x100	/* Fast commit is ongoing */  #define JBD2_FULL_COMMIT_ONGOING	0x200	/* Full commit is ongoing */  #define JBD2_JOURNAL_FLUSH_DISCARD	0x0001 diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index fe3c9993b5bf..c3f075e8f60c 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -65,6 +65,9 @@ static inline void *dereference_symbol_descriptor(void *ptr)  	return ptr;  } +/* How and when do we show kallsyms values? */ +extern bool kallsyms_show_value(const struct cred *cred); +  #ifdef CONFIG_KALLSYMS  unsigned long kallsyms_sym_address(int idx);  int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long), @@ -93,10 +96,6 @@ extern int sprint_backtrace(char *buffer, unsigned long address);  extern int sprint_backtrace_build_id(char *buffer, unsigned long address);  int lookup_symbol_name(unsigned long addr, char *symname); -int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); - -/* How and when do we show kallsyms values? */ -extern bool kallsyms_show_value(const struct cred *cred);  #else /* !CONFIG_KALLSYMS */ @@ -155,16 +154,6 @@ static inline int lookup_symbol_name(unsigned long addr, char *symname)  	return -ERANGE;  } -static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name) -{ -	return -ERANGE; -} - -static inline bool kallsyms_show_value(const struct cred *cred) -{ -	return false; -} -  static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long),  					  void *data)  { diff --git a/include/linux/kdb.h b/include/linux/kdb.h index 07dfb6a20a1c..f6c2ddb16b95 100644 --- a/include/linux/kdb.h +++ b/include/linux/kdb.h @@ -196,6 +196,8 @@ int kdb_process_cpu(const struct task_struct *p)  	return cpu;  } +extern void kdb_send_sig(struct task_struct *p, int sig); +  #ifdef CONFIG_KALLSYMS  extern const char *kdb_walk_kallsyms(loff_t *pos);  #else /* ! CONFIG_KALLSYMS */ diff --git a/include/linux/key.h b/include/linux/key.h index 8dc7f7c3088b..938d7ecfb495 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -490,9 +490,6 @@ do {									\  	rcu_assign_pointer((KEY)->payload.rcu_data0, (PAYLOAD));	\  } while (0) -#ifdef CONFIG_SYSCTL -extern struct ctl_table key_sysctls[]; -#endif  /*   * the userspace interface   */ diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 258cdde8d356..76e891ee9e37 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h @@ -365,5 +365,6 @@ extern void kgdb_free_init_mem(void);  #define dbg_late_init()  static inline void kgdb_panic(const char *msg) {}  static inline void kgdb_free_init_mem(void) { } +static inline int kgdb_nmicallback(int cpu, void *regs) { return 1; }  #endif /* ! CONFIG_KGDB */  #endif /* _KGDB_H_ */ diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 0e571e973bc2..9d3ac7720da9 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -849,7 +849,7 @@ static inline void kvm_vm_bugged(struct kvm *kvm)  #define KVM_BUG(cond, kvm, fmt...)				\  ({								\ -	int __ret = (cond);					\ +	bool __ret = !!(cond);					\  								\  	if (WARN_ONCE(__ret && !(kvm)->vm_bugged, fmt))		\  		kvm_vm_bugged(kvm);				\ @@ -858,7 +858,7 @@ static inline void kvm_vm_bugged(struct kvm *kvm)  #define KVM_BUG_ON(cond, kvm)					\  ({								\ -	int __ret = (cond);					\ +	bool __ret = !!(cond);					\  								\  	if (WARN_ON_ONCE(__ret && !(kvm)->vm_bugged))		\  		kvm_vm_bugged(kvm);				\ @@ -991,6 +991,8 @@ static inline bool kvm_memslots_empty(struct kvm_memslots *slots)  	return RB_EMPTY_ROOT(&slots->gfn_tree);  } +bool kvm_are_all_memslots_empty(struct kvm *kvm); +  #define kvm_for_each_memslot(memslot, bkt, slots)			      \  	hash_for_each(slots->id_hash, bkt, memslot, id_node[slots->node_idx]) \  		if (WARN_ON_ONCE(!memslot->npages)) {			      \ @@ -2237,9 +2239,6 @@ static inline long kvm_arch_vcpu_async_ioctl(struct file *filp,  }  #endif /* CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL */ -void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, -					    unsigned long start, unsigned long end); -  void kvm_arch_guest_memory_reclaimed(struct kvm *kvm);  #ifdef CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE diff --git a/include/linux/leds.h b/include/linux/leds.h index c39bbf17a25b..7d428100b42b 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -124,6 +124,10 @@ struct led_classdev {  #define LED_BLINK_INVERT		3  #define LED_BLINK_BRIGHTNESS_CHANGE 	4  #define LED_BLINK_DISABLE		5 +	/* Brightness off also disables hw-blinking so it is a separate action */ +#define LED_SET_BRIGHTNESS_OFF		6 +#define LED_SET_BRIGHTNESS		7 +#define LED_SET_BLINK			8  	/* Set LED brightness level  	 * Must not sleep. Use brightness_set_blocking for drivers @@ -147,6 +151,10 @@ struct led_classdev {  	 * match the values specified exactly.  	 * Deactivate blinking again when the brightness is set to LED_OFF  	 * via the brightness_set() callback. +	 * For led_blink_set_nosleep() the LED core assumes that blink_set +	 * implementations, of drivers which do not use brightness_set_blocking, +	 * will not sleep. Therefor if brightness_set_blocking is not set +	 * this function must not sleep!  	 */  	int		(*blink_set)(struct led_classdev *led_cdev,  				     unsigned long *delay_on, @@ -170,6 +178,8 @@ struct led_classdev {  	struct work_struct	set_brightness_work;  	int			delayed_set_value; +	unsigned long		delayed_delay_on; +	unsigned long		delayed_delay_off;  #ifdef CONFIG_LEDS_TRIGGERS  	/* Protects the trigger data below */ @@ -183,6 +193,49 @@ struct led_classdev {  	/* LEDs that have private triggers have this set */  	struct led_hw_trigger_type	*trigger_type; + +	/* Unique trigger name supported by LED set in hw control mode */ +	const char		*hw_control_trigger; +	/* +	 * Check if the LED driver supports the requested mode provided by the +	 * defined supported trigger to setup the LED to hw control mode. +	 * +	 * Return 0 on success. Return -EOPNOTSUPP when the passed flags are not +	 * supported and software fallback needs to be used. +	 * Return a negative error number on any other case  for check fail due +	 * to various reason like device not ready or timeouts. +	 */ +	int			(*hw_control_is_supported)(struct led_classdev *led_cdev, +							   unsigned long flags); +	/* +	 * Activate hardware control, LED driver will use the provided flags +	 * from the supported trigger and setup the LED to be driven by hardware +	 * following the requested mode from the trigger flags. +	 * Deactivate hardware blink control by setting brightness to LED_OFF via +	 * the brightness_set() callback. +	 * +	 * Return 0 on success, a negative error number on flags apply fail. +	 */ +	int			(*hw_control_set)(struct led_classdev *led_cdev, +						  unsigned long flags); +	/* +	 * Get from the LED driver the current mode that the LED is set in hw +	 * control mode and put them in flags. +	 * Trigger can use this to get the initial state of a LED already set in +	 * hardware blink control. +	 * +	 * Return 0 on success, a negative error number on failing parsing the +	 * initial mode. Error from this function is NOT FATAL as the device +	 * may be in a not supported initial state by the attached LED trigger. +	 */ +	int			(*hw_control_get)(struct led_classdev *led_cdev, +						  unsigned long *flags); +	/* +	 * Get the device this LED blinks in response to. +	 * e.g. for a PHY LED, it is the network device. If the LED is +	 * not yet associated to a device, return NULL. +	 */ +	struct device		*(*hw_control_get_device)(struct led_classdev *led_cdev);  #endif  #ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED @@ -272,12 +325,27 @@ struct led_classdev *__must_check devm_of_led_get(struct device *dev,   * software blinking if there is no hardware blinking or if   * the LED refuses the passed values.   * + * This function may sleep! + *   * Note that if software blinking is active, simply calling   * led_cdev->brightness_set() will not stop the blinking,   * use led_set_brightness() instead.   */  void led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on,  		   unsigned long *delay_off); + +/** + * led_blink_set_nosleep - set blinking, guaranteed to not sleep + * @led_cdev: the LED to start blinking + * @delay_on: the time it should be on (in ms) + * @delay_off: the time it should ble off (in ms) + * + * This function makes the LED blink and is guaranteed to not sleep. Otherwise + * this is the same as led_blink_set(), see led_blink_set() for details. + */ +void led_blink_set_nosleep(struct led_classdev *led_cdev, unsigned long delay_on, +			   unsigned long delay_off); +  /**   * led_blink_set_oneshot - do a oneshot software blink   * @led_cdev: the LED to start blinking @@ -291,6 +359,8 @@ void led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on,   *   * If invert is set, led blinks for delay_off first, then for   * delay_on and leave the led on after the on-off cycle. + * + * This function is guaranteed not to sleep.   */  void led_blink_set_oneshot(struct led_classdev *led_cdev,  			   unsigned long *delay_on, unsigned long *delay_off, @@ -433,11 +503,11 @@ void led_trigger_register_simple(const char *name,  				struct led_trigger **trigger);  void led_trigger_unregister_simple(struct led_trigger *trigger);  void led_trigger_event(struct led_trigger *trigger,  enum led_brightness event); -void led_trigger_blink(struct led_trigger *trigger, unsigned long *delay_on, -		       unsigned long *delay_off); +void led_trigger_blink(struct led_trigger *trigger, unsigned long delay_on, +		       unsigned long delay_off);  void led_trigger_blink_oneshot(struct led_trigger *trigger, -			       unsigned long *delay_on, -			       unsigned long *delay_off, +			       unsigned long delay_on, +			       unsigned long delay_off,  			       int invert);  void led_trigger_set_default(struct led_classdev *led_cdev);  int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger); @@ -487,11 +557,11 @@ static inline void led_trigger_unregister_simple(struct led_trigger *trigger) {}  static inline void led_trigger_event(struct led_trigger *trigger,  				enum led_brightness event) {}  static inline void led_trigger_blink(struct led_trigger *trigger, -				      unsigned long *delay_on, -				      unsigned long *delay_off) {} +				      unsigned long delay_on, +				      unsigned long delay_off) {}  static inline void led_trigger_blink_oneshot(struct led_trigger *trigger, -				      unsigned long *delay_on, -				      unsigned long *delay_off, +				      unsigned long delay_on, +				      unsigned long delay_off,  				      int invert) {}  static inline void led_trigger_set_default(struct led_classdev *led_cdev) {}  static inline int led_trigger_set(struct led_classdev *led_cdev, @@ -509,6 +579,21 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev)  #endif /* CONFIG_LEDS_TRIGGERS */ +/* Trigger specific enum */ +enum led_trigger_netdev_modes { +	TRIGGER_NETDEV_LINK = 0, +	TRIGGER_NETDEV_LINK_10, +	TRIGGER_NETDEV_LINK_100, +	TRIGGER_NETDEV_LINK_1000, +	TRIGGER_NETDEV_HALF_DUPLEX, +	TRIGGER_NETDEV_FULL_DUPLEX, +	TRIGGER_NETDEV_TX, +	TRIGGER_NETDEV_RX, + +	/* Keep last */ +	__TRIGGER_NETDEV_MAX, +}; +  /* Trigger specific functions */  #ifdef CONFIG_LEDS_TRIGGER_DISK  void ledtrig_disk_activity(bool write); diff --git a/include/linux/libata.h b/include/linux/libata.h index dd5797fb6305..820f7a3a2749 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -94,17 +94,19 @@ enum {  	ATA_DFLAG_DMADIR	= (1 << 10), /* device requires DMADIR */  	ATA_DFLAG_NCQ_SEND_RECV = (1 << 11), /* device supports NCQ SEND and RECV */  	ATA_DFLAG_NCQ_PRIO	= (1 << 12), /* device supports NCQ priority */ -	ATA_DFLAG_CFG_MASK	= (1 << 13) - 1, - -	ATA_DFLAG_PIO		= (1 << 13), /* device limited to PIO mode */ -	ATA_DFLAG_NCQ_OFF	= (1 << 14), /* device limited to non-NCQ mode */ -	ATA_DFLAG_SLEEPING	= (1 << 15), /* device is sleeping */ -	ATA_DFLAG_DUBIOUS_XFER	= (1 << 16), /* data transfer not verified */ -	ATA_DFLAG_NO_UNLOAD	= (1 << 17), /* device doesn't support unload */ -	ATA_DFLAG_UNLOCK_HPA	= (1 << 18), /* unlock HPA */ -	ATA_DFLAG_INIT_MASK	= (1 << 19) - 1, - -	ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 19), /* Priority cmds sent to dev */ +	ATA_DFLAG_CDL		= (1 << 13), /* supports cmd duration limits */ +	ATA_DFLAG_CFG_MASK	= (1 << 14) - 1, + +	ATA_DFLAG_PIO		= (1 << 14), /* device limited to PIO mode */ +	ATA_DFLAG_NCQ_OFF	= (1 << 15), /* device limited to non-NCQ mode */ +	ATA_DFLAG_SLEEPING	= (1 << 16), /* device is sleeping */ +	ATA_DFLAG_DUBIOUS_XFER	= (1 << 17), /* data transfer not verified */ +	ATA_DFLAG_NO_UNLOAD	= (1 << 18), /* device doesn't support unload */ +	ATA_DFLAG_UNLOCK_HPA	= (1 << 19), /* unlock HPA */ +	ATA_DFLAG_INIT_MASK	= (1 << 20) - 1, + +	ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 20), /* Priority cmds sent to dev */ +	ATA_DFLAG_CDL_ENABLED	= (1 << 21), /* cmd duration limits is enabled */  	ATA_DFLAG_DETACH	= (1 << 24),  	ATA_DFLAG_DETACHED	= (1 << 25),  	ATA_DFLAG_DA		= (1 << 26), /* device supports Device Attention */ @@ -115,7 +117,8 @@ enum {  	ATA_DFLAG_FEATURES_MASK	= (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA |	\  				   ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \ -				   ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA), +				   ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA | \ +				   ATA_DFLAG_CDL),  	ATA_DEV_UNKNOWN		= 0,	/* unknown device */  	ATA_DEV_ATA		= 1,	/* ATA device */ @@ -206,10 +209,12 @@ enum {  	ATA_QCFLAG_CLEAR_EXCL	= (1 << 5), /* clear excl_link on completion */  	ATA_QCFLAG_QUIET	= (1 << 6), /* don't report device error */  	ATA_QCFLAG_RETRY	= (1 << 7), /* retry after failure */ +	ATA_QCFLAG_HAS_CDL	= (1 << 8), /* qc has CDL a descriptor set */  	ATA_QCFLAG_EH		= (1 << 16), /* cmd aborted and owned by EH */  	ATA_QCFLAG_SENSE_VALID	= (1 << 17), /* sense data valid */  	ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ +	ATA_QCFLAG_EH_SUCCESS_CMD = (1 << 19), /* EH should fetch sense for this successful cmd */  	/* host set flags */  	ATA_HOST_SIMPLEX	= (1 << 0),	/* Host is simplex, one DMA channel per host only */ @@ -308,8 +313,10 @@ enum {  	ATA_EH_RESET		= ATA_EH_SOFTRESET | ATA_EH_HARDRESET,  	ATA_EH_ENABLE_LINK	= (1 << 3),  	ATA_EH_PARK		= (1 << 5), /* unload heads and stop I/O */ +	ATA_EH_GET_SUCCESS_SENSE = (1 << 6), /* Get sense data for successful cmd */ -	ATA_EH_PERDEV_MASK	= ATA_EH_REVALIDATE | ATA_EH_PARK, +	ATA_EH_PERDEV_MASK	= ATA_EH_REVALIDATE | ATA_EH_PARK | +				  ATA_EH_GET_SUCCESS_SENSE,  	ATA_EH_ALL_ACTIONS	= ATA_EH_REVALIDATE | ATA_EH_RESET |  				  ATA_EH_ENABLE_LINK, @@ -709,6 +716,9 @@ struct ata_device {  	/* Concurrent positioning ranges */  	struct ata_cpr_log	*cpr_log; +	/* Command Duration Limits log support */ +	u8			cdl[ATA_LOG_CDL_SIZE]; +  	/* error history */  	int			spdn_cnt;  	/* ering is CLEAR_END, read comment above CLEAR_END */ @@ -860,6 +870,7 @@ struct ata_port {  	struct ata_acpi_gtm	__acpi_init_gtm; /* use ata_acpi_init_gtm() */  #endif  	/* owned by EH */ +	u8			*ncq_sense_buf;  	u8			sector_buf[ATA_SECT_SIZE] ____cacheline_aligned;  }; @@ -1144,8 +1155,8 @@ extern int ata_scsi_slave_config(struct scsi_device *sdev);  extern void ata_scsi_slave_destroy(struct scsi_device *sdev);  extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,  				       int queue_depth); -extern int ata_change_queue_depth(struct ata_port *ap, struct ata_device *dev, -				  struct scsi_device *sdev, int queue_depth); +extern int ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, +				  int queue_depth);  extern struct ata_device *ata_dev_pair(struct ata_device *adev);  extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);  extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); @@ -1178,6 +1189,7 @@ extern int sata_link_hardreset(struct ata_link *link,  			bool *online, int (*check_ready)(struct ata_link *));  extern int sata_link_resume(struct ata_link *link, const unsigned long *params,  			    unsigned long deadline); +extern int ata_eh_read_sense_success_ncq_log(struct ata_link *link);  extern void ata_eh_analyze_ncq_error(struct ata_link *link);  #else  static inline const unsigned long * @@ -1215,6 +1227,10 @@ static inline int sata_link_resume(struct ata_link *link,  {  	return -EOPNOTSUPP;  } +static inline int ata_eh_read_sense_success_ncq_log(struct ata_link *link) +{ +	return -EOPNOTSUPP; +}  static inline void ata_eh_analyze_ncq_error(struct ata_link *link) { }  #endif  extern int sata_link_debounce(struct ata_link *link, @@ -1276,7 +1292,7 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);  struct platform_device; -extern int ata_platform_remove_one(struct platform_device *pdev); +extern void ata_platform_remove_one(struct platform_device *pdev);  /*   * ACPI - drivers/ata/libata-acpi.c diff --git a/include/linux/libps2.h b/include/linux/libps2.h index 53f7e4d0f4b7..9ca9ce4e6e64 100644 --- a/include/linux/libps2.h +++ b/include/linux/libps2.h @@ -8,44 +8,59 @@   */  #include <linux/bitops.h> +#include <linux/interrupt.h>  #include <linux/mutex.h>  #include <linux/types.h>  #include <linux/wait.h> -#define PS2_CMD_SETSCALE11	0x00e6 -#define PS2_CMD_SETRES		0x10e8 -#define PS2_CMD_GETID		0x02f2 -#define PS2_CMD_RESET_BAT	0x02ff +struct ps2dev; -#define PS2_RET_BAT		0xaa -#define PS2_RET_ID		0x00 -#define PS2_RET_ACK		0xfa -#define PS2_RET_NAK		0xfe -#define PS2_RET_ERR		0xfc +/** + * enum ps2_disposition - indicates how received byte should be handled + * @PS2_PROCESS: pass to the main protocol handler, process normally + * @PS2_IGNORE: skip the byte + * @PS2_ERROR: do not process the byte, abort command in progress + */ +enum ps2_disposition { +	PS2_PROCESS, +	PS2_IGNORE, +	PS2_ERROR, +}; -#define PS2_FLAG_ACK		BIT(0)	/* Waiting for ACK/NAK */ -#define PS2_FLAG_CMD		BIT(1)	/* Waiting for a command to finish */ -#define PS2_FLAG_CMD1		BIT(2)	/* Waiting for the first byte of command response */ -#define PS2_FLAG_WAITID		BIT(3)	/* Command executing is GET ID */ -#define PS2_FLAG_NAK		BIT(4)	/* Last transmission was NAKed */ -#define PS2_FLAG_ACK_CMD	BIT(5)	/* Waiting to ACK the command (first) byte */ +typedef enum ps2_disposition (*ps2_pre_receive_handler_t)(struct ps2dev *, u8, +							  unsigned int); +typedef void (*ps2_receive_handler_t)(struct ps2dev *, u8); +/** + * struct ps2dev - represents a device using PS/2 protocol + * @serio: a serio port used by the PS/2 device + * @cmd_mutex: a mutex ensuring that only one command is executing at a time + * @wait: a waitqueue used to signal completion from the serio interrupt handler + * @flags: various internal flags indicating stages of PS/2 command execution + * @cmdbuf: buffer holding command response + * @cmdcnt: outstanding number of bytes of the command response + * @nak: a byte transmitted by the device when it refuses command + * @pre_receive_handler: checks communication errors and returns disposition + * (&enum ps2_disposition) of the received data byte + * @receive_handler: main handler of particular PS/2 protocol, such as keyboard + *   or mouse protocol + */  struct ps2dev {  	struct serio *serio; - -	/* Ensures that only one command is executing at a time */  	struct mutex cmd_mutex; - -	/* Used to signal completion from interrupt handler */  	wait_queue_head_t wait; -  	unsigned long flags;  	u8 cmdbuf[8];  	u8 cmdcnt;  	u8 nak; + +	ps2_pre_receive_handler_t pre_receive_handler; +	ps2_receive_handler_t receive_handler;  }; -void ps2_init(struct ps2dev *ps2dev, struct serio *serio); +void ps2_init(struct ps2dev *ps2dev, struct serio *serio, +	      ps2_pre_receive_handler_t pre_receive_handler, +	      ps2_receive_handler_t receive_handler);  int ps2_sendbyte(struct ps2dev *ps2dev, u8 byte, unsigned int timeout);  void ps2_drain(struct ps2dev *ps2dev, size_t maxbytes, unsigned int timeout);  void ps2_begin_command(struct ps2dev *ps2dev); @@ -53,9 +68,8 @@ void ps2_end_command(struct ps2dev *ps2dev);  int __ps2_command(struct ps2dev *ps2dev, u8 *param, unsigned int command);  int ps2_command(struct ps2dev *ps2dev, u8 *param, unsigned int command);  int ps2_sliced_command(struct ps2dev *ps2dev, u8 command); -bool ps2_handle_ack(struct ps2dev *ps2dev, u8 data); -bool ps2_handle_response(struct ps2dev *ps2dev, u8 data); -void ps2_cmd_aborted(struct ps2dev *ps2dev);  bool ps2_is_keyboard_id(u8 id); +irqreturn_t ps2_interrupt(struct serio *serio, u8 data, unsigned int flags); +  #endif /* _LIBPS2_H */ diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h index 3bc9f7410e21..c53c81242e72 100644 --- a/include/linux/lockd/bind.h +++ b/include/linux/lockd/bind.h @@ -20,6 +20,7 @@  /* Dummy declarations */  struct svc_rqst;  struct rpc_task; +struct rpc_clnt;  /*   * This is the set of functions for lockd->nfsd communication @@ -56,6 +57,7 @@ struct nlmclnt_initdata {  extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);  extern void	nlmclnt_done(struct nlm_host *host); +extern struct rpc_clnt *nlmclnt_rpc_clnt(struct nlm_host *host);  /*   * NLM client operations provide a means to modify RPC processing of NLM diff --git a/include/linux/mdio.h b/include/linux/mdio.h index 27013d6bf24a..c1b7008826e5 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -106,6 +106,16 @@ int mdio_driver_register(struct mdio_driver *drv);  void mdio_driver_unregister(struct mdio_driver *drv);  int mdio_device_bus_match(struct device *dev, struct device_driver *drv); +static inline void mdio_device_get(struct mdio_device *mdiodev) +{ +	get_device(&mdiodev->dev); +} + +static inline void mdio_device_put(struct mdio_device *mdiodev) +{ +	mdio_device_free(mdiodev); +} +  static inline bool mdio_phy_id_is_c45(int phy_id)  {  	return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK); @@ -486,6 +496,45 @@ static inline u32 linkmode_adv_to_mii_10base_t1_t(unsigned long *adv)  	return result;  } +/** + * mii_c73_mod_linkmode - convert a Clause 73 advertisement to linkmodes + * @adv: linkmode advertisement setting + * @lpa: array of three u16s containing the advertisement + * + * Convert an IEEE 802.3 Clause 73 advertisement to ethtool link modes. + */ +static inline void mii_c73_mod_linkmode(unsigned long *adv, u16 *lpa) +{ +	linkmode_mod_bit(ETHTOOL_LINK_MODE_Pause_BIT, +			 adv, lpa[0] & MDIO_AN_C73_0_PAUSE); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, +			 adv, lpa[0] & MDIO_AN_C73_0_ASM_DIR); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_1000BASE_KX); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_10GBASE_KX4); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_40GBASE_KR4); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_40GBASE_CR4); +	/* 100GBASE_CR10 and 100GBASE_KP4 not implemented */ +	linkmode_mod_bit(ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_100GBASE_KR4); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_100GBASE_CR4); +	/* 25GBASE_R_S not implemented */ +	/* The 25GBASE_R bit can be used for 25Gbase KR or CR modes */ +	linkmode_mod_bit(ETHTOOL_LINK_MODE_25000baseKR_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_25GBASE_R); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_25000baseCR_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_25GBASE_R); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseKR_Full_BIT, +			 adv, lpa[1] & MDIO_AN_C73_1_10GBASE_KR); +	linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, +			 adv, lpa[2] & MDIO_AN_C73_2_2500BASE_KX); +	/* 5GBASE_KR not implemented */ +} +  int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);  int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);  int __mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum, diff --git a/include/linux/mdio/mdio-regmap.h b/include/linux/mdio/mdio-regmap.h new file mode 100644 index 000000000000..679d9069846b --- /dev/null +++ b/include/linux/mdio/mdio-regmap.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Driver for MMIO-Mapped MDIO devices. Some IPs expose internal PHYs or PCS + * within the MMIO-mapped area + * + * Copyright (C) 2023 Maxime Chevallier <[email protected]> + */ +#ifndef MDIO_REGMAP_H +#define MDIO_REGMAP_H + +#include <linux/phy.h> + +struct device; +struct regmap; + +struct mdio_regmap_config { +	struct device *parent; +	struct regmap *regmap; +	char name[MII_BUS_ID_SIZE]; +	u8 valid_addr; +	bool autoscan; +}; + +struct mii_bus *devm_mdio_regmap_register(struct device *dev, +					  const struct mdio_regmap_config *config); + +#endif diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index fff7fa6b7c5d..f1755163dd9f 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h @@ -12,6 +12,7 @@  enum axp20x_variants {  	AXP152_ID = 0, +	AXP192_ID,  	AXP202_ID,  	AXP209_ID,  	AXP221_ID, @@ -26,6 +27,7 @@ enum axp20x_variants {  	NR_AXP20X_VARIANTS,  }; +#define AXP192_DATACACHE(m)		(0x06 + (m))  #define AXP20X_DATACACHE(m)		(0x04 + (m))  /* Power supply */ @@ -47,6 +49,13 @@ enum axp20x_variants {  #define AXP152_DCDC_FREQ		0x37  #define AXP152_DCDC_MODE		0x80 +#define AXP192_USB_OTG_STATUS		0x04 +#define AXP192_PWR_OUT_CTRL		0x12 +#define AXP192_DCDC2_V_OUT		0x23 +#define AXP192_DCDC1_V_OUT		0x26 +#define AXP192_DCDC3_V_OUT		0x27 +#define AXP192_LDO2_3_V_OUT		0x28 +  #define AXP20X_PWR_INPUT_STATUS		0x00  #define AXP20X_PWR_OP_MODE		0x01  #define AXP20X_USB_OTG_STATUS		0x02 @@ -185,6 +194,17 @@ enum axp20x_variants {  #define AXP152_IRQ2_STATE		0x49  #define AXP152_IRQ3_STATE		0x4a +#define AXP192_IRQ1_EN			0x40 +#define AXP192_IRQ2_EN			0x41 +#define AXP192_IRQ3_EN			0x42 +#define AXP192_IRQ4_EN			0x43 +#define AXP192_IRQ1_STATE		0x44 +#define AXP192_IRQ2_STATE		0x45 +#define AXP192_IRQ3_STATE		0x46 +#define AXP192_IRQ4_STATE		0x47 +#define AXP192_IRQ5_EN			0x4a +#define AXP192_IRQ5_STATE		0x4d +  #define AXP20X_IRQ1_EN			0x40  #define AXP20X_IRQ2_EN			0x41  #define AXP20X_IRQ3_EN			0x42 @@ -204,6 +224,11 @@ enum axp20x_variants {  #define AXP15060_IRQ2_STATE		0x49  /* ADC */ +#define AXP192_GPIO2_V_ADC_H		0x68 +#define AXP192_GPIO2_V_ADC_L		0x69 +#define AXP192_GPIO3_V_ADC_H		0x6a +#define AXP192_GPIO3_V_ADC_L		0x6b +  #define AXP20X_ACIN_V_ADC_H		0x56  #define AXP20X_ACIN_V_ADC_L		0x57  #define AXP20X_ACIN_I_ADC_H		0x58 @@ -233,6 +258,8 @@ enum axp20x_variants {  #define AXP20X_IPSOUT_V_HIGH_L		0x7f  /* Power supply */ +#define AXP192_GPIO30_IN_RANGE		0x85 +  #define AXP20X_DCDC_MODE		0x80  #define AXP20X_ADC_EN1			0x82  #define AXP20X_ADC_EN2			0x83 @@ -261,6 +288,16 @@ enum axp20x_variants {  #define AXP152_PWM1_FREQ_Y		0x9c  #define AXP152_PWM1_DUTY_CYCLE		0x9d +#define AXP192_GPIO0_CTRL		0x90 +#define AXP192_LDO_IO0_V_OUT		0x91 +#define AXP192_GPIO1_CTRL		0x92 +#define AXP192_GPIO2_CTRL		0x93 +#define AXP192_GPIO2_0_STATE		0x94 +#define AXP192_GPIO4_3_CTRL		0x95 +#define AXP192_GPIO4_3_STATE		0x96 +#define AXP192_GPIO2_0_PULL		0x97 +#define AXP192_N_RSTO_CTRL		0x9e +  #define AXP20X_GPIO0_CTRL		0x90  #define AXP20X_LDO5_V_OUT		0x91  #define AXP20X_GPIO1_CTRL		0x92 @@ -341,6 +378,17 @@ enum axp20x_variants {  /* Regulators IDs */  enum { +	AXP192_DCDC1 = 0, +	AXP192_DCDC2, +	AXP192_DCDC3, +	AXP192_LDO1, +	AXP192_LDO2, +	AXP192_LDO3, +	AXP192_LDO_IO0, +	AXP192_REG_ID_MAX +}; + +enum {  	AXP20X_LDO1 = 0,  	AXP20X_LDO2,  	AXP20X_LDO3, @@ -531,6 +579,42 @@ enum {  	AXP152_IRQ_GPIO0_INPUT,  }; +enum axp192_irqs { +	AXP192_IRQ_ACIN_OVER_V = 1, +	AXP192_IRQ_ACIN_PLUGIN, +	AXP192_IRQ_ACIN_REMOVAL, +	AXP192_IRQ_VBUS_OVER_V, +	AXP192_IRQ_VBUS_PLUGIN, +	AXP192_IRQ_VBUS_REMOVAL, +	AXP192_IRQ_VBUS_V_LOW, +	AXP192_IRQ_BATT_PLUGIN, +	AXP192_IRQ_BATT_REMOVAL, +	AXP192_IRQ_BATT_ENT_ACT_MODE, +	AXP192_IRQ_BATT_EXIT_ACT_MODE, +	AXP192_IRQ_CHARG, +	AXP192_IRQ_CHARG_DONE, +	AXP192_IRQ_BATT_TEMP_HIGH, +	AXP192_IRQ_BATT_TEMP_LOW, +	AXP192_IRQ_DIE_TEMP_HIGH, +	AXP192_IRQ_CHARG_I_LOW, +	AXP192_IRQ_DCDC1_V_LONG, +	AXP192_IRQ_DCDC2_V_LONG, +	AXP192_IRQ_DCDC3_V_LONG, +	AXP192_IRQ_PEK_SHORT = 22, +	AXP192_IRQ_PEK_LONG, +	AXP192_IRQ_N_OE_PWR_ON, +	AXP192_IRQ_N_OE_PWR_OFF, +	AXP192_IRQ_VBUS_VALID, +	AXP192_IRQ_VBUS_NOT_VALID, +	AXP192_IRQ_VBUS_SESS_VALID, +	AXP192_IRQ_VBUS_SESS_END, +	AXP192_IRQ_LOW_PWR_LVL = 31, +	AXP192_IRQ_TIMER, +	AXP192_IRQ_GPIO2_INPUT = 37, +	AXP192_IRQ_GPIO1_INPUT, +	AXP192_IRQ_GPIO0_INPUT, +}; +  enum {  	AXP20X_IRQ_ACIN_OVER_V = 1,  	AXP20X_IRQ_ACIN_PLUGIN, diff --git a/include/linux/mfd/intel-m10-bmc.h b/include/linux/mfd/intel-m10-bmc.h index 1812ebfa11a8..ee66c9751003 100644 --- a/include/linux/mfd/intel-m10-bmc.h +++ b/include/linux/mfd/intel-m10-bmc.h @@ -11,6 +11,7 @@  #include <linux/bits.h>  #include <linux/dev_printk.h>  #include <linux/regmap.h> +#include <linux/rwsem.h>  #define M10BMC_N3000_LEGACY_BUILD_VER	0x300468  #define M10BMC_N3000_SYS_BASE		0x300800 @@ -39,6 +40,11 @@  #define M10BMC_N3000_VER_PCB_INFO_MSK	GENMASK(31, 24)  #define M10BMC_N3000_VER_LEGACY_INVALID	0xffffffff +/* Telemetry registers */ +#define M10BMC_N3000_TELEM_START	0x100 +#define M10BMC_N3000_TELEM_END		0x250 +#define M10BMC_D5005_TELEM_END		0x300 +  /* Secure update doorbell register, in system register region */  #define M10BMC_N3000_DOORBELL		0x400 @@ -205,11 +211,15 @@ struct m10bmc_csr_map {   * struct intel_m10bmc_platform_info - Intel MAX 10 BMC platform specific information   * @cells: MFD cells   * @n_cells: MFD cells ARRAY_SIZE() + * @handshake_sys_reg_ranges: array of register ranges for fw handshake regs + * @handshake_sys_reg_nranges: number of register ranges for fw handshake regs   * @csr_map: the mappings for register definition of MAX10 BMC   */  struct intel_m10bmc_platform_info {  	struct mfd_cell *cells;  	int n_cells; +	const struct regmap_range *handshake_sys_reg_ranges; +	unsigned int handshake_sys_reg_nranges;  	const struct m10bmc_csr_map *csr_map;  }; @@ -232,18 +242,30 @@ struct intel_m10bmc_flash_bulk_ops {  	void (*unlock_write)(struct intel_m10bmc *m10bmc);  }; +enum m10bmc_fw_state { +	M10BMC_FW_STATE_NORMAL, +	M10BMC_FW_STATE_SEC_UPDATE_PREPARE, +	M10BMC_FW_STATE_SEC_UPDATE_WRITE, +	M10BMC_FW_STATE_SEC_UPDATE_PROGRAM, +}; +  /**   * struct intel_m10bmc - Intel MAX 10 BMC parent driver data structure   * @dev: this device   * @regmap: the regmap used to access registers by m10bmc itself   * @info: the platform information for MAX10 BMC   * @flash_bulk_ops: optional device specific operations for flash R/W + * @bmcfw_lock: read/write semaphore to BMC firmware running state + * @bmcfw_state: BMC firmware running state. Available only when + *		 handshake_sys_reg_nranges > 0.   */  struct intel_m10bmc {  	struct device *dev;  	struct regmap *regmap;  	const struct intel_m10bmc_platform_info *info;  	const struct intel_m10bmc_flash_bulk_ops *flash_bulk_ops; +	struct rw_semaphore bmcfw_lock;		/* Protects bmcfw_state */ +	enum m10bmc_fw_state bmcfw_state;  };  /* @@ -251,6 +273,7 @@ struct intel_m10bmc {   *   * m10bmc_raw_read - read m10bmc register per addr   * m10bmc_sys_read - read m10bmc system register per offset + * m10bmc_sys_update_bits - update m10bmc system register per offset   */  static inline int  m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr, @@ -266,21 +289,15 @@ m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,  	return ret;  } +int m10bmc_sys_read(struct intel_m10bmc *m10bmc, unsigned int offset, unsigned int *val); +int m10bmc_sys_update_bits(struct intel_m10bmc *m10bmc, unsigned int offset, +			   unsigned int msk, unsigned int val); +  /* - * The base of the system registers could be configured by HW developers, and - * in HW SPEC, the base is not added to the addresses of the system registers. - * - * This function helps to simplify the accessing of the system registers. And if - * the base is reconfigured in HW, SW developers could simply change the - * csr_map's base accordingly. + * Track the state of the firmware, as it is not available for register + * handshakes during secure updates on some MAX 10 cards.   */ -static inline int m10bmc_sys_read(struct intel_m10bmc *m10bmc, unsigned int offset, -				  unsigned int *val) -{ -	const struct m10bmc_csr_map *csr_map = m10bmc->info->csr_map; - -	return m10bmc_raw_read(m10bmc, csr_map->base + offset, val); -} +void m10bmc_fw_state_set(struct intel_m10bmc *m10bmc, enum m10bmc_fw_state new_state);  /*   * MAX10 BMC Core support diff --git a/include/linux/mfd/max597x.h b/include/linux/mfd/max5970.h index a850b2e02e6a..762a7d40c843 100644 --- a/include/linux/mfd/max597x.h +++ b/include/linux/mfd/max5970.h @@ -7,25 +7,25 @@   * Author: Patrick Rudolph <[email protected]>   */ -#ifndef _MFD_MAX597X_H -#define _MFD_MAX597X_H +#ifndef _MFD_MAX5970_H +#define _MFD_MAX5970_H  #include <linux/regmap.h>  #define MAX5970_NUM_SWITCHES 2  #define MAX5978_NUM_SWITCHES 1 -#define MAX597X_NUM_LEDS     4 +#define MAX5970_NUM_LEDS     4 -struct max597x_data { +struct max5970_data {  	int num_switches;  	u32 irng[MAX5970_NUM_SWITCHES];  	u32 mon_rng[MAX5970_NUM_SWITCHES];  	u32 shunt_micro_ohms[MAX5970_NUM_SWITCHES];  }; -enum max597x_chip_type { -	MAX597x_TYPE_MAX5978 = 1, -	MAX597x_TYPE_MAX5970, +enum max5970_chip_type { +	TYPE_MAX5978 = 1, +	TYPE_MAX5970,  };  #define MAX5970_REG_CURRENT_L(ch)		(0x01 + (ch) * 4) @@ -93,4 +93,4 @@ enum max597x_chip_type {  #define MAX_REGISTERS			0x49  #define ADC_MASK			0x3FF -#endif				/* _MFD_MAX597X_H */ +#endif				/* _MFD_MAX5970_H */ diff --git a/include/linux/mfd/max77541.h b/include/linux/mfd/max77541.h new file mode 100644 index 000000000000..fe5c0a3dc637 --- /dev/null +++ b/include/linux/mfd/max77541.h @@ -0,0 +1,91 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __MFD_MAX77541_H +#define __MFD_MAX77541_H + +#include <linux/bits.h> +#include <linux/types.h> + +/* REGISTERS */ +#define MAX77541_REG_INT_SRC                    0x00 +#define MAX77541_REG_INT_SRC_M                  0x01 + +#define MAX77541_BIT_INT_SRC_TOPSYS             BIT(0) +#define MAX77541_BIT_INT_SRC_BUCK               BIT(1) + +#define MAX77541_REG_TOPSYS_INT                 0x02 +#define MAX77541_REG_TOPSYS_INT_M               0x03 + +#define MAX77541_BIT_TOPSYS_INT_TJ_120C         BIT(0) +#define MAX77541_BIT_TOPSYS_INT_TJ_140C         BIT(1) +#define MAX77541_BIT_TOPSYS_INT_TSHDN           BIT(2) +#define MAX77541_BIT_TOPSYS_INT_UVLO            BIT(3) +#define MAX77541_BIT_TOPSYS_INT_ALT_SWO         BIT(4) +#define MAX77541_BIT_TOPSYS_INT_EXT_FREQ_DET    BIT(5) + +/* REGULATORS */ +#define MAX77541_REG_BUCK_INT                   0x20 +#define MAX77541_REG_BUCK_INT_M                 0x21 + +#define MAX77541_BIT_BUCK_INT_M1_POK_FLT        BIT(0) +#define MAX77541_BIT_BUCK_INT_M2_POK_FLT        BIT(1) +#define MAX77541_BIT_BUCK_INT_M1_SCFLT          BIT(4) +#define MAX77541_BIT_BUCK_INT_M2_SCFLT          BIT(5) + +#define MAX77541_REG_EN_CTRL                    0x0B + +#define MAX77541_BIT_M1_EN                      BIT(0) +#define MAX77541_BIT_M2_EN                      BIT(1) + +#define MAX77541_REG_M1_VOUT                    0x23 +#define MAX77541_REG_M2_VOUT                    0x33 + +#define MAX77541_BITS_MX_VOUT                   GENMASK(7, 0) + +#define MAX77541_REG_M1_CFG1                    0x25 +#define MAX77541_REG_M2_CFG1                    0x35 + +#define MAX77541_BITS_MX_CFG1_RNG               GENMASK(7, 6) + +/* ADC */ +#define MAX77541_REG_ADC_INT                    0x70 +#define MAX77541_REG_ADC_INT_M                  0x71 + +#define MAX77541_BIT_ADC_INT_CH1_I              BIT(0) +#define MAX77541_BIT_ADC_INT_CH2_I              BIT(1) +#define MAX77541_BIT_ADC_INT_CH3_I              BIT(2) +#define MAX77541_BIT_ADC_INT_CH6_I              BIT(5) + +#define MAX77541_REG_ADC_DATA_CH1               0x72 +#define MAX77541_REG_ADC_DATA_CH2               0x73 +#define MAX77541_REG_ADC_DATA_CH3               0x74 +#define MAX77541_REG_ADC_DATA_CH6               0x77 + +/* INTERRUPT MASKS*/ +#define MAX77541_REG_INT_SRC_MASK               0x00 +#define MAX77541_REG_TOPSYS_INT_MASK            0x00 +#define MAX77541_REG_BUCK_INT_MASK              0x00 + +#define MAX77541_MAX_REGULATORS 2 + +enum max7754x_ids { +	MAX77540 = 1, +	MAX77541, +}; + +struct regmap; +struct regmap_irq_chip_data; +struct i2c_client; + +struct max77541 { +	struct i2c_client *i2c; +	struct regmap *regmap; +	enum max7754x_ids id; + +	struct regmap_irq_chip_data *irq_data; +	struct regmap_irq_chip_data *irq_buck; +	struct regmap_irq_chip_data *irq_topsys; +	struct regmap_irq_chip_data *irq_adc; +}; + +#endif /* __MFD_MAX77541_H */ diff --git a/include/linux/mfd/rt5033-private.h b/include/linux/mfd/rt5033-private.h index 6bb432f6a96c..0221f806d139 100644 --- a/include/linux/mfd/rt5033-private.h +++ b/include/linux/mfd/rt5033-private.h @@ -55,21 +55,28 @@ enum rt5033_reg {  };  /* RT5033 Charger state register */ -#define RT5033_CHG_STAT_MASK		0x20 +#define RT5033_CHG_STAT_TYPE_MASK	0x60 +#define RT5033_CHG_STAT_TYPE_PRE	0x20 +#define RT5033_CHG_STAT_TYPE_FAST	0x60 +#define RT5033_CHG_STAT_MASK		0x30  #define RT5033_CHG_STAT_DISCHARGING	0x00  #define RT5033_CHG_STAT_FULL		0x10  #define RT5033_CHG_STAT_CHARGING	0x20  #define RT5033_CHG_STAT_NOT_CHARGING	0x30 -#define RT5033_CHG_STAT_TYPE_MASK	0x60 -#define RT5033_CHG_STAT_TYPE_PRE	0x20 -#define RT5033_CHG_STAT_TYPE_FAST	0x60  /* RT5033 CHGCTRL1 register */  #define RT5033_CHGCTRL1_IAICR_MASK	0xe0 +#define RT5033_CHGCTRL1_TE_EN_MASK	0x08 +#define RT5033_CHGCTRL1_HZ_MASK		0x02  #define RT5033_CHGCTRL1_MODE_MASK	0x01  /* RT5033 CHGCTRL2 register */  #define RT5033_CHGCTRL2_CV_MASK		0xfc +#define RT5033_CHGCTRL2_CV_SHIFT	0x02 + +/* RT5033 DEVICE_ID register */ +#define RT5033_VENDOR_ID_MASK		0xf0 +#define RT5033_CHIP_REV_MASK		0x0f  /* RT5033 CHGCTRL3 register */  #define RT5033_CHGCTRL3_CFO_EN_MASK	0x40 @@ -77,18 +84,18 @@ enum rt5033_reg {  #define RT5033_CHGCTRL3_TIMER_EN_MASK	0x01  /* RT5033 CHGCTRL4 register */ -#define RT5033_CHGCTRL4_EOC_MASK	0x07 +#define RT5033_CHGCTRL4_MIVR_MASK	0xe0  #define RT5033_CHGCTRL4_IPREC_MASK	0x18 +#define RT5033_CHGCTRL4_IPREC_SHIFT	0x03 +#define RT5033_CHGCTRL4_EOC_MASK	0x07  /* RT5033 CHGCTRL5 register */ -#define RT5033_CHGCTRL5_VPREC_MASK	0x0f  #define RT5033_CHGCTRL5_ICHG_MASK	0xf0  #define RT5033_CHGCTRL5_ICHG_SHIFT	0x04 -#define RT5033_CHG_MAX_CURRENT		0x0d +#define RT5033_CHGCTRL5_VPREC_MASK	0x0f  /* RT5033 RT CTRL1 register */  #define RT5033_RT_CTRL1_UUG_MASK	0x02 -#define RT5033_RT_HZ_MASK		0x01  /* RT5033 control register */  #define RT5033_CTRL_FCCM_BUCK_MASK		BIT(0) @@ -115,28 +122,37 @@ enum rt5033_reg {   * register), AICR mode limits the input current. For example, the AIRC 100   * mode limits the input current to 100 mA.   */ +#define RT5033_AICR_DISABLE			0x00  #define RT5033_AICR_100_MODE			0x20  #define RT5033_AICR_500_MODE			0x40  #define RT5033_AICR_700_MODE			0x60  #define RT5033_AICR_900_MODE			0x80 +#define RT5033_AICR_1000_MODE			0xa0  #define RT5033_AICR_1500_MODE			0xc0  #define RT5033_AICR_2000_MODE			0xe0 -#define RT5033_AICR_MODE_MASK			0xe0 -/* RT5033 use internal timer need to set time */ -#define RT5033_FAST_CHARGE_TIMER4		0x00 -#define RT5033_FAST_CHARGE_TIMER6		0x01 -#define RT5033_FAST_CHARGE_TIMER8		0x02 -#define RT5033_FAST_CHARGE_TIMER9		0x03 -#define RT5033_FAST_CHARGE_TIMER12		0x04 -#define RT5033_FAST_CHARGE_TIMER14		0x05 -#define RT5033_FAST_CHARGE_TIMER16		0x06 +/* RT5033 charger minimum input voltage regulation */ +#define RT5033_CHARGER_MIVR_DISABLE		0x00 +#define RT5033_CHARGER_MIVR_4200MV		0x20 +#define RT5033_CHARGER_MIVR_4300MV		0x40 +#define RT5033_CHARGER_MIVR_4400MV		0x60 +#define RT5033_CHARGER_MIVR_4500MV		0x80 +#define RT5033_CHARGER_MIVR_4600MV		0xa0 +#define RT5033_CHARGER_MIVR_4700MV		0xc0 +#define RT5033_CHARGER_MIVR_4800MV		0xe0 +/* RT5033 use internal timer need to set time */ +#define RT5033_FAST_CHARGE_TIMER4		0x00 /*  4 hrs */ +#define RT5033_FAST_CHARGE_TIMER6		0x08 /*  6 hrs */ +#define RT5033_FAST_CHARGE_TIMER8		0x10 /*  8 hrs */ +#define RT5033_FAST_CHARGE_TIMER10		0x18 /* 10 hrs */ +#define RT5033_FAST_CHARGE_TIMER12		0x20 /* 12 hrs */ +#define RT5033_FAST_CHARGE_TIMER14		0x28 /* 14 hrs */ +#define RT5033_FAST_CHARGE_TIMER16		0x30 /* 16 hrs */ + +#define RT5033_INT_TIMER_DISABLE		0x00  #define RT5033_INT_TIMER_ENABLE			0x01 -/* RT5033 charger termination enable mask */ -#define RT5033_TE_ENABLE_MASK			0x08 -  /*   * RT5033 charger opa mode. RT5033 has two opa modes for OTG: charger mode   * and boost mode. @@ -145,25 +161,30 @@ enum rt5033_reg {  #define RT5033_BOOST_MODE			0x01  /* RT5033 charger termination enable */ +#define RT5033_TE_DISABLE			0x00  #define RT5033_TE_ENABLE			0x08  /* RT5033 charger CFO enable */ +#define RT5033_CFO_DISABLE			0x00  #define RT5033_CFO_ENABLE			0x40  /* RT5033 charger constant charge voltage (as in CHGCTRL2 register), uV */  #define RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MIN	3650000U  #define RT5033_CHARGER_CONST_VOLTAGE_STEP_NUM   25000U  #define RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MAX	4400000U +#define RT5033_CV_MAX_VOLTAGE			0x1e  /* RT5033 charger pre-charge current limits (as in CHGCTRL4 register), uA */  #define RT5033_CHARGER_PRE_CURRENT_LIMIT_MIN	350000U  #define RT5033_CHARGER_PRE_CURRENT_STEP_NUM	100000U  #define RT5033_CHARGER_PRE_CURRENT_LIMIT_MAX	650000U +#define RT5033_CHG_MAX_PRE_CURRENT		0x03  /* RT5033 charger fast-charge current (as in CHGCTRL5 register), uA */  #define RT5033_CHARGER_FAST_CURRENT_MIN		700000U  #define RT5033_CHARGER_FAST_CURRENT_STEP_NUM	100000U  #define RT5033_CHARGER_FAST_CURRENT_MAX		2000000U +#define RT5033_CHG_MAX_CURRENT			0x0d  /*   * RT5033 charger const-charge end of charger current ( @@ -187,11 +208,12 @@ enum rt5033_reg {   * RT5033 charger UUG. It enables MOS auto control by H/W charger   * circuit.   */ +#define RT5033_CHARGER_UUG_DISABLE		0x00  #define RT5033_CHARGER_UUG_ENABLE		0x02  /* RT5033 charger high impedance mode */  #define RT5033_CHARGER_HZ_DISABLE		0x00 -#define RT5033_CHARGER_HZ_ENABLE		0x01 +#define RT5033_CHARGER_HZ_ENABLE		0x02  /* RT5033 regulator BUCK output voltage uV */  #define RT5033_REGULATOR_BUCK_VOLTAGE_MIN		1000000U diff --git a/include/linux/mfd/rt5033.h b/include/linux/mfd/rt5033.h index 8f306ac15a27..bb3d18945d21 100644 --- a/include/linux/mfd/rt5033.h +++ b/include/linux/mfd/rt5033.h @@ -12,7 +12,6 @@  #include <linux/regulator/consumer.h>  #include <linux/i2c.h>  #include <linux/regmap.h> -#include <linux/power_supply.h>  /* RT5033 regulator IDs */  enum rt5033_regulators { @@ -32,27 +31,4 @@ struct rt5033_dev {  	bool wakeup;  }; -struct rt5033_battery { -	struct i2c_client	*client; -	struct rt5033_dev	*rt5033; -	struct regmap		*regmap; -	struct power_supply	*psy; -}; - -/* RT5033 charger platform data */ -struct rt5033_charger_data { -	unsigned int pre_uamp; -	unsigned int pre_uvolt; -	unsigned int const_uvolt; -	unsigned int eoc_uamp; -	unsigned int fast_uamp; -}; - -struct rt5033_charger { -	struct device			*dev; -	struct rt5033_dev		*rt5033; -	struct power_supply		psy; -	struct rt5033_charger_data	*chg; -}; -  #endif /* __RT5033_H__ */ diff --git a/include/linux/mfd/stpmic1.h b/include/linux/mfd/stpmic1.h index fa3f99f7e9a1..dc00bac24f5a 100644 --- a/include/linux/mfd/stpmic1.h +++ b/include/linux/mfd/stpmic1.h @@ -15,7 +15,7 @@  #define RREQ_STATE_SR		0x5  #define VERSION_SR		0x6 -#define SWOFF_PWRCTRL_CR	0x10 +#define MAIN_CR			0x10  #define PADS_PULL_CR		0x11  #define BUCKS_PD_CR		0x12  #define LDO14_PD_CR		0x13 @@ -148,14 +148,14 @@  #define LDO_BYPASS_MASK			BIT(7)  /* Main PMIC Control Register - * SWOFF_PWRCTRL_CR + * MAIN_CR   * Address : 0x10   */ -#define ICC_EVENT_ENABLED		BIT(4) +#define OCP_OFF_DBG			BIT(4)  #define PWRCTRL_POLARITY_HIGH		BIT(3) -#define PWRCTRL_PIN_VALID		BIT(2) -#define RESTART_REQUEST_ENABLED		BIT(1) -#define SOFTWARE_SWITCH_OFF_ENABLED	BIT(0) +#define PWRCTRL_ENABLE			BIT(2) +#define RESTART_REQUEST_ENABLE		BIT(1) +#define SOFTWARE_SWITCH_OFF		BIT(0)  /* Main PMIC PADS Control Register   * PADS_PULL_CR diff --git a/include/linux/mfd/tps65010.h b/include/linux/mfd/tps65010.h index a1fb9bc5311d..5edf1aef1118 100644 --- a/include/linux/mfd/tps65010.h +++ b/include/linux/mfd/tps65010.h @@ -28,6 +28,8 @@  #ifndef __LINUX_I2C_TPS65010_H  #define __LINUX_I2C_TPS65010_H +struct gpio_chip; +  /*   * ----------------------------------------------------------------------------   * Registers, all 8 bits @@ -176,12 +178,10 @@ struct i2c_client;  /**   * struct tps65010_board - packages GPIO and LED lines - * @base: the GPIO number to assign to GPIO-1   * @outmask: bit (N-1) is set to allow GPIO-N to be used as an   *	(open drain) output   * @setup: optional callback issued once the GPIOs are valid   * @teardown: optional callback issued before the GPIOs are invalidated - * @context: optional parameter passed to setup() and teardown()   *   * Board data may be used to package the GPIO (and LED) lines for use   * in by the generic GPIO and LED frameworks.  The first four GPIOs @@ -193,12 +193,9 @@ struct i2c_client;   * devices in their initial states using these GPIOs.   */  struct tps65010_board { -	int				base;  	unsigned			outmask; - -	int		(*setup)(struct i2c_client *client, void *context); -	int		(*teardown)(struct i2c_client *client, void *context); -	void		*context; +	int		(*setup)(struct i2c_client *client, struct gpio_chip *gc); +	void		(*teardown)(struct i2c_client *client, struct gpio_chip *gc);  };  #endif /*  __LINUX_I2C_TPS65010_H */ diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h index 6e3d99b7a0ee..c062d91a67d9 100644 --- a/include/linux/mfd/twl.h +++ b/include/linux/mfd/twl.h @@ -593,9 +593,6 @@ struct twl4030_gpio_platform_data {  	 */  	u32		pullups;  	u32		pulldowns; - -	int		(*setup)(struct device *dev, -				unsigned gpio, unsigned ngpio);  };  struct twl4030_madc_platform_data { diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index c0af74efd3cb..80cc12a9a531 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h @@ -716,6 +716,7 @@ enum sync_rst_state_type {  	MLX5_SYNC_RST_STATE_RESET_REQUEST	= 0x0,  	MLX5_SYNC_RST_STATE_RESET_NOW		= 0x1,  	MLX5_SYNC_RST_STATE_RESET_ABORT		= 0x2, +	MLX5_SYNC_RST_STATE_RESET_UNLOAD	= 0x3,  };  struct mlx5_eqe_sync_fw_update { diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 4b9626cd83e4..25d0528f9219 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -382,7 +382,6 @@ enum mlx5_res_type {  	MLX5_RES_SRQ	= 3,  	MLX5_RES_XSRQ	= 4,  	MLX5_RES_XRQ	= 5, -	MLX5_RES_DCT	= MLX5_EVENT_QUEUE_TYPE_DCT,  };  struct mlx5_core_rsc_common { @@ -443,15 +442,6 @@ struct mlx5_core_health {  	struct delayed_work		update_fw_log_ts_work;  }; -struct mlx5_qp_table { -	struct notifier_block   nb; - -	/* protect radix tree -	 */ -	spinlock_t		lock; -	struct radix_tree_root	tree; -}; -  enum {  	MLX5_PF_NOTIFY_DISABLE_VF,  	MLX5_PF_NOTIFY_ENABLE_VF, @@ -474,6 +464,7 @@ struct mlx5_core_sriov {  	struct mlx5_vf_context	*vfs_ctx;  	int			num_vfs;  	u16			max_vfs; +	u16			max_ec_vfs;  };  struct mlx5_fc_pool { @@ -580,6 +571,7 @@ enum mlx5_func_type {  	MLX5_VF,  	MLX5_SF,  	MLX5_HOST_PF, +	MLX5_EC_VF,  	MLX5_FUNC_TYPE_NUM,  }; @@ -1174,7 +1166,13 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,  				 u64 *values,  				 int num_counters,  				 size_t *offsets); -struct mlx5_core_dev *mlx5_lag_get_peer_mdev(struct mlx5_core_dev *dev); +struct mlx5_core_dev *mlx5_lag_get_next_peer_mdev(struct mlx5_core_dev *dev, int *i); + +#define mlx5_lag_for_each_peer_mdev(dev, peer, i)				\ +	for (i = 0, peer = mlx5_lag_get_next_peer_mdev(dev, &i);		\ +	     peer;								\ +	     peer = mlx5_lag_get_next_peer_mdev(dev, &i)) +  u8 mlx5_lag_get_num_ports(struct mlx5_core_dev *dev);  struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev);  void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up); @@ -1250,6 +1248,11 @@ static inline int mlx5_lag_is_lacp_owner(struct mlx5_core_dev *dev)  		    MLX5_CAP_GEN(dev, lag_master);  } +static inline u16 mlx5_core_max_ec_vfs(const struct mlx5_core_dev *dev) +{ +	return dev->priv.sriov.max_ec_vfs; +} +  static inline int mlx5_get_gid_table_len(u16 param)  {  	if (param > 4) { diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index b89778d0d326..33344a71c3e3 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -1710,9 +1710,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {  	u8         regexp_params[0x1];  	u8         uar_sz[0x6];  	u8         port_selection_cap[0x1]; -	u8         reserved_at_248[0x1]; +	u8         reserved_at_251[0x1];  	u8         umem_uid_0[0x1]; -	u8         reserved_at_250[0x5]; +	u8         reserved_at_253[0x5];  	u8         log_pg_sz[0x8];  	u8         bf[0x1]; @@ -1755,7 +1755,10 @@ struct mlx5_ifc_cmd_hca_cap_bits {  	u8         reserved_at_328[0x2];  	u8	   relaxed_ordering_read[0x1];  	u8         log_max_pd[0x5]; -	u8         reserved_at_330[0x9]; +	u8         reserved_at_330[0x6]; +	u8         pci_sync_for_fw_update_with_driver_unload[0x1]; +	u8         vnic_env_cnt_steering_fail[0x1]; +	u8         vport_counter_local_loopback[0x1];  	u8         q_counter_aggregation[0x1];  	u8         q_counter_other_vport[0x1];  	u8         log_max_xrcd[0x5]; @@ -1990,7 +1993,10 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {  	u8	   ts_cqe_metadata_size2wqe_counter[0x5];  	u8	   reserved_at_250[0x10]; -	u8	   reserved_at_260[0x5a0]; +	u8	   reserved_at_260[0x120]; +	u8	   reserved_at_380[0x10]; +	u8	   ec_vf_vport_base[0x10]; +	u8	   reserved_at_3a0[0x460];  };  enum mlx5_ifc_flow_destination_type { @@ -3112,7 +3118,9 @@ struct mlx5_ifc_dtor_reg_bits {  	struct mlx5_ifc_default_timeout_bits reclaim_vfs_pages_to; -	u8         reserved_at_1c0[0x40]; +	struct mlx5_ifc_default_timeout_bits reset_unload_to; + +	u8         reserved_at_1c0[0x20];  };  enum { @@ -3673,7 +3681,13 @@ struct mlx5_ifc_vnic_diagnostic_statistics_bits {  	u8         eth_wqe_too_small[0x20]; -	u8         reserved_at_220[0xdc0]; +	u8         reserved_at_220[0xc0]; + +	u8         generated_pkt_steering_fail[0x40]; + +	u8         handled_pkt_steering_fail[0x40]; + +	u8         reserved_at_360[0xc80];  };  struct mlx5_ifc_traffic_counter_bits { @@ -4797,7 +4811,8 @@ struct mlx5_ifc_set_hca_cap_in_bits {  	u8         op_mod[0x10];  	u8         other_function[0x1]; -	u8         reserved_at_41[0xf]; +	u8         ec_vf_function[0x1]; +	u8         reserved_at_42[0xe];  	u8         function_id[0x10];  	u8         reserved_at_60[0x20]; @@ -5175,7 +5190,9 @@ struct mlx5_ifc_query_vport_counter_out_bits {  	struct mlx5_ifc_traffic_counter_bits transmitted_eth_multicast; -	u8         reserved_at_680[0xa00]; +	struct mlx5_ifc_traffic_counter_bits local_loopback; + +	u8         reserved_at_700[0x980];  };  enum { @@ -5948,7 +5965,8 @@ struct mlx5_ifc_query_hca_cap_in_bits {  	u8         op_mod[0x10];  	u8         other_function[0x1]; -	u8         reserved_at_41[0xf]; +	u8         ec_vf_function[0x1]; +	u8         reserved_at_42[0xe];  	u8         function_id[0x10];  	u8         reserved_at_60[0x20]; diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h index 7f31432f44c2..fbb9bf447889 100644 --- a/include/linux/mlx5/vport.h +++ b/include/linux/mlx5/vport.h @@ -132,6 +132,6 @@ int mlx5_nic_vport_affiliate_multiport(struct mlx5_core_dev *master_mdev,  int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev);  u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev); -int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 function_id, void *out, +int mlx5_vport_get_other_func_cap(struct mlx5_core_dev *dev, u16 vport, void *out,  				  u16 opmod);  #endif /* __MLX5_VPORT_H__ */ diff --git a/include/linux/mm.h b/include/linux/mm.h index eef34f6a0351..2dd73e4f3d8e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -377,7 +377,7 @@ extern unsigned int kobjsize(const void *objp);  #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */  /* Bits set in the VMA until the stack is in its final location */ -#define VM_STACK_INCOMPLETE_SETUP	(VM_RAND_READ | VM_SEQ_READ) +#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ | VM_STACK_EARLY)  #define TASK_EXEC ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) @@ -399,8 +399,10 @@ extern unsigned int kobjsize(const void *objp);  #ifdef CONFIG_STACK_GROWSUP  #define VM_STACK	VM_GROWSUP +#define VM_STACK_EARLY	VM_GROWSDOWN  #else  #define VM_STACK	VM_GROWSDOWN +#define VM_STACK_EARLY	0  #endif  #define VM_STACK_FLAGS	(VM_STACK | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) @@ -2323,6 +2325,9 @@ void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to);  void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);  int generic_error_remove_page(struct address_space *mapping, struct page *page); +struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm, +		unsigned long address, struct pt_regs *regs); +  #ifdef CONFIG_MMU  extern vm_fault_t handle_mm_fault(struct vm_area_struct *vma,  				  unsigned long address, unsigned int flags, @@ -3174,7 +3179,7 @@ extern unsigned long do_mmap(struct file *file, unsigned long addr,  	unsigned long pgoff, unsigned long *populate, struct list_head *uf);  extern int do_vmi_munmap(struct vma_iterator *vmi, struct mm_struct *mm,  			 unsigned long start, size_t len, struct list_head *uf, -			 bool downgrade); +			 bool unlock);  extern int do_munmap(struct mm_struct *, unsigned long, size_t,  		     struct list_head *uf);  extern int do_madvise(struct mm_struct *mm, unsigned long start, size_t len_in, int behavior); @@ -3182,7 +3187,7 @@ extern int do_madvise(struct mm_struct *mm, unsigned long start, size_t len_in,  #ifdef CONFIG_MMU  extern int do_vma_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma,  			 unsigned long start, unsigned long end, -			 struct list_head *uf, bool downgrade); +			 struct list_head *uf, bool unlock);  extern int __mm_populate(unsigned long addr, unsigned long len,  			 int ignore_errors);  static inline void mm_populate(unsigned long addr, unsigned long len) @@ -3228,16 +3233,11 @@ extern vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf);  extern unsigned long stack_guard_gap;  /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ -extern int expand_stack(struct vm_area_struct *vma, unsigned long address); +int expand_stack_locked(struct vm_area_struct *vma, unsigned long address); +struct vm_area_struct *expand_stack(struct mm_struct * mm, unsigned long addr);  /* CONFIG_STACK_GROWSUP still needs to grow downwards at some places */ -extern int expand_downwards(struct vm_area_struct *vma, -		unsigned long address); -#if VM_GROWSUP -extern int expand_upwards(struct vm_area_struct *vma, unsigned long address); -#else -  #define expand_upwards(vma, address) (0) -#endif +int expand_downwards(struct vm_area_struct *vma, unsigned long address);  /* Look up the first VMA which satisfies  addr < vm_end,  NULL if none. */  extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr); @@ -3332,7 +3332,8 @@ unsigned long change_prot_numa(struct vm_area_struct *vma,  			unsigned long start, unsigned long end);  #endif -struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); +struct vm_area_struct *find_extend_vma_locked(struct mm_struct *, +		unsigned long addr);  int remap_pfn_range(struct vm_area_struct *, unsigned long addr,  			unsigned long pfn, unsigned long size, pgprot_t);  int remap_pfn_range_notrack(struct vm_area_struct *vma, unsigned long addr, @@ -3380,6 +3381,8 @@ static inline vm_fault_t vmf_error(int err)  {  	if (err == -ENOMEM)  		return VM_FAULT_OOM; +	else if (err == -EHWPOISON) +		return VM_FAULT_HWPOISON;  	return VM_FAULT_SIGBUS;  } diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h index c653accdc7fd..7fada7a714fe 100644 --- a/include/linux/mmc/sdio_ids.h +++ b/include/linux/mmc/sdio_ids.h @@ -121,7 +121,8 @@  #define SDIO_DEVICE_ID_REALTEK_RTW8822BS	0xb822  #define SDIO_DEVICE_ID_REALTEK_RTW8821CS	0xc821  #define SDIO_DEVICE_ID_REALTEK_RTW8822CS	0xc822 -#define SDIO_DEVICE_ID_REALTEK_RTW8723DS	0xd723 +#define SDIO_DEVICE_ID_REALTEK_RTW8723DS_2ANT	0xd723 +#define SDIO_DEVICE_ID_REALTEK_RTW8723DS_1ANT	0xd724  #define SDIO_DEVICE_ID_REALTEK_RTW8821DS	0xd821  #define SDIO_VENDOR_ID_SIANO			0x039a diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index ccaaeda792c0..b0678b093cb2 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -221,6 +221,19 @@ struct acpi_device_id {  	__u32 cls_msk;  }; +/** + * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with + * the PCI-defined class-code information + * + * @_cls : the class, subclass, prog-if triple for this device + * @_msk : the class mask for this device + * + * This macro is used to create a struct acpi_device_id that matches a + * specific PCI class. The .id and .driver_data fields will be left + * initialized with the default value. + */ +#define ACPI_DEVICE_CLASS(_cls, _msk)	.cls = (_cls), .cls_msk = (_msk), +  #define PNP_ID_LEN	8  #define PNP_MAX_DEVICES	8 @@ -912,6 +925,12 @@ struct ishtp_device_id {  	kernel_ulong_t driver_data;  }; +#define CDX_ANY_ID (0xFFFF) + +enum { +	CDX_ID_F_VFIO_DRIVER_OVERRIDE = 1, +}; +  /**   * struct cdx_device_id - CDX device identifier   * @vendor: Vendor ID diff --git a/include/linux/module.h b/include/linux/module.h index 9e56763dff81..a98e188cf37b 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -968,15 +968,6 @@ static inline int lookup_module_symbol_name(unsigned long addr, char *symname)  	return -ERANGE;  } -static inline int lookup_module_symbol_attrs(unsigned long addr, -					     unsigned long *size, -					     unsigned long *offset, -					     char *modname, -					     char *name) -{ -	return -ERANGE; -} -  static inline int module_get_kallsym(unsigned int symnum, unsigned long *value,  				     char *type, char *name,  				     char *module_name, int *exported) diff --git a/include/linux/mroute.h b/include/linux/mroute.h index 80b8400ab8b2..4c5003afee6c 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h @@ -18,10 +18,11 @@ static inline int ip_mroute_opt(int opt)  int ip_mroute_setsockopt(struct sock *, int, sockptr_t, unsigned int);  int ip_mroute_getsockopt(struct sock *, int, sockptr_t, sockptr_t); -int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); +int ipmr_ioctl(struct sock *sk, int cmd, void *arg);  int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);  int ip_mr_init(void);  bool ipmr_rule_default(const struct fib_rule *rule); +int ipmr_sk_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);  #else  static inline int ip_mroute_setsockopt(struct sock *sock, int optname,  				       sockptr_t optval, unsigned int optlen) @@ -35,7 +36,7 @@ static inline int ip_mroute_getsockopt(struct sock *sk, int optname,  	return -ENOPROTOOPT;  } -static inline int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) +static inline int ipmr_ioctl(struct sock *sk, int cmd, void *arg)  {  	return -ENOIOCTLCMD;  } @@ -54,6 +55,12 @@ static inline bool ipmr_rule_default(const struct fib_rule *rule)  {  	return true;  } + +static inline int ipmr_sk_ioctl(struct sock *sk, unsigned int cmd, +				void __user *arg) +{ +	return 1; +}  #endif  #define VIFF_STATIC 0x8000 diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h index 8f2b307fb124..63ef5191cc57 100644 --- a/include/linux/mroute6.h +++ b/include/linux/mroute6.h @@ -29,10 +29,10 @@ struct sock;  extern int ip6_mroute_setsockopt(struct sock *, int, sockptr_t, unsigned int);  extern int ip6_mroute_getsockopt(struct sock *, int, sockptr_t, sockptr_t);  extern int ip6_mr_input(struct sk_buff *skb); -extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);  extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);  extern int ip6_mr_init(void);  extern void ip6_mr_cleanup(void); +int ip6mr_ioctl(struct sock *sk, int cmd, void *arg);  #else  static inline int ip6_mroute_setsockopt(struct sock *sock, int optname,  		sockptr_t optval, unsigned int optlen) @@ -48,7 +48,7 @@ int ip6_mroute_getsockopt(struct sock *sock,  }  static inline -int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg) +int ip6mr_ioctl(struct sock *sk, int cmd, void *arg)  {  	return -ENOIOCTLCMD;  } @@ -100,6 +100,27 @@ extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,  #ifdef CONFIG_IPV6_MROUTE  bool mroute6_is_socket(struct net *net, struct sk_buff *skb);  extern int ip6mr_sk_done(struct sock *sk); +static inline int ip6mr_sk_ioctl(struct sock *sk, unsigned int cmd, +				 void __user *arg) +{ +	switch (cmd) { +	/* These userspace buffers will be consumed by ip6mr_ioctl() */ +	case SIOCGETMIFCNT_IN6: { +		struct sioc_mif_req6 buffer; + +		return sock_ioctl_inout(sk, cmd, arg, &buffer, +					sizeof(buffer)); +		} +	case SIOCGETSGCNT_IN6: { +		struct sioc_sg_req6 buffer; + +		return sock_ioctl_inout(sk, cmd, arg, &buffer, +					sizeof(buffer)); +		} +	} + +	return 1; +}  #else  static inline bool mroute6_is_socket(struct net *net, struct sk_buff *skb)  { @@ -109,5 +130,11 @@ static inline int ip6mr_sk_done(struct sock *sk)  {  	return 0;  } + +static inline int ip6mr_sk_ioctl(struct sock *sk, unsigned int cmd, +				 void __user *arg) +{ +	return 1; +}  #endif  #endif diff --git a/include/linux/net.h b/include/linux/net.h index b73ad8e3c212..41c608c1b02c 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -43,6 +43,7 @@ struct net;  #define SOCK_PASSSEC		4  #define SOCK_SUPPORT_ZC		5  #define SOCK_CUSTOM_SOCKOPT	6 +#define SOCK_PASSPIDFD		7  #ifndef ARCH_HAS_SOCKET_TYPES  /** @@ -206,10 +207,9 @@ struct proto_ops {  				      size_t total_len, int flags);  	int		(*mmap)	     (struct file *file, struct socket *sock,  				      struct vm_area_struct * vma); -	ssize_t		(*sendpage)  (struct socket *sock, struct page *page, -				      int offset, size_t size, int flags);  	ssize_t 	(*splice_read)(struct socket *sock,  loff_t *ppos,  				       struct pipe_inode_info *pipe, size_t len, unsigned int flags); +	void		(*splice_eof)(struct socket *sock);  	int		(*set_peek_off)(struct sock *sk, int val);  	int		(*peek_len)(struct socket *sock); @@ -220,8 +220,6 @@ struct proto_ops {  				     sk_read_actor_t recv_actor);  	/* This is different from read_sock(), it reads an entire skb at a time. */  	int		(*read_skb)(struct sock *sk, skb_read_actor_t recv_actor); -	int		(*sendpage_locked)(struct sock *sk, struct page *page, -					   int offset, size_t size, int flags);  	int		(*sendmsg_locked)(struct sock *sk, struct msghdr *msg,  					  size_t size);  	int		(*set_rcvlowat)(struct sock *sk, int val); @@ -339,10 +337,6 @@ int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen,  		   int flags);  int kernel_getsockname(struct socket *sock, struct sockaddr *addr);  int kernel_getpeername(struct socket *sock, struct sockaddr *addr); -int kernel_sendpage(struct socket *sock, struct page *page, int offset, -		    size_t size, int flags); -int kernel_sendpage_locked(struct sock *sk, struct page *page, int offset, -			   size_t size, int flags);  int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how);  /* Routine returns the IP overhead imposed by a (caller-protected) socket. */ diff --git a/include/linux/net_mm.h b/include/linux/net_mm.h new file mode 100644 index 000000000000..b298998bd5a0 --- /dev/null +++ b/include/linux/net_mm.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifdef CONFIG_MMU + +#ifdef CONFIG_INET +extern const struct vm_operations_struct tcp_vm_ops; +static inline bool vma_is_tcp(const struct vm_area_struct *vma) +{ +	return vma->vm_ops == &tcp_vm_ops; +} +#else +static inline bool vma_is_tcp(const struct vm_area_struct *vma) +{ +	return false; +} +#endif /* CONFIG_INET*/ + +#endif /* CONFIG_MMU */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c2f0c6002a84..b828c7a75be2 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3124,6 +3124,10 @@ struct net_device *netdev_sk_get_lowest_dev(struct net_device *dev,  					    struct sock *sk);  struct net_device *dev_get_by_index(struct net *net, int ifindex);  struct net_device *__dev_get_by_index(struct net *net, int ifindex); +struct net_device *netdev_get_by_index(struct net *net, int ifindex, +				       netdevice_tracker *tracker, gfp_t gfp); +struct net_device *netdev_get_by_name(struct net *net, const char *name, +				      netdevice_tracker *tracker, gfp_t gfp);  struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);  struct net_device *dev_get_by_napi_id(unsigned int napi_id);  int dev_restart(struct net_device *dev); @@ -4827,13 +4831,6 @@ int skb_crc32c_csum_help(struct sk_buff *skb);  int skb_csum_hwoffload_help(struct sk_buff *skb,  			    const netdev_features_t features); -struct sk_buff *__skb_gso_segment(struct sk_buff *skb, -				  netdev_features_t features, bool tx_path); -struct sk_buff *skb_eth_gso_segment(struct sk_buff *skb, -				    netdev_features_t features, __be16 type); -struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, -				    netdev_features_t features); -  struct netdev_bonding_info {  	ifslave	slave;  	ifbond	master; @@ -4856,11 +4853,6 @@ static inline void ethtool_notify(struct net_device *dev, unsigned int cmd,  }  #endif -static inline -struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) -{ -	return __skb_gso_segment(skb, features, true); -}  __be16 skb_network_protocol(struct sk_buff *skb, int *depth);  static inline bool can_checksum_protocol(netdev_features_t features, @@ -4987,6 +4979,7 @@ netdev_features_t passthru_features_check(struct sk_buff *skb,  					  struct net_device *dev,  					  netdev_features_t features);  netdev_features_t netif_skb_features(struct sk_buff *skb); +void skb_warn_bad_offload(const struct sk_buff *skb);  static inline bool net_gso_ok(netdev_features_t features, int gso_type)  { @@ -5035,19 +5028,6 @@ void netif_set_tso_max_segs(struct net_device *dev, unsigned int segs);  void netif_inherit_tso_max(struct net_device *to,  			   const struct net_device *from); -static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol, -					int pulled_hlen, u16 mac_offset, -					int mac_len) -{ -	skb->protocol = protocol; -	skb->encapsulation = 1; -	skb_push(skb, pulled_hlen); -	skb_reset_transport_header(skb); -	skb->mac_header = mac_offset; -	skb->network_header = skb->mac_header + mac_len; -	skb->mac_len = mac_len; -} -  static inline bool netif_is_macsec(const struct net_device *dev)  {  	return dev->priv_flags & IFF_MACSEC; @@ -5093,6 +5073,15 @@ static inline bool netif_is_l3_slave(const struct net_device *dev)  	return dev->priv_flags & IFF_L3MDEV_SLAVE;  } +static inline int dev_sdif(const struct net_device *dev) +{ +#ifdef CONFIG_NET_L3_MASTER_DEV +	if (netif_is_l3_slave(dev)) +		return dev->ifindex; +#endif +	return 0; +} +  static inline bool netif_is_bridge_master(const struct net_device *dev)  {  	return dev->priv_flags & IFF_EBRIDGE; diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 0762444e3767..d4fed4c508ca 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -481,7 +481,7 @@ struct nfnl_ct_hook {  };  extern const struct nfnl_ct_hook __rcu *nfnl_ct_hook; -/** +/*   * nf_skb_duplicated - TEE target has sent a packet   *   * When a xtables target sends a packet, the OUTPUT and POSTROUTING @@ -492,7 +492,7 @@ extern const struct nfnl_ct_hook __rcu *nfnl_ct_hook;   */  DECLARE_PER_CPU(bool, nf_skb_duplicated); -/** +/*   * Contains bitmask of ctnetlink event subscribers, if any.   * Can't be pernet due to NETLINK_LISTEN_ALL_NSID setsockopt flag.   */ diff --git a/include/linux/netfs.h b/include/linux/netfs.h index a1f3522daa69..b11a84f6c32b 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -300,10 +300,6 @@ void netfs_stats_show(struct seq_file *);  ssize_t netfs_extract_user_iter(struct iov_iter *orig, size_t orig_len,  				struct iov_iter *new,  				iov_iter_extraction_t extraction_flags); -struct sg_table; -ssize_t netfs_extract_iter_to_sg(struct iov_iter *iter, size_t len, -				 struct sg_table *sgtable, unsigned int sg_max, -				 iov_iter_extraction_t extraction_flags);  /**   * netfs_inode - Get the netfs inode context from the inode diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 19c0791ed9d5..9eec3f4f5351 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -311,6 +311,7 @@ struct netlink_dump_control {  	int (*start)(struct netlink_callback *);  	int (*dump)(struct sk_buff *skb, struct netlink_callback *);  	int (*done)(struct netlink_callback *); +	struct netlink_ext_ack *extack;  	void *data;  	struct module *module;  	u32 min_dump_alloc; diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index ea2f7e6b1b0b..20eeba8b009d 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -63,7 +63,8 @@ struct nfs_client {  	u32			cl_minorversion;/* NFSv4 minorversion */  	unsigned int		cl_nconnect;	/* Number of connections */  	unsigned int		cl_max_connect; /* max number of xprts allowed */ -	const char *		cl_principal;  /* used for machine cred */ +	const char *		cl_principal;	/* used for machine cred */ +	struct xprtsec_parms	cl_xprtsec;	/* xprt security policy */  #if IS_ENABLED(CONFIG_NFS_V4)  	struct list_head	cl_ds_clients; /* auth flavor data servers */ @@ -153,6 +154,7 @@ struct nfs_server {  #define NFS_MOUNT_WRITE_EAGER		0x01000000  #define NFS_MOUNT_WRITE_WAIT		0x02000000  #define NFS_MOUNT_TRUNK_DISCOVERY	0x04000000 +#define NFS_MOUNT_SHUTDOWN			0x08000000  	unsigned int		fattr_valid;	/* Valid attributes */  	unsigned int		caps;		/* server capabilities */ @@ -183,6 +185,7 @@ struct nfs_server {  				change_attr_type;/* Description of change attribute */  	struct nfs_fsid		fsid; +	int			s_sysfs_id;	/* sysfs dentry index */  	__u64			maxfilesize;	/* maximum file size */  	struct timespec64	time_delta;	/* smallest time granularity */  	unsigned long		mount_time;	/* when this fs was mounted */ @@ -259,6 +262,7 @@ struct nfs_server {  	/* User namespace info */  	const struct cred	*cred;  	bool			has_sec_mnt_opts; +	struct kobject		kobj;  };  /* Server capabilities */ diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 29a1b39794bf..12bbb5c63664 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1528,6 +1528,7 @@ struct nfs42_seek_res {  struct nfs42_setxattrargs {  	struct nfs4_sequence_args	seq_args;  	struct nfs_fh			*fh; +	const u32			*bitmask;  	const char			*xattr_name;  	u32				xattr_flags;  	size_t				xattr_len; @@ -1537,6 +1538,8 @@ struct nfs42_setxattrargs {  struct nfs42_setxattrres {  	struct nfs4_sequence_res	seq_res;  	struct nfs4_change_info		cinfo; +	struct nfs_fattr		*fattr; +	const struct nfs_server		*server;  };  struct nfs42_getxattrargs { diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 779507ac750b..182b6d614eb1 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -759,20 +759,55 @@ enum {  	NVME_LBART_ATTRIB_HIDE	= 1 << 1,  }; +enum nvme_pr_type { +	NVME_PR_WRITE_EXCLUSIVE			= 1, +	NVME_PR_EXCLUSIVE_ACCESS		= 2, +	NVME_PR_WRITE_EXCLUSIVE_REG_ONLY	= 3, +	NVME_PR_EXCLUSIVE_ACCESS_REG_ONLY	= 4, +	NVME_PR_WRITE_EXCLUSIVE_ALL_REGS	= 5, +	NVME_PR_EXCLUSIVE_ACCESS_ALL_REGS	= 6, +}; + +enum nvme_eds { +	NVME_EXTENDED_DATA_STRUCT	= 0x1, +}; + +struct nvme_registered_ctrl { +	__le16	cntlid; +	__u8	rcsts; +	__u8	rsvd3[5]; +	__le64	hostid; +	__le64	rkey; +}; +  struct nvme_reservation_status {  	__le32	gen;  	__u8	rtype;  	__u8	regctl[2];  	__u8	resv5[2];  	__u8	ptpls; -	__u8	resv10[13]; -	struct { -		__le16	cntlid; -		__u8	rcsts; -		__u8	resv3[5]; -		__le64	hostid; -		__le64	rkey; -	} regctl_ds[]; +	__u8	resv10[14]; +	struct nvme_registered_ctrl regctl_ds[]; +}; + +struct nvme_registered_ctrl_ext { +	__le16	cntlid; +	__u8	rcsts; +	__u8	rsvd3[5]; +	__le64	rkey; +	__u8	hostid[16]; +	__u8	rsvd32[32]; +}; + +struct nvme_reservation_status_ext { +	__le32	gen; +	__u8	rtype; +	__u8	regctl[2]; +	__u8	resv5[2]; +	__u8	ptpls; +	__u8	resv10[14]; +	__u8	rsvd24[40]; +	struct nvme_registered_ctrl_ext regctl_eds[];  };  enum nvme_async_event_type { diff --git a/include/linux/parport.h b/include/linux/parport.h index a0bc9e0267b7..999eddd619b7 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -180,6 +180,8 @@ struct ieee1284_info {  	struct semaphore irq;  }; +#define PARPORT_NAME_MAX_LEN 15 +  /* A parallel port */  struct parport {  	unsigned long base;	/* base address */ @@ -514,7 +516,7 @@ extern int parport_device_proc_register(struct pardevice *device);  extern int parport_device_proc_unregister(struct pardevice *device);  /* If PC hardware is the only type supported, we can optimise a bit.  */ -#if !defined(CONFIG_PARPORT_NOT_PC) +#if !defined(CONFIG_PARPORT_NOT_PC) && defined(CONFIG_PARPORT_PC)  #include <linux/parport_pc.h>  #define parport_write_data(p,x)            parport_pc_write_data(p,x) diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index 301bb0e53707..5cb694031072 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -203,7 +203,9 @@ void pci_epc_destroy(struct pci_epc *epc);  int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf,  		    enum pci_epc_interface_type type);  void pci_epc_linkup(struct pci_epc *epc); +void pci_epc_linkdown(struct pci_epc *epc);  void pci_epc_init_notify(struct pci_epc *epc); +void pci_epc_bme_notify(struct pci_epc *epc);  void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf,  			enum pci_epc_interface_type type);  int pci_epc_write_header(struct pci_epc *epc, u8 func_no, u8 vfunc_no, diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index a215dc8ce693..3f44b6aec477 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -71,10 +71,14 @@ struct pci_epf_ops {   * struct pci_epf_event_ops - Callbacks for capturing the EPC events   * @core_init: Callback for the EPC initialization complete event   * @link_up: Callback for the EPC link up event + * @link_down: Callback for the EPC link down event + * @bme: Callback for the EPC BME (Bus Master Enable) event   */  struct pci_epc_event_ops {  	int (*core_init)(struct pci_epf *epf);  	int (*link_up)(struct pci_epf *epf); +	int (*link_down)(struct pci_epf *epf); +	int (*bme)(struct pci_epf *epf);  };  /** @@ -89,7 +93,8 @@ struct pci_epc_event_ops {   * @id_table: identifies EPF devices for probing   */  struct pci_epf_driver { -	int	(*probe)(struct pci_epf *epf); +	int	(*probe)(struct pci_epf *epf, +			 const struct pci_epf_device_id *id);  	void	(*remove)(struct pci_epf *epf);  	struct device_driver	driver; @@ -131,6 +136,7 @@ struct pci_epf_bar {   * @epc: the EPC device to which this EPF device is bound   * @epf_pf: the physical EPF device to which this virtual EPF device is bound   * @driver: the EPF driver to which this EPF device is bound + * @id: Pointer to the EPF device ID   * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc   * @lock: mutex to protect pci_epf_ops   * @sec_epc: the secondary EPC device to which this EPF device is bound @@ -158,6 +164,7 @@ struct pci_epf {  	struct pci_epc		*epc;  	struct pci_epf		*epf_pf;  	struct pci_epf_driver	*driver; +	const struct pci_epf_device_id *id;  	struct list_head	list;  	/* mutex to protect against concurrent access of pci_epf_ops */  	struct mutex		lock; @@ -214,8 +221,6 @@ void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar,  			enum pci_epc_interface_type type);  int pci_epf_bind(struct pci_epf *epf);  void pci_epf_unbind(struct pci_epf *epf); -struct config_group *pci_epf_type_add_cfs(struct pci_epf *epf, -					  struct config_group *group);  int pci_epf_add_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf);  void pci_epf_remove_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf);  #endif /* __LINUX_PCI_EPF_H */ diff --git a/include/linux/pci.h b/include/linux/pci.h index 60b8772b5bd4..c69a2cc1f412 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1903,6 +1903,7 @@ static inline int pci_dev_present(const struct pci_device_id *ids)  #define pci_dev_put(dev)	do { } while (0)  static inline void pci_set_master(struct pci_dev *dev) { } +static inline void pci_clear_master(struct pci_dev *dev) { }  static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; }  static inline void pci_disable_device(struct pci_dev *dev) { }  static inline int pcim_enable_device(struct pci_dev *pdev) { return -EIO; } diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index a99b1fcfc617..2dc75df1437f 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2,7 +2,7 @@  /*   *	PCI Class, Vendor and Device IDs   * - *	Please keep sorted. + *	Please keep sorted by numeric Vendor ID and Device ID.   *   *	Do not add new entries to this file unless the definitions   *	are shared between multiple drivers. @@ -151,6 +151,9 @@  #define PCI_CLASS_SP_DPIO		0x1100  #define PCI_CLASS_SP_OTHER		0x1180 +#define PCI_BASE_CLASS_ACCELERATOR	0x12 +#define PCI_CLASS_ACCELERATOR_PROCESSING	0x1200 +  #define PCI_CLASS_OTHERS		0xff  /* Vendors and devices.  Sort key: vendor first, device next. */ @@ -158,6 +161,11 @@  #define PCI_VENDOR_ID_LOONGSON		0x0014 +#define PCI_DEVICE_ID_LOONGSON_HDA      0x7a07 +#define PCI_DEVICE_ID_LOONGSON_HDMI     0x7a37 + +#define PCI_VENDOR_ID_SOLIDIGM		0x025e +  #define PCI_VENDOR_ID_TTTECH		0x0357  #define PCI_DEVICE_ID_TTTECH_MC322	0x000a diff --git a/include/linux/pcs-altera-tse.h b/include/linux/pcs-altera-tse.h deleted file mode 100644 index 92ab9f08e835..000000000000 --- a/include/linux/pcs-altera-tse.h +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2022 Bootlin - * - * Maxime Chevallier <[email protected]> - */ - -#ifndef __LINUX_PCS_ALTERA_TSE_H -#define __LINUX_PCS_ALTERA_TSE_H - -struct phylink_pcs; -struct net_device; - -struct phylink_pcs *alt_tse_pcs_create(struct net_device *ndev, -				       void __iomem *pcs_base, int reg_width); - -#endif /* __LINUX_PCS_ALTERA_TSE_H */ diff --git a/include/linux/pcs-lynx.h b/include/linux/pcs-lynx.h index 5712cc2ce775..7958cccd16f2 100644 --- a/include/linux/pcs-lynx.h +++ b/include/linux/pcs-lynx.h @@ -9,9 +9,8 @@  #include <linux/mdio.h>  #include <linux/phylink.h> -struct mdio_device *lynx_get_mdio_device(struct phylink_pcs *pcs); - -struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio); +struct phylink_pcs *lynx_pcs_create_mdiodev(struct mii_bus *bus, int addr); +struct phylink_pcs *lynx_pcs_create_fwnode(struct fwnode_handle *node);  void lynx_pcs_destroy(struct phylink_pcs *pcs); diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index d2da1e0b4a92..ff99cf7a5d0d 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -18,6 +18,7 @@  #define DW_AN_C37_SGMII			2  #define DW_2500BASEX			3  #define DW_AN_C37_1000BASEX		4 +#define DW_10GBASER			5  struct xpcs_id; @@ -28,15 +29,15 @@ struct dw_xpcs {  };  int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface); -void xpcs_link_up(struct phylink_pcs *pcs, unsigned int mode, +void xpcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,  		  phy_interface_t interface, int speed, int duplex);  int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, -		   unsigned int mode, const unsigned long *advertising); +		   const unsigned long *advertising, unsigned int neg_mode);  void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces);  int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,  		    int enable); -struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev, -			    phy_interface_t interface); +struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr, +				    phy_interface_t interface);  void xpcs_destroy(struct dw_xpcs *xpcs);  #endif /* __LINUX_PCS_XPCS_H */ diff --git a/include/linux/pds/pds_adminq.h b/include/linux/pds/pds_adminq.h index 98a60ce87b92..bcba7fda3cc9 100644 --- a/include/linux/pds/pds_adminq.h +++ b/include/linux/pds/pds_adminq.h @@ -222,6 +222,27 @@ enum pds_core_lif_type {  	PDS_CORE_LIF_TYPE_DEFAULT = 0,  }; +#define PDS_CORE_IFNAMSIZ		16 + +/** + * enum pds_core_logical_qtype - Logical Queue Types + * @PDS_CORE_QTYPE_ADMINQ:    Administrative Queue + * @PDS_CORE_QTYPE_NOTIFYQ:   Notify Queue + * @PDS_CORE_QTYPE_RXQ:       Receive Queue + * @PDS_CORE_QTYPE_TXQ:       Transmit Queue + * @PDS_CORE_QTYPE_EQ:        Event Queue + * @PDS_CORE_QTYPE_MAX:       Max queue type supported + */ +enum pds_core_logical_qtype { +	PDS_CORE_QTYPE_ADMINQ  = 0, +	PDS_CORE_QTYPE_NOTIFYQ = 1, +	PDS_CORE_QTYPE_RXQ     = 2, +	PDS_CORE_QTYPE_TXQ     = 3, +	PDS_CORE_QTYPE_EQ      = 4, + +	PDS_CORE_QTYPE_MAX     = 16   /* don't change - used in struct size */ +}; +  /**   * union pds_core_lif_config - LIF configuration   * @state:	    LIF state (enum pds_core_lif_state) @@ -584,6 +605,219 @@ struct pds_core_q_init_comp {  	u8     color;  }; +/* + * enum pds_vdpa_cmd_opcode - vDPA Device commands + */ +enum pds_vdpa_cmd_opcode { +	PDS_VDPA_CMD_INIT		= 48, +	PDS_VDPA_CMD_IDENT		= 49, +	PDS_VDPA_CMD_RESET		= 51, +	PDS_VDPA_CMD_VQ_RESET		= 52, +	PDS_VDPA_CMD_VQ_INIT		= 53, +	PDS_VDPA_CMD_STATUS_UPDATE	= 54, +	PDS_VDPA_CMD_SET_FEATURES	= 55, +	PDS_VDPA_CMD_SET_ATTR		= 56, +}; + +/** + * struct pds_vdpa_cmd - generic command + * @opcode:	Opcode + * @vdpa_index:	Index for vdpa subdevice + * @vf_id:	VF id + */ +struct pds_vdpa_cmd { +	u8     opcode; +	u8     vdpa_index; +	__le16 vf_id; +}; + +/** + * struct pds_vdpa_init_cmd - INIT command + * @opcode:	Opcode PDS_VDPA_CMD_INIT + * @vdpa_index: Index for vdpa subdevice + * @vf_id:	VF id + */ +struct pds_vdpa_init_cmd { +	u8     opcode; +	u8     vdpa_index; +	__le16 vf_id; +}; + +/** + * struct pds_vdpa_ident - vDPA identification data + * @hw_features:	vDPA features supported by device + * @max_vqs:		max queues available (2 queues for a single queuepair) + * @max_qlen:		log(2) of maximum number of descriptors + * @min_qlen:		log(2) of minimum number of descriptors + * + * This struct is used in a DMA block that is set up for the PDS_VDPA_CMD_IDENT + * transaction.  Set up the DMA block and send the address in the IDENT cmd + * data, the DSC will write the ident information, then we can remove the DMA + * block after reading the answer.  If the completion status is 0, then there + * is valid information, else there was an error and the data should be invalid. + */ +struct pds_vdpa_ident { +	__le64 hw_features; +	__le16 max_vqs; +	__le16 max_qlen; +	__le16 min_qlen; +}; + +/** + * struct pds_vdpa_ident_cmd - IDENT command + * @opcode:	Opcode PDS_VDPA_CMD_IDENT + * @rsvd:       Word boundary padding + * @vf_id:	VF id + * @len:	length of ident info DMA space + * @ident_pa:	address for DMA of ident info (struct pds_vdpa_ident) + *			only used for this transaction, then forgotten by DSC + */ +struct pds_vdpa_ident_cmd { +	u8     opcode; +	u8     rsvd; +	__le16 vf_id; +	__le32 len; +	__le64 ident_pa; +}; + +/** + * struct pds_vdpa_status_cmd - STATUS_UPDATE command + * @opcode:	Opcode PDS_VDPA_CMD_STATUS_UPDATE + * @vdpa_index: Index for vdpa subdevice + * @vf_id:	VF id + * @status:	new status bits + */ +struct pds_vdpa_status_cmd { +	u8     opcode; +	u8     vdpa_index; +	__le16 vf_id; +	u8     status; +}; + +/** + * enum pds_vdpa_attr - List of VDPA device attributes + * @PDS_VDPA_ATTR_MAC:          MAC address + * @PDS_VDPA_ATTR_MAX_VQ_PAIRS: Max virtqueue pairs + */ +enum pds_vdpa_attr { +	PDS_VDPA_ATTR_MAC          = 1, +	PDS_VDPA_ATTR_MAX_VQ_PAIRS = 2, +}; + +/** + * struct pds_vdpa_setattr_cmd - SET_ATTR command + * @opcode:		Opcode PDS_VDPA_CMD_SET_ATTR + * @vdpa_index:		Index for vdpa subdevice + * @vf_id:		VF id + * @attr:		attribute to be changed (enum pds_vdpa_attr) + * @pad:		Word boundary padding + * @mac:		new mac address to be assigned as vdpa device address + * @max_vq_pairs:	new limit of virtqueue pairs + */ +struct pds_vdpa_setattr_cmd { +	u8     opcode; +	u8     vdpa_index; +	__le16 vf_id; +	u8     attr; +	u8     pad[3]; +	union { +		u8 mac[6]; +		__le16 max_vq_pairs; +	} __packed; +}; + +/** + * struct pds_vdpa_vq_init_cmd - queue init command + * @opcode: Opcode PDS_VDPA_CMD_VQ_INIT + * @vdpa_index:	Index for vdpa subdevice + * @vf_id:	VF id + * @qid:	Queue id (bit0 clear = rx, bit0 set = tx, qid=N is ctrlq) + * @len:	log(2) of max descriptor count + * @desc_addr:	DMA address of descriptor area + * @avail_addr:	DMA address of available descriptors (aka driver area) + * @used_addr:	DMA address of used descriptors (aka device area) + * @intr_index:	interrupt index + * @avail_index:	initial device position in available ring + * @used_index:	initial device position in used ring + */ +struct pds_vdpa_vq_init_cmd { +	u8     opcode; +	u8     vdpa_index; +	__le16 vf_id; +	__le16 qid; +	__le16 len; +	__le64 desc_addr; +	__le64 avail_addr; +	__le64 used_addr; +	__le16 intr_index; +	__le16 avail_index; +	__le16 used_index; +}; + +/** + * struct pds_vdpa_vq_init_comp - queue init completion + * @status:	Status of the command (enum pds_core_status_code) + * @hw_qtype:	HW queue type, used in doorbell selection + * @hw_qindex:	HW queue index, used in doorbell selection + * @rsvd:	Word boundary padding + * @color:	Color bit + */ +struct pds_vdpa_vq_init_comp { +	u8     status; +	u8     hw_qtype; +	__le16 hw_qindex; +	u8     rsvd[11]; +	u8     color; +}; + +/** + * struct pds_vdpa_vq_reset_cmd - queue reset command + * @opcode:	Opcode PDS_VDPA_CMD_VQ_RESET + * @vdpa_index:	Index for vdpa subdevice + * @vf_id:	VF id + * @qid:	Queue id + */ +struct pds_vdpa_vq_reset_cmd { +	u8     opcode; +	u8     vdpa_index; +	__le16 vf_id; +	__le16 qid; +}; + +/** + * struct pds_vdpa_vq_reset_comp - queue reset completion + * @status:	Status of the command (enum pds_core_status_code) + * @rsvd0:	Word boundary padding + * @avail_index:	current device position in available ring + * @used_index:	current device position in used ring + * @rsvd:	Word boundary padding + * @color:	Color bit + */ +struct pds_vdpa_vq_reset_comp { +	u8     status; +	u8     rsvd0; +	__le16 avail_index; +	__le16 used_index; +	u8     rsvd[9]; +	u8     color; +}; + +/** + * struct pds_vdpa_set_features_cmd - set hw features + * @opcode: Opcode PDS_VDPA_CMD_SET_FEATURES + * @vdpa_index:	Index for vdpa subdevice + * @vf_id:	VF id + * @rsvd:       Word boundary padding + * @features:	Feature bit mask + */ +struct pds_vdpa_set_features_cmd { +	u8     opcode; +	u8     vdpa_index; +	__le16 vf_id; +	__le32 rsvd; +	__le64 features; +}; +  union pds_core_adminq_cmd {  	u8     opcode;  	u8     bytes[64]; @@ -600,6 +834,16 @@ union pds_core_adminq_cmd {  	struct pds_core_q_identify_cmd    q_ident;  	struct pds_core_q_init_cmd        q_init; + +	struct pds_vdpa_cmd		  vdpa; +	struct pds_vdpa_init_cmd	  vdpa_init; +	struct pds_vdpa_ident_cmd	  vdpa_ident; +	struct pds_vdpa_status_cmd	  vdpa_status; +	struct pds_vdpa_setattr_cmd	  vdpa_setattr; +	struct pds_vdpa_set_features_cmd  vdpa_set_features; +	struct pds_vdpa_vq_init_cmd	  vdpa_vq_init; +	struct pds_vdpa_vq_reset_cmd	  vdpa_vq_reset; +  };  union pds_core_adminq_comp { @@ -621,6 +865,9 @@ union pds_core_adminq_comp {  	struct pds_core_q_identify_comp   q_ident;  	struct pds_core_q_init_comp       q_init; + +	struct pds_vdpa_vq_init_comp	  vdpa_vq_init; +	struct pds_vdpa_vq_reset_comp	  vdpa_vq_reset;  };  #ifndef __CHECKER__ diff --git a/include/linux/pds/pds_common.h b/include/linux/pds/pds_common.h index 060331486d50..435c8e8161c2 100644 --- a/include/linux/pds/pds_common.h +++ b/include/linux/pds/pds_common.h @@ -39,26 +39,7 @@ enum pds_core_vif_types {  #define PDS_DEV_TYPE_RDMA_STR	"RDMA"  #define PDS_DEV_TYPE_LM_STR	"LM" -#define PDS_CORE_IFNAMSIZ		16 - -/** - * enum pds_core_logical_qtype - Logical Queue Types - * @PDS_CORE_QTYPE_ADMINQ:    Administrative Queue - * @PDS_CORE_QTYPE_NOTIFYQ:   Notify Queue - * @PDS_CORE_QTYPE_RXQ:       Receive Queue - * @PDS_CORE_QTYPE_TXQ:       Transmit Queue - * @PDS_CORE_QTYPE_EQ:        Event Queue - * @PDS_CORE_QTYPE_MAX:       Max queue type supported - */ -enum pds_core_logical_qtype { -	PDS_CORE_QTYPE_ADMINQ  = 0, -	PDS_CORE_QTYPE_NOTIFYQ = 1, -	PDS_CORE_QTYPE_RXQ     = 2, -	PDS_CORE_QTYPE_TXQ     = 3, -	PDS_CORE_QTYPE_EQ      = 4, - -	PDS_CORE_QTYPE_MAX     = 16   /* don't change - used in struct size */ -}; +#define PDS_VDPA_DEV_NAME	PDS_CORE_DRV_NAME "." PDS_DEV_TYPE_VDPA_STR  int pdsc_register_notify(struct notifier_block *nb);  void pdsc_unregister_notify(struct notifier_block *nb); diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index b528be0e1f47..2166a69e3bf2 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -305,6 +305,7 @@ struct pmu {  	struct module			*module;  	struct device			*dev; +	struct device			*parent;  	const struct attribute_group	**attr_groups;  	const struct attribute_group	**attr_update;  	const char			*name; diff --git a/include/linux/phy.h b/include/linux/phy.h index 6478838405a0..11c1e91563d4 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -86,6 +86,7 @@ extern const int phy_10gbit_features_array[1];  #define PHY_IS_INTERNAL		0x00000001  #define PHY_RST_AFTER_CLK_EN	0x00000002  #define PHY_POLL_CABLE_TEST	0x00000004 +#define PHY_ALWAYS_CALL_SUSPEND	0x00000008  #define MDIO_DEVICE_IS_PHY	0x80000000  /** @@ -496,14 +497,17 @@ struct phy_device *mdiobus_scan_c22(struct mii_bus *bus, int addr);   * Once complete, move to UP to restart the PHY.   * - phy_stop aborts the running test and moves to @PHY_HALTED   * - * @PHY_HALTED: PHY is up, but no polling or interrupts are done. Or - * PHY is in an error state. + * @PHY_HALTED: PHY is up, but no polling or interrupts are done.   * - phy_start moves to @PHY_UP + * + * @PHY_ERROR: PHY is up, but is in an error state. + * - phy_stop moves to @PHY_HALTED   */  enum phy_state {  	PHY_DOWN = 0,  	PHY_READY,  	PHY_HALTED, +	PHY_ERROR,  	PHY_UP,  	PHY_RUNNING,  	PHY_NOLINK, @@ -548,6 +552,8 @@ struct macsec_ops;   * @downshifted_rate: Set true if link speed has been downshifted.   * @is_on_sfp_module: Set true if PHY is located on an SFP module.   * @mac_managed_pm: Set true if MAC driver takes of suspending/resuming PHY + * @wol_enabled: Set to true if the PHY or the attached MAC have Wake-on-LAN + * 		 enabled.   * @state: State of the PHY for management purposes   * @dev_flags: Device-specific flags used by the PHY driver.   * @@ -644,6 +650,7 @@ struct phy_device {  	unsigned downshifted_rate:1;  	unsigned is_on_sfp_module:1;  	unsigned mac_managed_pm:1; +	unsigned wol_enabled:1;  	unsigned autoneg:1;  	/* The most recently read link state */ @@ -1108,6 +1115,34 @@ struct phy_driver {  #define PHY_ID_MATCH_MODEL(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 4)  #define PHY_ID_MATCH_VENDOR(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 10) +/** + * phy_id_compare - compare @id1 with @id2 taking account of @mask + * @id1: first PHY ID + * @id2: second PHY ID + * @mask: the PHY ID mask, set bits are significant in matching + * + * Return true if the bits from @id1 and @id2 specified by @mask match. + * This uses an equivalent test to (@id & @mask) == (@phy_id & @mask). + */ +static inline bool phy_id_compare(u32 id1, u32 id2, u32 mask) +{ +	return !((id1 ^ id2) & mask); +} + +/** + * phydev_id_compare - compare @id with the PHY's Clause 22 ID + * @phydev: the PHY device + * @id: the PHY ID to be matched + * + * Compare the @phydev clause 22 ID with the provided @id and return true or + * false depending whether it matches, using the bound driver mask. The + * @phydev must be bound to a driver. + */ +static inline bool phydev_id_compare(struct phy_device *phydev, u32 id) +{ +	return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask); +} +  /* A Structure for boards to register fixups with the PHY Lib */  struct phy_fixup {  	struct list_head list; @@ -1171,10 +1206,12 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum)  #define phy_read_poll_timeout(phydev, regnum, val, cond, sleep_us, \  				timeout_us, sleep_before_read) \  ({ \ -	int __ret = read_poll_timeout(phy_read, val, val < 0 || (cond), \ +	int __ret, __val; \ +	__ret = read_poll_timeout(__val = phy_read, val, \ +				  __val < 0 || (cond), \  		sleep_us, timeout_us, sleep_before_read, phydev, regnum); \ -	if (val < 0) \ -		__ret = val; \ +	if (__val < 0) \ +		__ret = __val; \  	if (__ret) \  		phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \  	__ret; \ @@ -1267,11 +1304,13 @@ int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);  #define phy_read_mmd_poll_timeout(phydev, devaddr, regnum, val, cond, \  				  sleep_us, timeout_us, sleep_before_read) \  ({ \ -	int __ret = read_poll_timeout(phy_read_mmd, val, (cond) || val < 0, \ +	int __ret, __val; \ +	__ret = read_poll_timeout(__val = phy_read_mmd, val, \ +				  __val < 0 || (cond), \  				  sleep_us, timeout_us, sleep_before_read, \  				  phydev, devaddr, regnum); \ -	if (val <  0) \ -		__ret = val; \ +	if (__val < 0) \ +		__ret = __val; \  	if (__ret) \  		phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \  	__ret; \ diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 71755c66c162..1817940a3418 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -21,6 +21,24 @@ enum {  	MLO_AN_FIXED,	/* Fixed-link mode */  	MLO_AN_INBAND,	/* In-band protocol */ +	/* PCS "negotiation" mode. +	 *  PHYLINK_PCS_NEG_NONE - protocol has no inband capability +	 *  PHYLINK_PCS_NEG_OUTBAND - some out of band or fixed link setting +	 *  PHYLINK_PCS_NEG_INBAND_DISABLED - inband mode disabled, e.g. +	 *				      1000base-X with autoneg off +	 *  PHYLINK_PCS_NEG_INBAND_ENABLED - inband mode enabled +	 * Additionally, this can be tested using bitmasks: +	 *  PHYLINK_PCS_NEG_INBAND - inband mode selected +	 *  PHYLINK_PCS_NEG_ENABLED - negotiation mode enabled +	 */ +	PHYLINK_PCS_NEG_NONE = 0, +	PHYLINK_PCS_NEG_ENABLED = BIT(4), +	PHYLINK_PCS_NEG_OUTBAND = BIT(5), +	PHYLINK_PCS_NEG_INBAND = BIT(6), +	PHYLINK_PCS_NEG_INBAND_DISABLED = PHYLINK_PCS_NEG_INBAND, +	PHYLINK_PCS_NEG_INBAND_ENABLED = PHYLINK_PCS_NEG_INBAND | +					 PHYLINK_PCS_NEG_ENABLED, +  	/* MAC_SYM_PAUSE and MAC_ASYM_PAUSE are used when configuring our  	 * autonegotiation advertisement. They correspond to the PAUSE and  	 * ASM_DIR bits defined by 802.3, respectively. @@ -80,6 +98,72 @@ static inline bool phylink_autoneg_inband(unsigned int mode)  }  /** + * phylink_pcs_neg_mode() - helper to determine PCS inband mode + * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. + * @interface: interface mode to be used + * @advertising: adertisement ethtool link mode mask + * + * Determines the negotiation mode to be used by the PCS, and returns + * one of: + * + * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband + * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY) + *   will be used. + * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg + *   disabled + * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled + * + * Note: this is for cases where the PCS itself is involved in negotiation + * (e.g. Clause 37, SGMII and similar) not Clause 73. + */ +static inline unsigned int phylink_pcs_neg_mode(unsigned int mode, +						phy_interface_t interface, +						const unsigned long *advertising) +{ +	unsigned int neg_mode; + +	switch (interface) { +	case PHY_INTERFACE_MODE_SGMII: +	case PHY_INTERFACE_MODE_QSGMII: +	case PHY_INTERFACE_MODE_QUSGMII: +	case PHY_INTERFACE_MODE_USXGMII: +		/* These protocols are designed for use with a PHY which +		 * communicates its negotiation result back to the MAC via +		 * inband communication. Note: there exist PHYs that run +		 * with SGMII but do not send the inband data. +		 */ +		if (!phylink_autoneg_inband(mode)) +			neg_mode = PHYLINK_PCS_NEG_OUTBAND; +		else +			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; +		break; + +	case PHY_INTERFACE_MODE_1000BASEX: +	case PHY_INTERFACE_MODE_2500BASEX: +		/* 1000base-X is designed for use media-side for Fibre +		 * connections, and thus the Autoneg bit needs to be +		 * taken into account. We also do this for 2500base-X +		 * as well, but drivers may not support this, so may +		 * need to override this. +		 */ +		if (!phylink_autoneg_inband(mode)) +			neg_mode = PHYLINK_PCS_NEG_OUTBAND; +		else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, +					   advertising)) +			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED; +		else +			neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED; +		break; + +	default: +		neg_mode = PHYLINK_PCS_NEG_NONE; +		break; +	} + +	return neg_mode; +} + +/**   * struct phylink_link_state - link state structure   * @advertising: ethtool bitmask containing advertised link modes   * @lp_advertising: ethtool bitmask containing link partner advertised link @@ -436,6 +520,7 @@ struct phylink_pcs_ops;  /**   * struct phylink_pcs - PHYLINK PCS instance   * @ops: a pointer to the &struct phylink_pcs_ops structure + * @neg_mode: provide PCS neg mode via "mode" argument   * @poll: poll the PCS for link changes   *   * This structure is designed to be embedded within the PCS private data, @@ -443,6 +528,7 @@ struct phylink_pcs_ops;   */  struct phylink_pcs {  	const struct phylink_pcs_ops *ops; +	bool neg_mode;  	bool poll;  }; @@ -460,12 +546,12 @@ struct phylink_pcs_ops {  			    const struct phylink_link_state *state);  	void (*pcs_get_state)(struct phylink_pcs *pcs,  			      struct phylink_link_state *state); -	int (*pcs_config)(struct phylink_pcs *pcs, unsigned int mode, +	int (*pcs_config)(struct phylink_pcs *pcs, unsigned int neg_mode,  			  phy_interface_t interface,  			  const unsigned long *advertising,  			  bool permit_pause_to_mac);  	void (*pcs_an_restart)(struct phylink_pcs *pcs); -	void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int mode, +	void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int neg_mode,  			    phy_interface_t interface, int speed, int duplex);  }; @@ -508,7 +594,7 @@ void pcs_get_state(struct phylink_pcs *pcs,  /**   * pcs_config() - Configure the PCS mode and advertisement   * @pcs: a pointer to a &struct phylink_pcs. - * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. + * @neg_mode: link negotiation mode (see below)   * @interface: interface mode to be used   * @advertising: adertisement ethtool link mode mask   * @permit_pause_to_mac: permit forwarding pause resolution to MAC @@ -526,8 +612,12 @@ void pcs_get_state(struct phylink_pcs *pcs,   * For 1000BASE-X, the advertisement should be programmed into the PCS.   *   * For most 10GBASE-R, there is no advertisement. + * + * The %neg_mode argument should be tested via the phylink_mode_*() family of + * functions, or for PCS that set pcs->neg_mode true, should be tested + * against the %PHYLINK_PCS_NEG_* definitions.   */ -int pcs_config(struct phylink_pcs *pcs, unsigned int mode, +int pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,  	       phy_interface_t interface, const unsigned long *advertising,  	       bool permit_pause_to_mac); @@ -543,7 +633,7 @@ void pcs_an_restart(struct phylink_pcs *pcs);  /**   * pcs_link_up() - program the PCS for the resolved link configuration   * @pcs: a pointer to a &struct phylink_pcs. - * @mode: link autonegotiation mode + * @neg_mode: link negotiation mode (see below)   * @interface: link &typedef phy_interface_t mode   * @speed: link speed   * @duplex: link duplex @@ -552,8 +642,12 @@ void pcs_an_restart(struct phylink_pcs *pcs);   * the resolved link parameters. For example, a PCS operating in SGMII   * mode without in-band AN needs to be manually configured for the link   * and duplex setting. Otherwise, this should be a no-op. + * + * The %mode argument should be tested via the phylink_mode_*() family of + * functions, or for PCS that set pcs->neg_mode true, should be tested + * against the %PHYLINK_PCS_NEG_* definitions.   */ -void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, +void pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,  		 phy_interface_t interface, int speed, int duplex);  #endif @@ -568,16 +662,17 @@ void phylink_generic_validate(struct phylink_config *config,  			      unsigned long *supported,  			      struct phylink_link_state *state); -struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *, -			       phy_interface_t iface, -			       const struct phylink_mac_ops *mac_ops); +struct phylink *phylink_create(struct phylink_config *, +			       const struct fwnode_handle *, +			       phy_interface_t, +			       const struct phylink_mac_ops *);  void phylink_destroy(struct phylink *);  bool phylink_expects_phy(struct phylink *pl);  int phylink_connect_phy(struct phylink *, struct phy_device *);  int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);  int phylink_fwnode_phy_connect(struct phylink *pl, -			       struct fwnode_handle *fwnode, +			       const struct fwnode_handle *fwnode,  			       u32 flags);  void phylink_disconnect_phy(struct phylink *); @@ -650,11 +745,14 @@ void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,  				   struct phylink_link_state *state);  int phylink_mii_c22_pcs_encode_advertisement(phy_interface_t interface,  					     const unsigned long *advertising); -int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, +int phylink_mii_c22_pcs_config(struct mdio_device *pcs,  			       phy_interface_t interface, -			       const unsigned long *advertising); +			       const unsigned long *advertising, +			       unsigned int neg_mode);  void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs); +void phylink_resolve_c73(struct phylink_link_state *state); +  void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs,  				   struct phylink_link_state *state); diff --git a/include/linux/pid.h b/include/linux/pid.h index b75de288a8c2..653a527574c4 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -67,7 +67,7 @@ struct pid  	/* wait queue for pidfd notifications */  	wait_queue_head_t wait_pidfd;  	struct rcu_head rcu; -	struct upid numbers[1]; +	struct upid numbers[];  };  extern struct pid init_struct_pid; diff --git a/include/linux/platform_data/asoc-pxa.h b/include/linux/platform_data/asoc-pxa.h index 327454cd8246..7b5b9e20fbf5 100644 --- a/include/linux/platform_data/asoc-pxa.h +++ b/include/linux/platform_data/asoc-pxa.h @@ -27,5 +27,6 @@ typedef struct {  } pxa2xx_audio_ops_t;  extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops); +extern void pxa27x_configure_ac97reset(int reset_gpio, bool to_gpio);  #endif diff --git a/include/linux/platform_data/davinci-cpufreq.h b/include/linux/platform_data/davinci-cpufreq.h index bc208c64e3d7..1ef91c36f609 100644 --- a/include/linux/platform_data/davinci-cpufreq.h +++ b/include/linux/platform_data/davinci-cpufreq.h @@ -16,4 +16,10 @@ struct davinci_cpufreq_config {  	int (*init)(void);  }; +#ifdef CONFIG_CPU_FREQ +int davinci_cpufreq_init(void); +#else +static inline int davinci_cpufreq_init(void) { return 0; } +#endif +  #endif /* _MACH_DAVINCI_CPUFREQ_H */ diff --git a/include/linux/platform_data/lcd-mipid.h b/include/linux/platform_data/lcd-mipid.h index 63f05eb23827..4927cfc5158c 100644 --- a/include/linux/platform_data/lcd-mipid.h +++ b/include/linux/platform_data/lcd-mipid.h @@ -15,10 +15,8 @@ enum mipid_test_result {  #ifdef __KERNEL__  struct mipid_platform_data { -	int	nreset_gpio;  	int	data_lines; -	void	(*shutdown)(struct mipid_platform_data *pdata);  	void	(*set_bklight_level)(struct mipid_platform_data *pdata,  				     int level);  	int	(*get_bklight_level)(struct mipid_platform_data *pdata); diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h index 3441064713a3..3cc8db0b12b5 100644 --- a/include/linux/platform_data/leds-lp55xx.h +++ b/include/linux/platform_data/leds-lp55xx.h @@ -73,6 +73,9 @@ struct lp55xx_platform_data {  	/* Clock configuration */  	u8 clock_mode; +	/* Charge pump mode */ +	u32 charge_pump_mode; +  	/* optional enable GPIO */  	struct gpio_desc *enable_gpiod; diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h index 91051e9907f3..054d0c3c5ec5 100644 --- a/include/linux/platform_data/mmc-omap.h +++ b/include/linux/platform_data/mmc-omap.h @@ -20,8 +20,6 @@ struct omap_mmc_platform_data {  	 * maximum frequency on the MMC bus */  	unsigned int max_freq; -	/* switch the bus to a new slot */ -	int (*switch_slot)(struct device *dev, int slot);  	/* initialize board-specific MMC functionality, can be NULL if  	 * not supported */  	int (*init)(struct device *dev); diff --git a/include/linux/platform_data/pxa2xx_udc.h b/include/linux/platform_data/pxa2xx_udc.h index ff9c35dca59d..bc99cc6a3c5f 100644 --- a/include/linux/platform_data/pxa2xx_udc.h +++ b/include/linux/platform_data/pxa2xx_udc.h @@ -25,4 +25,10 @@ struct pxa2xx_udc_mach_info {  	int	gpio_pullup;			/* high == pullup activated */  }; +#ifdef CONFIG_PXA27x +extern void pxa27x_clear_otgph(void); +#else +#define pxa27x_clear_otgph()	do {} while (0) +#endif +  #endif diff --git a/include/linux/platform_data/sht3x.h b/include/linux/platform_data/sht3x.h deleted file mode 100644 index 14680d2a98f7..000000000000 --- a/include/linux/platform_data/sht3x.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2016 Sensirion AG, Switzerland - * Author: David Frey <[email protected]> - * Author: Pascal Sachs <[email protected]> - */ - -#ifndef __SHT3X_H_ -#define __SHT3X_H_ - -struct sht3x_platform_data { -	bool blocking_io; -	bool high_precision; -}; -#endif /* __SHT3X_H_ */ diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h index 897051e51b78..a657830232ae 100644 --- a/include/linux/platform_data/st_sensors_pdata.h +++ b/include/linux/platform_data/st_sensors_pdata.h @@ -15,7 +15,7 @@   * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2).   *	Available only for accelerometer, magnetometer and pressure sensors.   *	Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet). - *	Magnetometer DRDY is supported only on LSM9DS0. + *	Magnetometer DRDY is supported only on LSM9DS0 and LSM303D.   * @open_drain: set the interrupt line to be open drain if possible.   * @spi_3wire: enable spi-3wire mode.   * @pullups: enable/disable i2c controller pullup resistors. diff --git a/include/linux/pm.h b/include/linux/pm.h index 035d9649eba4..badad7d11f4f 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -375,23 +375,23 @@ const struct dev_pm_ops name = { \  }  #ifdef CONFIG_PM -#define _EXPORT_DEV_PM_OPS(name, sec, ns)				\ +#define _EXPORT_DEV_PM_OPS(name, license, ns)				\  	const struct dev_pm_ops name;					\ -	__EXPORT_SYMBOL(name, sec, ns);					\ +	__EXPORT_SYMBOL(name, license, ns);				\  	const struct dev_pm_ops name  #define EXPORT_PM_FN_GPL(name)		EXPORT_SYMBOL_GPL(name)  #define EXPORT_PM_FN_NS_GPL(name, ns)	EXPORT_SYMBOL_NS_GPL(name, ns)  #else -#define _EXPORT_DEV_PM_OPS(name, sec, ns)				\ +#define _EXPORT_DEV_PM_OPS(name, license, ns)				\  	static __maybe_unused const struct dev_pm_ops __static_##name  #define EXPORT_PM_FN_GPL(name)  #define EXPORT_PM_FN_NS_GPL(name, ns)  #endif  #define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "") -#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "_gpl", "") +#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "GPL", "")  #define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns) -#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "_gpl", #ns) +#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "GPL", #ns)  /*   * Use this if you want to use the same suspend and resume callbacks for suspend diff --git a/include/linux/pr.h b/include/linux/pr.h index 94ceec713afe..3003daec28a5 100644 --- a/include/linux/pr.h +++ b/include/linux/pr.h @@ -4,6 +4,18 @@  #include <uapi/linux/pr.h> +struct pr_keys { +	u32	generation; +	u32	num_keys; +	u64	keys[]; +}; + +struct pr_held_reservation { +	u64		key; +	u32		generation; +	enum pr_type	type; +}; +  struct pr_ops {  	int (*pr_register)(struct block_device *bdev, u64 old_key, u64 new_key,  			u32 flags); @@ -14,6 +26,19 @@ struct pr_ops {  	int (*pr_preempt)(struct block_device *bdev, u64 old_key, u64 new_key,  			enum pr_type type, bool abort);  	int (*pr_clear)(struct block_device *bdev, u64 key); +	/* +	 * pr_read_keys - Read the registered keys and return them in the +	 * pr_keys->keys array. The keys array will have been allocated at the +	 * end of the pr_keys struct, and pr_keys->num_keys must be set to the +	 * number of keys the array can hold. If there are more than can fit +	 * in the array, success will still be returned and pr_keys->num_keys +	 * will reflect the total number of keys the device contains, so the +	 * caller can retry with a larger array. +	 */ +	int (*pr_read_keys)(struct block_device *bdev, +			struct pr_keys *keys_info); +	int (*pr_read_reservation)(struct block_device *bdev, +			struct pr_held_reservation *rsv);  };  #endif /* LINUX_PR_H */ diff --git a/include/linux/property.h b/include/linux/property.h index 66df1a15d518..8c3c6685a2ae 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -85,6 +85,18 @@ bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char  	return fwnode_property_match_string(fwnode, "compatible", compat) >= 0;  } +/** + * device_is_compatible - match 'compatible' property of the device with a given string + * @dev: Pointer to the struct device + * @compat: The string to match 'compatible' property with + * + * Returns: true if matches, otherwise false. + */ +static inline bool device_is_compatible(const struct device *dev, const char *compat) +{ +	return fwnode_device_is_compatible(dev_fwnode(dev), compat); +} +  int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode,  				       const char *prop, const char *nargs_prop,  				       unsigned int nargs, unsigned int index, diff --git a/include/linux/pruss_driver.h b/include/linux/pruss_driver.h index ecfded30ed05..c9a31c567e85 100644 --- a/include/linux/pruss_driver.h +++ b/include/linux/pruss_driver.h @@ -9,7 +9,55 @@  #ifndef _PRUSS_DRIVER_H_  #define _PRUSS_DRIVER_H_ +#include <linux/mutex.h> +#include <linux/remoteproc/pruss.h>  #include <linux/types.h> +#include <linux/err.h> + +/* + * enum pruss_gp_mux_sel - PRUSS GPI/O Mux modes for the + * PRUSS_GPCFG0/1 registers + * + * NOTE: The below defines are the most common values, but there + * are some exceptions like on 66AK2G, where the RESERVED and MII2 + * values are interchanged. Also, this bit-field does not exist on + * AM335x SoCs + */ +enum pruss_gp_mux_sel { +	PRUSS_GP_MUX_SEL_GP, +	PRUSS_GP_MUX_SEL_ENDAT, +	PRUSS_GP_MUX_SEL_RESERVED, +	PRUSS_GP_MUX_SEL_SD, +	PRUSS_GP_MUX_SEL_MII2, +	PRUSS_GP_MUX_SEL_MAX, +}; + +/* + * enum pruss_gpi_mode - PRUSS GPI configuration modes, used + *			 to program the PRUSS_GPCFG0/1 registers + */ +enum pruss_gpi_mode { +	PRUSS_GPI_MODE_DIRECT, +	PRUSS_GPI_MODE_PARALLEL, +	PRUSS_GPI_MODE_28BIT_SHIFT, +	PRUSS_GPI_MODE_MII, +	PRUSS_GPI_MODE_MAX, +}; + +/** + * enum pru_type - PRU core type identifier + * + * @PRU_TYPE_PRU: Programmable Real-time Unit + * @PRU_TYPE_RTU: Auxiliary Programmable Real-Time Unit + * @PRU_TYPE_TX_PRU: Transmit Programmable Real-Time Unit + * @PRU_TYPE_MAX: just keep this one at the end + */ +enum pru_type { +	PRU_TYPE_PRU, +	PRU_TYPE_RTU, +	PRU_TYPE_TX_PRU, +	PRU_TYPE_MAX, +};  /*   * enum pruss_mem - PRUSS memory range identifiers @@ -39,6 +87,8 @@ struct pruss_mem_region {   * @cfg_base: base iomap for CFG region   * @cfg_regmap: regmap for config region   * @mem_regions: data for each of the PRUSS memory regions + * @mem_in_use: to indicate if memory resource is in use + * @lock: mutex to serialize access to resources   * @core_clk_mux: clk handle for PRUSS CORE_CLK_MUX   * @iep_clk_mux: clk handle for PRUSS IEP_CLK_MUX   */ @@ -47,8 +97,81 @@ struct pruss {  	void __iomem *cfg_base;  	struct regmap *cfg_regmap;  	struct pruss_mem_region mem_regions[PRUSS_MEM_MAX]; +	struct pruss_mem_region *mem_in_use[PRUSS_MEM_MAX]; +	struct mutex lock; /* PRU resource lock */  	struct clk *core_clk_mux;  	struct clk *iep_clk_mux;  }; +#if IS_ENABLED(CONFIG_TI_PRUSS) + +struct pruss *pruss_get(struct rproc *rproc); +void pruss_put(struct pruss *pruss); +int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id, +			     struct pruss_mem_region *region); +int pruss_release_mem_region(struct pruss *pruss, +			     struct pruss_mem_region *region); +int pruss_cfg_get_gpmux(struct pruss *pruss, enum pruss_pru_id pru_id, u8 *mux); +int pruss_cfg_set_gpmux(struct pruss *pruss, enum pruss_pru_id pru_id, u8 mux); +int pruss_cfg_gpimode(struct pruss *pruss, enum pruss_pru_id pru_id, +		      enum pruss_gpi_mode mode); +int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable); +int pruss_cfg_xfr_enable(struct pruss *pruss, enum pru_type pru_type, +			 bool enable); + +#else + +static inline struct pruss *pruss_get(struct rproc *rproc) +{ +	return ERR_PTR(-EOPNOTSUPP); +} + +static inline void pruss_put(struct pruss *pruss) { } + +static inline int pruss_request_mem_region(struct pruss *pruss, +					   enum pruss_mem mem_id, +					   struct pruss_mem_region *region) +{ +	return -EOPNOTSUPP; +} + +static inline int pruss_release_mem_region(struct pruss *pruss, +					   struct pruss_mem_region *region) +{ +	return -EOPNOTSUPP; +} + +static inline int pruss_cfg_get_gpmux(struct pruss *pruss, +				      enum pruss_pru_id pru_id, u8 *mux) +{ +	return ERR_PTR(-EOPNOTSUPP); +} + +static inline int pruss_cfg_set_gpmux(struct pruss *pruss, +				      enum pruss_pru_id pru_id, u8 mux) +{ +	return ERR_PTR(-EOPNOTSUPP); +} + +static inline int pruss_cfg_gpimode(struct pruss *pruss, +				    enum pruss_pru_id pru_id, +				    enum pruss_gpi_mode mode) +{ +	return ERR_PTR(-EOPNOTSUPP); +} + +static inline int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable) +{ +	return ERR_PTR(-EOPNOTSUPP); +} + +static inline int pruss_cfg_xfr_enable(struct pruss *pruss, +				       enum pru_type pru_type, +				       bool enable); +{ +	return ERR_PTR(-EOPNOTSUPP); +} + +#endif /* CONFIG_TI_PRUSS */ +  #endif	/* _PRUSS_DRIVER_H_ */ diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index fdffa6a98d79..1ef4e0f9bd2a 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h @@ -77,8 +77,14 @@ struct ptp_system_timestamp {   *            nominal frequency in parts per million, but with a   *            16 bit binary fractional field.   * - * @adjphase:  Adjusts the phase offset of the hardware clock. - *             parameter delta: Desired change in nanoseconds. + * @adjphase:  Indicates that the PHC should use an internal servo + *             algorithm to correct the provided phase offset. + *             parameter delta: PHC servo phase adjustment target + *                              in nanoseconds. + * + * @getmaxphase:  Advertises maximum offset that can be provided + *                to the hardware clock's phase control functionality + *                through adjphase.   *   * @adjtime:  Shifts the time of the hardware clock.   *            parameter delta: Desired change in nanoseconds. @@ -169,6 +175,7 @@ struct ptp_clock_info {  	struct ptp_pin_desc *pin_config;  	int (*adjfine)(struct ptp_clock_info *ptp, long scaled_ppm);  	int (*adjphase)(struct ptp_clock_info *ptp, s32 phase); +	s32 (*getmaxphase)(struct ptp_clock_info *ptp);  	int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);  	int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts);  	int (*gettimex64)(struct ptp_clock_info *ptp, struct timespec64 *ts, diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h index 8052d34da782..27343424225c 100644 --- a/include/linux/rcuwait.h +++ b/include/linux/rcuwait.h @@ -49,9 +49,9 @@ static inline void prepare_to_rcuwait(struct rcuwait *w)  extern void finish_rcuwait(struct rcuwait *w); -#define rcuwait_wait_event(w, condition, state)				\ +#define ___rcuwait_wait_event(w, condition, state, ret, cmd)		\  ({									\ -	int __ret = 0;							\ +	long __ret = ret;						\  	prepare_to_rcuwait(w);						\  	for (;;) {							\  		/*							\ @@ -67,10 +67,27 @@ extern void finish_rcuwait(struct rcuwait *w);  			break;						\  		}							\  									\ -		schedule();						\ +		cmd;							\  	}								\  	finish_rcuwait(w);						\  	__ret;								\  }) +#define rcuwait_wait_event(w, condition, state)				\ +	___rcuwait_wait_event(w, condition, state, 0, schedule()) + +#define __rcuwait_wait_event_timeout(w, condition, state, timeout)	\ +	___rcuwait_wait_event(w, ___wait_cond_timeout(condition),	\ +			      state, timeout,				\ +			      __ret = schedule_timeout(__ret)) + +#define rcuwait_wait_event_timeout(w, condition, state, timeout)	\ +({									\ +	long __ret = timeout;						\ +	if (!___wait_cond_timeout(condition))				\ +		__ret = __rcuwait_wait_event_timeout(w, condition,	\ +						     state, timeout);	\ +	__ret;								\ +}) +  #endif /* _LINUX_RCUWAIT_H_ */ diff --git a/include/linux/ref_tracker.h b/include/linux/ref_tracker.h index 9ca353ab712b..8eac4f3d5254 100644 --- a/include/linux/ref_tracker.h +++ b/include/linux/ref_tracker.h @@ -17,12 +17,15 @@ struct ref_tracker_dir {  	bool			dead;  	struct list_head	list; /* List of active trackers */  	struct list_head	quarantine; /* List of dead trackers */ +	char			name[32];  #endif  };  #ifdef CONFIG_REF_TRACKER +  static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir, -					unsigned int quarantine_count) +					unsigned int quarantine_count, +					const char *name)  {  	INIT_LIST_HEAD(&dir->list);  	INIT_LIST_HEAD(&dir->quarantine); @@ -31,14 +34,20 @@ static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,  	dir->dead = false;  	refcount_set(&dir->untracked, 1);  	refcount_set(&dir->no_tracker, 1); +	strscpy(dir->name, name, sizeof(dir->name));  	stack_depot_init();  }  void ref_tracker_dir_exit(struct ref_tracker_dir *dir); +void ref_tracker_dir_print_locked(struct ref_tracker_dir *dir, +				  unsigned int display_limit); +  void ref_tracker_dir_print(struct ref_tracker_dir *dir,  			   unsigned int display_limit); +int ref_tracker_dir_snprint(struct ref_tracker_dir *dir, char *buf, size_t size); +  int ref_tracker_alloc(struct ref_tracker_dir *dir,  		      struct ref_tracker **trackerp, gfp_t gfp); @@ -48,7 +57,8 @@ int ref_tracker_free(struct ref_tracker_dir *dir,  #else /* CONFIG_REF_TRACKER */  static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir, -					unsigned int quarantine_count) +					unsigned int quarantine_count, +					const char *name)  {  } @@ -56,11 +66,22 @@ static inline void ref_tracker_dir_exit(struct ref_tracker_dir *dir)  {  } +static inline void ref_tracker_dir_print_locked(struct ref_tracker_dir *dir, +						unsigned int display_limit) +{ +} +  static inline void ref_tracker_dir_print(struct ref_tracker_dir *dir,  					 unsigned int display_limit)  {  } +static inline int ref_tracker_dir_snprint(struct ref_tracker_dir *dir, +					  char *buf, size_t size) +{ +	return 0; +} +  static inline int ref_tracker_alloc(struct ref_tracker_dir *dir,  				    struct ref_tracker **trackerp,  				    gfp_t gfp) diff --git a/include/linux/rethook.h b/include/linux/rethook.h index c8ac1e5afcd1..fdf26cd0e742 100644 --- a/include/linux/rethook.h +++ b/include/linux/rethook.h @@ -14,7 +14,7 @@  struct rethook_node; -typedef void (*rethook_handler_t) (struct rethook_node *, void *, struct pt_regs *); +typedef void (*rethook_handler_t) (struct rethook_node *, void *, unsigned long, struct pt_regs *);  /**   * struct rethook - The rethook management data structure. diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 0ce5746a4470..e6fe4f73ffe6 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -629,11 +629,25 @@ struct scmi_powercap_info {   * @num_domains_get: get the count of powercap domains provided by SCMI.   * @info_get: get the information for the specified domain.   * @cap_get: get the current CAP value for the specified domain. + *	     On SCMI platforms supporting powercap zone disabling, this could + *	     report a zero value for a zone where powercapping is disabled.   * @cap_set: set the CAP value for the specified domain to the provided value;   *	     if the domain supports setting the CAP with an asynchronous command   *	     this request will finally trigger an asynchronous transfer, but, if   *	     @ignore_dresp here is set to true, this call will anyway return   *	     immediately without waiting for the related delayed response. + *	     Note that the powercap requested value must NOT be zero, even if + *	     the platform supports disabling a powercap by setting its cap to + *	     zero (since SCMI v3.2): there are dedicated operations that should + *	     be used for that. (@cap_enable_set/get) + * @cap_enable_set: enable or disable the powercapping on the specified domain, + *		    if supported by the SCMI platform implementation. + *		    Note that, by the SCMI specification, the platform can + *		    silently ignore our disable request and decide to enforce + *		    anyway some other powercap value requested by another agent + *		    on the system: for this reason @cap_get and @cap_enable_get + *		    will always report the final platform view of the powercaps. + * @cap_enable_get: get the current CAP enable status for the specified domain.   * @pai_get: get the current PAI value for the specified domain.   * @pai_set: set the PAI value for the specified domain to the provided value.   * @measurements_get: retrieve the current average power measurements for the @@ -662,6 +676,10 @@ struct scmi_powercap_proto_ops {  		       u32 *power_cap);  	int (*cap_set)(const struct scmi_protocol_handle *ph, u32 domain_id,  		       u32 power_cap, bool ignore_dresp); +	int (*cap_enable_set)(const struct scmi_protocol_handle *ph, +			      u32 domain_id, bool enable); +	int (*cap_enable_get)(const struct scmi_protocol_handle *ph, +			      u32 domain_id, bool *enable);  	int (*pai_get)(const struct scmi_protocol_handle *ph, u32 domain_id,  		       u32 *pai);  	int (*pai_set)(const struct scmi_protocol_handle *ph, u32 domain_id, diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 6f78f302d272..be65de65fe61 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -7,17 +7,34 @@  #ifndef _LINUX_SERIAL_8250_H  #define _LINUX_SERIAL_8250_H +#include <linux/errno.h>  #include <linux/serial_core.h>  #include <linux/serial_reg.h>  #include <linux/platform_device.h> +struct uart_8250_port; +  /*   * This is the platform device platform_data structure + * + * @mapsize:	Port size for ioremap() + * @bugs:	Port bugs + * + * @dl_read: ``u32 ()(struct uart_8250_port *up)`` + * + *	UART divisor latch read. + * + * @dl_write: ``void ()(struct uart_8250_port *up, u32 value)`` + * + *	Write @value into UART divisor latch. + * + *	Locking: Caller holds port's lock.   */  struct plat_serial8250_port {  	unsigned long	iobase;		/* io base address */  	void __iomem	*membase;	/* ioremap cookie or NULL */  	resource_size_t	mapbase;	/* resource base */ +	resource_size_t	mapsize;  	unsigned int	uartclk;	/* UART clock rate */  	unsigned int	irq;		/* interrupt number */  	unsigned long	irqflags;	/* request_irq flags */ @@ -28,8 +45,11 @@ struct plat_serial8250_port {  	unsigned char	has_sysrq;	/* supports magic SysRq */  	unsigned int	type;		/* If UPF_FIXED_TYPE */  	upf_t		flags;		/* UPF_* flags */ +	u16		bugs;		/* port bugs */  	unsigned int	(*serial_in)(struct uart_port *, int);  	void		(*serial_out)(struct uart_port *, int, int); +	u32		(*dl_read)(struct uart_8250_port *up); +	void		(*dl_write)(struct uart_8250_port *up, u32 value);  	void		(*set_termios)(struct uart_port *,  			               struct ktermios *new,  			               const struct ktermios *old); @@ -90,15 +110,23 @@ struct uart_8250_em485 {   * their own 8250 ports without registering their own   * platform device.  Using these will make your driver   * dependent on the 8250 driver. + * + * @dl_read: ``u32 ()(struct uart_8250_port *port)`` + * + *	UART divisor latch read. + * + * @dl_write: ``void ()(struct uart_8250_port *port, u32 value)`` + * + *	Write @value into UART divisor latch. + * + *	Locking: Caller holds port's lock.   */ -  struct uart_8250_port {  	struct uart_port	port;  	struct timer_list	timer;		/* "no irq" timer */  	struct list_head	list;		/* ports on this IRQ */  	u32			capabilities;	/* port capabilities */ -	unsigned short		bugs;		/* port bugs */ -	bool			fifo_bug;	/* min RX trigger if enabled */ +	u16			bugs;		/* port bugs */  	unsigned int		tx_loadsz;	/* transmit fifo load size */  	unsigned char		acr;  	unsigned char		fcr; @@ -129,8 +157,8 @@ struct uart_8250_port {  	const struct uart_8250_ops *ops;  	/* 8250 specific callbacks */ -	int			(*dl_read)(struct uart_8250_port *); -	void			(*dl_write)(struct uart_8250_port *, int); +	u32			(*dl_read)(struct uart_8250_port *up); +	void			(*dl_write)(struct uart_8250_port *up, u32 value);  	struct uart_8250_em485 *em485;  	void			(*rs485_start_tx)(struct uart_8250_port *); @@ -183,8 +211,11 @@ void serial8250_set_isa_configurator(void (*v)(int port, struct uart_port *up,  					       u32 *capabilities));  #ifdef CONFIG_SERIAL_8250_RT288X -unsigned int au_serial_in(struct uart_port *p, int offset); -void au_serial_out(struct uart_port *p, int offset, int value); +int rt288x_setup(struct uart_port *p); +int au_platform_setup(struct plat_serial8250_port *p); +#else +static inline int rt288x_setup(struct uart_port *p) { return -ENODEV; } +static inline int au_platform_setup(struct plat_serial8250_port *p) { return -ENODEV; }  #endif  #endif diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 66ecec15a1bf..6d58c57acdaa 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -28,6 +28,7 @@  struct uart_port;  struct serial_struct; +struct serial_port_device;  struct device;  struct gpio_desc; @@ -458,6 +459,7 @@ struct uart_port {  						struct serial_rs485 *rs485);  	int			(*iso7816_config)(struct uart_port *,  						  struct serial_iso7816 *iso7816); +	int			ctrl_id;		/* optional serial core controller id */  	unsigned int		irq;			/* irq number */  	unsigned long		irqflags;		/* irq flags  */  	unsigned int		uartclk;		/* base uart clock */ @@ -563,7 +565,8 @@ struct uart_port {  	unsigned int		minor;  	resource_size_t		mapbase;		/* for ioremap */  	resource_size_t		mapsize; -	struct device		*dev;			/* parent device */ +	struct device		*dev;			/* serial port physical parent device */ +	struct serial_port_device *port_dev;		/* serial core port device */  	unsigned long		sysrq;			/* sysrq timeout */  	unsigned int		sysrq_ch;		/* char for sysrq */ @@ -853,7 +856,7 @@ void uart_console_write(struct uart_port *port, const char *s,  int uart_register_driver(struct uart_driver *uart);  void uart_unregister_driver(struct uart_driver *uart);  int uart_add_one_port(struct uart_driver *reg, struct uart_port *port); -int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); +void uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);  bool uart_match_port(const struct uart_port *port1,  		const struct uart_port *port2); diff --git a/include/linux/sfp.h b/include/linux/sfp.h index ef06a195b3c2..9346cd44814d 100644 --- a/include/linux/sfp.h +++ b/include/linux/sfp.h @@ -342,6 +342,12 @@ enum {  	SFP_ENCODING			= 11,  	SFP_BR_NOMINAL			= 12,  	SFP_RATE_ID			= 13, +	SFF_RID_8079			= 0x01, +	SFF_RID_8431_RX_ONLY		= 0x02, +	SFF_RID_8431_TX_ONLY		= 0x04, +	SFF_RID_8431			= 0x06, +	SFF_RID_10G8G			= 0x0e, +  	SFP_LINK_LEN_SM_KM		= 14,  	SFP_LINK_LEN_SM_100M		= 15,  	SFP_LINK_LEN_50UM_OM2_10M	= 16, @@ -465,6 +471,7 @@ enum {  	SFP_STATUS			= 110,  	SFP_STATUS_TX_DISABLE		= BIT(7),  	SFP_STATUS_TX_DISABLE_FORCE	= BIT(6), +	SFP_STATUS_RS0_SELECT		= BIT(3),  	SFP_STATUS_TX_FAULT		= BIT(2),  	SFP_STATUS_RX_LOS		= BIT(1),  	SFP_ALARM0			= 112, @@ -496,6 +503,7 @@ enum {  	SFP_WARN1_RXPWR_LOW		= BIT(6),  	SFP_EXT_STATUS			= 118, +	SFP_EXT_STATUS_RS1_SELECT	= BIT(3),  	SFP_EXT_STATUS_PWRLVL_SELECT	= BIT(0),  	SFP_VSL				= 120, @@ -556,6 +564,7 @@ int sfp_get_module_eeprom_by_page(struct sfp_bus *bus,  				  struct netlink_ext_ack *extack);  void sfp_upstream_start(struct sfp_bus *bus);  void sfp_upstream_stop(struct sfp_bus *bus); +void sfp_upstream_set_signal_rate(struct sfp_bus *bus, unsigned int rate_kbd);  void sfp_bus_put(struct sfp_bus *bus);  struct sfp_bus *sfp_bus_find_fwnode(const struct fwnode_handle *fwnode);  int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream, @@ -615,6 +624,11 @@ static inline void sfp_upstream_stop(struct sfp_bus *bus)  {  } +static inline void sfp_upstream_set_signal_rate(struct sfp_bus *bus, +						unsigned int rate_kbd) +{ +} +  static inline void sfp_bus_put(struct sfp_bus *bus)  {  } diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 0b40417457cd..91ed66952580 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -330,6 +330,7 @@ struct tc_skb_ext {  	u8 post_ct_snat:1;  	u8 post_ct_dnat:1;  	u8 act_miss:1; /* Set if act_miss_cookie is used */ +	u8 l2_miss:1; /* Set by bridge upon FDB or MDB miss */  };  #endif @@ -1383,7 +1384,7 @@ static inline int skb_pad(struct sk_buff *skb, int pad)  #define dev_kfree_skb(a)	consume_skb(a)  int skb_append_pagefrags(struct sk_buff *skb, struct page *page, -			 int offset, size_t size); +			 int offset, size_t size, size_t max_frags);  struct skb_seq_state {  	__u32		lower_offset; @@ -2421,20 +2422,22 @@ static inline unsigned int skb_pagelen(const struct sk_buff *skb)  	return skb_headlen(skb) + __skb_pagelen(skb);  } +static inline void skb_frag_fill_page_desc(skb_frag_t *frag, +					   struct page *page, +					   int off, int size) +{ +	frag->bv_page = page; +	frag->bv_offset = off; +	skb_frag_size_set(frag, size); +} +  static inline void __skb_fill_page_desc_noacc(struct skb_shared_info *shinfo,  					      int i, struct page *page,  					      int off, int size)  {  	skb_frag_t *frag = &shinfo->frags[i]; -	/* -	 * Propagate page pfmemalloc to the skb if we can. The problem is -	 * that not all callers have unique ownership of the page but rely -	 * on page_is_pfmemalloc doing the right thing(tm). -	 */ -	frag->bv_page		  = page; -	frag->bv_offset		  = off; -	skb_frag_size_set(frag, size); +	skb_frag_fill_page_desc(frag, page, off, size);  }  /** @@ -2466,6 +2469,11 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,  					struct page *page, int off, int size)  {  	__skb_fill_page_desc_noacc(skb_shinfo(skb), i, page, off, size); + +	/* Propagate page pfmemalloc to the skb if we can. The problem is +	 * that not all callers have unique ownership of the page but rely +	 * on page_is_pfmemalloc doing the right thing(tm). +	 */  	page = compound_head(page);  	if (page_is_pfmemalloc(page))  		skb->pfmemalloc	= true; @@ -3494,32 +3502,6 @@ static inline void skb_frag_page_copy(skb_frag_t *fragto,  	fragto->bv_page = fragfrom->bv_page;  } -/** - * __skb_frag_set_page - sets the page contained in a paged fragment - * @frag: the paged fragment - * @page: the page to set - * - * Sets the fragment @frag to contain @page. - */ -static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page) -{ -	frag->bv_page = page; -} - -/** - * skb_frag_set_page - sets the page contained in a paged fragment of an skb - * @skb: the buffer - * @f: the fragment offset - * @page: the page to set - * - * Sets the @f'th fragment of @skb to contain @page. - */ -static inline void skb_frag_set_page(struct sk_buff *skb, int f, -				     struct page *page) -{ -	__skb_frag_set_page(&skb_shinfo(skb)->frags[f], page); -} -  bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio);  /** @@ -3992,8 +3974,6 @@ int skb_zerocopy(struct sk_buff *to, struct sk_buff *from,  void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);  int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);  void skb_scrub_packet(struct sk_buff *skb, bool xnet); -bool skb_gso_validate_network_len(const struct sk_buff *skb, unsigned int mtu); -bool skb_gso_validate_mac_len(const struct sk_buff *skb, unsigned int len);  struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);  struct sk_buff *skb_segment_list(struct sk_buff *skb, netdev_features_t features,  				 unsigned int offset); @@ -4043,7 +4023,7 @@ __skb_header_pointer(const struct sk_buff *skb, int offset, int len,  	if (likely(hlen - offset >= len))  		return (void *)data + offset; -	if (!skb || unlikely(skb_copy_bits(skb, offset, buffer, len) < 0)) +	if (!skb || !buffer || unlikely(skb_copy_bits(skb, offset, buffer, len) < 0))  		return NULL;  	return buffer; @@ -4859,75 +4839,6 @@ static inline struct sec_path *skb_sec_path(const struct sk_buff *skb)  #endif  } -/* Keeps track of mac header offset relative to skb->head. - * It is useful for TSO of Tunneling protocol. e.g. GRE. - * For non-tunnel skb it points to skb_mac_header() and for - * tunnel skb it points to outer mac header. - * Keeps track of level of encapsulation of network headers. - */ -struct skb_gso_cb { -	union { -		int	mac_offset; -		int	data_offset; -	}; -	int	encap_level; -	__wsum	csum; -	__u16	csum_start; -}; -#define SKB_GSO_CB_OFFSET	32 -#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_GSO_CB_OFFSET)) - -static inline int skb_tnl_header_len(const struct sk_buff *inner_skb) -{ -	return (skb_mac_header(inner_skb) - inner_skb->head) - -		SKB_GSO_CB(inner_skb)->mac_offset; -} - -static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra) -{ -	int new_headroom, headroom; -	int ret; - -	headroom = skb_headroom(skb); -	ret = pskb_expand_head(skb, extra, 0, GFP_ATOMIC); -	if (ret) -		return ret; - -	new_headroom = skb_headroom(skb); -	SKB_GSO_CB(skb)->mac_offset += (new_headroom - headroom); -	return 0; -} - -static inline void gso_reset_checksum(struct sk_buff *skb, __wsum res) -{ -	/* Do not update partial checksums if remote checksum is enabled. */ -	if (skb->remcsum_offload) -		return; - -	SKB_GSO_CB(skb)->csum = res; -	SKB_GSO_CB(skb)->csum_start = skb_checksum_start(skb) - skb->head; -} - -/* Compute the checksum for a gso segment. First compute the checksum value - * from the start of transport header to SKB_GSO_CB(skb)->csum_start, and - * then add in skb->csum (checksum from csum_start to end of packet). - * skb->csum and csum_start are then updated to reflect the checksum of the - * resultant packet starting from the transport header-- the resultant checksum - * is in the res argument (i.e. normally zero or ~ of checksum of a pseudo - * header. - */ -static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res) -{ -	unsigned char *csum_start = skb_transport_header(skb); -	int plen = (skb->head + SKB_GSO_CB(skb)->csum_start) - csum_start; -	__wsum partial = SKB_GSO_CB(skb)->csum; - -	SKB_GSO_CB(skb)->csum = res; -	SKB_GSO_CB(skb)->csum_start = csum_start - skb->head; - -	return csum_fold(csum_partial(csum_start, plen, partial)); -} -  static inline bool skb_is_gso(const struct sk_buff *skb)  {  	return skb_shinfo(skb)->gso_size; @@ -5126,5 +5037,8 @@ static inline void skb_mark_for_recycle(struct sk_buff *skb)  #endif  } +ssize_t skb_splice_from_iter(struct sk_buff *skb, struct iov_iter *iter, +			     ssize_t maxsize, gfp_t gfp); +  #endif	/* __KERNEL__ */  #endif	/* _LINUX_SKBUFF_H */ diff --git a/include/linux/slab.h b/include/linux/slab.h index ca53425e9b32..791f7453a04f 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -54,16 +54,18 @@   * stays valid, the trick to using this is relying on an independent   * object validation pass. Something like:   * - *  rcu_read_lock() - * again: + * begin: + *  rcu_read_lock();   *  obj = lockless_lookup(key);   *  if (obj) {   *    if (!try_get_ref(obj)) // might fail for free objects - *      goto again; + *      rcu_read_unlock(); + *      goto begin;   *   *    if (obj->key != key) { // not the object we expected   *      put_ref(obj); - *      goto again; + *      rcu_read_unlock(); + *      goto begin;   *    }   *  }   *  rcu_read_unlock(); @@ -107,6 +109,18 @@  /* Avoid kmemleak tracing */  #define SLAB_NOLEAKTRACE	((slab_flags_t __force)0x00800000U) +/* + * Prevent merging with compatible kmem caches. This flag should be used + * cautiously. Valid use cases: + * + * - caches created for self-tests (e.g. kunit) + * - general caches created and used by a subsystem, only when a + *   (subsystem-specific) debug option is enabled + * - performance critical caches, should be very rare and consulted with slab + *   maintainers, and not used together with CONFIG_SLUB_TINY + */ +#define SLAB_NO_MERGE		((slab_flags_t __force)0x01000000U) +  /* Fault injection mark */  #ifdef CONFIG_FAILSLAB  # define SLAB_FAILSLAB		((slab_flags_t __force)0x02000000U) diff --git a/include/linux/soc/mediatek/mtk-mmsys.h b/include/linux/soc/mediatek/mtk-mmsys.h index 37544ea6286d..2475ef914746 100644 --- a/include/linux/soc/mediatek/mtk-mmsys.h +++ b/include/linux/soc/mediatek/mtk-mmsys.h @@ -27,8 +27,7 @@ enum mtk_ddp_comp_id {  	DDP_COMPONENT_CCORR,  	DDP_COMPONENT_COLOR0,  	DDP_COMPONENT_COLOR1, -	DDP_COMPONENT_DITHER, -	DDP_COMPONENT_DITHER0 = DDP_COMPONENT_DITHER, +	DDP_COMPONENT_DITHER0,  	DDP_COMPONENT_DITHER1,  	DDP_COMPONENT_DP_INTF0,  	DDP_COMPONENT_DP_INTF1, diff --git a/include/linux/soc/pxa/smemc.h b/include/linux/soc/pxa/smemc.h index f1ffea236c15..4feb1dded3ec 100644 --- a/include/linux/soc/pxa/smemc.h +++ b/include/linux/soc/pxa/smemc.h @@ -10,4 +10,20 @@ int pxa2xx_smemc_get_sdram_rows(void);  unsigned int pxa3xx_smemc_get_memclkdiv(void);  void __iomem *pxa_smemc_get_mdrefr(void); +/* + * Once fully converted to the clock framework, all these functions should be + * removed, and replaced with a clk_get(NULL, "core"). + */ +#ifdef CONFIG_PXA25x +extern unsigned pxa25x_get_clk_frequency_khz(int); +#else +#define pxa25x_get_clk_frequency_khz(x)		(0) +#endif + +#ifdef CONFIG_PXA27x +extern unsigned pxa27x_get_clk_frequency_khz(int); +#else +#define pxa27x_get_clk_frequency_khz(x)		(0) +#endif +  #endif diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h index 86e1b358688a..223db6a9c733 100644 --- a/include/linux/soc/qcom/smem.h +++ b/include/linux/soc/qcom/smem.h @@ -11,4 +11,6 @@ int qcom_smem_get_free_space(unsigned host);  phys_addr_t qcom_smem_virt_to_phys(void *p); +int qcom_smem_get_soc_id(u32 *id); +  #endif diff --git a/include/linux/soc/qcom/socinfo.h b/include/linux/soc/qcom/socinfo.h new file mode 100644 index 000000000000..e78777bb0f4a --- /dev/null +++ b/include/linux/soc/qcom/socinfo.h @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __QCOM_SOCINFO_H__ +#define __QCOM_SOCINFO_H__ + +/* + * SMEM item id, used to acquire handles to respective + * SMEM region. + */ +#define SMEM_HW_SW_BUILD_ID		137 + +#define SMEM_SOCINFO_BUILD_ID_LENGTH	32 +#define SMEM_SOCINFO_CHIP_ID_LENGTH	32 + +/* Socinfo SMEM item structure */ +struct socinfo { +	__le32 fmt; +	__le32 id; +	__le32 ver; +	char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH]; +	/* Version 2 */ +	__le32 raw_id; +	__le32 raw_ver; +	/* Version 3 */ +	__le32 hw_plat; +	/* Version 4 */ +	__le32 plat_ver; +	/* Version 5 */ +	__le32 accessory_chip; +	/* Version 6 */ +	__le32 hw_plat_subtype; +	/* Version 7 */ +	__le32 pmic_model; +	__le32 pmic_die_rev; +	/* Version 8 */ +	__le32 pmic_model_1; +	__le32 pmic_die_rev_1; +	__le32 pmic_model_2; +	__le32 pmic_die_rev_2; +	/* Version 9 */ +	__le32 foundry_id; +	/* Version 10 */ +	__le32 serial_num; +	/* Version 11 */ +	__le32 num_pmics; +	__le32 pmic_array_offset; +	/* Version 12 */ +	__le32 chip_family; +	__le32 raw_device_family; +	__le32 raw_device_num; +	/* Version 13 */ +	__le32 nproduct_id; +	char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH]; +	/* Version 14 */ +	__le32 num_clusters; +	__le32 ncluster_array_offset; +	__le32 num_subset_parts; +	__le32 nsubset_parts_array_offset; +	/* Version 15 */ +	__le32 nmodem_supported; +	/* Version 16 */ +	__le32  feature_code; +	__le32  pcode; +	__le32  npartnamemap_offset; +	__le32  nnum_partname_mapping; +	/* Version 17 */ +	__le32 oem_variant; +	/* Version 18 */ +	__le32 num_kvps; +	__le32 kvps_offset; +	/* Version 19 */ +	__le32 num_func_clusters; +	__le32 boot_cluster; +	__le32 boot_core; +}; + +#endif diff --git a/include/linux/socket.h b/include/linux/socket.h index 13c3a237b9c9..39b74d83c7c4 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -177,6 +177,7 @@ static inline size_t msg_data_left(struct msghdr *msg)  #define	SCM_RIGHTS	0x01		/* rw: access rights (array of int) */  #define SCM_CREDENTIALS 0x02		/* rw: struct ucred		*/  #define SCM_SECURITY	0x03		/* rw: security label		*/ +#define SCM_PIDFD	0x04		/* ro: pidfd (int)		*/  struct ucred {  	__u32	pid; @@ -318,7 +319,6 @@ struct ucred {  #define MSG_MORE	0x8000	/* Sender will send more */  #define MSG_WAITFORONE	0x10000	/* recvmmsg(): block until 1+ packets avail */  #define MSG_SENDPAGE_NOPOLICY 0x10000 /* sendpage() internal : do no apply policy */ -#define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */  #define MSG_BATCH	0x40000 /* sendmmsg(): more messages coming */  #define MSG_EOF         MSG_FIN  #define MSG_NO_SHARED_FRAGS 0x80000 /* sendpage() internal : page frags are not shared */ @@ -327,6 +327,7 @@ struct ucred {  					  */  #define MSG_ZEROCOPY	0x4000000	/* Use user data in kernel path */ +#define MSG_SPLICE_PAGES 0x8000000	/* Splice the pages from the iterator in sendmsg() */  #define MSG_FASTOPEN	0x20000000	/* Send data in TCP SYN */  #define MSG_CMSG_CLOEXEC 0x40000000	/* Set close_on_exec for file  					   descriptor received through @@ -337,6 +338,9 @@ struct ucred {  #define MSG_CMSG_COMPAT	0		/* We never have 32 bit fixups */  #endif +/* Flags to be cleared on entry by sendmsg and sendmmsg syscalls */ +#define MSG_INTERNAL_SENDMSG_FLAGS \ +	(MSG_SPLICE_PAGES | MSG_SENDPAGE_NOPOLICY | MSG_SENDPAGE_DECRYPTED)  /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */  #define SOL_IP		0 diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index d424c1aadf38..a04c1c34c344 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h @@ -35,8 +35,6 @@ struct ads7846_platform_data {  	u16	debounce_tol;		/* tolerance used for filtering */  	u16	debounce_rep;		/* additional consecutive good readings  					 * required after the first two */ -	int	gpio_pendown;		/* the GPIO used to decide the pendown -					 * state if get_pendown_state == NULL */  	int	gpio_pendown_debounce;	/* platform specific debounce time for  					 * the gpio_pendown */  	int	(*get_pendown_state)(void); diff --git a/include/linux/splice.h b/include/linux/splice.h index 8f052c3dae95..6c461573434d 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h @@ -38,6 +38,7 @@ struct splice_desc {  		struct file *file;	/* file to read/write */  		void *data;		/* cookie */  	} u; +	void (*splice_eof)(struct splice_desc *sd); /* Unexpected EOF handler */  	loff_t pos;			/* file position */  	loff_t *opos;			/* sendfile: output position */  	size_t num_spliced;		/* number of bytes already spliced */ @@ -87,6 +88,8 @@ extern long do_splice(struct file *in, loff_t *off_in,  extern long do_tee(struct file *in, struct file *out, size_t len,  		   unsigned int flags); +extern ssize_t splice_to_socket(struct pipe_inode_info *pipe, struct file *out, +				loff_t *ppos, size_t len, unsigned int flags);  /*   * for dynamic pipe sizing diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 225751a8fd8e..06090538fe2d 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -293,5 +293,6 @@ struct plat_stmmacenet_data {  	bool sph_disable;  	bool serdes_up_after_phy_linkup;  	const struct dwmac4_addrs *dwmac4_addrs; +	bool has_integrated_pcs;  };  #endif diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h new file mode 100644 index 000000000000..48120222b9b2 --- /dev/null +++ b/include/linux/string_choices.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_STRING_CHOICES_H_ +#define _LINUX_STRING_CHOICES_H_ + +#include <linux/types.h> + +static inline const char *str_enable_disable(bool v) +{ +	return v ? "enable" : "disable"; +} + +static inline const char *str_enabled_disabled(bool v) +{ +	return v ? "enabled" : "disabled"; +} + +static inline const char *str_hi_lo(bool v) +{ +	return v ? "hi" : "lo"; +} +#define str_lo_hi(v)		str_hi_lo(!(v)) + +static inline const char *str_high_low(bool v) +{ +	return v ? "high" : "low"; +} +#define str_low_high(v)		str_high_low(!(v)) + +static inline const char *str_read_write(bool v) +{ +	return v ? "read" : "write"; +} + +static inline const char *str_on_off(bool v) +{ +	return v ? "on" : "off"; +} + +static inline const char *str_yes_no(bool v) +{ +	return v ? "yes" : "no"; +} + +#endif diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index fae6beaaa217..789ab30045da 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -4,6 +4,7 @@  #include <linux/bits.h>  #include <linux/ctype.h> +#include <linux/string_choices.h>  #include <linux/string.h>  #include <linux/types.h> @@ -113,29 +114,4 @@ void kfree_strarray(char **array, size_t n);  char **devm_kasprintf_strarray(struct device *dev, const char *prefix, size_t n); -static inline const char *str_yes_no(bool v) -{ -	return v ? "yes" : "no"; -} - -static inline const char *str_on_off(bool v) -{ -	return v ? "on" : "off"; -} - -static inline const char *str_enable_disable(bool v) -{ -	return v ? "enable" : "disable"; -} - -static inline const char *str_enabled_disabled(bool v) -{ -	return v ? "enabled" : "disabled"; -} - -static inline const char *str_read_write(bool v) -{ -	return v ? "read" : "write"; -} -  #endif diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 3e6ce288a7fc..61e58327b1aa 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h @@ -120,6 +120,7 @@ struct rpc_authops {  						struct rpcsec_gss_info *);  	int			(*key_timeout)(struct rpc_auth *,  						struct rpc_cred *); +	int			(*ping)(struct rpc_clnt *clnt);  };  struct rpc_credops { @@ -144,6 +145,7 @@ struct rpc_credops {  extern const struct rpc_authops	authunix_ops;  extern const struct rpc_authops	authnull_ops; +extern const struct rpc_authops	authtls_ops;  int __init		rpc_init_authunix(void);  int __init		rpcauth_init_module(void); diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 770ef2cb5775..4f41d839face 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -30,7 +30,13 @@  #include <linux/sunrpc/xprtmultipath.h>  struct rpc_inode; -struct rpc_sysfs_client; +struct rpc_sysfs_client { +	struct kobject kobject; +	struct net *net; +	struct rpc_clnt *clnt; +	struct rpc_xprt_switch *xprt_switch; +}; +  /*   * The high-level client handle @@ -57,7 +63,9 @@ struct rpc_clnt {  				cl_discrtry : 1,/* disconnect before retry */  				cl_noretranstimeo: 1,/* No retransmit timeouts */  				cl_autobind : 1,/* use getport() */ -				cl_chatty   : 1;/* be verbose */ +				cl_chatty   : 1,/* be verbose */ +				cl_shutdown : 1;/* rpc immediate -EIO */ +	struct xprtsec_parms	cl_xprtsec;	/* transport security policy */  	struct rpc_rtt *	cl_rtt;		/* RTO estimator data */  	const struct rpc_timeout *cl_timeout;	/* Timeout strategy */ @@ -139,6 +147,7 @@ struct rpc_create_args {  	struct svc_xprt		*bc_xprt;	/* NFSv4.1 backchannel */  	const struct cred	*cred;  	unsigned int		max_connect; +	struct xprtsec_parms	xprtsec;  };  struct rpc_add_xprt_test { diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index b4903b87362a..f8751118c122 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -161,16 +161,15 @@ static inline bool svc_put_not_last(struct svc_serv *serv)  extern u32 svc_max_payload(const struct svc_rqst *rqstp);  /* - * RPC Requsts and replies are stored in one or more pages. + * RPC Requests and replies are stored in one or more pages.   * We maintain an array of pages for each server thread.   * Requests are copied into these pages as they arrive.  Remaining   * pages are available to write the reply into.   * - * Pages are sent using ->sendpage so each server thread needs to - * allocate more to replace those used in sending.  To help keep track - * of these pages we have a receive list where all pages initialy live, - * and a send list where pages are moved to when there are to be part - * of a reply. + * Pages are sent using ->sendmsg with MSG_SPLICE_PAGES so each server thread + * needs to allocate more to replace those used in sending.  To help keep track + * of these pages we have a receive list where all pages initialy live, and a + * send list where pages are moved to when there are to be part of a reply.   *   * We use xdr_buf for holding responses as it fits well with NFS   * read responses (that have a header, and some data pages, and possibly diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index b9f59aabee53..b52411bcfe4e 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -129,6 +129,21 @@ struct rpc_rqst {  #define rq_svec			rq_snd_buf.head  #define rq_slen			rq_snd_buf.len +/* RPC transport layer security policies */ +enum xprtsec_policies { +	RPC_XPRTSEC_NONE = 0, +	RPC_XPRTSEC_TLS_ANON, +	RPC_XPRTSEC_TLS_X509, +}; + +struct xprtsec_parms { +	enum xprtsec_policies	policy; + +	/* authentication material */ +	key_serial_t		cert_serial; +	key_serial_t		privkey_serial; +}; +  struct rpc_xprt_ops {  	void		(*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);  	int		(*reserve_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); @@ -185,6 +200,7 @@ enum xprt_transports {  	XPRT_TRANSPORT_RDMA	= 256,  	XPRT_TRANSPORT_BC_RDMA	= XPRT_TRANSPORT_RDMA | XPRT_TRANSPORT_BC,  	XPRT_TRANSPORT_LOCAL	= 257, +	XPRT_TRANSPORT_TCP_TLS	= 258,  };  struct rpc_sysfs_xprt; @@ -229,6 +245,7 @@ struct rpc_xprt {  	 */  	unsigned long		bind_timeout,  				reestablish_timeout; +	struct xprtsec_parms	xprtsec;  	unsigned int		connect_cookie;	/* A cookie that gets bumped  						   every time the transport  						   is reconnected */ @@ -333,6 +350,7 @@ struct xprt_create {  	struct svc_xprt		*bc_xprt;	/* NFSv4.1 backchannel */  	struct rpc_xprt_switch	*bc_xps;  	unsigned int		flags; +	struct xprtsec_parms	xprtsec;  };  struct xprt_class { diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h index 38284f25eddf..700a1e6c047c 100644 --- a/include/linux/sunrpc/xprtsock.h +++ b/include/linux/sunrpc/xprtsock.h @@ -57,9 +57,11 @@ struct sock_xprt {  	struct work_struct	error_worker;  	struct work_struct	recv_worker;  	struct mutex		recv_mutex; +	struct completion	handshake_done;  	struct sockaddr_storage	srcaddr;  	unsigned short		srcport;  	int			xprt_err; +	struct rpc_clnt		*clnt;  	/*  	 * UDP socket buffer size parameters @@ -90,5 +92,6 @@ struct sock_xprt {  #define XPRT_SOCK_WAKE_DISCONNECT	(7)  #define XPRT_SOCK_CONNECT_SENT	(8)  #define XPRT_SOCK_NOSPACE	(9) +#define XPRT_SOCK_IGNORE_RECV	(10)  #endif /* _LINUX_SUNRPC_XPRTSOCK_H */ diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 7af2673b47ba..4e52cd5e0bdc 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -76,7 +76,6 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,   * @nslabs:	The number of IO TLB blocks (in groups of 64) between @start and   *		@end. For default swiotlb, this is command line adjustable via   *		setup_io_tlb_npages. - * @used:	The number of used IO TLB block.   * @list:	The free list describing the number of free entries available   *		from each index.   * @orig_addr:	The original address corresponding to a mapped entry. @@ -98,7 +97,6 @@ struct io_tlb_mem {  	phys_addr_t end;  	void *vaddr;  	unsigned long nslabs; -	unsigned long used;  	struct dentry *debugfs;  	bool late_alloc;  	bool force_bounce; diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 3d08277959af..59d451f455bf 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -89,7 +89,7 @@ int proc_do_static_key(struct ctl_table *table, int write, void *buffer,  		size_t *lenp, loff_t *ppos);  /* - * Register a set of sysctl names by calling register_sysctl_table + * Register a set of sysctl names by calling register_sysctl   * with an initialised array of struct ctl_table's.  An entry with    * NULL procname terminates the table.  table->de will be   * set up by the registration and need not be initialised in advance. @@ -137,7 +137,17 @@ struct ctl_table {  	void *data;  	int maxlen;  	umode_t mode; -	struct ctl_table *child;	/* Deprecated */ +	/** +	 * enum type - Enumeration to differentiate between ctl target types +	 * @SYSCTL_TABLE_TYPE_DEFAULT: ctl target with no special considerations +	 * @SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY: Used to identify a permanently +	 *                                       empty directory target to serve +	 *                                       as mount point. +	 */ +	enum { +		SYSCTL_TABLE_TYPE_DEFAULT, +		SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY +	} type;  	proc_handler *proc_handler;	/* Callback for text formatting */  	struct ctl_table_poll *poll;  	void *extra1; @@ -197,20 +207,6 @@ struct ctl_path {  #ifdef CONFIG_SYSCTL -#define DECLARE_SYSCTL_BASE(_name, _table)				\ -static struct ctl_table _name##_base_table[] = {			\ -	{								\ -		.procname	= #_name,				\ -		.mode		= 0555,					\ -		.child		= _table,				\ -	},								\ -	{ },								\ -} - -extern int __register_sysctl_base(struct ctl_table *base_table); - -#define register_sysctl_base(_name) __register_sysctl_base(_name##_base_table) -  void proc_sys_poll_notify(struct ctl_table_poll *poll);  extern void setup_sysctl_set(struct ctl_table_set *p, @@ -222,7 +218,6 @@ struct ctl_table_header *__register_sysctl_table(  	struct ctl_table_set *set,  	const char *path, struct ctl_table *table);  struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table); -struct ctl_table_header *register_sysctl_table(struct ctl_table * table);  void unregister_sysctl_table(struct ctl_table_header * table);  extern int sysctl_init_bases(void); @@ -244,24 +239,10 @@ extern int unaligned_enabled;  extern int unaligned_dump_stack;  extern int no_unaligned_warning; -extern struct ctl_table sysctl_mount_point[]; +#define SYSCTL_PERM_EMPTY_DIR	(1 << 0)  #else /* CONFIG_SYSCTL */ -#define DECLARE_SYSCTL_BASE(_name, _table) - -static inline int __register_sysctl_base(struct ctl_table *base_table) -{ -	return 0; -} - -#define register_sysctl_base(table) __register_sysctl_base(table) - -static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) -{ -	return NULL; -} -  static inline void register_sysctl_init(const char *path, struct ctl_table *table)  {  } diff --git a/include/linux/tegra-icc.h b/include/linux/tegra-icc.h new file mode 100644 index 000000000000..4b4d4bee290c --- /dev/null +++ b/include/linux/tegra-icc.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2022-2023 NVIDIA CORPORATION.  All rights reserved. + */ + +#ifndef LINUX_TEGRA_ICC_H +#define LINUX_TEGRA_ICC_H + +enum tegra_icc_client_type { +	TEGRA_ICC_NONE, +	TEGRA_ICC_NISO, +	TEGRA_ICC_ISO_DISPLAY, +	TEGRA_ICC_ISO_VI, +	TEGRA_ICC_ISO_AUDIO, +	TEGRA_ICC_ISO_VIFAL, +}; + +/* ICC ID's for MC client's used in BPMP */ +#define TEGRA_ICC_BPMP_DEBUG		1 +#define TEGRA_ICC_BPMP_CPU_CLUSTER0	2 +#define TEGRA_ICC_BPMP_CPU_CLUSTER1	3 +#define TEGRA_ICC_BPMP_CPU_CLUSTER2	4 +#define TEGRA_ICC_BPMP_GPU		5 +#define TEGRA_ICC_BPMP_CACTMON		6 +#define TEGRA_ICC_BPMP_DISPLAY		7 +#define TEGRA_ICC_BPMP_VI		8 +#define TEGRA_ICC_BPMP_EQOS		9 +#define TEGRA_ICC_BPMP_PCIE_0		10 +#define TEGRA_ICC_BPMP_PCIE_1		11 +#define TEGRA_ICC_BPMP_PCIE_2		12 +#define TEGRA_ICC_BPMP_PCIE_3		13 +#define TEGRA_ICC_BPMP_PCIE_4		14 +#define TEGRA_ICC_BPMP_PCIE_5		15 +#define TEGRA_ICC_BPMP_PCIE_6		16 +#define TEGRA_ICC_BPMP_PCIE_7		17 +#define TEGRA_ICC_BPMP_PCIE_8		18 +#define TEGRA_ICC_BPMP_PCIE_9		19 +#define TEGRA_ICC_BPMP_PCIE_10		20 +#define TEGRA_ICC_BPMP_DLA_0		21 +#define TEGRA_ICC_BPMP_DLA_1		22 +#define TEGRA_ICC_BPMP_SDMMC_1		23 +#define TEGRA_ICC_BPMP_SDMMC_2		24 +#define TEGRA_ICC_BPMP_SDMMC_3		25 +#define TEGRA_ICC_BPMP_SDMMC_4		26 +#define TEGRA_ICC_BPMP_NVDEC		27 +#define TEGRA_ICC_BPMP_NVENC		28 +#define TEGRA_ICC_BPMP_NVJPG_0		29 +#define TEGRA_ICC_BPMP_NVJPG_1		30 +#define TEGRA_ICC_BPMP_OFAA		31 +#define TEGRA_ICC_BPMP_XUSB_HOST	32 +#define TEGRA_ICC_BPMP_XUSB_DEV		33 +#define TEGRA_ICC_BPMP_TSEC		34 +#define TEGRA_ICC_BPMP_VIC		35 +#define TEGRA_ICC_BPMP_APE		36 +#define TEGRA_ICC_BPMP_APEDMA		37 +#define TEGRA_ICC_BPMP_SE		38 +#define TEGRA_ICC_BPMP_ISP		39 +#define TEGRA_ICC_BPMP_HDA		40 +#define TEGRA_ICC_BPMP_VIFAL		41 +#define TEGRA_ICC_BPMP_VI2FAL		42 +#define TEGRA_ICC_BPMP_VI2		43 +#define TEGRA_ICC_BPMP_RCE		44 +#define TEGRA_ICC_BPMP_PVA		45 + +#endif /* LINUX_TEGRA_ICC_H */ diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h index 90cd08ab2f5d..02333f47c994 100644 --- a/include/linux/thunderbolt.h +++ b/include/linux/thunderbolt.h @@ -172,6 +172,20 @@ int tb_register_property_dir(const char *key, struct tb_property_dir *dir);  void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir);  /** + * enum tb_link_width - Thunderbolt/USB4 link width + * @TB_LINK_WIDTH_SINGLE: Single lane link + * @TB_LINK_WIDTH_DUAL: Dual lane symmetric link + * @TB_LINK_WIDTH_ASYM_TX: Dual lane asymmetric Gen 4 link with 3 trasmitters + * @TB_LINK_WIDTH_ASYM_RX: Dual lane asymmetric Gen 4 link with 3 receivers + */ +enum tb_link_width { +	TB_LINK_WIDTH_SINGLE = BIT(0), +	TB_LINK_WIDTH_DUAL = BIT(1), +	TB_LINK_WIDTH_ASYM_TX = BIT(2), +	TB_LINK_WIDTH_ASYM_RX = BIT(3), +}; + +/**   * struct tb_xdomain - Cross-domain (XDomain) connection   * @dev: XDomain device   * @tb: Pointer to the domain @@ -186,7 +200,7 @@ void tb_unregister_property_dir(const char *key, struct tb_property_dir *dir);   * @vendor_name: Name of the vendor (or %NULL if not known)   * @device_name: Name of the device (or %NULL if not known)   * @link_speed: Speed of the link in Gb/s - * @link_width: Width of the link (1 or 2) + * @link_width: Width of the downstream facing link   * @link_usb4: Downstream link is USB4   * @is_unplugged: The XDomain is unplugged   * @needs_uuid: If the XDomain does not have @remote_uuid it will be @@ -234,7 +248,7 @@ struct tb_xdomain {  	const char *vendor_name;  	const char *device_name;  	unsigned int link_speed; -	unsigned int link_width; +	enum tb_link_width link_width;  	bool link_usb4;  	bool is_unplugged;  	bool needs_uuid; diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 7c4a0b72334e..3930e676436c 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -318,6 +318,7 @@ enum {  	TRACE_EVENT_FL_KPROBE_BIT,  	TRACE_EVENT_FL_UPROBE_BIT,  	TRACE_EVENT_FL_EPROBE_BIT, +	TRACE_EVENT_FL_FPROBE_BIT,  	TRACE_EVENT_FL_CUSTOM_BIT,  }; @@ -332,6 +333,7 @@ enum {   *  KPROBE        - Event is a kprobe   *  UPROBE        - Event is a uprobe   *  EPROBE        - Event is an event probe + *  FPROBE        - Event is an function probe   *  CUSTOM        - Event is a custom event (to be attached to an exsiting tracepoint)   *                   This is set when the custom event has not been attached   *                   to a tracepoint yet, then it is cleared when it is. @@ -346,6 +348,7 @@ enum {  	TRACE_EVENT_FL_KPROBE		= (1 << TRACE_EVENT_FL_KPROBE_BIT),  	TRACE_EVENT_FL_UPROBE		= (1 << TRACE_EVENT_FL_UPROBE_BIT),  	TRACE_EVENT_FL_EPROBE		= (1 << TRACE_EVENT_FL_EPROBE_BIT), +	TRACE_EVENT_FL_FPROBE		= (1 << TRACE_EVENT_FL_FPROBE_BIT),  	TRACE_EVENT_FL_CUSTOM		= (1 << TRACE_EVENT_FL_CUSTOM_BIT),  }; diff --git a/include/linux/tracepoint-defs.h b/include/linux/tracepoint-defs.h index e7c2276be33e..4dc4955f0fbf 100644 --- a/include/linux/tracepoint-defs.h +++ b/include/linux/tracepoint-defs.h @@ -35,6 +35,7 @@ struct tracepoint {  	struct static_call_key *static_call_key;  	void *static_call_tramp;  	void *iterator; +	void *probestub;  	int (*regfunc)(void);  	void (*unregfunc)(void);  	struct tracepoint_func __rcu *funcs; diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 6811e43c1b5c..88c0ba623ee6 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -303,6 +303,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)  	__section("__tracepoints_strings") = #_name;			\  	extern struct static_call_key STATIC_CALL_KEY(tp_func_##_name);	\  	int __traceiter_##_name(void *__data, proto);			\ +	void __probestub_##_name(void *__data, proto);			\  	struct tracepoint __tracepoint_##_name	__used			\  	__section("__tracepoints") = {					\  		.name = __tpstrtab_##_name,				\ @@ -310,6 +311,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)  		.static_call_key = &STATIC_CALL_KEY(tp_func_##_name),	\  		.static_call_tramp = STATIC_CALL_TRAMP_ADDR(tp_func_##_name), \  		.iterator = &__traceiter_##_name,			\ +		.probestub = &__probestub_##_name,			\  		.regfunc = _reg,					\  		.unregfunc = _unreg,					\  		.funcs = NULL };					\ @@ -330,6 +332,9 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)  		}							\  		return 0;						\  	}								\ +	void __probestub_##_name(void *__data, proto)			\ +	{								\ +	}								\  	DEFINE_STATIC_CALL(tp_func_##_name, __traceiter_##_name);  #define DEFINE_TRACE(name, proto, args)		\ diff --git a/include/linux/uacce.h b/include/linux/uacce.h index 0a81c3dfd26c..e290c0269944 100644 --- a/include/linux/uacce.h +++ b/include/linux/uacce.h @@ -86,6 +86,7 @@ enum uacce_q_state {   * @state: queue state machine   * @pasid: pasid associated to the mm   * @handle: iommu_sva handle returned by iommu_sva_bind_device() + * @mapping: user space mapping of the queue   */  struct uacce_queue {  	struct uacce_device *uacce; @@ -97,6 +98,7 @@ struct uacce_queue {  	enum uacce_q_state state;  	u32 pasid;  	struct iommu_sva *handle; +	struct address_space *mapping;  };  /** @@ -114,7 +116,6 @@ struct uacce_queue {   * @mutex: protects uacce operation   * @priv: private pointer of the uacce   * @queues: list of queues - * @inode: core vfs   */  struct uacce_device {  	const char *algs; @@ -130,7 +131,6 @@ struct uacce_device {  	struct mutex mutex;  	void *priv;  	struct list_head queues; -	struct inode *inode;  };  #if IS_ENABLED(CONFIG_UACCE) diff --git a/include/linux/uio.h b/include/linux/uio.h index 8e7d2c425340..ff81e5ccaef2 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -413,4 +413,9 @@ static inline bool iov_iter_extract_will_pin(const struct iov_iter *iter)  	return user_backed_iter(iter);  } +struct sg_table; +ssize_t extract_iter_to_sg(struct iov_iter *iter, size_t len, +			   struct sg_table *sgtable, unsigned int sg_max, +			   iov_iter_extraction_t extraction_flags); +  #endif diff --git a/include/linux/ulpi/driver.h b/include/linux/ulpi/driver.h index c7a1810373e3..a8cb617a3028 100644 --- a/include/linux/ulpi/driver.h +++ b/include/linux/ulpi/driver.h @@ -15,9 +15,9 @@ struct ulpi_ops;   * @dev: device interface   */  struct ulpi { +	struct device dev;  	struct ulpi_device_id id;  	const struct ulpi_ops *ops; -	struct device dev;  };  #define to_ulpi_dev(d) container_of(d, struct ulpi, dev) diff --git a/include/linux/umh.h b/include/linux/umh.h index 5d1f6129b847..daa6a7048c11 100644 --- a/include/linux/umh.h +++ b/include/linux/umh.h @@ -42,8 +42,6 @@ call_usermodehelper_setup(const char *path, char **argv, char **envp,  extern int  call_usermodehelper_exec(struct subprocess_info *info, int wait); -extern struct ctl_table usermodehelper_table[]; -  enum umh_disable_depth {  	UMH_ENABLED = 0,  	UMH_FREEZING, diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 0c7eff91adf4..4e9623e8492b 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -267,7 +267,7 @@ struct hc_driver {  	int	(*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);  	/* called after entering D0 (etc), before resuming the hub */ -	int	(*pci_resume)(struct usb_hcd *hcd, bool hibernated); +	int	(*pci_resume)(struct usb_hcd *hcd, pm_message_t state);  	/* called just before hibernate final D3 state, allows host to poweroff parts */  	int	(*pci_poweroff_late)(struct usb_hcd *hcd, bool do_wakeup); diff --git a/include/linux/usb/midi-v2.h b/include/linux/usb/midi-v2.h new file mode 100644 index 000000000000..16f09d959a2d --- /dev/null +++ b/include/linux/usb/midi-v2.h @@ -0,0 +1,94 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * <linux/usb/midi-v2.h> -- USB MIDI 2.0 definitions. + */ + +#ifndef __LINUX_USB_MIDI_V2_H +#define __LINUX_USB_MIDI_V2_H + +#include <linux/types.h> +#include <linux/usb/midi.h> + +/* A.1 MS Class-Specific Interface Descriptor Types */ +#define USB_DT_CS_GR_TRM_BLOCK	0x26 + +/* A.1 MS Class-Specific Interface Descriptor Subtypes */ +/* same as MIDI 1.0 */ + +/* A.2 MS Class-Specific Endpoint Descriptor Subtypes */ +#define USB_MS_GENERAL_2_0	0x02 + +/* A.3 MS Class-Specific Group Terminal Block Descriptor Subtypes */ +#define USB_MS_GR_TRM_BLOCK_UNDEFINED	0x00 +#define USB_MS_GR_TRM_BLOCK_HEADER	0x01 +#define USB_MS_GR_TRM_BLOCK		0x02 + +/* A.4 MS Interface Header MIDIStreaming Class Revision */ +#define USB_MS_REV_MIDI_1_0		0x0100 +#define USB_MS_REV_MIDI_2_0		0x0200 + +/* A.5 MS MIDI IN and OUT Jack Types */ +/* same as MIDI 1.0 */ + +/* A.6 Group Terminal Block Types */ +#define USB_MS_GR_TRM_BLOCK_TYPE_BIDIRECTIONAL	0x00 +#define USB_MS_GR_TRM_BLOCK_TYPE_INPUT_ONLY	0x01 +#define USB_MS_GR_TRM_BLOCK_TYPE_OUTPUT_ONLY	0x02 + +/* A.7 Group Terminal Default MIDI Protocol */ +#define USB_MS_MIDI_PROTO_UNKNOWN	0x00 /* Unknown (Use MIDI-CI) */ +#define USB_MS_MIDI_PROTO_1_0_64	0x01 /* MIDI 1.0, UMP up to 64bits */ +#define USB_MS_MIDI_PROTO_1_0_64_JRTS	0x02 /* MIDI 1.0, UMP up to 64bits, Jitter Reduction Timestamps */ +#define USB_MS_MIDI_PROTO_1_0_128	0x03 /* MIDI 1.0, UMP up to 128bits */ +#define USB_MS_MIDI_PROTO_1_0_128_JRTS	0x04 /* MIDI 1.0, UMP up to 128bits, Jitter Reduction Timestamps */ +#define USB_MS_MIDI_PROTO_2_0		0x11 /* MIDI 2.0 */ +#define USB_MS_MIDI_PROTO_2_0_JRTS	0x12 /* MIDI 2.0, Jitter Reduction Timestamps */ + +/* 5.2.2.1 Class-Specific MS Interface Header Descriptor */ +/* Same as MIDI 1.0, use struct usb_ms_header_descriptor */ + +/* 5.3.2 Class-Specific MIDI Streaming Data Endpoint Descriptor */ +struct usb_ms20_endpoint_descriptor { +	__u8  bLength;			/* 4+n */ +	__u8  bDescriptorType;		/* USB_DT_CS_ENDPOINT */ +	__u8  bDescriptorSubtype;	/* USB_MS_GENERAL_2_0 */ +	__u8  bNumGrpTrmBlock;		/* Number of Group Terminal Blocks: n */ +	__u8  baAssoGrpTrmBlkID[];	/* ID of the Group Terminal Blocks [n] */ +} __packed; + +#define USB_DT_MS20_ENDPOINT_SIZE(n)	(4 + (n)) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_USB_MS20_ENDPOINT_DESCRIPTOR(n)			\ +struct usb_ms20_endpoint_descriptor_##n {			\ +	__u8  bLength;						\ +	__u8  bDescriptorType;					\ +	__u8  bDescriptorSubtype;				\ +	__u8  bNumGrpTrmBlock;					\ +	__u8  baAssoGrpTrmBlkID[n];				\ +} __packed + +/* 5.4.1 Class-Specific Group Terminal Block Header Descriptor */ +struct usb_ms20_gr_trm_block_header_descriptor { +	__u8  bLength;			/* 5 */ +	__u8  bDescriptorType;		/* USB_DT_CS_GR_TRM_BLOCK */ +	__u8  bDescriptorSubtype;	/* USB_MS_GR_TRM_BLOCK_HEADER */ +	__le16 wTotalLength;		/* Total number of bytes */ +} __packed; + +/* 5.4.2.1 Group Terminal Block Descriptor */ +struct usb_ms20_gr_trm_block_descriptor { +	__u8  bLength;			/* 13 */ +	__u8  bDescriptorType;		/* USB_DT_CS_GR_TRM_BLOCK */ +	__u8  bDescriptorSubtype;	/* USB_MS_GR_TRM_BLOCK */ +	__u8  bGrpTrmBlkID;		/* ID of this Group Terminal Block */ +	__u8  bGrpTrmBlkType;		/* Group Terminal Block Type */ +	__u8  nGroupTrm;		/* The first member Group Terminal in this block */ +	__u8  nNumGroupTrm;		/* Number of member Group Terminals spanned */ +	__u8  iBlockItem;		/* String ID of Block item */ +	__u8  bMIDIProtocol;		/* Default MIDI protocol */ +	__le16 wMaxInputBandwidth;	/* Max input bandwidth capability in 4kB/s */ +	__le16 wMaxOutputBandwidth;	/* Max output bandwidth capability in 4kB/s */ +} __packed; + +#endif /* __LINUX_USB_MIDI_V2_H */ diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index e4a3ad3c800f..3963e55e88a3 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -99,9 +99,6 @@ struct musb_hdrc_platform_data {  	/* (HOST or OTG) program PHY for external Vbus */  	unsigned	extvbus:1; -	/* Power the device on or off */ -	int		(*set_power)(int state); -  	/* MUSB configuration-specific details */  	const struct musb_hdrc_config *config; @@ -135,14 +132,4 @@ static inline int musb_mailbox(enum musb_vbus_id_status status)  #define	TUSB6010_REFCLK_24	41667	/* psec/clk @ 24.0 MHz XI */  #define	TUSB6010_REFCLK_19	52083	/* psec/clk @ 19.2 MHz CLKIN */ -#ifdef	CONFIG_ARCH_OMAP2 - -extern int __init tusb6010_setup_interface( -		struct musb_hdrc_platform_data *data, -		unsigned ps_refclk, unsigned waitpin, -		unsigned async_cs, unsigned sync_cs, -		unsigned irq, unsigned dmachan); - -#endif	/* OMAP2 */ -  #endif /* __LINUX_USB_MUSB_H */ diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 7eeb5f9c4f0d..1a0a4dc87980 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -278,7 +278,7 @@ struct usb_serial_driver {  	int  (*set_serial)(struct tty_struct *tty, struct serial_struct *ss);  	void (*set_termios)(struct tty_struct *tty, struct usb_serial_port *port,  			    const struct ktermios *old); -	void (*break_ctl)(struct tty_struct *tty, int break_state); +	int (*break_ctl)(struct tty_struct *tty, int break_state);  	unsigned int (*chars_in_buffer)(struct tty_struct *tty);  	void (*wait_until_sent)(struct tty_struct *tty, long timeout);  	bool (*tx_empty)(struct usb_serial_port *port); diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h index 9292f0e07846..2489a7857d8e 100644 --- a/include/linux/usb/typec_mux.h +++ b/include/linux/usb/typec_mux.h @@ -60,8 +60,7 @@ struct typec_mux_desc {  #if IS_ENABLED(CONFIG_TYPEC) -struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode, -				       const struct typec_altmode_desc *desc); +struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode);  void typec_mux_put(struct typec_mux *mux);  int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state); @@ -74,8 +73,7 @@ void *typec_mux_get_drvdata(struct typec_mux_dev *mux);  #else -static inline struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode, -				       const struct typec_altmode_desc *desc) +static inline struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode)  {  	return NULL;  } @@ -102,10 +100,9 @@ static inline void *typec_mux_get_drvdata(struct typec_mux_dev *mux)  #endif /* CONFIG_TYPEC */ -static inline struct typec_mux * -typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc) +static inline struct typec_mux *typec_mux_get(struct device *dev)  { -	return fwnode_typec_mux_get(dev_fwnode(dev), desc); +	return fwnode_typec_mux_get(dev_fwnode(dev));  }  #endif /* __USB_TYPEC_MUX */ diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h index 367fd79226a3..562e8754869d 100644 --- a/include/linux/vfio_pci_core.h +++ b/include/linux/vfio_pci_core.h @@ -59,8 +59,7 @@ struct vfio_pci_core_device {  	struct perm_bits	*msi_perm;  	spinlock_t		irqlock;  	struct mutex		igate; -	struct vfio_pci_irq_ctx	*ctx; -	int			num_ctx; +	struct xarray		ctx;  	int			irq_type;  	int			num_regions;  	struct vfio_pci_region	*region; @@ -69,17 +68,18 @@ struct vfio_pci_core_device {  	u16			msix_size;  	u32			msix_offset;  	u32			rbar[7]; -	bool			pci_2_3; -	bool			virq_disabled; -	bool			reset_works; -	bool			extended_caps; -	bool			bardirty; -	bool			has_vga; -	bool			needs_reset; -	bool			nointx; -	bool			needs_pm_restore; -	bool			pm_intx_masked; -	bool			pm_runtime_engaged; +	bool			has_dyn_msix:1; +	bool			pci_2_3:1; +	bool			virq_disabled:1; +	bool			reset_works:1; +	bool			extended_caps:1; +	bool			bardirty:1; +	bool			has_vga:1; +	bool			needs_reset:1; +	bool			nointx:1; +	bool			needs_pm_restore:1; +	bool			pm_intx_masked:1; +	bool			pm_runtime_engaged:1;  	struct pci_saved_state	*pci_saved_state;  	struct pci_saved_state	*pm_save;  	int			ioeventfds_nr; diff --git a/include/linux/via-gpio.h b/include/linux/via-gpio.h deleted file mode 100644 index ac34668fd442..000000000000 --- a/include/linux/via-gpio.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Support for viafb GPIO ports. - * - * Copyright 2009 Jonathan Corbet <[email protected]> - */ - -#ifndef __VIA_GPIO_H__ -#define __VIA_GPIO_H__ - -extern int viafb_gpio_lookup(const char *name); -extern int viafb_gpio_init(void); -extern void viafb_gpio_exit(void); -#endif diff --git a/include/linux/virtio.h b/include/linux/virtio.h index b93238db94e3..de6041deee37 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h @@ -103,6 +103,7 @@ int virtqueue_resize(struct virtqueue *vq, u32 num,   * @config_enabled: configuration change reporting enabled   * @config_change_pending: configuration change reported while disabled   * @config_lock: protects configuration change reporting + * @vqs_list_lock: protects @vqs.   * @dev: underlying device.   * @id: the device type identification (used to match it with a driver).   * @config: the configuration ops for this device. @@ -117,7 +118,7 @@ struct virtio_device {  	bool config_enabled;  	bool config_change_pending;  	spinlock_t config_lock; -	spinlock_t vqs_list_lock; /* Protects VQs list access */ +	spinlock_t vqs_list_lock;  	struct device dev;  	struct virtio_device_id id;  	const struct virtio_config_ops *config; @@ -160,6 +161,8 @@ size_t virtio_max_dma_size(const struct virtio_device *vdev);   * @feature_table_size: number of entries in the feature table array.   * @feature_table_legacy: same as feature_table but when working in legacy mode.   * @feature_table_size_legacy: number of entries in feature table legacy array. + * @validate: the function to call to validate features and config space. + *            Returns 0 or -errno.   * @probe: the function to call when a device is found.  Returns 0 or -errno.   * @scan: optional function to call after successful probe; intended   *    for virtio-scsi to invoke a scan. diff --git a/include/linux/virtio_pci_modern.h b/include/linux/virtio_pci_modern.h index c4eeb79b0139..067ac1d789bc 100644 --- a/include/linux/virtio_pci_modern.h +++ b/include/linux/virtio_pci_modern.h @@ -38,6 +38,12 @@ struct virtio_pci_modern_device {  	int modern_bars;  	struct virtio_device_id id; + +	/* optional check for vendor virtio device, returns dev_id or -ERRNO */ +	int (*device_id_check)(struct pci_dev *pdev); + +	/* optional mask for devices with limited DMA space */ +	u64 dma_mask;  };  /* diff --git a/include/linux/wmi.h b/include/linux/wmi.h index b88d7b58e61e..763bd382cf2d 100644 --- a/include/linux/wmi.h +++ b/include/linux/wmi.h @@ -13,25 +13,46 @@  #include <linux/mod_devicetable.h>  #include <uapi/linux/wmi.h> +/** + * struct wmi_device - WMI device structure + * @dev: Device associated with this WMI device + * @setable: True for devices implementing the Set Control Method + * + * This represents WMI devices discovered by the WMI driver core. + */  struct wmi_device {  	struct device dev; -	 /* True for data blocks implementing the Set Control Method */ +	/* private: used by the WMI driver core */  	bool setable;  }; -/* evaluate the ACPI method associated with this device */  extern acpi_status wmidev_evaluate_method(struct wmi_device *wdev,  					  u8 instance, u32 method_id,  					  const struct acpi_buffer *in,  					  struct acpi_buffer *out); -/* Caller must kfree the result. */  extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,  					     u8 instance); +u8 wmidev_instance_count(struct wmi_device *wdev); +  extern int set_required_buffer_size(struct wmi_device *wdev, u64 length); +/** + * struct wmi_driver - WMI driver structure + * @driver: Driver model structure + * @id_table: List of WMI GUIDs supported by this driver + * @no_notify_data: WMI events provide no event data + * @probe: Callback for device binding + * @remove: Callback for device unbinding + * @notify: Callback for receiving WMI events + * @filter_callback: Callback for filtering device IOCTLs + * + * This represents WMI drivers which handle WMI devices. + * @filter_callback is only necessary for drivers which + * want to set up a WMI IOCTL interface. + */  struct wmi_driver {  	struct device_driver driver;  	const struct wmi_device_id *id_table; @@ -47,8 +68,24 @@ struct wmi_driver {  extern int __must_check __wmi_driver_register(struct wmi_driver *driver,  					      struct module *owner);  extern void wmi_driver_unregister(struct wmi_driver *driver); + +/** + * wmi_driver_register() - Helper macro to register a WMI driver + * @driver: wmi_driver struct + * + * Helper macro for registering a WMI driver. It automatically passes + * THIS_MODULE to the underlying function. + */  #define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE) +/** + * module_wmi_driver() - Helper macro to register/unregister a WMI driver + * @__wmi_driver: wmi_driver struct + * + * Helper macro for WMI drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit(). + */  #define module_wmi_driver(__wmi_driver) \  	module_driver(__wmi_driver, wmi_driver_register, \  		      wmi_driver_unregister) |