diff options
Diffstat (limited to 'include')
2646 files changed, 16713 insertions, 9013 deletions
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index ad54610ea6cd..17d61b1f2511 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -126,8 +126,12 @@ struct acpi_exception_info {  #define AE_NOT_CONFIGURED               EXCEP_ENV (0x001C)  #define AE_ACCESS                       EXCEP_ENV (0x001D)  #define AE_IO_ERROR                     EXCEP_ENV (0x001E) +#define AE_NUMERIC_OVERFLOW             EXCEP_ENV (0x001F) +#define AE_HEX_OVERFLOW                 EXCEP_ENV (0x0020) +#define AE_DECIMAL_OVERFLOW             EXCEP_ENV (0x0021) +#define AE_OCTAL_OVERFLOW               EXCEP_ENV (0x0022) -#define AE_CODE_ENV_MAX                 0x001E +#define AE_CODE_ENV_MAX                 0x0022  /*   * Programmer exceptions @@ -263,7 +267,15 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {  	EXCEP_TXT("AE_NOT_CONFIGURED",  		  "The interface is not part of the current subsystem configuration"),  	EXCEP_TXT("AE_ACCESS", "Permission denied for the requested operation"), -	EXCEP_TXT("AE_IO_ERROR", "An I/O error occurred") +	EXCEP_TXT("AE_IO_ERROR", "An I/O error occurred"), +	EXCEP_TXT("AE_NUMERIC_OVERFLOW", +		  "Overflow during string-to-integer conversion"), +	EXCEP_TXT("AE_HEX_OVERFLOW", +		  "Overflow during ASCII hex-to-binary conversion"), +	EXCEP_TXT("AE_DECIMAL_OVERFLOW", +		  "Overflow during ASCII decimal-to-binary conversion"), +	EXCEP_TXT("AE_OCTAL_OVERFLOW", +		  "Overflow during ASCII octal-to-binary conversion")  };  static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index fa1505292f6c..f849be28e082 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -211,7 +211,7 @@ struct acpi_device_flags {  	u32 of_compatible_ok:1;  	u32 coherent_dma:1;  	u32 cca_seen:1; -	u32 spi_i2c_slave:1; +	u32 serial_bus_slave:1;  	u32 reserved:19;  }; diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h index 303315b9693f..d0633fc1fc15 100644 --- a/include/acpi/acpi_io.h +++ b/include/acpi/acpi_io.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ACPI_IO_H_  #define _ACPI_IO_H_ diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h index 1e3a74f94131..fdebcfc6c8df 100644 --- a/include/acpi/acpi_numa.h +++ b/include/acpi/acpi_numa.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ACPI_NUMA_H  #define __ACPI_NUMA_H diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index c66eb8ffa454..d5c0f5153c4e 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -287,6 +287,8 @@ acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);  /*   * Platform and hardware-independent physical memory interfaces   */ +int acpi_os_read_iomem(void __iomem *virt_addr, u64 *value, u32 width); +  #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_memory  acpi_status  acpi_os_read_memory(acpi_physical_address address, u64 *value, u32 width); diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 53c5e2f7bcec..e1dd1a8d42b6 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -46,7 +46,7 @@  /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION                 0x20170728 +#define ACPI_CA_VERSION                 0x20170831  #include <acpi/acconfig.h>  #include <acpi/actypes.h> diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 6b8714a428b6..7a89e6de94da 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -69,6 +69,7 @@  #define ACPI_SIG_HEST           "HEST"	/* Hardware Error Source Table */  #define ACPI_SIG_MADT           "APIC"	/* Multiple APIC Description Table */  #define ACPI_SIG_MSCT           "MSCT"	/* Maximum System Characteristics Table */ +#define ACPI_SIG_PDTT           "PDTT"	/* Processor Debug Trigger Table */  #define ACPI_SIG_PPTT           "PPTT"	/* Processor Properties Topology Table */  #define ACPI_SIG_SBST           "SBST"	/* Smart Battery Specification Table */  #define ACPI_SIG_SLIT           "SLIT"	/* System Locality Distance Information Table */ @@ -1282,6 +1283,35 @@ struct acpi_nfit_flush_address {  /*******************************************************************************   * + * PDTT - Processor Debug Trigger Table (ACPI 6.2) + *        Version 0 + * + ******************************************************************************/ + +struct acpi_table_pdtt { +	struct acpi_table_header header;	/* Common ACPI table header */ +	u8 trigger_count; +	u8 reserved[3]; +	u32 array_offset; +}; + +/* + * PDTT Communication Channel Identifier Structure. + * The number of these structures is defined by trigger_count above, + * starting at array_offset. + */ +struct acpi_pdtt_channel { +	u16 sub_channel_id; +}; + +/* Mask and Flags for above */ + +#define ACPI_PDTT_SUBCHANNEL_ID_MASK        0x00FF +#define ACPI_PDTT_RUNTIME_TRIGGER           (1<<8) +#define ACPI_PPTT_WAIT_COMPLETION           (1<<9) + +/******************************************************************************* + *   * PPTT - Processor Properties Topology Table (ACPI 6.2)   *        Version 1   * diff --git a/include/acpi/apei.h b/include/acpi/apei.h index c46694abea28..680f80960c3d 100644 --- a/include/acpi/apei.h +++ b/include/acpi/apei.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * apei.h - ACPI Platform Error Interface   */ @@ -50,7 +51,6 @@ int erst_clear(u64 record_id);  int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data);  void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err); -void arch_apei_flush_tlb_one(unsigned long addr);  #endif  #endif diff --git a/include/acpi/button.h b/include/acpi/button.h index 1cad8b2d460c..3a2b8535dec6 100644 --- a/include/acpi/button.h +++ b/include/acpi/button.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ACPI_BUTTON_H  #define ACPI_BUTTON_H diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h index 9061c5c743b3..8feb0c866ee0 100644 --- a/include/acpi/ghes.h +++ b/include/acpi/ghes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef GHES_H  #define GHES_H diff --git a/include/acpi/pcc.h b/include/acpi/pcc.h index 8caa79c61703..cd6ef45e614e 100644 --- a/include/acpi/pcc.h +++ b/include/acpi/pcc.h @@ -13,6 +13,7 @@  #include <linux/mailbox_controller.h>  #include <linux/mailbox_client.h> +#define MAX_PCC_SUBSPACES	256  #ifdef CONFIG_PCC  extern struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,  						  int subspace_id); diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h index 552637b0d051..967c552d1cd3 100644 --- a/include/acpi/pdc_intel.h +++ b/include/acpi/pdc_intel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* _PDC bit definition for Intel processors */ diff --git a/include/acpi/processor.h b/include/acpi/processor.h index c1ba00fc4888..d591bb77f592 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ACPI_PROCESSOR_H  #define __ACPI_PROCESSOR_H diff --git a/include/acpi/reboot.h b/include/acpi/reboot.h index 0419184ce886..14122fc55bbe 100644 --- a/include/acpi/reboot.h +++ b/include/acpi/reboot.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ACPI_REBOOT_H  #define __ACPI_REBOOT_H diff --git a/include/acpi/video.h b/include/acpi/video.h index bfe484da55d2..db8548ff03ce 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ACPI_VIDEO_H  #define __ACPI_VIDEO_H diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h index 928fd66b1271..89f3b03b1445 100644 --- a/include/asm-generic/4level-fixup.h +++ b/include/asm-generic/4level-fixup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _4LEVEL_FIXUP_H  #define _4LEVEL_FIXUP_H diff --git a/include/asm-generic/5level-fixup.h b/include/asm-generic/5level-fixup.h index b5ca82dc4175..dfbd9d990637 100644 --- a/include/asm-generic/5level-fixup.h +++ b/include/asm-generic/5level-fixup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _5LEVEL_FIXUP_H  #define _5LEVEL_FIXUP_H diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h index 939869c772b1..2fa2bc208383 100644 --- a/include/asm-generic/asm-prototypes.h +++ b/include/asm-generic/asm-prototypes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <linux/bitops.h>  #undef __memset  extern void *__memset(void *, int, __kernel_size_t); diff --git a/include/asm-generic/atomic-long.h b/include/asm-generic/atomic-long.h index 288cc9e96395..34a028a7bcc5 100644 --- a/include/asm-generic/atomic-long.h +++ b/include/asm-generic/atomic-long.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_ATOMIC_LONG_H  #define _ASM_GENERIC_ATOMIC_LONG_H  /* @@ -243,4 +244,7 @@ static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)  #define atomic_long_inc_not_zero(l) \  	ATOMIC_LONG_PFX(_inc_not_zero)((ATOMIC_LONG_PFX(_t) *)(l)) +#define atomic_long_cond_read_acquire(v, c) \ +	ATOMIC_LONG_PFX(_cond_read_acquire)((ATOMIC_LONG_PFX(_t) *)(v), (c)) +  #endif  /*  _ASM_GENERIC_ATOMIC_LONG_H  */ diff --git a/include/asm-generic/audit_change_attr.h b/include/asm-generic/audit_change_attr.h index a1865537339b..331670807cf0 100644 --- a/include/asm-generic/audit_change_attr.h +++ b/include/asm-generic/audit_change_attr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifdef __NR_chmod  __NR_chmod,  #endif diff --git a/include/asm-generic/audit_dir_write.h b/include/asm-generic/audit_dir_write.h index 7b61db4fe72b..da09fb986459 100644 --- a/include/asm-generic/audit_dir_write.h +++ b/include/asm-generic/audit_dir_write.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifdef __NR_rename  __NR_rename,  #endif @@ -30,3 +31,6 @@ __NR_renameat,  __NR_linkat,  __NR_symlinkat,  #endif +#ifdef __NR_renameat2 +__NR_renameat2, +#endif diff --git a/include/asm-generic/audit_read.h b/include/asm-generic/audit_read.h index 3b249cb857dc..7bb7b5a83ae2 100644 --- a/include/asm-generic/audit_read.h +++ b/include/asm-generic/audit_read.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifdef __NR_readlink  __NR_readlink,  #endif diff --git a/include/asm-generic/audit_write.h b/include/asm-generic/audit_write.h index 274575d7129f..f9f1d0ae11d9 100644 --- a/include/asm-generic/audit_write.h +++ b/include/asm-generic/audit_write.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <asm-generic/audit_dir_write.h>  __NR_acct,  #ifdef __NR_swapon @@ -19,3 +20,6 @@ __NR_ftruncate64,  #ifdef __NR_bind  __NR_bind,		/* bind can affect fs object only in one way... */  #endif +#ifdef __NR_fallocate +__NR_fallocate, +#endif diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index dcdcacf2fd2b..bfc96bf6606e 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_BITOPS_H  #define __ASM_GENERIC_BITOPS_H diff --git a/include/asm-generic/bitops/__ffs.h b/include/asm-generic/bitops/__ffs.h index 937d7c435575..39e56e1c7203 100644 --- a/include/asm-generic/bitops/__ffs.h +++ b/include/asm-generic/bitops/__ffs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS___FFS_H_  #define _ASM_GENERIC_BITOPS___FFS_H_ diff --git a/include/asm-generic/bitops/__fls.h b/include/asm-generic/bitops/__fls.h index a60a7ccb6782..03f721a8a2b1 100644 --- a/include/asm-generic/bitops/__fls.h +++ b/include/asm-generic/bitops/__fls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS___FLS_H_  #define _ASM_GENERIC_BITOPS___FLS_H_ diff --git a/include/asm-generic/bitops/arch_hweight.h b/include/asm-generic/bitops/arch_hweight.h index 6a211f40665c..c2705e1d220d 100644 --- a/include/asm-generic/bitops/arch_hweight.h +++ b/include/asm-generic/bitops/arch_hweight.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_  #define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h index 49673510b484..04deffaf5f7d 100644 --- a/include/asm-generic/bitops/atomic.h +++ b/include/asm-generic/bitops/atomic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_ATOMIC_H_  #define _ASM_GENERIC_BITOPS_ATOMIC_H_ diff --git a/include/asm-generic/bitops/builtin-__ffs.h b/include/asm-generic/bitops/builtin-__ffs.h index 90041e3a41f0..87024da44d10 100644 --- a/include/asm-generic/bitops/builtin-__ffs.h +++ b/include/asm-generic/bitops/builtin-__ffs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_  #define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_ diff --git a/include/asm-generic/bitops/builtin-__fls.h b/include/asm-generic/bitops/builtin-__fls.h index 0248f386635f..43a5aa9afbdb 100644 --- a/include/asm-generic/bitops/builtin-__fls.h +++ b/include/asm-generic/bitops/builtin-__fls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_  #define _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_ diff --git a/include/asm-generic/bitops/builtin-ffs.h b/include/asm-generic/bitops/builtin-ffs.h index 064825829e1c..458c85ebcd15 100644 --- a/include/asm-generic/bitops/builtin-ffs.h +++ b/include/asm-generic/bitops/builtin-ffs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_  #define _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_ diff --git a/include/asm-generic/bitops/builtin-fls.h b/include/asm-generic/bitops/builtin-fls.h index eda652d0ac7f..62daf940989d 100644 --- a/include/asm-generic/bitops/builtin-fls.h +++ b/include/asm-generic/bitops/builtin-fls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_  #define _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_ diff --git a/include/asm-generic/bitops/const_hweight.h b/include/asm-generic/bitops/const_hweight.h index 0a7e06623470..149faeeeeaf2 100644 --- a/include/asm-generic/bitops/const_hweight.h +++ b/include/asm-generic/bitops/const_hweight.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_  #define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ diff --git a/include/asm-generic/bitops/ext2-atomic-setbit.h b/include/asm-generic/bitops/ext2-atomic-setbit.h index 5a0997857b34..b041cbf0d899 100644 --- a/include/asm-generic/bitops/ext2-atomic-setbit.h +++ b/include/asm-generic/bitops/ext2-atomic-setbit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_  #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_ diff --git a/include/asm-generic/bitops/ext2-atomic.h b/include/asm-generic/bitops/ext2-atomic.h index 87f0f109d7f1..0cfc3180b074 100644 --- a/include/asm-generic/bitops/ext2-atomic.h +++ b/include/asm-generic/bitops/ext2-atomic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_  #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ diff --git a/include/asm-generic/bitops/ffs.h b/include/asm-generic/bitops/ffs.h index fbbb43af7dc0..e81868b2c0f0 100644 --- a/include/asm-generic/bitops/ffs.h +++ b/include/asm-generic/bitops/ffs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_FFS_H_  #define _ASM_GENERIC_BITOPS_FFS_H_ diff --git a/include/asm-generic/bitops/ffz.h b/include/asm-generic/bitops/ffz.h index 6744bd4cdf46..0d010085fdec 100644 --- a/include/asm-generic/bitops/ffz.h +++ b/include/asm-generic/bitops/ffz.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_FFZ_H_  #define _ASM_GENERIC_BITOPS_FFZ_H_ diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h index 998d4d544f18..1ba611e16fa0 100644 --- a/include/asm-generic/bitops/find.h +++ b/include/asm-generic/bitops/find.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_FIND_H_  #define _ASM_GENERIC_BITOPS_FIND_H_ diff --git a/include/asm-generic/bitops/fls.h b/include/asm-generic/bitops/fls.h index 0576d1f42f43..753aecaab641 100644 --- a/include/asm-generic/bitops/fls.h +++ b/include/asm-generic/bitops/fls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_FLS_H_  #define _ASM_GENERIC_BITOPS_FLS_H_ diff --git a/include/asm-generic/bitops/fls64.h b/include/asm-generic/bitops/fls64.h index b097cf8444e3..866f2b2304ff 100644 --- a/include/asm-generic/bitops/fls64.h +++ b/include/asm-generic/bitops/fls64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_FLS64_H_  #define _ASM_GENERIC_BITOPS_FLS64_H_ diff --git a/include/asm-generic/bitops/hweight.h b/include/asm-generic/bitops/hweight.h index a94d6519c7ed..6bf1bba83589 100644 --- a/include/asm-generic/bitops/hweight.h +++ b/include/asm-generic/bitops/hweight.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_  #define _ASM_GENERIC_BITOPS_HWEIGHT_H_ diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h index 61731543c00e..188d3eba3ace 100644 --- a/include/asm-generic/bitops/le.h +++ b/include/asm-generic/bitops/le.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_LE_H_  #define _ASM_GENERIC_BITOPS_LE_H_ diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h index 8ef0ccbf8167..bc397573c43a 100644 --- a/include/asm-generic/bitops/lock.h +++ b/include/asm-generic/bitops/lock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_LOCK_H_  #define _ASM_GENERIC_BITOPS_LOCK_H_ diff --git a/include/asm-generic/bitops/non-atomic.h b/include/asm-generic/bitops/non-atomic.h index 697cc2b7e0f0..7e10c4b50c5d 100644 --- a/include/asm-generic/bitops/non-atomic.h +++ b/include/asm-generic/bitops/non-atomic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_NON_ATOMIC_H_  #define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ diff --git a/include/asm-generic/bitops/sched.h b/include/asm-generic/bitops/sched.h index 604fab7031a6..86470cfcef60 100644 --- a/include/asm-generic/bitops/sched.h +++ b/include/asm-generic/bitops/sched.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BITOPS_SCHED_H_  #define _ASM_GENERIC_BITOPS_SCHED_H_ diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h index d1d70aa19021..3905c1c93dc2 100644 --- a/include/asm-generic/bitsperlong.h +++ b/include/asm-generic/bitsperlong.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_BITS_PER_LONG  #define __ASM_GENERIC_BITS_PER_LONG diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 87191357d303..963b755d19b0 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -1,8 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_BUG_H  #define _ASM_GENERIC_BUG_H  #include <linux/compiler.h> +#define CUT_HERE		"------------[ cut here ]------------\n" +  #ifdef CONFIG_GENERIC_BUG  #define BUGFLAG_WARNING		(1 << 0)  #define BUGFLAG_ONCE		(1 << 1) @@ -89,10 +92,11 @@ extern void warn_slowpath_null(const char *file, const int line);  #define __WARN_printf_taint(taint, arg...)				\  	warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)  #else +extern __printf(1, 2) void __warn_printk(const char *fmt, ...);  #define __WARN()		__WARN_TAINT(TAINT_WARN) -#define __WARN_printf(arg...)	do { printk(arg); __WARN(); } while (0) +#define __WARN_printf(arg...)	do { __warn_printk(arg); __WARN(); } while (0)  #define __WARN_printf_taint(taint, arg...)				\ -	do { printk(arg); __WARN_TAINT(taint); } while (0) +	do { __warn_printk(arg); __WARN_TAINT(taint); } while (0)  #endif  /* used internally by panic.c */ @@ -129,7 +133,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,  #ifndef WARN_ON_ONCE  #define WARN_ON_ONCE(condition)	({				\ -	static bool __section(.data.unlikely) __warned;		\ +	static bool __section(.data.once) __warned;		\  	int __ret_warn_once = !!(condition);			\  								\  	if (unlikely(__ret_warn_once && !__warned)) {		\ @@ -141,7 +145,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,  #endif  #define WARN_ONCE(condition, format...)	({			\ -	static bool __section(.data.unlikely) __warned;		\ +	static bool __section(.data.once) __warned;		\  	int __ret_warn_once = !!(condition);			\  								\  	if (unlikely(__ret_warn_once && !__warned)) {		\ @@ -152,7 +156,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,  })  #define WARN_TAINT_ONCE(condition, taint, format...)	({	\ -	static bool __section(.data.unlikely) __warned;		\ +	static bool __section(.data.once) __warned;		\  	int __ret_warn_once = !!(condition);			\  								\  	if (unlikely(__ret_warn_once && !__warned)) {		\ diff --git a/include/asm-generic/bugs.h b/include/asm-generic/bugs.h index 6c4f62ea714d..69021830f078 100644 --- a/include/asm-generic/bugs.h +++ b/include/asm-generic/bugs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_BUGS_H  #define __ASM_GENERIC_BUGS_H  /* diff --git a/include/asm-generic/cache.h b/include/asm-generic/cache.h index 1bfcfe5c2237..60386e164246 100644 --- a/include/asm-generic/cache.h +++ b/include/asm-generic/cache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_CACHE_H  #define __ASM_GENERIC_CACHE_H  /* diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h index 87bc536ccde3..0dd47a6db2cf 100644 --- a/include/asm-generic/cacheflush.h +++ b/include/asm-generic/cacheflush.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_CACHEFLUSH_H  #define __ASM_CACHEFLUSH_H diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h index 3150cbd8eb21..34785c0f57b0 100644 --- a/include/asm-generic/checksum.h +++ b/include/asm-generic/checksum.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_CHECKSUM_H  #define __ASM_GENERIC_CHECKSUM_H diff --git a/include/asm-generic/cmpxchg-local.h b/include/asm-generic/cmpxchg-local.h index 70bef78912b7..f17f14f84d09 100644 --- a/include/asm-generic/cmpxchg-local.h +++ b/include/asm-generic/cmpxchg-local.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_CMPXCHG_LOCAL_H  #define __ASM_GENERIC_CMPXCHG_LOCAL_H diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h index e5f9080e8e86..9a24510cd8c1 100644 --- a/include/asm-generic/cmpxchg.h +++ b/include/asm-generic/cmpxchg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Generic UP xchg and cmpxchg using interrupt disablement.  Does not   * support SMP. diff --git a/include/asm-generic/current.h b/include/asm-generic/current.h index 5e86f6ae7cab..3a2e224b9fa0 100644 --- a/include/asm-generic/current.h +++ b/include/asm-generic/current.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_CURRENT_H  #define __ASM_GENERIC_CURRENT_H diff --git a/include/asm-generic/delay.h b/include/asm-generic/delay.h index 0f79054ce7cd..e448ac61430c 100644 --- a/include/asm-generic/delay.h +++ b/include/asm-generic/delay.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_DELAY_H  #define __ASM_GENERIC_DELAY_H diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h index 163f77999ea4..dc9726fdac8f 100644 --- a/include/asm-generic/div64.h +++ b/include/asm-generic/div64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_DIV64_H  #define _ASM_GENERIC_DIV64_H  /* @@ -25,6 +26,20 @@  #if BITS_PER_LONG == 64 +/** + * do_div - returns 2 values: calculate remainder and update new dividend + * @n: pointer to uint64_t dividend (will be updated) + * @base: uint32_t divisor + * + * Summary: + * ``uint32_t remainder = *n % base;`` + * ``*n = *n / base;`` + * + * Return: (uint32_t)remainder + * + * NOTE: macro parameter @n is evaluated multiple times, + * beware of side effects! + */  # define do_div(n,base) ({					\  	uint32_t __base = (base);				\  	uint32_t __rem;						\ diff --git a/include/asm-generic/dma-contiguous.h b/include/asm-generic/dma-contiguous.h index 292c571750f0..f24b0f9a4f05 100644 --- a/include/asm-generic/dma-contiguous.h +++ b/include/asm-generic/dma-contiguous.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_DMA_CONTIGUOUS_H  #define _ASM_GENERIC_DMA_CONTIGUOUS_H diff --git a/include/asm-generic/dma.h b/include/asm-generic/dma.h index 9dfc3a7f36d2..43d0c8af8058 100644 --- a/include/asm-generic/dma.h +++ b/include/asm-generic/dma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_DMA_H  #define __ASM_GENERIC_DMA_H  /* diff --git a/include/asm-generic/early_ioremap.h b/include/asm-generic/early_ioremap.h index 2edef8d7fa6b..9def22e6e2b3 100644 --- a/include/asm-generic/early_ioremap.h +++ b/include/asm-generic/early_ioremap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_EARLY_IOREMAP_H_  #define _ASM_EARLY_IOREMAP_H_ diff --git a/include/asm-generic/emergency-restart.h b/include/asm-generic/emergency-restart.h index 0d68a1eae985..445de38b795e 100644 --- a/include/asm-generic/emergency-restart.h +++ b/include/asm-generic/emergency-restart.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_EMERGENCY_RESTART_H  #define _ASM_GENERIC_EMERGENCY_RESTART_H diff --git a/include/asm-generic/extable.h b/include/asm-generic/extable.h index ca14c6664027..f9618bd0723a 100644 --- a/include/asm-generic/extable.h +++ b/include/asm-generic/extable.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_EXTABLE_H  #define __ASM_GENERIC_EXTABLE_H diff --git a/include/asm-generic/fb.h b/include/asm-generic/fb.h index fe8ca7fcea00..f9f18101ed36 100644 --- a/include/asm-generic/fb.h +++ b/include/asm-generic/fb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_FB_H_  #define __ASM_GENERIC_FB_H_  #include <linux/fb.h> diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h index f0d8b1c51343..fcb61b4659b3 100644 --- a/include/asm-generic/futex.h +++ b/include/asm-generic/futex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_FUTEX_H  #define _ASM_GENERIC_FUTEX_H diff --git a/include/asm-generic/getorder.h b/include/asm-generic/getorder.h index 65e4468ac53d..c64bea7a52be 100644 --- a/include/asm-generic/getorder.h +++ b/include/asm-generic/getorder.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_GETORDER_H  #define __ASM_GENERIC_GETORDER_H diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 8ca627dcea11..19eadac415c4 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_GPIO_H  #define _ASM_GENERIC_GPIO_H diff --git a/include/asm-generic/hardirq.h b/include/asm-generic/hardirq.h index 04d0a977cd43..d14214dfc10b 100644 --- a/include/asm-generic/hardirq.h +++ b/include/asm-generic/hardirq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_HARDIRQ_H  #define __ASM_GENERIC_HARDIRQ_H diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 540354f94f83..9d0cde8ab716 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_HUGETLB_H  #define _ASM_GENERIC_HUGETLB_H diff --git a/include/asm-generic/ide_iops.h b/include/asm-generic/ide_iops.h index 1b91d0681914..81dfa3ee5e06 100644 --- a/include/asm-generic/ide_iops.h +++ b/include/asm-generic/ide_iops.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Generic I/O and MEMIO string operations.  */  #define __ide_insw	insw diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h index 4cd84855cb46..ffb68d67be5f 100644 --- a/include/asm-generic/int-ll64.h +++ b/include/asm-generic/int-ll64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * asm-generic/int-ll64.h   * diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h index 297fb0d7cd6c..9fda9ed000cd 100644 --- a/include/asm-generic/ioctl.h +++ b/include/asm-generic/ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_IOCTL_H  #define _ASM_GENERIC_IOCTL_H diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h index 650fede33c25..5b63b94ef6b5 100644 --- a/include/asm-generic/iomap.h +++ b/include/asm-generic/iomap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __GENERIC_IO_H  #define __GENERIC_IO_H diff --git a/include/asm-generic/irq.h b/include/asm-generic/irq.h index b90ec0bc485f..da21de991e84 100644 --- a/include/asm-generic/irq.h +++ b/include/asm-generic/irq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_IRQ_H  #define __ASM_GENERIC_IRQ_H diff --git a/include/asm-generic/irq_work.h b/include/asm-generic/irq_work.h index a44f452c6590..d5dce06f74b8 100644 --- a/include/asm-generic/irq_work.h +++ b/include/asm-generic/irq_work.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_IRQ_WORK_H  #define __ASM_IRQ_WORK_H diff --git a/include/asm-generic/irqflags.h b/include/asm-generic/irqflags.h index 1f40d0024cf3..19ccbf483a24 100644 --- a/include/asm-generic/irqflags.h +++ b/include/asm-generic/irqflags.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_IRQFLAGS_H  #define __ASM_GENERIC_IRQFLAGS_H diff --git a/include/asm-generic/kdebug.h b/include/asm-generic/kdebug.h index d1814497bcdb..2b10b31b02d0 100644 --- a/include/asm-generic/kdebug.h +++ b/include/asm-generic/kdebug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_KDEBUG_H  #define _ASM_GENERIC_KDEBUG_H diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h index 90f99c74dd38..9f95b7b63d19 100644 --- a/include/asm-generic/kmap_types.h +++ b/include/asm-generic/kmap_types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_KMAP_TYPES_H  #define _ASM_GENERIC_KMAP_TYPES_H diff --git a/include/asm-generic/kprobes.h b/include/asm-generic/kprobes.h index 57af9f21d148..4a982089c95c 100644 --- a/include/asm-generic/kprobes.h +++ b/include/asm-generic/kprobes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_KPROBES_H  #define _ASM_GENERIC_KPROBES_H diff --git a/include/asm-generic/kvm_para.h b/include/asm-generic/kvm_para.h index fa25becbdcaf..18c6abe81fbd 100644 --- a/include/asm-generic/kvm_para.h +++ b/include/asm-generic/kvm_para.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_KVM_PARA_H  #define _ASM_GENERIC_KVM_PARA_H diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h index 9ceb03b4f466..fca7f1d84818 100644 --- a/include/asm-generic/local.h +++ b/include/asm-generic/local.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_LOCAL_H  #define _ASM_GENERIC_LOCAL_H diff --git a/include/asm-generic/local64.h b/include/asm-generic/local64.h index 5980002b8b7b..765be0b7d883 100644 --- a/include/asm-generic/local64.h +++ b/include/asm-generic/local64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_LOCAL64_H  #define _ASM_GENERIC_LOCAL64_H diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h index 5148150cc80b..7637fb46ba4f 100644 --- a/include/asm-generic/memory_model.h +++ b/include/asm-generic/memory_model.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_MEMORY_MODEL_H  #define __ASM_MEMORY_MODEL_H diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h index 41e5b6784b97..ea189d88a3cc 100644 --- a/include/asm-generic/mm_hooks.h +++ b/include/asm-generic/mm_hooks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Define generic no-op hooks for arch_dup_mmap, arch_exit_mmap   * and arch_unmap to be included in asm-FOO/mmu_context.h for any diff --git a/include/asm-generic/mmu.h b/include/asm-generic/mmu.h index 0ed3f1cfb854..061838037542 100644 --- a/include/asm-generic/mmu.h +++ b/include/asm-generic/mmu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_MMU_H  #define __ASM_GENERIC_MMU_H diff --git a/include/asm-generic/mmu_context.h b/include/asm-generic/mmu_context.h index a7eec910ba6c..6be9106fb6fb 100644 --- a/include/asm-generic/mmu_context.h +++ b/include/asm-generic/mmu_context.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_MMU_CONTEXT_H  #define __ASM_GENERIC_MMU_CONTEXT_H diff --git a/include/asm-generic/module.h b/include/asm-generic/module.h index 14dc41d185a7..98e1541b72b7 100644 --- a/include/asm-generic/module.h +++ b/include/asm-generic/module.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_MODULE_H  #define __ASM_GENERIC_MODULE_H diff --git a/include/asm-generic/msi.h b/include/asm-generic/msi.h index 61c58d8878ce..e6795f088bdd 100644 --- a/include/asm-generic/msi.h +++ b/include/asm-generic/msi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_MSI_H  #define __ASM_GENERIC_MSI_H diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h index 67cfb7dbc284..27bf3377b0cb 100644 --- a/include/asm-generic/page.h +++ b/include/asm-generic/page.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_PAGE_H  #define __ASM_GENERIC_PAGE_H  /* diff --git a/include/asm-generic/param.h b/include/asm-generic/param.h index 04e715bccceb..8d3009dd28ff 100644 --- a/include/asm-generic/param.h +++ b/include/asm-generic/param.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_PARAM_H  #define __ASM_GENERIC_PARAM_H diff --git a/include/asm-generic/parport.h b/include/asm-generic/parport.h index 2c9f9d4336ca..483991d619a7 100644 --- a/include/asm-generic/parport.h +++ b/include/asm-generic/parport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_PARPORT_H  #define __ASM_GENERIC_PARPORT_H diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h index f24bc519bf31..830d7659289b 100644 --- a/include/asm-generic/pci.h +++ b/include/asm-generic/pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/asm-generic/pci.h   * diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 976f8ac26665..1817a8415a5e 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_PERCPU_H_  #define _ASM_GENERIC_PERCPU_H_ diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h index 9e429d08b1f8..948714c1535a 100644 --- a/include/asm-generic/pgalloc.h +++ b/include/asm-generic/pgalloc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_PGALLOC_H  #define __ASM_GENERIC_PGALLOC_H  /* diff --git a/include/asm-generic/pgtable-nop4d-hack.h b/include/asm-generic/pgtable-nop4d-hack.h index 752fb7511750..0c34215263b8 100644 --- a/include/asm-generic/pgtable-nop4d-hack.h +++ b/include/asm-generic/pgtable-nop4d-hack.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _PGTABLE_NOP4D_HACK_H  #define _PGTABLE_NOP4D_HACK_H diff --git a/include/asm-generic/pgtable-nop4d.h b/include/asm-generic/pgtable-nop4d.h index de364ecb8df6..8f22f55de17a 100644 --- a/include/asm-generic/pgtable-nop4d.h +++ b/include/asm-generic/pgtable-nop4d.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _PGTABLE_NOP4D_H  #define _PGTABLE_NOP4D_H diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index 725612b793ce..f35f6e8149e4 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _PGTABLE_NOPMD_H  #define _PGTABLE_NOPMD_H diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index c2b9b96d6268..e950b9c50f34 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _PGTABLE_NOPUD_H  #define _PGTABLE_NOPUD_H diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 8e0243036564..757dc6ffc7ba 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_PGTABLE_H  #define _ASM_GENERIC_PGTABLE_H diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h index c1cde3577551..c3046c920063 100644 --- a/include/asm-generic/preempt.h +++ b/include/asm-generic/preempt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_PREEMPT_H  #define __ASM_PREEMPT_H diff --git a/include/asm-generic/qrwlock.h b/include/asm-generic/qrwlock.h index 7d026bf27713..0f7062bd55e5 100644 --- a/include/asm-generic/qrwlock.h +++ b/include/asm-generic/qrwlock.h @@ -26,51 +26,20 @@  /*   * Writer states & reader shift and bias. - * - *       | +0 | +1 | +2 | +3 | - *   ----+----+----+----+----+ - *    LE | 78 | 56 | 34 | 12 | 0x12345678 - *   ----+----+----+----+----+ - *       | wr |      rd      | - *       +----+----+----+----+ - * - *   ----+----+----+----+----+ - *    BE | 12 | 34 | 56 | 78 | 0x12345678 - *   ----+----+----+----+----+ - *       |      rd      | wr | - *       +----+----+----+----+   */ -#define	_QW_WAITING	1		/* A writer is waiting	   */ -#define	_QW_LOCKED	0xff		/* A writer holds the lock */ -#define	_QW_WMASK	0xff		/* Writer mask		   */ -#define	_QR_SHIFT	8		/* Reader count shift	   */ +#define	_QW_WAITING	0x100		/* A writer is waiting	   */ +#define	_QW_LOCKED	0x0ff		/* A writer holds the lock */ +#define	_QW_WMASK	0x1ff		/* Writer mask		   */ +#define	_QR_SHIFT	9		/* Reader count shift	   */  #define _QR_BIAS	(1U << _QR_SHIFT)  /*   * External function declarations   */ -extern void queued_read_lock_slowpath(struct qrwlock *lock, u32 cnts); +extern void queued_read_lock_slowpath(struct qrwlock *lock);  extern void queued_write_lock_slowpath(struct qrwlock *lock);  /** - * queued_read_can_lock- would read_trylock() succeed? - * @lock: Pointer to queue rwlock structure - */ -static inline int queued_read_can_lock(struct qrwlock *lock) -{ -	return !(atomic_read(&lock->cnts) & _QW_WMASK); -} - -/** - * queued_write_can_lock- would write_trylock() succeed? - * @lock: Pointer to queue rwlock structure - */ -static inline int queued_write_can_lock(struct qrwlock *lock) -{ -	return !atomic_read(&lock->cnts); -} - -/**   * queued_read_trylock - try to acquire read lock of a queue rwlock   * @lock : Pointer to queue rwlock structure   * Return: 1 if lock acquired, 0 if failed @@ -118,7 +87,7 @@ static inline void queued_read_lock(struct qrwlock *lock)  		return;  	/* The slowpath will decrement the reader count, if necessary. */ -	queued_read_lock_slowpath(lock, cnts); +	queued_read_lock_slowpath(lock);  }  /** @@ -147,30 +116,18 @@ static inline void queued_read_unlock(struct qrwlock *lock)  }  /** - * __qrwlock_write_byte - retrieve the write byte address of a queue rwlock - * @lock : Pointer to queue rwlock structure - * Return: the write byte address of a queue rwlock - */ -static inline u8 *__qrwlock_write_byte(struct qrwlock *lock) -{ -	return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN); -} - -/**   * queued_write_unlock - release write lock of a queue rwlock   * @lock : Pointer to queue rwlock structure   */  static inline void queued_write_unlock(struct qrwlock *lock)  { -	smp_store_release(__qrwlock_write_byte(lock), 0); +	smp_store_release(&lock->wlocked, 0);  }  /*   * Remapping rwlock architecture specific functions to the corresponding   * queue rwlock functions.   */ -#define arch_read_can_lock(l)	queued_read_can_lock(l) -#define arch_write_can_lock(l)	queued_write_can_lock(l)  #define arch_read_lock(l)	queued_read_lock(l)  #define arch_write_lock(l)	queued_write_lock(l)  #define arch_read_trylock(l)	queued_read_trylock(l) diff --git a/include/asm-generic/qrwlock_types.h b/include/asm-generic/qrwlock_types.h index 0abc6b6062fb..137ecdd16daa 100644 --- a/include/asm-generic/qrwlock_types.h +++ b/include/asm-generic/qrwlock_types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_QRWLOCK_TYPES_H  #define __ASM_GENERIC_QRWLOCK_TYPES_H @@ -9,12 +10,23 @@   */  typedef struct qrwlock { -	atomic_t		cnts; +	union { +		atomic_t cnts; +		struct { +#ifdef __LITTLE_ENDIAN +			u8 wlocked;	/* Locked for write? */ +			u8 __lstate[3]; +#else +			u8 __lstate[3]; +			u8 wlocked;	/* Locked for write? */ +#endif +		}; +	};  	arch_spinlock_t		wait_lock;  } arch_rwlock_t;  #define	__ARCH_RW_LOCK_UNLOCKED {		\ -	.cnts = ATOMIC_INIT(0),			\ +	{ .cnts = ATOMIC_INIT(0), },		\  	.wait_lock = __ARCH_SPIN_LOCK_UNLOCKED,	\  } diff --git a/include/asm-generic/qspinlock.h b/include/asm-generic/qspinlock.h index 66260777d644..b37b4ad7eb94 100644 --- a/include/asm-generic/qspinlock.h +++ b/include/asm-generic/qspinlock.h @@ -121,6 +121,5 @@ static __always_inline bool virt_spin_lock(struct qspinlock *lock)  #define arch_spin_lock(l)		queued_spin_lock(l)  #define arch_spin_trylock(l)		queued_spin_trylock(l)  #define arch_spin_unlock(l)		queued_spin_unlock(l) -#define arch_spin_lock_flags(l, f)	queued_spin_lock(l)  #endif /* __ASM_GENERIC_QSPINLOCK_H */ diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h index 5e752b959054..8874f681b056 100644 --- a/include/asm-generic/resource.h +++ b/include/asm-generic/resource.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_RESOURCE_H  #define _ASM_GENERIC_RESOURCE_H diff --git a/include/asm-generic/rwsem.h b/include/asm-generic/rwsem.h index 6c6a2141f271..93e67a055a4d 100644 --- a/include/asm-generic/rwsem.h +++ b/include/asm-generic/rwsem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_RWSEM_H  #define _ASM_GENERIC_RWSEM_H @@ -37,6 +38,16 @@ static inline void __down_read(struct rw_semaphore *sem)  		rwsem_down_read_failed(sem);  } +static inline int __down_read_killable(struct rw_semaphore *sem) +{ +	if (unlikely(atomic_long_inc_return_acquire(&sem->count) <= 0)) { +		if (IS_ERR(rwsem_down_read_failed_killable(sem))) +			return -EINTR; +	} + +	return 0; +} +  static inline int __down_read_trylock(struct rw_semaphore *sem)  {  	long tmp; diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index e5da44eddd2f..03cc5f9bba71 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_SECTIONS_H_  #define _ASM_GENERIC_SECTIONS_H_ @@ -43,6 +44,7 @@ extern char __entry_text_start[], __entry_text_end[];  extern char __start_rodata[], __end_rodata[];  extern char __irqentry_text_start[], __irqentry_text_end[];  extern char __softirqentry_text_start[], __softirqentry_text_end[]; +extern char __start_once[], __end_once[];  /* Start and end of .ctors section - used for constructor calls. */  extern char __ctors_start[], __ctors_end[]; diff --git a/include/asm-generic/serial.h b/include/asm-generic/serial.h index 5e291090fe04..ca9f7b6be3f0 100644 --- a/include/asm-generic/serial.h +++ b/include/asm-generic/serial.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_SERIAL_H  #define __ASM_GENERIC_SERIAL_H diff --git a/include/asm-generic/set_memory.h b/include/asm-generic/set_memory.h index 83e81f8996b2..c86abf6bc7ba 100644 --- a/include/asm-generic/set_memory.h +++ b/include/asm-generic/set_memory.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_SET_MEMORY_H  #define __ASM_SET_MEMORY_H diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h index d840c90a157a..c53984fa9761 100644 --- a/include/asm-generic/signal.h +++ b/include/asm-generic/signal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_SIGNAL_H  #define __ASM_GENERIC_SIGNAL_H diff --git a/include/asm-generic/simd.h b/include/asm-generic/simd.h index f57eb7b5c23b..d0343d58a74a 100644 --- a/include/asm-generic/simd.h +++ b/include/asm-generic/simd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <linux/hardirq.h> diff --git a/include/asm-generic/spinlock.h b/include/asm-generic/spinlock.h index 1547a03ac50f..adaf6acab172 100644 --- a/include/asm-generic/spinlock.h +++ b/include/asm-generic/spinlock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_SPINLOCK_H  #define __ASM_GENERIC_SPINLOCK_H  /* diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h index 4b934e9ec970..f88dcd8ed9dd 100644 --- a/include/asm-generic/statfs.h +++ b/include/asm-generic/statfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _GENERIC_STATFS_H  #define _GENERIC_STATFS_H diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h index 1f74be5113b2..933ca6581aba 100644 --- a/include/asm-generic/syscalls.h +++ b/include/asm-generic/syscalls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_SYSCALLS_H  #define __ASM_GENERIC_SYSCALLS_H diff --git a/include/asm-generic/termios-base.h b/include/asm-generic/termios-base.h index 157bbf6f4510..59c5a3bd4a6e 100644 --- a/include/asm-generic/termios-base.h +++ b/include/asm-generic/termios-base.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* termios.h: generic termios/termio user copying/translation   */ diff --git a/include/asm-generic/termios.h b/include/asm-generic/termios.h index 8c13a16b074e..b1398d0d4a1d 100644 --- a/include/asm-generic/termios.h +++ b/include/asm-generic/termios.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_TERMIOS_H  #define _ASM_GENERIC_TERMIOS_H diff --git a/include/asm-generic/timex.h b/include/asm-generic/timex.h index b2243cb8d6f6..50ba9b5ce983 100644 --- a/include/asm-generic/timex.h +++ b/include/asm-generic/timex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_TIMEX_H  #define __ASM_GENERIC_TIMEX_H diff --git a/include/asm-generic/tlbflush.h b/include/asm-generic/tlbflush.h index d6d0a88430fe..dc2669289faf 100644 --- a/include/asm-generic/tlbflush.h +++ b/include/asm-generic/tlbflush.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_TLBFLUSH_H  #define __ASM_GENERIC_TLBFLUSH_H  /* diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h index 5d2add1a6c96..238873739550 100644 --- a/include/asm-generic/topology.h +++ b/include/asm-generic/topology.h @@ -44,9 +44,6 @@  #define cpu_to_mem(cpu)		((void)(cpu),0)  #endif -#ifndef parent_node -#define parent_node(node)	((void)(node),0) -#endif  #ifndef cpumask_of_node    #ifdef CONFIG_NEED_MULTIPLE_NODES      #define cpumask_of_node(node)	((node) == 0 ? cpu_online_mask : cpu_none_mask) diff --git a/include/asm-generic/trace_clock.h b/include/asm-generic/trace_clock.h index 6726f1bafb5e..cbbca295931a 100644 --- a/include/asm-generic/trace_clock.h +++ b/include/asm-generic/trace_clock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_GENERIC_TRACE_CLOCK_H  #define _ASM_GENERIC_TRACE_CLOCK_H  /* diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index 2e51f6e7b3c2..6b2e63df2739 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_UACCESS_H  #define __ASM_GENERIC_UACCESS_H diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h index 1ac097279db1..374c940e9be1 100644 --- a/include/asm-generic/unaligned.h +++ b/include/asm-generic/unaligned.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_GENERIC_UNALIGNED_H  #define __ASM_GENERIC_UNALIGNED_H diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index cccc86ecfeaa..cdf904265caf 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <uapi/asm-generic/unistd.h>  #include <linux/export.h> diff --git a/include/asm-generic/vga.h b/include/asm-generic/vga.h index 36c8ff52016b..adf91a783b5c 100644 --- a/include/asm-generic/vga.h +++ b/include/asm-generic/vga.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Access to VGA videoram   * diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 8acfc1e099e1..ee8b707d9fa9 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -223,6 +223,9 @@  	MEM_KEEP(init.data)						\  	MEM_KEEP(exit.data)						\  	*(.data.unlikely)						\ +	VMLINUX_SYMBOL(__start_once) = .;				\ +	*(.data.once)							\ +	VMLINUX_SYMBOL(__end_once) = .;					\  	STRUCT_ALIGN();							\  	*(__tracepoints)						\  	/* implement dynamic printk debug */				\ @@ -459,6 +462,7 @@  #define TEXT_TEXT							\  		ALIGN_FUNCTION();					\  		*(.text.hot TEXT_MAIN .text.fixup .text.unlikely)	\ +		*(.text..refcount)					\  		*(.ref.text)						\  	MEM_KEEP(init.text)						\  	MEM_KEEP(exit.text)						\ @@ -687,7 +691,7 @@  #define BUG_TABLE  #endif -#ifdef CONFIG_ORC_UNWINDER +#ifdef CONFIG_UNWINDER_ORC  #define ORC_UNWIND_TABLE						\  	. = ALIGN(4);							\  	.orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) {	\ @@ -778,6 +782,24 @@  #endif  /* + * Memory encryption operates on a page basis. Since we need to clear + * the memory encryption mask for this section, it needs to be aligned + * on a page boundary and be a page-size multiple in length. + * + * Note: We use a separate section so that only this section gets + * decrypted to avoid exposing more than we wish. + */ +#ifdef CONFIG_AMD_MEM_ENCRYPT +#define PERCPU_DECRYPTED_SECTION					\ +	. = ALIGN(PAGE_SIZE);						\ +	*(.data..percpu..decrypted)					\ +	. = ALIGN(PAGE_SIZE); +#else +#define PERCPU_DECRYPTED_SECTION +#endif + + +/*   * Default discarded sections.   *   * Some archs want to discard exit text/data at runtime rather than @@ -815,6 +837,7 @@  	. = ALIGN(cacheline);						\  	*(.data..percpu)						\  	*(.data..percpu..shared_aligned)				\ +	PERCPU_DECRYPTED_SECTION					\  	VMLINUX_SYMBOL(__per_cpu_end) = .;  /** diff --git a/include/asm-generic/word-at-a-time.h b/include/asm-generic/word-at-a-time.h index 011dde083f23..20c93f08c993 100644 --- a/include/asm-generic/word-at-a-time.h +++ b/include/asm-generic/word-at-a-time.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_WORD_AT_A_TIME_H  #define _ASM_WORD_AT_A_TIME_H diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h index cc805b72994a..349e5957c949 100644 --- a/include/clocksource/arm_arch_timer.h +++ b/include/clocksource/arm_arch_timer.h @@ -67,7 +67,9 @@ enum arch_timer_spi_nr {  #define ARCH_TIMER_USR_VT_ACCESS_EN	(1 << 8) /* virtual timer registers */  #define ARCH_TIMER_USR_PT_ACCESS_EN	(1 << 9) /* physical timer registers */ -#define ARCH_TIMER_EVT_STREAM_FREQ	10000	/* 100us */ +#define ARCH_TIMER_EVT_STREAM_PERIOD_US	100 +#define ARCH_TIMER_EVT_STREAM_FREQ				\ +	(USEC_PER_SEC / ARCH_TIMER_EVT_STREAM_PERIOD_US)  struct arch_timer_kvm_info {  	struct timecounter timecounter; @@ -93,6 +95,7 @@ struct arch_timer_mem {  extern u32 arch_timer_get_rate(void);  extern u64 (*arch_timer_read_counter)(void);  extern struct arch_timer_kvm_info *arch_timer_get_kvm_info(void); +extern bool arch_timer_evtstrm_available(void);  #else @@ -106,6 +109,11 @@ static inline u64 arch_timer_read_counter(void)  	return 0;  } +static inline bool arch_timer_evtstrm_available(void) +{ +	return false; +} +  #endif  #endif diff --git a/include/clocksource/timer-sp804.h b/include/clocksource/timer-sp804.h index 7654d71243dd..a5b41f31a1c2 100644 --- a/include/clocksource/timer-sp804.h +++ b/include/clocksource/timer-sp804.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __CLKSOURCE_TIMER_SP804_H  #define __CLKSOURCE_TIMER_SP804_H diff --git a/include/crypto/ablk_helper.h b/include/crypto/ablk_helper.h index 4f93df50c23e..4e655c2a4e15 100644 --- a/include/crypto/ablk_helper.h +++ b/include/crypto/ablk_helper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Shared async block cipher helpers   */ diff --git a/include/crypto/aes.h b/include/crypto/aes.h index 7524ba3b6f3c..852eaa9cd4db 100644 --- a/include/crypto/aes.h +++ b/include/crypto/aes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common values for AES algorithms   */ diff --git a/include/crypto/blowfish.h b/include/crypto/blowfish.h index 1450d4a27980..9b384670b356 100644 --- a/include/crypto/blowfish.h +++ b/include/crypto/blowfish.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common values for blowfish algorithms   */ diff --git a/include/crypto/cast5.h b/include/crypto/cast5.h index 14fbf39d6380..3d4ed4ea9c3b 100644 --- a/include/crypto/cast5.h +++ b/include/crypto/cast5.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CRYPTO_CAST5_H  #define _CRYPTO_CAST5_H diff --git a/include/crypto/cast6.h b/include/crypto/cast6.h index 32b60eb8bd24..c71f6ef47f0f 100644 --- a/include/crypto/cast6.h +++ b/include/crypto/cast6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CRYPTO_CAST6_H  #define _CRYPTO_CAST6_H diff --git a/include/crypto/cast_common.h b/include/crypto/cast_common.h index b7df35cd9f0a..b90090244164 100644 --- a/include/crypto/cast_common.h +++ b/include/crypto/cast_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CRYPTO_CAST_COMMON_H  #define _CRYPTO_CAST_COMMON_H diff --git a/include/crypto/chacha20.h b/include/crypto/chacha20.h index 445fc45f4b5b..caaa470389e0 100644 --- a/include/crypto/chacha20.h +++ b/include/crypto/chacha20.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common values for the ChaCha20 algorithm   */ diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h index 94418cbf9013..1e64f354c2b8 100644 --- a/include/crypto/cryptd.h +++ b/include/crypto/cryptd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Software async crypto daemon   * diff --git a/include/crypto/crypto_wq.h b/include/crypto/crypto_wq.h index a7d252daf91b..23114746ac08 100644 --- a/include/crypto/crypto_wq.h +++ b/include/crypto/crypto_wq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef CRYPTO_WQ_H  #define CRYPTO_WQ_H diff --git a/include/crypto/des.h b/include/crypto/des.h index fc6274c6bb26..d4094d58ac54 100644 --- a/include/crypto/des.h +++ b/include/crypto/des.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*    * DES & Triple DES EDE Cipher Algorithms.   */ diff --git a/include/crypto/dh.h b/include/crypto/dh.h index f638998fb6d0..71e1bb24d79f 100644 --- a/include/crypto/dh.h +++ b/include/crypto/dh.h @@ -53,7 +53,7 @@ struct dh {   *   * Return: size of the key in bytes   */ -int crypto_dh_key_len(const struct dh *params); +unsigned int crypto_dh_key_len(const struct dh *params);  /**   * crypto_dh_encode_key() - encode the private key diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h index 22f884c97387..8f941102af36 100644 --- a/include/crypto/drbg.h +++ b/include/crypto/drbg.h @@ -126,8 +126,7 @@ struct drbg_state {  	__u8 *ctr_null_value;			/* CTR mode aligned zero buf */  	__u8 *outscratchpadbuf;			/* CTR mode output scratchpad */          __u8 *outscratchpad;			/* CTR mode aligned outbuf */ -	struct completion ctr_completion;	/* CTR mode async handler */ -	int ctr_async_err;			/* CTR mode async error */ +	struct crypto_wait ctr_wait;		/* CTR mode async wait obj */  	bool seeded;		/* DRBG fully seeded? */  	bool pr;		/* Prediction resistance enabled? */ diff --git a/include/crypto/ecdh.h b/include/crypto/ecdh.h index 1aff2a8a3a68..d696317c43a8 100644 --- a/include/crypto/ecdh.h +++ b/include/crypto/ecdh.h @@ -54,7 +54,7 @@ struct ecdh {   *   * Return: size of the key in bytes   */ -int crypto_ecdh_key_len(const struct ecdh *params); +unsigned int crypto_ecdh_key_len(const struct ecdh *params);  /**   * crypto_ecdh_encode_key() - encode the private key diff --git a/include/crypto/gcm.h b/include/crypto/gcm.h new file mode 100644 index 000000000000..c50e057ea17e --- /dev/null +++ b/include/crypto/gcm.h @@ -0,0 +1,8 @@ +#ifndef _CRYPTO_GCM_H +#define _CRYPTO_GCM_H + +#define GCM_AES_IV_SIZE 12 +#define GCM_RFC4106_IV_SIZE 8 +#define GCM_RFC4543_IV_SIZE 8 + +#endif diff --git a/include/crypto/gf128mul.h b/include/crypto/gf128mul.h index 0977fb18ff68..fa0a63d298dc 100644 --- a/include/crypto/gf128mul.h +++ b/include/crypto/gf128mul.h @@ -227,7 +227,7 @@ struct gf128mul_4k *gf128mul_init_4k_lle(const be128 *g);  struct gf128mul_4k *gf128mul_init_4k_bbe(const be128 *g);  void gf128mul_4k_lle(be128 *a, const struct gf128mul_4k *t);  void gf128mul_4k_bbe(be128 *a, const struct gf128mul_4k *t); - +void gf128mul_x8_ble(le128 *r, const le128 *x);  static inline void gf128mul_free_4k(struct gf128mul_4k *t)  {  	kzfree(t); diff --git a/include/crypto/ghash.h b/include/crypto/ghash.h index 2a61c9bbab8f..9136301062a5 100644 --- a/include/crypto/ghash.h +++ b/include/crypto/ghash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common values for GHASH algorithms   */ diff --git a/include/crypto/hash.h b/include/crypto/hash.h index b5727bcd2336..0ed31fd80242 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -75,6 +75,7 @@ struct ahash_request {   *	  state of the HASH transformation at the beginning. This shall fill in   *	  the internal structures used during the entire duration of the whole   *	  transformation. No data processing happens at this point. + *	  Note: mandatory.   * @update: Push a chunk of data into the driver for transformation. This   *	   function actually pushes blocks of data from upper layers into the   *	   driver, which then passes those to the hardware as seen fit. This @@ -84,16 +85,20 @@ struct ahash_request {   *	   context, as this function may be called in parallel with the same   *	   transformation object. Data processing can happen synchronously   *	   [SHASH] or asynchronously [AHASH] at this point. + *	   Note: mandatory.   * @final: Retrieve result from the driver. This function finalizes the   *	   transformation and retrieves the resulting hash from the driver and   *	   pushes it back to upper layers. No data processing happens at this - *	   point. + *	   point unless hardware requires it to finish the transformation + *	   (then the data buffered by the device driver is processed). + *	   Note: mandatory.   * @finup: Combination of @update and @final. This function is effectively a   *	   combination of @update and @final calls issued in sequence. As some   *	   hardware cannot do @update and @final separately, this callback was   *	   added to allow such hardware to be used at least by IPsec. Data   *	   processing can happen synchronously [SHASH] or asynchronously [AHASH]   *	   at this point. + *	   Note: optional.   * @digest: Combination of @init and @update and @final. This function   *	    effectively behaves as the entire chain of operations, @init,   *	    @update and @final issued in sequence. Just like @finup, this was @@ -416,11 +421,10 @@ static inline bool crypto_ahash_has_setkey(struct crypto_ahash *tfm)   *	 needed to perform the cipher operation   *   * This function is a "short-hand" for the function calls of - * crypto_ahash_update and crypto_shash_final. The parameters have the same + * crypto_ahash_update and crypto_ahash_final. The parameters have the same   * meaning as discussed for those separate functions.   * - * Return: 0 if the message digest creation was successful; < 0 if an error - *	   occurred + * Return: see crypto_ahash_final()   */  int crypto_ahash_finup(struct ahash_request *req); @@ -433,8 +437,11 @@ int crypto_ahash_finup(struct ahash_request *req);   * based on all data added to the cipher handle. The message digest is placed   * into the output buffer registered with the ahash_request handle.   * - * Return: 0 if the message digest creation was successful; < 0 if an error - *	   occurred + * Return: + * 0		if the message digest was successfully calculated; + * -EINPROGRESS	if data is feeded into hardware (DMA) or queued for later; + * -EBUSY	if queue is full and request should be resubmitted later; + * other < 0	if an error occurred   */  int crypto_ahash_final(struct ahash_request *req); @@ -447,8 +454,7 @@ int crypto_ahash_final(struct ahash_request *req);   * crypto_ahash_update and crypto_ahash_final. The parameters have the same   * meaning as discussed for those separate three functions.   * - * Return: 0 if the message digest creation was successful; < 0 if an error - *	   occurred + * Return: see crypto_ahash_final()   */  int crypto_ahash_digest(struct ahash_request *req); @@ -493,8 +499,7 @@ static inline int crypto_ahash_import(struct ahash_request *req, const void *in)   * handle. Any potentially existing state created by previous operations is   * discarded.   * - * Return: 0 if the message digest initialization was successful; < 0 if an - *	   error occurred + * Return: see crypto_ahash_final()   */  static inline int crypto_ahash_init(struct ahash_request *req)  { @@ -510,8 +515,7 @@ static inline int crypto_ahash_init(struct ahash_request *req)   * is pointed to by the scatter/gather list registered in the &ahash_request   * handle   * - * Return: 0 if the message digest update was successful; < 0 if an error - *	   occurred + * Return: see crypto_ahash_final()   */  static inline int crypto_ahash_update(struct ahash_request *req)  { diff --git a/include/crypto/hmac.h b/include/crypto/hmac.h index ef09f7938204..66774132a7b6 100644 --- a/include/crypto/hmac.h +++ b/include/crypto/hmac.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CRYPTO_HMAC_H  #define _CRYPTO_HMAC_H diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h index 75ec9c662268..6abf0a3604dc 100644 --- a/include/crypto/if_alg.h +++ b/include/crypto/if_alg.h @@ -40,11 +40,6 @@ struct alg_sock {  	void *private;  }; -struct af_alg_completion { -	struct completion completion; -	int err; -}; -  struct af_alg_control {  	struct af_alg_iv *iv;  	int op; @@ -152,7 +147,7 @@ struct af_alg_ctx {  	void *iv;  	size_t aead_assoclen; -	struct af_alg_completion completion; +	struct crypto_wait wait;  	size_t used;  	size_t rcvused; @@ -177,19 +172,11 @@ void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_new);  int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con); -int af_alg_wait_for_completion(int err, struct af_alg_completion *completion); -void af_alg_complete(struct crypto_async_request *req, int err); -  static inline struct alg_sock *alg_sk(struct sock *sk)  {  	return (struct alg_sock *)sk;  } -static inline void af_alg_init_completion(struct af_alg_completion *completion) -{ -	init_completion(&completion->completion); -} -  /**   * Size of available buffer for sending data from user space to kernel.   * diff --git a/include/crypto/internal/simd.h b/include/crypto/internal/simd.h index 429509968f68..32ceb6929885 100644 --- a/include/crypto/internal/simd.h +++ b/include/crypto/internal/simd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Shared crypto simd helpers   */ diff --git a/include/crypto/lrw.h b/include/crypto/lrw.h index 25a2c8716375..a9d44c06d081 100644 --- a/include/crypto/lrw.h +++ b/include/crypto/lrw.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CRYPTO_LRW_H  #define _CRYPTO_LRW_H diff --git a/include/crypto/mcryptd.h b/include/crypto/mcryptd.h index 4a53c0d38cd2..cceafa01f907 100644 --- a/include/crypto/mcryptd.h +++ b/include/crypto/mcryptd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Software async multibuffer crypto daemon headers   * diff --git a/include/crypto/md5.h b/include/crypto/md5.h index 327deac963c0..cf9e9dec3d21 100644 --- a/include/crypto/md5.h +++ b/include/crypto/md5.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CRYPTO_MD5_H  #define _CRYPTO_MD5_H diff --git a/include/crypto/null.h b/include/crypto/null.h index 3f0c59fb0a61..5757c0a4b321 100644 --- a/include/crypto/null.h +++ b/include/crypto/null.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Values for NULL algorithms */  #ifndef _CRYPTO_NULL_H diff --git a/include/crypto/poly1305.h b/include/crypto/poly1305.h index 894df59b74e4..c65567d01e8e 100644 --- a/include/crypto/poly1305.h +++ b/include/crypto/poly1305.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common values for the Poly1305 algorithm   */ diff --git a/include/crypto/serpent.h b/include/crypto/serpent.h index b7e0941eb6fc..7dd780c5d058 100644 --- a/include/crypto/serpent.h +++ b/include/crypto/serpent.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common values for serpent algorithms   */ diff --git a/include/crypto/sha.h b/include/crypto/sha.h index c94d3eb1cefd..0555b571dd34 100644 --- a/include/crypto/sha.h +++ b/include/crypto/sha.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common values for SHA algorithms   */ diff --git a/include/crypto/sha3.h b/include/crypto/sha3.h index f4c9f68f5ffe..b9d9bd553b48 100644 --- a/include/crypto/sha3.h +++ b/include/crypto/sha3.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common values for SHA-3 algorithms   */ diff --git a/include/crypto/sm3.h b/include/crypto/sm3.h new file mode 100644 index 000000000000..1438942dc773 --- /dev/null +++ b/include/crypto/sm3.h @@ -0,0 +1,40 @@ +/* + * Common values for SM3 algorithm + */ + +#ifndef _CRYPTO_SM3_H +#define _CRYPTO_SM3_H + +#include <linux/types.h> + +#define SM3_DIGEST_SIZE	32 +#define SM3_BLOCK_SIZE	64 + +#define SM3_T1		0x79CC4519 +#define SM3_T2		0x7A879D8A + +#define SM3_IVA		0x7380166f +#define SM3_IVB		0x4914b2b9 +#define SM3_IVC		0x172442d7 +#define SM3_IVD		0xda8a0600 +#define SM3_IVE		0xa96f30bc +#define SM3_IVF		0x163138aa +#define SM3_IVG		0xe38dee4d +#define SM3_IVH		0xb0fb0e4e + +extern const u8 sm3_zero_message_hash[SM3_DIGEST_SIZE]; + +struct sm3_state { +	u32 state[SM3_DIGEST_SIZE / 4]; +	u64 count; +	u8 buffer[SM3_BLOCK_SIZE]; +}; + +struct shash_desc; + +extern int crypto_sm3_update(struct shash_desc *desc, const u8 *data, +			      unsigned int len); + +extern int crypto_sm3_finup(struct shash_desc *desc, const u8 *data, +			     unsigned int len, u8 *hash); +#endif diff --git a/include/crypto/sm3_base.h b/include/crypto/sm3_base.h new file mode 100644 index 000000000000..256948e39296 --- /dev/null +++ b/include/crypto/sm3_base.h @@ -0,0 +1,117 @@ +/* + * sm3_base.h - core logic for SM3 implementations + * + * Copyright (C) 2017 ARM Limited or its affiliates. + * Written by Gilad Ben-Yossef <gilad@benyossef.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#include <crypto/internal/hash.h> +#include <crypto/sm3.h> +#include <linux/crypto.h> +#include <linux/module.h> +#include <asm/unaligned.h> + +typedef void (sm3_block_fn)(struct sm3_state *sst, u8 const *src, int blocks); + +static inline int sm3_base_init(struct shash_desc *desc) +{ +	struct sm3_state *sctx = shash_desc_ctx(desc); + +	sctx->state[0] = SM3_IVA; +	sctx->state[1] = SM3_IVB; +	sctx->state[2] = SM3_IVC; +	sctx->state[3] = SM3_IVD; +	sctx->state[4] = SM3_IVE; +	sctx->state[5] = SM3_IVF; +	sctx->state[6] = SM3_IVG; +	sctx->state[7] = SM3_IVH; +	sctx->count = 0; + +	return 0; +} + +static inline int sm3_base_do_update(struct shash_desc *desc, +				      const u8 *data, +				      unsigned int len, +				      sm3_block_fn *block_fn) +{ +	struct sm3_state *sctx = shash_desc_ctx(desc); +	unsigned int partial = sctx->count % SM3_BLOCK_SIZE; + +	sctx->count += len; + +	if (unlikely((partial + len) >= SM3_BLOCK_SIZE)) { +		int blocks; + +		if (partial) { +			int p = SM3_BLOCK_SIZE - partial; + +			memcpy(sctx->buffer + partial, data, p); +			data += p; +			len -= p; + +			block_fn(sctx, sctx->buffer, 1); +		} + +		blocks = len / SM3_BLOCK_SIZE; +		len %= SM3_BLOCK_SIZE; + +		if (blocks) { +			block_fn(sctx, data, blocks); +			data += blocks * SM3_BLOCK_SIZE; +		} +		partial = 0; +	} +	if (len) +		memcpy(sctx->buffer + partial, data, len); + +	return 0; +} + +static inline int sm3_base_do_finalize(struct shash_desc *desc, +					sm3_block_fn *block_fn) +{ +	const int bit_offset = SM3_BLOCK_SIZE - sizeof(__be64); +	struct sm3_state *sctx = shash_desc_ctx(desc); +	__be64 *bits = (__be64 *)(sctx->buffer + bit_offset); +	unsigned int partial = sctx->count % SM3_BLOCK_SIZE; + +	sctx->buffer[partial++] = 0x80; +	if (partial > bit_offset) { +		memset(sctx->buffer + partial, 0x0, SM3_BLOCK_SIZE - partial); +		partial = 0; + +		block_fn(sctx, sctx->buffer, 1); +	} + +	memset(sctx->buffer + partial, 0x0, bit_offset - partial); +	*bits = cpu_to_be64(sctx->count << 3); +	block_fn(sctx, sctx->buffer, 1); + +	return 0; +} + +static inline int sm3_base_finish(struct shash_desc *desc, u8 *out) +{ +	struct sm3_state *sctx = shash_desc_ctx(desc); +	__be32 *digest = (__be32 *)out; +	int i; + +	for (i = 0; i < SM3_DIGEST_SIZE / sizeof(__be32); i++) +		put_unaligned_be32(sctx->state[i], digest++); + +	*sctx = (struct sm3_state){}; +	return 0; +} diff --git a/include/crypto/twofish.h b/include/crypto/twofish.h index 095c901a8af3..2e2c09673d88 100644 --- a/include/crypto/twofish.h +++ b/include/crypto/twofish.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CRYPTO_TWOFISH_H  #define _CRYPTO_TWOFISH_H diff --git a/include/crypto/xts.h b/include/crypto/xts.h index c0bde308b28a..322aab6e78a7 100644 --- a/include/crypto/xts.h +++ b/include/crypto/xts.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CRYPTO_XTS_H  #define _CRYPTO_XTS_H diff --git a/include/drm/ati_pcigart.h b/include/drm/ati_pcigart.h index 5765648b5ef7..a728a1364e66 100644 --- a/include/drm/ati_pcigart.h +++ b/include/drm/ati_pcigart.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DRM_ATI_PCIGART_H  #define DRM_ATI_PCIGART_H diff --git a/include/drm/bridge/mhl.h b/include/drm/bridge/mhl.h index fbdfc8d7f3c7..96a5e0f6ff12 100644 --- a/include/drm/bridge/mhl.h +++ b/include/drm/bridge/mhl.h @@ -262,6 +262,10 @@ enum {  #define MHL_RAPK_UNSUPPORTED	0x02	/* Rcvd RAP action code not supported */  #define MHL_RAPK_BUSY		0x03	/* Responder too busy to respond */ +/* Bit masks for RCP messages */ +#define MHL_RCP_KEY_RELEASED_MASK	0x80 +#define MHL_RCP_KEY_ID_MASK		0x7F +  /*   * Error status codes for RCPE messages   */ diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 7277783a4ff0..59be1232d005 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -136,6 +136,7 @@ struct pci_controller;  #define DRM_UT_ATOMIC		0x10  #define DRM_UT_VBL		0x20  #define DRM_UT_STATE		0x40 +#define DRM_UT_LEASE		0x80  /***********************************************************************/  /** \name DRM template customization defaults */ @@ -250,6 +251,9 @@ struct pci_controller;  #define DRM_DEBUG_VBL(fmt, ...)					\  	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__) +#define DRM_DEBUG_LEASE(fmt, ...)					\ +	drm_printk(KERN_DEBUG, DRM_UT_LEASE, fmt, ##__VA_ARGS__) +  #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\  ({									\  	static DEFINE_RATELIMIT_STATE(_rs,				\ diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h index b2d912670a7f..b05e462276d5 100644 --- a/include/drm/drm_agpsupport.h +++ b/include/drm/drm_agpsupport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DRM_AGPSUPPORT_H_  #define _DRM_AGPSUPPORT_H_ diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 8a5808eb5628..5afd6e364fb6 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -144,7 +144,6 @@ struct __drm_planes_state {  struct __drm_crtcs_state {  	struct drm_crtc *ptr;  	struct drm_crtc_state *state, *old_state, *new_state; -	struct drm_crtc_commit *commit;  	s32 __user *out_fence_ptr;  	unsigned last_vblank_count;  }; @@ -237,6 +236,18 @@ struct drm_atomic_state {  	struct drm_modeset_acquire_ctx *acquire_ctx;  	/** +	 * @fake_commit: +	 * +	 * Used for signaling unbound planes/connectors. +	 * When a connector or plane is not bound to any CRTC, it's still important +	 * to preserve linearity to prevent the atomic states from being freed to early. +	 * +	 * This commit (if set) is not bound to any crtc, but will be completed when +	 * drm_atomic_helper_commit_hw_done() is called. +	 */ +	struct drm_crtc_commit *fake_commit; + +	/**  	 * @commit_work:  	 *  	 * Work item which can be used by the driver or helpers to execute the @@ -252,10 +263,14 @@ void __drm_crtc_commit_free(struct kref *kref);   * @commit: CRTC commit   *   * Increases the reference of @commit. + * + * Returns: + * The pointer to @commit, with reference increased.   */ -static inline void drm_crtc_commit_get(struct drm_crtc_commit *commit) +static inline struct drm_crtc_commit *drm_crtc_commit_get(struct drm_crtc_commit *commit)  {  	kref_get(&commit->ref); +	return commit;  }  /** @@ -555,31 +570,6 @@ int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);  void drm_state_dump(struct drm_device *dev, struct drm_printer *p);  /** - * for_each_connector_in_state - iterate over all connectors in an atomic update - * @__state: &struct drm_atomic_state pointer - * @connector: &struct drm_connector iteration cursor - * @connector_state: &struct drm_connector_state iteration cursor - * @__i: int iteration cursor, for macro-internal use - * - * This iterates over all connectors in an atomic update. Note that before the - * software state is committed (by calling drm_atomic_helper_swap_state(), this - * points to the new state, while afterwards it points to the old state. Due to - * this tricky confusion this macro is deprecated. - * - * FIXME: - * - * Replace all usage of this with one of the explicit iterators below and then - * remove this macro. - */ -#define for_each_connector_in_state(__state, connector, connector_state, __i) \ -	for ((__i) = 0;							\ -	     (__i) < (__state)->num_connector &&				\ -	     ((connector) = (__state)->connectors[__i].ptr,			\ -	     (connector_state) = (__state)->connectors[__i].state, 1); 	\ -	     (__i)++)							\ -		for_each_if (connector) - -/**   * for_each_oldnew_connector_in_state - iterate over all connectors in an atomic update   * @__state: &struct drm_atomic_state pointer   * @connector: &struct drm_connector iteration cursor @@ -595,12 +585,12 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_oldnew_connector_in_state(__state, connector, old_connector_state, new_connector_state, __i) \  	for ((__i) = 0;								\ -	     (__i) < (__state)->num_connector &&				\ -	     ((connector) = (__state)->connectors[__i].ptr,			\ -	     (old_connector_state) = (__state)->connectors[__i].old_state,	\ -	     (new_connector_state) = (__state)->connectors[__i].new_state, 1); 	\ -	     (__i)++)							\ -		for_each_if (connector) +	     (__i) < (__state)->num_connector;					\ +	     (__i)++)								\ +		for_each_if ((__state)->connectors[__i].ptr &&			\ +			     ((connector) = (__state)->connectors[__i].ptr,	\ +			     (old_connector_state) = (__state)->connectors[__i].old_state,	\ +			     (new_connector_state) = (__state)->connectors[__i].new_state, 1))  /**   * for_each_old_connector_in_state - iterate over all connectors in an atomic update @@ -616,11 +606,11 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_old_connector_in_state(__state, connector, old_connector_state, __i) \  	for ((__i) = 0;								\ -	     (__i) < (__state)->num_connector &&				\ -	     ((connector) = (__state)->connectors[__i].ptr,			\ -	     (old_connector_state) = (__state)->connectors[__i].old_state, 1); 	\ -	     (__i)++)							\ -		for_each_if (connector) +	     (__i) < (__state)->num_connector;					\ +	     (__i)++)								\ +		for_each_if ((__state)->connectors[__i].ptr &&			\ +			     ((connector) = (__state)->connectors[__i].ptr,	\ +			     (old_connector_state) = (__state)->connectors[__i].old_state, 1))  /**   * for_each_new_connector_in_state - iterate over all connectors in an atomic update @@ -636,36 +626,11 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_new_connector_in_state(__state, connector, new_connector_state, __i) \  	for ((__i) = 0;								\ -	     (__i) < (__state)->num_connector &&				\ -	     ((connector) = (__state)->connectors[__i].ptr,			\ -	     (new_connector_state) = (__state)->connectors[__i].new_state, 1); 	\ -	     (__i)++)							\ -		for_each_if (connector) - -/** - * for_each_crtc_in_state - iterate over all connectors in an atomic update - * @__state: &struct drm_atomic_state pointer - * @crtc: &struct drm_crtc iteration cursor - * @crtc_state: &struct drm_crtc_state iteration cursor - * @__i: int iteration cursor, for macro-internal use - * - * This iterates over all CRTCs in an atomic update. Note that before the - * software state is committed (by calling drm_atomic_helper_swap_state(), this - * points to the new state, while afterwards it points to the old state. Due to - * this tricky confusion this macro is deprecated. - * - * FIXME: - * - * Replace all usage of this with one of the explicit iterators below and then - * remove this macro. - */ -#define for_each_crtc_in_state(__state, crtc, crtc_state, __i)	\ -	for ((__i) = 0;						\ -	     (__i) < (__state)->dev->mode_config.num_crtc &&	\ -	     ((crtc) = (__state)->crtcs[__i].ptr,			\ -	     (crtc_state) = (__state)->crtcs[__i].state, 1);	\ -	     (__i)++)						\ -		for_each_if (crtc_state) +	     (__i) < (__state)->num_connector;					\ +	     (__i)++)								\ +		for_each_if ((__state)->connectors[__i].ptr &&			\ +			     ((connector) = (__state)->connectors[__i].ptr,	\ +			     (new_connector_state) = (__state)->connectors[__i].new_state, 1))  /**   * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic update @@ -681,12 +646,12 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_oldnew_crtc_in_state(__state, crtc, old_crtc_state, new_crtc_state, __i) \  	for ((__i) = 0;							\ -	     (__i) < (__state)->dev->mode_config.num_crtc &&		\ -	     ((crtc) = (__state)->crtcs[__i].ptr,			\ -	     (old_crtc_state) = (__state)->crtcs[__i].old_state,	\ -	     (new_crtc_state) = (__state)->crtcs[__i].new_state, 1);	\ +	     (__i) < (__state)->dev->mode_config.num_crtc;		\  	     (__i)++)							\ -		for_each_if (crtc) +		for_each_if ((__state)->crtcs[__i].ptr &&		\ +			     ((crtc) = (__state)->crtcs[__i].ptr,	\ +			     (old_crtc_state) = (__state)->crtcs[__i].old_state, \ +			     (new_crtc_state) = (__state)->crtcs[__i].new_state, 1))  /**   * for_each_old_crtc_in_state - iterate over all CRTCs in an atomic update @@ -701,11 +666,11 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_old_crtc_in_state(__state, crtc, old_crtc_state, __i)	\  	for ((__i) = 0;							\ -	     (__i) < (__state)->dev->mode_config.num_crtc &&		\ -	     ((crtc) = (__state)->crtcs[__i].ptr,			\ -	     (old_crtc_state) = (__state)->crtcs[__i].old_state, 1);	\ +	     (__i) < (__state)->dev->mode_config.num_crtc;		\  	     (__i)++)							\ -		for_each_if (crtc) +		for_each_if ((__state)->crtcs[__i].ptr &&		\ +			     ((crtc) = (__state)->crtcs[__i].ptr,	\ +			     (old_crtc_state) = (__state)->crtcs[__i].old_state, 1))  /**   * for_each_new_crtc_in_state - iterate over all CRTCs in an atomic update @@ -720,36 +685,11 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_new_crtc_in_state(__state, crtc, new_crtc_state, __i)	\  	for ((__i) = 0;							\ -	     (__i) < (__state)->dev->mode_config.num_crtc &&		\ -	     ((crtc) = (__state)->crtcs[__i].ptr,			\ -	     (new_crtc_state) = (__state)->crtcs[__i].new_state, 1);	\ +	     (__i) < (__state)->dev->mode_config.num_crtc;		\  	     (__i)++)							\ -		for_each_if (crtc) - -/** - * for_each_plane_in_state - iterate over all planes in an atomic update - * @__state: &struct drm_atomic_state pointer - * @plane: &struct drm_plane iteration cursor - * @plane_state: &struct drm_plane_state iteration cursor - * @__i: int iteration cursor, for macro-internal use - * - * This iterates over all planes in an atomic update. Note that before the - * software state is committed (by calling drm_atomic_helper_swap_state(), this - * points to the new state, while afterwards it points to the old state. Due to - * this tricky confusion this macro is deprecated. - * - * FIXME: - * - * Replace all usage of this with one of the explicit iterators below and then - * remove this macro. - */ -#define for_each_plane_in_state(__state, plane, plane_state, __i)		\ -	for ((__i) = 0;							\ -	     (__i) < (__state)->dev->mode_config.num_total_plane &&	\ -	     ((plane) = (__state)->planes[__i].ptr,				\ -	     (plane_state) = (__state)->planes[__i].state, 1);		\ -	     (__i)++)							\ -		for_each_if (plane_state) +		for_each_if ((__state)->crtcs[__i].ptr &&		\ +			     ((crtc) = (__state)->crtcs[__i].ptr,	\ +			     (new_crtc_state) = (__state)->crtcs[__i].new_state, 1))  /**   * for_each_oldnew_plane_in_state - iterate over all planes in an atomic update @@ -765,12 +705,12 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_oldnew_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \  	for ((__i) = 0;							\ -	     (__i) < (__state)->dev->mode_config.num_total_plane &&	\ -	     ((plane) = (__state)->planes[__i].ptr,			\ -	     (old_plane_state) = (__state)->planes[__i].old_state,	\ -	     (new_plane_state) = (__state)->planes[__i].new_state, 1);	\ +	     (__i) < (__state)->dev->mode_config.num_total_plane;	\  	     (__i)++)							\ -		for_each_if (plane) +		for_each_if ((__state)->planes[__i].ptr &&		\ +			     ((plane) = (__state)->planes[__i].ptr,	\ +			      (old_plane_state) = (__state)->planes[__i].old_state,\ +			      (new_plane_state) = (__state)->planes[__i].new_state, 1))  /**   * for_each_old_plane_in_state - iterate over all planes in an atomic update @@ -785,12 +725,11 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_old_plane_in_state(__state, plane, old_plane_state, __i) \  	for ((__i) = 0;							\ -	     (__i) < (__state)->dev->mode_config.num_total_plane &&	\ -	     ((plane) = (__state)->planes[__i].ptr,			\ -	     (old_plane_state) = (__state)->planes[__i].old_state, 1);	\ +	     (__i) < (__state)->dev->mode_config.num_total_plane;	\  	     (__i)++)							\ -		for_each_if (plane) - +		for_each_if ((__state)->planes[__i].ptr &&		\ +			     ((plane) = (__state)->planes[__i].ptr,	\ +			      (old_plane_state) = (__state)->planes[__i].old_state, 1))  /**   * for_each_new_plane_in_state - iterate over all planes in an atomic update   * @__state: &struct drm_atomic_state pointer @@ -804,11 +743,11 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);   */  #define for_each_new_plane_in_state(__state, plane, new_plane_state, __i) \  	for ((__i) = 0;							\ -	     (__i) < (__state)->dev->mode_config.num_total_plane &&	\ -	     ((plane) = (__state)->planes[__i].ptr,			\ -	     (new_plane_state) = (__state)->planes[__i].new_state, 1);	\ +	     (__i) < (__state)->dev->mode_config.num_total_plane;	\  	     (__i)++)							\ -		for_each_if (plane) +		for_each_if ((__state)->planes[__i].ptr &&		\ +			     ((plane) = (__state)->planes[__i].ptr,	\ +			      (new_plane_state) = (__state)->planes[__i].new_state, 1))  /**   * for_each_oldnew_private_obj_in_state - iterate over all private objects in an atomic update @@ -828,8 +767,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);  		     ((obj) = (__state)->private_objs[__i].ptr, \  		      (old_obj_state) = (__state)->private_objs[__i].old_state,	\  		      (new_obj_state) = (__state)->private_objs[__i].new_state, 1); \ -	     (__i)++) \ -		for_each_if (obj) +	     (__i)++)  /**   * for_each_old_private_obj_in_state - iterate over all private objects in an atomic update @@ -847,8 +785,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);  	     (__i) < (__state)->num_private_objs && \  		     ((obj) = (__state)->private_objs[__i].ptr, \  		      (old_obj_state) = (__state)->private_objs[__i].old_state, 1); \ -	     (__i)++) \ -		for_each_if (obj) +	     (__i)++)  /**   * for_each_new_private_obj_in_state - iterate over all private objects in an atomic update @@ -866,8 +803,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);  	     (__i) < (__state)->num_private_objs && \  		     ((obj) = (__state)->private_objs[__i].ptr, \  		      (new_obj_state) = (__state)->private_objs[__i].new_state, 1); \ -	     (__i)++) \ -		for_each_if (obj) +	     (__i)++)  /**   * drm_atomic_crtc_needs_modeset - compute combined modeset need diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h index 81a40c2a9a3e..86bff9841b54 100644 --- a/include/drm/drm_auth.h +++ b/include/drm/drm_auth.h @@ -52,6 +52,12 @@ struct drm_lock_data {   * @dev: Link back to the DRM device   * @lock: DRI1 lock information.   * @driver_priv: Pointer to driver-private information. + * @lessor: Lease holder + * @lessee_id: id for lessees. Owners always have id 0 + * @lessee_list: other lessees of the same master + * @lessees: drm_masters leasing from this one + * @leases: Objects leased to this drm_master. + * @lessee_idr: All lessees under this owner (only used where lessor == NULL)   *   * Note that master structures are only relevant for the legacy/primary device   * nodes, hence there can only be one per device, not one per drm_minor. @@ -76,10 +82,25 @@ struct drm_master {  	struct idr magic_map;  	struct drm_lock_data lock;  	void *driver_priv; + +	/* Tree of display resource leases, each of which is a drm_master struct +	 * All of these get activated simultaneously, so drm_device master points +	 * at the top of the tree (for which lessor is NULL). Protected by +	 * &drm_device.mode_config.idr_mutex. +	 */ + +	struct drm_master *lessor; +	int	lessee_id; +	struct list_head lessee_list; +	struct list_head lessees; +	struct idr leases; +	struct idr lessee_idr;  };  struct drm_master *drm_master_get(struct drm_master *master);  void drm_master_put(struct drm_master **master);  bool drm_is_current_master(struct drm_file *fpriv); +struct drm_master *drm_master_create(struct drm_device *dev); +  #endif diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 6522d4cbc9d9..682d01ba920c 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -245,7 +245,7 @@ struct drm_bridge {  	void *driver_private;  }; -int drm_bridge_add(struct drm_bridge *bridge); +void drm_bridge_add(struct drm_bridge *bridge);  void drm_bridge_remove(struct drm_bridge *bridge);  struct drm_bridge *of_drm_find_bridge(struct device_node *np);  int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index ea8da401c93c..df9807a3caae 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -284,6 +284,11 @@ struct drm_display_info {  	 * @hdmi: advance features of a HDMI sink.  	 */  	struct drm_hdmi_info hdmi; + +	/** +	 * @non_desktop: Non desktop display (HMD). +	 */ +	bool non_desktop;  };  int drm_display_info_set_bus_formats(struct drm_display_info *info, @@ -347,6 +352,13 @@ struct drm_connector_state {  	struct drm_atomic_state *state; +	/** +	 * @commit: Tracks the pending commit to prevent use-after-free conditions. +	 * +	 * Is only set when @crtc is NULL. +	 */ +	struct drm_crtc_commit *commit; +  	struct drm_tv_connector_state tv;  	/** @@ -888,8 +900,7 @@ struct drm_connector {  	 * This is protected by @drm_mode_config.connection_mutex. Note that  	 * nonblocking atomic commits access the current connector state without  	 * taking locks. Either by going through the &struct drm_atomic_state -	 * pointers, see for_each_connector_in_state(), -	 * for_each_oldnew_connector_in_state(), +	 * pointers, see for_each_oldnew_connector_in_state(),  	 * for_each_old_connector_in_state() and  	 * for_each_new_connector_in_state(). Or through careful ordering of  	 * atomic commit operations as implemented in the atomic helpers, see @@ -927,16 +938,18 @@ static inline unsigned drm_connector_index(struct drm_connector *connector)  /**   * drm_connector_lookup - lookup connector object   * @dev: DRM device + * @file_priv: drm file to check for lease against.   * @id: connector object id   *   * This function looks up the connector object specified by id   * add takes a reference to it.   */  static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev, +		struct drm_file *file_priv,  		uint32_t id)  {  	struct drm_mode_object *mo; -	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR); +	mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR);  	return mo ? obj_to_connector(mo) : NULL;  } diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 1a642020e306..a2d81d2907a9 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -253,6 +253,15 @@ struct drm_crtc_state {  	 */  	struct drm_pending_vblank_event *event; +	/** +	 * @commit: +	 * +	 * This tracks how the commit for this update proceeds through the +	 * various phases. This is never cleared, except when we destroy the +	 * state, so that subsequent commits can synchronize with previous ones. +	 */ +	struct drm_crtc_commit *commit; +  	struct drm_atomic_state *state;  }; @@ -797,10 +806,10 @@ struct drm_crtc {  	 * This is protected by @mutex. Note that nonblocking atomic commits  	 * access the current CRTC state without taking locks. Either by going  	 * through the &struct drm_atomic_state pointers, see -	 * for_each_crtc_in_state(), for_each_oldnew_crtc_in_state(), -	 * for_each_old_crtc_in_state() and for_each_new_crtc_in_state(). Or -	 * through careful ordering of atomic commit operations as implemented -	 * in the atomic helpers, see &struct drm_crtc_commit. +	 * for_each_oldnew_crtc_in_state(), for_each_old_crtc_in_state() and +	 * for_each_new_crtc_in_state(). Or through careful ordering of atomic +	 * commit operations as implemented in the atomic helpers, see +	 * &struct drm_crtc_commit.  	 */  	struct drm_crtc_state *state; @@ -808,10 +817,16 @@ struct drm_crtc {  	 * @commit_list:  	 *  	 * List of &drm_crtc_commit structures tracking pending commits. -	 * Protected by @commit_lock. This list doesn't hold its own full -	 * reference, but burrows it from the ongoing commit. Commit entries -	 * must be removed from this list once the commit is fully completed, -	 * but before it's correspoding &drm_atomic_state gets destroyed. +	 * Protected by @commit_lock. This list holds its own full reference, +	 * as does the ongoing commit. +	 * +	 * "Note that the commit for a state change is also tracked in +	 * &drm_crtc_state.commit. For accessing the immediately preceding +	 * commit in an atomic update it is recommended to just use that +	 * pointer in the old CRTC state, since accessing that doesn't need +	 * any locking or list-walking. @commit_list should only be used to +	 * stall for framebuffer cleanup that's signalled through +	 * &drm_crtc_commit.cleanup_done."  	 */  	struct list_head commit_list; @@ -937,6 +952,7 @@ struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);  /**   * drm_crtc_find - look up a CRTC object from its ID   * @dev: DRM device + * @file_priv: drm file to check for lease against.   * @id: &drm_mode_object ID   *   * This can be used to look up a CRTC from its userspace ID. Only used by @@ -944,10 +960,11 @@ struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);   * userspace interface should be done using &drm_property.   */  static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, -	uint32_t id) +		struct drm_file *file_priv, +		uint32_t id)  {  	struct drm_mode_object *mo; -	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC); +	mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CRTC);  	return mo ? obj_to_crtc(mo) : NULL;  } diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index b17476a6909c..2623a1255481 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -510,6 +510,8 @@  # define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK   0xc0  # define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT  6 +#define DP_ADJUST_REQUEST_POST_CURSOR2      0x20c +  #define DP_TEST_REQUEST			    0x218  # define DP_TEST_LINK_TRAINING		    (1 << 0)  # define DP_TEST_LINK_VIDEO_PATTERN	    (1 << 1) @@ -582,6 +584,8 @@  #define DP_TEST_REFRESH_RATE_NUMERATOR      0x234 +#define DP_TEST_MISC0                       0x232 +  #define DP_TEST_CRC_R_CR		    0x240  #define DP_TEST_CRC_G_Y			    0x242  #define DP_TEST_CRC_B_CB		    0x244 @@ -590,6 +594,18 @@  # define DP_TEST_CRC_SUPPORTED		    (1 << 5)  # define DP_TEST_COUNT_MASK		    0xf +#define DP_TEST_PHY_PATTERN                 0x248 +#define DP_TEST_80BIT_CUSTOM_PATTERN_7_0    0x250 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_15_8   0x251 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_23_16  0x252 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_31_24  0x253 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_39_32  0x254 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_47_40  0x255 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_55_48  0x256 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_63_56  0x257 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_71_64  0x258 +#define	DP_TEST_80BIT_CUSTOM_PATTERN_79_72  0x259 +  #define DP_TEST_RESPONSE		    0x260  # define DP_TEST_ACK			    (1 << 0)  # define DP_TEST_NAK			    (1 << 1) @@ -611,6 +627,7 @@  #define DP_SINK_OUI			    0x400  #define DP_BRANCH_OUI			    0x500  #define DP_BRANCH_ID                        0x503 +#define DP_BRANCH_REVISION_START            0x509  #define DP_BRANCH_HW_REV                    0x509  #define DP_BRANCH_SW_REV                    0x50A @@ -735,9 +752,23 @@  # define DP_PSR_SINK_INTERNAL_ERROR         7  # define DP_PSR_SINK_STATE_MASK             0x07 +#define DP_SYNCHRONIZATION_LATENCY_IN_SINK		0x2009 /* edp 1.4 */ +# define DP_MAX_RESYNC_FRAME_COUNT_MASK			(0xf << 0) +# define DP_MAX_RESYNC_FRAME_COUNT_SHIFT		0 +# define DP_LAST_ACTUAL_SYNCHRONIZATION_LATENCY_MASK	(0xf << 4) +# define DP_LAST_ACTUAL_SYNCHRONIZATION_LATENCY_SHIFT	4 +  #define DP_RECEIVER_ALPM_STATUS		    0x200b  /* eDP 1.4 */  # define DP_ALPM_LOCK_TIMEOUT_ERROR	    (1 << 0) +#define DP_LANE0_1_STATUS_ESI                  0x200c /* status same as 0x202 */ +#define DP_LANE2_3_STATUS_ESI                  0x200d /* status same as 0x203 */ +#define DP_LANE_ALIGN_STATUS_UPDATED_ESI       0x200e /* status same as 0x204 */ +#define DP_SINK_STATUS_ESI                     0x200f /* status same as 0x205 */ + +#define DP_DP13_DPCD_REV                    0x2200 +#define DP_DP13_MAX_LINK_RATE               0x2201 +  #define DP_DPRX_FEATURE_ENUMERATION_LIST    0x2210  /* DP 1.3 */  # define DP_GTC_CAP					(1 << 0)  /* DP 1.3 */  # define DP_SST_SPLIT_SDP_CAP				(1 << 1)  /* DP 1.4 */ @@ -871,6 +902,18 @@ void drm_dp_link_train_channel_eq_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]);  u8 drm_dp_link_rate_to_bw_code(int link_rate);  int drm_dp_bw_code_to_link_rate(u8 link_bw); +#define DP_SDP_AUDIO_TIMESTAMP		0x01 +#define DP_SDP_AUDIO_STREAM		0x02 +#define DP_SDP_EXTENSION		0x04 /* DP 1.1 */ +#define DP_SDP_AUDIO_COPYMANAGEMENT	0x05 /* DP 1.2 */ +#define DP_SDP_ISRC			0x06 /* DP 1.2 */ +#define DP_SDP_VSC			0x07 /* DP 1.2 */ +#define DP_SDP_CAMERA_GENERIC(i)	(0x08 + (i)) /* 0-7, DP 1.3 */ +#define DP_SDP_PPS			0x10 /* DP 1.4 */ +#define DP_SDP_VSC_EXT_VESA		0x20 /* DP 1.4 */ +#define DP_SDP_VSC_EXT_CEA		0x21 /* DP 1.4 */ +/* 0x80+ CEA-861 infoframe types */ +  struct edp_sdp_header {  	u8 HB0; /* Secondary Data Packet ID */  	u8 HB1; /* Secondary Data Packet Type */ diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index d55abb75f29a..7f78d26a0766 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h @@ -631,5 +631,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,  int drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,  				     struct drm_dp_mst_topology_mgr *mgr,  				     int slots); +int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr, +				 struct drm_dp_mst_port *port, bool power_up);  #endif diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 71bbaaec836d..412e83a4d3db 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -155,7 +155,7 @@ struct drm_driver {  	 * reverse order of the initialization.  Similarly to the load  	 * hook, this handler is deprecated and its usage should be  	 * dropped in favor of an open-coded teardown function at the -	 * driver layer.  See drm_dev_unregister() and drm_dev_unref() +	 * driver layer.  See drm_dev_unregister() and drm_dev_put()  	 * for the proper way to remove a &struct drm_device.  	 *  	 * The unload() hook is called right after unregistering @@ -324,7 +324,7 @@ struct drm_driver {  	 */  	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,  				     int *max_error, -				     struct timeval *vblank_time, +				     ktime_t *vblank_time,  				     bool in_vblank_irq);  	/** @@ -611,7 +611,8 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,  int drm_dev_register(struct drm_device *dev, unsigned long flags);  void drm_dev_unregister(struct drm_device *dev); -void drm_dev_ref(struct drm_device *dev); +void drm_dev_get(struct drm_device *dev); +void drm_dev_put(struct drm_device *dev);  void drm_dev_unref(struct drm_device *dev);  void drm_put_dev(struct drm_device *dev);  void drm_dev_unplug(struct drm_device *dev); diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 1e1908a6b1d6..6f35909b8add 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -341,6 +341,8 @@ int drm_av_sync_delay(struct drm_connector *connector,  #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE  struct edid *drm_load_edid_firmware(struct drm_connector *connector); +int __drm_set_edid_firmware_path(const char *path); +int __drm_get_edid_firmware_path(char *buf, size_t bufsize);  #else  static inline struct edid *  drm_load_edid_firmware(struct drm_connector *connector) diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index 8d8245ec0181..ee4cfbe63c52 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -208,17 +208,19 @@ static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder,  /**   * drm_encoder_find - find a &drm_encoder   * @dev: DRM device + * @file_priv: drm file to check for lease against.   * @id: encoder id   *   * Returns the encoder with @id, NULL if it doesn't exist. Simple wrapper around   * drm_mode_object_find().   */  static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev, +						   struct drm_file *file_priv,  						   uint32_t id)  {  	struct drm_mode_object *mo; -	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER); +	mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_ENCODER);  	return mo ? obj_to_encoder(mo) : NULL;  } diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index a323781afc3f..faf56c53df28 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DRM_FB_CMA_HELPER_H__  #define __DRM_FB_CMA_HELPER_H__ @@ -28,16 +29,6 @@ void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state);  void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,  					bool state); -void drm_fb_cma_destroy(struct drm_framebuffer *fb); -int drm_fb_cma_create_handle(struct drm_framebuffer *fb, -	struct drm_file *file_priv, unsigned int *handle); - -struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev, -	struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd, -	const struct drm_framebuffer_funcs *funcs); -struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, -	struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd); -  struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,  	unsigned int plane); @@ -45,9 +36,6 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb,  				   struct drm_plane_state *state,  				   unsigned int plane); -int drm_fb_cma_prepare_fb(struct drm_plane *plane, -			  struct drm_plane_state *state); -  #ifdef CONFIG_DEBUG_FS  struct seq_file; diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index b6996ddb19d6..4c5ee4ae54df 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h @@ -205,6 +205,7 @@ int drm_framebuffer_init(struct drm_device *dev,  			 struct drm_framebuffer *fb,  			 const struct drm_framebuffer_funcs *funcs);  struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev, +					       struct drm_file *file_priv,  					       uint32_t id);  void drm_framebuffer_remove(struct drm_framebuffer *fb);  void drm_framebuffer_cleanup(struct drm_framebuffer *fb); diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 58a739bf15f1..520e3feb502c 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DRM_GEM_CMA_HELPER_H__  #define __DRM_GEM_CMA_HELPER_H__ diff --git a/include/drm/drm_gem_framebuffer_helper.h b/include/drm/drm_gem_framebuffer_helper.h index db9cfa07235e..5ca7cdc3f527 100644 --- a/include/drm/drm_gem_framebuffer_helper.h +++ b/include/drm/drm_gem_framebuffer_helper.h @@ -2,8 +2,8 @@  #define __DRM_GEM_FB_HELPER_H__  struct drm_device; -struct drm_file;  struct drm_fb_helper_surface_size; +struct drm_file;  struct drm_framebuffer;  struct drm_framebuffer_funcs;  struct drm_gem_object; diff --git a/include/drm/drm_lease.h b/include/drm/drm_lease.h new file mode 100644 index 000000000000..fbc0ab54855b --- /dev/null +++ b/include/drm/drm_lease.h @@ -0,0 +1,46 @@ +/* + * Copyright © 2017 Keith Packard <keithp@keithp.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + */ + +#ifndef _DRM_LEASE_H_ +#define _DRM_LEASE_H_ + +struct drm_file; +struct drm_device; +struct drm_master; + +struct drm_master *drm_lease_owner(struct drm_master *master); + +void drm_lease_destroy(struct drm_master *lessee); + +bool drm_lease_held(struct drm_file *file_priv, int id); + +bool _drm_lease_held(struct drm_file *file_priv, int id); + +void drm_lease_revoke(struct drm_master *master); + +uint32_t drm_lease_filter_crtcs(struct drm_file *file_priv, uint32_t crtcs); + +int drm_mode_create_lease_ioctl(struct drm_device *dev, +				void *data, struct drm_file *file_priv); + +int drm_mode_list_lessees_ioctl(struct drm_device *dev, +				void *data, struct drm_file *file_priv); + +int drm_mode_get_lease_ioctl(struct drm_device *dev, +			     void *data, struct drm_file *file_priv); + +int drm_mode_revoke_lease_ioctl(struct drm_device *dev, +				void *data, struct drm_file *file_priv); + +#endif /* _DRM_LEASE_H_ */ diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 1b37368416c8..b21e827c5c78 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -430,19 +430,6 @@ struct drm_mode_config {  	struct list_head encoder_list;  	/** -	 * @num_overlay_plane: -	 * -	 * Number of overlay planes on this device, excluding primary and cursor -	 * planes. -	 * -	 * Track number of overlay planes separately from number of total -	 * planes.  By default we only advertise overlay planes to userspace; if -	 * userspace sets the "universal plane" capability bit, we'll go ahead -	 * and expose all planes. This is invariant over the lifetime of a -	 * device and hence doesn't need any locks. -	 */ -	int num_overlay_plane; -	/**  	 * @num_total_plane:  	 *  	 * Number of universal (i.e. with primary/curso) planes on this device. @@ -741,6 +728,13 @@ struct drm_mode_config {  	 */  	struct drm_property *suggested_y_property; +	/** +	 * @non_desktop_property: Optional connector property with a hint +	 * that device isn't a standard display, and the console/desktop, +	 * should not be displayed on it. +	 */ +	struct drm_property *non_desktop_property; +  	/* dumb ioctl parameters */  	uint32_t preferred_depth, prefer_shadow; diff --git a/include/drm/drm_mode_object.h b/include/drm/drm_mode_object.h index a767b4a30a6d..7ba3913f30b5 100644 --- a/include/drm/drm_mode_object.h +++ b/include/drm/drm_mode_object.h @@ -24,9 +24,11 @@  #define __DRM_MODESET_H__  #include <linux/kref.h> +#include <drm/drm_lease.h>  struct drm_object_properties;  struct drm_property;  struct drm_device; +struct drm_file;  /**   * struct drm_mode_object - base structure for modeset objects @@ -113,6 +115,7 @@ struct drm_object_properties {  	}  struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, +					     struct drm_file *file_priv,  					     uint32_t id, uint32_t type);  void drm_mode_object_get(struct drm_mode_object *obj);  void drm_mode_object_put(struct drm_mode_object *obj); @@ -151,4 +154,6 @@ int drm_object_property_get_value(struct drm_mode_object *obj,  void drm_object_attach_property(struct drm_mode_object *obj,  				struct drm_property *property,  				uint64_t init_val); + +bool drm_mode_object_lease_required(uint32_t type);  #endif diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index c55cf3ff6847..16646c44b7df 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h @@ -314,7 +314,7 @@ struct drm_crtc_helper_funcs {  	 * implementation in drm_atomic_helper_check().  	 *  	 * When using drm_atomic_helper_check_planes() this hook is called -	 * after the &drm_plane_helper_funcs.atomc_check hook for planes, which +	 * after the &drm_plane_helper_funcs.atomic_check hook for planes, which  	 * allows drivers to assign shared resources requested by planes in this  	 * callback here. For more complicated dependencies the driver can call  	 * the provided check helpers multiple times until the computed state diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h index 4b27c2bb955c..a685d1bb21f2 100644 --- a/include/drm/drm_modeset_lock.h +++ b/include/drm/drm_modeset_lock.h @@ -34,6 +34,7 @@ struct drm_modeset_lock;   * @contended: used internally for -EDEADLK handling   * @locked: list of held locks   * @trylock_only: trylock mode used in atomic contexts/panic notifiers + * @interruptible: whether interruptible locking should be used.   *   * Each thread competing for a set of locks must use one acquire   * ctx.  And if any lock fxn returns -EDEADLK, it must backoff and @@ -59,6 +60,9 @@ struct drm_modeset_acquire_ctx {  	 * Trylock mode, use only for panic handlers!  	 */  	bool trylock_only; + +	/* Perform interruptible waits on this context. */ +	bool interruptible;  };  /** @@ -82,12 +86,13 @@ struct drm_modeset_lock {  	struct list_head head;  }; +#define DRM_MODESET_ACQUIRE_INTERRUPTIBLE BIT(0) +  void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,  		uint32_t flags);  void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx);  void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx); -void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx); -int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx); +int drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);  void drm_modeset_lock_init(struct drm_modeset_lock *lock); @@ -111,8 +116,7 @@ static inline bool drm_modeset_is_locked(struct drm_modeset_lock *lock)  int drm_modeset_lock(struct drm_modeset_lock *lock,  		struct drm_modeset_acquire_ctx *ctx); -int drm_modeset_lock_interruptible(struct drm_modeset_lock *lock, -		struct drm_modeset_acquire_ctx *ctx); +int __must_check drm_modeset_lock_single_interruptible(struct drm_modeset_lock *lock);  void drm_modeset_unlock(struct drm_modeset_lock *lock);  struct drm_device; diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 104dd517fdbe..b93c239afb60 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -1,7 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DRM_OF_H__  #define __DRM_OF_H__  #include <linux/of_graph.h> +#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE) +#include <drm/drm_bridge.h> +#endif  struct component_master_ops;  struct component_match; @@ -67,6 +71,34 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np,  }  #endif +/* + * drm_of_panel_bridge_remove - remove panel bridge + * @np: device tree node containing panel bridge output ports + * + * Remove the panel bridge of a given DT node's port and endpoint number + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +static inline int drm_of_panel_bridge_remove(const struct device_node *np, +					     int port, int endpoint) +{ +#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE) +	struct drm_bridge *bridge; +	struct device_node *remote; + +	remote = of_graph_get_remote_node(np, port, endpoint); +	if (!remote) +		return -ENODEV; + +	bridge = of_drm_find_bridge(remote); +	drm_panel_bridge_remove(bridge); + +	return 0; +#else +	return -EINVAL; +#endif +} +  static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,  						    struct drm_encoder *encoder)  { diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h index 10122353b744..ee8d61b64f29 100644 --- a/include/drm/drm_os_linux.h +++ b/include/drm/drm_os_linux.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /**   * \file drm_os_linux.h   * OS abstraction macros. diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 8bc073d297db..683742826511 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #define radeon_PCI_IDS \  	{0x1002, 0x1304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \  	{0x1002, 0x1305, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 73f90f9d057f..571615079230 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -123,6 +123,14 @@ struct drm_plane_state {  	 */  	bool visible; +	/** +	 * @commit: Tracks the pending commit to prevent use-after-free conditions, +	 * and for async plane updates. +	 * +	 * May be NULL. +	 */ +	struct drm_crtc_commit *commit; +  	struct drm_atomic_state *state;  }; @@ -531,10 +539,10 @@ struct drm_plane {  	 * This is protected by @mutex. Note that nonblocking atomic commits  	 * access the current plane state without taking locks. Either by going  	 * through the &struct drm_atomic_state pointers, see -	 * for_each_plane_in_state(), for_each_oldnew_plane_in_state(), -	 * for_each_old_plane_in_state() and for_each_new_plane_in_state(). Or -	 * through careful ordering of atomic commit operations as implemented -	 * in the atomic helpers, see &struct drm_crtc_commit. +	 * for_each_oldnew_plane_in_state(), for_each_old_plane_in_state() and +	 * for_each_new_plane_in_state(). Or through careful ordering of atomic +	 * commit operations as implemented in the atomic helpers, see +	 * &struct drm_crtc_commit.  	 */  	struct drm_plane_state *state; @@ -583,16 +591,18 @@ int drm_mode_plane_set_obj_prop(struct drm_plane *plane,  /**   * drm_plane_find - find a &drm_plane   * @dev: DRM device + * @file_priv: drm file to check for lease against.   * @id: plane id   *   * Returns the plane with @id, NULL if it doesn't exist. Simple wrapper around   * drm_mode_object_find().   */  static inline struct drm_plane *drm_plane_find(struct drm_device *dev, +		struct drm_file *file_priv,  		uint32_t id)  {  	struct drm_mode_object *mo; -	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE); +	mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PLANE);  	return mo ? obj_to_plane(mo) : NULL;  } diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h index 37355c623e6c..8a522b4bed40 100644 --- a/include/drm/drm_property.h +++ b/include/drm/drm_property.h @@ -305,17 +305,19 @@ drm_property_unreference_blob(struct drm_property_blob *blob)  }  /** - * drm_connector_find - find property object + * drm_property_find - find property object   * @dev: DRM device + * @file_priv: drm file to check for lease against.   * @id: property object id   *   * This function looks up the property object specified by id and returns it.   */  static inline struct drm_property *drm_property_find(struct drm_device *dev, +						     struct drm_file *file_priv,  						     uint32_t id)  {  	struct drm_mode_object *mo; -	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY); +	mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PROPERTY);  	return mo ? obj_to_property(mo) : NULL;  } diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index c00fee539822..43e2f382d2f0 100644 --- a/include/drm/drm_syncobj.h +++ b/include/drm/drm_syncobj.h @@ -136,5 +136,10 @@ int drm_syncobj_find_fence(struct drm_file *file_private,  			   u32 handle,  			   struct dma_fence **fence);  void drm_syncobj_free(struct kref *kref); +int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, +		       struct dma_fence *fence); +int drm_syncobj_get_handle(struct drm_file *file_private, +			   struct drm_syncobj *syncobj, u32 *handle); +int drm_syncobj_get_fd(struct drm_syncobj *syncobj, int *p_fd);  #endif diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h index 70c9a1074aca..4f311e836cdc 100644 --- a/include/drm/drm_sysfs.h +++ b/include/drm/drm_sysfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DRM_SYSFS_H_  #define _DRM_SYSFS_H_ diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h index 7fba9efe4951..848b463a0af5 100644 --- a/include/drm/drm_vblank.h +++ b/include/drm/drm_vblank.h @@ -48,9 +48,17 @@ struct drm_pending_vblank_event {  	 */  	unsigned int pipe;  	/** +	 * @sequence: frame event should be triggered at +	 */ +	u64 sequence; +	/**  	 * @event: Actual event which will be sent to userspace.  	 */ -	struct drm_event_vblank event; +	union { +		struct drm_event base; +		struct drm_event_vblank vbl; +		struct drm_event_crtc_sequence seq; +	} event;  };  /** @@ -88,11 +96,11 @@ struct drm_vblank_crtc {  	/**  	 * @count: Current software vblank counter.  	 */ -	u32 count; +	u64 count;  	/**  	 * @time: Vblank timestamp corresponding to @count.  	 */ -	struct timeval time; +	ktime_t time;  	/**  	 * @refcount: Number of users/waiters of the vblank interrupt. Only when @@ -152,13 +160,16 @@ struct drm_vblank_crtc {  };  int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs); -u32 drm_crtc_vblank_count(struct drm_crtc *crtc); -u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc, -				   struct timeval *vblanktime); +u64 drm_crtc_vblank_count(struct drm_crtc *crtc); +u64 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc, +				   ktime_t *vblanktime);  void drm_crtc_send_vblank_event(struct drm_crtc *crtc,  			       struct drm_pending_vblank_event *e);  void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,  			      struct drm_pending_vblank_event *e); +void drm_vblank_set_event(struct drm_pending_vblank_event *e, +			  u64 *seq, +			  ktime_t *now);  bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe);  bool drm_crtc_handle_vblank(struct drm_crtc *crtc);  int drm_crtc_vblank_get(struct drm_crtc *crtc); @@ -172,7 +183,7 @@ u32 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc);  bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,  					   unsigned int pipe, int *max_error, -					   struct timeval *vblank_time, +					   ktime_t *vblank_time,  					   bool in_vblank_irq);  void drm_calc_timestamping_constants(struct drm_crtc *crtc,  				     const struct drm_display_mode *mode); diff --git a/include/drm/i2c/tda998x.h b/include/drm/i2c/tda998x.h index a25483090cd5..3cb25ccbe5e6 100644 --- a/include/drm/i2c/tda998x.h +++ b/include/drm/i2c/tda998x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DRM_I2C_TDA998X_H__  #define __DRM_I2C_TDA998X_H__ diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h index 34c8f5600ce0..972a25633525 100644 --- a/include/drm/i915_pciids.h +++ b/include/drm/i915_pciids.h @@ -118,92 +118,125 @@  #define INTEL_IRONLAKE_M_IDS(info) \  	INTEL_VGA_DEVICE(0x0046, info) -#define INTEL_SNB_D_IDS(info) \ +#define INTEL_SNB_D_GT1_IDS(info) \  	INTEL_VGA_DEVICE(0x0102, info), \ -	INTEL_VGA_DEVICE(0x0112, info), \ -	INTEL_VGA_DEVICE(0x0122, info), \  	INTEL_VGA_DEVICE(0x010A, info) -#define INTEL_SNB_M_IDS(info) \ -	INTEL_VGA_DEVICE(0x0106, info), \ +#define INTEL_SNB_D_GT2_IDS(info) \ +	INTEL_VGA_DEVICE(0x0112, info), \ +	INTEL_VGA_DEVICE(0x0122, info) + +#define INTEL_SNB_D_IDS(info) \ +	INTEL_SNB_D_GT1_IDS(info), \ +	INTEL_SNB_D_GT2_IDS(info) + +#define INTEL_SNB_M_GT1_IDS(info) \ +	INTEL_VGA_DEVICE(0x0106, info) + +#define INTEL_SNB_M_GT2_IDS(info) \  	INTEL_VGA_DEVICE(0x0116, info), \  	INTEL_VGA_DEVICE(0x0126, info) +#define INTEL_SNB_M_IDS(info) \ +	INTEL_SNB_M_GT1_IDS(info), \ +	INTEL_SNB_M_GT2_IDS(info) + +#define INTEL_IVB_M_GT1_IDS(info) \ +	INTEL_VGA_DEVICE(0x0156, info) /* GT1 mobile */ + +#define INTEL_IVB_M_GT2_IDS(info) \ +	INTEL_VGA_DEVICE(0x0166, info) /* GT2 mobile */ +  #define INTEL_IVB_M_IDS(info) \ -	INTEL_VGA_DEVICE(0x0156, info), /* GT1 mobile */ \ -	INTEL_VGA_DEVICE(0x0166, info)  /* GT2 mobile */ +	INTEL_IVB_M_GT1_IDS(info), \ +	INTEL_IVB_M_GT2_IDS(info) -#define INTEL_IVB_D_IDS(info) \ +#define INTEL_IVB_D_GT1_IDS(info) \  	INTEL_VGA_DEVICE(0x0152, info), /* GT1 desktop */ \ +	INTEL_VGA_DEVICE(0x015a, info)  /* GT1 server */ + +#define INTEL_IVB_D_GT2_IDS(info) \  	INTEL_VGA_DEVICE(0x0162, info), /* GT2 desktop */ \ -	INTEL_VGA_DEVICE(0x015a, info), /* GT1 server */ \  	INTEL_VGA_DEVICE(0x016a, info)  /* GT2 server */ +#define INTEL_IVB_D_IDS(info) \ +	INTEL_IVB_D_GT1_IDS(info), \ +	INTEL_IVB_D_GT2_IDS(info) +  #define INTEL_IVB_Q_IDS(info) \  	INTEL_QUANTA_VGA_DEVICE(info) /* Quanta transcode */ -#define INTEL_HSW_IDS(info) \ +#define INTEL_HSW_GT1_IDS(info) \  	INTEL_VGA_DEVICE(0x0402, info), /* GT1 desktop */ \ -	INTEL_VGA_DEVICE(0x0412, info), /* GT2 desktop */ \ -	INTEL_VGA_DEVICE(0x0422, info), /* GT3 desktop */ \  	INTEL_VGA_DEVICE(0x040a, info), /* GT1 server */ \ -	INTEL_VGA_DEVICE(0x041a, info), /* GT2 server */ \ -	INTEL_VGA_DEVICE(0x042a, info), /* GT3 server */ \  	INTEL_VGA_DEVICE(0x040B, info), /* GT1 reserved */ \ -	INTEL_VGA_DEVICE(0x041B, info), /* GT2 reserved */ \ -	INTEL_VGA_DEVICE(0x042B, info), /* GT3 reserved */ \  	INTEL_VGA_DEVICE(0x040E, info), /* GT1 reserved */ \ -	INTEL_VGA_DEVICE(0x041E, info), /* GT2 reserved */ \ -	INTEL_VGA_DEVICE(0x042E, info), /* GT3 reserved */ \  	INTEL_VGA_DEVICE(0x0C02, info), /* SDV GT1 desktop */ \ -	INTEL_VGA_DEVICE(0x0C12, info), /* SDV GT2 desktop */ \ -	INTEL_VGA_DEVICE(0x0C22, info), /* SDV GT3 desktop */ \  	INTEL_VGA_DEVICE(0x0C0A, info), /* SDV GT1 server */ \ -	INTEL_VGA_DEVICE(0x0C1A, info), /* SDV GT2 server */ \ -	INTEL_VGA_DEVICE(0x0C2A, info), /* SDV GT3 server */ \  	INTEL_VGA_DEVICE(0x0C0B, info), /* SDV GT1 reserved */ \ -	INTEL_VGA_DEVICE(0x0C1B, info), /* SDV GT2 reserved */ \ -	INTEL_VGA_DEVICE(0x0C2B, info), /* SDV GT3 reserved */ \  	INTEL_VGA_DEVICE(0x0C0E, info), /* SDV GT1 reserved */ \ -	INTEL_VGA_DEVICE(0x0C1E, info), /* SDV GT2 reserved */ \ -	INTEL_VGA_DEVICE(0x0C2E, info), /* SDV GT3 reserved */ \  	INTEL_VGA_DEVICE(0x0A02, info), /* ULT GT1 desktop */ \ -	INTEL_VGA_DEVICE(0x0A12, info), /* ULT GT2 desktop */ \ -	INTEL_VGA_DEVICE(0x0A22, info), /* ULT GT3 desktop */ \  	INTEL_VGA_DEVICE(0x0A0A, info), /* ULT GT1 server */ \ -	INTEL_VGA_DEVICE(0x0A1A, info), /* ULT GT2 server */ \ -	INTEL_VGA_DEVICE(0x0A2A, info), /* ULT GT3 server */ \  	INTEL_VGA_DEVICE(0x0A0B, info), /* ULT GT1 reserved */ \ -	INTEL_VGA_DEVICE(0x0A1B, info), /* ULT GT2 reserved */ \ -	INTEL_VGA_DEVICE(0x0A2B, info), /* ULT GT3 reserved */ \  	INTEL_VGA_DEVICE(0x0D02, info), /* CRW GT1 desktop */ \ -	INTEL_VGA_DEVICE(0x0D12, info), /* CRW GT2 desktop */ \ -	INTEL_VGA_DEVICE(0x0D22, info), /* CRW GT3 desktop */ \  	INTEL_VGA_DEVICE(0x0D0A, info), /* CRW GT1 server */ \ -	INTEL_VGA_DEVICE(0x0D1A, info), /* CRW GT2 server */ \ -	INTEL_VGA_DEVICE(0x0D2A, info), /* CRW GT3 server */ \  	INTEL_VGA_DEVICE(0x0D0B, info), /* CRW GT1 reserved */ \ -	INTEL_VGA_DEVICE(0x0D1B, info), /* CRW GT2 reserved */ \ -	INTEL_VGA_DEVICE(0x0D2B, info), /* CRW GT3 reserved */ \  	INTEL_VGA_DEVICE(0x0D0E, info), /* CRW GT1 reserved */ \ -	INTEL_VGA_DEVICE(0x0D1E, info), /* CRW GT2 reserved */ \ -	INTEL_VGA_DEVICE(0x0D2E, info),  /* CRW GT3 reserved */ \  	INTEL_VGA_DEVICE(0x0406, info), /* GT1 mobile */ \ +	INTEL_VGA_DEVICE(0x0C06, info), /* SDV GT1 mobile */ \ +	INTEL_VGA_DEVICE(0x0A06, info), /* ULT GT1 mobile */ \ +	INTEL_VGA_DEVICE(0x0A0E, info), /* ULX GT1 mobile */ \ +	INTEL_VGA_DEVICE(0x0D06, info)  /* CRW GT1 mobile */ + +#define INTEL_HSW_GT2_IDS(info) \ +	INTEL_VGA_DEVICE(0x0412, info), /* GT2 desktop */ \ +	INTEL_VGA_DEVICE(0x041a, info), /* GT2 server */ \ +	INTEL_VGA_DEVICE(0x041B, info), /* GT2 reserved */ \ +	INTEL_VGA_DEVICE(0x041E, info), /* GT2 reserved */ \ +	INTEL_VGA_DEVICE(0x0C12, info), /* SDV GT2 desktop */ \ +	INTEL_VGA_DEVICE(0x0C1A, info), /* SDV GT2 server */ \ +	INTEL_VGA_DEVICE(0x0C1B, info), /* SDV GT2 reserved */ \ +	INTEL_VGA_DEVICE(0x0C1E, info), /* SDV GT2 reserved */ \ +	INTEL_VGA_DEVICE(0x0A12, info), /* ULT GT2 desktop */ \ +	INTEL_VGA_DEVICE(0x0A1A, info), /* ULT GT2 server */ \ +	INTEL_VGA_DEVICE(0x0A1B, info), /* ULT GT2 reserved */ \ +	INTEL_VGA_DEVICE(0x0D12, info), /* CRW GT2 desktop */ \ +	INTEL_VGA_DEVICE(0x0D1A, info), /* CRW GT2 server */ \ +	INTEL_VGA_DEVICE(0x0D1B, info), /* CRW GT2 reserved */ \ +	INTEL_VGA_DEVICE(0x0D1E, info), /* CRW GT2 reserved */ \  	INTEL_VGA_DEVICE(0x0416, info), /* GT2 mobile */ \  	INTEL_VGA_DEVICE(0x0426, info), /* GT2 mobile */ \ -	INTEL_VGA_DEVICE(0x0C06, info), /* SDV GT1 mobile */ \  	INTEL_VGA_DEVICE(0x0C16, info), /* SDV GT2 mobile */ \ -	INTEL_VGA_DEVICE(0x0C26, info), /* SDV GT3 mobile */ \ -	INTEL_VGA_DEVICE(0x0A06, info), /* ULT GT1 mobile */ \  	INTEL_VGA_DEVICE(0x0A16, info), /* ULT GT2 mobile */ \ -	INTEL_VGA_DEVICE(0x0A26, info), /* ULT GT3 mobile */ \ -	INTEL_VGA_DEVICE(0x0A0E, info), /* ULX GT1 mobile */ \  	INTEL_VGA_DEVICE(0x0A1E, info), /* ULX GT2 mobile */ \ +	INTEL_VGA_DEVICE(0x0D16, info)  /* CRW GT2 mobile */ + +#define INTEL_HSW_GT3_IDS(info) \ +	INTEL_VGA_DEVICE(0x0422, info), /* GT3 desktop */ \ +	INTEL_VGA_DEVICE(0x042a, info), /* GT3 server */ \ +	INTEL_VGA_DEVICE(0x042B, info), /* GT3 reserved */ \ +	INTEL_VGA_DEVICE(0x042E, info), /* GT3 reserved */ \ +	INTEL_VGA_DEVICE(0x0C22, info), /* SDV GT3 desktop */ \ +	INTEL_VGA_DEVICE(0x0C2A, info), /* SDV GT3 server */ \ +	INTEL_VGA_DEVICE(0x0C2B, info), /* SDV GT3 reserved */ \ +	INTEL_VGA_DEVICE(0x0C2E, info), /* SDV GT3 reserved */ \ +	INTEL_VGA_DEVICE(0x0A22, info), /* ULT GT3 desktop */ \ +	INTEL_VGA_DEVICE(0x0A2A, info), /* ULT GT3 server */ \ +	INTEL_VGA_DEVICE(0x0A2B, info), /* ULT GT3 reserved */ \ +	INTEL_VGA_DEVICE(0x0D22, info), /* CRW GT3 desktop */ \ +	INTEL_VGA_DEVICE(0x0D2A, info), /* CRW GT3 server */ \ +	INTEL_VGA_DEVICE(0x0D2B, info), /* CRW GT3 reserved */ \ +	INTEL_VGA_DEVICE(0x0D2E, info), /* CRW GT3 reserved */ \ +	INTEL_VGA_DEVICE(0x0C26, info), /* SDV GT3 mobile */ \ +	INTEL_VGA_DEVICE(0x0A26, info), /* ULT GT3 mobile */ \  	INTEL_VGA_DEVICE(0x0A2E, info), /* ULT GT3 reserved */ \ -	INTEL_VGA_DEVICE(0x0D06, info), /* CRW GT1 mobile */ \ -	INTEL_VGA_DEVICE(0x0D16, info), /* CRW GT2 mobile */ \  	INTEL_VGA_DEVICE(0x0D26, info)  /* CRW GT3 mobile */ +#define INTEL_HSW_IDS(info) \ +	INTEL_HSW_GT1_IDS(info), \ +	INTEL_HSW_GT2_IDS(info), \ +	INTEL_HSW_GT3_IDS(info) +  #define INTEL_VLV_IDS(info) \  	INTEL_VGA_DEVICE(0x0f30, info), \  	INTEL_VGA_DEVICE(0x0f31, info), \ @@ -212,17 +245,19 @@  	INTEL_VGA_DEVICE(0x0157, info), \  	INTEL_VGA_DEVICE(0x0155, info) -#define INTEL_BDW_GT12_IDS(info)  \ +#define INTEL_BDW_GT1_IDS(info)  \  	INTEL_VGA_DEVICE(0x1602, info), /* GT1 ULT */ \  	INTEL_VGA_DEVICE(0x1606, info), /* GT1 ULT */ \  	INTEL_VGA_DEVICE(0x160B, info), /* GT1 Iris */ \  	INTEL_VGA_DEVICE(0x160E, info), /* GT1 ULX */ \ -	INTEL_VGA_DEVICE(0x1612, info), /* GT2 Halo */ \ +	INTEL_VGA_DEVICE(0x160A, info), /* GT1 Server */ \ +	INTEL_VGA_DEVICE(0x160D, info)  /* GT1 Workstation */ + +#define INTEL_BDW_GT2_IDS(info)  \ +	INTEL_VGA_DEVICE(0x1612, info), /* GT2 Halo */	\  	INTEL_VGA_DEVICE(0x1616, info), /* GT2 ULT */ \  	INTEL_VGA_DEVICE(0x161B, info), /* GT2 ULT */ \ -	INTEL_VGA_DEVICE(0x161E, info),  /* GT2 ULX */ \ -	INTEL_VGA_DEVICE(0x160A, info), /* GT1 Server */ \ -	INTEL_VGA_DEVICE(0x160D, info), /* GT1 Workstation */ \ +	INTEL_VGA_DEVICE(0x161E, info), /* GT2 ULX */ \  	INTEL_VGA_DEVICE(0x161A, info), /* GT2 Server */ \  	INTEL_VGA_DEVICE(0x161D, info)  /* GT2 Workstation */ @@ -243,7 +278,8 @@  	INTEL_VGA_DEVICE(0x163D, info)  /* Workstation */  #define INTEL_BDW_IDS(info) \ -	INTEL_BDW_GT12_IDS(info), \ +	INTEL_BDW_GT1_IDS(info), \ +	INTEL_BDW_GT2_IDS(info), \  	INTEL_BDW_GT3_IDS(info), \  	INTEL_BDW_RSVD_IDS(info) @@ -303,7 +339,6 @@  #define INTEL_KBL_GT1_IDS(info)	\  	INTEL_VGA_DEVICE(0x5913, info), /* ULT GT1.5 */ \  	INTEL_VGA_DEVICE(0x5915, info), /* ULX GT1.5 */ \ -	INTEL_VGA_DEVICE(0x5917, info), /* DT  GT1.5 */ \  	INTEL_VGA_DEVICE(0x5906, info), /* ULT GT1 */ \  	INTEL_VGA_DEVICE(0x590E, info), /* ULX GT1 */ \  	INTEL_VGA_DEVICE(0x5902, info), /* DT  GT1 */ \ @@ -313,6 +348,7 @@  #define INTEL_KBL_GT2_IDS(info)	\  	INTEL_VGA_DEVICE(0x5916, info), /* ULT GT2 */ \ +	INTEL_VGA_DEVICE(0x5917, info), /* Mobile GT2 */ \  	INTEL_VGA_DEVICE(0x5921, info), /* ULT GT2F */ \  	INTEL_VGA_DEVICE(0x591E, info), /* ULX GT2 */ \  	INTEL_VGA_DEVICE(0x5912, info), /* DT  GT2 */ \ @@ -335,20 +371,22 @@  	INTEL_KBL_GT4_IDS(info)  /* CFL S */ -#define INTEL_CFL_S_IDS(info) \ +#define INTEL_CFL_S_GT1_IDS(info) \  	INTEL_VGA_DEVICE(0x3E90, info), /* SRV GT1 */ \ -	INTEL_VGA_DEVICE(0x3E93, info), /* SRV GT1 */ \ +	INTEL_VGA_DEVICE(0x3E93, info)  /* SRV GT1 */ + +#define INTEL_CFL_S_GT2_IDS(info) \  	INTEL_VGA_DEVICE(0x3E91, info), /* SRV GT2 */ \  	INTEL_VGA_DEVICE(0x3E92, info), /* SRV GT2 */ \  	INTEL_VGA_DEVICE(0x3E96, info)  /* SRV GT2 */  /* CFL H */ -#define INTEL_CFL_H_IDS(info) \ +#define INTEL_CFL_H_GT2_IDS(info) \  	INTEL_VGA_DEVICE(0x3E9B, info), /* Halo GT2 */ \  	INTEL_VGA_DEVICE(0x3E94, info)  /* Halo GT2 */  /* CFL U */ -#define INTEL_CFL_U_IDS(info) \ +#define INTEL_CFL_U_GT3_IDS(info) \  	INTEL_VGA_DEVICE(0x3EA6, info), /* ULT GT3 */ \  	INTEL_VGA_DEVICE(0x3EA7, info), /* ULT GT3 */ \  	INTEL_VGA_DEVICE(0x3EA8, info), /* ULT GT3 */ \ diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h index b3bf717cfc45..c5db7975c640 100644 --- a/include/drm/intel-gtt.h +++ b/include/drm/intel-gtt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Common header for intel-gtt.ko and i915.ko */  #ifndef _DRM_INTEL_GTT_H diff --git a/include/drm/ttm/ttm_debug.h b/include/drm/ttm/ttm_debug.h new file mode 100644 index 000000000000..b5e460fa5086 --- /dev/null +++ b/include/drm/ttm/ttm_debug.h @@ -0,0 +1,31 @@ +/************************************************************************** + * + * Copyright (c) 2017 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Tom St Denis <tom.stdenis@amd.com> + */ +extern void ttm_trace_dma_map(struct device *dev, struct ttm_dma_tt *tt); +extern void ttm_trace_dma_unmap(struct device *dev, struct ttm_dma_tt *tt); diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h index c4520890f267..2c1e3598effe 100644 --- a/include/drm/ttm/ttm_memory.h +++ b/include/drm/ttm/ttm_memory.h @@ -150,10 +150,9 @@ extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,  extern void ttm_mem_global_free(struct ttm_mem_global *glob,  				uint64_t amount);  extern int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, -				     struct page *page, -				     bool no_wait, bool interruptible); +				     struct page *page, uint64_t size);  extern void ttm_mem_global_free_page(struct ttm_mem_global *glob, -				     struct page *page); +				     struct page *page, uint64_t size);  extern size_t ttm_round_pot(size_t size);  extern uint64_t ttm_get_kernel_zone_memory_size(struct ttm_mem_global *glob);  #endif diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h index 49a828425fa2..38a2b4770c35 100644 --- a/include/drm/ttm/ttm_page_alloc.h +++ b/include/drm/ttm/ttm_page_alloc.h @@ -47,7 +47,7 @@ void ttm_page_alloc_fini(void);   *   * Add backing pages to all of @ttm   */ -extern int ttm_pool_populate(struct ttm_tt *ttm); +int ttm_pool_populate(struct ttm_tt *ttm);  /**   * ttm_pool_unpopulate: @@ -56,12 +56,12 @@ extern int ttm_pool_populate(struct ttm_tt *ttm);   *   * Free all pages of @ttm   */ -extern void ttm_pool_unpopulate(struct ttm_tt *ttm); +void ttm_pool_unpopulate(struct ttm_tt *ttm);  /**   * Output the state of pools to debugfs file   */ -extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); +int ttm_page_alloc_debugfs(struct seq_file *m, void *data);  #if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU) @@ -78,10 +78,21 @@ void ttm_dma_page_alloc_fini(void);  /**   * Output the state of pools to debugfs file   */ -extern int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data); +int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data); -extern int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev); -extern void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev); +int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev); +void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev); + + +/** + * Populates and DMA maps pages to fullfil a ttm_dma_populate() request + */ +int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt); + +/** + * Unpopulates and DMA unmaps pages as part of a + * ttm_dma_unpopulate() request */ +void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);  #else  static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, @@ -105,6 +116,16 @@ static inline void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma,  				      struct device *dev)  {  } + +static inline int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt) +{ +	return -ENOMEM; +} + +static inline void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt) +{ +} +  #endif  #endif diff --git a/include/dt-bindings/clock/berlin2.h b/include/dt-bindings/clock/berlin2.h index 0c30800175df..b07b8efab075 100644 --- a/include/dt-bindings/clock/berlin2.h +++ b/include/dt-bindings/clock/berlin2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Berlin2 BG2/BG2CD clock tree IDs   */ diff --git a/include/dt-bindings/clock/berlin2q.h b/include/dt-bindings/clock/berlin2q.h index 72eaf91c9ca6..44b4ac382850 100644 --- a/include/dt-bindings/clock/berlin2q.h +++ b/include/dt-bindings/clock/berlin2q.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Berlin2 BG2Q clock tree IDs   */ diff --git a/include/dt-bindings/clock/cortina,gemini-clock.h b/include/dt-bindings/clock/cortina,gemini-clock.h index acf5cd550b0c..04c3404b2d33 100644 --- a/include/dt-bindings/clock/cortina,gemini-clock.h +++ b/include/dt-bindings/clock/cortina,gemini-clock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DT_BINDINGS_CORTINA_GEMINI_CLOCK_H  #define DT_BINDINGS_CORTINA_GEMINI_CLOCK_H diff --git a/include/dt-bindings/clock/efm32-cmu.h b/include/dt-bindings/clock/efm32-cmu.h index b21b91e736af..4b48d15fe194 100644 --- a/include/dt-bindings/clock/efm32-cmu.h +++ b/include/dt-bindings/clock/efm32-cmu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_BINDINGS_CLOCK_EFM32_CMU_H  #define __DT_BINDINGS_CLOCK_EFM32_CMU_H diff --git a/include/dt-bindings/clock/exynos-audss-clk.h b/include/dt-bindings/clock/exynos-audss-clk.h index 0ae6f5a75d2a..eee9fcc6e6af 100644 --- a/include/dt-bindings/clock/exynos-audss-clk.h +++ b/include/dt-bindings/clock/exynos-audss-clk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for Samsung audio subsystem   * clock controller. diff --git a/include/dt-bindings/clock/exynos4.h b/include/dt-bindings/clock/exynos4.h index c40111f36d5e..e9f9d400c322 100644 --- a/include/dt-bindings/clock/exynos4.h +++ b/include/dt-bindings/clock/exynos4.h @@ -272,4 +272,39 @@  /* must be greater than maximal clock id */  #define CLK_NR_CLKS		461 +/* Exynos4x12 ISP clocks */ +#define CLK_ISP_FIMC_ISP		 1 +#define CLK_ISP_FIMC_DRC		 2 +#define CLK_ISP_FIMC_FD			 3 +#define CLK_ISP_FIMC_LITE0		 4 +#define CLK_ISP_FIMC_LITE1		 5 +#define CLK_ISP_MCUISP			 6 +#define CLK_ISP_GICISP			 7 +#define CLK_ISP_SMMU_ISP		 8 +#define CLK_ISP_SMMU_DRC		 9 +#define CLK_ISP_SMMU_FD			10 +#define CLK_ISP_SMMU_LITE0		11 +#define CLK_ISP_SMMU_LITE1		12 +#define CLK_ISP_PPMUISPMX		13 +#define CLK_ISP_PPMUISPX		14 +#define CLK_ISP_MCUCTL_ISP		15 +#define CLK_ISP_MPWM_ISP		16 +#define CLK_ISP_I2C0_ISP		17 +#define CLK_ISP_I2C1_ISP		18 +#define CLK_ISP_MTCADC_ISP		19 +#define CLK_ISP_PWM_ISP			20 +#define CLK_ISP_WDT_ISP			21 +#define CLK_ISP_UART_ISP		22 +#define CLK_ISP_ASYNCAXIM		23 +#define CLK_ISP_SMMU_ISPCX		24 +#define CLK_ISP_SPI0_ISP		25 +#define CLK_ISP_SPI1_ISP		26 + +#define CLK_ISP_DIV_ISP0		27 +#define CLK_ISP_DIV_ISP1		28 +#define CLK_ISP_DIV_MCUISP0		29 +#define CLK_ISP_DIV_MCUISP1		30 + +#define CLK_NR_ISP_CLKS			31 +  #endif /* _DT_BINDINGS_CLOCK_EXYNOS_4_H */ diff --git a/include/dt-bindings/clock/gxbb-clkc.h b/include/dt-bindings/clock/gxbb-clkc.h index c04a76d8facf..8ba99a5e3fd3 100644 --- a/include/dt-bindings/clock/gxbb-clkc.h +++ b/include/dt-bindings/clock/gxbb-clkc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * GXBB clock tree IDs   */ @@ -113,5 +114,16 @@  #define CLKID_SD_EMMC_A_CLK0	119  #define CLKID_SD_EMMC_B_CLK0	122  #define CLKID_SD_EMMC_C_CLK0	125 +#define CLKID_VPU_0_SEL		126 +#define CLKID_VPU_0		128 +#define CLKID_VPU_1_SEL		129 +#define CLKID_VPU_1		131 +#define CLKID_VPU		132 +#define CLKID_VAPB_0_SEL	133 +#define CLKID_VAPB_0		135 +#define CLKID_VAPB_1_SEL	136 +#define CLKID_VAPB_1		138 +#define CLKID_VAPB_SEL		139 +#define CLKID_VAPB		140  #endif /* __GXBB_CLKC_H */ diff --git a/include/dt-bindings/clock/imx7d-clock.h b/include/dt-bindings/clock/imx7d-clock.h index de62a83b6c80..e2f99ae72d5c 100644 --- a/include/dt-bindings/clock/imx7d-clock.h +++ b/include/dt-bindings/clock/imx7d-clock.h @@ -80,10 +80,10 @@  #define IMX7D_ARM_M4_ROOT_SRC		67  #define IMX7D_ARM_M4_ROOT_CG		68  #define IMX7D_ARM_M4_ROOT_DIV		69 -#define IMX7D_ARM_M0_ROOT_CLK		70 -#define IMX7D_ARM_M0_ROOT_SRC		71 -#define IMX7D_ARM_M0_ROOT_CG		72 -#define IMX7D_ARM_M0_ROOT_DIV		73 +#define IMX7D_ARM_M0_ROOT_CLK		70	/* unused */ +#define IMX7D_ARM_M0_ROOT_SRC		71	/* unused */ +#define IMX7D_ARM_M0_ROOT_CG		72	/* unused */ +#define IMX7D_ARM_M0_ROOT_DIV		73	/* unused */  #define IMX7D_MAIN_AXI_ROOT_CLK		74  #define IMX7D_MAIN_AXI_ROOT_SRC		75  #define IMX7D_MAIN_AXI_ROOT_CG		76 diff --git a/include/dt-bindings/clock/jz4740-cgu.h b/include/dt-bindings/clock/jz4740-cgu.h index 43153d3e9bd2..6ed83f926ae7 100644 --- a/include/dt-bindings/clock/jz4740-cgu.h +++ b/include/dt-bindings/clock/jz4740-cgu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides clock numbers for the ingenic,jz4740-cgu DT binding.   * diff --git a/include/dt-bindings/clock/jz4780-cgu.h b/include/dt-bindings/clock/jz4780-cgu.h index 467165e3cfee..1859ce53ee38 100644 --- a/include/dt-bindings/clock/jz4780-cgu.h +++ b/include/dt-bindings/clock/jz4780-cgu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides clock numbers for the ingenic,jz4780-cgu DT binding.   * diff --git a/include/dt-bindings/clock/marvell,mmp2.h b/include/dt-bindings/clock/marvell,mmp2.h index 7a510384a82a..228a5e234af0 100644 --- a/include/dt-bindings/clock/marvell,mmp2.h +++ b/include/dt-bindings/clock/marvell,mmp2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DTS_MARVELL_MMP2_CLOCK_H  #define __DTS_MARVELL_MMP2_CLOCK_H diff --git a/include/dt-bindings/clock/marvell,pxa168.h b/include/dt-bindings/clock/marvell,pxa168.h index 3e45bdfe1aa4..caf90436b848 100644 --- a/include/dt-bindings/clock/marvell,pxa168.h +++ b/include/dt-bindings/clock/marvell,pxa168.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DTS_MARVELL_PXA168_CLOCK_H  #define __DTS_MARVELL_PXA168_CLOCK_H diff --git a/include/dt-bindings/clock/marvell,pxa1928.h b/include/dt-bindings/clock/marvell,pxa1928.h index d4f2e18919ff..5dca4820297f 100644 --- a/include/dt-bindings/clock/marvell,pxa1928.h +++ b/include/dt-bindings/clock/marvell,pxa1928.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DTS_MARVELL_PXA1928_CLOCK_H  #define __DTS_MARVELL_PXA1928_CLOCK_H diff --git a/include/dt-bindings/clock/marvell,pxa910.h b/include/dt-bindings/clock/marvell,pxa910.h index 135082a0b62f..7bf46238946e 100644 --- a/include/dt-bindings/clock/marvell,pxa910.h +++ b/include/dt-bindings/clock/marvell,pxa910.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DTS_MARVELL_PXA910_CLOCK_H  #define __DTS_MARVELL_PXA910_CLOCK_H diff --git a/include/dt-bindings/clock/meson8b-clkc.h b/include/dt-bindings/clock/meson8b-clkc.h index a9c0306330b6..dea9d46d4fa7 100644 --- a/include/dt-bindings/clock/meson8b-clkc.h +++ b/include/dt-bindings/clock/meson8b-clkc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Meson8b clock tree IDs   */ diff --git a/include/dt-bindings/clock/mpc512x-clock.h b/include/dt-bindings/clock/mpc512x-clock.h index 4f94919327ce..13c316bf2796 100644 --- a/include/dt-bindings/clock/mpc512x-clock.h +++ b/include/dt-bindings/clock/mpc512x-clock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for MPC512x clock specs in DT bindings.   */ diff --git a/include/dt-bindings/clock/mt2712-clk.h b/include/dt-bindings/clock/mt2712-clk.h new file mode 100644 index 000000000000..48a8e797a617 --- /dev/null +++ b/include/dt-bindings/clock/mt2712-clk.h @@ -0,0 +1,427 @@ +/* + * Copyright (c) 2017 MediaTek Inc. + * Author: Weiyi Lu <weiyi.lu@mediatek.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef _DT_BINDINGS_CLK_MT2712_H +#define _DT_BINDINGS_CLK_MT2712_H + +/* APMIXEDSYS */ + +#define CLK_APMIXED_MAINPLL		0 +#define CLK_APMIXED_UNIVPLL		1 +#define CLK_APMIXED_VCODECPLL		2 +#define CLK_APMIXED_VENCPLL		3 +#define CLK_APMIXED_APLL1		4 +#define CLK_APMIXED_APLL2		5 +#define CLK_APMIXED_LVDSPLL		6 +#define CLK_APMIXED_LVDSPLL2		7 +#define CLK_APMIXED_MSDCPLL		8 +#define CLK_APMIXED_MSDCPLL2		9 +#define CLK_APMIXED_TVDPLL		10 +#define CLK_APMIXED_MMPLL		11 +#define CLK_APMIXED_ARMCA35PLL		12 +#define CLK_APMIXED_ARMCA72PLL		13 +#define CLK_APMIXED_ETHERPLL		14 +#define CLK_APMIXED_NR_CLK		15 + +/* TOPCKGEN */ + +#define CLK_TOP_ARMCA35PLL		0 +#define CLK_TOP_ARMCA35PLL_600M		1 +#define CLK_TOP_ARMCA35PLL_400M		2 +#define CLK_TOP_ARMCA72PLL		3 +#define CLK_TOP_SYSPLL			4 +#define CLK_TOP_SYSPLL_D2		5 +#define CLK_TOP_SYSPLL1_D2		6 +#define CLK_TOP_SYSPLL1_D4		7 +#define CLK_TOP_SYSPLL1_D8		8 +#define CLK_TOP_SYSPLL1_D16		9 +#define CLK_TOP_SYSPLL_D3		10 +#define CLK_TOP_SYSPLL2_D2		11 +#define CLK_TOP_SYSPLL2_D4		12 +#define CLK_TOP_SYSPLL_D5		13 +#define CLK_TOP_SYSPLL3_D2		14 +#define CLK_TOP_SYSPLL3_D4		15 +#define CLK_TOP_SYSPLL_D7		16 +#define CLK_TOP_SYSPLL4_D2		17 +#define CLK_TOP_SYSPLL4_D4		18 +#define CLK_TOP_UNIVPLL			19 +#define CLK_TOP_UNIVPLL_D7		20 +#define CLK_TOP_UNIVPLL_D26		21 +#define CLK_TOP_UNIVPLL_D52		22 +#define CLK_TOP_UNIVPLL_D104		23 +#define CLK_TOP_UNIVPLL_D208		24 +#define CLK_TOP_UNIVPLL_D2		25 +#define CLK_TOP_UNIVPLL1_D2		26 +#define CLK_TOP_UNIVPLL1_D4		27 +#define CLK_TOP_UNIVPLL1_D8		28 +#define CLK_TOP_UNIVPLL_D3		29 +#define CLK_TOP_UNIVPLL2_D2		30 +#define CLK_TOP_UNIVPLL2_D4		31 +#define CLK_TOP_UNIVPLL2_D8		32 +#define CLK_TOP_UNIVPLL_D5		33 +#define CLK_TOP_UNIVPLL3_D2		34 +#define CLK_TOP_UNIVPLL3_D4		35 +#define CLK_TOP_UNIVPLL3_D8		36 +#define CLK_TOP_F_MP0_PLL1		37 +#define CLK_TOP_F_MP0_PLL2		38 +#define CLK_TOP_F_BIG_PLL1		39 +#define CLK_TOP_F_BIG_PLL2		40 +#define CLK_TOP_F_BUS_PLL1		41 +#define CLK_TOP_F_BUS_PLL2		42 +#define CLK_TOP_APLL1			43 +#define CLK_TOP_APLL1_D2		44 +#define CLK_TOP_APLL1_D4		45 +#define CLK_TOP_APLL1_D8		46 +#define CLK_TOP_APLL1_D16		47 +#define CLK_TOP_APLL2			48 +#define CLK_TOP_APLL2_D2		49 +#define CLK_TOP_APLL2_D4		50 +#define CLK_TOP_APLL2_D8		51 +#define CLK_TOP_APLL2_D16		52 +#define CLK_TOP_LVDSPLL			53 +#define CLK_TOP_LVDSPLL_D2		54 +#define CLK_TOP_LVDSPLL_D4		55 +#define CLK_TOP_LVDSPLL_D8		56 +#define CLK_TOP_LVDSPLL2		57 +#define CLK_TOP_LVDSPLL2_D2		58 +#define CLK_TOP_LVDSPLL2_D4		59 +#define CLK_TOP_LVDSPLL2_D8		60 +#define CLK_TOP_ETHERPLL_125M		61 +#define CLK_TOP_ETHERPLL_50M		62 +#define CLK_TOP_CVBS			63 +#define CLK_TOP_CVBS_D2			64 +#define CLK_TOP_SYS_26M			65 +#define CLK_TOP_MMPLL			66 +#define CLK_TOP_MMPLL_D2		67 +#define CLK_TOP_VENCPLL			68 +#define CLK_TOP_VENCPLL_D2		69 +#define CLK_TOP_VCODECPLL		70 +#define CLK_TOP_VCODECPLL_D2		71 +#define CLK_TOP_TVDPLL			72 +#define CLK_TOP_TVDPLL_D2		73 +#define CLK_TOP_TVDPLL_D4		74 +#define CLK_TOP_TVDPLL_D8		75 +#define CLK_TOP_TVDPLL_429M		76 +#define CLK_TOP_TVDPLL_429M_D2		77 +#define CLK_TOP_TVDPLL_429M_D4		78 +#define CLK_TOP_MSDCPLL			79 +#define CLK_TOP_MSDCPLL_D2		80 +#define CLK_TOP_MSDCPLL_D4		81 +#define CLK_TOP_MSDCPLL2		82 +#define CLK_TOP_MSDCPLL2_D2		83 +#define CLK_TOP_MSDCPLL2_D4		84 +#define CLK_TOP_CLK26M_D2		85 +#define CLK_TOP_D2A_ULCLK_6P5M		86 +#define CLK_TOP_VPLL3_DPIX		87 +#define CLK_TOP_VPLL_DPIX		88 +#define CLK_TOP_LTEPLL_FS26M		89 +#define CLK_TOP_DMPLL			90 +#define CLK_TOP_DSI0_LNTC		91 +#define CLK_TOP_DSI1_LNTC		92 +#define CLK_TOP_LVDSTX3_CLKDIG_CTS	93 +#define CLK_TOP_LVDSTX_CLKDIG_CTS	94 +#define CLK_TOP_CLKRTC_EXT		95 +#define CLK_TOP_CLKRTC_INT		96 +#define CLK_TOP_CSI0			97 +#define CLK_TOP_CVBSPLL			98 +#define CLK_TOP_AXI_SEL			99 +#define CLK_TOP_MEM_SEL			100 +#define CLK_TOP_MM_SEL			101 +#define CLK_TOP_PWM_SEL			102 +#define CLK_TOP_VDEC_SEL		103 +#define CLK_TOP_VENC_SEL		104 +#define CLK_TOP_MFG_SEL			105 +#define CLK_TOP_CAMTG_SEL		106 +#define CLK_TOP_UART_SEL		107 +#define CLK_TOP_SPI_SEL			108 +#define CLK_TOP_USB20_SEL		109 +#define CLK_TOP_USB30_SEL		110 +#define CLK_TOP_MSDC50_0_HCLK_SEL	111 +#define CLK_TOP_MSDC50_0_SEL		112 +#define CLK_TOP_MSDC30_1_SEL		113 +#define CLK_TOP_MSDC30_2_SEL		114 +#define CLK_TOP_MSDC30_3_SEL		115 +#define CLK_TOP_AUDIO_SEL		116 +#define CLK_TOP_AUD_INTBUS_SEL		117 +#define CLK_TOP_PMICSPI_SEL		118 +#define CLK_TOP_DPILVDS1_SEL		119 +#define CLK_TOP_ATB_SEL			120 +#define CLK_TOP_NR_SEL			121 +#define CLK_TOP_NFI2X_SEL		122 +#define CLK_TOP_IRDA_SEL		123 +#define CLK_TOP_CCI400_SEL		124 +#define CLK_TOP_AUD_1_SEL		125 +#define CLK_TOP_AUD_2_SEL		126 +#define CLK_TOP_MEM_MFG_IN_AS_SEL	127 +#define CLK_TOP_AXI_MFG_IN_AS_SEL	128 +#define CLK_TOP_SCAM_SEL		129 +#define CLK_TOP_NFIECC_SEL		130 +#define CLK_TOP_PE2_MAC_P0_SEL		131 +#define CLK_TOP_PE2_MAC_P1_SEL		132 +#define CLK_TOP_DPILVDS_SEL		133 +#define CLK_TOP_MSDC50_3_HCLK_SEL	134 +#define CLK_TOP_HDCP_SEL		135 +#define CLK_TOP_HDCP_24M_SEL		136 +#define CLK_TOP_RTC_SEL			137 +#define CLK_TOP_SPINOR_SEL		138 +#define CLK_TOP_APLL_SEL		139 +#define CLK_TOP_APLL2_SEL		140 +#define CLK_TOP_A1SYS_HP_SEL		141 +#define CLK_TOP_A2SYS_HP_SEL		142 +#define CLK_TOP_ASM_L_SEL		143 +#define CLK_TOP_ASM_M_SEL		144 +#define CLK_TOP_ASM_H_SEL		145 +#define CLK_TOP_I2SO1_SEL		146 +#define CLK_TOP_I2SO2_SEL		147 +#define CLK_TOP_I2SO3_SEL		148 +#define CLK_TOP_TDMO0_SEL		149 +#define CLK_TOP_TDMO1_SEL		150 +#define CLK_TOP_I2SI1_SEL		151 +#define CLK_TOP_I2SI2_SEL		152 +#define CLK_TOP_I2SI3_SEL		153 +#define CLK_TOP_ETHER_125M_SEL		154 +#define CLK_TOP_ETHER_50M_SEL		155 +#define CLK_TOP_JPGDEC_SEL		156 +#define CLK_TOP_SPISLV_SEL		157 +#define CLK_TOP_ETHER_50M_RMII_SEL	158 +#define CLK_TOP_CAM2TG_SEL		159 +#define CLK_TOP_DI_SEL			160 +#define CLK_TOP_TVD_SEL			161 +#define CLK_TOP_I2C_SEL			162 +#define CLK_TOP_PWM_INFRA_SEL		163 +#define CLK_TOP_MSDC0P_AES_SEL		164 +#define CLK_TOP_CMSYS_SEL		165 +#define CLK_TOP_GCPU_SEL		166 +#define CLK_TOP_AUD_APLL1_SEL		167 +#define CLK_TOP_AUD_APLL2_SEL		168 +#define CLK_TOP_DA_AUDULL_VTX_6P5M_SEL	169 +#define CLK_TOP_APLL_DIV0		170 +#define CLK_TOP_APLL_DIV1		171 +#define CLK_TOP_APLL_DIV2		172 +#define CLK_TOP_APLL_DIV3		173 +#define CLK_TOP_APLL_DIV4		174 +#define CLK_TOP_APLL_DIV5		175 +#define CLK_TOP_APLL_DIV6		176 +#define CLK_TOP_APLL_DIV7		177 +#define CLK_TOP_APLL_DIV_PDN0		178 +#define CLK_TOP_APLL_DIV_PDN1		179 +#define CLK_TOP_APLL_DIV_PDN2		180 +#define CLK_TOP_APLL_DIV_PDN3		181 +#define CLK_TOP_APLL_DIV_PDN4		182 +#define CLK_TOP_APLL_DIV_PDN5		183 +#define CLK_TOP_APLL_DIV_PDN6		184 +#define CLK_TOP_APLL_DIV_PDN7		185 +#define CLK_TOP_NR_CLK			186 + +/* INFRACFG */ + +#define CLK_INFRA_DBGCLK		0 +#define CLK_INFRA_GCE			1 +#define CLK_INFRA_M4U			2 +#define CLK_INFRA_KP			3 +#define CLK_INFRA_AO_SPI0		4 +#define CLK_INFRA_AO_SPI1		5 +#define CLK_INFRA_AO_UART5		6 +#define CLK_INFRA_NR_CLK		7 + +/* PERICFG */ + +#define CLK_PERI_NFI			0 +#define CLK_PERI_THERM			1 +#define CLK_PERI_PWM0			2 +#define CLK_PERI_PWM1			3 +#define CLK_PERI_PWM2			4 +#define CLK_PERI_PWM3			5 +#define CLK_PERI_PWM4			6 +#define CLK_PERI_PWM5			7 +#define CLK_PERI_PWM6			8 +#define CLK_PERI_PWM7			9 +#define CLK_PERI_PWM			10 +#define CLK_PERI_AP_DMA			11 +#define CLK_PERI_MSDC30_0		12 +#define CLK_PERI_MSDC30_1		13 +#define CLK_PERI_MSDC30_2		14 +#define CLK_PERI_MSDC30_3		15 +#define CLK_PERI_UART0			16 +#define CLK_PERI_UART1			17 +#define CLK_PERI_UART2			18 +#define CLK_PERI_UART3			19 +#define CLK_PERI_I2C0			20 +#define CLK_PERI_I2C1			21 +#define CLK_PERI_I2C2			22 +#define CLK_PERI_I2C3			23 +#define CLK_PERI_I2C4			24 +#define CLK_PERI_AUXADC			25 +#define CLK_PERI_SPI0			26 +#define CLK_PERI_SPI			27 +#define CLK_PERI_I2C5			28 +#define CLK_PERI_SPI2			29 +#define CLK_PERI_SPI3			30 +#define CLK_PERI_SPI5			31 +#define CLK_PERI_UART4			32 +#define CLK_PERI_SFLASH			33 +#define CLK_PERI_GMAC			34 +#define CLK_PERI_PCIE0			35 +#define CLK_PERI_PCIE1			36 +#define CLK_PERI_GMAC_PCLK		37 +#define CLK_PERI_MSDC50_0_EN		38 +#define CLK_PERI_MSDC30_1_EN		39 +#define CLK_PERI_MSDC30_2_EN		40 +#define CLK_PERI_MSDC30_3_EN		41 +#define CLK_PERI_MSDC50_0_HCLK_EN	42 +#define CLK_PERI_MSDC50_3_HCLK_EN	43 +#define CLK_PERI_NR_CLK			44 + +/* MCUCFG */ + +#define CLK_MCU_MP0_SEL			0 +#define CLK_MCU_MP2_SEL			1 +#define CLK_MCU_BUS_SEL			2 +#define CLK_MCU_NR_CLK			3 + +/* MFGCFG */ + +#define CLK_MFG_BG3D			0 +#define CLK_MFG_NR_CLK			1 + +/* MMSYS */ + +#define CLK_MM_SMI_COMMON		0 +#define CLK_MM_SMI_LARB0		1 +#define CLK_MM_CAM_MDP			2 +#define CLK_MM_MDP_RDMA0		3 +#define CLK_MM_MDP_RDMA1		4 +#define CLK_MM_MDP_RSZ0			5 +#define CLK_MM_MDP_RSZ1			6 +#define CLK_MM_MDP_RSZ2			7 +#define CLK_MM_MDP_TDSHP0		8 +#define CLK_MM_MDP_TDSHP1		9 +#define CLK_MM_MDP_CROP			10 +#define CLK_MM_MDP_WDMA			11 +#define CLK_MM_MDP_WROT0		12 +#define CLK_MM_MDP_WROT1		13 +#define CLK_MM_FAKE_ENG			14 +#define CLK_MM_MUTEX_32K		15 +#define CLK_MM_DISP_OVL0		16 +#define CLK_MM_DISP_OVL1		17 +#define CLK_MM_DISP_RDMA0		18 +#define CLK_MM_DISP_RDMA1		19 +#define CLK_MM_DISP_RDMA2		20 +#define CLK_MM_DISP_WDMA0		21 +#define CLK_MM_DISP_WDMA1		22 +#define CLK_MM_DISP_COLOR0		23 +#define CLK_MM_DISP_COLOR1		24 +#define CLK_MM_DISP_AAL			25 +#define CLK_MM_DISP_GAMMA		26 +#define CLK_MM_DISP_UFOE		27 +#define CLK_MM_DISP_SPLIT0		28 +#define CLK_MM_DISP_OD			29 +#define CLK_MM_DISP_PWM0_MM		30 +#define CLK_MM_DISP_PWM0_26M		31 +#define CLK_MM_DISP_PWM1_MM		32 +#define CLK_MM_DISP_PWM1_26M		33 +#define CLK_MM_DSI0_ENGINE		34 +#define CLK_MM_DSI0_DIGITAL		35 +#define CLK_MM_DSI1_ENGINE		36 +#define CLK_MM_DSI1_DIGITAL		37 +#define CLK_MM_DPI_PIXEL		38 +#define CLK_MM_DPI_ENGINE		39 +#define CLK_MM_DPI1_PIXEL		40 +#define CLK_MM_DPI1_ENGINE		41 +#define CLK_MM_LVDS_PIXEL		42 +#define CLK_MM_LVDS_CTS			43 +#define CLK_MM_SMI_LARB4		44 +#define CLK_MM_SMI_COMMON1		45 +#define CLK_MM_SMI_LARB5		46 +#define CLK_MM_MDP_RDMA2		47 +#define CLK_MM_MDP_TDSHP2		48 +#define CLK_MM_DISP_OVL2		49 +#define CLK_MM_DISP_WDMA2		50 +#define CLK_MM_DISP_COLOR2		51 +#define CLK_MM_DISP_AAL1		52 +#define CLK_MM_DISP_OD1			53 +#define CLK_MM_LVDS1_PIXEL		54 +#define CLK_MM_LVDS1_CTS		55 +#define CLK_MM_SMI_LARB7		56 +#define CLK_MM_MDP_RDMA3		57 +#define CLK_MM_MDP_WROT2		58 +#define CLK_MM_DSI2			59 +#define CLK_MM_DSI2_DIGITAL		60 +#define CLK_MM_DSI3			61 +#define CLK_MM_DSI3_DIGITAL		62 +#define CLK_MM_NR_CLK			63 + +/* IMGSYS */ + +#define CLK_IMG_SMI_LARB2		0 +#define CLK_IMG_SENINF_SCAM_EN		1 +#define CLK_IMG_SENINF_CAM_EN		2 +#define CLK_IMG_CAM_SV_EN		3 +#define CLK_IMG_CAM_SV1_EN		4 +#define CLK_IMG_CAM_SV2_EN		5 +#define CLK_IMG_NR_CLK			6 + +/* BDPSYS */ + +#define CLK_BDP_BRIDGE_B		0 +#define CLK_BDP_BRIDGE_DRAM		1 +#define CLK_BDP_LARB_DRAM		2 +#define CLK_BDP_WR_CHANNEL_VDI_PXL	3 +#define CLK_BDP_WR_CHANNEL_VDI_DRAM	4 +#define CLK_BDP_WR_CHANNEL_VDI_B	5 +#define CLK_BDP_MT_B			6 +#define CLK_BDP_DISPFMT_27M		7 +#define CLK_BDP_DISPFMT_27M_VDOUT	8 +#define CLK_BDP_DISPFMT_27_74_74	9 +#define CLK_BDP_DISPFMT_2FS		10 +#define CLK_BDP_DISPFMT_2FS_2FS74_148	11 +#define CLK_BDP_DISPFMT_B		12 +#define CLK_BDP_VDO_DRAM		13 +#define CLK_BDP_VDO_2FS			14 +#define CLK_BDP_VDO_B			15 +#define CLK_BDP_WR_CHANNEL_DI_PXL	16 +#define CLK_BDP_WR_CHANNEL_DI_DRAM	17 +#define CLK_BDP_WR_CHANNEL_DI_B		18 +#define CLK_BDP_NR_AGENT		19 +#define CLK_BDP_NR_DRAM			20 +#define CLK_BDP_NR_B			21 +#define CLK_BDP_BRIDGE_RT_B		22 +#define CLK_BDP_BRIDGE_RT_DRAM		23 +#define CLK_BDP_LARB_RT_DRAM		24 +#define CLK_BDP_TVD_TDC			25 +#define CLK_BDP_TVD_54			26 +#define CLK_BDP_TVD_CBUS		27 +#define CLK_BDP_NR_CLK			28 + +/* VDECSYS */ + +#define CLK_VDEC_CKEN			0 +#define CLK_VDEC_LARB1_CKEN		1 +#define CLK_VDEC_IMGRZ_CKEN		2 +#define CLK_VDEC_NR_CLK			3 + +/* VENCSYS */ + +#define CLK_VENC_SMI_COMMON_CON		0 +#define CLK_VENC_VENC			1 +#define CLK_VENC_SMI_LARB6		2 +#define CLK_VENC_NR_CLK			3 + +/* JPGDECSYS */ + +#define CLK_JPGDEC_JPGDEC1		0 +#define CLK_JPGDEC_JPGDEC		1 +#define CLK_JPGDEC_NR_CLK		2 + +#endif /* _DT_BINDINGS_CLK_MT2712_H */ diff --git a/include/dt-bindings/clock/mt7622-clk.h b/include/dt-bindings/clock/mt7622-clk.h new file mode 100644 index 000000000000..3e514ed51d15 --- /dev/null +++ b/include/dt-bindings/clock/mt7622-clk.h @@ -0,0 +1,289 @@ +/* + * Copyright (c) 2017 MediaTek Inc. + * Author: Chen Zhong <chen.zhong@mediatek.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef _DT_BINDINGS_CLK_MT7622_H +#define _DT_BINDINGS_CLK_MT7622_H + +/* TOPCKGEN */ + +#define CLK_TOP_TO_U2_PHY		0 +#define CLK_TOP_TO_U2_PHY_1P		1 +#define CLK_TOP_PCIE0_PIPE_EN		2 +#define CLK_TOP_PCIE1_PIPE_EN		3 +#define CLK_TOP_SSUSB_TX250M		4 +#define CLK_TOP_SSUSB_EQ_RX250M		5 +#define CLK_TOP_SSUSB_CDR_REF		6 +#define CLK_TOP_SSUSB_CDR_FB		7 +#define CLK_TOP_SATA_ASIC		8 +#define CLK_TOP_SATA_RBC		9 +#define CLK_TOP_TO_USB3_SYS		10 +#define CLK_TOP_P1_1MHZ			11 +#define CLK_TOP_4MHZ			12 +#define CLK_TOP_P0_1MHZ			13 +#define CLK_TOP_TXCLK_SRC_PRE		14 +#define CLK_TOP_RTC			15 +#define CLK_TOP_MEMPLL			16 +#define CLK_TOP_DMPLL			17 +#define CLK_TOP_SYSPLL_D2		18 +#define CLK_TOP_SYSPLL1_D2		19 +#define CLK_TOP_SYSPLL1_D4		20 +#define CLK_TOP_SYSPLL1_D8		21 +#define CLK_TOP_SYSPLL2_D4		22 +#define CLK_TOP_SYSPLL2_D8		23 +#define CLK_TOP_SYSPLL_D5		24 +#define CLK_TOP_SYSPLL3_D2		25 +#define CLK_TOP_SYSPLL3_D4		26 +#define CLK_TOP_SYSPLL4_D2		27 +#define CLK_TOP_SYSPLL4_D4		28 +#define CLK_TOP_SYSPLL4_D16		29 +#define CLK_TOP_UNIVPLL			30 +#define CLK_TOP_UNIVPLL_D2		31 +#define CLK_TOP_UNIVPLL1_D2		32 +#define CLK_TOP_UNIVPLL1_D4		33 +#define CLK_TOP_UNIVPLL1_D8		34 +#define CLK_TOP_UNIVPLL1_D16		35 +#define CLK_TOP_UNIVPLL2_D2		36 +#define CLK_TOP_UNIVPLL2_D4		37 +#define CLK_TOP_UNIVPLL2_D8		38 +#define CLK_TOP_UNIVPLL2_D16		39 +#define CLK_TOP_UNIVPLL_D5		40 +#define CLK_TOP_UNIVPLL3_D2		41 +#define CLK_TOP_UNIVPLL3_D4		42 +#define CLK_TOP_UNIVPLL3_D16		43 +#define CLK_TOP_UNIVPLL_D7		44 +#define CLK_TOP_UNIVPLL_D80_D4		45 +#define CLK_TOP_UNIV48M			46 +#define CLK_TOP_SGMIIPLL		47 +#define CLK_TOP_SGMIIPLL_D2		48 +#define CLK_TOP_AUD1PLL			49 +#define CLK_TOP_AUD2PLL			50 +#define CLK_TOP_AUD_I2S2_MCK		51 +#define CLK_TOP_TO_USB3_REF		52 +#define CLK_TOP_PCIE1_MAC_EN		53 +#define CLK_TOP_PCIE0_MAC_EN		54 +#define CLK_TOP_ETH_500M		55 +#define CLK_TOP_AXI_SEL			56 +#define CLK_TOP_MEM_SEL			57 +#define CLK_TOP_DDRPHYCFG_SEL		58 +#define CLK_TOP_ETH_SEL			59 +#define CLK_TOP_PWM_SEL			60 +#define CLK_TOP_F10M_REF_SEL		61 +#define CLK_TOP_NFI_INFRA_SEL		62 +#define CLK_TOP_FLASH_SEL		63 +#define CLK_TOP_UART_SEL		64 +#define CLK_TOP_SPI0_SEL		65 +#define CLK_TOP_SPI1_SEL		66 +#define CLK_TOP_MSDC50_0_SEL		67 +#define CLK_TOP_MSDC30_0_SEL		68 +#define CLK_TOP_MSDC30_1_SEL		69 +#define CLK_TOP_A1SYS_HP_SEL		70 +#define CLK_TOP_A2SYS_HP_SEL		71 +#define CLK_TOP_INTDIR_SEL		72 +#define CLK_TOP_AUD_INTBUS_SEL		73 +#define CLK_TOP_PMICSPI_SEL		74 +#define CLK_TOP_SCP_SEL			75 +#define CLK_TOP_ATB_SEL			76 +#define CLK_TOP_HIF_SEL			77 +#define CLK_TOP_AUDIO_SEL		78 +#define CLK_TOP_U2_SEL			79 +#define CLK_TOP_AUD1_SEL		80 +#define CLK_TOP_AUD2_SEL		81 +#define CLK_TOP_IRRX_SEL		82 +#define CLK_TOP_IRTX_SEL		83 +#define CLK_TOP_ASM_L_SEL		84 +#define CLK_TOP_ASM_M_SEL		85 +#define CLK_TOP_ASM_H_SEL		86 +#define CLK_TOP_APLL1_SEL		87 +#define CLK_TOP_APLL2_SEL		88 +#define CLK_TOP_I2S0_MCK_SEL		89 +#define CLK_TOP_I2S1_MCK_SEL		90 +#define CLK_TOP_I2S2_MCK_SEL		91 +#define CLK_TOP_I2S3_MCK_SEL		92 +#define CLK_TOP_APLL1_DIV		93 +#define CLK_TOP_APLL2_DIV		94 +#define CLK_TOP_I2S0_MCK_DIV		95 +#define CLK_TOP_I2S1_MCK_DIV		96 +#define CLK_TOP_I2S2_MCK_DIV		97 +#define CLK_TOP_I2S3_MCK_DIV		98 +#define CLK_TOP_A1SYS_HP_DIV		99 +#define CLK_TOP_A2SYS_HP_DIV		100 +#define CLK_TOP_APLL1_DIV_PD		101 +#define CLK_TOP_APLL2_DIV_PD		102 +#define CLK_TOP_I2S0_MCK_DIV_PD		103 +#define CLK_TOP_I2S1_MCK_DIV_PD		104 +#define CLK_TOP_I2S2_MCK_DIV_PD		105 +#define CLK_TOP_I2S3_MCK_DIV_PD		106 +#define CLK_TOP_A1SYS_HP_DIV_PD		107 +#define CLK_TOP_A2SYS_HP_DIV_PD		108 +#define CLK_TOP_NR_CLK			109 + +/* INFRACFG */ + +#define CLK_INFRA_MUX1_SEL		0 +#define CLK_INFRA_DBGCLK_PD		1 +#define CLK_INFRA_AUDIO_PD		2 +#define CLK_INFRA_IRRX_PD		3 +#define CLK_INFRA_APXGPT_PD		4 +#define CLK_INFRA_PMIC_PD		5 +#define CLK_INFRA_TRNG			6 +#define CLK_INFRA_NR_CLK		7 + +/* PERICFG */ + +#define CLK_PERIBUS_SEL			0 +#define CLK_PERI_THERM_PD		1 +#define CLK_PERI_PWM1_PD		2 +#define CLK_PERI_PWM2_PD		3 +#define CLK_PERI_PWM3_PD		4 +#define CLK_PERI_PWM4_PD		5 +#define CLK_PERI_PWM5_PD		6 +#define CLK_PERI_PWM6_PD		7 +#define CLK_PERI_PWM7_PD		8 +#define CLK_PERI_PWM_PD			9 +#define CLK_PERI_AP_DMA_PD		10 +#define CLK_PERI_MSDC30_0_PD		11 +#define CLK_PERI_MSDC30_1_PD		12 +#define CLK_PERI_UART0_PD		13 +#define CLK_PERI_UART1_PD		14 +#define CLK_PERI_UART2_PD		15 +#define CLK_PERI_UART3_PD		16 +#define CLK_PERI_UART4_PD		17 +#define CLK_PERI_BTIF_PD		18 +#define CLK_PERI_I2C0_PD		19 +#define CLK_PERI_I2C1_PD		20 +#define CLK_PERI_I2C2_PD		21 +#define CLK_PERI_SPI1_PD		22 +#define CLK_PERI_AUXADC_PD		23 +#define CLK_PERI_SPI0_PD		24 +#define CLK_PERI_SNFI_PD		25 +#define CLK_PERI_NFI_PD			26 +#define CLK_PERI_NFIECC_PD		27 +#define CLK_PERI_FLASH_PD		28 +#define CLK_PERI_IRTX_PD		29 +#define CLK_PERI_NR_CLK			30 + +/* APMIXEDSYS */ + +#define CLK_APMIXED_ARMPLL		0 +#define CLK_APMIXED_MAINPLL		1 +#define CLK_APMIXED_UNIV2PLL		2 +#define CLK_APMIXED_ETH1PLL		3 +#define CLK_APMIXED_ETH2PLL		4 +#define CLK_APMIXED_AUD1PLL		5 +#define CLK_APMIXED_AUD2PLL		6 +#define CLK_APMIXED_TRGPLL		7 +#define CLK_APMIXED_SGMIPLL		8 +#define CLK_APMIXED_MAIN_CORE_EN	9 +#define CLK_APMIXED_NR_CLK		10 + +/* AUDIOSYS */ + +#define CLK_AUDIO_AFE			0 +#define CLK_AUDIO_HDMI			1 +#define CLK_AUDIO_SPDF			2 +#define CLK_AUDIO_APLL			3 +#define CLK_AUDIO_I2SIN1		4 +#define CLK_AUDIO_I2SIN2		5 +#define CLK_AUDIO_I2SIN3		6 +#define CLK_AUDIO_I2SIN4		7 +#define CLK_AUDIO_I2SO1			8 +#define CLK_AUDIO_I2SO2			9 +#define CLK_AUDIO_I2SO3			10 +#define CLK_AUDIO_I2SO4			11 +#define CLK_AUDIO_ASRCI1		12 +#define CLK_AUDIO_ASRCI2		13 +#define CLK_AUDIO_ASRCO1		14 +#define CLK_AUDIO_ASRCO2		15 +#define CLK_AUDIO_INTDIR		16 +#define CLK_AUDIO_A1SYS			17 +#define CLK_AUDIO_A2SYS			18 +#define CLK_AUDIO_UL1			19 +#define CLK_AUDIO_UL2			20 +#define CLK_AUDIO_UL3			21 +#define CLK_AUDIO_UL4			22 +#define CLK_AUDIO_UL5			23 +#define CLK_AUDIO_UL6			24 +#define CLK_AUDIO_DL1			25 +#define CLK_AUDIO_DL2			26 +#define CLK_AUDIO_DL3			27 +#define CLK_AUDIO_DL4			28 +#define CLK_AUDIO_DL5			29 +#define CLK_AUDIO_DL6			30 +#define CLK_AUDIO_DLMCH			31 +#define CLK_AUDIO_ARB1			32 +#define CLK_AUDIO_AWB			33 +#define CLK_AUDIO_AWB2			34 +#define CLK_AUDIO_DAI			35 +#define CLK_AUDIO_MOD			36 +#define CLK_AUDIO_ASRCI3		37 +#define CLK_AUDIO_ASRCI4		38 +#define CLK_AUDIO_ASRCO3		39 +#define CLK_AUDIO_ASRCO4		40 +#define CLK_AUDIO_MEM_ASRC1		41 +#define CLK_AUDIO_MEM_ASRC2		42 +#define CLK_AUDIO_MEM_ASRC3		43 +#define CLK_AUDIO_MEM_ASRC4		44 +#define CLK_AUDIO_MEM_ASRC5		45 +#define CLK_AUDIO_NR_CLK		46 + +/* SSUSBSYS */ + +#define CLK_SSUSB_U2_PHY_1P_EN		0 +#define CLK_SSUSB_U2_PHY_EN		1 +#define CLK_SSUSB_REF_EN		2 +#define CLK_SSUSB_SYS_EN		3 +#define CLK_SSUSB_MCU_EN		4 +#define CLK_SSUSB_DMA_EN		5 +#define CLK_SSUSB_NR_CLK		6 + +/* PCIESYS */ + +#define CLK_PCIE_P1_AUX_EN		0 +#define CLK_PCIE_P1_OBFF_EN		1 +#define CLK_PCIE_P1_AHB_EN		2 +#define CLK_PCIE_P1_AXI_EN		3 +#define CLK_PCIE_P1_MAC_EN		4 +#define CLK_PCIE_P1_PIPE_EN		5 +#define CLK_PCIE_P0_AUX_EN		6 +#define CLK_PCIE_P0_OBFF_EN		7 +#define CLK_PCIE_P0_AHB_EN		8 +#define CLK_PCIE_P0_AXI_EN		9 +#define CLK_PCIE_P0_MAC_EN		10 +#define CLK_PCIE_P0_PIPE_EN		11 +#define CLK_SATA_AHB_EN			12 +#define CLK_SATA_AXI_EN			13 +#define CLK_SATA_ASIC_EN		14 +#define CLK_SATA_RBC_EN			15 +#define CLK_SATA_PM_EN			16 +#define CLK_PCIE_NR_CLK			17 + +/* ETHSYS */ + +#define CLK_ETH_HSDMA_EN		0 +#define CLK_ETH_ESW_EN			1 +#define CLK_ETH_GP2_EN			2 +#define CLK_ETH_GP1_EN			3 +#define CLK_ETH_GP0_EN			4 +#define CLK_ETH_NR_CLK			5 + +/* SGMIISYS */ + +#define CLK_SGMII_TX250M_EN		0 +#define CLK_SGMII_RX250M_EN		1 +#define CLK_SGMII_CDR_REF		2 +#define CLK_SGMII_CDR_FB		3 +#define CLK_SGMII_NR_CLK		4 + +#endif /* _DT_BINDINGS_CLK_MT7622_H */ + diff --git a/include/dt-bindings/clock/qcom,rpmcc.h b/include/dt-bindings/clock/qcom,rpmcc.h index 96b63c00249e..b8337a5fa347 100644 --- a/include/dt-bindings/clock/qcom,rpmcc.h +++ b/include/dt-bindings/clock/qcom,rpmcc.h @@ -37,6 +37,9 @@  #define RPM_SYS_FABRIC_A_CLK			19  #define RPM_SFPB_CLK				20  #define RPM_SFPB_A_CLK				21 +#define RPM_SMI_CLK				22 +#define RPM_SMI_A_CLK				23 +#define RPM_PLL4_CLK				24  /* SMD RPM clocks */  #define RPM_SMD_XO_CLK_SRC				0 @@ -101,5 +104,19 @@  #define RPM_SMD_CXO_A1_A_PIN			59  #define RPM_SMD_CXO_A2_PIN			60  #define RPM_SMD_CXO_A2_A_PIN			61 +#define RPM_SMD_AGGR1_NOC_CLK			62 +#define RPM_SMD_AGGR1_NOC_A_CLK			63 +#define RPM_SMD_AGGR2_NOC_CLK			64 +#define RPM_SMD_AGGR2_NOC_A_CLK			65 +#define RPM_SMD_MMAXI_CLK			66 +#define RPM_SMD_MMAXI_A_CLK			67 +#define RPM_SMD_IPA_CLK				68 +#define RPM_SMD_IPA_A_CLK			69 +#define RPM_SMD_CE1_CLK				70 +#define RPM_SMD_CE1_A_CLK			71 +#define RPM_SMD_DIV_CLK3			72 +#define RPM_SMD_DIV_A_CLK3			73 +#define RPM_SMD_LN_BB_CLK			74 +#define RPM_SMD_LN_BB_A_CLK			75  #endif diff --git a/include/dt-bindings/clock/r7s72100-clock.h b/include/dt-bindings/clock/r7s72100-clock.h index 7dd8bc0c3cd0..0dcb3e87d44c 100644 --- a/include/dt-bindings/clock/r7s72100-clock.h +++ b/include/dt-bindings/clock/r7s72100-clock.h @@ -11,6 +11,8 @@  #define __DT_BINDINGS_CLOCK_R7S72100_H__  #define R7S72100_CLK_PLL	0 +#define R7S72100_CLK_I		1 +#define R7S72100_CLK_G		2  /* MSTP2 */  #define R7S72100_CLK_CORESIGHT	0 diff --git a/include/dt-bindings/clock/r8a77970-cpg-mssr.h b/include/dt-bindings/clock/r8a77970-cpg-mssr.h new file mode 100644 index 000000000000..4146395595b1 --- /dev/null +++ b/include/dt-bindings/clock/r8a77970-cpg-mssr.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016 Renesas Electronics Corp. + * Copyright (C) 2017 Cogent Embedded, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef __DT_BINDINGS_CLOCK_R8A77970_CPG_MSSR_H__ +#define __DT_BINDINGS_CLOCK_R8A77970_CPG_MSSR_H__ + +#include <dt-bindings/clock/renesas-cpg-mssr.h> + +/* r8a77970 CPG Core Clocks */ +#define R8A77970_CLK_Z2			0 +#define R8A77970_CLK_ZR			1 +#define R8A77970_CLK_ZTR		2 +#define R8A77970_CLK_ZTRD2		3 +#define R8A77970_CLK_ZT			4 +#define R8A77970_CLK_ZX			5 +#define R8A77970_CLK_S1D1		6 +#define R8A77970_CLK_S1D2		7 +#define R8A77970_CLK_S1D4		8 +#define R8A77970_CLK_S2D1		9 +#define R8A77970_CLK_S2D2		10 +#define R8A77970_CLK_S2D4		11 +#define R8A77970_CLK_LB			12 +#define R8A77970_CLK_CL			13 +#define R8A77970_CLK_ZB3		14 +#define R8A77970_CLK_ZB3D2		15 +#define R8A77970_CLK_DDR		16 +#define R8A77970_CLK_CR			17 +#define R8A77970_CLK_CRD2		18 +#define R8A77970_CLK_SD0H		19 +#define R8A77970_CLK_SD0		20 +#define R8A77970_CLK_RPC		21 +#define R8A77970_CLK_RPCD2		22 +#define R8A77970_CLK_MSO		23 +#define R8A77970_CLK_CANFD		24 +#define R8A77970_CLK_CSI0		25 +#define R8A77970_CLK_FRAY		26 +#define R8A77970_CLK_CP			27 +#define R8A77970_CLK_CPEX		28 +#define R8A77970_CLK_R			29 +#define R8A77970_CLK_OSC		30 + +#endif /* __DT_BINDINGS_CLOCK_R8A77970_CPG_MSSR_H__ */ diff --git a/include/dt-bindings/clock/rk3188-cru-common.h b/include/dt-bindings/clock/rk3188-cru-common.h index eff4319d008b..b9462b7d3dfe 100644 --- a/include/dt-bindings/clock/rk3188-cru-common.h +++ b/include/dt-bindings/clock/rk3188-cru-common.h @@ -68,12 +68,14 @@  #define ACLK_LCDC1		196  #define ACLK_GPU		197  #define ACLK_SMC		198 -#define ACLK_CIF		199 +#define ACLK_CIF1		199  #define ACLK_IPP		200  #define ACLK_RGA		201  #define ACLK_CIF0		202  #define ACLK_CPU		203  #define ACLK_PERI		204 +#define ACLK_VEPU		205 +#define ACLK_VDPU		206  /* pclk gates */  #define PCLK_GRF		320 @@ -134,8 +136,11 @@  #define HCLK_NANDC0		467  #define HCLK_CPU		468  #define HCLK_PERI		469 +#define HCLK_CIF1		470 +#define HCLK_VEPU		471 +#define HCLK_VDPU		472 -#define CLK_NR_CLKS		(HCLK_PERI + 1) +#define CLK_NR_CLKS		(HCLK_VDPU + 1)  /* soft-reset indices */  #define SRST_MCORE		2 diff --git a/include/dt-bindings/clock/rk3368-cru.h b/include/dt-bindings/clock/rk3368-cru.h index aeb83e581a11..a0063ed7284a 100644 --- a/include/dt-bindings/clock/rk3368-cru.h +++ b/include/dt-bindings/clock/rk3368-cru.h @@ -156,6 +156,7 @@  #define PCLK_ISP		366  #define PCLK_VIP		367  #define PCLK_WDT		368 +#define PCLK_EFUSE256		369  /* hclk gates */  #define HCLK_SFC		448 diff --git a/include/dt-bindings/clock/rockchip,rk808.h b/include/dt-bindings/clock/rockchip,rk808.h index 1a873432f965..75dabfc6adc1 100644 --- a/include/dt-bindings/clock/rockchip,rk808.h +++ b/include/dt-bindings/clock/rockchip,rk808.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants clk index RK808 pmic clkout   */ diff --git a/include/dt-bindings/clock/s3c2443.h b/include/dt-bindings/clock/s3c2443.h index 37e66b054d64..f3ba68a25ecb 100644 --- a/include/dt-bindings/clock/s3c2443.h +++ b/include/dt-bindings/clock/s3c2443.h @@ -26,6 +26,8 @@  #define ARMCLK			4  #define HCLK			5  #define PCLK			6 +#define MPLL			7 +#define EPLL			8  /* Special clocks */  #define SCLK_HSSPI0		16 diff --git a/include/dt-bindings/clock/ste-ab8500.h b/include/dt-bindings/clock/ste-ab8500.h index 6731f1f00a84..fb42dd0cab5f 100644 --- a/include/dt-bindings/clock/ste-ab8500.h +++ b/include/dt-bindings/clock/ste-ab8500.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __STE_CLK_AB8500_H__  #define __STE_CLK_AB8500_H__ diff --git a/include/dt-bindings/clock/stih407-clks.h b/include/dt-bindings/clock/stih407-clks.h index 082edd9badfa..f0936c133772 100644 --- a/include/dt-bindings/clock/stih407-clks.h +++ b/include/dt-bindings/clock/stih407-clks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants clk index STMicroelectronics   * STiH407 SoC. diff --git a/include/dt-bindings/clock/stih410-clks.h b/include/dt-bindings/clock/stih410-clks.h index 2097a4bbe155..90cbe6154c39 100644 --- a/include/dt-bindings/clock/stih410-clks.h +++ b/include/dt-bindings/clock/stih410-clks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants clk index STMicroelectronics   * STiH410 SoC. diff --git a/include/dt-bindings/clock/stih416-clks.h b/include/dt-bindings/clock/stih416-clks.h index f9bdbd13568d..74302278024e 100644 --- a/include/dt-bindings/clock/stih416-clks.h +++ b/include/dt-bindings/clock/stih416-clks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants clk index STMicroelectronics   * STiH416 SoC. diff --git a/include/dt-bindings/clock/stih418-clks.h b/include/dt-bindings/clock/stih418-clks.h index b62aa0b20217..0e7fba0c52b3 100644 --- a/include/dt-bindings/clock/stih418-clks.h +++ b/include/dt-bindings/clock/stih418-clks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants clk index STMicroelectronics   * STiH418 SoC. diff --git a/include/dt-bindings/clock/sun4i-a10-ccu.h b/include/dt-bindings/clock/sun4i-a10-ccu.h index c5a53f38d654..e4fa61be5c75 100644 --- a/include/dt-bindings/clock/sun4i-a10-ccu.h +++ b/include/dt-bindings/clock/sun4i-a10-ccu.h @@ -43,6 +43,8 @@  #define _DT_BINDINGS_CLK_SUN4I_A10_H_  #define CLK_HOSC		1 +#define CLK_PLL_VIDEO0_2X	9 +#define CLK_PLL_VIDEO1_2X	18  #define CLK_CPU			20  /* AHB Gates */ diff --git a/include/dt-bindings/clock/sun6i-a31-ccu.h b/include/dt-bindings/clock/sun6i-a31-ccu.h index 4482530fb6f5..c5d13340184a 100644 --- a/include/dt-bindings/clock/sun6i-a31-ccu.h +++ b/include/dt-bindings/clock/sun6i-a31-ccu.h @@ -43,8 +43,12 @@  #ifndef _DT_BINDINGS_CLK_SUN6I_A31_H_  #define _DT_BINDINGS_CLK_SUN6I_A31_H_ +#define CLK_PLL_VIDEO0_2X	7 +  #define CLK_PLL_PERIPH		10 +#define CLK_PLL_VIDEO1_2X	13 +  #define CLK_CPU			18  #define CLK_AHB1_MIPIDSI	23 diff --git a/include/dt-bindings/clock/tegra114-car.h b/include/dt-bindings/clock/tegra114-car.h index ed5ca218c857..bb5c2c999c05 100644 --- a/include/dt-bindings/clock/tegra114-car.h +++ b/include/dt-bindings/clock/tegra114-car.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra114-car.   * diff --git a/include/dt-bindings/clock/tegra124-car-common.h b/include/dt-bindings/clock/tegra124-car-common.h index 9352c7e2ce0b..4331f1df6ebe 100644 --- a/include/dt-bindings/clock/tegra124-car-common.h +++ b/include/dt-bindings/clock/tegra124-car-common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra124-car or   * nvidia,tegra132-car. diff --git a/include/dt-bindings/clock/tegra124-car.h b/include/dt-bindings/clock/tegra124-car.h index 2860737f0443..c520ee231950 100644 --- a/include/dt-bindings/clock/tegra124-car.h +++ b/include/dt-bindings/clock/tegra124-car.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides Tegra124-specific constants for binding   * nvidia,tegra124-car. diff --git a/include/dt-bindings/clock/tegra186-clock.h b/include/dt-bindings/clock/tegra186-clock.h index f73d32098f99..d6b525f4566f 100644 --- a/include/dt-bindings/clock/tegra186-clock.h +++ b/include/dt-bindings/clock/tegra186-clock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /** @file */  #ifndef _MACH_T186_CLK_T186_H diff --git a/include/dt-bindings/clock/tegra20-car.h b/include/dt-bindings/clock/tegra20-car.h index 04500b243a4d..b21a0eb32921 100644 --- a/include/dt-bindings/clock/tegra20-car.h +++ b/include/dt-bindings/clock/tegra20-car.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra20-car.   * diff --git a/include/dt-bindings/clock/tegra210-car.h b/include/dt-bindings/clock/tegra210-car.h index 46689cd3750b..6422314e46eb 100644 --- a/include/dt-bindings/clock/tegra210-car.h +++ b/include/dt-bindings/clock/tegra210-car.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra210-car.   * @@ -309,6 +310,7 @@  #define TEGRA210_CLK_BLINK 280  /* 281 */  #define TEGRA210_CLK_SOR1_SRC 282 +#define TEGRA210_CLK_SOR1_OUT 282  /* 283 */  #define TEGRA210_CLK_XUSB_HOST_SRC 284  #define TEGRA210_CLK_XUSB_FALCON_SRC 285 diff --git a/include/dt-bindings/clock/tegra30-car.h b/include/dt-bindings/clock/tegra30-car.h index 7213354b9652..3c90f1535551 100644 --- a/include/dt-bindings/clock/tegra30-car.h +++ b/include/dt-bindings/clock/tegra30-car.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra30-car.   * diff --git a/include/dt-bindings/display/tda998x.h b/include/dt-bindings/display/tda998x.h index 34757a3847ef..746831ff396c 100644 --- a/include/dt-bindings/display/tda998x.h +++ b/include/dt-bindings/display/tda998x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DT_BINDINGS_TDA998X_H  #define _DT_BINDINGS_TDA998X_H diff --git a/include/dt-bindings/gpio/gpio.h b/include/dt-bindings/gpio/gpio.h index c5074584561d..dd549ff04295 100644 --- a/include/dt-bindings/gpio/gpio.h +++ b/include/dt-bindings/gpio/gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for most GPIO bindings.   * @@ -30,6 +31,6 @@  /* Bit 3 express GPIO suspend/resume persistence */  #define GPIO_SLEEP_MAINTAIN_VALUE 0 -#define GPIO_SLEEP_MAY_LOOSE_VALUE 8 +#define GPIO_SLEEP_MAY_LOSE_VALUE 8  #endif diff --git a/include/dt-bindings/gpio/meson-gxbb-gpio.h b/include/dt-bindings/gpio/meson-gxbb-gpio.h index 58654fd7aa1e..43a68a1110f0 100644 --- a/include/dt-bindings/gpio/meson-gxbb-gpio.h +++ b/include/dt-bindings/gpio/meson-gxbb-gpio.h @@ -29,6 +29,7 @@  #define	GPIOAO_11	11  #define	GPIOAO_12	12  #define	GPIOAO_13	13 +#define	GPIO_TEST_N	14  #define	GPIOZ_0		0  #define	GPIOZ_1		1 @@ -149,6 +150,5 @@  #define	GPIOCLK_1	116  #define	GPIOCLK_2	117  #define	GPIOCLK_3	118 -#define	GPIO_TEST_N	119  #endif diff --git a/include/dt-bindings/gpio/meson-gxl-gpio.h b/include/dt-bindings/gpio/meson-gxl-gpio.h index 684d0d7add1c..01f2a2abd35e 100644 --- a/include/dt-bindings/gpio/meson-gxl-gpio.h +++ b/include/dt-bindings/gpio/meson-gxl-gpio.h @@ -25,6 +25,7 @@  #define	GPIOAO_7	7  #define	GPIOAO_8	8  #define	GPIOAO_9	9 +#define	GPIO_TEST_N	10  #define	GPIOZ_0		0  #define	GPIOZ_1		1 @@ -126,6 +127,5 @@  #define	GPIOX_18	97  #define	GPIOCLK_0	98  #define	GPIOCLK_1	99 -#define	GPIO_TEST_N	100  #endif diff --git a/include/dt-bindings/gpio/tegra-gpio.h b/include/dt-bindings/gpio/tegra-gpio.h index a1c09e88e80b..7625dbc577c2 100644 --- a/include/dt-bindings/gpio/tegra-gpio.h +++ b/include/dt-bindings/gpio/tegra-gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra*-gpio.   * diff --git a/include/dt-bindings/gpio/tegra186-gpio.h b/include/dt-bindings/gpio/tegra186-gpio.h index 38001c7023f1..463ad398fe3e 100644 --- a/include/dt-bindings/gpio/tegra186-gpio.h +++ b/include/dt-bindings/gpio/tegra186-gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra186-gpio*.   * diff --git a/include/dt-bindings/gpio/uniphier-gpio.h b/include/dt-bindings/gpio/uniphier-gpio.h new file mode 100644 index 000000000000..9f0ad174f61c --- /dev/null +++ b/include/dt-bindings/gpio/uniphier-gpio.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2017 Socionext Inc. + *   Author: Masahiro Yamada <yamada.masahiro@socionext.com> + */ + +#ifndef _DT_BINDINGS_GPIO_UNIPHIER_H +#define _DT_BINDINGS_GPIO_UNIPHIER_H + +#define UNIPHIER_GPIO_LINES_PER_BANK	8 + +#define UNIPHIER_GPIO_IRQ_OFFSET	((UNIPHIER_GPIO_LINES_PER_BANK) * 15) + +#define UNIPHIER_GPIO_PORT(bank, line)	\ +			((UNIPHIER_GPIO_LINES_PER_BANK) * (bank) + (line)) + +#define UNIPHIER_GPIO_IRQ(n)		((UNIPHIER_GPIO_IRQ_OFFSET) + (n)) + +#endif /* _DT_BINDINGS_GPIO_UNIPHIER_H */ diff --git a/include/dt-bindings/iio/adc/fsl-imx25-gcq.h b/include/dt-bindings/iio/adc/fsl-imx25-gcq.h index 87abdd4a7674..08ef4d298b94 100644 --- a/include/dt-bindings/iio/adc/fsl-imx25-gcq.h +++ b/include/dt-bindings/iio/adc/fsl-imx25-gcq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for configuring the I.MX25 ADC   */ diff --git a/include/dt-bindings/iio/adi,ad5592r.h b/include/dt-bindings/iio/adi,ad5592r.h index c48aca1dcade..9f8c7b808cd1 100644 --- a/include/dt-bindings/iio/adi,ad5592r.h +++ b/include/dt-bindings/iio/adi,ad5592r.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DT_BINDINGS_ADI_AD5592R_H  #define _DT_BINDINGS_ADI_AD5592R_H diff --git a/include/dt-bindings/input/input.h b/include/dt-bindings/input/input.h index a21413324a3f..bcf0ae100f21 100644 --- a/include/dt-bindings/input/input.h +++ b/include/dt-bindings/input/input.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for most input bindings.   * diff --git a/include/dt-bindings/interrupt-controller/arm-gic.h b/include/dt-bindings/interrupt-controller/arm-gic.h index d4110d5caa3e..0c85f65c81c7 100644 --- a/include/dt-bindings/interrupt-controller/arm-gic.h +++ b/include/dt-bindings/interrupt-controller/arm-gic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the ARM GIC.   */ diff --git a/include/dt-bindings/interrupt-controller/irq.h b/include/dt-bindings/interrupt-controller/irq.h index 33a1003c55aa..a8b310555f14 100644 --- a/include/dt-bindings/interrupt-controller/irq.h +++ b/include/dt-bindings/interrupt-controller/irq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for most IRQ bindings.   * diff --git a/include/dt-bindings/interrupt-controller/mips-gic.h b/include/dt-bindings/interrupt-controller/mips-gic.h index cf35a577e371..bd45cee0c3f0 100644 --- a/include/dt-bindings/interrupt-controller/mips-gic.h +++ b/include/dt-bindings/interrupt-controller/mips-gic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_MIPS_GIC_H  #define _DT_BINDINGS_INTERRUPT_CONTROLLER_MIPS_GIC_H diff --git a/include/dt-bindings/interrupt-controller/mvebu-icu.h b/include/dt-bindings/interrupt-controller/mvebu-icu.h index 8249558545c7..bb5217c64206 100644 --- a/include/dt-bindings/interrupt-controller/mvebu-icu.h +++ b/include/dt-bindings/interrupt-controller/mvebu-icu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the MVEBU ICU driver.   */ diff --git a/include/dt-bindings/leds/common.h b/include/dt-bindings/leds/common.h index 7958bec7de8c..e171d0a6beb2 100644 --- a/include/dt-bindings/leds/common.h +++ b/include/dt-bindings/leds/common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides macros for the common LEDs device tree bindings.   * diff --git a/include/dt-bindings/leds/leds-ns2.h b/include/dt-bindings/leds/leds-ns2.h index 491c5f974a92..fd615749e703 100644 --- a/include/dt-bindings/leds/leds-ns2.h +++ b/include/dt-bindings/leds/leds-ns2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DT_BINDINGS_LEDS_NS2_H  #define _DT_BINDINGS_LEDS_NS2_H diff --git a/include/dt-bindings/mailbox/tegra186-hsp.h b/include/dt-bindings/mailbox/tegra186-hsp.h index f5d66e5f5f10..bcab5b7ca785 100644 --- a/include/dt-bindings/mailbox/tegra186-hsp.h +++ b/include/dt-bindings/mailbox/tegra186-hsp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra186-hsp.   */ diff --git a/include/dt-bindings/media/c8sectpfe.h b/include/dt-bindings/media/c8sectpfe.h index a0b5c7be683c..6b1fb6f5413b 100644 --- a/include/dt-bindings/media/c8sectpfe.h +++ b/include/dt-bindings/media/c8sectpfe.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_C8SECTPFE_H  #define __DT_C8SECTPFE_H diff --git a/include/dt-bindings/memory/tegra114-mc.h b/include/dt-bindings/memory/tegra114-mc.h index 8f48985a3139..27c8386987ff 100644 --- a/include/dt-bindings/memory/tegra114-mc.h +++ b/include/dt-bindings/memory/tegra114-mc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DT_BINDINGS_MEMORY_TEGRA114_MC_H  #define DT_BINDINGS_MEMORY_TEGRA114_MC_H diff --git a/include/dt-bindings/memory/tegra124-mc.h b/include/dt-bindings/memory/tegra124-mc.h index 7d8ee798f34e..f534d7c06019 100644 --- a/include/dt-bindings/memory/tegra124-mc.h +++ b/include/dt-bindings/memory/tegra124-mc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DT_BINDINGS_MEMORY_TEGRA124_MC_H  #define DT_BINDINGS_MEMORY_TEGRA124_MC_H diff --git a/include/dt-bindings/memory/tegra210-mc.h b/include/dt-bindings/memory/tegra210-mc.h index d1731bc14dbc..4490f7cf4772 100644 --- a/include/dt-bindings/memory/tegra210-mc.h +++ b/include/dt-bindings/memory/tegra210-mc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DT_BINDINGS_MEMORY_TEGRA210_MC_H  #define DT_BINDINGS_MEMORY_TEGRA210_MC_H diff --git a/include/dt-bindings/memory/tegra30-mc.h b/include/dt-bindings/memory/tegra30-mc.h index 502beb03d777..3cac81919023 100644 --- a/include/dt-bindings/memory/tegra30-mc.h +++ b/include/dt-bindings/memory/tegra30-mc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DT_BINDINGS_MEMORY_TEGRA30_MC_H  #define DT_BINDINGS_MEMORY_TEGRA30_MC_H diff --git a/include/dt-bindings/mfd/as3722.h b/include/dt-bindings/mfd/as3722.h index e66c0898c58e..9ef0cba90407 100644 --- a/include/dt-bindings/mfd/as3722.h +++ b/include/dt-bindings/mfd/as3722.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides macros for ams AS3722 device bindings.   * diff --git a/include/dt-bindings/mfd/dbx500-prcmu.h b/include/dt-bindings/mfd/dbx500-prcmu.h index 552a2d174f01..0404bcc47dd4 100644 --- a/include/dt-bindings/mfd/dbx500-prcmu.h +++ b/include/dt-bindings/mfd/dbx500-prcmu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the PRCMU bindings.   * diff --git a/include/dt-bindings/mfd/max77620.h b/include/dt-bindings/mfd/max77620.h index b911a0720ccd..1e19c5f908d7 100644 --- a/include/dt-bindings/mfd/max77620.h +++ b/include/dt-bindings/mfd/max77620.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides macros for MAXIM MAX77620 device bindings.   * diff --git a/include/dt-bindings/mfd/palmas.h b/include/dt-bindings/mfd/palmas.h index cdb075aae4e1..c4f1d57ff4ff 100644 --- a/include/dt-bindings/mfd/palmas.h +++ b/include/dt-bindings/mfd/palmas.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides macros for Palmas device bindings.   * diff --git a/include/dt-bindings/mfd/qcom-rpm.h b/include/dt-bindings/mfd/qcom-rpm.h index 54aef5e21763..c9204c4df520 100644 --- a/include/dt-bindings/mfd/qcom-rpm.h +++ b/include/dt-bindings/mfd/qcom-rpm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the Qualcomm RPM bindings.   */ diff --git a/include/dt-bindings/mfd/st-lpc.h b/include/dt-bindings/mfd/st-lpc.h index d05894afa7e7..88a7f56843bc 100644 --- a/include/dt-bindings/mfd/st-lpc.h +++ b/include/dt-bindings/mfd/st-lpc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides shared DT/Driver defines for ST's LPC device   * diff --git a/include/dt-bindings/mfd/stm32f4-rcc.h b/include/dt-bindings/mfd/stm32f4-rcc.h index 082a81c94298..309e8c79f27b 100644 --- a/include/dt-bindings/mfd/stm32f4-rcc.h +++ b/include/dt-bindings/mfd/stm32f4-rcc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the STM32F4 RCC IP   */ diff --git a/include/dt-bindings/mfd/stm32f7-rcc.h b/include/dt-bindings/mfd/stm32f7-rcc.h index e36cc69959c7..8b7b7197ffd7 100644 --- a/include/dt-bindings/mfd/stm32f7-rcc.h +++ b/include/dt-bindings/mfd/stm32f7-rcc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the STM32F7 RCC IP   */ diff --git a/include/dt-bindings/mux/mux.h b/include/dt-bindings/mux/mux.h index c8e855c4a609..042719218dbf 100644 --- a/include/dt-bindings/mux/mux.h +++ b/include/dt-bindings/mux/mux.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for most Multiplexer bindings.   * diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h index 6c901930eb3e..d16e8755f6a9 100644 --- a/include/dt-bindings/phy/phy.h +++ b/include/dt-bindings/phy/phy.h @@ -15,5 +15,6 @@  #define PHY_TYPE_PCIE		2  #define PHY_TYPE_USB2		3  #define PHY_TYPE_USB3		4 +#define PHY_TYPE_UFS		5  #endif /* _DT_BINDINGS_PHY */ diff --git a/include/dt-bindings/pinctrl/am33xx.h b/include/dt-bindings/pinctrl/am33xx.h index 226f77246a70..7d947a597220 100644 --- a/include/dt-bindings/pinctrl/am33xx.h +++ b/include/dt-bindings/pinctrl/am33xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants specific to AM33XX pinctrl bindings.   */ diff --git a/include/dt-bindings/pinctrl/am43xx.h b/include/dt-bindings/pinctrl/am43xx.h index 344bd1eb3386..a69e310789c5 100644 --- a/include/dt-bindings/pinctrl/am43xx.h +++ b/include/dt-bindings/pinctrl/am43xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants specific to AM43XX pinctrl bindings.   */ @@ -21,9 +22,21 @@  #define INPUT_EN		(1 << 18)  #define SLEWCTRL_SLOW		(1 << 19)  #define SLEWCTRL_FAST		0 +#define DS0_FORCE_OFF_MODE	(1 << 24) +#define DS0_INPUT		(1 << 25) +#define DS0_FORCE_OUT_HIGH	(1 << 26)  #define DS0_PULL_UP_DOWN_EN	(1 << 27) +#define DS0_PULL_UP_SEL		(1 << 28)  #define WAKEUP_ENABLE		(1 << 29) +#define DS0_PIN_OUTPUT		(DS0_FORCE_OFF_MODE) +#define DS0_PIN_OUTPUT_HIGH	(DS0_FORCE_OFF_MODE | DS0_FORCE_OUT_HIGH) +#define DS0_PIN_OUTPUT_PULLUP	(DS0_FORCE_OFF_MODE | DS0_PULL_UP_DOWN_EN | DS0_PULL_UP_SEL) +#define DS0_PIN_OUTPUT_PULLDOWN	(DS0_FORCE_OFF_MODE | DS0_PULL_UP_DOWN_EN) +#define DS0_PIN_INPUT		(DS0_FORCE_OFF_MODE | DS0_INPUT) +#define DS0_PIN_INPUT_PULLUP	(DS0_FORCE_OFF_MODE | DS0_INPUT | DS0_PULL_UP_DOWN_EN | DS0_PULL_UP_SEL) +#define DS0_PIN_INPUT_PULLDOWN	(DS0_FORCE_OFF_MODE | DS0_INPUT | DS0_PULL_UP_DOWN_EN) +  #define PIN_OUTPUT		(PULL_DISABLE)  #define PIN_OUTPUT_PULLUP	(PULL_UP)  #define PIN_OUTPUT_PULLDOWN	0 diff --git a/include/dt-bindings/pinctrl/dm814x.h b/include/dt-bindings/pinctrl/dm814x.h index 0f484273da0d..afbabbc4ddbb 100644 --- a/include/dt-bindings/pinctrl/dm814x.h +++ b/include/dt-bindings/pinctrl/dm814x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants specific to DM814X pinctrl bindings.   */ diff --git a/include/dt-bindings/pinctrl/mt6397-pinfunc.h b/include/dt-bindings/pinctrl/mt6397-pinfunc.h index 85739b308c2f..f393fbd68905 100644 --- a/include/dt-bindings/pinctrl/mt6397-pinfunc.h +++ b/include/dt-bindings/pinctrl/mt6397-pinfunc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DTS_MT6397_PINFUNC_H  #define __DTS_MT6397_PINFUNC_H diff --git a/include/dt-bindings/pinctrl/mt7623-pinfunc.h b/include/dt-bindings/pinctrl/mt7623-pinfunc.h index 436a87be864a..2d6a7b1d7be2 100644 --- a/include/dt-bindings/pinctrl/mt7623-pinfunc.h +++ b/include/dt-bindings/pinctrl/mt7623-pinfunc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DTS_MT7623_PINFUNC_H  #define __DTS_MT7623_PINFUNC_H diff --git a/include/dt-bindings/pinctrl/omap.h b/include/dt-bindings/pinctrl/omap.h index fbd6f7202476..49b5dea2b388 100644 --- a/include/dt-bindings/pinctrl/omap.h +++ b/include/dt-bindings/pinctrl/omap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for OMAP pinctrl bindings.   * diff --git a/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h b/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h index 914d56da9324..ac63c399b4b6 100644 --- a/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h +++ b/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H  #define _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H 1 diff --git a/include/dt-bindings/pinctrl/qcom,pmic-gpio.h b/include/dt-bindings/pinctrl/qcom,pmic-gpio.h index b8ff8824e21b..e5df5ce45a0f 100644 --- a/include/dt-bindings/pinctrl/qcom,pmic-gpio.h +++ b/include/dt-bindings/pinctrl/qcom,pmic-gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the Qualcomm PMIC GPIO binding.   */ diff --git a/include/dt-bindings/pinctrl/qcom,pmic-mpp.h b/include/dt-bindings/pinctrl/qcom,pmic-mpp.h index 2e360d8f7801..32e66ee7e830 100644 --- a/include/dt-bindings/pinctrl/qcom,pmic-mpp.h +++ b/include/dt-bindings/pinctrl/qcom,pmic-mpp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the Qualcomm PMIC's   * Multi-Purpose Pin binding. diff --git a/include/dt-bindings/pinctrl/r7s72100-pinctrl.h b/include/dt-bindings/pinctrl/r7s72100-pinctrl.h index 6b609fe10910..cdb950246880 100644 --- a/include/dt-bindings/pinctrl/r7s72100-pinctrl.h +++ b/include/dt-bindings/pinctrl/r7s72100-pinctrl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Defines macros and constants for Renesas RZ/A1 pin controller pin   * muxing functions. diff --git a/include/dt-bindings/pinctrl/stm32-pinfunc.h b/include/dt-bindings/pinctrl/stm32-pinfunc.h new file mode 100644 index 000000000000..b8dfe31821e6 --- /dev/null +++ b/include/dt-bindings/pinctrl/stm32-pinfunc.h @@ -0,0 +1,30 @@ +#ifndef _DT_BINDINGS_STM32_PINFUNC_H +#define _DT_BINDINGS_STM32_PINFUNC_H + +/*  define PIN modes */ +#define GPIO	0x0 +#define AF0	0x1 +#define AF1	0x2 +#define AF2	0x3 +#define AF3	0x4 +#define AF4	0x5 +#define AF5	0x6 +#define AF6	0x7 +#define AF7	0x8 +#define AF8	0x9 +#define AF9	0xa +#define AF10	0xb +#define AF11	0xc +#define AF12	0xd +#define AF13	0xe +#define AF14	0xf +#define AF15	0x10 +#define ANALOG	0x11 + +/* define Pins number*/ +#define PIN_NO(port, line)	(((port) - 'A') * 0x10 + (line)) + +#define STM32_PINMUX(port, line, mode) (((PIN_NO(port, line)) << 8) | (mode)) + +#endif /* _DT_BINDINGS_STM32_PINFUNC_H */ + diff --git a/include/dt-bindings/pinctrl/stm32f429-pinfunc.h b/include/dt-bindings/pinctrl/stm32f429-pinfunc.h deleted file mode 100644 index 26f18798d949..000000000000 --- a/include/dt-bindings/pinctrl/stm32f429-pinfunc.h +++ /dev/null @@ -1,1239 +0,0 @@ -#ifndef _DT_BINDINGS_STM32F429_PINFUNC_H -#define _DT_BINDINGS_STM32F429_PINFUNC_H - -#define STM32F429_PA0_FUNC_GPIO 0x0 -#define STM32F429_PA0_FUNC_TIM2_CH1_TIM2_ETR 0x2 -#define STM32F429_PA0_FUNC_TIM5_CH1 0x3 -#define STM32F429_PA0_FUNC_TIM8_ETR 0x4 -#define STM32F429_PA0_FUNC_USART2_CTS 0x8 -#define STM32F429_PA0_FUNC_UART4_TX 0x9 -#define STM32F429_PA0_FUNC_ETH_MII_CRS 0xc -#define STM32F429_PA0_FUNC_EVENTOUT 0x10 -#define STM32F429_PA0_FUNC_ANALOG 0x11 - -#define STM32F429_PA1_FUNC_GPIO 0x100 -#define STM32F429_PA1_FUNC_TIM2_CH2 0x102 -#define STM32F429_PA1_FUNC_TIM5_CH2 0x103 -#define STM32F429_PA1_FUNC_USART2_RTS 0x108 -#define STM32F429_PA1_FUNC_UART4_RX 0x109 -#define STM32F429_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK 0x10c -#define STM32F429_PA1_FUNC_EVENTOUT 0x110 -#define STM32F429_PA1_FUNC_ANALOG 0x111 - -#define STM32F429_PA2_FUNC_GPIO 0x200 -#define STM32F429_PA2_FUNC_TIM2_CH3 0x202 -#define STM32F429_PA2_FUNC_TIM5_CH3 0x203 -#define STM32F429_PA2_FUNC_TIM9_CH1 0x204 -#define STM32F429_PA2_FUNC_USART2_TX 0x208 -#define STM32F429_PA2_FUNC_ETH_MDIO 0x20c -#define STM32F429_PA2_FUNC_EVENTOUT 0x210 -#define STM32F429_PA2_FUNC_ANALOG 0x211 - -#define STM32F429_PA3_FUNC_GPIO 0x300 -#define STM32F429_PA3_FUNC_TIM2_CH4 0x302 -#define STM32F429_PA3_FUNC_TIM5_CH4 0x303 -#define STM32F429_PA3_FUNC_TIM9_CH2 0x304 -#define STM32F429_PA3_FUNC_USART2_RX 0x308 -#define STM32F429_PA3_FUNC_OTG_HS_ULPI_D0 0x30b -#define STM32F429_PA3_FUNC_ETH_MII_COL 0x30c -#define STM32F429_PA3_FUNC_LCD_B5 0x30f -#define STM32F429_PA3_FUNC_EVENTOUT 0x310 -#define STM32F429_PA3_FUNC_ANALOG 0x311 - -#define STM32F429_PA4_FUNC_GPIO 0x400 -#define STM32F429_PA4_FUNC_SPI1_NSS 0x406 -#define STM32F429_PA4_FUNC_SPI3_NSS_I2S3_WS 0x407 -#define STM32F429_PA4_FUNC_USART2_CK 0x408 -#define STM32F429_PA4_FUNC_OTG_HS_SOF 0x40d -#define STM32F429_PA4_FUNC_DCMI_HSYNC 0x40e -#define STM32F429_PA4_FUNC_LCD_VSYNC 0x40f -#define STM32F429_PA4_FUNC_EVENTOUT 0x410 -#define STM32F429_PA4_FUNC_ANALOG 0x411 - -#define STM32F429_PA5_FUNC_GPIO 0x500 -#define STM32F429_PA5_FUNC_TIM2_CH1_TIM2_ETR 0x502 -#define STM32F429_PA5_FUNC_TIM8_CH1N 0x504 -#define STM32F429_PA5_FUNC_SPI1_SCK 0x506 -#define STM32F429_PA5_FUNC_OTG_HS_ULPI_CK 0x50b -#define STM32F429_PA5_FUNC_EVENTOUT 0x510 -#define STM32F429_PA5_FUNC_ANALOG 0x511 - -#define STM32F429_PA6_FUNC_GPIO 0x600 -#define STM32F429_PA6_FUNC_TIM1_BKIN 0x602 -#define STM32F429_PA6_FUNC_TIM3_CH1 0x603 -#define STM32F429_PA6_FUNC_TIM8_BKIN 0x604 -#define STM32F429_PA6_FUNC_SPI1_MISO 0x606 -#define STM32F429_PA6_FUNC_TIM13_CH1 0x60a -#define STM32F429_PA6_FUNC_DCMI_PIXCLK 0x60e -#define STM32F429_PA6_FUNC_LCD_G2 0x60f -#define STM32F429_PA6_FUNC_EVENTOUT 0x610 -#define STM32F429_PA6_FUNC_ANALOG 0x611 - -#define STM32F429_PA7_FUNC_GPIO 0x700 -#define STM32F429_PA7_FUNC_TIM1_CH1N 0x702 -#define STM32F429_PA7_FUNC_TIM3_CH2 0x703 -#define STM32F429_PA7_FUNC_TIM8_CH1N 0x704 -#define STM32F429_PA7_FUNC_SPI1_MOSI 0x706 -#define STM32F429_PA7_FUNC_TIM14_CH1 0x70a -#define STM32F429_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV 0x70c -#define STM32F429_PA7_FUNC_EVENTOUT 0x710 -#define STM32F429_PA7_FUNC_ANALOG 0x711 - -#define STM32F429_PA8_FUNC_GPIO 0x800 -#define STM32F429_PA8_FUNC_MCO1 0x801 -#define STM32F429_PA8_FUNC_TIM1_CH1 0x802 -#define STM32F429_PA8_FUNC_I2C3_SCL 0x805 -#define STM32F429_PA8_FUNC_USART1_CK 0x808 -#define STM32F429_PA8_FUNC_OTG_FS_SOF 0x80b -#define STM32F429_PA8_FUNC_LCD_R6 0x80f -#define STM32F429_PA8_FUNC_EVENTOUT 0x810 -#define STM32F429_PA8_FUNC_ANALOG 0x811 - -#define STM32F429_PA9_FUNC_GPIO 0x900 -#define STM32F429_PA9_FUNC_TIM1_CH2 0x902 -#define STM32F429_PA9_FUNC_I2C3_SMBA 0x905 -#define STM32F429_PA9_FUNC_USART1_TX 0x908 -#define STM32F429_PA9_FUNC_DCMI_D0 0x90e -#define STM32F429_PA9_FUNC_EVENTOUT 0x910 -#define STM32F429_PA9_FUNC_ANALOG 0x911 - -#define STM32F429_PA10_FUNC_GPIO 0xa00 -#define STM32F429_PA10_FUNC_TIM1_CH3 0xa02 -#define STM32F429_PA10_FUNC_USART1_RX 0xa08 -#define STM32F429_PA10_FUNC_OTG_FS_ID 0xa0b -#define STM32F429_PA10_FUNC_DCMI_D1 0xa0e -#define STM32F429_PA10_FUNC_EVENTOUT 0xa10 -#define STM32F429_PA10_FUNC_ANALOG 0xa11 - -#define STM32F429_PA11_FUNC_GPIO 0xb00 -#define STM32F429_PA11_FUNC_TIM1_CH4 0xb02 -#define STM32F429_PA11_FUNC_USART1_CTS 0xb08 -#define STM32F429_PA11_FUNC_CAN1_RX 0xb0a -#define STM32F429_PA11_FUNC_OTG_FS_DM 0xb0b -#define STM32F429_PA11_FUNC_LCD_R4 0xb0f -#define STM32F429_PA11_FUNC_EVENTOUT 0xb10 -#define STM32F429_PA11_FUNC_ANALOG 0xb11 - -#define STM32F429_PA12_FUNC_GPIO 0xc00 -#define STM32F429_PA12_FUNC_TIM1_ETR 0xc02 -#define STM32F429_PA12_FUNC_USART1_RTS 0xc08 -#define STM32F429_PA12_FUNC_CAN1_TX 0xc0a -#define STM32F429_PA12_FUNC_OTG_FS_DP 0xc0b -#define STM32F429_PA12_FUNC_LCD_R5 0xc0f -#define STM32F429_PA12_FUNC_EVENTOUT 0xc10 -#define STM32F429_PA12_FUNC_ANALOG 0xc11 - -#define STM32F429_PA13_FUNC_GPIO 0xd00 -#define STM32F429_PA13_FUNC_JTMS_SWDIO 0xd01 -#define STM32F429_PA13_FUNC_EVENTOUT 0xd10 -#define STM32F429_PA13_FUNC_ANALOG 0xd11 - -#define STM32F429_PA14_FUNC_GPIO 0xe00 -#define STM32F429_PA14_FUNC_JTCK_SWCLK 0xe01 -#define STM32F429_PA14_FUNC_EVENTOUT 0xe10 -#define STM32F429_PA14_FUNC_ANALOG 0xe11 - -#define STM32F429_PA15_FUNC_GPIO 0xf00 -#define STM32F429_PA15_FUNC_JTDI 0xf01 -#define STM32F429_PA15_FUNC_TIM2_CH1_TIM2_ETR 0xf02 -#define STM32F429_PA15_FUNC_SPI1_NSS 0xf06 -#define STM32F429_PA15_FUNC_SPI3_NSS_I2S3_WS 0xf07 -#define STM32F429_PA15_FUNC_EVENTOUT 0xf10 -#define STM32F429_PA15_FUNC_ANALOG 0xf11 - - - -#define STM32F429_PB0_FUNC_GPIO 0x1000 -#define STM32F429_PB0_FUNC_TIM1_CH2N 0x1002 -#define STM32F429_PB0_FUNC_TIM3_CH3 0x1003 -#define STM32F429_PB0_FUNC_TIM8_CH2N 0x1004 -#define STM32F429_PB0_FUNC_LCD_R3 0x100a -#define STM32F429_PB0_FUNC_OTG_HS_ULPI_D1 0x100b -#define STM32F429_PB0_FUNC_ETH_MII_RXD2 0x100c -#define STM32F429_PB0_FUNC_EVENTOUT 0x1010 -#define STM32F429_PB0_FUNC_ANALOG 0x1011 - -#define STM32F429_PB1_FUNC_GPIO 0x1100 -#define STM32F429_PB1_FUNC_TIM1_CH3N 0x1102 -#define STM32F429_PB1_FUNC_TIM3_CH4 0x1103 -#define STM32F429_PB1_FUNC_TIM8_CH3N 0x1104 -#define STM32F429_PB1_FUNC_LCD_R6 0x110a -#define STM32F429_PB1_FUNC_OTG_HS_ULPI_D2 0x110b -#define STM32F429_PB1_FUNC_ETH_MII_RXD3 0x110c -#define STM32F429_PB1_FUNC_EVENTOUT 0x1110 -#define STM32F429_PB1_FUNC_ANALOG 0x1111 - -#define STM32F429_PB2_FUNC_GPIO 0x1200 -#define STM32F429_PB2_FUNC_EVENTOUT 0x1210 -#define STM32F429_PB2_FUNC_ANALOG 0x1211 - -#define STM32F429_PB3_FUNC_GPIO 0x1300 -#define STM32F429_PB3_FUNC_JTDO_TRACESWO 0x1301 -#define STM32F429_PB3_FUNC_TIM2_CH2 0x1302 -#define STM32F429_PB3_FUNC_SPI1_SCK 0x1306 -#define STM32F429_PB3_FUNC_SPI3_SCK_I2S3_CK 0x1307 -#define STM32F429_PB3_FUNC_EVENTOUT 0x1310 -#define STM32F429_PB3_FUNC_ANALOG 0x1311 - -#define STM32F429_PB4_FUNC_GPIO 0x1400 -#define STM32F429_PB4_FUNC_NJTRST 0x1401 -#define STM32F429_PB4_FUNC_TIM3_CH1 0x1403 -#define STM32F429_PB4_FUNC_SPI1_MISO 0x1406 -#define STM32F429_PB4_FUNC_SPI3_MISO 0x1407 -#define STM32F429_PB4_FUNC_I2S3EXT_SD 0x1408 -#define STM32F429_PB4_FUNC_EVENTOUT 0x1410 -#define STM32F429_PB4_FUNC_ANALOG 0x1411 - -#define STM32F429_PB5_FUNC_GPIO 0x1500 -#define STM32F429_PB5_FUNC_TIM3_CH2 0x1503 -#define STM32F429_PB5_FUNC_I2C1_SMBA 0x1505 -#define STM32F429_PB5_FUNC_SPI1_MOSI 0x1506 -#define STM32F429_PB5_FUNC_SPI3_MOSI_I2S3_SD 0x1507 -#define STM32F429_PB5_FUNC_CAN2_RX 0x150a -#define STM32F429_PB5_FUNC_OTG_HS_ULPI_D7 0x150b -#define STM32F429_PB5_FUNC_ETH_PPS_OUT 0x150c -#define STM32F429_PB5_FUNC_FMC_SDCKE1 0x150d -#define STM32F429_PB5_FUNC_DCMI_D10 0x150e -#define STM32F429_PB5_FUNC_EVENTOUT 0x1510 -#define STM32F429_PB5_FUNC_ANALOG 0x1511 - -#define STM32F429_PB6_FUNC_GPIO 0x1600 -#define STM32F429_PB6_FUNC_TIM4_CH1 0x1603 -#define STM32F429_PB6_FUNC_I2C1_SCL 0x1605 -#define STM32F429_PB6_FUNC_USART1_TX 0x1608 -#define STM32F429_PB6_FUNC_CAN2_TX 0x160a -#define STM32F429_PB6_FUNC_FMC_SDNE1 0x160d -#define STM32F429_PB6_FUNC_DCMI_D5 0x160e -#define STM32F429_PB6_FUNC_EVENTOUT 0x1610 -#define STM32F429_PB6_FUNC_ANALOG 0x1611 - -#define STM32F429_PB7_FUNC_GPIO 0x1700 -#define STM32F429_PB7_FUNC_TIM4_CH2 0x1703 -#define STM32F429_PB7_FUNC_I2C1_SDA 0x1705 -#define STM32F429_PB7_FUNC_USART1_RX 0x1708 -#define STM32F429_PB7_FUNC_FMC_NL 0x170d -#define STM32F429_PB7_FUNC_DCMI_VSYNC 0x170e -#define STM32F429_PB7_FUNC_EVENTOUT 0x1710 -#define STM32F429_PB7_FUNC_ANALOG 0x1711 - -#define STM32F429_PB8_FUNC_GPIO 0x1800 -#define STM32F429_PB8_FUNC_TIM4_CH3 0x1803 -#define STM32F429_PB8_FUNC_TIM10_CH1 0x1804 -#define STM32F429_PB8_FUNC_I2C1_SCL 0x1805 -#define STM32F429_PB8_FUNC_CAN1_RX 0x180a -#define STM32F429_PB8_FUNC_ETH_MII_TXD3 0x180c -#define STM32F429_PB8_FUNC_SDIO_D4 0x180d -#define STM32F429_PB8_FUNC_DCMI_D6 0x180e -#define STM32F429_PB8_FUNC_LCD_B6 0x180f -#define STM32F429_PB8_FUNC_EVENTOUT 0x1810 -#define STM32F429_PB8_FUNC_ANALOG 0x1811 - -#define STM32F429_PB9_FUNC_GPIO 0x1900 -#define STM32F429_PB9_FUNC_TIM4_CH4 0x1903 -#define STM32F429_PB9_FUNC_TIM11_CH1 0x1904 -#define STM32F429_PB9_FUNC_I2C1_SDA 0x1905 -#define STM32F429_PB9_FUNC_SPI2_NSS_I2S2_WS 0x1906 -#define STM32F429_PB9_FUNC_CAN1_TX 0x190a -#define STM32F429_PB9_FUNC_SDIO_D5 0x190d -#define STM32F429_PB9_FUNC_DCMI_D7 0x190e -#define STM32F429_PB9_FUNC_LCD_B7 0x190f -#define STM32F429_PB9_FUNC_EVENTOUT 0x1910 -#define STM32F429_PB9_FUNC_ANALOG 0x1911 - -#define STM32F429_PB10_FUNC_GPIO 0x1a00 -#define STM32F429_PB10_FUNC_TIM2_CH3 0x1a02 -#define STM32F429_PB10_FUNC_I2C2_SCL 0x1a05 -#define STM32F429_PB10_FUNC_SPI2_SCK_I2S2_CK 0x1a06 -#define STM32F429_PB10_FUNC_USART3_TX 0x1a08 -#define STM32F429_PB10_FUNC_OTG_HS_ULPI_D3 0x1a0b -#define STM32F429_PB10_FUNC_ETH_MII_RX_ER 0x1a0c -#define STM32F429_PB10_FUNC_LCD_G4 0x1a0f -#define STM32F429_PB10_FUNC_EVENTOUT 0x1a10 -#define STM32F429_PB10_FUNC_ANALOG 0x1a11 - -#define STM32F429_PB11_FUNC_GPIO 0x1b00 -#define STM32F429_PB11_FUNC_TIM2_CH4 0x1b02 -#define STM32F429_PB11_FUNC_I2C2_SDA 0x1b05 -#define STM32F429_PB11_FUNC_USART3_RX 0x1b08 -#define STM32F429_PB11_FUNC_OTG_HS_ULPI_D4 0x1b0b -#define STM32F429_PB11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x1b0c -#define STM32F429_PB11_FUNC_LCD_G5 0x1b0f -#define STM32F429_PB11_FUNC_EVENTOUT 0x1b10 -#define STM32F429_PB11_FUNC_ANALOG 0x1b11 - -#define STM32F429_PB12_FUNC_GPIO 0x1c00 -#define STM32F429_PB12_FUNC_TIM1_BKIN 0x1c02 -#define STM32F429_PB12_FUNC_I2C2_SMBA 0x1c05 -#define STM32F429_PB12_FUNC_SPI2_NSS_I2S2_WS 0x1c06 -#define STM32F429_PB12_FUNC_USART3_CK 0x1c08 -#define STM32F429_PB12_FUNC_CAN2_RX 0x1c0a -#define STM32F429_PB12_FUNC_OTG_HS_ULPI_D5 0x1c0b -#define STM32F429_PB12_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x1c0c -#define STM32F429_PB12_FUNC_OTG_HS_ID 0x1c0d -#define STM32F429_PB12_FUNC_EVENTOUT 0x1c10 -#define STM32F429_PB12_FUNC_ANALOG 0x1c11 - -#define STM32F429_PB13_FUNC_GPIO 0x1d00 -#define STM32F429_PB13_FUNC_TIM1_CH1N 0x1d02 -#define STM32F429_PB13_FUNC_SPI2_SCK_I2S2_CK 0x1d06 -#define STM32F429_PB13_FUNC_USART3_CTS 0x1d08 -#define STM32F429_PB13_FUNC_CAN2_TX 0x1d0a -#define STM32F429_PB13_FUNC_OTG_HS_ULPI_D6 0x1d0b -#define STM32F429_PB13_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x1d0c -#define STM32F429_PB13_FUNC_EVENTOUT 0x1d10 -#define STM32F429_PB13_FUNC_ANALOG 0x1d11 - -#define STM32F429_PB14_FUNC_GPIO 0x1e00 -#define STM32F429_PB14_FUNC_TIM1_CH2N 0x1e02 -#define STM32F429_PB14_FUNC_TIM8_CH2N 0x1e04 -#define STM32F429_PB14_FUNC_SPI2_MISO 0x1e06 -#define STM32F429_PB14_FUNC_I2S2EXT_SD 0x1e07 -#define STM32F429_PB14_FUNC_USART3_RTS 0x1e08 -#define STM32F429_PB14_FUNC_TIM12_CH1 0x1e0a -#define STM32F429_PB14_FUNC_OTG_HS_DM 0x1e0d -#define STM32F429_PB14_FUNC_EVENTOUT 0x1e10 -#define STM32F429_PB14_FUNC_ANALOG 0x1e11 - -#define STM32F429_PB15_FUNC_GPIO 0x1f00 -#define STM32F429_PB15_FUNC_RTC_REFIN 0x1f01 -#define STM32F429_PB15_FUNC_TIM1_CH3N 0x1f02 -#define STM32F429_PB15_FUNC_TIM8_CH3N 0x1f04 -#define STM32F429_PB15_FUNC_SPI2_MOSI_I2S2_SD 0x1f06 -#define STM32F429_PB15_FUNC_TIM12_CH2 0x1f0a -#define STM32F429_PB15_FUNC_OTG_HS_DP 0x1f0d -#define STM32F429_PB15_FUNC_EVENTOUT 0x1f10 -#define STM32F429_PB15_FUNC_ANALOG 0x1f11 - - - -#define STM32F429_PC0_FUNC_GPIO 0x2000 -#define STM32F429_PC0_FUNC_OTG_HS_ULPI_STP 0x200b -#define STM32F429_PC0_FUNC_FMC_SDNWE 0x200d -#define STM32F429_PC0_FUNC_EVENTOUT 0x2010 -#define STM32F429_PC0_FUNC_ANALOG 0x2011 - -#define STM32F429_PC1_FUNC_GPIO 0x2100 -#define STM32F429_PC1_FUNC_ETH_MDC 0x210c -#define STM32F429_PC1_FUNC_EVENTOUT 0x2110 -#define STM32F429_PC1_FUNC_ANALOG 0x2111 - -#define STM32F429_PC2_FUNC_GPIO 0x2200 -#define STM32F429_PC2_FUNC_SPI2_MISO 0x2206 -#define STM32F429_PC2_FUNC_I2S2EXT_SD 0x2207 -#define STM32F429_PC2_FUNC_OTG_HS_ULPI_DIR 0x220b -#define STM32F429_PC2_FUNC_ETH_MII_TXD2 0x220c -#define STM32F429_PC2_FUNC_FMC_SDNE0 0x220d -#define STM32F429_PC2_FUNC_EVENTOUT 0x2210 -#define STM32F429_PC2_FUNC_ANALOG 0x2211 - -#define STM32F429_PC3_FUNC_GPIO 0x2300 -#define STM32F429_PC3_FUNC_SPI2_MOSI_I2S2_SD 0x2306 -#define STM32F429_PC3_FUNC_OTG_HS_ULPI_NXT 0x230b -#define STM32F429_PC3_FUNC_ETH_MII_TX_CLK 0x230c -#define STM32F429_PC3_FUNC_FMC_SDCKE0 0x230d -#define STM32F429_PC3_FUNC_EVENTOUT 0x2310 -#define STM32F429_PC3_FUNC_ANALOG 0x2311 - -#define STM32F429_PC4_FUNC_GPIO 0x2400 -#define STM32F429_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0 0x240c -#define STM32F429_PC4_FUNC_EVENTOUT 0x2410 -#define STM32F429_PC4_FUNC_ANALOG 0x2411 - -#define STM32F429_PC5_FUNC_GPIO 0x2500 -#define STM32F429_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1 0x250c -#define STM32F429_PC5_FUNC_EVENTOUT 0x2510 -#define STM32F429_PC5_FUNC_ANALOG 0x2511 - -#define STM32F429_PC6_FUNC_GPIO 0x2600 -#define STM32F429_PC6_FUNC_TIM3_CH1 0x2603 -#define STM32F429_PC6_FUNC_TIM8_CH1 0x2604 -#define STM32F429_PC6_FUNC_I2S2_MCK 0x2606 -#define STM32F429_PC6_FUNC_USART6_TX 0x2609 -#define STM32F429_PC6_FUNC_SDIO_D6 0x260d -#define STM32F429_PC6_FUNC_DCMI_D0 0x260e -#define STM32F429_PC6_FUNC_LCD_HSYNC 0x260f -#define STM32F429_PC6_FUNC_EVENTOUT 0x2610 -#define STM32F429_PC6_FUNC_ANALOG 0x2611 - -#define STM32F429_PC7_FUNC_GPIO 0x2700 -#define STM32F429_PC7_FUNC_TIM3_CH2 0x2703 -#define STM32F429_PC7_FUNC_TIM8_CH2 0x2704 -#define STM32F429_PC7_FUNC_I2S3_MCK 0x2707 -#define STM32F429_PC7_FUNC_USART6_RX 0x2709 -#define STM32F429_PC7_FUNC_SDIO_D7 0x270d -#define STM32F429_PC7_FUNC_DCMI_D1 0x270e -#define STM32F429_PC7_FUNC_LCD_G6 0x270f -#define STM32F429_PC7_FUNC_EVENTOUT 0x2710 -#define STM32F429_PC7_FUNC_ANALOG 0x2711 - -#define STM32F429_PC8_FUNC_GPIO 0x2800 -#define STM32F429_PC8_FUNC_TIM3_CH3 0x2803 -#define STM32F429_PC8_FUNC_TIM8_CH3 0x2804 -#define STM32F429_PC8_FUNC_USART6_CK 0x2809 -#define STM32F429_PC8_FUNC_SDIO_D0 0x280d -#define STM32F429_PC8_FUNC_DCMI_D2 0x280e -#define STM32F429_PC8_FUNC_EVENTOUT 0x2810 -#define STM32F429_PC8_FUNC_ANALOG 0x2811 - -#define STM32F429_PC9_FUNC_GPIO 0x2900 -#define STM32F429_PC9_FUNC_MCO2 0x2901 -#define STM32F429_PC9_FUNC_TIM3_CH4 0x2903 -#define STM32F429_PC9_FUNC_TIM8_CH4 0x2904 -#define STM32F429_PC9_FUNC_I2C3_SDA 0x2905 -#define STM32F429_PC9_FUNC_I2S_CKIN 0x2906 -#define STM32F429_PC9_FUNC_SDIO_D1 0x290d -#define STM32F429_PC9_FUNC_DCMI_D3 0x290e -#define STM32F429_PC9_FUNC_EVENTOUT 0x2910 -#define STM32F429_PC9_FUNC_ANALOG 0x2911 - -#define STM32F429_PC10_FUNC_GPIO 0x2a00 -#define STM32F429_PC10_FUNC_SPI3_SCK_I2S3_CK 0x2a07 -#define STM32F429_PC10_FUNC_USART3_TX 0x2a08 -#define STM32F429_PC10_FUNC_UART4_TX 0x2a09 -#define STM32F429_PC10_FUNC_SDIO_D2 0x2a0d -#define STM32F429_PC10_FUNC_DCMI_D8 0x2a0e -#define STM32F429_PC10_FUNC_LCD_R2 0x2a0f -#define STM32F429_PC10_FUNC_EVENTOUT 0x2a10 -#define STM32F429_PC10_FUNC_ANALOG 0x2a11 - -#define STM32F429_PC11_FUNC_GPIO 0x2b00 -#define STM32F429_PC11_FUNC_I2S3EXT_SD 0x2b06 -#define STM32F429_PC11_FUNC_SPI3_MISO 0x2b07 -#define STM32F429_PC11_FUNC_USART3_RX 0x2b08 -#define STM32F429_PC11_FUNC_UART4_RX 0x2b09 -#define STM32F429_PC11_FUNC_SDIO_D3 0x2b0d -#define STM32F429_PC11_FUNC_DCMI_D4 0x2b0e -#define STM32F429_PC11_FUNC_EVENTOUT 0x2b10 -#define STM32F429_PC11_FUNC_ANALOG 0x2b11 - -#define STM32F429_PC12_FUNC_GPIO 0x2c00 -#define STM32F429_PC12_FUNC_SPI3_MOSI_I2S3_SD 0x2c07 -#define STM32F429_PC12_FUNC_USART3_CK 0x2c08 -#define STM32F429_PC12_FUNC_UART5_TX 0x2c09 -#define STM32F429_PC12_FUNC_SDIO_CK 0x2c0d -#define STM32F429_PC12_FUNC_DCMI_D9 0x2c0e -#define STM32F429_PC12_FUNC_EVENTOUT 0x2c10 -#define STM32F429_PC12_FUNC_ANALOG 0x2c11 - -#define STM32F429_PC13_FUNC_GPIO 0x2d00 -#define STM32F429_PC13_FUNC_EVENTOUT 0x2d10 -#define STM32F429_PC13_FUNC_ANALOG 0x2d11 - -#define STM32F429_PC14_FUNC_GPIO 0x2e00 -#define STM32F429_PC14_FUNC_EVENTOUT 0x2e10 -#define STM32F429_PC14_FUNC_ANALOG 0x2e11 - -#define STM32F429_PC15_FUNC_GPIO 0x2f00 -#define STM32F429_PC15_FUNC_EVENTOUT 0x2f10 -#define STM32F429_PC15_FUNC_ANALOG 0x2f11 - - - -#define STM32F429_PD0_FUNC_GPIO 0x3000 -#define STM32F429_PD0_FUNC_CAN1_RX 0x300a -#define STM32F429_PD0_FUNC_FMC_D2 0x300d -#define STM32F429_PD0_FUNC_EVENTOUT 0x3010 -#define STM32F429_PD0_FUNC_ANALOG 0x3011 - -#define STM32F429_PD1_FUNC_GPIO 0x3100 -#define STM32F429_PD1_FUNC_CAN1_TX 0x310a -#define STM32F429_PD1_FUNC_FMC_D3 0x310d -#define STM32F429_PD1_FUNC_EVENTOUT 0x3110 -#define STM32F429_PD1_FUNC_ANALOG 0x3111 - -#define STM32F429_PD2_FUNC_GPIO 0x3200 -#define STM32F429_PD2_FUNC_TIM3_ETR 0x3203 -#define STM32F429_PD2_FUNC_UART5_RX 0x3209 -#define STM32F429_PD2_FUNC_SDIO_CMD 0x320d -#define STM32F429_PD2_FUNC_DCMI_D11 0x320e -#define STM32F429_PD2_FUNC_EVENTOUT 0x3210 -#define STM32F429_PD2_FUNC_ANALOG 0x3211 - -#define STM32F429_PD3_FUNC_GPIO 0x3300 -#define STM32F429_PD3_FUNC_SPI2_SCK_I2S2_CK 0x3306 -#define STM32F429_PD3_FUNC_USART2_CTS 0x3308 -#define STM32F429_PD3_FUNC_FMC_CLK 0x330d -#define STM32F429_PD3_FUNC_DCMI_D5 0x330e -#define STM32F429_PD3_FUNC_LCD_G7 0x330f -#define STM32F429_PD3_FUNC_EVENTOUT 0x3310 -#define STM32F429_PD3_FUNC_ANALOG 0x3311 - -#define STM32F429_PD4_FUNC_GPIO 0x3400 -#define STM32F429_PD4_FUNC_USART2_RTS 0x3408 -#define STM32F429_PD4_FUNC_FMC_NOE 0x340d -#define STM32F429_PD4_FUNC_EVENTOUT 0x3410 -#define STM32F429_PD4_FUNC_ANALOG 0x3411 - -#define STM32F429_PD5_FUNC_GPIO 0x3500 -#define STM32F429_PD5_FUNC_USART2_TX 0x3508 -#define STM32F429_PD5_FUNC_FMC_NWE 0x350d -#define STM32F429_PD5_FUNC_EVENTOUT 0x3510 -#define STM32F429_PD5_FUNC_ANALOG 0x3511 - -#define STM32F429_PD6_FUNC_GPIO 0x3600 -#define STM32F429_PD6_FUNC_SPI3_MOSI_I2S3_SD 0x3606 -#define STM32F429_PD6_FUNC_SAI1_SD_A 0x3607 -#define STM32F429_PD6_FUNC_USART2_RX 0x3608 -#define STM32F429_PD6_FUNC_FMC_NWAIT 0x360d -#define STM32F429_PD6_FUNC_DCMI_D10 0x360e -#define STM32F429_PD6_FUNC_LCD_B2 0x360f -#define STM32F429_PD6_FUNC_EVENTOUT 0x3610 -#define STM32F429_PD6_FUNC_ANALOG 0x3611 - -#define STM32F429_PD7_FUNC_GPIO 0x3700 -#define STM32F429_PD7_FUNC_USART2_CK 0x3708 -#define STM32F429_PD7_FUNC_FMC_NE1_FMC_NCE2 0x370d -#define STM32F429_PD7_FUNC_EVENTOUT 0x3710 -#define STM32F429_PD7_FUNC_ANALOG 0x3711 - -#define STM32F429_PD8_FUNC_GPIO 0x3800 -#define STM32F429_PD8_FUNC_USART3_TX 0x3808 -#define STM32F429_PD8_FUNC_FMC_D13 0x380d -#define STM32F429_PD8_FUNC_EVENTOUT 0x3810 -#define STM32F429_PD8_FUNC_ANALOG 0x3811 - -#define STM32F429_PD9_FUNC_GPIO 0x3900 -#define STM32F429_PD9_FUNC_USART3_RX 0x3908 -#define STM32F429_PD9_FUNC_FMC_D14 0x390d -#define STM32F429_PD9_FUNC_EVENTOUT 0x3910 -#define STM32F429_PD9_FUNC_ANALOG 0x3911 - -#define STM32F429_PD10_FUNC_GPIO 0x3a00 -#define STM32F429_PD10_FUNC_USART3_CK 0x3a08 -#define STM32F429_PD10_FUNC_FMC_D15 0x3a0d -#define STM32F429_PD10_FUNC_LCD_B3 0x3a0f -#define STM32F429_PD10_FUNC_EVENTOUT 0x3a10 -#define STM32F429_PD10_FUNC_ANALOG 0x3a11 - -#define STM32F429_PD11_FUNC_GPIO 0x3b00 -#define STM32F429_PD11_FUNC_USART3_CTS 0x3b08 -#define STM32F429_PD11_FUNC_FMC_A16 0x3b0d -#define STM32F429_PD11_FUNC_EVENTOUT 0x3b10 -#define STM32F429_PD11_FUNC_ANALOG 0x3b11 - -#define STM32F429_PD12_FUNC_GPIO 0x3c00 -#define STM32F429_PD12_FUNC_TIM4_CH1 0x3c03 -#define STM32F429_PD12_FUNC_USART3_RTS 0x3c08 -#define STM32F429_PD12_FUNC_FMC_A17 0x3c0d -#define STM32F429_PD12_FUNC_EVENTOUT 0x3c10 -#define STM32F429_PD12_FUNC_ANALOG 0x3c11 - -#define STM32F429_PD13_FUNC_GPIO 0x3d00 -#define STM32F429_PD13_FUNC_TIM4_CH2 0x3d03 -#define STM32F429_PD13_FUNC_FMC_A18 0x3d0d -#define STM32F429_PD13_FUNC_EVENTOUT 0x3d10 -#define STM32F429_PD13_FUNC_ANALOG 0x3d11 - -#define STM32F429_PD14_FUNC_GPIO 0x3e00 -#define STM32F429_PD14_FUNC_TIM4_CH3 0x3e03 -#define STM32F429_PD14_FUNC_FMC_D0 0x3e0d -#define STM32F429_PD14_FUNC_EVENTOUT 0x3e10 -#define STM32F429_PD14_FUNC_ANALOG 0x3e11 - -#define STM32F429_PD15_FUNC_GPIO 0x3f00 -#define STM32F429_PD15_FUNC_TIM4_CH4 0x3f03 -#define STM32F429_PD15_FUNC_FMC_D1 0x3f0d -#define STM32F429_PD15_FUNC_EVENTOUT 0x3f10 -#define STM32F429_PD15_FUNC_ANALOG 0x3f11 - - - -#define STM32F429_PE0_FUNC_GPIO 0x4000 -#define STM32F429_PE0_FUNC_TIM4_ETR 0x4003 -#define STM32F429_PE0_FUNC_UART8_RX 0x4009 -#define STM32F429_PE0_FUNC_FMC_NBL0 0x400d -#define STM32F429_PE0_FUNC_DCMI_D2 0x400e -#define STM32F429_PE0_FUNC_EVENTOUT 0x4010 -#define STM32F429_PE0_FUNC_ANALOG 0x4011 - -#define STM32F429_PE1_FUNC_GPIO 0x4100 -#define STM32F429_PE1_FUNC_UART8_TX 0x4109 -#define STM32F429_PE1_FUNC_FMC_NBL1 0x410d -#define STM32F429_PE1_FUNC_DCMI_D3 0x410e -#define STM32F429_PE1_FUNC_EVENTOUT 0x4110 -#define STM32F429_PE1_FUNC_ANALOG 0x4111 - -#define STM32F429_PE2_FUNC_GPIO 0x4200 -#define STM32F429_PE2_FUNC_TRACECLK 0x4201 -#define STM32F429_PE2_FUNC_SPI4_SCK 0x4206 -#define STM32F429_PE2_FUNC_SAI1_MCLK_A 0x4207 -#define STM32F429_PE2_FUNC_ETH_MII_TXD3 0x420c -#define STM32F429_PE2_FUNC_FMC_A23 0x420d -#define STM32F429_PE2_FUNC_EVENTOUT 0x4210 -#define STM32F429_PE2_FUNC_ANALOG 0x4211 - -#define STM32F429_PE3_FUNC_GPIO 0x4300 -#define STM32F429_PE3_FUNC_TRACED0 0x4301 -#define STM32F429_PE3_FUNC_SAI1_SD_B 0x4307 -#define STM32F429_PE3_FUNC_FMC_A19 0x430d -#define STM32F429_PE3_FUNC_EVENTOUT 0x4310 -#define STM32F429_PE3_FUNC_ANALOG 0x4311 - -#define STM32F429_PE4_FUNC_GPIO 0x4400 -#define STM32F429_PE4_FUNC_TRACED1 0x4401 -#define STM32F429_PE4_FUNC_SPI4_NSS 0x4406 -#define STM32F429_PE4_FUNC_SAI1_FS_A 0x4407 -#define STM32F429_PE4_FUNC_FMC_A20 0x440d -#define STM32F429_PE4_FUNC_DCMI_D4 0x440e -#define STM32F429_PE4_FUNC_LCD_B0 0x440f -#define STM32F429_PE4_FUNC_EVENTOUT 0x4410 -#define STM32F429_PE4_FUNC_ANALOG 0x4411 - -#define STM32F429_PE5_FUNC_GPIO 0x4500 -#define STM32F429_PE5_FUNC_TRACED2 0x4501 -#define STM32F429_PE5_FUNC_TIM9_CH1 0x4504 -#define STM32F429_PE5_FUNC_SPI4_MISO 0x4506 -#define STM32F429_PE5_FUNC_SAI1_SCK_A 0x4507 -#define STM32F429_PE5_FUNC_FMC_A21 0x450d -#define STM32F429_PE5_FUNC_DCMI_D6 0x450e -#define STM32F429_PE5_FUNC_LCD_G0 0x450f -#define STM32F429_PE5_FUNC_EVENTOUT 0x4510 -#define STM32F429_PE5_FUNC_ANALOG 0x4511 - -#define STM32F429_PE6_FUNC_GPIO 0x4600 -#define STM32F429_PE6_FUNC_TRACED3 0x4601 -#define STM32F429_PE6_FUNC_TIM9_CH2 0x4604 -#define STM32F429_PE6_FUNC_SPI4_MOSI 0x4606 -#define STM32F429_PE6_FUNC_SAI1_SD_A 0x4607 -#define STM32F429_PE6_FUNC_FMC_A22 0x460d -#define STM32F429_PE6_FUNC_DCMI_D7 0x460e -#define STM32F429_PE6_FUNC_LCD_G1 0x460f -#define STM32F429_PE6_FUNC_EVENTOUT 0x4610 -#define STM32F429_PE6_FUNC_ANALOG 0x4611 - -#define STM32F429_PE7_FUNC_GPIO 0x4700 -#define STM32F429_PE7_FUNC_TIM1_ETR 0x4702 -#define STM32F429_PE7_FUNC_UART7_RX 0x4709 -#define STM32F429_PE7_FUNC_FMC_D4 0x470d -#define STM32F429_PE7_FUNC_EVENTOUT 0x4710 -#define STM32F429_PE7_FUNC_ANALOG 0x4711 - -#define STM32F429_PE8_FUNC_GPIO 0x4800 -#define STM32F429_PE8_FUNC_TIM1_CH1N 0x4802 -#define STM32F429_PE8_FUNC_UART7_TX 0x4809 -#define STM32F429_PE8_FUNC_FMC_D5 0x480d -#define STM32F429_PE8_FUNC_EVENTOUT 0x4810 -#define STM32F429_PE8_FUNC_ANALOG 0x4811 - -#define STM32F429_PE9_FUNC_GPIO 0x4900 -#define STM32F429_PE9_FUNC_TIM1_CH1 0x4902 -#define STM32F429_PE9_FUNC_FMC_D6 0x490d -#define STM32F429_PE9_FUNC_EVENTOUT 0x4910 -#define STM32F429_PE9_FUNC_ANALOG 0x4911 - -#define STM32F429_PE10_FUNC_GPIO 0x4a00 -#define STM32F429_PE10_FUNC_TIM1_CH2N 0x4a02 -#define STM32F429_PE10_FUNC_FMC_D7 0x4a0d -#define STM32F429_PE10_FUNC_EVENTOUT 0x4a10 -#define STM32F429_PE10_FUNC_ANALOG 0x4a11 - -#define STM32F429_PE11_FUNC_GPIO 0x4b00 -#define STM32F429_PE11_FUNC_TIM1_CH2 0x4b02 -#define STM32F429_PE11_FUNC_SPI4_NSS 0x4b06 -#define STM32F429_PE11_FUNC_FMC_D8 0x4b0d -#define STM32F429_PE11_FUNC_LCD_G3 0x4b0f -#define STM32F429_PE11_FUNC_EVENTOUT 0x4b10 -#define STM32F429_PE11_FUNC_ANALOG 0x4b11 - -#define STM32F429_PE12_FUNC_GPIO 0x4c00 -#define STM32F429_PE12_FUNC_TIM1_CH3N 0x4c02 -#define STM32F429_PE12_FUNC_SPI4_SCK 0x4c06 -#define STM32F429_PE12_FUNC_FMC_D9 0x4c0d -#define STM32F429_PE12_FUNC_LCD_B4 0x4c0f -#define STM32F429_PE12_FUNC_EVENTOUT 0x4c10 -#define STM32F429_PE12_FUNC_ANALOG 0x4c11 - -#define STM32F429_PE13_FUNC_GPIO 0x4d00 -#define STM32F429_PE13_FUNC_TIM1_CH3 0x4d02 -#define STM32F429_PE13_FUNC_SPI4_MISO 0x4d06 -#define STM32F429_PE13_FUNC_FMC_D10 0x4d0d -#define STM32F429_PE13_FUNC_LCD_DE 0x4d0f -#define STM32F429_PE13_FUNC_EVENTOUT 0x4d10 -#define STM32F429_PE13_FUNC_ANALOG 0x4d11 - -#define STM32F429_PE14_FUNC_GPIO 0x4e00 -#define STM32F429_PE14_FUNC_TIM1_CH4 0x4e02 -#define STM32F429_PE14_FUNC_SPI4_MOSI 0x4e06 -#define STM32F429_PE14_FUNC_FMC_D11 0x4e0d -#define STM32F429_PE14_FUNC_LCD_CLK 0x4e0f -#define STM32F429_PE14_FUNC_EVENTOUT 0x4e10 -#define STM32F429_PE14_FUNC_ANALOG 0x4e11 - -#define STM32F429_PE15_FUNC_GPIO 0x4f00 -#define STM32F429_PE15_FUNC_TIM1_BKIN 0x4f02 -#define STM32F429_PE15_FUNC_FMC_D12 0x4f0d -#define STM32F429_PE15_FUNC_LCD_R7 0x4f0f -#define STM32F429_PE15_FUNC_EVENTOUT 0x4f10 -#define STM32F429_PE15_FUNC_ANALOG 0x4f11 - - - -#define STM32F429_PF0_FUNC_GPIO 0x5000 -#define STM32F429_PF0_FUNC_I2C2_SDA 0x5005 -#define STM32F429_PF0_FUNC_FMC_A0 0x500d -#define STM32F429_PF0_FUNC_EVENTOUT 0x5010 -#define STM32F429_PF0_FUNC_ANALOG 0x5011 - -#define STM32F429_PF1_FUNC_GPIO 0x5100 -#define STM32F429_PF1_FUNC_I2C2_SCL 0x5105 -#define STM32F429_PF1_FUNC_FMC_A1 0x510d -#define STM32F429_PF1_FUNC_EVENTOUT 0x5110 -#define STM32F429_PF1_FUNC_ANALOG 0x5111 - -#define STM32F429_PF2_FUNC_GPIO 0x5200 -#define STM32F429_PF2_FUNC_I2C2_SMBA 0x5205 -#define STM32F429_PF2_FUNC_FMC_A2 0x520d -#define STM32F429_PF2_FUNC_EVENTOUT 0x5210 -#define STM32F429_PF2_FUNC_ANALOG 0x5211 - -#define STM32F429_PF3_FUNC_GPIO 0x5300 -#define STM32F429_PF3_FUNC_FMC_A3 0x530d -#define STM32F429_PF3_FUNC_EVENTOUT 0x5310 -#define STM32F429_PF3_FUNC_ANALOG 0x5311 - -#define STM32F429_PF4_FUNC_GPIO 0x5400 -#define STM32F429_PF4_FUNC_FMC_A4 0x540d -#define STM32F429_PF4_FUNC_EVENTOUT 0x5410 -#define STM32F429_PF4_FUNC_ANALOG 0x5411 - -#define STM32F429_PF5_FUNC_GPIO 0x5500 -#define STM32F429_PF5_FUNC_FMC_A5 0x550d -#define STM32F429_PF5_FUNC_EVENTOUT 0x5510 -#define STM32F429_PF5_FUNC_ANALOG 0x5511 - -#define STM32F429_PF6_FUNC_GPIO 0x5600 -#define STM32F429_PF6_FUNC_TIM10_CH1 0x5604 -#define STM32F429_PF6_FUNC_SPI5_NSS 0x5606 -#define STM32F429_PF6_FUNC_SAI1_SD_B 0x5607 -#define STM32F429_PF6_FUNC_UART7_RX 0x5609 -#define STM32F429_PF6_FUNC_FMC_NIORD 0x560d -#define STM32F429_PF6_FUNC_EVENTOUT 0x5610 -#define STM32F429_PF6_FUNC_ANALOG 0x5611 - -#define STM32F429_PF7_FUNC_GPIO 0x5700 -#define STM32F429_PF7_FUNC_TIM11_CH1 0x5704 -#define STM32F429_PF7_FUNC_SPI5_SCK 0x5706 -#define STM32F429_PF7_FUNC_SAI1_MCLK_B 0x5707 -#define STM32F429_PF7_FUNC_UART7_TX 0x5709 -#define STM32F429_PF7_FUNC_FMC_NREG 0x570d -#define STM32F429_PF7_FUNC_EVENTOUT 0x5710 -#define STM32F429_PF7_FUNC_ANALOG 0x5711 - -#define STM32F429_PF8_FUNC_GPIO 0x5800 -#define STM32F429_PF8_FUNC_SPI5_MISO 0x5806 -#define STM32F429_PF8_FUNC_SAI1_SCK_B 0x5807 -#define STM32F429_PF8_FUNC_TIM13_CH1 0x580a -#define STM32F429_PF8_FUNC_FMC_NIOWR 0x580d -#define STM32F429_PF8_FUNC_EVENTOUT 0x5810 -#define STM32F429_PF8_FUNC_ANALOG 0x5811 - -#define STM32F429_PF9_FUNC_GPIO 0x5900 -#define STM32F429_PF9_FUNC_SPI5_MOSI 0x5906 -#define STM32F429_PF9_FUNC_SAI1_FS_B 0x5907 -#define STM32F429_PF9_FUNC_TIM14_CH1 0x590a -#define STM32F429_PF9_FUNC_FMC_CD 0x590d -#define STM32F429_PF9_FUNC_EVENTOUT 0x5910 -#define STM32F429_PF9_FUNC_ANALOG 0x5911 - -#define STM32F429_PF10_FUNC_GPIO 0x5a00 -#define STM32F429_PF10_FUNC_FMC_INTR 0x5a0d -#define STM32F429_PF10_FUNC_DCMI_D11 0x5a0e -#define STM32F429_PF10_FUNC_LCD_DE 0x5a0f -#define STM32F429_PF10_FUNC_EVENTOUT 0x5a10 -#define STM32F429_PF10_FUNC_ANALOG 0x5a11 - -#define STM32F429_PF11_FUNC_GPIO 0x5b00 -#define STM32F429_PF11_FUNC_SPI5_MOSI 0x5b06 -#define STM32F429_PF11_FUNC_FMC_SDNRAS 0x5b0d -#define STM32F429_PF11_FUNC_DCMI_D12 0x5b0e -#define STM32F429_PF11_FUNC_EVENTOUT 0x5b10 -#define STM32F429_PF11_FUNC_ANALOG 0x5b11 - -#define STM32F429_PF12_FUNC_GPIO 0x5c00 -#define STM32F429_PF12_FUNC_FMC_A6 0x5c0d -#define STM32F429_PF12_FUNC_EVENTOUT 0x5c10 -#define STM32F429_PF12_FUNC_ANALOG 0x5c11 - -#define STM32F429_PF13_FUNC_GPIO 0x5d00 -#define STM32F429_PF13_FUNC_FMC_A7 0x5d0d -#define STM32F429_PF13_FUNC_EVENTOUT 0x5d10 -#define STM32F429_PF13_FUNC_ANALOG 0x5d11 - -#define STM32F429_PF14_FUNC_GPIO 0x5e00 -#define STM32F429_PF14_FUNC_FMC_A8 0x5e0d -#define STM32F429_PF14_FUNC_EVENTOUT 0x5e10 -#define STM32F429_PF14_FUNC_ANALOG 0x5e11 - -#define STM32F429_PF15_FUNC_GPIO 0x5f00 -#define STM32F429_PF15_FUNC_FMC_A9 0x5f0d -#define STM32F429_PF15_FUNC_EVENTOUT 0x5f10 -#define STM32F429_PF15_FUNC_ANALOG 0x5f11 - - - -#define STM32F429_PG0_FUNC_GPIO 0x6000 -#define STM32F429_PG0_FUNC_FMC_A10 0x600d -#define STM32F429_PG0_FUNC_EVENTOUT 0x6010 -#define STM32F429_PG0_FUNC_ANALOG 0x6011 - -#define STM32F429_PG1_FUNC_GPIO 0x6100 -#define STM32F429_PG1_FUNC_FMC_A11 0x610d -#define STM32F429_PG1_FUNC_EVENTOUT 0x6110 -#define STM32F429_PG1_FUNC_ANALOG 0x6111 - -#define STM32F429_PG2_FUNC_GPIO 0x6200 -#define STM32F429_PG2_FUNC_FMC_A12 0x620d -#define STM32F429_PG2_FUNC_EVENTOUT 0x6210 -#define STM32F429_PG2_FUNC_ANALOG 0x6211 - -#define STM32F429_PG3_FUNC_GPIO 0x6300 -#define STM32F429_PG3_FUNC_FMC_A13 0x630d -#define STM32F429_PG3_FUNC_EVENTOUT 0x6310 -#define STM32F429_PG3_FUNC_ANALOG 0x6311 - -#define STM32F429_PG4_FUNC_GPIO 0x6400 -#define STM32F429_PG4_FUNC_FMC_A14_FMC_BA0 0x640d -#define STM32F429_PG4_FUNC_EVENTOUT 0x6410 -#define STM32F429_PG4_FUNC_ANALOG 0x6411 - -#define STM32F429_PG5_FUNC_GPIO 0x6500 -#define STM32F429_PG5_FUNC_FMC_A15_FMC_BA1 0x650d -#define STM32F429_PG5_FUNC_EVENTOUT 0x6510 -#define STM32F429_PG5_FUNC_ANALOG 0x6511 - -#define STM32F429_PG6_FUNC_GPIO 0x6600 -#define STM32F429_PG6_FUNC_FMC_INT2 0x660d -#define STM32F429_PG6_FUNC_DCMI_D12 0x660e -#define STM32F429_PG6_FUNC_LCD_R7 0x660f -#define STM32F429_PG6_FUNC_EVENTOUT 0x6610 -#define STM32F429_PG6_FUNC_ANALOG 0x6611 - -#define STM32F429_PG7_FUNC_GPIO 0x6700 -#define STM32F429_PG7_FUNC_USART6_CK 0x6709 -#define STM32F429_PG7_FUNC_FMC_INT3 0x670d -#define STM32F429_PG7_FUNC_DCMI_D13 0x670e -#define STM32F429_PG7_FUNC_LCD_CLK 0x670f -#define STM32F429_PG7_FUNC_EVENTOUT 0x6710 -#define STM32F429_PG7_FUNC_ANALOG 0x6711 - -#define STM32F429_PG8_FUNC_GPIO 0x6800 -#define STM32F429_PG8_FUNC_SPI6_NSS 0x6806 -#define STM32F429_PG8_FUNC_USART6_RTS 0x6809 -#define STM32F429_PG8_FUNC_ETH_PPS_OUT 0x680c -#define STM32F429_PG8_FUNC_FMC_SDCLK 0x680d -#define STM32F429_PG8_FUNC_EVENTOUT 0x6810 -#define STM32F429_PG8_FUNC_ANALOG 0x6811 - -#define STM32F429_PG9_FUNC_GPIO 0x6900 -#define STM32F429_PG9_FUNC_USART6_RX 0x6909 -#define STM32F429_PG9_FUNC_FMC_NE2_FMC_NCE3 0x690d -#define STM32F429_PG9_FUNC_DCMI_VSYNC 0x690e -#define STM32F429_PG9_FUNC_EVENTOUT 0x6910 -#define STM32F429_PG9_FUNC_ANALOG 0x6911 - -#define STM32F429_PG10_FUNC_GPIO 0x6a00 -#define STM32F429_PG10_FUNC_LCD_G3 0x6a0a -#define STM32F429_PG10_FUNC_FMC_NCE4_1_FMC_NE3 0x6a0d -#define STM32F429_PG10_FUNC_DCMI_D2 0x6a0e -#define STM32F429_PG10_FUNC_LCD_B2 0x6a0f -#define STM32F429_PG10_FUNC_EVENTOUT 0x6a10 -#define STM32F429_PG10_FUNC_ANALOG 0x6a11 - -#define STM32F429_PG11_FUNC_GPIO 0x6b00 -#define STM32F429_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x6b0c -#define STM32F429_PG11_FUNC_FMC_NCE4_2 0x6b0d -#define STM32F429_PG11_FUNC_DCMI_D3 0x6b0e -#define STM32F429_PG11_FUNC_LCD_B3 0x6b0f -#define STM32F429_PG11_FUNC_EVENTOUT 0x6b10 -#define STM32F429_PG11_FUNC_ANALOG 0x6b11 - -#define STM32F429_PG12_FUNC_GPIO 0x6c00 -#define STM32F429_PG12_FUNC_SPI6_MISO 0x6c06 -#define STM32F429_PG12_FUNC_USART6_RTS 0x6c09 -#define STM32F429_PG12_FUNC_LCD_B4 0x6c0a -#define STM32F429_PG12_FUNC_FMC_NE4 0x6c0d -#define STM32F429_PG12_FUNC_LCD_B1 0x6c0f -#define STM32F429_PG12_FUNC_EVENTOUT 0x6c10 -#define STM32F429_PG12_FUNC_ANALOG 0x6c11 - -#define STM32F429_PG13_FUNC_GPIO 0x6d00 -#define STM32F429_PG13_FUNC_SPI6_SCK 0x6d06 -#define STM32F429_PG13_FUNC_USART6_CTS 0x6d09 -#define STM32F429_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x6d0c -#define STM32F429_PG13_FUNC_FMC_A24 0x6d0d -#define STM32F429_PG13_FUNC_EVENTOUT 0x6d10 -#define STM32F429_PG13_FUNC_ANALOG 0x6d11 - -#define STM32F429_PG14_FUNC_GPIO 0x6e00 -#define STM32F429_PG14_FUNC_SPI6_MOSI 0x6e06 -#define STM32F429_PG14_FUNC_USART6_TX 0x6e09 -#define STM32F429_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x6e0c -#define STM32F429_PG14_FUNC_FMC_A25 0x6e0d -#define STM32F429_PG14_FUNC_EVENTOUT 0x6e10 -#define STM32F429_PG14_FUNC_ANALOG 0x6e11 - -#define STM32F429_PG15_FUNC_GPIO 0x6f00 -#define STM32F429_PG15_FUNC_USART6_CTS 0x6f09 -#define STM32F429_PG15_FUNC_FMC_SDNCAS 0x6f0d -#define STM32F429_PG15_FUNC_DCMI_D13 0x6f0e -#define STM32F429_PG15_FUNC_EVENTOUT 0x6f10 -#define STM32F429_PG15_FUNC_ANALOG 0x6f11 - - - -#define STM32F429_PH0_FUNC_GPIO 0x7000 -#define STM32F429_PH0_FUNC_EVENTOUT 0x7010 -#define STM32F429_PH0_FUNC_ANALOG 0x7011 - -#define STM32F429_PH1_FUNC_GPIO 0x7100 -#define STM32F429_PH1_FUNC_EVENTOUT 0x7110 -#define STM32F429_PH1_FUNC_ANALOG 0x7111 - -#define STM32F429_PH2_FUNC_GPIO 0x7200 -#define STM32F429_PH2_FUNC_ETH_MII_CRS 0x720c -#define STM32F429_PH2_FUNC_FMC_SDCKE0 0x720d -#define STM32F429_PH2_FUNC_LCD_R0 0x720f -#define STM32F429_PH2_FUNC_EVENTOUT 0x7210 -#define STM32F429_PH2_FUNC_ANALOG 0x7211 - -#define STM32F429_PH3_FUNC_GPIO 0x7300 -#define STM32F429_PH3_FUNC_ETH_MII_COL 0x730c -#define STM32F429_PH3_FUNC_FMC_SDNE0 0x730d -#define STM32F429_PH3_FUNC_LCD_R1 0x730f -#define STM32F429_PH3_FUNC_EVENTOUT 0x7310 -#define STM32F429_PH3_FUNC_ANALOG 0x7311 - -#define STM32F429_PH4_FUNC_GPIO 0x7400 -#define STM32F429_PH4_FUNC_I2C2_SCL 0x7405 -#define STM32F429_PH4_FUNC_OTG_HS_ULPI_NXT 0x740b -#define STM32F429_PH4_FUNC_EVENTOUT 0x7410 -#define STM32F429_PH4_FUNC_ANALOG 0x7411 - -#define STM32F429_PH5_FUNC_GPIO 0x7500 -#define STM32F429_PH5_FUNC_I2C2_SDA 0x7505 -#define STM32F429_PH5_FUNC_SPI5_NSS 0x7506 -#define STM32F429_PH5_FUNC_FMC_SDNWE 0x750d -#define STM32F429_PH5_FUNC_EVENTOUT 0x7510 -#define STM32F429_PH5_FUNC_ANALOG 0x7511 - -#define STM32F429_PH6_FUNC_GPIO 0x7600 -#define STM32F429_PH6_FUNC_I2C2_SMBA 0x7605 -#define STM32F429_PH6_FUNC_SPI5_SCK 0x7606 -#define STM32F429_PH6_FUNC_TIM12_CH1 0x760a -#define STM32F429_PH6_FUNC_ETH_MII_RXD2 0x760c -#define STM32F429_PH6_FUNC_FMC_SDNE1 0x760d -#define STM32F429_PH6_FUNC_DCMI_D8 0x760e -#define STM32F429_PH6_FUNC_EVENTOUT 0x7610 -#define STM32F429_PH6_FUNC_ANALOG 0x7611 - -#define STM32F429_PH7_FUNC_GPIO 0x7700 -#define STM32F429_PH7_FUNC_I2C3_SCL 0x7705 -#define STM32F429_PH7_FUNC_SPI5_MISO 0x7706 -#define STM32F429_PH7_FUNC_ETH_MII_RXD3 0x770c -#define STM32F429_PH7_FUNC_FMC_SDCKE1 0x770d -#define STM32F429_PH7_FUNC_DCMI_D9 0x770e -#define STM32F429_PH7_FUNC_EVENTOUT 0x7710 -#define STM32F429_PH7_FUNC_ANALOG 0x7711 - -#define STM32F429_PH8_FUNC_GPIO 0x7800 -#define STM32F429_PH8_FUNC_I2C3_SDA 0x7805 -#define STM32F429_PH8_FUNC_FMC_D16 0x780d -#define STM32F429_PH8_FUNC_DCMI_HSYNC 0x780e -#define STM32F429_PH8_FUNC_LCD_R2 0x780f -#define STM32F429_PH8_FUNC_EVENTOUT 0x7810 -#define STM32F429_PH8_FUNC_ANALOG 0x7811 - -#define STM32F429_PH9_FUNC_GPIO 0x7900 -#define STM32F429_PH9_FUNC_I2C3_SMBA 0x7905 -#define STM32F429_PH9_FUNC_TIM12_CH2 0x790a -#define STM32F429_PH9_FUNC_FMC_D17 0x790d -#define STM32F429_PH9_FUNC_DCMI_D0 0x790e -#define STM32F429_PH9_FUNC_LCD_R3 0x790f -#define STM32F429_PH9_FUNC_EVENTOUT 0x7910 -#define STM32F429_PH9_FUNC_ANALOG 0x7911 - -#define STM32F429_PH10_FUNC_GPIO 0x7a00 -#define STM32F429_PH10_FUNC_TIM5_CH1 0x7a03 -#define STM32F429_PH10_FUNC_FMC_D18 0x7a0d -#define STM32F429_PH10_FUNC_DCMI_D1 0x7a0e -#define STM32F429_PH10_FUNC_LCD_R4 0x7a0f -#define STM32F429_PH10_FUNC_EVENTOUT 0x7a10 -#define STM32F429_PH10_FUNC_ANALOG 0x7a11 - -#define STM32F429_PH11_FUNC_GPIO 0x7b00 -#define STM32F429_PH11_FUNC_TIM5_CH2 0x7b03 -#define STM32F429_PH11_FUNC_FMC_D19 0x7b0d -#define STM32F429_PH11_FUNC_DCMI_D2 0x7b0e -#define STM32F429_PH11_FUNC_LCD_R5 0x7b0f -#define STM32F429_PH11_FUNC_EVENTOUT 0x7b10 -#define STM32F429_PH11_FUNC_ANALOG 0x7b11 - -#define STM32F429_PH12_FUNC_GPIO 0x7c00 -#define STM32F429_PH12_FUNC_TIM5_CH3 0x7c03 -#define STM32F429_PH12_FUNC_FMC_D20 0x7c0d -#define STM32F429_PH12_FUNC_DCMI_D3 0x7c0e -#define STM32F429_PH12_FUNC_LCD_R6 0x7c0f -#define STM32F429_PH12_FUNC_EVENTOUT 0x7c10 -#define STM32F429_PH12_FUNC_ANALOG 0x7c11 - -#define STM32F429_PH13_FUNC_GPIO 0x7d00 -#define STM32F429_PH13_FUNC_TIM8_CH1N 0x7d04 -#define STM32F429_PH13_FUNC_CAN1_TX 0x7d0a -#define STM32F429_PH13_FUNC_FMC_D21 0x7d0d -#define STM32F429_PH13_FUNC_LCD_G2 0x7d0f -#define STM32F429_PH13_FUNC_EVENTOUT 0x7d10 -#define STM32F429_PH13_FUNC_ANALOG 0x7d11 - -#define STM32F429_PH14_FUNC_GPIO 0x7e00 -#define STM32F429_PH14_FUNC_TIM8_CH2N 0x7e04 -#define STM32F429_PH14_FUNC_FMC_D22 0x7e0d -#define STM32F429_PH14_FUNC_DCMI_D4 0x7e0e -#define STM32F429_PH14_FUNC_LCD_G3 0x7e0f -#define STM32F429_PH14_FUNC_EVENTOUT 0x7e10 -#define STM32F429_PH14_FUNC_ANALOG 0x7e11 - -#define STM32F429_PH15_FUNC_GPIO 0x7f00 -#define STM32F429_PH15_FUNC_TIM8_CH3N 0x7f04 -#define STM32F429_PH15_FUNC_FMC_D23 0x7f0d -#define STM32F429_PH15_FUNC_DCMI_D11 0x7f0e -#define STM32F429_PH15_FUNC_LCD_G4 0x7f0f -#define STM32F429_PH15_FUNC_EVENTOUT 0x7f10 -#define STM32F429_PH15_FUNC_ANALOG 0x7f11 - - - -#define STM32F429_PI0_FUNC_GPIO 0x8000 -#define STM32F429_PI0_FUNC_TIM5_CH4 0x8003 -#define STM32F429_PI0_FUNC_SPI2_NSS_I2S2_WS 0x8006 -#define STM32F429_PI0_FUNC_FMC_D24 0x800d -#define STM32F429_PI0_FUNC_DCMI_D13 0x800e -#define STM32F429_PI0_FUNC_LCD_G5 0x800f -#define STM32F429_PI0_FUNC_EVENTOUT 0x8010 -#define STM32F429_PI0_FUNC_ANALOG 0x8011 - -#define STM32F429_PI1_FUNC_GPIO 0x8100 -#define STM32F429_PI1_FUNC_SPI2_SCK_I2S2_CK 0x8106 -#define STM32F429_PI1_FUNC_FMC_D25 0x810d -#define STM32F429_PI1_FUNC_DCMI_D8 0x810e -#define STM32F429_PI1_FUNC_LCD_G6 0x810f -#define STM32F429_PI1_FUNC_EVENTOUT 0x8110 -#define STM32F429_PI1_FUNC_ANALOG 0x8111 - -#define STM32F429_PI2_FUNC_GPIO 0x8200 -#define STM32F429_PI2_FUNC_TIM8_CH4 0x8204 -#define STM32F429_PI2_FUNC_SPI2_MISO 0x8206 -#define STM32F429_PI2_FUNC_I2S2EXT_SD 0x8207 -#define STM32F429_PI2_FUNC_FMC_D26 0x820d -#define STM32F429_PI2_FUNC_DCMI_D9 0x820e -#define STM32F429_PI2_FUNC_LCD_G7 0x820f -#define STM32F429_PI2_FUNC_EVENTOUT 0x8210 -#define STM32F429_PI2_FUNC_ANALOG 0x8211 - -#define STM32F429_PI3_FUNC_GPIO 0x8300 -#define STM32F429_PI3_FUNC_TIM8_ETR 0x8304 -#define STM32F429_PI3_FUNC_SPI2_MOSI_I2S2_SD 0x8306 -#define STM32F429_PI3_FUNC_FMC_D27 0x830d -#define STM32F429_PI3_FUNC_DCMI_D10 0x830e -#define STM32F429_PI3_FUNC_EVENTOUT 0x8310 -#define STM32F429_PI3_FUNC_ANALOG 0x8311 - -#define STM32F429_PI4_FUNC_GPIO 0x8400 -#define STM32F429_PI4_FUNC_TIM8_BKIN 0x8404 -#define STM32F429_PI4_FUNC_FMC_NBL2 0x840d -#define STM32F429_PI4_FUNC_DCMI_D5 0x840e -#define STM32F429_PI4_FUNC_LCD_B4 0x840f -#define STM32F429_PI4_FUNC_EVENTOUT 0x8410 -#define STM32F429_PI4_FUNC_ANALOG 0x8411 - -#define STM32F429_PI5_FUNC_GPIO 0x8500 -#define STM32F429_PI5_FUNC_TIM8_CH1 0x8504 -#define STM32F429_PI5_FUNC_FMC_NBL3 0x850d -#define STM32F429_PI5_FUNC_DCMI_VSYNC 0x850e -#define STM32F429_PI5_FUNC_LCD_B5 0x850f -#define STM32F429_PI5_FUNC_EVENTOUT 0x8510 -#define STM32F429_PI5_FUNC_ANALOG 0x8511 - -#define STM32F429_PI6_FUNC_GPIO 0x8600 -#define STM32F429_PI6_FUNC_TIM8_CH2 0x8604 -#define STM32F429_PI6_FUNC_FMC_D28 0x860d -#define STM32F429_PI6_FUNC_DCMI_D6 0x860e -#define STM32F429_PI6_FUNC_LCD_B6 0x860f -#define STM32F429_PI6_FUNC_EVENTOUT 0x8610 -#define STM32F429_PI6_FUNC_ANALOG 0x8611 - -#define STM32F429_PI7_FUNC_GPIO 0x8700 -#define STM32F429_PI7_FUNC_TIM8_CH3 0x8704 -#define STM32F429_PI7_FUNC_FMC_D29 0x870d -#define STM32F429_PI7_FUNC_DCMI_D7 0x870e -#define STM32F429_PI7_FUNC_LCD_B7 0x870f -#define STM32F429_PI7_FUNC_EVENTOUT 0x8710 -#define STM32F429_PI7_FUNC_ANALOG 0x8711 - -#define STM32F429_PI8_FUNC_GPIO 0x8800 -#define STM32F429_PI8_FUNC_EVENTOUT 0x8810 -#define STM32F429_PI8_FUNC_ANALOG 0x8811 - -#define STM32F429_PI9_FUNC_GPIO 0x8900 -#define STM32F429_PI9_FUNC_CAN1_RX 0x890a -#define STM32F429_PI9_FUNC_FMC_D30 0x890d -#define STM32F429_PI9_FUNC_LCD_VSYNC 0x890f -#define STM32F429_PI9_FUNC_EVENTOUT 0x8910 -#define STM32F429_PI9_FUNC_ANALOG 0x8911 - -#define STM32F429_PI10_FUNC_GPIO 0x8a00 -#define STM32F429_PI10_FUNC_ETH_MII_RX_ER 0x8a0c -#define STM32F429_PI10_FUNC_FMC_D31 0x8a0d -#define STM32F429_PI10_FUNC_LCD_HSYNC 0x8a0f -#define STM32F429_PI10_FUNC_EVENTOUT 0x8a10 -#define STM32F429_PI10_FUNC_ANALOG 0x8a11 - -#define STM32F429_PI11_FUNC_GPIO 0x8b00 -#define STM32F429_PI11_FUNC_OTG_HS_ULPI_DIR 0x8b0b -#define STM32F429_PI11_FUNC_EVENTOUT 0x8b10 -#define STM32F429_PI11_FUNC_ANALOG 0x8b11 - -#define STM32F429_PI12_FUNC_GPIO 0x8c00 -#define STM32F429_PI12_FUNC_LCD_HSYNC 0x8c0f -#define STM32F429_PI12_FUNC_EVENTOUT 0x8c10 -#define STM32F429_PI12_FUNC_ANALOG 0x8c11 - -#define STM32F429_PI13_FUNC_GPIO 0x8d00 -#define STM32F429_PI13_FUNC_LCD_VSYNC 0x8d0f -#define STM32F429_PI13_FUNC_EVENTOUT 0x8d10 -#define STM32F429_PI13_FUNC_ANALOG 0x8d11 - -#define STM32F429_PI14_FUNC_GPIO 0x8e00 -#define STM32F429_PI14_FUNC_LCD_CLK 0x8e0f -#define STM32F429_PI14_FUNC_EVENTOUT 0x8e10 -#define STM32F429_PI14_FUNC_ANALOG 0x8e11 - -#define STM32F429_PI15_FUNC_GPIO 0x8f00 -#define STM32F429_PI15_FUNC_LCD_R0 0x8f0f -#define STM32F429_PI15_FUNC_EVENTOUT 0x8f10 -#define STM32F429_PI15_FUNC_ANALOG 0x8f11 - - - -#define STM32F429_PJ0_FUNC_GPIO 0x9000 -#define STM32F429_PJ0_FUNC_LCD_R1 0x900f -#define STM32F429_PJ0_FUNC_EVENTOUT 0x9010 -#define STM32F429_PJ0_FUNC_ANALOG 0x9011 - -#define STM32F429_PJ1_FUNC_GPIO 0x9100 -#define STM32F429_PJ1_FUNC_LCD_R2 0x910f -#define STM32F429_PJ1_FUNC_EVENTOUT 0x9110 -#define STM32F429_PJ1_FUNC_ANALOG 0x9111 - -#define STM32F429_PJ2_FUNC_GPIO 0x9200 -#define STM32F429_PJ2_FUNC_LCD_R3 0x920f -#define STM32F429_PJ2_FUNC_EVENTOUT 0x9210 -#define STM32F429_PJ2_FUNC_ANALOG 0x9211 - -#define STM32F429_PJ3_FUNC_GPIO 0x9300 -#define STM32F429_PJ3_FUNC_LCD_R4 0x930f -#define STM32F429_PJ3_FUNC_EVENTOUT 0x9310 -#define STM32F429_PJ3_FUNC_ANALOG 0x9311 - -#define STM32F429_PJ4_FUNC_GPIO 0x9400 -#define STM32F429_PJ4_FUNC_LCD_R5 0x940f -#define STM32F429_PJ4_FUNC_EVENTOUT 0x9410 -#define STM32F429_PJ4_FUNC_ANALOG 0x9411 - -#define STM32F429_PJ5_FUNC_GPIO 0x9500 -#define STM32F429_PJ5_FUNC_LCD_R6 0x950f -#define STM32F429_PJ5_FUNC_EVENTOUT 0x9510 -#define STM32F429_PJ5_FUNC_ANALOG 0x9511 - -#define STM32F429_PJ6_FUNC_GPIO 0x9600 -#define STM32F429_PJ6_FUNC_LCD_R7 0x960f -#define STM32F429_PJ6_FUNC_EVENTOUT 0x9610 -#define STM32F429_PJ6_FUNC_ANALOG 0x9611 - -#define STM32F429_PJ7_FUNC_GPIO 0x9700 -#define STM32F429_PJ7_FUNC_LCD_G0 0x970f -#define STM32F429_PJ7_FUNC_EVENTOUT 0x9710 -#define STM32F429_PJ7_FUNC_ANALOG 0x9711 - -#define STM32F429_PJ8_FUNC_GPIO 0x9800 -#define STM32F429_PJ8_FUNC_LCD_G1 0x980f -#define STM32F429_PJ8_FUNC_EVENTOUT 0x9810 -#define STM32F429_PJ8_FUNC_ANALOG 0x9811 - -#define STM32F429_PJ9_FUNC_GPIO 0x9900 -#define STM32F429_PJ9_FUNC_LCD_G2 0x990f -#define STM32F429_PJ9_FUNC_EVENTOUT 0x9910 -#define STM32F429_PJ9_FUNC_ANALOG 0x9911 - -#define STM32F429_PJ10_FUNC_GPIO 0x9a00 -#define STM32F429_PJ10_FUNC_LCD_G3 0x9a0f -#define STM32F429_PJ10_FUNC_EVENTOUT 0x9a10 -#define STM32F429_PJ10_FUNC_ANALOG 0x9a11 - -#define STM32F429_PJ11_FUNC_GPIO 0x9b00 -#define STM32F429_PJ11_FUNC_LCD_G4 0x9b0f -#define STM32F429_PJ11_FUNC_EVENTOUT 0x9b10 -#define STM32F429_PJ11_FUNC_ANALOG 0x9b11 - -#define STM32F429_PJ12_FUNC_GPIO 0x9c00 -#define STM32F429_PJ12_FUNC_LCD_B0 0x9c0f -#define STM32F429_PJ12_FUNC_EVENTOUT 0x9c10 -#define STM32F429_PJ12_FUNC_ANALOG 0x9c11 - -#define STM32F429_PJ13_FUNC_GPIO 0x9d00 -#define STM32F429_PJ13_FUNC_LCD_B1 0x9d0f -#define STM32F429_PJ13_FUNC_EVENTOUT 0x9d10 -#define STM32F429_PJ13_FUNC_ANALOG 0x9d11 - -#define STM32F429_PJ14_FUNC_GPIO 0x9e00 -#define STM32F429_PJ14_FUNC_LCD_B2 0x9e0f -#define STM32F429_PJ14_FUNC_EVENTOUT 0x9e10 -#define STM32F429_PJ14_FUNC_ANALOG 0x9e11 - -#define STM32F429_PJ15_FUNC_GPIO 0x9f00 -#define STM32F429_PJ15_FUNC_LCD_B3 0x9f0f -#define STM32F429_PJ15_FUNC_EVENTOUT 0x9f10 -#define STM32F429_PJ15_FUNC_ANALOG 0x9f11 - - - -#define STM32F429_PK0_FUNC_GPIO 0xa000 -#define STM32F429_PK0_FUNC_LCD_G5 0xa00f -#define STM32F429_PK0_FUNC_EVENTOUT 0xa010 -#define STM32F429_PK0_FUNC_ANALOG 0xa011 - -#define STM32F429_PK1_FUNC_GPIO 0xa100 -#define STM32F429_PK1_FUNC_LCD_G6 0xa10f -#define STM32F429_PK1_FUNC_EVENTOUT 0xa110 -#define STM32F429_PK1_FUNC_ANALOG 0xa111 - -#define STM32F429_PK2_FUNC_GPIO 0xa200 -#define STM32F429_PK2_FUNC_LCD_G7 0xa20f -#define STM32F429_PK2_FUNC_EVENTOUT 0xa210 -#define STM32F429_PK2_FUNC_ANALOG 0xa211 - -#define STM32F429_PK3_FUNC_GPIO 0xa300 -#define STM32F429_PK3_FUNC_LCD_B4 0xa30f -#define STM32F429_PK3_FUNC_EVENTOUT 0xa310 -#define STM32F429_PK3_FUNC_ANALOG 0xa311 - -#define STM32F429_PK4_FUNC_GPIO 0xa400 -#define STM32F429_PK4_FUNC_LCD_B5 0xa40f -#define STM32F429_PK4_FUNC_EVENTOUT 0xa410 -#define STM32F429_PK4_FUNC_ANALOG 0xa411 - -#define STM32F429_PK5_FUNC_GPIO 0xa500 -#define STM32F429_PK5_FUNC_LCD_B6 0xa50f -#define STM32F429_PK5_FUNC_EVENTOUT 0xa510 -#define STM32F429_PK5_FUNC_ANALOG 0xa511 - -#define STM32F429_PK6_FUNC_GPIO 0xa600 -#define STM32F429_PK6_FUNC_LCD_B7 0xa60f -#define STM32F429_PK6_FUNC_EVENTOUT 0xa610 -#define STM32F429_PK6_FUNC_ANALOG 0xa611 - -#define STM32F429_PK7_FUNC_GPIO 0xa700 -#define STM32F429_PK7_FUNC_LCD_DE 0xa70f -#define STM32F429_PK7_FUNC_EVENTOUT 0xa710 -#define STM32F429_PK7_FUNC_ANALOG 0xa711 - -#endif /* _DT_BINDINGS_STM32F429_PINFUNC_H */ diff --git a/include/dt-bindings/pinctrl/stm32f746-pinfunc.h b/include/dt-bindings/pinctrl/stm32f746-pinfunc.h deleted file mode 100644 index 6348c6a830e9..000000000000 --- a/include/dt-bindings/pinctrl/stm32f746-pinfunc.h +++ /dev/null @@ -1,1324 +0,0 @@ -#ifndef _DT_BINDINGS_STM32F746_PINFUNC_H -#define _DT_BINDINGS_STM32F746_PINFUNC_H - -#define STM32F746_PA0_FUNC_GPIO 0x0 -#define STM32F746_PA0_FUNC_TIM2_CH1_TIM2_ETR 0x2 -#define STM32F746_PA0_FUNC_TIM5_CH1 0x3 -#define STM32F746_PA0_FUNC_TIM8_ETR 0x4 -#define STM32F746_PA0_FUNC_USART2_CTS 0x8 -#define STM32F746_PA0_FUNC_UART4_TX 0x9 -#define STM32F746_PA0_FUNC_SAI2_SD_B 0xb -#define STM32F746_PA0_FUNC_ETH_MII_CRS 0xc -#define STM32F746_PA0_FUNC_EVENTOUT 0x10 -#define STM32F746_PA0_FUNC_ANALOG 0x11 - -#define STM32F746_PA1_FUNC_GPIO 0x100 -#define STM32F746_PA1_FUNC_TIM2_CH2 0x102 -#define STM32F746_PA1_FUNC_TIM5_CH2 0x103 -#define STM32F746_PA1_FUNC_USART2_RTS 0x108 -#define STM32F746_PA1_FUNC_UART4_RX 0x109 -#define STM32F746_PA1_FUNC_QUADSPI_BK1_IO3 0x10a -#define STM32F746_PA1_FUNC_SAI2_MCLK_B 0x10b -#define STM32F746_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK 0x10c -#define STM32F746_PA1_FUNC_LCD_R2 0x10f -#define STM32F746_PA1_FUNC_EVENTOUT 0x110 -#define STM32F746_PA1_FUNC_ANALOG 0x111 - -#define STM32F746_PA2_FUNC_GPIO 0x200 -#define STM32F746_PA2_FUNC_TIM2_CH3 0x202 -#define STM32F746_PA2_FUNC_TIM5_CH3 0x203 -#define STM32F746_PA2_FUNC_TIM9_CH1 0x204 -#define STM32F746_PA2_FUNC_USART2_TX 0x208 -#define STM32F746_PA2_FUNC_SAI2_SCK_B 0x209 -#define STM32F746_PA2_FUNC_ETH_MDIO 0x20c -#define STM32F746_PA2_FUNC_LCD_R1 0x20f -#define STM32F746_PA2_FUNC_EVENTOUT 0x210 -#define STM32F746_PA2_FUNC_ANALOG 0x211 - -#define STM32F746_PA3_FUNC_GPIO 0x300 -#define STM32F746_PA3_FUNC_TIM2_CH4 0x302 -#define STM32F746_PA3_FUNC_TIM5_CH4 0x303 -#define STM32F746_PA3_FUNC_TIM9_CH2 0x304 -#define STM32F746_PA3_FUNC_USART2_RX 0x308 -#define STM32F746_PA3_FUNC_OTG_HS_ULPI_D0 0x30b -#define STM32F746_PA3_FUNC_ETH_MII_COL 0x30c -#define STM32F746_PA3_FUNC_LCD_B5 0x30f -#define STM32F746_PA3_FUNC_EVENTOUT 0x310 -#define STM32F746_PA3_FUNC_ANALOG 0x311 - -#define STM32F746_PA4_FUNC_GPIO 0x400 -#define STM32F746_PA4_FUNC_SPI1_NSS_I2S1_WS 0x406 -#define STM32F746_PA4_FUNC_SPI3_NSS_I2S3_WS 0x407 -#define STM32F746_PA4_FUNC_USART2_CK 0x408 -#define STM32F746_PA4_FUNC_OTG_HS_SOF 0x40d -#define STM32F746_PA4_FUNC_DCMI_HSYNC 0x40e -#define STM32F746_PA4_FUNC_LCD_VSYNC 0x40f -#define STM32F746_PA4_FUNC_EVENTOUT 0x410 -#define STM32F746_PA4_FUNC_ANALOG 0x411 - -#define STM32F746_PA5_FUNC_GPIO 0x500 -#define STM32F746_PA5_FUNC_TIM2_CH1_TIM2_ETR 0x502 -#define STM32F746_PA5_FUNC_TIM8_CH1N 0x504 -#define STM32F746_PA5_FUNC_SPI1_SCK_I2S1_CK 0x506 -#define STM32F746_PA5_FUNC_OTG_HS_ULPI_CK 0x50b -#define STM32F746_PA5_FUNC_LCD_R4 0x50f -#define STM32F746_PA5_FUNC_EVENTOUT 0x510 -#define STM32F746_PA5_FUNC_ANALOG 0x511 - -#define STM32F746_PA6_FUNC_GPIO 0x600 -#define STM32F746_PA6_FUNC_TIM1_BKIN 0x602 -#define STM32F746_PA6_FUNC_TIM3_CH1 0x603 -#define STM32F746_PA6_FUNC_TIM8_BKIN 0x604 -#define STM32F746_PA6_FUNC_SPI1_MISO 0x606 -#define STM32F746_PA6_FUNC_TIM13_CH1 0x60a -#define STM32F746_PA6_FUNC_DCMI_PIXCLK 0x60e -#define STM32F746_PA6_FUNC_LCD_G2 0x60f -#define STM32F746_PA6_FUNC_EVENTOUT 0x610 -#define STM32F746_PA6_FUNC_ANALOG 0x611 - -#define STM32F746_PA7_FUNC_GPIO 0x700 -#define STM32F746_PA7_FUNC_TIM1_CH1N 0x702 -#define STM32F746_PA7_FUNC_TIM3_CH2 0x703 -#define STM32F746_PA7_FUNC_TIM8_CH1N 0x704 -#define STM32F746_PA7_FUNC_SPI1_MOSI_I2S1_SD 0x706 -#define STM32F746_PA7_FUNC_TIM14_CH1 0x70a -#define STM32F746_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV 0x70c -#define STM32F746_PA7_FUNC_FMC_SDNWE 0x70d -#define STM32F746_PA7_FUNC_EVENTOUT 0x710 -#define STM32F746_PA7_FUNC_ANALOG 0x711 - -#define STM32F746_PA8_FUNC_GPIO 0x800 -#define STM32F746_PA8_FUNC_MCO1 0x801 -#define STM32F746_PA8_FUNC_TIM1_CH1 0x802 -#define STM32F746_PA8_FUNC_TIM8_BKIN2 0x804 -#define STM32F746_PA8_FUNC_I2C3_SCL 0x805 -#define STM32F746_PA8_FUNC_USART1_CK 0x808 -#define STM32F746_PA8_FUNC_OTG_FS_SOF 0x80b -#define STM32F746_PA8_FUNC_LCD_R6 0x80f -#define STM32F746_PA8_FUNC_EVENTOUT 0x810 -#define STM32F746_PA8_FUNC_ANALOG 0x811 - -#define STM32F746_PA9_FUNC_GPIO 0x900 -#define STM32F746_PA9_FUNC_TIM1_CH2 0x902 -#define STM32F746_PA9_FUNC_I2C3_SMBA 0x905 -#define STM32F746_PA9_FUNC_SPI2_SCK_I2S2_CK 0x906 -#define STM32F746_PA9_FUNC_USART1_TX 0x908 -#define STM32F746_PA9_FUNC_DCMI_D0 0x90e -#define STM32F746_PA9_FUNC_EVENTOUT 0x910 -#define STM32F746_PA9_FUNC_ANALOG 0x911 - -#define STM32F746_PA10_FUNC_GPIO 0xa00 -#define STM32F746_PA10_FUNC_TIM1_CH3 0xa02 -#define STM32F746_PA10_FUNC_USART1_RX 0xa08 -#define STM32F746_PA10_FUNC_OTG_FS_ID 0xa0b -#define STM32F746_PA10_FUNC_DCMI_D1 0xa0e -#define STM32F746_PA10_FUNC_EVENTOUT 0xa10 -#define STM32F746_PA10_FUNC_ANALOG 0xa11 - -#define STM32F746_PA11_FUNC_GPIO 0xb00 -#define STM32F746_PA11_FUNC_TIM1_CH4 0xb02 -#define STM32F746_PA11_FUNC_USART1_CTS 0xb08 -#define STM32F746_PA11_FUNC_CAN1_RX 0xb0a -#define STM32F746_PA11_FUNC_OTG_FS_DM 0xb0b -#define STM32F746_PA11_FUNC_LCD_R4 0xb0f -#define STM32F746_PA11_FUNC_EVENTOUT 0xb10 -#define STM32F746_PA11_FUNC_ANALOG 0xb11 - -#define STM32F746_PA12_FUNC_GPIO 0xc00 -#define STM32F746_PA12_FUNC_TIM1_ETR 0xc02 -#define STM32F746_PA12_FUNC_USART1_RTS 0xc08 -#define STM32F746_PA12_FUNC_SAI2_FS_B 0xc09 -#define STM32F746_PA12_FUNC_CAN1_TX 0xc0a -#define STM32F746_PA12_FUNC_OTG_FS_DP 0xc0b -#define STM32F746_PA12_FUNC_LCD_R5 0xc0f -#define STM32F746_PA12_FUNC_EVENTOUT 0xc10 -#define STM32F746_PA12_FUNC_ANALOG 0xc11 - -#define STM32F746_PA13_FUNC_GPIO 0xd00 -#define STM32F746_PA13_FUNC_JTMS_SWDIO 0xd01 -#define STM32F746_PA13_FUNC_EVENTOUT 0xd10 -#define STM32F746_PA13_FUNC_ANALOG 0xd11 - -#define STM32F746_PA14_FUNC_GPIO 0xe00 -#define STM32F746_PA14_FUNC_JTCK_SWCLK 0xe01 -#define STM32F746_PA14_FUNC_EVENTOUT 0xe10 -#define STM32F746_PA14_FUNC_ANALOG 0xe11 - -#define STM32F746_PA15_FUNC_GPIO 0xf00 -#define STM32F746_PA15_FUNC_JTDI 0xf01 -#define STM32F746_PA15_FUNC_TIM2_CH1_TIM2_ETR 0xf02 -#define STM32F746_PA15_FUNC_HDMI_CEC 0xf05 -#define STM32F746_PA15_FUNC_SPI1_NSS_I2S1_WS 0xf06 -#define STM32F746_PA15_FUNC_SPI3_NSS_I2S3_WS 0xf07 -#define STM32F746_PA15_FUNC_UART4_RTS 0xf09 -#define STM32F746_PA15_FUNC_EVENTOUT 0xf10 -#define STM32F746_PA15_FUNC_ANALOG 0xf11 - - -#define STM32F746_PB0_FUNC_GPIO 0x1000 -#define STM32F746_PB0_FUNC_TIM1_CH2N 0x1002 -#define STM32F746_PB0_FUNC_TIM3_CH3 0x1003 -#define STM32F746_PB0_FUNC_TIM8_CH2N 0x1004 -#define STM32F746_PB0_FUNC_UART4_CTS 0x1009 -#define STM32F746_PB0_FUNC_LCD_R3 0x100a -#define STM32F746_PB0_FUNC_OTG_HS_ULPI_D1 0x100b -#define STM32F746_PB0_FUNC_ETH_MII_RXD2 0x100c -#define STM32F746_PB0_FUNC_EVENTOUT 0x1010 -#define STM32F746_PB0_FUNC_ANALOG 0x1011 - -#define STM32F746_PB1_FUNC_GPIO 0x1100 -#define STM32F746_PB1_FUNC_TIM1_CH3N 0x1102 -#define STM32F746_PB1_FUNC_TIM3_CH4 0x1103 -#define STM32F746_PB1_FUNC_TIM8_CH3N 0x1104 -#define STM32F746_PB1_FUNC_LCD_R6 0x110a -#define STM32F746_PB1_FUNC_OTG_HS_ULPI_D2 0x110b -#define STM32F746_PB1_FUNC_ETH_MII_RXD3 0x110c -#define STM32F746_PB1_FUNC_EVENTOUT 0x1110 -#define STM32F746_PB1_FUNC_ANALOG 0x1111 - -#define STM32F746_PB2_FUNC_GPIO 0x1200 -#define STM32F746_PB2_FUNC_SAI1_SD_A 0x1207 -#define STM32F746_PB2_FUNC_SPI3_MOSI_I2S3_SD 0x1208 -#define STM32F746_PB2_FUNC_QUADSPI_CLK 0x120a -#define STM32F746_PB2_FUNC_EVENTOUT 0x1210 -#define STM32F746_PB2_FUNC_ANALOG 0x1211 - -#define STM32F746_PB3_FUNC_GPIO 0x1300 -#define STM32F746_PB3_FUNC_JTDO_TRACESWO 0x1301 -#define STM32F746_PB3_FUNC_TIM2_CH2 0x1302 -#define STM32F746_PB3_FUNC_SPI1_SCK_I2S1_CK 0x1306 -#define STM32F746_PB3_FUNC_SPI3_SCK_I2S3_CK 0x1307 -#define STM32F746_PB3_FUNC_EVENTOUT 0x1310 -#define STM32F746_PB3_FUNC_ANALOG 0x1311 - -#define STM32F746_PB4_FUNC_GPIO 0x1400 -#define STM32F746_PB4_FUNC_NJTRST 0x1401 -#define STM32F746_PB4_FUNC_TIM3_CH1 0x1403 -#define STM32F746_PB4_FUNC_SPI1_MISO 0x1406 -#define STM32F746_PB4_FUNC_SPI3_MISO 0x1407 -#define STM32F746_PB4_FUNC_SPI2_NSS_I2S2_WS 0x1408 -#define STM32F746_PB4_FUNC_EVENTOUT 0x1410 -#define STM32F746_PB4_FUNC_ANALOG 0x1411 - -#define STM32F746_PB5_FUNC_GPIO 0x1500 -#define STM32F746_PB5_FUNC_TIM3_CH2 0x1503 -#define STM32F746_PB5_FUNC_I2C1_SMBA 0x1505 -#define STM32F746_PB5_FUNC_SPI1_MOSI_I2S1_SD 0x1506 -#define STM32F746_PB5_FUNC_SPI3_MOSI_I2S3_SD 0x1507 -#define STM32F746_PB5_FUNC_CAN2_RX 0x150a -#define STM32F746_PB5_FUNC_OTG_HS_ULPI_D7 0x150b -#define STM32F746_PB5_FUNC_ETH_PPS_OUT 0x150c -#define STM32F746_PB5_FUNC_FMC_SDCKE1 0x150d -#define STM32F746_PB5_FUNC_DCMI_D10 0x150e -#define STM32F746_PB5_FUNC_EVENTOUT 0x1510 -#define STM32F746_PB5_FUNC_ANALOG 0x1511 - -#define STM32F746_PB6_FUNC_GPIO 0x1600 -#define STM32F746_PB6_FUNC_TIM4_CH1 0x1603 -#define STM32F746_PB6_FUNC_HDMI_CEC 0x1604 -#define STM32F746_PB6_FUNC_I2C1_SCL 0x1605 -#define STM32F746_PB6_FUNC_USART1_TX 0x1608 -#define STM32F746_PB6_FUNC_CAN2_TX 0x160a -#define STM32F746_PB6_FUNC_QUADSPI_BK1_NCS 0x160b -#define STM32F746_PB6_FUNC_FMC_SDNE1 0x160d -#define STM32F746_PB6_FUNC_DCMI_D5 0x160e -#define STM32F746_PB6_FUNC_EVENTOUT 0x1610 -#define STM32F746_PB6_FUNC_ANALOG 0x1611 - -#define STM32F746_PB7_FUNC_GPIO 0x1700 -#define STM32F746_PB7_FUNC_TIM4_CH2 0x1703 -#define STM32F746_PB7_FUNC_I2C1_SDA 0x1705 -#define STM32F746_PB7_FUNC_USART1_RX 0x1708 -#define STM32F746_PB7_FUNC_FMC_NL 0x170d -#define STM32F746_PB7_FUNC_DCMI_VSYNC 0x170e -#define STM32F746_PB7_FUNC_EVENTOUT 0x1710 -#define STM32F746_PB7_FUNC_ANALOG 0x1711 - -#define STM32F746_PB8_FUNC_GPIO 0x1800 -#define STM32F746_PB8_FUNC_TIM4_CH3 0x1803 -#define STM32F746_PB8_FUNC_TIM10_CH1 0x1804 -#define STM32F746_PB8_FUNC_I2C1_SCL 0x1805 -#define STM32F746_PB8_FUNC_CAN1_RX 0x180a -#define STM32F746_PB8_FUNC_ETH_MII_TXD3 0x180c -#define STM32F746_PB8_FUNC_SDMMC1_D4 0x180d -#define STM32F746_PB8_FUNC_DCMI_D6 0x180e -#define STM32F746_PB8_FUNC_LCD_B6 0x180f -#define STM32F746_PB8_FUNC_EVENTOUT 0x1810 -#define STM32F746_PB8_FUNC_ANALOG 0x1811 - -#define STM32F746_PB9_FUNC_GPIO 0x1900 -#define STM32F746_PB9_FUNC_TIM4_CH4 0x1903 -#define STM32F746_PB9_FUNC_TIM11_CH1 0x1904 -#define STM32F746_PB9_FUNC_I2C1_SDA 0x1905 -#define STM32F746_PB9_FUNC_SPI2_NSS_I2S2_WS 0x1906 -#define STM32F746_PB9_FUNC_CAN1_TX 0x190a -#define STM32F746_PB9_FUNC_SDMMC1_D5 0x190d -#define STM32F746_PB9_FUNC_DCMI_D7 0x190e -#define STM32F746_PB9_FUNC_LCD_B7 0x190f -#define STM32F746_PB9_FUNC_EVENTOUT 0x1910 -#define STM32F746_PB9_FUNC_ANALOG 0x1911 - -#define STM32F746_PB10_FUNC_GPIO 0x1a00 -#define STM32F746_PB10_FUNC_TIM2_CH3 0x1a02 -#define STM32F746_PB10_FUNC_I2C2_SCL 0x1a05 -#define STM32F746_PB10_FUNC_SPI2_SCK_I2S2_CK 0x1a06 -#define STM32F746_PB10_FUNC_USART3_TX 0x1a08 -#define STM32F746_PB10_FUNC_OTG_HS_ULPI_D3 0x1a0b -#define STM32F746_PB10_FUNC_ETH_MII_RX_ER 0x1a0c -#define STM32F746_PB10_FUNC_LCD_G4 0x1a0f -#define STM32F746_PB10_FUNC_EVENTOUT 0x1a10 -#define STM32F746_PB10_FUNC_ANALOG 0x1a11 - -#define STM32F746_PB11_FUNC_GPIO 0x1b00 -#define STM32F746_PB11_FUNC_TIM2_CH4 0x1b02 -#define STM32F746_PB11_FUNC_I2C2_SDA 0x1b05 -#define STM32F746_PB11_FUNC_USART3_RX 0x1b08 -#define STM32F746_PB11_FUNC_OTG_HS_ULPI_D4 0x1b0b -#define STM32F746_PB11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x1b0c -#define STM32F746_PB11_FUNC_LCD_G5 0x1b0f -#define STM32F746_PB11_FUNC_EVENTOUT 0x1b10 -#define STM32F746_PB11_FUNC_ANALOG 0x1b11 - -#define STM32F746_PB12_FUNC_GPIO 0x1c00 -#define STM32F746_PB12_FUNC_TIM1_BKIN 0x1c02 -#define STM32F746_PB12_FUNC_I2C2_SMBA 0x1c05 -#define STM32F746_PB12_FUNC_SPI2_NSS_I2S2_WS 0x1c06 -#define STM32F746_PB12_FUNC_USART3_CK 0x1c08 -#define STM32F746_PB12_FUNC_CAN2_RX 0x1c0a -#define STM32F746_PB12_FUNC_OTG_HS_ULPI_D5 0x1c0b -#define STM32F746_PB12_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x1c0c -#define STM32F746_PB12_FUNC_OTG_HS_ID 0x1c0d -#define STM32F746_PB12_FUNC_EVENTOUT 0x1c10 -#define STM32F746_PB12_FUNC_ANALOG 0x1c11 - -#define STM32F746_PB13_FUNC_GPIO 0x1d00 -#define STM32F746_PB13_FUNC_TIM1_CH1N 0x1d02 -#define STM32F746_PB13_FUNC_SPI2_SCK_I2S2_CK 0x1d06 -#define STM32F746_PB13_FUNC_USART3_CTS 0x1d08 -#define STM32F746_PB13_FUNC_CAN2_TX 0x1d0a -#define STM32F746_PB13_FUNC_OTG_HS_ULPI_D6 0x1d0b -#define STM32F746_PB13_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x1d0c -#define STM32F746_PB13_FUNC_EVENTOUT 0x1d10 -#define STM32F746_PB13_FUNC_ANALOG 0x1d11 - -#define STM32F746_PB14_FUNC_GPIO 0x1e00 -#define STM32F746_PB14_FUNC_TIM1_CH2N 0x1e02 -#define STM32F746_PB14_FUNC_TIM8_CH2N 0x1e04 -#define STM32F746_PB14_FUNC_SPI2_MISO 0x1e06 -#define STM32F746_PB14_FUNC_USART3_RTS 0x1e08 -#define STM32F746_PB14_FUNC_TIM12_CH1 0x1e0a -#define STM32F746_PB14_FUNC_OTG_HS_DM 0x1e0d -#define STM32F746_PB14_FUNC_EVENTOUT 0x1e10 -#define STM32F746_PB14_FUNC_ANALOG 0x1e11 - -#define STM32F746_PB15_FUNC_GPIO 0x1f00 -#define STM32F746_PB15_FUNC_RTC_REFIN 0x1f01 -#define STM32F746_PB15_FUNC_TIM1_CH3N 0x1f02 -#define STM32F746_PB15_FUNC_TIM8_CH3N 0x1f04 -#define STM32F746_PB15_FUNC_SPI2_MOSI_I2S2_SD 0x1f06 -#define STM32F746_PB15_FUNC_TIM12_CH2 0x1f0a -#define STM32F746_PB15_FUNC_OTG_HS_DP 0x1f0d -#define STM32F746_PB15_FUNC_EVENTOUT 0x1f10 -#define STM32F746_PB15_FUNC_ANALOG 0x1f11 - - -#define STM32F746_PC0_FUNC_GPIO 0x2000 -#define STM32F746_PC0_FUNC_SAI2_FS_B 0x2009 -#define STM32F746_PC0_FUNC_OTG_HS_ULPI_STP 0x200b -#define STM32F746_PC0_FUNC_FMC_SDNWE 0x200d -#define STM32F746_PC0_FUNC_LCD_R5 0x200f -#define STM32F746_PC0_FUNC_EVENTOUT 0x2010 -#define STM32F746_PC0_FUNC_ANALOG 0x2011 - -#define STM32F746_PC1_FUNC_GPIO 0x2100 -#define STM32F746_PC1_FUNC_TRACED0 0x2101 -#define STM32F746_PC1_FUNC_SPI2_MOSI_I2S2_SD 0x2106 -#define STM32F746_PC1_FUNC_SAI1_SD_A 0x2107 -#define STM32F746_PC1_FUNC_ETH_MDC 0x210c -#define STM32F746_PC1_FUNC_EVENTOUT 0x2110 -#define STM32F746_PC1_FUNC_ANALOG 0x2111 - -#define STM32F746_PC2_FUNC_GPIO 0x2200 -#define STM32F746_PC2_FUNC_SPI2_MISO 0x2206 -#define STM32F746_PC2_FUNC_OTG_HS_ULPI_DIR 0x220b -#define STM32F746_PC2_FUNC_ETH_MII_TXD2 0x220c -#define STM32F746_PC2_FUNC_FMC_SDNE0 0x220d -#define STM32F746_PC2_FUNC_EVENTOUT 0x2210 -#define STM32F746_PC2_FUNC_ANALOG 0x2211 - -#define STM32F746_PC3_FUNC_GPIO 0x2300 -#define STM32F746_PC3_FUNC_SPI2_MOSI_I2S2_SD 0x2306 -#define STM32F746_PC3_FUNC_OTG_HS_ULPI_NXT 0x230b -#define STM32F746_PC3_FUNC_ETH_MII_TX_CLK 0x230c -#define STM32F746_PC3_FUNC_FMC_SDCKE0 0x230d -#define STM32F746_PC3_FUNC_EVENTOUT 0x2310 -#define STM32F746_PC3_FUNC_ANALOG 0x2311 - -#define STM32F746_PC4_FUNC_GPIO 0x2400 -#define STM32F746_PC4_FUNC_I2S1_MCK 0x2406 -#define STM32F746_PC4_FUNC_SPDIFRX_IN2 0x2409 -#define STM32F746_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0 0x240c -#define STM32F746_PC4_FUNC_FMC_SDNE0 0x240d -#define STM32F746_PC4_FUNC_EVENTOUT 0x2410 -#define STM32F746_PC4_FUNC_ANALOG 0x2411 - -#define STM32F746_PC5_FUNC_GPIO 0x2500 -#define STM32F746_PC5_FUNC_SPDIFRX_IN3 0x2509 -#define STM32F746_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1 0x250c -#define STM32F746_PC5_FUNC_FMC_SDCKE0 0x250d -#define STM32F746_PC5_FUNC_EVENTOUT 0x2510 -#define STM32F746_PC5_FUNC_ANALOG 0x2511 - -#define STM32F746_PC6_FUNC_GPIO 0x2600 -#define STM32F746_PC6_FUNC_TIM3_CH1 0x2603 -#define STM32F746_PC6_FUNC_TIM8_CH1 0x2604 -#define STM32F746_PC6_FUNC_I2S2_MCK 0x2606 -#define STM32F746_PC6_FUNC_USART6_TX 0x2609 -#define STM32F746_PC6_FUNC_SDMMC1_D6 0x260d -#define STM32F746_PC6_FUNC_DCMI_D0 0x260e -#define STM32F746_PC6_FUNC_LCD_HSYNC 0x260f -#define STM32F746_PC6_FUNC_EVENTOUT 0x2610 -#define STM32F746_PC6_FUNC_ANALOG 0x2611 - -#define STM32F746_PC7_FUNC_GPIO 0x2700 -#define STM32F746_PC7_FUNC_TIM3_CH2 0x2703 -#define STM32F746_PC7_FUNC_TIM8_CH2 0x2704 -#define STM32F746_PC7_FUNC_I2S3_MCK 0x2707 -#define STM32F746_PC7_FUNC_USART6_RX 0x2709 -#define STM32F746_PC7_FUNC_SDMMC1_D7 0x270d -#define STM32F746_PC7_FUNC_DCMI_D1 0x270e -#define STM32F746_PC7_FUNC_LCD_G6 0x270f -#define STM32F746_PC7_FUNC_EVENTOUT 0x2710 -#define STM32F746_PC7_FUNC_ANALOG 0x2711 - -#define STM32F746_PC8_FUNC_GPIO 0x2800 -#define STM32F746_PC8_FUNC_TRACED1 0x2801 -#define STM32F746_PC8_FUNC_TIM3_CH3 0x2803 -#define STM32F746_PC8_FUNC_TIM8_CH3 0x2804 -#define STM32F746_PC8_FUNC_UART5_RTS 0x2808 -#define STM32F746_PC8_FUNC_USART6_CK 0x2809 -#define STM32F746_PC8_FUNC_SDMMC1_D0 0x280d -#define STM32F746_PC8_FUNC_DCMI_D2 0x280e -#define STM32F746_PC8_FUNC_EVENTOUT 0x2810 -#define STM32F746_PC8_FUNC_ANALOG 0x2811 - -#define STM32F746_PC9_FUNC_GPIO 0x2900 -#define STM32F746_PC9_FUNC_MCO2 0x2901 -#define STM32F746_PC9_FUNC_TIM3_CH4 0x2903 -#define STM32F746_PC9_FUNC_TIM8_CH4 0x2904 -#define STM32F746_PC9_FUNC_I2C3_SDA 0x2905 -#define STM32F746_PC9_FUNC_I2S_CKIN 0x2906 -#define STM32F746_PC9_FUNC_UART5_CTS 0x2908 -#define STM32F746_PC9_FUNC_QUADSPI_BK1_IO0 0x290a -#define STM32F746_PC9_FUNC_SDMMC1_D1 0x290d -#define STM32F746_PC9_FUNC_DCMI_D3 0x290e -#define STM32F746_PC9_FUNC_EVENTOUT 0x2910 -#define STM32F746_PC9_FUNC_ANALOG 0x2911 - -#define STM32F746_PC10_FUNC_GPIO 0x2a00 -#define STM32F746_PC10_FUNC_SPI3_SCK_I2S3_CK 0x2a07 -#define STM32F746_PC10_FUNC_USART3_TX 0x2a08 -#define STM32F746_PC10_FUNC_UART4_TX 0x2a09 -#define STM32F746_PC10_FUNC_QUADSPI_BK1_IO1 0x2a0a -#define STM32F746_PC10_FUNC_SDMMC1_D2 0x2a0d -#define STM32F746_PC10_FUNC_DCMI_D8 0x2a0e -#define STM32F746_PC10_FUNC_LCD_R2 0x2a0f -#define STM32F746_PC10_FUNC_EVENTOUT 0x2a10 -#define STM32F746_PC10_FUNC_ANALOG 0x2a11 - -#define STM32F746_PC11_FUNC_GPIO 0x2b00 -#define STM32F746_PC11_FUNC_SPI3_MISO 0x2b07 -#define STM32F746_PC11_FUNC_USART3_RX 0x2b08 -#define STM32F746_PC11_FUNC_UART4_RX 0x2b09 -#define STM32F746_PC11_FUNC_QUADSPI_BK2_NCS 0x2b0a -#define STM32F746_PC11_FUNC_SDMMC1_D3 0x2b0d -#define STM32F746_PC11_FUNC_DCMI_D4 0x2b0e -#define STM32F746_PC11_FUNC_EVENTOUT 0x2b10 -#define STM32F746_PC11_FUNC_ANALOG 0x2b11 - -#define STM32F746_PC12_FUNC_GPIO 0x2c00 -#define STM32F746_PC12_FUNC_TRACED3 0x2c01 -#define STM32F746_PC12_FUNC_SPI3_MOSI_I2S3_SD 0x2c07 -#define STM32F746_PC12_FUNC_USART3_CK 0x2c08 -#define STM32F746_PC12_FUNC_UART5_TX 0x2c09 -#define STM32F746_PC12_FUNC_SDMMC1_CK 0x2c0d -#define STM32F746_PC12_FUNC_DCMI_D9 0x2c0e -#define STM32F746_PC12_FUNC_EVENTOUT 0x2c10 -#define STM32F746_PC12_FUNC_ANALOG 0x2c11 - -#define STM32F746_PC13_FUNC_GPIO 0x2d00 -#define STM32F746_PC13_FUNC_EVENTOUT 0x2d10 -#define STM32F746_PC13_FUNC_ANALOG 0x2d11 - -#define STM32F746_PC14_FUNC_GPIO 0x2e00 -#define STM32F746_PC14_FUNC_EVENTOUT 0x2e10 -#define STM32F746_PC14_FUNC_ANALOG 0x2e11 - -#define STM32F746_PC15_FUNC_GPIO 0x2f00 -#define STM32F746_PC15_FUNC_EVENTOUT 0x2f10 -#define STM32F746_PC15_FUNC_ANALOG 0x2f11 - - -#define STM32F746_PD0_FUNC_GPIO 0x3000 -#define STM32F746_PD0_FUNC_CAN1_RX 0x300a -#define STM32F746_PD0_FUNC_FMC_D2 0x300d -#define STM32F746_PD0_FUNC_EVENTOUT 0x3010 -#define STM32F746_PD0_FUNC_ANALOG 0x3011 - -#define STM32F746_PD1_FUNC_GPIO 0x3100 -#define STM32F746_PD1_FUNC_CAN1_TX 0x310a -#define STM32F746_PD1_FUNC_FMC_D3 0x310d -#define STM32F746_PD1_FUNC_EVENTOUT 0x3110 -#define STM32F746_PD1_FUNC_ANALOG 0x3111 - -#define STM32F746_PD2_FUNC_GPIO 0x3200 -#define STM32F746_PD2_FUNC_TRACED2 0x3201 -#define STM32F746_PD2_FUNC_TIM3_ETR 0x3203 -#define STM32F746_PD2_FUNC_UART5_RX 0x3209 -#define STM32F746_PD2_FUNC_SDMMC1_CMD 0x320d -#define STM32F746_PD2_FUNC_DCMI_D11 0x320e -#define STM32F746_PD2_FUNC_EVENTOUT 0x3210 -#define STM32F746_PD2_FUNC_ANALOG 0x3211 - -#define STM32F746_PD3_FUNC_GPIO 0x3300 -#define STM32F746_PD3_FUNC_SPI2_SCK_I2S2_CK 0x3306 -#define STM32F746_PD3_FUNC_USART2_CTS 0x3308 -#define STM32F746_PD3_FUNC_FMC_CLK 0x330d -#define STM32F746_PD3_FUNC_DCMI_D5 0x330e -#define STM32F746_PD3_FUNC_LCD_G7 0x330f -#define STM32F746_PD3_FUNC_EVENTOUT 0x3310 -#define STM32F746_PD3_FUNC_ANALOG 0x3311 - -#define STM32F746_PD4_FUNC_GPIO 0x3400 -#define STM32F746_PD4_FUNC_USART2_RTS 0x3408 -#define STM32F746_PD4_FUNC_FMC_NOE 0x340d -#define STM32F746_PD4_FUNC_EVENTOUT 0x3410 -#define STM32F746_PD4_FUNC_ANALOG 0x3411 - -#define STM32F746_PD5_FUNC_GPIO 0x3500 -#define STM32F746_PD5_FUNC_USART2_TX 0x3508 -#define STM32F746_PD5_FUNC_FMC_NWE 0x350d -#define STM32F746_PD5_FUNC_EVENTOUT 0x3510 -#define STM32F746_PD5_FUNC_ANALOG 0x3511 - -#define STM32F746_PD6_FUNC_GPIO 0x3600 -#define STM32F746_PD6_FUNC_SPI3_MOSI_I2S3_SD 0x3606 -#define STM32F746_PD6_FUNC_SAI1_SD_A 0x3607 -#define STM32F746_PD6_FUNC_USART2_RX 0x3608 -#define STM32F746_PD6_FUNC_FMC_NWAIT 0x360d -#define STM32F746_PD6_FUNC_DCMI_D10 0x360e -#define STM32F746_PD6_FUNC_LCD_B2 0x360f -#define STM32F746_PD6_FUNC_EVENTOUT 0x3610 -#define STM32F746_PD6_FUNC_ANALOG 0x3611 - -#define STM32F746_PD7_FUNC_GPIO 0x3700 -#define STM32F746_PD7_FUNC_USART2_CK 0x3708 -#define STM32F746_PD7_FUNC_SPDIFRX_IN0 0x3709 -#define STM32F746_PD7_FUNC_FMC_NE1 0x370d -#define STM32F746_PD7_FUNC_EVENTOUT 0x3710 -#define STM32F746_PD7_FUNC_ANALOG 0x3711 - -#define STM32F746_PD8_FUNC_GPIO 0x3800 -#define STM32F746_PD8_FUNC_USART3_TX 0x3808 -#define STM32F746_PD8_FUNC_SPDIFRX_IN1 0x3809 -#define STM32F746_PD8_FUNC_FMC_D13 0x380d -#define STM32F746_PD8_FUNC_EVENTOUT 0x3810 -#define STM32F746_PD8_FUNC_ANALOG 0x3811 - -#define STM32F746_PD9_FUNC_GPIO 0x3900 -#define STM32F746_PD9_FUNC_USART3_RX 0x3908 -#define STM32F746_PD9_FUNC_FMC_D14 0x390d -#define STM32F746_PD9_FUNC_EVENTOUT 0x3910 -#define STM32F746_PD9_FUNC_ANALOG 0x3911 - -#define STM32F746_PD10_FUNC_GPIO 0x3a00 -#define STM32F746_PD10_FUNC_USART3_CK 0x3a08 -#define STM32F746_PD10_FUNC_FMC_D15 0x3a0d -#define STM32F746_PD10_FUNC_LCD_B3 0x3a0f -#define STM32F746_PD10_FUNC_EVENTOUT 0x3a10 -#define STM32F746_PD10_FUNC_ANALOG 0x3a11 - -#define STM32F746_PD11_FUNC_GPIO 0x3b00 -#define STM32F746_PD11_FUNC_I2C4_SMBA 0x3b05 -#define STM32F746_PD11_FUNC_USART3_CTS 0x3b08 -#define STM32F746_PD11_FUNC_QUADSPI_BK1_IO0 0x3b0a -#define STM32F746_PD11_FUNC_SAI2_SD_A 0x3b0b -#define STM32F746_PD11_FUNC_FMC_A16_FMC_CLE 0x3b0d -#define STM32F746_PD11_FUNC_EVENTOUT 0x3b10 -#define STM32F746_PD11_FUNC_ANALOG 0x3b11 - -#define STM32F746_PD12_FUNC_GPIO 0x3c00 -#define STM32F746_PD12_FUNC_TIM4_CH1 0x3c03 -#define STM32F746_PD12_FUNC_LPTIM1_IN1 0x3c04 -#define STM32F746_PD12_FUNC_I2C4_SCL 0x3c05 -#define STM32F746_PD12_FUNC_USART3_RTS 0x3c08 -#define STM32F746_PD12_FUNC_QUADSPI_BK1_IO1 0x3c0a -#define STM32F746_PD12_FUNC_SAI2_FS_A 0x3c0b -#define STM32F746_PD12_FUNC_FMC_A17_FMC_ALE 0x3c0d -#define STM32F746_PD12_FUNC_EVENTOUT 0x3c10 -#define STM32F746_PD12_FUNC_ANALOG 0x3c11 - -#define STM32F746_PD13_FUNC_GPIO 0x3d00 -#define STM32F746_PD13_FUNC_TIM4_CH2 0x3d03 -#define STM32F746_PD13_FUNC_LPTIM1_OUT 0x3d04 -#define STM32F746_PD13_FUNC_I2C4_SDA 0x3d05 -#define STM32F746_PD13_FUNC_QUADSPI_BK1_IO3 0x3d0a -#define STM32F746_PD13_FUNC_SAI2_SCK_A 0x3d0b -#define STM32F746_PD13_FUNC_FMC_A18 0x3d0d -#define STM32F746_PD13_FUNC_EVENTOUT 0x3d10 -#define STM32F746_PD13_FUNC_ANALOG 0x3d11 - -#define STM32F746_PD14_FUNC_GPIO 0x3e00 -#define STM32F746_PD14_FUNC_TIM4_CH3 0x3e03 -#define STM32F746_PD14_FUNC_UART8_CTS 0x3e09 -#define STM32F746_PD14_FUNC_FMC_D0 0x3e0d -#define STM32F746_PD14_FUNC_EVENTOUT 0x3e10 -#define STM32F746_PD14_FUNC_ANALOG 0x3e11 - -#define STM32F746_PD15_FUNC_GPIO 0x3f00 -#define STM32F746_PD15_FUNC_TIM4_CH4 0x3f03 -#define STM32F746_PD15_FUNC_UART8_RTS 0x3f09 -#define STM32F746_PD15_FUNC_FMC_D1 0x3f0d -#define STM32F746_PD15_FUNC_EVENTOUT 0x3f10 -#define STM32F746_PD15_FUNC_ANALOG 0x3f11 - - -#define STM32F746_PE0_FUNC_GPIO 0x4000 -#define STM32F746_PE0_FUNC_TIM4_ETR 0x4003 -#define STM32F746_PE0_FUNC_LPTIM1_ETR 0x4004 -#define STM32F746_PE0_FUNC_UART8_RX 0x4009 -#define STM32F746_PE0_FUNC_SAI2_MCLK_A 0x400b -#define STM32F746_PE0_FUNC_FMC_NBL0 0x400d -#define STM32F746_PE0_FUNC_DCMI_D2 0x400e -#define STM32F746_PE0_FUNC_EVENTOUT 0x4010 -#define STM32F746_PE0_FUNC_ANALOG 0x4011 - -#define STM32F746_PE1_FUNC_GPIO 0x4100 -#define STM32F746_PE1_FUNC_LPTIM1_IN2 0x4104 -#define STM32F746_PE1_FUNC_UART8_TX 0x4109 -#define STM32F746_PE1_FUNC_FMC_NBL1 0x410d -#define STM32F746_PE1_FUNC_DCMI_D3 0x410e -#define STM32F746_PE1_FUNC_EVENTOUT 0x4110 -#define STM32F746_PE1_FUNC_ANALOG 0x4111 - -#define STM32F746_PE2_FUNC_GPIO 0x4200 -#define STM32F746_PE2_FUNC_TRACECLK 0x4201 -#define STM32F746_PE2_FUNC_SPI4_SCK 0x4206 -#define STM32F746_PE2_FUNC_SAI1_MCLK_A 0x4207 -#define STM32F746_PE2_FUNC_QUADSPI_BK1_IO2 0x420a -#define STM32F746_PE2_FUNC_ETH_MII_TXD3 0x420c -#define STM32F746_PE2_FUNC_FMC_A23 0x420d -#define STM32F746_PE2_FUNC_EVENTOUT 0x4210 -#define STM32F746_PE2_FUNC_ANALOG 0x4211 - -#define STM32F746_PE3_FUNC_GPIO 0x4300 -#define STM32F746_PE3_FUNC_TRACED0 0x4301 -#define STM32F746_PE3_FUNC_SAI1_SD_B 0x4307 -#define STM32F746_PE3_FUNC_FMC_A19 0x430d -#define STM32F746_PE3_FUNC_EVENTOUT 0x4310 -#define STM32F746_PE3_FUNC_ANALOG 0x4311 - -#define STM32F746_PE4_FUNC_GPIO 0x4400 -#define STM32F746_PE4_FUNC_TRACED1 0x4401 -#define STM32F746_PE4_FUNC_SPI4_NSS 0x4406 -#define STM32F746_PE4_FUNC_SAI1_FS_A 0x4407 -#define STM32F746_PE4_FUNC_FMC_A20 0x440d -#define STM32F746_PE4_FUNC_DCMI_D4 0x440e -#define STM32F746_PE4_FUNC_LCD_B0 0x440f -#define STM32F746_PE4_FUNC_EVENTOUT 0x4410 -#define STM32F746_PE4_FUNC_ANALOG 0x4411 - -#define STM32F746_PE5_FUNC_GPIO 0x4500 -#define STM32F746_PE5_FUNC_TRACED2 0x4501 -#define STM32F746_PE5_FUNC_TIM9_CH1 0x4504 -#define STM32F746_PE5_FUNC_SPI4_MISO 0x4506 -#define STM32F746_PE5_FUNC_SAI1_SCK_A 0x4507 -#define STM32F746_PE5_FUNC_FMC_A21 0x450d -#define STM32F746_PE5_FUNC_DCMI_D6 0x450e -#define STM32F746_PE5_FUNC_LCD_G0 0x450f -#define STM32F746_PE5_FUNC_EVENTOUT 0x4510 -#define STM32F746_PE5_FUNC_ANALOG 0x4511 - -#define STM32F746_PE6_FUNC_GPIO 0x4600 -#define STM32F746_PE6_FUNC_TRACED3 0x4601 -#define STM32F746_PE6_FUNC_TIM1_BKIN2 0x4602 -#define STM32F746_PE6_FUNC_TIM9_CH2 0x4604 -#define STM32F746_PE6_FUNC_SPI4_MOSI 0x4606 -#define STM32F746_PE6_FUNC_SAI1_SD_A 0x4607 -#define STM32F746_PE6_FUNC_SAI2_MCLK_B 0x460b -#define STM32F746_PE6_FUNC_FMC_A22 0x460d -#define STM32F746_PE6_FUNC_DCMI_D7 0x460e -#define STM32F746_PE6_FUNC_LCD_G1 0x460f -#define STM32F746_PE6_FUNC_EVENTOUT 0x4610 -#define STM32F746_PE6_FUNC_ANALOG 0x4611 - -#define STM32F746_PE7_FUNC_GPIO 0x4700 -#define STM32F746_PE7_FUNC_TIM1_ETR 0x4702 -#define STM32F746_PE7_FUNC_UART7_RX 0x4709 -#define STM32F746_PE7_FUNC_QUADSPI_BK2_IO0 0x470b -#define STM32F746_PE7_FUNC_FMC_D4 0x470d -#define STM32F746_PE7_FUNC_EVENTOUT 0x4710 -#define STM32F746_PE7_FUNC_ANALOG 0x4711 - -#define STM32F746_PE8_FUNC_GPIO 0x4800 -#define STM32F746_PE8_FUNC_TIM1_CH1N 0x4802 -#define STM32F746_PE8_FUNC_UART7_TX 0x4809 -#define STM32F746_PE8_FUNC_QUADSPI_BK2_IO1 0x480b -#define STM32F746_PE8_FUNC_FMC_D5 0x480d -#define STM32F746_PE8_FUNC_EVENTOUT 0x4810 -#define STM32F746_PE8_FUNC_ANALOG 0x4811 - -#define STM32F746_PE9_FUNC_GPIO 0x4900 -#define STM32F746_PE9_FUNC_TIM1_CH1 0x4902 -#define STM32F746_PE9_FUNC_UART7_RTS 0x4909 -#define STM32F746_PE9_FUNC_QUADSPI_BK2_IO2 0x490b -#define STM32F746_PE9_FUNC_FMC_D6 0x490d -#define STM32F746_PE9_FUNC_EVENTOUT 0x4910 -#define STM32F746_PE9_FUNC_ANALOG 0x4911 - -#define STM32F746_PE10_FUNC_GPIO 0x4a00 -#define STM32F746_PE10_FUNC_TIM1_CH2N 0x4a02 -#define STM32F746_PE10_FUNC_UART7_CTS 0x4a09 -#define STM32F746_PE10_FUNC_QUADSPI_BK2_IO3 0x4a0b -#define STM32F746_PE10_FUNC_FMC_D7 0x4a0d -#define STM32F746_PE10_FUNC_EVENTOUT 0x4a10 -#define STM32F746_PE10_FUNC_ANALOG 0x4a11 - -#define STM32F746_PE11_FUNC_GPIO 0x4b00 -#define STM32F746_PE11_FUNC_TIM1_CH2 0x4b02 -#define STM32F746_PE11_FUNC_SPI4_NSS 0x4b06 -#define STM32F746_PE11_FUNC_SAI2_SD_B 0x4b0b -#define STM32F746_PE11_FUNC_FMC_D8 0x4b0d -#define STM32F746_PE11_FUNC_LCD_G3 0x4b0f -#define STM32F746_PE11_FUNC_EVENTOUT 0x4b10 -#define STM32F746_PE11_FUNC_ANALOG 0x4b11 - -#define STM32F746_PE12_FUNC_GPIO 0x4c00 -#define STM32F746_PE12_FUNC_TIM1_CH3N 0x4c02 -#define STM32F746_PE12_FUNC_SPI4_SCK 0x4c06 -#define STM32F746_PE12_FUNC_SAI2_SCK_B 0x4c0b -#define STM32F746_PE12_FUNC_FMC_D9 0x4c0d -#define STM32F746_PE12_FUNC_LCD_B4 0x4c0f -#define STM32F746_PE12_FUNC_EVENTOUT 0x4c10 -#define STM32F746_PE12_FUNC_ANALOG 0x4c11 - -#define STM32F746_PE13_FUNC_GPIO 0x4d00 -#define STM32F746_PE13_FUNC_TIM1_CH3 0x4d02 -#define STM32F746_PE13_FUNC_SPI4_MISO 0x4d06 -#define STM32F746_PE13_FUNC_SAI2_FS_B 0x4d0b -#define STM32F746_PE13_FUNC_FMC_D10 0x4d0d -#define STM32F746_PE13_FUNC_LCD_DE 0x4d0f -#define STM32F746_PE13_FUNC_EVENTOUT 0x4d10 -#define STM32F746_PE13_FUNC_ANALOG 0x4d11 - -#define STM32F746_PE14_FUNC_GPIO 0x4e00 -#define STM32F746_PE14_FUNC_TIM1_CH4 0x4e02 -#define STM32F746_PE14_FUNC_SPI4_MOSI 0x4e06 -#define STM32F746_PE14_FUNC_SAI2_MCLK_B 0x4e0b -#define STM32F746_PE14_FUNC_FMC_D11 0x4e0d -#define STM32F746_PE14_FUNC_LCD_CLK 0x4e0f -#define STM32F746_PE14_FUNC_EVENTOUT 0x4e10 -#define STM32F746_PE14_FUNC_ANALOG 0x4e11 - -#define STM32F746_PE15_FUNC_GPIO 0x4f00 -#define STM32F746_PE15_FUNC_TIM1_BKIN 0x4f02 -#define STM32F746_PE15_FUNC_FMC_D12 0x4f0d -#define STM32F746_PE15_FUNC_LCD_R7 0x4f0f -#define STM32F746_PE15_FUNC_EVENTOUT 0x4f10 -#define STM32F746_PE15_FUNC_ANALOG 0x4f11 - - -#define STM32F746_PF0_FUNC_GPIO 0x5000 -#define STM32F746_PF0_FUNC_I2C2_SDA 0x5005 -#define STM32F746_PF0_FUNC_FMC_A0 0x500d -#define STM32F746_PF0_FUNC_EVENTOUT 0x5010 -#define STM32F746_PF0_FUNC_ANALOG 0x5011 - -#define STM32F746_PF1_FUNC_GPIO 0x5100 -#define STM32F746_PF1_FUNC_I2C2_SCL 0x5105 -#define STM32F746_PF1_FUNC_FMC_A1 0x510d -#define STM32F746_PF1_FUNC_EVENTOUT 0x5110 -#define STM32F746_PF1_FUNC_ANALOG 0x5111 - -#define STM32F746_PF2_FUNC_GPIO 0x5200 -#define STM32F746_PF2_FUNC_I2C2_SMBA 0x5205 -#define STM32F746_PF2_FUNC_FMC_A2 0x520d -#define STM32F746_PF2_FUNC_EVENTOUT 0x5210 -#define STM32F746_PF2_FUNC_ANALOG 0x5211 - -#define STM32F746_PF3_FUNC_GPIO 0x5300 -#define STM32F746_PF3_FUNC_FMC_A3 0x530d -#define STM32F746_PF3_FUNC_EVENTOUT 0x5310 -#define STM32F746_PF3_FUNC_ANALOG 0x5311 - -#define STM32F746_PF4_FUNC_GPIO 0x5400 -#define STM32F746_PF4_FUNC_FMC_A4 0x540d -#define STM32F746_PF4_FUNC_EVENTOUT 0x5410 -#define STM32F746_PF4_FUNC_ANALOG 0x5411 - -#define STM32F746_PF5_FUNC_GPIO 0x5500 -#define STM32F746_PF5_FUNC_FMC_A5 0x550d -#define STM32F746_PF5_FUNC_EVENTOUT 0x5510 -#define STM32F746_PF5_FUNC_ANALOG 0x5511 - -#define STM32F746_PF6_FUNC_GPIO 0x5600 -#define STM32F746_PF6_FUNC_TIM10_CH1 0x5604 -#define STM32F746_PF6_FUNC_SPI5_NSS 0x5606 -#define STM32F746_PF6_FUNC_SAI1_SD_B 0x5607 -#define STM32F746_PF6_FUNC_UART7_RX 0x5609 -#define STM32F746_PF6_FUNC_QUADSPI_BK1_IO3 0x560a -#define STM32F746_PF6_FUNC_EVENTOUT 0x5610 -#define STM32F746_PF6_FUNC_ANALOG 0x5611 - -#define STM32F746_PF7_FUNC_GPIO 0x5700 -#define STM32F746_PF7_FUNC_TIM11_CH1 0x5704 -#define STM32F746_PF7_FUNC_SPI5_SCK 0x5706 -#define STM32F746_PF7_FUNC_SAI1_MCLK_B 0x5707 -#define STM32F746_PF7_FUNC_UART7_TX 0x5709 -#define STM32F746_PF7_FUNC_QUADSPI_BK1_IO2 0x570a -#define STM32F746_PF7_FUNC_EVENTOUT 0x5710 -#define STM32F746_PF7_FUNC_ANALOG 0x5711 - -#define STM32F746_PF8_FUNC_GPIO 0x5800 -#define STM32F746_PF8_FUNC_SPI5_MISO 0x5806 -#define STM32F746_PF8_FUNC_SAI1_SCK_B 0x5807 -#define STM32F746_PF8_FUNC_UART7_RTS 0x5809 -#define STM32F746_PF8_FUNC_TIM13_CH1 0x580a -#define STM32F746_PF8_FUNC_QUADSPI_BK1_IO0 0x580b -#define STM32F746_PF8_FUNC_EVENTOUT 0x5810 -#define STM32F746_PF8_FUNC_ANALOG 0x5811 - -#define STM32F746_PF9_FUNC_GPIO 0x5900 -#define STM32F746_PF9_FUNC_SPI5_MOSI 0x5906 -#define STM32F746_PF9_FUNC_SAI1_FS_B 0x5907 -#define STM32F746_PF9_FUNC_UART7_CTS 0x5909 -#define STM32F746_PF9_FUNC_TIM14_CH1 0x590a -#define STM32F746_PF9_FUNC_QUADSPI_BK1_IO1 0x590b -#define STM32F746_PF9_FUNC_EVENTOUT 0x5910 -#define STM32F746_PF9_FUNC_ANALOG 0x5911 - -#define STM32F746_PF10_FUNC_GPIO 0x5a00 -#define STM32F746_PF10_FUNC_DCMI_D11 0x5a0e -#define STM32F746_PF10_FUNC_LCD_DE 0x5a0f -#define STM32F746_PF10_FUNC_EVENTOUT 0x5a10 -#define STM32F746_PF10_FUNC_ANALOG 0x5a11 - -#define STM32F746_PF11_FUNC_GPIO 0x5b00 -#define STM32F746_PF11_FUNC_SPI5_MOSI 0x5b06 -#define STM32F746_PF11_FUNC_SAI2_SD_B 0x5b0b -#define STM32F746_PF11_FUNC_FMC_SDNRAS 0x5b0d -#define STM32F746_PF11_FUNC_DCMI_D12 0x5b0e -#define STM32F746_PF11_FUNC_EVENTOUT 0x5b10 -#define STM32F746_PF11_FUNC_ANALOG 0x5b11 - -#define STM32F746_PF12_FUNC_GPIO 0x5c00 -#define STM32F746_PF12_FUNC_FMC_A6 0x5c0d -#define STM32F746_PF12_FUNC_EVENTOUT 0x5c10 -#define STM32F746_PF12_FUNC_ANALOG 0x5c11 - -#define STM32F746_PF13_FUNC_GPIO 0x5d00 -#define STM32F746_PF13_FUNC_I2C4_SMBA 0x5d05 -#define STM32F746_PF13_FUNC_FMC_A7 0x5d0d -#define STM32F746_PF13_FUNC_EVENTOUT 0x5d10 -#define STM32F746_PF13_FUNC_ANALOG 0x5d11 - -#define STM32F746_PF14_FUNC_GPIO 0x5e00 -#define STM32F746_PF14_FUNC_I2C4_SCL 0x5e05 -#define STM32F746_PF14_FUNC_FMC_A8 0x5e0d -#define STM32F746_PF14_FUNC_EVENTOUT 0x5e10 -#define STM32F746_PF14_FUNC_ANALOG 0x5e11 - -#define STM32F746_PF15_FUNC_GPIO 0x5f00 -#define STM32F746_PF15_FUNC_I2C4_SDA 0x5f05 -#define STM32F746_PF15_FUNC_FMC_A9 0x5f0d -#define STM32F746_PF15_FUNC_EVENTOUT 0x5f10 -#define STM32F746_PF15_FUNC_ANALOG 0x5f11 - - -#define STM32F746_PG0_FUNC_GPIO 0x6000 -#define STM32F746_PG0_FUNC_FMC_A10 0x600d -#define STM32F746_PG0_FUNC_EVENTOUT 0x6010 -#define STM32F746_PG0_FUNC_ANALOG 0x6011 - -#define STM32F746_PG1_FUNC_GPIO 0x6100 -#define STM32F746_PG1_FUNC_FMC_A11 0x610d -#define STM32F746_PG1_FUNC_EVENTOUT 0x6110 -#define STM32F746_PG1_FUNC_ANALOG 0x6111 - -#define STM32F746_PG2_FUNC_GPIO 0x6200 -#define STM32F746_PG2_FUNC_FMC_A12 0x620d -#define STM32F746_PG2_FUNC_EVENTOUT 0x6210 -#define STM32F746_PG2_FUNC_ANALOG 0x6211 - -#define STM32F746_PG3_FUNC_GPIO 0x6300 -#define STM32F746_PG3_FUNC_FMC_A13 0x630d -#define STM32F746_PG3_FUNC_EVENTOUT 0x6310 -#define STM32F746_PG3_FUNC_ANALOG 0x6311 - -#define STM32F746_PG4_FUNC_GPIO 0x6400 -#define STM32F746_PG4_FUNC_FMC_A14_FMC_BA0 0x640d -#define STM32F746_PG4_FUNC_EVENTOUT 0x6410 -#define STM32F746_PG4_FUNC_ANALOG 0x6411 - -#define STM32F746_PG5_FUNC_GPIO 0x6500 -#define STM32F746_PG5_FUNC_FMC_A15_FMC_BA1 0x650d -#define STM32F746_PG5_FUNC_EVENTOUT 0x6510 -#define STM32F746_PG5_FUNC_ANALOG 0x6511 - -#define STM32F746_PG6_FUNC_GPIO 0x6600 -#define STM32F746_PG6_FUNC_DCMI_D12 0x660e -#define STM32F746_PG6_FUNC_LCD_R7 0x660f -#define STM32F746_PG6_FUNC_EVENTOUT 0x6610 -#define STM32F746_PG6_FUNC_ANALOG 0x6611 - -#define STM32F746_PG7_FUNC_GPIO 0x6700 -#define STM32F746_PG7_FUNC_USART6_CK 0x6709 -#define STM32F746_PG7_FUNC_FMC_INT 0x670d -#define STM32F746_PG7_FUNC_DCMI_D13 0x670e -#define STM32F746_PG7_FUNC_LCD_CLK 0x670f -#define STM32F746_PG7_FUNC_EVENTOUT 0x6710 -#define STM32F746_PG7_FUNC_ANALOG 0x6711 - -#define STM32F746_PG8_FUNC_GPIO 0x6800 -#define STM32F746_PG8_FUNC_SPI6_NSS 0x6806 -#define STM32F746_PG8_FUNC_SPDIFRX_IN2 0x6808 -#define STM32F746_PG8_FUNC_USART6_RTS 0x6809 -#define STM32F746_PG8_FUNC_ETH_PPS_OUT 0x680c -#define STM32F746_PG8_FUNC_FMC_SDCLK 0x680d -#define STM32F746_PG8_FUNC_EVENTOUT 0x6810 -#define STM32F746_PG8_FUNC_ANALOG 0x6811 - -#define STM32F746_PG9_FUNC_GPIO 0x6900 -#define STM32F746_PG9_FUNC_SPDIFRX_IN3 0x6908 -#define STM32F746_PG9_FUNC_USART6_RX 0x6909 -#define STM32F746_PG9_FUNC_QUADSPI_BK2_IO2 0x690a -#define STM32F746_PG9_FUNC_SAI2_FS_B 0x690b -#define STM32F746_PG9_FUNC_FMC_NE2_FMC_NCE 0x690d -#define STM32F746_PG9_FUNC_DCMI_VSYNC 0x690e -#define STM32F746_PG9_FUNC_EVENTOUT 0x6910 -#define STM32F746_PG9_FUNC_ANALOG 0x6911 - -#define STM32F746_PG10_FUNC_GPIO 0x6a00 -#define STM32F746_PG10_FUNC_LCD_G3 0x6a0a -#define STM32F746_PG10_FUNC_SAI2_SD_B 0x6a0b -#define STM32F746_PG10_FUNC_FMC_NE3 0x6a0d -#define STM32F746_PG10_FUNC_DCMI_D2 0x6a0e -#define STM32F746_PG10_FUNC_LCD_B2 0x6a0f -#define STM32F746_PG10_FUNC_EVENTOUT 0x6a10 -#define STM32F746_PG10_FUNC_ANALOG 0x6a11 - -#define STM32F746_PG11_FUNC_GPIO 0x6b00 -#define STM32F746_PG11_FUNC_SPDIFRX_IN0 0x6b08 -#define STM32F746_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x6b0c -#define STM32F746_PG11_FUNC_DCMI_D3 0x6b0e -#define STM32F746_PG11_FUNC_LCD_B3 0x6b0f -#define STM32F746_PG11_FUNC_EVENTOUT 0x6b10 -#define STM32F746_PG11_FUNC_ANALOG 0x6b11 - -#define STM32F746_PG12_FUNC_GPIO 0x6c00 -#define STM32F746_PG12_FUNC_LPTIM1_IN1 0x6c04 -#define STM32F746_PG12_FUNC_SPI6_MISO 0x6c06 -#define STM32F746_PG12_FUNC_SPDIFRX_IN1 0x6c08 -#define STM32F746_PG12_FUNC_USART6_RTS 0x6c09 -#define STM32F746_PG12_FUNC_LCD_B4 0x6c0a -#define STM32F746_PG12_FUNC_FMC_NE4 0x6c0d -#define STM32F746_PG12_FUNC_LCD_B1 0x6c0f -#define STM32F746_PG12_FUNC_EVENTOUT 0x6c10 -#define STM32F746_PG12_FUNC_ANALOG 0x6c11 - -#define STM32F746_PG13_FUNC_GPIO 0x6d00 -#define STM32F746_PG13_FUNC_TRACED0 0x6d01 -#define STM32F746_PG13_FUNC_LPTIM1_OUT 0x6d04 -#define STM32F746_PG13_FUNC_SPI6_SCK 0x6d06 -#define STM32F746_PG13_FUNC_USART6_CTS 0x6d09 -#define STM32F746_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x6d0c -#define STM32F746_PG13_FUNC_FMC_A24 0x6d0d -#define STM32F746_PG13_FUNC_LCD_R0 0x6d0f -#define STM32F746_PG13_FUNC_EVENTOUT 0x6d10 -#define STM32F746_PG13_FUNC_ANALOG 0x6d11 - -#define STM32F746_PG14_FUNC_GPIO 0x6e00 -#define STM32F746_PG14_FUNC_TRACED1 0x6e01 -#define STM32F746_PG14_FUNC_LPTIM1_ETR 0x6e04 -#define STM32F746_PG14_FUNC_SPI6_MOSI 0x6e06 -#define STM32F746_PG14_FUNC_USART6_TX 0x6e09 -#define STM32F746_PG14_FUNC_QUADSPI_BK2_IO3 0x6e0a -#define STM32F746_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x6e0c -#define STM32F746_PG14_FUNC_FMC_A25 0x6e0d -#define STM32F746_PG14_FUNC_LCD_B0 0x6e0f -#define STM32F746_PG14_FUNC_EVENTOUT 0x6e10 -#define STM32F746_PG14_FUNC_ANALOG 0x6e11 - -#define STM32F746_PG15_FUNC_GPIO 0x6f00 -#define STM32F746_PG15_FUNC_USART6_CTS 0x6f09 -#define STM32F746_PG15_FUNC_FMC_SDNCAS 0x6f0d -#define STM32F746_PG15_FUNC_DCMI_D13 0x6f0e -#define STM32F746_PG15_FUNC_EVENTOUT 0x6f10 -#define STM32F746_PG15_FUNC_ANALOG 0x6f11 - - -#define STM32F746_PH0_FUNC_GPIO 0x7000 -#define STM32F746_PH0_FUNC_EVENTOUT 0x7010 -#define STM32F746_PH0_FUNC_ANALOG 0x7011 - -#define STM32F746_PH1_FUNC_GPIO 0x7100 -#define STM32F746_PH1_FUNC_EVENTOUT 0x7110 -#define STM32F746_PH1_FUNC_ANALOG 0x7111 - -#define STM32F746_PH2_FUNC_GPIO 0x7200 -#define STM32F746_PH2_FUNC_LPTIM1_IN2 0x7204 -#define STM32F746_PH2_FUNC_QUADSPI_BK2_IO0 0x720a -#define STM32F746_PH2_FUNC_SAI2_SCK_B 0x720b -#define STM32F746_PH2_FUNC_ETH_MII_CRS 0x720c -#define STM32F746_PH2_FUNC_FMC_SDCKE0 0x720d -#define STM32F746_PH2_FUNC_LCD_R0 0x720f -#define STM32F746_PH2_FUNC_EVENTOUT 0x7210 -#define STM32F746_PH2_FUNC_ANALOG 0x7211 - -#define STM32F746_PH3_FUNC_GPIO 0x7300 -#define STM32F746_PH3_FUNC_QUADSPI_BK2_IO1 0x730a -#define STM32F746_PH3_FUNC_SAI2_MCLK_B 0x730b -#define STM32F746_PH3_FUNC_ETH_MII_COL 0x730c -#define STM32F746_PH3_FUNC_FMC_SDNE0 0x730d -#define STM32F746_PH3_FUNC_LCD_R1 0x730f -#define STM32F746_PH3_FUNC_EVENTOUT 0x7310 -#define STM32F746_PH3_FUNC_ANALOG 0x7311 - -#define STM32F746_PH4_FUNC_GPIO 0x7400 -#define STM32F746_PH4_FUNC_I2C2_SCL 0x7405 -#define STM32F746_PH4_FUNC_OTG_HS_ULPI_NXT 0x740b -#define STM32F746_PH4_FUNC_EVENTOUT 0x7410 -#define STM32F746_PH4_FUNC_ANALOG 0x7411 - -#define STM32F746_PH5_FUNC_GPIO 0x7500 -#define STM32F746_PH5_FUNC_I2C2_SDA 0x7505 -#define STM32F746_PH5_FUNC_SPI5_NSS 0x7506 -#define STM32F746_PH5_FUNC_FMC_SDNWE 0x750d -#define STM32F746_PH5_FUNC_EVENTOUT 0x7510 -#define STM32F746_PH5_FUNC_ANALOG 0x7511 - -#define STM32F746_PH6_FUNC_GPIO 0x7600 -#define STM32F746_PH6_FUNC_I2C2_SMBA 0x7605 -#define STM32F746_PH6_FUNC_SPI5_SCK 0x7606 -#define STM32F746_PH6_FUNC_TIM12_CH1 0x760a -#define STM32F746_PH6_FUNC_ETH_MII_RXD2 0x760c -#define STM32F746_PH6_FUNC_FMC_SDNE1 0x760d -#define STM32F746_PH6_FUNC_DCMI_D8 0x760e -#define STM32F746_PH6_FUNC_EVENTOUT 0x7610 -#define STM32F746_PH6_FUNC_ANALOG 0x7611 - -#define STM32F746_PH7_FUNC_GPIO 0x7700 -#define STM32F746_PH7_FUNC_I2C3_SCL 0x7705 -#define STM32F746_PH7_FUNC_SPI5_MISO 0x7706 -#define STM32F746_PH7_FUNC_ETH_MII_RXD3 0x770c -#define STM32F746_PH7_FUNC_FMC_SDCKE1 0x770d -#define STM32F746_PH7_FUNC_DCMI_D9 0x770e -#define STM32F746_PH7_FUNC_EVENTOUT 0x7710 -#define STM32F746_PH7_FUNC_ANALOG 0x7711 - -#define STM32F746_PH8_FUNC_GPIO 0x7800 -#define STM32F746_PH8_FUNC_I2C3_SDA 0x7805 -#define STM32F746_PH8_FUNC_FMC_D16 0x780d -#define STM32F746_PH8_FUNC_DCMI_HSYNC 0x780e -#define STM32F746_PH8_FUNC_LCD_R2 0x780f -#define STM32F746_PH8_FUNC_EVENTOUT 0x7810 -#define STM32F746_PH8_FUNC_ANALOG 0x7811 - -#define STM32F746_PH9_FUNC_GPIO 0x7900 -#define STM32F746_PH9_FUNC_I2C3_SMBA 0x7905 -#define STM32F746_PH9_FUNC_TIM12_CH2 0x790a -#define STM32F746_PH9_FUNC_FMC_D17 0x790d -#define STM32F746_PH9_FUNC_DCMI_D0 0x790e -#define STM32F746_PH9_FUNC_LCD_R3 0x790f -#define STM32F746_PH9_FUNC_EVENTOUT 0x7910 -#define STM32F746_PH9_FUNC_ANALOG 0x7911 - -#define STM32F746_PH10_FUNC_GPIO 0x7a00 -#define STM32F746_PH10_FUNC_TIM5_CH1 0x7a03 -#define STM32F746_PH10_FUNC_I2C4_SMBA 0x7a05 -#define STM32F746_PH10_FUNC_FMC_D18 0x7a0d -#define STM32F746_PH10_FUNC_DCMI_D1 0x7a0e -#define STM32F746_PH10_FUNC_LCD_R4 0x7a0f -#define STM32F746_PH10_FUNC_EVENTOUT 0x7a10 -#define STM32F746_PH10_FUNC_ANALOG 0x7a11 - -#define STM32F746_PH11_FUNC_GPIO 0x7b00 -#define STM32F746_PH11_FUNC_TIM5_CH2 0x7b03 -#define STM32F746_PH11_FUNC_I2C4_SCL 0x7b05 -#define STM32F746_PH11_FUNC_FMC_D19 0x7b0d -#define STM32F746_PH11_FUNC_DCMI_D2 0x7b0e -#define STM32F746_PH11_FUNC_LCD_R5 0x7b0f -#define STM32F746_PH11_FUNC_EVENTOUT 0x7b10 -#define STM32F746_PH11_FUNC_ANALOG 0x7b11 - -#define STM32F746_PH12_FUNC_GPIO 0x7c00 -#define STM32F746_PH12_FUNC_TIM5_CH3 0x7c03 -#define STM32F746_PH12_FUNC_I2C4_SDA 0x7c05 -#define STM32F746_PH12_FUNC_FMC_D20 0x7c0d -#define STM32F746_PH12_FUNC_DCMI_D3 0x7c0e -#define STM32F746_PH12_FUNC_LCD_R6 0x7c0f -#define STM32F746_PH12_FUNC_EVENTOUT 0x7c10 -#define STM32F746_PH12_FUNC_ANALOG 0x7c11 - -#define STM32F746_PH13_FUNC_GPIO 0x7d00 -#define STM32F746_PH13_FUNC_TIM8_CH1N 0x7d04 -#define STM32F746_PH13_FUNC_CAN1_TX 0x7d0a -#define STM32F746_PH13_FUNC_FMC_D21 0x7d0d -#define STM32F746_PH13_FUNC_LCD_G2 0x7d0f -#define STM32F746_PH13_FUNC_EVENTOUT 0x7d10 -#define STM32F746_PH13_FUNC_ANALOG 0x7d11 - -#define STM32F746_PH14_FUNC_GPIO 0x7e00 -#define STM32F746_PH14_FUNC_TIM8_CH2N 0x7e04 -#define STM32F746_PH14_FUNC_FMC_D22 0x7e0d -#define STM32F746_PH14_FUNC_DCMI_D4 0x7e0e -#define STM32F746_PH14_FUNC_LCD_G3 0x7e0f -#define STM32F746_PH14_FUNC_EVENTOUT 0x7e10 -#define STM32F746_PH14_FUNC_ANALOG 0x7e11 - -#define STM32F746_PH15_FUNC_GPIO 0x7f00 -#define STM32F746_PH15_FUNC_TIM8_CH3N 0x7f04 -#define STM32F746_PH15_FUNC_FMC_D23 0x7f0d -#define STM32F746_PH15_FUNC_DCMI_D11 0x7f0e -#define STM32F746_PH15_FUNC_LCD_G4 0x7f0f -#define STM32F746_PH15_FUNC_EVENTOUT 0x7f10 -#define STM32F746_PH15_FUNC_ANALOG 0x7f11 - - -#define STM32F746_PI0_FUNC_GPIO 0x8000 -#define STM32F746_PI0_FUNC_TIM5_CH4 0x8003 -#define STM32F746_PI0_FUNC_SPI2_NSS_I2S2_WS 0x8006 -#define STM32F746_PI0_FUNC_FMC_D24 0x800d -#define STM32F746_PI0_FUNC_DCMI_D13 0x800e -#define STM32F746_PI0_FUNC_LCD_G5 0x800f -#define STM32F746_PI0_FUNC_EVENTOUT 0x8010 -#define STM32F746_PI0_FUNC_ANALOG 0x8011 - -#define STM32F746_PI1_FUNC_GPIO 0x8100 -#define STM32F746_PI1_FUNC_TIM8_BKIN2 0x8104 -#define STM32F746_PI1_FUNC_SPI2_SCK_I2S2_CK 0x8106 -#define STM32F746_PI1_FUNC_FMC_D25 0x810d -#define STM32F746_PI1_FUNC_DCMI_D8 0x810e -#define STM32F746_PI1_FUNC_LCD_G6 0x810f -#define STM32F746_PI1_FUNC_EVENTOUT 0x8110 -#define STM32F746_PI1_FUNC_ANALOG 0x8111 - -#define STM32F746_PI2_FUNC_GPIO 0x8200 -#define STM32F746_PI2_FUNC_TIM8_CH4 0x8204 -#define STM32F746_PI2_FUNC_SPI2_MISO 0x8206 -#define STM32F746_PI2_FUNC_FMC_D26 0x820d -#define STM32F746_PI2_FUNC_DCMI_D9 0x820e -#define STM32F746_PI2_FUNC_LCD_G7 0x820f -#define STM32F746_PI2_FUNC_EVENTOUT 0x8210 -#define STM32F746_PI2_FUNC_ANALOG 0x8211 - -#define STM32F746_PI3_FUNC_GPIO 0x8300 -#define STM32F746_PI3_FUNC_TIM8_ETR 0x8304 -#define STM32F746_PI3_FUNC_SPI2_MOSI_I2S2_SD 0x8306 -#define STM32F746_PI3_FUNC_FMC_D27 0x830d -#define STM32F746_PI3_FUNC_DCMI_D10 0x830e -#define STM32F746_PI3_FUNC_EVENTOUT 0x8310 -#define STM32F746_PI3_FUNC_ANALOG 0x8311 - -#define STM32F746_PI4_FUNC_GPIO 0x8400 -#define STM32F746_PI4_FUNC_TIM8_BKIN 0x8404 -#define STM32F746_PI4_FUNC_SAI2_MCLK_A 0x840b -#define STM32F746_PI4_FUNC_FMC_NBL2 0x840d -#define STM32F746_PI4_FUNC_DCMI_D5 0x840e -#define STM32F746_PI4_FUNC_LCD_B4 0x840f -#define STM32F746_PI4_FUNC_EVENTOUT 0x8410 -#define STM32F746_PI4_FUNC_ANALOG 0x8411 - -#define STM32F746_PI5_FUNC_GPIO 0x8500 -#define STM32F746_PI5_FUNC_TIM8_CH1 0x8504 -#define STM32F746_PI5_FUNC_SAI2_SCK_A 0x850b -#define STM32F746_PI5_FUNC_FMC_NBL3 0x850d -#define STM32F746_PI5_FUNC_DCMI_VSYNC 0x850e -#define STM32F746_PI5_FUNC_LCD_B5 0x850f -#define STM32F746_PI5_FUNC_EVENTOUT 0x8510 -#define STM32F746_PI5_FUNC_ANALOG 0x8511 - -#define STM32F746_PI6_FUNC_GPIO 0x8600 -#define STM32F746_PI6_FUNC_TIM8_CH2 0x8604 -#define STM32F746_PI6_FUNC_SAI2_SD_A 0x860b -#define STM32F746_PI6_FUNC_FMC_D28 0x860d -#define STM32F746_PI6_FUNC_DCMI_D6 0x860e -#define STM32F746_PI6_FUNC_LCD_B6 0x860f -#define STM32F746_PI6_FUNC_EVENTOUT 0x8610 -#define STM32F746_PI6_FUNC_ANALOG 0x8611 - -#define STM32F746_PI7_FUNC_GPIO 0x8700 -#define STM32F746_PI7_FUNC_TIM8_CH3 0x8704 -#define STM32F746_PI7_FUNC_SAI2_FS_A 0x870b -#define STM32F746_PI7_FUNC_FMC_D29 0x870d -#define STM32F746_PI7_FUNC_DCMI_D7 0x870e -#define STM32F746_PI7_FUNC_LCD_B7 0x870f -#define STM32F746_PI7_FUNC_EVENTOUT 0x8710 -#define STM32F746_PI7_FUNC_ANALOG 0x8711 - -#define STM32F746_PI8_FUNC_GPIO 0x8800 -#define STM32F746_PI8_FUNC_EVENTOUT 0x8810 -#define STM32F746_PI8_FUNC_ANALOG 0x8811 - -#define STM32F746_PI9_FUNC_GPIO 0x8900 -#define STM32F746_PI9_FUNC_CAN1_RX 0x890a -#define STM32F746_PI9_FUNC_FMC_D30 0x890d -#define STM32F746_PI9_FUNC_LCD_VSYNC 0x890f -#define STM32F746_PI9_FUNC_EVENTOUT 0x8910 -#define STM32F746_PI9_FUNC_ANALOG 0x8911 - -#define STM32F746_PI10_FUNC_GPIO 0x8a00 -#define STM32F746_PI10_FUNC_ETH_MII_RX_ER 0x8a0c -#define STM32F746_PI10_FUNC_FMC_D31 0x8a0d -#define STM32F746_PI10_FUNC_LCD_HSYNC 0x8a0f -#define STM32F746_PI10_FUNC_EVENTOUT 0x8a10 -#define STM32F746_PI10_FUNC_ANALOG 0x8a11 - -#define STM32F746_PI11_FUNC_GPIO 0x8b00 -#define STM32F746_PI11_FUNC_OTG_HS_ULPI_DIR 0x8b0b -#define STM32F746_PI11_FUNC_EVENTOUT 0x8b10 -#define STM32F746_PI11_FUNC_ANALOG 0x8b11 - -#define STM32F746_PI12_FUNC_GPIO 0x8c00 -#define STM32F746_PI12_FUNC_LCD_HSYNC 0x8c0f -#define STM32F746_PI12_FUNC_EVENTOUT 0x8c10 -#define STM32F746_PI12_FUNC_ANALOG 0x8c11 - -#define STM32F746_PI13_FUNC_GPIO 0x8d00 -#define STM32F746_PI13_FUNC_LCD_VSYNC 0x8d0f -#define STM32F746_PI13_FUNC_EVENTOUT 0x8d10 -#define STM32F746_PI13_FUNC_ANALOG 0x8d11 - -#define STM32F746_PI14_FUNC_GPIO 0x8e00 -#define STM32F746_PI14_FUNC_LCD_CLK 0x8e0f -#define STM32F746_PI14_FUNC_EVENTOUT 0x8e10 -#define STM32F746_PI14_FUNC_ANALOG 0x8e11 - -#define STM32F746_PI15_FUNC_GPIO 0x8f00 -#define STM32F746_PI15_FUNC_LCD_R0 0x8f0f -#define STM32F746_PI15_FUNC_EVENTOUT 0x8f10 -#define STM32F746_PI15_FUNC_ANALOG 0x8f11 - - -#define STM32F746_PJ0_FUNC_GPIO 0x9000 -#define STM32F746_PJ0_FUNC_LCD_R1 0x900f -#define STM32F746_PJ0_FUNC_EVENTOUT 0x9010 -#define STM32F746_PJ0_FUNC_ANALOG 0x9011 - -#define STM32F746_PJ1_FUNC_GPIO 0x9100 -#define STM32F746_PJ1_FUNC_LCD_R2 0x910f -#define STM32F746_PJ1_FUNC_EVENTOUT 0x9110 -#define STM32F746_PJ1_FUNC_ANALOG 0x9111 - -#define STM32F746_PJ2_FUNC_GPIO 0x9200 -#define STM32F746_PJ2_FUNC_LCD_R3 0x920f -#define STM32F746_PJ2_FUNC_EVENTOUT 0x9210 -#define STM32F746_PJ2_FUNC_ANALOG 0x9211 - -#define STM32F746_PJ3_FUNC_GPIO 0x9300 -#define STM32F746_PJ3_FUNC_LCD_R4 0x930f -#define STM32F746_PJ3_FUNC_EVENTOUT 0x9310 -#define STM32F746_PJ3_FUNC_ANALOG 0x9311 - -#define STM32F746_PJ4_FUNC_GPIO 0x9400 -#define STM32F746_PJ4_FUNC_LCD_R5 0x940f -#define STM32F746_PJ4_FUNC_EVENTOUT 0x9410 -#define STM32F746_PJ4_FUNC_ANALOG 0x9411 - -#define STM32F746_PJ5_FUNC_GPIO 0x9500 -#define STM32F746_PJ5_FUNC_LCD_R6 0x950f -#define STM32F746_PJ5_FUNC_EVENTOUT 0x9510 -#define STM32F746_PJ5_FUNC_ANALOG 0x9511 - -#define STM32F746_PJ6_FUNC_GPIO 0x9600 -#define STM32F746_PJ6_FUNC_LCD_R7 0x960f -#define STM32F746_PJ6_FUNC_EVENTOUT 0x9610 -#define STM32F746_PJ6_FUNC_ANALOG 0x9611 - -#define STM32F746_PJ7_FUNC_GPIO 0x9700 -#define STM32F746_PJ7_FUNC_LCD_G0 0x970f -#define STM32F746_PJ7_FUNC_EVENTOUT 0x9710 -#define STM32F746_PJ7_FUNC_ANALOG 0x9711 - -#define STM32F746_PJ8_FUNC_GPIO 0x9800 -#define STM32F746_PJ8_FUNC_LCD_G1 0x980f -#define STM32F746_PJ8_FUNC_EVENTOUT 0x9810 -#define STM32F746_PJ8_FUNC_ANALOG 0x9811 - -#define STM32F746_PJ9_FUNC_GPIO 0x9900 -#define STM32F746_PJ9_FUNC_LCD_G2 0x990f -#define STM32F746_PJ9_FUNC_EVENTOUT 0x9910 -#define STM32F746_PJ9_FUNC_ANALOG 0x9911 - -#define STM32F746_PJ10_FUNC_GPIO 0x9a00 -#define STM32F746_PJ10_FUNC_LCD_G3 0x9a0f -#define STM32F746_PJ10_FUNC_EVENTOUT 0x9a10 -#define STM32F746_PJ10_FUNC_ANALOG 0x9a11 - -#define STM32F746_PJ11_FUNC_GPIO 0x9b00 -#define STM32F746_PJ11_FUNC_LCD_G4 0x9b0f -#define STM32F746_PJ11_FUNC_EVENTOUT 0x9b10 -#define STM32F746_PJ11_FUNC_ANALOG 0x9b11 - -#define STM32F746_PJ12_FUNC_GPIO 0x9c00 -#define STM32F746_PJ12_FUNC_LCD_B0 0x9c0f -#define STM32F746_PJ12_FUNC_EVENTOUT 0x9c10 -#define STM32F746_PJ12_FUNC_ANALOG 0x9c11 - -#define STM32F746_PJ13_FUNC_GPIO 0x9d00 -#define STM32F746_PJ13_FUNC_LCD_B1 0x9d0f -#define STM32F746_PJ13_FUNC_EVENTOUT 0x9d10 -#define STM32F746_PJ13_FUNC_ANALOG 0x9d11 - -#define STM32F746_PJ14_FUNC_GPIO 0x9e00 -#define STM32F746_PJ14_FUNC_LCD_B2 0x9e0f -#define STM32F746_PJ14_FUNC_EVENTOUT 0x9e10 -#define STM32F746_PJ14_FUNC_ANALOG 0x9e11 - -#define STM32F746_PJ15_FUNC_GPIO 0x9f00 -#define STM32F746_PJ15_FUNC_LCD_B3 0x9f0f -#define STM32F746_PJ15_FUNC_EVENTOUT 0x9f10 -#define STM32F746_PJ15_FUNC_ANALOG 0x9f11 - - -#define STM32F746_PK0_FUNC_GPIO 0xa000 -#define STM32F746_PK0_FUNC_LCD_G5 0xa00f -#define STM32F746_PK0_FUNC_EVENTOUT 0xa010 -#define STM32F746_PK0_FUNC_ANALOG 0xa011 - -#define STM32F746_PK1_FUNC_GPIO 0xa100 -#define STM32F746_PK1_FUNC_LCD_G6 0xa10f -#define STM32F746_PK1_FUNC_EVENTOUT 0xa110 -#define STM32F746_PK1_FUNC_ANALOG 0xa111 - -#define STM32F746_PK2_FUNC_GPIO 0xa200 -#define STM32F746_PK2_FUNC_LCD_G7 0xa20f -#define STM32F746_PK2_FUNC_EVENTOUT 0xa210 -#define STM32F746_PK2_FUNC_ANALOG 0xa211 - -#define STM32F746_PK3_FUNC_GPIO 0xa300 -#define STM32F746_PK3_FUNC_LCD_B4 0xa30f -#define STM32F746_PK3_FUNC_EVENTOUT 0xa310 -#define STM32F746_PK3_FUNC_ANALOG 0xa311 - -#define STM32F746_PK4_FUNC_GPIO 0xa400 -#define STM32F746_PK4_FUNC_LCD_B5 0xa40f -#define STM32F746_PK4_FUNC_EVENTOUT 0xa410 -#define STM32F746_PK4_FUNC_ANALOG 0xa411 - -#define STM32F746_PK5_FUNC_GPIO 0xa500 -#define STM32F746_PK5_FUNC_LCD_B6 0xa50f -#define STM32F746_PK5_FUNC_EVENTOUT 0xa510 -#define STM32F746_PK5_FUNC_ANALOG 0xa511 - -#define STM32F746_PK6_FUNC_GPIO 0xa600 -#define STM32F746_PK6_FUNC_LCD_B7 0xa60f -#define STM32F746_PK6_FUNC_EVENTOUT 0xa610 -#define STM32F746_PK6_FUNC_ANALOG 0xa611 - -#define STM32F746_PK7_FUNC_GPIO 0xa700 -#define STM32F746_PK7_FUNC_LCD_DE 0xa70f -#define STM32F746_PK7_FUNC_EVENTOUT 0xa710 -#define STM32F746_PK7_FUNC_ANALOG 0xa711 - -#endif /* _DT_BINDINGS_STM32F746_PINFUNC_H */ diff --git a/include/dt-bindings/pinctrl/stm32h7-pinfunc.h b/include/dt-bindings/pinctrl/stm32h7-pinfunc.h deleted file mode 100644 index cb673b5e8e1e..000000000000 --- a/include/dt-bindings/pinctrl/stm32h7-pinfunc.h +++ /dev/null @@ -1,1612 +0,0 @@ -#ifndef _DT_BINDINGS_STM32H7_PINFUNC_H -#define _DT_BINDINGS_STM32H7_PINFUNC_H - -#define STM32H7_PA0_FUNC_GPIO 0x0 -#define STM32H7_PA0_FUNC_TIM2_CH1_TIM2_ETR 0x2 -#define STM32H7_PA0_FUNC_TIM5_CH1 0x3 -#define STM32H7_PA0_FUNC_TIM8_ETR 0x4 -#define STM32H7_PA0_FUNC_TIM15_BKIN 0x5 -#define STM32H7_PA0_FUNC_USART2_CTS_NSS 0x8 -#define STM32H7_PA0_FUNC_UART4_TX 0x9 -#define STM32H7_PA0_FUNC_SDMMC2_CMD 0xa -#define STM32H7_PA0_FUNC_SAI2_SD_B 0xb -#define STM32H7_PA0_FUNC_ETH_MII_CRS 0xc -#define STM32H7_PA0_FUNC_EVENTOUT 0x10 -#define STM32H7_PA0_FUNC_ANALOG 0x11 - -#define STM32H7_PA1_FUNC_GPIO 0x100 -#define STM32H7_PA1_FUNC_TIM2_CH2 0x102 -#define STM32H7_PA1_FUNC_TIM5_CH2 0x103 -#define STM32H7_PA1_FUNC_LPTIM3_OUT 0x104 -#define STM32H7_PA1_FUNC_TIM15_CH1N 0x105 -#define STM32H7_PA1_FUNC_USART2_RTS 0x108 -#define STM32H7_PA1_FUNC_UART4_RX 0x109 -#define STM32H7_PA1_FUNC_QUADSPI_BK1_IO3 0x10a -#define STM32H7_PA1_FUNC_SAI2_MCK_B 0x10b -#define STM32H7_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK 0x10c -#define STM32H7_PA1_FUNC_LCD_R2 0x10f -#define STM32H7_PA1_FUNC_EVENTOUT 0x110 -#define STM32H7_PA1_FUNC_ANALOG 0x111 - -#define STM32H7_PA2_FUNC_GPIO 0x200 -#define STM32H7_PA2_FUNC_TIM2_CH3 0x202 -#define STM32H7_PA2_FUNC_TIM5_CH3 0x203 -#define STM32H7_PA2_FUNC_LPTIM4_OUT 0x204 -#define STM32H7_PA2_FUNC_TIM15_CH1 0x205 -#define STM32H7_PA2_FUNC_USART2_TX 0x208 -#define STM32H7_PA2_FUNC_SAI2_SCK_B 0x209 -#define STM32H7_PA2_FUNC_ETH_MDIO 0x20c -#define STM32H7_PA2_FUNC_MDIOS_MDIO 0x20d -#define STM32H7_PA2_FUNC_LCD_R1 0x20f -#define STM32H7_PA2_FUNC_EVENTOUT 0x210 -#define STM32H7_PA2_FUNC_ANALOG 0x211 - -#define STM32H7_PA3_FUNC_GPIO 0x300 -#define STM32H7_PA3_FUNC_TIM2_CH4 0x302 -#define STM32H7_PA3_FUNC_TIM5_CH4 0x303 -#define STM32H7_PA3_FUNC_LPTIM5_OUT 0x304 -#define STM32H7_PA3_FUNC_TIM15_CH2 0x305 -#define STM32H7_PA3_FUNC_USART2_RX 0x308 -#define STM32H7_PA3_FUNC_LCD_B2 0x30a -#define STM32H7_PA3_FUNC_OTG_HS_ULPI_D0 0x30b -#define STM32H7_PA3_FUNC_ETH_MII_COL 0x30c -#define STM32H7_PA3_FUNC_LCD_B5 0x30f -#define STM32H7_PA3_FUNC_EVENTOUT 0x310 -#define STM32H7_PA3_FUNC_ANALOG 0x311 - -#define STM32H7_PA4_FUNC_GPIO 0x400 -#define STM32H7_PA4_FUNC_TIM5_ETR 0x403 -#define STM32H7_PA4_FUNC_SPI1_NSS_I2S1_WS 0x406 -#define STM32H7_PA4_FUNC_SPI3_NSS_I2S3_WS 0x407 -#define STM32H7_PA4_FUNC_USART2_CK 0x408 -#define STM32H7_PA4_FUNC_SPI6_NSS 0x409 -#define STM32H7_PA4_FUNC_OTG_HS_SOF 0x40d -#define STM32H7_PA4_FUNC_DCMI_HSYNC 0x40e -#define STM32H7_PA4_FUNC_LCD_VSYNC 0x40f -#define STM32H7_PA4_FUNC_EVENTOUT 0x410 -#define STM32H7_PA4_FUNC_ANALOG 0x411 - -#define STM32H7_PA5_FUNC_GPIO 0x500 -#define STM32H7_PA5_FUNC_TIM2_CH1_TIM2_ETR 0x502 -#define STM32H7_PA5_FUNC_TIM8_CH1N 0x504 -#define STM32H7_PA5_FUNC_SPI1_SCK_I2S1_CK 0x506 -#define STM32H7_PA5_FUNC_SPI6_SCK 0x509 -#define STM32H7_PA5_FUNC_OTG_HS_ULPI_CK 0x50b -#define STM32H7_PA5_FUNC_LCD_R4 0x50f -#define STM32H7_PA5_FUNC_EVENTOUT 0x510 -#define STM32H7_PA5_FUNC_ANALOG 0x511 - -#define STM32H7_PA6_FUNC_GPIO 0x600 -#define STM32H7_PA6_FUNC_TIM1_BKIN 0x602 -#define STM32H7_PA6_FUNC_TIM3_CH1 0x603 -#define STM32H7_PA6_FUNC_TIM8_BKIN 0x604 -#define STM32H7_PA6_FUNC_SPI1_MISO_I2S1_SDI 0x606 -#define STM32H7_PA6_FUNC_SPI6_MISO 0x609 -#define STM32H7_PA6_FUNC_TIM13_CH1 0x60a -#define STM32H7_PA6_FUNC_TIM8_BKIN_COMP12 0x60b -#define STM32H7_PA6_FUNC_MDIOS_MDC 0x60c -#define STM32H7_PA6_FUNC_TIM1_BKIN_COMP12 0x60d -#define STM32H7_PA6_FUNC_DCMI_PIXCLK 0x60e -#define STM32H7_PA6_FUNC_LCD_G2 0x60f -#define STM32H7_PA6_FUNC_EVENTOUT 0x610 -#define STM32H7_PA6_FUNC_ANALOG 0x611 - -#define STM32H7_PA7_FUNC_GPIO 0x700 -#define STM32H7_PA7_FUNC_TIM1_CH1N 0x702 -#define STM32H7_PA7_FUNC_TIM3_CH2 0x703 -#define STM32H7_PA7_FUNC_TIM8_CH1N 0x704 -#define STM32H7_PA7_FUNC_SPI1_MOSI_I2S1_SDO 0x706 -#define STM32H7_PA7_FUNC_SPI6_MOSI 0x709 -#define STM32H7_PA7_FUNC_TIM14_CH1 0x70a -#define STM32H7_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV 0x70c -#define STM32H7_PA7_FUNC_FMC_SDNWE 0x70d -#define STM32H7_PA7_FUNC_EVENTOUT 0x710 -#define STM32H7_PA7_FUNC_ANALOG 0x711 - -#define STM32H7_PA8_FUNC_GPIO 0x800 -#define STM32H7_PA8_FUNC_MCO1 0x801 -#define STM32H7_PA8_FUNC_TIM1_CH1 0x802 -#define STM32H7_PA8_FUNC_HRTIM_CHB2 0x803 -#define STM32H7_PA8_FUNC_TIM8_BKIN2 0x804 -#define STM32H7_PA8_FUNC_I2C3_SCL 0x805 -#define STM32H7_PA8_FUNC_USART1_CK 0x808 -#define STM32H7_PA8_FUNC_OTG_FS_SOF 0x80b -#define STM32H7_PA8_FUNC_UART7_RX 0x80c -#define STM32H7_PA8_FUNC_TIM8_BKIN2_COMP12 0x80d -#define STM32H7_PA8_FUNC_LCD_B3 0x80e -#define STM32H7_PA8_FUNC_LCD_R6 0x80f -#define STM32H7_PA8_FUNC_EVENTOUT 0x810 -#define STM32H7_PA8_FUNC_ANALOG 0x811 - -#define STM32H7_PA9_FUNC_GPIO 0x900 -#define STM32H7_PA9_FUNC_TIM1_CH2 0x902 -#define STM32H7_PA9_FUNC_HRTIM_CHC1 0x903 -#define STM32H7_PA9_FUNC_LPUART1_TX 0x904 -#define STM32H7_PA9_FUNC_I2C3_SMBA 0x905 -#define STM32H7_PA9_FUNC_SPI2_SCK_I2S2_CK 0x906 -#define STM32H7_PA9_FUNC_USART1_TX 0x908 -#define STM32H7_PA9_FUNC_CAN1_RXFD 0x90a -#define STM32H7_PA9_FUNC_ETH_TX_ER 0x90c -#define STM32H7_PA9_FUNC_DCMI_D0 0x90e -#define STM32H7_PA9_FUNC_LCD_R5 0x90f -#define STM32H7_PA9_FUNC_EVENTOUT 0x910 -#define STM32H7_PA9_FUNC_ANALOG 0x911 - -#define STM32H7_PA10_FUNC_GPIO 0xa00 -#define STM32H7_PA10_FUNC_TIM1_CH3 0xa02 -#define STM32H7_PA10_FUNC_HRTIM_CHC2 0xa03 -#define STM32H7_PA10_FUNC_LPUART1_RX 0xa04 -#define STM32H7_PA10_FUNC_USART1_RX 0xa08 -#define STM32H7_PA10_FUNC_CAN1_TXFD 0xa0a -#define STM32H7_PA10_FUNC_OTG_FS_ID 0xa0b -#define STM32H7_PA10_FUNC_MDIOS_MDIO 0xa0c -#define STM32H7_PA10_FUNC_LCD_B4 0xa0d -#define STM32H7_PA10_FUNC_DCMI_D1 0xa0e -#define STM32H7_PA10_FUNC_LCD_B1 0xa0f -#define STM32H7_PA10_FUNC_EVENTOUT 0xa10 -#define STM32H7_PA10_FUNC_ANALOG 0xa11 - -#define STM32H7_PA11_FUNC_GPIO 0xb00 -#define STM32H7_PA11_FUNC_TIM1_CH4 0xb02 -#define STM32H7_PA11_FUNC_HRTIM_CHD1 0xb03 -#define STM32H7_PA11_FUNC_LPUART1_CTS 0xb04 -#define STM32H7_PA11_FUNC_SPI2_NSS_I2S2_WS 0xb06 -#define STM32H7_PA11_FUNC_UART4_RX 0xb07 -#define STM32H7_PA11_FUNC_USART1_CTS_NSS 0xb08 -#define STM32H7_PA11_FUNC_CAN1_RX 0xb0a -#define STM32H7_PA11_FUNC_OTG_FS_DM 0xb0b -#define STM32H7_PA11_FUNC_LCD_R4 0xb0f -#define STM32H7_PA11_FUNC_EVENTOUT 0xb10 -#define STM32H7_PA11_FUNC_ANALOG 0xb11 - -#define STM32H7_PA12_FUNC_GPIO 0xc00 -#define STM32H7_PA12_FUNC_TIM1_ETR 0xc02 -#define STM32H7_PA12_FUNC_HRTIM_CHD2 0xc03 -#define STM32H7_PA12_FUNC_LPUART1_RTS 0xc04 -#define STM32H7_PA12_FUNC_SPI2_SCK_I2S2_CK 0xc06 -#define STM32H7_PA12_FUNC_UART4_TX 0xc07 -#define STM32H7_PA12_FUNC_USART1_RTS 0xc08 -#define STM32H7_PA12_FUNC_SAI2_FS_B 0xc09 -#define STM32H7_PA12_FUNC_CAN1_TX 0xc0a -#define STM32H7_PA12_FUNC_OTG_FS_DP 0xc0b -#define STM32H7_PA12_FUNC_LCD_R5 0xc0f -#define STM32H7_PA12_FUNC_EVENTOUT 0xc10 -#define STM32H7_PA12_FUNC_ANALOG 0xc11 - -#define STM32H7_PA13_FUNC_GPIO 0xd00 -#define STM32H7_PA13_FUNC_JTMS_SWDIO 0xd01 -#define STM32H7_PA13_FUNC_EVENTOUT 0xd10 -#define STM32H7_PA13_FUNC_ANALOG 0xd11 - -#define STM32H7_PA14_FUNC_GPIO 0xe00 -#define STM32H7_PA14_FUNC_JTCK_SWCLK 0xe01 -#define STM32H7_PA14_FUNC_EVENTOUT 0xe10 -#define STM32H7_PA14_FUNC_ANALOG 0xe11 - -#define STM32H7_PA15_FUNC_GPIO 0xf00 -#define STM32H7_PA15_FUNC_JTDI 0xf01 -#define STM32H7_PA15_FUNC_TIM2_CH1_TIM2_ETR 0xf02 -#define STM32H7_PA15_FUNC_HRTIM_FLT1 0xf03 -#define STM32H7_PA15_FUNC_HDMI_CEC 0xf05 -#define STM32H7_PA15_FUNC_SPI1_NSS_I2S1_WS 0xf06 -#define STM32H7_PA15_FUNC_SPI3_NSS_I2S3_WS 0xf07 -#define STM32H7_PA15_FUNC_SPI6_NSS 0xf08 -#define STM32H7_PA15_FUNC_UART4_RTS 0xf09 -#define STM32H7_PA15_FUNC_UART7_TX 0xf0c -#define STM32H7_PA15_FUNC_DSI_TE 0xf0e -#define STM32H7_PA15_FUNC_EVENTOUT 0xf10 -#define STM32H7_PA15_FUNC_ANALOG 0xf11 - -#define STM32H7_PB0_FUNC_GPIO 0x1000 -#define STM32H7_PB0_FUNC_TIM1_CH2N 0x1002 -#define STM32H7_PB0_FUNC_TIM3_CH3 0x1003 -#define STM32H7_PB0_FUNC_TIM8_CH2N 0x1004 -#define STM32H7_PB0_FUNC_DFSDM_CKOUT 0x1007 -#define STM32H7_PB0_FUNC_UART4_CTS 0x1009 -#define STM32H7_PB0_FUNC_LCD_R3 0x100a -#define STM32H7_PB0_FUNC_OTG_HS_ULPI_D1 0x100b -#define STM32H7_PB0_FUNC_ETH_MII_RXD2 0x100c -#define STM32H7_PB0_FUNC_LCD_G1 0x100f -#define STM32H7_PB0_FUNC_EVENTOUT 0x1010 -#define STM32H7_PB0_FUNC_ANALOG 0x1011 - -#define STM32H7_PB1_FUNC_GPIO 0x1100 -#define STM32H7_PB1_FUNC_TIM1_CH3N 0x1102 -#define STM32H7_PB1_FUNC_TIM3_CH4 0x1103 -#define STM32H7_PB1_FUNC_TIM8_CH3N 0x1104 -#define STM32H7_PB1_FUNC_DFSDM_DATIN1 0x1107 -#define STM32H7_PB1_FUNC_LCD_R6 0x110a -#define STM32H7_PB1_FUNC_OTG_HS_ULPI_D2 0x110b -#define STM32H7_PB1_FUNC_ETH_MII_RXD3 0x110c -#define STM32H7_PB1_FUNC_LCD_G0 0x110f -#define STM32H7_PB1_FUNC_EVENTOUT 0x1110 -#define STM32H7_PB1_FUNC_ANALOG 0x1111 - -#define STM32H7_PB2_FUNC_GPIO 0x1200 -#define STM32H7_PB2_FUNC_SAI1_D1 0x1203 -#define STM32H7_PB2_FUNC_DFSDM_CKIN1 0x1205 -#define STM32H7_PB2_FUNC_SAI1_SD_A 0x1207 -#define STM32H7_PB2_FUNC_SPI3_MOSI_I2S3_SDO 0x1208 -#define STM32H7_PB2_FUNC_SAI4_SD_A 0x1209 -#define STM32H7_PB2_FUNC_QUADSPI_CLK 0x120a -#define STM32H7_PB2_FUNC_SAI4_D1 0x120b -#define STM32H7_PB2_FUNC_ETH_TX_ER 0x120c -#define STM32H7_PB2_FUNC_EVENTOUT 0x1210 -#define STM32H7_PB2_FUNC_ANALOG 0x1211 - -#define STM32H7_PB3_FUNC_GPIO 0x1300 -#define STM32H7_PB3_FUNC_JTDO_TRACESWO 0x1301 -#define STM32H7_PB3_FUNC_TIM2_CH2 0x1302 -#define STM32H7_PB3_FUNC_HRTIM_FLT4 0x1303 -#define STM32H7_PB3_FUNC_SPI1_SCK_I2S1_CK 0x1306 -#define STM32H7_PB3_FUNC_SPI3_SCK_I2S3_CK 0x1307 -#define STM32H7_PB3_FUNC_SPI6_SCK 0x1309 -#define STM32H7_PB3_FUNC_SDMMC2_D2 0x130a -#define STM32H7_PB3_FUNC_UART7_RX 0x130c -#define STM32H7_PB3_FUNC_EVENTOUT 0x1310 -#define STM32H7_PB3_FUNC_ANALOG 0x1311 - -#define STM32H7_PB4_FUNC_GPIO 0x1400 -#define STM32H7_PB4_FUNC_NJTRST 0x1401 -#define STM32H7_PB4_FUNC_TIM16_BKIN 0x1402 -#define STM32H7_PB4_FUNC_TIM3_CH1 0x1403 -#define STM32H7_PB4_FUNC_HRTIM_EEV6 0x1404 -#define STM32H7_PB4_FUNC_SPI1_MISO_I2S1_SDI 0x1406 -#define STM32H7_PB4_FUNC_SPI3_MISO_I2S3_SDI 0x1407 -#define STM32H7_PB4_FUNC_SPI2_NSS_I2S2_WS 0x1408 -#define STM32H7_PB4_FUNC_SPI6_MISO 0x1409 -#define STM32H7_PB4_FUNC_SDMMC2_D3 0x140a -#define STM32H7_PB4_FUNC_UART7_TX 0x140c -#define STM32H7_PB4_FUNC_EVENTOUT 0x1410 -#define STM32H7_PB4_FUNC_ANALOG 0x1411 - -#define STM32H7_PB5_FUNC_GPIO 0x1500 -#define STM32H7_PB5_FUNC_TIM17_BKIN 0x1502 -#define STM32H7_PB5_FUNC_TIM3_CH2 0x1503 -#define STM32H7_PB5_FUNC_HRTIM_EEV7 0x1504 -#define STM32H7_PB5_FUNC_I2C1_SMBA 0x1505 -#define STM32H7_PB5_FUNC_SPI1_MOSI_I2S1_SDO 0x1506 -#define STM32H7_PB5_FUNC_I2C4_SMBA 0x1507 -#define STM32H7_PB5_FUNC_SPI3_MOSI_I2S3_SDO 0x1508 -#define STM32H7_PB5_FUNC_SPI6_MOSI 0x1509 -#define STM32H7_PB5_FUNC_CAN2_RX 0x150a -#define STM32H7_PB5_FUNC_OTG_HS_ULPI_D7 0x150b -#define STM32H7_PB5_FUNC_ETH_PPS_OUT 0x150c -#define STM32H7_PB5_FUNC_FMC_SDCKE1 0x150d -#define STM32H7_PB5_FUNC_DCMI_D10 0x150e -#define STM32H7_PB5_FUNC_UART5_RX 0x150f -#define STM32H7_PB5_FUNC_EVENTOUT 0x1510 -#define STM32H7_PB5_FUNC_ANALOG 0x1511 - -#define STM32H7_PB6_FUNC_GPIO 0x1600 -#define STM32H7_PB6_FUNC_TIM16_CH1N 0x1602 -#define STM32H7_PB6_FUNC_TIM4_CH1 0x1603 -#define STM32H7_PB6_FUNC_HRTIM_EEV8 0x1604 -#define STM32H7_PB6_FUNC_I2C1_SCL 0x1605 -#define STM32H7_PB6_FUNC_HDMI_CEC 0x1606 -#define STM32H7_PB6_FUNC_I2C4_SCL 0x1607 -#define STM32H7_PB6_FUNC_USART1_TX 0x1608 -#define STM32H7_PB6_FUNC_LPUART1_TX 0x1609 -#define STM32H7_PB6_FUNC_CAN2_TX 0x160a -#define STM32H7_PB6_FUNC_QUADSPI_BK1_NCS 0x160b -#define STM32H7_PB6_FUNC_DFSDM_DATIN5 0x160c -#define STM32H7_PB6_FUNC_FMC_SDNE1 0x160d -#define STM32H7_PB6_FUNC_DCMI_D5 0x160e -#define STM32H7_PB6_FUNC_UART5_TX 0x160f -#define STM32H7_PB6_FUNC_EVENTOUT 0x1610 -#define STM32H7_PB6_FUNC_ANALOG 0x1611 - -#define STM32H7_PB7_FUNC_GPIO 0x1700 -#define STM32H7_PB7_FUNC_TIM17_CH1N 0x1702 -#define STM32H7_PB7_FUNC_TIM4_CH2 0x1703 -#define STM32H7_PB7_FUNC_HRTIM_EEV9 0x1704 -#define STM32H7_PB7_FUNC_I2C1_SDA 0x1705 -#define STM32H7_PB7_FUNC_I2C4_SDA 0x1707 -#define STM32H7_PB7_FUNC_USART1_RX 0x1708 -#define STM32H7_PB7_FUNC_LPUART1_RX 0x1709 -#define STM32H7_PB7_FUNC_CAN2_TXFD 0x170a -#define STM32H7_PB7_FUNC_DFSDM_CKIN5 0x170c -#define STM32H7_PB7_FUNC_FMC_NL 0x170d -#define STM32H7_PB7_FUNC_DCMI_VSYNC 0x170e -#define STM32H7_PB7_FUNC_EVENTOUT 0x1710 -#define STM32H7_PB7_FUNC_ANALOG 0x1711 - -#define STM32H7_PB8_FUNC_GPIO 0x1800 -#define STM32H7_PB8_FUNC_TIM16_CH1 0x1802 -#define STM32H7_PB8_FUNC_TIM4_CH3 0x1803 -#define STM32H7_PB8_FUNC_DFSDM_CKIN7 0x1804 -#define STM32H7_PB8_FUNC_I2C1_SCL 0x1805 -#define STM32H7_PB8_FUNC_I2C4_SCL 0x1807 -#define STM32H7_PB8_FUNC_SDMMC1_CKIN 0x1808 -#define STM32H7_PB8_FUNC_UART4_RX 0x1809 -#define STM32H7_PB8_FUNC_CAN1_RX 0x180a -#define STM32H7_PB8_FUNC_SDMMC2_D4 0x180b -#define STM32H7_PB8_FUNC_ETH_MII_TXD3 0x180c -#define STM32H7_PB8_FUNC_SDMMC1_D4 0x180d -#define STM32H7_PB8_FUNC_DCMI_D6 0x180e -#define STM32H7_PB8_FUNC_LCD_B6 0x180f -#define STM32H7_PB8_FUNC_EVENTOUT 0x1810 -#define STM32H7_PB8_FUNC_ANALOG 0x1811 - -#define STM32H7_PB9_FUNC_GPIO 0x1900 -#define STM32H7_PB9_FUNC_TIM17_CH1 0x1902 -#define STM32H7_PB9_FUNC_TIM4_CH4 0x1903 -#define STM32H7_PB9_FUNC_DFSDM_DATIN7 0x1904 -#define STM32H7_PB9_FUNC_I2C1_SDA 0x1905 -#define STM32H7_PB9_FUNC_SPI2_NSS_I2S2_WS 0x1906 -#define STM32H7_PB9_FUNC_I2C4_SDA 0x1907 -#define STM32H7_PB9_FUNC_SDMMC1_CDIR 0x1908 -#define STM32H7_PB9_FUNC_UART4_TX 0x1909 -#define STM32H7_PB9_FUNC_CAN1_TX 0x190a -#define STM32H7_PB9_FUNC_SDMMC2_D5 0x190b -#define STM32H7_PB9_FUNC_I2C4_SMBA 0x190c -#define STM32H7_PB9_FUNC_SDMMC1_D5 0x190d -#define STM32H7_PB9_FUNC_DCMI_D7 0x190e -#define STM32H7_PB9_FUNC_LCD_B7 0x190f -#define STM32H7_PB9_FUNC_EVENTOUT 0x1910 -#define STM32H7_PB9_FUNC_ANALOG 0x1911 - -#define STM32H7_PB10_FUNC_GPIO 0x1a00 -#define STM32H7_PB10_FUNC_TIM2_CH3 0x1a02 -#define STM32H7_PB10_FUNC_HRTIM_SCOUT 0x1a03 -#define STM32H7_PB10_FUNC_LPTIM2_IN1 0x1a04 -#define STM32H7_PB10_FUNC_I2C2_SCL 0x1a05 -#define STM32H7_PB10_FUNC_SPI2_SCK_I2S2_CK 0x1a06 -#define STM32H7_PB10_FUNC_DFSDM_DATIN7 0x1a07 -#define STM32H7_PB10_FUNC_USART3_TX 0x1a08 -#define STM32H7_PB10_FUNC_QUADSPI_BK1_NCS 0x1a0a -#define STM32H7_PB10_FUNC_OTG_HS_ULPI_D3 0x1a0b -#define STM32H7_PB10_FUNC_ETH_MII_RX_ER 0x1a0c -#define STM32H7_PB10_FUNC_LCD_G4 0x1a0f -#define STM32H7_PB10_FUNC_EVENTOUT 0x1a10 -#define STM32H7_PB10_FUNC_ANALOG 0x1a11 - -#define STM32H7_PB11_FUNC_GPIO 0x1b00 -#define STM32H7_PB11_FUNC_TIM2_CH4 0x1b02 -#define STM32H7_PB11_FUNC_HRTIM_SCIN 0x1b03 -#define STM32H7_PB11_FUNC_LPTIM2_ETR 0x1b04 -#define STM32H7_PB11_FUNC_I2C2_SDA 0x1b05 -#define STM32H7_PB11_FUNC_DFSDM_CKIN7 0x1b07 -#define STM32H7_PB11_FUNC_USART3_RX 0x1b08 -#define STM32H7_PB11_FUNC_OTG_HS_ULPI_D4 0x1b0b -#define STM32H7_PB11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x1b0c -#define STM32H7_PB11_FUNC_DSI_TE 0x1b0e -#define STM32H7_PB11_FUNC_LCD_G5 0x1b0f -#define STM32H7_PB11_FUNC_EVENTOUT 0x1b10 -#define STM32H7_PB11_FUNC_ANALOG 0x1b11 - -#define STM32H7_PB12_FUNC_GPIO 0x1c00 -#define STM32H7_PB12_FUNC_TIM1_BKIN 0x1c02 -#define STM32H7_PB12_FUNC_I2C2_SMBA 0x1c05 -#define STM32H7_PB12_FUNC_SPI2_NSS_I2S2_WS 0x1c06 -#define STM32H7_PB12_FUNC_DFSDM_DATIN1 0x1c07 -#define STM32H7_PB12_FUNC_USART3_CK 0x1c08 -#define STM32H7_PB12_FUNC_CAN2_RX 0x1c0a -#define STM32H7_PB12_FUNC_OTG_HS_ULPI_D5 0x1c0b -#define STM32H7_PB12_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x1c0c -#define STM32H7_PB12_FUNC_OTG_HS_ID 0x1c0d -#define STM32H7_PB12_FUNC_TIM1_BKIN_COMP12 0x1c0e -#define STM32H7_PB12_FUNC_UART5_RX 0x1c0f -#define STM32H7_PB12_FUNC_EVENTOUT 0x1c10 -#define STM32H7_PB12_FUNC_ANALOG 0x1c11 - -#define STM32H7_PB13_FUNC_GPIO 0x1d00 -#define STM32H7_PB13_FUNC_TIM1_CH1N 0x1d02 -#define STM32H7_PB13_FUNC_LPTIM2_OUT 0x1d04 -#define STM32H7_PB13_FUNC_SPI2_SCK_I2S2_CK 0x1d06 -#define STM32H7_PB13_FUNC_DFSDM_CKIN1 0x1d07 -#define STM32H7_PB13_FUNC_USART3_CTS_NSS 0x1d08 -#define STM32H7_PB13_FUNC_CAN2_TX 0x1d0a -#define STM32H7_PB13_FUNC_OTG_HS_ULPI_D6 0x1d0b -#define STM32H7_PB13_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x1d0c -#define STM32H7_PB13_FUNC_UART5_TX 0x1d0f -#define STM32H7_PB13_FUNC_EVENTOUT 0x1d10 -#define STM32H7_PB13_FUNC_ANALOG 0x1d11 - -#define STM32H7_PB14_FUNC_GPIO 0x1e00 -#define STM32H7_PB14_FUNC_TIM1_CH2N 0x1e02 -#define STM32H7_PB14_FUNC_TIM8_CH2N 0x1e04 -#define STM32H7_PB14_FUNC_USART1_TX 0x1e05 -#define STM32H7_PB14_FUNC_SPI2_MISO_I2S2_SDI 0x1e06 -#define STM32H7_PB14_FUNC_DFSDM_DATIN2 0x1e07 -#define STM32H7_PB14_FUNC_USART3_RTS 0x1e08 -#define STM32H7_PB14_FUNC_UART4_RTS 0x1e09 -#define STM32H7_PB14_FUNC_SDMMC2_D0 0x1e0a -#define STM32H7_PB14_FUNC_OTG_HS_DM 0x1e0d -#define STM32H7_PB14_FUNC_EVENTOUT 0x1e10 -#define STM32H7_PB14_FUNC_ANALOG 0x1e11 - -#define STM32H7_PB15_FUNC_GPIO 0x1f00 -#define STM32H7_PB15_FUNC_RTC_REFIN 0x1f01 -#define STM32H7_PB15_FUNC_TIM1_CH3N 0x1f02 -#define STM32H7_PB15_FUNC_TIM8_CH3N 0x1f04 -#define STM32H7_PB15_FUNC_USART1_RX 0x1f05 -#define STM32H7_PB15_FUNC_SPI2_MOSI_I2S2_SDO 0x1f06 -#define STM32H7_PB15_FUNC_DFSDM_CKIN2 0x1f07 -#define STM32H7_PB15_FUNC_UART4_CTS 0x1f09 -#define STM32H7_PB15_FUNC_SDMMC2_D1 0x1f0a -#define STM32H7_PB15_FUNC_OTG_HS_DP 0x1f0d -#define STM32H7_PB15_FUNC_EVENTOUT 0x1f10 -#define STM32H7_PB15_FUNC_ANALOG 0x1f11 - -#define STM32H7_PC0_FUNC_GPIO 0x2000 -#define STM32H7_PC0_FUNC_DFSDM_CKIN0 0x2004 -#define STM32H7_PC0_FUNC_DFSDM_DATIN4 0x2007 -#define STM32H7_PC0_FUNC_SAI2_FS_B 0x2009 -#define STM32H7_PC0_FUNC_OTG_HS_ULPI_STP 0x200b -#define STM32H7_PC0_FUNC_FMC_SDNWE 0x200d -#define STM32H7_PC0_FUNC_LCD_R5 0x200f -#define STM32H7_PC0_FUNC_EVENTOUT 0x2010 -#define STM32H7_PC0_FUNC_ANALOG 0x2011 - -#define STM32H7_PC1_FUNC_GPIO 0x2100 -#define STM32H7_PC1_FUNC_TRACED0 0x2101 -#define STM32H7_PC1_FUNC_SAI1_D1 0x2103 -#define STM32H7_PC1_FUNC_DFSDM_DATIN0 0x2104 -#define STM32H7_PC1_FUNC_DFSDM_CKIN4 0x2105 -#define STM32H7_PC1_FUNC_SPI2_MOSI_I2S2_SDO 0x2106 -#define STM32H7_PC1_FUNC_SAI1_SD_A 0x2107 -#define STM32H7_PC1_FUNC_SAI4_SD_A 0x2109 -#define STM32H7_PC1_FUNC_SDMMC2_CK 0x210a -#define STM32H7_PC1_FUNC_SAI4_D1 0x210b -#define STM32H7_PC1_FUNC_ETH_MDC 0x210c -#define STM32H7_PC1_FUNC_MDIOS_MDC 0x210d -#define STM32H7_PC1_FUNC_EVENTOUT 0x2110 -#define STM32H7_PC1_FUNC_ANALOG 0x2111 - -#define STM32H7_PC2_FUNC_GPIO 0x2200 -#define STM32H7_PC2_FUNC_DFSDM_CKIN1 0x2204 -#define STM32H7_PC2_FUNC_SPI2_MISO_I2S2_SDI 0x2206 -#define STM32H7_PC2_FUNC_DFSDM_CKOUT 0x2207 -#define STM32H7_PC2_FUNC_OTG_HS_ULPI_DIR 0x220b -#define STM32H7_PC2_FUNC_ETH_MII_TXD2 0x220c -#define STM32H7_PC2_FUNC_FMC_SDNE0 0x220d -#define STM32H7_PC2_FUNC_EVENTOUT 0x2210 -#define STM32H7_PC2_FUNC_ANALOG 0x2211 - -#define STM32H7_PC3_FUNC_GPIO 0x2300 -#define STM32H7_PC3_FUNC_DFSDM_DATIN1 0x2304 -#define STM32H7_PC3_FUNC_SPI2_MOSI_I2S2_SDO 0x2306 -#define STM32H7_PC3_FUNC_OTG_HS_ULPI_NXT 0x230b -#define STM32H7_PC3_FUNC_ETH_MII_TX_CLK 0x230c -#define STM32H7_PC3_FUNC_FMC_SDCKE0 0x230d -#define STM32H7_PC3_FUNC_EVENTOUT 0x2310 -#define STM32H7_PC3_FUNC_ANALOG 0x2311 - -#define STM32H7_PC4_FUNC_GPIO 0x2400 -#define STM32H7_PC4_FUNC_DFSDM_CKIN2 0x2404 -#define STM32H7_PC4_FUNC_I2S1_MCK 0x2406 -#define STM32H7_PC4_FUNC_SPDIFRX_IN2 0x240a -#define STM32H7_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0 0x240c -#define STM32H7_PC4_FUNC_FMC_SDNE0 0x240d -#define STM32H7_PC4_FUNC_EVENTOUT 0x2410 -#define STM32H7_PC4_FUNC_ANALOG 0x2411 - -#define STM32H7_PC5_FUNC_GPIO 0x2500 -#define STM32H7_PC5_FUNC_SAI1_D3 0x2503 -#define STM32H7_PC5_FUNC_DFSDM_DATIN2 0x2504 -#define STM32H7_PC5_FUNC_SPDIFRX_IN3 0x250a -#define STM32H7_PC5_FUNC_SAI4_D3 0x250b -#define STM32H7_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1 0x250c -#define STM32H7_PC5_FUNC_FMC_SDCKE0 0x250d -#define STM32H7_PC5_FUNC_COMP_1_OUT 0x250e -#define STM32H7_PC5_FUNC_EVENTOUT 0x2510 -#define STM32H7_PC5_FUNC_ANALOG 0x2511 - -#define STM32H7_PC6_FUNC_GPIO 0x2600 -#define STM32H7_PC6_FUNC_HRTIM_CHA1 0x2602 -#define STM32H7_PC6_FUNC_TIM3_CH1 0x2603 -#define STM32H7_PC6_FUNC_TIM8_CH1 0x2604 -#define STM32H7_PC6_FUNC_DFSDM_CKIN3 0x2605 -#define STM32H7_PC6_FUNC_I2S2_MCK 0x2606 -#define STM32H7_PC6_FUNC_USART6_TX 0x2608 -#define STM32H7_PC6_FUNC_SDMMC1_D0DIR 0x2609 -#define STM32H7_PC6_FUNC_FMC_NWAIT 0x260a -#define STM32H7_PC6_FUNC_SDMMC2_D6 0x260b -#define STM32H7_PC6_FUNC_SDMMC1_D6 0x260d -#define STM32H7_PC6_FUNC_DCMI_D0 0x260e -#define STM32H7_PC6_FUNC_LCD_HSYNC 0x260f -#define STM32H7_PC6_FUNC_EVENTOUT 0x2610 -#define STM32H7_PC6_FUNC_ANALOG 0x2611 - -#define STM32H7_PC7_FUNC_GPIO 0x2700 -#define STM32H7_PC7_FUNC_TRGIO 0x2701 -#define STM32H7_PC7_FUNC_HRTIM_CHA2 0x2702 -#define STM32H7_PC7_FUNC_TIM3_CH2 0x2703 -#define STM32H7_PC7_FUNC_TIM8_CH2 0x2704 -#define STM32H7_PC7_FUNC_DFSDM_DATIN3 0x2705 -#define STM32H7_PC7_FUNC_I2S3_MCK 0x2707 -#define STM32H7_PC7_FUNC_USART6_RX 0x2708 -#define STM32H7_PC7_FUNC_SDMMC1_D123DIR 0x2709 -#define STM32H7_PC7_FUNC_FMC_NE1 0x270a -#define STM32H7_PC7_FUNC_SDMMC2_D7 0x270b -#define STM32H7_PC7_FUNC_SWPMI_TX 0x270c -#define STM32H7_PC7_FUNC_SDMMC1_D7 0x270d -#define STM32H7_PC7_FUNC_DCMI_D1 0x270e -#define STM32H7_PC7_FUNC_LCD_G6 0x270f -#define STM32H7_PC7_FUNC_EVENTOUT 0x2710 -#define STM32H7_PC7_FUNC_ANALOG 0x2711 - -#define STM32H7_PC8_FUNC_GPIO 0x2800 -#define STM32H7_PC8_FUNC_TRACED1 0x2801 -#define STM32H7_PC8_FUNC_HRTIM_CHB1 0x2802 -#define STM32H7_PC8_FUNC_TIM3_CH3 0x2803 -#define STM32H7_PC8_FUNC_TIM8_CH3 0x2804 -#define STM32H7_PC8_FUNC_USART6_CK 0x2808 -#define STM32H7_PC8_FUNC_UART5_RTS 0x2809 -#define STM32H7_PC8_FUNC_FMC_NE2_FMC_NCE 0x280a -#define STM32H7_PC8_FUNC_SWPMI_RX 0x280c -#define STM32H7_PC8_FUNC_SDMMC1_D0 0x280d -#define STM32H7_PC8_FUNC_DCMI_D2 0x280e -#define STM32H7_PC8_FUNC_EVENTOUT 0x2810 -#define STM32H7_PC8_FUNC_ANALOG 0x2811 - -#define STM32H7_PC9_FUNC_GPIO 0x2900 -#define STM32H7_PC9_FUNC_MCO2 0x2901 -#define STM32H7_PC9_FUNC_TIM3_CH4 0x2903 -#define STM32H7_PC9_FUNC_TIM8_CH4 0x2904 -#define STM32H7_PC9_FUNC_I2C3_SDA 0x2905 -#define STM32H7_PC9_FUNC_I2S_CKIN 0x2906 -#define STM32H7_PC9_FUNC_UART5_CTS 0x2909 -#define STM32H7_PC9_FUNC_QUADSPI_BK1_IO0 0x290a -#define STM32H7_PC9_FUNC_LCD_G3 0x290b -#define STM32H7_PC9_FUNC_SWPMI_SUSPEND 0x290c -#define STM32H7_PC9_FUNC_SDMMC1_D1 0x290d -#define STM32H7_PC9_FUNC_DCMI_D3 0x290e -#define STM32H7_PC9_FUNC_LCD_B2 0x290f -#define STM32H7_PC9_FUNC_EVENTOUT 0x2910 -#define STM32H7_PC9_FUNC_ANALOG 0x2911 - -#define STM32H7_PC10_FUNC_GPIO 0x2a00 -#define STM32H7_PC10_FUNC_HRTIM_EEV1 0x2a03 -#define STM32H7_PC10_FUNC_DFSDM_CKIN5 0x2a04 -#define STM32H7_PC10_FUNC_SPI3_SCK_I2S3_CK 0x2a07 -#define STM32H7_PC10_FUNC_USART3_TX 0x2a08 -#define STM32H7_PC10_FUNC_UART4_TX 0x2a09 -#define STM32H7_PC10_FUNC_QUADSPI_BK1_IO1 0x2a0a -#define STM32H7_PC10_FUNC_SDMMC1_D2 0x2a0d -#define STM32H7_PC10_FUNC_DCMI_D8 0x2a0e -#define STM32H7_PC10_FUNC_LCD_R2 0x2a0f -#define STM32H7_PC10_FUNC_EVENTOUT 0x2a10 -#define STM32H7_PC10_FUNC_ANALOG 0x2a11 - -#define STM32H7_PC11_FUNC_GPIO 0x2b00 -#define STM32H7_PC11_FUNC_HRTIM_FLT2 0x2b03 -#define STM32H7_PC11_FUNC_DFSDM_DATIN5 0x2b04 -#define STM32H7_PC11_FUNC_SPI3_MISO_I2S3_SDI 0x2b07 -#define STM32H7_PC11_FUNC_USART3_RX 0x2b08 -#define STM32H7_PC11_FUNC_UART4_RX 0x2b09 -#define STM32H7_PC11_FUNC_QUADSPI_BK2_NCS 0x2b0a -#define STM32H7_PC11_FUNC_SDMMC1_D3 0x2b0d -#define STM32H7_PC11_FUNC_DCMI_D4 0x2b0e -#define STM32H7_PC11_FUNC_EVENTOUT 0x2b10 -#define STM32H7_PC11_FUNC_ANALOG 0x2b11 - -#define STM32H7_PC12_FUNC_GPIO 0x2c00 -#define STM32H7_PC12_FUNC_TRACED3 0x2c01 -#define STM32H7_PC12_FUNC_HRTIM_EEV2 0x2c03 -#define STM32H7_PC12_FUNC_SPI3_MOSI_I2S3_SDO 0x2c07 -#define STM32H7_PC12_FUNC_USART3_CK 0x2c08 -#define STM32H7_PC12_FUNC_UART5_TX 0x2c09 -#define STM32H7_PC12_FUNC_SDMMC1_CK 0x2c0d -#define STM32H7_PC12_FUNC_DCMI_D9 0x2c0e -#define STM32H7_PC12_FUNC_EVENTOUT 0x2c10 -#define STM32H7_PC12_FUNC_ANALOG 0x2c11 - -#define STM32H7_PC13_FUNC_GPIO 0x2d00 -#define STM32H7_PC13_FUNC_EVENTOUT 0x2d10 -#define STM32H7_PC13_FUNC_ANALOG 0x2d11 - -#define STM32H7_PC14_FUNC_GPIO 0x2e00 -#define STM32H7_PC14_FUNC_EVENTOUT 0x2e10 -#define STM32H7_PC14_FUNC_ANALOG 0x2e11 - -#define STM32H7_PC15_FUNC_GPIO 0x2f00 -#define STM32H7_PC15_FUNC_EVENTOUT 0x2f10 -#define STM32H7_PC15_FUNC_ANALOG 0x2f11 - -#define STM32H7_PD0_FUNC_GPIO 0x3000 -#define STM32H7_PD0_FUNC_DFSDM_CKIN6 0x3004 -#define STM32H7_PD0_FUNC_SAI3_SCK_A 0x3007 -#define STM32H7_PD0_FUNC_UART4_RX 0x3009 -#define STM32H7_PD0_FUNC_CAN1_RX 0x300a -#define STM32H7_PD0_FUNC_FMC_D2_FMC_DA2 0x300d -#define STM32H7_PD0_FUNC_EVENTOUT 0x3010 -#define STM32H7_PD0_FUNC_ANALOG 0x3011 - -#define STM32H7_PD1_FUNC_GPIO 0x3100 -#define STM32H7_PD1_FUNC_DFSDM_DATIN6 0x3104 -#define STM32H7_PD1_FUNC_SAI3_SD_A 0x3107 -#define STM32H7_PD1_FUNC_UART4_TX 0x3109 -#define STM32H7_PD1_FUNC_CAN1_TX 0x310a -#define STM32H7_PD1_FUNC_FMC_D3_FMC_DA3 0x310d -#define STM32H7_PD1_FUNC_EVENTOUT 0x3110 -#define STM32H7_PD1_FUNC_ANALOG 0x3111 - -#define STM32H7_PD2_FUNC_GPIO 0x3200 -#define STM32H7_PD2_FUNC_TRACED2 0x3201 -#define STM32H7_PD2_FUNC_TIM3_ETR 0x3203 -#define STM32H7_PD2_FUNC_UART5_RX 0x3209 -#define STM32H7_PD2_FUNC_SDMMC1_CMD 0x320d -#define STM32H7_PD2_FUNC_DCMI_D11 0x320e -#define STM32H7_PD2_FUNC_EVENTOUT 0x3210 -#define STM32H7_PD2_FUNC_ANALOG 0x3211 - -#define STM32H7_PD3_FUNC_GPIO 0x3300 -#define STM32H7_PD3_FUNC_DFSDM_CKOUT 0x3304 -#define STM32H7_PD3_FUNC_SPI2_SCK_I2S2_CK 0x3306 -#define STM32H7_PD3_FUNC_USART2_CTS_NSS 0x3308 -#define STM32H7_PD3_FUNC_FMC_CLK 0x330d -#define STM32H7_PD3_FUNC_DCMI_D5 0x330e -#define STM32H7_PD3_FUNC_LCD_G7 0x330f -#define STM32H7_PD3_FUNC_EVENTOUT 0x3310 -#define STM32H7_PD3_FUNC_ANALOG 0x3311 - -#define STM32H7_PD4_FUNC_GPIO 0x3400 -#define STM32H7_PD4_FUNC_HRTIM_FLT3 0x3403 -#define STM32H7_PD4_FUNC_SAI3_FS_A 0x3407 -#define STM32H7_PD4_FUNC_USART2_RTS 0x3408 -#define STM32H7_PD4_FUNC_CAN1_RXFD 0x340a -#define STM32H7_PD4_FUNC_FMC_NOE 0x340d -#define STM32H7_PD4_FUNC_EVENTOUT 0x3410 -#define STM32H7_PD4_FUNC_ANALOG 0x3411 - -#define STM32H7_PD5_FUNC_GPIO 0x3500 -#define STM32H7_PD5_FUNC_HRTIM_EEV3 0x3503 -#define STM32H7_PD5_FUNC_USART2_TX 0x3508 -#define STM32H7_PD5_FUNC_CAN1_TXFD 0x350a -#define STM32H7_PD5_FUNC_FMC_NWE 0x350d -#define STM32H7_PD5_FUNC_EVENTOUT 0x3510 -#define STM32H7_PD5_FUNC_ANALOG 0x3511 - -#define STM32H7_PD6_FUNC_GPIO 0x3600 -#define STM32H7_PD6_FUNC_SAI1_D1 0x3603 -#define STM32H7_PD6_FUNC_DFSDM_CKIN4 0x3604 -#define STM32H7_PD6_FUNC_DFSDM_DATIN1 0x3605 -#define STM32H7_PD6_FUNC_SPI3_MOSI_I2S3_SDO 0x3606 -#define STM32H7_PD6_FUNC_SAI1_SD_A 0x3607 -#define STM32H7_PD6_FUNC_USART2_RX 0x3608 -#define STM32H7_PD6_FUNC_SAI4_SD_A 0x3609 -#define STM32H7_PD6_FUNC_CAN2_RXFD 0x360a -#define STM32H7_PD6_FUNC_SAI4_D1 0x360b -#define STM32H7_PD6_FUNC_SDMMC2_CK 0x360c -#define STM32H7_PD6_FUNC_FMC_NWAIT 0x360d -#define STM32H7_PD6_FUNC_DCMI_D10 0x360e -#define STM32H7_PD6_FUNC_LCD_B2 0x360f -#define STM32H7_PD6_FUNC_EVENTOUT 0x3610 -#define STM32H7_PD6_FUNC_ANALOG 0x3611 - -#define STM32H7_PD7_FUNC_GPIO 0x3700 -#define STM32H7_PD7_FUNC_DFSDM_DATIN4 0x3704 -#define STM32H7_PD7_FUNC_SPI1_MOSI_I2S1_SDO 0x3706 -#define STM32H7_PD7_FUNC_DFSDM_CKIN1 0x3707 -#define STM32H7_PD7_FUNC_USART2_CK 0x3708 -#define STM32H7_PD7_FUNC_SPDIFRX_IN0 0x370a -#define STM32H7_PD7_FUNC_SDMMC2_CMD 0x370c -#define STM32H7_PD7_FUNC_FMC_NE1 0x370d -#define STM32H7_PD7_FUNC_EVENTOUT 0x3710 -#define STM32H7_PD7_FUNC_ANALOG 0x3711 - -#define STM32H7_PD8_FUNC_GPIO 0x3800 -#define STM32H7_PD8_FUNC_DFSDM_CKIN3 0x3804 -#define STM32H7_PD8_FUNC_SAI3_SCK_B 0x3807 -#define STM32H7_PD8_FUNC_USART3_TX 0x3808 -#define STM32H7_PD8_FUNC_SPDIFRX_IN1 0x380a -#define STM32H7_PD8_FUNC_FMC_D13_FMC_DA13 0x380d -#define STM32H7_PD8_FUNC_EVENTOUT 0x3810 -#define STM32H7_PD8_FUNC_ANALOG 0x3811 - -#define STM32H7_PD9_FUNC_GPIO 0x3900 -#define STM32H7_PD9_FUNC_DFSDM_DATIN3 0x3904 -#define STM32H7_PD9_FUNC_SAI3_SD_B 0x3907 -#define STM32H7_PD9_FUNC_USART3_RX 0x3908 -#define STM32H7_PD9_FUNC_CAN2_RXFD 0x390a -#define STM32H7_PD9_FUNC_FMC_D14_FMC_DA14 0x390d -#define STM32H7_PD9_FUNC_EVENTOUT 0x3910 -#define STM32H7_PD9_FUNC_ANALOG 0x3911 - -#define STM32H7_PD10_FUNC_GPIO 0x3a00 -#define STM32H7_PD10_FUNC_DFSDM_CKOUT 0x3a04 -#define STM32H7_PD10_FUNC_SAI3_FS_B 0x3a07 -#define STM32H7_PD10_FUNC_USART3_CK 0x3a08 -#define STM32H7_PD10_FUNC_CAN2_TXFD 0x3a0a -#define STM32H7_PD10_FUNC_FMC_D15_FMC_DA15 0x3a0d -#define STM32H7_PD10_FUNC_LCD_B3 0x3a0f -#define STM32H7_PD10_FUNC_EVENTOUT 0x3a10 -#define STM32H7_PD10_FUNC_ANALOG 0x3a11 - -#define STM32H7_PD11_FUNC_GPIO 0x3b00 -#define STM32H7_PD11_FUNC_LPTIM2_IN2 0x3b04 -#define STM32H7_PD11_FUNC_I2C4_SMBA 0x3b05 -#define STM32H7_PD11_FUNC_USART3_CTS_NSS 0x3b08 -#define STM32H7_PD11_FUNC_QUADSPI_BK1_IO0 0x3b0a -#define STM32H7_PD11_FUNC_SAI2_SD_A 0x3b0b -#define STM32H7_PD11_FUNC_FMC_A16 0x3b0d -#define STM32H7_PD11_FUNC_EVENTOUT 0x3b10 -#define STM32H7_PD11_FUNC_ANALOG 0x3b11 - -#define STM32H7_PD12_FUNC_GPIO 0x3c00 -#define STM32H7_PD12_FUNC_LPTIM1_IN1 0x3c02 -#define STM32H7_PD12_FUNC_TIM4_CH1 0x3c03 -#define STM32H7_PD12_FUNC_LPTIM2_IN1 0x3c04 -#define STM32H7_PD12_FUNC_I2C4_SCL 0x3c05 -#define STM32H7_PD12_FUNC_USART3_RTS 0x3c08 -#define STM32H7_PD12_FUNC_QUADSPI_BK1_IO1 0x3c0a -#define STM32H7_PD12_FUNC_SAI2_FS_A 0x3c0b -#define STM32H7_PD12_FUNC_FMC_A17 0x3c0d -#define STM32H7_PD12_FUNC_EVENTOUT 0x3c10 -#define STM32H7_PD12_FUNC_ANALOG 0x3c11 - -#define STM32H7_PD13_FUNC_GPIO 0x3d00 -#define STM32H7_PD13_FUNC_LPTIM1_OUT 0x3d02 -#define STM32H7_PD13_FUNC_TIM4_CH2 0x3d03 -#define STM32H7_PD13_FUNC_I2C4_SDA 0x3d05 -#define STM32H7_PD13_FUNC_QUADSPI_BK1_IO3 0x3d0a -#define STM32H7_PD13_FUNC_SAI2_SCK_A 0x3d0b -#define STM32H7_PD13_FUNC_FMC_A18 0x3d0d -#define STM32H7_PD13_FUNC_EVENTOUT 0x3d10 -#define STM32H7_PD13_FUNC_ANALOG 0x3d11 - -#define STM32H7_PD14_FUNC_GPIO 0x3e00 -#define STM32H7_PD14_FUNC_TIM4_CH3 0x3e03 -#define STM32H7_PD14_FUNC_SAI3_MCLK_B 0x3e07 -#define STM32H7_PD14_FUNC_UART8_CTS 0x3e09 -#define STM32H7_PD14_FUNC_FMC_D0_FMC_DA0 0x3e0d -#define STM32H7_PD14_FUNC_EVENTOUT 0x3e10 -#define STM32H7_PD14_FUNC_ANALOG 0x3e11 - -#define STM32H7_PD15_FUNC_GPIO 0x3f00 -#define STM32H7_PD15_FUNC_TIM4_CH4 0x3f03 -#define STM32H7_PD15_FUNC_SAI3_MCLK_A 0x3f07 -#define STM32H7_PD15_FUNC_UART8_RTS 0x3f09 -#define STM32H7_PD15_FUNC_FMC_D1_FMC_DA1 0x3f0d -#define STM32H7_PD15_FUNC_EVENTOUT 0x3f10 -#define STM32H7_PD15_FUNC_ANALOG 0x3f11 - -#define STM32H7_PE0_FUNC_GPIO 0x4000 -#define STM32H7_PE0_FUNC_LPTIM1_ETR 0x4002 -#define STM32H7_PE0_FUNC_TIM4_ETR 0x4003 -#define STM32H7_PE0_FUNC_HRTIM_SCIN 0x4004 -#define STM32H7_PE0_FUNC_LPTIM2_ETR 0x4005 -#define STM32H7_PE0_FUNC_UART8_RX 0x4009 -#define STM32H7_PE0_FUNC_CAN1_RXFD 0x400a -#define STM32H7_PE0_FUNC_SAI2_MCK_A 0x400b -#define STM32H7_PE0_FUNC_FMC_NBL0 0x400d -#define STM32H7_PE0_FUNC_DCMI_D2 0x400e -#define STM32H7_PE0_FUNC_EVENTOUT 0x4010 -#define STM32H7_PE0_FUNC_ANALOG 0x4011 - -#define STM32H7_PE1_FUNC_GPIO 0x4100 -#define STM32H7_PE1_FUNC_LPTIM1_IN2 0x4102 -#define STM32H7_PE1_FUNC_HRTIM_SCOUT 0x4104 -#define STM32H7_PE1_FUNC_UART8_TX 0x4109 -#define STM32H7_PE1_FUNC_CAN1_TXFD 0x410a -#define STM32H7_PE1_FUNC_FMC_NBL1 0x410d -#define STM32H7_PE1_FUNC_DCMI_D3 0x410e -#define STM32H7_PE1_FUNC_EVENTOUT 0x4110 -#define STM32H7_PE1_FUNC_ANALOG 0x4111 - -#define STM32H7_PE2_FUNC_GPIO 0x4200 -#define STM32H7_PE2_FUNC_TRACECLK 0x4201 -#define STM32H7_PE2_FUNC_SAI1_CK1 0x4203 -#define STM32H7_PE2_FUNC_SPI4_SCK 0x4206 -#define STM32H7_PE2_FUNC_SAI1_MCLK_A 0x4207 -#define STM32H7_PE2_FUNC_SAI4_MCLK_A 0x4209 -#define STM32H7_PE2_FUNC_QUADSPI_BK1_IO2 0x420a -#define STM32H7_PE2_FUNC_SAI4_CK1 0x420b -#define STM32H7_PE2_FUNC_ETH_MII_TXD3 0x420c -#define STM32H7_PE2_FUNC_FMC_A23 0x420d -#define STM32H7_PE2_FUNC_EVENTOUT 0x4210 -#define STM32H7_PE2_FUNC_ANALOG 0x4211 - -#define STM32H7_PE3_FUNC_GPIO 0x4300 -#define STM32H7_PE3_FUNC_TRACED0 0x4301 -#define STM32H7_PE3_FUNC_TIM15_BKIN 0x4305 -#define STM32H7_PE3_FUNC_SAI1_SD_B 0x4307 -#define STM32H7_PE3_FUNC_SAI4_SD_B 0x4309 -#define STM32H7_PE3_FUNC_FMC_A19 0x430d -#define STM32H7_PE3_FUNC_EVENTOUT 0x4310 -#define STM32H7_PE3_FUNC_ANALOG 0x4311 - -#define STM32H7_PE4_FUNC_GPIO 0x4400 -#define STM32H7_PE4_FUNC_TRACED1 0x4401 -#define STM32H7_PE4_FUNC_SAI1_D2 0x4403 -#define STM32H7_PE4_FUNC_DFSDM_DATIN3 0x4404 -#define STM32H7_PE4_FUNC_TIM15_CH1N 0x4405 -#define STM32H7_PE4_FUNC_SPI4_NSS 0x4406 -#define STM32H7_PE4_FUNC_SAI1_FS_A 0x4407 -#define STM32H7_PE4_FUNC_SAI4_FS_A 0x4409 -#define STM32H7_PE4_FUNC_SAI4_D2 0x440b -#define STM32H7_PE4_FUNC_FMC_A20 0x440d -#define STM32H7_PE4_FUNC_DCMI_D4 0x440e -#define STM32H7_PE4_FUNC_LCD_B0 0x440f -#define STM32H7_PE4_FUNC_EVENTOUT 0x4410 -#define STM32H7_PE4_FUNC_ANALOG 0x4411 - -#define STM32H7_PE5_FUNC_GPIO 0x4500 -#define STM32H7_PE5_FUNC_TRACED2 0x4501 -#define STM32H7_PE5_FUNC_SAI1_CK2 0x4503 -#define STM32H7_PE5_FUNC_DFSDM_CKIN3 0x4504 -#define STM32H7_PE5_FUNC_TIM15_CH1 0x4505 -#define STM32H7_PE5_FUNC_SPI4_MISO 0x4506 -#define STM32H7_PE5_FUNC_SAI1_SCK_A 0x4507 -#define STM32H7_PE5_FUNC_SAI4_SCK_A 0x4509 -#define STM32H7_PE5_FUNC_SAI4_CK2 0x450b -#define STM32H7_PE5_FUNC_FMC_A21 0x450d -#define STM32H7_PE5_FUNC_DCMI_D6 0x450e -#define STM32H7_PE5_FUNC_LCD_G0 0x450f -#define STM32H7_PE5_FUNC_EVENTOUT 0x4510 -#define STM32H7_PE5_FUNC_ANALOG 0x4511 - -#define STM32H7_PE6_FUNC_GPIO 0x4600 -#define STM32H7_PE6_FUNC_TRACED3 0x4601 -#define STM32H7_PE6_FUNC_TIM1_BKIN2 0x4602 -#define STM32H7_PE6_FUNC_SAI1_D1 0x4603 -#define STM32H7_PE6_FUNC_TIM15_CH2 0x4605 -#define STM32H7_PE6_FUNC_SPI4_MOSI 0x4606 -#define STM32H7_PE6_FUNC_SAI1_SD_A 0x4607 -#define STM32H7_PE6_FUNC_SAI4_SD_A 0x4609 -#define STM32H7_PE6_FUNC_SAI4_D1 0x460a -#define STM32H7_PE6_FUNC_SAI2_MCK_B 0x460b -#define STM32H7_PE6_FUNC_TIM1_BKIN2_COMP12 0x460c -#define STM32H7_PE6_FUNC_FMC_A22 0x460d -#define STM32H7_PE6_FUNC_DCMI_D7 0x460e -#define STM32H7_PE6_FUNC_LCD_G1 0x460f -#define STM32H7_PE6_FUNC_EVENTOUT 0x4610 -#define STM32H7_PE6_FUNC_ANALOG 0x4611 - -#define STM32H7_PE7_FUNC_GPIO 0x4700 -#define STM32H7_PE7_FUNC_TIM1_ETR 0x4702 -#define STM32H7_PE7_FUNC_DFSDM_DATIN2 0x4704 -#define STM32H7_PE7_FUNC_UART7_RX 0x4708 -#define STM32H7_PE7_FUNC_QUADSPI_BK2_IO0 0x470b -#define STM32H7_PE7_FUNC_FMC_D4_FMC_DA4 0x470d -#define STM32H7_PE7_FUNC_EVENTOUT 0x4710 -#define STM32H7_PE7_FUNC_ANALOG 0x4711 - -#define STM32H7_PE8_FUNC_GPIO 0x4800 -#define STM32H7_PE8_FUNC_TIM1_CH1N 0x4802 -#define STM32H7_PE8_FUNC_DFSDM_CKIN2 0x4804 -#define STM32H7_PE8_FUNC_UART7_TX 0x4808 -#define STM32H7_PE8_FUNC_QUADSPI_BK2_IO1 0x480b -#define STM32H7_PE8_FUNC_FMC_D5_FMC_DA5 0x480d -#define STM32H7_PE8_FUNC_COMP_2_OUT 0x480e -#define STM32H7_PE8_FUNC_EVENTOUT 0x4810 -#define STM32H7_PE8_FUNC_ANALOG 0x4811 - -#define STM32H7_PE9_FUNC_GPIO 0x4900 -#define STM32H7_PE9_FUNC_TIM1_CH1 0x4902 -#define STM32H7_PE9_FUNC_DFSDM_CKOUT 0x4904 -#define STM32H7_PE9_FUNC_UART7_RTS 0x4908 -#define STM32H7_PE9_FUNC_QUADSPI_BK2_IO2 0x490b -#define STM32H7_PE9_FUNC_FMC_D6_FMC_DA6 0x490d -#define STM32H7_PE9_FUNC_EVENTOUT 0x4910 -#define STM32H7_PE9_FUNC_ANALOG 0x4911 - -#define STM32H7_PE10_FUNC_GPIO 0x4a00 -#define STM32H7_PE10_FUNC_TIM1_CH2N 0x4a02 -#define STM32H7_PE10_FUNC_DFSDM_DATIN4 0x4a04 -#define STM32H7_PE10_FUNC_UART7_CTS 0x4a08 -#define STM32H7_PE10_FUNC_QUADSPI_BK2_IO3 0x4a0b -#define STM32H7_PE10_FUNC_FMC_D7_FMC_DA7 0x4a0d -#define STM32H7_PE10_FUNC_EVENTOUT 0x4a10 -#define STM32H7_PE10_FUNC_ANALOG 0x4a11 - -#define STM32H7_PE11_FUNC_GPIO 0x4b00 -#define STM32H7_PE11_FUNC_TIM1_CH2 0x4b02 -#define STM32H7_PE11_FUNC_DFSDM_CKIN4 0x4b04 -#define STM32H7_PE11_FUNC_SPI4_NSS 0x4b06 -#define STM32H7_PE11_FUNC_SAI2_SD_B 0x4b0b -#define STM32H7_PE11_FUNC_FMC_D8_FMC_DA8 0x4b0d -#define STM32H7_PE11_FUNC_LCD_G3 0x4b0f -#define STM32H7_PE11_FUNC_EVENTOUT 0x4b10 -#define STM32H7_PE11_FUNC_ANALOG 0x4b11 - -#define STM32H7_PE12_FUNC_GPIO 0x4c00 -#define STM32H7_PE12_FUNC_TIM1_CH3N 0x4c02 -#define STM32H7_PE12_FUNC_DFSDM_DATIN5 0x4c04 -#define STM32H7_PE12_FUNC_SPI4_SCK 0x4c06 -#define STM32H7_PE12_FUNC_SAI2_SCK_B 0x4c0b -#define STM32H7_PE12_FUNC_FMC_D9_FMC_DA9 0x4c0d -#define STM32H7_PE12_FUNC_COMP_1_OUT 0x4c0e -#define STM32H7_PE12_FUNC_LCD_B4 0x4c0f -#define STM32H7_PE12_FUNC_EVENTOUT 0x4c10 -#define STM32H7_PE12_FUNC_ANALOG 0x4c11 - -#define STM32H7_PE13_FUNC_GPIO 0x4d00 -#define STM32H7_PE13_FUNC_TIM1_CH3 0x4d02 -#define STM32H7_PE13_FUNC_DFSDM_CKIN5 0x4d04 -#define STM32H7_PE13_FUNC_SPI4_MISO 0x4d06 -#define STM32H7_PE13_FUNC_SAI2_FS_B 0x4d0b -#define STM32H7_PE13_FUNC_FMC_D10_FMC_DA10 0x4d0d -#define STM32H7_PE13_FUNC_COMP_2_OUT 0x4d0e -#define STM32H7_PE13_FUNC_LCD_DE 0x4d0f -#define STM32H7_PE13_FUNC_EVENTOUT 0x4d10 -#define STM32H7_PE13_FUNC_ANALOG 0x4d11 - -#define STM32H7_PE14_FUNC_GPIO 0x4e00 -#define STM32H7_PE14_FUNC_TIM1_CH4 0x4e02 -#define STM32H7_PE14_FUNC_SPI4_MOSI 0x4e06 -#define STM32H7_PE14_FUNC_SAI2_MCK_B 0x4e0b -#define STM32H7_PE14_FUNC_FMC_D11_FMC_DA11 0x4e0d -#define STM32H7_PE14_FUNC_LCD_CLK 0x4e0f -#define STM32H7_PE14_FUNC_EVENTOUT 0x4e10 -#define STM32H7_PE14_FUNC_ANALOG 0x4e11 - -#define STM32H7_PE15_FUNC_GPIO 0x4f00 -#define STM32H7_PE15_FUNC_TIM1_BKIN 0x4f02 -#define STM32H7_PE15_FUNC_HDMI__TIM1_BKIN 0x4f06 -#define STM32H7_PE15_FUNC_FMC_D12_FMC_DA12 0x4f0d -#define STM32H7_PE15_FUNC_TIM1_BKIN_COMP12 0x4f0e -#define STM32H7_PE15_FUNC_LCD_R7 0x4f0f -#define STM32H7_PE15_FUNC_EVENTOUT 0x4f10 -#define STM32H7_PE15_FUNC_ANALOG 0x4f11 - -#define STM32H7_PF0_FUNC_GPIO 0x5000 -#define STM32H7_PF0_FUNC_I2C2_SDA 0x5005 -#define STM32H7_PF0_FUNC_FMC_A0 0x500d -#define STM32H7_PF0_FUNC_EVENTOUT 0x5010 -#define STM32H7_PF0_FUNC_ANALOG 0x5011 - -#define STM32H7_PF1_FUNC_GPIO 0x5100 -#define STM32H7_PF1_FUNC_I2C2_SCL 0x5105 -#define STM32H7_PF1_FUNC_FMC_A1 0x510d -#define STM32H7_PF1_FUNC_EVENTOUT 0x5110 -#define STM32H7_PF1_FUNC_ANALOG 0x5111 - -#define STM32H7_PF2_FUNC_GPIO 0x5200 -#define STM32H7_PF2_FUNC_I2C2_SMBA 0x5205 -#define STM32H7_PF2_FUNC_FMC_A2 0x520d -#define STM32H7_PF2_FUNC_EVENTOUT 0x5210 -#define STM32H7_PF2_FUNC_ANALOG 0x5211 - -#define STM32H7_PF3_FUNC_GPIO 0x5300 -#define STM32H7_PF3_FUNC_FMC_A3 0x530d -#define STM32H7_PF3_FUNC_EVENTOUT 0x5310 -#define STM32H7_PF3_FUNC_ANALOG 0x5311 - -#define STM32H7_PF4_FUNC_GPIO 0x5400 -#define STM32H7_PF4_FUNC_FMC_A4 0x540d -#define STM32H7_PF4_FUNC_EVENTOUT 0x5410 -#define STM32H7_PF4_FUNC_ANALOG 0x5411 - -#define STM32H7_PF5_FUNC_GPIO 0x5500 -#define STM32H7_PF5_FUNC_FMC_A5 0x550d -#define STM32H7_PF5_FUNC_EVENTOUT 0x5510 -#define STM32H7_PF5_FUNC_ANALOG 0x5511 - -#define STM32H7_PF6_FUNC_GPIO 0x5600 -#define STM32H7_PF6_FUNC_TIM16_CH1 0x5602 -#define STM32H7_PF6_FUNC_SPI5_NSS 0x5606 -#define STM32H7_PF6_FUNC_SAI1_SD_B 0x5607 -#define STM32H7_PF6_FUNC_UART7_RX 0x5608 -#define STM32H7_PF6_FUNC_SAI4_SD_B 0x5609 -#define STM32H7_PF6_FUNC_QUADSPI_BK1_IO3 0x560a -#define STM32H7_PF6_FUNC_EVENTOUT 0x5610 -#define STM32H7_PF6_FUNC_ANALOG 0x5611 - -#define STM32H7_PF7_FUNC_GPIO 0x5700 -#define STM32H7_PF7_FUNC_TIM17_CH1 0x5702 -#define STM32H7_PF7_FUNC_SPI5_SCK 0x5706 -#define STM32H7_PF7_FUNC_SAI1_MCLK_B 0x5707 -#define STM32H7_PF7_FUNC_UART7_TX 0x5708 -#define STM32H7_PF7_FUNC_SAI4_MCLK_B 0x5709 -#define STM32H7_PF7_FUNC_QUADSPI_BK1_IO2 0x570a -#define STM32H7_PF7_FUNC_EVENTOUT 0x5710 -#define STM32H7_PF7_FUNC_ANALOG 0x5711 - -#define STM32H7_PF8_FUNC_GPIO 0x5800 -#define STM32H7_PF8_FUNC_TIM16_CH1N 0x5802 -#define STM32H7_PF8_FUNC_SPI5_MISO 0x5806 -#define STM32H7_PF8_FUNC_SAI1_SCK_B 0x5807 -#define STM32H7_PF8_FUNC_UART7_RTS 0x5808 -#define STM32H7_PF8_FUNC_SAI4_SCK_B 0x5809 -#define STM32H7_PF8_FUNC_TIM13_CH1 0x580a -#define STM32H7_PF8_FUNC_QUADSPI_BK1_IO0 0x580b -#define STM32H7_PF8_FUNC_EVENTOUT 0x5810 -#define STM32H7_PF8_FUNC_ANALOG 0x5811 - -#define STM32H7_PF9_FUNC_GPIO 0x5900 -#define STM32H7_PF9_FUNC_TIM17_CH1N 0x5902 -#define STM32H7_PF9_FUNC_SPI5_MOSI 0x5906 -#define STM32H7_PF9_FUNC_SAI1_FS_B 0x5907 -#define STM32H7_PF9_FUNC_UART7_CTS 0x5908 -#define STM32H7_PF9_FUNC_SAI4_FS_B 0x5909 -#define STM32H7_PF9_FUNC_TIM14_CH1 0x590a -#define STM32H7_PF9_FUNC_QUADSPI_BK1_IO1 0x590b -#define STM32H7_PF9_FUNC_EVENTOUT 0x5910 -#define STM32H7_PF9_FUNC_ANALOG 0x5911 - -#define STM32H7_PF10_FUNC_GPIO 0x5a00 -#define STM32H7_PF10_FUNC_TIM16_BKIN 0x5a02 -#define STM32H7_PF10_FUNC_SAI1_D3 0x5a03 -#define STM32H7_PF10_FUNC_QUADSPI_CLK 0x5a0a -#define STM32H7_PF10_FUNC_SAI4_D3 0x5a0b -#define STM32H7_PF10_FUNC_DCMI_D11 0x5a0e -#define STM32H7_PF10_FUNC_LCD_DE 0x5a0f -#define STM32H7_PF10_FUNC_EVENTOUT 0x5a10 -#define STM32H7_PF10_FUNC_ANALOG 0x5a11 - -#define STM32H7_PF11_FUNC_GPIO 0x5b00 -#define STM32H7_PF11_FUNC_SPI5_MOSI 0x5b06 -#define STM32H7_PF11_FUNC_SAI2_SD_B 0x5b0b -#define STM32H7_PF11_FUNC_FMC_SDNRAS 0x5b0d -#define STM32H7_PF11_FUNC_DCMI_D12 0x5b0e -#define STM32H7_PF11_FUNC_EVENTOUT 0x5b10 -#define STM32H7_PF11_FUNC_ANALOG 0x5b11 - -#define STM32H7_PF12_FUNC_GPIO 0x5c00 -#define STM32H7_PF12_FUNC_FMC_A6 0x5c0d -#define STM32H7_PF12_FUNC_EVENTOUT 0x5c10 -#define STM32H7_PF12_FUNC_ANALOG 0x5c11 - -#define STM32H7_PF13_FUNC_GPIO 0x5d00 -#define STM32H7_PF13_FUNC_DFSDM_DATIN6 0x5d04 -#define STM32H7_PF13_FUNC_I2C4_SMBA 0x5d05 -#define STM32H7_PF13_FUNC_FMC_A7 0x5d0d -#define STM32H7_PF13_FUNC_EVENTOUT 0x5d10 -#define STM32H7_PF13_FUNC_ANALOG 0x5d11 - -#define STM32H7_PF14_FUNC_GPIO 0x5e00 -#define STM32H7_PF14_FUNC_DFSDM_CKIN6 0x5e04 -#define STM32H7_PF14_FUNC_I2C4_SCL 0x5e05 -#define STM32H7_PF14_FUNC_FMC_A8 0x5e0d -#define STM32H7_PF14_FUNC_EVENTOUT 0x5e10 -#define STM32H7_PF14_FUNC_ANALOG 0x5e11 - -#define STM32H7_PF15_FUNC_GPIO 0x5f00 -#define STM32H7_PF15_FUNC_I2C4_SDA 0x5f05 -#define STM32H7_PF15_FUNC_FMC_A9 0x5f0d -#define STM32H7_PF15_FUNC_EVENTOUT 0x5f10 -#define STM32H7_PF15_FUNC_ANALOG 0x5f11 - -#define STM32H7_PG0_FUNC_GPIO 0x6000 -#define STM32H7_PG0_FUNC_FMC_A10 0x600d -#define STM32H7_PG0_FUNC_EVENTOUT 0x6010 -#define STM32H7_PG0_FUNC_ANALOG 0x6011 - -#define STM32H7_PG1_FUNC_GPIO 0x6100 -#define STM32H7_PG1_FUNC_FMC_A11 0x610d -#define STM32H7_PG1_FUNC_EVENTOUT 0x6110 -#define STM32H7_PG1_FUNC_ANALOG 0x6111 - -#define STM32H7_PG2_FUNC_GPIO 0x6200 -#define STM32H7_PG2_FUNC_TIM8_BKIN 0x6204 -#define STM32H7_PG2_FUNC_TIM8_BKIN_COMP12 0x620c -#define STM32H7_PG2_FUNC_FMC_A12 0x620d -#define STM32H7_PG2_FUNC_EVENTOUT 0x6210 -#define STM32H7_PG2_FUNC_ANALOG 0x6211 - -#define STM32H7_PG3_FUNC_GPIO 0x6300 -#define STM32H7_PG3_FUNC_TIM8_BKIN2 0x6304 -#define STM32H7_PG3_FUNC_TIM8_BKIN2_COMP12 0x630c -#define STM32H7_PG3_FUNC_FMC_A13 0x630d -#define STM32H7_PG3_FUNC_EVENTOUT 0x6310 -#define STM32H7_PG3_FUNC_ANALOG 0x6311 - -#define STM32H7_PG4_FUNC_GPIO 0x6400 -#define STM32H7_PG4_FUNC_TIM1_BKIN2 0x6402 -#define STM32H7_PG4_FUNC_TIM1_BKIN2_COMP12 0x640c -#define STM32H7_PG4_FUNC_FMC_A14_FMC_BA0 0x640d -#define STM32H7_PG4_FUNC_EVENTOUT 0x6410 -#define STM32H7_PG4_FUNC_ANALOG 0x6411 - -#define STM32H7_PG5_FUNC_GPIO 0x6500 -#define STM32H7_PG5_FUNC_TIM1_ETR 0x6502 -#define STM32H7_PG5_FUNC_FMC_A15_FMC_BA1 0x650d -#define STM32H7_PG5_FUNC_EVENTOUT 0x6510 -#define STM32H7_PG5_FUNC_ANALOG 0x6511 - -#define STM32H7_PG6_FUNC_GPIO 0x6600 -#define STM32H7_PG6_FUNC_TIM17_BKIN 0x6602 -#define STM32H7_PG6_FUNC_HRTIM_CHE1 0x6603 -#define STM32H7_PG6_FUNC_QUADSPI_BK1_NCS 0x660b -#define STM32H7_PG6_FUNC_FMC_NE3 0x660d -#define STM32H7_PG6_FUNC_DCMI_D12 0x660e -#define STM32H7_PG6_FUNC_LCD_R7 0x660f -#define STM32H7_PG6_FUNC_EVENTOUT 0x6610 -#define STM32H7_PG6_FUNC_ANALOG 0x6611 - -#define STM32H7_PG7_FUNC_GPIO 0x6700 -#define STM32H7_PG7_FUNC_HRTIM_CHE2 0x6703 -#define STM32H7_PG7_FUNC_SAI1_MCLK_A 0x6707 -#define STM32H7_PG7_FUNC_USART6_CK 0x6708 -#define STM32H7_PG7_FUNC_FMC_INT 0x670d -#define STM32H7_PG7_FUNC_DCMI_D13 0x670e -#define STM32H7_PG7_FUNC_LCD_CLK 0x670f -#define STM32H7_PG7_FUNC_EVENTOUT 0x6710 -#define STM32H7_PG7_FUNC_ANALOG 0x6711 - -#define STM32H7_PG8_FUNC_GPIO 0x6800 -#define STM32H7_PG8_FUNC_TIM8_ETR 0x6804 -#define STM32H7_PG8_FUNC_SPI6_NSS 0x6806 -#define STM32H7_PG8_FUNC_USART6_RTS 0x6808 -#define STM32H7_PG8_FUNC_SPDIFRX_IN2 0x6809 -#define STM32H7_PG8_FUNC_ETH_PPS_OUT 0x680c -#define STM32H7_PG8_FUNC_FMC_SDCLK 0x680d -#define STM32H7_PG8_FUNC_LCD_G7 0x680f -#define STM32H7_PG8_FUNC_EVENTOUT 0x6810 -#define STM32H7_PG8_FUNC_ANALOG 0x6811 - -#define STM32H7_PG9_FUNC_GPIO 0x6900 -#define STM32H7_PG9_FUNC_SPI1_MISO_I2S1_SDI 0x6906 -#define STM32H7_PG9_FUNC_USART6_RX 0x6908 -#define STM32H7_PG9_FUNC_SPDIFRX_IN3 0x6909 -#define STM32H7_PG9_FUNC_QUADSPI_BK2_IO2 0x690a -#define STM32H7_PG9_FUNC_SAI2_FS_B 0x690b -#define STM32H7_PG9_FUNC_FMC_NE2_FMC_NCE 0x690d -#define STM32H7_PG9_FUNC_DCMI_VSYNC 0x690e -#define STM32H7_PG9_FUNC_EVENTOUT 0x6910 -#define STM32H7_PG9_FUNC_ANALOG 0x6911 - -#define STM32H7_PG10_FUNC_GPIO 0x6a00 -#define STM32H7_PG10_FUNC_HRTIM_FLT5 0x6a03 -#define STM32H7_PG10_FUNC_SPI1_NSS_I2S1_WS 0x6a06 -#define STM32H7_PG10_FUNC_LCD_G3 0x6a0a -#define STM32H7_PG10_FUNC_SAI2_SD_B 0x6a0b -#define STM32H7_PG10_FUNC_FMC_NE3 0x6a0d -#define STM32H7_PG10_FUNC_DCMI_D2 0x6a0e -#define STM32H7_PG10_FUNC_LCD_B2 0x6a0f -#define STM32H7_PG10_FUNC_EVENTOUT 0x6a10 -#define STM32H7_PG10_FUNC_ANALOG 0x6a11 - -#define STM32H7_PG11_FUNC_GPIO 0x6b00 -#define STM32H7_PG11_FUNC_HRTIM_EEV4 0x6b03 -#define STM32H7_PG11_FUNC_SPI1_SCK_I2S1_CK 0x6b06 -#define STM32H7_PG11_FUNC_SPDIFRX_IN0 0x6b09 -#define STM32H7_PG11_FUNC_SDMMC2_D2 0x6b0b -#define STM32H7_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN 0x6b0c -#define STM32H7_PG11_FUNC_DCMI_D3 0x6b0e -#define STM32H7_PG11_FUNC_LCD_B3 0x6b0f -#define STM32H7_PG11_FUNC_EVENTOUT 0x6b10 -#define STM32H7_PG11_FUNC_ANALOG 0x6b11 - -#define STM32H7_PG12_FUNC_GPIO 0x6c00 -#define STM32H7_PG12_FUNC_LPTIM1_IN1 0x6c02 -#define STM32H7_PG12_FUNC_HRTIM_EEV5 0x6c03 -#define STM32H7_PG12_FUNC_SPI6_MISO 0x6c06 -#define STM32H7_PG12_FUNC_USART6_RTS 0x6c08 -#define STM32H7_PG12_FUNC_SPDIFRX_IN1 0x6c09 -#define STM32H7_PG12_FUNC_LCD_B4 0x6c0a -#define STM32H7_PG12_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x6c0c -#define STM32H7_PG12_FUNC_FMC_NE4 0x6c0d -#define STM32H7_PG12_FUNC_LCD_B1 0x6c0f -#define STM32H7_PG12_FUNC_EVENTOUT 0x6c10 -#define STM32H7_PG12_FUNC_ANALOG 0x6c11 - -#define STM32H7_PG13_FUNC_GPIO 0x6d00 -#define STM32H7_PG13_FUNC_TRACED0 0x6d01 -#define STM32H7_PG13_FUNC_LPTIM1_OUT 0x6d02 -#define STM32H7_PG13_FUNC_HRTIM_EEV10 0x6d03 -#define STM32H7_PG13_FUNC_SPI6_SCK 0x6d06 -#define STM32H7_PG13_FUNC_USART6_CTS_NSS 0x6d08 -#define STM32H7_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0 0x6d0c -#define STM32H7_PG13_FUNC_FMC_A24 0x6d0d -#define STM32H7_PG13_FUNC_LCD_R0 0x6d0f -#define STM32H7_PG13_FUNC_EVENTOUT 0x6d10 -#define STM32H7_PG13_FUNC_ANALOG 0x6d11 - -#define STM32H7_PG14_FUNC_GPIO 0x6e00 -#define STM32H7_PG14_FUNC_TRACED1 0x6e01 -#define STM32H7_PG14_FUNC_LPTIM1_ETR 0x6e02 -#define STM32H7_PG14_FUNC_SPI6_MOSI 0x6e06 -#define STM32H7_PG14_FUNC_USART6_TX 0x6e08 -#define STM32H7_PG14_FUNC_QUADSPI_BK2_IO3 0x6e0a -#define STM32H7_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1 0x6e0c -#define STM32H7_PG14_FUNC_FMC_A25 0x6e0d -#define STM32H7_PG14_FUNC_LCD_B0 0x6e0f -#define STM32H7_PG14_FUNC_EVENTOUT 0x6e10 -#define STM32H7_PG14_FUNC_ANALOG 0x6e11 - -#define STM32H7_PG15_FUNC_GPIO 0x6f00 -#define STM32H7_PG15_FUNC_USART6_CTS_NSS 0x6f08 -#define STM32H7_PG15_FUNC_FMC_SDNCAS 0x6f0d -#define STM32H7_PG15_FUNC_DCMI_D13 0x6f0e -#define STM32H7_PG15_FUNC_EVENTOUT 0x6f10 -#define STM32H7_PG15_FUNC_ANALOG 0x6f11 - -#define STM32H7_PH0_FUNC_GPIO 0x7000 -#define STM32H7_PH0_FUNC_EVENTOUT 0x7010 -#define STM32H7_PH0_FUNC_ANALOG 0x7011 - -#define STM32H7_PH1_FUNC_GPIO 0x7100 -#define STM32H7_PH1_FUNC_EVENTOUT 0x7110 -#define STM32H7_PH1_FUNC_ANALOG 0x7111 - -#define STM32H7_PH2_FUNC_GPIO 0x7200 -#define STM32H7_PH2_FUNC_LPTIM1_IN2 0x7202 -#define STM32H7_PH2_FUNC_QUADSPI_BK2_IO0 0x720a -#define STM32H7_PH2_FUNC_SAI2_SCK_B 0x720b -#define STM32H7_PH2_FUNC_ETH_MII_CRS 0x720c -#define STM32H7_PH2_FUNC_FMC_SDCKE0 0x720d -#define STM32H7_PH2_FUNC_LCD_R0 0x720f -#define STM32H7_PH2_FUNC_EVENTOUT 0x7210 -#define STM32H7_PH2_FUNC_ANALOG 0x7211 - -#define STM32H7_PH3_FUNC_GPIO 0x7300 -#define STM32H7_PH3_FUNC_QUADSPI_BK2_IO1 0x730a -#define STM32H7_PH3_FUNC_SAI2_MCK_B 0x730b -#define STM32H7_PH3_FUNC_ETH_MII_COL 0x730c -#define STM32H7_PH3_FUNC_FMC_SDNE0 0x730d -#define STM32H7_PH3_FUNC_LCD_R1 0x730f -#define STM32H7_PH3_FUNC_EVENTOUT 0x7310 -#define STM32H7_PH3_FUNC_ANALOG 0x7311 - -#define STM32H7_PH4_FUNC_GPIO 0x7400 -#define STM32H7_PH4_FUNC_I2C2_SCL 0x7405 -#define STM32H7_PH4_FUNC_LCD_G5 0x740a -#define STM32H7_PH4_FUNC_OTG_HS_ULPI_NXT 0x740b -#define STM32H7_PH4_FUNC_LCD_G4 0x740f -#define STM32H7_PH4_FUNC_EVENTOUT 0x7410 -#define STM32H7_PH4_FUNC_ANALOG 0x7411 - -#define STM32H7_PH5_FUNC_GPIO 0x7500 -#define STM32H7_PH5_FUNC_I2C2_SDA 0x7505 -#define STM32H7_PH5_FUNC_SPI5_NSS 0x7506 -#define STM32H7_PH5_FUNC_FMC_SDNWE 0x750d -#define STM32H7_PH5_FUNC_EVENTOUT 0x7510 -#define STM32H7_PH5_FUNC_ANALOG 0x7511 - -#define STM32H7_PH6_FUNC_GPIO 0x7600 -#define STM32H7_PH6_FUNC_I2C2_SMBA 0x7605 -#define STM32H7_PH6_FUNC_SPI5_SCK 0x7606 -#define STM32H7_PH6_FUNC_ETH_MII_RXD2 0x760c -#define STM32H7_PH6_FUNC_FMC_SDNE1 0x760d -#define STM32H7_PH6_FUNC_DCMI_D8 0x760e -#define STM32H7_PH6_FUNC_EVENTOUT 0x7610 -#define STM32H7_PH6_FUNC_ANALOG 0x7611 - -#define STM32H7_PH7_FUNC_GPIO 0x7700 -#define STM32H7_PH7_FUNC_I2C3_SCL 0x7705 -#define STM32H7_PH7_FUNC_SPI5_MISO 0x7706 -#define STM32H7_PH7_FUNC_ETH_MII_RXD3 0x770c -#define STM32H7_PH7_FUNC_FMC_SDCKE1 0x770d -#define STM32H7_PH7_FUNC_DCMI_D9 0x770e -#define STM32H7_PH7_FUNC_EVENTOUT 0x7710 -#define STM32H7_PH7_FUNC_ANALOG 0x7711 - -#define STM32H7_PH8_FUNC_GPIO 0x7800 -#define STM32H7_PH8_FUNC_TIM5_ETR 0x7803 -#define STM32H7_PH8_FUNC_I2C3_SDA 0x7805 -#define STM32H7_PH8_FUNC_FMC_D16 0x780d -#define STM32H7_PH8_FUNC_DCMI_HSYNC 0x780e -#define STM32H7_PH8_FUNC_LCD_R2 0x780f -#define STM32H7_PH8_FUNC_EVENTOUT 0x7810 -#define STM32H7_PH8_FUNC_ANALOG 0x7811 - -#define STM32H7_PH9_FUNC_GPIO 0x7900 -#define STM32H7_PH9_FUNC_I2C3_SMBA 0x7905 -#define STM32H7_PH9_FUNC_FMC_D17 0x790d -#define STM32H7_PH9_FUNC_DCMI_D0 0x790e -#define STM32H7_PH9_FUNC_LCD_R3 0x790f -#define STM32H7_PH9_FUNC_EVENTOUT 0x7910 -#define STM32H7_PH9_FUNC_ANALOG 0x7911 - -#define STM32H7_PH10_FUNC_GPIO 0x7a00 -#define STM32H7_PH10_FUNC_TIM5_CH1 0x7a03 -#define STM32H7_PH10_FUNC_I2C4_SMBA 0x7a05 -#define STM32H7_PH10_FUNC_FMC_D18 0x7a0d -#define STM32H7_PH10_FUNC_DCMI_D1 0x7a0e -#define STM32H7_PH10_FUNC_LCD_R4 0x7a0f -#define STM32H7_PH10_FUNC_EVENTOUT 0x7a10 -#define STM32H7_PH10_FUNC_ANALOG 0x7a11 - -#define STM32H7_PH11_FUNC_GPIO 0x7b00 -#define STM32H7_PH11_FUNC_TIM5_CH2 0x7b03 -#define STM32H7_PH11_FUNC_I2C4_SCL 0x7b05 -#define STM32H7_PH11_FUNC_FMC_D19 0x7b0d -#define STM32H7_PH11_FUNC_DCMI_D2 0x7b0e -#define STM32H7_PH11_FUNC_LCD_R5 0x7b0f -#define STM32H7_PH11_FUNC_EVENTOUT 0x7b10 -#define STM32H7_PH11_FUNC_ANALOG 0x7b11 - -#define STM32H7_PH12_FUNC_GPIO 0x7c00 -#define STM32H7_PH12_FUNC_TIM5_CH3 0x7c03 -#define STM32H7_PH12_FUNC_I2C4_SDA 0x7c05 -#define STM32H7_PH12_FUNC_FMC_D20 0x7c0d -#define STM32H7_PH12_FUNC_DCMI_D3 0x7c0e -#define STM32H7_PH12_FUNC_LCD_R6 0x7c0f -#define STM32H7_PH12_FUNC_EVENTOUT 0x7c10 -#define STM32H7_PH12_FUNC_ANALOG 0x7c11 - -#define STM32H7_PH13_FUNC_GPIO 0x7d00 -#define STM32H7_PH13_FUNC_TIM8_CH1N 0x7d04 -#define STM32H7_PH13_FUNC_UART4_TX 0x7d09 -#define STM32H7_PH13_FUNC_CAN1_TX 0x7d0a -#define STM32H7_PH13_FUNC_FMC_D21 0x7d0d -#define STM32H7_PH13_FUNC_LCD_G2 0x7d0f -#define STM32H7_PH13_FUNC_EVENTOUT 0x7d10 -#define STM32H7_PH13_FUNC_ANALOG 0x7d11 - -#define STM32H7_PH14_FUNC_GPIO 0x7e00 -#define STM32H7_PH14_FUNC_TIM8_CH2N 0x7e04 -#define STM32H7_PH14_FUNC_UART4_RX 0x7e09 -#define STM32H7_PH14_FUNC_CAN1_RX 0x7e0a -#define STM32H7_PH14_FUNC_FMC_D22 0x7e0d -#define STM32H7_PH14_FUNC_DCMI_D4 0x7e0e -#define STM32H7_PH14_FUNC_LCD_G3 0x7e0f -#define STM32H7_PH14_FUNC_EVENTOUT 0x7e10 -#define STM32H7_PH14_FUNC_ANALOG 0x7e11 - -#define STM32H7_PH15_FUNC_GPIO 0x7f00 -#define STM32H7_PH15_FUNC_TIM8_CH3N 0x7f04 -#define STM32H7_PH15_FUNC_CAN1_TXFD 0x7f0a -#define STM32H7_PH15_FUNC_FMC_D23 0x7f0d -#define STM32H7_PH15_FUNC_DCMI_D11 0x7f0e -#define STM32H7_PH15_FUNC_LCD_G4 0x7f0f -#define STM32H7_PH15_FUNC_EVENTOUT 0x7f10 -#define STM32H7_PH15_FUNC_ANALOG 0x7f11 - -#define STM32H7_PI0_FUNC_GPIO 0x8000 -#define STM32H7_PI0_FUNC_TIM5_CH4 0x8003 -#define STM32H7_PI0_FUNC_SPI2_NSS_I2S2_WS 0x8006 -#define STM32H7_PI0_FUNC_CAN1_RXFD 0x800a -#define STM32H7_PI0_FUNC_FMC_D24 0x800d -#define STM32H7_PI0_FUNC_DCMI_D13 0x800e -#define STM32H7_PI0_FUNC_LCD_G5 0x800f -#define STM32H7_PI0_FUNC_EVENTOUT 0x8010 -#define STM32H7_PI0_FUNC_ANALOG 0x8011 - -#define STM32H7_PI1_FUNC_GPIO 0x8100 -#define STM32H7_PI1_FUNC_TIM8_BKIN2 0x8104 -#define STM32H7_PI1_FUNC_SPI2_SCK_I2S2_CK 0x8106 -#define STM32H7_PI1_FUNC_TIM8_BKIN2_COMP12 0x810c -#define STM32H7_PI1_FUNC_FMC_D25 0x810d -#define STM32H7_PI1_FUNC_DCMI_D8 0x810e -#define STM32H7_PI1_FUNC_LCD_G6 0x810f -#define STM32H7_PI1_FUNC_EVENTOUT 0x8110 -#define STM32H7_PI1_FUNC_ANALOG 0x8111 - -#define STM32H7_PI2_FUNC_GPIO 0x8200 -#define STM32H7_PI2_FUNC_TIM8_CH4 0x8204 -#define STM32H7_PI2_FUNC_SPI2_MISO_I2S2_SDI 0x8206 -#define STM32H7_PI2_FUNC_FMC_D26 0x820d -#define STM32H7_PI2_FUNC_DCMI_D9 0x820e -#define STM32H7_PI2_FUNC_LCD_G7 0x820f -#define STM32H7_PI2_FUNC_EVENTOUT 0x8210 -#define STM32H7_PI2_FUNC_ANALOG 0x8211 - -#define STM32H7_PI3_FUNC_GPIO 0x8300 -#define STM32H7_PI3_FUNC_TIM8_ETR 0x8304 -#define STM32H7_PI3_FUNC_SPI2_MOSI_I2S2_SDO 0x8306 -#define STM32H7_PI3_FUNC_FMC_D27 0x830d -#define STM32H7_PI3_FUNC_DCMI_D10 0x830e -#define STM32H7_PI3_FUNC_EVENTOUT 0x8310 -#define STM32H7_PI3_FUNC_ANALOG 0x8311 - -#define STM32H7_PI4_FUNC_GPIO 0x8400 -#define STM32H7_PI4_FUNC_TIM8_BKIN 0x8404 -#define STM32H7_PI4_FUNC_SAI2_MCK_A 0x840b -#define STM32H7_PI4_FUNC_TIM8_BKIN_COMP12 0x840c -#define STM32H7_PI4_FUNC_FMC_NBL2 0x840d -#define STM32H7_PI4_FUNC_DCMI_D5 0x840e -#define STM32H7_PI4_FUNC_LCD_B4 0x840f -#define STM32H7_PI4_FUNC_EVENTOUT 0x8410 -#define STM32H7_PI4_FUNC_ANALOG 0x8411 - -#define STM32H7_PI5_FUNC_GPIO 0x8500 -#define STM32H7_PI5_FUNC_TIM8_CH1 0x8504 -#define STM32H7_PI5_FUNC_SAI2_SCK_A 0x850b -#define STM32H7_PI5_FUNC_FMC_NBL3 0x850d -#define STM32H7_PI5_FUNC_DCMI_VSYNC 0x850e -#define STM32H7_PI5_FUNC_LCD_B5 0x850f -#define STM32H7_PI5_FUNC_EVENTOUT 0x8510 -#define STM32H7_PI5_FUNC_ANALOG 0x8511 - -#define STM32H7_PI6_FUNC_GPIO 0x8600 -#define STM32H7_PI6_FUNC_TIM8_CH2 0x8604 -#define STM32H7_PI6_FUNC_SAI2_SD_A 0x860b -#define STM32H7_PI6_FUNC_FMC_D28 0x860d -#define STM32H7_PI6_FUNC_DCMI_D6 0x860e -#define STM32H7_PI6_FUNC_LCD_B6 0x860f -#define STM32H7_PI6_FUNC_EVENTOUT 0x8610 -#define STM32H7_PI6_FUNC_ANALOG 0x8611 - -#define STM32H7_PI7_FUNC_GPIO 0x8700 -#define STM32H7_PI7_FUNC_TIM8_CH3 0x8704 -#define STM32H7_PI7_FUNC_SAI2_FS_A 0x870b -#define STM32H7_PI7_FUNC_FMC_D29 0x870d -#define STM32H7_PI7_FUNC_DCMI_D7 0x870e -#define STM32H7_PI7_FUNC_LCD_B7 0x870f -#define STM32H7_PI7_FUNC_EVENTOUT 0x8710 -#define STM32H7_PI7_FUNC_ANALOG 0x8711 - -#define STM32H7_PI8_FUNC_GPIO 0x8800 -#define STM32H7_PI8_FUNC_EVENTOUT 0x8810 -#define STM32H7_PI8_FUNC_ANALOG 0x8811 - -#define STM32H7_PI9_FUNC_GPIO 0x8900 -#define STM32H7_PI9_FUNC_UART4_RX 0x8909 -#define STM32H7_PI9_FUNC_CAN1_RX 0x890a -#define STM32H7_PI9_FUNC_FMC_D30 0x890d -#define STM32H7_PI9_FUNC_LCD_VSYNC 0x890f -#define STM32H7_PI9_FUNC_EVENTOUT 0x8910 -#define STM32H7_PI9_FUNC_ANALOG 0x8911 - -#define STM32H7_PI10_FUNC_GPIO 0x8a00 -#define STM32H7_PI10_FUNC_CAN1_RXFD 0x8a0a -#define STM32H7_PI10_FUNC_ETH_MII_RX_ER 0x8a0c -#define STM32H7_PI10_FUNC_FMC_D31 0x8a0d -#define STM32H7_PI10_FUNC_LCD_HSYNC 0x8a0f -#define STM32H7_PI10_FUNC_EVENTOUT 0x8a10 -#define STM32H7_PI10_FUNC_ANALOG 0x8a11 - -#define STM32H7_PI11_FUNC_GPIO 0x8b00 -#define STM32H7_PI11_FUNC_LCD_G6 0x8b0a -#define STM32H7_PI11_FUNC_OTG_HS_ULPI_DIR 0x8b0b -#define STM32H7_PI11_FUNC_EVENTOUT 0x8b10 -#define STM32H7_PI11_FUNC_ANALOG 0x8b11 - -#define STM32H7_PI12_FUNC_GPIO 0x8c00 -#define STM32H7_PI12_FUNC_ETH_TX_ER 0x8c0c -#define STM32H7_PI12_FUNC_LCD_HSYNC 0x8c0f -#define STM32H7_PI12_FUNC_EVENTOUT 0x8c10 -#define STM32H7_PI12_FUNC_ANALOG 0x8c11 - -#define STM32H7_PI13_FUNC_GPIO 0x8d00 -#define STM32H7_PI13_FUNC_LCD_VSYNC 0x8d0f -#define STM32H7_PI13_FUNC_EVENTOUT 0x8d10 -#define STM32H7_PI13_FUNC_ANALOG 0x8d11 - -#define STM32H7_PI14_FUNC_GPIO 0x8e00 -#define STM32H7_PI14_FUNC_LCD_CLK 0x8e0f -#define STM32H7_PI14_FUNC_EVENTOUT 0x8e10 -#define STM32H7_PI14_FUNC_ANALOG 0x8e11 - -#define STM32H7_PI15_FUNC_GPIO 0x8f00 -#define STM32H7_PI15_FUNC_LCD_G2 0x8f0a -#define STM32H7_PI15_FUNC_LCD_R0 0x8f0f -#define STM32H7_PI15_FUNC_EVENTOUT 0x8f10 -#define STM32H7_PI15_FUNC_ANALOG 0x8f11 - -#define STM32H7_PJ0_FUNC_GPIO 0x9000 -#define STM32H7_PJ0_FUNC_LCD_R7 0x900a -#define STM32H7_PJ0_FUNC_LCD_R1 0x900f -#define STM32H7_PJ0_FUNC_EVENTOUT 0x9010 -#define STM32H7_PJ0_FUNC_ANALOG 0x9011 - -#define STM32H7_PJ1_FUNC_GPIO 0x9100 -#define STM32H7_PJ1_FUNC_LCD_R2 0x910f -#define STM32H7_PJ1_FUNC_EVENTOUT 0x9110 -#define STM32H7_PJ1_FUNC_ANALOG 0x9111 - -#define STM32H7_PJ2_FUNC_GPIO 0x9200 -#define STM32H7_PJ2_FUNC_DSI_TE 0x920e -#define STM32H7_PJ2_FUNC_LCD_R3 0x920f -#define STM32H7_PJ2_FUNC_EVENTOUT 0x9210 -#define STM32H7_PJ2_FUNC_ANALOG 0x9211 - -#define STM32H7_PJ3_FUNC_GPIO 0x9300 -#define STM32H7_PJ3_FUNC_LCD_R4 0x930f -#define STM32H7_PJ3_FUNC_EVENTOUT 0x9310 -#define STM32H7_PJ3_FUNC_ANALOG 0x9311 - -#define STM32H7_PJ4_FUNC_GPIO 0x9400 -#define STM32H7_PJ4_FUNC_LCD_R5 0x940f -#define STM32H7_PJ4_FUNC_EVENTOUT 0x9410 -#define STM32H7_PJ4_FUNC_ANALOG 0x9411 - -#define STM32H7_PJ5_FUNC_GPIO 0x9500 -#define STM32H7_PJ5_FUNC_LCD_R6 0x950f -#define STM32H7_PJ5_FUNC_EVENTOUT 0x9510 -#define STM32H7_PJ5_FUNC_ANALOG 0x9511 - -#define STM32H7_PJ6_FUNC_GPIO 0x9600 -#define STM32H7_PJ6_FUNC_TIM8_CH2 0x9604 -#define STM32H7_PJ6_FUNC_LCD_R7 0x960f -#define STM32H7_PJ6_FUNC_EVENTOUT 0x9610 -#define STM32H7_PJ6_FUNC_ANALOG 0x9611 - -#define STM32H7_PJ7_FUNC_GPIO 0x9700 -#define STM32H7_PJ7_FUNC_TRGIN 0x9701 -#define STM32H7_PJ7_FUNC_TIM8_CH2N 0x9704 -#define STM32H7_PJ7_FUNC_LCD_G0 0x970f -#define STM32H7_PJ7_FUNC_EVENTOUT 0x9710 -#define STM32H7_PJ7_FUNC_ANALOG 0x9711 - -#define STM32H7_PJ8_FUNC_GPIO 0x9800 -#define STM32H7_PJ8_FUNC_TIM1_CH3N 0x9802 -#define STM32H7_PJ8_FUNC_TIM8_CH1 0x9804 -#define STM32H7_PJ8_FUNC_UART8_TX 0x9809 -#define STM32H7_PJ8_FUNC_LCD_G1 0x980f -#define STM32H7_PJ8_FUNC_EVENTOUT 0x9810 -#define STM32H7_PJ8_FUNC_ANALOG 0x9811 - -#define STM32H7_PJ9_FUNC_GPIO 0x9900 -#define STM32H7_PJ9_FUNC_TIM1_CH3 0x9902 -#define STM32H7_PJ9_FUNC_TIM8_CH1N 0x9904 -#define STM32H7_PJ9_FUNC_UART8_RX 0x9909 -#define STM32H7_PJ9_FUNC_LCD_G2 0x990f -#define STM32H7_PJ9_FUNC_EVENTOUT 0x9910 -#define STM32H7_PJ9_FUNC_ANALOG 0x9911 - -#define STM32H7_PJ10_FUNC_GPIO 0x9a00 -#define STM32H7_PJ10_FUNC_TIM1_CH2N 0x9a02 -#define STM32H7_PJ10_FUNC_TIM8_CH2 0x9a04 -#define STM32H7_PJ10_FUNC_SPI5_MOSI 0x9a06 -#define STM32H7_PJ10_FUNC_LCD_G3 0x9a0f -#define STM32H7_PJ10_FUNC_EVENTOUT 0x9a10 -#define STM32H7_PJ10_FUNC_ANALOG 0x9a11 - -#define STM32H7_PJ11_FUNC_GPIO 0x9b00 -#define STM32H7_PJ11_FUNC_TIM1_CH2 0x9b02 -#define STM32H7_PJ11_FUNC_TIM8_CH2N 0x9b04 -#define STM32H7_PJ11_FUNC_SPI5_MISO 0x9b06 -#define STM32H7_PJ11_FUNC_LCD_G4 0x9b0f -#define STM32H7_PJ11_FUNC_EVENTOUT 0x9b10 -#define STM32H7_PJ11_FUNC_ANALOG 0x9b11 - -#define STM32H7_PJ12_FUNC_GPIO 0x9c00 -#define STM32H7_PJ12_FUNC_TRGOUT 0x9c01 -#define STM32H7_PJ12_FUNC_LCD_G3 0x9c0a -#define STM32H7_PJ12_FUNC_LCD_B0 0x9c0f -#define STM32H7_PJ12_FUNC_EVENTOUT 0x9c10 -#define STM32H7_PJ12_FUNC_ANALOG 0x9c11 - -#define STM32H7_PJ13_FUNC_GPIO 0x9d00 -#define STM32H7_PJ13_FUNC_LCD_B4 0x9d0a -#define STM32H7_PJ13_FUNC_LCD_B1 0x9d0f -#define STM32H7_PJ13_FUNC_EVENTOUT 0x9d10 -#define STM32H7_PJ13_FUNC_ANALOG 0x9d11 - -#define STM32H7_PJ14_FUNC_GPIO 0x9e00 -#define STM32H7_PJ14_FUNC_LCD_B2 0x9e0f -#define STM32H7_PJ14_FUNC_EVENTOUT 0x9e10 -#define STM32H7_PJ14_FUNC_ANALOG 0x9e11 - -#define STM32H7_PJ15_FUNC_GPIO 0x9f00 -#define STM32H7_PJ15_FUNC_LCD_B3 0x9f0f -#define STM32H7_PJ15_FUNC_EVENTOUT 0x9f10 -#define STM32H7_PJ15_FUNC_ANALOG 0x9f11 - -#define STM32H7_PK0_FUNC_GPIO 0xa000 -#define STM32H7_PK0_FUNC_TIM1_CH1N 0xa002 -#define STM32H7_PK0_FUNC_TIM8_CH3 0xa004 -#define STM32H7_PK0_FUNC_SPI5_SCK 0xa006 -#define STM32H7_PK0_FUNC_LCD_G5 0xa00f -#define STM32H7_PK0_FUNC_EVENTOUT 0xa010 -#define STM32H7_PK0_FUNC_ANALOG 0xa011 - -#define STM32H7_PK1_FUNC_GPIO 0xa100 -#define STM32H7_PK1_FUNC_TIM1_CH1 0xa102 -#define STM32H7_PK1_FUNC_TIM8_CH3N 0xa104 -#define STM32H7_PK1_FUNC_SPI5_NSS 0xa106 -#define STM32H7_PK1_FUNC_LCD_G6 0xa10f -#define STM32H7_PK1_FUNC_EVENTOUT 0xa110 -#define STM32H7_PK1_FUNC_ANALOG 0xa111 - -#define STM32H7_PK2_FUNC_GPIO 0xa200 -#define STM32H7_PK2_FUNC_TIM1_BKIN 0xa202 -#define STM32H7_PK2_FUNC_TIM8_BKIN 0xa204 -#define STM32H7_PK2_FUNC_TIM8_BKIN_COMP12 0xa20b -#define STM32H7_PK2_FUNC_TIM1_BKIN_COMP12 0xa20c -#define STM32H7_PK2_FUNC_LCD_G7 0xa20f -#define STM32H7_PK2_FUNC_EVENTOUT 0xa210 -#define STM32H7_PK2_FUNC_ANALOG 0xa211 - -#define STM32H7_PK3_FUNC_GPIO 0xa300 -#define STM32H7_PK3_FUNC_LCD_B4 0xa30f -#define STM32H7_PK3_FUNC_EVENTOUT 0xa310 -#define STM32H7_PK3_FUNC_ANALOG 0xa311 - -#define STM32H7_PK4_FUNC_GPIO 0xa400 -#define STM32H7_PK4_FUNC_LCD_B5 0xa40f -#define STM32H7_PK4_FUNC_EVENTOUT 0xa410 -#define STM32H7_PK4_FUNC_ANALOG 0xa411 - -#define STM32H7_PK5_FUNC_GPIO 0xa500 -#define STM32H7_PK5_FUNC_LCD_B6 0xa50f -#define STM32H7_PK5_FUNC_EVENTOUT 0xa510 -#define STM32H7_PK5_FUNC_ANALOG 0xa511 - -#define STM32H7_PK6_FUNC_GPIO 0xa600 -#define STM32H7_PK6_FUNC_LCD_B7 0xa60f -#define STM32H7_PK6_FUNC_EVENTOUT 0xa610 -#define STM32H7_PK6_FUNC_ANALOG 0xa611 - -#define STM32H7_PK7_FUNC_GPIO 0xa700 -#define STM32H7_PK7_FUNC_LCD_DE 0xa70f -#define STM32H7_PK7_FUNC_EVENTOUT 0xa710 -#define STM32H7_PK7_FUNC_ANALOG 0xa711 - -#endif /* _DT_BINDINGS_STM32H7_PINFUNC_H */ diff --git a/include/dt-bindings/power/mt8173-power.h b/include/dt-bindings/power/mt8173-power.h index b34cee95aa89..15d531aa6e78 100644 --- a/include/dt-bindings/power/mt8173-power.h +++ b/include/dt-bindings/power/mt8173-power.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DT_BINDINGS_POWER_MT8183_POWER_H  #define _DT_BINDINGS_POWER_MT8183_POWER_H diff --git a/include/dt-bindings/power/r8a77970-sysc.h b/include/dt-bindings/power/r8a77970-sysc.h new file mode 100644 index 000000000000..bf54779d1625 --- /dev/null +++ b/include/dt-bindings/power/r8a77970-sysc.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Cogent Embedded Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef __DT_BINDINGS_POWER_R8A77970_SYSC_H__ +#define __DT_BINDINGS_POWER_R8A77970_SYSC_H__ + +/* + * These power domain indices match the numbers of the interrupt bits + * representing the power areas in the various Interrupt Registers + * (e.g. SYSCISR, Interrupt Status Register) + */ + +#define R8A77970_PD_CA53_CPU0		 5 +#define R8A77970_PD_CA53_CPU1		 6 +#define R8A77970_PD_CR7			13 +#define R8A77970_PD_CA53_SCU		21 +#define R8A77970_PD_A2IR0		23 +#define R8A77970_PD_A3IR			24 +#define R8A77970_PD_A2IR1		27 +#define R8A77970_PD_A2IR2		28 +#define R8A77970_PD_A2IR3		29 +#define R8A77970_PD_A2SC0		30 +#define R8A77970_PD_A2SC1		31 + +/* Always-on power area */ +#define R8A77970_PD_ALWAYS_ON		32 + +#endif /* __DT_BINDINGS_POWER_R8A77970_SYSC_H__ */ diff --git a/include/dt-bindings/power/rk3288-power.h b/include/dt-bindings/power/rk3288-power.h index b8b1045f3daa..f710b56ccd81 100644 --- a/include/dt-bindings/power/rk3288-power.h +++ b/include/dt-bindings/power/rk3288-power.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_BINDINGS_POWER_RK3288_POWER_H__  #define __DT_BINDINGS_POWER_RK3288_POWER_H__ diff --git a/include/dt-bindings/power/rk3328-power.h b/include/dt-bindings/power/rk3328-power.h index 10c3c3715334..02e3d7fc1cce 100644 --- a/include/dt-bindings/power/rk3328-power.h +++ b/include/dt-bindings/power/rk3328-power.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_BINDINGS_POWER_RK3328_POWER_H__  #define __DT_BINDINGS_POWER_RK3328_POWER_H__ diff --git a/include/dt-bindings/power/rk3368-power.h b/include/dt-bindings/power/rk3368-power.h index 93633d57ed84..5e602dbd64ec 100644 --- a/include/dt-bindings/power/rk3368-power.h +++ b/include/dt-bindings/power/rk3368-power.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_BINDINGS_POWER_RK3368_POWER_H__  #define __DT_BINDINGS_POWER_RK3368_POWER_H__ diff --git a/include/dt-bindings/power/rk3399-power.h b/include/dt-bindings/power/rk3399-power.h index 168b3bfbd6f5..aedd8b180fe4 100644 --- a/include/dt-bindings/power/rk3399-power.h +++ b/include/dt-bindings/power/rk3399-power.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_BINDINGS_POWER_RK3399_POWER_H__  #define __DT_BINDINGS_POWER_RK3399_POWER_H__ diff --git a/include/dt-bindings/pwm/pwm.h b/include/dt-bindings/pwm/pwm.h index 96f49e82253e..ab9a077e3c7d 100644 --- a/include/dt-bindings/pwm/pwm.h +++ b/include/dt-bindings/pwm/pwm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for most PWM bindings.   * diff --git a/include/dt-bindings/reset/cortina,gemini-reset.h b/include/dt-bindings/reset/cortina,gemini-reset.h index 0b886aee65e3..f48aff23847a 100644 --- a/include/dt-bindings/reset/cortina,gemini-reset.h +++ b/include/dt-bindings/reset/cortina,gemini-reset.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DT_BINDINGS_RESET_CORTINA_GEMINI_H  #define _DT_BINDINGS_RESET_CORTINA_GEMINI_H diff --git a/include/dt-bindings/reset/hisi,hi6220-resets.h b/include/dt-bindings/reset/hisi,hi6220-resets.h index 322ec5335b65..e7c362a81a97 100644 --- a/include/dt-bindings/reset/hisi,hi6220-resets.h +++ b/include/dt-bindings/reset/hisi,hi6220-resets.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /**   * This header provides index for the reset controller   * based on hi6220 SoC. diff --git a/include/dt-bindings/reset/mt7622-reset.h b/include/dt-bindings/reset/mt7622-reset.h new file mode 100644 index 000000000000..234052f80417 --- /dev/null +++ b/include/dt-bindings/reset/mt7622-reset.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2017 MediaTek Inc. + * Author: Sean Wang <sean.wang@mediatek.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT7622 +#define _DT_BINDINGS_RESET_CONTROLLER_MT7622 + +/* INFRACFG resets */ +#define MT7622_INFRA_EMI_REG_RST		0 +#define MT7622_INFRA_DRAMC0_A0_RST		1 +#define MT7622_INFRA_APCIRQ_EINT_RST		3 +#define MT7622_INFRA_APXGPT_RST			4 +#define MT7622_INFRA_SCPSYS_RST			5 +#define MT7622_INFRA_PMIC_WRAP_RST		7 +#define MT7622_INFRA_IRRX_RST			9 +#define MT7622_INFRA_EMI_RST			16 +#define MT7622_INFRA_WED0_RST			17 +#define MT7622_INFRA_DRAMC_RST			18 +#define MT7622_INFRA_CCI_INTF_RST		19 +#define MT7622_INFRA_TRNG_RST			21 +#define MT7622_INFRA_SYSIRQ_RST			22 +#define MT7622_INFRA_WED1_RST			25 + +/* PERICFG Subsystem resets */ +#define MT7622_PERI_UART0_SW_RST		0 +#define MT7622_PERI_UART1_SW_RST		1 +#define MT7622_PERI_UART2_SW_RST		2 +#define MT7622_PERI_UART3_SW_RST		3 +#define MT7622_PERI_UART4_SW_RST		4 +#define MT7622_PERI_BTIF_SW_RST			6 +#define MT7622_PERI_PWM_SW_RST			8 +#define MT7622_PERI_AUXADC_SW_RST		10 +#define MT7622_PERI_DMA_SW_RST			11 +#define MT7622_PERI_IRTX_SW_RST			13 +#define MT7622_PERI_NFI_SW_RST			14 +#define MT7622_PERI_THERM_SW_RST		16 +#define MT7622_PERI_MSDC0_SW_RST		19 +#define MT7622_PERI_MSDC1_SW_RST		20 +#define MT7622_PERI_I2C0_SW_RST			22 +#define MT7622_PERI_I2C1_SW_RST			23 +#define MT7622_PERI_I2C2_SW_RST			24 +#define MT7622_PERI_SPI0_SW_RST			33 +#define MT7622_PERI_SPI1_SW_RST			34 +#define MT7622_PERI_FLASHIF_SW_RST		36 + +/* TOPRGU resets */ +#define MT7622_TOPRGU_INFRA_RST			0 +#define MT7622_TOPRGU_ETHDMA_RST		1 +#define MT7622_TOPRGU_DDRPHY_RST		6 +#define MT7622_TOPRGU_INFRA_AO_RST		8 +#define MT7622_TOPRGU_CONN_RST			9 +#define MT7622_TOPRGU_APMIXED_RST		10 +#define MT7622_TOPRGU_CONN_MCU_RST		12 + +/* PCIe/SATA Subsystem resets */ +#define MT7622_SATA_PHY_REG_RST			12 +#define MT7622_SATA_PHY_SW_RST			13 +#define MT7622_SATA_AXI_BUS_RST			15 +#define MT7622_PCIE1_CORE_RST			19 +#define MT7622_PCIE1_MMIO_RST			20 +#define MT7622_PCIE1_HRST			21 +#define MT7622_PCIE1_USER_RST			22 +#define MT7622_PCIE1_PIPE_RST			23 +#define MT7622_PCIE0_CORE_RST			27 +#define MT7622_PCIE0_MMIO_RST			28 +#define MT7622_PCIE0_HRST			29 +#define MT7622_PCIE0_USER_RST			30 +#define MT7622_PCIE0_PIPE_RST			31 + +/* SSUSB Subsystem resets */ +#define MT7622_SSUSB_PHY_PWR_RST		3 +#define MT7622_SSUSB_MAC_PWR_RST		4 + +/* ETHSYS Subsystem resets */ +#define MT7622_ETHSYS_SYS_RST			0 +#define MT7622_ETHSYS_MCM_RST			2 +#define MT7622_ETHSYS_HSDMA_RST			5 +#define MT7622_ETHSYS_FE_RST			6 +#define MT7622_ETHSYS_GMAC_RST			23 +#define MT7622_ETHSYS_EPHY_RST			24 +#define MT7622_ETHSYS_CRYPTO_RST		29 +#define MT7622_ETHSYS_PPE_RST			31 + +#endif  /* _DT_BINDINGS_RESET_CONTROLLER_MT7622 */ diff --git a/include/dt-bindings/reset/pistachio-resets.h b/include/dt-bindings/reset/pistachio-resets.h index 60a189b1faef..5bb4dd0d6377 100644 --- a/include/dt-bindings/reset/pistachio-resets.h +++ b/include/dt-bindings/reset/pistachio-resets.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the reset controller   * present in the Pistachio SoC diff --git a/include/dt-bindings/reset/stih407-resets.h b/include/dt-bindings/reset/stih407-resets.h index 4ab3a1c94958..f2a2c4f7f06a 100644 --- a/include/dt-bindings/reset/stih407-resets.h +++ b/include/dt-bindings/reset/stih407-resets.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the reset controller   * based peripheral powerdown requests on the STMicroelectronics diff --git a/include/dt-bindings/reset/stih415-resets.h b/include/dt-bindings/reset/stih415-resets.h index c2329fe29cf6..96f7831a1db0 100644 --- a/include/dt-bindings/reset/stih415-resets.h +++ b/include/dt-bindings/reset/stih415-resets.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the reset controller   * based peripheral powerdown requests on the STMicroelectronics diff --git a/include/dt-bindings/reset/stih416-resets.h b/include/dt-bindings/reset/stih416-resets.h index fcf9af1ac0b2..f682c906ed5a 100644 --- a/include/dt-bindings/reset/stih416-resets.h +++ b/include/dt-bindings/reset/stih416-resets.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the reset controller   * based peripheral powerdown requests on the STMicroelectronics diff --git a/include/dt-bindings/reset/tegra124-car.h b/include/dt-bindings/reset/tegra124-car.h index 070e4f6e7486..97d2f3db82bf 100644 --- a/include/dt-bindings/reset/tegra124-car.h +++ b/include/dt-bindings/reset/tegra124-car.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides Tegra124-specific constants for binding   * nvidia,tegra124-car. diff --git a/include/dt-bindings/reset/tegra210-car.h b/include/dt-bindings/reset/tegra210-car.h index 296ec6e3f8c0..9dc84ec76301 100644 --- a/include/dt-bindings/reset/tegra210-car.h +++ b/include/dt-bindings/reset/tegra210-car.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides Tegra210-specific constants for binding   * nvidia,tegra210-car. diff --git a/include/dt-bindings/soc/rockchip,boot-mode.h b/include/dt-bindings/soc/rockchip,boot-mode.h index ae7c867e736a..4b0914c0989d 100644 --- a/include/dt-bindings/soc/rockchip,boot-mode.h +++ b/include/dt-bindings/soc/rockchip,boot-mode.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ROCKCHIP_BOOT_MODE_H  #define __ROCKCHIP_BOOT_MODE_H diff --git a/include/dt-bindings/sound/apq8016-lpass.h b/include/dt-bindings/sound/apq8016-lpass.h index 499076e980a3..3c3e16c0aadb 100644 --- a/include/dt-bindings/sound/apq8016-lpass.h +++ b/include/dt-bindings/sound/apq8016-lpass.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_APQ8016_LPASS_H  #define __DT_APQ8016_LPASS_H diff --git a/include/dt-bindings/sound/audio-jack-events.h b/include/dt-bindings/sound/audio-jack-events.h index 378349f28069..1b29b295126a 100644 --- a/include/dt-bindings/sound/audio-jack-events.h +++ b/include/dt-bindings/sound/audio-jack-events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __AUDIO_JACK_EVENTS_H  #define __AUDIO_JACK_EVENTS_H diff --git a/include/dt-bindings/sound/cs35l32.h b/include/dt-bindings/sound/cs35l32.h index 0c6d6a3c15a2..7549d5019e8b 100644 --- a/include/dt-bindings/sound/cs35l32.h +++ b/include/dt-bindings/sound/cs35l32.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_CS35L32_H  #define __DT_CS35L32_H diff --git a/include/dt-bindings/sound/fsl-imx-audmux.h b/include/dt-bindings/sound/fsl-imx-audmux.h index 50b09e96f247..751fe1416f95 100644 --- a/include/dt-bindings/sound/fsl-imx-audmux.h +++ b/include/dt-bindings/sound/fsl-imx-audmux.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_FSL_IMX_AUDMUX_H  #define __DT_FSL_IMX_AUDMUX_H diff --git a/include/dt-bindings/sound/samsung-i2s.h b/include/dt-bindings/sound/samsung-i2s.h index 0c69818d530c..77545f14c379 100644 --- a/include/dt-bindings/sound/samsung-i2s.h +++ b/include/dt-bindings/sound/samsung-i2s.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DT_BINDINGS_SAMSUNG_I2S_H  #define _DT_BINDINGS_SAMSUNG_I2S_H diff --git a/include/dt-bindings/sound/tas2552.h b/include/dt-bindings/sound/tas2552.h index a4e1a079980b..0daeb8385837 100644 --- a/include/dt-bindings/sound/tas2552.h +++ b/include/dt-bindings/sound/tas2552.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_TAS2552_H  #define __DT_TAS2552_H diff --git a/include/dt-bindings/sound/tlv320aic31xx-micbias.h b/include/dt-bindings/sound/tlv320aic31xx-micbias.h index f5cb772ab9c8..c6895a18a455 100644 --- a/include/dt-bindings/sound/tlv320aic31xx-micbias.h +++ b/include/dt-bindings/sound/tlv320aic31xx-micbias.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DT_TLV320AIC31XX_MICBIAS_H  #define __DT_TLV320AIC31XX_MICBIAS_H diff --git a/include/dt-bindings/thermal/lm90.h b/include/dt-bindings/thermal/lm90.h index 8c2e3095f704..eed91a16c32f 100644 --- a/include/dt-bindings/thermal/lm90.h +++ b/include/dt-bindings/thermal/lm90.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for the LM90 thermal bindings.   */ diff --git a/include/dt-bindings/thermal/tegra124-soctherm.h b/include/dt-bindings/thermal/tegra124-soctherm.h index 2a99f1d52bb5..c15e8b709a0d 100644 --- a/include/dt-bindings/thermal/tegra124-soctherm.h +++ b/include/dt-bindings/thermal/tegra124-soctherm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header provides constants for binding nvidia,tegra124-soctherm.   */ diff --git a/include/dt-bindings/thermal/tegra186-bpmp-thermal.h b/include/dt-bindings/thermal/tegra186-bpmp-thermal.h new file mode 100644 index 000000000000..a96b8fa31aab --- /dev/null +++ b/include/dt-bindings/thermal/tegra186-bpmp-thermal.h @@ -0,0 +1,14 @@ +/* + * This header provides constants for binding nvidia,tegra186-bpmp-thermal. + */ + +#ifndef _DT_BINDINGS_THERMAL_TEGRA186_BPMP_THERMAL_H +#define _DT_BINDINGS_THERMAL_TEGRA186_BPMP_THERMAL_H + +#define TEGRA186_BPMP_THERMAL_ZONE_CPU 2 +#define TEGRA186_BPMP_THERMAL_ZONE_GPU 3 +#define TEGRA186_BPMP_THERMAL_ZONE_AUX 4 +#define TEGRA186_BPMP_THERMAL_ZONE_PLLX 5 +#define TEGRA186_BPMP_THERMAL_ZONE_AO 6 + +#endif diff --git a/include/keys/ceph-type.h b/include/keys/ceph-type.h index f69c4ac197a0..aa6d3e050cc7 100644 --- a/include/keys/ceph-type.h +++ b/include/keys/ceph-type.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _KEYS_CEPH_TYPE_H  #define _KEYS_CEPH_TYPE_H diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index f0053f884b4a..01ee473517e2 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -31,8 +31,15 @@ struct arch_timer_context {  	/* Timer IRQ */  	struct kvm_irq_level		irq; -	/* Active IRQ state caching */ -	bool				active_cleared_last; +	/* +	 * We have multiple paths which can save/restore the timer state +	 * onto the hardware, so we need some way of keeping track of +	 * where the latest state is. +	 * +	 * loaded == true:  State is loaded on the hardware registers. +	 * loaded == false: State is stored in memory. +	 */ +	bool			loaded;  	/* Virtual offset */  	u64			cntvoff; @@ -43,13 +50,13 @@ struct arch_timer_cpu {  	struct arch_timer_context	ptimer;  	/* Background timer used when the guest is not running */ -	struct hrtimer			timer; +	struct hrtimer			bg_timer;  	/* Work queued with the above timer expires */  	struct work_struct		expired; -	/* Background timer active */ -	bool				armed; +	/* Physical timer emulation */ +	struct hrtimer			phys_timer;  	/* Is the timer enabled */  	bool			enabled; @@ -59,7 +66,6 @@ int kvm_timer_hyp_init(void);  int kvm_timer_enable(struct kvm_vcpu *vcpu);  int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu);  void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); -void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu);  void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu);  bool kvm_timer_should_notify_user(struct kvm_vcpu *vcpu);  void kvm_timer_update_run(struct kvm_vcpu *vcpu); @@ -72,16 +78,22 @@ int kvm_arm_timer_set_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr);  int kvm_arm_timer_get_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr);  int kvm_arm_timer_has_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr); -bool kvm_timer_should_fire(struct arch_timer_context *timer_ctx); +bool kvm_timer_is_pending(struct kvm_vcpu *vcpu); +  void kvm_timer_schedule(struct kvm_vcpu *vcpu);  void kvm_timer_unschedule(struct kvm_vcpu *vcpu);  u64 kvm_phys_timer_read(void); +void kvm_timer_vcpu_load(struct kvm_vcpu *vcpu);  void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu);  void kvm_timer_init_vhe(void);  #define vcpu_vtimer(v)	(&(v)->arch.timer_cpu.vtimer)  #define vcpu_ptimer(v)	(&(v)->arch.timer_cpu.ptimer) + +void enable_el1_phys_timer_access(void); +void disable_el1_phys_timer_access(void); +  #endif diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index 34dba516ef24..8c896540a72c 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h @@ -26,6 +26,8 @@  #include <linux/list.h>  #include <linux/jump_label.h> +#include <linux/irqchip/arm-gic-v4.h> +  #define VGIC_V3_MAX_CPUS	255  #define VGIC_V2_MAX_CPUS	8  #define VGIC_NR_IRQS_LEGACY     256 @@ -73,6 +75,9 @@ struct vgic_global {  	/* Only needed for the legacy KVM_CREATE_IRQCHIP */  	bool			can_emulate_gicv2; +	/* Hardware has GICv4? */ +	bool			has_gicv4; +  	/* GIC system register CPU interface */  	struct static_key_false gicv3_cpuif; @@ -116,6 +121,7 @@ struct vgic_irq {  	bool hw;			/* Tied to HW IRQ */  	struct kref refcount;		/* Used for LPIs */  	u32 hwintid;			/* HW INTID number */ +	unsigned int host_irq;		/* linux irq corresponding to hwintid */  	union {  		u8 targets;			/* GICv2 target VCPUs mask */  		u32 mpidr;			/* GICv3 target VCPU */ @@ -232,6 +238,15 @@ struct vgic_dist {  	/* used by vgic-debug */  	struct vgic_state_iter *iter; + +	/* +	 * GICv4 ITS per-VM data, containing the IRQ domain, the VPE +	 * array, the property table pointer as well as allocation +	 * data. This essentially ties the Linux IRQ core and ITS +	 * together, and avoids leaking KVM's data structures anywhere +	 * else. +	 */ +	struct its_vm		its_vm;  };  struct vgic_v2_cpu_if { @@ -250,6 +265,14 @@ struct vgic_v3_cpu_if {  	u32		vgic_ap0r[4];  	u32		vgic_ap1r[4];  	u64		vgic_lr[VGIC_V3_MAX_LRS]; + +	/* +	 * GICv4 ITS per-VPE data, containing the doorbell IRQ, the +	 * pending table pointer, the its_vm pointer and a few other +	 * HW specific things. As for the its_vm structure, this is +	 * linking the Linux IRQ subsystem and the ITS together. +	 */ +	struct its_vpe	its_vpe;  };  struct vgic_cpu { @@ -307,9 +330,10 @@ void kvm_vgic_init_cpu_hardware(void);  int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,  			bool level, void *owner); -int kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu, u32 virt_irq, u32 phys_irq); -int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, unsigned int virt_irq); -bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int virt_irq); +int kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu, unsigned int host_irq, +			  u32 vintid); +int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, unsigned int vintid); +bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int vintid);  int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu); @@ -349,4 +373,15 @@ int kvm_vgic_setup_default_irq_routing(struct kvm *kvm);  int kvm_vgic_set_owner(struct kvm_vcpu *vcpu, unsigned int intid, void *owner); +struct kvm_kernel_irq_routing_entry; + +int kvm_vgic_v4_set_forwarding(struct kvm *kvm, int irq, +			       struct kvm_kernel_irq_routing_entry *irq_entry); + +int kvm_vgic_v4_unset_forwarding(struct kvm *kvm, int irq, +				 struct kvm_kernel_irq_routing_entry *irq_entry); + +void kvm_vgic_v4_enable_doorbell(struct kvm_vcpu *vcpu); +void kvm_vgic_v4_disable_doorbell(struct kvm_vcpu *vcpu); +  #endif /* __KVM_ARM_VGIC_H */ diff --git a/include/linux/clk/bcm2835.h b/include/lib/libgcc.h index aa937f6c17da..32e1e0f4b2d0 100644 --- a/include/linux/clk/bcm2835.h +++ b/include/lib/libgcc.h @@ -1,5 +1,5 @@  /* - * Copyright (C) 2010 Broadcom + * include/lib/libgcc.h   *   * This program is free software; you can redistribute it and/or modify   * it under the terms of the GNU General Public License as published by @@ -12,13 +12,32 @@   * GNU General Public License for more details.   *   * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA + * along with this program; if not, see the file COPYING, or write + * to the Free Software Foundation, Inc.   */ -#ifndef __LINUX_CLK_BCM2835_H_ -#define __LINUX_CLK_BCM2835_H_ +#ifndef __LIB_LIBGCC_H +#define __LIB_LIBGCC_H -void __init bcm2835_init_clocks(void); +#include <asm/byteorder.h> +typedef int word_type __attribute__ ((mode (__word__))); + +#ifdef __BIG_ENDIAN +struct DWstruct { +	int high, low; +}; +#elif defined(__LITTLE_ENDIAN) +struct DWstruct { +	int low, high; +}; +#else +#error I feel sick.  #endif + +typedef union { +	struct DWstruct s; +	long long ll; +} DWunion; + +#endif /* __ASM_LIBGCC_H */ diff --git a/include/linux/8250_pci.h b/include/linux/8250_pci.h index b24ff086a662..9c777d2c98f5 100644 --- a/include/linux/8250_pci.h +++ b/include/linux/8250_pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Definitions for PCI support.   */ diff --git a/include/linux/a.out.h b/include/linux/a.out.h index ee884168989f..600cf45645c6 100644 --- a/include/linux/a.out.h +++ b/include/linux/a.out.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __A_OUT_GNU_H__  #define __A_OUT_GNU_H__ diff --git a/include/linux/acct.h b/include/linux/acct.h index dccc2d4fe7de..bc70e81895c0 100644 --- a/include/linux/acct.h +++ b/include/linux/acct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  BSD Process Accounting for Linux - Definitions   * @@ -19,9 +20,6 @@  #ifdef CONFIG_BSD_PROCESS_ACCT -struct vfsmount; -struct super_block; -struct pacct_struct;  struct pid_namespace;  extern int acct_parm[]; /* for sysctl */  extern void acct_collect(long exitcode, int group_dead); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 502af53ec012..dc1ebfeeb5ec 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -864,21 +864,16 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,  #endif  #if defined(CONFIG_ACPI) && defined(CONFIG_PM) -int acpi_dev_runtime_suspend(struct device *dev); -int acpi_dev_runtime_resume(struct device *dev); +int acpi_dev_suspend(struct device *dev, bool wakeup); +int acpi_dev_resume(struct device *dev);  int acpi_subsys_runtime_suspend(struct device *dev);  int acpi_subsys_runtime_resume(struct device *dev); -struct acpi_device *acpi_dev_pm_get_node(struct device *dev);  int acpi_dev_pm_attach(struct device *dev, bool power_on);  #else  static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }  static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }  static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }  static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } -static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) -{ -	return NULL; -}  static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)  {  	return -ENODEV; @@ -887,22 +882,30 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)  #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)  int acpi_dev_suspend_late(struct device *dev); -int acpi_dev_resume_early(struct device *dev);  int acpi_subsys_prepare(struct device *dev);  void acpi_subsys_complete(struct device *dev);  int acpi_subsys_suspend_late(struct device *dev); +int acpi_subsys_suspend_noirq(struct device *dev); +int acpi_subsys_resume_noirq(struct device *dev);  int acpi_subsys_resume_early(struct device *dev);  int acpi_subsys_suspend(struct device *dev);  int acpi_subsys_freeze(struct device *dev); +int acpi_subsys_freeze_late(struct device *dev); +int acpi_subsys_freeze_noirq(struct device *dev); +int acpi_subsys_thaw_noirq(struct device *dev);  #else -static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }  static inline int acpi_dev_resume_early(struct device *dev) { return 0; }  static inline int acpi_subsys_prepare(struct device *dev) { return 0; }  static inline void acpi_subsys_complete(struct device *dev) {}  static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } +static inline int acpi_subsys_suspend_noirq(struct device *dev) { return 0; } +static inline int acpi_subsys_resume_noirq(struct device *dev) { return 0; }  static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }  static inline int acpi_subsys_suspend(struct device *dev) { return 0; }  static inline int acpi_subsys_freeze(struct device *dev) { return 0; } +static inline int acpi_subsys_freeze_late(struct device *dev) { return 0; } +static inline int acpi_subsys_freeze_noirq(struct device *dev) { return 0; } +static inline int acpi_subsys_thaw_noirq(struct device *dev) { return 0; }  #endif  #ifdef CONFIG_ACPI @@ -1254,4 +1257,13 @@ int acpi_irq_get(acpi_handle handle, unsigned int index, struct resource *res)  }  #endif +#ifdef CONFIG_ACPI_LPIT +int lpit_read_residency_count_address(u64 *address); +#else +static inline int lpit_read_residency_count_address(u64 *address) +{ +	return -EINVAL; +} +#endif +  #endif	/*_LINUX_ACPI_H*/ diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h index 8d3f0bf80379..2f7a29242b87 100644 --- a/include/linux/acpi_iort.h +++ b/include/linux/acpi_iort.h @@ -49,8 +49,8 @@ static inline void acpi_configure_pmsi_domain(struct device *dev) { }  /* IOMMU interface */  static inline void iort_dma_setup(struct device *dev, u64 *dma_addr,  				  u64 *size) { } -static inline -const struct iommu_ops *iort_iommu_configure(struct device *dev) +static inline const struct iommu_ops *iort_iommu_configure( +				      struct device *dev)  { return NULL; }  #endif diff --git a/include/linux/acpi_pmtmr.h b/include/linux/acpi_pmtmr.h index 1d0ef1ae8036..50d88bf1498d 100644 --- a/include/linux/acpi_pmtmr.h +++ b/include/linux/acpi_pmtmr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ACPI_PMTMR_H_  #define _ACPI_PMTMR_H_ diff --git a/include/linux/adb.h b/include/linux/adb.h index cde41300c7ad..f6306fc86015 100644 --- a/include/linux/adb.h +++ b/include/linux/adb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Definitions for ADB (Apple Desktop Bus) support.   */ diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h index 0d991071a9d4..4836e382ad52 100644 --- a/include/linux/adfs_fs.h +++ b/include/linux/adfs_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ADFS_FS_H  #define _ADFS_FS_H diff --git a/include/linux/aer.h b/include/linux/aer.h index 43799bd17a02..8f87bbeceef4 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright (C) 2006 Intel Corp.   *     Tom Long Nguyen (tom.l.nguyen@intel.com) diff --git a/include/linux/ahci-remap.h b/include/linux/ahci-remap.h index 62be3a40239d..230c871ba084 100644 --- a/include/linux/ahci-remap.h +++ b/include/linux/ahci-remap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_AHCI_REMAP_H  #define _LINUX_AHCI_REMAP_H diff --git a/include/linux/aio.h b/include/linux/aio.h index fdd0a343f455..9d8aabecfe2d 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX__AIO_H  #define __LINUX__AIO_H diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h index c70aac13244a..0760ca1cb009 100644 --- a/include/linux/alarmtimer.h +++ b/include/linux/alarmtimer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ALARMTIMER_H  #define _LINUX_ALARMTIMER_H diff --git a/include/linux/altera_jtaguart.h b/include/linux/altera_jtaguart.h index 953b178a1650..527a142cd530 100644 --- a/include/linux/altera_jtaguart.h +++ b/include/linux/altera_jtaguart.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * altera_jtaguart.h -- Altera JTAG UART driver defines.   */ diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h index c022c82db7ca..3eb73b8c49c8 100644 --- a/include/linux/altera_uart.h +++ b/include/linux/altera_uart.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * altera_uart.h -- Altera UART driver defines.   */ diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index 8c98113069ce..da8357ba11bc 100644 --- a/include/linux/amba/mmci.h +++ b/include/linux/amba/mmci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  include/linux/amba/mmci.h   */ diff --git a/include/linux/amifd.h b/include/linux/amifd.h index 346993268b45..202a77dbe46d 100644 --- a/include/linux/amifd.h +++ b/include/linux/amifd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _AMIFD_H  #define _AMIFD_H diff --git a/include/linux/amifdreg.h b/include/linux/amifdreg.h index 76188bf48d3b..9b514d05ec70 100644 --- a/include/linux/amifdreg.h +++ b/include/linux/amifdreg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_AMIFDREG_H  #define _LINUX_AMIFDREG_H diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h index 8013a45242fe..d0d7d96261ad 100644 --- a/include/linux/anon_inodes.h +++ b/include/linux/anon_inodes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  include/linux/anon_inodes.h   * diff --git a/include/linux/apple_bl.h b/include/linux/apple_bl.h index 0a95e730fcea..445af2e3cc21 100644 --- a/include/linux/apple_bl.h +++ b/include/linux/apple_bl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * apple_bl exported symbols   */ diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h index 716ce587247e..304511267c82 100644 --- a/include/linux/arch_topology.h +++ b/include/linux/arch_topology.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/arch_topology.h - arch specific cpu topology information   */ @@ -5,15 +6,30 @@  #define _LINUX_ARCH_TOPOLOGY_H_  #include <linux/types.h> +#include <linux/percpu.h>  void topology_normalize_cpu_scale(void);  struct device_node;  bool topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu); +DECLARE_PER_CPU(unsigned long, cpu_scale); +  struct sched_domain; -unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu); +static inline +unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu) +{ +	return per_cpu(cpu_scale, cpu); +}  void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity); +DECLARE_PER_CPU(unsigned long, freq_scale); + +static inline +unsigned long topology_get_freq_scale(struct sched_domain *sd, int cpu) +{ +	return per_cpu(freq_scale, cpu); +} +  #endif /* _LINUX_ARCH_TOPOLOGY_H_ */ diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h index 619d9e78e644..ff2120215dec 100644 --- a/include/linux/ata_platform.h +++ b/include/linux/ata_platform.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_ATA_PLATFORM_H  #define __LINUX_ATA_PLATFORM_H diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 73fd8b7e9534..4d356e168692 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_ATALK_H__  #define __LINUX_ATALK_H__ diff --git a/include/linux/atm.h b/include/linux/atm.h index 30006c435951..4b50fd0a6eab 100644 --- a/include/linux/atm.h +++ b/include/linux/atm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* atm.h - general ATM declarations */  #ifndef _LINUX_ATM_H  #define _LINUX_ATM_H diff --git a/include/linux/atm_tcp.h b/include/linux/atm_tcp.h index db6b65fc0aec..c8ecf6f68fb5 100644 --- a/include/linux/atm_tcp.h +++ b/include/linux/atm_tcp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by  	       driver-specific utilities) */ diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 0ec9bdb1cc9f..0c27515d2cf6 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* atmdev.h - ATM device driver declarations and various related items */  #ifndef LINUX_ATMDEV_H  #define LINUX_ATMDEV_H diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h index 42a9e1884842..1491af38cc6e 100644 --- a/include/linux/atmel-mci.h +++ b/include/linux/atmel-mci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_ATMEL_MCI_H  #define __LINUX_ATMEL_MCI_H diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h index fdb545101ede..6091d2abc1eb 100644 --- a/include/linux/atmel-ssc.h +++ b/include/linux/atmel-ssc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __INCLUDE_ATMEL_SSC_H  #define __INCLUDE_ATMEL_SSC_H diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 40d6bfec0e0d..8b276fd9a127 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Atomic operations usable in machine independent code */  #ifndef _LINUX_ATOMIC_H  #define _LINUX_ATOMIC_H @@ -653,6 +654,8 @@ static inline int atomic_dec_if_positive(atomic_t *v)  }  #endif +#define atomic_cond_read_acquire(v, c)	smp_cond_load_acquire(&(v)->counter, (c)) +  #ifdef CONFIG_GENERIC_ATOMIC64  #include <asm-generic/atomic64.h>  #endif @@ -1072,6 +1075,8 @@ static inline long long atomic64_fetch_andnot_release(long long i, atomic64_t *v  }  #endif +#define atomic64_cond_read_acquire(v, c)	smp_cond_load_acquire(&(v)->counter, (c)) +  #include <asm-generic/atomic-long.h>  #endif /* _LINUX_ATOMIC_H */ diff --git a/include/linux/audit.h b/include/linux/audit.h index cb708eb8accc..af410d9fbf2d 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h @@ -149,12 +149,6 @@ extern void		    audit_log_key(struct audit_buffer *ab,  extern void		    audit_log_link_denied(const char *operation,  						  const struct path *link);  extern void		    audit_log_lost(const char *message); -#ifdef CONFIG_SECURITY -extern void 		    audit_log_secctx(struct audit_buffer *ab, u32 secid); -#else -static inline void	    audit_log_secctx(struct audit_buffer *ab, u32 secid) -{ } -#endif  extern int audit_log_task_context(struct audit_buffer *ab);  extern void audit_log_task_info(struct audit_buffer *ab, @@ -203,8 +197,6 @@ static inline void audit_log_key(struct audit_buffer *ab, char *key)  static inline void audit_log_link_denied(const char *string,  					 const struct path *link)  { } -static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) -{ }  static inline int audit_log_task_context(struct audit_buffer *ab)  {  	return 0; @@ -356,6 +348,7 @@ extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,  extern void __audit_log_capset(const struct cred *new, const struct cred *old);  extern void __audit_mmap_fd(int fd, int flags);  extern void __audit_log_kern_module(char *name); +extern void __audit_fanotify(unsigned int response);  static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)  { @@ -452,6 +445,12 @@ static inline void audit_log_kern_module(char *name)  		__audit_log_kern_module(name);  } +static inline void audit_fanotify(unsigned int response) +{ +	if (!audit_dummy_context()) +		__audit_fanotify(response); +} +  extern int audit_n_rules;  extern int audit_signals;  #else /* CONFIG_AUDITSYSCALL */ @@ -568,6 +567,9 @@ static inline void audit_log_kern_module(char *name)  {  } +static inline void audit_fanotify(unsigned int response) +{ } +  static inline void audit_ptrace(struct task_struct *t)  { }  #define audit_n_rules 0 diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h index 3e0fbe441763..f68d0ec2d740 100644 --- a/include/linux/auxvec.h +++ b/include/linux/auxvec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_AUXVEC_H  #define _LINUX_AUXVEC_H diff --git a/include/linux/average.h b/include/linux/average.h index 7ddaf340d2ac..a1a8f09631ce 100644 --- a/include/linux/average.h +++ b/include/linux/average.h @@ -1,6 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_AVERAGE_H  #define _LINUX_AVERAGE_H +#include <linux/bug.h> +#include <linux/compiler.h> +#include <linux/log2.h> +  /*   * Exponentially weighted moving average (EWMA)   * @@ -48,7 +53,7 @@  	static inline void ewma_##name##_add(struct ewma_##name *e,	\  					     unsigned long val)		\  	{								\ -		unsigned long internal = ACCESS_ONCE(e->internal);	\ +		unsigned long internal = READ_ONCE(e->internal);	\  		unsigned long weight_rcp = ilog2(_weight_rcp);		\  		unsigned long precision = _precision;			\  									\ @@ -57,10 +62,10 @@  		BUILD_BUG_ON((_precision) > 30);			\  		BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp);		\  									\ -		ACCESS_ONCE(e->internal) = internal ?			\ +		WRITE_ONCE(e->internal, internal ?			\  			(((internal << weight_rcp) - internal) +	\  				(val << precision)) >> weight_rcp :	\ -			(val << precision);				\ +			(val << precision));				\  	}  #endif /* _LINUX_AVERAGE_H */ diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h index 2b038442c352..3ce61342fa31 100644 --- a/include/linux/avf/virtchnl.h +++ b/include/linux/avf/virtchnl.h @@ -135,6 +135,7 @@ enum virtchnl_ops {  	VIRTCHNL_OP_SET_RSS_HENA = 26,  	VIRTCHNL_OP_ENABLE_VLAN_STRIPPING = 27,  	VIRTCHNL_OP_DISABLE_VLAN_STRIPPING = 28, +	VIRTCHNL_OP_REQUEST_QUEUES = 29,  };  /* This macro is used to generate a compilation error if a structure @@ -235,6 +236,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);  #define VIRTCHNL_VF_OFFLOAD_RSS_AQ		0x00000008  #define VIRTCHNL_VF_OFFLOAD_RSS_REG		0x00000010  #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR		0x00000020 +#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES		0x00000040  #define VIRTCHNL_VF_OFFLOAD_VLAN		0x00010000  #define VIRTCHNL_VF_OFFLOAD_RX_POLLING		0x00020000  #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2	0x00040000 @@ -325,6 +327,21 @@ struct virtchnl_vsi_queue_config_info {  	struct virtchnl_queue_pair_info qpair[1];  }; +/* VIRTCHNL_OP_REQUEST_QUEUES + * VF sends this message to request the PF to allocate additional queues to + * this VF.  Each VF gets a guaranteed number of queues on init but asking for + * additional queues must be negotiated.  This is a best effort request as it + * is possible the PF does not have enough queues left to support the request. + * If the PF cannot support the number requested it will respond with the + * maximum number it is able to support.  If the request is successful, PF will + * then reset the VF to institute required changes. + */ + +/* VF resource request */ +struct virtchnl_vf_res_request { +	u16 num_queue_pairs; +}; +  VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info);  /* VIRTCHNL_OP_CONFIG_IRQ_MAP @@ -691,6 +708,9 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,  	case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:  	case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:  		break; +	case VIRTCHNL_OP_REQUEST_QUEUES: +		valid_len = sizeof(struct virtchnl_vf_res_request); +		break;  	/* These are always errors coming from the VF. */  	case VIRTCHNL_OP_EVENT:  	case VIRTCHNL_OP_UNKNOWN: diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 866c433e7d32..bfe86b54f6c1 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BACKING_DEV_DEFS_H  #define __LINUX_BACKING_DEV_DEFS_H @@ -24,6 +25,7 @@ enum wb_state {  	WB_shutting_down,	/* wb_shutdown() in progress */  	WB_writeback_running,	/* Writeback is in progress */  	WB_has_dirty_io,	/* Dirty inodes on ->b_{dirty|io|more_io} */ +	WB_start_all,		/* nr_pages == 0 (all) work pending */  };  enum wb_congested_state { @@ -44,6 +46,28 @@ enum wb_stat_item {  #define WB_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))  /* + * why some writeback work was initiated + */ +enum wb_reason { +	WB_REASON_BACKGROUND, +	WB_REASON_VMSCAN, +	WB_REASON_SYNC, +	WB_REASON_PERIODIC, +	WB_REASON_LAPTOP_TIMER, +	WB_REASON_FREE_MORE_MEM, +	WB_REASON_FS_FREE_SPACE, +	/* +	 * There is no bdi forker thread any more and works are done +	 * by emergency worker, however, this is TPs userland visible +	 * and we'll be exposing exactly the same information, +	 * so it has a mismatch name. +	 */ +	WB_REASON_FORKER_THREAD, + +	WB_REASON_MAX, +}; + +/*   * For cgroup writeback, multiple wb's may map to the same blkcg.  Those   * wb's can operate mostly independently but should share the congested   * state.  To facilitate such sharing, the congested state is tracked using @@ -115,6 +139,7 @@ struct bdi_writeback {  	struct fprop_local_percpu completions;  	int dirty_exceeded; +	enum wb_reason start_all_reason;  	spinlock_t work_lock;		/* protects work_list & dwork scheduling */  	struct list_head work_list; diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 854e1bdd0b2a..e54e7e0033eb 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/backing-dev.h   * @@ -38,8 +39,6 @@ static inline struct backing_dev_info *bdi_alloc(gfp_t gfp_mask)  	return bdi_alloc_node(gfp_mask, NUMA_NO_NODE);  } -void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, -			bool range_cyclic, enum wb_reason reason);  void wb_start_background_writeback(struct bdi_writeback *wb);  void wb_workfn(struct work_struct *work);  void wb_wakeup_delayed(struct bdi_writeback *wb); @@ -94,7 +93,7 @@ extern void wb_writeout_inc(struct bdi_writeback *wb);  /*   * maximal error of a stat counter.   */ -static inline unsigned long wb_stat_error(struct bdi_writeback *wb) +static inline unsigned long wb_stat_error(void)  {  #ifdef CONFIG_SMP  	return nr_cpu_ids * WB_STAT_BATCH; @@ -123,6 +122,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);   * BDI_CAP_STRICTLIMIT:    Keep number of dirty pages below bdi threshold.   *   * BDI_CAP_CGROUP_WRITEBACK: Supports cgroup-aware writeback. + * BDI_CAP_SYNCHRONOUS_IO: Device is so fast that asynchronous IO would be + *			   inefficient.   */  #define BDI_CAP_NO_ACCT_DIRTY	0x00000001  #define BDI_CAP_NO_WRITEBACK	0x00000002 @@ -130,6 +131,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);  #define BDI_CAP_STABLE_WRITES	0x00000008  #define BDI_CAP_STRICTLIMIT	0x00000010  #define BDI_CAP_CGROUP_WRITEBACK 0x00000020 +#define BDI_CAP_SYNCHRONOUS_IO	0x00000040  #define BDI_CAP_NO_ACCT_AND_WRITEBACK \  	(BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB) @@ -174,8 +176,11 @@ static inline int wb_congested(struct bdi_writeback *wb, int cong_bits)  long congestion_wait(int sync, long timeout);  long wait_iff_congested(struct pglist_data *pgdat, int sync, long timeout); -int pdflush_proc_obsolete(struct ctl_table *table, int write, -		void __user *buffer, size_t *lenp, loff_t *ppos); + +static inline bool bdi_cap_synchronous_io(struct backing_dev_info *bdi) +{ +	return bdi->capabilities & BDI_CAP_SYNCHRONOUS_IO; +}  static inline bool bdi_cap_stable_pages_required(struct backing_dev_info *bdi)  { diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 5f2fd61ef4fb..af7003548593 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Backlight Lowlevel Control Abstraction   * diff --git a/include/linux/badblocks.h b/include/linux/badblocks.h index c3bdf8c59480..2426276b9bd3 100644 --- a/include/linux/badblocks.h +++ b/include/linux/badblocks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BADBLOCKS_H  #define _LINUX_BADBLOCKS_H diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h index 79542b2698ec..53051f3d8f25 100644 --- a/include/linux/balloon_compaction.h +++ b/include/linux/balloon_compaction.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/balloon_compaction.h   * @@ -49,6 +50,7 @@  #include <linux/gfp.h>  #include <linux/err.h>  #include <linux/fs.h> +#include <linux/list.h>  /*   * Balloon device information descriptor. @@ -66,7 +68,9 @@ struct balloon_dev_info {  	struct inode *inode;  }; -extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info); +extern struct page *balloon_page_alloc(void); +extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info, +				 struct page *page);  extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);  static inline void balloon_devinfo_init(struct balloon_dev_info *balloon) @@ -192,4 +196,34 @@ static inline gfp_t balloon_mapping_gfp_mask(void)  }  #endif /* CONFIG_BALLOON_COMPACTION */ + +/* + * balloon_page_push - insert a page into a page list. + * @head : pointer to list + * @page : page to be added + * + * Caller must ensure the page is private and protect the list. + */ +static inline void balloon_page_push(struct list_head *pages, struct page *page) +{ +	list_add(&page->lru, pages); +} + +/* + * balloon_page_pop - remove a page from a page list. + * @head : pointer to list + * @page : page to be added + * + * Caller must ensure the page is private and protect the list. + */ +static inline struct page *balloon_page_pop(struct list_head *pages) +{ +	struct page *page = list_first_entry_or_null(pages, struct page, lru); + +	if (!page) +		return NULL; + +	list_del(&page->lru); +	return page; +}  #endif /* _LINUX_BALLOON_COMPACTION_H */ diff --git a/include/linux/bcd.h b/include/linux/bcd.h index 18fff11fb3ea..118bea36d7d4 100644 --- a/include/linux/bcd.h +++ b/include/linux/bcd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _BCD_H  #define _BCD_H diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h index 8d9d07ec22a5..fc9dcdb4b979 100644 --- a/include/linux/bcm47xx_wdt.h +++ b/include/linux/bcm47xx_wdt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCM47XX_WDT_H_  #define LINUX_BCM47XX_WDT_H_ diff --git a/include/linux/bcm963xx_nvram.h b/include/linux/bcm963xx_nvram.h index 290c231b8cf1..c8c7f01159fe 100644 --- a/include/linux/bcm963xx_nvram.h +++ b/include/linux/bcm963xx_nvram.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BCM963XX_NVRAM_H__  #define __LINUX_BCM963XX_NVRAM_H__ diff --git a/include/linux/bcm963xx_tag.h b/include/linux/bcm963xx_tag.h index 161c7b37a77b..b87945cb6946 100644 --- a/include/linux/bcm963xx_tag.h +++ b/include/linux/bcm963xx_tag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BCM963XX_TAG_H__  #define __LINUX_BCM963XX_TAG_H__ diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 8eeedb2db924..ef61f3607e99 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_H_  #define LINUX_BCMA_H_ diff --git a/include/linux/bcma/bcma_driver_arm_c9.h b/include/linux/bcma/bcma_driver_arm_c9.h index 93bd73d670d5..688cf590c99b 100644 --- a/include/linux/bcma/bcma_driver_arm_c9.h +++ b/include/linux/bcma/bcma_driver_arm_c9.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_DRIVER_ARM_C9_H_  #define LINUX_BCMA_DRIVER_ARM_C9_H_ diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index 2f1c690a3e66..d35b9206096d 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_DRIVER_CC_H_  #define LINUX_BCMA_DRIVER_CC_H_ diff --git a/include/linux/bcma/bcma_driver_gmac_cmn.h b/include/linux/bcma/bcma_driver_gmac_cmn.h index 4354d4ea6713..420e222d7a22 100644 --- a/include/linux/bcma/bcma_driver_gmac_cmn.h +++ b/include/linux/bcma/bcma_driver_gmac_cmn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_DRIVER_GMAC_CMN_H_  #define LINUX_BCMA_DRIVER_GMAC_CMN_H_ diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h index 8eea7f9e33b4..798013fab54f 100644 --- a/include/linux/bcma/bcma_driver_mips.h +++ b/include/linux/bcma/bcma_driver_mips.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_DRIVER_MIPS_H_  #define LINUX_BCMA_DRIVER_MIPS_H_ diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h index bca6a5e4ca3d..68da8dba5162 100644 --- a/include/linux/bcma/bcma_driver_pci.h +++ b/include/linux/bcma/bcma_driver_pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_DRIVER_PCI_H_  #define LINUX_BCMA_DRIVER_PCI_H_ diff --git a/include/linux/bcma/bcma_driver_pcie2.h b/include/linux/bcma/bcma_driver_pcie2.h index 31e6d17ab798..91ce515e3a77 100644 --- a/include/linux/bcma/bcma_driver_pcie2.h +++ b/include/linux/bcma/bcma_driver_pcie2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_DRIVER_PCIE2_H_  #define LINUX_BCMA_DRIVER_PCIE2_H_ diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h index 9986f8288d01..944105cbd671 100644 --- a/include/linux/bcma/bcma_regs.h +++ b/include/linux/bcma/bcma_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_REGS_H_  #define LINUX_BCMA_REGS_H_ diff --git a/include/linux/bcma/bcma_soc.h b/include/linux/bcma/bcma_soc.h index 1b5fc0c3b1b5..7cca5f859a90 100644 --- a/include/linux/bcma/bcma_soc.h +++ b/include/linux/bcma/bcma_soc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_BCMA_SOC_H_  #define LINUX_BCMA_SOC_H_ diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 18d05b5491f3..b0abe21d6cc9 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BINFMTS_H  #define _LINUX_BINFMTS_H diff --git a/include/linux/bio.h b/include/linux/bio.h index 275c91c99516..82f0c8fd7be8 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -129,18 +129,6 @@ static inline void *bio_data(struct bio *bio)  #define bvec_to_phys(bv)	(page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset)  /* - * queues that have highmem support enabled may still need to revert to - * PIO transfers occasionally and thus map high pages temporarily. For - * permanent PIO fall back, user is probably better off disabling highmem - * I/O completely on that queue (see ide-dma for example) - */ -#define __bio_kmap_atomic(bio, iter)				\ -	(kmap_atomic(bio_iter_iovec((bio), (iter)).bv_page) +	\ -		bio_iter_iovec((bio), (iter)).bv_offset) - -#define __bio_kunmap_atomic(addr)	kunmap_atomic(addr) - -/*   * merge helpers etc   */ @@ -462,7 +450,7 @@ extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,  int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);  struct rq_map_data;  extern struct bio *bio_map_user_iov(struct request_queue *, -				    const struct iov_iter *, gfp_t); +				    struct iov_iter *, gfp_t);  extern void bio_unmap_user(struct bio *);  extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,  				gfp_t); @@ -494,7 +482,7 @@ extern void bio_free_pages(struct bio *bio);  extern struct bio *bio_copy_user_iov(struct request_queue *,  				     struct rq_map_data *, -				     const struct iov_iter *, +				     struct iov_iter *,  				     gfp_t);  extern int bio_uncopy_user(struct bio *);  void zero_fill_bio(struct bio *bio); @@ -522,13 +510,11 @@ do {						\  #ifdef CONFIG_BLK_CGROUP  int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); -int bio_associate_current(struct bio *bio);  void bio_disassociate_task(struct bio *bio);  void bio_clone_blkcg_association(struct bio *dst, struct bio *src);  #else	/* CONFIG_BLK_CGROUP */  static inline int bio_associate_blkcg(struct bio *bio,  			struct cgroup_subsys_state *blkcg_css) { return 0; } -static inline int bio_associate_current(struct bio *bio) { return -ENOENT; }  static inline void bio_disassociate_task(struct bio *bio) { }  static inline void bio_clone_blkcg_association(struct bio *dst,  			struct bio *src) { } @@ -575,17 +561,6 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)  }  #endif -static inline char *__bio_kmap_irq(struct bio *bio, struct bvec_iter iter, -				   unsigned long *flags) -{ -	return bvec_kmap_irq(&bio_iter_iovec(bio, iter), flags); -} -#define __bio_kunmap_irq(buf, flags)	bvec_kunmap_irq(buf, flags) - -#define bio_kmap_irq(bio, flags) \ -	__bio_kmap_irq((bio), (bio)->bi_iter, (flags)) -#define bio_kunmap_irq(buf,flags)	__bio_kunmap_irq(buf, flags) -  /*   * BIO list management for use by remapping drivers (e.g. DM or MD) and loop.   * diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h index 3b5bafce4337..bbc4730a6505 100644 --- a/include/linux/bit_spinlock.h +++ b/include/linux/bit_spinlock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BIT_SPINLOCK_H  #define __LINUX_BIT_SPINLOCK_H diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h index f2deb71958b2..1030651f8309 100644 --- a/include/linux/bitfield.h +++ b/include/linux/bitfield.h @@ -15,7 +15,7 @@  #ifndef _LINUX_BITFIELD_H  #define _LINUX_BITFIELD_H -#include <linux/bug.h> +#include <linux/build_bug.h>  /*   * Bitfield access macros diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 700cf5f67118..3489253e38fc 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BITMAP_H  #define __LINUX_BITMAP_H @@ -21,65 +22,74 @@   * See lib/bitmap.c for more details.   */ -/* +/** + * DOC: bitmap overview + *   * The available bitmap operations and their rough meaning in the   * case that the bitmap is a single unsigned long are thus:   *   * Note that nbits should be always a compile time evaluable constant.   * Otherwise many inlines will generate horrible code.   * - * bitmap_zero(dst, nbits)			*dst = 0UL - * bitmap_fill(dst, nbits)			*dst = ~0UL - * bitmap_copy(dst, src, nbits)			*dst = *src - * bitmap_and(dst, src1, src2, nbits)		*dst = *src1 & *src2 - * bitmap_or(dst, src1, src2, nbits)		*dst = *src1 | *src2 - * bitmap_xor(dst, src1, src2, nbits)		*dst = *src1 ^ *src2 - * bitmap_andnot(dst, src1, src2, nbits)	*dst = *src1 & ~(*src2) - * bitmap_complement(dst, src, nbits)		*dst = ~(*src) - * bitmap_equal(src1, src2, nbits)		Are *src1 and *src2 equal? - * bitmap_intersects(src1, src2, nbits) 	Do *src1 and *src2 overlap? - * bitmap_subset(src1, src2, nbits)		Is *src1 a subset of *src2? - * bitmap_empty(src, nbits)			Are all bits zero in *src? - * bitmap_full(src, nbits)			Are all bits set in *src? - * bitmap_weight(src, nbits)			Hamming Weight: number set bits - * bitmap_set(dst, pos, nbits)			Set specified bit area - * bitmap_clear(dst, pos, nbits)		Clear specified bit area - * bitmap_find_next_zero_area(buf, len, pos, n, mask)	Find bit free area - * bitmap_find_next_zero_area_off(buf, len, pos, n, mask)	as above - * bitmap_shift_right(dst, src, n, nbits)	*dst = *src >> n - * bitmap_shift_left(dst, src, n, nbits)	*dst = *src << n - * bitmap_remap(dst, src, old, new, nbits)	*dst = map(old, new)(src) - * bitmap_bitremap(oldbit, old, new, nbits)	newbit = map(old, new)(oldbit) - * bitmap_onto(dst, orig, relmap, nbits)	*dst = orig relative to relmap - * bitmap_fold(dst, orig, sz, nbits)		dst bits = orig bits mod sz - * bitmap_parse(buf, buflen, dst, nbits)	Parse bitmap dst from kernel buf - * bitmap_parse_user(ubuf, ulen, dst, nbits)	Parse bitmap dst from user buf - * bitmap_parselist(buf, dst, nbits)		Parse bitmap dst from kernel buf - * bitmap_parselist_user(buf, dst, nbits)	Parse bitmap dst from user buf - * bitmap_find_free_region(bitmap, bits, order)	Find and allocate bit region - * bitmap_release_region(bitmap, pos, order)	Free specified bit region - * bitmap_allocate_region(bitmap, pos, order)	Allocate specified bit region - * bitmap_from_u32array(dst, nbits, buf, nwords) *dst = *buf (nwords 32b words) - * bitmap_to_u32array(buf, nwords, src, nbits)	*buf = *dst (nwords 32b words) + * :: + * + *  bitmap_zero(dst, nbits)                     *dst = 0UL + *  bitmap_fill(dst, nbits)                     *dst = ~0UL + *  bitmap_copy(dst, src, nbits)                *dst = *src + *  bitmap_and(dst, src1, src2, nbits)          *dst = *src1 & *src2 + *  bitmap_or(dst, src1, src2, nbits)           *dst = *src1 | *src2 + *  bitmap_xor(dst, src1, src2, nbits)          *dst = *src1 ^ *src2 + *  bitmap_andnot(dst, src1, src2, nbits)       *dst = *src1 & ~(*src2) + *  bitmap_complement(dst, src, nbits)          *dst = ~(*src) + *  bitmap_equal(src1, src2, nbits)             Are *src1 and *src2 equal? + *  bitmap_intersects(src1, src2, nbits)        Do *src1 and *src2 overlap? + *  bitmap_subset(src1, src2, nbits)            Is *src1 a subset of *src2? + *  bitmap_empty(src, nbits)                    Are all bits zero in *src? + *  bitmap_full(src, nbits)                     Are all bits set in *src? + *  bitmap_weight(src, nbits)                   Hamming Weight: number set bits + *  bitmap_set(dst, pos, nbits)                 Set specified bit area + *  bitmap_clear(dst, pos, nbits)               Clear specified bit area + *  bitmap_find_next_zero_area(buf, len, pos, n, mask)  Find bit free area + *  bitmap_find_next_zero_area_off(buf, len, pos, n, mask)  as above + *  bitmap_shift_right(dst, src, n, nbits)      *dst = *src >> n + *  bitmap_shift_left(dst, src, n, nbits)       *dst = *src << n + *  bitmap_remap(dst, src, old, new, nbits)     *dst = map(old, new)(src) + *  bitmap_bitremap(oldbit, old, new, nbits)    newbit = map(old, new)(oldbit) + *  bitmap_onto(dst, orig, relmap, nbits)       *dst = orig relative to relmap + *  bitmap_fold(dst, orig, sz, nbits)           dst bits = orig bits mod sz + *  bitmap_parse(buf, buflen, dst, nbits)       Parse bitmap dst from kernel buf + *  bitmap_parse_user(ubuf, ulen, dst, nbits)   Parse bitmap dst from user buf + *  bitmap_parselist(buf, dst, nbits)           Parse bitmap dst from kernel buf + *  bitmap_parselist_user(buf, dst, nbits)      Parse bitmap dst from user buf + *  bitmap_find_free_region(bitmap, bits, order)  Find and allocate bit region + *  bitmap_release_region(bitmap, pos, order)   Free specified bit region + *  bitmap_allocate_region(bitmap, pos, order)  Allocate specified bit region + *  bitmap_from_u32array(dst, nbits, buf, nwords)  *dst = *buf (nwords 32b words) + *  bitmap_to_u32array(buf, nwords, src, nbits) *buf = *dst (nwords 32b words) + *   */ -/* - * Also the following operations in asm/bitops.h apply to bitmaps. +/** + * DOC: bitmap bitops + * + * Also the following operations in asm/bitops.h apply to bitmaps.:: + * + *  set_bit(bit, addr)                  *addr |= bit + *  clear_bit(bit, addr)                *addr &= ~bit + *  change_bit(bit, addr)               *addr ^= bit + *  test_bit(bit, addr)                 Is bit set in *addr? + *  test_and_set_bit(bit, addr)         Set bit and return old value + *  test_and_clear_bit(bit, addr)       Clear bit and return old value + *  test_and_change_bit(bit, addr)      Change bit and return old value + *  find_first_zero_bit(addr, nbits)    Position first zero bit in *addr + *  find_first_bit(addr, nbits)         Position first set bit in *addr + *  find_next_zero_bit(addr, nbits, bit)  Position next zero bit in *addr >= bit + *  find_next_bit(addr, nbits, bit)     Position next set bit in *addr >= bit   * - * set_bit(bit, addr)			*addr |= bit - * clear_bit(bit, addr)			*addr &= ~bit - * change_bit(bit, addr)		*addr ^= bit - * test_bit(bit, addr)			Is bit set in *addr? - * test_and_set_bit(bit, addr)		Set bit and return old value - * test_and_clear_bit(bit, addr)	Clear bit and return old value - * test_and_change_bit(bit, addr)	Change bit and return old value - * find_first_zero_bit(addr, nbits)	Position first zero bit in *addr - * find_first_bit(addr, nbits)		Position first set bit in *addr - * find_next_zero_bit(addr, nbits, bit)	Position next zero bit in *addr >= bit - * find_next_bit(addr, nbits, bit)	Position next set bit in *addr >= bit   */ -/* +/** + * DOC: declare bitmap   * The DECLARE_BITMAP(name,bits) macro, in linux/types.h, can be used   * to declare an array named 'name' of just enough unsigned longs to   * contain all bit positions from 0 to 'bits' - 1. @@ -360,8 +370,9 @@ static inline int bitmap_parse(const char *buf, unsigned int buflen,  	return __bitmap_parse(buf, buflen, 0, maskp, nmaskbits);  } -/* +/**   * BITMAP_FROM_U64() - Represent u64 value in the format suitable for bitmap. + * @n: u64 value   *   * Linux bitmaps are internally arrays of unsigned longs, i.e. 32-bit   * integers in 32-bit environment, and 64-bit integers in 64-bit one. @@ -392,14 +403,14 @@ static inline int bitmap_parse(const char *buf, unsigned int buflen,  				((unsigned long) ((u64)(n) >> 32))  #endif -/* +/**   * bitmap_from_u64 - Check and swap words within u64.   *  @mask: source bitmap   *  @dst:  destination bitmap   * - * In 32-bit Big Endian kernel, when using (u32 *)(&val)[*] + * In 32-bit Big Endian kernel, when using ``(u32 *)(&val)[*]``   * to read u64 mask, we will get the wrong word. - * That is "(u32 *)(&val)[0]" gets the upper 32 bits, + * That is ``(u32 *)(&val)[0]`` gets the upper 32 bits,   * but we expect the lower 32-bits of u64.   */  static inline void bitmap_from_u64(unsigned long *dst, u64 mask) diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 8fbe259b197c..4cac4e1a72ff 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BITOPS_H  #define _LINUX_BITOPS_H  #include <asm/types.h> @@ -227,6 +228,30 @@ static inline unsigned long __ffs64(u64 word)  	return __ffs((unsigned long)word);  } +/** + * assign_bit - Assign value to a bit in memory + * @nr: the bit to set + * @addr: the address to start counting from + * @value: the value to assign + */ +static __always_inline void assign_bit(long nr, volatile unsigned long *addr, +				       bool value) +{ +	if (value) +		set_bit(nr, addr); +	else +		clear_bit(nr, addr); +} + +static __always_inline void __assign_bit(long nr, volatile unsigned long *addr, +					 bool value) +{ +	if (value) +		__set_bit(nr, addr); +	else +		__clear_bit(nr, addr); +} +  #ifdef __KERNEL__  #ifndef set_mask_bits @@ -236,7 +261,7 @@ static inline unsigned long __ffs64(u64 word)  	typeof(*ptr) old, new;					\  								\  	do {							\ -		old = ACCESS_ONCE(*ptr);			\ +		old = READ_ONCE(*ptr);			\  		new = (old & ~mask) | bits;			\  	} while (cmpxchg(ptr, old, new) != old);		\  								\ @@ -251,7 +276,7 @@ static inline unsigned long __ffs64(u64 word)  	typeof(*ptr) old, new;					\  								\  	do {							\ -		old = ACCESS_ONCE(*ptr);			\ +		old = READ_ONCE(*ptr);			\  		new = old & ~clear;				\  	} while (!(old & test) &&				\  		 cmpxchg(ptr, old, new) != old);		\ diff --git a/include/linux/bitrev.h b/include/linux/bitrev.h index b97be27e5a85..50fb0dee23e8 100644 --- a/include/linux/bitrev.h +++ b/include/linux/bitrev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BITREV_H  #define _LINUX_BITREV_H diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 9d92153dd856..e9825ff57b15 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _BLK_CGROUP_H  #define _BLK_CGROUP_H  /* @@ -19,6 +20,7 @@  #include <linux/radix-tree.h>  #include <linux/blkdev.h>  #include <linux/atomic.h> +#include <linux/kthread.h>  /* percpu_counter batch for blkg_[rw]stats, per-cpu drift doesn't matter */  #define BLKG_STAT_CPU_BATCH	(INT_MAX / 2) @@ -223,22 +225,16 @@ static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css)  	return css ? container_of(css, struct blkcg, css) : NULL;  } -static inline struct blkcg *task_blkcg(struct task_struct *tsk) -{ -	return css_to_blkcg(task_css(tsk, io_cgrp_id)); -} -  static inline struct blkcg *bio_blkcg(struct bio *bio)  { +	struct cgroup_subsys_state *css; +  	if (bio && bio->bi_css)  		return css_to_blkcg(bio->bi_css); -	return task_blkcg(current); -} - -static inline struct cgroup_subsys_state * -task_get_blkcg_css(struct task_struct *task) -{ -	return task_get_css(task, io_cgrp_id); +	css = kthread_blkcg(); +	if (css) +		return css_to_blkcg(css); +	return css_to_blkcg(task_css(current, io_cgrp_id));  }  /** @@ -735,12 +731,6 @@ struct blkcg_policy {  #define blkcg_root_css	((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) -static inline struct cgroup_subsys_state * -task_get_blkcg_css(struct task_struct *task) -{ -	return NULL; -} -  #ifdef CONFIG_BLOCK  static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } diff --git a/include/linux/blk-mq-pci.h b/include/linux/blk-mq-pci.h index 6ab595259112..6338551e0fb9 100644 --- a/include/linux/blk-mq-pci.h +++ b/include/linux/blk-mq-pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BLK_MQ_PCI_H  #define _LINUX_BLK_MQ_PCI_H diff --git a/include/linux/blk-mq-virtio.h b/include/linux/blk-mq-virtio.h index b1ef6e14744f..69b4da262c45 100644 --- a/include/linux/blk-mq-virtio.h +++ b/include/linux/blk-mq-virtio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BLK_MQ_VIRTIO_H  #define _LINUX_BLK_MQ_VIRTIO_H diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 50c6485cb04f..95c9a5c862e2 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef BLK_MQ_H  #define BLK_MQ_H @@ -30,10 +31,12 @@ struct blk_mq_hw_ctx {  	struct sbitmap		ctx_map; +	struct blk_mq_ctx	*dispatch_from; +  	struct blk_mq_ctx	**ctxs;  	unsigned int		nr_ctx; -	wait_queue_entry_t		dispatch_wait; +	wait_queue_entry_t	dispatch_wait;  	atomic_t		wait_index;  	struct blk_mq_tags	*tags; @@ -90,6 +93,8 @@ struct blk_mq_queue_data {  typedef blk_status_t (queue_rq_fn)(struct blk_mq_hw_ctx *,  		const struct blk_mq_queue_data *); +typedef bool (get_budget_fn)(struct blk_mq_hw_ctx *); +typedef void (put_budget_fn)(struct blk_mq_hw_ctx *);  typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool);  typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);  typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); @@ -112,6 +117,15 @@ struct blk_mq_ops {  	queue_rq_fn		*queue_rq;  	/* +	 * Reserve budget before queue request, once .queue_rq is +	 * run, it is driver's responsibility to release the +	 * reserved budget. Also we have to handle failure case +	 * of .get_budget for avoiding I/O deadlock. +	 */ +	get_budget_fn		*get_budget; +	put_budget_fn		*put_budget; + +	/*  	 * Called on request timeout  	 */  	timeout_fn		*timeout; @@ -168,8 +182,7 @@ enum {  	BLK_MQ_S_STOPPED	= 0,  	BLK_MQ_S_TAG_ACTIVE	= 1,  	BLK_MQ_S_SCHED_RESTART	= 2, -	BLK_MQ_S_TAG_WAITING	= 3, -	BLK_MQ_S_START_ON_RUN	= 4, +	BLK_MQ_S_START_ON_RUN	= 3,  	BLK_MQ_MAX_DEPTH	= 10240, @@ -197,15 +210,21 @@ void blk_mq_free_request(struct request *rq);  bool blk_mq_can_queue(struct blk_mq_hw_ctx *);  enum { -	BLK_MQ_REQ_NOWAIT	= (1 << 0), /* return when out of requests */ -	BLK_MQ_REQ_RESERVED	= (1 << 1), /* allocate from reserved pool */ -	BLK_MQ_REQ_INTERNAL	= (1 << 2), /* allocate internal/sched tag */ +	/* return when out of requests */ +	BLK_MQ_REQ_NOWAIT	= (__force blk_mq_req_flags_t)(1 << 0), +	/* allocate from reserved pool */ +	BLK_MQ_REQ_RESERVED	= (__force blk_mq_req_flags_t)(1 << 1), +	/* allocate internal/sched tag */ +	BLK_MQ_REQ_INTERNAL	= (__force blk_mq_req_flags_t)(1 << 2), +	/* set RQF_PREEMPT */ +	BLK_MQ_REQ_PREEMPT	= (__force blk_mq_req_flags_t)(1 << 3),  };  struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, -		unsigned int flags); +		blk_mq_req_flags_t flags);  struct request *blk_mq_alloc_request_hctx(struct request_queue *q, -		unsigned int op, unsigned int flags, unsigned int hctx_idx); +		unsigned int op, blk_mq_req_flags_t flags, +		unsigned int hctx_idx);  struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag);  enum { @@ -248,7 +267,7 @@ void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);  void blk_mq_quiesce_queue(struct request_queue *q);  void blk_mq_unquiesce_queue(struct request_queue *q);  void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); -void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); +bool blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);  void blk_mq_run_hw_queues(struct request_queue *q, bool async);  void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);  void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, @@ -259,8 +278,8 @@ void blk_freeze_queue_start(struct request_queue *q);  void blk_mq_freeze_queue_wait(struct request_queue *q);  int blk_mq_freeze_queue_wait_timeout(struct request_queue *q,  				     unsigned long timeout); -int blk_mq_reinit_tagset(struct blk_mq_tag_set *set, -			 int (reinit_request)(void *, struct request *)); +int blk_mq_tagset_iter(struct blk_mq_tag_set *set, void *data, +		int (reinit_request)(void *, struct request *));  int blk_mq_map_queues(struct blk_mq_tag_set *set);  void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index a2d2aa709cef..a1e628e032da 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Block data types and constants.  Directly include this file only to   * break include dependency loop. @@ -162,6 +163,8 @@ struct bio {   */  #define BIO_RESET_BITS	BVEC_POOL_OFFSET +typedef __u32 __bitwise blk_mq_req_flags_t; +  /*   * Operations and flags common to the bio and request structures.   * We use 8 bits for encoding the operation, and the remaining 24 for flags. @@ -224,11 +227,14 @@ enum req_flag_bits {  	__REQ_PREFLUSH,		/* request for cache flush */  	__REQ_RAHEAD,		/* read ahead, can fail anytime */  	__REQ_BACKGROUND,	/* background IO */ +	__REQ_NOWAIT,           /* Don't wait if request will block */  	/* command specific flags for REQ_OP_WRITE_ZEROES: */  	__REQ_NOUNMAP,		/* do not free blocks when zeroing */ -	__REQ_NOWAIT,           /* Don't wait if request will block */ +	/* for driver use */ +	__REQ_DRV, +  	__REQ_NR_BITS,		/* stops here */  }; @@ -245,9 +251,11 @@ enum req_flag_bits {  #define REQ_PREFLUSH		(1ULL << __REQ_PREFLUSH)  #define REQ_RAHEAD		(1ULL << __REQ_RAHEAD)  #define REQ_BACKGROUND		(1ULL << __REQ_BACKGROUND) +#define REQ_NOWAIT		(1ULL << __REQ_NOWAIT)  #define REQ_NOUNMAP		(1ULL << __REQ_NOUNMAP) -#define REQ_NOWAIT		(1ULL << __REQ_NOWAIT) + +#define REQ_DRV			(1ULL << __REQ_DRV)  #define REQ_FAILFAST_MASK \  	(REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) @@ -329,11 +337,10 @@ static inline bool blk_qc_t_is_internal(blk_qc_t cookie)  }  struct blk_rq_stat { -	s64 mean; +	u64 mean;  	u64 min;  	u64 max; -	s32 nr_samples; -	s32 nr_batch; +	u32 nr_samples;  	u64 batch;  }; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 02fa42d24b52..8089ca17db9a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BLKDEV_H  #define _LINUX_BLKDEV_H @@ -266,6 +267,7 @@ struct blk_queue_ctx;  typedef void (request_fn_proc) (struct request_queue *q);  typedef blk_qc_t (make_request_fn) (struct request_queue *q, struct bio *bio); +typedef bool (poll_q_fn) (struct request_queue *q, blk_qc_t);  typedef int (prep_rq_fn) (struct request_queue *, struct request *);  typedef void (unprep_rq_fn) (struct request_queue *, struct request *); @@ -408,6 +410,7 @@ struct request_queue {  	request_fn_proc		*request_fn;  	make_request_fn		*make_request_fn; +	poll_q_fn		*poll_fn;  	prep_rq_fn		*prep_rq_fn;  	unprep_rq_fn		*unprep_rq_fn;  	softirq_done_fn		*softirq_done_fn; @@ -609,7 +612,6 @@ struct request_queue {  #define QUEUE_FLAG_NOMERGES     5	/* disable merge attempts */  #define QUEUE_FLAG_SAME_COMP	6	/* complete on same CPU-group */  #define QUEUE_FLAG_FAIL_IO	7	/* fake timeout */ -#define QUEUE_FLAG_STACKABLE	8	/* supports request stacking */  #define QUEUE_FLAG_NONROT	9	/* non-rotational device (SSD) */  #define QUEUE_FLAG_VIRT        QUEUE_FLAG_NONROT /* paravirt device */  #define QUEUE_FLAG_IO_STAT     10	/* do IO stats */ @@ -631,14 +633,13 @@ struct request_queue {  #define QUEUE_FLAG_REGISTERED  26	/* queue has been registered to a disk */  #define QUEUE_FLAG_SCSI_PASSTHROUGH 27	/* queue supports SCSI commands */  #define QUEUE_FLAG_QUIESCED    28	/* queue has been quiesced */ +#define QUEUE_FLAG_PREEMPT_ONLY	29	/* only process REQ_PREEMPT requests */  #define QUEUE_FLAG_DEFAULT	((1 << QUEUE_FLAG_IO_STAT) |		\ -				 (1 << QUEUE_FLAG_STACKABLE)	|	\  				 (1 << QUEUE_FLAG_SAME_COMP)	|	\  				 (1 << QUEUE_FLAG_ADD_RANDOM))  #define QUEUE_FLAG_MQ_DEFAULT	((1 << QUEUE_FLAG_IO_STAT) |		\ -				 (1 << QUEUE_FLAG_STACKABLE)	|	\  				 (1 << QUEUE_FLAG_SAME_COMP)	|	\  				 (1 << QUEUE_FLAG_POLL)) @@ -722,8 +723,6 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)  #define blk_queue_nonrot(q)	test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)  #define blk_queue_io_stat(q)	test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)  #define blk_queue_add_random(q)	test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags) -#define blk_queue_stackable(q)	\ -	test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)  #define blk_queue_discard(q)	test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)  #define blk_queue_secure_erase(q) \  	(test_bit(QUEUE_FLAG_SECERASE, &(q)->queue_flags)) @@ -735,6 +734,11 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)  	((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \  			     REQ_FAILFAST_DRIVER))  #define blk_queue_quiesced(q)	test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags) +#define blk_queue_preempt_only(q)				\ +	test_bit(QUEUE_FLAG_PREEMPT_ONLY, &(q)->queue_flags) + +extern int blk_set_preempt_only(struct request_queue *q); +extern void blk_clear_preempt_only(struct request_queue *q);  static inline bool blk_account_rq(struct request *rq)  { @@ -922,24 +926,17 @@ static inline void rq_flush_dcache_pages(struct request *rq)  }  #endif -#ifdef CONFIG_PRINTK -#define vfs_msg(sb, level, fmt, ...)				\ -	__vfs_msg(sb, level, fmt, ##__VA_ARGS__) -#else -#define vfs_msg(sb, level, fmt, ...)				\ -do {								\ -	no_printk(fmt, ##__VA_ARGS__);				\ -	__vfs_msg(sb, "", " ");					\ -} while (0) -#endif -  extern int blk_register_queue(struct gendisk *disk);  extern void blk_unregister_queue(struct gendisk *disk);  extern blk_qc_t generic_make_request(struct bio *bio); +extern blk_qc_t direct_make_request(struct bio *bio);  extern void blk_rq_init(struct request_queue *q, struct request *rq);  extern void blk_init_request_from_bio(struct request *req, struct bio *bio);  extern void blk_put_request(struct request *);  extern void __blk_put_request(struct request_queue *, struct request *); +extern struct request *blk_get_request_flags(struct request_queue *, +					     unsigned int op, +					     blk_mq_req_flags_t flags);  extern struct request *blk_get_request(struct request_queue *, unsigned int op,  				       gfp_t gfp_mask);  extern void blk_requeue_request(struct request_queue *, struct request *); @@ -963,7 +960,7 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,  extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,  			 struct scsi_ioctl_command __user *); -extern int blk_queue_enter(struct request_queue *q, bool nowait); +extern int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags);  extern void blk_queue_exit(struct request_queue *q);  extern void blk_start_queue(struct request_queue *q);  extern void blk_start_queue_async(struct request_queue *q); @@ -990,7 +987,7 @@ extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,  int blk_status_to_errno(blk_status_t status);  blk_status_t errno_to_blk_status(int errno); -bool blk_mq_poll(struct request_queue *q, blk_qc_t cookie); +bool blk_poll(struct request_queue *q, blk_qc_t cookie);  static inline struct request_queue *bdev_get_queue(struct block_device *bdev)  { @@ -1109,6 +1106,8 @@ extern struct request *blk_peek_request(struct request_queue *q);  extern void blk_start_request(struct request *rq);  extern struct request *blk_fetch_request(struct request_queue *q); +void blk_steal_bios(struct bio_list *list, struct request *rq); +  /*   * Request completion related functions.   * @@ -1371,7 +1370,7 @@ static inline int sb_issue_zeroout(struct super_block *sb, sector_t block,  				    gfp_mask, 0);  } -extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); +extern int blk_verify_command(unsigned char *cmd, fmode_t mode);  enum blk_default_limits {  	BLK_MAX_SEGMENTS	= 128, diff --git a/include/linux/blkpg.h b/include/linux/blkpg.h index bef124fde61e..1c91753c3c28 100644 --- a/include/linux/blkpg.h +++ b/include/linux/blkpg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BLKPG_H  #define _LINUX_BLKPG_H diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 67b4d4dfc19c..8804753805ac 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef BLKTRACE_H  #define BLKTRACE_H diff --git a/include/linux/blockgroup_lock.h b/include/linux/blockgroup_lock.h index 225bdb7daec7..511ab123a822 100644 --- a/include/linux/blockgroup_lock.h +++ b/include/linux/blockgroup_lock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BLOCKGROUP_LOCK_H  #define _LINUX_BLOCKGROUP_LOCK_H  /* diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index e223d91b6439..a53063e9d7d8 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999   */ @@ -160,6 +161,9 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,  #define BOOTMEM_ALLOC_ANYWHERE		(~(phys_addr_t)0)  /* FIXME: Move to memblock.h at a point where we remove nobootmem.c */ +void *memblock_virt_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align, +				      phys_addr_t min_addr, +				      phys_addr_t max_addr, int nid);  void *memblock_virt_alloc_try_nid_nopanic(phys_addr_t size,  		phys_addr_t align, phys_addr_t min_addr,  		phys_addr_t max_addr, int nid); @@ -176,6 +180,14 @@ static inline void * __init memblock_virt_alloc(  					    NUMA_NO_NODE);  } +static inline void * __init memblock_virt_alloc_raw( +					phys_addr_t size,  phys_addr_t align) +{ +	return memblock_virt_alloc_try_nid_raw(size, align, BOOTMEM_LOW_LIMIT, +					    BOOTMEM_ALLOC_ACCESSIBLE, +					    NUMA_NO_NODE); +} +  static inline void * __init memblock_virt_alloc_nopanic(  					phys_addr_t size, phys_addr_t align)  { @@ -257,6 +269,14 @@ static inline void * __init memblock_virt_alloc(  	return __alloc_bootmem(size, align, BOOTMEM_LOW_LIMIT);  } +static inline void * __init memblock_virt_alloc_raw( +					phys_addr_t size,  phys_addr_t align) +{ +	if (!align) +		align = SMP_CACHE_BYTES; +	return __alloc_bootmem_nopanic(size, align, BOOTMEM_LOW_LIMIT); +} +  static inline void * __init memblock_virt_alloc_nopanic(  					phys_addr_t size, phys_addr_t align)  { @@ -309,6 +329,14 @@ static inline void * __init memblock_virt_alloc_try_nid(phys_addr_t size,  					  min_addr);  } +static inline void * __init memblock_virt_alloc_try_nid_raw( +			phys_addr_t size, phys_addr_t align, +			phys_addr_t min_addr, phys_addr_t max_addr, int nid) +{ +	return ___alloc_bootmem_node_nopanic(NODE_DATA(nid), size, align, +				min_addr, max_addr); +} +  static inline void * __init memblock_virt_alloc_try_nid_nopanic(  			phys_addr_t size, phys_addr_t align,  			phys_addr_t min_addr, phys_addr_t max_addr, int nid) diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h index 8fdcb783197d..a19519f4241d 100644 --- a/include/linux/bottom_half.h +++ b/include/linux/bottom_half.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BH_H  #define _LINUX_BH_H diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index d41d40ac3efd..a7f16e0f8d68 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _BPF_CGROUP_H  #define _BPF_CGROUP_H @@ -14,27 +15,46 @@ struct bpf_sock_ops_kern;  extern struct static_key_false cgroup_bpf_enabled_key;  #define cgroup_bpf_enabled static_branch_unlikely(&cgroup_bpf_enabled_key) +struct bpf_prog_list { +	struct list_head node; +	struct bpf_prog *prog; +}; + +struct bpf_prog_array; +  struct cgroup_bpf { -	/* -	 * Store two sets of bpf_prog pointers, one for programs that are -	 * pinned directly to this cgroup, and one for those that are effective -	 * when this cgroup is accessed. +	/* array of effective progs in this cgroup */ +	struct bpf_prog_array __rcu *effective[MAX_BPF_ATTACH_TYPE]; + +	/* attached progs to this cgroup and attach flags +	 * when flags == 0 or BPF_F_ALLOW_OVERRIDE the progs list will +	 * have either zero or one element +	 * when BPF_F_ALLOW_MULTI the list can have up to BPF_CGROUP_MAX_PROGS  	 */ -	struct bpf_prog *prog[MAX_BPF_ATTACH_TYPE]; -	struct bpf_prog __rcu *effective[MAX_BPF_ATTACH_TYPE]; -	bool disallow_override[MAX_BPF_ATTACH_TYPE]; +	struct list_head progs[MAX_BPF_ATTACH_TYPE]; +	u32 flags[MAX_BPF_ATTACH_TYPE]; + +	/* temp storage for effective prog array used by prog_attach/detach */ +	struct bpf_prog_array __rcu *inactive;  };  void cgroup_bpf_put(struct cgroup *cgrp); -void cgroup_bpf_inherit(struct cgroup *cgrp, struct cgroup *parent); - -int __cgroup_bpf_update(struct cgroup *cgrp, struct cgroup *parent, -			struct bpf_prog *prog, enum bpf_attach_type type, -			bool overridable); - -/* Wrapper for __cgroup_bpf_update() protected by cgroup_mutex */ -int cgroup_bpf_update(struct cgroup *cgrp, struct bpf_prog *prog, -		      enum bpf_attach_type type, bool overridable); +int cgroup_bpf_inherit(struct cgroup *cgrp); + +int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, +			enum bpf_attach_type type, u32 flags); +int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, +			enum bpf_attach_type type, u32 flags); +int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, +		       union bpf_attr __user *uattr); + +/* Wrapper for __cgroup_bpf_*() protected by cgroup_mutex */ +int cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, +		      enum bpf_attach_type type, u32 flags); +int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, +		      enum bpf_attach_type type, u32 flags); +int cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, +		     union bpf_attr __user *uattr);  int __cgroup_bpf_run_filter_skb(struct sock *sk,  				struct sk_buff *skb, @@ -47,6 +67,9 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,  				     struct bpf_sock_ops_kern *sock_ops,  				     enum bpf_attach_type type); +int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, +				      short access, enum bpf_attach_type type); +  /* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */  #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb)			      \  ({									      \ @@ -92,17 +115,28 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,  	}								       \  	__ret;								       \  }) + +#define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type, major, minor, access)	      \ +({									      \ +	int __ret = 0;							      \ +	if (cgroup_bpf_enabled)						      \ +		__ret = __cgroup_bpf_check_dev_permission(type, major, minor, \ +							  access,	      \ +							  BPF_CGROUP_DEVICE); \ +									      \ +	__ret;								      \ +})  #else  struct cgroup_bpf {};  static inline void cgroup_bpf_put(struct cgroup *cgrp) {} -static inline void cgroup_bpf_inherit(struct cgroup *cgrp, -				      struct cgroup *parent) {} +static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; }  #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; })  #define BPF_CGROUP_RUN_PROG_INET_EGRESS(sk,skb) ({ 0; })  #define BPF_CGROUP_RUN_PROG_INET_SOCK(sk) ({ 0; })  #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) +#define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; })  #endif /* CONFIG_CGROUP_BPF */ diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 8390859e79e7..e55e4255a210 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -15,6 +15,7 @@  #include <linux/err.h>  #include <linux/rbtree_latch.h>  #include <linux/numa.h> +#include <linux/wait.h>  struct perf_event;  struct bpf_prog; @@ -56,6 +57,10 @@ struct bpf_map {  	struct work_struct work;  	atomic_t usercnt;  	struct bpf_map *inner_map_meta; +	char name[BPF_OBJ_NAME_LEN]; +#ifdef CONFIG_SECURITY +	void *security; +#endif  };  /* function argument constraints */ @@ -73,6 +78,7 @@ enum bpf_arg_type {  	 * functions that access data on eBPF program stack  	 */  	ARG_PTR_TO_MEM,		/* pointer to valid memory (stack, packet, map value) */ +	ARG_PTR_TO_MEM_OR_NULL, /* pointer to valid memory or NULL */  	ARG_PTR_TO_UNINIT_MEM,	/* pointer to memory does not need to be initialized,  				 * helper function must fill all bytes or clear  				 * them in error case. @@ -137,6 +143,7 @@ enum bpf_reg_type {  	PTR_TO_MAP_VALUE,	 /* reg points to map element value */  	PTR_TO_MAP_VALUE_OR_NULL,/* points to map elem value or NULL */  	PTR_TO_STACK,		 /* reg == frame_pointer + offset */ +	PTR_TO_PACKET_META,	 /* skb->data - meta_len */  	PTR_TO_PACKET,		 /* reg points to skb->data */  	PTR_TO_PACKET_END,	 /* skb->data + headlen */  }; @@ -155,6 +162,11 @@ bpf_ctx_record_field_size(struct bpf_insn_access_aux *aux, u32 size)  	aux->ctx_field_size = size;  } +struct bpf_prog_ops { +	int (*test_run)(struct bpf_prog *prog, const union bpf_attr *kattr, +			union bpf_attr __user *uattr); +}; +  struct bpf_verifier_ops {  	/* return eBPF function prototype for verification */  	const struct bpf_func_proto *(*get_func_proto)(enum bpf_func_id func_id); @@ -170,8 +182,16 @@ struct bpf_verifier_ops {  				  const struct bpf_insn *src,  				  struct bpf_insn *dst,  				  struct bpf_prog *prog, u32 *target_size); -	int (*test_run)(struct bpf_prog *prog, const union bpf_attr *kattr, -			union bpf_attr __user *uattr); +}; + +struct bpf_dev_offload { +	struct bpf_prog		*prog; +	struct net_device	*netdev; +	void			*dev_priv; +	struct list_head	offloads; +	bool			dev_state; +	bool			verifier_running; +	wait_queue_head_t	verifier_done;  };  struct bpf_prog_aux { @@ -182,10 +202,16 @@ struct bpf_prog_aux {  	u32 id;  	struct latch_tree_node ksym_tnode;  	struct list_head ksym_lnode; -	const struct bpf_verifier_ops *ops; +	const struct bpf_prog_ops *ops;  	struct bpf_map **used_maps;  	struct bpf_prog *prog;  	struct user_struct *user; +	u64 load_time; /* ns since boottime */ +	char name[BPF_OBJ_NAME_LEN]; +#ifdef CONFIG_SECURITY +	void *security; +#endif +	struct bpf_dev_offload *offload;  	union {  		struct work_struct work;  		struct rcu_head	rcu; @@ -218,9 +244,6 @@ struct bpf_event_entry {  	struct rcu_head rcu;  }; -u64 bpf_tail_call(u64 ctx, u64 r2, u64 index, u64 r4, u64 r5); -u64 bpf_get_stackid(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); -  bool bpf_prog_array_compatible(struct bpf_array *array, const struct bpf_prog *fp);  int bpf_prog_calc_tag(struct bpf_prog *fp); @@ -237,19 +260,83 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,  int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,  			  union bpf_attr __user *uattr); +/* an array of programs to be executed under rcu_lock. + * + * Typical usage: + * ret = BPF_PROG_RUN_ARRAY(&bpf_prog_array, ctx, BPF_PROG_RUN); + * + * the structure returned by bpf_prog_array_alloc() should be populated + * with program pointers and the last pointer must be NULL. + * The user has to keep refcnt on the program and make sure the program + * is removed from the array before bpf_prog_put(). + * The 'struct bpf_prog_array *' should only be replaced with xchg() + * since other cpus are walking the array of pointers in parallel. + */ +struct bpf_prog_array { +	struct rcu_head rcu; +	struct bpf_prog *progs[0]; +}; + +struct bpf_prog_array __rcu *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); +void bpf_prog_array_free(struct bpf_prog_array __rcu *progs); +int bpf_prog_array_length(struct bpf_prog_array __rcu *progs); +int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, +				__u32 __user *prog_ids, u32 cnt); + +void bpf_prog_array_delete_safe(struct bpf_prog_array __rcu *progs, +				struct bpf_prog *old_prog); +int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, +			struct bpf_prog *exclude_prog, +			struct bpf_prog *include_prog, +			struct bpf_prog_array **new_array); + +#define __BPF_PROG_RUN_ARRAY(array, ctx, func, check_non_null)	\ +	({						\ +		struct bpf_prog **_prog, *__prog;	\ +		struct bpf_prog_array *_array;		\ +		u32 _ret = 1;				\ +		rcu_read_lock();			\ +		_array = rcu_dereference(array);	\ +		if (unlikely(check_non_null && !_array))\ +			goto _out;			\ +		_prog = _array->progs;			\ +		while ((__prog = READ_ONCE(*_prog))) {	\ +			_ret &= func(__prog, ctx);	\ +			_prog++;			\ +		}					\ +_out:							\ +		rcu_read_unlock();			\ +		_ret;					\ +	 }) + +#define BPF_PROG_RUN_ARRAY(array, ctx, func)		\ +	__BPF_PROG_RUN_ARRAY(array, ctx, func, false) + +#define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func)	\ +	__BPF_PROG_RUN_ARRAY(array, ctx, func, true) +  #ifdef CONFIG_BPF_SYSCALL  DECLARE_PER_CPU(int, bpf_prog_active); -#define BPF_PROG_TYPE(_id, _ops) \ -	extern const struct bpf_verifier_ops _ops; +extern const struct file_operations bpf_map_fops; +extern const struct file_operations bpf_prog_fops; + +#define BPF_PROG_TYPE(_id, _name) \ +	extern const struct bpf_prog_ops _name ## _prog_ops; \ +	extern const struct bpf_verifier_ops _name ## _verifier_ops;  #define BPF_MAP_TYPE(_id, _ops) \  	extern const struct bpf_map_ops _ops;  #include <linux/bpf_types.h>  #undef BPF_PROG_TYPE  #undef BPF_MAP_TYPE +extern const struct bpf_prog_ops bpf_offload_prog_ops; +extern const struct bpf_verifier_ops tc_cls_act_analyzer_ops; +extern const struct bpf_verifier_ops xdp_analyzer_ops; +  struct bpf_prog *bpf_prog_get(u32 ufd); -struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type); +struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, +				       bool attach_drv);  struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, int i);  void bpf_prog_sub(struct bpf_prog *prog, int i);  struct bpf_prog * __must_check bpf_prog_inc(struct bpf_prog *prog); @@ -269,11 +356,11 @@ void bpf_map_area_free(void *base);  extern int sysctl_unprivileged_bpf_disabled; -int bpf_map_new_fd(struct bpf_map *map); +int bpf_map_new_fd(struct bpf_map *map, int flags);  int bpf_prog_new_fd(struct bpf_prog *prog);  int bpf_obj_pin_user(u32 ufd, const char __user *pathname); -int bpf_obj_get_user(const char __user *pathname); +int bpf_obj_get_user(const char __user *pathname, int flags);  int bpf_percpu_hash_copy(struct bpf_map *map, void *key, void *value);  int bpf_percpu_array_copy(struct bpf_map *map, void *key, void *value); @@ -292,6 +379,8 @@ int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file,  				void *key, void *value, u64 map_flags);  int bpf_fd_htab_map_lookup_elem(struct bpf_map *map, void *key, u32 *value); +int bpf_get_file_flag(int flags); +  /* memcpy that is used with 8-byte aligned pointers, power-of-8 size and   * forced to use 'long' read/writes to try to atomically copy long counters.   * Best-effort only.  No barriers here, since it _will_ race with concurrent @@ -316,6 +405,13 @@ struct net_device  *__dev_map_lookup_elem(struct bpf_map *map, u32 key);  void __dev_map_insert_ctx(struct bpf_map *map, u32 index);  void __dev_map_flush(struct bpf_map *map); +struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key); +void __cpu_map_insert_ctx(struct bpf_map *map, u32 index); +void __cpu_map_flush(struct bpf_map *map); +struct xdp_buff; +int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_buff *xdp, +		    struct net_device *dev_rx); +  /* Return map's numa specified by userspace */  static inline int bpf_map_attr_numa_node(const union bpf_attr *attr)  { @@ -323,17 +419,19 @@ static inline int bpf_map_attr_numa_node(const union bpf_attr *attr)  		attr->numa_node : NUMA_NO_NODE;  } -#else +#else /* !CONFIG_BPF_SYSCALL */  static inline struct bpf_prog *bpf_prog_get(u32 ufd)  {  	return ERR_PTR(-EOPNOTSUPP);  } -static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, -						 enum bpf_prog_type type) +static inline struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, +						     enum bpf_prog_type type, +						     bool attach_drv)  {  	return ERR_PTR(-EOPNOTSUPP);  } +  static inline struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog,  							  int i)  { @@ -368,6 +466,11 @@ static inline void __bpf_prog_uncharge(struct user_struct *user, u32 pages)  {  } +static inline int bpf_obj_get_user(const char __user *pathname, int flags) +{ +	return -EOPNOTSUPP; +} +  static inline struct net_device  *__dev_map_lookup_elem(struct bpf_map *map,  						       u32 key)  { @@ -381,8 +484,59 @@ static inline void __dev_map_insert_ctx(struct bpf_map *map, u32 index)  static inline void __dev_map_flush(struct bpf_map *map)  {  } + +static inline +struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key) +{ +	return NULL; +} + +static inline void __cpu_map_insert_ctx(struct bpf_map *map, u32 index) +{ +} + +static inline void __cpu_map_flush(struct bpf_map *map) +{ +} + +struct xdp_buff; +static inline int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, +				  struct xdp_buff *xdp, +				  struct net_device *dev_rx) +{ +	return 0; +}  #endif /* CONFIG_BPF_SYSCALL */ +static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, +						 enum bpf_prog_type type) +{ +	return bpf_prog_get_type_dev(ufd, type, false); +} + +int bpf_prog_offload_compile(struct bpf_prog *prog); +void bpf_prog_offload_destroy(struct bpf_prog *prog); + +#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL) +int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr); + +static inline bool bpf_prog_is_dev_bound(struct bpf_prog_aux *aux) +{ +	return aux->offload; +} +#else +static inline int bpf_prog_offload_init(struct bpf_prog *prog, +					union bpf_attr *attr) +{ +	return -EOPNOTSUPP; +} + +static inline bool bpf_prog_is_dev_bound(struct bpf_prog_aux *aux) +{ +	return false; +} +#endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */ +  #if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL)  struct sock  *__sock_map_lookup_elem(struct bpf_map *map, u32 key);  int sock_map_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type); diff --git a/include/linux/bpf_trace.h b/include/linux/bpf_trace.h index b22efbdd2eb4..e6fe98ae3794 100644 --- a/include/linux/bpf_trace.h +++ b/include/linux/bpf_trace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BPF_TRACE_H__  #define __LINUX_BPF_TRACE_H__ diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index 6f1a567667b8..978c1d9c9383 100644 --- a/include/linux/bpf_types.h +++ b/include/linux/bpf_types.h @@ -1,22 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* internal file - do not include directly */  #ifdef CONFIG_NET -BPF_PROG_TYPE(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_ACT, tc_cls_act_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_inout_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_inout_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_SOCK_OPS, sock_ops_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_SK_SKB, sk_skb_prog_ops) +BPF_PROG_TYPE(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter) +BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act) +BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_ACT, tc_cls_act) +BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp) +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb) +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock) +BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_inout) +BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_inout) +BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit) +BPF_PROG_TYPE(BPF_PROG_TYPE_SOCK_OPS, sock_ops) +BPF_PROG_TYPE(BPF_PROG_TYPE_SK_SKB, sk_skb)  #endif  #ifdef CONFIG_BPF_EVENTS -BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint_prog_ops) -BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event_prog_ops) +BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe) +BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint) +BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event) +#endif +#ifdef CONFIG_CGROUP_BPF +BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev)  #endif  BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops) @@ -41,4 +45,5 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)  #ifdef CONFIG_STREAM_PARSER  BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops)  #endif +BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops)  #endif diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index b8d200f60a40..c561b986bab0 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -88,14 +88,19 @@ enum bpf_stack_slot_type {  #define BPF_REG_SIZE 8	/* size of eBPF register in bytes */ +struct bpf_stack_state { +	struct bpf_reg_state spilled_ptr; +	u8 slot_type[BPF_REG_SIZE]; +}; +  /* state of the program:   * type of all registers and stack info   */  struct bpf_verifier_state {  	struct bpf_reg_state regs[MAX_BPF_REG]; -	u8 stack_slot_type[MAX_BPF_STACK]; -	struct bpf_reg_state spilled_regs[MAX_BPF_STACK / BPF_REG_SIZE];  	struct bpf_verifier_state *parent; +	int allocated_stack; +	struct bpf_stack_state *stack;  };  /* linked list of verifier states used to prune search */ @@ -110,11 +115,26 @@ struct bpf_insn_aux_data {  		struct bpf_map *map_ptr;	/* pointer for call insn into lookup_elem */  	};  	int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ -	int converted_op_size; /* the valid value width after perceived conversion */ +	bool seen; /* this insn was processed by the verifier */  };  #define MAX_USED_MAPS 64 /* max number of maps accessed by one eBPF program */ +#define BPF_VERIFIER_TMP_LOG_SIZE	1024 + +struct bpf_verifer_log { +	u32 level; +	char kbuf[BPF_VERIFIER_TMP_LOG_SIZE]; +	char __user *ubuf; +	u32 len_used; +	u32 len_total; +}; + +static inline bool bpf_verifier_log_full(const struct bpf_verifer_log *log) +{ +	return log->len_used >= log->len_total - 1; +} +  struct bpf_verifier_env;  struct bpf_ext_analyzer_ops {  	int (*insn_hook)(struct bpf_verifier_env *env, @@ -126,22 +146,35 @@ struct bpf_ext_analyzer_ops {   */  struct bpf_verifier_env {  	struct bpf_prog *prog;		/* eBPF program being verified */ +	const struct bpf_verifier_ops *ops;  	struct bpf_verifier_stack_elem *head; /* stack of verifier states to be processed */  	int stack_size;			/* number of states to be processed */  	bool strict_alignment;		/* perform strict pointer alignment checks */ -	struct bpf_verifier_state cur_state; /* current verifier state */ +	struct bpf_verifier_state *cur_state; /* current verifier state */  	struct bpf_verifier_state_list **explored_states; /* search pruning optimization */ -	const struct bpf_ext_analyzer_ops *analyzer_ops; /* external analyzer ops */ -	void *analyzer_priv; /* pointer to external analyzer's private data */ +	const struct bpf_ext_analyzer_ops *dev_ops; /* device analyzer ops */  	struct bpf_map *used_maps[MAX_USED_MAPS]; /* array of map's used by eBPF program */  	u32 used_map_cnt;		/* number of used maps */  	u32 id_gen;			/* used to generate unique reg IDs */  	bool allow_ptr_leaks;  	bool seen_direct_write;  	struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */ + +	struct bpf_verifer_log log;  }; -int bpf_analyzer(struct bpf_prog *prog, const struct bpf_ext_analyzer_ops *ops, -		 void *priv); +static inline struct bpf_reg_state *cur_regs(struct bpf_verifier_env *env) +{ +	return env->cur_state->regs; +} + +#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL) +int bpf_prog_offload_verifier_prep(struct bpf_verifier_env *env); +#else +static inline int bpf_prog_offload_verifier_prep(struct bpf_verifier_env *env) +{ +	return -EOPNOTSUPP; +} +#endif  #endif /* _LINUX_BPF_VERIFIER_H */ diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index abcda9b458ab..8ff86b4c1b8a 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BRCMPHY_H  #define _LINUX_BRCMPHY_H @@ -63,6 +64,7 @@  #define PHY_BRCM_EXT_IBND_TX_ENABLE	0x00002000  #define PHY_BRCM_CLEAR_RGMII_MODE	0x00004000  #define PHY_BRCM_DIS_TXCRXC_NOENRGY	0x00008000 +#define PHY_BRCM_EN_MASTER_MODE		0x00010000  /* Broadcom BCM7xxx specific workarounds */  #define PHY_BRCM_7XXX_REV(x)		(((x) >> 8) & 0xff) diff --git a/include/linux/bsearch.h b/include/linux/bsearch.h index 90b1aa867224..62b1eb348858 100644 --- a/include/linux/bsearch.h +++ b/include/linux/bsearch.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BSEARCH_H  #define _LINUX_BSEARCH_H diff --git a/include/linux/bsg.h b/include/linux/bsg.h index 7173f6e9d2dd..2a202e41a3af 100644 --- a/include/linux/bsg.h +++ b/include/linux/bsg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef BSG_H  #define BSG_H diff --git a/include/linux/btree-128.h b/include/linux/btree-128.h index 0b3414c4c928..22c09f5c3c39 100644 --- a/include/linux/btree-128.h +++ b/include/linux/btree-128.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  extern struct btree_geo btree_geo128;  struct btree_head128 { struct btree_head h; }; diff --git a/include/linux/btree-type.h b/include/linux/btree-type.h index 9a1147ef8563..fb34a52c788b 100644 --- a/include/linux/btree-type.h +++ b/include/linux/btree-type.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #define __BTREE_TP(pfx, type, sfx)	pfx ## type ## sfx  #define _BTREE_TP(pfx, type, sfx)	__BTREE_TP(pfx, type, sfx)  #define BTREE_TP(pfx)			_BTREE_TP(pfx, BTREE_TYPE_SUFFIX,) diff --git a/include/linux/btree.h b/include/linux/btree.h index 65b5bb058324..68f858c831b1 100644 --- a/include/linux/btree.h +++ b/include/linux/btree.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef BTREE_H  #define BTREE_H diff --git a/include/linux/btrfs.h b/include/linux/btrfs.h index 22d799147db2..9a37a45ec801 100644 --- a/include/linux/btrfs.h +++ b/include/linux/btrfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BTRFS_H  #define _LINUX_BTRFS_H diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index c8dae555eccf..8b1bf8d3d4a2 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/buffer_head.h   * @@ -156,7 +157,7 @@ void set_bh_page(struct buffer_head *bh,  		struct page *page, unsigned long offset);  int try_to_free_buffers(struct page *);  struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, -		int retry); +		bool retry);  void create_empty_buffers(struct page *, unsigned long,  			unsigned long b_state);  void end_buffer_read_sync(struct buffer_head *bh, int uptodate); @@ -232,6 +233,7 @@ int generic_write_end(struct file *, struct address_space *,  				loff_t, unsigned, unsigned,  				struct page *, void *);  void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); +void clean_page_buffers(struct page *page);  int cont_write_begin(struct file *, struct address_space *, loff_t,  			unsigned, unsigned, struct page **, void **,  			get_block_t *, loff_t *); diff --git a/include/linux/bug.h b/include/linux/bug.h index 5d5554c874fd..fe5916550da8 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BUG_H  #define _LINUX_BUG_H @@ -42,6 +43,8 @@ enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);  /* These are defined by the architecture */  int is_valid_bugaddr(unsigned long addr); +void generic_bug_clear_once(void); +  #else	/* !CONFIG_GENERIC_BUG */  static inline enum bug_trap_type report_bug(unsigned long bug_addr, @@ -50,6 +53,9 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr,  	return BUG_TRAP_TYPE_BUG;  } + +static inline void generic_bug_clear_once(void) {} +  #endif	/* CONFIG_GENERIC_BUG */  /* diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h index b7d22d60008a..3efed0d742a0 100644 --- a/include/linux/build_bug.h +++ b/include/linux/build_bug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BUILD_BUG_H  #define _LINUX_BUILD_BUG_H diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h index ffd215988392..d64a524d3cfb 100644 --- a/include/linux/byteorder/big_endian.h +++ b/include/linux/byteorder/big_endian.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H  #define _LINUX_BYTEORDER_BIG_ENDIAN_H diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h index 89f67c1c3160..451aaa0786ae 100644 --- a/include/linux/byteorder/generic.h +++ b/include/linux/byteorder/generic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BYTEORDER_GENERIC_H  #define _LINUX_BYTEORDER_GENERIC_H @@ -170,4 +171,20 @@ static inline void be64_add_cpu(__be64 *var, u64 val)  	*var = cpu_to_be64(be64_to_cpu(*var) + val);  } +static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len) +{ +	int i; + +	for (i = 0; i < len; i++) +		dst[i] = cpu_to_be32(src[i]); +} + +static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len) +{ +	int i; + +	for (i = 0; i < len; i++) +		dst[i] = be32_to_cpu(src[i]); +} +  #endif /* _LINUX_BYTEORDER_GENERIC_H */ diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h index ba910bb9aad0..1ec650ff76cb 100644 --- a/include/linux/byteorder/little_endian.h +++ b/include/linux/byteorder/little_endian.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H  #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H diff --git a/include/linux/c2port.h b/include/linux/c2port.h index 4efabcb51347..f2736348ca26 100644 --- a/include/linux/c2port.h +++ b/include/linux/c2port.h @@ -9,8 +9,6 @@   * the Free Software Foundation   */ -#include <linux/kmemcheck.h> -  #define C2PORT_NAME_LEN			32  struct device; @@ -22,10 +20,8 @@ struct device;  /* Main struct */  struct c2port_ops;  struct c2port_device { -	kmemcheck_bitfield_begin(flags);  	unsigned int access:1;  	unsigned int flash_access:1; -	kmemcheck_bitfield_end(flags);  	int id;  	char name[C2PORT_NAME_LEN]; diff --git a/include/linux/cache.h b/include/linux/cache.h index 1be04f8c563a..750621e41d1c 100644 --- a/include/linux/cache.h +++ b/include/linux/cache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_CACHE_H  #define __LINUX_CACHE_H diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 6a524bf6a06d..3d9805297cda 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CACHEINFO_H  #define _LINUX_CACHEINFO_H diff --git a/include/linux/can/core.h b/include/linux/can/core.h index c9a17bb1221c..6099bc18bd0c 100644 --- a/include/linux/can/core.h +++ b/include/linux/can/core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/can/core.h   * diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 141b05aade81..61f1cf2d9f44 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/can/dev.h   * diff --git a/include/linux/can/platform/cc770.h b/include/linux/can/platform/cc770.h index 78b2d44f04cf..9587d6882906 100644 --- a/include/linux/can/platform/cc770.h +++ b/include/linux/can/platform/cc770.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CAN_PLATFORM_CC770_H  #define _CAN_PLATFORM_CC770_H diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h index d44fcae274ff..9e5ac27fb6c1 100644 --- a/include/linux/can/platform/mcp251x.h +++ b/include/linux/can/platform/mcp251x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CAN_PLATFORM_MCP251X_H  #define _CAN_PLATFORM_MCP251X_H diff --git a/include/linux/can/platform/rcar_can.h b/include/linux/can/platform/rcar_can.h index 0f4a2f3df504..a43dcd0cf79e 100644 --- a/include/linux/can/platform/rcar_can.h +++ b/include/linux/can/platform/rcar_can.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CAN_PLATFORM_RCAR_CAN_H_  #define _CAN_PLATFORM_RCAR_CAN_H_ diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h index 93570b61ec6c..5755ae5a4712 100644 --- a/include/linux/can/platform/sja1000.h +++ b/include/linux/can/platform/sja1000.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CAN_PLATFORM_SJA1000_H  #define _CAN_PLATFORM_SJA1000_H diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h index 51bb6532785c..b3379a97245c 100644 --- a/include/linux/can/skb.h +++ b/include/linux/can/skb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/can/skb.h   * diff --git a/include/linux/capability.h b/include/linux/capability.h index b52e278e4744..f640dcbc880c 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This is <linux/capability.h>   * diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h index 84b6e2d0f44d..1d5229200a71 100644 --- a/include/linux/cciss_ioctl.h +++ b/include/linux/cciss_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef CCISS_IOCTLH  #define CCISS_IOCTLH diff --git a/include/linux/cdev.h b/include/linux/cdev.h index cb28eb21e3ca..0e8cd6293deb 100644 --- a/include/linux/cdev.h +++ b/include/linux/cdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CDEV_H  #define _LINUX_CDEV_H diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 6e8f209a6dff..e75dfd1f1dec 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * -- <linux/cdrom.h>   * General header file for linux CD-ROM drivers  diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h index a6747789fe5c..e931da8424a4 100644 --- a/include/linux/ceph/auth.h +++ b/include/linux/ceph/auth.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_AUTH_H  #define _FS_CEPH_AUTH_H diff --git a/include/linux/ceph/buffer.h b/include/linux/ceph/buffer.h index 07ca15e76100..5e58bb29b1a3 100644 --- a/include/linux/ceph/buffer.h +++ b/include/linux/ceph/buffer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __FS_CEPH_BUFFER_H  #define __FS_CEPH_BUFFER_H diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h index 51c5bd64bd00..d5a5da838caf 100644 --- a/include/linux/ceph/ceph_debug.h +++ b/include/linux/ceph/ceph_debug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_DEBUG_H  #define _FS_CEPH_DEBUG_H diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h index 040dd105c3e7..59042d5ac520 100644 --- a/include/linux/ceph/ceph_features.h +++ b/include/linux/ceph/ceph_features.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __CEPH_FEATURES  #define __CEPH_FEATURES diff --git a/include/linux/ceph/ceph_frag.h b/include/linux/ceph/ceph_frag.h index 146507df8650..97bab0adc58a 100644 --- a/include/linux/ceph/ceph_frag.h +++ b/include/linux/ceph/ceph_frag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef FS_CEPH_FRAG_H  #define FS_CEPH_FRAG_H diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index b422170b791a..88dd51381aaf 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * ceph_fs.h - Ceph constants and data types to share between kernel and   * user space. diff --git a/include/linux/ceph/ceph_hash.h b/include/linux/ceph/ceph_hash.h index d099c3f90236..fda474c7a5d6 100644 --- a/include/linux/ceph/ceph_hash.h +++ b/include/linux/ceph/ceph_hash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef FS_CEPH_HASH_H  #define FS_CEPH_HASH_H diff --git a/include/linux/ceph/cls_lock_client.h b/include/linux/ceph/cls_lock_client.h index 0594d3bba774..bea6c77d2093 100644 --- a/include/linux/ceph/cls_lock_client.h +++ b/include/linux/ceph/cls_lock_client.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CEPH_CLS_LOCK_CLIENT_H  #define _LINUX_CEPH_CLS_LOCK_CLIENT_H diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h index 29cf897cc5cd..fa5f9b7f5dbb 100644 --- a/include/linux/ceph/debugfs.h +++ b/include/linux/ceph/debugfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_DEBUGFS_H  #define _FS_CEPH_DEBUGFS_H diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h index 14af9b70d301..d143ac8879c6 100644 --- a/include/linux/ceph/decode.h +++ b/include/linux/ceph/decode.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __CEPH_DECODE_H  #define __CEPH_DECODE_H diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 4c846aabd9f6..c2ec44cf5098 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_LIBCEPH_H  #define _FS_CEPH_LIBCEPH_H diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h index d5f783f3226a..0067d767c9ae 100644 --- a/include/linux/ceph/mdsmap.h +++ b/include/linux/ceph/mdsmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_MDSMAP_H  #define _FS_CEPH_MDSMAP_H diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index fbd94d9fa5dd..ead9d85f1c11 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __FS_CEPH_MESSENGER_H  #define __FS_CEPH_MESSENGER_H diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h index 0fa990bf867a..3a4688af7455 100644 --- a/include/linux/ceph/mon_client.h +++ b/include/linux/ceph/mon_client.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_MON_CLIENT_H  #define _FS_CEPH_MON_CLIENT_H diff --git a/include/linux/ceph/msgpool.h b/include/linux/ceph/msgpool.h index ddd0d48d0384..76c98a512758 100644 --- a/include/linux/ceph/msgpool.h +++ b/include/linux/ceph/msgpool.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_MSGPOOL  #define _FS_CEPH_MSGPOOL diff --git a/include/linux/ceph/msgr.h b/include/linux/ceph/msgr.h index 0fe2656ac415..73ae2a926548 100644 --- a/include/linux/ceph/msgr.h +++ b/include/linux/ceph/msgr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef CEPH_MSGR_H  #define CEPH_MSGR_H diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index adf670ecaf94..52fb37d1c2a5 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_OSD_CLIENT_H  #define _FS_CEPH_OSD_CLIENT_H diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index af3444a5bfdd..d41fad99c0fa 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_OSDMAP_H  #define _FS_CEPH_OSDMAP_H diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h index 75a7db21457d..7edcded07641 100644 --- a/include/linux/ceph/pagelist.h +++ b/include/linux/ceph/pagelist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __FS_CEPH_PAGELIST_H  #define __FS_CEPH_PAGELIST_H diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h index 01408841c9c4..f1988387c5ad 100644 --- a/include/linux/ceph/rados.h +++ b/include/linux/ceph/rados.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef CEPH_RADOS_H  #define CEPH_RADOS_H diff --git a/include/linux/ceph/string_table.h b/include/linux/ceph/string_table.h index 1b02c96daf75..a4a9962d1e14 100644 --- a/include/linux/ceph/string_table.h +++ b/include/linux/ceph/string_table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_STRING_TABLE_H  #define _FS_CEPH_STRING_TABLE_H diff --git a/include/linux/ceph/types.h b/include/linux/ceph/types.h index d3ff1cf2d27e..27cd973d3881 100644 --- a/include/linux/ceph/types.h +++ b/include/linux/ceph/types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FS_CEPH_TYPES_H  #define _FS_CEPH_TYPES_H diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index ade4a78a54c2..8b7fd8eeccee 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/cgroup-defs.h - basic definitions for cgroup   * @@ -16,6 +17,7 @@  #include <linux/refcount.h>  #include <linux/percpu-refcount.h>  #include <linux/percpu-rwsem.h> +#include <linux/u64_stats_sync.h>  #include <linux/workqueue.h>  #include <linux/bpf-cgroup.h> @@ -254,6 +256,57 @@ struct css_set {  	struct rcu_head rcu_head;  }; +/* + * cgroup basic resource usage statistics.  Accounting is done per-cpu in + * cgroup_cpu_stat which is then lazily propagated up the hierarchy on + * reads. + * + * When a stat gets updated, the cgroup_cpu_stat and its ancestors are + * linked into the updated tree.  On the following read, propagation only + * considers and consumes the updated tree.  This makes reading O(the + * number of descendants which have been active since last read) instead of + * O(the total number of descendants). + * + * This is important because there can be a lot of (draining) cgroups which + * aren't active and stat may be read frequently.  The combination can + * become very expensive.  By propagating selectively, increasing reading + * frequency decreases the cost of each read. + */ +struct cgroup_cpu_stat { +	/* +	 * ->sync protects all the current counters.  These are the only +	 * fields which get updated in the hot path. +	 */ +	struct u64_stats_sync sync; +	struct task_cputime cputime; + +	/* +	 * Snapshots at the last reading.  These are used to calculate the +	 * deltas to propagate to the global counters. +	 */ +	struct task_cputime last_cputime; + +	/* +	 * Child cgroups with stat updates on this cpu since the last read +	 * are linked on the parent's ->updated_children through +	 * ->updated_next. +	 * +	 * In addition to being more compact, singly-linked list pointing +	 * to the cgroup makes it unnecessary for each per-cpu struct to +	 * point back to the associated cgroup. +	 * +	 * Protected by per-cpu cgroup_cpu_stat_lock. +	 */ +	struct cgroup *updated_children;	/* terminated by self cgroup */ +	struct cgroup *updated_next;		/* NULL iff not on the list */ +}; + +struct cgroup_stat { +	/* per-cpu statistics are collected into the folowing global counters */ +	struct task_cputime cputime; +	struct prev_cputime prev_cputime; +}; +  struct cgroup {  	/* self css with NULL ->ss, points back to this cgroup */  	struct cgroup_subsys_state self; @@ -353,6 +406,11 @@ struct cgroup {  	 */  	struct cgroup *dom_cgrp; +	/* cgroup basic resource statistics */ +	struct cgroup_cpu_stat __percpu *cpu_stat; +	struct cgroup_stat pending_stat;	/* pending from children */ +	struct cgroup_stat stat; +  	/*  	 * list of pidlists, up to two for each namespace (one for procs, one  	 * for tasks); created on demand. @@ -512,6 +570,8 @@ struct cgroup_subsys {  	void (*css_released)(struct cgroup_subsys_state *css);  	void (*css_free)(struct cgroup_subsys_state *css);  	void (*css_reset)(struct cgroup_subsys_state *css); +	int (*css_extra_stat_show)(struct seq_file *seq, +				   struct cgroup_subsys_state *css);  	int (*can_attach)(struct cgroup_taskset *tset);  	void (*cancel_attach)(struct cgroup_taskset *tset); diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index d023ac5e377f..473e0c0abb86 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CGROUP_H  #define _LINUX_CGROUP_H  /* @@ -22,6 +23,7 @@  #include <linux/nsproxy.h>  #include <linux/user_namespace.h>  #include <linux/refcount.h> +#include <linux/kernel_stat.h>  #include <linux/cgroup-defs.h> @@ -689,6 +691,63 @@ static inline void cgroup_path_from_kernfs_id(const union kernfs_node_id *id,  #endif /* !CONFIG_CGROUPS */  /* + * Basic resource stats. + */ +#ifdef CONFIG_CGROUPS + +#ifdef CONFIG_CGROUP_CPUACCT +void cpuacct_charge(struct task_struct *tsk, u64 cputime); +void cpuacct_account_field(struct task_struct *tsk, int index, u64 val); +#else +static inline void cpuacct_charge(struct task_struct *tsk, u64 cputime) {} +static inline void cpuacct_account_field(struct task_struct *tsk, int index, +					 u64 val) {} +#endif + +void __cgroup_account_cputime(struct cgroup *cgrp, u64 delta_exec); +void __cgroup_account_cputime_field(struct cgroup *cgrp, +				    enum cpu_usage_stat index, u64 delta_exec); + +static inline void cgroup_account_cputime(struct task_struct *task, +					  u64 delta_exec) +{ +	struct cgroup *cgrp; + +	cpuacct_charge(task, delta_exec); + +	rcu_read_lock(); +	cgrp = task_dfl_cgroup(task); +	if (cgroup_parent(cgrp)) +		__cgroup_account_cputime(cgrp, delta_exec); +	rcu_read_unlock(); +} + +static inline void cgroup_account_cputime_field(struct task_struct *task, +						enum cpu_usage_stat index, +						u64 delta_exec) +{ +	struct cgroup *cgrp; + +	cpuacct_account_field(task, index, delta_exec); + +	rcu_read_lock(); +	cgrp = task_dfl_cgroup(task); +	if (cgroup_parent(cgrp)) +		__cgroup_account_cputime_field(cgrp, index, delta_exec); +	rcu_read_unlock(); +} + +#else	/* CONFIG_CGROUPS */ + +static inline void cgroup_account_cputime(struct task_struct *task, +					  u64 delta_exec) {} +static inline void cgroup_account_cputime_field(struct task_struct *task, +						enum cpu_usage_stat index, +						u64 delta_exec) {} + +#endif	/* CONFIG_CGROUPS */ + +/*   * sock->sk_cgrp_data handling.  For more info, see sock_cgroup_data   * definition in cgroup-defs.h.   */ diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index d0e597c44585..acb77dcff3b4 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * List of cgroup subsystems.   * diff --git a/include/linux/circ_buf.h b/include/linux/circ_buf.h index 90f2471dc6f2..7cf262a421c3 100644 --- a/include/linux/circ_buf.h +++ b/include/linux/circ_buf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * See Documentation/circular-buffers.txt for more information.   */ diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h index bbb3712dd892..5f5730c1d324 100644 --- a/include/linux/cleancache.h +++ b/include/linux/cleancache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CLEANCACHE_H  #define _LINUX_CLEANCACHE_H diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 5100ec1b5d55..7c925e6211f1 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -682,10 +682,10 @@ struct clk_gpio {  extern const struct clk_ops clk_gpio_gate_ops;  struct clk *clk_register_gpio_gate(struct device *dev, const char *name, -		const char *parent_name, unsigned gpio, bool active_low, +		const char *parent_name, struct gpio_desc *gpiod,  		unsigned long flags);  struct clk_hw *clk_hw_register_gpio_gate(struct device *dev, const char *name, -		const char *parent_name, unsigned gpio, bool active_low, +		const char *parent_name, struct gpio_desc *gpiod,  		unsigned long flags);  void clk_hw_unregister_gpio_gate(struct clk_hw *hw); @@ -701,11 +701,11 @@ void clk_hw_unregister_gpio_gate(struct clk_hw *hw);  extern const struct clk_ops clk_gpio_mux_ops;  struct clk *clk_register_gpio_mux(struct device *dev, const char *name, -		const char * const *parent_names, u8 num_parents, unsigned gpio, -		bool active_low, unsigned long flags); +		const char * const *parent_names, u8 num_parents, struct gpio_desc *gpiod, +		unsigned long flags);  struct clk_hw *clk_hw_register_gpio_mux(struct device *dev, const char *name, -		const char * const *parent_names, u8 num_parents, unsigned gpio, -		bool active_low, unsigned long flags); +		const char * const *parent_names, u8 num_parents, struct gpio_desc *gpiod, +		unsigned long flags);  void clk_hw_unregister_gpio_mux(struct clk_hw *hw);  /** @@ -815,7 +815,12 @@ int of_clk_add_hw_provider(struct device_node *np,  			   struct clk_hw *(*get)(struct of_phandle_args *clkspec,  						 void *data),  			   void *data); +int devm_of_clk_add_hw_provider(struct device *dev, +			   struct clk_hw *(*get)(struct of_phandle_args *clkspec, +						 void *data), +			   void *data);  void of_clk_del_provider(struct device_node *np); +void devm_of_clk_del_provider(struct device *dev);  struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,  				  void *data);  struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, @@ -847,7 +852,15 @@ static inline int of_clk_add_hw_provider(struct device_node *np,  {  	return 0;  } +static inline int devm_of_clk_add_hw_provider(struct device *dev, +			   struct clk_hw *(*get)(struct of_phandle_args *clkspec, +						 void *data), +			   void *data) +{ +	return 0; +}  static inline void of_clk_del_provider(struct device_node *np) {} +static inline void devm_of_clk_del_provider(struct device *dev) {}  static inline struct clk *of_clk_src_simple_get(  	struct of_phandle_args *clkspec, void *data)  { diff --git a/include/linux/clk/mmp.h b/include/linux/clk/mmp.h index 607321fa2c2b..445130460380 100644 --- a/include/linux/clk/mmp.h +++ b/include/linux/clk/mmp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __CLK_MMP_H  #define __CLK_MMP_H diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index a116926598fd..8ae9a95ebf5b 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*  linux/include/linux/clockchips.h   *   *  This file contains the structure definitions for clockchips. diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index a78cb1848e65..7dff1963c185 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*  linux/include/linux/clocksource.h   *   *  This file contains the structure definitions for clocksources. diff --git a/include/linux/cm4000_cs.h b/include/linux/cm4000_cs.h index 88bee3a33090..ea4958e07a14 100644 --- a/include/linux/cm4000_cs.h +++ b/include/linux/cm4000_cs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef	_CM4000_H_  #define	_CM4000_H_ diff --git a/include/linux/cma.h b/include/linux/cma.h index 3e8fbf5a5c73..bf90f0bb42bd 100644 --- a/include/linux/cma.h +++ b/include/linux/cma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __CMA_H__  #define __CMA_H__ diff --git a/include/linux/cmdline-parser.h b/include/linux/cmdline-parser.h index 2e6dce6e5c2a..68a541807bdf 100644 --- a/include/linux/cmdline-parser.h +++ b/include/linux/cmdline-parser.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Parsing command line, get the partitions information.   * diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h index 31e4e1f1547c..15170954aa2b 100644 --- a/include/linux/coda_psdev.h +++ b/include/linux/coda_psdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __CODA_PSDEV_H  #define __CODA_PSDEV_H diff --git a/include/linux/compaction.h b/include/linux/compaction.h index 0d8415820fc3..68250a57aace 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_COMPACTION_H  #define _LINUX_COMPACTION_H diff --git a/include/linux/compat.h b/include/linux/compat.h index a5619de3437d..0fc36406f32c 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_COMPAT_H  #define _LINUX_COMPAT_H  /* @@ -443,11 +444,6 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,  	return lhs->tv_nsec - rhs->tv_nsec;  } -extern int get_compat_itimerspec(struct itimerspec *dst, -				 const struct compat_itimerspec __user *src); -extern int put_compat_itimerspec(struct compat_itimerspec __user *dst, -				 const struct itimerspec *src); -  asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,  		struct timezone __user *tz);  asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, @@ -455,8 +451,9 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,  asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); -extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat); -extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set); +extern int get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat); +extern int put_compat_sigset(compat_sigset_t __user *compat, +			     const sigset_t *set, unsigned int size);  asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,  		compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index de179993e039..3b609edffa8f 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -1,4 +1,5 @@ -#ifndef __LINUX_COMPILER_H +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_COMPILER_TYPES_H  #error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."  #endif @@ -15,3 +16,6 @@   * with any version that can compile the kernel   */  #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) + +#define randomized_struct_fields_start	struct { +#define randomized_struct_fields_end	}; diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 16d41de92ee3..2272ded07496 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -1,4 +1,5 @@ -#ifndef __LINUX_COMPILER_H +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_COMPILER_TYPES_H  #error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."  #endif diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h index d4c71132d07f..bfa08160db3a 100644 --- a/include/linux/compiler-intel.h +++ b/include/linux/compiler-intel.h @@ -1,4 +1,5 @@ -#ifndef __LINUX_COMPILER_H +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_COMPILER_TYPES_H  #error "Please don't include <linux/compiler-intel.h> directly, include <linux/compiler.h> instead."  #endif diff --git a/include/linux/compiler.h b/include/linux/compiler.h index e95a2631e545..188ed9f65517 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -1,111 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_COMPILER_H  #define __LINUX_COMPILER_H -#ifndef __ASSEMBLY__ +#include <linux/compiler_types.h> -#ifdef __CHECKER__ -# define __user		__attribute__((noderef, address_space(1))) -# define __kernel	__attribute__((address_space(0))) -# define __safe		__attribute__((safe)) -# define __force	__attribute__((force)) -# define __nocast	__attribute__((nocast)) -# define __iomem	__attribute__((noderef, address_space(2))) -# define __must_hold(x)	__attribute__((context(x,1,1))) -# define __acquires(x)	__attribute__((context(x,0,1))) -# define __releases(x)	__attribute__((context(x,1,0))) -# define __acquire(x)	__context__(x,1) -# define __release(x)	__context__(x,-1) -# define __cond_lock(x,c)	((c) ? ({ __acquire(x); 1; }) : 0) -# define __percpu	__attribute__((noderef, address_space(3))) -# define __rcu		__attribute__((noderef, address_space(4))) -# define __private	__attribute__((noderef)) -extern void __chk_user_ptr(const volatile void __user *); -extern void __chk_io_ptr(const volatile void __iomem *); -# define ACCESS_PRIVATE(p, member) (*((typeof((p)->member) __force *) &(p)->member)) -#else /* __CHECKER__ */ -# ifdef STRUCTLEAK_PLUGIN -#  define __user __attribute__((user)) -# else -#  define __user -# endif -# define __kernel -# define __safe -# define __force -# define __nocast -# define __iomem -# define __chk_user_ptr(x) (void)0 -# define __chk_io_ptr(x) (void)0 -# define __builtin_warning(x, y...) (1) -# define __must_hold(x) -# define __acquires(x) -# define __releases(x) -# define __acquire(x) (void)0 -# define __release(x) (void)0 -# define __cond_lock(x,c) (c) -# define __percpu -# define __rcu -# define __private -# define ACCESS_PRIVATE(p, member) ((p)->member) -#endif /* __CHECKER__ */ - -/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ -#define ___PASTE(a,b) a##b -#define __PASTE(a,b) ___PASTE(a,b) +#ifndef __ASSEMBLY__  #ifdef __KERNEL__ -#ifdef __GNUC__ -#include <linux/compiler-gcc.h> -#endif - -#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) -#define notrace __attribute__((hotpatch(0,0))) -#else -#define notrace __attribute__((no_instrument_function)) -#endif - -/* Intel compiler defines __GNUC__. So we will overwrite implementations - * coming from above header files here - */ -#ifdef __INTEL_COMPILER -# include <linux/compiler-intel.h> -#endif - -/* Clang compiler defines __GNUC__. So we will overwrite implementations - * coming from above header files here - */ -#ifdef __clang__ -#include <linux/compiler-clang.h> -#endif - -/* - * Generic compiler-dependent macros required for kernel - * build go below this comment. Actual compiler/compiler version - * specific implementations come from the above header files - */ - -struct ftrace_branch_data { -	const char *func; -	const char *file; -	unsigned line; -	union { -		struct { -			unsigned long correct; -			unsigned long incorrect; -		}; -		struct { -			unsigned long miss; -			unsigned long hit; -		}; -		unsigned long miss_hit[2]; -	}; -}; - -struct ftrace_likely_data { -	struct ftrace_branch_data	data; -	unsigned long			constant; -}; -  /*   * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code   * to disable branch tracing on a per file basis. @@ -186,17 +88,22 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,  /* Unreachable code */  #ifdef CONFIG_STACK_VALIDATION +/* + * These macros help objtool understand GCC code flow for unreachable code. + * The __COUNTER__ based labels are a hack to make each instance of the macros + * unique, to convince GCC not to merge duplicate inline asm statements. + */  #define annotate_reachable() ({						\ -	asm("%c0:\n\t"							\ -	    ".pushsection .discard.reachable\n\t"			\ -	    ".long %c0b - .\n\t"					\ -	    ".popsection\n\t" : : "i" (__LINE__));			\ +	asm volatile("%c0:\n\t"						\ +		     ".pushsection .discard.reachable\n\t"		\ +		     ".long %c0b - .\n\t"				\ +		     ".popsection\n\t" : : "i" (__COUNTER__));		\  })  #define annotate_unreachable() ({					\ -	asm("%c0:\n\t"							\ -	    ".pushsection .discard.unreachable\n\t"			\ -	    ".long %c0b - .\n\t"					\ -	    ".popsection\n\t" : : "i" (__LINE__));			\ +	asm volatile("%c0:\n\t"						\ +		     ".pushsection .discard.unreachable\n\t"		\ +		     ".long %c0b - .\n\t"				\ +		     ".popsection\n\t" : : "i" (__COUNTER__));		\  })  #define ASM_UNREACHABLE							\  	"999:\n\t"							\ @@ -332,6 +239,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s   * with an explicit memory barrier or atomic instruction that provides the   * required ordering.   */ +#include <asm/barrier.h>  #define __READ_ONCE(x, check)						\  ({									\ @@ -340,6 +248,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s  		__read_once_size(&(x), __u.__c, sizeof(x));		\  	else								\  		__read_once_size_nocheck(&(x), __u.__c, sizeof(x));	\ +	smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \  	__u.__val;							\  })  #define READ_ONCE(x) __READ_ONCE(x, 1) @@ -362,167 +271,6 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s  #endif /* __ASSEMBLY__ */ -#ifdef __KERNEL__ -/* - * Allow us to mark functions as 'deprecated' and have gcc emit a nice - * warning for each use, in hopes of speeding the functions removal. - * Usage is: - * 		int __deprecated foo(void) - */ -#ifndef __deprecated -# define __deprecated		/* unimplemented */ -#endif - -#ifdef MODULE -#define __deprecated_for_modules __deprecated -#else -#define __deprecated_for_modules -#endif - -#ifndef __must_check -#define __must_check -#endif - -#ifndef CONFIG_ENABLE_MUST_CHECK -#undef __must_check -#define __must_check -#endif -#ifndef CONFIG_ENABLE_WARN_DEPRECATED -#undef __deprecated -#undef __deprecated_for_modules -#define __deprecated -#define __deprecated_for_modules -#endif - -#ifndef __malloc -#define __malloc -#endif - -/* - * Allow us to avoid 'defined but not used' warnings on functions and data, - * as well as force them to be emitted to the assembly file. - * - * As of gcc 3.4, static functions that are not marked with attribute((used)) - * may be elided from the assembly file.  As of gcc 3.4, static data not so - * marked will not be elided, but this may change in a future gcc version. - * - * NOTE: Because distributions shipped with a backported unit-at-a-time - * compiler in gcc 3.3, we must define __used to be __attribute__((used)) - * for gcc >=3.3 instead of 3.4. - * - * In prior versions of gcc, such functions and data would be emitted, but - * would be warned about except with attribute((unused)). - * - * Mark functions that are referenced only in inline assembly as __used so - * the code is emitted even though it appears to be unreferenced. - */ -#ifndef __used -# define __used			/* unimplemented */ -#endif - -#ifndef __maybe_unused -# define __maybe_unused		/* unimplemented */ -#endif - -#ifndef __always_unused -# define __always_unused	/* unimplemented */ -#endif - -#ifndef noinline -#define noinline -#endif - -/* - * Rather then using noinline to prevent stack consumption, use - * noinline_for_stack instead.  For documentation reasons. - */ -#define noinline_for_stack noinline - -#ifndef __always_inline -#define __always_inline inline -#endif - -#endif /* __KERNEL__ */ - -/* - * From the GCC manual: - * - * Many functions do not examine any values except their arguments, - * and have no effects except the return value.  Basically this is - * just slightly more strict class than the `pure' attribute above, - * since function is not allowed to read global memory. - * - * Note that a function that has pointer arguments and examines the - * data pointed to must _not_ be declared `const'.  Likewise, a - * function that calls a non-`const' function usually must not be - * `const'.  It does not make sense for a `const' function to return - * `void'. - */ -#ifndef __attribute_const__ -# define __attribute_const__	/* unimplemented */ -#endif - -#ifndef __designated_init -# define __designated_init -#endif - -#ifndef __latent_entropy -# define __latent_entropy -#endif - -#ifndef __randomize_layout -# define __randomize_layout __designated_init -#endif - -#ifndef __no_randomize_layout -# define __no_randomize_layout -#endif - -#ifndef randomized_struct_fields_start -# define randomized_struct_fields_start -# define randomized_struct_fields_end -#endif - -/* - * Tell gcc if a function is cold. The compiler will assume any path - * directly leading to the call is unlikely. - */ - -#ifndef __cold -#define __cold -#endif - -/* Simple shorthand for a section definition */ -#ifndef __section -# define __section(S) __attribute__ ((__section__(#S))) -#endif - -#ifndef __visible -#define __visible -#endif - -#ifndef __nostackprotector -# define __nostackprotector -#endif - -/* - * Assume alignment of return value. - */ -#ifndef __assume_aligned -#define __assume_aligned(a, ...) -#endif - - -/* Are two types/vars the same type (ignoring qualifiers)? */ -#ifndef __same_type -# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) -#endif - -/* Is this type a native word size -- useful for atomic operations */ -#ifndef __native_word -# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) -#endif -  /* Compile time object size, -1 for unknown */  #ifndef __compiletime_object_size  # define __compiletime_object_size(obj) -1 @@ -604,24 +352,4 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s  	(volatile typeof(x) *)&(x); })  #define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) -/** - * lockless_dereference() - safely load a pointer for later dereference - * @p: The pointer to load - * - * Similar to rcu_dereference(), but for situations where the pointed-to - * object's lifetime is managed by something other than RCU.  That - * "something other" might be reference counting or simple immortality. - * - * The seemingly unused variable ___typecheck_p validates that @p is - * indeed a pointer type by using a pointer to typeof(*p) as the type. - * Taking a pointer to typeof(*p) again is needed in case p is void *. - */ -#define lockless_dereference(p) \ -({ \ -	typeof(p) _________p1 = READ_ONCE(p); \ -	typeof(*(p)) *___typecheck_p __maybe_unused; \ -	smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ -	(_________p1); \ -}) -  #endif /* __LINUX_COMPILER_H */ diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h new file mode 100644 index 000000000000..6b79a9bba9a7 --- /dev/null +++ b/include/linux/compiler_types.h @@ -0,0 +1,274 @@ +#ifndef __LINUX_COMPILER_TYPES_H +#define __LINUX_COMPILER_TYPES_H + +#ifndef __ASSEMBLY__ + +#ifdef __CHECKER__ +# define __user		__attribute__((noderef, address_space(1))) +# define __kernel	__attribute__((address_space(0))) +# define __safe		__attribute__((safe)) +# define __force	__attribute__((force)) +# define __nocast	__attribute__((nocast)) +# define __iomem	__attribute__((noderef, address_space(2))) +# define __must_hold(x)	__attribute__((context(x,1,1))) +# define __acquires(x)	__attribute__((context(x,0,1))) +# define __releases(x)	__attribute__((context(x,1,0))) +# define __acquire(x)	__context__(x,1) +# define __release(x)	__context__(x,-1) +# define __cond_lock(x,c)	((c) ? ({ __acquire(x); 1; }) : 0) +# define __percpu	__attribute__((noderef, address_space(3))) +# define __rcu		__attribute__((noderef, address_space(4))) +# define __private	__attribute__((noderef)) +extern void __chk_user_ptr(const volatile void __user *); +extern void __chk_io_ptr(const volatile void __iomem *); +# define ACCESS_PRIVATE(p, member) (*((typeof((p)->member) __force *) &(p)->member)) +#else /* __CHECKER__ */ +# ifdef STRUCTLEAK_PLUGIN +#  define __user __attribute__((user)) +# else +#  define __user +# endif +# define __kernel +# define __safe +# define __force +# define __nocast +# define __iomem +# define __chk_user_ptr(x) (void)0 +# define __chk_io_ptr(x) (void)0 +# define __builtin_warning(x, y...) (1) +# define __must_hold(x) +# define __acquires(x) +# define __releases(x) +# define __acquire(x) (void)0 +# define __release(x) (void)0 +# define __cond_lock(x,c) (c) +# define __percpu +# define __rcu +# define __private +# define ACCESS_PRIVATE(p, member) ((p)->member) +#endif /* __CHECKER__ */ + +/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ +#define ___PASTE(a,b) a##b +#define __PASTE(a,b) ___PASTE(a,b) + +#ifdef __KERNEL__ + +#ifdef __GNUC__ +#include <linux/compiler-gcc.h> +#endif + +#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) +#define notrace __attribute__((hotpatch(0,0))) +#else +#define notrace __attribute__((no_instrument_function)) +#endif + +/* Intel compiler defines __GNUC__. So we will overwrite implementations + * coming from above header files here + */ +#ifdef __INTEL_COMPILER +# include <linux/compiler-intel.h> +#endif + +/* Clang compiler defines __GNUC__. So we will overwrite implementations + * coming from above header files here + */ +#ifdef __clang__ +#include <linux/compiler-clang.h> +#endif + +/* + * Generic compiler-dependent macros required for kernel + * build go below this comment. Actual compiler/compiler version + * specific implementations come from the above header files + */ + +struct ftrace_branch_data { +	const char *func; +	const char *file; +	unsigned line; +	union { +		struct { +			unsigned long correct; +			unsigned long incorrect; +		}; +		struct { +			unsigned long miss; +			unsigned long hit; +		}; +		unsigned long miss_hit[2]; +	}; +}; + +struct ftrace_likely_data { +	struct ftrace_branch_data	data; +	unsigned long			constant; +}; + +#endif /* __KERNEL__ */ + +#endif /* __ASSEMBLY__ */ + +#ifdef __KERNEL__ +/* + * Allow us to mark functions as 'deprecated' and have gcc emit a nice + * warning for each use, in hopes of speeding the functions removal. + * Usage is: + * 		int __deprecated foo(void) + */ +#ifndef __deprecated +# define __deprecated		/* unimplemented */ +#endif + +#ifdef MODULE +#define __deprecated_for_modules __deprecated +#else +#define __deprecated_for_modules +#endif + +#ifndef __must_check +#define __must_check +#endif + +#ifndef CONFIG_ENABLE_MUST_CHECK +#undef __must_check +#define __must_check +#endif +#ifndef CONFIG_ENABLE_WARN_DEPRECATED +#undef __deprecated +#undef __deprecated_for_modules +#define __deprecated +#define __deprecated_for_modules +#endif + +#ifndef __malloc +#define __malloc +#endif + +/* + * Allow us to avoid 'defined but not used' warnings on functions and data, + * as well as force them to be emitted to the assembly file. + * + * As of gcc 3.4, static functions that are not marked with attribute((used)) + * may be elided from the assembly file.  As of gcc 3.4, static data not so + * marked will not be elided, but this may change in a future gcc version. + * + * NOTE: Because distributions shipped with a backported unit-at-a-time + * compiler in gcc 3.3, we must define __used to be __attribute__((used)) + * for gcc >=3.3 instead of 3.4. + * + * In prior versions of gcc, such functions and data would be emitted, but + * would be warned about except with attribute((unused)). + * + * Mark functions that are referenced only in inline assembly as __used so + * the code is emitted even though it appears to be unreferenced. + */ +#ifndef __used +# define __used			/* unimplemented */ +#endif + +#ifndef __maybe_unused +# define __maybe_unused		/* unimplemented */ +#endif + +#ifndef __always_unused +# define __always_unused	/* unimplemented */ +#endif + +#ifndef noinline +#define noinline +#endif + +/* + * Rather then using noinline to prevent stack consumption, use + * noinline_for_stack instead.  For documentation reasons. + */ +#define noinline_for_stack noinline + +#ifndef __always_inline +#define __always_inline inline +#endif + +#endif /* __KERNEL__ */ + +/* + * From the GCC manual: + * + * Many functions do not examine any values except their arguments, + * and have no effects except the return value.  Basically this is + * just slightly more strict class than the `pure' attribute above, + * since function is not allowed to read global memory. + * + * Note that a function that has pointer arguments and examines the + * data pointed to must _not_ be declared `const'.  Likewise, a + * function that calls a non-`const' function usually must not be + * `const'.  It does not make sense for a `const' function to return + * `void'. + */ +#ifndef __attribute_const__ +# define __attribute_const__	/* unimplemented */ +#endif + +#ifndef __designated_init +# define __designated_init +#endif + +#ifndef __latent_entropy +# define __latent_entropy +#endif + +#ifndef __randomize_layout +# define __randomize_layout __designated_init +#endif + +#ifndef __no_randomize_layout +# define __no_randomize_layout +#endif + +#ifndef randomized_struct_fields_start +# define randomized_struct_fields_start +# define randomized_struct_fields_end +#endif + +/* + * Tell gcc if a function is cold. The compiler will assume any path + * directly leading to the call is unlikely. + */ + +#ifndef __cold +#define __cold +#endif + +/* Simple shorthand for a section definition */ +#ifndef __section +# define __section(S) __attribute__ ((__section__(#S))) +#endif + +#ifndef __visible +#define __visible +#endif + +#ifndef __nostackprotector +# define __nostackprotector +#endif + +/* + * Assume alignment of return value. + */ +#ifndef __assume_aligned +#define __assume_aligned(a, ...) +#endif + + +/* Are two types/vars the same type (ignoring qualifiers)? */ +#ifndef __same_type +# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +#endif + +/* Is this type a native word size -- useful for atomic operations */ +#ifndef __native_word +# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) +#endif + +#endif /* __LINUX_COMPILER_TYPES_H */ diff --git a/include/linux/completion.h b/include/linux/completion.h index cae5400022a3..0662a417febe 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_COMPLETION_H  #define __LINUX_COMPLETION_H @@ -49,15 +50,23 @@ static inline void complete_release_commit(struct completion *x)  	lock_commit_crosslock((struct lockdep_map *)&x->map);  } +#define init_completion_map(x, m)					\ +do {									\ +	lockdep_init_map_crosslock((struct lockdep_map *)&(x)->map,	\ +			(m)->name, (m)->key, 0);				\ +	__init_completion(x);						\ +} while (0) +  #define init_completion(x)						\  do {									\  	static struct lock_class_key __key;				\  	lockdep_init_map_crosslock((struct lockdep_map *)&(x)->map,	\ -			"(complete)" #x,				\ +			"(completion)" #x,				\  			&__key, 0);					\  	__init_completion(x);						\  } while (0)  #else +#define init_completion_map(x, m) __init_completion(x)  #define init_completion(x) __init_completion(x)  static inline void complete_acquire(struct completion *x) {}  static inline void complete_release(struct completion *x) {} @@ -67,12 +76,15 @@ static inline void complete_release_commit(struct completion *x) {}  #ifdef CONFIG_LOCKDEP_COMPLETIONS  #define COMPLETION_INITIALIZER(work) \  	{ 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait), \ -	STATIC_CROSS_LOCKDEP_MAP_INIT("(complete)" #work, &(work)) } +	STATIC_CROSS_LOCKDEP_MAP_INIT("(completion)" #work, &(work)) }  #else  #define COMPLETION_INITIALIZER(work) \  	{ 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }  #endif +#define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \ +	(*({ init_completion_map(&(work), &(map)); &(work); })) +  #define COMPLETION_INITIALIZER_ONSTACK(work) \  	(*({ init_completion(&work); &work; })) @@ -102,8 +114,11 @@ static inline void complete_release_commit(struct completion *x) {}  #ifdef CONFIG_LOCKDEP  # define DECLARE_COMPLETION_ONSTACK(work) \  	struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) +# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) \ +	struct completion work = COMPLETION_INITIALIZER_ONSTACK_MAP(work, map)  #else  # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) +# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) DECLARE_COMPLETION(work)  #endif  /** diff --git a/include/linux/component.h b/include/linux/component.h index a559eebc0e0f..e71fbbbc74e2 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef COMPONENT_H  #define COMPONENT_H diff --git a/include/linux/configfs.h b/include/linux/configfs.h index c96709049683..90b90f8baf99 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h @@ -58,7 +58,7 @@ struct config_item {  	struct list_head	ci_entry;  	struct config_item	*ci_parent;  	struct config_group	*ci_group; -	struct config_item_type	*ci_type; +	const struct config_item_type	*ci_type;  	struct dentry		*ci_dentry;  }; @@ -72,7 +72,7 @@ static inline char *config_item_name(struct config_item * item)  extern void config_item_init_type_name(struct config_item *item,  				       const char *name, -				       struct config_item_type *type); +				       const struct config_item_type *type);  extern struct config_item *config_item_get(struct config_item *);  extern struct config_item *config_item_get_unless_zero(struct config_item *); @@ -101,7 +101,7 @@ struct config_group {  extern void config_group_init(struct config_group *group);  extern void config_group_init_type_name(struct config_group *group,  					const char *name, -					struct config_item_type *type); +					const struct config_item_type *type);  static inline struct config_group *to_config_group(struct config_item *item)  { @@ -261,7 +261,7 @@ void configfs_remove_default_groups(struct config_group *group);  struct config_group *  configfs_register_default_group(struct config_group *parent_group,  				const char *name, -				struct config_item_type *item_type); +				const struct config_item_type *item_type);  void configfs_unregister_default_group(struct config_group *group);  /* These functions can sleep and can alloc with GFP_KERNEL */ diff --git a/include/linux/connector.h b/include/linux/connector.h index f8fe8637d771..032102b19645 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h @@ -22,7 +22,7 @@  #define __CONNECTOR_H -#include <linux/atomic.h> +#include <linux/refcount.h>  #include <linux/list.h>  #include <linux/workqueue.h> @@ -49,7 +49,7 @@ struct cn_callback_id {  struct cn_callback_entry {  	struct list_head callback_entry; -	atomic_t refcnt; +	refcount_t refcnt;  	struct cn_queue_dev *pdev;  	struct cn_callback_id id; diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index 6fd3c908a340..c0ec478ea5bf 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * console_struct.h   * diff --git a/include/linux/consolemap.h b/include/linux/consolemap.h index c4811da1338b..254246673390 100644 --- a/include/linux/consolemap.h +++ b/include/linux/consolemap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * consolemap.h   * diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index c78fc27418f2..d05609ad329d 100644 --- a/include/linux/context_tracking.h +++ b/include/linux/context_tracking.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CONTEXT_TRACKING_H  #define _LINUX_CONTEXT_TRACKING_H diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h index 1d34fe68f48a..f128dc3be0df 100644 --- a/include/linux/context_tracking_state.h +++ b/include/linux/context_tracking_state.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CONTEXT_TRACKING_STATE_H  #define _LINUX_CONTEXT_TRACKING_STATE_H diff --git a/include/linux/coredump.h b/include/linux/coredump.h index 28ffa94aed6b..207aed96a5b7 100644 --- a/include/linux/coredump.h +++ b/include/linux/coredump.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_COREDUMP_H  #define _LINUX_COREDUMP_H diff --git a/include/linux/coresight-stm.h b/include/linux/coresight-stm.h index a978bb85599a..74714b59f9d2 100644 --- a/include/linux/coresight-stm.h +++ b/include/linux/coresight-stm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_CORESIGHT_STM_H_  #define __LINUX_CORESIGHT_STM_H_ diff --git a/include/linux/cpu.h b/include/linux/cpu.h index ca73bc1563f4..a04ef7c15c6a 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/cpu.h - generic cpu definition   * @@ -55,27 +56,17 @@ extern void unregister_cpu(struct cpu *cpu);  extern ssize_t arch_cpu_probe(const char *, size_t);  extern ssize_t arch_cpu_release(const char *, size_t);  #endif -struct notifier_block; - -#define CPU_ONLINE		0x0002 /* CPU (unsigned)v is up */ -#define CPU_UP_PREPARE		0x0003 /* CPU (unsigned)v coming up */ -#define CPU_DEAD		0x0007 /* CPU (unsigned)v dead */ -#define CPU_POST_DEAD		0x0009 /* CPU (unsigned)v dead, cpu_hotplug -					* lock is dropped */ -#define CPU_BROKEN		0x000B /* CPU (unsigned)v did not die properly, -					* perhaps due to preemption. */ - -/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend - * operation in progress + +/* + * These states are not related to the core CPU hotplug mechanism. They are + * used by various (sub)architectures to track internal state   */ -#define CPU_TASKS_FROZEN	0x0010 - -#define CPU_ONLINE_FROZEN	(CPU_ONLINE | CPU_TASKS_FROZEN) -#define CPU_UP_PREPARE_FROZEN	(CPU_UP_PREPARE | CPU_TASKS_FROZEN) -#define CPU_UP_CANCELED_FROZEN	(CPU_UP_CANCELED | CPU_TASKS_FROZEN) -#define CPU_DOWN_PREPARE_FROZEN	(CPU_DOWN_PREPARE | CPU_TASKS_FROZEN) -#define CPU_DOWN_FAILED_FROZEN	(CPU_DOWN_FAILED | CPU_TASKS_FROZEN) -#define CPU_DEAD_FROZEN		(CPU_DEAD | CPU_TASKS_FROZEN) +#define CPU_ONLINE		0x0002 /* CPU is up */ +#define CPU_UP_PREPARE		0x0003 /* CPU coming up */ +#define CPU_DEAD		0x0007 /* CPU dead */ +#define CPU_DEAD_FROZEN		0x0008 /* CPU timed out on unplug */ +#define CPU_POST_DEAD		0x0009 /* CPU successfully unplugged */ +#define CPU_BROKEN		0x000B /* CPU did not die properly */  #ifdef CONFIG_SMP  extern bool cpuhp_tasks_frozen; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 537ff842ff73..065f3a8eb486 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -917,8 +917,12 @@ static inline bool policy_has_boost_freq(struct cpufreq_policy *policy)  }  #endif +extern void arch_freq_prepare_all(void);  extern unsigned int arch_freq_get_on_cpu(int cpu); +extern void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, +				unsigned long max_freq); +  /* the following are really really optional */  extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;  extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs; diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 6d508767e144..201ab7267986 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __CPUHOTPLUG_H  #define __CPUHOTPLUG_H @@ -98,6 +99,7 @@ enum cpuhp_state {  	CPUHP_AP_IRQ_HIP04_STARTING,  	CPUHP_AP_IRQ_ARMADA_XP_STARTING,  	CPUHP_AP_IRQ_BCM2836_STARTING, +	CPUHP_AP_IRQ_MIPS_GIC_STARTING,  	CPUHP_AP_ARM_MVEBU_COHERENCY,  	CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,  	CPUHP_AP_PERF_X86_STARTING, @@ -153,6 +155,9 @@ enum cpuhp_state {  	CPUHP_AP_PERF_S390_SF_ONLINE,  	CPUHP_AP_PERF_ARM_CCI_ONLINE,  	CPUHP_AP_PERF_ARM_CCN_ONLINE, +	CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE, +	CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE, +	CPUHP_AP_PERF_ARM_HISI_L3_ONLINE,  	CPUHP_AP_PERF_ARM_L2X0_ONLINE,  	CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE,  	CPUHP_AP_PERF_ARM_QCOM_L3_ONLINE, diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index cd415b733c2a..75b565194437 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_CPUMASK_H  #define __LINUX_CPUMASK_H @@ -130,6 +131,11 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)  	return 0;  } +static inline unsigned int cpumask_last(const struct cpumask *srcp) +{ +	return 0; +} +  /* Valid inputs for n are -1 and 0. */  static inline unsigned int cpumask_next(int n, const struct cpumask *srcp)  { @@ -178,6 +184,17 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)  	return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits);  } +/** + * cpumask_last - get the last CPU in a cpumask + * @srcp:	- the cpumask pointer + * + * Returns	>= nr_cpumask_bits if no CPUs set. + */ +static inline unsigned int cpumask_last(const struct cpumask *srcp) +{ +	return find_last_bit(cpumask_bits(srcp), nr_cpumask_bits); +} +  unsigned int cpumask_next(int n, const struct cpumask *srcp);  /** diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index a1e6a33a4b03..1b8e41597ef5 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CPUSET_H  #define _LINUX_CPUSET_H  /* diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index 2df2118fbe13..06097ef30449 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_CRASH_CORE_H  #define LINUX_CRASH_CORE_H diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index 3873697ba21c..a992e6ca2f1c 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_CRASH_DUMP_H  #define LINUX_CRASH_DUMP_H diff --git a/include/linux/crc-ccitt.h b/include/linux/crc-ccitt.h index f52696a1ff0d..cd4f420231ba 100644 --- a/include/linux/crc-ccitt.h +++ b/include/linux/crc-ccitt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CRC_CCITT_H  #define _LINUX_CRC_CCITT_H diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h index d81961e9e37d..1fe0cfcdea30 100644 --- a/include/linux/crc-t10dif.h +++ b/include/linux/crc-t10dif.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CRC_T10DIF_H  #define _LINUX_CRC_T10DIF_H diff --git a/include/linux/crc32c.h b/include/linux/crc32c.h index bd8b44d96bdc..357ae4611a45 100644 --- a/include/linux/crc32c.h +++ b/include/linux/crc32c.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CRC32C_H  #define _LINUX_CRC32C_H diff --git a/include/linux/crc4.h b/include/linux/crc4.h index 8f739f1d794f..bd2c90556a06 100644 --- a/include/linux/crc4.h +++ b/include/linux/crc4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CRC4_H  #define _LINUX_CRC4_H diff --git a/include/linux/crc7.h b/include/linux/crc7.h index d590765106f3..b462842f3c32 100644 --- a/include/linux/crc7.h +++ b/include/linux/crc7.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CRC7_H  #define _LINUX_CRC7_H  #include <linux/types.h> diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h index 07eed95e10c7..54741295c70b 100644 --- a/include/linux/crush/crush.h +++ b/include/linux/crush/crush.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef CEPH_CRUSH_CRUSH_H  #define CEPH_CRUSH_CRUSH_H diff --git a/include/linux/crush/hash.h b/include/linux/crush/hash.h index d1d90258242e..904df41f7847 100644 --- a/include/linux/crush/hash.h +++ b/include/linux/crush/hash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef CEPH_CRUSH_HASH_H  #define CEPH_CRUSH_HASH_H diff --git a/include/linux/crush/mapper.h b/include/linux/crush/mapper.h index 141edabb947e..f9b99232f5a1 100644 --- a/include/linux/crush/mapper.h +++ b/include/linux/crush/mapper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef CEPH_CRUSH_MAPPER_H  #define CEPH_CRUSH_MAPPER_H diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 84da9978e951..78508ca4b108 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -24,6 +24,7 @@  #include <linux/slab.h>  #include <linux/string.h>  #include <linux/uaccess.h> +#include <linux/completion.h>  /*   * Autoloaded crypto modules should only use a prefixed name to avoid allowing @@ -468,6 +469,45 @@ struct crypto_alg {  } CRYPTO_MINALIGN_ATTR;  /* + * A helper struct for waiting for completion of async crypto ops + */ +struct crypto_wait { +	struct completion completion; +	int err; +}; + +/* + * Macro for declaring a crypto op async wait object on stack + */ +#define DECLARE_CRYPTO_WAIT(_wait) \ +	struct crypto_wait _wait = { \ +		COMPLETION_INITIALIZER_ONSTACK((_wait).completion), 0 } + +/* + * Async ops completion helper functioons + */ +void crypto_req_done(struct crypto_async_request *req, int err); + +static inline int crypto_wait_req(int err, struct crypto_wait *wait) +{ +	switch (err) { +	case -EINPROGRESS: +	case -EBUSY: +		wait_for_completion(&wait->completion); +		reinit_completion(&wait->completion); +		err = wait->err; +		break; +	}; + +	return err; +} + +static inline void crypto_init_wait(struct crypto_wait *wait) +{ +	init_completion(&wait->completion); +} + +/*   * Algorithm registration interface.   */  int crypto_register_alg(struct crypto_alg *alg); diff --git a/include/linux/cryptohash.h b/include/linux/cryptohash.h index df4d3e943d28..f6ba4c3e60d7 100644 --- a/include/linux/cryptohash.h +++ b/include/linux/cryptohash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __CRYPTOHASH_H  #define __CRYPTOHASH_H diff --git a/include/linux/ctype.h b/include/linux/ctype.h index f13e4ff6835a..363b004426db 100644 --- a/include/linux/ctype.h +++ b/include/linux/ctype.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CTYPE_H  #define _LINUX_CTYPE_H diff --git a/include/linux/cuda.h b/include/linux/cuda.h index b72332823807..056867f09a01 100644 --- a/include/linux/cuda.h +++ b/include/linux/cuda.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Definitions for talking to the CUDA.  The CUDA is a microcontroller   * which controls the ADB, system power, RTC, and various other things. diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h index 19ae518f5471..05ee0f19448a 100644 --- a/include/linux/cyclades.h +++ b/include/linux/cyclades.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $   * linux/include/linux/cyclades.h   * @@ -156,6 +157,9 @@ struct cyclades_port {  	struct cyclades_icount	icount;  	struct completion       shutdown_wait;  	int throttle; +#ifdef CONFIG_CYZ_INTR +	struct timer_list	rx_full_timer; +#endif  };  #define	CLOSING_WAIT_DELAY	30*HZ diff --git a/include/linux/dax.h b/include/linux/dax.h index 122197124b9d..5258346c558c 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DAX_H  #define _LINUX_DAX_H @@ -95,7 +96,9 @@ bool dax_write_cache_enabled(struct dax_device *dax_dev);  ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,  		const struct iomap_ops *ops);  int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size, -		    const struct iomap_ops *ops); +		    pfn_t *pfnp, const struct iomap_ops *ops); +int dax_finish_sync_fault(struct vm_fault *vmf, enum page_entry_size pe_size, +			  pfn_t pfn);  int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);  int dax_invalidate_mapping_entry_sync(struct address_space *mapping,  				      pgoff_t index); diff --git a/include/linux/dcache.h b/include/linux/dcache.h index ed1a7cf6923a..65cd8ab60b7a 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_DCACHE_H  #define __LINUX_DCACHE_H @@ -519,7 +520,7 @@ static inline struct inode *d_inode(const struct dentry *dentry)  }  /** - * d_inode_rcu - Get the actual inode of this dentry with ACCESS_ONCE() + * d_inode_rcu - Get the actual inode of this dentry with READ_ONCE()   * @dentry: The dentry to query   *   * This is the helper normal filesystems should use to get at their own inodes @@ -527,7 +528,7 @@ static inline struct inode *d_inode(const struct dentry *dentry)   */  static inline struct inode *d_inode_rcu(const struct dentry *dentry)  { -	return ACCESS_ONCE(dentry->d_inode); +	return READ_ONCE(dentry->d_inode);  }  /** diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 68449293c4b6..6b64b6cc2175 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DCCP_H  #define _LINUX_DCCP_H diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h index 699b6c499c4f..ddfdac20cad0 100644 --- a/include/linux/dcookies.h +++ b/include/linux/dcookies.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * dcookies.h   * diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 822c1354f3a6..120225e9a366 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_DEBUG_LOCKING_H  #define __LINUX_DEBUG_LOCKING_H diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index b93efc8feecd..f36ecc2a5712 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0  /*   *  debugfs.h - a tiny little debug file system   *   *  Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>   *  Copyright (C) 2004 IBM Inc.   * - *	This program is free software; you can redistribute it and/or - *	modify it under the terms of the GNU General Public License version - *	2 as published by the Free Software Foundation. - *   *  debugfs is for people to use instead of /proc or /sys.   *  See Documentation/filesystems/ for more details.   */ @@ -23,7 +20,6 @@  struct device;  struct file_operations; -struct srcu_struct;  struct debugfs_blob_wrapper {  	void *data; @@ -43,25 +39,6 @@ struct debugfs_regset32 {  extern struct dentry *arch_debugfs_dir; -extern struct srcu_struct debugfs_srcu; - -/** - * debugfs_real_fops - getter for the real file operation - * @filp: a pointer to a struct file - * - * Must only be called under the protection established by - * debugfs_use_file_start(). - */ -static inline const struct file_operations *debugfs_real_fops(const struct file *filp) -	__must_hold(&debugfs_srcu) -{ -	/* -	 * Neither the pointer to the struct file_operations, nor its -	 * contents ever change -- srcu_dereference() is not needed here. -	 */ -	return filp->f_path.dentry->d_fsdata; -} -  #define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt)		\  static int __fops ## _open(struct inode *inode, struct file *file)	\  {									\ @@ -107,10 +84,10 @@ struct dentry *debugfs_create_automount(const char *name,  void debugfs_remove(struct dentry *dentry);  void debugfs_remove_recursive(struct dentry *dentry); -int debugfs_use_file_start(const struct dentry *dentry, int *srcu_idx) -	__acquires(&debugfs_srcu); +const struct file_operations *debugfs_real_fops(const struct file *filp); -void debugfs_use_file_finish(int srcu_idx) __releases(&debugfs_srcu); +int debugfs_file_get(struct dentry *dentry); +void debugfs_file_put(struct dentry *dentry);  ssize_t debugfs_attr_read(struct file *file, char __user *buf,  			size_t len, loff_t *ppos); @@ -239,15 +216,12 @@ static inline void debugfs_remove(struct dentry *dentry)  static inline void debugfs_remove_recursive(struct dentry *dentry)  { } -static inline int debugfs_use_file_start(const struct dentry *dentry, -					int *srcu_idx) -	__acquires(&debugfs_srcu) +static inline int debugfs_file_get(struct dentry *dentry)  {  	return 0;  } -static inline void debugfs_use_file_finish(int srcu_idx) -	__releases(&debugfs_srcu) +static inline void debugfs_file_put(struct dentry *dentry)  { }  static inline ssize_t debugfs_attr_read(struct file *file, char __user *buf, diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h index d82bf1994485..afc416e5dcab 100644 --- a/include/linux/debugobjects.h +++ b/include/linux/debugobjects.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DEBUGOBJECTS_H  #define _LINUX_DEBUGOBJECTS_H diff --git a/include/linux/decompress/bunzip2.h b/include/linux/decompress/bunzip2.h index 4d683df898e6..5860163942a4 100644 --- a/include/linux/decompress/bunzip2.h +++ b/include/linux/decompress/bunzip2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DECOMPRESS_BUNZIP2_H  #define DECOMPRESS_BUNZIP2_H diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h index 1fcfd64b5076..207d80138db5 100644 --- a/include/linux/decompress/generic.h +++ b/include/linux/decompress/generic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DECOMPRESS_GENERIC_H  #define DECOMPRESS_GENERIC_H diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h index e4f411fdbd24..b65f24e7d442 100644 --- a/include/linux/decompress/inflate.h +++ b/include/linux/decompress/inflate.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_DECOMPRESS_INFLATE_H  #define LINUX_DECOMPRESS_INFLATE_H diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h index 7925bf0ee836..868e9eacd69e 100644 --- a/include/linux/decompress/mm.h +++ b/include/linux/decompress/mm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/compr_mm.h   * diff --git a/include/linux/decompress/unlz4.h b/include/linux/decompress/unlz4.h index 3273c2f36496..5a235f605d5f 100644 --- a/include/linux/decompress/unlz4.h +++ b/include/linux/decompress/unlz4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DECOMPRESS_UNLZ4_H  #define DECOMPRESS_UNLZ4_H diff --git a/include/linux/decompress/unlzma.h b/include/linux/decompress/unlzma.h index 8a891a193840..1c930f125182 100644 --- a/include/linux/decompress/unlzma.h +++ b/include/linux/decompress/unlzma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DECOMPRESS_UNLZMA_H  #define DECOMPRESS_UNLZMA_H diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h index af18f95d6570..550ae8783d1b 100644 --- a/include/linux/decompress/unlzo.h +++ b/include/linux/decompress/unlzo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DECOMPRESS_UNLZO_H  #define DECOMPRESS_UNLZO_H diff --git a/include/linux/delay.h b/include/linux/delay.h index 2ecb3c46b20a..b78bab4395d8 100644 --- a/include/linux/delay.h +++ b/include/linux/delay.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DELAY_H  #define _LINUX_DELAY_H diff --git a/include/linux/delayed_call.h b/include/linux/delayed_call.h index f7fa76ae1a9b..a26c3b95b5cf 100644 --- a/include/linux/delayed_call.h +++ b/include/linux/delayed_call.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DELAYED_CALL_H  #define _DELAYED_CALL_H diff --git a/include/linux/dell-led.h b/include/linux/dell-led.h index 3f033c48071e..92521471517f 100644 --- a/include/linux/dell-led.h +++ b/include/linux/dell-led.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DELL_LED_H__  #define __DELL_LED_H__ diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 597294e0cc40..3aae5b3af87c 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -19,6 +19,13 @@  #define DEVFREQ_NAME_LEN 16 +/* DEVFREQ governor name */ +#define DEVFREQ_GOV_SIMPLE_ONDEMAND	"simple_ondemand" +#define DEVFREQ_GOV_PERFORMANCE		"performance" +#define DEVFREQ_GOV_POWERSAVE		"powersave" +#define DEVFREQ_GOV_USERSPACE		"userspace" +#define DEVFREQ_GOV_PASSIVE		"passive" +  /* DEVFREQ notifier interface */  #define DEVFREQ_TRANSITION_NOTIFIER	(0) @@ -84,8 +91,9 @@ struct devfreq_dev_status {   *			from devfreq_remove_device() call. If the user   *			has registered devfreq->nb at a notifier-head,   *			this is the time to unregister it. - * @freq_table:	Optional list of frequencies to support statistics. - * @max_state:	The size of freq_table. + * @freq_table:		Optional list of frequencies to support statistics + *			and freq_table must be generated in ascending order. + * @max_state:		The size of freq_table.   */  struct devfreq_dev_profile {  	unsigned long initial_freq; @@ -120,6 +128,8 @@ struct devfreq_dev_profile {   *		touch this.   * @min_freq:	Limit minimum frequency requested by user (0: none)   * @max_freq:	Limit maximum frequency requested by user (0: none) + * @scaling_min_freq:	Limit minimum frequency requested by OPP interface + * @scaling_max_freq:	Limit maximum frequency requested by OPP interface   * @stop_polling:	 devfreq polling status of a device.   * @total_trans:	Number of devfreq transitions   * @trans_table:	Statistics of devfreq transitions @@ -153,6 +163,8 @@ struct devfreq {  	unsigned long min_freq;  	unsigned long max_freq; +	unsigned long scaling_min_freq; +	unsigned long scaling_max_freq;  	bool stop_polling;  	/* information for device frequency transition */ diff --git a/include/linux/device.h b/include/linux/device.h index 66fe271c2544..9d32000725da 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -97,6 +97,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);   * @p:		The private data of the driver core, only the driver core can   *		touch this.   * @lock_key:	Lock class key for use by the lock validator + * @force_dma:	Assume devices on this bus should be set up by dma_configure() + * 		even if DMA capability is not explicitly described by firmware.   *   * A bus is a channel between the processor and one or more devices. For the   * purposes of the device model, all devices are connected via a bus, even if @@ -135,6 +137,8 @@ struct bus_type {  	struct subsys_private *p;  	struct lock_class_key lock_key; + +	bool force_dma;  };  extern int __must_check bus_register(struct bus_type *bus); @@ -370,9 +374,6 @@ int subsys_virtual_register(struct bus_type *subsys,   * @devnode:	Callback to provide the devtmpfs.   * @class_release: Called to release this class.   * @dev_release: Called to release the device. - * @suspend:	Used to put the device to sleep mode, usually to a low power - *		state. - * @resume:	Used to bring the device from the sleep mode.   * @shutdown_pre: Called at shut-down time before driver shutdown.   * @ns_type:	Callbacks so sysfs can detemine namespaces.   * @namespace:	Namespace of the device belongs to this class. @@ -400,8 +401,6 @@ struct class {  	void (*class_release)(struct class *class);  	void (*dev_release)(struct device *dev); -	int (*suspend)(struct device *dev, pm_message_t state); -	int (*resume)(struct device *dev);  	int (*shutdown_pre)(struct device *dev);  	const struct kobj_ns_type_operations *ns_type; @@ -1075,6 +1074,16 @@ static inline void dev_pm_syscore_device(struct device *dev, bool val)  #endif  } +static inline void dev_pm_set_driver_flags(struct device *dev, u32 flags) +{ +	dev->power.driver_flags = flags; +} + +static inline bool dev_pm_test_driver_flags(struct device *dev, u32 flags) +{ +	return !!(dev->power.driver_flags & flags); +} +  static inline void device_lock(struct device *dev)  {  	mutex_lock(&dev->mutex); diff --git a/include/linux/device_cgroup.h b/include/linux/device_cgroup.h index 8b64221b432b..8557efe096dc 100644 --- a/include/linux/device_cgroup.h +++ b/include/linux/device_cgroup.h @@ -1,16 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <linux/fs.h> +#include <linux/bpf-cgroup.h> + +#define DEVCG_ACC_MKNOD 1 +#define DEVCG_ACC_READ  2 +#define DEVCG_ACC_WRITE 4 +#define DEVCG_ACC_MASK (DEVCG_ACC_MKNOD | DEVCG_ACC_READ | DEVCG_ACC_WRITE) + +#define DEVCG_DEV_BLOCK 1 +#define DEVCG_DEV_CHAR  2 +#define DEVCG_DEV_ALL   4  /* this represents all devices */  #ifdef CONFIG_CGROUP_DEVICE -extern int __devcgroup_inode_permission(struct inode *inode, int mask); -extern int devcgroup_inode_mknod(int mode, dev_t dev); +extern int __devcgroup_check_permission(short type, u32 major, u32 minor, +					short access); +#else +static inline int __devcgroup_check_permission(short type, u32 major, u32 minor, +					       short access) +{ return 0; } +#endif + +#if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF) +static inline int devcgroup_check_permission(short type, u32 major, u32 minor, +					     short access) +{ +	int rc = BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type, major, minor, access); + +	if (rc) +		return -EPERM; + +	return __devcgroup_check_permission(type, major, minor, access); +} +  static inline int devcgroup_inode_permission(struct inode *inode, int mask)  { +	short type, access = 0; +  	if (likely(!inode->i_rdev))  		return 0; -	if (!S_ISBLK(inode->i_mode) && !S_ISCHR(inode->i_mode)) + +	if (S_ISBLK(inode->i_mode)) +		type = DEVCG_DEV_BLOCK; +	else if (S_ISCHR(inode->i_mode)) +		type = DEVCG_DEV_CHAR; +	else +		return 0; + +	if (mask & MAY_WRITE) +		access |= DEVCG_ACC_WRITE; +	if (mask & MAY_READ) +		access |= DEVCG_ACC_READ; + +	return devcgroup_check_permission(type, imajor(inode), iminor(inode), +					  access); +} + +static inline int devcgroup_inode_mknod(int mode, dev_t dev) +{ +	short type; + +	if (!S_ISBLK(mode) && !S_ISCHR(mode))  		return 0; -	return __devcgroup_inode_permission(inode, mask); + +	if (S_ISBLK(mode)) +		type = DEVCG_DEV_BLOCK; +	else +		type = DEVCG_DEV_CHAR; + +	return devcgroup_check_permission(type, MAJOR(dev), MINOR(dev), +					  DEVCG_ACC_MKNOD);  } +  #else  static inline int devcgroup_inode_permission(struct inode *inode, int mask)  { return 0; } diff --git a/include/linux/dio.h b/include/linux/dio.h index 2cc0fd00463f..1470d1d943b4 100644 --- a/include/linux/dio.h +++ b/include/linux/dio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* header file for DIO boards for the HP300 architecture.   * Maybe this should handle DIO-II later?   * The general structure of this is vaguely based on how diff --git a/include/linux/dirent.h b/include/linux/dirent.h index f072fb8d10a3..fc61f3cff72f 100644 --- a/include/linux/dirent.h +++ b/include/linux/dirent.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DIRENT_H  #define _LINUX_DIRENT_H diff --git a/include/linux/dma-direction.h b/include/linux/dma-direction.h index 95b6a82f5951..3649a031893a 100644 --- a/include/linux/dma-direction.h +++ b/include/linux/dma-direction.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DMA_DIRECTION_H  #define _LINUX_DMA_DIRECTION_H  /* diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index 171895072435..efdabbb64e3c 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h @@ -128,7 +128,7 @@ struct dma_fence_cb {   * implementation know that there is another driver waiting on   * the signal (ie. hw->sw case).   * - * This function can be called called from atomic context, but not + * This function can be called from atomic context, but not   * from irq context, so normal spinlocks can be used.   *   * A return value of false indicates the fence already passed, @@ -248,9 +248,12 @@ dma_fence_get_rcu_safe(struct dma_fence * __rcu *fencep)  		struct dma_fence *fence;  		fence = rcu_dereference(*fencep); -		if (!fence || !dma_fence_get_rcu(fence)) +		if (!fence)  			return NULL; +		if (!dma_fence_get_rcu(fence)) +			continue; +  		/* The atomic_inc_not_zero() inside dma_fence_get_rcu()  		 * provides a full memory barrier upon success (such as now).  		 * This is paired with the write barrier from assigning diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 29ce9815da87..e8f8e8fb244d 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DMA_MAPPING_H  #define _LINUX_DMA_MAPPING_H @@ -8,7 +9,6 @@  #include <linux/dma-debug.h>  #include <linux/dma-direction.h>  #include <linux/scatterlist.h> -#include <linux/kmemcheck.h>  #include <linux/bug.h>  #include <linux/mem_encrypt.h> @@ -126,6 +126,8 @@ struct dma_map_ops {  	void (*sync_sg_for_device)(struct device *dev,  				   struct scatterlist *sg, int nents,  				   enum dma_data_direction dir); +	void (*cache_sync)(struct device *dev, void *vaddr, size_t size, +			enum dma_data_direction direction);  	int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);  	int (*dma_supported)(struct device *dev, u64 mask);  #ifdef ARCH_HAS_DMA_GET_REQUIRED_MASK @@ -229,7 +231,6 @@ static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,  	const struct dma_map_ops *ops = get_dma_ops(dev);  	dma_addr_t addr; -	kmemcheck_mark_initialized(ptr, size);  	BUG_ON(!valid_dma_direction(dir));  	addr = ops->map_page(dev, virt_to_page(ptr),  			     offset_in_page(ptr), size, @@ -262,11 +263,8 @@ static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,  				   unsigned long attrs)  {  	const struct dma_map_ops *ops = get_dma_ops(dev); -	int i, ents; -	struct scatterlist *s; +	int ents; -	for_each_sg(sg, s, nents, i) -		kmemcheck_mark_initialized(sg_virt(s), s->length);  	BUG_ON(!valid_dma_direction(dir));  	ents = ops->map_sg(dev, sg, nents, dir, attrs);  	BUG_ON(ents < 0); @@ -296,7 +294,6 @@ static inline dma_addr_t dma_map_page_attrs(struct device *dev,  	const struct dma_map_ops *ops = get_dma_ops(dev);  	dma_addr_t addr; -	kmemcheck_mark_initialized(page_address(page) + offset, size);  	BUG_ON(!valid_dma_direction(dir));  	addr = ops->map_page(dev, page, offset, size, dir, attrs);  	debug_dma_map_page(dev, page, offset, size, dir, addr, false); @@ -436,6 +433,17 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,  #define dma_map_page(d, p, o, s, r) dma_map_page_attrs(d, p, o, s, r, 0)  #define dma_unmap_page(d, a, s, r) dma_unmap_page_attrs(d, a, s, r, 0) +static inline void +dma_cache_sync(struct device *dev, void *vaddr, size_t size, +		enum dma_data_direction dir) +{ +	const struct dma_map_ops *ops = get_dma_ops(dev); + +	BUG_ON(!valid_dma_direction(dir)); +	if (ops->cache_sync) +		ops->cache_sync(dev, vaddr, size, dir); +} +  extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,  			   void *cpu_addr, dma_addr_t dma_addr, size_t size); diff --git a/include/linux/dma/mmp-pdma.h b/include/linux/dma/mmp-pdma.h index 2dc9b2bc18fc..25cab62a28c4 100644 --- a/include/linux/dma/mmp-pdma.h +++ b/include/linux/dma/mmp-pdma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _MMP_PDMA_H_  #define _MMP_PDMA_H_ diff --git a/include/linux/dma/pxa-dma.h b/include/linux/dma/pxa-dma.h index 3edc99294bf6..e56ec7af4fd7 100644 --- a/include/linux/dma/pxa-dma.h +++ b/include/linux/dma/pxa-dma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _PXA_DMA_H_  #define _PXA_DMA_H_ diff --git a/include/linux/dma/xilinx_dma.h b/include/linux/dma/xilinx_dma.h index 3ae300052553..34b98f276ed0 100644 --- a/include/linux/dma/xilinx_dma.h +++ b/include/linux/dma/xilinx_dma.h @@ -41,20 +41,6 @@ struct xilinx_vdma_config {  	int ext_fsync;  }; -/** - * enum xdma_ip_type: DMA IP type. - * - * XDMA_TYPE_AXIDMA: Axi dma ip. - * XDMA_TYPE_CDMA: Axi cdma ip. - * XDMA_TYPE_VDMA: Axi vdma ip. - * - */ -enum xdma_ip_type { -	XDMA_TYPE_AXIDMA = 0, -	XDMA_TYPE_CDMA, -	XDMA_TYPE_VDMA, -}; -  int xilinx_vdma_channel_set_config(struct dma_chan *dchan,  					struct xilinx_vdma_config *cfg); diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h index 90884072fa73..21b3e7d33d68 100644 --- a/include/linux/dma_remapping.h +++ b/include/linux/dma_remapping.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DMA_REMAPPING_H  #define _DMA_REMAPPING_H diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 8319101170fc..f838764993eb 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -329,7 +329,7 @@ enum dma_slave_buswidth {   * @src_addr_width: this is the width in bytes of the source (RX)   * register where DMA data shall be read. If the source   * is memory this may be ignored depending on architecture. - * Legal values: 1, 2, 4, 8. + * Legal values: 1, 2, 3, 4, 8, 16, 32, 64.   * @dst_addr_width: same as src_addr_width but for destination   * target (TX) mutatis mutandis.   * @src_maxburst: the maximum number of words (note: words, as in @@ -404,14 +404,16 @@ enum dma_residue_granularity {  	DMA_RESIDUE_GRANULARITY_BURST = 2,  }; -/* struct dma_slave_caps - expose capabilities of a slave channel only - * - * @src_addr_widths: bit mask of src addr widths the channel supports - * @dst_addr_widths: bit mask of dstn addr widths the channel supports - * @directions: bit mask of slave direction the channel supported - * 	since the enum dma_transfer_direction is not defined as bits for each - * 	type of direction, the dma controller should fill (1 << <TYPE>) and same - * 	should be checked by controller as well +/** + * struct dma_slave_caps - expose capabilities of a slave channel only + * @src_addr_widths: bit mask of src addr widths the channel supports. + *	Width is specified in bytes, e.g. for a channel supporting + *	a width of 4 the mask should have BIT(4) set. + * @dst_addr_widths: bit mask of dst addr widths the channel supports + * @directions: bit mask of slave directions the channel supports. + *	Since the enum dma_transfer_direction is not defined as bit flag for + *	each type, the dma controller should set BIT(<TYPE>) and same + *	should be checked by controller as well   * @max_burst: max burst capability per-transfer   * @cmd_pause: true, if pause and thereby resume is supported   * @cmd_terminate: true, if terminate cmd is supported @@ -678,11 +680,13 @@ struct dma_filter {   * @dev_id: unique device ID   * @dev: struct device reference for dma mapping api   * @src_addr_widths: bit mask of src addr widths the device supports + *	Width is specified in bytes, e.g. for a device supporting + *	a width of 4 the mask should have BIT(4) set.   * @dst_addr_widths: bit mask of dst addr widths the device supports - * @directions: bit mask of slave direction the device supports since - * 	the enum dma_transfer_direction is not defined as bits for - * 	each type of direction, the dma controller should fill (1 << - * 	<TYPE>) and same should be checked by controller as well + * @directions: bit mask of slave directions the device supports. + *	Since the enum dma_transfer_direction is not defined as bit flag for + *	each type, the dma controller should set BIT(<TYPE>) and same + *	should be checked by controller as well   * @max_burst: max burst capability per-transfer   * @residue_granularity: granularity of the transfer residue reported   *	by tx_status diff --git a/include/linux/dmar.h b/include/linux/dmar.h index e8ffba1052d3..e2433bc50210 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h @@ -112,6 +112,7 @@ static inline bool dmar_rcu_check(void)  extern int dmar_table_init(void);  extern int dmar_dev_scope_init(void); +extern void dmar_register_bus_notifier(void);  extern int dmar_parse_dev_scope(void *start, void *end, int *cnt,  				struct dmar_dev_scope **devices, u16 segment);  extern void *dmar_alloc_dev_scope(void *start, void *end, int *cnt); diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 9bbf21a516e4..46e151172d95 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __DMI_H__  #define __DMI_H__ diff --git a/include/linux/dnotify.h b/include/linux/dnotify.h index 3290555a52ee..0aad774beaec 100644 --- a/include/linux/dnotify.h +++ b/include/linux/dnotify.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DNOTIFY_H  #define _LINUX_DNOTIFY_H  /* diff --git a/include/linux/dqblk_qtree.h b/include/linux/dqblk_qtree.h index 0de21e935976..100d22a46b82 100644 --- a/include/linux/dqblk_qtree.h +++ b/include/linux/dqblk_qtree.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Definitions of structures and functions for quota formats using trie   */ diff --git a/include/linux/dqblk_v1.h b/include/linux/dqblk_v1.h index c0d4d1e2a45c..85d837a14838 100644 --- a/include/linux/dqblk_v1.h +++ b/include/linux/dqblk_v1.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	File with in-memory structures of old quota format   */ diff --git a/include/linux/dqblk_v2.h b/include/linux/dqblk_v2.h index 18000a542677..da95932ad9e7 100644 --- a/include/linux/dqblk_v2.h +++ b/include/linux/dqblk_v2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  Definitions for vfsv0 quota format   */ diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h index 4e6d4d4c7056..53f44b8cd75f 100644 --- a/include/linux/drbd_genl.h +++ b/include/linux/drbd_genl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * General overview:   * full generic netlink message: diff --git a/include/linux/drbd_genl_api.h b/include/linux/drbd_genl_api.h index 9ef50d51e34e..bd62efc29002 100644 --- a/include/linux/drbd_genl_api.h +++ b/include/linux/drbd_genl_api.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef DRBD_GENL_STRUCT_H  #define DRBD_GENL_STRUCT_H diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h index 24ae1b9b76c7..9e33f7038bea 100644 --- a/include/linux/drbd_limits.h +++ b/include/linux/drbd_limits.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*    drbd_limits.h    This file is part of DRBD by Philipp Reisner and Lars Ellenberg. diff --git a/include/linux/ds2782_battery.h b/include/linux/ds2782_battery.h index b4e281f65c15..fb6c97e10956 100644 --- a/include/linux/ds2782_battery.h +++ b/include/linux/ds2782_battery.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_DS2782_BATTERY_H  #define __LINUX_DS2782_BATTERY_H diff --git a/include/linux/dsa/lan9303.h b/include/linux/dsa/lan9303.h new file mode 100644 index 000000000000..f48a85c377de --- /dev/null +++ b/include/linux/dsa/lan9303.h @@ -0,0 +1,38 @@ +/* Included by drivers/net/dsa/lan9303.h and net/dsa/tag_lan9303.c */ +#include <linux/if_ether.h> + +struct lan9303; + +struct lan9303_phy_ops { +	/* PHY 1 and 2 access*/ +	int	(*phy_read)(struct lan9303 *chip, int port, int regnum); +	int	(*phy_write)(struct lan9303 *chip, int port, +			     int regnum, u16 val); +}; + +#define LAN9303_NUM_ALR_RECORDS 512 +struct lan9303_alr_cache_entry { +	u8  mac_addr[ETH_ALEN]; +	u8  port_map;         /* Bitmap of ports. Zero if unused entry */ +	u8  stp_override;     /* non zero if set LAN9303_ALR_DAT1_AGE_OVERRID */ +}; + +struct lan9303 { +	struct device *dev; +	struct regmap *regmap; +	struct regmap_irq_chip_data *irq_data; +	struct gpio_desc *reset_gpio; +	u32 reset_duration; /* in [ms] */ +	bool phy_addr_sel_strap; +	struct dsa_switch *ds; +	struct mutex indirect_mutex; /* protect indexed register access */ +	const struct lan9303_phy_ops *ops; +	bool is_bridged; /* true if port 1 and 2 are bridged */ + +	/* remember LAN9303_SWE_PORT_STATE while not bridged */ +	u32 swe_port_state; +	/* LAN9303 do not offer reading specific ALR entry. Cache all +	 * static entries in a flat table +	 **/ +	struct lan9303_alr_cache_entry alr_cache[LAN9303_NUM_ALR_RECORDS]; +}; diff --git a/include/linux/dtlk.h b/include/linux/dtlk.h index 22a7b9a5f5d1..27b95e70bde3 100644 --- a/include/linux/dtlk.h +++ b/include/linux/dtlk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #define DTLK_MINOR	0  #define DTLK_IO_EXTENT	0x02 diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 546d68057e3b..2fd8006153c3 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DYNAMIC_DEBUG_H  #define _DYNAMIC_DEBUG_H diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h index a4be70398ce1..99fc06f0afc1 100644 --- a/include/linux/dynamic_queue_limits.h +++ b/include/linux/dynamic_queue_limits.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Dynamic queue limits (dql) - Definitions   * @@ -88,7 +89,7 @@ static inline void dql_queued(struct dql *dql, unsigned int count)  /* Returns how many objects can be queued, < 0 indicates over limit. */  static inline int dql_avail(const struct dql *dql)  { -	return ACCESS_ONCE(dql->adj_limit) - ACCESS_ONCE(dql->num_queued); +	return READ_ONCE(dql->adj_limit) - READ_ONCE(dql->num_queued);  }  /* Record number of completed objects and recalculate the limit. */ @@ -98,7 +99,7 @@ void dql_completed(struct dql *dql, unsigned int count);  void dql_reset(struct dql *dql);  /* Initialize dql state */ -int dql_init(struct dql *dql, unsigned hold_time); +void dql_init(struct dql *dql, unsigned int hold_time);  #endif /* _KERNEL_ */ diff --git a/include/linux/earlycpio.h b/include/linux/earlycpio.h index 111f46d83d00..c70519267c77 100644 --- a/include/linux/earlycpio.h +++ b/include/linux/earlycpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_EARLYCPIO_H  #define _LINUX_EARLYCPIO_H diff --git a/include/linux/ecryptfs.h b/include/linux/ecryptfs.h index 8d5ab998a222..91e142abf7e8 100644 --- a/include/linux/ecryptfs.h +++ b/include/linux/ecryptfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ECRYPTFS_H  #define _LINUX_ECRYPTFS_H diff --git a/include/linux/eeprom_93xx46.h b/include/linux/eeprom_93xx46.h index 915898759280..eec7928ff8fe 100644 --- a/include/linux/eeprom_93xx46.h +++ b/include/linux/eeprom_93xx46.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Module: eeprom_93xx46   * platform description for 93xx46 EEPROMs. diff --git a/include/linux/efi-bgrt.h b/include/linux/efi-bgrt.h index e6f624b53c3d..e6cd51005633 100644 --- a/include/linux/efi-bgrt.h +++ b/include/linux/efi-bgrt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_EFI_BGRT_H  #define _LINUX_EFI_BGRT_H diff --git a/include/linux/efi.h b/include/linux/efi.h index 66f4a4e79f4b..d813f7b04da7 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_EFI_H  #define _LINUX_EFI_H diff --git a/include/linux/efs_vh.h b/include/linux/efs_vh.h index 8a11150c61fe..206c5270f7b8 100644 --- a/include/linux/efs_vh.h +++ b/include/linux/efs_vh.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * efs_vh.h   * diff --git a/include/linux/eisa.h b/include/linux/eisa.h index 6925249a5ac6..b012e30afebd 100644 --- a/include/linux/eisa.h +++ b/include/linux/eisa.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_EISA_H  #define _LINUX_EISA_H diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 5bc8f8682a3e..3d794b3dc532 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ELEVATOR_H  #define _LINUX_ELEVATOR_H @@ -144,6 +145,7 @@ struct elevator_type  	size_t icq_align;	/* ditto */  	struct elv_fs_entry *elevator_attrs;  	char elevator_name[ELV_NAME_MAX]; +	const char *elevator_alias;  	struct module *elevator_owner;  	bool uses_mq;  #ifdef CONFIG_BLK_DEBUG_FS diff --git a/include/linux/elf-randomize.h b/include/linux/elf-randomize.h index b5f0bda9472e..da0dbb7b6be3 100644 --- a/include/linux/elf-randomize.h +++ b/include/linux/elf-randomize.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ELF_RANDOMIZE_H  #define _ELF_RANDOMIZE_H diff --git a/include/linux/elf.h b/include/linux/elf.h index ba069e8f4f78..e3649b3e970e 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ELF_H  #define _LINUX_ELF_H diff --git a/include/linux/elfcore-compat.h b/include/linux/elfcore-compat.h index 0a90e1c3a422..b5f2efdd05e0 100644 --- a/include/linux/elfcore-compat.h +++ b/include/linux/elfcore-compat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ELFCORE_COMPAT_H  #define _LINUX_ELFCORE_COMPAT_H diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index c8240a12c42d..4cad0e784b28 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ELFCORE_H  #define _LINUX_ELFCORE_H diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h index 278e3ef05336..f236f5b931b2 100644 --- a/include/linux/elfnote.h +++ b/include/linux/elfnote.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ELFNOTE_H  #define _LINUX_ELFNOTE_H  /* diff --git a/include/linux/err.h b/include/linux/err.h index 1e3558845e4c..87be24350e91 100644 --- a/include/linux/err.h +++ b/include/linux/err.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ERR_H  #define _LINUX_ERR_H diff --git a/include/linux/errno.h b/include/linux/errno.h index 7ce9fb1b7d28..3cba627577d6 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ERRNO_H  #define _LINUX_ERRNO_H diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h index 6fdfc884fdeb..be1cf7291d6c 100644 --- a/include/linux/errqueue.h +++ b/include/linux/errqueue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ERRQUEUE_H  #define _LINUX_ERRQUEUE_H 1 diff --git a/include/linux/errseq.h b/include/linux/errseq.h index f746bd8fe4d0..6ffae9c5052d 100644 --- a/include/linux/errseq.h +++ b/include/linux/errseq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * See Documentation/errseq.rst and lib/errseq.c   */ diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 2d9f80848d4b..263dbcad22fc 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -66,6 +66,7 @@ int eth_gro_complete(struct sk_buff *skb, int nhoff);  /* Reserved Ethernet Addresses per IEEE 802.1Q */  static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) =  { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; +#define eth_stp_addr eth_reserved_addr_base  /**   * is_link_local_ether_addr - Determine if given Ethernet address is link-local diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 4587a4c36923..2ec41a7eb54f 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * ethtool.h: Defines for Linux ethtool.   * @@ -163,6 +164,16 @@ extern int  __ethtool_get_link_ksettings(struct net_device *dev,  			     struct ethtool_link_ksettings *link_ksettings); +/** + * ethtool_intersect_link_masks - Given two link masks, AND them together + * @dst: first mask and where result is stored + * @src: second mask to intersect with + * + * Given two link mode masks, AND them together and save the result in dst. + */ +void ethtool_intersect_link_masks(struct ethtool_link_ksettings *dst, +				  struct ethtool_link_ksettings *src); +  void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst,  					     u32 legacy_u32); diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 9e4befd95bc7..60b2985e8a18 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  include/linux/eventfd.h   * diff --git a/include/linux/evm.h b/include/linux/evm.h index 35ed9a8a403a..8302bc29bb35 100644 --- a/include/linux/evm.h +++ b/include/linux/evm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * evm.h   * diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 5ab958cdc50b..0d3037419bc7 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_EXPORTFS_H  #define LINUX_EXPORTFS_H 1 diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index 2723e715f67a..1fef88569037 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  linux/include/linux/ext2_fs.h   * diff --git a/include/linux/extable.h b/include/linux/extable.h index 28addad0dda7..41c5b3a25f67 100644 --- a/include/linux/extable.h +++ b/include/linux/extable.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_EXTABLE_H  #define _LINUX_EXTABLE_H diff --git a/include/linux/extcon-provider.h b/include/linux/extcon-provider.h new file mode 100644 index 000000000000..2feca5881fa7 --- /dev/null +++ b/include/linux/extcon-provider.h @@ -0,0 +1,142 @@ +/* + * External Connector (extcon) framework + * - linux/include/linux/extcon-provider.h for extcon provider device driver. + * + * Copyright (C) 2017 Samsung Electronics + * Author: Chanwoo Choi <cw00.choi@samsung.com> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_EXTCON_PROVIDER_H__ +#define __LINUX_EXTCON_PROVIDER_H__ + +#include <linux/extcon.h> + +struct extcon_dev; + +#if IS_ENABLED(CONFIG_EXTCON) + +/* Following APIs register/unregister the extcon device. */ +extern int extcon_dev_register(struct extcon_dev *edev); +extern void extcon_dev_unregister(struct extcon_dev *edev); +extern int devm_extcon_dev_register(struct device *dev, +				struct extcon_dev *edev); +extern void devm_extcon_dev_unregister(struct device *dev, +				struct extcon_dev *edev); + +/* Following APIs allocate/free the memory of the extcon device. */ +extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable); +extern void extcon_dev_free(struct extcon_dev *edev); +extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, +				const unsigned int *cable); +extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); + +/* Synchronize the state and property value for each external connector. */ +extern int extcon_sync(struct extcon_dev *edev, unsigned int id); + +/* + * Following APIs set the connected state of each external connector. + * The 'id' argument indicates the defined external connector. + */ +extern int extcon_set_state(struct extcon_dev *edev, unsigned int id, +				bool state); +extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, +				bool state); + +/* + * Following APIs set the property of each external connector. + * The 'id' argument indicates the defined external connector + * and the 'prop' indicates the extcon property. + * + * And extcon_set_property_capability() set the capability of the property + * for each external connector. They are used to set the capability of the + * property of each external connector based on the id and property. + */ +extern int extcon_set_property(struct extcon_dev *edev, unsigned int id, +				unsigned int prop, +				union extcon_property_value prop_val); +extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id, +				unsigned int prop, +				union extcon_property_value prop_val); +extern int extcon_set_property_capability(struct extcon_dev *edev, +				unsigned int id, unsigned int prop); + +#else /* CONFIG_EXTCON */ +static inline int extcon_dev_register(struct extcon_dev *edev) +{ +	return 0; +} + +static inline void extcon_dev_unregister(struct extcon_dev *edev) { } + +static inline int devm_extcon_dev_register(struct device *dev, +				struct extcon_dev *edev) +{ +	return -EINVAL; +} + +static inline void devm_extcon_dev_unregister(struct device *dev, +				struct extcon_dev *edev) { } + +static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable) +{ +	return ERR_PTR(-ENOSYS); +} + +static inline void extcon_dev_free(struct extcon_dev *edev) { } + +static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, +				const unsigned int *cable) +{ +	return ERR_PTR(-ENOSYS); +} + +static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } + + +static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id, +				bool state) +{ +	return 0; +} + +static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, +				bool state) +{ +	return 0; +} + +static inline int extcon_sync(struct extcon_dev *edev, unsigned int id) +{ +	return 0; +} + +static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id, +				unsigned int prop, +				union extcon_property_value prop_val) +{ +	return 0; +} + +static inline int extcon_set_property_sync(struct extcon_dev *edev, +				unsigned int id, unsigned int prop, +				union extcon_property_value prop_val) +{ +	return 0; +} + +static inline int extcon_set_property_capability(struct extcon_dev *edev, +				unsigned int id, unsigned int prop) +{ +	return 0; +} +#endif /* CONFIG_EXTCON */ +#endif /* __LINUX_EXTCON_PROVIDER_H__ */ diff --git a/include/linux/extcon.h b/include/linux/extcon.h index 744d60ca80c3..6d94e82c8ad9 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -1,5 +1,6 @@  /*   * External Connector (extcon) framework + * - linux/include/linux/extcon.h for extcon consumer device driver.   *   * Copyright (C) 2015 Samsung Electronics   * Author: Chanwoo Choi <cw00.choi@samsung.com> @@ -170,61 +171,29 @@ union extcon_property_value {  	int intval;	/* type : integer (intval) */  }; -struct extcon_cable;  struct extcon_dev;  #if IS_ENABLED(CONFIG_EXTCON) - -/* Following APIs register/unregister the extcon device. */ -extern int extcon_dev_register(struct extcon_dev *edev); -extern void extcon_dev_unregister(struct extcon_dev *edev); -extern int devm_extcon_dev_register(struct device *dev, -				struct extcon_dev *edev); -extern void devm_extcon_dev_unregister(struct device *dev, -				struct extcon_dev *edev); - -/* Following APIs allocate/free the memory of the extcon device. */ -extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable); -extern void extcon_dev_free(struct extcon_dev *edev); -extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, -				const unsigned int *cable); -extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); - -/* Synchronize the state and property value for each external connector. */ -extern int extcon_sync(struct extcon_dev *edev, unsigned int id); -  /* - * Following APIs get/set the connected state of each external connector. + * Following APIs get the connected state of each external connector.   * The 'id' argument indicates the defined external connector.   */  extern int extcon_get_state(struct extcon_dev *edev, unsigned int id); -extern int extcon_set_state(struct extcon_dev *edev, unsigned int id, -				bool state); -extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, -				bool state);  /* - * Following APIs get/set the property of each external connector. + * Following APIs get the property of each external connector.   * The 'id' argument indicates the defined external connector   * and the 'prop' indicates the extcon property.   * - * And extcon_get/set_property_capability() set the capability of the property - * for each external connector. They are used to set the capability of the + * And extcon_get_property_capability() get the capability of the property + * for each external connector. They are used to get the capability of the   * property of each external connector based on the id and property.   */  extern int extcon_get_property(struct extcon_dev *edev, unsigned int id,  				unsigned int prop,  				union extcon_property_value *prop_val); -extern int extcon_set_property(struct extcon_dev *edev, unsigned int id, -				unsigned int prop, -				union extcon_property_value prop_val); -extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id, -				unsigned int prop, -				union extcon_property_value prop_val);  extern int extcon_get_property_capability(struct extcon_dev *edev,  				unsigned int id, unsigned int prop); -extern int extcon_set_property_capability(struct extcon_dev *edev, -				unsigned int id, unsigned int prop);  /*   * Following APIs register the notifier block in order to detect @@ -268,79 +237,17 @@ extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,  extern const char *extcon_get_edev_name(struct extcon_dev *edev);  #else /* CONFIG_EXTCON */ -static inline int extcon_dev_register(struct extcon_dev *edev) -{ -	return 0; -} - -static inline void extcon_dev_unregister(struct extcon_dev *edev) { } - -static inline int devm_extcon_dev_register(struct device *dev, -				struct extcon_dev *edev) -{ -	return -EINVAL; -} - -static inline void devm_extcon_dev_unregister(struct device *dev, -				struct extcon_dev *edev) { } - -static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable) -{ -	return ERR_PTR(-ENOSYS); -} - -static inline void extcon_dev_free(struct extcon_dev *edev) { } - -static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, -				const unsigned int *cable) -{ -	return ERR_PTR(-ENOSYS); -} - -static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } - -  static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id)  {  	return 0;  } -static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id, -				bool state) -{ -	return 0; -} - -static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, -				bool state) -{ -	return 0; -} - -static inline int extcon_sync(struct extcon_dev *edev, unsigned int id) -{ -	return 0; -} -  static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,  				unsigned int prop,  				union extcon_property_value *prop_val)  {  	return 0;  } -static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id, -				unsigned int prop, -				union extcon_property_value prop_val) -{ -	return 0; -} - -static inline int extcon_set_property_sync(struct extcon_dev *edev, -				unsigned int id, unsigned int prop, -				union extcon_property_value prop_val) -{ -	return 0; -}  static inline int extcon_get_property_capability(struct extcon_dev *edev,  				unsigned int id, unsigned int prop) @@ -348,12 +255,6 @@ static inline int extcon_get_property_capability(struct extcon_dev *edev,  	return 0;  } -static inline int extcon_set_property_capability(struct extcon_dev *edev, -				unsigned int id, unsigned int prop) -{ -	return 0; -} -  static inline int extcon_register_notifier(struct extcon_dev *edev,  				unsigned int id, struct notifier_block *nb)  { diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h index 2a0c453d7235..43e98d30d2df 100644 --- a/include/linux/f2fs_fs.h +++ b/include/linux/f2fs_fs.h @@ -36,6 +36,8 @@  #define F2FS_NODE_INO(sbi)	((sbi)->node_ino_num)  #define F2FS_META_INO(sbi)	((sbi)->meta_ino_num) +#define F2FS_MAX_QUOTAS		3 +  #define F2FS_IO_SIZE(sbi)	(1 << (sbi)->write_io_size_bits) /* Blocks */  #define F2FS_IO_SIZE_KB(sbi)	(1 << ((sbi)->write_io_size_bits + 2)) /* KB */  #define F2FS_IO_SIZE_BYTES(sbi)	(1 << ((sbi)->write_io_size_bits + 12)) /* B */ @@ -108,7 +110,8 @@ struct f2fs_super_block {  	__u8 encryption_level;		/* versioning level for encryption */  	__u8 encrypt_pw_salt[16];	/* Salt used for string2key algorithm */  	struct f2fs_device devs[MAX_DEVICES];	/* device list */ -	__u8 reserved[327];		/* valid reserved region */ +	__le32 qf_ino[F2FS_MAX_QUOTAS];	/* quota inode numbers */ +	__u8 reserved[315];		/* valid reserved region */  } __packed;  /* @@ -184,7 +187,8 @@ struct f2fs_extent {  } __packed;  #define F2FS_NAME_LEN		255 -#define F2FS_INLINE_XATTR_ADDRS	50	/* 200 bytes for inline xattrs */ +/* 200 bytes for inline xattrs by default */ +#define DEFAULT_INLINE_XATTR_ADDRS	50  #define DEF_ADDRS_PER_INODE	923	/* Address Pointers in an Inode */  #define CUR_ADDRS_PER_INODE(inode)	(DEF_ADDRS_PER_INODE - \  					get_extra_isize(inode)) @@ -238,7 +242,7 @@ struct f2fs_inode {  	union {  		struct {  			__le16 i_extra_isize;	/* extra inode attribute size */ -			__le16 i_padding;	/* padding */ +			__le16 i_inline_xattr_size;	/* inline xattr size, unit: 4 bytes */  			__le32 i_projid;	/* project id */  			__le32 i_inode_checksum;/* inode meta checksum */  			__le32 i_extra_end[0];	/* for attribute size calculation */ diff --git a/include/linux/falloc.h b/include/linux/falloc.h index 7494dc67c66f..674d59f4d6ce 100644 --- a/include/linux/falloc.h +++ b/include/linux/falloc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FALLOC_H_  #define _FALLOC_H_ diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h index cef93ddcc5a0..096c96f4f16a 100644 --- a/include/linux/fanotify.h +++ b/include/linux/fanotify.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FANOTIFY_H  #define _LINUX_FANOTIFY_H diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h index 728d4e0292aa..c3c95d18bf43 100644 --- a/include/linux/fault-inject.h +++ b/include/linux/fault-inject.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FAULT_INJECT_H  #define _LINUX_FAULT_INJECT_H diff --git a/include/linux/fb.h b/include/linux/fb.h index f4386b0ccf40..bc24e48e396d 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FB_H  #define _LINUX_FB_H diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h index 1b48d9c9a561..27dc7a60693e 100644 --- a/include/linux/fcntl.h +++ b/include/linux/fcntl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FCNTL_H  #define _LINUX_FCNTL_H diff --git a/include/linux/fd.h b/include/linux/fd.h index 69275bccc3e4..ece5ea53205b 100644 --- a/include/linux/fd.h +++ b/include/linux/fd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FD_H  #define _LINUX_FD_H diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 6e84b2cae6ad..1c65817673db 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * descriptor table internals; you almost certainly want file.h instead.   */ diff --git a/include/linux/file.h b/include/linux/file.h index 61eb82cbafba..279720db984a 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Wrapper functions for accessing the file_struct fd array.   */ diff --git a/include/linux/filter.h b/include/linux/filter.h index d29e58fde364..80b5b482cb46 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Linux Socket Filter Data Structures   */ @@ -453,13 +454,11 @@ struct bpf_binary_header {  struct bpf_prog {  	u16			pages;		/* Number of allocated pages */ -	kmemcheck_bitfield_begin(meta);  	u16			jited:1,	/* Is our filter JIT'ed? */  				locked:1,	/* Program image locked? */  				gpl_compatible:1, /* Is filter GPL compatible? */  				cb_access:1,	/* Is control block accessed? */  				dst_needed:1;	/* Do we need dst entry? */ -	kmemcheck_bitfield_end(meta);  	enum bpf_prog_type	type;		/* Type of BPF program */  	u32			len;		/* Number of filter blocks */  	u32			jited_len;	/* Size of jited insns in bytes */ @@ -481,30 +480,36 @@ struct sk_filter {  	struct bpf_prog	*prog;  }; -#define BPF_PROG_RUN(filter, ctx)  (*filter->bpf_func)(ctx, filter->insnsi) +#define BPF_PROG_RUN(filter, ctx)  (*(filter)->bpf_func)(ctx, (filter)->insnsi)  #define BPF_SKB_CB_LEN QDISC_CB_PRIV_LEN  struct bpf_skb_data_end {  	struct qdisc_skb_cb qdisc_cb; +	void *data_meta;  	void *data_end;  };  struct xdp_buff {  	void *data;  	void *data_end; +	void *data_meta;  	void *data_hard_start;  }; -/* compute the linear packet data range [data, data_end) which - * will be accessed by cls_bpf, act_bpf and lwt programs +/* Compute the linear packet data range [data, data_end) which + * will be accessed by various program types (cls_bpf, act_bpf, + * lwt, ...). Subsystems allowing direct data access must (!) + * ensure that cb[] area can be written to when BPF program is + * invoked (otherwise cb[] save/restore is necessary).   */ -static inline void bpf_compute_data_end(struct sk_buff *skb) +static inline void bpf_compute_data_pointers(struct sk_buff *skb)  {  	struct bpf_skb_data_end *cb = (struct bpf_skb_data_end *)skb->cb;  	BUILD_BUG_ON(sizeof(*cb) > FIELD_SIZEOF(struct sk_buff, cb)); -	cb->data_end = skb->data + skb_headlen(skb); +	cb->data_meta = skb->data - skb_metadata_len(skb); +	cb->data_end  = skb->data + skb_headlen(skb);  }  static inline u8 *bpf_skb_cb(struct sk_buff *skb) @@ -725,10 +730,24 @@ int xdp_do_redirect(struct net_device *dev,  		    struct bpf_prog *prog);  void xdp_do_flush_map(void); +/* Drivers not supporting XDP metadata can use this helper, which + * rejects any room expansion for metadata as a result. + */ +static __always_inline void +xdp_set_data_meta_invalid(struct xdp_buff *xdp) +{ +	xdp->data_meta = xdp->data + 1; +} + +static __always_inline bool +xdp_data_meta_unsupported(const struct xdp_buff *xdp) +{ +	return unlikely(xdp->data_meta > xdp->data); +} +  void bpf_warn_invalid_xdp_action(u32 act); -void bpf_warn_invalid_xdp_redirect(u32 ifindex); -struct sock *do_sk_redirect_map(void); +struct sock *do_sk_redirect_map(struct sk_buff *skb);  #ifdef CONFIG_BPF_JIT  extern int bpf_jit_enable; diff --git a/include/linux/fips.h b/include/linux/fips.h index f8fb07b0b6b8..afeeece92302 100644 --- a/include/linux/fips.h +++ b/include/linux/fips.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FIPS_H  #define _FIPS_H diff --git a/include/linux/firewire.h b/include/linux/firewire.h index d4b7683c722d..aec8f30ab200 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FIREWIRE_H  #define _LINUX_FIREWIRE_H diff --git a/include/linux/firmware.h b/include/linux/firmware.h index b1f9f0ccb8ac..d4508080348d 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FIRMWARE_H  #define _LINUX_FIRMWARE_H diff --git a/include/linux/flat.h b/include/linux/flat.h index 7d542dfd0def..569b67d64d5c 100644 --- a/include/linux/flat.h +++ b/include/linux/flat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright (C) 2002-2003  David McCullough <davidm@snapgear.com>   * Copyright (C) 1998       Kenneth Albanowski <kjahds@kjahds.com> diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h index 11366b3ff0b4..b94fa61b51fb 100644 --- a/include/linux/flex_array.h +++ b/include/linux/flex_array.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _FLEX_ARRAY_H  #define _FLEX_ARRAY_H diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h index 0d348e011a6e..c12df59d3f5f 100644 --- a/include/linux/flex_proportions.h +++ b/include/linux/flex_proportions.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Floating proportions with flexible aging period   * diff --git a/include/linux/fmc-sdb.h b/include/linux/fmc-sdb.h index 599bd6bab56d..bec899f0867c 100644 --- a/include/linux/fmc-sdb.h +++ b/include/linux/fmc-sdb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This file is separate from sdb.h, because I want that one to remain   * unchanged (as far as possible) from the official sdb distribution diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h index dba6e3c697c7..aa66c87c120b 100644 --- a/include/linux/fpga/fpga-bridge.h +++ b/include/linux/fpga/fpga-bridge.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <linux/device.h>  #include <linux/fpga/fpga-mgr.h> diff --git a/include/linux/frame.h b/include/linux/frame.h index d772c61c31da..02d3ca2d9598 100644 --- a/include/linux/frame.h +++ b/include/linux/frame.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FRAME_H  #define _LINUX_FRAME_H diff --git a/include/linux/freezer.h b/include/linux/freezer.h index dd03e837ebb7..21f5aa0b217f 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Freezer declarations */  #ifndef FREEZER_H_INCLUDED @@ -181,7 +182,7 @@ static inline void freezable_schedule_unsafe(void)  }  /* - * Like freezable_schedule_timeout(), but should not block the freezer.  Do not + * Like schedule_timeout(), but should not block the freezer.  Do not   * call this with locks held.   */  static inline long freezable_schedule_timeout(long timeout) diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h index 1d18af034554..011965c08b93 100644 --- a/include/linux/frontswap.h +++ b/include/linux/frontswap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FRONTSWAP_H  #define _LINUX_FRONTSWAP_H diff --git a/include/linux/fs.h b/include/linux/fs.h index 13dab191a23e..2995a271ec46 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FS_H  #define _LINUX_FS_H @@ -970,8 +971,8 @@ struct lock_manager {  struct net;  void locks_start_grace(struct net *, struct lock_manager *);  void locks_end_grace(struct lock_manager *); -int locks_in_grace(struct net *); -int opens_in_grace(struct net *); +bool locks_in_grace(struct net *); +bool opens_in_grace(struct net *);  /* that will die - we need it for nfs_lock_info */  #include <linux/nfs_fs_i.h> @@ -1701,6 +1702,7 @@ struct file_operations {  	long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);  	long (*compat_ioctl) (struct file *, unsigned int, unsigned long);  	int (*mmap) (struct file *, struct vm_area_struct *); +	unsigned long mmap_supported_flags;  	int (*open) (struct inode *, struct file *);  	int (*flush) (struct file *, fl_owner_t id);  	int (*release) (struct inode *, struct file *); @@ -1853,6 +1855,7 @@ struct super_operations {  #else  #define S_DAX		0	/* Make all the DAX code disappear */  #endif +#define S_ENCRYPTED	16384	/* Encrypted file (using fs/crypto/) */  /*   * Note that nosuid etc flags are inode-specific: setting some file-system @@ -1892,6 +1895,7 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags  #define IS_AUTOMOUNT(inode)	((inode)->i_flags & S_AUTOMOUNT)  #define IS_NOSEC(inode)		((inode)->i_flags & S_NOSEC)  #define IS_DAX(inode)		((inode)->i_flags & S_DAX) +#define IS_ENCRYPTED(inode)	((inode)->i_flags & S_ENCRYPTED)  #define IS_WHITEOUT(inode)	(S_ISCHR(inode->i_mode) && \  				 (inode)->i_rdev == WHITEOUT_DEV) @@ -2094,9 +2098,18 @@ struct file_system_type {  extern struct dentry *mount_ns(struct file_system_type *fs_type,  	int flags, void *data, void *ns, struct user_namespace *user_ns,  	int (*fill_super)(struct super_block *, void *, int)); +#ifdef CONFIG_BLOCK  extern struct dentry *mount_bdev(struct file_system_type *fs_type,  	int flags, const char *dev_name, void *data,  	int (*fill_super)(struct super_block *, void *, int)); +#else +static inline struct dentry *mount_bdev(struct file_system_type *fs_type, +	int flags, const char *dev_name, void *data, +	int (*fill_super)(struct super_block *, void *, int)) +{ +	return ERR_PTR(-ENODEV); +} +#endif  extern struct dentry *mount_single(struct file_system_type *fs_type,  	int flags, void *data,  	int (*fill_super)(struct super_block *, void *, int)); @@ -2105,7 +2118,14 @@ extern struct dentry *mount_nodev(struct file_system_type *fs_type,  	int (*fill_super)(struct super_block *, void *, int));  extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path);  void generic_shutdown_super(struct super_block *sb); +#ifdef CONFIG_BLOCK  void kill_block_super(struct super_block *sb); +#else +static inline void kill_block_super(struct super_block *sb) +{ +	BUG(); +} +#endif  void kill_anon_super(struct super_block *sb);  void kill_litter_super(struct super_block *sb);  void deactivate_super(struct super_block *sb); @@ -2169,7 +2189,6 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,  extern int vfs_statfs(const struct path *, struct kstatfs *);  extern int user_statfs(const char __user *, struct kstatfs *);  extern int fd_statfs(int, struct kstatfs *); -extern int vfs_ustat(dev_t, struct kstatfs *);  extern int freeze_super(struct super_block *super);  extern int thaw_super(struct super_block *super);  extern bool our_mnt(struct vfsmount *mnt); @@ -2792,6 +2811,7 @@ extern int do_pipe_flags(int *, int);  	id(KEXEC_IMAGE, kexec-image)		\  	id(KEXEC_INITRAMFS, kexec-initramfs)	\  	id(POLICY, security-policy)		\ +	id(X509_CERTIFICATE, x509-certificate)	\  	id(MAX_ID, )  #define __fid_enumify(ENUM, dummy) READING_ ## ENUM, diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h index 3886b3bffd7f..7cab74d66f85 100644 --- a/include/linux/fs_pin.h +++ b/include/linux/fs_pin.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <linux/wait.h>  struct fs_pin { diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h index da317c7163ab..54210a42c30d 100644 --- a/include/linux/fs_stack.h +++ b/include/linux/fs_stack.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FS_STACK_H  #define _LINUX_FS_STACK_H diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h index 7a026240cbb1..cf1015abfbf2 100644 --- a/include/linux/fs_struct.h +++ b/include/linux/fs_struct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FS_STRUCT_H  #define _LINUX_FS_STRUCT_H diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h new file mode 100644 index 000000000000..08b4b40c5aa8 --- /dev/null +++ b/include/linux/fscrypt.h @@ -0,0 +1,294 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * fscrypt.h: declarations for per-file encryption + * + * Filesystems that implement per-file encryption include this header + * file with the __FS_HAS_ENCRYPTION set according to whether that filesystem + * is being built with encryption support or not. + * + * Copyright (C) 2015, Google, Inc. + * + * Written by Michael Halcrow, 2015. + * Modified by Jaegeuk Kim, 2015. + */ +#ifndef _LINUX_FSCRYPT_H +#define _LINUX_FSCRYPT_H + +#include <linux/key.h> +#include <linux/fs.h> +#include <linux/mm.h> +#include <linux/bio.h> +#include <linux/dcache.h> +#include <crypto/skcipher.h> +#include <uapi/linux/fs.h> + +#define FS_CRYPTO_BLOCK_SIZE		16 + +struct fscrypt_info; + +struct fscrypt_ctx { +	union { +		struct { +			struct page *bounce_page;	/* Ciphertext page */ +			struct page *control_page;	/* Original page  */ +		} w; +		struct { +			struct bio *bio; +			struct work_struct work; +		} r; +		struct list_head free_list;	/* Free list */ +	}; +	u8 flags;				/* Flags */ +}; + +/** + * For encrypted symlinks, the ciphertext length is stored at the beginning + * of the string in little-endian format. + */ +struct fscrypt_symlink_data { +	__le16 len; +	char encrypted_path[1]; +} __packed; + +struct fscrypt_str { +	unsigned char *name; +	u32 len; +}; + +struct fscrypt_name { +	const struct qstr *usr_fname; +	struct fscrypt_str disk_name; +	u32 hash; +	u32 minor_hash; +	struct fscrypt_str crypto_buf; +}; + +#define FSTR_INIT(n, l)		{ .name = n, .len = l } +#define FSTR_TO_QSTR(f)		QSTR_INIT((f)->name, (f)->len) +#define fname_name(p)		((p)->disk_name.name) +#define fname_len(p)		((p)->disk_name.len) + +/* + * fscrypt superblock flags + */ +#define FS_CFLG_OWN_PAGES (1U << 1) + +/* + * crypto opertions for filesystems + */ +struct fscrypt_operations { +	unsigned int flags; +	const char *key_prefix; +	int (*get_context)(struct inode *, void *, size_t); +	int (*set_context)(struct inode *, const void *, size_t, void *); +	bool (*dummy_context)(struct inode *); +	bool (*empty_dir)(struct inode *); +	unsigned (*max_namelen)(struct inode *); +}; + +/* Maximum value for the third parameter of fscrypt_operations.set_context(). */ +#define FSCRYPT_SET_CONTEXT_MAX_SIZE	28 + +static inline bool fscrypt_dummy_context_enabled(struct inode *inode) +{ +	if (inode->i_sb->s_cop->dummy_context && +				inode->i_sb->s_cop->dummy_context(inode)) +		return true; +	return false; +} + +static inline bool fscrypt_valid_enc_modes(u32 contents_mode, +					u32 filenames_mode) +{ +	if (contents_mode == FS_ENCRYPTION_MODE_AES_128_CBC && +	    filenames_mode == FS_ENCRYPTION_MODE_AES_128_CTS) +		return true; + +	if (contents_mode == FS_ENCRYPTION_MODE_AES_256_XTS && +	    filenames_mode == FS_ENCRYPTION_MODE_AES_256_CTS) +		return true; + +	return false; +} + +static inline bool fscrypt_is_dot_dotdot(const struct qstr *str) +{ +	if (str->len == 1 && str->name[0] == '.') +		return true; + +	if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.') +		return true; + +	return false; +} + +#if __FS_HAS_ENCRYPTION + +static inline struct page *fscrypt_control_page(struct page *page) +{ +	return ((struct fscrypt_ctx *)page_private(page))->w.control_page; +} + +static inline bool fscrypt_has_encryption_key(const struct inode *inode) +{ +	return (inode->i_crypt_info != NULL); +} + +#include <linux/fscrypt_supp.h> + +#else /* !__FS_HAS_ENCRYPTION */ + +static inline struct page *fscrypt_control_page(struct page *page) +{ +	WARN_ON_ONCE(1); +	return ERR_PTR(-EINVAL); +} + +static inline bool fscrypt_has_encryption_key(const struct inode *inode) +{ +	return 0; +} + +#include <linux/fscrypt_notsupp.h> +#endif /* __FS_HAS_ENCRYPTION */ + +/** + * fscrypt_require_key - require an inode's encryption key + * @inode: the inode we need the key for + * + * If the inode is encrypted, set up its encryption key if not already done. + * Then require that the key be present and return -ENOKEY otherwise. + * + * No locks are needed, and the key will live as long as the struct inode --- so + * it won't go away from under you. + * + * Return: 0 on success, -ENOKEY if the key is missing, or another -errno code + * if a problem occurred while setting up the encryption key. + */ +static inline int fscrypt_require_key(struct inode *inode) +{ +	if (IS_ENCRYPTED(inode)) { +		int err = fscrypt_get_encryption_info(inode); + +		if (err) +			return err; +		if (!fscrypt_has_encryption_key(inode)) +			return -ENOKEY; +	} +	return 0; +} + +/** + * fscrypt_prepare_link - prepare to link an inode into a possibly-encrypted directory + * @old_dentry: an existing dentry for the inode being linked + * @dir: the target directory + * @dentry: negative dentry for the target filename + * + * A new link can only be added to an encrypted directory if the directory's + * encryption key is available --- since otherwise we'd have no way to encrypt + * the filename.  Therefore, we first set up the directory's encryption key (if + * not already done) and return an error if it's unavailable. + * + * We also verify that the link will not violate the constraint that all files + * in an encrypted directory tree use the same encryption policy. + * + * Return: 0 on success, -ENOKEY if the directory's encryption key is missing, + * -EPERM if the link would result in an inconsistent encryption policy, or + * another -errno code. + */ +static inline int fscrypt_prepare_link(struct dentry *old_dentry, +				       struct inode *dir, +				       struct dentry *dentry) +{ +	if (IS_ENCRYPTED(dir)) +		return __fscrypt_prepare_link(d_inode(old_dentry), dir); +	return 0; +} + +/** + * fscrypt_prepare_rename - prepare for a rename between possibly-encrypted directories + * @old_dir: source directory + * @old_dentry: dentry for source file + * @new_dir: target directory + * @new_dentry: dentry for target location (may be negative unless exchanging) + * @flags: rename flags (we care at least about %RENAME_EXCHANGE) + * + * Prepare for ->rename() where the source and/or target directories may be + * encrypted.  A new link can only be added to an encrypted directory if the + * directory's encryption key is available --- since otherwise we'd have no way + * to encrypt the filename.  A rename to an existing name, on the other hand, + * *is* cryptographically possible without the key.  However, we take the more + * conservative approach and just forbid all no-key renames. + * + * We also verify that the rename will not violate the constraint that all files + * in an encrypted directory tree use the same encryption policy. + * + * Return: 0 on success, -ENOKEY if an encryption key is missing, -EPERM if the + * rename would cause inconsistent encryption policies, or another -errno code. + */ +static inline int fscrypt_prepare_rename(struct inode *old_dir, +					 struct dentry *old_dentry, +					 struct inode *new_dir, +					 struct dentry *new_dentry, +					 unsigned int flags) +{ +	if (IS_ENCRYPTED(old_dir) || IS_ENCRYPTED(new_dir)) +		return __fscrypt_prepare_rename(old_dir, old_dentry, +						new_dir, new_dentry, flags); +	return 0; +} + +/** + * fscrypt_prepare_lookup - prepare to lookup a name in a possibly-encrypted directory + * @dir: directory being searched + * @dentry: filename being looked up + * @flags: lookup flags + * + * Prepare for ->lookup() in a directory which may be encrypted.  Lookups can be + * done with or without the directory's encryption key; without the key, + * filenames are presented in encrypted form.  Therefore, we'll try to set up + * the directory's encryption key, but even without it the lookup can continue. + * + * To allow invalidating stale dentries if the directory's encryption key is + * added later, we also install a custom ->d_revalidate() method and use the + * DCACHE_ENCRYPTED_WITH_KEY flag to indicate whether a given dentry is a + * plaintext name (flag set) or a ciphertext name (flag cleared). + * + * Return: 0 on success, -errno if a problem occurred while setting up the + * encryption key + */ +static inline int fscrypt_prepare_lookup(struct inode *dir, +					 struct dentry *dentry, +					 unsigned int flags) +{ +	if (IS_ENCRYPTED(dir)) +		return __fscrypt_prepare_lookup(dir, dentry); +	return 0; +} + +/** + * fscrypt_prepare_setattr - prepare to change a possibly-encrypted inode's attributes + * @dentry: dentry through which the inode is being changed + * @attr: attributes to change + * + * Prepare for ->setattr() on a possibly-encrypted inode.  On an encrypted file, + * most attribute changes are allowed even without the encryption key.  However, + * without the encryption key we do have to forbid truncates.  This is needed + * because the size being truncated to may not be a multiple of the filesystem + * block size, and in that case we'd have to decrypt the final block, zero the + * portion past i_size, and re-encrypt it.  (We *could* allow truncating to a + * filesystem block boundary, but it's simpler to just forbid all truncates --- + * and we already forbid all other contents modifications without the key.) + * + * Return: 0 on success, -ENOKEY if the key is missing, or another -errno code + * if a problem occurred while setting up the encryption key. + */ +static inline int fscrypt_prepare_setattr(struct dentry *dentry, +					  struct iattr *attr) +{ +	if (attr->ia_valid & ATTR_SIZE) +		return fscrypt_require_key(d_inode(dentry)); +	return 0; +} + +#endif	/* _LINUX_FSCRYPT_H */ diff --git a/include/linux/fscrypt_common.h b/include/linux/fscrypt_common.h deleted file mode 100644 index 97f738628b36..000000000000 --- a/include/linux/fscrypt_common.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * fscrypt_common.h: common declarations for per-file encryption - * - * Copyright (C) 2015, Google, Inc. - * - * Written by Michael Halcrow, 2015. - * Modified by Jaegeuk Kim, 2015. - */ - -#ifndef _LINUX_FSCRYPT_COMMON_H -#define _LINUX_FSCRYPT_COMMON_H - -#include <linux/key.h> -#include <linux/fs.h> -#include <linux/mm.h> -#include <linux/bio.h> -#include <linux/dcache.h> -#include <crypto/skcipher.h> -#include <uapi/linux/fs.h> - -#define FS_CRYPTO_BLOCK_SIZE		16 - -struct fscrypt_info; - -struct fscrypt_ctx { -	union { -		struct { -			struct page *bounce_page;	/* Ciphertext page */ -			struct page *control_page;	/* Original page  */ -		} w; -		struct { -			struct bio *bio; -			struct work_struct work; -		} r; -		struct list_head free_list;	/* Free list */ -	}; -	u8 flags;				/* Flags */ -}; - -/** - * For encrypted symlinks, the ciphertext length is stored at the beginning - * of the string in little-endian format. - */ -struct fscrypt_symlink_data { -	__le16 len; -	char encrypted_path[1]; -} __packed; - -struct fscrypt_str { -	unsigned char *name; -	u32 len; -}; - -struct fscrypt_name { -	const struct qstr *usr_fname; -	struct fscrypt_str disk_name; -	u32 hash; -	u32 minor_hash; -	struct fscrypt_str crypto_buf; -}; - -#define FSTR_INIT(n, l)		{ .name = n, .len = l } -#define FSTR_TO_QSTR(f)		QSTR_INIT((f)->name, (f)->len) -#define fname_name(p)		((p)->disk_name.name) -#define fname_len(p)		((p)->disk_name.len) - -/* - * fscrypt superblock flags - */ -#define FS_CFLG_OWN_PAGES (1U << 1) - -/* - * crypto opertions for filesystems - */ -struct fscrypt_operations { -	unsigned int flags; -	const char *key_prefix; -	int (*get_context)(struct inode *, void *, size_t); -	int (*set_context)(struct inode *, const void *, size_t, void *); -	bool (*dummy_context)(struct inode *); -	bool (*is_encrypted)(struct inode *); -	bool (*empty_dir)(struct inode *); -	unsigned (*max_namelen)(struct inode *); -}; - -/* Maximum value for the third parameter of fscrypt_operations.set_context(). */ -#define FSCRYPT_SET_CONTEXT_MAX_SIZE	28 - -static inline bool fscrypt_dummy_context_enabled(struct inode *inode) -{ -	if (inode->i_sb->s_cop->dummy_context && -				inode->i_sb->s_cop->dummy_context(inode)) -		return true; -	return false; -} - -static inline bool fscrypt_valid_enc_modes(u32 contents_mode, -					u32 filenames_mode) -{ -	if (contents_mode == FS_ENCRYPTION_MODE_AES_128_CBC && -	    filenames_mode == FS_ENCRYPTION_MODE_AES_128_CTS) -		return true; - -	if (contents_mode == FS_ENCRYPTION_MODE_AES_256_XTS && -	    filenames_mode == FS_ENCRYPTION_MODE_AES_256_CTS) -		return true; - -	return false; -} - -static inline bool fscrypt_is_dot_dotdot(const struct qstr *str) -{ -	if (str->len == 1 && str->name[0] == '.') -		return true; - -	if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.') -		return true; - -	return false; -} - -static inline struct page *fscrypt_control_page(struct page *page) -{ -#if IS_ENABLED(CONFIG_FS_ENCRYPTION) -	return ((struct fscrypt_ctx *)page_private(page))->w.control_page; -#else -	WARN_ON_ONCE(1); -	return ERR_PTR(-EINVAL); -#endif -} - -static inline int fscrypt_has_encryption_key(const struct inode *inode) -{ -#if IS_ENABLED(CONFIG_FS_ENCRYPTION) -	return (inode->i_crypt_info != NULL); -#else -	return 0; -#endif -} - -#endif	/* _LINUX_FSCRYPT_COMMON_H */ diff --git a/include/linux/fscrypt_notsupp.h b/include/linux/fscrypt_notsupp.h index ec406aed2f2f..63e58808519a 100644 --- a/include/linux/fscrypt_notsupp.h +++ b/include/linux/fscrypt_notsupp.h @@ -1,15 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * fscrypt_notsupp.h   *   * This stubs out the fscrypt functions for filesystems configured without   * encryption support. + * + * Do not include this file directly. Use fscrypt.h instead!   */ +#ifndef _LINUX_FSCRYPT_H +#error "Incorrect include of linux/fscrypt_notsupp.h!" +#endif  #ifndef _LINUX_FSCRYPT_NOTSUPP_H  #define _LINUX_FSCRYPT_NOTSUPP_H -#include <linux/fscrypt_common.h> -  /* crypto.c */  static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode,  						  gfp_t gfp_flags) @@ -97,7 +101,7 @@ static inline int fscrypt_setup_filename(struct inode *dir,  					 const struct qstr *iname,  					 int lookup, struct fscrypt_name *fname)  { -	if (dir->i_sb->s_cop->is_encrypted(dir)) +	if (IS_ENCRYPTED(dir))  		return -EOPNOTSUPP;  	memset(fname, 0, sizeof(struct fscrypt_name)); @@ -174,4 +178,34 @@ static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,  	return -EOPNOTSUPP;  } +/* hooks.c */ + +static inline int fscrypt_file_open(struct inode *inode, struct file *filp) +{ +	if (IS_ENCRYPTED(inode)) +		return -EOPNOTSUPP; +	return 0; +} + +static inline int __fscrypt_prepare_link(struct inode *inode, +					 struct inode *dir) +{ +	return -EOPNOTSUPP; +} + +static inline int __fscrypt_prepare_rename(struct inode *old_dir, +					   struct dentry *old_dentry, +					   struct inode *new_dir, +					   struct dentry *new_dentry, +					   unsigned int flags) +{ +	return -EOPNOTSUPP; +} + +static inline int __fscrypt_prepare_lookup(struct inode *dir, +					   struct dentry *dentry) +{ +	return -EOPNOTSUPP; +} +  #endif	/* _LINUX_FSCRYPT_NOTSUPP_H */ diff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h index 32e2fcf13b01..cf9e9fc02f0a 100644 --- a/include/linux/fscrypt_supp.h +++ b/include/linux/fscrypt_supp.h @@ -1,14 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * fscrypt_supp.h   * - * This is included by filesystems configured with encryption support. + * Do not include this file directly. Use fscrypt.h instead!   */ +#ifndef _LINUX_FSCRYPT_H +#error "Incorrect include of linux/fscrypt_supp.h!" +#endif  #ifndef _LINUX_FSCRYPT_SUPP_H  #define _LINUX_FSCRYPT_SUPP_H -#include <linux/fscrypt_common.h> -  /* crypto.c */  extern struct kmem_cache *fscrypt_info_cachep;  extern struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *, gfp_t); @@ -142,4 +144,14 @@ extern void fscrypt_pullback_bio_page(struct page **, bool);  extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t,  				 unsigned int); +/* hooks.c */ +extern int fscrypt_file_open(struct inode *inode, struct file *filp); +extern int __fscrypt_prepare_link(struct inode *inode, struct inode *dir); +extern int __fscrypt_prepare_rename(struct inode *old_dir, +				    struct dentry *old_dentry, +				    struct inode *new_dir, +				    struct dentry *new_dentry, +				    unsigned int flags); +extern int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry); +  #endif	/* _LINUX_FSCRYPT_SUPP_H */ diff --git a/include/linux/fsl/edac.h b/include/linux/fsl/edac.h index 90d64d4ec1a9..148a297d7587 100644 --- a/include/linux/fsl/edac.h +++ b/include/linux/fsl/edac.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef FSL_EDAC_H  #define FSL_EDAC_H diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index b78aa7ac77ce..bdaf22582f6e 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FS_NOTIFY_H  #define _LINUX_FS_NOTIFY_H diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index c6c69318752b..067d52e95f02 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Filesystem access notification for Linux   * @@ -17,6 +18,7 @@  #include <linux/types.h>  #include <linux/atomic.h>  #include <linux/user_namespace.h> +#include <linux/refcount.h>  /*   * IN_* from inotfy.h lines up EXACTLY with FS_*, this is so we can easily @@ -135,7 +137,7 @@ struct fsnotify_group {  	 * inotify_init() and the refcnt will hit 0 only when that fd has been  	 * closed.  	 */ -	atomic_t refcnt;		/* things with interest in this group */ +	refcount_t refcnt;		/* things with interest in this group */  	const struct fsnotify_ops *ops;	/* how this group handles things */ @@ -182,14 +184,13 @@ struct fsnotify_group {  #endif  #ifdef CONFIG_FANOTIFY  		struct fanotify_group_private_data { -#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS  			/* allows a group to block waiting for a userspace response */  			struct list_head access_list;  			wait_queue_head_t access_waitq; -#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */  			int f_flags;  			unsigned int max_marks;  			struct user_struct *user; +			bool audit;  		} fanotify_data;  #endif /* CONFIG_FANOTIFY */  	}; @@ -243,7 +244,7 @@ struct fsnotify_mark {  	__u32 mask;  	/* We hold one for presence in g_list. Also one ref for each 'thing'  	 * in kernel that found and may be using this mark. */ -	atomic_t refcnt; +	refcount_t refcnt;  	/* Group this mark is for. Set on mark creation, stable until last ref  	 * is dropped */  	struct fsnotify_group *group; diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 2e028854bac7..2bab81951ced 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Ftrace header.  For implementation details beyond the random comments   * scattered below, see: Documentation/trace/ftrace-design.txt @@ -51,6 +52,30 @@ static inline void early_trace_init(void) { }  struct module;  struct ftrace_hash; +#if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \ +	defined(CONFIG_DYNAMIC_FTRACE) +const char * +ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, +		   unsigned long *off, char **modname, char *sym); +int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value, +			   char *type, char *name, +			   char *module_name, int *exported); +#else +static inline const char * +ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, +		   unsigned long *off, char **modname, char *sym) +{ +	return NULL; +} +static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value, +					 char *type, char *name, +					 char *module_name, int *exported) +{ +	return -1; +} +#endif + +  #ifdef CONFIG_FUNCTION_TRACER  extern int ftrace_enabled; @@ -78,10 +103,6 @@ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);   * ENABLED - set/unset when ftrace_ops is registered/unregistered   * DYNAMIC - set when ftrace_ops is registered to denote dynamically   *           allocated ftrace_ops which need special care - * PER_CPU - set manualy by ftrace_ops user to denote the ftrace_ops - *           could be controlled by following calls: - *             ftrace_function_local_enable - *             ftrace_function_local_disable   * SAVE_REGS - The ftrace_ops wants regs saved at each function called   *            and passed to the callback. If this flag is set, but the   *            architecture does not support passing regs @@ -125,21 +146,20 @@ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);  enum {  	FTRACE_OPS_FL_ENABLED			= 1 << 0,  	FTRACE_OPS_FL_DYNAMIC			= 1 << 1, -	FTRACE_OPS_FL_PER_CPU			= 1 << 2, -	FTRACE_OPS_FL_SAVE_REGS			= 1 << 3, -	FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED	= 1 << 4, -	FTRACE_OPS_FL_RECURSION_SAFE		= 1 << 5, -	FTRACE_OPS_FL_STUB			= 1 << 6, -	FTRACE_OPS_FL_INITIALIZED		= 1 << 7, -	FTRACE_OPS_FL_DELETED			= 1 << 8, -	FTRACE_OPS_FL_ADDING			= 1 << 9, -	FTRACE_OPS_FL_REMOVING			= 1 << 10, -	FTRACE_OPS_FL_MODIFYING			= 1 << 11, -	FTRACE_OPS_FL_ALLOC_TRAMP		= 1 << 12, -	FTRACE_OPS_FL_IPMODIFY			= 1 << 13, -	FTRACE_OPS_FL_PID			= 1 << 14, -	FTRACE_OPS_FL_RCU			= 1 << 15, -	FTRACE_OPS_FL_TRACE_ARRAY		= 1 << 16, +	FTRACE_OPS_FL_SAVE_REGS			= 1 << 2, +	FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED	= 1 << 3, +	FTRACE_OPS_FL_RECURSION_SAFE		= 1 << 4, +	FTRACE_OPS_FL_STUB			= 1 << 5, +	FTRACE_OPS_FL_INITIALIZED		= 1 << 6, +	FTRACE_OPS_FL_DELETED			= 1 << 7, +	FTRACE_OPS_FL_ADDING			= 1 << 8, +	FTRACE_OPS_FL_REMOVING			= 1 << 9, +	FTRACE_OPS_FL_MODIFYING			= 1 << 10, +	FTRACE_OPS_FL_ALLOC_TRAMP		= 1 << 11, +	FTRACE_OPS_FL_IPMODIFY			= 1 << 12, +	FTRACE_OPS_FL_PID			= 1 << 13, +	FTRACE_OPS_FL_RCU			= 1 << 14, +	FTRACE_OPS_FL_TRACE_ARRAY		= 1 << 15,  };  #ifdef CONFIG_DYNAMIC_FTRACE @@ -151,8 +171,10 @@ struct ftrace_ops_hash {  };  void ftrace_free_init_mem(void); +void ftrace_free_mem(struct module *mod, void *start, void *end);  #else  static inline void ftrace_free_init_mem(void) { } +static inline void ftrace_free_mem(struct module *mod, void *start, void *end) { }  #endif  /* @@ -172,7 +194,6 @@ struct ftrace_ops {  	unsigned long			flags;  	void				*private;  	ftrace_func_t			saved_func; -	int __percpu			*disabled;  #ifdef CONFIG_DYNAMIC_FTRACE  	struct ftrace_ops_hash		local_hash;  	struct ftrace_ops_hash		*func_hash; @@ -204,55 +225,6 @@ int register_ftrace_function(struct ftrace_ops *ops);  int unregister_ftrace_function(struct ftrace_ops *ops);  void clear_ftrace_function(void); -/** - * ftrace_function_local_enable - enable ftrace_ops on current cpu - * - * This function enables tracing on current cpu by decreasing - * the per cpu control variable. - * It must be called with preemption disabled and only on ftrace_ops - * registered with FTRACE_OPS_FL_PER_CPU. If called without preemption - * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled. - */ -static inline void ftrace_function_local_enable(struct ftrace_ops *ops) -{ -	if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_PER_CPU))) -		return; - -	(*this_cpu_ptr(ops->disabled))--; -} - -/** - * ftrace_function_local_disable - disable ftrace_ops on current cpu - * - * This function disables tracing on current cpu by increasing - * the per cpu control variable. - * It must be called with preemption disabled and only on ftrace_ops - * registered with FTRACE_OPS_FL_PER_CPU. If called without preemption - * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled. - */ -static inline void ftrace_function_local_disable(struct ftrace_ops *ops) -{ -	if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_PER_CPU))) -		return; - -	(*this_cpu_ptr(ops->disabled))++; -} - -/** - * ftrace_function_local_disabled - returns ftrace_ops disabled value - *                                  on current cpu - * - * This function returns value of ftrace_ops::disabled on current cpu. - * It must be called with preemption disabled and only on ftrace_ops - * registered with FTRACE_OPS_FL_PER_CPU. If called without preemption - * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled. - */ -static inline int ftrace_function_local_disabled(struct ftrace_ops *ops) -{ -	WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_PER_CPU)); -	return *this_cpu_ptr(ops->disabled); -} -  extern void ftrace_stub(unsigned long a0, unsigned long a1,  			struct ftrace_ops *op, struct pt_regs *regs); @@ -270,6 +242,7 @@ static inline int ftrace_nr_registered_ops(void)  static inline void clear_ftrace_function(void) { }  static inline void ftrace_kill(void) { }  static inline void ftrace_free_init_mem(void) { } +static inline void ftrace_free_mem(struct module *mod, void *start, void *end) { }  #endif /* CONFIG_FUNCTION_TRACER */  #ifdef CONFIG_STACK_TRACER @@ -742,7 +715,8 @@ static inline unsigned long get_lock_parent_ip(void)    static inline void time_hardirqs_off(unsigned long a0, unsigned long a1) { }  #endif -#ifdef CONFIG_PREEMPT_TRACER +#if defined(CONFIG_PREEMPT_TRACER) || \ +	(defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_PREEMPTIRQ_EVENTS))    extern void trace_preempt_on(unsigned long a0, unsigned long a1);    extern void trace_preempt_off(unsigned long a0, unsigned long a1);  #else diff --git a/include/linux/ftrace_irq.h b/include/linux/ftrace_irq.h index 4ec2c9b205f2..ccda97dc7f8b 100644 --- a/include/linux/ftrace_irq.h +++ b/include/linux/ftrace_irq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FTRACE_IRQ_H  #define _LINUX_FTRACE_IRQ_H diff --git a/include/linux/futex.h b/include/linux/futex.h index f36bfd26f998..c0fb9a24bbd2 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_FUTEX_H  #define _LINUX_FUTEX_H diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 0c35b6caf0f6..411a84c6c400 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -68,7 +68,7 @@ struct fwnode_reference_args {   * @graph_parse_endpoint: Parse endpoint for port and endpoint id.   */  struct fwnode_operations { -	void (*get)(struct fwnode_handle *fwnode); +	struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);  	void (*put)(struct fwnode_handle *fwnode);  	bool (*device_is_available)(const struct fwnode_handle *fwnode);  	bool (*property_present)(const struct fwnode_handle *fwnode, diff --git a/include/linux/gcd.h b/include/linux/gcd.h index 69f5e8a01bad..cb572677fd7f 100644 --- a/include/linux/gcd.h +++ b/include/linux/gcd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _GCD_H  #define _GCD_H diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h index 6dfec4d638df..872f930f1b06 100644 --- a/include/linux/genalloc.h +++ b/include/linux/genalloc.h @@ -32,6 +32,7 @@  #include <linux/types.h>  #include <linux/spinlock_types.h> +#include <linux/atomic.h>  struct device;  struct device_node; @@ -71,7 +72,7 @@ struct gen_pool {   */  struct gen_pool_chunk {  	struct list_head next_chunk;	/* next chunk in pool */ -	atomic_t avail; +	atomic_long_t avail;  	phys_addr_t phys_addr;		/* physical starting address of memory chunk */  	unsigned long start_addr;	/* start address of memory chunk */  	unsigned long end_addr;		/* end address of memory chunk (inclusive) */ diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h index a4c61cbce777..ecc2928e8046 100644 --- a/include/linux/genetlink.h +++ b/include/linux/genetlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_GENERIC_NETLINK_H  #define __LINUX_GENERIC_NETLINK_H @@ -30,7 +31,7 @@ extern wait_queue_head_t genl_sk_destructing_waitq;   * @p: The pointer to read, prior to dereferencing   *   * Return the value of the specified RCU-protected pointer, but omit - * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because + * both the smp_read_barrier_depends() and the READ_ONCE(), because   * caller holds genl mutex.   */  #define genl_dereference(p)					\ diff --git a/include/linux/genhd.h b/include/linux/genhd.h index ea652bfcd675..5144ebe046c9 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_GENHD_H  #define _LINUX_GENHD_H @@ -140,6 +141,7 @@ struct hd_struct {  #define GENHD_FL_NATIVE_CAPACITY		128  #define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE	256  #define GENHD_FL_NO_PART_SCAN			512 +#define GENHD_FL_HIDDEN				1024  enum {  	DISK_EVENT_MEDIA_CHANGE			= 1 << 0, /* media changed */ @@ -206,6 +208,7 @@ struct gendisk {  #endif	/* CONFIG_BLK_DEV_INTEGRITY */  	int node_id;  	struct badblocks *bb; +	struct lockdep_map lockdep_map;  };  static inline struct gendisk *part_to_disk(struct hd_struct *part) @@ -234,7 +237,7 @@ static inline bool disk_part_scan_enabled(struct gendisk *disk)  static inline dev_t disk_devt(struct gendisk *disk)  { -	return disk_to_dev(disk)->devt; +	return MKDEV(disk->major, disk->first_minor);  }  static inline dev_t part_devt(struct hd_struct *part) @@ -242,6 +245,7 @@ static inline dev_t part_devt(struct hd_struct *part)  	return part_to_dev(part)->devt;  } +extern struct hd_struct *__disk_get_part(struct gendisk *disk, int partno);  extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno);  static inline void disk_put_part(struct hd_struct *part) @@ -590,8 +594,7 @@ extern void __delete_partition(struct percpu_ref *);  extern void delete_partition(struct gendisk *, int);  extern void printk_all_partitions(void); -extern struct gendisk *alloc_disk_node(int minors, int node_id); -extern struct gendisk *alloc_disk(int minors); +extern struct gendisk *__alloc_disk_node(int minors, int node_id);  extern struct kobject *get_disk(struct gendisk *disk);  extern void put_disk(struct gendisk *disk);  extern void blk_register_region(dev_t devt, unsigned long range, @@ -615,6 +618,24 @@ extern ssize_t part_fail_store(struct device *dev,  			       const char *buf, size_t count);  #endif /* CONFIG_FAIL_MAKE_REQUEST */ +#define alloc_disk_node(minors, node_id)				\ +({									\ +	static struct lock_class_key __key;				\ +	const char *__name;						\ +	struct gendisk *__disk;						\ +									\ +	__name = "(gendisk_completion)"#minors"("#node_id")";		\ +									\ +	__disk = __alloc_disk_node(minors, node_id);			\ +									\ +	if (__disk)							\ +		lockdep_init_map(&__disk->lockdep_map, __name, &__key, 0); \ +									\ +	__disk;								\ +}) + +#define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE) +  static inline int hd_ref_init(struct hd_struct *part)  {  	if (percpu_ref_init(&part->ref, __delete_partition, 0, diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h index 377257d8f7e3..604967609e55 100644 --- a/include/linux/genl_magic_func.h +++ b/include/linux/genl_magic_func.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef GENL_MAGIC_FUNC_H  #define GENL_MAGIC_FUNC_H diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h index 6270a56e5edc..5972e4969197 100644 --- a/include/linux/genl_magic_struct.h +++ b/include/linux/genl_magic_struct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef GENL_MAGIC_STRUCT_H  #define GENL_MAGIC_STRUCT_H diff --git a/include/linux/getcpu.h b/include/linux/getcpu.h index c7372d7a97be..c304dcdb4eac 100644 --- a/include/linux/getcpu.h +++ b/include/linux/getcpu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_GETCPU_H  #define _LINUX_GETCPU_H 1 diff --git a/include/linux/gfp.h b/include/linux/gfp.h index f780718b7391..1a4582b44d32 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_GFP_H  #define __LINUX_GFP_H @@ -23,7 +24,6 @@ struct vm_area_struct;  #define ___GFP_HIGH		0x20u  #define ___GFP_IO		0x40u  #define ___GFP_FS		0x80u -#define ___GFP_COLD		0x100u  #define ___GFP_NOWARN		0x200u  #define ___GFP_RETRY_MAYFAIL	0x400u  #define ___GFP_NOFAIL		0x800u @@ -36,7 +36,6 @@ struct vm_area_struct;  #define ___GFP_THISNODE		0x40000u  #define ___GFP_ATOMIC		0x80000u  #define ___GFP_ACCOUNT		0x100000u -#define ___GFP_NOTRACK		0x200000u  #define ___GFP_DIRECT_RECLAIM	0x400000u  #define ___GFP_WRITE		0x800000u  #define ___GFP_KSWAPD_RECLAIM	0x1000000u @@ -192,27 +191,15 @@ struct vm_area_struct;  /*   * Action modifiers   * - * __GFP_COLD indicates that the caller does not expect to be used in the near - *   future. Where possible, a cache-cold page will be returned. - *   * __GFP_NOWARN suppresses allocation failure reports.   *   * __GFP_COMP address compound page metadata.   *   * __GFP_ZERO returns a zeroed page on success. - * - * __GFP_NOTRACK avoids tracking with kmemcheck. - * - * __GFP_NOTRACK_FALSE_POSITIVE is an alias of __GFP_NOTRACK. It's a means of - *   distinguishing in the source between false positives and allocations that - *   cannot be supported (e.g. page tables).   */ -#define __GFP_COLD	((__force gfp_t)___GFP_COLD)  #define __GFP_NOWARN	((__force gfp_t)___GFP_NOWARN)  #define __GFP_COMP	((__force gfp_t)___GFP_COMP)  #define __GFP_ZERO	((__force gfp_t)___GFP_ZERO) -#define __GFP_NOTRACK	((__force gfp_t)___GFP_NOTRACK) -#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)  /* Disable lockdep for GFP context tracking */  #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP) @@ -538,8 +525,8 @@ void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);  extern void __free_pages(struct page *page, unsigned int order);  extern void free_pages(unsigned long addr, unsigned int order); -extern void free_hot_cold_page(struct page *page, bool cold); -extern void free_hot_cold_page_list(struct list_head *list, bool cold); +extern void free_unref_page(struct page *page); +extern void free_unref_page_list(struct list_head *list);  struct page_frag_cache;  extern void __page_frag_cache_drain(struct page *page, unsigned int count); diff --git a/include/linux/glob.h b/include/linux/glob.h index 861d8347d08e..861327b33e41 100644 --- a/include/linux/glob.h +++ b/include/linux/glob.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_GLOB_H  #define _LINUX_GLOB_H diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h index 93e080b39cf6..2835c150c3ff 100644 --- a/include/linux/goldfish.h +++ b/include/linux/goldfish.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_GOLDFISH_H  #define __LINUX_GOLDFISH_H diff --git a/include/linux/gpio-fan.h b/include/linux/gpio-fan.h deleted file mode 100644 index 096659169215..000000000000 --- a/include/linux/gpio-fan.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * include/linux/gpio-fan.h - * - * Platform data structure for GPIO fan driver - * - * This file is licensed under the terms of the GNU General Public - * License version 2.  This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef __LINUX_GPIO_FAN_H -#define __LINUX_GPIO_FAN_H - -struct gpio_fan_alarm { -	unsigned	gpio; -	unsigned	active_low; -}; - -struct gpio_fan_speed { -	int rpm; -	int ctrl_val; -}; - -struct gpio_fan_platform_data { -	int			num_ctrl; -	unsigned		*ctrl;	/* fan control GPIOs. */ -	struct gpio_fan_alarm	*alarm;	/* fan alarm GPIO. */ -	/* -	 * Speed conversion array: rpm from/to GPIO bit field. -	 * This array _must_ be sorted in ascending rpm order. -	 */ -	int			num_speed; -	struct gpio_fan_speed	*speed; -}; - -#endif /* __LINUX_GPIO_FAN_H */ diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h index d90ebbe02ca4..1e1fa0160480 100644 --- a/include/linux/gpio-pxa.h +++ b/include/linux/gpio-pxa.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __GPIO_PXA_H  #define __GPIO_PXA_H diff --git a/include/linux/gpio.h b/include/linux/gpio.h index d12b5d566e4b..8ef7fc0ce0f0 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_GPIO_H  #define __LINUX_GPIO_H diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 8f702fcbe485..7447d85dbe2f 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_GPIO_CONSUMER_H  #define __LINUX_GPIO_CONSUMER_H @@ -28,6 +29,7 @@ struct gpio_descs {  #define GPIOD_FLAGS_BIT_DIR_SET		BIT(0)  #define GPIOD_FLAGS_BIT_DIR_OUT		BIT(1)  #define GPIOD_FLAGS_BIT_DIR_VAL		BIT(2) +#define GPIOD_FLAGS_BIT_OPEN_DRAIN	BIT(3)  /**   * Optional flags that can be passed to one of gpiod_* to configure direction @@ -39,6 +41,11 @@ enum gpiod_flags {  	GPIOD_OUT_LOW	= GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,  	GPIOD_OUT_HIGH	= GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |  			  GPIOD_FLAGS_BIT_DIR_VAL, +	GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET | +			  GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_OPEN_DRAIN, +	GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET | +			  GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_DIR_VAL | +			  GPIOD_FLAGS_BIT_OPEN_DRAIN,  };  #ifdef CONFIG_GPIOLIB @@ -99,10 +106,15 @@ int gpiod_direction_output_raw(struct gpio_desc *desc, int value);  /* Value get/set from non-sleeping context */  int gpiod_get_value(const struct gpio_desc *desc); +int gpiod_get_array_value(unsigned int array_size, +			  struct gpio_desc **desc_array, int *value_array);  void gpiod_set_value(struct gpio_desc *desc, int value);  void gpiod_set_array_value(unsigned int array_size,  			   struct gpio_desc **desc_array, int *value_array);  int gpiod_get_raw_value(const struct gpio_desc *desc); +int gpiod_get_raw_array_value(unsigned int array_size, +			      struct gpio_desc **desc_array, +			      int *value_array);  void gpiod_set_raw_value(struct gpio_desc *desc, int value);  void gpiod_set_raw_array_value(unsigned int array_size,  			       struct gpio_desc **desc_array, @@ -110,11 +122,17 @@ void gpiod_set_raw_array_value(unsigned int array_size,  /* Value get/set from sleeping context */  int gpiod_get_value_cansleep(const struct gpio_desc *desc); +int gpiod_get_array_value_cansleep(unsigned int array_size, +				   struct gpio_desc **desc_array, +				   int *value_array);  void gpiod_set_value_cansleep(struct gpio_desc *desc, int value);  void gpiod_set_array_value_cansleep(unsigned int array_size,  				    struct gpio_desc **desc_array,  				    int *value_array);  int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc); +int gpiod_get_raw_array_value_cansleep(unsigned int array_size, +				       struct gpio_desc **desc_array, +				       int *value_array);  void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value);  void gpiod_set_raw_array_value_cansleep(unsigned int array_size,  					struct gpio_desc **desc_array, @@ -305,6 +323,14 @@ static inline int gpiod_get_value(const struct gpio_desc *desc)  	WARN_ON(1);  	return 0;  } +static inline int gpiod_get_array_value(unsigned int array_size, +					struct gpio_desc **desc_array, +					int *value_array) +{ +	/* GPIO can never have been requested */ +	WARN_ON(1); +	return 0; +}  static inline void gpiod_set_value(struct gpio_desc *desc, int value)  {  	/* GPIO can never have been requested */ @@ -323,6 +349,14 @@ static inline int gpiod_get_raw_value(const struct gpio_desc *desc)  	WARN_ON(1);  	return 0;  } +static inline int gpiod_get_raw_array_value(unsigned int array_size, +					    struct gpio_desc **desc_array, +					    int *value_array) +{ +	/* GPIO can never have been requested */ +	WARN_ON(1); +	return 0; +}  static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)  {  	/* GPIO can never have been requested */ @@ -342,6 +376,14 @@ static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)  	WARN_ON(1);  	return 0;  } +static inline int gpiod_get_array_value_cansleep(unsigned int array_size, +				     struct gpio_desc **desc_array, +				     int *value_array) +{ +	/* GPIO can never have been requested */ +	WARN_ON(1); +	return 0; +}  static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)  {  	/* GPIO can never have been requested */ @@ -360,6 +402,14 @@ static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)  	WARN_ON(1);  	return 0;  } +static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size, +					       struct gpio_desc **desc_array, +					       int *value_array) +{ +	/* GPIO can never have been requested */ +	WARN_ON(1); +	return 0; +}  static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,  						int value)  { diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index c97f8325e8bf..55e672592fa9 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_GPIO_DRIVER_H  #define __LINUX_GPIO_DRIVER_H @@ -19,6 +20,131 @@ struct module;  #ifdef CONFIG_GPIOLIB +#ifdef CONFIG_GPIOLIB_IRQCHIP +/** + * struct gpio_irq_chip - GPIO interrupt controller + */ +struct gpio_irq_chip { +	/** +	 * @chip: +	 * +	 * GPIO IRQ chip implementation, provided by GPIO driver. +	 */ +	struct irq_chip *chip; + +	/** +	 * @domain: +	 * +	 * Interrupt translation domain; responsible for mapping between GPIO +	 * hwirq number and Linux IRQ number. +	 */ +	struct irq_domain *domain; + +	/** +	 * @domain_ops: +	 * +	 * Table of interrupt domain operations for this IRQ chip. +	 */ +	const struct irq_domain_ops *domain_ops; + +	/** +	 * @handler: +	 * +	 * The IRQ handler to use (often a predefined IRQ core function) for +	 * GPIO IRQs, provided by GPIO driver. +	 */ +	irq_flow_handler_t handler; + +	/** +	 * @default_type: +	 * +	 * Default IRQ triggering type applied during GPIO driver +	 * initialization, provided by GPIO driver. +	 */ +	unsigned int default_type; + +	/** +	 * @lock_key: +	 * +	 * Per GPIO IRQ chip lockdep class. +	 */ +	struct lock_class_key *lock_key; + +	/** +	 * @parent_handler: +	 * +	 * The interrupt handler for the GPIO chip's parent interrupts, may be +	 * NULL if the parent interrupts are nested rather than cascaded. +	 */ +	irq_flow_handler_t parent_handler; + +	/** +	 * @parent_handler_data: +	 * +	 * Data associated, and passed to, the handler for the parent +	 * interrupt. +	 */ +	void *parent_handler_data; + +	/** +	 * @num_parents: +	 * +	 * The number of interrupt parents of a GPIO chip. +	 */ +	unsigned int num_parents; + +	/** +	 * @parents: +	 * +	 * A list of interrupt parents of a GPIO chip. This is owned by the +	 * driver, so the core will only reference this list, not modify it. +	 */ +	unsigned int *parents; + +	/** +	 * @map: +	 * +	 * A list of interrupt parents for each line of a GPIO chip. +	 */ +	unsigned int *map; + +	/** +	 * @threaded: +	 * +	 * True if set the interrupt handling uses nested threads. +	 */ +	bool threaded; + +	/** +	 * @need_valid_mask: +	 * +	 * If set core allocates @valid_mask with all bits set to one. +	 */ +	bool need_valid_mask; + +	/** +	 * @valid_mask: +	 * +	 * If not %NULL holds bitmask of GPIOs which are valid to be included +	 * in IRQ domain of the chip. +	 */ +	unsigned long *valid_mask; + +	/** +	 * @first: +	 * +	 * Required for static IRQ allocation. If set, irq_domain_add_simple() +	 * will allocate and map all IRQs during initialization. +	 */ +	unsigned int first; +}; + +static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip) +{ +	return container_of(chip, struct gpio_irq_chip, chip); +} +#endif +  /**   * struct gpio_chip - abstract a GPIO controller   * @label: a functional name for the GPIO device, such as a part @@ -35,6 +161,8 @@ struct module;   * @direction_input: configures signal "offset" as input, or returns error   * @direction_output: configures signal "offset" as output, or returns error   * @get: returns value for signal "offset", 0=low, 1=high, or negative error + * @get_multiple: reads values for multiple signals defined by "mask" and + *	stores them in "bits", returns 0 on success or negative error   * @set: assigns output value for signal "offset"   * @set_multiple: assigns output values for multiple signals defined by "mask"   * @set_config: optional hook for all kinds of settings. Uses the same @@ -65,9 +193,9 @@ struct module;   *	registers.   * @read_reg: reader function for generic GPIO   * @write_reg: writer function for generic GPIO - * @pin2mask: some generic GPIO controllers work with the big-endian bits - *	notation, e.g. in a 8-bits register, GPIO7 is the least significant - *	bit. This callback assigns the right bit mask. + * @be_bits: if the generic GPIO has big endian bit order (bit 31 is representing + *	line 0, bit 30 is line 1 ... bit 0 is line 31) this is set to true by the + *	generic GPIO core. It is for internal housekeeping only.   * @reg_dat: data (in) register for generic GPIO   * @reg_set: output set register (out=high) for generic GPIO   * @reg_clr: output clear register (out=low) for generic GPIO @@ -80,23 +208,6 @@ struct module;   *	safely.   * @bgpio_dir: shadowed direction register for generic GPIO to clear/set   *	direction safely. - * @irqchip: GPIO IRQ chip impl, provided by GPIO driver - * @irqdomain: Interrupt translation domain; responsible for mapping - *	between GPIO hwirq number and linux irq number - * @irq_base: first linux IRQ number assigned to GPIO IRQ chip (deprecated) - * @irq_handler: the irq handler to use (often a predefined irq core function) - *	for GPIO IRQs, provided by GPIO driver - * @irq_default_type: default IRQ triggering type applied during GPIO driver - *	initialization, provided by GPIO driver - * @irq_chained_parent: GPIO IRQ chip parent/bank linux irq number, - *	provided by GPIO driver for chained interrupt (not for nested - *	interrupts). - * @irq_nested: True if set the interrupt handling is nested. - * @irq_need_valid_mask: If set core allocates @irq_valid_mask with all - *	bits set to one - * @irq_valid_mask: If not %NULL holds bitmask of GPIOs which are valid to - *	be included in IRQ domain of the chip - * @lock_key: per GPIO IRQ chip lockdep class   *   * A gpio_chip can help platforms abstract various sources of GPIOs so   * they can all be accessed through a common programing interface. @@ -126,6 +237,9 @@ struct gpio_chip {  						unsigned offset, int value);  	int			(*get)(struct gpio_chip *chip,  						unsigned offset); +	int			(*get_multiple)(struct gpio_chip *chip, +						unsigned long *mask, +						unsigned long *bits);  	void			(*set)(struct gpio_chip *chip,  						unsigned offset, int value);  	void			(*set_multiple)(struct gpio_chip *chip, @@ -147,7 +261,7 @@ struct gpio_chip {  #if IS_ENABLED(CONFIG_GPIO_GENERIC)  	unsigned long (*read_reg)(void __iomem *reg);  	void (*write_reg)(void __iomem *reg, unsigned long data); -	unsigned long (*pin2mask)(struct gpio_chip *gc, unsigned int pin); +	bool be_bits;  	void __iomem *reg_dat;  	void __iomem *reg_set;  	void __iomem *reg_clr; @@ -163,16 +277,14 @@ struct gpio_chip {  	 * With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib  	 * to handle IRQs for most practical cases.  	 */ -	struct irq_chip		*irqchip; -	struct irq_domain	*irqdomain; -	unsigned int		irq_base; -	irq_flow_handler_t	irq_handler; -	unsigned int		irq_default_type; -	unsigned int		irq_chained_parent; -	bool			irq_nested; -	bool			irq_need_valid_mask; -	unsigned long		*irq_valid_mask; -	struct lock_class_key	*lock_key; + +	/** +	 * @irq: +	 * +	 * Integrates interrupt chip functionality with the GPIO chip. Can be +	 * used to handle IRQs for most practical cases. +	 */ +	struct gpio_irq_chip irq;  #endif  #if defined(CONFIG_OF_GPIO) @@ -210,7 +322,41 @@ extern const char *gpiochip_is_requested(struct gpio_chip *chip,  			unsigned offset);  /* add/remove chips */ -extern int gpiochip_add_data(struct gpio_chip *chip, void *data); +extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, +				      struct lock_class_key *lock_key); + +/** + * gpiochip_add_data() - register a gpio_chip + * @chip: the chip to register, with chip->base initialized + * @data: driver-private data associated with this chip + * + * Context: potentially before irqs will work + * + * When gpiochip_add_data() is called very early during boot, so that GPIOs + * can be freely used, the chip->parent device must be registered before + * the gpio framework's arch_initcall().  Otherwise sysfs initialization + * for GPIOs will fail rudely. + * + * gpiochip_add_data() must only be called after gpiolib initialization, + * ie after core_initcall(). + * + * If chip->base is negative, this requests dynamic assignment of + * a range of valid GPIOs. + * + * Returns: + * A negative errno if the chip can't be registered, such as because the + * chip->base is invalid or already associated with a different chip. + * Otherwise it returns zero as a success code. + */ +#ifdef CONFIG_LOCKDEP +#define gpiochip_add_data(chip, data) ({		\ +		static struct lock_class_key key;	\ +		gpiochip_add_data_with_key(chip, data, &key);	\ +	}) +#else +#define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL) +#endif +  static inline int gpiochip_add(struct gpio_chip *chip)  {  	return gpiochip_add_data(chip, NULL); @@ -264,6 +410,10 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev,  #ifdef CONFIG_GPIOLIB_IRQCHIP +int gpiochip_irq_map(struct irq_domain *d, unsigned int irq, +		     irq_hw_number_t hwirq); +void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq); +  void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,  		struct irq_chip *irqchip,  		unsigned int parent_irq, @@ -278,7 +428,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,  			     unsigned int first_irq,  			     irq_flow_handler_t handler,  			     unsigned int type, -			     bool nested, +			     bool threaded,  			     struct lock_class_key *lock_key);  #ifdef CONFIG_LOCKDEP diff --git a/include/linux/gpio/gpio-reg.h b/include/linux/gpio/gpio-reg.h index 90e0b9060e6d..5c6efd394cb0 100644 --- a/include/linux/gpio/gpio-reg.h +++ b/include/linux/gpio/gpio-reg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef GPIO_REG_H  #define GPIO_REG_H diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h index ba4ccfd900f9..846be7c69a52 100644 --- a/include/linux/gpio/machine.h +++ b/include/linux/gpio/machine.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_GPIO_MACHINE_H  #define __LINUX_GPIO_MACHINE_H @@ -10,7 +11,7 @@ enum gpio_lookup_flags {  	GPIO_OPEN_DRAIN = (1 << 1),  	GPIO_OPEN_SOURCE = (1 << 2),  	GPIO_SLEEP_MAINTAIN_VALUE = (0 << 3), -	GPIO_SLEEP_MAY_LOOSE_VALUE = (1 << 3), +	GPIO_SLEEP_MAY_LOSE_VALUE = (1 << 3),  };  /** diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index 0b71024c082c..d06bf77400f1 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _GPIO_KEYS_H  #define _GPIO_KEYS_H diff --git a/include/linux/gpio_mouse.h b/include/linux/gpio_mouse.h deleted file mode 100644 index 44ed7aa14d85..000000000000 --- a/include/linux/gpio_mouse.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Driver for simulating a mouse on GPIO lines. - * - * Copyright (C) 2007 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef _GPIO_MOUSE_H -#define _GPIO_MOUSE_H - -#define GPIO_MOUSE_POLARITY_ACT_HIGH	0x00 -#define GPIO_MOUSE_POLARITY_ACT_LOW	0x01 - -#define GPIO_MOUSE_PIN_UP	0 -#define GPIO_MOUSE_PIN_DOWN	1 -#define GPIO_MOUSE_PIN_LEFT	2 -#define GPIO_MOUSE_PIN_RIGHT	3 -#define GPIO_MOUSE_PIN_BLEFT	4 -#define GPIO_MOUSE_PIN_BMIDDLE	5 -#define GPIO_MOUSE_PIN_BRIGHT	6 -#define GPIO_MOUSE_PIN_MAX	7 - -/** - * struct gpio_mouse_platform_data - * @scan_ms: integer in ms specifying the scan periode. - * @polarity: Pin polarity, active high or low. - * @up: GPIO line for up value. - * @down: GPIO line for down value. - * @left: GPIO line for left value. - * @right: GPIO line for right value. - * @bleft: GPIO line for left button. - * @bmiddle: GPIO line for middle button. - * @bright: GPIO line for right button. - * - * This struct must be added to the platform_device in the board code. - * It is used by the gpio_mouse driver to setup GPIO lines and to - * calculate mouse movement. - */ -struct gpio_mouse_platform_data { -	int scan_ms; -	int polarity; - -	union { -		struct { -			int up; -			int down; -			int left; -			int right; - -			int bleft; -			int bmiddle; -			int bright; -		}; -		int pins[GPIO_MOUSE_PIN_MAX]; -	}; -}; - -#endif /* _GPIO_MOUSE_H */ diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index c683996110b1..0fbbcdf0c178 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_HARDIRQ_H  #define LINUX_HARDIRQ_H diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h index 082dc1bd0801..417d2c4bc60d 100644 --- a/include/linux/hashtable.h +++ b/include/linux/hashtable.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Statically sized hash table implementation   * (C) 2012  Sasha Levin <levinsasha928@gmail.com> diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h index be3be25bb898..d4d633a49d36 100644 --- a/include/linux/hdlcdrv.h +++ b/include/linux/hdlcdrv.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * hdlcdrv.h  -- HDLC packet radio network driver.   * The Linux soundcard driver for 1200 baud and 9600 baud packet radio diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index fc7aae64dcde..331dc377c275 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h @@ -231,6 +231,7 @@ struct hid_sensor_common {  	unsigned usage_id;  	atomic_t data_ready;  	atomic_t user_requested_state; +	atomic_t runtime_pm_enable;  	int poll_interval;  	int raw_hystersis;  	int latency_ms; diff --git a/include/linux/hid.h b/include/linux/hid.h index ab05a86269dc..d491027a7c22 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -289,6 +289,7 @@ struct hid_item {  #define HID_DG_DEVICEINDEX	0x000d0053  #define HID_DG_CONTACTCOUNT	0x000d0054  #define HID_DG_CONTACTMAX	0x000d0055 +#define HID_DG_SCANTIME		0x000d0056  #define HID_DG_BUTTONTYPE	0x000d0059  #define HID_DG_BARRELSWITCH2	0x000d005a  #define HID_DG_TOOLSERIALNUMBER	0x000d005b @@ -753,6 +754,7 @@ struct hid_driver {   * @stop: called on remove   * @open: called by input layer on open   * @close: called by input layer on close + * @power: request underlying hardware to enter requested power mode   * @parse: this method is called only once to parse the device data,   *	   shouldn't allocate anything to not leak memory   * @request: send report request to device (e.g. feature report) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index bb3f3297062a..776f90f3a1cd 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_HIGHMEM_H  #define _LINUX_HIGHMEM_H diff --git a/include/linux/highuid.h b/include/linux/highuid.h index 434e56246f67..50d383fd674d 100644 --- a/include/linux/highuid.h +++ b/include/linux/highuid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_HIGHUID_H  #define _LINUX_HIGHUID_H diff --git a/include/linux/hmm.h b/include/linux/hmm.h index 96e69979f84d..325017ad9311 100644 --- a/include/linux/hmm.h +++ b/include/linux/hmm.h @@ -471,9 +471,9 @@ static inline void hmm_devmem_page_set_drvdata(struct page *page,   * @page: pointer to struct page   * Return: driver data value   */ -static inline unsigned long hmm_devmem_page_get_drvdata(struct page *page) +static inline unsigned long hmm_devmem_page_get_drvdata(const struct page *page)  { -	unsigned long *drvdata = (unsigned long *)&page->pgmap; +	const unsigned long *drvdata = (const unsigned long *)&page->pgmap;  	return drvdata[1];  } diff --git a/include/linux/host1x.h b/include/linux/host1x.h index 630b1a98ab58..ddf7f9ca86cc 100644 --- a/include/linux/host1x.h +++ b/include/linux/host1x.h @@ -157,7 +157,7 @@ int host1x_syncpt_incr(struct host1x_syncpt *sp);  u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);  int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,  		       u32 *value); -struct host1x_syncpt *host1x_syncpt_request(struct device *dev, +struct host1x_syncpt *host1x_syncpt_request(struct host1x_client *client,  					    unsigned long flags);  void host1x_syncpt_free(struct host1x_syncpt *sp); diff --git a/include/linux/hpet.h b/include/linux/hpet.h index 9427ab4e01c3..8604564b985d 100644 --- a/include/linux/hpet.h +++ b/include/linux/hpet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef	__HPET__  #define	__HPET__ 1 diff --git a/include/linux/htcpld.h b/include/linux/htcpld.h index ab3f6cb4dddc..842fce69ac06 100644 --- a/include/linux/htcpld.h +++ b/include/linux/htcpld.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_HTCPLD_H  #define __LINUX_HTCPLD_H diff --git a/include/linux/htirq.h b/include/linux/htirq.h deleted file mode 100644 index d4a527e58434..000000000000 --- a/include/linux/htirq.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef LINUX_HTIRQ_H -#define LINUX_HTIRQ_H - -struct pci_dev; -struct irq_data; - -struct ht_irq_msg { -	u32	address_lo;	/* low 32 bits of the ht irq message */ -	u32	address_hi;	/* high 32 bits of the it irq message */ -}; - -typedef void (ht_irq_update_t)(struct pci_dev *dev, int irq, -			       struct ht_irq_msg *msg); - -struct ht_irq_cfg { -	struct pci_dev *dev; -	 /* Update callback used to cope with buggy hardware */ -	ht_irq_update_t *update; -	unsigned pos; -	unsigned idx; -	struct ht_irq_msg msg; -}; - -/* Helper functions.. */ -void fetch_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg); -void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg); -void mask_ht_irq(struct irq_data *data); -void unmask_ht_irq(struct irq_data *data); - -/* The arch hook for getting things started */ -int arch_setup_ht_irq(int idx, int pos, struct pci_dev *dev, -		      ht_irq_update_t *update); -void arch_teardown_ht_irq(unsigned int irq); - -/* For drivers of buggy hardware */ -int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update); - -#endif /* LINUX_HTIRQ_H */ diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 14bc21c2ee7f..a8a126259bc4 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_HUGE_MM_H  #define _LINUX_HUGE_MM_H @@ -221,7 +222,7 @@ extern struct page *huge_zero_page;  static inline bool is_huge_zero_page(struct page *page)  { -	return ACCESS_ONCE(huge_zero_page) == page; +	return READ_ONCE(huge_zero_page) == page;  }  static inline bool is_huge_zero_pmd(pmd_t pmd) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 8bbbd37ab105..fbf5b31d47ee 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_HUGETLB_H  #define _LINUX_HUGETLB_H diff --git a/include/linux/hugetlb_inline.h b/include/linux/hugetlb_inline.h index a4e7ca0f3585..0660a03d37d9 100644 --- a/include/linux/hugetlb_inline.h +++ b/include/linux/hugetlb_inline.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_HUGETLB_INLINE_H  #define _LINUX_HUGETLB_INLINE_H diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h index 0464c85e63fd..cf045885a499 100644 --- a/include/linux/hw_breakpoint.h +++ b/include/linux/hw_breakpoint.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_HW_BREAKPOINT_H  #define _LINUX_HW_BREAKPOINT_H diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index c458d7b7ad19..f3e97c5f94c9 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -719,6 +719,10 @@ struct vmbus_channel {  	struct vmbus_close_msg close_msg; +	/* Statistics */ +	u64	interrupts;	/* Host to Guest interrupts */ +	u64	sig_events;	/* Guest to Host events */ +  	/* Channel callback's invoked in softirq context */  	struct tasklet_struct callback_event;  	void (*onchannel_callback)(void *context); @@ -829,6 +833,11 @@ struct vmbus_channel {  	struct rcu_head rcu;  	/* +	 * For sysfs per-channel properties. +	 */ +	struct kobject			kobj; + +	/*  	 * For performance critical channels (storage, networking  	 * etc,), Hyper-V has a mechanism to enhance the throughput  	 * at the expense of latency: @@ -1089,6 +1098,7 @@ struct hv_device {  	struct device device;  	struct vmbus_channel *channel; +	struct kset	     *channels_kset;  }; @@ -1403,7 +1413,7 @@ extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, u8 *buf,  				const int *srv_version, int srv_vercnt,  				int *nego_fw_version, int *nego_srv_version); -void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid); +void hv_process_channel_removal(u32 relid);  void vmbus_setevent(struct vmbus_channel *channel);  /* diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h index 3fa5ef2b3759..b19563f9a8eb 100644 --- a/include/linux/hypervisor.h +++ b/include/linux/hypervisor.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_HYPEVISOR_H  #define __LINUX_HYPEVISOR_H @@ -6,8 +7,12 @@   *		Juergen Gross <jgross@suse.com>   */ -#ifdef CONFIG_HYPERVISOR_GUEST -#include <asm/hypervisor.h> +#ifdef CONFIG_X86 +#include <asm/x86_init.h> +static inline void hypervisor_pin_vcpu(int cpu) +{ +	x86_platform.hyper.pin_vcpu(cpu); +}  #else  static inline void hypervisor_pin_vcpu(int cpu)  { diff --git a/include/linux/i2c-algo-pca.h b/include/linux/i2c-algo-pca.h index a3c3ecd59f08..d03071732db4 100644 --- a/include/linux/i2c-algo-pca.h +++ b/include/linux/i2c-algo-pca.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_I2C_ALGO_PCA_H  #define _LINUX_I2C_ALGO_PCA_H diff --git a/include/linux/i2c-gpio.h b/include/linux/i2c-gpio.h index c1bcb1f1d73b..352c1426fd4d 100644 --- a/include/linux/i2c-gpio.h +++ b/include/linux/i2c-gpio.h @@ -12,8 +12,6 @@  /**   * struct i2c_gpio_platform_data - Platform-dependent data for i2c-gpio - * @sda_pin: GPIO pin ID to use for SDA - * @scl_pin: GPIO pin ID to use for SCL   * @udelay: signal toggle delay. SCL frequency is (500 / udelay) kHz   * @timeout: clock stretching timeout in jiffies. If the slave keeps   *	SCL low for longer than this, the transfer will time out. @@ -26,8 +24,6 @@   * @scl_is_output_only: SCL output drivers cannot be turned off.   */  struct i2c_gpio_platform_data { -	unsigned int	sda_pin; -	unsigned int	scl_pin;  	int		udelay;  	int		timeout;  	unsigned int	sda_is_open_drain:1; diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h index babe0cf6d56b..3444265ee8ee 100644 --- a/include/linux/i2c-omap.h +++ b/include/linux/i2c-omap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __I2C_OMAP_H__  #define __I2C_OMAP_H__ diff --git a/include/linux/i2c-pca-platform.h b/include/linux/i2c-pca-platform.h index aba33759dec4..0e5f7c77d1d8 100644 --- a/include/linux/i2c-pca-platform.h +++ b/include/linux/i2c-pca-platform.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef I2C_PCA9564_PLATFORM_H  #define I2C_PCA9564_PLATFORM_H diff --git a/include/linux/i2c-pxa.h b/include/linux/i2c-pxa.h index 41dcdfe7f625..a897e2b507b6 100644 --- a/include/linux/i2c-pxa.h +++ b/include/linux/i2c-pxa.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_I2C_ALGO_PXA_H  #define _LINUX_I2C_ALGO_PXA_H diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h index a1385023a29b..fb0e040b1abb 100644 --- a/include/linux/i2c-smbus.h +++ b/include/linux/i2c-smbus.h @@ -42,7 +42,6 @@   * properly set.   */  struct i2c_smbus_alert_setup { -	unsigned int		alert_edge_triggered:1;  	int			irq;  }; @@ -50,4 +49,13 @@ struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter,  					 struct i2c_smbus_alert_setup *setup);  int i2c_handle_smbus_alert(struct i2c_client *ara); +#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF) +int of_i2c_setup_smbus_alert(struct i2c_adapter *adap); +#else +static inline int of_i2c_setup_smbus_alert(struct i2c_adapter *adap) +{ +	return 0; +} +#endif +  #endif /* _LINUX_I2C_SMBUS_H */ diff --git a/include/linux/i2c.h b/include/linux/i2c.h index d501d3956f13..0f774406fad0 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -304,6 +304,7 @@ static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }   * @type: chip type, to initialize i2c_client.name   * @flags: to initialize i2c_client.flags   * @addr: stored in i2c_client.addr + * @dev_name: Overrides the default <busnr>-<addr> dev_name if set   * @platform_data: stored in i2c_client.dev.platform_data   * @archdata: copied into i2c_client.dev.archdata   * @of_node: pointer to OpenFirmware device node @@ -328,6 +329,7 @@ struct i2c_board_info {  	char		type[I2C_NAME_SIZE];  	unsigned short	flags;  	unsigned short	addr; +	const char	*dev_name;  	void		*platform_data;  	struct dev_archdata	*archdata;  	struct device_node *of_node; diff --git a/include/linux/i7300_idle.h b/include/linux/i7300_idle.h index 1587b7dec505..4dbe651f71f5 100644 --- a/include/linux/i7300_idle.h +++ b/include/linux/i7300_idle.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef I7300_IDLE_H  #define I7300_IDLE_H diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index 57086e9fc64c..a8f888976137 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ICMPV6_H  #define _LINUX_ICMPV6_H diff --git a/include/linux/ide.h b/include/linux/ide.h index dc152e4b7f73..771989d25ef8 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IDE_H  #define _IDE_H  /* @@ -1211,7 +1212,7 @@ extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);  extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); -extern void ide_timer_expiry(unsigned long); +extern void ide_timer_expiry(struct timer_list *t);  extern irqreturn_t ide_intr(int irq, void *dev_id);  extern void do_ide_request(struct request_queue *);  extern void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq); diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 55a604ad459f..ee6657a0ed69 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -2445,6 +2445,7 @@ enum ieee80211_sa_query_action {  #define WLAN_OUI_TYPE_MICROSOFT_WPA	1  #define WLAN_OUI_TYPE_MICROSOFT_WMM	2  #define WLAN_OUI_TYPE_MICROSOFT_WPS	4 +#define WLAN_OUI_TYPE_MICROSOFT_TPC	8  /*   * WMM/802.11e Tspec Element diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 3355efc89781..6756fea18b69 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -31,7 +31,7 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb)  	return (struct arphdr *)skb_network_header(skb);  } -static inline int arp_hdr_len(struct net_device *dev) +static inline unsigned int arp_hdr_len(const struct net_device *dev)  {  	switch (dev->type) {  #if IS_ENABLED(CONFIG_FIREWIRE_NET) diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 3cd18ac0697f..02639ebea2f0 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h @@ -49,6 +49,7 @@ struct br_ip_list {  #define BR_MULTICAST_TO_UNICAST	BIT(12)  #define BR_VLAN_TUNNEL		BIT(13)  #define BR_BCAST_FLOOD		BIT(14) +#define BR_NEIGH_SUPPRESS	BIT(15)  #define BR_DEFAULT_AGEING_TIME	(300 * HZ) @@ -63,6 +64,7 @@ int br_multicast_list_adjacent(struct net_device *dev,  bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto);  bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto);  bool br_multicast_enabled(const struct net_device *dev); +bool br_multicast_router(const struct net_device *dev);  #else  static inline int br_multicast_list_adjacent(struct net_device *dev,  					     struct list_head *br_ip_list) @@ -83,6 +85,10 @@ static inline bool br_multicast_enabled(const struct net_device *dev)  {  	return false;  } +static inline bool br_multicast_router(const struct net_device *dev) +{ +	return false; +}  #endif  #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h index 46df7e565d6f..82a1b4e93570 100644 --- a/include/linux/if_frad.h +++ b/include/linux/if_frad.h @@ -83,6 +83,7 @@ struct frad_local     /* fields that are used by the Sangoma SDLA cards */     struct timer_list timer; +   struct net_device *dev;     int               type;		/* adapter type */     int               state;		/* state of the S502/8 control latch */     int               buffer;		/* current buffer for S508 firmware */ diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 0b17c585b5cd..4c54611e03e9 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IF_LINK_H  #define _LINUX_IF_LINK_H diff --git a/include/linux/if_ltalk.h b/include/linux/if_ltalk.h index 81e434c50790..4cc1c0b77870 100644 --- a/include/linux/if_ltalk.h +++ b/include/linux/if_ltalk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_LTALK_H  #define __LINUX_LTALK_H diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index c9ec1343d187..bedf54b6f943 100644 --- a/include/linux/if_macvlan.h +++ b/include/linux/if_macvlan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IF_MACVLAN_H  #define _LINUX_IF_MACVLAN_H @@ -10,13 +11,6 @@  #include <linux/u64_stats_sync.h>  struct macvlan_port; -struct macvtap_queue; - -/* - * Maximum times a macvtap device can be opened. This can be used to - * configure the number of receive queue, e.g. for multiqueue virtio. - */ -#define MAX_TAP_QUEUES	256  #define MACVLAN_MC_FILTER_BITS	8  #define MACVLAN_MC_FILTER_SZ	(1 << MACVLAN_MC_FILTER_BITS) @@ -35,14 +29,6 @@ struct macvlan_dev {  	netdev_features_t	set_features;  	enum macvlan_mode	mode;  	u16			flags; -	/* This array tracks active taps. */ -	struct tap_queue	__rcu *taps[MAX_TAP_QUEUES]; -	/* This list tracks all taps (both enabled and disabled) */ -	struct list_head	queue_list; -	int			numvtaps; -	int			numqueues; -	netdev_features_t	tap_features; -	int			minor;  	int			nest_level;  #ifdef CONFIG_NET_POLL_CONTROLLER  	struct netpoll		*netpoll; @@ -72,7 +58,8 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,  extern void macvlan_common_setup(struct net_device *dev);  extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, -				  struct nlattr *tb[], struct nlattr *data[]); +				  struct nlattr *tb[], struct nlattr *data[], +				  struct netlink_ext_ack *extack);  extern void macvlan_count_rx(const struct macvlan_dev *vlan,  			     unsigned int len, bool success, diff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h index bbcdb0a767d8..2d8486168ec5 100644 --- a/include/linux/if_phonet.h +++ b/include/linux/if_phonet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * File: if_phonet.h   * @@ -10,5 +11,5 @@  #include <uapi/linux/if_phonet.h> -extern struct header_ops phonet_header_ops; +extern const struct header_ops phonet_header_ops;  #endif diff --git a/include/linux/if_tap.h b/include/linux/if_tap.h index 4837157da0dc..3ecef57c31e3 100644 --- a/include/linux/if_tap.h +++ b/include/linux/if_tap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IF_TAP_H_  #define _LINUX_IF_TAP_H_ @@ -22,6 +23,10 @@ static inline struct skb_array *tap_get_skb_array(struct file *f)  #include <net/sock.h>  #include <linux/skb_array.h> +/* + * Maximum times a tap device can be opened. This can be used to + * configure the number of receive queue, e.g. for multiqueue virtio. + */  #define MAX_TAP_QUEUES 256  struct tap_queue; @@ -73,8 +78,8 @@ void tap_del_queues(struct tap_dev *tap);  int tap_get_minor(dev_t major, struct tap_dev *tap);  void tap_free_minor(dev_t major, struct tap_dev *tap);  int tap_queue_resize(struct tap_dev *tap); -int tap_create_cdev(struct cdev *tap_cdev, -		    dev_t *tap_major, const char *device_name); +int tap_create_cdev(struct cdev *tap_cdev, dev_t *tap_major, +		    const char *device_name, struct module *module);  void tap_destroy_cdev(dev_t major, struct cdev *tap_cdev);  #endif /*_LINUX_IF_TAP_H_*/ diff --git a/include/linux/if_team.h b/include/linux/if_team.h index 30294603526f..d95cae09dea0 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h @@ -247,7 +247,7 @@ static inline struct team_port *team_get_port_by_index(struct team *team,  static inline int team_num_to_port_index(struct team *team, unsigned int num)  { -	int en_port_count = ACCESS_ONCE(team->en_port_count); +	int en_port_count = READ_ONCE(team->en_port_count);  	if (unlikely(!en_port_count))  		return 0; diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index 712710bc0580..26606523eca4 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IF_TUNNEL_H_  #define _IF_TUNNEL_H_ diff --git a/include/linux/ihex.h b/include/linux/ihex.h index 31d8629e75a1..75c194391869 100644 --- a/include/linux/ihex.h +++ b/include/linux/ihex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Compact binary representation of ihex records. Some devices need their   * firmware loaded in strange orders rather than a single big blob, but diff --git a/include/linux/iio/buffer_impl.h b/include/linux/iio/buffer_impl.h index 8daba198fafa..b9e22b7e2f28 100644 --- a/include/linux/iio/buffer_impl.h +++ b/include/linux/iio/buffer_impl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IIO_BUFFER_GENERIC_IMPL_H_  #define _IIO_BUFFER_GENERIC_IMPL_H_  #include <linux/sysfs.h> diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 7b0fa8b5c120..f9bd6e8ab138 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h @@ -131,28 +131,39 @@ struct st_sensor_das {  };  /** + * struct st_sensor_int_drdy - ST sensor device drdy line parameters + * @addr: address of INT drdy register. + * @mask: mask to enable drdy line. + * @addr_od: address to enable/disable Open Drain on the INT line. + * @mask_od: mask to enable/disable Open Drain on the INT line. + */ +struct st_sensor_int_drdy { +	u8 addr; +	u8 mask; +	u8 addr_od; +	u8 mask_od; +}; + +/**   * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt - * @addr: address of the register. - * @mask_int1: mask to enable/disable IRQ on INT1 pin. - * @mask_int2: mask to enable/disable IRQ on INT2 pin. + * struct int1 - data-ready configuration register for INT1 pin. + * struct int2 - data-ready configuration register for INT2 pin.   * @addr_ihl: address to enable/disable active low on the INT lines.   * @mask_ihl: mask to enable/disable active low on the INT lines. - * @addr_od: address to enable/disable Open Drain on the INT lines. - * @mask_od: mask to enable/disable Open Drain on the INT lines. - * @addr_stat_drdy: address to read status of DRDY (data ready) interrupt + * struct stat_drdy - status register of DRDY (data ready) interrupt.   * struct ig1 - represents the Interrupt Generator 1 of sensors.   * @en_addr: address of the enable ig1 register.   * @en_mask: mask to write the on/off value for enable.   */  struct st_sensor_data_ready_irq { -	u8 addr; -	u8 mask_int1; -	u8 mask_int2; +	struct st_sensor_int_drdy int1; +	struct st_sensor_int_drdy int2;  	u8 addr_ihl;  	u8 mask_ihl; -	u8 addr_od; -	u8 mask_od; -	u8 addr_stat_drdy; +	struct { +		u8 addr; +		u8 mask; +	} stat_drdy;  	struct {  		u8 en_addr;  		u8 en_mask; diff --git a/include/linux/iio/dac/ad5421.h b/include/linux/iio/dac/ad5421.h index 8fd8f057a890..d8ee9a7f8a6a 100644 --- a/include/linux/iio/dac/ad5421.h +++ b/include/linux/iio/dac/ad5421.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __IIO_DAC_AD5421_H__  #define __IIO_DAC_AD5421_H__ diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index c380daa40c0e..20b61347ea58 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -365,12 +365,9 @@ unsigned int iio_get_time_res(const struct iio_dev *indio_dev);  #define INDIO_MAX_RAW_ELEMENTS		4  struct iio_trigger; /* forward declaration */ -struct iio_dev;  /**   * struct iio_info - constant information about device - * @driver_module:	module structure used to ensure correct - *			ownership of chrdevs etc   * @event_attrs:	event control attributes   * @attrs:		general purpose device attributes   * @read_raw:		function to request a value from the device. @@ -425,7 +422,6 @@ struct iio_dev;   *			were flushed and there was an error.   **/  struct iio_info { -	struct module			*driver_module;  	const struct attribute_group	*event_attrs;  	const struct attribute_group	*attrs; @@ -518,6 +514,7 @@ struct iio_buffer_setup_ops {  /**   * struct iio_dev - industrial I/O device   * @id:			[INTERN] used to identify device internally + * @driver_module:	[INTERN] used to make it harder to undercut users   * @modes:		[DRIVER] operating modes supported by device   * @currentmode:	[DRIVER] current operating mode   * @dev:		[DRIVER] device structure, should be assigned a parent @@ -558,6 +555,7 @@ struct iio_buffer_setup_ops {   */  struct iio_dev {  	int				id; +	struct module			*driver_module;  	int				modes;  	int				currentmode; @@ -604,9 +602,34 @@ struct iio_dev {  const struct iio_chan_spec  *iio_find_channel_from_si(struct iio_dev *indio_dev, int si); -int iio_device_register(struct iio_dev *indio_dev); +/** + * iio_device_register() - register a device with the IIO subsystem + * @indio_dev:		Device structure filled by the device driver + **/ +#define iio_device_register(iio_dev) \ +	__iio_device_register((iio_dev), THIS_MODULE) +int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod);  void iio_device_unregister(struct iio_dev *indio_dev); -int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev); +/** + * devm_iio_device_register - Resource-managed iio_device_register() + * @dev:	Device to allocate iio_dev for + * @indio_dev:	Device structure filled by the device driver + * + * Managed iio_device_register.  The IIO device registered with this + * function is automatically unregistered on driver detach. This function + * calls iio_device_register() internally. Refer to that function for more + * information. + * + * If an iio_dev registered with this function needs to be unregistered + * separately, devm_iio_device_unregister() must be used. + * + * RETURNS: + * 0 on success, negative error number on failure. + */ +#define devm_iio_device_register(dev, indio_dev) \ +	__devm_iio_device_register((dev), (indio_dev), THIS_MODULE); +int __devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev, +			       struct module *this_mod);  void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev);  int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);  int iio_device_claim_direct_mode(struct iio_dev *indio_dev); diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h index 027cfa9c3703..764659e01b68 100644 --- a/include/linux/iio/kfifo_buf.h +++ b/include/linux/iio/kfifo_buf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_IIO_KFIFO_BUF_H__  #define __LINUX_IIO_KFIFO_BUF_H__ diff --git a/include/linux/iio/magnetometer/ak8975.h b/include/linux/iio/magnetometer/ak8975.h index c8400959d197..ac9366f807cb 100644 --- a/include/linux/iio/magnetometer/ak8975.h +++ b/include/linux/iio/magnetometer/ak8975.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __IIO_MAGNETOMETER_AK8975_H__  #define __IIO_MAGNETOMETER_AK8975_H__ diff --git a/include/linux/iio/sw_device.h b/include/linux/iio/sw_device.h index fa7931933067..8642b91a7577 100644 --- a/include/linux/iio/sw_device.h +++ b/include/linux/iio/sw_device.h @@ -60,7 +60,7 @@ void iio_sw_device_type_configfs_unregister(struct iio_sw_device_type *dt);  static inline  void iio_swd_group_init_type_name(struct iio_sw_device *d,  				  const char *name, -				  struct config_item_type *type) +				  const struct config_item_type *type)  {  #if IS_ENABLED(CONFIG_CONFIGFS_FS)  	config_group_init_type_name(&d->group, name, type); diff --git a/include/linux/iio/sw_trigger.h b/include/linux/iio/sw_trigger.h index c97eab67558f..0c43738a9e24 100644 --- a/include/linux/iio/sw_trigger.h +++ b/include/linux/iio/sw_trigger.h @@ -60,7 +60,7 @@ void iio_sw_trigger_type_configfs_unregister(struct iio_sw_trigger_type *tt);  static inline  void iio_swt_group_init_type_name(struct iio_sw_trigger *t,  				  const char *name, -				  struct config_item_type *type) +				  const struct config_item_type *type)  {  #if IS_ENABLED(CONFIG_CONFIGFS_FS)  	config_group_init_type_name(&t->group, name, type); diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index 7142d8d6e470..7d5e44518379 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h @@ -23,7 +23,6 @@ struct iio_trigger;  /**   * struct iio_trigger_ops - operations structure for an iio_trigger. - * @owner:		used to monitor usage count of the trigger.   * @set_trigger_state:	switch on/off the trigger on demand   * @try_reenable:	function to reenable the trigger when the   *			use count is zero (may be NULL) @@ -34,7 +33,6 @@ struct iio_trigger;   * instances of a given device.   **/  struct iio_trigger_ops { -	struct module *owner;  	int (*set_trigger_state)(struct iio_trigger *trig, bool state);  	int (*try_reenable)(struct iio_trigger *trig);  	int (*validate_device)(struct iio_trigger *trig, @@ -62,6 +60,7 @@ struct iio_trigger_ops {   **/  struct iio_trigger {  	const struct iio_trigger_ops	*ops; +	struct module			*owner;  	int				id;  	const char			*name;  	struct device			dev; @@ -87,14 +86,14 @@ static inline struct iio_trigger *to_iio_trigger(struct device *d)  static inline void iio_trigger_put(struct iio_trigger *trig)  { -	module_put(trig->ops->owner); +	module_put(trig->owner);  	put_device(&trig->dev);  }  static inline struct iio_trigger *iio_trigger_get(struct iio_trigger *trig)  {  	get_device(&trig->dev); -	__module_get(trig->ops->owner); +	__module_get(trig->owner);  	return trig;  } @@ -127,10 +126,16 @@ static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig)   * iio_trigger_register() - register a trigger with the IIO core   * @trig_info:	trigger to be registered   **/ -int iio_trigger_register(struct iio_trigger *trig_info); - -int devm_iio_trigger_register(struct device *dev, -			      struct iio_trigger *trig_info); +#define iio_trigger_register(trig_info) \ +	__iio_trigger_register((trig_info), THIS_MODULE) +int __iio_trigger_register(struct iio_trigger *trig_info, +			   struct module *this_mod); + +#define devm_iio_trigger_register(dev, trig_info) \ +	__devm_iio_trigger_register((dev), (trig_info), THIS_MODULE) +int __devm_iio_trigger_register(struct device *dev, +				struct iio_trigger *trig_info, +				struct module *this_mod);  /**   * iio_trigger_unregister() - unregister a trigger from the core diff --git a/include/linux/iio/triggered_buffer.h b/include/linux/iio/triggered_buffer.h index 30145616773d..238ad30ce166 100644 --- a/include/linux/iio/triggered_buffer.h +++ b/include/linux/iio/triggered_buffer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IIO_TRIGGERED_BUFFER_H_  #define _LINUX_IIO_TRIGGERED_BUFFER_H_ diff --git a/include/linux/iio/triggered_event.h b/include/linux/iio/triggered_event.h index 8fe8537085bb..13250fd99745 100644 --- a/include/linux/iio/triggered_event.h +++ b/include/linux/iio/triggered_event.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IIO_TRIGGERED_EVENT_H_  #define _LINUX_IIO_TRIGGERED_EVENT_H_ diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h index ee251c585854..39faaaf843e1 100644 --- a/include/linux/inet_diag.h +++ b/include/linux/inet_diag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _INET_DIAG_H_  #define _INET_DIAG_H_ 1 diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index fb3f809e34e4..1ac5bf95bfdd 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_INETDEVICE_H  #define _LINUX_INETDEVICE_H @@ -154,6 +155,7 @@ struct in_ifaddr {  struct in_validator_info {  	__be32			ivi_addr;  	struct in_device	*ivi_dev; +	struct netlink_ext_ack	*extack;  };  int register_inetaddr_notifier(struct notifier_block *nb); @@ -179,6 +181,7 @@ __be32 inet_confirm_addr(struct net *net, struct in_device *in_dev, __be32 dst,  			 __be32 local, int scope);  struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,  				    __be32 mask); +struct in_ifaddr *inet_lookup_ifaddr_rcu(struct net *net, __be32 addr);  static __inline__ bool inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)  {  	return !((addr^ifa->ifa_address)&ifa->ifa_mask); diff --git a/include/linux/init.h b/include/linux/init.h index 94769d687cf0..ea1b31101d9e 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_INIT_H  #define _LINUX_INIT_H @@ -39,7 +40,7 @@  /* These are for everybody (although not all archs will actually     discard it in modules) */ -#define __init		__section(.init.text) __cold __inittrace __latent_entropy +#define __init		__section(.init.text) __cold  __latent_entropy  #define __initdata	__section(.init.data)  #define __initconst	__section(.init.rodata)  #define __exitdata	__section(.exit.data) @@ -68,10 +69,8 @@  #ifdef MODULE  #define __exitused -#define __inittrace notrace  #else  #define __exitused  __used -#define __inittrace  #endif  #define __exit          __section(.exit.text) __exitused __cold notrace diff --git a/include/linux/init_ohci1394_dma.h b/include/linux/init_ohci1394_dma.h index 3c03a4bba5e4..228afca432ac 100644 --- a/include/linux/init_ohci1394_dma.h +++ b/include/linux/init_ohci1394_dma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT  extern int __initdata init_ohci1394_dma_early;  extern void __init init_ohci1394_dma_on_all_controllers(void); diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 3c07ace5b431..6a532629c983 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX__INIT_TASK_H  #define _LINUX__INIT_TASK_H @@ -104,7 +105,6 @@ extern struct group_info init_groups;  	.numbers	= { {						\  		.nr		= 0,					\  		.ns		= &init_pid_ns,				\ -		.pid_chain	= { .next = NULL, .pprev = NULL },	\  	}, }								\  } diff --git a/include/linux/initrd.h b/include/linux/initrd.h index bc67b767f9ce..84b423044088 100644 --- a/include/linux/initrd.h +++ b/include/linux/initrd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #define INITRD_MINOR 250 /* shouldn't collide with /dev/ram* too soon ... */ diff --git a/include/linux/inotify.h b/include/linux/inotify.h index 23aede0b5843..44f9ffe72c87 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Inode based directory notification for Linux   * diff --git a/include/linux/input.h b/include/linux/input.h index fb5e23c7ed98..7c7516eb7d76 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -234,6 +234,10 @@ struct input_dev {  #error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"  #endif +#if INPUT_PROP_MAX != INPUT_DEVICE_ID_PROP_MAX +#error "INPUT_PROP_MAX and INPUT_DEVICE_ID_PROP_MAX do not match" +#endif +  #define INPUT_DEVICE_ID_MATCH_DEVICE \  	(INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)  #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \ @@ -469,6 +473,9 @@ int input_get_keycode(struct input_dev *dev, struct input_keymap_entry *ke);  int input_set_keycode(struct input_dev *dev,  		      const struct input_keymap_entry *ke); +bool input_match_device_id(const struct input_dev *dev, +			   const struct input_device_id *id); +  void input_enable_softrepeat(struct input_dev *dev, int delay, int period);  extern struct class input_class; diff --git a/include/linux/input/cy8ctmg110_pdata.h b/include/linux/input/cy8ctmg110_pdata.h index 09522cb59910..77582ae1745a 100644 --- a/include/linux/input/cy8ctmg110_pdata.h +++ b/include/linux/input/cy8ctmg110_pdata.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_CY8CTMG110_PDATA_H  #define _LINUX_CY8CTMG110_PDATA_H diff --git a/include/linux/input/gp2ap002a00f.h b/include/linux/input/gp2ap002a00f.h index aad2fd44a61a..3614a13a8297 100644 --- a/include/linux/input/gp2ap002a00f.h +++ b/include/linux/input/gp2ap002a00f.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _GP2AP002A00F_H_  #define _GP2AP002A00F_H_ diff --git a/include/linux/input/gpio_tilt.h b/include/linux/input/gpio_tilt.h index c1cc52d380e0..f9d932476a80 100644 --- a/include/linux/input/gpio_tilt.h +++ b/include/linux/input/gpio_tilt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _INPUT_GPIO_TILT_H  #define _INPUT_GPIO_TILT_H diff --git a/include/linux/input/ili210x.h b/include/linux/input/ili210x.h index a5471245a13c..b76e7c1404cd 100644 --- a/include/linux/input/ili210x.h +++ b/include/linux/input/ili210x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ILI210X_H  #define _ILI210X_H diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index 6174733a57eb..9476768c3b90 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _MATRIX_KEYPAD_H  #define _MATRIX_KEYPAD_H diff --git a/include/linux/input/sh_keysc.h b/include/linux/input/sh_keysc.h index 5d253cd93691..b3c4f3b6679c 100644 --- a/include/linux/input/sh_keysc.h +++ b/include/linux/input/sh_keysc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SH_KEYSC_H__  #define __SH_KEYSC_H__ diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 485a5b48f038..f3274d9f46a2 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h @@ -212,6 +212,7 @@  #define DMA_FSTS_IQE (1 << 4)  #define DMA_FSTS_ICE (1 << 5)  #define DMA_FSTS_ITE (1 << 6) +#define DMA_FSTS_PRO (1 << 7)  #define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff)  /* FRCD_REG, 32 bits access */ diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 59ba11661b6e..69c238210325 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* interrupt.h */  #ifndef _LINUX_INTERRUPT_H  #define _LINUX_INTERRUPT_H @@ -593,21 +594,6 @@ static inline void tasklet_hi_schedule(struct tasklet_struct *t)  		__tasklet_hi_schedule(t);  } -extern void __tasklet_hi_schedule_first(struct tasklet_struct *t); - -/* - * This version avoids touching any other tasklets. Needed for kmemcheck - * in order not to take any page faults while enqueueing this tasklet; - * consider VERY carefully whether you really need this or - * tasklet_hi_schedule()... - */ -static inline void tasklet_hi_schedule_first(struct tasklet_struct *t) -{ -	if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) -		__tasklet_hi_schedule_first(t); -} - -  static inline void tasklet_disable_nosync(struct tasklet_struct *t)  {  	atomic_inc(&t->count); diff --git a/include/linux/interval_tree.h b/include/linux/interval_tree.h index 202ee1283f4b..288c26f50732 100644 --- a/include/linux/interval_tree.h +++ b/include/linux/interval_tree.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_INTERVAL_TREE_H  #define _LINUX_INTERVAL_TREE_H diff --git a/include/linux/io-64-nonatomic-hi-lo.h b/include/linux/io-64-nonatomic-hi-lo.h index defcc4644ce3..862d786a904f 100644 --- a/include/linux/io-64-nonatomic-hi-lo.h +++ b/include/linux/io-64-nonatomic-hi-lo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IO_64_NONATOMIC_HI_LO_H_  #define _LINUX_IO_64_NONATOMIC_HI_LO_H_ diff --git a/include/linux/io-64-nonatomic-lo-hi.h b/include/linux/io-64-nonatomic-lo-hi.h index 084461a4e5ab..d042e7bb5adb 100644 --- a/include/linux/io-64-nonatomic-lo-hi.h +++ b/include/linux/io-64-nonatomic-lo-hi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IO_64_NONATOMIC_LO_HI_H_  #define _LINUX_IO_64_NONATOMIC_LO_HI_H_ diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index df38db2ef45b..dba15ca8e60b 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef IOCONTEXT_H  #define IOCONTEXT_H diff --git a/include/linux/iomap.h b/include/linux/iomap.h index f64dc6ce5161..19a07de28212 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_IOMAP_H  #define LINUX_IOMAP_H 1 @@ -15,27 +16,33 @@ struct vm_fault;   */  #define IOMAP_HOLE	0x01	/* no blocks allocated, need allocation */  #define IOMAP_DELALLOC	0x02	/* delayed allocation blocks */ -#define IOMAP_MAPPED	0x03	/* blocks allocated @blkno */ -#define IOMAP_UNWRITTEN	0x04	/* blocks allocated @blkno in unwritten state */ +#define IOMAP_MAPPED	0x03	/* blocks allocated at @addr */ +#define IOMAP_UNWRITTEN	0x04	/* blocks allocated at @addr in unwritten state */  /*   * Flags for all iomap mappings: + * + * IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access + * written data and requires fdatasync to commit them to persistent storage.   */ -#define IOMAP_F_NEW	0x01	/* blocks have been newly allocated */ +#define IOMAP_F_NEW		0x01	/* blocks have been newly allocated */ +#define IOMAP_F_BOUNDARY	0x02	/* mapping ends at metadata boundary */ +#define IOMAP_F_DIRTY		0x04	/* uncommitted metadata */  /*   * Flags that only need to be reported for IOMAP_REPORT requests:   */ -#define IOMAP_F_MERGED	0x10	/* contains multiple blocks/extents */ -#define IOMAP_F_SHARED	0x20	/* block shared with another file */ +#define IOMAP_F_MERGED		0x10	/* contains multiple blocks/extents */ +#define IOMAP_F_SHARED		0x20	/* block shared with another file */ +#define IOMAP_F_DATA_INLINE	0x40	/* data inline in the inode */  /* - * Magic value for blkno: + * Magic value for addr:   */ -#define IOMAP_NULL_BLOCK -1LL	/* blkno is not valid */ +#define IOMAP_NULL_ADDR -1ULL	/* addr is not valid */  struct iomap { -	sector_t		blkno;	/* 1st sector of mapping, 512b units */ +	u64			addr; /* disk offset of mapping, bytes */  	loff_t			offset;	/* file offset of mapping, bytes */  	u64			length;	/* length of mapping, bytes */  	u16			type;	/* type of mapping */ diff --git a/include/linux/iommu-common.h b/include/linux/iommu-common.h index 376a27c9cc6a..802c90c79d1f 100644 --- a/include/linux/iommu-common.h +++ b/include/linux/iommu-common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IOMMU_COMMON_H  #define _LINUX_IOMMU_COMMON_H diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index 86bdeffe43ad..cb9a9248c8c0 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IOMMU_HELPER_H  #define _LINUX_IOMMU_HELPER_H diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index d29e1e21bf3f..b1d861caca16 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h @@ -42,18 +42,21 @@   */  #define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us)	\  ({ \ -	ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ -	might_sleep_if(sleep_us); \ +	u64 __timeout_us = (timeout_us); \ +	unsigned long __sleep_us = (sleep_us); \ +	ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \ +	might_sleep_if((__sleep_us) != 0); \  	for (;;) { \  		(val) = op(addr); \  		if (cond) \  			break; \ -		if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ +		if (__timeout_us && \ +		    ktime_compare(ktime_get(), __timeout) > 0) { \  			(val) = op(addr); \  			break; \  		} \ -		if (sleep_us) \ -			usleep_range((sleep_us >> 2) + 1, sleep_us); \ +		if (__sleep_us) \ +			usleep_range((__sleep_us >> 2) + 1, __sleep_us); \  	} \  	(cond) ? 0 : -ETIMEDOUT; \  }) @@ -77,17 +80,20 @@   */  #define readx_poll_timeout_atomic(op, addr, val, cond, delay_us, timeout_us) \  ({ \ -	ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ +	u64 __timeout_us = (timeout_us); \ +	unsigned long __delay_us = (delay_us); \ +	ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \  	for (;;) { \  		(val) = op(addr); \  		if (cond) \  			break; \ -		if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ +		if (__timeout_us && \ +		    ktime_compare(ktime_get(), __timeout) > 0) { \  			(val) = op(addr); \  			break; \  		} \ -		if (delay_us) \ -			udelay(delay_us);	\ +		if (__delay_us) \ +			udelay(__delay_us);	\  	} \  	(cond) ? 0 : -ETIMEDOUT; \  }) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index f5cf32e80041..93b4183cf53d 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * ioport.h	Definitions of routines for detecting, reserving and   *		allocating system resources. @@ -270,11 +271,14 @@ extern int  walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,  		void *arg, int (*func)(unsigned long, unsigned long, void *));  extern int +walk_mem_res(u64 start, u64 end, void *arg, +	     int (*func)(struct resource *, void *)); +extern int  walk_system_ram_res(u64 start, u64 end, void *arg, -		    int (*func)(u64, u64, void *)); +		    int (*func)(struct resource *, void *));  extern int  walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end, -		    void *arg, int (*func)(u64, u64, void *)); +		    void *arg, int (*func)(struct resource *, void *));  /* True if any part of r1 overlaps r2 */  static inline bool resource_overlaps(struct resource *r1, struct resource *r2) diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h index 8c1239020d79..627efac73e6d 100644 --- a/include/linux/ioprio.h +++ b/include/linux/ioprio.h @@ -1,7 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef IOPRIO_H  #define IOPRIO_H  #include <linux/sched.h> +#include <linux/sched/rt.h>  #include <linux/iocontext.h>  /* @@ -62,7 +64,7 @@ static inline int task_nice_ioclass(struct task_struct *task)  {  	if (task->policy == SCHED_IDLE)  		return IOPRIO_CLASS_IDLE; -	else if (task->policy == SCHED_FIFO || task->policy == SCHED_RR) +	else if (task_is_realtime(task))  		return IOPRIO_CLASS_RT;  	else  		return IOPRIO_CLASS_BE; diff --git a/include/linux/iova.h b/include/linux/iova.h index d179b9bf7814..928442dda565 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h @@ -70,10 +70,12 @@ struct iova_fq {  struct iova_domain {  	spinlock_t	iova_rbtree_lock; /* Lock to protect update of rbtree */  	struct rb_root	rbroot;		/* iova domain rbtree root */ -	struct rb_node	*cached32_node; /* Save last alloced node */ +	struct rb_node	*cached_node;	/* Save last alloced node */ +	struct rb_node	*cached32_node; /* Save last 32-bit alloced node */  	unsigned long	granule;	/* pfn granularity for this domain */  	unsigned long	start_pfn;	/* Lower limit for this domain */  	unsigned long	dma_32bit_pfn; +	struct iova	anchor;		/* rbtree lookup anchor */  	struct iova_rcache rcaches[IOVA_RANGE_CACHE_MAX_SIZE];	/* IOVA range caches */  	iova_flush_cb	flush_cb;	/* Call-Back function to flush IOMMU @@ -148,12 +150,12 @@ void queue_iova(struct iova_domain *iovad,  		unsigned long pfn, unsigned long pages,  		unsigned long data);  unsigned long alloc_iova_fast(struct iova_domain *iovad, unsigned long size, -			      unsigned long limit_pfn); +			      unsigned long limit_pfn, bool flush_rcache);  struct iova *reserve_iova(struct iova_domain *iovad, unsigned long pfn_lo,  	unsigned long pfn_hi);  void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to);  void init_iova_domain(struct iova_domain *iovad, unsigned long granule, -	unsigned long start_pfn, unsigned long pfn_32bit); +	unsigned long start_pfn);  int init_iova_flush_queue(struct iova_domain *iovad,  			  iova_flush_cb flush_cb, iova_entry_dtor entry_dtor);  struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn); @@ -210,7 +212,8 @@ static inline void queue_iova(struct iova_domain *iovad,  static inline unsigned long alloc_iova_fast(struct iova_domain *iovad,  					    unsigned long size, -					    unsigned long limit_pfn) +					    unsigned long limit_pfn, +					    bool flush_rcache)  {  	return 0;  } @@ -229,8 +232,7 @@ static inline void copy_reserved_iova(struct iova_domain *from,  static inline void init_iova_domain(struct iova_domain *iovad,  				    unsigned long granule, -				    unsigned long start_pfn, -				    unsigned long pfn_32bit) +				    unsigned long start_pfn)  {  } diff --git a/include/linux/ipc.h b/include/linux/ipc.h index 92a2ccff80c5..821b2f260992 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IPC_H  #define _LINUX_IPC_H diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index 83f0bf7a587d..b5630c8eb2f3 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __IPC_NAMESPACE_H__  #define __IPC_NAMESPACE_H__ @@ -18,7 +19,10 @@ struct ipc_ids {  	bool tables_initialized;  	struct rw_semaphore rwsem;  	struct idr ipcs_idr; +	int max_id; +#ifdef CONFIG_CHECKPOINT_RESTORE  	int next_id; +#endif  	struct rhashtable key_ht;  }; diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index f1045b2c6a00..f4ffacf4fe9d 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h @@ -113,9 +113,9 @@ int ipmi_create_user(unsigned int          if_num,  int ipmi_destroy_user(ipmi_user_t user);  /* Get the IPMI version of the BMC we are talking to. */ -void ipmi_get_version(ipmi_user_t   user, -		      unsigned char *major, -		      unsigned char *minor); +int ipmi_get_version(ipmi_user_t   user, +		     unsigned char *major, +		     unsigned char *minor);  /* Set and get the slave address and LUN that we will use for our     source messages.  Note that this affects the interface, not just @@ -277,7 +277,7 @@ int ipmi_validate_addr(struct ipmi_addr *addr, int len);   */  enum ipmi_addr_src {  	SI_INVALID = 0, SI_HOTMOD, SI_HARDCODED, SI_SPMI, SI_ACPI, SI_SMBIOS, -	SI_PCI,	SI_DEVICETREE, SI_LAST +	SI_PCI,	SI_DEVICETREE, SI_PLATFORM, SI_LAST  };  const char *ipmi_addr_src_to_str(enum ipmi_addr_src src); diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index f8cea14485dd..5be51281e14d 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -162,27 +162,27 @@ struct ipmi_device_id {  #define ipmi_version_major(v) ((v)->ipmi_version & 0xf)  #define ipmi_version_minor(v) ((v)->ipmi_version >> 4) -/* Take a pointer to a raw data buffer and a length and extract device -   id information from it.  The first byte of data must point to the -   netfn << 2, the data should be of the format: -      netfn << 2, cmd, completion code, data -   as normally comes from a device interface. */ -static inline int ipmi_demangle_device_id(const unsigned char *data, +/* Take a pointer to an IPMI response and extract device id information from + * it. @netfn is in the IPMI_NETFN_ format, so may need to be shifted from + * a SI response. + */ +static inline int ipmi_demangle_device_id(uint8_t netfn, uint8_t cmd, +					  const unsigned char *data,  					  unsigned int data_len,  					  struct ipmi_device_id *id)  { -	if (data_len < 9) +	if (data_len < 7)  		return -EINVAL; -	if (data[0] != IPMI_NETFN_APP_RESPONSE << 2 || -	    data[1] != IPMI_GET_DEVICE_ID_CMD) +	if (netfn != IPMI_NETFN_APP_RESPONSE || cmd != IPMI_GET_DEVICE_ID_CMD)  		/* Strange, didn't get the response we expected. */  		return -EINVAL; -	if (data[2] != 0) +	if (data[0] != 0)  		/* That's odd, it shouldn't be able to fail. */  		return -EINVAL; -	data += 3; -	data_len -= 3; +	data++; +	data_len--; +  	id->device_id = data[0];  	id->device_revision = data[1];  	id->firmware_revision_1 = data[2]; @@ -214,7 +214,6 @@ static inline int ipmi_demangle_device_id(const unsigned char *data,     call. */  int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,  		      void                     *send_info, -		      struct ipmi_device_id    *device_id,  		      struct device            *dev,  		      unsigned char            slave_addr); @@ -242,11 +241,13 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)  	msg->done(msg);  } +#ifdef CONFIG_IPMI_PROC_INTERFACE  /* Allow the lower layer to add things to the proc filesystem     directory for this interface.  Note that the entry will     automatically be dstroyed when the interface is destroyed. */  int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,  			    const struct file_operations *proc_ops,  			    void *data); +#endif  #endif /* __LINUX_IPMI_SMI_H */ diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index ac2da4e11d5e..cb18c6290ca8 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IPV6_H  #define _IPV6_H @@ -72,6 +73,7 @@ struct ipv6_devconf {  	__u32		enhanced_dad;  	__u32		addr_gen_mode;  	__s32		disable_policy; +	__s32           ndisc_tclass;  	struct ctl_table_header *sysctl_header;  }; diff --git a/include/linux/irq.h b/include/linux/irq.h index d4728bf6a537..e140f69163b6 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IRQ_H  #define _LINUX_IRQ_H @@ -210,6 +211,7 @@ struct irq_data {   * IRQD_MANAGED_SHUTDOWN	- Interrupt was shutdown due to empty affinity   *				  mask. Applies only to affinity managed irqs.   * IRQD_SINGLE_TARGET		- IRQ allows only a single affinity target + * IRQD_DEFAULT_TRIGGER_SET	- Expected trigger already been set   */  enum {  	IRQD_TRIGGER_MASK		= 0xf, @@ -230,6 +232,7 @@ enum {  	IRQD_IRQ_STARTED		= (1 << 22),  	IRQD_MANAGED_SHUTDOWN		= (1 << 23),  	IRQD_SINGLE_TARGET		= (1 << 24), +	IRQD_DEFAULT_TRIGGER_SET	= (1 << 25),  };  #define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors) @@ -259,18 +262,25 @@ static inline void irqd_mark_affinity_was_set(struct irq_data *d)  	__irqd_to_state(d) |= IRQD_AFFINITY_SET;  } +static inline bool irqd_trigger_type_was_set(struct irq_data *d) +{ +	return __irqd_to_state(d) & IRQD_DEFAULT_TRIGGER_SET; +} +  static inline u32 irqd_get_trigger_type(struct irq_data *d)  {  	return __irqd_to_state(d) & IRQD_TRIGGER_MASK;  }  /* - * Must only be called inside irq_chip.irq_set_type() functions. + * Must only be called inside irq_chip.irq_set_type() functions or + * from the DT/ACPI setup code.   */  static inline void irqd_set_trigger_type(struct irq_data *d, u32 type)  {  	__irqd_to_state(d) &= ~IRQD_TRIGGER_MASK;  	__irqd_to_state(d) |= type & IRQD_TRIGGER_MASK; +	__irqd_to_state(d) |= IRQD_DEFAULT_TRIGGER_SET;  }  static inline bool irqd_is_level_type(struct irq_data *d) @@ -1009,7 +1019,7 @@ void irq_gc_mask_clr_bit(struct irq_data *d);  void irq_gc_unmask_enable_reg(struct irq_data *d);  void irq_gc_ack_set_bit(struct irq_data *d);  void irq_gc_ack_clr_bit(struct irq_data *d); -void irq_gc_mask_disable_reg_and_ack(struct irq_data *d); +void irq_gc_mask_disable_and_ack_set(struct irq_data *d);  void irq_gc_eoi(struct irq_data *d);  int irq_gc_set_wake(struct irq_data *d, unsigned int on); @@ -1113,6 +1123,28 @@ static inline u32 irq_reg_readl(struct irq_chip_generic *gc,  		return readl(gc->reg_base + reg_offset);  } +struct irq_matrix; +struct irq_matrix *irq_alloc_matrix(unsigned int matrix_bits, +				    unsigned int alloc_start, +				    unsigned int alloc_end); +void irq_matrix_online(struct irq_matrix *m); +void irq_matrix_offline(struct irq_matrix *m); +void irq_matrix_assign_system(struct irq_matrix *m, unsigned int bit, bool replace); +int irq_matrix_reserve_managed(struct irq_matrix *m, const struct cpumask *msk); +void irq_matrix_remove_managed(struct irq_matrix *m, const struct cpumask *msk); +int irq_matrix_alloc_managed(struct irq_matrix *m, unsigned int cpu); +void irq_matrix_reserve(struct irq_matrix *m); +void irq_matrix_remove_reserved(struct irq_matrix *m); +int irq_matrix_alloc(struct irq_matrix *m, const struct cpumask *msk, +		     bool reserved, unsigned int *mapped_cpu); +void irq_matrix_free(struct irq_matrix *m, unsigned int cpu, +		     unsigned int bit, bool managed); +void irq_matrix_assign(struct irq_matrix *m, unsigned int bit); +unsigned int irq_matrix_available(struct irq_matrix *m, bool cpudown); +unsigned int irq_matrix_allocated(struct irq_matrix *m); +unsigned int irq_matrix_reserved(struct irq_matrix *m); +void irq_matrix_debug_show(struct seq_file *sf, struct irq_matrix *m, int ind); +  /* Contrary to Linux irqs, for hardware irqs the irq number 0 is valid */  #define INVALID_HWIRQ	(~0UL)  irq_hw_number_t ipi_get_hwirq(unsigned int irq, unsigned int cpu); diff --git a/include/linux/irq_cpustat.h b/include/linux/irq_cpustat.h index 77e4bac29287..4954948d1973 100644 --- a/include/linux/irq_cpustat.h +++ b/include/linux/irq_cpustat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __irq_cpustat_h  #define __irq_cpustat_h diff --git a/include/linux/irq_poll.h b/include/linux/irq_poll.h index 3e8c1b8fb9be..16aaeccb65cb 100644 --- a/include/linux/irq_poll.h +++ b/include/linux/irq_poll.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef IRQ_POLL_H  #define IRQ_POLL_H diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h index 47b9ebd4a74f..0e81035b678f 100644 --- a/include/linux/irq_work.h +++ b/include/linux/irq_work.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IRQ_WORK_H  #define _LINUX_IRQ_WORK_H @@ -33,10 +34,7 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))  #define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), }  bool irq_work_queue(struct irq_work *work); - -#ifdef CONFIG_SMP  bool irq_work_queue_on(struct irq_work *work, int cpu); -#endif  void irq_work_tick(void);  void irq_work_sync(struct irq_work *work); diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 1ea576c8126f..c00c4c33e432 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h @@ -68,6 +68,7 @@  #define GICD_CTLR_ENABLE_SS_G1		(1U << 1)  #define GICD_CTLR_ENABLE_SS_G0		(1U << 0) +#define GICD_TYPER_RSS			(1U << 26)  #define GICD_TYPER_LPIS			(1U << 17)  #define GICD_TYPER_MBIS			(1U << 16) @@ -372,6 +373,8 @@  #define GITS_BASER_ENTRY_SIZE_SHIFT		(48)  #define GITS_BASER_ENTRY_SIZE(r)	((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1)  #define GITS_BASER_ENTRY_SIZE_MASK	GENMASK_ULL(52, 48) +#define GITS_BASER_PHYS_52_to_48(phys)					\ +	(((phys) & GENMASK_ULL(47, 16)) | (((phys) >> 48) & 0xf) << 12)  #define GITS_BASER_SHAREABILITY_SHIFT	(10)  #define GITS_BASER_InnerShareable					\  	GIC_BASER_SHAREABILITY(GITS_BASER, InnerShareable) @@ -459,6 +462,7 @@  #define ICC_CTLR_EL1_SEIS_MASK		(0x1 << ICC_CTLR_EL1_SEIS_SHIFT)  #define ICC_CTLR_EL1_A3V_SHIFT		15  #define ICC_CTLR_EL1_A3V_MASK		(0x1 << ICC_CTLR_EL1_A3V_SHIFT) +#define ICC_CTLR_EL1_RSS		(0x1 << 18)  #define ICC_PMR_EL1_SHIFT		0  #define ICC_PMR_EL1_MASK		(0xff << ICC_PMR_EL1_SHIFT)  #define ICC_BPR0_EL1_SHIFT		0 @@ -547,6 +551,8 @@  #define ICC_SGI1R_AFFINITY_2_SHIFT	32  #define ICC_SGI1R_AFFINITY_2_MASK	(0xffULL << ICC_SGI1R_AFFINITY_2_SHIFT)  #define ICC_SGI1R_IRQ_ROUTING_MODE_BIT	40 +#define ICC_SGI1R_RS_SHIFT		44 +#define ICC_SGI1R_RS_MASK		(0xfULL << ICC_SGI1R_RS_SHIFT)  #define ICC_SGI1R_AFFINITY_3_SHIFT	48  #define ICC_SGI1R_AFFINITY_3_MASK	(0xffULL << ICC_SGI1R_AFFINITY_3_SHIFT) diff --git a/include/linux/irqchip/arm-gic-v4.h b/include/linux/irqchip/arm-gic-v4.h index 58a4d89aa82c..fa683ea5c769 100644 --- a/include/linux/irqchip/arm-gic-v4.h +++ b/include/linux/irqchip/arm-gic-v4.h @@ -20,6 +20,12 @@  struct its_vpe; +/* + * Maximum number of ITTs when GITS_TYPER.VMOVP == 0, using the + * ITSList mechanism to perform inter-ITS synchronization. + */ +#define GICv4_ITS_LIST_MAX		16 +  /* Embedded in kvm.arch */  struct its_vm {  	struct fwnode_handle	*fwnode; @@ -30,6 +36,7 @@ struct its_vm {  	irq_hw_number_t		db_lpi_base;  	unsigned long		*db_bitmap;  	int			nr_db_lpis; +	u32			vlpi_count[GICv4_ITS_LIST_MAX];  };  /* Embedded in kvm_vcpu.arch */ @@ -64,12 +71,14 @@ struct its_vpe {   * @vm:		Pointer to the GICv4 notion of a VM   * @vpe:	Pointer to the GICv4 notion of a virtual CPU (VPE)   * @vintid:	Virtual LPI number + * @properties:	Priority and enable bits (as written in the prop table)   * @db_enabled:	Is the VPE doorbell to be generated?   */  struct its_vlpi_map {  	struct its_vm		*vm;  	struct its_vpe		*vpe;  	u32			vintid; +	u8			properties;  	bool			db_enabled;  }; @@ -100,6 +109,7 @@ int its_get_vlpi(int irq, struct its_vlpi_map *map);  int its_unmap_vlpi(int irq);  int its_prop_update_vlpi(int irq, u8 config, bool inv); +struct irq_domain_ops;  int its_init_v4(struct irq_domain *domain, const struct irq_domain_ops *ops);  #endif diff --git a/include/linux/irqchip/irq-bcm2836.h b/include/linux/irqchip/irq-bcm2836.h new file mode 100644 index 000000000000..218a6e1b18d8 --- /dev/null +++ b/include/linux/irqchip/irq-bcm2836.h @@ -0,0 +1,70 @@ +/* + * Root interrupt controller for the BCM2836 (Raspberry Pi 2). + * + * Copyright 2015 Broadcom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#define LOCAL_CONTROL			0x000 +#define LOCAL_PRESCALER			0x008 + +/* + * The low 2 bits identify the CPU that the GPU IRQ goes to, and the + * next 2 bits identify the CPU that the GPU FIQ goes to. + */ +#define LOCAL_GPU_ROUTING		0x00c +/* When setting bits 0-3, enables PMU interrupts on that CPU. */ +#define LOCAL_PM_ROUTING_SET		0x010 +/* When setting bits 0-3, disables PMU interrupts on that CPU. */ +#define LOCAL_PM_ROUTING_CLR		0x014 +/* + * The low 4 bits of this are the CPU's timer IRQ enables, and the + * next 4 bits are the CPU's timer FIQ enables (which override the IRQ + * bits). + */ +#define LOCAL_TIMER_INT_CONTROL0	0x040 +/* + * The low 4 bits of this are the CPU's per-mailbox IRQ enables, and + * the next 4 bits are the CPU's per-mailbox FIQ enables (which + * override the IRQ bits). + */ +#define LOCAL_MAILBOX_INT_CONTROL0	0x050 +/* + * The CPU's interrupt status register.  Bits are defined by the the + * LOCAL_IRQ_* bits below. + */ +#define LOCAL_IRQ_PENDING0		0x060 +/* Same status bits as above, but for FIQ. */ +#define LOCAL_FIQ_PENDING0		0x070 +/* + * Mailbox write-to-set bits.  There are 16 mailboxes, 4 per CPU, and + * these bits are organized by mailbox number and then CPU number.  We + * use mailbox 0 for IPIs.  The mailbox's interrupt is raised while + * any bit is set. + */ +#define LOCAL_MAILBOX0_SET0		0x080 +#define LOCAL_MAILBOX3_SET0		0x08c +/* Mailbox write-to-clear bits. */ +#define LOCAL_MAILBOX0_CLR0		0x0c0 +#define LOCAL_MAILBOX3_CLR0		0x0cc + +#define LOCAL_IRQ_CNTPSIRQ	0 +#define LOCAL_IRQ_CNTPNSIRQ	1 +#define LOCAL_IRQ_CNTHPIRQ	2 +#define LOCAL_IRQ_CNTVIRQ	3 +#define LOCAL_IRQ_MAILBOX0	4 +#define LOCAL_IRQ_MAILBOX1	5 +#define LOCAL_IRQ_MAILBOX2	6 +#define LOCAL_IRQ_MAILBOX3	7 +#define LOCAL_IRQ_GPU_FAST	8 +#define LOCAL_IRQ_PMU_FAST	9 +#define LAST_IRQ		LOCAL_IRQ_PMU_FAST diff --git a/include/linux/irqchip/irq-omap-intc.h b/include/linux/irqchip/irq-omap-intc.h index 2e3d1afeb674..f19ccee7749f 100644 --- a/include/linux/irqchip/irq-omap-intc.h +++ b/include/linux/irqchip/irq-omap-intc.h @@ -18,8 +18,6 @@  #ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H  #define __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H -void omap3_init_irq(void); -  int omap_irq_pending(void);  void omap_intc_save_context(void);  void omap_intc_restore_context(void); diff --git a/include/linux/irqchip/metag-ext.h b/include/linux/irqchip/metag-ext.h index 697af0fe7c5a..d120496370b9 100644 --- a/include/linux/irqchip/metag-ext.h +++ b/include/linux/irqchip/metag-ext.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright (C) 2012 Imagination Technologies   */ diff --git a/include/linux/irqchip/metag.h b/include/linux/irqchip/metag.h index 4ebdfb3101ab..0adcf449e4e4 100644 --- a/include/linux/irqchip/metag.h +++ b/include/linux/irqchip/metag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright (C) 2011 Imagination Technologies   */ diff --git a/include/linux/irqchip/mmp.h b/include/linux/irqchip/mmp.h index c78a8921185d..cb8455c87c8a 100644 --- a/include/linux/irqchip/mmp.h +++ b/include/linux/irqchip/mmp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef	__IRQCHIP_MMP_H  #define	__IRQCHIP_MMP_H diff --git a/include/linux/irqchip/versatile-fpga.h b/include/linux/irqchip/versatile-fpga.h index 1fac9651d3ca..a978fc8c7996 100644 --- a/include/linux/irqchip/versatile-fpga.h +++ b/include/linux/irqchip/versatile-fpga.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef PLAT_FPGA_IRQ_H  #define PLAT_FPGA_IRQ_H diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index 3e90a094798d..dd418955962b 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IRQDESC_H  #define _LINUX_IRQDESC_H @@ -93,6 +94,7 @@ struct irq_desc {  #endif  #ifdef CONFIG_GENERIC_IRQ_DEBUGFS  	struct dentry		*debugfs_file; +	const char		*dev_name;  #endif  #ifdef CONFIG_SPARSE_IRQ  	struct rcu_head		rcu; @@ -244,6 +246,14 @@ static inline int irq_is_percpu(unsigned int irq)  	return desc->status_use_accessors & IRQ_PER_CPU;  } +static inline int irq_is_percpu_devid(unsigned int irq) +{ +	struct irq_desc *desc; + +	desc = irq_to_desc(irq); +	return desc->status_use_accessors & IRQ_PER_CPU_DEVID; +} +  static inline void  irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)  { diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 81e4889ca6dd..a34355d19546 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * irq_domain - IRQ translation domains   * @@ -32,6 +33,7 @@  #include <linux/types.h>  #include <linux/irqhandler.h>  #include <linux/of.h> +#include <linux/mutex.h>  #include <linux/radix-tree.h>  struct device_node; @@ -40,6 +42,7 @@ struct of_device_id;  struct irq_chip;  struct irq_data;  struct cpumask; +struct seq_file;  /* Number of irqs reserved for a legacy isa controller */  #define NUM_ISA_INTERRUPTS	16 @@ -104,18 +107,21 @@ struct irq_domain_ops {  	int (*xlate)(struct irq_domain *d, struct device_node *node,  		     const u32 *intspec, unsigned int intsize,  		     unsigned long *out_hwirq, unsigned int *out_type); -  #ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY  	/* extended V2 interfaces to support hierarchy irq_domains */  	int (*alloc)(struct irq_domain *d, unsigned int virq,  		     unsigned int nr_irqs, void *arg);  	void (*free)(struct irq_domain *d, unsigned int virq,  		     unsigned int nr_irqs); -	void (*activate)(struct irq_domain *d, struct irq_data *irq_data); +	int (*activate)(struct irq_domain *d, struct irq_data *irqd, bool early);  	void (*deactivate)(struct irq_domain *d, struct irq_data *irq_data);  	int (*translate)(struct irq_domain *d, struct irq_fwspec *fwspec,  			 unsigned long *out_hwirq, unsigned int *out_type);  #endif +#ifdef CONFIG_GENERIC_IRQ_DEBUGFS +	void (*debug_show)(struct seq_file *m, struct irq_domain *d, +			   struct irq_data *irqd, int ind); +#endif  };  extern struct irq_domain_ops irq_generic_chip_ops; @@ -133,8 +139,8 @@ struct irq_domain_chip_generic;   * @mapcount: The number of mapped interrupts   *   * Optional elements - * @of_node: Pointer to device tree nodes associated with the irq_domain. Used - *           when decoding device tree interrupt specifiers. + * @fwnode: Pointer to firmware node associated with the irq_domain. Pretty easy + *          to swap it for the of_node via the irq_domain_get_of_node accessor   * @gc: Pointer to a list of generic chips. There is a helper function for   *      setting up one or more generic chips for interrupt controllers   *      drivers using the generic chip library which uses this pointer. @@ -172,6 +178,7 @@ struct irq_domain {  	unsigned int revmap_direct_max_irq;  	unsigned int revmap_size;  	struct radix_tree_root revmap_tree; +	struct mutex revmap_tree_mutex;  	unsigned int linear_revmap[];  }; @@ -437,7 +444,7 @@ extern int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,  				   unsigned int nr_irqs, int node, void *arg,  				   bool realloc, const struct cpumask *affinity);  extern void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs); -extern void irq_domain_activate_irq(struct irq_data *irq_data); +extern int irq_domain_activate_irq(struct irq_data *irq_data, bool early);  extern void irq_domain_deactivate_irq(struct irq_data *irq_data);  static inline int irq_domain_alloc_irqs(struct irq_domain *domain, @@ -507,8 +514,6 @@ static inline bool irq_domain_is_msi_remap(struct irq_domain *domain)  extern bool irq_domain_hierarchical_is_msi_remap(struct irq_domain *domain);  #else	/* CONFIG_IRQ_DOMAIN_HIERARCHY */ -static inline void irq_domain_activate_irq(struct irq_data *data) { } -static inline void irq_domain_deactivate_irq(struct irq_data *data) { }  static inline int irq_domain_alloc_irqs(struct irq_domain *domain,  			unsigned int nr_irqs, int node, void *arg)  { @@ -557,8 +562,6 @@ irq_domain_hierarchical_is_msi_remap(struct irq_domain *domain)  #else /* CONFIG_IRQ_DOMAIN */  static inline void irq_dispose_mapping(unsigned int virq) { } -static inline void irq_domain_activate_irq(struct irq_data *data) { } -static inline void irq_domain_deactivate_irq(struct irq_data *data) { }  static inline struct irq_domain *irq_find_matching_fwnode(  	struct fwnode_handle *fwnode, enum irq_domain_bus_token bus_token)  { diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h index 5fdd93bb9300..46cb57d5eb13 100644 --- a/include/linux/irqflags.h +++ b/include/linux/irqflags.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/irqflags.h   * diff --git a/include/linux/irqhandler.h b/include/linux/irqhandler.h index 661bed0ed1f3..1e6f4e7123d6 100644 --- a/include/linux/irqhandler.h +++ b/include/linux/irqhandler.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IRQHANDLER_H  #define _LINUX_IRQHANDLER_H diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 9669bf9d4f48..3496baa0b07f 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IRQNR_H  #define _LINUX_IRQNR_H diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h index eb1bdcf95f2e..bd4c066ad39b 100644 --- a/include/linux/irqreturn.h +++ b/include/linux/irqreturn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_IRQRETURN_H  #define _LINUX_IRQRETURN_H diff --git a/include/linux/isa.h b/include/linux/isa.h index f2d0258414cf..41336da0f4e7 100644 --- a/include/linux/isa.h +++ b/include/linux/isa.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * ISA bus.   */ diff --git a/include/linux/isicom.h b/include/linux/isicom.h index b92e05650639..7de6822d7b1a 100644 --- a/include/linux/isicom.h +++ b/include/linux/isicom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ISICOM_H  #define _LINUX_ISICOM_H diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 606b6bce3a5b..296d1e0ea87b 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1367,6 +1367,7 @@ int jbd2_log_start_commit(journal_t *journal, tid_t tid);  int __jbd2_log_start_commit(journal_t *journal, tid_t tid);  int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);  int jbd2_log_wait_commit(journal_t *journal, tid_t tid); +int jbd2_transaction_committed(journal_t *journal, tid_t tid);  int jbd2_complete_transaction(journal_t *journal, tid_t tid);  int jbd2_log_do_checkpoint(journal_t *journal);  int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid); diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 734377ad42e9..9385aa57497b 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_JIFFIES_H  #define _LINUX_JIFFIES_H diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h index 98cd41bb39c8..9fb870524314 100644 --- a/include/linux/journal-head.h +++ b/include/linux/journal-head.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/journal-head.h   * diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index cd5861651b17..c7b368c734af 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_JUMP_LABEL_H  #define _LINUX_JUMP_LABEL_H @@ -81,9 +82,9 @@  extern bool static_key_initialized; -#define STATIC_KEY_CHECK_USE() WARN(!static_key_initialized,		      \ -				    "%s used before call to jump_label_init", \ -				    __func__) +#define STATIC_KEY_CHECK_USE(key) WARN(!static_key_initialized,		      \ +				    "%s(): static key '%pS' used before call to jump_label_init()", \ +				    __func__, (key))  #ifdef HAVE_JUMP_LABEL @@ -211,13 +212,13 @@ static __always_inline bool static_key_true(struct static_key *key)  static inline void static_key_slow_inc(struct static_key *key)  { -	STATIC_KEY_CHECK_USE(); +	STATIC_KEY_CHECK_USE(key);  	atomic_inc(&key->enabled);  }  static inline void static_key_slow_dec(struct static_key *key)  { -	STATIC_KEY_CHECK_USE(); +	STATIC_KEY_CHECK_USE(key);  	atomic_dec(&key->enabled);  } @@ -236,7 +237,7 @@ static inline int jump_label_apply_nops(struct module *mod)  static inline void static_key_enable(struct static_key *key)  { -	STATIC_KEY_CHECK_USE(); +	STATIC_KEY_CHECK_USE(key);  	if (atomic_read(&key->enabled) != 0) {  		WARN_ON_ONCE(atomic_read(&key->enabled) != 1); @@ -247,7 +248,7 @@ static inline void static_key_enable(struct static_key *key)  static inline void static_key_disable(struct static_key *key)  { -	STATIC_KEY_CHECK_USE(); +	STATIC_KEY_CHECK_USE(key);  	if (atomic_read(&key->enabled) != 1) {  		WARN_ON_ONCE(atomic_read(&key->enabled) != 0); diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h index 23da3af459fe..baa8eabbaa56 100644 --- a/include/linux/jump_label_ratelimit.h +++ b/include/linux/jump_label_ratelimit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_JUMP_LABEL_RATELIMIT_H  #define _LINUX_JUMP_LABEL_RATELIMIT_H @@ -24,18 +25,18 @@ struct static_key_deferred {  };  static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)  { -	STATIC_KEY_CHECK_USE(); +	STATIC_KEY_CHECK_USE(key);  	static_key_slow_dec(&key->key);  }  static inline void static_key_deferred_flush(struct static_key_deferred *key)  { -	STATIC_KEY_CHECK_USE(); +	STATIC_KEY_CHECK_USE(key);  }  static inline void  jump_label_rate_limit(struct static_key_deferred *key,  		unsigned long rl)  { -	STATIC_KEY_CHECK_USE(); +	STATIC_KEY_CHECK_USE(key);  }  #endif	/* HAVE_JUMP_LABEL */  #endif	/* _LINUX_JUMP_LABEL_RATELIMIT_H */ diff --git a/include/linux/jz4740-adc.h b/include/linux/jz4740-adc.h index 8184578fbfa4..19d995c8bf06 100644 --- a/include/linux/jz4740-adc.h +++ b/include/linux/jz4740-adc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_JZ4740_ADC  #define __LINUX_JZ4740_ADC diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 6883e197acb9..708f337d780b 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Rewritten and vastly simplified by Rusty Russell for in-kernel   * module loader:   *   Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation @@ -13,6 +14,12 @@  #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \  			 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) +#ifndef CONFIG_64BIT +# define KALLSYM_FMT "%08lx" +#else +# define KALLSYM_FMT "%016lx" +#endif +  struct module;  #ifdef CONFIG_KALLSYMS @@ -45,6 +52,9 @@ extern void __print_symbol(const char *fmt, 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 int kallsyms_show_value(void); +  #else /* !CONFIG_KALLSYMS */  static inline unsigned long kallsyms_lookup_name(const char *name) @@ -103,6 +113,11 @@ static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, u  	return -ERANGE;  } +static inline int kallsyms_show_value(void) +{ +	return false; +} +  /* Stupid that this does nothing, but I didn't create this mess. */  #define __print_symbol(fmt, addr)  #endif /*CONFIG_KALLSYMS*/ diff --git a/include/linux/kasan-checks.h b/include/linux/kasan-checks.h index 41960fecf783..d314150658a4 100644 --- a/include/linux/kasan-checks.h +++ b/include/linux/kasan-checks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KASAN_CHECKS_H  #define _LINUX_KASAN_CHECKS_H diff --git a/include/linux/kasan.h b/include/linux/kasan.h index a5c7046f26b4..e3eb834c9a35 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KASAN_H  #define _LINUX_KASAN_H @@ -45,7 +46,7 @@ void kasan_alloc_pages(struct page *page, unsigned int order);  void kasan_free_pages(struct page *page, unsigned int order);  void kasan_cache_create(struct kmem_cache *cache, size_t *size, -			unsigned long *flags); +			slab_flags_t *flags);  void kasan_cache_shrink(struct kmem_cache *cache);  void kasan_cache_shutdown(struct kmem_cache *cache); @@ -94,7 +95,7 @@ static inline void kasan_free_pages(struct page *page, unsigned int order) {}  static inline void kasan_cache_create(struct kmem_cache *cache,  				      size_t *size, -				      unsigned long *flags) {} +				      slab_flags_t *flags) {}  static inline void kasan_cache_shrink(struct kmem_cache *cache) {}  static inline void kasan_cache_shutdown(struct kmem_cache *cache) {} diff --git a/include/linux/kbd_diacr.h b/include/linux/kbd_diacr.h index 7274ec68c246..738c7340c151 100644 --- a/include/linux/kbd_diacr.h +++ b/include/linux/kbd_diacr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _DIACR_H  #define _DIACR_H  #include <linux/kd.h> diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index cbfb171bbcba..bb2246c8ec13 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _KBD_KERN_H  #define _KBD_KERN_H diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h index 4e80f3a9ad58..e7be517aaaf6 100644 --- a/include/linux/kbuild.h +++ b/include/linux/kbuild.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_KBUILD_H  #define __LINUX_KBUILD_H diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 4d748603e818..fec5076eda91 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_KCONFIG_H  #define __LINUX_KCONFIG_H diff --git a/include/linux/kcore.h b/include/linux/kcore.h index d92762286645..7ff25a808fef 100644 --- a/include/linux/kcore.h +++ b/include/linux/kcore.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * /proc/kcore definitions   */ diff --git a/include/linux/kcov.h b/include/linux/kcov.h index 2883ac98c280..3ecf6f5e3a5f 100644 --- a/include/linux/kcov.h +++ b/include/linux/kcov.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KCOV_H  #define _LINUX_KCOV_H @@ -7,19 +8,23 @@ struct task_struct;  #ifdef CONFIG_KCOV -void kcov_task_init(struct task_struct *t); -void kcov_task_exit(struct task_struct *t); -  enum kcov_mode {  	/* Coverage collection is not enabled yet. */  	KCOV_MODE_DISABLED = 0, +	/* KCOV was initialized, but tracing mode hasn't been chosen yet. */ +	KCOV_MODE_INIT = 1,  	/*  	 * Tracing coverage collection mode.  	 * Covered PCs are collected in a per-task buffer.  	 */ -	KCOV_MODE_TRACE = 1, +	KCOV_MODE_TRACE_PC = 2, +	/* Collecting comparison operands mode. */ +	KCOV_MODE_TRACE_CMP = 3,  }; +void kcov_task_init(struct task_struct *t); +void kcov_task_exit(struct task_struct *t); +  #else  static inline void kcov_task_init(struct task_struct *t) {} diff --git a/include/linux/kd.h b/include/linux/kd.h index 25bd17fad239..b130a18f860f 100644 --- a/include/linux/kd.h +++ b/include/linux/kd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KD_H  #define _LINUX_KD_H diff --git a/include/linux/kdebug.h b/include/linux/kdebug.h index ed815090b3bc..fd311565fabf 100644 --- a/include/linux/kdebug.h +++ b/include/linux/kdebug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KDEBUG_H  #define _LINUX_KDEBUG_H diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h index 8e9e288b08c1..85b5151911cf 100644 --- a/include/linux/kdev_t.h +++ b/include/linux/kdev_t.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KDEV_T_H  #define _LINUX_KDEV_T_H diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h index f282d4e87258..d237fe854ad9 100644 --- a/include/linux/kern_levels.h +++ b/include/linux/kern_levels.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __KERN_LEVELS_H__  #define __KERN_LEVELS_H__ diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h index f65ce09784f1..abd20ef93c98 100644 --- a/include/linux/kernel-page-flags.h +++ b/include/linux/kernel-page-flags.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_KERNEL_PAGE_FLAGS_H  #define LINUX_KERNEL_PAGE_FLAGS_H diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 0ad4c3044cf9..ce51455e2adf 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KERNEL_H  #define _LINUX_KERNEL_H @@ -44,6 +45,12 @@  #define STACK_MAGIC	0xdeadbeef +/** + * REPEAT_BYTE - repeat the value @x multiple times as an unsigned long value + * @x: value to repeat + * + * NOTE: @x is not checked for > 0xff; larger values produce odd results. + */  #define REPEAT_BYTE(x)	((~0ul / 0xff) * (x))  /* @a is a power of 2 value */ @@ -57,6 +64,10 @@  #define READ			0  #define WRITE			1 +/** + * ARRAY_SIZE - get the number of elements in array @arr + * @arr: array to be sized + */  #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))  #define u64_to_user_ptr(x) (		\ @@ -76,7 +87,15 @@  #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)  #define round_down(x, y) ((x) & ~__round_mask(x, y)) +/** + * FIELD_SIZEOF - get the size of a struct's field + * @t: the target struct + * @f: the target struct's field + * Return: the size of @f in the struct definition without having a + * declared instance of @t. + */  #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) +  #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP  #define DIV_ROUND_DOWN_ULL(ll, d) \ @@ -107,7 +126,7 @@  /*   * Divide positive or negative dividend by positive or negative divisor   * and round to closest integer. Result is undefined for negative - * divisors if he dividend variable type is unsigned and for negative + * divisors if the dividend variable type is unsigned and for negative   * dividends if the divisor variable type is unsigned.   */  #define DIV_ROUND_CLOSEST(x, divisor)(			\ @@ -247,13 +266,13 @@ extern int _cond_resched(void);   * @ep_ro: right open interval endpoint   *   * Perform a "reciprocal multiplication" in order to "scale" a value into - * range [0, ep_ro), where the upper interval endpoint is right-open. + * range [0, @ep_ro), where the upper interval endpoint is right-open.   * This is useful, e.g. for accessing a index of an array containing - * ep_ro elements, for example. Think of it as sort of modulus, only that + * @ep_ro elements, for example. Think of it as sort of modulus, only that   * the result isn't that of modulo. ;) Note that if initial input is a   * small value, then result will return 0.   * - * Return: a result based on val in interval [0, ep_ro). + * Return: a result based on @val in interval [0, @ep_ro).   */  static inline u32 reciprocal_scale(u32 val, u32 ep_ro)  { @@ -530,7 +549,8 @@ extern enum system_states {  #define TAINT_UNSIGNED_MODULE		13  #define TAINT_SOFTLOCKUP		14  #define TAINT_LIVEPATCH			15 -#define TAINT_FLAGS_COUNT		16 +#define TAINT_AUX			16 +#define TAINT_FLAGS_COUNT		17  struct taint_flag {  	char c_true;	/* character printed when tainted */ @@ -618,8 +638,8 @@ do {									\   * trace_printk - printf formatting in the ftrace buffer   * @fmt: the printf format for printing   * - * Note: __trace_printk is an internal function for trace_printk and - *       the @ip is passed in via the trace_printk macro. + * Note: __trace_printk is an internal function for trace_printk() and + *       the @ip is passed in via the trace_printk() macro.   *   * This function allows a kernel developer to debug fast path sections   * that printk is not appropriate for. By scattering in various @@ -629,7 +649,7 @@ do {									\   * This is intended as a debugging tool for the developer only.   * Please refrain from leaving trace_printks scattered around in   * your code. (Extra memory is used for special buffers that are - * allocated when trace_printk() is used) + * allocated when trace_printk() is used.)   *   * A little optization trick is done here. If there's only one   * argument, there's no need to scan the string for printf formats. @@ -681,7 +701,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);   *       the @ip is passed in via the trace_puts macro.   *   * This is similar to trace_printk() but is made for those really fast - * paths that a developer wants the least amount of "Heisenbug" affects, + * paths that a developer wants the least amount of "Heisenbug" effects,   * where the processing of the print format is still too much.   *   * This function allows a kernel developer to debug fast path sections @@ -692,7 +712,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);   * This is intended as a debugging tool for the developer only.   * Please refrain from leaving trace_puts scattered around in   * your code. (Extra memory is used for special buffers that are - * allocated when trace_puts() is used) + * allocated when trace_puts() is used.)   *   * Returns: 0 if nothing was written, positive # if string was.   *  (1 when __trace_bputs is used, strlen(str) when __trace_puts is used) @@ -771,6 +791,12 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }  	t2 min2 = (y);					\  	(void) (&min1 == &min2);			\  	min1 < min2 ? min1 : min2; }) + +/** + * min - return minimum of two values of the same or compatible types + * @x: first value + * @y: second value + */  #define min(x, y)					\  	__min(typeof(x), typeof(y),			\  	      __UNIQUE_ID(min1_), __UNIQUE_ID(min2_),	\ @@ -781,12 +807,31 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }  	t2 max2 = (y);					\  	(void) (&max1 == &max2);			\  	max1 > max2 ? max1 : max2; }) + +/** + * max - return maximum of two values of the same or compatible types + * @x: first value + * @y: second value + */  #define max(x, y)					\  	__max(typeof(x), typeof(y),			\  	      __UNIQUE_ID(max1_), __UNIQUE_ID(max2_),	\  	      x, y) +/** + * min3 - return minimum of three values + * @x: first value + * @y: second value + * @z: third value + */  #define min3(x, y, z) min((typeof(x))min(x, y), z) + +/** + * max3 - return maximum of three values + * @x: first value + * @y: second value + * @z: third value + */  #define max3(x, y, z) max((typeof(x))max(x, y), z)  /** @@ -805,8 +850,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }   * @lo: lowest allowable value   * @hi: highest allowable value   * - * This macro does strict typechecking of lo/hi to make sure they are of the - * same type as val.  See the unnecessary pointer comparisons. + * This macro does strict typechecking of @lo/@hi to make sure they are of the + * same type as @val.  See the unnecessary pointer comparisons.   */  #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi) @@ -816,11 +861,24 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }   *   * Or not use min/max/clamp at all, of course.   */ + +/** + * min_t - return minimum of two values, using the specified type + * @type: data type to use + * @x: first value + * @y: second value + */  #define min_t(type, x, y)				\  	__min(type, type,				\  	      __UNIQUE_ID(min1_), __UNIQUE_ID(min2_),	\  	      x, y) +/** + * max_t - return maximum of two values, using the specified type + * @type: data type to use + * @x: first value + * @y: second value + */  #define max_t(type, x, y)				\  	__max(type, type,				\  	      __UNIQUE_ID(min1_), __UNIQUE_ID(min2_),	\ @@ -834,7 +892,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }   * @hi: maximum allowable value   *   * This macro does no typechecking and uses temporary variables of type - * 'type' to make all the comparisons. + * @type to make all the comparisons.   */  #define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi) @@ -845,15 +903,17 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }   * @hi: maximum allowable value   *   * This macro does no typechecking and uses temporary variables of whatever - * type the input argument 'val' is.  This is useful when val is an unsigned - * type and min and max are literals that will otherwise be assigned a signed + * type the input argument @val is.  This is useful when @val is an unsigned + * type and @lo and @hi are literals that will otherwise be assigned a signed   * integer type.   */  #define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi) -/* - * swap - swap value of @a and @b +/** + * swap - swap values of @a and @b + * @a: first value + * @b: second value   */  #define swap(a, b) \  	do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 66be8b6beceb..7ee2bb43b251 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KERNEL_STAT_H  #define _LINUX_KERNEL_STAT_H diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h index e985ba679c4a..075fab5f92e1 100644 --- a/include/linux/kernelcapi.h +++ b/include/linux/kernelcapi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $   *  diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 2b7590f5483a..f16f6ceb3875 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_KEXEC_H  #define LINUX_KEXEC_H @@ -159,7 +160,7 @@ struct kexec_buf {  };  int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf, -			       int (*func)(u64, u64, void *)); +			       int (*func)(struct resource *, void *));  extern int kexec_add_buffer(struct kexec_buf *kbuf);  int kexec_locate_mem_hole(struct kexec_buf *kbuf);  #endif /* CONFIG_KEXEC_FILE */ diff --git a/include/linux/key-type.h b/include/linux/key-type.h index 9520fc3c3b9a..05d8fb5a06c4 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h @@ -44,7 +44,7 @@ struct key_preparsed_payload {  	const void	*data;		/* Raw data */  	size_t		datalen;	/* Raw datalen */  	size_t		quotalen;	/* Quota length for proposed payload */ -	time_t		expiry;		/* Expiry time of key */ +	time64_t	expiry;		/* Expiry time of key */  } __randomize_layout;  typedef int (*request_key_actor_t)(struct key_construction *key, diff --git a/include/linux/key.h b/include/linux/key.h index e315e16b6ff8..e58ee10f6e58 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -24,6 +24,7 @@  #include <linux/atomic.h>  #include <linux/assoc_array.h>  #include <linux/refcount.h> +#include <linux/time64.h>  #ifdef __KERNEL__  #include <linux/uidgid.h> @@ -138,6 +139,11 @@ struct key_restriction {  	struct key_type *keytype;  }; +enum key_state { +	KEY_IS_UNINSTANTIATED, +	KEY_IS_POSITIVE,		/* Positively instantiated */ +}; +  /*****************************************************************************/  /*   * authentication token / access credential / keyring @@ -157,10 +163,10 @@ struct key {  	struct key_user		*user;		/* owner of this key */  	void			*security;	/* security data for this key */  	union { -		time_t		expiry;		/* time at which key expires (or 0) */ -		time_t		revoked_at;	/* time at which key was revoked */ +		time64_t	expiry;		/* time at which key expires (or 0) */ +		time64_t	revoked_at;	/* time at which key was revoked */  	}; -	time_t			last_used_at;	/* last time used for LRU keyring discard */ +	time64_t		last_used_at;	/* last time used for LRU keyring discard */  	kuid_t			uid;  	kgid_t			gid;  	key_perm_t		perm;		/* access permissions */ @@ -169,6 +175,7 @@ struct key {  						 * - may not match RCU dereferenced payload  						 * - payload should contain own length  						 */ +	short			state;		/* Key state (+) or rejection error (-) */  #ifdef KEY_DEBUGGING  	unsigned		magic; @@ -176,18 +183,16 @@ struct key {  #endif  	unsigned long		flags;		/* status flags (change with bitops) */ -#define KEY_FLAG_INSTANTIATED	0	/* set if key has been instantiated */ -#define KEY_FLAG_DEAD		1	/* set if key type has been deleted */ -#define KEY_FLAG_REVOKED	2	/* set if key had been revoked */ -#define KEY_FLAG_IN_QUOTA	3	/* set if key consumes quota */ -#define KEY_FLAG_USER_CONSTRUCT	4	/* set if key is being constructed in userspace */ -#define KEY_FLAG_NEGATIVE	5	/* set if key is negative */ -#define KEY_FLAG_ROOT_CAN_CLEAR	6	/* set if key can be cleared by root without permission */ -#define KEY_FLAG_INVALIDATED	7	/* set if key has been invalidated */ -#define KEY_FLAG_BUILTIN	8	/* set if key is built in to the kernel */ -#define KEY_FLAG_ROOT_CAN_INVAL	9	/* set if key can be invalidated by root without permission */ -#define KEY_FLAG_KEEP		10	/* set if key should not be removed */ -#define KEY_FLAG_UID_KEYRING	11	/* set if key is a user or user session keyring */ +#define KEY_FLAG_DEAD		0	/* set if key type has been deleted */ +#define KEY_FLAG_REVOKED	1	/* set if key had been revoked */ +#define KEY_FLAG_IN_QUOTA	2	/* set if key consumes quota */ +#define KEY_FLAG_USER_CONSTRUCT	3	/* set if key is being constructed in userspace */ +#define KEY_FLAG_ROOT_CAN_CLEAR	4	/* set if key can be cleared by root without permission */ +#define KEY_FLAG_INVALIDATED	5	/* set if key has been invalidated */ +#define KEY_FLAG_BUILTIN	6	/* set if key is built in to the kernel */ +#define KEY_FLAG_ROOT_CAN_INVAL	7	/* set if key can be invalidated by root without permission */ +#define KEY_FLAG_KEEP		8	/* set if key should not be removed */ +#define KEY_FLAG_UID_KEYRING	9	/* set if key is a user or user session keyring */  	/* the key type and key description string  	 * - the desc is used to match a key against search criteria @@ -213,7 +218,6 @@ struct key {  			struct list_head name_link;  			struct assoc_array keys;  		}; -		int reject_error;  	};  	/* This is set on a keyring to restrict the addition of a link to a key @@ -353,17 +357,27 @@ extern void key_set_timeout(struct key *, unsigned);  #define	KEY_NEED_SETATTR 0x20	/* Require permission to change attributes */  #define	KEY_NEED_ALL	0x3f	/* All the above permissions */ +static inline short key_read_state(const struct key *key) +{ +	/* Barrier versus mark_key_instantiated(). */ +	return smp_load_acquire(&key->state); +} +  /** - * key_is_instantiated - Determine if a key has been positively instantiated + * key_is_positive - Determine if a key has been positively instantiated   * @key: The key to check.   *   * Return true if the specified key has been positively instantiated, false   * otherwise.   */ -static inline bool key_is_instantiated(const struct key *key) +static inline bool key_is_positive(const struct key *key) +{ +	return key_read_state(key) == KEY_IS_POSITIVE; +} + +static inline bool key_is_negative(const struct key *key)  { -	return test_bit(KEY_FLAG_INSTANTIATED, &key->flags) && -		!test_bit(KEY_FLAG_NEGATIVE, &key->flags); +	return key_read_state(key) < 0;  }  #define dereference_key_rcu(KEY)					\ diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h index 131ed5146521..73d11e4090cf 100644 --- a/include/linux/keyboard.h +++ b/include/linux/keyboard.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_KEYBOARD_H  #define __LINUX_KEYBOARD_H diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 41eb6fdf87a8..7b45959ebd92 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h @@ -325,7 +325,7 @@ __kfifo_uint_must_check_helper( \   *   * This macro dynamically allocates a new fifo buffer.   * - * The numer of elements will be rounded-up to a power of 2. + * The number of elements will be rounded-up to a power of 2.   * The fifo will be release with kfifo_free().   * Return 0 if no error, otherwise an error code.   */ @@ -358,9 +358,9 @@ __kfifo_int_must_check_helper( \   * @buffer: the preallocated buffer to be used   * @size: the size of the internal buffer, this have to be a power of 2   * - * This macro initialize a fifo using a preallocated buffer. + * This macro initializes a fifo using a preallocated buffer.   * - * The numer of elements will be rounded-up to a power of 2. + * The number of elements will be rounded-up to a power of 2.   * Return 0 if no error, otherwise an error code.   */  #define kfifo_init(fifo, buffer, size) \ diff --git a/include/linux/khugepaged.h b/include/linux/khugepaged.h index f0d7335336cd..082d1d2a5216 100644 --- a/include/linux/khugepaged.h +++ b/include/linux/khugepaged.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KHUGEPAGED_H  #define _LINUX_KHUGEPAGED_H diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h index 39f8453239f7..ea32a7d3cf1b 100644 --- a/include/linux/kmemcheck.h +++ b/include/linux/kmemcheck.h @@ -1,171 +1 @@ -#ifndef LINUX_KMEMCHECK_H -#define LINUX_KMEMCHECK_H - -#include <linux/mm_types.h> -#include <linux/types.h> - -#ifdef CONFIG_KMEMCHECK -extern int kmemcheck_enabled; - -/* The slab-related functions. */ -void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node); -void kmemcheck_free_shadow(struct page *page, int order); -void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object, -			  size_t size); -void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size); - -void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order, -			       gfp_t gfpflags); - -void kmemcheck_show_pages(struct page *p, unsigned int n); -void kmemcheck_hide_pages(struct page *p, unsigned int n); - -bool kmemcheck_page_is_tracked(struct page *p); - -void kmemcheck_mark_unallocated(void *address, unsigned int n); -void kmemcheck_mark_uninitialized(void *address, unsigned int n); -void kmemcheck_mark_initialized(void *address, unsigned int n); -void kmemcheck_mark_freed(void *address, unsigned int n); - -void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n); -void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n); -void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n); - -int kmemcheck_show_addr(unsigned long address); -int kmemcheck_hide_addr(unsigned long address); - -bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); - -/* - * Bitfield annotations - * - * How to use: If you have a struct using bitfields, for example - * - *     struct a { - *             int x:8, y:8; - *     }; - * - * then this should be rewritten as - * - *     struct a { - *             kmemcheck_bitfield_begin(flags); - *             int x:8, y:8; - *             kmemcheck_bitfield_end(flags); - *     }; - * - * Now the "flags_begin" and "flags_end" members may be used to refer to the - * beginning and end, respectively, of the bitfield (and things like - * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- - * fields should be annotated: - * - *     struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); - *     kmemcheck_annotate_bitfield(a, flags); - */ -#define kmemcheck_bitfield_begin(name)	\ -	int name##_begin[0]; - -#define kmemcheck_bitfield_end(name)	\ -	int name##_end[0]; - -#define kmemcheck_annotate_bitfield(ptr, name)				\ -	do {								\ -		int _n;							\ -									\ -		if (!ptr)						\ -			break;						\ -									\ -		_n = (long) &((ptr)->name##_end)			\ -			- (long) &((ptr)->name##_begin);		\ -		BUILD_BUG_ON(_n < 0);					\ -									\ -		kmemcheck_mark_initialized(&((ptr)->name##_begin), _n);	\ -	} while (0) - -#define kmemcheck_annotate_variable(var)				\ -	do {								\ -		kmemcheck_mark_initialized(&(var), sizeof(var));	\ -	} while (0)							\ - -#else -#define kmemcheck_enabled 0 - -static inline void -kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node) -{ -} - -static inline void -kmemcheck_free_shadow(struct page *page, int order) -{ -} - -static inline void -kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object, -		     size_t size) -{ -} - -static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object, -				       size_t size) -{ -} - -static inline void kmemcheck_pagealloc_alloc(struct page *p, -	unsigned int order, gfp_t gfpflags) -{ -} - -static inline bool kmemcheck_page_is_tracked(struct page *p) -{ -	return false; -} - -static inline void kmemcheck_mark_unallocated(void *address, unsigned int n) -{ -} - -static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n) -{ -} - -static inline void kmemcheck_mark_initialized(void *address, unsigned int n) -{ -} - -static inline void kmemcheck_mark_freed(void *address, unsigned int n) -{ -} - -static inline void kmemcheck_mark_unallocated_pages(struct page *p, -						    unsigned int n) -{ -} - -static inline void kmemcheck_mark_uninitialized_pages(struct page *p, -						      unsigned int n) -{ -} - -static inline void kmemcheck_mark_initialized_pages(struct page *p, -						    unsigned int n) -{ -} - -static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size) -{ -	return true; -} - -#define kmemcheck_bitfield_begin(name) -#define kmemcheck_bitfield_end(name) -#define kmemcheck_annotate_bitfield(ptr, name)	\ -	do {					\ -	} while (0) - -#define kmemcheck_annotate_variable(var)	\ -	do {					\ -	} while (0) - -#endif /* CONFIG_KMEMCHECK */ - -#endif /* LINUX_KMEMCHECK_H */ +/* SPDX-License-Identifier: GPL-2.0 */ diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h index 590343f6c1b1..5ac416e2d339 100644 --- a/include/linux/kmemleak.h +++ b/include/linux/kmemleak.h @@ -48,14 +48,14 @@ extern void kmemleak_not_leak_phys(phys_addr_t phys) __ref;  extern void kmemleak_ignore_phys(phys_addr_t phys) __ref;  static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, -					    int min_count, unsigned long flags, +					    int min_count, slab_flags_t flags,  					    gfp_t gfp)  {  	if (!(flags & SLAB_NOLEAKTRACE))  		kmemleak_alloc(ptr, size, min_count, gfp);  } -static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags) +static inline void kmemleak_free_recursive(const void *ptr, slab_flags_t flags)  {  	if (!(flags & SLAB_NOLEAKTRACE))  		kmemleak_free(ptr); @@ -76,7 +76,7 @@ static inline void kmemleak_alloc(const void *ptr, size_t size, int min_count,  {  }  static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, -					    int min_count, unsigned long flags, +					    int min_count, slab_flags_t flags,  					    gfp_t gfp)  {  } @@ -94,7 +94,7 @@ static inline void kmemleak_free(const void *ptr)  static inline void kmemleak_free_part(const void *ptr, size_t size)  {  } -static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags) +static inline void kmemleak_free_recursive(const void *ptr, slab_flags_t flags)  {  }  static inline void kmemleak_free_percpu(const void __percpu *ptr) diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h index 18ca75ffcc5a..c9919f8b2293 100644 --- a/include/linux/kobj_map.h +++ b/include/linux/kobj_map.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * kobj_map.h   */ diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index bd2684700b74..9440a2fc8893 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -391,10 +391,6 @@ int register_kprobes(struct kprobe **kps, int num);  void unregister_kprobes(struct kprobe **kps, int num);  int setjmp_pre_handler(struct kprobe *, struct pt_regs *);  int longjmp_break_handler(struct kprobe *, struct pt_regs *); -int register_jprobe(struct jprobe *p); -void unregister_jprobe(struct jprobe *p); -int register_jprobes(struct jprobe **jps, int num); -void unregister_jprobes(struct jprobe **jps, int num);  void jprobe_return(void);  unsigned long arch_deref_entry_point(void *); @@ -443,20 +439,6 @@ static inline void unregister_kprobe(struct kprobe *p)  static inline void unregister_kprobes(struct kprobe **kps, int num)  {  } -static inline int register_jprobe(struct jprobe *p) -{ -	return -ENOSYS; -} -static inline int register_jprobes(struct jprobe **jps, int num) -{ -	return -ENOSYS; -} -static inline void unregister_jprobe(struct jprobe *p) -{ -} -static inline void unregister_jprobes(struct jprobe **jps, int num) -{ -}  static inline void jprobe_return(void)  {  } @@ -486,6 +468,20 @@ static inline int enable_kprobe(struct kprobe *kp)  	return -ENOSYS;  }  #endif /* CONFIG_KPROBES */ +static inline int register_jprobe(struct jprobe *p) +{ +	return -ENOSYS; +} +static inline int register_jprobes(struct jprobe **jps, int num) +{ +	return -ENOSYS; +} +static inline void unregister_jprobe(struct jprobe *p) +{ +} +static inline void unregister_jprobes(struct jprobe **jps, int num) +{ +}  static inline int disable_kretprobe(struct kretprobe *rp)  {  	return disable_kprobe(&rp->kp); @@ -496,11 +492,11 @@ static inline int enable_kretprobe(struct kretprobe *rp)  }  static inline int disable_jprobe(struct jprobe *jp)  { -	return disable_kprobe(&jp->kp); +	return -ENOSYS;  }  static inline int enable_jprobe(struct jprobe *jp)  { -	return enable_kprobe(&jp->kp); +	return -ENOSYS;  }  #ifndef CONFIG_KPROBES diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 78b44a024eaa..44368b19b27e 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_KSM_H  #define __LINUX_KSM_H  /* diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 82e197eeac91..c1961761311d 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -1,8 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KTHREAD_H  #define _LINUX_KTHREAD_H  /* Simple interface for creating and stopping kernel threads without mess. */  #include <linux/err.h>  #include <linux/sched.h> +#include <linux/cgroup.h>  __printf(4, 5)  struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), @@ -75,7 +77,7 @@ extern int tsk_fork_get_node(struct task_struct *tsk);   */  struct kthread_work;  typedef void (*kthread_work_func_t)(struct kthread_work *work); -void kthread_delayed_work_timer_fn(unsigned long __data); +void kthread_delayed_work_timer_fn(struct timer_list *t);  enum {  	KTW_FREEZABLE		= 1 << 0,	/* freeze during suspend */ @@ -116,8 +118,7 @@ struct kthread_delayed_work {  #define KTHREAD_DELAYED_WORK_INIT(dwork, fn) {				\  	.work = KTHREAD_WORK_INIT((dwork).work, (fn)),			\ -	.timer = __TIMER_INITIALIZER(kthread_delayed_work_timer_fn,	\ -				     0, (unsigned long)&(dwork),	\ +	.timer = __TIMER_INITIALIZER(kthread_delayed_work_timer_fn,\  				     TIMER_IRQSAFE),			\  	} @@ -163,10 +164,9 @@ extern void __kthread_init_worker(struct kthread_worker *worker,  #define kthread_init_delayed_work(dwork, fn)				\  	do {								\  		kthread_init_work(&(dwork)->work, (fn));		\ -		__setup_timer(&(dwork)->timer,				\ -			      kthread_delayed_work_timer_fn,		\ -			      (unsigned long)(dwork),			\ -			      TIMER_IRQSAFE);				\ +		__init_timer(&(dwork)->timer,				\ +			     kthread_delayed_work_timer_fn,		\ +			     TIMER_IRQSAFE);				\  	} while (0)  int kthread_worker_fn(void *worker_ptr); @@ -198,4 +198,14 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work);  void kthread_destroy_worker(struct kthread_worker *worker); +#ifdef CONFIG_BLK_CGROUP +void kthread_associate_blkcg(struct cgroup_subsys_state *css); +struct cgroup_subsys_state *kthread_blkcg(void); +#else +static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } +static inline struct cgroup_subsys_state *kthread_blkcg(void) +{ +	return NULL; +} +#endif  #endif /* _LINUX_KTHREAD_H */ diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 0c8bd45c8206..5b9fddbaac41 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -270,5 +270,6 @@ static inline ktime_t ms_to_ktime(u64 ms)  }  # include <linux/timekeeping.h> +# include <linux/timekeeping32.h>  #endif diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 6882538eda32..2e754b7c282c 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -667,6 +667,7 @@ kvm_pfn_t __gfn_to_pfn_memslot(struct kvm_memory_slot *slot, gfn_t gfn,  			       bool *writable);  void kvm_release_pfn_clean(kvm_pfn_t pfn); +void kvm_release_pfn_dirty(kvm_pfn_t pfn);  void kvm_set_pfn_dirty(kvm_pfn_t pfn);  void kvm_set_pfn_accessed(kvm_pfn_t pfn);  void kvm_get_pfn(kvm_pfn_t pfn); diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h index 35e568f04b1e..51f6ef2c2ff4 100644 --- a/include/linux/kvm_para.h +++ b/include/linux/kvm_para.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_KVM_PARA_H  #define __LINUX_KVM_PARA_H diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h index bffdb962f1a6..0402eda1a94e 100644 --- a/include/linux/l2tp.h +++ b/include/linux/l2tp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * L2TP-over-IP socket for L2TPv3.   * diff --git a/include/linux/lapb.h b/include/linux/lapb.h index 873c1eb635e4..eb56472f23b2 100644 --- a/include/linux/lapb.h +++ b/include/linux/lapb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * These are the public elements of the Linux LAPB module.   */ diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h index 59ccab297ae0..7c560e0dc8f4 100644 --- a/include/linux/latencytop.h +++ b/include/linux/latencytop.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * latencytop.h: Infrastructure for displaying latency   * diff --git a/include/linux/lcd.h b/include/linux/lcd.h index 504f6246f38f..851eee8fff25 100644 --- a/include/linux/lcd.h +++ b/include/linux/lcd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * LCD Lowlevel Control Abstraction   * diff --git a/include/linux/lcm.h b/include/linux/lcm.h index 1ce79a7f1daa..0db3efd56efb 100644 --- a/include/linux/lcm.h +++ b/include/linux/lcm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LCM_H  #define _LCM_H diff --git a/include/linux/leds.h b/include/linux/leds.h index bf6db4fe895b..5579c64c8fd6 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -40,16 +40,16 @@ struct led_classdev {  	int			 flags;  	/* Lower 16 bits reflect status */ -#define LED_SUSPENDED		(1 << 0) -#define LED_UNREGISTERING	(1 << 1) +#define LED_SUSPENDED		BIT(0) +#define LED_UNREGISTERING	BIT(1)  	/* Upper 16 bits reflect control information */ -#define LED_CORE_SUSPENDRESUME	(1 << 16) -#define LED_SYSFS_DISABLE	(1 << 17) -#define LED_DEV_CAP_FLASH	(1 << 18) -#define LED_HW_PLUGGABLE	(1 << 19) -#define LED_PANIC_INDICATOR	(1 << 20) -#define LED_BRIGHT_HW_CHANGED	(1 << 21) -#define LED_RETAIN_AT_SHUTDOWN	(1 << 22) +#define LED_CORE_SUSPENDRESUME	BIT(16) +#define LED_SYSFS_DISABLE	BIT(17) +#define LED_DEV_CAP_FLASH	BIT(18) +#define LED_HW_PLUGGABLE	BIT(19) +#define LED_PANIC_INDICATOR	BIT(20) +#define LED_BRIGHT_HW_CHANGED	BIT(21) +#define LED_RETAIN_AT_SHUTDOWN	BIT(22)  	/* set_brightness_work / blink_timer flags, atomic, private. */  	unsigned long		work_flags; diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h index a65e9646e4b1..93d101d28943 100644 --- a/include/linux/leds_pwm.h +++ b/include/linux/leds_pwm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * PWM LED driver data - see drivers/leds/leds-pwm.c   */ diff --git a/include/linux/libata.h b/include/linux/libata.h index 931c32f1f18d..ed9826b21c5e 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -522,6 +522,7 @@ enum ata_lpm_policy {  	ATA_LPM_UNKNOWN,  	ATA_LPM_MAX_POWER,  	ATA_LPM_MED_POWER, +	ATA_LPM_MED_POWER_WITH_DIPM, /* Med power + DIPM as win IRST does */  	ATA_LPM_MIN_POWER,  }; diff --git a/include/linux/libfdt.h b/include/linux/libfdt.h index 4c0306c69b4e..27ba06e5d117 100644 --- a/include/linux/libfdt.h +++ b/include/linux/libfdt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _INCLUDE_LIBFDT_H_  #define _INCLUDE_LIBFDT_H_ diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h index 2a663c6bb428..14997285e53d 100644 --- a/include/linux/libfdt_env.h +++ b/include/linux/libfdt_env.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LIBFDT_ENV_H  #define _LIBFDT_ENV_H diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index 3eaad2fbf284..f8109ddb5ef1 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -18,6 +18,18 @@  #include <linux/sizes.h>  #include <linux/types.h>  #include <linux/uuid.h> +#include <linux/spinlock.h> + +struct badrange_entry { +	u64 start; +	u64 length; +	struct list_head list; +}; + +struct badrange { +	struct list_head list; +	spinlock_t lock; +};  enum {  	/* when a dimm supports both PMEM and BLK access a label is required */ @@ -129,9 +141,12 @@ static inline struct nd_blk_region_desc *to_blk_region_desc(  } -int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length); -void nvdimm_forget_poison(struct nvdimm_bus *nvdimm_bus, -		phys_addr_t start, unsigned int len); +void badrange_init(struct badrange *badrange); +int badrange_add(struct badrange *badrange, u64 addr, u64 length); +void badrange_forget(struct badrange *badrange, phys_addr_t start, +		unsigned int len); +int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr, +		u64 length);  struct nvdimm_bus *nvdimm_bus_register(struct device *parent,  		struct nvdimm_bus_descriptor *nfit_desc);  void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus); diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 7dfa56ebbc6d..2d1d9de06728 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef NVM_H  #define NVM_H @@ -56,6 +57,7 @@ typedef int (nvm_get_l2p_tbl_fn)(struct nvm_dev *, u64, u32,  typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, u8 *);  typedef int (nvm_op_set_bb_fn)(struct nvm_dev *, struct ppa_addr *, int, int);  typedef int (nvm_submit_io_fn)(struct nvm_dev *, struct nvm_rq *); +typedef int (nvm_submit_io_sync_fn)(struct nvm_dev *, struct nvm_rq *);  typedef void *(nvm_create_dma_pool_fn)(struct nvm_dev *, char *);  typedef void (nvm_destroy_dma_pool_fn)(void *);  typedef void *(nvm_dev_dma_alloc_fn)(struct nvm_dev *, void *, gfp_t, @@ -69,6 +71,7 @@ struct nvm_dev_ops {  	nvm_op_set_bb_fn	*set_bb_tbl;  	nvm_submit_io_fn	*submit_io; +	nvm_submit_io_sync_fn	*submit_io_sync;  	nvm_create_dma_pool_fn	*create_dma_pool;  	nvm_destroy_dma_pool_fn	*destroy_dma_pool; @@ -460,10 +463,9 @@ struct nvm_tgt_type {  	/* For internal use */  	struct list_head list; +	struct module *owner;  }; -extern struct nvm_tgt_type *nvm_find_target_type(const char *, int); -  extern int nvm_register_tgt_type(struct nvm_tgt_type *);  extern void nvm_unregister_tgt_type(struct nvm_tgt_type *); @@ -478,10 +480,8 @@ extern int nvm_set_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr *,  			      int, int);  extern int nvm_max_phys_sects(struct nvm_tgt_dev *);  extern int nvm_submit_io(struct nvm_tgt_dev *, struct nvm_rq *); +extern int nvm_submit_io_sync(struct nvm_tgt_dev *, struct nvm_rq *);  extern int nvm_erase_sync(struct nvm_tgt_dev *, struct ppa_addr *, int); -extern int nvm_set_rqd_ppalist(struct nvm_tgt_dev *, struct nvm_rq *, -					const struct ppa_addr *, int, int); -extern void nvm_free_rqd_ppalist(struct nvm_tgt_dev *, struct nvm_rq *);  extern int nvm_get_l2p_tbl(struct nvm_tgt_dev *, u64, u32, nvm_l2p_update_fn *,  			   void *);  extern int nvm_get_area(struct nvm_tgt_dev *, sector_t *, sector_t); @@ -490,8 +490,6 @@ extern void nvm_end_io(struct nvm_rq *);  extern int nvm_bb_tbl_fold(struct nvm_dev *, u8 *, int);  extern int nvm_get_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr, u8 *); -extern int nvm_dev_factory(struct nvm_dev *, int flags); -  extern void nvm_part_to_tgt(struct nvm_dev *, sector_t *, int);  #else /* CONFIG_NVM */ diff --git a/include/linux/linkage.h b/include/linux/linkage.h index a6a42dd02466..f68db9e450eb 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -1,7 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_LINKAGE_H  #define _LINUX_LINKAGE_H -#include <linux/compiler.h> +#include <linux/compiler_types.h>  #include <linux/stringify.h>  #include <linux/export.h>  #include <asm/linkage.h> diff --git a/include/linux/linux_logo.h b/include/linux/linux_logo.h index ca5bd91d12e1..5e3581d76c7f 100644 --- a/include/linux/linux_logo.h +++ b/include/linux/linux_logo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_LINUX_LOGO_H  #define _LINUX_LINUX_LOGO_H diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h index f1664c636af0..b72b8cdba765 100644 --- a/include/linux/lis3lv02d.h +++ b/include/linux/lis3lv02d.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LIS3LV02D_H_  #define __LIS3LV02D_H_ diff --git a/include/linux/list.h b/include/linux/list.h index ae537fa46216..4b129df4d46b 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_LIST_H  #define _LINUX_LIST_H diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h index cb483305e1f5..3fc2cc57ba1b 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_LIST_BL_H  #define _LINUX_LIST_BL_H diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h index fa7fd03cb5f9..bb8129a3474d 100644 --- a/include/linux/list_lru.h +++ b/include/linux/list_lru.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright (c) 2013 Red Hat, Inc. and Parallels Inc. All rights reserved.   * Authors: David Chinner and Glauber Costa diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h index 87ff4f58a2f0..3ef96743db8d 100644 --- a/include/linux/list_nulls.h +++ b/include/linux/list_nulls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_LIST_NULLS_H  #define _LINUX_LIST_NULLS_H diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h index 1a2df2efb771..ba79956e848d 100644 --- a/include/linux/list_sort.h +++ b/include/linux/list_sort.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_LIST_SORT_H  #define _LINUX_LIST_SORT_H diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 194991ef9347..fc5c1be3f6f4 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -87,10 +87,35 @@ struct klp_func {  	bool transition;  }; +struct klp_object; + +/** + * struct klp_callbacks - pre/post live-(un)patch callback structure + * @pre_patch:		executed before code patching + * @post_patch:		executed after code patching + * @pre_unpatch:	executed before code unpatching + * @post_unpatch:	executed after code unpatching + * @post_unpatch_enabled:	flag indicating if post-unpatch callback + * 				should run + * + * All callbacks are optional.  Only the pre-patch callback, if provided, + * will be unconditionally executed.  If the parent klp_object fails to + * patch for any reason, including a non-zero error status returned from + * the pre-patch callback, no further callbacks will be executed. + */ +struct klp_callbacks { +	int (*pre_patch)(struct klp_object *obj); +	void (*post_patch)(struct klp_object *obj); +	void (*pre_unpatch)(struct klp_object *obj); +	void (*post_unpatch)(struct klp_object *obj); +	bool post_unpatch_enabled; +}; +  /**   * struct klp_object - kernel object structure for live patching   * @name:	module name (or NULL for vmlinux)   * @funcs:	function entries for functions to be patched in the object + * @callbacks:	functions to be executed pre/post (un)patching   * @kobj:	kobject for sysfs resources   * @mod:	kernel module associated with the patched object   *		(NULL for vmlinux) @@ -100,6 +125,7 @@ struct klp_object {  	/* external */  	const char *name;  	struct klp_func *funcs; +	struct klp_callbacks callbacks;  	/* internal */  	struct kobject kobj; @@ -164,6 +190,14 @@ static inline bool klp_have_reliable_stack(void)  	       IS_ENABLED(CONFIG_HAVE_RELIABLE_STACKTRACE);  } +void *klp_shadow_get(void *obj, unsigned long id); +void *klp_shadow_alloc(void *obj, unsigned long id, void *data, +		       size_t size, gfp_t gfp_flags); +void *klp_shadow_get_or_alloc(void *obj, unsigned long id, void *data, +			      size_t size, gfp_t gfp_flags); +void klp_shadow_free(void *obj, unsigned long id); +void klp_shadow_free_all(unsigned long id); +  #else /* !CONFIG_LIVEPATCH */  static inline int klp_module_coming(struct module *mod) { return 0; } diff --git a/include/linux/llist.h b/include/linux/llist.h index 1957635e6d5f..85abc2915e8d 100644 --- a/include/linux/llist.h +++ b/include/linux/llist.h @@ -198,7 +198,7 @@ static inline void init_llist_head(struct llist_head *list)   */  static inline bool llist_empty(const struct llist_head *head)  { -	return ACCESS_ONCE(head->first) == NULL; +	return READ_ONCE(head->first) == NULL;  }  static inline struct llist_node *llist_next(struct llist_node *node) diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h index 05728396a1a1..053a4ef3d431 100644 --- a/include/linux/lockd/bind.h +++ b/include/linux/lockd/bind.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/lockd/bind.h   * diff --git a/include/linux/lockd/debug.h b/include/linux/lockd/debug.h index 0ca8109934e4..e536c579827f 100644 --- a/include/linux/lockd/debug.h +++ b/include/linux/lockd/debug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/lockd/debug.h   * diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 3eca67728366..d7d313fb9cd4 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/lockd/lockd.h   * diff --git a/include/linux/lockd/nlm.h b/include/linux/lockd/nlm.h index d9d46e442538..6e343ef760dc 100644 --- a/include/linux/lockd/nlm.h +++ b/include/linux/lockd/nlm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/lockd/nlm.h   * diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h index 630c5bf69b07..1f18a9faf645 100644 --- a/include/linux/lockd/share.h +++ b/include/linux/lockd/share.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/lockd/share.h   * diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index 7acbecc21a40..7ab9f264313f 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/lockd/xdr.h   * diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h index bf1645609225..e709fe5924f2 100644 --- a/include/linux/lockd/xdr4.h +++ b/include/linux/lockd/xdr4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/lockd/xdr4.h   * diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index bfa8e0b0d6f1..a842551fe044 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Runtime locking correctness validator   * @@ -527,6 +528,11 @@ static inline void lockdep_on(void)   */  struct lock_class_key { }; +/* + * The lockdep_map takes no space if lockdep is disabled: + */ +struct lockdep_map { }; +  #define lockdep_depth(tsk)	(0)  #define lockdep_is_held_type(l, r)		(1) @@ -719,9 +725,24 @@ do {									\  	lock_acquire(&(lock)->dep_map, 0, 0, 1, 1, NULL, _THIS_IP_);	\  	lock_release(&(lock)->dep_map, 0, _THIS_IP_);			\  } while (0) + +#define lockdep_assert_irqs_enabled()	do {				\ +		WARN_ONCE(debug_locks && !current->lockdep_recursion &&	\ +			  !current->hardirqs_enabled,			\ +			  "IRQs not enabled as expected\n");		\ +	} while (0) + +#define lockdep_assert_irqs_disabled()	do {				\ +		WARN_ONCE(debug_locks && !current->lockdep_recursion &&	\ +			  current->hardirqs_enabled,			\ +			  "IRQs not disabled as expected\n");		\ +	} while (0) +  #else  # define might_lock(lock) do { } while (0)  # define might_lock_read(lock) do { } while (0) +# define lockdep_assert_irqs_enabled() do { } while (0) +# define lockdep_assert_irqs_disabled() do { } while (0)  #endif  #ifdef CONFIG_LOCKDEP diff --git a/include/linux/lockref.h b/include/linux/lockref.h index b10b122dd099..ef3c9342e119 100644 --- a/include/linux/lockref.h +++ b/include/linux/lockref.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_LOCKREF_H  #define __LINUX_LOCKREF_H diff --git a/include/linux/log2.h b/include/linux/log2.h index c373295f359f..41a1ae010993 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h @@ -37,19 +37,23 @@ int __ilog2_u64(u64 n)  }  #endif -/* - *  Determine whether some value is a power of two, where zero is +/** + * is_power_of_2() - check if a value is a power of two + * @n: the value to check + * + * Determine whether some value is a power of two, where zero is   * *not* considered a power of two. + * Return: true if @n is a power of 2, otherwise false.   */ -  static inline __attribute__((const))  bool is_power_of_2(unsigned long n)  {  	return (n != 0 && ((n & (n - 1)) == 0));  } -/* - * round up to nearest power of two +/** + * __roundup_pow_of_two() - round up to nearest power of two + * @n: value to round up   */  static inline __attribute__((const))  unsigned long __roundup_pow_of_two(unsigned long n) @@ -57,8 +61,9 @@ unsigned long __roundup_pow_of_two(unsigned long n)  	return 1UL << fls_long(n - 1);  } -/* - * round down to nearest power of two +/** + * __rounddown_pow_of_two() - round down to nearest power of two + * @n: value to round down   */  static inline __attribute__((const))  unsigned long __rounddown_pow_of_two(unsigned long n) @@ -67,12 +72,12 @@ unsigned long __rounddown_pow_of_two(unsigned long n)  }  /** - * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value - * @n - parameter + * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value + * @n: parameter   *   * constant-capable log of base 2 calculation   * - this can be used to initialise global variables from constant data, hence - *   the massive ternary operator construction + * the massive ternary operator construction   *   * selects the appropriately-sized optimised version depending on sizeof(n)   */ @@ -150,7 +155,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)  /**   * roundup_pow_of_two - round the given value up to nearest power of two - * @n - parameter + * @n: parameter   *   * round the given value up to the nearest power of two   * - the result is undefined when n == 0 @@ -167,7 +172,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)  /**   * rounddown_pow_of_two - round the given value down to nearest power of two - * @n - parameter + * @n: parameter   *   * round the given value down to the nearest power of two   * - the result is undefined when n == 0 @@ -180,6 +185,12 @@ unsigned long __rounddown_pow_of_two(unsigned long n)  	__rounddown_pow_of_two(n)		\   ) +static inline __attribute_const__ +int __order_base_2(unsigned long n) +{ +	return n > 1 ? ilog2(n - 1) + 1 : 0; +} +  /**   * order_base_2 - calculate the (rounded up) base 2 order of the argument   * @n: parameter @@ -193,13 +204,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n)   *  ob2(5) = 3   *  ... and so on.   */ - -static inline __attribute_const__ -int __order_base_2(unsigned long n) -{ -	return n > 1 ? ilog2(n - 1) + 1 : 0; -} -  #define order_base_2(n)				\  (						\  	__builtin_constant_p(n) ? (		\ diff --git a/include/linux/lp.h b/include/linux/lp.h index 0dd276af9e4e..be8a07eb2083 100644 --- a/include/linux/lp.h +++ b/include/linux/lp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * usr/include/linux/lp.h c.1991-1992 James Wiegand   * many modifications copyright (C) 1992 Michael K. Johnson diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h index d1c2901f1542..915330abf6e5 100644 --- a/include/linux/lsm_audit.h +++ b/include/linux/lsm_audit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common LSM logging functions   * Heavily borrowed from selinux/avc.h diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index c9258124e417..7161d8e7ee79 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -1351,6 +1351,40 @@   *	@inode we wish to get the security context of.   *	@ctx is a pointer in which to place the allocated security context.   *	@ctxlen points to the place to put the length of @ctx. + * + * Security hooks for using the eBPF maps and programs functionalities through + * eBPF syscalls. + * + * @bpf: + *	Do a initial check for all bpf syscalls after the attribute is copied + *	into the kernel. The actual security module can implement their own + *	rules to check the specific cmd they need. + * + * @bpf_map: + *	Do a check when the kernel generate and return a file descriptor for + *	eBPF maps. + * + *	@map: bpf map that we want to access + *	@mask: the access flags + * + * @bpf_prog: + *	Do a check when the kernel generate and return a file descriptor for + *	eBPF programs. + * + *	@prog: bpf prog that userspace want to use. + * + * @bpf_map_alloc_security: + *	Initialize the security field inside bpf map. + * + * @bpf_map_free_security: + *	Clean up the security information stored inside bpf map. + * + * @bpf_prog_alloc_security: + *	Initialize the security field inside bpf program. + * + * @bpf_prog_free_security: + *	Clean up the security information stored inside bpf prog. + *   */  union security_list_options {  	int (*binder_set_context_mgr)(struct task_struct *mgr); @@ -1682,6 +1716,17 @@ union security_list_options {  				struct audit_context *actx);  	void (*audit_rule_free)(void *lsmrule);  #endif /* CONFIG_AUDIT */ + +#ifdef CONFIG_BPF_SYSCALL +	int (*bpf)(int cmd, union bpf_attr *attr, +				 unsigned int size); +	int (*bpf_map)(struct bpf_map *map, fmode_t fmode); +	int (*bpf_prog)(struct bpf_prog *prog); +	int (*bpf_map_alloc_security)(struct bpf_map *map); +	void (*bpf_map_free_security)(struct bpf_map *map); +	int (*bpf_prog_alloc_security)(struct bpf_prog_aux *aux); +	void (*bpf_prog_free_security)(struct bpf_prog_aux *aux); +#endif /* CONFIG_BPF_SYSCALL */  };  struct security_hook_heads { @@ -1901,6 +1946,15 @@ struct security_hook_heads {  	struct list_head audit_rule_match;  	struct list_head audit_rule_free;  #endif /* CONFIG_AUDIT */ +#ifdef CONFIG_BPF_SYSCALL +	struct list_head bpf; +	struct list_head bpf_map; +	struct list_head bpf_prog; +	struct list_head bpf_map_alloc_security; +	struct list_head bpf_map_free_security; +	struct list_head bpf_prog_alloc_security; +	struct list_head bpf_prog_free_security; +#endif /* CONFIG_BPF_SYSCALL */  } __randomize_layout;  /* diff --git a/include/linux/lzo.h b/include/linux/lzo.h index a0848d9377e5..2ae27cb89927 100644 --- a/include/linux/lzo.h +++ b/include/linux/lzo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LZO_H__  #define __LZO_H__  /* diff --git a/include/linux/mISDNdsp.h b/include/linux/mISDNdsp.h index 41d1eeb9b3bd..00758f45fddc 100644 --- a/include/linux/mISDNdsp.h +++ b/include/linux/mISDNdsp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __mISDNdsp_H__  #define __mISDNdsp_H__ diff --git a/include/linux/maple.h b/include/linux/maple.h index c37288b23e0c..9b140272ee16 100644 --- a/include/linux/maple.h +++ b/include/linux/maple.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MAPLE_H  #define __LINUX_MAPLE_H diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h index 4055cf8cc978..4f5f8c21e283 100644 --- a/include/linux/marvell_phy.h +++ b/include/linux/marvell_phy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _MARVELL_PHY_H  #define _MARVELL_PHY_H diff --git a/include/linux/math64.h b/include/linux/math64.h index 80690c96c734..837f2f2d1d34 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MATH64_H  #define _LINUX_MATH64_H @@ -11,6 +12,11 @@  /**   * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 32bit divisor + * @remainder: pointer to unsigned 32bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor   *   * This is commonly provided by 32bit archs to provide an optimized 64bit   * divide. @@ -23,6 +29,11 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)  /**   * div_s64_rem - signed 64bit divide with 32bit divisor with remainder + * @dividend: signed 64bit dividend + * @divisor: signed 32bit divisor + * @remainder: pointer to signed 32bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor   */  static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)  { @@ -32,6 +43,11 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)  /**   * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 64bit divisor + * @remainder: pointer to unsigned 64bit remainder + * + * Return: sets ``*remainder``, then returns dividend / divisor   */  static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)  { @@ -41,6 +57,10 @@ static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)  /**   * div64_u64 - unsigned 64bit divide with 64bit divisor + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 64bit divisor + * + * Return: dividend / divisor   */  static inline u64 div64_u64(u64 dividend, u64 divisor)  { @@ -49,6 +69,10 @@ static inline u64 div64_u64(u64 dividend, u64 divisor)  /**   * div64_s64 - signed 64bit divide with 64bit divisor + * @dividend: signed 64bit dividend + * @divisor: signed 64bit divisor + * + * Return: dividend / divisor   */  static inline s64 div64_s64(s64 dividend, s64 divisor)  { @@ -88,6 +112,8 @@ extern s64 div64_s64(s64 dividend, s64 divisor);  /**   * div_u64 - unsigned 64bit divide with 32bit divisor + * @dividend: unsigned 64bit dividend + * @divisor: unsigned 32bit divisor   *   * This is the most common 64bit divide and should be used if possible,   * as many 32bit archs can optimize this variant better than a full 64bit @@ -103,6 +129,8 @@ static inline u64 div_u64(u64 dividend, u32 divisor)  /**   * div_s64 - signed 64bit divide with 32bit divisor + * @dividend: signed 64bit dividend + * @divisor: signed 32bit divisor   */  #ifndef div_s64  static inline s64 div_s64(s64 dividend, s32 divisor) diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h index e1bc73414983..20f1e3ff6013 100644 --- a/include/linux/mbcache.h +++ b/include/linux/mbcache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MBCACHE_H  #define _LINUX_MBCACHE_H diff --git a/include/linux/mbus.h b/include/linux/mbus.h index 0d3f14fd2621..4773145246ed 100644 --- a/include/linux/mbus.h +++ b/include/linux/mbus.h @@ -31,8 +31,8 @@ struct mbus_dram_target_info  	struct mbus_dram_window {  		u8	cs_index;  		u8	mbus_attr; -		u32	base; -		u32	size; +		u64	base; +		u64	size;  	} cs[4];  }; diff --git a/include/linux/mc6821.h b/include/linux/mc6821.h index 28e301e295da..8dffab19b4ac 100644 --- a/include/linux/mc6821.h +++ b/include/linux/mc6821.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _MC6821_H_  #define _MC6821_H_ diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h index 76f52bbbb2f4..a8ac9cfa014c 100644 --- a/include/linux/mdio-bitbang.h +++ b/include/linux/mdio-bitbang.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MDIO_BITBANG_H  #define __LINUX_MDIO_BITBANG_H diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h index a0d274fe08f1..7fde40e17c8b 100644 --- a/include/linux/mei_cl_bus.h +++ b/include/linux/mei_cl_bus.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MEI_CL_BUS_H  #define _LINUX_MEI_CL_BUS_H diff --git a/include/linux/mem_encrypt.h b/include/linux/mem_encrypt.h index 265a9cd21cb4..b310a9c18113 100644 --- a/include/linux/mem_encrypt.h +++ b/include/linux/mem_encrypt.h @@ -23,11 +23,14 @@  #define sme_me_mask	0ULL +static inline bool sme_active(void) { return false; } +static inline bool sev_active(void) { return false; } +  #endif	/* CONFIG_ARCH_HAS_MEM_ENCRYPT */ -static inline bool sme_active(void) +static inline bool mem_encrypt_active(void)  { -	return !!sme_me_mask; +	return sme_me_mask;  }  static inline u64 sme_get_me_mask(void) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index bae11c7e7bf3..7ed0f7782d16 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -237,6 +237,22 @@ unsigned long memblock_next_valid_pfn(unsigned long pfn, unsigned long max_pfn);  	for_each_mem_range_rev(i, &memblock.memory, &memblock.reserved,	\  			       nid, flags, p_start, p_end, p_nid) +/** + * for_each_resv_unavail_range - iterate through reserved and unavailable memory + * @i: u64 used as loop variable + * @flags: pick from blocks based on memory attributes + * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL + * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL + * + * Walks over unavailable but reserved (reserved && !memory) areas of memblock. + * Available as soon as memblock is initialized. + * Note: because this memory does not belong to any physical node, flags and + * nid arguments do not make sense and thus not exported as arguments. + */ +#define for_each_resv_unavail_range(i, p_start, p_end)			\ +	for_each_mem_range(i, &memblock.reserved, &memblock.memory,	\ +			   NUMA_NO_NODE, MEMBLOCK_NONE, p_start, p_end, NULL) +  static inline void memblock_set_region_flags(struct memblock_region *r,  					     unsigned long flags)  { @@ -389,10 +405,10 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo  	     region < (memblock.memblock_type.regions + memblock.memblock_type.cnt);	\  	     region++) -#define for_each_memblock_type(memblock_type, rgn)			\ -	for (idx = 0, rgn = &memblock_type->regions[0];			\ -	     idx < memblock_type->cnt;					\ -	     idx++, rgn = &memblock_type->regions[idx]) +#define for_each_memblock_type(i, memblock_type, rgn)			\ +	for (i = 0, rgn = &memblock_type->regions[0];			\ +	     i < memblock_type->cnt;					\ +	     i++, rgn = &memblock_type->regions[i])  #ifdef CONFIG_MEMTEST  extern void early_memtest(phys_addr_t start, phys_addr_t end); diff --git a/include/linux/memory.h b/include/linux/memory.h index b723a686fc10..f71e732c77b2 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/memory.h - generic memory definition   * diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 0995e1a2b458..58e110aee7ab 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MEMORY_HOTPLUG_H  #define __LINUX_MEMORY_HOTPLUG_H diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 3a58b4be1b0c..5228c62af416 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * NUMA memory policies for Linux.   * Copyright 2003,2004 Andi Kleen SuSE Labs diff --git a/include/linux/mempool.h b/include/linux/mempool.h index b1086c936507..b51f5c430c26 100644 --- a/include/linux/mempool.h +++ b/include/linux/mempool.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * memory buffer pool support   */ diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 79f8ba7c3894..10d23c367048 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MEMREMAP_H_  #define _LINUX_MEMREMAP_H_  #include <linux/mm.h> diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index bfeecf179895..f72dc53848d7 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -174,6 +174,9 @@ struct arizona_pdata {  	/** Mode for outputs */  	int out_mono[ARIZONA_MAX_OUTPUT]; +	/** Limit output volumes */ +	unsigned int out_vol_limit[2 * ARIZONA_MAX_OUTPUT]; +  	/** PDM speaker mute setting */  	unsigned int spk_mute[ARIZONA_MAX_PDM_SPK]; diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index e9c908c4fba8..78dc85365c4f 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h @@ -131,6 +131,9 @@ enum axp20x_variants {  #define AXP803_DCDC6_V_OUT		0x25  #define AXP803_DCDC_FREQ_CTRL		0x3b +/* Other DCDC regulator control registers are the same as AXP803 */ +#define AXP813_DCDC7_V_OUT		0x26 +  /* Interrupt */  #define AXP152_IRQ1_EN			0x40  #define AXP152_IRQ2_EN			0x41 diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h index 0aa3a1a49ee3..d1c57b8dbba4 100644 --- a/include/linux/mfd/da903x.h +++ b/include/linux/mfd/da903x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PMIC_DA903X_H  #define __LINUX_PMIC_DA903X_H diff --git a/include/linux/mfd/dln2.h b/include/linux/mfd/dln2.h index 004b24576da8..4cade9aa8edb 100644 --- a/include/linux/mfd/dln2.h +++ b/include/linux/mfd/dln2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_USB_DLN2_H  #define __LINUX_USB_DLN2_H diff --git a/include/linux/mfd/ds1wm.h b/include/linux/mfd/ds1wm.h index 2227c6a75d84..43dfca1c9702 100644 --- a/include/linux/mfd/ds1wm.h +++ b/include/linux/mfd/ds1wm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* MFD cell driver data for the DS1WM driver   *   * to be defined in the MFD device that is diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h index 32a1b5cfeba1..ffde195e12b7 100644 --- a/include/linux/mfd/ezx-pcap.h +++ b/include/linux/mfd/ezx-pcap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright 2009 Daniel Ribeiro <drwyrm@gmail.com>   * diff --git a/include/linux/mfd/imx25-tsadc.h b/include/linux/mfd/imx25-tsadc.h index 7fe4b8c3baac..21f8adfefd1d 100644 --- a/include/linux/mfd/imx25-tsadc.h +++ b/include/linux/mfd/imx25-tsadc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_INCLUDE_MFD_IMX25_TSADC_H_  #define _LINUX_INCLUDE_MFD_IMX25_TSADC_H_ diff --git a/include/linux/mfd/ipaq-micro.h b/include/linux/mfd/ipaq-micro.h index 5c4d29f6674f..ee48a4321c57 100644 --- a/include/linux/mfd/ipaq-micro.h +++ b/include/linux/mfd/ipaq-micro.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Header file for the compaq Micro MFD   */ diff --git a/include/linux/mfd/max77843-private.h b/include/linux/mfd/max77843-private.h index c19303b0ccfd..b8908bf8d315 100644 --- a/include/linux/mfd/max77843-private.h +++ b/include/linux/mfd/max77843-private.h @@ -245,10 +245,13 @@ enum max77843_irq_muic {  #define MAX77843_CHG_OVER_CURRENT_BAT		(0x06 << 4)  /* MAX77843 CHG_CNFG_00 register */ +#define MAX77843_CHG_MODE_MASK			0x0f  #define MAX77843_CHG_DISABLE			0x00  #define MAX77843_CHG_ENABLE			0x05  #define MAX77843_CHG_MASK			0x01 +#define MAX77843_CHG_OTG_MASK			0x02  #define MAX77843_CHG_BUCK_MASK			0x04 +#define MAX77843_CHG_BOOST_MASK			0x08  /* MAX77843 CHG_CNFG_01 register */  #define MAX77843_CHG_RESTART_THRESHOLD_100	0x00 @@ -347,6 +350,7 @@ enum max77843_irq_muic {  /* MAX77843 CONTROL register */  #define MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT	0  #define MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT	3 +#define MAX77843_MUIC_CONTROL1_NOBCCOMP_SHIFT	6  #define MAX77843_MUIC_CONTROL1_IDBEN_SHIFT	7  #define MAX77843_MUIC_CONTROL2_LOWPWR_SHIFT	0  #define MAX77843_MUIC_CONTROL2_ADCEN_SHIFT	1 @@ -363,6 +367,7 @@ enum max77843_irq_muic {  #define MAX77843_MUIC_CONTROL1_COMP1SW_MASK	(0x7 << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT)  #define MAX77843_MUIC_CONTROL1_COMP2SW_MASK	(0x7 << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT)  #define MAX77843_MUIC_CONTROL1_IDBEN_MASK	BIT(MAX77843_MUIC_CONTROL1_IDBEN_SHIFT) +#define MAX77843_MUIC_CONTROL1_NOBCCOMP_MASK	BIT(MAX77843_MUIC_CONTROL1_NOBCCOMP_SHIFT)  #define MAX77843_MUIC_CONTROL2_LOWPWR_MASK	BIT(MAX77843_MUIC_CONTROL2_LOWPWR_SHIFT)  #define MAX77843_MUIC_CONTROL2_ADCEN_MASK	BIT(MAX77843_MUIC_CONTROL2_ADCEN_SHIFT)  #define MAX77843_MUIC_CONTROL2_CPEN_MASK	BIT(MAX77843_MUIC_CONTROL2_CPEN_SHIFT) diff --git a/include/linux/mfd/menelaus.h b/include/linux/mfd/menelaus.h index 9e85ac06da89..ce489aba88ec 100644 --- a/include/linux/mfd/menelaus.h +++ b/include/linux/mfd/menelaus.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Functions to access Menelaus power management chip   */ diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 6dec43826303..3c8568aa82a5 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h @@ -20,7 +20,7 @@  #include <linux/leds.h>  #include <linux/regmap.h>  #include <linux/regulator/driver.h> -#include <linux/extcon.h> +#include <linux/extcon-provider.h>  #include <linux/of_gpio.h>  #include <linux/usb/phy_companion.h> diff --git a/include/linux/mfd/pcf50633/pmic.h b/include/linux/mfd/pcf50633/pmic.h index 2d3dbe53b235..eac0c3d8e984 100644 --- a/include/linux/mfd/pcf50633/pmic.h +++ b/include/linux/mfd/pcf50633/pmic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MFD_PCF50633_PMIC_H  #define __LINUX_MFD_PCF50633_PMIC_H diff --git a/include/linux/mfd/qcom_rpm.h b/include/linux/mfd/qcom_rpm.h index 742ebf1b76ca..4b6b644f1108 100644 --- a/include/linux/mfd/qcom_rpm.h +++ b/include/linux/mfd/qcom_rpm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __QCOM_RPM_H__  #define __QCOM_RPM_H__ diff --git a/include/linux/mfd/rdc321x.h b/include/linux/mfd/rdc321x.h index 442743a8f915..697933b2227b 100644 --- a/include/linux/mfd/rdc321x.h +++ b/include/linux/mfd/rdc321x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __RDC321X_MFD_H  #define __RDC321X_MFD_H diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h index 116816fb9110..a2a1318a3d0c 100644 --- a/include/linux/mfd/rtsx_pci.h +++ b/include/linux/mfd/rtsx_pci.h @@ -334,6 +334,7 @@  #define DCM_DRP_RD_DATA_H		0xFC29  #define SD_VPCLK0_CTL			0xFC2A  #define SD_VPCLK1_CTL			0xFC2B +#define   PHASE_SELECT_MASK		0x1F  #define SD_DCMPS0_CTL			0xFC2C  #define SD_DCMPS1_CTL			0xFC2D  #define SD_VPTX_CTL			SD_VPCLK0_CTL @@ -573,6 +574,12 @@  #define MSGTXDATA3			0xFE47  #define MSGTXCTL			0xFE48  #define LTR_CTL				0xFE4A +#define LTR_TX_EN_MASK		BIT(7) +#define LTR_TX_EN_1			BIT(7) +#define LTR_TX_EN_0			0 +#define LTR_LATENCY_MODE_MASK		BIT(6) +#define LTR_LATENCY_MODE_HW		0 +#define LTR_LATENCY_MODE_SW		BIT(6)  #define OBFF_CFG			0xFE4C  #define CDRESUMECTL			0xFE52 @@ -616,11 +623,15 @@  #define L1SUB_CONFIG2			0xFE8E  #define   L1SUB_AUTO_CFG		0x02  #define L1SUB_CONFIG3			0xFE8F +#define   L1OFF_MBIAS2_EN_5250		BIT(7)  #define DUMMY_REG_RESET_0		0xFE90  #define AUTOLOAD_CFG_BASE		0xFF00  #define PETXCFG				0xFF03 +#define FORCE_CLKREQ_DELINK_MASK	BIT(7) +#define FORCE_CLKREQ_LOW	0x80 +#define FORCE_CLKREQ_HIGH	0x00  #define PM_CTRL1			0xFF44  #define   CD_RESUME_EN_MASK		0xF0 @@ -844,6 +855,9 @@  #define   PHY_DIG1E_RX_EN_KEEP		0x0001  #define PHY_DUM_REG			0x1F +#define PCR_ASPM_SETTING_REG1		0x160 +#define PCR_ASPM_SETTING_REG2		0x168 +  #define PCR_SETTING_REG1		0x724  #define PCR_SETTING_REG2		0x814  #define PCR_SETTING_REG3		0x747 @@ -876,14 +890,79 @@ struct pcr_ops {  	int		(*conv_clk_and_div_n)(int clk, int dir);  	void		(*fetch_vendor_settings)(struct rtsx_pcr *pcr);  	void		(*force_power_down)(struct rtsx_pcr *pcr, u8 pm_state); + +	void (*set_aspm)(struct rtsx_pcr *pcr, bool enable); +	int (*set_ltr_latency)(struct rtsx_pcr *pcr, u32 latency); +	int (*set_l1off_sub)(struct rtsx_pcr *pcr, u8 val); +	void (*set_l1off_cfg_sub_d0)(struct rtsx_pcr *pcr, int active); +	void (*full_on)(struct rtsx_pcr *pcr); +	void (*power_saving)(struct rtsx_pcr *pcr);  };  enum PDEV_STAT  {PDEV_STAT_IDLE, PDEV_STAT_RUN}; +#define ASPM_L1_1_EN_MASK		BIT(3) +#define ASPM_L1_2_EN_MASK		BIT(2) +#define PM_L1_1_EN_MASK		BIT(1) +#define PM_L1_2_EN_MASK		BIT(0) + +#define ASPM_L1_1_EN			BIT(0) +#define ASPM_L1_2_EN			BIT(1) +#define PM_L1_1_EN				BIT(2) +#define PM_L1_2_EN				BIT(3) +#define LTR_L1SS_PWR_GATE_EN	BIT(4) +#define L1_SNOOZE_TEST_EN		BIT(5) +#define LTR_L1SS_PWR_GATE_CHECK_CARD_EN	BIT(6) + +enum dev_aspm_mode { +	DEV_ASPM_DISABLE = 0, +	DEV_ASPM_DYNAMIC, +	DEV_ASPM_BACKDOOR, +	DEV_ASPM_STATIC, +}; + +/* + * struct rtsx_cr_option  - card reader option + * @dev_flags: device flags + * @force_clkreq_0: force clock request + * @ltr_en: enable ltr mode flag + * @ltr_enabled: ltr mode in configure space flag + * @ltr_active: ltr mode status + * @ltr_active_latency: ltr mode active latency + * @ltr_idle_latency: ltr mode idle latency + * @ltr_l1off_latency: ltr mode l1off latency + * @dev_aspm_mode: device aspm mode + * @l1_snooze_delay: l1 snooze delay + * @ltr_l1off_sspwrgate: ltr l1off sspwrgate + * @ltr_l1off_snooze_sspwrgate: ltr l1off snooze sspwrgate + */ +struct rtsx_cr_option { +	u32 dev_flags; +	bool force_clkreq_0; +	bool ltr_en; +	bool ltr_enabled; +	bool ltr_active; +	u32 ltr_active_latency; +	u32 ltr_idle_latency; +	u32 ltr_l1off_latency; +	enum dev_aspm_mode dev_aspm_mode; +	u32 l1_snooze_delay; +	u8 ltr_l1off_sspwrgate; +	u8 ltr_l1off_snooze_sspwrgate; +}; + +#define rtsx_set_dev_flag(cr, flag) \ +	((cr)->option.dev_flags |= (flag)) +#define rtsx_clear_dev_flag(cr, flag) \ +	((cr)->option.dev_flags &= ~(flag)) +#define rtsx_check_dev_flag(cr, flag) \ +	((cr)->option.dev_flags & (flag)) +  struct rtsx_pcr {  	struct pci_dev			*pci;  	unsigned int			id;  	int				pcie_cap; +	struct rtsx_cr_option	option;  	/* pci resources */  	unsigned long			addr; @@ -940,6 +1019,7 @@ struct rtsx_pcr {  	u8				card_drive_sel;  #define ASPM_L1_EN			0x02  	u8				aspm_en; +	bool				aspm_enabled;  #define PCR_MS_PMOS			(1 << 0)  #define PCR_REVERSE_SOCKET		(1 << 1) @@ -964,6 +1044,11 @@ struct rtsx_pcr {  	u8				dma_error_count;  }; +#define PID_524A	0x524A +#define PID_5249		0x5249 +#define PID_5250		0x5250 +#define PID_525A	0x525A +  #define CHK_PCI_PID(pcr, pid)		((pcr)->pci->device == (pid))  #define PCI_VID(pcr)			((pcr)->pci->vendor)  #define PCI_PID(pcr)			((pcr)->pci->device) diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 15646740e2a8..e1cfe9194129 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef MFD_TMIO_H  #define MFD_TMIO_H diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h index eac285756b37..b5dd108421c8 100644 --- a/include/linux/mfd/tps65217.h +++ b/include/linux/mfd/tps65217.h @@ -263,7 +263,6 @@ struct tps65217_board {  struct tps65217 {  	struct device *dev;  	struct tps65217_board *pdata; -	unsigned long id;  	struct regulator_desc desc[TPS65217_NUM_REGULATOR];  	struct regmap *regmap;  	u8 *strobes; @@ -278,11 +277,6 @@ static inline struct tps65217 *dev_to_tps65217(struct device *dev)  	return dev_get_drvdata(dev);  } -static inline unsigned long tps65217_chip_id(struct tps65217 *tps65217) -{ -	return tps65217->id; -} -  int tps65217_reg_read(struct tps65217 *tps, unsigned int reg,  					unsigned int *val);  int tps65217_reg_write(struct tps65217 *tps, unsigned int reg, diff --git a/include/linux/mfd/tps65218.h b/include/linux/mfd/tps65218.h index bccd2d68b1e3..f069c518c0ed 100644 --- a/include/linux/mfd/tps65218.h +++ b/include/linux/mfd/tps65218.h @@ -246,24 +246,6 @@ enum tps65218_irqs {  };  /** - * struct tps_info - packages regulator constraints - * @id:			Id of the regulator - * @name:		Voltage regulator name - * @min_uV:		minimum micro volts - * @max_uV:		minimum micro volts - * @strobe:		sequencing strobe value for the regulator - * - * This data is used to check the regualtor voltage limits while setting. - */ -struct tps_info { -	int id; -	const char *name; -	int min_uV; -	int max_uV; -	int strobe; -}; - -/**   * struct tps65218 - tps65218 sub-driver chip access routines   *   * Device data may be used to access the TPS65218 chip @@ -280,7 +262,6 @@ struct tps65218 {  	u32 irq_mask;  	struct regmap_irq_chip_data *irq_data;  	struct regulator_desc desc[TPS65218_NUM_REGULATOR]; -	struct tps_info *info[TPS65218_NUM_REGULATOR];  	struct regmap *regmap;  	u8 *strobes;  }; diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h index 96187ed9f9bb..2fe68e481230 100644 --- a/include/linux/mfd/tps6586x.h +++ b/include/linux/mfd/tps6586x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MFD_TPS6586X_H  #define __LINUX_MFD_TPS6586X_H diff --git a/include/linux/mfd/wm97xx.h b/include/linux/mfd/wm97xx.h new file mode 100644 index 000000000000..45fb54f19d09 --- /dev/null +++ b/include/linux/mfd/wm97xx.h @@ -0,0 +1,25 @@ +/* + * wm97xx client interface + * + * Copyright (C) 2017 Robert Jarzmik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __LINUX_MFD_WM97XX_H +#define __LINUX_MFD_WM97XX_H + +struct regmap; +struct wm97xx_batt_pdata; +struct snd_ac97; + +struct wm97xx_platform_data { +	struct snd_ac97 *ac97; +	struct regmap *regmap; +	struct wm97xx_batt_pdata *batt_pdata; +}; + +#endif diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 643c7ae7d7b4..895ec0c4942e 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MIGRATE_H  #define _LINUX_MIGRATE_H diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h index bdf66af9b937..883c99249033 100644 --- a/include/linux/migrate_mode.h +++ b/include/linux/migrate_mode.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef MIGRATE_MODE_H_INCLUDED  #define MIGRATE_MODE_H_INCLUDED  /* diff --git a/include/linux/mii.h b/include/linux/mii.h index e870bfa6abfe..55000ee5c6ad 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/mii.h: definitions for MII-compatible transceivers   * Originally drivers/net/sunhme.h. diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 58751eae5f77..3247a3dc7934 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MISCDEVICE_H  #define _LINUX_MISCDEVICE_H  #include <linux/major.h> @@ -35,6 +36,7 @@  #define HWRNG_MINOR		183  #define MICROCODE_MINOR		184  #define IRNET_MINOR		187 +#define D7S_MINOR		193  #define VFIO_MINOR		196  #define TUN_MINOR		200  #define CUSE_MINOR		203 diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h index 09cebe528488..508e8cc5ee86 100644 --- a/include/linux/mlx4/cq.h +++ b/include/linux/mlx4/cq.h @@ -136,6 +136,9 @@ enum {  	MLX4_CQE_BAD_FCS                 = 1 << 4,  }; +#define MLX4_MAX_CQ_PERIOD (BIT(16) - 1) +#define MLX4_MAX_CQ_COUNT (BIT(16) - 1) +  static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd,  			       void __iomem *uar_page,  			       spinlock_t *doorbell_lock) diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index b0a57e043fa3..a9b5fed8f7c6 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h @@ -40,7 +40,7 @@  #include <linux/cpu_rmap.h>  #include <linux/crash_dump.h> -#include <linux/atomic.h> +#include <linux/refcount.h>  #include <linux/timecounter.h> @@ -751,7 +751,7 @@ struct mlx4_cq {  	int			cqn;  	unsigned		vector; -	atomic_t		refcount; +	refcount_t		refcount;  	struct completion	free;  	struct {  		struct list_head list; @@ -768,7 +768,7 @@ struct mlx4_qp {  	int			qpn; -	atomic_t		refcount; +	refcount_t		refcount;  	struct completion	free;  	u8			usage;  }; @@ -781,7 +781,7 @@ struct mlx4_srq {  	int			max_gs;  	int			wqe_shift; -	atomic_t		refcount; +	refcount_t		refcount;  	struct completion	free;  }; diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h index 95898847c7d4..48c181a2acc9 100644 --- a/include/linux/mlx5/cq.h +++ b/include/linux/mlx5/cq.h @@ -35,7 +35,7 @@  #include <rdma/ib_verbs.h>  #include <linux/mlx5/driver.h> - +#include <linux/refcount.h>  struct mlx5_core_cq {  	u32			cqn; @@ -43,7 +43,7 @@ struct mlx5_core_cq {  	__be32		       *set_ci_db;  	__be32		       *arm_db;  	struct mlx5_uars_page  *uar; -	atomic_t		refcount; +	refcount_t		refcount;  	struct completion	free;  	unsigned		vector;  	unsigned int		irqn; @@ -125,11 +125,16 @@ struct mlx5_cq_modify_params {  enum {  	CQE_SIZE_64 = 0,  	CQE_SIZE_128 = 1, +	CQE_SIZE_128_PAD = 2,  }; -static inline int cqe_sz_to_mlx_sz(u8 size) +#define MLX5_MAX_CQ_PERIOD (BIT(__mlx5_bit_sz(cqc, cq_period)) - 1) +#define MLX5_MAX_CQ_COUNT (BIT(__mlx5_bit_sz(cqc, cq_max_count)) - 1) + +static inline int cqe_sz_to_mlx_sz(u8 size, int padding_128_en)  { -	return size == 64 ? CQE_SIZE_64 : CQE_SIZE_128; +	return padding_128_en ? CQE_SIZE_128_PAD : +				size == 64 ? CQE_SIZE_64 : CQE_SIZE_128;  }  static inline void mlx5_cq_set_ci(struct mlx5_core_cq *cq) diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index e32dbc4934db..409ffb14298a 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h @@ -49,11 +49,15 @@  #define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)  #define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)  #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld)) +#define __mlx5_16_off(typ, fld) (__mlx5_bit_off(typ, fld) / 16)  #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)  #define __mlx5_64_off(typ, fld) (__mlx5_bit_off(typ, fld) / 64) +#define __mlx5_16_bit_off(typ, fld) (16 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0xf))  #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))  #define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))  #define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld)) +#define __mlx5_mask16(typ, fld) ((u16)((1ull << __mlx5_bit_sz(typ, fld)) - 1)) +#define __mlx5_16_mask(typ, fld) (__mlx5_mask16(typ, fld) << __mlx5_16_bit_off(typ, fld))  #define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits)  #define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8) @@ -116,6 +120,19 @@ __mlx5_mask(typ, fld))  	___t; \  }) +#define MLX5_GET16(typ, p, fld) ((be16_to_cpu(*((__be16 *)(p) +\ +__mlx5_16_off(typ, fld))) >> __mlx5_16_bit_off(typ, fld)) & \ +__mlx5_mask16(typ, fld)) + +#define MLX5_SET16(typ, p, fld, v) do { \ +	u16 _v = v; \ +	BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 16);             \ +	*((__be16 *)(p) + __mlx5_16_off(typ, fld)) = \ +	cpu_to_be16((be16_to_cpu(*((__be16 *)(p) + __mlx5_16_off(typ, fld))) & \ +		     (~__mlx5_16_mask(typ, fld))) | (((_v) & __mlx5_mask16(typ, fld)) \ +		     << __mlx5_16_bit_off(typ, fld))); \ +} while (0) +  /* Big endian getters */  #define MLX5_GET64_BE(typ, p, fld) (*((__be64 *)(p) +\  	__mlx5_64_off(typ, fld))) @@ -1000,6 +1017,14 @@ enum mlx5_mcam_feature_groups {  	MLX5_MCAM_FEATURE_ENHANCED_FEATURES         = 0x0,  }; +enum mlx5_qcam_reg_groups { +	MLX5_QCAM_REGS_FIRST_128                    = 0x0, +}; + +enum mlx5_qcam_feature_groups { +	MLX5_QCAM_FEATURE_ENHANCED_FEATURES         = 0x0, +}; +  /* GET Dev Caps macros */  #define MLX5_CAP_GEN(mdev, cap) \  	MLX5_GET(cmd_hca_cap, mdev->caps.hca_cur[MLX5_CAP_GENERAL], cap) @@ -1108,6 +1133,12 @@ enum mlx5_mcam_feature_groups {  #define MLX5_CAP_MCAM_FEATURE(mdev, fld) \  	MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld) +#define MLX5_CAP_QCAM_REG(mdev, fld) \ +	MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_access_reg_cap_mask.reg_cap.fld) + +#define MLX5_CAP_QCAM_FEATURE(mdev, fld) \ +	MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_feature_cap_mask.feature_cap.fld) +  #define MLX5_CAP_FPGA(mdev, cap) \  	MLX5_GET(fpga_cap, (mdev)->caps.fpga, cap) diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 401c8972cc3a..a886b51511ab 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -49,6 +49,8 @@  #include <linux/mlx5/device.h>  #include <linux/mlx5/doorbell.h>  #include <linux/mlx5/srq.h> +#include <linux/timecounter.h> +#include <linux/ptp_clock_kernel.h>  enum {  	MLX5_BOARD_ID_LEN = 64, @@ -105,8 +107,11 @@ enum {  };  enum { +	MLX5_REG_QPTS            = 0x4002,  	MLX5_REG_QETCR		 = 0x4005,  	MLX5_REG_QTCT		 = 0x400a, +	MLX5_REG_QPDPM           = 0x4013, +	MLX5_REG_QCAM            = 0x4019,  	MLX5_REG_DCBX_PARAM      = 0x4020,  	MLX5_REG_DCBX_APP        = 0x4021,  	MLX5_REG_FPGA_CAP	 = 0x4022, @@ -139,6 +144,11 @@ enum {  	MLX5_REG_MCAM		 = 0x907f,  }; +enum mlx5_qpts_trust_state { +	MLX5_QPTS_TRUST_PCP  = 1, +	MLX5_QPTS_TRUST_DSCP = 2, +}; +  enum mlx5_dcbx_oper_mode {  	MLX5E_DCBX_PARAM_VER_OPER_HOST  = 0x0,  	MLX5E_DCBX_PARAM_VER_OPER_AUTO  = 0x3, @@ -760,6 +770,27 @@ struct mlx5_rsvd_gids {  	struct ida ida;  }; +#define MAX_PIN_NUM	8 +struct mlx5_pps { +	u8                         pin_caps[MAX_PIN_NUM]; +	struct work_struct         out_work; +	u64                        start[MAX_PIN_NUM]; +	u8                         enabled; +}; + +struct mlx5_clock { +	rwlock_t                   lock; +	struct cyclecounter        cycles; +	struct timecounter         tc; +	struct hwtstamp_config     hwtstamp_config; +	u32                        nominal_c_mult; +	unsigned long              overflow_period; +	struct delayed_work        overflow_work; +	struct ptp_clock          *ptp; +	struct ptp_clock_info      ptp_info; +	struct mlx5_pps            pps_info; +}; +  struct mlx5_core_dev {  	struct pci_dev	       *pdev;  	/* sync pci state */ @@ -775,6 +806,7 @@ struct mlx5_core_dev {  		u32 pcam[MLX5_ST_SZ_DW(pcam_reg)];  		u32 mcam[MLX5_ST_SZ_DW(mcam_reg)];  		u32 fpga[MLX5_ST_SZ_DW(fpga_cap)]; +		u32 qcam[MLX5_ST_SZ_DW(qcam_reg)];  	} caps;  	phys_addr_t		iseg_base;  	struct mlx5_init_seg __iomem *iseg; @@ -800,6 +832,7 @@ struct mlx5_core_dev {  #ifdef CONFIG_RFS_ACCEL  	struct cpu_rmap         *rmap;  #endif +	struct mlx5_clock        clock;  };  struct mlx5_db { diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 69772347f866..38a7577a9ce7 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -614,7 +614,9 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {  	u8         swp[0x1];  	u8         swp_csum[0x1];  	u8         swp_lso[0x1]; -	u8         reserved_at_23[0x1d]; +	u8         reserved_at_23[0x1b]; +	u8         max_geneve_opt_len[0x1]; +	u8         tunnel_stateless_geneve_rx[0x1];  	u8         reserved_at_40[0x10];  	u8         lro_min_mss_size[0x10]; @@ -744,6 +746,7 @@ enum {  	MLX5_WQ_TYPE_LINKED_LIST  = 0x0,  	MLX5_WQ_TYPE_CYCLIC       = 0x1,  	MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ = 0x2, +	MLX5_WQ_TYPE_CYCLIC_STRIDING_RQ = 0x3,  };  enum { @@ -838,7 +841,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {  	u8         cc_modify_allowed[0x1];  	u8         start_pad[0x1];  	u8         cache_line_128byte[0x1]; -	u8         reserved_at_165[0xb]; +	u8         reserved_at_165[0xa]; +	u8         qcam_reg[0x1];  	u8         gid_table_size[0x10];  	u8         out_of_seq_cnt[0x1]; @@ -1046,7 +1050,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {  	u8	   num_of_uars_per_page[0x20];  	u8         reserved_at_540[0x40]; -	u8         reserved_at_580[0x3f]; +	u8         reserved_at_580[0x3d]; +	u8         cqe_128_always[0x1]; +	u8         cqe_compression_128[0x1];  	u8         cqe_compression[0x1];  	u8         cqe_compression_timeout[0x10]; @@ -7890,6 +7896,43 @@ struct mlx5_ifc_mcam_reg_bits {  	u8         reserved_at_1c0[0x80];  }; +struct mlx5_ifc_qcam_access_reg_cap_mask { +	u8         qcam_access_reg_cap_mask_127_to_20[0x6C]; +	u8         qpdpm[0x1]; +	u8         qcam_access_reg_cap_mask_18_to_4[0x0F]; +	u8         qdpm[0x1]; +	u8         qpts[0x1]; +	u8         qcap[0x1]; +	u8         qcam_access_reg_cap_mask_0[0x1]; +}; + +struct mlx5_ifc_qcam_qos_feature_cap_mask { +	u8         qcam_qos_feature_cap_mask_127_to_1[0x7F]; +	u8         qpts_trust_both[0x1]; +}; + +struct mlx5_ifc_qcam_reg_bits { +	u8         reserved_at_0[0x8]; +	u8         feature_group[0x8]; +	u8         reserved_at_10[0x8]; +	u8         access_reg_group[0x8]; +	u8         reserved_at_20[0x20]; + +	union { +		struct mlx5_ifc_qcam_access_reg_cap_mask reg_cap; +		u8  reserved_at_0[0x80]; +	} qos_access_reg_cap_mask; + +	u8         reserved_at_c0[0x80]; + +	union { +		struct mlx5_ifc_qcam_qos_feature_cap_mask feature_cap; +		u8  reserved_at_0[0x80]; +	} qos_feature_cap_mask; + +	u8         reserved_at_1c0[0x80]; +}; +  struct mlx5_ifc_pcap_reg_bits {  	u8         reserved_at_0[0x8];  	u8         local_port[0x8]; @@ -8540,6 +8583,26 @@ struct mlx5_ifc_qetc_reg_bits {  	struct mlx5_ifc_ets_global_config_reg_bits global_configuration;  }; +struct mlx5_ifc_qpdpm_dscp_reg_bits { +	u8         e[0x1]; +	u8         reserved_at_01[0x0b]; +	u8         prio[0x04]; +}; + +struct mlx5_ifc_qpdpm_reg_bits { +	u8                                     reserved_at_0[0x8]; +	u8                                     local_port[0x8]; +	u8                                     reserved_at_10[0x10]; +	struct mlx5_ifc_qpdpm_dscp_reg_bits    dscp[64]; +}; + +struct mlx5_ifc_qpts_reg_bits { +	u8         reserved_at_0[0x8]; +	u8         local_port[0x8]; +	u8         reserved_at_10[0x2d]; +	u8         trust_state[0x3]; +}; +  struct mlx5_ifc_qtct_reg_bits {  	u8         reserved_at_0[0x8];  	u8         port_number[0x8]; diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h index c57d4b7de3a8..035f0d4dc9fe 100644 --- a/include/linux/mlx5/port.h +++ b/include/linux/mlx5/port.h @@ -157,6 +157,8 @@ int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, u8 *prio_tc);  int mlx5_query_port_prio_tc(struct mlx5_core_dev *mdev,  			    u8 prio, u8 *tc);  int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, u8 *tc_group); +int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev, +			     u8 tc, u8 *tc_group);  int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *tc_bw);  int mlx5_query_port_tc_bw_alloc(struct mlx5_core_dev *mdev,  				u8 tc, u8 *bw_pct); @@ -177,4 +179,9 @@ int mlx5_query_module_eeprom(struct mlx5_core_dev *dev,  int mlx5_query_port_dcbx_param(struct mlx5_core_dev *mdev, u32 *out);  int mlx5_set_port_dcbx_param(struct mlx5_core_dev *mdev, u32 *in); + +int mlx5_set_trust_state(struct mlx5_core_dev *mdev, u8 trust_state); +int mlx5_query_trust_state(struct mlx5_core_dev *mdev, u8 *trust_state); +int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, u8 dscp, u8 prio); +int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio);  #endif /* __MLX5_PORT_H__ */ diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h index 66d19b611fe4..62af7512dabb 100644 --- a/include/linux/mlx5/qp.h +++ b/include/linux/mlx5/qp.h @@ -221,6 +221,7 @@ enum {  };  enum { +	MLX5_ETH_WQE_SVLAN              = 1 << 0,  	MLX5_ETH_WQE_INSERT_VLAN        = 1 << 15,  }; diff --git a/include/linux/mm.h b/include/linux/mm.h index 065d99deb847..ee073146aaa7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MM_H  #define _LINUX_MM_H @@ -95,6 +96,15 @@ extern int mmap_rnd_compat_bits __read_mostly;  #endif  /* + * On some architectures it is expensive to call memset() for small sizes. + * Those architectures should provide their own implementation of "struct page" + * zeroing by defining this macro in <asm/pgtable.h>. + */ +#ifndef mm_zero_struct_page +#define mm_zero_struct_page(pp)  ((void)memset((pp), 0, sizeof(struct page))) +#endif + +/*   * Default maximum number of active map areas, this limits the number of vmas   * per mm struct. Users can overwrite this number by sysctl but there is a   * problem. @@ -189,6 +199,7 @@ extern unsigned int kobjsize(const void *objp);  #define VM_ACCOUNT	0x00100000	/* Is a VM accounted object */  #define VM_NORESERVE	0x00200000	/* should the VM suppress accounting */  #define VM_HUGETLB	0x00400000	/* Huge TLB Page VM */ +#define VM_SYNC		0x00800000	/* Synchronous page faults */  #define VM_ARCH_1	0x01000000	/* Architecture-specific flag */  #define VM_WIPEONFORK	0x02000000	/* Wipe VMA contents in child. */  #define VM_DONTDUMP	0x04000000	/* Do not include in the core dump */ @@ -1181,8 +1192,9 @@ static inline void clear_page_pfmemalloc(struct page *page)  #define VM_FAULT_RETRY	0x0400	/* ->fault blocked, must retry */  #define VM_FAULT_FALLBACK 0x0800	/* huge page fault failed, fall back to small */  #define VM_FAULT_DONE_COW   0x1000	/* ->fault has fully handled COW */ - -#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */ +#define VM_FAULT_NEEDDSYNC  0x2000	/* ->fault did not modify page tables +					 * and needs fsync() to complete (for +					 * synchronous page faults in DAX) */  #define VM_FAULT_ERROR	(VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \  			 VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE | \ @@ -1200,7 +1212,8 @@ static inline void clear_page_pfmemalloc(struct page *page)  	{ VM_FAULT_LOCKED,		"LOCKED" }, \  	{ VM_FAULT_RETRY,		"RETRY" }, \  	{ VM_FAULT_FALLBACK,		"FALLBACK" }, \ -	{ VM_FAULT_DONE_COW,		"DONE_COW" } +	{ VM_FAULT_DONE_COW,		"DONE_COW" }, \ +	{ VM_FAULT_NEEDDSYNC,		"NEEDDSYNC" }  /* Encode hstate index for a hwpoisoned large page */  #define VM_FAULT_SET_HINDEX(x) ((x) << 12) @@ -1430,7 +1443,13 @@ void account_page_cleaned(struct page *page, struct address_space *mapping,  			  struct bdi_writeback *wb);  int set_page_dirty(struct page *page);  int set_page_dirty_lock(struct page *page); -void cancel_dirty_page(struct page *page); +void __cancel_dirty_page(struct page *page); +static inline void cancel_dirty_page(struct page *page) +{ +	/* Avoid atomic ops, locking, etc. when not actually needed. */ +	if (PageDirty(page)) +		__cancel_dirty_page(page); +}  int clear_page_dirty_for_io(struct page *page);  int get_cmdline(struct task_struct *task, char *buffer, int buflen); @@ -1598,26 +1617,32 @@ static inline int __p4d_alloc(struct mm_struct *mm, pgd_t *pgd,  int __p4d_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);  #endif -#ifdef __PAGETABLE_PUD_FOLDED +#if defined(__PAGETABLE_PUD_FOLDED) || !defined(CONFIG_MMU)  static inline int __pud_alloc(struct mm_struct *mm, p4d_t *p4d,  						unsigned long address)  {  	return 0;  } +static inline void mm_inc_nr_puds(struct mm_struct *mm) {} +static inline void mm_dec_nr_puds(struct mm_struct *mm) {} +  #else  int __pud_alloc(struct mm_struct *mm, p4d_t *p4d, unsigned long address); -#endif -#if defined(__PAGETABLE_PMD_FOLDED) || !defined(CONFIG_MMU) -static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud, -						unsigned long address) +static inline void mm_inc_nr_puds(struct mm_struct *mm)  { -	return 0; +	atomic_long_add(PTRS_PER_PUD * sizeof(pud_t), &mm->pgtables_bytes);  } -static inline void mm_nr_pmds_init(struct mm_struct *mm) {} +static inline void mm_dec_nr_puds(struct mm_struct *mm) +{ +	atomic_long_sub(PTRS_PER_PUD * sizeof(pud_t), &mm->pgtables_bytes); +} +#endif -static inline unsigned long mm_nr_pmds(struct mm_struct *mm) +#if defined(__PAGETABLE_PMD_FOLDED) || !defined(CONFIG_MMU) +static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud, +						unsigned long address)  {  	return 0;  } @@ -1628,25 +1653,47 @@ static inline void mm_dec_nr_pmds(struct mm_struct *mm) {}  #else  int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address); -static inline void mm_nr_pmds_init(struct mm_struct *mm) +static inline void mm_inc_nr_pmds(struct mm_struct *mm) +{ +	atomic_long_add(PTRS_PER_PMD * sizeof(pmd_t), &mm->pgtables_bytes); +} + +static inline void mm_dec_nr_pmds(struct mm_struct *mm)  { -	atomic_long_set(&mm->nr_pmds, 0); +	atomic_long_sub(PTRS_PER_PMD * sizeof(pmd_t), &mm->pgtables_bytes);  } +#endif -static inline unsigned long mm_nr_pmds(struct mm_struct *mm) +#ifdef CONFIG_MMU +static inline void mm_pgtables_bytes_init(struct mm_struct *mm)  { -	return atomic_long_read(&mm->nr_pmds); +	atomic_long_set(&mm->pgtables_bytes, 0);  } -static inline void mm_inc_nr_pmds(struct mm_struct *mm) +static inline unsigned long mm_pgtables_bytes(const struct mm_struct *mm)  { -	atomic_long_inc(&mm->nr_pmds); +	return atomic_long_read(&mm->pgtables_bytes);  } -static inline void mm_dec_nr_pmds(struct mm_struct *mm) +static inline void mm_inc_nr_ptes(struct mm_struct *mm) +{ +	atomic_long_add(PTRS_PER_PTE * sizeof(pte_t), &mm->pgtables_bytes); +} + +static inline void mm_dec_nr_ptes(struct mm_struct *mm) +{ +	atomic_long_sub(PTRS_PER_PTE * sizeof(pte_t), &mm->pgtables_bytes); +} +#else + +static inline void mm_pgtables_bytes_init(struct mm_struct *mm) {} +static inline unsigned long mm_pgtables_bytes(const struct mm_struct *mm)  { -	atomic_long_dec(&mm->nr_pmds); +	return 0;  } + +static inline void mm_inc_nr_ptes(struct mm_struct *mm) {} +static inline void mm_dec_nr_ptes(struct mm_struct *mm) {}  #endif  int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address); @@ -2001,6 +2048,12 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn,  					struct mminit_pfnnid_cache *state);  #endif +#ifdef CONFIG_HAVE_MEMBLOCK +void zero_resv_unavail(void); +#else +static inline void zero_resv_unavail(void) {} +#endif +  extern void set_dma_reserve(unsigned long new_dma_reserve);  extern void memmap_init_zone(unsigned long, int, unsigned long,  				unsigned long, enum memmap_context); @@ -2495,7 +2548,7 @@ void vmemmap_populate_print_last(void);  void vmemmap_free(unsigned long start, unsigned long end);  #endif  void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, -				  unsigned long size); +				  unsigned long nr_pages);  enum mf_flags {  	MF_COUNT_INCREASED = 1 << 0, diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 25438b2b6f22..c30b32e3c862 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_MM_INLINE_H  #define LINUX_MM_INLINE_H diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 46f4ecf5479a..cfd0ac4e5e0e 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MM_TYPES_H  #define _LINUX_MM_TYPES_H @@ -47,8 +48,10 @@ struct page {  						 * inode address_space, or NULL.  						 * If page mapped as anonymous  						 * memory, low bit is set, and -						 * it points to anon_vma object: -						 * see PAGE_MAPPING_ANON below. +						 * it points to anon_vma object +						 * or KSM private structure. See +						 * PAGE_MAPPING_ANON and +						 * PAGE_MAPPING_KSM.  						 */  		void *s_mem;			/* slab first object */  		atomic_t compound_mapcount;	/* first tail page */ @@ -206,14 +209,6 @@ struct page {  					   not kmapped, ie. highmem) */  #endif /* WANT_PAGE_VIRTUAL */ -#ifdef CONFIG_KMEMCHECK -	/* -	 * kmemcheck wants to track the status of each byte in a page; this -	 * is a pointer to such a status block. NULL if not tracked. -	 */ -	void *shadow; -#endif -  #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS  	int _last_cpupid;  #endif @@ -398,9 +393,8 @@ struct mm_struct {  	 */  	atomic_t mm_count; -	atomic_long_t nr_ptes;			/* PTE page table pages */ -#if CONFIG_PGTABLE_LEVELS > 2 -	atomic_long_t nr_pmds;			/* PMD page table pages */ +#ifdef CONFIG_MMU +	atomic_long_t pgtables_bytes;		/* PTE page table pages */  #endif  	int map_count;				/* number of VMAs */ @@ -445,6 +439,9 @@ struct mm_struct {  	unsigned long flags; /* Must use atomic bitops to access the bits */  	struct core_state *core_state; /* coredumping support */ +#ifdef CONFIG_MEMBARRIER +	atomic_t membarrier_state; +#endif  #ifdef CONFIG_AIO  	spinlock_t			ioctx_lock;  	struct kioctx_table __rcu	*ioctx_table; diff --git a/include/linux/mm_types_task.h b/include/linux/mm_types_task.h index fc412fbd80bd..5fe87687664c 100644 --- a/include/linux/mm_types_task.h +++ b/include/linux/mm_types_task.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MM_TYPES_TASK_H  #define _LINUX_MM_TYPES_TASK_H diff --git a/include/linux/mman.h b/include/linux/mman.h index c8367041fafd..6a4d1caaff5c 100644 --- a/include/linux/mman.h +++ b/include/linux/mman.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MMAN_H  #define _LINUX_MMAN_H @@ -7,6 +8,48 @@  #include <linux/atomic.h>  #include <uapi/linux/mman.h> +/* + * Arrange for legacy / undefined architecture specific flags to be + * ignored by mmap handling code. + */ +#ifndef MAP_32BIT +#define MAP_32BIT 0 +#endif +#ifndef MAP_HUGE_2MB +#define MAP_HUGE_2MB 0 +#endif +#ifndef MAP_HUGE_1GB +#define MAP_HUGE_1GB 0 +#endif +#ifndef MAP_UNINITIALIZED +#define MAP_UNINITIALIZED 0 +#endif +#ifndef MAP_SYNC +#define MAP_SYNC 0 +#endif + +/* + * The historical set of flags that all mmap implementations implicitly + * support when a ->mmap_validate() op is not provided in file_operations. + */ +#define LEGACY_MAP_MASK (MAP_SHARED \ +		| MAP_PRIVATE \ +		| MAP_FIXED \ +		| MAP_ANONYMOUS \ +		| MAP_DENYWRITE \ +		| MAP_EXECUTABLE \ +		| MAP_UNINITIALIZED \ +		| MAP_GROWSDOWN \ +		| MAP_LOCKED \ +		| MAP_NORESERVE \ +		| MAP_POPULATE \ +		| MAP_NONBLOCK \ +		| MAP_STACK \ +		| MAP_HUGETLB \ +		| MAP_32BIT \ +		| MAP_HUGE_2MB \ +		| MAP_HUGE_1GB) +  extern int sysctl_overcommit_memory;  extern int sysctl_overcommit_ratio;  extern unsigned long sysctl_overcommit_kbytes; @@ -63,8 +106,9 @@ static inline bool arch_validate_prot(unsigned long prot)   * ("bit1" and "bit2" must be single bits)   */  #define _calc_vm_trans(x, bit1, bit2) \ +  ((!(bit1) || !(bit2)) ? 0 : \    ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \ -   : ((x) & (bit1)) / ((bit1) / (bit2))) +   : ((x) & (bit1)) / ((bit1) / (bit2))))  /*   * Combine the mmap "prot" argument into "vm_flags" used internally. @@ -86,7 +130,8 @@ calc_vm_flag_bits(unsigned long flags)  {  	return _calc_vm_trans(flags, MAP_GROWSDOWN,  VM_GROWSDOWN ) |  	       _calc_vm_trans(flags, MAP_DENYWRITE,  VM_DENYWRITE ) | -	       _calc_vm_trans(flags, MAP_LOCKED,     VM_LOCKED    ); +	       _calc_vm_trans(flags, MAP_LOCKED,     VM_LOCKED    ) | +	       _calc_vm_trans(flags, MAP_SYNC,	     VM_SYNC      );  }  unsigned long vm_commit_limit(void); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 9a43763a68ad..e7743eca1021 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -255,6 +255,10 @@ struct mmc_supply {  	struct regulator *vqmmc;	/* Optional Vccq supply */  }; +struct mmc_ctx { +	struct task_struct *task; +}; +  struct mmc_host {  	struct device		*parent;  	struct device		class_dev; @@ -350,6 +354,8 @@ struct mmc_host {  #define MMC_CAP2_CQE		(1 << 23)	/* Has eMMC command queue engine */  #define MMC_CAP2_CQE_DCMD	(1 << 24)	/* CQE can issue a direct command */ +	int			fixed_drv_type;	/* fixed driver type for non-removable media */ +  	mmc_pm_flag_t		pm_caps;	/* supported pm features */  	/* host specific block data */ @@ -388,8 +394,9 @@ struct mmc_host {  	struct mmc_card		*card;		/* device attached to this host */  	wait_queue_head_t	wq; -	struct task_struct	*claimer;	/* task that has host claimed */ +	struct mmc_ctx		*claimer;	/* context that has host claimed */  	int			claim_cnt;	/* "claim" nesting count */ +	struct mmc_ctx		default_ctx;	/* default context */  	struct delayed_work	detect;  	int			detect_change;	/* card detect flag */ @@ -469,6 +476,8 @@ void mmc_detect_change(struct mmc_host *, unsigned long delay);  void mmc_request_done(struct mmc_host *, struct mmc_request *);  void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq); +void mmc_cqe_request_done(struct mmc_host *host, struct mmc_request *mrq); +  static inline void mmc_signal_sdio_irq(struct mmc_host *host)  {  	host->ops->enable_sdio_irq(host, 0); diff --git a/include/linux/mmc/sdhci-pci-data.h b/include/linux/mmc/sdhci-pci-data.h index fda15b6d4135..1d42872d22f3 100644 --- a/include/linux/mmc/sdhci-pci-data.h +++ b/include/linux/mmc/sdhci-pci-data.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_MMC_SDHCI_PCI_DATA_H  #define LINUX_MMC_SDHCI_PCI_DATA_H @@ -14,7 +15,4 @@ struct sdhci_pci_data {  extern struct sdhci_pci_data *(*sdhci_pci_get_data)(struct pci_dev *pdev,  				int slotno); - -extern int sdhci_pci_spt_drive_strength; -  #endif diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h index abacd5484bc0..cdd66a5fbd5e 100644 --- a/include/linux/mmc/sdio_ids.h +++ b/include/linux/mmc/sdio_ids.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * SDIO Classes, Interface Types, Manufacturer IDs, etc.   */ diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index 451a811f48f2..57b0030d3800 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_MM_DEBUG_H  #define LINUX_MM_DEBUG_H 1 diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h index 3ba327af055c..88236849894d 100644 --- a/include/linux/mmiotrace.h +++ b/include/linux/mmiotrace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MMIOTRACE_H  #define _LINUX_MMIOTRACE_H diff --git a/include/linux/mmu_context.h b/include/linux/mmu_context.h index a4441784503b..d9a543a9e1cc 100644 --- a/include/linux/mmu_context.h +++ b/include/linux/mmu_context.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MMU_CONTEXT_H  #define _LINUX_MMU_CONTEXT_H diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index 6866e8126982..b25dc9db19fc 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MMU_NOTIFIER_H  #define _LINUX_MMU_NOTIFIER_H @@ -155,7 +156,8 @@ struct mmu_notifier_ops {  	 * shared page-tables, it not necessary to implement the  	 * invalidate_range_start()/end() notifiers, as  	 * invalidate_range() alread catches the points in time when an -	 * external TLB range needs to be flushed. +	 * external TLB range needs to be flushed. For more in depth +	 * discussion on this see Documentation/vm/mmu_notifier.txt  	 *  	 * The invalidate_range() function is called under the ptl  	 * spin-lock and not allowed to sleep. @@ -212,7 +214,8 @@ extern void __mmu_notifier_change_pte(struct mm_struct *mm,  extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,  				  unsigned long start, unsigned long end);  extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm, -				  unsigned long start, unsigned long end); +				  unsigned long start, unsigned long end, +				  bool only_end);  extern void __mmu_notifier_invalidate_range(struct mm_struct *mm,  				  unsigned long start, unsigned long end); @@ -266,7 +269,14 @@ static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,  				  unsigned long start, unsigned long end)  {  	if (mm_has_notifiers(mm)) -		__mmu_notifier_invalidate_range_end(mm, start, end); +		__mmu_notifier_invalidate_range_end(mm, start, end, false); +} + +static inline void mmu_notifier_invalidate_range_only_end(struct mm_struct *mm, +				  unsigned long start, unsigned long end) +{ +	if (mm_has_notifiers(mm)) +		__mmu_notifier_invalidate_range_end(mm, start, end, true);  }  static inline void mmu_notifier_invalidate_range(struct mm_struct *mm, @@ -437,6 +447,11 @@ static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,  {  } +static inline void mmu_notifier_invalidate_range_only_end(struct mm_struct *mm, +				  unsigned long start, unsigned long end) +{ +} +  static inline void mmu_notifier_invalidate_range(struct mm_struct *mm,  				  unsigned long start, unsigned long end)  { diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index c8f89417740b..67f2e3c38939 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MMZONE_H  #define _LINUX_MMZONE_H @@ -699,7 +700,8 @@ typedef struct pglist_data {  	 * is the first PFN that needs to be initialised.  	 */  	unsigned long first_deferred_pfn; -	unsigned long static_init_size; +	/* Number of non-deferred pages */ +	unsigned long static_init_pgcnt;  #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */  #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -711,12 +713,6 @@ typedef struct pglist_data {  	/* Fields commonly accessed by the page reclaim scanner */  	struct lruvec		lruvec; -	/* -	 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on -	 * this node's LRU.  Maintained by the pageout code. -	 */ -	unsigned int inactive_ratio; -  	unsigned long		flags;  	ZONE_PADDING(_pad2_) @@ -1150,13 +1146,17 @@ struct mem_section {  #define SECTION_ROOT_MASK	(SECTIONS_PER_ROOT - 1)  #ifdef CONFIG_SPARSEMEM_EXTREME -extern struct mem_section *mem_section[NR_SECTION_ROOTS]; +extern struct mem_section **mem_section;  #else  extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT];  #endif  static inline struct mem_section *__nr_to_section(unsigned long nr)  { +#ifdef CONFIG_SPARSEMEM_EXTREME +	if (!mem_section) +		return NULL; +#endif  	if (!mem_section[SECTION_NR_TO_ROOT(nr)])  		return NULL;  	return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h index 12b2ab510323..35942084cd40 100644 --- a/include/linux/mnt_namespace.h +++ b/include/linux/mnt_namespace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NAMESPACE_H_  #define _NAMESPACE_H_  #ifdef __KERNEL__ diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 694cebb50f72..abb6dc2ebbf8 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Device tables which are exported to userspace via   * scripts/mod/file2alias.c.  You must keep that file in sync with this @@ -293,6 +294,7 @@ struct pcmcia_device_id {  #define INPUT_DEVICE_ID_SND_MAX		0x07  #define INPUT_DEVICE_ID_FF_MAX		0x7f  #define INPUT_DEVICE_ID_SW_MAX		0x0f +#define INPUT_DEVICE_ID_PROP_MAX	0x1f  #define INPUT_DEVICE_ID_MATCH_BUS	1  #define INPUT_DEVICE_ID_MATCH_VENDOR	2 @@ -308,6 +310,7 @@ struct pcmcia_device_id {  #define INPUT_DEVICE_ID_MATCH_SNDBIT	0x0400  #define INPUT_DEVICE_ID_MATCH_FFBIT	0x0800  #define INPUT_DEVICE_ID_MATCH_SWBIT	0x1000 +#define INPUT_DEVICE_ID_MATCH_PROPBIT	0x2000  struct input_device_id { @@ -327,6 +330,7 @@ struct input_device_id {  	kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1];  	kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1];  	kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1]; +	kernel_ulong_t propbit[INPUT_DEVICE_ID_PROP_MAX / BITS_PER_LONG + 1];  	kernel_ulong_t driver_info;  }; @@ -683,5 +687,31 @@ struct fsl_mc_device_id {  	const char obj_type[16];  }; +/** + * struct tb_service_id - Thunderbolt service identifiers + * @match_flags: Flags used to match the structure + * @protocol_key: Protocol key the service supports + * @protocol_id: Protocol id the service supports + * @protocol_version: Version of the protocol + * @protocol_revision: Revision of the protocol software + * @driver_data: Driver specific data + * + * Thunderbolt XDomain services are exposed as devices where each device + * carries the protocol information the service supports. Thunderbolt + * XDomain service drivers match against that information. + */ +struct tb_service_id { +	__u32 match_flags; +	char protocol_key[8 + 1]; +	__u32 protocol_id; +	__u32 protocol_version; +	__u32 protocol_revision; +	kernel_ulong_t driver_data; +}; + +#define TBSVC_MATCH_PROTOCOL_KEY	0x0001 +#define TBSVC_MATCH_PROTOCOL_ID		0x0002 +#define TBSVC_MATCH_PROTOCOL_VERSION	0x0004 +#define TBSVC_MATCH_PROTOCOL_REVISION	0x0008  #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/include/linux/module.h b/include/linux/module.h index fe5aa3736707..c69b49abe877 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -639,6 +639,8 @@ static inline bool is_livepatch_module(struct module *mod)  }  #endif /* CONFIG_LIVEPATCH */ +bool is_module_sig_enforced(void); +  #else /* !CONFIG_MODULES... */  static inline struct module *__module_address(unsigned long addr) @@ -753,6 +755,11 @@ static inline bool module_requested_async_probing(struct module *module)  	return false;  } +static inline bool is_module_sig_enforced(void) +{ +	return false; +} +  #endif /* CONFIG_MODULES */  #ifdef CONFIG_SYSFS diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h index 4d0cb9bba93e..31013c2effd3 100644 --- a/include/linux/moduleloader.h +++ b/include/linux/moduleloader.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MODULELOADER_H  #define _LINUX_MODULELOADER_H  /* The stuff needed for archs to support modules. */ diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 1ee7b30dafec..ba36506db4fb 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MODULE_PARAMS_H  #define _LINUX_MODULE_PARAMS_H  /* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */ @@ -227,19 +228,11 @@ struct kparam_array  	    VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }  /* Obsolete - use module_param_cb() */ -#define module_param_call(name, set, get, arg, perm)			\ -	static const struct kernel_param_ops __param_ops_##name =		\ -		{ .flags = 0, (void *)set, (void *)get };		\ +#define module_param_call(name, _set, _get, arg, perm)			\ +	static const struct kernel_param_ops __param_ops_##name =	\ +		{ .flags = 0, .set = _set, .get = _get };		\  	__module_param_call(MODULE_PARAM_PREFIX,			\ -			    name, &__param_ops_##name, arg,		\ -			    (perm) + sizeof(__check_old_set_param(set))*0, -1, 0) - -/* We don't get oldget: it's often a new-style param_get_uint, etc. */ -static inline int -__check_old_set_param(int (*oldset)(const char *, struct kernel_param *)) -{ -	return 0; -} +			    name, &__param_ops_##name, arg, perm, -1, 0)  #ifdef CONFIG_SYSFS  extern void kernel_param_lock(struct module *mod); diff --git a/include/linux/mount.h b/include/linux/mount.h index 1ce85e6fd95f..45b1f56c6c2f 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *   * Definitions for mount interface. This describes the in the kernel build  diff --git a/include/linux/mpage.h b/include/linux/mpage.h index 068a0c9946af..001f1fcf9836 100644 --- a/include/linux/mpage.h +++ b/include/linux/mpage.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/mpage.h   * diff --git a/include/linux/mpls.h b/include/linux/mpls.h index 384fb22b6c43..ae1a188c011b 100644 --- a/include/linux/mpls.h +++ b/include/linux/mpls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MPLS_H  #define _LINUX_MPLS_H diff --git a/include/linux/mpls_iptunnel.h b/include/linux/mpls_iptunnel.h index ef29eb2d6dfd..140c56954fbe 100644 --- a/include/linux/mpls_iptunnel.h +++ b/include/linux/mpls_iptunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MPLS_IPTUNNEL_H  #define _LINUX_MPLS_IPTUNNEL_H diff --git a/include/linux/mroute.h b/include/linux/mroute.h index d7f63339ef0b..5396521a776a 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MROUTE_H  #define __LINUX_MROUTE_H @@ -5,6 +6,8 @@  #include <linux/pim.h>  #include <linux/rhashtable.h>  #include <net/sock.h> +#include <net/fib_rules.h> +#include <net/fib_notifier.h>  #include <uapi/linux/mroute.h>  #ifdef CONFIG_IP_MROUTE @@ -18,6 +21,7 @@ int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);  int ipmr_ioctl(struct sock *sk, int cmd, void __user *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);  #else  static inline int ip_mroute_setsockopt(struct sock *sock, int optname,  				       char __user *optval, unsigned int optlen) @@ -45,10 +49,16 @@ static inline int ip_mroute_opt(int opt)  {  	return 0;  } + +static inline bool ipmr_rule_default(const struct fib_rule *rule) +{ +	return true; +}  #endif  struct vif_device {  	struct net_device 	*dev;			/* Device we are using */ +	struct netdev_phys_item_id dev_parent_id;	/* Device parent ID    */  	unsigned long	bytes_in,bytes_out;  	unsigned long	pkt_in,pkt_out;		/* Statistics 			*/  	unsigned long	rate_limit;		/* Traffic shaping (NI) 	*/ @@ -58,6 +68,14 @@ struct vif_device {  	int		link;			/* Physical interface index	*/  }; +struct vif_entry_notifier_info { +	struct fib_notifier_info info; +	struct net_device *dev; +	vifi_t vif_index; +	unsigned short vif_flags; +	u32 tb_id; +}; +  #define VIFF_STATIC 0x8000  #define VIF_EXISTS(_mrt, _idx) ((_mrt)->vif_table[_idx].dev != NULL) @@ -81,9 +99,11 @@ struct mr_table {  /* mfc_flags:   * MFC_STATIC - the entry was added statically (not by a routing daemon) + * MFC_OFFLOAD - the entry was offloaded to the hardware   */  enum {  	MFC_STATIC = BIT(0), +	MFC_OFFLOAD = BIT(1),  };  struct mfc_cache_cmp_arg { @@ -109,6 +129,7 @@ struct mfc_cache_cmp_arg {   * @wrong_if: number of wrong source interface hits   * @lastuse: time of last use of the group (traffic or update)   * @ttls: OIF TTL threshold array + * @refcount: reference count for this entry   * @list: global entry list   * @rcu: used for entry destruction   */ @@ -138,14 +159,40 @@ struct mfc_cache {  			unsigned long wrong_if;  			unsigned long lastuse;  			unsigned char ttls[MAXVIFS]; +			refcount_t refcount;  		} res;  	} mfc_un;  	struct list_head list;  	struct rcu_head	rcu;  }; +struct mfc_entry_notifier_info { +	struct fib_notifier_info info; +	struct mfc_cache *mfc; +	u32 tb_id; +}; +  struct rtmsg;  int ipmr_get_route(struct net *net, struct sk_buff *skb,  		   __be32 saddr, __be32 daddr,  		   struct rtmsg *rtm, u32 portid); + +#ifdef CONFIG_IP_MROUTE +void ipmr_cache_free(struct mfc_cache *mfc_cache); +#else +static inline void ipmr_cache_free(struct mfc_cache *mfc_cache) +{ +} +#endif + +static inline void ipmr_cache_put(struct mfc_cache *c) +{ +	if (refcount_dec_and_test(&c->mfc_un.res.refcount)) +		ipmr_cache_free(c); +} +static inline void ipmr_cache_hold(struct mfc_cache *c) +{ +	refcount_inc(&c->mfc_un.res.refcount); +} +  #endif diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h index ce44e3e96d27..3014c52bfd86 100644 --- a/include/linux/mroute6.h +++ b/include/linux/mroute6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MROUTE6_H  #define __LINUX_MROUTE6_H diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index e1b163f912fb..b7a5d4c72f56 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MSDOS_FS_H  #define _LINUX_MSDOS_FS_H diff --git a/include/linux/msg.h b/include/linux/msg.h index 81263fe3f9dc..0a7eefeee0d1 100644 --- a/include/linux/msg.h +++ b/include/linux/msg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MSG_H  #define _LINUX_MSG_H diff --git a/include/linux/msi.h b/include/linux/msi.h index 80e3b562bef6..1f1bbb5b4679 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_MSI_H  #define LINUX_MSI_H @@ -283,6 +284,11 @@ enum {  	MSI_FLAG_PCI_MSIX		= (1 << 3),  	/* Needs early activate, required for PCI */  	MSI_FLAG_ACTIVATE_EARLY		= (1 << 4), +	/* +	 * Must reactivate when irq is started even when +	 * MSI_FLAG_ACTIVATE_EARLY has been set. +	 */ +	MSI_FLAG_MUST_REACTIVATE	= (1 << 5),  };  int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask, diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h index 8255118be0f0..fdfff87066a9 100644 --- a/include/linux/mtd/inftl.h +++ b/include/linux/mtd/inftl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	inftl.h -- defines to support the Inverse NAND Flash Translation Layer   * diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 6cd0f6b7658b..cd55bf14ad51 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -267,7 +267,7 @@ struct mtd_info {  	 */  	unsigned int bitflip_threshold; -	// Kernel-only stuff starts here. +	/* Kernel-only stuff starts here. */  	const char *name;  	int index; @@ -297,10 +297,6 @@ struct mtd_info {  	int (*_point) (struct mtd_info *mtd, loff_t from, size_t len,  		       size_t *retlen, void **virt, resource_size_t *phys);  	int (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len); -	unsigned long (*_get_unmapped_area) (struct mtd_info *mtd, -					     unsigned long len, -					     unsigned long offset, -					     unsigned long flags);  	int (*_read) (struct mtd_info *mtd, loff_t from, size_t len,  		      size_t *retlen, u_char *buf);  	int (*_write) (struct mtd_info *mtd, loff_t to, size_t len, diff --git a/include/linux/mtd/mtdram.h b/include/linux/mtd/mtdram.h index 628a6a21ddf0..ee8f95643f9b 100644 --- a/include/linux/mtd/mtdram.h +++ b/include/linux/mtd/mtdram.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __MTD_MTDRAM_H__  #define __MTD_MTDRAM_H__ diff --git a/include/linux/mtd/nand-gpio.h b/include/linux/mtd/nand-gpio.h index be4f45d89be2..7ab51bc4a380 100644 --- a/include/linux/mtd/nand-gpio.h +++ b/include/linux/mtd/nand-gpio.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MTD_NAND_GPIO_H  #define __LINUX_MTD_NAND_GPIO_H  #include <linux/mtd/rawnand.h>  struct gpio_nand_platdata { -	int	gpio_nce; -	int	gpio_nwp; -	int	gpio_cle; -	int	gpio_ale; -	int	gpio_rdy;  	void	(*adjust_parts)(struct gpio_nand_platdata *, size_t);  	struct mtd_partition *parts;  	unsigned int num_parts; diff --git a/include/linux/mtd/pfow.h b/include/linux/mtd/pfow.h index 42ff7ff09bf5..122f3439e1af 100644 --- a/include/linux/mtd/pfow.h +++ b/include/linux/mtd/pfow.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Primary function overlay window definitions   * and service functions used by LPDDR chips   */ diff --git a/include/linux/mtd/qinfo.h b/include/linux/mtd/qinfo.h index b532ce524dae..df5b9fddea16 100644 --- a/include/linux/mtd/qinfo.h +++ b/include/linux/mtd/qinfo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_MTD_QINFO_H  #define __LINUX_MTD_QINFO_H diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 2b05f4273bab..749bb08c4772 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -177,6 +177,9 @@ enum nand_ecc_algo {   */  #define NAND_NEED_SCRAMBLING	0x00002000 +/* Device needs 3rd row address cycle */ +#define NAND_ROW_ADDR_3		0x00004000 +  /* Options valid for Samsung large page devices */  #define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 1f0a7fc7772f..d0c66a0975cf 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -232,10 +232,17 @@ enum spi_nor_option_flags {  };  /** + * struct flash_info - Forward declaration of a structure used internally by + *		       spi_nor_scan() + */ +struct flash_info; + +/**   * struct spi_nor - Structure for defining a the SPI NOR layer   * @mtd:		point to a mtd_info structure   * @lock:		the lock for the read/write/erase/lock/unlock operations   * @dev:		point to a spi device, or a spi nor controller device. + * @info:		spi-nor part JDEC MFR id and other info   * @page_size:		the page size of the SPI NOR   * @addr_width:		number of address bytes   * @erase_opcode:	the opcode for erasing a sector @@ -262,6 +269,7 @@ enum spi_nor_option_flags {   * @flash_lock:		[FLASH-SPECIFIC] lock a region of the SPI NOR   * @flash_unlock:	[FLASH-SPECIFIC] unlock a region of the SPI NOR   * @flash_is_locked:	[FLASH-SPECIFIC] check if a region of the SPI NOR is + * @quad_enable:	[FLASH-SPECIFIC] enables SPI NOR quad mode   *			completely locked   * @priv:		the private data   */ @@ -269,6 +277,7 @@ struct spi_nor {  	struct mtd_info		mtd;  	struct mutex		lock;  	struct device		*dev; +	const struct flash_info	*info;  	u32			page_size;  	u8			addr_width;  	u8			erase_opcode; @@ -296,6 +305,7 @@ struct spi_nor {  	int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);  	int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);  	int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); +	int (*quad_enable)(struct spi_nor *nor);  	void *priv;  }; diff --git a/include/linux/mutex.h b/include/linux/mutex.h index ffcba1f337da..153274f78402 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Mutexes: blocking mutual exclusion locks   * diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h index 61a0da38d0cb..3682ae75c7aa 100644 --- a/include/linux/mv643xx_eth.h +++ b/include/linux/mv643xx_eth.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * MV-643XX ethernet platform device data definition file.   */ diff --git a/include/linux/namei.h b/include/linux/namei.h index 8b4794e83196..a982bb7cd480 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_NAMEI_H  #define _LINUX_NAMEI_H diff --git a/include/linux/net.h b/include/linux/net.h index d97d80d7fdf8..caeb159abda5 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -22,7 +22,6 @@  #include <linux/random.h>  #include <linux/wait.h>  #include <linux/fcntl.h>	/* For O_CLOEXEC and O_NONBLOCK */ -#include <linux/kmemcheck.h>  #include <linux/rcupdate.h>  #include <linux/once.h>  #include <linux/fs.h> @@ -111,9 +110,7 @@ struct socket_wq {  struct socket {  	socket_state		state; -	kmemcheck_bitfield_begin(type);  	short			type; -	kmemcheck_bitfield_end(type);  	unsigned long		flags; diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index dc8b4896b77b..b1b0ca7ccb2b 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -54,8 +54,9 @@ enum {  	NETIF_F_GSO_TUNNEL_REMCSUM_BIT, /* ... TUNNEL with TSO & REMCSUM */  	NETIF_F_GSO_SCTP_BIT,		/* ... SCTP fragmentation */  	NETIF_F_GSO_ESP_BIT,		/* ... ESP with TSO */ +	NETIF_F_GSO_UDP_BIT,		/* ... UFO, deprecated except tuntap */  	/**/NETIF_F_GSO_LAST =		/* last bit, see GSO_MASK */ -		NETIF_F_GSO_ESP_BIT, +		NETIF_F_GSO_UDP_BIT,  	NETIF_F_FCOE_CRC_BIT,		/* FCoE CRC32 */  	NETIF_F_SCTP_CRC_BIT,		/* SCTP checksum offload */ @@ -132,6 +133,7 @@ enum {  #define NETIF_F_GSO_TUNNEL_REMCSUM __NETIF_F(GSO_TUNNEL_REMCSUM)  #define NETIF_F_GSO_SCTP	__NETIF_F(GSO_SCTP)  #define NETIF_F_GSO_ESP		__NETIF_F(GSO_ESP) +#define NETIF_F_GSO_UDP		__NETIF_F(GSO_UDP)  #define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)  #define NETIF_F_HW_VLAN_STAG_RX	__NETIF_F(HW_VLAN_STAG_RX)  #define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f535779d9dc1..ef789e1d679e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -55,7 +55,7 @@  struct netpoll_info;  struct device;  struct phy_device; -struct dsa_switch_tree; +struct dsa_port;  /* 802.11 specific */  struct wireless_dev; @@ -770,17 +770,20 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,  				       struct sk_buff *skb);  enum tc_setup_type { -	TC_SETUP_MQPRIO, +	TC_SETUP_QDISC_MQPRIO,  	TC_SETUP_CLSU32,  	TC_SETUP_CLSFLOWER,  	TC_SETUP_CLSMATCHALL,  	TC_SETUP_CLSBPF, +	TC_SETUP_BLOCK, +	TC_SETUP_QDISC_CBS, +	TC_SETUP_QDISC_RED,  }; -/* These structures hold the attributes of xdp state that are being passed - * to the netdevice through the xdp op. +/* These structures hold the attributes of bpf state that are being passed + * to the netdevice through the bpf op.   */ -enum xdp_netdev_command { +enum bpf_netdev_command {  	/* Set or clear a bpf program used in the earliest stages of packet  	 * rx. The prog will have been loaded as BPF_PROG_TYPE_XDP. The callee  	 * is responsible for calling bpf_prog_put on any old progs that are @@ -795,12 +798,17 @@ enum xdp_netdev_command {  	 * is equivalent to XDP_ATTACHED_DRV.  	 */  	XDP_QUERY_PROG, +	/* BPF program for offload callbacks, invoked at program load time. */ +	BPF_OFFLOAD_VERIFIER_PREP, +	BPF_OFFLOAD_TRANSLATE, +	BPF_OFFLOAD_DESTROY,  }; +struct bpf_ext_analyzer_ops;  struct netlink_ext_ack; -struct netdev_xdp { -	enum xdp_netdev_command command; +struct netdev_bpf { +	enum bpf_netdev_command command;  	union {  		/* XDP_SETUP_PROG */  		struct { @@ -813,6 +821,15 @@ struct netdev_xdp {  			u8 prog_attached;  			u32 prog_id;  		}; +		/* BPF_OFFLOAD_VERIFIER_PREP */ +		struct { +			struct bpf_prog *prog; +			const struct bpf_ext_analyzer_ops *ops; /* callee set */ +		} verifier; +		/* BPF_OFFLOAD_TRANSLATE, BPF_OFFLOAD_DESTROY */ +		struct { +			struct bpf_prog *prog; +		} offload;  	};  }; @@ -826,6 +843,11 @@ struct xfrmdev_ops {  };  #endif +struct dev_ifalias { +	struct rcu_head rcuhead; +	char ifalias[]; +}; +  /*   * This structure defines the management hooks for network devices.   * The following hooks can be defined; unless noted otherwise, they are @@ -1117,9 +1139,10 @@ struct xfrmdev_ops {   *	appropriate rx headroom value allows avoiding skb head copy on   *	forward. Setting a negative value resets the rx headroom to the   *	default value. - * int (*ndo_xdp)(struct net_device *dev, struct netdev_xdp *xdp); + * int (*ndo_bpf)(struct net_device *dev, struct netdev_bpf *bpf);   *	This function is used to set or query state related to XDP on the - *	netdevice. See definition of enum xdp_netdev_command for details. + *	netdevice and manage BPF offload. See definition of + *	enum bpf_netdev_command for details.   * int (*ndo_xdp_xmit)(struct net_device *dev, struct xdp_buff *xdp);   *	This function is used to submit a XDP packet for transmit on a   *	netdevice. @@ -1241,7 +1264,8 @@ struct net_device_ops {  						     u32 flow_id);  #endif  	int			(*ndo_add_slave)(struct net_device *dev, -						 struct net_device *slave_dev); +						 struct net_device *slave_dev, +						 struct netlink_ext_ack *extack);  	int			(*ndo_del_slave)(struct net_device *dev,  						 struct net_device *slave_dev);  	netdev_features_t	(*ndo_fix_features)(struct net_device *dev, @@ -1307,8 +1331,8 @@ struct net_device_ops {  						       struct sk_buff *skb);  	void			(*ndo_set_rx_headroom)(struct net_device *dev,  						       int needed_headroom); -	int			(*ndo_xdp)(struct net_device *dev, -					   struct netdev_xdp *xdp); +	int			(*ndo_bpf)(struct net_device *dev, +					   struct netdev_bpf *bpf);  	int			(*ndo_xdp_xmit)(struct net_device *dev,  						struct xdp_buff *xdp);  	void			(*ndo_xdp_flush)(struct net_device *dev); @@ -1551,6 +1575,8 @@ enum netdev_priv_flags {   *   *	@rx_handler:		handler for received packets   *	@rx_handler_data: 	XXX: need comments on this one + *	@miniq_ingress:		ingress/clsact qdisc specific data for + *				ingress processing   *	@ingress_queue:		XXX: need comments on this one   *	@broadcast:		hw bcast address   * @@ -1568,7 +1594,8 @@ enum netdev_priv_flags {   *	@tx_global_lock: 	XXX: need comments on this one   *   *	@xps_maps:	XXX: need comments on this one - * + *	@miniq_egress:		clsact qdisc specific data for + *				egress processing   *	@watchdog_timeo:	Represents the timeout that is used by   *				the watchdog (see dev_watchdog())   *	@watchdog_timer:	List of timers @@ -1632,7 +1659,7 @@ enum netdev_priv_flags {  struct net_device {  	char			name[IFNAMSIZ];  	struct hlist_node	name_hlist; -	char 			*ifalias; +	struct dev_ifalias	__rcu *ifalias;  	/*  	 *	I/O specific fields  	 *	FIXME: Merge these and struct ifmap into one @@ -1752,7 +1779,7 @@ struct net_device {  	struct vlan_info __rcu	*vlan_info;  #endif  #if IS_ENABLED(CONFIG_NET_DSA) -	struct dsa_switch_tree	*dsa_ptr; +	struct dsa_port		*dsa_ptr;  #endif  #if IS_ENABLED(CONFIG_TIPC)  	struct tipc_bearer __rcu *tipc_ptr; @@ -1787,7 +1814,7 @@ struct net_device {  	void __rcu		*rx_handler_data;  #ifdef CONFIG_NET_CLS_ACT -	struct tcf_proto __rcu  *ingress_cl_list; +	struct mini_Qdisc __rcu	*miniq_ingress;  #endif  	struct netdev_queue __rcu *ingress_queue;  #ifdef CONFIG_NETFILTER_INGRESS @@ -1818,7 +1845,7 @@ struct net_device {  	struct xps_dev_maps __rcu *xps_maps;  #endif  #ifdef CONFIG_NET_CLS_ACT -	struct tcf_proto __rcu  *egress_cl_list; +	struct mini_Qdisc __rcu	*miniq_egress;  #endif  	/* These may be needed for future network-power-down code. */ @@ -2304,7 +2331,8 @@ int register_netdevice_notifier(struct notifier_block *nb);  int unregister_netdevice_notifier(struct notifier_block *nb);  struct netdev_notifier_info { -	struct net_device *dev; +	struct net_device	*dev; +	struct netlink_ext_ack	*extack;  };  struct netdev_notifier_change_info { @@ -2329,6 +2357,7 @@ static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,  					     struct net_device *dev)  {  	info->dev = dev; +	info->extack = NULL;  }  static inline struct net_device * @@ -2337,6 +2366,12 @@ netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)  	return info->dev;  } +static inline struct netlink_ext_ack * +netdev_notifier_info_to_extack(const struct netdev_notifier_info *info) +{ +	return info->extack; +} +  int call_netdevice_notifiers(unsigned long val, struct net_device *dev); @@ -3246,6 +3281,7 @@ int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb);  int netif_rx(struct sk_buff *skb);  int netif_rx_ni(struct sk_buff *skb);  int netif_receive_skb(struct sk_buff *skb); +int netif_receive_skb_core(struct sk_buff *skb);  gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);  void napi_gro_flush(struct napi_struct *napi, bool flush_old);  struct sk_buff *napi_get_frags(struct napi_struct *napi); @@ -3275,6 +3311,7 @@ void __dev_notify_flags(struct net_device *, unsigned int old_flags,  			unsigned int gchanges);  int dev_change_name(struct net_device *, const char *);  int dev_set_alias(struct net_device *, const char *, size_t); +int dev_get_alias(const struct net_device *, char *, size_t);  int dev_change_net_namespace(struct net_device *, struct net *, const char *);  int __dev_set_mtu(struct net_device *, int);  int dev_set_mtu(struct net_device *, int); @@ -3290,10 +3327,10 @@ struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *d  struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,  				    struct netdev_queue *txq, int *ret); -typedef int (*xdp_op_t)(struct net_device *dev, struct netdev_xdp *xdp); +typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf);  int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,  		      int fd, u32 flags); -u8 __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op, u32 *prog_id); +u8 __dev_xdp_attached(struct net_device *dev, bpf_op_t xdp_op, u32 *prog_id);  int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);  int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); @@ -3694,6 +3731,9 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,  				    unsigned char name_assign_type,  				    void (*setup)(struct net_device *),  				    unsigned int txqs, unsigned int rxqs); +int dev_get_valid_name(struct net *net, struct net_device *dev, +		       const char *name); +  #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \  	alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1) @@ -3904,10 +3944,12 @@ void *netdev_adjacent_get_private(struct list_head *adj_list);  void *netdev_lower_get_first_private_rcu(struct net_device *dev);  struct net_device *netdev_master_upper_dev_get(struct net_device *dev);  struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); -int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev); +int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, +			  struct netlink_ext_ack *extack);  int netdev_master_upper_dev_link(struct net_device *dev,  				 struct net_device *upper_dev, -				 void *upper_priv, void *upper_info); +				 void *upper_priv, void *upper_info, +				 struct netlink_ext_ack *extack);  void netdev_upper_dev_unlink(struct net_device *dev,  			     struct net_device *upper_dev);  void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); @@ -4098,6 +4140,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)  	BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> NETIF_F_GSO_SHIFT));  	BUILD_BUG_ON(SKB_GSO_SCTP    != (NETIF_F_GSO_SCTP >> NETIF_F_GSO_SHIFT));  	BUILD_BUG_ON(SKB_GSO_ESP != (NETIF_F_GSO_ESP >> NETIF_F_GSO_SHIFT)); +	BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_GSO_UDP >> NETIF_F_GSO_SHIFT));  	return (features & feature) == feature;  } @@ -4294,6 +4337,31 @@ void netdev_notice(const struct net_device *dev, const char *format, ...);  __printf(2, 3)  void netdev_info(const struct net_device *dev, const char *format, ...); +#define netdev_level_once(level, dev, fmt, ...)			\ +do {								\ +	static bool __print_once __read_mostly;			\ +								\ +	if (!__print_once) {					\ +		__print_once = true;				\ +		netdev_printk(level, dev, fmt, ##__VA_ARGS__);	\ +	}							\ +} while (0) + +#define netdev_emerg_once(dev, fmt, ...) \ +	netdev_level_once(KERN_EMERG, dev, fmt, ##__VA_ARGS__) +#define netdev_alert_once(dev, fmt, ...) \ +	netdev_level_once(KERN_ALERT, dev, fmt, ##__VA_ARGS__) +#define netdev_crit_once(dev, fmt, ...) \ +	netdev_level_once(KERN_CRIT, dev, fmt, ##__VA_ARGS__) +#define netdev_err_once(dev, fmt, ...) \ +	netdev_level_once(KERN_ERR, dev, fmt, ##__VA_ARGS__) +#define netdev_warn_once(dev, fmt, ...) \ +	netdev_level_once(KERN_WARNING, dev, fmt, ##__VA_ARGS__) +#define netdev_notice_once(dev, fmt, ...) \ +	netdev_level_once(KERN_NOTICE, dev, fmt, ##__VA_ARGS__) +#define netdev_info_once(dev, fmt, ...) \ +	netdev_level_once(KERN_INFO, dev, fmt, ##__VA_ARGS__) +  #define MODULE_ALIAS_NETDEV(device) \  	MODULE_ALIAS("netdev-" device) @@ -4334,6 +4402,10 @@ do {								\  	WARN(1, "netdevice: %s%s\n" format, netdev_name(dev),	\  	     netdev_reg_state(dev), ##args) +#define netdev_WARN_ONCE(dev, condition, format, arg...)		\ +	WARN_ONCE(1, "netdevice: %s%s\n" format, netdev_name(dev)	\ +		  netdev_reg_state(dev), ##args) +  /* netif printk helpers, similar to netdev_printk */  #define netif_printk(priv, type, level, dev, fmt, args...)	\ @@ -4408,15 +4480,7 @@ do {								\   *	Why 16. Because with 16 the only overlap we get on a hash of the   *	low nibble of the protocol value is RARP/SNAP/X.25.   * - *      NOTE:  That is no longer true with the addition of VLAN tags.  Not - *             sure which should go first, but I bet it won't make much - *             difference if we are running VLANs.  The good news is that - *             this protocol won't be in the list unless compiled in, so - *             the average user (w/out VLANs) will not be adversely affected. - *             --BLG - *   *		0800	IP - *		8100    802.1Q VLAN   *		0001	802.3   *		0002	AX.25   *		0004	802.2 diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index f84bca1703cd..b24e9b101651 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_NETFILTER_H  #define __LINUX_NETFILTER_H diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h index 366d6c0ea04f..2dddbc6dcac7 100644 --- a/include/linux/netfilter/ipset/ip_set_bitmap.h +++ b/include/linux/netfilter/ipset/ip_set_bitmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __IP_SET_BITMAP_H  #define __IP_SET_BITMAP_H diff --git a/include/linux/netfilter/ipset/ip_set_getport.h b/include/linux/netfilter/ipset/ip_set_getport.h index 90d09300e954..ac6a11d38a19 100644 --- a/include/linux/netfilter/ipset/ip_set_getport.h +++ b/include/linux/netfilter/ipset/ip_set_getport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IP_SET_GETPORT_H  #define _IP_SET_GETPORT_H diff --git a/include/linux/netfilter/ipset/ip_set_hash.h b/include/linux/netfilter/ipset/ip_set_hash.h index f98ddfb094cb..838abab672af 100644 --- a/include/linux/netfilter/ipset/ip_set_hash.h +++ b/include/linux/netfilter/ipset/ip_set_hash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __IP_SET_HASH_H  #define __IP_SET_HASH_H diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h index fe2622a00151..a61fe2a7e655 100644 --- a/include/linux/netfilter/ipset/ip_set_list.h +++ b/include/linux/netfilter/ipset/ip_set_list.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __IP_SET_LIST_H  #define __IP_SET_LIST_H diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h index 1afbb94b4b65..f59094e6158b 100644 --- a/include/linux/netfilter/ipset/pfxlen.h +++ b/include/linux/netfilter/ipset/pfxlen.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _PFXLEN_H  #define _PFXLEN_H diff --git a/include/linux/netfilter/nf_conntrack_amanda.h b/include/linux/netfilter/nf_conntrack_amanda.h index 4b59a1584959..34345e543ba2 100644 --- a/include/linux/netfilter/nf_conntrack_amanda.h +++ b/include/linux/netfilter/nf_conntrack_amanda.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_AMANDA_H  #define _NF_CONNTRACK_AMANDA_H  /* AMANDA tracking. */ diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h index 1d1ef4e20512..03097fa70975 100644 --- a/include/linux/netfilter/nf_conntrack_common.h +++ b/include/linux/netfilter/nf_conntrack_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_COMMON_H  #define _NF_CONNTRACK_COMMON_H diff --git a/include/linux/netfilter/nf_conntrack_dccp.h b/include/linux/netfilter/nf_conntrack_dccp.h index ff721d7325cf..ace0f952d50f 100644 --- a/include/linux/netfilter/nf_conntrack_dccp.h +++ b/include/linux/netfilter/nf_conntrack_dccp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_DCCP_H  #define _NF_CONNTRACK_DCCP_H diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h index 5f818b01e035..73a296dfd019 100644 --- a/include/linux/netfilter/nf_conntrack_ftp.h +++ b/include/linux/netfilter/nf_conntrack_ftp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_FTP_H  #define _NF_CONNTRACK_FTP_H diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h index 858d9b214053..f76ed373a2a5 100644 --- a/include/linux/netfilter/nf_conntrack_h323.h +++ b/include/linux/netfilter/nf_conntrack_h323.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_H323_H  #define _NF_CONNTRACK_H323_H diff --git a/include/linux/netfilter/nf_conntrack_irc.h b/include/linux/netfilter/nf_conntrack_irc.h index 4bb9bae67176..00c2b74206e1 100644 --- a/include/linux/netfilter/nf_conntrack_irc.h +++ b/include/linux/netfilter/nf_conntrack_irc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_IRC_H  #define _NF_CONNTRACK_IRC_H diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h index 2ab2830316b7..833a5b2255ea 100644 --- a/include/linux/netfilter/nf_conntrack_pptp.h +++ b/include/linux/netfilter/nf_conntrack_pptp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* PPTP constants and structs */  #ifndef _NF_CONNTRACK_PPTP_H  #define _NF_CONNTRACK_PPTP_H diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h index dee0acd0dd31..b8d95564bd53 100644 --- a/include/linux/netfilter/nf_conntrack_proto_gre.h +++ b/include/linux/netfilter/nf_conntrack_proto_gre.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _CONNTRACK_PROTO_GRE_H  #define _CONNTRACK_PROTO_GRE_H  #include <asm/byteorder.h> diff --git a/include/linux/netfilter/nf_conntrack_sane.h b/include/linux/netfilter/nf_conntrack_sane.h index 4767d6e23e97..7d2de44edce3 100644 --- a/include/linux/netfilter/nf_conntrack_sane.h +++ b/include/linux/netfilter/nf_conntrack_sane.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_SANE_H  #define _NF_CONNTRACK_SANE_H  /* SANE tracking. */ diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h index 22a16a23cd8a..9a33f171aa82 100644 --- a/include/linux/netfilter/nf_conntrack_sctp.h +++ b/include/linux/netfilter/nf_conntrack_sctp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_SCTP_H  #define _NF_CONNTRACK_SCTP_H  /* SCTP tracking. */ diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index d5af3c27fb7d..c7fc38807a33 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NF_CONNTRACK_SIP_H__  #define __NF_CONNTRACK_SIP_H__  #ifdef __KERNEL__ diff --git a/include/linux/netfilter/nf_conntrack_snmp.h b/include/linux/netfilter/nf_conntrack_snmp.h index 064bc63a5346..818088c47475 100644 --- a/include/linux/netfilter/nf_conntrack_snmp.h +++ b/include/linux/netfilter/nf_conntrack_snmp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_SNMP_H  #define _NF_CONNTRACK_SNMP_H diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h index 22db9614b584..f9e3a663037b 100644 --- a/include/linux/netfilter/nf_conntrack_tcp.h +++ b/include/linux/netfilter/nf_conntrack_tcp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_TCP_H  #define _NF_CONNTRACK_TCP_H diff --git a/include/linux/netfilter/nf_conntrack_tftp.h b/include/linux/netfilter/nf_conntrack_tftp.h index c78d38fdb050..5769e12dd0a2 100644 --- a/include/linux/netfilter/nf_conntrack_tftp.h +++ b/include/linux/netfilter/nf_conntrack_tftp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_TFTP_H  #define _NF_CONNTRACK_TFTP_H diff --git a/include/linux/netfilter/nf_conntrack_zones_common.h b/include/linux/netfilter/nf_conntrack_zones_common.h index 5d7cf36d4766..8f3905e12a64 100644 --- a/include/linux/netfilter/nf_conntrack_zones_common.h +++ b/include/linux/netfilter/nf_conntrack_zones_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_ZONES_COMMON_H  #define _NF_CONNTRACK_ZONES_COMMON_H diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 41d04e9d088a..495ba4dd9da5 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFNETLINK_H  #define _NFNETLINK_H @@ -66,7 +67,7 @@ static inline bool lockdep_nfnl_is_held(__u8 subsys_id)   * @ss: The nfnetlink subsystem ID   *   * Return the value of the specified RCU-protected pointer, but omit - * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because + * both the smp_read_barrier_depends() and the READ_ONCE(), because   * caller holds the NFNL subsystem mutex.   */  #define nfnl_dereference(p, ss)					\ diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h index 664da0048625..b4d741195c28 100644 --- a/include/linux/netfilter/nfnetlink_acct.h +++ b/include/linux/netfilter/nfnetlink_acct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFNL_ACCT_H_  #define _NFNL_ACCT_H_ diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index b3044c2c62cb..33f7530f96b9 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _X_TABLES_H  #define _X_TABLES_H diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h index 0fc458bde80b..169d03983589 100644 --- a/include/linux/netfilter/xt_hashlimit.h +++ b/include/linux/netfilter/xt_hashlimit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XT_HASHLIMIT_H  #define _XT_HASHLIMIT_H diff --git a/include/linux/netfilter/xt_physdev.h b/include/linux/netfilter/xt_physdev.h index 5b5e41716d69..4ca0593949cd 100644 --- a/include/linux/netfilter/xt_physdev.h +++ b/include/linux/netfilter/xt_physdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XT_PHYSDEV_H  #define _XT_PHYSDEV_H diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index 029b95e8924e..e98028f00e47 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * 	Format of an ARP firewall descriptor   * diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h index 2ed40c402b5e..b671fdfd212b 100644 --- a/include/linux/netfilter_bridge.h +++ b/include/linux/netfilter_bridge.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BRIDGE_NETFILTER_H  #define __LINUX_BRIDGE_NETFILTER_H diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h index e17e8bfb4e8b..c6147f9c0d80 100644 --- a/include/linux/netfilter_bridge/ebt_802_3.h +++ b/include/linux/netfilter_bridge/ebt_802_3.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BRIDGE_EBT_802_3_H  #define __LINUX_BRIDGE_EBT_802_3_H diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h index 2c2a5514b0df..0773b5a032f1 100644 --- a/include/linux/netfilter_bridge/ebtables.h +++ b/include/linux/netfilter_bridge/ebtables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  ebtables   * @@ -108,9 +109,10 @@ struct ebt_table {  #define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \  		     ~(__alignof__(struct _xt_align)-1)) -extern struct ebt_table *ebt_register_table(struct net *net, -					    const struct ebt_table *table, -					    const struct nf_hook_ops *); +extern int ebt_register_table(struct net *net, +			      const struct ebt_table *table, +			      const struct nf_hook_ops *ops, +			      struct ebt_table **res);  extern void ebt_unregister_table(struct net *net, struct ebt_table *table,  				 const struct nf_hook_ops *);  extern unsigned int ebt_do_table(struct sk_buff *skb, diff --git a/include/linux/netfilter_defs.h b/include/linux/netfilter_defs.h index d3a7f8597e82..dc6111adea06 100644 --- a/include/linux/netfilter_defs.h +++ b/include/linux/netfilter_defs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_NETFILTER_CORE_H_  #define __LINUX_NETFILTER_CORE_H_ diff --git a/include/linux/netfilter_ingress.h b/include/linux/netfilter_ingress.h index 8d5dae1e2ff8..554c920691dd 100644 --- a/include/linux/netfilter_ingress.h +++ b/include/linux/netfilter_ingress.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NETFILTER_INGRESS_H_  #define _NETFILTER_INGRESS_H_ diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index 7bfc5893ec31..d026e63a5aa4 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * 25-Jul-1998 Major changes to allow for ip chain table   * diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index b21c392d6012..99cbfd3add40 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * 25-Jul-1998 Major changes to allow for ip chain table   * diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 8664fd26eb5d..49b4257ce1ea 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_NETLINK_H  #define __LINUX_NETLINK_H @@ -16,9 +17,6 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)  }  enum netlink_skb_flags { -	NETLINK_SKB_MMAPED	= 0x1,	/* Packet data is mmaped */ -	NETLINK_SKB_TX		= 0x2,	/* Packet was sent by userspace */ -	NETLINK_SKB_DELIVERED	= 0x4,	/* Packet was delivered */  	NETLINK_SKB_DST		= 0x8,	/* Dst set in sendto or sendmsg */  }; diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 27c0aaa22cb0..67662d01130a 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common code for low-level network console, dump, and debugger code   * diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 610af5155ef2..0dc7ad38a0da 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * NFS protocol definitions   * diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h index a778ad8e3afd..404b8f724fc9 100644 --- a/include/linux/nfs3.h +++ b/include/linux/nfs3.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * NFSv3 protocol definitions   */ diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 47239c336688..47adac640191 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  include/linux/nfs4.h   * diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index a0282ceaa48b..38187c68063d 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  linux/include/linux/nfs_fs.h   * @@ -22,6 +23,7 @@  #include <linux/mm.h>  #include <linux/pagemap.h>  #include <linux/rbtree.h> +#include <linux/refcount.h>  #include <linux/rwsem.h>  #include <linux/wait.h> @@ -55,7 +57,7 @@ struct nfs_access_entry {  };  struct nfs_lock_context { -	atomic_t count; +	refcount_t count;  	struct list_head list;  	struct nfs_open_context *open_context;  	fl_owner_t lockowner; @@ -184,6 +186,16 @@ struct nfs_inode {  };  /* + * Access bit flags + */ +#define NFS_ACCESS_READ        0x0001 +#define NFS_ACCESS_LOOKUP      0x0002 +#define NFS_ACCESS_MODIFY      0x0004 +#define NFS_ACCESS_EXTEND      0x0008 +#define NFS_ACCESS_DELETE      0x0010 +#define NFS_ACCESS_EXECUTE     0x0020 + +/*   * Cache validity bit flags   */  #define NFS_INO_INVALID_ATTR	0x0001		/* cached attrs are invalid */ diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index a5c50d97341e..98f9268fcfc2 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFS_FS_I  #define _NFS_FS_I diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 74c44665e6d3..4e735be53e70 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFS_FS_SB  #define _NFS_FS_SB @@ -9,6 +10,7 @@  #include <linux/sunrpc/xprt.h>  #include <linux/atomic.h> +#include <linux/refcount.h>  struct nfs4_session;  struct nfs_iostats; @@ -24,7 +26,7 @@ struct nfs41_impl_id;   * The nfs_client identifies our client state to the server.   */  struct nfs_client { -	atomic_t		cl_count; +	refcount_t		cl_count;  	atomic_t		cl_mds_count;  	int			cl_cons_state;	/* current construction state (-ve: init error) */  #define NFS_CS_READY		0		/* ready to be used */ diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h index 9dcbbe9a51fb..027874c36c88 100644 --- a/include/linux/nfs_iostat.h +++ b/include/linux/nfs_iostat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  User-space visible declarations for NFS client per-mount   *  point statistics diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index d117120c9b6e..e27572d30d97 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/nfs_page.h   * diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 164d5359d4ab..6959968dc36a 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_NFS_XDR_H  #define _LINUX_NFS_XDR_H diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h index 5e69e67b31ab..103d44695323 100644 --- a/include/linux/nfsacl.h +++ b/include/linux/nfsacl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * File: linux/nfsacl.h   * diff --git a/include/linux/nls.h b/include/linux/nls.h index 520681b68208..499e486b3722 100644 --- a/include/linux/nls.h +++ b/include/linux/nls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_NLS_H  #define _LINUX_NLS_H diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 27e249ed7c5c..b8d868d23e79 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  linux/include/linux/nmi.h   */ diff --git a/include/linux/node.h b/include/linux/node.h index d1751beb462c..4ece0fee0ffc 100644 --- a/include/linux/node.h +++ b/include/linux/node.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/node.h - generic node definition   * diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index cf0b91c3ec12..1fbde8a880d9 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_NODEMASK_H  #define __LINUX_NODEMASK_H @@ -103,7 +104,16 @@ extern nodemask_t _unused_nodemask_arg_;   *   * Can be used to provide arguments for '%*pb[l]' when printing a nodemask.   */ -#define nodemask_pr_args(maskp)		MAX_NUMNODES, (maskp)->bits +#define nodemask_pr_args(maskp)	__nodemask_pr_numnodes(maskp), \ +				__nodemask_pr_bits(maskp) +static inline unsigned int __nodemask_pr_numnodes(const nodemask_t *m) +{ +	return m ? MAX_NUMNODES : 0; +} +static inline const unsigned long *__nodemask_pr_bits(const nodemask_t *m) +{ +	return m ? m->bits : NULL; +}  /*   * The inline keyword gives the compiler room to decide to inline, or diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 4149868de4e6..6d731110e0db 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Routines to manage notifier chains for passing status changes to any   *	interested routines. We need this instead of hard coded call lists so diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h index 85a5c8c16be9..5fbc4000358f 100644 --- a/include/linux/ns_common.h +++ b/include/linux/ns_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_NS_COMMON_H  #define _LINUX_NS_COMMON_H diff --git a/include/linux/nsc_gpio.h b/include/linux/nsc_gpio.h index 7da0cf3702ee..d7a04a6e3783 100644 --- a/include/linux/nsc_gpio.h +++ b/include/linux/nsc_gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /**     nsc_gpio.c diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index ac0d65bef5d0..2ae1b1a4d84d 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_NSPROXY_H  #define _LINUX_NSPROXY_H diff --git a/include/linux/ntb.h b/include/linux/ntb.h index 609e232c00da..c308964777eb 100644 --- a/include/linux/ntb.h +++ b/include/linux/ntb.h @@ -70,6 +70,7 @@ struct pci_dev;   * @NTB_TOPO_SEC:	On secondary side of remote ntb.   * @NTB_TOPO_B2B_USD:	On primary side of local ntb upstream of remote ntb.   * @NTB_TOPO_B2B_DSD:	On primary side of local ntb downstream of remote ntb. + * @NTB_TOPO_SWITCH:	Connected via a switch which supports ntb.   */  enum ntb_topo {  	NTB_TOPO_NONE = -1, @@ -77,6 +78,7 @@ enum ntb_topo {  	NTB_TOPO_SEC,  	NTB_TOPO_B2B_USD,  	NTB_TOPO_B2B_DSD, +	NTB_TOPO_SWITCH,  };  static inline int ntb_topo_is_b2b(enum ntb_topo topo) @@ -97,6 +99,7 @@ static inline char *ntb_topo_string(enum ntb_topo topo)  	case NTB_TOPO_SEC:	return "NTB_TOPO_SEC";  	case NTB_TOPO_B2B_USD:	return "NTB_TOPO_B2B_USD";  	case NTB_TOPO_B2B_DSD:	return "NTB_TOPO_B2B_DSD"; +	case NTB_TOPO_SWITCH:	return "NTB_TOPO_SWITCH";  	}  	return "NTB_TOPO_INVALID";  } @@ -730,7 +733,8 @@ static inline int ntb_link_disable(struct ntb_dev *ntb)   * Hardware and topology may support a different number of memory windows.   * Moreover different peer devices can support different number of memory   * windows. Simply speaking this method returns the number of possible inbound - * memory windows to share with specified peer device. + * memory windows to share with specified peer device. Note: this may return + * zero if the link is not up yet.   *   * Return: the number of memory windows.   */ @@ -751,7 +755,7 @@ static inline int ntb_mw_count(struct ntb_dev *ntb, int pidx)   * Get the alignments of an inbound memory window with specified index.   * NULL may be given for any output parameter if the value is not needed.   * The alignment and size parameters may be used for allocation of proper - * shared memory. + * shared memory. Note: this must only be called when the link is up.   *   * Return: Zero on success, otherwise a negative error number.   */ @@ -760,6 +764,9 @@ static inline int ntb_mw_get_align(struct ntb_dev *ntb, int pidx, int widx,  				   resource_size_t *size_align,  				   resource_size_t *size_max)  { +	if (!(ntb_link_is_up(ntb, NULL, NULL) & (1 << pidx))) +		return -ENOTCONN; +  	return ntb->ops->mw_get_align(ntb, pidx, widx, addr_align, size_align,  				      size_max);  } diff --git a/include/linux/nubus.h b/include/linux/nubus.h index 6165b2c62040..11ce6b1117a8 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*    nubus.h: various definitions and prototypes for NuBus drivers to use. diff --git a/include/linux/numa.h b/include/linux/numa.h index 3aaa31603a86..110b0e5d0fb0 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_NUMA_H  #define _LINUX_NUMA_H diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h index a726f96010d5..496ff759f84c 100644 --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h @@ -40,6 +40,8 @@   * @node_name: FC WWNN for the port   * @port_name: FC WWPN for the port   * @port_role: What NVME roles are supported (see FC_PORT_ROLE_xxx) + * @dev_loss_tmo: maximum delay for reconnects to an association on + *             this device. Used only on a remoteport.   *   * Initialization values for dynamic port fields:   * @port_id:      FC N_Port_ID currently assigned the port. Upper 8 bits must @@ -50,6 +52,7 @@ struct nvme_fc_port_info {  	u64			port_name;  	u32			port_role;  	u32			port_id; +	u32			dev_loss_tmo;  }; @@ -102,8 +105,6 @@ enum nvmefc_fcp_datadir {  }; -#define NVME_FC_MAX_SEGMENTS		256 -  /**   * struct nvmefc_fcp_req - Request structure passed from NVME-FC transport   *                         to LLDD in order to perform a NVME FCP IO operation. @@ -202,6 +203,9 @@ enum nvme_fc_obj_state {   *             The length of the buffer corresponds to the local_priv_sz   *             value specified in the nvme_fc_port_template supplied by   *             the LLDD. + * @dev_loss_tmo: maximum delay for reconnects to an association on + *             this device. To modify, lldd must call + *             nvme_fc_set_remoteport_devloss().   *   * Fields with dynamic values. Values may change base on link state. LLDD   * may reference fields directly to change them. Initialized by the @@ -259,10 +263,9 @@ struct nvme_fc_remote_port {  	u32 port_role;  	u64 node_name;  	u64 port_name; -  	struct nvme_fc_local_port *localport; -  	void *private; +	u32 dev_loss_tmo;  	/* dynamic fields */  	u32 port_id; @@ -446,6 +449,10 @@ int nvme_fc_register_remoteport(struct nvme_fc_local_port *localport,  int nvme_fc_unregister_remoteport(struct nvme_fc_remote_port *remoteport); +void nvme_fc_rescan_remoteport(struct nvme_fc_remote_port *remoteport); + +int nvme_fc_set_remoteport_devloss(struct nvme_fc_remote_port *remoteport, +			u32 dev_loss_tmo);  /* diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 9310ce77d8e1..aea87f0d917b 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -90,6 +90,14 @@ enum {  };  #define NVME_AQ_DEPTH		32 +#define NVME_NR_AEN_COMMANDS	1 +#define NVME_AQ_BLK_MQ_DEPTH	(NVME_AQ_DEPTH - NVME_NR_AEN_COMMANDS) + +/* + * Subtract one to leave an empty queue entry for 'Full Queue' condition. See + * NVM-Express 1.2 specification, section 4.1.2. + */ +#define NVME_AQ_MQ_TAG_DEPTH	(NVME_AQ_BLK_MQ_DEPTH - 1)  enum {  	NVME_REG_CAP	= 0x0000,	/* Controller Capabilities */ @@ -267,6 +275,7 @@ enum {  	NVME_CTRL_OACS_SEC_SUPP                 = 1 << 0,  	NVME_CTRL_OACS_DIRECTIVES		= 1 << 5,  	NVME_CTRL_OACS_DBBUF_SUPP		= 1 << 8, +	NVME_CTRL_LPA_CMD_EFFECTS_LOG		= 1 << 1,  };  struct nvme_lbaf { @@ -396,6 +405,21 @@ struct nvme_fw_slot_info_log {  };  enum { +	NVME_CMD_EFFECTS_CSUPP		= 1 << 0, +	NVME_CMD_EFFECTS_LBCC		= 1 << 1, +	NVME_CMD_EFFECTS_NCC		= 1 << 2, +	NVME_CMD_EFFECTS_NIC		= 1 << 3, +	NVME_CMD_EFFECTS_CCC		= 1 << 4, +	NVME_CMD_EFFECTS_CSE_MASK	= 3 << 16, +}; + +struct nvme_effects_log { +	__le32 acs[256]; +	__le32 iocs[256]; +	__u8   resv[2048]; +}; + +enum {  	NVME_SMART_CRIT_SPARE		= 1 << 0,  	NVME_SMART_CRIT_TEMPERATURE	= 1 << 1,  	NVME_SMART_CRIT_RELIABILITY	= 1 << 2, @@ -404,6 +428,10 @@ enum {  };  enum { +	NVME_AER_ERROR			= 0, +	NVME_AER_SMART			= 1, +	NVME_AER_CSS			= 6, +	NVME_AER_VS			= 7,  	NVME_AER_NOTICE_NS_CHANGED	= 0x0002,  	NVME_AER_NOTICE_FW_ACT_STARTING = 0x0102,  }; @@ -681,6 +709,7 @@ enum nvme_admin_opcode {  	nvme_admin_format_nvm		= 0x80,  	nvme_admin_security_send	= 0x81,  	nvme_admin_security_recv	= 0x82, +	nvme_admin_sanitize_nvm		= 0x84,  };  enum { @@ -712,6 +741,7 @@ enum {  	NVME_LOG_ERROR		= 0x01,  	NVME_LOG_SMART		= 0x02,  	NVME_LOG_FW_SLOT	= 0x03, +	NVME_LOG_CMD_EFFECTS	= 0x05,  	NVME_LOG_DISC		= 0x70,  	NVME_LOG_RESERVATION	= 0x80,  	NVME_FWACT_REPL		= (0 << 3), diff --git a/include/linux/nvram.h b/include/linux/nvram.h index cf0ff555a6ac..28bfb9ab94ca 100644 --- a/include/linux/nvram.h +++ b/include/linux/nvram.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_NVRAM_H  #define _LINUX_NVRAM_H diff --git a/include/linux/of.h b/include/linux/of.h index cfc34117fc92..d3dea1d1e3a9 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -37,9 +37,15 @@ struct property {  	int	length;  	void	*value;  	struct property *next; +#if defined(CONFIG_OF_DYNAMIC) || defined(CONFIG_SPARC)  	unsigned long _flags; +#endif +#if defined(CONFIG_OF_PROMTREE)  	unsigned int unique_id; +#endif +#if defined(CONFIG_OF_KOBJ)  	struct bin_attribute attr; +#endif  };  #if defined(CONFIG_SPARC) @@ -58,7 +64,9 @@ struct device_node {  	struct	device_node *parent;  	struct	device_node *child;  	struct	device_node *sibling; +#if defined(CONFIG_OF_KOBJ)  	struct	kobject kobj; +#endif  	unsigned long _flags;  	void	*data;  #if defined(CONFIG_SPARC) @@ -103,21 +111,17 @@ extern struct kobj_type of_node_ktype;  extern const struct fwnode_operations of_fwnode_ops;  static inline void of_node_init(struct device_node *node)  { +#if defined(CONFIG_OF_KOBJ)  	kobject_init(&node->kobj, &of_node_ktype); +#endif  	node->fwnode.ops = &of_fwnode_ops;  } -/* true when node is initialized */ -static inline int of_node_is_initialized(struct device_node *node) -{ -	return node && node->kobj.state_initialized; -} - -/* true when node is attached (i.e. present on sysfs) */ -static inline int of_node_is_attached(struct device_node *node) -{ -	return node && node->kobj.state_in_sysfs; -} +#if defined(CONFIG_OF_KOBJ) +#define of_node_kobj(n) (&(n)->kobj) +#else +#define of_node_kobj(n) NULL +#endif  #ifdef CONFIG_OF_DYNAMIC  extern struct device_node *of_node_get(struct device_node *node); @@ -203,6 +207,7 @@ static inline void of_node_clear_flag(struct device_node *n, unsigned long flag)  	clear_bit(flag, &n->_flags);  } +#if defined(CONFIG_OF_DYNAMIC) || defined(CONFIG_SPARC)  static inline int of_property_check_flag(struct property *p, unsigned long flag)  {  	return test_bit(flag, &p->_flags); @@ -217,6 +222,7 @@ static inline void of_property_clear_flag(struct property *p, unsigned long flag  {  	clear_bit(flag, &p->_flags);  } +#endif  extern struct device_node *__of_find_all_nodes(struct device_node *prev);  extern struct device_node *of_find_all_nodes(struct device_node *prev); @@ -675,12 +681,6 @@ static inline int of_property_count_elems_of_size(const struct device_node *np,  	return -ENOSYS;  } -static inline int of_property_read_u32_index(const struct device_node *np, -			const char *propname, u32 index, u32 *out_value) -{ -	return -ENOSYS; -} -  static inline int of_property_read_u8_array(const struct device_node *np,  			const char *propname, u8 *out_values, size_t sz)  { @@ -707,16 +707,14 @@ static inline int of_property_read_u64_array(const struct device_node *np,  	return -ENOSYS;  } -static inline int of_property_read_string(const struct device_node *np, -					  const char *propname, -					  const char **out_string) +static inline int of_property_read_u32_index(const struct device_node *np, +			const char *propname, u32 index, u32 *out_value)  {  	return -ENOSYS;  } -static inline int of_property_read_string_helper(const struct device_node *np, -						 const char *propname, -						 const char **out_strs, size_t sz, int index) +static inline int of_property_read_u64_index(const struct device_node *np, +			const char *propname, u32 index, u64 *out_value)  {  	return -ENOSYS;  } @@ -734,12 +732,61 @@ static inline struct device_node *of_get_cpu_node(int cpu,  	return NULL;  } +static inline int of_n_addr_cells(struct device_node *np) +{ +	return 0; + +} +static inline int of_n_size_cells(struct device_node *np) +{ +	return 0; +} + +static inline int of_property_read_variable_u8_array(const struct device_node *np, +					const char *propname, u8 *out_values, +					size_t sz_min, size_t sz_max) +{ +	return -ENOSYS; +} + +static inline int of_property_read_variable_u16_array(const struct device_node *np, +					const char *propname, u16 *out_values, +					size_t sz_min, size_t sz_max) +{ +	return -ENOSYS; +} + +static inline int of_property_read_variable_u32_array(const struct device_node *np, +					const char *propname, +					u32 *out_values, +					size_t sz_min, +					size_t sz_max) +{ +	return -ENOSYS; +} +  static inline int of_property_read_u64(const struct device_node *np,  				       const char *propname, u64 *out_value)  {  	return -ENOSYS;  } +static inline int of_property_read_variable_u64_array(const struct device_node *np, +					const char *propname, +					u64 *out_values, +					size_t sz_min, +					size_t sz_max) +{ +	return -ENOSYS; +} + +static inline int of_property_read_string(const struct device_node *np, +					  const char *propname, +					  const char **out_string) +{ +	return -ENOSYS; +} +  static inline int of_property_match_string(const struct device_node *np,  					   const char *propname,  					   const char *string) @@ -747,6 +794,13 @@ static inline int of_property_match_string(const struct device_node *np,  	return -ENOSYS;  } +static inline int of_property_read_string_helper(const struct device_node *np, +						 const char *propname, +						 const char **out_strs, size_t sz, int index) +{ +	return -ENOSYS; +} +  static inline struct device_node *of_parse_phandle(const struct device_node *np,  						   const char *phandle_name,  						   int index) @@ -1273,9 +1327,6 @@ static inline int of_reconfig_get_state_change(unsigned long action,  }  #endif /* CONFIG_OF_DYNAMIC */ -/* CONFIG_OF_RESOLVE api */ -extern int of_resolve_phandles(struct device_node *tree); -  /**   * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node   * @np: Pointer to the given device_node @@ -1292,7 +1343,7 @@ static inline bool of_device_is_system_power_controller(const struct device_node   */  enum of_overlay_notify_action { -	OF_OVERLAY_PRE_APPLY, +	OF_OVERLAY_PRE_APPLY = 0,  	OF_OVERLAY_POST_APPLY,  	OF_OVERLAY_PRE_REMOVE,  	OF_OVERLAY_POST_REMOVE, @@ -1306,26 +1357,26 @@ struct of_overlay_notify_data {  #ifdef CONFIG_OF_OVERLAY  /* ID based overlays; the API for external users */ -int of_overlay_create(struct device_node *tree); -int of_overlay_destroy(int id); -int of_overlay_destroy_all(void); +int of_overlay_apply(struct device_node *tree, int *ovcs_id); +int of_overlay_remove(int *ovcs_id); +int of_overlay_remove_all(void);  int of_overlay_notifier_register(struct notifier_block *nb);  int of_overlay_notifier_unregister(struct notifier_block *nb);  #else -static inline int of_overlay_create(struct device_node *tree) +static inline int of_overlay_apply(struct device_node *tree, int *ovcs_id)  {  	return -ENOTSUPP;  } -static inline int of_overlay_destroy(int id) +static inline int of_overlay_remove(int *ovcs_id)  {  	return -ENOTSUPP;  } -static inline int of_overlay_destroy_all(void) +static inline int of_overlay_remove_all(void)  {  	return -ENOTSUPP;  } diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 37864734ca50..30e40fb6936b 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __OF_ADDRESS_H  #define __OF_ADDRESS_H  #include <linux/ioport.h> @@ -49,6 +50,8 @@ extern const __be32 *of_get_address(struct device_node *dev, int index,  extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,  			struct device_node *node); +extern int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, +			struct device_node *node);  extern struct of_pci_range *of_pci_range_parser_one(  					struct of_pci_range_parser *parser,  					struct of_pci_range *range); @@ -85,7 +88,13 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,  static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,  			struct device_node *node)  { -	return -1; +	return -ENOSYS; +} + +static inline int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, +			struct device_node *node) +{ +	return -ENOSYS;  }  static inline struct of_pci_range *of_pci_range_parser_one( diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 611502524425..8da5a1b31ece 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_OF_DEVICE_H  #define _LINUX_OF_DEVICE_H diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index ca10f43564de..1fe205582111 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h @@ -31,7 +31,7 @@ enum of_gpio_flags {  	OF_GPIO_ACTIVE_LOW = 0x1,  	OF_GPIO_SINGLE_ENDED = 0x2,  	OF_GPIO_OPEN_DRAIN = 0x4, -	OF_GPIO_SLEEP_MAY_LOOSE_VALUE = 0x8, +	OF_GPIO_SLEEP_MAY_LOSE_VALUE = 0x8,  };  #ifdef CONFIG_OF_GPIO diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h index 13394ac83c66..cddfaff4d0b7 100644 --- a/include/linux/of_iommu.h +++ b/include/linux/of_iommu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __OF_IOMMU_H  #define __OF_IOMMU_H diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index 1e0deb8e8494..1214cabb2247 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __OF_IRQ_H  #define __OF_IRQ_H diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 518c8d20647a..bf588a05d0d0 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __OF_PCI_H  #define __OF_PCI_H diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index f8e1992d6423..67ab8d271df3 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __OF_RESERVED_MEM_H  #define __OF_RESERVED_MEM_H @@ -44,6 +45,7 @@ int early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,  void fdt_init_reserved_mem(void);  void fdt_reserved_mem_save_node(unsigned long node, const char *uname,  			       phys_addr_t base, phys_addr_t size); +struct reserved_mem *of_reserved_mem_lookup(struct device_node *np);  #else  static inline int of_reserved_mem_device_init_by_idx(struct device *dev,  					struct device_node *np, int idx) @@ -55,6 +57,10 @@ static inline void of_reserved_mem_device_release(struct device *pdev) { }  static inline void fdt_init_reserved_mem(void) { }  static inline void fdt_reserved_mem_save_node(unsigned long node,  		const char *uname, phys_addr_t base, phys_addr_t size) { } +static inline struct reserved_mem *of_reserved_mem_lookup(struct device_node *np) +{ +	return NULL; +}  #endif  /** diff --git a/include/linux/olpc-ec.h b/include/linux/olpc-ec.h index 2925df3ce78a..79bdc6328c52 100644 --- a/include/linux/olpc-ec.h +++ b/include/linux/olpc-ec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_OLPC_EC_H  #define _LINUX_OLPC_EC_H diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h index 290081620b3e..840ce551e773 100644 --- a/include/linux/omap-dma.h +++ b/include/linux/omap-dma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_OMAP_DMA_H  #define __LINUX_OMAP_DMA_H  #include <linux/omap-dmaengine.h> diff --git a/include/linux/omap-gpmc.h b/include/linux/omap-gpmc.h index fd0de00c0d77..edfa280c3d56 100644 --- a/include/linux/omap-gpmc.h +++ b/include/linux/omap-gpmc.h @@ -36,18 +36,6 @@ static inline struct gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs  }  #endif /* CONFIG_OMAP_GPMC */ -/*--------------------------------*/ - -/* deprecated APIs */ -#if IS_ENABLED(CONFIG_OMAP_GPMC) -void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); -#else -static inline void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) -{ -} -#endif /* CONFIG_OMAP_GPMC */ -/*--------------------------------*/ -  extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,  			     struct gpmc_settings *gpmc_s,  			     struct gpmc_device_timings *dev_t); diff --git a/include/linux/once.h b/include/linux/once.h index 9c98aaa87cbc..9225ee6d96c7 100644 --- a/include/linux/once.h +++ b/include/linux/once.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_ONCE_H  #define _LINUX_ONCE_H @@ -5,7 +6,7 @@  #include <linux/jump_label.h>  bool __do_once_start(bool *done, unsigned long *flags); -void __do_once_done(bool *done, struct static_key *once_key, +void __do_once_done(bool *done, struct static_key_true *once_key,  		    unsigned long *flags);  /* Call a function exactly once. The idea of DO_ONCE() is to perform @@ -38,8 +39,8 @@ void __do_once_done(bool *done, struct static_key *once_key,  	({								     \  		bool ___ret = false;					     \  		static bool ___done = false;				     \ -		static struct static_key ___once_key = STATIC_KEY_INIT_TRUE; \ -		if (static_key_true(&___once_key)) {			     \ +		static DEFINE_STATIC_KEY_TRUE(___once_key);		     \ +		if (static_branch_unlikely(&___once_key)) {		     \  			unsigned long ___flags;				     \  			___ret = __do_once_start(&___done, &___flags);	     \  			if (unlikely(___ret)) {				     \ diff --git a/include/linux/oom.h b/include/linux/oom.h index 76aac4ce39bc..01c91d874a57 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __INCLUDE_LINUX_OOM_H  #define __INCLUDE_LINUX_OOM_H diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h index 703ea5c30a33..5581dbd3bd34 100644 --- a/include/linux/osq_lock.h +++ b/include/linux/osq_lock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_OSQ_LOCK_H  #define __LINUX_OSQ_LOCK_H diff --git a/include/linux/oxu210hp.h b/include/linux/oxu210hp.h index 0bf96eae5389..94cd25165c08 100644 --- a/include/linux/oxu210hp.h +++ b/include/linux/oxu210hp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* platform data for the OXU210HP HCD */  struct oxu210hp_platform_data { diff --git a/include/linux/padata.h b/include/linux/padata.h index 2f9c1f93b1ce..5d13d25da2c8 100644 --- a/include/linux/padata.h +++ b/include/linux/padata.h @@ -37,6 +37,7 @@   * @list: List entry, to attach to the padata lists.   * @pd: Pointer to the internal control structure.   * @cb_cpu: Callback cpu for serializatioon. + * @cpu: Cpu for parallelization.   * @seq_nr: Sequence number of the parallelized data object.   * @info: Used to pass information from the parallel to the serial function.   * @parallel: Parallel execution function. @@ -46,6 +47,7 @@ struct padata_priv {  	struct list_head	list;  	struct parallel_data	*pd;  	int			cb_cpu; +	int			cpu;  	int			info;  	void                    (*parallel)(struct padata_priv *padata);  	void                    (*serial)(struct padata_priv *padata); @@ -85,6 +87,7 @@ struct padata_serial_queue {   * @swork: work struct for serialization.   * @pd: Backpointer to the internal control structure.   * @work: work struct for parallelization. + * @reorder_work: work struct for reordering.   * @num_obj: Number of objects that are processed by this cpu.   * @cpu_index: Index of the cpu.   */ @@ -93,6 +96,7 @@ struct padata_parallel_queue {         struct padata_list    reorder;         struct parallel_data *pd;         struct work_struct    work; +       struct work_struct    reorder_work;         atomic_t              num_obj;         int                   cpu_index;  }; diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h index 77b078c103b2..7ec86bf31ce4 100644 --- a/include/linux/page-flags-layout.h +++ b/include/linux/page-flags-layout.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef PAGE_FLAGS_LAYOUT_H  #define PAGE_FLAGS_LAYOUT_H diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index ba2d470d2d0a..3ec44e27aa9d 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Macros for manipulating and testing page->flags   */ @@ -17,7 +18,7 @@   * Various page->flags bits:   *   * PG_reserved is set for special pages, which can never be swapped out. Some - * of them might not even exist (eg empty_bad_page)... + * of them might not even exist...   *   * The PG_private bitflag is set on pagecache pages if they contain filesystem   * specific data (which is normally at page->private). It can be used by diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index d4cd2014fa6f..cdad58bbfd8b 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PAGEISOLATION_H  #define __LINUX_PAGEISOLATION_H @@ -30,7 +31,7 @@ static inline bool is_migrate_isolate(int migratetype)  #endif  bool has_unmovable_pages(struct zone *zone, struct page *page, int count, -			 bool skip_hwpoisoned_pages); +			 int migratetype, bool skip_hwpoisoned_pages);  void set_pageblock_migratetype(struct page *page, int migratetype);  int move_freepages_block(struct zone *zone, struct page *page,  				int migratetype, int *num_movable); diff --git a/include/linux/page_counter.h b/include/linux/page_counter.h index 7e62920a3a94..c15ab80ad32d 100644 --- a/include/linux/page_counter.h +++ b/include/linux/page_counter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PAGE_COUNTER_H  #define _LINUX_PAGE_COUNTER_H diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h index 9298c393ddaa..ca5461efae2f 100644 --- a/include/linux/page_ext.h +++ b/include/linux/page_ext.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PAGE_EXT_H  #define __LINUX_PAGE_EXT_H diff --git a/include/linux/page_idle.h b/include/linux/page_idle.h index fec40271339f..1e894d34bdce 100644 --- a/include/linux/page_idle.h +++ b/include/linux/page_idle.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MM_PAGE_IDLE_H  #define _LINUX_MM_PAGE_IDLE_H diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h index 2be728d156b5..8679ccd722e8 100644 --- a/include/linux/page_owner.h +++ b/include/linux/page_owner.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PAGE_OWNER_H  #define __LINUX_PAGE_OWNER_H diff --git a/include/linux/page_ref.h b/include/linux/page_ref.h index 1fd71733aa68..760d74a0e9a9 100644 --- a/include/linux/page_ref.h +++ b/include/linux/page_ref.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PAGE_REF_H  #define _LINUX_PAGE_REF_H diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h index e942558b3585..9132c5cb41f1 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h @@ -96,6 +96,17 @@ void set_pfnblock_flags_mask(struct page *page,  #define set_pageblock_skip(page) \  			set_pageblock_flags_group(page, 1, PB_migrate_skip,  \  							PB_migrate_skip) +#else +static inline bool get_pageblock_skip(struct page *page) +{ +	return false; +} +static inline void clear_pageblock_skip(struct page *page) +{ +} +static inline void set_pageblock_skip(struct page *page) +{ +}  #endif /* CONFIG_COMPACTION */  #endif	/* PAGEBLOCK_FLAGS_H */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 5bbd6780f205..34ce3ebf97d5 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PAGEMAP_H  #define _LINUX_PAGEMAP_H @@ -15,6 +16,8 @@  #include <linux/hardirq.h> /* for in_interrupt() */  #include <linux/hugetlb_inline.h> +struct pagevec; +  /*   * Bits in mapping->flags.   */ @@ -115,7 +118,7 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)  	m->gfp_mask = mask;  } -void release_pages(struct page **pages, int nr, bool cold); +void release_pages(struct page **pages, int nr);  /*   * speculatively take a reference to a page. @@ -231,15 +234,9 @@ static inline struct page *page_cache_alloc(struct address_space *x)  	return __page_cache_alloc(mapping_gfp_mask(x));  } -static inline struct page *page_cache_alloc_cold(struct address_space *x) -{ -	return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD); -} -  static inline gfp_t readahead_gfp_mask(struct address_space *x)  { -	return mapping_gfp_mask(x) | -				  __GFP_COLD | __GFP_NORETRY | __GFP_NOWARN; +	return mapping_gfp_mask(x) | __GFP_NORETRY | __GFP_NOWARN;  }  typedef int filler_t(void *, struct page *); @@ -365,8 +362,16 @@ static inline unsigned find_get_pages(struct address_space *mapping,  }  unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,  			       unsigned int nr_pages, struct page **pages); -unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index, -			int tag, unsigned int nr_pages, struct page **pages); +unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index, +			pgoff_t end, int tag, unsigned int nr_pages, +			struct page **pages); +static inline unsigned find_get_pages_tag(struct address_space *mapping, +			pgoff_t *index, int tag, unsigned int nr_pages, +			struct page **pages) +{ +	return find_get_pages_range_tag(mapping, index, (pgoff_t)-1, tag, +					nr_pages, pages); +}  unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start,  			int tag, unsigned int nr_entries,  			struct page **entries, pgoff_t *indices); @@ -615,6 +620,8 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,  extern void delete_from_page_cache(struct page *page);  extern void __delete_from_page_cache(struct page *page, void *shadow);  int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask); +void delete_from_page_cache_batch(struct address_space *mapping, +				  struct pagevec *pvec);  /*   * Like add_to_page_cache_locked, but used to add newly allocated pages: diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index 4dcd5506f1ed..5fb6580f7f23 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/pagevec.h   * @@ -16,7 +17,7 @@ struct address_space;  struct pagevec {  	unsigned long nr; -	unsigned long cold; +	bool percpu_pvec_drained;  	struct page *pages[PAGEVEC_SIZE];  }; @@ -37,14 +38,22 @@ static inline unsigned pagevec_lookup(struct pagevec *pvec,  	return pagevec_lookup_range(pvec, mapping, start, (pgoff_t)-1);  } -unsigned pagevec_lookup_tag(struct pagevec *pvec, -		struct address_space *mapping, pgoff_t *index, int tag, -		unsigned nr_pages); +unsigned pagevec_lookup_range_tag(struct pagevec *pvec, +		struct address_space *mapping, pgoff_t *index, pgoff_t end, +		int tag); +unsigned pagevec_lookup_range_nr_tag(struct pagevec *pvec, +		struct address_space *mapping, pgoff_t *index, pgoff_t end, +		int tag, unsigned max_pages); +static inline unsigned pagevec_lookup_tag(struct pagevec *pvec, +		struct address_space *mapping, pgoff_t *index, int tag) +{ +	return pagevec_lookup_range_tag(pvec, mapping, index, (pgoff_t)-1, tag); +} -static inline void pagevec_init(struct pagevec *pvec, int cold) +static inline void pagevec_init(struct pagevec *pvec)  {  	pvec->nr = 0; -	pvec->cold = cold; +	pvec->percpu_pvec_drained = false;  }  static inline void pagevec_reinit(struct pagevec *pvec) diff --git a/include/linux/parport.h b/include/linux/parport.h index 58e3c64c6b49..397607a0c0eb 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -225,6 +225,7 @@ struct parport {  	struct pardevice *waittail;  	struct list_head list; +	struct timer_list timer;  	unsigned int flags;  	void *sysctl_table; diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h index cc1767f5cca8..3d6fc576d6a1 100644 --- a/include/linux/parport_pc.h +++ b/include/linux/parport_pc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PARPORT_PC_H  #define __LINUX_PARPORT_PC_H diff --git a/include/linux/parser.h b/include/linux/parser.h index 884c1e6eb3fe..12fc3482f5fc 100644 --- a/include/linux/parser.h +++ b/include/linux/parser.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/parser.h   * diff --git a/include/linux/patchkey.h b/include/linux/patchkey.h index 97a919fc9927..f581defb2df0 100644 --- a/include/linux/patchkey.h +++ b/include/linux/patchkey.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * <linux/patchkey.h> -- definition of _PATCHKEY macro   * diff --git a/include/linux/path.h b/include/linux/path.h index cde895cc4af4..475225a03d0d 100644 --- a/include/linux/path.h +++ b/include/linux/path.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PATH_H  #define _LINUX_PATH_H @@ -17,4 +18,10 @@ static inline int path_equal(const struct path *path1, const struct path *path2)  	return path1->mnt == path2->mnt && path1->dentry == path2->dentry;  } +static inline void path_put_init(struct path *path) +{ +	path_put(path); +	*path = (struct path) { }; +} +  #endif  /* _LINUX_PATH_H */ diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index dd86c97f2454..8082b612f561 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * File		pci-acpi.h   * diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h index 207c561fb40e..3cc06b059017 100644 --- a/include/linux/pci-aspm.h +++ b/include/linux/pci-aspm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	aspm.h   * diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h index 782fb8e0755f..7c4b8e27268c 100644 --- a/include/linux/pci-ats.h +++ b/include/linux/pci-ats.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_PCI_ATS_H  #define LINUX_PCI_ATS_H diff --git a/include/linux/pci-dma-compat.h b/include/linux/pci-dma-compat.h index 39726caef5b1..d1f9fdade1e0 100644 --- a/include/linux/pci-dma-compat.h +++ b/include/linux/pci-dma-compat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* include this file if the platform implements the dma_ DMA Mapping API   * and wants to provide the pci_ DMA Mapping API in terms of it */ diff --git a/include/linux/pci-dma.h b/include/linux/pci-dma.h index 549a041f9c08..0f7aa7353ca3 100644 --- a/include/linux/pci-dma.h +++ b/include/linux/pci-dma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PCI_DMA_H  #define _LINUX_PCI_DMA_H diff --git a/include/linux/pci.h b/include/linux/pci.h index f4f8ee5a7362..0403894147a3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	pci.h   * @@ -205,13 +206,8 @@ enum pci_dev_flags {  	PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9),  	/* Do not use FLR even if device advertises PCI_AF_CAP */  	PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), -	/* -	 * Resume before calling the driver's system suspend hooks, disabling -	 * the direct_complete optimization. -	 */ -	PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11),  	/* Don't use Relaxed Ordering for TLPs directed at this device */ -	PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 12), +	PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11),  };  enum pci_irq_reroute_variant { @@ -596,6 +592,10 @@ static inline bool pci_is_bridge(struct pci_dev *dev)  		dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;  } +#define for_each_pci_bridge(dev, bus)				\ +	list_for_each_entry(dev, &bus->devices, bus_list)	\ +		if (!pci_is_bridge(dev)) {} else +  static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)  {  	dev = pci_physfn(dev); @@ -1089,7 +1089,6 @@ int pcie_set_mps(struct pci_dev *dev, int mps);  int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,  			  enum pcie_link_width *width);  void pcie_flr(struct pci_dev *dev); -int __pci_reset_function(struct pci_dev *dev);  int __pci_reset_function_locked(struct pci_dev *dev);  int pci_reset_function(struct pci_dev *dev);  int pci_reset_function_locked(struct pci_dev *dev); @@ -1106,6 +1105,8 @@ void pci_reset_bridge_secondary_bus(struct pci_dev *dev);  void pci_update_resource(struct pci_dev *dev, int resno);  int __must_check pci_assign_resource(struct pci_dev *dev, int i);  int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); +void pci_release_resource(struct pci_dev *dev, int resno); +int __must_check pci_resize_resource(struct pci_dev *dev, int i, int size);  int pci_select_bars(struct pci_dev *dev, unsigned long flags);  bool pci_device_is_present(struct pci_dev *pdev);  void pci_ignore_hotplug(struct pci_dev *dev); @@ -1185,6 +1186,7 @@ void pci_assign_unassigned_resources(void);  void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);  void pci_assign_unassigned_bus_resources(struct pci_bus *bus);  void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus); +int pci_reassign_bridge_resources(struct pci_dev *bridge, unsigned long type);  void pdev_enable_device(struct pci_dev *);  int pci_enable_resources(struct pci_dev *, int mask);  void pci_assign_irq(struct pci_dev *dev); @@ -1483,12 +1485,6 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }  static inline void pcie_ecrc_get_policy(char *str) { }  #endif -#ifdef CONFIG_HT_IRQ -/* The functions a driver should call */ -int  ht_create_irq(struct pci_dev *dev, int idx); -void ht_destroy_irq(unsigned int irq); -#endif /* CONFIG_HT_IRQ */ -  #ifdef CONFIG_PCI_ATS  /* Address Translation Service */  void pci_ats_init(struct pci_dev *dev); @@ -1958,8 +1954,8 @@ int pci_iov_virtfn_devfn(struct pci_dev *dev, int id);  int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);  void pci_disable_sriov(struct pci_dev *dev); -int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset); -void pci_iov_remove_virtfn(struct pci_dev *dev, int id, int reset); +int pci_iov_add_virtfn(struct pci_dev *dev, int id); +void pci_iov_remove_virtfn(struct pci_dev *dev, int id);  int pci_num_vf(struct pci_dev *dev);  int pci_vfs_assigned(struct pci_dev *dev);  int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); @@ -1976,12 +1972,12 @@ static inline int pci_iov_virtfn_devfn(struct pci_dev *dev, int id)  }  static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)  { return -ENODEV; } -static inline int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset) +static inline int pci_iov_add_virtfn(struct pci_dev *dev, int id)  {  	return -ENOSYS;  }  static inline void pci_iov_remove_virtfn(struct pci_dev *dev, -					 int id, int reset) { } +					 int id) { }  static inline void pci_disable_sriov(struct pci_dev *dev) { }  static inline int pci_num_vf(struct pci_dev *dev) { return 0; }  static inline int pci_vfs_assigned(struct pci_dev *dev) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 4adf6161ec77..ab20dc5db423 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	PCI Class, Vendor and Device IDs   * diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h index e8f3f7479224..b69769dbf659 100644 --- a/include/linux/pcieport_if.h +++ b/include/linux/pcieport_if.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * File:	pcieport_if.h   * Purpose:	PCI Express Port Bus Driver's IF Data Structure diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 8f16299ca068..2d2096ba1cfe 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -173,6 +173,21 @@  	DEFINE_PER_CPU_SECTION(type, name, "..read_mostly")  /* + * Declaration/definition used for per-CPU variables that should be accessed + * as decrypted when memory encryption is enabled in the guest. + */ +#if defined(CONFIG_VIRTUALIZATION) && defined(CONFIG_AMD_MEM_ENCRYPT) + +#define DECLARE_PER_CPU_DECRYPTED(type, name)				\ +	DECLARE_PER_CPU_SECTION(type, name, "..decrypted") + +#define DEFINE_PER_CPU_DECRYPTED(type, name)				\ +	DEFINE_PER_CPU_SECTION(type, name, "..decrypted") +#else +#define DEFINE_PER_CPU_DECRYPTED(type, name)	DEFINE_PER_CPU(type, name) +#endif + +/*   * Intermodule exports for per-CPU variables.  sparse forgets about   * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to   * noop if __CHECKER__. diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index c13dceb87b60..6658d9ee5257 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Percpu refcounts:   * (C) 2012 Google, Inc. diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h index 93664f022ecf..b1f37a89e368 100644 --- a/include/linux/percpu-rwsem.h +++ b/include/linux/percpu-rwsem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PERCPU_RWSEM_H  #define _LINUX_PERCPU_RWSEM_H diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 6a5fb939d3e5..296bbe49d5d1 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PERCPU_H  #define __LINUX_PERCPU_H diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index ec065387f443..73a7bf30fe9a 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PERCPU_COUNTER_H  #define _LINUX_PERCPU_COUNTER_H  /* diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h index f5cfdd6a5539..07d78e4653bc 100644 --- a/include/linux/percpu_ida.h +++ b/include/linux/percpu_ida.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __PERCPU_IDA_H__  #define __PERCPU_IDA_H__ diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 8e22f24ded6a..2c9c87d8a0c1 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -485,9 +485,9 @@ struct perf_addr_filters_head {  };  /** - * enum perf_event_active_state - the states of a event + * enum perf_event_state - the states of a event   */ -enum perf_event_active_state { +enum perf_event_state {  	PERF_EVENT_STATE_DEAD		= -4,  	PERF_EVENT_STATE_EXIT		= -3,  	PERF_EVENT_STATE_ERROR		= -2, @@ -578,7 +578,7 @@ struct perf_event {  	struct pmu			*pmu;  	void				*pmu_private; -	enum perf_event_active_state	state; +	enum perf_event_state		state;  	unsigned int			attach_state;  	local64_t			count;  	atomic64_t			child_count; @@ -588,26 +588,10 @@ struct perf_event {  	 * has been enabled (i.e. eligible to run, and the task has  	 * been scheduled in, if this is a per-task event)  	 * and running (scheduled onto the CPU), respectively. -	 * -	 * They are computed from tstamp_enabled, tstamp_running and -	 * tstamp_stopped when the event is in INACTIVE or ACTIVE state.  	 */  	u64				total_time_enabled;  	u64				total_time_running; - -	/* -	 * These are timestamps used for computing total_time_enabled -	 * and total_time_running when the event is in INACTIVE or -	 * ACTIVE state, measured in nanoseconds from an arbitrary point -	 * in time. -	 * tstamp_enabled: the notional time when the event was enabled -	 * tstamp_running: the notional time when the event was scheduled on -	 * tstamp_stopped: in INACTIVE state, the notional time when the -	 *	event was scheduled off. -	 */ -	u64				tstamp_enabled; -	u64				tstamp_running; -	u64				tstamp_stopped; +	u64				tstamp;  	/*  	 * timestamp shadows the actual context timing but it can @@ -699,7 +683,6 @@ struct perf_event {  #ifdef CONFIG_CGROUP_PERF  	struct perf_cgroup		*cgrp; /* cgroup event is attach to */ -	int				cgrp_defer_enabled;  #endif  	struct list_head		sb_list; @@ -806,6 +789,7 @@ struct perf_output_handle {  struct bpf_perf_event_data_kern {  	struct pt_regs *regs;  	struct perf_sample_data *data; +	struct perf_event *event;  };  #ifdef CONFIG_CGROUP_PERF @@ -884,7 +868,8 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr,  				void *context);  extern void perf_pmu_migrate_context(struct pmu *pmu,  				int src_cpu, int dst_cpu); -int perf_event_read_local(struct perf_event *event, u64 *value); +int perf_event_read_local(struct perf_event *event, u64 *value, +			  u64 *enabled, u64 *running);  extern u64 perf_event_read_value(struct perf_event *event,  				 u64 *enabled, u64 *running); @@ -1184,7 +1169,7 @@ extern void perf_event_init(void);  extern void perf_tp_event(u16 event_type, u64 count, void *record,  			  int entry_size, struct pt_regs *regs,  			  struct hlist_head *head, int rctx, -			  struct task_struct *task, struct perf_event *event); +			  struct task_struct *task);  extern void perf_bp_event(struct perf_event *event, void *data);  #ifndef perf_misc_flags @@ -1286,7 +1271,8 @@ static inline const struct perf_event_attr *perf_event_attrs(struct perf_event *  {  	return ERR_PTR(-EINVAL);  } -static inline int perf_event_read_local(struct perf_event *event, u64 *value) +static inline int perf_event_read_local(struct perf_event *event, u64 *value, +					u64 *enabled, u64 *running)  {  	return -EINVAL;  } diff --git a/include/linux/perf_regs.h b/include/linux/perf_regs.h index 9b7dd59fe28d..476747456bca 100644 --- a/include/linux/perf_regs.h +++ b/include/linux/perf_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PERF_REGS_H  #define _LINUX_PERF_REGS_H diff --git a/include/linux/personality.h b/include/linux/personality.h index aeb7892b2468..fc16fbc659c7 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PERSONALITY_H  #define _LINUX_PERSONALITY_H diff --git a/include/linux/pfn.h b/include/linux/pfn.h index 1132953235c0..14bc053c53d8 100644 --- a/include/linux/pfn.h +++ b/include/linux/pfn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PFN_H_  #define _LINUX_PFN_H_ diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h index a49b3259cad7..43b1d7648e82 100644 --- a/include/linux/pfn_t.h +++ b/include/linux/pfn_t.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PFN_T_H_  #define _LINUX_PFN_T_H_  #include <linux/mm.h> diff --git a/include/linux/phy.h b/include/linux/phy.h index d78cd01ea513..dc82a07cb4fd 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -451,6 +451,8 @@ struct phy_device {  	struct phy_led_trigger *phy_led_triggers;  	unsigned int phy_num_led_triggers;  	struct phy_led_trigger *last_triggered; + +	struct phy_led_trigger *led_link_trigger;  #endif  	/* diff --git a/include/linux/phy/phy-qcom-ufs.h b/include/linux/phy/phy-qcom-ufs.h index 35c070ea6ea3..0a2c18a9771d 100644 --- a/include/linux/phy/phy-qcom-ufs.h +++ b/include/linux/phy/phy-qcom-ufs.h @@ -31,10 +31,7 @@ void ufs_qcom_phy_enable_dev_ref_clk(struct phy *phy);   */  void ufs_qcom_phy_disable_dev_ref_clk(struct phy *phy); -int ufs_qcom_phy_start_serdes(struct phy *phy);  int ufs_qcom_phy_set_tx_lane_enable(struct phy *phy, u32 tx_lanes); -int ufs_qcom_phy_calibrate_phy(struct phy *phy, bool is_rate_B); -int ufs_qcom_phy_is_pcs_ready(struct phy *phy);  void ufs_qcom_phy_save_controller_version(struct phy *phy,  			u8 major, u16 minor, u16 step); diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index e694d4008c4a..4f8423a948d5 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -29,6 +29,8 @@ enum phy_mode {  	PHY_MODE_USB_OTG,  	PHY_MODE_SGMII,  	PHY_MODE_10GKR, +	PHY_MODE_UFS_HS_A, +	PHY_MODE_UFS_HS_B,  };  /** @@ -39,6 +41,7 @@ enum phy_mode {   * @power_off: powering off the phy   * @set_mode: set the mode of the phy   * @reset: resetting the phy + * @calibrate: calibrate the phy   * @owner: the module owner containing the ops   */  struct phy_ops { @@ -48,6 +51,7 @@ struct phy_ops {  	int	(*power_off)(struct phy *phy);  	int	(*set_mode)(struct phy *phy, enum phy_mode mode);  	int	(*reset)(struct phy *phy); +	int	(*calibrate)(struct phy *phy);  	struct module *owner;  }; @@ -141,6 +145,7 @@ int phy_power_on(struct phy *phy);  int phy_power_off(struct phy *phy);  int phy_set_mode(struct phy *phy, enum phy_mode mode);  int phy_reset(struct phy *phy); +int phy_calibrate(struct phy *phy);  static inline int phy_get_bus_width(struct phy *phy)  {  	return phy->attrs.bus_width; @@ -262,6 +267,13 @@ static inline int phy_reset(struct phy *phy)  	return -ENOSYS;  } +static inline int phy_calibrate(struct phy *phy) +{ +	if (!phy) +		return 0; +	return -ENOSYS; +} +  static inline int phy_get_bus_width(struct phy *phy)  {  	return -ENOSYS; @@ -291,7 +303,7 @@ static inline struct phy *devm_phy_get(struct device *dev, const char *string)  static inline struct phy *devm_phy_optional_get(struct device *dev,  						const char *string)  { -	return ERR_PTR(-ENOSYS); +	return NULL;  }  static inline struct phy *devm_of_phy_get(struct device *dev, diff --git a/include/linux/phy/ulpi_phy.h b/include/linux/phy/ulpi_phy.h index f2ebe490a4bc..7054b440347c 100644 --- a/include/linux/phy/ulpi_phy.h +++ b/include/linux/phy/ulpi_phy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <linux/phy/phy.h>  /** diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h index 1d41ec44e39d..cf6392de6eb0 100644 --- a/include/linux/phy_fixed.h +++ b/include/linux/phy_fixed.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __PHY_FIXED_H  #define __PHY_FIXED_H diff --git a/include/linux/pid.h b/include/linux/pid.h index 719582744a2e..7633d55d9a24 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PID_H  #define _LINUX_PID_H @@ -50,10 +51,8 @@ enum pid_type   */  struct upid { -	/* Try to keep pid_chain in the same cacheline as nr for find_vpid */  	int nr;  	struct pid_namespace *ns; -	struct hlist_node pid_chain;  };  struct pid diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index b09136f88cf4..49538b172483 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PID_NS_H  #define _LINUX_PID_NS_H @@ -9,15 +10,8 @@  #include <linux/nsproxy.h>  #include <linux/kref.h>  #include <linux/ns_common.h> +#include <linux/idr.h> -struct pidmap { -       atomic_t nr_free; -       void *page; -}; - -#define BITS_PER_PAGE		(PAGE_SIZE * 8) -#define BITS_PER_PAGE_MASK	(BITS_PER_PAGE-1) -#define PIDMAP_ENTRIES		((PID_MAX_LIMIT+BITS_PER_PAGE-1)/BITS_PER_PAGE)  struct fs_pin; @@ -29,10 +23,9 @@ enum { /* definitions for pid_namespace's hide_pid field */  struct pid_namespace {  	struct kref kref; -	struct pidmap pidmap[PIDMAP_ENTRIES]; +	struct idr idr;  	struct rcu_head rcu; -	int last_pid; -	unsigned int nr_hashed; +	unsigned int pid_allocated;  	struct task_struct *child_reaper;  	struct kmem_cache *pid_cachep;  	unsigned int level; @@ -56,7 +49,7 @@ struct pid_namespace {  extern struct pid_namespace init_pid_ns; -#define PIDNS_HASH_ADDING (1U << 31) +#define PIDNS_ADDING (1U << 31)  #ifdef CONFIG_PID_NS  static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) @@ -105,6 +98,6 @@ static inline int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)  extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);  void pidhash_init(void); -void pidmap_init(void); +void pid_idr_init(void);  #endif /* _LINUX_PID_NS_H */ diff --git a/include/linux/pim.h b/include/linux/pim.h index 0e81b2778ae0..290d4d2ed9b9 100644 --- a/include/linux/pim.h +++ b/include/linux/pim.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PIM_H  #define __LINUX_PIM_H diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h index a0f2aba72fa9..0412cc9833e9 100644 --- a/include/linux/pinctrl/consumer.h +++ b/include/linux/pinctrl/consumer.h @@ -25,8 +25,8 @@ struct device;  #ifdef CONFIG_PINCTRL  /* External interface to pin control */ -extern int pinctrl_request_gpio(unsigned gpio); -extern void pinctrl_free_gpio(unsigned gpio); +extern int pinctrl_gpio_request(unsigned gpio); +extern void pinctrl_gpio_free(unsigned gpio);  extern int pinctrl_gpio_direction_input(unsigned gpio);  extern int pinctrl_gpio_direction_output(unsigned gpio);  extern int pinctrl_gpio_set_config(unsigned gpio, unsigned long config); @@ -62,12 +62,12 @@ static inline int pinctrl_pm_select_idle_state(struct device *dev)  #else /* !CONFIG_PINCTRL */ -static inline int pinctrl_request_gpio(unsigned gpio) +static inline int pinctrl_gpio_request(unsigned gpio)  {  	return 0;  } -static inline void pinctrl_free_gpio(unsigned gpio) +static inline void pinctrl_gpio_free(unsigned gpio)  {  } diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h index 5d8bc7f21c2a..ec6dadcc1fde 100644 --- a/include/linux/pinctrl/pinconf-generic.h +++ b/include/linux/pinctrl/pinconf-generic.h @@ -90,6 +90,10 @@   * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to   *	this parameter (on a custom format) tells the driver which alternative   *	slew rate to use. + * @PIN_CONFIG_SKEW_DELAY: if the pin has programmable skew rate (on inputs) + *	or latch delay (on outputs) this parameter (in a custom format) + *	specifies the clock skew or latch delay. It typically controls how + *	many double inverters are put in front of the line.   * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if   *	you need to pass in custom configurations to the pin controller, use   *	PIN_CONFIG_END+1 as the base offset. @@ -117,6 +121,7 @@ enum pin_config_param {  	PIN_CONFIG_POWER_SOURCE,  	PIN_CONFIG_SLEEP_HARDWARE_STATE,  	PIN_CONFIG_SLEW_RATE, +	PIN_CONFIG_SKEW_DELAY,  	PIN_CONFIG_END = 0x7F,  	PIN_CONFIG_MAX = 0xFF,  }; diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h index 23073519339f..a0e785815a64 100644 --- a/include/linux/pinctrl/pinctrl-state.h +++ b/include/linux/pinctrl/pinctrl-state.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Standard pin control state definitions   */ diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index e7497c9dde7f..2dc5e9870fcd 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PIPE_FS_I_H  #define _LINUX_PIPE_FS_I_H @@ -190,5 +191,6 @@ long pipe_fcntl(struct file *, unsigned int, unsigned long arg);  struct pipe_inode_info *get_pipe_info(struct file *file);  int create_pipe_files(struct file **, int); +unsigned int round_pipe_size(unsigned int size);  #endif diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h index a1bacf1150b2..0794ca78c379 100644 --- a/include/linux/pkeys.h +++ b/include/linux/pkeys.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PKEYS_H  #define _LINUX_PKEYS_H diff --git a/include/linux/platform_data/ad7291.h b/include/linux/platform_data/ad7291.h index bbd89fa51188..b1fd1530c9a5 100644 --- a/include/linux/platform_data/ad7291.h +++ b/include/linux/platform_data/ad7291.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __IIO_AD7291_H__  #define __IIO_AD7291_H__ diff --git a/include/linux/platform_data/ad7791.h b/include/linux/platform_data/ad7791.h index f9e4db1b82ae..cc7533049b5b 100644 --- a/include/linux/platform_data/ad7791.h +++ b/include/linux/platform_data/ad7791.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PLATFORM_DATA_AD7791__  #define __LINUX_PLATFORM_DATA_AD7791__ diff --git a/include/linux/platform_data/ad7879.h b/include/linux/platform_data/ad7879.h index 69e2e1fd2bc8..6655cc8453ac 100644 --- a/include/linux/platform_data/ad7879.h +++ b/include/linux/platform_data/ad7879.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* linux/platform_data/ad7879.h */  /* Touchscreen characteristics vary between boards and models.  The diff --git a/include/linux/platform_data/asoc-imx-ssi.h b/include/linux/platform_data/asoc-imx-ssi.h index 92c7fd72f636..902851aeb0b4 100644 --- a/include/linux/platform_data/asoc-imx-ssi.h +++ b/include/linux/platform_data/asoc-imx-ssi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __MACH_SSI_H  #define __MACH_SSI_H diff --git a/include/linux/platform_data/asoc-kirkwood.h b/include/linux/platform_data/asoc-kirkwood.h index d6a55bd2e578..d442cefa3928 100644 --- a/include/linux/platform_data/asoc-kirkwood.h +++ b/include/linux/platform_data/asoc-kirkwood.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __PLAT_AUDIO_H  #define __PLAT_AUDIO_H diff --git a/include/linux/platform_data/asoc-mx27vis.h b/include/linux/platform_data/asoc-mx27vis.h index 409adcd04d04..2107d0d992dd 100644 --- a/include/linux/platform_data/asoc-mx27vis.h +++ b/include/linux/platform_data/asoc-mx27vis.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __PLATFORM_DATA_ASOC_MX27VIS_H  #define __PLATFORM_DATA_ASOC_MX27VIS_H diff --git a/include/linux/platform_data/asoc-palm27x.h b/include/linux/platform_data/asoc-palm27x.h index 58afb30d5298..22b69a393a57 100644 --- a/include/linux/platform_data/asoc-palm27x.h +++ b/include/linux/platform_data/asoc-palm27x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _INCLUDE_PALMASOC_H_  #define _INCLUDE_PALMASOC_H_ diff --git a/include/linux/platform_data/bcmgenet.h b/include/linux/platform_data/bcmgenet.h index 26af54321958..d8f8738629d2 100644 --- a/include/linux/platform_data/bcmgenet.h +++ b/include/linux/platform_data/bcmgenet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PLATFORM_DATA_BCMGENET_H__  #define __LINUX_PLATFORM_DATA_BCMGENET_H__ diff --git a/include/linux/platform_data/crypto-atmel.h b/include/linux/platform_data/crypto-atmel.h index b46e0d9062a0..0471aaf6999b 100644 --- a/include/linux/platform_data/crypto-atmel.h +++ b/include/linux/platform_data/crypto-atmel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_CRYPTO_ATMEL_H  #define __LINUX_CRYPTO_ATMEL_H diff --git a/include/linux/platform_data/dma-ep93xx.h b/include/linux/platform_data/dma-ep93xx.h index e82c642fa53c..f8f1f6b952a6 100644 --- a/include/linux/platform_data/dma-ep93xx.h +++ b/include/linux/platform_data/dma-ep93xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_ARCH_DMA_H  #define __ASM_ARCH_DMA_H diff --git a/include/linux/platform_data/dma-imx-sdma.h b/include/linux/platform_data/dma-imx-sdma.h index 2d08816720f6..6eaa53cef0bd 100644 --- a/include/linux/platform_data/dma-imx-sdma.h +++ b/include/linux/platform_data/dma-imx-sdma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __MACH_MXC_SDMA_H__  #define __MACH_MXC_SDMA_H__ diff --git a/include/linux/platform_data/dma-mv_xor.h b/include/linux/platform_data/dma-mv_xor.h index 92ffd3245f76..6867a7ea329b 100644 --- a/include/linux/platform_data/dma-mv_xor.h +++ b/include/linux/platform_data/dma-mv_xor.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Marvell XOR platform device data definition file.   */ diff --git a/include/linux/platform_data/ds620.h b/include/linux/platform_data/ds620.h index 736bb87ac0fc..6ef58bb77e46 100644 --- a/include/linux/platform_data/ds620.h +++ b/include/linux/platform_data/ds620.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_DS620_H  #define _LINUX_DS620_H diff --git a/include/linux/platform_data/efm32-spi.h b/include/linux/platform_data/efm32-spi.h index 31b19ca1d73a..a2c56fcd0534 100644 --- a/include/linux/platform_data/efm32-spi.h +++ b/include/linux/platform_data/efm32-spi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__  #define __LINUX_PLATFORM_DATA_EFM32_SPI_H__ diff --git a/include/linux/platform_data/efm32-uart.h b/include/linux/platform_data/efm32-uart.h index ed0e975b3c54..ccbb8f11db75 100644 --- a/include/linux/platform_data/efm32-uart.h +++ b/include/linux/platform_data/efm32-uart.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *   * diff --git a/include/linux/platform_data/gpio-htc-egpio.h b/include/linux/platform_data/gpio-htc-egpio.h index b4201c971367..b7baf1e42c55 100644 --- a/include/linux/platform_data/gpio-htc-egpio.h +++ b/include/linux/platform_data/gpio-htc-egpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * HTC simple EGPIO irq and gpio extender   */ diff --git a/include/linux/platform_data/i2c-nuc900.h b/include/linux/platform_data/i2c-nuc900.h deleted file mode 100644 index 9ffb12d06e91..000000000000 --- a/include/linux/platform_data/i2c-nuc900.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __ASM_ARCH_NUC900_I2C_H -#define __ASM_ARCH_NUC900_I2C_H - -struct nuc900_platform_i2c { -	int		bus_num; -	unsigned long   bus_freq; -}; - -#endif /* __ASM_ARCH_NUC900_I2C_H */ diff --git a/include/linux/platform_data/irda-pxaficp.h b/include/linux/platform_data/irda-pxaficp.h index 3cd41f77dda4..bd35ddcf3068 100644 --- a/include/linux/platform_data/irda-pxaficp.h +++ b/include/linux/platform_data/irda-pxaficp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ASMARM_ARCH_IRDA_H  #define ASMARM_ARCH_IRDA_H diff --git a/include/linux/platform_data/itco_wdt.h b/include/linux/platform_data/itco_wdt.h index 0e95527edf25..2ccdce6a4e27 100644 --- a/include/linux/platform_data/itco_wdt.h +++ b/include/linux/platform_data/itco_wdt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Platform data for the Intel TCO Watchdog   */ diff --git a/include/linux/platform_data/keyboard-pxa930_rotary.h b/include/linux/platform_data/keyboard-pxa930_rotary.h index 053587caffdd..3271aa01cbe8 100644 --- a/include/linux/platform_data/keyboard-pxa930_rotary.h +++ b/include/linux/platform_data/keyboard-pxa930_rotary.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_ARCH_PXA930_ROTARY_H  #define __ASM_ARCH_PXA930_ROTARY_H diff --git a/include/linux/platform_data/keypad-ep93xx.h b/include/linux/platform_data/keypad-ep93xx.h index adccee25b162..0e36818e3680 100644 --- a/include/linux/platform_data/keypad-ep93xx.h +++ b/include/linux/platform_data/keypad-ep93xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __KEYPAD_EP93XX_H  #define __KEYPAD_EP93XX_H diff --git a/include/linux/platform_data/keypad-pxa27x.h b/include/linux/platform_data/keypad-pxa27x.h index 24625569d16d..a376442b9935 100644 --- a/include/linux/platform_data/keypad-pxa27x.h +++ b/include/linux/platform_data/keypad-pxa27x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_ARCH_PXA27x_KEYPAD_H  #define __ASM_ARCH_PXA27x_KEYPAD_H diff --git a/include/linux/platform_data/keypad-w90p910.h b/include/linux/platform_data/keypad-w90p910.h index 556778e8ddaa..206ca4ecd93f 100644 --- a/include/linux/platform_data/keypad-w90p910.h +++ b/include/linux/platform_data/keypad-w90p910.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_ARCH_W90P910_KEYPAD_H  #define __ASM_ARCH_W90P910_KEYPAD_H diff --git a/include/linux/platform_data/lcd-mipid.h b/include/linux/platform_data/lcd-mipid.h index 8e52c6572281..63f05eb23827 100644 --- a/include/linux/platform_data/lcd-mipid.h +++ b/include/linux/platform_data/lcd-mipid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LCD_MIPID_H  #define __LCD_MIPID_H diff --git a/include/linux/platform_data/max3421-hcd.h b/include/linux/platform_data/max3421-hcd.h index 0303d1970084..5947a6f43d60 100644 --- a/include/linux/platform_data/max3421-hcd.h +++ b/include/linux/platform_data/max3421-hcd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright (c) 2014 eGauge Systems LLC   *	Contributed by David Mosberger-Tang <davidm@egauge.net> diff --git a/include/linux/platform_data/max6639.h b/include/linux/platform_data/max6639.h index 6011c42034da..65bfdb4fdc15 100644 --- a/include/linux/platform_data/max6639.h +++ b/include/linux/platform_data/max6639.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_MAX6639_H  #define _LINUX_MAX6639_H diff --git a/include/linux/platform_data/max732x.h b/include/linux/platform_data/max732x.h index c04bac8bf2fe..f231c635faec 100644 --- a/include/linux/platform_data/max732x.h +++ b/include/linux/platform_data/max732x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_I2C_MAX732X_H  #define __LINUX_I2C_MAX732X_H diff --git a/include/linux/platform_data/media/gpio-ir-recv.h b/include/linux/platform_data/media/gpio-ir-recv.h deleted file mode 100644 index 0c298f569d5a..000000000000 --- a/include/linux/platform_data/media/gpio-ir-recv.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2012, Code Aurora Forum. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - */ - -#ifndef __GPIO_IR_RECV_H__ -#define __GPIO_IR_RECV_H__ - -struct gpio_ir_recv_platform_data { -	int		gpio_nr; -	bool		active_low; -	u64		allowed_protos; -	const char	*map_name; -}; - -#endif /* __GPIO_IR_RECV_H__ */ diff --git a/include/linux/platform_data/media/ir-rx51.h b/include/linux/platform_data/media/ir-rx51.h index 2c94ab568bfa..9d127aa648e7 100644 --- a/include/linux/platform_data/media/ir-rx51.h +++ b/include/linux/platform_data/media/ir-rx51.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IR_RX51_H  #define _IR_RX51_H diff --git a/include/linux/platform_data/media/mmp-camera.h b/include/linux/platform_data/media/mmp-camera.h index 7611963a257f..83804028115c 100644 --- a/include/linux/platform_data/media/mmp-camera.h +++ b/include/linux/platform_data/media/mmp-camera.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Information for the Marvell Armada MMP camera   */ diff --git a/include/linux/platform_data/media/omap4iss.h b/include/linux/platform_data/media/omap4iss.h index 0d7620db5e32..2a511a8fcda7 100644 --- a/include/linux/platform_data/media/omap4iss.h +++ b/include/linux/platform_data/media/omap4iss.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ARCH_ARM_PLAT_OMAP4_ISS_H  #define ARCH_ARM_PLAT_OMAP4_ISS_H diff --git a/include/linux/platform_data/mmc-davinci.h b/include/linux/platform_data/mmc-davinci.h index 9cea4ee377b5..87a8bed3b6cb 100644 --- a/include/linux/platform_data/mmc-davinci.h +++ b/include/linux/platform_data/mmc-davinci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  Board-specific MMC configuration   */ diff --git a/include/linux/platform_data/mmc-mxcmmc.h b/include/linux/platform_data/mmc-mxcmmc.h index b0fdaa9bd185..ac677351316a 100644 --- a/include/linux/platform_data/mmc-mxcmmc.h +++ b/include/linux/platform_data/mmc-mxcmmc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ASMARM_ARCH_MMC_H  #define ASMARM_ARCH_MMC_H diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h index 1706b3597ce0..752f97c62ef2 100644 --- a/include/linux/platform_data/mmc-pxamci.h +++ b/include/linux/platform_data/mmc-pxamci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ASMARM_ARCH_MMC_H  #define ASMARM_ARCH_MMC_H diff --git a/include/linux/platform_data/mmc-s3cmci.h b/include/linux/platform_data/mmc-s3cmci.h index c42d31711944..b68d9f0bdd9e 100644 --- a/include/linux/platform_data/mmc-s3cmci.h +++ b/include/linux/platform_data/mmc-s3cmci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ARCH_MCI_H  #define _ARCH_MCI_H diff --git a/include/linux/platform_data/mmc-sdhci-s3c.h b/include/linux/platform_data/mmc-sdhci-s3c.h index 249f02387a35..74a54eeb27b1 100644 --- a/include/linux/platform_data/mmc-sdhci-s3c.h +++ b/include/linux/platform_data/mmc-sdhci-s3c.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __PLATFORM_DATA_SDHCI_S3C_H  #define __PLATFORM_DATA_SDHCI_S3C_H diff --git a/include/linux/platform_data/mouse-pxa930_trkball.h b/include/linux/platform_data/mouse-pxa930_trkball.h index 5e0789bc4729..ba0ac7a30d8c 100644 --- a/include/linux/platform_data/mouse-pxa930_trkball.h +++ b/include/linux/platform_data/mouse-pxa930_trkball.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_ARCH_PXA930_TRKBALL_H  #define __ASM_ARCH_PXA930_TRKBALL_H diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h index 17d57a18bac5..619df2431e75 100644 --- a/include/linux/platform_data/mtd-nand-omap2.h +++ b/include/linux/platform_data/mtd-nand-omap2.h @@ -63,24 +63,5 @@ struct gpmc_nand_regs {  	void __iomem	*gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER];  	void __iomem	*gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];  	void __iomem	*gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER]; -	/* Deprecated. Do not use */ -	void __iomem	*gpmc_status; -}; - -struct omap_nand_platform_data { -	int			cs; -	struct mtd_partition	*parts; -	int			nr_parts; -	bool			flash_bbt; -	enum nand_io		xfer_type; -	int			devsize; -	enum omap_ecc           ecc_opt; - -	struct device_node	*elm_of_node; - -	/* deprecated */ -	struct gpmc_nand_regs	reg; -	struct device_node	*of_node; -	bool			dev_ready;  };  #endif diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h index 394d15597dc7..b42ad83cbc20 100644 --- a/include/linux/platform_data/mtd-nand-pxa3xx.h +++ b/include/linux/platform_data/mtd-nand-pxa3xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_ARCH_PXA3XX_NAND_H  #define __ASM_ARCH_PXA3XX_NAND_H diff --git a/include/linux/platform_data/omap1_bl.h b/include/linux/platform_data/omap1_bl.h index 881a8e92d605..5e8b17d77a5f 100644 --- a/include/linux/platform_data/omap1_bl.h +++ b/include/linux/platform_data/omap1_bl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __OMAP1_BL_H__  #define __OMAP1_BL_H__ diff --git a/include/linux/platform_data/pca953x.h b/include/linux/platform_data/pca953x.h index 3c98dd4f901f..4eb53e023997 100644 --- a/include/linux/platform_data/pca953x.h +++ b/include/linux/platform_data/pca953x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PCA953X_H  #define _LINUX_PCA953X_H diff --git a/include/linux/platform_data/pcf857x.h b/include/linux/platform_data/pcf857x.h index 0767a2a6b2f1..11d4ed78c7f4 100644 --- a/include/linux/platform_data/pcf857x.h +++ b/include/linux/platform_data/pcf857x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PCF857X_H  #define __LINUX_PCF857X_H diff --git a/include/linux/platform_data/pcmcia-pxa2xx_viper.h b/include/linux/platform_data/pcmcia-pxa2xx_viper.h index d428be4db44c..a23b58aff9e1 100644 --- a/include/linux/platform_data/pcmcia-pxa2xx_viper.h +++ b/include/linux/platform_data/pcmcia-pxa2xx_viper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ARCOM_PCMCIA_H  #define __ARCOM_PCMCIA_H diff --git a/include/linux/platform_data/pinctrl-single.h b/include/linux/platform_data/pinctrl-single.h index 72eacda9b360..1cf36fdf9510 100644 --- a/include/linux/platform_data/pinctrl-single.h +++ b/include/linux/platform_data/pinctrl-single.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /**   * irq:		optional wake-up interrupt   * rearm:	optional soc specific rearm function diff --git a/include/linux/platform_data/pixcir_i2c_ts.h b/include/linux/platform_data/pixcir_i2c_ts.h index 646af6f8b838..4ab3cd6f1cc2 100644 --- a/include/linux/platform_data/pixcir_i2c_ts.h +++ b/include/linux/platform_data/pixcir_i2c_ts.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef	_PIXCIR_I2C_TS_H  #define	_PIXCIR_I2C_TS_H diff --git a/include/linux/platform_data/pxa2xx_udc.h b/include/linux/platform_data/pxa2xx_udc.h index c6c5e98b5b82..ff9c35dca59d 100644 --- a/include/linux/platform_data/pxa2xx_udc.h +++ b/include/linux/platform_data/pxa2xx_udc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This supports machine-specific differences in how the PXA2xx   * USB Device Controller (UDC) is wired. diff --git a/include/linux/platform_data/sa11x0-serial.h b/include/linux/platform_data/sa11x0-serial.h index 009e1d83fe39..8b79ab08af45 100644 --- a/include/linux/platform_data/sa11x0-serial.h +++ b/include/linux/platform_data/sa11x0-serial.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  Author: Nicolas Pitre   * diff --git a/include/linux/platform_data/sht15.h b/include/linux/platform_data/sht15.h deleted file mode 100644 index 12289c1e9413..000000000000 --- a/include/linux/platform_data/sht15.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * sht15.h - support for the SHT15 Temperature and Humidity Sensor - * - * Copyright (c) 2009 Jonathan Cameron - * - * Copyright (c) 2007 Wouter Horre - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * For further information, see the Documentation/hwmon/sht15 file. - */ - -#ifndef _PDATA_SHT15_H -#define _PDATA_SHT15_H - -/** - * struct sht15_platform_data - sht15 connectivity info - * @gpio_data:		no. of gpio to which bidirectional data line is - *			connected. - * @gpio_sck:		no. of gpio to which the data clock is connected. - * @supply_mv:		supply voltage in mv. Overridden by regulator if - *			available. - * @checksum:		flag to indicate the checksum should be validated. - * @no_otp_reload:	flag to indicate no reload from OTP. - * @low_resolution:	flag to indicate the temp/humidity resolution to use. - */ -struct sht15_platform_data { -	int gpio_data; -	int gpio_sck; -	int supply_mv; -	bool checksum; -	bool no_otp_reload; -	bool low_resolution; -}; - -#endif /* _PDATA_SHT15_H */ diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h index 533d9807e543..818c5c6e203f 100644 --- a/include/linux/platform_data/si5351.h +++ b/include/linux/platform_data/si5351.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Si5351A/B/C programmable clock generator platform_data.   */ diff --git a/include/linux/platform_data/spi-ep93xx.h b/include/linux/platform_data/spi-ep93xx.h index 171a271c2cbd..eb16c6739ac2 100644 --- a/include/linux/platform_data/spi-ep93xx.h +++ b/include/linux/platform_data/spi-ep93xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_MACH_EP93XX_SPI_H  #define __ASM_MACH_EP93XX_SPI_H diff --git a/include/linux/platform_data/spi-imx.h b/include/linux/platform_data/spi-imx.h index 08be445e8eb8..6f012fefa1a2 100644 --- a/include/linux/platform_data/spi-imx.h +++ b/include/linux/platform_data/spi-imx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __MACH_SPI_H_  #define __MACH_SPI_H_ diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h index c100456eab17..13c83a25958a 100644 --- a/include/linux/platform_data/spi-omap2-mcspi.h +++ b/include/linux/platform_data/spi-omap2-mcspi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _OMAP2_MCSPI_H  #define _OMAP2_MCSPI_H diff --git a/include/linux/platform_data/st1232_pdata.h b/include/linux/platform_data/st1232_pdata.h deleted file mode 100644 index cac3e7b4c454..000000000000 --- a/include/linux/platform_data/st1232_pdata.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _LINUX_ST1232_PDATA_H -#define _LINUX_ST1232_PDATA_H - -/* - * Optional platform data - * - * Use this if you want the driver to drive the reset pin. - */ -struct st1232_pdata { -	int reset_gpio; -}; - -#endif diff --git a/include/linux/platform_data/syscon.h b/include/linux/platform_data/syscon.h index 2354c6fa3726..2c089dd3e2bd 100644 --- a/include/linux/platform_data/syscon.h +++ b/include/linux/platform_data/syscon.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef PLATFORM_DATA_SYSCON_H  #define PLATFORM_DATA_SYSCON_H diff --git a/include/linux/platform_data/tsc2007.h b/include/linux/platform_data/tsc2007.h index c2d3aa1dadd4..a0ca52c41ccb 100644 --- a/include/linux/platform_data/tsc2007.h +++ b/include/linux/platform_data/tsc2007.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_I2C_TSC2007_H  #define __LINUX_I2C_TSC2007_H diff --git a/include/linux/platform_data/tsl2563.h b/include/linux/platform_data/tsl2563.h index c90d7a09dda7..9cf9309c3f24 100644 --- a/include/linux/platform_data/tsl2563.h +++ b/include/linux/platform_data/tsl2563.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_TSL2563_H  #define __LINUX_TSL2563_H diff --git a/include/linux/platform_data/usb-ehci-mxc.h b/include/linux/platform_data/usb-ehci-mxc.h index 157e71f79f99..ad9794d09bc8 100644 --- a/include/linux/platform_data/usb-ehci-mxc.h +++ b/include/linux/platform_data/usb-ehci-mxc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H  #define __INCLUDE_ASM_ARCH_MXC_EHCI_H diff --git a/include/linux/platform_data/usb-ohci-pxa27x.h b/include/linux/platform_data/usb-ohci-pxa27x.h index 95b6e2a6e514..69adea7694f3 100644 --- a/include/linux/platform_data/usb-ohci-pxa27x.h +++ b/include/linux/platform_data/usb-ohci-pxa27x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ASMARM_ARCH_OHCI_H  #define ASMARM_ARCH_OHCI_H diff --git a/include/linux/platform_data/usb3503.h b/include/linux/platform_data/usb3503.h index 1d1b6ef871f6..e049d51c1353 100644 --- a/include/linux/platform_data/usb3503.h +++ b/include/linux/platform_data/usb3503.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __USB3503_H__  #define __USB3503_H__ diff --git a/include/linux/platform_data/video-clcd-versatile.h b/include/linux/platform_data/video-clcd-versatile.h index 09ccf182af4d..305ebaec3afd 100644 --- a/include/linux/platform_data/video-clcd-versatile.h +++ b/include/linux/platform_data/video-clcd-versatile.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef PLAT_CLCD_H  #define PLAT_CLCD_H diff --git a/include/linux/platform_data/video-ep93xx.h b/include/linux/platform_data/video-ep93xx.h index 699ac4109366..a6f3ccdec1cb 100644 --- a/include/linux/platform_data/video-ep93xx.h +++ b/include/linux/platform_data/video-ep93xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __VIDEO_EP93XX_H  #define __VIDEO_EP93XX_H diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h index cf9348b376ac..02812651af7d 100644 --- a/include/linux/platform_data/video-imxfb.h +++ b/include/linux/platform_data/video-imxfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This structure describes the machine which we are running on.   */ diff --git a/include/linux/platform_data/video_s3c.h b/include/linux/platform_data/video_s3c.h index 48883995f47f..dd7747ba3269 100644 --- a/include/linux/platform_data/video_s3c.h +++ b/include/linux/platform_data/video_s3c.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __PLATFORM_DATA_VIDEO_S3C  #define __PLATFORM_DATA_VIDEO_S3C diff --git a/include/linux/pm-trace.h b/include/linux/pm-trace.h index 7b78793f07d7..b8604f8847d9 100644 --- a/include/linux/pm-trace.h +++ b/include/linux/pm-trace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef PM_TRACE_H  #define PM_TRACE_H diff --git a/include/linux/pm.h b/include/linux/pm.h index 47ded8aa8a5d..65d39115f06d 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -550,6 +550,33 @@ struct pm_subsys_data {  #endif  }; +/* + * Driver flags to control system suspend/resume behavior. + * + * These flags can be set by device drivers at the probe time.  They need not be + * cleared by the drivers as the driver core will take care of that. + * + * NEVER_SKIP: Do not skip system suspend/resume callbacks for the device. + * SMART_PREPARE: Check the return value of the driver's ->prepare callback. + * SMART_SUSPEND: No need to resume the device from runtime suspend. + * + * Setting SMART_PREPARE instructs bus types and PM domains which may want + * system suspend/resume callbacks to be skipped for the device to return 0 from + * their ->prepare callbacks if the driver's ->prepare callback returns 0 (in + * other words, the system suspend/resume callbacks can only be skipped for the + * device if its driver doesn't object against that).  This flag has no effect + * if NEVER_SKIP is set. + * + * Setting SMART_SUSPEND instructs bus types and PM domains which may want to + * runtime resume the device upfront during system suspend that doing so is not + * necessary from the driver's perspective.  It also may cause them to skip + * invocations of the ->suspend_late and ->suspend_noirq callbacks provided by + * the driver if they decide to leave the device in runtime suspend. + */ +#define DPM_FLAG_NEVER_SKIP	BIT(0) +#define DPM_FLAG_SMART_PREPARE	BIT(1) +#define DPM_FLAG_SMART_SUSPEND	BIT(2) +  struct dev_pm_info {  	pm_message_t		power_state;  	unsigned int		can_wakeup:1; @@ -561,6 +588,7 @@ struct dev_pm_info {  	bool			is_late_suspended:1;  	bool			early_init:1;	/* Owned by the PM core */  	bool			direct_complete:1;	/* Owned by the PM core */ +	u32			driver_flags;  	spinlock_t		lock;  #ifdef CONFIG_PM_SLEEP  	struct list_head	entry; @@ -736,7 +764,8 @@ extern int pm_generic_poweroff_noirq(struct device *dev);  extern int pm_generic_poweroff_late(struct device *dev);  extern int pm_generic_poweroff(struct device *dev);  extern void pm_generic_complete(struct device *dev); -extern void pm_complete_with_resume_check(struct device *dev); + +extern bool dev_pm_smart_suspend_and_suspended(struct device *dev);  #else /* !CONFIG_PM_SLEEP */ diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 84f423d5633e..04dbef9847d3 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -18,9 +18,10 @@  #include <linux/spinlock.h>  /* Defines used for the flags field in the struct generic_pm_domain */ -#define GENPD_FLAG_PM_CLK	(1U << 0) /* PM domain uses PM clk */ -#define GENPD_FLAG_IRQ_SAFE	(1U << 1) /* PM domain operates in atomic */ -#define GENPD_FLAG_ALWAYS_ON	(1U << 2) /* PM domain is always powered on */ +#define GENPD_FLAG_PM_CLK	 (1U << 0) /* PM domain uses PM clk */ +#define GENPD_FLAG_IRQ_SAFE	 (1U << 1) /* PM domain operates in atomic */ +#define GENPD_FLAG_ALWAYS_ON	 (1U << 2) /* PM domain is always powered on */ +#define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) /* Keep devices active if wakeup */  enum gpd_status {  	GPD_STATE_ACTIVE = 0,	/* PM domain is active */ @@ -35,7 +36,6 @@ struct dev_power_governor {  struct gpd_dev_ops {  	int (*start)(struct device *dev);  	int (*stop)(struct device *dev); -	bool (*active_wakeup)(struct device *dev);  };  struct genpd_power_state { @@ -64,8 +64,11 @@ struct generic_pm_domain {  	unsigned int device_count;	/* Number of devices */  	unsigned int suspended_count;	/* System suspend device counter */  	unsigned int prepared_count;	/* Suspend counter of prepared devices */ +	unsigned int performance_state;	/* Aggregated max performance state */  	int (*power_off)(struct generic_pm_domain *domain);  	int (*power_on)(struct generic_pm_domain *domain); +	int (*set_performance_state)(struct generic_pm_domain *genpd, +				     unsigned int state);  	struct gpd_dev_ops dev_ops;  	s64 max_off_time_ns;	/* Maximum allowed "suspended" time. */  	bool max_off_time_changed; @@ -121,6 +124,7 @@ struct generic_pm_domain_data {  	struct pm_domain_data base;  	struct gpd_timing_data td;  	struct notifier_block nb; +	unsigned int performance_state;  	void *data;  }; @@ -148,6 +152,8 @@ extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,  extern int pm_genpd_init(struct generic_pm_domain *genpd,  			 struct dev_power_governor *gov, bool is_off);  extern int pm_genpd_remove(struct generic_pm_domain *genpd); +extern int dev_pm_genpd_set_performance_state(struct device *dev, +					      unsigned int state);  extern struct dev_power_governor simple_qos_governor;  extern struct dev_power_governor pm_domain_always_on_gov; @@ -188,6 +194,12 @@ static inline int pm_genpd_remove(struct generic_pm_domain *genpd)  	return -ENOTSUPP;  } +static inline int dev_pm_genpd_set_performance_state(struct device *dev, +						     unsigned int state) +{ +	return -ENOTSUPP; +} +  #define simple_qos_governor		(*(struct dev_power_governor *)(NULL))  #define pm_domain_always_on_gov		(*(struct dev_power_governor *)(NULL))  #endif diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 51ec727b4824..6c2d2e88f066 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -124,7 +124,9 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table);  struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name);  void dev_pm_opp_put_clkname(struct opp_table *opp_table);  struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); -void dev_pm_opp_register_put_opp_helper(struct opp_table *opp_table); +void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); +struct opp_table *dev_pm_opp_register_get_pstate_helper(struct device *dev, int (*get_pstate)(struct device *dev, unsigned long rate)); +void dev_pm_opp_unregister_get_pstate_helper(struct opp_table *opp_table);  int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq);  int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask);  int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); @@ -243,7 +245,15 @@ static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device  	return ERR_PTR(-ENOTSUPP);  } -static inline void dev_pm_opp_register_put_opp_helper(struct opp_table *opp_table) {} +static inline void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) {} + +static inline struct opp_table *dev_pm_opp_register_get_pstate_helper(struct device *dev, +		int (*get_pstate)(struct device *dev, unsigned long rate)) +{ +	return ERR_PTR(-ENOTSUPP); +} + +static inline void dev_pm_opp_unregister_get_pstate_helper(struct opp_table *opp_table) {}  static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name)  { diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 032b55909145..6ea1ae373d77 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PM_QOS_H  #define _LINUX_PM_QOS_H  /* interface for the pm_qos_power infrastructure of the linux kernel. @@ -27,19 +28,21 @@ enum pm_qos_flags_status {  	PM_QOS_FLAGS_ALL,  }; -#define PM_QOS_DEFAULT_VALUE -1 +#define PM_QOS_DEFAULT_VALUE	(-1) +#define PM_QOS_LATENCY_ANY	S32_MAX +#define PM_QOS_LATENCY_ANY_NS	((s64)PM_QOS_LATENCY_ANY * NSEC_PER_USEC)  #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE	(2000 * USEC_PER_SEC)  #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE	(2000 * USEC_PER_SEC)  #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE	0  #define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE	0 -#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE	0 +#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE	PM_QOS_LATENCY_ANY +#define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT	PM_QOS_LATENCY_ANY +#define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS	PM_QOS_LATENCY_ANY_NS  #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE	0  #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT	(-1) -#define PM_QOS_LATENCY_ANY			((s32)(~(__u32)0 >> 1))  #define PM_QOS_FLAG_NO_POWER_OFF	(1 << 0) -#define PM_QOS_FLAG_REMOTE_WAKEUP	(1 << 1)  struct pm_qos_request {  	struct plist_node node; @@ -174,7 +177,8 @@ static inline s32 dev_pm_qos_requested_flags(struct device *dev)  static inline s32 dev_pm_qos_raw_read_value(struct device *dev)  {  	return IS_ERR_OR_NULL(dev->power.qos) ? -		0 : pm_qos_read_value(&dev->power.qos->resume_latency); +		PM_QOS_RESUME_LATENCY_NO_CONSTRAINT : +		pm_qos_read_value(&dev->power.qos->resume_latency);  }  #else  static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, @@ -184,9 +188,9 @@ static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev,  							s32 mask)  			{ return PM_QOS_FLAGS_UNDEFINED; }  static inline s32 __dev_pm_qos_read_value(struct device *dev) -			{ return 0; } +			{ return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; }  static inline s32 dev_pm_qos_read_value(struct device *dev) -			{ return 0; } +			{ return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; }  static inline int dev_pm_qos_add_request(struct device *dev,  					 struct dev_pm_qos_request *req,  					 enum dev_pm_qos_req_type type, @@ -232,9 +236,15 @@ static inline int dev_pm_qos_expose_latency_tolerance(struct device *dev)  			{ return 0; }  static inline void dev_pm_qos_hide_latency_tolerance(struct device *dev) {} -static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) { return 0; } +static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) +{ +	return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; +}  static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } -static inline s32 dev_pm_qos_raw_read_value(struct device *dev) { return 0; } +static inline s32 dev_pm_qos_raw_read_value(struct device *dev) +{ +	return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; +}  #endif  #endif diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 2efb08a60e63..f0fc4700b6ff 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -105,7 +105,7 @@ static inline bool pm_runtime_callbacks_present(struct device *dev)  static inline void pm_runtime_mark_last_busy(struct device *dev)  { -	ACCESS_ONCE(dev->power.last_busy) = jiffies; +	WRITE_ONCE(dev->power.last_busy, jiffies);  }  static inline bool pm_runtime_is_irq_safe(struct device *dev) diff --git a/include/linux/pmu.h b/include/linux/pmu.h index 99b400b8a241..9ac8fc60ad49 100644 --- a/include/linux/pmu.h +++ b/include/linux/pmu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Definitions for talking to the PMU.  The PMU is a microcontroller   * which controls battery charging and system power on PowerBook 3400 diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 2588ca6a9028..3b12fd28af78 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Linux Plug and Play Support   * Copyright by Adam Belay <ambx1@neo.rr.com> diff --git a/include/linux/poison.h b/include/linux/poison.h index a39540326417..15927ebc22f2 100644 --- a/include/linux/poison.h +++ b/include/linux/poison.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_POISON_H  #define _LINUX_POISON_H diff --git a/include/linux/poll.h b/include/linux/poll.h index 2889f09a1c60..d384f12abdd5 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_POLL_H  #define _LINUX_POLL_H diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 62839fd04dce..672c4f32311e 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _linux_POSIX_TIMERS_H  #define _linux_POSIX_TIMERS_H diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h index 5a9a739acdd5..b2b7255ec7f5 100644 --- a/include/linux/posix_acl.h +++ b/include/linux/posix_acl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*    File: linux/posix_acl.h diff --git a/include/linux/posix_acl_xattr.h b/include/linux/posix_acl_xattr.h index 8b867e3bf3aa..2387709991b5 100644 --- a/include/linux/posix_acl_xattr.h +++ b/include/linux/posix_acl_xattr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*    File: linux/posix_acl_xattr.h diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h index 43194e02c1ee..e6187f524f2c 100644 --- a/include/linux/power/bq27xxx_battery.h +++ b/include/linux/power/bq27xxx_battery.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_BQ27X00_BATTERY_H__  #define __LINUX_BQ27X00_BATTERY_H__ diff --git a/include/linux/pr.h b/include/linux/pr.h index 65c01c10b335..94ceec713afe 100644 --- a/include/linux/pr.h +++ b/include/linux/pr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_PR_H  #define LINUX_PR_H diff --git a/include/linux/preempt.h b/include/linux/preempt.h index cae461224948..5bd3f151da78 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PREEMPT_H  #define __LINUX_PREEMPT_H diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h index a3bfbdf63d32..13eafebf3549 100644 --- a/include/linux/prefetch.h +++ b/include/linux/prefetch.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  Generic cache management functions. Everything is arch-specific,     *  but this header exists to make sure the defines/functions can be diff --git a/include/linux/prime_numbers.h b/include/linux/prime_numbers.h index 14ec4f567342..2b8e99c948d3 100644 --- a/include/linux/prime_numbers.h +++ b/include/linux/prime_numbers.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PRIME_NUMBERS_H  #define __LINUX_PRIME_NUMBERS_H diff --git a/include/linux/printk.h b/include/linux/printk.h index e10f27468322..e9b603ee9953 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __KERNEL_PRINTK__  #define __KERNEL_PRINTK__ @@ -131,10 +132,8 @@ struct va_format {   */  #define no_printk(fmt, ...)				\  ({							\ -	do {						\ -		if (0)					\ -			printk(fmt, ##__VA_ARGS__);	\ -	} while (0);					\ +	if (0)						\ +		printk(fmt, ##__VA_ARGS__);		\  	0;						\  }) @@ -188,7 +187,6 @@ extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,  extern int printk_delay_msec;  extern int dmesg_restrict; -extern int kptr_restrict;  extern int  devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf, @@ -279,6 +277,8 @@ static inline void printk_safe_flush_on_panic(void)  }  #endif +extern int kptr_restrict; +  extern asmlinkage void dump_stack(void) __cold;  #ifndef pr_fmt diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 76124dd4e36d..928ef9e4d912 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * The proc filesystem constants/structures   */ diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h index 06844b54dfc1..2ff18c9840a7 100644 --- a/include/linux/proc_ns.h +++ b/include/linux/proc_ns.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * procfs namespace bits   */ diff --git a/include/linux/processor.h b/include/linux/processor.h index da0c5e56ca02..dbc952eec869 100644 --- a/include/linux/processor.h +++ b/include/linux/processor.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Misc low level processor primitives */  #ifndef _LINUX_PROCESSOR_H  #define _LINUX_PROCESSOR_H diff --git a/include/linux/profile.h b/include/linux/profile.h index b537a25ffa17..bad18ca43150 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PROFILE_H  #define _LINUX_PROFILE_H diff --git a/include/linux/projid.h b/include/linux/projid.h index 8c1f2c55226d..613730622a1a 100644 --- a/include/linux/projid.h +++ b/include/linux/projid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PROJID_H  #define _LINUX_PROJID_H diff --git a/include/linux/property.h b/include/linux/property.h index 6bebee13c5e0..f6189a3ac63c 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -100,7 +100,7 @@ struct fwnode_handle *fwnode_get_named_child_node(  struct fwnode_handle *device_get_named_child_node(struct device *dev,  						  const char *childname); -void fwnode_handle_get(struct fwnode_handle *fwnode); +struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);  void fwnode_handle_put(struct fwnode_handle *fwnode);  unsigned int device_get_child_node_count(struct device *dev); @@ -293,6 +293,10 @@ struct fwnode_handle *  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,  			     u32 endpoint); +#define fwnode_graph_for_each_endpoint(fwnode, child)			\ +	for (child = NULL;						\ +	     (child = fwnode_graph_get_next_endpoint(fwnode, child)); ) +  int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,  				struct fwnode_endpoint *endpoint); diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 0e5fcc11b1b8..919b2a0b0307 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PTRACE_H  #define _LINUX_PTRACE_H diff --git a/include/linux/purgatory.h b/include/linux/purgatory.h index d60d4e278609..b950e961cfa8 100644 --- a/include/linux/purgatory.h +++ b/include/linux/purgatory.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_PURGATORY_H  #define _LINUX_PURGATORY_H diff --git a/include/linux/pvclock_gtod.h b/include/linux/pvclock_gtod.h index a71d2dbd3610..f63549581f3e 100644 --- a/include/linux/pvclock_gtod.h +++ b/include/linux/pvclock_gtod.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _PVCLOCK_GTOD_H  #define _PVCLOCK_GTOD_H diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 08fad7c6a471..56518adc31dd 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_PWM_H  #define __LINUX_PWM_H diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index efdd9227a49c..e8afbd71a140 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Generic PWM backlight driver data - see drivers/video/backlight/pwm_bl.c   */ diff --git a/include/linux/pxa168_eth.h b/include/linux/pxa168_eth.h index e1ab6e86cdb3..fb09c2c7cb75 100644 --- a/include/linux/pxa168_eth.h +++ b/include/linux/pxa168_eth.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *pxa168 ethernet platform device data definition file.   */ diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index e5380471c2cd..1fd27d68926b 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -23,6 +23,19 @@ struct qcom_scm_hdcp_req {  	u32 val;  }; +struct qcom_scm_vmperm { +	int vmid; +	int perm; +}; + +#define QCOM_SCM_VMID_HLOS       0x3 +#define QCOM_SCM_VMID_MSS_MSA    0xF +#define QCOM_SCM_PERM_READ       0x4 +#define QCOM_SCM_PERM_WRITE      0x2 +#define QCOM_SCM_PERM_EXEC       0x1 +#define QCOM_SCM_PERM_RW (QCOM_SCM_PERM_READ | QCOM_SCM_PERM_WRITE) +#define QCOM_SCM_PERM_RWX (QCOM_SCM_PERM_RW | QCOM_SCM_PERM_EXEC) +  #if IS_ENABLED(CONFIG_QCOM_SCM)  extern int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus);  extern int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus); @@ -37,12 +50,17 @@ extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr,  				  phys_addr_t size);  extern int qcom_scm_pas_auth_and_reset(u32 peripheral);  extern int qcom_scm_pas_shutdown(u32 peripheral); +extern int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, +			       unsigned int *src, struct qcom_scm_vmperm *newvm, +			       int dest_cnt);  extern void qcom_scm_cpu_power_down(u32 flags);  extern u32 qcom_scm_get_version(void);  extern int qcom_scm_set_remote_state(u32 state, u32 id);  extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);  extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size);  extern int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare); +extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); +extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val);  #else  static inline  int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus) @@ -73,5 +91,7 @@ qcom_scm_set_remote_state(u32 state,u32 id) { return -ENODEV; }  static inline int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) { return -ENODEV; }  static inline int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size) { return -ENODEV; }  static inline int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) { return -ENODEV; } +static inline int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val) { return -ENODEV; } +static inline int qcom_scm_io_writel(phys_addr_t addr, unsigned int val) { return -ENODEV; }  #endif  #endif diff --git a/include/linux/qed/qed_fcoe_if.h b/include/linux/qed/qed_fcoe_if.h index 1e015c50e6b8..46082480a2c3 100644 --- a/include/linux/qed/qed_fcoe_if.h +++ b/include/linux/qed/qed_fcoe_if.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _QED_FCOE_IF_H  #define _QED_FCOE_IF_H  #include <linux/types.h> diff --git a/include/linux/qed/qed_ll2_if.h b/include/linux/qed/qed_ll2_if.h index dd7a3b86bb9e..e755954d85fd 100644 --- a/include/linux/qed/qed_ll2_if.h +++ b/include/linux/qed/qed_ll2_if.h @@ -64,6 +64,7 @@ enum qed_ll2_roce_flavor_type {  enum qed_ll2_tx_dest {  	QED_LL2_TX_DEST_NW, /* Light L2 TX Destination to the Network */  	QED_LL2_TX_DEST_LB, /* Light L2 TX Destination to the Loopback */ +	QED_LL2_TX_DEST_DROP, /* Light L2 Drop the TX packet */  	QED_LL2_TX_DEST_MAX  }; @@ -101,6 +102,7 @@ struct qed_ll2_comp_rx_data {  	void *cookie;  	dma_addr_t rx_buf_addr;  	u16 parse_flags; +	u16 err_flags;  	u16 vlan;  	bool b_last_packet;  	u8 connection_handle; @@ -149,11 +151,16 @@ void (*qed_ll2_release_tx_packet_cb)(void *cxt,  				     dma_addr_t first_frag_addr,  				     bool b_last_fragment, bool b_last_packet); +typedef +void (*qed_ll2_slowpath_cb)(void *cxt, u8 connection_handle, +			    u32 opaque_data_0, u32 opaque_data_1); +  struct qed_ll2_cbs {  	qed_ll2_complete_rx_packet_cb rx_comp_cb;  	qed_ll2_release_rx_packet_cb rx_release_cb;  	qed_ll2_complete_tx_packet_cb tx_comp_cb;  	qed_ll2_release_tx_packet_cb tx_release_cb; +	qed_ll2_slowpath_cb slowpath_cb;  	void *cookie;  }; @@ -170,6 +177,7 @@ struct qed_ll2_acquire_data_inputs {  	enum qed_ll2_tx_dest tx_dest;  	enum qed_ll2_error_handle ai_err_packet_too_big;  	enum qed_ll2_error_handle ai_err_no_buf; +	bool secondary_queue;  	u8 gsi_enable;  }; diff --git a/include/linux/qnx6_fs.h b/include/linux/qnx6_fs.h index 26049eab9010..13373d437cf2 100644 --- a/include/linux/qnx6_fs.h +++ b/include/linux/qnx6_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  Name                 : qnx6_fs.h   *  Author               : Kai Bankett diff --git a/include/linux/quicklist.h b/include/linux/quicklist.h index 3bdfa70bc642..034982c98c8b 100644 --- a/include/linux/quicklist.h +++ b/include/linux/quicklist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_QUICKLIST_H  #define LINUX_QUICKLIST_H  /* diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 0ce6fc49962e..2fb6fb11132e 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Definitions for diskquota-operations. When diskquota is configured these   * macros expand to the right source-code. diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 567ebb5eaab0..23a9c89c7ad9 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -22,7 +22,6 @@  #define _LINUX_RADIX_TREE_H  #include <linux/bitops.h> -#include <linux/bug.h>  #include <linux/kernel.h>  #include <linux/list.h>  #include <linux/preempt.h> @@ -301,18 +300,17 @@ void *__radix_tree_lookup(const struct radix_tree_root *, unsigned long index,  void *radix_tree_lookup(const struct radix_tree_root *, unsigned long);  void __rcu **radix_tree_lookup_slot(const struct radix_tree_root *,  					unsigned long index); -typedef void (*radix_tree_update_node_t)(struct radix_tree_node *, void *); +typedef void (*radix_tree_update_node_t)(struct radix_tree_node *);  void __radix_tree_replace(struct radix_tree_root *, struct radix_tree_node *,  			  void __rcu **slot, void *entry, -			  radix_tree_update_node_t update_node, void *private); +			  radix_tree_update_node_t update_node);  void radix_tree_iter_replace(struct radix_tree_root *,  		const struct radix_tree_iter *, void __rcu **slot, void *entry);  void radix_tree_replace_slot(struct radix_tree_root *,  			     void __rcu **slot, void *entry);  void __radix_tree_delete_node(struct radix_tree_root *,  			      struct radix_tree_node *, -			      radix_tree_update_node_t update_node, -			      void *private); +			      radix_tree_update_node_t update_node);  void radix_tree_iter_delete(struct radix_tree_root *,  			struct radix_tree_iter *iter, void __rcu **slot);  void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *); diff --git a/include/linux/raid/xor.h b/include/linux/raid/xor.h index 5a210959e3f8..2a9fee8ddae3 100644 --- a/include/linux/raid/xor.h +++ b/include/linux/raid/xor.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XOR_H  #define _XOR_H diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h index ecc730977a5a..5ef7d54caac2 100644 --- a/include/linux/ramfs.h +++ b/include/linux/ramfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RAMFS_H  #define _LINUX_RAMFS_H diff --git a/include/linux/random.h b/include/linux/random.h index eafea6a09361..4024f7d9c77d 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/random.h   * diff --git a/include/linux/range.h b/include/linux/range.h index bd184a5db791..d1fbeb664012 100644 --- a/include/linux/range.h +++ b/include/linux/range.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RANGE_H  #define _LINUX_RANGE_H diff --git a/include/linux/ras.h b/include/linux/ras.h index be5338a35d57..7c3debb47c87 100644 --- a/include/linux/ras.h +++ b/include/linux/ras.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __RAS_H__  #define __RAS_H__ diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h index 56375edf2ed2..8ddf79e9207a 100644 --- a/include/linux/ratelimit.h +++ b/include/linux/ratelimit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RATELIMIT_H  #define _LINUX_RATELIMIT_H diff --git a/include/linux/rational.h b/include/linux/rational.h index bfa6a2bcfb32..33f5f5fc3e36 100644 --- a/include/linux/rational.h +++ b/include/linux/rational.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * rational fractions   * diff --git a/include/linux/rbtree_latch.h b/include/linux/rbtree_latch.h index 4f3432c61d12..ece43e882b56 100644 --- a/include/linux/rbtree_latch.h +++ b/include/linux/rbtree_latch.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Latched RB-trees   * diff --git a/include/linux/rculist.h b/include/linux/rculist.h index b1fd8bf85fdc..127f534fec94 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RCULIST_H  #define _LINUX_RCULIST_H @@ -274,9 +275,9 @@ static inline void list_splice_tail_init_rcu(struct list_head *list,   * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().   */  #define list_entry_rcu(ptr, type, member) \ -	container_of(lockless_dereference(ptr), type, member) +	container_of(READ_ONCE(ptr), type, member) -/** +/*   * Where are list_empty_rcu() and list_first_entry_rcu()?   *   * Implementing those functions following their counterparts list_empty() and @@ -367,7 +368,7 @@ static inline void list_splice_tail_init_rcu(struct list_head *list,   * example is when items are added to the list, but never deleted.   */  #define list_entry_lockless(ptr, type, member) \ -	container_of((typeof(ptr))lockless_dereference(ptr), type, member) +	container_of((typeof(ptr))READ_ONCE(ptr), type, member)  /**   * list_for_each_entry_lockless - iterate over rcu list of given type diff --git a/include/linux/rculist_bl.h b/include/linux/rculist_bl.h index 4f216c59e7db..66e73ec1aa99 100644 --- a/include/linux/rculist_bl.h +++ b/include/linux/rculist_bl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RCULIST_BL_H  #define _LINUX_RCULIST_BL_H diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h index a23a33153180..a328e8181e49 100644 --- a/include/linux/rculist_nulls.h +++ b/include/linux/rculist_nulls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RCULIST_NULLS_H  #define _LINUX_RCULIST_NULLS_H diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index de50d8a4cf41..a6ddc42f87a5 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -346,7 +346,7 @@ static inline void rcu_preempt_sleep_check(void) { }  #define __rcu_dereference_check(p, c, space) \  ({ \  	/* Dependency order vs. p above. */ \ -	typeof(*p) *________p1 = (typeof(*p) *__force)lockless_dereference(p); \ +	typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \  	RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \  	rcu_dereference_sparse(p, space); \  	((typeof(*p) __force __kernel *)(________p1)); \ @@ -360,7 +360,7 @@ static inline void rcu_preempt_sleep_check(void) { }  #define rcu_dereference_raw(p) \  ({ \  	/* Dependency order vs. p above. */ \ -	typeof(p) ________p1 = lockless_dereference(p); \ +	typeof(p) ________p1 = READ_ONCE(p); \  	((typeof(*p) __force __kernel *)(________p1)); \  }) @@ -523,7 +523,7 @@ static inline void rcu_preempt_sleep_check(void) { }   * Return the value of the specified RCU-protected pointer, but omit   * both the smp_read_barrier_depends() and the READ_ONCE().  This   * is useful in cases where update-side locks prevent the value of the - * pointer from changing.  Please note that this primitive does -not- + * pointer from changing.  Please note that this primitive does *not*   * prevent the compiler from repeating this reference or combining it   * with other references, so it should not be used without protection   * of appropriate locks. @@ -568,7 +568,7 @@ static inline void rcu_preempt_sleep_check(void) { }   * is handed off from RCU to some other synchronization mechanism, for   * example, reference counting or locking.  In C11, it would map to   * kill_dependency().  It could be used as follows: - * + * ``   *	rcu_read_lock();   *	p = rcu_dereference(gp);   *	long_lived = is_long_lived(p); @@ -579,6 +579,7 @@ static inline void rcu_preempt_sleep_check(void) { }   *			p = rcu_pointer_handoff(p);   *	}   *	rcu_read_unlock(); + *``   */  #define rcu_pointer_handoff(p) (p) @@ -778,18 +779,21 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)  /**   * RCU_INIT_POINTER() - initialize an RCU protected pointer + * @p: The pointer to be initialized. + * @v: The value to initialized the pointer to.   *   * Initialize an RCU-protected pointer in special cases where readers   * do not need ordering constraints on the CPU or the compiler.  These   * special cases are:   * - * 1.	This use of RCU_INIT_POINTER() is NULLing out the pointer -or- + * 1.	This use of RCU_INIT_POINTER() is NULLing out the pointer *or*   * 2.	The caller has taken whatever steps are required to prevent - *	RCU readers from concurrently accessing this pointer -or- + *	RCU readers from concurrently accessing this pointer *or*   * 3.	The referenced data structure has already been exposed to - *	readers either at compile time or via rcu_assign_pointer() -and- - *	a.	You have not made -any- reader-visible changes to - *		this structure since then -or- + *	readers either at compile time or via rcu_assign_pointer() *and* + * + *	a.	You have not made *any* reader-visible changes to + *		this structure since then *or*   *	b.	It is OK for readers accessing this structure from its   *		new location to see the old state of the structure.  (For   *		example, the changes were to statistical counters or to @@ -805,7 +809,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)   * by a single external-to-structure RCU-protected pointer, then you may   * use RCU_INIT_POINTER() to initialize the internal RCU-protected   * pointers, but you must use rcu_assign_pointer() to initialize the - * external-to-structure pointer -after- you have completely initialized + * external-to-structure pointer *after* you have completely initialized   * the reader-accessible portions of the linked structure.   *   * Note that unlike rcu_assign_pointer(), RCU_INIT_POINTER() provides no @@ -819,6 +823,8 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)  /**   * RCU_POINTER_INITIALIZER() - statically initialize an RCU protected pointer + * @p: The pointer to be initialized. + * @v: The value to initialized the pointer to.   *   * GCC-style initialization for an RCU-protected pointer in a structure field.   */ diff --git a/include/linux/rcupdate_wait.h b/include/linux/rcupdate_wait.h index e774b4f5f220..57f371344152 100644 --- a/include/linux/rcupdate_wait.h +++ b/include/linux/rcupdate_wait.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_RCUPDATE_WAIT_H  #define _LINUX_SCHED_RCUPDATE_WAIT_H diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h index a4ede51b3e7c..90bfa3279a01 100644 --- a/include/linux/rcuwait.h +++ b/include/linux/rcuwait.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RCUWAIT_H_  #define _LINUX_RCUWAIT_H_ diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h index 75f7fe5c881f..4a2abb38d1d6 100644 --- a/include/linux/reboot-mode.h +++ b/include/linux/reboot-mode.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __REBOOT_MODE_H__  #define __REBOOT_MODE_H__ diff --git a/include/linux/reboot.h b/include/linux/reboot.h index a7ff409f386d..e63799a6e895 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_REBOOT_H  #define _LINUX_REBOOT_H @@ -5,6 +6,8 @@  #include <linux/notifier.h>  #include <uapi/linux/reboot.h> +struct device; +  #define SYS_DOWN	0x0001	/* Notify of system down */  #define SYS_RESTART	SYS_DOWN  #define SYS_HALT	0x0002	/* Notify of system halt */ @@ -38,6 +41,8 @@ extern int reboot_force;  extern int register_reboot_notifier(struct notifier_block *);  extern int unregister_reboot_notifier(struct notifier_block *); +extern int devm_register_reboot_notifier(struct device *, struct notifier_block *); +  extern int register_restart_handler(struct notifier_block *);  extern int unregister_restart_handler(struct notifier_block *);  extern void do_kernel_restart(char *cmd); diff --git a/include/linux/reciprocal_div.h b/include/linux/reciprocal_div.h index 8c5a3fb6c6c5..e031e9f2f9d8 100644 --- a/include/linux/reciprocal_div.h +++ b/include/linux/reciprocal_div.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RECIPROCAL_DIV_H  #define _LINUX_RECIPROCAL_DIV_H diff --git a/include/linux/refcount.h b/include/linux/refcount.h index 48b7c9c68c4d..e8286585e149 100644 --- a/include/linux/refcount.h +++ b/include/linux/refcount.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_REFCOUNT_H  #define _LINUX_REFCOUNT_H diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 978abfbac617..15eddc1353ba 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -120,21 +120,65 @@ struct reg_sequence {   */  #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \  ({ \ -	ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ +	u64 __timeout_us = (timeout_us); \ +	unsigned long __sleep_us = (sleep_us); \ +	ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \ +	int __ret; \ +	might_sleep_if(__sleep_us); \ +	for (;;) { \ +		__ret = regmap_read((map), (addr), &(val)); \ +		if (__ret) \ +			break; \ +		if (cond) \ +			break; \ +		if ((__timeout_us) && \ +		    ktime_compare(ktime_get(), __timeout) > 0) { \ +			__ret = regmap_read((map), (addr), &(val)); \ +			break; \ +		} \ +		if (__sleep_us) \ +			usleep_range((__sleep_us >> 2) + 1, __sleep_us); \ +	} \ +	__ret ?: ((cond) ? 0 : -ETIMEDOUT); \ +}) + +/** + * regmap_field_read_poll_timeout - Poll until a condition is met or timeout + * + * @field: Regmap field to read from + * @val: Unsigned integer variable to read the value into + * @cond: Break condition (usually involving @val) + * @sleep_us: Maximum time to sleep between reads in us (0 + *            tight-loops).  Should be less than ~20ms since usleep_range + *            is used (see Documentation/timers/timers-howto.txt). + * @timeout_us: Timeout in us, 0 means never timeout + * + * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read + * error return value in case of a error read. In the two former cases, + * the last read value at @addr is stored in @val. Must not be called + * from atomic context if sleep_us or timeout_us are used. + * + * This is modelled after the readx_poll_timeout macros in linux/iopoll.h. + */ +#define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \ +({ \ +	u64 __timeout_us = (timeout_us); \ +	unsigned long __sleep_us = (sleep_us); \ +	ktime_t timeout = ktime_add_us(ktime_get(), __timeout_us); \  	int pollret; \ -	might_sleep_if(sleep_us); \ +	might_sleep_if(__sleep_us); \  	for (;;) { \ -		pollret = regmap_read((map), (addr), &(val)); \ +		pollret = regmap_field_read((field), &(val)); \  		if (pollret) \  			break; \  		if (cond) \  			break; \ -		if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ -			pollret = regmap_read((map), (addr), &(val)); \ +		if (__timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ +			pollret = regmap_field_read((field), &(val)); \  			break; \  		} \ -		if (sleep_us) \ -			usleep_range((sleep_us >> 2) + 1, sleep_us); \ +		if (__sleep_us) \ +			usleep_range((__sleep_us >> 2) + 1, __sleep_us); \  	} \  	pollret ?: ((cond) ? 0 : -ETIMEDOUT); \  }) @@ -273,6 +317,9 @@ typedef void (*regmap_unlock)(void *);   *   * @ranges: Array of configuration entries for virtual address ranges.   * @num_ranges: Number of range configuration entries. + * @hwlock_id: Specify the hardware spinlock id. + * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE, + *		 HWLOCK_IRQ or 0.   */  struct regmap_config {  	const char *name; @@ -317,6 +364,9 @@ struct regmap_config {  	const struct regmap_range_cfg *ranges;  	unsigned int num_ranges; + +	unsigned int hwlock_id; +	unsigned int hwlock_mode;  };  /** diff --git a/include/linux/regset.h b/include/linux/regset.h index 8e0c9febf495..494cedaafdf2 100644 --- a/include/linux/regset.h +++ b/include/linux/regset.h @@ -107,6 +107,28 @@ typedef int user_regset_writeback_fn(struct task_struct *target,  				     int immediate);  /** + * user_regset_get_size_fn - type of @get_size function in &struct user_regset + * @target:	thread being examined + * @regset:	regset being examined + * + * This call is optional; usually the pointer is %NULL. + * + * When provided, this function must return the current size of regset + * data, as observed by the @get function in &struct user_regset.  The + * value returned must be a multiple of @size.  The returned size is + * required to be valid only until the next time (if any) @regset is + * modified for @target. + * + * This function is intended for dynamically sized regsets.  A regset + * that is statically sized does not need to implement it. + * + * This function should not be called directly: instead, callers should + * call regset_size() to determine the current size of a regset. + */ +typedef unsigned int user_regset_get_size_fn(struct task_struct *target, +					     const struct user_regset *regset); + +/**   * struct user_regset - accessible thread CPU state   * @n:			Number of slots (registers).   * @size:		Size in bytes of a slot (register). @@ -117,19 +139,33 @@ typedef int user_regset_writeback_fn(struct task_struct *target,   * @set:		Function to store values.   * @active:		Function to report if regset is active, or %NULL.   * @writeback:		Function to write data back to user memory, or %NULL. + * @get_size:		Function to return the regset's size, or %NULL.   *   * This data structure describes a machine resource we call a register set.   * This is part of the state of an individual thread, not necessarily   * actual CPU registers per se.  A register set consists of a number of   * similar slots, given by @n.  Each slot is @size bytes, and aligned to - * @align bytes (which is at least @size). + * @align bytes (which is at least @size).  For dynamically-sized + * regsets, @n must contain the maximum possible number of slots for the + * regset, and @get_size must point to a function that returns the + * current regset size.   * - * These functions must be called only on the current thread or on a - * thread that is in %TASK_STOPPED or %TASK_TRACED state, that we are - * guaranteed will not be woken up and return to user mode, and that we - * have called wait_task_inactive() on.  (The target thread always might - * wake up for SIGKILL while these functions are working, in which case - * that thread's user_regset state might be scrambled.) + * Callers that need to know only the current size of the regset and do + * not care about its internal structure should call regset_size() + * instead of inspecting @n or calling @get_size. + * + * For backward compatibility, the @get and @set methods must pad to, or + * accept, @n * @size bytes, even if the current regset size is smaller. + * The precise semantics of these operations depend on the regset being + * accessed. + * + * The functions to which &struct user_regset members point must be + * called only on the current thread or on a thread that is in + * %TASK_STOPPED or %TASK_TRACED state, that we are guaranteed will not + * be woken up and return to user mode, and that we have called + * wait_task_inactive() on.  (The target thread always might wake up for + * SIGKILL while these functions are working, in which case that + * thread's user_regset state might be scrambled.)   *   * The @pos argument must be aligned according to @align; the @count   * argument must be a multiple of @size.  These functions are not @@ -156,6 +192,7 @@ struct user_regset {  	user_regset_set_fn		*set;  	user_regset_active_fn		*active;  	user_regset_writeback_fn	*writeback; +	user_regset_get_size_fn		*get_size;  	unsigned int			n;  	unsigned int 			size;  	unsigned int 			align; @@ -371,5 +408,21 @@ static inline int copy_regset_from_user(struct task_struct *target,  	return regset->set(target, regset, offset, size, NULL, data);  } +/** + * regset_size - determine the current size of a regset + * @target:	thread to be examined + * @regset:	regset to be examined + * + * Note that the returned size is valid only until the next time + * (if any) @regset is modified for @target. + */ +static inline unsigned int regset_size(struct task_struct *target, +				       const struct user_regset *regset) +{ +	if (!regset->get_size) +		return regset->n * regset->size; +	else +		return regset->get_size(target, regset); +}  #endif	/* <linux/regset.h> */ diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h index 80cb40b7c88d..f2fd2d3bf58f 100644 --- a/include/linux/regulator/da9211.h +++ b/include/linux/regulator/da9211.h @@ -1,6 +1,6 @@  /*   * da9211.h - Regulator device driver for DA9211/DA9212 - * /DA9213/DA9214/DA9215 + * /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225   * Copyright (C) 2015  Dialog Semiconductor Ltd.   *   * This program is free software; you can redistribute it and/or @@ -25,8 +25,11 @@ enum da9211_chip_id {  	DA9211,  	DA9212,  	DA9213, +	DA9223,  	DA9214, +	DA9224,  	DA9215, +	DA9225,  };  struct da9211_pdata { diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h index 763953f7e3b8..df7f154a2ed5 100644 --- a/include/linux/regulator/of_regulator.h +++ b/include/linux/regulator/of_regulator.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * OpenFirmware regulator support routines   * diff --git a/include/linux/regulator/userspace-consumer.h b/include/linux/regulator/userspace-consumer.h index b4554ce9d4bb..b5dba0628951 100644 --- a/include/linux/regulator/userspace-consumer.h +++ b/include/linux/regulator/userspace-consumer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __REGULATOR_PLATFORM_CONSUMER_H_  #define __REGULATOR_PLATFORM_CONSUMER_H_ diff --git a/include/linux/relay.h b/include/linux/relay.h index 68c1448e56bb..e1bdf01a86e2 100644 --- a/include/linux/relay.h +++ b/include/linux/relay.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/relay.h   * diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h index db1fe6772ad5..adb88f8cefbc 100644 --- a/include/linux/reset-controller.h +++ b/include/linux/reset-controller.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RESET_CONTROLLER_H_  #define _LINUX_RESET_CONTROLLER_H_ diff --git a/include/linux/reset.h b/include/linux/reset.h index 56463f37f3e6..4c7871ddf3c6 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RESET_H_  #define _LINUX_RESET_H_ diff --git a/include/linux/resource.h b/include/linux/resource.h index 277afdad6589..bdf491cbcab7 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RESOURCE_H  #define _LINUX_RESOURCE_H diff --git a/include/linux/restart_block.h b/include/linux/restart_block.h index 19df8422606c..bcfdb918cd81 100644 --- a/include/linux/restart_block.h +++ b/include/linux/restart_block.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Common syscall restarting data   */ diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index ee9b461af095..289e4d54e3e0 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h @@ -1,7 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RING_BUFFER_H  #define _LINUX_RING_BUFFER_H -#include <linux/kmemcheck.h>  #include <linux/mm.h>  #include <linux/seq_file.h>  #include <linux/poll.h> @@ -13,9 +13,7 @@ struct ring_buffer_iter;   * Don't refer to this struct directly, use functions below.   */  struct ring_buffer_event { -	kmemcheck_bitfield_begin(bitfield);  	u32		type_len:5, time_delta:27; -	kmemcheck_bitfield_end(bitfield);  	u32		array[];  }; diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 733d3d8181e2..988d176472df 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RMAP_H  #define _LINUX_RMAP_H  /* diff --git a/include/linux/rndis.h b/include/linux/rndis.h index 93c0a64aefa6..882587c2b15e 100644 --- a/include/linux/rndis.h +++ b/include/linux/rndis.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Remote Network Driver Interface Specification (RNDIS)   * definitions of the magic numbers used by this protocol diff --git a/include/linux/root_dev.h b/include/linux/root_dev.h index ed241aad7c17..bab671b0782f 100644 --- a/include/linux/root_dev.h +++ b/include/linux/root_dev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ROOT_DEV_H_  #define _ROOT_DEV_H_ diff --git a/include/linux/rpmsg/qcom_smd.h b/include/linux/rpmsg/qcom_smd.h index f27917e0a101..2e92d7407a85 100644 --- a/include/linux/rpmsg/qcom_smd.h +++ b/include/linux/rpmsg/qcom_smd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_RPMSG_QCOM_SMD_H  #define _LINUX_RPMSG_QCOM_SMD_H diff --git a/include/linux/rtc.h b/include/linux/rtc.h index e6d0f9c1cafd..41319a2e409b 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Generic RTC interface.   * This version contains the part of the user interface to the Real Time Clock @@ -135,6 +136,14 @@ struct rtc_device {  	/* Some hardware can't support UIE mode */  	int uie_unsupported; +	/* Number of nsec it takes to set the RTC clock. This influences when +	 * the set ops are called. An offset: +	 *   - of 0.5 s will call RTC set for wall clock time 10.0 s at 9.5 s +	 *   - of 1.5 s will call RTC set for wall clock time 10.0 s at 8.5 s +	 *   - of -0.5 s will call RTC set for wall clock time 10.0 s at 10.5 s +	 */ +	long set_offset_nsec; +  	bool registered;  	struct nvmem_config *nvmem_config; @@ -172,7 +181,7 @@ extern void devm_rtc_device_unregister(struct device *dev,  extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);  extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); -extern int rtc_set_ntp_time(struct timespec64 now); +extern int rtc_set_ntp_time(struct timespec64 now, unsigned long *target_nsec);  int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);  extern int rtc_read_alarm(struct rtc_device *rtc,  			struct rtc_wkalrm *alrm); @@ -221,6 +230,39 @@ static inline bool is_leap_year(unsigned int year)  	return (!(year % 4) && (year % 100)) || !(year % 400);  } +/* Determine if we can call to driver to set the time. Drivers can only be + * called to set a second aligned time value, and the field set_offset_nsec + * specifies how far away from the second aligned time to call the driver. + * + * This also computes 'to_set' which is the time we are trying to set, and has + * a zero in tv_nsecs, such that: + *    to_set - set_delay_nsec == now +/- FUZZ + * + */ +static inline bool rtc_tv_nsec_ok(s64 set_offset_nsec, +				  struct timespec64 *to_set, +				  const struct timespec64 *now) +{ +	/* Allowed error in tv_nsec, arbitarily set to 5 jiffies in ns. */ +	const unsigned long TIME_SET_NSEC_FUZZ = TICK_NSEC * 5; +	struct timespec64 delay = {.tv_sec = 0, +				   .tv_nsec = set_offset_nsec}; + +	*to_set = timespec64_add(*now, delay); + +	if (to_set->tv_nsec < TIME_SET_NSEC_FUZZ) { +		to_set->tv_nsec = 0; +		return true; +	} + +	if (to_set->tv_nsec > NSEC_PER_SEC - TIME_SET_NSEC_FUZZ) { +		to_set->tv_sec++; +		to_set->tv_nsec = 0; +		return true; +	} +	return false; +} +  #define rtc_register_device(device) \  	__rtc_register_device(THIS_MODULE, device) diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index 53fcbe9de7fd..1b92a28dd672 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * RT Mutexes: blocking mutual exclusion locks with PI support   * diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index dea59c8eec54..2032ce2eb20b 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_RTNETLINK_H  #define __LINUX_RTNETLINK_H @@ -17,9 +18,11 @@ extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,  			      u32 id, long expires, u32 error);  void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags); +void rtmsg_ifinfo_newnet(int type, struct net_device *dev, unsigned int change, +			 gfp_t flags, int *new_nsid);  struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev,  				       unsigned change, u32 event, -				       gfp_t flags); +				       gfp_t flags, int *new_nsid);  void rtmsg_ifinfo_send(struct sk_buff *skb, struct net_device *dev,  		       gfp_t flags); @@ -67,7 +70,7 @@ static inline bool lockdep_rtnl_is_held(void)   * @p: The pointer to read, prior to dereferencing   *   * Return the value of the specified RCU-protected pointer, but omit - * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because + * both the smp_read_barrier_depends() and the READ_ONCE(), because   * caller holds RTNL.   */  #define rtnl_dereference(p)					\ diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h index bc2994ed66e1..3dcd617e65ae 100644 --- a/include/linux/rwlock.h +++ b/include/linux/rwlock.h @@ -38,6 +38,15 @@ do {								\   extern int do_raw_write_trylock(rwlock_t *lock);   extern void do_raw_write_unlock(rwlock_t *lock) __releases(lock);  #else + +#ifndef arch_read_lock_flags +# define arch_read_lock_flags(lock, flags)	arch_read_lock(lock) +#endif + +#ifndef arch_write_lock_flags +# define arch_write_lock_flags(lock, flags)	arch_write_lock(lock) +#endif +  # define do_raw_read_lock(rwlock)	do {__acquire(lock); arch_read_lock(&(rwlock)->raw_lock); } while (0)  # define do_raw_read_lock_flags(lock, flags) \  		do {__acquire(lock); arch_read_lock_flags(&(lock)->raw_lock, *(flags)); } while (0) @@ -50,9 +59,6 @@ do {								\  # define do_raw_write_unlock(rwlock)	do {arch_write_unlock(&(rwlock)->raw_lock); __release(lock); } while (0)  #endif -#define read_can_lock(rwlock)		arch_read_can_lock(&(rwlock)->raw_lock) -#define write_can_lock(rwlock)		arch_write_can_lock(&(rwlock)->raw_lock) -  /*   * Define the various rw_lock methods.  Note we define these   * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various diff --git a/include/linux/rwlock_api_smp.h b/include/linux/rwlock_api_smp.h index 5b9b84b20407..86ebb4bf9c6e 100644 --- a/include/linux/rwlock_api_smp.h +++ b/include/linux/rwlock_api_smp.h @@ -211,7 +211,7 @@ static inline void __raw_write_lock(rwlock_t *lock)  	LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock);  } -#endif /* CONFIG_PREEMPT */ +#endif /* !CONFIG_GENERIC_LOCKBREAK || CONFIG_DEBUG_LOCK_ALLOC */  static inline void __raw_write_unlock(rwlock_t *lock)  { diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h index e784761a4443..e47568363e5e 100644 --- a/include/linux/rwsem-spinlock.h +++ b/include/linux/rwsem-spinlock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* rwsem-spinlock.h: fallback C implementation   *   * Copyright (c) 2001   David Howells (dhowells@redhat.com). diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 0ad7318ff299..56707d5ff6ad 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* rwsem.h: R/W semaphores, public interface   *   * Written by David Howells (dhowells@redhat.com). @@ -111,6 +112,7 @@ static inline int rwsem_is_contended(struct rw_semaphore *sem)   * lock for reading   */  extern void down_read(struct rw_semaphore *sem); +extern int __must_check down_read_killable(struct rw_semaphore *sem);  /*   * trylock for reading -- returns 1 if successful, 0 if contention diff --git a/include/linux/s3c_adc_battery.h b/include/linux/s3c_adc_battery.h index 99dadbffdd4f..833871dcf6fd 100644 --- a/include/linux/s3c_adc_battery.h +++ b/include/linux/s3c_adc_battery.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _S3C_ADC_BATTERY_H  #define _S3C_ADC_BATTERY_H diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h index a1904aadbc45..0dcc60e820de 100644 --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h @@ -211,10 +211,14 @@ bool sbitmap_any_bit_set(const struct sbitmap *sb);   */  bool sbitmap_any_bit_clear(const struct sbitmap *sb); +#define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) +#define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U)) +  typedef bool (*sb_for_each_fn)(struct sbitmap *, unsigned int, void *);  /** - * sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap. + * __sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap. + * @start: Where to start the iteration.   * @sb: Bitmap to iterate over.   * @fn: Callback. Should return true to continue or false to break early.   * @data: Pointer to pass to callback. @@ -222,35 +226,61 @@ typedef bool (*sb_for_each_fn)(struct sbitmap *, unsigned int, void *);   * This is inline even though it's non-trivial so that the function calls to the   * callback will hopefully get optimized away.   */ -static inline void sbitmap_for_each_set(struct sbitmap *sb, sb_for_each_fn fn, -					void *data) +static inline void __sbitmap_for_each_set(struct sbitmap *sb, +					  unsigned int start, +					  sb_for_each_fn fn, void *data)  { -	unsigned int i; +	unsigned int index; +	unsigned int nr; +	unsigned int scanned = 0; -	for (i = 0; i < sb->map_nr; i++) { -		struct sbitmap_word *word = &sb->map[i]; -		unsigned int off, nr; +	if (start >= sb->depth) +		start = 0; +	index = SB_NR_TO_INDEX(sb, start); +	nr = SB_NR_TO_BIT(sb, start); -		if (!word->word) -			continue; +	while (scanned < sb->depth) { +		struct sbitmap_word *word = &sb->map[index]; +		unsigned int depth = min_t(unsigned int, word->depth - nr, +					   sb->depth - scanned); -		nr = 0; -		off = i << sb->shift; +		scanned += depth; +		if (!word->word) +			goto next; + +		/* +		 * On the first iteration of the outer loop, we need to add the +		 * bit offset back to the size of the word for find_next_bit(). +		 * On all other iterations, nr is zero, so this is a noop. +		 */ +		depth += nr;  		while (1) { -			nr = find_next_bit(&word->word, word->depth, nr); -			if (nr >= word->depth) +			nr = find_next_bit(&word->word, depth, nr); +			if (nr >= depth)  				break; - -			if (!fn(sb, off + nr, data)) +			if (!fn(sb, (index << sb->shift) + nr, data))  				return;  			nr++;  		} +next: +		nr = 0; +		if (++index >= sb->map_nr) +			index = 0;  	}  } -#define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) -#define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U)) +/** + * sbitmap_for_each_set() - Iterate over each set bit in a &struct sbitmap. + * @sb: Bitmap to iterate over. + * @fn: Callback. Should return true to continue or false to break early. + * @data: Pointer to pass to callback. + */ +static inline void sbitmap_for_each_set(struct sbitmap *sb, sb_for_each_fn fn, +					void *data) +{ +	__sbitmap_for_each_set(sb, 0, fn, data); +}  static inline unsigned long *__sbitmap_word(struct sbitmap *sb,  					    unsigned int bitnr) diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 4b3286ac60c8..b7c83254c566 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCATTERLIST_H  #define _LINUX_SCATTERLIST_H @@ -21,6 +22,12 @@ struct scatterlist {  };  /* + * Since the above length field is an unsigned int, below we define the maximum + * length in bytes that can be stored in one scatterlist entry. + */ +#define SCATTERLIST_MAX_SEGMENT (UINT_MAX & PAGE_MASK) + +/*   * These macros should be used after a dma_map_sg call has been done   * to get bus addresses of each of the SG entries and their lengths.   * You should only work with the number of sg entries dma_map_sg @@ -261,10 +268,13 @@ void sg_free_table(struct sg_table *);  int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int,  		     struct scatterlist *, gfp_t, sg_alloc_fn *);  int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); -int sg_alloc_table_from_pages(struct sg_table *sgt, -	struct page **pages, unsigned int n_pages, -	unsigned long offset, unsigned long size, -	gfp_t gfp_mask); +int __sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, +				unsigned int n_pages, unsigned int offset, +				unsigned long size, unsigned int max_segment, +				gfp_t gfp_mask); +int sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, +			      unsigned int n_pages, unsigned int offset, +			      unsigned long size, gfp_t gfp_mask);  size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,  		      size_t buflen, off_t skip, bool to_buffer); diff --git a/include/linux/scc.h b/include/linux/scc.h index c5a004962679..745eabd17c10 100644 --- a/include/linux/scc.h +++ b/include/linux/scc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */  #ifndef	_SCC_H  #define	_SCC_H diff --git a/include/linux/sched.h b/include/linux/sched.h index 26a7df4e558c..21991d668d35 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_H  #define _LINUX_SCHED_H @@ -165,8 +166,6 @@ struct task_group;  /* Task command name length: */  #define TASK_COMM_LEN			16 -extern cpumask_var_t			cpu_isolated_map; -  extern void scheduler_tick(void);  #define	MAX_SCHEDULE_TIMEOUT		LONG_MAX @@ -331,9 +330,11 @@ struct load_weight {  struct sched_avg {  	u64				last_update_time;  	u64				load_sum; +	u64				runnable_load_sum;  	u32				util_sum;  	u32				period_contrib;  	unsigned long			load_avg; +	unsigned long			runnable_load_avg;  	unsigned long			util_avg;  }; @@ -376,6 +377,7 @@ struct sched_statistics {  struct sched_entity {  	/* For load-balancing: */  	struct load_weight		load; +	unsigned long			runnable_weight;  	struct rb_node			run_node;  	struct list_head		group_node;  	unsigned int			on_rq; @@ -471,10 +473,10 @@ struct sched_dl_entity {  	 * conditions between the inactive timer handler and the wakeup  	 * code.  	 */ -	int				dl_throttled; -	int				dl_boosted; -	int				dl_yielded; -	int				dl_non_contending; +	unsigned int			dl_throttled      : 1; +	unsigned int			dl_boosted        : 1; +	unsigned int			dl_yielded        : 1; +	unsigned int			dl_non_contending : 1;  	/*  	 * Bandwidth enforcement timer. Each -deadline task has its @@ -1245,7 +1247,7 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)  #define TASK_REPORT_IDLE	(TASK_REPORT + 1)  #define TASK_REPORT_MAX		(TASK_REPORT_IDLE << 1) -static inline unsigned int __get_task_state(struct task_struct *tsk) +static inline unsigned int task_state_index(struct task_struct *tsk)  {  	unsigned int tsk_state = READ_ONCE(tsk->state);  	unsigned int state = (tsk_state | tsk->exit_state) & TASK_REPORT; @@ -1258,7 +1260,7 @@ static inline unsigned int __get_task_state(struct task_struct *tsk)  	return fls(state);  } -static inline char __task_state_to_char(unsigned int state) +static inline char task_index_to_char(unsigned int state)  {  	static const char state_char[] = "RSDTtXZPI"; @@ -1269,7 +1271,7 @@ static inline char __task_state_to_char(unsigned int state)  static inline char task_state_to_char(struct task_struct *tsk)  { -	return __task_state_to_char(__get_task_state(tsk)); +	return task_index_to_char(task_state_index(tsk));  }  /** diff --git a/include/linux/sched/autogroup.h b/include/linux/sched/autogroup.h index 55cd496df884..704391cc1d20 100644 --- a/include/linux/sched/autogroup.h +++ b/include/linux/sched/autogroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_AUTOGROUP_H  #define _LINUX_SCHED_AUTOGROUP_H diff --git a/include/linux/sched/clock.h b/include/linux/sched/clock.h index a55600ffdf4b..867d588314e0 100644 --- a/include/linux/sched/clock.h +++ b/include/linux/sched/clock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_CLOCK_H  #define _LINUX_SCHED_CLOCK_H diff --git a/include/linux/sched/coredump.h b/include/linux/sched/coredump.h index 98ae0d05aa32..9c8847395b5e 100644 --- a/include/linux/sched/coredump.h +++ b/include/linux/sched/coredump.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_COREDUMP_H  #define _LINUX_SCHED_COREDUMP_H diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h index d2be2ccbb372..d1ad3d825561 100644 --- a/include/linux/sched/cpufreq.h +++ b/include/linux/sched/cpufreq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_CPUFREQ_H  #define _LINUX_SCHED_CPUFREQ_H diff --git a/include/linux/sched/cputime.h b/include/linux/sched/cputime.h index 4c5b9735c1ae..53f883f5a2fd 100644 --- a/include/linux/sched/cputime.h +++ b/include/linux/sched/cputime.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_CPUTIME_H  #define _LINUX_SCHED_CPUTIME_H @@ -53,7 +54,8 @@ static inline void task_cputime_scaled(struct task_struct *t,  extern void task_cputime_adjusted(struct task_struct *p, u64 *ut, u64 *st);  extern void thread_group_cputime_adjusted(struct task_struct *p, u64 *ut, u64 *st); - +extern void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev, +			   u64 *ut, u64 *st);  /*   * Thread group CPU time accounting. diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h index 975be862e083..a5bc8728ead7 100644 --- a/include/linux/sched/deadline.h +++ b/include/linux/sched/deadline.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_DEADLINE_H  #define _LINUX_SCHED_DEADLINE_H diff --git a/include/linux/sched/debug.h b/include/linux/sched/debug.h index 5d58d49e9f87..95fb9e025247 100644 --- a/include/linux/sched/debug.h +++ b/include/linux/sched/debug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_DEBUG_H  #define _LINUX_SCHED_DEBUG_H diff --git a/include/linux/sched/hotplug.h b/include/linux/sched/hotplug.h index 752ac7e628d7..9a62ffdd296f 100644 --- a/include/linux/sched/hotplug.h +++ b/include/linux/sched/hotplug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_HOTPLUG_H  #define _LINUX_SCHED_HOTPLUG_H diff --git a/include/linux/sched/idle.h b/include/linux/sched/idle.h index 5ca63ebad6b4..22873d276be6 100644 --- a/include/linux/sched/idle.h +++ b/include/linux/sched/idle.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_IDLE_H  #define _LINUX_SCHED_IDLE_H diff --git a/include/linux/sched/init.h b/include/linux/sched/init.h index 127215045285..03542575fd33 100644 --- a/include/linux/sched/init.h +++ b/include/linux/sched/init.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_INIT_H  #define _LINUX_SCHED_INIT_H diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h new file mode 100644 index 000000000000..d849431c8060 --- /dev/null +++ b/include/linux/sched/isolation.h @@ -0,0 +1,51 @@ +#ifndef _LINUX_SCHED_ISOLATION_H +#define _LINUX_SCHED_ISOLATION_H + +#include <linux/cpumask.h> +#include <linux/init.h> +#include <linux/tick.h> + +enum hk_flags { +	HK_FLAG_TIMER		= 1, +	HK_FLAG_RCU		= (1 << 1), +	HK_FLAG_MISC		= (1 << 2), +	HK_FLAG_SCHED		= (1 << 3), +	HK_FLAG_TICK		= (1 << 4), +	HK_FLAG_DOMAIN		= (1 << 5), +}; + +#ifdef CONFIG_CPU_ISOLATION +DECLARE_STATIC_KEY_FALSE(housekeeping_overriden); +extern int housekeeping_any_cpu(enum hk_flags flags); +extern const struct cpumask *housekeeping_cpumask(enum hk_flags flags); +extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags); +extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags); +extern void __init housekeeping_init(void); + +#else + +static inline int housekeeping_any_cpu(enum hk_flags flags) +{ +	return smp_processor_id(); +} + +static inline const struct cpumask *housekeeping_cpumask(enum hk_flags flags) +{ +	return cpu_possible_mask; +} + +static inline void housekeeping_affine(struct task_struct *t, +				       enum hk_flags flags) { } +static inline void housekeeping_init(void) { } +#endif /* CONFIG_CPU_ISOLATION */ + +static inline bool housekeeping_cpu(int cpu, enum hk_flags flags) +{ +#ifdef CONFIG_CPU_ISOLATION +	if (static_branch_unlikely(&housekeeping_overriden)) +		return housekeeping_test_cpu(cpu, flags); +#endif +	return true; +} + +#endif /* _LINUX_SCHED_ISOLATION_H */ diff --git a/include/linux/sched/jobctl.h b/include/linux/sched/jobctl.h index 016afa0fb3bb..98228bd48aee 100644 --- a/include/linux/sched/jobctl.h +++ b/include/linux/sched/jobctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_JOBCTL_H  #define _LINUX_SCHED_JOBCTL_H diff --git a/include/linux/sched/loadavg.h b/include/linux/sched/loadavg.h index 4264bc6b2c27..80bc84ba5d2a 100644 --- a/include/linux/sched/loadavg.h +++ b/include/linux/sched/loadavg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_LOADAVG_H  #define _LINUX_SCHED_LOADAVG_H diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index ae53e413fb13..3d49b91b674d 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_MM_H  #define _LINUX_SCHED_MM_H @@ -211,4 +212,20 @@ static inline void memalloc_noreclaim_restore(unsigned int flags)  	current->flags = (current->flags & ~PF_MEMALLOC) | flags;  } +#ifdef CONFIG_MEMBARRIER +enum { +	MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY	= (1U << 0), +	MEMBARRIER_STATE_SWITCH_MM			= (1U << 1), +}; + +static inline void membarrier_execve(struct task_struct *t) +{ +	atomic_set(&t->mm->membarrier_state, 0); +} +#else +static inline void membarrier_execve(struct task_struct *t) +{ +} +#endif +  #endif /* _LINUX_SCHED_MM_H */ diff --git a/include/linux/sched/nohz.h b/include/linux/sched/nohz.h index 028d17b918a7..3d3a97d9399d 100644 --- a/include/linux/sched/nohz.h +++ b/include/linux/sched/nohz.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_NOHZ_H  #define _LINUX_SCHED_NOHZ_H diff --git a/include/linux/sched/numa_balancing.h b/include/linux/sched/numa_balancing.h index 35d5fc77b4be..e7dd04a84ba8 100644 --- a/include/linux/sched/numa_balancing.h +++ b/include/linux/sched/numa_balancing.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_NUMA_BALANCING_H  #define _LINUX_SCHED_NUMA_BALANCING_H diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h index 2cc450f6ec54..7d64feafc408 100644 --- a/include/linux/sched/prio.h +++ b/include/linux/sched/prio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_PRIO_H  #define _LINUX_SCHED_PRIO_H diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h index f93329aba31a..e5af028c08b4 100644 --- a/include/linux/sched/rt.h +++ b/include/linux/sched/rt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_RT_H  #define _LINUX_SCHED_RT_H @@ -17,6 +18,17 @@ static inline int rt_task(struct task_struct *p)  	return rt_prio(p->prio);  } +static inline bool task_is_realtime(struct task_struct *tsk) +{ +	int policy = tsk->policy; + +	if (policy == SCHED_FIFO || policy == SCHED_RR) +		return true; +	if (policy == SCHED_DEADLINE) +		return true; +	return false; +} +  #ifdef CONFIG_RT_MUTEXES  /*   * Must hold either p->pi_lock or task_rq(p)->lock. diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h index 2a0dd40b15db..0aa4548fb492 100644 --- a/include/linux/sched/signal.h +++ b/include/linux/sched/signal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_SIGNAL_H  #define _LINUX_SCHED_SIGNAL_H diff --git a/include/linux/sched/stat.h b/include/linux/sched/stat.h index 141b74c53fad..04f1321d14c4 100644 --- a/include/linux/sched/stat.h +++ b/include/linux/sched/stat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_STAT_H  #define _LINUX_SCHED_STAT_H diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index 0f5ecd4d298e..1c1a1512ec55 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_SYSCTL_H  #define _LINUX_SCHED_SYSCTL_H @@ -37,9 +38,9 @@ extern unsigned int sysctl_numa_balancing_scan_period_max;  extern unsigned int sysctl_numa_balancing_scan_size;  #ifdef CONFIG_SCHED_DEBUG -extern unsigned int sysctl_sched_migration_cost; -extern unsigned int sysctl_sched_nr_migrate; -extern unsigned int sysctl_sched_time_avg; +extern __read_mostly unsigned int sysctl_sched_migration_cost; +extern __read_mostly unsigned int sysctl_sched_nr_migrate; +extern __read_mostly unsigned int sysctl_sched_time_avg;  int sched_proc_update_handler(struct ctl_table *table, int write,  		void __user *buffer, size_t *length, diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index 79a2a744648d..05b8650f06f5 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_TASK_H  #define _LINUX_SCHED_TASK_H diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h index df6ea6665b31..cb4828aaa34f 100644 --- a/include/linux/sched/task_stack.h +++ b/include/linux/sched/task_stack.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_TASK_STACK_H  #define _LINUX_SCHED_TASK_STACK_H diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index d7b6dab956ec..cf257c2e728d 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_TOPOLOGY_H  #define _LINUX_SCHED_TOPOLOGY_H @@ -71,14 +72,6 @@ struct sched_domain_shared {  	atomic_t	ref;  	atomic_t	nr_busy_cpus;  	int		has_idle_cores; - -	/* -	 * Some variables from the most recent sd_lb_stats for this domain, -	 * used by wake_affine(). -	 */ -	unsigned long	nr_running; -	unsigned long	load; -	unsigned long	capacity;  };  struct sched_domain { diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h index 3c07e4135127..0dcf4e480ef7 100644 --- a/include/linux/sched/user.h +++ b/include/linux/sched/user.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_USER_H  #define _LINUX_SCHED_USER_H diff --git a/include/linux/sched/wake_q.h b/include/linux/sched/wake_q.h index d03d8a9047dc..10b19a192b2d 100644 --- a/include/linux/sched/wake_q.h +++ b/include/linux/sched/wake_q.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_WAKE_Q_H  #define _LINUX_SCHED_WAKE_Q_H diff --git a/include/linux/sched/xacct.h b/include/linux/sched/xacct.h index a28156a0d34a..c078f0a94cec 100644 --- a/include/linux/sched/xacct.h +++ b/include/linux/sched/xacct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SCHED_XACCT_H  #define _LINUX_SCHED_XACCT_H diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h index f0f8bad54be9..eab7081392d5 100644 --- a/include/linux/screen_info.h +++ b/include/linux/screen_info.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCREEN_INFO_H  #define _SCREEN_INFO_H diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 82b171e1aa0b..da803dfc7a39 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -231,7 +231,7 @@ struct sctp_datahdr {  	__be32 tsn;  	__be16 stream;  	__be16 ssn; -	__be32 ppid; +	__u32 ppid;  	__u8  payload[0];  }; @@ -716,28 +716,28 @@ struct sctp_reconf_chunk {  struct sctp_strreset_outreq {  	struct sctp_paramhdr param_hdr; -	__u32 request_seq; -	__u32 response_seq; -	__u32 send_reset_at_tsn; -	__u16 list_of_streams[0]; +	__be32 request_seq; +	__be32 response_seq; +	__be32 send_reset_at_tsn; +	__be16 list_of_streams[0];  };  struct sctp_strreset_inreq {  	struct sctp_paramhdr param_hdr; -	__u32 request_seq; -	__u16 list_of_streams[0]; +	__be32 request_seq; +	__be16 list_of_streams[0];  };  struct sctp_strreset_tsnreq {  	struct sctp_paramhdr param_hdr; -	__u32 request_seq; +	__be32 request_seq;  };  struct sctp_strreset_addstrm {  	struct sctp_paramhdr param_hdr; -	__u32 request_seq; -	__u16 number_of_streams; -	__u16 reserved; +	__be32 request_seq; +	__be16 number_of_streams; +	__be16 reserved;  };  enum { @@ -752,16 +752,16 @@ enum {  struct sctp_strreset_resp {  	struct sctp_paramhdr param_hdr; -	__u32 response_seq; -	__u32 result; +	__be32 response_seq; +	__be32 result;  };  struct sctp_strreset_resptsn {  	struct sctp_paramhdr param_hdr; -	__u32 response_seq; -	__u32 result; -	__u32 senders_next_tsn; -	__u32 receivers_next_tsn; +	__be32 response_seq; +	__be32 result; +	__be32 senders_next_tsn; +	__be32 receivers_next_tsn;  };  #endif /* __LINUX_SCTP_H__ */ diff --git a/include/linux/scx200.h b/include/linux/scx200.h index de466e11e271..652ec1a45f7c 100644 --- a/include/linux/scx200.h +++ b/include/linux/scx200.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* linux/include/linux/scx200.h     Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> diff --git a/include/linux/scx200_gpio.h b/include/linux/scx200_gpio.h index ece4e553e9ac..6386ddbb6b70 100644 --- a/include/linux/scx200_gpio.h +++ b/include/linux/scx200_gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear);  extern unsigned scx200_gpio_base; diff --git a/include/linux/sdb.h b/include/linux/sdb.h index fbb76a46c8a5..a2404a2bbd10 100644 --- a/include/linux/sdb.h +++ b/include/linux/sdb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This is the official version 1.1 of sdb.h   */ diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h index c8bef436b61d..10f25f7e4304 100644 --- a/include/linux/seccomp.h +++ b/include/linux/seccomp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SECCOMP_H  #define _LINUX_SECCOMP_H diff --git a/include/linux/securebits.h b/include/linux/securebits.h index da1b33b33af7..656528673983 100644 --- a/include/linux/securebits.h +++ b/include/linux/securebits.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SECUREBITS_H  #define _LINUX_SECUREBITS_H 1 diff --git a/include/linux/security.h b/include/linux/security.h index ce6265960d6c..73f1ef625d40 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -1730,6 +1730,54 @@ static inline void securityfs_remove(struct dentry *dentry)  #endif +#ifdef CONFIG_BPF_SYSCALL +union bpf_attr; +struct bpf_map; +struct bpf_prog; +struct bpf_prog_aux; +#ifdef CONFIG_SECURITY +extern int security_bpf(int cmd, union bpf_attr *attr, unsigned int size); +extern int security_bpf_map(struct bpf_map *map, fmode_t fmode); +extern int security_bpf_prog(struct bpf_prog *prog); +extern int security_bpf_map_alloc(struct bpf_map *map); +extern void security_bpf_map_free(struct bpf_map *map); +extern int security_bpf_prog_alloc(struct bpf_prog_aux *aux); +extern void security_bpf_prog_free(struct bpf_prog_aux *aux); +#else +static inline int security_bpf(int cmd, union bpf_attr *attr, +					     unsigned int size) +{ +	return 0; +} + +static inline int security_bpf_map(struct bpf_map *map, fmode_t fmode) +{ +	return 0; +} + +static inline int security_bpf_prog(struct bpf_prog *prog) +{ +	return 0; +} + +static inline int security_bpf_map_alloc(struct bpf_map *map) +{ +	return 0; +} + +static inline void security_bpf_map_free(struct bpf_map *map) +{ } + +static inline int security_bpf_prog_alloc(struct bpf_prog_aux *aux) +{ +	return 0; +} + +static inline void security_bpf_prog_free(struct bpf_prog_aux *aux) +{ } +#endif /* CONFIG_SECURITY */ +#endif /* CONFIG_BPF_SYSCALL */ +  #ifdef CONFIG_SECURITY  static inline char *alloc_secdata(void) diff --git a/include/linux/seg6.h b/include/linux/seg6.h index 7a66d2b4c5a6..369066a33ab9 100644 --- a/include/linux/seg6.h +++ b/include/linux/seg6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SEG6_H  #define _LINUX_SEG6_H diff --git a/include/linux/seg6_genl.h b/include/linux/seg6_genl.h index d6c3fb4f3734..2f25a3cd7cb3 100644 --- a/include/linux/seg6_genl.h +++ b/include/linux/seg6_genl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SEG6_GENL_H  #define _LINUX_SEG6_GENL_H diff --git a/include/linux/seg6_hmac.h b/include/linux/seg6_hmac.h index da437ebdc6cd..16e59595e870 100644 --- a/include/linux/seg6_hmac.h +++ b/include/linux/seg6_hmac.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SEG6_HMAC_H  #define _LINUX_SEG6_HMAC_H diff --git a/include/linux/seg6_iptunnel.h b/include/linux/seg6_iptunnel.h index 5377cf6a5a02..d07df7fc9dee 100644 --- a/include/linux/seg6_iptunnel.h +++ b/include/linux/seg6_iptunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SEG6_IPTUNNEL_H  #define _LINUX_SEG6_IPTUNNEL_H diff --git a/include/linux/selection.h b/include/linux/selection.h index 8e4624efdb6f..5b278ce99d8d 100644 --- a/include/linux/selection.h +++ b/include/linux/selection.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * selection.h   * diff --git a/include/linux/sem.h b/include/linux/sem.h index 0083128318f6..9badd322dcee 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SEM_H  #define _LINUX_SEM_H diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h index fb7eb9ccb1cd..aa5deb041c25 100644 --- a/include/linux/seq_buf.h +++ b/include/linux/seq_buf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SEQ_BUF_H  #define _LINUX_SEQ_BUF_H diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index e305b66a9fb9..09c6e28746f9 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SEQ_FILE_H  #define _LINUX_SEQ_FILE_H diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h index 32c89bbe24a2..43ccd84127b6 100644 --- a/include/linux/seq_file_net.h +++ b/include/linux/seq_file_net.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SEQ_FILE_NET_H__  #define __SEQ_FILE_NET_H__ diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index ead97654c4e9..f189a8a3bbb8 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SEQLOCK_H  #define __LINUX_SEQLOCK_H  /* diff --git a/include/linux/serial_bcm63xx.h b/include/linux/serial_bcm63xx.h index 570e964dc899..b5e48ef89736 100644 --- a/include/linux/serial_bcm63xx.h +++ b/include/linux/serial_bcm63xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SERIAL_BCM63XX_H  #define _LINUX_SERIAL_BCM63XX_H diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 5553e04e59c9..37b044e78333 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -501,4 +501,9 @@ static inline int uart_handle_break(struct uart_port *port)  					 (cflag) & CRTSCTS || \  					 !((cflag) & CLOCAL)) +/* + * Common device tree parsing helpers + */ +void of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf); +  #endif /* LINUX_SERIAL_CORE_H */ diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h index e598eaef3962..c0e795d95477 100644 --- a/include/linux/serial_sci.h +++ b/include/linux/serial_sci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SERIAL_SCI_H  #define __LINUX_SERIAL_SCI_H diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h index 645896b81244..7bed5be886c6 100644 --- a/include/linux/sh_clk.h +++ b/include/linux/sh_clk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SH_CLOCK_H  #define __SH_CLOCK_H diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h index f2e27e078362..ff3642d267f7 100644 --- a/include/linux/sh_eth.h +++ b/include/linux/sh_eth.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_SH_ETH_H__  #define __ASM_SH_ETH_H__ diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h index 32383285da68..c255273b0281 100644 --- a/include/linux/sh_intc.h +++ b/include/linux/sh_intc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SH_INTC_H  #define __SH_INTC_H diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h index 64638b058076..74fd5140bb7a 100644 --- a/include/linux/sh_timer.h +++ b/include/linux/sh_timer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SH_TIMER_H__  #define __SH_TIMER_H__ diff --git a/include/linux/shm.h b/include/linux/shm.h index 74a4b3b64352..2bbafacfbfc9 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SHM_H_  #define _LINUX_SHM_H_ diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index b6c3540e07bc..06b295bec00d 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SHMEM_FS_H  #define __SHMEM_FS_H @@ -53,6 +54,8 @@ extern struct file *shmem_file_setup(const char *name,  					loff_t size, unsigned long flags);  extern struct file *shmem_kernel_file_setup(const char *name, loff_t size,  					    unsigned long flags); +extern struct file *shmem_file_setup_with_mnt(struct vfsmount *mnt, +		const char *name, loff_t size, unsigned long flags);  extern int shmem_zero_setup(struct vm_area_struct *);  extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr,  		unsigned long len, unsigned long pgoff, unsigned long flags); diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 51d189615bda..388ff2936a87 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SHRINKER_H  #define _LINUX_SHRINKER_H diff --git a/include/linux/signal.h b/include/linux/signal.h index 38564e3e54c7..042968dd98f0 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SIGNAL_H  #define _LINUX_SIGNAL_H diff --git a/include/linux/signal_types.h b/include/linux/signal_types.h index 16d862a3d8f3..222ae696000b 100644 --- a/include/linux/signal_types.h +++ b/include/linux/signal_types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SIGNAL_TYPES_H  #define _LINUX_SIGNAL_TYPES_H diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h index 4985048640a7..9a47c380bda8 100644 --- a/include/linux/signalfd.h +++ b/include/linux/signalfd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  include/linux/signalfd.h   * diff --git a/include/linux/sirfsoc_dma.h b/include/linux/sirfsoc_dma.h index 29d959333d81..50161b6afb61 100644 --- a/include/linux/sirfsoc_dma.h +++ b/include/linux/sirfsoc_dma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SIRFSOC_DMA_H_  #define _SIRFSOC_DMA_H_ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 72299ef00061..bc486ef23f20 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -15,7 +15,6 @@  #define _LINUX_SKBUFF_H  #include <linux/kernel.h> -#include <linux/kmemcheck.h>  #include <linux/compiler.h>  #include <linux/time.h>  #include <linux/bug.h> @@ -489,8 +488,9 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,   * the end of the header data, ie. at skb->end.   */  struct skb_shared_info { -	unsigned short	_unused; -	unsigned char	nr_frags; +	__u8		__unused; +	__u8		meta_len; +	__u8		nr_frags;  	__u8		tx_flags;  	unsigned short	gso_size;  	/* Warning: this field is not always filled in (UFO)! */ @@ -499,7 +499,6 @@ struct skb_shared_info {  	struct skb_shared_hwtstamps hwtstamps;  	unsigned int	gso_type;  	u32		tskey; -	__be32          ip6_frag_id;  	/*  	 * Warning : all fields before dataref are cleared in __alloc_skb() @@ -569,6 +568,8 @@ enum {  	SKB_GSO_SCTP = 1 << 14,  	SKB_GSO_ESP = 1 << 15, + +	SKB_GSO_UDP = 1 << 16,  };  #if BITS_PER_LONG > 32 @@ -616,6 +617,7 @@ typedef unsigned char *sk_buff_data_t;   *	@nf_trace: netfilter packet trace flag   *	@protocol: Packet protocol from driver   *	@destructor: Destruct function + *	@tcp_tsorted_anchor: list structure for TCP (tp->tsorted_sent_queue)   *	@_nfct: Associated connection, if any (with nfctinfo bits)   *	@nf_bridge: Saved data about a bridged frame - see br_netfilter.c   *	@skb_iif: ifindex of device we arrived on @@ -661,8 +663,12 @@ struct sk_buff {  			struct sk_buff		*prev;  			union { -				ktime_t		tstamp; -				u64		skb_mstamp; +				struct net_device	*dev; +				/* Some protocols might use this space to store information, +				 * while device pointer would be NULL. +				 * UDP receive path is one user. +				 */ +				unsigned long		dev_scratch;  			};  		};  		struct rb_node	rbnode; /* used in netem & tcp stack */ @@ -670,12 +676,8 @@ struct sk_buff {  	struct sock		*sk;  	union { -		struct net_device	*dev; -		/* Some protocols might use this space to store information, -		 * while device pointer would be NULL. -		 * UDP receive path is one user. -		 */ -		unsigned long		dev_scratch; +		ktime_t		tstamp; +		u64		skb_mstamp;  	};  	/*  	 * This is the control buffer. It is free to use for every @@ -685,8 +687,14 @@ struct sk_buff {  	 */  	char			cb[48] __aligned(8); -	unsigned long		_skb_refdst; -	void			(*destructor)(struct sk_buff *skb); +	union { +		struct { +			unsigned long	_skb_refdst; +			void		(*destructor)(struct sk_buff *skb); +		}; +		struct list_head	tcp_tsorted_anchor; +	}; +  #ifdef CONFIG_XFRM  	struct	sec_path	*sp;  #endif @@ -704,7 +712,6 @@ struct sk_buff {  	/* Following fields are _not_ copied in __copy_skb_header()  	 * Note that queue_mapping is here mostly to fill a hole.  	 */ -	kmemcheck_bitfield_begin(flags1);  	__u16			queue_mapping;  /* if you move cloned around you also must adapt those constants */ @@ -723,7 +730,6 @@ struct sk_buff {  				head_frag:1,  				xmit_more:1,  				__unused:1; /* one bit hole */ -	kmemcheck_bitfield_end(flags1);  	/* fields enclosed in headers_start/headers_end are copied  	 * using a single memcpy() in __copy_skb_header() @@ -771,6 +777,7 @@ struct sk_buff {  	__u8			remcsum_offload:1;  #ifdef CONFIG_NET_SWITCHDEV  	__u8			offload_fwd_mark:1; +	__u8			offload_mr_fwd_mark:1;  #endif  #ifdef CONFIG_NET_CLS_ACT  	__u8			tc_skip_classify:1; @@ -1457,27 +1464,8 @@ static inline int skb_header_unclone(struct sk_buff *skb, gfp_t pri)  }  /** - *	skb_header_release - release reference to header - *	@skb: buffer to operate on - * - *	Drop a reference to the header part of the buffer.  This is done - *	by acquiring a payload reference.  You must not read from the header - *	part of skb->data after this. - *	Note : Check if you can use __skb_header_release() instead. - */ -static inline void skb_header_release(struct sk_buff *skb) -{ -	BUG_ON(skb->nohdr); -	skb->nohdr = 1; -	atomic_add(1 << SKB_DATAREF_SHIFT, &skb_shinfo(skb)->dataref); -} - -/**   *	__skb_header_release - release reference to header   *	@skb: buffer to operate on - * - *	Variant of skb_header_release() assuming skb is private to caller. - *	We can avoid one atomic operation.   */  static inline void __skb_header_release(struct sk_buff *skb)  { @@ -2675,7 +2663,7 @@ static inline struct page *__dev_alloc_pages(gfp_t gfp_mask,  	 * 4.  __GFP_MEMALLOC is ignored if __GFP_NOMEMALLOC is set due to  	 *     code in gfp_to_alloc_flags that should be enforcing this.  	 */ -	gfp_mask |= __GFP_COLD | __GFP_COMP | __GFP_MEMALLOC; +	gfp_mask |= __GFP_COMP | __GFP_MEMALLOC;  	return alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);  } @@ -3168,6 +3156,12 @@ static inline int __skb_grow_rcsum(struct sk_buff *skb, unsigned int len)  	return __skb_grow(skb, len);  } +#define rb_to_skb(rb) rb_entry_safe(rb, struct sk_buff, rbnode) +#define skb_rb_first(root) rb_to_skb(rb_first(root)) +#define skb_rb_last(root)  rb_to_skb(rb_last(root)) +#define skb_rb_next(skb)   rb_to_skb(rb_next(&(skb)->rbnode)) +#define skb_rb_prev(skb)   rb_to_skb(rb_prev(&(skb)->rbnode)) +  #define skb_queue_walk(queue, skb) \  		for (skb = (queue)->next;					\  		     skb != (struct sk_buff *)(queue);				\ @@ -3182,6 +3176,18 @@ static inline int __skb_grow_rcsum(struct sk_buff *skb, unsigned int len)  		for (; skb != (struct sk_buff *)(queue);			\  		     skb = skb->next) +#define skb_rbtree_walk(skb, root)						\ +		for (skb = skb_rb_first(root); skb != NULL;			\ +		     skb = skb_rb_next(skb)) + +#define skb_rbtree_walk_from(skb)						\ +		for (; skb != NULL;						\ +		     skb = skb_rb_next(skb)) + +#define skb_rbtree_walk_from_safe(skb, tmp)					\ +		for (; tmp = skb ? skb_rb_next(skb) : NULL, (skb != NULL);	\ +		     skb = tmp) +  #define skb_queue_walk_from_safe(queue, skb, tmp)				\  		for (tmp = skb->next;						\  		     skb != (struct sk_buff *)(queue);				\ @@ -3419,6 +3425,69 @@ static inline ktime_t net_invalid_timestamp(void)  	return 0;  } +static inline u8 skb_metadata_len(const struct sk_buff *skb) +{ +	return skb_shinfo(skb)->meta_len; +} + +static inline void *skb_metadata_end(const struct sk_buff *skb) +{ +	return skb_mac_header(skb); +} + +static inline bool __skb_metadata_differs(const struct sk_buff *skb_a, +					  const struct sk_buff *skb_b, +					  u8 meta_len) +{ +	const void *a = skb_metadata_end(skb_a); +	const void *b = skb_metadata_end(skb_b); +	/* Using more efficient varaiant than plain call to memcmp(). */ +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 +	u64 diffs = 0; + +	switch (meta_len) { +#define __it(x, op) (x -= sizeof(u##op)) +#define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op)) +	case 32: diffs |= __it_diff(a, b, 64); +	case 24: diffs |= __it_diff(a, b, 64); +	case 16: diffs |= __it_diff(a, b, 64); +	case  8: diffs |= __it_diff(a, b, 64); +		break; +	case 28: diffs |= __it_diff(a, b, 64); +	case 20: diffs |= __it_diff(a, b, 64); +	case 12: diffs |= __it_diff(a, b, 64); +	case  4: diffs |= __it_diff(a, b, 32); +		break; +	} +	return diffs; +#else +	return memcmp(a - meta_len, b - meta_len, meta_len); +#endif +} + +static inline bool skb_metadata_differs(const struct sk_buff *skb_a, +					const struct sk_buff *skb_b) +{ +	u8 len_a = skb_metadata_len(skb_a); +	u8 len_b = skb_metadata_len(skb_b); + +	if (!(len_a | len_b)) +		return false; + +	return len_a != len_b ? +	       true : __skb_metadata_differs(skb_a, skb_b, len_a); +} + +static inline void skb_metadata_set(struct sk_buff *skb, u8 meta_len) +{ +	skb_shinfo(skb)->meta_len = meta_len; +} + +static inline void skb_metadata_clear(struct sk_buff *skb) +{ +	skb_metadata_set(skb, 0); +} +  struct sk_buff *skb_clone_sk(struct sk_buff *skb);  #ifdef CONFIG_NETWORK_PHY_TIMESTAMPING @@ -3770,6 +3839,13 @@ static inline void nf_reset_trace(struct sk_buff *skb)  #endif  } +static inline void ipvs_reset(struct sk_buff *skb) +{ +#if IS_ENABLED(CONFIG_IP_VS) +	skb->ipvs_property = 0; +#endif +} +  /* Note: This doesn't put any conntrack and bridge info in dst. */  static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src,  			     bool copy) diff --git a/include/linux/slab.h b/include/linux/slab.h index 41473df6dfb0..50697a1d6621 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk).   * @@ -20,13 +21,20 @@   * Flags to pass to kmem_cache_create().   * The ones marked DEBUG are only valid if CONFIG_DEBUG_SLAB is set.   */ -#define SLAB_CONSISTENCY_CHECKS	0x00000100UL	/* DEBUG: Perform (expensive) checks on alloc/free */ -#define SLAB_RED_ZONE		0x00000400UL	/* DEBUG: Red zone objs in a cache */ -#define SLAB_POISON		0x00000800UL	/* DEBUG: Poison objects */ -#define SLAB_HWCACHE_ALIGN	0x00002000UL	/* Align objs on cache lines */ -#define SLAB_CACHE_DMA		0x00004000UL	/* Use GFP_DMA memory */ -#define SLAB_STORE_USER		0x00010000UL	/* DEBUG: Store the last owner for bug hunting */ -#define SLAB_PANIC		0x00040000UL	/* Panic if kmem_cache_create() fails */ +/* DEBUG: Perform (expensive) checks on alloc/free */ +#define SLAB_CONSISTENCY_CHECKS	((slab_flags_t __force)0x00000100U) +/* DEBUG: Red zone objs in a cache */ +#define SLAB_RED_ZONE		((slab_flags_t __force)0x00000400U) +/* DEBUG: Poison objects */ +#define SLAB_POISON		((slab_flags_t __force)0x00000800U) +/* Align objs on cache lines */ +#define SLAB_HWCACHE_ALIGN	((slab_flags_t __force)0x00002000U) +/* Use GFP_DMA memory */ +#define SLAB_CACHE_DMA		((slab_flags_t __force)0x00004000U) +/* DEBUG: Store the last owner for bug hunting */ +#define SLAB_STORE_USER		((slab_flags_t __force)0x00010000U) +/* Panic if kmem_cache_create() fails */ +#define SLAB_PANIC		((slab_flags_t __force)0x00040000U)  /*   * SLAB_TYPESAFE_BY_RCU - **WARNING** READ THIS!   * @@ -64,44 +72,45 @@   *   * Note that SLAB_TYPESAFE_BY_RCU was originally named SLAB_DESTROY_BY_RCU.   */ -#define SLAB_TYPESAFE_BY_RCU	0x00080000UL	/* Defer freeing slabs to RCU */ -#define SLAB_MEM_SPREAD		0x00100000UL	/* Spread some memory over cpuset */ -#define SLAB_TRACE		0x00200000UL	/* Trace allocations and frees */ +/* Defer freeing slabs to RCU */ +#define SLAB_TYPESAFE_BY_RCU	((slab_flags_t __force)0x00080000U) +/* Spread some memory over cpuset */ +#define SLAB_MEM_SPREAD		((slab_flags_t __force)0x00100000U) +/* Trace allocations and frees */ +#define SLAB_TRACE		((slab_flags_t __force)0x00200000U)  /* Flag to prevent checks on free */  #ifdef CONFIG_DEBUG_OBJECTS -# define SLAB_DEBUG_OBJECTS	0x00400000UL +# define SLAB_DEBUG_OBJECTS	((slab_flags_t __force)0x00400000U)  #else -# define SLAB_DEBUG_OBJECTS	0x00000000UL +# define SLAB_DEBUG_OBJECTS	0  #endif -#define SLAB_NOLEAKTRACE	0x00800000UL	/* Avoid kmemleak tracing */ +/* Avoid kmemleak tracing */ +#define SLAB_NOLEAKTRACE	((slab_flags_t __force)0x00800000U) -/* Don't track use of uninitialized memory */ -#ifdef CONFIG_KMEMCHECK -# define SLAB_NOTRACK		0x01000000UL -#else -# define SLAB_NOTRACK		0x00000000UL -#endif +/* Fault injection mark */  #ifdef CONFIG_FAILSLAB -# define SLAB_FAILSLAB		0x02000000UL	/* Fault injection mark */ +# define SLAB_FAILSLAB		((slab_flags_t __force)0x02000000U)  #else -# define SLAB_FAILSLAB		0x00000000UL +# define SLAB_FAILSLAB		0  #endif +/* Account to memcg */  #if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) -# define SLAB_ACCOUNT		0x04000000UL	/* Account to memcg */ +# define SLAB_ACCOUNT		((slab_flags_t __force)0x04000000U)  #else -# define SLAB_ACCOUNT		0x00000000UL +# define SLAB_ACCOUNT		0  #endif  #ifdef CONFIG_KASAN -#define SLAB_KASAN		0x08000000UL +#define SLAB_KASAN		((slab_flags_t __force)0x08000000U)  #else -#define SLAB_KASAN		0x00000000UL +#define SLAB_KASAN		0  #endif  /* The following flags affect the page allocator grouping pages by mobility */ -#define SLAB_RECLAIM_ACCOUNT	0x00020000UL		/* Objects are reclaimable */ +/* Objects are reclaimable */ +#define SLAB_RECLAIM_ACCOUNT	((slab_flags_t __force)0x00020000U)  #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */  /*   * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. @@ -127,7 +136,7 @@ void __init kmem_cache_init(void);  bool slab_is_available(void);  struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, -			unsigned long, +			slab_flags_t,  			void (*)(void *));  void kmem_cache_destroy(struct kmem_cache *);  int kmem_cache_shrink(struct kmem_cache *); @@ -458,9 +467,6 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)   * Also it is possible to set different flags by OR'ing   * in one or more of the following additional @flags:   * - * %__GFP_COLD - Request cache-cold pages instead of - *   trying to return cache-warm pages. - *   * %__GFP_HIGH - This allocation has high priority and may use emergency pools.   *   * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail @@ -635,6 +641,22 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);  #define kmalloc_track_caller(size, flags) \  	__kmalloc_track_caller(size, flags, _RET_IP_) +static inline void *kmalloc_array_node(size_t n, size_t size, gfp_t flags, +				       int node) +{ +	if (size != 0 && n > SIZE_MAX / size) +		return NULL; +	if (__builtin_constant_p(n) && __builtin_constant_p(size)) +		return kmalloc_node(n * size, flags, node); +	return __kmalloc_node(n * size, flags, node); +} + +static inline void *kcalloc_node(size_t n, size_t size, gfp_t flags, int node) +{ +	return kmalloc_array_node(n, size, flags | __GFP_ZERO, node); +} + +  #ifdef CONFIG_NUMA  extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);  #define kmalloc_node_track_caller(size, flags, node) \ diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 4ad2c5a26399..072e46e9e1d5 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SLAB_DEF_H  #define	_LINUX_SLAB_DEF_H @@ -19,7 +20,7 @@ struct kmem_cache {  	struct reciprocal_value reciprocal_buffer_size;  /* 2) touched by every alloc & free from the backend */ -	unsigned int flags;		/* constant flags */ +	slab_flags_t flags;		/* constant flags */  	unsigned int num;		/* # of objs per slab */  /* 3) cache_grow/shrink */ diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 0783b622311e..0adae162dc8f 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SLUB_DEF_H  #define _LINUX_SLUB_DEF_H @@ -81,7 +82,7 @@ struct kmem_cache_order_objects {  struct kmem_cache {  	struct kmem_cache_cpu __percpu *cpu_slab;  	/* Used for retriving partial slabs etc */ -	unsigned long flags; +	slab_flags_t flags;  	unsigned long min_partial;  	int size;		/* The size of an object including meta data */  	int object_size;	/* The size of an object without meta data */ diff --git a/include/linux/smc911x.h b/include/linux/smc911x.h index 521f37143fae..8cace8189e74 100644 --- a/include/linux/smc911x.h +++ b/include/linux/smc911x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SMC911X_H__  #define __SMC911X_H__ diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h index 129bc674dcf5..f3b195fa78b9 100644 --- a/include/linux/smc91x.h +++ b/include/linux/smc91x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SMC91X_H__  #define __SMC91X_H__ diff --git a/include/linux/smp.h b/include/linux/smp.h index 98b1fe027fc9..9fb239e12b82 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SMP_H  #define __LINUX_SMP_H diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h index c149aa7bedf3..c174844cf663 100644 --- a/include/linux/smpboot.h +++ b/include/linux/smpboot.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SMPBOOT_H  #define _LINUX_SMPBOOT_H diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h index f4bf16e16e16..1a136271ba6a 100644 --- a/include/linux/smscphy.h +++ b/include/linux/smscphy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SMSCPHY_H__  #define __LINUX_SMSCPHY_H__ diff --git a/include/linux/soc/brcmstb/brcmstb.h b/include/linux/soc/brcmstb/brcmstb.h index 337ce414e898..12e548938bbb 100644 --- a/include/linux/soc/brcmstb/brcmstb.h +++ b/include/linux/soc/brcmstb/brcmstb.h @@ -1,10 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __BRCMSTB_SOC_H  #define __BRCMSTB_SOC_H +static inline u32 BRCM_ID(u32 reg) +{ +	return reg >> 28 ? reg >> 16 : reg >> 8; +} + +static inline u32 BRCM_REV(u32 reg) +{ +	return reg & 0xff; +} +  /*   * Bus Interface Unit control register setup, must happen early during boot,   * before SMP is brought up, called by machine entry point.   */  void brcmstb_biuctrl_init(void); +/* + * Helper functions for getting family or product id from the + * SoC driver. + */ +u32 brcmstb_get_family_id(void); +u32 brcmstb_get_product_id(void); +  #endif /* __BRCMSTB_SOC_H */ diff --git a/include/linux/soc/dove/pmu.h b/include/linux/soc/dove/pmu.h index 765386972b55..1955c01deec5 100644 --- a/include/linux/soc/dove/pmu.h +++ b/include/linux/soc/dove/pmu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SOC_DOVE_PMU_H  #define LINUX_SOC_DOVE_PMU_H diff --git a/include/linux/soc/mediatek/infracfg.h b/include/linux/soc/mediatek/infracfg.h index a0182ec2a621..e8d9f0d52933 100644 --- a/include/linux/soc/mediatek/infracfg.h +++ b/include/linux/soc/mediatek/infracfg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SOC_MEDIATEK_INFRACFG_H  #define __SOC_MEDIATEK_INFRACFG_H diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/mdt_loader.h index f423001db3a9..bd8e0864b059 100644 --- a/include/linux/soc/qcom/mdt_loader.h +++ b/include/linux/soc/qcom/mdt_loader.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __QCOM_MDT_LOADER_H__  #define __QCOM_MDT_LOADER_H__ diff --git a/include/linux/soc/qcom/smd-rpm.h b/include/linux/soc/qcom/smd-rpm.h index 2a53dcaeeeed..9f5c6e53f3a5 100644 --- a/include/linux/soc/qcom/smd-rpm.h +++ b/include/linux/soc/qcom/smd-rpm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __QCOM_SMD_RPM_H__  #define __QCOM_SMD_RPM_H__ @@ -26,6 +27,10 @@ struct qcom_smd_rpm;  #define QCOM_SMD_RPM_SMPB	0x62706d73  #define QCOM_SMD_RPM_SPDM	0x63707362  #define QCOM_SMD_RPM_VSA	0x00617376 +#define QCOM_SMD_RPM_MMAXI_CLK	0x69786d6d +#define QCOM_SMD_RPM_IPA_CLK	0x617069 +#define QCOM_SMD_RPM_CE_CLK	0x6563 +#define QCOM_SMD_RPM_AGGR_CLK	0x72676761  int qcom_rpm_smd_write(struct qcom_smd_rpm *rpm,  		       int state, diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h index 785e196ee2ca..c1657ed27b30 100644 --- a/include/linux/soc/qcom/smem.h +++ b/include/linux/soc/qcom/smem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __QCOM_SMEM_H__  #define __QCOM_SMEM_H__ diff --git a/include/linux/soc/qcom/smem_state.h b/include/linux/soc/qcom/smem_state.h index b8478ee7a71f..63ad8cddad14 100644 --- a/include/linux/soc/qcom/smem_state.h +++ b/include/linux/soc/qcom/smem_state.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __QCOM_SMEM_STATE__  #define __QCOM_SMEM_STATE__ diff --git a/include/linux/soc/qcom/wcnss_ctrl.h b/include/linux/soc/qcom/wcnss_ctrl.h index a4dd4d7c711d..bbeb6b9c0221 100644 --- a/include/linux/soc/qcom/wcnss_ctrl.h +++ b/include/linux/soc/qcom/wcnss_ctrl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __WCNSS_CTRL_H__  #define __WCNSS_CTRL_H__ diff --git a/include/linux/soc/renesas/rcar-rst.h b/include/linux/soc/renesas/rcar-rst.h index 2c231f2280a6..7899a5b8c247 100644 --- a/include/linux/soc/renesas/rcar-rst.h +++ b/include/linux/soc/renesas/rcar-rst.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SOC_RENESAS_RCAR_RST_H__  #define __LINUX_SOC_RENESAS_RCAR_RST_H__ diff --git a/include/linux/soc/renesas/rcar-sysc.h b/include/linux/soc/renesas/rcar-sysc.h index 7b8b280c181b..8a6086d2e9c3 100644 --- a/include/linux/soc/renesas/rcar-sysc.h +++ b/include/linux/soc/renesas/rcar-sysc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SOC_RENESAS_RCAR_SYSC_H__  #define __LINUX_SOC_RENESAS_RCAR_SYSC_H__ diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h index a2f8109bb215..15fe980a27ea 100644 --- a/include/linux/sock_diag.h +++ b/include/linux/sock_diag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SOCK_DIAG_H__  #define __SOCK_DIAG_H__ diff --git a/include/linux/socket.h b/include/linux/socket.h index 8ad963cdc88c..9286a5a8c60c 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SOCKET_H  #define _LINUX_SOCKET_H diff --git a/include/linux/sonet.h b/include/linux/sonet.h index 680f9a31df25..2b802b6d12ad 100644 --- a/include/linux/sonet.h +++ b/include/linux/sonet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* sonet.h - SONET/SHD physical layer control */  #ifndef LINUX_SONET_H  #define LINUX_SONET_H diff --git a/include/linux/sony-laptop.h b/include/linux/sony-laptop.h index e2e036d94e4a..1a4b77317fa1 100644 --- a/include/linux/sony-laptop.h +++ b/include/linux/sony-laptop.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SONYLAPTOP_H_  #define _SONYLAPTOP_H_ diff --git a/include/linux/sort.h b/include/linux/sort.h index d534da2b5575..2b99a5dd073d 100644 --- a/include/linux/sort.h +++ b/include/linux/sort.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SORT_H  #define _LINUX_SORT_H diff --git a/include/linux/sound.h b/include/linux/sound.h index 73ded040f1d7..3c6d393c7f29 100644 --- a/include/linux/sound.h +++ b/include/linux/sound.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SOUND_H  #define _LINUX_SOUND_H diff --git a/include/linux/spi/ad7877.h b/include/linux/spi/ad7877.h index cdbed816f25e..b7be843c88e2 100644 --- a/include/linux/spi/ad7877.h +++ b/include/linux/spi/ad7877.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* linux/spi/ad7877.h */  /* Touchscreen characteristics vary between boards and models.  The diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index 2f694f3846a9..1a5eaef3b7f2 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* linux/spi/ads7846.h */  /* Touchscreen characteristics vary between boards and models.  The diff --git a/include/linux/spi/at73c213.h b/include/linux/spi/at73c213.h index 0f20a70e5eb4..cbca6654aa31 100644 --- a/include/linux/spi/at73c213.h +++ b/include/linux/spi/at73c213.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Board-specific data used to set up AT73c213 audio DAC driver.   */ diff --git a/include/linux/spi/corgi_lcd.h b/include/linux/spi/corgi_lcd.h index 6692b3418ccf..edf4beccdadb 100644 --- a/include/linux/spi/corgi_lcd.h +++ b/include/linux/spi/corgi_lcd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SPI_CORGI_LCD_H  #define __LINUX_SPI_CORGI_LCD_H diff --git a/include/linux/spi/ds1305.h b/include/linux/spi/ds1305.h index 287ec830eab7..82db6cd152dc 100644 --- a/include/linux/spi/ds1305.h +++ b/include/linux/spi/ds1305.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SPI_DS1305_H  #define __LINUX_SPI_DS1305_H diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h index e34e169f9dcb..aceccf9c71fb 100644 --- a/include/linux/spi/eeprom.h +++ b/include/linux/spi/eeprom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SPI_EEPROM_H  #define __LINUX_SPI_EEPROM_H diff --git a/include/linux/spi/flash.h b/include/linux/spi/flash.h index f4199e758f97..2401a0887209 100644 --- a/include/linux/spi/flash.h +++ b/include/linux/spi/flash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SPI_FLASH_H  #define LINUX_SPI_FLASH_H diff --git a/include/linux/spi/ifx_modem.h b/include/linux/spi/ifx_modem.h index 394fec9e7722..694268c78d5d 100644 --- a/include/linux/spi/ifx_modem.h +++ b/include/linux/spi/ifx_modem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_IFX_MODEM_H  #define LINUX_IFX_MODEM_H diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h index bcaa2f762cc1..433c20e2f46e 100644 --- a/include/linux/spi/max7301.h +++ b/include/linux/spi/max7301.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SPI_MAX7301_H  #define LINUX_SPI_MAX7301_H diff --git a/include/linux/spi/mc33880.h b/include/linux/spi/mc33880.h index 82ffccd6fbe5..205a49cb99db 100644 --- a/include/linux/spi/mc33880.h +++ b/include/linux/spi/mc33880.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SPI_MC33880_H  #define LINUX_SPI_MC33880_H diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h index 82d96a346e6f..738a45b435f2 100644 --- a/include/linux/spi/mcp23s08.h +++ b/include/linux/spi/mcp23s08.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  struct mcp23s08_platform_data {  	/* For mcp23s08, up to 4 slaves (numbered 0..3) can share one SPI  	 * chipselect, each providing 1 gpio_chip instance with 8 gpios. diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index 274bc0fa00af..bfde741a543d 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SPI_MMC_SPI_H  #define __LINUX_SPI_MMC_SPI_H diff --git a/include/linux/spi/sh_msiof.h b/include/linux/spi/sh_msiof.h index f74b581f242f..dc2a0cbd210d 100644 --- a/include/linux/spi/sh_msiof.h +++ b/include/linux/spi/sh_msiof.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SPI_SH_MSIOF_H__  #define __SPI_SH_MSIOF_H__ diff --git a/include/linux/spi/spi-fsl-dspi.h b/include/linux/spi/spi-fsl-dspi.h new file mode 100644 index 000000000000..74c9bae20bf2 --- /dev/null +++ b/include/linux/spi/spi-fsl-dspi.h @@ -0,0 +1,31 @@ +/* + * Freescale DSPI controller driver + * + * Copyright (c) 2017 Angelo Dureghello <angelo@sysam.it> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef SPI_FSL_DSPI_HEADER_H +#define SPI_FSL_DSPI_HEADER_H + +/** + * struct fsl_dspi_platform_data - platform data for the Freescale DSPI driver + * @bus_num: board specific identifier for this DSPI driver. + * @cs_num: number of chip selects supported by this DSPI driver. + */ +struct fsl_dspi_platform_data { +	u32 cs_num; +	u32 bus_num; +	u32 sck_cs_delay; +	u32 cs_sck_delay; +}; + +#endif /* SPI_FSL_DSPI_HEADER_H */ diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index 154788ed218c..51d8c060e513 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef	__SPI_BITBANG_H  #define	__SPI_BITBANG_H diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h index 1634ce31c06d..e7bd89a59cd1 100644 --- a/include/linux/spi/spi_gpio.h +++ b/include/linux/spi/spi_gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SPI_GPIO_H  #define __LINUX_SPI_GPIO_H diff --git a/include/linux/spi/spi_oc_tiny.h b/include/linux/spi/spi_oc_tiny.h index 1ac529cf4f06..a3ecf2feadf2 100644 --- a/include/linux/spi/spi_oc_tiny.h +++ b/include/linux/spi/spi_oc_tiny.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SPI_SPI_OC_TINY_H  #define _LINUX_SPI_SPI_OC_TINY_H diff --git a/include/linux/spi/tdo24m.h b/include/linux/spi/tdo24m.h index 7572d4e1fe76..48dd58ac5383 100644 --- a/include/linux/spi/tdo24m.h +++ b/include/linux/spi/tdo24m.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __TDO24M_H__  #define __TDO24M_H__ diff --git a/include/linux/spi/xilinx_spi.h b/include/linux/spi/xilinx_spi.h index 333ecdfee0d9..c15d69d28e68 100644 --- a/include/linux/spi/xilinx_spi.h +++ b/include/linux/spi/xilinx_spi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SPI_XILINX_SPI_H  #define __LINUX_SPI_XILINX_SPI_H diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 69e079c5ff98..a39186194cd6 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SPINLOCK_H  #define __LINUX_SPINLOCK_H @@ -165,6 +166,10 @@ static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock)  	arch_spin_lock(&lock->raw_lock);  } +#ifndef arch_spin_lock_flags +#define arch_spin_lock_flags(lock, flags)	arch_spin_lock(lock) +#endif +  static inline void  do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lock)  { @@ -278,12 +283,6 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)  	1 : ({ local_irq_restore(flags); 0; }); \  }) -/** - * raw_spin_can_lock - would raw_spin_trylock() succeed? - * @lock: the spinlock in question. - */ -#define raw_spin_can_lock(lock)	(!raw_spin_is_locked(lock)) -  /* Include rwlock functions */  #include <linux/rwlock.h> @@ -396,11 +395,6 @@ static __always_inline int spin_is_contended(spinlock_t *lock)  	return raw_spin_is_contended(&lock->rlock);  } -static __always_inline int spin_can_lock(spinlock_t *lock) -{ -	return raw_spin_can_lock(&lock->rlock); -} -  #define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)  /* diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h index 612fb530af41..0ac9112c1bbe 100644 --- a/include/linux/spinlock_up.h +++ b/include/linux/spinlock_up.h @@ -32,14 +32,6 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)  	barrier();  } -static inline void -arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) -{ -	local_irq_save(flags); -	lock->slock = 0; -	barrier(); -} -  static inline int arch_spin_trylock(arch_spinlock_t *lock)  {  	char oldval = lock->slock; @@ -77,7 +69,4 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)  #define arch_spin_is_contended(lock)	(((void)(lock), 0)) -#define arch_read_can_lock(lock)	(((void)(lock), 1)) -#define arch_write_can_lock(lock)	(((void)(lock), 1)) -  #endif /* __LINUX_SPINLOCK_UP_H */ diff --git a/include/linux/splice.h b/include/linux/splice.h index db42746bdfea..74b4911ac16d 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Function declerations and data structures related to the splice   * implementation. diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 39af9bc0f653..62be8966e837 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -78,6 +78,7 @@ void synchronize_srcu(struct srcu_struct *sp);  /**   * srcu_read_lock_held - might we be in SRCU read-side critical section? + * @sp: The srcu_struct structure to check   *   * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU   * read-side critical section.  In absence of CONFIG_DEBUG_LOCK_ALLOC, diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 26a0b3c3ce5f..3b43655cabe6 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SSB_H_  #define LINUX_SSB_H_ diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h index 0688472500bb..31593b34608e 100644 --- a/include/linux/ssb/ssb_driver_gige.h +++ b/include/linux/ssb/ssb_driver_gige.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SSB_DRIVER_GIGE_H_  #define LINUX_SSB_DRIVER_GIGE_H_ diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h index 6535e4718fde..bef6bba32dff 100644 --- a/include/linux/ssb/ssb_driver_mips.h +++ b/include/linux/ssb/ssb_driver_mips.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SSB_MIPSCORE_H_  #define LINUX_SSB_MIPSCORE_H_ diff --git a/include/linux/ssb/ssb_driver_pci.h b/include/linux/ssb/ssb_driver_pci.h index 41e330e51c2a..42824bdfe16e 100644 --- a/include/linux/ssb/ssb_driver_pci.h +++ b/include/linux/ssb/ssb_driver_pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SSB_PCICORE_H_  #define LINUX_SSB_PCICORE_H_ diff --git a/include/linux/ssb/ssb_embedded.h b/include/linux/ssb/ssb_embedded.h index 8d8dedff059d..49604ac3db82 100644 --- a/include/linux/ssb/ssb_embedded.h +++ b/include/linux/ssb/ssb_embedded.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SSB_EMBEDDED_H_  #define LINUX_SSB_EMBEDDED_H_ diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index c0f707ac192b..210f46494065 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_SSB_REGS_H_  #define LINUX_SSB_REGS_H_ diff --git a/include/linux/stackprotector.h b/include/linux/stackprotector.h index 6f3e54c704c0..03696c729fb4 100644 --- a/include/linux/stackprotector.h +++ b/include/linux/stackprotector.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_STACKPROTECTOR_H  #define _LINUX_STACKPROTECTOR_H 1 diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index 4205f71a5f0e..ba29a0613e66 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_STACKTRACE_H  #define __LINUX_STACKTRACE_H diff --git a/include/linux/start_kernel.h b/include/linux/start_kernel.h index d3e5f2756545..4b268d86a784 100644 --- a/include/linux/start_kernel.h +++ b/include/linux/start_kernel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_START_KERNEL_H  #define _LINUX_START_KERNEL_H diff --git a/include/linux/stat.h b/include/linux/stat.h index 64b6b3aece21..22484e44544d 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_STAT_H  #define _LINUX_STAT_H diff --git a/include/linux/statfs.h b/include/linux/statfs.h index 0166d320a75d..3142e98546ac 100644 --- a/include/linux/statfs.h +++ b/include/linux/statfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_STATFS_H  #define _LINUX_STATFS_H diff --git a/include/linux/stddef.h b/include/linux/stddef.h index 9c61c7cda936..2181719fd907 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_STDDEF_H  #define _LINUX_STDDEF_H diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 108739ff9223..32feac5bbd75 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -126,14 +126,14 @@ struct stmmac_axi {  struct stmmac_rxq_cfg {  	u8 mode_to_use; -	u8 chan; +	u32 chan;  	u8 pkt_route;  	bool use_prio;  	u32 prio;  };  struct stmmac_txq_cfg { -	u8 weight; +	u32 weight;  	u8 mode_to_use;  	/* Credit Base Shaper parameters */  	u32 send_slope; @@ -168,8 +168,8 @@ struct plat_stmmacenet_data {  	int unicast_filter_entries;  	int tx_fifo_size;  	int rx_fifo_size; -	u8 rx_queues_to_use; -	u8 tx_queues_to_use; +	u32 rx_queues_to_use; +	u32 tx_queues_to_use;  	u8 rx_sched_algorithm;  	u8 tx_sched_algorithm;  	struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES]; diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index 3d60275e3ba9..6d3635c86dbe 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_STOP_MACHINE  #define _LINUX_STOP_MACHINE diff --git a/include/linux/string.h b/include/linux/string.h index 54d21783e18d..410ecf17de3c 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_STRING_H_  #define _LINUX_STRING_H_ diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index 5ce9538f290e..4397c52ec4a4 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_STRING_HELPERS_H_  #define _LINUX_STRING_HELPERS_H_ diff --git a/include/linux/stringhash.h b/include/linux/stringhash.h index 7c2d95170d01..e8f0f852968f 100644 --- a/include/linux/stringhash.h +++ b/include/linux/stringhash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_STRINGHASH_H  #define __LINUX_STRINGHASH_H diff --git a/include/linux/sungem_phy.h b/include/linux/sungem_phy.h index bd9be9f59d3a..3a11fa41a131 100644 --- a/include/linux/sungem_phy.h +++ b/include/linux/sungem_phy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SUNGEM_PHY_H__  #define __SUNGEM_PHY_H__ diff --git a/include/linux/sunrpc/addr.h b/include/linux/sunrpc/addr.h index 5c9c6cd08d3b..07d454873b6d 100644 --- a/include/linux/sunrpc/addr.h +++ b/include/linux/sunrpc/addr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/addr.h   * diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 8fd3504946ad..d9af474a857d 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/auth.h   * diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h index cebdf8745901..0c9eac351aab 100644 --- a/include/linux/sunrpc/auth_gss.h +++ b/include/linux/sunrpc/auth_gss.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/auth_gss.h   * diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 55ef67bea06b..71c237e8240e 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  linux/include/linux/sunrpc/clnt.h   * diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index 8da0f37f3bdc..f6aeed07fe04 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/debug.h   * diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h index 68ec78c1aa48..5ac5db4d295f 100644 --- a/include/linux/sunrpc/gss_api.h +++ b/include/linux/sunrpc/gss_api.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/gss_api.h   * diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h index 694eecb2f1b5..9baed7b355b2 100644 --- a/include/linux/sunrpc/metrics.h +++ b/include/linux/sunrpc/metrics.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  linux/include/linux/sunrpc/metrics.h   * diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h index 59cbf16eaeb5..4722b28ec36a 100644 --- a/include/linux/sunrpc/msg_prot.h +++ b/include/linux/sunrpc/msg_prot.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/msg_prot.h   * diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index 7f490bef9e99..a5704daf5df9 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H  #define _LINUX_SUNRPC_RPC_PIPE_FS_H diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h index b7e85b341a54..8f144db73e38 100644 --- a/include/linux/sunrpc/rpc_rdma.h +++ b/include/linux/sunrpc/rpc_rdma.h @@ -1,4 +1,5 @@  /* + * Copyright (c) 2015-2017 Oracle. All rights reserved.   * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved.   *   * This software is available to you under a choice of one of two @@ -50,65 +51,6 @@ enum {  	RPCRDMA_V1_DEF_INLINE_SIZE	= 1024,  }; -struct rpcrdma_segment { -	__be32 rs_handle;	/* Registered memory handle */ -	__be32 rs_length;	/* Length of the chunk in bytes */ -	__be64 rs_offset;	/* Chunk virtual address or offset */ -}; - -/* - * read chunk(s), encoded as a linked list. - */ -struct rpcrdma_read_chunk { -	__be32 rc_discrim;	/* 1 indicates presence */ -	__be32 rc_position;	/* Position in XDR stream */ -	struct rpcrdma_segment rc_target; -}; - -/* - * write chunk, and reply chunk. - */ -struct rpcrdma_write_chunk { -	struct rpcrdma_segment wc_target; -}; - -/* - * write chunk(s), encoded as a counted array. - */ -struct rpcrdma_write_array { -	__be32 wc_discrim;	/* 1 indicates presence */ -	__be32 wc_nchunks;	/* Array count */ -	struct rpcrdma_write_chunk wc_array[0]; -}; - -struct rpcrdma_msg { -	__be32 rm_xid;	/* Mirrors the RPC header xid */ -	__be32 rm_vers;	/* Version of this protocol */ -	__be32 rm_credit;	/* Buffers requested/granted */ -	__be32 rm_type;	/* Type of message (enum rpcrdma_proc) */ -	union { - -		struct {			/* no chunks */ -			__be32 rm_empty[3];	/* 3 empty chunk lists */ -		} rm_nochunks; - -		struct {			/* no chunks and padded */ -			__be32 rm_align;	/* Padding alignment */ -			__be32 rm_thresh;	/* Padding threshold */ -			__be32 rm_pempty[3];	/* 3 empty chunk lists */ -		} rm_padded; - -		struct { -			__be32 rm_err; -			__be32 rm_vers_low; -			__be32 rm_vers_high; -		} rm_error; - -		__be32 rm_chunks[0];	/* read, write and reply chunks */ - -	} rm_body; -}; -  /*   * XDR sizes, in quads   */ diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index c1768f9d993b..d96e74e114c0 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/sched.h   * diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h index edc64219f92b..84b92b4ad1c0 100644 --- a/include/linux/sunrpc/stats.h +++ b/include/linux/sunrpc/stats.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/stats.h   * diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 38f561b2dda3..786ae2255f05 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/svc.h   * @@ -46,6 +47,7 @@ struct svc_pool {  	struct svc_pool_stats	sp_stats;	/* statistics on pool operation */  #define	SP_TASK_PENDING		(0)		/* still work to do even if no  						 * xprt is queued. */ +#define SP_CONGESTED		(1)  	unsigned long		sp_flags;  } ____cacheline_aligned_in_smp; diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index 6a2ad38f5458..1caf7bc83306 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/svc_xprt.h   * diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h index d03932055328..7c3656505847 100644 --- a/include/linux/sunrpc/svcauth.h +++ b/include/linux/sunrpc/svcauth.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/svcauth.h   * diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h index 726aff1a5201..a4528b26c8aa 100644 --- a/include/linux/sunrpc/svcauth_gss.h +++ b/include/linux/sunrpc/svcauth_gss.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/svcauth_gss.h   * diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 2e780134f449..119718a922f2 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/svcsock.h   * diff --git a/include/linux/sunrpc/timer.h b/include/linux/sunrpc/timer.h index 697d6e69d61f..242dbe00b5ff 100644 --- a/include/linux/sunrpc/timer.h +++ b/include/linux/sunrpc/timer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  linux/include/linux/sunrpc/timer.h   * diff --git a/include/linux/sunrpc/types.h b/include/linux/sunrpc/types.h index 11a7536c0fd2..bd3c8e05632b 100644 --- a/include/linux/sunrpc/types.h +++ b/include/linux/sunrpc/types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/include/linux/sunrpc/types.h   * diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 86b59e3525a5..d950223c64b1 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * XDR standard data types and function declarations   * diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 5a7bff41f6b7..7fad83881ce1 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  linux/include/linux/sunrpc/xprt.h   * diff --git a/include/linux/sunrpc/xprtmultipath.h b/include/linux/sunrpc/xprtmultipath.h index 507418c1c69e..af1257c030d2 100644 --- a/include/linux/sunrpc/xprtmultipath.h +++ b/include/linux/sunrpc/xprtmultipath.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * RPC client multipathing definitions   * diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h index c9959d7e3579..ae0f99b9b965 100644 --- a/include/linux/sunrpc/xprtsock.h +++ b/include/linux/sunrpc/xprtsock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  linux/include/linux/sunrpc/xprtsock.h   * diff --git a/include/linux/sunserialcore.h b/include/linux/sunserialcore.h index dbe4d7fca1b8..c12d1c7fa42b 100644 --- a/include/linux/sunserialcore.h +++ b/include/linux/sunserialcore.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* sunserialcore.h   *   * Generic SUN serial/kbd/ms layer.  Based entirely diff --git a/include/linux/suspend.h b/include/linux/suspend.h index d10b7980799d..d60b0f5c38d5 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SUSPEND_H  #define _LINUX_SUSPEND_H diff --git a/include/linux/svga.h b/include/linux/svga.h index bfa68e837d6a..3bfe4626953d 100644 --- a/include/linux/svga.h +++ b/include/linux/svga.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SVGA_H  #define _LINUX_SVGA_H diff --git a/include/linux/sw842.h b/include/linux/sw842.h index 109ba041c2ae..3e29f5dcc62b 100644 --- a/include/linux/sw842.h +++ b/include/linux/sw842.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SW842_H__  #define __SW842_H__ diff --git a/include/linux/swab.h b/include/linux/swab.h index 9ad3c60f6cae..e466fd159c85 100644 --- a/include/linux/swab.h +++ b/include/linux/swab.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SWAB_H  #define _LINUX_SWAB_H diff --git a/include/linux/swait.h b/include/linux/swait.h index 73e97a08d3d0..c98aaf677466 100644 --- a/include/linux/swait.h +++ b/include/linux/swait.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SWAIT_H  #define _LINUX_SWAIT_H @@ -9,13 +10,16 @@  /*   * Simple wait queues   * - * While these are very similar to the other/complex wait queues (wait.h) the - * most important difference is that the simple waitqueue allows for - * deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold - * times. + * While these are very similar to regular wait queues (wait.h) the most + * important difference is that the simple waitqueue allows for deterministic + * behaviour -- IOW it has strictly bounded IRQ and lock hold times.   * - * In order to make this so, we had to drop a fair number of features of the - * other waitqueue code; notably: + * Mainly, this is accomplished by two things. Firstly not allowing swake_up_all + * from IRQ disabled, and dropping the lock upon every wakeup, giving a higher + * priority task a chance to run. + * + * Secondly, we had to drop a fair number of features of the other waitqueue + * code; notably:   *   *  - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue;   *    all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right @@ -24,12 +28,14 @@   *  - the exclusive mode; because this requires preserving the list order   *    and this is hard.   * - *  - custom wake functions; because you cannot give any guarantees about - *    random code. - * - * As a side effect of this; the data structures are slimmer. + *  - custom wake callback functions; because you cannot give any guarantees + *    about random code. This also allows swait to be used in RT, such that + *    raw spinlock can be used for the swait queue head.   * - * One would recommend using this wait queue where possible. + * As a side effect of these; the data structures are slimmer albeit more ad-hoc. + * For all the above, note that simple wait queues should _only_ be used under + * very specific realtime constraints -- it is best to stick with the regular + * wait queues in most cases.   */  struct task_struct; diff --git a/include/linux/swap.h b/include/linux/swap.h index 8a807292037f..c2b8128799c1 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SWAP_H  #define _LINUX_SWAP_H @@ -170,8 +171,9 @@ enum {  	SWP_AREA_DISCARD = (1 << 8),	/* single-time swap area discards */  	SWP_PAGE_DISCARD = (1 << 9),	/* freed swap page-cluster discards */  	SWP_STABLE_WRITES = (1 << 10),	/* no overwrite PG_writeback pages */ +	SWP_SYNCHRONOUS_IO = (1 << 11),	/* synchronous IO is efficient */  					/* add others here before... */ -	SWP_SCANNING	= (1 << 11),	/* refcount in scan_swap_map */ +	SWP_SCANNING	= (1 << 12),	/* refcount in scan_swap_map */  };  #define SWAP_CLUSTER_MAX 32UL @@ -265,6 +267,10 @@ struct swap_info_struct {  					 * both locks need hold, hold swap_lock  					 * first.  					 */ +	spinlock_t cont_lock;		/* +					 * protect swap count continuation page +					 * list. +					 */  	struct work_struct discard_work; /* discard worker */  	struct swap_cluster_list discard_clusters; /* discard clusters list */  }; @@ -292,7 +298,18 @@ struct vma_swap_readahead {  void *workingset_eviction(struct address_space *mapping, struct page *page);  bool workingset_refault(void *shadow);  void workingset_activation(struct page *page); -void workingset_update_node(struct radix_tree_node *node, void *private); + +/* Do not use directly, use workingset_lookup_update */ +void workingset_update_node(struct radix_tree_node *node); + +/* Returns workingset_update_node() if the mapping has shadow entries. */ +#define workingset_lookup_update(mapping)				\ +({									\ +	radix_tree_update_node_t __helper = workingset_update_node;	\ +	if (dax_mapping(mapping) || shmem_mapping(mapping))		\ +		__helper = NULL;					\ +	__helper;							\ +})  /* linux/mm/page_alloc.c */  extern unsigned long totalram_pages; @@ -457,9 +474,11 @@ extern unsigned int count_swap_pages(int, int);  extern sector_t map_swap_page(struct page *, struct block_device **);  extern sector_t swapdev_block(int, pgoff_t);  extern int page_swapcount(struct page *); +extern int __swap_count(struct swap_info_struct *si, swp_entry_t entry);  extern int __swp_swapcount(swp_entry_t entry);  extern int swp_swapcount(swp_entry_t entry);  extern struct swap_info_struct *page_swap_info(struct page *); +extern struct swap_info_struct *swp_swap_info(swp_entry_t entry);  extern bool reuse_swap_page(struct page *, int *);  extern int try_to_free_swap(struct page *);  struct backing_dev_info; @@ -468,6 +487,16 @@ extern void exit_swap_address_space(unsigned int type);  #else /* CONFIG_SWAP */ +static inline int swap_readpage(struct page *page, bool do_poll) +{ +	return 0; +} + +static inline struct swap_info_struct *swp_swap_info(swp_entry_t entry) +{ +	return NULL; +} +  #define swap_address_space(entry)		(NULL)  #define get_nr_swap_pages()			0L  #define total_swap_pages			0L @@ -481,7 +510,7 @@ extern void exit_swap_address_space(unsigned int type);  #define free_page_and_swap_cache(page) \  	put_page(page)  #define free_pages_and_swap_cache(pages, nr) \ -	release_pages((pages), (nr), false); +	release_pages((pages), (nr));  static inline void show_swap_cache_info(void)  { @@ -572,6 +601,11 @@ static inline int page_swapcount(struct page *page)  	return 0;  } +static inline int __swap_count(struct swap_info_struct *si, swp_entry_t entry) +{ +	return 0; +} +  static inline int __swp_swapcount(swp_entry_t entry)  {  	return 0; diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h index b2b8ec7bda3f..a12dd1c3966c 100644 --- a/include/linux/swap_cgroup.h +++ b/include/linux/swap_cgroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SWAP_CGROUP_H  #define __LINUX_SWAP_CGROUP_H diff --git a/include/linux/swap_slots.h b/include/linux/swap_slots.h index 6ef92d17633d..e36b200c2a77 100644 --- a/include/linux/swap_slots.h +++ b/include/linux/swap_slots.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SWAP_SLOTS_H  #define _LINUX_SWAP_SLOTS_H diff --git a/include/linux/swapfile.h b/include/linux/swapfile.h index 388293a91e8c..06bd7b096167 100644 --- a/include/linux/swapfile.h +++ b/include/linux/swapfile.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SWAPFILE_H  #define _LINUX_SWAPFILE_H diff --git a/include/linux/swapops.h b/include/linux/swapops.h index 291c4b534658..9c5a2628d6ce 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SWAPOPS_H  #define _LINUX_SWAPOPS_H diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 15e7160751a8..24ed817082ee 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SWIOTLB_H  #define __LINUX_SWIOTLB_H diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h new file mode 100644 index 000000000000..09d73d0d1aa8 --- /dev/null +++ b/include/linux/switchtec.h @@ -0,0 +1,373 @@ +/* + * Microsemi Switchtec PCIe Driver + * Copyright (c) 2017, Microsemi Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for + * more details. + * + */ + +#ifndef _SWITCHTEC_H +#define _SWITCHTEC_H + +#include <linux/pci.h> +#include <linux/cdev.h> + +#define MICROSEMI_VENDOR_ID         0x11f8 +#define MICROSEMI_NTB_CLASSCODE     0x068000 +#define MICROSEMI_MGMT_CLASSCODE    0x058000 + +#define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024 +#define SWITCHTEC_MAX_PFF_CSR 48 + +#define SWITCHTEC_EVENT_OCCURRED BIT(0) +#define SWITCHTEC_EVENT_CLEAR    BIT(0) +#define SWITCHTEC_EVENT_EN_LOG   BIT(1) +#define SWITCHTEC_EVENT_EN_CLI   BIT(2) +#define SWITCHTEC_EVENT_EN_IRQ   BIT(3) +#define SWITCHTEC_EVENT_FATAL    BIT(4) + +enum { +	SWITCHTEC_GAS_MRPC_OFFSET       = 0x0000, +	SWITCHTEC_GAS_TOP_CFG_OFFSET    = 0x1000, +	SWITCHTEC_GAS_SW_EVENT_OFFSET   = 0x1800, +	SWITCHTEC_GAS_SYS_INFO_OFFSET   = 0x2000, +	SWITCHTEC_GAS_FLASH_INFO_OFFSET = 0x2200, +	SWITCHTEC_GAS_PART_CFG_OFFSET   = 0x4000, +	SWITCHTEC_GAS_NTB_OFFSET        = 0x10000, +	SWITCHTEC_GAS_PFF_CSR_OFFSET    = 0x134000, +}; + +struct mrpc_regs { +	u8 input_data[SWITCHTEC_MRPC_PAYLOAD_SIZE]; +	u8 output_data[SWITCHTEC_MRPC_PAYLOAD_SIZE]; +	u32 cmd; +	u32 status; +	u32 ret_value; +} __packed; + +enum mrpc_status { +	SWITCHTEC_MRPC_STATUS_INPROGRESS = 1, +	SWITCHTEC_MRPC_STATUS_DONE = 2, +	SWITCHTEC_MRPC_STATUS_ERROR = 0xFF, +	SWITCHTEC_MRPC_STATUS_INTERRUPTED = 0x100, +}; + +struct sw_event_regs { +	u64 event_report_ctrl; +	u64 reserved1; +	u64 part_event_bitmap; +	u64 reserved2; +	u32 global_summary; +	u32 reserved3[3]; +	u32 stack_error_event_hdr; +	u32 stack_error_event_data; +	u32 reserved4[4]; +	u32 ppu_error_event_hdr; +	u32 ppu_error_event_data; +	u32 reserved5[4]; +	u32 isp_error_event_hdr; +	u32 isp_error_event_data; +	u32 reserved6[4]; +	u32 sys_reset_event_hdr; +	u32 reserved7[5]; +	u32 fw_exception_hdr; +	u32 reserved8[5]; +	u32 fw_nmi_hdr; +	u32 reserved9[5]; +	u32 fw_non_fatal_hdr; +	u32 reserved10[5]; +	u32 fw_fatal_hdr; +	u32 reserved11[5]; +	u32 twi_mrpc_comp_hdr; +	u32 twi_mrpc_comp_data; +	u32 reserved12[4]; +	u32 twi_mrpc_comp_async_hdr; +	u32 twi_mrpc_comp_async_data; +	u32 reserved13[4]; +	u32 cli_mrpc_comp_hdr; +	u32 cli_mrpc_comp_data; +	u32 reserved14[4]; +	u32 cli_mrpc_comp_async_hdr; +	u32 cli_mrpc_comp_async_data; +	u32 reserved15[4]; +	u32 gpio_interrupt_hdr; +	u32 gpio_interrupt_data; +	u32 reserved16[4]; +} __packed; + +enum { +	SWITCHTEC_CFG0_RUNNING = 0x04, +	SWITCHTEC_CFG1_RUNNING = 0x05, +	SWITCHTEC_IMG0_RUNNING = 0x03, +	SWITCHTEC_IMG1_RUNNING = 0x07, +}; + +struct sys_info_regs { +	u32 device_id; +	u32 device_version; +	u32 firmware_version; +	u32 reserved1; +	u32 vendor_table_revision; +	u32 table_format_version; +	u32 partition_id; +	u32 cfg_file_fmt_version; +	u16 cfg_running; +	u16 img_running; +	u32 reserved2[57]; +	char vendor_id[8]; +	char product_id[16]; +	char product_revision[4]; +	char component_vendor[8]; +	u16 component_id; +	u8 component_revision; +} __packed; + +struct flash_info_regs { +	u32 flash_part_map_upd_idx; + +	struct active_partition_info { +		u32 address; +		u32 build_version; +		u32 build_string; +	} active_img; + +	struct active_partition_info active_cfg; +	struct active_partition_info inactive_img; +	struct active_partition_info inactive_cfg; + +	u32 flash_length; + +	struct partition_info { +		u32 address; +		u32 length; +	} cfg0; + +	struct partition_info cfg1; +	struct partition_info img0; +	struct partition_info img1; +	struct partition_info nvlog; +	struct partition_info vendor[8]; +}; + +enum { +	SWITCHTEC_NTB_REG_INFO_OFFSET   = 0x0000, +	SWITCHTEC_NTB_REG_CTRL_OFFSET   = 0x4000, +	SWITCHTEC_NTB_REG_DBMSG_OFFSET  = 0x64000, +}; + +struct ntb_info_regs { +	u8  partition_count; +	u8  partition_id; +	u16 reserved1; +	u64 ep_map; +	u16 requester_id; +} __packed; + +struct part_cfg_regs { +	u32 status; +	u32 state; +	u32 port_cnt; +	u32 usp_port_mode; +	u32 usp_pff_inst_id; +	u32 vep_pff_inst_id; +	u32 dsp_pff_inst_id[47]; +	u32 reserved1[11]; +	u16 vep_vector_number; +	u16 usp_vector_number; +	u32 port_event_bitmap; +	u32 reserved2[3]; +	u32 part_event_summary; +	u32 reserved3[3]; +	u32 part_reset_hdr; +	u32 part_reset_data[5]; +	u32 mrpc_comp_hdr; +	u32 mrpc_comp_data[5]; +	u32 mrpc_comp_async_hdr; +	u32 mrpc_comp_async_data[5]; +	u32 dyn_binding_hdr; +	u32 dyn_binding_data[5]; +	u32 reserved4[159]; +} __packed; + +enum { +	NTB_CTRL_PART_OP_LOCK = 0x1, +	NTB_CTRL_PART_OP_CFG = 0x2, +	NTB_CTRL_PART_OP_RESET = 0x3, + +	NTB_CTRL_PART_STATUS_NORMAL = 0x1, +	NTB_CTRL_PART_STATUS_LOCKED = 0x2, +	NTB_CTRL_PART_STATUS_LOCKING = 0x3, +	NTB_CTRL_PART_STATUS_CONFIGURING = 0x4, +	NTB_CTRL_PART_STATUS_RESETTING = 0x5, + +	NTB_CTRL_BAR_VALID = 1 << 0, +	NTB_CTRL_BAR_DIR_WIN_EN = 1 << 4, +	NTB_CTRL_BAR_LUT_WIN_EN = 1 << 5, + +	NTB_CTRL_REQ_ID_EN = 1 << 0, + +	NTB_CTRL_LUT_EN = 1 << 0, + +	NTB_PART_CTRL_ID_PROT_DIS = 1 << 0, +}; + +struct ntb_ctrl_regs { +	u32 partition_status; +	u32 partition_op; +	u32 partition_ctrl; +	u32 bar_setup; +	u32 bar_error; +	u16 lut_table_entries; +	u16 lut_table_offset; +	u32 lut_error; +	u16 req_id_table_size; +	u16 req_id_table_offset; +	u32 req_id_error; +	u32 reserved1[7]; +	struct { +		u32 ctl; +		u32 win_size; +		u64 xlate_addr; +	} bar_entry[6]; +	u32 reserved2[216]; +	u32 req_id_table[256]; +	u32 reserved3[512]; +	u64 lut_entry[512]; +} __packed; + +#define NTB_DBMSG_IMSG_STATUS BIT_ULL(32) +#define NTB_DBMSG_IMSG_MASK   BIT_ULL(40) + +struct ntb_dbmsg_regs { +	u32 reserved1[1024]; +	u64 odb; +	u64 odb_mask; +	u64 idb; +	u64 idb_mask; +	u8  idb_vec_map[64]; +	u32 msg_map; +	u32 reserved2; +	struct { +		u32 msg; +		u32 status; +	} omsg[4]; + +	struct { +		u32 msg; +		u8  status; +		u8  mask; +		u8  src; +		u8  reserved; +	} imsg[4]; + +	u8 reserved3[3928]; +	u8 msix_table[1024]; +	u8 reserved4[3072]; +	u8 pba[24]; +	u8 reserved5[4072]; +} __packed; + +enum { +	SWITCHTEC_PART_CFG_EVENT_RESET = 1 << 0, +	SWITCHTEC_PART_CFG_EVENT_MRPC_CMP = 1 << 1, +	SWITCHTEC_PART_CFG_EVENT_MRPC_ASYNC_CMP = 1 << 2, +	SWITCHTEC_PART_CFG_EVENT_DYN_PART_CMP = 1 << 3, +}; + +struct pff_csr_regs { +	u16 vendor_id; +	u16 device_id; +	u32 pci_cfg_header[15]; +	u32 pci_cap_region[48]; +	u32 pcie_cap_region[448]; +	u32 indirect_gas_window[128]; +	u32 indirect_gas_window_off; +	u32 reserved[127]; +	u32 pff_event_summary; +	u32 reserved2[3]; +	u32 aer_in_p2p_hdr; +	u32 aer_in_p2p_data[5]; +	u32 aer_in_vep_hdr; +	u32 aer_in_vep_data[5]; +	u32 dpc_hdr; +	u32 dpc_data[5]; +	u32 cts_hdr; +	u32 cts_data[5]; +	u32 reserved3[6]; +	u32 hotplug_hdr; +	u32 hotplug_data[5]; +	u32 ier_hdr; +	u32 ier_data[5]; +	u32 threshold_hdr; +	u32 threshold_data[5]; +	u32 power_mgmt_hdr; +	u32 power_mgmt_data[5]; +	u32 tlp_throttling_hdr; +	u32 tlp_throttling_data[5]; +	u32 force_speed_hdr; +	u32 force_speed_data[5]; +	u32 credit_timeout_hdr; +	u32 credit_timeout_data[5]; +	u32 link_state_hdr; +	u32 link_state_data[5]; +	u32 reserved4[174]; +} __packed; + +struct switchtec_ntb; + +struct switchtec_dev { +	struct pci_dev *pdev; +	struct device dev; +	struct cdev cdev; + +	int partition; +	int partition_count; +	int pff_csr_count; +	char pff_local[SWITCHTEC_MAX_PFF_CSR]; + +	void __iomem *mmio; +	struct mrpc_regs __iomem *mmio_mrpc; +	struct sw_event_regs __iomem *mmio_sw_event; +	struct sys_info_regs __iomem *mmio_sys_info; +	struct flash_info_regs __iomem *mmio_flash_info; +	struct ntb_info_regs __iomem *mmio_ntb; +	struct part_cfg_regs __iomem *mmio_part_cfg; +	struct part_cfg_regs __iomem *mmio_part_cfg_all; +	struct pff_csr_regs __iomem *mmio_pff_csr; + +	/* +	 * The mrpc mutex must be held when accessing the other +	 * mrpc_ fields, alive flag and stuser->state field +	 */ +	struct mutex mrpc_mutex; +	struct list_head mrpc_queue; +	int mrpc_busy; +	struct work_struct mrpc_work; +	struct delayed_work mrpc_timeout; +	bool alive; + +	wait_queue_head_t event_wq; +	atomic_t event_cnt; + +	struct work_struct link_event_work; +	void (*link_notifier)(struct switchtec_dev *stdev); +	u8 link_event_count[SWITCHTEC_MAX_PFF_CSR]; + +	struct switchtec_ntb *sndev; +}; + +static inline struct switchtec_dev *to_stdev(struct device *dev) +{ +	return container_of(dev, struct switchtec_dev, dev); +} + +extern struct class *switchtec_class; + +#endif diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h index 0ad87c434ae6..790ca021203a 100644 --- a/include/linux/sync_file.h +++ b/include/linux/sync_file.h @@ -25,8 +25,12 @@   * @file:		file representing this fence   * @sync_file_list:	membership in global file list   * @wq:			wait queue for fence signaling + * @flags:		flags for the sync_file   * @fence:		fence with the fences in the sync_file   * @cb:			fence callback information + * + * flags: + * POLL_ENABLED: whether userspace is currently poll()'ing or not   */  struct sync_file {  	struct file		*file; diff --git a/include/linux/sys.h b/include/linux/sys.h index daa6008bfdc8..3ebd9812f2e6 100644 --- a/include/linux/sys.h +++ b/include/linux/sys.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SYS_H  #define _LINUX_SYS_H diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 1d4dba490fb6..992bc9948232 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * sysctl.h: General linux system control interface   * @@ -50,6 +51,9 @@ extern int proc_dointvec_minmax(struct ctl_table *, int,  extern int proc_douintvec_minmax(struct ctl_table *table, int write,  				 void __user *buffer, size_t *lenp,  				 loff_t *ppos); +extern int proc_dopipe_max_size(struct ctl_table *table, int write, +				void __user *buffer, size_t *lenp, +				loff_t *ppos);  extern int proc_dointvec_jiffies(struct ctl_table *, int,  				 void __user *, size_t *, loff_t *);  extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int, @@ -212,6 +216,11 @@ static inline struct ctl_table_header *register_sysctl_paths(  	return NULL;  } +static inline struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table) +{ +	return NULL; +} +  static inline void unregister_sysctl_table(struct ctl_table_header * table)  {  } diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index aa02c328dff5..e32dfe098e82 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * sysfs.h - definitions for the device driver filesystem   * diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h index 387fa7d05c98..8c71874e8485 100644 --- a/include/linux/sysrq.h +++ b/include/linux/sysrq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* -*- linux-c -*-   *   *	$Id: sysrq.h,v 1.3 1997/07/17 11:54:33 mj Exp $ diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index e47d6d90023d..5cf77dbb8d86 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_SYSV_FS_H  #define _LINUX_SYSV_FS_H diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h index 635a3c5706bd..c6aa8a3c42ed 100644 --- a/include/linux/t10-pi.h +++ b/include/linux/t10-pi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_T10_PI_H  #define _LINUX_T10_PI_H diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h index bdf855c2856f..6f6acce064de 100644 --- a/include/linux/task_io_accounting.h +++ b/include/linux/task_io_accounting.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * task_io_accounting: a structure which is used for recording a single task's   * IO statistics. diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h index 4d090f9ee608..bb5498bcdd96 100644 --- a/include/linux/task_io_accounting_ops.h +++ b/include/linux/task_io_accounting_ops.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Task I/O accounting operations   */ diff --git a/include/linux/task_work.h b/include/linux/task_work.h index ca5a1cf27dae..bd9a6a91c097 100644 --- a/include/linux/task_work.h +++ b/include/linux/task_work.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TASK_WORK_H  #define _LINUX_TASK_WORK_H diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h index e2a5daf8d14f..dbb4d124c7d7 100644 --- a/include/linux/taskstats_kern.h +++ b/include/linux/taskstats_kern.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* taskstats_kern.h - kernel header for per-task statistics interface   *   * Copyright (C) Shailabh Nagar, IBM Corp. 2006 diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 4aa40ef02d32..df5d97a85e1a 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -85,7 +85,6 @@ struct tcp_sack_block {  /*These are used to set the sack_ok field in struct tcp_options_received */  #define TCP_SACK_SEEN     (1 << 0)   /*1 = peer is SACK capable, */ -#define TCP_FACK_ENABLED  (1 << 1)   /*1 = FACK is enabled locally*/  #define TCP_DSACK_SEEN    (1 << 2)   /*1 = DSACK was received from peer*/  struct tcp_options_received { @@ -98,7 +97,8 @@ struct tcp_options_received {  		tstamp_ok : 1,	/* TIMESTAMP seen on SYN packet		*/  		dsack : 1,	/* D-SACK is scheduled			*/  		wscale_ok : 1,	/* Wscale seen on SYN packet		*/ -		sack_ok : 4,	/* SACK seen on SYN packet		*/ +		sack_ok : 3,	/* SACK seen on SYN packet		*/ +		smc_ok : 1,	/* SMC seen on SYN packet		*/  		snd_wscale : 4,	/* Window scaling received from sender	*/  		rcv_wscale : 4;	/* Window scaling to send to receiver	*/  	u8	num_sacks;	/* Number of SACK blocks		*/ @@ -110,6 +110,9 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt)  {  	rx_opt->tstamp_ok = rx_opt->sack_ok = 0;  	rx_opt->wscale_ok = rx_opt->snd_wscale = 0; +#if IS_ENABLED(CONFIG_SMC) +	rx_opt->smc_ok = 0; +#endif  }  /* This is the max number of SACKS that we'll generate and process. It's safe @@ -191,6 +194,7 @@ struct tcp_sock {  	u32	tsoffset;	/* timestamp offset */  	struct list_head tsq_node; /* anchor in tsq_tasklet.head list */ +	struct list_head tsorted_sent_queue; /* time-sorted sent but un-SACKed skbs */  	u32	snd_wl1;	/* Sequence for window update		*/  	u32	snd_wnd;	/* The window we expect to receive	*/ @@ -205,8 +209,13 @@ struct tcp_sock {  		u64 mstamp; /* (Re)sent time of the skb */  		u32 rtt_us;  /* Associated RTT */  		u32 end_seq; /* Ending TCP sequence of the skb */ -		u8 advanced; /* mstamp advanced since last lost marking */ -		u8 reord;    /* reordering detected */ +		u32 last_delivered; /* tp->delivered at last reo_wnd adj */ +		u8 reo_wnd_steps;   /* Allowed reordering window */ +#define TCP_RACK_RECOVERY_THRESH 16 +		u8 reo_wnd_persist:5, /* No. of recovery since last adj */ +		   dsack_seen:1, /* Whether DSACK seen after last adj */ +		   advanced:1,	 /* mstamp advanced since last lost marking */ +		   reord:1;	 /* reordering detected */  	} rack;  	u16	advmss;		/* Advertised MSS			*/  	u32	chrono_start;	/* Start time in jiffies of a TCP chrono */ @@ -214,7 +223,8 @@ struct tcp_sock {  	u8	chrono_type:2,	/* current chronograph type */  		rate_app_limited:1,  /* rate_{delivered,interval_us} limited? */  		fastopen_connect:1, /* FASTOPEN_CONNECT sockopt */ -		unused:4; +		fastopen_no_cookie:1, /* Allow send/recv SYN+data without a cookie */ +		unused:3;  	u8	nonagle     : 4,/* Disable Nagle algorithm?             */  		thin_lto    : 1,/* Use linear timeouts for thin streams */  		unused1	    : 1, @@ -227,7 +237,8 @@ struct tcp_sock {  		syn_fastopen_ch:1, /* Active TFO re-enabling probe */  		syn_data_acked:1,/* data in SYN is acked by SYN-ACK */  		save_syn:1,	/* Save headers of SYN packet */ -		is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */ +		is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */ +		syn_smc:1;	/* SYN includes SMC */  	u32	tlp_high_seq;	/* snd_nxt at the time of TLP retransmit. */  /* RTT measurement */ @@ -282,7 +293,6 @@ struct tcp_sock {  	u32	pushed_seq;	/* Last pushed seq, required to talk to windows */  	u32	lost_out;	/* Lost packets			*/  	u32	sacked_out;	/* SACK'd packets			*/ -	u32	fackets_out;	/* FACK'd packets			*/  	struct hrtimer	pacing_timer; diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h index cfaee869146f..0494db3fd9e8 100644 --- a/include/linux/textsearch.h +++ b/include/linux/textsearch.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_TEXTSEARCH_H  #define __LINUX_TEXTSEARCH_H diff --git a/include/linux/textsearch_fsm.h b/include/linux/textsearch_fsm.h index fdfa078c66e5..b57231ff652f 100644 --- a/include/linux/textsearch_fsm.h +++ b/include/linux/textsearch_fsm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_TEXTSEARCH_FSM_H  #define __LINUX_TEXTSEARCH_FSM_H diff --git a/include/linux/thermal.h b/include/linux/thermal.h index fd5b959c753c..8c5302374eaa 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -488,7 +488,7 @@ static inline int power_actor_set_power(struct thermal_cooling_device *cdev,  static inline struct thermal_zone_device *thermal_zone_device_register(  	const char *type, int trips, int mask, void *devdata,  	struct thermal_zone_device_ops *ops, -	const struct thermal_zone_params *tzp, +	struct thermal_zone_params *tzp,  	int passive_delay, int polling_delay)  { return ERR_PTR(-ENODEV); }  static inline void thermal_zone_device_unregister( diff --git a/include/linux/thinkpad_acpi.h b/include/linux/thinkpad_acpi.h index 361de59a2285..9fb317970c01 100644 --- a/include/linux/thinkpad_acpi.h +++ b/include/linux/thinkpad_acpi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __THINKPAD_ACPI_H__  #define __THINKPAD_ACPI_H__ diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 905d769d8ddc..34f053a150a9 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* thread_info.h: common low-level thread information accessors   *   * Copyright (C) 2002  David Howells (dhowells@redhat.com) @@ -42,11 +43,10 @@ enum {  #define THREAD_ALIGN	THREAD_SIZE  #endif -#ifdef CONFIG_DEBUG_STACK_USAGE -# define THREADINFO_GFP		(GFP_KERNEL_ACCOUNT | __GFP_NOTRACK | \ -				 __GFP_ZERO) +#if IS_ENABLED(CONFIG_DEBUG_STACK_USAGE) || IS_ENABLED(CONFIG_DEBUG_KMEMLEAK) +# define THREADINFO_GFP		(GFP_KERNEL_ACCOUNT | __GFP_ZERO)  #else -# define THREADINFO_GFP		(GFP_KERNEL_ACCOUNT | __GFP_NOTRACK) +# define THREADINFO_GFP		(GFP_KERNEL_ACCOUNT)  #endif  /* diff --git a/include/linux/threads.h b/include/linux/threads.h index 383ab9592bec..3086dba525e2 100644 --- a/include/linux/threads.h +++ b/include/linux/threads.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_THREADS_H  #define _LINUX_THREADS_H diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h new file mode 100644 index 000000000000..7b69853188b1 --- /dev/null +++ b/include/linux/thunderbolt.h @@ -0,0 +1,598 @@ +/* + * Thunderbolt service API + * + * Copyright (C) 2014 Andreas Noever <andreas.noever@gmail.com> + * Copyright (C) 2017, Intel Corporation + * Authors: Michael Jamet <michael.jamet@intel.com> + *          Mika Westerberg <mika.westerberg@linux.intel.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef THUNDERBOLT_H_ +#define THUNDERBOLT_H_ + +#include <linux/device.h> +#include <linux/idr.h> +#include <linux/list.h> +#include <linux/mutex.h> +#include <linux/mod_devicetable.h> +#include <linux/pci.h> +#include <linux/uuid.h> +#include <linux/workqueue.h> + +enum tb_cfg_pkg_type { +	TB_CFG_PKG_READ = 1, +	TB_CFG_PKG_WRITE = 2, +	TB_CFG_PKG_ERROR = 3, +	TB_CFG_PKG_NOTIFY_ACK = 4, +	TB_CFG_PKG_EVENT = 5, +	TB_CFG_PKG_XDOMAIN_REQ = 6, +	TB_CFG_PKG_XDOMAIN_RESP = 7, +	TB_CFG_PKG_OVERRIDE = 8, +	TB_CFG_PKG_RESET = 9, +	TB_CFG_PKG_ICM_EVENT = 10, +	TB_CFG_PKG_ICM_CMD = 11, +	TB_CFG_PKG_ICM_RESP = 12, +	TB_CFG_PKG_PREPARE_TO_SLEEP = 13, +}; + +/** + * enum tb_security_level - Thunderbolt security level + * @TB_SECURITY_NONE: No security, legacy mode + * @TB_SECURITY_USER: User approval required at minimum + * @TB_SECURITY_SECURE: One time saved key required at minimum + * @TB_SECURITY_DPONLY: Only tunnel Display port (and USB) + */ +enum tb_security_level { +	TB_SECURITY_NONE, +	TB_SECURITY_USER, +	TB_SECURITY_SECURE, +	TB_SECURITY_DPONLY, +}; + +/** + * struct tb - main thunderbolt bus structure + * @dev: Domain device + * @lock: Big lock. Must be held when accessing any struct + *	  tb_switch / struct tb_port. + * @nhi: Pointer to the NHI structure + * @ctl: Control channel for this domain + * @wq: Ordered workqueue for all domain specific work + * @root_switch: Root switch of this domain + * @cm_ops: Connection manager specific operations vector + * @index: Linux assigned domain number + * @security_level: Current security level + * @privdata: Private connection manager specific data + */ +struct tb { +	struct device dev; +	struct mutex lock; +	struct tb_nhi *nhi; +	struct tb_ctl *ctl; +	struct workqueue_struct *wq; +	struct tb_switch *root_switch; +	const struct tb_cm_ops *cm_ops; +	int index; +	enum tb_security_level security_level; +	unsigned long privdata[0]; +}; + +extern struct bus_type tb_bus_type; +extern struct device_type tb_service_type; +extern struct device_type tb_xdomain_type; + +#define TB_LINKS_PER_PHY_PORT	2 + +static inline unsigned int tb_phy_port_from_link(unsigned int link) +{ +	return (link - 1) / TB_LINKS_PER_PHY_PORT; +} + +/** + * struct tb_property_dir - XDomain property directory + * @uuid: Directory UUID or %NULL if root directory + * @properties: List of properties in this directory + * + * User needs to provide serialization if needed. + */ +struct tb_property_dir { +	const uuid_t *uuid; +	struct list_head properties; +}; + +enum tb_property_type { +	TB_PROPERTY_TYPE_UNKNOWN = 0x00, +	TB_PROPERTY_TYPE_DIRECTORY = 0x44, +	TB_PROPERTY_TYPE_DATA = 0x64, +	TB_PROPERTY_TYPE_TEXT = 0x74, +	TB_PROPERTY_TYPE_VALUE = 0x76, +}; + +#define TB_PROPERTY_KEY_SIZE	8 + +/** + * struct tb_property - XDomain property + * @list: Used to link properties together in a directory + * @key: Key for the property (always terminated). + * @type: Type of the property + * @length: Length of the property data in dwords + * @value: Property value + * + * Users use @type to determine which field in @value is filled. + */ +struct tb_property { +	struct list_head list; +	char key[TB_PROPERTY_KEY_SIZE + 1]; +	enum tb_property_type type; +	size_t length; +	union { +		struct tb_property_dir *dir; +		u8 *data; +		char *text; +		u32 immediate; +	} value; +}; + +struct tb_property_dir *tb_property_parse_dir(const u32 *block, +					      size_t block_len); +ssize_t tb_property_format_dir(const struct tb_property_dir *dir, u32 *block, +			       size_t block_len); +struct tb_property_dir *tb_property_create_dir(const uuid_t *uuid); +void tb_property_free_dir(struct tb_property_dir *dir); +int tb_property_add_immediate(struct tb_property_dir *parent, const char *key, +			      u32 value); +int tb_property_add_data(struct tb_property_dir *parent, const char *key, +			 const void *buf, size_t buflen); +int tb_property_add_text(struct tb_property_dir *parent, const char *key, +			 const char *text); +int tb_property_add_dir(struct tb_property_dir *parent, const char *key, +			struct tb_property_dir *dir); +void tb_property_remove(struct tb_property *tb_property); +struct tb_property *tb_property_find(struct tb_property_dir *dir, +			const char *key, enum tb_property_type type); +struct tb_property *tb_property_get_next(struct tb_property_dir *dir, +					 struct tb_property *prev); + +#define tb_property_for_each(dir, property)			\ +	for (property = tb_property_get_next(dir, NULL);	\ +	     property;						\ +	     property = tb_property_get_next(dir, property)) + +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); + +/** + * struct tb_xdomain - Cross-domain (XDomain) connection + * @dev: XDomain device + * @tb: Pointer to the domain + * @remote_uuid: UUID of the remote domain (host) + * @local_uuid: Cached local UUID + * @route: Route string the other domain can be reached + * @vendor: Vendor ID of the remote domain + * @device: Device ID of the demote domain + * @lock: Lock to serialize access to the following fields of this structure + * @vendor_name: Name of the vendor (or %NULL if not known) + * @device_name: Name of the device (or %NULL if not known) + * @is_unplugged: The XDomain is unplugged + * @resume: The XDomain is being resumed + * @transmit_path: HopID which the remote end expects us to transmit + * @transmit_ring: Local ring (hop) where outgoing packets are pushed + * @receive_path: HopID which we expect the remote end to transmit + * @receive_ring: Local ring (hop) where incoming packets arrive + * @service_ids: Used to generate IDs for the services + * @properties: Properties exported by the remote domain + * @property_block_gen: Generation of @properties + * @properties_lock: Lock protecting @properties. + * @get_properties_work: Work used to get remote domain properties + * @properties_retries: Number of times left to read properties + * @properties_changed_work: Work used to notify the remote domain that + *			     our properties have changed + * @properties_changed_retries: Number of times left to send properties + *				changed notification + * @link: Root switch link the remote domain is connected (ICM only) + * @depth: Depth in the chain the remote domain is connected (ICM only) + * + * This structure represents connection across two domains (hosts). + * Each XDomain contains zero or more services which are exposed as + * &struct tb_service objects. + * + * Service drivers may access this structure if they need to enumerate + * non-standard properties but they need hold @lock when doing so + * because properties can be changed asynchronously in response to + * changes in the remote domain. + */ +struct tb_xdomain { +	struct device dev; +	struct tb *tb; +	uuid_t *remote_uuid; +	const uuid_t *local_uuid; +	u64 route; +	u16 vendor; +	u16 device; +	struct mutex lock; +	const char *vendor_name; +	const char *device_name; +	bool is_unplugged; +	bool resume; +	u16 transmit_path; +	u16 transmit_ring; +	u16 receive_path; +	u16 receive_ring; +	struct ida service_ids; +	struct tb_property_dir *properties; +	u32 property_block_gen; +	struct delayed_work get_properties_work; +	int properties_retries; +	struct delayed_work properties_changed_work; +	int properties_changed_retries; +	u8 link; +	u8 depth; +}; + +int tb_xdomain_enable_paths(struct tb_xdomain *xd, u16 transmit_path, +			    u16 transmit_ring, u16 receive_path, +			    u16 receive_ring); +int tb_xdomain_disable_paths(struct tb_xdomain *xd); +struct tb_xdomain *tb_xdomain_find_by_uuid(struct tb *tb, const uuid_t *uuid); + +static inline struct tb_xdomain * +tb_xdomain_find_by_uuid_locked(struct tb *tb, const uuid_t *uuid) +{ +	struct tb_xdomain *xd; + +	mutex_lock(&tb->lock); +	xd = tb_xdomain_find_by_uuid(tb, uuid); +	mutex_unlock(&tb->lock); + +	return xd; +} + +static inline struct tb_xdomain *tb_xdomain_get(struct tb_xdomain *xd) +{ +	if (xd) +		get_device(&xd->dev); +	return xd; +} + +static inline void tb_xdomain_put(struct tb_xdomain *xd) +{ +	if (xd) +		put_device(&xd->dev); +} + +static inline bool tb_is_xdomain(const struct device *dev) +{ +	return dev->type == &tb_xdomain_type; +} + +static inline struct tb_xdomain *tb_to_xdomain(struct device *dev) +{ +	if (tb_is_xdomain(dev)) +		return container_of(dev, struct tb_xdomain, dev); +	return NULL; +} + +int tb_xdomain_response(struct tb_xdomain *xd, const void *response, +			size_t size, enum tb_cfg_pkg_type type); +int tb_xdomain_request(struct tb_xdomain *xd, const void *request, +		       size_t request_size, enum tb_cfg_pkg_type request_type, +		       void *response, size_t response_size, +		       enum tb_cfg_pkg_type response_type, +		       unsigned int timeout_msec); + +/** + * tb_protocol_handler - Protocol specific handler + * @uuid: XDomain messages with this UUID are dispatched to this handler + * @callback: Callback called with the XDomain message. Returning %1 + *	      here tells the XDomain core that the message was handled + *	      by this handler and should not be forwared to other + *	      handlers. + * @data: Data passed with the callback + * @list: Handlers are linked using this + * + * Thunderbolt services can hook into incoming XDomain requests by + * registering protocol handler. Only limitation is that the XDomain + * discovery protocol UUID cannot be registered since it is handled by + * the core XDomain code. + * + * The @callback must check that the message is really directed to the + * service the driver implements. + */ +struct tb_protocol_handler { +	const uuid_t *uuid; +	int (*callback)(const void *buf, size_t size, void *data); +	void *data; +	struct list_head list; +}; + +int tb_register_protocol_handler(struct tb_protocol_handler *handler); +void tb_unregister_protocol_handler(struct tb_protocol_handler *handler); + +/** + * struct tb_service - Thunderbolt service + * @dev: XDomain device + * @id: ID of the service (shown in sysfs) + * @key: Protocol key from the properties directory + * @prtcid: Protocol ID from the properties directory + * @prtcvers: Protocol version from the properties directory + * @prtcrevs: Protocol software revision from the properties directory + * @prtcstns: Protocol settings mask from the properties directory + * + * Each domain exposes set of services it supports as collection of + * properties. For each service there will be one corresponding + * &struct tb_service. Service drivers are bound to these. + */ +struct tb_service { +	struct device dev; +	int id; +	const char *key; +	u32 prtcid; +	u32 prtcvers; +	u32 prtcrevs; +	u32 prtcstns; +}; + +static inline struct tb_service *tb_service_get(struct tb_service *svc) +{ +	if (svc) +		get_device(&svc->dev); +	return svc; +} + +static inline void tb_service_put(struct tb_service *svc) +{ +	if (svc) +		put_device(&svc->dev); +} + +static inline bool tb_is_service(const struct device *dev) +{ +	return dev->type == &tb_service_type; +} + +static inline struct tb_service *tb_to_service(struct device *dev) +{ +	if (tb_is_service(dev)) +		return container_of(dev, struct tb_service, dev); +	return NULL; +} + +/** + * tb_service_driver - Thunderbolt service driver + * @driver: Driver structure + * @probe: Called when the driver is probed + * @remove: Called when the driver is removed (optional) + * @shutdown: Called at shutdown time to stop the service (optional) + * @id_table: Table of service identifiers the driver supports + */ +struct tb_service_driver { +	struct device_driver driver; +	int (*probe)(struct tb_service *svc, const struct tb_service_id *id); +	void (*remove)(struct tb_service *svc); +	void (*shutdown)(struct tb_service *svc); +	const struct tb_service_id *id_table; +}; + +#define TB_SERVICE(key, id)				\ +	.match_flags = TBSVC_MATCH_PROTOCOL_KEY |	\ +		       TBSVC_MATCH_PROTOCOL_ID,		\ +	.protocol_key = (key),				\ +	.protocol_id = (id) + +int tb_register_service_driver(struct tb_service_driver *drv); +void tb_unregister_service_driver(struct tb_service_driver *drv); + +static inline void *tb_service_get_drvdata(const struct tb_service *svc) +{ +	return dev_get_drvdata(&svc->dev); +} + +static inline void tb_service_set_drvdata(struct tb_service *svc, void *data) +{ +	dev_set_drvdata(&svc->dev, data); +} + +static inline struct tb_xdomain *tb_service_parent(struct tb_service *svc) +{ +	return tb_to_xdomain(svc->dev.parent); +} + +/** + * struct tb_nhi - thunderbolt native host interface + * @lock: Must be held during ring creation/destruction. Is acquired by + *	  interrupt_work when dispatching interrupts to individual rings. + * @pdev: Pointer to the PCI device + * @iobase: MMIO space of the NHI + * @tx_rings: All Tx rings available on this host controller + * @rx_rings: All Rx rings available on this host controller + * @msix_ida: Used to allocate MSI-X vectors for rings + * @going_away: The host controller device is about to disappear so when + *		this flag is set, avoid touching the hardware anymore. + * @interrupt_work: Work scheduled to handle ring interrupt when no + *		    MSI-X is used. + * @hop_count: Number of rings (end point hops) supported by NHI. + */ +struct tb_nhi { +	spinlock_t lock; +	struct pci_dev *pdev; +	void __iomem *iobase; +	struct tb_ring **tx_rings; +	struct tb_ring **rx_rings; +	struct ida msix_ida; +	bool going_away; +	struct work_struct interrupt_work; +	u32 hop_count; +}; + +/** + * struct tb_ring - thunderbolt TX or RX ring associated with a NHI + * @lock: Lock serializing actions to this ring. Must be acquired after + *	  nhi->lock. + * @nhi: Pointer to the native host controller interface + * @size: Size of the ring + * @hop: Hop (DMA channel) associated with this ring + * @head: Head of the ring (write next descriptor here) + * @tail: Tail of the ring (complete next descriptor here) + * @descriptors: Allocated descriptors for this ring + * @queue: Queue holding frames to be transferred over this ring + * @in_flight: Queue holding frames that are currently in flight + * @work: Interrupt work structure + * @is_tx: Is the ring Tx or Rx + * @running: Is the ring running + * @irq: MSI-X irq number if the ring uses MSI-X. %0 otherwise. + * @vector: MSI-X vector number the ring uses (only set if @irq is > 0) + * @flags: Ring specific flags + * @sof_mask: Bit mask used to detect start of frame PDF + * @eof_mask: Bit mask used to detect end of frame PDF + * @start_poll: Called when ring interrupt is triggered to start + *		polling. Passing %NULL keeps the ring in interrupt mode. + * @poll_data: Data passed to @start_poll + */ +struct tb_ring { +	spinlock_t lock; +	struct tb_nhi *nhi; +	int size; +	int hop; +	int head; +	int tail; +	struct ring_desc *descriptors; +	dma_addr_t descriptors_dma; +	struct list_head queue; +	struct list_head in_flight; +	struct work_struct work; +	bool is_tx:1; +	bool running:1; +	int irq; +	u8 vector; +	unsigned int flags; +	u16 sof_mask; +	u16 eof_mask; +	void (*start_poll)(void *data); +	void *poll_data; +}; + +/* Leave ring interrupt enabled on suspend */ +#define RING_FLAG_NO_SUSPEND	BIT(0) +/* Configure the ring to be in frame mode */ +#define RING_FLAG_FRAME		BIT(1) +/* Enable end-to-end flow control */ +#define RING_FLAG_E2E		BIT(2) + +struct ring_frame; +typedef void (*ring_cb)(struct tb_ring *, struct ring_frame *, bool canceled); + +/** + * enum ring_desc_flags - Flags for DMA ring descriptor + * %RING_DESC_ISOCH: Enable isonchronous DMA (Tx only) + * %RING_DESC_CRC_ERROR: In frame mode CRC check failed for the frame (Rx only) + * %RING_DESC_COMPLETED: Descriptor completed (set by NHI) + * %RING_DESC_POSTED: Always set this + * %RING_DESC_BUFFER_OVERRUN: RX buffer overrun + * %RING_DESC_INTERRUPT: Request an interrupt on completion + */ +enum ring_desc_flags { +	RING_DESC_ISOCH = 0x1, +	RING_DESC_CRC_ERROR = 0x1, +	RING_DESC_COMPLETED = 0x2, +	RING_DESC_POSTED = 0x4, +	RING_DESC_BUFFER_OVERRUN = 0x04, +	RING_DESC_INTERRUPT = 0x8, +}; + +/** + * struct ring_frame - For use with ring_rx/ring_tx + * @buffer_phy: DMA mapped address of the frame + * @callback: Callback called when the frame is finished (optional) + * @list: Frame is linked to a queue using this + * @size: Size of the frame in bytes (%0 means %4096) + * @flags: Flags for the frame (see &enum ring_desc_flags) + * @eof: End of frame protocol defined field + * @sof: Start of frame protocol defined field + */ +struct ring_frame { +	dma_addr_t buffer_phy; +	ring_cb callback; +	struct list_head list; +	u32 size:12; +	u32 flags:12; +	u32 eof:4; +	u32 sof:4; +}; + +/* Minimum size for ring_rx */ +#define TB_FRAME_SIZE		0x100 + +struct tb_ring *tb_ring_alloc_tx(struct tb_nhi *nhi, int hop, int size, +				 unsigned int flags); +struct tb_ring *tb_ring_alloc_rx(struct tb_nhi *nhi, int hop, int size, +				 unsigned int flags, u16 sof_mask, u16 eof_mask, +				 void (*start_poll)(void *), void *poll_data); +void tb_ring_start(struct tb_ring *ring); +void tb_ring_stop(struct tb_ring *ring); +void tb_ring_free(struct tb_ring *ring); + +int __tb_ring_enqueue(struct tb_ring *ring, struct ring_frame *frame); + +/** + * tb_ring_rx() - enqueue a frame on an RX ring + * @ring: Ring to enqueue the frame + * @frame: Frame to enqueue + * + * @frame->buffer, @frame->buffer_phy have to be set. The buffer must + * contain at least %TB_FRAME_SIZE bytes. + * + * @frame->callback will be invoked with @frame->size, @frame->flags, + * @frame->eof, @frame->sof set once the frame has been received. + * + * If ring_stop() is called after the packet has been enqueued + * @frame->callback will be called with canceled set to true. + * + * Return: Returns %-ESHUTDOWN if ring_stop has been called. Zero otherwise. + */ +static inline int tb_ring_rx(struct tb_ring *ring, struct ring_frame *frame) +{ +	WARN_ON(ring->is_tx); +	return __tb_ring_enqueue(ring, frame); +} + +/** + * tb_ring_tx() - enqueue a frame on an TX ring + * @ring: Ring the enqueue the frame + * @frame: Frame to enqueue + * + * @frame->buffer, @frame->buffer_phy, @frame->size, @frame->eof and + * @frame->sof have to be set. + * + * @frame->callback will be invoked with once the frame has been transmitted. + * + * If ring_stop() is called after the packet has been enqueued @frame->callback + * will be called with canceled set to true. + * + * Return: Returns %-ESHUTDOWN if ring_stop has been called. Zero otherwise. + */ +static inline int tb_ring_tx(struct tb_ring *ring, struct ring_frame *frame) +{ +	WARN_ON(!ring->is_tx); +	return __tb_ring_enqueue(ring, frame); +} + +/* Used only when the ring is in polling mode */ +struct ring_frame *tb_ring_poll(struct tb_ring *ring); +void tb_ring_poll_complete(struct tb_ring *ring); + +/** + * tb_ring_dma_device() - Return device used for DMA mapping + * @ring: Ring whose DMA device is retrieved + * + * Use this function when you are mapping DMA for buffers that are + * passed to the ring for sending/receiving. + */ +static inline struct device *tb_ring_dma_device(struct tb_ring *ring) +{ +	return &ring->nhi->pdev->dev; +} + +#endif /* THUNDERBOLT_H_ */ diff --git a/include/linux/tick.h b/include/linux/tick.h index fe01e68bf520..f442d1a42025 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Tick related global functions   */ @@ -137,7 +138,6 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }  #ifdef CONFIG_NO_HZ_FULL  extern bool tick_nohz_full_running;  extern cpumask_var_t tick_nohz_full_mask; -extern cpumask_var_t housekeeping_mask;  static inline bool tick_nohz_full_enabled(void)  { @@ -161,11 +161,6 @@ static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask)  		cpumask_or(mask, mask, tick_nohz_full_mask);  } -static inline int housekeeping_any_cpu(void) -{ -	return cpumask_any_and(housekeeping_mask, cpu_online_mask); -} -  extern void tick_nohz_dep_set(enum tick_dep_bits bit);  extern void tick_nohz_dep_clear(enum tick_dep_bits bit);  extern void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit); @@ -234,11 +229,8 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal,  extern void tick_nohz_full_kick_cpu(int cpu);  extern void __tick_nohz_task_switch(void); +extern void __init tick_nohz_full_setup(cpumask_var_t cpumask);  #else -static inline int housekeeping_any_cpu(void) -{ -	return smp_processor_id(); -}  static inline bool tick_nohz_full_enabled(void) { return false; }  static inline bool tick_nohz_full_cpu(int cpu) { return false; }  static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { } @@ -258,35 +250,9 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal,  static inline void tick_nohz_full_kick_cpu(int cpu) { }  static inline void __tick_nohz_task_switch(void) { } +static inline void tick_nohz_full_setup(cpumask_var_t cpumask) { }  #endif -static inline const struct cpumask *housekeeping_cpumask(void) -{ -#ifdef CONFIG_NO_HZ_FULL -	if (tick_nohz_full_enabled()) -		return housekeeping_mask; -#endif -	return cpu_possible_mask; -} - -static inline bool is_housekeeping_cpu(int cpu) -{ -#ifdef CONFIG_NO_HZ_FULL -	if (tick_nohz_full_enabled()) -		return cpumask_test_cpu(cpu, housekeeping_mask); -#endif -	return true; -} - -static inline void housekeeping_affine(struct task_struct *t) -{ -#ifdef CONFIG_NO_HZ_FULL -	if (tick_nohz_full_enabled()) -		set_cpus_allowed_ptr(t, housekeeping_mask); - -#endif -} -  static inline void tick_nohz_task_switch(void)  {  	if (tick_nohz_full_enabled()) diff --git a/include/linux/time.h b/include/linux/time.h index 9bc1f945777c..4b62a2c0a661 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TIME_H  #define _LINUX_TIME_H @@ -17,149 +18,10 @@ int get_itimerspec64(struct itimerspec64 *it,  int put_itimerspec64(const struct itimerspec64 *it,  			struct itimerspec __user *uit); -#define TIME_T_MAX	(time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) - -static inline int timespec_equal(const struct timespec *a, -                                 const struct timespec *b) -{ -	return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); -} - -/* - * lhs < rhs:  return <0 - * lhs == rhs: return 0 - * lhs > rhs:  return >0 - */ -static inline int timespec_compare(const struct timespec *lhs, const struct timespec *rhs) -{ -	if (lhs->tv_sec < rhs->tv_sec) -		return -1; -	if (lhs->tv_sec > rhs->tv_sec) -		return 1; -	return lhs->tv_nsec - rhs->tv_nsec; -} - -static inline int timeval_compare(const struct timeval *lhs, const struct timeval *rhs) -{ -	if (lhs->tv_sec < rhs->tv_sec) -		return -1; -	if (lhs->tv_sec > rhs->tv_sec) -		return 1; -	return lhs->tv_usec - rhs->tv_usec; -} -  extern time64_t mktime64(const unsigned int year, const unsigned int mon,  			const unsigned int day, const unsigned int hour,  			const unsigned int min, const unsigned int sec); -/** - * Deprecated. Use mktime64(). - */ -static inline unsigned long mktime(const unsigned int year, -			const unsigned int mon, const unsigned int day, -			const unsigned int hour, const unsigned int min, -			const unsigned int sec) -{ -	return mktime64(year, mon, day, hour, min, sec); -} - -extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); - -/* - * timespec_add_safe assumes both values are positive and checks - * for overflow. It will return TIME_T_MAX if the reutrn would be - * smaller then either of the arguments. - */ -extern struct timespec timespec_add_safe(const struct timespec lhs, -					 const struct timespec rhs); - - -static inline struct timespec timespec_add(struct timespec lhs, -						struct timespec rhs) -{ -	struct timespec ts_delta; -	set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec, -				lhs.tv_nsec + rhs.tv_nsec); -	return ts_delta; -} - -/* - * sub = lhs - rhs, in normalized form - */ -static inline struct timespec timespec_sub(struct timespec lhs, -						struct timespec rhs) -{ -	struct timespec ts_delta; -	set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec, -				lhs.tv_nsec - rhs.tv_nsec); -	return ts_delta; -} - -/* - * Returns true if the timespec is norm, false if denorm: - */ -static inline bool timespec_valid(const struct timespec *ts) -{ -	/* Dates before 1970 are bogus */ -	if (ts->tv_sec < 0) -		return false; -	/* Can't have more nanoseconds then a second */ -	if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC) -		return false; -	return true; -} - -static inline bool timespec_valid_strict(const struct timespec *ts) -{ -	if (!timespec_valid(ts)) -		return false; -	/* Disallow values that could overflow ktime_t */ -	if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) -		return false; -	return true; -} - -static inline bool timeval_valid(const struct timeval *tv) -{ -	/* Dates before 1970 are bogus */ -	if (tv->tv_sec < 0) -		return false; - -	/* Can't have more microseconds then a second */ -	if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC) -		return false; - -	return true; -} - -extern struct timespec timespec_trunc(struct timespec t, unsigned gran); - -/* - * Validates if a timespec/timeval used to inject a time offset is valid. - * Offsets can be postive or negative. The value of the timeval/timespec - * is the sum of its fields, but *NOTE*: the field tv_usec/tv_nsec must - * always be non-negative. - */ -static inline bool timeval_inject_offset_valid(const struct timeval *tv) -{ -	/* We don't check the tv_sec as it can be positive or negative */ - -	/* Can't have more microseconds then a second */ -	if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC) -		return false; -	return true; -} - -static inline bool timespec_inject_offset_valid(const struct timespec *ts) -{ -	/* We don't check the tv_sec as it can be positive or negative */ - -	/* Can't have more nanoseconds then a second */ -	if (ts->tv_nsec < 0 || ts->tv_nsec >= NSEC_PER_SEC) -		return false; -	return true; -} -  /* Some architectures do not supply their own clocksource.   * This is mainly the case in architectures that get their   * inter-tick times by reading the counter on their interval @@ -208,73 +70,7 @@ struct tm {  void time64_to_tm(time64_t totalsecs, int offset, struct tm *result); -/** - * time_to_tm - converts the calendar time to local broken-down time - * - * @totalsecs	the number of seconds elapsed since 00:00:00 on January 1, 1970, - *		Coordinated Universal Time (UTC). - * @offset	offset seconds adding to totalsecs. - * @result	pointer to struct tm variable to receive broken-down time - */ -static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result) -{ -	time64_to_tm(totalsecs, offset, result); -} - -/** - * timespec_to_ns - Convert timespec to nanoseconds - * @ts:		pointer to the timespec variable to be converted - * - * Returns the scalar nanosecond representation of the timespec - * parameter. - */ -static inline s64 timespec_to_ns(const struct timespec *ts) -{ -	return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; -} - -/** - * timeval_to_ns - Convert timeval to nanoseconds - * @ts:		pointer to the timeval variable to be converted - * - * Returns the scalar nanosecond representation of the timeval - * parameter. - */ -static inline s64 timeval_to_ns(const struct timeval *tv) -{ -	return ((s64) tv->tv_sec * NSEC_PER_SEC) + -		tv->tv_usec * NSEC_PER_USEC; -} - -/** - * ns_to_timespec - Convert nanoseconds to timespec - * @nsec:	the nanoseconds value to be converted - * - * Returns the timespec representation of the nsec parameter. - */ -extern struct timespec ns_to_timespec(const s64 nsec); - -/** - * ns_to_timeval - Convert nanoseconds to timeval - * @nsec:	the nanoseconds value to be converted - * - * Returns the timeval representation of the nsec parameter. - */ -extern struct timeval ns_to_timeval(const s64 nsec); - -/** - * timespec_add_ns - Adds nanoseconds to a timespec - * @a:		pointer to timespec to be incremented - * @ns:		unsigned nanoseconds value to be added - * - * This must always be inlined because its used from the x86-64 vdso, - * which cannot call other kernel functions. - */ -static __always_inline void timespec_add_ns(struct timespec *a, u64 ns) -{ -	a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns); -	a->tv_nsec = ns; -} +# include <linux/time32.h>  static inline bool itimerspec64_valid(const struct itimerspec64 *its)  { diff --git a/include/linux/time32.h b/include/linux/time32.h new file mode 100644 index 000000000000..65b1de25198d --- /dev/null +++ b/include/linux/time32.h @@ -0,0 +1,221 @@ +#ifndef _LINUX_TIME32_H +#define _LINUX_TIME32_H +/* + * These are all interfaces based on the old time_t definition + * that overflows in 2038 on 32-bit architectures. New code + * should use the replacements based on time64_t and timespec64. + * + * Any interfaces in here that become unused as we migrate + * code to time64_t should get removed. + */ + +#include <linux/time64.h> + +#define TIME_T_MAX	(time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) + +#if __BITS_PER_LONG == 64 + +/* timespec64 is defined as timespec here */ +static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) +{ +	return ts64; +} + +static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) +{ +	return ts; +} + +# define timespec_equal			timespec64_equal +# define timespec_compare		timespec64_compare +# define set_normalized_timespec	set_normalized_timespec64 +# define timespec_add			timespec64_add +# define timespec_sub			timespec64_sub +# define timespec_valid			timespec64_valid +# define timespec_valid_strict		timespec64_valid_strict +# define timespec_to_ns			timespec64_to_ns +# define ns_to_timespec			ns_to_timespec64 +# define timespec_add_ns		timespec64_add_ns + +#else +static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) +{ +	struct timespec ret; + +	ret.tv_sec = (time_t)ts64.tv_sec; +	ret.tv_nsec = ts64.tv_nsec; +	return ret; +} + +static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) +{ +	struct timespec64 ret; + +	ret.tv_sec = ts.tv_sec; +	ret.tv_nsec = ts.tv_nsec; +	return ret; +} + +static inline int timespec_equal(const struct timespec *a, +				 const struct timespec *b) +{ +	return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); +} + +/* + * lhs < rhs:  return <0 + * lhs == rhs: return 0 + * lhs > rhs:  return >0 + */ +static inline int timespec_compare(const struct timespec *lhs, const struct timespec *rhs) +{ +	if (lhs->tv_sec < rhs->tv_sec) +		return -1; +	if (lhs->tv_sec > rhs->tv_sec) +		return 1; +	return lhs->tv_nsec - rhs->tv_nsec; +} + +extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); + +static inline struct timespec timespec_add(struct timespec lhs, +						struct timespec rhs) +{ +	struct timespec ts_delta; + +	set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec, +				lhs.tv_nsec + rhs.tv_nsec); +	return ts_delta; +} + +/* + * sub = lhs - rhs, in normalized form + */ +static inline struct timespec timespec_sub(struct timespec lhs, +						struct timespec rhs) +{ +	struct timespec ts_delta; + +	set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec, +				lhs.tv_nsec - rhs.tv_nsec); +	return ts_delta; +} + +/* + * Returns true if the timespec is norm, false if denorm: + */ +static inline bool timespec_valid(const struct timespec *ts) +{ +	/* Dates before 1970 are bogus */ +	if (ts->tv_sec < 0) +		return false; +	/* Can't have more nanoseconds then a second */ +	if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC) +		return false; +	return true; +} + +static inline bool timespec_valid_strict(const struct timespec *ts) +{ +	if (!timespec_valid(ts)) +		return false; +	/* Disallow values that could overflow ktime_t */ +	if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) +		return false; +	return true; +} + +/** + * timespec_to_ns - Convert timespec to nanoseconds + * @ts:		pointer to the timespec variable to be converted + * + * Returns the scalar nanosecond representation of the timespec + * parameter. + */ +static inline s64 timespec_to_ns(const struct timespec *ts) +{ +	return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; +} + +/** + * ns_to_timespec - Convert nanoseconds to timespec + * @nsec:	the nanoseconds value to be converted + * + * Returns the timespec representation of the nsec parameter. + */ +extern struct timespec ns_to_timespec(const s64 nsec); + +/** + * timespec_add_ns - Adds nanoseconds to a timespec + * @a:		pointer to timespec to be incremented + * @ns:		unsigned nanoseconds value to be added + * + * This must always be inlined because its used from the x86-64 vdso, + * which cannot call other kernel functions. + */ +static __always_inline void timespec_add_ns(struct timespec *a, u64 ns) +{ +	a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns); +	a->tv_nsec = ns; +} + +#endif + +/** + * time_to_tm - converts the calendar time to local broken-down time + * + * @totalsecs	the number of seconds elapsed since 00:00:00 on January 1, 1970, + *		Coordinated Universal Time (UTC). + * @offset	offset seconds adding to totalsecs. + * @result	pointer to struct tm variable to receive broken-down time + */ +static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result) +{ +	time64_to_tm(totalsecs, offset, result); +} + +static inline unsigned long mktime(const unsigned int year, +			const unsigned int mon, const unsigned int day, +			const unsigned int hour, const unsigned int min, +			const unsigned int sec) +{ +	return mktime64(year, mon, day, hour, min, sec); +} + +static inline bool timeval_valid(const struct timeval *tv) +{ +	/* Dates before 1970 are bogus */ +	if (tv->tv_sec < 0) +		return false; + +	/* Can't have more microseconds then a second */ +	if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC) +		return false; + +	return true; +} + +extern struct timespec timespec_trunc(struct timespec t, unsigned int gran); + +/** + * timeval_to_ns - Convert timeval to nanoseconds + * @ts:		pointer to the timeval variable to be converted + * + * Returns the scalar nanosecond representation of the timeval + * parameter. + */ +static inline s64 timeval_to_ns(const struct timeval *tv) +{ +	return ((s64) tv->tv_sec * NSEC_PER_SEC) + +		tv->tv_usec * NSEC_PER_USEC; +} + +/** + * ns_to_timeval - Convert nanoseconds to timeval + * @nsec:	the nanoseconds value to be converted + * + * Returns the timeval representation of the nsec parameter. + */ +extern struct timeval ns_to_timeval(const s64 nsec); + +#endif diff --git a/include/linux/time64.h b/include/linux/time64.h index 980c71b3001a..93d39499838e 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TIME64_H  #define _LINUX_TIME64_H @@ -7,11 +8,8 @@  typedef __s64 time64_t;  typedef __u64 timeu64_t; -/* - * This wants to go into uapi/linux/time.h once we agreed about the - * userspace interfaces. - */  #if __BITS_PER_LONG == 64 +/* this trick allows us to optimize out timespec64_to_timespec */  # define timespec64 timespec  #define itimerspec64 itimerspec  #else @@ -41,77 +39,6 @@ struct itimerspec64 {  #define KTIME_MAX			((s64)~((u64)1 << 63))  #define KTIME_SEC_MAX			(KTIME_MAX / NSEC_PER_SEC) -#if __BITS_PER_LONG == 64 - -static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) -{ -	return ts64; -} - -static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) -{ -	return ts; -} - -static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64) -{ -	return *its64; -} - -static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its) -{ -	return *its; -} - -# define timespec64_equal		timespec_equal -# define timespec64_compare		timespec_compare -# define set_normalized_timespec64	set_normalized_timespec -# define timespec64_add			timespec_add -# define timespec64_sub			timespec_sub -# define timespec64_valid		timespec_valid -# define timespec64_valid_strict	timespec_valid_strict -# define timespec64_to_ns		timespec_to_ns -# define ns_to_timespec64		ns_to_timespec -# define timespec64_add_ns		timespec_add_ns - -#else - -static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) -{ -	struct timespec ret; - -	ret.tv_sec = (time_t)ts64.tv_sec; -	ret.tv_nsec = ts64.tv_nsec; -	return ret; -} - -static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) -{ -	struct timespec64 ret; - -	ret.tv_sec = ts.tv_sec; -	ret.tv_nsec = ts.tv_nsec; -	return ret; -} - -static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64) -{ -	struct itimerspec ret; - -	ret.it_interval = timespec64_to_timespec(its64->it_interval); -	ret.it_value = timespec64_to_timespec(its64->it_value); -	return ret; -} - -static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its) -{ -	struct itimerspec64 ret; - -	ret.it_interval = timespec_to_timespec64(its->it_interval); -	ret.it_value = timespec_to_timespec64(its->it_value); -	return ret; -} -  static inline int timespec64_equal(const struct timespec64 *a,  				   const struct timespec64 *b)  { @@ -213,8 +140,6 @@ static __always_inline void timespec64_add_ns(struct timespec64 *a, u64 ns)  	a->tv_nsec = ns;  } -#endif -  /*   * timespec64_add_safe assumes both values are positive and checks for   * overflow. It will return TIME64_MAX in case of overflow. diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index 0a0a53daf2a2..d315c3d6725c 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * You SHOULD NOT be including this unless you're vsyscall   * handling code or timekeeping internal code! @@ -13,19 +14,22 @@  /**   * struct tk_read_base - base structure for timekeeping readout   * @clock:	Current clocksource used for timekeeping. - * @read:	Read function of @clock   * @mask:	Bitmask for two's complement subtraction of non 64bit clocks   * @cycle_last: @clock cycle value at last update   * @mult:	(NTP adjusted) multiplier for scaled math conversion   * @shift:	Shift value for scaled math conversion   * @xtime_nsec: Shifted (fractional) nano seconds offset for readout   * @base:	ktime_t (nanoseconds) base time for readout + * @base_real:	Nanoseconds base value for clock REALTIME readout   *   * This struct has size 56 byte on 64 bit. Together with a seqcount it   * occupies a single 64byte cache line.   *   * The struct is separate from struct timekeeper as it is also used   * for a fast NMI safe accessors. + * + * @base_real is for the fast NMI safe accessor to allow reading clock + * realtime from any context.   */  struct tk_read_base {  	struct clocksource	*clock; @@ -35,6 +39,7 @@ struct tk_read_base {  	u32			shift;  	u64			xtime_nsec;  	ktime_t			base; +	u64			base_real;  };  /** @@ -131,13 +136,6 @@ struct timekeeper {  extern void update_vsyscall(struct timekeeper *tk);  extern void update_vsyscall_tz(void); -#elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD) - -extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm, -				struct clocksource *c, u32 mult, -				u64 cycle_last); -extern void update_vsyscall_tz(void); -  #else  static inline void update_vsyscall(struct timekeeper *tk) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index ddc229ff6d1e..b17bcce58bc4 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TIMEKEEPING_H  #define _LINUX_TIMEKEEPING_H @@ -15,27 +16,16 @@ extern void xtime_update(unsigned long ticks);  /*   * Get and set timeofday   */ -extern void do_gettimeofday(struct timeval *tv);  extern int do_settimeofday64(const struct timespec64 *ts);  extern int do_sys_settimeofday64(const struct timespec64 *tv,  				 const struct timezone *tz);  /*   * Kernel time accessors   */ -unsigned long get_seconds(void);  struct timespec64 current_kernel_time64(void); -/* does not take xtime_lock */ -struct timespec __current_kernel_time(void); - -static inline struct timespec current_kernel_time(void) -{ -	struct timespec64 now = current_kernel_time64(); - -	return timespec64_to_timespec(now); -}  /* - * timespec based interfaces + * timespec64 based interfaces   */  struct timespec64 get_monotonic_coarse64(void);  extern void getrawmonotonic64(struct timespec64 *ts); @@ -47,116 +37,6 @@ extern int __getnstimeofday64(struct timespec64 *tv);  extern void getnstimeofday64(struct timespec64 *tv);  extern void getboottime64(struct timespec64 *ts); -#if BITS_PER_LONG == 64 -/** - * Deprecated. Use do_settimeofday64(). - */ -static inline int do_settimeofday(const struct timespec *ts) -{ -	return do_settimeofday64(ts); -} - -static inline int __getnstimeofday(struct timespec *ts) -{ -	return __getnstimeofday64(ts); -} - -static inline void getnstimeofday(struct timespec *ts) -{ -	getnstimeofday64(ts); -} - -static inline void ktime_get_ts(struct timespec *ts) -{ -	ktime_get_ts64(ts); -} - -static inline void ktime_get_real_ts(struct timespec *ts) -{ -	getnstimeofday64(ts); -} - -static inline void getrawmonotonic(struct timespec *ts) -{ -	getrawmonotonic64(ts); -} - -static inline struct timespec get_monotonic_coarse(void) -{ -	return get_monotonic_coarse64(); -} - -static inline void getboottime(struct timespec *ts) -{ -	return getboottime64(ts); -} -#else -/** - * Deprecated. Use do_settimeofday64(). - */ -static inline int do_settimeofday(const struct timespec *ts) -{ -	struct timespec64 ts64; - -	ts64 = timespec_to_timespec64(*ts); -	return do_settimeofday64(&ts64); -} - -static inline int __getnstimeofday(struct timespec *ts) -{ -	struct timespec64 ts64; -	int ret = __getnstimeofday64(&ts64); - -	*ts = timespec64_to_timespec(ts64); -	return ret; -} - -static inline void getnstimeofday(struct timespec *ts) -{ -	struct timespec64 ts64; - -	getnstimeofday64(&ts64); -	*ts = timespec64_to_timespec(ts64); -} - -static inline void ktime_get_ts(struct timespec *ts) -{ -	struct timespec64 ts64; - -	ktime_get_ts64(&ts64); -	*ts = timespec64_to_timespec(ts64); -} - -static inline void ktime_get_real_ts(struct timespec *ts) -{ -	struct timespec64 ts64; - -	getnstimeofday64(&ts64); -	*ts = timespec64_to_timespec(ts64); -} - -static inline void getrawmonotonic(struct timespec *ts) -{ -	struct timespec64 ts64; - -	getrawmonotonic64(&ts64); -	*ts = timespec64_to_timespec(ts64); -} - -static inline struct timespec get_monotonic_coarse(void) -{ -	return timespec64_to_timespec(get_monotonic_coarse64()); -} - -static inline void getboottime(struct timespec *ts) -{ -	struct timespec64 ts64; - -	getboottime64(&ts64); -	*ts = timespec64_to_timespec(ts64); -} -#endif -  #define ktime_get_real_ts64(ts)	getnstimeofday64(ts)  /* @@ -239,25 +119,16 @@ static inline u64 ktime_get_raw_ns(void)  extern u64 ktime_get_mono_fast_ns(void);  extern u64 ktime_get_raw_fast_ns(void);  extern u64 ktime_get_boot_fast_ns(void); +extern u64 ktime_get_real_fast_ns(void);  /* - * Timespec interfaces utilizing the ktime based ones + * timespec64 interfaces utilizing the ktime based ones   */ -static inline void get_monotonic_boottime(struct timespec *ts) -{ -	*ts = ktime_to_timespec(ktime_get_boottime()); -} -  static inline void get_monotonic_boottime64(struct timespec64 *ts)  {  	*ts = ktime_to_timespec64(ktime_get_boottime());  } -static inline void timekeeping_clocktai(struct timespec *ts) -{ -	*ts = ktime_to_timespec(ktime_get_clocktai()); -} -  static inline void timekeeping_clocktai64(struct timespec64 *ts)  {  	*ts = ktime_to_timespec64(ktime_get_clocktai()); @@ -272,12 +143,6 @@ extern bool timekeeping_rtc_skipresume(void);  extern void timekeeping_inject_sleeptime64(struct timespec64 *delta);  /* - * PPS accessor - */ -extern void ktime_get_raw_and_real_ts64(struct timespec64 *ts_raw, -				        struct timespec64 *ts_real); - -/*   * struct system_time_snapshot - simultaneous raw/real time capture with   *	counter value   * @cycles:	Clocksource counter value to produce the system times @@ -340,10 +205,8 @@ extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot);   */  extern int persistent_clock_is_local; -extern void read_persistent_clock(struct timespec *ts);  extern void read_persistent_clock64(struct timespec64 *ts);  extern void read_boot_clock64(struct timespec64 *ts); -extern int update_persistent_clock(struct timespec now);  extern int update_persistent_clock64(struct timespec64 now); diff --git a/include/linux/timekeeping32.h b/include/linux/timekeeping32.h new file mode 100644 index 000000000000..af4114d5dc17 --- /dev/null +++ b/include/linux/timekeeping32.h @@ -0,0 +1,151 @@ +#ifndef _LINUX_TIMEKEEPING32_H +#define _LINUX_TIMEKEEPING32_H +/* + * These interfaces are all based on the old timespec type + * and should get replaced with the timespec64 based versions + * over time so we can remove the file here. + */ + +extern void do_gettimeofday(struct timeval *tv); +unsigned long get_seconds(void); + +/* does not take xtime_lock */ +struct timespec __current_kernel_time(void); + +static inline struct timespec current_kernel_time(void) +{ +	struct timespec64 now = current_kernel_time64(); + +	return timespec64_to_timespec(now); +} + +#if BITS_PER_LONG == 64 +/** + * Deprecated. Use do_settimeofday64(). + */ +static inline int do_settimeofday(const struct timespec *ts) +{ +	return do_settimeofday64(ts); +} + +static inline int __getnstimeofday(struct timespec *ts) +{ +	return __getnstimeofday64(ts); +} + +static inline void getnstimeofday(struct timespec *ts) +{ +	getnstimeofday64(ts); +} + +static inline void ktime_get_ts(struct timespec *ts) +{ +	ktime_get_ts64(ts); +} + +static inline void ktime_get_real_ts(struct timespec *ts) +{ +	getnstimeofday64(ts); +} + +static inline void getrawmonotonic(struct timespec *ts) +{ +	getrawmonotonic64(ts); +} + +static inline struct timespec get_monotonic_coarse(void) +{ +	return get_monotonic_coarse64(); +} + +static inline void getboottime(struct timespec *ts) +{ +	return getboottime64(ts); +} +#else +/** + * Deprecated. Use do_settimeofday64(). + */ +static inline int do_settimeofday(const struct timespec *ts) +{ +	struct timespec64 ts64; + +	ts64 = timespec_to_timespec64(*ts); +	return do_settimeofday64(&ts64); +} + +static inline int __getnstimeofday(struct timespec *ts) +{ +	struct timespec64 ts64; +	int ret = __getnstimeofday64(&ts64); + +	*ts = timespec64_to_timespec(ts64); +	return ret; +} + +static inline void getnstimeofday(struct timespec *ts) +{ +	struct timespec64 ts64; + +	getnstimeofday64(&ts64); +	*ts = timespec64_to_timespec(ts64); +} + +static inline void ktime_get_ts(struct timespec *ts) +{ +	struct timespec64 ts64; + +	ktime_get_ts64(&ts64); +	*ts = timespec64_to_timespec(ts64); +} + +static inline void ktime_get_real_ts(struct timespec *ts) +{ +	struct timespec64 ts64; + +	getnstimeofday64(&ts64); +	*ts = timespec64_to_timespec(ts64); +} + +static inline void getrawmonotonic(struct timespec *ts) +{ +	struct timespec64 ts64; + +	getrawmonotonic64(&ts64); +	*ts = timespec64_to_timespec(ts64); +} + +static inline struct timespec get_monotonic_coarse(void) +{ +	return timespec64_to_timespec(get_monotonic_coarse64()); +} + +static inline void getboottime(struct timespec *ts) +{ +	struct timespec64 ts64; + +	getboottime64(&ts64); +	*ts = timespec64_to_timespec(ts64); +} +#endif + +/* + * Timespec interfaces utilizing the ktime based ones + */ +static inline void get_monotonic_boottime(struct timespec *ts) +{ +	*ts = ktime_to_timespec(ktime_get_boottime()); +} + +static inline void timekeeping_clocktai(struct timespec *ts) +{ +	*ts = ktime_to_timespec(ktime_get_clocktai()); +} + +/* + * Persistent clock related interfaces + */ +extern void read_persistent_clock(struct timespec *ts); +extern int update_persistent_clock(struct timespec now); + +#endif diff --git a/include/linux/timer.h b/include/linux/timer.h index 6383c528b148..04af640ea95b 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TIMER_H  #define _LINUX_TIMER_H @@ -16,8 +17,7 @@ struct timer_list {  	 */  	struct hlist_node	entry;  	unsigned long		expires; -	void			(*function)(unsigned long); -	unsigned long		data; +	void			(*function)(struct timer_list *);  	u32			flags;  #ifdef CONFIG_LOCKDEP @@ -63,121 +63,82 @@ struct timer_list {  #define TIMER_TRACE_FLAGMASK	(TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE) -#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \ +#define __TIMER_INITIALIZER(_function, _flags) {		\  		.entry = { .next = TIMER_ENTRY_STATIC },	\  		.function = (_function),			\ -		.expires = (_expires),				\ -		.data = (_data),				\  		.flags = (_flags),				\  		__TIMER_LOCKDEP_MAP_INITIALIZER(		\  			__FILE__ ":" __stringify(__LINE__))	\  	} -#define TIMER_INITIALIZER(_function, _expires, _data)		\ -	__TIMER_INITIALIZER((_function), (_expires), (_data), 0) - -#define TIMER_PINNED_INITIALIZER(_function, _expires, _data)	\ -	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED) - -#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data)	\ -	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE) - -#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data)	\ -	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED) - -#define DEFINE_TIMER(_name, _function, _expires, _data)		\ +#define DEFINE_TIMER(_name, _function)				\  	struct timer_list _name =				\ -		TIMER_INITIALIZER(_function, _expires, _data) +		__TIMER_INITIALIZER(_function, 0) -void init_timer_key(struct timer_list *timer, unsigned int flags, +/* + * LOCKDEP and DEBUG timer interfaces. + */ +void init_timer_key(struct timer_list *timer, +		    void (*func)(struct timer_list *), unsigned int flags,  		    const char *name, struct lock_class_key *key);  #ifdef CONFIG_DEBUG_OBJECTS_TIMERS  extern void init_timer_on_stack_key(struct timer_list *timer, +				    void (*func)(struct timer_list *),  				    unsigned int flags, const char *name,  				    struct lock_class_key *key); -extern void destroy_timer_on_stack(struct timer_list *timer);  #else -static inline void destroy_timer_on_stack(struct timer_list *timer) { }  static inline void init_timer_on_stack_key(struct timer_list *timer, -					   unsigned int flags, const char *name, +					   void (*func)(struct timer_list *), +					   unsigned int flags, +					   const char *name,  					   struct lock_class_key *key)  { -	init_timer_key(timer, flags, name, key); +	init_timer_key(timer, func, flags, name, key);  }  #endif  #ifdef CONFIG_LOCKDEP -#define __init_timer(_timer, _flags)					\ +#define __init_timer(_timer, _fn, _flags)				\  	do {								\  		static struct lock_class_key __key;			\ -		init_timer_key((_timer), (_flags), #_timer, &__key);	\ +		init_timer_key((_timer), (_fn), (_flags), #_timer, &__key);\  	} while (0) -#define __init_timer_on_stack(_timer, _flags)				\ +#define __init_timer_on_stack(_timer, _fn, _flags)			\  	do {								\  		static struct lock_class_key __key;			\ -		init_timer_on_stack_key((_timer), (_flags), #_timer, &__key); \ +		init_timer_on_stack_key((_timer), (_fn), (_flags),	\ +					#_timer, &__key);		 \  	} while (0)  #else -#define __init_timer(_timer, _flags)					\ -	init_timer_key((_timer), (_flags), NULL, NULL) -#define __init_timer_on_stack(_timer, _flags)				\ -	init_timer_on_stack_key((_timer), (_flags), NULL, NULL) +#define __init_timer(_timer, _fn, _flags)				\ +	init_timer_key((_timer), (_fn), (_flags), NULL, NULL) +#define __init_timer_on_stack(_timer, _fn, _flags)			\ +	init_timer_on_stack_key((_timer), (_fn), (_flags), NULL, NULL)  #endif -#define init_timer(timer)						\ -	__init_timer((timer), 0) -#define init_timer_pinned(timer)					\ -	__init_timer((timer), TIMER_PINNED) -#define init_timer_deferrable(timer)					\ -	__init_timer((timer), TIMER_DEFERRABLE) -#define init_timer_pinned_deferrable(timer)				\ -	__init_timer((timer), TIMER_DEFERRABLE | TIMER_PINNED) -#define init_timer_on_stack(timer)					\ -	__init_timer_on_stack((timer), 0) - -#define __setup_timer(_timer, _fn, _data, _flags)			\ -	do {								\ -		__init_timer((_timer), (_flags));			\ -		(_timer)->function = (_fn);				\ -		(_timer)->data = (_data);				\ -	} while (0) +/** + * timer_setup - prepare a timer for first use + * @timer: the timer in question + * @callback: the function to call when timer expires + * @flags: any TIMER_* flags + * + * Regular timer initialization should use either DEFINE_TIMER() above, + * or timer_setup(). For timers on the stack, timer_setup_on_stack() must + * be used and must be balanced with a call to destroy_timer_on_stack(). + */ +#define timer_setup(timer, callback, flags)			\ +	__init_timer((timer), (callback), (flags)) -#define __setup_timer_on_stack(_timer, _fn, _data, _flags)		\ -	do {								\ -		__init_timer_on_stack((_timer), (_flags));		\ -		(_timer)->function = (_fn);				\ -		(_timer)->data = (_data);				\ -	} while (0) +#define timer_setup_on_stack(timer, callback, flags)		\ +	__init_timer_on_stack((timer), (callback), (flags)) -#define setup_timer(timer, fn, data)					\ -	__setup_timer((timer), (fn), (data), 0) -#define setup_pinned_timer(timer, fn, data)				\ -	__setup_timer((timer), (fn), (data), TIMER_PINNED) -#define setup_deferrable_timer(timer, fn, data)				\ -	__setup_timer((timer), (fn), (data), TIMER_DEFERRABLE) -#define setup_pinned_deferrable_timer(timer, fn, data)			\ -	__setup_timer((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED) -#define setup_timer_on_stack(timer, fn, data)				\ -	__setup_timer_on_stack((timer), (fn), (data), 0) -#define setup_pinned_timer_on_stack(timer, fn, data)			\ -	__setup_timer_on_stack((timer), (fn), (data), TIMER_PINNED) -#define setup_deferrable_timer_on_stack(timer, fn, data)		\ -	__setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE) -#define setup_pinned_deferrable_timer_on_stack(timer, fn, data)		\ -	__setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED) - -#define TIMER_DATA_TYPE		unsigned long -#define TIMER_FUNC_TYPE		void (*)(TIMER_DATA_TYPE) - -static inline void timer_setup(struct timer_list *timer, -			       void (*callback)(struct timer_list *), -			       unsigned int flags) -{ -	__setup_timer(timer, (TIMER_FUNC_TYPE)callback, -		      (TIMER_DATA_TYPE)timer, flags); -} +#ifdef CONFIG_DEBUG_OBJECTS_TIMERS +extern void destroy_timer_on_stack(struct timer_list *timer); +#else +static inline void destroy_timer_on_stack(struct timer_list *timer) { } +#endif  #define from_timer(var, callback_timer, timer_fieldname) \  	container_of(callback_timer, typeof(*var), timer_fieldname) @@ -201,6 +162,7 @@ extern void add_timer_on(struct timer_list *timer, int cpu);  extern int del_timer(struct timer_list * timer);  extern int mod_timer(struct timer_list *timer, unsigned long expires);  extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); +extern int timer_reduce(struct timer_list *timer, unsigned long expires);  /*   * The jiffies value which is added to now, when there is no timer diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h index bab0b1ad0613..0c33260e5dfb 100644 --- a/include/linux/timerfd.h +++ b/include/linux/timerfd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  include/linux/timerfd.h   * diff --git a/include/linux/timerqueue.h b/include/linux/timerqueue.h index 7eec17ad7fa1..78b8cc73f12f 100644 --- a/include/linux/timerqueue.h +++ b/include/linux/timerqueue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TIMERQUEUE_H  #define _LINUX_TIMERQUEUE_H diff --git a/include/linux/tpm_command.h b/include/linux/tpm_command.h index 727512e249b5..f5c03e9c3913 100644 --- a/include/linux/tpm_command.h +++ b/include/linux/tpm_command.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_TPM_COMMAND_H__  #define __LINUX_TPM_COMMAND_H__ diff --git a/include/linux/trace.h b/include/linux/trace.h index 9330a58e2651..d24991c1fef3 100644 --- a/include/linux/trace.h +++ b/include/linux/trace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TRACE_H  #define _LINUX_TRACE_H diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h index 1d7ca2739272..00e8f98c940f 100644 --- a/include/linux/trace_clock.h +++ b/include/linux/trace_clock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TRACE_CLOCK_H  #define _LINUX_TRACE_CLOCK_H diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 2e0f22298fe9..af44e7c2d577 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TRACE_EVENT_H  #define _LINUX_TRACE_EVENT_H @@ -173,6 +174,11 @@ enum trace_reg {  	TRACE_REG_PERF_UNREGISTER,  	TRACE_REG_PERF_OPEN,  	TRACE_REG_PERF_CLOSE, +	/* +	 * These (ADD/DEL) use a 'boolean' return value, where 1 (true) means a +	 * custom action was taken and the default action is not to be +	 * performed. +	 */  	TRACE_REG_PERF_ADD,  	TRACE_REG_PERF_DEL,  #endif @@ -271,14 +277,37 @@ struct trace_event_call {  #ifdef CONFIG_PERF_EVENTS  	int				perf_refcount;  	struct hlist_head __percpu	*perf_events; -	struct bpf_prog			*prog; -	struct perf_event		*bpf_prog_owner; +	struct bpf_prog_array __rcu	*prog_array;  	int	(*perf_perm)(struct trace_event_call *,  			     struct perf_event *);  #endif  }; +#ifdef CONFIG_PERF_EVENTS +static inline bool bpf_prog_array_valid(struct trace_event_call *call) +{ +	/* +	 * This inline function checks whether call->prog_array +	 * is valid or not. The function is called in various places, +	 * outside rcu_read_lock/unlock, as a heuristic to speed up execution. +	 * +	 * If this function returns true, and later call->prog_array +	 * becomes false inside rcu_read_lock/unlock region, +	 * we bail out then. If this function return false, +	 * there is a risk that we might miss a few events if the checking +	 * were delayed until inside rcu_read_lock/unlock region and +	 * call->prog_array happened to become non-NULL then. +	 * +	 * Here, READ_ONCE() is used instead of rcu_access_pointer(). +	 * rcu_access_pointer() requires the actual definition of +	 * "struct bpf_prog_array" while READ_ONCE() only needs +	 * a declaration of the same type. +	 */ +	return !!READ_ONCE(call->prog_array); +} +#endif +  static inline const char *  trace_event_name(struct trace_event_call *call)  { @@ -435,12 +464,23 @@ trace_trigger_soft_disabled(struct trace_event_file *file)  }  #ifdef CONFIG_BPF_EVENTS -unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx); +unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx); +int perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog); +void perf_event_detach_bpf_prog(struct perf_event *event);  #else -static inline unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx) +static inline unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx)  {  	return 1;  } + +static inline int +perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog) +{ +	return -EOPNOTSUPP; +} + +static inline void perf_event_detach_bpf_prog(struct perf_event *event) { } +  #endif  enum { @@ -507,10 +547,11 @@ void perf_trace_run_bpf_submit(void *raw_data, int size, int rctx,  static inline void  perf_trace_buf_submit(void *raw_data, int size, int rctx, u16 type,  		       u64 count, struct pt_regs *regs, void *head, -		       struct task_struct *task, struct perf_event *event) +		       struct task_struct *task)  { -	perf_tp_event(type, count, raw_data, size, regs, head, rctx, task, event); +	perf_tp_event(type, count, raw_data, size, regs, head, rctx, task);  } +  #endif  #endif /* _LINUX_TRACE_EVENT_H */ diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index cfaf5a1d4bad..6609b39a7232 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TRACE_SEQ_H  #define _LINUX_TRACE_SEQ_H diff --git a/include/linux/tracepoint-defs.h b/include/linux/tracepoint-defs.h index a03192052066..64ed7064f1fa 100644 --- a/include/linux/tracepoint-defs.h +++ b/include/linux/tracepoint-defs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef TRACEPOINT_DEFS_H  #define TRACEPOINT_DEFS_H 1 diff --git a/include/linux/ts-nbus.h b/include/linux/ts-nbus.h new file mode 100644 index 000000000000..5bd4c822f7cf --- /dev/null +++ b/include/linux/ts-nbus.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016 - Savoir-faire Linux + * Author: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com> + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#ifndef _TS_NBUS_H +#define _TS_NBUS_H + +struct ts_nbus; + +extern int ts_nbus_read(struct ts_nbus *ts_nbus, u8 adr, u16 *val); +extern int ts_nbus_write(struct ts_nbus *ts_nbus, u8 adr, u16 val); + +#endif /* _TS_NBUS_H */ diff --git a/include/linux/tsacct_kern.h b/include/linux/tsacct_kern.h index 3251965bf4cc..d8ddce26e1f1 100644 --- a/include/linux/tsacct_kern.h +++ b/include/linux/tsacct_kern.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * tsacct_kern.h - kernel header for system accounting over taskstats interface   * diff --git a/include/linux/tty.h b/include/linux/tty.h index cf53eb539f6e..7ac8ba208b1f 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TTY_H  #define _LINUX_TTY_H diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index fcdc0f5d9098..31c2b5b166de 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TTY_DRIVER_H  #define _LINUX_TTY_DRIVER_H diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index d43837f2ce3a..767f62086bd9 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TTY_FLIP_H  #define _LINUX_TTY_FLIP_H diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 3971cf0eb467..3bc5144b1c7e 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TTY_LDISC_H  #define _LINUX_TTY_LDISC_H diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h index eb5b74a575be..20d310331eb5 100644 --- a/include/linux/typecheck.h +++ b/include/linux/typecheck.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef TYPECHECK_H_INCLUDED  #define TYPECHECK_H_INCLUDED diff --git a/include/linux/types.h b/include/linux/types.h index 258099a4ed82..c94d59ef96cc 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_TYPES_H  #define _LINUX_TYPES_H @@ -155,6 +156,7 @@ typedef u32 dma_addr_t;  #endif  typedef unsigned __bitwise gfp_t; +typedef unsigned __bitwise slab_flags_t;  typedef unsigned __bitwise fmode_t;  #ifdef CONFIG_PHYS_ADDR_T_64BIT diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h index 650f3dd6b800..5bdbd9f49395 100644 --- a/include/linux/u64_stats_sync.h +++ b/include/linux/u64_stats_sync.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_U64_STATS_SYNC_H  #define _LINUX_U64_STATS_SYNC_H diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 20ef8e6ec2db..251e655d407f 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_UACCESS_H__  #define __LINUX_UACCESS_H__ diff --git a/include/linux/ucs2_string.h b/include/linux/ucs2_string.h index bb679b48f408..cf3ada3e820e 100644 --- a/include/linux/ucs2_string.h +++ b/include/linux/ucs2_string.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UCS2_STRING_H_  #define _LINUX_UCS2_STRING_H_ diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h index 25e9d9216340..b0542cd11aeb 100644 --- a/include/linux/uidgid.h +++ b/include/linux/uidgid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UIDGID_H  #define _LINUX_UIDGID_H diff --git a/include/linux/uinput.h b/include/linux/uinput.h deleted file mode 100644 index 75de43da2301..000000000000 --- a/include/linux/uinput.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - *  User level driver support for input subsystem - * - * Heavily based on evdev.c by Vojtech Pavlik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> - * - * Changes/Revisions: - *	0.5	08/13/2015 (David Herrmann <dh.herrmann@gmail.com> & - *			    Benjamin Tissoires <benjamin.tissoires@redhat.com>) - *		- add UI_DEV_SETUP ioctl - *		- add UI_ABS_SETUP ioctl - *		- add UI_GET_VERSION ioctl - *	0.4	01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>) - *		- add UI_GET_SYSNAME ioctl - *	0.3	24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>) - *		- update ff support for the changes in kernel interface - *		- add UINPUT_VERSION - *	0.2	16/10/2004 (Micah Dowty <micah@navi.cx>) - *		- added force feedback support - *             - added UI_SET_PHYS - *	0.1	20/06/2002 - *		- first public version - */ -#ifndef __UINPUT_H_ -#define __UINPUT_H_ - -#include <uapi/linux/uinput.h> - -#define UINPUT_NAME		"uinput" -#define UINPUT_BUFFER_SIZE	16 -#define UINPUT_NUM_REQUESTS	16 - -enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED }; - -struct uinput_request { -	unsigned int		id; -	unsigned int		code;	/* UI_FF_UPLOAD, UI_FF_ERASE */ - -	int			retval; -	struct completion	done; - -	union { -		unsigned int	effect_id; -		struct { -			struct ff_effect *effect; -			struct ff_effect *old; -		} upload; -	} u; -}; - -struct uinput_device { -	struct input_dev	*dev; -	struct mutex		mutex; -	enum uinput_state	state; -	wait_queue_head_t	waitq; -	unsigned char		ready; -	unsigned char		head; -	unsigned char		tail; -	struct input_event	buff[UINPUT_BUFFER_SIZE]; -	unsigned int		ff_effects_max; - -	struct uinput_request	*requests[UINPUT_NUM_REQUESTS]; -	wait_queue_head_t	requests_waitq; -	spinlock_t		requests_lock; -}; -#endif	/* __UINPUT_H_ */ diff --git a/include/linux/uio.h b/include/linux/uio.h index 8a642cda641c..e67e12adb136 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -80,8 +80,6 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)  	     ((iov = iov_iter_iovec(&(iter))), 1);		\  	     iov_iter_advance(&(iter), (iov).iov_len)) -unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); -  size_t iov_iter_copy_from_user_atomic(struct page *page,  		struct iov_iter *i, unsigned long offset, size_t bytes);  void iov_iter_advance(struct iov_iter *i, size_t bytes); @@ -246,4 +244,8 @@ int compat_import_iovec(int type, const struct compat_iovec __user * uvector,  int import_single_range(int type, void __user *buf, size_t len,  		 struct iovec *iov, struct iov_iter *i); +int iov_iter_for_each_range(struct iov_iter *i, size_t bytes, +			    int (*f)(struct kvec *vec, void *context), +			    void *context); +  #endif diff --git a/include/linux/ulpi/driver.h b/include/linux/ulpi/driver.h index a7af21a55248..c7a1810373e3 100644 --- a/include/linux/ulpi/driver.h +++ b/include/linux/ulpi/driver.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_ULPI_DRIVER_H  #define __LINUX_ULPI_DRIVER_H diff --git a/include/linux/ulpi/interface.h b/include/linux/ulpi/interface.h index a2011a919eb6..e93cfa36c3f7 100644 --- a/include/linux/ulpi/interface.h +++ b/include/linux/ulpi/interface.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_ULPI_INTERFACE_H  #define __LINUX_ULPI_INTERFACE_H diff --git a/include/linux/ulpi/regs.h b/include/linux/ulpi/regs.h index b5b8b8804560..9f607872b2f8 100644 --- a/include/linux/ulpi/regs.h +++ b/include/linux/ulpi/regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_ULPI_REGS_H  #define __LINUX_ULPI_REGS_H diff --git a/include/linux/unaligned/access_ok.h b/include/linux/unaligned/access_ok.h index 33383ca23837..167aa849c0ce 100644 --- a/include/linux/unaligned/access_ok.h +++ b/include/linux/unaligned/access_ok.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_ACCESS_OK_H  #define _LINUX_UNALIGNED_ACCESS_OK_H diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h index 9356b24223ac..8bdb8fa01bd4 100644 --- a/include/linux/unaligned/be_byteshift.h +++ b/include/linux/unaligned/be_byteshift.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H  #define _LINUX_UNALIGNED_BE_BYTESHIFT_H diff --git a/include/linux/unaligned/be_memmove.h b/include/linux/unaligned/be_memmove.h index c2a76c5c9ed0..7164214a4ba1 100644 --- a/include/linux/unaligned/be_memmove.h +++ b/include/linux/unaligned/be_memmove.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_BE_MEMMOVE_H  #define _LINUX_UNALIGNED_BE_MEMMOVE_H diff --git a/include/linux/unaligned/be_struct.h b/include/linux/unaligned/be_struct.h index 132415836c50..15ea503a13fc 100644 --- a/include/linux/unaligned/be_struct.h +++ b/include/linux/unaligned/be_struct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_BE_STRUCT_H  #define _LINUX_UNALIGNED_BE_STRUCT_H diff --git a/include/linux/unaligned/generic.h b/include/linux/unaligned/generic.h index 02d97ff3df70..57d3114656e5 100644 --- a/include/linux/unaligned/generic.h +++ b/include/linux/unaligned/generic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_GENERIC_H  #define _LINUX_UNALIGNED_GENERIC_H diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h index be376fb79b64..1628b75866f0 100644 --- a/include/linux/unaligned/le_byteshift.h +++ b/include/linux/unaligned/le_byteshift.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H  #define _LINUX_UNALIGNED_LE_BYTESHIFT_H diff --git a/include/linux/unaligned/le_memmove.h b/include/linux/unaligned/le_memmove.h index 269849bee4ec..9202e864d026 100644 --- a/include/linux/unaligned/le_memmove.h +++ b/include/linux/unaligned/le_memmove.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_LE_MEMMOVE_H  #define _LINUX_UNALIGNED_LE_MEMMOVE_H diff --git a/include/linux/unaligned/le_struct.h b/include/linux/unaligned/le_struct.h index 088c4572faa8..9977987883a6 100644 --- a/include/linux/unaligned/le_struct.h +++ b/include/linux/unaligned/le_struct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_LE_STRUCT_H  #define _LINUX_UNALIGNED_LE_STRUCT_H diff --git a/include/linux/unaligned/memmove.h b/include/linux/unaligned/memmove.h index eeb5a779a4fd..ac71b53bc6dc 100644 --- a/include/linux/unaligned/memmove.h +++ b/include/linux/unaligned/memmove.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UNALIGNED_MEMMOVE_H  #define _LINUX_UNALIGNED_MEMMOVE_H diff --git a/include/linux/usb.h b/include/linux/usb.h index cb9fbd54386e..fbbe974661f2 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_USB_H  #define __LINUX_USB_H @@ -1728,6 +1729,8 @@ static inline int usb_urb_dir_out(struct urb *urb)  	return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;  } +int usb_urb_ep_type_check(const struct urb *urb); +  void *usb_alloc_coherent(struct usb_device *dev, size_t size,  	gfp_t mem_flags, dma_addr_t *dma);  void usb_free_coherent(struct usb_device *dev, size_t size, @@ -1766,7 +1769,21 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,  extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,  	unsigned char descindex, void *buf, int size);  extern int usb_get_status(struct usb_device *dev, -	int type, int target, void *data); +	int recip, int type, int target, void *data); + +static inline int usb_get_std_status(struct usb_device *dev, +	int recip, int target, void *data) +{ +	return usb_get_status(dev, recip, USB_STATUS_TYPE_STANDARD, target, +		data); +} + +static inline int usb_get_ptm_status(struct usb_device *dev, void *data) +{ +	return usb_get_status(dev, USB_RECIP_DEVICE, USB_STATUS_TYPE_PTM, +		0, data); +} +  extern int usb_string(struct usb_device *dev, int index,  	char *buf, size_t size); diff --git a/include/linux/usb/association.h b/include/linux/usb/association.h index 0a4a18b3c1bb..d7f3cb9b9db5 100644 --- a/include/linux/usb/association.h +++ b/include/linux/usb/association.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Wireless USB - Cable Based Association   * diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h index ba99af275a31..9bb00df3b53f 100644 --- a/include/linux/usb/atmel_usba_udc.h +++ b/include/linux/usb/atmel_usba_udc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Platform data definitions for Atmel USBA gadget driver.   */ diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index fd73bc0e9027..3119d0ace7aa 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Copyright (c) 2010 Daniel Mack <daniel@caiaq.de>   * diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index 3d84619110a4..170acd500ea1 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * <linux/usb/audio.h> -- USB Audio definitions.   * diff --git a/include/linux/usb/c67x00.h b/include/linux/usb/c67x00.h index 83c6b45470ca..2fc39e3b7281 100644 --- a/include/linux/usb/c67x00.h +++ b/include/linux/usb/c67x00.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * usb_c67x00.h: platform definitions for the Cypress C67X00 USB chip   * diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h index 0b3f4295c025..9b895f93d8de 100644 --- a/include/linux/usb/cdc-wdm.h +++ b/include/linux/usb/cdc-wdm.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * USB CDC Device Management subdriver   * diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index b5706f94ee9e..35d784cf32a4 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * USB CDC common helpers   * diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h index 1a59699cf82a..1646c06989df 100644 --- a/include/linux/usb/cdc_ncm.h +++ b/include/linux/usb/cdc_ncm.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)  /*   * Copyright (C) ST-Ericsson 2010-2012   * Contact: Alexey Orishko <alexey.orishko@stericsson.com> diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 6cc96bb12ddc..523aa088f6ab 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This file holds USB constants and structures that are needed for   * USB device APIs.  These are used by the USB device model, which is diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index d725cff7268d..07f99362bc90 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Platform data for the chipidea USB dual role controller   */ diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index f665d2ceac20..cef0e44601f8 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * composite.h -- framework for usb gadgets which are composite devices   * diff --git a/include/linux/usb/ehci-dbgp.h b/include/linux/usb/ehci-dbgp.h index 7344d9e591cc..62ab3805172d 100644 --- a/include/linux/usb/ehci-dbgp.h +++ b/include/linux/usb/ehci-dbgp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Standalone EHCI usb debug driver   * diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h index e479033bd782..a15ce99dfc2d 100644 --- a/include/linux/usb/ehci_def.h +++ b/include/linux/usb/ehci_def.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * Copyright (c) 2001-2002 by David Brownell   * diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h index db0431b39a63..dd742afdc03f 100644 --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de>   * diff --git a/include/linux/usb/ezusb.h b/include/linux/usb/ezusb.h index 639ee45779fb..487047162ca8 100644 --- a/include/linux/usb/ezusb.h +++ b/include/linux/usb/ezusb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __EZUSB_H  #define __EZUSB_H diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h index 71190663f1ee..570578cc9861 100644 --- a/include/linux/usb/functionfs.h +++ b/include/linux/usb/functionfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_FUNCTIONFS_H__  #define __LINUX_FUNCTIONFS_H__ 1 diff --git a/include/linux/usb/g_hid.h b/include/linux/usb/g_hid.h index 50f5745df28c..7581e488c237 100644 --- a/include/linux/usb/g_hid.h +++ b/include/linux/usb/g_hid.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * g_hid.h -- Header file for USB HID gadget driver   * diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 21468a722c4a..0142f3af0da6 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * <linux/usb/gadget.h>   * @@ -188,6 +189,8 @@ struct usb_ep_caps {   * @ops: Function pointers used to access hardware-specific operations.   * @ep_list:the gadget's ep_list holds all of its endpoints   * @caps:The structure describing types and directions supported by endoint. + * @enabled: The current endpoint enabled/disabled state. + * @claimed: True if this endpoint is claimed by a function.   * @maxpacket:The maximum packet size used on this endpoint.  The initial   *	value can sometimes be reduced (hardware allowing), according to   *	the endpoint descriptor used to configure the endpoint. @@ -349,6 +352,9 @@ struct usb_gadget_ops {   *	or B-Peripheral wants to take host role.   * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to   *	MaxPacketSize. + * @quirk_altset_not_supp: UDC controller doesn't support alt settings. + * @quirk_stall_not_supp: UDC controller doesn't support stalling. + * @quirk_zlp_not_supp: UDC controller doesn't support ZLP.   * @quirk_avoids_skb_reserve: udc/platform wants to avoid skb_reserve() in   *	u_ether.c to improve performance.   * @is_selfpowered: if the gadget is self-powered. diff --git a/include/linux/usb/gadget_configfs.h b/include/linux/usb/gadget_configfs.h index c36e95730de1..d61aebd68128 100644 --- a/include/linux/usb/gadget_configfs.h +++ b/include/linux/usb/gadget_configfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __GADGET_CONFIGFS__  #define __GADGET_CONFIGFS__ diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h index 837bba604a0b..804fb06cf6d6 100644 --- a/include/linux/usb/gpio_vbus.h +++ b/include/linux/usb/gpio_vbus.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * A simple GPIO VBUS sensing driver for B peripheral only devices   * with internal transceivers. diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index a1f03ebfde47..176900528822 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * Copyright (c) 2001-2002 by David Brownell   * diff --git a/include/linux/usb/input.h b/include/linux/usb/input.h index 0e010b220e85..974befa72ac0 100644 --- a/include/linux/usb/input.h +++ b/include/linux/usb/input.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Copyright (C) 2005 Dmitry Torokhov   * diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h index 4fd6513d564c..56559bc53214 100644 --- a/include/linux/usb/iowarrior.h +++ b/include/linux/usb/iowarrior.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_USB_IOWARRIOR_H  #define __LINUX_USB_IOWARRIOR_H diff --git a/include/linux/usb/irda.h b/include/linux/usb/irda.h index e345ceaf72d6..396d2b043e64 100644 --- a/include/linux/usb/irda.h +++ b/include/linux/usb/irda.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * USB IrDA Bridge Device Definition   */ diff --git a/include/linux/usb/isp116x.h b/include/linux/usb/isp116x.h index 96ca114e88d0..1f331c28bfe3 100644 --- a/include/linux/usb/isp116x.h +++ b/include/linux/usb/isp116x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Board initialization code should put one of these into dev->platform_data   * and place the isp116x onto platform_bus. diff --git a/include/linux/usb/isp1301.h b/include/linux/usb/isp1301.h index d3a851c28b6a..dedb3b2473e8 100644 --- a/include/linux/usb/isp1301.h +++ b/include/linux/usb/isp1301.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * NXP ISP1301 USB transceiver driver   * diff --git a/include/linux/usb/isp1362.h b/include/linux/usb/isp1362.h index 642684bb9292..5356c4ae386e 100644 --- a/include/linux/usb/isp1362.h +++ b/include/linux/usb/isp1362.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * board initialization code should put one of these into dev->platform_data   * and place the isp1362 onto platform_bus. diff --git a/include/linux/usb/isp1760.h b/include/linux/usb/isp1760.h index de7de53c5531..b75ded28db81 100644 --- a/include/linux/usb/isp1760.h +++ b/include/linux/usb/isp1760.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * board initialization should put one of these into dev->platform_data   * and place the isp1760 onto platform_bus named "isp1760-hcd". diff --git a/include/linux/usb/m66592.h b/include/linux/usb/m66592.h index a4ba31ab2fed..2dfe68183495 100644 --- a/include/linux/usb/m66592.h +++ b/include/linux/usb/m66592.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * M66592 driver platform data   * diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h deleted file mode 100644 index 974c3796a23f..000000000000 --- a/include/linux/usb/msm_hsusb_hw.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2007 Google, Inc. - * Author: Brian Swetland <swetland@google.com> - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - */ - -#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__ -#define __LINUX_USB_GADGET_MSM72K_UDC_H__ - -/* USB phy selector - in TCSR address range */ -#define USB2_PHY_SEL         0xfd4ab000 - -#define USB_AHBBURST         (MSM_USB_BASE + 0x0090) -#define USB_AHBMODE          (MSM_USB_BASE + 0x0098) -#define USB_GENCONFIG_2      (MSM_USB_BASE + 0x00a0) -#define ULPI_TX_PKT_EN_CLR_FIX	BIT(19) - -#define USB_CAPLENGTH        (MSM_USB_BASE + 0x0100) /* 8 bit */ - -#define USB_USBCMD           (MSM_USB_BASE + 0x0140) -#define USB_PORTSC           (MSM_USB_BASE + 0x0184) -#define USB_OTGSC            (MSM_USB_BASE + 0x01A4) -#define USB_USBMODE          (MSM_USB_BASE + 0x01A8) -#define USB_PHY_CTRL         (MSM_USB_BASE + 0x0240) -#define USB_PHY_CTRL2        (MSM_USB_BASE + 0x0278) - -#define GENCONFIG_2_SESS_VLD_CTRL_EN	BIT(7) -#define USBCMD_SESS_VLD_CTRL		BIT(25) - -#define USBCMD_RESET   2 -#define USB_USBINTR          (MSM_USB_BASE + 0x0148) - -#define PORTSC_PHCD            (1 << 23) /* phy suspend mode */ -#define PORTSC_PTS_MASK        (3 << 30) -#define PORTSC_PTS_ULPI        (2 << 30) -#define PORTSC_PTS_SERIAL      (3 << 30) - -#define USB_ULPI_VIEWPORT    (MSM_USB_BASE + 0x0170) -#define ULPI_RUN              (1 << 30) -#define ULPI_WRITE            (1 << 29) -#define ULPI_READ             (0 << 29) -#define ULPI_ADDR(n)          (((n) & 255) << 16) -#define ULPI_DATA(n)          ((n) & 255) -#define ULPI_DATA_READ(n)     (((n) >> 8) & 255) - -/* synopsys 28nm phy registers */ -#define ULPI_PWR_CLK_MNG_REG	0x88 -#define OTG_COMP_DISABLE	BIT(0) - -#define ULPI_MISC_A			0x96 -#define ULPI_MISC_A_VBUSVLDEXTSEL	BIT(1) -#define ULPI_MISC_A_VBUSVLDEXT		BIT(0) - -#define ASYNC_INTR_CTRL         (1 << 29) /* Enable async interrupt */ -#define ULPI_STP_CTRL           (1 << 30) /* Block communication with PHY */ -#define PHY_RETEN               (1 << 1) /* PHY retention enable/disable */ -#define PHY_POR_ASSERT		(1 << 0) /* USB2 28nm PHY POR ASSERT */ - -/* OTG definitions */ -#define OTGSC_INTSTS_MASK	(0x7f << 16) -#define OTGSC_ID		(1 << 8) -#define OTGSC_BSV		(1 << 11) -#define OTGSC_IDIS		(1 << 16) -#define OTGSC_BSVIS		(1 << 19) -#define OTGSC_IDIE		(1 << 24) -#define OTGSC_BSVIE		(1 << 27) - -#endif /* __LINUX_USB_GADGET_MSM72K_UDC_H__ */ diff --git a/include/linux/usb/musb-ux500.h b/include/linux/usb/musb-ux500.h index 1e2c7130f6e1..c4b7ad9850ca 100644 --- a/include/linux/usb/musb-ux500.h +++ b/include/linux/usb/musb-ux500.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * Copyright (C) 2013 ST-Ericsson AB   * diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index d315c8907869..5d19e6730475 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This is used to for host and peripheral modes of the driver for   * Inventra (Multidrop) Highspeed Dual-Role Controllers:  (M)HDRC. diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h index 725120224472..08b85caecfaf 100644 --- a/include/linux/usb/net2280.h +++ b/include/linux/usb/net2280.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * NetChip 2280 high/full speed USB device controller.   * Unlike many such controllers, this one talks PCI. diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h index 4031f47629ec..6cbe7a5c2b57 100644 --- a/include/linux/usb/of.h +++ b/include/linux/usb/of.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * OF helpers for usb devices.   * diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h index 012f2b7eb2b6..7eb16cf587ee 100644 --- a/include/linux/usb/ohci_pdriver.h +++ b/include/linux/usb/ohci_pdriver.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de>   * diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index a0a8f878503c..e78eb577d0fa 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /* Copyright (C) 2007,2008 Freescale Semiconductor, Inc.   *   * This program is free software; you can redistribute  it and/or modify it diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 67929df86df5..69f1b6328532 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* USB OTG (On The Go) defines */  /*   * diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h new file mode 100644 index 000000000000..e00051ced806 --- /dev/null +++ b/include/linux/usb/pd.h @@ -0,0 +1,298 @@ +/* + * Copyright 2015-2017 Google, Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_USB_PD_H +#define __LINUX_USB_PD_H + +#include <linux/types.h> +#include <linux/usb/typec.h> + +/* USB PD Messages */ +enum pd_ctrl_msg_type { +	/* 0 Reserved */ +	PD_CTRL_GOOD_CRC = 1, +	PD_CTRL_GOTO_MIN = 2, +	PD_CTRL_ACCEPT = 3, +	PD_CTRL_REJECT = 4, +	PD_CTRL_PING = 5, +	PD_CTRL_PS_RDY = 6, +	PD_CTRL_GET_SOURCE_CAP = 7, +	PD_CTRL_GET_SINK_CAP = 8, +	PD_CTRL_DR_SWAP = 9, +	PD_CTRL_PR_SWAP = 10, +	PD_CTRL_VCONN_SWAP = 11, +	PD_CTRL_WAIT = 12, +	PD_CTRL_SOFT_RESET = 13, +	/* 14-15 Reserved */ +}; + +enum pd_data_msg_type { +	/* 0 Reserved */ +	PD_DATA_SOURCE_CAP = 1, +	PD_DATA_REQUEST = 2, +	PD_DATA_BIST = 3, +	PD_DATA_SINK_CAP = 4, +	/* 5-14 Reserved */ +	PD_DATA_VENDOR_DEF = 15, +}; + +#define PD_REV10	0x0 +#define PD_REV20	0x1 + +#define PD_HEADER_CNT_SHIFT	12 +#define PD_HEADER_CNT_MASK	0x7 +#define PD_HEADER_ID_SHIFT	9 +#define PD_HEADER_ID_MASK	0x7 +#define PD_HEADER_PWR_ROLE	BIT(8) +#define PD_HEADER_REV_SHIFT	6 +#define PD_HEADER_REV_MASK	0x3 +#define PD_HEADER_DATA_ROLE	BIT(5) +#define PD_HEADER_TYPE_SHIFT	0 +#define PD_HEADER_TYPE_MASK	0xf + +#define PD_HEADER(type, pwr, data, id, cnt)				\ +	((((type) & PD_HEADER_TYPE_MASK) << PD_HEADER_TYPE_SHIFT) |	\ +	 ((pwr) == TYPEC_SOURCE ? PD_HEADER_PWR_ROLE : 0) |		\ +	 ((data) == TYPEC_HOST ? PD_HEADER_DATA_ROLE : 0) |		\ +	 (PD_REV20 << PD_HEADER_REV_SHIFT) |				\ +	 (((id) & PD_HEADER_ID_MASK) << PD_HEADER_ID_SHIFT) |		\ +	 (((cnt) & PD_HEADER_CNT_MASK) << PD_HEADER_CNT_SHIFT)) + +#define PD_HEADER_LE(type, pwr, data, id, cnt) \ +	cpu_to_le16(PD_HEADER((type), (pwr), (data), (id), (cnt))) + +static inline unsigned int pd_header_cnt(u16 header) +{ +	return (header >> PD_HEADER_CNT_SHIFT) & PD_HEADER_CNT_MASK; +} + +static inline unsigned int pd_header_cnt_le(__le16 header) +{ +	return pd_header_cnt(le16_to_cpu(header)); +} + +static inline unsigned int pd_header_type(u16 header) +{ +	return (header >> PD_HEADER_TYPE_SHIFT) & PD_HEADER_TYPE_MASK; +} + +static inline unsigned int pd_header_type_le(__le16 header) +{ +	return pd_header_type(le16_to_cpu(header)); +} + +static inline unsigned int pd_header_msgid(u16 header) +{ +	return (header >> PD_HEADER_ID_SHIFT) & PD_HEADER_ID_MASK; +} + +static inline unsigned int pd_header_msgid_le(__le16 header) +{ +	return pd_header_msgid(le16_to_cpu(header)); +} + +#define PD_MAX_PAYLOAD		7 + +/** + * struct pd_message - PD message as seen on wire + * @header:	PD message header + * @payload:	PD message payload + */ +struct pd_message { +	__le16 header; +	__le32 payload[PD_MAX_PAYLOAD]; +} __packed; + +/* PDO: Power Data Object */ +#define PDO_MAX_OBJECTS		7 + +enum pd_pdo_type { +	PDO_TYPE_FIXED = 0, +	PDO_TYPE_BATT = 1, +	PDO_TYPE_VAR = 2, +}; + +#define PDO_TYPE_SHIFT		30 +#define PDO_TYPE_MASK		0x3 + +#define PDO_TYPE(t)	((t) << PDO_TYPE_SHIFT) + +#define PDO_VOLT_MASK		0x3ff +#define PDO_CURR_MASK		0x3ff +#define PDO_PWR_MASK		0x3ff + +#define PDO_FIXED_DUAL_ROLE	BIT(29)	/* Power role swap supported */ +#define PDO_FIXED_SUSPEND	BIT(28) /* USB Suspend supported (Source) */ +#define PDO_FIXED_HIGHER_CAP	BIT(28) /* Requires more than vSafe5V (Sink) */ +#define PDO_FIXED_EXTPOWER	BIT(27) /* Externally powered */ +#define PDO_FIXED_USB_COMM	BIT(26) /* USB communications capable */ +#define PDO_FIXED_DATA_SWAP	BIT(25) /* Data role swap supported */ +#define PDO_FIXED_VOLT_SHIFT	10	/* 50mV units */ +#define PDO_FIXED_CURR_SHIFT	0	/* 10mA units */ + +#define PDO_FIXED_VOLT(mv)	((((mv) / 50) & PDO_VOLT_MASK) << PDO_FIXED_VOLT_SHIFT) +#define PDO_FIXED_CURR(ma)	((((ma) / 10) & PDO_CURR_MASK) << PDO_FIXED_CURR_SHIFT) + +#define PDO_FIXED(mv, ma, flags)			\ +	(PDO_TYPE(PDO_TYPE_FIXED) | (flags) |		\ +	 PDO_FIXED_VOLT(mv) | PDO_FIXED_CURR(ma)) + +#define PDO_BATT_MAX_VOLT_SHIFT	20	/* 50mV units */ +#define PDO_BATT_MIN_VOLT_SHIFT	10	/* 50mV units */ +#define PDO_BATT_MAX_PWR_SHIFT	0	/* 250mW units */ + +#define PDO_BATT_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MIN_VOLT_SHIFT) +#define PDO_BATT_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MAX_VOLT_SHIFT) +#define PDO_BATT_MAX_POWER(mw) ((((mw) / 250) & PDO_PWR_MASK) << PDO_BATT_MAX_PWR_SHIFT) + +#define PDO_BATT(min_mv, max_mv, max_mw)			\ +	(PDO_TYPE(PDO_TYPE_BATT) | PDO_BATT_MIN_VOLT(min_mv) |	\ +	 PDO_BATT_MAX_VOLT(max_mv) | PDO_BATT_MAX_POWER(max_mw)) + +#define PDO_VAR_MAX_VOLT_SHIFT	20	/* 50mV units */ +#define PDO_VAR_MIN_VOLT_SHIFT	10	/* 50mV units */ +#define PDO_VAR_MAX_CURR_SHIFT	0	/* 10mA units */ + +#define PDO_VAR_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT) +#define PDO_VAR_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MAX_VOLT_SHIFT) +#define PDO_VAR_MAX_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_VAR_MAX_CURR_SHIFT) + +#define PDO_VAR(min_mv, max_mv, max_ma)				\ +	(PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) |	\ +	 PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma)) + +static inline enum pd_pdo_type pdo_type(u32 pdo) +{ +	return (pdo >> PDO_TYPE_SHIFT) & PDO_TYPE_MASK; +} + +static inline unsigned int pdo_fixed_voltage(u32 pdo) +{ +	return ((pdo >> PDO_FIXED_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; +} + +static inline unsigned int pdo_min_voltage(u32 pdo) +{ +	return ((pdo >> PDO_VAR_MIN_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; +} + +static inline unsigned int pdo_max_voltage(u32 pdo) +{ +	return ((pdo >> PDO_VAR_MAX_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; +} + +static inline unsigned int pdo_max_current(u32 pdo) +{ +	return ((pdo >> PDO_VAR_MAX_CURR_SHIFT) & PDO_CURR_MASK) * 10; +} + +static inline unsigned int pdo_max_power(u32 pdo) +{ +	return ((pdo >> PDO_BATT_MAX_PWR_SHIFT) & PDO_PWR_MASK) * 250; +} + +/* RDO: Request Data Object */ +#define RDO_OBJ_POS_SHIFT	28 +#define RDO_OBJ_POS_MASK	0x7 +#define RDO_GIVE_BACK		BIT(27)	/* Supports reduced operating current */ +#define RDO_CAP_MISMATCH	BIT(26) /* Not satisfied by source caps */ +#define RDO_USB_COMM		BIT(25) /* USB communications capable */ +#define RDO_NO_SUSPEND		BIT(24) /* USB Suspend not supported */ + +#define RDO_PWR_MASK			0x3ff +#define RDO_CURR_MASK			0x3ff + +#define RDO_FIXED_OP_CURR_SHIFT		10 +#define RDO_FIXED_MAX_CURR_SHIFT	0 + +#define RDO_OBJ(idx) (((idx) & RDO_OBJ_POS_MASK) << RDO_OBJ_POS_SHIFT) + +#define PDO_FIXED_OP_CURR(ma) ((((ma) / 10) & RDO_CURR_MASK) << RDO_FIXED_OP_CURR_SHIFT) +#define PDO_FIXED_MAX_CURR(ma) ((((ma) / 10) & RDO_CURR_MASK) << RDO_FIXED_MAX_CURR_SHIFT) + +#define RDO_FIXED(idx, op_ma, max_ma, flags)			\ +	(RDO_OBJ(idx) | (flags) |				\ +	 PDO_FIXED_OP_CURR(op_ma) | PDO_FIXED_MAX_CURR(max_ma)) + +#define RDO_BATT_OP_PWR_SHIFT		10	/* 250mW units */ +#define RDO_BATT_MAX_PWR_SHIFT		0	/* 250mW units */ + +#define RDO_BATT_OP_PWR(mw) ((((mw) / 250) & RDO_PWR_MASK) << RDO_BATT_OP_PWR_SHIFT) +#define RDO_BATT_MAX_PWR(mw) ((((mw) / 250) & RDO_PWR_MASK) << RDO_BATT_MAX_PWR_SHIFT) + +#define RDO_BATT(idx, op_mw, max_mw, flags)			\ +	(RDO_OBJ(idx) | (flags) |				\ +	 RDO_BATT_OP_PWR(op_mw) | RDO_BATT_MAX_PWR(max_mw)) + +static inline unsigned int rdo_index(u32 rdo) +{ +	return (rdo >> RDO_OBJ_POS_SHIFT) & RDO_OBJ_POS_MASK; +} + +static inline unsigned int rdo_op_current(u32 rdo) +{ +	return ((rdo >> RDO_FIXED_OP_CURR_SHIFT) & RDO_CURR_MASK) * 10; +} + +static inline unsigned int rdo_max_current(u32 rdo) +{ +	return ((rdo >> RDO_FIXED_MAX_CURR_SHIFT) & +		RDO_CURR_MASK) * 10; +} + +static inline unsigned int rdo_op_power(u32 rdo) +{ +	return ((rdo >> RDO_BATT_OP_PWR_SHIFT) & RDO_PWR_MASK) * 250; +} + +static inline unsigned int rdo_max_power(u32 rdo) +{ +	return ((rdo >> RDO_BATT_MAX_PWR_SHIFT) & RDO_PWR_MASK) * 250; +} + +/* USB PD timers and counters */ +#define PD_T_NO_RESPONSE	5000	/* 4.5 - 5.5 seconds */ +#define PD_T_DB_DETECT		10000	/* 10 - 15 seconds */ +#define PD_T_SEND_SOURCE_CAP	150	/* 100 - 200 ms */ +#define PD_T_SENDER_RESPONSE	60	/* 24 - 30 ms, relaxed */ +#define PD_T_SOURCE_ACTIVITY	45 +#define PD_T_SINK_ACTIVITY	135 +#define PD_T_SINK_WAIT_CAP	240 +#define PD_T_PS_TRANSITION	500 +#define PD_T_SRC_TRANSITION	35 +#define PD_T_DRP_SNK		40 +#define PD_T_DRP_SRC		30 +#define PD_T_PS_SOURCE_OFF	920 +#define PD_T_PS_SOURCE_ON	480 +#define PD_T_PS_HARD_RESET	30 +#define PD_T_SRC_RECOVER	760 +#define PD_T_SRC_RECOVER_MAX	1000 +#define PD_T_SRC_TURN_ON	275 +#define PD_T_SAFE_0V		650 +#define PD_T_VCONN_SOURCE_ON	100 +#define PD_T_SINK_REQUEST	100	/* 100 ms minimum */ +#define PD_T_ERROR_RECOVERY	100	/* minimum 25 is insufficient */ +#define PD_T_SRCSWAPSTDBY      625     /* Maximum of 650ms */ +#define PD_T_NEWSRC            250     /* Maximum of 275ms */ + +#define PD_T_DRP_TRY		100	/* 75 - 150 ms */ +#define PD_T_DRP_TRYWAIT	600	/* 400 - 800 ms */ + +#define PD_T_CC_DEBOUNCE	200	/* 100 - 200 ms */ +#define PD_T_PD_DEBOUNCE	20	/* 10 - 20 ms */ + +#define PD_N_CAPS_COUNT		(PD_T_NO_RESPONSE / PD_T_SEND_SOURCE_CAP) +#define PD_N_HARD_RESET_COUNT	2 + +#endif /* __LINUX_USB_PD_H */ diff --git a/include/linux/usb/pd_bdo.h b/include/linux/usb/pd_bdo.h new file mode 100644 index 000000000000..90b94d9fea5d --- /dev/null +++ b/include/linux/usb/pd_bdo.h @@ -0,0 +1,31 @@ +/* + * Copyright 2015-2017 Google, Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_USB_PD_BDO_H +#define __LINUX_USB_PD_BDO_H + +/* BDO : BIST Data Object */ +#define BDO_MODE_RECV		(0 << 28) +#define BDO_MODE_TRANSMIT	(1 << 28) +#define BDO_MODE_COUNTERS	(2 << 28) +#define BDO_MODE_CARRIER0	(3 << 28) +#define BDO_MODE_CARRIER1	(4 << 28) +#define BDO_MODE_CARRIER2	(5 << 28) +#define BDO_MODE_CARRIER3	(6 << 28) +#define BDO_MODE_EYE		(7 << 28) +#define BDO_MODE_TESTDATA	(8 << 28) + +#define BDO_MODE_MASK(mode)	((mode) & 0xf0000000) + +#endif diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h new file mode 100644 index 000000000000..d92259f8de0a --- /dev/null +++ b/include/linux/usb/pd_vdo.h @@ -0,0 +1,251 @@ +/* + * Copyright 2015-2017 Google, Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_USB_PD_VDO_H +#define __LINUX_USB_PD_VDO_H + +#include "pd.h" + +/* + * VDO : Vendor Defined Message Object + * VDM object is minimum of VDM header + 6 additional data objects. + */ + +#define VDO_MAX_OBJECTS		6 +#define VDO_MAX_SIZE		(VDO_MAX_OBJECTS + 1) + +/* + * VDM header + * ---------- + * <31:16>  :: SVID + * <15>     :: VDM type ( 1b == structured, 0b == unstructured ) + * <14:13>  :: Structured VDM version (can only be 00 == 1.0 currently) + * <12:11>  :: reserved + * <10:8>   :: object position (1-7 valid ... used for enter/exit mode only) + * <7:6>    :: command type (SVDM only?) + * <5>      :: reserved (SVDM), command type (UVDM) + * <4:0>    :: command + */ +#define VDO(vid, type, custom)				\ +	(((vid) << 16) |				\ +	 ((type) << 15) |				\ +	 ((custom) & 0x7FFF)) + +#define VDO_SVDM_TYPE		(1 << 15) +#define VDO_SVDM_VERS(x)	((x) << 13) +#define VDO_OPOS(x)		((x) << 8) +#define VDO_CMDT(x)		((x) << 6) +#define VDO_OPOS_MASK		VDO_OPOS(0x7) +#define VDO_CMDT_MASK		VDO_CMDT(0x3) + +#define CMDT_INIT		0 +#define CMDT_RSP_ACK		1 +#define CMDT_RSP_NAK		2 +#define CMDT_RSP_BUSY		3 + +/* reserved for SVDM ... for Google UVDM */ +#define VDO_SRC_INITIATOR	(0 << 5) +#define VDO_SRC_RESPONDER	(1 << 5) + +#define CMD_DISCOVER_IDENT	1 +#define CMD_DISCOVER_SVID	2 +#define CMD_DISCOVER_MODES	3 +#define CMD_ENTER_MODE		4 +#define CMD_EXIT_MODE		5 +#define CMD_ATTENTION		6 + +#define VDO_CMD_VENDOR(x)    (((10 + (x)) & 0x1f)) + +/* ChromeOS specific commands */ +#define VDO_CMD_VERSION		VDO_CMD_VENDOR(0) +#define VDO_CMD_SEND_INFO	VDO_CMD_VENDOR(1) +#define VDO_CMD_READ_INFO	VDO_CMD_VENDOR(2) +#define VDO_CMD_REBOOT		VDO_CMD_VENDOR(5) +#define VDO_CMD_FLASH_ERASE	VDO_CMD_VENDOR(6) +#define VDO_CMD_FLASH_WRITE	VDO_CMD_VENDOR(7) +#define VDO_CMD_ERASE_SIG	VDO_CMD_VENDOR(8) +#define VDO_CMD_PING_ENABLE	VDO_CMD_VENDOR(10) +#define VDO_CMD_CURRENT		VDO_CMD_VENDOR(11) +#define VDO_CMD_FLIP		VDO_CMD_VENDOR(12) +#define VDO_CMD_GET_LOG		VDO_CMD_VENDOR(13) +#define VDO_CMD_CCD_EN		VDO_CMD_VENDOR(14) + +#define PD_VDO_VID(vdo)		((vdo) >> 16) +#define PD_VDO_SVDM(vdo)	(((vdo) >> 15) & 1) +#define PD_VDO_OPOS(vdo)	(((vdo) >> 8) & 0x7) +#define PD_VDO_CMD(vdo)		((vdo) & 0x1f) +#define PD_VDO_CMDT(vdo)	(((vdo) >> 6) & 0x3) + +/* + * SVDM Identity request -> response + * + * Request is simply properly formatted SVDM header + * + * Response is 4 data objects: + * [0] :: SVDM header + * [1] :: Identitiy header + * [2] :: Cert Stat VDO + * [3] :: (Product | Cable) VDO + * [4] :: AMA VDO + * + */ +#define VDO_INDEX_HDR		0 +#define VDO_INDEX_IDH		1 +#define VDO_INDEX_CSTAT		2 +#define VDO_INDEX_CABLE		3 +#define VDO_INDEX_PRODUCT	3 +#define VDO_INDEX_AMA		4 + +/* + * SVDM Identity Header + * -------------------- + * <31>     :: data capable as a USB host + * <30>     :: data capable as a USB device + * <29:27>  :: product type + * <26>     :: modal operation supported (1b == yes) + * <25:16>  :: Reserved, Shall be set to zero + * <15:0>   :: USB-IF assigned VID for this cable vendor + */ +#define IDH_PTYPE_UNDEF		0 +#define IDH_PTYPE_HUB		1 +#define IDH_PTYPE_PERIPH	2 +#define IDH_PTYPE_PCABLE	3 +#define IDH_PTYPE_ACABLE	4 +#define IDH_PTYPE_AMA		5 + +#define VDO_IDH(usbh, usbd, ptype, is_modal, vid)		\ +	((usbh) << 31 | (usbd) << 30 | ((ptype) & 0x7) << 27	\ +	 | (is_modal) << 26 | ((vid) & 0xffff)) + +#define PD_IDH_PTYPE(vdo)	(((vdo) >> 27) & 0x7) +#define PD_IDH_VID(vdo)		((vdo) & 0xffff) +#define PD_IDH_MODAL_SUPP(vdo)	((vdo) & (1 << 26)) + +/* + * Cert Stat VDO + * ------------- + * <31:0>  : USB-IF assigned XID for this cable + */ +#define PD_CSTAT_XID(vdo)	(vdo) + +/* + * Product VDO + * ----------- + * <31:16> : USB Product ID + * <15:0>  : USB bcdDevice + */ +#define VDO_PRODUCT(pid, bcd)	(((pid) & 0xffff) << 16 | ((bcd) & 0xffff)) +#define PD_PRODUCT_PID(vdo)	(((vdo) >> 16) & 0xffff) + +/* + * Cable VDO + * --------- + * <31:28> :: Cable HW version + * <27:24> :: Cable FW version + * <23:20> :: Reserved, Shall be set to zero + * <19:18> :: type-C to Type-A/B/C (00b == A, 01 == B, 10 == C) + * <17>    :: Type-C to Plug/Receptacle (0b == plug, 1b == receptacle) + * <16:13> :: cable latency (0001 == <10ns(~1m length)) + * <12:11> :: cable termination type (11b == both ends active VCONN req) + * <10>    :: SSTX1 Directionality support (0b == fixed, 1b == cfgable) + * <9>     :: SSTX2 Directionality support + * <8>     :: SSRX1 Directionality support + * <7>     :: SSRX2 Directionality support + * <6:5>   :: Vbus current handling capability + * <4>     :: Vbus through cable (0b == no, 1b == yes) + * <3>     :: SOP" controller present? (0b == no, 1b == yes) + * <2:0>   :: USB SS Signaling support + */ +#define CABLE_ATYPE		0 +#define CABLE_BTYPE		1 +#define CABLE_CTYPE		2 +#define CABLE_PLUG		0 +#define CABLE_RECEPTACLE	1 +#define CABLE_CURR_1A5		0 +#define CABLE_CURR_3A		1 +#define CABLE_CURR_5A		2 +#define CABLE_USBSS_U2_ONLY	0 +#define CABLE_USBSS_U31_GEN1	1 +#define CABLE_USBSS_U31_GEN2	2 +#define VDO_CABLE(hw, fw, cbl, gdr, lat, term, tx1d, tx2d, rx1d, rx2d, cur,\ +		  vps, sopp, usbss) \ +	(((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 | ((cbl) & 0x3) << 18	\ +	 | (gdr) << 17 | ((lat) & 0x7) << 13 | ((term) & 0x3) << 11	\ +	 | (tx1d) << 10 | (tx2d) << 9 | (rx1d) << 8 | (rx2d) << 7	\ +	 | ((cur) & 0x3) << 5 | (vps) << 4 | (sopp) << 3		\ +	 | ((usbss) & 0x7)) + +/* + * AMA VDO + * --------- + * <31:28> :: Cable HW version + * <27:24> :: Cable FW version + * <23:12> :: Reserved, Shall be set to zero + * <11>    :: SSTX1 Directionality support (0b == fixed, 1b == cfgable) + * <10>    :: SSTX2 Directionality support + * <9>     :: SSRX1 Directionality support + * <8>     :: SSRX2 Directionality support + * <7:5>   :: Vconn power + * <4>     :: Vconn power required + * <3>     :: Vbus power required + * <2:0>   :: USB SS Signaling support + */ +#define VDO_AMA(hw, fw, tx1d, tx2d, rx1d, rx2d, vcpwr, vcr, vbr, usbss) \ +	(((hw) & 0x7) << 28 | ((fw) & 0x7) << 24			\ +	 | (tx1d) << 11 | (tx2d) << 10 | (rx1d) << 9 | (rx2d) << 8	\ +	 | ((vcpwr) & 0x7) << 5 | (vcr) << 4 | (vbr) << 3		\ +	 | ((usbss) & 0x7)) + +#define PD_VDO_AMA_VCONN_REQ(vdo)	(((vdo) >> 4) & 1) +#define PD_VDO_AMA_VBUS_REQ(vdo)	(((vdo) >> 3) & 1) + +#define AMA_VCONN_PWR_1W	0 +#define AMA_VCONN_PWR_1W5	1 +#define AMA_VCONN_PWR_2W	2 +#define AMA_VCONN_PWR_3W	3 +#define AMA_VCONN_PWR_4W	4 +#define AMA_VCONN_PWR_5W	5 +#define AMA_VCONN_PWR_6W	6 +#define AMA_USBSS_U2_ONLY	0 +#define AMA_USBSS_U31_GEN1	1 +#define AMA_USBSS_U31_GEN2	2 +#define AMA_USBSS_BBONLY	3 + +/* + * SVDM Discover SVIDs request -> response + * + * Request is properly formatted VDM Header with discover SVIDs command. + * Response is a set of SVIDs of all all supported SVIDs with all zero's to + * mark the end of SVIDs.  If more than 12 SVIDs are supported command SHOULD be + * repeated. + */ +#define VDO_SVID(svid0, svid1)	(((svid0) & 0xffff) << 16 | ((svid1) & 0xffff)) +#define PD_VDO_SVID_SVID0(vdo)	((vdo) >> 16) +#define PD_VDO_SVID_SVID1(vdo)	((vdo) & 0xffff) + +/* USB-IF SIDs */ +#define USB_SID_PD		0xff00 /* power delivery */ +#define USB_SID_DISPLAYPORT	0xff01 +#define USB_SID_MHL		0xff02	/* Mobile High-Definition Link */ + +/* VDM command timeouts (in ms) */ + +#define PD_T_VDM_UNSTRUCTURED	500 +#define PD_T_VDM_BUSY		100 +#define PD_T_VDM_WAIT_MODE_E	100 +#define PD_T_VDM_SNDR_RSP	30 +#define PD_T_VDM_E_MODE		25 +#define PD_T_VDM_RCVR_RSP	15 + +#endif /* __LINUX_USB_PD_VDO_H */ diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 8c6914873a16..b7a2625947f5 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * USB PHY defines   * diff --git a/include/linux/usb/phy_companion.h b/include/linux/usb/phy_companion.h index edd2ec23d282..407f530061cd 100644 --- a/include/linux/usb/phy_companion.h +++ b/include/linux/usb/phy_companion.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * phy-companion.h -- phy companion to indicate the comparator part of PHY   * diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index de2a722fe3cf..f1fcec2fd5f8 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This file holds the definitions of quirks found in USB devices.   * Only quirks that affect the whole device, not an interface, @@ -56,4 +57,10 @@   */  #define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL	BIT(11) +/* + * Device needs to be disconnected before suspend to prevent spurious + * wakeup. + */ +#define USB_QUIRK_DISCONNECT_SUSPEND		BIT(12) +  #endif /* __LINUX_USB_QUIRKS_H */ diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h index 55805f9dcf21..c0753d026bbf 100644 --- a/include/linux/usb/r8a66597.h +++ b/include/linux/usb/r8a66597.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * R8A66597 driver platform data   * diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index 00a47d058d83..67102f3d59d4 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-1.0+  /*   * Renesas USB   * @@ -183,8 +184,9 @@ struct renesas_usbhs_driver_param {  #define USBHS_USB_DMAC_XFER_SIZE	32	/* hardcode the xfer size */  }; -#define USBHS_TYPE_RCAR_GEN2	1 -#define USBHS_TYPE_RCAR_GEN3	2 +#define USBHS_TYPE_RCAR_GEN2		1 +#define USBHS_TYPE_RCAR_GEN3		2 +#define USBHS_TYPE_RCAR_GEN3_WITH_PLL	3  /*   * option: diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h index d44ef85db177..809bccd08455 100644 --- a/include/linux/usb/rndis_host.h +++ b/include/linux/usb/rndis_host.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * Host Side support for RNDIS Networking Links   * Copyright (C) 2005 by David Brownell diff --git a/include/linux/usb/samsung_usb_phy.h b/include/linux/usb/samsung_usb_phy.h index 916782699f1c..dc0071741695 100644 --- a/include/linux/usb/samsung_usb_phy.h +++ b/include/linux/usb/samsung_usb_phy.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * Copyright (C) 2012 Samsung Electronics Co.Ltd   *		http://www.samsung.com/ diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index e2f0ab07eea5..106551a5616e 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * USB Serial Converter stuff   * diff --git a/include/linux/usb/sl811.h b/include/linux/usb/sl811.h index 3afe4d16fcef..6c97f8e66492 100644 --- a/include/linux/usb/sl811.h +++ b/include/linux/usb/sl811.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * board initialization should put one of these into dev->platform_data   * and place the sl811hs onto platform_bus named "sl811-hcd". diff --git a/include/linux/usb/storage.h b/include/linux/usb/storage.h index 305ee8db7faf..e0240f864548 100644 --- a/include/linux/usb/storage.h +++ b/include/linux/usb/storage.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #ifndef __LINUX_USB_STORAGE_H  #define __LINUX_USB_STORAGE_H diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h new file mode 100644 index 000000000000..073197f0d2bb --- /dev/null +++ b/include/linux/usb/tcpm.h @@ -0,0 +1,204 @@ +/* + * Copyright 2015-2017 Google, Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_USB_TCPM_H +#define __LINUX_USB_TCPM_H + +#include <linux/bitops.h> +#include <linux/usb/typec.h> +#include "pd.h" + +enum typec_cc_status { +	TYPEC_CC_OPEN, +	TYPEC_CC_RA, +	TYPEC_CC_RD, +	TYPEC_CC_RP_DEF, +	TYPEC_CC_RP_1_5, +	TYPEC_CC_RP_3_0, +}; + +enum typec_cc_polarity { +	TYPEC_POLARITY_CC1, +	TYPEC_POLARITY_CC2, +}; + +/* Time to wait for TCPC to complete transmit */ +#define PD_T_TCPC_TX_TIMEOUT	100		/* in ms	*/ +#define PD_ROLE_SWAP_TIMEOUT	(MSEC_PER_SEC * 10) + +enum tcpm_transmit_status { +	TCPC_TX_SUCCESS = 0, +	TCPC_TX_DISCARDED = 1, +	TCPC_TX_FAILED = 2, +}; + +enum tcpm_transmit_type { +	TCPC_TX_SOP = 0, +	TCPC_TX_SOP_PRIME = 1, +	TCPC_TX_SOP_PRIME_PRIME = 2, +	TCPC_TX_SOP_DEBUG_PRIME = 3, +	TCPC_TX_SOP_DEBUG_PRIME_PRIME = 4, +	TCPC_TX_HARD_RESET = 5, +	TCPC_TX_CABLE_RESET = 6, +	TCPC_TX_BIST_MODE_2 = 7 +}; + +/** + * struct tcpc_config - Port configuration + * @src_pdo:	PDO parameters sent to port partner as response to + *		PD_CTRL_GET_SOURCE_CAP message + * @nr_src_pdo:	Number of entries in @src_pdo + * @snk_pdo:	PDO parameters sent to partner as response to + *		PD_CTRL_GET_SINK_CAP message + * @nr_snk_pdo:	Number of entries in @snk_pdo + * @max_snk_mv:	Maximum acceptable sink voltage in mV + * @max_snk_ma:	Maximum sink current in mA + * @max_snk_mw:	Maximum required sink power in mW + * @operating_snk_mw: + *		Required operating sink power in mW + * @type:	Port type (TYPEC_PORT_DFP, TYPEC_PORT_UFP, or + *		TYPEC_PORT_DRP) + * @default_role: + *		Default port role (TYPEC_SINK or TYPEC_SOURCE). + *		Set to TYPEC_NO_PREFERRED_ROLE if no default role. + * @try_role_hw:True if try.{Src,Snk} is implemented in hardware + * @alt_modes:	List of supported alternate modes + */ +struct tcpc_config { +	const u32 *src_pdo; +	unsigned int nr_src_pdo; + +	const u32 *snk_pdo; +	unsigned int nr_snk_pdo; + +	const u32 *snk_vdo; +	unsigned int nr_snk_vdo; + +	unsigned int max_snk_mv; +	unsigned int max_snk_ma; +	unsigned int max_snk_mw; +	unsigned int operating_snk_mw; + +	enum typec_port_type type; +	enum typec_role default_role; +	bool try_role_hw;	/* try.{src,snk} implemented in hardware */ + +	const struct typec_altmode_desc *alt_modes; +}; + +enum tcpc_usb_switch { +	TCPC_USB_SWITCH_CONNECT, +	TCPC_USB_SWITCH_DISCONNECT, +}; + +/* Mux state attributes */ +#define TCPC_MUX_USB_ENABLED		BIT(0)	/* USB enabled */ +#define TCPC_MUX_DP_ENABLED		BIT(1)	/* DP enabled */ +#define TCPC_MUX_POLARITY_INVERTED	BIT(2)	/* Polarity inverted */ + +/* Mux modes, decoded to attributes */ +enum tcpc_mux_mode { +	TYPEC_MUX_NONE	= 0,				/* Open switch */ +	TYPEC_MUX_USB	= TCPC_MUX_USB_ENABLED,		/* USB only */ +	TYPEC_MUX_DP	= TCPC_MUX_DP_ENABLED,		/* DP only */ +	TYPEC_MUX_DOCK	= TCPC_MUX_USB_ENABLED |	/* Both USB and DP */ +			  TCPC_MUX_DP_ENABLED, +}; + +struct tcpc_mux_dev { +	int (*set)(struct tcpc_mux_dev *dev, enum tcpc_mux_mode mux_mode, +		   enum tcpc_usb_switch usb_config, +		   enum typec_cc_polarity polarity); +	bool dfp_only; +	void *priv_data; +}; + +/** + * struct tcpc_dev - Port configuration and callback functions + * @config:	Pointer to port configuration + * @get_vbus:	Called to read current VBUS state + * @get_current_limit: + *		Optional; called by the tcpm core when configured as a snk + *		and cc=Rp-def. This allows the tcpm to provide a fallback + *		current-limit detection method for the cc=Rp-def case. + *		For example, some tcpcs may include BC1.2 charger detection + *		and use that in this case. + * @set_cc:	Called to set value of CC pins + * @get_cc:	Called to read current CC pin values + * @set_polarity: + *		Called to set polarity + * @set_vconn:	Called to enable or disable VCONN + * @set_vbus:	Called to enable or disable VBUS + * @set_current_limit: + *		Optional; called to set current limit as negotiated + *		with partner. + * @set_pd_rx:	Called to enable or disable reception of PD messages + * @set_roles:	Called to set power and data roles + * @start_drp_toggling: + *		Optional; if supported by hardware, called to start DRP + *		toggling. DRP toggling is stopped automatically if + *		a connection is established. + * @try_role:	Optional; called to set a preferred role + * @pd_transmit:Called to transmit PD message + * @mux:	Pointer to multiplexer data + */ +struct tcpc_dev { +	const struct tcpc_config *config; + +	int (*init)(struct tcpc_dev *dev); +	int (*get_vbus)(struct tcpc_dev *dev); +	int (*get_current_limit)(struct tcpc_dev *dev); +	int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc); +	int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1, +		      enum typec_cc_status *cc2); +	int (*set_polarity)(struct tcpc_dev *dev, +			    enum typec_cc_polarity polarity); +	int (*set_vconn)(struct tcpc_dev *dev, bool on); +	int (*set_vbus)(struct tcpc_dev *dev, bool on, bool charge); +	int (*set_current_limit)(struct tcpc_dev *dev, u32 max_ma, u32 mv); +	int (*set_pd_rx)(struct tcpc_dev *dev, bool on); +	int (*set_roles)(struct tcpc_dev *dev, bool attached, +			 enum typec_role role, enum typec_data_role data); +	int (*start_drp_toggling)(struct tcpc_dev *dev, +				  enum typec_cc_status cc); +	int (*try_role)(struct tcpc_dev *dev, int role); +	int (*pd_transmit)(struct tcpc_dev *dev, enum tcpm_transmit_type type, +			   const struct pd_message *msg); +	struct tcpc_mux_dev *mux; +}; + +struct tcpm_port; + +struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc); +void tcpm_unregister_port(struct tcpm_port *port); + +void tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo, +				     unsigned int nr_pdo); +void tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo, +				   unsigned int nr_pdo, +				   unsigned int max_snk_mv, +				   unsigned int max_snk_ma, +				   unsigned int max_snk_mw, +				   unsigned int operating_snk_mw); + +void tcpm_vbus_change(struct tcpm_port *port); +void tcpm_cc_change(struct tcpm_port *port); +void tcpm_pd_receive(struct tcpm_port *port, +		     const struct pd_message *msg); +void tcpm_pd_transmit_complete(struct tcpm_port *port, +			       enum tcpm_transmit_status status); +void tcpm_pd_hard_reset(struct tcpm_port *port); +void tcpm_tcpc_reset(struct tcpm_port *port); + +#endif /* __LINUX_USB_TCPM_H */ diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h index 1de16c324ec8..d641ea1660b7 100644 --- a/include/linux/usb/tegra_usb_phy.h +++ b/include/linux/usb/tegra_usb_phy.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Copyright (C) 2010 Google, Inc.   * diff --git a/include/linux/usb/tilegx.h b/include/linux/usb/tilegx.h index 2d65e3435680..817908573fe8 100644 --- a/include/linux/usb/tilegx.h +++ b/include/linux/usb/tilegx.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Copyright 2012 Tilera Corporation. All Rights Reserved.   * diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index ffe7487886ca..0d44ce6af08f 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_USB_TYPEC_H  #define __LINUX_USB_TYPEC_H diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h index 3fc8e8b9f043..aa3ad39d39dc 100644 --- a/include/linux/usb/uas.h +++ b/include/linux/usb/uas.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __USB_UAS_H__  #define __USB_UAS_H__ diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 5f07407a367a..c515765adab7 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * ulpi.h -- ULPI defines and function prorotypes   * diff --git a/include/linux/usb/usb338x.h b/include/linux/usb/usb338x.h index 11525d8d89a7..7189e3387bf9 100644 --- a/include/linux/usb/usb338x.h +++ b/include/linux/usb/usb338x.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * USB 338x super/high/full speed USB device controller.   * Unlike many such controllers, this one talks PCI. diff --git a/include/linux/usb/usb_phy_generic.h b/include/linux/usb/usb_phy_generic.h index c13632d5292e..7408cf52c710 100644 --- a/include/linux/usb/usb_phy_generic.h +++ b/include/linux/usb/usb_phy_generic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_USB_NOP_XCEIV_H  #define __LINUX_USB_NOP_XCEIV_H diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 97116379db5f..a69877734c4e 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*   * USB Networking Link Interface   * diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h index c1257130769b..64a840b5106e 100644 --- a/include/linux/usb/wusb-wa.h +++ b/include/linux/usb/wusb-wa.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Wireless USB Wire Adapter constants and structures.   * diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h index eeb28329fa3c..9e4a3213f2c2 100644 --- a/include/linux/usb/wusb.h +++ b/include/linux/usb/wusb.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Wireless USB Standard Definitions   * Event Size Tables diff --git a/include/linux/usb/xhci-dbgp.h b/include/linux/usb/xhci-dbgp.h index 80c1cca1f529..0a37f1283bf0 100644 --- a/include/linux/usb/xhci-dbgp.h +++ b/include/linux/usb/xhci-dbgp.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Standalone xHCI debug capability driver   * diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 0aae1b2ee931..000a5954b2e8 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Interface to the libusual.   * diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index 04a26285416c..79aab0065ec8 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+  /*****************************************************************************/  /* diff --git a/include/linux/user-return-notifier.h b/include/linux/user-return-notifier.h index 9c4a445bb43c..c07b386a9e93 100644 --- a/include/linux/user-return-notifier.h +++ b/include/linux/user-return-notifier.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_USER_RETURN_NOTIFIER_H  #define _LINUX_USER_RETURN_NOTIFIER_H diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index c18e01252346..d6b74b91096b 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_USER_NAMESPACE_H  #define _LINUX_USER_NAMESPACE_H @@ -10,15 +11,24 @@  #include <linux/sysctl.h>  #include <linux/err.h> -#define UID_GID_MAP_MAX_EXTENTS 5 +#define UID_GID_MAP_MAX_BASE_EXTENTS 5 +#define UID_GID_MAP_MAX_EXTENTS 340 -struct uid_gid_map {	/* 64 bytes -- 1 cache line */ +struct uid_gid_extent { +	u32 first; +	u32 lower_first; +	u32 count; +}; + +struct uid_gid_map { /* 64 bytes -- 1 cache line */  	u32 nr_extents; -	struct uid_gid_extent { -		u32 first; -		u32 lower_first; -		u32 count; -	} extent[UID_GID_MAP_MAX_EXTENTS]; +	union { +		struct uid_gid_extent extent[UID_GID_MAP_MAX_BASE_EXTENTS]; +		struct { +			struct uid_gid_extent *forward; +			struct uid_gid_extent *reverse; +		}; +	};  };  #define USERNS_SETGROUPS_ALLOWED 1UL diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h index 48a3483dccb1..f2f3b68ba910 100644 --- a/include/linux/userfaultfd_k.h +++ b/include/linux/userfaultfd_k.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  include/linux/userfaultfd_k.h   * diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h index f9b2ce58039b..72299f261b25 100644 --- a/include/linux/util_macros.h +++ b/include/linux/util_macros.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_HELPER_MACROS_H_  #define _LINUX_HELPER_MACROS_H_ diff --git a/include/linux/uts.h b/include/linux/uts.h index 6ddbd86377de..d62829530c2f 100644 --- a/include/linux/uts.h +++ b/include/linux/uts.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UTS_H  #define _LINUX_UTS_H diff --git a/include/linux/utsname.h b/include/linux/utsname.h index da826ed059cf..c8060c2ecd04 100644 --- a/include/linux/utsname.h +++ b/include/linux/utsname.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_UTSNAME_H  #define _LINUX_UTSNAME_H diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index af6c03f7f986..bae807eb2933 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <generated/utsrelease.h>  /* Simply sanity version stamp for modules. */ diff --git a/include/linux/vfs.h b/include/linux/vfs.h index e701d0541405..33952ac00a19 100644 --- a/include/linux/vfs.h +++ b/include/linux/vfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VFS_H  #define _LINUX_VFS_H diff --git a/include/linux/via.h b/include/linux/via.h index 86ae3bcdb2ba..38ea9a77426a 100644 --- a/include/linux/via.h +++ b/include/linux/via.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Miscellaneous definitions for VIA chipsets     Currently used only by drivers/parport/parport_pc.c */ diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 28b0e965360f..988c7355bc22 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VIRTIO_H  #define _LINUX_VIRTIO_H  /* Everything a virtio driver needs to work with any particular virtio diff --git a/include/linux/virtio_byteorder.h b/include/linux/virtio_byteorder.h index ce63a2c3a612..825aaefac9b1 100644 --- a/include/linux/virtio_byteorder.h +++ b/include/linux/virtio_byteorder.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VIRTIO_BYTEORDER_H  #define _LINUX_VIRTIO_BYTEORDER_H  #include <linux/types.h> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 0133d8a12ccd..5559a2d31c46 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VIRTIO_CONFIG_H  #define _LINUX_VIRTIO_CONFIG_H diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 32fb046f2173..f144216febc6 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VIRTIO_NET_H  #define _LINUX_VIRTIO_NET_H @@ -8,7 +9,7 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,  					const struct virtio_net_hdr *hdr,  					bool little_endian)  { -	unsigned short gso_type = 0; +	unsigned int gso_type = 0;  	if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {  		switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { @@ -18,6 +19,9 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,  		case VIRTIO_NET_HDR_GSO_TCPV6:  			gso_type = SKB_GSO_TCPV6;  			break; +		case VIRTIO_NET_HDR_GSO_UDP: +			gso_type = SKB_GSO_UDP; +			break;  		default:  			return -EINVAL;  		} diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index 270cfa81830e..bbf32524ab27 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VIRTIO_RING_H  #define _LINUX_VIRTIO_RING_H diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h index ab13f0743da8..e223e2632edd 100644 --- a/include/linux/virtio_vsock.h +++ b/include/linux/virtio_vsock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VIRTIO_VSOCK_H  #define _LINUX_VIRTIO_VSOCK_H diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index d77bc35278b0..5c7f010676a7 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef VM_EVENT_ITEM_H_INCLUDED  #define VM_EVENT_ITEM_H_INCLUDED diff --git a/include/linux/vmacache.h b/include/linux/vmacache.h index 1081db987391..a5b3aa8d281f 100644 --- a/include/linux/vmacache.h +++ b/include/linux/vmacache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_VMACACHE_H  #define __LINUX_VMACACHE_H diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 2d92dd002abd..1e5d8c392f15 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VMALLOC_H  #define _LINUX_VMALLOC_H diff --git a/include/linux/vme.h b/include/linux/vme.h index 25874da3f2e1..7e82bf500f01 100644 --- a/include/linux/vme.h +++ b/include/linux/vme.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _VME_H_  #define _VME_H_ diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h index 3347cc3ec0ab..61e6fddfb26f 100644 --- a/include/linux/vmpressure.h +++ b/include/linux/vmpressure.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_VMPRESSURE_H  #define __LINUX_VMPRESSURE_H diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index ade7cb5f1359..1779c9817b39 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VMSTAT_H  #define _LINUX_VMSTAT_H @@ -6,9 +7,19 @@  #include <linux/mmzone.h>  #include <linux/vm_event_item.h>  #include <linux/atomic.h> +#include <linux/static_key.h>  extern int sysctl_stat_interval; +#ifdef CONFIG_NUMA +#define ENABLE_NUMA_STAT   1 +#define DISABLE_NUMA_STAT   0 +extern int sysctl_vm_numa_stat; +DECLARE_STATIC_KEY_TRUE(vm_numa_stat_key); +extern int sysctl_vm_numa_stat_handler(struct ctl_table *table, +		int write, void __user *buffer, size_t *length, loff_t *ppos); +#endif +  #ifdef CONFIG_VM_EVENT_COUNTERS  /*   * Light weight per cpu counter implementation. diff --git a/include/linux/vt.h b/include/linux/vt.h index b186e0435239..9820ae4f99ab 100644 --- a/include/linux/vt.h +++ b/include/linux/vt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_VT_H  #define _LINUX_VT_H diff --git a/include/linux/vt_buffer.h b/include/linux/vt_buffer.h index 30b6e0d2a942..848db1b1569f 100644 --- a/include/linux/vt_buffer.h +++ b/include/linux/vt_buffer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	include/linux/vt_buffer.h -- Access to VT screen buffer   * diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 833fdd4794a0..3fd07912909c 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _VT_KERN_H  #define _VT_KERN_H diff --git a/include/linux/vtime.h b/include/linux/vtime.h index 18b405e3cd93..a26ed10a4eac 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_KERNEL_VTIME_H  #define _LINUX_KERNEL_VTIME_H diff --git a/include/linux/w1.h b/include/linux/w1.h index 5b2972946dda..694101f744c7 100644 --- a/include/linux/w1.h +++ b/include/linux/w1.h @@ -293,6 +293,7 @@ void w1_unregister_family(struct w1_family *family);  			w1_unregister_family)  u8 w1_triplet(struct w1_master *dev, int bdir); +u8 w1_touch_bit(struct w1_master *dev, int bit);  void w1_write_8(struct w1_master *, u8);  u8 w1_read_8(struct w1_master *);  int w1_reset_bus(struct w1_master *); diff --git a/include/linux/wait.h b/include/linux/wait.h index 87c4641023fb..158715445ffb 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_WAIT_H  #define _LINUX_WAIT_H  /* diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h index 12b26660d7e9..61b39eaf7cad 100644 --- a/include/linux/wait_bit.h +++ b/include/linux/wait_bit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_WAIT_BIT_H  #define _LINUX_WAIT_BIT_H @@ -25,6 +26,8 @@ struct wait_bit_queue_entry {  	{ .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, }  typedef int wait_bit_action_f(struct wait_bit_key *key, int mode); +typedef int wait_atomic_t_action_f(atomic_t *counter, unsigned int mode); +  void __wake_up_bit(struct wait_queue_head *wq_head, void *word, int bit);  int __wait_on_bit(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_entry, wait_bit_action_f *action, unsigned int mode);  int __wait_on_bit_lock(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_entry, wait_bit_action_f *action, unsigned int mode); @@ -33,7 +36,7 @@ void wake_up_atomic_t(atomic_t *p);  int out_of_line_wait_on_bit(void *word, int, wait_bit_action_f *action, unsigned int mode);  int out_of_line_wait_on_bit_timeout(void *word, int, wait_bit_action_f *action, unsigned int mode, unsigned long timeout);  int out_of_line_wait_on_bit_lock(void *word, int, wait_bit_action_f *action, unsigned int mode); -int out_of_line_wait_on_atomic_t(atomic_t *p, int (*)(atomic_t *), unsigned int mode); +int out_of_line_wait_on_atomic_t(atomic_t *p, wait_atomic_t_action_f action, unsigned int mode);  struct wait_queue_head *bit_waitqueue(void *word, int bit);  extern void __init wait_bit_init(void); @@ -50,10 +53,11 @@ int wake_bit_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync  		},								\  	} -extern int bit_wait(struct wait_bit_key *key, int bit); -extern int bit_wait_io(struct wait_bit_key *key, int bit); -extern int bit_wait_timeout(struct wait_bit_key *key, int bit); -extern int bit_wait_io_timeout(struct wait_bit_key *key, int bit); +extern int bit_wait(struct wait_bit_key *key, int mode); +extern int bit_wait_io(struct wait_bit_key *key, int mode); +extern int bit_wait_timeout(struct wait_bit_key *key, int mode); +extern int bit_wait_io_timeout(struct wait_bit_key *key, int mode); +extern int atomic_t_wait(atomic_t *counter, unsigned int mode);  /**   * wait_on_bit - wait for a bit to be cleared @@ -250,7 +254,7 @@ wait_on_bit_lock_action(unsigned long *word, int bit, wait_bit_action_f *action,   * outside of the target 'word'.   */  static inline -int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode) +int wait_on_atomic_t(atomic_t *val, wait_atomic_t_action_f action, unsigned mode)  {  	might_sleep();  	if (atomic_read(val) == 0) diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h index 8198a63cf459..f6358558f9f5 100644 --- a/include/linux/wanrouter.h +++ b/include/linux/wanrouter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * wanrouter.h	Legacy declarations kept around until X25 is removed   */ diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index a786e5e8973b..44985c4a1e86 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Generic watchdog defines. Derived from..   * diff --git a/include/linux/win_minmax.h b/include/linux/win_minmax.h index 56569604278f..4ca2842d2842 100644 --- a/include/linux/win_minmax.h +++ b/include/linux/win_minmax.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /**   * lib/minmax.c: windowed min/max tracker by Kathleen Nichols.   * diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 4ea4c6e2383d..2d1b54556eff 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This file define a set of standard wireless extensions   * diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h index fd98bb968219..58e082dadc68 100644 --- a/include/linux/wm97xx.h +++ b/include/linux/wm97xx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Register bits and API for Wolfson WM97xx series of codecs diff --git a/include/linux/wmi.h b/include/linux/wmi.h index cd0d7734dc49..4757cb5077e5 100644 --- a/include/linux/wmi.h +++ b/include/linux/wmi.h @@ -18,6 +18,7 @@  #include <linux/device.h>  #include <linux/acpi.h> +#include <uapi/linux/wmi.h>  struct wmi_device {  	struct device dev; @@ -26,13 +27,17 @@ struct wmi_device {  	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); -/* Gets another device on the same bus.  Caller must put_device the result. */ -extern struct wmi_device *wmidev_get_other_guid(struct wmi_device *wdev, -						const char *guid_string); +extern int set_required_buffer_size(struct wmi_device *wdev, u64 length);  struct wmi_device_id {  	const char *guid_string; @@ -45,6 +50,8 @@ struct wmi_driver {  	int (*probe)(struct wmi_device *wdev);  	int (*remove)(struct wmi_device *wdev);  	void (*notify)(struct wmi_device *device, union acpi_object *data); +	long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd, +				struct wmi_ioctl_buffer *arg);  };  extern int __must_check __wmi_driver_register(struct wmi_driver *driver, diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 1c49431f3121..4a54ef96aff5 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * workqueue.h --- work queue handling for Linux.   */ @@ -17,7 +18,7 @@ struct workqueue_struct;  struct work_struct;  typedef void (*work_func_t)(struct work_struct *work); -void delayed_work_timer_fn(unsigned long __data); +void delayed_work_timer_fn(struct timer_list *t);  /*   * The first word is the work queue pointer and the flags rolled into @@ -175,8 +176,7 @@ struct execute_work {  #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\  	.work = __WORK_INITIALIZER((n).work, (f)),			\ -	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\ -				     0, (unsigned long)&(n),		\ +	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,\  				     (tflags) | TIMER_IRQSAFE),		\  	} @@ -218,7 +218,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }  									\  		__init_work((_work), _onstack);				\  		(_work)->data = (atomic_long_t) WORK_DATA_INIT();	\ -		lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0); \ +		lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, &__key, 0); \  		INIT_LIST_HEAD(&(_work)->entry);			\  		(_work)->func = (_func);				\  	} while (0) @@ -241,18 +241,17 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }  #define __INIT_DELAYED_WORK(_work, _func, _tflags)			\  	do {								\  		INIT_WORK(&(_work)->work, (_func));			\ -		__setup_timer(&(_work)->timer, delayed_work_timer_fn,	\ -			      (unsigned long)(_work),			\ -			      (_tflags) | TIMER_IRQSAFE);		\ +		__init_timer(&(_work)->timer,				\ +			     delayed_work_timer_fn,			\ +			     (_tflags) | TIMER_IRQSAFE);		\  	} while (0)  #define __INIT_DELAYED_WORK_ONSTACK(_work, _func, _tflags)		\  	do {								\  		INIT_WORK_ONSTACK(&(_work)->work, (_func));		\ -		__setup_timer_on_stack(&(_work)->timer,			\ -				       delayed_work_timer_fn,		\ -				       (unsigned long)(_work),		\ -				       (_tflags) | TIMER_IRQSAFE);	\ +		__init_timer_on_stack(&(_work)->timer,			\ +				      delayed_work_timer_fn,		\ +				      (_tflags) | TIMER_IRQSAFE);	\  	} while (0)  #define INIT_DELAYED_WORK(_work, _func)					\ @@ -398,7 +397,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,  	static struct lock_class_key __key;				\  	const char *__lock_name;					\  									\ -	__lock_name = #fmt#args;					\ +	__lock_name = "(wq_completion)"#fmt#args;			\  									\  	__alloc_workqueue_key((fmt), (flags), (max_active),		\  			      &__key, __lock_name, ##args);		\ diff --git a/include/linux/writeback.h b/include/linux/writeback.h index d5815794416c..fdfd04e348f6 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * include/linux/writeback.h   */ @@ -42,28 +43,6 @@ enum writeback_sync_modes {  };  /* - * why some writeback work was initiated - */ -enum wb_reason { -	WB_REASON_BACKGROUND, -	WB_REASON_VMSCAN, -	WB_REASON_SYNC, -	WB_REASON_PERIODIC, -	WB_REASON_LAPTOP_TIMER, -	WB_REASON_FREE_MORE_MEM, -	WB_REASON_FS_FREE_SPACE, -	/* -	 * There is no bdi forker thread any more and works are done -	 * by emergency worker, however, this is TPs userland visible -	 * and we'll be exposing exactly the same information, -	 * so it has a mismatch name. -	 */ -	WB_REASON_FORKER_THREAD, - -	WB_REASON_MAX, -}; - -/*   * A control structure which tells the writeback code what to do.  These are   * always on the stack, and hence need no locking.  They are always initialised   * in a manner such that unspecified fields are set to zero. @@ -185,11 +164,11 @@ struct bdi_writeback;  void writeback_inodes_sb(struct super_block *, enum wb_reason reason);  void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,  							enum wb_reason reason); -bool try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason); -bool try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, -				   enum wb_reason reason); +void try_to_writeback_inodes_sb(struct super_block *sb, enum wb_reason reason);  void sync_inodes_sb(struct super_block *); -void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); +void wakeup_flusher_threads(enum wb_reason reason); +void wakeup_flusher_threads_bdi(struct backing_dev_info *bdi, +				enum wb_reason reason);  void inode_wait_for_writeback(struct inode *inode);  /* writeback.h requires fs.h; it, too, is not included from here. */ @@ -329,7 +308,7 @@ static inline void cgroup_writeback_umount(void)  void laptop_io_completion(struct backing_dev_info *info);  void laptop_sync_completion(void);  void laptop_mode_sync(struct work_struct *work); -void laptop_mode_timer_fn(unsigned long data); +void laptop_mode_timer_fn(struct timer_list *t);  #else  static inline void laptop_sync_completion(void) { }  #endif diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h index 5dd9a7682227..39fda195bf78 100644 --- a/include/linux/ww_mutex.h +++ b/include/linux/ww_mutex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Wound/Wait Mutexes: blocking mutual exclusion locks with deadlock avoidance   * diff --git a/include/linux/xattr.h b/include/linux/xattr.h index e77605a0c8da..d70f77a4b62a 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*    File: linux/xattr.h diff --git a/include/linux/z2_battery.h b/include/linux/z2_battery.h index 7b9750404d22..eaba53ff387c 100644 --- a/include/linux/z2_battery.h +++ b/include/linux/z2_battery.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_Z2_BATTERY_H  #define _LINUX_Z2_BATTERY_H diff --git a/include/linux/zbud.h b/include/linux/zbud.h index e183a0a65ac1..b1eaf6e31735 100644 --- a/include/linux/zbud.h +++ b/include/linux/zbud.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ZBUD_H_  #define _ZBUD_H_ diff --git a/include/linux/zpool.h b/include/linux/zpool.h index 2e97b7707dff..004ba807df96 100644 --- a/include/linux/zpool.h +++ b/include/linux/zpool.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * zpool memory storage api   * diff --git a/include/media/blackfin/bfin_capture.h b/include/media/blackfin/bfin_capture.h index 56b9ce4472fc..a999a3970c69 100644 --- a/include/media/blackfin/bfin_capture.h +++ b/include/media/blackfin/bfin_capture.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _BFIN_CAPTURE_H_  #define _BFIN_CAPTURE_H_ diff --git a/include/media/cec-pin.h b/include/media/cec-pin.h index f09cc9579d53..83b3e17e0a07 100644 --- a/include/media/cec-pin.h +++ b/include/media/cec-pin.h @@ -21,71 +21,8 @@  #define LINUX_CEC_PIN_H  #include <linux/types.h> -#include <linux/atomic.h>  #include <media/cec.h> -enum cec_pin_state { -	/* CEC is off */ -	CEC_ST_OFF, -	/* CEC is idle, waiting for Rx or Tx */ -	CEC_ST_IDLE, - -	/* Tx states */ - -	/* Pending Tx, waiting for Signal Free Time to expire */ -	CEC_ST_TX_WAIT, -	/* Low-drive was detected, wait for bus to go high */ -	CEC_ST_TX_WAIT_FOR_HIGH, -	/* Drive CEC low for the start bit */ -	CEC_ST_TX_START_BIT_LOW, -	/* Drive CEC high for the start bit */ -	CEC_ST_TX_START_BIT_HIGH, -	/* Drive CEC low for the 0 bit */ -	CEC_ST_TX_DATA_BIT_0_LOW, -	/* Drive CEC high for the 0 bit */ -	CEC_ST_TX_DATA_BIT_0_HIGH, -	/* Drive CEC low for the 1 bit */ -	CEC_ST_TX_DATA_BIT_1_LOW, -	/* Drive CEC high for the 1 bit */ -	CEC_ST_TX_DATA_BIT_1_HIGH, -	/* -	 * Wait for start of sample time to check for Ack bit or first -	 * four initiator bits to check for Arbitration Lost. -	 */ -	CEC_ST_TX_DATA_BIT_1_HIGH_PRE_SAMPLE, -	/* Wait for end of bit period after sampling */ -	CEC_ST_TX_DATA_BIT_1_HIGH_POST_SAMPLE, - -	/* Rx states */ - -	/* Start bit low detected */ -	CEC_ST_RX_START_BIT_LOW, -	/* Start bit high detected */ -	CEC_ST_RX_START_BIT_HIGH, -	/* Wait for bit sample time */ -	CEC_ST_RX_DATA_SAMPLE, -	/* Wait for earliest end of bit period after sampling */ -	CEC_ST_RX_DATA_POST_SAMPLE, -	/* Wait for CEC to go high (i.e. end of bit period */ -	CEC_ST_RX_DATA_HIGH, -	/* Drive CEC low to send 0 Ack bit */ -	CEC_ST_RX_ACK_LOW, -	/* End of 0 Ack time, wait for earliest end of bit period */ -	CEC_ST_RX_ACK_LOW_POST, -	/* Wait for CEC to go high (i.e. end of bit period */ -	CEC_ST_RX_ACK_HIGH_POST, -	/* Wait for earliest end of bit period and end of message */ -	CEC_ST_RX_ACK_FINISH, - -	/* Start low drive */ -	CEC_ST_LOW_DRIVE, -	/* Monitor pin using interrupts */ -	CEC_ST_RX_IRQ, - -	/* Total number of pin states */ -	CEC_PIN_STATES -}; -  /**   * struct cec_pin_ops - low-level CEC pin operations   * @read:	read the CEC pin. Return true if high, false if low. @@ -97,6 +34,9 @@ enum cec_pin_state {   * @free:	optional. Free any allocated resources. Called when the   *		adapter is deleted.   * @status:	optional, log status information. + * @read_hpd:	read the HPD pin. Return true if high, false if low or + *		an error if negative. If NULL or -ENOTTY is returned, + *		then this is not supported.   *   * These operations are used by the cec pin framework to manipulate   * the CEC pin. @@ -109,50 +49,7 @@ struct cec_pin_ops {  	void (*disable_irq)(struct cec_adapter *adap);  	void (*free)(struct cec_adapter *adap);  	void (*status)(struct cec_adapter *adap, struct seq_file *file); -}; - -#define CEC_NUM_PIN_EVENTS 128 - -#define CEC_PIN_IRQ_UNCHANGED	0 -#define CEC_PIN_IRQ_DISABLE	1 -#define CEC_PIN_IRQ_ENABLE	2 - -struct cec_pin { -	struct cec_adapter		*adap; -	const struct cec_pin_ops	*ops; -	struct task_struct		*kthread; -	wait_queue_head_t		kthread_waitq; -	struct hrtimer			timer; -	ktime_t				ts; -	unsigned int			wait_usecs; -	u16				la_mask; -	bool				enabled; -	bool				monitor_all; -	bool				rx_eom; -	bool				enable_irq_failed; -	enum cec_pin_state		state; -	struct cec_msg			tx_msg; -	u32				tx_bit; -	bool				tx_nacked; -	u32				tx_signal_free_time; -	struct cec_msg			rx_msg; -	u32				rx_bit; - -	struct cec_msg			work_rx_msg; -	u8				work_tx_status; -	ktime_t				work_tx_ts; -	atomic_t			work_irq_change; -	atomic_t			work_pin_events; -	unsigned int			work_pin_events_wr; -	unsigned int			work_pin_events_rd; -	ktime_t				work_pin_ts[CEC_NUM_PIN_EVENTS]; -	bool				work_pin_is_high[CEC_NUM_PIN_EVENTS]; -	ktime_t				timer_ts; -	u32				timer_cnt; -	u32				timer_100ms_overruns; -	u32				timer_300ms_overruns; -	u32				timer_max_overrun; -	u32				timer_sum_overrun; +	int  (*read_hpd)(struct cec_adapter *adap);  };  /** diff --git a/include/media/cec.h b/include/media/cec.h index df6b3bd31284..16341210d3ba 100644 --- a/include/media/cec.h +++ b/include/media/cec.h @@ -91,7 +91,7 @@ struct cec_event_entry {  };  #define CEC_NUM_CORE_EVENTS 2 -#define CEC_NUM_EVENTS CEC_EVENT_PIN_CEC_HIGH +#define CEC_NUM_EVENTS CEC_EVENT_PIN_HPD_HIGH  struct cec_fh {  	struct list_head	list; @@ -297,6 +297,16 @@ void cec_queue_pin_cec_event(struct cec_adapter *adap,  			     bool is_high, ktime_t ts);  /** + * cec_queue_pin_hpd_event() - queue a pin event with a given timestamp. + * + * @adap:	pointer to the cec adapter + * @is_high:	when true the HPD pin is high, otherwise it is low + * @ts:		the timestamp for this event + * + */ +void cec_queue_pin_hpd_event(struct cec_adapter *adap, bool is_high, ktime_t ts); + +/**   * cec_get_edid_phys_addr() - find and return the physical address   *   * @edid:	pointer to the EDID data @@ -417,6 +427,10 @@ static inline u16 cec_phys_addr_for_input(u16 phys_addr, u8 input)  static inline int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port)  { +	if (parent) +		*parent = phys_addr; +	if (port) +		*port = 0;  	return 0;  } diff --git a/include/media/drv-intf/saa7146.h b/include/media/drv-intf/saa7146.h index 45294328614d..769c6cf7eb4c 100644 --- a/include/media/drv-intf/saa7146.h +++ b/include/media/drv-intf/saa7146.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SAA7146__  #define __SAA7146__ diff --git a/include/media/drv-intf/saa7146_vv.h b/include/media/drv-intf/saa7146_vv.h index 0da6ccc0615b..6f80fb7f31a5 100644 --- a/include/media/drv-intf/saa7146_vv.h +++ b/include/media/drv-intf/saa7146_vv.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SAA7146_VV__  #define __SAA7146_VV__ @@ -107,6 +108,7 @@ struct saa7146_vv  	struct saa7146_dmaqueue		vbi_dmaq;  	struct v4l2_vbi_format		vbi_fmt;  	struct timer_list		vbi_read_timeout; +	struct file			*vbi_read_timeout_file;  	/* vbi workaround interrupt queue */  	wait_queue_head_t		vbi_wq;  	int				vbi_fieldcount; @@ -183,7 +185,7 @@ int saa7146_unregister_device(struct video_device *vid, struct saa7146_dev *dev)  void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state);  void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi);  int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); -void saa7146_buffer_timeout(unsigned long data); +void saa7146_buffer_timeout(struct timer_list *t);  void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q,  						struct saa7146_buf *buf); @@ -202,14 +204,14 @@ void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);  /* from saa7146_video.c */  extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops;  extern const struct v4l2_ioctl_ops saa7146_vbi_ioctl_ops; -extern struct saa7146_use_ops saa7146_video_uops; +extern const struct saa7146_use_ops saa7146_video_uops;  int saa7146_start_preview(struct saa7146_fh *fh);  int saa7146_stop_preview(struct saa7146_fh *fh);  long saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg);  int saa7146_s_ctrl(struct v4l2_ctrl *ctrl);  /* from saa7146_vbi.c */ -extern struct saa7146_use_ops saa7146_vbi_uops; +extern const struct saa7146_use_ops saa7146_vbi_uops;  /* resource management functions */  int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit); diff --git a/include/media/drv-intf/sh_mobile_ceu.h b/include/media/drv-intf/sh_mobile_ceu.h index 2f43f7d9e28d..555f0ecc0fde 100644 --- a/include/media/drv-intf/sh_mobile_ceu.h +++ b/include/media/drv-intf/sh_mobile_ceu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_SH_MOBILE_CEU_H__  #define __ASM_SH_MOBILE_CEU_H__ diff --git a/include/media/i2c-addr.h b/include/media/i2c-addr.h index 5d0f56054d26..1b6872f5e970 100644 --- a/include/media/i2c-addr.h +++ b/include/media/i2c-addr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	V4L I2C address list   * diff --git a/include/media/i2c/ir-kbd-i2c.h b/include/media/i2c/ir-kbd-i2c.h index ac8c55617a79..76491c62c254 100644 --- a/include/media/i2c/ir-kbd-i2c.h +++ b/include/media/i2c/ir-kbd-i2c.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IR_I2C  #define _IR_I2C diff --git a/include/media/i2c/mt9p031.h b/include/media/i2c/mt9p031.h index 1ba361205af1..7c29c53aa988 100644 --- a/include/media/i2c/mt9p031.h +++ b/include/media/i2c/mt9p031.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef MT9P031_H  #define MT9P031_H diff --git a/include/media/i2c/mt9t001.h b/include/media/i2c/mt9t001.h index 03fd63edd133..4b1090554270 100644 --- a/include/media/i2c/mt9t001.h +++ b/include/media/i2c/mt9t001.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _MEDIA_MT9T001_H  #define _MEDIA_MT9T001_H diff --git a/include/media/i2c/mt9v032.h b/include/media/i2c/mt9v032.h index 12175a63c5b2..83a37ccfb649 100644 --- a/include/media/i2c/mt9v032.h +++ b/include/media/i2c/mt9v032.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _MEDIA_MT9V032_H  #define _MEDIA_MT9V032_H diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h index 86d15a9b6c01..857da67bd931 100644 --- a/include/media/lirc_dev.h +++ b/include/media/lirc_dev.h @@ -9,7 +9,6 @@  #ifndef _LINUX_LIRC_DEV_H  #define _LINUX_LIRC_DEV_H -#define MAX_IRCTL_DEVICES 8  #define BUFLEN            16  #include <linux/slab.h> @@ -18,6 +17,8 @@  #include <linux/poll.h>  #include <linux/kfifo.h>  #include <media/lirc.h> +#include <linux/device.h> +#include <linux/cdev.h>  struct lirc_buffer {  	wait_queue_head_t wait_poll; @@ -112,84 +113,69 @@ static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf,  }  /** - * struct lirc_driver - Defines the parameters on a LIRC driver - * - * @name:		this string will be used for logs - * - * @minor:		indicates minor device (/dev/lirc) number for - *			registered driver if caller fills it with negative - *			value, then the first free minor number will be used - *			(if available). - * - * @code_length:	length of the remote control key code expressed in bits. - * - * @buffer_size:	Number of FIFO buffers with @chunk_size size. If zero, - *			creates a buffer with BUFLEN size (16 bytes). + * struct lirc_dev - represents a LIRC device   * + * @name:		used for logging + * @minor:		the minor device (/dev/lircX) number for the device + * @code_length:	length of a remote control key code expressed in bits   * @features:		lirc compatible hardware features, like LIRC_MODE_RAW,   *			LIRC_CAN\_\*, as defined at include/media/lirc.h. - * + * @buffer_size:	Number of FIFO buffers with @chunk_size size. + *			Only used if @rbuf is NULL.   * @chunk_size:		Size of each FIFO buffer. - * - * @data:		it may point to any driver data and this pointer will - *			be passed to all callback functions. - * - * @min_timeout:	Minimum timeout for record. Valid only if - *			LIRC_CAN_SET_REC_TIMEOUT is defined. - * - * @max_timeout:	Maximum timeout for record. Valid only if - *			LIRC_CAN_SET_REC_TIMEOUT is defined. - * - * @rbuf:		if not NULL, it will be used as a read buffer, you will + *			Only used if @rbuf is NULL. + * @data:		private per-driver data + * @buf:		if %NULL, lirc_dev will allocate and manage the buffer, + *			otherwise allocated by the caller which will   *			have to write to the buffer by other means, like irq's   *			(see also lirc_serial.c). - * - * @rdev:		Pointed to struct rc_dev associated with the LIRC - *			device. - * - * @fops:		file_operations for drivers which don't fit the current - *			driver model. - *			Some ioctl's can be directly handled by lirc_dev if the - *			driver's ioctl function is NULL or if it returns - *			-ENOIOCTLCMD (see also lirc_serial.c). - * - * @dev:		pointer to the struct device associated with the LIRC - *			device. - * + * @buf_internal:	whether lirc_dev has allocated the read buffer or not + * @rdev:		&struct rc_dev associated with the device + * @fops:		&struct file_operations for the device   * @owner:		the module owning this struct + * @attached:		if the device is still live + * @open:		open count for the device's chardev + * @mutex:		serialises file_operations calls + * @dev:		&struct device assigned to the device + * @cdev:		&struct cdev assigned to the device   */ -struct lirc_driver { +struct lirc_dev {  	char name[40]; -	int minor; +	unsigned int minor;  	__u32 code_length; -	unsigned int buffer_size; /* in chunks holding one code each */  	__u32 features; +	unsigned int buffer_size; /* in chunks holding one code each */  	unsigned int chunk_size; +	struct lirc_buffer *buf; +	bool buf_internal;  	void *data; -	int min_timeout; -	int max_timeout; -	struct lirc_buffer *rbuf;  	struct rc_dev *rdev;  	const struct file_operations *fops; -	struct device *dev;  	struct module *owner; + +	bool attached; +	int open; + +	struct mutex mutex; /* protect from simultaneous accesses */ + +	struct device dev; +	struct cdev cdev;  }; -/* following functions can be called ONLY from user context - * - * returns negative value on error or minor number - * of the registered device if success - * contents of the structure pointed by p is copied - */ -extern int lirc_register_driver(struct lirc_driver *d); +struct lirc_dev *lirc_allocate_device(void); + +void lirc_free_device(struct lirc_dev *d); + +int lirc_register_device(struct lirc_dev *d); + +void lirc_unregister_device(struct lirc_dev *d); -/* returns negative value on error or 0 if success -*/ -extern int lirc_unregister_driver(int minor); +/* Must be called in the open fop before lirc_get_pdata() can be used */ +void lirc_init_pdata(struct inode *inode, struct file *file); -/* Returns the private data stored in the lirc_driver +/* Returns the private data stored in the lirc_dev   * associated with the given device file pointer.   */  void *lirc_get_pdata(struct file *file); diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 2a160e6e823c..72197cb43781 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -211,6 +211,7 @@ struct rc_map *rc_map_get(const char *name);  #define RC_MAP_ALINK_DTU_M               "rc-alink-dtu-m"  #define RC_MAP_ANYSEE                    "rc-anysee"  #define RC_MAP_APAC_VIEWCOMP             "rc-apac-viewcomp" +#define RC_MAP_ASTROMETA_T2HYBRID        "rc-astrometa-t2hybrid"  #define RC_MAP_ASUS_PC39                 "rc-asus-pc39"  #define RC_MAP_ASUS_PS3_100              "rc-asus-ps3-100"  #define RC_MAP_ATI_TV_WONDER_HD_600      "rc-ati-tv-wonder-hd-600" @@ -258,6 +259,8 @@ struct rc_map *rc_map_get(const char *name);  #define RC_MAP_GENIUS_TVGO_A11MCE        "rc-genius-tvgo-a11mce"  #define RC_MAP_GOTVIEW7135               "rc-gotview7135"  #define RC_MAP_HAUPPAUGE_NEW             "rc-hauppauge" +#define RC_MAP_HISI_POPLAR               "rc-hisi-poplar" +#define RC_MAP_HISI_TV_DEMO              "rc-hisi-tv-demo"  #define RC_MAP_IMON_MCE                  "rc-imon-mce"  #define RC_MAP_IMON_PAD                  "rc-imon-pad"  #define RC_MAP_IODATA_BCTV7E             "rc-iodata-bctv7e" @@ -300,6 +303,7 @@ struct rc_map *rc_map_get(const char *name);  #define RC_MAP_REDDO                     "rc-reddo"  #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"  #define RC_MAP_STREAMZAP                 "rc-streamzap" +#define RC_MAP_TANGO                     "rc-tango"  #define RC_MAP_TBS_NEC                   "rc-tbs-nec"  #define RC_MAP_TECHNISAT_TS35            "rc-technisat-ts35"  #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2" diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h index aed539068d2d..78f0654d9c3d 100644 --- a/include/media/tuner-types.h +++ b/include/media/tuner-types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * descriptions for simple tuners.   */ diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h index 630bcf3d8885..b56eaee82aa5 100644 --- a/include/media/tveeprom.h +++ b/include/media/tveeprom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * tveeprom - Contains structures and functions to work with Hauppauge diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h index c69d8c8a66d0..6152434cbe82 100644 --- a/include/media/v4l2-async.h +++ b/include/media/v4l2-async.h @@ -50,6 +50,10 @@ enum v4l2_async_match_type {   * @match:	union of per-bus type matching data sets   * @list:	used to link struct v4l2_async_subdev objects, waiting to be   *		probed, to a notifier->waiting list + * + * When this struct is used as a member in a driver specific struct, + * the driver specific struct shall contain the &struct + * v4l2_async_subdev as its first member.   */  struct v4l2_async_subdev {  	enum v4l2_async_match_type match_type; @@ -76,32 +80,47 @@ struct v4l2_async_subdev {  };  /** + * struct v4l2_async_notifier_operations - Asynchronous V4L2 notifier operations + * @bound:	a subdevice driver has successfully probed one of the subdevices + * @complete:	All subdevices have been probed successfully. The complete + *		callback is only executed for the root notifier. + * @unbind:	a subdevice is leaving + */ +struct v4l2_async_notifier_operations { +	int (*bound)(struct v4l2_async_notifier *notifier, +		     struct v4l2_subdev *subdev, +		     struct v4l2_async_subdev *asd); +	int (*complete)(struct v4l2_async_notifier *notifier); +	void (*unbind)(struct v4l2_async_notifier *notifier, +		       struct v4l2_subdev *subdev, +		       struct v4l2_async_subdev *asd); +}; + +/**   * struct v4l2_async_notifier - v4l2_device notifier data   * - * @num_subdevs: number of subdevices + * @ops:	notifier operations + * @num_subdevs: number of subdevices used in the subdevs array + * @max_subdevs: number of subdevices allocated in the subdevs array   * @subdevs:	array of pointers to subdevice descriptors - * @v4l2_dev:	pointer to struct v4l2_device + * @v4l2_dev:	v4l2_device of the root notifier, NULL otherwise + * @sd:		sub-device that registered the notifier, NULL otherwise + * @parent:	parent notifier   * @waiting:	list of struct v4l2_async_subdev, waiting for their drivers   * @done:	list of struct v4l2_subdev, already probed   * @list:	member in a global list of notifiers - * @bound:	a subdevice driver has successfully probed one of subdevices - * @complete:	all subdevices have been probed successfully - * @unbind:	a subdevice is leaving   */  struct v4l2_async_notifier { +	const struct v4l2_async_notifier_operations *ops;  	unsigned int num_subdevs; +	unsigned int max_subdevs;  	struct v4l2_async_subdev **subdevs;  	struct v4l2_device *v4l2_dev; +	struct v4l2_subdev *sd; +	struct v4l2_async_notifier *parent;  	struct list_head waiting;  	struct list_head done;  	struct list_head list; -	int (*bound)(struct v4l2_async_notifier *notifier, -		     struct v4l2_subdev *subdev, -		     struct v4l2_async_subdev *asd); -	int (*complete)(struct v4l2_async_notifier *notifier); -	void (*unbind)(struct v4l2_async_notifier *notifier, -		       struct v4l2_subdev *subdev, -		       struct v4l2_async_subdev *asd);  };  /** @@ -114,6 +133,16 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,  				 struct v4l2_async_notifier *notifier);  /** + * v4l2_async_subdev_notifier_register - registers a subdevice asynchronous + *					 notifier for a sub-device + * + * @sd: pointer to &struct v4l2_subdev + * @notifier: pointer to &struct v4l2_async_notifier + */ +int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd, +					struct v4l2_async_notifier *notifier); + +/**   * v4l2_async_notifier_unregister - unregisters a subdevice asynchronous notifier   *   * @notifier: pointer to &struct v4l2_async_notifier @@ -121,6 +150,22 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,  void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier);  /** + * v4l2_async_notifier_cleanup - clean up notifier resources + * @notifier: the notifier the resources of which are to be cleaned up + * + * Release memory resources related to a notifier, including the async + * sub-devices allocated for the purposes of the notifier but not the notifier + * itself. The user is responsible for calling this function to clean up the + * notifier after calling @v4l2_async_notifier_parse_fwnode_endpoints or + * @v4l2_fwnode_reference_parse_sensor_common. + * + * There is no harm from calling v4l2_async_notifier_cleanup in other + * cases as long as its memory has been zeroed after it has been + * allocated. + */ +void v4l2_async_notifier_cleanup(struct v4l2_async_notifier *notifier); + +/**   * v4l2_async_register_subdev - registers a sub-device to the asynchronous   * 	subdevice framework   * @@ -129,6 +174,28 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier);  int v4l2_async_register_subdev(struct v4l2_subdev *sd);  /** + * v4l2_async_register_subdev_sensor_common - registers a sensor sub-device to + *					      the asynchronous sub-device + *					      framework and parse set up common + *					      sensor related devices + * + * @sd: pointer to struct &v4l2_subdev + * + * This function is just like v4l2_async_register_subdev() with the exception + * that calling it will also parse firmware interfaces for remote references + * using v4l2_async_notifier_parse_fwnode_sensor_common() and registers the + * async sub-devices. The sub-device is similarly unregistered by calling + * v4l2_async_unregister_subdev(). + * + * While registered, the subdev module is marked as in-use. + * + * An error is returned if the module is no longer loaded on any attempts + * to register it. + */ +int __must_check v4l2_async_register_subdev_sensor_common( +	struct v4l2_subdev *sd); + +/**   * v4l2_async_unregister_subdev - unregisters a sub-device to the asynchronous   * 	subdevice framework   * diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index e657614521e3..28a686eb7d09 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *   *	V 4 L 2   D R I V E R   H E L P E R   A P I diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index 7adec9851d9e..b5b465677d28 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -25,6 +25,8 @@  #include <media/v4l2-mediabus.h>  struct fwnode_handle; +struct v4l2_async_notifier; +struct v4l2_async_subdev;  #define V4L2_FWNODE_CSI2_MAX_DATA_LANES	4 @@ -113,13 +115,237 @@ struct v4l2_fwnode_link {  	unsigned int remote_port;  }; +/** + * v4l2_fwnode_endpoint_parse() - parse all fwnode node properties + * @fwnode: pointer to the endpoint's fwnode handle + * @vep: pointer to the V4L2 fwnode data structure + * + * All properties are optional. If none are found, we don't set any flags. This + * means the port has a static configuration and no properties have to be + * specified explicitly. If any properties that identify the bus as parallel + * are found and slave-mode isn't set, we set V4L2_MBUS_MASTER. Similarly, if + * we recognise the bus as serial CSI-2 and clock-noncontinuous isn't set, we + * set the V4L2_MBUS_CSI2_CONTINUOUS_CLOCK flag. The caller should hold a + * reference to @fwnode. + * + * NOTE: This function does not parse properties the size of which is variable + * without a low fixed limit. Please use v4l2_fwnode_endpoint_alloc_parse() in + * new drivers instead. + * + * Return: 0 on success or a negative error code on failure. + */  int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,  			       struct v4l2_fwnode_endpoint *vep); + +/** + * v4l2_fwnode_endpoint_free() - free the V4L2 fwnode acquired by + * v4l2_fwnode_endpoint_alloc_parse() + * @vep: the V4L2 fwnode the resources of which are to be released + * + * It is safe to call this function with NULL argument or on a V4L2 fwnode the + * parsing of which failed. + */ +void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep); + +/** + * v4l2_fwnode_endpoint_alloc_parse() - parse all fwnode node properties + * @fwnode: pointer to the endpoint's fwnode handle + * + * All properties are optional. If none are found, we don't set any flags. This + * means the port has a static configuration and no properties have to be + * specified explicitly. If any properties that identify the bus as parallel + * are found and slave-mode isn't set, we set V4L2_MBUS_MASTER. Similarly, if + * we recognise the bus as serial CSI-2 and clock-noncontinuous isn't set, we + * set the V4L2_MBUS_CSI2_CONTINUOUS_CLOCK flag. The caller should hold a + * reference to @fwnode. + * + * v4l2_fwnode_endpoint_alloc_parse() has two important differences to + * v4l2_fwnode_endpoint_parse(): + * + * 1. It also parses variable size data. + * + * 2. The memory it has allocated to store the variable size data must be freed + *    using v4l2_fwnode_endpoint_free() when no longer needed. + * + * Return: Pointer to v4l2_fwnode_endpoint if successful, on an error pointer + * on error. + */  struct v4l2_fwnode_endpoint *v4l2_fwnode_endpoint_alloc_parse(  	struct fwnode_handle *fwnode); -void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep); + +/** + * v4l2_fwnode_parse_link() - parse a link between two endpoints + * @fwnode: pointer to the endpoint's fwnode at the local end of the link + * @link: pointer to the V4L2 fwnode link data structure + * + * Fill the link structure with the local and remote nodes and port numbers. + * The local_node and remote_node fields are set to point to the local and + * remote port's parent nodes respectively (the port parent node being the + * parent node of the port node if that node isn't a 'ports' node, or the + * grand-parent node of the port node otherwise). + * + * A reference is taken to both the local and remote nodes, the caller must use + * v4l2_fwnode_put_link() to drop the references when done with the + * link. + * + * Return: 0 on success, or -ENOLINK if the remote endpoint fwnode can't be + * found. + */  int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,  			   struct v4l2_fwnode_link *link); + +/** + * v4l2_fwnode_put_link() - drop references to nodes in a link + * @link: pointer to the V4L2 fwnode link data structure + * + * Drop references to the local and remote nodes in the link. This function + * must be called on every link parsed with v4l2_fwnode_parse_link(). + */  void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link); + +/** + * typedef parse_endpoint_func - Driver's callback function to be called on + *	each V4L2 fwnode endpoint. + * + * @dev: pointer to &struct device + * @vep: pointer to &struct v4l2_fwnode_endpoint + * @asd: pointer to &struct v4l2_async_subdev + * + * Return: + * * %0 on success + * * %-ENOTCONN if the endpoint is to be skipped but this + *   should not be considered as an error + * * %-EINVAL if the endpoint configuration is invalid + */ +typedef int (*parse_endpoint_func)(struct device *dev, +				  struct v4l2_fwnode_endpoint *vep, +				  struct v4l2_async_subdev *asd); + + +/** + * v4l2_async_notifier_parse_fwnode_endpoints - Parse V4L2 fwnode endpoints in a + *						device node + * @dev: the device the endpoints of which are to be parsed + * @notifier: notifier for @dev + * @asd_struct_size: size of the driver's async sub-device struct, including + *		     sizeof(struct v4l2_async_subdev). The &struct + *		     v4l2_async_subdev shall be the first member of + *		     the driver's async sub-device struct, i.e. both + *		     begin at the same memory address. + * @parse_endpoint: Driver's callback function called on each V4L2 fwnode + *		    endpoint. Optional. + * + * Parse the fwnode endpoints of the @dev device and populate the async sub- + * devices array of the notifier. The @parse_endpoint callback function is + * called for each endpoint with the corresponding async sub-device pointer to + * let the caller initialize the driver-specific part of the async sub-device + * structure. + * + * The notifier memory shall be zeroed before this function is called on the + * notifier. + * + * This function may not be called on a registered notifier and may be called on + * a notifier only once. + * + * Do not change the notifier's subdevs array, take references to the subdevs + * array itself or change the notifier's num_subdevs field. This is because this + * function allocates and reallocates the subdevs array based on parsing + * endpoints. + * + * The &struct v4l2_fwnode_endpoint passed to the callback function + * @parse_endpoint is released once the function is finished. If there is a need + * to retain that configuration, the user needs to allocate memory for it. + * + * Any notifier populated using this function must be released with a call to + * v4l2_async_notifier_cleanup() after it has been unregistered and the async + * sub-devices are no longer in use, even if the function returned an error. + * + * Return: %0 on success, including when no async sub-devices are found + *	   %-ENOMEM if memory allocation failed + *	   %-EINVAL if graph or endpoint parsing failed + *	   Other error codes as returned by @parse_endpoint + */ +int v4l2_async_notifier_parse_fwnode_endpoints( +	struct device *dev, struct v4l2_async_notifier *notifier, +	size_t asd_struct_size, +	parse_endpoint_func parse_endpoint); + +/** + * v4l2_async_notifier_parse_fwnode_endpoints_by_port - Parse V4L2 fwnode + *							endpoints of a port in a + *							device node + * @dev: the device the endpoints of which are to be parsed + * @notifier: notifier for @dev + * @asd_struct_size: size of the driver's async sub-device struct, including + *		     sizeof(struct v4l2_async_subdev). The &struct + *		     v4l2_async_subdev shall be the first member of + *		     the driver's async sub-device struct, i.e. both + *		     begin at the same memory address. + * @port: port number where endpoints are to be parsed + * @parse_endpoint: Driver's callback function called on each V4L2 fwnode + *		    endpoint. Optional. + * + * This function is just like v4l2_async_notifier_parse_fwnode_endpoints() with + * the exception that it only parses endpoints in a given port. This is useful + * on devices that have both sinks and sources: the async sub-devices connected + * to sources have already been configured by another driver (on capture + * devices). In this case the driver must know which ports to parse. + * + * Parse the fwnode endpoints of the @dev device on a given @port and populate + * the async sub-devices array of the notifier. The @parse_endpoint callback + * function is called for each endpoint with the corresponding async sub-device + * pointer to let the caller initialize the driver-specific part of the async + * sub-device structure. + * + * The notifier memory shall be zeroed before this function is called on the + * notifier the first time. + * + * This function may not be called on a registered notifier and may be called on + * a notifier only once per port. + * + * Do not change the notifier's subdevs array, take references to the subdevs + * array itself or change the notifier's num_subdevs field. This is because this + * function allocates and reallocates the subdevs array based on parsing + * endpoints. + * + * The &struct v4l2_fwnode_endpoint passed to the callback function + * @parse_endpoint is released once the function is finished. If there is a need + * to retain that configuration, the user needs to allocate memory for it. + * + * Any notifier populated using this function must be released with a call to + * v4l2_async_notifier_cleanup() after it has been unregistered and the async + * sub-devices are no longer in use, even if the function returned an error. + * + * Return: %0 on success, including when no async sub-devices are found + *	   %-ENOMEM if memory allocation failed + *	   %-EINVAL if graph or endpoint parsing failed + *	   Other error codes as returned by @parse_endpoint + */ +int v4l2_async_notifier_parse_fwnode_endpoints_by_port( +	struct device *dev, struct v4l2_async_notifier *notifier, +	size_t asd_struct_size, unsigned int port, +	parse_endpoint_func parse_endpoint); + +/** + * v4l2_fwnode_reference_parse_sensor_common - parse common references on + *					       sensors for async sub-devices + * @dev: the device node the properties of which are parsed for references + * @notifier: the async notifier where the async subdevs will be added + * + * Parse common sensor properties for remote devices related to the + * sensor and set up async sub-devices for them. + * + * Any notifier populated using this function must be released with a call to + * v4l2_async_notifier_release() after it has been unregistered and the async + * sub-devices are no longer in use, even in the case the function returned an + * error. + * + * Return: 0 on success + *	   -ENOMEM if memory allocation failed + *	   -EINVAL if property parsing failed + */ +int v4l2_async_notifier_parse_fwnode_sensor_common( +	struct device *dev, struct v4l2_async_notifier *notifier); +  #endif /* _V4L2_FWNODE_H */ diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index bd5312118013..a7b3f7c75d62 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *   *	V 4 L 2   D R I V E R   H E L P E R   A P I diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index e83872078376..ec399c770301 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -793,6 +793,8 @@ struct v4l2_subdev_platform_data {   *	list.   * @asd: Pointer to respective &struct v4l2_async_subdev.   * @notifier: Pointer to the managing notifier. + * @subdev_notifier: A sub-device notifier implicitly registered for the sub- + *		     device using v4l2_device_register_sensor_subdev().   * @pdata: common part of subdevice platform data   *   * Each instance of a subdev driver should create this struct, either @@ -823,6 +825,7 @@ struct v4l2_subdev {  	struct list_head async_list;  	struct v4l2_async_subdev *asd;  	struct v4l2_async_notifier *notifier; +	struct v4l2_async_notifier *subdev_notifier;  	struct v4l2_subdev_platform_data *pdata;  }; diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h index c3bfa473c3aa..a14ac7711c92 100644 --- a/include/media/videobuf-dvb.h +++ b/include/media/videobuf-dvb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <dvbdev.h>  #include <dmxdev.h>  #include <dvb_demux.h> diff --git a/include/media/videobuf2-dvb.h b/include/media/videobuf2-dvb.h index 87b559024b4a..5a31faa24f1a 100644 --- a/include/media/videobuf2-dvb.h +++ b/include/media/videobuf2-dvb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _VIDEOBUF2_DVB_H_  #define	_VIDEOBUF2_DVB_H_ diff --git a/include/net/Space.h b/include/net/Space.h index 8a32771e4215..27fb5c937c4f 100644 --- a/include/net/Space.h +++ b/include/net/Space.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* A unified ethernet device probe.  This is the easiest way to have every   * ethernet adaptor have the name "eth[0123...]".   */ diff --git a/include/net/act_api.h b/include/net/act_api.h index b944e0eb93be..fd08df74c466 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_ACT_API_H  #define __NET_ACT_API_H @@ -93,8 +94,7 @@ struct tc_action_ops {  	int     (*walk)(struct net *, struct sk_buff *,  			struct netlink_callback *, int, const struct tc_action_ops *);  	void	(*stats_update)(struct tc_action *, u64, u32, u64); -	int	(*get_dev)(const struct tc_action *a, struct net *net, -			   struct net_device **mirred_dev); +	struct net_device *(*get_dev)(const struct tc_action *a);  };  struct tc_action_net { @@ -122,7 +122,9 @@ void tcf_idrinfo_destroy(const struct tc_action_ops *ops,  static inline void tc_action_net_exit(struct tc_action_net *tn)  { +	rtnl_lock();  	tcf_idrinfo_destroy(tn->ops, tn->idrinfo); +	rtnl_unlock();  	kfree(tn->idrinfo);  } @@ -175,4 +177,38 @@ static inline void tcf_action_stats_update(struct tc_action *a, u64 bytes,  #endif  } +typedef int tc_setup_cb_t(enum tc_setup_type type, +			  void *type_data, void *cb_priv); + +#ifdef CONFIG_NET_CLS_ACT +int tc_setup_cb_egdev_register(const struct net_device *dev, +			       tc_setup_cb_t *cb, void *cb_priv); +void tc_setup_cb_egdev_unregister(const struct net_device *dev, +				  tc_setup_cb_t *cb, void *cb_priv); +int tc_setup_cb_egdev_call(const struct net_device *dev, +			   enum tc_setup_type type, void *type_data, +			   bool err_stop); +#else +static inline +int tc_setup_cb_egdev_register(const struct net_device *dev, +			       tc_setup_cb_t *cb, void *cb_priv) +{ +	return 0; +} + +static inline +void tc_setup_cb_egdev_unregister(const struct net_device *dev, +				  tc_setup_cb_t *cb, void *cb_priv) +{ +} + +static inline +int tc_setup_cb_egdev_call(const struct net_device *dev, +			   enum tc_setup_type type, void *type_data, +			   bool err_stop) +{ +	return 0; +} +#endif +  #endif diff --git a/include/net/addrconf.h b/include/net/addrconf.h index f44ff2476758..b623b65a79d1 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ADDRCONF_H  #define _ADDRCONF_H @@ -55,11 +56,9 @@ struct prefix_info {  struct in6_validator_info {  	struct in6_addr		i6vi_addr;  	struct inet6_dev	*i6vi_dev; +	struct netlink_ext_ack	*extack;  }; -#define IN6_ADDR_HSIZE_SHIFT	4 -#define IN6_ADDR_HSIZE		(1 << IN6_ADDR_HSIZE_SHIFT) -  int addrconf_init(void);  void addrconf_cleanup(void); @@ -94,8 +93,8 @@ int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,  		      u32 banned_flags);  int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,  		    u32 banned_flags); -int inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, -			 bool match_wildcard); +bool inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, +			  bool match_wildcard);  void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr);  void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr); @@ -207,7 +206,7 @@ void ipv6_mc_remap(struct inet6_dev *idev);  void ipv6_mc_init_dev(struct inet6_dev *idev);  void ipv6_mc_destroy_dev(struct inet6_dev *idev);  int ipv6_mc_check_mld(struct sk_buff *skb, struct sk_buff **skb_trimmed); -void addrconf_dad_failure(struct inet6_ifaddr *ifp); +void addrconf_dad_failure(struct sk_buff *skb, struct inet6_ifaddr *ifp);  bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,  			 const struct in6_addr *src_addr); diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h index 3ac79150291f..2b3a6eec4570 100644 --- a/include/net/af_rxrpc.h +++ b/include/net/af_rxrpc.h @@ -49,17 +49,19 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,  					   unsigned long,  					   s64,  					   gfp_t, -					   rxrpc_notify_rx_t); +					   rxrpc_notify_rx_t, +					   bool);  int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,  			   struct msghdr *, size_t,  			   rxrpc_notify_end_tx_t);  int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *, -			   void *, size_t, size_t *, bool, u32 *); +			   void *, size_t, size_t *, bool, u32 *, u16 *);  bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,  			     u32, int, const char *);  void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);  void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,  			   struct sockaddr_rxrpc *); +u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *);  int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,  			       rxrpc_user_attach_call_t, unsigned long, gfp_t);  void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); @@ -67,5 +69,6 @@ int rxrpc_kernel_retry_call(struct socket *, struct rxrpc_call *,  			    struct sockaddr_rxrpc *, struct key *);  int rxrpc_kernel_check_call(struct socket *, struct rxrpc_call *,  			    enum rxrpc_call_completion *, u32 *); +u32 rxrpc_kernel_check_life(struct socket *, struct rxrpc_call *);  #endif /* _NET_RXRPC_H */ diff --git a/include/net/af_unix.h b/include/net/af_unix.h index afb37f835449..a5ba41b3b867 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_NET_AFUNIX_H  #define __LINUX_NET_AFUNIX_H diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index f9fb566e75cf..9324ac2d9ff2 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h @@ -22,11 +22,13 @@  #include "vsock_addr.h" -/* vsock-specific sock->sk_state constants */ -#define VSOCK_SS_LISTEN 255 -  #define LAST_RESERVED_PORT 1023 +#define VSOCK_HASH_SIZE         251 +extern struct list_head vsock_bind_table[VSOCK_HASH_SIZE + 1]; +extern struct list_head vsock_connected_table[VSOCK_HASH_SIZE]; +extern spinlock_t vsock_table_lock; +  #define vsock_sk(__sk)    ((struct vsock_sock *)__sk)  #define sk_vsock(__vsk)   (&(__vsk)->sk) @@ -175,6 +177,18 @@ const struct vsock_transport *vsock_core_get_transport(void);  /**** UTILS ****/ +/* vsock_table_lock must be held */ +static inline bool __vsock_in_bound_table(struct vsock_sock *vsk) +{ +	return !list_empty(&vsk->bound_table); +} + +/* vsock_table_lock must be held */ +static inline bool __vsock_in_connected_table(struct vsock_sock *vsk) +{ +	return !list_empty(&vsk->connected_table); +} +  void vsock_release_pending(struct sock *pending);  void vsock_add_pending(struct sock *listener, struct sock *pending);  void vsock_remove_pending(struct sock *listener, struct sock *pending); diff --git a/include/net/ah.h b/include/net/ah.h index 4e2dfa474a7e..2d2dea521169 100644 --- a/include/net/ah.h +++ b/include/net/ah.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_AH_H  #define _NET_AH_H diff --git a/include/net/arp.h b/include/net/arp.h index 17d90e4e8dc5..dc8cd47f883b 100644 --- a/include/net/arp.h +++ b/include/net/arp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* linux/net/inet/arp.h */  #ifndef _ARP_H  #define _ARP_H diff --git a/include/net/atmclip.h b/include/net/atmclip.h index 5865924d4aac..70e350e0db3d 100644 --- a/include/net/atmclip.h +++ b/include/net/atmclip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* net/atm/atmarp.h - RFC1577 ATM ARP */  /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/net/ax25.h b/include/net/ax25.h index c4a0cf6f0810..76fb39c272a7 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Declarations of AX.25 type objects.   * diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 020142bb9735..e89cff0c4c23 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -147,6 +147,9 @@ void bt_err_ratelimited(const char *fmt, ...);  #define bt_dev_dbg(hdev, fmt, ...)				\  	BT_DBG("%s: " fmt, (hdev)->name, ##__VA_ARGS__) +#define bt_dev_err_ratelimited(hdev, fmt, ...)			\ +	BT_ERR_RATELIMITED("%s: " fmt, (hdev)->name, ##__VA_ARGS__) +  /* Connection and socket states */  enum {  	BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index fe98f0a5bef0..1668211297a9 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -273,7 +273,7 @@ enum {  #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */  #define HCI_POWER_OFF_TIMEOUT	msecs_to_jiffies(5000)	/* 5 seconds */  #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */ -#define HCI_LE_AUTOCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */ +#define HCI_LE_AUTOCONN_TIMEOUT	msecs_to_jiffies(4000)	/* 4 seconds */  /* HCI data types */  #define HCI_COMMAND_PKT		0x01 diff --git a/include/net/bonding.h b/include/net/bonding.h index b2e68657a216..f801fc940b29 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h @@ -330,7 +330,6 @@ static inline void bond_set_active_slave(struct slave *slave)  		slave->backup = 0;  		bond_queue_slave_event(slave);  		bond_lower_state_changed(slave); -		rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);  	}  } @@ -340,7 +339,6 @@ static inline void bond_set_backup_slave(struct slave *slave)  		slave->backup = 1;  		bond_queue_slave_event(slave);  		bond_lower_state_changed(slave); -		rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);  	}  } @@ -353,7 +351,6 @@ static inline void bond_set_slave_state(struct slave *slave,  	slave->backup = slave_state;  	if (notify) {  		bond_lower_state_changed(slave); -		rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);  		bond_queue_slave_event(slave);  		slave->should_notify = 0;  	} else { @@ -385,7 +382,6 @@ static inline void bond_slave_state_notify(struct bonding *bond)  	bond_for_each_slave(bond, tmp, iter) {  		if (tmp->should_notify) {  			bond_lower_state_changed(tmp); -			rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC);  			tmp->should_notify = 0;  		}  	} @@ -596,7 +592,8 @@ void bond_destroy_sysfs(struct bond_net *net);  void bond_prepare_sysfs_group(struct bonding *bond);  int bond_sysfs_slave_add(struct slave *slave);  void bond_sysfs_slave_del(struct slave *slave); -int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); +int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, +		 struct netlink_ext_ack *extack);  int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);  u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb);  int bond_set_carrier(struct bonding *bond); diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f12fa5245a45..8b8118a7fadb 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -4347,19 +4347,6 @@ static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,  }  /** - * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 - * @skb: the 802.3 frame - * @addr: the device MAC address - * @iftype: the virtual interface type - * @bssid: the network bssid (used only for iftype STATION and ADHOC) - * @qos: build 802.11 QoS data frame - * Return: 0 on success, or a negative error code. - */ -int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, -			     enum nl80211_iftype iftype, const u8 *bssid, -			     bool qos); - -/**   * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame   *   * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. @@ -5441,9 +5428,6 @@ cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,   * @req_ie_len: association request IEs length   * @resp_ie: association response IEs (may be %NULL)   * @resp_ie_len: assoc response IEs length - * @authorized: true if the 802.1X authentication was done by the driver or is - *	not needed (e.g., when Fast Transition protocol was used), false - *	otherwise. Ignored for networks that don't use 802.1X authentication.   */  struct cfg80211_roam_info {  	struct ieee80211_channel *channel; @@ -5453,7 +5437,6 @@ struct cfg80211_roam_info {  	size_t req_ie_len;  	const u8 *resp_ie;  	size_t resp_ie_len; -	bool authorized;  };  /** @@ -5478,6 +5461,23 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,  		     gfp_t gfp);  /** + * cfg80211_port_authorized - notify cfg80211 of successful security association + * + * @dev: network device + * @bssid: the BSSID of the AP + * @gfp: allocation flags + * + * This function should be called by a driver that supports 4 way handshake + * offload after a security association was successfully established (i.e., + * the 4 way handshake was completed successfully). The call to this function + * should be preceded with a call to cfg80211_connect_result(), + * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to + * indicate the 802.11 association. + */ +void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, +			      gfp_t gfp); + +/**   * cfg80211_disconnected - notify cfg80211 that connection was dropped   *   * @dev: network device @@ -5934,7 +5934,8 @@ int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,   * @ies: the IE buffer   * @ielen: the length of the IE buffer   * @ids: an array with element IDs that are allowed before - *	the split + *	the split. A WLAN_EID_EXTENSION value means that the next + *	EID in the list is a sub-element of the EXTENSION IE.   * @n_ids: the size of the element ID array   * @after_ric: array IE types that come after the RIC element   * @n_after_ric: size of the @after_ric array @@ -5965,7 +5966,8 @@ size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,   * @ies: the IE buffer   * @ielen: the length of the IE buffer   * @ids: an array with element IDs that are allowed before - *	the split + *	the split. A WLAN_EID_EXTENSION value means that the next + *	EID in the list is a sub-element of the EXTENSION IE.   * @n_ids: the size of the element ID array   * @offset: offset where to start splitting in the buffer   * diff --git a/include/net/compat.h b/include/net/compat.h index 13de0ccaa059..a91bea80b9fc 100644 --- a/include/net/compat.h +++ b/include/net/compat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef NET_COMPAT_H  #define NET_COMPAT_H diff --git a/include/net/datalink.h b/include/net/datalink.h index 93cb18f729b5..a9663229b913 100644 --- a/include/net/datalink.h +++ b/include/net/datalink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_INET_DATALINK_H_  #define _NET_INET_DATALINK_H_ diff --git a/include/net/dn.h b/include/net/dn.h index 913b73d239f5..56ab0726c641 100644 --- a/include/net/dn.h +++ b/include/net/dn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_DN_H  #define _NET_DN_H @@ -122,13 +123,6 @@ struct dn_scp                                   /* Session Control Port */  	unsigned long keepalive;  	void (*keepalive_fxn)(struct sock *sk); -	/* -	 * This stuff is for the fast timer for delayed acks -	 */ -	struct timer_list delack_timer; -	int delack_pending; -	void (*delack_fxn)(struct sock *sk); -  };  static inline struct dn_scp *DN_SK(struct sock *sk) diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h index 197886cd7bdd..595b4f6c1eb1 100644 --- a/include/net/dn_dev.h +++ b/include/net/dn_dev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_DN_DEV_H  #define _NET_DN_DEV_H diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index 81210a8b8d7c..6dd2213c5eb2 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_DN_FIB_H  #define _NET_DN_FIB_H diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h index 5e902fc3f4eb..2e3e7793973a 100644 --- a/include/net/dn_neigh.h +++ b/include/net/dn_neigh.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_DN_NEIGH_H  #define _NET_DN_NEIGH_H diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h index 3a3e33d18456..413a15e5339c 100644 --- a/include/net/dn_nsp.h +++ b/include/net/dn_nsp.h @@ -17,7 +17,6 @@  void dn_nsp_send_data_ack(struct sock *sk);  void dn_nsp_send_oth_ack(struct sock *sk); -void dn_nsp_delayed_ack(struct sock *sk);  void dn_send_conn_ack(struct sock *sk);  void dn_send_conn_conf(struct sock *sk, gfp_t gfp);  void dn_nsp_send_disc(struct sock *sk, unsigned char type, diff --git a/include/net/dsa.h b/include/net/dsa.h index dd44d6ce1097..2a05738570d8 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -29,6 +29,7 @@ struct fixed_phy_status;  enum dsa_tag_protocol {  	DSA_TAG_PROTO_NONE = 0,  	DSA_TAG_PROTO_BRCM, +	DSA_TAG_PROTO_BRCM_PREPEND,  	DSA_TAG_PROTO_DSA,  	DSA_TAG_PROTO_EDSA,  	DSA_TAG_PROTO_KSZ, @@ -116,13 +117,13 @@ struct dsa_switch_tree {  	struct raw_notifier_head	nh;  	/* Tree identifier */ -	u32 tree; +	unsigned int index;  	/* Number of switches attached to this tree */  	struct kref refcount;  	/* Has this tree been applied to the hardware? */ -	bool applied; +	bool setup;  	/*  	 * Configuration data for the platform device that owns @@ -130,11 +131,6 @@ struct dsa_switch_tree {  	 */  	struct dsa_platform_data	*pd; -	/* Copy of tag_ops->rcv for faster access in hot path */ -	struct sk_buff *	(*rcv)(struct sk_buff *skb, -				       struct net_device *dev, -				       struct packet_type *pt); -  	/*  	 * The switch port to which the CPU is attached.  	 */ @@ -144,12 +140,6 @@ struct dsa_switch_tree {  	 * Data for the individual switch chips.  	 */  	struct dsa_switch	*ds[DSA_MAX_SWITCHES]; - -	/* -	 * Tagging protocol operations for adding and removing an -	 * encapsulation tag. -	 */ -	const struct dsa_device_ops *tag_ops;  };  /* TC matchall action types, only mirroring for now */ @@ -175,11 +165,33 @@ struct dsa_mall_tc_entry {  struct dsa_port { +	/* A CPU port is physically connected to a master device. +	 * A user port exposed to userspace has a slave device. +	 */ +	union { +		struct net_device *master; +		struct net_device *slave; +	}; + +	/* CPU port tagging operations used by master or slave devices */ +	const struct dsa_device_ops *tag_ops; + +	/* Copies for faster access in master receive hot path */ +	struct dsa_switch_tree *dst; +	struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev, +			       struct packet_type *pt); + +	enum { +		DSA_PORT_TYPE_UNUSED = 0, +		DSA_PORT_TYPE_CPU, +		DSA_PORT_TYPE_DSA, +		DSA_PORT_TYPE_USER, +	} type; +  	struct dsa_switch	*ds;  	unsigned int		index;  	const char		*name; -	struct dsa_port		*cpu_dp; -	struct net_device	*netdev; +	const struct dsa_port	*cpu_dp;  	struct device_node	*dn;  	unsigned int		ageing_time;  	u8			stp_state; @@ -188,7 +200,6 @@ struct dsa_port {  	/*  	 * Original copy of the master netdev ethtool_ops  	 */ -	struct ethtool_ops	ethtool_ops;  	const struct ethtool_ops *orig_ethtool_ops;  }; @@ -199,7 +210,7 @@ struct dsa_switch {  	 * Parent switch tree, and switch index.  	 */  	struct dsa_switch_tree	*dst; -	int			index; +	unsigned int		index;  	/* Listener for switch fabric events */  	struct notifier_block	nb; @@ -230,9 +241,6 @@ struct dsa_switch {  	/*  	 * Slave mii_bus and devices for the individual ports.  	 */ -	u32			dsa_port_mask; -	u32			cpu_port_mask; -	u32			enabled_port_mask;  	u32			phys_mii_mask;  	struct mii_bus		*slave_mii_bus; @@ -251,19 +259,41 @@ struct dsa_switch {  	struct dsa_port ports[];  }; +static inline const struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p) +{ +	return &ds->ports[p]; +} + +static inline bool dsa_is_unused_port(struct dsa_switch *ds, int p) +{ +	return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_UNUSED; +} +  static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)  { -	return !!(ds->cpu_port_mask & (1 << p)); +	return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_CPU;  }  static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)  { -	return !!((ds->dsa_port_mask) & (1 << p)); +	return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_DSA; +} + +static inline bool dsa_is_user_port(struct dsa_switch *ds, int p) +{ +	return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_USER;  } -static inline bool dsa_is_normal_port(struct dsa_switch *ds, int p) +static inline u32 dsa_user_ports(struct dsa_switch *ds)  { -	return !dsa_is_cpu_port(ds, p) && !dsa_is_dsa_port(ds, p); +	u32 mask = 0; +	int p; + +	for (p = 0; p < ds->num_ports; p++) +		if (dsa_is_user_port(ds, p)) +			mask |= BIT(p); + +	return mask;  }  static inline u8 dsa_upstream_port(struct dsa_switch *ds) @@ -292,10 +322,10 @@ struct dsa_switch_ops {  				  struct device *host_dev, int sw_addr,  				  void **priv); -	enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds); +	enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds, +						  int port);  	int	(*setup)(struct dsa_switch *ds); -	int	(*set_addr)(struct dsa_switch *ds, u8 *addr);  	u32	(*get_phy_flags)(struct dsa_switch *ds, int port);  	/* @@ -475,4 +505,54 @@ static inline int dsa_switch_resume(struct dsa_switch *ds)  }  #endif /* CONFIG_PM_SLEEP */ +enum dsa_notifier_type { +	DSA_PORT_REGISTER, +	DSA_PORT_UNREGISTER, +}; + +struct dsa_notifier_info { +	struct net_device *dev; +}; + +struct dsa_notifier_register_info { +	struct dsa_notifier_info info;	/* must be first */ +	struct net_device *master; +	unsigned int port_number; +	unsigned int switch_number; +}; + +static inline struct net_device * +dsa_notifier_info_to_dev(const struct dsa_notifier_info *info) +{ +	return info->dev; +} + +#if IS_ENABLED(CONFIG_NET_DSA) +int register_dsa_notifier(struct notifier_block *nb); +int unregister_dsa_notifier(struct notifier_block *nb); +int call_dsa_notifiers(unsigned long val, struct net_device *dev, +		       struct dsa_notifier_info *info); +#else +static inline int register_dsa_notifier(struct notifier_block *nb) +{ +	return 0; +} + +static inline int unregister_dsa_notifier(struct notifier_block *nb) +{ +	return 0; +} + +static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev, +				     struct dsa_notifier_info *info) +{ +	return NOTIFY_DONE; +} +#endif + +/* Broadcom tag specific helpers to insert and extract queue/port number */ +#define BRCM_TAG_SET_PORT_QUEUE(p, q)	((p) << 8 | q) +#define BRCM_TAG_GET_PORT(v)		((v) >> 8) +#define BRCM_TAG_GET_QUEUE(v)		((v) & 0xff) +  #endif diff --git a/include/net/dsfield.h b/include/net/dsfield.h index e1ad903a8d6a..1a245ee10c95 100644 --- a/include/net/dsfield.h +++ b/include/net/dsfield.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* include/net/dsfield.h - Manipulation of the Differentiated Services field */  /* Written 1998-2000 by Werner Almesberger, EPFL ICA */ diff --git a/include/net/dst.h b/include/net/dst.h index 06a6765da074..b091fd536098 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * net/dst.h	Protocol independent destination cache definitions.   * @@ -101,7 +102,7 @@ struct dst_entry {  	union {  		struct dst_entry	*next;  		struct rtable __rcu	*rt_next; -		struct rt6_info		*rt6_next; +		struct rt6_info __rcu	*rt6_next;  		struct dn_route __rcu	*dn_next;  	};  }; @@ -255,17 +256,18 @@ static inline void dst_hold(struct dst_entry *dst)  	WARN_ON(atomic_inc_not_zero(&dst->__refcnt) == 0);  } -static inline void dst_use(struct dst_entry *dst, unsigned long time) +static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)  { -	dst_hold(dst); -	dst->__use++; -	dst->lastuse = time; +	if (unlikely(time != dst->lastuse)) { +		dst->__use++; +		dst->lastuse = time; +	}  } -static inline void dst_use_noref(struct dst_entry *dst, unsigned long time) +static inline void dst_hold_and_use(struct dst_entry *dst, unsigned long time)  { -	dst->__use++; -	dst->lastuse = time; +	dst_hold(dst); +	dst_use_noref(dst, time);  }  static inline struct dst_entry *dst_clone(struct dst_entry *dst) diff --git a/include/net/dst_cache.h b/include/net/dst_cache.h index 151accae708b..72fd5067c353 100644 --- a/include/net/dst_cache.h +++ b/include/net/dst_cache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_DST_CACHE_H  #define _NET_DST_CACHE_H diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h index a803129a4849..56cb3c38569a 100644 --- a/include/net/dst_metadata.h +++ b/include/net/dst_metadata.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_DST_METADATA_H  #define __NET_DST_METADATA_H 1 @@ -24,7 +25,7 @@ struct metadata_dst {  	} u;  }; -static inline struct metadata_dst *skb_metadata_dst(struct sk_buff *skb) +static inline struct metadata_dst *skb_metadata_dst(const struct sk_buff *skb)  {  	struct metadata_dst *md_dst = (struct metadata_dst *) skb_dst(skb); @@ -34,7 +35,8 @@ static inline struct metadata_dst *skb_metadata_dst(struct sk_buff *skb)  	return NULL;  } -static inline struct ip_tunnel_info *skb_tunnel_info(struct sk_buff *skb) +static inline struct ip_tunnel_info * +skb_tunnel_info(const struct sk_buff *skb)  {  	struct metadata_dst *md_dst = skb_metadata_dst(skb);  	struct dst_entry *dst; @@ -86,6 +88,7 @@ static inline int skb_metadata_dst_cmp(const struct sk_buff *skb_a,  void metadata_dst_free(struct metadata_dst *);  struct metadata_dst *metadata_dst_alloc(u8 optslen, enum metadata_type type,  					gfp_t flags); +void metadata_dst_free_percpu(struct metadata_dst __percpu *md_dst);  struct metadata_dst __percpu *  metadata_dst_alloc_percpu(u8 optslen, enum metadata_type type, gfp_t flags); diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index c84b3287e38b..5ec645f27ee3 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_DST_OPS_H  #define _NET_DST_OPS_H  #include <linux/types.h> diff --git a/include/net/esp.h b/include/net/esp.h index c41994d1bfef..117652eb6ea3 100644 --- a/include/net/esp.h +++ b/include/net/esp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_ESP_H  #define _NET_ESP_H diff --git a/include/net/fib_notifier.h b/include/net/fib_notifier.h index 669b9716dc7a..c91ec732afd6 100644 --- a/include/net/fib_notifier.h +++ b/include/net/fib_notifier.h @@ -9,6 +9,7 @@  struct fib_notifier_info {  	struct net *net;  	int family; +	struct netlink_ext_ack  *extack;  };  enum fib_event_type { @@ -20,6 +21,8 @@ enum fib_event_type {  	FIB_EVENT_RULE_DEL,  	FIB_EVENT_NH_ADD,  	FIB_EVENT_NH_DEL, +	FIB_EVENT_VIF_ADD, +	FIB_EVENT_VIF_DEL,  };  struct fib_notifier_ops { diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 3d7f1cefc6f5..648caf90ec07 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_FIB_RULES_H  #define __NET_FIB_RULES_H diff --git a/include/net/firewire.h b/include/net/firewire.h index 31bcbfe7a220..299e5df38552 100644 --- a/include/net/firewire.h +++ b/include/net/firewire.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_FIREWIRE_H  #define _NET_FIREWIRE_H diff --git a/include/net/flow.h b/include/net/flow.h index eb60cee30b44..f1624fd5b1d0 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *   *	Generic internet FLOW. diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index fc3dce730a6b..9a074776f70b 100644 --- a/include/net/flow_dissector.h +++ b/include/net/flow_dissector.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_FLOW_DISSECTOR_H  #define _NET_FLOW_DISSECTOR_H @@ -83,11 +84,11 @@ struct flow_dissector_key_ipv6_addrs {  };  /** - * struct flow_dissector_key_tipc_addrs: - * @srcnode: source node address + * struct flow_dissector_key_tipc: + * @key: source node address combined with selector   */ -struct flow_dissector_key_tipc_addrs { -	__be32 srcnode; +struct flow_dissector_key_tipc { +	__be32 key;  };  /** @@ -99,7 +100,7 @@ struct flow_dissector_key_addrs {  	union {  		struct flow_dissector_key_ipv4_addrs v4addrs;  		struct flow_dissector_key_ipv6_addrs v6addrs; -		struct flow_dissector_key_tipc_addrs tipcaddrs; +		struct flow_dissector_key_tipc tipckey;  	};  }; @@ -191,7 +192,7 @@ enum flow_dissector_key_id {  	FLOW_DISSECTOR_KEY_PORTS, /* struct flow_dissector_key_ports */  	FLOW_DISSECTOR_KEY_ICMP, /* struct flow_dissector_key_icmp */  	FLOW_DISSECTOR_KEY_ETH_ADDRS, /* struct flow_dissector_key_eth_addrs */ -	FLOW_DISSECTOR_KEY_TIPC_ADDRS, /* struct flow_dissector_key_tipc_addrs */ +	FLOW_DISSECTOR_KEY_TIPC, /* struct flow_dissector_key_tipc */  	FLOW_DISSECTOR_KEY_ARP, /* struct flow_dissector_key_arp */  	FLOW_DISSECTOR_KEY_VLAN, /* struct flow_dissector_key_flow_vlan */  	FLOW_DISSECTOR_KEY_FLOW_LABEL, /* struct flow_dissector_key_flow_tags */ diff --git a/include/net/fou.h b/include/net/fou.h index f5cc6910a27e..80f56e275b08 100644 --- a/include/net/fou.h +++ b/include/net/fou.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_FOU_H  #define __NET_FOU_H diff --git a/include/net/fq.h b/include/net/fq.h index 6d8521a30c5c..ac944a686840 100644 --- a/include/net/fq.h +++ b/include/net/fq.h @@ -90,6 +90,13 @@ typedef void fq_skb_free_t(struct fq *,  			   struct fq_flow *,  			   struct sk_buff *); +/* Return %true to filter (drop) the frame. */ +typedef bool fq_skb_filter_t(struct fq *, +			     struct fq_tin *, +			     struct fq_flow *, +			     struct sk_buff *, +			     void *); +  typedef struct fq_flow *fq_flow_get_default_t(struct fq *,  					      struct fq_tin *,  					      int idx, diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h index 4e6131cd3f43..be7c0fab3478 100644 --- a/include/net/fq_impl.h +++ b/include/net/fq_impl.h @@ -12,24 +12,22 @@  /* functions that are embedded into includer */ -static struct sk_buff *fq_flow_dequeue(struct fq *fq, -				       struct fq_flow *flow) +static void fq_adjust_removal(struct fq *fq, +			      struct fq_flow *flow, +			      struct sk_buff *skb)  {  	struct fq_tin *tin = flow->tin; -	struct fq_flow *i; -	struct sk_buff *skb; - -	lockdep_assert_held(&fq->lock); - -	skb = __skb_dequeue(&flow->queue); -	if (!skb) -		return NULL;  	tin->backlog_bytes -= skb->len;  	tin->backlog_packets--;  	flow->backlog -= skb->len;  	fq->backlog--;  	fq->memory_usage -= skb->truesize; +} + +static void fq_rejigger_backlog(struct fq *fq, struct fq_flow *flow) +{ +	struct fq_flow *i;  	if (flow->backlog == 0) {  		list_del_init(&flow->backlogchain); @@ -43,6 +41,21 @@ static struct sk_buff *fq_flow_dequeue(struct fq *fq,  		list_move_tail(&flow->backlogchain,  			       &i->backlogchain);  	} +} + +static struct sk_buff *fq_flow_dequeue(struct fq *fq, +				       struct fq_flow *flow) +{ +	struct sk_buff *skb; + +	lockdep_assert_held(&fq->lock); + +	skb = __skb_dequeue(&flow->queue); +	if (!skb) +		return NULL; + +	fq_adjust_removal(fq, flow, skb); +	fq_rejigger_backlog(fq, flow);  	return skb;  } @@ -146,6 +159,7 @@ static void fq_tin_enqueue(struct fq *fq,  			   fq_flow_get_default_t get_default_func)  {  	struct fq_flow *flow; +	bool oom;  	lockdep_assert_held(&fq->lock); @@ -167,8 +181,8 @@ static void fq_tin_enqueue(struct fq *fq,  	}  	__skb_queue_tail(&flow->queue, skb); - -	if (fq->backlog > fq->limit || fq->memory_usage > fq->memory_limit) { +	oom = (fq->memory_usage > fq->memory_limit); +	while (fq->backlog > fq->limit || oom) {  		flow = list_first_entry_or_null(&fq->backlogs,  						struct fq_flow,  						backlogchain); @@ -183,11 +197,52 @@ static void fq_tin_enqueue(struct fq *fq,  		flow->tin->overlimit++;  		fq->overlimit++; -		if (fq->memory_usage > fq->memory_limit) +		if (oom) {  			fq->overmemory++; +			oom = (fq->memory_usage > fq->memory_limit); +		}  	}  } +static void fq_flow_filter(struct fq *fq, +			   struct fq_flow *flow, +			   fq_skb_filter_t filter_func, +			   void *filter_data, +			   fq_skb_free_t free_func) +{ +	struct fq_tin *tin = flow->tin; +	struct sk_buff *skb, *tmp; + +	lockdep_assert_held(&fq->lock); + +	skb_queue_walk_safe(&flow->queue, skb, tmp) { +		if (!filter_func(fq, tin, flow, skb, filter_data)) +			continue; + +		__skb_unlink(skb, &flow->queue); +		fq_adjust_removal(fq, flow, skb); +		free_func(fq, tin, flow, skb); +	} + +	fq_rejigger_backlog(fq, flow); +} + +static void fq_tin_filter(struct fq *fq, +			  struct fq_tin *tin, +			  fq_skb_filter_t filter_func, +			  void *filter_data, +			  fq_skb_free_t free_func) +{ +	struct fq_flow *flow; + +	lockdep_assert_held(&fq->lock); + +	list_for_each_entry(flow, &tin->new_flows, flowchain) +		fq_flow_filter(fq, flow, filter_func, filter_data, free_func); +	list_for_each_entry(flow, &tin->old_flows, flowchain) +		fq_flow_filter(fq, flow, filter_func, filter_data, free_func); +} +  static void fq_flow_reset(struct fq *fq,  			  struct fq_flow *flow,  			  fq_skb_free_t free_func) diff --git a/include/net/garp.h b/include/net/garp.h index abf33bbd2e6a..c41833bd4590 100644 --- a/include/net/garp.h +++ b/include/net/garp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_GARP_H  #define _NET_GARP_H diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h index 8b7aa370e7a4..304f7aa9cc01 100644 --- a/include/net/gen_stats.h +++ b/include/net/gen_stats.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_GEN_STATS_H  #define __NET_GEN_STATS_H diff --git a/include/net/genetlink.h b/include/net/genetlink.h index c59a098221db..decf6012a401 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_GENERIC_NETLINK_H  #define __NET_GENERIC_NETLINK_H @@ -153,15 +154,12 @@ void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,  /**   * genlmsg_nlhdr - Obtain netlink header from user specified header   * @user_hdr: user header as returned from genlmsg_put() - * @family: generic netlink family   *   * Returns pointer to netlink header.   */ -static inline struct nlmsghdr * -genlmsg_nlhdr(void *user_hdr, const struct genl_family *family) +static inline struct nlmsghdr *genlmsg_nlhdr(void *user_hdr)  {  	return (struct nlmsghdr *)((char *)user_hdr - -				   family->hdrsize -  				   GENL_HDRLEN -  				   NLMSG_HDRLEN);  } @@ -189,16 +187,14 @@ static inline int genlmsg_parse(const struct nlmsghdr *nlh,   * genl_dump_check_consistent - check if sequence is consistent and advertise if not   * @cb: netlink callback structure that stores the sequence number   * @user_hdr: user header as returned from genlmsg_put() - * @family: generic netlink family   *   * Cf. nl_dump_check_consistent(), this just provides a wrapper to make it   * simpler to use with generic netlink.   */  static inline void genl_dump_check_consistent(struct netlink_callback *cb, -					      void *user_hdr, -					      const struct genl_family *family) +					      void *user_hdr)  { -	nl_dump_check_consistent(cb, genlmsg_nlhdr(user_hdr, family)); +	nl_dump_check_consistent(cb, genlmsg_nlhdr(user_hdr));  }  /** diff --git a/include/net/geneve.h b/include/net/geneve.h index ec0327d4331b..a7600ed55ea3 100644 --- a/include/net/geneve.h +++ b/include/net/geneve.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_GENEVE_H  #define __NET_GENEVE_H  1 diff --git a/include/net/gre.h b/include/net/gre.h index d25d836c129b..f90585decbce 100644 --- a/include/net/gre.h +++ b/include/net/gre.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_GRE_H  #define __LINUX_GRE_H diff --git a/include/net/gro_cells.h b/include/net/gro_cells.h index fcaf8f479130..596688b67a2a 100644 --- a/include/net/gro_cells.h +++ b/include/net/gro_cells.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_GRO_CELLS_H  #define _NET_GRO_CELLS_H diff --git a/include/net/gtp.h b/include/net/gtp.h index 6398891b99ba..0e16ebb2a82d 100644 --- a/include/net/gtp.h +++ b/include/net/gtp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _GTP_H_  #define _GTP_H_ diff --git a/include/net/gue.h b/include/net/gue.h index 3f28ec7f1c7f..2fdb29ca74c2 100644 --- a/include/net/gue.h +++ b/include/net/gue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_GUE_H  #define __NET_GUE_H diff --git a/include/net/hwbm.h b/include/net/hwbm.h index 47d08662501b..89085e2e2da5 100644 --- a/include/net/hwbm.h +++ b/include/net/hwbm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _HWBM_H  #define _HWBM_H diff --git a/include/net/ife.h b/include/net/ife.h index 2d87d6898b0a..44b9c00f7223 100644 --- a/include/net/ife.h +++ b/include/net/ife.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_IFE_H  #define __NET_IFE_H diff --git a/include/net/inet_common.h b/include/net/inet_common.h index f39ae697347f..5a54c9570977 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _INET_COMMON_H  #define _INET_COMMON_H diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 13e4c89a8231..0358745ea059 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h @@ -169,9 +169,9 @@ enum inet_csk_ack_state_t {  };  void inet_csk_init_xmit_timers(struct sock *sk, -			       void (*retransmit_handler)(unsigned long), -			       void (*delack_handler)(unsigned long), -			       void (*keepalive_handler)(unsigned long)); +			       void (*retransmit_handler)(struct timer_list *), +			       void (*delack_handler)(struct timer_list *), +			       void (*keepalive_handler)(struct timer_list *));  void inet_csk_clear_xmit_timers(struct sock *sk);  static inline void inet_csk_schedule_ack(struct sock *sk) diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index dce2d586d9ce..482a1b705362 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _INET_ECN_H_  #define _INET_ECN_H_ @@ -133,11 +134,6 @@ static inline int IP6_ECN_set_ce(struct sk_buff *skb, struct ipv6hdr *iph)  	return 1;  } -static inline void IP6_ECN_clear(struct ipv6hdr *iph) -{ -	*(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); -} -  static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)  {  	dscp &= ~INET_ECN_MASK; diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index fc59e0775e00..351f0c3cdcd9 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_FRAG_H__  #define __NET_FRAG_H__ @@ -95,7 +96,7 @@ struct inet_frags {  	void			(*constructor)(struct inet_frag_queue *q,  					       const void *arg);  	void			(*destructor)(struct inet_frag_queue *); -	void			(*frag_expire)(unsigned long data); +	void			(*frag_expire)(struct timer_list *t);  	struct kmem_cache	*frags_cachep;  	const char		*frags_cache_name;  }; diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index aa95053dfc78..39efb968b7a4 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -17,7 +17,6 @@  #define _INET_SOCK_H  #include <linux/bitops.h> -#include <linux/kmemcheck.h>  #include <linux/string.h>  #include <linux/types.h>  #include <linux/jhash.h> @@ -84,7 +83,6 @@ struct inet_request_sock {  #define ireq_state		req.__req_common.skc_state  #define ireq_family		req.__req_common.skc_family -	kmemcheck_bitfield_begin(flags);  	u16			snd_wscale : 4,  				rcv_wscale : 4,  				tstamp_ok  : 1, @@ -92,11 +90,11 @@ struct inet_request_sock {  				wscale_ok  : 1,  				ecn_ok	   : 1,  				acked	   : 1, -				no_srccheck: 1; -	kmemcheck_bitfield_end(flags); +				no_srccheck: 1, +				smc_ok	   : 1;  	u32                     ir_mark;  	union { -		struct ip_options_rcu	*opt; +		struct ip_options_rcu __rcu	*ireq_opt;  #if IS_ENABLED(CONFIG_IPV6)  		struct {  			struct ipv6_txoptions	*ipv6_opt; @@ -132,6 +130,12 @@ static inline int inet_request_bound_dev_if(const struct sock *sk,  	return sk->sk_bound_dev_if;  } +static inline struct ip_options_rcu *ireq_opt_deref(const struct inet_request_sock *ireq) +{ +	return rcu_dereference_check(ireq->ireq_opt, +				     refcount_read(&ireq->req.rsk_refcnt) > 0); +} +  struct inet_cork {  	unsigned int		flags;  	__be32			addr; diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 6a75d67a30fd..1356fa6a7566 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h @@ -15,8 +15,6 @@  #ifndef _INET_TIMEWAIT_SOCK_  #define _INET_TIMEWAIT_SOCK_ - -#include <linux/kmemcheck.h>  #include <linux/list.h>  #include <linux/timer.h>  #include <linux/types.h> @@ -69,14 +67,12 @@ struct inet_timewait_sock {  	/* Socket demultiplex comparisons on incoming packets. */  	/* these three are in inet_sock */  	__be16			tw_sport; -	kmemcheck_bitfield_begin(flags);  	/* And these are ours. */  	unsigned int		tw_kill		: 1,  				tw_transparent  : 1,  				tw_flowlabel	: 20,  				tw_pad		: 2,	/* 2 bits hole */  				tw_tos		: 8; -	kmemcheck_bitfield_end(flags);  	struct timer_list	tw_timer;  	struct inet_bind_bucket	*tw_tb;  }; diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 950ed182f62f..00b5e7825508 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *		INETPEER - A storage for permanent information about peers   * diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index d060d711a624..10c913816032 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -29,6 +29,14 @@  #define FIB6_TABLE_HASHSZ 1  #endif +#define RT6_DEBUG 2 + +#if RT6_DEBUG >= 3 +#define RT6_TRACE(x...) pr_debug(x) +#else +#define RT6_TRACE(x...) do { ; } while (0) +#endif +  struct rt6_info;  struct fib6_config { @@ -60,25 +68,30 @@ struct fib6_config {  };  struct fib6_node { -	struct fib6_node	*parent; -	struct fib6_node	*left; -	struct fib6_node	*right; +	struct fib6_node __rcu	*parent; +	struct fib6_node __rcu	*left; +	struct fib6_node __rcu	*right;  #ifdef CONFIG_IPV6_SUBTREES -	struct fib6_node	*subtree; +	struct fib6_node __rcu	*subtree;  #endif -	struct rt6_info		*leaf; +	struct rt6_info __rcu	*leaf;  	__u16			fn_bit;		/* bit key */  	__u16			fn_flags;  	int			fn_sernum; -	struct rt6_info		*rr_ptr; +	struct rt6_info __rcu	*rr_ptr;  	struct rcu_head		rcu;  }; +struct fib6_gc_args { +	int			timeout; +	int			more; +}; +  #ifndef CONFIG_IPV6_SUBTREES  #define FIB6_SUBTREE(fn)	NULL  #else -#define FIB6_SUBTREE(fn)	((fn)->subtree) +#define FIB6_SUBTREE(fn)	(rcu_dereference_protected((fn)->subtree, 1))  #endif  struct mx6_config { @@ -98,6 +111,22 @@ struct rt6key {  struct fib6_table; +struct rt6_exception_bucket { +	struct hlist_head	chain; +	int			depth; +}; + +struct rt6_exception { +	struct hlist_node	hlist; +	struct rt6_info		*rt6i; +	unsigned long		stamp; +	struct rcu_head		rcu; +}; + +#define FIB6_EXCEPTION_BUCKET_SIZE_SHIFT 10 +#define FIB6_EXCEPTION_BUCKET_SIZE (1 << FIB6_EXCEPTION_BUCKET_SIZE_SHIFT) +#define FIB6_MAX_DEPTH 5 +  struct rt6_info {  	struct dst_entry		dst; @@ -134,14 +163,25 @@ struct rt6_info {  	struct inet6_dev		*rt6i_idev;  	struct rt6_info * __percpu	*rt6i_pcpu; +	struct rt6_exception_bucket __rcu *rt6i_exception_bucket;  	u32				rt6i_metric;  	u32				rt6i_pmtu;  	/* more non-fragment space at head required */  	unsigned short			rt6i_nfheader_len;  	u8				rt6i_protocol; +	u8				exception_bucket_flushed:1, +					unused:7;  }; +#define for_each_fib6_node_rt_rcu(fn)					\ +	for (rt = rcu_dereference((fn)->leaf); rt;			\ +	     rt = rcu_dereference(rt->dst.rt6_next)) + +#define for_each_fib6_walker_rt(w)					\ +	for (rt = (w)->leaf; rt;					\ +	     rt = rcu_dereference_protected(rt->dst.rt6_next, 1)) +  static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)  {  	return ((struct rt6_info *)dst)->rt6i_idev; @@ -188,6 +228,8 @@ static inline bool rt6_get_cookie_safe(const struct rt6_info *rt,  	if (fn) {  		*cookie = fn->fn_sernum; +		/* pairs with smp_wmb() in fib6_update_sernum_upto_root() */ +		smp_rmb();  		status = true;  	} @@ -248,7 +290,6 @@ struct fib6_walker {  	struct fib6_node *root, *node;  	struct rt6_info *leaf;  	enum fib6_walk_state state; -	bool prune;  	unsigned int skip;  	unsigned int count;  	int (*func)(struct fib6_walker *); @@ -256,12 +297,15 @@ struct fib6_walker {  };  struct rt6_statistics { -	__u32		fib_nodes; -	__u32		fib_route_nodes; -	__u32		fib_rt_alloc;		/* permanent routes	*/ -	__u32		fib_rt_entries;		/* rt entries in table	*/ -	__u32		fib_rt_cache;		/* cache routes		*/ -	__u32		fib_discarded_routes; +	__u32		fib_nodes;		/* all fib6 nodes */ +	__u32		fib_route_nodes;	/* intermediate nodes */ +	__u32		fib_rt_entries;		/* rt entries in fib table */ +	__u32		fib_rt_cache;		/* cached rt entries in exception table */ +	__u32		fib_discarded_routes;	/* total number of routes delete */ + +	/* The following stats are not protected by any lock */ +	atomic_t	fib_rt_alloc;		/* total number of routes alloced */ +	atomic_t	fib_rt_uncache;		/* rt entries in uncached list */  };  #define RTN_TL_ROOT	0x0001 @@ -277,7 +321,7 @@ struct rt6_statistics {  struct fib6_table {  	struct hlist_node	tb6_hlist;  	u32			tb6_id; -	rwlock_t		tb6_lock; +	spinlock_t		tb6_lock;  	struct fib6_node	tb6_root;  	struct inet_peer_base	tb6_peers;  	unsigned int		flags; @@ -325,7 +369,8 @@ struct fib6_node *fib6_lookup(struct fib6_node *root,  struct fib6_node *fib6_locate(struct fib6_node *root,  			      const struct in6_addr *daddr, int dst_len, -			      const struct in6_addr *saddr, int src_len); +			      const struct in6_addr *saddr, int src_len, +			      bool exact_match);  void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),  		    void *arg); @@ -358,6 +403,8 @@ void __net_exit fib6_notifier_exit(struct net *net);  unsigned int fib6_tables_seq_read(struct net *net);  int fib6_tables_dump(struct net *net, struct notifier_block *nb); +void fib6_update_sernum(struct rt6_info *rt); +  #ifdef CONFIG_IPV6_MULTIPLE_TABLES  int fib6_rules_init(void);  void fib6_rules_cleanup(void); diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index ee96f402cb75..18e442ea93d8 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_IP6_ROUTE_H  #define _NET_IP6_ROUTE_H @@ -95,6 +96,11 @@ int ip6_route_add(struct fib6_config *cfg, struct netlink_ext_ack *extack);  int ip6_ins_rt(struct rt6_info *);  int ip6_del_rt(struct rt6_info *); +void rt6_flush_exceptions(struct rt6_info *rt); +int rt6_remove_exception_rt(struct rt6_info *rt); +void rt6_age_exceptions(struct rt6_info *rt, struct fib6_gc_args *gc_args, +			unsigned long now); +  static inline int ip6_route_get_saddr(struct net *net, struct rt6_info *rt,  				      const struct in6_addr *daddr,  				      unsigned int prefs, diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index 08fbc7f7d8d7..d66f70f63734 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_IP6_TUNNEL_H  #define _NET_IP6_TUNNEL_H diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 1a7f7e424320..f80524396c06 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -122,9 +122,6 @@ struct fib_info {  #define fib_rtt fib_metrics->metrics[RTAX_RTT-1]  #define fib_advmss fib_metrics->metrics[RTAX_ADVMSS-1]  	int			fib_nhs; -#ifdef CONFIG_IP_ROUTE_MULTIPATH -	int			fib_weight; -#endif  	struct rcu_head		rcu;  	struct fib_nh		fib_nh[0];  #define fib_dev		fib_nh[0].nh_dev diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 992652856fe8..24628f6b09bf 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_IP_TUNNELS_H  #define __NET_IP_TUNNELS_H 1 @@ -258,7 +259,8 @@ int ip_tunnel_get_iflink(const struct net_device *dev);  int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id,  		       struct rtnl_link_ops *ops, char *devname); -void ip_tunnel_delete_net(struct ip_tunnel_net *itn, struct rtnl_link_ops *ops); +void ip_tunnel_delete_nets(struct list_head *list_net, unsigned int id, +			   struct rtnl_link_ops *ops);  void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,  		    const struct iphdr *tnl_params, const u8 protocol); diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 4f4f786255ef..ff68cf288f9b 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* IP Virtual Server   * data structure and functionality definitions   */ @@ -983,12 +984,12 @@ static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)  static inline int sysctl_sync_period(struct netns_ipvs *ipvs)  { -	return ACCESS_ONCE(ipvs->sysctl_sync_threshold[1]); +	return READ_ONCE(ipvs->sysctl_sync_threshold[1]);  }  static inline unsigned int sysctl_sync_refresh_period(struct netns_ipvs *ipvs)  { -	return ACCESS_ONCE(ipvs->sysctl_sync_refresh_period); +	return READ_ONCE(ipvs->sysctl_sync_refresh_period);  }  static inline int sysctl_sync_retries(struct netns_ipvs *ipvs) @@ -1013,7 +1014,7 @@ static inline int sysctl_sloppy_sctp(struct netns_ipvs *ipvs)  static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)  { -	return ACCESS_ONCE(ipvs->sysctl_sync_ports); +	return READ_ONCE(ipvs->sysctl_sync_ports);  }  static inline int sysctl_sync_persist_mode(struct netns_ipvs *ipvs) diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h index cc4f30cd7315..fee6fc451597 100644 --- a/include/net/ipcomp.h +++ b/include/net/ipcomp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_IPCOMP_H  #define _NET_IPCOMP_H diff --git a/include/net/ipconfig.h b/include/net/ipconfig.h index c74cc1bd5a02..e3534299bd2a 100644 --- a/include/net/ipconfig.h +++ b/include/net/ipconfig.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  Copyright (C) 1997 Martin Mares   * diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 6eac5cf8f1e6..f73797e2fa60 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -51,6 +51,46 @@  #define IPV6_DEFAULT_HOPLIMIT   64  #define IPV6_DEFAULT_MCASTHOPS	1 +/* Limits on Hop-by-Hop and Destination options. + * + * Per RFC8200 there is no limit on the maximum number or lengths of options in + * Hop-by-Hop or Destination options other then the packet must fit in an MTU. + * We allow configurable limits in order to mitigate potential denial of + * service attacks. + * + * There are three limits that may be set: + *   - Limit the number of options in a Hop-by-Hop or Destination options + *     extension header + *   - Limit the byte length of a Hop-by-Hop or Destination options extension + *     header + *   - Disallow unknown options + * + * The limits are expressed in corresponding sysctls: + * + * ipv6.sysctl.max_dst_opts_cnt + * ipv6.sysctl.max_hbh_opts_cnt + * ipv6.sysctl.max_dst_opts_len + * ipv6.sysctl.max_hbh_opts_len + * + * max_*_opts_cnt is the number of TLVs that are allowed for Destination + * options or Hop-by-Hop options. If the number is less than zero then unknown + * TLVs are disallowed and the number of known options that are allowed is the + * absolute value. Setting the value to INT_MAX indicates no limit. + * + * max_*_opts_len is the length limit in bytes of a Destination or + * Hop-by-Hop options extension header. Setting the value to INT_MAX + * indicates no length limit. + * + * If a limit is exceeded when processing an extension header the packet is + * silently discarded. + */ + +/* Default limits for Hop-by-Hop and Destination options */ +#define IP6_DEFAULT_MAX_DST_OPTS_CNT	 8 +#define IP6_DEFAULT_MAX_HBH_OPTS_CNT	 8 +#define IP6_DEFAULT_MAX_DST_OPTS_LEN	 INT_MAX /* No limit */ +#define IP6_DEFAULT_MAX_HBH_OPTS_LEN	 INT_MAX /* No limit */ +  /*   *	Addr type   *	 @@ -300,8 +340,8 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)  void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); -int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, -			       struct icmp6hdr *thdr, int len); +void icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, +				struct icmp6hdr *thdr, int len);  int ip6_ra_control(struct sock *sk, int sel); @@ -727,7 +767,7 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add  __be32 ipv6_select_ident(struct net *net,  			 const struct in6_addr *daddr,  			 const struct in6_addr *saddr); -void ipv6_proxy_select_ident(struct net *net, struct sk_buff *skb); +__be32 ipv6_proxy_select_ident(struct net *net, struct sk_buff *skb);  int ip6_dst_hoplimit(struct dst_entry *dst); diff --git a/include/net/ipx.h b/include/net/ipx.h index af32b97b5ddd..baf090390998 100644 --- a/include/net/ipx.h +++ b/include/net/ipx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_INET_IPX_H_  #define _NET_INET_IPX_H_  /* diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h index 714cc9a54a4c..070e93a17c59 100644 --- a/include/net/iucv/af_iucv.h +++ b/include/net/iucv/af_iucv.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright 2006 IBM Corporation   * IUCV protocol stack for Linux on zSeries diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h index b867b0cf79e8..f9e88401d7da 100644 --- a/include/net/iucv/iucv.h +++ b/include/net/iucv/iucv.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  drivers/s390/net/iucv.h   *    IUCV base support. diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index 2509728650bd..725282095840 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This file define the new driver API for Wireless Extensions   * diff --git a/include/net/lapb.h b/include/net/lapb.h index 85e773742f4e..ccc3d1f020b0 100644 --- a/include/net/lapb.h +++ b/include/net/lapb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LAPB_H  #define _LAPB_H   #include <linux/lapb.h> diff --git a/include/net/lib80211.h b/include/net/lib80211.h index aab0f427edb5..8b47d3a51cf8 100644 --- a/include/net/lib80211.h +++ b/include/net/lib80211.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * lib80211.h -- common bits for IEEE802.11 wireless drivers   * diff --git a/include/net/llc_c_ac.h b/include/net/llc_c_ac.h index f3be818e73c1..e766300b3e99 100644 --- a/include/net/llc_c_ac.h +++ b/include/net/llc_c_ac.h @@ -171,10 +171,10 @@ int llc_conn_ac_rst_sendack_flag(struct sock *sk, struct sk_buff *skb);  int llc_conn_ac_send_i_rsp_as_ack(struct sock *sk, struct sk_buff *skb);  int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb); -void llc_conn_busy_tmr_cb(unsigned long timeout_data); -void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data); -void llc_conn_ack_tmr_cb(unsigned long timeout_data); -void llc_conn_rej_tmr_cb(unsigned long timeout_data); +void llc_conn_busy_tmr_cb(struct timer_list *t); +void llc_conn_pf_cycle_tmr_cb(struct timer_list *t); +void llc_conn_ack_tmr_cb(struct timer_list *t); +void llc_conn_rej_tmr_cb(struct timer_list *t);  void llc_conn_set_p_flag(struct sock *sk, u8 value);  #endif /* LLC_C_AC_H */ diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h index 7c26863b8cf4..d747ef975cd8 100644 --- a/include/net/lwtunnel.h +++ b/include/net/lwtunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_LWTUNNEL_H  #define __NET_LWTUNNEL_H 1 diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 885690fa39c8..cc9073e45be9 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -5441,8 +5441,14 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,   */  void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn); +/** + * ieee80211_manage_rx_ba_offl - helper to queue an RX BA work + * @vif: &struct ieee80211_vif pointer from the add_interface callback + * @addr: station mac address + * @tid: the rx tid + */  void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif, const u8 *addr, -				 unsigned int bit); +				 unsigned int tid);  /**   * ieee80211_start_rx_ba_session_offl - start a Rx BA session diff --git a/include/net/mld.h b/include/net/mld.h index 01d751303498..b0f5b3105ef0 100644 --- a/include/net/mld.h +++ b/include/net/mld.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef LINUX_MLD_H  #define LINUX_MLD_H diff --git a/include/net/mrp.h b/include/net/mrp.h index 31912c3be772..ef58b4a07190 100644 --- a/include/net/mrp.h +++ b/include/net/mrp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_MRP_H  #define _NET_MRP_H diff --git a/include/net/ncsi.h b/include/net/ncsi.h index fdc60ff2511d..fbefe80361ee 100644 --- a/include/net/ncsi.h +++ b/include/net/ncsi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_NCSI_H  #define __NET_NCSI_H diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 31b1bb11ba3f..ddfbb591e2c5 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NDISC_H  #define _NDISC_H diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 9816df225af3..e421f86af043 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_NEIGHBOUR_H  #define _NET_NEIGHBOUR_H @@ -190,8 +191,8 @@ struct neigh_hash_table {  struct neigh_table {  	int			family; -	int			entry_size; -	int			key_len; +	unsigned int		entry_size; +	unsigned int		key_len;  	__be16			protocol;  	__u32			(*hash)(const void *pkey,  					const struct net_device *dev, diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 57faa375eab9..10f99dafd5ac 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Operations on the network namespace   */ diff --git a/include/net/net_ratelimit.h b/include/net/net_ratelimit.h index 7727b4247daf..93c1bd5133c2 100644 --- a/include/net/net_ratelimit.h +++ b/include/net/net_ratelimit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _LINUX_NET_RATELIMIT_H  #define _LINUX_NET_RATELIMIT_H diff --git a/include/net/netevent.h b/include/net/netevent.h index f440df172b56..40e7bab68490 100644 --- a/include/net/netevent.h +++ b/include/net/netevent.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_EVENT_H  #define _NET_EVENT_H @@ -25,6 +26,7 @@ enum netevent_notif_type {  	NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */  	NETEVENT_REDIRECT,	   /* arg is struct netevent_redirect ptr */  	NETEVENT_DELAY_PROBE_TIME_UPDATE, /* arg is struct neigh_parms ptr */ +	NETEVENT_MULTIPATH_HASH_UPDATE, /* arg is struct net ptr */  };  int register_netevent_notifier(struct notifier_block *nb); diff --git a/include/net/netfilter/br_netfilter.h b/include/net/netfilter/br_netfilter.h index 925524ede6c8..74af19c3a8f7 100644 --- a/include/net/netfilter/br_netfilter.h +++ b/include/net/netfilter/br_netfilter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _BR_NETFILTER_H_  #define _BR_NETFILTER_H_ diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h index 919e4e8af327..4ed1040bbe4a 100644 --- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h +++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * IPv4 support for nf_conntrack.   * @@ -10,7 +11,7 @@  #define _NF_CONNTRACK_IPV4_H -extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; +const extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;  extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;  extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4; diff --git a/include/net/netfilter/ipv4/nf_defrag_ipv4.h b/include/net/netfilter/ipv4/nf_defrag_ipv4.h index db405f70e538..bcbd724cc048 100644 --- a/include/net/netfilter/ipv4/nf_defrag_ipv4.h +++ b/include/net/netfilter/ipv4/nf_defrag_ipv4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_DEFRAG_IPV4_H  #define _NF_DEFRAG_IPV4_H diff --git a/include/net/netfilter/ipv4/nf_dup_ipv4.h b/include/net/netfilter/ipv4/nf_dup_ipv4.h index 0a14733e8b82..c962e0be3549 100644 --- a/include/net/netfilter/ipv4/nf_dup_ipv4.h +++ b/include/net/netfilter/ipv4/nf_dup_ipv4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_DUP_IPV4_H_  #define _NF_DUP_IPV4_H_ diff --git a/include/net/netfilter/ipv4/nf_nat_masquerade.h b/include/net/netfilter/ipv4/nf_nat_masquerade.h index a9c001c646da..ebd869473603 100644 --- a/include/net/netfilter/ipv4/nf_nat_masquerade.h +++ b/include/net/netfilter/ipv4/nf_nat_masquerade.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_NAT_MASQUERADE_IPV4_H_  #define _NF_NAT_MASQUERADE_IPV4_H_ diff --git a/include/net/netfilter/ipv4/nf_reject.h b/include/net/netfilter/ipv4/nf_reject.h index df7ecd806aba..2eb43fcefc50 100644 --- a/include/net/netfilter/ipv4/nf_reject.h +++ b/include/net/netfilter/ipv4/nf_reject.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IPV4_NF_REJECT_H  #define _IPV4_NF_REJECT_H diff --git a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h index 67edd50a398a..c86895bc5eb6 100644 --- a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h +++ b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * ICMPv6 tracking.   * diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h index eaea968f8657..9cd55be95853 100644 --- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h +++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h @@ -1,7 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_IPV6_H  #define _NF_CONNTRACK_IPV6_H -extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; +extern const struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;  extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;  extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6; diff --git a/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/include/net/netfilter/ipv6/nf_defrag_ipv6.h index 7664efe37974..9d7e28736da9 100644 --- a/include/net/netfilter/ipv6/nf_defrag_ipv6.h +++ b/include/net/netfilter/ipv6/nf_defrag_ipv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_DEFRAG_IPV6_H  #define _NF_DEFRAG_IPV6_H diff --git a/include/net/netfilter/ipv6/nf_dup_ipv6.h b/include/net/netfilter/ipv6/nf_dup_ipv6.h index fa6237b382a3..caf0c2dd8ee7 100644 --- a/include/net/netfilter/ipv6/nf_dup_ipv6.h +++ b/include/net/netfilter/ipv6/nf_dup_ipv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_DUP_IPV6_H_  #define _NF_DUP_IPV6_H_ diff --git a/include/net/netfilter/ipv6/nf_nat_masquerade.h b/include/net/netfilter/ipv6/nf_nat_masquerade.h index 0a13396cd390..1ed4f2631ed6 100644 --- a/include/net/netfilter/ipv6/nf_nat_masquerade.h +++ b/include/net/netfilter/ipv6/nf_nat_masquerade.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_NAT_MASQUERADE_IPV6_H_  #define _NF_NAT_MASQUERADE_IPV6_H_ diff --git a/include/net/netfilter/ipv6/nf_reject.h b/include/net/netfilter/ipv6/nf_reject.h index 0ea4fa37db16..3a5a9a36a0b2 100644 --- a/include/net/netfilter/ipv6/nf_reject.h +++ b/include/net/netfilter/ipv6/nf_reject.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _IPV6_NF_REJECT_H  #define _IPV6_NF_REJECT_H diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 8f3bd30511de..f5223bf2c420 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Connection state tracking for netfilter.  This is separated from,   * but required by, the (future) NAT layer; it can also be used by an iptables @@ -284,7 +285,7 @@ static inline bool nf_ct_should_gc(const struct nf_conn *ct)  struct kernel_param; -int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); +int nf_conntrack_set_hashsize(const char *val, const struct kernel_param *kp);  int nf_conntrack_hash_resize(unsigned int hashsize);  extern struct hlist_nulls_head *nf_conntrack_hash; diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 81d7f8a30945..9b5e7634713e 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header is used to share core functionality between the   * standalone connection tracking module, and the compatibility layer's use diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 2a10c6570fcc..3f1ce9a8776e 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * connection tracking event cache.   */ diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index 818def011110..006e430d1cdf 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * connection tracking expectations.   */ diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index 4944bc9153cf..21f887c5058c 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_EXTEND_H  #define _NF_CONNTRACK_EXTEND_H diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index c519bb5b5bb8..fc39bbaf107c 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * connection tracking helpers.   * diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index 6269deecbee7..d5808f3e2715 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Copyright (C)2003,2004 USAGI/WIDE Project   * diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index 738a0307a96b..7ef56c13698a 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Header for use in defining a given L4 protocol for connection tracking.   * @@ -42,7 +43,6 @@ struct nf_conntrack_l4proto {  		      const struct sk_buff *skb,  		      unsigned int dataoff,  		      enum ip_conntrack_info ctinfo, -		      u_int8_t pf,  		      unsigned int *timeouts);  	/* Called when a new connection for this protocol found; @@ -75,7 +75,7 @@ struct nf_conntrack_l4proto {  	int (*tuple_to_nlattr)(struct sk_buff *skb,  			       const struct nf_conntrack_tuple *t);  	/* Calculate tuple nlattr size */ -	int (*nlattr_tuple_size)(void); +	unsigned int (*nlattr_tuple_size)(void);  	int (*nlattr_to_tuple)(struct nlattr *tb[],  			       struct nf_conntrack_tuple *t);  	const struct nla_policy *nla_policy; @@ -145,15 +145,27 @@ int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,  			       const struct nf_conntrack_tuple *tuple);  int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],  			       struct nf_conntrack_tuple *t); -int nf_ct_port_nlattr_tuple_size(void); +unsigned int nf_ct_port_nlattr_tuple_size(void);  extern const struct nla_policy nf_ct_port_nla_policy[];  #ifdef CONFIG_SYSCTL -#define LOG_INVALID(net, proto)				\ -	((net)->ct.sysctl_log_invalid == (proto) ||	\ -	 (net)->ct.sysctl_log_invalid == IPPROTO_RAW) +__printf(3, 4) __cold +void nf_ct_l4proto_log_invalid(const struct sk_buff *skb, +			       const struct nf_conn *ct, +			       const char *fmt, ...); +__printf(5, 6) __cold +void nf_l4proto_log_invalid(const struct sk_buff *skb, +			    struct net *net, +			    u16 pf, u8 protonum, +			    const char *fmt, ...);  #else -static inline int LOG_INVALID(struct net *net, int proto) { return 0; } +static inline __printf(5, 6) __cold +void nf_l4proto_log_invalid(const struct sk_buff *skb, struct net *net, +			    u16 pf, u8 protonum, const char *fmt, ...) {} +static inline __printf(3, 4) __cold +void nf_ct_l4proto_log_invalid(const struct sk_buff *skb, +			       const struct nf_conn *ct, +			       const char *fmt, ...) { }  #endif /* CONFIG_SYSCTL */  #endif /*_NF_CONNTRACK_PROTOCOL_H*/ diff --git a/include/net/netfilter/nf_conntrack_labels.h b/include/net/netfilter/nf_conntrack_labels.h index 1723a67c0b0a..4eacce6f3bcc 100644 --- a/include/net/netfilter/nf_conntrack_labels.h +++ b/include/net/netfilter/nf_conntrack_labels.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <linux/types.h>  #include <net/net_namespace.h>  #include <linux/netfilter/nf_conntrack_common.h> diff --git a/include/net/netfilter/nf_conntrack_seqadj.h b/include/net/netfilter/nf_conntrack_seqadj.h index 4b3362991a25..0a10b50537ae 100644 --- a/include/net/netfilter/nf_conntrack_seqadj.h +++ b/include/net/netfilter/nf_conntrack_seqadj.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_SEQADJ_H  #define _NF_CONNTRACK_SEQADJ_H diff --git a/include/net/netfilter/nf_conntrack_synproxy.h b/include/net/netfilter/nf_conntrack_synproxy.h index a2fcb5271726..2c7559a54092 100644 --- a/include/net/netfilter/nf_conntrack_synproxy.h +++ b/include/net/netfilter/nf_conntrack_synproxy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_SYNPROXY_H  #define _NF_CONNTRACK_SYNPROXY_H diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h index 483d104fa254..9468ab4ad12d 100644 --- a/include/net/netfilter/nf_conntrack_timeout.h +++ b/include/net/netfilter/nf_conntrack_timeout.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_TIMEOUT_H  #define _NF_CONNTRACK_TIMEOUT_H diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h index 300ae2209f25..3b661986be8f 100644 --- a/include/net/netfilter/nf_conntrack_timestamp.h +++ b/include/net/netfilter/nf_conntrack_timestamp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_TSTAMP_H  #define _NF_CONNTRACK_TSTAMP_H diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index aea3f8221be0..bf0444e111a6 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Definitions and Declarations for tuple.   * diff --git a/include/net/netfilter/nf_conntrack_zones.h b/include/net/netfilter/nf_conntrack_zones.h index 64a718b60839..52950baa3ab5 100644 --- a/include/net/netfilter/nf_conntrack_zones.h +++ b/include/net/netfilter/nf_conntrack_zones.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_CONNTRACK_ZONES_H  #define _NF_CONNTRACK_ZONES_H diff --git a/include/net/netfilter/nf_dup_netdev.h b/include/net/netfilter/nf_dup_netdev.h index 3e919356bedf..2a6f6dcad3d9 100644 --- a/include/net/netfilter/nf_dup_netdev.h +++ b/include/net/netfilter/nf_dup_netdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_DUP_NETDEV_H_  #define _NF_DUP_NETDEV_H_ diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h index 42e0696f38d8..e811ac07ea94 100644 --- a/include/net/netfilter/nf_log.h +++ b/include/net/netfilter/nf_log.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_LOG_H  #define _NF_LOG_H diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index b71701302e61..207a467e7ca6 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_NAT_H  #define _NF_NAT_H  #include <linux/netfilter_ipv4.h> diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h index 186c54138f35..235bd0e9a5aa 100644 --- a/include/net/netfilter/nf_nat_core.h +++ b/include/net/netfilter/nf_nat_core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_NAT_CORE_H  #define _NF_NAT_CORE_H  #include <linux/list.h> diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h index fbfa5acf4f14..97d7033e93a4 100644 --- a/include/net/netfilter/nf_nat_helper.h +++ b/include/net/netfilter/nf_nat_helper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_NAT_HELPER_H  #define _NF_NAT_HELPER_H  /* NAT protocol helper routines. */ diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h index aef3e5fc9fd9..ce7c2b4e64bb 100644 --- a/include/net/netfilter/nf_nat_l3proto.h +++ b/include/net/netfilter/nf_nat_l3proto.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_NAT_L3PROTO_H  #define _NF_NAT_L3PROTO_H diff --git a/include/net/netfilter/nf_nat_l4proto.h b/include/net/netfilter/nf_nat_l4proto.h index 3923150f2a1e..67835ff8a2d9 100644 --- a/include/net/netfilter/nf_nat_l4proto.h +++ b/include/net/netfilter/nf_nat_l4proto.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Header for use in defining a given protocol. */  #ifndef _NF_NAT_L4PROTO_H  #define _NF_NAT_L4PROTO_H diff --git a/include/net/netfilter/nf_nat_redirect.h b/include/net/netfilter/nf_nat_redirect.h index 73b729543309..5ddabb08c472 100644 --- a/include/net/netfilter/nf_nat_redirect.h +++ b/include/net/netfilter/nf_nat_redirect.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_NAT_REDIRECT_H_  #define _NF_NAT_REDIRECT_H_ diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index 39468720fc19..814058d0f167 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_QUEUE_H  #define _NF_QUEUE_H diff --git a/include/net/netfilter/nf_socket.h b/include/net/netfilter/nf_socket.h index f2fc39c97d43..8230fefff9f5 100644 --- a/include/net/netfilter/nf_socket.h +++ b/include/net/netfilter/nf_socket.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_SOCK_H_  #define _NF_SOCK_H_ diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 0f5b12a4ad09..fecc6112c768 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_NF_TABLES_H  #define _NET_NF_TABLES_H @@ -311,6 +312,7 @@ struct nft_expr;   *	@flush: deactivate element in the next generation   *	@remove: remove element from set   *	@walk: iterate over all set elemeennts + *	@get: get set elements   *	@privsize: function to return size of set private data   *	@init: initialize private data of new set instance   *	@destroy: destroy private data of set instance @@ -350,6 +352,10 @@ struct nft_set_ops {  	void				(*walk)(const struct nft_ctx *ctx,  						struct nft_set *set,  						struct nft_set_iter *iter); +	void *				(*get)(const struct net *net, +					       const struct nft_set *set, +					       const struct nft_set_elem *elem, +					       unsigned int flags);  	unsigned int			(*privsize)(const struct nlattr * const nla[],  						    const struct nft_set_desc *desc); @@ -1164,8 +1170,8 @@ static inline u8 nft_genmask_next(const struct net *net)  static inline u8 nft_genmask_cur(const struct net *net)  { -	/* Use ACCESS_ONCE() to prevent refetching the value for atomicity */ -	return 1 << ACCESS_ONCE(net->nft.gencursor); +	/* Use READ_ONCE() to prevent refetching the value for atomicity */ +	return 1 << READ_ONCE(net->nft.gencursor);  }  #define NFT_GENMASK_ANY		((1 << 0) | (1 << 1)) diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h index 424684c33771..ea5aab568be8 100644 --- a/include/net/netfilter/nf_tables_core.h +++ b/include/net/netfilter/nf_tables_core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_NF_TABLES_CORE_H  #define _NET_NF_TABLES_CORE_H diff --git a/include/net/netfilter/nf_tables_ipv4.h b/include/net/netfilter/nf_tables_ipv4.h index 25e33aee91e7..f0896ba456c4 100644 --- a/include/net/netfilter/nf_tables_ipv4.h +++ b/include/net/netfilter/nf_tables_ipv4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_TABLES_IPV4_H_  #define _NF_TABLES_IPV4_H_ diff --git a/include/net/netfilter/nf_tables_ipv6.h b/include/net/netfilter/nf_tables_ipv6.h index 97983d1c05e4..b8065b72f56e 100644 --- a/include/net/netfilter/nf_tables_ipv6.h +++ b/include/net/netfilter/nf_tables_ipv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NF_TABLES_IPV6_H_  #define _NF_TABLES_IPV6_H_ diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h index 5ca3f14f0998..612cfb63ac68 100644 --- a/include/net/netfilter/nfnetlink_log.h +++ b/include/net/netfilter/nfnetlink_log.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _KER_NFNETLINK_LOG_H  #define _KER_NFNETLINK_LOG_H diff --git a/include/net/netfilter/nft_dup.h b/include/net/netfilter/nft_dup.h index 6b84cf6491a2..4d9d512984b2 100644 --- a/include/net/netfilter/nft_dup.h +++ b/include/net/netfilter/nft_dup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFT_DUP_H_  #define _NFT_DUP_H_ diff --git a/include/net/netfilter/nft_fib.h b/include/net/netfilter/nft_fib.h index 381af9469e6a..a88f92737308 100644 --- a/include/net/netfilter/nft_fib.h +++ b/include/net/netfilter/nft_fib.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFT_FIB_H_  #define _NFT_FIB_H_ diff --git a/include/net/netfilter/nft_masq.h b/include/net/netfilter/nft_masq.h index a3f3c11b2526..e51ab3815797 100644 --- a/include/net/netfilter/nft_masq.h +++ b/include/net/netfilter/nft_masq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFT_MASQ_H_  #define _NFT_MASQ_H_ diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h index 1139cde0fdc5..5c69e9b09388 100644 --- a/include/net/netfilter/nft_meta.h +++ b/include/net/netfilter/nft_meta.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFT_META_H_  #define _NFT_META_H_ diff --git a/include/net/netfilter/nft_redir.h b/include/net/netfilter/nft_redir.h index a2d67546afab..4a970737c03c 100644 --- a/include/net/netfilter/nft_redir.h +++ b/include/net/netfilter/nft_redir.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFT_REDIR_H_  #define _NFT_REDIR_H_ diff --git a/include/net/netfilter/nft_reject.h b/include/net/netfilter/nft_reject.h index 02e28c529b29..de80c50761f0 100644 --- a/include/net/netfilter/nft_reject.h +++ b/include/net/netfilter/nft_reject.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NFT_REJECT_H_  #define _NFT_REJECT_H_ diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h index 130e58361f99..b1db13772554 100644 --- a/include/net/netfilter/xt_rateest.h +++ b/include/net/netfilter/xt_rateest.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XT_RATEEST_H  #define _XT_RATEEST_H diff --git a/include/net/netlink.h b/include/net/netlink.h index 14c289393071..0c154f98e987 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_NETLINK_H  #define __NET_NETLINK_H diff --git a/include/net/netns/can.h b/include/net/netns/can.h index b106e6ae2e5b..ecf238b8862c 100644 --- a/include/net/netns/can.h +++ b/include/net/netns/can.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * can in net namespaces   */ diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index 17724c62de97..9795d628a127 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NETNS_CONNTRACK_H  #define __NETNS_CONNTRACK_H diff --git a/include/net/netns/core.h b/include/net/netns/core.h index 78eb1ff75475..0ad4d0c71228 100644 --- a/include/net/netns/core.h +++ b/include/net/netns/core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NETNS_CORE_H__  #define __NETNS_CORE_H__ diff --git a/include/net/netns/dccp.h b/include/net/netns/dccp.h index 98d2a7ce1f71..cdbc4f5b8390 100644 --- a/include/net/netns/dccp.h +++ b/include/net/netns/dccp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NETNS_DCCP_H__  #define __NETNS_DCCP_H__ diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h index f15daaa89385..8a1ab47c3fb3 100644 --- a/include/net/netns/generic.h +++ b/include/net/netns/generic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * generic net pointers   */ diff --git a/include/net/netns/hash.h b/include/net/netns/hash.h index 69a6715d9f3f..24c78183a4c2 100644 --- a/include/net/netns/hash.h +++ b/include/net/netns/hash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_NS_HASH_H__  #define __NET_NS_HASH_H__ diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h index 8170f8d7052b..736aeac52f56 100644 --- a/include/net/netns/ieee802154_6lowpan.h +++ b/include/net/netns/ieee802154_6lowpan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * ieee802154 6lowpan in net namespaces   */ diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 20d061c805e3..44668c29701a 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * ipv4 in net namespaces   */ @@ -36,6 +37,8 @@ struct inet_timewait_death_row {  	int			sysctl_max_tw_buckets;  }; +struct tcp_fastopen_context; +  struct netns_ipv4 {  #ifdef CONFIG_SYSCTL  	struct ctl_table_header	*forw_hdr; @@ -52,6 +55,7 @@ struct netns_ipv4 {  	struct fib_table __rcu	*fib_main;  	struct fib_table __rcu	*fib_default;  #endif +	bool			fib_has_custom_local_routes;  #ifdef CONFIG_IP_ROUTE_CLASSID  	int			fib_num_tclassid_users;  #endif @@ -125,8 +129,43 @@ struct netns_ipv4 {  	int sysctl_tcp_sack;  	int sysctl_tcp_window_scaling;  	int sysctl_tcp_timestamps; +	int sysctl_tcp_early_retrans; +	int sysctl_tcp_recovery; +	int sysctl_tcp_thin_linear_timeouts; +	int sysctl_tcp_slow_start_after_idle; +	int sysctl_tcp_retrans_collapse; +	int sysctl_tcp_stdurg; +	int sysctl_tcp_rfc1337; +	int sysctl_tcp_abort_on_overflow; +	int sysctl_tcp_fack; +	int sysctl_tcp_max_reordering; +	int sysctl_tcp_dsack; +	int sysctl_tcp_app_win; +	int sysctl_tcp_adv_win_scale; +	int sysctl_tcp_frto; +	int sysctl_tcp_nometrics_save; +	int sysctl_tcp_moderate_rcvbuf; +	int sysctl_tcp_tso_win_divisor; +	int sysctl_tcp_workaround_signed_windows; +	int sysctl_tcp_limit_output_bytes; +	int sysctl_tcp_challenge_ack_limit; +	int sysctl_tcp_min_tso_segs; +	int sysctl_tcp_min_rtt_wlen; +	int sysctl_tcp_autocorking; +	int sysctl_tcp_invalid_ratelimit; +	int sysctl_tcp_pacing_ss_ratio; +	int sysctl_tcp_pacing_ca_ratio; +	int sysctl_tcp_wmem[3]; +	int sysctl_tcp_rmem[3];  	struct inet_timewait_death_row tcp_death_row;  	int sysctl_max_syn_backlog; +	int sysctl_tcp_fastopen; +	const struct tcp_congestion_ops __rcu  *tcp_congestion_control; +	struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; +	spinlock_t tcp_fastopen_ctx_lock; +	unsigned int sysctl_tcp_fastopen_blackhole_timeout; +	atomic_t tfo_active_disable_times; +	unsigned long tfo_active_disable_stamp;  #ifdef CONFIG_NET_L3_MASTER_DEV  	int sysctl_udp_l3mdev_accept; @@ -162,6 +201,9 @@ struct netns_ipv4 {  	struct fib_notifier_ops	*notifier_ops;  	unsigned int	fib_seq;	/* protected by rtnl_mutex */ +	struct fib_notifier_ops	*ipmr_notifier_ops; +	unsigned int	ipmr_seq;	/* protected by rtnl_mutex */ +  	atomic_t	rt_genid;  };  #endif diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 2544f9760a42..987cc4569cb8 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * ipv6 in net namespaces   */ @@ -37,6 +38,10 @@ struct netns_sysctl_ipv6 {  	int idgen_delay;  	int flowlabel_state_ranges;  	int flowlabel_reflect; +	int max_dst_opts_cnt; +	int max_hbh_opts_cnt; +	int max_dst_opts_len; +	int max_hbh_opts_len;  };  struct netns_ipv6 { @@ -89,6 +94,11 @@ struct netns_ipv6 {  	atomic_t		fib6_sernum;  	struct seg6_pernet_data *seg6_data;  	struct fib_notifier_ops	*notifier_ops; +	struct { +		struct hlist_head head; +		spinlock_t	lock; +		u32		seq; +	} ip6addrlbl_table;  };  #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h index d542a4b28cca..830bdf345b17 100644 --- a/include/net/netns/mib.h +++ b/include/net/netns/mib.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NETNS_MIB_H__  #define __NETNS_MIB_H__ diff --git a/include/net/netns/mpls.h b/include/net/netns/mpls.h index 6608b3693385..a7bdcfbb0b28 100644 --- a/include/net/netns/mpls.h +++ b/include/net/netns/mpls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * mpls in net namespaces   */ diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h index 72d66c8763d0..cc00af2ac2d7 100644 --- a/include/net/netns/netfilter.h +++ b/include/net/netns/netfilter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NETNS_NETFILTER_H  #define __NETNS_NETFILTER_H diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h index c80781146019..4109b5f3010f 100644 --- a/include/net/netns/nftables.h +++ b/include/net/netns/nftables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NETNS_NFTABLES_H_  #define _NETNS_NFTABLES_H_ diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h index 17ec2b95c062..aae69bb43cde 100644 --- a/include/net/netns/packet.h +++ b/include/net/netns/packet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Packet network namespace   */ diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h index b7871d018354..ebc813277662 100644 --- a/include/net/netns/sctp.h +++ b/include/net/netns/sctp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NETNS_SCTP_H__  #define __NETNS_SCTP_H__ diff --git a/include/net/netns/unix.h b/include/net/netns/unix.h index 284649d4dfb4..91a3d7e39198 100644 --- a/include/net/netns/unix.h +++ b/include/net/netns/unix.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Unix network namespace   */ diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h index c8a7681efa6a..9bc5a12fdbb0 100644 --- a/include/net/netns/x_tables.h +++ b/include/net/netns/x_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NETNS_X_TABLES_H  #define __NETNS_X_TABLES_H diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h index 611521646dd4..9991e5ef52cc 100644 --- a/include/net/netns/xfrm.h +++ b/include/net/netns/xfrm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NETNS_XFRM_H  #define __NETNS_XFRM_H diff --git a/include/net/netrom.h b/include/net/netrom.h index 443a4ffca7aa..0dad2dd5f9d7 100644 --- a/include/net/netrom.h +++ b/include/net/netrom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Declarations of NET/ROM type objects.   * diff --git a/include/net/nexthop.h b/include/net/nexthop.h index 3334dbfa5aa4..36bb794f5cd6 100644 --- a/include/net/nexthop.h +++ b/include/net/nexthop.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_NEXTHOP_H  #define __NET_NEXTHOP_H diff --git a/include/net/nsh.h b/include/net/nsh.h index a1eaea20be96..350b1ad11c7f 100644 --- a/include/net/nsh.h +++ b/include/net/nsh.h @@ -304,4 +304,7 @@ static inline void nsh_set_flags_ttl_len(struct nshhdr *nsh, u8 flags,  			NSH_FLAGS_MASK | NSH_TTL_MASK | NSH_LEN_MASK);  } +int nsh_push(struct sk_buff *skb, const struct nshhdr *pushed_nh); +int nsh_pop(struct sk_buff *skb); +  #endif /* __NET_NSH_H */ diff --git a/include/net/p8022.h b/include/net/p8022.h index 05e41383856b..c2bacc66bfbc 100644 --- a/include/net/p8022.h +++ b/include/net/p8022.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_P8022_H  #define _NET_P8022_H  struct datalink_proto * diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h index 039cc29cb4a8..51e1a2a45d02 100644 --- a/include/net/phonet/phonet.h +++ b/include/net/phonet/phonet.h @@ -108,8 +108,10 @@ struct phonet_protocol {  	int			sock_type;  }; -int phonet_proto_register(unsigned int protocol, struct phonet_protocol *pp); -void phonet_proto_unregister(unsigned int protocol, struct phonet_protocol *pp); +int phonet_proto_register(unsigned int protocol, +		const struct phonet_protocol *pp); +void phonet_proto_unregister(unsigned int protocol, +		const struct phonet_protocol *pp);  int phonet_sysctl_init(void);  void phonet_sysctl_exit(void); diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index e80edd8879ef..0105445cab83 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -1,7 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_PKT_CLS_H  #define __NET_PKT_CLS_H  #include <linux/pkt_cls.h> +#include <linux/workqueue.h>  #include <net/sch_generic.h>  #include <net/act_api.h> @@ -17,20 +19,72 @@ struct tcf_walker {  int register_tcf_proto_ops(struct tcf_proto_ops *ops);  int unregister_tcf_proto_ops(struct tcf_proto_ops *ops); +enum tcf_block_binder_type { +	TCF_BLOCK_BINDER_TYPE_UNSPEC, +	TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS, +	TCF_BLOCK_BINDER_TYPE_CLSACT_EGRESS, +}; + +struct tcf_block_ext_info { +	enum tcf_block_binder_type binder_type; +	tcf_chain_head_change_t *chain_head_change; +	void *chain_head_change_priv; +}; + +struct tcf_block_cb; +bool tcf_queue_work(struct work_struct *work); +  #ifdef CONFIG_NET_CLS  struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,  				bool create);  void tcf_chain_put(struct tcf_chain *chain);  int tcf_block_get(struct tcf_block **p_block, -		  struct tcf_proto __rcu **p_filter_chain); +		  struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q); +int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q, +		      struct tcf_block_ext_info *ei);  void tcf_block_put(struct tcf_block *block); +void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q, +		       struct tcf_block_ext_info *ei); + +static inline struct Qdisc *tcf_block_q(struct tcf_block *block) +{ +	return block->q; +} + +static inline struct net_device *tcf_block_dev(struct tcf_block *block) +{ +	return tcf_block_q(block)->dev_queue->dev; +} + +void *tcf_block_cb_priv(struct tcf_block_cb *block_cb); +struct tcf_block_cb *tcf_block_cb_lookup(struct tcf_block *block, +					 tc_setup_cb_t *cb, void *cb_ident); +void tcf_block_cb_incref(struct tcf_block_cb *block_cb); +unsigned int tcf_block_cb_decref(struct tcf_block_cb *block_cb); +struct tcf_block_cb *__tcf_block_cb_register(struct tcf_block *block, +					     tc_setup_cb_t *cb, void *cb_ident, +					     void *cb_priv); +int tcf_block_cb_register(struct tcf_block *block, +			  tc_setup_cb_t *cb, void *cb_ident, +			  void *cb_priv); +void __tcf_block_cb_unregister(struct tcf_block_cb *block_cb); +void tcf_block_cb_unregister(struct tcf_block *block, +			     tc_setup_cb_t *cb, void *cb_ident); +  int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,  		 struct tcf_result *res, bool compat_mode);  #else  static inline  int tcf_block_get(struct tcf_block **p_block, -		  struct tcf_proto __rcu **p_filter_chain) +		  struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q) +{ +	return 0; +} + +static inline +int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q, +		      struct tcf_block_ext_info *ei)  {  	return 0;  } @@ -39,6 +93,86 @@ static inline void tcf_block_put(struct tcf_block *block)  {  } +static inline +void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q, +		       struct tcf_block_ext_info *ei) +{ +} + +static inline struct Qdisc *tcf_block_q(struct tcf_block *block) +{ +	return NULL; +} + +static inline struct net_device *tcf_block_dev(struct tcf_block *block) +{ +	return NULL; +} + +static inline +int tc_setup_cb_block_register(struct tcf_block *block, tc_setup_cb_t *cb, +			       void *cb_priv) +{ +	return 0; +} + +static inline +void tc_setup_cb_block_unregister(struct tcf_block *block, tc_setup_cb_t *cb, +				  void *cb_priv) +{ +} + +static inline +void *tcf_block_cb_priv(struct tcf_block_cb *block_cb) +{ +	return NULL; +} + +static inline +struct tcf_block_cb *tcf_block_cb_lookup(struct tcf_block *block, +					 tc_setup_cb_t *cb, void *cb_ident) +{ +	return NULL; +} + +static inline +void tcf_block_cb_incref(struct tcf_block_cb *block_cb) +{ +} + +static inline +unsigned int tcf_block_cb_decref(struct tcf_block_cb *block_cb) +{ +	return 0; +} + +static inline +struct tcf_block_cb *__tcf_block_cb_register(struct tcf_block *block, +					     tc_setup_cb_t *cb, void *cb_ident, +					     void *cb_priv) +{ +	return NULL; +} + +static inline +int tcf_block_cb_register(struct tcf_block *block, +			  tc_setup_cb_t *cb, void *cb_ident, +			  void *cb_priv) +{ +	return 0; +} + +static inline +void __tcf_block_cb_unregister(struct tcf_block_cb *block_cb) +{ +} + +static inline +void tcf_block_cb_unregister(struct tcf_block *block, +			     tc_setup_cb_t *cb, void *cb_ident) +{ +} +  static inline int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,  			       struct tcf_result *res, bool compat_mode)  { @@ -53,36 +187,43 @@ __cls_set_class(unsigned long *clp, unsigned long cl)  }  static inline unsigned long -cls_set_class(struct tcf_proto *tp, unsigned long *clp,  -	unsigned long cl) +cls_set_class(struct Qdisc *q, unsigned long *clp, unsigned long cl)  {  	unsigned long old_cl; -	 -	tcf_tree_lock(tp); + +	sch_tree_lock(q);  	old_cl = __cls_set_class(clp, cl); -	tcf_tree_unlock(tp); -  +	sch_tree_unlock(q);  	return old_cl;  }  static inline void  tcf_bind_filter(struct tcf_proto *tp, struct tcf_result *r, unsigned long base)  { +	struct Qdisc *q = tp->chain->block->q;  	unsigned long cl; -	cl = tp->q->ops->cl_ops->bind_tcf(tp->q, base, r->classid); -	cl = cls_set_class(tp, &r->class, cl); +	/* Check q as it is not set for shared blocks. In that case, +	 * setting class is not supported. +	 */ +	if (!q) +		return; +	cl = q->ops->cl_ops->bind_tcf(q, base, r->classid); +	cl = cls_set_class(q, &r->class, cl);  	if (cl) -		tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); +		q->ops->cl_ops->unbind_tcf(q, cl);  }  static inline void  tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r)  { +	struct Qdisc *q = tp->chain->block->q;  	unsigned long cl; +	if (!q) +		return;  	if ((cl = __cls_set_class(&r->class, 0)) != 0) -		tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); +		q->ops->cl_ops->unbind_tcf(q, cl);  }  struct tcf_exts { @@ -90,6 +231,7 @@ struct tcf_exts {  	__u32	type; /* for backward compat(TCA_OLD_COMPAT) */  	int nr_actions;  	struct tc_action **actions; +	struct net *net;  #endif  	/* Map to export classifier specific extension TLV types to the  	 * generic extensions API. Unsupported extensions must be set to 0. @@ -103,6 +245,7 @@ static inline int tcf_exts_init(struct tcf_exts *exts, int action, int police)  #ifdef CONFIG_NET_CLS_ACT  	exts->type = 0;  	exts->nr_actions = 0; +	exts->net = NULL;  	exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *),  				GFP_KERNEL);  	if (!exts->actions) @@ -113,6 +256,28 @@ static inline int tcf_exts_init(struct tcf_exts *exts, int action, int police)  	return 0;  } +/* Return false if the netns is being destroyed in cleanup_net(). Callers + * need to do cleanup synchronously in this case, otherwise may race with + * tc_action_net_exit(). Return true for other cases. + */ +static inline bool tcf_exts_get_net(struct tcf_exts *exts) +{ +#ifdef CONFIG_NET_CLS_ACT +	exts->net = maybe_get_net(exts->net); +	return exts->net != NULL; +#else +	return true; +#endif +} + +static inline void tcf_exts_put_net(struct tcf_exts *exts) +{ +#ifdef CONFIG_NET_CLS_ACT +	if (exts->net) +		put_net(exts->net); +#endif +} +  static inline void tcf_exts_to_list(const struct tcf_exts *exts,  				    struct list_head *actions)  { @@ -204,8 +369,6 @@ void tcf_exts_destroy(struct tcf_exts *exts);  void tcf_exts_change(struct tcf_exts *dst, struct tcf_exts *src);  int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts);  int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts); -int tcf_exts_get_dev(struct net_device *dev, struct tcf_exts *exts, -		     struct net_device **hw_dev);  /**   * struct tcf_pkt_info - packet information @@ -405,11 +568,24 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)  }  #endif /* CONFIG_NET_CLS_IND */ +int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts, +		     enum tc_setup_type type, void *type_data, bool err_stop); + +enum tc_block_command { +	TC_BLOCK_BIND, +	TC_BLOCK_UNBIND, +}; + +struct tc_block_offload { +	enum tc_block_command command; +	enum tcf_block_binder_type binder_type; +	struct tcf_block *block; +}; +  struct tc_cls_common_offload {  	u32 chain_index;  	__be16 protocol;  	u32 prio; -	u32 classid;  };  static inline void @@ -419,7 +595,6 @@ tc_cls_common_offload_init(struct tc_cls_common_offload *cls_common,  	cls_common->chain_index = tp->chain->index;  	cls_common->protocol = tp->protocol;  	cls_common->prio = tp->prio; -	cls_common->classid = tp->classid;  }  struct tc_cls_u32_knode { @@ -459,11 +634,7 @@ struct tc_cls_u32_offload {  static inline bool tc_can_offload(const struct net_device *dev)  { -	if (!(dev->features & NETIF_F_HW_TC)) -		return false; -	if (!dev->netdev_ops->ndo_setup_tc) -		return false; -	return true; +	return dev->features & NETIF_F_HW_TC;  }  static inline bool tc_skip_hw(u32 flags) @@ -471,13 +642,6 @@ static inline bool tc_skip_hw(u32 flags)  	return (flags & TCA_CLS_FLAGS_SKIP_HW) ? true : false;  } -static inline bool tc_should_offload(const struct net_device *dev, u32 flags) -{ -	if (tc_skip_hw(flags)) -		return false; -	return tc_can_offload(dev); -} -  static inline bool tc_skip_sw(u32 flags)  {  	return (flags & TCA_CLS_FLAGS_SKIP_SW) ? true : false; @@ -514,7 +678,7 @@ struct tc_cls_flower_offload {  	struct fl_flow_key *mask;  	struct fl_flow_key *key;  	struct tcf_exts *exts; -	bool egress_dev; +	u32 classid;  };  enum tc_matchall_command { @@ -546,6 +710,15 @@ struct tc_cls_bpf_offload {  	u32 gen_flags;  }; +struct tc_mqprio_qopt_offload { +	/* struct tc_mqprio_qopt must always be the first element */ +	struct tc_mqprio_qopt qopt; +	u16 mode; +	u16 shaper; +	u32 flags; +	u64 min_rate[TC_QOPT_MAX_QUEUE]; +	u64 max_rate[TC_QOPT_MAX_QUEUE]; +};  /* This structure holds cookie structure that is passed from user   * to the kernel for actions and classifiers @@ -554,4 +727,34 @@ struct tc_cookie {  	u8  *data;  	u32 len;  }; + +enum tc_red_command { +	TC_RED_REPLACE, +	TC_RED_DESTROY, +	TC_RED_STATS, +	TC_RED_XSTATS, +}; + +struct tc_red_qopt_offload_params { +	u32 min; +	u32 max; +	u32 probability; +	bool is_ecn; +}; +struct tc_red_qopt_offload_stats { +	struct gnet_stats_basic_packed *bstats; +	struct gnet_stats_queue *qstats; +}; + +struct tc_red_qopt_offload { +	enum tc_red_command command; +	u32 handle; +	u32 parent; +	union { +		struct tc_red_qopt_offload_params set; +		struct tc_red_qopt_offload_stats stats; +		struct red_stats *xstats; +	}; +}; +  #endif diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 259bc191ba59..d1f413f06c72 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -1,10 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_PKT_SCHED_H  #define __NET_PKT_SCHED_H  #include <linux/jiffies.h>  #include <linux/ktime.h>  #include <linux/if_vlan.h> +#include <linux/netdevice.h>  #include <net/sch_generic.h> +#include <net/net_namespace.h>  #include <uapi/linux/pkt_sched.h>  #define DEFAULT_TX_QUEUE_LEN	1000 @@ -133,17 +136,18 @@ static inline unsigned int psched_mtu(const struct net_device *dev)  	return dev->mtu + dev->hard_header_len;  } -static inline bool is_classid_clsact_ingress(u32 classid) +static inline struct net *qdisc_net(struct Qdisc *q)  { -	/* This also returns true for ingress qdisc */ -	return TC_H_MAJ(classid) == TC_H_MAJ(TC_H_CLSACT) && -	       TC_H_MIN(classid) != TC_H_MIN(TC_H_MIN_EGRESS); +	return dev_net(q->dev_queue->dev);  } -static inline bool is_classid_clsact_egress(u32 classid) -{ -	return TC_H_MAJ(classid) == TC_H_MAJ(TC_H_CLSACT) && -	       TC_H_MIN(classid) == TC_H_MIN(TC_H_MIN_EGRESS); -} +struct tc_cbs_qopt_offload { +	u8 enable; +	s32 queue; +	s32 hicredit; +	s32 locredit; +	s32 idleslope; +	s32 sendslope; +};  #endif diff --git a/include/net/pptp.h b/include/net/pptp.h index 92e9f1fe2628..383e25ca53a7 100644 --- a/include/net/pptp.h +++ b/include/net/pptp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_PPTP_H  #define _NET_PPTP_H diff --git a/include/net/psample.h b/include/net/psample.h index 8888b0e1a82e..9b80f814ab04 100644 --- a/include/net/psample.h +++ b/include/net/psample.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_PSAMPLE_H  #define __NET_PSAMPLE_H diff --git a/include/net/psnap.h b/include/net/psnap.h index 78db4cc1306a..7cb0c8ab4171 100644 --- a/include/net/psnap.h +++ b/include/net/psnap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_PSNAP_H  #define _NET_PSNAP_H diff --git a/include/net/rawv6.h b/include/net/rawv6.h index 4addc5c988e0..53d86b6055e8 100644 --- a/include/net/rawv6.h +++ b/include/net/rawv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_RAWV6_H  #define _NET_RAWV6_H diff --git a/include/net/red.h b/include/net/red.h index 208e718e16b9..9a9347710701 100644 --- a/include/net/red.h +++ b/include/net/red.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_SCHED_RED_H  #define __NET_SCHED_RED_H diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 23e22054aa60..347015515a7d 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h @@ -150,6 +150,8 @@ struct fastopen_queue {  	spinlock_t	lock;  	int		qlen;		/* # of pending (TCP_SYN_RECV) reqs */  	int		max_qlen;	/* != 0 iff TFO is currently enabled */ + +	struct tcp_fastopen_context __rcu *ctx; /* cipher context for cookie */  };  /** struct request_sock_queue - queue of request_socks diff --git a/include/net/rose.h b/include/net/rose.h index 50811fe2c585..04b72681f2ab 100644 --- a/include/net/rose.h +++ b/include/net/rose.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Declarations of Rose type objects.   * diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 21837ca68ecc..ead018744ff5 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_RTNETLINK_H  #define __NET_RTNETLINK_H @@ -93,9 +94,6 @@ struct rtnl_link_ops {  	int			slave_maxtype;  	const struct nla_policy	*slave_policy; -	int			(*slave_validate)(struct nlattr *tb[], -						  struct nlattr *data[], -						  struct netlink_ext_ack *extack);  	int			(*slave_changelink)(struct net_device *dev,  						    struct net_device *slave_dev,  						    struct nlattr *tb[], @@ -154,8 +152,6 @@ struct rtnl_af_ops {  	size_t			(*get_stats_af_size)(const struct net_device *dev);  }; -void __rtnl_af_unregister(struct rtnl_af_ops *ops); -  void rtnl_af_register(struct rtnl_af_ops *ops);  void rtnl_af_unregister(struct rtnl_af_ops *ops); diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 135f5a2dd931..65d0d25f2648 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_SCHED_GENERIC_H  #define __NET_SCHED_GENERIC_H @@ -10,6 +11,7 @@  #include <linux/dynamic_queue_limits.h>  #include <linux/list.h>  #include <linux/refcount.h> +#include <linux/workqueue.h>  #include <net/gen_stats.h>  #include <net/rtnetlink.h> @@ -93,7 +95,6 @@ struct Qdisc {  	unsigned long		state;  	struct Qdisc            *next_sched;  	struct sk_buff		*skb_bad_txq; -	struct rcu_head		rcu_head;  	int			padded;  	refcount_t		refcnt; @@ -260,9 +261,12 @@ struct qdisc_skb_cb {  	unsigned char		data[QDISC_CB_PRIV_LEN];  }; +typedef void tcf_chain_head_change_t(struct tcf_proto *tp_head, void *priv); +  struct tcf_chain {  	struct tcf_proto __rcu *filter_chain; -	struct tcf_proto __rcu **p_filter_chain; +	tcf_chain_head_change_t *chain_head_change; +	void *chain_head_change_priv;  	struct list_head list;  	struct tcf_block *block;  	u32 index; /* chain index */ @@ -271,6 +275,10 @@ struct tcf_chain {  struct tcf_block {  	struct list_head chain_list; +	struct net *net; +	struct Qdisc *q; +	struct list_head cb_list; +	struct work_struct work;  };  static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) @@ -358,9 +366,6 @@ static inline void sch_tree_unlock(const struct Qdisc *q)  	spin_unlock_bh(qdisc_root_sleeping_lock(q));  } -#define tcf_tree_lock(tp)	sch_tree_lock((tp)->q) -#define tcf_tree_unlock(tp)	sch_tree_unlock((tp)->q) -  extern struct Qdisc noop_qdisc;  extern struct Qdisc_ops noop_qdisc_ops;  extern struct Qdisc_ops pfifo_fast_ops; @@ -410,6 +415,13 @@ qdisc_class_find(const struct Qdisc_class_hash *hash, u32 id)  	return NULL;  } +static inline int tc_classid_to_hwtc(struct net_device *dev, u32 classid) +{ +	u32 hwtc = TC_H_MIN(classid) - TC_H_MIN_PRIORITY; + +	return (hwtc < netdev_get_num_tc(dev)) ? hwtc : -EINVAL; +} +  int qdisc_class_hash_init(struct Qdisc_class_hash *);  void qdisc_class_hash_insert(struct Qdisc_class_hash *,  			     struct Qdisc_class_common *); @@ -893,4 +905,36 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res,  	res->linklayer = (r->linklayer & TC_LINKLAYER_MASK);  } +/* Mini Qdisc serves for specific needs of ingress/clsact Qdisc. + * The fast path only needs to access filter list and to update stats + */ +struct mini_Qdisc { +	struct tcf_proto *filter_list; +	struct gnet_stats_basic_cpu __percpu *cpu_bstats; +	struct gnet_stats_queue	__percpu *cpu_qstats; +	struct rcu_head rcu; +}; + +static inline void mini_qdisc_bstats_cpu_update(struct mini_Qdisc *miniq, +						const struct sk_buff *skb) +{ +	bstats_cpu_update(this_cpu_ptr(miniq->cpu_bstats), skb); +} + +static inline void mini_qdisc_qstats_cpu_drop(struct mini_Qdisc *miniq) +{ +	this_cpu_inc(miniq->cpu_qstats->drops); +} + +struct mini_Qdisc_pair { +	struct mini_Qdisc miniq1; +	struct mini_Qdisc miniq2; +	struct mini_Qdisc __rcu **p_miniq; +}; + +void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp, +			  struct tcf_proto *tp_head); +void mini_qdisc_pair_init(struct mini_Qdisc_pair *miniqp, struct Qdisc *qdisc, +			  struct mini_Qdisc __rcu **p_miniq); +  #endif diff --git a/include/net/scm.h b/include/net/scm.h index 142ea9e7a6d0..903771c8d4e3 100644 --- a/include/net/scm.h +++ b/include/net/scm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_NET_SCM_H  #define __LINUX_NET_SCM_H diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index d7d8cba01469..749a42882437 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -444,7 +444,8 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)  	if (asoc->user_frag)  		frag = min_t(int, frag, asoc->user_frag); -	frag = SCTP_TRUNC4(min_t(int, frag, SCTP_MAX_CHUNK_LEN)); +	frag = SCTP_TRUNC4(min_t(int, frag, SCTP_MAX_CHUNK_LEN - +					    sizeof(struct sctp_data_chunk)));  	return frag;  } diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 2db3d3a9ce1d..70fb397f65b0 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -72,7 +72,7 @@ typedef enum sctp_disposition (sctp_state_fn_t) (  					const union sctp_subtype type,  					void *arg,  					struct sctp_cmd_seq *commands); -typedef void (sctp_timer_event_t) (unsigned long); +typedef void (sctp_timer_event_t) (struct timer_list *);  struct sctp_sm_table_entry {  	sctp_state_fn_t *fn;  	const char *name; @@ -261,7 +261,7 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,  				    struct sctp_fwdtsn_skip *skiplist);  struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc);  struct sctp_chunk *sctp_make_strreset_req(const struct sctp_association *asoc, -					  __u16 stream_num, __u16 *stream_list, +					  __u16 stream_num, __be16 *stream_list,  					  bool out, bool in);  struct sctp_chunk *sctp_make_strreset_tsnreq(  					const struct sctp_association *asoc); @@ -314,10 +314,10 @@ int sctp_do_sm(struct net *net, enum sctp_event event_type,  	       void *event_arg, gfp_t gfp);  /* 2nd level prototypes */ -void sctp_generate_t3_rtx_event(unsigned long peer); -void sctp_generate_heartbeat_event(unsigned long peer); -void sctp_generate_reconf_event(unsigned long peer); -void sctp_generate_proto_unreach_event(unsigned long peer); +void sctp_generate_t3_rtx_event(struct timer_list *t); +void sctp_generate_heartbeat_event(struct timer_list *t); +void sctp_generate_reconf_event(struct timer_list *t); +void sctp_generate_proto_unreach_event(struct timer_list *t);  void sctp_ootb_pkt_free(struct sctp_packet *packet); diff --git a/include/net/sctp/stream_sched.h b/include/net/sctp/stream_sched.h new file mode 100644 index 000000000000..c676550a4c7d --- /dev/null +++ b/include/net/sctp/stream_sched.h @@ -0,0 +1,72 @@ +/* SCTP kernel implementation + * (C) Copyright Red Hat Inc. 2017 + * + * These are definitions used by the stream schedulers, defined in RFC + * draft ndata (https://tools.ietf.org/html/draft-ietf-tsvwg-sctp-ndata-11) + * + * This SCTP implementation is free software; + * you can redistribute it and/or modify it under the terms of + * the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This SCTP implementation  is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied + *                 ************************ + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU CC; see the file COPYING.  If not, see + * <http://www.gnu.org/licenses/>. + * + * Please send any bug reports or fixes you make to the + * email addresses: + *    lksctp developers <linux-sctp@vger.kernel.org> + * + * Written or modified by: + *   Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> + */ + +#ifndef __sctp_stream_sched_h__ +#define __sctp_stream_sched_h__ + +struct sctp_sched_ops { +	/* Property handling for a given stream */ +	int (*set)(struct sctp_stream *stream, __u16 sid, __u16 value, +		   gfp_t gfp); +	int (*get)(struct sctp_stream *stream, __u16 sid, __u16 *value); + +	/* Init the specific scheduler */ +	int (*init)(struct sctp_stream *stream); +	/* Init a stream */ +	int (*init_sid)(struct sctp_stream *stream, __u16 sid, gfp_t gfp); +	/* Frees the entire thing */ +	void (*free)(struct sctp_stream *stream); + +	/* Enqueue a chunk */ +	void (*enqueue)(struct sctp_outq *q, struct sctp_datamsg *msg); +	/* Dequeue a chunk */ +	struct sctp_chunk *(*dequeue)(struct sctp_outq *q); +	/* Called only if the chunk fit the packet */ +	void (*dequeue_done)(struct sctp_outq *q, struct sctp_chunk *chunk); +	/* Sched all chunks already enqueued */ +	void (*sched_all)(struct sctp_stream *steam); +	/* Unched all chunks already enqueued */ +	void (*unsched_all)(struct sctp_stream *steam); +}; + +int sctp_sched_set_sched(struct sctp_association *asoc, +			 enum sctp_sched_type sched); +int sctp_sched_get_sched(struct sctp_association *asoc); +int sctp_sched_set_value(struct sctp_association *asoc, __u16 sid, +			 __u16 value, gfp_t gfp); +int sctp_sched_get_value(struct sctp_association *asoc, __u16 sid, +			 __u16 *value); +void sctp_sched_dequeue_done(struct sctp_outq *q, struct sctp_chunk *ch); + +void sctp_sched_dequeue_common(struct sctp_outq *q, struct sctp_chunk *ch); +int sctp_sched_init_sid(struct sctp_stream *stream, __u16 sid, gfp_t gfp); +struct sctp_sched_ops *sctp_sched_ops_from_stream(struct sctp_stream *stream); + +#endif /* __sctp_stream_sched_h__ */ diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0477945de1a3..16f949eef52f 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -380,6 +380,7 @@ struct sctp_sender_hb_info {  int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,  		     gfp_t gfp); +int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid);  void sctp_stream_free(struct sctp_stream *stream);  void sctp_stream_clear(struct sctp_stream *stream);  void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new); @@ -529,8 +530,12 @@ struct sctp_chunk {  	/* How many times this chunk have been sent, for prsctp RTX policy */  	int sent_count; -	/* This is our link to the per-transport transmitted list.  */ -	struct list_head transmitted_list; +	union { +		/* This is our link to the per-transport transmitted list.  */ +		struct list_head transmitted_list; +		/* List in specific stream outq */ +		struct list_head stream_list; +	};  	/* This field is used by chunks that hold fragmented data.  	 * For the first fragment this is the list that holds the rest of @@ -640,6 +645,11 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,  		     union sctp_addr *);  const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); +static inline __u16 sctp_chunk_stream_no(struct sctp_chunk *ch) +{ +	return ntohs(ch->subh.data_hdr->stream); +} +  enum {  	SCTP_ADDR_NEW,		/* new address added to assoc/ep */  	SCTP_ADDR_SRC,		/* address can be used as source */ @@ -1012,6 +1022,9 @@ struct sctp_outq {  	/* Data pending that has never been transmitted.  */  	struct list_head out_chunk_list; +	/* Stream scheduler being used */ +	struct sctp_sched_ops *sched; +  	unsigned int out_qlen;	/* Total length of queued data chunks. */  	/* Error of send failed, may used in SCTP_SEND_FAILED event. */ @@ -1315,11 +1328,37 @@ struct sctp_inithdr_host {  	__u32 initial_tsn;  }; +struct sctp_stream_priorities { +	/* List of priorities scheduled */ +	struct list_head prio_sched; +	/* List of streams scheduled */ +	struct list_head active; +	/* The next stream stream in line */ +	struct sctp_stream_out_ext *next; +	__u16 prio; +}; + +struct sctp_stream_out_ext { +	__u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1]; +	__u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1]; +	struct list_head outq; /* chunks enqueued by this stream */ +	union { +		struct { +			/* Scheduled streams list */ +			struct list_head prio_list; +			struct sctp_stream_priorities *prio_head; +		}; +		/* Fields used by RR scheduler */ +		struct { +			struct list_head rr_list; +		}; +	}; +}; +  struct sctp_stream_out {  	__u16	ssn;  	__u8	state; -	__u64	abandoned_unsent[SCTP_PR_INDEX(MAX) + 1]; -	__u64	abandoned_sent[SCTP_PR_INDEX(MAX) + 1]; +	struct sctp_stream_out_ext *ext;  };  struct sctp_stream_in { @@ -1331,6 +1370,22 @@ struct sctp_stream {  	struct sctp_stream_in *in;  	__u16 outcnt;  	__u16 incnt; +	/* Current stream being sent, if any */ +	struct sctp_stream_out *out_curr; +	union { +		/* Fields used by priority scheduler */ +		struct { +			/* List of priorities scheduled */ +			struct list_head prio_list; +		}; +		/* Fields used by RR scheduler */ +		struct { +			/* List of streams scheduled */ +			struct list_head rr_list; +			/* The next stream stream in line */ +			struct sctp_stream_out_ext *rr_next; +		}; +	};  };  #define SCTP_STREAM_CLOSED		0x00 diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h index b8c86ec1a8f5..231dc42f1da6 100644 --- a/include/net/sctp/ulpevent.h +++ b/include/net/sctp/ulpevent.h @@ -130,7 +130,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(  struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event(  	const struct sctp_association *asoc, __u16 flags, -	__u16 stream_num, __u16 *stream_list, gfp_t gfp); +	__u16 stream_num, __be16 *stream_list, gfp_t gfp);  struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event(  	const struct sctp_association *asoc, __u16 flags, diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h index 031bf16d1521..d7d2495f83c2 100644 --- a/include/net/secure_seq.h +++ b/include/net/secure_seq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_SECURE_SEQ  #define _NET_SECURE_SEQ diff --git a/include/net/smc.h b/include/net/smc.h index 12d26358ad9f..8381d163fefa 100644 --- a/include/net/smc.h +++ b/include/net/smc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *  Shared Memory Communications over RDMA (SMC-R) and RoCE   * diff --git a/include/net/sock.h b/include/net/sock.h index a6b9a8d1a6df..79e1a2c7912c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -60,7 +60,7 @@  #include <linux/sched.h>  #include <linux/wait.h>  #include <linux/cgroup-defs.h> - +#include <linux/rbtree.h>  #include <linux/filter.h>  #include <linux/rculist_nulls.h>  #include <linux/poll.h> @@ -267,6 +267,7 @@ struct sock_common {    *	@sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)    *	@sk_gso_max_size: Maximum GSO segment size to build    *	@sk_gso_max_segs: Maximum number of GSO segments +  *	@sk_pacing_shift: scaling factor for TCP Small Queues    *	@sk_lingertime: %SO_LINGER l_linger setting    *	@sk_backlog: always used with the per-socket spinlock held    *	@sk_callback_lock: used with the callbacks in the end of this struct @@ -397,7 +398,10 @@ struct sock {  	int			sk_wmem_queued;  	refcount_t		sk_wmem_alloc;  	unsigned long		sk_tsq_flags; -	struct sk_buff		*sk_send_head; +	union { +		struct sk_buff	*sk_send_head; +		struct rb_root	tcp_rtx_queue; +	};  	struct sk_buff_head	sk_write_queue;  	__s32			sk_peek_off;  	int			sk_write_pending; @@ -436,7 +440,6 @@ struct sock {  #define SK_FL_TYPE_MASK    0xffff0000  #endif -	kmemcheck_bitfield_begin(flags);  	unsigned int		sk_padding : 1,  				sk_kern_sock : 1,  				sk_no_check_tx : 1, @@ -445,9 +448,8 @@ struct sock {  				sk_protocol  : 8,  				sk_type      : 16;  #define SK_PROTOCOL_MAX U8_MAX -	kmemcheck_bitfield_end(flags); -  	u16			sk_gso_max_segs; +	u8			sk_pacing_shift;  	unsigned long	        sk_lingertime;  	struct proto		*sk_prot_creator;  	rwlock_t		sk_callback_lock; @@ -734,10 +736,10 @@ static inline void sk_add_bind_node(struct sock *sk,   *   */  #define sk_for_each_entry_offset_rcu(tpos, pos, head, offset)		       \ -	for (pos = rcu_dereference((head)->first);			       \ +	for (pos = rcu_dereference(hlist_first_rcu(head));		       \  	     pos != NULL &&						       \  		({ tpos = (typeof(*tpos) *)((void *)pos - offset); 1;});       \ -	     pos = rcu_dereference(pos->next)) +	     pos = rcu_dereference(hlist_next_rcu(pos)))  static inline struct user_namespace *sk_user_ns(struct sock *sk)  { @@ -1098,14 +1100,18 @@ struct proto {  	 */  	unsigned long		*memory_pressure;  	long			*sysctl_mem; +  	int			*sysctl_wmem;  	int			*sysctl_rmem; +	u32			sysctl_wmem_offset; +	u32			sysctl_rmem_offset; +  	int			max_header;  	bool			no_autobind;  	struct kmem_cache	*slab;  	unsigned int		obj_size; -	int			slab_flags; +	slab_flags_t		slab_flags;  	struct percpu_counter	*orphan_count; @@ -2387,4 +2393,22 @@ extern int sysctl_optmem_max;  extern __u32 sysctl_wmem_default;  extern __u32 sysctl_rmem_default; +static inline int sk_get_wmem0(const struct sock *sk, const struct proto *proto) +{ +	/* Does this proto have per netns sysctl_wmem ? */ +	if (proto->sysctl_wmem_offset) +		return *(int *)((void *)sock_net(sk) + proto->sysctl_wmem_offset); + +	return *proto->sysctl_wmem; +} + +static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto) +{ +	/* Does this proto have per netns sysctl_rmem ? */ +	if (proto->sysctl_rmem_offset) +		return *(int *)((void *)sock_net(sk) + proto->sysctl_rmem_offset); + +	return *proto->sysctl_rmem; +} +  #endif	/* _SOCK_H */ diff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h index aecd30308d50..0054b3a9b923 100644 --- a/include/net/sock_reuseport.h +++ b/include/net/sock_reuseport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SOCK_REUSEPORT_H  #define _SOCK_REUSEPORT_H diff --git a/include/net/stp.h b/include/net/stp.h index 3af174d70d9e..2914e6d53490 100644 --- a/include/net/stp.h +++ b/include/net/stp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_STP_H  #define _NET_STP_H diff --git a/include/net/strparser.h b/include/net/strparser.h index 7dc131d62ad5..d96b59f45eba 100644 --- a/include/net/strparser.h +++ b/include/net/strparser.h @@ -74,10 +74,9 @@ struct strparser {  	u32 unrecov_intr : 1;  	struct sk_buff **skb_nextp; -	struct timer_list msg_timer;  	struct sk_buff *skb_head;  	unsigned int need_bytes; -	struct delayed_work delayed_work; +	struct delayed_work msg_timer_work;  	struct work_struct work;  	struct strp_stats stats;  	struct strp_callbacks cb; diff --git a/include/net/switchdev.h b/include/net/switchdev.h index d767b7991887..39bc855d7fee 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -51,6 +51,7 @@ enum switchdev_attr_id {  	SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,  	SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING,  	SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED, +	SWITCHDEV_ATTR_ID_BRIDGE_MROUTER,  };  struct switchdev_attr { @@ -75,6 +76,7 @@ enum switchdev_obj_id {  	SWITCHDEV_OBJ_ID_UNDEFINED,  	SWITCHDEV_OBJ_ID_PORT_VLAN,  	SWITCHDEV_OBJ_ID_PORT_MDB, +	SWITCHDEV_OBJ_ID_HOST_MDB,  };  struct switchdev_obj { diff --git a/include/net/tc_act/tc_connmark.h b/include/net/tc_act/tc_connmark.h index 59b515d32bb4..1f4cb477bb5d 100644 --- a/include/net/tc_act/tc_connmark.h +++ b/include/net/tc_act/tc_connmark.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_CONNMARK_H  #define __NET_TC_CONNMARK_H diff --git a/include/net/tc_act/tc_csum.h b/include/net/tc_act/tc_csum.h index 3248beaf16b0..781f3433a0be 100644 --- a/include/net/tc_act/tc_csum.h +++ b/include/net/tc_act/tc_csum.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_CSUM_H  #define __NET_TC_CSUM_H diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h index d47f040a3bdf..d7ba0402a732 100644 --- a/include/net/tc_act/tc_defact.h +++ b/include/net/tc_act/tc_defact.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_DEF_H  #define __NET_TC_DEF_H diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h index 41afe1ce7b16..ef8dd0db70ce 100644 --- a/include/net/tc_act/tc_gact.h +++ b/include/net/tc_act/tc_gact.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_GACT_H  #define __NET_TC_GACT_H @@ -33,6 +34,11 @@ static inline bool __is_tcf_gact_act(const struct tc_action *a, int act,  	return false;  } +static inline bool is_tcf_gact_ok(const struct tc_action *a) +{ +	return __is_tcf_gact_act(a, TC_ACT_OK, false); +} +  static inline bool is_tcf_gact_shot(const struct tc_action *a)  {  	return __is_tcf_gact_act(a, TC_ACT_SHOT, false); diff --git a/include/net/tc_act/tc_ife.h b/include/net/tc_act/tc_ife.h index 30ba459ddd34..86d13b01b39d 100644 --- a/include/net/tc_act/tc_ife.h +++ b/include/net/tc_act/tc_ife.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_IFE_H  #define __NET_TC_IFE_H @@ -6,12 +7,18 @@  #include <linux/rtnetlink.h>  #include <linux/module.h> -struct tcf_ife_info { -	struct tc_action common; +struct tcf_ife_params {  	u8 eth_dst[ETH_ALEN];  	u8 eth_src[ETH_ALEN];  	u16 eth_type;  	u16 flags; + +	struct rcu_head rcu; +}; + +struct tcf_ife_info { +	struct tc_action common; +	struct tcf_ife_params __rcu *params;  	/* list of metaids allowed */  	struct list_head metalist;  }; @@ -40,7 +47,7 @@ struct tcf_meta_ops {  	struct module	*owner;  }; -#define MODULE_ALIAS_IFE_META(metan)   MODULE_ALIAS("ifemeta" __stringify_1(metan)) +#define MODULE_ALIAS_IFE_META(metan)   MODULE_ALIAS("ife-meta-" metan)  int ife_get_meta_u32(struct sk_buff *skb, struct tcf_meta_info *mi);  int ife_get_meta_u16(struct sk_buff *skb, struct tcf_meta_info *mi); diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h index 31309766e379..4225fcb1c6ba 100644 --- a/include/net/tc_act/tc_ipt.h +++ b/include/net/tc_act/tc_ipt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_IPT_H  #define __NET_TC_IPT_H diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h index 604bc31e23ab..21d253c9a8c6 100644 --- a/include/net/tc_act/tc_mirred.h +++ b/include/net/tc_act/tc_mirred.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_MIR_H  #define __NET_TC_MIR_H @@ -10,6 +11,7 @@ struct tcf_mirred {  	int			tcfm_ifindex;  	bool			tcfm_mac_header_xmit;  	struct net_device __rcu	*tcfm_dev; +	struct net		*net;  	struct list_head	tcfm_list;  };  #define to_mirred(a) ((struct tcf_mirred *)a) diff --git a/include/net/tc_act/tc_nat.h b/include/net/tc_act/tc_nat.h index 56681a320612..c14407160812 100644 --- a/include/net/tc_act/tc_nat.h +++ b/include/net/tc_act/tc_nat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_NAT_H  #define __NET_TC_NAT_H diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h index a46c3f2ace70..227a6f1d02f4 100644 --- a/include/net/tc_act/tc_pedit.h +++ b/include/net/tc_act/tc_pedit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_PED_H  #define __NET_TC_PED_H diff --git a/include/net/tc_act/tc_sample.h b/include/net/tc_act/tc_sample.h index 89e9305be880..524cee4f4c81 100644 --- a/include/net/tc_act/tc_sample.h +++ b/include/net/tc_act/tc_sample.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_TC_SAMPLE_H  #define __NET_TC_SAMPLE_H diff --git a/include/net/tc_act/tc_vlan.h b/include/net/tc_act/tc_vlan.h index c2090df944ff..22ae260d6869 100644 --- a/include/net/tc_act/tc_vlan.h +++ b/include/net/tc_act/tc_vlan.h @@ -13,12 +13,17 @@  #include <net/act_api.h>  #include <linux/tc_act/tc_vlan.h> +struct tcf_vlan_params { +	int               tcfv_action; +	u16               tcfv_push_vid; +	__be16            tcfv_push_proto; +	u8                tcfv_push_prio; +	struct rcu_head   rcu; +}; +  struct tcf_vlan {  	struct tc_action	common; -	int			tcfv_action; -	u16			tcfv_push_vid; -	__be16			tcfv_push_proto; -	u8			tcfv_push_prio; +	struct tcf_vlan_params __rcu *vlan_p;  };  #define to_vlan(a) ((struct tcf_vlan *)a) @@ -33,22 +38,45 @@ static inline bool is_tcf_vlan(const struct tc_action *a)  static inline u32 tcf_vlan_action(const struct tc_action *a)  { -	return to_vlan(a)->tcfv_action; +	u32 tcfv_action; + +	rcu_read_lock(); +	tcfv_action = rcu_dereference(to_vlan(a)->vlan_p)->tcfv_action; +	rcu_read_unlock(); + +	return tcfv_action;  }  static inline u16 tcf_vlan_push_vid(const struct tc_action *a)  { -	return to_vlan(a)->tcfv_push_vid; +	u16 tcfv_push_vid; + +	rcu_read_lock(); +	tcfv_push_vid = rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_vid; +	rcu_read_unlock(); + +	return tcfv_push_vid;  }  static inline __be16 tcf_vlan_push_proto(const struct tc_action *a)  { -	return to_vlan(a)->tcfv_push_proto; +	__be16 tcfv_push_proto; + +	rcu_read_lock(); +	tcfv_push_proto = rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_proto; +	rcu_read_unlock(); + +	return tcfv_push_proto;  }  static inline u8 tcf_vlan_push_prio(const struct tc_action *a)  { -	return to_vlan(a)->tcfv_push_prio; -} +	u8 tcfv_push_prio; +	rcu_read_lock(); +	tcfv_push_prio = rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_prio; +	rcu_read_unlock(); + +	return tcfv_push_prio; +}  #endif /* __NET_TC_VLAN_H */ diff --git a/include/net/tcp.h b/include/net/tcp.h index 89974c5286d8..4e09398009c1 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -45,9 +45,6 @@  #include <linux/seq_file.h>  #include <linux/memcontrol.h> - -#include <linux/bpf.h> -#include <linux/filter.h>  #include <linux/bpf-cgroup.h>  extern struct inet_hashinfo tcp_hashinfo; @@ -191,6 +188,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);   * experimental options. See draft-ietf-tcpm-experimental-options-00.txt   */  #define TCPOPT_FASTOPEN_MAGIC	0xF989 +#define TCPOPT_SMC_MAGIC	0xE2D4C3D9  /*   *     TCP option lengths @@ -203,6 +201,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);  #define TCPOLEN_MD5SIG         18  #define TCPOLEN_FASTOPEN_BASE  2  #define TCPOLEN_EXP_FASTOPEN_BASE  4 +#define TCPOLEN_EXP_SMC_BASE   6  /* But this is what stacks really send out. */  #define TCPOLEN_TSTAMP_ALIGNED		12 @@ -213,6 +212,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);  #define TCPOLEN_SACK_PERBLOCK		8  #define TCPOLEN_MD5SIG_ALIGNED		20  #define TCPOLEN_MSS_ALIGNED		4 +#define TCPOLEN_EXP_SMC_BASE_ALIGNED	8  /* Flags in tp->nonagle */  #define TCP_NAGLE_OFF		1	/* Nagle's algo is disabled */ @@ -240,41 +240,11 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);  /* sysctl variables for tcp */ -extern int sysctl_tcp_fastopen; -extern int sysctl_tcp_retrans_collapse; -extern int sysctl_tcp_stdurg; -extern int sysctl_tcp_rfc1337; -extern int sysctl_tcp_abort_on_overflow;  extern int sysctl_tcp_max_orphans; -extern int sysctl_tcp_fack; -extern int sysctl_tcp_reordering; -extern int sysctl_tcp_max_reordering; -extern int sysctl_tcp_dsack;  extern long sysctl_tcp_mem[3]; -extern int sysctl_tcp_wmem[3]; -extern int sysctl_tcp_rmem[3]; -extern int sysctl_tcp_app_win; -extern int sysctl_tcp_adv_win_scale; -extern int sysctl_tcp_frto; -extern int sysctl_tcp_nometrics_save; -extern int sysctl_tcp_moderate_rcvbuf; -extern int sysctl_tcp_tso_win_divisor; -extern int sysctl_tcp_workaround_signed_windows; -extern int sysctl_tcp_slow_start_after_idle; -extern int sysctl_tcp_thin_linear_timeouts; -extern int sysctl_tcp_thin_dupack; -extern int sysctl_tcp_early_retrans; -extern int sysctl_tcp_recovery; -#define TCP_RACK_LOSS_DETECTION  0x1 /* Use RACK to detect losses */ -extern int sysctl_tcp_limit_output_bytes; -extern int sysctl_tcp_challenge_ack_limit; -extern int sysctl_tcp_min_tso_segs; -extern int sysctl_tcp_min_rtt_wlen; -extern int sysctl_tcp_autocorking; -extern int sysctl_tcp_invalid_ratelimit; -extern int sysctl_tcp_pacing_ss_ratio; -extern int sysctl_tcp_pacing_ca_ratio; +#define TCP_RACK_LOSS_DETECTION  0x1 /* Use RACK to detect losses */ +#define TCP_RACK_STATIC_REO_WND  0x2 /* Use static RACK reo wnd */  extern atomic_long_t tcp_memory_allocated;  extern struct percpu_counter tcp_sockets_allocated; @@ -414,9 +384,9 @@ void tcp_update_metrics(struct sock *sk);  void tcp_init_metrics(struct sock *sk);  void tcp_metrics_init(void);  bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst); -void tcp_disable_fack(struct tcp_sock *tp);  void tcp_close(struct sock *sk, long timeout);  void tcp_init_sock(struct sock *sk); +void tcp_init_transfer(struct sock *sk, int bpf_op);  unsigned int tcp_poll(struct file *file, struct socket *sock,  		      struct poll_table_struct *wait);  int tcp_getsockopt(struct sock *sk, int level, int optname, @@ -551,7 +521,13 @@ void tcp_xmit_retransmit_queue(struct sock *);  void tcp_simple_retransmit(struct sock *);  void tcp_enter_recovery(struct sock *sk, bool ece_ack);  int tcp_trim_head(struct sock *, struct sk_buff *, u32); -int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int, gfp_t); +enum tcp_queue { +	TCP_FRAG_IN_WRITE_QUEUE, +	TCP_FRAG_IN_RTX_QUEUE, +}; +int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue, +		 struct sk_buff *skb, u32 len, +		 unsigned int mss_now, gfp_t gfp);  void tcp_send_probe0(struct sock *);  void tcp_send_partial(struct sock *); @@ -563,7 +539,7 @@ void tcp_push_one(struct sock *, unsigned int mss_now);  void tcp_send_ack(struct sock *sk);  void tcp_send_delayed_ack(struct sock *sk);  void tcp_send_loss_probe(struct sock *sk); -bool tcp_schedule_loss_probe(struct sock *sk); +bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto);  void tcp_skb_collapse_tstamp(struct sk_buff *skb,  			     const struct sk_buff *next_skb); @@ -796,16 +772,10 @@ struct tcp_skb_cb {  			u16	tcp_gso_segs;  			u16	tcp_gso_size;  		}; - -		/* Used to stash the receive timestamp while this skb is in the -		 * out of order queue, as skb->tstamp is overwritten by the -		 * rbnode. -		 */ -		ktime_t		swtstamp;  	};  	__u8		tcp_flags;	/* TCP header flags. (tcp[13])	*/ -	__u8		sacked;		/* State flags for SACK/FACK.	*/ +	__u8		sacked;		/* State flags for SACK.	*/  #define TCPCB_SACKED_ACKED	0x01	/* SKB ACK'd by a SACK block	*/  #define TCPCB_SACKED_RETRANS	0x02	/* SKB retransmitted		*/  #define TCPCB_LOST		0x04	/* SKB is lost			*/ @@ -840,6 +810,12 @@ struct tcp_skb_cb {  			struct inet6_skb_parm	h6;  #endif  		} header;	/* For incoming skbs */ +		struct { +			__u32 key; +			__u32 flags; +			struct bpf_map *map; +			void *data_end; +		} bpf;  	};  }; @@ -1026,8 +1002,8 @@ void tcp_unregister_congestion_control(struct tcp_congestion_ops *type);  void tcp_assign_congestion_control(struct sock *sk);  void tcp_init_congestion_control(struct sock *sk);  void tcp_cleanup_congestion_control(struct sock *sk); -int tcp_set_default_congestion_control(const char *name); -void tcp_get_default_congestion_control(char *name); +int tcp_set_default_congestion_control(struct net *net, const char *name); +void tcp_get_default_congestion_control(struct net *net, char *name);  void tcp_get_available_congestion_control(char *buf, size_t len);  void tcp_get_allowed_congestion_control(char *buf, size_t len);  int tcp_set_allowed_congestion_control(char *allowed); @@ -1041,7 +1017,7 @@ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked);  extern struct tcp_congestion_ops tcp_reno;  struct tcp_congestion_ops *tcp_ca_find_key(u32 key); -u32 tcp_ca_get_key_by_name(const char *name, bool *ecn_ca); +u32 tcp_ca_get_key_by_name(struct net *net, const char *name, bool *ecn_ca);  #ifdef CONFIG_INET  char *tcp_ca_get_name_by_key(u32 key, char *buffer);  #else @@ -1089,7 +1065,6 @@ void tcp_rate_check_app_limited(struct sock *sk);   *   * tcp_is_sack - SACK enabled   * tcp_is_reno - No SACK - * tcp_is_fack - FACK enabled, implies SACK enabled   */  static inline int tcp_is_sack(const struct tcp_sock *tp)  { @@ -1101,16 +1076,6 @@ static inline bool tcp_is_reno(const struct tcp_sock *tp)  	return !tcp_is_sack(tp);  } -static inline bool tcp_is_fack(const struct tcp_sock *tp) -{ -	return tp->rx_opt.sack_ok & TCP_FACK_ENABLED; -} - -static inline void tcp_enable_fack(struct tcp_sock *tp) -{ -	tp->rx_opt.sack_ok |= TCP_FACK_ENABLED; -} -  static inline unsigned int tcp_left_out(const struct tcp_sock *tp)  {  	return tp->sacked_out + tp->lost_out; @@ -1303,7 +1268,7 @@ static inline void tcp_slow_start_after_idle_check(struct sock *sk)  	struct tcp_sock *tp = tcp_sk(sk);  	s32 delta; -	if (!sysctl_tcp_slow_start_after_idle || tp->packets_out || +	if (!sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle || tp->packets_out ||  	    ca_ops->cong_control)  		return;  	delta = tcp_jiffies32 - tp->lsndtime; @@ -1312,13 +1277,14 @@ static inline void tcp_slow_start_after_idle_check(struct sock *sk)  }  /* Determine a window scaling and initial window to offer. */ -void tcp_select_initial_window(int __space, __u32 mss, __u32 *rcv_wnd, +void tcp_select_initial_window(const struct sock *sk, int __space, +			       __u32 mss, __u32 *rcv_wnd,  			       __u32 *window_clamp, int wscale_ok,  			       __u8 *rcv_wscale, __u32 init_rcv_wnd); -static inline int tcp_win_from_space(int space) +static inline int tcp_win_from_space(const struct sock *sk, int space)  { -	int tcp_adv_win_scale = sysctl_tcp_adv_win_scale; +	int tcp_adv_win_scale = sock_net(sk)->ipv4.sysctl_tcp_adv_win_scale;  	return tcp_adv_win_scale <= 0 ?  		(space>>(-tcp_adv_win_scale)) : @@ -1328,13 +1294,13 @@ static inline int tcp_win_from_space(int space)  /* Note: caller must be prepared to deal with negative returns */  static inline int tcp_space(const struct sock *sk)  { -	return tcp_win_from_space(sk->sk_rcvbuf - +	return tcp_win_from_space(sk, sk->sk_rcvbuf -  				  atomic_read(&sk->sk_rmem_alloc));  }  static inline int tcp_full_space(const struct sock *sk)  { -	return tcp_win_from_space(sk->sk_rcvbuf); +	return tcp_win_from_space(sk, sk->sk_rcvbuf);  }  extern void tcp_openreq_init_rwin(struct request_sock *req, @@ -1555,14 +1521,16 @@ struct tcp_fastopen_request {  	int				copied;	/* queued in tcp_connect() */  };  void tcp_free_fastopen_req(struct tcp_sock *tp); - -extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; -int tcp_fastopen_reset_cipher(void *key, unsigned int len); +void tcp_fastopen_destroy_cipher(struct sock *sk); +void tcp_fastopen_ctx_destroy(struct net *net); +int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk, +			      void *key, unsigned int len);  void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb);  struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,  			      struct request_sock *req, -			      struct tcp_fastopen_cookie *foc); -void tcp_fastopen_init_key_once(bool publish); +			      struct tcp_fastopen_cookie *foc, +			      const struct dst_entry *dst); +void tcp_fastopen_init_key_once(struct net *net);  bool tcp_fastopen_cookie_check(struct sock *sk, u16 *mss,  			     struct tcp_fastopen_cookie *cookie);  bool tcp_fastopen_defer_connect(struct sock *sk, int *err); @@ -1595,52 +1563,46 @@ enum tcp_chrono {  void tcp_chrono_start(struct sock *sk, const enum tcp_chrono type);  void tcp_chrono_stop(struct sock *sk, const enum tcp_chrono type); -/* write queue abstraction */ -static inline void tcp_write_queue_purge(struct sock *sk) +/* This helper is needed, because skb->tcp_tsorted_anchor uses + * the same memory storage than skb->destructor/_skb_refdst + */ +static inline void tcp_skb_tsorted_anchor_cleanup(struct sk_buff *skb)  { -	struct sk_buff *skb; - -	tcp_chrono_stop(sk, TCP_CHRONO_BUSY); -	while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) -		sk_wmem_free_skb(sk, skb); -	sk_mem_reclaim(sk); -	tcp_clear_all_retrans_hints(tcp_sk(sk)); +	skb->destructor = NULL; +	skb->_skb_refdst = 0UL;  } -static inline struct sk_buff *tcp_write_queue_head(const struct sock *sk) -{ -	return skb_peek(&sk->sk_write_queue); +#define tcp_skb_tsorted_save(skb) {		\ +	unsigned long _save = skb->_skb_refdst;	\ +	skb->_skb_refdst = 0UL; + +#define tcp_skb_tsorted_restore(skb)		\ +	skb->_skb_refdst = _save;		\  } -static inline struct sk_buff *tcp_write_queue_tail(const struct sock *sk) +void tcp_write_queue_purge(struct sock *sk); + +static inline struct sk_buff *tcp_rtx_queue_head(const struct sock *sk)  { -	return skb_peek_tail(&sk->sk_write_queue); +	return skb_rb_first(&sk->tcp_rtx_queue);  } -static inline struct sk_buff *tcp_write_queue_next(const struct sock *sk, -						   const struct sk_buff *skb) +static inline struct sk_buff *tcp_write_queue_head(const struct sock *sk)  { -	return skb_queue_next(&sk->sk_write_queue, skb); +	return skb_peek(&sk->sk_write_queue);  } -static inline struct sk_buff *tcp_write_queue_prev(const struct sock *sk, -						   const struct sk_buff *skb) +static inline struct sk_buff *tcp_write_queue_tail(const struct sock *sk)  { -	return skb_queue_prev(&sk->sk_write_queue, skb); +	return skb_peek_tail(&sk->sk_write_queue);  } -#define tcp_for_write_queue(skb, sk)					\ -	skb_queue_walk(&(sk)->sk_write_queue, skb) - -#define tcp_for_write_queue_from(skb, sk)				\ -	skb_queue_walk_from(&(sk)->sk_write_queue, skb) -  #define tcp_for_write_queue_from_safe(skb, tmp, sk)			\  	skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)  static inline struct sk_buff *tcp_send_head(const struct sock *sk)  { -	return sk->sk_send_head; +	return skb_peek(&sk->sk_write_queue);  }  static inline bool tcp_skb_is_last(const struct sock *sk, @@ -1649,27 +1611,25 @@ static inline bool tcp_skb_is_last(const struct sock *sk,  	return skb_queue_is_last(&sk->sk_write_queue, skb);  } -static inline void tcp_advance_send_head(struct sock *sk, const struct sk_buff *skb) +static inline bool tcp_write_queue_empty(const struct sock *sk)  { -	if (tcp_skb_is_last(sk, skb)) -		sk->sk_send_head = NULL; -	else -		sk->sk_send_head = tcp_write_queue_next(sk, skb); +	return skb_queue_empty(&sk->sk_write_queue);  } -static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) +static inline bool tcp_rtx_queue_empty(const struct sock *sk)  { -	if (sk->sk_send_head == skb_unlinked) { -		sk->sk_send_head = NULL; -		tcp_chrono_stop(sk, TCP_CHRONO_BUSY); -	} -	if (tcp_sk(sk)->highest_sack == skb_unlinked) -		tcp_sk(sk)->highest_sack = NULL; +	return RB_EMPTY_ROOT(&sk->tcp_rtx_queue);  } -static inline void tcp_init_send_head(struct sock *sk) +static inline bool tcp_rtx_and_write_queues_empty(const struct sock *sk)  { -	sk->sk_send_head = NULL; +	return tcp_rtx_queue_empty(sk) && tcp_write_queue_empty(sk); +} + +static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) +{ +	if (tcp_write_queue_empty(sk)) +		tcp_chrono_stop(sk, TCP_CHRONO_BUSY);  }  static inline void __tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb) @@ -1682,26 +1642,8 @@ static inline void tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb  	__tcp_add_write_queue_tail(sk, skb);  	/* Queue it, remembering where we must start sending. */ -	if (sk->sk_send_head == NULL) { -		sk->sk_send_head = skb; +	if (sk->sk_write_queue.next == skb)  		tcp_chrono_start(sk, TCP_CHRONO_BUSY); - -		if (tcp_sk(sk)->highest_sack == NULL) -			tcp_sk(sk)->highest_sack = skb; -	} -} - -static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb) -{ -	__skb_queue_head(&sk->sk_write_queue, skb); -} - -/* Insert buff after skb on the write queue of sk.  */ -static inline void tcp_insert_write_queue_after(struct sk_buff *skb, -						struct sk_buff *buff, -						struct sock *sk) -{ -	__skb_queue_after(&sk->sk_write_queue, skb, buff);  }  /* Insert new before skb on the write queue of sk.  */ @@ -1710,19 +1652,27 @@ static inline void tcp_insert_write_queue_before(struct sk_buff *new,  						  struct sock *sk)  {  	__skb_queue_before(&sk->sk_write_queue, skb, new); - -	if (sk->sk_send_head == skb) -		sk->sk_send_head = new;  }  static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)  { +	tcp_skb_tsorted_anchor_cleanup(skb);  	__skb_unlink(skb, &sk->sk_write_queue);  } -static inline bool tcp_write_queue_empty(struct sock *sk) +void tcp_rbtree_insert(struct rb_root *root, struct sk_buff *skb); + +static inline void tcp_rtx_queue_unlink(struct sk_buff *skb, struct sock *sk)  { -	return skb_queue_empty(&sk->sk_write_queue); +	tcp_skb_tsorted_anchor_cleanup(skb); +	rb_erase(&skb->rbnode, &sk->tcp_rtx_queue); +} + +static inline void tcp_rtx_queue_unlink_and_free(struct sk_buff *skb, struct sock *sk) +{ +	list_del(&skb->tcp_tsorted_anchor); +	tcp_rtx_queue_unlink(skb, sk); +	sk_wmem_free_skb(sk, skb);  }  static inline void tcp_push_pending_frames(struct sock *sk) @@ -1751,8 +1701,7 @@ static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp)  static inline void tcp_advance_highest_sack(struct sock *sk, struct sk_buff *skb)  { -	tcp_sk(sk)->highest_sack = tcp_skb_is_last(sk, skb) ? NULL : -						tcp_write_queue_next(sk, skb); +	tcp_sk(sk)->highest_sack = skb_rb_next(skb);  }  static inline struct sk_buff *tcp_highest_sack(struct sock *sk) @@ -1762,15 +1711,15 @@ static inline struct sk_buff *tcp_highest_sack(struct sock *sk)  static inline void tcp_highest_sack_reset(struct sock *sk)  { -	tcp_sk(sk)->highest_sack = tcp_write_queue_head(sk); +	tcp_sk(sk)->highest_sack = tcp_rtx_queue_head(sk);  } -/* Called when old skb is about to be deleted (to be combined with new skb) */ -static inline void tcp_highest_sack_combine(struct sock *sk, +/* Called when old skb is about to be deleted and replaced by new skb */ +static inline void tcp_highest_sack_replace(struct sock *sk,  					    struct sk_buff *old,  					    struct sk_buff *new)  { -	if (tcp_sk(sk)->sacked_out && (old == tcp_sk(sk)->highest_sack)) +	if (old == tcp_highest_sack(sk))  		tcp_sk(sk)->highest_sack = new;  } @@ -1928,11 +1877,12 @@ extern void tcp_rack_mark_lost(struct sock *sk);  extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,  			     u64 xmit_time);  extern void tcp_rack_reo_timeout(struct sock *sk); +extern void tcp_rack_update_reo_wnd(struct sock *sk, struct rate_sample *rs);  /* At how many usecs into the future should the RTO fire? */  static inline s64 tcp_rto_delta_us(const struct sock *sk)  { -	const struct sk_buff *skb = tcp_write_queue_head(sk); +	const struct sk_buff *skb = tcp_rtx_queue_head(sk);  	u32 rto = inet_csk(sk)->icsk_rto;  	u64 rto_time_stamp_us = skb->skb_mstamp + jiffies_to_usecs(rto); @@ -2109,4 +2059,8 @@ static inline bool tcp_bpf_ca_needs_ecn(struct sock *sk)  {  	return (tcp_call_bpf(sk, BPF_SOCK_OPS_NEEDS_ECN) == 1);  } + +#if IS_ENABLED(CONFIG_SMC) +extern struct static_key_false tcp_have_smc; +#endif  #endif	/* _TCP_H */ diff --git a/include/net/tipc.h b/include/net/tipc.h new file mode 100644 index 000000000000..07670ec022a7 --- /dev/null +++ b/include/net/tipc.h @@ -0,0 +1,62 @@ +/* + * include/net/tipc.h: Include file for TIPC message header routines + * + * Copyright (c) 2017 Ericsson AB + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of its + *    contributors may be used to endorse or promote products derived from + *    this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _TIPC_HDR_H +#define _TIPC_HDR_H + +#include <linux/random.h> + +#define KEEPALIVE_MSG_MASK 0x0e080000  /* LINK_PROTOCOL + MSG_IS_KEEPALIVE */ + +struct tipc_basic_hdr { +	__be32 w[4]; +}; + +static inline u32 tipc_hdr_rps_key(struct tipc_basic_hdr *hdr) +{ +	u32 w0 = ntohl(hdr->w[0]); +	bool keepalive_msg = (w0 & KEEPALIVE_MSG_MASK) == KEEPALIVE_MSG_MASK; +	int key; + +	/* Return source node identity as key */ +	if (likely(!keepalive_msg)) +		return hdr->w[3]; + +	/* Spread PROBE/PROBE_REPLY messages across the cores */ +	get_random_bytes(&key, sizeof(key)); +	return key; +} + +#endif diff --git a/include/net/tls.h b/include/net/tls.h index b89d397dd62f..936cfc5cab7d 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -35,6 +35,10 @@  #define _TLS_OFFLOAD_H  #include <linux/types.h> +#include <asm/byteorder.h> +#include <linux/socket.h> +#include <linux/tcp.h> +#include <net/tcp.h>  #include <uapi/linux/tls.h> @@ -83,6 +87,8 @@ struct tls_context {  	void *priv_ctx; +	u8 tx_conf:2; +  	u16 prepend_size;  	u16 tag_size;  	u16 overhead_size; @@ -97,7 +103,6 @@ struct tls_context {  	u16 pending_open_record_frags;  	int (*push_pending_record)(struct sock *sk, int flags); -	void (*free_resources)(struct sock *sk);  	void (*sk_write_space)(struct sock *sk);  	void (*sk_proto_close)(struct sock *sk, long timeout); @@ -122,6 +127,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);  int tls_sw_sendpage(struct sock *sk, struct page *page,  		    int offset, size_t size, int flags);  void tls_sw_close(struct sock *sk, long timeout); +void tls_sw_free_tx_resources(struct sock *sk);  void tls_sk_destruct(struct sock *sk, struct tls_context *ctx);  void tls_icsk_clean_acked(struct sock *sk); @@ -212,6 +218,21 @@ static inline void tls_fill_prepend(struct tls_context *ctx,  	       ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, iv_size);  } +static inline void tls_make_aad(char *buf, +				size_t size, +				char *record_sequence, +				int record_sequence_size, +				unsigned char record_type) +{ +	memcpy(buf, record_sequence, record_sequence_size); + +	buf[8] = record_type; +	buf[9] = TLS_1_2_VERSION_MAJOR; +	buf[10] = TLS_1_2_VERSION_MINOR; +	buf[11] = size >> 8; +	buf[12] = size & 0xFF; +} +  static inline struct tls_context *tls_get_ctx(const struct sock *sk)  {  	struct inet_connection_sock *icsk = inet_csk(sk); diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 276f9760ab56..c4f5caaf3778 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _TRANSP_V6_H  #define _TRANSP_V6_H diff --git a/include/net/tso.h b/include/net/tso.h index 9a56c39e6d0a..7e166a570349 100644 --- a/include/net/tso.h +++ b/include/net/tso.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _TSO_H  #define _TSO_H diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index 10cce0dd4450..b95a6927c718 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_UDP_TUNNEL_H  #define __NET_UDP_TUNNEL_H diff --git a/include/net/udplite.h b/include/net/udplite.h index b7a18f63d86d..81bdbf97319b 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Definitions for the UDP-Lite (RFC 3828) code.   */ diff --git a/include/net/vxlan.h b/include/net/vxlan.h index 4e3876dde295..13223396dc64 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_VXLAN_H  #define __NET_VXLAN_H 1 diff --git a/include/net/wext.h b/include/net/wext.h index 454ff763eeba..e51f067fdb3a 100644 --- a/include/net/wext.h +++ b/include/net/wext.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __NET_WEXT_H  #define __NET_WEXT_H diff --git a/include/net/x25.h b/include/net/x25.h index 2609b57bd459..ed1acc3044ac 100644 --- a/include/net/x25.h +++ b/include/net/x25.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   *	Declarations of X.25 Packet Layer type objects.   * diff --git a/include/net/x25device.h b/include/net/x25device.h index 1fa08b49f1c2..cf749efca24d 100644 --- a/include/net/x25device.h +++ b/include/net/x25device.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _X25DEVICE_H  #define _X25DEVICE_H diff --git a/include/net/xfrm.h b/include/net/xfrm.h index f002a2c5e33c..dc28a98ce97c 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _NET_XFRM_H  #define _NET_XFRM_H @@ -1764,22 +1765,22 @@ static inline int xfrm_acquire_is_on(struct net *net)  }  #endif -static inline int aead_len(struct xfrm_algo_aead *alg) +static inline unsigned int aead_len(struct xfrm_algo_aead *alg)  {  	return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);  } -static inline int xfrm_alg_len(const struct xfrm_algo *alg) +static inline unsigned int xfrm_alg_len(const struct xfrm_algo *alg)  {  	return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);  } -static inline int xfrm_alg_auth_len(const struct xfrm_algo_auth *alg) +static inline unsigned int xfrm_alg_auth_len(const struct xfrm_algo_auth *alg)  {  	return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);  } -static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay_esn) +static inline unsigned int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay_esn)  {  	return sizeof(*replay_esn) + replay_esn->bmp_len * sizeof(__u32);  } diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h index 429f46fb61e4..9c689868eb4d 100644 --- a/include/ras/ras_event.h +++ b/include/ras/ras_event.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM ras  #define TRACE_INCLUDE_FILE ras_event diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index ec5008cf5d51..18c564f60e93 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h @@ -125,8 +125,9 @@ int rdma_resolve_ip_route(struct sockaddr *src_addr,  void rdma_addr_cancel(struct rdma_dev_addr *addr); -int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, -	      const unsigned char *dst_dev_addr); +void rdma_copy_addr(struct rdma_dev_addr *dev_addr, +		    const struct net_device *dev, +		    const unsigned char *dst_dev_addr);  int rdma_addr_size(struct sockaddr *addr); @@ -245,10 +246,11 @@ static inline void rdma_addr_set_dgid(struct rdma_dev_addr *dev_addr, union ib_g  static inline enum ib_mtu iboe_get_mtu(int mtu)  {  	/* -	 * reduce IB headers from effective IBoE MTU. 28 stands for -	 * atomic header which is the biggest possible header after BTH +	 * Reduce IB headers from effective IBoE MTU.  	 */ -	mtu = mtu - IB_GRH_BYTES - IB_BTH_BYTES - 28; +	mtu = mtu - (IB_GRH_BYTES + IB_UDP_BYTES + IB_BTH_BYTES + +		     IB_EXT_XRC_BYTES + IB_EXT_ATOMICETH_BYTES + +		     IB_ICRC_BYTES);  	if (mtu >= ib_mtu_enum_to_int(IB_MTU_4096))  		return IB_MTU_4096; @@ -305,12 +307,12 @@ static inline void rdma_get_ll_mac(struct in6_addr *addr, u8 *mac)  static inline int rdma_is_multicast_addr(struct in6_addr *addr)  { -	u32 ipv4_addr; +	__be32 ipv4_addr;  	if (addr->s6_addr[0] == 0xff)  		return 1; -	memcpy(&ipv4_addr, addr->s6_addr + 12, 4); +	ipv4_addr = addr->s6_addr32[3];  	return (ipv6_addr_v4mapped(addr) && ipv4_is_multicast(ipv4_addr));  } diff --git a/include/rdma/ib_pack.h b/include/rdma/ib_pack.h index 36655899ee02..7ea1382ad0e5 100644 --- a/include/rdma/ib_pack.h +++ b/include/rdma/ib_pack.h @@ -37,14 +37,17 @@  #include <uapi/linux/if_ether.h>  enum { -	IB_LRH_BYTES  = 8, -	IB_ETH_BYTES  = 14, -	IB_VLAN_BYTES = 4, -	IB_GRH_BYTES  = 40, -	IB_IP4_BYTES  = 20, -	IB_UDP_BYTES  = 8, -	IB_BTH_BYTES  = 12, -	IB_DETH_BYTES = 8 +	IB_LRH_BYTES		= 8, +	IB_ETH_BYTES		= 14, +	IB_VLAN_BYTES		= 4, +	IB_GRH_BYTES		= 40, +	IB_IP4_BYTES		= 20, +	IB_UDP_BYTES		= 8, +	IB_BTH_BYTES		= 12, +	IB_DETH_BYTES		= 8, +	IB_EXT_ATOMICETH_BYTES	= 28, +	IB_EXT_XRC_BYTES	= 4, +	IB_ICRC_BYTES		= 4  };  struct ib_field { diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index 355b81f4242d..1f7f604db5aa 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h @@ -590,20 +590,20 @@ static inline bool sa_path_is_roce(struct sa_path_rec *rec)  		(rec->rec_type == SA_PATH_REC_TYPE_ROCE_V2));  } -static inline void sa_path_set_slid(struct sa_path_rec *rec, __be32 slid) +static inline void sa_path_set_slid(struct sa_path_rec *rec, u32 slid)  {  	if (rec->rec_type == SA_PATH_REC_TYPE_IB) -		rec->ib.slid = htons(ntohl(slid)); +		rec->ib.slid = cpu_to_be16(slid);  	else if (rec->rec_type == SA_PATH_REC_TYPE_OPA) -		rec->opa.slid = slid; +		rec->opa.slid = cpu_to_be32(slid);  } -static inline void sa_path_set_dlid(struct sa_path_rec *rec, __be32 dlid) +static inline void sa_path_set_dlid(struct sa_path_rec *rec, u32 dlid)  {  	if (rec->rec_type == SA_PATH_REC_TYPE_IB) -		rec->ib.dlid = htons(ntohl(dlid)); +		rec->ib.dlid = cpu_to_be16(dlid);  	else if (rec->rec_type == SA_PATH_REC_TYPE_OPA) -		rec->opa.dlid = dlid; +		rec->opa.dlid = cpu_to_be32(dlid);  }  static inline void sa_path_set_raw_traffic(struct sa_path_rec *rec, diff --git a/include/rdma/ib_umem_odp.h b/include/rdma/ib_umem_odp.h index 5eb7f5bc8248..6a17f856f841 100644 --- a/include/rdma/ib_umem_odp.h +++ b/include/rdma/ib_umem_odp.h @@ -111,10 +111,6 @@ int ib_umem_odp_map_dma_pages(struct ib_umem *umem, u64 start_offset, u64 bcnt,  void ib_umem_odp_unmap_dma_pages(struct ib_umem *umem, u64 start_offset,  				 u64 bound); -void rbt_ib_umem_insert(struct umem_odp_node *node, -			struct rb_root_cached *root); -void rbt_ib_umem_remove(struct umem_odp_node *node, -			struct rb_root_cached *root);  typedef int (*umem_call_back)(struct ib_umem *item, u64 start, u64 end,  			      void *cookie);  /* diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index e8608b2dc844..fd84cda5ed7c 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -229,6 +229,8 @@ enum ib_device_cap_flags {  	/* Deprecated. Please use IB_RAW_PACKET_CAP_SCATTER_FCS. */  	IB_DEVICE_RAW_SCATTER_FCS		= (1ULL << 34),  	IB_DEVICE_RDMA_NETDEV_OPA_VNIC		= (1ULL << 35), +	/* The device supports padding incoming writes to cacheline. */ +	IB_DEVICE_PCI_WRITE_END_PADDING		= (1ULL << 36),  };  enum ib_signature_prot_cap { @@ -309,6 +311,15 @@ struct ib_cq_init_attr {  	u32		flags;  }; +enum ib_cq_attr_mask { +	IB_CQ_MODERATE = 1 << 0, +}; + +struct ib_cq_caps { +	u16     max_cq_moderation_count; +	u16     max_cq_moderation_period; +}; +  struct ib_device_attr {  	u64			fw_ver;  	__be64			sys_image_guid; @@ -359,6 +370,7 @@ struct ib_device_attr {  	u32			max_wq_type_rq;  	u32			raw_packet_caps; /* Use ib_raw_packet_caps enum */  	struct ib_tm_caps	tm_caps; +	struct ib_cq_caps       cq_caps;  };  enum ib_mtu { @@ -1098,6 +1110,7 @@ enum ib_qp_create_flags {  	IB_QP_CREATE_SCATTER_FCS		= 1 << 8,  	IB_QP_CREATE_CVLAN_STRIPPING		= 1 << 9,  	IB_QP_CREATE_SOURCE_QPN			= 1 << 10, +	IB_QP_CREATE_PCI_WRITE_END_PADDING	= 1 << 11,  	/* reserve bits 26-31 for low level drivers' internal use */  	IB_QP_CREATE_RESERVED_START		= 1 << 26,  	IB_QP_CREATE_RESERVED_END		= 1 << 31, @@ -1621,6 +1634,7 @@ enum ib_wq_flags {  	IB_WQ_FLAGS_CVLAN_STRIPPING	= 1 << 0,  	IB_WQ_FLAGS_SCATTER_FCS		= 1 << 1,  	IB_WQ_FLAGS_DELAY_DROP		= 1 << 2, +	IB_WQ_FLAGS_PCI_WRITE_END_PADDING = 1 << 3,  };  struct ib_wq_init_attr { @@ -2858,6 +2872,21 @@ void ib_dealloc_pd(struct ib_pd *pd);  struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr);  /** + * rdma_create_user_ah - Creates an address handle for the given address vector. + * It resolves destination mac address for ah attribute of RoCE type. + * @pd: The protection domain associated with the address handle. + * @ah_attr: The attributes of the address vector. + * @udata: pointer to user's input output buffer information need by + *         provider driver. + * + * It returns 0 on success and returns appropriate error code on error. + * The address handle is used to reference a local or global destination + * in all UD QP post sends. + */ +struct ib_ah *rdma_create_user_ah(struct ib_pd *pd, +				  struct rdma_ah_attr *ah_attr, +				  struct ib_udata *udata); +/**   * ib_get_gids_from_rdma_hdr - Get sgid and dgid from GRH or IPv4 header   *   work completion.   * @hdr: the L3 header to parse @@ -3140,13 +3169,13 @@ struct ib_cq *ib_create_cq(struct ib_device *device,  int ib_resize_cq(struct ib_cq *cq, int cqe);  /** - * ib_modify_cq - Modifies moderation params of the CQ + * rdma_set_cq_moderation - Modifies moderation params of the CQ   * @cq: The CQ to modify.   * @cq_count: number of CQEs that will trigger an event   * @cq_period: max period of time in usec before triggering an event   *   */ -int ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period); +int rdma_set_cq_moderation(struct ib_cq *cq, u16 cq_count, u16 cq_period);  /**   * ib_destroy_cq - Destroys the specified CQ. @@ -3607,8 +3636,6 @@ void ib_drain_rq(struct ib_qp *qp);  void ib_drain_sq(struct ib_qp *qp);  void ib_drain_qp(struct ib_qp *qp); -int ib_resolve_eth_dmac(struct ib_device *device, -			struct rdma_ah_attr *ah_attr);  int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width);  static inline u8 *rdma_ah_retrieve_dmac(struct rdma_ah_attr *attr) diff --git a/include/rdma/opa_addr.h b/include/rdma/opa_addr.h index e6e90f18e6d5..f68fca296631 100644 --- a/include/rdma/opa_addr.h +++ b/include/rdma/opa_addr.h @@ -97,15 +97,15 @@ static inline u32 opa_get_lid_from_gid(const union ib_gid *gid)   * @dlid: The DLID   * @slid: The SLID   */ -static inline bool opa_is_extended_lid(u32 dlid, u32 slid) +static inline bool opa_is_extended_lid(__be32 dlid, __be32 slid)  {  	if ((be32_to_cpu(dlid) >=  	     be16_to_cpu(IB_MULTICAST_LID_BASE)) ||  	    (be32_to_cpu(slid) >=  	     be16_to_cpu(IB_MULTICAST_LID_BASE)))  		return true; -	else -		return false; + +	return false;  }  /* Get multicast lid base */ diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h index 2d878596b1e0..c369703fcd69 100644 --- a/include/rdma/rdma_netlink.h +++ b/include/rdma/rdma_netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _RDMA_NETLINK_H  #define _RDMA_NETLINK_H diff --git a/include/rdma/rdmavt_qp.h b/include/rdma/rdmavt_qp.h index 0eed3d8752fa..89ab88c342b6 100644 --- a/include/rdma/rdmavt_qp.h +++ b/include/rdma/rdmavt_qp.h @@ -282,7 +282,6 @@ struct rvt_qp {  	u32 remote_qpn;  	u32 qkey;               /* QKEY for this QP (for UD or RD) */  	u32 s_size;             /* send work queue size */ -	u32 s_ahgpsn;           /* set to the psn in the copy of the header */  	u16 pmtu;		/* decoded from path_mtu */  	u8 log_pmtu;		/* shift for pmtu */ @@ -344,7 +343,6 @@ struct rvt_qp {  	struct rvt_swqe *s_wqe;  	struct rvt_sge_state s_sge;     /* current send request data */  	struct rvt_mregion *s_rdma_mr; -	u32 s_cur_size;         /* size of send packet in bytes */  	u32 s_len;              /* total length of s_sge */  	u32 s_rdma_read_len;    /* total length of s_rdma_read_sge */  	u32 s_last_psn;         /* last response PSN processed */ @@ -358,8 +356,10 @@ struct rvt_qp {  	u32 s_acked;            /* last un-ACK'ed entry */  	u32 s_last;             /* last completed entry */  	u32 s_lsn;              /* limit sequence number (credit) */ -	u16 s_hdrwords;         /* size of s_hdr in 32 bit words */ +	u32 s_ahgpsn;           /* set to the psn in the copy of the header */ +	u16 s_cur_size;         /* size of send packet in bytes */  	u16 s_rdma_ack_cnt; +	u8 s_hdrwords;         /* size of s_hdr in 32 bit words */  	s8 s_ahgidx;  	u8 s_state;             /* opcode of last packet sent */  	u8 s_ack_state;         /* opcode of packet to ACK */ diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 722d3264d3bf..cb8a273732cf 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h @@ -382,7 +382,7 @@ static inline struct net_device *fcoe_get_netdev(const struct fc_lport *lport)  void fcoe_clean_pending_queue(struct fc_lport *);  void fcoe_check_wait_queue(struct fc_lport *lport, struct sk_buff *skb); -void fcoe_queue_timer(ulong lport); +void fcoe_queue_timer(struct timer_list *t);  int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen,  			   struct fcoe_percpu_s *fps); diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 6c0dc6155ee7..0f9cbf96c093 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -60,38 +60,32 @@ enum sas_phy_type {   * so when updating/adding events here, please also   * update the other file too.   */ -enum ha_event { -	HAE_RESET             = 0U, -	HA_NUM_EVENTS         = 1, -}; -  enum port_event {  	PORTE_BYTES_DMAED     = 0U, -	PORTE_BROADCAST_RCVD  = 1, -	PORTE_LINK_RESET_ERR  = 2, -	PORTE_TIMER_EVENT     = 3, -	PORTE_HARD_RESET      = 4, -	PORT_NUM_EVENTS       = 5, +	PORTE_BROADCAST_RCVD, +	PORTE_LINK_RESET_ERR, +	PORTE_TIMER_EVENT, +	PORTE_HARD_RESET, +	PORT_NUM_EVENTS,  };  enum phy_event {  	PHYE_LOSS_OF_SIGNAL   = 0U, -	PHYE_OOB_DONE         = 1, -	PHYE_OOB_ERROR        = 2, -	PHYE_SPINUP_HOLD      = 3, /* hot plug SATA, no COMWAKE sent */ -	PHYE_RESUME_TIMEOUT   = 4, -	PHY_NUM_EVENTS        = 5, +	PHYE_OOB_DONE, +	PHYE_OOB_ERROR, +	PHYE_SPINUP_HOLD,             /* hot plug SATA, no COMWAKE sent */ +	PHYE_RESUME_TIMEOUT, +	PHY_NUM_EVENTS,  };  enum discover_event {  	DISCE_DISCOVER_DOMAIN   = 0U, -	DISCE_REVALIDATE_DOMAIN = 1, -	DISCE_PORT_GONE         = 2, -	DISCE_PROBE		= 3, -	DISCE_SUSPEND		= 4, -	DISCE_RESUME		= 5, -	DISCE_DESTRUCT		= 6, -	DISC_NUM_EVENTS		= 7, +	DISCE_REVALIDATE_DOMAIN, +	DISCE_PROBE, +	DISCE_SUSPEND, +	DISCE_RESUME, +	DISCE_DESTRUCT, +	DISC_NUM_EVENTS,  };  /* ---------- Expander Devices ---------- */ @@ -261,8 +255,6 @@ struct sas_discovery {  /* The port struct is Class:RW, driver:RO */  struct asd_sas_port {  /* private: */ -	struct completion port_gone_completion; -  	struct sas_discovery disc;  	struct domain_device *port_dev;  	spinlock_t dev_list_lock; @@ -362,18 +354,6 @@ struct scsi_core {  }; -struct sas_ha_event { -	struct sas_work work; -	struct sas_ha_struct *ha; -}; - -static inline struct sas_ha_event *to_sas_ha_event(struct work_struct *work) -{ -	struct sas_ha_event *ev = container_of(work, typeof(*ev), work.work); - -	return ev; -} -  enum sas_ha_state {  	SAS_HA_REGISTERED,  	SAS_HA_DRAINING, @@ -383,9 +363,6 @@ enum sas_ha_state {  struct sas_ha_struct {  /* private: */ -	struct sas_ha_event ha_events[HA_NUM_EVENTS]; -	unsigned long	 pending; -  	struct list_head  defer_q; /* work queued while draining */  	struct mutex	  drain_mutex;  	unsigned long	  state; @@ -415,7 +392,6 @@ struct sas_ha_struct {  				* their siblings when forming wide ports */  	/* LLDD calls these to notify the class of an event. */ -	int (*notify_ha_event)(struct sas_ha_struct *, enum ha_event);  	int (*notify_port_event)(struct asd_sas_phy *, enum port_event);  	int (*notify_phy_event)(struct asd_sas_phy *, enum phy_event); @@ -629,6 +605,7 @@ struct sas_task_slow {  	 */  	struct timer_list     timer;  	struct completion     completion; +	struct sas_task       *task;  };  #define SAS_TASK_STATE_PENDING      1 diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h index 303ba1118a4d..8a6acd054e4e 100644 --- a/include/scsi/osd_attributes.h +++ b/include/scsi/osd_attributes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __OSD_ATTRIBUTES_H__  #define __OSD_ATTRIBUTES_H__ diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index a1e1930b7a87..cb85eddb47ea 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header file contains public constants and structures used by   * the SCSI initiator code. diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 3d3f8b342e05..7fb57e905526 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_CMND_H  #define _SCSI_SCSI_CMND_H diff --git a/include/scsi/scsi_common.h b/include/scsi/scsi_common.h index 20bf7eaef05a..731ac09ed231 100644 --- a/include/scsi/scsi_common.h +++ b/include/scsi/scsi_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Functions used by both the SCSI initiator code and the SCSI target code.   */ diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index 56710e03101c..04e0679767f6 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_DBG_H  #define _SCSI_SCSI_DBG_H diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 67c5a9f223f7..7ae177c8e399 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_DEVICE_H  #define _SCSI_SCSI_DEVICE_H @@ -14,6 +15,8 @@ struct scsi_cmnd;  struct scsi_lun;  struct scsi_sense_hdr; +typedef unsigned int __bitwise blist_flags_t; +  struct scsi_mode_data {  	__u32	length;  	__u16	block_descriptor_length; @@ -64,9 +67,10 @@ enum scsi_device_event {  	SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED,	/* 2A 01  UA reported */  	SDEV_EVT_LUN_CHANGE_REPORTED,			/* 3F 0E  UA reported */  	SDEV_EVT_ALUA_STATE_CHANGE_REPORTED,		/* 2A 06  UA reported */ +	SDEV_EVT_POWER_ON_RESET_OCCURRED,		/* 29 00  UA reported */  	SDEV_EVT_FIRST		= SDEV_EVT_MEDIA_CHANGE, -	SDEV_EVT_LAST		= SDEV_EVT_ALUA_STATE_CHANGE_REPORTED, +	SDEV_EVT_LAST		= SDEV_EVT_POWER_ON_RESET_OCCURRED,  	SDEV_EVT_MAXBITS	= SDEV_EVT_LAST + 1  }; @@ -139,7 +143,7 @@ struct scsi_device {  	unsigned char current_tag;	/* current tag */  	struct scsi_target      *sdev_target;   /* used only for single_lun */ -	unsigned int	sdev_bflags; /* black/white flags as also found in +	blist_flags_t		sdev_bflags; /* black/white flags as also found in  				 * scsi_devinfo.[hc]. For now used only to  				 * pass settings from slave_alloc to scsi  				 * core. */ @@ -220,6 +224,7 @@ struct scsi_device {  	unsigned char		access_state;  	struct mutex		state_mutex;  	enum scsi_device_state sdev_state; +	struct task_struct	*quiesced_by;  	unsigned long		sdev_data[0];  } __attribute__((aligned(sizeof(unsigned long)))); diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h index 36b03013d629..ea67c32e870e 100644 --- a/include/scsi/scsi_devinfo.h +++ b/include/scsi/scsi_devinfo.h @@ -1,34 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_DEVINFO_H  #define _SCSI_SCSI_DEVINFO_H  /*   * Flags for SCSI devices that need special treatment   */ -#define BLIST_NOLUN     	0x001	/* Only scan LUN 0 */ -#define BLIST_FORCELUN  	0x002	/* Known to have LUNs, force scanning, -					   deprecated: Use max_luns=N */ -#define BLIST_BORKEN    	0x004	/* Flag for broken handshaking */ -#define BLIST_KEY       	0x008	/* unlock by special command */ -#define BLIST_SINGLELUN 	0x010	/* Do not use LUNs in parallel */ -#define BLIST_NOTQ		0x020	/* Buggy Tagged Command Queuing */ -#define BLIST_SPARSELUN 	0x040	/* Non consecutive LUN numbering */ -#define BLIST_MAX5LUN		0x080	/* Avoid LUNS >= 5 */ -#define BLIST_ISROM     	0x100	/* Treat as (removable) CD-ROM */ -#define BLIST_LARGELUN		0x200	/* LUNs past 7 on a SCSI-2 device */ -#define BLIST_INQUIRY_36	0x400	/* override additional length field */ -#define BLIST_NOSTARTONADD	0x1000	/* do not do automatic start on add */ -#define BLIST_REPORTLUN2	0x20000	/* try REPORT_LUNS even for SCSI-2 devs - 					   (if HBA supports more than 8 LUNs) */ -#define BLIST_NOREPORTLUN	0x40000	/* don't try REPORT_LUNS scan (SCSI-3 devs) */ -#define BLIST_NOT_LOCKABLE	0x80000	/* don't use PREVENT-ALLOW commands */ -#define BLIST_NO_ULD_ATTACH	0x100000 /* device is actually for RAID config */ -#define BLIST_SELECT_NO_ATN	0x200000 /* select without ATN */ -#define BLIST_RETRY_HWERROR	0x400000 /* retry HARDWARE_ERROR */ -#define BLIST_MAX_512		0x800000 /* maximum 512 sector cdb length */ -#define BLIST_NO_DIF		0x2000000 /* Disable T10 PI (DIF) */ -#define BLIST_SKIP_VPD_PAGES	0x4000000 /* Ignore SBC-3 VPD pages */ -#define BLIST_TRY_VPD_PAGES	0x10000000 /* Attempt to read VPD pages */ -#define BLIST_NO_RSOC		0x20000000 /* don't try to issue RSOC */ -#define BLIST_MAX_1024		0x40000000 /* maximum 1024 sector cdb length */ -#define BLIST_UNMAP_LIMIT_WS	0x80000000 /* Use UNMAP limit for WRITE SAME */ + +/* Only scan LUN 0 */ +#define BLIST_NOLUN		((__force blist_flags_t)(1 << 0)) +/* Known to have LUNs, force scanning. + * DEPRECATED: Use max_luns=N */ +#define BLIST_FORCELUN		((__force blist_flags_t)(1 << 1)) +/* Flag for broken handshaking */ +#define BLIST_BORKEN		((__force blist_flags_t)(1 << 2)) +/* unlock by special command */ +#define BLIST_KEY		((__force blist_flags_t)(1 << 3)) +/* Do not use LUNs in parallel */ +#define BLIST_SINGLELUN		((__force blist_flags_t)(1 << 4)) +/* Buggy Tagged Command Queuing */ +#define BLIST_NOTQ		((__force blist_flags_t)(1 << 5)) +/* Non consecutive LUN numbering */ +#define BLIST_SPARSELUN		((__force blist_flags_t)(1 << 6)) +/* Avoid LUNS >= 5 */ +#define BLIST_MAX5LUN		((__force blist_flags_t)(1 << 7)) +/* Treat as (removable) CD-ROM */ +#define BLIST_ISROM		((__force blist_flags_t)(1 << 8)) +/* LUNs past 7 on a SCSI-2 device */ +#define BLIST_LARGELUN		((__force blist_flags_t)(1 << 9)) +/* override additional length field */ +#define BLIST_INQUIRY_36	((__force blist_flags_t)(1 << 10)) +/* do not do automatic start on add */ +#define BLIST_NOSTARTONADD	((__force blist_flags_t)(1 << 12)) +/* try REPORT_LUNS even for SCSI-2 devs (if HBA supports more than 8 LUNs) */ +#define BLIST_REPORTLUN2	((__force blist_flags_t)(1 << 17)) +/* don't try REPORT_LUNS scan (SCSI-3 devs) */ +#define BLIST_NOREPORTLUN	((__force blist_flags_t)(1 << 18)) +/* don't use PREVENT-ALLOW commands */ +#define BLIST_NOT_LOCKABLE	((__force blist_flags_t)(1 << 19)) +/* device is actually for RAID config */ +#define BLIST_NO_ULD_ATTACH	((__force blist_flags_t)(1 << 20)) +/* select without ATN */ +#define BLIST_SELECT_NO_ATN	((__force blist_flags_t)(1 << 21)) +/* retry HARDWARE_ERROR */ +#define BLIST_RETRY_HWERROR	((__force blist_flags_t)(1 << 22)) +/* maximum 512 sector cdb length */ +#define BLIST_MAX_512		((__force blist_flags_t)(1 << 23)) +/* Disable T10 PI (DIF) */ +#define BLIST_NO_DIF		((__force blist_flags_t)(1 << 25)) +/* Ignore SBC-3 VPD pages */ +#define BLIST_SKIP_VPD_PAGES	((__force blist_flags_t)(1 << 26)) +/* Attempt to read VPD pages */ +#define BLIST_TRY_VPD_PAGES	((__force blist_flags_t)(1 << 28)) +/* don't try to issue RSOC */ +#define BLIST_NO_RSOC		((__force blist_flags_t)(1 << 29)) +/* maximum 1024 sector cdb length */ +#define BLIST_MAX_1024		((__force blist_flags_t)(1 << 30)) +/* Use UNMAP limit for WRITE SAME */ +#define BLIST_UNMAP_LIMIT_WS	((__force blist_flags_t)(1 << 31))  #endif diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h index a5534ccad859..fae8b465233e 100644 --- a/include/scsi/scsi_driver.h +++ b/include/scsi/scsi_driver.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_DRIVER_H  #define _SCSI_SCSI_DRIVER_H diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h index 64d30d80dadb..2b7e227960e1 100644 --- a/include/scsi/scsi_eh.h +++ b/include/scsi/scsi_eh.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_EH_H  #define _SCSI_SCSI_EH_H diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 0a804b1a4726..a8b7bf879ced 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_HOST_H  #define _SCSI_SCSI_HOST_H diff --git a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h index 8d19d1d233c3..5101e987c0ef 100644 --- a/include/scsi/scsi_ioctl.h +++ b/include/scsi/scsi_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_IOCTL_H  #define _SCSI_IOCTL_H  diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h index 8c285d9a06d8..1df8efb0ee01 100644 --- a/include/scsi/scsi_proto.h +++ b/include/scsi/scsi_proto.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * This header file contains public constants and structures used by   * both the SCSI initiator and the SCSI target code. @@ -301,19 +302,42 @@ struct scsi_lun {  /* Reporting options for REPORT ZONES */  enum zbc_zone_reporting_options { -	ZBC_ZONE_REPORTING_OPTION_ALL = 0, -	ZBC_ZONE_REPORTING_OPTION_EMPTY, -	ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPEN, -	ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPEN, -	ZBC_ZONE_REPORTING_OPTION_CLOSED, -	ZBC_ZONE_REPORTING_OPTION_FULL, -	ZBC_ZONE_REPORTING_OPTION_READONLY, -	ZBC_ZONE_REPORTING_OPTION_OFFLINE, -	ZBC_ZONE_REPORTING_OPTION_NEED_RESET_WP = 0x10, -	ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE, -	ZBC_ZONE_REPORTING_OPTION_NON_WP = 0x3f, +	ZBC_ZONE_REPORTING_OPTION_ALL		= 0x00, +	ZBC_ZONE_REPORTING_OPTION_EMPTY		= 0x01, +	ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPEN	= 0x02, +	ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPEN	= 0x03, +	ZBC_ZONE_REPORTING_OPTION_CLOSED	= 0x04, +	ZBC_ZONE_REPORTING_OPTION_FULL		= 0x05, +	ZBC_ZONE_REPORTING_OPTION_READONLY	= 0x06, +	ZBC_ZONE_REPORTING_OPTION_OFFLINE	= 0x07, +	/* 0x08 to 0x0f are reserved */ +	ZBC_ZONE_REPORTING_OPTION_NEED_RESET_WP	= 0x10, +	ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE	= 0x11, +	/* 0x12 to 0x3e are reserved */ +	ZBC_ZONE_REPORTING_OPTION_NON_WP	= 0x3f,  };  #define ZBC_REPORT_ZONE_PARTIAL 0x80 +/* Zone types of REPORT ZONES zone descriptors */ +enum zbc_zone_type { +	ZBC_ZONE_TYPE_CONV		= 0x1, +	ZBC_ZONE_TYPE_SEQWRITE_REQ	= 0x2, +	ZBC_ZONE_TYPE_SEQWRITE_PREF	= 0x3, +	/* 0x4 to 0xf are reserved */ +}; + +/* Zone conditions of REPORT ZONES zone descriptors */ +enum zbc_zone_cond { +	ZBC_ZONE_COND_NO_WP		= 0x0, +	ZBC_ZONE_COND_EMPTY		= 0x1, +	ZBC_ZONE_COND_IMP_OPEN		= 0x2, +	ZBC_ZONE_COND_EXP_OPEN		= 0x3, +	ZBC_ZONE_COND_CLOSED		= 0x4, +	/* 0x5 to 0xc are reserved */ +	ZBC_ZONE_COND_READONLY		= 0xd, +	ZBC_ZONE_COND_FULL		= 0xe, +	ZBC_ZONE_COND_OFFLINE		= 0xf, +}; +  #endif /* _SCSI_PROTO_H_ */ diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h index e0afa445ee4e..b06f28c74908 100644 --- a/include/scsi/scsi_request.h +++ b/include/scsi/scsi_request.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_REQUEST_H  #define _SCSI_SCSI_REQUEST_H diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index 5b416debf101..e192a0caa850 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_SCSI_TCQ_H  #define _SCSI_SCSI_TCQ_H diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index e8644eea9fe5..8cf30215c177 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -139,6 +139,8 @@ enum fc_vport_state {  #define FC_PORTSPEED_50GBIT		0x200  #define FC_PORTSPEED_100GBIT		0x400  #define FC_PORTSPEED_25GBIT		0x800 +#define FC_PORTSPEED_64BIT		0x1000 +#define FC_PORTSPEED_128BIT		0x2000  #define FC_PORTSPEED_NOT_NEGOTIATED	(1 << 15) /* Speed not established */  /* diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index a23304b7fb2e..62895b405933 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef SCSI_TRANSPORT_SAS_H  #define SCSI_TRANSPORT_SAS_H diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h index 56ae198acc73..d22df12584f9 100644 --- a/include/scsi/scsi_transport_srp.h +++ b/include/scsi/scsi_transport_srp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef SCSI_TRANSPORT_SRP_H  #define SCSI_TRANSPORT_SRP_H diff --git a/include/scsi/scsicam.h b/include/scsi/scsicam.h index 24ede474752e..57c729254569 100644 --- a/include/scsi/scsicam.h +++ b/include/scsi/scsicam.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * scsicam.h - SCSI CAM support functions, use for HDIO_GETGEO, etc.   * diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 20bc71c3e0b8..f91bcca604e4 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SCSI_GENERIC_H  #define _SCSI_GENERIC_H diff --git a/include/soc/at91/atmel-sfr.h b/include/soc/at91/atmel-sfr.h index 506ea8ffda19..482337af06b8 100644 --- a/include/soc/at91/atmel-sfr.h +++ b/include/soc/at91/atmel-sfr.h @@ -17,6 +17,7 @@  /* 0x08 ~ 0x0c: Reserved */  #define AT91_SFR_OHCIICR	0x10	/* OHCI INT Configuration Register */  #define AT91_SFR_OHCIISR	0x14	/* OHCI INT Status Register */ +#define AT91_SFR_UTMICKTRIM	0x30	/* UTMI Clock Trimming Register */  #define AT91_SFR_I2SCLKSEL	0x90	/* I2SC Register */  /* Field definitions */ @@ -28,5 +29,6 @@  					 AT91_OHCIICR_SUSPEND_B | \  					 AT91_OHCIICR_SUSPEND_C) +#define AT91_UTMICKTRIM_FREQ	GENMASK(1, 0)  #endif /* _LINUX_MFD_SYSCON_ATMEL_SFR_H */ diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h index 9ba65222bd3f..aeae4466dd25 100644 --- a/include/soc/tegra/bpmp.h +++ b/include/soc/tegra/bpmp.h @@ -94,10 +94,11 @@ struct tegra_bpmp {  	struct reset_controller_dev rstc;  	struct genpd_onecell_data genpd; -}; -struct tegra_bpmp *tegra_bpmp_get(struct device *dev); -void tegra_bpmp_put(struct tegra_bpmp *bpmp); +#ifdef CONFIG_DEBUG_FS +	struct dentry *debugfs_mirror; +#endif +};  struct tegra_bpmp_message {  	unsigned int mrq; @@ -110,18 +111,60 @@ struct tegra_bpmp_message {  	struct {  		void *data;  		size_t size; +		int ret;  	} rx;  }; +#if IS_ENABLED(CONFIG_TEGRA_BPMP) +struct tegra_bpmp *tegra_bpmp_get(struct device *dev); +void tegra_bpmp_put(struct tegra_bpmp *bpmp);  int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp,  			       struct tegra_bpmp_message *msg);  int tegra_bpmp_transfer(struct tegra_bpmp *bpmp,  			struct tegra_bpmp_message *msg); +void tegra_bpmp_mrq_return(struct tegra_bpmp_channel *channel, int code, +			   const void *data, size_t size);  int tegra_bpmp_request_mrq(struct tegra_bpmp *bpmp, unsigned int mrq,  			   tegra_bpmp_mrq_handler_t handler, void *data);  void tegra_bpmp_free_mrq(struct tegra_bpmp *bpmp, unsigned int mrq,  			 void *data); +#else +static inline struct tegra_bpmp *tegra_bpmp_get(struct device *dev) +{ +	return ERR_PTR(-ENOTSUPP); +} +static inline void tegra_bpmp_put(struct tegra_bpmp *bpmp) +{ +} +static inline int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp, +					     struct tegra_bpmp_message *msg) +{ +	return -ENOTSUPP; +} +static inline int tegra_bpmp_transfer(struct tegra_bpmp *bpmp, +				      struct tegra_bpmp_message *msg) +{ +	return -ENOTSUPP; +} +static inline void tegra_bpmp_mrq_return(struct tegra_bpmp_channel *channel, +					 int code, const void *data, +					 size_t size) +{ +} + +static inline int tegra_bpmp_request_mrq(struct tegra_bpmp *bpmp, +					 unsigned int mrq, +					 tegra_bpmp_mrq_handler_t handler, +					 void *data) +{ +	return -ENOTSUPP; +} +static inline void tegra_bpmp_free_mrq(struct tegra_bpmp *bpmp, +				       unsigned int mrq, void *data) +{ +} +#endif  #if IS_ENABLED(CONFIG_CLK_TEGRA_BPMP)  int tegra_bpmp_init_clocks(struct tegra_bpmp *bpmp); @@ -150,4 +193,14 @@ static inline int tegra_bpmp_init_powergates(struct tegra_bpmp *bpmp)  }  #endif +#if IS_ENABLED(CONFIG_DEBUG_FS) +int tegra_bpmp_init_debugfs(struct tegra_bpmp *bpmp); +#else +static inline int tegra_bpmp_init_debugfs(struct tegra_bpmp *bpmp) +{ +	return 0; +} +#endif + +  #endif /* __SOC_TEGRA_BPMP_H */ diff --git a/include/sound/ac97/codec.h b/include/sound/ac97/codec.h new file mode 100644 index 000000000000..ec04be9ab119 --- /dev/null +++ b/include/sound/ac97/codec.h @@ -0,0 +1,118 @@ +/* + *  Copyright (C) 2016 Robert Jarzmik <robert.jarzmik@free.fr> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef __SOUND_AC97_CODEC2_H +#define __SOUND_AC97_CODEC2_H + +#include <linux/device.h> + +#define AC97_ID(vendor_id1, vendor_id2) \ +	((((vendor_id1) & 0xffff) << 16) | ((vendor_id2) & 0xffff)) +#define AC97_DRIVER_ID(vendor_id1, vendor_id2, mask_id1, mask_id2, _data) \ +	{ .id = (((vendor_id1) & 0xffff) << 16) | ((vendor_id2) & 0xffff), \ +	  .mask = (((mask_id1) & 0xffff) << 16) | ((mask_id2) & 0xffff), \ +	  .data = (_data) } + +struct ac97_controller; +struct clk; + +/** + * struct ac97_id - matches a codec device and driver on an ac97 bus + * @id: The significant bits if the codec vendor ID1 and ID2 + * @mask: Bitmask specifying which bits of the id field are significant when + *	  matching. A driver binds to a device when : + *        ((vendorID1 << 8 | vendorID2) & (mask_id1 << 8 | mask_id2)) == id. + * @data: Private data used by the driver. + */ +struct ac97_id { +	unsigned int		id; +	unsigned int		mask; +	void			*data; +}; + +/** + * ac97_codec_device - a ac97 codec + * @dev: the core device + * @vendor_id: the vendor_id of the codec, as sensed on the AC-link + * @num: the codec number, 0 is primary, 1 is first slave, etc ... + * @clk: the clock BIT_CLK provided by the codec + * @ac97_ctrl: ac97 digital controller on the same AC-link + * + * This is the device instantiated for each codec living on a AC-link. There are + * normally 0 to 4 codec devices per AC-link, and all of them are controlled by + * an AC97 digital controller. + */ +struct ac97_codec_device { +	struct device		dev; +	unsigned int		vendor_id; +	unsigned int		num; +	struct clk		*clk; +	struct ac97_controller	*ac97_ctrl; +}; + +/** + * ac97_codec_driver - a ac97 codec driver + * @driver: the device driver structure + * @probe: the function called when a ac97_codec_device is matched + * @remove: the function called when the device is unbound/removed + * @shutdown: shutdown function (might be NULL) + * @id_table: ac97 vendor_id match table, { } member terminated + */ +struct ac97_codec_driver { +	struct device_driver	driver; +	int			(*probe)(struct ac97_codec_device *); +	int			(*remove)(struct ac97_codec_device *); +	void			(*shutdown)(struct ac97_codec_device *); +	const struct ac97_id	*id_table; +}; + +static inline struct ac97_codec_device *to_ac97_device(struct device *d) +{ +	return container_of(d, struct ac97_codec_device, dev); +} + +static inline struct ac97_codec_driver *to_ac97_driver(struct device_driver *d) +{ +	return container_of(d, struct ac97_codec_driver, driver); +} + +#if IS_ENABLED(CONFIG_AC97_BUS_NEW) +int snd_ac97_codec_driver_register(struct ac97_codec_driver *drv); +void snd_ac97_codec_driver_unregister(struct ac97_codec_driver *drv); +#else +static inline int +snd_ac97_codec_driver_register(struct ac97_codec_driver *drv) +{ +	return 0; +} +static inline void +snd_ac97_codec_driver_unregister(struct ac97_codec_driver *drv) +{ +} +#endif + + +static inline struct device * +ac97_codec_dev2dev(struct ac97_codec_device *adev) +{ +	return &adev->dev; +} + +static inline void *ac97_get_drvdata(struct ac97_codec_device *adev) +{ +	return dev_get_drvdata(ac97_codec_dev2dev(adev)); +} + +static inline void ac97_set_drvdata(struct ac97_codec_device *adev, +				    void *data) +{ +	dev_set_drvdata(ac97_codec_dev2dev(adev), data); +} + +void *snd_ac97_codec_get_platdata(const struct ac97_codec_device *adev); + +#endif diff --git a/include/sound/ac97/compat.h b/include/sound/ac97/compat.h new file mode 100644 index 000000000000..1351cba40048 --- /dev/null +++ b/include/sound/ac97/compat.h @@ -0,0 +1,20 @@ +/* + *  Copyright (C) 2016 Robert Jarzmik <robert.jarzmik@free.fr> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file is for backward compatibility with snd_ac97 structure and its + * multiple usages, such as the snd_ac97_bus and snd_ac97_build_ops. + * + */ +#ifndef AC97_COMPAT_H +#define AC97_COMPAT_H + +#include <sound/ac97_codec.h> + +struct snd_ac97 *snd_ac97_compat_alloc(struct ac97_codec_device *adev); +void snd_ac97_compat_release(struct snd_ac97 *ac97); + +#endif diff --git a/include/sound/ac97/controller.h b/include/sound/ac97/controller.h new file mode 100644 index 000000000000..b36ecdd64f14 --- /dev/null +++ b/include/sound/ac97/controller.h @@ -0,0 +1,85 @@ +/* + *  Copyright (C) 2016 Robert Jarzmik <robert.jarzmik@free.fr> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef AC97_CONTROLLER_H +#define AC97_CONTROLLER_H + +#include <linux/device.h> +#include <linux/list.h> + +#define AC97_BUS_MAX_CODECS 4 +#define AC97_SLOTS_AVAILABLE_ALL 0xf + +struct ac97_controller_ops; + +/** + * struct ac97_controller - The AC97 controller of the AC-Link + * @ops:		the AC97 operations. + * @controllers:	linked list of all existing controllers. + * @adap:		the shell device ac97-%d, ie. ac97 adapter + * @nr:			the number of the shell device + * @slots_available:	the mask of accessible/scanable codecs. + * @parent:		the device providing the AC97 controller. + * @codecs:		the 4 possible AC97 codecs (NULL if none found). + * @codecs_pdata:	platform_data for each codec (NULL if no pdata). + * + * This structure is internal to AC97 bus, and should not be used by the + * controllers themselves, excepting for using @dev. + */ +struct ac97_controller { +	const struct ac97_controller_ops *ops; +	struct list_head controllers; +	struct device adap; +	int nr; +	unsigned short slots_available; +	struct device *parent; +	struct ac97_codec_device *codecs[AC97_BUS_MAX_CODECS]; +	void *codecs_pdata[AC97_BUS_MAX_CODECS]; +}; + +/** + * struct ac97_controller_ops - The AC97 operations + * @reset:	Cold reset of the AC97 AC-Link. + * @warm_reset:	Warm reset of the AC97 AC-Link. + * @read:	Read of a single AC97 register. + *		Returns the register value or a negative error code. + * @write:	Write of a single AC97 register. + * + * These are the basic operation an AC97 controller must provide for an AC97 + * access functions. Amongst these, all but the last 2 are mandatory. + * The slot number is also known as the AC97 codec number, between 0 and 3. + */ +struct ac97_controller_ops { +	void (*reset)(struct ac97_controller *adrv); +	void (*warm_reset)(struct ac97_controller *adrv); +	int (*write)(struct ac97_controller *adrv, int slot, +		     unsigned short reg, unsigned short val); +	int (*read)(struct ac97_controller *adrv, int slot, unsigned short reg); +}; + +#if IS_ENABLED(CONFIG_AC97_BUS_NEW) +struct ac97_controller *snd_ac97_controller_register( +	const struct ac97_controller_ops *ops, struct device *dev, +	unsigned short slots_available, void **codecs_pdata); +void snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl); +#else +static inline struct ac97_controller * +snd_ac97_controller_register(const struct ac97_controller_ops *ops, +			     struct device *dev, +			     unsigned short slots_available, +			     void **codecs_pdata) +{ +	return ERR_PTR(-ENODEV); +} + +static inline void +snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl) +{ +} +#endif + +#endif diff --git a/include/sound/ac97/regs.h b/include/sound/ac97/regs.h new file mode 100644 index 000000000000..4bb86d379bd5 --- /dev/null +++ b/include/sound/ac97/regs.h @@ -0,0 +1,262 @@ +/* + *  Copyright (c) by Jaroslav Kysela <perex@perex.cz> + *  Universal interface for Audio Codec '97 + * + *  For more details look to AC '97 component specification revision 2.1 + *  by Intel Corporation (http://developer.intel.com). + * + * + *   This program is free software; you can redistribute it and/or modify + *   it under the terms of the GNU General Public License as published by + *   the Free Software Foundation; either version 2 of the License, or + *   (at your option) any later version. + * + *   This program is distributed in the hope that it will be useful, + *   but WITHOUT ANY WARRANTY; without even the implied warranty of + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *   GNU General Public License for more details. + * + *   You should have received a copy of the GNU General Public License + *   along with this program; if not, write to the Free Software + *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA + * + */ + +/* + *  AC'97 codec registers + */ + +#define AC97_RESET		0x00	/* Reset */ +#define AC97_MASTER		0x02	/* Master Volume */ +#define AC97_HEADPHONE		0x04	/* Headphone Volume (optional) */ +#define AC97_MASTER_MONO	0x06	/* Master Volume Mono (optional) */ +#define AC97_MASTER_TONE	0x08	/* Master Tone (Bass & Treble) (optional) */ +#define AC97_PC_BEEP		0x0a	/* PC Beep Volume (optinal) */ +#define AC97_PHONE		0x0c	/* Phone Volume (optional) */ +#define AC97_MIC		0x0e	/* MIC Volume */ +#define AC97_LINE		0x10	/* Line In Volume */ +#define AC97_CD			0x12	/* CD Volume */ +#define AC97_VIDEO		0x14	/* Video Volume (optional) */ +#define AC97_AUX		0x16	/* AUX Volume (optional) */ +#define AC97_PCM		0x18	/* PCM Volume */ +#define AC97_REC_SEL		0x1a	/* Record Select */ +#define AC97_REC_GAIN		0x1c	/* Record Gain */ +#define AC97_REC_GAIN_MIC	0x1e	/* Record Gain MIC (optional) */ +#define AC97_GENERAL_PURPOSE	0x20	/* General Purpose (optional) */ +#define AC97_3D_CONTROL		0x22	/* 3D Control (optional) */ +#define AC97_INT_PAGING		0x24	/* Audio Interrupt & Paging (AC'97 2.3) */ +#define AC97_POWERDOWN		0x26	/* Powerdown control / status */ +/* range 0x28-0x3a - AUDIO AC'97 2.0 extensions */ +#define AC97_EXTENDED_ID	0x28	/* Extended Audio ID */ +#define AC97_EXTENDED_STATUS	0x2a	/* Extended Audio Status and Control */ +#define AC97_PCM_FRONT_DAC_RATE 0x2c	/* PCM Front DAC Rate */ +#define AC97_PCM_SURR_DAC_RATE	0x2e	/* PCM Surround DAC Rate */ +#define AC97_PCM_LFE_DAC_RATE	0x30	/* PCM LFE DAC Rate */ +#define AC97_PCM_LR_ADC_RATE	0x32	/* PCM LR ADC Rate */ +#define AC97_PCM_MIC_ADC_RATE	0x34	/* PCM MIC ADC Rate */ +#define AC97_CENTER_LFE_MASTER	0x36	/* Center + LFE Master Volume */ +#define AC97_SURROUND_MASTER	0x38	/* Surround (Rear) Master Volume */ +#define AC97_SPDIF		0x3a	/* S/PDIF control */ +/* range 0x3c-0x58 - MODEM */ +#define AC97_EXTENDED_MID	0x3c	/* Extended Modem ID */ +#define AC97_EXTENDED_MSTATUS	0x3e	/* Extended Modem Status and Control */ +#define AC97_LINE1_RATE		0x40	/* Line1 DAC/ADC Rate */ +#define AC97_LINE2_RATE		0x42	/* Line2 DAC/ADC Rate */ +#define AC97_HANDSET_RATE	0x44	/* Handset DAC/ADC Rate */ +#define AC97_LINE1_LEVEL	0x46	/* Line1 DAC/ADC Level */ +#define AC97_LINE2_LEVEL	0x48	/* Line2 DAC/ADC Level */ +#define AC97_HANDSET_LEVEL	0x4a	/* Handset DAC/ADC Level */ +#define AC97_GPIO_CFG		0x4c	/* GPIO Configuration */ +#define AC97_GPIO_POLARITY	0x4e	/* GPIO Pin Polarity/Type, 0=low, 1=high active */ +#define AC97_GPIO_STICKY	0x50	/* GPIO Pin Sticky, 0=not, 1=sticky */ +#define AC97_GPIO_WAKEUP	0x52	/* GPIO Pin Wakeup, 0=no int, 1=yes int */ +#define AC97_GPIO_STATUS	0x54	/* GPIO Pin Status, slot 12 */ +#define AC97_MISC_AFE		0x56	/* Miscellaneous Modem AFE Status and Control */ +/* range 0x5a-0x7b - Vendor Specific */ +#define AC97_VENDOR_ID1		0x7c	/* Vendor ID1 */ +#define AC97_VENDOR_ID2		0x7e	/* Vendor ID2 / revision */ +/* range 0x60-0x6f (page 1) - extended codec registers */ +#define AC97_CODEC_CLASS_REV	0x60	/* Codec Class/Revision */ +#define AC97_PCI_SVID		0x62	/* PCI Subsystem Vendor ID */ +#define AC97_PCI_SID		0x64	/* PCI Subsystem ID */ +#define AC97_FUNC_SELECT	0x66	/* Function Select */ +#define AC97_FUNC_INFO		0x68	/* Function Information */ +#define AC97_SENSE_INFO		0x6a	/* Sense Details */ + +/* volume controls */ +#define AC97_MUTE_MASK_MONO	0x8000 +#define AC97_MUTE_MASK_STEREO	0x8080 + +/* slot allocation */ +#define AC97_SLOT_TAG		0 +#define AC97_SLOT_CMD_ADDR	1 +#define AC97_SLOT_CMD_DATA	2 +#define AC97_SLOT_PCM_LEFT	3 +#define AC97_SLOT_PCM_RIGHT	4 +#define AC97_SLOT_MODEM_LINE1	5 +#define AC97_SLOT_PCM_CENTER	6 +#define AC97_SLOT_MIC		6	/* input */ +#define AC97_SLOT_SPDIF_LEFT1	6 +#define AC97_SLOT_PCM_SLEFT	7	/* surround left */ +#define AC97_SLOT_PCM_LEFT_0	7	/* double rate operation */ +#define AC97_SLOT_SPDIF_LEFT	7 +#define AC97_SLOT_PCM_SRIGHT	8	/* surround right */ +#define AC97_SLOT_PCM_RIGHT_0	8	/* double rate operation */ +#define AC97_SLOT_SPDIF_RIGHT	8 +#define AC97_SLOT_LFE		9 +#define AC97_SLOT_SPDIF_RIGHT1	9 +#define AC97_SLOT_MODEM_LINE2	10 +#define AC97_SLOT_PCM_LEFT_1	10	/* double rate operation */ +#define AC97_SLOT_SPDIF_LEFT2	10 +#define AC97_SLOT_HANDSET	11	/* output */ +#define AC97_SLOT_PCM_RIGHT_1	11	/* double rate operation */ +#define AC97_SLOT_SPDIF_RIGHT2	11 +#define AC97_SLOT_MODEM_GPIO	12	/* modem GPIO */ +#define AC97_SLOT_PCM_CENTER_1	12	/* double rate operation */ + +/* basic capabilities (reset register) */ +#define AC97_BC_DEDICATED_MIC	0x0001	/* Dedicated Mic PCM In Channel */ +#define AC97_BC_RESERVED1	0x0002	/* Reserved (was Modem Line Codec support) */ +#define AC97_BC_BASS_TREBLE	0x0004	/* Bass & Treble Control */ +#define AC97_BC_SIM_STEREO	0x0008	/* Simulated stereo */ +#define AC97_BC_HEADPHONE	0x0010	/* Headphone Out Support */ +#define AC97_BC_LOUDNESS	0x0020	/* Loudness (bass boost) Support */ +#define AC97_BC_16BIT_DAC	0x0000	/* 16-bit DAC resolution */ +#define AC97_BC_18BIT_DAC	0x0040	/* 18-bit DAC resolution */ +#define AC97_BC_20BIT_DAC	0x0080	/* 20-bit DAC resolution */ +#define AC97_BC_DAC_MASK	0x00c0 +#define AC97_BC_16BIT_ADC	0x0000	/* 16-bit ADC resolution */ +#define AC97_BC_18BIT_ADC	0x0100	/* 18-bit ADC resolution */ +#define AC97_BC_20BIT_ADC	0x0200	/* 20-bit ADC resolution */ +#define AC97_BC_ADC_MASK	0x0300 +#define AC97_BC_3D_TECH_ID_MASK	0x7c00	/* Per-vendor ID of 3D enhancement */ + +/* general purpose */ +#define AC97_GP_DRSS_MASK	0x0c00	/* double rate slot select */ +#define AC97_GP_DRSS_1011	0x0000	/* LR(C) 10+11(+12) */ +#define AC97_GP_DRSS_78		0x0400	/* LR 7+8 */ + +/* powerdown bits */ +#define AC97_PD_ADC_STATUS	0x0001	/* ADC status (RO) */ +#define AC97_PD_DAC_STATUS	0x0002	/* DAC status (RO) */ +#define AC97_PD_MIXER_STATUS	0x0004	/* Analog mixer status (RO) */ +#define AC97_PD_VREF_STATUS	0x0008	/* Vref status (RO) */ +#define AC97_PD_PR0		0x0100	/* Power down PCM ADCs and input MUX */ +#define AC97_PD_PR1		0x0200	/* Power down PCM front DAC */ +#define AC97_PD_PR2		0x0400	/* Power down Mixer (Vref still on) */ +#define AC97_PD_PR3		0x0800	/* Power down Mixer (Vref off) */ +#define AC97_PD_PR4		0x1000	/* Power down AC-Link */ +#define AC97_PD_PR5		0x2000	/* Disable internal clock usage */ +#define AC97_PD_PR6		0x4000	/* Headphone amplifier */ +#define AC97_PD_EAPD		0x8000	/* External Amplifer Power Down (EAPD) */ + +/* extended audio ID bit defines */ +#define AC97_EI_VRA		0x0001	/* Variable bit rate supported */ +#define AC97_EI_DRA		0x0002	/* Double rate supported */ +#define AC97_EI_SPDIF		0x0004	/* S/PDIF out supported */ +#define AC97_EI_VRM		0x0008	/* Variable bit rate supported for MIC */ +#define AC97_EI_DACS_SLOT_MASK	0x0030	/* DACs slot assignment */ +#define AC97_EI_DACS_SLOT_SHIFT	4 +#define AC97_EI_CDAC		0x0040	/* PCM Center DAC available */ +#define AC97_EI_SDAC		0x0080	/* PCM Surround DACs available */ +#define AC97_EI_LDAC		0x0100	/* PCM LFE DAC available */ +#define AC97_EI_AMAP		0x0200	/* indicates optional slot/DAC mapping based on codec ID */ +#define AC97_EI_REV_MASK	0x0c00	/* AC'97 revision mask */ +#define AC97_EI_REV_22		0x0400	/* AC'97 revision 2.2 */ +#define AC97_EI_REV_23		0x0800	/* AC'97 revision 2.3 */ +#define AC97_EI_REV_SHIFT	10 +#define AC97_EI_ADDR_MASK	0xc000	/* physical codec ID (address) */ +#define AC97_EI_ADDR_SHIFT	14 + +/* extended audio status and control bit defines */ +#define AC97_EA_VRA		0x0001	/* Variable bit rate enable bit */ +#define AC97_EA_DRA		0x0002	/* Double-rate audio enable bit */ +#define AC97_EA_SPDIF		0x0004	/* S/PDIF out enable bit */ +#define AC97_EA_VRM		0x0008	/* Variable bit rate for MIC enable bit */ +#define AC97_EA_SPSA_SLOT_MASK	0x0030	/* Mask for slot assignment bits */ +#define AC97_EA_SPSA_SLOT_SHIFT 4 +#define AC97_EA_SPSA_3_4	0x0000	/* Slot assigned to 3 & 4 */ +#define AC97_EA_SPSA_7_8	0x0010	/* Slot assigned to 7 & 8 */ +#define AC97_EA_SPSA_6_9	0x0020	/* Slot assigned to 6 & 9 */ +#define AC97_EA_SPSA_10_11	0x0030	/* Slot assigned to 10 & 11 */ +#define AC97_EA_CDAC		0x0040	/* PCM Center DAC is ready (Read only) */ +#define AC97_EA_SDAC		0x0080	/* PCM Surround DACs are ready (Read only) */ +#define AC97_EA_LDAC		0x0100	/* PCM LFE DAC is ready (Read only) */ +#define AC97_EA_MDAC		0x0200	/* MIC ADC is ready (Read only) */ +#define AC97_EA_SPCV		0x0400	/* S/PDIF configuration valid (Read only) */ +#define AC97_EA_PRI		0x0800	/* Turns the PCM Center DAC off */ +#define AC97_EA_PRJ		0x1000	/* Turns the PCM Surround DACs off */ +#define AC97_EA_PRK		0x2000	/* Turns the PCM LFE DAC off */ +#define AC97_EA_PRL		0x4000	/* Turns the MIC ADC off */ + +/* S/PDIF control bit defines */ +#define AC97_SC_PRO		0x0001	/* Professional status */ +#define AC97_SC_NAUDIO		0x0002	/* Non audio stream */ +#define AC97_SC_COPY		0x0004	/* Copyright status */ +#define AC97_SC_PRE		0x0008	/* Preemphasis status */ +#define AC97_SC_CC_MASK		0x07f0	/* Category Code mask */ +#define AC97_SC_CC_SHIFT	4 +#define AC97_SC_L		0x0800	/* Generation Level status */ +#define AC97_SC_SPSR_MASK	0x3000	/* S/PDIF Sample Rate bits */ +#define AC97_SC_SPSR_SHIFT	12 +#define AC97_SC_SPSR_44K	0x0000	/* Use 44.1kHz Sample rate */ +#define AC97_SC_SPSR_48K	0x2000	/* Use 48kHz Sample rate */ +#define AC97_SC_SPSR_32K	0x3000	/* Use 32kHz Sample rate */ +#define AC97_SC_DRS		0x4000	/* Double Rate S/PDIF */ +#define AC97_SC_V		0x8000	/* Validity status */ + +/* Interrupt and Paging bit defines (AC'97 2.3) */ +#define AC97_PAGE_MASK		0x000f	/* Page Selector */ +#define AC97_PAGE_VENDOR	0	/* Vendor-specific registers */ +#define AC97_PAGE_1		1	/* Extended Codec Registers page 1 */ +#define AC97_INT_ENABLE		0x0800	/* Interrupt Enable */ +#define AC97_INT_SENSE		0x1000	/* Sense Cycle */ +#define AC97_INT_CAUSE_SENSE	0x2000	/* Sense Cycle Completed (RO) */ +#define AC97_INT_CAUSE_GPIO	0x4000	/* GPIO bits changed (RO) */ +#define AC97_INT_STATUS		0x8000	/* Interrupt Status */ + +/* extended modem ID bit defines */ +#define AC97_MEI_LINE1		0x0001	/* Line1 present */ +#define AC97_MEI_LINE2		0x0002	/* Line2 present */ +#define AC97_MEI_HANDSET	0x0004	/* Handset present */ +#define AC97_MEI_CID1		0x0008	/* caller ID decode for Line1 is supported */ +#define AC97_MEI_CID2		0x0010	/* caller ID decode for Line2 is supported */ +#define AC97_MEI_ADDR_MASK	0xc000	/* physical codec ID (address) */ +#define AC97_MEI_ADDR_SHIFT	14 + +/* extended modem status and control bit defines */ +#define AC97_MEA_GPIO		0x0001	/* GPIO is ready (ro) */ +#define AC97_MEA_MREF		0x0002	/* Vref is up to nominal level (ro) */ +#define AC97_MEA_ADC1		0x0004	/* ADC1 operational (ro) */ +#define AC97_MEA_DAC1		0x0008	/* DAC1 operational (ro) */ +#define AC97_MEA_ADC2		0x0010	/* ADC2 operational (ro) */ +#define AC97_MEA_DAC2		0x0020	/* DAC2 operational (ro) */ +#define AC97_MEA_HADC		0x0040	/* HADC operational (ro) */ +#define AC97_MEA_HDAC		0x0080	/* HDAC operational (ro) */ +#define AC97_MEA_PRA		0x0100	/* GPIO power down (high) */ +#define AC97_MEA_PRB		0x0200	/* reserved */ +#define AC97_MEA_PRC		0x0400	/* ADC1 power down (high) */ +#define AC97_MEA_PRD		0x0800	/* DAC1 power down (high) */ +#define AC97_MEA_PRE		0x1000	/* ADC2 power down (high) */ +#define AC97_MEA_PRF		0x2000	/* DAC2 power down (high) */ +#define AC97_MEA_PRG		0x4000	/* HADC power down (high) */ +#define AC97_MEA_PRH		0x8000	/* HDAC power down (high) */ + +/* modem gpio status defines */ +#define AC97_GPIO_LINE1_OH      0x0001  /* Off Hook Line1 */ +#define AC97_GPIO_LINE1_RI      0x0002  /* Ring Detect Line1 */ +#define AC97_GPIO_LINE1_CID     0x0004  /* Caller ID path enable Line1 */ +#define AC97_GPIO_LINE1_LCS     0x0008  /* Loop Current Sense Line1 */ +#define AC97_GPIO_LINE1_PULSE   0x0010  /* Opt./ Pulse Dial Line1 (out) */ +#define AC97_GPIO_LINE1_HL1R    0x0020  /* Opt./ Handset to Line1 relay control (out) */ +#define AC97_GPIO_LINE1_HOHD    0x0040  /* Opt./ Handset off hook detect Line1 (in) */ +#define AC97_GPIO_LINE12_AC     0x0080  /* Opt./ Int.bit 1 / Line1/2 AC (out) */ +#define AC97_GPIO_LINE12_DC     0x0100  /* Opt./ Int.bit 2 / Line1/2 DC (out) */ +#define AC97_GPIO_LINE12_RS     0x0200  /* Opt./ Int.bit 3 / Line1/2 RS (out) */ +#define AC97_GPIO_LINE2_OH      0x0400  /* Off Hook Line2 */ +#define AC97_GPIO_LINE2_RI      0x0800  /* Ring Detect Line2 */ +#define AC97_GPIO_LINE2_CID     0x1000  /* Caller ID path enable Line2 */ +#define AC97_GPIO_LINE2_LCS     0x2000  /* Loop Current Sense Line2 */ +#define AC97_GPIO_LINE2_PULSE   0x4000  /* Opt./ Pulse Dial Line2 (out) */ +#define AC97_GPIO_LINE2_HL1R    0x8000  /* Opt./ Handset to Line2 relay control (out) */ + diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 15aa5f07c955..89d311a503d3 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -28,6 +28,7 @@  #include <linux/bitops.h>  #include <linux/device.h>  #include <linux/workqueue.h> +#include <sound/ac97/regs.h>  #include <sound/pcm.h>  #include <sound/control.h>  #include <sound/info.h> @@ -35,244 +36,6 @@  /* maximum number of devices on the AC97 bus */  #define	AC97_BUS_MAX_DEVICES	4 -/* - *  AC'97 codec registers - */ - -#define AC97_RESET		0x00	/* Reset */ -#define AC97_MASTER		0x02	/* Master Volume */ -#define AC97_HEADPHONE		0x04	/* Headphone Volume (optional) */ -#define AC97_MASTER_MONO	0x06	/* Master Volume Mono (optional) */ -#define AC97_MASTER_TONE	0x08	/* Master Tone (Bass & Treble) (optional) */ -#define AC97_PC_BEEP		0x0a	/* PC Beep Volume (optinal) */ -#define AC97_PHONE		0x0c	/* Phone Volume (optional) */ -#define AC97_MIC		0x0e	/* MIC Volume */ -#define AC97_LINE		0x10	/* Line In Volume */ -#define AC97_CD			0x12	/* CD Volume */ -#define AC97_VIDEO		0x14	/* Video Volume (optional) */ -#define AC97_AUX		0x16	/* AUX Volume (optional) */ -#define AC97_PCM		0x18	/* PCM Volume */ -#define AC97_REC_SEL		0x1a	/* Record Select */ -#define AC97_REC_GAIN		0x1c	/* Record Gain */ -#define AC97_REC_GAIN_MIC	0x1e	/* Record Gain MIC (optional) */ -#define AC97_GENERAL_PURPOSE	0x20	/* General Purpose (optional) */ -#define AC97_3D_CONTROL		0x22	/* 3D Control (optional) */ -#define AC97_INT_PAGING		0x24	/* Audio Interrupt & Paging (AC'97 2.3) */ -#define AC97_POWERDOWN		0x26	/* Powerdown control / status */ -/* range 0x28-0x3a - AUDIO AC'97 2.0 extensions */ -#define AC97_EXTENDED_ID	0x28	/* Extended Audio ID */ -#define AC97_EXTENDED_STATUS	0x2a	/* Extended Audio Status and Control */ -#define AC97_PCM_FRONT_DAC_RATE 0x2c	/* PCM Front DAC Rate */ -#define AC97_PCM_SURR_DAC_RATE	0x2e	/* PCM Surround DAC Rate */ -#define AC97_PCM_LFE_DAC_RATE	0x30	/* PCM LFE DAC Rate */ -#define AC97_PCM_LR_ADC_RATE	0x32	/* PCM LR ADC Rate */ -#define AC97_PCM_MIC_ADC_RATE	0x34	/* PCM MIC ADC Rate */ -#define AC97_CENTER_LFE_MASTER	0x36	/* Center + LFE Master Volume */ -#define AC97_SURROUND_MASTER	0x38	/* Surround (Rear) Master Volume */ -#define AC97_SPDIF		0x3a	/* S/PDIF control */ -/* range 0x3c-0x58 - MODEM */ -#define AC97_EXTENDED_MID	0x3c	/* Extended Modem ID */ -#define AC97_EXTENDED_MSTATUS	0x3e	/* Extended Modem Status and Control */ -#define AC97_LINE1_RATE		0x40	/* Line1 DAC/ADC Rate */ -#define AC97_LINE2_RATE		0x42	/* Line2 DAC/ADC Rate */ -#define AC97_HANDSET_RATE	0x44	/* Handset DAC/ADC Rate */ -#define AC97_LINE1_LEVEL	0x46	/* Line1 DAC/ADC Level */ -#define AC97_LINE2_LEVEL	0x48	/* Line2 DAC/ADC Level */ -#define AC97_HANDSET_LEVEL	0x4a	/* Handset DAC/ADC Level */ -#define AC97_GPIO_CFG		0x4c	/* GPIO Configuration */ -#define AC97_GPIO_POLARITY	0x4e	/* GPIO Pin Polarity/Type, 0=low, 1=high active */ -#define AC97_GPIO_STICKY	0x50	/* GPIO Pin Sticky, 0=not, 1=sticky */ -#define AC97_GPIO_WAKEUP	0x52	/* GPIO Pin Wakeup, 0=no int, 1=yes int */ -#define AC97_GPIO_STATUS	0x54	/* GPIO Pin Status, slot 12 */ -#define AC97_MISC_AFE		0x56	/* Miscellaneous Modem AFE Status and Control */ -/* range 0x5a-0x7b - Vendor Specific */ -#define AC97_VENDOR_ID1		0x7c	/* Vendor ID1 */ -#define AC97_VENDOR_ID2		0x7e	/* Vendor ID2 / revision */ -/* range 0x60-0x6f (page 1) - extended codec registers */ -#define AC97_CODEC_CLASS_REV	0x60	/* Codec Class/Revision */ -#define AC97_PCI_SVID		0x62	/* PCI Subsystem Vendor ID */ -#define AC97_PCI_SID		0x64	/* PCI Subsystem ID */ -#define AC97_FUNC_SELECT	0x66	/* Function Select */ -#define AC97_FUNC_INFO		0x68	/* Function Information */ -#define AC97_SENSE_INFO		0x6a	/* Sense Details */ - -/* volume controls */ -#define AC97_MUTE_MASK_MONO	0x8000 -#define AC97_MUTE_MASK_STEREO	0x8080 - -/* slot allocation */ -#define AC97_SLOT_TAG		0 -#define AC97_SLOT_CMD_ADDR	1 -#define AC97_SLOT_CMD_DATA	2 -#define AC97_SLOT_PCM_LEFT	3 -#define AC97_SLOT_PCM_RIGHT	4 -#define AC97_SLOT_MODEM_LINE1	5 -#define AC97_SLOT_PCM_CENTER	6 -#define AC97_SLOT_MIC		6	/* input */ -#define AC97_SLOT_SPDIF_LEFT1	6 -#define AC97_SLOT_PCM_SLEFT	7	/* surround left */ -#define AC97_SLOT_PCM_LEFT_0	7	/* double rate operation */ -#define AC97_SLOT_SPDIF_LEFT	7 -#define AC97_SLOT_PCM_SRIGHT	8	/* surround right */ -#define AC97_SLOT_PCM_RIGHT_0	8	/* double rate operation */ -#define AC97_SLOT_SPDIF_RIGHT	8 -#define AC97_SLOT_LFE		9 -#define AC97_SLOT_SPDIF_RIGHT1	9 -#define AC97_SLOT_MODEM_LINE2	10 -#define AC97_SLOT_PCM_LEFT_1	10	/* double rate operation */ -#define AC97_SLOT_SPDIF_LEFT2	10 -#define AC97_SLOT_HANDSET	11	/* output */ -#define AC97_SLOT_PCM_RIGHT_1	11	/* double rate operation */ -#define AC97_SLOT_SPDIF_RIGHT2	11 -#define AC97_SLOT_MODEM_GPIO	12	/* modem GPIO */ -#define AC97_SLOT_PCM_CENTER_1	12	/* double rate operation */ - -/* basic capabilities (reset register) */ -#define AC97_BC_DEDICATED_MIC	0x0001	/* Dedicated Mic PCM In Channel */ -#define AC97_BC_RESERVED1	0x0002	/* Reserved (was Modem Line Codec support) */ -#define AC97_BC_BASS_TREBLE	0x0004	/* Bass & Treble Control */ -#define AC97_BC_SIM_STEREO	0x0008	/* Simulated stereo */ -#define AC97_BC_HEADPHONE	0x0010	/* Headphone Out Support */ -#define AC97_BC_LOUDNESS	0x0020	/* Loudness (bass boost) Support */ -#define AC97_BC_16BIT_DAC	0x0000	/* 16-bit DAC resolution */ -#define AC97_BC_18BIT_DAC	0x0040	/* 18-bit DAC resolution */ -#define AC97_BC_20BIT_DAC	0x0080	/* 20-bit DAC resolution */ -#define AC97_BC_DAC_MASK	0x00c0 -#define AC97_BC_16BIT_ADC	0x0000	/* 16-bit ADC resolution */ -#define AC97_BC_18BIT_ADC	0x0100	/* 18-bit ADC resolution */ -#define AC97_BC_20BIT_ADC	0x0200	/* 20-bit ADC resolution */ -#define AC97_BC_ADC_MASK	0x0300 -#define AC97_BC_3D_TECH_ID_MASK	0x7c00	/* Per-vendor ID of 3D enhancement */ - -/* general purpose */ -#define AC97_GP_DRSS_MASK	0x0c00	/* double rate slot select */ -#define AC97_GP_DRSS_1011	0x0000	/* LR(C) 10+11(+12) */ -#define AC97_GP_DRSS_78		0x0400	/* LR 7+8 */ - -/* powerdown bits */ -#define AC97_PD_ADC_STATUS	0x0001	/* ADC status (RO) */ -#define AC97_PD_DAC_STATUS	0x0002	/* DAC status (RO) */ -#define AC97_PD_MIXER_STATUS	0x0004	/* Analog mixer status (RO) */ -#define AC97_PD_VREF_STATUS	0x0008	/* Vref status (RO) */ -#define AC97_PD_PR0		0x0100	/* Power down PCM ADCs and input MUX */ -#define AC97_PD_PR1		0x0200	/* Power down PCM front DAC */ -#define AC97_PD_PR2		0x0400	/* Power down Mixer (Vref still on) */ -#define AC97_PD_PR3		0x0800	/* Power down Mixer (Vref off) */ -#define AC97_PD_PR4		0x1000	/* Power down AC-Link */ -#define AC97_PD_PR5		0x2000	/* Disable internal clock usage */ -#define AC97_PD_PR6		0x4000	/* Headphone amplifier */ -#define AC97_PD_EAPD		0x8000	/* External Amplifer Power Down (EAPD) */ - -/* extended audio ID bit defines */ -#define AC97_EI_VRA		0x0001	/* Variable bit rate supported */ -#define AC97_EI_DRA		0x0002	/* Double rate supported */ -#define AC97_EI_SPDIF		0x0004	/* S/PDIF out supported */ -#define AC97_EI_VRM		0x0008	/* Variable bit rate supported for MIC */ -#define AC97_EI_DACS_SLOT_MASK	0x0030	/* DACs slot assignment */ -#define AC97_EI_DACS_SLOT_SHIFT	4 -#define AC97_EI_CDAC		0x0040	/* PCM Center DAC available */ -#define AC97_EI_SDAC		0x0080	/* PCM Surround DACs available */ -#define AC97_EI_LDAC		0x0100	/* PCM LFE DAC available */ -#define AC97_EI_AMAP		0x0200	/* indicates optional slot/DAC mapping based on codec ID */ -#define AC97_EI_REV_MASK	0x0c00	/* AC'97 revision mask */ -#define AC97_EI_REV_22		0x0400	/* AC'97 revision 2.2 */ -#define AC97_EI_REV_23		0x0800	/* AC'97 revision 2.3 */ -#define AC97_EI_REV_SHIFT	10 -#define AC97_EI_ADDR_MASK	0xc000	/* physical codec ID (address) */ -#define AC97_EI_ADDR_SHIFT	14 - -/* extended audio status and control bit defines */ -#define AC97_EA_VRA		0x0001	/* Variable bit rate enable bit */ -#define AC97_EA_DRA		0x0002	/* Double-rate audio enable bit */ -#define AC97_EA_SPDIF		0x0004	/* S/PDIF out enable bit */ -#define AC97_EA_VRM		0x0008	/* Variable bit rate for MIC enable bit */ -#define AC97_EA_SPSA_SLOT_MASK	0x0030	/* Mask for slot assignment bits */ -#define AC97_EA_SPSA_SLOT_SHIFT 4 -#define AC97_EA_SPSA_3_4	0x0000	/* Slot assigned to 3 & 4 */ -#define AC97_EA_SPSA_7_8	0x0010	/* Slot assigned to 7 & 8 */ -#define AC97_EA_SPSA_6_9	0x0020	/* Slot assigned to 6 & 9 */ -#define AC97_EA_SPSA_10_11	0x0030	/* Slot assigned to 10 & 11 */ -#define AC97_EA_CDAC		0x0040	/* PCM Center DAC is ready (Read only) */ -#define AC97_EA_SDAC		0x0080	/* PCM Surround DACs are ready (Read only) */ -#define AC97_EA_LDAC		0x0100	/* PCM LFE DAC is ready (Read only) */ -#define AC97_EA_MDAC		0x0200	/* MIC ADC is ready (Read only) */ -#define AC97_EA_SPCV		0x0400	/* S/PDIF configuration valid (Read only) */ -#define AC97_EA_PRI		0x0800	/* Turns the PCM Center DAC off */ -#define AC97_EA_PRJ		0x1000	/* Turns the PCM Surround DACs off */ -#define AC97_EA_PRK		0x2000	/* Turns the PCM LFE DAC off */ -#define AC97_EA_PRL		0x4000	/* Turns the MIC ADC off */ - -/* S/PDIF control bit defines */ -#define AC97_SC_PRO		0x0001	/* Professional status */ -#define AC97_SC_NAUDIO		0x0002	/* Non audio stream */ -#define AC97_SC_COPY		0x0004	/* Copyright status */ -#define AC97_SC_PRE		0x0008	/* Preemphasis status */ -#define AC97_SC_CC_MASK		0x07f0	/* Category Code mask */ -#define AC97_SC_CC_SHIFT	4 -#define AC97_SC_L		0x0800	/* Generation Level status */ -#define AC97_SC_SPSR_MASK	0x3000	/* S/PDIF Sample Rate bits */ -#define AC97_SC_SPSR_SHIFT	12 -#define AC97_SC_SPSR_44K	0x0000	/* Use 44.1kHz Sample rate */ -#define AC97_SC_SPSR_48K	0x2000	/* Use 48kHz Sample rate */ -#define AC97_SC_SPSR_32K	0x3000	/* Use 32kHz Sample rate */ -#define AC97_SC_DRS		0x4000	/* Double Rate S/PDIF */ -#define AC97_SC_V		0x8000	/* Validity status */ - -/* Interrupt and Paging bit defines (AC'97 2.3) */ -#define AC97_PAGE_MASK		0x000f	/* Page Selector */ -#define AC97_PAGE_VENDOR	0	/* Vendor-specific registers */ -#define AC97_PAGE_1		1	/* Extended Codec Registers page 1 */ -#define AC97_INT_ENABLE		0x0800	/* Interrupt Enable */ -#define AC97_INT_SENSE		0x1000	/* Sense Cycle */ -#define AC97_INT_CAUSE_SENSE	0x2000	/* Sense Cycle Completed (RO) */ -#define AC97_INT_CAUSE_GPIO	0x4000	/* GPIO bits changed (RO) */ -#define AC97_INT_STATUS		0x8000	/* Interrupt Status */ - -/* extended modem ID bit defines */ -#define AC97_MEI_LINE1		0x0001	/* Line1 present */ -#define AC97_MEI_LINE2		0x0002	/* Line2 present */ -#define AC97_MEI_HANDSET	0x0004	/* Handset present */ -#define AC97_MEI_CID1		0x0008	/* caller ID decode for Line1 is supported */ -#define AC97_MEI_CID2		0x0010	/* caller ID decode for Line2 is supported */ -#define AC97_MEI_ADDR_MASK	0xc000	/* physical codec ID (address) */ -#define AC97_MEI_ADDR_SHIFT	14 - -/* extended modem status and control bit defines */ -#define AC97_MEA_GPIO		0x0001	/* GPIO is ready (ro) */ -#define AC97_MEA_MREF		0x0002	/* Vref is up to nominal level (ro) */ -#define AC97_MEA_ADC1		0x0004	/* ADC1 operational (ro) */ -#define AC97_MEA_DAC1		0x0008	/* DAC1 operational (ro) */ -#define AC97_MEA_ADC2		0x0010	/* ADC2 operational (ro) */ -#define AC97_MEA_DAC2		0x0020	/* DAC2 operational (ro) */ -#define AC97_MEA_HADC		0x0040	/* HADC operational (ro) */ -#define AC97_MEA_HDAC		0x0080	/* HDAC operational (ro) */ -#define AC97_MEA_PRA		0x0100	/* GPIO power down (high) */ -#define AC97_MEA_PRB		0x0200	/* reserved */ -#define AC97_MEA_PRC		0x0400	/* ADC1 power down (high) */ -#define AC97_MEA_PRD		0x0800	/* DAC1 power down (high) */ -#define AC97_MEA_PRE		0x1000	/* ADC2 power down (high) */ -#define AC97_MEA_PRF		0x2000	/* DAC2 power down (high) */ -#define AC97_MEA_PRG		0x4000	/* HADC power down (high) */ -#define AC97_MEA_PRH		0x8000	/* HDAC power down (high) */ - -/* modem gpio status defines */ -#define AC97_GPIO_LINE1_OH      0x0001  /* Off Hook Line1 */ -#define AC97_GPIO_LINE1_RI      0x0002  /* Ring Detect Line1 */ -#define AC97_GPIO_LINE1_CID     0x0004  /* Caller ID path enable Line1 */ -#define AC97_GPIO_LINE1_LCS     0x0008  /* Loop Current Sense Line1 */ -#define AC97_GPIO_LINE1_PULSE   0x0010  /* Opt./ Pulse Dial Line1 (out) */ -#define AC97_GPIO_LINE1_HL1R    0x0020  /* Opt./ Handset to Line1 relay control (out) */ -#define AC97_GPIO_LINE1_HOHD    0x0040  /* Opt./ Handset off hook detect Line1 (in) */ -#define AC97_GPIO_LINE12_AC     0x0080  /* Opt./ Int.bit 1 / Line1/2 AC (out) */ -#define AC97_GPIO_LINE12_DC     0x0100  /* Opt./ Int.bit 2 / Line1/2 DC (out) */ -#define AC97_GPIO_LINE12_RS     0x0200  /* Opt./ Int.bit 3 / Line1/2 RS (out) */ -#define AC97_GPIO_LINE2_OH      0x0400  /* Off Hook Line2 */ -#define AC97_GPIO_LINE2_RI      0x0800  /* Ring Detect Line2 */ -#define AC97_GPIO_LINE2_CID     0x1000  /* Caller ID path enable Line2 */ -#define AC97_GPIO_LINE2_LCS     0x2000  /* Loop Current Sense Line2 */ -#define AC97_GPIO_LINE2_PULSE   0x4000  /* Opt./ Pulse Dial Line2 (out) */ -#define AC97_GPIO_LINE2_HL1R    0x8000  /* Opt./ Handset to Line2 relay control (out) */ -  /* specific - SigmaTel */  #define AC97_SIGMATEL_OUTSEL	0x64	/* Output Select, STAC9758 */  #define AC97_SIGMATEL_INSEL	0x66	/* Input Select, STAC9758 */ diff --git a/include/sound/aci.h b/include/sound/aci.h index ee639d355ef0..6ebbd4223f12 100644 --- a/include/sound/aci.h +++ b/include/sound/aci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ACI_H_  #define _ACI_H_ diff --git a/include/sound/alc5623.h b/include/sound/alc5623.h index 422c97d43df3..0ebb0f6fce54 100644 --- a/include/sound/alc5623.h +++ b/include/sound/alc5623.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _INCLUDE_SOUND_ALC5623_H  #define _INCLUDE_SOUND_ALC5623_H  struct alc5623_platform_data { diff --git a/include/sound/control.h b/include/sound/control.h index bd7246de58e7..ca13a44ae9d4 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -248,6 +248,11 @@ int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl,  			     void *private_data);  void snd_ctl_sync_vmaster(struct snd_kcontrol *kctl, bool hook_only);  #define snd_ctl_sync_vmaster_hook(kctl)	snd_ctl_sync_vmaster(kctl, true) +int snd_ctl_apply_vmaster_slaves(struct snd_kcontrol *kctl, +				 int (*func)(struct snd_kcontrol *vslave, +					     struct snd_kcontrol *slave, +					     void *arg), +				 void *arg);  /*   * Helper functions for jack-detection controls diff --git a/include/sound/core.h b/include/sound/core.h index 4104a9d1001f..5f181b875c2f 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -133,6 +133,7 @@ struct snd_card {  	struct device card_dev;		/* cardX object for sysfs */  	const struct attribute_group *dev_groups[4]; /* assigned sysfs attr */  	bool registered;		/* card_dev is registered? */ +	wait_queue_head_t remove_sleep;  #ifdef CONFIG_PM  	unsigned int power_state;	/* power state */ @@ -240,6 +241,7 @@ int snd_card_new(struct device *parent, int idx, const char *xid,  		 struct snd_card **card_ret);  int snd_card_disconnect(struct snd_card *card); +void snd_card_disconnect_sync(struct snd_card *card);  int snd_card_free(struct snd_card *card);  int snd_card_free_when_closed(struct snd_card *card);  void snd_card_set_id(struct snd_card *card, const char *id); diff --git a/include/sound/hda_chmap.h b/include/sound/hda_chmap.h index babd445c7505..e508f3192294 100644 --- a/include/sound/hda_chmap.h +++ b/include/sound/hda_chmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * For multichannel support   */ diff --git a/include/sound/hda_i915.h b/include/sound/hda_i915.h index 5ab972e116ec..a94f5b6f92ac 100644 --- a/include/sound/hda_i915.h +++ b/include/sound/hda_i915.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * HD-Audio helpers to sync with i915 driver   */ diff --git a/include/sound/hda_register.h b/include/sound/hda_register.h index 15fc6daf9096..2ab39fb52d7a 100644 --- a/include/sound/hda_register.h +++ b/include/sound/hda_register.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * HD-audio controller (Azalia) registers and helpers   * diff --git a/include/sound/hda_regmap.h b/include/sound/hda_regmap.h index ca64f0f50b45..5141f8ffbb12 100644 --- a/include/sound/hda_regmap.h +++ b/include/sound/hda_regmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * HD-audio regmap helpers   */ diff --git a/include/sound/hda_verbs.h b/include/sound/hda_verbs.h index f89cd5ee1c7a..2a8573a00ea6 100644 --- a/include/sound/hda_verbs.h +++ b/include/sound/hda_verbs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * HD-audio codec verbs   */ diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 96546b30e900..68169e3749de 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * HD-audio core stuff   */ @@ -111,8 +112,7 @@ void snd_hdac_device_unregister(struct hdac_device *codec);  int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name);  int snd_hdac_codec_modalias(struct hdac_device *hdac, char *buf, size_t size); -int snd_hdac_refresh_widgets(struct hdac_device *codec); -int snd_hdac_refresh_widget_sysfs(struct hdac_device *codec); +int snd_hdac_refresh_widgets(struct hdac_device *codec, bool sysfs);  unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid,  			       unsigned int verb, unsigned int parm); diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h index 8660a7f10851..ca00130cb028 100644 --- a/include/sound/hdaudio_ext.h +++ b/include/sound/hdaudio_ext.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SOUND_HDAUDIO_EXT_H  #define __SOUND_HDAUDIO_EXT_H diff --git a/include/sound/l3.h b/include/sound/l3.h index 1471da22adad..b6f58072237a 100644 --- a/include/sound/l3.h +++ b/include/sound/l3.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _L3_H_  #define _L3_H_ 1 diff --git a/include/sound/pcm_drm_eld.h b/include/sound/pcm_drm_eld.h index 93357b25d2e2..28a55a8beb28 100644 --- a/include/sound/pcm_drm_eld.h +++ b/include/sound/pcm_drm_eld.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SOUND_PCM_DRM_ELD_H  #define __SOUND_PCM_DRM_ELD_H diff --git a/include/sound/pcm_iec958.h b/include/sound/pcm_iec958.h index 36f023acb201..0939aa45e2fe 100644 --- a/include/sound/pcm_iec958.h +++ b/include/sound/pcm_iec958.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SOUND_PCM_IEC958_H  #define __SOUND_PCM_IEC958_H diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h index 6ef629bde164..63f75450d3db 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h @@ -1,10 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef PXA2XX_LIB_H  #define PXA2XX_LIB_H +#include <uapi/sound/asound.h>  #include <linux/platform_device.h> -#include <sound/ac97_codec.h>  /* PCM */ +struct snd_pcm_substream; +struct snd_pcm_hw_params; +struct snd_pcm;  extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,  				struct snd_pcm_hw_params *params); @@ -21,12 +25,12 @@ extern void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm);  /* AC97 */ -extern unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg); -extern void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val); +extern int pxa2xx_ac97_read(int slot, unsigned short reg); +extern int pxa2xx_ac97_write(int slot, unsigned short reg, unsigned short val); -extern bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97); -extern bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97); -extern void pxa2xx_ac97_finish_reset(struct snd_ac97 *ac97); +extern bool pxa2xx_ac97_try_warm_reset(void); +extern bool pxa2xx_ac97_try_cold_reset(void); +extern void pxa2xx_ac97_finish_reset(void);  extern int pxa2xx_ac97_hw_suspend(void);  extern int pxa2xx_ac97_hw_resume(void); diff --git a/include/sound/rt5651.h b/include/sound/rt5651.h index d35de758dfb5..18b79a761f10 100644 --- a/include/sound/rt5651.h +++ b/include/sound/rt5651.h @@ -11,11 +11,19 @@  #ifndef __LINUX_SND_RT5651_H  #define __LINUX_SND_RT5651_H +enum rt5651_jd_src { +	RT5651_JD_NULL, +	RT5651_JD1_1, +	RT5651_JD1_2, +	RT5651_JD2, +}; +  struct rt5651_platform_data {  	/* IN2 can optionally be differential */  	bool in2_diff;  	bool dmic_en; +	enum rt5651_jd_src jd_src;  };  #endif diff --git a/include/sound/rt5663.h b/include/sound/rt5663.h index 7d00e5849706..7b90a8f1034c 100644 --- a/include/sound/rt5663.h +++ b/include/sound/rt5663.h @@ -16,6 +16,9 @@ struct rt5663_platform_data {  	unsigned int dc_offset_r_manual;  	unsigned int dc_offset_l_manual_mic;  	unsigned int dc_offset_r_manual_mic; + +	unsigned int impedance_sensing_num; +	unsigned int *impedance_sensing_table;  };  #endif diff --git a/include/sound/s3c24xx_uda134x.h b/include/sound/s3c24xx_uda134x.h index ffaf1f098c8e..0232b80ff486 100644 --- a/include/sound/s3c24xx_uda134x.h +++ b/include/sound/s3c24xx_uda134x.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _S3C24XX_UDA134X_H_  #define _S3C24XX_UDA134X_H_ 1 diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h index feb58d455560..4b9ee3009aa0 100644 --- a/include/sound/seq_kernel.h +++ b/include/sound/seq_kernel.h @@ -49,7 +49,8 @@ typedef union snd_seq_timestamp snd_seq_timestamp_t;  #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS	200  /* max delivery path length */ -#define SNDRV_SEQ_MAX_HOPS		10 +/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */ +#define SNDRV_SEQ_MAX_HOPS		8  /* max size of event size */  #define SNDRV_SEQ_MAX_EVENT_LEN		0x3fffffff diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h index a03acd0d398a..695257ae64ac 100644 --- a/include/sound/seq_virmidi.h +++ b/include/sound/seq_virmidi.h @@ -60,6 +60,7 @@ struct snd_virmidi_dev {  	int port;			/* created/attached port */  	unsigned int flags;		/* SNDRV_VIRMIDI_* */  	rwlock_t filelist_lock; +	struct rw_semaphore filelist_sem;  	struct list_head filelist;  }; diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h index cd0bab1ef6f1..55053557c898 100644 --- a/include/sound/snd_wavefront.h +++ b/include/sound/snd_wavefront.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __SOUND_SND_WAVEFRONT_H__  #define __SOUND_SND_WAVEFRONT_H__ @@ -28,6 +29,7 @@ struct _snd_wavefront_midi {  	struct snd_rawmidi_substream	 *substream_output[2];  	struct snd_rawmidi_substream	 *substream_input[2];  	struct timer_list	 timer; +	snd_wavefront_card_t	 *timer_card;          spinlock_t               open;          spinlock_t               virtual;     /* protects isvirtual */  }; diff --git a/include/sound/soc-acpi-intel-match.h b/include/sound/soc-acpi-intel-match.h new file mode 100644 index 000000000000..1a9191cd4bb3 --- /dev/null +++ b/include/sound/soc-acpi-intel-match.h @@ -0,0 +1,32 @@ + +/* + * Copyright (C) 2017, Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + */ + +#ifndef __LINUX_SND_SOC_ACPI_INTEL_MATCH_H +#define __LINUX_SND_SOC_ACPI_INTEL_MATCH_H + +#include <linux/stddef.h> +#include <linux/acpi.h> + +/* + * these tables are not constants, some fields can be used for + * pdata or machine ops + */ +extern struct snd_soc_acpi_mach snd_soc_acpi_intel_haswell_machines[]; +extern struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[]; +extern struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[]; +extern struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_machines[]; +extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[]; + +#endif diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h new file mode 100644 index 000000000000..a7d8d335b043 --- /dev/null +++ b/include/sound/soc-acpi.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2013-15, Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + */ + +#ifndef __LINUX_SND_SOC_ACPI_H +#define __LINUX_SND_SOC_ACPI_H + +#include <linux/stddef.h> +#include <linux/acpi.h> + +struct snd_soc_acpi_package_context { +	char *name;           /* package name */ +	int length;           /* number of elements */ +	struct acpi_buffer *format; +	struct acpi_buffer *state; +	bool data_valid; +}; + +#if IS_ENABLED(CONFIG_ACPI) +/* translation fron HID to I2C name, needed for DAI codec_name */ +const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]); +bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN], +				    struct snd_soc_acpi_package_context *ctx); +#else +static inline const char * +snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]) +{ +	return NULL; +} +static inline bool +snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN], +				   struct snd_soc_acpi_package_context *ctx) +{ +	return false; +} +#endif + +/* acpi match */ +struct snd_soc_acpi_mach * +snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines); + +/* acpi check hid */ +bool snd_soc_acpi_check_hid(const u8 hid[ACPI_ID_LEN]); + +/** + * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are + * related to the hardware, except for the firmware and topology file names. + * A platform supported by legacy and Sound Open Firmware (SOF) would expose + * all firmware/topology related fields. + * + * @id: ACPI ID (usually the codec's) used to find a matching machine driver. + * @drv_name: machine driver name + * @fw_filename: firmware file name. Used when SOF is not enabled. + * @board: board name + * @machine_quirk: pointer to quirk, usually based on DMI information when + * ACPI ID alone is not sufficient, wrong or misleading + * @quirk_data: data used to uniquely identify a machine, usually a list of + * audio codecs whose presence if checked with ACPI + * @pdata: intended for platform data or machine specific-ops. This structure + *  is not constant since this field may be updated at run-time + * @sof_fw_filename: Sound Open Firmware file name, if enabled + * @sof_tplg_filename: Sound Open Firmware topology file name, if enabled + * @asoc_plat_name: ASoC platform name, used for binding machine drivers + * if non NULL + * @new_mach_data: machine driver private data fixup + */ +/* Descriptor for SST ASoC machine driver */ +struct snd_soc_acpi_mach { +	const u8 id[ACPI_ID_LEN]; +	const char *drv_name; +	const char *fw_filename; +	const char *board; +	struct snd_soc_acpi_mach * (*machine_quirk)(void *arg); +	const void *quirk_data; +	void *pdata; +	const char *sof_fw_filename; +	const char *sof_tplg_filename; +	const char *asoc_plat_name; +	struct platform_device * (*new_mach_data)(void *pdata); +}; + +#define SND_SOC_ACPI_MAX_CODECS 3 + +/** + * struct snd_soc_acpi_codecs: Structure to hold secondary codec information + * apart from the matched one, this data will be passed to the quirk function + * to match with the ACPI detected devices + * + * @num_codecs: number of secondary codecs used in the platform + * @codecs: holds the codec IDs + * + */ +struct snd_soc_acpi_codecs { +	int num_codecs; +	u8 codecs[SND_SOC_ACPI_MAX_CODECS][ACPI_ID_LEN]; +}; + +/* check all codecs */ +struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg); + +#endif diff --git a/include/sound/soc.h b/include/sound/soc.h index d22de9712c45..1a7323238c49 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -468,6 +468,11 @@ int snd_soc_register_codec(struct device *dev,  		const struct snd_soc_codec_driver *codec_drv,  		struct snd_soc_dai_driver *dai_drv, int num_dai);  void snd_soc_unregister_codec(struct device *dev); +int snd_soc_add_component(struct device *dev, +		struct snd_soc_component *component, +		const struct snd_soc_component_driver *component_driver, +		struct snd_soc_dai_driver *dai_drv, +		int num_dai);  int snd_soc_register_component(struct device *dev,  			 const struct snd_soc_component_driver *component_driver,  			 struct snd_soc_dai_driver *dai_drv, int num_dai); @@ -475,6 +480,8 @@ int devm_snd_soc_register_component(struct device *dev,  			 const struct snd_soc_component_driver *component_driver,  			 struct snd_soc_dai_driver *dai_drv, int num_dai);  void snd_soc_unregister_component(struct device *dev); +struct snd_soc_component *snd_soc_lookup_component(struct device *dev, +						   const char *driver_name);  int snd_soc_cache_init(struct snd_soc_codec *codec);  int snd_soc_cache_exit(struct snd_soc_codec *codec); @@ -795,6 +802,10 @@ struct snd_soc_component_driver {  	int (*suspend)(struct snd_soc_component *);  	int (*resume)(struct snd_soc_component *); +	/* pcm creation and destruction */ +	int (*pcm_new)(struct snd_soc_pcm_runtime *); +	void (*pcm_free)(struct snd_pcm *); +  	/* component wide operations */  	int (*set_sysclk)(struct snd_soc_component *component,  			  int clk_id, int source, unsigned int freq, int dir); @@ -812,10 +823,22 @@ struct snd_soc_component_driver {  	void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,  		int subseq);  	int (*stream_event)(struct snd_soc_component *, int event); +	int (*set_bias_level)(struct snd_soc_component *component, +			      enum snd_soc_bias_level level); + +	const struct snd_pcm_ops *ops; +	const struct snd_compr_ops *compr_ops;  	/* probe ordering - for components with runtime dependencies */  	int probe_order;  	int remove_order; + +	/* bits */ +	unsigned int idle_bias_on:1; +	unsigned int suspend_bias_off:1; +	unsigned int pmdown_time:1; /* care pmdown_time at stop */ +	unsigned int endianness:1; +	unsigned int non_legacy_dai_naming:1;  };  struct snd_soc_component { @@ -872,6 +895,8 @@ struct snd_soc_component {  	void (*remove)(struct snd_soc_component *);  	int (*suspend)(struct snd_soc_component *);  	int (*resume)(struct snd_soc_component *); +	int (*pcm_new)(struct snd_soc_component *, struct snd_soc_pcm_runtime *); +	void (*pcm_free)(struct snd_soc_component *, struct snd_pcm *);  	int (*set_sysclk)(struct snd_soc_component *component,  			  int clk_id, int source, unsigned int freq, int dir); @@ -879,6 +904,8 @@ struct snd_soc_component {  		       int source, unsigned int freq_in, unsigned int freq_out);  	int (*set_jack)(struct snd_soc_component *component,  			struct snd_soc_jack *jack,  void *data); +	int (*set_bias_level)(struct snd_soc_component *component, +			      enum snd_soc_bias_level level);  	/* machine specific init */  	int (*init)(struct snd_soc_component *component); @@ -1413,6 +1440,21 @@ static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec,  }  /** + * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level + * @component: The COMPONENT for which to initialize the DAPM bias level + * @level: The DAPM level to initialize to + * + * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level(). + */ +static inline void +snd_soc_component_init_bias_level(struct snd_soc_component *component, +				  enum snd_soc_bias_level level) +{ +	snd_soc_dapm_init_bias_level( +		snd_soc_component_get_dapm(component), level); +} + +/**   * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level   * @codec: The CODEC for which to get the DAPM bias level   * @@ -1425,6 +1467,19 @@ static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level(  }  /** + * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level + * @component: The COMPONENT for which to get the DAPM bias level + * + * Returns: The current DAPM bias level of the COMPONENT. + */ +static inline enum snd_soc_bias_level +snd_soc_component_get_bias_level(struct snd_soc_component *component) +{ +	return snd_soc_dapm_get_bias_level( +		snd_soc_component_get_dapm(component)); +} + +/**   * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level   * @codec: The CODEC for which to set the level   * @level: The level to set to @@ -1440,6 +1495,23 @@ static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec,  }  /** + * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level + * @component: The COMPONENT for which to set the level + * @level: The level to set to + * + * Forces the COMPONENT bias level to a specific state. See + * snd_soc_dapm_force_bias_level(). + */ +static inline int +snd_soc_component_force_bias_level(struct snd_soc_component *component, +				   enum snd_soc_bias_level level) +{ +	return snd_soc_dapm_force_bias_level( +		snd_soc_component_get_dapm(component), +		level); +} + +/**   * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol   * @kcontrol: The kcontrol   * @@ -1452,6 +1524,19 @@ static inline struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(  	return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol));  } +/** + * snd_soc_dapm_kcontrol_component() - Returns the component associated to a kcontrol + * @kcontrol: The kcontrol + * + * This function must only be used on DAPM contexts that are known to be part of + * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined. + */ +static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component( +	struct snd_kcontrol *kcontrol) +{ +	return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol)); +} +  /* codec IO */  unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);  int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, @@ -1468,9 +1553,23 @@ static inline int snd_soc_cache_sync(struct snd_soc_codec *codec)  	return regcache_sync(codec->component.regmap);  } +/** + * snd_soc_component_cache_sync() - Sync the register cache with the hardware + * @component: COMPONENT to sync + * + * Note: This function will call regcache_sync() + */ +static inline int snd_soc_component_cache_sync( +	struct snd_soc_component *component) +{ +	return regcache_sync(component->regmap); +} +  /* component IO */  int snd_soc_component_read(struct snd_soc_component *component,  	unsigned int reg, unsigned int *val); +unsigned int snd_soc_component_read32(struct snd_soc_component *component, +				      unsigned int reg);  int snd_soc_component_write(struct snd_soc_component *component,  	unsigned int reg, unsigned int val);  int snd_soc_component_update_bits(struct snd_soc_component *component, @@ -1487,6 +1586,8 @@ int snd_soc_component_set_sysclk(struct snd_soc_component *component,  int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id,  			      int source, unsigned int freq_in,  			      unsigned int freq_out); +int snd_soc_component_set_jack(struct snd_soc_component *component, +			       struct snd_soc_jack *jack, void *data);  #ifdef CONFIG_REGMAP @@ -1720,6 +1821,20 @@ struct snd_soc_dai *snd_soc_find_dai(  #include <sound/soc-dai.h> +static inline +struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card, +					       const char *dai_name) +{ +	struct snd_soc_pcm_runtime *rtd; + +	list_for_each_entry(rtd, &card->rtd_list, list) { +		if (!strcmp(rtd->codec_dai->name, dai_name)) +			return rtd->codec_dai; +	} + +	return NULL; +} +  #ifdef CONFIG_DEBUG_FS  extern struct dentry *snd_soc_debugfs_root;  #endif diff --git a/include/sound/tas5086.h b/include/sound/tas5086.h index aac481b7db8f..a0a1c380f359 100644 --- a/include/sound/tas5086.h +++ b/include/sound/tas5086.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _SND_SOC_CODEC_TAS5086_H_  #define _SND_SOC_CODEC_TAS5086_H_ diff --git a/include/sound/timer.h b/include/sound/timer.h index c4d76ff056c6..7ae226ab6990 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h @@ -90,6 +90,8 @@ struct snd_timer {  	struct list_head ack_list_head;  	struct list_head sack_list_head; /* slow ack list head */  	struct tasklet_struct task_queue; +	int max_instances;	/* upper limit of timer instances */ +	int num_instances;	/* current number of timer instances */  };  struct snd_timer_instance { diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h index fb87d32f5e51..cf5f3fff1f1a 100644 --- a/include/target/iscsi/iscsi_target_core.h +++ b/include/target/iscsi/iscsi_target_core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ISCSI_TARGET_CORE_H  #define ISCSI_TARGET_CORE_H diff --git a/include/target/iscsi/iscsi_target_stat.h b/include/target/iscsi/iscsi_target_stat.h index c27dd471656d..4d75a2c426ca 100644 --- a/include/target/iscsi/iscsi_target_stat.h +++ b/include/target/iscsi/iscsi_target_stat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ISCSI_TARGET_STAT_H  #define ISCSI_TARGET_STAT_H @@ -8,16 +9,16 @@  /*   * For struct iscsi_tiqn->tiqn_wwn default groups   */ -extern struct config_item_type iscsi_stat_instance_cit; -extern struct config_item_type iscsi_stat_sess_err_cit; -extern struct config_item_type iscsi_stat_tgt_attr_cit; -extern struct config_item_type iscsi_stat_login_cit; -extern struct config_item_type iscsi_stat_logout_cit; +extern const struct config_item_type iscsi_stat_instance_cit; +extern const struct config_item_type iscsi_stat_sess_err_cit; +extern const struct config_item_type iscsi_stat_tgt_attr_cit; +extern const struct config_item_type iscsi_stat_login_cit; +extern const struct config_item_type iscsi_stat_logout_cit;  /*   * For struct iscsi_session->se_sess default groups   */ -extern struct config_item_type iscsi_stat_sess_cit; +extern const struct config_item_type iscsi_stat_sess_cit;  /* iSCSI session error types */  #define ISCSI_SESS_ERR_UNKNOWN		0 diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h index ff1a4f4cd66d..91948bc5b185 100644 --- a/include/target/iscsi/iscsi_transport.h +++ b/include/target/iscsi/iscsi_transport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include "iscsi_target_core.h" /* struct iscsi_cmd */  struct sockaddr_storage; diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index e150e391878b..b6b3fb444a92 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef TARGET_CORE_BACKEND_H  #define TARGET_CORE_BACKEND_H diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 516764febeb7..2c8d8115469d 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef TARGET_CORE_BASE_H  #define TARGET_CORE_BASE_H @@ -181,6 +182,7 @@ enum tcm_sense_reason_table {  	TCM_UNSUPPORTED_TARGET_DESC_TYPE_CODE	= R(0x1a),  	TCM_TOO_MANY_SEGMENT_DESCS		= R(0x1b),  	TCM_UNSUPPORTED_SEGMENT_DESC_TYPE_CODE	= R(0x1c), +	TCM_INSUFFICIENT_REGISTRATION_RESOURCES	= R(0x1d),  #undef R  }; @@ -489,6 +491,7 @@ struct se_cmd {  #define CMD_T_STOP		(1 << 5)  #define CMD_T_TAS		(1 << 10)  #define CMD_T_FABRIC_STOP	(1 << 11) +#define CMD_T_PRE_EXECUTE	(1 << 12)  	spinlock_t		t_state_lock;  	struct kref		cmd_kref;  	struct completion	t_transport_stop_comp; diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 33d2e3e5773c..b297aa0d9651 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef TARGET_CORE_FABRIC_H  #define TARGET_CORE_FABRIC_H diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index 6e3945f64102..d9e3d4aa3f6e 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Trace files that want to automate creation of all tracepoints defined   * in their file should include this file. The following are macros that the diff --git a/include/trace/events/9p.h b/include/trace/events/9p.h index 633ee9ee9778..78c5608a1648 100644 --- a/include/trace/events/9p.h +++ b/include/trace/events/9p.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM 9p diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h index 8b95c16b7045..6b59c63a8e51 100644 --- a/include/trace/events/afs.h +++ b/include/trace/events/afs.h @@ -30,6 +30,38 @@ enum afs_call_trace {  	afs_call_trace_work,  }; +enum afs_fs_operation { +	afs_FS_FetchData		= 130,	/* AFS Fetch file data */ +	afs_FS_FetchStatus		= 132,	/* AFS Fetch file status */ +	afs_FS_StoreData		= 133,	/* AFS Store file data */ +	afs_FS_StoreStatus		= 135,	/* AFS Store file status */ +	afs_FS_RemoveFile		= 136,	/* AFS Remove a file */ +	afs_FS_CreateFile		= 137,	/* AFS Create a file */ +	afs_FS_Rename			= 138,	/* AFS Rename or move a file or directory */ +	afs_FS_Symlink			= 139,	/* AFS Create a symbolic link */ +	afs_FS_Link			= 140,	/* AFS Create a hard link */ +	afs_FS_MakeDir			= 141,	/* AFS Create a directory */ +	afs_FS_RemoveDir		= 142,	/* AFS Remove a directory */ +	afs_FS_GetVolumeInfo		= 148,	/* AFS Get information about a volume */ +	afs_FS_GetVolumeStatus		= 149,	/* AFS Get volume status information */ +	afs_FS_GetRootVolume		= 151,	/* AFS Get root volume name */ +	afs_FS_SetLock			= 156,	/* AFS Request a file lock */ +	afs_FS_ExtendLock		= 157,	/* AFS Extend a file lock */ +	afs_FS_ReleaseLock		= 158,	/* AFS Release a file lock */ +	afs_FS_Lookup			= 161,	/* AFS lookup file in directory */ +	afs_FS_FetchData64		= 65537, /* AFS Fetch file data */ +	afs_FS_StoreData64		= 65538, /* AFS Store file data */ +	afs_FS_GiveUpAllCallBacks	= 65539, /* AFS Give up all our callbacks on a server */ +	afs_FS_GetCapabilities		= 65540, /* AFS Get FS server capabilities */ +}; + +enum afs_vl_operation { +	afs_VL_GetEntryByNameU	= 527,		/* AFS Get Vol Entry By Name operation ID */ +	afs_VL_GetAddrsU	= 533,		/* AFS Get FS server addresses */ +	afs_YFSVL_GetEndpoints	= 64002,	/* YFS Get FS & Vol server addresses */ +	afs_VL_GetCapabilities	= 65537,	/* AFS Get VL server capabilities */ +}; +  #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */  /* @@ -42,6 +74,37 @@ enum afs_call_trace {  	EM(afs_call_trace_wake,			"WAKE ") \  	E_(afs_call_trace_work,			"WORK ") +#define afs_fs_operations \ +	EM(afs_FS_FetchData,			"FS.FetchData") \ +	EM(afs_FS_FetchStatus,			"FS.FetchStatus") \ +	EM(afs_FS_StoreData,			"FS.StoreData") \ +	EM(afs_FS_StoreStatus,			"FS.StoreStatus") \ +	EM(afs_FS_RemoveFile,			"FS.RemoveFile") \ +	EM(afs_FS_CreateFile,			"FS.CreateFile") \ +	EM(afs_FS_Rename,			"FS.Rename") \ +	EM(afs_FS_Symlink,			"FS.Symlink") \ +	EM(afs_FS_Link,				"FS.Link") \ +	EM(afs_FS_MakeDir,			"FS.MakeDir") \ +	EM(afs_FS_RemoveDir,			"FS.RemoveDir") \ +	EM(afs_FS_GetVolumeInfo,		"FS.GetVolumeInfo") \ +	EM(afs_FS_GetVolumeStatus,		"FS.GetVolumeStatus") \ +	EM(afs_FS_GetRootVolume,		"FS.GetRootVolume") \ +	EM(afs_FS_SetLock,			"FS.SetLock") \ +	EM(afs_FS_ExtendLock,			"FS.ExtendLock") \ +	EM(afs_FS_ReleaseLock,			"FS.ReleaseLock") \ +	EM(afs_FS_Lookup,			"FS.Lookup") \ +	EM(afs_FS_FetchData64,			"FS.FetchData64") \ +	EM(afs_FS_StoreData64,			"FS.StoreData64") \ +	EM(afs_FS_GiveUpAllCallBacks,		"FS.GiveUpAllCallBacks") \ +	E_(afs_FS_GetCapabilities,		"FS.GetCapabilities") + +#define afs_vl_operations \ +	EM(afs_VL_GetEntryByNameU,		"VL.GetEntryByNameU") \ +	EM(afs_VL_GetAddrsU,			"VL.GetAddrsU") \ +	EM(afs_YFSVL_GetEndpoints,		"YFSVL.GetEndpoints") \ +	E_(afs_VL_GetCapabilities,		"VL.GetCapabilities") + +  /*   * Export enum symbols via userspace.   */ @@ -51,6 +114,8 @@ enum afs_call_trace {  #define E_(a, b) TRACE_DEFINE_ENUM(a);  afs_call_traces; +afs_fs_operations; +afs_vl_operations;  /*   * Now redefine the EM() and E_() macros to map the enums to the strings that @@ -178,6 +243,234 @@ TRACE_EVENT(afs_call,  		      __entry->where)  	    ); +TRACE_EVENT(afs_make_fs_call, +	    TP_PROTO(struct afs_call *call, const struct afs_fid *fid), + +	    TP_ARGS(call, fid), + +	    TP_STRUCT__entry( +		    __field(struct afs_call *,		call		) +		    __field(enum afs_fs_operation,	op		) +		    __field_struct(struct afs_fid,	fid		) +			     ), + +	    TP_fast_assign( +		    __entry->call = call; +		    __entry->op = call->operation_ID; +		    if (fid) { +			    __entry->fid = *fid; +		    } else { +			    __entry->fid.vid = 0; +			    __entry->fid.vnode = 0; +			    __entry->fid.unique = 0; +		    } +			   ), + +	    TP_printk("c=%p %06x:%06x:%06x %s", +		      __entry->call, +		      __entry->fid.vid, +		      __entry->fid.vnode, +		      __entry->fid.unique, +		      __print_symbolic(__entry->op, afs_fs_operations)) +	    ); + +TRACE_EVENT(afs_make_vl_call, +	    TP_PROTO(struct afs_call *call), + +	    TP_ARGS(call), + +	    TP_STRUCT__entry( +		    __field(struct afs_call *,		call		) +		    __field(enum afs_vl_operation,	op		) +			     ), + +	    TP_fast_assign( +		    __entry->call = call; +		    __entry->op = call->operation_ID; +			   ), + +	    TP_printk("c=%p %s", +		      __entry->call, +		      __print_symbolic(__entry->op, afs_vl_operations)) +	    ); + +TRACE_EVENT(afs_call_done, +	    TP_PROTO(struct afs_call *call), + +	    TP_ARGS(call), + +	    TP_STRUCT__entry( +		    __field(struct afs_call *,		call		) +		    __field(struct rxrpc_call *,	rx_call		) +		    __field(int,			ret		) +		    __field(u32,			abort_code	) +			     ), + +	    TP_fast_assign( +		    __entry->call = call; +		    __entry->rx_call = call->rxcall; +		    __entry->ret = call->error; +		    __entry->abort_code = call->abort_code; +			   ), + +	    TP_printk("   c=%p ret=%d ab=%d [%p]", +		      __entry->call, +		      __entry->ret, +		      __entry->abort_code, +		      __entry->rx_call) +	    ); + +TRACE_EVENT(afs_send_pages, +	    TP_PROTO(struct afs_call *call, struct msghdr *msg, +		     pgoff_t first, pgoff_t last, unsigned int offset), + +	    TP_ARGS(call, msg, first, last, offset), + +	    TP_STRUCT__entry( +		    __field(struct afs_call *,		call		) +		    __field(pgoff_t,			first		) +		    __field(pgoff_t,			last		) +		    __field(unsigned int,		nr		) +		    __field(unsigned int,		bytes		) +		    __field(unsigned int,		offset		) +		    __field(unsigned int,		flags		) +			     ), + +	    TP_fast_assign( +		    __entry->call = call; +		    __entry->first = first; +		    __entry->last = last; +		    __entry->nr = msg->msg_iter.nr_segs; +		    __entry->bytes = msg->msg_iter.count; +		    __entry->offset = offset; +		    __entry->flags = msg->msg_flags; +			   ), + +	    TP_printk(" c=%p %lx-%lx-%lx b=%x o=%x f=%x", +		      __entry->call, +		      __entry->first, __entry->first + __entry->nr - 1, __entry->last, +		      __entry->bytes, __entry->offset, +		      __entry->flags) +	    ); + +TRACE_EVENT(afs_sent_pages, +	    TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last, +		     pgoff_t cursor, int ret), + +	    TP_ARGS(call, first, last, cursor, ret), + +	    TP_STRUCT__entry( +		    __field(struct afs_call *,		call		) +		    __field(pgoff_t,			first		) +		    __field(pgoff_t,			last		) +		    __field(pgoff_t,			cursor		) +		    __field(int,			ret		) +			     ), + +	    TP_fast_assign( +		    __entry->call = call; +		    __entry->first = first; +		    __entry->last = last; +		    __entry->cursor = cursor; +		    __entry->ret = ret; +			   ), + +	    TP_printk(" c=%p %lx-%lx c=%lx r=%d", +		      __entry->call, +		      __entry->first, __entry->last, +		      __entry->cursor, __entry->ret) +	    ); + +TRACE_EVENT(afs_dir_check_failed, +	    TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size), + +	    TP_ARGS(vnode, off, i_size), + +	    TP_STRUCT__entry( +		    __field(struct afs_vnode *,		vnode		) +		    __field(loff_t,			off		) +		    __field(loff_t,			i_size		) +			     ), + +	    TP_fast_assign( +		    __entry->vnode = vnode; +		    __entry->off = off; +		    __entry->i_size = i_size; +			   ), + +	    TP_printk("vn=%p %llx/%llx", +		      __entry->vnode, __entry->off, __entry->i_size) +	    ); + +/* + * We use page->private to hold the amount of the page that we've written to, + * splitting the field into two parts.  However, we need to represent a range + * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system. + */ +#if PAGE_SIZE > 32768 +#define AFS_PRIV_MAX	0xffffffff +#define AFS_PRIV_SHIFT	32 +#else +#define AFS_PRIV_MAX	0xffff +#define AFS_PRIV_SHIFT	16 +#endif + +TRACE_EVENT(afs_page_dirty, +	    TP_PROTO(struct afs_vnode *vnode, const char *where, +		     pgoff_t page, unsigned long priv), + +	    TP_ARGS(vnode, where, page, priv), + +	    TP_STRUCT__entry( +		    __field(struct afs_vnode *,		vnode		) +		    __field(const char *,		where		) +		    __field(pgoff_t,			page		) +		    __field(unsigned long,		priv		) +			     ), + +	    TP_fast_assign( +		    __entry->vnode = vnode; +		    __entry->where = where; +		    __entry->page = page; +		    __entry->priv = priv; +			   ), + +	    TP_printk("vn=%p %lx %s %lu-%lu", +		      __entry->vnode, __entry->page, __entry->where, +		      __entry->priv & AFS_PRIV_MAX, +		      __entry->priv >> AFS_PRIV_SHIFT) +	    ); + +TRACE_EVENT(afs_call_state, +	    TP_PROTO(struct afs_call *call, +		     enum afs_call_state from, +		     enum afs_call_state to, +		     int ret, u32 remote_abort), + +	    TP_ARGS(call, from, to, ret, remote_abort), + +	    TP_STRUCT__entry( +		    __field(struct afs_call *,		call		) +		    __field(enum afs_call_state,	from		) +		    __field(enum afs_call_state,	to		) +		    __field(int,			ret		) +		    __field(u32,			abort		) +			     ), + +	    TP_fast_assign( +		    __entry->call = call; +		    __entry->from = from; +		    __entry->to = to; +		    __entry->ret = ret; +		    __entry->abort = remote_abort; +			   ), + +	    TP_printk("c=%p %u->%u r=%d ab=%d", +		      __entry->call, +		      __entry->from, __entry->to, +		      __entry->ret, __entry->abort) +	    ); +  #endif /* _TRACE_AFS_H */  /* This part must be outside protection */ diff --git a/include/trace/events/alarmtimer.h b/include/trace/events/alarmtimer.h index ae4f358dd8e9..13483c7ca70b 100644 --- a/include/trace/events/alarmtimer.h +++ b/include/trace/events/alarmtimer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM alarmtimer diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h index 9130dd5a184a..ccd1a3bdff46 100644 --- a/include/trace/events/asoc.h +++ b/include/trace/events/asoc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM asoc diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h index daf749138ff8..2cbd6e42ad83 100644 --- a/include/trace/events/bcache.h +++ b/include/trace/events/bcache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM bcache diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 1fd7ff1a46f7..81b43f5bdf23 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM block diff --git a/include/trace/events/bpf.h b/include/trace/events/bpf.h index 52c8425d144b..150185647e6b 100644 --- a/include/trace/events/bpf.h +++ b/include/trace/events/bpf.h @@ -1,9 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM bpf  #if !defined(_TRACE_BPF_H) || defined(TRACE_HEADER_MULTI_READ)  #define _TRACE_BPF_H +/* These are only used within the BPF_SYSCALL code */ +#ifdef CONFIG_BPF_SYSCALL +  #include <linux/filter.h>  #include <linux/bpf.h>  #include <linux/fs.h> @@ -345,7 +349,7 @@ TRACE_EVENT(bpf_map_next_key,  		  __print_hex(__get_dynamic_array(nxt), __entry->key_len),  		  __entry->key_trunc ? " ..." : "")  ); - +#endif /* CONFIG_BPF_SYSCALL */  #endif /* _TRACE_BPF_H */  #include <trace/define_trace.h> diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index dc1d0df91e0b..4342a329821f 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM btrfs @@ -28,6 +29,13 @@ struct btrfs_qgroup_extent_record;  struct btrfs_qgroup;  struct prelim_ref; +TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR); +TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS); +TRACE_DEFINE_ENUM(FLUSH_DELALLOC); +TRACE_DEFINE_ENUM(FLUSH_DELALLOC_WAIT); +TRACE_DEFINE_ENUM(ALLOC_CHUNK); +TRACE_DEFINE_ENUM(COMMIT_TRANS); +  #define show_ref_type(type)						\  	__print_symbolic(type,						\  		{ BTRFS_TREE_BLOCK_REF_KEY, 	"TREE_BLOCK_REF" },	\ @@ -791,11 +799,10 @@ DEFINE_EVENT(btrfs_delayed_data_ref,  run_delayed_data_ref,  DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,  	TP_PROTO(const struct btrfs_fs_info *fs_info, -		 const struct btrfs_delayed_ref_node *ref,  		 const struct btrfs_delayed_ref_head *head_ref,  		 int action), -	TP_ARGS(fs_info, ref, head_ref, action), +	TP_ARGS(fs_info, head_ref, action),  	TP_STRUCT__entry_btrfs(  		__field(	u64,  bytenr		) @@ -805,8 +812,8 @@ DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,  	),  	TP_fast_assign_btrfs(fs_info, -		__entry->bytenr		= ref->bytenr; -		__entry->num_bytes	= ref->num_bytes; +		__entry->bytenr		= head_ref->bytenr; +		__entry->num_bytes	= head_ref->num_bytes;  		__entry->action		= action;  		__entry->is_data	= head_ref->is_data;  	), @@ -821,21 +828,19 @@ DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,  DEFINE_EVENT(btrfs_delayed_ref_head,  add_delayed_ref_head,  	TP_PROTO(const struct btrfs_fs_info *fs_info, -		 const struct btrfs_delayed_ref_node *ref,  		 const struct btrfs_delayed_ref_head *head_ref,  		 int action), -	TP_ARGS(fs_info, ref, head_ref, action) +	TP_ARGS(fs_info, head_ref, action)  );  DEFINE_EVENT(btrfs_delayed_ref_head,  run_delayed_ref_head,  	TP_PROTO(const struct btrfs_fs_info *fs_info, -		 const struct btrfs_delayed_ref_node *ref,  		 const struct btrfs_delayed_ref_head *head_ref,  		 int action), -	TP_ARGS(fs_info, ref, head_ref, action) +	TP_ARGS(fs_info, head_ref, action)  );  #define show_chunk_type(type)					\ @@ -1691,6 +1696,27 @@ DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,  	TP_ARGS(fs_info, oldref, newref, tree_size)  ); +TRACE_EVENT(btrfs_inode_mod_outstanding_extents, +	TP_PROTO(struct btrfs_root *root, u64 ino, int mod), + +	TP_ARGS(root, ino, mod), + +	TP_STRUCT__entry_btrfs( +		__field(	u64, root_objectid	) +		__field(	u64, ino		) +		__field(	int, mod		) +	), + +	TP_fast_assign_btrfs(root->fs_info, +		__entry->root_objectid	= root->objectid; +		__entry->ino		= ino; +		__entry->mod		= mod; +	), + +	TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d", +			show_root_type(__entry->root_objectid), +			(unsigned long long)__entry->ino, __entry->mod) +);  #endif /* _TRACE_BTRFS_H */  /* This part must be outside protection */ diff --git a/include/trace/events/cgroup.h b/include/trace/events/cgroup.h index c226f50e88fa..d74722c2ac8b 100644 --- a/include/trace/events/cgroup.h +++ b/include/trace/events/cgroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM cgroup diff --git a/include/trace/events/cma.h b/include/trace/events/cma.h index d7cd961720a7..5017a8829270 100644 --- a/include/trace/events/cma.h +++ b/include/trace/events/cma.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM cma diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h index 0a18ab6483ff..6074eff3d766 100644 --- a/include/trace/events/compaction.h +++ b/include/trace/events/compaction.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM compaction diff --git a/include/trace/events/context_tracking.h b/include/trace/events/context_tracking.h index ce8007cf29cf..0aa6fd68fdf9 100644 --- a/include/trace/events/context_tracking.h +++ b/include/trace/events/context_tracking.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM context_tracking diff --git a/include/trace/events/cpuhp.h b/include/trace/events/cpuhp.h index 996953db91d7..fe1d6e8cd99d 100644 --- a/include/trace/events/cpuhp.h +++ b/include/trace/events/cpuhp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM cpuhp diff --git a/include/trace/events/devlink.h b/include/trace/events/devlink.h index 09f1df228f2c..44acfbca1266 100644 --- a/include/trace/events/devlink.h +++ b/include/trace/events/devlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #if IS_ENABLED(CONFIG_NET_DEVLINK)  #undef TRACE_SYSTEM diff --git a/include/trace/events/dma_fence.h b/include/trace/events/dma_fence.h index 1157cb4c3c6f..2212adda8f77 100644 --- a/include/trace/events/dma_fence.h +++ b/include/trace/events/dma_fence.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM dma_fence @@ -8,46 +9,6 @@  struct dma_fence; -TRACE_EVENT(dma_fence_annotate_wait_on, - -	/* fence: the fence waiting on f1, f1: the fence to be waited on. */ -	TP_PROTO(struct dma_fence *fence, struct dma_fence *f1), - -	TP_ARGS(fence, f1), - -	TP_STRUCT__entry( -		__string(driver, fence->ops->get_driver_name(fence)) -		__string(timeline, fence->ops->get_timeline_name(fence)) -		__field(unsigned int, context) -		__field(unsigned int, seqno) - -		__string(waiting_driver, f1->ops->get_driver_name(f1)) -		__string(waiting_timeline, f1->ops->get_timeline_name(f1)) -		__field(unsigned int, waiting_context) -		__field(unsigned int, waiting_seqno) -	), - -	TP_fast_assign( -		__assign_str(driver, fence->ops->get_driver_name(fence)) -		__assign_str(timeline, fence->ops->get_timeline_name(fence)) -		__entry->context = fence->context; -		__entry->seqno = fence->seqno; - -		__assign_str(waiting_driver, f1->ops->get_driver_name(f1)) -		__assign_str(waiting_timeline, f1->ops->get_timeline_name(f1)) -		__entry->waiting_context = f1->context; -		__entry->waiting_seqno = f1->seqno; - -	), - -	TP_printk("driver=%s timeline=%s context=%u seqno=%u "	\ -		  "waits on driver=%s timeline=%s context=%u seqno=%u", -		  __get_str(driver), __get_str(timeline), __entry->context, -		  __entry->seqno, -		  __get_str(waiting_driver), __get_str(waiting_timeline), -		  __entry->waiting_context, __entry->waiting_seqno) -); -  DECLARE_EVENT_CLASS(dma_fence,  	TP_PROTO(struct dma_fence *fence), diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 9c3bc3883d2f..4d0e3af4e561 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM ext4 diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 5d216f7fb05a..8f8dd42fa57b 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM f2fs @@ -136,6 +137,18 @@ TRACE_DEFINE_ENUM(CP_TRIMMED);  		{ CP_UMOUNT,	"Umount" },				\  		{ CP_TRIMMED,	"Trimmed" }) +#define show_fsync_cpreason(type)					\ +	__print_symbolic(type,						\ +		{ CP_NO_NEEDED,		"no needed" },			\ +		{ CP_NON_REGULAR,	"non regular" },		\ +		{ CP_HARDLINK,		"hardlink" },			\ +		{ CP_SB_NEED_CP,	"sb needs cp" },		\ +		{ CP_WRONG_PINO,	"wrong pino" },			\ +		{ CP_NO_SPC_ROLL,	"no space roll forward" },	\ +		{ CP_NODE_NEED_CP,	"node needs cp" },		\ +		{ CP_FASTBOOT_MODE,	"fastboot mode" },		\ +		{ CP_SPEC_LOG_NUM,	"log type is 2" }) +  struct victim_sel_policy;  struct f2fs_map_blocks; @@ -210,14 +223,14 @@ DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,  TRACE_EVENT(f2fs_sync_file_exit, -	TP_PROTO(struct inode *inode, int need_cp, int datasync, int ret), +	TP_PROTO(struct inode *inode, int cp_reason, int datasync, int ret), -	TP_ARGS(inode, need_cp, datasync, ret), +	TP_ARGS(inode, cp_reason, datasync, ret),  	TP_STRUCT__entry(  		__field(dev_t,	dev)  		__field(ino_t,	ino) -		__field(int,	need_cp) +		__field(int,	cp_reason)  		__field(int,	datasync)  		__field(int,	ret)  	), @@ -225,15 +238,15 @@ TRACE_EVENT(f2fs_sync_file_exit,  	TP_fast_assign(  		__entry->dev		= inode->i_sb->s_dev;  		__entry->ino		= inode->i_ino; -		__entry->need_cp	= need_cp; +		__entry->cp_reason	= cp_reason;  		__entry->datasync	= datasync;  		__entry->ret		= ret;  	), -	TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, " +	TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, "  		"datasync = %d, ret = %d",  		show_dev_ino(__entry), -		__entry->need_cp ? "needed" : "not needed", +		show_fsync_cpreason(__entry->cp_reason),  		__entry->datasync,  		__entry->ret)  ); @@ -728,6 +741,91 @@ TRACE_EVENT(f2fs_get_victim,  		__entry->free)  ); +TRACE_EVENT(f2fs_lookup_start, + +	TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags), + +	TP_ARGS(dir, dentry, flags), + +	TP_STRUCT__entry( +		__field(dev_t,	dev) +		__field(ino_t,	ino) +		__field(const char *,	name) +		__field(unsigned int, flags) +	), + +	TP_fast_assign( +		__entry->dev	= dir->i_sb->s_dev; +		__entry->ino	= dir->i_ino; +		__entry->name	= dentry->d_name.name; +		__entry->flags	= flags; +	), + +	TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u", +		show_dev_ino(__entry), +		__entry->name, +		__entry->flags) +); + +TRACE_EVENT(f2fs_lookup_end, + +	TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino, +		int err), + +	TP_ARGS(dir, dentry, ino, err), + +	TP_STRUCT__entry( +		__field(dev_t,	dev) +		__field(ino_t,	ino) +		__field(const char *,	name) +		__field(nid_t,	cino) +		__field(int,	err) +	), + +	TP_fast_assign( +		__entry->dev	= dir->i_sb->s_dev; +		__entry->ino	= dir->i_ino; +		__entry->name	= dentry->d_name.name; +		__entry->cino	= ino; +		__entry->err	= err; +	), + +	TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d", +		show_dev_ino(__entry), +		__entry->name, +		__entry->cino, +		__entry->err) +); + +TRACE_EVENT(f2fs_readdir, + +	TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err), + +	TP_ARGS(dir, start_pos, end_pos, err), + +	TP_STRUCT__entry( +		__field(dev_t,	dev) +		__field(ino_t,	ino) +		__field(loff_t,	start) +		__field(loff_t,	end) +		__field(int,	err) +	), + +	TP_fast_assign( +		__entry->dev	= dir->i_sb->s_dev; +		__entry->ino	= dir->i_ino; +		__entry->start	= start_pos; +		__entry->end	= end_pos; +		__entry->err	= err; +	), + +	TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d", +		show_dev_ino(__entry), +		__entry->start, +		__entry->end, +		__entry->err) +); +  TRACE_EVENT(f2fs_fallocate,  	TP_PROTO(struct inode *inode, int mode, @@ -1286,6 +1384,13 @@ DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,  	TP_ARGS(dev, blkstart, blklen)  ); +DEFINE_EVENT(f2fs_discard, f2fs_remove_discard, + +	TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen), + +	TP_ARGS(dev, blkstart, blklen) +); +  TRACE_EVENT(f2fs_issue_reset_zone,  	TP_PROTO(struct block_device *dev, block_t blkstart), diff --git a/include/trace/events/fib.h b/include/trace/events/fib.h index 833cfcb6750d..81b7e985bb45 100644 --- a/include/trace/events/fib.h +++ b/include/trace/events/fib.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM fib diff --git a/include/trace/events/fib6.h b/include/trace/events/fib6.h index d60096cddb2a..7e8d48a81b91 100644 --- a/include/trace/events/fib6.h +++ b/include/trace/events/fib6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM fib6 @@ -12,9 +13,9 @@  TRACE_EVENT(fib6_table_lookup,  	TP_PROTO(const struct net *net, const struct rt6_info *rt, -		 u32 tb_id, const struct flowi6 *flp), +		 struct fib6_table *table, const struct flowi6 *flp), -	TP_ARGS(net, rt, tb_id, flp), +	TP_ARGS(net, rt, table, flp),  	TP_STRUCT__entry(  		__field(	u32,	tb_id		) @@ -34,7 +35,7 @@ TRACE_EVENT(fib6_table_lookup,  	TP_fast_assign(  		struct in6_addr *in6; -		__entry->tb_id = tb_id; +		__entry->tb_id = table->tb6_id;  		__entry->oif = flp->flowi6_oif;  		__entry->iif = flp->flowi6_iif;  		__entry->tos = ip6_tclass(flp->flowlabel); diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h index 63a7680347cb..d1faf3597b9d 100644 --- a/include/trace/events/filelock.h +++ b/include/trace/events/filelock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Events for filesystem locks   * diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h index ff91325b8123..ee05db7ee8d2 100644 --- a/include/trace/events/filemap.h +++ b/include/trace/events/filemap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM filemap diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h index fbc4a06f7310..97b09fcf7e52 100644 --- a/include/trace/events/fs_dax.h +++ b/include/trace/events/fs_dax.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM fs_dax @@ -148,7 +149,6 @@ DEFINE_EVENT(dax_pmd_insert_mapping_class, name, \  	TP_ARGS(inode, vmf, length, pfn, radix_entry))  DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping); -DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping_fallback);  DECLARE_EVENT_CLASS(dax_pte_fault_class,  	TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result), @@ -191,6 +191,8 @@ DEFINE_EVENT(dax_pte_fault_class, name, \  DEFINE_PTE_FAULT_EVENT(dax_pte_fault);  DEFINE_PTE_FAULT_EVENT(dax_pte_fault_done);  DEFINE_PTE_FAULT_EVENT(dax_load_hole); +DEFINE_PTE_FAULT_EVENT(dax_insert_pfn_mkwrite_no_entry); +DEFINE_PTE_FAULT_EVENT(dax_insert_pfn_mkwrite);  TRACE_EVENT(dax_insert_mapping,  	TP_PROTO(struct inode *inode, struct vm_fault *vmf, void *radix_entry), diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h index 697ee6678892..92e5e89e52ed 100644 --- a/include/trace/events/fsi.h +++ b/include/trace/events/fsi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM fsi diff --git a/include/trace/events/fsi_master_gpio.h b/include/trace/events/fsi_master_gpio.h index 11b36c119048..f95cf3264bf9 100644 --- a/include/trace/events/fsi_master_gpio.h +++ b/include/trace/events/fsi_master_gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM fsi_master_gpio diff --git a/include/trace/events/gpio.h b/include/trace/events/gpio.h index 2da73b92d47e..5c189a22c489 100644 --- a/include/trace/events/gpio.h +++ b/include/trace/events/gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM gpio diff --git a/include/trace/events/hswadsp.h b/include/trace/events/hswadsp.h index 0f78bbb02002..939d7a09d73f 100644 --- a/include/trace/events/hswadsp.h +++ b/include/trace/events/hswadsp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM hswadsp diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h index 04f58acda8e8..dd4db334bd63 100644 --- a/include/trace/events/huge_memory.h +++ b/include/trace/events/huge_memory.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM huge_memory diff --git a/include/trace/events/intel-sst.h b/include/trace/events/intel-sst.h index edc24e6dea1b..0416e91f8181 100644 --- a/include/trace/events/intel-sst.h +++ b/include/trace/events/intel-sst.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM intel-sst diff --git a/include/trace/events/intel_ish.h b/include/trace/events/intel_ish.h index 92f7d5b23177..e6d7ff55ee8c 100644 --- a/include/trace/events/intel_ish.h +++ b/include/trace/events/intel_ish.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM intel_ish diff --git a/include/trace/events/iommu.h b/include/trace/events/iommu.h index 99254ed89212..72b4582322ff 100644 --- a/include/trace/events/iommu.h +++ b/include/trace/events/iommu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * iommu trace points   * diff --git a/include/trace/events/ipi.h b/include/trace/events/ipi.h index 834a7362a610..0be71dad6ec0 100644 --- a/include/trace/events/ipi.h +++ b/include/trace/events/ipi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM ipi diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h index 1c41b74581f7..eeceafaaea4c 100644 --- a/include/trace/events/irq.h +++ b/include/trace/events/irq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM irq diff --git a/include/trace/events/irq_matrix.h b/include/trace/events/irq_matrix.h new file mode 100644 index 000000000000..267d4cbbf360 --- /dev/null +++ b/include/trace/events/irq_matrix.h @@ -0,0 +1,201 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM irq_matrix + +#if !defined(_TRACE_IRQ_MATRIX_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_IRQ_MATRIX_H + +#include <linux/tracepoint.h> + +struct irq_matrix; +struct cpumap; + +DECLARE_EVENT_CLASS(irq_matrix_global, + +	TP_PROTO(struct irq_matrix *matrix), + +	TP_ARGS(matrix), + +	TP_STRUCT__entry( +		__field(	unsigned int,	online_maps		) +		__field(	unsigned int,	global_available	) +		__field(	unsigned int,	global_reserved		) +		__field(	unsigned int,	total_allocated		) +	), + +	TP_fast_assign( +		__entry->online_maps		= matrix->online_maps; +		__entry->global_available	= matrix->global_available; +		__entry->global_reserved	= matrix->global_reserved; +		__entry->total_allocated	= matrix->total_allocated; +	), + +	TP_printk("online_maps=%d global_avl=%u, global_rsvd=%u, total_alloc=%u", +		  __entry->online_maps, __entry->global_available, +		  __entry->global_reserved, __entry->total_allocated) +); + +DECLARE_EVENT_CLASS(irq_matrix_global_update, + +	TP_PROTO(int bit, struct irq_matrix *matrix), + +	TP_ARGS(bit, matrix), + +	TP_STRUCT__entry( +		__field(	int,		bit			) +		__field(	unsigned int,	online_maps		) +		__field(	unsigned int,	global_available	) +		__field(	unsigned int,	global_reserved		) +		__field(	unsigned int,	total_allocated		) +	), + +	TP_fast_assign( +		__entry->bit			= bit; +		__entry->online_maps		= matrix->online_maps; +		__entry->global_available	= matrix->global_available; +		__entry->global_reserved	= matrix->global_reserved; +		__entry->total_allocated	= matrix->total_allocated; +	), + +	TP_printk("bit=%d online_maps=%d global_avl=%u, global_rsvd=%u, total_alloc=%u", +		  __entry->bit, __entry->online_maps, +		  __entry->global_available, __entry->global_reserved, +		  __entry->total_allocated) +); + +DECLARE_EVENT_CLASS(irq_matrix_cpu, + +	TP_PROTO(int bit, unsigned int cpu, struct irq_matrix *matrix, +		 struct cpumap *cmap), + +	TP_ARGS(bit, cpu, matrix, cmap), + +	TP_STRUCT__entry( +		__field(	int,		bit			) +		__field(	unsigned int,	cpu			) +		__field(	bool,		online			) +		__field(	unsigned int,	available		) +		__field(	unsigned int,	allocated		) +		__field(	unsigned int,	managed			) +		__field(	unsigned int,	online_maps		) +		__field(	unsigned int,	global_available	) +		__field(	unsigned int,	global_reserved		) +		__field(	unsigned int,	total_allocated		) +	), + +	TP_fast_assign( +		__entry->bit			= bit; +		__entry->cpu			= cpu; +		__entry->online			= cmap->online; +		__entry->available		= cmap->available; +		__entry->allocated		= cmap->allocated; +		__entry->managed		= cmap->managed; +		__entry->online_maps		= matrix->online_maps; +		__entry->global_available	= matrix->global_available; +		__entry->global_reserved	= matrix->global_reserved; +		__entry->total_allocated	= matrix->total_allocated; +	), + +	TP_printk("bit=%d cpu=%u online=%d avl=%u alloc=%u managed=%u online_maps=%u global_avl=%u, global_rsvd=%u, total_alloc=%u", +		  __entry->bit, __entry->cpu, __entry->online, +		  __entry->available, __entry->allocated, +		  __entry->managed, __entry->online_maps, +		  __entry->global_available, __entry->global_reserved, +		  __entry->total_allocated) +); + +DEFINE_EVENT(irq_matrix_global, irq_matrix_online, + +	TP_PROTO(struct irq_matrix *matrix), + +	TP_ARGS(matrix) +); + +DEFINE_EVENT(irq_matrix_global, irq_matrix_offline, + +	TP_PROTO(struct irq_matrix *matrix), + +	TP_ARGS(matrix) +); + +DEFINE_EVENT(irq_matrix_global, irq_matrix_reserve, + +	TP_PROTO(struct irq_matrix *matrix), + +	TP_ARGS(matrix) +); + +DEFINE_EVENT(irq_matrix_global, irq_matrix_remove_reserved, + +	TP_PROTO(struct irq_matrix *matrix), + +	TP_ARGS(matrix) +); + +DEFINE_EVENT(irq_matrix_global_update, irq_matrix_assign_system, + +	TP_PROTO(int bit, struct irq_matrix *matrix), + +	TP_ARGS(bit, matrix) +); + +DEFINE_EVENT(irq_matrix_cpu, irq_matrix_alloc_reserved, + +	TP_PROTO(int bit, unsigned int cpu, +		 struct irq_matrix *matrix, struct cpumap *cmap), + +	TP_ARGS(bit, cpu, matrix, cmap) +); + +DEFINE_EVENT(irq_matrix_cpu, irq_matrix_reserve_managed, + +	TP_PROTO(int bit, unsigned int cpu, +		 struct irq_matrix *matrix, struct cpumap *cmap), + +	TP_ARGS(bit, cpu, matrix, cmap) +); + +DEFINE_EVENT(irq_matrix_cpu, irq_matrix_remove_managed, + +	TP_PROTO(int bit, unsigned int cpu, +		 struct irq_matrix *matrix, struct cpumap *cmap), + +	TP_ARGS(bit, cpu, matrix, cmap) +); + +DEFINE_EVENT(irq_matrix_cpu, irq_matrix_alloc_managed, + +	TP_PROTO(int bit, unsigned int cpu, +		 struct irq_matrix *matrix, struct cpumap *cmap), + +	TP_ARGS(bit, cpu, matrix, cmap) +); + +DEFINE_EVENT(irq_matrix_cpu, irq_matrix_assign, + +	TP_PROTO(int bit, unsigned int cpu, +		 struct irq_matrix *matrix, struct cpumap *cmap), + +	TP_ARGS(bit, cpu, matrix, cmap) +); + +DEFINE_EVENT(irq_matrix_cpu, irq_matrix_alloc, + +	TP_PROTO(int bit, unsigned int cpu, +		 struct irq_matrix *matrix, struct cpumap *cmap), + +	TP_ARGS(bit, cpu, matrix, cmap) +); + +DEFINE_EVENT(irq_matrix_cpu, irq_matrix_free, + +	TP_PROTO(int bit, unsigned int cpu, +		 struct irq_matrix *matrix, struct cpumap *cmap), + +	TP_ARGS(bit, cpu, matrix, cmap) +); + + +#endif /*  _TRACE_IRQ_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h index c1d1f3eb242d..2310b259329f 100644 --- a/include/trace/events/jbd2.h +++ b/include/trace/events/jbd2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM jbd2 diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h index 6b2e154fd23a..eb57e3037deb 100644 --- a/include/trace/events/kmem.h +++ b/include/trace/events/kmem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM kmem @@ -171,24 +172,21 @@ TRACE_EVENT(mm_page_free,  TRACE_EVENT(mm_page_free_batched, -	TP_PROTO(struct page *page, int cold), +	TP_PROTO(struct page *page), -	TP_ARGS(page, cold), +	TP_ARGS(page),  	TP_STRUCT__entry(  		__field(	unsigned long,	pfn		) -		__field(	int,		cold		)  	),  	TP_fast_assign(  		__entry->pfn		= page_to_pfn(page); -		__entry->cold		= cold;  	), -	TP_printk("page=%p pfn=%lu order=0 cold=%d", +	TP_printk("page=%p pfn=%lu order=0",  			pfn_to_page(__entry->pfn), -			__entry->pfn, -			__entry->cold) +			__entry->pfn)  );  TRACE_EVENT(mm_page_alloc, diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h index dcffedfac431..e4b0b8e09932 100644 --- a/include/trace/events/kvm.h +++ b/include/trace/events/kvm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #if !defined(_TRACE_KVM_MAIN_H) || defined(TRACE_HEADER_MULTI_READ)  #define _TRACE_KVM_MAIN_H diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h index 2fbbf990e4b3..ab69434e2329 100644 --- a/include/trace/events/libata.h +++ b/include/trace/events/libata.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM libata diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h index 2821b86de63b..d7512129a324 100644 --- a/include/trace/events/lock.h +++ b/include/trace/events/lock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM lock diff --git a/include/trace/events/mce.h b/include/trace/events/mce.h index 70f02149808c..1391ada0da3b 100644 --- a/include/trace/events/mce.h +++ b/include/trace/events/mce.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM mce diff --git a/include/trace/events/mdio.h b/include/trace/events/mdio.h index 00d85f5f54e4..0f241cbe00ab 100644 --- a/include/trace/events/mdio.h +++ b/include/trace/events/mdio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM mdio diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h index 539b25a76111..bcf4daccd6be 100644 --- a/include/trace/events/migrate.h +++ b/include/trace/events/migrate.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM migrate diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h index f30a99ac65b6..200f731be557 100644 --- a/include/trace/events/mmc.h +++ b/include/trace/events/mmc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM mmc diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index fec6291a6703..dbe1bb058c09 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #include <linux/node.h>  #include <linux/mmzone.h>  #include <linux/compaction.h> @@ -31,7 +32,6 @@  	{(unsigned long)__GFP_ATOMIC,		"__GFP_ATOMIC"},	\  	{(unsigned long)__GFP_IO,		"__GFP_IO"},		\  	{(unsigned long)__GFP_FS,		"__GFP_FS"},		\ -	{(unsigned long)__GFP_COLD,		"__GFP_COLD"},		\  	{(unsigned long)__GFP_NOWARN,		"__GFP_NOWARN"},	\  	{(unsigned long)__GFP_RETRY_MAYFAIL,	"__GFP_RETRY_MAYFAIL"},	\  	{(unsigned long)__GFP_NOFAIL,		"__GFP_NOFAIL"},	\ @@ -45,7 +45,6 @@  	{(unsigned long)__GFP_RECLAIMABLE,	"__GFP_RECLAIMABLE"},	\  	{(unsigned long)__GFP_MOVABLE,		"__GFP_MOVABLE"},	\  	{(unsigned long)__GFP_ACCOUNT,		"__GFP_ACCOUNT"},	\ -	{(unsigned long)__GFP_NOTRACK,		"__GFP_NOTRACK"},	\  	{(unsigned long)__GFP_WRITE,		"__GFP_WRITE"},		\  	{(unsigned long)__GFP_RECLAIM,		"__GFP_RECLAIM"},	\  	{(unsigned long)__GFP_DIRECT_RECLAIM,	"__GFP_DIRECT_RECLAIM"},\ diff --git a/include/trace/events/module.h b/include/trace/events/module.h index 28c45997e451..097485c73c01 100644 --- a/include/trace/events/module.h +++ b/include/trace/events/module.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Because linux/module.h has tracepoints in the header, and ftrace.h   * used to include this file, define_trace.h includes linux/module.h diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h index 0b9e5136a2a3..f3a12566bed0 100644 --- a/include/trace/events/napi.h +++ b/include/trace/events/napi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM napi diff --git a/include/trace/events/net.h b/include/trace/events/net.h index 49cc7c3de252..9c886739246a 100644 --- a/include/trace/events/net.h +++ b/include/trace/events/net.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM net diff --git a/include/trace/events/nilfs2.h b/include/trace/events/nilfs2.h index c7805818fcc6..84ee31fc04cc 100644 --- a/include/trace/events/nilfs2.h +++ b/include/trace/events/nilfs2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM nilfs2 diff --git a/include/trace/events/nmi.h b/include/trace/events/nmi.h index da3ee96b8d03..18e0411398ba 100644 --- a/include/trace/events/nmi.h +++ b/include/trace/events/nmi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM nmi diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h index c3c19d47ae5e..26a11e4a2c36 100644 --- a/include/trace/events/oom.h +++ b/include/trace/events/oom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM oom diff --git a/include/trace/events/page_isolation.h b/include/trace/events/page_isolation.h index 8738a78e6bf4..bf4c42e8d6a4 100644 --- a/include/trace/events/page_isolation.h +++ b/include/trace/events/page_isolation.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM page_isolation diff --git a/include/trace/events/page_ref.h b/include/trace/events/page_ref.h index 81001f8b0db4..5d2ea93956ce 100644 --- a/include/trace/events/page_ref.h +++ b/include/trace/events/page_ref.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM page_ref diff --git a/include/trace/events/pagemap.h b/include/trace/events/pagemap.h index ce0803b8d05f..8fd1babae761 100644 --- a/include/trace/events/pagemap.h +++ b/include/trace/events/pagemap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM pagemap diff --git a/include/trace/events/percpu.h b/include/trace/events/percpu.h index ad34b1bae047..df112a64f6c9 100644 --- a/include/trace/events/percpu.h +++ b/include/trace/events/percpu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM percpu diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 54e3aad32806..908977d69783 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM power diff --git a/include/trace/events/power_cpu_migrate.h b/include/trace/events/power_cpu_migrate.h index f76dd4de625e..e338810639b4 100644 --- a/include/trace/events/power_cpu_migrate.h +++ b/include/trace/events/power_cpu_migrate.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM power diff --git a/include/trace/events/preemptirq.h b/include/trace/events/preemptirq.h new file mode 100644 index 000000000000..f5024c560d8f --- /dev/null +++ b/include/trace/events/preemptirq.h @@ -0,0 +1,70 @@ +#ifdef CONFIG_PREEMPTIRQ_EVENTS + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM preemptirq + +#if !defined(_TRACE_PREEMPTIRQ_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_PREEMPTIRQ_H + +#include <linux/ktime.h> +#include <linux/tracepoint.h> +#include <linux/string.h> +#include <asm/sections.h> + +DECLARE_EVENT_CLASS(preemptirq_template, + +	TP_PROTO(unsigned long ip, unsigned long parent_ip), + +	TP_ARGS(ip, parent_ip), + +	TP_STRUCT__entry( +		__field(u32, caller_offs) +		__field(u32, parent_offs) +	), + +	TP_fast_assign( +		__entry->caller_offs = (u32)(ip - (unsigned long)_stext); +		__entry->parent_offs = (u32)(parent_ip - (unsigned long)_stext); +	), + +	TP_printk("caller=%pF parent=%pF", +		  (void *)((unsigned long)(_stext) + __entry->caller_offs), +		  (void *)((unsigned long)(_stext) + __entry->parent_offs)) +); + +#ifndef CONFIG_PROVE_LOCKING +DEFINE_EVENT(preemptirq_template, irq_disable, +	     TP_PROTO(unsigned long ip, unsigned long parent_ip), +	     TP_ARGS(ip, parent_ip)); + +DEFINE_EVENT(preemptirq_template, irq_enable, +	     TP_PROTO(unsigned long ip, unsigned long parent_ip), +	     TP_ARGS(ip, parent_ip)); +#endif + +#ifdef CONFIG_DEBUG_PREEMPT +DEFINE_EVENT(preemptirq_template, preempt_disable, +	     TP_PROTO(unsigned long ip, unsigned long parent_ip), +	     TP_ARGS(ip, parent_ip)); + +DEFINE_EVENT(preemptirq_template, preempt_enable, +	     TP_PROTO(unsigned long ip, unsigned long parent_ip), +	     TP_ARGS(ip, parent_ip)); +#endif + +#endif /* _TRACE_PREEMPTIRQ_H */ + +#include <trace/define_trace.h> + +#else /* !CONFIG_PREEMPTIRQ_EVENTS */ + +#define trace_irq_enable(...) +#define trace_irq_disable(...) +#define trace_preempt_enable(...) +#define trace_preempt_disable(...) +#define trace_irq_enable_rcuidle(...) +#define trace_irq_disable_rcuidle(...) +#define trace_preempt_enable_rcuidle(...) +#define trace_preempt_disable_rcuidle(...) + +#endif diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h index f350170059c6..13d405b2fd8b 100644 --- a/include/trace/events/printk.h +++ b/include/trace/events/printk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM printk diff --git a/include/trace/events/random.h b/include/trace/events/random.h index 4684de344c5d..0560dfc33f1c 100644 --- a/include/trace/events/random.h +++ b/include/trace/events/random.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM random diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h index e91ae1f2290d..59d40c454aa0 100644 --- a/include/trace/events/rcu.h +++ b/include/trace/events/rcu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM rcu diff --git a/include/trace/events/regulator.h b/include/trace/events/regulator.h index 37502a7404b7..b70583c32c08 100644 --- a/include/trace/events/regulator.h +++ b/include/trace/events/regulator.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM regulator diff --git a/include/trace/events/rpm.h b/include/trace/events/rpm.h index 33f85b68c22c..26927a560eab 100644 --- a/include/trace/events/rpm.h +++ b/include/trace/events/rpm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM rpm diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 3c8b7f625670..bc01e06bc716 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM sched @@ -115,9 +116,9 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *  	 * RUNNING (we will not have dequeued if state != RUNNING).  	 */  	if (preempt) -		return TASK_STATE_MAX; +		return TASK_REPORT_MAX; -	return __get_task_state(p); +	return 1 << task_state_index(p);  }  #endif /* CREATE_TRACE_POINTS */ @@ -163,7 +164,7 @@ TRACE_EVENT(sched_switch,  				{ 0x40, "P" }, { 0x80, "I" }) :  		  "R", -		__entry->prev_state & TASK_STATE_MAX ? "+" : "", +		__entry->prev_state & TASK_REPORT_MAX ? "+" : "",  		__entry->next_comm, __entry->next_pid, __entry->next_prio)  ); diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h index 9a9b3e2550af..f624969a4f14 100644 --- a/include/trace/events/scsi.h +++ b/include/trace/events/scsi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM scsi diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h index 39a8a430d90f..86582923d51c 100644 --- a/include/trace/events/signal.h +++ b/include/trace/events/signal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM signal diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index 0c68ae22da22..9e92f22eb086 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM skb diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h index 779abb91df81..ec4dade24466 100644 --- a/include/trace/events/sock.h +++ b/include/trace/events/sock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM sock @@ -47,7 +48,7 @@ TRACE_EVENT(sock_exceed_buf_limit,  		strncpy(__entry->name, prot->name, 32);  		__entry->sysctl_mem = prot->sysctl_mem;  		__entry->allocated = allocated; -		__entry->sysctl_rmem = prot->sysctl_rmem[0]; +		__entry->sysctl_rmem = sk_get_rmem0(sk, prot);  		__entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc);  	), diff --git a/include/trace/events/spi.h b/include/trace/events/spi.h index f9f702b6ae2e..277bb9d25779 100644 --- a/include/trace/events/spi.h +++ b/include/trace/events/spi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM spi diff --git a/include/trace/events/spmi.h b/include/trace/events/spmi.h index 62f005ef4c7e..8b60efe18ba6 100644 --- a/include/trace/events/spmi.h +++ b/include/trace/events/spmi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM spmi diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index 8a707f8a41c3..8c153f68509e 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM sunrpc @@ -70,6 +71,36 @@ TRACE_EVENT(rpc_connect_status,  		__entry->status)  ); +TRACE_EVENT(rpc_request, +	TP_PROTO(const struct rpc_task *task), + +	TP_ARGS(task), + +	TP_STRUCT__entry( +		__field(unsigned int, task_id) +		__field(unsigned int, client_id) +		__field(int, version) +		__field(bool, async) +		__string(progname, task->tk_client->cl_program->name) +		__string(procname, rpc_proc_name(task)) +	), + +	TP_fast_assign( +		__entry->task_id = task->tk_pid; +		__entry->client_id = task->tk_client->cl_clid; +		__entry->version = task->tk_client->cl_vers; +		__entry->async = RPC_IS_ASYNC(task); +		__assign_str(progname, task->tk_client->cl_program->name) +		__assign_str(procname, rpc_proc_name(task)) +	), + +	TP_printk("task:%u@%u %sv%d %s (%ssync)", +		__entry->task_id, __entry->client_id, +		__get_str(progname), __entry->version, +		__get_str(procname), __entry->async ? "a": "" +		) +); +  DECLARE_EVENT_CLASS(rpc_task_running,  	TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), @@ -341,21 +372,21 @@ DECLARE_EVENT_CLASS(rpc_xprt_event,  	TP_ARGS(xprt, xid, status),  	TP_STRUCT__entry( -		__field(__be32, xid) +		__field(u32, xid)  		__field(int, status)  		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])  		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])  	),  	TP_fast_assign( -		__entry->xid = xid; +		__entry->xid = be32_to_cpu(xid);  		__entry->status = status;  		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);  		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);  	), -	TP_printk("peer=[%s]:%s xid=0x%x status=%d", __get_str(addr), -			__get_str(port), be32_to_cpu(__entry->xid), +	TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr), +			__get_str(port), __entry->xid,  			__entry->status)  ); @@ -416,7 +447,7 @@ TRACE_EVENT(xs_tcp_data_recv,  	TP_STRUCT__entry(  		__string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])  		__string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]) -		__field(__be32, xid) +		__field(u32, xid)  		__field(unsigned long, flags)  		__field(unsigned long, copied)  		__field(unsigned int, reclen) @@ -426,15 +457,15 @@ TRACE_EVENT(xs_tcp_data_recv,  	TP_fast_assign(  		__assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);  		__assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]); -		__entry->xid = xs->tcp_xid; +		__entry->xid = be32_to_cpu(xs->tcp_xid);  		__entry->flags = xs->tcp_flags;  		__entry->copied = xs->tcp_copied;  		__entry->reclen = xs->tcp_reclen;  		__entry->offset = xs->tcp_offset;  	), -	TP_printk("peer=[%s]:%s xid=0x%x flags=%s copied=%lu reclen=%u offset=%lu", -			__get_str(addr), __get_str(port), be32_to_cpu(__entry->xid), +	TP_printk("peer=[%s]:%s xid=0x%08x flags=%s copied=%lu reclen=%u offset=%lu", +			__get_str(addr), __get_str(port), __entry->xid,  			rpc_show_sock_xprt_flags(__entry->flags),  			__entry->copied, __entry->reclen, __entry->offset)  ); @@ -455,21 +486,23 @@ TRACE_EVENT(svc_recv,  	TP_ARGS(rqst, status),  	TP_STRUCT__entry( -		__field(struct sockaddr *, addr) -		__field(__be32, xid) +		__field(u32, xid)  		__field(int, status)  		__field(unsigned long, flags) +		__dynamic_array(unsigned char, addr, rqst->rq_addrlen)  	),  	TP_fast_assign( -		__entry->addr = (struct sockaddr *)&rqst->rq_addr; -		__entry->xid = status > 0 ? rqst->rq_xid : 0; +		__entry->xid = status > 0 ? be32_to_cpu(rqst->rq_xid) : 0;  		__entry->status = status;  		__entry->flags = rqst->rq_flags; +		memcpy(__get_dynamic_array(addr), +			&rqst->rq_addr, rqst->rq_addrlen);  	), -	TP_printk("addr=%pIScp xid=0x%x status=%d flags=%s", __entry->addr, -			be32_to_cpu(__entry->xid), __entry->status, +	TP_printk("addr=%pIScp xid=0x%08x status=%d flags=%s", +			(struct sockaddr *)__get_dynamic_array(addr), +			__entry->xid, __entry->status,  			show_rqstp_flags(__entry->flags))  ); @@ -480,21 +513,21 @@ DECLARE_EVENT_CLASS(svc_rqst_event,  	TP_ARGS(rqst),  	TP_STRUCT__entry( -		__field(__be32, xid) +		__field(u32, xid)  		__field(unsigned long, flags)  		__dynamic_array(unsigned char, addr, rqst->rq_addrlen)  	),  	TP_fast_assign( -		__entry->xid = rqst->rq_xid; +		__entry->xid = be32_to_cpu(rqst->rq_xid);  		__entry->flags = rqst->rq_flags;  		memcpy(__get_dynamic_array(addr),  			&rqst->rq_addr, rqst->rq_addrlen);  	), -	TP_printk("addr=%pIScp rq_xid=0x%x flags=%s", +	TP_printk("addr=%pIScp rq_xid=0x%08x flags=%s",  		(struct sockaddr *)__get_dynamic_array(addr), -		be32_to_cpu(__entry->xid), +		__entry->xid,  		show_rqstp_flags(__entry->flags))  ); @@ -513,22 +546,23 @@ DECLARE_EVENT_CLASS(svc_rqst_status,  	TP_ARGS(rqst, status),  	TP_STRUCT__entry( -		__field(struct sockaddr *, addr) -		__field(__be32, xid) -		__field(int, dropme) +		__field(u32, xid)  		__field(int, status)  		__field(unsigned long, flags) +		__dynamic_array(unsigned char, addr, rqst->rq_addrlen)  	),  	TP_fast_assign( -		__entry->addr = (struct sockaddr *)&rqst->rq_addr; -		__entry->xid = rqst->rq_xid; +		__entry->xid = be32_to_cpu(rqst->rq_xid);  		__entry->status = status;  		__entry->flags = rqst->rq_flags; +		memcpy(__get_dynamic_array(addr), +			&rqst->rq_addr, rqst->rq_addrlen);  	), -	TP_printk("addr=%pIScp rq_xid=0x%x status=%d flags=%s", -		__entry->addr, be32_to_cpu(__entry->xid), +	TP_printk("addr=%pIScp rq_xid=0x%08x status=%d flags=%s", +		(struct sockaddr *)__get_dynamic_array(addr), +		__entry->xid,  		__entry->status, show_rqstp_flags(__entry->flags))  ); @@ -677,18 +711,19 @@ DECLARE_EVENT_CLASS(svc_deferred_event,  	TP_ARGS(dr),  	TP_STRUCT__entry( -		__field(__be32, xid) +		__field(u32, xid)  		__dynamic_array(unsigned char, addr, dr->addrlen)  	),  	TP_fast_assign( -		__entry->xid = *(__be32 *)(dr->args + (dr->xprt_hlen>>2)); +		__entry->xid = be32_to_cpu(*(__be32 *)(dr->args + +						       (dr->xprt_hlen>>2)));  		memcpy(__get_dynamic_array(addr), &dr->addr, dr->addrlen);  	), -	TP_printk("addr=%pIScp xid=0x%x", +	TP_printk("addr=%pIScp xid=0x%08x",  		(struct sockaddr *)__get_dynamic_array(addr), -		be32_to_cpu(__entry->xid)) +		__entry->xid)  );  DEFINE_EVENT(svc_deferred_event, svc_drop_deferred, diff --git a/include/trace/events/sunvnet.h b/include/trace/events/sunvnet.h index eb080b267e55..8d444f1bb10d 100644 --- a/include/trace/events/sunvnet.h +++ b/include/trace/events/sunvnet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM sunvnet diff --git a/include/trace/events/swiotlb.h b/include/trace/events/swiotlb.h index 288c0c54a2b4..705be43b71ab 100644 --- a/include/trace/events/swiotlb.h +++ b/include/trace/events/swiotlb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM swiotlb diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h index b35533b94277..44a3259ed4a5 100644 --- a/include/trace/events/syscalls.h +++ b/include/trace/events/syscalls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM raw_syscalls  #undef TRACE_INCLUDE_FILE diff --git a/include/trace/events/target.h b/include/trace/events/target.h index 50fea660c0f8..914a872dd343 100644 --- a/include/trace/events/target.h +++ b/include/trace/events/target.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM target diff --git a/include/trace/events/task.h b/include/trace/events/task.h index 2cca6cd342d8..64d160930b0d 100644 --- a/include/trace/events/task.h +++ b/include/trace/events/task.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM task diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h new file mode 100644 index 000000000000..07cccca6cbf1 --- /dev/null +++ b/include/trace/events/tcp.h @@ -0,0 +1,299 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM tcp + +#if !defined(_TRACE_TCP_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_TCP_H + +#include <linux/ipv6.h> +#include <linux/tcp.h> +#include <linux/tracepoint.h> +#include <net/ipv6.h> + +#define tcp_state_name(state)	{ state, #state } +#define show_tcp_state_name(val)			\ +	__print_symbolic(val,				\ +		tcp_state_name(TCP_ESTABLISHED),	\ +		tcp_state_name(TCP_SYN_SENT),		\ +		tcp_state_name(TCP_SYN_RECV),		\ +		tcp_state_name(TCP_FIN_WAIT1),		\ +		tcp_state_name(TCP_FIN_WAIT2),		\ +		tcp_state_name(TCP_TIME_WAIT),		\ +		tcp_state_name(TCP_CLOSE),		\ +		tcp_state_name(TCP_CLOSE_WAIT),		\ +		tcp_state_name(TCP_LAST_ACK),		\ +		tcp_state_name(TCP_LISTEN),		\ +		tcp_state_name(TCP_CLOSING),		\ +		tcp_state_name(TCP_NEW_SYN_RECV)) + +/* + * tcp event with arguments sk and skb + * + * Note: this class requires a valid sk pointer; while skb pointer could + *       be NULL. + */ +DECLARE_EVENT_CLASS(tcp_event_sk_skb, + +	TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + +	TP_ARGS(sk, skb), + +	TP_STRUCT__entry( +		__field(const void *, skbaddr) +		__field(const void *, skaddr) +		__field(__u16, sport) +		__field(__u16, dport) +		__array(__u8, saddr, 4) +		__array(__u8, daddr, 4) +		__array(__u8, saddr_v6, 16) +		__array(__u8, daddr_v6, 16) +	), + +	TP_fast_assign( +		struct inet_sock *inet = inet_sk(sk); +		struct in6_addr *pin6; +		__be32 *p32; + +		__entry->skbaddr = skb; +		__entry->skaddr = sk; + +		__entry->sport = ntohs(inet->inet_sport); +		__entry->dport = ntohs(inet->inet_dport); + +		p32 = (__be32 *) __entry->saddr; +		*p32 = inet->inet_saddr; + +		p32 = (__be32 *) __entry->daddr; +		*p32 =  inet->inet_daddr; + +#if IS_ENABLED(CONFIG_IPV6) +		if (sk->sk_family == AF_INET6) { +			pin6 = (struct in6_addr *)__entry->saddr_v6; +			*pin6 = sk->sk_v6_rcv_saddr; +			pin6 = (struct in6_addr *)__entry->daddr_v6; +			*pin6 = sk->sk_v6_daddr; +		} else +#endif +		{ +			pin6 = (struct in6_addr *)__entry->saddr_v6; +			ipv6_addr_set_v4mapped(inet->inet_saddr, pin6); +			pin6 = (struct in6_addr *)__entry->daddr_v6; +			ipv6_addr_set_v4mapped(inet->inet_daddr, pin6); +		} +	), + +	TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", +		  __entry->sport, __entry->dport, __entry->saddr, __entry->daddr, +		  __entry->saddr_v6, __entry->daddr_v6) +); + +DEFINE_EVENT(tcp_event_sk_skb, tcp_retransmit_skb, + +	TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + +	TP_ARGS(sk, skb) +); + +/* + * skb of trace_tcp_send_reset is the skb that caused RST. In case of + * active reset, skb should be NULL + */ +DEFINE_EVENT(tcp_event_sk_skb, tcp_send_reset, + +	TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + +	TP_ARGS(sk, skb) +); + +/* + * tcp event with arguments sk + * + * Note: this class requires a valid sk pointer. + */ +DECLARE_EVENT_CLASS(tcp_event_sk, + +	TP_PROTO(const struct sock *sk), + +	TP_ARGS(sk), + +	TP_STRUCT__entry( +		__field(const void *, skaddr) +		__field(__u16, sport) +		__field(__u16, dport) +		__array(__u8, saddr, 4) +		__array(__u8, daddr, 4) +		__array(__u8, saddr_v6, 16) +		__array(__u8, daddr_v6, 16) +	), + +	TP_fast_assign( +		struct inet_sock *inet = inet_sk(sk); +		struct in6_addr *pin6; +		__be32 *p32; + +		__entry->skaddr = sk; + +		__entry->sport = ntohs(inet->inet_sport); +		__entry->dport = ntohs(inet->inet_dport); + +		p32 = (__be32 *) __entry->saddr; +		*p32 = inet->inet_saddr; + +		p32 = (__be32 *) __entry->daddr; +		*p32 =  inet->inet_daddr; + +#if IS_ENABLED(CONFIG_IPV6) +		if (sk->sk_family == AF_INET6) { +			pin6 = (struct in6_addr *)__entry->saddr_v6; +			*pin6 = sk->sk_v6_rcv_saddr; +			pin6 = (struct in6_addr *)__entry->daddr_v6; +			*pin6 = sk->sk_v6_daddr; +		} else +#endif +		{ +			pin6 = (struct in6_addr *)__entry->saddr_v6; +			ipv6_addr_set_v4mapped(inet->inet_saddr, pin6); +			pin6 = (struct in6_addr *)__entry->daddr_v6; +			ipv6_addr_set_v4mapped(inet->inet_daddr, pin6); +		} +	), + +	TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", +		  __entry->sport, __entry->dport, +		  __entry->saddr, __entry->daddr, +		  __entry->saddr_v6, __entry->daddr_v6) +); + +DEFINE_EVENT(tcp_event_sk, tcp_receive_reset, + +	TP_PROTO(const struct sock *sk), + +	TP_ARGS(sk) +); + +DEFINE_EVENT(tcp_event_sk, tcp_destroy_sock, + +	TP_PROTO(const struct sock *sk), + +	TP_ARGS(sk) +); + +TRACE_EVENT(tcp_set_state, + +	TP_PROTO(const struct sock *sk, const int oldstate, const int newstate), + +	TP_ARGS(sk, oldstate, newstate), + +	TP_STRUCT__entry( +		__field(const void *, skaddr) +		__field(int, oldstate) +		__field(int, newstate) +		__field(__u16, sport) +		__field(__u16, dport) +		__array(__u8, saddr, 4) +		__array(__u8, daddr, 4) +		__array(__u8, saddr_v6, 16) +		__array(__u8, daddr_v6, 16) +	), + +	TP_fast_assign( +		struct inet_sock *inet = inet_sk(sk); +		struct in6_addr *pin6; +		__be32 *p32; + +		__entry->skaddr = sk; +		__entry->oldstate = oldstate; +		__entry->newstate = newstate; + +		__entry->sport = ntohs(inet->inet_sport); +		__entry->dport = ntohs(inet->inet_dport); + +		p32 = (__be32 *) __entry->saddr; +		*p32 = inet->inet_saddr; + +		p32 = (__be32 *) __entry->daddr; +		*p32 =  inet->inet_daddr; + +#if IS_ENABLED(CONFIG_IPV6) +		if (sk->sk_family == AF_INET6) { +			pin6 = (struct in6_addr *)__entry->saddr_v6; +			*pin6 = sk->sk_v6_rcv_saddr; +			pin6 = (struct in6_addr *)__entry->daddr_v6; +			*pin6 = sk->sk_v6_daddr; +		} else +#endif +		{ +			pin6 = (struct in6_addr *)__entry->saddr_v6; +			ipv6_addr_set_v4mapped(inet->inet_saddr, pin6); +			pin6 = (struct in6_addr *)__entry->daddr_v6; +			ipv6_addr_set_v4mapped(inet->inet_daddr, pin6); +		} +	), + +	TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s", +		  __entry->sport, __entry->dport, +		  __entry->saddr, __entry->daddr, +		  __entry->saddr_v6, __entry->daddr_v6, +		  show_tcp_state_name(__entry->oldstate), +		  show_tcp_state_name(__entry->newstate)) +); + +TRACE_EVENT(tcp_retransmit_synack, + +	TP_PROTO(const struct sock *sk, const struct request_sock *req), + +	TP_ARGS(sk, req), + +	TP_STRUCT__entry( +		__field(const void *, skaddr) +		__field(const void *, req) +		__field(__u16, sport) +		__field(__u16, dport) +		__array(__u8, saddr, 4) +		__array(__u8, daddr, 4) +		__array(__u8, saddr_v6, 16) +		__array(__u8, daddr_v6, 16) +	), + +	TP_fast_assign( +		struct inet_request_sock *ireq = inet_rsk(req); +		struct in6_addr *pin6; +		__be32 *p32; + +		__entry->skaddr = sk; +		__entry->req = req; + +		__entry->sport = ireq->ir_num; +		__entry->dport = ntohs(ireq->ir_rmt_port); + +		p32 = (__be32 *) __entry->saddr; +		*p32 = ireq->ir_loc_addr; + +		p32 = (__be32 *) __entry->daddr; +		*p32 = ireq->ir_rmt_addr; + +#if IS_ENABLED(CONFIG_IPV6) +		if (sk->sk_family == AF_INET6) { +			pin6 = (struct in6_addr *)__entry->saddr_v6; +			*pin6 = ireq->ir_v6_loc_addr; +			pin6 = (struct in6_addr *)__entry->daddr_v6; +			*pin6 = ireq->ir_v6_rmt_addr; +		} else +#endif +		{ +			pin6 = (struct in6_addr *)__entry->saddr_v6; +			ipv6_addr_set_v4mapped(ireq->ir_loc_addr, pin6); +			pin6 = (struct in6_addr *)__entry->daddr_v6; +			ipv6_addr_set_v4mapped(ireq->ir_rmt_addr, pin6); +		} +	), + +	TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", +		  __entry->sport, __entry->dport, +		  __entry->saddr, __entry->daddr, +		  __entry->saddr_v6, __entry->daddr_v6) +); + +#endif /* _TRACE_TCP_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h index 6cde5b3514c2..78946640fe03 100644 --- a/include/trace/events/thermal.h +++ b/include/trace/events/thermal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM thermal @@ -90,6 +91,7 @@ TRACE_EVENT(thermal_zone_trip,  		show_tzt_type(__entry->trip_type))  ); +#ifdef CONFIG_CPU_THERMAL  TRACE_EVENT(thermal_power_cpu_get_power,  	TP_PROTO(const struct cpumask *cpus, unsigned long freq, u32 *load,  		size_t load_len, u32 dynamic_power, u32 static_power), @@ -147,7 +149,9 @@ TRACE_EVENT(thermal_power_cpu_limit,  		__get_bitmask(cpumask), __entry->freq, __entry->cdev_state,  		__entry->power)  ); +#endif /* CONFIG_CPU_THERMAL */ +#ifdef CONFIG_DEVFREQ_THERMAL  TRACE_EVENT(thermal_power_devfreq_get_power,  	TP_PROTO(struct thermal_cooling_device *cdev,  		 struct devfreq_dev_status *status, unsigned long freq, @@ -203,6 +207,7 @@ TRACE_EVENT(thermal_power_devfreq_limit,  		__get_str(type), __entry->freq, __entry->cdev_state,  		__entry->power)  ); +#endif /* CONFIG_DEVFREQ_THERMAL */  #endif /* _TRACE_THERMAL_H */  /* This part must be outside protection */ diff --git a/include/trace/events/thermal_power_allocator.h b/include/trace/events/thermal_power_allocator.h index 5afae8fe3795..1c8fb95544f9 100644 --- a/include/trace/events/thermal_power_allocator.h +++ b/include/trace/events/thermal_power_allocator.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM thermal_power_allocator diff --git a/include/trace/events/thp.h b/include/trace/events/thp.h index b59b065e9e5d..d7fbbe551841 100644 --- a/include/trace/events/thp.h +++ b/include/trace/events/thp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM thp diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index 80787eafba99..16e305e69f34 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM timer diff --git a/include/trace/events/tlb.h b/include/trace/events/tlb.h index 9d14b1992108..b4d8e7dc38f8 100644 --- a/include/trace/events/tlb.h +++ b/include/trace/events/tlb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM tlb diff --git a/include/trace/events/udp.h b/include/trace/events/udp.h index a664bb940973..336fe272889f 100644 --- a/include/trace/events/udp.h +++ b/include/trace/events/udp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM udp diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h index b3a85b3df53e..83860de120e3 100644 --- a/include/trace/events/v4l2.h +++ b/include/trace/events/v4l2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM v4l2 diff --git a/include/trace/events/vb2.h b/include/trace/events/vb2.h index c1a22416ed05..a40146dea83d 100644 --- a/include/trace/events/vb2.h +++ b/include/trace/events/vb2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM vb2 diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index 27e8a5c77579..d70b53e65f43 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM vmscan @@ -133,6 +134,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_b  	TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)  ); +#ifdef CONFIG_MEMCG  DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,  	TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx), @@ -146,6 +148,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_  	TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)  ); +#endif /* CONFIG_MEMCG */  DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template, @@ -171,6 +174,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end  	TP_ARGS(nr_reclaimed)  ); +#ifdef CONFIG_MEMCG  DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,  	TP_PROTO(unsigned long nr_reclaimed), @@ -184,6 +188,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_re  	TP_ARGS(nr_reclaimed)  ); +#endif /* CONFIG_MEMCG */  TRACE_EVENT(mm_shrink_slab_start,  	TP_PROTO(struct shrinker *shr, struct shrink_control *sc, diff --git a/include/trace/events/vsock_virtio_transport_common.h b/include/trace/events/vsock_virtio_transport_common.h index b7f1d6278280..6782213778be 100644 --- a/include/trace/events/vsock_virtio_transport_common.h +++ b/include/trace/events/vsock_virtio_transport_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM vsock diff --git a/include/trace/events/wbt.h b/include/trace/events/wbt.h index 3c518e455680..b048694070e2 100644 --- a/include/trace/events/wbt.h +++ b/include/trace/events/wbt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM wbt diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h index bf0e18ba6cfb..2f057a494d93 100644 --- a/include/trace/events/workqueue.h +++ b/include/trace/events/workqueue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM workqueue diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 9b57f014d79d..32db72c7c055 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM writeback @@ -286,7 +287,6 @@ DEFINE_EVENT(writeback_class, name, \  	TP_PROTO(struct bdi_writeback *wb), \  	TP_ARGS(wb)) -DEFINE_WRITEBACK_EVENT(writeback_nowork);  DEFINE_WRITEBACK_EVENT(writeback_wake_background);  TRACE_EVENT(writeback_bdi_register, diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h index 4e16c43fba10..4cd0f05d0113 100644 --- a/include/trace/events/xdp.h +++ b/include/trace/events/xdp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM xdp @@ -136,14 +137,90 @@ DEFINE_EVENT_PRINT(xdp_redirect_template, xdp_redirect_map_err,  		  __entry->map_id, __entry->map_index)  ); +#define devmap_ifindex(fwd, map)				\ +	(!fwd ? 0 :						\ +	 (!map ? 0 :						\ +	  ((map->map_type == BPF_MAP_TYPE_DEVMAP) ?		\ +	   ((struct net_device *)fwd)->ifindex : 0))) +  #define _trace_xdp_redirect_map(dev, xdp, fwd, map, idx)		\ -	 trace_xdp_redirect_map(dev, xdp, fwd ? fwd->ifindex : 0,	\ +	 trace_xdp_redirect_map(dev, xdp, devmap_ifindex(fwd, map),	\  				0, map, idx)  #define _trace_xdp_redirect_map_err(dev, xdp, fwd, map, idx, err)	\ -	 trace_xdp_redirect_map_err(dev, xdp, fwd ? fwd->ifindex : 0,	\ +	 trace_xdp_redirect_map_err(dev, xdp, devmap_ifindex(fwd, map),	\  				    err, map, idx) +TRACE_EVENT(xdp_cpumap_kthread, + +	TP_PROTO(int map_id, unsigned int processed,  unsigned int drops, +		 int sched), + +	TP_ARGS(map_id, processed, drops, sched), + +	TP_STRUCT__entry( +		__field(int, map_id) +		__field(u32, act) +		__field(int, cpu) +		__field(unsigned int, drops) +		__field(unsigned int, processed) +		__field(int, sched) +	), + +	TP_fast_assign( +		__entry->map_id		= map_id; +		__entry->act		= XDP_REDIRECT; +		__entry->cpu		= smp_processor_id(); +		__entry->drops		= drops; +		__entry->processed	= processed; +		__entry->sched	= sched; +	), + +	TP_printk("kthread" +		  " cpu=%d map_id=%d action=%s" +		  " processed=%u drops=%u" +		  " sched=%d", +		  __entry->cpu, __entry->map_id, +		  __print_symbolic(__entry->act, __XDP_ACT_SYM_TAB), +		  __entry->processed, __entry->drops, +		  __entry->sched) +); + +TRACE_EVENT(xdp_cpumap_enqueue, + +	TP_PROTO(int map_id, unsigned int processed,  unsigned int drops, +		 int to_cpu), + +	TP_ARGS(map_id, processed, drops, to_cpu), + +	TP_STRUCT__entry( +		__field(int, map_id) +		__field(u32, act) +		__field(int, cpu) +		__field(unsigned int, drops) +		__field(unsigned int, processed) +		__field(int, to_cpu) +	), + +	TP_fast_assign( +		__entry->map_id		= map_id; +		__entry->act		= XDP_REDIRECT; +		__entry->cpu		= smp_processor_id(); +		__entry->drops		= drops; +		__entry->processed	= processed; +		__entry->to_cpu		= to_cpu; +	), + +	TP_printk("enqueue" +		  " cpu=%d map_id=%d action=%s" +		  " processed=%u drops=%u" +		  " to_cpu=%d", +		  __entry->cpu, __entry->map_id, +		  __print_symbolic(__entry->act, __XDP_ACT_SYM_TAB), +		  __entry->processed, __entry->drops, +		  __entry->to_cpu) +); +  #endif /* _TRACE_XDP_H */  #include <trace/define_trace.h> diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h index 1b4fed72f573..b8adf05c534e 100644 --- a/include/trace/events/xen.h +++ b/include/trace/events/xen.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM  #define TRACE_SYSTEM xen @@ -147,7 +148,6 @@ DECLARE_EVENT_CLASS(xen_mmu__set_pte,  		     TP_ARGS(ptep, pteval))  DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte); -DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte_atomic);  TRACE_EVENT(xen_mmu_set_pte_at,  	    TP_PROTO(struct mm_struct *mm, unsigned long addr, @@ -169,21 +169,6 @@ TRACE_EVENT(xen_mmu_set_pte_at,  		      (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval)  	); -TRACE_EVENT(xen_mmu_pte_clear, -	    TP_PROTO(struct mm_struct *mm, unsigned long addr, pte_t *ptep), -	    TP_ARGS(mm, addr, ptep), -	    TP_STRUCT__entry( -		    __field(struct mm_struct *, mm) -		    __field(unsigned long, addr) -		    __field(pte_t *, ptep) -		    ), -	    TP_fast_assign(__entry->mm = mm; -			   __entry->addr = addr; -			   __entry->ptep = ptep), -	    TP_printk("mm %p addr %lx ptep %p", -		      __entry->mm, __entry->addr, __entry->ptep) -	); -  TRACE_DEFINE_SIZEOF(pmdval_t);  TRACE_EVENT(xen_mmu_set_pmd, @@ -201,6 +186,24 @@ TRACE_EVENT(xen_mmu_set_pmd,  		      (int)sizeof(pmdval_t) * 2, (unsigned long long)__entry->pmdval)  	); +#ifdef CONFIG_X86_PAE +DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte_atomic); + +TRACE_EVENT(xen_mmu_pte_clear, +	    TP_PROTO(struct mm_struct *mm, unsigned long addr, pte_t *ptep), +	    TP_ARGS(mm, addr, ptep), +	    TP_STRUCT__entry( +		    __field(struct mm_struct *, mm) +		    __field(unsigned long, addr) +		    __field(pte_t *, ptep) +		    ), +	    TP_fast_assign(__entry->mm = mm; +			   __entry->addr = addr; +			   __entry->ptep = ptep), +	    TP_printk("mm %p addr %lx ptep %p", +		      __entry->mm, __entry->addr, __entry->ptep) +	); +  TRACE_EVENT(xen_mmu_pmd_clear,  	    TP_PROTO(pmd_t *pmdp),  	    TP_ARGS(pmdp), @@ -210,6 +213,7 @@ TRACE_EVENT(xen_mmu_pmd_clear,  	    TP_fast_assign(__entry->pmdp = pmdp),  	    TP_printk("pmdp %p", __entry->pmdp)  	); +#endif  #if CONFIG_PGTABLE_LEVELS >= 4 diff --git a/include/trace/perf.h b/include/trace/perf.h index 04fe68bbe767..dbc6c74defc3 100644 --- a/include/trace/perf.h +++ b/include/trace/perf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #undef TRACE_SYSTEM_VAR @@ -34,7 +35,6 @@ perf_trace_##call(void *__data, proto)					\  	struct trace_event_call *event_call = __data;			\  	struct trace_event_data_offsets_##call __maybe_unused __data_offsets;\  	struct trace_event_raw_##call *entry;				\ -	struct bpf_prog *prog = event_call->prog;			\  	struct pt_regs *__regs;						\  	u64 __count = 1;						\  	struct task_struct *__task = NULL;				\ @@ -46,8 +46,9 @@ perf_trace_##call(void *__data, proto)					\  	__data_size = trace_event_get_offsets_##call(&__data_offsets, args); \  									\  	head = this_cpu_ptr(event_call->perf_events);			\ -	if (!prog && __builtin_constant_p(!__task) && !__task &&	\ -				hlist_empty(head))			\ +	if (!bpf_prog_array_valid(event_call) &&			\ +	    __builtin_constant_p(!__task) && !__task &&			\ +	    hlist_empty(head))						\  		return;							\  									\  	__entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ diff --git a/include/trace/syscall.h b/include/trace/syscall.h index 7434f0f5d3f6..dc8ac27d27c1 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _TRACE_SYSCALL_H  #define _TRACE_SYSCALL_H diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 3976fa1f6e42..bfda803b0a09 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Stage 1 of the trace events.   * diff --git a/include/uapi/asm-generic/bitsperlong.h b/include/uapi/asm-generic/bitsperlong.h index 23e6c416b85f..693d9a40eb7b 100644 --- a/include/uapi/asm-generic/bitsperlong.h +++ b/include/uapi/asm-generic/bitsperlong.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG  #define _UAPI__ASM_GENERIC_BITS_PER_LONG diff --git a/include/uapi/asm-generic/errno-base.h b/include/uapi/asm-generic/errno-base.h index 65115978510f..9653140bff92 100644 --- a/include/uapi/asm-generic/errno-base.h +++ b/include/uapi/asm-generic/errno-base.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ASM_GENERIC_ERRNO_BASE_H  #define _ASM_GENERIC_ERRNO_BASE_H diff --git a/include/uapi/asm-generic/errno.h b/include/uapi/asm-generic/errno.h index 88e0914cf2d9..cf9c51ac49f9 100644 --- a/include/uapi/asm-generic/errno.h +++ b/include/uapi/asm-generic/errno.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ASM_GENERIC_ERRNO_H  #define _ASM_GENERIC_ERRNO_H diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h index e063effe0cc1..9dc0bf0c5a6e 100644 --- a/include/uapi/asm-generic/fcntl.h +++ b/include/uapi/asm-generic/fcntl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ASM_GENERIC_FCNTL_H  #define _ASM_GENERIC_FCNTL_H diff --git a/include/uapi/asm-generic/int-l64.h b/include/uapi/asm-generic/int-l64.h index 978f21cae2f4..ed8bcd99c34d 100644 --- a/include/uapi/asm-generic/int-l64.h +++ b/include/uapi/asm-generic/int-l64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * asm-generic/int-l64.h   * diff --git a/include/uapi/asm-generic/int-ll64.h b/include/uapi/asm-generic/int-ll64.h index a8658b2423ba..1ed06964257c 100644 --- a/include/uapi/asm-generic/int-ll64.h +++ b/include/uapi/asm-generic/int-ll64.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * asm-generic/int-ll64.h   * diff --git a/include/uapi/asm-generic/ioctl.h b/include/uapi/asm-generic/ioctl.h index 749b32fe5623..a84f4db8a250 100644 --- a/include/uapi/asm-generic/ioctl.h +++ b/include/uapi/asm-generic/ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_ASM_GENERIC_IOCTL_H  #define _UAPI_ASM_GENERIC_IOCTL_H diff --git a/include/uapi/asm-generic/ioctls.h b/include/uapi/asm-generic/ioctls.h index 14baf9f23a14..040651735662 100644 --- a/include/uapi/asm-generic/ioctls.h +++ b/include/uapi/asm-generic/ioctls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_IOCTLS_H  #define __ASM_GENERIC_IOCTLS_H diff --git a/include/uapi/asm-generic/ipcbuf.h b/include/uapi/asm-generic/ipcbuf.h index 3dbcc1e771c0..7d80dbd336fb 100644 --- a/include/uapi/asm-generic/ipcbuf.h +++ b/include/uapi/asm-generic/ipcbuf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_IPCBUF_H  #define __ASM_GENERIC_IPCBUF_H diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h index 203268f9231e..f8b134f5608f 100644 --- a/include/uapi/asm-generic/mman-common.h +++ b/include/uapi/asm-generic/mman-common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_MMAN_COMMON_H  #define __ASM_GENERIC_MMAN_COMMON_H @@ -16,6 +17,7 @@  #define MAP_SHARED	0x01		/* Share changes */  #define MAP_PRIVATE	0x02		/* Changes are private */ +#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */  #define MAP_TYPE	0x0f		/* Mask for type of mapping */  #define MAP_FIXED	0x10		/* Interpret addr exactly */  #define MAP_ANONYMOUS	0x20		/* don't use a file */ diff --git a/include/uapi/asm-generic/mman.h b/include/uapi/asm-generic/mman.h index 7162cd4cca73..653687d9771b 100644 --- a/include/uapi/asm-generic/mman.h +++ b/include/uapi/asm-generic/mman.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_MMAN_H  #define __ASM_GENERIC_MMAN_H @@ -12,6 +13,7 @@  #define MAP_NONBLOCK	0x10000		/* do not block on IO */  #define MAP_STACK	0x20000		/* give out an address that is best suited for process/thread stacks */  #define MAP_HUGETLB	0x40000		/* create a huge page mapping */ +#define MAP_SYNC	0x80000		/* perform synchronous page faults for the mapping */  /* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */ diff --git a/include/uapi/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h index f55ecc43c60f..fb306ebdb36f 100644 --- a/include/uapi/asm-generic/msgbuf.h +++ b/include/uapi/asm-generic/msgbuf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_MSGBUF_H  #define __ASM_GENERIC_MSGBUF_H diff --git a/include/uapi/asm-generic/param.h b/include/uapi/asm-generic/param.h index 5becc84396b8..baad02ea7f93 100644 --- a/include/uapi/asm-generic/param.h +++ b/include/uapi/asm-generic/param.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__ASM_GENERIC_PARAM_H  #define _UAPI__ASM_GENERIC_PARAM_H diff --git a/include/uapi/asm-generic/poll.h b/include/uapi/asm-generic/poll.h index a9694982689f..fefb3d2c3fac 100644 --- a/include/uapi/asm-generic/poll.h +++ b/include/uapi/asm-generic/poll.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_POLL_H  #define __ASM_GENERIC_POLL_H diff --git a/include/uapi/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h index fe74fccf18db..5e6ea22bd525 100644 --- a/include/uapi/asm-generic/posix_types.h +++ b/include/uapi/asm-generic/posix_types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_POSIX_TYPES_H  #define __ASM_GENERIC_POSIX_TYPES_H diff --git a/include/uapi/asm-generic/resource.h b/include/uapi/asm-generic/resource.h index c6d10af50123..f12db7a0da64 100644 --- a/include/uapi/asm-generic/resource.h +++ b/include/uapi/asm-generic/resource.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_ASM_GENERIC_RESOURCE_H  #define _UAPI_ASM_GENERIC_RESOURCE_H diff --git a/include/uapi/asm-generic/sembuf.h b/include/uapi/asm-generic/sembuf.h index 4cb2c13e5090..cbf9cfe977d6 100644 --- a/include/uapi/asm-generic/sembuf.h +++ b/include/uapi/asm-generic/sembuf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_SEMBUF_H  #define __ASM_GENERIC_SEMBUF_H diff --git a/include/uapi/asm-generic/setup.h b/include/uapi/asm-generic/setup.h index 6fc26a51003c..88ac5100df35 100644 --- a/include/uapi/asm-generic/setup.h +++ b/include/uapi/asm-generic/setup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_SETUP_H  #define __ASM_GENERIC_SETUP_H diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h index 7e9fb2f0853b..2b6c3bb97f97 100644 --- a/include/uapi/asm-generic/shmbuf.h +++ b/include/uapi/asm-generic/shmbuf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_SHMBUF_H  #define __ASM_GENERIC_SHMBUF_H diff --git a/include/uapi/asm-generic/shmparam.h b/include/uapi/asm-generic/shmparam.h index 51a3852de733..8b78c0ba08b1 100644 --- a/include/uapi/asm-generic/shmparam.h +++ b/include/uapi/asm-generic/shmparam.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_SHMPARAM_H  #define __ASM_GENERIC_SHMPARAM_H diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h index e5aa6794cea4..e447283b8f52 100644 --- a/include/uapi/asm-generic/siginfo.h +++ b/include/uapi/asm-generic/siginfo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_ASM_GENERIC_SIGINFO_H  #define _UAPI_ASM_GENERIC_SIGINFO_H diff --git a/include/uapi/asm-generic/signal-defs.h b/include/uapi/asm-generic/signal-defs.h index 00f95df54297..e9304c95ceea 100644 --- a/include/uapi/asm-generic/signal-defs.h +++ b/include/uapi/asm-generic/signal-defs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_SIGNAL_DEFS_H  #define __ASM_GENERIC_SIGNAL_DEFS_H diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h index 3094618d382f..5c716a952cbe 100644 --- a/include/uapi/asm-generic/signal.h +++ b/include/uapi/asm-generic/signal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__ASM_GENERIC_SIGNAL_H  #define _UAPI__ASM_GENERIC_SIGNAL_H diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h index e47c9e436221..0ae758c90e54 100644 --- a/include/uapi/asm-generic/socket.h +++ b/include/uapi/asm-generic/socket.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_SOCKET_H  #define __ASM_GENERIC_SOCKET_H diff --git a/include/uapi/asm-generic/sockios.h b/include/uapi/asm-generic/sockios.h index 9a61a369b901..64f658c7cec2 100644 --- a/include/uapi/asm-generic/sockios.h +++ b/include/uapi/asm-generic/sockios.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_SOCKIOS_H  #define __ASM_GENERIC_SOCKIOS_H diff --git a/include/uapi/asm-generic/stat.h b/include/uapi/asm-generic/stat.h index bd8cad21998e..0d962ecd1663 100644 --- a/include/uapi/asm-generic/stat.h +++ b/include/uapi/asm-generic/stat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_STAT_H  #define __ASM_GENERIC_STAT_H diff --git a/include/uapi/asm-generic/statfs.h b/include/uapi/asm-generic/statfs.h index cb89cc730f0b..bd35c7619ca2 100644 --- a/include/uapi/asm-generic/statfs.h +++ b/include/uapi/asm-generic/statfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_GENERIC_STATFS_H  #define _UAPI_GENERIC_STATFS_H diff --git a/include/uapi/asm-generic/swab.h b/include/uapi/asm-generic/swab.h index a8e9029d9eba..f2da4e4fd4d1 100644 --- a/include/uapi/asm-generic/swab.h +++ b/include/uapi/asm-generic/swab.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ASM_GENERIC_SWAB_H  #define _ASM_GENERIC_SWAB_H diff --git a/include/uapi/asm-generic/termbits.h b/include/uapi/asm-generic/termbits.h index 232b4781aef3..2fbaf9ae89dd 100644 --- a/include/uapi/asm-generic/termbits.h +++ b/include/uapi/asm-generic/termbits.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_TERMBITS_H  #define __ASM_GENERIC_TERMBITS_H diff --git a/include/uapi/asm-generic/termios.h b/include/uapi/asm-generic/termios.h index 088176062133..cf892933a363 100644 --- a/include/uapi/asm-generic/termios.h +++ b/include/uapi/asm-generic/termios.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_ASM_GENERIC_TERMIOS_H  #define _UAPI_ASM_GENERIC_TERMIOS_H  /* diff --git a/include/uapi/asm-generic/types.h b/include/uapi/asm-generic/types.h index a3877926b0d4..dfaa50d99d8f 100644 --- a/include/uapi/asm-generic/types.h +++ b/include/uapi/asm-generic/types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ASM_GENERIC_TYPES_H  #define _ASM_GENERIC_TYPES_H  /* diff --git a/include/uapi/asm-generic/ucontext.h b/include/uapi/asm-generic/ucontext.h index ad77343e8a9a..351868a72168 100644 --- a/include/uapi/asm-generic/ucontext.h +++ b/include/uapi/asm-generic/ucontext.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __ASM_GENERIC_UCONTEXT_H  #define __ASM_GENERIC_UCONTEXT_H diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 061185a5eb51..8b87de067bc7 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #include <asm/bitsperlong.h>  /* diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 7b8fa11c2285..919248fb4028 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -52,6 +52,8 @@ extern "C" {  #define DRM_AMDGPU_GEM_USERPTR		0x11  #define DRM_AMDGPU_WAIT_FENCES		0x12  #define DRM_AMDGPU_VM			0x13 +#define DRM_AMDGPU_FENCE_TO_HANDLE	0x14 +#define DRM_AMDGPU_SCHED		0x15  #define DRM_IOCTL_AMDGPU_GEM_CREATE	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)  #define DRM_IOCTL_AMDGPU_GEM_MMAP	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) @@ -67,6 +69,8 @@ extern "C" {  #define DRM_IOCTL_AMDGPU_GEM_USERPTR	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)  #define DRM_IOCTL_AMDGPU_WAIT_FENCES	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)  #define DRM_IOCTL_AMDGPU_VM		DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm) +#define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle) +#define DRM_IOCTL_AMDGPU_SCHED		DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched)  #define AMDGPU_GEM_DOMAIN_CPU		0x1  #define AMDGPU_GEM_DOMAIN_GTT		0x2 @@ -87,6 +91,10 @@ extern "C" {  #define AMDGPU_GEM_CREATE_SHADOW		(1 << 4)  /* Flag that allocating the BO should use linear VRAM */  #define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS	(1 << 5) +/* Flag that BO is always valid in this VM */ +#define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID	(1 << 6) +/* Flag that BO sharing will be explicitly synchronized */ +#define AMDGPU_GEM_CREATE_EXPLICIT_SYNC		(1 << 7)  struct drm_amdgpu_gem_create_in  {  	/** the requested memory size */ @@ -162,13 +170,22 @@ union drm_amdgpu_bo_list {  /* unknown cause */  #define AMDGPU_CTX_UNKNOWN_RESET	3 +/* Context priority level */ +#define AMDGPU_CTX_PRIORITY_UNSET       -2048 +#define AMDGPU_CTX_PRIORITY_VERY_LOW    -1023 +#define AMDGPU_CTX_PRIORITY_LOW         -512 +#define AMDGPU_CTX_PRIORITY_NORMAL      0 +/* Selecting a priority above NORMAL requires CAP_SYS_NICE or DRM_MASTER */ +#define AMDGPU_CTX_PRIORITY_HIGH        512 +#define AMDGPU_CTX_PRIORITY_VERY_HIGH   1023 +  struct drm_amdgpu_ctx_in {  	/** AMDGPU_CTX_OP_* */  	__u32	op;  	/** For future use, no flags defined so far */  	__u32	flags;  	__u32	ctx_id; -	__u32	_pad; +	__s32	priority;  };  union drm_amdgpu_ctx_out { @@ -212,6 +229,21 @@ union drm_amdgpu_vm {  	struct drm_amdgpu_vm_out out;  }; +/* sched ioctl */ +#define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE	1 + +struct drm_amdgpu_sched_in { +	/* AMDGPU_SCHED_OP_* */ +	__u32	op; +	__u32	fd; +	__s32	priority; +	__u32	flags; +}; + +union drm_amdgpu_sched { +	struct drm_amdgpu_sched_in in; +}; +  /*   * This is not a reliable API and you should expect it to fail for any   * number of reasons and have fallback path that do not use userptr to @@ -513,6 +545,21 @@ struct drm_amdgpu_cs_chunk_sem {  	__u32 handle;  }; +#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ	0 +#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD	1 +#define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD	2 + +union drm_amdgpu_fence_to_handle { +	struct { +		struct drm_amdgpu_fence fence; +		__u32 what; +		__u32 pad; +	} in; +	struct { +		__u32 handle; +	} out; +}; +  struct drm_amdgpu_cs_chunk_data {  	union {  		struct drm_amdgpu_cs_chunk_ib		ib_data; @@ -611,6 +658,7 @@ struct drm_amdgpu_cs_chunk_data {  	#define AMDGPU_INFO_SENSOR_VDDGFX		0x7  /* Number of VRAM page faults on CPU access. */  #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS	0x1E +#define AMDGPU_INFO_VRAM_LOST_COUNTER		0x1F  #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT	0  #define AMDGPU_INFO_MMR_SE_INDEX_MASK	0xff diff --git a/include/uapi/drm/armada_drm.h b/include/uapi/drm/armada_drm.h index 0cb932416cfe..af1c14c837c5 100644 --- a/include/uapi/drm/armada_drm.h +++ b/include/uapi/drm/armada_drm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2012 Russell King   *  With inspiration from the i915 driver diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 97677cd6964d..6fdff5945c8a 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -737,6 +737,28 @@ struct drm_syncobj_array {  	__u32 pad;  }; +/* Query current scanout sequence number */ +struct drm_crtc_get_sequence { +	__u32 crtc_id;		/* requested crtc_id */ +	__u32 active;		/* return: crtc output is active */ +	__u64 sequence;		/* return: most recent vblank sequence */ +	__s64 sequence_ns;	/* return: most recent time of first pixel out */ +}; + +/* Queue event to be delivered at specified sequence. Time stamp marks + * when the first pixel of the refresh cycle leaves the display engine + * for the display + */ +#define DRM_CRTC_SEQUENCE_RELATIVE		0x00000001	/* sequence is relative to current */ +#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS		0x00000002	/* Use next sequence if we've missed */ + +struct drm_crtc_queue_sequence { +	__u32 crtc_id; +	__u32 flags; +	__u64 sequence;		/* on input, target sequence. on output, actual sequence */ +	__u64 user_data;	/* user data passed to event */ +}; +  #if defined(__cplusplus)  }  #endif @@ -819,6 +841,9 @@ extern "C" {  #define DRM_IOCTL_WAIT_VBLANK		DRM_IOWR(0x3a, union drm_wait_vblank) +#define DRM_IOCTL_CRTC_GET_SEQUENCE	DRM_IOWR(0x3b, struct drm_crtc_get_sequence) +#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE	DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) +  #define DRM_IOCTL_UPDATE_DRAW		DRM_IOW(0x3f, struct drm_update_draw)  #define DRM_IOCTL_MODE_GETRESOURCES	DRM_IOWR(0xA0, struct drm_mode_card_res) @@ -863,6 +888,11 @@ extern "C" {  #define DRM_IOCTL_SYNCOBJ_RESET		DRM_IOWR(0xC4, struct drm_syncobj_array)  #define DRM_IOCTL_SYNCOBJ_SIGNAL	DRM_IOWR(0xC5, struct drm_syncobj_array) +#define DRM_IOCTL_MODE_CREATE_LEASE	DRM_IOWR(0xC6, struct drm_mode_create_lease) +#define DRM_IOCTL_MODE_LIST_LESSEES	DRM_IOWR(0xC7, struct drm_mode_list_lessees) +#define DRM_IOCTL_MODE_GET_LEASE	DRM_IOWR(0xC8, struct drm_mode_get_lease) +#define DRM_IOCTL_MODE_REVOKE_LEASE	DRM_IOWR(0xC9, struct drm_mode_revoke_lease) +  /**   * Device specific ioctls should only be in their respective headers   * The device specific ioctl range is from 0x40 to 0x9f. @@ -893,6 +923,7 @@ struct drm_event {  #define DRM_EVENT_VBLANK 0x01  #define DRM_EVENT_FLIP_COMPLETE 0x02 +#define DRM_EVENT_CRTC_SEQUENCE	0x03  struct drm_event_vblank {  	struct drm_event base; @@ -903,6 +934,16 @@ struct drm_event_vblank {  	__u32 crtc_id; /* 0 on older kernels that do not support this */  }; +/* Event delivered at sequence. Time stamp marks when the first pixel + * of the refresh cycle leaves the display engine for the display + */ +struct drm_event_crtc_sequence { +	struct drm_event	base; +	__u64			user_data; +	__s64			time_ns; +	__u64			sequence; +}; +  /* typedef area */  #ifndef __KERNEL__  typedef struct drm_clip_rect drm_clip_rect_t; diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 54fc38c3c3f1..5597a87154e5 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -749,9 +749,9 @@ struct drm_format_modifier {  	 * If the number formats grew to 128, and formats 98-102 are  	 * supported with the modifier:  	 * -	 * 0x0000003c00000000 0000000000000000 +	 * 0x0000007c00000000 0000000000000000  	 *		  ^ -	 *		  |__offset = 64, formats = 0x3c00000000 +	 *		  |__offset = 64, formats = 0x7c00000000  	 *  	 */  	__u64 formats; @@ -782,6 +782,72 @@ struct drm_mode_destroy_blob {  	__u32 blob_id;  }; +/** + * Lease mode resources, creating another drm_master. + */ +struct drm_mode_create_lease { +	/** Pointer to array of object ids (__u32) */ +	__u64 object_ids; +	/** Number of object ids */ +	__u32 object_count; +	/** flags for new FD (O_CLOEXEC, etc) */ +	__u32 flags; + +	/** Return: unique identifier for lessee. */ +	__u32 lessee_id; +	/** Return: file descriptor to new drm_master file */ +	__u32 fd; +}; + +/** + * List lesses from a drm_master + */ +struct drm_mode_list_lessees { +	/** Number of lessees. +	 * On input, provides length of the array. +	 * On output, provides total number. No +	 * more than the input number will be written +	 * back, so two calls can be used to get +	 * the size and then the data. +	 */ +	__u32 count_lessees; +	__u32 pad; + +	/** Pointer to lessees. +	 * pointer to __u64 array of lessee ids +	 */ +	__u64 lessees_ptr; +}; + +/** + * Get leased objects + */ +struct drm_mode_get_lease { +	/** Number of leased objects. +	 * On input, provides length of the array. +	 * On output, provides total number. No +	 * more than the input number will be written +	 * back, so two calls can be used to get +	 * the size and then the data. +	 */ +	__u32 count_objects; +	__u32 pad; + +	/** Pointer to objects. +	 * pointer to __u32 array of object ids +	 */ +	__u64 objects_ptr; +}; + +/** + * Revoke lease + */ +struct drm_mode_revoke_lease { +	/** Unique ID of lessee +	 */ +	__u32 lessee_id; +}; +  #if defined(__cplusplus)  }  #endif diff --git a/include/uapi/drm/etnaviv_drm.h b/include/uapi/drm/etnaviv_drm.h index 76f6f78a352b..e9b997a0ef27 100644 --- a/include/uapi/drm/etnaviv_drm.h +++ b/include/uapi/drm/etnaviv_drm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2015 Etnaviv Project   * @@ -150,6 +151,19 @@ struct drm_etnaviv_gem_submit_bo {  	__u64 presumed;       /* in/out, presumed buffer address */  }; +/* performance monitor request (pmr) */ +#define ETNA_PM_PROCESS_PRE             0x0001 +#define ETNA_PM_PROCESS_POST            0x0002 +struct drm_etnaviv_gem_submit_pmr { +	__u32 flags;          /* in, when to process request (ETNA_PM_PROCESS_x) */ +	__u8  domain;         /* in, pm domain */ +	__u8  pad; +	__u16 signal;         /* in, pm signal */ +	__u32 sequence;       /* in, sequence number */ +	__u32 read_offset;    /* in, offset from read_bo */ +	__u32 read_idx;       /* in, index of read_bo buffer */ +}; +  /* Each cmdstream submit consists of a table of buffers involved, and   * one or more cmdstream buffers.  This allows for conditional execution   * (context-restore), and IB buffers needed for per tile/bin draw cmds. @@ -175,6 +189,9 @@ struct drm_etnaviv_gem_submit {  	__u64 stream;         /* in, ptr to cmdstream */  	__u32 flags;          /* in, mask of ETNA_SUBMIT_x */  	__s32 fence_fd;       /* in/out, fence fd (see ETNA_SUBMIT_FENCE_FD_x) */ +	__u64 pmrs;           /* in, ptr to array of submit_pmr's */ +	__u32 nr_pmrs;        /* in, number of submit_pmr's */ +	__u32 pad;  };  /* The normal way to synchronize with the GPU is just to CPU_PREP on @@ -210,6 +227,27 @@ struct drm_etnaviv_gem_wait {  	struct drm_etnaviv_timespec timeout;	/* in */  }; +/* + * Performance Monitor (PM): + */ + +struct drm_etnaviv_pm_domain { +	__u32 pipe;       /* in */ +	__u8  iter;       /* in/out, select pm domain at index iter */ +	__u8  id;         /* out, id of domain */ +	__u16 nr_signals; /* out, how many signals does this domain provide */ +	char  name[64];   /* out, name of domain */ +}; + +struct drm_etnaviv_pm_signal { +	__u32 pipe;       /* in */ +	__u8  domain;     /* in, pm domain index */ +	__u8  pad; +	__u16 iter;       /* in/out, select pm source at index iter */ +	__u16 id;         /* out, id of signal */ +	char  name[64];   /* out, name of domain */ +}; +  #define DRM_ETNAVIV_GET_PARAM          0x00  /* placeholder:  #define DRM_ETNAVIV_SET_PARAM          0x01 @@ -222,7 +260,9 @@ struct drm_etnaviv_gem_wait {  #define DRM_ETNAVIV_WAIT_FENCE         0x07  #define DRM_ETNAVIV_GEM_USERPTR        0x08  #define DRM_ETNAVIV_GEM_WAIT           0x09 -#define DRM_ETNAVIV_NUM_IOCTLS         0x0a +#define DRM_ETNAVIV_PM_QUERY_DOM       0x0a +#define DRM_ETNAVIV_PM_QUERY_SIG       0x0b +#define DRM_ETNAVIV_NUM_IOCTLS         0x0c  #define DRM_IOCTL_ETNAVIV_GET_PARAM    DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GET_PARAM, struct drm_etnaviv_param)  #define DRM_IOCTL_ETNAVIV_GEM_NEW      DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_NEW, struct drm_etnaviv_gem_new) @@ -233,6 +273,8 @@ struct drm_etnaviv_gem_wait {  #define DRM_IOCTL_ETNAVIV_WAIT_FENCE   DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_WAIT_FENCE, struct drm_etnaviv_wait_fence)  #define DRM_IOCTL_ETNAVIV_GEM_USERPTR  DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_USERPTR, struct drm_etnaviv_gem_userptr)  #define DRM_IOCTL_ETNAVIV_GEM_WAIT     DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_WAIT, struct drm_etnaviv_gem_wait) +#define DRM_IOCTL_ETNAVIV_PM_QUERY_DOM DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_PM_QUERY_DOM, struct drm_etnaviv_pm_domain) +#define DRM_IOCTL_ETNAVIV_PM_QUERY_SIG DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_PM_QUERY_SIG, struct drm_etnaviv_pm_signal)  #if defined(__cplusplus)  } diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h index cb3e9f9d029f..d01087b2a651 100644 --- a/include/uapi/drm/exynos_drm.h +++ b/include/uapi/drm/exynos_drm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /* exynos_drm.h   *   * Copyright (c) 2011 Samsung Electronics Co., Ltd. diff --git a/include/uapi/drm/i810_drm.h b/include/uapi/drm/i810_drm.h index 6e6cf86b75b0..d285d5e72e6a 100644 --- a/include/uapi/drm/i810_drm.h +++ b/include/uapi/drm/i810_drm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _I810_DRM_H_  #define _I810_DRM_H_ diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 6598fb76d2c2..ac3c6503ca27 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -397,10 +397,20 @@ typedef struct drm_i915_irq_wait {  #define I915_PARAM_MIN_EU_IN_POOL	 39  #define I915_PARAM_MMAP_GTT_VERSION	 40 -/* Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution +/* + * Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution   * priorities and the driver will attempt to execute batches in priority order. + * The param returns a capability bitmask, nonzero implies that the scheduler + * is enabled, with different features present according to the mask. + * + * The initial priority for each batch is supplied by the context and is + * controlled via I915_CONTEXT_PARAM_PRIORITY.   */  #define I915_PARAM_HAS_SCHEDULER	 41 +#define   I915_SCHEDULER_CAP_ENABLED	(1ul << 0) +#define   I915_SCHEDULER_CAP_PRIORITY	(1ul << 1) +#define   I915_SCHEDULER_CAP_PREEMPTION	(1ul << 2) +  #define I915_PARAM_HUC_STATUS		 42  /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to opt-out of @@ -829,6 +839,7 @@ struct drm_i915_gem_exec_fence {  #define I915_EXEC_FENCE_WAIT            (1<<0)  #define I915_EXEC_FENCE_SIGNAL          (1<<1) +#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))  	__u32 flags;  }; @@ -1308,14 +1319,16 @@ struct drm_i915_reg_read {  	 * be specified  	 */  	__u64 offset; +#define I915_REG_READ_8B_WA (1ul << 0) +  	__u64 val; /* Return value */  };  /* Known registers:   *   * Render engine timestamp - 0x2358 + 64bit - gen7+   * - Note this register returns an invalid value if using the default - *   single instruction 8byte read, in order to workaround that use - *   offset (0x2538 | 1) instead. + *   single instruction 8byte read, in order to workaround that pass + *   flag I915_REG_READ_8B_WA in offset field.   *   */ @@ -1358,6 +1371,10 @@ struct drm_i915_gem_context_param {  #define I915_CONTEXT_PARAM_GTT_SIZE	0x3  #define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE	0x4  #define I915_CONTEXT_PARAM_BANNABLE	0x5 +#define I915_CONTEXT_PARAM_PRIORITY	0x6 +#define   I915_CONTEXT_MAX_USER_PRIORITY	1023 /* inclusive */ +#define   I915_CONTEXT_DEFAULT_PRIORITY		0 +#define   I915_CONTEXT_MIN_USER_PRIORITY	-1023 /* inclusive */  	__u64 value;  }; @@ -1509,9 +1526,14 @@ struct drm_i915_perf_oa_config {  	__u32 n_boolean_regs;  	__u32 n_flex_regs; -	__u64 __user mux_regs_ptr; -	__u64 __user boolean_regs_ptr; -	__u64 __user flex_regs_ptr; +	/* +	 * These fields are pointers to tuples of u32 values (register +	 * address, value). For example the expected length of the buffer +	 * pointed by mux_regs_ptr is (2 * sizeof(u32) * n_mux_regs). +	 */ +	__u64 mux_regs_ptr; +	__u64 boolean_regs_ptr; +	__u64 flex_regs_ptr;  };  #if defined(__cplusplus) diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h index ad4eb2863e70..bbbaffad772d 100644 --- a/include/uapi/drm/msm_drm.h +++ b/include/uapi/drm/msm_drm.h @@ -73,6 +73,7 @@ struct drm_msm_timespec {  #define MSM_PARAM_MAX_FREQ   0x04  #define MSM_PARAM_TIMESTAMP  0x05  #define MSM_PARAM_GMEM_BASE  0x06 +#define MSM_PARAM_NR_RINGS   0x07  struct drm_msm_param {  	__u32 pipe;           /* in, MSM_PIPE_x */ @@ -218,6 +219,7 @@ struct drm_msm_gem_submit {  	__u64 bos;            /* in, ptr to array of submit_bo's */  	__u64 cmds;           /* in, ptr to array of submit_cmd's */  	__s32 fence_fd;       /* in/out fence fd (see MSM_SUBMIT_FENCE_FD_IN/OUT) */ +	__u32 queueid;         /* in, submitqueue id */  };  /* The normal way to synchronize with the GPU is just to CPU_PREP on @@ -231,6 +233,7 @@ struct drm_msm_wait_fence {  	__u32 fence;          /* in */  	__u32 pad;  	struct drm_msm_timespec timeout;   /* in */ +	__u32 queueid;         /* in, submitqueue id */  };  /* madvise provides a way to tell the kernel in case a buffers contents @@ -254,6 +257,20 @@ struct drm_msm_gem_madvise {  	__u32 retained;       /* out, whether backing store still exists */  }; +/* + * Draw queues allow the user to set specific submission parameter. Command + * submissions specify a specific submitqueue to use.  ID 0 is reserved for + * backwards compatibility as a "default" submitqueue + */ + +#define MSM_SUBMITQUEUE_FLAGS (0) + +struct drm_msm_submitqueue { +	__u32 flags;   /* in, MSM_SUBMITQUEUE_x */ +	__u32 prio;    /* in, Priority level */ +	__u32 id;      /* out, identifier */ +}; +  #define DRM_MSM_GET_PARAM              0x00  /* placeholder:  #define DRM_MSM_SET_PARAM              0x01 @@ -265,6 +282,11 @@ struct drm_msm_gem_madvise {  #define DRM_MSM_GEM_SUBMIT             0x06  #define DRM_MSM_WAIT_FENCE             0x07  #define DRM_MSM_GEM_MADVISE            0x08 +/* placeholder: +#define DRM_MSM_GEM_SVM_NEW            0x09 + */ +#define DRM_MSM_SUBMITQUEUE_NEW        0x0A +#define DRM_MSM_SUBMITQUEUE_CLOSE      0x0B  #define DRM_IOCTL_MSM_GET_PARAM        DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param)  #define DRM_IOCTL_MSM_GEM_NEW          DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new) @@ -274,6 +296,8 @@ struct drm_msm_gem_madvise {  #define DRM_IOCTL_MSM_GEM_SUBMIT       DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit)  #define DRM_IOCTL_MSM_WAIT_FENCE       DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence)  #define DRM_IOCTL_MSM_GEM_MADVISE      DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise) +#define DRM_IOCTL_MSM_SUBMITQUEUE_NEW    DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue) +#define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE  DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32)  #if defined(__cplusplus)  } diff --git a/include/uapi/drm/omap_drm.h b/include/uapi/drm/omap_drm.h index fd5e3ea53f2b..1fccffef9e27 100644 --- a/include/uapi/drm/omap_drm.h +++ b/include/uapi/drm/omap_drm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * include/uapi/drm/omap_drm.h   * diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h index afae87004963..52263b575bdc 100644 --- a/include/uapi/drm/vc4_drm.h +++ b/include/uapi/drm/vc4_drm.h @@ -41,6 +41,7 @@ extern "C" {  #define DRM_VC4_SET_TILING                        0x08  #define DRM_VC4_GET_TILING                        0x09  #define DRM_VC4_LABEL_BO                          0x0a +#define DRM_VC4_GEM_MADVISE                       0x0b  #define DRM_IOCTL_VC4_SUBMIT_CL           DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl)  #define DRM_IOCTL_VC4_WAIT_SEQNO          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) @@ -53,6 +54,7 @@ extern "C" {  #define DRM_IOCTL_VC4_SET_TILING          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling)  #define DRM_IOCTL_VC4_GET_TILING          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling)  #define DRM_IOCTL_VC4_LABEL_BO            DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) +#define DRM_IOCTL_VC4_GEM_MADVISE         DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise)  struct drm_vc4_submit_rcl_surface {  	__u32 hindex; /* Handle index, or ~0 if not present. */ @@ -305,6 +307,7 @@ struct drm_vc4_get_hang_state {  #define DRM_VC4_PARAM_SUPPORTS_ETC1		4  #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS	5  #define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER	6 +#define DRM_VC4_PARAM_SUPPORTS_MADVISE		7  struct drm_vc4_get_param {  	__u32 param; @@ -333,6 +336,22 @@ struct drm_vc4_label_bo {  	__u64 name;  }; +/* + * States prefixed with '__' are internal states and cannot be passed to the + * DRM_IOCTL_VC4_GEM_MADVISE ioctl. + */ +#define VC4_MADV_WILLNEED			0 +#define VC4_MADV_DONTNEED			1 +#define __VC4_MADV_PURGED			2 +#define __VC4_MADV_NOTSUPP			3 + +struct drm_vc4_gem_madvise { +	__u32 handle; +	__u32 madv; +	__u32 retained; +	__u32 pad; +}; +  #if defined(__cplusplus)  }  #endif diff --git a/include/uapi/linux/a.out.h b/include/uapi/linux/a.out.h index 295cd3ef6330..5fafde3798e5 100644 --- a/include/uapi/linux/a.out.h +++ b/include/uapi/linux/a.out.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__A_OUT_GNU_H__  #define _UAPI__A_OUT_GNU_H__ diff --git a/include/uapi/linux/acct.h b/include/uapi/linux/acct.h index df2f9a0bba6a..0e72172cd23a 100644 --- a/include/uapi/linux/acct.h +++ b/include/uapi/linux/acct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  BSD Process Accounting for Linux - Definitions   * diff --git a/include/uapi/linux/adb.h b/include/uapi/linux/adb.h index 0ea1075fc4a0..12b6db148ea9 100644 --- a/include/uapi/linux/adb.h +++ b/include/uapi/linux/adb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Definitions for ADB (Apple Desktop Bus) support.   */ diff --git a/include/uapi/linux/adfs_fs.h b/include/uapi/linux/adfs_fs.h index a1bf43754ddd..151d93e27ed4 100644 --- a/include/uapi/linux/adfs_fs.h +++ b/include/uapi/linux/adfs_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_ADFS_FS_H  #define _UAPI_ADFS_FS_H diff --git a/include/uapi/linux/affs_hardblocks.h b/include/uapi/linux/affs_hardblocks.h index f1b948c1f592..5e2fb8481252 100644 --- a/include/uapi/linux/affs_hardblocks.h +++ b/include/uapi/linux/affs_hardblocks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef	AFFS_HARDBLOCKS_H  #define	AFFS_HARDBLOCKS_H diff --git a/include/uapi/linux/am437x-vpfe.h b/include/uapi/linux/am437x-vpfe.h index d75774317b9b..beae3521ca91 100644 --- a/include/uapi/linux/am437x-vpfe.h +++ b/include/uapi/linux/am437x-vpfe.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2013 - 2014 Texas Instruments, Inc.   * diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index 84a9a0944e13..bfaec6903b8b 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2008 Google, Inc.   * diff --git a/include/uapi/linux/apm_bios.h b/include/uapi/linux/apm_bios.h index df79bca1b898..37ee11dba94c 100644 --- a/include/uapi/linux/apm_bios.h +++ b/include/uapi/linux/apm_bios.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Include file for the interface to an APM BIOS   * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) diff --git a/include/uapi/linux/arcfb.h b/include/uapi/linux/arcfb.h index 721e7654daeb..7a9008b365df 100644 --- a/include/uapi/linux/arcfb.h +++ b/include/uapi/linux/arcfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_ARCFB_H__  #define __LINUX_ARCFB_H__ diff --git a/include/uapi/linux/aspeed-lpc-ctrl.h b/include/uapi/linux/aspeed-lpc-ctrl.h index c328c976c684..53abffcde3c6 100644 --- a/include/uapi/linux/aspeed-lpc-ctrl.h +++ b/include/uapi/linux/aspeed-lpc-ctrl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright 2017 IBM Corp.   * diff --git a/include/uapi/linux/atalk.h b/include/uapi/linux/atalk.h index 4bcd596e6388..8b96460b46b1 100644 --- a/include/uapi/linux/atalk.h +++ b/include/uapi/linux/atalk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_ATALK_H__  #define _UAPI__LINUX_ATALK_H__ diff --git a/include/uapi/linux/atm.h b/include/uapi/linux/atm.h index 88399db602ac..95ebdcf4fe88 100644 --- a/include/uapi/linux/atm.h +++ b/include/uapi/linux/atm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atm.h - general ATM declarations */  /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/uapi/linux/atm_eni.h b/include/uapi/linux/atm_eni.h index 34f317972551..cf5bfd1a2691 100644 --- a/include/uapi/linux/atm_eni.h +++ b/include/uapi/linux/atm_eni.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atm_eni.h - Driver-specific declarations of the ENI driver (for use by  	       driver-specific utilities) */ diff --git a/include/uapi/linux/atm_he.h b/include/uapi/linux/atm_he.h index 2a7713b597cf..9f4b43293988 100644 --- a/include/uapi/linux/atm_he.h +++ b/include/uapi/linux/atm_he.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atm_he.h */  #ifndef LINUX_ATM_HE_H diff --git a/include/uapi/linux/atm_idt77105.h b/include/uapi/linux/atm_idt77105.h index 8b724000aa50..f0fd6912a14b 100644 --- a/include/uapi/linux/atm_idt77105.h +++ b/include/uapi/linux/atm_idt77105.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atm_idt77105.h - Driver-specific declarations of the IDT77105 driver (for   * use by driver-specific utilities) */ diff --git a/include/uapi/linux/atm_nicstar.h b/include/uapi/linux/atm_nicstar.h index 577b79f33e8d..880d368b5b9a 100644 --- a/include/uapi/linux/atm_nicstar.h +++ b/include/uapi/linux/atm_nicstar.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /******************************************************************************   *   * atm_nicstar.h diff --git a/include/uapi/linux/atm_tcp.h b/include/uapi/linux/atm_tcp.h index 914e821da64d..7309e1bc8867 100644 --- a/include/uapi/linux/atm_tcp.h +++ b/include/uapi/linux/atm_tcp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by  	       driver-specific utilities) */ diff --git a/include/uapi/linux/atm_zatm.h b/include/uapi/linux/atm_zatm.h index 9c9c6ad55f14..5135027b93c1 100644 --- a/include/uapi/linux/atm_zatm.h +++ b/include/uapi/linux/atm_zatm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by  		driver-specific utilities) */ diff --git a/include/uapi/linux/atmapi.h b/include/uapi/linux/atmapi.h index 8fe54d90d95b..c9bf5c23a71f 100644 --- a/include/uapi/linux/atmapi.h +++ b/include/uapi/linux/atmapi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atmapi.h - ATM API user space/kernel compatibility */  /* Written 1999,2000 by Werner Almesberger, EPFL ICA */ diff --git a/include/uapi/linux/atmarp.h b/include/uapi/linux/atmarp.h index 231f4bdec730..8e44d121fde1 100644 --- a/include/uapi/linux/atmarp.h +++ b/include/uapi/linux/atmarp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */  /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/uapi/linux/atmbr2684.h b/include/uapi/linux/atmbr2684.h index fdb2629b6189..a9e2250cd720 100644 --- a/include/uapi/linux/atmbr2684.h +++ b/include/uapi/linux/atmbr2684.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_ATMBR2684_H  #define _LINUX_ATMBR2684_H diff --git a/include/uapi/linux/atmclip.h b/include/uapi/linux/atmclip.h index 02c94c448dd6..c818bb82b4e6 100644 --- a/include/uapi/linux/atmclip.h +++ b/include/uapi/linux/atmclip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atmclip.h - Classical IP over ATM */  /* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/uapi/linux/atmdev.h b/include/uapi/linux/atmdev.h index 93e0ec008ca8..a5c15cf23bd7 100644 --- a/include/uapi/linux/atmdev.h +++ b/include/uapi/linux/atmdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atmdev.h - ATM device driver declarations and various related items */  /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/uapi/linux/atmioc.h b/include/uapi/linux/atmioc.h index 37f67aa8f1c1..cd7655e40c77 100644 --- a/include/uapi/linux/atmioc.h +++ b/include/uapi/linux/atmioc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atmioc.h - ranges for ATM-related ioctl numbers */  /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/uapi/linux/atmlec.h b/include/uapi/linux/atmlec.h index 302791e3ab2b..c68346bb40e6 100644 --- a/include/uapi/linux/atmlec.h +++ b/include/uapi/linux/atmlec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * ATM Lan Emulation Daemon driver interface   * diff --git a/include/uapi/linux/atmmpc.h b/include/uapi/linux/atmmpc.h index 2aba5787fa63..cc17f4304839 100644 --- a/include/uapi/linux/atmmpc.h +++ b/include/uapi/linux/atmmpc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ATMMPC_H_  #define _ATMMPC_H_ diff --git a/include/uapi/linux/atmppp.h b/include/uapi/linux/atmppp.h index 300dcce0c83f..504b9989675b 100644 --- a/include/uapi/linux/atmppp.h +++ b/include/uapi/linux/atmppp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atmppp.h - RFC2364 PPPoATM */  /* Written 2000 by Mitchell Blank Jr */ diff --git a/include/uapi/linux/atmsap.h b/include/uapi/linux/atmsap.h index 799b104515d7..fc052481eae0 100644 --- a/include/uapi/linux/atmsap.h +++ b/include/uapi/linux/atmsap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atmsap.h - ATM Service Access Point addressing definitions */  /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/uapi/linux/atmsvc.h b/include/uapi/linux/atmsvc.h index aa71583b8da7..137b5f853449 100644 --- a/include/uapi/linux/atmsvc.h +++ b/include/uapi/linux/atmsvc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* atmsvc.h - ATM signaling kernel-demon interface definitions */  /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index 0714a66f0e0c..4e61a9e05132 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /* audit.h -- Auditing support   *   * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. @@ -112,6 +113,7 @@  #define AUDIT_FEATURE_CHANGE	1328	/* audit log listing feature changes */  #define AUDIT_REPLACE		1329	/* Replace auditd if this packet unanswerd */  #define AUDIT_KERN_MODULE	1330	/* Kernel Module events */ +#define AUDIT_FANOTIFY		1331	/* Fanotify access decision */  #define AUDIT_AVC		1400	/* SE Linux avc denial or grant */  #define AUDIT_SELINUX_ERR	1401	/* Internal SE Linux Errors */ @@ -155,8 +157,9 @@  #define AUDIT_FILTER_WATCH	0x03	/* Apply rule to file system watches */  #define AUDIT_FILTER_EXIT	0x04	/* Apply rule at syscall exit */  #define AUDIT_FILTER_TYPE	0x05	/* Apply rule at audit_log_start */ +#define AUDIT_FILTER_FS		0x06	/* Apply rule at __audit_inode_child */ -#define AUDIT_NR_FILTERS	6 +#define AUDIT_NR_FILTERS	7  #define AUDIT_FILTER_PREPEND	0x10	/* Prepend to front of list */ @@ -256,6 +259,7 @@  #define AUDIT_OBJ_LEV_HIGH	23  #define AUDIT_LOGINUID_SET	24  #define AUDIT_SESSIONID	25	/* Session ID */ +#define AUDIT_FSTYPE	26	/* FileSystem Type */  				/* These are ONLY useful when checking  				 * at syscall exit time (AUDIT_AT_EXIT). */ @@ -335,13 +339,15 @@ enum {  #define AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND	0x00000008  #define AUDIT_FEATURE_BITMAP_SESSIONID_FILTER	0x00000010  #define AUDIT_FEATURE_BITMAP_LOST_RESET		0x00000020 +#define AUDIT_FEATURE_BITMAP_FILTER_FS		0x00000040  #define AUDIT_FEATURE_BITMAP_ALL (AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT | \  				  AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME | \  				  AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH | \  				  AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND | \  				  AUDIT_FEATURE_BITMAP_SESSIONID_FILTER | \ -				  AUDIT_FEATURE_BITMAP_LOST_RESET) +				  AUDIT_FEATURE_BITMAP_LOST_RESET | \ +				  AUDIT_FEATURE_BITMAP_FILTER_FS)  /* deprecated: AUDIT_VERSION_* */  #define AUDIT_VERSION_LATEST 		AUDIT_FEATURE_BITMAP_ALL diff --git a/include/uapi/linux/auto_dev-ioctl.h b/include/uapi/linux/auto_dev-ioctl.h index 5558db8e6646..374742651c30 100644 --- a/include/uapi/linux/auto_dev-ioctl.h +++ b/include/uapi/linux/auto_dev-ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright 2008 Red Hat, Inc. All rights reserved.   * Copyright 2008 Ian Kent <raven@themaw.net> diff --git a/include/uapi/linux/auto_fs.h b/include/uapi/linux/auto_fs.h index aa63451ef20a..2a4432c7a4b4 100644 --- a/include/uapi/linux/auto_fs.h +++ b/include/uapi/linux/auto_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *   Copyright 1997 Transmeta Corporation - All Rights Reserved   * diff --git a/include/uapi/linux/auto_fs4.h b/include/uapi/linux/auto_fs4.h index 9453e9a07c9d..1f608e27a06f 100644 --- a/include/uapi/linux/auto_fs4.h +++ b/include/uapi/linux/auto_fs4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>   * diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h index 835c065cc7e1..abe5f2b6581b 100644 --- a/include/uapi/linux/auxvec.h +++ b/include/uapi/linux/auxvec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_AUXVEC_H  #define _UAPI_LINUX_AUXVEC_H diff --git a/include/uapi/linux/ax25.h b/include/uapi/linux/ax25.h index 74c89a41732d..b496b9d8452f 100644 --- a/include/uapi/linux/ax25.h +++ b/include/uapi/linux/ax25.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * These are the public elements of the Linux kernel AX.25 code. A similar   * file netrom.h exists for the NET/ROM protocol. diff --git a/include/uapi/linux/b1lli.h b/include/uapi/linux/b1lli.h index 713f712685d3..4ae6ac9950df 100644 --- a/include/uapi/linux/b1lli.h +++ b/include/uapi/linux/b1lli.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $   *   * ISDN lowlevel-module for AVM B1-card. diff --git a/include/uapi/linux/batman_adv.h b/include/uapi/linux/batman_adv.h index a83ddb7b63db..efd641c8a5d6 100644 --- a/include/uapi/linux/batman_adv.h +++ b/include/uapi/linux/batman_adv.h @@ -24,20 +24,6 @@  /**   * enum batadv_tt_client_flags - TT client specific flags - * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table - * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and the new - *  update telling its new real location has not been received/sent yet - * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi interface. - *  This information is used by the "AP Isolation" feature - * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This - *  information is used by the Extended Isolation feature - * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from the table - * @BATADV_TT_CLIENT_NEW: this client has been added to the local table but has - *  not been announced yet - * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it is kept - *  in the table for one more originator interval for consistency purposes - * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be part of - *  the network but no nnode has already announced it   *   * Bits from 0 to 7 are called _remote flags_ because they are sent on the wire.   * Bits from 8 to 15 are called _local flags_ because they are used for local @@ -48,160 +34,385 @@   * in the TT CRC computation.   */  enum batadv_tt_client_flags { +	/** +	 * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table +	 */  	BATADV_TT_CLIENT_DEL     = (1 << 0), + +	/** +	 * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and +	 * the new update telling its new real location has not been +	 * received/sent yet +	 */  	BATADV_TT_CLIENT_ROAM    = (1 << 1), + +	/** +	 * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi +	 * interface. This information is used by the "AP Isolation" feature +	 */  	BATADV_TT_CLIENT_WIFI    = (1 << 4), + +	/** +	 * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This +	 * information is used by the Extended Isolation feature +	 */  	BATADV_TT_CLIENT_ISOLA	 = (1 << 5), + +	/** +	 * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from +	 * the table +	 */  	BATADV_TT_CLIENT_NOPURGE = (1 << 8), + +	/** +	 * @BATADV_TT_CLIENT_NEW: this client has been added to the local table +	 * but has not been announced yet +	 */  	BATADV_TT_CLIENT_NEW     = (1 << 9), + +	/** +	 * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it +	 * is kept in the table for one more originator interval for consistency +	 * purposes +	 */  	BATADV_TT_CLIENT_PENDING = (1 << 10), + +	/** +	 * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be +	 * part of the network but no nnode has already announced it +	 */  	BATADV_TT_CLIENT_TEMP	 = (1 << 11),  };  /**   * enum batadv_nl_attrs - batman-adv netlink attributes - * - * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors - * @BATADV_ATTR_VERSION: batman-adv version string - * @BATADV_ATTR_ALGO_NAME: name of routing algorithm - * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface - * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface - * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface - * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface - * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface - * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv interface - * @BATADV_ATTR_ORIG_ADDRESS: originator mac address - * @BATADV_ATTR_TPMETER_RESULT: result of run (see batadv_tp_meter_status) - * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took - * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run - * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session - * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment - * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active - * @BATADV_ATTR_TT_ADDRESS: Client MAC address - * @BATADV_ATTR_TT_TTVN: Translation table version - * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version - * @BATADV_ATTR_TT_CRC32: CRC32 over translation table - * @BATADV_ATTR_TT_VID: VLAN ID - * @BATADV_ATTR_TT_FLAGS: Translation table client flags - * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best - * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen - * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address - * @BATADV_ATTR_TQ: TQ to neighbour - * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour - * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth - * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth - * @BATADV_ATTR_ROUTER: Gateway router MAC address - * @BATADV_ATTR_BLA_OWN: Flag indicating own originator - * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address - * @BATADV_ATTR_BLA_VID: BLA VLAN ID - * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address - * @BATADV_ATTR_BLA_CRC: BLA CRC - * @__BATADV_ATTR_AFTER_LAST: internal use - * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available - * @BATADV_ATTR_MAX: highest attribute number currently defined   */  enum batadv_nl_attrs { +	/** +	 * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors +	 */  	BATADV_ATTR_UNSPEC, + +	/** +	 * @BATADV_ATTR_VERSION: batman-adv version string +	 */  	BATADV_ATTR_VERSION, + +	/** +	 * @BATADV_ATTR_ALGO_NAME: name of routing algorithm +	 */  	BATADV_ATTR_ALGO_NAME, + +	/** +	 * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface +	 */  	BATADV_ATTR_MESH_IFINDEX, + +	/** +	 * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface +	 */  	BATADV_ATTR_MESH_IFNAME, + +	/** +	 * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface +	 */  	BATADV_ATTR_MESH_ADDRESS, + +	/** +	 * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface +	 */  	BATADV_ATTR_HARD_IFINDEX, + +	/** +	 * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface +	 */  	BATADV_ATTR_HARD_IFNAME, + +	/** +	 * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv +	 * interface +	 */  	BATADV_ATTR_HARD_ADDRESS, + +	/** +	 * @BATADV_ATTR_ORIG_ADDRESS: originator mac address +	 */  	BATADV_ATTR_ORIG_ADDRESS, + +	/** +	 * @BATADV_ATTR_TPMETER_RESULT: result of run (see +	 * batadv_tp_meter_status) +	 */  	BATADV_ATTR_TPMETER_RESULT, + +	/** +	 * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took +	 */  	BATADV_ATTR_TPMETER_TEST_TIME, + +	/** +	 * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run +	 */  	BATADV_ATTR_TPMETER_BYTES, + +	/** +	 * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session +	 */  	BATADV_ATTR_TPMETER_COOKIE, + +	/** +	 * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment +	 */  	BATADV_ATTR_PAD, + +	/** +	 * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active +	 */  	BATADV_ATTR_ACTIVE, + +	/** +	 * @BATADV_ATTR_TT_ADDRESS: Client MAC address +	 */  	BATADV_ATTR_TT_ADDRESS, + +	/** +	 * @BATADV_ATTR_TT_TTVN: Translation table version +	 */  	BATADV_ATTR_TT_TTVN, + +	/** +	 * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version +	 */  	BATADV_ATTR_TT_LAST_TTVN, + +	/** +	 * @BATADV_ATTR_TT_CRC32: CRC32 over translation table +	 */  	BATADV_ATTR_TT_CRC32, + +	/** +	 * @BATADV_ATTR_TT_VID: VLAN ID +	 */  	BATADV_ATTR_TT_VID, + +	/** +	 * @BATADV_ATTR_TT_FLAGS: Translation table client flags +	 */  	BATADV_ATTR_TT_FLAGS, + +	/** +	 * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best +	 */  	BATADV_ATTR_FLAG_BEST, + +	/** +	 * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen +	 */  	BATADV_ATTR_LAST_SEEN_MSECS, + +	/** +	 * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address +	 */  	BATADV_ATTR_NEIGH_ADDRESS, + +	/** +	 * @BATADV_ATTR_TQ: TQ to neighbour +	 */  	BATADV_ATTR_TQ, + +	/** +	 * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour +	 */  	BATADV_ATTR_THROUGHPUT, + +	/** +	 * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth +	 */  	BATADV_ATTR_BANDWIDTH_UP, + +	/** +	 * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth +	 */  	BATADV_ATTR_BANDWIDTH_DOWN, + +	/** +	 * @BATADV_ATTR_ROUTER: Gateway router MAC address +	 */  	BATADV_ATTR_ROUTER, + +	/** +	 * @BATADV_ATTR_BLA_OWN: Flag indicating own originator +	 */  	BATADV_ATTR_BLA_OWN, + +	/** +	 * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address +	 */  	BATADV_ATTR_BLA_ADDRESS, + +	/** +	 * @BATADV_ATTR_BLA_VID: BLA VLAN ID +	 */  	BATADV_ATTR_BLA_VID, + +	/** +	 * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address +	 */  	BATADV_ATTR_BLA_BACKBONE, + +	/** +	 * @BATADV_ATTR_BLA_CRC: BLA CRC +	 */  	BATADV_ATTR_BLA_CRC, +  	/* add attributes above here, update the policy in netlink.c */ + +	/** +	 * @__BATADV_ATTR_AFTER_LAST: internal use +	 */  	__BATADV_ATTR_AFTER_LAST, + +	/** +	 * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available +	 */  	NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST, + +	/** +	 * @BATADV_ATTR_MAX: highest attribute number currently defined +	 */  	BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1  };  /**   * enum batadv_nl_commands - supported batman-adv netlink commands - * - * @BATADV_CMD_UNSPEC: unspecified command to catch errors - * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv device - * @BATADV_CMD_TP_METER: Start a tp meter session - * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session - * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms. - * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces - * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations - * @BATADV_CMD_GET_TRANSTABLE_GLOBAL Query list of global translations - * @BATADV_CMD_GET_ORIGINATORS: Query list of originators - * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours - * @BATADV_CMD_GET_GATEWAYS: Query list of gateways - * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims - * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance backbones - * @__BATADV_CMD_AFTER_LAST: internal use - * @BATADV_CMD_MAX: highest used command number   */  enum batadv_nl_commands { +	/** +	 * @BATADV_CMD_UNSPEC: unspecified command to catch errors +	 */  	BATADV_CMD_UNSPEC, + +	/** +	 * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv +	 * device +	 */  	BATADV_CMD_GET_MESH_INFO, + +	/** +	 * @BATADV_CMD_TP_METER: Start a tp meter session +	 */  	BATADV_CMD_TP_METER, + +	/** +	 * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session +	 */  	BATADV_CMD_TP_METER_CANCEL, + +	/** +	 * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms. +	 */  	BATADV_CMD_GET_ROUTING_ALGOS, + +	/** +	 * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces +	 */  	BATADV_CMD_GET_HARDIFS, + +	/** +	 * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations +	 */  	BATADV_CMD_GET_TRANSTABLE_LOCAL, + +	/** +	 * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations +	 */  	BATADV_CMD_GET_TRANSTABLE_GLOBAL, + +	/** +	 * @BATADV_CMD_GET_ORIGINATORS: Query list of originators +	 */  	BATADV_CMD_GET_ORIGINATORS, + +	/** +	 * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours +	 */  	BATADV_CMD_GET_NEIGHBORS, + +	/** +	 * @BATADV_CMD_GET_GATEWAYS: Query list of gateways +	 */  	BATADV_CMD_GET_GATEWAYS, + +	/** +	 * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims +	 */  	BATADV_CMD_GET_BLA_CLAIM, + +	/** +	 * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance +	 * backbones +	 */  	BATADV_CMD_GET_BLA_BACKBONE, +  	/* add new commands above here */ + +	/** +	 * @__BATADV_CMD_AFTER_LAST: internal use +	 */  	__BATADV_CMD_AFTER_LAST, + +	/** +	 * @BATADV_CMD_MAX: highest used command number +	 */  	BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1  };  /**   * enum batadv_tp_meter_reason - reason of a tp meter test run stop - * @BATADV_TP_REASON_COMPLETE: sender finished tp run - * @BATADV_TP_REASON_CANCEL: sender was stopped during run - * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or didn't - *  answer - * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit - * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node already - *  ongoing - * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory - * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface - * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions   */  enum batadv_tp_meter_reason { +	/** +	 * @BATADV_TP_REASON_COMPLETE: sender finished tp run +	 */  	BATADV_TP_REASON_COMPLETE		= 3, + +	/** +	 * @BATADV_TP_REASON_CANCEL: sender was stopped during run +	 */  	BATADV_TP_REASON_CANCEL			= 4, +  	/* error status >= 128 */ + +	/** +	 * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or +	 * didn't answer +	 */  	BATADV_TP_REASON_DST_UNREACHABLE	= 128, + +	/** +	 * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit +	 */  	BATADV_TP_REASON_RESEND_LIMIT		= 129, + +	/** +	 * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node +	 * already ongoing +	 */  	BATADV_TP_REASON_ALREADY_ONGOING	= 130, + +	/** +	 * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory +	 */  	BATADV_TP_REASON_MEMORY_ERROR		= 131, + +	/** +	 * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface +	 */  	BATADV_TP_REASON_CANT_SEND		= 132, + +	/** +	 * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions +	 */  	BATADV_TP_REASON_TOO_MANY		= 133,  }; diff --git a/include/uapi/linux/baycom.h b/include/uapi/linux/baycom.h index 81249e029dad..478cb565ae52 100644 --- a/include/uapi/linux/baycom.h +++ b/include/uapi/linux/baycom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * The Linux BAYCOM driver for the Baycom serial 1200 baud modem   * and the parallel 9600 baud modem diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h index e3bb0635e94a..90fc490f973f 100644 --- a/include/uapi/linux/bcache.h +++ b/include/uapi/linux/bcache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_BCACHE_H  #define _LINUX_BCACHE_H diff --git a/include/uapi/linux/bcm933xx_hcs.h b/include/uapi/linux/bcm933xx_hcs.h index d22821831549..f9fccf3c3654 100644 --- a/include/uapi/linux/bcm933xx_hcs.h +++ b/include/uapi/linux/bcm933xx_hcs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Broadcom Cable Modem firmware format   */ diff --git a/include/uapi/linux/bfs_fs.h b/include/uapi/linux/bfs_fs.h index 1c0b355aa515..73445ef07dda 100644 --- a/include/uapi/linux/bfs_fs.h +++ b/include/uapi/linux/bfs_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *	include/linux/bfs_fs.h - BFS data structures on disk.   *	Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com> diff --git a/include/uapi/linux/binfmts.h b/include/uapi/linux/binfmts.h index 4eb5972867c0..4abad03a8853 100644 --- a/include/uapi/linux/binfmts.h +++ b/include/uapi/linux/binfmts.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_BINFMTS_H  #define _UAPI_LINUX_BINFMTS_H diff --git a/include/uapi/linux/blkpg.h b/include/uapi/linux/blkpg.h index 63739a035085..ac6474e4f29d 100644 --- a/include/uapi/linux/blkpg.h +++ b/include/uapi/linux/blkpg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_BLKPG_H  #define _UAPI__LINUX_BLKPG_H diff --git a/include/uapi/linux/blktrace_api.h b/include/uapi/linux/blktrace_api.h index 9cdaedeadb84..20d1490d6377 100644 --- a/include/uapi/linux/blktrace_api.h +++ b/include/uapi/linux/blktrace_api.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPIBLKTRACE_H  #define _UAPIBLKTRACE_H diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h index 40d1d7bff537..e3c70fe6bf0f 100644 --- a/include/uapi/linux/blkzoned.h +++ b/include/uapi/linux/blkzoned.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Zoned block devices handling.   * diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index f90860d1f897..4c223ab30293 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com   *   * This program is free software; you can redistribute it and/or @@ -92,6 +93,7 @@ enum bpf_cmd {  	BPF_PROG_GET_FD_BY_ID,  	BPF_MAP_GET_FD_BY_ID,  	BPF_OBJ_GET_INFO_BY_FD, +	BPF_PROG_QUERY,  };  enum bpf_map_type { @@ -111,6 +113,7 @@ enum bpf_map_type {  	BPF_MAP_TYPE_HASH_OF_MAPS,  	BPF_MAP_TYPE_DEVMAP,  	BPF_MAP_TYPE_SOCKMAP, +	BPF_MAP_TYPE_CPUMAP,  };  enum bpf_prog_type { @@ -129,6 +132,7 @@ enum bpf_prog_type {  	BPF_PROG_TYPE_LWT_XMIT,  	BPF_PROG_TYPE_SOCK_OPS,  	BPF_PROG_TYPE_SK_SKB, +	BPF_PROG_TYPE_CGROUP_DEVICE,  };  enum bpf_attach_type { @@ -138,16 +142,53 @@ enum bpf_attach_type {  	BPF_CGROUP_SOCK_OPS,  	BPF_SK_SKB_STREAM_PARSER,  	BPF_SK_SKB_STREAM_VERDICT, +	BPF_CGROUP_DEVICE,  	__MAX_BPF_ATTACH_TYPE  };  #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE -/* If BPF_F_ALLOW_OVERRIDE flag is used in BPF_PROG_ATTACH command - * to the given target_fd cgroup the descendent cgroup will be able to - * override effective bpf program that was inherited from this cgroup +/* cgroup-bpf attach flags used in BPF_PROG_ATTACH command + * + * NONE(default): No further bpf programs allowed in the subtree. + * + * BPF_F_ALLOW_OVERRIDE: If a sub-cgroup installs some bpf program, + * the program in this cgroup yields to sub-cgroup program. + * + * BPF_F_ALLOW_MULTI: If a sub-cgroup installs some bpf program, + * that cgroup program gets run in addition to the program in this cgroup. + * + * Only one program is allowed to be attached to a cgroup with + * NONE or BPF_F_ALLOW_OVERRIDE flag. + * Attaching another program on top of NONE or BPF_F_ALLOW_OVERRIDE will + * release old program and attach the new one. Attach flags has to match. + * + * Multiple programs are allowed to be attached to a cgroup with + * BPF_F_ALLOW_MULTI flag. They are executed in FIFO order + * (those that were attached first, run first) + * The programs of sub-cgroup are executed first, then programs of + * this cgroup and then programs of parent cgroup. + * When children program makes decision (like picking TCP CA or sock bind) + * parent program has a chance to override it. + * + * A cgroup with MULTI or OVERRIDE flag allows any attach flags in sub-cgroups. + * A cgroup with NONE doesn't allow any programs in sub-cgroups. + * Ex1: + * cgrp1 (MULTI progs A, B) -> + *    cgrp2 (OVERRIDE prog C) -> + *      cgrp3 (MULTI prog D) -> + *        cgrp4 (OVERRIDE prog E) -> + *          cgrp5 (NONE prog F) + * the event in cgrp5 triggers execution of F,D,A,B in that order. + * if prog F is detached, the execution is E,D,A,B + * if prog F and D are detached, the execution is E,A,B + * if prog F, E and D are detached, the execution is C,A,B + * + * All eligible programs are executed regardless of return code from + * earlier programs.   */  #define BPF_F_ALLOW_OVERRIDE	(1U << 0) +#define BPF_F_ALLOW_MULTI	(1U << 1)  /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the   * verifier will perform strict alignment checking as if the kernel @@ -175,6 +216,15 @@ enum bpf_attach_type {  /* Specify numa node during map creation */  #define BPF_F_NUMA_NODE		(1U << 2) +/* flags for BPF_PROG_QUERY */ +#define BPF_F_QUERY_EFFECTIVE	(1U << 0) + +#define BPF_OBJ_NAME_LEN 16U + +/* Flags for accessing BPF object */ +#define BPF_F_RDONLY		(1U << 3) +#define BPF_F_WRONLY		(1U << 4) +  union bpf_attr {  	struct { /* anonymous struct used by BPF_MAP_CREATE command */  		__u32	map_type;	/* one of enum bpf_map_type */ @@ -188,6 +238,7 @@ union bpf_attr {  		__u32	numa_node;	/* numa node (effective only if  					 * BPF_F_NUMA_NODE is set).  					 */ +		char	map_name[BPF_OBJ_NAME_LEN];  	};  	struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ @@ -210,11 +261,14 @@ union bpf_attr {  		__aligned_u64	log_buf;	/* user supplied buffer */  		__u32		kern_version;	/* checked when prog_type=kprobe */  		__u32		prog_flags; +		char		prog_name[BPF_OBJ_NAME_LEN]; +		__u32		prog_ifindex;	/* ifindex of netdev to prep for */  	};  	struct { /* anonymous struct used by BPF_OBJ_* commands */  		__aligned_u64	pathname;  		__u32		bpf_fd; +		__u32		file_flags;  	};  	struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */ @@ -242,6 +296,7 @@ union bpf_attr {  			__u32		map_id;  		};  		__u32		next_id; +		__u32		open_flags;  	};  	struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ @@ -249,6 +304,15 @@ union bpf_attr {  		__u32		info_len;  		__aligned_u64	info;  	} info; + +	struct { /* anonymous struct used by BPF_PROG_QUERY command */ +		__u32		target_fd;	/* container object to query */ +		__u32		attach_type; +		__u32		query_flags; +		__u32		attach_flags; +		__aligned_u64	prog_ids; +		__u32		prog_cnt; +	} query;  } __attribute__((aligned(8)));  /* BPF helper function descriptions: @@ -553,12 +617,22 @@ union bpf_attr {   * int bpf_setsockopt(bpf_socket, level, optname, optval, optlen)   *     Calls setsockopt. Not all opts are available, only those with   *     integer optvals plus TCP_CONGESTION. - *     Supported levels: SOL_SOCKET and IPROTO_TCP + *     Supported levels: SOL_SOCKET and IPPROTO_TCP + *     @bpf_socket: pointer to bpf_socket + *     @level: SOL_SOCKET or IPPROTO_TCP + *     @optname: option name + *     @optval: pointer to option value + *     @optlen: length of optval in bytes + *     Return: 0 or negative error + * + * int bpf_getsockopt(bpf_socket, level, optname, optval, optlen) + *     Calls getsockopt. Not all opts are available. + *     Supported levels: IPPROTO_TCP   *     @bpf_socket: pointer to bpf_socket - *     @level: SOL_SOCKET or IPROTO_TCP + *     @level: IPPROTO_TCP   *     @optname: option name   *     @optval: pointer to option value - *     @optlen: length of optval in byes + *     @optlen: length of optval in bytes   *     Return: 0 or negative error   *   * int bpf_skb_adjust_room(skb, len_diff, mode, flags) @@ -575,13 +649,34 @@ union bpf_attr {   *     @map: pointer to sockmap   *     @key: key to lookup sock in map   *     @flags: reserved for future use - *     Return: SK_REDIRECT + *     Return: SK_PASS   *   * int bpf_sock_map_update(skops, map, key, flags)   *	@skops: pointer to bpf_sock_ops   *	@map: pointer to sockmap to update   *	@key: key to insert/update sock in map   *	@flags: same flags as map update elem + * + * int bpf_xdp_adjust_meta(xdp_md, delta) + *     Adjust the xdp_md.data_meta by delta + *     @xdp_md: pointer to xdp_md + *     @delta: An positive/negative integer to be added to xdp_md.data_meta + *     Return: 0 on success or negative on error + * + * int bpf_perf_event_read_value(map, flags, buf, buf_size) + *     read perf event counter value and perf event enabled/running time + *     @map: pointer to perf_event_array map + *     @flags: index of event in the map or bitmask flags + *     @buf: buf to fill + *     @buf_size: size of the buf + *     Return: 0 on success or negative error code + * + * int bpf_perf_prog_read_value(ctx, buf, buf_size) + *     read perf prog attached perf event counter and enabled/running time + *     @ctx: pointer to ctx + *     @buf: buf to fill + *     @buf_size: size of the buf + *     Return : 0 on success or negative error code   */  #define __BPF_FUNC_MAPPER(FN)		\  	FN(unspec),			\ @@ -638,6 +733,10 @@ union bpf_attr {  	FN(redirect_map),		\  	FN(sk_redirect_map),		\  	FN(sock_map_update),		\ +	FN(xdp_adjust_meta),		\ +	FN(perf_event_read_value),	\ +	FN(perf_prog_read_value),	\ +	FN(getsockopt),  /* integer value in 'imm' field of BPF_CALL instruction selects which helper   * function eBPF program intends to call @@ -681,7 +780,9 @@ enum bpf_func_id {  #define BPF_F_ZERO_CSUM_TX		(1ULL << 1)  #define BPF_F_DONT_FRAGMENT		(1ULL << 2) -/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */ +/* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and + * BPF_FUNC_perf_event_read_value flags. + */  #define BPF_F_INDEX_MASK		0xffffffffULL  #define BPF_F_CURRENT_CPU		BPF_F_INDEX_MASK  /* BPF_FUNC_perf_event_output for sk_buff input context. */ @@ -715,7 +816,7 @@ struct __sk_buff {  	__u32 data_end;  	__u32 napi_id; -	/* accessed by BPF_PROG_TYPE_sk_skb types */ +	/* Accessed by BPF_PROG_TYPE_sk_skb types from here to ... */  	__u32 family;  	__u32 remote_ip4;	/* Stored in network byte order */  	__u32 local_ip4;	/* Stored in network byte order */ @@ -723,6 +824,9 @@ struct __sk_buff {  	__u32 local_ip6[4];	/* Stored in network byte order */  	__u32 remote_port;	/* Stored in network byte order */  	__u32 local_port;	/* stored in host byte order */ +	/* ... here. */ + +	__u32 data_meta;  };  struct bpf_tunnel_key { @@ -783,12 +887,12 @@ enum xdp_action {  struct xdp_md {  	__u32 data;  	__u32 data_end; +	__u32 data_meta;  };  enum sk_action { -	SK_ABORTED = 0, -	SK_DROP, -	SK_REDIRECT, +	SK_DROP = 0, +	SK_PASS,  };  #define BPF_TAG_SIZE	8 @@ -801,6 +905,11 @@ struct bpf_prog_info {  	__u32 xlated_prog_len;  	__aligned_u64 jited_prog_insns;  	__aligned_u64 xlated_prog_insns; +	__u64 load_time;	/* ns since boottime */ +	__u32 created_by_uid; +	__u32 nr_map_ids; +	__aligned_u64 map_ids; +	char name[BPF_OBJ_NAME_LEN];  } __attribute__((aligned(8)));  struct bpf_map_info { @@ -810,6 +919,7 @@ struct bpf_map_info {  	__u32 value_size;  	__u32 max_entries;  	__u32 map_flags; +	char  name[BPF_OBJ_NAME_LEN];  } __attribute__((aligned(8)));  /* User bpf_sock_ops struct to access socket values and specify request ops @@ -859,9 +969,35 @@ enum {  	BPF_SOCK_OPS_NEEDS_ECN,		/* If connection's congestion control  					 * needs ECN  					 */ +	BPF_SOCK_OPS_BASE_RTT,		/* Get base RTT. The correct value is +					 * based on the path and may be +					 * dependent on the congestion control +					 * algorithm. In general it indicates +					 * a congestion threshold. RTTs above +					 * this indicate congestion +					 */  };  #define TCP_BPF_IW		1001	/* Set TCP initial congestion window */  #define TCP_BPF_SNDCWND_CLAMP	1002	/* Set sndcwnd_clamp */ +struct bpf_perf_event_value { +	__u64 counter; +	__u64 enabled; +	__u64 running; +}; + +#define BPF_DEVCG_ACC_MKNOD	(1ULL << 0) +#define BPF_DEVCG_ACC_READ	(1ULL << 1) +#define BPF_DEVCG_ACC_WRITE	(1ULL << 2) + +#define BPF_DEVCG_DEV_BLOCK	(1ULL << 0) +#define BPF_DEVCG_DEV_CHAR	(1ULL << 1) + +struct bpf_cgroup_dev_ctx { +	__u32 access_type; /* (access << 16) | type */ +	__u32 major; +	__u32 minor; +}; +  #endif /* _UAPI__LINUX_BPF_H__ */ diff --git a/include/uapi/linux/bpf_common.h b/include/uapi/linux/bpf_common.h index a5c220e0828f..18be90725ab0 100644 --- a/include/uapi/linux/bpf_common.h +++ b/include/uapi/linux/bpf_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_BPF_COMMON_H__  #define _UAPI__LINUX_BPF_COMMON_H__ diff --git a/include/uapi/linux/bpf_perf_event.h b/include/uapi/linux/bpf_perf_event.h index 067427259820..af549d4ecf1b 100644 --- a/include/uapi/linux/bpf_perf_event.h +++ b/include/uapi/linux/bpf_perf_event.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* Copyright (c) 2016 Facebook   *   * This program is free software; you can redistribute it and/or diff --git a/include/uapi/linux/bpqether.h b/include/uapi/linux/bpqether.h index 05865edaefda..d1d63e2acdeb 100644 --- a/include/uapi/linux/bpqether.h +++ b/include/uapi/linux/bpqether.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef	__BPQETHER_H  #define	__BPQETHER_H diff --git a/include/uapi/linux/bsg.h b/include/uapi/linux/bsg.h index 02986cf8b6f1..cd6302def5ed 100644 --- a/include/uapi/linux/bsg.h +++ b/include/uapi/linux/bsg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPIBSG_H  #define _UAPIBSG_H diff --git a/include/uapi/linux/bt-bmc.h b/include/uapi/linux/bt-bmc.h index d9ec766a63d0..2ffdccfccc1d 100644 --- a/include/uapi/linux/bt-bmc.h +++ b/include/uapi/linux/bt-bmc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (c) 2015-2016, IBM Corporation.   * diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index 378230c163d5..ce615b75e855 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2007 Oracle.  All rights reserved.   * @@ -608,10 +609,14 @@ struct btrfs_ioctl_ino_path_args {  struct btrfs_ioctl_logical_ino_args {  	__u64				logical;	/* in */  	__u64				size;		/* in */ -	__u64				reserved[4]; +	__u64				reserved[3];	/* must be 0 for now */ +	__u64				flags;		/* in, v2 only */  	/* struct btrfs_data_container	*inodes;	out   */  	__u64				inodes;  }; +/* Return every ref to the extent, not just those containing logical block. + * Requires logical == extent bytenr. */ +#define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET	(1ULL << 0)  enum btrfs_dev_stat_values {  	/* disk I/O failure stats */ @@ -835,5 +840,7 @@ enum btrfs_err_code {  				   struct btrfs_ioctl_feature_flags[3])  #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \  				   struct btrfs_ioctl_vol_args_v2) +#define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, \ +					struct btrfs_ioctl_logical_ino_args)  #endif /* _UAPI_LINUX_BTRFS_H */ diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h index 10689e1fdf11..6d6e5da51527 100644 --- a/include/uapi/linux/btrfs_tree.h +++ b/include/uapi/linux/btrfs_tree.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _BTRFS_CTREE_H_  #define _BTRFS_CTREE_H_ @@ -732,6 +733,7 @@ struct btrfs_balance_item {  #define BTRFS_FILE_EXTENT_INLINE 0  #define BTRFS_FILE_EXTENT_REG 1  #define BTRFS_FILE_EXTENT_PREALLOC 2 +#define BTRFS_FILE_EXTENT_TYPES	2  struct btrfs_file_extent_item {  	/* diff --git a/include/uapi/linux/byteorder/big_endian.h b/include/uapi/linux/byteorder/big_endian.h index cdab17ab907c..2199adc6a6c2 100644 --- a/include/uapi/linux/byteorder/big_endian.h +++ b/include/uapi/linux/byteorder/big_endian.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_BYTEORDER_BIG_ENDIAN_H  #define _UAPI_LINUX_BYTEORDER_BIG_ENDIAN_H diff --git a/include/uapi/linux/byteorder/little_endian.h b/include/uapi/linux/byteorder/little_endian.h index 4b93f2b260dd..601c904fd5cd 100644 --- a/include/uapi/linux/byteorder/little_endian.h +++ b/include/uapi/linux/byteorder/little_endian.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H  #define _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H diff --git a/include/uapi/linux/caif/caif_socket.h b/include/uapi/linux/caif/caif_socket.h index 586e9f98184f..10ec1d1cf68e 100644 --- a/include/uapi/linux/caif/caif_socket.h +++ b/include/uapi/linux/caif/caif_socket.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* linux/caif_socket.h   * CAIF Definitions for CAIF socket and network layer   * Copyright (C) ST-Ericsson AB 2010 diff --git a/include/uapi/linux/caif/if_caif.h b/include/uapi/linux/caif/if_caif.h index 7618aabe8c6b..74bca19403fa 100644 --- a/include/uapi/linux/caif/if_caif.h +++ b/include/uapi/linux/caif/if_caif.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) ST-Ericsson AB 2010   * Author:	Sjur Brendeland diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h index c48d93a28d1a..d7f97ac197a9 100644 --- a/include/uapi/linux/can.h +++ b/include/uapi/linux/can.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * linux/can.h   * diff --git a/include/uapi/linux/can/bcm.h b/include/uapi/linux/can/bcm.h index cefb304414ba..0fb328d93148 100644 --- a/include/uapi/linux/can/bcm.h +++ b/include/uapi/linux/can/bcm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * linux/can/bcm.h   * diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h index 1c508be9687f..bfc4b5d22a5e 100644 --- a/include/uapi/linux/can/error.h +++ b/include/uapi/linux/can/error.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * linux/can/error.h   * diff --git a/include/uapi/linux/can/gw.h b/include/uapi/linux/can/gw.h index 5079b9d57e31..7bee7a0b9800 100644 --- a/include/uapi/linux/can/gw.h +++ b/include/uapi/linux/can/gw.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * linux/can/gw.h   * diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h index fdf75f74fdaf..96710e76d5ce 100644 --- a/include/uapi/linux/can/netlink.h +++ b/include/uapi/linux/can/netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * linux/can/netlink.h   * diff --git a/include/uapi/linux/can/raw.h b/include/uapi/linux/can/raw.h index 8735f1080385..be3b36e7ff61 100644 --- a/include/uapi/linux/can/raw.h +++ b/include/uapi/linux/can/raw.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * linux/can/raw.h   * diff --git a/include/uapi/linux/can/vxcan.h b/include/uapi/linux/can/vxcan.h index ffb0b7156f7e..066812d118a2 100644 --- a/include/uapi/linux/can/vxcan.h +++ b/include/uapi/linux/can/vxcan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_CAN_VXCAN_H  #define _UAPI_CAN_VXCAN_H diff --git a/include/uapi/linux/capability.h b/include/uapi/linux/capability.h index 230e05d35191..240fdb9a60f6 100644 --- a/include/uapi/linux/capability.h +++ b/include/uapi/linux/capability.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * This is <linux/capability.h>   * diff --git a/include/uapi/linux/capi.h b/include/uapi/linux/capi.h index 7b145fd7afb6..31f946f8a88d 100644 --- a/include/uapi/linux/capi.h +++ b/include/uapi/linux/capi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* $Id: capi.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $   *    * CAPI 2.0 Interface for Linux diff --git a/include/uapi/linux/cciss_defs.h b/include/uapi/linux/cciss_defs.h index 316b670d4e33..5cbdfe993365 100644 --- a/include/uapi/linux/cciss_defs.h +++ b/include/uapi/linux/cciss_defs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef CCISS_DEFS_H  #define CCISS_DEFS_H diff --git a/include/uapi/linux/cciss_ioctl.h b/include/uapi/linux/cciss_ioctl.h index bb0b9ddf7eeb..562230199461 100644 --- a/include/uapi/linux/cciss_ioctl.h +++ b/include/uapi/linux/cciss_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPICCISS_IOCTLH  #define _UAPICCISS_IOCTLH diff --git a/include/uapi/linux/cdrom.h b/include/uapi/linux/cdrom.h index bd17ad5aa06d..2817230148fd 100644 --- a/include/uapi/linux/cdrom.h +++ b/include/uapi/linux/cdrom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * -- <linux/cdrom.h>   * General header file for linux CD-ROM drivers  diff --git a/include/uapi/linux/cec-funcs.h b/include/uapi/linux/cec-funcs.h index 270b251a3d9b..28e8a2a86e16 100644 --- a/include/uapi/linux/cec-funcs.h +++ b/include/uapi/linux/cec-funcs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * cec - HDMI Consumer Electronics Control message functions   * diff --git a/include/uapi/linux/cec.h b/include/uapi/linux/cec.h index 4351c3481aea..b51fbe1941a7 100644 --- a/include/uapi/linux/cec.h +++ b/include/uapi/linux/cec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * cec - HDMI Consumer Electronics Control public header   * @@ -410,6 +411,8 @@ struct cec_log_addrs {  #define CEC_EVENT_LOST_MSGS		2  #define CEC_EVENT_PIN_CEC_LOW		3  #define CEC_EVENT_PIN_CEC_HIGH		4 +#define CEC_EVENT_PIN_HPD_LOW		5 +#define CEC_EVENT_PIN_HPD_HIGH		6  #define CEC_EVENT_FL_INITIAL_STATE	(1 << 0)  #define CEC_EVENT_FL_DROPPED_EVENTS	(1 << 1) diff --git a/include/uapi/linux/cgroupstats.h b/include/uapi/linux/cgroupstats.h index 3753c33160d1..aa306e4cd6c1 100644 --- a/include/uapi/linux/cgroupstats.h +++ b/include/uapi/linux/cgroupstats.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */  /* cgroupstats.h - exporting per-cgroup statistics   *   * Copyright IBM Corporation, 2007 diff --git a/include/uapi/linux/chio.h b/include/uapi/linux/chio.h index d9bac7f97282..689fc93fafda 100644 --- a/include/uapi/linux/chio.h +++ b/include/uapi/linux/chio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * ioctl interface for the scsi media changer driver   */ diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h index d7e4c6ce6171..69829205fdb5 100644 --- a/include/uapi/linux/cifs/cifs_mount.h +++ b/include/uapi/linux/cifs/cifs_mount.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   *   include/uapi/linux/cifs/cifs_mount.h   * diff --git a/include/uapi/linux/cm4000_cs.h b/include/uapi/linux/cm4000_cs.h index 1217f751a1bc..c70a62ec8a49 100644 --- a/include/uapi/linux/cm4000_cs.h +++ b/include/uapi/linux/cm4000_cs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_CM4000_H_  #define _UAPI_CM4000_H_ diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h index f6c271035bbd..68ff25414700 100644 --- a/include/uapi/linux/cn_proc.h +++ b/include/uapi/linux/cn_proc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */  /*   * cn_proc.h - process events connector   * diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h index 79d05981fc4b..aa6623efd2dd 100644 --- a/include/uapi/linux/coda_psdev.h +++ b/include/uapi/linux/coda_psdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__CODA_PSDEV_H  #define _UAPI__CODA_PSDEV_H diff --git a/include/uapi/linux/coff.h b/include/uapi/linux/coff.h index 6354a7fe22b2..e4a79f80b9a0 100644 --- a/include/uapi/linux/coff.h +++ b/include/uapi/linux/coff.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* This file is derived from the GAS 2.1.4 assembler control file.     The GAS product is under the GNU General Public License, version 2 or later.     As such, this file is also under that license. diff --git a/include/uapi/linux/connector.h b/include/uapi/linux/connector.h index 4cb283505e45..3738936149a2 100644 --- a/include/uapi/linux/connector.h +++ b/include/uapi/linux/connector.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * 	connector.h   *  diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h index c872bfd25e13..92537757590a 100644 --- a/include/uapi/linux/const.h +++ b/include/uapi/linux/const.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* const.h: Macros for dealing with constants.  */  #ifndef _LINUX_CONST_H diff --git a/include/uapi/linux/coresight-stm.h b/include/uapi/linux/coresight-stm.h index 7e4272cf1fb2..aac550a52f80 100644 --- a/include/uapi/linux/coresight-stm.h +++ b/include/uapi/linux/coresight-stm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __UAPI_CORESIGHT_STM_H_  #define __UAPI_CORESIGHT_STM_H_ diff --git a/include/uapi/linux/cramfs_fs.h b/include/uapi/linux/cramfs_fs.h index e4611a9b9243..6713669aa2ed 100644 --- a/include/uapi/linux/cramfs_fs.h +++ b/include/uapi/linux/cramfs_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__CRAMFS_H  #define _UAPI__CRAMFS_H @@ -73,6 +74,7 @@ struct cramfs_super {  #define CRAMFS_FLAG_HOLES		0x00000100	/* support for holes */  #define CRAMFS_FLAG_WRONG_SIGNATURE	0x00000200	/* reserved */  #define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET	0x00000400	/* shifted root fs */ +#define CRAMFS_FLAG_EXT_BLOCK_POINTERS	0x00000800	/* block pointer extensions */  /*   * Valid values in super.flags.  Currently we refuse to mount @@ -82,7 +84,30 @@ struct cramfs_super {  #define CRAMFS_SUPPORTED_FLAGS	( 0x000000ff \  				| CRAMFS_FLAG_HOLES \  				| CRAMFS_FLAG_WRONG_SIGNATURE \ -				| CRAMFS_FLAG_SHIFTED_ROOT_OFFSET ) +				| CRAMFS_FLAG_SHIFTED_ROOT_OFFSET \ +				| CRAMFS_FLAG_EXT_BLOCK_POINTERS ) +/* + * Block pointer flags + * + * The maximum block offset that needs to be represented is roughly: + * + *   (1 << CRAMFS_OFFSET_WIDTH) * 4 + + *   (1 << CRAMFS_SIZE_WIDTH) / PAGE_SIZE * (4 + PAGE_SIZE) + *   = 0x11004000 + * + * That leaves room for 3 flag bits in the block pointer table. + */ +#define CRAMFS_BLK_FLAG_UNCOMPRESSED	(1 << 31) +#define CRAMFS_BLK_FLAG_DIRECT_PTR	(1 << 30) + +#define CRAMFS_BLK_FLAGS	( CRAMFS_BLK_FLAG_UNCOMPRESSED \ +				| CRAMFS_BLK_FLAG_DIRECT_PTR ) + +/* + * Direct blocks are at least 4-byte aligned. + * Pointers to direct blocks are shifted down by 2 bits. + */ +#define CRAMFS_BLK_DIRECT_PTR_SHIFT	2  #endif /* _UAPI__CRAMFS_H */ diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h index fdcbb3c29083..19bf0ca6d635 100644 --- a/include/uapi/linux/cryptouser.h +++ b/include/uapi/linux/cryptouser.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Crypto user configuration API.   * diff --git a/include/uapi/linux/cuda.h b/include/uapi/linux/cuda.h index 286f9f10fce8..28182557748d 100644 --- a/include/uapi/linux/cuda.h +++ b/include/uapi/linux/cuda.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Definitions for talking to the CUDA.  The CUDA is a microcontroller   * which controls the ADB, system power, RTC, and various other things. diff --git a/include/uapi/linux/cyclades.h b/include/uapi/linux/cyclades.h index 12b587aa361c..8279bc3d60ca 100644 --- a/include/uapi/linux/cyclades.h +++ b/include/uapi/linux/cyclades.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $   * linux/include/linux/cyclades.h   * diff --git a/include/uapi/linux/cycx_cfm.h b/include/uapi/linux/cycx_cfm.h index 032d26ed8384..51f541942ff9 100644 --- a/include/uapi/linux/cycx_cfm.h +++ b/include/uapi/linux/cycx_cfm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*  * cycx_cfm.h	Cyclom 2X WAN Link Driver.  *		Definitions for the Cyclom 2X Firmware Module (CFM). diff --git a/include/uapi/linux/dcbnl.h b/include/uapi/linux/dcbnl.h index 3ea470f35e40..2c0c6453c3f4 100644 --- a/include/uapi/linux/dcbnl.h +++ b/include/uapi/linux/dcbnl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (c) 2008-2011, Intel Corporation.   * @@ -205,6 +206,7 @@ struct cee_pfc {  #define IEEE_8021QAZ_APP_SEL_STREAM	2  #define IEEE_8021QAZ_APP_SEL_DGRAM	3  #define IEEE_8021QAZ_APP_SEL_ANY	4 +#define IEEE_8021QAZ_APP_SEL_DSCP       5  /* This structure contains the IEEE 802.1Qaz APP managed object. This   * object is also used for the CEE std as well. diff --git a/include/uapi/linux/dccp.h b/include/uapi/linux/dccp.h index 52a9cd7307e7..6e1978dbcf7c 100644 --- a/include/uapi/linux/dccp.h +++ b/include/uapi/linux/dccp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_DCCP_H  #define _UAPI_LINUX_DCCP_H diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index 0cbca96c66b9..6665df69e26a 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * include/uapi/linux/devlink.h - Network physical device Netlink interface   * Copyright (c) 2016 Mellanox Technologies. All rights reserved. diff --git a/include/uapi/linux/dlm.h b/include/uapi/linux/dlm.h index 1f73cc06168f..0d2eca287567 100644 --- a/include/uapi/linux/dlm.h +++ b/include/uapi/linux/dlm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /******************************************************************************  *******************************************************************************  ** diff --git a/include/uapi/linux/dlm_device.h b/include/uapi/linux/dlm_device.h index df56c8ff0769..f880d2831160 100644 --- a/include/uapi/linux/dlm_device.h +++ b/include/uapi/linux/dlm_device.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /******************************************************************************  *******************************************************************************  ** diff --git a/include/uapi/linux/dlm_netlink.h b/include/uapi/linux/dlm_netlink.h index ef1e2e08769a..5dc3a67d353d 100644 --- a/include/uapi/linux/dlm_netlink.h +++ b/include/uapi/linux/dlm_netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2007 Red Hat, Inc.  All rights reserved.   * diff --git a/include/uapi/linux/dlm_plock.h b/include/uapi/linux/dlm_plock.h index 6ae692c909cb..63b6c1fd9169 100644 --- a/include/uapi/linux/dlm_plock.h +++ b/include/uapi/linux/dlm_plock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2005-2008 Red Hat, Inc.  All rights reserved.   * diff --git a/include/uapi/linux/dlmconstants.h b/include/uapi/linux/dlmconstants.h index 2857bdc5b27b..a8ae47c32a37 100644 --- a/include/uapi/linux/dlmconstants.h +++ b/include/uapi/linux/dlmconstants.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /******************************************************************************  *******************************************************************************  ** diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h index ccaea525340b..14c44ec8b622 100644 --- a/include/uapi/linux/dm-ioctl.h +++ b/include/uapi/linux/dm-ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.   * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved. diff --git a/include/uapi/linux/dm-log-userspace.h b/include/uapi/linux/dm-log-userspace.h index 05e91e14c501..5c47a8603376 100644 --- a/include/uapi/linux/dm-log-userspace.h +++ b/include/uapi/linux/dm-log-userspace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (C) 2006-2009 Red Hat, Inc.   * diff --git a/include/uapi/linux/dma-buf.h b/include/uapi/linux/dma-buf.h index fb0dedb7c121..d75df5210a4a 100644 --- a/include/uapi/linux/dma-buf.h +++ b/include/uapi/linux/dma-buf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Framework for buffer objects that can be shared across devices/subsystems.   * diff --git a/include/uapi/linux/dn.h b/include/uapi/linux/dn.h index 4295c745f342..36ca71bd8bbe 100644 --- a/include/uapi/linux/dn.h +++ b/include/uapi/linux/dn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_DN_H  #define _LINUX_DN_H diff --git a/include/uapi/linux/dqblk_xfs.h b/include/uapi/linux/dqblk_xfs.h index 11b3b31faf14..03d890b80ebc 100644 --- a/include/uapi/linux/dqblk_xfs.h +++ b/include/uapi/linux/dqblk_xfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc.  All Rights Reserved.   * diff --git a/include/uapi/linux/dvb/audio.h b/include/uapi/linux/dvb/audio.h index d47bccd604e4..69f7a85d81b1 100644 --- a/include/uapi/linux/dvb/audio.h +++ b/include/uapi/linux/dvb/audio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * audio.h   * diff --git a/include/uapi/linux/dvb/ca.h b/include/uapi/linux/dvb/ca.h index cb150029fdff..dffa59e95ebb 100644 --- a/include/uapi/linux/dvb/ca.h +++ b/include/uapi/linux/dvb/ca.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * ca.h   * diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h index 4aa5f6a1815a..c10f1324b4ca 100644 --- a/include/uapi/linux/dvb/dmx.h +++ b/include/uapi/linux/dvb/dmx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * dmx.h   * diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h index 861cacd5711f..b297b65845d6 100644 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * frontend.h   * @@ -830,7 +831,7 @@ struct dtv_fe_stats {   * @cmd:	Digital TV command.   * @reserved:	Not used.   * @u:		Union with the values for the command. - * @result:	Result of the command set (currently unused). + * @result:	Unused   *   * The @u union may have either one of the values below:   * diff --git a/include/uapi/linux/dvb/net.h b/include/uapi/linux/dvb/net.h index 89d805f9a5a6..0c550ef93f2c 100644 --- a/include/uapi/linux/dvb/net.h +++ b/include/uapi/linux/dvb/net.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * net.h   * diff --git a/include/uapi/linux/dvb/osd.h b/include/uapi/linux/dvb/osd.h index 880e68435832..e163508b9ae8 100644 --- a/include/uapi/linux/dvb/osd.h +++ b/include/uapi/linux/dvb/osd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * osd.h   * diff --git a/include/uapi/linux/dvb/version.h b/include/uapi/linux/dvb/version.h index e53e2ad4444f..02e32ea83984 100644 --- a/include/uapi/linux/dvb/version.h +++ b/include/uapi/linux/dvb/version.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * version.h   * diff --git a/include/uapi/linux/dvb/video.h b/include/uapi/linux/dvb/video.h index c83d40b8a8a4..4d51f98182bb 100644 --- a/include/uapi/linux/dvb/video.h +++ b/include/uapi/linux/dvb/video.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * video.h   * diff --git a/include/uapi/linux/edd.h b/include/uapi/linux/edd.h index 89240a04e4c8..0fe3e02aec65 100644 --- a/include/uapi/linux/edd.h +++ b/include/uapi/linux/edd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * linux/include/linux/edd.h   *  Copyright (C) 2002, 2003, 2004 Dell Inc. diff --git a/include/uapi/linux/efs_fs_sb.h b/include/uapi/linux/efs_fs_sb.h index a01be90c58cc..6bad29a10faa 100644 --- a/include/uapi/linux/efs_fs_sb.h +++ b/include/uapi/linux/efs_fs_sb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * efs_fs_sb.h   * diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h index 9cd1de954c0a..31aa10178335 100644 --- a/include/uapi/linux/elf-em.h +++ b/include/uapi/linux/elf-em.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_ELF_EM_H  #define _LINUX_ELF_EM_H diff --git a/include/uapi/linux/elf-fdpic.h b/include/uapi/linux/elf-fdpic.h index 3921e33aec8e..4fcc6cfebe18 100644 --- a/include/uapi/linux/elf-fdpic.h +++ b/include/uapi/linux/elf-fdpic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /* elf-fdpic.h: FDPIC ELF load map   *   * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index b5280db9ef6a..bb6836986200 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_ELF_H  #define _UAPI_LINUX_ELF_H @@ -411,11 +412,13 @@ typedef struct elf64_shdr {  #define NT_S390_VXRS_HIGH	0x30a	/* s390 vector registers 16-31 */  #define NT_S390_GS_CB	0x30b		/* s390 guarded storage registers */  #define NT_S390_GS_BC	0x30c		/* s390 guarded storage broadcast control block */ +#define NT_S390_RI_CB	0x30d		/* s390 runtime instrumentation */  #define NT_ARM_VFP	0x400		/* ARM VFP/NEON registers */  #define NT_ARM_TLS	0x401		/* ARM TLS register */  #define NT_ARM_HW_BREAK	0x402		/* ARM hardware breakpoint registers */  #define NT_ARM_HW_WATCH	0x403		/* ARM hardware watchpoint registers */  #define NT_ARM_SYSTEM_CALL	0x404	/* ARM system call number */ +#define NT_ARM_SVE	0x405		/* ARM Scalable Vector Extension registers */  #define NT_METAG_CBUF	0x500		/* Metag catch buffer registers */  #define NT_METAG_RPIPE	0x501		/* Metag read pipeline state */  #define NT_METAG_TLS	0x502		/* Metag TLS pointer */ diff --git a/include/uapi/linux/elfcore.h b/include/uapi/linux/elfcore.h index 569737cfb557..0b2c9e16e345 100644 --- a/include/uapi/linux/elfcore.h +++ b/include/uapi/linux/elfcore.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_ELFCORE_H  #define _UAPI_LINUX_ELFCORE_H diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h index 78fdf52d6b2f..dc64cfaf13da 100644 --- a/include/uapi/linux/errqueue.h +++ b/include/uapi/linux/errqueue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_ERRQUEUE_H  #define _UAPI_LINUX_ERRQUEUE_H diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 5bd1b1de4ea0..ac71559314e7 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * ethtool.h: Defines for Linux ethtool.   * diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h index f4d5c998cc2b..63e21be30f15 100644 --- a/include/uapi/linux/eventpoll.h +++ b/include/uapi/linux/eventpoll.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  include/linux/eventpoll.h ( Efficient event polling implementation )   *  Copyright (C) 2001,...,2006	 Davide Libenzi diff --git a/include/uapi/linux/fadvise.h b/include/uapi/linux/fadvise.h index e8e747139b9a..0862b87434c2 100644 --- a/include/uapi/linux/fadvise.h +++ b/include/uapi/linux/fadvise.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef FADVISE_H_INCLUDED  #define FADVISE_H_INCLUDED diff --git a/include/uapi/linux/falloc.h b/include/uapi/linux/falloc.h index b075f601919b..51398fa57f6c 100644 --- a/include/uapi/linux/falloc.h +++ b/include/uapi/linux/falloc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_FALLOC_H_  #define _UAPI_FALLOC_H_ diff --git a/include/uapi/linux/fanotify.h b/include/uapi/linux/fanotify.h index 030508d195d3..74247917de04 100644 --- a/include/uapi/linux/fanotify.h +++ b/include/uapi/linux/fanotify.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_FANOTIFY_H  #define _UAPI_LINUX_FANOTIFY_H @@ -35,6 +36,7 @@  #define FAN_UNLIMITED_QUEUE	0x00000010  #define FAN_UNLIMITED_MARKS	0x00000020 +#define FAN_ENABLE_AUDIT	0x00000040  #define FAN_ALL_INIT_FLAGS	(FAN_CLOEXEC | FAN_NONBLOCK | \  				 FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\ @@ -99,6 +101,8 @@ struct fanotify_response {  /* Legit userspace responses to a _PERM event */  #define FAN_ALLOW	0x01  #define FAN_DENY	0x02 +#define FAN_AUDIT	0x10	/* Bit mask to create audit record for result */ +  /* No fd set in event */  #define FAN_NOFD	-1 diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h index fb795c3b3c17..6cd9b198b7c6 100644 --- a/include/uapi/linux/fb.h +++ b/include/uapi/linux/fb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_FB_H  #define _UAPI_LINUX_FB_H diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h index ec69d55bcec7..6448cdd9a350 100644 --- a/include/uapi/linux/fcntl.h +++ b/include/uapi/linux/fcntl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_FCNTL_H  #define _UAPI_LINUX_FCNTL_H diff --git a/include/uapi/linux/fd.h b/include/uapi/linux/fd.h index 84c517cbce90..90fb94712c41 100644 --- a/include/uapi/linux/fd.h +++ b/include/uapi/linux/fd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_FD_H  #define _UAPI_LINUX_FD_H diff --git a/include/uapi/linux/fdreg.h b/include/uapi/linux/fdreg.h index 61ce64169004..5e2981d5c523 100644 --- a/include/uapi/linux/fdreg.h +++ b/include/uapi/linux/fdreg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_FDREG_H  #define _LINUX_FDREG_H  /* diff --git a/include/uapi/linux/fib_rules.h b/include/uapi/linux/fib_rules.h index bbf02a63a011..2b642bf9b5a0 100644 --- a/include/uapi/linux/fib_rules.h +++ b/include/uapi/linux/fib_rules.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_FIB_RULES_H  #define __LINUX_FIB_RULES_H diff --git a/include/uapi/linux/fiemap.h b/include/uapi/linux/fiemap.h index 0c51d617dae9..8c0bc24d5d95 100644 --- a/include/uapi/linux/fiemap.h +++ b/include/uapi/linux/fiemap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * FS_IOC_FIEMAP ioctl infrastructure.   * diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h index c97340e43dd6..13f5b65a888f 100644 --- a/include/uapi/linux/filter.h +++ b/include/uapi/linux/filter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Linux Socket Filter Data Structures   */ diff --git a/include/uapi/linux/flat.h b/include/uapi/linux/flat.h index 88cd6baba8f3..27e595e44fb7 100644 --- a/include/uapi/linux/flat.h +++ b/include/uapi/linux/flat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2002-2003  David McCullough <davidm@snapgear.com>   * Copyright (C) 1998       Kenneth Albanowski <kjahds@kjahds.com> diff --git a/include/uapi/linux/fou.h b/include/uapi/linux/fou.h index d2947c52dc67..f2ea833a2812 100644 --- a/include/uapi/linux/fou.h +++ b/include/uapi/linux/fou.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* fou.h - FOU Interface */  #ifndef _UAPI_LINUX_FOU_H diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 56235dddea7d..4199f8acbce5 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_FS_H  #define _UAPI_LINUX_FS_H diff --git a/include/uapi/linux/fsl_hypervisor.h b/include/uapi/linux/fsl_hypervisor.h index 1bf04967fec4..1e237fba951f 100644 --- a/include/uapi/linux/fsl_hypervisor.h +++ b/include/uapi/linux/fsl_hypervisor.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * Freescale hypervisor ioctl and kernel interface   * diff --git a/include/uapi/linux/fsmap.h b/include/uapi/linux/fsmap.h index e5213c3e38b2..91fd519a3f7d 100644 --- a/include/uapi/linux/fsmap.h +++ b/include/uapi/linux/fsmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * FS_IOC_GETFSMAP ioctl infrastructure.   * diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 42fa977e3b14..4b5001c57f46 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*      This file defines the kernel interface of FUSE      Copyright (C) 2001-2008  Miklos Szeredi <miklos@szeredi.hu> diff --git a/include/uapi/linux/futex.h b/include/uapi/linux/futex.h index 0b1f716373c7..a89eb0accd5e 100644 --- a/include/uapi/linux/futex.h +++ b/include/uapi/linux/futex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_FUTEX_H  #define _UAPI_LINUX_FUTEX_H diff --git a/include/uapi/linux/gameport.h b/include/uapi/linux/gameport.h index 49b29b068f40..8fb40b4930ac 100644 --- a/include/uapi/linux/gameport.h +++ b/include/uapi/linux/gameport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  Copyright (c) 1999-2002 Vojtech Pavlik   * diff --git a/include/uapi/linux/gen_stats.h b/include/uapi/linux/gen_stats.h index 52deccc2128e..24a861c0d29d 100644 --- a/include/uapi/linux/gen_stats.h +++ b/include/uapi/linux/gen_stats.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_GEN_STATS_H  #define __LINUX_GEN_STATS_H diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h index adc899381e0d..877f7fa95466 100644 --- a/include/uapi/linux/genetlink.h +++ b/include/uapi/linux/genetlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_GENERIC_NETLINK_H  #define _UAPI__LINUX_GENERIC_NETLINK_H diff --git a/include/uapi/linux/genwqe/genwqe_card.h b/include/uapi/linux/genwqe/genwqe_card.h index baa93fb4cd4f..bc779a5d258d 100644 --- a/include/uapi/linux/genwqe/genwqe_card.h +++ b/include/uapi/linux/genwqe/genwqe_card.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __GENWQE_CARD_H__  #define __GENWQE_CARD_H__ diff --git a/include/uapi/linux/gfs2_ondisk.h b/include/uapi/linux/gfs2_ondisk.h index 7c4be7711c81..5156bad77b47 100644 --- a/include/uapi/linux/gfs2_ondisk.h +++ b/include/uapi/linux/gfs2_ondisk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.   * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved. diff --git a/include/uapi/linux/gigaset_dev.h b/include/uapi/linux/gigaset_dev.h index 258ba82937e7..279551af8ebf 100644 --- a/include/uapi/linux/gigaset_dev.h +++ b/include/uapi/linux/gigaset_dev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * interface to user space for the gigaset driver   * diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h index 333d3544c964..1bf6e6df084b 100644 --- a/include/uapi/linux/gpio.h +++ b/include/uapi/linux/gpio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * <linux/gpio.h> - userspace ABI for the GPIO character devices   * diff --git a/include/uapi/linux/gsmmux.h b/include/uapi/linux/gsmmux.h index ab055d8cddef..101d3c469acb 100644 --- a/include/uapi/linux/gsmmux.h +++ b/include/uapi/linux/gsmmux.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_GSMMUX_H  #define _LINUX_GSMMUX_H diff --git a/include/uapi/linux/gtp.h b/include/uapi/linux/gtp.h index 57d1edb8efd9..c7d66755d212 100644 --- a/include/uapi/linux/gtp.h +++ b/include/uapi/linux/gtp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_GTP_H_  #define _UAPI_LINUX_GTP_H_ diff --git a/include/uapi/linux/hash_info.h b/include/uapi/linux/hash_info.h index ebf8fd885dd5..eea5d02c58de 100644 --- a/include/uapi/linux/hash_info.h +++ b/include/uapi/linux/hash_info.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Hash Info: Hash algorithms information   * diff --git a/include/uapi/linux/hdlc.h b/include/uapi/linux/hdlc.h index 2c5f0aff4cf9..d89cb3ee7c70 100644 --- a/include/uapi/linux/hdlc.h +++ b/include/uapi/linux/hdlc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Generic HDLC support routines for Linux   * diff --git a/include/uapi/linux/hdlc/ioctl.h b/include/uapi/linux/hdlc/ioctl.h index 04bc0274a189..0fe4238e8246 100644 --- a/include/uapi/linux/hdlc/ioctl.h +++ b/include/uapi/linux/hdlc/ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __HDLC_IOCTL_H__  #define __HDLC_IOCTL_H__ diff --git a/include/uapi/linux/hdlcdrv.h b/include/uapi/linux/hdlcdrv.h index ffc79c0b44a8..9fe9499403a6 100644 --- a/include/uapi/linux/hdlcdrv.h +++ b/include/uapi/linux/hdlcdrv.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * hdlcdrv.h  -- HDLC packet radio network driver.   * The Linux soundcard driver for 1200 baud and 9600 baud packet radio diff --git a/include/uapi/linux/hdreg.h b/include/uapi/linux/hdreg.h index 29ee2873f4a8..aeee62ebf83c 100644 --- a/include/uapi/linux/hdreg.h +++ b/include/uapi/linux/hdreg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_HDREG_H  #define _LINUX_HDREG_H diff --git a/include/uapi/linux/hid.h b/include/uapi/linux/hid.h index b60f4842bd97..b34492a87a8a 100644 --- a/include/uapi/linux/hid.h +++ b/include/uapi/linux/hid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Copyright (c) 1999 Andreas Gal   *  Copyright (c) 2000-2001 Vojtech Pavlik diff --git a/include/uapi/linux/hiddev.h b/include/uapi/linux/hiddev.h index 7df7884bf5c4..53d6cad7a999 100644 --- a/include/uapi/linux/hiddev.h +++ b/include/uapi/linux/hiddev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Copyright (c) 1999-2000 Vojtech Pavlik   * diff --git a/include/uapi/linux/hidraw.h b/include/uapi/linux/hidraw.h index f5b732979a7c..98e2c493de85 100644 --- a/include/uapi/linux/hidraw.h +++ b/include/uapi/linux/hidraw.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  Copyright (c) 2007 Jiri Kosina   */ diff --git a/include/uapi/linux/hpet.h b/include/uapi/linux/hpet.h index 8af3c70abc8c..30e535644b43 100644 --- a/include/uapi/linux/hpet.h +++ b/include/uapi/linux/hpet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__HPET__  #define _UAPI__HPET__ diff --git a/include/uapi/linux/hsi/cs-protocol.h b/include/uapi/linux/hsi/cs-protocol.h index f153d6ea7c62..c7f6e7672cb5 100644 --- a/include/uapi/linux/hsi/cs-protocol.h +++ b/include/uapi/linux/hsi/cs-protocol.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * cmt-speech interface definitions   * diff --git a/include/uapi/linux/hsi/hsi_char.h b/include/uapi/linux/hsi/hsi_char.h index c00a463d55f9..91623b0398b1 100644 --- a/include/uapi/linux/hsi/hsi_char.h +++ b/include/uapi/linux/hsi/hsi_char.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Part of the HSI character device driver.   * diff --git a/include/uapi/linux/hsr_netlink.h b/include/uapi/linux/hsr_netlink.h index 2475cb8a53af..c218ef9c35dd 100644 --- a/include/uapi/linux/hsr_netlink.h +++ b/include/uapi/linux/hsr_netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright 2011-2013 Autronica Fire and Security AS   * diff --git a/include/uapi/linux/hw_breakpoint.h b/include/uapi/linux/hw_breakpoint.h index 2b65efd19a46..965e4d8606d8 100644 --- a/include/uapi/linux/hw_breakpoint.h +++ b/include/uapi/linux/hw_breakpoint.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_HW_BREAKPOINT_H  #define _UAPI_LINUX_HW_BREAKPOINT_H diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h index e347b24ef9fb..991b2b7ada7a 100644 --- a/include/uapi/linux/hyperv.h +++ b/include/uapi/linux/hyperv.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *   * Copyright (c) 2011, Microsoft Corporation. diff --git a/include/uapi/linux/hysdn_if.h b/include/uapi/linux/hysdn_if.h index 00236ae3b04e..99f77c517e6d 100644 --- a/include/uapi/linux/hysdn_if.h +++ b/include/uapi/linux/hysdn_if.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $   *   * Linux driver for HYSDN cards diff --git a/include/uapi/linux/i2c-dev.h b/include/uapi/linux/i2c-dev.h index 2f05e66de01e..85f8047afcf2 100644 --- a/include/uapi/linux/i2c-dev.h +++ b/include/uapi/linux/i2c-dev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*      i2c-dev.h - i2c-bus driver, char device interface diff --git a/include/uapi/linux/i2c.h b/include/uapi/linux/i2c.h index 009e27bb9abe..fe648032d6b9 100644 --- a/include/uapi/linux/i2c.h +++ b/include/uapi/linux/i2c.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /* ------------------------------------------------------------------------- */  /*									     */  /* i2c.h - definitions for the i2c-bus interface			     */ diff --git a/include/uapi/linux/i2o-dev.h b/include/uapi/linux/i2o-dev.h index a8093bfec3a6..b1cd407c47d5 100644 --- a/include/uapi/linux/i2o-dev.h +++ b/include/uapi/linux/i2o-dev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * I2O user space accessible structures/APIs   * diff --git a/include/uapi/linux/i8k.h b/include/uapi/linux/i8k.h index 133d02f03c25..268e6268f6c8 100644 --- a/include/uapi/linux/i8k.h +++ b/include/uapi/linux/i8k.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * i8k.h -- Linux driver for accessing the SMM BIOS on Dell laptops   * diff --git a/include/uapi/linux/icmp.h b/include/uapi/linux/icmp.h index fddd9d736284..5589eeb791ca 100644 --- a/include/uapi/linux/icmp.h +++ b/include/uapi/linux/icmp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/icmpv6.h b/include/uapi/linux/icmpv6.h index 590beda78ea0..caf8dc019250 100644 --- a/include/uapi/linux/icmpv6.h +++ b/include/uapi/linux/icmpv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_ICMPV6_H  #define _UAPI_LINUX_ICMPV6_H diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h index 259617a551f2..7fea0fd7d6f5 100644 --- a/include/uapi/linux/if.h +++ b/include/uapi/linux/if.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/if_addr.h b/include/uapi/linux/if_addr.h index 4318ab1635ce..2ef053d265de 100644 --- a/include/uapi/linux/if_addr.h +++ b/include/uapi/linux/if_addr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_IF_ADDR_H  #define __LINUX_IF_ADDR_H diff --git a/include/uapi/linux/if_addrlabel.h b/include/uapi/linux/if_addrlabel.h index 54580c298187..d1f5974c76e1 100644 --- a/include/uapi/linux/if_addrlabel.h +++ b/include/uapi/linux/if_addrlabel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * if_addrlabel.h - netlink interface for address labels   * diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h index f2acd2fde1f3..bc2bcdec377b 100644 --- a/include/uapi/linux/if_alg.h +++ b/include/uapi/linux/if_alg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * if_alg: User-space algorithm interface   * diff --git a/include/uapi/linux/if_arcnet.h b/include/uapi/linux/if_arcnet.h index cfb642f8e7bd..683878036d76 100644 --- a/include/uapi/linux/if_arcnet.h +++ b/include/uapi/linux/if_arcnet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET         An implementation of the TCP/IP protocol suite for the LINUX   *              operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h index a2a635620600..4605527ca41b 100644 --- a/include/uapi/linux/if_arp.h +++ b/include/uapi/linux/if_arp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/if_bonding.h b/include/uapi/linux/if_bonding.h index 9635a62f6f89..61a1bf6e865e 100644 --- a/include/uapi/linux/if_bonding.h +++ b/include/uapi/linux/if_bonding.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /*   * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.   * diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index a9e6244ce438..e41eda3c71f1 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *	Linux ethernet bridge   * diff --git a/include/uapi/linux/if_cablemodem.h b/include/uapi/linux/if_cablemodem.h index ee6b3c442baf..1f65130bf2a6 100644 --- a/include/uapi/linux/if_cablemodem.h +++ b/include/uapi/linux/if_cablemodem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  #ifndef _LINUX_CABLEMODEM_H_  #define _LINUX_CABLEMODEM_H_  /* diff --git a/include/uapi/linux/if_eql.h b/include/uapi/linux/if_eql.h index 06e818c9e7cb..d6865a2d8cdd 100644 --- a/include/uapi/linux/if_eql.h +++ b/include/uapi/linux/if_eql.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Equalizer Load-balancer for serial network interfaces.   * diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 9037065e23d0..3ee3bf7c8526 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/if_fc.h b/include/uapi/linux/if_fc.h index 6ed7f1bf35c8..3e3173282cc3 100644 --- a/include/uapi/linux/if_fc.h +++ b/include/uapi/linux/if_fc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/if_fddi.h b/include/uapi/linux/if_fddi.h index 1086cd9f6754..75eed8b62823 100644 --- a/include/uapi/linux/if_fddi.h +++ b/include/uapi/linux/if_fddi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the BSD Socket diff --git a/include/uapi/linux/if_frad.h b/include/uapi/linux/if_frad.h index f25b08d5eb6b..3c6ee85f6262 100644 --- a/include/uapi/linux/if_frad.h +++ b/include/uapi/linux/if_frad.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * DLCI/FRAD	Definitions for Frame Relay Access Devices.  DLCI devices are   *		created for each DLCI associated with a FRAD.  The FRAD driver diff --git a/include/uapi/linux/if_hippi.h b/include/uapi/linux/if_hippi.h index cdc049f1829a..785a1452a66c 100644 --- a/include/uapi/linux/if_hippi.h +++ b/include/uapi/linux/if_hippi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/if_infiniband.h b/include/uapi/linux/if_infiniband.h index 7d958475d4ac..050b92dcf8cf 100644 --- a/include/uapi/linux/if_infiniband.h +++ b/include/uapi/linux/if_infiniband.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * This software is available to you under a choice of one of two   * licenses.  You may choose to be licensed under the terms of the GNU diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 8d062c58d5cb..19fc02660e0c 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_IF_LINK_H  #define _UAPI_LINUX_IF_LINK_H @@ -158,6 +159,8 @@ enum {  	IFLA_PAD,  	IFLA_XDP,  	IFLA_EVENT, +	IFLA_NEW_NETNSID, +	IFLA_IF_NETNSID,  	__IFLA_MAX  }; @@ -325,6 +328,8 @@ enum {  	IFLA_BRPORT_MCAST_TO_UCAST,  	IFLA_BRPORT_VLAN_TUNNEL,  	IFLA_BRPORT_BCAST_FLOOD, +	IFLA_BRPORT_GROUP_FWD_MASK, +	IFLA_BRPORT_NEIGH_SUPPRESS,  	__IFLA_BRPORT_MAX  };  #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) @@ -462,6 +467,7 @@ enum macsec_validation_type {  enum {  	IFLA_IPVLAN_UNSPEC,  	IFLA_IPVLAN_MODE, +	IFLA_IPVLAN_FLAGS,  	__IFLA_IPVLAN_MAX  }; @@ -474,6 +480,9 @@ enum ipvlan_mode {  	IPVLAN_MODE_MAX  }; +#define IPVLAN_F_PRIVATE	0x01 +#define IPVLAN_F_VEPA		0x02 +  /* VXLAN section */  enum {  	IFLA_VXLAN_UNSPEC, diff --git a/include/uapi/linux/if_ltalk.h b/include/uapi/linux/if_ltalk.h index b92c1fb6ac16..fa61e776f598 100644 --- a/include/uapi/linux/if_ltalk.h +++ b/include/uapi/linux/if_ltalk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_LTALK_H  #define _UAPI__LINUX_LTALK_H diff --git a/include/uapi/linux/if_macsec.h b/include/uapi/linux/if_macsec.h index 02fc49cb72d8..719d243471f4 100644 --- a/include/uapi/linux/if_macsec.h +++ b/include/uapi/linux/if_macsec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * include/uapi/linux/if_macsec.h - MACsec device   * diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h index 4df96a7dd4fa..67b61d91d89b 100644 --- a/include/uapi/linux/if_packet.h +++ b/include/uapi/linux/if_packet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_IF_PACKET_H  #define __LINUX_IF_PACKET_H diff --git a/include/uapi/linux/if_phonet.h b/include/uapi/linux/if_phonet.h index f7ad9e24eb3d..9c22c969ec69 100644 --- a/include/uapi/linux/if_phonet.h +++ b/include/uapi/linux/if_phonet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * File: if_phonet.h   * diff --git a/include/uapi/linux/if_plip.h b/include/uapi/linux/if_plip.h index 6298c7e88b2b..495a366112f2 100644 --- a/include/uapi/linux/if_plip.h +++ b/include/uapi/linux/if_plip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *	NET3	PLIP tuning facilities for the new Niibe PLIP.   * diff --git a/include/uapi/linux/if_pppol2tp.h b/include/uapi/linux/if_pppol2tp.h index 6418c4d10241..060b4d1f3129 100644 --- a/include/uapi/linux/if_pppol2tp.h +++ b/include/uapi/linux/if_pppol2tp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /***************************************************************************   * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)   * diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h index d37bbb17a007..e7a693c28f16 100644 --- a/include/uapi/linux/if_pppox.h +++ b/include/uapi/linux/if_pppox.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /***************************************************************************   * Linux PPP over X - Generic PPP transport layer sockets   * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516)  diff --git a/include/uapi/linux/if_slip.h b/include/uapi/linux/if_slip.h index 1eb4e3a8397a..65937be53103 100644 --- a/include/uapi/linux/if_slip.h +++ b/include/uapi/linux/if_slip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *	Swansea University Computer Society	NET3   *	 diff --git a/include/uapi/linux/if_team.h b/include/uapi/linux/if_team.h index 7b8fa339de30..13c61fecb78b 100644 --- a/include/uapi/linux/if_team.h +++ b/include/uapi/linux/if_team.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * include/linux/if_team.h - Network team device driver header   * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com> diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h index 3cb5e1d85ddd..030d3e6d6029 100644 --- a/include/uapi/linux/if_tun.h +++ b/include/uapi/linux/if_tun.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Universal TUN/TAP device driver.   *  Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com> @@ -60,6 +61,8 @@  /* TUNSETIFF ifr flags */  #define IFF_TUN		0x0001  #define IFF_TAP		0x0002 +#define IFF_NAPI	0x0010 +#define IFF_NAPI_FRAGS	0x0020  #define IFF_NO_PI	0x1000  /* This flag has no real effect */  #define IFF_ONE_QUEUE	0x2000 diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h index 2e520883c054..e68dadbd6d45 100644 --- a/include/uapi/linux/if_tunnel.h +++ b/include/uapi/linux/if_tunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_IF_TUNNEL_H_  #define _UAPI_IF_TUNNEL_H_ @@ -84,6 +85,7 @@ enum tunnel_encap_types {  	TUNNEL_ENCAP_NONE,  	TUNNEL_ENCAP_FOU,  	TUNNEL_ENCAP_GUE, +	TUNNEL_ENCAP_MPLS,  };  #define TUNNEL_ENCAP_FLAG_CSUM		(1<<0) diff --git a/include/uapi/linux/if_vlan.h b/include/uapi/linux/if_vlan.h index 7e5e6b397332..7a0e8bd65b6b 100644 --- a/include/uapi/linux/if_vlan.h +++ b/include/uapi/linux/if_vlan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * VLAN		An implementation of 802.1Q VLAN tagging.   * diff --git a/include/uapi/linux/if_x25.h b/include/uapi/linux/if_x25.h index 897765f5feb8..5d962448345f 100644 --- a/include/uapi/linux/if_x25.h +++ b/include/uapi/linux/if_x25.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Linux X.25 packet to device interface   * diff --git a/include/uapi/linux/ife.h b/include/uapi/linux/ife.h index 2954da32e012..bdd953c67db1 100644 --- a/include/uapi/linux/ife.h +++ b/include/uapi/linux/ife.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __UAPI_IFE_H  #define __UAPI_IFE_H diff --git a/include/uapi/linux/igmp.h b/include/uapi/linux/igmp.h index a97f9a7568cf..7e44ac02ca18 100644 --- a/include/uapi/linux/igmp.h +++ b/include/uapi/linux/igmp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *	Linux NET3:	Internet Group Management Protocol  [IGMP]   * diff --git a/include/uapi/linux/iio/events.h b/include/uapi/linux/iio/events.h index 00bbdaed2f97..6ef413452dce 100644 --- a/include/uapi/linux/iio/events.h +++ b/include/uapi/linux/iio/events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* The industrial I/O - event passing to userspace   *   * Copyright (c) 2008-2011 Jonathan Cameron diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index ffafd6c25a48..4213cdf88e3c 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* industrial I/O data types needed both in and out of kernel   *   * Copyright (c) 2008 Jonathan Cameron diff --git a/include/uapi/linux/ila.h b/include/uapi/linux/ila.h index 948c0a91e11b..483b77af4eb8 100644 --- a/include/uapi/linux/ila.h +++ b/include/uapi/linux/ila.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* ila.h - ILA Interface */  #ifndef _UAPI_LINUX_ILA_H @@ -16,6 +17,8 @@ enum {  	ILA_ATTR_DIR,				/* u32 */  	ILA_ATTR_PAD,  	ILA_ATTR_CSUM_MODE,			/* u8 */ +	ILA_ATTR_IDENT_TYPE,			/* u8 */ +	ILA_ATTR_HOOK_TYPE,			/* u8 */  	__ILA_ATTR_MAX,  }; @@ -40,6 +43,25 @@ enum {  	ILA_CSUM_ADJUST_TRANSPORT,  	ILA_CSUM_NEUTRAL_MAP,  	ILA_CSUM_NO_ACTION, +	ILA_CSUM_NEUTRAL_MAP_AUTO, +}; + +enum { +	ILA_ATYPE_IID = 0, +	ILA_ATYPE_LUID, +	ILA_ATYPE_VIRT_V4, +	ILA_ATYPE_VIRT_UNI_V6, +	ILA_ATYPE_VIRT_MULTI_V6, +	ILA_ATYPE_NONLOCAL_ADDR, +	ILA_ATYPE_RSVD_1, +	ILA_ATYPE_RSVD_2, + +	ILA_ATYPE_USE_FORMAT = 32, /* Get type from type field in identifier */ +}; + +enum { +	ILA_HOOK_ROUTE_OUTPUT, +	ILA_HOOK_ROUTE_INPUT,  };  #endif /* _UAPI_LINUX_ILA_H */ diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h index 4e557f4e9553..48e8a225b985 100644 --- a/include/uapi/linux/in.h +++ b/include/uapi/linux/in.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h index 46444f8fbee4..ed291e55f024 100644 --- a/include/uapi/linux/in6.h +++ b/include/uapi/linux/in6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *	Types and definitions for AF_INET6    *	Linux INET6 implementation  @@ -284,6 +285,7 @@ struct in6_flowlabel_req {  #define IPV6_TRANSPARENT        75  #define IPV6_UNICAST_IF         76  #define IPV6_RECVFRAGSIZE	77 +#define IPV6_FREEBIND		78  /*   * Multicast Routing: diff --git a/include/uapi/linux/in_route.h b/include/uapi/linux/in_route.h index b261b8c915f0..0cc2c23b47f8 100644 --- a/include/uapi/linux/in_route.h +++ b/include/uapi/linux/in_route.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_IN_ROUTE_H  #define _LINUX_IN_ROUTE_H diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h index f52ff62bfabe..817d807e9481 100644 --- a/include/uapi/linux/inet_diag.h +++ b/include/uapi/linux/inet_diag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_INET_DIAG_H_  #define _UAPI_INET_DIAG_H_ diff --git a/include/uapi/linux/inotify.h b/include/uapi/linux/inotify.h index e6bf35b2dd34..5474461683db 100644 --- a/include/uapi/linux/inotify.h +++ b/include/uapi/linux/inotify.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Inode based directory notification for Linux   * diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 179891074b3c..061fa62958a2 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Input event codes   * @@ -406,6 +407,7 @@  #define BTN_TOOL_MOUSE		0x146  #define BTN_TOOL_LENS		0x147  #define BTN_TOOL_QUINTTAP	0x148	/* Five fingers on trackpad */ +#define BTN_STYLUS3		0x149  #define BTN_TOUCH		0x14a  #define BTN_STYLUS		0x14b  #define BTN_STYLUS2		0x14c diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index f561c0eb7d63..8c5a0bf6ee35 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (c) 1999-2002 Vojtech Pavlik   * diff --git a/include/uapi/linux/ioctl.h b/include/uapi/linux/ioctl.h index aa91eb3951ef..b292e8093b24 100644 --- a/include/uapi/linux/ioctl.h +++ b/include/uapi/linux/ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_IOCTL_H  #define _LINUX_IOCTL_H diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h index f291569768dd..b24a742beae5 100644 --- a/include/uapi/linux/ip.h +++ b/include/uapi/linux/ip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/ip6_tunnel.h b/include/uapi/linux/ip6_tunnel.h index 425926c467d7..0245269b037c 100644 --- a/include/uapi/linux/ip6_tunnel.h +++ b/include/uapi/linux/ip6_tunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IP6_TUNNEL_H  #define _IP6_TUNNEL_H @@ -20,6 +21,8 @@  #define IP6_TNL_F_RCV_DSCP_COPY 0x10  /* copy fwmark from inner packet */  #define IP6_TNL_F_USE_ORIG_FWMARK 0x20 +/* allow remote endpoint on the local node */ +#define IP6_TNL_F_ALLOW_LOCAL_REMOTE 0x40  struct ip6_tnl_parm {  	char name[IFNAMSIZ];	/* name of tunnel device */ diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h index 22d69894bc92..1c916b2f89dc 100644 --- a/include/uapi/linux/ip_vs.h +++ b/include/uapi/linux/ip_vs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *      IP Virtual Server   *      data structure and functionality definitions diff --git a/include/uapi/linux/ipc.h b/include/uapi/linux/ipc.h index de08dd46ddae..5995fc9d675e 100644 --- a/include/uapi/linux/ipc.h +++ b/include/uapi/linux/ipc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_IPC_H  #define _UAPI_LINUX_IPC_H diff --git a/include/uapi/linux/ipmi.h b/include/uapi/linux/ipmi.h index b9095a27a08a..b076f7a47407 100644 --- a/include/uapi/linux/ipmi.h +++ b/include/uapi/linux/ipmi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * ipmi.h   * diff --git a/include/uapi/linux/ipmi_msgdefs.h b/include/uapi/linux/ipmi_msgdefs.h index df97e6e31e87..17f349459587 100644 --- a/include/uapi/linux/ipmi_msgdefs.h +++ b/include/uapi/linux/ipmi_msgdefs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * ipmi_smi.h   * diff --git a/include/uapi/linux/ipsec.h b/include/uapi/linux/ipsec.h index d17a6302a0e9..50d8ee1791e2 100644 --- a/include/uapi/linux/ipsec.h +++ b/include/uapi/linux/ipsec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_IPSEC_H  #define _LINUX_IPSEC_H diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h index 2ae59178189d..9c0f4a92bcff 100644 --- a/include/uapi/linux/ipv6.h +++ b/include/uapi/linux/ipv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_IPV6_H  #define _UAPI_IPV6_H @@ -185,6 +186,7 @@ enum {  	DEVCONF_ADDR_GEN_MODE,  	DEVCONF_DISABLE_POLICY,  	DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN, +	DEVCONF_NDISC_TCLASS,  	DEVCONF_MAX  }; diff --git a/include/uapi/linux/ipv6_route.h b/include/uapi/linux/ipv6_route.h index d496c02e14bc..593800a18799 100644 --- a/include/uapi/linux/ipv6_route.h +++ b/include/uapi/linux/ipv6_route.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *	Linux INET6 implementation    * @@ -28,7 +29,7 @@  #define RTF_ROUTEINFO	0x00800000	/* route information - RA	*/ -#define RTF_CACHE	0x01000000	/* cache entry			*/ +#define RTF_CACHE	0x01000000	/* read-only: can not be set by user */  #define RTF_FLOW	0x02000000	/* flow significant route	*/  #define RTF_POLICY	0x04000000	/* policy route			*/ diff --git a/include/uapi/linux/ipx.h b/include/uapi/linux/ipx.h index 30f031db12f6..3168137adae8 100644 --- a/include/uapi/linux/ipx.h +++ b/include/uapi/linux/ipx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IPX_H_  #define _IPX_H_  #include <linux/libc-compat.h>	/* for compatibility with glibc netipx/ipx.h */ diff --git a/include/uapi/linux/irda.h b/include/uapi/linux/irda.h index a014c3252311..2105c266aa6e 100644 --- a/include/uapi/linux/irda.h +++ b/include/uapi/linux/irda.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*********************************************************************   *                   * Filename:      irda.h diff --git a/include/uapi/linux/isdn.h b/include/uapi/linux/isdn.h index eb1995fffc39..f371fd52ed75 100644 --- a/include/uapi/linux/isdn.h +++ b/include/uapi/linux/isdn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $   *   * Main header for the Linux ISDN subsystem (linklevel). diff --git a/include/uapi/linux/isdn/capicmd.h b/include/uapi/linux/isdn/capicmd.h index b58635f722da..4941628a4fb9 100644 --- a/include/uapi/linux/isdn/capicmd.h +++ b/include/uapi/linux/isdn/capicmd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* $Id: capicmd.h,v 1.2.6.2 2001/09/23 22:24:33 kai Exp $   *    * CAPI 2.0 Interface for Linux diff --git a/include/uapi/linux/isdn_divertif.h b/include/uapi/linux/isdn_divertif.h index 3e3c2d898416..0a17bb1bcb1b 100644 --- a/include/uapi/linux/isdn_divertif.h +++ b/include/uapi/linux/isdn_divertif.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $   *   * Header for the diversion supplementary interface for i4l. diff --git a/include/uapi/linux/isdn_ppp.h b/include/uapi/linux/isdn_ppp.h index e7d7bd2aed3f..0bdc4efaacb2 100644 --- a/include/uapi/linux/isdn_ppp.h +++ b/include/uapi/linux/isdn_ppp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /* Linux ISDN subsystem, sync PPP, interface to ipppd   *   * Copyright 1994-1999  by Fritz Elfert (fritz@isdn4linux.de) diff --git a/include/uapi/linux/isdnif.h b/include/uapi/linux/isdnif.h index 246138c01c4d..611a69196738 100644 --- a/include/uapi/linux/isdnif.h +++ b/include/uapi/linux/isdnif.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $   *   * Linux ISDN subsystem diff --git a/include/uapi/linux/iso_fs.h b/include/uapi/linux/iso_fs.h index 4688ac4284e2..a2555176f6d1 100644 --- a/include/uapi/linux/iso_fs.h +++ b/include/uapi/linux/iso_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ISOFS_FS_H  #define _ISOFS_FS_H @@ -12,10 +13,10 @@  #define ISODCL(from, to) (to - from + 1)  struct iso_volume_descriptor { -	char type[ISODCL(1,1)]; /* 711 */ +	__u8 type[ISODCL(1,1)]; /* 711 */  	char id[ISODCL(2,6)]; -	char version[ISODCL(7,7)]; -	char data[ISODCL(8,2048)]; +	__u8 version[ISODCL(7,7)]; +	__u8 data[ISODCL(8,2048)];  };  /* volume descriptor types */ @@ -26,24 +27,24 @@ struct iso_volume_descriptor {  #define ISO_STANDARD_ID "CD001"  struct iso_primary_descriptor { -	char type			[ISODCL (  1,   1)]; /* 711 */ +	__u8 type			[ISODCL (  1,   1)]; /* 711 */  	char id				[ISODCL (  2,   6)]; -	char version			[ISODCL (  7,   7)]; /* 711 */ -	char unused1			[ISODCL (  8,   8)]; +	__u8 version			[ISODCL (  7,   7)]; /* 711 */ +	__u8 unused1			[ISODCL (  8,   8)];  	char system_id			[ISODCL (  9,  40)]; /* achars */  	char volume_id			[ISODCL ( 41,  72)]; /* dchars */ -	char unused2			[ISODCL ( 73,  80)]; -	char volume_space_size		[ISODCL ( 81,  88)]; /* 733 */ -	char unused3			[ISODCL ( 89, 120)]; -	char volume_set_size		[ISODCL (121, 124)]; /* 723 */ -	char volume_sequence_number	[ISODCL (125, 128)]; /* 723 */ -	char logical_block_size		[ISODCL (129, 132)]; /* 723 */ -	char path_table_size		[ISODCL (133, 140)]; /* 733 */ -	char type_l_path_table		[ISODCL (141, 144)]; /* 731 */ -	char opt_type_l_path_table	[ISODCL (145, 148)]; /* 731 */ -	char type_m_path_table		[ISODCL (149, 152)]; /* 732 */ -	char opt_type_m_path_table	[ISODCL (153, 156)]; /* 732 */ -	char root_directory_record	[ISODCL (157, 190)]; /* 9.1 */ +	__u8 unused2			[ISODCL ( 73,  80)]; +	__u8 volume_space_size		[ISODCL ( 81,  88)]; /* 733 */ +	__u8 unused3			[ISODCL ( 89, 120)]; +	__u8 volume_set_size		[ISODCL (121, 124)]; /* 723 */ +	__u8 volume_sequence_number	[ISODCL (125, 128)]; /* 723 */ +	__u8 logical_block_size		[ISODCL (129, 132)]; /* 723 */ +	__u8 path_table_size		[ISODCL (133, 140)]; /* 733 */ +	__u8 type_l_path_table		[ISODCL (141, 144)]; /* 731 */ +	__u8 opt_type_l_path_table	[ISODCL (145, 148)]; /* 731 */ +	__u8 type_m_path_table		[ISODCL (149, 152)]; /* 732 */ +	__u8 opt_type_m_path_table	[ISODCL (153, 156)]; /* 732 */ +	__u8 root_directory_record	[ISODCL (157, 190)]; /* 9.1 */  	char volume_set_id		[ISODCL (191, 318)]; /* dchars */  	char publisher_id		[ISODCL (319, 446)]; /* achars */  	char preparer_id		[ISODCL (447, 574)]; /* achars */ @@ -51,36 +52,36 @@ struct iso_primary_descriptor {  	char copyright_file_id		[ISODCL (703, 739)]; /* 7.5 dchars */  	char abstract_file_id		[ISODCL (740, 776)]; /* 7.5 dchars */  	char bibliographic_file_id	[ISODCL (777, 813)]; /* 7.5 dchars */ -	char creation_date		[ISODCL (814, 830)]; /* 8.4.26.1 */ -	char modification_date		[ISODCL (831, 847)]; /* 8.4.26.1 */ -	char expiration_date		[ISODCL (848, 864)]; /* 8.4.26.1 */ -	char effective_date		[ISODCL (865, 881)]; /* 8.4.26.1 */ -	char file_structure_version	[ISODCL (882, 882)]; /* 711 */ -	char unused4			[ISODCL (883, 883)]; -	char application_data		[ISODCL (884, 1395)]; -	char unused5			[ISODCL (1396, 2048)]; +	__u8 creation_date		[ISODCL (814, 830)]; /* 8.4.26.1 */ +	__u8 modification_date		[ISODCL (831, 847)]; /* 8.4.26.1 */ +	__u8 expiration_date		[ISODCL (848, 864)]; /* 8.4.26.1 */ +	__u8 effective_date		[ISODCL (865, 881)]; /* 8.4.26.1 */ +	__u8 file_structure_version	[ISODCL (882, 882)]; /* 711 */ +	__u8 unused4			[ISODCL (883, 883)]; +	__u8 application_data		[ISODCL (884, 1395)]; +	__u8 unused5			[ISODCL (1396, 2048)];  };  /* Almost the same as the primary descriptor but two fields are specified */  struct iso_supplementary_descriptor { -	char type			[ISODCL (  1,   1)]; /* 711 */ +	__u8 type			[ISODCL (  1,   1)]; /* 711 */  	char id				[ISODCL (  2,   6)]; -	char version			[ISODCL (  7,   7)]; /* 711 */ -	char flags			[ISODCL (  8,   8)]; /* 853 */ +	__u8 version			[ISODCL (  7,   7)]; /* 711 */ +	__u8 flags			[ISODCL (  8,   8)]; /* 853 */  	char system_id			[ISODCL (  9,  40)]; /* achars */  	char volume_id			[ISODCL ( 41,  72)]; /* dchars */ -	char unused2			[ISODCL ( 73,  80)]; -	char volume_space_size		[ISODCL ( 81,  88)]; /* 733 */ -	char escape			[ISODCL ( 89, 120)]; /* 856 */ -	char volume_set_size		[ISODCL (121, 124)]; /* 723 */ -	char volume_sequence_number	[ISODCL (125, 128)]; /* 723 */ -	char logical_block_size		[ISODCL (129, 132)]; /* 723 */ -	char path_table_size		[ISODCL (133, 140)]; /* 733 */ -	char type_l_path_table		[ISODCL (141, 144)]; /* 731 */ -	char opt_type_l_path_table	[ISODCL (145, 148)]; /* 731 */ -	char type_m_path_table		[ISODCL (149, 152)]; /* 732 */ -	char opt_type_m_path_table	[ISODCL (153, 156)]; /* 732 */ -	char root_directory_record	[ISODCL (157, 190)]; /* 9.1 */ +	__u8 unused2			[ISODCL ( 73,  80)]; +	__u8 volume_space_size		[ISODCL ( 81,  88)]; /* 733 */ +	__u8 escape			[ISODCL ( 89, 120)]; /* 856 */ +	__u8 volume_set_size		[ISODCL (121, 124)]; /* 723 */ +	__u8 volume_sequence_number	[ISODCL (125, 128)]; /* 723 */ +	__u8 logical_block_size		[ISODCL (129, 132)]; /* 723 */ +	__u8 path_table_size		[ISODCL (133, 140)]; /* 733 */ +	__u8 type_l_path_table		[ISODCL (141, 144)]; /* 731 */ +	__u8 opt_type_l_path_table	[ISODCL (145, 148)]; /* 731 */ +	__u8 type_m_path_table		[ISODCL (149, 152)]; /* 732 */ +	__u8 opt_type_m_path_table	[ISODCL (153, 156)]; /* 732 */ +	__u8 root_directory_record	[ISODCL (157, 190)]; /* 9.1 */  	char volume_set_id		[ISODCL (191, 318)]; /* dchars */  	char publisher_id		[ISODCL (319, 446)]; /* achars */  	char preparer_id		[ISODCL (447, 574)]; /* achars */ @@ -88,54 +89,54 @@ struct iso_supplementary_descriptor {  	char copyright_file_id		[ISODCL (703, 739)]; /* 7.5 dchars */  	char abstract_file_id		[ISODCL (740, 776)]; /* 7.5 dchars */  	char bibliographic_file_id	[ISODCL (777, 813)]; /* 7.5 dchars */ -	char creation_date		[ISODCL (814, 830)]; /* 8.4.26.1 */ -	char modification_date		[ISODCL (831, 847)]; /* 8.4.26.1 */ -	char expiration_date		[ISODCL (848, 864)]; /* 8.4.26.1 */ -	char effective_date		[ISODCL (865, 881)]; /* 8.4.26.1 */ -	char file_structure_version	[ISODCL (882, 882)]; /* 711 */ -	char unused4			[ISODCL (883, 883)]; -	char application_data		[ISODCL (884, 1395)]; -	char unused5			[ISODCL (1396, 2048)]; +	__u8 creation_date		[ISODCL (814, 830)]; /* 8.4.26.1 */ +	__u8 modification_date		[ISODCL (831, 847)]; /* 8.4.26.1 */ +	__u8 expiration_date		[ISODCL (848, 864)]; /* 8.4.26.1 */ +	__u8 effective_date		[ISODCL (865, 881)]; /* 8.4.26.1 */ +	__u8 file_structure_version	[ISODCL (882, 882)]; /* 711 */ +	__u8 unused4			[ISODCL (883, 883)]; +	__u8 application_data		[ISODCL (884, 1395)]; +	__u8 unused5			[ISODCL (1396, 2048)];  };  #define HS_STANDARD_ID "CDROM"  struct  hs_volume_descriptor { -	char foo			[ISODCL (  1,   8)]; /* 733 */ -	char type			[ISODCL (  9,   9)]; /* 711 */ +	__u8 foo			[ISODCL (  1,   8)]; /* 733 */ +	__u8 type			[ISODCL (  9,   9)]; /* 711 */  	char id				[ISODCL ( 10,  14)]; -	char version			[ISODCL ( 15,  15)]; /* 711 */ -	char data[ISODCL(16,2048)]; +	__u8 version			[ISODCL ( 15,  15)]; /* 711 */ +	__u8 data[ISODCL(16,2048)];  };  struct hs_primary_descriptor { -	char foo			[ISODCL (  1,   8)]; /* 733 */ -	char type			[ISODCL (  9,   9)]; /* 711 */ -	char id				[ISODCL ( 10,  14)]; -	char version			[ISODCL ( 15,  15)]; /* 711 */ -	char unused1			[ISODCL ( 16,  16)]; /* 711 */ +	__u8 foo			[ISODCL (  1,   8)]; /* 733 */ +	__u8 type			[ISODCL (  9,   9)]; /* 711 */ +	__u8 id				[ISODCL ( 10,  14)]; +	__u8 version			[ISODCL ( 15,  15)]; /* 711 */ +	__u8 unused1			[ISODCL ( 16,  16)]; /* 711 */  	char system_id			[ISODCL ( 17,  48)]; /* achars */  	char volume_id			[ISODCL ( 49,  80)]; /* dchars */ -	char unused2			[ISODCL ( 81,  88)]; /* 733 */ -	char volume_space_size		[ISODCL ( 89,  96)]; /* 733 */ -	char unused3			[ISODCL ( 97, 128)]; /* 733 */ -	char volume_set_size		[ISODCL (129, 132)]; /* 723 */ -	char volume_sequence_number	[ISODCL (133, 136)]; /* 723 */ -	char logical_block_size		[ISODCL (137, 140)]; /* 723 */ -	char path_table_size		[ISODCL (141, 148)]; /* 733 */ -	char type_l_path_table		[ISODCL (149, 152)]; /* 731 */ -	char unused4			[ISODCL (153, 180)]; /* 733 */ -	char root_directory_record	[ISODCL (181, 214)]; /* 9.1 */ +	__u8 unused2			[ISODCL ( 81,  88)]; /* 733 */ +	__u8 volume_space_size		[ISODCL ( 89,  96)]; /* 733 */ +	__u8 unused3			[ISODCL ( 97, 128)]; /* 733 */ +	__u8 volume_set_size		[ISODCL (129, 132)]; /* 723 */ +	__u8 volume_sequence_number	[ISODCL (133, 136)]; /* 723 */ +	__u8 logical_block_size		[ISODCL (137, 140)]; /* 723 */ +	__u8 path_table_size		[ISODCL (141, 148)]; /* 733 */ +	__u8 type_l_path_table		[ISODCL (149, 152)]; /* 731 */ +	__u8 unused4			[ISODCL (153, 180)]; /* 733 */ +	__u8 root_directory_record	[ISODCL (181, 214)]; /* 9.1 */  };  /* We use this to help us look up the parent inode numbers. */  struct iso_path_table{ -	unsigned char  name_len[2];	/* 721 */ -	char extent[4];		/* 731 */ -	char  parent[2];	/* 721 */ +	__u8  name_len[2];	/* 721 */ +	__u8  extent[4];	/* 731 */ +	__u8  parent[2];	/* 721 */  	char name[0];  } __attribute__((packed)); @@ -143,16 +144,16 @@ struct iso_path_table{     there is an extra reserved byte after the flags */  struct iso_directory_record { -	char length			[ISODCL (1, 1)]; /* 711 */ -	char ext_attr_length		[ISODCL (2, 2)]; /* 711 */ -	char extent			[ISODCL (3, 10)]; /* 733 */ -	char size			[ISODCL (11, 18)]; /* 733 */ -	char date			[ISODCL (19, 25)]; /* 7 by 711 */ -	char flags			[ISODCL (26, 26)]; -	char file_unit_size		[ISODCL (27, 27)]; /* 711 */ -	char interleave			[ISODCL (28, 28)]; /* 711 */ -	char volume_sequence_number	[ISODCL (29, 32)]; /* 723 */ -	unsigned char name_len		[ISODCL (33, 33)]; /* 711 */ +	__u8 length			[ISODCL (1, 1)]; /* 711 */ +	__u8 ext_attr_length		[ISODCL (2, 2)]; /* 711 */ +	__u8 extent			[ISODCL (3, 10)]; /* 733 */ +	__u8 size			[ISODCL (11, 18)]; /* 733 */ +	__u8 date			[ISODCL (19, 25)]; /* 7 by 711 */ +	__u8 flags			[ISODCL (26, 26)]; +	__u8 file_unit_size		[ISODCL (27, 27)]; /* 711 */ +	__u8 interleave			[ISODCL (28, 28)]; /* 711 */ +	__u8 volume_sequence_number	[ISODCL (29, 32)]; /* 723 */ +	__u8 name_len			[ISODCL (33, 33)]; /* 711 */  	char name			[0];  } __attribute__((packed)); diff --git a/include/uapi/linux/ivtv.h b/include/uapi/linux/ivtv.h index 42bf725751af..e74f18642b11 100644 --- a/include/uapi/linux/ivtv.h +++ b/include/uapi/linux/ivtv.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*      Public ivtv API header      Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com> diff --git a/include/uapi/linux/ivtvfb.h b/include/uapi/linux/ivtvfb.h index e8b92f67f10d..9e9b072375de 100644 --- a/include/uapi/linux/ivtvfb.h +++ b/include/uapi/linux/ivtvfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*      On Screen Display cx23415 Framebuffer driver diff --git a/include/uapi/linux/ixjuser.h b/include/uapi/linux/ixjuser.h index 94ab5e942e53..ba245007cfe7 100644 --- a/include/uapi/linux/ixjuser.h +++ b/include/uapi/linux/ixjuser.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  #ifndef __LINUX_IXJUSER_H  #define __LINUX_IXJUSER_H diff --git a/include/uapi/linux/joystick.h b/include/uapi/linux/joystick.h index b856fd11c70e..64aabb84a66d 100644 --- a/include/uapi/linux/joystick.h +++ b/include/uapi/linux/joystick.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Copyright (C) 1996-2000 Vojtech Pavlik   * diff --git a/include/uapi/linux/kcm.h b/include/uapi/linux/kcm.h index a5a530940b99..01361ea359c4 100644 --- a/include/uapi/linux/kcm.h +++ b/include/uapi/linux/kcm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Kernel Connection Multiplexor   * diff --git a/include/uapi/linux/kcmp.h b/include/uapi/linux/kcmp.h index 481e103da78e..ef1305010925 100644 --- a/include/uapi/linux/kcmp.h +++ b/include/uapi/linux/kcmp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_KCMP_H  #define _UAPI_LINUX_KCMP_H diff --git a/include/uapi/linux/kcov.h b/include/uapi/linux/kcov.h index 574e22ec640d..9529867717a8 100644 --- a/include/uapi/linux/kcov.h +++ b/include/uapi/linux/kcov.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_KCOV_IOCTLS_H  #define _LINUX_KCOV_IOCTLS_H @@ -7,4 +8,28 @@  #define KCOV_ENABLE			_IO('c', 100)  #define KCOV_DISABLE			_IO('c', 101) +enum { +	/* +	 * Tracing coverage collection mode. +	 * Covered PCs are collected in a per-task buffer. +	 * In new KCOV version the mode is chosen by calling +	 * ioctl(fd, KCOV_ENABLE, mode). In older versions the mode argument +	 * was supposed to be 0 in such a call. So, for reasons of backward +	 * compatibility, we have chosen the value KCOV_TRACE_PC to be 0. +	 */ +	KCOV_TRACE_PC = 0, +	/* Collecting comparison operands mode. */ +	KCOV_TRACE_CMP = 1, +}; + +/* + * The format for the types of collected comparisons. + * + * Bit 0 shows whether one of the arguments is a compile-time constant. + * Bits 1 & 2 contain log2 of the argument size, up to 8 bytes. + */ +#define KCOV_CMP_CONST          (1 << 0) +#define KCOV_CMP_SIZE(n)        ((n) << 1) +#define KCOV_CMP_MASK           KCOV_CMP_SIZE(3) +  #endif /* _LINUX_KCOV_IOCTLS_H */ diff --git a/include/uapi/linux/kd.h b/include/uapi/linux/kd.h index 87b7cc439d7c..4616b31f84da 100644 --- a/include/uapi/linux/kd.h +++ b/include/uapi/linux/kd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_KD_H  #define _UAPI_LINUX_KD_H  #include <linux/types.h> diff --git a/include/uapi/linux/kdev_t.h b/include/uapi/linux/kdev_t.h index 0d881fa7eb9c..e1990f2e9777 100644 --- a/include/uapi/linux/kdev_t.h +++ b/include/uapi/linux/kdev_t.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_KDEV_T_H  #define _UAPI_LINUX_KDEV_T_H  #ifndef __KERNEL__ diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h index 5da5f8751ce7..fa139841ec18 100644 --- a/include/uapi/linux/kernel-page-flags.h +++ b/include/uapi/linux/kernel-page-flags.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPILINUX_KERNEL_PAGE_FLAGS_H  #define _UAPILINUX_KERNEL_PAGE_FLAGS_H diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h index 466073f0ce46..0ff8f7477847 100644 --- a/include/uapi/linux/kernel.h +++ b/include/uapi/linux/kernel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_KERNEL_H  #define _UAPI_LINUX_KERNEL_H diff --git a/include/uapi/linux/kernelcapi.h b/include/uapi/linux/kernelcapi.h index 89bf40d36d2a..325a856e0e20 100644 --- a/include/uapi/linux/kernelcapi.h +++ b/include/uapi/linux/kernelcapi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $   *  diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h index aae5ebf2022b..6d112868272d 100644 --- a/include/uapi/linux/kexec.h +++ b/include/uapi/linux/kexec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPILINUX_KEXEC_H  #define _UAPILINUX_KEXEC_H diff --git a/include/uapi/linux/keyboard.h b/include/uapi/linux/keyboard.h index 5a6849721ab6..ab4108c83186 100644 --- a/include/uapi/linux/keyboard.h +++ b/include/uapi/linux/keyboard.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_KEYBOARD_H  #define _UAPI__LINUX_KEYBOARD_H diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h index ef16df06642a..7b8c9e19bad1 100644 --- a/include/uapi/linux/keyctl.h +++ b/include/uapi/linux/keyctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /* keyctl.h: keyctl command IDs   *   * Copyright (C) 2004, 2008 Red Hat, Inc. All Rights Reserved. diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h index 26283fefdf5f..731d0df722e3 100644 --- a/include/uapi/linux/kfd_ioctl.h +++ b/include/uapi/linux/kfd_ioctl.h @@ -169,7 +169,7 @@ struct kfd_ioctl_dbg_wave_control_args {  #define KFD_IOC_WAIT_RESULT_TIMEOUT		1  #define KFD_IOC_WAIT_RESULT_FAIL		2 -#define KFD_SIGNAL_EVENT_LIMIT			256 +#define KFD_SIGNAL_EVENT_LIMIT			4096  struct kfd_ioctl_create_event_args {  	__u64 event_page_offset;	/* from KFD */ diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 838887587411..282d7613fce8 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_KVM_H  #define __LINUX_KVM_H @@ -930,6 +931,7 @@ struct kvm_ppc_resize_hpt {  #define KVM_CAP_PPC_SMT_POSSIBLE 147  #define KVM_CAP_HYPERV_SYNIC2 148  #define KVM_CAP_HYPERV_VP_INDEX 149 +#define KVM_CAP_S390_AIS_MIGRATION 150  #ifdef KVM_CAP_IRQ_ROUTING diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h index fed506aeff62..dcf629dd2889 100644 --- a/include/uapi/linux/kvm_para.h +++ b/include/uapi/linux/kvm_para.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_KVM_PARA_H  #define _UAPI__LINUX_KVM_PARA_H diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h index b23c1914a182..d84ce5c1c9aa 100644 --- a/include/uapi/linux/l2tp.h +++ b/include/uapi/linux/l2tp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * L2TP-over-IP socket for L2TPv3.   * diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h index 44b8a6bd5fe1..282875cf8056 100644 --- a/include/uapi/linux/libc-compat.h +++ b/include/uapi/linux/libc-compat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Compatibility interface for userspace libc header coordination:   * diff --git a/include/uapi/linux/lightnvm.h b/include/uapi/linux/lightnvm.h index c8aec4b9e73b..42d1a434af29 100644 --- a/include/uapi/linux/lightnvm.h +++ b/include/uapi/linux/lightnvm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2015 CNEX Labs.  All rights reserved.   * diff --git a/include/uapi/linux/limits.h b/include/uapi/linux/limits.h index 2d0f94162fb3..c3547f07605c 100644 --- a/include/uapi/linux/limits.h +++ b/include/uapi/linux/limits.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_LIMITS_H  #define _LINUX_LIMITS_H diff --git a/include/uapi/linux/lirc.h b/include/uapi/linux/lirc.h index 991ab4570b8e..c3aef4316fbf 100644 --- a/include/uapi/linux/lirc.h +++ b/include/uapi/linux/lirc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * lirc.h - linux infrared remote control header file   * last modified 2010/07/13 by Jarod Wilson diff --git a/include/uapi/linux/llc.h b/include/uapi/linux/llc.h index a6c17f66ee94..cf8806b14d5f 100644 --- a/include/uapi/linux/llc.h +++ b/include/uapi/linux/llc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /*   * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators.   * diff --git a/include/uapi/linux/loop.h b/include/uapi/linux/loop.h index 23158dbe2424..080a8df134ef 100644 --- a/include/uapi/linux/loop.h +++ b/include/uapi/linux/loop.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /*   * include/linux/loop.h   * diff --git a/include/uapi/linux/lp.h b/include/uapi/linux/lp.h index a3406a51f196..dafcfe4e4834 100644 --- a/include/uapi/linux/lp.h +++ b/include/uapi/linux/lp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * usr/include/linux/lp.h c.1991-1992 James Wiegand   * many modifications copyright (C) 1992 Michael K. Johnson diff --git a/include/uapi/linux/lwtunnel.h b/include/uapi/linux/lwtunnel.h index 7fdd19ca7511..de696ca12f2c 100644 --- a/include/uapi/linux/lwtunnel.h +++ b/include/uapi/linux/lwtunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LWTUNNEL_H_  #define _UAPI_LWTUNNEL_H_ diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h index e439565df838..1a6fee974116 100644 --- a/include/uapi/linux/magic.h +++ b/include/uapi/linux/magic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_MAGIC_H__  #define __LINUX_MAGIC_H__ @@ -46,6 +47,7 @@  #define OPENPROM_SUPER_MAGIC	0x9fa1  #define QNX4_SUPER_MAGIC	0x002f		/* qnx4 fs detection */  #define QNX6_SUPER_MAGIC	0x68191122	/* qnx6 fs detection */ +#define AFS_FS_MAGIC		0x6B414653  #define REISERFS_SUPER_MAGIC	0x52654973	/* used by gcc */  					/* used by file system utilities that diff --git a/include/uapi/linux/major.h b/include/uapi/linux/major.h index 19e195bee990..7e5fa8e15c43 100644 --- a/include/uapi/linux/major.h +++ b/include/uapi/linux/major.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_MAJOR_H  #define _LINUX_MAJOR_H diff --git a/include/uapi/linux/map_to_7segment.h b/include/uapi/linux/map_to_7segment.h index 12d62a54d470..f9ed18134b83 100644 --- a/include/uapi/linux/map_to_7segment.h +++ b/include/uapi/linux/map_to_7segment.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com>   * diff --git a/include/uapi/linux/matroxfb.h b/include/uapi/linux/matroxfb.h index 8c22a8938642..23e025b7e362 100644 --- a/include/uapi/linux/matroxfb.h +++ b/include/uapi/linux/matroxfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_MATROXFB_H__  #define __LINUX_MATROXFB_H__ diff --git a/include/uapi/linux/max2175.h b/include/uapi/linux/max2175.h index 3ef5d264440f..daedc4eb9b6b 100644 --- a/include/uapi/linux/max2175.h +++ b/include/uapi/linux/max2175.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * max2175.h   * diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h index c94a510a577e..d435b00d64ad 100644 --- a/include/uapi/linux/mdio.h +++ b/include/uapi/linux/mdio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * linux/mdio.h: definitions for MDIO (clause 45) transceivers   * Copyright 2006-2009 Solarflare Communications Inc. diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h index ef6fb307d2ce..9e3511742fdc 100644 --- a/include/uapi/linux/media-bus-format.h +++ b/include/uapi/linux/media-bus-format.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Media Bus API header   * diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 4865f1e71339..b9b9446095e9 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Multimedia device API   * diff --git a/include/uapi/linux/mei.h b/include/uapi/linux/mei.h index 7c3b64f6a215..0f681cbd38d3 100644 --- a/include/uapi/linux/mei.h +++ b/include/uapi/linux/mei.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /******************************************************************************   * Intel Management Engine Interface (Intel MEI) Linux driver   * Intel MEI Interface Header diff --git a/include/uapi/linux/membarrier.h b/include/uapi/linux/membarrier.h index 6d47b3249d8a..4e01ad7ffe98 100644 --- a/include/uapi/linux/membarrier.h +++ b/include/uapi/linux/membarrier.h @@ -52,21 +52,30 @@   *                          (non-running threads are de facto in such a   *                          state). This only covers threads from the   *                          same processes as the caller thread. This - *                          command returns 0. The "expedited" commands - *                          complete faster than the non-expedited ones, - *                          they never block, but have the downside of - *                          causing extra overhead. + *                          command returns 0 on success. The + *                          "expedited" commands complete faster than + *                          the non-expedited ones, they never block, + *                          but have the downside of causing extra + *                          overhead. A process needs to register its + *                          intent to use the private expedited command + *                          prior to using it, otherwise this command + *                          returns -EPERM. + * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED: + *                          Register the process intent to use + *                          MEMBARRIER_CMD_PRIVATE_EXPEDITED. Always + *                          returns 0.   *   * Command to be passed to the membarrier system call. The commands need to   * be a single bit each, except for MEMBARRIER_CMD_QUERY which is assigned to   * the value 0.   */  enum membarrier_cmd { -	MEMBARRIER_CMD_QUERY			= 0, -	MEMBARRIER_CMD_SHARED			= (1 << 0), +	MEMBARRIER_CMD_QUERY				= 0, +	MEMBARRIER_CMD_SHARED				= (1 << 0),  	/* reserved for MEMBARRIER_CMD_SHARED_EXPEDITED (1 << 1) */  	/* reserved for MEMBARRIER_CMD_PRIVATE (1 << 2) */ -	MEMBARRIER_CMD_PRIVATE_EXPEDITED	= (1 << 3), +	MEMBARRIER_CMD_PRIVATE_EXPEDITED		= (1 << 3), +	MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED	= (1 << 4),  };  #endif /* _UAPI_LINUX_MEMBARRIER_H */ diff --git a/include/uapi/linux/memfd.h b/include/uapi/linux/memfd.h index 7f3a722dbd72..015a4c0bbb47 100644 --- a/include/uapi/linux/memfd.h +++ b/include/uapi/linux/memfd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_MEMFD_H  #define _UAPI_LINUX_MEMFD_H diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h index 2a4d89508fec..3354774af61e 100644 --- a/include/uapi/linux/mempolicy.h +++ b/include/uapi/linux/mempolicy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * NUMA memory policies for Linux.   * Copyright 2003,2004 Andi Kleen SuSE Labs diff --git a/include/uapi/linux/meye.h b/include/uapi/linux/meye.h index 8ff50fe9e481..de9e3a954f3d 100644 --- a/include/uapi/linux/meye.h +++ b/include/uapi/linux/meye.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Motion Eye video4linux driver for Sony Vaio PictureBook   * diff --git a/include/uapi/linux/mic_common.h b/include/uapi/linux/mic_common.h index e9686372029d..504e523f702c 100644 --- a/include/uapi/linux/mic_common.h +++ b/include/uapi/linux/mic_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Intel MIC Platform Software Stack (MPSS)   * diff --git a/include/uapi/linux/mic_ioctl.h b/include/uapi/linux/mic_ioctl.h index feb0b4c0814c..687b9cd9d3e2 100644 --- a/include/uapi/linux/mic_ioctl.h +++ b/include/uapi/linux/mic_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Intel MIC Platform Software Stack (MPSS)   * diff --git a/include/uapi/linux/mii.h b/include/uapi/linux/mii.h index 15d8510cdae0..b5c2fdcf23fd 100644 --- a/include/uapi/linux/mii.h +++ b/include/uapi/linux/mii.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * linux/mii.h: definitions for MII-compatible transceivers   * Originally drivers/net/sunhme.h. diff --git a/include/uapi/linux/minix_fs.h b/include/uapi/linux/minix_fs.h index 13fe09e0576a..95dbcb17eacd 100644 --- a/include/uapi/linux/minix_fs.h +++ b/include/uapi/linux/minix_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_MINIX_FS_H  #define _LINUX_MINIX_FS_H diff --git a/include/uapi/linux/mman.h b/include/uapi/linux/mman.h index a937480d7cd3..bfd5938fede6 100644 --- a/include/uapi/linux/mman.h +++ b/include/uapi/linux/mman.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_MMAN_H  #define _UAPI_LINUX_MMAN_H diff --git a/include/uapi/linux/mmc/ioctl.h b/include/uapi/linux/mmc/ioctl.h index 700a55156eee..45f369dc0a42 100644 --- a/include/uapi/linux/mmc/ioctl.h +++ b/include/uapi/linux/mmc/ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef LINUX_MMC_IOCTL_H  #define LINUX_MMC_IOCTL_H diff --git a/include/uapi/linux/mmtimer.h b/include/uapi/linux/mmtimer.h index 884cabf16088..409fae1de383 100644 --- a/include/uapi/linux/mmtimer.h +++ b/include/uapi/linux/mmtimer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Intel Multimedia Timer device interface   * diff --git a/include/uapi/linux/module.h b/include/uapi/linux/module.h index 38da4258b12f..50d98ec5e866 100644 --- a/include/uapi/linux/module.h +++ b/include/uapi/linux/module.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_MODULE_H  #define _UAPI_LINUX_MODULE_H diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h index 77a19dfe3990..1ef5d6002a4a 100644 --- a/include/uapi/linux/mpls.h +++ b/include/uapi/linux/mpls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_MPLS_H  #define _UAPI_MPLS_H diff --git a/include/uapi/linux/mpls_iptunnel.h b/include/uapi/linux/mpls_iptunnel.h index f5e45095b0bb..521f2e605f13 100644 --- a/include/uapi/linux/mpls_iptunnel.h +++ b/include/uapi/linux/mpls_iptunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *	mpls tunnel api   * diff --git a/include/uapi/linux/mqueue.h b/include/uapi/linux/mqueue.h index bbd5116ea739..b516b66840ad 100644 --- a/include/uapi/linux/mqueue.h +++ b/include/uapi/linux/mqueue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /* Copyright (C) 2003 Krzysztof Benedyczak & Michal Wronski     This program is free software; you can redistribute it and/or diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h index e8e5041dea8e..10f9ff9426a2 100644 --- a/include/uapi/linux/mroute.h +++ b/include/uapi/linux/mroute.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_MROUTE_H  #define _UAPI__LINUX_MROUTE_H diff --git a/include/uapi/linux/mroute6.h b/include/uapi/linux/mroute6.h index e4746816c855..9999cc006390 100644 --- a/include/uapi/linux/mroute6.h +++ b/include/uapi/linux/mroute6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_MROUTE6_H  #define _UAPI__LINUX_MROUTE6_H diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h index e956704f5fb1..a45d0754102e 100644 --- a/include/uapi/linux/msdos_fs.h +++ b/include/uapi/linux/msdos_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_MSDOS_FS_H  #define _UAPI_LINUX_MSDOS_FS_H diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h index f51c8001dbe5..5d5ab81dc9be 100644 --- a/include/uapi/linux/msg.h +++ b/include/uapi/linux/msg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_MSG_H  #define _UAPI_LINUX_MSG_H diff --git a/include/uapi/linux/mtio.h b/include/uapi/linux/mtio.h index 18543e2db06f..a1191fecc592 100644 --- a/include/uapi/linux/mtio.h +++ b/include/uapi/linux/mtio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*    * linux/mtio.h header file for Linux. Written by H. Bergman   * diff --git a/include/uapi/linux/n_r3964.h b/include/uapi/linux/n_r3964.h index 81337cbf40b7..6bbd18520f30 100644 --- a/include/uapi/linux/n_r3964.h +++ b/include/uapi/linux/n_r3964.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /* r3964 linediscipline for linux   *   * ----------------------------------------------------------- diff --git a/include/uapi/linux/nbd-netlink.h b/include/uapi/linux/nbd-netlink.h index 6f7ca3d63a65..c5d0ef7aa7d5 100644 --- a/include/uapi/linux/nbd-netlink.h +++ b/include/uapi/linux/nbd-netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2017 Facebook.  All rights reserved.   * diff --git a/include/uapi/linux/nbd.h b/include/uapi/linux/nbd.h index a50527ebf671..85a3fb65e40a 100644 --- a/include/uapi/linux/nbd.h +++ b/include/uapi/linux/nbd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /*   * 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL.   * 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne) diff --git a/include/uapi/linux/ncp.h b/include/uapi/linux/ncp.h index 99f0adeeb3f3..ca6f3d42c88f 100644 --- a/include/uapi/linux/ncp.h +++ b/include/uapi/linux/ncp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  ncp.h   * diff --git a/include/uapi/linux/ncp_fs.h b/include/uapi/linux/ncp_fs.h index e13eefef0653..e76a44229d2f 100644 --- a/include/uapi/linux/ncp_fs.h +++ b/include/uapi/linux/ncp_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  ncp_fs.h   * diff --git a/include/uapi/linux/ncp_mount.h b/include/uapi/linux/ncp_mount.h index dfcbea2d889f..9bdbcd68c329 100644 --- a/include/uapi/linux/ncp_mount.h +++ b/include/uapi/linux/ncp_mount.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  ncp_mount.h   * diff --git a/include/uapi/linux/ncp_no.h b/include/uapi/linux/ncp_no.h index cddaa48fb182..654d7c7f5d92 100644 --- a/include/uapi/linux/ncp_no.h +++ b/include/uapi/linux/ncp_no.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NCP_NO  #define _NCP_NO diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h index 3199d28980b3..904db6148476 100644 --- a/include/uapi/linux/neighbour.h +++ b/include/uapi/linux/neighbour.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_NEIGHBOUR_H  #define __LINUX_NEIGHBOUR_H diff --git a/include/uapi/linux/net.h b/include/uapi/linux/net.h index 9457239ed219..4dabec6bd957 100644 --- a/include/uapi/linux/net.h +++ b/include/uapi/linux/net.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * NET		An implementation of the SOCKET network access protocol.   *		This is the master header file for the Linux NET layer, diff --git a/include/uapi/linux/net_dropmon.h b/include/uapi/linux/net_dropmon.h index 2a739462caeb..5edbd0a675fd 100644 --- a/include/uapi/linux/net_dropmon.h +++ b/include/uapi/linux/net_dropmon.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __NET_DROPMON_H  #define __NET_DROPMON_H diff --git a/include/uapi/linux/net_namespace.h b/include/uapi/linux/net_namespace.h index 778cd2c3ebf4..0187c74d8889 100644 --- a/include/uapi/linux/net_namespace.h +++ b/include/uapi/linux/net_namespace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* Copyright (c) 2015 6WIND S.A.   * Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>   * diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h index 3d421d912193..4fe104b2411f 100644 --- a/include/uapi/linux/net_tstamp.h +++ b/include/uapi/linux/net_tstamp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Userspace API for hardware time stamping of network packets   * diff --git a/include/uapi/linux/netconf.h b/include/uapi/linux/netconf.h index 7e5f0f3e31bf..c84fcdfca862 100644 --- a/include/uapi/linux/netconf.h +++ b/include/uapi/linux/netconf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_NETCONF_H_  #define _UAPI_LINUX_NETCONF_H_ diff --git a/include/uapi/linux/netdevice.h b/include/uapi/linux/netdevice.h index 55818543342d..f3770c5b0fac 100644 --- a/include/uapi/linux/netdevice.h +++ b/include/uapi/linux/netdevice.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/netfilter.h b/include/uapi/linux/netfilter.h index c111a91adcc0..cca10e767cd8 100644 --- a/include/uapi/linux/netfilter.h +++ b/include/uapi/linux/netfilter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_NETFILTER_H  #define _UAPI__LINUX_NETFILTER_H diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h index ebb5154976de..60236f694143 100644 --- a/include/uapi/linux/netfilter/ipset/ip_set.h +++ b/include/uapi/linux/netfilter/ipset/ip_set.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>   *                         Patrick Schaaf <bof@bof.de>   *                         Martin Josefsson <gandalf@wlug.westbo.se> diff --git a/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h b/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h index fd5024d26269..c6b146db9693 100644 --- a/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h +++ b/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__IP_SET_BITMAP_H  #define _UAPI__IP_SET_BITMAP_H diff --git a/include/uapi/linux/netfilter/ipset/ip_set_hash.h b/include/uapi/linux/netfilter/ipset/ip_set_hash.h index 82deeb883ac4..880749ace798 100644 --- a/include/uapi/linux/netfilter/ipset/ip_set_hash.h +++ b/include/uapi/linux/netfilter/ipset/ip_set_hash.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__IP_SET_HASH_H  #define _UAPI__IP_SET_HASH_H diff --git a/include/uapi/linux/netfilter/ipset/ip_set_list.h b/include/uapi/linux/netfilter/ipset/ip_set_list.h index 84d430368266..e6d7feb522cd 100644 --- a/include/uapi/linux/netfilter/ipset/ip_set_list.h +++ b/include/uapi/linux/netfilter/ipset/ip_set_list.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__IP_SET_LIST_H  #define _UAPI__IP_SET_LIST_H diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h index dc947e59d03a..3fea7709a441 100644 --- a/include/uapi/linux/netfilter/nf_conntrack_common.h +++ b/include/uapi/linux/netfilter/nf_conntrack_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_NF_CONNTRACK_COMMON_H  #define _UAPI_NF_CONNTRACK_COMMON_H  /* Connection state tracking for netfilter.  This is separated from, diff --git a/include/uapi/linux/netfilter/nf_conntrack_ftp.h b/include/uapi/linux/netfilter/nf_conntrack_ftp.h index 1030315a41b5..8eb6b9ef2071 100644 --- a/include/uapi/linux/netfilter/nf_conntrack_ftp.h +++ b/include/uapi/linux/netfilter/nf_conntrack_ftp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_NF_CONNTRACK_FTP_H  #define _UAPI_NF_CONNTRACK_FTP_H  /* FTP tracking. */ diff --git a/include/uapi/linux/netfilter/nf_conntrack_sctp.h b/include/uapi/linux/netfilter/nf_conntrack_sctp.h index 2cbc366c3fb4..edc6ddab0de6 100644 --- a/include/uapi/linux/netfilter/nf_conntrack_sctp.h +++ b/include/uapi/linux/netfilter/nf_conntrack_sctp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_NF_CONNTRACK_SCTP_H  #define _UAPI_NF_CONNTRACK_SCTP_H  /* SCTP tracking. */ diff --git a/include/uapi/linux/netfilter/nf_conntrack_tcp.h b/include/uapi/linux/netfilter/nf_conntrack_tcp.h index ef9f80f0f529..74b91151d494 100644 --- a/include/uapi/linux/netfilter/nf_conntrack_tcp.h +++ b/include/uapi/linux/netfilter/nf_conntrack_tcp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_NF_CONNTRACK_TCP_H  #define _UAPI_NF_CONNTRACK_TCP_H  /* TCP tracking. */ diff --git a/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h b/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h index 526b42496b78..64390fac6f7e 100644 --- a/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h +++ b/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NF_CONNTRACK_TUPLE_COMMON_H  #define _NF_CONNTRACK_TUPLE_COMMON_H diff --git a/include/uapi/linux/netfilter/nf_log.h b/include/uapi/linux/netfilter/nf_log.h index d0b5fa91ff54..2ae00932d3d2 100644 --- a/include/uapi/linux/netfilter/nf_log.h +++ b/include/uapi/linux/netfilter/nf_log.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NETFILTER_NF_LOG_H  #define _NETFILTER_NF_LOG_H diff --git a/include/uapi/linux/netfilter/nf_nat.h b/include/uapi/linux/netfilter/nf_nat.h index 0880781ad7b6..a33000da7229 100644 --- a/include/uapi/linux/netfilter/nf_nat.h +++ b/include/uapi/linux/netfilter/nf_nat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NETFILTER_NF_NAT_H  #define _NETFILTER_NF_NAT_H diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h index 871afa4871bf..a3ee277b17a1 100644 --- a/include/uapi/linux/netfilter/nf_tables.h +++ b/include/uapi/linux/netfilter/nf_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_NF_TABLES_H  #define _LINUX_NF_TABLES_H diff --git a/include/uapi/linux/netfilter/nf_tables_compat.h b/include/uapi/linux/netfilter/nf_tables_compat.h index 8310f5f76551..0e2b9fcb71b7 100644 --- a/include/uapi/linux/netfilter/nf_tables_compat.h +++ b/include/uapi/linux/netfilter/nf_tables_compat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NFT_COMPAT_NFNETLINK_H_  #define _NFT_COMPAT_NFNETLINK_H_ diff --git a/include/uapi/linux/netfilter/nfnetlink.h b/include/uapi/linux/netfilter/nfnetlink.h index a09906a30d77..5bc960f220b3 100644 --- a/include/uapi/linux/netfilter/nfnetlink.h +++ b/include/uapi/linux/netfilter/nfnetlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_NFNETLINK_H  #define _UAPI_NFNETLINK_H  #include <linux/types.h> diff --git a/include/uapi/linux/netfilter/nfnetlink_acct.h b/include/uapi/linux/netfilter/nfnetlink_acct.h index 36047ec70f37..7cb66d3218fc 100644 --- a/include/uapi/linux/netfilter/nfnetlink_acct.h +++ b/include/uapi/linux/netfilter/nfnetlink_acct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_NFNL_ACCT_H_  #define _UAPI_NFNL_ACCT_H_ diff --git a/include/uapi/linux/netfilter/nfnetlink_compat.h b/include/uapi/linux/netfilter/nfnetlink_compat.h index ffb95036bbd4..93bcdccef81d 100644 --- a/include/uapi/linux/netfilter/nfnetlink_compat.h +++ b/include/uapi/linux/netfilter/nfnetlink_compat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NFNETLINK_COMPAT_H  #define _NFNETLINK_COMPAT_H diff --git a/include/uapi/linux/netfilter/nfnetlink_conntrack.h b/include/uapi/linux/netfilter/nfnetlink_conntrack.h index 6deb8867c5fc..7397e022ce6e 100644 --- a/include/uapi/linux/netfilter/nfnetlink_conntrack.h +++ b/include/uapi/linux/netfilter/nfnetlink_conntrack.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IPCONNTRACK_NETLINK_H  #define _IPCONNTRACK_NETLINK_H  #include <linux/netfilter/nfnetlink.h> diff --git a/include/uapi/linux/netfilter/nfnetlink_cthelper.h b/include/uapi/linux/netfilter/nfnetlink_cthelper.h index 33659f6fad3e..a13137afc429 100644 --- a/include/uapi/linux/netfilter/nfnetlink_cthelper.h +++ b/include/uapi/linux/netfilter/nfnetlink_cthelper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NFNL_CTHELPER_H_  #define _NFNL_CTHELPER_H_ diff --git a/include/uapi/linux/netfilter/nfnetlink_cttimeout.h b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h index f2c10dc140d6..6b20fb22717b 100644 --- a/include/uapi/linux/netfilter/nfnetlink_cttimeout.h +++ b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _CTTIMEOUT_NETLINK_H  #define _CTTIMEOUT_NETLINK_H  #include <linux/netfilter/nfnetlink.h> diff --git a/include/uapi/linux/netfilter/nfnetlink_log.h b/include/uapi/linux/netfilter/nfnetlink_log.h index fb21f0c717a1..20983cb195a0 100644 --- a/include/uapi/linux/netfilter/nfnetlink_log.h +++ b/include/uapi/linux/netfilter/nfnetlink_log.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NFNETLINK_LOG_H  #define _NFNETLINK_LOG_H diff --git a/include/uapi/linux/netfilter/nfnetlink_queue.h b/include/uapi/linux/netfilter/nfnetlink_queue.h index d42f0396fe30..bcb2cb5d40b9 100644 --- a/include/uapi/linux/netfilter/nfnetlink_queue.h +++ b/include/uapi/linux/netfilter/nfnetlink_queue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _NFNETLINK_QUEUE_H  #define _NFNETLINK_QUEUE_H diff --git a/include/uapi/linux/netfilter/x_tables.h b/include/uapi/linux/netfilter/x_tables.h index c36969b91533..a8283f7dbc51 100644 --- a/include/uapi/linux/netfilter/x_tables.h +++ b/include/uapi/linux/netfilter/x_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_X_TABLES_H  #define _UAPI_X_TABLES_H  #include <linux/kernel.h> diff --git a/include/uapi/linux/netfilter/xt_AUDIT.h b/include/uapi/linux/netfilter/xt_AUDIT.h index 38751d2ea52b..1b314e2f84ac 100644 --- a/include/uapi/linux/netfilter/xt_AUDIT.h +++ b/include/uapi/linux/netfilter/xt_AUDIT.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Header file for iptables xt_AUDIT target   * diff --git a/include/uapi/linux/netfilter/xt_CHECKSUM.h b/include/uapi/linux/netfilter/xt_CHECKSUM.h index 9a2e4661654e..c578088e61b9 100644 --- a/include/uapi/linux/netfilter/xt_CHECKSUM.h +++ b/include/uapi/linux/netfilter/xt_CHECKSUM.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* Header file for iptables ipt_CHECKSUM target   *   * (C) 2002 by Harald Welte <laforge@gnumonks.org> diff --git a/include/uapi/linux/netfilter/xt_CLASSIFY.h b/include/uapi/linux/netfilter/xt_CLASSIFY.h index a813bf14dd63..fe059a98c1d3 100644 --- a/include/uapi/linux/netfilter/xt_CLASSIFY.h +++ b/include/uapi/linux/netfilter/xt_CLASSIFY.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_CLASSIFY_H  #define _XT_CLASSIFY_H diff --git a/include/uapi/linux/netfilter/xt_CONNMARK.h b/include/uapi/linux/netfilter/xt_CONNMARK.h index 2f2e48ec8023..36cc956ead1a 100644 --- a/include/uapi/linux/netfilter/xt_CONNMARK.h +++ b/include/uapi/linux/netfilter/xt_CONNMARK.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_CONNMARK_H_target  #define _XT_CONNMARK_H_target diff --git a/include/uapi/linux/netfilter/xt_CONNSECMARK.h b/include/uapi/linux/netfilter/xt_CONNSECMARK.h index b973ff80fa1e..ca078bb3c584 100644 --- a/include/uapi/linux/netfilter/xt_CONNSECMARK.h +++ b/include/uapi/linux/netfilter/xt_CONNSECMARK.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_CONNSECMARK_H_target  #define _XT_CONNSECMARK_H_target diff --git a/include/uapi/linux/netfilter/xt_CT.h b/include/uapi/linux/netfilter/xt_CT.h index 9e520418b858..868fa08e1fbb 100644 --- a/include/uapi/linux/netfilter/xt_CT.h +++ b/include/uapi/linux/netfilter/xt_CT.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_CT_H  #define _XT_CT_H diff --git a/include/uapi/linux/netfilter/xt_DSCP.h b/include/uapi/linux/netfilter/xt_DSCP.h index 648e0b3bed29..223d635e8b6f 100644 --- a/include/uapi/linux/netfilter/xt_DSCP.h +++ b/include/uapi/linux/netfilter/xt_DSCP.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* x_tables module for setting the IPv4/IPv6 DSCP field   *   * (C) 2002 Harald Welte <laforge@gnumonks.org> diff --git a/include/uapi/linux/netfilter/xt_HMARK.h b/include/uapi/linux/netfilter/xt_HMARK.h index 3fb48c8d8d78..2d4b751a7115 100644 --- a/include/uapi/linux/netfilter/xt_HMARK.h +++ b/include/uapi/linux/netfilter/xt_HMARK.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef XT_HMARK_H_  #define XT_HMARK_H_ diff --git a/include/uapi/linux/netfilter/xt_IDLETIMER.h b/include/uapi/linux/netfilter/xt_IDLETIMER.h index 208ae9387331..3c586a19baea 100644 --- a/include/uapi/linux/netfilter/xt_IDLETIMER.h +++ b/include/uapi/linux/netfilter/xt_IDLETIMER.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * linux/include/linux/netfilter/xt_IDLETIMER.h   * diff --git a/include/uapi/linux/netfilter/xt_LED.h b/include/uapi/linux/netfilter/xt_LED.h index f5509e7524d3..4fe0f1395807 100644 --- a/include/uapi/linux/netfilter/xt_LED.h +++ b/include/uapi/linux/netfilter/xt_LED.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_LED_H  #define _XT_LED_H diff --git a/include/uapi/linux/netfilter/xt_LOG.h b/include/uapi/linux/netfilter/xt_LOG.h index cac079095305..167d4ddd2476 100644 --- a/include/uapi/linux/netfilter/xt_LOG.h +++ b/include/uapi/linux/netfilter/xt_LOG.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_LOG_H  #define _XT_LOG_H diff --git a/include/uapi/linux/netfilter/xt_MARK.h b/include/uapi/linux/netfilter/xt_MARK.h index 41c456deba22..f1fe2b4be933 100644 --- a/include/uapi/linux/netfilter/xt_MARK.h +++ b/include/uapi/linux/netfilter/xt_MARK.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_MARK_H_target  #define _XT_MARK_H_target diff --git a/include/uapi/linux/netfilter/xt_NFLOG.h b/include/uapi/linux/netfilter/xt_NFLOG.h index f33070730fc8..517809771909 100644 --- a/include/uapi/linux/netfilter/xt_NFLOG.h +++ b/include/uapi/linux/netfilter/xt_NFLOG.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_NFLOG_TARGET  #define _XT_NFLOG_TARGET diff --git a/include/uapi/linux/netfilter/xt_NFQUEUE.h b/include/uapi/linux/netfilter/xt_NFQUEUE.h index 8bb5fe657d34..bb767fd73ed1 100644 --- a/include/uapi/linux/netfilter/xt_NFQUEUE.h +++ b/include/uapi/linux/netfilter/xt_NFQUEUE.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* iptables module for using NFQUEUE mechanism   *   * (C) 2005 Harald Welte <laforge@netfilter.org> diff --git a/include/uapi/linux/netfilter/xt_RATEEST.h b/include/uapi/linux/netfilter/xt_RATEEST.h index ec1b57047e03..2b87a71e6266 100644 --- a/include/uapi/linux/netfilter/xt_RATEEST.h +++ b/include/uapi/linux/netfilter/xt_RATEEST.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_RATEEST_TARGET_H  #define _XT_RATEEST_TARGET_H diff --git a/include/uapi/linux/netfilter/xt_SECMARK.h b/include/uapi/linux/netfilter/xt_SECMARK.h index 989092bd6274..1f2a708413f5 100644 --- a/include/uapi/linux/netfilter/xt_SECMARK.h +++ b/include/uapi/linux/netfilter/xt_SECMARK.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_SECMARK_H_target  #define _XT_SECMARK_H_target diff --git a/include/uapi/linux/netfilter/xt_SYNPROXY.h b/include/uapi/linux/netfilter/xt_SYNPROXY.h index ca67e61d2a61..ea5eba15d4c1 100644 --- a/include/uapi/linux/netfilter/xt_SYNPROXY.h +++ b/include/uapi/linux/netfilter/xt_SYNPROXY.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_SYNPROXY_H  #define _XT_SYNPROXY_H diff --git a/include/uapi/linux/netfilter/xt_TCPMSS.h b/include/uapi/linux/netfilter/xt_TCPMSS.h index 9a6960afc134..65ea6c9dab4b 100644 --- a/include/uapi/linux/netfilter/xt_TCPMSS.h +++ b/include/uapi/linux/netfilter/xt_TCPMSS.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_TCPMSS_H  #define _XT_TCPMSS_H diff --git a/include/uapi/linux/netfilter/xt_TCPOPTSTRIP.h b/include/uapi/linux/netfilter/xt_TCPOPTSTRIP.h index 7157318499c2..6bd51cd6f8da 100644 --- a/include/uapi/linux/netfilter/xt_TCPOPTSTRIP.h +++ b/include/uapi/linux/netfilter/xt_TCPOPTSTRIP.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_TCPOPTSTRIP_H  #define _XT_TCPOPTSTRIP_H diff --git a/include/uapi/linux/netfilter/xt_TEE.h b/include/uapi/linux/netfilter/xt_TEE.h index 01092023404b..eb854917f828 100644 --- a/include/uapi/linux/netfilter/xt_TEE.h +++ b/include/uapi/linux/netfilter/xt_TEE.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_TEE_TARGET_H  #define _XT_TEE_TARGET_H diff --git a/include/uapi/linux/netfilter/xt_TPROXY.h b/include/uapi/linux/netfilter/xt_TPROXY.h index 8d693eefdc1f..348957b02a82 100644 --- a/include/uapi/linux/netfilter/xt_TPROXY.h +++ b/include/uapi/linux/netfilter/xt_TPROXY.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_TPROXY_H  #define _XT_TPROXY_H diff --git a/include/uapi/linux/netfilter/xt_addrtype.h b/include/uapi/linux/netfilter/xt_addrtype.h index b156baa9d55e..2102dff74c31 100644 --- a/include/uapi/linux/netfilter/xt_addrtype.h +++ b/include/uapi/linux/netfilter/xt_addrtype.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_ADDRTYPE_H  #define _XT_ADDRTYPE_H diff --git a/include/uapi/linux/netfilter/xt_bpf.h b/include/uapi/linux/netfilter/xt_bpf.h index b97725af2ac0..a05adda26d3e 100644 --- a/include/uapi/linux/netfilter/xt_bpf.h +++ b/include/uapi/linux/netfilter/xt_bpf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_BPF_H  #define _XT_BPF_H @@ -23,6 +24,7 @@ enum xt_bpf_modes {  	XT_BPF_MODE_FD_PINNED,  	XT_BPF_MODE_FD_ELF,  }; +#define XT_BPF_MODE_PATH_PINNED XT_BPF_MODE_FD_PINNED  struct xt_bpf_info_v1 {  	__u16 mode; diff --git a/include/uapi/linux/netfilter/xt_cgroup.h b/include/uapi/linux/netfilter/xt_cgroup.h index 1e4b37b93bef..e96dfa1b34f7 100644 --- a/include/uapi/linux/netfilter/xt_cgroup.h +++ b/include/uapi/linux/netfilter/xt_cgroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_XT_CGROUP_H  #define _UAPI_XT_CGROUP_H diff --git a/include/uapi/linux/netfilter/xt_cluster.h b/include/uapi/linux/netfilter/xt_cluster.h index 9b883c8fbf54..ed8e0561f99c 100644 --- a/include/uapi/linux/netfilter/xt_cluster.h +++ b/include/uapi/linux/netfilter/xt_cluster.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_CLUSTER_MATCH_H  #define _XT_CLUSTER_MATCH_H diff --git a/include/uapi/linux/netfilter/xt_comment.h b/include/uapi/linux/netfilter/xt_comment.h index 0ea5e79f5bd7..85d284082542 100644 --- a/include/uapi/linux/netfilter/xt_comment.h +++ b/include/uapi/linux/netfilter/xt_comment.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_COMMENT_H  #define _XT_COMMENT_H diff --git a/include/uapi/linux/netfilter/xt_connbytes.h b/include/uapi/linux/netfilter/xt_connbytes.h index f1d6c15bd9e3..0bae507db23e 100644 --- a/include/uapi/linux/netfilter/xt_connbytes.h +++ b/include/uapi/linux/netfilter/xt_connbytes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_CONNBYTES_H  #define _XT_CONNBYTES_H diff --git a/include/uapi/linux/netfilter/xt_connlabel.h b/include/uapi/linux/netfilter/xt_connlabel.h index c4bc9ee9b330..2312f0ec07b2 100644 --- a/include/uapi/linux/netfilter/xt_connlabel.h +++ b/include/uapi/linux/netfilter/xt_connlabel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #include <linux/types.h>  #define XT_CONNLABEL_MAXBIT 127 diff --git a/include/uapi/linux/netfilter/xt_connlimit.h b/include/uapi/linux/netfilter/xt_connlimit.h index f1656096121e..07e5e9d47882 100644 --- a/include/uapi/linux/netfilter/xt_connlimit.h +++ b/include/uapi/linux/netfilter/xt_connlimit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_CONNLIMIT_H  #define _XT_CONNLIMIT_H diff --git a/include/uapi/linux/netfilter/xt_connmark.h b/include/uapi/linux/netfilter/xt_connmark.h index efc17a8305fb..408a9654f05c 100644 --- a/include/uapi/linux/netfilter/xt_connmark.h +++ b/include/uapi/linux/netfilter/xt_connmark.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  #ifndef _XT_CONNMARK_H  #define _XT_CONNMARK_H diff --git a/include/uapi/linux/netfilter/xt_conntrack.h b/include/uapi/linux/netfilter/xt_conntrack.h index e5bd3083a843..cdd14a83d29d 100644 --- a/include/uapi/linux/netfilter/xt_conntrack.h +++ b/include/uapi/linux/netfilter/xt_conntrack.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /* Header file for kernel module to match connection tracking information.   * GPL (C) 2001  Marc Boucher (marc@mbsi.ca).   */ diff --git a/include/uapi/linux/netfilter/xt_cpu.h b/include/uapi/linux/netfilter/xt_cpu.h index 93c7f11d8f42..b442e1f6f598 100644 --- a/include/uapi/linux/netfilter/xt_cpu.h +++ b/include/uapi/linux/netfilter/xt_cpu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_CPU_H  #define _XT_CPU_H diff --git a/include/uapi/linux/netfilter/xt_dccp.h b/include/uapi/linux/netfilter/xt_dccp.h index a579e1b6f040..564e61c5703f 100644 --- a/include/uapi/linux/netfilter/xt_dccp.h +++ b/include/uapi/linux/netfilter/xt_dccp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_DCCP_H_  #define _XT_DCCP_H_ diff --git a/include/uapi/linux/netfilter/xt_devgroup.h b/include/uapi/linux/netfilter/xt_devgroup.h index 1babde0ec900..79ed351a4525 100644 --- a/include/uapi/linux/netfilter/xt_devgroup.h +++ b/include/uapi/linux/netfilter/xt_devgroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_DEVGROUP_H  #define _XT_DEVGROUP_H diff --git a/include/uapi/linux/netfilter/xt_dscp.h b/include/uapi/linux/netfilter/xt_dscp.h index 15f8932ad5ce..7594e4df8587 100644 --- a/include/uapi/linux/netfilter/xt_dscp.h +++ b/include/uapi/linux/netfilter/xt_dscp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* x_tables module for matching the IPv4/IPv6 DSCP field   *   * (C) 2002 Harald Welte <laforge@gnumonks.org> diff --git a/include/uapi/linux/netfilter/xt_ecn.h b/include/uapi/linux/netfilter/xt_ecn.h index 7158fca364f2..2c301c1cbff2 100644 --- a/include/uapi/linux/netfilter/xt_ecn.h +++ b/include/uapi/linux/netfilter/xt_ecn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* iptables module for matching the ECN header in IPv4 and TCP header   *   * (C) 2002 Harald Welte <laforge@gnumonks.org> diff --git a/include/uapi/linux/netfilter/xt_esp.h b/include/uapi/linux/netfilter/xt_esp.h index ee6882408000..fa57a208f684 100644 --- a/include/uapi/linux/netfilter/xt_esp.h +++ b/include/uapi/linux/netfilter/xt_esp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_ESP_H  #define _XT_ESP_H diff --git a/include/uapi/linux/netfilter/xt_hashlimit.h b/include/uapi/linux/netfilter/xt_hashlimit.h index aa98573248b1..721a8de6c5b3 100644 --- a/include/uapi/linux/netfilter/xt_hashlimit.h +++ b/include/uapi/linux/netfilter/xt_hashlimit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_XT_HASHLIMIT_H  #define _UAPI_XT_HASHLIMIT_H diff --git a/include/uapi/linux/netfilter/xt_helper.h b/include/uapi/linux/netfilter/xt_helper.h index 6b42763f999d..53aa1458d6b7 100644 --- a/include/uapi/linux/netfilter/xt_helper.h +++ b/include/uapi/linux/netfilter/xt_helper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_HELPER_H  #define _XT_HELPER_H diff --git a/include/uapi/linux/netfilter/xt_ipcomp.h b/include/uapi/linux/netfilter/xt_ipcomp.h index 45c7e40eb8e1..69b12e76eaf7 100644 --- a/include/uapi/linux/netfilter/xt_ipcomp.h +++ b/include/uapi/linux/netfilter/xt_ipcomp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_IPCOMP_H  #define _XT_IPCOMP_H diff --git a/include/uapi/linux/netfilter/xt_iprange.h b/include/uapi/linux/netfilter/xt_iprange.h index 25fd7cf851f0..551bec7a22fc 100644 --- a/include/uapi/linux/netfilter/xt_iprange.h +++ b/include/uapi/linux/netfilter/xt_iprange.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_NETFILTER_XT_IPRANGE_H  #define _LINUX_NETFILTER_XT_IPRANGE_H 1 diff --git a/include/uapi/linux/netfilter/xt_ipvs.h b/include/uapi/linux/netfilter/xt_ipvs.h index e03b9c31a39d..925c76996dc4 100644 --- a/include/uapi/linux/netfilter/xt_ipvs.h +++ b/include/uapi/linux/netfilter/xt_ipvs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_IPVS_H  #define _XT_IPVS_H diff --git a/include/uapi/linux/netfilter/xt_l2tp.h b/include/uapi/linux/netfilter/xt_l2tp.h index 7dccfa0acbfa..990b52a49fab 100644 --- a/include/uapi/linux/netfilter/xt_l2tp.h +++ b/include/uapi/linux/netfilter/xt_l2tp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_NETFILTER_XT_L2TP_H  #define _LINUX_NETFILTER_XT_L2TP_H diff --git a/include/uapi/linux/netfilter/xt_length.h b/include/uapi/linux/netfilter/xt_length.h index b82ed7c4b1e0..513f653e2f6b 100644 --- a/include/uapi/linux/netfilter/xt_length.h +++ b/include/uapi/linux/netfilter/xt_length.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_LENGTH_H  #define _XT_LENGTH_H diff --git a/include/uapi/linux/netfilter/xt_limit.h b/include/uapi/linux/netfilter/xt_limit.h index bb47fc4d2ade..1d6e4ce9a646 100644 --- a/include/uapi/linux/netfilter/xt_limit.h +++ b/include/uapi/linux/netfilter/xt_limit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_RATE_H  #define _XT_RATE_H diff --git a/include/uapi/linux/netfilter/xt_mac.h b/include/uapi/linux/netfilter/xt_mac.h index 9a19a08a9181..c4dd5185cfc4 100644 --- a/include/uapi/linux/netfilter/xt_mac.h +++ b/include/uapi/linux/netfilter/xt_mac.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_MAC_H  #define _XT_MAC_H diff --git a/include/uapi/linux/netfilter/xt_mark.h b/include/uapi/linux/netfilter/xt_mark.h index ecadc40d5cde..9d0526ced8f0 100644 --- a/include/uapi/linux/netfilter/xt_mark.h +++ b/include/uapi/linux/netfilter/xt_mark.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_MARK_H  #define _XT_MARK_H diff --git a/include/uapi/linux/netfilter/xt_multiport.h b/include/uapi/linux/netfilter/xt_multiport.h index 5b7e72dfffc5..ffecf696454b 100644 --- a/include/uapi/linux/netfilter/xt_multiport.h +++ b/include/uapi/linux/netfilter/xt_multiport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_MULTIPORT_H  #define _XT_MULTIPORT_H diff --git a/include/uapi/linux/netfilter/xt_nfacct.h b/include/uapi/linux/netfilter/xt_nfacct.h index 3e19c8a86576..5c8a4d760ee3 100644 --- a/include/uapi/linux/netfilter/xt_nfacct.h +++ b/include/uapi/linux/netfilter/xt_nfacct.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_NFACCT_MATCH_H  #define _XT_NFACCT_MATCH_H diff --git a/include/uapi/linux/netfilter/xt_osf.h b/include/uapi/linux/netfilter/xt_osf.h index e6159958b2fb..dad197e2ab99 100644 --- a/include/uapi/linux/netfilter/xt_osf.h +++ b/include/uapi/linux/netfilter/xt_osf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru>   * diff --git a/include/uapi/linux/netfilter/xt_owner.h b/include/uapi/linux/netfilter/xt_owner.h index 2081761714b5..fa3ad84957d5 100644 --- a/include/uapi/linux/netfilter/xt_owner.h +++ b/include/uapi/linux/netfilter/xt_owner.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_OWNER_MATCH_H  #define _XT_OWNER_MATCH_H diff --git a/include/uapi/linux/netfilter/xt_physdev.h b/include/uapi/linux/netfilter/xt_physdev.h index ccdde87da214..06ae115e9a91 100644 --- a/include/uapi/linux/netfilter/xt_physdev.h +++ b/include/uapi/linux/netfilter/xt_physdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_XT_PHYSDEV_H  #define _UAPI_XT_PHYSDEV_H diff --git a/include/uapi/linux/netfilter/xt_pkttype.h b/include/uapi/linux/netfilter/xt_pkttype.h index f265cf52faea..c31f29d2e723 100644 --- a/include/uapi/linux/netfilter/xt_pkttype.h +++ b/include/uapi/linux/netfilter/xt_pkttype.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_PKTTYPE_H  #define _XT_PKTTYPE_H diff --git a/include/uapi/linux/netfilter/xt_policy.h b/include/uapi/linux/netfilter/xt_policy.h index d8a9800dce61..323bfa3074c5 100644 --- a/include/uapi/linux/netfilter/xt_policy.h +++ b/include/uapi/linux/netfilter/xt_policy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_POLICY_H  #define _XT_POLICY_H diff --git a/include/uapi/linux/netfilter/xt_quota.h b/include/uapi/linux/netfilter/xt_quota.h index 9314723f39ca..f3ba5d9e58b6 100644 --- a/include/uapi/linux/netfilter/xt_quota.h +++ b/include/uapi/linux/netfilter/xt_quota.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_QUOTA_H  #define _XT_QUOTA_H diff --git a/include/uapi/linux/netfilter/xt_rateest.h b/include/uapi/linux/netfilter/xt_rateest.h index 13fe50d4e4b3..52a37bdc1837 100644 --- a/include/uapi/linux/netfilter/xt_rateest.h +++ b/include/uapi/linux/netfilter/xt_rateest.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_RATEEST_MATCH_H  #define _XT_RATEEST_MATCH_H diff --git a/include/uapi/linux/netfilter/xt_realm.h b/include/uapi/linux/netfilter/xt_realm.h index d4a82ee56a02..252aa9f79cf8 100644 --- a/include/uapi/linux/netfilter/xt_realm.h +++ b/include/uapi/linux/netfilter/xt_realm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_REALM_H  #define _XT_REALM_H diff --git a/include/uapi/linux/netfilter/xt_recent.h b/include/uapi/linux/netfilter/xt_recent.h index 955d562031cc..e2c33996a802 100644 --- a/include/uapi/linux/netfilter/xt_recent.h +++ b/include/uapi/linux/netfilter/xt_recent.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_NETFILTER_XT_RECENT_H  #define _LINUX_NETFILTER_XT_RECENT_H 1 diff --git a/include/uapi/linux/netfilter/xt_rpfilter.h b/include/uapi/linux/netfilter/xt_rpfilter.h index 8358d4f71952..9b3d0f25a39c 100644 --- a/include/uapi/linux/netfilter/xt_rpfilter.h +++ b/include/uapi/linux/netfilter/xt_rpfilter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_RPATH_H  #define _XT_RPATH_H diff --git a/include/uapi/linux/netfilter/xt_sctp.h b/include/uapi/linux/netfilter/xt_sctp.h index 58ffcfb7978e..4bc6d1a08781 100644 --- a/include/uapi/linux/netfilter/xt_sctp.h +++ b/include/uapi/linux/netfilter/xt_sctp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_SCTP_H_  #define _XT_SCTP_H_ diff --git a/include/uapi/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h index d4e02348384c..8c1ca66c8a06 100644 --- a/include/uapi/linux/netfilter/xt_set.h +++ b/include/uapi/linux/netfilter/xt_set.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_SET_H  #define _XT_SET_H diff --git a/include/uapi/linux/netfilter/xt_socket.h b/include/uapi/linux/netfilter/xt_socket.h index 87644f832494..a7bdc9d882b0 100644 --- a/include/uapi/linux/netfilter/xt_socket.h +++ b/include/uapi/linux/netfilter/xt_socket.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_SOCKET_H  #define _XT_SOCKET_H diff --git a/include/uapi/linux/netfilter/xt_state.h b/include/uapi/linux/netfilter/xt_state.h index 7b32de886613..fe5670ef6aad 100644 --- a/include/uapi/linux/netfilter/xt_state.h +++ b/include/uapi/linux/netfilter/xt_state.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_STATE_H  #define _XT_STATE_H diff --git a/include/uapi/linux/netfilter/xt_statistic.h b/include/uapi/linux/netfilter/xt_statistic.h index 4e983ef0c968..bbce6fcb26e3 100644 --- a/include/uapi/linux/netfilter/xt_statistic.h +++ b/include/uapi/linux/netfilter/xt_statistic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_STATISTIC_H  #define _XT_STATISTIC_H diff --git a/include/uapi/linux/netfilter/xt_string.h b/include/uapi/linux/netfilter/xt_string.h index 235347c02eab..bedb015d54dd 100644 --- a/include/uapi/linux/netfilter/xt_string.h +++ b/include/uapi/linux/netfilter/xt_string.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_STRING_H  #define _XT_STRING_H diff --git a/include/uapi/linux/netfilter/xt_tcpmss.h b/include/uapi/linux/netfilter/xt_tcpmss.h index fbac56b9e667..2268f58b4dec 100644 --- a/include/uapi/linux/netfilter/xt_tcpmss.h +++ b/include/uapi/linux/netfilter/xt_tcpmss.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_TCPMSS_MATCH_H  #define _XT_TCPMSS_MATCH_H diff --git a/include/uapi/linux/netfilter/xt_tcpudp.h b/include/uapi/linux/netfilter/xt_tcpudp.h index 38aa7b399021..658c16999819 100644 --- a/include/uapi/linux/netfilter/xt_tcpudp.h +++ b/include/uapi/linux/netfilter/xt_tcpudp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_TCPUDP_H  #define _XT_TCPUDP_H diff --git a/include/uapi/linux/netfilter/xt_time.h b/include/uapi/linux/netfilter/xt_time.h index 095886019396..7f707c7ec858 100644 --- a/include/uapi/linux/netfilter/xt_time.h +++ b/include/uapi/linux/netfilter/xt_time.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_TIME_H  #define _XT_TIME_H 1 diff --git a/include/uapi/linux/netfilter/xt_u32.h b/include/uapi/linux/netfilter/xt_u32.h index 04d1bfea03c2..a88505ca72f8 100644 --- a/include/uapi/linux/netfilter/xt_u32.h +++ b/include/uapi/linux/netfilter/xt_u32.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _XT_U32_H  #define _XT_U32_H 1 diff --git a/include/uapi/linux/netfilter_arp.h b/include/uapi/linux/netfilter_arp.h index 92bc6ddcbf73..81b6a4cbcb72 100644 --- a/include/uapi/linux/netfilter_arp.h +++ b/include/uapi/linux/netfilter_arp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  #ifndef __LINUX_ARP_NETFILTER_H  #define __LINUX_ARP_NETFILTER_H diff --git a/include/uapi/linux/netfilter_arp/arp_tables.h b/include/uapi/linux/netfilter_arp/arp_tables.h index ece3ad4eecda..a2a0927d9bd6 100644 --- a/include/uapi/linux/netfilter_arp/arp_tables.h +++ b/include/uapi/linux/netfilter_arp/arp_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * 	Format of an ARP firewall descriptor   * diff --git a/include/uapi/linux/netfilter_arp/arpt_mangle.h b/include/uapi/linux/netfilter_arp/arpt_mangle.h index 8c2b16a1f5a0..60135d5cc223 100644 --- a/include/uapi/linux/netfilter_arp/arpt_mangle.h +++ b/include/uapi/linux/netfilter_arp/arpt_mangle.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ARPT_MANGLE_H  #define _ARPT_MANGLE_H  #include <linux/netfilter_arp/arp_tables.h> diff --git a/include/uapi/linux/netfilter_bridge.h b/include/uapi/linux/netfilter_bridge.h index 514519b47651..12fb77633f83 100644 --- a/include/uapi/linux/netfilter_bridge.h +++ b/include/uapi/linux/netfilter_bridge.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_BRIDGE_NETFILTER_H  #define _UAPI__LINUX_BRIDGE_NETFILTER_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_802_3.h b/include/uapi/linux/netfilter_bridge/ebt_802_3.h index f37522aade24..03463e4b0246 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_802_3.h +++ b/include/uapi/linux/netfilter_bridge/ebt_802_3.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_BRIDGE_EBT_802_3_H  #define _UAPI__LINUX_BRIDGE_EBT_802_3_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_among.h b/include/uapi/linux/netfilter_bridge/ebt_among.h index bd4e3ad0b706..9acf757bc1f7 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_among.h +++ b/include/uapi/linux/netfilter_bridge/ebt_among.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_AMONG_H  #define __LINUX_BRIDGE_EBT_AMONG_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_arp.h b/include/uapi/linux/netfilter_bridge/ebt_arp.h index dd4df25330e8..628b4fdae542 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_arp.h +++ b/include/uapi/linux/netfilter_bridge/ebt_arp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_ARP_H  #define __LINUX_BRIDGE_EBT_ARP_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_arpreply.h b/include/uapi/linux/netfilter_bridge/ebt_arpreply.h index 6fee3402e307..ed41ae053597 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_arpreply.h +++ b/include/uapi/linux/netfilter_bridge/ebt_arpreply.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H  #define __LINUX_BRIDGE_EBT_ARPREPLY_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_ip.h b/include/uapi/linux/netfilter_bridge/ebt_ip.h index c4bbc41b0ea4..8e462fb1983f 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_ip.h +++ b/include/uapi/linux/netfilter_bridge/ebt_ip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  ebt_ip   * diff --git a/include/uapi/linux/netfilter_bridge/ebt_ip6.h b/include/uapi/linux/netfilter_bridge/ebt_ip6.h index a062f0ce95f9..057945dd66bc 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_ip6.h +++ b/include/uapi/linux/netfilter_bridge/ebt_ip6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  ebt_ip6   * diff --git a/include/uapi/linux/netfilter_bridge/ebt_limit.h b/include/uapi/linux/netfilter_bridge/ebt_limit.h index 66d80b30ba0e..c2ac02e1fab6 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_limit.h +++ b/include/uapi/linux/netfilter_bridge/ebt_limit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_LIMIT_H  #define __LINUX_BRIDGE_EBT_LIMIT_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_log.h b/include/uapi/linux/netfilter_bridge/ebt_log.h index 7e7f1d1fe494..f6724155af91 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_log.h +++ b/include/uapi/linux/netfilter_bridge/ebt_log.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_LOG_H  #define __LINUX_BRIDGE_EBT_LOG_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_mark_m.h b/include/uapi/linux/netfilter_bridge/ebt_mark_m.h index 410f9e5a71d4..098ac78cd1e6 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_mark_m.h +++ b/include/uapi/linux/netfilter_bridge/ebt_mark_m.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_MARK_M_H  #define __LINUX_BRIDGE_EBT_MARK_M_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_mark_t.h b/include/uapi/linux/netfilter_bridge/ebt_mark_t.h index 7d5a268a4311..8810f1c12af3 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_mark_t.h +++ b/include/uapi/linux/netfilter_bridge/ebt_mark_t.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_MARK_T_H  #define __LINUX_BRIDGE_EBT_MARK_T_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_nat.h b/include/uapi/linux/netfilter_bridge/ebt_nat.h index c990d74ee966..49da2f9be021 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_nat.h +++ b/include/uapi/linux/netfilter_bridge/ebt_nat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_NAT_H  #define __LINUX_BRIDGE_EBT_NAT_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_nflog.h b/include/uapi/linux/netfilter_bridge/ebt_nflog.h index df829fce9125..f5cdc068c264 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_nflog.h +++ b/include/uapi/linux/netfilter_bridge/ebt_nflog.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_NFLOG_H  #define __LINUX_BRIDGE_EBT_NFLOG_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_pkttype.h b/include/uapi/linux/netfilter_bridge/ebt_pkttype.h index c241badcd036..32c5d08b31d3 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_pkttype.h +++ b/include/uapi/linux/netfilter_bridge/ebt_pkttype.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H  #define __LINUX_BRIDGE_EBT_PKTTYPE_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_redirect.h b/include/uapi/linux/netfilter_bridge/ebt_redirect.h index dd9622ce8488..dc7a7ce25902 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_redirect.h +++ b/include/uapi/linux/netfilter_bridge/ebt_redirect.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_REDIRECT_H  #define __LINUX_BRIDGE_EBT_REDIRECT_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_stp.h b/include/uapi/linux/netfilter_bridge/ebt_stp.h index 1025b9f5fb7d..94f68dedc3f6 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_stp.h +++ b/include/uapi/linux/netfilter_bridge/ebt_stp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_STP_H  #define __LINUX_BRIDGE_EBT_STP_H diff --git a/include/uapi/linux/netfilter_bridge/ebt_vlan.h b/include/uapi/linux/netfilter_bridge/ebt_vlan.h index 967d1d5cf98d..fb0d8f604c23 100644 --- a/include/uapi/linux/netfilter_bridge/ebt_vlan.h +++ b/include/uapi/linux/netfilter_bridge/ebt_vlan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_BRIDGE_EBT_VLAN_H  #define __LINUX_BRIDGE_EBT_VLAN_H diff --git a/include/uapi/linux/netfilter_bridge/ebtables.h b/include/uapi/linux/netfilter_bridge/ebtables.h index e3cdf9f1a259..9ff57c0a0199 100644 --- a/include/uapi/linux/netfilter_bridge/ebtables.h +++ b/include/uapi/linux/netfilter_bridge/ebtables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  ebtables   * diff --git a/include/uapi/linux/netfilter_decnet.h b/include/uapi/linux/netfilter_decnet.h index 0b09732aacd5..9089c38f6abe 100644 --- a/include/uapi/linux/netfilter_decnet.h +++ b/include/uapi/linux/netfilter_decnet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_DECNET_NETFILTER_H  #define __LINUX_DECNET_NETFILTER_H diff --git a/include/uapi/linux/netfilter_ipv4.h b/include/uapi/linux/netfilter_ipv4.h index 91ddd1f6fd4b..e6b1a84f5dd3 100644 --- a/include/uapi/linux/netfilter_ipv4.h +++ b/include/uapi/linux/netfilter_ipv4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* IPv4-specific defines for netfilter.    * (C)1998 Rusty Russell -- This code is GPL.   */ diff --git a/include/uapi/linux/netfilter_ipv4/ip_tables.h b/include/uapi/linux/netfilter_ipv4/ip_tables.h index d0da53d96d93..6aaeb14bfce1 100644 --- a/include/uapi/linux/netfilter_ipv4/ip_tables.h +++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * 25-Jul-1998 Major changes to allow for ip chain table   * diff --git a/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h index eac0f6548f47..ff6599494fe6 100644 --- a/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h +++ b/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IPT_CLUSTERIP_H_target  #define _IPT_CLUSTERIP_H_target diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h index bb88d5315a4d..e3630fd045b8 100644 --- a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h +++ b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* Header file for iptables ipt_ECN target   *   * (C) 2002 by Harald Welte <laforge@gnumonks.org> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_LOG.h b/include/uapi/linux/netfilter_ipv4/ipt_LOG.h index 5d8152077d71..6dec14ba851b 100644 --- a/include/uapi/linux/netfilter_ipv4/ipt_LOG.h +++ b/include/uapi/linux/netfilter_ipv4/ipt_LOG.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IPT_LOG_H  #define _IPT_LOG_H diff --git a/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h b/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h index 4293a1ad1b01..ae61ddd328b0 100644 --- a/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h +++ b/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IPT_REJECT_H  #define _IPT_REJECT_H diff --git a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h index f6ac169d92f9..57d2fc67a943 100644 --- a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h +++ b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* TTL modification module for IP tables   * (C) 2000 by Harald Welte <laforge@netfilter.org> */ diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ah.h b/include/uapi/linux/netfilter_ipv4/ipt_ah.h index 4e02bb0119e3..606ce90dbf83 100644 --- a/include/uapi/linux/netfilter_ipv4/ipt_ah.h +++ b/include/uapi/linux/netfilter_ipv4/ipt_ah.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IPT_AH_H  #define _IPT_AH_H diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h index 0e0c063dbf60..8121bec47026 100644 --- a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h +++ b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IPT_ECN_H  #define _IPT_ECN_H diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h index 37bee4442486..ad0226a8629b 100644 --- a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h +++ b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* IP tables module for matching the value of the TTL   * (C) 2000 by Harald Welte <laforge@gnumonks.org> */ diff --git a/include/uapi/linux/netfilter_ipv6.h b/include/uapi/linux/netfilter_ipv6.h index 12497c6c7949..2f9724611cc2 100644 --- a/include/uapi/linux/netfilter_ipv6.h +++ b/include/uapi/linux/netfilter_ipv6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* IPv6-specific defines for netfilter.    * (C)1998 Rusty Russell -- This code is GPL.   * (C)1999 David Jeffery diff --git a/include/uapi/linux/netfilter_ipv6/ip6_tables.h b/include/uapi/linux/netfilter_ipv6/ip6_tables.h index d1b22653daf2..031d0a43bed2 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6_tables.h +++ b/include/uapi/linux/netfilter_ipv6/ip6_tables.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * 25-Jul-1998 Major changes to allow for ip chain table   * diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_HL.h b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h index ebd8ead1bb63..eaed56a287b4 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_HL.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* Hop Limit modification module for ip6tables   * Maciej Soltysiak <solt@dns.toxicfilms.tv>   * Based on HW's TTL module */ diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_LOG.h b/include/uapi/linux/netfilter_ipv6/ip6t_LOG.h index 3dd0bc4e0735..7553a434e4da 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_LOG.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_LOG.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IP6T_LOG_H  #define _IP6T_LOG_H diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_NPT.h b/include/uapi/linux/netfilter_ipv6/ip6t_NPT.h index f763355481b5..422aef07657a 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_NPT.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_NPT.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __NETFILTER_IP6T_NPT  #define __NETFILTER_IP6T_NPT diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h b/include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h index cd2e940c8bf5..158ffa5f45b7 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IP6T_REJECT_H  #define _IP6T_REJECT_H diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_ah.h b/include/uapi/linux/netfilter_ipv6/ip6t_ah.h index 5da2b65cb3ad..9a4174e08f9c 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_ah.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_ah.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IP6T_AH_H  #define _IP6T_AH_H diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_frag.h b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h index dfd8bc2268cf..9acac816bba3 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_frag.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IP6T_FRAG_H  #define _IP6T_FRAG_H diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_hl.h b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h index 6e76dbc6c19a..6b62f9418eb2 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_hl.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* ip6tables module for matching the Hop Limit value   * Maciej Soltysiak <solt@dns.toxicfilms.tv>   * Based on HW's ttl module */ diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_ipv6header.h b/include/uapi/linux/netfilter_ipv6/ip6t_ipv6header.h index efae3a20c214..5a5196914764 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_ipv6header.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_ipv6header.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* ipv6header match - matches IPv6 packets based  on whether they contain certain headers */ diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_mh.h b/include/uapi/linux/netfilter_ipv6/ip6t_mh.h index a7729a5025cd..906196283185 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_mh.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_mh.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IP6T_MH_H  #define _IP6T_MH_H diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_opts.h b/include/uapi/linux/netfilter_ipv6/ip6t_opts.h index 17d419a811fd..79f9a477c5ac 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_opts.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_opts.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IP6T_OPTS_H  #define _IP6T_OPTS_H diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_rt.h b/include/uapi/linux/netfilter_ipv6/ip6t_rt.h index 558f81e46fb9..9c23e8ad20b9 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_rt.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_rt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _IP6T_RT_H  #define _IP6T_RT_H diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index e8af60a7c56d..776bc92e9118 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_NETLINK_H  #define _UAPI__LINUX_NETLINK_H diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h index 6dcd4de3397b..dfa61be43d2f 100644 --- a/include/uapi/linux/netlink_diag.h +++ b/include/uapi/linux/netlink_diag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __NETLINK_DIAG_H__  #define __NETLINK_DIAG_H__ diff --git a/include/uapi/linux/netrom.h b/include/uapi/linux/netrom.h index af7313cc9cb6..7498ea3c3940 100644 --- a/include/uapi/linux/netrom.h +++ b/include/uapi/linux/netrom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * These are the public elements of the Linux kernel NET/ROM implementation.   * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h index 399f39ff8048..f6e3c8c9c744 100644 --- a/include/uapi/linux/nfc.h +++ b/include/uapi/linux/nfc.h @@ -89,6 +89,7 @@   * @NFC_CMD_ACTIVATE_TARGET: Request NFC controller to reactivate target.   * @NFC_CMD_VENDOR: Vendor specific command, to be implemented directly   *	from the driver in order to support hardware specific operations. + * @NFC_CMD_DEACTIVATE_TARGET: Request NFC controller to deactivate target.   */  enum nfc_commands {  	NFC_CMD_UNSPEC, @@ -121,6 +122,7 @@ enum nfc_commands {  	NFC_CMD_SE_IO,  	NFC_CMD_ACTIVATE_TARGET,  	NFC_CMD_VENDOR, +	NFC_CMD_DEACTIVATE_TARGET,  /* private: internal use only */  	__NFC_CMD_AFTER_LAST  }; diff --git a/include/uapi/linux/nfs.h b/include/uapi/linux/nfs.h index 5e6296160361..057d22a48416 100644 --- a/include/uapi/linux/nfs.h +++ b/include/uapi/linux/nfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * NFS protocol definitions   * diff --git a/include/uapi/linux/nfs2.h b/include/uapi/linux/nfs2.h index fde24b30cc9e..e0237e0985b9 100644 --- a/include/uapi/linux/nfs2.h +++ b/include/uapi/linux/nfs2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * NFS protocol definitions   * diff --git a/include/uapi/linux/nfs3.h b/include/uapi/linux/nfs3.h index 231ef4e69829..37e4b34e6b43 100644 --- a/include/uapi/linux/nfs3.h +++ b/include/uapi/linux/nfs3.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * NFSv3 protocol definitions   */ diff --git a/include/uapi/linux/nfs4.h b/include/uapi/linux/nfs4.h index 4ae62796bfde..8572930cf5b0 100644 --- a/include/uapi/linux/nfs4.h +++ b/include/uapi/linux/nfs4.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  include/linux/nfs4.h   * diff --git a/include/uapi/linux/nfs4_mount.h b/include/uapi/linux/nfs4_mount.h index a0dcf6655657..d20bb869bb99 100644 --- a/include/uapi/linux/nfs4_mount.h +++ b/include/uapi/linux/nfs4_mount.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_NFS4_MOUNT_H  #define _LINUX_NFS4_MOUNT_H diff --git a/include/uapi/linux/nfs_fs.h b/include/uapi/linux/nfs_fs.h index 49142287999c..7bcc8cd6831d 100644 --- a/include/uapi/linux/nfs_fs.h +++ b/include/uapi/linux/nfs_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  linux/include/linux/nfs_fs.h   * diff --git a/include/uapi/linux/nfs_mount.h b/include/uapi/linux/nfs_mount.h index 64b0f22f5c4c..e44e00616ab5 100644 --- a/include/uapi/linux/nfs_mount.h +++ b/include/uapi/linux/nfs_mount.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_NFS_MOUNT_H  #define _LINUX_NFS_MOUNT_H diff --git a/include/uapi/linux/nfsacl.h b/include/uapi/linux/nfsacl.h index 552726631162..ca9a8501ff30 100644 --- a/include/uapi/linux/nfsacl.h +++ b/include/uapi/linux/nfsacl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * File: linux/nfsacl.h   * diff --git a/include/uapi/linux/nfsd/cld.h b/include/uapi/linux/nfsd/cld.h index ec260274be0c..f8f5cccad749 100644 --- a/include/uapi/linux/nfsd/cld.h +++ b/include/uapi/linux/nfsd/cld.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Upcall description for nfsdcld communication   * diff --git a/include/uapi/linux/nfsd/debug.h b/include/uapi/linux/nfsd/debug.h index 28ec6c9c421a..7301cdc79a33 100644 --- a/include/uapi/linux/nfsd/debug.h +++ b/include/uapi/linux/nfsd/debug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * linux/include/linux/nfsd/debug.h   * diff --git a/include/uapi/linux/nfsd/export.h b/include/uapi/linux/nfsd/export.h index c3be256107c6..2124ba904779 100644 --- a/include/uapi/linux/nfsd/export.h +++ b/include/uapi/linux/nfsd/export.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * include/linux/nfsd/export.h   *  diff --git a/include/uapi/linux/nfsd/nfsfh.h b/include/uapi/linux/nfsd/nfsfh.h index 20391235d088..ff0ca88b1c8f 100644 --- a/include/uapi/linux/nfsd/nfsfh.h +++ b/include/uapi/linux/nfsd/nfsfh.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * This file describes the layout of the file handles as passed   * over the wire. diff --git a/include/uapi/linux/nfsd/stats.h b/include/uapi/linux/nfsd/stats.h index 9fb7a0644263..b1a38ae14a02 100644 --- a/include/uapi/linux/nfsd/stats.h +++ b/include/uapi/linux/nfsd/stats.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * linux/include/linux/nfsd/stats.h   * diff --git a/include/uapi/linux/nilfs2_api.h b/include/uapi/linux/nilfs2_api.h index ef4c1de89b11..8b9b89104f3d 100644 --- a/include/uapi/linux/nilfs2_api.h +++ b/include/uapi/linux/nilfs2_api.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * nilfs2_api.h - NILFS2 user space API   * diff --git a/include/uapi/linux/nilfs2_ondisk.h b/include/uapi/linux/nilfs2_ondisk.h index 2a8a3addb675..a7e66ab11d1d 100644 --- a/include/uapi/linux/nilfs2_ondisk.h +++ b/include/uapi/linux/nilfs2_ondisk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * nilfs2_ondisk.h - NILFS2 on-disk structures   * diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 51626b4175c0..f882fe1f9709 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -569,13 +569,14 @@   *	authentication/association or not receiving a response from the AP.   *	Non-zero %NL80211_ATTR_STATUS_CODE value is indicated in that case as   *	well to remain backwards compatible. - * @NL80211_CMD_ROAM: notifcation indicating the card/driver roamed by itself. - *	When the driver roamed in a network that requires 802.1X authentication, - *	%NL80211_ATTR_PORT_AUTHORIZED should be set if the 802.1X authentication - *	was done by the driver or if roaming was done using Fast Transition - *	protocol (in which case 802.1X authentication is not needed). If - *	%NL80211_ATTR_PORT_AUTHORIZED is not set, user space is responsible for - *	the 802.1X authentication. + *	When establishing a security association, drivers that support 4 way + *	handshake offload should send %NL80211_CMD_PORT_AUTHORIZED event when + *	the 4 way handshake is completed successfully. + * @NL80211_CMD_ROAM: Notification indicating the card/driver roamed by itself. + *	When a security association was established with the new AP (e.g. if + *	the FT protocol was used for roaming or the driver completed the 4 way + *	handshake), this event should be followed by an + *	%NL80211_CMD_PORT_AUTHORIZED event.   * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify   *	userspace that a connection was dropped by the AP or due to other   *	reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and @@ -982,6 +983,14 @@   * @NL80211_CMD_DEL_PMK: For offloaded 4-Way handshake, delete the previously   *	configured PMK for the authenticator address identified by   *	&NL80211_ATTR_MAC. + * @NL80211_CMD_PORT_AUTHORIZED: An event that indicates that the 4 way + *	handshake was completed successfully by the driver. The BSSID is + *	specified with &NL80211_ATTR_MAC. Drivers that support 4 way handshake + *	offload should send this event after indicating 802.11 association with + *	&NL80211_CMD_CONNECT or &NL80211_CMD_ROAM. If the 4 way handshake failed + *	&NL80211_CMD_DISCONNECT should be indicated instead. + * + * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded.   *   * @NL80211_CMD_MAX: highest used command number   * @__NL80211_CMD_AFTER_LAST: internal use @@ -1185,6 +1194,10 @@ enum nl80211_commands {  	NL80211_CMD_SET_PMK,  	NL80211_CMD_DEL_PMK, +	NL80211_CMD_PORT_AUTHORIZED, + +	NL80211_CMD_RELOAD_REGDB, +  	/* add new commands above here */  	/* used to define NL80211_CMD_MAX below */ @@ -1407,8 +1420,12 @@ enum nl80211_commands {   *   * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is   *	used for the association (&enum nl80211_mfp, represented as a u32); - *	this attribute can be used - *	with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests + *	this attribute can be used with %NL80211_CMD_ASSOCIATE and + *	%NL80211_CMD_CONNECT requests. %NL80211_MFP_OPTIONAL is not allowed for + *	%NL80211_CMD_ASSOCIATE since user space SME is expected and hence, it + *	must have decided whether to use management frame protection or not. + *	Setting %NL80211_MFP_OPTIONAL with a %NL80211_CMD_CONNECT request will + *	let the driver (or the firmware) decide whether to use MFP or not.   *   * @NL80211_ATTR_STA_FLAGS2: Attribute containing a   *	&struct nl80211_sta_flag_update. @@ -2134,10 +2151,7 @@ enum nl80211_commands {   *	in %NL80211_CMD_CONNECT to indicate that for 802.1X authentication it   *	wants to use the supported offload of the 4-way handshake.   * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT. - * @NL80211_ATTR_PORT_AUTHORIZED: flag attribute used in %NL80211_CMD_ROAMED - *	notification indicating that that 802.1X authentication was done by - *	the driver or is not needed (because roaming used the Fast Transition - *	protocol). + * @NL80211_ATTR_PORT_AUTHORIZED: (reserved)   *   * @NUM_NL80211_ATTR: total number of nl80211_attrs available   * @NL80211_ATTR_MAX: highest attribute number currently defined @@ -3947,10 +3961,12 @@ enum nl80211_key_type {   * enum nl80211_mfp - Management frame protection state   * @NL80211_MFP_NO: Management frame protection not used   * @NL80211_MFP_REQUIRED: Management frame protection required + * @NL80211_MFP_OPTIONAL: Management frame protection is optional   */  enum nl80211_mfp {  	NL80211_MFP_NO,  	NL80211_MFP_REQUIRED, +	NL80211_MFP_OPTIONAL,  };  enum nl80211_wpa_versions { @@ -4914,6 +4930,17 @@ enum nl80211_feature_flags {   *	handshake with 802.1X in station mode (will pass EAP frames to the host   *	and accept the set_pmk/del_pmk commands), doing it in the host might not   *	be supported. + * @NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME: Driver is capable of overriding + *	the max channel attribute in the FILS request params IE with the + *	actual dwell time. + * @NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP: Driver accepts broadcast probe + *	response + * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE: Driver supports sending + *	the first probe request in each channel at rate of at least 5.5Mbps. + * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: Driver supports + *	probe request tx deferral and suppression + * @NL80211_EXT_FEATURE_MFP_OPTIONAL: Driver supports the %NL80211_MFP_OPTIONAL + *	value in %NL80211_ATTR_USE_MFP.   *   * @NUM_NL80211_EXT_FEATURES: number of extended features.   * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -4936,6 +4963,11 @@ enum nl80211_ext_feature_index {  	NL80211_EXT_FEATURE_FILS_SK_OFFLOAD,  	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK,  	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X, +	NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME, +	NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP, +	NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE, +	NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION, +	NL80211_EXT_FEATURE_MFP_OPTIONAL,  	/* add new features before the definition below */  	NUM_NL80211_EXT_FEATURES, @@ -5012,12 +5044,28 @@ enum nl80211_timeout_reason {   *	locally administered 1, multicast 0) is assumed.   *	This flag must not be requested when the feature isn't supported, check   *	the nl80211 feature flags for the device. + * @NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME: fill the dwell time in the FILS + *	request parameters IE in the probe request + * @NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP: accept broadcast probe responses + * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE: send probe request frames at + *	rate of at least 5.5M. In case non OCE AP is dicovered in the channel, + *	only the first probe req in the channel will be sent in high rate. + * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: allow probe request + *	tx deferral (dot11FILSProbeDelay shall be set to 15ms) + *	and suppression (if it has received a broadcast Probe Response frame, + *	Beacon frame or FILS Discovery frame from an AP that the STA considers + *	a suitable candidate for (re-)association - suitable in terms of + *	SSID and/or RSSI   */  enum nl80211_scan_flags { -	NL80211_SCAN_FLAG_LOW_PRIORITY			= 1<<0, -	NL80211_SCAN_FLAG_FLUSH				= 1<<1, -	NL80211_SCAN_FLAG_AP				= 1<<2, -	NL80211_SCAN_FLAG_RANDOM_ADDR			= 1<<3, +	NL80211_SCAN_FLAG_LOW_PRIORITY				= 1<<0, +	NL80211_SCAN_FLAG_FLUSH					= 1<<1, +	NL80211_SCAN_FLAG_AP					= 1<<2, +	NL80211_SCAN_FLAG_RANDOM_ADDR				= 1<<3, +	NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME			= 1<<4, +	NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP		= 1<<5, +	NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE		= 1<<6, +	NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION	= 1<<7,  };  /** diff --git a/include/uapi/linux/nsfs.h b/include/uapi/linux/nsfs.h index 1a3ca79f466b..a0c8552b64ee 100644 --- a/include/uapi/linux/nsfs.h +++ b/include/uapi/linux/nsfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_NSFS_H  #define __LINUX_NSFS_H diff --git a/include/uapi/linux/nubus.h b/include/uapi/linux/nubus.h index ac516064f0ee..f3776cc80f4d 100644 --- a/include/uapi/linux/nubus.h +++ b/include/uapi/linux/nubus.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*    nubus.h: various definitions and prototypes for NuBus drivers to use. diff --git a/include/uapi/linux/nvme_ioctl.h b/include/uapi/linux/nvme_ioctl.h index 50ff21f748b6..6e74b1eaf541 100644 --- a/include/uapi/linux/nvme_ioctl.h +++ b/include/uapi/linux/nvme_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Definitions for the NVM Express ioctl interface   * Copyright (c) 2011-2014, Intel Corporation. diff --git a/include/uapi/linux/nvram.h b/include/uapi/linux/nvram.h index 0986c4337383..4bee8e72dab4 100644 --- a/include/uapi/linux/nvram.h +++ b/include/uapi/linux/nvram.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_NVRAM_H  #define _UAPI_LINUX_NVRAM_H diff --git a/include/uapi/linux/omap3isp.h b/include/uapi/linux/omap3isp.h index c090cf9249bb..1a920145db04 100644 --- a/include/uapi/linux/omap3isp.h +++ b/include/uapi/linux/omap3isp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * omap3isp.h   * diff --git a/include/uapi/linux/omapfb.h b/include/uapi/linux/omapfb.h index 7c97bc00ac6d..44f43af4c699 100644 --- a/include/uapi/linux/omapfb.h +++ b/include/uapi/linux/omapfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * File: include/linux/omapfb.h   * diff --git a/include/uapi/linux/oom.h b/include/uapi/linux/oom.h index b29272d621ce..750b1c5a4dec 100644 --- a/include/uapi/linux/oom.h +++ b/include/uapi/linux/oom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__INCLUDE_LINUX_OOM_H  #define _UAPI__INCLUDE_LINUX_OOM_H diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h index 156ee4cab82e..4265d7f9e1f2 100644 --- a/include/uapi/linux/openvswitch.h +++ b/include/uapi/linux/openvswitch.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (c) 2007-2017 Nicira, Inc. @@ -257,6 +258,8 @@ enum ovs_vport_attr {  				/* receiving upcalls */  	OVS_VPORT_ATTR_STATS,	/* struct ovs_vport_stats */  	OVS_VPORT_ATTR_PAD, +	OVS_VPORT_ATTR_IFINDEX, +	OVS_VPORT_ATTR_NETNSID,  	__OVS_VPORT_ATTR_MAX  }; @@ -333,6 +336,7 @@ enum ovs_key_attr {  	OVS_KEY_ATTR_CT_LABELS,	/* 16-octet connection tracking label */  	OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4,   /* struct ovs_key_ct_tuple_ipv4 */  	OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6,   /* struct ovs_key_ct_tuple_ipv6 */ +	OVS_KEY_ATTR_NSH,       /* Nested set of ovs_nsh_key_* */  #ifdef __KERNEL__  	OVS_KEY_ATTR_TUNNEL_INFO,  /* struct ip_tunnel_info */ @@ -359,6 +363,7 @@ enum ovs_tunnel_key_attr {  	OVS_TUNNEL_KEY_ATTR_IPV6_SRC,		/* struct in6_addr src IPv6 address. */  	OVS_TUNNEL_KEY_ATTR_IPV6_DST,		/* struct in6_addr dst IPv6 address. */  	OVS_TUNNEL_KEY_ATTR_PAD, +	OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS,	/* be32 ERSPAN index. */  	__OVS_TUNNEL_KEY_ATTR_MAX  }; @@ -491,6 +496,30 @@ struct ovs_key_ct_tuple_ipv6 {  	__u8   ipv6_proto;  }; +enum ovs_nsh_key_attr { +	OVS_NSH_KEY_ATTR_UNSPEC, +	OVS_NSH_KEY_ATTR_BASE,  /* struct ovs_nsh_key_base. */ +	OVS_NSH_KEY_ATTR_MD1,   /* struct ovs_nsh_key_md1. */ +	OVS_NSH_KEY_ATTR_MD2,   /* variable-length octets for MD type 2. */ +	__OVS_NSH_KEY_ATTR_MAX +}; + +#define OVS_NSH_KEY_ATTR_MAX (__OVS_NSH_KEY_ATTR_MAX - 1) + +struct ovs_nsh_key_base { +	__u8 flags; +	__u8 ttl; +	__u8 mdtype; +	__u8 np; +	__be32 path_hdr; +}; + +#define NSH_MD1_CONTEXT_SIZE 4 + +struct ovs_nsh_key_md1 { +	__be32 context[NSH_MD1_CONTEXT_SIZE]; +}; +  /**   * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.   * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow @@ -806,6 +835,11 @@ struct ovs_action_push_eth {   * packet.   * @OVS_ACTION_ATTR_POP_ETH: Pop the outermost Ethernet header off the   * packet. + * @OVS_ACTION_ATTR_CT_CLEAR: Clear conntrack state from the packet. + * @OVS_ACTION_ATTR_PUSH_NSH: push NSH header to the packet. + * @OVS_ACTION_ATTR_POP_NSH: pop the outermost NSH header off the packet. + * @OVS_ACTION_ATTR_METER: Run packet through a meter, which may drop the + * packet, or modify the packet (e.g., change the DSCP field).   *   * Only a single header can be set with a single %OVS_ACTION_ATTR_SET.  Not all   * fields within a header are modifiable, e.g. the IPv4 protocol and fragment @@ -835,6 +869,10 @@ enum ovs_action_attr {  	OVS_ACTION_ATTR_TRUNC,        /* u32 struct ovs_action_trunc. */  	OVS_ACTION_ATTR_PUSH_ETH,     /* struct ovs_action_push_eth. */  	OVS_ACTION_ATTR_POP_ETH,      /* No argument. */ +	OVS_ACTION_ATTR_CT_CLEAR,     /* No argument. */ +	OVS_ACTION_ATTR_PUSH_NSH,     /* Nested OVS_NSH_KEY_ATTR_*. */ +	OVS_ACTION_ATTR_POP_NSH,      /* No argument. */ +	OVS_ACTION_ATTR_METER,        /* u32 meter ID. */  	__OVS_ACTION_ATTR_MAX,	      /* Nothing past this will be accepted  				       * from userspace. */ @@ -848,4 +886,55 @@ enum ovs_action_attr {  #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) +/* Meters. */ +#define OVS_METER_FAMILY  "ovs_meter" +#define OVS_METER_MCGROUP "ovs_meter" +#define OVS_METER_VERSION 0x1 + +enum ovs_meter_cmd { +	OVS_METER_CMD_UNSPEC, +	OVS_METER_CMD_FEATURES,	/* Get features supported by the datapath. */ +	OVS_METER_CMD_SET,	/* Add or modify a meter. */ +	OVS_METER_CMD_DEL,	/* Delete a meter. */ +	OVS_METER_CMD_GET	/* Get meter stats. */ +}; + +enum ovs_meter_attr { +	OVS_METER_ATTR_UNSPEC, +	OVS_METER_ATTR_ID,	/* u32 meter ID within datapath. */ +	OVS_METER_ATTR_KBPS,	/* No argument. If set, units in kilobits +				 * per second. Otherwise, units in +				 * packets per second. +				 */ +	OVS_METER_ATTR_STATS,	/* struct ovs_flow_stats for the meter. */ +	OVS_METER_ATTR_BANDS,	/* Nested attributes for meter bands. */ +	OVS_METER_ATTR_USED,	/* u64 msecs last used in monotonic time. */ +	OVS_METER_ATTR_CLEAR,	/* Flag to clear stats, used. */ +	OVS_METER_ATTR_MAX_METERS, /* u32 number of meters supported. */ +	OVS_METER_ATTR_MAX_BANDS,  /* u32 max number of bands per meter. */ +	OVS_METER_ATTR_PAD, +	__OVS_METER_ATTR_MAX +}; + +#define OVS_METER_ATTR_MAX (__OVS_METER_ATTR_MAX - 1) + +enum ovs_band_attr { +	OVS_BAND_ATTR_UNSPEC, +	OVS_BAND_ATTR_TYPE,	/* u32 OVS_METER_BAND_TYPE_* constant. */ +	OVS_BAND_ATTR_RATE,	/* u32 band rate in meter units (see above). */ +	OVS_BAND_ATTR_BURST,	/* u32 burst size in meter units. */ +	OVS_BAND_ATTR_STATS,	/* struct ovs_flow_stats for the band. */ +	__OVS_BAND_ATTR_MAX +}; + +#define OVS_BAND_ATTR_MAX (__OVS_BAND_ATTR_MAX - 1) + +enum ovs_meter_band_type { +	OVS_METER_BAND_TYPE_UNSPEC, +	OVS_METER_BAND_TYPE_DROP,   /* Drop exceeding packets. */ +	__OVS_METER_BAND_TYPE_MAX +}; + +#define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1) +  #endif /* _LINUX_OPENVSWITCH_H */ diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h index 0c5d5dd61b6a..349ddf0a96af 100644 --- a/include/uapi/linux/packet_diag.h +++ b/include/uapi/linux/packet_diag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __PACKET_DIAG_H__  #define __PACKET_DIAG_H__ diff --git a/include/uapi/linux/param.h b/include/uapi/linux/param.h index 092e92f67b50..94e0c57a75b7 100644 --- a/include/uapi/linux/param.h +++ b/include/uapi/linux/param.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_PARAM_H  #define _LINUX_PARAM_H diff --git a/include/uapi/linux/patchkey.h b/include/uapi/linux/patchkey.h index 1bda0e56bc5e..3eb246e94733 100644 --- a/include/uapi/linux/patchkey.h +++ b/include/uapi/linux/patchkey.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * <linux/patchkey.h> -- definition of _PATCHKEY macro   * diff --git a/include/uapi/linux/pci.h b/include/uapi/linux/pci.h index 3c292bc0d1c1..a769eefc5139 100644 --- a/include/uapi/linux/pci.h +++ b/include/uapi/linux/pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *	pci.h   * diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index f8d58045926f..70c2b2ade048 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *	pci_regs.h   * @@ -746,6 +747,7 @@  #define PCI_ERR_ROOT_FIRST_FATAL	0x00000010 /* First UNC is Fatal */  #define PCI_ERR_ROOT_NONFATAL_RCV	0x00000020 /* Non-Fatal Received */  #define PCI_ERR_ROOT_FATAL_RCV		0x00000040 /* Fatal Received */ +#define PCI_ERR_ROOT_AER_IRQ		0xf8000000 /* Advanced Error Interrupt Message Number */  #define PCI_ERR_ROOT_ERR_SRC	52	/* Error Source Identification */  /* Virtual Channel */ @@ -939,9 +941,13 @@  #define PCI_SATA_SIZEOF_LONG	16  /* Resizable BARs */ +#define PCI_REBAR_CAP		4	/* capability register */ +#define  PCI_REBAR_CAP_SIZES		0x00FFFFF0  /* supported BAR sizes */  #define PCI_REBAR_CTRL		8	/* control register */ -#define  PCI_REBAR_CTRL_NBAR_MASK	(7 << 5)	/* mask for # bars */ -#define  PCI_REBAR_CTRL_NBAR_SHIFT	5	/* shift for # bars */ +#define  PCI_REBAR_CTRL_BAR_IDX		0x00000007  /* BAR index */ +#define  PCI_REBAR_CTRL_NBAR_MASK	0x000000E0  /* # of resizable BARs */ +#define  PCI_REBAR_CTRL_NBAR_SHIFT	5  	    /* shift for # of BARs */ +#define  PCI_REBAR_CTRL_BAR_SIZE	0x00001F00  /* BAR size */  /* Dynamic Power Allocation */  #define PCI_DPA_CAP		4	/* capability register */ @@ -960,6 +966,7 @@  /* Downstream Port Containment */  #define PCI_EXP_DPC_CAP			4	/* DPC Capability */ +#define PCI_EXP_DPC_IRQ			0x1f	/* DPC Interrupt Message Number */  #define  PCI_EXP_DPC_CAP_RP_EXT		0x20	/* Root Port Extensions for DPC */  #define  PCI_EXP_DPC_CAP_POISONED_TLP	0x40	/* Poisoned TLP Egress Blocking Supported */  #define  PCI_EXP_DPC_CAP_SW_TRIGGER	0x80	/* Software Triggering Supported */ @@ -995,19 +1002,25 @@  #define  PCI_PTM_CTRL_ENABLE		0x00000001  /* PTM enable */  #define  PCI_PTM_CTRL_ROOT		0x00000002  /* Root select */ -/* L1 PM Substates */ -#define PCI_L1SS_CAP		    4	/* capability register */ -#define  PCI_L1SS_CAP_PCIPM_L1_2	 1	/* PCI PM L1.2 Support */ -#define  PCI_L1SS_CAP_PCIPM_L1_1	 2	/* PCI PM L1.1 Support */ -#define  PCI_L1SS_CAP_ASPM_L1_2		 4	/* ASPM L1.2 Support */ -#define  PCI_L1SS_CAP_ASPM_L1_1		 8	/* ASPM L1.1 Support */ -#define  PCI_L1SS_CAP_L1_PM_SS		16	/* L1 PM Substates Support */ -#define PCI_L1SS_CTL1		    8	/* Control Register 1 */ -#define  PCI_L1SS_CTL1_PCIPM_L1_2	1	/* PCI PM L1.2 Enable */ -#define  PCI_L1SS_CTL1_PCIPM_L1_1	2	/* PCI PM L1.1 Support */ -#define  PCI_L1SS_CTL1_ASPM_L1_2	4	/* ASPM L1.2 Support */ -#define  PCI_L1SS_CTL1_ASPM_L1_1	8	/* ASPM L1.1 Support */ -#define  PCI_L1SS_CTL1_L1SS_MASK	0x0000000F -#define PCI_L1SS_CTL2		    0xC	/* Control Register 2 */ +/* ASPM L1 PM Substates */ +#define PCI_L1SS_CAP		0x04	/* Capabilities Register */ +#define  PCI_L1SS_CAP_PCIPM_L1_2	0x00000001  /* PCI-PM L1.2 Supported */ +#define  PCI_L1SS_CAP_PCIPM_L1_1	0x00000002  /* PCI-PM L1.1 Supported */ +#define  PCI_L1SS_CAP_ASPM_L1_2		0x00000004  /* ASPM L1.2 Supported */ +#define  PCI_L1SS_CAP_ASPM_L1_1		0x00000008  /* ASPM L1.1 Supported */ +#define  PCI_L1SS_CAP_L1_PM_SS		0x00000010  /* L1 PM Substates Supported */ +#define  PCI_L1SS_CAP_CM_RESTORE_TIME	0x0000ff00  /* Port Common_Mode_Restore_Time */ +#define  PCI_L1SS_CAP_P_PWR_ON_SCALE	0x00030000  /* Port T_POWER_ON scale */ +#define  PCI_L1SS_CAP_P_PWR_ON_VALUE	0x00f80000  /* Port T_POWER_ON value */ +#define PCI_L1SS_CTL1		0x08	/* Control 1 Register */ +#define  PCI_L1SS_CTL1_PCIPM_L1_2	0x00000001  /* PCI-PM L1.2 Enable */ +#define  PCI_L1SS_CTL1_PCIPM_L1_1	0x00000002  /* PCI-PM L1.1 Enable */ +#define  PCI_L1SS_CTL1_ASPM_L1_2	0x00000004  /* ASPM L1.2 Enable */ +#define  PCI_L1SS_CTL1_ASPM_L1_1	0x00000008  /* ASPM L1.1 Enable */ +#define  PCI_L1SS_CTL1_L1SS_MASK	0x0000000f +#define  PCI_L1SS_CTL1_CM_RESTORE_TIME	0x0000ff00  /* Common_Mode_Restore_Time */ +#define  PCI_L1SS_CTL1_LTR_L12_TH_VALUE	0x03ff0000  /* LTR_L1.2_THRESHOLD_Value */ +#define  PCI_L1SS_CTL1_LTR_L12_TH_SCALE	0xe0000000  /* LTR_L1.2_THRESHOLD_Scale */ +#define PCI_L1SS_CTL2		0x0c	/* Control 2 Register */  #endif /* LINUX_PCI_REGS_H */ diff --git a/include/uapi/linux/pcitest.h b/include/uapi/linux/pcitest.h index a6aa10c45ad1..953cf036cb26 100644 --- a/include/uapi/linux/pcitest.h +++ b/include/uapi/linux/pcitest.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /**   * pcitest.h - PCI test uapi defines   * diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 140ae638cfd6..b9a4953018ed 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Performance events:   * @@ -941,6 +942,7 @@ enum perf_callchain_context {  #define PERF_AUX_FLAG_TRUNCATED		0x01	/* record was truncated to fit */  #define PERF_AUX_FLAG_OVERWRITE		0x02	/* snapshot from overwrite mode */  #define PERF_AUX_FLAG_PARTIAL		0x04	/* record contains gaps */ +#define PERF_AUX_FLAG_COLLISION		0x08	/* sample collided with another */  #define PERF_FLAG_FD_NO_GROUP		(1UL << 0)  #define PERF_FLAG_FD_OUTPUT		(1UL << 1) diff --git a/include/uapi/linux/personality.h b/include/uapi/linux/personality.h index aa169c4339d2..49796b7756af 100644 --- a/include/uapi/linux/personality.h +++ b/include/uapi/linux/personality.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_PERSONALITY_H  #define _UAPI_LINUX_PERSONALITY_H diff --git a/include/uapi/linux/pfkeyv2.h b/include/uapi/linux/pfkeyv2.h index ada7f0171ccc..d65b11785260 100644 --- a/include/uapi/linux/pfkeyv2.h +++ b/include/uapi/linux/pfkeyv2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* PF_KEY user interface, this is defined by rfc2367 so   * do not make arbitrary modifications or else this header   * file will not be compliant. diff --git a/include/uapi/linux/pg.h b/include/uapi/linux/pg.h index db994bb0c794..364c350e85cd 100644 --- a/include/uapi/linux/pg.h +++ b/include/uapi/linux/pg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /* 	pg.h (c) 1998  Grant R. Guenther <grant@torque.net>   		       Under the terms of the GNU General Public License diff --git a/include/uapi/linux/phantom.h b/include/uapi/linux/phantom.h index 94dd6645c60a..dbef708ab3b4 100644 --- a/include/uapi/linux/phantom.h +++ b/include/uapi/linux/phantom.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Copyright (C) 2005-2007 Jiri Slaby <jirislaby@gmail.com>   * diff --git a/include/uapi/linux/phonet.h b/include/uapi/linux/phonet.h index a3e1d65b3ed9..a2f6b37a5937 100644 --- a/include/uapi/linux/phonet.h +++ b/include/uapi/linux/phonet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /**   * file phonet.h   * diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h index d5e2bf68d0d4..46c506615f4a 100644 --- a/include/uapi/linux/pkt_cls.h +++ b/include/uapi/linux/pkt_cls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_PKT_CLS_H  #define __LINUX_PKT_CLS_H diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index 099bf5528fed..af3cc2f4e1ad 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_PKT_SCHED_H  #define __LINUX_PKT_SCHED_H @@ -74,6 +75,7 @@ struct tc_estimator {  #define TC_H_INGRESS    (0xFFFFFFF1U)  #define TC_H_CLSACT	TC_H_INGRESS +#define TC_H_MIN_PRIORITY	0xFFE0U  #define TC_H_MIN_INGRESS	0xFFF2U  #define TC_H_MIN_EGRESS		0xFFF3U @@ -254,6 +256,7 @@ struct tc_red_qopt {  #define TC_RED_ECN		1  #define TC_RED_HARDDROP		2  #define TC_RED_ADAPTATIVE	4 +#define TC_RED_OFFLOADED	8  };  struct tc_red_xstats { @@ -534,6 +537,9 @@ enum {  	TCA_NETEM_ECN,  	TCA_NETEM_RATE64,  	TCA_NETEM_PAD, +	TCA_NETEM_LATENCY64, +	TCA_NETEM_JITTER64, +	TCA_NETEM_SLOT,  	__TCA_NETEM_MAX,  }; @@ -571,6 +577,13 @@ struct tc_netem_rate {  	__s32	cell_overhead;  }; +struct tc_netem_slot { +	__s64   min_delay; /* nsec */ +	__s64   max_delay; +	__s32   max_packets; +	__s32   max_bytes; +}; +  enum {  	NETEM_LOSS_UNSPEC,  	NETEM_LOSS_GI,		/* General Intuitive - 4 state model */ @@ -625,6 +638,22 @@ enum {  #define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1) +enum { +	TC_MQPRIO_MODE_DCB, +	TC_MQPRIO_MODE_CHANNEL, +	__TC_MQPRIO_MODE_MAX +}; + +#define __TC_MQPRIO_MODE_MAX (__TC_MQPRIO_MODE_MAX - 1) + +enum { +	TC_MQPRIO_SHAPER_DCB, +	TC_MQPRIO_SHAPER_BW_RATE,	/* Add new shapers below */ +	__TC_MQPRIO_SHAPER_MAX +}; + +#define __TC_MQPRIO_SHAPER_MAX (__TC_MQPRIO_SHAPER_MAX - 1) +  struct tc_mqprio_qopt {  	__u8	num_tc;  	__u8	prio_tc_map[TC_QOPT_BITMASK + 1]; @@ -633,6 +662,22 @@ struct tc_mqprio_qopt {  	__u16	offset[TC_QOPT_MAX_QUEUE];  }; +#define TC_MQPRIO_F_MODE		0x1 +#define TC_MQPRIO_F_SHAPER		0x2 +#define TC_MQPRIO_F_MIN_RATE		0x4 +#define TC_MQPRIO_F_MAX_RATE		0x8 + +enum { +	TCA_MQPRIO_UNSPEC, +	TCA_MQPRIO_MODE, +	TCA_MQPRIO_SHAPER, +	TCA_MQPRIO_MIN_RATE64, +	TCA_MQPRIO_MAX_RATE64, +	__TCA_MQPRIO_MAX, +}; + +#define TCA_MQPRIO_MAX (__TCA_MQPRIO_MAX - 1) +  /* SFB */  enum { @@ -871,4 +916,23 @@ struct tc_pie_xstats {  	__u32 maxq;             /* maximum queue size */  	__u32 ecn_mark;         /* packets marked with ecn*/  }; + +/* CBS */ +struct tc_cbs_qopt { +	__u8 offload; +	__u8 _pad[3]; +	__s32 hicredit; +	__s32 locredit; +	__s32 idleslope; +	__s32 sendslope; +}; + +enum { +	TCA_CBS_UNSPEC, +	TCA_CBS_PARMS, +	__TCA_CBS_MAX, +}; + +#define TCA_CBS_MAX (__TCA_CBS_MAX - 1) +  #endif diff --git a/include/uapi/linux/pktcdvd.h b/include/uapi/linux/pktcdvd.h index 2640b9d4e243..9cbb55d21c94 100644 --- a/include/uapi/linux/pktcdvd.h +++ b/include/uapi/linux/pktcdvd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2000 Jens Axboe <axboe@suse.de>   * Copyright (C) 2001-2004 Peter Osterlund <petero2@telia.com> diff --git a/include/uapi/linux/pmu.h b/include/uapi/linux/pmu.h index caead364b6eb..89cb1acea93a 100644 --- a/include/uapi/linux/pmu.h +++ b/include/uapi/linux/pmu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Definitions for talking to the PMU.  The PMU is a microcontroller   * which controls battery charging and system power on PowerBook 3400 diff --git a/include/uapi/linux/posix_acl.h b/include/uapi/linux/posix_acl.h index 1037cb19aa17..217e4e26ab60 100644 --- a/include/uapi/linux/posix_acl.h +++ b/include/uapi/linux/posix_acl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * Copyright (C) 2002 Andreas Gruenbacher <a.gruenbacher@computer.org>   * Copyright (C) 2016 Red Hat, Inc. diff --git a/include/uapi/linux/posix_acl_xattr.h b/include/uapi/linux/posix_acl_xattr.h index 8b579844109b..506380f0b91b 100644 --- a/include/uapi/linux/posix_acl_xattr.h +++ b/include/uapi/linux/posix_acl_xattr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */  /*   * Copyright (C) 2002 Andreas Gruenbacher <a.gruenbacher@computer.org>   * Copyright (C) 2016 Red Hat, Inc. diff --git a/include/uapi/linux/posix_types.h b/include/uapi/linux/posix_types.h index 988f76e636e3..9a7a740b35a2 100644 --- a/include/uapi/linux/posix_types.h +++ b/include/uapi/linux/posix_types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_POSIX_TYPES_H  #define _LINUX_POSIX_TYPES_H diff --git a/include/uapi/linux/ppdev.h b/include/uapi/linux/ppdev.h index dc18c5d23ebe..8fe3c64d149e 100644 --- a/include/uapi/linux/ppdev.h +++ b/include/uapi/linux/ppdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * linux/include/linux/ppdev.h   * diff --git a/include/uapi/linux/ppp-comp.h b/include/uapi/linux/ppp-comp.h index 0a15bbb04e19..0fb7623e9548 100644 --- a/include/uapi/linux/ppp-comp.h +++ b/include/uapi/linux/ppp-comp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * ppp-comp.h - Definitions for doing PPP packet compression.   * diff --git a/include/uapi/linux/ppp-ioctl.h b/include/uapi/linux/ppp-ioctl.h index 63a23a3b8bb7..b19a9c249b15 100644 --- a/include/uapi/linux/ppp-ioctl.h +++ b/include/uapi/linux/ppp-ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * ppp-ioctl.h - PPP ioctl definitions.   * diff --git a/include/uapi/linux/ppp_defs.h b/include/uapi/linux/ppp_defs.h index 283fc05dbbda..fff51b91b409 100644 --- a/include/uapi/linux/ppp_defs.h +++ b/include/uapi/linux/ppp_defs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * ppp_defs.h - PPP definitions.   * diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h index c29d6b791c08..009ebcd8ced5 100644 --- a/include/uapi/linux/pps.h +++ b/include/uapi/linux/pps.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * PPS API header   * diff --git a/include/uapi/linux/pr.h b/include/uapi/linux/pr.h index 645ef3cf3dd0..ccc78cbf1221 100644 --- a/include/uapi/linux/pr.h +++ b/include/uapi/linux/pr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_PR_H  #define _UAPI_PR_H diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h index a8d0759a9e40..af5f8c2df87a 100644 --- a/include/uapi/linux/prctl.h +++ b/include/uapi/linux/prctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_PRCTL_H  #define _LINUX_PRCTL_H @@ -197,4 +198,13 @@ struct prctl_mm_map {  # define PR_CAP_AMBIENT_LOWER		3  # define PR_CAP_AMBIENT_CLEAR_ALL	4 +/* arm64 Scalable Vector Extension controls */ +/* Flag values must be kept in sync with ptrace NT_ARM_SVE interface */ +#define PR_SVE_SET_VL			50	/* set task vector length */ +# define PR_SVE_SET_VL_ONEXEC		(1 << 18) /* defer effect until exec */ +#define PR_SVE_GET_VL			51	/* get task vector length */ +/* Bits common to PR_SVE_SET_VL and PR_SVE_GET_VL */ +# define PR_SVE_VL_LEN_MASK		0xffff +# define PR_SVE_VL_INHERIT		(1 << 17) /* inherit across exec */ +  #endif /* _LINUX_PRCTL_H */ diff --git a/include/uapi/linux/psample.h b/include/uapi/linux/psample.h index ed48996ec0e8..ce1116cff53d 100644 --- a/include/uapi/linux/psample.h +++ b/include/uapi/linux/psample.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __UAPI_PSAMPLE_H  #define __UAPI_PSAMPLE_H diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index 3d7a0fc021a7..760e52a9640f 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * ARM Power State and Coordination Interface (PSCI) header   * diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h index ac6dded80ffa..3039bf6a742e 100644 --- a/include/uapi/linux/ptp_clock.h +++ b/include/uapi/linux/ptp_clock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * PTP 1588 clock support - user space interface   * diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h index fb8106509000..e3939e00980b 100644 --- a/include/uapi/linux/ptrace.h +++ b/include/uapi/linux/ptrace.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_PTRACE_H  #define _UAPI_LINUX_PTRACE_H  /* ptrace.h */ diff --git a/include/uapi/linux/qnx4_fs.h b/include/uapi/linux/qnx4_fs.h index 8b9aee1a9ce3..31487325d265 100644 --- a/include/uapi/linux/qnx4_fs.h +++ b/include/uapi/linux/qnx4_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  Name                         : qnx4_fs.h   *  Author                       : Richard Frowijn diff --git a/include/uapi/linux/qnxtypes.h b/include/uapi/linux/qnxtypes.h index bebbe5cc4fb8..eacfab10e821 100644 --- a/include/uapi/linux/qnxtypes.h +++ b/include/uapi/linux/qnxtypes.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  Name                         : qnxtypes.h   *  Author                       : Richard Frowijn diff --git a/include/uapi/linux/qrtr.h b/include/uapi/linux/qrtr.h index 9d76c566f66e..f7e2fb3d752b 100644 --- a/include/uapi/linux/qrtr.h +++ b/include/uapi/linux/qrtr.h @@ -1,13 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_QRTR_H  #define _LINUX_QRTR_H  #include <linux/socket.h>  #include <linux/types.h> +#define QRTR_NODE_BCAST	0xffffffffu +#define QRTR_PORT_CTRL	0xfffffffeu +  struct sockaddr_qrtr {  	__kernel_sa_family_t sq_family;  	__u32 sq_node;  	__u32 sq_port;  }; +enum qrtr_pkt_type { +	QRTR_TYPE_DATA		= 1, +	QRTR_TYPE_HELLO		= 2, +	QRTR_TYPE_BYE		= 3, +	QRTR_TYPE_NEW_SERVER	= 4, +	QRTR_TYPE_DEL_SERVER	= 5, +	QRTR_TYPE_DEL_CLIENT	= 6, +	QRTR_TYPE_RESUME_TX	= 7, +	QRTR_TYPE_EXIT          = 8, +	QRTR_TYPE_PING          = 9, +	QRTR_TYPE_NEW_LOOKUP	= 10, +	QRTR_TYPE_DEL_LOOKUP	= 11, +}; + +struct qrtr_ctrl_pkt { +	__le32 cmd; + +	union { +		struct { +			__le32 service; +			__le32 instance; +			__le32 node; +			__le32 port; +		} server; + +		struct { +			__le32 node; +			__le32 port; +		} client; +	}; +} __packed; +  #endif /* _LINUX_QRTR_H */ diff --git a/include/uapi/linux/radeonfb.h b/include/uapi/linux/radeonfb.h index 8c4bbdecc44f..86eafb805ed9 100644 --- a/include/uapi/linux/radeonfb.h +++ b/include/uapi/linux/radeonfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_RADEONFB_H__  #define __LINUX_RADEONFB_H__ diff --git a/include/uapi/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h index b9197976b660..b0d15c73f6d7 100644 --- a/include/uapi/linux/raid/md_p.h +++ b/include/uapi/linux/raid/md_p.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*     md_p.h : physical layout of Linux RAID devices            Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman diff --git a/include/uapi/linux/raid/md_u.h b/include/uapi/linux/raid/md_u.h index 36cd8210a5d1..105307244961 100644 --- a/include/uapi/linux/raid/md_u.h +++ b/include/uapi/linux/raid/md_u.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*     md_u.h : user <=> kernel API between Linux raidtools and RAID drivers            Copyright (C) 1998 Ingo Molnar diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h index 3f93d1695e7f..c34f4490d025 100644 --- a/include/uapi/linux/random.h +++ b/include/uapi/linux/random.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * include/linux/random.h   * diff --git a/include/uapi/linux/raw.h b/include/uapi/linux/raw.h index 62d543e70603..dc96dda479d6 100644 --- a/include/uapi/linux/raw.h +++ b/include/uapi/linux/raw.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_RAW_H  #define __LINUX_RAW_H diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h index 198892b95f09..e71d4491f225 100644 --- a/include/uapi/linux/rds.h +++ b/include/uapi/linux/rds.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2008 Oracle.  All rights reserved.   * diff --git a/include/uapi/linux/reboot.h b/include/uapi/linux/reboot.h index 09d056d4fc50..58e64398efc5 100644 --- a/include/uapi/linux/reboot.h +++ b/include/uapi/linux/reboot.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_REBOOT_H  #define _UAPI_LINUX_REBOOT_H diff --git a/include/uapi/linux/reiserfs_fs.h b/include/uapi/linux/reiserfs_fs.h index ea3700cd7367..5bb921409f2b 100644 --- a/include/uapi/linux/reiserfs_fs.h +++ b/include/uapi/linux/reiserfs_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details   */ diff --git a/include/uapi/linux/reiserfs_xattr.h b/include/uapi/linux/reiserfs_xattr.h index 38fdd648be21..28f10842f047 100644 --- a/include/uapi/linux/reiserfs_xattr.h +++ b/include/uapi/linux/reiserfs_xattr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*    File: linux/reiserfs_xattr.h  */ diff --git a/include/uapi/linux/resource.h b/include/uapi/linux/resource.h index 36fb3b5fb181..cc00fd079631 100644 --- a/include/uapi/linux/resource.h +++ b/include/uapi/linux/resource.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_RESOURCE_H  #define _UAPI_LINUX_RESOURCE_H diff --git a/include/uapi/linux/rio_cm_cdev.h b/include/uapi/linux/rio_cm_cdev.h index 6edb900d318d..d05dc3226f8e 100644 --- a/include/uapi/linux/rio_cm_cdev.h +++ b/include/uapi/linux/rio_cm_cdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * Copyright (c) 2015, Integrated Device Technology Inc.   * Copyright (c) 2015, Prodrive Technologies diff --git a/include/uapi/linux/rio_mport_cdev.h b/include/uapi/linux/rio_mport_cdev.h index 5796bf1d06ad..9bc9f98e353a 100644 --- a/include/uapi/linux/rio_mport_cdev.h +++ b/include/uapi/linux/rio_mport_cdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * Copyright (c) 2015-2016, Integrated Device Technology Inc.   * Copyright (c) 2015, Prodrive Technologies diff --git a/include/uapi/linux/romfs_fs.h b/include/uapi/linux/romfs_fs.h index 5f57f93b284f..a7f1585accef 100644 --- a/include/uapi/linux/romfs_fs.h +++ b/include/uapi/linux/romfs_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_ROMFS_FS_H  #define __LINUX_ROMFS_FS_H diff --git a/include/uapi/linux/rose.h b/include/uapi/linux/rose.h index 1fcfe95893b8..19aa4693c8fc 100644 --- a/include/uapi/linux/rose.h +++ b/include/uapi/linux/rose.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * These are the public elements of the Linux kernel Rose implementation.   * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the diff --git a/include/uapi/linux/route.h b/include/uapi/linux/route.h index 6600708311c8..a0de9a7331a2 100644 --- a/include/uapi/linux/route.h +++ b/include/uapi/linux/route.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/rpmsg.h b/include/uapi/linux/rpmsg.h index dedc226e0d3f..225eb38705dc 100644 --- a/include/uapi/linux/rpmsg.h +++ b/include/uapi/linux/rpmsg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (c) 2016, Linaro Ltd.   * diff --git a/include/uapi/linux/rtc.h b/include/uapi/linux/rtc.h index f8c82e6f25d5..2ad1788968d0 100644 --- a/include/uapi/linux/rtc.h +++ b/include/uapi/linux/rtc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Generic RTC interface.   * This version contains the part of the user interface to the Real Time Clock diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index dab7dad9e01a..d8b5f80c2ea6 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_RTNETLINK_H  #define _UAPI__LINUX_RTNETLINK_H @@ -430,6 +431,8 @@ enum {  #define RTAX_QUICKACK RTAX_QUICKACK  	RTAX_CC_ALGO,  #define RTAX_CC_ALGO RTAX_CC_ALGO +	RTAX_FASTOPEN_NO_COOKIE, +#define RTAX_FASTOPEN_NO_COOKIE RTAX_FASTOPEN_NO_COOKIE  	__RTAX_MAX  }; diff --git a/include/uapi/linux/rxrpc.h b/include/uapi/linux/rxrpc.h index 9656aad8f8f7..9d4afea308a4 100644 --- a/include/uapi/linux/rxrpc.h +++ b/include/uapi/linux/rxrpc.h @@ -20,12 +20,12 @@   * RxRPC socket address   */  struct sockaddr_rxrpc { -	sa_family_t	srx_family;	/* address family */ -	u16		srx_service;	/* service desired */ -	u16		transport_type;	/* type of transport socket (SOCK_DGRAM) */ -	u16		transport_len;	/* length of transport address */ +	__kernel_sa_family_t	srx_family;	/* address family */ +	__u16			srx_service;	/* service desired */ +	__u16			transport_type;	/* type of transport socket (SOCK_DGRAM) */ +	__u16			transport_len;	/* length of transport address */  	union { -		sa_family_t family;		/* transport address family */ +		__kernel_sa_family_t family;	/* transport address family */  		struct sockaddr_in sin;		/* IPv4 transport address */  		struct sockaddr_in6 sin6;	/* IPv6 transport address */  	} transport; diff --git a/include/uapi/linux/scc.h b/include/uapi/linux/scc.h index 72b6b8153374..c5bc7f747755 100644 --- a/include/uapi/linux/scc.h +++ b/include/uapi/linux/scc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */  #ifndef _UAPI_SCC_H diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h index e2a6c7b3510b..30a9e51bbb1e 100644 --- a/include/uapi/linux/sched.h +++ b/include/uapi/linux/sched.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SCHED_H  #define _UAPI_LINUX_SCHED_H diff --git a/include/uapi/linux/sched/types.h b/include/uapi/linux/sched/types.h index 34b81aa1a2f7..10fbb8031930 100644 --- a/include/uapi/linux/sched/types.h +++ b/include/uapi/linux/sched/types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SCHED_TYPES_H  #define _UAPI_LINUX_SCHED_TYPES_H diff --git a/include/uapi/linux/scif_ioctl.h b/include/uapi/linux/scif_ioctl.h index d9048918be52..862a4cc908f7 100644 --- a/include/uapi/linux/scif_ioctl.h +++ b/include/uapi/linux/scif_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * Intel MIC Platform Software Stack (MPSS)   * diff --git a/include/uapi/linux/screen_info.h b/include/uapi/linux/screen_info.h index 8b8d39dfb67f..87e5c086938e 100644 --- a/include/uapi/linux/screen_info.h +++ b/include/uapi/linux/screen_info.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_SCREEN_INFO_H  #define _UAPI_SCREEN_INFO_H diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h index 6217ff8500a1..d9adab32dbee 100644 --- a/include/uapi/linux/sctp.h +++ b/include/uapi/linux/sctp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /* SCTP kernel implementation   * (C) Copyright IBM Corp. 2001, 2004   * Copyright (c) 1999-2000 Cisco, Inc. @@ -122,6 +123,8 @@ typedef __s32 sctp_assoc_t;  #define SCTP_RESET_ASSOC	120  #define SCTP_ADD_STREAMS	121  #define SCTP_SOCKOPT_PEELOFF_FLAGS 122 +#define SCTP_STREAM_SCHEDULER	123 +#define SCTP_STREAM_SCHEDULER_VALUE	124  /* PR-SCTP policies */  #define SCTP_PR_SCTP_NONE	0x0000 @@ -376,7 +379,7 @@ struct sctp_remote_error {  	__u16 sre_type;  	__u16 sre_flags;  	__u32 sre_length; -	__u16 sre_error; +	__be16 sre_error;  	sctp_assoc_t sre_assoc_id;  	__u8 sre_data[0];  }; @@ -814,6 +817,12 @@ struct sctp_assoc_value {      uint32_t                assoc_value;  }; +struct sctp_stream_value { +	sctp_assoc_t assoc_id; +	uint16_t stream_id; +	uint16_t stream_value; +}; +  /*   * 7.2.2 Peer Address Information   * @@ -1088,4 +1097,12 @@ struct sctp_add_streams {  	uint16_t sas_outstrms;  }; +/* SCTP Stream schedulers */ +enum sctp_sched_type { +	SCTP_SS_FCFS, +	SCTP_SS_PRIO, +	SCTP_SS_RR, +	SCTP_SS_MAX = SCTP_SS_RR +}; +  #endif /* _UAPI_SCTP_H */ diff --git a/include/uapi/linux/sdla.h b/include/uapi/linux/sdla.h index 95eaff9c9e49..1e3735be6511 100644 --- a/include/uapi/linux/sdla.h +++ b/include/uapi/linux/sdla.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h index f6bc1dea3247..2a0bd9dd104d 100644 --- a/include/uapi/linux/seccomp.h +++ b/include/uapi/linux/seccomp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SECCOMP_H  #define _UAPI_LINUX_SECCOMP_H diff --git a/include/uapi/linux/securebits.h b/include/uapi/linux/securebits.h index 35ac35cef217..d6d98877ff1a 100644 --- a/include/uapi/linux/securebits.h +++ b/include/uapi/linux/securebits.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SECUREBITS_H  #define _UAPI_LINUX_SECUREBITS_H diff --git a/include/uapi/linux/sed-opal.h b/include/uapi/linux/sed-opal.h index c72e0735532d..627624d35030 100644 --- a/include/uapi/linux/sed-opal.h +++ b/include/uapi/linux/sed-opal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright © 2016 Intel Corporation   * diff --git a/include/uapi/linux/seg6.h b/include/uapi/linux/seg6.h index 7278511d339e..286e8d6a8e98 100644 --- a/include/uapi/linux/seg6.h +++ b/include/uapi/linux/seg6.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  SR-IPv6 implementation   * @@ -25,9 +26,9 @@ struct ipv6_sr_hdr {  	__u8	hdrlen;  	__u8	type;  	__u8	segments_left; -	__u8	first_segment; +	__u8	first_segment; /* Represents the last_entry field of SRH */  	__u8	flags; -	__u16	reserved; +	__u16	tag;  	struct in6_addr segments[0];  }; diff --git a/include/uapi/linux/seg6_genl.h b/include/uapi/linux/seg6_genl.h index fcf1c60d7df3..d995d48daebb 100644 --- a/include/uapi/linux/seg6_genl.h +++ b/include/uapi/linux/seg6_genl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SEG6_GENL_H  #define _UAPI_LINUX_SEG6_GENL_H diff --git a/include/uapi/linux/seg6_hmac.h b/include/uapi/linux/seg6_hmac.h index e691c753fc3f..b877c782158a 100644 --- a/include/uapi/linux/seg6_hmac.h +++ b/include/uapi/linux/seg6_hmac.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SEG6_HMAC_H  #define _UAPI_LINUX_SEG6_HMAC_H diff --git a/include/uapi/linux/seg6_iptunnel.h b/include/uapi/linux/seg6_iptunnel.h index b23df9f58354..09fb608a35ec 100644 --- a/include/uapi/linux/seg6_iptunnel.h +++ b/include/uapi/linux/seg6_iptunnel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  SR-IPv6 implementation   * diff --git a/include/uapi/linux/selinux_netlink.h b/include/uapi/linux/selinux_netlink.h index d239797785cf..2fc0542171cd 100644 --- a/include/uapi/linux/selinux_netlink.h +++ b/include/uapi/linux/selinux_netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Netlink event notifications for SELinux.   * diff --git a/include/uapi/linux/sem.h b/include/uapi/linux/sem.h index 67eb90361692..9c3e745b0656 100644 --- a/include/uapi/linux/sem.h +++ b/include/uapi/linux/sem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SEM_H  #define _UAPI_LINUX_SEM_H diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h index d2667ecd54ac..3fdd0dee8b41 100644 --- a/include/uapi/linux/serial.h +++ b/include/uapi/linux/serial.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /*   * include/linux/serial.h   * diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h index 50d71c436323..1c8413f93e3d 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  linux/drivers/char/serial_core.h   * diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h index 5db76880b4ad..be07b5470f4b 100644 --- a/include/uapi/linux/serial_reg.h +++ b/include/uapi/linux/serial_reg.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /*   * include/linux/serial_reg.h   * @@ -157,6 +158,7 @@   */  #define UART_DLL	0	/* Out: Divisor Latch Low */  #define UART_DLM	1	/* Out: Divisor Latch High */ +#define UART_DIV_MAX	0xFFFF	/* Max divisor value */  /*   * LCR=0xBF (or DLAB=1 for 16C660) diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h index ac217c6f0151..a0cac1d8670d 100644 --- a/include/uapi/linux/serio.h +++ b/include/uapi/linux/serio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 1999-2002 Vojtech Pavlik  * diff --git a/include/uapi/linux/shm.h b/include/uapi/linux/shm.h index cf23c873719d..4de12a39b075 100644 --- a/include/uapi/linux/shm.h +++ b/include/uapi/linux/shm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SHM_H_  #define _UAPI_LINUX_SHM_H_ diff --git a/include/uapi/linux/signal.h b/include/uapi/linux/signal.h index cd0804b6bfa2..e03238f8d478 100644 --- a/include/uapi/linux/signal.h +++ b/include/uapi/linux/signal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SIGNAL_H  #define _UAPI_LINUX_SIGNAL_H diff --git a/include/uapi/linux/signalfd.h b/include/uapi/linux/signalfd.h index 492c6def340d..6f0da42fc5ef 100644 --- a/include/uapi/linux/signalfd.h +++ b/include/uapi/linux/signalfd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  include/linux/signalfd.h   * diff --git a/include/uapi/linux/smc.h b/include/uapi/linux/smc.h index ab1dea8e53ee..0e11ca421ca4 100644 --- a/include/uapi/linux/smc.h +++ b/include/uapi/linux/smc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  Shared Memory Communications over RDMA (SMC-R) and RoCE   * diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h index 87712bfaa9dd..0ae5d4685ba3 100644 --- a/include/uapi/linux/smc_diag.h +++ b/include/uapi/linux/smc_diag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_SMC_DIAG_H_  #define _UAPI_SMC_DIAG_H_ diff --git a/include/uapi/linux/smiapp.h b/include/uapi/linux/smiapp.h index 53938f4412ee..50438f8d9647 100644 --- a/include/uapi/linux/smiapp.h +++ b/include/uapi/linux/smiapp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * include/uapi/linux/smiapp.h   * diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h index 758f12b58541..33a70ece462f 100644 --- a/include/uapi/linux/snmp.h +++ b/include/uapi/linux/snmp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Definitions for MIBs   * @@ -190,7 +191,6 @@ enum  	LINUX_MIB_TCPRENORECOVERY,		/* TCPRenoRecovery */  	LINUX_MIB_TCPSACKRECOVERY,		/* TCPSackRecovery */  	LINUX_MIB_TCPSACKRENEGING,		/* TCPSACKReneging */ -	LINUX_MIB_TCPFACKREORDER,		/* TCPFACKReorder */  	LINUX_MIB_TCPSACKREORDER,		/* TCPSACKReorder */  	LINUX_MIB_TCPRENOREORDER,		/* TCPRenoReorder */  	LINUX_MIB_TCPTSREORDER,			/* TCPTSReorder */ diff --git a/include/uapi/linux/sock_diag.h b/include/uapi/linux/sock_diag.h index 7ff505d8a47b..e5925009a652 100644 --- a/include/uapi/linux/sock_diag.h +++ b/include/uapi/linux/sock_diag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__SOCK_DIAG_H__  #define _UAPI__SOCK_DIAG_H__ diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h index 76ab0c68561e..8eb96021709c 100644 --- a/include/uapi/linux/socket.h +++ b/include/uapi/linux/socket.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SOCKET_H  #define _UAPI_LINUX_SOCKET_H diff --git a/include/uapi/linux/sockios.h b/include/uapi/linux/sockios.h index 79d029d25310..d393e9ed3964 100644 --- a/include/uapi/linux/sockios.h +++ b/include/uapi/linux/sockios.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/sonet.h b/include/uapi/linux/sonet.h index cc54acee81ba..9d02357c6c6f 100644 --- a/include/uapi/linux/sonet.h +++ b/include/uapi/linux/sonet.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* sonet.h - SONET/SHD physical layer control */  /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ diff --git a/include/uapi/linux/sonypi.h b/include/uapi/linux/sonypi.h index 85078a283573..88f122451776 100644 --- a/include/uapi/linux/sonypi.h +++ b/include/uapi/linux/sonypi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Sony Programmable I/O Control Device driver for VAIO   * diff --git a/include/uapi/linux/sound.h b/include/uapi/linux/sound.h index 014c9117c224..a62d74042f47 100644 --- a/include/uapi/linux/sound.h +++ b/include/uapi/linux/sound.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SOUND_H  #define _UAPI_LINUX_SOUND_H diff --git a/include/uapi/linux/spi/spidev.h b/include/uapi/linux/spi/spidev.h index dd5f21e75805..c4253f0090d8 100644 --- a/include/uapi/linux/spi/spidev.h +++ b/include/uapi/linux/spi/spidev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * include/linux/spi/spidev.h   * @@ -23,6 +24,7 @@  #define SPIDEV_H  #include <linux/types.h> +#include <linux/ioctl.h>  /* User space versions of kernel symbols for SPI clocking modes,   * matching <linux/spi/spi.h> diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index 17b10304c393..7b35e98d3c58 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_STAT_H  #define _UAPI_LINUX_STAT_H diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h index 621fa8ac4425..ee8220f8dcf5 100644 --- a/include/uapi/linux/stddef.h +++ b/include/uapi/linux/stddef.h @@ -1,4 +1,5 @@ -#include <linux/compiler.h> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#include <linux/compiler_types.h>  #ifndef __always_inline  #define __always_inline inline diff --git a/include/uapi/linux/stm.h b/include/uapi/linux/stm.h index 626a8d3f63b5..dbffdc23d804 100644 --- a/include/uapi/linux/stm.h +++ b/include/uapi/linux/stm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * System Trace Module (STM) userspace interfaces   * Copyright (c) 2014, Intel Corporation. diff --git a/include/uapi/linux/string.h b/include/uapi/linux/string.h index e32e545cff5a..9d129c13fe9d 100644 --- a/include/uapi/linux/string.h +++ b/include/uapi/linux/string.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_STRING_H_  #define _UAPI_LINUX_STRING_H_ diff --git a/include/uapi/linux/sunrpc/debug.h b/include/uapi/linux/sunrpc/debug.h index 830e34493a8c..ae54af3d3fd6 100644 --- a/include/uapi/linux/sunrpc/debug.h +++ b/include/uapi/linux/sunrpc/debug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * linux/include/linux/sunrpc/debug.h   * diff --git a/include/uapi/linux/suspend_ioctls.h b/include/uapi/linux/suspend_ioctls.h index 0b30382984fe..bcce04e21c0d 100644 --- a/include/uapi/linux/suspend_ioctls.h +++ b/include/uapi/linux/suspend_ioctls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_SUSPEND_IOCTLS_H  #define _LINUX_SUSPEND_IOCTLS_H diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h index 8f3a8f606fd9..23cd84868cc3 100644 --- a/include/uapi/linux/swab.h +++ b/include/uapi/linux/swab.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_SWAB_H  #define _UAPI_LINUX_SWAB_H diff --git a/include/uapi/linux/switchtec_ioctl.h b/include/uapi/linux/switchtec_ioctl.h index 5e392968bad2..75df44373034 100644 --- a/include/uapi/linux/switchtec_ioctl.h +++ b/include/uapi/linux/switchtec_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Microsemi Switchtec PCIe Driver   * Copyright (c) 2017, Microsemi Corporation diff --git a/include/uapi/linux/sync_file.h b/include/uapi/linux/sync_file.h index 5b287d6970b3..ee2dcfb3d660 100644 --- a/include/uapi/linux/sync_file.h +++ b/include/uapi/linux/sync_file.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /*   * Copyright (C) 2012 Google, Inc.   * diff --git a/include/uapi/linux/synclink.h b/include/uapi/linux/synclink.h index 7dcb065a5f76..62f32d4e1021 100644 --- a/include/uapi/linux/synclink.h +++ b/include/uapi/linux/synclink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */  /*   * SyncLink Multiprotocol Serial Adapter Driver   * diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h index e13d48058b8d..0f272818a4d2 100644 --- a/include/uapi/linux/sysctl.h +++ b/include/uapi/linux/sysctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * sysctl.h: General linux system control interface   * diff --git a/include/uapi/linux/sysinfo.h b/include/uapi/linux/sysinfo.h index 934335a22522..435d5c23f0c0 100644 --- a/include/uapi/linux/sysinfo.h +++ b/include/uapi/linux/sysinfo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_SYSINFO_H  #define _LINUX_SYSINFO_H diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h index 24a1c4ec2248..0be80f72646b 100644 --- a/include/uapi/linux/target_core_user.h +++ b/include/uapi/linux/target_core_user.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __TARGET_CORE_USER_H  #define __TARGET_CORE_USER_H diff --git a/include/uapi/linux/taskstats.h b/include/uapi/linux/taskstats.h index 2466e550a41d..b7aa7bb2349f 100644 --- a/include/uapi/linux/taskstats.h +++ b/include/uapi/linux/taskstats.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */  /* taskstats.h - exporting per-task statistics   *   * Copyright (C) Shailabh Nagar, IBM Corp. 2006 diff --git a/include/uapi/linux/tc_act/tc_bpf.h b/include/uapi/linux/tc_act/tc_bpf.h index 8dc2ac05eecf..6e89a5df49a4 100644 --- a/include/uapi/linux/tc_act/tc_bpf.h +++ b/include/uapi/linux/tc_act/tc_bpf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>   * diff --git a/include/uapi/linux/tc_act/tc_connmark.h b/include/uapi/linux/tc_act/tc_connmark.h index 62a5e944c554..80caa47b1933 100644 --- a/include/uapi/linux/tc_act/tc_connmark.h +++ b/include/uapi/linux/tc_act/tc_connmark.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __UAPI_TC_CONNMARK_H  #define __UAPI_TC_CONNMARK_H diff --git a/include/uapi/linux/tc_act/tc_csum.h b/include/uapi/linux/tc_act/tc_csum.h index a11bb355dbfb..0ecf4d29e2f3 100644 --- a/include/uapi/linux/tc_act/tc_csum.h +++ b/include/uapi/linux/tc_act/tc_csum.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_CSUM_H  #define __LINUX_TC_CSUM_H diff --git a/include/uapi/linux/tc_act/tc_defact.h b/include/uapi/linux/tc_act/tc_defact.h index d2a3abb77aeb..e3ecd8bf37de 100644 --- a/include/uapi/linux/tc_act/tc_defact.h +++ b/include/uapi/linux/tc_act/tc_defact.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_DEF_H  #define __LINUX_TC_DEF_H diff --git a/include/uapi/linux/tc_act/tc_gact.h b/include/uapi/linux/tc_act/tc_gact.h index 70b536a8f8b2..94273c3b81b0 100644 --- a/include/uapi/linux/tc_act/tc_gact.h +++ b/include/uapi/linux/tc_act/tc_gact.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_GACT_H  #define __LINUX_TC_GACT_H diff --git a/include/uapi/linux/tc_act/tc_ife.h b/include/uapi/linux/tc_act/tc_ife.h index 7c2817866c97..2f48490ef386 100644 --- a/include/uapi/linux/tc_act/tc_ife.h +++ b/include/uapi/linux/tc_act/tc_ife.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __UAPI_TC_IFE_H  #define __UAPI_TC_IFE_H diff --git a/include/uapi/linux/tc_act/tc_ipt.h b/include/uapi/linux/tc_act/tc_ipt.h index 7c6e155dd981..b743c8bddd13 100644 --- a/include/uapi/linux/tc_act/tc_ipt.h +++ b/include/uapi/linux/tc_act/tc_ipt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_IPT_H  #define __LINUX_TC_IPT_H diff --git a/include/uapi/linux/tc_act/tc_mirred.h b/include/uapi/linux/tc_act/tc_mirred.h index 3d7a2b352a62..5dd671cf5776 100644 --- a/include/uapi/linux/tc_act/tc_mirred.h +++ b/include/uapi/linux/tc_act/tc_mirred.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_MIR_H  #define __LINUX_TC_MIR_H @@ -9,13 +10,13 @@  #define TCA_EGRESS_MIRROR 2 /* mirror packet to EGRESS */  #define TCA_INGRESS_REDIR 3  /* packet redirect to INGRESS*/  #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ -                                                                                 +  struct tc_mirred {  	tc_gen;  	int                     eaction;   /* one of IN/EGRESS_MIRROR/REDIR */  	__u32                   ifindex;  /* ifindex of egress port */  }; -                                                                                 +  enum {  	TCA_MIRRED_UNSPEC,  	TCA_MIRRED_TM, @@ -24,5 +25,5 @@ enum {  	__TCA_MIRRED_MAX  };  #define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) -                                                                                 +  #endif diff --git a/include/uapi/linux/tc_act/tc_nat.h b/include/uapi/linux/tc_act/tc_nat.h index 923457c9ebf0..086be842587b 100644 --- a/include/uapi/linux/tc_act/tc_nat.h +++ b/include/uapi/linux/tc_act/tc_nat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_NAT_H  #define __LINUX_TC_NAT_H diff --git a/include/uapi/linux/tc_act/tc_pedit.h b/include/uapi/linux/tc_act/tc_pedit.h index 143d2b31a316..162d1094c41c 100644 --- a/include/uapi/linux/tc_act/tc_pedit.h +++ b/include/uapi/linux/tc_act/tc_pedit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_PED_H  #define __LINUX_TC_PED_H diff --git a/include/uapi/linux/tc_act/tc_sample.h b/include/uapi/linux/tc_act/tc_sample.h index edc9058bb30d..bd7e9f03abd2 100644 --- a/include/uapi/linux/tc_act/tc_sample.h +++ b/include/uapi/linux/tc_act/tc_sample.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_SAMPLE_H  #define __LINUX_TC_SAMPLE_H diff --git a/include/uapi/linux/tc_act/tc_skbedit.h b/include/uapi/linux/tc_act/tc_skbedit.h index 2884425738ce..fbcfe27a4e6c 100644 --- a/include/uapi/linux/tc_act/tc_skbedit.h +++ b/include/uapi/linux/tc_act/tc_skbedit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (c) 2008, Intel Corporation.   * diff --git a/include/uapi/linux/tc_act/tc_skbmod.h b/include/uapi/linux/tc_act/tc_skbmod.h index 10fc07da6c69..38c072f66f2f 100644 --- a/include/uapi/linux/tc_act/tc_skbmod.h +++ b/include/uapi/linux/tc_act/tc_skbmod.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (c) 2016, Jamal Hadi Salim   * diff --git a/include/uapi/linux/tc_act/tc_tunnel_key.h b/include/uapi/linux/tc_act/tc_tunnel_key.h index afcd4be953e2..72bbefe5d1d1 100644 --- a/include/uapi/linux/tc_act/tc_tunnel_key.h +++ b/include/uapi/linux/tc_act/tc_tunnel_key.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (c) 2016, Amir Vadai <amir@vadai.me>   * Copyright (c) 2016, Mellanox Technologies. All rights reserved. diff --git a/include/uapi/linux/tc_act/tc_vlan.h b/include/uapi/linux/tc_act/tc_vlan.h index bddb272b843f..0d7b5fd6605b 100644 --- a/include/uapi/linux/tc_act/tc_vlan.h +++ b/include/uapi/linux/tc_act/tc_vlan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>   * diff --git a/include/uapi/linux/tc_ematch/tc_em_cmp.h b/include/uapi/linux/tc_ematch/tc_em_cmp.h index f34bb1bae083..2549d9d6e031 100644 --- a/include/uapi/linux/tc_ematch/tc_em_cmp.h +++ b/include/uapi/linux/tc_ematch/tc_em_cmp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_EM_CMP_H  #define __LINUX_TC_EM_CMP_H diff --git a/include/uapi/linux/tc_ematch/tc_em_meta.h b/include/uapi/linux/tc_ematch/tc_em_meta.h index b11f8ce2d3c0..cf30b5bc4eaf 100644 --- a/include/uapi/linux/tc_ematch/tc_em_meta.h +++ b/include/uapi/linux/tc_ematch/tc_em_meta.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_EM_META_H  #define __LINUX_TC_EM_META_H diff --git a/include/uapi/linux/tc_ematch/tc_em_nbyte.h b/include/uapi/linux/tc_ematch/tc_em_nbyte.h index 7172cfb999c1..c76333f7f6f2 100644 --- a/include/uapi/linux/tc_ematch/tc_em_nbyte.h +++ b/include/uapi/linux/tc_ematch/tc_em_nbyte.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_EM_NBYTE_H  #define __LINUX_TC_EM_NBYTE_H diff --git a/include/uapi/linux/tc_ematch/tc_em_text.h b/include/uapi/linux/tc_ematch/tc_em_text.h index 5aac4045ba88..b0a92257964e 100644 --- a/include/uapi/linux/tc_ematch/tc_em_text.h +++ b/include/uapi/linux/tc_ematch/tc_em_text.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_TC_EM_TEXT_H  #define __LINUX_TC_EM_TEXT_H diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h index 15c25eccab2b..b4a4f64635fa 100644 --- a/include/uapi/linux/tcp.h +++ b/include/uapi/linux/tcp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket @@ -119,6 +120,8 @@ enum {  #define TCP_FASTOPEN_CONNECT	30	/* Attempt FastOpen with connect */  #define TCP_ULP			31	/* Attach a ULP to a TCP connection */  #define TCP_MD5SIG_EXT		32	/* TCP MD5 Signature with extensions */ +#define TCP_FASTOPEN_KEY	33	/* Set the key for Fast Open (cookie) */ +#define TCP_FASTOPEN_NO_COOKIE	34	/* Enable TFO without a TFO cookie */  struct tcp_repair_opt {  	__u32	opt_code; diff --git a/include/uapi/linux/tcp_metrics.h b/include/uapi/linux/tcp_metrics.h index 80ad90d0cfc2..7cb4a172feed 100644 --- a/include/uapi/linux/tcp_metrics.h +++ b/include/uapi/linux/tcp_metrics.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /* tcp_metrics.h - TCP Metrics Interface */  #ifndef _LINUX_TCP_METRICS_H diff --git a/include/uapi/linux/telephony.h b/include/uapi/linux/telephony.h index f63afe330add..d2c9f7105f4b 100644 --- a/include/uapi/linux/telephony.h +++ b/include/uapi/linux/telephony.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /******************************************************************************   *   *		telephony.h diff --git a/include/uapi/linux/termios.h b/include/uapi/linux/termios.h index 2acd0c1f8a2a..33961d4e4de0 100644 --- a/include/uapi/linux/termios.h +++ b/include/uapi/linux/termios.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_TERMIOS_H  #define _LINUX_TERMIOS_H diff --git a/include/uapi/linux/thermal.h b/include/uapi/linux/thermal.h index ac5535855982..96218378dda8 100644 --- a/include/uapi/linux/thermal.h +++ b/include/uapi/linux/thermal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_THERMAL_H  #define _UAPI_LINUX_THERMAL_H diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h index 09299fcb842a..53f8dd84beb5 100644 --- a/include/uapi/linux/time.h +++ b/include/uapi/linux/time.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_TIME_H  #define _UAPI_LINUX_TIME_H diff --git a/include/uapi/linux/timerfd.h b/include/uapi/linux/timerfd.h index 6fcfaa8da173..dd469944db02 100644 --- a/include/uapi/linux/timerfd.h +++ b/include/uapi/linux/timerfd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  include/linux/timerfd.h   * diff --git a/include/uapi/linux/times.h b/include/uapi/linux/times.h index 87b62615cedd..9c72df662f5f 100644 --- a/include/uapi/linux/times.h +++ b/include/uapi/linux/times.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_TIMES_H  #define _LINUX_TIMES_H diff --git a/include/uapi/linux/tiocl.h b/include/uapi/linux/tiocl.h index 4756862c4ed4..b32acc229024 100644 --- a/include/uapi/linux/tiocl.h +++ b/include/uapi/linux/tiocl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_TIOCL_H  #define _LINUX_TIOCL_H diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h index 5351b08c897a..35f79d1f8c3a 100644 --- a/include/uapi/linux/tipc.h +++ b/include/uapi/linux/tipc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * include/uapi/linux/tipc.h: Header for TIPC socket interface   * @@ -231,6 +232,21 @@ struct sockaddr_tipc {  #define TIPC_SOCK_RECVQ_DEPTH	132	/* Default: none (read only) */  #define TIPC_MCAST_BROADCAST    133     /* Default: TIPC selects. No arg */  #define TIPC_MCAST_REPLICAST    134     /* Default: TIPC selects. No arg */ +#define TIPC_GROUP_JOIN         135     /* Takes struct tipc_group_req* */ +#define TIPC_GROUP_LEAVE        136     /* No argument */ + +/* + * Flag values + */ +#define TIPC_GROUP_LOOPBACK     0x1  /* Receive copy of sent msg when match */ +#define TIPC_GROUP_MEMBER_EVTS  0x2  /* Receive membership events in socket */ + +struct tipc_group_req { +	__u32 type;      /* group id */ +	__u32 instance;  /* member id */ +	__u32 scope;     /* zone/cluster/node */ +	__u32 flags; +};  /*   * Maximum sizes of TIPC bearer-related names (including terminating NULL) diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h index 087b0ef82c07..3f29e3c8ed06 100644 --- a/include/uapi/linux/tipc_config.h +++ b/include/uapi/linux/tipc_config.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * include/uapi/linux/tipc_config.h: Header for TIPC configuration interface   * diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h index f9edd20fe9ba..469aa67a5ecb 100644 --- a/include/uapi/linux/tipc_netlink.h +++ b/include/uapi/linux/tipc_netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * Copyright (c) 2014, Ericsson AB   * All rights reserved. diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h index cc1d21db35d8..293b2cdad88d 100644 --- a/include/uapi/linux/tls.h +++ b/include/uapi/linux/tls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved.   * @@ -34,10 +35,6 @@  #define _UAPI_LINUX_TLS_H  #include <linux/types.h> -#include <asm/byteorder.h> -#include <linux/socket.h> -#include <linux/tcp.h> -#include <net/tcp.h>  /* TLS socket options */  #define TLS_TX			1	/* Set transmit parameters */ diff --git a/include/uapi/linux/toshiba.h b/include/uapi/linux/toshiba.h index c58bf4b5bb26..7f1941935f98 100644 --- a/include/uapi/linux/toshiba.h +++ b/include/uapi/linux/toshiba.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops    *   * Copyright (c) 1996-2000  Jonathan A. Buzzard (jonathan@buzzard.org.uk) diff --git a/include/uapi/linux/tty.h b/include/uapi/linux/tty.h index cf1455396df0..376cccf397be 100644 --- a/include/uapi/linux/tty.h +++ b/include/uapi/linux/tty.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_TTY_H  #define _UAPI_LINUX_TTY_H diff --git a/include/uapi/linux/tty_flags.h b/include/uapi/linux/tty_flags.h index 66e4d8bcb16f..6ac609a00dea 100644 --- a/include/uapi/linux/tty_flags.h +++ b/include/uapi/linux/tty_flags.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_TTY_FLAGS_H  #define _LINUX_TTY_FLAGS_H diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h index 41e5914f0a8e..e3d1d0c78f3c 100644 --- a/include/uapi/linux/types.h +++ b/include/uapi/linux/types.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_TYPES_H  #define _UAPI_LINUX_TYPES_H diff --git a/include/uapi/linux/udf_fs_i.h b/include/uapi/linux/udf_fs_i.h index 3536965913b0..c50863080399 100644 --- a/include/uapi/linux/udf_fs_i.h +++ b/include/uapi/linux/udf_fs_i.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * udf_fs_i.h   * diff --git a/include/uapi/linux/udp.h b/include/uapi/linux/udp.h index 2c8180f9156f..efb7b5991c2f 100644 --- a/include/uapi/linux/udp.h +++ b/include/uapi/linux/udp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * INET		An implementation of the TCP/IP protocol suite for the LINUX   *		operating system.  INET is implemented using the  BSD Socket diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h index aaa86d6bd1dd..cef7534d2d19 100644 --- a/include/uapi/linux/uhid.h +++ b/include/uapi/linux/uhid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  #ifndef __UHID_H_  #define __UHID_H_ diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h index dc652e224b67..c9e677e3af1d 100644 --- a/include/uapi/linux/uinput.h +++ b/include/uapi/linux/uinput.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  User level driver support for input subsystem   * diff --git a/include/uapi/linux/uio.h b/include/uapi/linux/uio.h index 2731d56a5484..059b1a9147f4 100644 --- a/include/uapi/linux/uio.h +++ b/include/uapi/linux/uio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *	Berkeley style UIO structures	-	Alan Cox 1994.   * diff --git a/include/uapi/linux/uleds.h b/include/uapi/linux/uleds.h index 95186578c46e..4d32a39965f8 100644 --- a/include/uapi/linux/uleds.h +++ b/include/uapi/linux/uleds.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Userspace driver support for the LED subsystem   * diff --git a/include/uapi/linux/ultrasound.h b/include/uapi/linux/ultrasound.h index 71339dc531c5..73305bd1dc5a 100644 --- a/include/uapi/linux/ultrasound.h +++ b/include/uapi/linux/ultrasound.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _ULTRASOUND_H_  #define _ULTRASOUND_H_  /* diff --git a/include/uapi/linux/un.h b/include/uapi/linux/un.h index 4f0ab3a548ad..0ad59dc8b686 100644 --- a/include/uapi/linux/un.h +++ b/include/uapi/linux/un.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_UN_H  #define _LINUX_UN_H diff --git a/include/uapi/linux/unistd.h b/include/uapi/linux/unistd.h index aa8d5b5e2e3e..a92361f5d32d 100644 --- a/include/uapi/linux/unistd.h +++ b/include/uapi/linux/unistd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_UNISTD_H_  #define _LINUX_UNISTD_H_ diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h index 1eb0b8dd1830..5c502fdf7a42 100644 --- a/include/uapi/linux/unix_diag.h +++ b/include/uapi/linux/unix_diag.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __UNIX_DIAG_H__  #define __UNIX_DIAG_H__ diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h index a4680a5bf5dd..17a022c5b414 100644 --- a/include/uapi/linux/usb/audio.h +++ b/include/uapi/linux/usb/audio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * <linux/usb/audio.h> -- USB Audio definitions.   * diff --git a/include/uapi/linux/usb/cdc-wdm.h b/include/uapi/linux/usb/cdc-wdm.h index 0dc132e75030..a927c7f6f68a 100644 --- a/include/uapi/linux/usb/cdc-wdm.h +++ b/include/uapi/linux/usb/cdc-wdm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * USB CDC Device Management userspace API definitions   * diff --git a/include/uapi/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h index e2bc417b243b..6d61550959ef 100644 --- a/include/uapi/linux/usb/cdc.h +++ b/include/uapi/linux/usb/cdc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * USB Communications Device Class (CDC) definitions   * diff --git a/include/uapi/linux/usb/ch11.h b/include/uapi/linux/usb/ch11.h index 576c704e3fb8..29c120c88747 100644 --- a/include/uapi/linux/usb/ch11.h +++ b/include/uapi/linux/usb/ch11.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * This file holds Hub protocol constants and data structures that are   * defined in chapter 11 (Hub Specification) of the USB 2.0 specification. diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h index 2a5d63040a0b..41a0a81b01e6 100644 --- a/include/uapi/linux/usb/ch9.h +++ b/include/uapi/linux/usb/ch9.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * This file holds USB constants and structures that are needed for   * USB device APIs.  These are used by the USB device model, which is @@ -143,6 +144,10 @@  #define	TEST_PACKET	4  #define	TEST_FORCE_EN	5 +/* Status Type */ +#define USB_STATUS_TYPE_STANDARD	0 +#define USB_STATUS_TYPE_PTM		1 +  /*   * New Feature Selectors as added by USB 3.0   * See USB 3.0 spec Table 9-7 diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h index f913d08ab7bb..d77ee6b65328 100644 --- a/include/uapi/linux/usb/functionfs.h +++ b/include/uapi/linux/usb/functionfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__LINUX_FUNCTIONFS_H__  #define _UAPI__LINUX_FUNCTIONFS_H__ diff --git a/include/uapi/linux/usb/g_printer.h b/include/uapi/linux/usb/g_printer.h index 6178fde50f74..7fc20e4b82f5 100644 --- a/include/uapi/linux/usb/g_printer.h +++ b/include/uapi/linux/usb/g_printer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * g_printer.h -- Header file for USB Printer gadget driver   * diff --git a/include/uapi/linux/usb/gadgetfs.h b/include/uapi/linux/usb/gadgetfs.h index 0bb12e0d4f8f..835473910a49 100644 --- a/include/uapi/linux/usb/gadgetfs.h +++ b/include/uapi/linux/usb/gadgetfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Filesystem based user-mode API to USB Gadget controller hardware   * diff --git a/include/uapi/linux/usb/midi.h b/include/uapi/linux/usb/midi.h index c8c52e3c91de..de6941ef70ad 100644 --- a/include/uapi/linux/usb/midi.h +++ b/include/uapi/linux/usb/midi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * <linux/usb/midi.h> -- USB MIDI definitions.   * diff --git a/include/uapi/linux/usb/tmc.h b/include/uapi/linux/usb/tmc.h index 2e59d9c50b8d..03f6adc8f35b 100644 --- a/include/uapi/linux/usb/tmc.h +++ b/include/uapi/linux/usb/tmc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany   * Copyright (C) 2008 Novell, Inc. diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h index 69ab695fad2e..ff6cc6cb4227 100644 --- a/include/uapi/linux/usb/video.h +++ b/include/uapi/linux/usb/video.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * USB Video Class definitions.   * diff --git a/include/uapi/linux/usbdevice_fs.h b/include/uapi/linux/usbdevice_fs.h index 0bbfd4abd2e3..70ed5338d447 100644 --- a/include/uapi/linux/usbdevice_fs.h +++ b/include/uapi/linux/usbdevice_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*****************************************************************************/  /* diff --git a/include/uapi/linux/usbip.h b/include/uapi/linux/usbip.h index fa5db30ede36..fd393d908d8a 100644 --- a/include/uapi/linux/usbip.h +++ b/include/uapi/linux/usbip.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *	usbip.h   * diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h index d6d1f65cb3c3..48f1a7c2f1f0 100644 --- a/include/uapi/linux/userfaultfd.h +++ b/include/uapi/linux/userfaultfd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  include/linux/userfaultfd.h   * diff --git a/include/uapi/linux/userio.h b/include/uapi/linux/userio.h index 37d147f0a13a..74c9951d2cd0 100644 --- a/include/uapi/linux/userio.h +++ b/include/uapi/linux/userio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */  /*   * userio: virtual serio device support   * Copyright (C) 2015 Red Hat diff --git a/include/uapi/linux/utime.h b/include/uapi/linux/utime.h index 5cdf673afbdb..fd9aa26b6860 100644 --- a/include/uapi/linux/utime.h +++ b/include/uapi/linux/utime.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_UTIME_H  #define _LINUX_UTIME_H diff --git a/include/uapi/linux/utsname.h b/include/uapi/linux/utsname.h index 872c2df10de7..c99edc662536 100644 --- a/include/uapi/linux/utsname.h +++ b/include/uapi/linux/utsname.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_UTSNAME_H  #define _UAPI_LINUX_UTSNAME_H diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h index 8ef82f433877..5c04130bb524 100644 --- a/include/uapi/linux/uuid.h +++ b/include/uapi/linux/uuid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * UUID/GUID definition   * diff --git a/include/uapi/linux/uvcvideo.h b/include/uapi/linux/uvcvideo.h index 3b081862b9e8..e80b4655d8cd 100644 --- a/include/uapi/linux/uvcvideo.h +++ b/include/uapi/linux/uvcvideo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __LINUX_UVCVIDEO_H_  #define __LINUX_UVCVIDEO_H_ diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h index 5b3f685a2d50..4f7b892377cd 100644 --- a/include/uapi/linux/v4l2-common.h +++ b/include/uapi/linux/v4l2-common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   * include/linux/v4l2-common.h   * diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 31bfc68f86d6..a692623e0236 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   *  Video for Linux Two controls header file   * diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h index da2955154381..b52b67c62562 100644 --- a/include/uapi/linux/v4l2-dv-timings.h +++ b/include/uapi/linux/v4l2-dv-timings.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * V4L2 DV timings header.   * diff --git a/include/uapi/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h index 9cac6325cc7e..6e20de63ec59 100644 --- a/include/uapi/linux/v4l2-mediabus.h +++ b/include/uapi/linux/v4l2-mediabus.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Media Bus API header   * diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h index dbce2b554e02..c95a53e6743c 100644 --- a/include/uapi/linux/v4l2-subdev.h +++ b/include/uapi/linux/v4l2-subdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * V4L2 subdev userspace API   * diff --git a/include/uapi/linux/veth.h b/include/uapi/linux/veth.h index 3354c1eb424e..52b58e587e23 100644 --- a/include/uapi/linux/veth.h +++ b/include/uapi/linux/veth.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef __NET_VETH_H_  #define __NET_VETH_H_ diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index ae461050661a..e3301dbd27d4 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * VFIO API definition   * diff --git a/include/uapi/linux/vfio_ccw.h b/include/uapi/linux/vfio_ccw.h index 34a7f6f9e065..2ec5f367ff78 100644 --- a/include/uapi/linux/vfio_ccw.h +++ b/include/uapi/linux/vfio_ccw.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Interfaces for vfio-ccw   * diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h index 60180c0b5dc6..c51f8e5cc608 100644 --- a/include/uapi/linux/vhost.h +++ b/include/uapi/linux/vhost.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_VHOST_H  #define _LINUX_VHOST_H  /* Userspace interface for in-kernel virtio accelerators. */ diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 185d6a0acc06..1c095b5a99c5 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   *  Video for Linux Two header file   * diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h index b4ed5d895699..68d57c5e99bc 100644 --- a/include/uapi/linux/vm_sockets.h +++ b/include/uapi/linux/vm_sockets.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * VMware vSockets Driver   * diff --git a/include/uapi/linux/vm_sockets_diag.h b/include/uapi/linux/vm_sockets_diag.h new file mode 100644 index 000000000000..14cd7dc5a187 --- /dev/null +++ b/include/uapi/linux/vm_sockets_diag.h @@ -0,0 +1,33 @@ +/* AF_VSOCK sock_diag(7) interface for querying open sockets */ + +#ifndef _UAPI__VM_SOCKETS_DIAG_H__ +#define _UAPI__VM_SOCKETS_DIAG_H__ + +#include <linux/types.h> + +/* Request */ +struct vsock_diag_req { +	__u8	sdiag_family;	/* must be AF_VSOCK */ +	__u8	sdiag_protocol;	/* must be 0 */ +	__u16	pad;		/* must be 0 */ +	__u32	vdiag_states;	/* query bitmap (e.g. 1 << TCP_LISTEN) */ +	__u32	vdiag_ino;	/* must be 0 (reserved) */ +	__u32	vdiag_show;	/* must be 0 (reserved) */ +	__u32	vdiag_cookie[2]; +}; + +/* Response */ +struct vsock_diag_msg { +	__u8	vdiag_family;	/* AF_VSOCK */ +	__u8	vdiag_type;	/* SOCK_STREAM or SOCK_DGRAM */ +	__u8	vdiag_state;	/* sk_state (e.g. TCP_LISTEN) */ +	__u8	vdiag_shutdown; /* local RCV_SHUTDOWN | SEND_SHUTDOWN */ +	__u32   vdiag_src_cid; +	__u32   vdiag_src_port; +	__u32   vdiag_dst_cid; +	__u32   vdiag_dst_port; +	__u32	vdiag_ino; +	__u32	vdiag_cookie[2]; +}; + +#endif /* _UAPI__VM_SOCKETS_DIAG_H__ */ diff --git a/include/uapi/linux/vsockmon.h b/include/uapi/linux/vsockmon.h index a08b522ef597..4a03b893a957 100644 --- a/include/uapi/linux/vsockmon.h +++ b/include/uapi/linux/vsockmon.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_VSOCKMON_H  #define _UAPI_VSOCKMON_H diff --git a/include/uapi/linux/vt.h b/include/uapi/linux/vt.h index f69034887e68..e9d39c48520a 100644 --- a/include/uapi/linux/vt.h +++ b/include/uapi/linux/vt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_VT_H  #define _UAPI_LINUX_VT_H diff --git a/include/uapi/linux/vtpm_proxy.h b/include/uapi/linux/vtpm_proxy.h index 58ac73cd38fe..31a30f33ac46 100644 --- a/include/uapi/linux/vtpm_proxy.h +++ b/include/uapi/linux/vtpm_proxy.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Definitions for the VTPM proxy driver   * Copyright (c) 2015, 2016, IBM Corporation diff --git a/include/uapi/linux/wait.h b/include/uapi/linux/wait.h index 9393eead23e2..ac49a220cf2a 100644 --- a/include/uapi/linux/wait.h +++ b/include/uapi/linux/wait.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_LINUX_WAIT_H  #define _UAPI_LINUX_WAIT_H diff --git a/include/uapi/linux/wanrouter.h b/include/uapi/linux/wanrouter.h index 498d6c12c666..2f1216d00caa 100644 --- a/include/uapi/linux/wanrouter.h +++ b/include/uapi/linux/wanrouter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * wanrouter.h	Legacy declarations kept around until X25 is removed   */ diff --git a/include/uapi/linux/watchdog.h b/include/uapi/linux/watchdog.h index 2babe72870ba..b15cde5c9054 100644 --- a/include/uapi/linux/watchdog.h +++ b/include/uapi/linux/watchdog.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *	Generic watchdog defines. Derived from..   * diff --git a/include/uapi/linux/wireless.h b/include/uapi/linux/wireless.h index d9ecd7c6d691..86eca3208b6b 100644 --- a/include/uapi/linux/wireless.h +++ b/include/uapi/linux/wireless.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * This file define a set of standard wireless extensions   * diff --git a/include/uapi/linux/wmi.h b/include/uapi/linux/wmi.h new file mode 100644 index 000000000000..7a92e9e3d1c0 --- /dev/null +++ b/include/uapi/linux/wmi.h @@ -0,0 +1,73 @@ +/* + *  User API methods for ACPI-WMI mapping driver + * + *  Copyright (C) 2017 Dell, Inc. + * + *  This program is free software; you can redistribute it and/or modify + *  it under the terms of the GNU General Public License version 2 as + *  published by the Free Software Foundation. + */ +#ifndef _UAPI_LINUX_WMI_H +#define _UAPI_LINUX_WMI_H + +#include <linux/ioctl.h> +#include <linux/types.h> + +/* WMI bus will filter all WMI vendor driver requests through this IOC */ +#define WMI_IOC 'W' + +/* All ioctl requests through WMI should declare their size followed by + * relevant data objects + */ +struct wmi_ioctl_buffer { +	__u64	length; +	__u8	data[]; +}; + +/* This structure may be modified by the firmware when we enter + * system management mode through SMM, hence the volatiles + */ +struct calling_interface_buffer { +	__u16 cmd_class; +	__u16 cmd_select; +	volatile __u32 input[4]; +	volatile __u32 output[4]; +} __packed; + +struct dell_wmi_extensions { +	__u32 argattrib; +	__u32 blength; +	__u8 data[]; +} __packed; + +struct dell_wmi_smbios_buffer { +	__u64 length; +	struct calling_interface_buffer std; +	struct dell_wmi_extensions	ext; +} __packed; + +/* Whitelisted smbios class/select commands */ +#define CLASS_TOKEN_READ	0 +#define CLASS_TOKEN_WRITE	1 +#define SELECT_TOKEN_STD	0 +#define SELECT_TOKEN_BAT	1 +#define SELECT_TOKEN_AC		2 +#define CLASS_FLASH_INTERFACE	7 +#define SELECT_FLASH_INTERFACE	3 +#define CLASS_ADMIN_PROP	10 +#define SELECT_ADMIN_PROP	3 +#define CLASS_INFO		17 +#define SELECT_RFKILL		11 +#define SELECT_APP_REGISTRATION	3 +#define SELECT_DOCK		22 + +/* whitelisted tokens */ +#define CAPSULE_EN_TOKEN	0x0461 +#define CAPSULE_DIS_TOKEN	0x0462 +#define WSMT_EN_TOKEN		0x04EC +#define WSMT_DIS_TOKEN		0x04ED + +/* Dell SMBIOS calling IOCTL command used by dell-smbios-wmi */ +#define DELL_WMI_SMBIOS_CMD	_IOWR(WMI_IOC, 0, struct dell_wmi_smbios_buffer) + +#endif diff --git a/include/uapi/linux/x25.h b/include/uapi/linux/x25.h index 810cce6737ea..034b7dc5593a 100644 --- a/include/uapi/linux/x25.h +++ b/include/uapi/linux/x25.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * These are the public elements of the Linux kernel X.25 implementation.   * diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h index 1590c49cae57..c1395b5bd432 100644 --- a/include/uapi/linux/xattr.h +++ b/include/uapi/linux/xattr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*    File: linux/xattr.h @@ -65,6 +66,9 @@  #define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE  #define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP +#define XATTR_APPARMOR_SUFFIX "apparmor" +#define XATTR_NAME_APPARMOR XATTR_SECURITY_PREFIX XATTR_APPARMOR_SUFFIX +  #define XATTR_CAPS_SUFFIX "capability"  #define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h index 5fe7370a2bef..e3af2859188b 100644 --- a/include/uapi/linux/xfrm.h +++ b/include/uapi/linux/xfrm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _LINUX_XFRM_H  #define _LINUX_XFRM_H diff --git a/include/uapi/linux/xilinx-v4l2-controls.h b/include/uapi/linux/xilinx-v4l2-controls.h index fb495b91e800..b6441fe705c5 100644 --- a/include/uapi/linux/xilinx-v4l2-controls.h +++ b/include/uapi/linux/xilinx-v4l2-controls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Xilinx Controls Header   * diff --git a/include/uapi/linux/zorro.h b/include/uapi/linux/zorro.h index 59d021b242ed..9798d1864fd9 100644 --- a/include/uapi/linux/zorro.h +++ b/include/uapi/linux/zorro.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions   * diff --git a/include/uapi/linux/zorro_ids.h b/include/uapi/linux/zorro_ids.h index 74bc53bcfdcf..6e574d7b7d79 100644 --- a/include/uapi/linux/zorro_ids.h +++ b/include/uapi/linux/zorro_ids.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  Zorro board IDs   * diff --git a/include/uapi/misc/cxl.h b/include/uapi/misc/cxl.h index 180d526a55c3..49e8fd08855a 100644 --- a/include/uapi/misc/cxl.h +++ b/include/uapi/misc/cxl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright 2014 IBM Corp.   * diff --git a/include/uapi/mtd/inftl-user.h b/include/uapi/mtd/inftl-user.h index 8376bd1a9e01..8d5044e32e53 100644 --- a/include/uapi/mtd/inftl-user.h +++ b/include/uapi/mtd/inftl-user.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Parts of INFTL headers shared with userspace   * diff --git a/include/uapi/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h index 0ec1da2ef652..aff5b5e59845 100644 --- a/include/uapi/mtd/mtd-abi.h +++ b/include/uapi/mtd/mtd-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.   * diff --git a/include/uapi/mtd/mtd-user.h b/include/uapi/mtd/mtd-user.h index e71d5558cc23..7eca1b3f6b43 100644 --- a/include/uapi/mtd/mtd-user.h +++ b/include/uapi/mtd/mtd-user.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>   * diff --git a/include/uapi/mtd/nftl-user.h b/include/uapi/mtd/nftl-user.h index bdeabd86ad99..b23bdc91c9f1 100644 --- a/include/uapi/mtd/nftl-user.h +++ b/include/uapi/mtd/nftl-user.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>   * diff --git a/include/uapi/mtd/ubi-user.h b/include/uapi/mtd/ubi-user.h index 1927b0d78a99..5b04a494d139 100644 --- a/include/uapi/mtd/ubi-user.h +++ b/include/uapi/mtd/ubi-user.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright © International Business Machines Corp., 2006   * diff --git a/include/uapi/rdma/bnxt_re-abi.h b/include/uapi/rdma/bnxt_re-abi.h index 74018bd18d72..398a514ee446 100644 --- a/include/uapi/rdma/bnxt_re-abi.h +++ b/include/uapi/rdma/bnxt_re-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Broadcom NetXtreme-E RoCE driver.   * diff --git a/include/uapi/rdma/cxgb3-abi.h b/include/uapi/rdma/cxgb3-abi.h index d24eee12128f..d5745e43ae85 100644 --- a/include/uapi/rdma/cxgb3-abi.h +++ b/include/uapi/rdma/cxgb3-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2006 Chelsio, Inc. All rights reserved.   * diff --git a/include/uapi/rdma/cxgb4-abi.h b/include/uapi/rdma/cxgb4-abi.h index 472b15990894..05f71f1bc119 100644 --- a/include/uapi/rdma/cxgb4-abi.h +++ b/include/uapi/rdma/cxgb4-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.   * diff --git a/include/uapi/rdma/hfi/hfi1_ioctl.h b/include/uapi/rdma/hfi/hfi1_ioctl.h index 4791cc8cb09b..9de78c5ee913 100644 --- a/include/uapi/rdma/hfi/hfi1_ioctl.h +++ b/include/uapi/rdma/hfi/hfi1_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   *   * This file is provided under a dual BSD/GPLv2 license.  When using or diff --git a/include/uapi/rdma/hfi/hfi1_user.h b/include/uapi/rdma/hfi/hfi1_user.h index 3f4ee93ae5eb..791bea2f8297 100644 --- a/include/uapi/rdma/hfi/hfi1_user.h +++ b/include/uapi/rdma/hfi/hfi1_user.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */  /*   *   * This file is provided under a dual BSD/GPLv2 license.  When using or diff --git a/include/uapi/rdma/hns-abi.h b/include/uapi/rdma/hns-abi.h index 5d7401963e35..a9c03b0eed57 100644 --- a/include/uapi/rdma/hns-abi.h +++ b/include/uapi/rdma/hns-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2016 Hisilicon Limited.   * diff --git a/include/uapi/rdma/ib_user_cm.h b/include/uapi/rdma/ib_user_cm.h index f79014aa28f9..f4041bdc4d08 100644 --- a/include/uapi/rdma/ib_user_cm.h +++ b/include/uapi/rdma/ib_user_cm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2005 Topspin Communications.  All rights reserved.   * Copyright (c) 2005 Intel Corporation.  All rights reserved. diff --git a/include/uapi/rdma/ib_user_mad.h b/include/uapi/rdma/ib_user_mad.h index 5c7abd859e0f..330a3c5f1aa8 100644 --- a/include/uapi/rdma/ib_user_mad.h +++ b/include/uapi/rdma/ib_user_mad.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2004 Topspin Communications.  All rights reserved.   * Copyright (c) 2005 Voltaire, Inc. All rights reserved. diff --git a/include/uapi/rdma/ib_user_sa.h b/include/uapi/rdma/ib_user_sa.h index cfc7c9ba781e..0d2607f0cd20 100644 --- a/include/uapi/rdma/ib_user_sa.h +++ b/include/uapi/rdma/ib_user_sa.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2005 Intel Corporation.  All rights reserved.   * diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index d4e0b53bfc75..7e11bb8651b6 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2005 Topspin Communications.  All rights reserved.   * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved. @@ -100,7 +101,8 @@ enum {  	IB_USER_VERBS_EX_CMD_MODIFY_WQ,  	IB_USER_VERBS_EX_CMD_DESTROY_WQ,  	IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL, -	IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL +	IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL, +	IB_USER_VERBS_EX_CMD_MODIFY_CQ  };  /* @@ -124,6 +126,12 @@ struct ib_uverbs_comp_event_desc {  	__u64 cq_handle;  }; +struct ib_uverbs_cq_moderation_caps { +	__u16     max_cq_moderation_count; +	__u16     max_cq_moderation_period; +	__u32     reserved; +}; +  /*   * All commands from userspace should start with a __u32 command field   * followed by __u16 in_words and out_words fields (which give the @@ -262,6 +270,7 @@ struct ib_uverbs_ex_query_device_resp {  	__u32  max_wq_type_rq;  	__u32 raw_packet_caps;  	struct ib_uverbs_tm_caps tm_caps; +	struct ib_uverbs_cq_moderation_caps cq_moderation_caps;  };  struct ib_uverbs_query_port { @@ -1150,6 +1159,18 @@ struct ib_uverbs_ex_destroy_rwq_ind_table  {  	__u32 ind_tbl_handle;  }; +struct ib_uverbs_cq_moderation { +	__u16 cq_count; +	__u16 cq_period; +}; + +struct ib_uverbs_ex_modify_cq { +	__u32 cq_handle; +	__u32 attr_mask; +	struct ib_uverbs_cq_moderation attr; +	__u32 reserved; +}; +  #define IB_DEVICE_NAME_MAX 64  #endif /* IB_USER_VERBS_H */ diff --git a/include/uapi/rdma/mlx4-abi.h b/include/uapi/rdma/mlx4-abi.h index c55f60e05f86..224b52b6279c 100644 --- a/include/uapi/rdma/mlx4-abi.h +++ b/include/uapi/rdma/mlx4-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.   * Copyright (c) 2007, 2008 Mellanox Technologies. All rights reserved. diff --git a/include/uapi/rdma/mlx5-abi.h b/include/uapi/rdma/mlx5-abi.h index 1791bf123ba9..a33e0517d3fd 100644 --- a/include/uapi/rdma/mlx5-abi.h +++ b/include/uapi/rdma/mlx5-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.   * @@ -39,6 +40,7 @@  enum {  	MLX5_QP_FLAG_SIGNATURE		= 1 << 0,  	MLX5_QP_FLAG_SCATTER_CQE	= 1 << 1, +	MLX5_QP_FLAG_TUNNEL_OFFLOADS	= 1 << 2,  };  enum { @@ -190,6 +192,32 @@ struct mlx5_ib_sw_parsing_caps {  	__u32 supported_qpts;  }; +struct mlx5_ib_striding_rq_caps { +	__u32 min_single_stride_log_num_of_bytes; +	__u32 max_single_stride_log_num_of_bytes; +	__u32 min_single_wqe_log_num_of_strides; +	__u32 max_single_wqe_log_num_of_strides; + +	/* Corresponding bit will be set if qp type from +	 * 'enum ib_qp_type' is supported, e.g. +	 * supported_qpts |= 1 << IB_QPT_RAW_PACKET +	 */ +	__u32 supported_qpts; +	__u32 reserved; +}; + +enum mlx5_ib_query_dev_resp_flags { +	/* Support 128B CQE compression */ +	MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0, +	MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD  = 1 << 1, +}; + +enum mlx5_ib_tunnel_offloads { +	MLX5_IB_TUNNELED_OFFLOADS_VXLAN  = 1 << 0, +	MLX5_IB_TUNNELED_OFFLOADS_GRE    = 1 << 1, +	MLX5_IB_TUNNELED_OFFLOADS_GENEVE = 1 << 2 +}; +  struct mlx5_ib_query_device_resp {  	__u32	comp_mask;  	__u32	response_length; @@ -198,8 +226,15 @@ struct mlx5_ib_query_device_resp {  	struct	mlx5_ib_cqe_comp_caps cqe_comp_caps;  	struct	mlx5_packet_pacing_caps packet_pacing_caps;  	__u32	mlx5_ib_support_multi_pkt_send_wqes; -	__u32	reserved; +	__u32	flags; /* Use enum mlx5_ib_query_dev_resp_flags */  	struct mlx5_ib_sw_parsing_caps sw_parsing_caps; +	struct mlx5_ib_striding_rq_caps striding_rq_caps; +	__u32	tunnel_offloads_caps; /* enum mlx5_ib_tunnel_offloads */ +	__u32	reserved; +}; + +enum mlx5_ib_create_cq_flags { +	MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD	= 1 << 0,  };  struct mlx5_ib_create_cq { @@ -208,7 +243,7 @@ struct mlx5_ib_create_cq {  	__u32	cqe_size;  	__u8    cqe_comp_en;  	__u8    cqe_comp_res_format; -	__u16	reserved; /* explicit padding (optional on i386) */ +	__u16	flags;  };  struct mlx5_ib_create_cq_resp { @@ -270,7 +305,9 @@ enum mlx5_rx_hash_fields {  	MLX5_RX_HASH_SRC_PORT_TCP	= 1 << 4,  	MLX5_RX_HASH_DST_PORT_TCP	= 1 << 5,  	MLX5_RX_HASH_SRC_PORT_UDP	= 1 << 6, -	MLX5_RX_HASH_DST_PORT_UDP	= 1 << 7 +	MLX5_RX_HASH_DST_PORT_UDP	= 1 << 7, +	/* Save bits for future fields */ +	MLX5_RX_HASH_INNER		= 1 << 31  };  struct mlx5_ib_create_qp_rss { @@ -280,7 +317,7 @@ struct mlx5_ib_create_qp_rss {  	__u8 reserved[6];  	__u8 rx_hash_key[128]; /* valid only for Toeplitz */  	__u32   comp_mask; -	__u32   reserved1; +	__u32	flags;  };  struct mlx5_ib_create_qp_resp { @@ -294,6 +331,10 @@ struct mlx5_ib_alloc_mw {  	__u16	reserved2;  }; +enum mlx5_ib_create_wq_mask { +	MLX5_IB_CREATE_WQ_STRIDING_RQ	= (1 << 0), +}; +  struct mlx5_ib_create_wq {  	__u64   buf_addr;  	__u64   db_addr; @@ -302,7 +343,9 @@ struct mlx5_ib_create_wq {  	__u32   user_index;  	__u32   flags;  	__u32   comp_mask; -	__u32   reserved; +	__u32	single_stride_log_num_of_bytes; +	__u32	single_wqe_log_num_of_strides; +	__u32	two_byte_shift_en;  };  struct mlx5_ib_create_ah_resp { diff --git a/include/uapi/rdma/mthca-abi.h b/include/uapi/rdma/mthca-abi.h index bcbf4ff2f6d1..3020d8a907a7 100644 --- a/include/uapi/rdma/mthca-abi.h +++ b/include/uapi/rdma/mthca-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2005 Topspin Communications.  All rights reserved.   * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved. diff --git a/include/uapi/rdma/nes-abi.h b/include/uapi/rdma/nes-abi.h index 6eb3734394a2..f5b2437aab28 100644 --- a/include/uapi/rdma/nes-abi.h +++ b/include/uapi/rdma/nes-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2006 - 2011 Intel Corporation.  All rights reserved.   * Copyright (c) 2005 Topspin Communications.  All rights reserved. diff --git a/include/uapi/rdma/ocrdma-abi.h b/include/uapi/rdma/ocrdma-abi.h index 9f28191bef4d..ad64a3cea1cd 100644 --- a/include/uapi/rdma/ocrdma-abi.h +++ b/include/uapi/rdma/ocrdma-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /* This file is part of the Emulex RoCE Device Driver for   * RoCE (RDMA over Converged Ethernet) adapters.   * Copyright (C) 2012-2015 Emulex. All rights reserved. diff --git a/include/uapi/rdma/qedr-abi.h b/include/uapi/rdma/qedr-abi.h index 54b64357ab24..261c6db4623e 100644 --- a/include/uapi/rdma/qedr-abi.h +++ b/include/uapi/rdma/qedr-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /* QLogic qedr NIC Driver   * Copyright (c) 2015-2016  QLogic Corporation   * diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h index 861440a87e7c..cc002e316d09 100644 --- a/include/uapi/rdma/rdma_netlink.h +++ b/include/uapi/rdma/rdma_netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_RDMA_NETLINK_H  #define _UAPI_RDMA_NETLINK_H diff --git a/include/uapi/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h index d71da36e3cd6..c83ef0026079 100644 --- a/include/uapi/rdma/rdma_user_cm.h +++ b/include/uapi/rdma/rdma_user_cm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2005-2006 Intel Corporation.  All rights reserved.   * diff --git a/include/uapi/rdma/rdma_user_ioctl.h b/include/uapi/rdma/rdma_user_ioctl.h index 165a27e969d5..03557b5f9aa6 100644 --- a/include/uapi/rdma/rdma_user_ioctl.h +++ b/include/uapi/rdma/rdma_user_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved.   * diff --git a/include/uapi/rdma/rdma_user_rxe.h b/include/uapi/rdma/rdma_user_rxe.h index 1de99cfdaf7d..bdeea948b2f3 100644 --- a/include/uapi/rdma/rdma_user_rxe.h +++ b/include/uapi/rdma/rdma_user_rxe.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.   * diff --git a/include/uapi/rdma/vmw_pvrdma-abi.h b/include/uapi/rdma/vmw_pvrdma-abi.h index c6569b0032ec..aaa352f2f110 100644 --- a/include/uapi/rdma/vmw_pvrdma-abi.h +++ b/include/uapi/rdma/vmw_pvrdma-abi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */  /*   * Copyright (c) 2012-2016 VMware, Inc.  All rights reserved.   * @@ -158,6 +159,8 @@ struct pvrdma_resize_cq {  struct pvrdma_create_srq {  	__u64 buf_addr; +	__u32 buf_size; +	__u32 reserved;  };  struct pvrdma_create_srq_resp { diff --git a/include/uapi/scsi/cxlflash_ioctl.h b/include/uapi/scsi/cxlflash_ioctl.h index 48d107e75cf2..513da47aa5ab 100644 --- a/include/uapi/scsi/cxlflash_ioctl.h +++ b/include/uapi/scsi/cxlflash_ioctl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * CXL Flash Device Driver   * diff --git a/include/uapi/scsi/fc/fc_els.h b/include/uapi/scsi/fc/fc_els.h index 481abbd48e39..b7e0a5ed40de 100644 --- a/include/uapi/scsi/fc/fc_els.h +++ b/include/uapi/scsi/fc/fc_els.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright(c) 2007 Intel Corporation. All rights reserved.   * diff --git a/include/uapi/scsi/fc/fc_fs.h b/include/uapi/scsi/fc/fc_fs.h index dcf314dc2a27..8c0a292a61ed 100644 --- a/include/uapi/scsi/fc/fc_fs.h +++ b/include/uapi/scsi/fc/fc_fs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright(c) 2007 Intel Corporation. All rights reserved.   * diff --git a/include/uapi/scsi/fc/fc_gs.h b/include/uapi/scsi/fc/fc_gs.h index a37346d47eb1..2153f3524555 100644 --- a/include/uapi/scsi/fc/fc_gs.h +++ b/include/uapi/scsi/fc/fc_gs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright(c) 2007 Intel Corporation. All rights reserved.   * diff --git a/include/uapi/scsi/fc/fc_ns.h b/include/uapi/scsi/fc/fc_ns.h index f7751d53f1d3..015e5e1ce8f1 100644 --- a/include/uapi/scsi/fc/fc_ns.h +++ b/include/uapi/scsi/fc/fc_ns.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * Copyright(c) 2007 Intel Corporation. All rights reserved.   * diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h index 3031b900b087..62597d86beed 100644 --- a/include/uapi/scsi/scsi_bsg_fc.h +++ b/include/uapi/scsi/scsi_bsg_fc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  FC Transport BSG Interface   * diff --git a/include/uapi/scsi/scsi_netlink.h b/include/uapi/scsi/scsi_netlink.h index 62b4edab15d3..5ccc2333acab 100644 --- a/include/uapi/scsi/scsi_netlink.h +++ b/include/uapi/scsi/scsi_netlink.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  SCSI Transport Netlink Interface   *    Used for the posting of outbound SCSI transport events diff --git a/include/uapi/scsi/scsi_netlink_fc.h b/include/uapi/scsi/scsi_netlink_fc.h index cbf76e479761..060f563c38a2 100644 --- a/include/uapi/scsi/scsi_netlink_fc.h +++ b/include/uapi/scsi/scsi_netlink_fc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  FC Transport Netlink Interface   * diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h index 7b7659a79ac4..a75e14edc957 100644 --- a/include/uapi/sound/asequencer.h +++ b/include/uapi/sound/asequencer.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Main header file for the ALSA sequencer   *  Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl> diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h index 78014ec56357..69c37ecbff7e 100644 --- a/include/uapi/sound/asoc.h +++ b/include/uapi/sound/asoc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM   * diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 1949923a40bf..c227ccba60ae 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Advanced Linux Sound Architecture - ALSA - Driver   *  Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>, @@ -93,7 +94,7 @@ enum {  	SNDRV_HWDEP_IFACE_VX,		/* Digigram VX cards */  	SNDRV_HWDEP_IFACE_MIXART,	/* Digigram miXart cards */  	SNDRV_HWDEP_IFACE_USX2Y,	/* Tascam US122, US224 & US428 usb */ -	SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */	 +	SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */  	SNDRV_HWDEP_IFACE_BLUETOOTH,	/* Bluetooth audio */  	SNDRV_HWDEP_IFACE_USX2Y_PCM,	/* Tascam US122, US224 & US428 rawusb pcm */  	SNDRV_HWDEP_IFACE_PCXHR,	/* Digigram PCXHR */ @@ -383,7 +384,7 @@ struct snd_mask {  struct snd_pcm_hw_params {  	unsigned int flags; -	struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -  +	struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -  			       SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];  	struct snd_mask mres[5];	/* reserved masks */  	struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - @@ -856,7 +857,7 @@ typedef int __bitwise snd_ctl_elem_iface_t;  #define SNDRV_CTL_ELEM_ACCESS_INACTIVE		(1<<8)	/* control does actually nothing, but may be updated */  #define SNDRV_CTL_ELEM_ACCESS_LOCK		(1<<9)	/* write lock */  #define SNDRV_CTL_ELEM_ACCESS_OWNER		(1<<10)	/* write lock owner */ -#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK	(1<<28)	/* kernel use a TLV callback */  +#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK	(1<<28)	/* kernel use a TLV callback */  #define SNDRV_CTL_ELEM_ACCESS_USER		(1<<29) /* user space element */  /* bits 30 and 31 are obsoleted (for indirect access) */ diff --git a/include/uapi/sound/asound_fm.h b/include/uapi/sound/asound_fm.h index c2a4b967d5be..8471f404ff0b 100644 --- a/include/uapi/sound/asound_fm.h +++ b/include/uapi/sound/asound_fm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  #ifndef __SOUND_ASOUND_FM_H  #define __SOUND_ASOUND_FM_H diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h index e00d8cbfc628..56d95673ce0f 100644 --- a/include/uapi/sound/compress_offload.h +++ b/include/uapi/sound/compress_offload.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   *  compress_offload.h - compress offload header definations   * diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/compress_params.h index 9625484a4a2a..3d4d6de66a17 100644 --- a/include/uapi/sound/compress_params.h +++ b/include/uapi/sound/compress_params.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) AND MIT) */  /*   *  compress_params.h - codec types and parameters for compressed data   *  streaming interface diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h index 5175e166987d..042c5a6f16ee 100644 --- a/include/uapi/sound/emu10k1.h +++ b/include/uapi/sound/emu10k1.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>,   *		     Creative Labs, Inc. diff --git a/include/uapi/sound/firewire.h b/include/uapi/sound/firewire.h index 622900488bdc..f0a547d86679 100644 --- a/include/uapi/sound/firewire.h +++ b/include/uapi/sound/firewire.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_SOUND_FIREWIRE_H_INCLUDED  #define _UAPI_SOUND_FIREWIRE_H_INCLUDED diff --git a/include/uapi/sound/hdsp.h b/include/uapi/sound/hdsp.h index 0909a3843479..5dc0c3db0a4c 100644 --- a/include/uapi/sound/hdsp.h +++ b/include/uapi/sound/hdsp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  #ifndef __SOUND_HDSP_H  #define __SOUND_HDSP_H diff --git a/include/uapi/sound/hdspm.h b/include/uapi/sound/hdspm.h index c4db6f5b306e..a38f3f79beb7 100644 --- a/include/uapi/sound/hdspm.h +++ b/include/uapi/sound/hdspm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  #ifndef __SOUND_HDSPM_H  #define __SOUND_HDSPM_H  /* diff --git a/include/uapi/sound/sb16_csp.h b/include/uapi/sound/sb16_csp.h index 3b96907e2afb..e64851481d88 100644 --- a/include/uapi/sound/sb16_csp.h +++ b/include/uapi/sound/sb16_csp.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *  Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>   *                        Takashi Iwai <tiwai@suse.de> diff --git a/include/uapi/sound/sfnt_info.h b/include/uapi/sound/sfnt_info.h index 1bce7fd1725f..c9a810a6ef48 100644 --- a/include/uapi/sound/sfnt_info.h +++ b/include/uapi/sound/sfnt_info.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  #ifndef __SOUND_SFNT_INFO_H  #define __SOUND_SFNT_INFO_H diff --git a/include/uapi/sound/snd_sst_tokens.h b/include/uapi/sound/snd_sst_tokens.h index f691e421f5e8..326054a72bc7 100644 --- a/include/uapi/sound/snd_sst_tokens.h +++ b/include/uapi/sound/snd_sst_tokens.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  /*   * snd_sst_tokens.h - Intel SST tokens definition   * diff --git a/include/uapi/sound/tlv.h b/include/uapi/sound/tlv.h index b4df440c015b..be5371f09a62 100644 --- a/include/uapi/sound/tlv.h +++ b/include/uapi/sound/tlv.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   *   This program is free software; you can redistribute it and/or modify   *   it under the terms of the GNU General Public License as published by diff --git a/include/uapi/sound/usb_stream.h b/include/uapi/sound/usb_stream.h index cfe8fba00714..95419d8bbc16 100644 --- a/include/uapi/sound/usb_stream.h +++ b/include/uapi/sound/usb_stream.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de>   * diff --git a/include/uapi/video/edid.h b/include/uapi/video/edid.h index 8c0f032014c9..c6030dc10d6b 100644 --- a/include/uapi/video/edid.h +++ b/include/uapi/video/edid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI__linux_video_edid_h__  #define _UAPI__linux_video_edid_h__ diff --git a/include/uapi/video/sisfb.h b/include/uapi/video/sisfb.h index 9250b22b10f8..f1e811951288 100644 --- a/include/uapi/video/sisfb.h +++ b/include/uapi/video/sisfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */  /*   * sisfb.h - definitions for the SiS framebuffer driver   * diff --git a/include/uapi/video/uvesafb.h b/include/uapi/video/uvesafb.h index cee063d723ad..a0d5c9213e92 100644 --- a/include/uapi/video/uvesafb.h +++ b/include/uapi/video/uvesafb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */  #ifndef _UAPI_UVESAFB_H  #define _UAPI_UVESAFB_H diff --git a/include/uapi/xen/evtchn.h b/include/uapi/xen/evtchn.h index cb4aa4bb905e..7fbf732f168f 100644 --- a/include/uapi/xen/evtchn.h +++ b/include/uapi/xen/evtchn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */  /******************************************************************************   * evtchn.h   * diff --git a/include/uapi/xen/gntdev.h b/include/uapi/xen/gntdev.h index d0661977667e..6d1163456c03 100644 --- a/include/uapi/xen/gntdev.h +++ b/include/uapi/xen/gntdev.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */  /******************************************************************************   * gntdev.h   *  diff --git a/include/uapi/xen/privcmd.h b/include/uapi/xen/privcmd.h index 63ee95c9dabb..39d3e7b8e993 100644 --- a/include/uapi/xen/privcmd.h +++ b/include/uapi/xen/privcmd.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */  /******************************************************************************   * privcmd.h   * diff --git a/include/video/aty128.h b/include/video/aty128.h index f0851e3bb7cc..cb6721ebfd34 100644 --- a/include/video/aty128.h +++ b/include/video/aty128.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*  $Id: aty128.h,v 1.1 1999/10/12 11:00:40 geert Exp $   *  linux/drivers/video/aty128.h   *  Register definitions for ATI Rage128 boards diff --git a/include/video/edid.h b/include/video/edid.h index 0cb8b2a92b75..f614371e9116 100644 --- a/include/video/edid.h +++ b/include/video/edid.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __linux_video_edid_h__  #define __linux_video_edid_h__ diff --git a/include/video/iga.h b/include/video/iga.h deleted file mode 100644 index 5a48f16578f8..000000000000 --- a/include/video/iga.h +++ /dev/null @@ -1,24 +0,0 @@ -/* $Id: iga.h,v 1.2 1999/09/11 22:56:31 zaitcev Exp $ - * iga1682.h: Sparc/PCI iga1682 driver constants etc. - * - * Copyleft 1998 V. Roganov and G. Raiko - */ - -#ifndef _IGA1682_H -#define _IGA1682_H 1 - -#define IGA_ATTR_CTL			0x3C0 -#define   IGA_IDX_VGA_OVERSCAN		0x11 -#define DAC_W_INDEX                     0x03C8 -#define DAC_DATA                        0x03C9 -#define IGA_EXT_CNTRL                   0x3CE -#define   IGA_IDX_EXT_BUS_CNTL          0x30 -#define     MEM_SIZE_ALIAS              0x3 -#define     MEM_SIZE_1M                 0x0 -#define     MEM_SIZE_2M                 0x1 -#define     MEM_SIZE_4M                 0x2 -#define     MEM_SIZE_RESERVED           0x3 -#define   IGA_IDX_OVERSCAN_COLOR        0x58 -#define   IGA_IDX_EXT_MEM_2             0x72 - -#endif /* !(_IGA1682_H) */ diff --git a/include/video/mbxfb.h b/include/video/mbxfb.h index ea18961fc5e7..35921cb6d1e5 100644 --- a/include/video/mbxfb.h +++ b/include/video/mbxfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __MBX_FB_H  #define __MBX_FB_H diff --git a/include/video/newport.h b/include/video/newport.h index de980a3b60c9..bcbb3d1b6bf9 100644 --- a/include/video/newport.h +++ b/include/video/newport.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* $Id: newport.h,v 1.5 1999/08/04 06:01:51 ulfc Exp $   *   * newport.h: Defines and register layout for NEWPORT graphics diff --git a/include/video/radeon.h b/include/video/radeon.h index 56b188abfb54..005eae19ec09 100644 --- a/include/video/radeon.h +++ b/include/video/radeon.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _RADEON_H  #define _RADEON_H diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h index 2605fa8adb9c..f706b0fed399 100644 --- a/include/video/sh_mobile_lcdc.h +++ b/include/video/sh_mobile_lcdc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __ASM_SH_MOBILE_LCDC_H__  #define __ASM_SH_MOBILE_LCDC_H__ diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h index 062e6e7f955c..f4efc21e205d 100644 --- a/include/video/sh_mobile_meram.h +++ b/include/video/sh_mobile_meram.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __VIDEO_SH_MOBILE_MERAM_H__  #define __VIDEO_SH_MOBILE_MERAM_H__ diff --git a/include/video/sstfb.h b/include/video/sstfb.h index c449eace12cd..28384f354773 100644 --- a/include/video/sstfb.h +++ b/include/video/sstfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * linux/drivers/video/sstfb.h -- voodoo graphics frame buffer   * diff --git a/include/video/tdfx.h b/include/video/tdfx.h index 69674b94bb68..6144633acc47 100644 --- a/include/video/tdfx.h +++ b/include/video/tdfx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _TDFX_H  #define _TDFX_H diff --git a/include/video/trident.h b/include/video/trident.h index b6ce19d1b61b..5ccc0d6a070c 100644 --- a/include/video/trident.h +++ b/include/video/trident.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef TRIDENTFB_DEBUG  #define TRIDENTFB_DEBUG 0 diff --git a/include/video/udlfb.h b/include/video/udlfb.h index 3ea90aea5617..1252a7a89bc0 100644 --- a/include/video/udlfb.h +++ b/include/video/udlfb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef UDLFB_H  #define UDLFB_H diff --git a/include/video/uvesafb.h b/include/video/uvesafb.h index 30f53625415c..8d2a3bfc8dac 100644 --- a/include/video/uvesafb.h +++ b/include/video/uvesafb.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _UVESAFB_H  #define _UVESAFB_H diff --git a/include/xen/arm/hypervisor.h b/include/xen/arm/hypervisor.h index 44b587b49904..2982571f7cc1 100644 --- a/include/xen/arm/hypervisor.h +++ b/include/xen/arm/hypervisor.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_ARM_XEN_HYPERVISOR_H  #define _ASM_ARM_XEN_HYPERVISOR_H diff --git a/include/xen/arm/interface.h b/include/xen/arm/interface.h index 75d596862892..c3eada2642aa 100644 --- a/include/xen/arm/interface.h +++ b/include/xen/arm/interface.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * Guest OS interface to ARM Xen.   * diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h index b1b4ecdf329a..59a260712a56 100644 --- a/include/xen/arm/page-coherent.h +++ b/include/xen/arm/page-coherent.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_ARM_XEN_PAGE_COHERENT_H  #define _ASM_ARM_XEN_PAGE_COHERENT_H diff --git a/include/xen/arm/page.h b/include/xen/arm/page.h index 6adc2a955340..f77dcbcba5a6 100644 --- a/include/xen/arm/page.h +++ b/include/xen/arm/page.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_ARM_XEN_PAGE_H  #define _ASM_ARM_XEN_PAGE_H diff --git a/include/xen/balloon.h b/include/xen/balloon.h index 8906361bb50c..4914b93a23f2 100644 --- a/include/xen/balloon.h +++ b/include/xen/balloon.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * Xen balloon functionality   */ diff --git a/include/xen/events.h b/include/xen/events.h index f442ca5fcd82..c3e6bc643a7b 100644 --- a/include/xen/events.h +++ b/include/xen/events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XEN_EVENTS_H  #define _XEN_EVENTS_H diff --git a/include/xen/features.h b/include/xen/features.h index 27292d4d2a6a..e4cb464386a9 100644 --- a/include/xen/features.h +++ b/include/xen/features.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * features.h   * diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 34b1379f9777..2e37741f6b8d 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h @@ -174,10 +174,13 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,  	unmap->dev_bus_addr = 0;  } -int arch_gnttab_init(unsigned long nr_shared); +int arch_gnttab_init(unsigned long nr_shared, unsigned long nr_status);  int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,  			   unsigned long max_nr_gframes,  			   void **__shared); +int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, +			   unsigned long max_nr_gframes, +			   grant_status_t **__shared);  void arch_gnttab_unmap(void *shared, unsigned long nr_gframes);  struct grant_frames { diff --git a/include/xen/hvc-console.h b/include/xen/hvc-console.h index b62dfef15f61..d8949d5e227d 100644 --- a/include/xen/hvc-console.h +++ b/include/xen/hvc-console.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef XEN_HVC_CONSOLE_H  #define XEN_HVC_CONSOLE_H diff --git a/include/xen/hvm.h b/include/xen/hvm.h index 63917a8de3b0..0b15f8cb17fc 100644 --- a/include/xen/hvm.h +++ b/include/xen/hvm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /* Simple wrappers around HVM functions */  #ifndef XEN_HVM_H__  #define XEN_HVM_H__ diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/event_channel.h index 7e6acef5415b..45650c9a06d5 100644 --- a/include/xen/interface/event_channel.h +++ b/include/xen/interface/event_channel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * event_channel.h   * diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h index 6ad3d110bb81..9b0eb574f0d1 100644 --- a/include/xen/interface/features.h +++ b/include/xen/interface/features.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * features.h   * diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index 8b8cfadf7833..5e40041c7e95 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * blkif.h   * diff --git a/include/xen/interface/io/console.h b/include/xen/interface/io/console.h index e563de70f784..85ca8b02695a 100644 --- a/include/xen/interface/io/console.h +++ b/include/xen/interface/io/console.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * console.h   * diff --git a/include/xen/interface/io/protocols.h b/include/xen/interface/io/protocols.h index 545a14ba0bb3..6a89dc1bf225 100644 --- a/include/xen/interface/io/protocols.h +++ b/include/xen/interface/io/protocols.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __XEN_PROTOCOLS_H__  #define __XEN_PROTOCOLS_H__ diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h index e547088ceb0e..3f40501fc60b 100644 --- a/include/xen/interface/io/ring.h +++ b/include/xen/interface/io/ring.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * ring.h   * diff --git a/include/xen/interface/io/xenbus.h b/include/xen/interface/io/xenbus.h index 9fda532973a5..aaf2951b1cce 100644 --- a/include/xen/interface/io/xenbus.h +++ b/include/xen/interface/io/xenbus.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*****************************************************************************   * xenbus.h   * diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h index 794deb07eb53..1517c7e93a3a 100644 --- a/include/xen/interface/io/xs_wire.h +++ b/include/xen/interface/io/xs_wire.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * Details of the "wire" protocol between Xen Store Daemon and client   * library or guest kernel. diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h index 9aa8988cb340..583dd93b3016 100644 --- a/include/xen/interface/memory.h +++ b/include/xen/interface/memory.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * memory.h   * diff --git a/include/xen/interface/nmi.h b/include/xen/interface/nmi.h index b47d9d06fade..73d9b0a2974e 100644 --- a/include/xen/interface/nmi.h +++ b/include/xen/interface/nmi.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * nmi.h   * diff --git a/include/xen/interface/vcpu.h b/include/xen/interface/vcpu.h index 98188c87f5c1..504c71601511 100644 --- a/include/xen/interface/vcpu.h +++ b/include/xen/interface/vcpu.h @@ -178,4 +178,46 @@ DEFINE_GUEST_HANDLE_STRUCT(vcpu_register_vcpu_info);  /* Send an NMI to the specified VCPU. @extra_arg == NULL. */  #define VCPUOP_send_nmi             11 + +/* + * Get the physical ID information for a pinned vcpu's underlying physical + * processor.  The physical ID informmation is architecture-specific. + * On x86: id[31:0]=apic_id, id[63:32]=acpi_id. + * This command returns -EINVAL if it is not a valid operation for this VCPU. + */ +#define VCPUOP_get_physid           12 /* arg == vcpu_get_physid_t */ +struct vcpu_get_physid { +	uint64_t phys_id; +}; +DEFINE_GUEST_HANDLE_STRUCT(vcpu_get_physid); +#define xen_vcpu_physid_to_x86_apicid(physid) ((uint32_t)(physid)) +#define xen_vcpu_physid_to_x86_acpiid(physid) ((uint32_t)((physid) >> 32)) + +/* + * Register a memory location to get a secondary copy of the vcpu time + * parameters.  The master copy still exists as part of the vcpu shared + * memory area, and this secondary copy is updated whenever the master copy + * is updated (and using the same versioning scheme for synchronisation). + * + * The intent is that this copy may be mapped (RO) into userspace so + * that usermode can compute system time using the time info and the + * tsc.  Usermode will see an array of vcpu_time_info structures, one + * for each vcpu, and choose the right one by an existing mechanism + * which allows it to get the current vcpu number (such as via a + * segment limit).  It can then apply the normal algorithm to compute + * system time from the tsc. + * + * @extra_arg == pointer to vcpu_register_time_info_memory_area structure. + */ +#define VCPUOP_register_vcpu_time_memory_area   13 +DEFINE_GUEST_HANDLE_STRUCT(vcpu_time_info); +struct vcpu_register_time_memory_area { +	union { +		GUEST_HANDLE(vcpu_time_info) h; +		struct pvclock_vcpu_time_info *v; +		uint64_t p; +	} addr; +}; +DEFINE_GUEST_HANDLE_STRUCT(vcpu_register_time_memory_area); +  #endif /* __XEN_PUBLIC_VCPU_H__ */ diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h index 145f12f9ecec..8772b552c006 100644 --- a/include/xen/interface/version.h +++ b/include/xen/interface/version.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /******************************************************************************   * version.h   * diff --git a/include/xen/interface/xenpmu.h b/include/xen/interface/xenpmu.h index 139efc91bceb..ad603eab24b3 100644 --- a/include/xen/interface/xenpmu.h +++ b/include/xen/interface/xenpmu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __XEN_PUBLIC_XENPMU_H__  #define __XEN_PUBLIC_XENPMU_H__ diff --git a/include/xen/page.h b/include/xen/page.h index 064194f6453e..df6d6b6ec66e 100644 --- a/include/xen/page.h +++ b/include/xen/page.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XEN_PAGE_H  #define _XEN_PAGE_H diff --git a/include/xen/platform_pci.h b/include/xen/platform_pci.h index 5c52b5583917..e51e7cb71a85 100644 --- a/include/xen/platform_pci.h +++ b/include/xen/platform_pci.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XEN_PLATFORM_PCI_H  #define _XEN_PLATFORM_PCI_H diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h index ed2de363da33..5e4b83f83dbc 100644 --- a/include/xen/swiotlb-xen.h +++ b/include/xen/swiotlb-xen.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef __LINUX_SWIOTLB_XEN_H  #define __LINUX_SWIOTLB_XEN_H diff --git a/include/xen/tmem.h b/include/xen/tmem.h index 3930a90045ff..c80bafe31f14 100644 --- a/include/xen/tmem.h +++ b/include/xen/tmem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XEN_TMEM_H  #define _XEN_TMEM_H diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index 218e6aae5433..fd23e42c6024 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef INCLUDE_XEN_OPS_H  #define INCLUDE_XEN_OPS_H @@ -32,6 +33,7 @@ void xen_resume_notifier_unregister(struct notifier_block *nb);  bool xen_vcpu_stolen(int vcpu);  void xen_setup_runstate_info(int cpu);  void xen_time_setup_guest(void); +void xen_manage_runstate_time(int action);  void xen_get_runstate_snapshot(struct vcpu_runstate_info *res);  u64 xen_steal_clock(int cpu); @@ -103,6 +105,8 @@ int xen_remap_domain_gfn_range(struct vm_area_struct *vma,  			       struct page **pages);  int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,  			       int numpgs, struct page **pages); + +#ifdef CONFIG_XEN_AUTO_XLATE  int xen_xlate_remap_gfn_array(struct vm_area_struct *vma,  			      unsigned long addr,  			      xen_pfn_t *gfn, int nr, @@ -111,6 +115,28 @@ int xen_xlate_remap_gfn_array(struct vm_area_struct *vma,  			      struct page **pages);  int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma,  			      int nr, struct page **pages); +#else +/* + * These two functions are called from arch/x86/xen/mmu.c and so stubs + * are needed for a configuration not specifying CONFIG_XEN_AUTO_XLATE. + */ +static inline int xen_xlate_remap_gfn_array(struct vm_area_struct *vma, +					    unsigned long addr, +					    xen_pfn_t *gfn, int nr, +					    int *err_ptr, pgprot_t prot, +					    unsigned int domid, +					    struct page **pages) +{ +	return -EOPNOTSUPP; +} + +static inline int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma, +					    int nr, struct page **pages) +{ +	return -EOPNOTSUPP; +} +#endif +  int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr,  				  unsigned long nr_grant_frames); diff --git a/include/xen/xen.h b/include/xen/xen.h index 28c59ca529d7..9d4340c907d1 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _XEN_XEN_H  #define _XEN_XEN_H  | 

