aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h25
-rw-r--r--include/linux/ahci_platform.h4
-rw-r--r--include/linux/arm-smccc.h38
-rw-r--r--include/linux/ascii85.h38
-rw-r--r--include/linux/audit.h5
-rw-r--r--include/linux/backing-dev-defs.h3
-rw-r--r--include/linux/backing-dev.h4
-rw-r--r--include/linux/backlight.h1
-rw-r--r--include/linux/bio.h19
-rw-r--r--include/linux/bitfield.h9
-rw-r--r--include/linux/bitmap.h8
-rw-r--r--include/linux/bitops.h3
-rw-r--r--include/linux/blk-cgroup.h191
-rw-r--r--include/linux/blk-mq.h4
-rw-r--r--include/linux/blk_types.h27
-rw-r--r--include/linux/blkdev.h66
-rw-r--r--include/linux/bootmem.h17
-rw-r--r--include/linux/bpf-cgroup.h54
-rw-r--r--include/linux/bpf.h79
-rw-r--r--include/linux/bpf_types.h9
-rw-r--r--include/linux/brcmphy.h1
-rw-r--r--include/linux/build-salt.h20
-rw-r--r--include/linux/can/dev.h7
-rw-r--r--include/linux/cdrom.h3
-rw-r--r--include/linux/ceph/auth.h8
-rw-r--r--include/linux/ceph/ceph_features.h7
-rw-r--r--include/linux/ceph/decode.h18
-rw-r--r--include/linux/ceph/messenger.h8
-rw-r--r--include/linux/ceph/msgr.h2
-rw-r--r--include/linux/ceph/osd_client.h10
-rw-r--r--include/linux/ceph/pagelist.h2
-rw-r--r--include/linux/cgroup-defs.h3
-rw-r--r--include/linux/cgroup.h30
-rw-r--r--include/linux/clk-provider.h26
-rw-r--r--include/linux/clk.h33
-rw-r--r--include/linux/clk/at91_pmc.h15
-rw-r--r--include/linux/cma.h2
-rw-r--r--include/linux/compat.h11
-rw-r--r--include/linux/compiler-clang.h20
-rw-r--r--include/linux/compiler-gcc.h173
-rw-r--r--include/linux/compiler-intel.h13
-rw-r--r--include/linux/compiler.h21
-rw-r--r--include/linux/compiler_types.h263
-rw-r--r--include/linux/console.h19
-rw-r--r--include/linux/console_struct.h5
-rw-r--r--include/linux/coresight.h68
-rw-r--r--include/linux/cpu.h23
-rw-r--r--include/linux/cpuhotplug.h2
-rw-r--r--include/linux/cpumask.h18
-rw-r--r--include/linux/crash_core.h2
-rw-r--r--include/linux/crc32poly.h20
-rw-r--r--include/linux/crc64.h11
-rw-r--r--include/linux/cred.h15
-rw-r--r--include/linux/crypto.h5
-rw-r--r--include/linux/dax.h13
-rw-r--r--include/linux/dcache.h18
-rw-r--r--include/linux/device.h135
-rw-r--r--include/linux/dm-kcopyd.h12
-rw-r--r--include/linux/dma-buf.h21
-rw-r--r--include/linux/dma-contiguous.h4
-rw-r--r--include/linux/dma-direction.h6
-rw-r--r--include/linux/dma-fence.h32
-rw-r--r--include/linux/dma-mapping.h9
-rw-r--r--include/linux/dma-noncoherent.h8
-rw-r--r--include/linux/dma/pxa-dma.h9
-rw-r--r--include/linux/dma/xilinx_dma.h2
-rw-r--r--include/linux/dmaengine.h6
-rw-r--r--include/linux/dmar.h5
-rw-r--r--include/linux/etherdevice.h3
-rw-r--r--include/linux/export.h64
-rw-r--r--include/linux/f2fs_fs.h5
-rw-r--r--include/linux/fb.h10
-rw-r--r--include/linux/file.h8
-rw-r--r--include/linux/filter.h52
-rw-r--r--include/linux/fpga/fpga-mgr.h24
-rw-r--r--include/linux/fpga/fpga-region.h2
-rw-r--r--include/linux/fs.h77
-rw-r--r--include/linux/fsi-sbefifo.h33
-rw-r--r--include/linux/fsi.h12
-rw-r--r--include/linux/fsl/ptp_qoriq.h44
-rw-r--r--include/linux/fsnotify.h14
-rw-r--r--include/linux/fsnotify_backend.h52
-rw-r--r--include/linux/ftrace.h17
-rw-r--r--include/linux/fwnode.h2
-rw-r--r--include/linux/genhd.h14
-rw-r--r--include/linux/gfp.h291
-rw-r--r--include/linux/gnss.h75
-rw-r--r--include/linux/goldfish.h14
-rw-r--r--include/linux/gpio.h2
-rw-r--r--include/linux/gpio/aspeed.h15
-rw-r--r--include/linux/gpio/consumer.h14
-rw-r--r--include/linux/gpio/driver.h3
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/hid.h17
-rw-r--r--include/linux/huge_mm.h14
-rw-r--r--include/linux/hugetlb.h5
-rw-r--r--include/linux/hwmon.h32
-rw-r--r--include/linux/hwspinlock.h37
-rw-r--r--include/linux/hyperv.h33
-rw-r--r--include/linux/i2c.h52
-rw-r--r--include/linux/idle_inject.h29
-rw-r--r--include/linux/idr.h79
-rw-r--r--include/linux/ieee80211.h437
-rw-r--r--include/linux/if_team.h18
-rw-r--r--include/linux/ima.h11
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init.h44
-rw-r--r--include/linux/init_task.h9
-rw-r--r--include/linux/inotify.h2
-rw-r--r--include/linux/integrity.h13
-rw-r--r--include/linux/intel-iommu.h80
-rw-r--r--include/linux/iomap.h47
-rw-r--r--include/linux/iommu.h23
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/ipc_namespace.h5
-rw-r--r--include/linux/irqchip/arm-gic-v3.h10
-rw-r--r--include/linux/irqchip/arm-gic.h11
-rw-r--r--include/linux/irqflags.h15
-rw-r--r--include/linux/jiffies.h5
-rw-r--r--include/linux/joystick.h4
-rw-r--r--include/linux/jump_label.h6
-rw-r--r--include/linux/kasan.h13
-rw-r--r--include/linux/kcore.h2
-rw-r--r--include/linux/kernel.h35
-rw-r--r--include/linux/kernfs.h28
-rw-r--r--include/linux/kobject.h21
-rw-r--r--include/linux/kvm_host.h28
-rw-r--r--include/linux/leds.h36
-rw-r--r--include/linux/libata.h7
-rw-r--r--include/linux/list.h30
-rw-r--r--include/linux/list_lru.h43
-rw-r--r--include/linux/lockd/lockd.h4
-rw-r--r--include/linux/lockdep.h6
-rw-r--r--include/linux/lsm_hooks.h8
-rw-r--r--include/linux/mailbox/mtk-cmdq-mailbox.h77
-rw-r--r--include/linux/memblock.h76
-rw-r--r--include/linux/memcontrol.h105
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--include/linux/mfd/as3722.h3
-rw-r--r--include/linux/mfd/cros_ec.h2
-rw-r--r--include/linux/mfd/cros_ec_commands.h229
-rw-r--r--include/linux/mfd/da9063/core.h15
-rw-r--r--include/linux/mfd/madera/core.h187
-rw-r--r--include/linux/mfd/madera/pdata.h59
-rw-r--r--include/linux/mfd/madera/registers.h3968
-rw-r--r--include/linux/mfd/rave-sp.h1
-rw-r--r--include/linux/mfd/rohm-bd718x7.h332
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h3
-rw-r--r--include/linux/mfd/tmio.h3
-rw-r--r--include/linux/mfd/wm8994/pdata.h6
-rw-r--r--include/linux/mlx4/device.h8
-rw-r--r--include/linux/mlx5/device.h24
-rw-r--r--include/linux/mlx5/driver.h15
-rw-r--r--include/linux/mlx5/fs.h7
-rw-r--r--include/linux/mlx5/mlx5_ifc.h191
-rw-r--r--include/linux/mlx5/mlx5_ifc_fpga.h1
-rw-r--r--include/linux/mlx5/vport.h2
-rw-r--r--include/linux/mm.h37
-rw-r--r--include/linux/mm_types.h5
-rw-r--r--include/linux/mmc/host.h10
-rw-r--r--include/linux/mmc/mmc.h2
-rw-r--r--include/linux/mmu_notifier.h33
-rw-r--r--include/linux/mmzone.h57
-rw-r--r--include/linux/mod_devicetable.h15
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/mroute_base.h3
-rw-r--r--include/linux/mtd/mtd.h8
-rw-r--r--include/linux/mtd/rawnand.h126
-rw-r--r--include/linux/mtd/spi-nor.h1
-rw-r--r--include/linux/mtd/spinand.h421
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/net_dim.h1
-rw-r--r--include/linux/netdev_features.h2
-rw-r--r--include/linux/netdevice.h219
-rw-r--r--include/linux/netfilter.h37
-rw-r--r--include/linux/netfilter/nfnetlink.h1
-rw-r--r--include/linux/netfilter/nfnetlink_osf.h (renamed from include/linux/netfilter/nf_osf.h)23
-rw-r--r--include/linux/netfilter_bridge.h11
-rw-r--r--include/linux/netfilter_ipv4.h11
-rw-r--r--include/linux/netfilter_ipv6.h5
-rw-r--r--include/linux/netlink.h1
-rw-r--r--include/linux/nfs4.h9
-rw-r--r--include/linux/nfs_fs.h11
-rw-r--r--include/linux/nfs_fs_sb.h4
-rw-r--r--include/linux/nfs_xdr.h15
-rw-r--r--include/linux/node.h12
-rw-r--r--include/linux/nodemask.h2
-rw-r--r--include/linux/nvme.h72
-rw-r--r--include/linux/of.h33
-rw-r--r--include/linux/of_iommu.h4
-rw-r--r--include/linux/omap-mailbox.h5
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/openvswitch.h5
-rw-r--r--include/linux/overflow.h31
-rw-r--r--include/linux/page-flags.h5
-rw-r--r--include/linux/page_ext.h15
-rw-r--r--include/linux/pci-dma-compat.h8
-rw-r--r--include/linux/pci-epc.h16
-rw-r--r--include/linux/pci-epf.h1
-rw-r--r--include/linux/pci.h64
-rw-r--r--include/linux/pci_hotplug.h15
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/percpu.h2
-rw-r--r--include/linux/percpu_ida.h83
-rw-r--r--include/linux/perf/arm_pmu.h11
-rw-r--r--include/linux/phy.h12
-rw-r--r--include/linux/phylink.h1
-rw-r--r--include/linux/pid.h11
-rw-r--r--include/linux/pinctrl/pinconf.h3
-rw-r--r--include/linux/platform_data/ams-delta-fiq.h58
-rw-r--r--include/linux/platform_data/bt-nokia-h4p.h38
-rw-r--r--include/linux/platform_data/gpio-davinci.h3
-rw-r--r--include/linux/platform_data/i2c-hid.h7
-rw-r--r--include/linux/platform_data/i2c-ocores.h2
-rw-r--r--include/linux/platform_data/ina2xx.h2
-rw-r--r--include/linux/platform_data/jz4740/jz4740_nand.h34
-rw-r--r--include/linux/platform_data/media/sii9234.h24
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h2
-rw-r--r--include/linux/platform_data/mmp_dma.h4
-rw-r--r--include/linux/platform_data/mtd-davinci-aemif.h1
-rw-r--r--include/linux/platform_data/mtd-orion_nand.h1
-rw-r--r--include/linux/platform_data/pm33xx.h29
-rw-r--r--include/linux/platform_data/sh_ipmmu.h18
-rw-r--r--include/linux/platform_data/ti-sysc.h1
-rw-r--r--include/linux/platform_data/txx9/ndfmc.h30
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm_domain.h15
-rw-r--r--include/linux/power_supply.h1
-rw-r--r--include/linux/preempt.h2
-rw-r--r--include/linux/printk.h10
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/ptrace.h2
-rw-r--r--include/linux/pxa2xx_ssp.h10
-rw-r--r--include/linux/qcom_scm.h4
-rw-r--r--include/linux/qed/qed_eth_if.h6
-rw-r--r--include/linux/qed/qed_if.h15
-rw-r--r--include/linux/quota.h8
-rw-r--r--include/linux/random.h3
-rw-r--r--include/linux/reciprocal_div.h68
-rw-r--r--include/linux/regmap.h54
-rw-r--r--include/linux/regulator/driver.h4
-rw-r--r--include/linux/regulator/pfuze100.h11
-rw-r--r--include/linux/remoteproc.h19
-rw-r--r--include/linux/rfkill.h20
-rw-r--r--include/linux/rhashtable-types.h137
-rw-r--r--include/linux/rhashtable.h164
-rw-r--r--include/linux/ring_buffer.h4
-rw-r--r--include/linux/rtc.h21
-rw-r--r--include/linux/sbitmap.h2
-rw-r--r--include/linux/sched.h47
-rw-r--r--include/linux/sched/mm.h37
-rw-r--r--include/linux/sched/signal.h51
-rw-r--r--include/linux/sched/sysctl.h1
-rw-r--r--include/linux/sched/user.h5
-rw-r--r--include/linux/sctp.h7
-rw-r--r--include/linux/security.h32
-rw-r--r--include/linux/selection.h6
-rw-r--r--include/linux/serial_8250.h3
-rw-r--r--include/linux/serial_core.h7
-rw-r--r--include/linux/set_memory.h14
-rw-r--r--include/linux/sfp.h72
-rw-r--r--include/linux/shrinker.h21
-rw-r--r--include/linux/signal.h10
-rw-r--r--include/linux/skbuff.h19
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/slimbus.h60
-rw-r--r--include/linux/soc/qcom/llcc-qcom.h180
-rw-r--r--include/linux/soc/qcom/mdt_loader.h4
-rw-r--r--include/linux/soc/renesas/rcar-sysc.h13
-rw-r--r--include/linux/soc/samsung/exynos-regs-pmu.h8
-rw-r--r--include/linux/spi/adi_spi3.h254
-rw-r--r--include/linux/spi/spi-mem.h18
-rw-r--r--include/linux/spi/spi_bitbang.h5
-rw-r--r--include/linux/spinlock.h17
-rw-r--r--include/linux/srcu.h5
-rw-r--r--include/linux/ssb/ssb.h2
-rw-r--r--include/linux/stmmac.h1
-rw-r--r--include/linux/sunrpc/auth.h5
-rw-r--r--include/linux/sunrpc/clnt.h1
-rw-r--r--include/linux/sunrpc/metrics.h4
-rw-r--r--include/linux/sunrpc/svc.h4
-rw-r--r--include/linux/sunrpc/svcauth.h3
-rw-r--r--include/linux/suspend.h2
-rw-r--r--include/linux/swap.h13
-rw-r--r--include/linux/swapfile.h2
-rw-r--r--include/linux/swapops.h15
-rw-r--r--include/linux/switchtec.h4
-rw-r--r--include/linux/syscalls.h11
-rw-r--r--include/linux/sysfs.h20
-rw-r--r--include/linux/t10-pi.h24
-rw-r--r--include/linux/tcp.h18
-rw-r--r--include/linux/time32.h15
-rw-r--r--include/linux/timekeeping.h19
-rw-r--r--include/linux/tpm.h7
-rw-r--r--include/linux/tracehook.h2
-rw-r--r--include/linux/tracepoint.h59
-rw-r--r--include/linux/tty_ldisc.h4
-rw-r--r--include/linux/udp.h4
-rw-r--r--include/linux/uprobes.h2
-rw-r--r--include/linux/usb/audio-v3.h19
-rw-r--r--include/linux/usb/hcd.h1
-rw-r--r--include/linux/usb/pd.h1
-rw-r--r--include/linux/usb/tcpm.h11
-rw-r--r--include/linux/usb/typec.h55
-rw-r--r--include/linux/usb/typec_altmode.h160
-rw-r--r--include/linux/usb/typec_dp.h95
-rw-r--r--include/linux/usb/typec_mux.h2
-rw-r--r--include/linux/userfaultfd_k.h5
-rw-r--r--include/linux/verification.h6
-rw-r--r--include/linux/vga_switcheroo.h8
-rw-r--r--include/linux/virtio_config.h7
-rw-r--r--include/linux/vmacache.h6
-rw-r--r--include/linux/w1.h2
-rw-r--r--include/linux/wkup_m3_ipc.h9
-rw-r--r--include/linux/ww_mutex.h45
315 files changed, 10899 insertions, 2237 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index e54f40974eb0..de8d3d3fa651 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1058,27 +1058,20 @@ static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
1058 1058
1059/* Device properties */ 1059/* Device properties */
1060 1060
1061#define MAX_ACPI_REFERENCE_ARGS 8
1062struct acpi_reference_args {
1063 struct acpi_device *adev;
1064 size_t nargs;
1065 u64 args[MAX_ACPI_REFERENCE_ARGS];
1066};
1067
1068#ifdef CONFIG_ACPI 1061#ifdef CONFIG_ACPI
1069int acpi_dev_get_property(const struct acpi_device *adev, const char *name, 1062int acpi_dev_get_property(const struct acpi_device *adev, const char *name,
1070 acpi_object_type type, const union acpi_object **obj); 1063 acpi_object_type type, const union acpi_object **obj);
1071int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, 1064int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1072 const char *name, size_t index, size_t num_args, 1065 const char *name, size_t index, size_t num_args,
1073 struct acpi_reference_args *args); 1066 struct fwnode_reference_args *args);
1074 1067
1075static inline int acpi_node_get_property_reference( 1068static inline int acpi_node_get_property_reference(
1076 const struct fwnode_handle *fwnode, 1069 const struct fwnode_handle *fwnode,
1077 const char *name, size_t index, 1070 const char *name, size_t index,
1078 struct acpi_reference_args *args) 1071 struct fwnode_reference_args *args)
1079{ 1072{
1080 return __acpi_node_get_property_reference(fwnode, name, index, 1073 return __acpi_node_get_property_reference(fwnode, name, index,
1081 MAX_ACPI_REFERENCE_ARGS, args); 1074 NR_FWNODE_REFERENCE_ARGS, args);
1082} 1075}
1083 1076
1084int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname, 1077int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname,
@@ -1096,14 +1089,6 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
1096 struct fwnode_handle *child); 1089 struct fwnode_handle *child);
1097struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode); 1090struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode);
1098 1091
1099struct fwnode_handle *
1100acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
1101 struct fwnode_handle *prev);
1102int acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode,
1103 struct fwnode_handle **remote,
1104 struct fwnode_handle **port,
1105 struct fwnode_handle **endpoint);
1106
1107struct acpi_probe_entry; 1092struct acpi_probe_entry;
1108typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *, 1093typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
1109 struct acpi_probe_entry *); 1094 struct acpi_probe_entry *);
@@ -1169,7 +1154,7 @@ static inline int acpi_dev_get_property(struct acpi_device *adev,
1169static inline int 1154static inline int
1170__acpi_node_get_property_reference(const struct fwnode_handle *fwnode, 1155__acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1171 const char *name, size_t index, size_t num_args, 1156 const char *name, size_t index, size_t num_args,
1172 struct acpi_reference_args *args) 1157 struct fwnode_reference_args *args)
1173{ 1158{
1174 return -ENXIO; 1159 return -ENXIO;
1175} 1160}
@@ -1177,7 +1162,7 @@ __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1177static inline int 1162static inline int
1178acpi_node_get_property_reference(const struct fwnode_handle *fwnode, 1163acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1179 const char *name, size_t index, 1164 const char *name, size_t index,
1180 struct acpi_reference_args *args) 1165 struct fwnode_reference_args *args)
1181{ 1166{
1182 return -ENXIO; 1167 return -ENXIO;
1183} 1168}
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 1b0a17b22cd3..eaedca5fe6fc 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -30,7 +30,7 @@ void ahci_platform_disable_regulators(struct ahci_host_priv *hpriv);
30int ahci_platform_enable_resources(struct ahci_host_priv *hpriv); 30int ahci_platform_enable_resources(struct ahci_host_priv *hpriv);
31void ahci_platform_disable_resources(struct ahci_host_priv *hpriv); 31void ahci_platform_disable_resources(struct ahci_host_priv *hpriv);
32struct ahci_host_priv *ahci_platform_get_resources( 32struct ahci_host_priv *ahci_platform_get_resources(
33 struct platform_device *pdev); 33 struct platform_device *pdev, unsigned int flags);
34int ahci_platform_init_host(struct platform_device *pdev, 34int ahci_platform_init_host(struct platform_device *pdev,
35 struct ahci_host_priv *hpriv, 35 struct ahci_host_priv *hpriv,
36 const struct ata_port_info *pi_template, 36 const struct ata_port_info *pi_template,
@@ -43,4 +43,6 @@ int ahci_platform_resume_host(struct device *dev);
43int ahci_platform_suspend(struct device *dev); 43int ahci_platform_suspend(struct device *dev);
44int ahci_platform_resume(struct device *dev); 44int ahci_platform_resume(struct device *dev);
45 45
46#define AHCI_PLATFORM_GET_RESETS 0x01
47
46#endif /* _AHCI_PLATFORM_H */ 48#endif /* _AHCI_PLATFORM_H */
diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index ca1d2cc2cdfa..18863d56273c 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -199,47 +199,57 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
199 199
200#define __declare_arg_0(a0, res) \ 200#define __declare_arg_0(a0, res) \
201 struct arm_smccc_res *___res = res; \ 201 struct arm_smccc_res *___res = res; \
202 register u32 r0 asm("r0") = a0; \ 202 register unsigned long r0 asm("r0") = (u32)a0; \
203 register unsigned long r1 asm("r1"); \ 203 register unsigned long r1 asm("r1"); \
204 register unsigned long r2 asm("r2"); \ 204 register unsigned long r2 asm("r2"); \
205 register unsigned long r3 asm("r3") 205 register unsigned long r3 asm("r3")
206 206
207#define __declare_arg_1(a0, a1, res) \ 207#define __declare_arg_1(a0, a1, res) \
208 typeof(a1) __a1 = a1; \
208 struct arm_smccc_res *___res = res; \ 209 struct arm_smccc_res *___res = res; \
209 register u32 r0 asm("r0") = a0; \ 210 register unsigned long r0 asm("r0") = (u32)a0; \
210 register typeof(a1) r1 asm("r1") = a1; \ 211 register unsigned long r1 asm("r1") = __a1; \
211 register unsigned long r2 asm("r2"); \ 212 register unsigned long r2 asm("r2"); \
212 register unsigned long r3 asm("r3") 213 register unsigned long r3 asm("r3")
213 214
214#define __declare_arg_2(a0, a1, a2, res) \ 215#define __declare_arg_2(a0, a1, a2, res) \
216 typeof(a1) __a1 = a1; \
217 typeof(a2) __a2 = a2; \
215 struct arm_smccc_res *___res = res; \ 218 struct arm_smccc_res *___res = res; \
216 register u32 r0 asm("r0") = a0; \ 219 register unsigned long r0 asm("r0") = (u32)a0; \
217 register typeof(a1) r1 asm("r1") = a1; \ 220 register unsigned long r1 asm("r1") = __a1; \
218 register typeof(a2) r2 asm("r2") = a2; \ 221 register unsigned long r2 asm("r2") = __a2; \
219 register unsigned long r3 asm("r3") 222 register unsigned long r3 asm("r3")
220 223
221#define __declare_arg_3(a0, a1, a2, a3, res) \ 224#define __declare_arg_3(a0, a1, a2, a3, res) \
225 typeof(a1) __a1 = a1; \
226 typeof(a2) __a2 = a2; \
227 typeof(a3) __a3 = a3; \
222 struct arm_smccc_res *___res = res; \ 228 struct arm_smccc_res *___res = res; \
223 register u32 r0 asm("r0") = a0; \ 229 register unsigned long r0 asm("r0") = (u32)a0; \
224 register typeof(a1) r1 asm("r1") = a1; \ 230 register unsigned long r1 asm("r1") = __a1; \
225 register typeof(a2) r2 asm("r2") = a2; \ 231 register unsigned long r2 asm("r2") = __a2; \
226 register typeof(a3) r3 asm("r3") = a3 232 register unsigned long r3 asm("r3") = __a3
227 233
228#define __declare_arg_4(a0, a1, a2, a3, a4, res) \ 234#define __declare_arg_4(a0, a1, a2, a3, a4, res) \
235 typeof(a4) __a4 = a4; \
229 __declare_arg_3(a0, a1, a2, a3, res); \ 236 __declare_arg_3(a0, a1, a2, a3, res); \
230 register typeof(a4) r4 asm("r4") = a4 237 register unsigned long r4 asm("r4") = __a4
231 238
232#define __declare_arg_5(a0, a1, a2, a3, a4, a5, res) \ 239#define __declare_arg_5(a0, a1, a2, a3, a4, a5, res) \
240 typeof(a5) __a5 = a5; \
233 __declare_arg_4(a0, a1, a2, a3, a4, res); \ 241 __declare_arg_4(a0, a1, a2, a3, a4, res); \
234 register typeof(a5) r5 asm("r5") = a5 242 register unsigned long r5 asm("r5") = __a5
235 243
236#define __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res) \ 244#define __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res) \
245 typeof(a6) __a6 = a6; \
237 __declare_arg_5(a0, a1, a2, a3, a4, a5, res); \ 246 __declare_arg_5(a0, a1, a2, a3, a4, a5, res); \
238 register typeof(a6) r6 asm("r6") = a6 247 register unsigned long r6 asm("r6") = __a6
239 248
240#define __declare_arg_7(a0, a1, a2, a3, a4, a5, a6, a7, res) \ 249#define __declare_arg_7(a0, a1, a2, a3, a4, a5, a6, a7, res) \
250 typeof(a7) __a7 = a7; \
241 __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res); \ 251 __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res); \
242 register typeof(a7) r7 asm("r7") = a7 252 register unsigned long r7 asm("r7") = __a7
243 253
244#define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__) 254#define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
245#define __declare_args(count, ...) ___declare_args(count, __VA_ARGS__) 255#define __declare_args(count, ...) ___declare_args(count, __VA_ARGS__)
diff --git a/include/linux/ascii85.h b/include/linux/ascii85.h
new file mode 100644
index 000000000000..4cc40201273e
--- /dev/null
+++ b/include/linux/ascii85.h
@@ -0,0 +1,38 @@
1/*
2 * SPDX-License-Identifier: GPL-2.0
3 *
4 * Copyright (c) 2008 Intel Corporation
5 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
6 */
7
8#ifndef _ASCII85_H_
9#define _ASCII85_H_
10
11#include <linux/kernel.h>
12
13#define ASCII85_BUFSZ 6
14
15static inline long
16ascii85_encode_len(long len)
17{
18 return DIV_ROUND_UP(len, 4);
19}
20
21static inline const char *
22ascii85_encode(u32 in, char *out)
23{
24 int i;
25
26 if (in == 0)
27 return "z";
28
29 out[5] = '\0';
30 for (i = 5; i--; ) {
31 out[i] = '!' + in % 85;
32 in /= 85;
33 }
34
35 return out;
36}
37
38#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 69c78477590b..9334fbef7bae 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -117,6 +117,9 @@ struct filename;
117 117
118extern void audit_log_session_info(struct audit_buffer *ab); 118extern void audit_log_session_info(struct audit_buffer *ab);
119 119
120#define AUDIT_OFF 0
121#define AUDIT_ON 1
122#define AUDIT_LOCKED 2
120#ifdef CONFIG_AUDIT 123#ifdef CONFIG_AUDIT
121/* These are defined in audit.c */ 124/* These are defined in audit.c */
122 /* Public API */ 125 /* Public API */
@@ -202,7 +205,7 @@ static inline int audit_log_task_context(struct audit_buffer *ab)
202static inline void audit_log_task_info(struct audit_buffer *ab, 205static inline void audit_log_task_info(struct audit_buffer *ab,
203 struct task_struct *tsk) 206 struct task_struct *tsk)
204{ } 207{ }
205#define audit_enabled 0 208#define audit_enabled AUDIT_OFF
206#endif /* CONFIG_AUDIT */ 209#endif /* CONFIG_AUDIT */
207 210
208#ifdef CONFIG_AUDIT_COMPAT_GENERIC 211#ifdef CONFIG_AUDIT_COMPAT_GENERIC
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index 24251762c20c..9a6bc0951cfa 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -12,6 +12,7 @@
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/workqueue.h> 13#include <linux/workqueue.h>
14#include <linux/kref.h> 14#include <linux/kref.h>
15#include <linux/refcount.h>
15 16
16struct page; 17struct page;
17struct device; 18struct device;
@@ -75,7 +76,7 @@ enum wb_reason {
75 */ 76 */
76struct bdi_writeback_congested { 77struct bdi_writeback_congested {
77 unsigned long state; /* WB_[a]sync_congested flags */ 78 unsigned long state; /* WB_[a]sync_congested flags */
78 atomic_t refcnt; /* nr of attached wb's and blkg */ 79 refcount_t refcnt; /* nr of attached wb's and blkg */
79 80
80#ifdef CONFIG_CGROUP_WRITEBACK 81#ifdef CONFIG_CGROUP_WRITEBACK
81 struct backing_dev_info *__bdi; /* the associated bdi, set to NULL 82 struct backing_dev_info *__bdi; /* the associated bdi, set to NULL
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 72ca0f3d39f3..c28a47cbe355 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -404,13 +404,13 @@ static inline bool inode_cgwb_enabled(struct inode *inode)
404static inline struct bdi_writeback_congested * 404static inline struct bdi_writeback_congested *
405wb_congested_get_create(struct backing_dev_info *bdi, int blkcg_id, gfp_t gfp) 405wb_congested_get_create(struct backing_dev_info *bdi, int blkcg_id, gfp_t gfp)
406{ 406{
407 atomic_inc(&bdi->wb_congested->refcnt); 407 refcount_inc(&bdi->wb_congested->refcnt);
408 return bdi->wb_congested; 408 return bdi->wb_congested;
409} 409}
410 410
411static inline void wb_congested_put(struct bdi_writeback_congested *congested) 411static inline void wb_congested_put(struct bdi_writeback_congested *congested)
412{ 412{
413 if (atomic_dec_and_test(&congested->refcnt)) 413 if (refcount_dec_and_test(&congested->refcnt))
414 kfree(congested); 414 kfree(congested);
415} 415}
416 416
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 7fbf0539e14a..0b5897446dca 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -79,7 +79,6 @@ struct backlight_properties {
79 /* Backlight type */ 79 /* Backlight type */
80 enum backlight_type type; 80 enum backlight_type type;
81 /* Flags used to signal drivers of state changes */ 81 /* Flags used to signal drivers of state changes */
82 /* Upper 4 bits are reserved for driver internal use */
83 unsigned int state; 82 unsigned int state;
84 83
85#define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */ 84#define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index f08f5fe7bd08..51371740d2a8 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -429,7 +429,6 @@ extern void bio_put(struct bio *);
429 429
430extern void __bio_clone_fast(struct bio *, struct bio *); 430extern void __bio_clone_fast(struct bio *, struct bio *);
431extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *); 431extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *);
432extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
433 432
434extern struct bio_set fs_bio_set; 433extern struct bio_set fs_bio_set;
435 434
@@ -443,12 +442,6 @@ static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs)
443 return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL); 442 return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL);
444} 443}
445 444
446static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask)
447{
448 return bio_clone_bioset(bio, gfp_mask, NULL);
449
450}
451
452extern blk_qc_t submit_bio(struct bio *); 445extern blk_qc_t submit_bio(struct bio *);
453 446
454extern void bio_endio(struct bio *); 447extern void bio_endio(struct bio *);
@@ -496,9 +489,9 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
496extern void bio_set_pages_dirty(struct bio *bio); 489extern void bio_set_pages_dirty(struct bio *bio);
497extern void bio_check_pages_dirty(struct bio *bio); 490extern void bio_check_pages_dirty(struct bio *bio);
498 491
499void generic_start_io_acct(struct request_queue *q, int rw, 492void generic_start_io_acct(struct request_queue *q, int op,
500 unsigned long sectors, struct hd_struct *part); 493 unsigned long sectors, struct hd_struct *part);
501void generic_end_io_acct(struct request_queue *q, int rw, 494void generic_end_io_acct(struct request_queue *q, int op,
502 struct hd_struct *part, 495 struct hd_struct *part,
503 unsigned long start_time); 496 unsigned long start_time);
504 497
@@ -553,8 +546,16 @@ do { \
553#define bio_dev(bio) \ 546#define bio_dev(bio) \
554 disk_devt((bio)->bi_disk) 547 disk_devt((bio)->bi_disk)
555 548
549#if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
550int bio_associate_blkcg_from_page(struct bio *bio, struct page *page);
551#else
552static inline int bio_associate_blkcg_from_page(struct bio *bio,
553 struct page *page) { return 0; }
554#endif
555
556#ifdef CONFIG_BLK_CGROUP 556#ifdef CONFIG_BLK_CGROUP
557int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); 557int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css);
558int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg);
558void bio_disassociate_task(struct bio *bio); 559void bio_disassociate_task(struct bio *bio);
559void bio_clone_blkcg_association(struct bio *dst, struct bio *src); 560void bio_clone_blkcg_association(struct bio *dst, struct bio *src);
560#else /* CONFIG_BLK_CGROUP */ 561#else /* CONFIG_BLK_CGROUP */
diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
index cf2588d81148..3f1ef4450a7c 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -53,7 +53,7 @@
53 ({ \ 53 ({ \
54 BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \ 54 BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
55 _pfx "mask is not constant"); \ 55 _pfx "mask is not constant"); \
56 BUILD_BUG_ON_MSG(!(_mask), _pfx "mask is zero"); \ 56 BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero"); \
57 BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \ 57 BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
58 ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \ 58 ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
59 _pfx "value too large for the field"); \ 59 _pfx "value too large for the field"); \
@@ -104,7 +104,7 @@
104 (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ 104 (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
105 }) 105 })
106 106
107extern void __compiletime_warning("value doesn't fit into mask") 107extern void __compiletime_error("value doesn't fit into mask")
108__field_overflow(void); 108__field_overflow(void);
109extern void __compiletime_error("bad bitfield mask") 109extern void __compiletime_error("bad bitfield mask")
110__bad_mask(void); 110__bad_mask(void);
@@ -121,8 +121,8 @@ static __always_inline u64 field_mask(u64 field)
121#define ____MAKE_OP(type,base,to,from) \ 121#define ____MAKE_OP(type,base,to,from) \
122static __always_inline __##type type##_encode_bits(base v, base field) \ 122static __always_inline __##type type##_encode_bits(base v, base field) \
123{ \ 123{ \
124 if (__builtin_constant_p(v) && (v & ~field_multiplier(field))) \ 124 if (__builtin_constant_p(v) && (v & ~field_mask(field))) \
125 __field_overflow(); \ 125 __field_overflow(); \
126 return to((v & field_mask(field)) * field_multiplier(field)); \ 126 return to((v & field_mask(field)) * field_multiplier(field)); \
127} \ 127} \
128static __always_inline __##type type##_replace_bits(__##type old, \ 128static __always_inline __##type type##_replace_bits(__##type old, \
@@ -143,6 +143,7 @@ static __always_inline base type##_get_bits(__##type v, base field) \
143 ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \ 143 ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
144 ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \ 144 ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
145 ____MAKE_OP(u##size,u##size,,) 145 ____MAKE_OP(u##size,u##size,,)
146____MAKE_OP(u8,u8,,)
146__MAKE_OP(16) 147__MAKE_OP(16)
147__MAKE_OP(32) 148__MAKE_OP(32)
148__MAKE_OP(64) 149__MAKE_OP(64)
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 1ee46f492267..acf5e8df3504 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -105,6 +105,14 @@
105 */ 105 */
106 106
107/* 107/*
108 * Allocation and deallocation of bitmap.
109 * Provided in lib/bitmap.c to avoid circular dependency.
110 */
111extern unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags);
112extern unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags);
113extern void bitmap_free(const unsigned long *bitmap);
114
115/*
108 * lib/bitmap.c provides these functions: 116 * lib/bitmap.c provides these functions:
109 */ 117 */
110 118
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index af419012d77d..7ddb1349394d 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -4,7 +4,8 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/bits.h> 5#include <linux/bits.h>
6 6
7#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 7#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
8#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
8 9
9extern unsigned int __sw_hweight8(unsigned int w); 10extern unsigned int __sw_hweight8(unsigned int w);
10extern unsigned int __sw_hweight16(unsigned int w); 11extern unsigned int __sw_hweight16(unsigned int w);
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 6c666fd7de3c..6d766a19f2bb 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -35,6 +35,7 @@ enum blkg_rwstat_type {
35 BLKG_RWSTAT_WRITE, 35 BLKG_RWSTAT_WRITE,
36 BLKG_RWSTAT_SYNC, 36 BLKG_RWSTAT_SYNC,
37 BLKG_RWSTAT_ASYNC, 37 BLKG_RWSTAT_ASYNC,
38 BLKG_RWSTAT_DISCARD,
38 39
39 BLKG_RWSTAT_NR, 40 BLKG_RWSTAT_NR,
40 BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR, 41 BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR,
@@ -55,6 +56,7 @@ struct blkcg {
55 struct list_head all_blkcgs_node; 56 struct list_head all_blkcgs_node;
56#ifdef CONFIG_CGROUP_WRITEBACK 57#ifdef CONFIG_CGROUP_WRITEBACK
57 struct list_head cgwb_list; 58 struct list_head cgwb_list;
59 refcount_t cgwb_refcnt;
58#endif 60#endif
59}; 61};
60 62
@@ -88,7 +90,6 @@ struct blkg_policy_data {
88 /* the blkg and policy id this per-policy data belongs to */ 90 /* the blkg and policy id this per-policy data belongs to */
89 struct blkcg_gq *blkg; 91 struct blkcg_gq *blkg;
90 int plid; 92 int plid;
91 bool offline;
92}; 93};
93 94
94/* 95/*
@@ -136,6 +137,12 @@ struct blkcg_gq {
136 struct blkg_policy_data *pd[BLKCG_MAX_POLS]; 137 struct blkg_policy_data *pd[BLKCG_MAX_POLS];
137 138
138 struct rcu_head rcu_head; 139 struct rcu_head rcu_head;
140
141 atomic_t use_delay;
142 atomic64_t delay_nsec;
143 atomic64_t delay_start;
144 u64 last_delay;
145 int last_use;
139}; 146};
140 147
141typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp); 148typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp);
@@ -148,6 +155,8 @@ typedef void (blkcg_pol_online_pd_fn)(struct blkg_policy_data *pd);
148typedef void (blkcg_pol_offline_pd_fn)(struct blkg_policy_data *pd); 155typedef void (blkcg_pol_offline_pd_fn)(struct blkg_policy_data *pd);
149typedef void (blkcg_pol_free_pd_fn)(struct blkg_policy_data *pd); 156typedef void (blkcg_pol_free_pd_fn)(struct blkg_policy_data *pd);
150typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkg_policy_data *pd); 157typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkg_policy_data *pd);
158typedef size_t (blkcg_pol_stat_pd_fn)(struct blkg_policy_data *pd, char *buf,
159 size_t size);
151 160
152struct blkcg_policy { 161struct blkcg_policy {
153 int plid; 162 int plid;
@@ -167,6 +176,7 @@ struct blkcg_policy {
167 blkcg_pol_offline_pd_fn *pd_offline_fn; 176 blkcg_pol_offline_pd_fn *pd_offline_fn;
168 blkcg_pol_free_pd_fn *pd_free_fn; 177 blkcg_pol_free_pd_fn *pd_free_fn;
169 blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn; 178 blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn;
179 blkcg_pol_stat_pd_fn *pd_stat_fn;
170}; 180};
171 181
172extern struct blkcg blkcg_root; 182extern struct blkcg blkcg_root;
@@ -238,6 +248,42 @@ static inline struct blkcg *bio_blkcg(struct bio *bio)
238 return css_to_blkcg(task_css(current, io_cgrp_id)); 248 return css_to_blkcg(task_css(current, io_cgrp_id));
239} 249}
240 250
251static inline bool blk_cgroup_congested(void)
252{
253 struct cgroup_subsys_state *css;
254 bool ret = false;
255
256 rcu_read_lock();
257 css = kthread_blkcg();
258 if (!css)
259 css = task_css(current, io_cgrp_id);
260 while (css) {
261 if (atomic_read(&css->cgroup->congestion_count)) {
262 ret = true;
263 break;
264 }
265 css = css->parent;
266 }
267 rcu_read_unlock();
268 return ret;
269}
270
271/**
272 * bio_issue_as_root_blkg - see if this bio needs to be issued as root blkg
273 * @return: true if this bio needs to be submitted with the root blkg context.
274 *
275 * In order to avoid priority inversions we sometimes need to issue a bio as if
276 * it were attached to the root blkg, and then backcharge to the actual owning
277 * blkg. The idea is we do bio_blkcg() to look up the actual context for the
278 * bio and attach the appropriate blkg to the bio. Then we call this helper and
279 * if it is true run with the root blkg for that queue and then do any
280 * backcharging to the originating cgroup once the io is complete.
281 */
282static inline bool bio_issue_as_root_blkg(struct bio *bio)
283{
284 return (bio->bi_opf & (REQ_META | REQ_SWAP)) != 0;
285}
286
241/** 287/**
242 * blkcg_parent - get the parent of a blkcg 288 * blkcg_parent - get the parent of a blkcg
243 * @blkcg: blkcg of interest 289 * @blkcg: blkcg of interest
@@ -296,6 +342,17 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg,
296} 342}
297 343
298/** 344/**
345 * blk_queue_root_blkg - return blkg for the (blkcg_root, @q) pair
346 * @q: request_queue of interest
347 *
348 * Lookup blkg for @q at the root level. See also blkg_lookup().
349 */
350static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q)
351{
352 return q->root_blkg;
353}
354
355/**
299 * blkg_to_pdata - get policy private data 356 * blkg_to_pdata - get policy private data
300 * @blkg: blkg of interest 357 * @blkg: blkg of interest
301 * @pol: policy of interest 358 * @pol: policy of interest
@@ -330,6 +387,49 @@ static inline struct blkcg *cpd_to_blkcg(struct blkcg_policy_data *cpd)
330 return cpd ? cpd->blkcg : NULL; 387 return cpd ? cpd->blkcg : NULL;
331} 388}
332 389
390extern void blkcg_destroy_blkgs(struct blkcg *blkcg);
391
392#ifdef CONFIG_CGROUP_WRITEBACK
393
394/**
395 * blkcg_cgwb_get - get a reference for blkcg->cgwb_list
396 * @blkcg: blkcg of interest
397 *
398 * This is used to track the number of active wb's related to a blkcg.
399 */
400static inline void blkcg_cgwb_get(struct blkcg *blkcg)
401{
402 refcount_inc(&blkcg->cgwb_refcnt);
403}
404
405/**
406 * blkcg_cgwb_put - put a reference for @blkcg->cgwb_list
407 * @blkcg: blkcg of interest
408 *
409 * This is used to track the number of active wb's related to a blkcg.
410 * When this count goes to zero, all active wb has finished so the
411 * blkcg can continue destruction by calling blkcg_destroy_blkgs().
412 * This work may occur in cgwb_release_workfn() on the cgwb_release
413 * workqueue.
414 */
415static inline void blkcg_cgwb_put(struct blkcg *blkcg)
416{
417 if (refcount_dec_and_test(&blkcg->cgwb_refcnt))
418 blkcg_destroy_blkgs(blkcg);
419}
420
421#else
422
423static inline void blkcg_cgwb_get(struct blkcg *blkcg) { }
424
425static inline void blkcg_cgwb_put(struct blkcg *blkcg)
426{
427 /* wb isn't being accounted, so trigger destruction right away */
428 blkcg_destroy_blkgs(blkcg);
429}
430
431#endif
432
333/** 433/**
334 * blkg_path - format cgroup path of blkg 434 * blkg_path - format cgroup path of blkg
335 * @blkg: blkg of interest 435 * @blkg: blkg of interest
@@ -355,6 +455,21 @@ static inline void blkg_get(struct blkcg_gq *blkg)
355 atomic_inc(&blkg->refcnt); 455 atomic_inc(&blkg->refcnt);
356} 456}
357 457
458/**
459 * blkg_try_get - try and get a blkg reference
460 * @blkg: blkg to get
461 *
462 * This is for use when doing an RCU lookup of the blkg. We may be in the midst
463 * of freeing this blkg, so we can only use it if the refcnt is not zero.
464 */
465static inline struct blkcg_gq *blkg_try_get(struct blkcg_gq *blkg)
466{
467 if (atomic_inc_not_zero(&blkg->refcnt))
468 return blkg;
469 return NULL;
470}
471
472
358void __blkg_release_rcu(struct rcu_head *rcu); 473void __blkg_release_rcu(struct rcu_head *rcu);
359 474
360/** 475/**
@@ -589,7 +704,9 @@ static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat,
589{ 704{
590 struct percpu_counter *cnt; 705 struct percpu_counter *cnt;
591 706
592 if (op_is_write(op)) 707 if (op_is_discard(op))
708 cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_DISCARD];
709 else if (op_is_write(op))
593 cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_WRITE]; 710 cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_WRITE];
594 else 711 else
595 cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_READ]; 712 cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_READ];
@@ -706,8 +823,14 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
706 823
707 if (!throtl) { 824 if (!throtl) {
708 blkg = blkg ?: q->root_blkg; 825 blkg = blkg ?: q->root_blkg;
709 blkg_rwstat_add(&blkg->stat_bytes, bio->bi_opf, 826 /*
710 bio->bi_iter.bi_size); 827 * If the bio is flagged with BIO_QUEUE_ENTERED it means this
828 * is a split bio and we would have already accounted for the
829 * size of the bio.
830 */
831 if (!bio_flagged(bio, BIO_QUEUE_ENTERED))
832 blkg_rwstat_add(&blkg->stat_bytes, bio->bi_opf,
833 bio->bi_iter.bi_size);
711 blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1); 834 blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1);
712 } 835 }
713 836
@@ -715,6 +838,59 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
715 return !throtl; 838 return !throtl;
716} 839}
717 840
841static inline void blkcg_use_delay(struct blkcg_gq *blkg)
842{
843 if (atomic_add_return(1, &blkg->use_delay) == 1)
844 atomic_inc(&blkg->blkcg->css.cgroup->congestion_count);
845}
846
847static inline int blkcg_unuse_delay(struct blkcg_gq *blkg)
848{
849 int old = atomic_read(&blkg->use_delay);
850
851 if (old == 0)
852 return 0;
853
854 /*
855 * We do this song and dance because we can race with somebody else
856 * adding or removing delay. If we just did an atomic_dec we'd end up
857 * negative and we'd already be in trouble. We need to subtract 1 and
858 * then check to see if we were the last delay so we can drop the
859 * congestion count on the cgroup.
860 */
861 while (old) {
862 int cur = atomic_cmpxchg(&blkg->use_delay, old, old - 1);
863 if (cur == old)
864 break;
865 old = cur;
866 }
867
868 if (old == 0)
869 return 0;
870 if (old == 1)
871 atomic_dec(&blkg->blkcg->css.cgroup->congestion_count);
872 return 1;
873}
874
875static inline void blkcg_clear_delay(struct blkcg_gq *blkg)
876{
877 int old = atomic_read(&blkg->use_delay);
878 if (!old)
879 return;
880 /* We only want 1 person clearing the congestion count for this blkg. */
881 while (old) {
882 int cur = atomic_cmpxchg(&blkg->use_delay, old, 0);
883 if (cur == old) {
884 atomic_dec(&blkg->blkcg->css.cgroup->congestion_count);
885 break;
886 }
887 old = cur;
888 }
889}
890
891void blkcg_add_delay(struct blkcg_gq *blkg, u64 now, u64 delta);
892void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay);
893void blkcg_maybe_throttle_current(void);
718#else /* CONFIG_BLK_CGROUP */ 894#else /* CONFIG_BLK_CGROUP */
719 895
720struct blkcg { 896struct blkcg {
@@ -734,9 +910,16 @@ struct blkcg_policy {
734 910
735#define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL)) 911#define blkcg_root_css ((struct cgroup_subsys_state *)ERR_PTR(-EINVAL))
736 912
913static inline void blkcg_maybe_throttle_current(void) { }
914static inline bool blk_cgroup_congested(void) { return false; }
915
737#ifdef CONFIG_BLOCK 916#ifdef CONFIG_BLOCK
738 917
918static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { }
919
739static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } 920static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; }
921static inline struct blkcg_gq *blk_queue_root_blkg(struct request_queue *q)
922{ return NULL; }
740static inline int blkcg_init_queue(struct request_queue *q) { return 0; } 923static inline int blkcg_init_queue(struct request_queue *q) { return 0; }
741static inline void blkcg_drain_queue(struct request_queue *q) { } 924static inline void blkcg_drain_queue(struct request_queue *q) { }
742static inline void blkcg_exit_queue(struct request_queue *q) { } 925static inline void blkcg_exit_queue(struct request_queue *q) { }
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index ca3f2c2edd85..1da59c16f637 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -35,10 +35,12 @@ struct blk_mq_hw_ctx {
35 struct sbitmap ctx_map; 35 struct sbitmap ctx_map;
36 36
37 struct blk_mq_ctx *dispatch_from; 37 struct blk_mq_ctx *dispatch_from;
38 unsigned int dispatch_busy;
38 39
39 struct blk_mq_ctx **ctxs;
40 unsigned int nr_ctx; 40 unsigned int nr_ctx;
41 struct blk_mq_ctx **ctxs;
41 42
43 spinlock_t dispatch_wait_lock;
42 wait_queue_entry_t dispatch_wait; 44 wait_queue_entry_t dispatch_wait;
43 atomic_t wait_index; 45 atomic_t wait_index;
44 46
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 3c4f390aea4b..f6dfb30737d8 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -179,11 +179,9 @@ struct bio {
179 */ 179 */
180 struct io_context *bi_ioc; 180 struct io_context *bi_ioc;
181 struct cgroup_subsys_state *bi_css; 181 struct cgroup_subsys_state *bi_css;
182#ifdef CONFIG_BLK_DEV_THROTTLING_LOW 182 struct blkcg_gq *bi_blkg;
183 void *bi_cg_private;
184 struct bio_issue bi_issue; 183 struct bio_issue bi_issue;
185#endif 184#endif
186#endif
187 union { 185 union {
188#if defined(CONFIG_BLK_DEV_INTEGRITY) 186#if defined(CONFIG_BLK_DEV_INTEGRITY)
189 struct bio_integrity_payload *bi_integrity; /* data integrity */ 187 struct bio_integrity_payload *bi_integrity; /* data integrity */
@@ -329,7 +327,7 @@ enum req_flag_bits {
329 327
330 /* for driver use */ 328 /* for driver use */
331 __REQ_DRV, 329 __REQ_DRV,
332 330 __REQ_SWAP, /* swapping request. */
333 __REQ_NR_BITS, /* stops here */ 331 __REQ_NR_BITS, /* stops here */
334}; 332};
335 333
@@ -351,6 +349,7 @@ enum req_flag_bits {
351#define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) 349#define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP)
352 350
353#define REQ_DRV (1ULL << __REQ_DRV) 351#define REQ_DRV (1ULL << __REQ_DRV)
352#define REQ_SWAP (1ULL << __REQ_SWAP)
354 353
355#define REQ_FAILFAST_MASK \ 354#define REQ_FAILFAST_MASK \
356 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 355 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
@@ -358,6 +357,14 @@ enum req_flag_bits {
358#define REQ_NOMERGE_FLAGS \ 357#define REQ_NOMERGE_FLAGS \
359 (REQ_NOMERGE | REQ_PREFLUSH | REQ_FUA) 358 (REQ_NOMERGE | REQ_PREFLUSH | REQ_FUA)
360 359
360enum stat_group {
361 STAT_READ,
362 STAT_WRITE,
363 STAT_DISCARD,
364
365 NR_STAT_GROUPS
366};
367
361#define bio_op(bio) \ 368#define bio_op(bio) \
362 ((bio)->bi_opf & REQ_OP_MASK) 369 ((bio)->bi_opf & REQ_OP_MASK)
363#define req_op(req) \ 370#define req_op(req) \
@@ -395,6 +402,18 @@ static inline bool op_is_sync(unsigned int op)
395 (op & (REQ_SYNC | REQ_FUA | REQ_PREFLUSH)); 402 (op & (REQ_SYNC | REQ_FUA | REQ_PREFLUSH));
396} 403}
397 404
405static inline bool op_is_discard(unsigned int op)
406{
407 return (op & REQ_OP_MASK) == REQ_OP_DISCARD;
408}
409
410static inline int op_stat_group(unsigned int op)
411{
412 if (op_is_discard(op))
413 return STAT_DISCARD;
414 return op_is_write(op);
415}
416
398typedef unsigned int blk_qc_t; 417typedef unsigned int blk_qc_t;
399#define BLK_QC_T_NONE -1U 418#define BLK_QC_T_NONE -1U
400#define BLK_QC_T_SHIFT 16 419#define BLK_QC_T_SHIFT 16
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 79226ca8f80f..d6869e0e2b64 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -27,8 +27,6 @@
27#include <linux/percpu-refcount.h> 27#include <linux/percpu-refcount.h>
28#include <linux/scatterlist.h> 28#include <linux/scatterlist.h>
29#include <linux/blkzoned.h> 29#include <linux/blkzoned.h>
30#include <linux/seqlock.h>
31#include <linux/u64_stats_sync.h>
32 30
33struct module; 31struct module;
34struct scsi_ioctl_command; 32struct scsi_ioctl_command;
@@ -42,7 +40,7 @@ struct bsg_job;
42struct blkcg_gq; 40struct blkcg_gq;
43struct blk_flush_queue; 41struct blk_flush_queue;
44struct pr_ops; 42struct pr_ops;
45struct rq_wb; 43struct rq_qos;
46struct blk_queue_stats; 44struct blk_queue_stats;
47struct blk_stat_callback; 45struct blk_stat_callback;
48 46
@@ -442,10 +440,8 @@ struct request_queue {
442 int nr_rqs[2]; /* # allocated [a]sync rqs */ 440 int nr_rqs[2]; /* # allocated [a]sync rqs */
443 int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */ 441 int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */
444 442
445 atomic_t shared_hctx_restart;
446
447 struct blk_queue_stats *stats; 443 struct blk_queue_stats *stats;
448 struct rq_wb *rq_wb; 444 struct rq_qos *rq_qos;
449 445
450 /* 446 /*
451 * If blkcg is not used, @q->root_rl serves all requests. If blkcg 447 * If blkcg is not used, @q->root_rl serves all requests. If blkcg
@@ -592,6 +588,7 @@ struct request_queue {
592 588
593 struct queue_limits limits; 589 struct queue_limits limits;
594 590
591#ifdef CONFIG_BLK_DEV_ZONED
595 /* 592 /*
596 * Zoned block device information for request dispatch control. 593 * Zoned block device information for request dispatch control.
597 * nr_zones is the total number of zones of the device. This is always 594 * nr_zones is the total number of zones of the device. This is always
@@ -612,6 +609,7 @@ struct request_queue {
612 unsigned int nr_zones; 609 unsigned int nr_zones;
613 unsigned long *seq_zones_bitmap; 610 unsigned long *seq_zones_bitmap;
614 unsigned long *seq_zones_wlock; 611 unsigned long *seq_zones_wlock;
612#endif /* CONFIG_BLK_DEV_ZONED */
615 613
616 /* 614 /*
617 * sg stuff 615 * sg stuff
@@ -800,11 +798,7 @@ static inline unsigned int blk_queue_zone_sectors(struct request_queue *q)
800 return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; 798 return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0;
801} 799}
802 800
803static inline unsigned int blk_queue_nr_zones(struct request_queue *q) 801#ifdef CONFIG_BLK_DEV_ZONED
804{
805 return q->nr_zones;
806}
807
808static inline unsigned int blk_queue_zone_no(struct request_queue *q, 802static inline unsigned int blk_queue_zone_no(struct request_queue *q,
809 sector_t sector) 803 sector_t sector)
810{ 804{
@@ -820,6 +814,7 @@ static inline bool blk_queue_zone_is_seq(struct request_queue *q,
820 return false; 814 return false;
821 return test_bit(blk_queue_zone_no(q, sector), q->seq_zones_bitmap); 815 return test_bit(blk_queue_zone_no(q, sector), q->seq_zones_bitmap);
822} 816}
817#endif /* CONFIG_BLK_DEV_ZONED */
823 818
824static inline bool rq_is_sync(struct request *rq) 819static inline bool rq_is_sync(struct request *rq)
825{ 820{
@@ -1070,6 +1065,7 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
1070 return blk_rq_cur_bytes(rq) >> SECTOR_SHIFT; 1065 return blk_rq_cur_bytes(rq) >> SECTOR_SHIFT;
1071} 1066}
1072 1067
1068#ifdef CONFIG_BLK_DEV_ZONED
1073static inline unsigned int blk_rq_zone_no(struct request *rq) 1069static inline unsigned int blk_rq_zone_no(struct request *rq)
1074{ 1070{
1075 return blk_queue_zone_no(rq->q, blk_rq_pos(rq)); 1071 return blk_queue_zone_no(rq->q, blk_rq_pos(rq));
@@ -1079,6 +1075,7 @@ static inline unsigned int blk_rq_zone_is_seq(struct request *rq)
1079{ 1075{
1080 return blk_queue_zone_is_seq(rq->q, blk_rq_pos(rq)); 1076 return blk_queue_zone_is_seq(rq->q, blk_rq_pos(rq));
1081} 1077}
1078#endif /* CONFIG_BLK_DEV_ZONED */
1082 1079
1083/* 1080/*
1084 * Some commands like WRITE SAME have a payload or data transfer size which 1081 * Some commands like WRITE SAME have a payload or data transfer size which
@@ -1437,8 +1434,6 @@ enum blk_default_limits {
1437 BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL, 1434 BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
1438}; 1435};
1439 1436
1440#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
1441
1442static inline unsigned long queue_segment_boundary(struct request_queue *q) 1437static inline unsigned long queue_segment_boundary(struct request_queue *q)
1443{ 1438{
1444 return q->limits.seg_boundary_mask; 1439 return q->limits.seg_boundary_mask;
@@ -1639,15 +1634,6 @@ static inline unsigned int bdev_zone_sectors(struct block_device *bdev)
1639 return 0; 1634 return 0;
1640} 1635}
1641 1636
1642static inline unsigned int bdev_nr_zones(struct block_device *bdev)
1643{
1644 struct request_queue *q = bdev_get_queue(bdev);
1645
1646 if (q)
1647 return blk_queue_nr_zones(q);
1648 return 0;
1649}
1650
1651static inline int queue_dma_alignment(struct request_queue *q) 1637static inline int queue_dma_alignment(struct request_queue *q)
1652{ 1638{
1653 return q ? q->dma_alignment : 511; 1639 return q ? q->dma_alignment : 511;
@@ -1877,6 +1863,28 @@ static inline bool integrity_req_gap_front_merge(struct request *req,
1877 bip_next->bip_vec[0].bv_offset); 1863 bip_next->bip_vec[0].bv_offset);
1878} 1864}
1879 1865
1866/**
1867 * bio_integrity_intervals - Return number of integrity intervals for a bio
1868 * @bi: blk_integrity profile for device
1869 * @sectors: Size of the bio in 512-byte sectors
1870 *
1871 * Description: The block layer calculates everything in 512 byte
1872 * sectors but integrity metadata is done in terms of the data integrity
1873 * interval size of the storage device. Convert the block layer sectors
1874 * to the appropriate number of integrity intervals.
1875 */
1876static inline unsigned int bio_integrity_intervals(struct blk_integrity *bi,
1877 unsigned int sectors)
1878{
1879 return sectors >> (bi->interval_exp - 9);
1880}
1881
1882static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
1883 unsigned int sectors)
1884{
1885 return bio_integrity_intervals(bi, sectors) * bi->tuple_size;
1886}
1887
1880#else /* CONFIG_BLK_DEV_INTEGRITY */ 1888#else /* CONFIG_BLK_DEV_INTEGRITY */
1881 1889
1882struct bio; 1890struct bio;
@@ -1950,12 +1958,24 @@ static inline bool integrity_req_gap_front_merge(struct request *req,
1950 return false; 1958 return false;
1951} 1959}
1952 1960
1961static inline unsigned int bio_integrity_intervals(struct blk_integrity *bi,
1962 unsigned int sectors)
1963{
1964 return 0;
1965}
1966
1967static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
1968 unsigned int sectors)
1969{
1970 return 0;
1971}
1972
1953#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1973#endif /* CONFIG_BLK_DEV_INTEGRITY */
1954 1974
1955struct block_device_operations { 1975struct block_device_operations {
1956 int (*open) (struct block_device *, fmode_t); 1976 int (*open) (struct block_device *, fmode_t);
1957 void (*release) (struct gendisk *, fmode_t); 1977 void (*release) (struct gendisk *, fmode_t);
1958 int (*rw_page)(struct block_device *, sector_t, struct page *, bool); 1978 int (*rw_page)(struct block_device *, sector_t, struct page *, unsigned int);
1959 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1979 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1960 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1980 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1961 unsigned int (*check_events) (struct gendisk *disk, 1981 unsigned int (*check_events) (struct gendisk *disk,
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 7942a96b1a9d..42515195d7d8 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -27,9 +27,20 @@ extern unsigned long max_pfn;
27extern unsigned long long max_possible_pfn; 27extern unsigned long long max_possible_pfn;
28 28
29#ifndef CONFIG_NO_BOOTMEM 29#ifndef CONFIG_NO_BOOTMEM
30/* 30/**
31 * node_bootmem_map is a map pointer - the bits represent all physical 31 * struct bootmem_data - per-node information used by the bootmem allocator
32 * memory pages (including holes) on the node. 32 * @node_min_pfn: the starting physical address of the node's memory
33 * @node_low_pfn: the end physical address of the directly addressable memory
34 * @node_bootmem_map: is a bitmap pointer - the bits represent all physical
35 * memory pages (including holes) on the node.
36 * @last_end_off: the offset within the page of the end of the last allocation;
37 * if 0, the page used is full
38 * @hint_idx: the PFN of the page used with the last allocation;
39 * together with using this with the @last_end_offset field,
40 * a test can be made to see if allocations can be merged
41 * with the page used for the last allocation rather than
42 * using up a full new page.
43 * @list: list entry in the linked list ordered by the memory addresses
33 */ 44 */
34typedef struct bootmem_data { 45typedef struct bootmem_data {
35 unsigned long node_min_pfn; 46 unsigned long node_min_pfn;
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index d50c2f0a655a..f91b0f8ff3a9 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -4,22 +4,46 @@
4 4
5#include <linux/errno.h> 5#include <linux/errno.h>
6#include <linux/jump_label.h> 6#include <linux/jump_label.h>
7#include <linux/percpu.h>
8#include <linux/rbtree.h>
7#include <uapi/linux/bpf.h> 9#include <uapi/linux/bpf.h>
8 10
9struct sock; 11struct sock;
10struct sockaddr; 12struct sockaddr;
11struct cgroup; 13struct cgroup;
12struct sk_buff; 14struct sk_buff;
15struct bpf_map;
16struct bpf_prog;
13struct bpf_sock_ops_kern; 17struct bpf_sock_ops_kern;
18struct bpf_cgroup_storage;
14 19
15#ifdef CONFIG_CGROUP_BPF 20#ifdef CONFIG_CGROUP_BPF
16 21
17extern struct static_key_false cgroup_bpf_enabled_key; 22extern struct static_key_false cgroup_bpf_enabled_key;
18#define cgroup_bpf_enabled static_branch_unlikely(&cgroup_bpf_enabled_key) 23#define cgroup_bpf_enabled static_branch_unlikely(&cgroup_bpf_enabled_key)
19 24
25DECLARE_PER_CPU(void*, bpf_cgroup_storage);
26
27struct bpf_cgroup_storage_map;
28
29struct bpf_storage_buffer {
30 struct rcu_head rcu;
31 char data[0];
32};
33
34struct bpf_cgroup_storage {
35 struct bpf_storage_buffer *buf;
36 struct bpf_cgroup_storage_map *map;
37 struct bpf_cgroup_storage_key key;
38 struct list_head list;
39 struct rb_node node;
40 struct rcu_head rcu;
41};
42
20struct bpf_prog_list { 43struct bpf_prog_list {
21 struct list_head node; 44 struct list_head node;
22 struct bpf_prog *prog; 45 struct bpf_prog *prog;
46 struct bpf_cgroup_storage *storage;
23}; 47};
24 48
25struct bpf_prog_array; 49struct bpf_prog_array;
@@ -77,6 +101,26 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
77int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, 101int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
78 short access, enum bpf_attach_type type); 102 short access, enum bpf_attach_type type);
79 103
104static inline void bpf_cgroup_storage_set(struct bpf_cgroup_storage *storage)
105{
106 struct bpf_storage_buffer *buf;
107
108 if (!storage)
109 return;
110
111 buf = READ_ONCE(storage->buf);
112 this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
113}
114
115struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(struct bpf_prog *prog);
116void bpf_cgroup_storage_free(struct bpf_cgroup_storage *storage);
117void bpf_cgroup_storage_link(struct bpf_cgroup_storage *storage,
118 struct cgroup *cgroup,
119 enum bpf_attach_type type);
120void bpf_cgroup_storage_unlink(struct bpf_cgroup_storage *storage);
121int bpf_cgroup_storage_assign(struct bpf_prog *prog, struct bpf_map *map);
122void bpf_cgroup_storage_release(struct bpf_prog *prog, struct bpf_map *map);
123
80/* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */ 124/* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */
81#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb) \ 125#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb) \
82({ \ 126({ \
@@ -221,6 +265,16 @@ static inline int cgroup_bpf_prog_query(const union bpf_attr *attr,
221 return -EINVAL; 265 return -EINVAL;
222} 266}
223 267
268static inline void bpf_cgroup_storage_set(struct bpf_cgroup_storage *storage) {}
269static inline int bpf_cgroup_storage_assign(struct bpf_prog *prog,
270 struct bpf_map *map) { return 0; }
271static inline void bpf_cgroup_storage_release(struct bpf_prog *prog,
272 struct bpf_map *map) {}
273static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(
274 struct bpf_prog *prog) { return 0; }
275static inline void bpf_cgroup_storage_free(
276 struct bpf_cgroup_storage *storage) {}
277
224#define cgroup_bpf_enabled (0) 278#define cgroup_bpf_enabled (0)
225#define BPF_CGROUP_PRE_CONNECT_ENABLED(sk) (0) 279#define BPF_CGROUP_PRE_CONNECT_ENABLED(sk) (0)
226#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; }) 280#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; })
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 8827e797ff97..523481a3471b 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -23,7 +23,7 @@ struct bpf_prog;
23struct bpf_map; 23struct bpf_map;
24struct sock; 24struct sock;
25struct seq_file; 25struct seq_file;
26struct btf; 26struct btf_type;
27 27
28/* map is generic key/value storage optionally accesible by eBPF programs */ 28/* map is generic key/value storage optionally accesible by eBPF programs */
29struct bpf_map_ops { 29struct bpf_map_ops {
@@ -48,8 +48,9 @@ struct bpf_map_ops {
48 u32 (*map_fd_sys_lookup_elem)(void *ptr); 48 u32 (*map_fd_sys_lookup_elem)(void *ptr);
49 void (*map_seq_show_elem)(struct bpf_map *map, void *key, 49 void (*map_seq_show_elem)(struct bpf_map *map, void *key,
50 struct seq_file *m); 50 struct seq_file *m);
51 int (*map_check_btf)(const struct bpf_map *map, const struct btf *btf, 51 int (*map_check_btf)(const struct bpf_map *map,
52 u32 key_type_id, u32 value_type_id); 52 const struct btf_type *key_type,
53 const struct btf_type *value_type);
53}; 54};
54 55
55struct bpf_map { 56struct bpf_map {
@@ -85,6 +86,7 @@ struct bpf_map {
85 char name[BPF_OBJ_NAME_LEN]; 86 char name[BPF_OBJ_NAME_LEN];
86}; 87};
87 88
89struct bpf_offload_dev;
88struct bpf_offloaded_map; 90struct bpf_offloaded_map;
89 91
90struct bpf_map_dev_ops { 92struct bpf_map_dev_ops {
@@ -117,9 +119,13 @@ static inline bool bpf_map_offload_neutral(const struct bpf_map *map)
117 119
118static inline bool bpf_map_support_seq_show(const struct bpf_map *map) 120static inline bool bpf_map_support_seq_show(const struct bpf_map *map)
119{ 121{
120 return map->ops->map_seq_show_elem && map->ops->map_check_btf; 122 return map->btf && map->ops->map_seq_show_elem;
121} 123}
122 124
125int map_check_no_btf(const struct bpf_map *map,
126 const struct btf_type *key_type,
127 const struct btf_type *value_type);
128
123extern const struct bpf_map_ops bpf_map_offload_ops; 129extern const struct bpf_map_ops bpf_map_offload_ops;
124 130
125/* function argument constraints */ 131/* function argument constraints */
@@ -154,6 +160,7 @@ enum bpf_arg_type {
154enum bpf_return_type { 160enum bpf_return_type {
155 RET_INTEGER, /* function returns integer */ 161 RET_INTEGER, /* function returns integer */
156 RET_VOID, /* function doesn't return anything */ 162 RET_VOID, /* function doesn't return anything */
163 RET_PTR_TO_MAP_VALUE, /* returns a pointer to map elem value */
157 RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */ 164 RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */
158}; 165};
159 166
@@ -281,6 +288,7 @@ struct bpf_prog_aux {
281 struct bpf_prog *prog; 288 struct bpf_prog *prog;
282 struct user_struct *user; 289 struct user_struct *user;
283 u64 load_time; /* ns since boottime */ 290 u64 load_time; /* ns since boottime */
291 struct bpf_map *cgroup_storage;
284 char name[BPF_OBJ_NAME_LEN]; 292 char name[BPF_OBJ_NAME_LEN];
285#ifdef CONFIG_SECURITY 293#ifdef CONFIG_SECURITY
286 void *security; 294 void *security;
@@ -347,12 +355,17 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
347 * The 'struct bpf_prog_array *' should only be replaced with xchg() 355 * The 'struct bpf_prog_array *' should only be replaced with xchg()
348 * since other cpus are walking the array of pointers in parallel. 356 * since other cpus are walking the array of pointers in parallel.
349 */ 357 */
358struct bpf_prog_array_item {
359 struct bpf_prog *prog;
360 struct bpf_cgroup_storage *cgroup_storage;
361};
362
350struct bpf_prog_array { 363struct bpf_prog_array {
351 struct rcu_head rcu; 364 struct rcu_head rcu;
352 struct bpf_prog *progs[0]; 365 struct bpf_prog_array_item items[0];
353}; 366};
354 367
355struct bpf_prog_array __rcu *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); 368struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags);
356void bpf_prog_array_free(struct bpf_prog_array __rcu *progs); 369void bpf_prog_array_free(struct bpf_prog_array __rcu *progs);
357int bpf_prog_array_length(struct bpf_prog_array __rcu *progs); 370int bpf_prog_array_length(struct bpf_prog_array __rcu *progs);
358int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, 371int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs,
@@ -370,7 +383,8 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array,
370 383
371#define __BPF_PROG_RUN_ARRAY(array, ctx, func, check_non_null) \ 384#define __BPF_PROG_RUN_ARRAY(array, ctx, func, check_non_null) \
372 ({ \ 385 ({ \
373 struct bpf_prog **_prog, *__prog; \ 386 struct bpf_prog_array_item *_item; \
387 struct bpf_prog *_prog; \
374 struct bpf_prog_array *_array; \ 388 struct bpf_prog_array *_array; \
375 u32 _ret = 1; \ 389 u32 _ret = 1; \
376 preempt_disable(); \ 390 preempt_disable(); \
@@ -378,10 +392,11 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array,
378 _array = rcu_dereference(array); \ 392 _array = rcu_dereference(array); \
379 if (unlikely(check_non_null && !_array))\ 393 if (unlikely(check_non_null && !_array))\
380 goto _out; \ 394 goto _out; \
381 _prog = _array->progs; \ 395 _item = &_array->items[0]; \
382 while ((__prog = READ_ONCE(*_prog))) { \ 396 while ((_prog = READ_ONCE(_item->prog))) { \
383 _ret &= func(__prog, ctx); \ 397 bpf_cgroup_storage_set(_item->cgroup_storage); \
384 _prog++; \ 398 _ret &= func(_prog, ctx); \
399 _item++; \
385 } \ 400 } \
386_out: \ 401_out: \
387 rcu_read_unlock(); \ 402 rcu_read_unlock(); \
@@ -434,6 +449,8 @@ struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref);
434void bpf_map_put_with_uref(struct bpf_map *map); 449void bpf_map_put_with_uref(struct bpf_map *map);
435void bpf_map_put(struct bpf_map *map); 450void bpf_map_put(struct bpf_map *map);
436int bpf_map_precharge_memlock(u32 pages); 451int bpf_map_precharge_memlock(u32 pages);
452int bpf_map_charge_memlock(struct bpf_map *map, u32 pages);
453void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages);
437void *bpf_map_area_alloc(size_t size, int numa_node); 454void *bpf_map_area_alloc(size_t size, int numa_node);
438void bpf_map_area_free(void *base); 455void bpf_map_area_free(void *base);
439void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); 456void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr);
@@ -512,6 +529,7 @@ static inline int bpf_map_attr_numa_node(const union bpf_attr *attr)
512} 529}
513 530
514struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type); 531struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type);
532int array_map_alloc_check(union bpf_attr *attr);
515 533
516#else /* !CONFIG_BPF_SYSCALL */ 534#else /* !CONFIG_BPF_SYSCALL */
517static inline struct bpf_prog *bpf_prog_get(u32 ufd) 535static inline struct bpf_prog *bpf_prog_get(u32 ufd)
@@ -648,7 +666,15 @@ int bpf_map_offload_delete_elem(struct bpf_map *map, void *key);
648int bpf_map_offload_get_next_key(struct bpf_map *map, 666int bpf_map_offload_get_next_key(struct bpf_map *map,
649 void *key, void *next_key); 667 void *key, void *next_key);
650 668
651bool bpf_offload_dev_match(struct bpf_prog *prog, struct bpf_map *map); 669bool bpf_offload_prog_map_match(struct bpf_prog *prog, struct bpf_map *map);
670
671struct bpf_offload_dev *bpf_offload_dev_create(void);
672void bpf_offload_dev_destroy(struct bpf_offload_dev *offdev);
673int bpf_offload_dev_netdev_register(struct bpf_offload_dev *offdev,
674 struct net_device *netdev);
675void bpf_offload_dev_netdev_unregister(struct bpf_offload_dev *offdev,
676 struct net_device *netdev);
677bool bpf_offload_dev_match(struct bpf_prog *prog, struct net_device *netdev);
652 678
653#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL) 679#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL)
654int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr); 680int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr);
@@ -749,6 +775,33 @@ static inline void __xsk_map_flush(struct bpf_map *map)
749} 775}
750#endif 776#endif
751 777
778#if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL)
779void bpf_sk_reuseport_detach(struct sock *sk);
780int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map, void *key,
781 void *value);
782int bpf_fd_reuseport_array_update_elem(struct bpf_map *map, void *key,
783 void *value, u64 map_flags);
784#else
785static inline void bpf_sk_reuseport_detach(struct sock *sk)
786{
787}
788
789#ifdef CONFIG_BPF_SYSCALL
790static inline int bpf_fd_reuseport_array_lookup_elem(struct bpf_map *map,
791 void *key, void *value)
792{
793 return -EOPNOTSUPP;
794}
795
796static inline int bpf_fd_reuseport_array_update_elem(struct bpf_map *map,
797 void *key, void *value,
798 u64 map_flags)
799{
800 return -EOPNOTSUPP;
801}
802#endif /* CONFIG_BPF_SYSCALL */
803#endif /* defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) */
804
752/* verifier prototypes for helper functions called from eBPF programs */ 805/* verifier prototypes for helper functions called from eBPF programs */
753extern const struct bpf_func_proto bpf_map_lookup_elem_proto; 806extern const struct bpf_func_proto bpf_map_lookup_elem_proto;
754extern const struct bpf_func_proto bpf_map_update_elem_proto; 807extern const struct bpf_func_proto bpf_map_update_elem_proto;
@@ -768,6 +821,8 @@ extern const struct bpf_func_proto bpf_sock_map_update_proto;
768extern const struct bpf_func_proto bpf_sock_hash_update_proto; 821extern const struct bpf_func_proto bpf_sock_hash_update_proto;
769extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto; 822extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto;
770 823
824extern const struct bpf_func_proto bpf_get_local_storage_proto;
825
771/* Shared helpers among cBPF and eBPF. */ 826/* Shared helpers among cBPF and eBPF. */
772void bpf_user_rnd_init_once(void); 827void bpf_user_rnd_init_once(void);
773u64 bpf_user_rnd_u32(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); 828u64 bpf_user_rnd_u32(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h
index c5700c2d5549..cd26c090e7c0 100644
--- a/include/linux/bpf_types.h
+++ b/include/linux/bpf_types.h
@@ -29,6 +29,9 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev)
29#ifdef CONFIG_BPF_LIRC_MODE2 29#ifdef CONFIG_BPF_LIRC_MODE2
30BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) 30BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2)
31#endif 31#endif
32#ifdef CONFIG_INET
33BPF_PROG_TYPE(BPF_PROG_TYPE_SK_REUSEPORT, sk_reuseport)
34#endif
32 35
33BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops) 36BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops)
34BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, percpu_array_map_ops) 37BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, percpu_array_map_ops)
@@ -37,6 +40,9 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_PERF_EVENT_ARRAY, perf_event_array_map_ops)
37#ifdef CONFIG_CGROUPS 40#ifdef CONFIG_CGROUPS
38BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_ARRAY, cgroup_array_map_ops) 41BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_ARRAY, cgroup_array_map_ops)
39#endif 42#endif
43#ifdef CONFIG_CGROUP_BPF
44BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_STORAGE, cgroup_storage_map_ops)
45#endif
40BPF_MAP_TYPE(BPF_MAP_TYPE_HASH, htab_map_ops) 46BPF_MAP_TYPE(BPF_MAP_TYPE_HASH, htab_map_ops)
41BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_HASH, htab_percpu_map_ops) 47BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_HASH, htab_percpu_map_ops)
42BPF_MAP_TYPE(BPF_MAP_TYPE_LRU_HASH, htab_lru_map_ops) 48BPF_MAP_TYPE(BPF_MAP_TYPE_LRU_HASH, htab_lru_map_ops)
@@ -57,4 +63,7 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops)
57#if defined(CONFIG_XDP_SOCKETS) 63#if defined(CONFIG_XDP_SOCKETS)
58BPF_MAP_TYPE(BPF_MAP_TYPE_XSKMAP, xsk_map_ops) 64BPF_MAP_TYPE(BPF_MAP_TYPE_XSKMAP, xsk_map_ops)
59#endif 65#endif
66#ifdef CONFIG_INET
67BPF_MAP_TYPE(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, reuseport_array_ops)
68#endif
60#endif 69#endif
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index daa9234a9baf..949e9af8d9d6 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -45,6 +45,7 @@
45#define PHY_ID_BCM7445 0x600d8510 45#define PHY_ID_BCM7445 0x600d8510
46 46
47#define PHY_ID_BCM_CYGNUS 0xae025200 47#define PHY_ID_BCM_CYGNUS 0xae025200
48#define PHY_ID_BCM_OMEGA 0xae025100
48 49
49#define PHY_BCM_OUI_MASK 0xfffffc00 50#define PHY_BCM_OUI_MASK 0xfffffc00
50#define PHY_BCM_OUI_1 0x00206000 51#define PHY_BCM_OUI_1 0x00206000
diff --git a/include/linux/build-salt.h b/include/linux/build-salt.h
new file mode 100644
index 000000000000..bb007bd05e7a
--- /dev/null
+++ b/include/linux/build-salt.h
@@ -0,0 +1,20 @@
1#ifndef __BUILD_SALT_H
2#define __BUILD_SALT_H
3
4#include <linux/elfnote.h>
5
6#define LINUX_ELFNOTE_BUILD_SALT 0x100
7
8#ifdef __ASSEMBLER__
9
10#define BUILD_SALT \
11 ELFNOTE(Linux, LINUX_ELFNOTE_BUILD_SALT, .asciz CONFIG_BUILD_SALT)
12
13#else
14
15#define BUILD_SALT \
16 ELFNOTE32("Linux", LINUX_ELFNOTE_BUILD_SALT, CONFIG_BUILD_SALT)
17
18#endif
19
20#endif /* __BUILD_SALT_H */
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 055aaf5ed9af..a83e1f632eb7 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -143,7 +143,12 @@ u8 can_dlc2len(u8 can_dlc);
143/* map the sanitized data length to an appropriate data length code */ 143/* map the sanitized data length to an appropriate data length code */
144u8 can_len2dlc(u8 len); 144u8 can_len2dlc(u8 len);
145 145
146struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); 146struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max,
147 unsigned int txqs, unsigned int rxqs);
148#define alloc_candev(sizeof_priv, echo_skb_max) \
149 alloc_candev_mqs(sizeof_priv, echo_skb_max, 1, 1)
150#define alloc_candev_mq(sizeof_priv, echo_skb_max, count) \
151 alloc_candev_mqs(sizeof_priv, echo_skb_max, count, count)
147void free_candev(struct net_device *dev); 152void free_candev(struct net_device *dev);
148 153
149/* a candev safe wrapper around netdev_priv */ 154/* a candev safe wrapper around netdev_priv */
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index e75dfd1f1dec..528271c60018 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/fs.h> /* not really needed, later.. */ 14#include <linux/fs.h> /* not really needed, later.. */
15#include <linux/list.h> 15#include <linux/list.h>
16#include <scsi/scsi_common.h>
16#include <uapi/linux/cdrom.h> 17#include <uapi/linux/cdrom.h>
17 18
18struct packet_command 19struct packet_command
@@ -21,7 +22,7 @@ struct packet_command
21 unsigned char *buffer; 22 unsigned char *buffer;
22 unsigned int buflen; 23 unsigned int buflen;
23 int stat; 24 int stat;
24 struct request_sense *sense; 25 struct scsi_sense_hdr *sshdr;
25 unsigned char data_direction; 26 unsigned char data_direction;
26 int quiet; 27 int quiet;
27 int timeout; 28 int timeout;
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h
index e931da8424a4..6728c2ee0205 100644
--- a/include/linux/ceph/auth.h
+++ b/include/linux/ceph/auth.h
@@ -64,6 +64,10 @@ struct ceph_auth_client_ops {
64 /* ensure that an existing authorizer is up to date */ 64 /* ensure that an existing authorizer is up to date */
65 int (*update_authorizer)(struct ceph_auth_client *ac, int peer_type, 65 int (*update_authorizer)(struct ceph_auth_client *ac, int peer_type,
66 struct ceph_auth_handshake *auth); 66 struct ceph_auth_handshake *auth);
67 int (*add_authorizer_challenge)(struct ceph_auth_client *ac,
68 struct ceph_authorizer *a,
69 void *challenge_buf,
70 int challenge_buf_len);
67 int (*verify_authorizer_reply)(struct ceph_auth_client *ac, 71 int (*verify_authorizer_reply)(struct ceph_auth_client *ac,
68 struct ceph_authorizer *a); 72 struct ceph_authorizer *a);
69 void (*invalidate_authorizer)(struct ceph_auth_client *ac, 73 void (*invalidate_authorizer)(struct ceph_auth_client *ac,
@@ -118,6 +122,10 @@ void ceph_auth_destroy_authorizer(struct ceph_authorizer *a);
118extern int ceph_auth_update_authorizer(struct ceph_auth_client *ac, 122extern int ceph_auth_update_authorizer(struct ceph_auth_client *ac,
119 int peer_type, 123 int peer_type,
120 struct ceph_auth_handshake *a); 124 struct ceph_auth_handshake *a);
125int ceph_auth_add_authorizer_challenge(struct ceph_auth_client *ac,
126 struct ceph_authorizer *a,
127 void *challenge_buf,
128 int challenge_buf_len);
121extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, 129extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac,
122 struct ceph_authorizer *a); 130 struct ceph_authorizer *a);
123extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, 131extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac,
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index 3901927cf6a0..6b92b3395fa9 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -165,9 +165,9 @@ DEFINE_CEPH_FEATURE(58, 1, FS_FILE_LAYOUT_V2) // overlap
165DEFINE_CEPH_FEATURE(59, 1, FS_BTIME) 165DEFINE_CEPH_FEATURE(59, 1, FS_BTIME)
166DEFINE_CEPH_FEATURE(59, 1, FS_CHANGE_ATTR) // overlap 166DEFINE_CEPH_FEATURE(59, 1, FS_CHANGE_ATTR) // overlap
167DEFINE_CEPH_FEATURE(59, 1, MSG_ADDR2) // overlap 167DEFINE_CEPH_FEATURE(59, 1, MSG_ADDR2) // overlap
168DEFINE_CEPH_FEATURE(60, 1, BLKIN_TRACING) // *do not share this bit* 168DEFINE_CEPH_FEATURE(60, 1, OSD_RECOVERY_DELETES) // *do not share this bit*
169DEFINE_CEPH_FEATURE(61, 1, CEPHX_V2) // *do not share this bit*
169 170
170DEFINE_CEPH_FEATURE(61, 1, RESERVED2) // unused, but slow down!
171DEFINE_CEPH_FEATURE(62, 1, RESERVED) // do not use; used as a sentinal 171DEFINE_CEPH_FEATURE(62, 1, RESERVED) // do not use; used as a sentinal
172DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facing 172DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facing
173 173
@@ -210,7 +210,8 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin
210 CEPH_FEATURE_SERVER_JEWEL | \ 210 CEPH_FEATURE_SERVER_JEWEL | \
211 CEPH_FEATURE_MON_STATEFUL_SUB | \ 211 CEPH_FEATURE_MON_STATEFUL_SUB | \
212 CEPH_FEATURE_CRUSH_TUNABLES5 | \ 212 CEPH_FEATURE_CRUSH_TUNABLES5 | \
213 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING) 213 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING | \
214 CEPH_FEATURE_CEPHX_V2)
214 215
215#define CEPH_FEATURES_REQUIRED_DEFAULT \ 216#define CEPH_FEATURES_REQUIRED_DEFAULT \
216 (CEPH_FEATURE_NOSRCADDR | \ 217 (CEPH_FEATURE_NOSRCADDR | \
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index d143ac8879c6..a6c2a48d42e0 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -194,16 +194,22 @@ ceph_decode_skip_n(p, end, sizeof(u8), bad)
194 } while (0) 194 } while (0)
195 195
196/* 196/*
197 * struct ceph_timespec <-> struct timespec 197 * struct ceph_timespec <-> struct timespec64
198 */ 198 */
199static inline void ceph_decode_timespec(struct timespec *ts, 199static inline void ceph_decode_timespec64(struct timespec64 *ts,
200 const struct ceph_timespec *tv) 200 const struct ceph_timespec *tv)
201{ 201{
202 ts->tv_sec = (__kernel_time_t)le32_to_cpu(tv->tv_sec); 202 /*
203 * This will still overflow in year 2106. We could extend
204 * the protocol to steal two more bits from tv_nsec to
205 * add three more 136 year epochs after that the way ext4
206 * does if necessary.
207 */
208 ts->tv_sec = (time64_t)le32_to_cpu(tv->tv_sec);
203 ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec); 209 ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec);
204} 210}
205static inline void ceph_encode_timespec(struct ceph_timespec *tv, 211static inline void ceph_encode_timespec64(struct ceph_timespec *tv,
206 const struct timespec *ts) 212 const struct timespec64 *ts)
207{ 213{
208 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec); 214 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
209 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec); 215 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index c7dfcb8a1fb2..fc2b4491ee0a 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -31,6 +31,9 @@ struct ceph_connection_operations {
31 struct ceph_auth_handshake *(*get_authorizer) ( 31 struct ceph_auth_handshake *(*get_authorizer) (
32 struct ceph_connection *con, 32 struct ceph_connection *con,
33 int *proto, int force_new); 33 int *proto, int force_new);
34 int (*add_authorizer_challenge)(struct ceph_connection *con,
35 void *challenge_buf,
36 int challenge_buf_len);
34 int (*verify_authorizer_reply) (struct ceph_connection *con); 37 int (*verify_authorizer_reply) (struct ceph_connection *con);
35 int (*invalidate_authorizer)(struct ceph_connection *con); 38 int (*invalidate_authorizer)(struct ceph_connection *con);
36 39
@@ -286,9 +289,8 @@ struct ceph_connection {
286 attempt for this connection, client */ 289 attempt for this connection, client */
287 u32 peer_global_seq; /* peer's global seq for this connection */ 290 u32 peer_global_seq; /* peer's global seq for this connection */
288 291
292 struct ceph_auth_handshake *auth;
289 int auth_retry; /* true if we need a newer authorizer */ 293 int auth_retry; /* true if we need a newer authorizer */
290 void *auth_reply_buf; /* where to put the authorizer reply */
291 int auth_reply_buf_len;
292 294
293 struct mutex mutex; 295 struct mutex mutex;
294 296
@@ -330,7 +332,7 @@ struct ceph_connection {
330 int in_base_pos; /* bytes read */ 332 int in_base_pos; /* bytes read */
331 __le64 in_temp_ack; /* for reading an ack */ 333 __le64 in_temp_ack; /* for reading an ack */
332 334
333 struct timespec last_keepalive_ack; /* keepalive2 ack stamp */ 335 struct timespec64 last_keepalive_ack; /* keepalive2 ack stamp */
334 336
335 struct delayed_work work; /* send|recv work */ 337 struct delayed_work work; /* send|recv work */
336 unsigned long delay; /* current delay interval */ 338 unsigned long delay; /* current delay interval */
diff --git a/include/linux/ceph/msgr.h b/include/linux/ceph/msgr.h
index 73ae2a926548..9e50aede46c8 100644
--- a/include/linux/ceph/msgr.h
+++ b/include/linux/ceph/msgr.h
@@ -91,7 +91,7 @@ struct ceph_entity_inst {
91#define CEPH_MSGR_TAG_SEQ 13 /* 64-bit int follows with seen seq number */ 91#define CEPH_MSGR_TAG_SEQ 13 /* 64-bit int follows with seen seq number */
92#define CEPH_MSGR_TAG_KEEPALIVE2 14 /* keepalive2 byte + ceph_timespec */ 92#define CEPH_MSGR_TAG_KEEPALIVE2 14 /* keepalive2 byte + ceph_timespec */
93#define CEPH_MSGR_TAG_KEEPALIVE2_ACK 15 /* keepalive2 reply */ 93#define CEPH_MSGR_TAG_KEEPALIVE2_ACK 15 /* keepalive2 reply */
94 94#define CEPH_MSGR_TAG_CHALLENGE_AUTHORIZER 16 /* cephx v2 doing server challenge */
95 95
96/* 96/*
97 * connection negotiation 97 * connection negotiation
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 0d6ee04b4c41..02096da01845 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -199,7 +199,7 @@ struct ceph_osd_request {
199 /* set by submitter */ 199 /* set by submitter */
200 u64 r_snapid; /* for reads, CEPH_NOSNAP o/w */ 200 u64 r_snapid; /* for reads, CEPH_NOSNAP o/w */
201 struct ceph_snap_context *r_snapc; /* for writes */ 201 struct ceph_snap_context *r_snapc; /* for writes */
202 struct timespec r_mtime; /* ditto */ 202 struct timespec64 r_mtime; /* ditto */
203 u64 r_data_offset; /* ditto */ 203 u64 r_data_offset; /* ditto */
204 bool r_linger; /* don't resend on failure */ 204 bool r_linger; /* don't resend on failure */
205 205
@@ -253,7 +253,7 @@ struct ceph_osd_linger_request {
253 struct ceph_osd_request_target t; 253 struct ceph_osd_request_target t;
254 u32 map_dne_bound; 254 u32 map_dne_bound;
255 255
256 struct timespec mtime; 256 struct timespec64 mtime;
257 257
258 struct kref kref; 258 struct kref kref;
259 struct mutex lock; 259 struct mutex lock;
@@ -508,7 +508,7 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
508 struct ceph_snap_context *sc, 508 struct ceph_snap_context *sc,
509 u64 off, u64 len, 509 u64 off, u64 len,
510 u32 truncate_seq, u64 truncate_size, 510 u32 truncate_seq, u64 truncate_size,
511 struct timespec *mtime, 511 struct timespec64 *mtime,
512 struct page **pages, int nr_pages); 512 struct page **pages, int nr_pages);
513 513
514/* watch/notify */ 514/* watch/notify */
@@ -528,12 +528,12 @@ int ceph_osdc_notify_ack(struct ceph_osd_client *osdc,
528 u64 notify_id, 528 u64 notify_id,
529 u64 cookie, 529 u64 cookie,
530 void *payload, 530 void *payload,
531 size_t payload_len); 531 u32 payload_len);
532int ceph_osdc_notify(struct ceph_osd_client *osdc, 532int ceph_osdc_notify(struct ceph_osd_client *osdc,
533 struct ceph_object_id *oid, 533 struct ceph_object_id *oid,
534 struct ceph_object_locator *oloc, 534 struct ceph_object_locator *oloc,
535 void *payload, 535 void *payload,
536 size_t payload_len, 536 u32 payload_len,
537 u32 timeout, 537 u32 timeout,
538 struct page ***preply_pages, 538 struct page ***preply_pages,
539 size_t *preply_len); 539 size_t *preply_len);
diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h
index 7edcded07641..d0223364349f 100644
--- a/include/linux/ceph/pagelist.h
+++ b/include/linux/ceph/pagelist.h
@@ -68,7 +68,7 @@ static inline int ceph_pagelist_encode_8(struct ceph_pagelist *pl, u8 v)
68 return ceph_pagelist_append(pl, &v, 1); 68 return ceph_pagelist_append(pl, &v, 1);
69} 69}
70static inline int ceph_pagelist_encode_string(struct ceph_pagelist *pl, 70static inline int ceph_pagelist_encode_string(struct ceph_pagelist *pl,
71 char *s, size_t len) 71 char *s, u32 len)
72{ 72{
73 int ret = ceph_pagelist_encode_32(pl, len); 73 int ret = ceph_pagelist_encode_32(pl, len);
74 if (ret) 74 if (ret)
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index c0e68f903011..ff20b677fb9f 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -438,6 +438,9 @@ struct cgroup {
438 /* used to store eBPF programs */ 438 /* used to store eBPF programs */
439 struct cgroup_bpf bpf; 439 struct cgroup_bpf bpf;
440 440
441 /* If there is block congestion on this cgroup. */
442 atomic_t congestion_count;
443
441 /* ids of the ancestors at each level including self */ 444 /* ids of the ancestors at each level including self */
442 int ancestor_ids[]; 445 int ancestor_ids[];
443}; 446};
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c9fdf6f57913..32c553556bbd 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -554,6 +554,36 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp,
554} 554}
555 555
556/** 556/**
557 * cgroup_ancestor - find ancestor of cgroup
558 * @cgrp: cgroup to find ancestor of
559 * @ancestor_level: level of ancestor to find starting from root
560 *
561 * Find ancestor of cgroup at specified level starting from root if it exists
562 * and return pointer to it. Return NULL if @cgrp doesn't have ancestor at
563 * @ancestor_level.
564 *
565 * This function is safe to call as long as @cgrp is accessible.
566 */
567static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
568 int ancestor_level)
569{
570 struct cgroup *ptr;
571
572 if (cgrp->level < ancestor_level)
573 return NULL;
574
575 for (ptr = cgrp;
576 ptr && ptr->level > ancestor_level;
577 ptr = cgroup_parent(ptr))
578 ;
579
580 if (ptr && ptr->level == ancestor_level)
581 return ptr;
582
583 return NULL;
584}
585
586/**
557 * task_under_cgroup_hierarchy - test task's membership of cgroup ancestry 587 * task_under_cgroup_hierarchy - test task's membership of cgroup ancestry
558 * @task: the task to be tested 588 * @task: the task to be tested
559 * @ancestor: possible ancestor of @task's cgroup 589 * @ancestor: possible ancestor of @task's cgroup
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index b7cfa037e593..08b1aa70a38d 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -38,6 +38,8 @@
38#define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */ 38#define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */
39/* parents need enable during gate/ungate, set rate and re-parent */ 39/* parents need enable during gate/ungate, set rate and re-parent */
40#define CLK_OPS_PARENT_ENABLE BIT(12) 40#define CLK_OPS_PARENT_ENABLE BIT(12)
41/* duty cycle call may be forwarded to the parent clock */
42#define CLK_DUTY_CYCLE_PARENT BIT(13)
41 43
42struct clk; 44struct clk;
43struct clk_hw; 45struct clk_hw;
@@ -67,6 +69,17 @@ struct clk_rate_request {
67}; 69};
68 70
69/** 71/**
72 * struct clk_duty - Struture encoding the duty cycle ratio of a clock
73 *
74 * @num: Numerator of the duty cycle ratio
75 * @den: Denominator of the duty cycle ratio
76 */
77struct clk_duty {
78 unsigned int num;
79 unsigned int den;
80};
81
82/**
70 * struct clk_ops - Callback operations for hardware clocks; these are to 83 * struct clk_ops - Callback operations for hardware clocks; these are to
71 * be provided by the clock implementation, and will be called by drivers 84 * be provided by the clock implementation, and will be called by drivers
72 * through the clk_* api. 85 * through the clk_* api.
@@ -169,6 +182,15 @@ struct clk_rate_request {
169 * by the second argument. Valid values for degrees are 182 * by the second argument. Valid values for degrees are
170 * 0-359. Return 0 on success, otherwise -EERROR. 183 * 0-359. Return 0 on success, otherwise -EERROR.
171 * 184 *
185 * @get_duty_cycle: Queries the hardware to get the current duty cycle ratio
186 * of a clock. Returned values denominator cannot be 0 and must be
187 * superior or equal to the numerator.
188 *
189 * @set_duty_cycle: Apply the duty cycle ratio to this clock signal specified by
190 * the numerator (2nd argurment) and denominator (3rd argument).
191 * Argument must be a valid ratio (denominator > 0
192 * and >= numerator) Return 0 on success, otherwise -EERROR.
193 *
172 * @init: Perform platform-specific initialization magic. 194 * @init: Perform platform-specific initialization magic.
173 * This is not not used by any of the basic clock types. 195 * This is not not used by any of the basic clock types.
174 * Please consider other ways of solving initialization problems 196 * Please consider other ways of solving initialization problems
@@ -218,6 +240,10 @@ struct clk_ops {
218 unsigned long parent_accuracy); 240 unsigned long parent_accuracy);
219 int (*get_phase)(struct clk_hw *hw); 241 int (*get_phase)(struct clk_hw *hw);
220 int (*set_phase)(struct clk_hw *hw, int degrees); 242 int (*set_phase)(struct clk_hw *hw, int degrees);
243 int (*get_duty_cycle)(struct clk_hw *hw,
244 struct clk_duty *duty);
245 int (*set_duty_cycle)(struct clk_hw *hw,
246 struct clk_duty *duty);
221 void (*init)(struct clk_hw *hw); 247 void (*init)(struct clk_hw *hw);
222 void (*debug_init)(struct clk_hw *hw, struct dentry *dentry); 248 void (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
223}; 249};
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 0dbd0885b2c2..4f750c481b82 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -142,6 +142,27 @@ int clk_set_phase(struct clk *clk, int degrees);
142int clk_get_phase(struct clk *clk); 142int clk_get_phase(struct clk *clk);
143 143
144/** 144/**
145 * clk_set_duty_cycle - adjust the duty cycle ratio of a clock signal
146 * @clk: clock signal source
147 * @num: numerator of the duty cycle ratio to be applied
148 * @den: denominator of the duty cycle ratio to be applied
149 *
150 * Adjust the duty cycle of a clock signal by the specified ratio. Returns 0 on
151 * success, -EERROR otherwise.
152 */
153int clk_set_duty_cycle(struct clk *clk, unsigned int num, unsigned int den);
154
155/**
156 * clk_get_duty_cycle - return the duty cycle ratio of a clock signal
157 * @clk: clock signal source
158 * @scale: scaling factor to be applied to represent the ratio as an integer
159 *
160 * Returns the duty cycle ratio multiplied by the scale provided, otherwise
161 * returns -EERROR.
162 */
163int clk_get_scaled_duty_cycle(struct clk *clk, unsigned int scale);
164
165/**
145 * clk_is_match - check if two clk's point to the same hardware clock 166 * clk_is_match - check if two clk's point to the same hardware clock
146 * @p: clk compared against q 167 * @p: clk compared against q
147 * @q: clk compared against p 168 * @q: clk compared against p
@@ -183,6 +204,18 @@ static inline long clk_get_phase(struct clk *clk)
183 return -ENOTSUPP; 204 return -ENOTSUPP;
184} 205}
185 206
207static inline int clk_set_duty_cycle(struct clk *clk, unsigned int num,
208 unsigned int den)
209{
210 return -ENOTSUPP;
211}
212
213static inline unsigned int clk_get_scaled_duty_cycle(struct clk *clk,
214 unsigned int scale)
215{
216 return 0;
217}
218
186static inline bool clk_is_match(const struct clk *p, const struct clk *q) 219static inline bool clk_is_match(const struct clk *p, const struct clk *q)
187{ 220{
188 return p == q; 221 return p == q;
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index 6aca5ce8a99a..931ab05f771d 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -47,8 +47,10 @@
47#define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */ 47#define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */
48#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ 48#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
49#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */ 49#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */
50#define AT91_PMC_WAITMODE (1 << 2) /* Wait Mode Command */
50#define AT91_PMC_MOSCRCEN (1 << 3) /* Main On-Chip RC Oscillator Enable [some SAM9] */ 51#define AT91_PMC_MOSCRCEN (1 << 3) /* Main On-Chip RC Oscillator Enable [some SAM9] */
51#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */ 52#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
53#define AT91_PMC_KEY_MASK (0xff << 16)
52#define AT91_PMC_KEY (0x37 << 16) /* MOR Writing Key */ 54#define AT91_PMC_KEY (0x37 << 16) /* MOR Writing Key */
53#define AT91_PMC_MOSCSEL (1 << 24) /* Main Oscillator Selection [some SAM9] */ 55#define AT91_PMC_MOSCSEL (1 << 24) /* Main Oscillator Selection [some SAM9] */
54#define AT91_PMC_CFDEN (1 << 25) /* Clock Failure Detector Enable [some SAM9] */ 56#define AT91_PMC_CFDEN (1 << 25) /* Clock Failure Detector Enable [some SAM9] */
@@ -155,6 +157,19 @@
155#define AT91_PMC_GCKRDY (1 << 24) /* Generated Clocks */ 157#define AT91_PMC_GCKRDY (1 << 24) /* Generated Clocks */
156#define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */ 158#define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */
157 159
160#define AT91_PMC_FSMR 0x70 /* Fast Startup Mode Register */
161#define AT91_PMC_FSTT(n) BIT(n)
162#define AT91_PMC_RTCAL BIT(17) /* RTC Alarm Enable */
163#define AT91_PMC_USBAL BIT(18) /* USB Resume Enable */
164#define AT91_PMC_SDMMC_CD BIT(19) /* SDMMC Card Detect Enable */
165#define AT91_PMC_LPM BIT(20) /* Low-power Mode */
166#define AT91_PMC_RXLP_MCE BIT(24) /* Backup UART Receive Enable */
167#define AT91_PMC_ACC_CE BIT(25) /* ACC Enable */
168
169#define AT91_PMC_FSPR 0x74 /* Fast Startup Polarity Reg */
170
171#define AT91_PMC_FS_INPUT_MASK 0x7ff
172
158#define AT91_PMC_PLLICPR 0x80 /* PLL Charge Pump Current Register */ 173#define AT91_PMC_PLLICPR 0x80 /* PLL Charge Pump Current Register */
159 174
160#define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */ 175#define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */
diff --git a/include/linux/cma.h b/include/linux/cma.h
index bf90f0bb42bd..190184b5ff32 100644
--- a/include/linux/cma.h
+++ b/include/linux/cma.h
@@ -33,7 +33,7 @@ extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
33 const char *name, 33 const char *name,
34 struct cma **res_cma); 34 struct cma **res_cma);
35extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, 35extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
36 gfp_t gfp_mask); 36 bool no_warn);
37extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count); 37extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count);
38 38
39extern int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data); 39extern int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data);
diff --git a/include/linux/compat.h b/include/linux/compat.h
index df45ee8413d6..1a3c4f37e908 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -1019,6 +1019,17 @@ static inline struct compat_timeval ns_to_compat_timeval(s64 nsec)
1019 return ctv; 1019 return ctv;
1020} 1020}
1021 1021
1022/*
1023 * Kernel code should not call compat syscalls (i.e., compat_sys_xyzyyz())
1024 * directly. Instead, use one of the functions which work equivalently, such
1025 * as the kcompat_sys_xyzyyz() functions prototyped below.
1026 */
1027
1028int kcompat_sys_statfs64(const char __user * pathname, compat_size_t sz,
1029 struct compat_statfs64 __user * buf);
1030int kcompat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
1031 struct compat_statfs64 __user * buf);
1032
1022#else /* !CONFIG_COMPAT */ 1033#else /* !CONFIG_COMPAT */
1023 1034
1024#define is_compat_task() (0) 1035#define is_compat_task() (0)
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index 7087446c24c8..b1ce500fe8b3 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -6,11 +6,7 @@
6/* Some compiler specific definitions are overwritten here 6/* Some compiler specific definitions are overwritten here
7 * for Clang compiler 7 * for Clang compiler
8 */ 8 */
9
10#ifdef uninitialized_var
11#undef uninitialized_var
12#define uninitialized_var(x) x = *(&(x)) 9#define uninitialized_var(x) x = *(&(x))
13#endif
14 10
15/* same as gcc, this was present in clang-2.6 so we can assume it works 11/* same as gcc, this was present in clang-2.6 so we can assume it works
16 * with any version that can compile the kernel 12 * with any version that can compile the kernel
@@ -25,14 +21,8 @@
25#define __SANITIZE_ADDRESS__ 21#define __SANITIZE_ADDRESS__
26#endif 22#endif
27 23
28#undef __no_sanitize_address
29#define __no_sanitize_address __attribute__((no_sanitize("address"))) 24#define __no_sanitize_address __attribute__((no_sanitize("address")))
30 25
31/* Clang doesn't have a way to turn it off per-function, yet. */
32#ifdef __noretpoline
33#undef __noretpoline
34#endif
35
36/* 26/*
37 * Not all versions of clang implement the the type-generic versions 27 * Not all versions of clang implement the the type-generic versions
38 * of the builtin overflow checkers. Fortunately, clang implements 28 * of the builtin overflow checkers. Fortunately, clang implements
@@ -40,9 +30,17 @@
40 * checks. Unfortunately, we don't know which version of gcc clang 30 * checks. Unfortunately, we don't know which version of gcc clang
41 * pretends to be, so the macro may or may not be defined. 31 * pretends to be, so the macro may or may not be defined.
42 */ 32 */
43#undef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW
44#if __has_builtin(__builtin_mul_overflow) && \ 33#if __has_builtin(__builtin_mul_overflow) && \
45 __has_builtin(__builtin_add_overflow) && \ 34 __has_builtin(__builtin_add_overflow) && \
46 __has_builtin(__builtin_sub_overflow) 35 __has_builtin(__builtin_sub_overflow)
47#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 36#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
48#endif 37#endif
38
39/* The following are for compatibility with GCC, from compiler-gcc.h,
40 * and may be redefined here because they should not be shared with other
41 * compilers, like ICC.
42 */
43#define barrier() __asm__ __volatile__("" : : : "memory")
44#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
45#define __assume_aligned(a, ...) \
46 __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 573f5a7d42d4..763bbad1e258 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -10,6 +10,10 @@
10 + __GNUC_MINOR__ * 100 \ 10 + __GNUC_MINOR__ * 100 \
11 + __GNUC_PATCHLEVEL__) 11 + __GNUC_PATCHLEVEL__)
12 12
13#if GCC_VERSION < 40600
14# error Sorry, your compiler is too old - please upgrade it.
15#endif
16
13/* Optimization barrier */ 17/* Optimization barrier */
14 18
15/* The "volatile" is due to gcc bugs */ 19/* The "volatile" is due to gcc bugs */
@@ -58,6 +62,12 @@
58#define OPTIMIZER_HIDE_VAR(var) \ 62#define OPTIMIZER_HIDE_VAR(var) \
59 __asm__ ("" : "=r" (var) : "0" (var)) 63 __asm__ ("" : "=r" (var) : "0" (var))
60 64
65/*
66 * A trick to suppress uninitialized variable warning without generating any
67 * code
68 */
69#define uninitialized_var(x) x = x
70
61#ifdef __CHECKER__ 71#ifdef __CHECKER__
62#define __must_be_array(a) 0 72#define __must_be_array(a) 0
63#else 73#else
@@ -65,49 +75,6 @@
65#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) 75#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
66#endif 76#endif
67 77
68/*
69 * Feature detection for gnu_inline (gnu89 extern inline semantics). Either
70 * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics,
71 * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not
72 * defined so the gnu89 semantics are the default.
73 */
74#ifdef __GNUC_STDC_INLINE__
75# define __gnu_inline __attribute__((gnu_inline))
76#else
77# define __gnu_inline
78#endif
79
80/*
81 * Force always-inline if the user requests it so via the .config,
82 * or if gcc is too old.
83 * GCC does not warn about unused static inline functions for
84 * -Wunused-function. This turns out to avoid the need for complex #ifdef
85 * directives. Suppress the warning in clang as well by using "unused"
86 * function attribute, which is redundant but not harmful for gcc.
87 * Prefer gnu_inline, so that extern inline functions do not emit an
88 * externally visible function. This makes extern inline behave as per gnu89
89 * semantics rather than c99. This prevents multiple symbol definition errors
90 * of extern inline functions at link time.
91 * A lot of inline functions can cause havoc with function tracing.
92 */
93#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
94 !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
95#define inline \
96 inline __attribute__((always_inline, unused)) notrace __gnu_inline
97#else
98#define inline inline __attribute__((unused)) notrace __gnu_inline
99#endif
100
101#define __inline__ inline
102#define __inline inline
103#define __always_inline inline __attribute__((always_inline))
104#define noinline __attribute__((noinline))
105
106#define __deprecated __attribute__((deprecated))
107#define __packed __attribute__((packed))
108#define __weak __attribute__((weak))
109#define __alias(symbol) __attribute__((alias(#symbol)))
110
111#ifdef RETPOLINE 78#ifdef RETPOLINE
112#define __noretpoline __attribute__((indirect_branch("keep"))) 79#define __noretpoline __attribute__((indirect_branch("keep")))
113#endif 80#endif
@@ -126,105 +93,20 @@
126 */ 93 */
127#define __naked __attribute__((naked)) noinline __noclone notrace 94#define __naked __attribute__((naked)) noinline __noclone notrace
128 95
129#define __noreturn __attribute__((noreturn))
130
131/*
132 * From the GCC manual:
133 *
134 * Many functions have no effects except the return value and their
135 * return value depends only on the parameters and/or global
136 * variables. Such a function can be subject to common subexpression
137 * elimination and loop optimization just as an arithmetic operator
138 * would be.
139 * [...]
140 */
141#define __pure __attribute__((pure))
142#define __aligned(x) __attribute__((aligned(x)))
143#define __aligned_largest __attribute__((aligned))
144#define __printf(a, b) __attribute__((format(printf, a, b)))
145#define __scanf(a, b) __attribute__((format(scanf, a, b)))
146#define __attribute_const__ __attribute__((__const__))
147#define __maybe_unused __attribute__((unused))
148#define __always_unused __attribute__((unused))
149#define __mode(x) __attribute__((mode(x)))
150
151/* gcc version specific checks */
152
153#if GCC_VERSION < 30200
154# error Sorry, your compiler is too old - please upgrade it.
155#endif
156
157#if GCC_VERSION < 30300
158# define __used __attribute__((__unused__))
159#else
160# define __used __attribute__((__used__))
161#endif
162
163#ifdef CONFIG_GCOV_KERNEL
164# if GCC_VERSION < 30400
165# error "GCOV profiling support for gcc versions below 3.4 not included"
166# endif /* __GNUC_MINOR__ */
167#endif /* CONFIG_GCOV_KERNEL */
168
169#if GCC_VERSION >= 30400
170#define __must_check __attribute__((warn_unused_result))
171#define __malloc __attribute__((__malloc__))
172#endif
173
174#if GCC_VERSION >= 40000
175
176/* GCC 4.1.[01] miscompiles __weak */
177#ifdef __KERNEL__
178# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
179# error Your version of gcc miscompiles the __weak directive
180# endif
181#endif
182
183#define __used __attribute__((__used__))
184#define __compiler_offsetof(a, b) \
185 __builtin_offsetof(a, b)
186
187#if GCC_VERSION >= 40100
188# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
189#endif
190
191#if GCC_VERSION >= 40300
192/* Mark functions as cold. gcc will assume any path leading to a call
193 * to them will be unlikely. This means a lot of manual unlikely()s
194 * are unnecessary now for any paths leading to the usual suspects
195 * like BUG(), printk(), panic() etc. [but let's keep them for now for
196 * older compilers]
197 *
198 * Early snapshots of gcc 4.3 don't support this and we can't detect this
199 * in the preprocessor, but we can live with this because they're unreleased.
200 * Maketime probing would be overkill here.
201 *
202 * gcc also has a __attribute__((__hot__)) to move hot functions into
203 * a special section, but I don't see any sense in this right now in
204 * the kernel context
205 */
206#define __cold __attribute__((__cold__))
207
208#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) 96#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
209 97
210#ifndef __CHECKER__
211# define __compiletime_warning(message) __attribute__((warning(message)))
212# define __compiletime_error(message) __attribute__((error(message)))
213#endif /* __CHECKER__ */
214#endif /* GCC_VERSION >= 40300 */
215
216#if GCC_VERSION >= 40400
217#define __optimize(level) __attribute__((__optimize__(level))) 98#define __optimize(level) __attribute__((__optimize__(level)))
218#define __nostackprotector __optimize("no-stack-protector")
219#endif /* GCC_VERSION >= 40400 */
220 99
221#if GCC_VERSION >= 40500 100#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
222 101
223#ifndef __CHECKER__ 102#ifndef __CHECKER__
103#define __compiletime_warning(message) __attribute__((warning(message)))
104#define __compiletime_error(message) __attribute__((error(message)))
105
224#ifdef LATENT_ENTROPY_PLUGIN 106#ifdef LATENT_ENTROPY_PLUGIN
225#define __latent_entropy __attribute__((latent_entropy)) 107#define __latent_entropy __attribute__((latent_entropy))
226#endif 108#endif
227#endif 109#endif /* __CHECKER__ */
228 110
229/* 111/*
230 * calling noreturn functions, __builtin_unreachable() and __builtin_trap() 112 * calling noreturn functions, __builtin_unreachable() and __builtin_trap()
@@ -262,10 +144,6 @@
262#define randomized_struct_fields_end } __randomize_layout; 144#define randomized_struct_fields_end } __randomize_layout;
263#endif 145#endif
264 146
265#endif /* GCC_VERSION >= 40500 */
266
267#if GCC_VERSION >= 40600
268
269/* 147/*
270 * When used with Link Time Optimization, gcc can optimize away C functions or 148 * When used with Link Time Optimization, gcc can optimize away C functions or
271 * variables which are referenced only from assembly code. __visible tells the 149 * variables which are referenced only from assembly code. __visible tells the
@@ -274,8 +152,7 @@
274 */ 152 */
275#define __visible __attribute__((externally_visible)) 153#define __visible __attribute__((externally_visible))
276 154
277#endif /* GCC_VERSION >= 40600 */ 155/* gcc version specific checks */
278
279 156
280#if GCC_VERSION >= 40900 && !defined(__CHECKER__) 157#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
281/* 158/*
@@ -309,10 +186,8 @@
309 * folding in __builtin_bswap*() (yet), so don't set these for it. 186 * folding in __builtin_bswap*() (yet), so don't set these for it.
310 */ 187 */
311#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP) && !defined(__CHECKER__) 188#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP) && !defined(__CHECKER__)
312#if GCC_VERSION >= 40400
313#define __HAVE_BUILTIN_BSWAP32__ 189#define __HAVE_BUILTIN_BSWAP32__
314#define __HAVE_BUILTIN_BSWAP64__ 190#define __HAVE_BUILTIN_BSWAP64__
315#endif
316#if GCC_VERSION >= 40800 191#if GCC_VERSION >= 40800
317#define __HAVE_BUILTIN_BSWAP16__ 192#define __HAVE_BUILTIN_BSWAP16__
318#endif 193#endif
@@ -341,10 +216,9 @@
341 * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html 216 * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
342 */ 217 */
343#define __designated_init __attribute__((designated_init)) 218#define __designated_init __attribute__((designated_init))
219#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
344#endif 220#endif
345 221
346#endif /* gcc version >= 40000 specific checks */
347
348#if !defined(__noclone) 222#if !defined(__noclone)
349#define __noclone /* not needed */ 223#define __noclone /* not needed */
350#endif 224#endif
@@ -354,16 +228,6 @@
354#endif 228#endif
355 229
356/* 230/*
357 * A trick to suppress uninitialized variable warning without generating any
358 * code
359 */
360#define uninitialized_var(x) x = x
361
362#if GCC_VERSION >= 50100
363#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
364#endif
365
366/*
367 * Turn individual warnings and errors on and off locally, depending 231 * Turn individual warnings and errors on and off locally, depending
368 * on version. 232 * on version.
369 */ 233 */
@@ -375,12 +239,9 @@
375#define __diag_GCC_warn warning 239#define __diag_GCC_warn warning
376#define __diag_GCC_error error 240#define __diag_GCC_error error
377 241
378/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */
379#if GCC_VERSION >= 40600
380#define __diag_str1(s) #s 242#define __diag_str1(s) #s
381#define __diag_str(s) __diag_str1(s) 243#define __diag_str(s) __diag_str1(s)
382#define __diag(s) _Pragma(__diag_str(GCC diagnostic s)) 244#define __diag(s) _Pragma(__diag_str(GCC diagnostic s))
383#endif
384 245
385#if GCC_VERSION >= 80000 246#if GCC_VERSION >= 80000
386#define __diag_GCC_8(s) __diag(s) 247#define __diag_GCC_8(s) __diag(s)
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index 547cdc920a3c..4c7f9befa9f6 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -14,10 +14,6 @@
14/* Intel ECC compiler doesn't support gcc specific asm stmts. 14/* Intel ECC compiler doesn't support gcc specific asm stmts.
15 * It uses intrinsics to do the equivalent things. 15 * It uses intrinsics to do the equivalent things.
16 */ 16 */
17#undef barrier
18#undef barrier_data
19#undef RELOC_HIDE
20#undef OPTIMIZER_HIDE_VAR
21 17
22#define barrier() __memory_barrier() 18#define barrier() __memory_barrier()
23#define barrier_data(ptr) barrier() 19#define barrier_data(ptr) barrier()
@@ -38,13 +34,12 @@
38 34
39#endif 35#endif
40 36
41#ifndef __HAVE_BUILTIN_BSWAP16__
42/* icc has this, but it's called _bswap16 */ 37/* icc has this, but it's called _bswap16 */
43#define __HAVE_BUILTIN_BSWAP16__ 38#define __HAVE_BUILTIN_BSWAP16__
44#define __builtin_bswap16 _bswap16 39#define __builtin_bswap16 _bswap16
45#endif
46 40
47/* 41/* The following are for compatibility with GCC, from compiler-gcc.h,
48 * icc defines __GNUC__, but does not implement the builtin overflow checkers. 42 * and may be redefined here because they should not be shared with other
43 * compilers, like clang.
49 */ 44 */
50#undef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 45#define __visible __attribute__((externally_visible))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 42506e4d1f53..681d866efb1e 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -280,6 +280,25 @@ unsigned long read_word_at_a_time(const void *addr)
280 280
281#endif /* __KERNEL__ */ 281#endif /* __KERNEL__ */
282 282
283/*
284 * Force the compiler to emit 'sym' as a symbol, so that we can reference
285 * it from inline assembler. Necessary in case 'sym' could be inlined
286 * otherwise, or eliminated entirely due to lack of references that are
287 * visible to the compiler.
288 */
289#define __ADDRESSABLE(sym) \
290 static void * __attribute__((section(".discard.addressable"), used)) \
291 __PASTE(__addressable_##sym, __LINE__) = (void *)&sym;
292
293/**
294 * offset_to_ptr - convert a relative memory offset to an absolute pointer
295 * @off: the address of the 32-bit offset value
296 */
297static inline void *offset_to_ptr(const int *off)
298{
299 return (void *)((unsigned long)off + *off);
300}
301
283#endif /* __ASSEMBLY__ */ 302#endif /* __ASSEMBLY__ */
284 303
285#ifndef __optimize 304#ifndef __optimize
@@ -313,7 +332,7 @@ unsigned long read_word_at_a_time(const void *addr)
313#ifdef __OPTIMIZE__ 332#ifdef __OPTIMIZE__
314# define __compiletime_assert(condition, msg, prefix, suffix) \ 333# define __compiletime_assert(condition, msg, prefix, suffix) \
315 do { \ 334 do { \
316 bool __cond = !(condition); \ 335 int __cond = !(condition); \
317 extern void prefix ## suffix(void) __compiletime_error(msg); \ 336 extern void prefix ## suffix(void) __compiletime_error(msg); \
318 if (__cond) \ 337 if (__cond) \
319 prefix ## suffix(); \ 338 prefix ## suffix(); \
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index a8ba6b04152c..3525c179698c 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -54,32 +54,32 @@ extern void __chk_io_ptr(const volatile void __iomem *);
54 54
55#ifdef __KERNEL__ 55#ifdef __KERNEL__
56 56
57#ifdef __GNUC__ 57/* Compiler specific macros. */
58#ifdef __clang__
59#include <linux/compiler-clang.h>
60#elif defined(__INTEL_COMPILER)
61#include <linux/compiler-intel.h>
62#elif defined(__GNUC__)
63/* The above compilers also define __GNUC__, so order is important here. */
58#include <linux/compiler-gcc.h> 64#include <linux/compiler-gcc.h>
59#endif
60
61#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__)
62#define notrace __attribute__((hotpatch(0,0)))
63#else 65#else
64#define notrace __attribute__((no_instrument_function)) 66#error "Unknown compiler"
65#endif
66
67/* Intel compiler defines __GNUC__. So we will overwrite implementations
68 * coming from above header files here
69 */
70#ifdef __INTEL_COMPILER
71# include <linux/compiler-intel.h>
72#endif 67#endif
73 68
74/* Clang compiler defines __GNUC__. So we will overwrite implementations 69/*
75 * coming from above header files here 70 * Some architectures need to provide custom definitions of macros provided
71 * by linux/compiler-*.h, and can do so using asm/compiler.h. We include that
72 * conditionally rather than using an asm-generic wrapper in order to avoid
73 * build failures if any C compilation, which will include this file via an
74 * -include argument in c_flags, occurs prior to the asm-generic wrappers being
75 * generated.
76 */ 76 */
77#ifdef __clang__ 77#ifdef CONFIG_HAVE_ARCH_COMPILER_H
78#include <linux/compiler-clang.h> 78#include <asm/compiler.h>
79#endif 79#endif
80 80
81/* 81/*
82 * Generic compiler-dependent macros required for kernel 82 * Generic compiler-independent macros required for kernel
83 * build go below this comment. Actual compiler/compiler version 83 * build go below this comment. Actual compiler/compiler version
84 * specific implementations come from the above header files 84 * specific implementations come from the above header files
85 */ 85 */
@@ -106,110 +106,19 @@ struct ftrace_likely_data {
106 unsigned long constant; 106 unsigned long constant;
107}; 107};
108 108
109#endif /* __KERNEL__ */ 109/* Don't. Just don't. */
110
111#endif /* __ASSEMBLY__ */
112
113#ifdef __KERNEL__
114/*
115 * Allow us to mark functions as 'deprecated' and have gcc emit a nice
116 * warning for each use, in hopes of speeding the functions removal.
117 * Usage is:
118 * int __deprecated foo(void)
119 */
120#ifndef __deprecated
121# define __deprecated /* unimplemented */
122#endif
123
124#ifdef MODULE
125#define __deprecated_for_modules __deprecated
126#else
127#define __deprecated_for_modules
128#endif
129
130#ifndef __must_check
131#define __must_check
132#endif
133
134#ifndef CONFIG_ENABLE_MUST_CHECK
135#undef __must_check
136#define __must_check
137#endif
138#ifndef CONFIG_ENABLE_WARN_DEPRECATED
139#undef __deprecated
140#undef __deprecated_for_modules
141#define __deprecated 110#define __deprecated
142#define __deprecated_for_modules 111#define __deprecated_for_modules
143#endif
144
145#ifndef __malloc
146#define __malloc
147#endif
148
149/*
150 * Allow us to avoid 'defined but not used' warnings on functions and data,
151 * as well as force them to be emitted to the assembly file.
152 *
153 * As of gcc 3.4, static functions that are not marked with attribute((used))
154 * may be elided from the assembly file. As of gcc 3.4, static data not so
155 * marked will not be elided, but this may change in a future gcc version.
156 *
157 * NOTE: Because distributions shipped with a backported unit-at-a-time
158 * compiler in gcc 3.3, we must define __used to be __attribute__((used))
159 * for gcc >=3.3 instead of 3.4.
160 *
161 * In prior versions of gcc, such functions and data would be emitted, but
162 * would be warned about except with attribute((unused)).
163 *
164 * Mark functions that are referenced only in inline assembly as __used so
165 * the code is emitted even though it appears to be unreferenced.
166 */
167#ifndef __used
168# define __used /* unimplemented */
169#endif
170
171#ifndef __maybe_unused
172# define __maybe_unused /* unimplemented */
173#endif
174
175#ifndef __always_unused
176# define __always_unused /* unimplemented */
177#endif
178
179#ifndef noinline
180#define noinline
181#endif
182
183/*
184 * Rather then using noinline to prevent stack consumption, use
185 * noinline_for_stack instead. For documentation reasons.
186 */
187#define noinline_for_stack noinline
188
189#ifndef __always_inline
190#define __always_inline inline
191#endif
192 112
193#endif /* __KERNEL__ */ 113#endif /* __KERNEL__ */
194 114
115#endif /* __ASSEMBLY__ */
116
195/* 117/*
196 * From the GCC manual: 118 * The below symbols may be defined for one or more, but not ALL, of the above
197 * 119 * compilers. We don't consider that to be an error, so set them to nothing.
198 * Many functions do not examine any values except their arguments, 120 * For example, some of them are for compiler specific plugins.
199 * and have no effects except the return value. Basically this is
200 * just slightly more strict class than the `pure' attribute above,
201 * since function is not allowed to read global memory.
202 *
203 * Note that a function that has pointer arguments and examines the
204 * data pointed to must _not_ be declared `const'. Likewise, a
205 * function that calls a non-`const' function usually must not be
206 * `const'. It does not make sense for a `const' function to return
207 * `void'.
208 */ 121 */
209#ifndef __attribute_const__
210# define __attribute_const__ /* unimplemented */
211#endif
212
213#ifndef __designated_init 122#ifndef __designated_init
214# define __designated_init 123# define __designated_init
215#endif 124#endif
@@ -231,28 +140,10 @@ struct ftrace_likely_data {
231# define randomized_struct_fields_end 140# define randomized_struct_fields_end
232#endif 141#endif
233 142
234/*
235 * Tell gcc if a function is cold. The compiler will assume any path
236 * directly leading to the call is unlikely.
237 */
238
239#ifndef __cold
240#define __cold
241#endif
242
243/* Simple shorthand for a section definition */
244#ifndef __section
245# define __section(S) __attribute__ ((__section__(#S)))
246#endif
247
248#ifndef __visible 143#ifndef __visible
249#define __visible 144#define __visible
250#endif 145#endif
251 146
252#ifndef __nostackprotector
253# define __nostackprotector
254#endif
255
256/* 147/*
257 * Assume alignment of return value. 148 * Assume alignment of return value.
258 */ 149 */
@@ -260,17 +151,23 @@ struct ftrace_likely_data {
260#define __assume_aligned(a, ...) 151#define __assume_aligned(a, ...)
261#endif 152#endif
262 153
263
264/* Are two types/vars the same type (ignoring qualifiers)? */ 154/* Are two types/vars the same type (ignoring qualifiers)? */
265#ifndef __same_type 155#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
266# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
267#endif
268 156
269/* Is this type a native word size -- useful for atomic operations */ 157/* Is this type a native word size -- useful for atomic operations */
270#ifndef __native_word 158#define __native_word(t) \
271# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) 159 (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
160 sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
161
162#ifndef __attribute_const__
163#define __attribute_const__ __attribute__((__const__))
164#endif
165
166#ifndef __noclone
167#define __noclone
272#endif 168#endif
273 169
170/* Helpers for emitting diagnostics in pragmas. */
274#ifndef __diag 171#ifndef __diag
275#define __diag(string) 172#define __diag(string)
276#endif 173#endif
@@ -289,4 +186,92 @@ struct ftrace_likely_data {
289#define __diag_error(compiler, version, option, comment) \ 186#define __diag_error(compiler, version, option, comment) \
290 __diag_ ## compiler(version, error, option) 187 __diag_ ## compiler(version, error, option)
291 188
189/*
190 * From the GCC manual:
191 *
192 * Many functions have no effects except the return value and their
193 * return value depends only on the parameters and/or global
194 * variables. Such a function can be subject to common subexpression
195 * elimination and loop optimization just as an arithmetic operator
196 * would be.
197 * [...]
198 */
199#define __pure __attribute__((pure))
200#define __aligned(x) __attribute__((aligned(x)))
201#define __aligned_largest __attribute__((aligned))
202#define __printf(a, b) __attribute__((format(printf, a, b)))
203#define __scanf(a, b) __attribute__((format(scanf, a, b)))
204#define __maybe_unused __attribute__((unused))
205#define __always_unused __attribute__((unused))
206#define __mode(x) __attribute__((mode(x)))
207#define __malloc __attribute__((__malloc__))
208#define __used __attribute__((__used__))
209#define __noreturn __attribute__((noreturn))
210#define __packed __attribute__((packed))
211#define __weak __attribute__((weak))
212#define __alias(symbol) __attribute__((alias(#symbol)))
213#define __cold __attribute__((cold))
214#define __section(S) __attribute__((__section__(#S)))
215
216
217#ifdef CONFIG_ENABLE_MUST_CHECK
218#define __must_check __attribute__((warn_unused_result))
219#else
220#define __must_check
221#endif
222
223#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__)
224#define notrace __attribute__((hotpatch(0, 0)))
225#else
226#define notrace __attribute__((no_instrument_function))
227#endif
228
229#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
230
231/*
232 * Feature detection for gnu_inline (gnu89 extern inline semantics). Either
233 * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics,
234 * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not
235 * defined so the gnu89 semantics are the default.
236 */
237#ifdef __GNUC_STDC_INLINE__
238# define __gnu_inline __attribute__((gnu_inline))
239#else
240# define __gnu_inline
241#endif
242
243/*
244 * Force always-inline if the user requests it so via the .config.
245 * GCC does not warn about unused static inline functions for
246 * -Wunused-function. This turns out to avoid the need for complex #ifdef
247 * directives. Suppress the warning in clang as well by using "unused"
248 * function attribute, which is redundant but not harmful for gcc.
249 * Prefer gnu_inline, so that extern inline functions do not emit an
250 * externally visible function. This makes extern inline behave as per gnu89
251 * semantics rather than c99. This prevents multiple symbol definition errors
252 * of extern inline functions at link time.
253 * A lot of inline functions can cause havoc with function tracing.
254 */
255#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
256 !defined(CONFIG_OPTIMIZE_INLINING)
257#define inline \
258 inline __attribute__((always_inline, unused)) notrace __gnu_inline
259#else
260#define inline inline __attribute__((unused)) notrace __gnu_inline
261#endif
262
263#define __inline__ inline
264#define __inline inline
265#define noinline __attribute__((noinline))
266
267#ifndef __always_inline
268#define __always_inline inline __attribute__((always_inline))
269#endif
270
271/*
272 * Rather then using noinline to prevent stack consumption, use
273 * noinline_for_stack instead. For documentation reasons.
274 */
275#define noinline_for_stack noinline
276
292#endif /* __LINUX_COMPILER_TYPES_H */ 277#endif /* __LINUX_COMPILER_TYPES_H */
diff --git a/include/linux/console.h b/include/linux/console.h
index dfd6b0e97855..ec9bdb3d7bab 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -14,6 +14,7 @@
14#ifndef _LINUX_CONSOLE_H_ 14#ifndef _LINUX_CONSOLE_H_
15#define _LINUX_CONSOLE_H_ 1 15#define _LINUX_CONSOLE_H_ 1
16 16
17#include <linux/atomic.h>
17#include <linux/types.h> 18#include <linux/types.h>
18 19
19struct vc_data; 20struct vc_data;
@@ -21,6 +22,7 @@ struct console_font_op;
21struct console_font; 22struct console_font;
22struct module; 23struct module;
23struct tty_struct; 24struct tty_struct;
25struct notifier_block;
24 26
25/* 27/*
26 * this is what the terminal answers to a ESC-Z or csi0c query. 28 * this is what the terminal answers to a ESC-Z or csi0c query.
@@ -200,11 +202,14 @@ void vcs_make_sysfs(int index);
200void vcs_remove_sysfs(int index); 202void vcs_remove_sysfs(int index);
201 203
202/* Some debug stub to catch some of the obvious races in the VT code */ 204/* Some debug stub to catch some of the obvious races in the VT code */
203#if 1 205#define WARN_CONSOLE_UNLOCKED() \
204#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress) 206 WARN_ON(!atomic_read(&ignore_console_lock_warning) && \
205#else 207 !is_console_locked() && !oops_in_progress)
206#define WARN_CONSOLE_UNLOCKED() 208/*
207#endif 209 * Increment ignore_console_lock_warning if you need to quiet
210 * WARN_CONSOLE_UNLOCKED() for debugging purposes.
211 */
212extern atomic_t ignore_console_lock_warning;
208 213
209/* VESA Blanking Levels */ 214/* VESA Blanking Levels */
210#define VESA_NO_BLANKING 0 215#define VESA_NO_BLANKING 0
@@ -220,4 +225,8 @@ static inline bool vgacon_text_force(void) { return false; }
220 225
221extern void console_init(void); 226extern void console_init(void);
222 227
228/* For deferred console takeover */
229void dummycon_register_output_notifier(struct notifier_block *nb);
230void dummycon_unregister_output_notifier(struct notifier_block *nb);
231
223#endif /* _LINUX_CONSOLE_H */ 232#endif /* _LINUX_CONSOLE_H */
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index c0ec478ea5bf..fea64f2692a0 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -17,8 +17,8 @@
17#include <linux/vt.h> 17#include <linux/vt.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19 19
20struct vt_struct;
21struct uni_pagedir; 20struct uni_pagedir;
21struct uni_screen;
22 22
23#define NPAR 16 23#define NPAR 16
24 24
@@ -140,6 +140,7 @@ struct vc_data {
140 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ 140 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
141 struct uni_pagedir *vc_uni_pagedir; 141 struct uni_pagedir *vc_uni_pagedir;
142 struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ 142 struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
143 struct uni_screen *vc_uni_screen; /* unicode screen content */
143 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ 144 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
144 /* additional information is in vt_kern.h */ 145 /* additional information is in vt_kern.h */
145}; 146};
@@ -148,7 +149,7 @@ struct vc {
148 struct vc_data *d; 149 struct vc_data *d;
149 struct work_struct SAK_work; 150 struct work_struct SAK_work;
150 151
151 /* might add scrmem, vt_struct, kbd at some time, 152 /* might add scrmem, kbd at some time,
152 to have everything in one place - the disadvantage 153 to have everything in one place - the disadvantage
153 would be that vc_cons etc can no longer be static */ 154 would be that vc_cons etc can no longer be static */
154}; 155};
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index c265e0468414..d828a6efe0b1 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -40,6 +40,7 @@ enum coresight_dev_type {
40 CORESIGHT_DEV_TYPE_LINK, 40 CORESIGHT_DEV_TYPE_LINK,
41 CORESIGHT_DEV_TYPE_LINKSINK, 41 CORESIGHT_DEV_TYPE_LINKSINK,
42 CORESIGHT_DEV_TYPE_SOURCE, 42 CORESIGHT_DEV_TYPE_SOURCE,
43 CORESIGHT_DEV_TYPE_HELPER,
43}; 44};
44 45
45enum coresight_dev_subtype_sink { 46enum coresight_dev_subtype_sink {
@@ -62,19 +63,30 @@ enum coresight_dev_subtype_source {
62 CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE, 63 CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE,
63}; 64};
64 65
66enum coresight_dev_subtype_helper {
67 CORESIGHT_DEV_SUBTYPE_HELPER_NONE,
68 CORESIGHT_DEV_SUBTYPE_HELPER_CATU,
69};
70
65/** 71/**
66 * struct coresight_dev_subtype - further characterisation of a type 72 * union coresight_dev_subtype - further characterisation of a type
67 * @sink_subtype: type of sink this component is, as defined 73 * @sink_subtype: type of sink this component is, as defined
68 by @coresight_dev_subtype_sink. 74 * by @coresight_dev_subtype_sink.
69 * @link_subtype: type of link this component is, as defined 75 * @link_subtype: type of link this component is, as defined
70 by @coresight_dev_subtype_link. 76 * by @coresight_dev_subtype_link.
71 * @source_subtype: type of source this component is, as defined 77 * @source_subtype: type of source this component is, as defined
72 by @coresight_dev_subtype_source. 78 * by @coresight_dev_subtype_source.
79 * @helper_subtype: type of helper this component is, as defined
80 * by @coresight_dev_subtype_helper.
73 */ 81 */
74struct coresight_dev_subtype { 82union coresight_dev_subtype {
75 enum coresight_dev_subtype_sink sink_subtype; 83 /* We have some devices which acts as LINK and SINK */
76 enum coresight_dev_subtype_link link_subtype; 84 struct {
85 enum coresight_dev_subtype_sink sink_subtype;
86 enum coresight_dev_subtype_link link_subtype;
87 };
77 enum coresight_dev_subtype_source source_subtype; 88 enum coresight_dev_subtype_source source_subtype;
89 enum coresight_dev_subtype_helper helper_subtype;
78}; 90};
79 91
80/** 92/**
@@ -87,7 +99,6 @@ struct coresight_dev_subtype {
87 * @child_ports:child component port number the current component is 99 * @child_ports:child component port number the current component is
88 connected to. 100 connected to.
89 * @nr_outport: number of output ports for this component. 101 * @nr_outport: number of output ports for this component.
90 * @clk: The clock this component is associated to.
91 */ 102 */
92struct coresight_platform_data { 103struct coresight_platform_data {
93 int cpu; 104 int cpu;
@@ -97,7 +108,6 @@ struct coresight_platform_data {
97 const char **child_names; 108 const char **child_names;
98 int *child_ports; 109 int *child_ports;
99 int nr_outport; 110 int nr_outport;
100 struct clk *clk;
101}; 111};
102 112
103/** 113/**
@@ -113,7 +123,7 @@ struct coresight_platform_data {
113 */ 123 */
114struct coresight_desc { 124struct coresight_desc {
115 enum coresight_dev_type type; 125 enum coresight_dev_type type;
116 struct coresight_dev_subtype subtype; 126 union coresight_dev_subtype subtype;
117 const struct coresight_ops *ops; 127 const struct coresight_ops *ops;
118 struct coresight_platform_data *pdata; 128 struct coresight_platform_data *pdata;
119 struct device *dev; 129 struct device *dev;
@@ -157,7 +167,7 @@ struct coresight_device {
157 int nr_inport; 167 int nr_inport;
158 int nr_outport; 168 int nr_outport;
159 enum coresight_dev_type type; 169 enum coresight_dev_type type;
160 struct coresight_dev_subtype subtype; 170 union coresight_dev_subtype subtype;
161 const struct coresight_ops *ops; 171 const struct coresight_ops *ops;
162 struct device dev; 172 struct device dev;
163 atomic_t *refcnt; 173 atomic_t *refcnt;
@@ -171,6 +181,7 @@ struct coresight_device {
171#define source_ops(csdev) csdev->ops->source_ops 181#define source_ops(csdev) csdev->ops->source_ops
172#define sink_ops(csdev) csdev->ops->sink_ops 182#define sink_ops(csdev) csdev->ops->sink_ops
173#define link_ops(csdev) csdev->ops->link_ops 183#define link_ops(csdev) csdev->ops->link_ops
184#define helper_ops(csdev) csdev->ops->helper_ops
174 185
175/** 186/**
176 * struct coresight_ops_sink - basic operations for a sink 187 * struct coresight_ops_sink - basic operations for a sink
@@ -230,10 +241,25 @@ struct coresight_ops_source {
230 struct perf_event *event); 241 struct perf_event *event);
231}; 242};
232 243
244/**
245 * struct coresight_ops_helper - Operations for a helper device.
246 *
247 * All operations could pass in a device specific data, which could
248 * help the helper device to determine what to do.
249 *
250 * @enable : Enable the device
251 * @disable : Disable the device
252 */
253struct coresight_ops_helper {
254 int (*enable)(struct coresight_device *csdev, void *data);
255 int (*disable)(struct coresight_device *csdev, void *data);
256};
257
233struct coresight_ops { 258struct coresight_ops {
234 const struct coresight_ops_sink *sink_ops; 259 const struct coresight_ops_sink *sink_ops;
235 const struct coresight_ops_link *link_ops; 260 const struct coresight_ops_link *link_ops;
236 const struct coresight_ops_source *source_ops; 261 const struct coresight_ops_source *source_ops;
262 const struct coresight_ops_helper *helper_ops;
237}; 263};
238 264
239#ifdef CONFIG_CORESIGHT 265#ifdef CONFIG_CORESIGHT
@@ -267,24 +293,4 @@ static inline struct coresight_platform_data *of_get_coresight_platform_data(
267 struct device *dev, const struct device_node *node) { return NULL; } 293 struct device *dev, const struct device_node *node) { return NULL; }
268#endif 294#endif
269 295
270#ifdef CONFIG_PID_NS
271static inline unsigned long
272coresight_vpid_to_pid(unsigned long vpid)
273{
274 struct task_struct *task = NULL;
275 unsigned long pid = 0;
276
277 rcu_read_lock();
278 task = find_task_by_vpid(vpid);
279 if (task)
280 pid = task_pid_nr(task);
281 rcu_read_unlock();
282
283 return pid;
284}
285#else
286static inline unsigned long
287coresight_vpid_to_pid(unsigned long vpid) { return vpid; }
288#endif
289
290#endif 296#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 3233fbe23594..218df7f4d3e1 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -55,6 +55,8 @@ extern ssize_t cpu_show_spectre_v2(struct device *dev,
55 struct device_attribute *attr, char *buf); 55 struct device_attribute *attr, char *buf);
56extern ssize_t cpu_show_spec_store_bypass(struct device *dev, 56extern ssize_t cpu_show_spec_store_bypass(struct device *dev,
57 struct device_attribute *attr, char *buf); 57 struct device_attribute *attr, char *buf);
58extern ssize_t cpu_show_l1tf(struct device *dev,
59 struct device_attribute *attr, char *buf);
58 60
59extern __printf(4, 5) 61extern __printf(4, 5)
60struct device *cpu_device_create(struct device *parent, void *drvdata, 62struct device *cpu_device_create(struct device *parent, void *drvdata,
@@ -103,6 +105,7 @@ extern void cpus_write_lock(void);
103extern void cpus_write_unlock(void); 105extern void cpus_write_unlock(void);
104extern void cpus_read_lock(void); 106extern void cpus_read_lock(void);
105extern void cpus_read_unlock(void); 107extern void cpus_read_unlock(void);
108extern int cpus_read_trylock(void);
106extern void lockdep_assert_cpus_held(void); 109extern void lockdep_assert_cpus_held(void);
107extern void cpu_hotplug_disable(void); 110extern void cpu_hotplug_disable(void);
108extern void cpu_hotplug_enable(void); 111extern void cpu_hotplug_enable(void);
@@ -115,6 +118,7 @@ static inline void cpus_write_lock(void) { }
115static inline void cpus_write_unlock(void) { } 118static inline void cpus_write_unlock(void) { }
116static inline void cpus_read_lock(void) { } 119static inline void cpus_read_lock(void) { }
117static inline void cpus_read_unlock(void) { } 120static inline void cpus_read_unlock(void) { }
121static inline int cpus_read_trylock(void) { return true; }
118static inline void lockdep_assert_cpus_held(void) { } 122static inline void lockdep_assert_cpus_held(void) { }
119static inline void cpu_hotplug_disable(void) { } 123static inline void cpu_hotplug_disable(void) { }
120static inline void cpu_hotplug_enable(void) { } 124static inline void cpu_hotplug_enable(void) { }
@@ -166,4 +170,23 @@ void cpuhp_report_idle_dead(void);
166static inline void cpuhp_report_idle_dead(void) { } 170static inline void cpuhp_report_idle_dead(void) { }
167#endif /* #ifdef CONFIG_HOTPLUG_CPU */ 171#endif /* #ifdef CONFIG_HOTPLUG_CPU */
168 172
173enum cpuhp_smt_control {
174 CPU_SMT_ENABLED,
175 CPU_SMT_DISABLED,
176 CPU_SMT_FORCE_DISABLED,
177 CPU_SMT_NOT_SUPPORTED,
178};
179
180#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
181extern enum cpuhp_smt_control cpu_smt_control;
182extern void cpu_smt_disable(bool force);
183extern void cpu_smt_check_topology_early(void);
184extern void cpu_smt_check_topology(void);
185#else
186# define cpu_smt_control (CPU_SMT_ENABLED)
187static inline void cpu_smt_disable(bool force) { }
188static inline void cpu_smt_check_topology_early(void) { }
189static inline void cpu_smt_check_topology(void) { }
190#endif
191
169#endif /* _LINUX_CPU_H_ */ 192#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 4cf06a64bc02..caf40ad0bbc6 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -125,6 +125,7 @@ enum cpuhp_state {
125 CPUHP_AP_MARCO_TIMER_STARTING, 125 CPUHP_AP_MARCO_TIMER_STARTING,
126 CPUHP_AP_MIPS_GIC_TIMER_STARTING, 126 CPUHP_AP_MIPS_GIC_TIMER_STARTING,
127 CPUHP_AP_ARC_TIMER_STARTING, 127 CPUHP_AP_ARC_TIMER_STARTING,
128 CPUHP_AP_RISCV_TIMER_STARTING,
128 CPUHP_AP_KVM_STARTING, 129 CPUHP_AP_KVM_STARTING,
129 CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING, 130 CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,
130 CPUHP_AP_KVM_ARM_VGIC_STARTING, 131 CPUHP_AP_KVM_ARM_VGIC_STARTING,
@@ -143,6 +144,7 @@ enum cpuhp_state {
143 CPUHP_AP_SMPBOOT_THREADS, 144 CPUHP_AP_SMPBOOT_THREADS,
144 CPUHP_AP_X86_VDSO_VMA_ONLINE, 145 CPUHP_AP_X86_VDSO_VMA_ONLINE,
145 CPUHP_AP_IRQ_AFFINITY_ONLINE, 146 CPUHP_AP_IRQ_AFFINITY_ONLINE,
147 CPUHP_AP_ARM_MVEBU_SYNC_CLOCKS,
146 CPUHP_AP_PERF_ONLINE, 148 CPUHP_AP_PERF_ONLINE,
147 CPUHP_AP_PERF_X86_ONLINE, 149 CPUHP_AP_PERF_X86_ONLINE,
148 CPUHP_AP_PERF_X86_UNCORE_ONLINE, 150 CPUHP_AP_PERF_X86_UNCORE_ONLINE,
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index bf53d893ad02..147bdec42215 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -115,12 +115,17 @@ extern struct cpumask __cpu_active_mask;
115#define cpu_active(cpu) ((cpu) == 0) 115#define cpu_active(cpu) ((cpu) == 0)
116#endif 116#endif
117 117
118/* verify cpu argument to cpumask_* operators */ 118static inline void cpu_max_bits_warn(unsigned int cpu, unsigned int bits)
119static inline unsigned int cpumask_check(unsigned int cpu)
120{ 119{
121#ifdef CONFIG_DEBUG_PER_CPU_MAPS 120#ifdef CONFIG_DEBUG_PER_CPU_MAPS
122 WARN_ON_ONCE(cpu >= nr_cpumask_bits); 121 WARN_ON_ONCE(cpu >= bits);
123#endif /* CONFIG_DEBUG_PER_CPU_MAPS */ 122#endif /* CONFIG_DEBUG_PER_CPU_MAPS */
123}
124
125/* verify cpu argument to cpumask_* operators */
126static inline unsigned int cpumask_check(unsigned int cpu)
127{
128 cpu_max_bits_warn(cpu, nr_cpumask_bits);
124 return cpu; 129 return cpu;
125} 130}
126 131
@@ -154,6 +159,13 @@ static inline unsigned int cpumask_next_and(int n,
154 return n+1; 159 return n+1;
155} 160}
156 161
162static inline unsigned int cpumask_next_wrap(int n, const struct cpumask *mask,
163 int start, bool wrap)
164{
165 /* cpu0 unless stop condition, wrap and at cpu0, then nr_cpumask_bits */
166 return (wrap && n == 0);
167}
168
157/* cpu must be a valid cpu, ie 0, so there's no other choice. */ 169/* cpu must be a valid cpu, ie 0, so there's no other choice. */
158static inline unsigned int cpumask_any_but(const struct cpumask *mask, 170static inline unsigned int cpumask_any_but(const struct cpumask *mask,
159 unsigned int cpu) 171 unsigned int cpu)
diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
index b511f6d24b42..525510a9f965 100644
--- a/include/linux/crash_core.h
+++ b/include/linux/crash_core.h
@@ -60,6 +60,8 @@ phys_addr_t paddr_vmcoreinfo_note(void);
60#define VMCOREINFO_CONFIG(name) \ 60#define VMCOREINFO_CONFIG(name) \
61 vmcoreinfo_append_str("CONFIG_%s=y\n", #name) 61 vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
62 62
63extern unsigned char *vmcoreinfo_data;
64extern size_t vmcoreinfo_size;
63extern u32 *vmcoreinfo_note; 65extern u32 *vmcoreinfo_note;
64 66
65Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type, 67Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
diff --git a/include/linux/crc32poly.h b/include/linux/crc32poly.h
new file mode 100644
index 000000000000..62c4b7790a28
--- /dev/null
+++ b/include/linux/crc32poly.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_CRC32_POLY_H
3#define _LINUX_CRC32_POLY_H
4
5/*
6 * There are multiple 16-bit CRC polynomials in common use, but this is
7 * *the* standard CRC-32 polynomial, first popularized by Ethernet.
8 * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0
9 */
10#define CRC32_POLY_LE 0xedb88320
11#define CRC32_POLY_BE 0x04c11db7
12
13/*
14 * This is the CRC32c polynomial, as outlined by Castagnoli.
15 * x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+
16 * x^8+x^6+x^0
17 */
18#define CRC32C_POLY_LE 0x82F63B78
19
20#endif /* _LINUX_CRC32_POLY_H */
diff --git a/include/linux/crc64.h b/include/linux/crc64.h
new file mode 100644
index 000000000000..c756e65a1b58
--- /dev/null
+++ b/include/linux/crc64.h
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * See lib/crc64.c for the related specification and polynomial arithmetic.
4 */
5#ifndef _LINUX_CRC64_H
6#define _LINUX_CRC64_H
7
8#include <linux/types.h>
9
10u64 __pure crc64_be(u64 crc, const void *p, size_t len);
11#endif /* _LINUX_CRC64_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 631286535d0f..7eed6101c791 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -65,6 +65,12 @@ extern void groups_free(struct group_info *);
65 65
66extern int in_group_p(kgid_t); 66extern int in_group_p(kgid_t);
67extern int in_egroup_p(kgid_t); 67extern int in_egroup_p(kgid_t);
68extern int groups_search(const struct group_info *, kgid_t);
69
70extern int set_current_groups(struct group_info *);
71extern void set_groups(struct cred *, struct group_info *);
72extern bool may_setgroups(void);
73extern void groups_sort(struct group_info *);
68#else 74#else
69static inline void groups_free(struct group_info *group_info) 75static inline void groups_free(struct group_info *group_info)
70{ 76{
@@ -78,12 +84,11 @@ static inline int in_egroup_p(kgid_t grp)
78{ 84{
79 return 1; 85 return 1;
80} 86}
87static inline int groups_search(const struct group_info *group_info, kgid_t grp)
88{
89 return 1;
90}
81#endif 91#endif
82extern int set_current_groups(struct group_info *);
83extern void set_groups(struct cred *, struct group_info *);
84extern int groups_search(const struct group_info *, kgid_t);
85extern bool may_setgroups(void);
86extern void groups_sort(struct group_info *);
87 92
88/* 93/*
89 * The security context of a task 94 * The security context of a task
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 6eb06101089f..e8839d3a7559 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -113,6 +113,11 @@
113#define CRYPTO_ALG_OPTIONAL_KEY 0x00004000 113#define CRYPTO_ALG_OPTIONAL_KEY 0x00004000
114 114
115/* 115/*
116 * Don't trigger module loading
117 */
118#define CRYPTO_NOLOAD 0x00008000
119
120/*
116 * Transform masks and values (for crt_flags). 121 * Transform masks and values (for crt_flags).
117 */ 122 */
118#define CRYPTO_TFM_NEED_KEY 0x00000001 123#define CRYPTO_TFM_NEED_KEY 0x00000001
diff --git a/include/linux/dax.h b/include/linux/dax.h
index deb0f663252f..450b28db9533 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -88,6 +88,8 @@ int dax_writeback_mapping_range(struct address_space *mapping,
88 struct block_device *bdev, struct writeback_control *wbc); 88 struct block_device *bdev, struct writeback_control *wbc);
89 89
90struct page *dax_layout_busy_page(struct address_space *mapping); 90struct page *dax_layout_busy_page(struct address_space *mapping);
91bool dax_lock_mapping_entry(struct page *page);
92void dax_unlock_mapping_entry(struct page *page);
91#else 93#else
92static inline bool bdev_dax_supported(struct block_device *bdev, 94static inline bool bdev_dax_supported(struct block_device *bdev,
93 int blocksize) 95 int blocksize)
@@ -119,6 +121,17 @@ static inline int dax_writeback_mapping_range(struct address_space *mapping,
119{ 121{
120 return -EOPNOTSUPP; 122 return -EOPNOTSUPP;
121} 123}
124
125static inline bool dax_lock_mapping_entry(struct page *page)
126{
127 if (IS_DAX(page->mapping->host))
128 return true;
129 return false;
130}
131
132static inline void dax_unlock_mapping_entry(struct page *page)
133{
134}
122#endif 135#endif
123 136
124int dax_read_lock(void); 137int dax_read_lock(void);
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 66c6e17e61e5..ef4b70f64f33 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -145,8 +145,7 @@ struct dentry_operations {
145 char *(*d_dname)(struct dentry *, char *, int); 145 char *(*d_dname)(struct dentry *, char *, int);
146 struct vfsmount *(*d_automount)(struct path *); 146 struct vfsmount *(*d_automount)(struct path *);
147 int (*d_manage)(const struct path *, bool); 147 int (*d_manage)(const struct path *, bool);
148 struct dentry *(*d_real)(struct dentry *, const struct inode *, 148 struct dentry *(*d_real)(struct dentry *, const struct inode *);
149 unsigned int, unsigned int);
150} ____cacheline_aligned; 149} ____cacheline_aligned;
151 150
152/* 151/*
@@ -227,7 +226,6 @@ extern void d_instantiate(struct dentry *, struct inode *);
227extern void d_instantiate_new(struct dentry *, struct inode *); 226extern void d_instantiate_new(struct dentry *, struct inode *);
228extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 227extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
229extern struct dentry * d_instantiate_anon(struct dentry *, struct inode *); 228extern struct dentry * d_instantiate_anon(struct dentry *, struct inode *);
230extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
231extern void __d_drop(struct dentry *dentry); 229extern void __d_drop(struct dentry *dentry);
232extern void d_drop(struct dentry *dentry); 230extern void d_drop(struct dentry *dentry);
233extern void d_delete(struct dentry *); 231extern void d_delete(struct dentry *);
@@ -271,8 +269,6 @@ extern void d_rehash(struct dentry *);
271 269
272extern void d_add(struct dentry *, struct inode *); 270extern void d_add(struct dentry *, struct inode *);
273 271
274extern void dentry_update_name_case(struct dentry *, const struct qstr *);
275
276/* used for rename() and baskets */ 272/* used for rename() and baskets */
277extern void d_move(struct dentry *, struct dentry *); 273extern void d_move(struct dentry *, struct dentry *);
278extern void d_exchange(struct dentry *, struct dentry *); 274extern void d_exchange(struct dentry *, struct dentry *);
@@ -564,15 +560,10 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper)
564 return upper; 560 return upper;
565} 561}
566 562
567/* d_real() flags */
568#define D_REAL_UPPER 0x2 /* return upper dentry or NULL if non-upper */
569
570/** 563/**
571 * d_real - Return the real dentry 564 * d_real - Return the real dentry
572 * @dentry: the dentry to query 565 * @dentry: the dentry to query
573 * @inode: inode to select the dentry from multiple layers (can be NULL) 566 * @inode: inode to select the dentry from multiple layers (can be NULL)
574 * @open_flags: open flags to control copy-up behavior
575 * @flags: flags to control what is returned by this function
576 * 567 *
577 * If dentry is on a union/overlay, then return the underlying, real dentry. 568 * If dentry is on a union/overlay, then return the underlying, real dentry.
578 * Otherwise return the dentry itself. 569 * Otherwise return the dentry itself.
@@ -580,11 +571,10 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper)
580 * See also: Documentation/filesystems/vfs.txt 571 * See also: Documentation/filesystems/vfs.txt
581 */ 572 */
582static inline struct dentry *d_real(struct dentry *dentry, 573static inline struct dentry *d_real(struct dentry *dentry,
583 const struct inode *inode, 574 const struct inode *inode)
584 unsigned int open_flags, unsigned int flags)
585{ 575{
586 if (unlikely(dentry->d_flags & DCACHE_OP_REAL)) 576 if (unlikely(dentry->d_flags & DCACHE_OP_REAL))
587 return dentry->d_op->d_real(dentry, inode, open_flags, flags); 577 return dentry->d_op->d_real(dentry, inode);
588 else 578 else
589 return dentry; 579 return dentry;
590} 580}
@@ -599,7 +589,7 @@ static inline struct dentry *d_real(struct dentry *dentry,
599static inline struct inode *d_real_inode(const struct dentry *dentry) 589static inline struct inode *d_real_inode(const struct dentry *dentry)
600{ 590{
601 /* This usage of d_real() results in const dentry */ 591 /* This usage of d_real() results in const dentry */
602 return d_backing_inode(d_real((struct dentry *) dentry, NULL, 0, 0)); 592 return d_backing_inode(d_real((struct dentry *) dentry, NULL));
603} 593}
604 594
605struct name_snapshot { 595struct name_snapshot {
diff --git a/include/linux/device.h b/include/linux/device.h
index 055a69dbcd18..8f882549edee 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -90,7 +90,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
90 * @num_vf: Called to find out how many virtual functions a device on this 90 * @num_vf: Called to find out how many virtual functions a device on this
91 * bus supports. 91 * bus supports.
92 * @dma_configure: Called to setup DMA configuration on a device on 92 * @dma_configure: Called to setup DMA configuration on a device on
93 this bus. 93 * this bus.
94 * @pm: Power management operations of this bus, callback the specific 94 * @pm: Power management operations of this bus, callback the specific
95 * device driver's pm-ops. 95 * device driver's pm-ops.
96 * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU 96 * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU
@@ -339,6 +339,8 @@ struct device *driver_find_device(struct device_driver *drv,
339 struct device *start, void *data, 339 struct device *start, void *data,
340 int (*match)(struct device *dev, void *data)); 340 int (*match)(struct device *dev, void *data));
341 341
342int driver_deferred_probe_check_state(struct device *dev);
343
342/** 344/**
343 * struct subsys_interface - interfaces to device functions 345 * struct subsys_interface - interfaces to device functions
344 * @name: name of the device function 346 * @name: name of the device function
@@ -384,6 +386,9 @@ int subsys_virtual_register(struct bus_type *subsys,
384 * @shutdown_pre: Called at shut-down time before driver shutdown. 386 * @shutdown_pre: Called at shut-down time before driver shutdown.
385 * @ns_type: Callbacks so sysfs can detemine namespaces. 387 * @ns_type: Callbacks so sysfs can detemine namespaces.
386 * @namespace: Namespace of the device belongs to this class. 388 * @namespace: Namespace of the device belongs to this class.
389 * @get_ownership: Allows class to specify uid/gid of the sysfs directories
390 * for the devices belonging to the class. Usually tied to
391 * device's namespace.
387 * @pm: The default device power management operations of this class. 392 * @pm: The default device power management operations of this class.
388 * @p: The private data of the driver core, no one other than the 393 * @p: The private data of the driver core, no one other than the
389 * driver core can touch this. 394 * driver core can touch this.
@@ -413,6 +418,8 @@ struct class {
413 const struct kobj_ns_type_operations *ns_type; 418 const struct kobj_ns_type_operations *ns_type;
414 const void *(*namespace)(struct device *dev); 419 const void *(*namespace)(struct device *dev);
415 420
421 void (*get_ownership)(struct device *dev, kuid_t *uid, kgid_t *gid);
422
416 const struct dev_pm_ops *pm; 423 const struct dev_pm_ops *pm;
417 424
418 struct subsys_private *p; 425 struct subsys_private *p;
@@ -696,6 +703,10 @@ extern void devm_free_pages(struct device *dev, unsigned long addr);
696 703
697void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 704void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
698 705
706void __iomem *devm_of_iomap(struct device *dev,
707 struct device_node *node, int index,
708 resource_size_t *size);
709
699/* allows to add/remove a custom action to devres stack */ 710/* allows to add/remove a custom action to devres stack */
700int devm_add_action(struct device *dev, void (*action)(void *), void *data); 711int devm_add_action(struct device *dev, void (*action)(void *), void *data);
701void devm_remove_action(struct device *dev, void (*action)(void *), void *data); 712void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
@@ -784,14 +795,16 @@ enum device_link_state {
784 * Device link flags. 795 * Device link flags.
785 * 796 *
786 * STATELESS: The core won't track the presence of supplier/consumer drivers. 797 * STATELESS: The core won't track the presence of supplier/consumer drivers.
787 * AUTOREMOVE: Remove this link automatically on consumer driver unbind. 798 * AUTOREMOVE_CONSUMER: Remove the link automatically on consumer driver unbind.
788 * PM_RUNTIME: If set, the runtime PM framework will use this link. 799 * PM_RUNTIME: If set, the runtime PM framework will use this link.
789 * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. 800 * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation.
801 * AUTOREMOVE_SUPPLIER: Remove the link automatically on supplier driver unbind.
790 */ 802 */
791#define DL_FLAG_STATELESS BIT(0) 803#define DL_FLAG_STATELESS BIT(0)
792#define DL_FLAG_AUTOREMOVE BIT(1) 804#define DL_FLAG_AUTOREMOVE_CONSUMER BIT(1)
793#define DL_FLAG_PM_RUNTIME BIT(2) 805#define DL_FLAG_PM_RUNTIME BIT(2)
794#define DL_FLAG_RPM_ACTIVE BIT(3) 806#define DL_FLAG_RPM_ACTIVE BIT(3)
807#define DL_FLAG_AUTOREMOVE_SUPPLIER BIT(4)
795 808
796/** 809/**
797 * struct device_link - Device link representation. 810 * struct device_link - Device link representation.
@@ -886,6 +899,8 @@ struct dev_links_info {
886 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 899 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
887 * hardware supports 64-bit addresses for consistent allocations 900 * hardware supports 64-bit addresses for consistent allocations
888 * such descriptors. 901 * such descriptors.
902 * @bus_dma_mask: Mask of an upstream bridge or bus which imposes a smaller DMA
903 * limit than the device itself supports.
889 * @dma_pfn_offset: offset of DMA memory range relatively of RAM 904 * @dma_pfn_offset: offset of DMA memory range relatively of RAM
890 * @dma_parms: A low level driver may set these to teach IOMMU code about 905 * @dma_parms: A low level driver may set these to teach IOMMU code about
891 * segment limitations. 906 * segment limitations.
@@ -912,8 +927,6 @@ struct dev_links_info {
912 * @offline: Set after successful invocation of bus type's .offline(). 927 * @offline: Set after successful invocation of bus type's .offline().
913 * @of_node_reused: Set if the device-tree node is shared with an ancestor 928 * @of_node_reused: Set if the device-tree node is shared with an ancestor
914 * device. 929 * device.
915 * @dma_32bit_limit: bridge limited to 32bit DMA even if the device itself
916 * indicates support for a higher limit in the dma_mask field.
917 * 930 *
918 * At the lowest level, every device in a Linux system is represented by an 931 * At the lowest level, every device in a Linux system is represented by an
919 * instance of struct device. The device structure contains the information 932 * instance of struct device. The device structure contains the information
@@ -967,6 +980,7 @@ struct device {
967 not all hardware supports 980 not all hardware supports
968 64 bit addresses for consistent 981 64 bit addresses for consistent
969 allocations such descriptors. */ 982 allocations such descriptors. */
983 u64 bus_dma_mask; /* upstream dma_mask constraint */
970 unsigned long dma_pfn_offset; 984 unsigned long dma_pfn_offset;
971 985
972 struct device_dma_parameters *dma_parms; 986 struct device_dma_parameters *dma_parms;
@@ -1002,7 +1016,6 @@ struct device {
1002 bool offline_disabled:1; 1016 bool offline_disabled:1;
1003 bool offline:1; 1017 bool offline:1;
1004 bool of_node_reused:1; 1018 bool of_node_reused:1;
1005 bool dma_32bit_limit:1;
1006}; 1019};
1007 1020
1008static inline struct device *kobj_to_dev(struct kobject *kobj) 1021static inline struct device *kobj_to_dev(struct kobject *kobj)
@@ -1316,31 +1329,36 @@ extern const char *dev_driver_string(const struct device *dev);
1316struct device_link *device_link_add(struct device *consumer, 1329struct device_link *device_link_add(struct device *consumer,
1317 struct device *supplier, u32 flags); 1330 struct device *supplier, u32 flags);
1318void device_link_del(struct device_link *link); 1331void device_link_del(struct device_link *link);
1332void device_link_remove(void *consumer, struct device *supplier);
1333
1334#ifndef dev_fmt
1335#define dev_fmt(fmt) fmt
1336#endif
1319 1337
1320#ifdef CONFIG_PRINTK 1338#ifdef CONFIG_PRINTK
1321 1339
1322extern __printf(3, 0) 1340__printf(3, 0)
1323int dev_vprintk_emit(int level, const struct device *dev, 1341int dev_vprintk_emit(int level, const struct device *dev,
1324 const char *fmt, va_list args); 1342 const char *fmt, va_list args);
1325extern __printf(3, 4) 1343__printf(3, 4)
1326int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); 1344int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
1327 1345
1328extern __printf(3, 4) 1346__printf(3, 4)
1329void dev_printk(const char *level, const struct device *dev, 1347void dev_printk(const char *level, const struct device *dev,
1330 const char *fmt, ...); 1348 const char *fmt, ...);
1331extern __printf(2, 3) 1349__printf(2, 3)
1332void dev_emerg(const struct device *dev, const char *fmt, ...); 1350void _dev_emerg(const struct device *dev, const char *fmt, ...);
1333extern __printf(2, 3) 1351__printf(2, 3)
1334void dev_alert(const struct device *dev, const char *fmt, ...); 1352void _dev_alert(const struct device *dev, const char *fmt, ...);
1335extern __printf(2, 3) 1353__printf(2, 3)
1336void dev_crit(const struct device *dev, const char *fmt, ...); 1354void _dev_crit(const struct device *dev, const char *fmt, ...);
1337extern __printf(2, 3) 1355__printf(2, 3)
1338void dev_err(const struct device *dev, const char *fmt, ...); 1356void _dev_err(const struct device *dev, const char *fmt, ...);
1339extern __printf(2, 3) 1357__printf(2, 3)
1340void dev_warn(const struct device *dev, const char *fmt, ...); 1358void _dev_warn(const struct device *dev, const char *fmt, ...);
1341extern __printf(2, 3) 1359__printf(2, 3)
1342void dev_notice(const struct device *dev, const char *fmt, ...); 1360void _dev_notice(const struct device *dev, const char *fmt, ...);
1343extern __printf(2, 3) 1361__printf(2, 3)
1344void _dev_info(const struct device *dev, const char *fmt, ...); 1362void _dev_info(const struct device *dev, const char *fmt, ...);
1345 1363
1346#else 1364#else
@@ -1358,26 +1376,26 @@ static inline void __dev_printk(const char *level, const struct device *dev,
1358{} 1376{}
1359static inline __printf(3, 4) 1377static inline __printf(3, 4)
1360void dev_printk(const char *level, const struct device *dev, 1378void dev_printk(const char *level, const struct device *dev,
1361 const char *fmt, ...) 1379 const char *fmt, ...)
1362{} 1380{}
1363 1381
1364static inline __printf(2, 3) 1382static inline __printf(2, 3)
1365void dev_emerg(const struct device *dev, const char *fmt, ...) 1383void _dev_emerg(const struct device *dev, const char *fmt, ...)
1366{} 1384{}
1367static inline __printf(2, 3) 1385static inline __printf(2, 3)
1368void dev_crit(const struct device *dev, const char *fmt, ...) 1386void _dev_crit(const struct device *dev, const char *fmt, ...)
1369{} 1387{}
1370static inline __printf(2, 3) 1388static inline __printf(2, 3)
1371void dev_alert(const struct device *dev, const char *fmt, ...) 1389void _dev_alert(const struct device *dev, const char *fmt, ...)
1372{} 1390{}
1373static inline __printf(2, 3) 1391static inline __printf(2, 3)
1374void dev_err(const struct device *dev, const char *fmt, ...) 1392void _dev_err(const struct device *dev, const char *fmt, ...)
1375{} 1393{}
1376static inline __printf(2, 3) 1394static inline __printf(2, 3)
1377void dev_warn(const struct device *dev, const char *fmt, ...) 1395void _dev_warn(const struct device *dev, const char *fmt, ...)
1378{} 1396{}
1379static inline __printf(2, 3) 1397static inline __printf(2, 3)
1380void dev_notice(const struct device *dev, const char *fmt, ...) 1398void _dev_notice(const struct device *dev, const char *fmt, ...)
1381{} 1399{}
1382static inline __printf(2, 3) 1400static inline __printf(2, 3)
1383void _dev_info(const struct device *dev, const char *fmt, ...) 1401void _dev_info(const struct device *dev, const char *fmt, ...)
@@ -1386,27 +1404,36 @@ void _dev_info(const struct device *dev, const char *fmt, ...)
1386#endif 1404#endif
1387 1405
1388/* 1406/*
1389 * Stupid hackaround for existing uses of non-printk uses dev_info 1407 * #defines for all the dev_<level> macros to prefix with whatever
1390 * 1408 * possible use of #define dev_fmt(fmt) ...
1391 * Note that the definition of dev_info below is actually _dev_info
1392 * and a macro is used to avoid redefining dev_info
1393 */ 1409 */
1394 1410
1395#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) 1411#define dev_emerg(dev, fmt, ...) \
1412 _dev_emerg(dev, dev_fmt(fmt), ##__VA_ARGS__)
1413#define dev_crit(dev, fmt, ...) \
1414 _dev_crit(dev, dev_fmt(fmt), ##__VA_ARGS__)
1415#define dev_alert(dev, fmt, ...) \
1416 _dev_alert(dev, dev_fmt(fmt), ##__VA_ARGS__)
1417#define dev_err(dev, fmt, ...) \
1418 _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
1419#define dev_warn(dev, fmt, ...) \
1420 _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
1421#define dev_notice(dev, fmt, ...) \
1422 _dev_notice(dev, dev_fmt(fmt), ##__VA_ARGS__)
1423#define dev_info(dev, fmt, ...) \
1424 _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
1396 1425
1397#if defined(CONFIG_DYNAMIC_DEBUG) 1426#if defined(CONFIG_DYNAMIC_DEBUG)
1398#define dev_dbg(dev, format, ...) \ 1427#define dev_dbg(dev, fmt, ...) \
1399do { \ 1428 dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
1400 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
1401} while (0)
1402#elif defined(DEBUG) 1429#elif defined(DEBUG)
1403#define dev_dbg(dev, format, arg...) \ 1430#define dev_dbg(dev, fmt, ...) \
1404 dev_printk(KERN_DEBUG, dev, format, ##arg) 1431 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
1405#else 1432#else
1406#define dev_dbg(dev, format, arg...) \ 1433#define dev_dbg(dev, fmt, ...) \
1407({ \ 1434({ \
1408 if (0) \ 1435 if (0) \
1409 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1436 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
1410}) 1437})
1411#endif 1438#endif
1412 1439
@@ -1478,7 +1505,7 @@ do { \
1478 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1505 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
1479 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1506 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
1480 __ratelimit(&_rs)) \ 1507 __ratelimit(&_rs)) \
1481 __dynamic_dev_dbg(&descriptor, dev, fmt, \ 1508 __dynamic_dev_dbg(&descriptor, dev, dev_fmt(fmt), \
1482 ##__VA_ARGS__); \ 1509 ##__VA_ARGS__); \
1483} while (0) 1510} while (0)
1484#elif defined(DEBUG) 1511#elif defined(DEBUG)
@@ -1488,23 +1515,23 @@ do { \
1488 DEFAULT_RATELIMIT_INTERVAL, \ 1515 DEFAULT_RATELIMIT_INTERVAL, \
1489 DEFAULT_RATELIMIT_BURST); \ 1516 DEFAULT_RATELIMIT_BURST); \
1490 if (__ratelimit(&_rs)) \ 1517 if (__ratelimit(&_rs)) \
1491 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1518 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
1492} while (0) 1519} while (0)
1493#else 1520#else
1494#define dev_dbg_ratelimited(dev, fmt, ...) \ 1521#define dev_dbg_ratelimited(dev, fmt, ...) \
1495do { \ 1522do { \
1496 if (0) \ 1523 if (0) \
1497 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1524 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
1498} while (0) 1525} while (0)
1499#endif 1526#endif
1500 1527
1501#ifdef VERBOSE_DEBUG 1528#ifdef VERBOSE_DEBUG
1502#define dev_vdbg dev_dbg 1529#define dev_vdbg dev_dbg
1503#else 1530#else
1504#define dev_vdbg(dev, format, arg...) \ 1531#define dev_vdbg(dev, fmt, ...) \
1505({ \ 1532({ \
1506 if (0) \ 1533 if (0) \
1507 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1534 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
1508}) 1535})
1509#endif 1536#endif
1510 1537
diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h
index cfac8588ed56..e42de7750c88 100644
--- a/include/linux/dm-kcopyd.h
+++ b/include/linux/dm-kcopyd.h
@@ -62,9 +62,9 @@ void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
62typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err, 62typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err,
63 void *context); 63 void *context);
64 64
65int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, 65void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
66 unsigned num_dests, struct dm_io_region *dests, 66 unsigned num_dests, struct dm_io_region *dests,
67 unsigned flags, dm_kcopyd_notify_fn fn, void *context); 67 unsigned flags, dm_kcopyd_notify_fn fn, void *context);
68 68
69/* 69/*
70 * Prepare a callback and submit it via the kcopyd thread. 70 * Prepare a callback and submit it via the kcopyd thread.
@@ -81,9 +81,9 @@ void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc,
81 dm_kcopyd_notify_fn fn, void *context); 81 dm_kcopyd_notify_fn fn, void *context);
82void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err); 82void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err);
83 83
84int dm_kcopyd_zero(struct dm_kcopyd_client *kc, 84void dm_kcopyd_zero(struct dm_kcopyd_client *kc,
85 unsigned num_dests, struct dm_io_region *dests, 85 unsigned num_dests, struct dm_io_region *dests,
86 unsigned flags, dm_kcopyd_notify_fn fn, void *context); 86 unsigned flags, dm_kcopyd_notify_fn fn, void *context);
87 87
88#endif /* __KERNEL__ */ 88#endif /* __KERNEL__ */
89#endif /* _LINUX_DM_KCOPYD_H */ 89#endif /* _LINUX_DM_KCOPYD_H */
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 085db2fee2d7..58725f890b5b 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -39,12 +39,12 @@ struct dma_buf_attachment;
39 39
40/** 40/**
41 * struct dma_buf_ops - operations possible on struct dma_buf 41 * struct dma_buf_ops - operations possible on struct dma_buf
42 * @map_atomic: maps a page from the buffer into kernel address 42 * @map_atomic: [optional] maps a page from the buffer into kernel address
43 * space, users may not block until the subsequent unmap call. 43 * space, users may not block until the subsequent unmap call.
44 * This callback must not sleep. 44 * This callback must not sleep.
45 * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer. 45 * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer.
46 * This Callback must not sleep. 46 * This Callback must not sleep.
47 * @map: maps a page from the buffer into kernel address space. 47 * @map: [optional] maps a page from the buffer into kernel address space.
48 * @unmap: [optional] unmaps a page from the buffer. 48 * @unmap: [optional] unmaps a page from the buffer.
49 * @vmap: [optional] creates a virtual mapping for the buffer into kernel 49 * @vmap: [optional] creates a virtual mapping for the buffer into kernel
50 * address space. Same restrictions as for vmap and friends apply. 50 * address space. Same restrictions as for vmap and friends apply.
@@ -55,11 +55,11 @@ struct dma_buf_ops {
55 * @attach: 55 * @attach:
56 * 56 *
57 * This is called from dma_buf_attach() to make sure that a given 57 * This is called from dma_buf_attach() to make sure that a given
58 * &device can access the provided &dma_buf. Exporters which support 58 * &dma_buf_attachment.dev can access the provided &dma_buf. Exporters
59 * buffer objects in special locations like VRAM or device-specific 59 * which support buffer objects in special locations like VRAM or
60 * carveout areas should check whether the buffer could be move to 60 * device-specific carveout areas should check whether the buffer could
61 * system memory (or directly accessed by the provided device), and 61 * be move to system memory (or directly accessed by the provided
62 * otherwise need to fail the attach operation. 62 * device), and otherwise need to fail the attach operation.
63 * 63 *
64 * The exporter should also in general check whether the current 64 * The exporter should also in general check whether the current
65 * allocation fullfills the DMA constraints of the new device. If this 65 * allocation fullfills the DMA constraints of the new device. If this
@@ -77,8 +77,7 @@ struct dma_buf_ops {
77 * to signal that backing storage is already allocated and incompatible 77 * to signal that backing storage is already allocated and incompatible
78 * with the requirements of requesting device. 78 * with the requirements of requesting device.
79 */ 79 */
80 int (*attach)(struct dma_buf *, struct device *, 80 int (*attach)(struct dma_buf *, struct dma_buf_attachment *);
81 struct dma_buf_attachment *);
82 81
83 /** 82 /**
84 * @detach: 83 * @detach:
@@ -206,8 +205,6 @@ struct dma_buf_ops {
206 * to be restarted. 205 * to be restarted.
207 */ 206 */
208 int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); 207 int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction);
209 void *(*map_atomic)(struct dma_buf *, unsigned long);
210 void (*unmap_atomic)(struct dma_buf *, unsigned long, void *);
211 void *(*map)(struct dma_buf *, unsigned long); 208 void *(*map)(struct dma_buf *, unsigned long);
212 void (*unmap)(struct dma_buf *, unsigned long, void *); 209 void (*unmap)(struct dma_buf *, unsigned long, void *);
213 210
@@ -395,8 +392,6 @@ int dma_buf_begin_cpu_access(struct dma_buf *dma_buf,
395 enum dma_data_direction dir); 392 enum dma_data_direction dir);
396int dma_buf_end_cpu_access(struct dma_buf *dma_buf, 393int dma_buf_end_cpu_access(struct dma_buf *dma_buf,
397 enum dma_data_direction dir); 394 enum dma_data_direction dir);
398void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long);
399void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);
400void *dma_buf_kmap(struct dma_buf *, unsigned long); 395void *dma_buf_kmap(struct dma_buf *, unsigned long);
401void dma_buf_kunmap(struct dma_buf *, unsigned long, void *); 396void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);
402 397
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 3c5a4cb3eb95..f247e8aa5e3d 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -112,7 +112,7 @@ static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size,
112} 112}
113 113
114struct page *dma_alloc_from_contiguous(struct device *dev, size_t count, 114struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
115 unsigned int order, gfp_t gfp_mask); 115 unsigned int order, bool no_warn);
116bool dma_release_from_contiguous(struct device *dev, struct page *pages, 116bool dma_release_from_contiguous(struct device *dev, struct page *pages,
117 int count); 117 int count);
118 118
@@ -145,7 +145,7 @@ int dma_declare_contiguous(struct device *dev, phys_addr_t size,
145 145
146static inline 146static inline
147struct page *dma_alloc_from_contiguous(struct device *dev, size_t count, 147struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
148 unsigned int order, gfp_t gfp_mask) 148 unsigned int order, bool no_warn)
149{ 149{
150 return NULL; 150 return NULL;
151} 151}
diff --git a/include/linux/dma-direction.h b/include/linux/dma-direction.h
index 3649a031893a..9c96e30e6a0b 100644
--- a/include/linux/dma-direction.h
+++ b/include/linux/dma-direction.h
@@ -1,14 +1,12 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_DMA_DIRECTION_H 2#ifndef _LINUX_DMA_DIRECTION_H
3#define _LINUX_DMA_DIRECTION_H 3#define _LINUX_DMA_DIRECTION_H
4/* 4
5 * These definitions mirror those in pci.h, so they can be used
6 * interchangeably with their PCI_ counterparts.
7 */
8enum dma_data_direction { 5enum dma_data_direction {
9 DMA_BIDIRECTIONAL = 0, 6 DMA_BIDIRECTIONAL = 0,
10 DMA_TO_DEVICE = 1, 7 DMA_TO_DEVICE = 1,
11 DMA_FROM_DEVICE = 2, 8 DMA_FROM_DEVICE = 2,
12 DMA_NONE = 3, 9 DMA_NONE = 3,
13}; 10};
11
14#endif 12#endif
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index eb9b05aa5aea..02dba8cd033d 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -166,7 +166,8 @@ struct dma_fence_ops {
166 * released when the fence is signalled (through e.g. the interrupt 166 * released when the fence is signalled (through e.g. the interrupt
167 * handler). 167 * handler).
168 * 168 *
169 * This callback is mandatory. 169 * This callback is optional. If this callback is not present, then the
170 * driver must always have signaling enabled.
170 */ 171 */
171 bool (*enable_signaling)(struct dma_fence *fence); 172 bool (*enable_signaling)(struct dma_fence *fence);
172 173
@@ -190,11 +191,14 @@ struct dma_fence_ops {
190 /** 191 /**
191 * @wait: 192 * @wait:
192 * 193 *
193 * Custom wait implementation, or dma_fence_default_wait. 194 * Custom wait implementation, defaults to dma_fence_default_wait() if
195 * not set.
194 * 196 *
195 * Must not be NULL, set to dma_fence_default_wait for default implementation. 197 * The dma_fence_default_wait implementation should work for any fence, as long
196 * the dma_fence_default_wait implementation should work for any fence, as long 198 * as @enable_signaling works correctly. This hook allows drivers to
197 * as enable_signaling works correctly. 199 * have an optimized version for the case where a process context is
200 * already available, e.g. if @enable_signaling for the general case
201 * needs to set up a worker thread.
198 * 202 *
199 * Must return -ERESTARTSYS if the wait is intr = true and the wait was 203 * Must return -ERESTARTSYS if the wait is intr = true and the wait was
200 * interrupted, and remaining jiffies if fence has signaled, or 0 if wait 204 * interrupted, and remaining jiffies if fence has signaled, or 0 if wait
@@ -202,7 +206,7 @@ struct dma_fence_ops {
202 * which should be treated as if the fence is signaled. For example a hardware 206 * which should be treated as if the fence is signaled. For example a hardware
203 * lockup could be reported like that. 207 * lockup could be reported like that.
204 * 208 *
205 * This callback is mandatory. 209 * This callback is optional.
206 */ 210 */
207 signed long (*wait)(struct dma_fence *fence, 211 signed long (*wait)(struct dma_fence *fence,
208 bool intr, signed long timeout); 212 bool intr, signed long timeout);
@@ -218,17 +222,6 @@ struct dma_fence_ops {
218 void (*release)(struct dma_fence *fence); 222 void (*release)(struct dma_fence *fence);
219 223
220 /** 224 /**
221 * @fill_driver_data:
222 *
223 * Callback to fill in free-form debug info.
224 *
225 * Returns amount of bytes filled, or negative error on failure.
226 *
227 * This callback is optional.
228 */
229 int (*fill_driver_data)(struct dma_fence *fence, void *data, int size);
230
231 /**
232 * @fence_value_str: 225 * @fence_value_str:
233 * 226 *
234 * Callback to fill in free-form debug info specific to this fence, like 227 * Callback to fill in free-form debug info specific to this fence, like
@@ -242,8 +235,9 @@ struct dma_fence_ops {
242 * @timeline_value_str: 235 * @timeline_value_str:
243 * 236 *
244 * Fills in the current value of the timeline as a string, like the 237 * Fills in the current value of the timeline as a string, like the
245 * sequence number. This should match what @fill_driver_data prints for 238 * sequence number. Note that the specific fence passed to this function
246 * the most recently signalled fence (assuming no delayed signalling). 239 * should not matter, drivers should only use it to look up the
240 * corresponding timeline structures.
247 */ 241 */
248 void (*timeline_value_str)(struct dma_fence *fence, 242 void (*timeline_value_str)(struct dma_fence *fence,
249 char *str, int size); 243 char *str, int size);
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index f9cc309507d9..1db6a6b46d0d 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -538,10 +538,17 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
538 const struct dma_map_ops *ops = get_dma_ops(dev); 538 const struct dma_map_ops *ops = get_dma_ops(dev);
539 539
540 BUG_ON(!ops); 540 BUG_ON(!ops);
541 WARN_ON(irqs_disabled());
542 541
543 if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr)) 542 if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr))
544 return; 543 return;
544 /*
545 * On non-coherent platforms which implement DMA-coherent buffers via
546 * non-cacheable remaps, ops->free() may call vunmap(). Thus getting
547 * this far in IRQ context is a) at risk of a BUG_ON() or trying to
548 * sleep on some machines, and b) an indication that the driver is
549 * probably misusing the coherent API anyway.
550 */
551 WARN_ON(irqs_disabled());
545 552
546 if (!ops->free || !cpu_addr) 553 if (!ops->free || !cpu_addr)
547 return; 554 return;
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
index 10b2654d549b..a0aa00cc909d 100644
--- a/include/linux/dma-noncoherent.h
+++ b/include/linux/dma-noncoherent.h
@@ -44,4 +44,12 @@ static inline void arch_sync_dma_for_cpu(struct device *dev,
44} 44}
45#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */ 45#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
46 46
47#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
48void arch_sync_dma_for_cpu_all(struct device *dev);
49#else
50static inline void arch_sync_dma_for_cpu_all(struct device *dev)
51{
52}
53#endif /* CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL */
54
47#endif /* _LINUX_DMA_NONCOHERENT_H */ 55#endif /* _LINUX_DMA_NONCOHERENT_H */
diff --git a/include/linux/dma/pxa-dma.h b/include/linux/dma/pxa-dma.h
index e56ec7af4fd7..9fc594f69eff 100644
--- a/include/linux/dma/pxa-dma.h
+++ b/include/linux/dma/pxa-dma.h
@@ -9,6 +9,15 @@ enum pxad_chan_prio {
9 PXAD_PRIO_LOWEST, 9 PXAD_PRIO_LOWEST,
10}; 10};
11 11
12/**
13 * struct pxad_param - dma channel request parameters
14 * @drcmr: requestor line number
15 * @prio: minimal mandatory priority of the channel
16 *
17 * If a requested channel is granted, its priority will be at least @prio,
18 * ie. if PXAD_PRIO_LOW is required, the requested channel will be either
19 * PXAD_PRIO_LOW, PXAD_PRIO_NORMAL or PXAD_PRIO_HIGHEST.
20 */
12struct pxad_param { 21struct pxad_param {
13 unsigned int drcmr; 22 unsigned int drcmr;
14 enum pxad_chan_prio prio; 23 enum pxad_chan_prio prio;
diff --git a/include/linux/dma/xilinx_dma.h b/include/linux/dma/xilinx_dma.h
index 34b98f276ed0..5b6e61e4b3aa 100644
--- a/include/linux/dma/xilinx_dma.h
+++ b/include/linux/dma/xilinx_dma.h
@@ -27,6 +27,7 @@
27 * @delay: Delay counter 27 * @delay: Delay counter
28 * @reset: Reset Channel 28 * @reset: Reset Channel
29 * @ext_fsync: External Frame Sync source 29 * @ext_fsync: External Frame Sync source
30 * @vflip_en: Vertical Flip enable
30 */ 31 */
31struct xilinx_vdma_config { 32struct xilinx_vdma_config {
32 int frm_dly; 33 int frm_dly;
@@ -39,6 +40,7 @@ struct xilinx_vdma_config {
39 int delay; 40 int delay;
40 int reset; 41 int reset;
41 int ext_fsync; 42 int ext_fsync;
43 bool vflip_en;
42}; 44};
43 45
44int xilinx_vdma_channel_set_config(struct dma_chan *dchan, 46int xilinx_vdma_channel_set_config(struct dma_chan *dchan,
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 861be5cab1df..d49ec5c31944 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -415,7 +415,9 @@ enum dma_residue_granularity {
415 * each type, the dma controller should set BIT(<TYPE>) and same 415 * each type, the dma controller should set BIT(<TYPE>) and same
416 * should be checked by controller as well 416 * should be checked by controller as well
417 * @max_burst: max burst capability per-transfer 417 * @max_burst: max burst capability per-transfer
418 * @cmd_pause: true, if pause and thereby resume is supported 418 * @cmd_pause: true, if pause is supported (i.e. for reading residue or
419 * for resume later)
420 * @cmd_resume: true, if resume is supported
419 * @cmd_terminate: true, if terminate cmd is supported 421 * @cmd_terminate: true, if terminate cmd is supported
420 * @residue_granularity: granularity of the reported transfer residue 422 * @residue_granularity: granularity of the reported transfer residue
421 * @descriptor_reuse: if a descriptor can be reused by client and 423 * @descriptor_reuse: if a descriptor can be reused by client and
@@ -427,6 +429,7 @@ struct dma_slave_caps {
427 u32 directions; 429 u32 directions;
428 u32 max_burst; 430 u32 max_burst;
429 bool cmd_pause; 431 bool cmd_pause;
432 bool cmd_resume;
430 bool cmd_terminate; 433 bool cmd_terminate;
431 enum dma_residue_granularity residue_granularity; 434 enum dma_residue_granularity residue_granularity;
432 bool descriptor_reuse; 435 bool descriptor_reuse;
@@ -1403,6 +1406,7 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
1403/* --- DMA device --- */ 1406/* --- DMA device --- */
1404 1407
1405int dma_async_device_register(struct dma_device *device); 1408int dma_async_device_register(struct dma_device *device);
1409int dmaenginem_async_device_register(struct dma_device *device);
1406void dma_async_device_unregister(struct dma_device *device); 1410void dma_async_device_unregister(struct dma_device *device);
1407void dma_run_dependencies(struct dma_async_tx_descriptor *tx); 1411void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
1408struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); 1412struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index e2433bc50210..843a41ba7e28 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -265,11 +265,6 @@ static inline void dmar_copy_shared_irte(struct irte *dst, struct irte *src)
265#define PDA_LOW_BIT 26 265#define PDA_LOW_BIT 26
266#define PDA_HIGH_BIT 32 266#define PDA_HIGH_BIT 32
267 267
268enum {
269 IRQ_REMAP_XAPIC_MODE,
270 IRQ_REMAP_X2APIC_MODE,
271};
272
273/* Can't use the common MSI interrupt functions 268/* Can't use the common MSI interrupt functions
274 * since DMAR is not a pci device 269 * since DMAR is not a pci device
275 */ 270 */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 79563840c295..572e11bb8696 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -59,8 +59,7 @@ struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv,
59 unsigned int rxqs); 59 unsigned int rxqs);
60#define devm_alloc_etherdev(dev, sizeof_priv) devm_alloc_etherdev_mqs(dev, sizeof_priv, 1, 1) 60#define devm_alloc_etherdev(dev, sizeof_priv) devm_alloc_etherdev_mqs(dev, sizeof_priv, 1, 1)
61 61
62struct sk_buff **eth_gro_receive(struct sk_buff **head, 62struct sk_buff *eth_gro_receive(struct list_head *head, struct sk_buff *skb);
63 struct sk_buff *skb);
64int eth_gro_complete(struct sk_buff *skb, int nhoff); 63int eth_gro_complete(struct sk_buff *skb, int nhoff);
65 64
66/* Reserved Ethernet Addresses per IEEE 802.1Q */ 65/* Reserved Ethernet Addresses per IEEE 802.1Q */
diff --git a/include/linux/export.h b/include/linux/export.h
index b768d6dd3c90..ce764a5d2ee4 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -10,20 +10,7 @@
10 * hackers place grumpy comments in header files. 10 * hackers place grumpy comments in header files.
11 */ 11 */
12 12
13#define __VMLINUX_SYMBOL(x) x
14#define __VMLINUX_SYMBOL_STR(x) #x
15
16/* Indirect, so macros are expanded before pasting. */
17#define VMLINUX_SYMBOL(x) __VMLINUX_SYMBOL(x)
18#define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x)
19
20#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
21struct kernel_symbol
22{
23 unsigned long value;
24 const char *name;
25};
26
27#ifdef MODULE 14#ifdef MODULE
28extern struct module __this_module; 15extern struct module __this_module;
29#define THIS_MODULE (&__this_module) 16#define THIS_MODULE (&__this_module)
@@ -54,19 +41,58 @@ extern struct module __this_module;
54#define __CRC_SYMBOL(sym, sec) 41#define __CRC_SYMBOL(sym, sec)
55#endif 42#endif
56 43
44#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
45#include <linux/compiler.h>
46/*
47 * Emit the ksymtab entry as a pair of relative references: this reduces
48 * the size by half on 64-bit architectures, and eliminates the need for
49 * absolute relocations that require runtime processing on relocatable
50 * kernels.
51 */
52#define __KSYMTAB_ENTRY(sym, sec) \
53 __ADDRESSABLE(sym) \
54 asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \
55 " .balign 8 \n" \
56 "__ksymtab_" #sym ": \n" \
57 " .long " #sym "- . \n" \
58 " .long __kstrtab_" #sym "- . \n" \
59 " .previous \n")
60
61struct kernel_symbol {
62 int value_offset;
63 int name_offset;
64};
65#else
66#define __KSYMTAB_ENTRY(sym, sec) \
67 static const struct kernel_symbol __ksymtab_##sym \
68 __attribute__((section("___ksymtab" sec "+" #sym), used)) \
69 = { (unsigned long)&sym, __kstrtab_##sym }
70
71struct kernel_symbol {
72 unsigned long value;
73 const char *name;
74};
75#endif
76
57/* For every exported symbol, place a struct in the __ksymtab section */ 77/* For every exported symbol, place a struct in the __ksymtab section */
58#define ___EXPORT_SYMBOL(sym, sec) \ 78#define ___EXPORT_SYMBOL(sym, sec) \
59 extern typeof(sym) sym; \ 79 extern typeof(sym) sym; \
60 __CRC_SYMBOL(sym, sec) \ 80 __CRC_SYMBOL(sym, sec) \
61 static const char __kstrtab_##sym[] \ 81 static const char __kstrtab_##sym[] \
62 __attribute__((section("__ksymtab_strings"), aligned(1))) \ 82 __attribute__((section("__ksymtab_strings"), used, aligned(1))) \
63 = #sym; \ 83 = #sym; \
64 static const struct kernel_symbol __ksymtab_##sym \ 84 __KSYMTAB_ENTRY(sym, sec)
65 __used \ 85
66 __attribute__((section("___ksymtab" sec "+" #sym), used)) \ 86#if defined(__DISABLE_EXPORTS)
67 = { (unsigned long)&sym, __kstrtab_##sym } 87
88/*
89 * Allow symbol exports to be disabled completely so that C code may
90 * be reused in other execution contexts such as the UEFI stub or the
91 * decompressor.
92 */
93#define __EXPORT_SYMBOL(sym, sec)
68 94
69#if defined(__KSYM_DEPS__) 95#elif defined(__KSYM_DEPS__)
70 96
71/* 97/*
72 * For fine grained build dependencies, we want to tell the build system 98 * For fine grained build dependencies, we want to tell the build system
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index aa5db8b5521a..f70f8ac9c4f4 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -304,11 +304,6 @@ struct f2fs_node {
304 * For NAT entries 304 * For NAT entries
305 */ 305 */
306#define NAT_ENTRY_PER_BLOCK (PAGE_SIZE / sizeof(struct f2fs_nat_entry)) 306#define NAT_ENTRY_PER_BLOCK (PAGE_SIZE / sizeof(struct f2fs_nat_entry))
307#define NAT_ENTRY_BITMAP_SIZE ((NAT_ENTRY_PER_BLOCK + 7) / 8)
308#define NAT_ENTRY_BITMAP_SIZE_ALIGNED \
309 ((NAT_ENTRY_BITMAP_SIZE + BITS_PER_LONG - 1) / \
310 BITS_PER_LONG * BITS_PER_LONG)
311
312 307
313struct f2fs_nat_entry { 308struct f2fs_nat_entry {
314 __u8 version; /* latest version of cached nat entry */ 309 __u8 version; /* latest version of cached nat entry */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index aa74a228bb92..3e7e75383d32 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -126,7 +126,7 @@ struct fb_cursor_user {
126 126
127/* The resolution of the passed in fb_info about to change */ 127/* The resolution of the passed in fb_info about to change */
128#define FB_EVENT_MODE_CHANGE 0x01 128#define FB_EVENT_MODE_CHANGE 0x01
129/* The display on this fb_info is beeing suspended, no access to the 129/* The display on this fb_info is being suspended, no access to the
130 * framebuffer is allowed any more after that call returns 130 * framebuffer is allowed any more after that call returns
131 */ 131 */
132#define FB_EVENT_SUSPEND 0x02 132#define FB_EVENT_SUSPEND 0x02
@@ -159,9 +159,9 @@ struct fb_cursor_user {
159#define FB_EVENT_FB_UNBIND 0x0E 159#define FB_EVENT_FB_UNBIND 0x0E
160/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ 160/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
161#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F 161#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
162/* A hardware display blank early change occured */ 162/* A hardware display blank early change occurred */
163#define FB_EARLY_EVENT_BLANK 0x10 163#define FB_EARLY_EVENT_BLANK 0x10
164/* A hardware display blank revert early change occured */ 164/* A hardware display blank revert early change occurred */
165#define FB_R_EARLY_EVENT_BLANK 0x11 165#define FB_R_EARLY_EVENT_BLANK 0x11
166 166
167struct fb_event { 167struct fb_event {
@@ -650,6 +650,10 @@ extern struct fb_info *registered_fb[FB_MAX];
650extern int num_registered_fb; 650extern int num_registered_fb;
651extern struct class *fb_class; 651extern struct class *fb_class;
652 652
653#define for_each_registered_fb(i) \
654 for (i = 0; i < FB_MAX; i++) \
655 if (!registered_fb[i]) {} else
656
653extern int lock_fb_info(struct fb_info *info); 657extern int lock_fb_info(struct fb_info *info);
654 658
655static inline void unlock_fb_info(struct fb_info *info) 659static inline void unlock_fb_info(struct fb_info *info)
diff --git a/include/linux/file.h b/include/linux/file.h
index 279720db984a..6b2fb032416c 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -17,9 +17,12 @@ extern void fput(struct file *);
17struct file_operations; 17struct file_operations;
18struct vfsmount; 18struct vfsmount;
19struct dentry; 19struct dentry;
20struct inode;
20struct path; 21struct path;
21extern struct file *alloc_file(const struct path *, fmode_t mode, 22extern struct file *alloc_file_pseudo(struct inode *, struct vfsmount *,
22 const struct file_operations *fop); 23 const char *, int flags, const struct file_operations *);
24extern struct file *alloc_file_clone(struct file *, int flags,
25 const struct file_operations *);
23 26
24static inline void fput_light(struct file *file, int fput_needed) 27static inline void fput_light(struct file *file, int fput_needed)
25{ 28{
@@ -78,7 +81,6 @@ extern int f_dupfd(unsigned int from, struct file *file, unsigned flags);
78extern int replace_fd(unsigned fd, struct file *file, unsigned flags); 81extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
79extern void set_close_on_exec(unsigned int fd, int flag); 82extern void set_close_on_exec(unsigned int fd, int flag);
80extern bool get_close_on_exec(unsigned int fd); 83extern bool get_close_on_exec(unsigned int fd);
81extern void put_filp(struct file *);
82extern int get_unused_fd_flags(unsigned flags); 84extern int get_unused_fd_flags(unsigned flags);
83extern void put_unused_fd(unsigned int fd); 85extern void put_unused_fd(unsigned int fd);
84 86
diff --git a/include/linux/filter.h b/include/linux/filter.h
index c73dd7396886..6791a0ac0139 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -32,6 +32,7 @@ struct seccomp_data;
32struct bpf_prog_aux; 32struct bpf_prog_aux;
33struct xdp_rxq_info; 33struct xdp_rxq_info;
34struct xdp_buff; 34struct xdp_buff;
35struct sock_reuseport;
35 36
36/* ArgX, context and stack frame pointer register positions. Note, 37/* ArgX, context and stack frame pointer register positions. Note,
37 * Arg1, Arg2, Arg3, etc are used as argument mappings of function 38 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
@@ -537,6 +538,19 @@ struct sk_msg_buff {
537 struct list_head list; 538 struct list_head list;
538}; 539};
539 540
541struct bpf_redirect_info {
542 u32 ifindex;
543 u32 flags;
544 struct bpf_map *map;
545 struct bpf_map *map_to_flush;
546 u32 kern_flags;
547};
548
549DECLARE_PER_CPU(struct bpf_redirect_info, bpf_redirect_info);
550
551/* flags for bpf_redirect_info kern_flags */
552#define BPF_RI_F_RF_NO_DIRECT BIT(0) /* no napi_direct on return_frame */
553
540/* Compute the linear packet data range [data, data_end) which 554/* Compute the linear packet data range [data, data_end) which
541 * will be accessed by various program types (cls_bpf, act_bpf, 555 * will be accessed by various program types (cls_bpf, act_bpf,
542 * lwt, ...). Subsystems allowing direct data access must (!) 556 * lwt, ...). Subsystems allowing direct data access must (!)
@@ -738,6 +752,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
738int sk_attach_bpf(u32 ufd, struct sock *sk); 752int sk_attach_bpf(u32 ufd, struct sock *sk);
739int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk); 753int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk);
740int sk_reuseport_attach_bpf(u32 ufd, struct sock *sk); 754int sk_reuseport_attach_bpf(u32 ufd, struct sock *sk);
755void sk_reuseport_prog_free(struct bpf_prog *prog);
741int sk_detach_filter(struct sock *sk); 756int sk_detach_filter(struct sock *sk);
742int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, 757int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
743 unsigned int len); 758 unsigned int len);
@@ -765,6 +780,29 @@ static inline bool bpf_dump_raw_ok(void)
765struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, 780struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
766 const struct bpf_insn *patch, u32 len); 781 const struct bpf_insn *patch, u32 len);
767 782
783void bpf_clear_redirect_map(struct bpf_map *map);
784
785static inline bool xdp_return_frame_no_direct(void)
786{
787 struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info);
788
789 return ri->kern_flags & BPF_RI_F_RF_NO_DIRECT;
790}
791
792static inline void xdp_set_return_frame_no_direct(void)
793{
794 struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info);
795
796 ri->kern_flags |= BPF_RI_F_RF_NO_DIRECT;
797}
798
799static inline void xdp_clear_return_frame_no_direct(void)
800{
801 struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info);
802
803 ri->kern_flags &= ~BPF_RI_F_RF_NO_DIRECT;
804}
805
768static inline int xdp_ok_fwd_dev(const struct net_device *fwd, 806static inline int xdp_ok_fwd_dev(const struct net_device *fwd,
769 unsigned int pktlen) 807 unsigned int pktlen)
770{ 808{
@@ -798,6 +836,20 @@ void bpf_warn_invalid_xdp_action(u32 act);
798struct sock *do_sk_redirect_map(struct sk_buff *skb); 836struct sock *do_sk_redirect_map(struct sk_buff *skb);
799struct sock *do_msg_redirect_map(struct sk_msg_buff *md); 837struct sock *do_msg_redirect_map(struct sk_msg_buff *md);
800 838
839#ifdef CONFIG_INET
840struct sock *bpf_run_sk_reuseport(struct sock_reuseport *reuse, struct sock *sk,
841 struct bpf_prog *prog, struct sk_buff *skb,
842 u32 hash);
843#else
844static inline struct sock *
845bpf_run_sk_reuseport(struct sock_reuseport *reuse, struct sock *sk,
846 struct bpf_prog *prog, struct sk_buff *skb,
847 u32 hash)
848{
849 return NULL;
850}
851#endif
852
801#ifdef CONFIG_BPF_JIT 853#ifdef CONFIG_BPF_JIT
802extern int bpf_jit_enable; 854extern int bpf_jit_enable;
803extern int bpf_jit_harden; 855extern int bpf_jit_harden;
diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h
index eec7c2478b0d..8942e61f0028 100644
--- a/include/linux/fpga/fpga-mgr.h
+++ b/include/linux/fpga/fpga-mgr.h
@@ -77,6 +77,7 @@ enum fpga_mgr_states {
77 * @sgt: scatter/gather table containing FPGA image 77 * @sgt: scatter/gather table containing FPGA image
78 * @buf: contiguous buffer containing FPGA image 78 * @buf: contiguous buffer containing FPGA image
79 * @count: size of buf 79 * @count: size of buf
80 * @region_id: id of target region
80 * @dev: device that owns this 81 * @dev: device that owns this
81 * @overlay: Device Tree overlay 82 * @overlay: Device Tree overlay
82 */ 83 */
@@ -89,6 +90,7 @@ struct fpga_image_info {
89 struct sg_table *sgt; 90 struct sg_table *sgt;
90 const char *buf; 91 const char *buf;
91 size_t count; 92 size_t count;
93 int region_id;
92 struct device *dev; 94 struct device *dev;
93#ifdef CONFIG_OF 95#ifdef CONFIG_OF
94 struct device_node *overlay; 96 struct device_node *overlay;
@@ -99,6 +101,7 @@ struct fpga_image_info {
99 * struct fpga_manager_ops - ops for low level fpga manager drivers 101 * struct fpga_manager_ops - ops for low level fpga manager drivers
100 * @initial_header_size: Maximum number of bytes that should be passed into write_init 102 * @initial_header_size: Maximum number of bytes that should be passed into write_init
101 * @state: returns an enum value of the FPGA's state 103 * @state: returns an enum value of the FPGA's state
104 * @status: returns status of the FPGA, including reconfiguration error code
102 * @write_init: prepare the FPGA to receive confuration data 105 * @write_init: prepare the FPGA to receive confuration data
103 * @write: write count bytes of configuration data to the FPGA 106 * @write: write count bytes of configuration data to the FPGA
104 * @write_sg: write the scatter list of configuration data to the FPGA 107 * @write_sg: write the scatter list of configuration data to the FPGA
@@ -113,6 +116,7 @@ struct fpga_image_info {
113struct fpga_manager_ops { 116struct fpga_manager_ops {
114 size_t initial_header_size; 117 size_t initial_header_size;
115 enum fpga_mgr_states (*state)(struct fpga_manager *mgr); 118 enum fpga_mgr_states (*state)(struct fpga_manager *mgr);
119 u64 (*status)(struct fpga_manager *mgr);
116 int (*write_init)(struct fpga_manager *mgr, 120 int (*write_init)(struct fpga_manager *mgr,
117 struct fpga_image_info *info, 121 struct fpga_image_info *info,
118 const char *buf, size_t count); 122 const char *buf, size_t count);
@@ -124,12 +128,31 @@ struct fpga_manager_ops {
124 const struct attribute_group **groups; 128 const struct attribute_group **groups;
125}; 129};
126 130
131/* FPGA manager status: Partial/Full Reconfiguration errors */
132#define FPGA_MGR_STATUS_OPERATION_ERR BIT(0)
133#define FPGA_MGR_STATUS_CRC_ERR BIT(1)
134#define FPGA_MGR_STATUS_INCOMPATIBLE_IMAGE_ERR BIT(2)
135#define FPGA_MGR_STATUS_IP_PROTOCOL_ERR BIT(3)
136#define FPGA_MGR_STATUS_FIFO_OVERFLOW_ERR BIT(4)
137
138/**
139 * struct fpga_compat_id - id for compatibility check
140 *
141 * @id_h: high 64bit of the compat_id
142 * @id_l: low 64bit of the compat_id
143 */
144struct fpga_compat_id {
145 u64 id_h;
146 u64 id_l;
147};
148
127/** 149/**
128 * struct fpga_manager - fpga manager structure 150 * struct fpga_manager - fpga manager structure
129 * @name: name of low level fpga manager 151 * @name: name of low level fpga manager
130 * @dev: fpga manager device 152 * @dev: fpga manager device
131 * @ref_mutex: only allows one reference to fpga manager 153 * @ref_mutex: only allows one reference to fpga manager
132 * @state: state of fpga manager 154 * @state: state of fpga manager
155 * @compat_id: FPGA manager id for compatibility check.
133 * @mops: pointer to struct of fpga manager ops 156 * @mops: pointer to struct of fpga manager ops
134 * @priv: low level driver private date 157 * @priv: low level driver private date
135 */ 158 */
@@ -138,6 +161,7 @@ struct fpga_manager {
138 struct device dev; 161 struct device dev;
139 struct mutex ref_mutex; 162 struct mutex ref_mutex;
140 enum fpga_mgr_states state; 163 enum fpga_mgr_states state;
164 struct fpga_compat_id *compat_id;
141 const struct fpga_manager_ops *mops; 165 const struct fpga_manager_ops *mops;
142 void *priv; 166 void *priv;
143}; 167};
diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h
index d7071cddd727..0521b7f577a4 100644
--- a/include/linux/fpga/fpga-region.h
+++ b/include/linux/fpga/fpga-region.h
@@ -14,6 +14,7 @@
14 * @bridge_list: list of FPGA bridges specified in region 14 * @bridge_list: list of FPGA bridges specified in region
15 * @mgr: FPGA manager 15 * @mgr: FPGA manager
16 * @info: FPGA image info 16 * @info: FPGA image info
17 * @compat_id: FPGA region id for compatibility check.
17 * @priv: private data 18 * @priv: private data
18 * @get_bridges: optional function to get bridges to a list 19 * @get_bridges: optional function to get bridges to a list
19 */ 20 */
@@ -23,6 +24,7 @@ struct fpga_region {
23 struct list_head bridge_list; 24 struct list_head bridge_list;
24 struct fpga_manager *mgr; 25 struct fpga_manager *mgr;
25 struct fpga_image_info *info; 26 struct fpga_image_info *info;
27 struct fpga_compat_id *compat_id;
26 void *priv; 28 void *priv;
27 int (*get_bridges)(struct fpga_region *region); 29 int (*get_bridges)(struct fpga_region *region);
28}; 30};
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 805bf22898cf..33322702c910 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -74,6 +74,8 @@ extern struct inodes_stat_t inodes_stat;
74extern int leases_enable, lease_break_time; 74extern int leases_enable, lease_break_time;
75extern int sysctl_protected_symlinks; 75extern int sysctl_protected_symlinks;
76extern int sysctl_protected_hardlinks; 76extern int sysctl_protected_hardlinks;
77extern int sysctl_protected_fifos;
78extern int sysctl_protected_regular;
77 79
78typedef __kernel_rwf_t rwf_t; 80typedef __kernel_rwf_t rwf_t;
79 81
@@ -148,12 +150,18 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
148/* Has write method(s) */ 150/* Has write method(s) */
149#define FMODE_CAN_WRITE ((__force fmode_t)0x40000) 151#define FMODE_CAN_WRITE ((__force fmode_t)0x40000)
150 152
153#define FMODE_OPENED ((__force fmode_t)0x80000)
154#define FMODE_CREATED ((__force fmode_t)0x100000)
155
151/* File was opened by fanotify and shouldn't generate fanotify events */ 156/* File was opened by fanotify and shouldn't generate fanotify events */
152#define FMODE_NONOTIFY ((__force fmode_t)0x4000000) 157#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
153 158
154/* File is capable of returning -EAGAIN if I/O will block */ 159/* File is capable of returning -EAGAIN if I/O will block */
155#define FMODE_NOWAIT ((__force fmode_t)0x8000000) 160#define FMODE_NOWAIT ((__force fmode_t)0x8000000)
156 161
162/* File does not contribute to nr_files count */
163#define FMODE_NOACCOUNT ((__force fmode_t)0x20000000)
164
157/* 165/*
158 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector 166 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
159 * that indicates that they should check the contents of the iovec are 167 * that indicates that they should check the contents of the iovec are
@@ -176,7 +184,6 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
176#define ATTR_ATIME_SET (1 << 7) 184#define ATTR_ATIME_SET (1 << 7)
177#define ATTR_MTIME_SET (1 << 8) 185#define ATTR_MTIME_SET (1 << 8)
178#define ATTR_FORCE (1 << 9) /* Not a change, but a change it */ 186#define ATTR_FORCE (1 << 9) /* Not a change, but a change it */
179#define ATTR_ATTR_FLAG (1 << 10)
180#define ATTR_KILL_SUID (1 << 11) 187#define ATTR_KILL_SUID (1 << 11)
181#define ATTR_KILL_SGID (1 << 12) 188#define ATTR_KILL_SGID (1 << 12)
182#define ATTR_FILE (1 << 13) 189#define ATTR_FILE (1 << 13)
@@ -275,6 +282,7 @@ struct writeback_control;
275 282
276/* 283/*
277 * Write life time hint values. 284 * Write life time hint values.
285 * Stored in struct inode as u8.
278 */ 286 */
279enum rw_hint { 287enum rw_hint {
280 WRITE_LIFE_NOT_SET = 0, 288 WRITE_LIFE_NOT_SET = 0,
@@ -341,6 +349,10 @@ struct address_space_operations {
341 /* Set a page dirty. Return true if this dirtied it */ 349 /* Set a page dirty. Return true if this dirtied it */
342 int (*set_page_dirty)(struct page *page); 350 int (*set_page_dirty)(struct page *page);
343 351
352 /*
353 * Reads in the requested pages. Unlike ->readpage(), this is
354 * PURELY used for read-ahead!.
355 */
344 int (*readpages)(struct file *filp, struct address_space *mapping, 356 int (*readpages)(struct file *filp, struct address_space *mapping,
345 struct list_head *pages, unsigned nr_pages); 357 struct list_head *pages, unsigned nr_pages);
346 358
@@ -609,8 +621,8 @@ struct inode {
609 struct timespec64 i_ctime; 621 struct timespec64 i_ctime;
610 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 622 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
611 unsigned short i_bytes; 623 unsigned short i_bytes;
612 unsigned int i_blkbits; 624 u8 i_blkbits;
613 enum rw_hint i_write_hint; 625 u8 i_write_hint;
614 blkcnt_t i_blocks; 626 blkcnt_t i_blocks;
615 627
616#ifdef __NEED_I_SIZE_ORDERED 628#ifdef __NEED_I_SIZE_ORDERED
@@ -685,6 +697,17 @@ static inline int inode_unhashed(struct inode *inode)
685} 697}
686 698
687/* 699/*
700 * __mark_inode_dirty expects inodes to be hashed. Since we don't
701 * want special inodes in the fileset inode space, we make them
702 * appear hashed, but do not put on any lists. hlist_del()
703 * will work fine and require no locking.
704 */
705static inline void inode_fake_hash(struct inode *inode)
706{
707 hlist_add_fake(&inode->i_hash);
708}
709
710/*
688 * inode->i_mutex nesting subclasses for the lock validator: 711 * inode->i_mutex nesting subclasses for the lock validator:
689 * 712 *
690 * 0: the object of the current VFS operation 713 * 0: the object of the current VFS operation
@@ -1049,17 +1072,7 @@ struct file_lock_context {
1049 1072
1050extern void send_sigio(struct fown_struct *fown, int fd, int band); 1073extern void send_sigio(struct fown_struct *fown, int fd, int band);
1051 1074
1052/* 1075#define locks_inode(f) file_inode(f)
1053 * Return the inode to use for locking
1054 *
1055 * For overlayfs this should be the overlay inode, not the real inode returned
1056 * by file_inode(). For any other fs file_inode(filp) and locks_inode(filp) are
1057 * equal.
1058 */
1059static inline struct inode *locks_inode(const struct file *f)
1060{
1061 return f->f_path.dentry->d_inode;
1062}
1063 1076
1064#ifdef CONFIG_FILE_LOCKING 1077#ifdef CONFIG_FILE_LOCKING
1065extern int fcntl_getlk(struct file *, unsigned int, struct flock *); 1078extern int fcntl_getlk(struct file *, unsigned int, struct flock *);
@@ -1244,7 +1257,7 @@ static inline struct inode *file_inode(const struct file *f)
1244 1257
1245static inline struct dentry *file_dentry(const struct file *file) 1258static inline struct dentry *file_dentry(const struct file *file)
1246{ 1259{
1247 return d_real(file->f_path.dentry, file_inode(file), 0, 0); 1260 return d_real(file->f_path.dentry, file_inode(file));
1248} 1261}
1249 1262
1250static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) 1263static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
@@ -1300,7 +1313,6 @@ extern int send_sigurg(struct fown_struct *fown);
1300 1313
1301/* These sb flags are internal to the kernel */ 1314/* These sb flags are internal to the kernel */
1302#define SB_SUBMOUNT (1<<26) 1315#define SB_SUBMOUNT (1<<26)
1303#define SB_NOREMOTELOCK (1<<27)
1304#define SB_NOSEC (1<<28) 1316#define SB_NOSEC (1<<28)
1305#define SB_BORN (1<<29) 1317#define SB_BORN (1<<29)
1306#define SB_ACTIVE (1<<30) 1318#define SB_ACTIVE (1<<30)
@@ -1629,6 +1641,8 @@ int vfs_mkobj(struct dentry *, umode_t,
1629 int (*f)(struct dentry *, umode_t, void *), 1641 int (*f)(struct dentry *, umode_t, void *),
1630 void *); 1642 void *);
1631 1643
1644extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1645
1632/* 1646/*
1633 * VFS file helper functions. 1647 * VFS file helper functions.
1634 */ 1648 */
@@ -1747,7 +1761,7 @@ struct file_operations {
1747 loff_t, size_t, unsigned int); 1761 loff_t, size_t, unsigned int);
1748 int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t, 1762 int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t,
1749 u64); 1763 u64);
1750 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *, 1764 int (*dedupe_file_range)(struct file *, loff_t, struct file *, loff_t,
1751 u64); 1765 u64);
1752} __randomize_layout; 1766} __randomize_layout;
1753 1767
@@ -1776,7 +1790,7 @@ struct inode_operations {
1776 int (*update_time)(struct inode *, struct timespec64 *, int); 1790 int (*update_time)(struct inode *, struct timespec64 *, int);
1777 int (*atomic_open)(struct inode *, struct dentry *, 1791 int (*atomic_open)(struct inode *, struct dentry *,
1778 struct file *, unsigned open_flag, 1792 struct file *, unsigned open_flag,
1779 umode_t create_mode, int *opened); 1793 umode_t create_mode);
1780 int (*tmpfile) (struct inode *, struct dentry *, umode_t); 1794 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
1781 int (*set_acl)(struct inode *, struct posix_acl *, int); 1795 int (*set_acl)(struct inode *, struct posix_acl *, int);
1782} ____cacheline_aligned; 1796} ____cacheline_aligned;
@@ -1820,6 +1834,10 @@ extern int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
1820 loff_t len, bool *is_same); 1834 loff_t len, bool *is_same);
1821extern int vfs_dedupe_file_range(struct file *file, 1835extern int vfs_dedupe_file_range(struct file *file,
1822 struct file_dedupe_range *same); 1836 struct file_dedupe_range *same);
1837extern int vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
1838 struct file *dst_file, loff_t dst_pos,
1839 u64 len);
1840
1823 1841
1824struct super_operations { 1842struct super_operations {
1825 struct inode *(*alloc_inode)(struct super_block *sb); 1843 struct inode *(*alloc_inode)(struct super_block *sb);
@@ -2014,6 +2032,8 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
2014 * I_OVL_INUSE Used by overlayfs to get exclusive ownership on upper 2032 * I_OVL_INUSE Used by overlayfs to get exclusive ownership on upper
2015 * and work dirs among overlayfs mounts. 2033 * and work dirs among overlayfs mounts.
2016 * 2034 *
2035 * I_CREATING New object's inode in the middle of setting up.
2036 *
2017 * Q: What is the difference between I_WILL_FREE and I_FREEING? 2037 * Q: What is the difference between I_WILL_FREE and I_FREEING?
2018 */ 2038 */
2019#define I_DIRTY_SYNC (1 << 0) 2039#define I_DIRTY_SYNC (1 << 0)
@@ -2034,7 +2054,8 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
2034#define __I_DIRTY_TIME_EXPIRED 12 2054#define __I_DIRTY_TIME_EXPIRED 12
2035#define I_DIRTY_TIME_EXPIRED (1 << __I_DIRTY_TIME_EXPIRED) 2055#define I_DIRTY_TIME_EXPIRED (1 << __I_DIRTY_TIME_EXPIRED)
2036#define I_WB_SWITCH (1 << 13) 2056#define I_WB_SWITCH (1 << 13)
2037#define I_OVL_INUSE (1 << 14) 2057#define I_OVL_INUSE (1 << 14)
2058#define I_CREATING (1 << 15)
2038 2059
2039#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) 2060#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
2040#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES) 2061#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
@@ -2075,6 +2096,7 @@ enum file_time_flags {
2075 S_VERSION = 8, 2096 S_VERSION = 8,
2076}; 2097};
2077 2098
2099extern bool atime_needs_update(const struct path *, struct inode *);
2078extern void touch_atime(const struct path *); 2100extern void touch_atime(const struct path *);
2079static inline void file_accessed(struct file *file) 2101static inline void file_accessed(struct file *file)
2080{ 2102{
@@ -2420,7 +2442,12 @@ extern struct file *filp_open(const char *, int, umode_t);
2420extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2442extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2421 const char *, int, umode_t); 2443 const char *, int, umode_t);
2422extern struct file * dentry_open(const struct path *, int, const struct cred *); 2444extern struct file * dentry_open(const struct path *, int, const struct cred *);
2423extern struct file *filp_clone_open(struct file *); 2445extern struct file * open_with_fake_path(const struct path *, int,
2446 struct inode*, const struct cred *);
2447static inline struct file *file_clone_open(struct file *file)
2448{
2449 return dentry_open(&file->f_path, file->f_flags, file->f_cred);
2450}
2424extern int filp_close(struct file *, fl_owner_t id); 2451extern int filp_close(struct file *, fl_owner_t id);
2425 2452
2426extern struct filename *getname_flags(const char __user *, int, int *); 2453extern struct filename *getname_flags(const char __user *, int, int *);
@@ -2428,13 +2455,8 @@ extern struct filename *getname(const char __user *);
2428extern struct filename *getname_kernel(const char *); 2455extern struct filename *getname_kernel(const char *);
2429extern void putname(struct filename *name); 2456extern void putname(struct filename *name);
2430 2457
2431enum {
2432 FILE_CREATED = 1,
2433 FILE_OPENED = 2
2434};
2435extern int finish_open(struct file *file, struct dentry *dentry, 2458extern int finish_open(struct file *file, struct dentry *dentry,
2436 int (*open)(struct inode *, struct file *), 2459 int (*open)(struct inode *, struct file *));
2437 int *opened);
2438extern int finish_no_open(struct file *file, struct dentry *dentry); 2460extern int finish_no_open(struct file *file, struct dentry *dentry);
2439 2461
2440/* fs/ioctl.c */ 2462/* fs/ioctl.c */
@@ -2622,8 +2644,6 @@ static inline int filemap_fdatawait(struct address_space *mapping)
2622 2644
2623extern bool filemap_range_has_page(struct address_space *, loff_t lstart, 2645extern bool filemap_range_has_page(struct address_space *, loff_t lstart,
2624 loff_t lend); 2646 loff_t lend);
2625extern int __must_check file_fdatawait_range(struct file *file, loff_t lstart,
2626 loff_t lend);
2627extern int filemap_write_and_wait(struct address_space *mapping); 2647extern int filemap_write_and_wait(struct address_space *mapping);
2628extern int filemap_write_and_wait_range(struct address_space *mapping, 2648extern int filemap_write_and_wait_range(struct address_space *mapping,
2629 loff_t lstart, loff_t lend); 2649 loff_t lstart, loff_t lend);
@@ -2918,6 +2938,7 @@ extern void lockdep_annotate_inode_mutex_key(struct inode *inode);
2918static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { }; 2938static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { };
2919#endif 2939#endif
2920extern void unlock_new_inode(struct inode *); 2940extern void unlock_new_inode(struct inode *);
2941extern void discard_new_inode(struct inode *);
2921extern unsigned int get_next_ino(void); 2942extern unsigned int get_next_ino(void);
2922extern void evict_inodes(struct super_block *sb); 2943extern void evict_inodes(struct super_block *sb);
2923 2944
diff --git a/include/linux/fsi-sbefifo.h b/include/linux/fsi-sbefifo.h
new file mode 100644
index 000000000000..13f9ebeaa25e
--- /dev/null
+++ b/include/linux/fsi-sbefifo.h
@@ -0,0 +1,33 @@
1/*
2 * SBEFIFO FSI Client device driver
3 *
4 * Copyright (C) IBM Corporation 2017
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERGCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef LINUX_FSI_SBEFIFO_H
17#define LINUX_FSI_SBEFIFO_H
18
19#define SBEFIFO_CMD_PUT_OCC_SRAM 0xa404
20#define SBEFIFO_CMD_GET_OCC_SRAM 0xa403
21#define SBEFIFO_CMD_GET_SBE_FFDC 0xa801
22
23#define SBEFIFO_MAX_FFDC_SIZE 0x2000
24
25struct device;
26
27int sbefifo_submit(struct device *dev, const __be32 *command, size_t cmd_len,
28 __be32 *response, size_t *resp_len);
29
30int sbefifo_parse_status(struct device *dev, u16 cmd, __be32 *response,
31 size_t resp_len, size_t *data_len);
32
33#endif /* LINUX_FSI_SBEFIFO_H */
diff --git a/include/linux/fsi.h b/include/linux/fsi.h
index 141fd38d061f..ec3be0d5b786 100644
--- a/include/linux/fsi.h
+++ b/include/linux/fsi.h
@@ -76,8 +76,18 @@ extern int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
76extern int fsi_slave_write(struct fsi_slave *slave, uint32_t addr, 76extern int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
77 const void *val, size_t size); 77 const void *val, size_t size);
78 78
79extern struct bus_type fsi_bus_type;
80extern const struct device_type fsi_cdev_type;
79 81
82enum fsi_dev_type {
83 fsi_dev_cfam,
84 fsi_dev_sbefifo,
85 fsi_dev_scom,
86 fsi_dev_occ
87};
80 88
81extern struct bus_type fsi_bus_type; 89extern int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type,
90 dev_t *out_dev, int *out_index);
91extern void fsi_free_minor(dev_t dev);
82 92
83#endif /* LINUX_FSI_H */ 93#endif /* LINUX_FSI_H */
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index b462d9ea8007..c1f003aadcce 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -11,9 +11,8 @@
11 11
12/* 12/*
13 * qoriq ptp registers 13 * qoriq ptp registers
14 * Generated by regen.tcl on Thu May 13 01:38:57 PM CEST 2010
15 */ 14 */
16struct qoriq_ptp_registers { 15struct ctrl_regs {
17 u32 tmr_ctrl; /* Timer control register */ 16 u32 tmr_ctrl; /* Timer control register */
18 u32 tmr_tevent; /* Timestamp event register */ 17 u32 tmr_tevent; /* Timestamp event register */
19 u32 tmr_temask; /* Timer event mask register */ 18 u32 tmr_temask; /* Timer event mask register */
@@ -28,22 +27,47 @@ struct qoriq_ptp_registers {
28 u8 res1[4]; 27 u8 res1[4];
29 u32 tmroff_h; /* Timer offset high */ 28 u32 tmroff_h; /* Timer offset high */
30 u32 tmroff_l; /* Timer offset low */ 29 u32 tmroff_l; /* Timer offset low */
31 u8 res2[8]; 30};
31
32struct alarm_regs {
32 u32 tmr_alarm1_h; /* Timer alarm 1 high register */ 33 u32 tmr_alarm1_h; /* Timer alarm 1 high register */
33 u32 tmr_alarm1_l; /* Timer alarm 1 high register */ 34 u32 tmr_alarm1_l; /* Timer alarm 1 high register */
34 u32 tmr_alarm2_h; /* Timer alarm 2 high register */ 35 u32 tmr_alarm2_h; /* Timer alarm 2 high register */
35 u32 tmr_alarm2_l; /* Timer alarm 2 high register */ 36 u32 tmr_alarm2_l; /* Timer alarm 2 high register */
36 u8 res3[48]; 37};
38
39struct fiper_regs {
37 u32 tmr_fiper1; /* Timer fixed period interval */ 40 u32 tmr_fiper1; /* Timer fixed period interval */
38 u32 tmr_fiper2; /* Timer fixed period interval */ 41 u32 tmr_fiper2; /* Timer fixed period interval */
39 u32 tmr_fiper3; /* Timer fixed period interval */ 42 u32 tmr_fiper3; /* Timer fixed period interval */
40 u8 res4[20]; 43};
44
45struct etts_regs {
41 u32 tmr_etts1_h; /* Timestamp of general purpose external trigger */ 46 u32 tmr_etts1_h; /* Timestamp of general purpose external trigger */
42 u32 tmr_etts1_l; /* Timestamp of general purpose external trigger */ 47 u32 tmr_etts1_l; /* Timestamp of general purpose external trigger */
43 u32 tmr_etts2_h; /* Timestamp of general purpose external trigger */ 48 u32 tmr_etts2_h; /* Timestamp of general purpose external trigger */
44 u32 tmr_etts2_l; /* Timestamp of general purpose external trigger */ 49 u32 tmr_etts2_l; /* Timestamp of general purpose external trigger */
45}; 50};
46 51
52struct qoriq_ptp_registers {
53 struct ctrl_regs __iomem *ctrl_regs;
54 struct alarm_regs __iomem *alarm_regs;
55 struct fiper_regs __iomem *fiper_regs;
56 struct etts_regs __iomem *etts_regs;
57};
58
59/* Offset definitions for the four register groups */
60#define CTRL_REGS_OFFSET 0x0
61#define ALARM_REGS_OFFSET 0x40
62#define FIPER_REGS_OFFSET 0x80
63#define ETTS_REGS_OFFSET 0xa0
64
65#define FMAN_CTRL_REGS_OFFSET 0x80
66#define FMAN_ALARM_REGS_OFFSET 0xb8
67#define FMAN_FIPER_REGS_OFFSET 0xd0
68#define FMAN_ETTS_REGS_OFFSET 0xe0
69
70
47/* Bit definitions for the TMR_CTRL register */ 71/* Bit definitions for the TMR_CTRL register */
48#define ALM1P (1<<31) /* Alarm1 output polarity */ 72#define ALM1P (1<<31) /* Alarm1 output polarity */
49#define ALM2P (1<<30) /* Alarm2 output polarity */ 73#define ALM2P (1<<30) /* Alarm2 output polarity */
@@ -103,12 +127,16 @@ struct qoriq_ptp_registers {
103 127
104 128
105#define DRIVER "ptp_qoriq" 129#define DRIVER "ptp_qoriq"
106#define DEFAULT_CKSEL 1
107#define N_EXT_TS 2 130#define N_EXT_TS 2
108#define REG_SIZE sizeof(struct qoriq_ptp_registers) 131
132#define DEFAULT_CKSEL 1
133#define DEFAULT_TMR_PRSC 2
134#define DEFAULT_FIPER1_PERIOD 1000000000
135#define DEFAULT_FIPER2_PERIOD 100000
109 136
110struct qoriq_ptp { 137struct qoriq_ptp {
111 struct qoriq_ptp_registers __iomem *regs; 138 void __iomem *base;
139 struct qoriq_ptp_registers regs;
112 spinlock_t lock; /* protects regs */ 140 spinlock_t lock; /* protects regs */
113 struct ptp_clock *clock; 141 struct ptp_clock *clock;
114 struct ptp_clock_info caps; 142 struct ptp_clock_info caps;
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index bdaf22582f6e..fd1ce10553bf 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -30,11 +30,7 @@ static inline int fsnotify_parent(const struct path *path, struct dentry *dentry
30static inline int fsnotify_perm(struct file *file, int mask) 30static inline int fsnotify_perm(struct file *file, int mask)
31{ 31{
32 const struct path *path = &file->f_path; 32 const struct path *path = &file->f_path;
33 /* 33 struct inode *inode = file_inode(file);
34 * Do not use file_inode() here or anywhere in this file to get the
35 * inode. That would break *notity on overlayfs.
36 */
37 struct inode *inode = path->dentry->d_inode;
38 __u32 fsnotify_mask = 0; 34 __u32 fsnotify_mask = 0;
39 int ret; 35 int ret;
40 36
@@ -178,7 +174,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
178static inline void fsnotify_access(struct file *file) 174static inline void fsnotify_access(struct file *file)
179{ 175{
180 const struct path *path = &file->f_path; 176 const struct path *path = &file->f_path;
181 struct inode *inode = path->dentry->d_inode; 177 struct inode *inode = file_inode(file);
182 __u32 mask = FS_ACCESS; 178 __u32 mask = FS_ACCESS;
183 179
184 if (S_ISDIR(inode->i_mode)) 180 if (S_ISDIR(inode->i_mode))
@@ -196,7 +192,7 @@ static inline void fsnotify_access(struct file *file)
196static inline void fsnotify_modify(struct file *file) 192static inline void fsnotify_modify(struct file *file)
197{ 193{
198 const struct path *path = &file->f_path; 194 const struct path *path = &file->f_path;
199 struct inode *inode = path->dentry->d_inode; 195 struct inode *inode = file_inode(file);
200 __u32 mask = FS_MODIFY; 196 __u32 mask = FS_MODIFY;
201 197
202 if (S_ISDIR(inode->i_mode)) 198 if (S_ISDIR(inode->i_mode))
@@ -214,7 +210,7 @@ static inline void fsnotify_modify(struct file *file)
214static inline void fsnotify_open(struct file *file) 210static inline void fsnotify_open(struct file *file)
215{ 211{
216 const struct path *path = &file->f_path; 212 const struct path *path = &file->f_path;
217 struct inode *inode = path->dentry->d_inode; 213 struct inode *inode = file_inode(file);
218 __u32 mask = FS_OPEN; 214 __u32 mask = FS_OPEN;
219 215
220 if (S_ISDIR(inode->i_mode)) 216 if (S_ISDIR(inode->i_mode))
@@ -230,7 +226,7 @@ static inline void fsnotify_open(struct file *file)
230static inline void fsnotify_close(struct file *file) 226static inline void fsnotify_close(struct file *file)
231{ 227{
232 const struct path *path = &file->f_path; 228 const struct path *path = &file->f_path;
233 struct inode *inode = path->dentry->d_inode; 229 struct inode *inode = file_inode(file);
234 fmode_t mode = file->f_mode; 230 fmode_t mode = file->f_mode;
235 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 231 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
236 232
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index b38964a7a521..b8f4182f42f1 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -84,6 +84,8 @@ struct fsnotify_event_private_data;
84struct fsnotify_fname; 84struct fsnotify_fname;
85struct fsnotify_iter_info; 85struct fsnotify_iter_info;
86 86
87struct mem_cgroup;
88
87/* 89/*
88 * Each group much define these ops. The fsnotify infrastructure will call 90 * Each group much define these ops. The fsnotify infrastructure will call
89 * these operations for each relevant group. 91 * these operations for each relevant group.
@@ -127,6 +129,8 @@ struct fsnotify_event {
127 * everything will be cleaned up. 129 * everything will be cleaned up.
128 */ 130 */
129struct fsnotify_group { 131struct fsnotify_group {
132 const struct fsnotify_ops *ops; /* how this group handles things */
133
130 /* 134 /*
131 * How the refcnt is used is up to each group. When the refcnt hits 0 135 * How the refcnt is used is up to each group. When the refcnt hits 0
132 * fsnotify will clean up all of the resources associated with this group. 136 * fsnotify will clean up all of the resources associated with this group.
@@ -137,8 +141,6 @@ struct fsnotify_group {
137 */ 141 */
138 refcount_t refcnt; /* things with interest in this group */ 142 refcount_t refcnt; /* things with interest in this group */
139 143
140 const struct fsnotify_ops *ops; /* how this group handles things */
141
142 /* needed to send notification to userspace */ 144 /* needed to send notification to userspace */
143 spinlock_t notification_lock; /* protect the notification_list */ 145 spinlock_t notification_lock; /* protect the notification_list */
144 struct list_head notification_list; /* list of event_holder this group needs to send to userspace */ 146 struct list_head notification_list; /* list of event_holder this group needs to send to userspace */
@@ -160,6 +162,8 @@ struct fsnotify_group {
160 atomic_t num_marks; /* 1 for each mark and 1 for not being 162 atomic_t num_marks; /* 1 for each mark and 1 for not being
161 * past the point of no return when freeing 163 * past the point of no return when freeing
162 * a group */ 164 * a group */
165 atomic_t user_waits; /* Number of tasks waiting for user
166 * response */
163 struct list_head marks_list; /* all inode marks for this group */ 167 struct list_head marks_list; /* all inode marks for this group */
164 168
165 struct fasync_struct *fsn_fa; /* async notification */ 169 struct fasync_struct *fsn_fa; /* async notification */
@@ -167,8 +171,8 @@ struct fsnotify_group {
167 struct fsnotify_event *overflow_event; /* Event we queue when the 171 struct fsnotify_event *overflow_event; /* Event we queue when the
168 * notification list is too 172 * notification list is too
169 * full */ 173 * full */
170 atomic_t user_waits; /* Number of tasks waiting for user 174
171 * response */ 175 struct mem_cgroup *memcg; /* memcg to charge allocations */
172 176
173 /* groups can define private fields here or use the void *private */ 177 /* groups can define private fields here or use the void *private */
174 union { 178 union {
@@ -210,6 +214,11 @@ enum fsnotify_obj_type {
210#define FSNOTIFY_OBJ_TYPE_VFSMOUNT_FL (1U << FSNOTIFY_OBJ_TYPE_VFSMOUNT) 214#define FSNOTIFY_OBJ_TYPE_VFSMOUNT_FL (1U << FSNOTIFY_OBJ_TYPE_VFSMOUNT)
211#define FSNOTIFY_OBJ_ALL_TYPES_MASK ((1U << FSNOTIFY_OBJ_TYPE_COUNT) - 1) 215#define FSNOTIFY_OBJ_ALL_TYPES_MASK ((1U << FSNOTIFY_OBJ_TYPE_COUNT) - 1)
212 216
217static inline bool fsnotify_valid_obj_type(unsigned int type)
218{
219 return (type < FSNOTIFY_OBJ_TYPE_COUNT);
220}
221
213struct fsnotify_iter_info { 222struct fsnotify_iter_info {
214 struct fsnotify_mark *marks[FSNOTIFY_OBJ_TYPE_COUNT]; 223 struct fsnotify_mark *marks[FSNOTIFY_OBJ_TYPE_COUNT];
215 unsigned int report_mask; 224 unsigned int report_mask;
@@ -251,6 +260,13 @@ FSNOTIFY_ITER_FUNCS(vfsmount, VFSMOUNT)
251 for (type = 0; type < FSNOTIFY_OBJ_TYPE_COUNT; type++) 260 for (type = 0; type < FSNOTIFY_OBJ_TYPE_COUNT; type++)
252 261
253/* 262/*
263 * fsnotify_connp_t is what we embed in objects which connector can be attached
264 * to. fsnotify_connp_t * is how we refer from connector back to object.
265 */
266struct fsnotify_mark_connector;
267typedef struct fsnotify_mark_connector __rcu *fsnotify_connp_t;
268
269/*
254 * Inode / vfsmount point to this structure which tracks all marks attached to 270 * Inode / vfsmount point to this structure which tracks all marks attached to
255 * the inode / vfsmount. The reference to inode / vfsmount is held by this 271 * the inode / vfsmount. The reference to inode / vfsmount is held by this
256 * structure. We destroy this structure when there are no more marks attached 272 * structure. We destroy this structure when there are no more marks attached
@@ -259,9 +275,9 @@ FSNOTIFY_ITER_FUNCS(vfsmount, VFSMOUNT)
259struct fsnotify_mark_connector { 275struct fsnotify_mark_connector {
260 spinlock_t lock; 276 spinlock_t lock;
261 unsigned int type; /* Type of object [lock] */ 277 unsigned int type; /* Type of object [lock] */
262 union { /* Object pointer [lock] */ 278 union {
263 struct inode *inode; 279 /* Object pointer [lock] */
264 struct vfsmount *mnt; 280 fsnotify_connp_t *obj;
265 /* Used listing heads to free after srcu period expires */ 281 /* Used listing heads to free after srcu period expires */
266 struct fsnotify_mark_connector *destroy_next; 282 struct fsnotify_mark_connector *destroy_next;
267 }; 283 };
@@ -389,32 +405,36 @@ extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group
389 405
390/* functions used to manipulate the marks attached to inodes */ 406/* functions used to manipulate the marks attached to inodes */
391 407
408/* Get mask of events for a list of marks */
409extern __u32 fsnotify_conn_mask(struct fsnotify_mark_connector *conn);
392/* Calculate mask of events for a list of marks */ 410/* Calculate mask of events for a list of marks */
393extern void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn); 411extern void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn);
394extern void fsnotify_init_mark(struct fsnotify_mark *mark, 412extern void fsnotify_init_mark(struct fsnotify_mark *mark,
395 struct fsnotify_group *group); 413 struct fsnotify_group *group);
396/* Find mark belonging to given group in the list of marks */ 414/* Find mark belonging to given group in the list of marks */
397extern struct fsnotify_mark *fsnotify_find_mark( 415extern struct fsnotify_mark *fsnotify_find_mark(fsnotify_connp_t *connp,
398 struct fsnotify_mark_connector __rcu **connp, 416 struct fsnotify_group *group);
399 struct fsnotify_group *group); 417/* attach the mark to the object */
400/* attach the mark to the inode or vfsmount */ 418extern int fsnotify_add_mark(struct fsnotify_mark *mark,
401extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct inode *inode, 419 fsnotify_connp_t *connp, unsigned int type,
402 struct vfsmount *mnt, int allow_dups); 420 int allow_dups);
403extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark, 421extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
404 struct inode *inode, struct vfsmount *mnt, 422 fsnotify_connp_t *connp, unsigned int type,
405 int allow_dups); 423 int allow_dups);
406/* attach the mark to the inode */ 424/* attach the mark to the inode */
407static inline int fsnotify_add_inode_mark(struct fsnotify_mark *mark, 425static inline int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
408 struct inode *inode, 426 struct inode *inode,
409 int allow_dups) 427 int allow_dups)
410{ 428{
411 return fsnotify_add_mark(mark, inode, NULL, allow_dups); 429 return fsnotify_add_mark(mark, &inode->i_fsnotify_marks,
430 FSNOTIFY_OBJ_TYPE_INODE, allow_dups);
412} 431}
413static inline int fsnotify_add_inode_mark_locked(struct fsnotify_mark *mark, 432static inline int fsnotify_add_inode_mark_locked(struct fsnotify_mark *mark,
414 struct inode *inode, 433 struct inode *inode,
415 int allow_dups) 434 int allow_dups)
416{ 435{
417 return fsnotify_add_mark_locked(mark, inode, NULL, allow_dups); 436 return fsnotify_add_mark_locked(mark, &inode->i_fsnotify_marks,
437 FSNOTIFY_OBJ_TYPE_INODE, allow_dups);
418} 438}
419/* given a group and a mark, flag mark to be freed when all references are dropped */ 439/* given a group and a mark, flag mark to be freed when all references are dropped */
420extern void fsnotify_destroy_mark(struct fsnotify_mark *mark, 440extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ebb77674be90..a397907e8d72 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -234,10 +234,6 @@ extern void ftrace_stub(unsigned long a0, unsigned long a1,
234 */ 234 */
235#define register_ftrace_function(ops) ({ 0; }) 235#define register_ftrace_function(ops) ({ 0; })
236#define unregister_ftrace_function(ops) ({ 0; }) 236#define unregister_ftrace_function(ops) ({ 0; })
237static inline int ftrace_nr_registered_ops(void)
238{
239 return 0;
240}
241static inline void ftrace_kill(void) { } 237static inline void ftrace_kill(void) { }
242static inline void ftrace_free_init_mem(void) { } 238static inline void ftrace_free_init_mem(void) { }
243static inline void ftrace_free_mem(struct module *mod, void *start, void *end) { } 239static inline void ftrace_free_mem(struct module *mod, void *start, void *end) { }
@@ -328,8 +324,6 @@ struct seq_file;
328 324
329extern int ftrace_text_reserved(const void *start, const void *end); 325extern int ftrace_text_reserved(const void *start, const void *end);
330 326
331extern int ftrace_nr_registered_ops(void);
332
333struct ftrace_ops *ftrace_ops_trampoline(unsigned long addr); 327struct ftrace_ops *ftrace_ops_trampoline(unsigned long addr);
334 328
335bool is_ftrace_trampoline(unsigned long addr); 329bool is_ftrace_trampoline(unsigned long addr);
@@ -707,16 +701,7 @@ static inline unsigned long get_lock_parent_ip(void)
707 return CALLER_ADDR2; 701 return CALLER_ADDR2;
708} 702}
709 703
710#ifdef CONFIG_IRQSOFF_TRACER 704#ifdef CONFIG_TRACE_PREEMPT_TOGGLE
711 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
712 extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
713#else
714 static inline void time_hardirqs_on(unsigned long a0, unsigned long a1) { }
715 static inline void time_hardirqs_off(unsigned long a0, unsigned long a1) { }
716#endif
717
718#if defined(CONFIG_PREEMPT_TRACER) || \
719 (defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_PREEMPTIRQ_EVENTS))
720 extern void trace_preempt_on(unsigned long a0, unsigned long a1); 705 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
721 extern void trace_preempt_off(unsigned long a0, unsigned long a1); 706 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
722#else 707#else
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 4fe8f289b3f6..faebf0ca0686 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -45,7 +45,7 @@ struct fwnode_endpoint {
45struct fwnode_reference_args { 45struct fwnode_reference_args {
46 struct fwnode_handle *fwnode; 46 struct fwnode_handle *fwnode;
47 unsigned int nargs; 47 unsigned int nargs;
48 unsigned int args[NR_FWNODE_REFERENCE_ARGS]; 48 u64 args[NR_FWNODE_REFERENCE_ARGS];
49}; 49};
50 50
51/** 51/**
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 6cb8a5789668..57864422a2c8 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -16,6 +16,7 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/percpu-refcount.h> 17#include <linux/percpu-refcount.h>
18#include <linux/uuid.h> 18#include <linux/uuid.h>
19#include <linux/blk_types.h>
19 20
20#ifdef CONFIG_BLOCK 21#ifdef CONFIG_BLOCK
21 22
@@ -82,10 +83,10 @@ struct partition {
82} __attribute__((packed)); 83} __attribute__((packed));
83 84
84struct disk_stats { 85struct disk_stats {
85 unsigned long sectors[2]; /* READs and WRITEs */ 86 unsigned long sectors[NR_STAT_GROUPS];
86 unsigned long ios[2]; 87 unsigned long ios[NR_STAT_GROUPS];
87 unsigned long merges[2]; 88 unsigned long merges[NR_STAT_GROUPS];
88 unsigned long ticks[2]; 89 unsigned long ticks[NR_STAT_GROUPS];
89 unsigned long io_ticks; 90 unsigned long io_ticks;
90 unsigned long time_in_queue; 91 unsigned long time_in_queue;
91}; 92};
@@ -353,6 +354,11 @@ static inline void free_part_stats(struct hd_struct *part)
353 354
354#endif /* CONFIG_SMP */ 355#endif /* CONFIG_SMP */
355 356
357#define part_stat_read_accum(part, field) \
358 (part_stat_read(part, field[STAT_READ]) + \
359 part_stat_read(part, field[STAT_WRITE]) + \
360 part_stat_read(part, field[STAT_DISCARD]))
361
356#define part_stat_add(cpu, part, field, addnd) do { \ 362#define part_stat_add(cpu, part, field, addnd) do { \
357 __part_stat_add((cpu), (part), field, addnd); \ 363 __part_stat_add((cpu), (part), field, addnd); \
358 if ((part)->partno) \ 364 if ((part)->partno) \
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index a6afcec53795..24bcc5eec6b4 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -59,29 +59,32 @@ struct vm_area_struct;
59#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */ 59#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */
60#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE) 60#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
61 61
62/* 62/**
63 * DOC: Page mobility and placement hints
64 *
63 * Page mobility and placement hints 65 * Page mobility and placement hints
66 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 * 67 *
65 * These flags provide hints about how mobile the page is. Pages with similar 68 * These flags provide hints about how mobile the page is. Pages with similar
66 * mobility are placed within the same pageblocks to minimise problems due 69 * mobility are placed within the same pageblocks to minimise problems due
67 * to external fragmentation. 70 * to external fragmentation.
68 * 71 *
69 * __GFP_MOVABLE (also a zone modifier) indicates that the page can be 72 * %__GFP_MOVABLE (also a zone modifier) indicates that the page can be
70 * moved by page migration during memory compaction or can be reclaimed. 73 * moved by page migration during memory compaction or can be reclaimed.
71 * 74 *
72 * __GFP_RECLAIMABLE is used for slab allocations that specify 75 * %__GFP_RECLAIMABLE is used for slab allocations that specify
73 * SLAB_RECLAIM_ACCOUNT and whose pages can be freed via shrinkers. 76 * SLAB_RECLAIM_ACCOUNT and whose pages can be freed via shrinkers.
74 * 77 *
75 * __GFP_WRITE indicates the caller intends to dirty the page. Where possible, 78 * %__GFP_WRITE indicates the caller intends to dirty the page. Where possible,
76 * these pages will be spread between local zones to avoid all the dirty 79 * these pages will be spread between local zones to avoid all the dirty
77 * pages being in one zone (fair zone allocation policy). 80 * pages being in one zone (fair zone allocation policy).
78 * 81 *
79 * __GFP_HARDWALL enforces the cpuset memory allocation policy. 82 * %__GFP_HARDWALL enforces the cpuset memory allocation policy.
80 * 83 *
81 * __GFP_THISNODE forces the allocation to be satisified from the requested 84 * %__GFP_THISNODE forces the allocation to be satisified from the requested
82 * node with no fallbacks or placement policy enforcements. 85 * node with no fallbacks or placement policy enforcements.
83 * 86 *
84 * __GFP_ACCOUNT causes the allocation to be accounted to kmemcg. 87 * %__GFP_ACCOUNT causes the allocation to be accounted to kmemcg.
85 */ 88 */
86#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) 89#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE)
87#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) 90#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE)
@@ -89,54 +92,60 @@ struct vm_area_struct;
89#define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE) 92#define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE)
90#define __GFP_ACCOUNT ((__force gfp_t)___GFP_ACCOUNT) 93#define __GFP_ACCOUNT ((__force gfp_t)___GFP_ACCOUNT)
91 94
92/* 95/**
96 * DOC: Watermark modifiers
97 *
93 * Watermark modifiers -- controls access to emergency reserves 98 * Watermark modifiers -- controls access to emergency reserves
99 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94 * 100 *
95 * __GFP_HIGH indicates that the caller is high-priority and that granting 101 * %__GFP_HIGH indicates that the caller is high-priority and that granting
96 * the request is necessary before the system can make forward progress. 102 * the request is necessary before the system can make forward progress.
97 * For example, creating an IO context to clean pages. 103 * For example, creating an IO context to clean pages.
98 * 104 *
99 * __GFP_ATOMIC indicates that the caller cannot reclaim or sleep and is 105 * %__GFP_ATOMIC indicates that the caller cannot reclaim or sleep and is
100 * high priority. Users are typically interrupt handlers. This may be 106 * high priority. Users are typically interrupt handlers. This may be
101 * used in conjunction with __GFP_HIGH 107 * used in conjunction with %__GFP_HIGH
102 * 108 *
103 * __GFP_MEMALLOC allows access to all memory. This should only be used when 109 * %__GFP_MEMALLOC allows access to all memory. This should only be used when
104 * the caller guarantees the allocation will allow more memory to be freed 110 * the caller guarantees the allocation will allow more memory to be freed
105 * very shortly e.g. process exiting or swapping. Users either should 111 * very shortly e.g. process exiting or swapping. Users either should
106 * be the MM or co-ordinating closely with the VM (e.g. swap over NFS). 112 * be the MM or co-ordinating closely with the VM (e.g. swap over NFS).
107 * 113 *
108 * __GFP_NOMEMALLOC is used to explicitly forbid access to emergency reserves. 114 * %__GFP_NOMEMALLOC is used to explicitly forbid access to emergency reserves.
109 * This takes precedence over the __GFP_MEMALLOC flag if both are set. 115 * This takes precedence over the %__GFP_MEMALLOC flag if both are set.
110 */ 116 */
111#define __GFP_ATOMIC ((__force gfp_t)___GFP_ATOMIC) 117#define __GFP_ATOMIC ((__force gfp_t)___GFP_ATOMIC)
112#define __GFP_HIGH ((__force gfp_t)___GFP_HIGH) 118#define __GFP_HIGH ((__force gfp_t)___GFP_HIGH)
113#define __GFP_MEMALLOC ((__force gfp_t)___GFP_MEMALLOC) 119#define __GFP_MEMALLOC ((__force gfp_t)___GFP_MEMALLOC)
114#define __GFP_NOMEMALLOC ((__force gfp_t)___GFP_NOMEMALLOC) 120#define __GFP_NOMEMALLOC ((__force gfp_t)___GFP_NOMEMALLOC)
115 121
116/* 122/**
123 * DOC: Reclaim modifiers
124 *
117 * Reclaim modifiers 125 * Reclaim modifiers
126 * ~~~~~~~~~~~~~~~~~
118 * 127 *
119 * __GFP_IO can start physical IO. 128 * %__GFP_IO can start physical IO.
120 * 129 *
121 * __GFP_FS can call down to the low-level FS. Clearing the flag avoids the 130 * %__GFP_FS can call down to the low-level FS. Clearing the flag avoids the
122 * allocator recursing into the filesystem which might already be holding 131 * allocator recursing into the filesystem which might already be holding
123 * locks. 132 * locks.
124 * 133 *
125 * __GFP_DIRECT_RECLAIM indicates that the caller may enter direct reclaim. 134 * %__GFP_DIRECT_RECLAIM indicates that the caller may enter direct reclaim.
126 * This flag can be cleared to avoid unnecessary delays when a fallback 135 * This flag can be cleared to avoid unnecessary delays when a fallback
127 * option is available. 136 * option is available.
128 * 137 *
129 * __GFP_KSWAPD_RECLAIM indicates that the caller wants to wake kswapd when 138 * %__GFP_KSWAPD_RECLAIM indicates that the caller wants to wake kswapd when
130 * the low watermark is reached and have it reclaim pages until the high 139 * the low watermark is reached and have it reclaim pages until the high
131 * watermark is reached. A caller may wish to clear this flag when fallback 140 * watermark is reached. A caller may wish to clear this flag when fallback
132 * options are available and the reclaim is likely to disrupt the system. The 141 * options are available and the reclaim is likely to disrupt the system. The
133 * canonical example is THP allocation where a fallback is cheap but 142 * canonical example is THP allocation where a fallback is cheap but
134 * reclaim/compaction may cause indirect stalls. 143 * reclaim/compaction may cause indirect stalls.
135 * 144 *
136 * __GFP_RECLAIM is shorthand to allow/forbid both direct and kswapd reclaim. 145 * %__GFP_RECLAIM is shorthand to allow/forbid both direct and kswapd reclaim.
137 * 146 *
138 * The default allocator behavior depends on the request size. We have a concept 147 * The default allocator behavior depends on the request size. We have a concept
139 * of so called costly allocations (with order > PAGE_ALLOC_COSTLY_ORDER). 148 * of so called costly allocations (with order > %PAGE_ALLOC_COSTLY_ORDER).
140 * !costly allocations are too essential to fail so they are implicitly 149 * !costly allocations are too essential to fail so they are implicitly
141 * non-failing by default (with some exceptions like OOM victims might fail so 150 * non-failing by default (with some exceptions like OOM victims might fail so
142 * the caller still has to check for failures) while costly requests try to be 151 * the caller still has to check for failures) while costly requests try to be
@@ -144,40 +153,40 @@ struct vm_area_struct;
144 * The following three modifiers might be used to override some of these 153 * The following three modifiers might be used to override some of these
145 * implicit rules 154 * implicit rules
146 * 155 *
147 * __GFP_NORETRY: The VM implementation will try only very lightweight 156 * %__GFP_NORETRY: The VM implementation will try only very lightweight
148 * memory direct reclaim to get some memory under memory pressure (thus 157 * memory direct reclaim to get some memory under memory pressure (thus
149 * it can sleep). It will avoid disruptive actions like OOM killer. The 158 * it can sleep). It will avoid disruptive actions like OOM killer. The
150 * caller must handle the failure which is quite likely to happen under 159 * caller must handle the failure which is quite likely to happen under
151 * heavy memory pressure. The flag is suitable when failure can easily be 160 * heavy memory pressure. The flag is suitable when failure can easily be
152 * handled at small cost, such as reduced throughput 161 * handled at small cost, such as reduced throughput
153 * 162 *
154 * __GFP_RETRY_MAYFAIL: The VM implementation will retry memory reclaim 163 * %__GFP_RETRY_MAYFAIL: The VM implementation will retry memory reclaim
155 * procedures that have previously failed if there is some indication 164 * procedures that have previously failed if there is some indication
156 * that progress has been made else where. It can wait for other 165 * that progress has been made else where. It can wait for other
157 * tasks to attempt high level approaches to freeing memory such as 166 * tasks to attempt high level approaches to freeing memory such as
158 * compaction (which removes fragmentation) and page-out. 167 * compaction (which removes fragmentation) and page-out.
159 * There is still a definite limit to the number of retries, but it is 168 * There is still a definite limit to the number of retries, but it is
160 * a larger limit than with __GFP_NORETRY. 169 * a larger limit than with %__GFP_NORETRY.
161 * Allocations with this flag may fail, but only when there is 170 * Allocations with this flag may fail, but only when there is
162 * genuinely little unused memory. While these allocations do not 171 * genuinely little unused memory. While these allocations do not
163 * directly trigger the OOM killer, their failure indicates that 172 * directly trigger the OOM killer, their failure indicates that
164 * the system is likely to need to use the OOM killer soon. The 173 * the system is likely to need to use the OOM killer soon. The
165 * caller must handle failure, but can reasonably do so by failing 174 * caller must handle failure, but can reasonably do so by failing
166 * a higher-level request, or completing it only in a much less 175 * a higher-level request, or completing it only in a much less
167 * efficient manner. 176 * efficient manner.
168 * If the allocation does fail, and the caller is in a position to 177 * If the allocation does fail, and the caller is in a position to
169 * free some non-essential memory, doing so could benefit the system 178 * free some non-essential memory, doing so could benefit the system
170 * as a whole. 179 * as a whole.
171 * 180 *
172 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller 181 * %__GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
173 * cannot handle allocation failures. The allocation could block 182 * cannot handle allocation failures. The allocation could block
174 * indefinitely but will never return with failure. Testing for 183 * indefinitely but will never return with failure. Testing for
175 * failure is pointless. 184 * failure is pointless.
176 * New users should be evaluated carefully (and the flag should be 185 * New users should be evaluated carefully (and the flag should be
177 * used only when there is no reasonable failure policy) but it is 186 * used only when there is no reasonable failure policy) but it is
178 * definitely preferable to use the flag rather than opencode endless 187 * definitely preferable to use the flag rather than opencode endless
179 * loop around allocator. 188 * loop around allocator.
180 * Using this flag for costly allocations is _highly_ discouraged. 189 * Using this flag for costly allocations is _highly_ discouraged.
181 */ 190 */
182#define __GFP_IO ((__force gfp_t)___GFP_IO) 191#define __GFP_IO ((__force gfp_t)___GFP_IO)
183#define __GFP_FS ((__force gfp_t)___GFP_FS) 192#define __GFP_FS ((__force gfp_t)___GFP_FS)
@@ -188,14 +197,17 @@ struct vm_area_struct;
188#define __GFP_NOFAIL ((__force gfp_t)___GFP_NOFAIL) 197#define __GFP_NOFAIL ((__force gfp_t)___GFP_NOFAIL)
189#define __GFP_NORETRY ((__force gfp_t)___GFP_NORETRY) 198#define __GFP_NORETRY ((__force gfp_t)___GFP_NORETRY)
190 199
191/* 200/**
201 * DOC: Action modifiers
202 *
192 * Action modifiers 203 * Action modifiers
204 * ~~~~~~~~~~~~~~~~
193 * 205 *
194 * __GFP_NOWARN suppresses allocation failure reports. 206 * %__GFP_NOWARN suppresses allocation failure reports.
195 * 207 *
196 * __GFP_COMP address compound page metadata. 208 * %__GFP_COMP address compound page metadata.
197 * 209 *
198 * __GFP_ZERO returns a zeroed page on success. 210 * %__GFP_ZERO returns a zeroed page on success.
199 */ 211 */
200#define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN) 212#define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN)
201#define __GFP_COMP ((__force gfp_t)___GFP_COMP) 213#define __GFP_COMP ((__force gfp_t)___GFP_COMP)
@@ -208,66 +220,71 @@ struct vm_area_struct;
208#define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP)) 220#define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP))
209#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 221#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
210 222
211/* 223/**
224 * DOC: Useful GFP flag combinations
225 *
226 * Useful GFP flag combinations
227 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228 *
212 * Useful GFP flag combinations that are commonly used. It is recommended 229 * Useful GFP flag combinations that are commonly used. It is recommended
213 * that subsystems start with one of these combinations and then set/clear 230 * that subsystems start with one of these combinations and then set/clear
214 * __GFP_FOO flags as necessary. 231 * %__GFP_FOO flags as necessary.
215 * 232 *
216 * GFP_ATOMIC users can not sleep and need the allocation to succeed. A lower 233 * %GFP_ATOMIC users can not sleep and need the allocation to succeed. A lower
217 * watermark is applied to allow access to "atomic reserves" 234 * watermark is applied to allow access to "atomic reserves"
218 * 235 *
219 * GFP_KERNEL is typical for kernel-internal allocations. The caller requires 236 * %GFP_KERNEL is typical for kernel-internal allocations. The caller requires
220 * ZONE_NORMAL or a lower zone for direct access but can direct reclaim. 237 * %ZONE_NORMAL or a lower zone for direct access but can direct reclaim.
221 * 238 *
222 * GFP_KERNEL_ACCOUNT is the same as GFP_KERNEL, except the allocation is 239 * %GFP_KERNEL_ACCOUNT is the same as GFP_KERNEL, except the allocation is
223 * accounted to kmemcg. 240 * accounted to kmemcg.
224 * 241 *
225 * GFP_NOWAIT is for kernel allocations that should not stall for direct 242 * %GFP_NOWAIT is for kernel allocations that should not stall for direct
226 * reclaim, start physical IO or use any filesystem callback. 243 * reclaim, start physical IO or use any filesystem callback.
227 * 244 *
228 * GFP_NOIO will use direct reclaim to discard clean pages or slab pages 245 * %GFP_NOIO will use direct reclaim to discard clean pages or slab pages
229 * that do not require the starting of any physical IO. 246 * that do not require the starting of any physical IO.
230 * Please try to avoid using this flag directly and instead use 247 * Please try to avoid using this flag directly and instead use
231 * memalloc_noio_{save,restore} to mark the whole scope which cannot 248 * memalloc_noio_{save,restore} to mark the whole scope which cannot
232 * perform any IO with a short explanation why. All allocation requests 249 * perform any IO with a short explanation why. All allocation requests
233 * will inherit GFP_NOIO implicitly. 250 * will inherit GFP_NOIO implicitly.
234 * 251 *
235 * GFP_NOFS will use direct reclaim but will not use any filesystem interfaces. 252 * %GFP_NOFS will use direct reclaim but will not use any filesystem interfaces.
236 * Please try to avoid using this flag directly and instead use 253 * Please try to avoid using this flag directly and instead use
237 * memalloc_nofs_{save,restore} to mark the whole scope which cannot/shouldn't 254 * memalloc_nofs_{save,restore} to mark the whole scope which cannot/shouldn't
238 * recurse into the FS layer with a short explanation why. All allocation 255 * recurse into the FS layer with a short explanation why. All allocation
239 * requests will inherit GFP_NOFS implicitly. 256 * requests will inherit GFP_NOFS implicitly.
240 * 257 *
241 * GFP_USER is for userspace allocations that also need to be directly 258 * %GFP_USER is for userspace allocations that also need to be directly
242 * accessibly by the kernel or hardware. It is typically used by hardware 259 * accessibly by the kernel or hardware. It is typically used by hardware
243 * for buffers that are mapped to userspace (e.g. graphics) that hardware 260 * for buffers that are mapped to userspace (e.g. graphics) that hardware
244 * still must DMA to. cpuset limits are enforced for these allocations. 261 * still must DMA to. cpuset limits are enforced for these allocations.
245 * 262 *
246 * GFP_DMA exists for historical reasons and should be avoided where possible. 263 * %GFP_DMA exists for historical reasons and should be avoided where possible.
247 * The flags indicates that the caller requires that the lowest zone be 264 * The flags indicates that the caller requires that the lowest zone be
248 * used (ZONE_DMA or 16M on x86-64). Ideally, this would be removed but 265 * used (%ZONE_DMA or 16M on x86-64). Ideally, this would be removed but
249 * it would require careful auditing as some users really require it and 266 * it would require careful auditing as some users really require it and
250 * others use the flag to avoid lowmem reserves in ZONE_DMA and treat the 267 * others use the flag to avoid lowmem reserves in %ZONE_DMA and treat the
251 * lowest zone as a type of emergency reserve. 268 * lowest zone as a type of emergency reserve.
252 * 269 *
253 * GFP_DMA32 is similar to GFP_DMA except that the caller requires a 32-bit 270 * %GFP_DMA32 is similar to %GFP_DMA except that the caller requires a 32-bit
254 * address. 271 * address.
255 * 272 *
256 * GFP_HIGHUSER is for userspace allocations that may be mapped to userspace, 273 * %GFP_HIGHUSER is for userspace allocations that may be mapped to userspace,
257 * do not need to be directly accessible by the kernel but that cannot 274 * do not need to be directly accessible by the kernel but that cannot
258 * move once in use. An example may be a hardware allocation that maps 275 * move once in use. An example may be a hardware allocation that maps
259 * data directly into userspace but has no addressing limitations. 276 * data directly into userspace but has no addressing limitations.
260 * 277 *
261 * GFP_HIGHUSER_MOVABLE is for userspace allocations that the kernel does not 278 * %GFP_HIGHUSER_MOVABLE is for userspace allocations that the kernel does not
262 * need direct access to but can use kmap() when access is required. They 279 * need direct access to but can use kmap() when access is required. They
263 * are expected to be movable via page reclaim or page migration. Typically, 280 * are expected to be movable via page reclaim or page migration. Typically,
264 * pages on the LRU would also be allocated with GFP_HIGHUSER_MOVABLE. 281 * pages on the LRU would also be allocated with %GFP_HIGHUSER_MOVABLE.
265 * 282 *
266 * GFP_TRANSHUGE and GFP_TRANSHUGE_LIGHT are used for THP allocations. They are 283 * %GFP_TRANSHUGE and %GFP_TRANSHUGE_LIGHT are used for THP allocations. They
267 * compound allocations that will generally fail quickly if memory is not 284 * are compound allocations that will generally fail quickly if memory is not
268 * available and will not wake kswapd/kcompactd on failure. The _LIGHT 285 * available and will not wake kswapd/kcompactd on failure. The _LIGHT
269 * version does not attempt reclaim/compaction at all and is by default used 286 * version does not attempt reclaim/compaction at all and is by default used
270 * in page fault path, while the non-light is used by khugepaged. 287 * in page fault path, while the non-light is used by khugepaged.
271 */ 288 */
272#define GFP_ATOMIC (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM) 289#define GFP_ATOMIC (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM)
273#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS) 290#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS)
diff --git a/include/linux/gnss.h b/include/linux/gnss.h
new file mode 100644
index 000000000000..43546977098c
--- /dev/null
+++ b/include/linux/gnss.h
@@ -0,0 +1,75 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * GNSS receiver support
4 *
5 * Copyright (C) 2018 Johan Hovold <johan@kernel.org>
6 */
7
8#ifndef _LINUX_GNSS_H
9#define _LINUX_GNSS_H
10
11#include <linux/cdev.h>
12#include <linux/device.h>
13#include <linux/kfifo.h>
14#include <linux/mutex.h>
15#include <linux/rwsem.h>
16#include <linux/types.h>
17#include <linux/wait.h>
18
19struct gnss_device;
20
21enum gnss_type {
22 GNSS_TYPE_NMEA = 0,
23 GNSS_TYPE_SIRF,
24 GNSS_TYPE_UBX,
25
26 GNSS_TYPE_COUNT
27};
28
29struct gnss_operations {
30 int (*open)(struct gnss_device *gdev);
31 void (*close)(struct gnss_device *gdev);
32 int (*write_raw)(struct gnss_device *gdev, const unsigned char *buf,
33 size_t count);
34};
35
36struct gnss_device {
37 struct device dev;
38 struct cdev cdev;
39 int id;
40
41 enum gnss_type type;
42 unsigned long flags;
43
44 struct rw_semaphore rwsem;
45 const struct gnss_operations *ops;
46 unsigned int count;
47 unsigned int disconnected:1;
48
49 struct mutex read_mutex;
50 struct kfifo read_fifo;
51 wait_queue_head_t read_queue;
52
53 struct mutex write_mutex;
54 char *write_buf;
55};
56
57struct gnss_device *gnss_allocate_device(struct device *parent);
58void gnss_put_device(struct gnss_device *gdev);
59int gnss_register_device(struct gnss_device *gdev);
60void gnss_deregister_device(struct gnss_device *gdev);
61
62int gnss_insert_raw(struct gnss_device *gdev, const unsigned char *buf,
63 size_t count);
64
65static inline void gnss_set_drvdata(struct gnss_device *gdev, void *data)
66{
67 dev_set_drvdata(&gdev->dev, data);
68}
69
70static inline void *gnss_get_drvdata(struct gnss_device *gdev)
71{
72 return dev_get_drvdata(&gdev->dev);
73}
74
75#endif /* _LINUX_GNSS_H */
diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h
index 2835c150c3ff..265a099cd3b8 100644
--- a/include/linux/goldfish.h
+++ b/include/linux/goldfish.h
@@ -2,14 +2,20 @@
2#ifndef __LINUX_GOLDFISH_H 2#ifndef __LINUX_GOLDFISH_H
3#define __LINUX_GOLDFISH_H 3#define __LINUX_GOLDFISH_H
4 4
5#include <linux/kernel.h>
6#include <linux/types.h>
7#include <linux/io.h>
8
5/* Helpers for Goldfish virtual platform */ 9/* Helpers for Goldfish virtual platform */
6 10
7static inline void gf_write_ptr(const void *ptr, void __iomem *portl, 11static inline void gf_write_ptr(const void *ptr, void __iomem *portl,
8 void __iomem *porth) 12 void __iomem *porth)
9{ 13{
10 writel((u32)(unsigned long)ptr, portl); 14 const unsigned long addr = (unsigned long)ptr;
15
16 writel(lower_32_bits(addr), portl);
11#ifdef CONFIG_64BIT 17#ifdef CONFIG_64BIT
12 writel((unsigned long)ptr >> 32, porth); 18 writel(upper_32_bits(addr), porth);
13#endif 19#endif
14} 20}
15 21
@@ -17,9 +23,9 @@ static inline void gf_write_dma_addr(const dma_addr_t addr,
17 void __iomem *portl, 23 void __iomem *portl,
18 void __iomem *porth) 24 void __iomem *porth)
19{ 25{
20 writel((u32)addr, portl); 26 writel(lower_32_bits(addr), portl);
21#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 27#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
22 writel(addr >> 32, porth); 28 writel(upper_32_bits(addr), porth);
23#endif 29#endif
24} 30}
25 31
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 91ed23468530..39745b8bdd65 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -14,7 +14,7 @@
14 14
15#include <linux/errno.h> 15#include <linux/errno.h>
16 16
17/* see Documentation/gpio/gpio-legacy.txt */ 17/* see Documentation/driver-api/gpio/legacy.rst */
18 18
19/* make these flag values available regardless of GPIO kconfig options */ 19/* make these flag values available regardless of GPIO kconfig options */
20#define GPIOF_DIR_OUT (0 << 0) 20#define GPIOF_DIR_OUT (0 << 0)
diff --git a/include/linux/gpio/aspeed.h b/include/linux/gpio/aspeed.h
new file mode 100644
index 000000000000..1bfb3cdc86d0
--- /dev/null
+++ b/include/linux/gpio/aspeed.h
@@ -0,0 +1,15 @@
1#ifndef __GPIO_ASPEED_H
2#define __GPIO_ASPEED_H
3
4struct aspeed_gpio_copro_ops {
5 int (*request_access)(void *data);
6 int (*release_access)(void *data);
7};
8
9int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc,
10 u16 *vreg_offset, u16 *dreg_offset, u8 *bit);
11int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc);
12int aspeed_gpio_copro_set_ops(const struct aspeed_gpio_copro_ops *ops, void *data);
13
14
15#endif /* __GPIO_ASPEED_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 243112c7fa7d..21ddbe440030 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -41,11 +41,8 @@ enum gpiod_flags {
41 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT, 41 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
42 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT | 42 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
43 GPIOD_FLAGS_BIT_DIR_VAL, 43 GPIOD_FLAGS_BIT_DIR_VAL,
44 GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET | 44 GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_OPEN_DRAIN,
45 GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_OPEN_DRAIN, 45 GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_OPEN_DRAIN,
46 GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET |
47 GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_DIR_VAL |
48 GPIOD_FLAGS_BIT_OPEN_DRAIN,
49}; 46};
50 47
51#ifdef CONFIG_GPIOLIB 48#ifdef CONFIG_GPIOLIB
@@ -145,6 +142,7 @@ int gpiod_is_active_low(const struct gpio_desc *desc);
145int gpiod_cansleep(const struct gpio_desc *desc); 142int gpiod_cansleep(const struct gpio_desc *desc);
146 143
147int gpiod_to_irq(const struct gpio_desc *desc); 144int gpiod_to_irq(const struct gpio_desc *desc);
145void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name);
148 146
149/* Convert between the old gpio_ and new gpiod_ interfaces */ 147/* Convert between the old gpio_ and new gpiod_ interfaces */
150struct gpio_desc *gpio_to_desc(unsigned gpio); 148struct gpio_desc *gpio_to_desc(unsigned gpio);
@@ -467,6 +465,12 @@ static inline int gpiod_to_irq(const struct gpio_desc *desc)
467 return -EINVAL; 465 return -EINVAL;
468} 466}
469 467
468static inline void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name)
469{
470 /* GPIO can never have been requested */
471 WARN_ON(1);
472}
473
470static inline struct gpio_desc *gpio_to_desc(unsigned gpio) 474static inline struct gpio_desc *gpio_to_desc(unsigned gpio)
471{ 475{
472 return ERR_PTR(-EINVAL); 476 return ERR_PTR(-EINVAL);
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 5382b5183b7e..0ea328e71ec9 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -201,6 +201,8 @@ static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip)
201 * @reg_set: output set register (out=high) for generic GPIO 201 * @reg_set: output set register (out=high) for generic GPIO
202 * @reg_clr: output clear register (out=low) for generic GPIO 202 * @reg_clr: output clear register (out=low) for generic GPIO
203 * @reg_dir: direction setting register for generic GPIO 203 * @reg_dir: direction setting register for generic GPIO
204 * @bgpio_dir_inverted: indicates that the direction register is inverted
205 * (gpiolib private state variable)
204 * @bgpio_bits: number of register bits used for a generic GPIO i.e. 206 * @bgpio_bits: number of register bits used for a generic GPIO i.e.
205 * <register width> * 8 207 * <register width> * 8
206 * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep 208 * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep
@@ -267,6 +269,7 @@ struct gpio_chip {
267 void __iomem *reg_set; 269 void __iomem *reg_set;
268 void __iomem *reg_clr; 270 void __iomem *reg_clr;
269 void __iomem *reg_dir; 271 void __iomem *reg_dir;
272 bool bgpio_dir_inverted;
270 int bgpio_bits; 273 int bgpio_bits;
271 spinlock_t bgpio_lock; 274 spinlock_t bgpio_lock;
272 unsigned long bgpio_data; 275 unsigned long bgpio_data;
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 7160df54a6fe..3f84aeb81e48 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -2,6 +2,8 @@
2#ifndef _GPIO_KEYS_H 2#ifndef _GPIO_KEYS_H
3#define _GPIO_KEYS_H 3#define _GPIO_KEYS_H
4 4
5#include <linux/types.h>
6
5struct device; 7struct device;
6 8
7/** 9/**
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 773bcb1d4044..834e6461a690 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -190,6 +190,12 @@ struct hid_item {
190 * http://www.usb.org/developers/hidpage/HUTRR40RadioHIDUsagesFinal.pdf 190 * http://www.usb.org/developers/hidpage/HUTRR40RadioHIDUsagesFinal.pdf
191 */ 191 */
192#define HID_GD_WIRELESS_RADIO_CTLS 0x0001000c 192#define HID_GD_WIRELESS_RADIO_CTLS 0x0001000c
193/*
194 * System Multi-Axis, see:
195 * http://www.usb.org/developers/hidpage/HUTRR62_-_Generic_Desktop_CA_for_System_Multi-Axis_Controllers.txt
196 */
197#define HID_GD_SYSTEM_MULTIAXIS 0x0001000e
198
193#define HID_GD_X 0x00010030 199#define HID_GD_X 0x00010030
194#define HID_GD_Y 0x00010031 200#define HID_GD_Y 0x00010031
195#define HID_GD_Z 0x00010032 201#define HID_GD_Z 0x00010032
@@ -638,12 +644,13 @@ static inline void hid_set_drvdata(struct hid_device *hdev, void *data)
638struct hid_parser { 644struct hid_parser {
639 struct hid_global global; 645 struct hid_global global;
640 struct hid_global global_stack[HID_GLOBAL_STACK_SIZE]; 646 struct hid_global global_stack[HID_GLOBAL_STACK_SIZE];
641 unsigned global_stack_ptr; 647 unsigned int global_stack_ptr;
642 struct hid_local local; 648 struct hid_local local;
643 unsigned collection_stack[HID_COLLECTION_STACK_SIZE]; 649 unsigned int *collection_stack;
644 unsigned collection_stack_ptr; 650 unsigned int collection_stack_ptr;
651 unsigned int collection_stack_size;
645 struct hid_device *device; 652 struct hid_device *device;
646 unsigned scan_flags; 653 unsigned int scan_flags;
647}; 654};
648 655
649struct hid_class_descriptor { 656struct hid_class_descriptor {
@@ -894,6 +901,8 @@ const struct hid_device_id *hid_match_id(const struct hid_device *hdev,
894 const struct hid_device_id *id); 901 const struct hid_device_id *id);
895const struct hid_device_id *hid_match_device(struct hid_device *hdev, 902const struct hid_device_id *hid_match_device(struct hid_device *hdev,
896 struct hid_driver *hdrv); 903 struct hid_driver *hdrv);
904bool hid_compare_device_paths(struct hid_device *hdev_a,
905 struct hid_device *hdev_b, char separator);
897s32 hid_snto32(__u32 value, unsigned n); 906s32 hid_snto32(__u32 value, unsigned n);
898__u32 hid_field_extract(const struct hid_device *hid, __u8 *report, 907__u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
899 unsigned offset, unsigned n); 908 unsigned offset, unsigned n);
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a8a126259bc4..99c19b06d9a4 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -3,10 +3,11 @@
3#define _LINUX_HUGE_MM_H 3#define _LINUX_HUGE_MM_H
4 4
5#include <linux/sched/coredump.h> 5#include <linux/sched/coredump.h>
6#include <linux/mm_types.h>
6 7
7#include <linux/fs.h> /* only for vma_is_dax() */ 8#include <linux/fs.h> /* only for vma_is_dax() */
8 9
9extern int do_huge_pmd_anonymous_page(struct vm_fault *vmf); 10extern vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf);
10extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, 11extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
11 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, 12 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
12 struct vm_area_struct *vma); 13 struct vm_area_struct *vma);
@@ -23,7 +24,7 @@ static inline void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud)
23} 24}
24#endif 25#endif
25 26
26extern int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd); 27extern vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
27extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, 28extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
28 unsigned long addr, 29 unsigned long addr,
29 pmd_t *pmd, 30 pmd_t *pmd,
@@ -46,9 +47,9 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
46extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 47extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
47 unsigned long addr, pgprot_t newprot, 48 unsigned long addr, pgprot_t newprot,
48 int prot_numa); 49 int prot_numa);
49int vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, 50vm_fault_t vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
50 pmd_t *pmd, pfn_t pfn, bool write); 51 pmd_t *pmd, pfn_t pfn, bool write);
51int vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, 52vm_fault_t vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr,
52 pud_t *pud, pfn_t pfn, bool write); 53 pud_t *pud, pfn_t pfn, bool write);
53enum transparent_hugepage_flag { 54enum transparent_hugepage_flag {
54 TRANSPARENT_HUGEPAGE_FLAG, 55 TRANSPARENT_HUGEPAGE_FLAG,
@@ -216,7 +217,7 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
216struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr, 217struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
217 pud_t *pud, int flags); 218 pud_t *pud, int flags);
218 219
219extern int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd); 220extern vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
220 221
221extern struct page *huge_zero_page; 222extern struct page *huge_zero_page;
222 223
@@ -321,7 +322,8 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
321 return NULL; 322 return NULL;
322} 323}
323 324
324static inline int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd) 325static inline vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf,
326 pmd_t orig_pmd)
325{ 327{
326 return 0; 328 return 0;
327} 329}
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 36fa6a2a82e3..6b68e345f0ca 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -105,7 +105,7 @@ void hugetlb_report_meminfo(struct seq_file *);
105int hugetlb_report_node_meminfo(int, char *); 105int hugetlb_report_node_meminfo(int, char *);
106void hugetlb_show_meminfo(void); 106void hugetlb_show_meminfo(void);
107unsigned long hugetlb_total_pages(void); 107unsigned long hugetlb_total_pages(void);
108int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 108vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
109 unsigned long address, unsigned int flags); 109 unsigned long address, unsigned int flags);
110int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte, 110int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte,
111 struct vm_area_struct *dst_vma, 111 struct vm_area_struct *dst_vma,
@@ -348,9 +348,6 @@ struct hstate {
348struct huge_bootmem_page { 348struct huge_bootmem_page {
349 struct list_head list; 349 struct list_head list;
350 struct hstate *hstate; 350 struct hstate *hstate;
351#ifdef CONFIG_HIGHMEM
352 phys_addr_t phys;
353#endif
354}; 351};
355 352
356struct page *alloc_huge_page(struct vm_area_struct *vma, 353struct page *alloc_huge_page(struct vm_area_struct *vma,
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index e5fd2707b6df..9493d4a388db 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -93,6 +93,7 @@ enum hwmon_temp_attributes {
93#define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm) 93#define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm)
94#define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm) 94#define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm)
95#define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm) 95#define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm)
96#define HWMON_T_LCRIT_ALARM BIT(hwmon_temp_lcrit_alarm)
96#define HWMON_T_EMERGENCY_ALARM BIT(hwmon_temp_emergency_alarm) 97#define HWMON_T_EMERGENCY_ALARM BIT(hwmon_temp_emergency_alarm)
97#define HWMON_T_FAULT BIT(hwmon_temp_fault) 98#define HWMON_T_FAULT BIT(hwmon_temp_fault)
98#define HWMON_T_OFFSET BIT(hwmon_temp_offset) 99#define HWMON_T_OFFSET BIT(hwmon_temp_offset)
@@ -187,12 +188,16 @@ enum hwmon_power_attributes {
187 hwmon_power_cap_hyst, 188 hwmon_power_cap_hyst,
188 hwmon_power_cap_max, 189 hwmon_power_cap_max,
189 hwmon_power_cap_min, 190 hwmon_power_cap_min,
191 hwmon_power_min,
190 hwmon_power_max, 192 hwmon_power_max,
191 hwmon_power_crit, 193 hwmon_power_crit,
194 hwmon_power_lcrit,
192 hwmon_power_label, 195 hwmon_power_label,
193 hwmon_power_alarm, 196 hwmon_power_alarm,
194 hwmon_power_cap_alarm, 197 hwmon_power_cap_alarm,
198 hwmon_power_min_alarm,
195 hwmon_power_max_alarm, 199 hwmon_power_max_alarm,
200 hwmon_power_lcrit_alarm,
196 hwmon_power_crit_alarm, 201 hwmon_power_crit_alarm,
197}; 202};
198 203
@@ -213,12 +218,16 @@ enum hwmon_power_attributes {
213#define HWMON_P_CAP_HYST BIT(hwmon_power_cap_hyst) 218#define HWMON_P_CAP_HYST BIT(hwmon_power_cap_hyst)
214#define HWMON_P_CAP_MAX BIT(hwmon_power_cap_max) 219#define HWMON_P_CAP_MAX BIT(hwmon_power_cap_max)
215#define HWMON_P_CAP_MIN BIT(hwmon_power_cap_min) 220#define HWMON_P_CAP_MIN BIT(hwmon_power_cap_min)
221#define HWMON_P_MIN BIT(hwmon_power_min)
216#define HWMON_P_MAX BIT(hwmon_power_max) 222#define HWMON_P_MAX BIT(hwmon_power_max)
223#define HWMON_P_LCRIT BIT(hwmon_power_lcrit)
217#define HWMON_P_CRIT BIT(hwmon_power_crit) 224#define HWMON_P_CRIT BIT(hwmon_power_crit)
218#define HWMON_P_LABEL BIT(hwmon_power_label) 225#define HWMON_P_LABEL BIT(hwmon_power_label)
219#define HWMON_P_ALARM BIT(hwmon_power_alarm) 226#define HWMON_P_ALARM BIT(hwmon_power_alarm)
220#define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm) 227#define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm)
228#define HWMON_P_MIN_ALARM BIT(hwmon_power_max_alarm)
221#define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm) 229#define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm)
230#define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm)
222#define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm) 231#define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)
223 232
224enum hwmon_energy_attributes { 233enum hwmon_energy_attributes {
@@ -389,4 +398,27 @@ devm_hwmon_device_register_with_info(struct device *dev,
389void hwmon_device_unregister(struct device *dev); 398void hwmon_device_unregister(struct device *dev);
390void devm_hwmon_device_unregister(struct device *dev); 399void devm_hwmon_device_unregister(struct device *dev);
391 400
401/**
402 * hwmon_is_bad_char - Is the char invalid in a hwmon name
403 * @ch: the char to be considered
404 *
405 * hwmon_is_bad_char() can be used to determine if the given character
406 * may not be used in a hwmon name.
407 *
408 * Returns true if the char is invalid, false otherwise.
409 */
410static inline bool hwmon_is_bad_char(const char ch)
411{
412 switch (ch) {
413 case '-':
414 case '*':
415 case ' ':
416 case '\t':
417 case '\n':
418 return true;
419 default:
420 return false;
421 }
422}
423
392#endif 424#endif
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
index 57537e67b468..0afe693be5f4 100644
--- a/include/linux/hwspinlock.h
+++ b/include/linux/hwspinlock.h
@@ -52,7 +52,7 @@ struct hwspinlock_pdata {
52 int base_id; 52 int base_id;
53}; 53};
54 54
55#if defined(CONFIG_HWSPINLOCK) || defined(CONFIG_HWSPINLOCK_MODULE) 55#ifdef CONFIG_HWSPINLOCK
56 56
57int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, 57int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
58 const struct hwspinlock_ops *ops, int base_id, int num_locks); 58 const struct hwspinlock_ops *ops, int base_id, int num_locks);
@@ -66,6 +66,17 @@ int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int,
66 unsigned long *); 66 unsigned long *);
67int __hwspin_trylock(struct hwspinlock *, int, unsigned long *); 67int __hwspin_trylock(struct hwspinlock *, int, unsigned long *);
68void __hwspin_unlock(struct hwspinlock *, int, unsigned long *); 68void __hwspin_unlock(struct hwspinlock *, int, unsigned long *);
69int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name);
70int devm_hwspin_lock_free(struct device *dev, struct hwspinlock *hwlock);
71struct hwspinlock *devm_hwspin_lock_request(struct device *dev);
72struct hwspinlock *devm_hwspin_lock_request_specific(struct device *dev,
73 unsigned int id);
74int devm_hwspin_lock_unregister(struct device *dev,
75 struct hwspinlock_device *bank);
76int devm_hwspin_lock_register(struct device *dev,
77 struct hwspinlock_device *bank,
78 const struct hwspinlock_ops *ops,
79 int base_id, int num_locks);
69 80
70#else /* !CONFIG_HWSPINLOCK */ 81#else /* !CONFIG_HWSPINLOCK */
71 82
@@ -125,6 +136,30 @@ static inline int hwspin_lock_get_id(struct hwspinlock *hwlock)
125 return 0; 136 return 0;
126} 137}
127 138
139static inline
140int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name)
141{
142 return 0;
143}
144
145static inline
146int devm_hwspin_lock_free(struct device *dev, struct hwspinlock *hwlock)
147{
148 return 0;
149}
150
151static inline struct hwspinlock *devm_hwspin_lock_request(struct device *dev)
152{
153 return ERR_PTR(-ENODEV);
154}
155
156static inline
157struct hwspinlock *devm_hwspin_lock_request_specific(struct device *dev,
158 unsigned int id)
159{
160 return ERR_PTR(-ENODEV);
161}
162
128#endif /* !CONFIG_HWSPINLOCK */ 163#endif /* !CONFIG_HWSPINLOCK */
129 164
130/** 165/**
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 3a3012f57be4..efda23cf32c7 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -89,18 +89,33 @@ struct hv_ring_buffer {
89 u32 interrupt_mask; 89 u32 interrupt_mask;
90 90
91 /* 91 /*
92 * Win8 uses some of the reserved bits to implement 92 * WS2012/Win8 and later versions of Hyper-V implement interrupt
93 * interrupt driven flow management. On the send side 93 * driven flow management. The feature bit feat_pending_send_sz
94 * we can request that the receiver interrupt the sender 94 * is set by the host on the host->guest ring buffer, and by the
95 * when the ring transitions from being full to being able 95 * guest on the guest->host ring buffer.
96 * to handle a message of size "pending_send_sz".
97 * 96 *
98 * Add necessary state for this enhancement. 97 * The meaning of the feature bit is a bit complex in that it has
98 * semantics that apply to both ring buffers. If the guest sets
99 * the feature bit in the guest->host ring buffer, the guest is
100 * telling the host that:
101 * 1) It will set the pending_send_sz field in the guest->host ring
102 * buffer when it is waiting for space to become available, and
103 * 2) It will read the pending_send_sz field in the host->guest
104 * ring buffer and interrupt the host when it frees enough space
105 *
106 * Similarly, if the host sets the feature bit in the host->guest
107 * ring buffer, the host is telling the guest that:
108 * 1) It will set the pending_send_sz field in the host->guest ring
109 * buffer when it is waiting for space to become available, and
110 * 2) It will read the pending_send_sz field in the guest->host
111 * ring buffer and interrupt the guest when it frees enough space
112 *
113 * If either the guest or host does not set the feature bit that it
114 * owns, that guest or host must do polling if it encounters a full
115 * ring buffer, and not signal the other end with an interrupt.
99 */ 116 */
100 u32 pending_send_sz; 117 u32 pending_send_sz;
101
102 u32 reserved1[12]; 118 u32 reserved1[12];
103
104 union { 119 union {
105 struct { 120 struct {
106 u32 feat_pending_send_sz:1; 121 u32 feat_pending_send_sz:1;
@@ -1046,6 +1061,8 @@ extern int vmbus_establish_gpadl(struct vmbus_channel *channel,
1046extern int vmbus_teardown_gpadl(struct vmbus_channel *channel, 1061extern int vmbus_teardown_gpadl(struct vmbus_channel *channel,
1047 u32 gpadl_handle); 1062 u32 gpadl_handle);
1048 1063
1064void vmbus_reset_channel_cb(struct vmbus_channel *channel);
1065
1049extern int vmbus_recvpacket(struct vmbus_channel *channel, 1066extern int vmbus_recvpacket(struct vmbus_channel *channel,
1050 void *buffer, 1067 void *buffer,
1051 u32 bufferlen, 1068 u32 bufferlen,
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 254cd34eeae2..65b4eaed1d96 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -140,9 +140,14 @@ extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
140 and probably just as fast. 140 and probably just as fast.
141 Note that we use i2c_adapter here, because you do not need a specific 141 Note that we use i2c_adapter here, because you do not need a specific
142 smbus adapter to call this function. */ 142 smbus adapter to call this function. */
143extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, 143s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
144 unsigned short flags, char read_write, u8 command, 144 unsigned short flags, char read_write, u8 command,
145 int size, union i2c_smbus_data *data); 145 int protocol, union i2c_smbus_data *data);
146
147/* Unlocked flavor */
148s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
149 unsigned short flags, char read_write, u8 command,
150 int protocol, union i2c_smbus_data *data);
146 151
147/* Now follow the 'nice' access routines. These also document the calling 152/* Now follow the 'nice' access routines. These also document the calling
148 conventions of i2c_smbus_xfer. */ 153 conventions of i2c_smbus_xfer. */
@@ -226,7 +231,6 @@ enum i2c_alert_protocol {
226/** 231/**
227 * struct i2c_driver - represent an I2C device driver 232 * struct i2c_driver - represent an I2C device driver
228 * @class: What kind of i2c device we instantiate (for detect) 233 * @class: What kind of i2c device we instantiate (for detect)
229 * @attach_adapter: Callback for bus addition (deprecated)
230 * @probe: Callback for device binding - soon to be deprecated 234 * @probe: Callback for device binding - soon to be deprecated
231 * @probe_new: New callback for device binding 235 * @probe_new: New callback for device binding
232 * @remove: Callback for device unbinding 236 * @remove: Callback for device unbinding
@@ -263,11 +267,6 @@ enum i2c_alert_protocol {
263struct i2c_driver { 267struct i2c_driver {
264 unsigned int class; 268 unsigned int class;
265 269
266 /* Notifies the driver that a new bus has appeared. You should avoid
267 * using this, it will be removed in a near future.
268 */
269 int (*attach_adapter)(struct i2c_adapter *) __deprecated;
270
271 /* Standard driver model interfaces */ 270 /* Standard driver model interfaces */
272 int (*probe)(struct i2c_client *, const struct i2c_device_id *); 271 int (*probe)(struct i2c_client *, const struct i2c_device_id *);
273 int (*remove)(struct i2c_client *); 272 int (*remove)(struct i2c_client *);
@@ -559,6 +558,7 @@ struct i2c_lock_operations {
559 * @scl_fall_ns: time SCL signal takes to fall in ns; t(f) in the I2C specification 558 * @scl_fall_ns: time SCL signal takes to fall in ns; t(f) in the I2C specification
560 * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns 559 * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns
561 * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification 560 * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification
561 * @sda_hold_ns: time IP core additionally needs to hold SDA in ns
562 */ 562 */
563struct i2c_timings { 563struct i2c_timings {
564 u32 bus_freq_hz; 564 u32 bus_freq_hz;
@@ -566,6 +566,7 @@ struct i2c_timings {
566 u32 scl_fall_ns; 566 u32 scl_fall_ns;
567 u32 scl_int_delay_ns; 567 u32 scl_int_delay_ns;
568 u32 sda_fall_ns; 568 u32 sda_fall_ns;
569 u32 sda_hold_ns;
569}; 570};
570 571
571/** 572/**
@@ -576,12 +577,14 @@ struct i2c_timings {
576 * recovery. Populated internally for generic GPIO recovery. 577 * recovery. Populated internally for generic GPIO recovery.
577 * @set_scl: This sets/clears the SCL line. Mandatory for generic SCL recovery. 578 * @set_scl: This sets/clears the SCL line. Mandatory for generic SCL recovery.
578 * Populated internally for generic GPIO recovery. 579 * Populated internally for generic GPIO recovery.
579 * @get_sda: This gets current value of SDA line. Optional for generic SCL 580 * @get_sda: This gets current value of SDA line. This or set_sda() is mandatory
580 * recovery. Populated internally, if sda_gpio is a valid GPIO, for generic 581 * for generic SCL recovery. Populated internally, if sda_gpio is a valid
581 * GPIO recovery. 582 * GPIO, for generic GPIO recovery.
582 * @set_sda: This sets/clears the SDA line. Optional for generic SCL recovery. 583 * @set_sda: This sets/clears the SDA line. This or get_sda() is mandatory for
583 * Populated internally, if sda_gpio is a valid GPIO, for generic GPIO 584 * generic SCL recovery. Populated internally, if sda_gpio is a valid GPIO,
584 * recovery. 585 * for generic GPIO recovery.
586 * @get_bus_free: Returns the bus free state as seen from the IP core in case it
587 * has a more complex internal logic than just reading SDA. Optional.
585 * @prepare_recovery: This will be called before starting recovery. Platform may 588 * @prepare_recovery: This will be called before starting recovery. Platform may
586 * configure padmux here for SDA/SCL line or something else they want. 589 * configure padmux here for SDA/SCL line or something else they want.
587 * @unprepare_recovery: This will be called after completing recovery. Platform 590 * @unprepare_recovery: This will be called after completing recovery. Platform
@@ -596,6 +599,7 @@ struct i2c_bus_recovery_info {
596 void (*set_scl)(struct i2c_adapter *adap, int val); 599 void (*set_scl)(struct i2c_adapter *adap, int val);
597 int (*get_sda)(struct i2c_adapter *adap); 600 int (*get_sda)(struct i2c_adapter *adap);
598 void (*set_sda)(struct i2c_adapter *adap, int val); 601 void (*set_sda)(struct i2c_adapter *adap, int val);
602 int (*get_bus_free)(struct i2c_adapter *adap);
599 603
600 void (*prepare_recovery)(struct i2c_adapter *adap); 604 void (*prepare_recovery)(struct i2c_adapter *adap);
601 void (*unprepare_recovery)(struct i2c_adapter *adap); 605 void (*unprepare_recovery)(struct i2c_adapter *adap);
@@ -653,6 +657,10 @@ struct i2c_adapter_quirks {
653 I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR) 657 I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR)
654/* clock stretching is not supported */ 658/* clock stretching is not supported */
655#define I2C_AQ_NO_CLK_STRETCH BIT(4) 659#define I2C_AQ_NO_CLK_STRETCH BIT(4)
660/* message cannot have length of 0 */
661#define I2C_AQ_NO_ZERO_LEN_READ BIT(5)
662#define I2C_AQ_NO_ZERO_LEN_WRITE BIT(6)
663#define I2C_AQ_NO_ZERO_LEN (I2C_AQ_NO_ZERO_LEN_READ | I2C_AQ_NO_ZERO_LEN_WRITE)
656 664
657/* 665/*
658 * i2c_adapter is the structure used to identify a physical i2c bus along 666 * i2c_adapter is the structure used to identify a physical i2c bus along
@@ -754,18 +762,6 @@ i2c_unlock_bus(struct i2c_adapter *adapter, unsigned int flags)
754 adapter->lock_ops->unlock_bus(adapter, flags); 762 adapter->lock_ops->unlock_bus(adapter, flags);
755} 763}
756 764
757static inline void
758i2c_lock_adapter(struct i2c_adapter *adapter)
759{
760 i2c_lock_bus(adapter, I2C_LOCK_ROOT_ADAPTER);
761}
762
763static inline void
764i2c_unlock_adapter(struct i2c_adapter *adapter)
765{
766 i2c_unlock_bus(adapter, I2C_LOCK_ROOT_ADAPTER);
767}
768
769/*flags for the client struct: */ 765/*flags for the client struct: */
770#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 766#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
771#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ 767#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
@@ -859,7 +855,7 @@ static inline u8 i2c_8bit_addr_from_msg(const struct i2c_msg *msg)
859} 855}
860 856
861u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold); 857u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold);
862void i2c_release_dma_safe_msg_buf(struct i2c_msg *msg, u8 *buf); 858void i2c_put_dma_safe_msg_buf(u8 *buf, struct i2c_msg *msg, bool xferred);
863 859
864int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr); 860int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr);
865/** 861/**
diff --git a/include/linux/idle_inject.h b/include/linux/idle_inject.h
new file mode 100644
index 000000000000..bdc0293fb6cb
--- /dev/null
+++ b/include/linux/idle_inject.h
@@ -0,0 +1,29 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2018 Linaro Ltd
4 *
5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
6 *
7 */
8#ifndef __IDLE_INJECT_H__
9#define __IDLE_INJECT_H__
10
11/* private idle injection device structure */
12struct idle_inject_device;
13
14struct idle_inject_device *idle_inject_register(struct cpumask *cpumask);
15
16void idle_inject_unregister(struct idle_inject_device *ii_dev);
17
18int idle_inject_start(struct idle_inject_device *ii_dev);
19
20void idle_inject_stop(struct idle_inject_device *ii_dev);
21
22void idle_inject_set_duration(struct idle_inject_device *ii_dev,
23 unsigned int run_duration_ms,
24 unsigned int idle_duration_ms);
25
26void idle_inject_get_duration(struct idle_inject_device *ii_dev,
27 unsigned int *run_duration_ms,
28 unsigned int *idle_duration_ms);
29#endif /* __IDLE_INJECT_H__ */
diff --git a/include/linux/idr.h b/include/linux/idr.h
index e856f4e0ab35..3ec8628ce17f 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -98,6 +98,17 @@ static inline void idr_set_cursor(struct idr *idr, unsigned int val)
98 * period). 98 * period).
99 */ 99 */
100 100
101#define idr_lock(idr) xa_lock(&(idr)->idr_rt)
102#define idr_unlock(idr) xa_unlock(&(idr)->idr_rt)
103#define idr_lock_bh(idr) xa_lock_bh(&(idr)->idr_rt)
104#define idr_unlock_bh(idr) xa_unlock_bh(&(idr)->idr_rt)
105#define idr_lock_irq(idr) xa_lock_irq(&(idr)->idr_rt)
106#define idr_unlock_irq(idr) xa_unlock_irq(&(idr)->idr_rt)
107#define idr_lock_irqsave(idr, flags) \
108 xa_lock_irqsave(&(idr)->idr_rt, flags)
109#define idr_unlock_irqrestore(idr, flags) \
110 xa_unlock_irqrestore(&(idr)->idr_rt, flags)
111
101void idr_preload(gfp_t gfp_mask); 112void idr_preload(gfp_t gfp_mask);
102 113
103int idr_alloc(struct idr *, void *ptr, int start, int end, gfp_t); 114int idr_alloc(struct idr *, void *ptr, int start, int end, gfp_t);
@@ -225,34 +236,74 @@ struct ida {
225} 236}
226#define DEFINE_IDA(name) struct ida name = IDA_INIT(name) 237#define DEFINE_IDA(name) struct ida name = IDA_INIT(name)
227 238
228int ida_pre_get(struct ida *ida, gfp_t gfp_mask); 239int ida_alloc_range(struct ida *, unsigned int min, unsigned int max, gfp_t);
229int ida_get_new_above(struct ida *ida, int starting_id, int *p_id); 240void ida_free(struct ida *, unsigned int id);
230void ida_remove(struct ida *ida, int id);
231void ida_destroy(struct ida *ida); 241void ida_destroy(struct ida *ida);
232 242
233int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end, 243/**
234 gfp_t gfp_mask); 244 * ida_alloc() - Allocate an unused ID.
235void ida_simple_remove(struct ida *ida, unsigned int id); 245 * @ida: IDA handle.
246 * @gfp: Memory allocation flags.
247 *
248 * Allocate an ID between 0 and %INT_MAX, inclusive.
249 *
250 * Context: Any context.
251 * Return: The allocated ID, or %-ENOMEM if memory could not be allocated,
252 * or %-ENOSPC if there are no free IDs.
253 */
254static inline int ida_alloc(struct ida *ida, gfp_t gfp)
255{
256 return ida_alloc_range(ida, 0, ~0, gfp);
257}
236 258
237static inline void ida_init(struct ida *ida) 259/**
260 * ida_alloc_min() - Allocate an unused ID.
261 * @ida: IDA handle.
262 * @min: Lowest ID to allocate.
263 * @gfp: Memory allocation flags.
264 *
265 * Allocate an ID between @min and %INT_MAX, inclusive.
266 *
267 * Context: Any context.
268 * Return: The allocated ID, or %-ENOMEM if memory could not be allocated,
269 * or %-ENOSPC if there are no free IDs.
270 */
271static inline int ida_alloc_min(struct ida *ida, unsigned int min, gfp_t gfp)
238{ 272{
239 INIT_RADIX_TREE(&ida->ida_rt, IDR_RT_MARKER | GFP_NOWAIT); 273 return ida_alloc_range(ida, min, ~0, gfp);
240} 274}
241 275
242/** 276/**
243 * ida_get_new - allocate new ID 277 * ida_alloc_max() - Allocate an unused ID.
244 * @ida: idr handle 278 * @ida: IDA handle.
245 * @p_id: pointer to the allocated handle 279 * @max: Highest ID to allocate.
280 * @gfp: Memory allocation flags.
281 *
282 * Allocate an ID between 0 and @max, inclusive.
246 * 283 *
247 * Simple wrapper around ida_get_new_above() w/ @starting_id of zero. 284 * Context: Any context.
285 * Return: The allocated ID, or %-ENOMEM if memory could not be allocated,
286 * or %-ENOSPC if there are no free IDs.
248 */ 287 */
249static inline int ida_get_new(struct ida *ida, int *p_id) 288static inline int ida_alloc_max(struct ida *ida, unsigned int max, gfp_t gfp)
250{ 289{
251 return ida_get_new_above(ida, 0, p_id); 290 return ida_alloc_range(ida, 0, max, gfp);
252} 291}
253 292
293static inline void ida_init(struct ida *ida)
294{
295 INIT_RADIX_TREE(&ida->ida_rt, IDR_RT_MARKER | GFP_NOWAIT);
296}
297
298#define ida_simple_get(ida, start, end, gfp) \
299 ida_alloc_range(ida, start, (end) - 1, gfp)
300#define ida_simple_remove(ida, id) ida_free(ida, id)
301
254static inline bool ida_is_empty(const struct ida *ida) 302static inline bool ida_is_empty(const struct ida *ida)
255{ 303{
256 return radix_tree_empty(&ida->ida_rt); 304 return radix_tree_empty(&ida->ida_rt);
257} 305}
306
307/* in lib/radix-tree.c */
308int ida_pre_get(struct ida *ida, gfp_t gfp_mask);
258#endif /* __IDR_H__ */ 309#endif /* __IDR_H__ */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 8fe7e4306816..9c03a7d5e400 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1433,11 +1433,13 @@ struct ieee80211_ht_operation {
1433#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 1433#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
1434 1434
1435/* 1435/*
1436 * A-PMDU buffer sizes 1436 * A-MPDU buffer sizes
1437 * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) 1437 * According to HT size varies from 8 to 64 frames
1438 * HE adds the ability to have up to 256 frames.
1438 */ 1439 */
1439#define IEEE80211_MIN_AMPDU_BUF 0x8 1440#define IEEE80211_MIN_AMPDU_BUF 0x8
1440#define IEEE80211_MAX_AMPDU_BUF 0x40 1441#define IEEE80211_MAX_AMPDU_BUF_HT 0x40
1442#define IEEE80211_MAX_AMPDU_BUF 0x100
1441 1443
1442 1444
1443/* Spatial Multiplexing Power Save Modes (for capability) */ 1445/* Spatial Multiplexing Power Save Modes (for capability) */
@@ -1539,6 +1541,106 @@ struct ieee80211_vht_operation {
1539 __le16 basic_mcs_set; 1541 __le16 basic_mcs_set;
1540} __packed; 1542} __packed;
1541 1543
1544/**
1545 * struct ieee80211_he_cap_elem - HE capabilities element
1546 *
1547 * This structure is the "HE capabilities element" fixed fields as
1548 * described in P802.11ax_D2.0 section 9.4.2.237.2 and 9.4.2.237.3
1549 */
1550struct ieee80211_he_cap_elem {
1551 u8 mac_cap_info[5];
1552 u8 phy_cap_info[9];
1553} __packed;
1554
1555#define IEEE80211_TX_RX_MCS_NSS_DESC_MAX_LEN 5
1556
1557/**
1558 * enum ieee80211_he_mcs_support - HE MCS support definitions
1559 * @IEEE80211_HE_MCS_SUPPORT_0_7: MCSes 0-7 are supported for the
1560 * number of streams
1561 * @IEEE80211_HE_MCS_SUPPORT_0_9: MCSes 0-9 are supported
1562 * @IEEE80211_HE_MCS_SUPPORT_0_11: MCSes 0-11 are supported
1563 * @IEEE80211_HE_MCS_NOT_SUPPORTED: This number of streams isn't supported
1564 *
1565 * These definitions are used in each 2-bit subfield of the rx_mcs_*
1566 * and tx_mcs_* fields of &struct ieee80211_he_mcs_nss_supp, which are
1567 * both split into 8 subfields by number of streams. These values indicate
1568 * which MCSes are supported for the number of streams the value appears
1569 * for.
1570 */
1571enum ieee80211_he_mcs_support {
1572 IEEE80211_HE_MCS_SUPPORT_0_7 = 0,
1573 IEEE80211_HE_MCS_SUPPORT_0_9 = 1,
1574 IEEE80211_HE_MCS_SUPPORT_0_11 = 2,
1575 IEEE80211_HE_MCS_NOT_SUPPORTED = 3,
1576};
1577
1578/**
1579 * struct ieee80211_he_mcs_nss_supp - HE Tx/Rx HE MCS NSS Support Field
1580 *
1581 * This structure holds the data required for the Tx/Rx HE MCS NSS Support Field
1582 * described in P802.11ax_D2.0 section 9.4.2.237.4
1583 *
1584 * @rx_mcs_80: Rx MCS map 2 bits for each stream, total 8 streams, for channel
1585 * widths less than 80MHz.
1586 * @tx_mcs_80: Tx MCS map 2 bits for each stream, total 8 streams, for channel
1587 * widths less than 80MHz.
1588 * @rx_mcs_160: Rx MCS map 2 bits for each stream, total 8 streams, for channel
1589 * width 160MHz.
1590 * @tx_mcs_160: Tx MCS map 2 bits for each stream, total 8 streams, for channel
1591 * width 160MHz.
1592 * @rx_mcs_80p80: Rx MCS map 2 bits for each stream, total 8 streams, for
1593 * channel width 80p80MHz.
1594 * @tx_mcs_80p80: Tx MCS map 2 bits for each stream, total 8 streams, for
1595 * channel width 80p80MHz.
1596 */
1597struct ieee80211_he_mcs_nss_supp {
1598 __le16 rx_mcs_80;
1599 __le16 tx_mcs_80;
1600 __le16 rx_mcs_160;
1601 __le16 tx_mcs_160;
1602 __le16 rx_mcs_80p80;
1603 __le16 tx_mcs_80p80;
1604} __packed;
1605
1606/**
1607 * struct ieee80211_he_operation - HE capabilities element
1608 *
1609 * This structure is the "HE operation element" fields as
1610 * described in P802.11ax_D2.0 section 9.4.2.238
1611 */
1612struct ieee80211_he_operation {
1613 __le32 he_oper_params;
1614 __le16 he_mcs_nss_set;
1615 /* Optional 0,1,3 or 4 bytes: depends on @he_oper_params */
1616 u8 optional[0];
1617} __packed;
1618
1619/**
1620 * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field
1621 *
1622 * This structure is the "MU AC Parameter Record" fields as
1623 * described in P802.11ax_D2.0 section 9.4.2.240
1624 */
1625struct ieee80211_he_mu_edca_param_ac_rec {
1626 u8 aifsn;
1627 u8 ecw_min_max;
1628 u8 mu_edca_timer;
1629} __packed;
1630
1631/**
1632 * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element
1633 *
1634 * This structure is the "MU EDCA Parameter Set element" fields as
1635 * described in P802.11ax_D2.0 section 9.4.2.240
1636 */
1637struct ieee80211_mu_edca_param_set {
1638 u8 mu_qos_info;
1639 struct ieee80211_he_mu_edca_param_ac_rec ac_be;
1640 struct ieee80211_he_mu_edca_param_ac_rec ac_bk;
1641 struct ieee80211_he_mu_edca_param_ac_rec ac_vi;
1642 struct ieee80211_he_mu_edca_param_ac_rec ac_vo;
1643} __packed;
1542 1644
1543/* 802.11ac VHT Capabilities */ 1645/* 802.11ac VHT Capabilities */
1544#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 1646#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000
@@ -1577,6 +1679,328 @@ struct ieee80211_vht_operation {
1577#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 1679#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000
1578#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 1680#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000
1579 1681
1682/* 802.11ax HE MAC capabilities */
1683#define IEEE80211_HE_MAC_CAP0_HTC_HE 0x01
1684#define IEEE80211_HE_MAC_CAP0_TWT_REQ 0x02
1685#define IEEE80211_HE_MAC_CAP0_TWT_RES 0x04
1686#define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_NOT_SUPP 0x00
1687#define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_1 0x08
1688#define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_2 0x10
1689#define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_3 0x18
1690#define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_MASK 0x18
1691#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_1 0x00
1692#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_2 0x20
1693#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_4 0x40
1694#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_8 0x60
1695#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_16 0x80
1696#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_32 0xa0
1697#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_64 0xc0
1698#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_UNLIMITED 0xe0
1699#define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_MASK 0xe0
1700
1701#define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_UNLIMITED 0x00
1702#define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_128 0x01
1703#define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_256 0x02
1704#define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_512 0x03
1705#define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_MASK 0x03
1706#define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_0US 0x00
1707#define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_8US 0x04
1708#define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x08
1709#define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK 0x0c
1710#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_1 0x00
1711#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_2 0x10
1712#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_3 0x20
1713#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_4 0x30
1714#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_5 0x40
1715#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_6 0x50
1716#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_7 0x60
1717#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_8 0x70
1718#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_MASK 0x70
1719
1720/* Link adaptation is split between byte HE_MAC_CAP1 and
1721 * HE_MAC_CAP2. It should be set only if IEEE80211_HE_MAC_CAP0_HTC_HE
1722 * in which case the following values apply:
1723 * 0 = No feedback.
1724 * 1 = reserved.
1725 * 2 = Unsolicited feedback.
1726 * 3 = both
1727 */
1728#define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION 0x80
1729
1730#define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x01
1731#define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x02
1732#define IEEE80211_HE_MAC_CAP2_UL_MU_RESP_SCHED 0x04
1733#define IEEE80211_HE_MAC_CAP2_BSR 0x08
1734#define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10
1735#define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x20
1736#define IEEE80211_HE_MAC_CAP2_MU_CASCADING 0x40
1737#define IEEE80211_HE_MAC_CAP2_ACK_EN 0x80
1738
1739#define IEEE80211_HE_MAC_CAP3_GRP_ADDR_MULTI_STA_BA_DL_MU 0x01
1740#define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x02
1741#define IEEE80211_HE_MAC_CAP3_OFDMA_RA 0x04
1742
1743/* The maximum length of an A-MDPU is defined by the combination of the Maximum
1744 * A-MDPU Length Exponent field in the HT capabilities, VHT capabilities and the
1745 * same field in the HE capabilities.
1746 */
1747#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_USE_VHT 0x00
1748#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_VHT_1 0x08
1749#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_VHT_2 0x10
1750#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_RESERVED 0x18
1751#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_MASK 0x18
1752#define IEEE80211_HE_MAC_CAP3_A_AMSDU_FRAG 0x20
1753#define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x40
1754#define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80
1755
1756#define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x01
1757#define IEEE80211_HE_MAC_CAP4_QTP 0x02
1758#define IEEE80211_HE_MAC_CAP4_BQR 0x04
1759#define IEEE80211_HE_MAC_CAP4_SR_RESP 0x08
1760#define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10
1761#define IEEE80211_HE_MAC_CAP4_OPS 0x20
1762#define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x40
1763
1764/* 802.11ax HE PHY capabilities */
1765#define IEEE80211_HE_PHY_CAP0_DUAL_BAND 0x01
1766#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x02
1767#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x04
1768#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x08
1769#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G 0x10
1770#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G 0x20
1771#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G 0x40
1772#define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK 0xfe
1773
1774#define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_80MHZ_ONLY_SECOND_20MHZ 0x01
1775#define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_80MHZ_ONLY_SECOND_40MHZ 0x02
1776#define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_160MHZ_ONLY_SECOND_20MHZ 0x04
1777#define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_160MHZ_ONLY_SECOND_40MHZ 0x08
1778#define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK 0x0f
1779#define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x10
1780#define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x20
1781#define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x40
1782/* Midamble RX Max NSTS is split between byte #2 and byte #3 */
1783#define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_MAX_NSTS 0x80
1784
1785#define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_MAX_NSTS 0x01
1786#define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x02
1787#define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x04
1788#define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x08
1789#define IEEE80211_HE_PHY_CAP2_DOPPLER_TX 0x10
1790#define IEEE80211_HE_PHY_CAP2_DOPPLER_RX 0x20
1791
1792/* Note that the meaning of UL MU below is different between an AP and a non-AP
1793 * sta, where in the AP case it indicates support for Rx and in the non-AP sta
1794 * case it indicates support for Tx.
1795 */
1796#define IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO 0x40
1797#define IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO 0x80
1798
1799#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM 0x00
1800#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK 0x01
1801#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK 0x02
1802#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM 0x03
1803#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK 0x03
1804#define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 0x00
1805#define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2 0x04
1806#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM 0x00
1807#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK 0x08
1808#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK 0x10
1809#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM 0x18
1810#define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x18
1811#define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x00
1812#define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2 0x20
1813#define IEEE80211_HE_PHY_CAP3_RX_HE_MU_PPDU_FROM_NON_AP_STA 0x40
1814#define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x80
1815
1816#define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x01
1817#define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER 0x02
1818
1819/* Minimal allowed value of Max STS under 80MHz is 3 */
1820#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 0x0c
1821#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_5 0x10
1822#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_6 0x14
1823#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_7 0x18
1824#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8 0x1c
1825#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK 0x1c
1826
1827/* Minimal allowed value of Max STS above 80MHz is 3 */
1828#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4 0x60
1829#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_5 0x80
1830#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_6 0xa0
1831#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_7 0xc0
1832#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 0xe0
1833#define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK 0xe0
1834
1835#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_1 0x00
1836#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 0x01
1837#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_3 0x02
1838#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_4 0x03
1839#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_5 0x04
1840#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_6 0x05
1841#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_7 0x06
1842#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_8 0x07
1843#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK 0x07
1844
1845#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_1 0x00
1846#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 0x08
1847#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_3 0x10
1848#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_4 0x18
1849#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_5 0x20
1850#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_6 0x28
1851#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_7 0x30
1852#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_8 0x38
1853#define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK 0x38
1854
1855#define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK 0x40
1856#define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK 0x80
1857
1858#define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x01
1859#define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x02
1860#define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB 0x04
1861#define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB 0x08
1862#define IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB 0x10
1863#define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x20
1864#define IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO 0x40
1865#define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x80
1866
1867#define IEEE80211_HE_PHY_CAP7_SRP_BASED_SR 0x01
1868#define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR 0x02
1869#define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x04
1870#define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x08
1871#define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x10
1872#define IEEE80211_HE_PHY_CAP7_MAX_NC_3 0x18
1873#define IEEE80211_HE_PHY_CAP7_MAX_NC_4 0x20
1874#define IEEE80211_HE_PHY_CAP7_MAX_NC_5 0x28
1875#define IEEE80211_HE_PHY_CAP7_MAX_NC_6 0x30
1876#define IEEE80211_HE_PHY_CAP7_MAX_NC_7 0x38
1877#define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK 0x38
1878#define IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ 0x40
1879#define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ 0x80
1880
1881#define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI 0x01
1882#define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G 0x02
1883#define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x04
1884#define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x08
1885#define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x10
1886#define IEEE80211_HE_PHY_CAP8_MIDAMBLE_RX_2X_AND_1XLTF 0x20
1887
1888/* 802.11ax HE TX/RX MCS NSS Support */
1889#define IEEE80211_TX_RX_MCS_NSS_SUPP_HIGHEST_MCS_POS (3)
1890#define IEEE80211_TX_RX_MCS_NSS_SUPP_TX_BITMAP_POS (6)
1891#define IEEE80211_TX_RX_MCS_NSS_SUPP_RX_BITMAP_POS (11)
1892#define IEEE80211_TX_RX_MCS_NSS_SUPP_TX_BITMAP_MASK 0x07c0
1893#define IEEE80211_TX_RX_MCS_NSS_SUPP_RX_BITMAP_MASK 0xf800
1894
1895/* TX/RX HE MCS Support field Highest MCS subfield encoding */
1896enum ieee80211_he_highest_mcs_supported_subfield_enc {
1897 HIGHEST_MCS_SUPPORTED_MCS7 = 0,
1898 HIGHEST_MCS_SUPPORTED_MCS8,
1899 HIGHEST_MCS_SUPPORTED_MCS9,
1900 HIGHEST_MCS_SUPPORTED_MCS10,
1901 HIGHEST_MCS_SUPPORTED_MCS11,
1902};
1903
1904/* Calculate 802.11ax HE capabilities IE Tx/Rx HE MCS NSS Support Field size */
1905static inline u8
1906ieee80211_he_mcs_nss_size(const struct ieee80211_he_cap_elem *he_cap)
1907{
1908 u8 count = 4;
1909
1910 if (he_cap->phy_cap_info[0] &
1911 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G)
1912 count += 4;
1913
1914 if (he_cap->phy_cap_info[0] &
1915 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
1916 count += 4;
1917
1918 return count;
1919}
1920
1921/* 802.11ax HE PPE Thresholds */
1922#define IEEE80211_PPE_THRES_NSS_SUPPORT_2NSS (1)
1923#define IEEE80211_PPE_THRES_NSS_POS (0)
1924#define IEEE80211_PPE_THRES_NSS_MASK (7)
1925#define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_2x966_AND_966_RU \
1926 (BIT(5) | BIT(6))
1927#define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK 0x78
1928#define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_POS (3)
1929#define IEEE80211_PPE_THRES_INFO_PPET_SIZE (3)
1930
1931/*
1932 * Calculate 802.11ax HE capabilities IE PPE field size
1933 * Input: Header byte of ppe_thres (first byte), and HE capa IE's PHY cap u8*
1934 */
1935static inline u8
1936ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info)
1937{
1938 u8 n;
1939
1940 if ((phy_cap_info[6] &
1941 IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) == 0)
1942 return 0;
1943
1944 n = hweight8(ppe_thres_hdr &
1945 IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK);
1946 n *= (1 + ((ppe_thres_hdr & IEEE80211_PPE_THRES_NSS_MASK) >>
1947 IEEE80211_PPE_THRES_NSS_POS));
1948
1949 /*
1950 * Each pair is 6 bits, and we need to add the 7 "header" bits to the
1951 * total size.
1952 */
1953 n = (n * IEEE80211_PPE_THRES_INFO_PPET_SIZE * 2) + 7;
1954 n = DIV_ROUND_UP(n, 8);
1955
1956 return n;
1957}
1958
1959/* HE Operation defines */
1960#define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x0000003f
1961#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x000001c0
1962#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_OFFSET 6
1963#define IEEE80211_HE_OPERATION_TWT_REQUIRED 0x00000200
1964#define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK 0x000ffc00
1965#define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET 10
1966#define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x000100000
1967#define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x000200000
1968#define IEEE80211_HE_OPERATION_MULTI_BSSID_AP 0x10000000
1969#define IEEE80211_HE_OPERATION_TX_BSSID_INDICATOR 0x20000000
1970#define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x40000000
1971
1972/*
1973 * ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size
1974 * @he_oper_ie: byte data of the He Operations IE, stating from the the byte
1975 * after the ext ID byte. It is assumed that he_oper_ie has at least
1976 * sizeof(struct ieee80211_he_operation) bytes, checked already in
1977 * ieee802_11_parse_elems_crc()
1978 * @return the actual size of the IE data (not including header), or 0 on error
1979 */
1980static inline u8
1981ieee80211_he_oper_size(const u8 *he_oper_ie)
1982{
1983 struct ieee80211_he_operation *he_oper = (void *)he_oper_ie;
1984 u8 oper_len = sizeof(struct ieee80211_he_operation);
1985 u32 he_oper_params;
1986
1987 /* Make sure the input is not NULL */
1988 if (!he_oper_ie)
1989 return 0;
1990
1991 /* Calc required length */
1992 he_oper_params = le32_to_cpu(he_oper->he_oper_params);
1993 if (he_oper_params & IEEE80211_HE_OPERATION_VHT_OPER_INFO)
1994 oper_len += 3;
1995 if (he_oper_params & IEEE80211_HE_OPERATION_MULTI_BSSID_AP)
1996 oper_len++;
1997
1998 /* Add the first byte (extension ID) to the total length */
1999 oper_len++;
2000
2001 return oper_len;
2002}
2003
1580/* Authentication algorithms */ 2004/* Authentication algorithms */
1581#define WLAN_AUTH_OPEN 0 2005#define WLAN_AUTH_OPEN 0
1582#define WLAN_AUTH_SHARED_KEY 1 2006#define WLAN_AUTH_SHARED_KEY 1
@@ -1992,6 +2416,11 @@ enum ieee80211_eid_ext {
1992 WLAN_EID_EXT_FILS_WRAPPED_DATA = 8, 2416 WLAN_EID_EXT_FILS_WRAPPED_DATA = 8,
1993 WLAN_EID_EXT_FILS_PUBLIC_KEY = 12, 2417 WLAN_EID_EXT_FILS_PUBLIC_KEY = 12,
1994 WLAN_EID_EXT_FILS_NONCE = 13, 2418 WLAN_EID_EXT_FILS_NONCE = 13,
2419 WLAN_EID_EXT_FUTURE_CHAN_GUIDANCE = 14,
2420 WLAN_EID_EXT_HE_CAPABILITY = 35,
2421 WLAN_EID_EXT_HE_OPERATION = 36,
2422 WLAN_EID_EXT_UORA = 37,
2423 WLAN_EID_EXT_HE_MU_EDCA = 38,
1995}; 2424};
1996 2425
1997/* Action category code */ 2426/* Action category code */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index d95cae09dea0..ac42da56f7a2 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -74,6 +74,11 @@ struct team_port {
74 long mode_priv[0]; 74 long mode_priv[0];
75}; 75};
76 76
77static inline struct team_port *team_port_get_rcu(const struct net_device *dev)
78{
79 return rcu_dereference(dev->rx_handler_data);
80}
81
77static inline bool team_port_enabled(struct team_port *port) 82static inline bool team_port_enabled(struct team_port *port)
78{ 83{
79 return port->index != -1; 84 return port->index != -1;
@@ -84,6 +89,19 @@ static inline bool team_port_txable(struct team_port *port)
84 return port->linkup && team_port_enabled(port); 89 return port->linkup && team_port_enabled(port);
85} 90}
86 91
92static inline bool team_port_dev_txable(const struct net_device *port_dev)
93{
94 struct team_port *port;
95 bool txable;
96
97 rcu_read_lock();
98 port = team_port_get_rcu(port_dev);
99 txable = port ? team_port_txable(port) : false;
100 rcu_read_unlock();
101
102 return txable;
103}
104
87#ifdef CONFIG_NET_POLL_CONTROLLER 105#ifdef CONFIG_NET_POLL_CONTROLLER
88static inline void team_netpoll_send_skb(struct team_port *port, 106static inline void team_netpoll_send_skb(struct team_port *port,
89 struct sk_buff *skb) 107 struct sk_buff *skb)
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 0e4647e0eb60..97914a2833d1 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -11,14 +11,16 @@
11#define _LINUX_IMA_H 11#define _LINUX_IMA_H
12 12
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/security.h>
14#include <linux/kexec.h> 15#include <linux/kexec.h>
15struct linux_binprm; 16struct linux_binprm;
16 17
17#ifdef CONFIG_IMA 18#ifdef CONFIG_IMA
18extern int ima_bprm_check(struct linux_binprm *bprm); 19extern int ima_bprm_check(struct linux_binprm *bprm);
19extern int ima_file_check(struct file *file, int mask, int opened); 20extern int ima_file_check(struct file *file, int mask);
20extern void ima_file_free(struct file *file); 21extern void ima_file_free(struct file *file);
21extern int ima_file_mmap(struct file *file, unsigned long prot); 22extern int ima_file_mmap(struct file *file, unsigned long prot);
23extern int ima_load_data(enum kernel_load_data_id id);
22extern int ima_read_file(struct file *file, enum kernel_read_file_id id); 24extern int ima_read_file(struct file *file, enum kernel_read_file_id id);
23extern int ima_post_read_file(struct file *file, void *buf, loff_t size, 25extern int ima_post_read_file(struct file *file, void *buf, loff_t size,
24 enum kernel_read_file_id id); 26 enum kernel_read_file_id id);
@@ -34,7 +36,7 @@ static inline int ima_bprm_check(struct linux_binprm *bprm)
34 return 0; 36 return 0;
35} 37}
36 38
37static inline int ima_file_check(struct file *file, int mask, int opened) 39static inline int ima_file_check(struct file *file, int mask)
38{ 40{
39 return 0; 41 return 0;
40} 42}
@@ -49,6 +51,11 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
49 return 0; 51 return 0;
50} 52}
51 53
54static inline int ima_load_data(enum kernel_load_data_id id)
55{
56 return 0;
57}
58
52static inline int ima_read_file(struct file *file, enum kernel_read_file_id id) 59static inline int ima_read_file(struct file *file, enum kernel_read_file_id id)
53{ 60{
54 return 0; 61 return 0;
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 27650f1bff3d..c759d1cbcedd 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -93,6 +93,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
93 93
94#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) 94#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
95#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) 95#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
96#define IN_DEV_BFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), BC_FORWARDING)
96#define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) 97#define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER)
97#define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK) 98#define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK)
98#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ 99#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \
diff --git a/include/linux/init.h b/include/linux/init.h
index bc27cf03c41e..2538d176dd1f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -116,8 +116,24 @@
116typedef int (*initcall_t)(void); 116typedef int (*initcall_t)(void);
117typedef void (*exitcall_t)(void); 117typedef void (*exitcall_t)(void);
118 118
119extern initcall_t __con_initcall_start[], __con_initcall_end[]; 119#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
120extern initcall_t __security_initcall_start[], __security_initcall_end[]; 120typedef int initcall_entry_t;
121
122static inline initcall_t initcall_from_entry(initcall_entry_t *entry)
123{
124 return offset_to_ptr(entry);
125}
126#else
127typedef initcall_t initcall_entry_t;
128
129static inline initcall_t initcall_from_entry(initcall_entry_t *entry)
130{
131 return *entry;
132}
133#endif
134
135extern initcall_entry_t __con_initcall_start[], __con_initcall_end[];
136extern initcall_entry_t __security_initcall_start[], __security_initcall_end[];
121 137
122/* Used for contructor calls. */ 138/* Used for contructor calls. */
123typedef void (*ctor_fn_t)(void); 139typedef void (*ctor_fn_t)(void);
@@ -167,9 +183,20 @@ extern bool initcall_debug;
167 * as KEEP() in the linker script. 183 * as KEEP() in the linker script.
168 */ 184 */
169 185
170#define __define_initcall(fn, id) \ 186#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
187#define ___define_initcall(fn, id, __sec) \
188 __ADDRESSABLE(fn) \
189 asm(".section \"" #__sec ".init\", \"a\" \n" \
190 "__initcall_" #fn #id ": \n" \
191 ".long " #fn " - . \n" \
192 ".previous \n");
193#else
194#define ___define_initcall(fn, id, __sec) \
171 static initcall_t __initcall_##fn##id __used \ 195 static initcall_t __initcall_##fn##id __used \
172 __attribute__((__section__(".initcall" #id ".init"))) = fn; 196 __attribute__((__section__(#__sec ".init"))) = fn;
197#endif
198
199#define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
173 200
174/* 201/*
175 * Early initcalls run before initializing SMP. 202 * Early initcalls run before initializing SMP.
@@ -208,13 +235,8 @@ extern bool initcall_debug;
208#define __exitcall(fn) \ 235#define __exitcall(fn) \
209 static exitcall_t __exitcall_##fn __exit_call = fn 236 static exitcall_t __exitcall_##fn __exit_call = fn
210 237
211#define console_initcall(fn) \ 238#define console_initcall(fn) ___define_initcall(fn,, .con_initcall)
212 static initcall_t __initcall_##fn \ 239#define security_initcall(fn) ___define_initcall(fn,, .security_initcall)
213 __used __section(.con_initcall.init) = fn
214
215#define security_initcall(fn) \
216 static initcall_t __initcall_##fn \
217 __used __section(.security_initcall.init) = fn
218 240
219struct obs_kernel_param { 241struct obs_kernel_param {
220 const char *str; 242 const char *str;
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index a454b8aeb938..a7083a45a26c 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -46,15 +46,6 @@ extern struct cred init_cred;
46#define INIT_CPU_TIMERS(s) 46#define INIT_CPU_TIMERS(s)
47#endif 47#endif
48 48
49#define INIT_PID_LINK(type) \
50{ \
51 .node = { \
52 .next = NULL, \
53 .pprev = NULL, \
54 }, \
55 .pid = &init_struct_pid, \
56}
57
58#define INIT_TASK_COMM "swapper" 49#define INIT_TASK_COMM "swapper"
59 50
60/* Attach to the init_task data structure for proper alignment */ 51/* Attach to the init_task data structure for proper alignment */
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 44f9ffe72c87..6a24905f6e1e 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -18,6 +18,6 @@ extern struct ctl_table inotify_table[]; /* for sysctl */
18 IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | \ 18 IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | \
19 IN_Q_OVERFLOW | IN_IGNORED | IN_ONLYDIR | \ 19 IN_Q_OVERFLOW | IN_IGNORED | IN_ONLYDIR | \
20 IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \ 20 IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \
21 IN_ISDIR | IN_ONESHOT) 21 IN_MASK_CREATE | IN_ISDIR | IN_ONESHOT)
22 22
23#endif /* _LINUX_INOTIFY_H */ 23#endif /* _LINUX_INOTIFY_H */
diff --git a/include/linux/integrity.h b/include/linux/integrity.h
index 858d3f4a2241..54c853ec2fd1 100644
--- a/include/linux/integrity.h
+++ b/include/linux/integrity.h
@@ -44,4 +44,17 @@ static inline void integrity_load_keys(void)
44} 44}
45#endif /* CONFIG_INTEGRITY */ 45#endif /* CONFIG_INTEGRITY */
46 46
47#ifdef CONFIG_INTEGRITY_ASYMMETRIC_KEYS
48
49extern int integrity_kernel_module_request(char *kmod_name);
50
51#else
52
53static inline int integrity_kernel_module_request(char *kmod_name)
54{
55 return 0;
56}
57
58#endif /* CONFIG_INTEGRITY_ASYMMETRIC_KEYS */
59
47#endif /* _LINUX_INTEGRITY_H */ 60#endif /* _LINUX_INTEGRITY_H */
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index ef169d67df92..28004d74ae04 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -31,6 +31,7 @@
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/iommu.h> 32#include <linux/iommu.h>
33#include <linux/io-64-nonatomic-lo-hi.h> 33#include <linux/io-64-nonatomic-lo-hi.h>
34#include <linux/dmar.h>
34 35
35#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
36#include <asm/iommu.h> 37#include <asm/iommu.h>
@@ -114,6 +115,7 @@
114 * Extended Capability Register 115 * Extended Capability Register
115 */ 116 */
116 117
118#define ecap_dit(e) ((e >> 41) & 0x1)
117#define ecap_pasid(e) ((e >> 40) & 0x1) 119#define ecap_pasid(e) ((e >> 40) & 0x1)
118#define ecap_pss(e) ((e >> 35) & 0x1f) 120#define ecap_pss(e) ((e >> 35) & 0x1f)
119#define ecap_eafs(e) ((e >> 34) & 0x1) 121#define ecap_eafs(e) ((e >> 34) & 0x1)
@@ -284,6 +286,7 @@ enum {
284#define QI_DEV_IOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32) 286#define QI_DEV_IOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32)
285#define QI_DEV_IOTLB_QDEP(qdep) (((qdep) & 0x1f) << 16) 287#define QI_DEV_IOTLB_QDEP(qdep) (((qdep) & 0x1f) << 16)
286#define QI_DEV_IOTLB_ADDR(addr) ((u64)(addr) & VTD_PAGE_MASK) 288#define QI_DEV_IOTLB_ADDR(addr) ((u64)(addr) & VTD_PAGE_MASK)
289#define QI_DEV_IOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52))
287#define QI_DEV_IOTLB_SIZE 1 290#define QI_DEV_IOTLB_SIZE 1
288#define QI_DEV_IOTLB_MAX_INVS 32 291#define QI_DEV_IOTLB_MAX_INVS 32
289 292
@@ -308,6 +311,7 @@ enum {
308#define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32) 311#define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32)
309#define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16) 312#define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16)
310#define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4) 313#define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4)
314#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52))
311#define QI_DEV_EIOTLB_MAX_INVS 32 315#define QI_DEV_EIOTLB_MAX_INVS 32
312 316
313#define QI_PGRP_IDX(idx) (((u64)(idx)) << 55) 317#define QI_PGRP_IDX(idx) (((u64)(idx)) << 55)
@@ -385,6 +389,42 @@ struct pasid_entry;
385struct pasid_state_entry; 389struct pasid_state_entry;
386struct page_req_dsc; 390struct page_req_dsc;
387 391
392struct dmar_domain {
393 int nid; /* node id */
394
395 unsigned iommu_refcnt[DMAR_UNITS_SUPPORTED];
396 /* Refcount of devices per iommu */
397
398
399 u16 iommu_did[DMAR_UNITS_SUPPORTED];
400 /* Domain ids per IOMMU. Use u16 since
401 * domain ids are 16 bit wide according
402 * to VT-d spec, section 9.3 */
403
404 bool has_iotlb_device;
405 struct list_head devices; /* all devices' list */
406 struct iova_domain iovad; /* iova's that belong to this domain */
407
408 struct dma_pte *pgd; /* virtual address */
409 int gaw; /* max guest address width */
410
411 /* adjusted guest address width, 0 is level 2 30-bit */
412 int agaw;
413
414 int flags; /* flags to find out type of domain */
415
416 int iommu_coherency;/* indicate coherency of iommu access */
417 int iommu_snooping; /* indicate snooping control feature*/
418 int iommu_count; /* reference count of iommu */
419 int iommu_superpage;/* Level of superpages supported:
420 0 == 4KiB (no superpages), 1 == 2MiB,
421 2 == 1GiB, 3 == 512GiB, 4 == 1TiB */
422 u64 max_addr; /* maximum mapped address */
423
424 struct iommu_domain domain; /* generic domain data structure for
425 iommu core */
426};
427
388struct intel_iommu { 428struct intel_iommu {
389 void __iomem *reg; /* Pointer to hardware regs, virtual addr */ 429 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
390 u64 reg_phys; /* physical address of hw register set */ 430 u64 reg_phys; /* physical address of hw register set */
@@ -414,11 +454,9 @@ struct intel_iommu {
414 * devices away to userspace processes (e.g. for DPDK) and don't 454 * devices away to userspace processes (e.g. for DPDK) and don't
415 * want to trust that userspace will use *only* the PASID it was 455 * want to trust that userspace will use *only* the PASID it was
416 * told to. But while it's all driver-arbitrated, we're fine. */ 456 * told to. But while it's all driver-arbitrated, we're fine. */
417 struct pasid_entry *pasid_table;
418 struct pasid_state_entry *pasid_state_table; 457 struct pasid_state_entry *pasid_state_table;
419 struct page_req_dsc *prq; 458 struct page_req_dsc *prq;
420 unsigned char prq_name[16]; /* Name for PRQ interrupt */ 459 unsigned char prq_name[16]; /* Name for PRQ interrupt */
421 struct idr pasid_idr;
422 u32 pasid_max; 460 u32 pasid_max;
423#endif 461#endif
424 struct q_inval *qi; /* Queued invalidation info */ 462 struct q_inval *qi; /* Queued invalidation info */
@@ -434,6 +472,27 @@ struct intel_iommu {
434 u32 flags; /* Software defined flags */ 472 u32 flags; /* Software defined flags */
435}; 473};
436 474
475/* PCI domain-device relationship */
476struct device_domain_info {
477 struct list_head link; /* link to domain siblings */
478 struct list_head global; /* link to global list */
479 struct list_head table; /* link to pasid table */
480 u8 bus; /* PCI bus number */
481 u8 devfn; /* PCI devfn number */
482 u16 pfsid; /* SRIOV physical function source ID */
483 u8 pasid_supported:3;
484 u8 pasid_enabled:1;
485 u8 pri_supported:1;
486 u8 pri_enabled:1;
487 u8 ats_supported:1;
488 u8 ats_enabled:1;
489 u8 ats_qdep;
490 struct device *dev; /* it's NULL for PCIe-to-PCI bridge */
491 struct intel_iommu *iommu; /* IOMMU used by this device */
492 struct dmar_domain *domain; /* pointer to domain */
493 struct pasid_table *pasid_table; /* pasid table */
494};
495
437static inline void __iommu_flush_cache( 496static inline void __iommu_flush_cache(
438 struct intel_iommu *iommu, void *addr, int size) 497 struct intel_iommu *iommu, void *addr, int size)
439{ 498{
@@ -453,16 +512,22 @@ extern void qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid,
453 u8 fm, u64 type); 512 u8 fm, u64 type);
454extern void qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, 513extern void qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
455 unsigned int size_order, u64 type); 514 unsigned int size_order, u64 type);
456extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep, 515extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid,
457 u64 addr, unsigned mask); 516 u16 qdep, u64 addr, unsigned mask);
458
459extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 517extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
460 518
461extern int dmar_ir_support(void); 519extern int dmar_ir_support(void);
462 520
521struct dmar_domain *get_valid_domain_for_dev(struct device *dev);
522void *alloc_pgtable_page(int node);
523void free_pgtable_page(void *vaddr);
524struct intel_iommu *domain_get_iommu(struct dmar_domain *domain);
525int for_each_device_domain(int (*fn)(struct device_domain_info *info,
526 void *data), void *data);
527
463#ifdef CONFIG_INTEL_IOMMU_SVM 528#ifdef CONFIG_INTEL_IOMMU_SVM
464extern int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu); 529int intel_svm_init(struct intel_iommu *iommu);
465extern int intel_svm_free_pasid_tables(struct intel_iommu *iommu); 530int intel_svm_exit(struct intel_iommu *iommu);
466extern int intel_svm_enable_prq(struct intel_iommu *iommu); 531extern int intel_svm_enable_prq(struct intel_iommu *iommu);
467extern int intel_svm_finish_prq(struct intel_iommu *iommu); 532extern int intel_svm_finish_prq(struct intel_iommu *iommu);
468 533
@@ -486,6 +551,7 @@ struct intel_svm {
486 int flags; 551 int flags;
487 int pasid; 552 int pasid;
488 struct list_head devs; 553 struct list_head devs;
554 struct list_head list;
489}; 555};
490 556
491extern int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sdev); 557extern int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sdev);
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index a044a824da85..3555d54bf79a 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -2,6 +2,9 @@
2#ifndef LINUX_IOMAP_H 2#ifndef LINUX_IOMAP_H
3#define LINUX_IOMAP_H 1 3#define LINUX_IOMAP_H 1
4 4
5#include <linux/atomic.h>
6#include <linux/bitmap.h>
7#include <linux/mm.h>
5#include <linux/types.h> 8#include <linux/types.h>
6 9
7struct address_space; 10struct address_space;
@@ -9,6 +12,7 @@ struct fiemap_extent_info;
9struct inode; 12struct inode;
10struct iov_iter; 13struct iov_iter;
11struct kiocb; 14struct kiocb;
15struct page;
12struct vm_area_struct; 16struct vm_area_struct;
13struct vm_fault; 17struct vm_fault;
14 18
@@ -29,6 +33,7 @@ struct vm_fault;
29 */ 33 */
30#define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ 34#define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */
31#define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ 35#define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */
36#define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */
32 37
33/* 38/*
34 * Flags that only need to be reported for IOMAP_REPORT requests: 39 * Flags that only need to be reported for IOMAP_REPORT requests:
@@ -55,6 +60,16 @@ struct iomap {
55 u16 flags; /* flags for mapping */ 60 u16 flags; /* flags for mapping */
56 struct block_device *bdev; /* block device for I/O */ 61 struct block_device *bdev; /* block device for I/O */
57 struct dax_device *dax_dev; /* dax_dev for dax operations */ 62 struct dax_device *dax_dev; /* dax_dev for dax operations */
63 void *inline_data;
64 void *private; /* filesystem private */
65
66 /*
67 * Called when finished processing a page in the mapping returned in
68 * this iomap. At least for now this is only supported in the buffered
69 * write path.
70 */
71 void (*page_done)(struct inode *inode, loff_t pos, unsigned copied,
72 struct page *page, struct iomap *iomap);
58}; 73};
59 74
60/* 75/*
@@ -86,8 +101,40 @@ struct iomap_ops {
86 ssize_t written, unsigned flags, struct iomap *iomap); 101 ssize_t written, unsigned flags, struct iomap *iomap);
87}; 102};
88 103
104/*
105 * Structure allocate for each page when block size < PAGE_SIZE to track
106 * sub-page uptodate status and I/O completions.
107 */
108struct iomap_page {
109 atomic_t read_count;
110 atomic_t write_count;
111 DECLARE_BITMAP(uptodate, PAGE_SIZE / 512);
112};
113
114static inline struct iomap_page *to_iomap_page(struct page *page)
115{
116 if (page_has_private(page))
117 return (struct iomap_page *)page_private(page);
118 return NULL;
119}
120
89ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from, 121ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
90 const struct iomap_ops *ops); 122 const struct iomap_ops *ops);
123int iomap_readpage(struct page *page, const struct iomap_ops *ops);
124int iomap_readpages(struct address_space *mapping, struct list_head *pages,
125 unsigned nr_pages, const struct iomap_ops *ops);
126int iomap_set_page_dirty(struct page *page);
127int iomap_is_partially_uptodate(struct page *page, unsigned long from,
128 unsigned long count);
129int iomap_releasepage(struct page *page, gfp_t gfp_mask);
130void iomap_invalidatepage(struct page *page, unsigned int offset,
131 unsigned int len);
132#ifdef CONFIG_MIGRATION
133int iomap_migrate_page(struct address_space *mapping, struct page *newpage,
134 struct page *page, enum migrate_mode mode);
135#else
136#define iomap_migrate_page NULL
137#endif
91int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, 138int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len,
92 const struct iomap_ops *ops); 139 const struct iomap_ops *ops);
93int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, 140int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len,
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 19938ee6eb31..87994c265bf5 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -166,8 +166,6 @@ struct iommu_resv_region {
166 * @detach_dev: detach device from an iommu domain 166 * @detach_dev: detach device from an iommu domain
167 * @map: map a physically contiguous memory region to an iommu domain 167 * @map: map a physically contiguous memory region to an iommu domain
168 * @unmap: unmap a physically contiguous memory region from an iommu domain 168 * @unmap: unmap a physically contiguous memory region from an iommu domain
169 * @map_sg: map a scatter-gather list of physically contiguous memory chunks
170 * to an iommu domain
171 * @flush_tlb_all: Synchronously flush all hardware TLBs for this domain 169 * @flush_tlb_all: Synchronously flush all hardware TLBs for this domain
172 * @tlb_range_add: Add a given iova range to the flush queue for this domain 170 * @tlb_range_add: Add a given iova range to the flush queue for this domain
173 * @tlb_sync: Flush all queued ranges from the hardware TLBs and empty flush 171 * @tlb_sync: Flush all queued ranges from the hardware TLBs and empty flush
@@ -201,8 +199,6 @@ struct iommu_ops {
201 phys_addr_t paddr, size_t size, int prot); 199 phys_addr_t paddr, size_t size, int prot);
202 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 200 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
203 size_t size); 201 size_t size);
204 size_t (*map_sg)(struct iommu_domain *domain, unsigned long iova,
205 struct scatterlist *sg, unsigned int nents, int prot);
206 void (*flush_iotlb_all)(struct iommu_domain *domain); 202 void (*flush_iotlb_all)(struct iommu_domain *domain);
207 void (*iotlb_range_add)(struct iommu_domain *domain, 203 void (*iotlb_range_add)(struct iommu_domain *domain,
208 unsigned long iova, size_t size); 204 unsigned long iova, size_t size);
@@ -303,9 +299,8 @@ extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
303 size_t size); 299 size_t size);
304extern size_t iommu_unmap_fast(struct iommu_domain *domain, 300extern size_t iommu_unmap_fast(struct iommu_domain *domain,
305 unsigned long iova, size_t size); 301 unsigned long iova, size_t size);
306extern size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova, 302extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
307 struct scatterlist *sg,unsigned int nents, 303 struct scatterlist *sg,unsigned int nents, int prot);
308 int prot);
309extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); 304extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
310extern void iommu_set_fault_handler(struct iommu_domain *domain, 305extern void iommu_set_fault_handler(struct iommu_domain *domain,
311 iommu_fault_handler_t handler, void *token); 306 iommu_fault_handler_t handler, void *token);
@@ -378,13 +373,6 @@ static inline void iommu_tlb_sync(struct iommu_domain *domain)
378 domain->ops->iotlb_sync(domain); 373 domain->ops->iotlb_sync(domain);
379} 374}
380 375
381static inline size_t iommu_map_sg(struct iommu_domain *domain,
382 unsigned long iova, struct scatterlist *sg,
383 unsigned int nents, int prot)
384{
385 return domain->ops->map_sg(domain, iova, sg, nents, prot);
386}
387
388/* PCI device grouping function */ 376/* PCI device grouping function */
389extern struct iommu_group *pci_device_group(struct device *dev); 377extern struct iommu_group *pci_device_group(struct device *dev);
390/* Generic device grouping function */ 378/* Generic device grouping function */
@@ -698,4 +686,11 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
698 686
699#endif /* CONFIG_IOMMU_API */ 687#endif /* CONFIG_IOMMU_API */
700 688
689#ifdef CONFIG_IOMMU_DEBUGFS
690extern struct dentry *iommu_debugfs_dir;
691void iommu_debugfs_setup(void);
692#else
693static inline void iommu_debugfs_setup(void) {}
694#endif
695
701#endif /* __LINUX_IOMMU_H */ 696#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 6cc2df7f7ac9..e1c9eea6015b 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -4,7 +4,7 @@
4 4
5#include <linux/spinlock.h> 5#include <linux/spinlock.h>
6#include <linux/uidgid.h> 6#include <linux/uidgid.h>
7#include <linux/rhashtable.h> 7#include <linux/rhashtable-types.h>
8#include <uapi/linux/ipc.h> 8#include <uapi/linux/ipc.h>
9#include <linux/refcount.h> 9#include <linux/refcount.h>
10 10
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index b5630c8eb2f3..6ab8c1bada3f 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -9,17 +9,16 @@
9#include <linux/nsproxy.h> 9#include <linux/nsproxy.h>
10#include <linux/ns_common.h> 10#include <linux/ns_common.h>
11#include <linux/refcount.h> 11#include <linux/refcount.h>
12#include <linux/rhashtable.h> 12#include <linux/rhashtable-types.h>
13 13
14struct user_namespace; 14struct user_namespace;
15 15
16struct ipc_ids { 16struct ipc_ids {
17 int in_use; 17 int in_use;
18 unsigned short seq; 18 unsigned short seq;
19 bool tables_initialized;
20 struct rw_semaphore rwsem; 19 struct rw_semaphore rwsem;
21 struct idr ipcs_idr; 20 struct idr ipcs_idr;
22 int max_id; 21 int max_idx;
23#ifdef CONFIG_CHECKPOINT_RESTORE 22#ifdef CONFIG_CHECKPOINT_RESTORE
24 int next_id; 23 int next_id;
25#endif 24#endif
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
index 9d2ea3e907d0..8bdbb5f29494 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -61,6 +61,16 @@
61#define GICD_CTLR_ENABLE_G1A (1U << 1) 61#define GICD_CTLR_ENABLE_G1A (1U << 1)
62#define GICD_CTLR_ENABLE_G1 (1U << 0) 62#define GICD_CTLR_ENABLE_G1 (1U << 0)
63 63
64#define GICD_IIDR_IMPLEMENTER_SHIFT 0
65#define GICD_IIDR_IMPLEMENTER_MASK (0xfff << GICD_IIDR_IMPLEMENTER_SHIFT)
66#define GICD_IIDR_REVISION_SHIFT 12
67#define GICD_IIDR_REVISION_MASK (0xf << GICD_IIDR_REVISION_SHIFT)
68#define GICD_IIDR_VARIANT_SHIFT 16
69#define GICD_IIDR_VARIANT_MASK (0xf << GICD_IIDR_VARIANT_SHIFT)
70#define GICD_IIDR_PRODUCT_ID_SHIFT 24
71#define GICD_IIDR_PRODUCT_ID_MASK (0xff << GICD_IIDR_PRODUCT_ID_SHIFT)
72
73
64/* 74/*
65 * In systems with a single security state (what we emulate in KVM) 75 * In systems with a single security state (what we emulate in KVM)
66 * the meaning of the interrupt group enable bits is slightly different 76 * the meaning of the interrupt group enable bits is slightly different
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 68d8b1f73682..6c4aaf04046c 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -71,6 +71,16 @@
71 (GICD_INT_DEF_PRI << 8) |\ 71 (GICD_INT_DEF_PRI << 8) |\
72 GICD_INT_DEF_PRI) 72 GICD_INT_DEF_PRI)
73 73
74#define GICD_IIDR_IMPLEMENTER_SHIFT 0
75#define GICD_IIDR_IMPLEMENTER_MASK (0xfff << GICD_IIDR_IMPLEMENTER_SHIFT)
76#define GICD_IIDR_REVISION_SHIFT 12
77#define GICD_IIDR_REVISION_MASK (0xf << GICD_IIDR_REVISION_SHIFT)
78#define GICD_IIDR_VARIANT_SHIFT 16
79#define GICD_IIDR_VARIANT_MASK (0xf << GICD_IIDR_VARIANT_SHIFT)
80#define GICD_IIDR_PRODUCT_ID_SHIFT 24
81#define GICD_IIDR_PRODUCT_ID_MASK (0xff << GICD_IIDR_PRODUCT_ID_SHIFT)
82
83
74#define GICH_HCR 0x0 84#define GICH_HCR 0x0
75#define GICH_VTR 0x4 85#define GICH_VTR 0x4
76#define GICH_VMCR 0x8 86#define GICH_VMCR 0x8
@@ -94,6 +104,7 @@
94#define GICH_LR_PENDING_BIT (1 << 28) 104#define GICH_LR_PENDING_BIT (1 << 28)
95#define GICH_LR_ACTIVE_BIT (1 << 29) 105#define GICH_LR_ACTIVE_BIT (1 << 29)
96#define GICH_LR_EOI (1 << 19) 106#define GICH_LR_EOI (1 << 19)
107#define GICH_LR_GROUP1 (1 << 30)
97#define GICH_LR_HW (1 << 31) 108#define GICH_LR_HW (1 << 31)
98 109
99#define GICH_VMCR_ENABLE_GRP0_SHIFT 0 110#define GICH_VMCR_ENABLE_GRP0_SHIFT 0
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index 9700f00bbc04..21619c92c377 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -15,9 +15,20 @@
15#include <linux/typecheck.h> 15#include <linux/typecheck.h>
16#include <asm/irqflags.h> 16#include <asm/irqflags.h>
17 17
18#ifdef CONFIG_TRACE_IRQFLAGS 18/* Currently trace_softirqs_on/off is used only by lockdep */
19#ifdef CONFIG_PROVE_LOCKING
19 extern void trace_softirqs_on(unsigned long ip); 20 extern void trace_softirqs_on(unsigned long ip);
20 extern void trace_softirqs_off(unsigned long ip); 21 extern void trace_softirqs_off(unsigned long ip);
22 extern void lockdep_hardirqs_on(unsigned long ip);
23 extern void lockdep_hardirqs_off(unsigned long ip);
24#else
25 static inline void trace_softirqs_on(unsigned long ip) { }
26 static inline void trace_softirqs_off(unsigned long ip) { }
27 static inline void lockdep_hardirqs_on(unsigned long ip) { }
28 static inline void lockdep_hardirqs_off(unsigned long ip) { }
29#endif
30
31#ifdef CONFIG_TRACE_IRQFLAGS
21 extern void trace_hardirqs_on(void); 32 extern void trace_hardirqs_on(void);
22 extern void trace_hardirqs_off(void); 33 extern void trace_hardirqs_off(void);
23# define trace_hardirq_context(p) ((p)->hardirq_context) 34# define trace_hardirq_context(p) ((p)->hardirq_context)
@@ -43,8 +54,6 @@ do { \
43#else 54#else
44# define trace_hardirqs_on() do { } while (0) 55# define trace_hardirqs_on() do { } while (0)
45# define trace_hardirqs_off() do { } while (0) 56# define trace_hardirqs_off() do { } while (0)
46# define trace_softirqs_on(ip) do { } while (0)
47# define trace_softirqs_off(ip) do { } while (0)
48# define trace_hardirq_context(p) 0 57# define trace_hardirq_context(p) 0
49# define trace_softirq_context(p) 0 58# define trace_softirq_context(p) 0
50# define trace_hardirqs_enabled(p) 0 59# define trace_hardirqs_enabled(p) 0
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index a27cf6652327..fa928242567d 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -447,6 +447,11 @@ static inline clock_t jiffies_delta_to_clock_t(long delta)
447 return jiffies_to_clock_t(max(0L, delta)); 447 return jiffies_to_clock_t(max(0L, delta));
448} 448}
449 449
450static inline unsigned int jiffies_delta_to_msecs(long delta)
451{
452 return jiffies_to_msecs(max(0L, delta));
453}
454
450extern unsigned long clock_t_to_jiffies(unsigned long x); 455extern unsigned long clock_t_to_jiffies(unsigned long x);
451extern u64 jiffies_64_to_clock_t(u64 x); 456extern u64 jiffies_64_to_clock_t(u64 x);
452extern u64 nsec_to_clock_t(u64 x); 457extern u64 nsec_to_clock_t(u64 x);
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index cbf2aa9e93b9..5153f5b9294c 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -17,10 +17,6 @@
17 * You should have received a copy of the GNU General Public License 17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Should you need to contact me, the author, you can do so either by
22 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
23 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
24 */ 20 */
25#ifndef _LINUX_JOYSTICK_H 21#ifndef _LINUX_JOYSTICK_H
26#define _LINUX_JOYSTICK_H 22#define _LINUX_JOYSTICK_H
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index b46b541c67c4..1a0b6f17a5d6 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -299,12 +299,18 @@ struct static_key_false {
299#define DEFINE_STATIC_KEY_TRUE(name) \ 299#define DEFINE_STATIC_KEY_TRUE(name) \
300 struct static_key_true name = STATIC_KEY_TRUE_INIT 300 struct static_key_true name = STATIC_KEY_TRUE_INIT
301 301
302#define DEFINE_STATIC_KEY_TRUE_RO(name) \
303 struct static_key_true name __ro_after_init = STATIC_KEY_TRUE_INIT
304
302#define DECLARE_STATIC_KEY_TRUE(name) \ 305#define DECLARE_STATIC_KEY_TRUE(name) \
303 extern struct static_key_true name 306 extern struct static_key_true name
304 307
305#define DEFINE_STATIC_KEY_FALSE(name) \ 308#define DEFINE_STATIC_KEY_FALSE(name) \
306 struct static_key_false name = STATIC_KEY_FALSE_INIT 309 struct static_key_false name = STATIC_KEY_FALSE_INIT
307 310
311#define DEFINE_STATIC_KEY_FALSE_RO(name) \
312 struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT
313
308#define DECLARE_STATIC_KEY_FALSE(name) \ 314#define DECLARE_STATIC_KEY_FALSE(name) \
309 extern struct static_key_false name 315 extern struct static_key_false name
310 316
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index de784fd11d12..46aae129917c 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -20,7 +20,7 @@ extern pmd_t kasan_zero_pmd[PTRS_PER_PMD];
20extern pud_t kasan_zero_pud[PTRS_PER_PUD]; 20extern pud_t kasan_zero_pud[PTRS_PER_PUD];
21extern p4d_t kasan_zero_p4d[MAX_PTRS_PER_P4D]; 21extern p4d_t kasan_zero_p4d[MAX_PTRS_PER_P4D];
22 22
23void kasan_populate_zero_shadow(const void *shadow_start, 23int kasan_populate_zero_shadow(const void *shadow_start,
24 const void *shadow_end); 24 const void *shadow_end);
25 25
26static inline void *kasan_mem_to_shadow(const void *addr) 26static inline void *kasan_mem_to_shadow(const void *addr)
@@ -71,6 +71,9 @@ struct kasan_cache {
71int kasan_module_alloc(void *addr, size_t size); 71int kasan_module_alloc(void *addr, size_t size);
72void kasan_free_shadow(const struct vm_struct *vm); 72void kasan_free_shadow(const struct vm_struct *vm);
73 73
74int kasan_add_zero_shadow(void *start, unsigned long size);
75void kasan_remove_zero_shadow(void *start, unsigned long size);
76
74size_t ksize(const void *); 77size_t ksize(const void *);
75static inline void kasan_unpoison_slab(const void *ptr) { ksize(ptr); } 78static inline void kasan_unpoison_slab(const void *ptr) { ksize(ptr); }
76size_t kasan_metadata_size(struct kmem_cache *cache); 79size_t kasan_metadata_size(struct kmem_cache *cache);
@@ -124,6 +127,14 @@ static inline bool kasan_slab_free(struct kmem_cache *s, void *object,
124static inline int kasan_module_alloc(void *addr, size_t size) { return 0; } 127static inline int kasan_module_alloc(void *addr, size_t size) { return 0; }
125static inline void kasan_free_shadow(const struct vm_struct *vm) {} 128static inline void kasan_free_shadow(const struct vm_struct *vm) {}
126 129
130static inline int kasan_add_zero_shadow(void *start, unsigned long size)
131{
132 return 0;
133}
134static inline void kasan_remove_zero_shadow(void *start,
135 unsigned long size)
136{}
137
127static inline void kasan_unpoison_slab(const void *ptr) { } 138static inline void kasan_unpoison_slab(const void *ptr) { }
128static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; } 139static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; }
129 140
diff --git a/include/linux/kcore.h b/include/linux/kcore.h
index bc088ef96358..8c3f8c14eeaa 100644
--- a/include/linux/kcore.h
+++ b/include/linux/kcore.h
@@ -37,7 +37,7 @@ struct vmcoredd_node {
37}; 37};
38 38
39#ifdef CONFIG_PROC_KCORE 39#ifdef CONFIG_PROC_KCORE
40extern void kclist_add(struct kcore_list *, void *, size_t, int type); 40void __init kclist_add(struct kcore_list *, void *, size_t, int type);
41static inline 41static inline
42void kclist_add_remap(struct kcore_list *m, void *addr, void *vaddr, size_t sz) 42void kclist_add_remap(struct kcore_list *m, void *addr, void *vaddr, size_t sz)
43{ 43{
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 941dc0a5a877..d6aac75b51ba 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -85,7 +85,23 @@
85 * arguments just once each. 85 * arguments just once each.
86 */ 86 */
87#define __round_mask(x, y) ((__typeof__(x))((y)-1)) 87#define __round_mask(x, y) ((__typeof__(x))((y)-1))
88/**
89 * round_up - round up to next specified power of 2
90 * @x: the value to round
91 * @y: multiple to round up to (must be a power of 2)
92 *
93 * Rounds @x up to next multiple of @y (which must be a power of 2).
94 * To perform arbitrary rounding up, use roundup() below.
95 */
88#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) 96#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
97/**
98 * round_down - round down to next specified power of 2
99 * @x: the value to round
100 * @y: multiple to round down to (must be a power of 2)
101 *
102 * Rounds @x down to next multiple of @y (which must be a power of 2).
103 * To perform arbitrary rounding down, use rounddown() below.
104 */
89#define round_down(x, y) ((x) & ~__round_mask(x, y)) 105#define round_down(x, y) ((x) & ~__round_mask(x, y))
90 106
91/** 107/**
@@ -110,13 +126,30 @@
110# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d) 126# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d)
111#endif 127#endif
112 128
113/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */ 129/**
130 * roundup - round up to the next specified multiple
131 * @x: the value to up
132 * @y: multiple to round up to
133 *
134 * Rounds @x up to next multiple of @y. If @y will always be a power
135 * of 2, consider using the faster round_up().
136 *
137 * The `const' here prevents gcc-3.3 from calling __divdi3
138 */
114#define roundup(x, y) ( \ 139#define roundup(x, y) ( \
115{ \ 140{ \
116 const typeof(y) __y = y; \ 141 const typeof(y) __y = y; \
117 (((x) + (__y - 1)) / __y) * __y; \ 142 (((x) + (__y - 1)) / __y) * __y; \
118} \ 143} \
119) 144)
145/**
146 * rounddown - round down to next specified multiple
147 * @x: the value to round
148 * @y: multiple to round down to
149 *
150 * Rounds @x down to next multiple of @y. If @y will always be a power
151 * of 2, consider using the faster round_down().
152 */
120#define rounddown(x, y) ( \ 153#define rounddown(x, y) ( \
121{ \ 154{ \
122 typeof(x) __x = (x); \ 155 typeof(x) __x = (x); \
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index ab25c8b6d9e3..814643f7ee52 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -15,6 +15,7 @@
15#include <linux/lockdep.h> 15#include <linux/lockdep.h>
16#include <linux/rbtree.h> 16#include <linux/rbtree.h>
17#include <linux/atomic.h> 17#include <linux/atomic.h>
18#include <linux/uidgid.h>
18#include <linux/wait.h> 19#include <linux/wait.h>
19 20
20struct file; 21struct file;
@@ -325,12 +326,14 @@ void kernfs_destroy_root(struct kernfs_root *root);
325 326
326struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, 327struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent,
327 const char *name, umode_t mode, 328 const char *name, umode_t mode,
329 kuid_t uid, kgid_t gid,
328 void *priv, const void *ns); 330 void *priv, const void *ns);
329struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, 331struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent,
330 const char *name); 332 const char *name);
331struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, 333struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent,
332 const char *name, 334 const char *name, umode_t mode,
333 umode_t mode, loff_t size, 335 kuid_t uid, kgid_t gid,
336 loff_t size,
334 const struct kernfs_ops *ops, 337 const struct kernfs_ops *ops,
335 void *priv, const void *ns, 338 void *priv, const void *ns,
336 struct lock_class_key *key); 339 struct lock_class_key *key);
@@ -415,12 +418,14 @@ static inline void kernfs_destroy_root(struct kernfs_root *root) { }
415 418
416static inline struct kernfs_node * 419static inline struct kernfs_node *
417kernfs_create_dir_ns(struct kernfs_node *parent, const char *name, 420kernfs_create_dir_ns(struct kernfs_node *parent, const char *name,
418 umode_t mode, void *priv, const void *ns) 421 umode_t mode, kuid_t uid, kgid_t gid,
422 void *priv, const void *ns)
419{ return ERR_PTR(-ENOSYS); } 423{ return ERR_PTR(-ENOSYS); }
420 424
421static inline struct kernfs_node * 425static inline struct kernfs_node *
422__kernfs_create_file(struct kernfs_node *parent, const char *name, 426__kernfs_create_file(struct kernfs_node *parent, const char *name,
423 umode_t mode, loff_t size, const struct kernfs_ops *ops, 427 umode_t mode, kuid_t uid, kgid_t gid,
428 loff_t size, const struct kernfs_ops *ops,
424 void *priv, const void *ns, struct lock_class_key *key) 429 void *priv, const void *ns, struct lock_class_key *key)
425{ return ERR_PTR(-ENOSYS); } 430{ return ERR_PTR(-ENOSYS); }
426 431
@@ -498,12 +503,15 @@ static inline struct kernfs_node *
498kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode, 503kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode,
499 void *priv) 504 void *priv)
500{ 505{
501 return kernfs_create_dir_ns(parent, name, mode, priv, NULL); 506 return kernfs_create_dir_ns(parent, name, mode,
507 GLOBAL_ROOT_UID, GLOBAL_ROOT_GID,
508 priv, NULL);
502} 509}
503 510
504static inline struct kernfs_node * 511static inline struct kernfs_node *
505kernfs_create_file_ns(struct kernfs_node *parent, const char *name, 512kernfs_create_file_ns(struct kernfs_node *parent, const char *name,
506 umode_t mode, loff_t size, const struct kernfs_ops *ops, 513 umode_t mode, kuid_t uid, kgid_t gid,
514 loff_t size, const struct kernfs_ops *ops,
507 void *priv, const void *ns) 515 void *priv, const void *ns)
508{ 516{
509 struct lock_class_key *key = NULL; 517 struct lock_class_key *key = NULL;
@@ -511,15 +519,17 @@ kernfs_create_file_ns(struct kernfs_node *parent, const char *name,
511#ifdef CONFIG_DEBUG_LOCK_ALLOC 519#ifdef CONFIG_DEBUG_LOCK_ALLOC
512 key = (struct lock_class_key *)&ops->lockdep_key; 520 key = (struct lock_class_key *)&ops->lockdep_key;
513#endif 521#endif
514 return __kernfs_create_file(parent, name, mode, size, ops, priv, ns, 522 return __kernfs_create_file(parent, name, mode, uid, gid,
515 key); 523 size, ops, priv, ns, key);
516} 524}
517 525
518static inline struct kernfs_node * 526static inline struct kernfs_node *
519kernfs_create_file(struct kernfs_node *parent, const char *name, umode_t mode, 527kernfs_create_file(struct kernfs_node *parent, const char *name, umode_t mode,
520 loff_t size, const struct kernfs_ops *ops, void *priv) 528 loff_t size, const struct kernfs_ops *ops, void *priv)
521{ 529{
522 return kernfs_create_file_ns(parent, name, mode, size, ops, priv, NULL); 530 return kernfs_create_file_ns(parent, name, mode,
531 GLOBAL_ROOT_UID, GLOBAL_ROOT_GID,
532 size, ops, priv, NULL);
523} 533}
524 534
525static inline int kernfs_remove_by_name(struct kernfs_node *parent, 535static inline int kernfs_remove_by_name(struct kernfs_node *parent,
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 7f6f93c3df9c..1ab0d624fb36 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -26,6 +26,7 @@
26#include <linux/wait.h> 26#include <linux/wait.h>
27#include <linux/atomic.h> 27#include <linux/atomic.h>
28#include <linux/workqueue.h> 28#include <linux/workqueue.h>
29#include <linux/uidgid.h>
29 30
30#define UEVENT_HELPER_PATH_LEN 256 31#define UEVENT_HELPER_PATH_LEN 256
31#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 32#define UEVENT_NUM_ENVP 32 /* number of env pointers */
@@ -114,14 +115,34 @@ extern struct kobject * __must_check kobject_get_unless_zero(
114extern void kobject_put(struct kobject *kobj); 115extern void kobject_put(struct kobject *kobj);
115 116
116extern const void *kobject_namespace(struct kobject *kobj); 117extern const void *kobject_namespace(struct kobject *kobj);
118extern void kobject_get_ownership(struct kobject *kobj,
119 kuid_t *uid, kgid_t *gid);
117extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); 120extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
118 121
122/**
123 * kobject_has_children - Returns whether a kobject has children.
124 * @kobj: the object to test
125 *
126 * This will return whether a kobject has other kobjects as children.
127 *
128 * It does NOT account for the presence of attribute files, only sub
129 * directories. It also assumes there is no concurrent addition or
130 * removal of such children, and thus relies on external locking.
131 */
132static inline bool kobject_has_children(struct kobject *kobj)
133{
134 WARN_ON_ONCE(kref_read(&kobj->kref) == 0);
135
136 return kobj->sd && kobj->sd->dir.subdirs;
137}
138
119struct kobj_type { 139struct kobj_type {
120 void (*release)(struct kobject *kobj); 140 void (*release)(struct kobject *kobj);
121 const struct sysfs_ops *sysfs_ops; 141 const struct sysfs_ops *sysfs_ops;
122 struct attribute **default_attrs; 142 struct attribute **default_attrs;
123 const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); 143 const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
124 const void *(*namespace)(struct kobject *kobj); 144 const void *(*namespace)(struct kobject *kobj);
145 void (*get_ownership)(struct kobject *kobj, kuid_t *uid, kgid_t *gid);
125}; 146};
126 147
127struct kobj_uevent_env { 148struct kobj_uevent_env {
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 4ee7bc548a83..0205aee44ded 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -130,7 +130,7 @@ static inline bool is_error_page(struct page *page)
130#define KVM_REQUEST_ARCH_BASE 8 130#define KVM_REQUEST_ARCH_BASE 8
131 131
132#define KVM_ARCH_REQ_FLAGS(nr, flags) ({ \ 132#define KVM_ARCH_REQ_FLAGS(nr, flags) ({ \
133 BUILD_BUG_ON((unsigned)(nr) >= 32 - KVM_REQUEST_ARCH_BASE); \ 133 BUILD_BUG_ON((unsigned)(nr) >= (FIELD_SIZEOF(struct kvm_vcpu, requests) * 8) - KVM_REQUEST_ARCH_BASE); \
134 (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \ 134 (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \
135}) 135})
136#define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0) 136#define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0)
@@ -224,7 +224,7 @@ struct kvm_vcpu {
224 int vcpu_id; 224 int vcpu_id;
225 int srcu_idx; 225 int srcu_idx;
226 int mode; 226 int mode;
227 unsigned long requests; 227 u64 requests;
228 unsigned long guest_debug; 228 unsigned long guest_debug;
229 229
230 int pre_pcpu; 230 int pre_pcpu;
@@ -309,6 +309,13 @@ static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memsl
309 return ALIGN(memslot->npages, BITS_PER_LONG) / 8; 309 return ALIGN(memslot->npages, BITS_PER_LONG) / 8;
310} 310}
311 311
312static inline unsigned long *kvm_second_dirty_bitmap(struct kvm_memory_slot *memslot)
313{
314 unsigned long len = kvm_dirty_bitmap_bytes(memslot);
315
316 return memslot->dirty_bitmap + len / sizeof(*memslot->dirty_bitmap);
317}
318
312struct kvm_s390_adapter_int { 319struct kvm_s390_adapter_int {
313 u64 ind_addr; 320 u64 ind_addr;
314 u64 summary_addr; 321 u64 summary_addr;
@@ -827,6 +834,13 @@ static inline void kvm_arch_free_vm(struct kvm *kvm)
827} 834}
828#endif 835#endif
829 836
837#ifndef __KVM_HAVE_ARCH_FLUSH_REMOTE_TLB
838static inline int kvm_arch_flush_remote_tlb(struct kvm *kvm)
839{
840 return -ENOTSUPP;
841}
842#endif
843
830#ifdef __KVM_HAVE_ARCH_NONCOHERENT_DMA 844#ifdef __KVM_HAVE_ARCH_NONCOHERENT_DMA
831void kvm_arch_register_noncoherent_dma(struct kvm *kvm); 845void kvm_arch_register_noncoherent_dma(struct kvm *kvm);
832void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm); 846void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm);
@@ -1124,7 +1138,7 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
1124 * caller. Paired with the smp_mb__after_atomic in kvm_check_request. 1138 * caller. Paired with the smp_mb__after_atomic in kvm_check_request.
1125 */ 1139 */
1126 smp_wmb(); 1140 smp_wmb();
1127 set_bit(req & KVM_REQUEST_MASK, &vcpu->requests); 1141 set_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->requests);
1128} 1142}
1129 1143
1130static inline bool kvm_request_pending(struct kvm_vcpu *vcpu) 1144static inline bool kvm_request_pending(struct kvm_vcpu *vcpu)
@@ -1134,12 +1148,12 @@ static inline bool kvm_request_pending(struct kvm_vcpu *vcpu)
1134 1148
1135static inline bool kvm_test_request(int req, struct kvm_vcpu *vcpu) 1149static inline bool kvm_test_request(int req, struct kvm_vcpu *vcpu)
1136{ 1150{
1137 return test_bit(req & KVM_REQUEST_MASK, &vcpu->requests); 1151 return test_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->requests);
1138} 1152}
1139 1153
1140static inline void kvm_clear_request(int req, struct kvm_vcpu *vcpu) 1154static inline void kvm_clear_request(int req, struct kvm_vcpu *vcpu)
1141{ 1155{
1142 clear_bit(req & KVM_REQUEST_MASK, &vcpu->requests); 1156 clear_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->requests);
1143} 1157}
1144 1158
1145static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) 1159static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
@@ -1275,8 +1289,8 @@ static inline long kvm_arch_vcpu_async_ioctl(struct file *filp,
1275} 1289}
1276#endif /* CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL */ 1290#endif /* CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL */
1277 1291
1278void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, 1292int kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm,
1279 unsigned long start, unsigned long end); 1293 unsigned long start, unsigned long end, bool blockable);
1280 1294
1281#ifdef CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE 1295#ifdef CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE
1282int kvm_arch_vcpu_run_pid_change(struct kvm_vcpu *vcpu); 1296int kvm_arch_vcpu_run_pid_change(struct kvm_vcpu *vcpu);
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b7e82550e655..834683d603f9 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -253,7 +253,7 @@ static inline bool led_sysfs_is_disabled(struct led_classdev *led_cdev)
253struct led_trigger { 253struct led_trigger {
254 /* Trigger Properties */ 254 /* Trigger Properties */
255 const char *name; 255 const char *name;
256 void (*activate)(struct led_classdev *led_cdev); 256 int (*activate)(struct led_classdev *led_cdev);
257 void (*deactivate)(struct led_classdev *led_cdev); 257 void (*deactivate)(struct led_classdev *led_cdev);
258 258
259 /* LEDs under control by this trigger (for simple triggers) */ 259 /* LEDs under control by this trigger (for simple triggers) */
@@ -262,8 +262,19 @@ struct led_trigger {
262 262
263 /* Link to next registered trigger */ 263 /* Link to next registered trigger */
264 struct list_head next_trig; 264 struct list_head next_trig;
265
266 const struct attribute_group **groups;
265}; 267};
266 268
269/*
270 * Currently the attributes in struct led_trigger::groups are added directly to
271 * the LED device. As this might change in the future, the following
272 * macros abstract getting the LED device and its trigger_data from the dev
273 * parameter passed to the attribute accessor functions.
274 */
275#define led_trigger_get_led(dev) ((struct led_classdev *)dev_get_drvdata((dev)))
276#define led_trigger_get_drvdata(dev) (led_get_trigger_data(led_trigger_get_led(dev)))
277
267ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, 278ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
268 const char *buf, size_t count); 279 const char *buf, size_t count);
269ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr, 280ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
@@ -288,10 +299,16 @@ extern void led_trigger_blink_oneshot(struct led_trigger *trigger,
288 unsigned long *delay_off, 299 unsigned long *delay_off,
289 int invert); 300 int invert);
290extern void led_trigger_set_default(struct led_classdev *led_cdev); 301extern void led_trigger_set_default(struct led_classdev *led_cdev);
291extern void led_trigger_set(struct led_classdev *led_cdev, 302extern int led_trigger_set(struct led_classdev *led_cdev,
292 struct led_trigger *trigger); 303 struct led_trigger *trigger);
293extern void led_trigger_remove(struct led_classdev *led_cdev); 304extern void led_trigger_remove(struct led_classdev *led_cdev);
294 305
306static inline void led_set_trigger_data(struct led_classdev *led_cdev,
307 void *trigger_data)
308{
309 led_cdev->trigger_data = trigger_data;
310}
311
295static inline void *led_get_trigger_data(struct led_classdev *led_cdev) 312static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
296{ 313{
297 return led_cdev->trigger_data; 314 return led_cdev->trigger_data;
@@ -315,6 +332,10 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
315extern void led_trigger_rename_static(const char *name, 332extern void led_trigger_rename_static(const char *name,
316 struct led_trigger *trig); 333 struct led_trigger *trig);
317 334
335#define module_led_trigger(__led_trigger) \
336 module_driver(__led_trigger, led_trigger_register, \
337 led_trigger_unregister)
338
318#else 339#else
319 340
320/* Trigger has no members */ 341/* Trigger has no members */
@@ -334,9 +355,14 @@ static inline void led_trigger_blink_oneshot(struct led_trigger *trigger,
334 unsigned long *delay_off, 355 unsigned long *delay_off,
335 int invert) {} 356 int invert) {}
336static inline void led_trigger_set_default(struct led_classdev *led_cdev) {} 357static inline void led_trigger_set_default(struct led_classdev *led_cdev) {}
337static inline void led_trigger_set(struct led_classdev *led_cdev, 358static inline int led_trigger_set(struct led_classdev *led_cdev,
338 struct led_trigger *trigger) {} 359 struct led_trigger *trigger)
360{
361 return 0;
362}
363
339static inline void led_trigger_remove(struct led_classdev *led_cdev) {} 364static inline void led_trigger_remove(struct led_classdev *led_cdev) {}
365static inline void led_set_trigger_data(struct led_classdev *led_cdev) {}
340static inline void *led_get_trigger_data(struct led_classdev *led_cdev) 366static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
341{ 367{
342 return NULL; 368 return NULL;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 32f247cb5e9e..38c95d66ab12 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -523,7 +523,8 @@ enum ata_lpm_policy {
523 ATA_LPM_MAX_POWER, 523 ATA_LPM_MAX_POWER,
524 ATA_LPM_MED_POWER, 524 ATA_LPM_MED_POWER,
525 ATA_LPM_MED_POWER_WITH_DIPM, /* Med power + DIPM as win IRST does */ 525 ATA_LPM_MED_POWER_WITH_DIPM, /* Med power + DIPM as win IRST does */
526 ATA_LPM_MIN_POWER, 526 ATA_LPM_MIN_POWER_WITH_PARTIAL, /* Min Power + partial and slumber */
527 ATA_LPM_MIN_POWER, /* Min power + no partial (slumber only) */
527}; 528};
528 529
529enum ata_lpm_hints { 530enum ata_lpm_hints {
@@ -1111,6 +1112,8 @@ extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
1111extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 1112extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
1112 const struct ata_port_info * const * ppi, int n_ports); 1113 const struct ata_port_info * const * ppi, int n_ports);
1113extern int ata_slave_link_init(struct ata_port *ap); 1114extern int ata_slave_link_init(struct ata_port *ap);
1115extern void ata_host_get(struct ata_host *host);
1116extern void ata_host_put(struct ata_host *host);
1114extern int ata_host_start(struct ata_host *host); 1117extern int ata_host_start(struct ata_host *host);
1115extern int ata_host_register(struct ata_host *host, 1118extern int ata_host_register(struct ata_host *host,
1116 struct scsi_host_template *sht); 1119 struct scsi_host_template *sht);
@@ -1856,8 +1859,6 @@ extern unsigned int ata_sff_data_xfer(struct ata_queued_cmd *qc,
1856 unsigned char *buf, unsigned int buflen, int rw); 1859 unsigned char *buf, unsigned int buflen, int rw);
1857extern unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, 1860extern unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc,
1858 unsigned char *buf, unsigned int buflen, int rw); 1861 unsigned char *buf, unsigned int buflen, int rw);
1859extern unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc,
1860 unsigned char *buf, unsigned int buflen, int rw);
1861extern void ata_sff_irq_on(struct ata_port *ap); 1862extern void ata_sff_irq_on(struct ata_port *ap);
1862extern void ata_sff_irq_clear(struct ata_port *ap); 1863extern void ata_sff_irq_clear(struct ata_port *ap);
1863extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, 1864extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
diff --git a/include/linux/list.h b/include/linux/list.h
index 4b129df4d46b..de04cc5ed536 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -285,6 +285,36 @@ static inline void list_cut_position(struct list_head *list,
285 __list_cut_position(list, head, entry); 285 __list_cut_position(list, head, entry);
286} 286}
287 287
288/**
289 * list_cut_before - cut a list into two, before given entry
290 * @list: a new list to add all removed entries
291 * @head: a list with entries
292 * @entry: an entry within head, could be the head itself
293 *
294 * This helper moves the initial part of @head, up to but
295 * excluding @entry, from @head to @list. You should pass
296 * in @entry an element you know is on @head. @list should
297 * be an empty list or a list you do not care about losing
298 * its data.
299 * If @entry == @head, all entries on @head are moved to
300 * @list.
301 */
302static inline void list_cut_before(struct list_head *list,
303 struct list_head *head,
304 struct list_head *entry)
305{
306 if (head->next == entry) {
307 INIT_LIST_HEAD(list);
308 return;
309 }
310 list->next = head->next;
311 list->next->prev = list;
312 list->prev = entry->prev;
313 list->prev->next = list;
314 head->next = entry;
315 entry->prev = head;
316}
317
288static inline void __list_splice(const struct list_head *list, 318static inline void __list_splice(const struct list_head *list,
289 struct list_head *prev, 319 struct list_head *prev,
290 struct list_head *next) 320 struct list_head *next)
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
index 96def9d15b1b..aa5efd9351eb 100644
--- a/include/linux/list_lru.h
+++ b/include/linux/list_lru.h
@@ -42,7 +42,7 @@ struct list_lru_node {
42 spinlock_t lock; 42 spinlock_t lock;
43 /* global list, used for the root cgroup in cgroup aware lrus */ 43 /* global list, used for the root cgroup in cgroup aware lrus */
44 struct list_lru_one lru; 44 struct list_lru_one lru;
45#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) 45#ifdef CONFIG_MEMCG_KMEM
46 /* for cgroup aware lrus points to per cgroup lists, otherwise NULL */ 46 /* for cgroup aware lrus points to per cgroup lists, otherwise NULL */
47 struct list_lru_memcg __rcu *memcg_lrus; 47 struct list_lru_memcg __rcu *memcg_lrus;
48#endif 48#endif
@@ -51,21 +51,25 @@ struct list_lru_node {
51 51
52struct list_lru { 52struct list_lru {
53 struct list_lru_node *node; 53 struct list_lru_node *node;
54#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) 54#ifdef CONFIG_MEMCG_KMEM
55 struct list_head list; 55 struct list_head list;
56 int shrinker_id;
56#endif 57#endif
57}; 58};
58 59
59void list_lru_destroy(struct list_lru *lru); 60void list_lru_destroy(struct list_lru *lru);
60int __list_lru_init(struct list_lru *lru, bool memcg_aware, 61int __list_lru_init(struct list_lru *lru, bool memcg_aware,
61 struct lock_class_key *key); 62 struct lock_class_key *key, struct shrinker *shrinker);
62 63
63#define list_lru_init(lru) __list_lru_init((lru), false, NULL) 64#define list_lru_init(lru) \
64#define list_lru_init_key(lru, key) __list_lru_init((lru), false, (key)) 65 __list_lru_init((lru), false, NULL, NULL)
65#define list_lru_init_memcg(lru) __list_lru_init((lru), true, NULL) 66#define list_lru_init_key(lru, key) \
67 __list_lru_init((lru), false, (key), NULL)
68#define list_lru_init_memcg(lru, shrinker) \
69 __list_lru_init((lru), true, NULL, shrinker)
66 70
67int memcg_update_all_list_lrus(int num_memcgs); 71int memcg_update_all_list_lrus(int num_memcgs);
68void memcg_drain_all_list_lrus(int src_idx, int dst_idx); 72void memcg_drain_all_list_lrus(int src_idx, struct mem_cgroup *dst_memcg);
69 73
70/** 74/**
71 * list_lru_add: add an element to the lru list's tail 75 * list_lru_add: add an element to the lru list's tail
@@ -162,6 +166,23 @@ unsigned long list_lru_walk_one(struct list_lru *lru,
162 int nid, struct mem_cgroup *memcg, 166 int nid, struct mem_cgroup *memcg,
163 list_lru_walk_cb isolate, void *cb_arg, 167 list_lru_walk_cb isolate, void *cb_arg,
164 unsigned long *nr_to_walk); 168 unsigned long *nr_to_walk);
169/**
170 * list_lru_walk_one_irq: walk a list_lru, isolating and disposing freeable items.
171 * @lru: the lru pointer.
172 * @nid: the node id to scan from.
173 * @memcg: the cgroup to scan from.
174 * @isolate: callback function that is resposible for deciding what to do with
175 * the item currently being scanned
176 * @cb_arg: opaque type that will be passed to @isolate
177 * @nr_to_walk: how many items to scan.
178 *
179 * Same as @list_lru_walk_one except that the spinlock is acquired with
180 * spin_lock_irq().
181 */
182unsigned long list_lru_walk_one_irq(struct list_lru *lru,
183 int nid, struct mem_cgroup *memcg,
184 list_lru_walk_cb isolate, void *cb_arg,
185 unsigned long *nr_to_walk);
165unsigned long list_lru_walk_node(struct list_lru *lru, int nid, 186unsigned long list_lru_walk_node(struct list_lru *lru, int nid,
166 list_lru_walk_cb isolate, void *cb_arg, 187 list_lru_walk_cb isolate, void *cb_arg,
167 unsigned long *nr_to_walk); 188 unsigned long *nr_to_walk);
@@ -175,6 +196,14 @@ list_lru_shrink_walk(struct list_lru *lru, struct shrink_control *sc,
175} 196}
176 197
177static inline unsigned long 198static inline unsigned long
199list_lru_shrink_walk_irq(struct list_lru *lru, struct shrink_control *sc,
200 list_lru_walk_cb isolate, void *cb_arg)
201{
202 return list_lru_walk_one_irq(lru, sc->nid, sc->memcg, isolate, cb_arg,
203 &sc->nr_to_scan);
204}
205
206static inline unsigned long
178list_lru_walk(struct list_lru *lru, list_lru_walk_cb isolate, 207list_lru_walk(struct list_lru *lru, list_lru_walk_cb isolate,
179 void *cb_arg, unsigned long nr_to_walk) 208 void *cb_arg, unsigned long nr_to_walk)
180{ 209{
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 4fd95dbeb52f..b065ef406770 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -299,7 +299,7 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
299 299
300static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) 300static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
301{ 301{
302 return file_inode(file->f_file); 302 return locks_inode(file->f_file);
303} 303}
304 304
305static inline int __nlm_privileged_request4(const struct sockaddr *sap) 305static inline int __nlm_privileged_request4(const struct sockaddr *sap)
@@ -359,7 +359,7 @@ static inline int nlm_privileged_requester(const struct svc_rqst *rqstp)
359static inline int nlm_compare_locks(const struct file_lock *fl1, 359static inline int nlm_compare_locks(const struct file_lock *fl1,
360 const struct file_lock *fl2) 360 const struct file_lock *fl2)
361{ 361{
362 return file_inode(fl1->fl_file) == file_inode(fl2->fl_file) 362 return locks_inode(fl1->fl_file) == locks_inode(fl2->fl_file)
363 && fl1->fl_pid == fl2->fl_pid 363 && fl1->fl_pid == fl2->fl_pid
364 && fl1->fl_owner == fl2->fl_owner 364 && fl1->fl_owner == fl2->fl_owner
365 && fl1->fl_start == fl2->fl_start 365 && fl1->fl_start == fl2->fl_start
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 6fc77d4dbdcd..b0d0b51c4d85 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -266,7 +266,7 @@ struct held_lock {
266/* 266/*
267 * Initialization, self-test and debugging-output methods: 267 * Initialization, self-test and debugging-output methods:
268 */ 268 */
269extern void lockdep_info(void); 269extern void lockdep_init(void);
270extern void lockdep_reset(void); 270extern void lockdep_reset(void);
271extern void lockdep_reset_lock(struct lockdep_map *lock); 271extern void lockdep_reset_lock(struct lockdep_map *lock);
272extern void lockdep_free_key_range(void *start, unsigned long size); 272extern void lockdep_free_key_range(void *start, unsigned long size);
@@ -406,7 +406,7 @@ static inline void lockdep_on(void)
406# define lock_downgrade(l, i) do { } while (0) 406# define lock_downgrade(l, i) do { } while (0)
407# define lock_set_class(l, n, k, s, i) do { } while (0) 407# define lock_set_class(l, n, k, s, i) do { } while (0)
408# define lock_set_subclass(l, s, i) do { } while (0) 408# define lock_set_subclass(l, s, i) do { } while (0)
409# define lockdep_info() do { } while (0) 409# define lockdep_init() do { } while (0)
410# define lockdep_init_map(lock, name, key, sub) \ 410# define lockdep_init_map(lock, name, key, sub) \
411 do { (void)(name); (void)(key); } while (0) 411 do { (void)(name); (void)(key); } while (0)
412# define lockdep_set_class(lock, key) do { (void)(key); } while (0) 412# define lockdep_set_class(lock, key) do { (void)(key); } while (0)
@@ -532,7 +532,7 @@ do { \
532 532
533#endif /* CONFIG_LOCKDEP */ 533#endif /* CONFIG_LOCKDEP */
534 534
535#ifdef CONFIG_TRACE_IRQFLAGS 535#ifdef CONFIG_PROVE_LOCKING
536extern void print_irqtrace_events(struct task_struct *curr); 536extern void print_irqtrace_events(struct task_struct *curr);
537#else 537#else
538static inline void print_irqtrace_events(struct task_struct *curr) 538static inline void print_irqtrace_events(struct task_struct *curr)
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 8f1131c8dd54..97a020c616ad 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -576,6 +576,10 @@
576 * userspace to load a kernel module with the given name. 576 * userspace to load a kernel module with the given name.
577 * @kmod_name name of the module requested by the kernel 577 * @kmod_name name of the module requested by the kernel
578 * Return 0 if successful. 578 * Return 0 if successful.
579 * @kernel_load_data:
580 * Load data provided by userspace.
581 * @id kernel load data identifier
582 * Return 0 if permission is granted.
579 * @kernel_read_file: 583 * @kernel_read_file:
580 * Read a file specified by userspace. 584 * Read a file specified by userspace.
581 * @file contains the file structure pointing to the file being read 585 * @file contains the file structure pointing to the file being read
@@ -1569,7 +1573,7 @@ union security_list_options {
1569 int (*file_send_sigiotask)(struct task_struct *tsk, 1573 int (*file_send_sigiotask)(struct task_struct *tsk,
1570 struct fown_struct *fown, int sig); 1574 struct fown_struct *fown, int sig);
1571 int (*file_receive)(struct file *file); 1575 int (*file_receive)(struct file *file);
1572 int (*file_open)(struct file *file, const struct cred *cred); 1576 int (*file_open)(struct file *file);
1573 1577
1574 int (*task_alloc)(struct task_struct *task, unsigned long clone_flags); 1578 int (*task_alloc)(struct task_struct *task, unsigned long clone_flags);
1575 void (*task_free)(struct task_struct *task); 1579 void (*task_free)(struct task_struct *task);
@@ -1582,6 +1586,7 @@ union security_list_options {
1582 int (*kernel_act_as)(struct cred *new, u32 secid); 1586 int (*kernel_act_as)(struct cred *new, u32 secid);
1583 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1587 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1584 int (*kernel_module_request)(char *kmod_name); 1588 int (*kernel_module_request)(char *kmod_name);
1589 int (*kernel_load_data)(enum kernel_load_data_id id);
1585 int (*kernel_read_file)(struct file *file, enum kernel_read_file_id id); 1590 int (*kernel_read_file)(struct file *file, enum kernel_read_file_id id);
1586 int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size, 1591 int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size,
1587 enum kernel_read_file_id id); 1592 enum kernel_read_file_id id);
@@ -1872,6 +1877,7 @@ struct security_hook_heads {
1872 struct hlist_head cred_getsecid; 1877 struct hlist_head cred_getsecid;
1873 struct hlist_head kernel_act_as; 1878 struct hlist_head kernel_act_as;
1874 struct hlist_head kernel_create_files_as; 1879 struct hlist_head kernel_create_files_as;
1880 struct hlist_head kernel_load_data;
1875 struct hlist_head kernel_read_file; 1881 struct hlist_head kernel_read_file;
1876 struct hlist_head kernel_post_read_file; 1882 struct hlist_head kernel_post_read_file;
1877 struct hlist_head kernel_module_request; 1883 struct hlist_head kernel_module_request;
diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h
new file mode 100644
index 000000000000..ccb73422c2fa
--- /dev/null
+++ b/include/linux/mailbox/mtk-cmdq-mailbox.h
@@ -0,0 +1,77 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2018 MediaTek Inc.
4 *
5 */
6
7#ifndef __MTK_CMDQ_MAILBOX_H__
8#define __MTK_CMDQ_MAILBOX_H__
9
10#include <linux/platform_device.h>
11#include <linux/slab.h>
12#include <linux/types.h>
13
14#define CMDQ_INST_SIZE 8 /* instruction is 64-bit */
15#define CMDQ_SUBSYS_SHIFT 16
16#define CMDQ_OP_CODE_SHIFT 24
17#define CMDQ_JUMP_PASS CMDQ_INST_SIZE
18
19#define CMDQ_WFE_UPDATE BIT(31)
20#define CMDQ_WFE_WAIT BIT(15)
21#define CMDQ_WFE_WAIT_VALUE 0x1
22
23/*
24 * CMDQ_CODE_MASK:
25 * set write mask
26 * format: op mask
27 * CMDQ_CODE_WRITE:
28 * write value into target register
29 * format: op subsys address value
30 * CMDQ_CODE_JUMP:
31 * jump by offset
32 * format: op offset
33 * CMDQ_CODE_WFE:
34 * wait for event and clear
35 * it is just clear if no wait
36 * format: [wait] op event update:1 to_wait:1 wait:1
37 * [clear] op event update:1 to_wait:0 wait:0
38 * CMDQ_CODE_EOC:
39 * end of command
40 * format: op irq_flag
41 */
42enum cmdq_code {
43 CMDQ_CODE_MASK = 0x02,
44 CMDQ_CODE_WRITE = 0x04,
45 CMDQ_CODE_JUMP = 0x10,
46 CMDQ_CODE_WFE = 0x20,
47 CMDQ_CODE_EOC = 0x40,
48};
49
50enum cmdq_cb_status {
51 CMDQ_CB_NORMAL = 0,
52 CMDQ_CB_ERROR
53};
54
55struct cmdq_cb_data {
56 enum cmdq_cb_status sta;
57 void *data;
58};
59
60typedef void (*cmdq_async_flush_cb)(struct cmdq_cb_data data);
61
62struct cmdq_task_cb {
63 cmdq_async_flush_cb cb;
64 void *data;
65};
66
67struct cmdq_pkt {
68 void *va_base;
69 dma_addr_t pa_base;
70 size_t cmd_buf_size; /* command occupied size */
71 size_t buf_size; /* real buffer size */
72 struct cmdq_task_cb cb;
73 struct cmdq_task_cb async_cb;
74 void *cl;
75};
76
77#endif /* __MTK_CMDQ_MAILBOX_H__ */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index ca59883c8364..516920549378 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -20,31 +20,60 @@
20#define INIT_MEMBLOCK_REGIONS 128 20#define INIT_MEMBLOCK_REGIONS 128
21#define INIT_PHYSMEM_REGIONS 4 21#define INIT_PHYSMEM_REGIONS 4
22 22
23/* Definition of memblock flags. */ 23/**
24enum { 24 * enum memblock_flags - definition of memory region attributes
25 * @MEMBLOCK_NONE: no special request
26 * @MEMBLOCK_HOTPLUG: hotpluggable region
27 * @MEMBLOCK_MIRROR: mirrored region
28 * @MEMBLOCK_NOMAP: don't add to kernel direct mapping
29 */
30enum memblock_flags {
25 MEMBLOCK_NONE = 0x0, /* No special request */ 31 MEMBLOCK_NONE = 0x0, /* No special request */
26 MEMBLOCK_HOTPLUG = 0x1, /* hotpluggable region */ 32 MEMBLOCK_HOTPLUG = 0x1, /* hotpluggable region */
27 MEMBLOCK_MIRROR = 0x2, /* mirrored region */ 33 MEMBLOCK_MIRROR = 0x2, /* mirrored region */
28 MEMBLOCK_NOMAP = 0x4, /* don't add to kernel direct mapping */ 34 MEMBLOCK_NOMAP = 0x4, /* don't add to kernel direct mapping */
29}; 35};
30 36
37/**
38 * struct memblock_region - represents a memory region
39 * @base: physical address of the region
40 * @size: size of the region
41 * @flags: memory region attributes
42 * @nid: NUMA node id
43 */
31struct memblock_region { 44struct memblock_region {
32 phys_addr_t base; 45 phys_addr_t base;
33 phys_addr_t size; 46 phys_addr_t size;
34 unsigned long flags; 47 enum memblock_flags flags;
35#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 48#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
36 int nid; 49 int nid;
37#endif 50#endif
38}; 51};
39 52
53/**
54 * struct memblock_type - collection of memory regions of certain type
55 * @cnt: number of regions
56 * @max: size of the allocated array
57 * @total_size: size of all regions
58 * @regions: array of regions
59 * @name: the memory type symbolic name
60 */
40struct memblock_type { 61struct memblock_type {
41 unsigned long cnt; /* number of regions */ 62 unsigned long cnt;
42 unsigned long max; /* size of the allocated array */ 63 unsigned long max;
43 phys_addr_t total_size; /* size of all regions */ 64 phys_addr_t total_size;
44 struct memblock_region *regions; 65 struct memblock_region *regions;
45 char *name; 66 char *name;
46}; 67};
47 68
69/**
70 * struct memblock - memblock allocator metadata
71 * @bottom_up: is bottom up direction?
72 * @current_limit: physical address of the current allocation limit
73 * @memory: usabe memory regions
74 * @reserved: reserved memory regions
75 * @physmem: all physical memory
76 */
48struct memblock { 77struct memblock {
49 bool bottom_up; /* is bottom up direction? */ 78 bool bottom_up; /* is bottom up direction? */
50 phys_addr_t current_limit; 79 phys_addr_t current_limit;
@@ -72,7 +101,7 @@ void memblock_discard(void);
72 101
73phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align, 102phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align,
74 phys_addr_t start, phys_addr_t end, 103 phys_addr_t start, phys_addr_t end,
75 int nid, ulong flags); 104 int nid, enum memblock_flags flags);
76phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, 105phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
77 phys_addr_t size, phys_addr_t align); 106 phys_addr_t size, phys_addr_t align);
78void memblock_allow_resize(void); 107void memblock_allow_resize(void);
@@ -89,19 +118,19 @@ int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
89int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); 118int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
90int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); 119int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
91int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); 120int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
92ulong choose_memblock_flags(void); 121enum memblock_flags choose_memblock_flags(void);
93 122
94/* Low level functions */ 123/* Low level functions */
95int memblock_add_range(struct memblock_type *type, 124int memblock_add_range(struct memblock_type *type,
96 phys_addr_t base, phys_addr_t size, 125 phys_addr_t base, phys_addr_t size,
97 int nid, unsigned long flags); 126 int nid, enum memblock_flags flags);
98 127
99void __next_mem_range(u64 *idx, int nid, ulong flags, 128void __next_mem_range(u64 *idx, int nid, enum memblock_flags flags,
100 struct memblock_type *type_a, 129 struct memblock_type *type_a,
101 struct memblock_type *type_b, phys_addr_t *out_start, 130 struct memblock_type *type_b, phys_addr_t *out_start,
102 phys_addr_t *out_end, int *out_nid); 131 phys_addr_t *out_end, int *out_nid);
103 132
104void __next_mem_range_rev(u64 *idx, int nid, ulong flags, 133void __next_mem_range_rev(u64 *idx, int nid, enum memblock_flags flags,
105 struct memblock_type *type_a, 134 struct memblock_type *type_a,
106 struct memblock_type *type_b, phys_addr_t *out_start, 135 struct memblock_type *type_b, phys_addr_t *out_start,
107 phys_addr_t *out_end, int *out_nid); 136 phys_addr_t *out_end, int *out_nid);
@@ -239,7 +268,6 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
239/** 268/**
240 * for_each_resv_unavail_range - iterate through reserved and unavailable memory 269 * for_each_resv_unavail_range - iterate through reserved and unavailable memory
241 * @i: u64 used as loop variable 270 * @i: u64 used as loop variable
242 * @flags: pick from blocks based on memory attributes
243 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 271 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
244 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 272 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
245 * 273 *
@@ -253,13 +281,13 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
253 NUMA_NO_NODE, MEMBLOCK_NONE, p_start, p_end, NULL) 281 NUMA_NO_NODE, MEMBLOCK_NONE, p_start, p_end, NULL)
254 282
255static inline void memblock_set_region_flags(struct memblock_region *r, 283static inline void memblock_set_region_flags(struct memblock_region *r,
256 unsigned long flags) 284 enum memblock_flags flags)
257{ 285{
258 r->flags |= flags; 286 r->flags |= flags;
259} 287}
260 288
261static inline void memblock_clear_region_flags(struct memblock_region *r, 289static inline void memblock_clear_region_flags(struct memblock_region *r,
262 unsigned long flags) 290 enum memblock_flags flags)
263{ 291{
264 r->flags &= ~flags; 292 r->flags &= ~flags;
265} 293}
@@ -317,10 +345,10 @@ static inline bool memblock_bottom_up(void)
317 345
318phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, 346phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align,
319 phys_addr_t start, phys_addr_t end, 347 phys_addr_t start, phys_addr_t end,
320 ulong flags); 348 enum memblock_flags flags);
321phys_addr_t memblock_alloc_base_nid(phys_addr_t size, 349phys_addr_t memblock_alloc_base_nid(phys_addr_t size,
322 phys_addr_t align, phys_addr_t max_addr, 350 phys_addr_t align, phys_addr_t max_addr,
323 int nid, ulong flags); 351 int nid, enum memblock_flags flags);
324phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align, 352phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
325 phys_addr_t max_addr); 353 phys_addr_t max_addr);
326phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, 354phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
@@ -367,8 +395,10 @@ phys_addr_t memblock_get_current_limit(void);
367 */ 395 */
368 396
369/** 397/**
370 * memblock_region_memory_base_pfn - Return the lowest pfn intersecting with the memory region 398 * memblock_region_memory_base_pfn - get the lowest pfn of the memory region
371 * @reg: memblock_region structure 399 * @reg: memblock_region structure
400 *
401 * Return: the lowest pfn intersecting with the memory region
372 */ 402 */
373static inline unsigned long memblock_region_memory_base_pfn(const struct memblock_region *reg) 403static inline unsigned long memblock_region_memory_base_pfn(const struct memblock_region *reg)
374{ 404{
@@ -376,8 +406,10 @@ static inline unsigned long memblock_region_memory_base_pfn(const struct membloc
376} 406}
377 407
378/** 408/**
379 * memblock_region_memory_end_pfn - Return the end_pfn this region 409 * memblock_region_memory_end_pfn - get the end pfn of the memory region
380 * @reg: memblock_region structure 410 * @reg: memblock_region structure
411 *
412 * Return: the end_pfn of the reserved region
381 */ 413 */
382static inline unsigned long memblock_region_memory_end_pfn(const struct memblock_region *reg) 414static inline unsigned long memblock_region_memory_end_pfn(const struct memblock_region *reg)
383{ 415{
@@ -385,8 +417,10 @@ static inline unsigned long memblock_region_memory_end_pfn(const struct memblock
385} 417}
386 418
387/** 419/**
388 * memblock_region_reserved_base_pfn - Return the lowest pfn intersecting with the reserved region 420 * memblock_region_reserved_base_pfn - get the lowest pfn of the reserved region
389 * @reg: memblock_region structure 421 * @reg: memblock_region structure
422 *
423 * Return: the lowest pfn intersecting with the reserved region
390 */ 424 */
391static inline unsigned long memblock_region_reserved_base_pfn(const struct memblock_region *reg) 425static inline unsigned long memblock_region_reserved_base_pfn(const struct memblock_region *reg)
392{ 426{
@@ -394,8 +428,10 @@ static inline unsigned long memblock_region_reserved_base_pfn(const struct membl
394} 428}
395 429
396/** 430/**
397 * memblock_region_reserved_end_pfn - Return the end_pfn this region 431 * memblock_region_reserved_end_pfn - get the end pfn of the reserved region
398 * @reg: memblock_region structure 432 * @reg: memblock_region structure
433 *
434 * Return: the end_pfn of the reserved region
399 */ 435 */
400static inline unsigned long memblock_region_reserved_end_pfn(const struct memblock_region *reg) 436static inline unsigned long memblock_region_reserved_end_pfn(const struct memblock_region *reg)
401{ 437{
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 6c6fb116e925..652f602167df 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -112,6 +112,15 @@ struct lruvec_stat {
112}; 112};
113 113
114/* 114/*
115 * Bitmap of shrinker::id corresponding to memcg-aware shrinkers,
116 * which have elements charged to this memcg.
117 */
118struct memcg_shrinker_map {
119 struct rcu_head rcu;
120 unsigned long map[0];
121};
122
123/*
115 * per-zone information in memory controller. 124 * per-zone information in memory controller.
116 */ 125 */
117struct mem_cgroup_per_node { 126struct mem_cgroup_per_node {
@@ -124,6 +133,9 @@ struct mem_cgroup_per_node {
124 133
125 struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; 134 struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1];
126 135
136#ifdef CONFIG_MEMCG_KMEM
137 struct memcg_shrinker_map __rcu *shrinker_map;
138#endif
127 struct rb_node tree_node; /* RB tree node */ 139 struct rb_node tree_node; /* RB tree node */
128 unsigned long usage_in_excess;/* Set to the value by which */ 140 unsigned long usage_in_excess;/* Set to the value by which */
129 /* the soft limit is exceeded*/ 141 /* the soft limit is exceeded*/
@@ -213,6 +225,11 @@ struct mem_cgroup {
213 */ 225 */
214 bool use_hierarchy; 226 bool use_hierarchy;
215 227
228 /*
229 * Should the OOM killer kill all belonging tasks, had it kill one?
230 */
231 bool oom_group;
232
216 /* protected by memcg_oom_lock */ 233 /* protected by memcg_oom_lock */
217 bool oom_lock; 234 bool oom_lock;
218 int under_oom; 235 int under_oom;
@@ -271,7 +288,7 @@ struct mem_cgroup {
271 bool tcpmem_active; 288 bool tcpmem_active;
272 int tcpmem_pressure; 289 int tcpmem_pressure;
273 290
274#ifndef CONFIG_SLOB 291#ifdef CONFIG_MEMCG_KMEM
275 /* Index in the kmem_cache->memcg_params.memcg_caches array */ 292 /* Index in the kmem_cache->memcg_params.memcg_caches array */
276 int kmemcg_id; 293 int kmemcg_id;
277 enum memcg_kmem_state kmem_state; 294 enum memcg_kmem_state kmem_state;
@@ -306,6 +323,11 @@ struct mem_cgroup {
306 323
307extern struct mem_cgroup *root_mem_cgroup; 324extern struct mem_cgroup *root_mem_cgroup;
308 325
326static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
327{
328 return (memcg == root_mem_cgroup);
329}
330
309static inline bool mem_cgroup_disabled(void) 331static inline bool mem_cgroup_disabled(void)
310{ 332{
311 return !cgroup_subsys_enabled(memory_cgrp_subsys); 333 return !cgroup_subsys_enabled(memory_cgrp_subsys);
@@ -317,6 +339,9 @@ enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root,
317int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm, 339int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
318 gfp_t gfp_mask, struct mem_cgroup **memcgp, 340 gfp_t gfp_mask, struct mem_cgroup **memcgp,
319 bool compound); 341 bool compound);
342int mem_cgroup_try_charge_delay(struct page *page, struct mm_struct *mm,
343 gfp_t gfp_mask, struct mem_cgroup **memcgp,
344 bool compound);
320void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg, 345void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg,
321 bool lrucare, bool compound); 346 bool lrucare, bool compound);
322void mem_cgroup_cancel_charge(struct page *page, struct mem_cgroup *memcg, 347void mem_cgroup_cancel_charge(struct page *page, struct mem_cgroup *memcg,
@@ -370,11 +395,21 @@ struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *);
370bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg); 395bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg);
371struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 396struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
372 397
398struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm);
399
400struct mem_cgroup *get_mem_cgroup_from_page(struct page *page);
401
373static inline 402static inline
374struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css){ 403struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css){
375 return css ? container_of(css, struct mem_cgroup, css) : NULL; 404 return css ? container_of(css, struct mem_cgroup, css) : NULL;
376} 405}
377 406
407static inline void mem_cgroup_put(struct mem_cgroup *memcg)
408{
409 if (memcg)
410 css_put(&memcg->css);
411}
412
378#define mem_cgroup_from_counter(counter, member) \ 413#define mem_cgroup_from_counter(counter, member) \
379 container_of(counter, struct mem_cgroup, member) 414 container_of(counter, struct mem_cgroup, member)
380 415
@@ -494,16 +529,16 @@ unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg);
494void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 529void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
495 struct task_struct *p); 530 struct task_struct *p);
496 531
497static inline void mem_cgroup_oom_enable(void) 532static inline void mem_cgroup_enter_user_fault(void)
498{ 533{
499 WARN_ON(current->memcg_may_oom); 534 WARN_ON(current->in_user_fault);
500 current->memcg_may_oom = 1; 535 current->in_user_fault = 1;
501} 536}
502 537
503static inline void mem_cgroup_oom_disable(void) 538static inline void mem_cgroup_exit_user_fault(void)
504{ 539{
505 WARN_ON(!current->memcg_may_oom); 540 WARN_ON(!current->in_user_fault);
506 current->memcg_may_oom = 0; 541 current->in_user_fault = 0;
507} 542}
508 543
509static inline bool task_in_memcg_oom(struct task_struct *p) 544static inline bool task_in_memcg_oom(struct task_struct *p)
@@ -512,6 +547,9 @@ static inline bool task_in_memcg_oom(struct task_struct *p)
512} 547}
513 548
514bool mem_cgroup_oom_synchronize(bool wait); 549bool mem_cgroup_oom_synchronize(bool wait);
550struct mem_cgroup *mem_cgroup_get_oom_group(struct task_struct *victim,
551 struct mem_cgroup *oom_domain);
552void mem_cgroup_print_oom_group(struct mem_cgroup *memcg);
515 553
516#ifdef CONFIG_MEMCG_SWAP 554#ifdef CONFIG_MEMCG_SWAP
517extern int do_swap_account; 555extern int do_swap_account;
@@ -759,6 +797,11 @@ void mem_cgroup_split_huge_fixup(struct page *head);
759 797
760struct mem_cgroup; 798struct mem_cgroup;
761 799
800static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
801{
802 return true;
803}
804
762static inline bool mem_cgroup_disabled(void) 805static inline bool mem_cgroup_disabled(void)
763{ 806{
764 return true; 807 return true;
@@ -789,6 +832,16 @@ static inline int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
789 return 0; 832 return 0;
790} 833}
791 834
835static inline int mem_cgroup_try_charge_delay(struct page *page,
836 struct mm_struct *mm,
837 gfp_t gfp_mask,
838 struct mem_cgroup **memcgp,
839 bool compound)
840{
841 *memcgp = NULL;
842 return 0;
843}
844
792static inline void mem_cgroup_commit_charge(struct page *page, 845static inline void mem_cgroup_commit_charge(struct page *page,
793 struct mem_cgroup *memcg, 846 struct mem_cgroup *memcg,
794 bool lrucare, bool compound) 847 bool lrucare, bool compound)
@@ -837,6 +890,20 @@ static inline bool task_in_mem_cgroup(struct task_struct *task,
837 return true; 890 return true;
838} 891}
839 892
893static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)
894{
895 return NULL;
896}
897
898static inline struct mem_cgroup *get_mem_cgroup_from_page(struct page *page)
899{
900 return NULL;
901}
902
903static inline void mem_cgroup_put(struct mem_cgroup *memcg)
904{
905}
906
840static inline struct mem_cgroup * 907static inline struct mem_cgroup *
841mem_cgroup_iter(struct mem_cgroup *root, 908mem_cgroup_iter(struct mem_cgroup *root,
842 struct mem_cgroup *prev, 909 struct mem_cgroup *prev,
@@ -924,11 +991,11 @@ static inline void mem_cgroup_handle_over_high(void)
924{ 991{
925} 992}
926 993
927static inline void mem_cgroup_oom_enable(void) 994static inline void mem_cgroup_enter_user_fault(void)
928{ 995{
929} 996}
930 997
931static inline void mem_cgroup_oom_disable(void) 998static inline void mem_cgroup_exit_user_fault(void)
932{ 999{
933} 1000}
934 1001
@@ -942,6 +1009,16 @@ static inline bool mem_cgroup_oom_synchronize(bool wait)
942 return false; 1009 return false;
943} 1010}
944 1011
1012static inline struct mem_cgroup *mem_cgroup_get_oom_group(
1013 struct task_struct *victim, struct mem_cgroup *oom_domain)
1014{
1015 return NULL;
1016}
1017
1018static inline void mem_cgroup_print_oom_group(struct mem_cgroup *memcg)
1019{
1020}
1021
945static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, 1022static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
946 int idx) 1023 int idx)
947{ 1024{
@@ -1194,7 +1271,7 @@ int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order,
1194int memcg_kmem_charge(struct page *page, gfp_t gfp, int order); 1271int memcg_kmem_charge(struct page *page, gfp_t gfp, int order);
1195void memcg_kmem_uncharge(struct page *page, int order); 1272void memcg_kmem_uncharge(struct page *page, int order);
1196 1273
1197#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) 1274#ifdef CONFIG_MEMCG_KMEM
1198extern struct static_key_false memcg_kmem_enabled_key; 1275extern struct static_key_false memcg_kmem_enabled_key;
1199extern struct workqueue_struct *memcg_kmem_cache_wq; 1276extern struct workqueue_struct *memcg_kmem_cache_wq;
1200 1277
@@ -1225,6 +1302,10 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg)
1225 return memcg ? memcg->kmemcg_id : -1; 1302 return memcg ? memcg->kmemcg_id : -1;
1226} 1303}
1227 1304
1305extern int memcg_expand_shrinker_maps(int new_id);
1306
1307extern void memcg_set_shrinker_bit(struct mem_cgroup *memcg,
1308 int nid, int shrinker_id);
1228#else 1309#else
1229#define for_each_memcg_cache_index(_idx) \ 1310#define for_each_memcg_cache_index(_idx) \
1230 for (; NULL; ) 1311 for (; NULL; )
@@ -1247,6 +1328,8 @@ static inline void memcg_put_cache_ids(void)
1247{ 1328{
1248} 1329}
1249 1330
1250#endif /* CONFIG_MEMCG && !CONFIG_SLOB */ 1331static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg,
1332 int nid, int shrinker_id) { }
1333#endif /* CONFIG_MEMCG_KMEM */
1251 1334
1252#endif /* _LINUX_MEMCONTROL_H */ 1335#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 4e9828cda7a2..34a28227068d 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -319,6 +319,7 @@ static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
319static inline void remove_memory(int nid, u64 start, u64 size) {} 319static inline void remove_memory(int nid, u64 start, u64 size) {}
320#endif /* CONFIG_MEMORY_HOTREMOVE */ 320#endif /* CONFIG_MEMORY_HOTREMOVE */
321 321
322extern void __ref free_area_init_core_hotplug(int nid);
322extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, 323extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
323 void *arg, int (*func)(struct memory_block *, void *)); 324 void *arg, int (*func)(struct memory_block *, void *));
324extern int add_memory(int nid, u64 start, u64 size); 325extern int add_memory(int nid, u64 start, u64 size);
diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h
index 51e6f9414575..b404a5af9bba 100644
--- a/include/linux/mfd/as3722.h
+++ b/include/linux/mfd/as3722.h
@@ -296,6 +296,8 @@
296#define AS3722_ADC1_CONV_NOTREADY BIT(7) 296#define AS3722_ADC1_CONV_NOTREADY BIT(7)
297#define AS3722_ADC1_SOURCE_SELECT_MASK 0x1F 297#define AS3722_ADC1_SOURCE_SELECT_MASK 0x1F
298 298
299#define AS3722_CTRL_SEQU1_AC_OK_PWR_ON BIT(0)
300
299/* GPIO modes */ 301/* GPIO modes */
300#define AS3722_GPIO_MODE_MASK 0x07 302#define AS3722_GPIO_MODE_MASK 0x07
301#define AS3722_GPIO_MODE_INPUT 0x00 303#define AS3722_GPIO_MODE_INPUT 0x00
@@ -391,6 +393,7 @@ struct as3722 {
391 unsigned long irq_flags; 393 unsigned long irq_flags;
392 bool en_intern_int_pullup; 394 bool en_intern_int_pullup;
393 bool en_intern_i2c_pullup; 395 bool en_intern_i2c_pullup;
396 bool en_ac_ok_pwr_on;
394 struct regmap_irq_chip_data *irq_data; 397 struct regmap_irq_chip_data *irq_data;
395}; 398};
396 399
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 32421dfeb996..20949dde35cd 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -147,7 +147,7 @@ struct cros_ec_device {
147 bool mkbp_event_supported; 147 bool mkbp_event_supported;
148 struct blocking_notifier_head event_notifier; 148 struct blocking_notifier_head event_notifier;
149 149
150 struct ec_response_get_next_event event_data; 150 struct ec_response_get_next_event_v1 event_data;
151 int event_size; 151 int event_size;
152 u32 host_event_wake_mask; 152 u32 host_event_wake_mask;
153}; 153};
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index f2edd9969b40..6e1ab9bead28 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -804,6 +804,8 @@ enum ec_feature_code {
804 EC_FEATURE_MOTION_SENSE_FIFO = 24, 804 EC_FEATURE_MOTION_SENSE_FIFO = 24,
805 /* EC has RTC feature that can be controlled by host commands */ 805 /* EC has RTC feature that can be controlled by host commands */
806 EC_FEATURE_RTC = 27, 806 EC_FEATURE_RTC = 27,
807 /* EC supports CEC commands */
808 EC_FEATURE_CEC = 35,
807}; 809};
808 810
809#define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) 811#define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32))
@@ -2078,6 +2080,12 @@ enum ec_mkbp_event {
2078 /* EC sent a sysrq command */ 2080 /* EC sent a sysrq command */
2079 EC_MKBP_EVENT_SYSRQ = 6, 2081 EC_MKBP_EVENT_SYSRQ = 6,
2080 2082
2083 /* Notify the AP that something happened on CEC */
2084 EC_MKBP_EVENT_CEC_EVENT = 8,
2085
2086 /* Send an incoming CEC message to the AP */
2087 EC_MKBP_EVENT_CEC_MESSAGE = 9,
2088
2081 /* Number of MKBP events */ 2089 /* Number of MKBP events */
2082 EC_MKBP_EVENT_COUNT, 2090 EC_MKBP_EVENT_COUNT,
2083}; 2091};
@@ -2093,12 +2101,28 @@ union ec_response_get_next_data {
2093 uint32_t sysrq; 2101 uint32_t sysrq;
2094} __packed; 2102} __packed;
2095 2103
2104union ec_response_get_next_data_v1 {
2105 uint8_t key_matrix[16];
2106 uint32_t host_event;
2107 uint32_t buttons;
2108 uint32_t switches;
2109 uint32_t sysrq;
2110 uint32_t cec_events;
2111 uint8_t cec_message[16];
2112} __packed;
2113
2096struct ec_response_get_next_event { 2114struct ec_response_get_next_event {
2097 uint8_t event_type; 2115 uint8_t event_type;
2098 /* Followed by event data if any */ 2116 /* Followed by event data if any */
2099 union ec_response_get_next_data data; 2117 union ec_response_get_next_data data;
2100} __packed; 2118} __packed;
2101 2119
2120struct ec_response_get_next_event_v1 {
2121 uint8_t event_type;
2122 /* Followed by event data if any */
2123 union ec_response_get_next_data_v1 data;
2124} __packed;
2125
2102/* Bit indices for buttons and switches.*/ 2126/* Bit indices for buttons and switches.*/
2103/* Buttons */ 2127/* Buttons */
2104#define EC_MKBP_POWER_BUTTON 0 2128#define EC_MKBP_POWER_BUTTON 0
@@ -2593,14 +2617,18 @@ struct ec_params_current_limit {
2593} __packed; 2617} __packed;
2594 2618
2595/* 2619/*
2596 * Set maximum external power current. 2620 * Set maximum external voltage / current.
2597 */ 2621 */
2598#define EC_CMD_EXT_POWER_CURRENT_LIMIT 0xa2 2622#define EC_CMD_EXTERNAL_POWER_LIMIT 0x00A2
2599 2623
2600struct ec_params_ext_power_current_limit { 2624/* Command v0 is used only on Spring and is obsolete + unsupported */
2601 uint32_t limit; /* in mA */ 2625struct ec_params_external_power_limit_v1 {
2626 uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */
2627 uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */
2602} __packed; 2628} __packed;
2603 2629
2630#define EC_POWER_LIMIT_NONE 0xffff
2631
2604/* Inform the EC when entering a sleep state */ 2632/* Inform the EC when entering a sleep state */
2605#define EC_CMD_HOST_SLEEP_EVENT 0xa9 2633#define EC_CMD_HOST_SLEEP_EVENT 0xa9
2606 2634
@@ -2831,6 +2859,79 @@ struct ec_params_reboot_ec {
2831 2859
2832/*****************************************************************************/ 2860/*****************************************************************************/
2833/* 2861/*
2862 * HDMI CEC commands
2863 *
2864 * These commands are for sending and receiving message via HDMI CEC
2865 */
2866#define EC_MAX_CEC_MSG_LEN 16
2867
2868/* CEC message from the AP to be written on the CEC bus */
2869#define EC_CMD_CEC_WRITE_MSG 0x00B8
2870
2871/**
2872 * struct ec_params_cec_write - Message to write to the CEC bus
2873 * @msg: message content to write to the CEC bus
2874 */
2875struct ec_params_cec_write {
2876 uint8_t msg[EC_MAX_CEC_MSG_LEN];
2877} __packed;
2878
2879/* Set various CEC parameters */
2880#define EC_CMD_CEC_SET 0x00BA
2881
2882/**
2883 * struct ec_params_cec_set - CEC parameters set
2884 * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS
2885 * @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC
2886 * or 1 to enable CEC functionality, in case cmd is CEC_CMD_LOGICAL_ADDRESS,
2887 * this field encodes the requested logical address between 0 and 15
2888 * or 0xff to unregister
2889 */
2890struct ec_params_cec_set {
2891 uint8_t cmd; /* enum cec_command */
2892 uint8_t val;
2893} __packed;
2894
2895/* Read various CEC parameters */
2896#define EC_CMD_CEC_GET 0x00BB
2897
2898/**
2899 * struct ec_params_cec_get - CEC parameters get
2900 * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS
2901 */
2902struct ec_params_cec_get {
2903 uint8_t cmd; /* enum cec_command */
2904} __packed;
2905
2906/**
2907 * struct ec_response_cec_get - CEC parameters get response
2908 * @val: in case cmd was CEC_CMD_ENABLE, this field will 0 if CEC is
2909 * disabled or 1 if CEC functionality is enabled,
2910 * in case cmd was CEC_CMD_LOGICAL_ADDRESS, this will encode the
2911 * configured logical address between 0 and 15 or 0xff if unregistered
2912 */
2913struct ec_response_cec_get {
2914 uint8_t val;
2915} __packed;
2916
2917/* CEC parameters command */
2918enum ec_cec_command {
2919 /* CEC reading, writing and events enable */
2920 CEC_CMD_ENABLE,
2921 /* CEC logical address */
2922 CEC_CMD_LOGICAL_ADDRESS,
2923};
2924
2925/* Events from CEC to AP */
2926enum mkbp_cec_event {
2927 /* Outgoing message was acknowledged by a follower */
2928 EC_MKBP_CEC_SEND_OK = BIT(0),
2929 /* Outgoing message was not acknowledged */
2930 EC_MKBP_CEC_SEND_FAILED = BIT(1),
2931};
2932
2933/*****************************************************************************/
2934/*
2834 * Special commands 2935 * Special commands
2835 * 2936 *
2836 * These do not follow the normal rules for commands. See each command for 2937 * These do not follow the normal rules for commands. See each command for
@@ -2974,6 +3075,12 @@ enum usb_chg_type {
2974 USB_CHG_TYPE_VBUS, 3075 USB_CHG_TYPE_VBUS,
2975 USB_CHG_TYPE_UNKNOWN, 3076 USB_CHG_TYPE_UNKNOWN,
2976}; 3077};
3078enum usb_power_roles {
3079 USB_PD_PORT_POWER_DISCONNECTED,
3080 USB_PD_PORT_POWER_SOURCE,
3081 USB_PD_PORT_POWER_SINK,
3082 USB_PD_PORT_POWER_SINK_NOT_CHARGING,
3083};
2977 3084
2978struct usb_chg_measures { 3085struct usb_chg_measures {
2979 uint16_t voltage_max; 3086 uint16_t voltage_max;
@@ -2991,6 +3098,120 @@ struct ec_response_usb_pd_power_info {
2991 uint32_t max_power; 3098 uint32_t max_power;
2992} __packed; 3099} __packed;
2993 3100
3101struct ec_params_usb_pd_info_request {
3102 uint8_t port;
3103} __packed;
3104
3105/* Read USB-PD Device discovery info */
3106#define EC_CMD_USB_PD_DISCOVERY 0x0113
3107struct ec_params_usb_pd_discovery_entry {
3108 uint16_t vid; /* USB-IF VID */
3109 uint16_t pid; /* USB-IF PID */
3110 uint8_t ptype; /* product type (hub,periph,cable,ama) */
3111} __packed;
3112
3113/* Override default charge behavior */
3114#define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114
3115
3116/* Negative port parameters have special meaning */
3117enum usb_pd_override_ports {
3118 OVERRIDE_DONT_CHARGE = -2,
3119 OVERRIDE_OFF = -1,
3120 /* [0, CONFIG_USB_PD_PORT_COUNT): Port# */
3121};
3122
3123struct ec_params_charge_port_override {
3124 int16_t override_port; /* Override port# */
3125} __packed;
3126
3127/* Read (and delete) one entry of PD event log */
3128#define EC_CMD_PD_GET_LOG_ENTRY 0x0115
3129
3130struct ec_response_pd_log {
3131 uint32_t timestamp; /* relative timestamp in milliseconds */
3132 uint8_t type; /* event type : see PD_EVENT_xx below */
3133 uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */
3134 uint16_t data; /* type-defined data payload */
3135 uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */
3136} __packed;
3137
3138/* The timestamp is the microsecond counter shifted to get about a ms. */
3139#define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */
3140
3141#define PD_LOG_SIZE_MASK 0x1f
3142#define PD_LOG_PORT_MASK 0xe0
3143#define PD_LOG_PORT_SHIFT 5
3144#define PD_LOG_PORT_SIZE(port, size) (((port) << PD_LOG_PORT_SHIFT) | \
3145 ((size) & PD_LOG_SIZE_MASK))
3146#define PD_LOG_PORT(size_port) ((size_port) >> PD_LOG_PORT_SHIFT)
3147#define PD_LOG_SIZE(size_port) ((size_port) & PD_LOG_SIZE_MASK)
3148
3149/* PD event log : entry types */
3150/* PD MCU events */
3151#define PD_EVENT_MCU_BASE 0x00
3152#define PD_EVENT_MCU_CHARGE (PD_EVENT_MCU_BASE+0)
3153#define PD_EVENT_MCU_CONNECT (PD_EVENT_MCU_BASE+1)
3154/* Reserved for custom board event */
3155#define PD_EVENT_MCU_BOARD_CUSTOM (PD_EVENT_MCU_BASE+2)
3156/* PD generic accessory events */
3157#define PD_EVENT_ACC_BASE 0x20
3158#define PD_EVENT_ACC_RW_FAIL (PD_EVENT_ACC_BASE+0)
3159#define PD_EVENT_ACC_RW_ERASE (PD_EVENT_ACC_BASE+1)
3160/* PD power supply events */
3161#define PD_EVENT_PS_BASE 0x40
3162#define PD_EVENT_PS_FAULT (PD_EVENT_PS_BASE+0)
3163/* PD video dongles events */
3164#define PD_EVENT_VIDEO_BASE 0x60
3165#define PD_EVENT_VIDEO_DP_MODE (PD_EVENT_VIDEO_BASE+0)
3166#define PD_EVENT_VIDEO_CODEC (PD_EVENT_VIDEO_BASE+1)
3167/* Returned in the "type" field, when there is no entry available */
3168#define PD_EVENT_NO_ENTRY 0xff
3169
3170/*
3171 * PD_EVENT_MCU_CHARGE event definition :
3172 * the payload is "struct usb_chg_measures"
3173 * the data field contains the port state flags as defined below :
3174 */
3175/* Port partner is a dual role device */
3176#define CHARGE_FLAGS_DUAL_ROLE BIT(15)
3177/* Port is the pending override port */
3178#define CHARGE_FLAGS_DELAYED_OVERRIDE BIT(14)
3179/* Port is the override port */
3180#define CHARGE_FLAGS_OVERRIDE BIT(13)
3181/* Charger type */
3182#define CHARGE_FLAGS_TYPE_SHIFT 3
3183#define CHARGE_FLAGS_TYPE_MASK (0xf << CHARGE_FLAGS_TYPE_SHIFT)
3184/* Power delivery role */
3185#define CHARGE_FLAGS_ROLE_MASK (7 << 0)
3186
3187/*
3188 * PD_EVENT_PS_FAULT data field flags definition :
3189 */
3190#define PS_FAULT_OCP 1
3191#define PS_FAULT_FAST_OCP 2
3192#define PS_FAULT_OVP 3
3193#define PS_FAULT_DISCH 4
3194
3195/*
3196 * PD_EVENT_VIDEO_CODEC payload is "struct mcdp_info".
3197 */
3198struct mcdp_version {
3199 uint8_t major;
3200 uint8_t minor;
3201 uint16_t build;
3202} __packed;
3203
3204struct mcdp_info {
3205 uint8_t family[2];
3206 uint8_t chipid[2];
3207 struct mcdp_version irom;
3208 struct mcdp_version fw;
3209} __packed;
3210
3211/* struct mcdp_info field decoding */
3212#define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1])
3213#define MCDP_FAMILY(family) ((family[0] << 8) | family[1])
3214
2994/* Get info about USB-C SS muxes */ 3215/* Get info about USB-C SS muxes */
2995#define EC_CMD_USB_PD_MUX_INFO 0x11a 3216#define EC_CMD_USB_PD_MUX_INFO 0x11a
2996 3217
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index f3ae65db4c86..71b09154e2db 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -29,8 +29,11 @@
29#define DA9063_DRVNAME_RTC "da9063-rtc" 29#define DA9063_DRVNAME_RTC "da9063-rtc"
30#define DA9063_DRVNAME_VIBRATION "da9063-vibration" 30#define DA9063_DRVNAME_VIBRATION "da9063-vibration"
31 31
32enum da9063_models { 32#define PMIC_CHIP_ID_DA9063 0x61
33 PMIC_DA9063 = 0x61, 33
34enum da9063_type {
35 PMIC_TYPE_DA9063 = 0,
36 PMIC_TYPE_DA9063L,
34}; 37};
35 38
36enum da9063_variant_codes { 39enum da9063_variant_codes {
@@ -72,13 +75,10 @@ enum da9063_irqs {
72 DA9063_IRQ_GPI15, 75 DA9063_IRQ_GPI15,
73}; 76};
74 77
75#define DA9063_IRQ_BASE_OFFSET 0
76#define DA9063_NUM_IRQ (DA9063_IRQ_GPI15 + 1 - DA9063_IRQ_BASE_OFFSET)
77
78struct da9063 { 78struct da9063 {
79 /* Device */ 79 /* Device */
80 struct device *dev; 80 struct device *dev;
81 unsigned short model; 81 enum da9063_type type;
82 unsigned char variant_code; 82 unsigned char variant_code;
83 unsigned int flags; 83 unsigned int flags;
84 84
@@ -94,7 +94,4 @@ struct da9063 {
94int da9063_device_init(struct da9063 *da9063, unsigned int irq); 94int da9063_device_init(struct da9063 *da9063, unsigned int irq);
95int da9063_irq_init(struct da9063 *da9063); 95int da9063_irq_init(struct da9063 *da9063);
96 96
97void da9063_device_exit(struct da9063 *da9063);
98void da9063_irq_exit(struct da9063 *da9063);
99
100#endif /* __MFD_DA9063_CORE_H__ */ 97#endif /* __MFD_DA9063_CORE_H__ */
diff --git a/include/linux/mfd/madera/core.h b/include/linux/mfd/madera/core.h
new file mode 100644
index 000000000000..c332681848ef
--- /dev/null
+++ b/include/linux/mfd/madera/core.h
@@ -0,0 +1,187 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * MFD internals for Cirrus Logic Madera codecs
4 *
5 * Copyright (C) 2015-2018 Cirrus Logic
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; version 2.
10 */
11
12#ifndef MADERA_CORE_H
13#define MADERA_CORE_H
14
15#include <linux/gpio/consumer.h>
16#include <linux/interrupt.h>
17#include <linux/mfd/madera/pdata.h>
18#include <linux/notifier.h>
19#include <linux/regmap.h>
20#include <linux/regulator/consumer.h>
21
22enum madera_type {
23 /* 0 is reserved for indicating failure to identify */
24 CS47L35 = 1,
25 CS47L85 = 2,
26 CS47L90 = 3,
27 CS47L91 = 4,
28 WM1840 = 7,
29};
30
31#define MADERA_MAX_CORE_SUPPLIES 2
32#define MADERA_MAX_GPIOS 40
33
34#define CS47L35_NUM_GPIOS 16
35#define CS47L85_NUM_GPIOS 40
36#define CS47L90_NUM_GPIOS 38
37
38#define MADERA_MAX_MICBIAS 4
39
40/* Notifier events */
41#define MADERA_NOTIFY_VOICE_TRIGGER 0x1
42#define MADERA_NOTIFY_HPDET 0x2
43#define MADERA_NOTIFY_MICDET 0x4
44
45/* GPIO Function Definitions */
46#define MADERA_GP_FN_ALTERNATE 0x00
47#define MADERA_GP_FN_GPIO 0x01
48#define MADERA_GP_FN_DSP_GPIO 0x02
49#define MADERA_GP_FN_IRQ1 0x03
50#define MADERA_GP_FN_IRQ2 0x04
51#define MADERA_GP_FN_FLL1_CLOCK 0x10
52#define MADERA_GP_FN_FLL2_CLOCK 0x11
53#define MADERA_GP_FN_FLL3_CLOCK 0x12
54#define MADERA_GP_FN_FLLAO_CLOCK 0x13
55#define MADERA_GP_FN_FLL1_LOCK 0x18
56#define MADERA_GP_FN_FLL2_LOCK 0x19
57#define MADERA_GP_FN_FLL3_LOCK 0x1A
58#define MADERA_GP_FN_FLLAO_LOCK 0x1B
59#define MADERA_GP_FN_OPCLK_OUT 0x40
60#define MADERA_GP_FN_OPCLK_ASYNC_OUT 0x41
61#define MADERA_GP_FN_PWM1 0x48
62#define MADERA_GP_FN_PWM2 0x49
63#define MADERA_GP_FN_SPDIF_OUT 0x4C
64#define MADERA_GP_FN_HEADPHONE_DET 0x50
65#define MADERA_GP_FN_MIC_DET 0x58
66#define MADERA_GP_FN_DRC1_SIGNAL_DETECT 0x80
67#define MADERA_GP_FN_DRC2_SIGNAL_DETECT 0x81
68#define MADERA_GP_FN_ASRC1_IN1_LOCK 0x88
69#define MADERA_GP_FN_ASRC1_IN2_LOCK 0x89
70#define MADERA_GP_FN_ASRC2_IN1_LOCK 0x8A
71#define MADERA_GP_FN_ASRC2_IN2_LOCK 0x8B
72#define MADERA_GP_FN_DSP_IRQ1 0xA0
73#define MADERA_GP_FN_DSP_IRQ2 0xA1
74#define MADERA_GP_FN_DSP_IRQ3 0xA2
75#define MADERA_GP_FN_DSP_IRQ4 0xA3
76#define MADERA_GP_FN_DSP_IRQ5 0xA4
77#define MADERA_GP_FN_DSP_IRQ6 0xA5
78#define MADERA_GP_FN_DSP_IRQ7 0xA6
79#define MADERA_GP_FN_DSP_IRQ8 0xA7
80#define MADERA_GP_FN_DSP_IRQ9 0xA8
81#define MADERA_GP_FN_DSP_IRQ10 0xA9
82#define MADERA_GP_FN_DSP_IRQ11 0xAA
83#define MADERA_GP_FN_DSP_IRQ12 0xAB
84#define MADERA_GP_FN_DSP_IRQ13 0xAC
85#define MADERA_GP_FN_DSP_IRQ14 0xAD
86#define MADERA_GP_FN_DSP_IRQ15 0xAE
87#define MADERA_GP_FN_DSP_IRQ16 0xAF
88#define MADERA_GP_FN_HPOUT1L_SC 0xB0
89#define MADERA_GP_FN_HPOUT1R_SC 0xB1
90#define MADERA_GP_FN_HPOUT2L_SC 0xB2
91#define MADERA_GP_FN_HPOUT2R_SC 0xB3
92#define MADERA_GP_FN_HPOUT3L_SC 0xB4
93#define MADERA_GP_FN_HPOUT4R_SC 0xB5
94#define MADERA_GP_FN_SPKOUTL_SC 0xB6
95#define MADERA_GP_FN_SPKOUTR_SC 0xB7
96#define MADERA_GP_FN_HPOUT1L_ENA 0xC0
97#define MADERA_GP_FN_HPOUT1R_ENA 0xC1
98#define MADERA_GP_FN_HPOUT2L_ENA 0xC2
99#define MADERA_GP_FN_HPOUT2R_ENA 0xC3
100#define MADERA_GP_FN_HPOUT3L_ENA 0xC4
101#define MADERA_GP_FN_HPOUT4R_ENA 0xC5
102#define MADERA_GP_FN_SPKOUTL_ENA 0xC6
103#define MADERA_GP_FN_SPKOUTR_ENA 0xC7
104#define MADERA_GP_FN_HPOUT1L_DIS 0xD0
105#define MADERA_GP_FN_HPOUT1R_DIS 0xD1
106#define MADERA_GP_FN_HPOUT2L_DIS 0xD2
107#define MADERA_GP_FN_HPOUT2R_DIS 0xD3
108#define MADERA_GP_FN_HPOUT3L_DIS 0xD4
109#define MADERA_GP_FN_HPOUT4R_DIS 0xD5
110#define MADERA_GP_FN_SPKOUTL_DIS 0xD6
111#define MADERA_GP_FN_SPKOUTR_DIS 0xD7
112#define MADERA_GP_FN_SPK_SHUTDOWN 0xE0
113#define MADERA_GP_FN_SPK_OVH_SHUTDOWN 0xE1
114#define MADERA_GP_FN_SPK_OVH_WARN 0xE2
115#define MADERA_GP_FN_TIMER1_STATUS 0x140
116#define MADERA_GP_FN_TIMER2_STATUS 0x141
117#define MADERA_GP_FN_TIMER3_STATUS 0x142
118#define MADERA_GP_FN_TIMER4_STATUS 0x143
119#define MADERA_GP_FN_TIMER5_STATUS 0x144
120#define MADERA_GP_FN_TIMER6_STATUS 0x145
121#define MADERA_GP_FN_TIMER7_STATUS 0x146
122#define MADERA_GP_FN_TIMER8_STATUS 0x147
123#define MADERA_GP_FN_EVENTLOG1_FIFO_STS 0x150
124#define MADERA_GP_FN_EVENTLOG2_FIFO_STS 0x151
125#define MADERA_GP_FN_EVENTLOG3_FIFO_STS 0x152
126#define MADERA_GP_FN_EVENTLOG4_FIFO_STS 0x153
127#define MADERA_GP_FN_EVENTLOG5_FIFO_STS 0x154
128#define MADERA_GP_FN_EVENTLOG6_FIFO_STS 0x155
129#define MADERA_GP_FN_EVENTLOG7_FIFO_STS 0x156
130#define MADERA_GP_FN_EVENTLOG8_FIFO_STS 0x157
131
132struct snd_soc_dapm_context;
133
134/*
135 * struct madera - internal data shared by the set of Madera drivers
136 *
137 * This should not be used by anything except child drivers of the Madera MFD
138 *
139 * @regmap: pointer to the regmap instance for 16-bit registers
140 * @regmap_32bit: pointer to the regmap instance for 32-bit registers
141 * @dev: pointer to the MFD device
142 * @type: type of codec
143 * @rev: silicon revision
144 * @type_name: display name of this codec
145 * @num_core_supplies: number of core supply regulators
146 * @core_supplies: list of core supplies that are always required
147 * @dcvdd: pointer to DCVDD regulator
148 * @internal_dcvdd: true if DCVDD is supplied from the internal LDO1
149 * @pdata: our pdata
150 * @irq_dev: the irqchip child driver device
151 * @irq: host irq number from SPI or I2C configuration
152 * @out_clamp: indicates output clamp state for each analogue output
153 * @out_shorted: indicates short circuit state for each analogue output
154 * @hp_ena: bitflags of enable state for the headphone outputs
155 * @num_micbias: number of MICBIAS outputs
156 * @num_childbias: number of child biases for each MICBIAS
157 * @dapm: pointer to codec driver DAPM context
158 * @notifier: notifier for signalling events to ASoC machine driver
159 */
160struct madera {
161 struct regmap *regmap;
162 struct regmap *regmap_32bit;
163
164 struct device *dev;
165
166 enum madera_type type;
167 unsigned int rev;
168 const char *type_name;
169
170 int num_core_supplies;
171 struct regulator_bulk_data core_supplies[MADERA_MAX_CORE_SUPPLIES];
172 struct regulator *dcvdd;
173 bool internal_dcvdd;
174
175 struct madera_pdata pdata;
176
177 struct device *irq_dev;
178 int irq;
179
180 unsigned int num_micbias;
181 unsigned int num_childbias[MADERA_MAX_MICBIAS];
182
183 struct snd_soc_dapm_context *dapm;
184
185 struct blocking_notifier_head notifier;
186};
187#endif
diff --git a/include/linux/mfd/madera/pdata.h b/include/linux/mfd/madera/pdata.h
new file mode 100644
index 000000000000..0b311f39c8f4
--- /dev/null
+++ b/include/linux/mfd/madera/pdata.h
@@ -0,0 +1,59 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Platform data for Cirrus Logic Madera codecs
4 *
5 * Copyright (C) 2015-2018 Cirrus Logic
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; version 2.
10 */
11
12#ifndef MADERA_PDATA_H
13#define MADERA_PDATA_H
14
15#include <linux/kernel.h>
16#include <linux/regulator/arizona-ldo1.h>
17#include <linux/regulator/arizona-micsupp.h>
18#include <linux/regulator/machine.h>
19
20#define MADERA_MAX_MICBIAS 4
21#define MADERA_MAX_CHILD_MICBIAS 4
22
23#define MADERA_MAX_GPSW 2
24
25struct gpio_desc;
26struct pinctrl_map;
27struct madera_irqchip_pdata;
28struct madera_codec_pdata;
29
30/**
31 * struct madera_pdata - Configuration data for Madera devices
32 *
33 * @reset: GPIO controlling /RESET (NULL = none)
34 * @ldo1: Substruct of pdata for the LDO1 regulator
35 * @micvdd: Substruct of pdata for the MICVDD regulator
36 * @irq_flags: Mode for primary IRQ (defaults to active low)
37 * @gpio_base: Base GPIO number
38 * @gpio_configs: Array of GPIO configurations (See Documentation/pinctrl.txt)
39 * @n_gpio_configs: Number of entries in gpio_configs
40 * @gpsw: General purpose switch mode setting. Depends on the external
41 * hardware connected to the switch. (See the SW1_MODE field
42 * in the datasheet for the available values for your codec)
43 */
44struct madera_pdata {
45 struct gpio_desc *reset;
46
47 struct arizona_ldo1_pdata ldo1;
48 struct arizona_micsupp_pdata micvdd;
49
50 unsigned int irq_flags;
51 int gpio_base;
52
53 const struct pinctrl_map *gpio_configs;
54 int n_gpio_configs;
55
56 u32 gpsw[MADERA_MAX_GPSW];
57};
58
59#endif
diff --git a/include/linux/mfd/madera/registers.h b/include/linux/mfd/madera/registers.h
new file mode 100644
index 000000000000..977e06101711
--- /dev/null
+++ b/include/linux/mfd/madera/registers.h
@@ -0,0 +1,3968 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Madera register definitions
4 *
5 * Copyright (C) 2015-2018 Cirrus Logic
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; version 2.
10 */
11
12#ifndef MADERA_REGISTERS_H
13#define MADERA_REGISTERS_H
14
15/*
16 * Register Addresses.
17 */
18#define MADERA_SOFTWARE_RESET 0x00
19#define MADERA_HARDWARE_REVISION 0x01
20#define MADERA_CTRL_IF_CFG_1 0x08
21#define MADERA_CTRL_IF_CFG_2 0x09
22#define MADERA_CTRL_IF_CFG_3 0x0A
23#define MADERA_WRITE_SEQUENCER_CTRL_0 0x16
24#define MADERA_WRITE_SEQUENCER_CTRL_1 0x17
25#define MADERA_WRITE_SEQUENCER_CTRL_2 0x18
26#define MADERA_TONE_GENERATOR_1 0x20
27#define MADERA_TONE_GENERATOR_2 0x21
28#define MADERA_TONE_GENERATOR_3 0x22
29#define MADERA_TONE_GENERATOR_4 0x23
30#define MADERA_TONE_GENERATOR_5 0x24
31#define MADERA_PWM_DRIVE_1 0x30
32#define MADERA_PWM_DRIVE_2 0x31
33#define MADERA_PWM_DRIVE_3 0x32
34#define MADERA_SEQUENCE_CONTROL 0x41
35#define MADERA_SAMPLE_RATE_SEQUENCE_SELECT_1 0x61
36#define MADERA_SAMPLE_RATE_SEQUENCE_SELECT_2 0x62
37#define MADERA_SAMPLE_RATE_SEQUENCE_SELECT_3 0x63
38#define MADERA_SAMPLE_RATE_SEQUENCE_SELECT_4 0x64
39#define MADERA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_1 0x66
40#define MADERA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_2 0x67
41#define MADERA_HAPTICS_CONTROL_1 0x90
42#define MADERA_HAPTICS_CONTROL_2 0x91
43#define MADERA_HAPTICS_PHASE_1_INTENSITY 0x92
44#define MADERA_HAPTICS_PHASE_1_DURATION 0x93
45#define MADERA_HAPTICS_PHASE_2_INTENSITY 0x94
46#define MADERA_HAPTICS_PHASE_2_DURATION 0x95
47#define MADERA_HAPTICS_PHASE_3_INTENSITY 0x96
48#define MADERA_HAPTICS_PHASE_3_DURATION 0x97
49#define MADERA_HAPTICS_STATUS 0x98
50#define MADERA_COMFORT_NOISE_GENERATOR 0xA0
51#define MADERA_CLOCK_32K_1 0x100
52#define MADERA_SYSTEM_CLOCK_1 0x101
53#define MADERA_SAMPLE_RATE_1 0x102
54#define MADERA_SAMPLE_RATE_2 0x103
55#define MADERA_SAMPLE_RATE_3 0x104
56#define MADERA_SAMPLE_RATE_1_STATUS 0x10A
57#define MADERA_SAMPLE_RATE_2_STATUS 0x10B
58#define MADERA_SAMPLE_RATE_3_STATUS 0x10C
59#define MADERA_ASYNC_CLOCK_1 0x112
60#define MADERA_ASYNC_SAMPLE_RATE_1 0x113
61#define MADERA_ASYNC_SAMPLE_RATE_2 0x114
62#define MADERA_ASYNC_SAMPLE_RATE_1_STATUS 0x11B
63#define MADERA_ASYNC_SAMPLE_RATE_2_STATUS 0x11C
64#define MADERA_DSP_CLOCK_1 0x120
65#define MADERA_DSP_CLOCK_2 0x122
66#define MADERA_OUTPUT_SYSTEM_CLOCK 0x149
67#define MADERA_OUTPUT_ASYNC_CLOCK 0x14A
68#define MADERA_RATE_ESTIMATOR_1 0x152
69#define MADERA_RATE_ESTIMATOR_2 0x153
70#define MADERA_RATE_ESTIMATOR_3 0x154
71#define MADERA_RATE_ESTIMATOR_4 0x155
72#define MADERA_RATE_ESTIMATOR_5 0x156
73#define MADERA_FLL1_CONTROL_1 0x171
74#define MADERA_FLL1_CONTROL_2 0x172
75#define MADERA_FLL1_CONTROL_3 0x173
76#define MADERA_FLL1_CONTROL_4 0x174
77#define MADERA_FLL1_CONTROL_5 0x175
78#define MADERA_FLL1_CONTROL_6 0x176
79#define MADERA_FLL1_LOOP_FILTER_TEST_1 0x177
80#define MADERA_FLL1_NCO_TEST_0 0x178
81#define MADERA_FLL1_CONTROL_7 0x179
82#define MADERA_FLL1_EFS_2 0x17A
83#define CS47L35_FLL1_SYNCHRONISER_1 0x17F
84#define CS47L35_FLL1_SYNCHRONISER_2 0x180
85#define CS47L35_FLL1_SYNCHRONISER_3 0x181
86#define CS47L35_FLL1_SYNCHRONISER_4 0x182
87#define CS47L35_FLL1_SYNCHRONISER_5 0x183
88#define CS47L35_FLL1_SYNCHRONISER_6 0x184
89#define CS47L35_FLL1_SYNCHRONISER_7 0x185
90#define CS47L35_FLL1_SPREAD_SPECTRUM 0x187
91#define CS47L35_FLL1_GPIO_CLOCK 0x188
92#define MADERA_FLL1_SYNCHRONISER_1 0x181
93#define MADERA_FLL1_SYNCHRONISER_2 0x182
94#define MADERA_FLL1_SYNCHRONISER_3 0x183
95#define MADERA_FLL1_SYNCHRONISER_4 0x184
96#define MADERA_FLL1_SYNCHRONISER_5 0x185
97#define MADERA_FLL1_SYNCHRONISER_6 0x186
98#define MADERA_FLL1_SYNCHRONISER_7 0x187
99#define MADERA_FLL1_SPREAD_SPECTRUM 0x189
100#define MADERA_FLL1_GPIO_CLOCK 0x18A
101#define MADERA_FLL2_CONTROL_1 0x191
102#define MADERA_FLL2_CONTROL_2 0x192
103#define MADERA_FLL2_CONTROL_3 0x193
104#define MADERA_FLL2_CONTROL_4 0x194
105#define MADERA_FLL2_CONTROL_5 0x195
106#define MADERA_FLL2_CONTROL_6 0x196
107#define MADERA_FLL2_LOOP_FILTER_TEST_1 0x197
108#define MADERA_FLL2_NCO_TEST_0 0x198
109#define MADERA_FLL2_CONTROL_7 0x199
110#define MADERA_FLL2_EFS_2 0x19A
111#define MADERA_FLL2_SYNCHRONISER_1 0x1A1
112#define MADERA_FLL2_SYNCHRONISER_2 0x1A2
113#define MADERA_FLL2_SYNCHRONISER_3 0x1A3
114#define MADERA_FLL2_SYNCHRONISER_4 0x1A4
115#define MADERA_FLL2_SYNCHRONISER_5 0x1A5
116#define MADERA_FLL2_SYNCHRONISER_6 0x1A6
117#define MADERA_FLL2_SYNCHRONISER_7 0x1A7
118#define MADERA_FLL2_SPREAD_SPECTRUM 0x1A9
119#define MADERA_FLL2_GPIO_CLOCK 0x1AA
120#define MADERA_FLL3_CONTROL_1 0x1B1
121#define MADERA_FLL3_CONTROL_2 0x1B2
122#define MADERA_FLL3_CONTROL_3 0x1B3
123#define MADERA_FLL3_CONTROL_4 0x1B4
124#define MADERA_FLL3_CONTROL_5 0x1B5
125#define MADERA_FLL3_CONTROL_6 0x1B6
126#define MADERA_FLL3_LOOP_FILTER_TEST_1 0x1B7
127#define MADERA_FLL3_NCO_TEST_0 0x1B8
128#define MADERA_FLL3_CONTROL_7 0x1B9
129#define MADERA_FLL3_SYNCHRONISER_1 0x1C1
130#define MADERA_FLL3_SYNCHRONISER_2 0x1C2
131#define MADERA_FLL3_SYNCHRONISER_3 0x1C3
132#define MADERA_FLL3_SYNCHRONISER_4 0x1C4
133#define MADERA_FLL3_SYNCHRONISER_5 0x1C5
134#define MADERA_FLL3_SYNCHRONISER_6 0x1C6
135#define MADERA_FLL3_SYNCHRONISER_7 0x1C7
136#define MADERA_FLL3_SPREAD_SPECTRUM 0x1C9
137#define MADERA_FLL3_GPIO_CLOCK 0x1CA
138#define MADERA_FLLAO_CONTROL_1 0x1D1
139#define MADERA_FLLAO_CONTROL_2 0x1D2
140#define MADERA_FLLAO_CONTROL_3 0x1D3
141#define MADERA_FLLAO_CONTROL_4 0x1D4
142#define MADERA_FLLAO_CONTROL_5 0x1D5
143#define MADERA_FLLAO_CONTROL_6 0x1D6
144#define MADERA_FLLAO_CONTROL_7 0x1D8
145#define MADERA_FLLAO_CONTROL_8 0x1DA
146#define MADERA_FLLAO_CONTROL_9 0x1DB
147#define MADERA_FLLAO_CONTROL_10 0x1DC
148#define MADERA_FLLAO_CONTROL_11 0x1DD
149#define MADERA_MIC_CHARGE_PUMP_1 0x200
150#define MADERA_HP_CHARGE_PUMP_8 0x20B
151#define MADERA_LDO1_CONTROL_1 0x210
152#define MADERA_LDO2_CONTROL_1 0x213
153#define MADERA_MIC_BIAS_CTRL_1 0x218
154#define MADERA_MIC_BIAS_CTRL_2 0x219
155#define MADERA_MIC_BIAS_CTRL_3 0x21A
156#define MADERA_MIC_BIAS_CTRL_4 0x21B
157#define MADERA_MIC_BIAS_CTRL_5 0x21C
158#define MADERA_MIC_BIAS_CTRL_6 0x21E
159#define MADERA_HP_CTRL_1L 0x225
160#define MADERA_HP_CTRL_1R 0x226
161#define MADERA_HP_CTRL_2L 0x227
162#define MADERA_HP_CTRL_2R 0x228
163#define MADERA_HP_CTRL_3L 0x229
164#define MADERA_HP_CTRL_3R 0x22A
165#define MADERA_DCS_HP1L_CONTROL 0x232
166#define MADERA_DCS_HP1R_CONTROL 0x238
167#define MADERA_EDRE_HP_STEREO_CONTROL 0x27E
168#define MADERA_ACCESSORY_DETECT_MODE_1 0x293
169#define MADERA_HEADPHONE_DETECT_0 0x299
170#define MADERA_HEADPHONE_DETECT_1 0x29B
171#define MADERA_HEADPHONE_DETECT_2 0x29C
172#define MADERA_HEADPHONE_DETECT_3 0x29D
173#define MADERA_HEADPHONE_DETECT_4 0x29E
174#define MADERA_HEADPHONE_DETECT_5 0x29F
175#define MADERA_MIC_DETECT_1_CONTROL_0 0x2A2
176#define MADERA_MIC_DETECT_1_CONTROL_1 0x2A3
177#define MADERA_MIC_DETECT_1_CONTROL_2 0x2A4
178#define MADERA_MIC_DETECT_1_CONTROL_3 0x2A5
179#define MADERA_MIC_DETECT_1_LEVEL_1 0x2A6
180#define MADERA_MIC_DETECT_1_LEVEL_2 0x2A7
181#define MADERA_MIC_DETECT_1_LEVEL_3 0x2A8
182#define MADERA_MIC_DETECT_1_LEVEL_4 0x2A9
183#define MADERA_MIC_DETECT_1_CONTROL_4 0x2AB
184#define MADERA_MIC_DETECT_2_CONTROL_0 0x2B2
185#define MADERA_MIC_DETECT_2_CONTROL_1 0x2B3
186#define MADERA_MIC_DETECT_2_CONTROL_2 0x2B4
187#define MADERA_MIC_DETECT_2_CONTROL_3 0x2B5
188#define MADERA_MIC_DETECT_2_LEVEL_1 0x2B6
189#define MADERA_MIC_DETECT_2_LEVEL_2 0x2B7
190#define MADERA_MIC_DETECT_2_LEVEL_3 0x2B8
191#define MADERA_MIC_DETECT_2_LEVEL_4 0x2B9
192#define MADERA_MIC_DETECT_2_CONTROL_4 0x2BB
193#define MADERA_MICD_CLAMP_CONTROL 0x2C6
194#define MADERA_GP_SWITCH_1 0x2C8
195#define MADERA_JACK_DETECT_ANALOGUE 0x2D3
196#define MADERA_INPUT_ENABLES 0x300
197#define MADERA_INPUT_ENABLES_STATUS 0x301
198#define MADERA_INPUT_RATE 0x308
199#define MADERA_INPUT_VOLUME_RAMP 0x309
200#define MADERA_HPF_CONTROL 0x30C
201#define MADERA_IN1L_CONTROL 0x310
202#define MADERA_ADC_DIGITAL_VOLUME_1L 0x311
203#define MADERA_DMIC1L_CONTROL 0x312
204#define MADERA_IN1L_RATE_CONTROL 0x313
205#define MADERA_IN1R_CONTROL 0x314
206#define MADERA_ADC_DIGITAL_VOLUME_1R 0x315
207#define MADERA_DMIC1R_CONTROL 0x316
208#define MADERA_IN1R_RATE_CONTROL 0x317
209#define MADERA_IN2L_CONTROL 0x318
210#define MADERA_ADC_DIGITAL_VOLUME_2L 0x319
211#define MADERA_DMIC2L_CONTROL 0x31A
212#define MADERA_IN2L_RATE_CONTROL 0x31B
213#define MADERA_IN2R_CONTROL 0x31C
214#define MADERA_ADC_DIGITAL_VOLUME_2R 0x31D
215#define MADERA_DMIC2R_CONTROL 0x31E
216#define MADERA_IN2R_RATE_CONTROL 0x31F
217#define MADERA_IN3L_CONTROL 0x320
218#define MADERA_ADC_DIGITAL_VOLUME_3L 0x321
219#define MADERA_DMIC3L_CONTROL 0x322
220#define MADERA_IN3L_RATE_CONTROL 0x323
221#define MADERA_IN3R_CONTROL 0x324
222#define MADERA_ADC_DIGITAL_VOLUME_3R 0x325
223#define MADERA_DMIC3R_CONTROL 0x326
224#define MADERA_IN3R_RATE_CONTROL 0x327
225#define MADERA_IN4L_CONTROL 0x328
226#define MADERA_ADC_DIGITAL_VOLUME_4L 0x329
227#define MADERA_DMIC4L_CONTROL 0x32A
228#define MADERA_IN4L_RATE_CONTROL 0x32B
229#define MADERA_IN4R_CONTROL 0x32C
230#define MADERA_ADC_DIGITAL_VOLUME_4R 0x32D
231#define MADERA_DMIC4R_CONTROL 0x32E
232#define MADERA_IN4R_RATE_CONTROL 0x32F
233#define MADERA_IN5L_CONTROL 0x330
234#define MADERA_ADC_DIGITAL_VOLUME_5L 0x331
235#define MADERA_DMIC5L_CONTROL 0x332
236#define MADERA_IN5L_RATE_CONTROL 0x333
237#define MADERA_IN5R_CONTROL 0x334
238#define MADERA_ADC_DIGITAL_VOLUME_5R 0x335
239#define MADERA_DMIC5R_CONTROL 0x336
240#define MADERA_IN5R_RATE_CONTROL 0x337
241#define MADERA_IN6L_CONTROL 0x338
242#define MADERA_ADC_DIGITAL_VOLUME_6L 0x339
243#define MADERA_DMIC6L_CONTROL 0x33A
244#define MADERA_IN6R_CONTROL 0x33C
245#define MADERA_ADC_DIGITAL_VOLUME_6R 0x33D
246#define MADERA_DMIC6R_CONTROL 0x33E
247#define MADERA_OUTPUT_ENABLES_1 0x400
248#define MADERA_OUTPUT_STATUS_1 0x401
249#define MADERA_RAW_OUTPUT_STATUS_1 0x406
250#define MADERA_OUTPUT_RATE_1 0x408
251#define MADERA_OUTPUT_VOLUME_RAMP 0x409
252#define MADERA_OUTPUT_PATH_CONFIG_1L 0x410
253#define MADERA_DAC_DIGITAL_VOLUME_1L 0x411
254#define MADERA_OUTPUT_PATH_CONFIG_1 0x412
255#define MADERA_NOISE_GATE_SELECT_1L 0x413
256#define MADERA_OUTPUT_PATH_CONFIG_1R 0x414
257#define MADERA_DAC_DIGITAL_VOLUME_1R 0x415
258#define MADERA_NOISE_GATE_SELECT_1R 0x417
259#define MADERA_OUTPUT_PATH_CONFIG_2L 0x418
260#define MADERA_DAC_DIGITAL_VOLUME_2L 0x419
261#define MADERA_OUTPUT_PATH_CONFIG_2 0x41A
262#define MADERA_NOISE_GATE_SELECT_2L 0x41B
263#define MADERA_OUTPUT_PATH_CONFIG_2R 0x41C
264#define MADERA_DAC_DIGITAL_VOLUME_2R 0x41D
265#define MADERA_NOISE_GATE_SELECT_2R 0x41F
266#define MADERA_OUTPUT_PATH_CONFIG_3L 0x420
267#define MADERA_DAC_DIGITAL_VOLUME_3L 0x421
268#define MADERA_NOISE_GATE_SELECT_3L 0x423
269#define MADERA_OUTPUT_PATH_CONFIG_3R 0x424
270#define MADERA_DAC_DIGITAL_VOLUME_3R 0x425
271#define MADERA_NOISE_GATE_SELECT_3R 0x427
272#define MADERA_OUTPUT_PATH_CONFIG_4L 0x428
273#define MADERA_DAC_DIGITAL_VOLUME_4L 0x429
274#define MADERA_NOISE_GATE_SELECT_4L 0x42B
275#define MADERA_OUTPUT_PATH_CONFIG_4R 0x42C
276#define MADERA_DAC_DIGITAL_VOLUME_4R 0x42D
277#define MADERA_NOISE_GATE_SELECT_4R 0x42F
278#define MADERA_OUTPUT_PATH_CONFIG_5L 0x430
279#define MADERA_DAC_DIGITAL_VOLUME_5L 0x431
280#define MADERA_NOISE_GATE_SELECT_5L 0x433
281#define MADERA_OUTPUT_PATH_CONFIG_5R 0x434
282#define MADERA_DAC_DIGITAL_VOLUME_5R 0x435
283#define MADERA_NOISE_GATE_SELECT_5R 0x437
284#define MADERA_OUTPUT_PATH_CONFIG_6L 0x438
285#define MADERA_DAC_DIGITAL_VOLUME_6L 0x439
286#define MADERA_NOISE_GATE_SELECT_6L 0x43B
287#define MADERA_OUTPUT_PATH_CONFIG_6R 0x43C
288#define MADERA_DAC_DIGITAL_VOLUME_6R 0x43D
289#define MADERA_NOISE_GATE_SELECT_6R 0x43F
290#define MADERA_DRE_ENABLE 0x440
291#define MADERA_EDRE_ENABLE 0x448
292#define MADERA_EDRE_MANUAL 0x44A
293#define MADERA_DAC_AEC_CONTROL_1 0x450
294#define MADERA_DAC_AEC_CONTROL_2 0x451
295#define MADERA_NOISE_GATE_CONTROL 0x458
296#define MADERA_PDM_SPK1_CTRL_1 0x490
297#define MADERA_PDM_SPK1_CTRL_2 0x491
298#define MADERA_PDM_SPK2_CTRL_1 0x492
299#define MADERA_PDM_SPK2_CTRL_2 0x493
300#define MADERA_HP1_SHORT_CIRCUIT_CTRL 0x4A0
301#define MADERA_HP2_SHORT_CIRCUIT_CTRL 0x4A1
302#define MADERA_HP3_SHORT_CIRCUIT_CTRL 0x4A2
303#define MADERA_HP_TEST_CTRL_1 0x4A4
304#define MADERA_HP_TEST_CTRL_5 0x4A8
305#define MADERA_HP_TEST_CTRL_6 0x4A9
306#define MADERA_AIF1_BCLK_CTRL 0x500
307#define MADERA_AIF1_TX_PIN_CTRL 0x501
308#define MADERA_AIF1_RX_PIN_CTRL 0x502
309#define MADERA_AIF1_RATE_CTRL 0x503
310#define MADERA_AIF1_FORMAT 0x504
311#define MADERA_AIF1_RX_BCLK_RATE 0x506
312#define MADERA_AIF1_FRAME_CTRL_1 0x507
313#define MADERA_AIF1_FRAME_CTRL_2 0x508
314#define MADERA_AIF1_FRAME_CTRL_3 0x509
315#define MADERA_AIF1_FRAME_CTRL_4 0x50A
316#define MADERA_AIF1_FRAME_CTRL_5 0x50B
317#define MADERA_AIF1_FRAME_CTRL_6 0x50C
318#define MADERA_AIF1_FRAME_CTRL_7 0x50D
319#define MADERA_AIF1_FRAME_CTRL_8 0x50E
320#define MADERA_AIF1_FRAME_CTRL_9 0x50F
321#define MADERA_AIF1_FRAME_CTRL_10 0x510
322#define MADERA_AIF1_FRAME_CTRL_11 0x511
323#define MADERA_AIF1_FRAME_CTRL_12 0x512
324#define MADERA_AIF1_FRAME_CTRL_13 0x513
325#define MADERA_AIF1_FRAME_CTRL_14 0x514
326#define MADERA_AIF1_FRAME_CTRL_15 0x515
327#define MADERA_AIF1_FRAME_CTRL_16 0x516
328#define MADERA_AIF1_FRAME_CTRL_17 0x517
329#define MADERA_AIF1_FRAME_CTRL_18 0x518
330#define MADERA_AIF1_TX_ENABLES 0x519
331#define MADERA_AIF1_RX_ENABLES 0x51A
332#define MADERA_AIF1_FORCE_WRITE 0x51B
333#define MADERA_AIF2_BCLK_CTRL 0x540
334#define MADERA_AIF2_TX_PIN_CTRL 0x541
335#define MADERA_AIF2_RX_PIN_CTRL 0x542
336#define MADERA_AIF2_RATE_CTRL 0x543
337#define MADERA_AIF2_FORMAT 0x544
338#define MADERA_AIF2_RX_BCLK_RATE 0x546
339#define MADERA_AIF2_FRAME_CTRL_1 0x547
340#define MADERA_AIF2_FRAME_CTRL_2 0x548
341#define MADERA_AIF2_FRAME_CTRL_3 0x549
342#define MADERA_AIF2_FRAME_CTRL_4 0x54A
343#define MADERA_AIF2_FRAME_CTRL_5 0x54B
344#define MADERA_AIF2_FRAME_CTRL_6 0x54C
345#define MADERA_AIF2_FRAME_CTRL_7 0x54D
346#define MADERA_AIF2_FRAME_CTRL_8 0x54E
347#define MADERA_AIF2_FRAME_CTRL_9 0x54F
348#define MADERA_AIF2_FRAME_CTRL_10 0x550
349#define MADERA_AIF2_FRAME_CTRL_11 0x551
350#define MADERA_AIF2_FRAME_CTRL_12 0x552
351#define MADERA_AIF2_FRAME_CTRL_13 0x553
352#define MADERA_AIF2_FRAME_CTRL_14 0x554
353#define MADERA_AIF2_FRAME_CTRL_15 0x555
354#define MADERA_AIF2_FRAME_CTRL_16 0x556
355#define MADERA_AIF2_FRAME_CTRL_17 0x557
356#define MADERA_AIF2_FRAME_CTRL_18 0x558
357#define MADERA_AIF2_TX_ENABLES 0x559
358#define MADERA_AIF2_RX_ENABLES 0x55A
359#define MADERA_AIF2_FORCE_WRITE 0x55B
360#define MADERA_AIF3_BCLK_CTRL 0x580
361#define MADERA_AIF3_TX_PIN_CTRL 0x581
362#define MADERA_AIF3_RX_PIN_CTRL 0x582
363#define MADERA_AIF3_RATE_CTRL 0x583
364#define MADERA_AIF3_FORMAT 0x584
365#define MADERA_AIF3_RX_BCLK_RATE 0x586
366#define MADERA_AIF3_FRAME_CTRL_1 0x587
367#define MADERA_AIF3_FRAME_CTRL_2 0x588
368#define MADERA_AIF3_FRAME_CTRL_3 0x589
369#define MADERA_AIF3_FRAME_CTRL_4 0x58A
370#define MADERA_AIF3_FRAME_CTRL_11 0x591
371#define MADERA_AIF3_FRAME_CTRL_12 0x592
372#define MADERA_AIF3_TX_ENABLES 0x599
373#define MADERA_AIF3_RX_ENABLES 0x59A
374#define MADERA_AIF3_FORCE_WRITE 0x59B
375#define MADERA_AIF4_BCLK_CTRL 0x5A0
376#define MADERA_AIF4_TX_PIN_CTRL 0x5A1
377#define MADERA_AIF4_RX_PIN_CTRL 0x5A2
378#define MADERA_AIF4_RATE_CTRL 0x5A3
379#define MADERA_AIF4_FORMAT 0x5A4
380#define MADERA_AIF4_RX_BCLK_RATE 0x5A6
381#define MADERA_AIF4_FRAME_CTRL_1 0x5A7
382#define MADERA_AIF4_FRAME_CTRL_2 0x5A8
383#define MADERA_AIF4_FRAME_CTRL_3 0x5A9
384#define MADERA_AIF4_FRAME_CTRL_4 0x5AA
385#define MADERA_AIF4_FRAME_CTRL_11 0x5B1
386#define MADERA_AIF4_FRAME_CTRL_12 0x5B2
387#define MADERA_AIF4_TX_ENABLES 0x5B9
388#define MADERA_AIF4_RX_ENABLES 0x5BA
389#define MADERA_AIF4_FORCE_WRITE 0x5BB
390#define MADERA_SPD1_TX_CONTROL 0x5C2
391#define MADERA_SPD1_TX_CHANNEL_STATUS_1 0x5C3
392#define MADERA_SPD1_TX_CHANNEL_STATUS_2 0x5C4
393#define MADERA_SPD1_TX_CHANNEL_STATUS_3 0x5C5
394#define MADERA_SLIMBUS_FRAMER_REF_GEAR 0x5E3
395#define MADERA_SLIMBUS_RATES_1 0x5E5
396#define MADERA_SLIMBUS_RATES_2 0x5E6
397#define MADERA_SLIMBUS_RATES_3 0x5E7
398#define MADERA_SLIMBUS_RATES_4 0x5E8
399#define MADERA_SLIMBUS_RATES_5 0x5E9
400#define MADERA_SLIMBUS_RATES_6 0x5EA
401#define MADERA_SLIMBUS_RATES_7 0x5EB
402#define MADERA_SLIMBUS_RATES_8 0x5EC
403#define MADERA_SLIMBUS_RX_CHANNEL_ENABLE 0x5F5
404#define MADERA_SLIMBUS_TX_CHANNEL_ENABLE 0x5F6
405#define MADERA_SLIMBUS_RX_PORT_STATUS 0x5F7
406#define MADERA_SLIMBUS_TX_PORT_STATUS 0x5F8
407#define MADERA_PWM1MIX_INPUT_1_SOURCE 0x640
408#define MADERA_PWM1MIX_INPUT_1_VOLUME 0x641
409#define MADERA_PWM1MIX_INPUT_2_SOURCE 0x642
410#define MADERA_PWM1MIX_INPUT_2_VOLUME 0x643
411#define MADERA_PWM1MIX_INPUT_3_SOURCE 0x644
412#define MADERA_PWM1MIX_INPUT_3_VOLUME 0x645
413#define MADERA_PWM1MIX_INPUT_4_SOURCE 0x646
414#define MADERA_PWM1MIX_INPUT_4_VOLUME 0x647
415#define MADERA_PWM2MIX_INPUT_1_SOURCE 0x648
416#define MADERA_PWM2MIX_INPUT_1_VOLUME 0x649
417#define MADERA_PWM2MIX_INPUT_2_SOURCE 0x64A
418#define MADERA_PWM2MIX_INPUT_2_VOLUME 0x64B
419#define MADERA_PWM2MIX_INPUT_3_SOURCE 0x64C
420#define MADERA_PWM2MIX_INPUT_3_VOLUME 0x64D
421#define MADERA_PWM2MIX_INPUT_4_SOURCE 0x64E
422#define MADERA_PWM2MIX_INPUT_4_VOLUME 0x64F
423#define MADERA_OUT1LMIX_INPUT_1_SOURCE 0x680
424#define MADERA_OUT1LMIX_INPUT_1_VOLUME 0x681
425#define MADERA_OUT1LMIX_INPUT_2_SOURCE 0x682
426#define MADERA_OUT1LMIX_INPUT_2_VOLUME 0x683
427#define MADERA_OUT1LMIX_INPUT_3_SOURCE 0x684
428#define MADERA_OUT1LMIX_INPUT_3_VOLUME 0x685
429#define MADERA_OUT1LMIX_INPUT_4_SOURCE 0x686
430#define MADERA_OUT1LMIX_INPUT_4_VOLUME 0x687
431#define MADERA_OUT1RMIX_INPUT_1_SOURCE 0x688
432#define MADERA_OUT1RMIX_INPUT_1_VOLUME 0x689
433#define MADERA_OUT1RMIX_INPUT_2_SOURCE 0x68A
434#define MADERA_OUT1RMIX_INPUT_2_VOLUME 0x68B
435#define MADERA_OUT1RMIX_INPUT_3_SOURCE 0x68C
436#define MADERA_OUT1RMIX_INPUT_3_VOLUME 0x68D
437#define MADERA_OUT1RMIX_INPUT_4_SOURCE 0x68E
438#define MADERA_OUT1RMIX_INPUT_4_VOLUME 0x68F
439#define MADERA_OUT2LMIX_INPUT_1_SOURCE 0x690
440#define MADERA_OUT2LMIX_INPUT_1_VOLUME 0x691
441#define MADERA_OUT2LMIX_INPUT_2_SOURCE 0x692
442#define MADERA_OUT2LMIX_INPUT_2_VOLUME 0x693
443#define MADERA_OUT2LMIX_INPUT_3_SOURCE 0x694
444#define MADERA_OUT2LMIX_INPUT_3_VOLUME 0x695
445#define MADERA_OUT2LMIX_INPUT_4_SOURCE 0x696
446#define MADERA_OUT2LMIX_INPUT_4_VOLUME 0x697
447#define MADERA_OUT2RMIX_INPUT_1_SOURCE 0x698
448#define MADERA_OUT2RMIX_INPUT_1_VOLUME 0x699
449#define MADERA_OUT2RMIX_INPUT_2_SOURCE 0x69A
450#define MADERA_OUT2RMIX_INPUT_2_VOLUME 0x69B
451#define MADERA_OUT2RMIX_INPUT_3_SOURCE 0x69C
452#define MADERA_OUT2RMIX_INPUT_3_VOLUME 0x69D
453#define MADERA_OUT2RMIX_INPUT_4_SOURCE 0x69E
454#define MADERA_OUT2RMIX_INPUT_4_VOLUME 0x69F
455#define MADERA_OUT3LMIX_INPUT_1_SOURCE 0x6A0
456#define MADERA_OUT3LMIX_INPUT_1_VOLUME 0x6A1
457#define MADERA_OUT3LMIX_INPUT_2_SOURCE 0x6A2
458#define MADERA_OUT3LMIX_INPUT_2_VOLUME 0x6A3
459#define MADERA_OUT3LMIX_INPUT_3_SOURCE 0x6A4
460#define MADERA_OUT3LMIX_INPUT_3_VOLUME 0x6A5
461#define MADERA_OUT3LMIX_INPUT_4_SOURCE 0x6A6
462#define MADERA_OUT3LMIX_INPUT_4_VOLUME 0x6A7
463#define MADERA_OUT3RMIX_INPUT_1_SOURCE 0x6A8
464#define MADERA_OUT3RMIX_INPUT_1_VOLUME 0x6A9
465#define MADERA_OUT3RMIX_INPUT_2_SOURCE 0x6AA
466#define MADERA_OUT3RMIX_INPUT_2_VOLUME 0x6AB
467#define MADERA_OUT3RMIX_INPUT_3_SOURCE 0x6AC
468#define MADERA_OUT3RMIX_INPUT_3_VOLUME 0x6AD
469#define MADERA_OUT3RMIX_INPUT_4_SOURCE 0x6AE
470#define MADERA_OUT3RMIX_INPUT_4_VOLUME 0x6AF
471#define MADERA_OUT4LMIX_INPUT_1_SOURCE 0x6B0
472#define MADERA_OUT4LMIX_INPUT_1_VOLUME 0x6B1
473#define MADERA_OUT4LMIX_INPUT_2_SOURCE 0x6B2
474#define MADERA_OUT4LMIX_INPUT_2_VOLUME 0x6B3
475#define MADERA_OUT4LMIX_INPUT_3_SOURCE 0x6B4
476#define MADERA_OUT4LMIX_INPUT_3_VOLUME 0x6B5
477#define MADERA_OUT4LMIX_INPUT_4_SOURCE 0x6B6
478#define MADERA_OUT4LMIX_INPUT_4_VOLUME 0x6B7
479#define MADERA_OUT4RMIX_INPUT_1_SOURCE 0x6B8
480#define MADERA_OUT4RMIX_INPUT_1_VOLUME 0x6B9
481#define MADERA_OUT4RMIX_INPUT_2_SOURCE 0x6BA
482#define MADERA_OUT4RMIX_INPUT_2_VOLUME 0x6BB
483#define MADERA_OUT4RMIX_INPUT_3_SOURCE 0x6BC
484#define MADERA_OUT4RMIX_INPUT_3_VOLUME 0x6BD
485#define MADERA_OUT4RMIX_INPUT_4_SOURCE 0x6BE
486#define MADERA_OUT4RMIX_INPUT_4_VOLUME 0x6BF
487#define MADERA_OUT5LMIX_INPUT_1_SOURCE 0x6C0
488#define MADERA_OUT5LMIX_INPUT_1_VOLUME 0x6C1
489#define MADERA_OUT5LMIX_INPUT_2_SOURCE 0x6C2
490#define MADERA_OUT5LMIX_INPUT_2_VOLUME 0x6C3
491#define MADERA_OUT5LMIX_INPUT_3_SOURCE 0x6C4
492#define MADERA_OUT5LMIX_INPUT_3_VOLUME 0x6C5
493#define MADERA_OUT5LMIX_INPUT_4_SOURCE 0x6C6
494#define MADERA_OUT5LMIX_INPUT_4_VOLUME 0x6C7
495#define MADERA_OUT5RMIX_INPUT_1_SOURCE 0x6C8
496#define MADERA_OUT5RMIX_INPUT_1_VOLUME 0x6C9
497#define MADERA_OUT5RMIX_INPUT_2_SOURCE 0x6CA
498#define MADERA_OUT5RMIX_INPUT_2_VOLUME 0x6CB
499#define MADERA_OUT5RMIX_INPUT_3_SOURCE 0x6CC
500#define MADERA_OUT5RMIX_INPUT_3_VOLUME 0x6CD
501#define MADERA_OUT5RMIX_INPUT_4_SOURCE 0x6CE
502#define MADERA_OUT5RMIX_INPUT_4_VOLUME 0x6CF
503#define MADERA_OUT6LMIX_INPUT_1_SOURCE 0x6D0
504#define MADERA_OUT6LMIX_INPUT_1_VOLUME 0x6D1
505#define MADERA_OUT6LMIX_INPUT_2_SOURCE 0x6D2
506#define MADERA_OUT6LMIX_INPUT_2_VOLUME 0x6D3
507#define MADERA_OUT6LMIX_INPUT_3_SOURCE 0x6D4
508#define MADERA_OUT6LMIX_INPUT_3_VOLUME 0x6D5
509#define MADERA_OUT6LMIX_INPUT_4_SOURCE 0x6D6
510#define MADERA_OUT6LMIX_INPUT_4_VOLUME 0x6D7
511#define MADERA_OUT6RMIX_INPUT_1_SOURCE 0x6D8
512#define MADERA_OUT6RMIX_INPUT_1_VOLUME 0x6D9
513#define MADERA_OUT6RMIX_INPUT_2_SOURCE 0x6DA
514#define MADERA_OUT6RMIX_INPUT_2_VOLUME 0x6DB
515#define MADERA_OUT6RMIX_INPUT_3_SOURCE 0x6DC
516#define MADERA_OUT6RMIX_INPUT_3_VOLUME 0x6DD
517#define MADERA_OUT6RMIX_INPUT_4_SOURCE 0x6DE
518#define MADERA_OUT6RMIX_INPUT_4_VOLUME 0x6DF
519#define MADERA_AIF1TX1MIX_INPUT_1_SOURCE 0x700
520#define MADERA_AIF1TX1MIX_INPUT_1_VOLUME 0x701
521#define MADERA_AIF1TX1MIX_INPUT_2_SOURCE 0x702
522#define MADERA_AIF1TX1MIX_INPUT_2_VOLUME 0x703
523#define MADERA_AIF1TX1MIX_INPUT_3_SOURCE 0x704
524#define MADERA_AIF1TX1MIX_INPUT_3_VOLUME 0x705
525#define MADERA_AIF1TX1MIX_INPUT_4_SOURCE 0x706
526#define MADERA_AIF1TX1MIX_INPUT_4_VOLUME 0x707
527#define MADERA_AIF1TX2MIX_INPUT_1_SOURCE 0x708
528#define MADERA_AIF1TX2MIX_INPUT_1_VOLUME 0x709
529#define MADERA_AIF1TX2MIX_INPUT_2_SOURCE 0x70A
530#define MADERA_AIF1TX2MIX_INPUT_2_VOLUME 0x70B
531#define MADERA_AIF1TX2MIX_INPUT_3_SOURCE 0x70C
532#define MADERA_AIF1TX2MIX_INPUT_3_VOLUME 0x70D
533#define MADERA_AIF1TX2MIX_INPUT_4_SOURCE 0x70E
534#define MADERA_AIF1TX2MIX_INPUT_4_VOLUME 0x70F
535#define MADERA_AIF1TX3MIX_INPUT_1_SOURCE 0x710
536#define MADERA_AIF1TX3MIX_INPUT_1_VOLUME 0x711
537#define MADERA_AIF1TX3MIX_INPUT_2_SOURCE 0x712
538#define MADERA_AIF1TX3MIX_INPUT_2_VOLUME 0x713
539#define MADERA_AIF1TX3MIX_INPUT_3_SOURCE 0x714
540#define MADERA_AIF1TX3MIX_INPUT_3_VOLUME 0x715
541#define MADERA_AIF1TX3MIX_INPUT_4_SOURCE 0x716
542#define MADERA_AIF1TX3MIX_INPUT_4_VOLUME 0x717
543#define MADERA_AIF1TX4MIX_INPUT_1_SOURCE 0x718
544#define MADERA_AIF1TX4MIX_INPUT_1_VOLUME 0x719
545#define MADERA_AIF1TX4MIX_INPUT_2_SOURCE 0x71A
546#define MADERA_AIF1TX4MIX_INPUT_2_VOLUME 0x71B
547#define MADERA_AIF1TX4MIX_INPUT_3_SOURCE 0x71C
548#define MADERA_AIF1TX4MIX_INPUT_3_VOLUME 0x71D
549#define MADERA_AIF1TX4MIX_INPUT_4_SOURCE 0x71E
550#define MADERA_AIF1TX4MIX_INPUT_4_VOLUME 0x71F
551#define MADERA_AIF1TX5MIX_INPUT_1_SOURCE 0x720
552#define MADERA_AIF1TX5MIX_INPUT_1_VOLUME 0x721
553#define MADERA_AIF1TX5MIX_INPUT_2_SOURCE 0x722
554#define MADERA_AIF1TX5MIX_INPUT_2_VOLUME 0x723
555#define MADERA_AIF1TX5MIX_INPUT_3_SOURCE 0x724
556#define MADERA_AIF1TX5MIX_INPUT_3_VOLUME 0x725
557#define MADERA_AIF1TX5MIX_INPUT_4_SOURCE 0x726
558#define MADERA_AIF1TX5MIX_INPUT_4_VOLUME 0x727
559#define MADERA_AIF1TX6MIX_INPUT_1_SOURCE 0x728
560#define MADERA_AIF1TX6MIX_INPUT_1_VOLUME 0x729
561#define MADERA_AIF1TX6MIX_INPUT_2_SOURCE 0x72A
562#define MADERA_AIF1TX6MIX_INPUT_2_VOLUME 0x72B
563#define MADERA_AIF1TX6MIX_INPUT_3_SOURCE 0x72C
564#define MADERA_AIF1TX6MIX_INPUT_3_VOLUME 0x72D
565#define MADERA_AIF1TX6MIX_INPUT_4_SOURCE 0x72E
566#define MADERA_AIF1TX6MIX_INPUT_4_VOLUME 0x72F
567#define MADERA_AIF1TX7MIX_INPUT_1_SOURCE 0x730
568#define MADERA_AIF1TX7MIX_INPUT_1_VOLUME 0x731
569#define MADERA_AIF1TX7MIX_INPUT_2_SOURCE 0x732
570#define MADERA_AIF1TX7MIX_INPUT_2_VOLUME 0x733
571#define MADERA_AIF1TX7MIX_INPUT_3_SOURCE 0x734
572#define MADERA_AIF1TX7MIX_INPUT_3_VOLUME 0x735
573#define MADERA_AIF1TX7MIX_INPUT_4_SOURCE 0x736
574#define MADERA_AIF1TX7MIX_INPUT_4_VOLUME 0x737
575#define MADERA_AIF1TX8MIX_INPUT_1_SOURCE 0x738
576#define MADERA_AIF1TX8MIX_INPUT_1_VOLUME 0x739
577#define MADERA_AIF1TX8MIX_INPUT_2_SOURCE 0x73A
578#define MADERA_AIF1TX8MIX_INPUT_2_VOLUME 0x73B
579#define MADERA_AIF1TX8MIX_INPUT_3_SOURCE 0x73C
580#define MADERA_AIF1TX8MIX_INPUT_3_VOLUME 0x73D
581#define MADERA_AIF1TX8MIX_INPUT_4_SOURCE 0x73E
582#define MADERA_AIF1TX8MIX_INPUT_4_VOLUME 0x73F
583#define MADERA_AIF2TX1MIX_INPUT_1_SOURCE 0x740
584#define MADERA_AIF2TX1MIX_INPUT_1_VOLUME 0x741
585#define MADERA_AIF2TX1MIX_INPUT_2_SOURCE 0x742
586#define MADERA_AIF2TX1MIX_INPUT_2_VOLUME 0x743
587#define MADERA_AIF2TX1MIX_INPUT_3_SOURCE 0x744
588#define MADERA_AIF2TX1MIX_INPUT_3_VOLUME 0x745
589#define MADERA_AIF2TX1MIX_INPUT_4_SOURCE 0x746
590#define MADERA_AIF2TX1MIX_INPUT_4_VOLUME 0x747
591#define MADERA_AIF2TX2MIX_INPUT_1_SOURCE 0x748
592#define MADERA_AIF2TX2MIX_INPUT_1_VOLUME 0x749
593#define MADERA_AIF2TX2MIX_INPUT_2_SOURCE 0x74A
594#define MADERA_AIF2TX2MIX_INPUT_2_VOLUME 0x74B
595#define MADERA_AIF2TX2MIX_INPUT_3_SOURCE 0x74C
596#define MADERA_AIF2TX2MIX_INPUT_3_VOLUME 0x74D
597#define MADERA_AIF2TX2MIX_INPUT_4_SOURCE 0x74E
598#define MADERA_AIF2TX2MIX_INPUT_4_VOLUME 0x74F
599#define MADERA_AIF2TX3MIX_INPUT_1_SOURCE 0x750
600#define MADERA_AIF2TX3MIX_INPUT_1_VOLUME 0x751
601#define MADERA_AIF2TX3MIX_INPUT_2_SOURCE 0x752
602#define MADERA_AIF2TX3MIX_INPUT_2_VOLUME 0x753
603#define MADERA_AIF2TX3MIX_INPUT_3_SOURCE 0x754
604#define MADERA_AIF2TX3MIX_INPUT_3_VOLUME 0x755
605#define MADERA_AIF2TX3MIX_INPUT_4_SOURCE 0x756
606#define MADERA_AIF2TX3MIX_INPUT_4_VOLUME 0x757
607#define MADERA_AIF2TX4MIX_INPUT_1_SOURCE 0x758
608#define MADERA_AIF2TX4MIX_INPUT_1_VOLUME 0x759
609#define MADERA_AIF2TX4MIX_INPUT_2_SOURCE 0x75A
610#define MADERA_AIF2TX4MIX_INPUT_2_VOLUME 0x75B
611#define MADERA_AIF2TX4MIX_INPUT_3_SOURCE 0x75C
612#define MADERA_AIF2TX4MIX_INPUT_3_VOLUME 0x75D
613#define MADERA_AIF2TX4MIX_INPUT_4_SOURCE 0x75E
614#define MADERA_AIF2TX4MIX_INPUT_4_VOLUME 0x75F
615#define MADERA_AIF2TX5MIX_INPUT_1_SOURCE 0x760
616#define MADERA_AIF2TX5MIX_INPUT_1_VOLUME 0x761
617#define MADERA_AIF2TX5MIX_INPUT_2_SOURCE 0x762
618#define MADERA_AIF2TX5MIX_INPUT_2_VOLUME 0x763
619#define MADERA_AIF2TX5MIX_INPUT_3_SOURCE 0x764
620#define MADERA_AIF2TX5MIX_INPUT_3_VOLUME 0x765
621#define MADERA_AIF2TX5MIX_INPUT_4_SOURCE 0x766
622#define MADERA_AIF2TX5MIX_INPUT_4_VOLUME 0x767
623#define MADERA_AIF2TX6MIX_INPUT_1_SOURCE 0x768
624#define MADERA_AIF2TX6MIX_INPUT_1_VOLUME 0x769
625#define MADERA_AIF2TX6MIX_INPUT_2_SOURCE 0x76A
626#define MADERA_AIF2TX6MIX_INPUT_2_VOLUME 0x76B
627#define MADERA_AIF2TX6MIX_INPUT_3_SOURCE 0x76C
628#define MADERA_AIF2TX6MIX_INPUT_3_VOLUME 0x76D
629#define MADERA_AIF2TX6MIX_INPUT_4_SOURCE 0x76E
630#define MADERA_AIF2TX6MIX_INPUT_4_VOLUME 0x76F
631#define MADERA_AIF2TX7MIX_INPUT_1_SOURCE 0x770
632#define MADERA_AIF2TX7MIX_INPUT_1_VOLUME 0x771
633#define MADERA_AIF2TX7MIX_INPUT_2_SOURCE 0x772
634#define MADERA_AIF2TX7MIX_INPUT_2_VOLUME 0x773
635#define MADERA_AIF2TX7MIX_INPUT_3_SOURCE 0x774
636#define MADERA_AIF2TX7MIX_INPUT_3_VOLUME 0x775
637#define MADERA_AIF2TX7MIX_INPUT_4_SOURCE 0x776
638#define MADERA_AIF2TX7MIX_INPUT_4_VOLUME 0x777
639#define MADERA_AIF2TX8MIX_INPUT_1_SOURCE 0x778
640#define MADERA_AIF2TX8MIX_INPUT_1_VOLUME 0x779
641#define MADERA_AIF2TX8MIX_INPUT_2_SOURCE 0x77A
642#define MADERA_AIF2TX8MIX_INPUT_2_VOLUME 0x77B
643#define MADERA_AIF2TX8MIX_INPUT_3_SOURCE 0x77C
644#define MADERA_AIF2TX8MIX_INPUT_3_VOLUME 0x77D
645#define MADERA_AIF2TX8MIX_INPUT_4_SOURCE 0x77E
646#define MADERA_AIF2TX8MIX_INPUT_4_VOLUME 0x77F
647#define MADERA_AIF3TX1MIX_INPUT_1_SOURCE 0x780
648#define MADERA_AIF3TX1MIX_INPUT_1_VOLUME 0x781
649#define MADERA_AIF3TX1MIX_INPUT_2_SOURCE 0x782
650#define MADERA_AIF3TX1MIX_INPUT_2_VOLUME 0x783
651#define MADERA_AIF3TX1MIX_INPUT_3_SOURCE 0x784
652#define MADERA_AIF3TX1MIX_INPUT_3_VOLUME 0x785
653#define MADERA_AIF3TX1MIX_INPUT_4_SOURCE 0x786
654#define MADERA_AIF3TX1MIX_INPUT_4_VOLUME 0x787
655#define MADERA_AIF3TX2MIX_INPUT_1_SOURCE 0x788
656#define MADERA_AIF3TX2MIX_INPUT_1_VOLUME 0x789
657#define MADERA_AIF3TX2MIX_INPUT_2_SOURCE 0x78A
658#define MADERA_AIF3TX2MIX_INPUT_2_VOLUME 0x78B
659#define MADERA_AIF3TX2MIX_INPUT_3_SOURCE 0x78C
660#define MADERA_AIF3TX2MIX_INPUT_3_VOLUME 0x78D
661#define MADERA_AIF3TX2MIX_INPUT_4_SOURCE 0x78E
662#define MADERA_AIF3TX2MIX_INPUT_4_VOLUME 0x78F
663#define MADERA_AIF4TX1MIX_INPUT_1_SOURCE 0x7A0
664#define MADERA_AIF4TX1MIX_INPUT_1_VOLUME 0x7A1
665#define MADERA_AIF4TX1MIX_INPUT_2_SOURCE 0x7A2
666#define MADERA_AIF4TX1MIX_INPUT_2_VOLUME 0x7A3
667#define MADERA_AIF4TX1MIX_INPUT_3_SOURCE 0x7A4
668#define MADERA_AIF4TX1MIX_INPUT_3_VOLUME 0x7A5
669#define MADERA_AIF4TX1MIX_INPUT_4_SOURCE 0x7A6
670#define MADERA_AIF4TX1MIX_INPUT_4_VOLUME 0x7A7
671#define MADERA_AIF4TX2MIX_INPUT_1_SOURCE 0x7A8
672#define MADERA_AIF4TX2MIX_INPUT_1_VOLUME 0x7A9
673#define MADERA_AIF4TX2MIX_INPUT_2_SOURCE 0x7AA
674#define MADERA_AIF4TX2MIX_INPUT_2_VOLUME 0x7AB
675#define MADERA_AIF4TX2MIX_INPUT_3_SOURCE 0x7AC
676#define MADERA_AIF4TX2MIX_INPUT_3_VOLUME 0x7AD
677#define MADERA_AIF4TX2MIX_INPUT_4_SOURCE 0x7AE
678#define MADERA_AIF4TX2MIX_INPUT_4_VOLUME 0x7AF
679#define MADERA_SLIMTX1MIX_INPUT_1_SOURCE 0x7C0
680#define MADERA_SLIMTX1MIX_INPUT_1_VOLUME 0x7C1
681#define MADERA_SLIMTX1MIX_INPUT_2_SOURCE 0x7C2
682#define MADERA_SLIMTX1MIX_INPUT_2_VOLUME 0x7C3
683#define MADERA_SLIMTX1MIX_INPUT_3_SOURCE 0x7C4
684#define MADERA_SLIMTX1MIX_INPUT_3_VOLUME 0x7C5
685#define MADERA_SLIMTX1MIX_INPUT_4_SOURCE 0x7C6
686#define MADERA_SLIMTX1MIX_INPUT_4_VOLUME 0x7C7
687#define MADERA_SLIMTX2MIX_INPUT_1_SOURCE 0x7C8
688#define MADERA_SLIMTX2MIX_INPUT_1_VOLUME 0x7C9
689#define MADERA_SLIMTX2MIX_INPUT_2_SOURCE 0x7CA
690#define MADERA_SLIMTX2MIX_INPUT_2_VOLUME 0x7CB
691#define MADERA_SLIMTX2MIX_INPUT_3_SOURCE 0x7CC
692#define MADERA_SLIMTX2MIX_INPUT_3_VOLUME 0x7CD
693#define MADERA_SLIMTX2MIX_INPUT_4_SOURCE 0x7CE
694#define MADERA_SLIMTX2MIX_INPUT_4_VOLUME 0x7CF
695#define MADERA_SLIMTX3MIX_INPUT_1_SOURCE 0x7D0
696#define MADERA_SLIMTX3MIX_INPUT_1_VOLUME 0x7D1
697#define MADERA_SLIMTX3MIX_INPUT_2_SOURCE 0x7D2
698#define MADERA_SLIMTX3MIX_INPUT_2_VOLUME 0x7D3
699#define MADERA_SLIMTX3MIX_INPUT_3_SOURCE 0x7D4
700#define MADERA_SLIMTX3MIX_INPUT_3_VOLUME 0x7D5
701#define MADERA_SLIMTX3MIX_INPUT_4_SOURCE 0x7D6
702#define MADERA_SLIMTX3MIX_INPUT_4_VOLUME 0x7D7
703#define MADERA_SLIMTX4MIX_INPUT_1_SOURCE 0x7D8
704#define MADERA_SLIMTX4MIX_INPUT_1_VOLUME 0x7D9
705#define MADERA_SLIMTX4MIX_INPUT_2_SOURCE 0x7DA
706#define MADERA_SLIMTX4MIX_INPUT_2_VOLUME 0x7DB
707#define MADERA_SLIMTX4MIX_INPUT_3_SOURCE 0x7DC
708#define MADERA_SLIMTX4MIX_INPUT_3_VOLUME 0x7DD
709#define MADERA_SLIMTX4MIX_INPUT_4_SOURCE 0x7DE
710#define MADERA_SLIMTX4MIX_INPUT_4_VOLUME 0x7DF
711#define MADERA_SLIMTX5MIX_INPUT_1_SOURCE 0x7E0
712#define MADERA_SLIMTX5MIX_INPUT_1_VOLUME 0x7E1
713#define MADERA_SLIMTX5MIX_INPUT_2_SOURCE 0x7E2
714#define MADERA_SLIMTX5MIX_INPUT_2_VOLUME 0x7E3
715#define MADERA_SLIMTX5MIX_INPUT_3_SOURCE 0x7E4
716#define MADERA_SLIMTX5MIX_INPUT_3_VOLUME 0x7E5
717#define MADERA_SLIMTX5MIX_INPUT_4_SOURCE 0x7E6
718#define MADERA_SLIMTX5MIX_INPUT_4_VOLUME 0x7E7
719#define MADERA_SLIMTX6MIX_INPUT_1_SOURCE 0x7E8
720#define MADERA_SLIMTX6MIX_INPUT_1_VOLUME 0x7E9
721#define MADERA_SLIMTX6MIX_INPUT_2_SOURCE 0x7EA
722#define MADERA_SLIMTX6MIX_INPUT_2_VOLUME 0x7EB
723#define MADERA_SLIMTX6MIX_INPUT_3_SOURCE 0x7EC
724#define MADERA_SLIMTX6MIX_INPUT_3_VOLUME 0x7ED
725#define MADERA_SLIMTX6MIX_INPUT_4_SOURCE 0x7EE
726#define MADERA_SLIMTX6MIX_INPUT_4_VOLUME 0x7EF
727#define MADERA_SLIMTX7MIX_INPUT_1_SOURCE 0x7F0
728#define MADERA_SLIMTX7MIX_INPUT_1_VOLUME 0x7F1
729#define MADERA_SLIMTX7MIX_INPUT_2_SOURCE 0x7F2
730#define MADERA_SLIMTX7MIX_INPUT_2_VOLUME 0x7F3
731#define MADERA_SLIMTX7MIX_INPUT_3_SOURCE 0x7F4
732#define MADERA_SLIMTX7MIX_INPUT_3_VOLUME 0x7F5
733#define MADERA_SLIMTX7MIX_INPUT_4_SOURCE 0x7F6
734#define MADERA_SLIMTX7MIX_INPUT_4_VOLUME 0x7F7
735#define MADERA_SLIMTX8MIX_INPUT_1_SOURCE 0x7F8
736#define MADERA_SLIMTX8MIX_INPUT_1_VOLUME 0x7F9
737#define MADERA_SLIMTX8MIX_INPUT_2_SOURCE 0x7FA
738#define MADERA_SLIMTX8MIX_INPUT_2_VOLUME 0x7FB
739#define MADERA_SLIMTX8MIX_INPUT_3_SOURCE 0x7FC
740#define MADERA_SLIMTX8MIX_INPUT_3_VOLUME 0x7FD
741#define MADERA_SLIMTX8MIX_INPUT_4_SOURCE 0x7FE
742#define MADERA_SLIMTX8MIX_INPUT_4_VOLUME 0x7FF
743#define MADERA_SPDIF1TX1MIX_INPUT_1_SOURCE 0x800
744#define MADERA_SPDIF1TX1MIX_INPUT_1_VOLUME 0x801
745#define MADERA_SPDIF1TX2MIX_INPUT_1_SOURCE 0x808
746#define MADERA_SPDIF1TX2MIX_INPUT_1_VOLUME 0x809
747#define MADERA_EQ1MIX_INPUT_1_SOURCE 0x880
748#define MADERA_EQ1MIX_INPUT_1_VOLUME 0x881
749#define MADERA_EQ1MIX_INPUT_2_SOURCE 0x882
750#define MADERA_EQ1MIX_INPUT_2_VOLUME 0x883
751#define MADERA_EQ1MIX_INPUT_3_SOURCE 0x884
752#define MADERA_EQ1MIX_INPUT_3_VOLUME 0x885
753#define MADERA_EQ1MIX_INPUT_4_SOURCE 0x886
754#define MADERA_EQ1MIX_INPUT_4_VOLUME 0x887
755#define MADERA_EQ2MIX_INPUT_1_SOURCE 0x888
756#define MADERA_EQ2MIX_INPUT_1_VOLUME 0x889
757#define MADERA_EQ2MIX_INPUT_2_SOURCE 0x88A
758#define MADERA_EQ2MIX_INPUT_2_VOLUME 0x88B
759#define MADERA_EQ2MIX_INPUT_3_SOURCE 0x88C
760#define MADERA_EQ2MIX_INPUT_3_VOLUME 0x88D
761#define MADERA_EQ2MIX_INPUT_4_SOURCE 0x88E
762#define MADERA_EQ2MIX_INPUT_4_VOLUME 0x88F
763#define MADERA_EQ3MIX_INPUT_1_SOURCE 0x890
764#define MADERA_EQ3MIX_INPUT_1_VOLUME 0x891
765#define MADERA_EQ3MIX_INPUT_2_SOURCE 0x892
766#define MADERA_EQ3MIX_INPUT_2_VOLUME 0x893
767#define MADERA_EQ3MIX_INPUT_3_SOURCE 0x894
768#define MADERA_EQ3MIX_INPUT_3_VOLUME 0x895
769#define MADERA_EQ3MIX_INPUT_4_SOURCE 0x896
770#define MADERA_EQ3MIX_INPUT_4_VOLUME 0x897
771#define MADERA_EQ4MIX_INPUT_1_SOURCE 0x898
772#define MADERA_EQ4MIX_INPUT_1_VOLUME 0x899
773#define MADERA_EQ4MIX_INPUT_2_SOURCE 0x89A
774#define MADERA_EQ4MIX_INPUT_2_VOLUME 0x89B
775#define MADERA_EQ4MIX_INPUT_3_SOURCE 0x89C
776#define MADERA_EQ4MIX_INPUT_3_VOLUME 0x89D
777#define MADERA_EQ4MIX_INPUT_4_SOURCE 0x89E
778#define MADERA_EQ4MIX_INPUT_4_VOLUME 0x89F
779#define MADERA_DRC1LMIX_INPUT_1_SOURCE 0x8C0
780#define MADERA_DRC1LMIX_INPUT_1_VOLUME 0x8C1
781#define MADERA_DRC1LMIX_INPUT_2_SOURCE 0x8C2
782#define MADERA_DRC1LMIX_INPUT_2_VOLUME 0x8C3
783#define MADERA_DRC1LMIX_INPUT_3_SOURCE 0x8C4
784#define MADERA_DRC1LMIX_INPUT_3_VOLUME 0x8C5
785#define MADERA_DRC1LMIX_INPUT_4_SOURCE 0x8C6
786#define MADERA_DRC1LMIX_INPUT_4_VOLUME 0x8C7
787#define MADERA_DRC1RMIX_INPUT_1_SOURCE 0x8C8
788#define MADERA_DRC1RMIX_INPUT_1_VOLUME 0x8C9
789#define MADERA_DRC1RMIX_INPUT_2_SOURCE 0x8CA
790#define MADERA_DRC1RMIX_INPUT_2_VOLUME 0x8CB
791#define MADERA_DRC1RMIX_INPUT_3_SOURCE 0x8CC
792#define MADERA_DRC1RMIX_INPUT_3_VOLUME 0x8CD
793#define MADERA_DRC1RMIX_INPUT_4_SOURCE 0x8CE
794#define MADERA_DRC1RMIX_INPUT_4_VOLUME 0x8CF
795#define MADERA_DRC2LMIX_INPUT_1_SOURCE 0x8D0
796#define MADERA_DRC2LMIX_INPUT_1_VOLUME 0x8D1
797#define MADERA_DRC2LMIX_INPUT_2_SOURCE 0x8D2
798#define MADERA_DRC2LMIX_INPUT_2_VOLUME 0x8D3
799#define MADERA_DRC2LMIX_INPUT_3_SOURCE 0x8D4
800#define MADERA_DRC2LMIX_INPUT_3_VOLUME 0x8D5
801#define MADERA_DRC2LMIX_INPUT_4_SOURCE 0x8D6
802#define MADERA_DRC2LMIX_INPUT_4_VOLUME 0x8D7
803#define MADERA_DRC2RMIX_INPUT_1_SOURCE 0x8D8
804#define MADERA_DRC2RMIX_INPUT_1_VOLUME 0x8D9
805#define MADERA_DRC2RMIX_INPUT_2_SOURCE 0x8DA
806#define MADERA_DRC2RMIX_INPUT_2_VOLUME 0x8DB
807#define MADERA_DRC2RMIX_INPUT_3_SOURCE 0x8DC
808#define MADERA_DRC2RMIX_INPUT_3_VOLUME 0x8DD
809#define MADERA_DRC2RMIX_INPUT_4_SOURCE 0x8DE
810#define MADERA_DRC2RMIX_INPUT_4_VOLUME 0x8DF
811#define MADERA_HPLP1MIX_INPUT_1_SOURCE 0x900
812#define MADERA_HPLP1MIX_INPUT_1_VOLUME 0x901
813#define MADERA_HPLP1MIX_INPUT_2_SOURCE 0x902
814#define MADERA_HPLP1MIX_INPUT_2_VOLUME 0x903
815#define MADERA_HPLP1MIX_INPUT_3_SOURCE 0x904
816#define MADERA_HPLP1MIX_INPUT_3_VOLUME 0x905
817#define MADERA_HPLP1MIX_INPUT_4_SOURCE 0x906
818#define MADERA_HPLP1MIX_INPUT_4_VOLUME 0x907
819#define MADERA_HPLP2MIX_INPUT_1_SOURCE 0x908
820#define MADERA_HPLP2MIX_INPUT_1_VOLUME 0x909
821#define MADERA_HPLP2MIX_INPUT_2_SOURCE 0x90A
822#define MADERA_HPLP2MIX_INPUT_2_VOLUME 0x90B
823#define MADERA_HPLP2MIX_INPUT_3_SOURCE 0x90C
824#define MADERA_HPLP2MIX_INPUT_3_VOLUME 0x90D
825#define MADERA_HPLP2MIX_INPUT_4_SOURCE 0x90E
826#define MADERA_HPLP2MIX_INPUT_4_VOLUME 0x90F
827#define MADERA_HPLP3MIX_INPUT_1_SOURCE 0x910
828#define MADERA_HPLP3MIX_INPUT_1_VOLUME 0x911
829#define MADERA_HPLP3MIX_INPUT_2_SOURCE 0x912
830#define MADERA_HPLP3MIX_INPUT_2_VOLUME 0x913
831#define MADERA_HPLP3MIX_INPUT_3_SOURCE 0x914
832#define MADERA_HPLP3MIX_INPUT_3_VOLUME 0x915
833#define MADERA_HPLP3MIX_INPUT_4_SOURCE 0x916
834#define MADERA_HPLP3MIX_INPUT_4_VOLUME 0x917
835#define MADERA_HPLP4MIX_INPUT_1_SOURCE 0x918
836#define MADERA_HPLP4MIX_INPUT_1_VOLUME 0x919
837#define MADERA_HPLP4MIX_INPUT_2_SOURCE 0x91A
838#define MADERA_HPLP4MIX_INPUT_2_VOLUME 0x91B
839#define MADERA_HPLP4MIX_INPUT_3_SOURCE 0x91C
840#define MADERA_HPLP4MIX_INPUT_3_VOLUME 0x91D
841#define MADERA_HPLP4MIX_INPUT_4_SOURCE 0x91E
842#define MADERA_HPLP4MIX_INPUT_4_VOLUME 0x91F
843#define MADERA_DSP1LMIX_INPUT_1_SOURCE 0x940
844#define MADERA_DSP1LMIX_INPUT_1_VOLUME 0x941
845#define MADERA_DSP1LMIX_INPUT_2_SOURCE 0x942
846#define MADERA_DSP1LMIX_INPUT_2_VOLUME 0x943
847#define MADERA_DSP1LMIX_INPUT_3_SOURCE 0x944
848#define MADERA_DSP1LMIX_INPUT_3_VOLUME 0x945
849#define MADERA_DSP1LMIX_INPUT_4_SOURCE 0x946
850#define MADERA_DSP1LMIX_INPUT_4_VOLUME 0x947
851#define MADERA_DSP1RMIX_INPUT_1_SOURCE 0x948
852#define MADERA_DSP1RMIX_INPUT_1_VOLUME 0x949
853#define MADERA_DSP1RMIX_INPUT_2_SOURCE 0x94A
854#define MADERA_DSP1RMIX_INPUT_2_VOLUME 0x94B
855#define MADERA_DSP1RMIX_INPUT_3_SOURCE 0x94C
856#define MADERA_DSP1RMIX_INPUT_3_VOLUME 0x94D
857#define MADERA_DSP1RMIX_INPUT_4_SOURCE 0x94E
858#define MADERA_DSP1RMIX_INPUT_4_VOLUME 0x94F
859#define MADERA_DSP1AUX1MIX_INPUT_1_SOURCE 0x950
860#define MADERA_DSP1AUX2MIX_INPUT_1_SOURCE 0x958
861#define MADERA_DSP1AUX3MIX_INPUT_1_SOURCE 0x960
862#define MADERA_DSP1AUX4MIX_INPUT_1_SOURCE 0x968
863#define MADERA_DSP1AUX5MIX_INPUT_1_SOURCE 0x970
864#define MADERA_DSP1AUX6MIX_INPUT_1_SOURCE 0x978
865#define MADERA_DSP2LMIX_INPUT_1_SOURCE 0x980
866#define MADERA_DSP2LMIX_INPUT_1_VOLUME 0x981
867#define MADERA_DSP2LMIX_INPUT_2_SOURCE 0x982
868#define MADERA_DSP2LMIX_INPUT_2_VOLUME 0x983
869#define MADERA_DSP2LMIX_INPUT_3_SOURCE 0x984
870#define MADERA_DSP2LMIX_INPUT_3_VOLUME 0x985
871#define MADERA_DSP2LMIX_INPUT_4_SOURCE 0x986
872#define MADERA_DSP2LMIX_INPUT_4_VOLUME 0x987
873#define MADERA_DSP2RMIX_INPUT_1_SOURCE 0x988
874#define MADERA_DSP2RMIX_INPUT_1_VOLUME 0x989
875#define MADERA_DSP2RMIX_INPUT_2_SOURCE 0x98A
876#define MADERA_DSP2RMIX_INPUT_2_VOLUME 0x98B
877#define MADERA_DSP2RMIX_INPUT_3_SOURCE 0x98C
878#define MADERA_DSP2RMIX_INPUT_3_VOLUME 0x98D
879#define MADERA_DSP2RMIX_INPUT_4_SOURCE 0x98E
880#define MADERA_DSP2RMIX_INPUT_4_VOLUME 0x98F
881#define MADERA_DSP2AUX1MIX_INPUT_1_SOURCE 0x990
882#define MADERA_DSP2AUX2MIX_INPUT_1_SOURCE 0x998
883#define MADERA_DSP2AUX3MIX_INPUT_1_SOURCE 0x9A0
884#define MADERA_DSP2AUX4MIX_INPUT_1_SOURCE 0x9A8
885#define MADERA_DSP2AUX5MIX_INPUT_1_SOURCE 0x9B0
886#define MADERA_DSP2AUX6MIX_INPUT_1_SOURCE 0x9B8
887#define MADERA_DSP3LMIX_INPUT_1_SOURCE 0x9C0
888#define MADERA_DSP3LMIX_INPUT_1_VOLUME 0x9C1
889#define MADERA_DSP3LMIX_INPUT_2_SOURCE 0x9C2
890#define MADERA_DSP3LMIX_INPUT_2_VOLUME 0x9C3
891#define MADERA_DSP3LMIX_INPUT_3_SOURCE 0x9C4
892#define MADERA_DSP3LMIX_INPUT_3_VOLUME 0x9C5
893#define MADERA_DSP3LMIX_INPUT_4_SOURCE 0x9C6
894#define MADERA_DSP3LMIX_INPUT_4_VOLUME 0x9C7
895#define MADERA_DSP3RMIX_INPUT_1_SOURCE 0x9C8
896#define MADERA_DSP3RMIX_INPUT_1_VOLUME 0x9C9
897#define MADERA_DSP3RMIX_INPUT_2_SOURCE 0x9CA
898#define MADERA_DSP3RMIX_INPUT_2_VOLUME 0x9CB
899#define MADERA_DSP3RMIX_INPUT_3_SOURCE 0x9CC
900#define MADERA_DSP3RMIX_INPUT_3_VOLUME 0x9CD
901#define MADERA_DSP3RMIX_INPUT_4_SOURCE 0x9CE
902#define MADERA_DSP3RMIX_INPUT_4_VOLUME 0x9CF
903#define MADERA_DSP3AUX1MIX_INPUT_1_SOURCE 0x9D0
904#define MADERA_DSP3AUX2MIX_INPUT_1_SOURCE 0x9D8
905#define MADERA_DSP3AUX3MIX_INPUT_1_SOURCE 0x9E0
906#define MADERA_DSP3AUX4MIX_INPUT_1_SOURCE 0x9E8
907#define MADERA_DSP3AUX5MIX_INPUT_1_SOURCE 0x9F0
908#define MADERA_DSP3AUX6MIX_INPUT_1_SOURCE 0x9F8
909#define MADERA_DSP4LMIX_INPUT_1_SOURCE 0xA00
910#define MADERA_DSP4LMIX_INPUT_1_VOLUME 0xA01
911#define MADERA_DSP4LMIX_INPUT_2_SOURCE 0xA02
912#define MADERA_DSP4LMIX_INPUT_2_VOLUME 0xA03
913#define MADERA_DSP4LMIX_INPUT_3_SOURCE 0xA04
914#define MADERA_DSP4LMIX_INPUT_3_VOLUME 0xA05
915#define MADERA_DSP4LMIX_INPUT_4_SOURCE 0xA06
916#define MADERA_DSP4LMIX_INPUT_4_VOLUME 0xA07
917#define MADERA_DSP4RMIX_INPUT_1_SOURCE 0xA08
918#define MADERA_DSP4RMIX_INPUT_1_VOLUME 0xA09
919#define MADERA_DSP4RMIX_INPUT_2_SOURCE 0xA0A
920#define MADERA_DSP4RMIX_INPUT_2_VOLUME 0xA0B
921#define MADERA_DSP4RMIX_INPUT_3_SOURCE 0xA0C
922#define MADERA_DSP4RMIX_INPUT_3_VOLUME 0xA0D
923#define MADERA_DSP4RMIX_INPUT_4_SOURCE 0xA0E
924#define MADERA_DSP4RMIX_INPUT_4_VOLUME 0xA0F
925#define MADERA_DSP4AUX1MIX_INPUT_1_SOURCE 0xA10
926#define MADERA_DSP4AUX2MIX_INPUT_1_SOURCE 0xA18
927#define MADERA_DSP4AUX3MIX_INPUT_1_SOURCE 0xA20
928#define MADERA_DSP4AUX4MIX_INPUT_1_SOURCE 0xA28
929#define MADERA_DSP4AUX5MIX_INPUT_1_SOURCE 0xA30
930#define MADERA_DSP4AUX6MIX_INPUT_1_SOURCE 0xA38
931#define MADERA_DSP5LMIX_INPUT_1_SOURCE 0xA40
932#define MADERA_DSP5LMIX_INPUT_1_VOLUME 0xA41
933#define MADERA_DSP5LMIX_INPUT_2_SOURCE 0xA42
934#define MADERA_DSP5LMIX_INPUT_2_VOLUME 0xA43
935#define MADERA_DSP5LMIX_INPUT_3_SOURCE 0xA44
936#define MADERA_DSP5LMIX_INPUT_3_VOLUME 0xA45
937#define MADERA_DSP5LMIX_INPUT_4_SOURCE 0xA46
938#define MADERA_DSP5LMIX_INPUT_4_VOLUME 0xA47
939#define MADERA_DSP5RMIX_INPUT_1_SOURCE 0xA48
940#define MADERA_DSP5RMIX_INPUT_1_VOLUME 0xA49
941#define MADERA_DSP5RMIX_INPUT_2_SOURCE 0xA4A
942#define MADERA_DSP5RMIX_INPUT_2_VOLUME 0xA4B
943#define MADERA_DSP5RMIX_INPUT_3_SOURCE 0xA4C
944#define MADERA_DSP5RMIX_INPUT_3_VOLUME 0xA4D
945#define MADERA_DSP5RMIX_INPUT_4_SOURCE 0xA4E
946#define MADERA_DSP5RMIX_INPUT_4_VOLUME 0xA4F
947#define MADERA_DSP5AUX1MIX_INPUT_1_SOURCE 0xA50
948#define MADERA_DSP5AUX2MIX_INPUT_1_SOURCE 0xA58
949#define MADERA_DSP5AUX3MIX_INPUT_1_SOURCE 0xA60
950#define MADERA_DSP5AUX4MIX_INPUT_1_SOURCE 0xA68
951#define MADERA_DSP5AUX5MIX_INPUT_1_SOURCE 0xA70
952#define MADERA_DSP5AUX6MIX_INPUT_1_SOURCE 0xA78
953#define MADERA_ASRC1_1LMIX_INPUT_1_SOURCE 0xA80
954#define MADERA_ASRC1_1RMIX_INPUT_1_SOURCE 0xA88
955#define MADERA_ASRC1_2LMIX_INPUT_1_SOURCE 0xA90
956#define MADERA_ASRC1_2RMIX_INPUT_1_SOURCE 0xA98
957#define MADERA_ASRC2_1LMIX_INPUT_1_SOURCE 0xAA0
958#define MADERA_ASRC2_1RMIX_INPUT_1_SOURCE 0xAA8
959#define MADERA_ASRC2_2LMIX_INPUT_1_SOURCE 0xAB0
960#define MADERA_ASRC2_2RMIX_INPUT_1_SOURCE 0xAB8
961#define MADERA_ISRC1DEC1MIX_INPUT_1_SOURCE 0xB00
962#define MADERA_ISRC1DEC2MIX_INPUT_1_SOURCE 0xB08
963#define MADERA_ISRC1DEC3MIX_INPUT_1_SOURCE 0xB10
964#define MADERA_ISRC1DEC4MIX_INPUT_1_SOURCE 0xB18
965#define MADERA_ISRC1INT1MIX_INPUT_1_SOURCE 0xB20
966#define MADERA_ISRC1INT2MIX_INPUT_1_SOURCE 0xB28
967#define MADERA_ISRC1INT3MIX_INPUT_1_SOURCE 0xB30
968#define MADERA_ISRC1INT4MIX_INPUT_1_SOURCE 0xB38
969#define MADERA_ISRC2DEC1MIX_INPUT_1_SOURCE 0xB40
970#define MADERA_ISRC2DEC2MIX_INPUT_1_SOURCE 0xB48
971#define MADERA_ISRC2DEC3MIX_INPUT_1_SOURCE 0xB50
972#define MADERA_ISRC2DEC4MIX_INPUT_1_SOURCE 0xB58
973#define MADERA_ISRC2INT1MIX_INPUT_1_SOURCE 0xB60
974#define MADERA_ISRC2INT2MIX_INPUT_1_SOURCE 0xB68
975#define MADERA_ISRC2INT3MIX_INPUT_1_SOURCE 0xB70
976#define MADERA_ISRC2INT4MIX_INPUT_1_SOURCE 0xB78
977#define MADERA_ISRC3DEC1MIX_INPUT_1_SOURCE 0xB80
978#define MADERA_ISRC3DEC2MIX_INPUT_1_SOURCE 0xB88
979#define MADERA_ISRC3DEC3MIX_INPUT_1_SOURCE 0xB90
980#define MADERA_ISRC3DEC4MIX_INPUT_1_SOURCE 0xB98
981#define MADERA_ISRC3INT1MIX_INPUT_1_SOURCE 0xBA0
982#define MADERA_ISRC3INT2MIX_INPUT_1_SOURCE 0xBA8
983#define MADERA_ISRC3INT3MIX_INPUT_1_SOURCE 0xBB0
984#define MADERA_ISRC3INT4MIX_INPUT_1_SOURCE 0xBB8
985#define MADERA_ISRC4DEC1MIX_INPUT_1_SOURCE 0xBC0
986#define MADERA_ISRC4DEC2MIX_INPUT_1_SOURCE 0xBC8
987#define MADERA_ISRC4INT1MIX_INPUT_1_SOURCE 0xBE0
988#define MADERA_ISRC4INT2MIX_INPUT_1_SOURCE 0xBE8
989#define MADERA_DSP6LMIX_INPUT_1_SOURCE 0xC00
990#define MADERA_DSP6LMIX_INPUT_1_VOLUME 0xC01
991#define MADERA_DSP6LMIX_INPUT_2_SOURCE 0xC02
992#define MADERA_DSP6LMIX_INPUT_2_VOLUME 0xC03
993#define MADERA_DSP6LMIX_INPUT_3_SOURCE 0xC04
994#define MADERA_DSP6LMIX_INPUT_3_VOLUME 0xC05
995#define MADERA_DSP6LMIX_INPUT_4_SOURCE 0xC06
996#define MADERA_DSP6LMIX_INPUT_4_VOLUME 0xC07
997#define MADERA_DSP6RMIX_INPUT_1_SOURCE 0xC08
998#define MADERA_DSP6RMIX_INPUT_1_VOLUME 0xC09
999#define MADERA_DSP6RMIX_INPUT_2_SOURCE 0xC0A
1000#define MADERA_DSP6RMIX_INPUT_2_VOLUME 0xC0B
1001#define MADERA_DSP6RMIX_INPUT_3_SOURCE 0xC0C
1002#define MADERA_DSP6RMIX_INPUT_3_VOLUME 0xC0D
1003#define MADERA_DSP6RMIX_INPUT_4_SOURCE 0xC0E
1004#define MADERA_DSP6RMIX_INPUT_4_VOLUME 0xC0F
1005#define MADERA_DSP6AUX1MIX_INPUT_1_SOURCE 0xC10
1006#define MADERA_DSP6AUX2MIX_INPUT_1_SOURCE 0xC18
1007#define MADERA_DSP6AUX3MIX_INPUT_1_SOURCE 0xC20
1008#define MADERA_DSP6AUX4MIX_INPUT_1_SOURCE 0xC28
1009#define MADERA_DSP6AUX5MIX_INPUT_1_SOURCE 0xC30
1010#define MADERA_DSP6AUX6MIX_INPUT_1_SOURCE 0xC38
1011#define MADERA_DSP7LMIX_INPUT_1_SOURCE 0xC40
1012#define MADERA_DSP7LMIX_INPUT_1_VOLUME 0xC41
1013#define MADERA_DSP7LMIX_INPUT_2_SOURCE 0xC42
1014#define MADERA_DSP7LMIX_INPUT_2_VOLUME 0xC43
1015#define MADERA_DSP7LMIX_INPUT_3_SOURCE 0xC44
1016#define MADERA_DSP7LMIX_INPUT_3_VOLUME 0xC45
1017#define MADERA_DSP7LMIX_INPUT_4_SOURCE 0xC46
1018#define MADERA_DSP7LMIX_INPUT_4_VOLUME 0xC47
1019#define MADERA_DSP7RMIX_INPUT_1_SOURCE 0xC48
1020#define MADERA_DSP7RMIX_INPUT_1_VOLUME 0xC49
1021#define MADERA_DSP7RMIX_INPUT_2_SOURCE 0xC4A
1022#define MADERA_DSP7RMIX_INPUT_2_VOLUME 0xC4B
1023#define MADERA_DSP7RMIX_INPUT_3_SOURCE 0xC4C
1024#define MADERA_DSP7RMIX_INPUT_3_VOLUME 0xC4D
1025#define MADERA_DSP7RMIX_INPUT_4_SOURCE 0xC4E
1026#define MADERA_DSP7RMIX_INPUT_4_VOLUME 0xC4F
1027#define MADERA_DSP7AUX1MIX_INPUT_1_SOURCE 0xC50
1028#define MADERA_DSP7AUX2MIX_INPUT_1_SOURCE 0xC58
1029#define MADERA_DSP7AUX3MIX_INPUT_1_SOURCE 0xC60
1030#define MADERA_DSP7AUX4MIX_INPUT_1_SOURCE 0xC68
1031#define MADERA_DSP7AUX5MIX_INPUT_1_SOURCE 0xC70
1032#define MADERA_DSP7AUX6MIX_INPUT_1_SOURCE 0xC78
1033#define MADERA_DFC1MIX_INPUT_1_SOURCE 0xDC0
1034#define MADERA_DFC2MIX_INPUT_1_SOURCE 0xDC8
1035#define MADERA_DFC3MIX_INPUT_1_SOURCE 0xDD0
1036#define MADERA_DFC4MIX_INPUT_1_SOURCE 0xDD8
1037#define MADERA_DFC5MIX_INPUT_1_SOURCE 0xDE0
1038#define MADERA_DFC6MIX_INPUT_1_SOURCE 0xDE8
1039#define MADERA_DFC7MIX_INPUT_1_SOURCE 0xDF0
1040#define MADERA_DFC8MIX_INPUT_1_SOURCE 0xDF8
1041#define MADERA_FX_CTRL1 0xE00
1042#define MADERA_FX_CTRL2 0xE01
1043#define MADERA_EQ1_1 0xE10
1044#define MADERA_EQ1_2 0xE11
1045#define MADERA_EQ1_21 0xE24
1046#define MADERA_EQ2_1 0xE26
1047#define MADERA_EQ2_2 0xE27
1048#define MADERA_EQ2_21 0xE3A
1049#define MADERA_EQ3_1 0xE3C
1050#define MADERA_EQ3_2 0xE3D
1051#define MADERA_EQ3_21 0xE50
1052#define MADERA_EQ4_1 0xE52
1053#define MADERA_EQ4_2 0xE53
1054#define MADERA_EQ4_21 0xE66
1055#define MADERA_DRC1_CTRL1 0xE80
1056#define MADERA_DRC1_CTRL2 0xE81
1057#define MADERA_DRC1_CTRL3 0xE82
1058#define MADERA_DRC1_CTRL4 0xE83
1059#define MADERA_DRC1_CTRL5 0xE84
1060#define MADERA_DRC2_CTRL1 0xE88
1061#define MADERA_DRC2_CTRL2 0xE89
1062#define MADERA_DRC2_CTRL3 0xE8A
1063#define MADERA_DRC2_CTRL4 0xE8B
1064#define MADERA_DRC2_CTRL5 0xE8C
1065#define MADERA_HPLPF1_1 0xEC0
1066#define MADERA_HPLPF1_2 0xEC1
1067#define MADERA_HPLPF2_1 0xEC4
1068#define MADERA_HPLPF2_2 0xEC5
1069#define MADERA_HPLPF3_1 0xEC8
1070#define MADERA_HPLPF3_2 0xEC9
1071#define MADERA_HPLPF4_1 0xECC
1072#define MADERA_HPLPF4_2 0xECD
1073#define MADERA_ASRC2_ENABLE 0xED0
1074#define MADERA_ASRC2_STATUS 0xED1
1075#define MADERA_ASRC2_RATE1 0xED2
1076#define MADERA_ASRC2_RATE2 0xED3
1077#define MADERA_ASRC1_ENABLE 0xEE0
1078#define MADERA_ASRC1_STATUS 0xEE1
1079#define MADERA_ASRC1_RATE1 0xEE2
1080#define MADERA_ASRC1_RATE2 0xEE3
1081#define MADERA_ISRC_1_CTRL_1 0xEF0
1082#define MADERA_ISRC_1_CTRL_2 0xEF1
1083#define MADERA_ISRC_1_CTRL_3 0xEF2
1084#define MADERA_ISRC_2_CTRL_1 0xEF3
1085#define MADERA_ISRC_2_CTRL_2 0xEF4
1086#define MADERA_ISRC_2_CTRL_3 0xEF5
1087#define MADERA_ISRC_3_CTRL_1 0xEF6
1088#define MADERA_ISRC_3_CTRL_2 0xEF7
1089#define MADERA_ISRC_3_CTRL_3 0xEF8
1090#define MADERA_ISRC_4_CTRL_1 0xEF9
1091#define MADERA_ISRC_4_CTRL_2 0xEFA
1092#define MADERA_ISRC_4_CTRL_3 0xEFB
1093#define MADERA_CLOCK_CONTROL 0xF00
1094#define MADERA_ANC_SRC 0xF01
1095#define MADERA_DSP_STATUS 0xF02
1096#define MADERA_ANC_COEFF_START 0xF08
1097#define MADERA_ANC_COEFF_END 0xF12
1098#define MADERA_FCL_FILTER_CONTROL 0xF15
1099#define MADERA_FCL_ADC_REFORMATTER_CONTROL 0xF17
1100#define MADERA_FCL_COEFF_START 0xF18
1101#define MADERA_FCL_COEFF_END 0xF69
1102#define MADERA_FCR_FILTER_CONTROL 0xF71
1103#define MADERA_FCR_ADC_REFORMATTER_CONTROL 0xF73
1104#define MADERA_FCR_COEFF_START 0xF74
1105#define MADERA_FCR_COEFF_END 0xFC5
1106#define MADERA_DAC_COMP_1 0x1300
1107#define MADERA_DAC_COMP_2 0x1302
1108#define MADERA_FRF_COEFFICIENT_1L_1 0x1380
1109#define MADERA_FRF_COEFFICIENT_1L_2 0x1381
1110#define MADERA_FRF_COEFFICIENT_1L_3 0x1382
1111#define MADERA_FRF_COEFFICIENT_1L_4 0x1383
1112#define MADERA_FRF_COEFFICIENT_1R_1 0x1390
1113#define MADERA_FRF_COEFFICIENT_1R_2 0x1391
1114#define MADERA_FRF_COEFFICIENT_1R_3 0x1392
1115#define MADERA_FRF_COEFFICIENT_1R_4 0x1393
1116#define MADERA_FRF_COEFFICIENT_2L_1 0x13A0
1117#define MADERA_FRF_COEFFICIENT_2L_2 0x13A1
1118#define MADERA_FRF_COEFFICIENT_2L_3 0x13A2
1119#define MADERA_FRF_COEFFICIENT_2L_4 0x13A3
1120#define MADERA_FRF_COEFFICIENT_2R_1 0x13B0
1121#define MADERA_FRF_COEFFICIENT_2R_2 0x13B1
1122#define MADERA_FRF_COEFFICIENT_2R_3 0x13B2
1123#define MADERA_FRF_COEFFICIENT_2R_4 0x13B3
1124#define MADERA_FRF_COEFFICIENT_3L_1 0x13C0
1125#define MADERA_FRF_COEFFICIENT_3L_2 0x13C1
1126#define MADERA_FRF_COEFFICIENT_3L_3 0x13C2
1127#define MADERA_FRF_COEFFICIENT_3L_4 0x13C3
1128#define MADERA_FRF_COEFFICIENT_3R_1 0x13D0
1129#define MADERA_FRF_COEFFICIENT_3R_2 0x13D1
1130#define MADERA_FRF_COEFFICIENT_3R_3 0x13D2
1131#define MADERA_FRF_COEFFICIENT_3R_4 0x13D3
1132#define MADERA_FRF_COEFFICIENT_4L_1 0x13E0
1133#define MADERA_FRF_COEFFICIENT_4L_2 0x13E1
1134#define MADERA_FRF_COEFFICIENT_4L_3 0x13E2
1135#define MADERA_FRF_COEFFICIENT_4L_4 0x13E3
1136#define MADERA_FRF_COEFFICIENT_4R_1 0x13F0
1137#define MADERA_FRF_COEFFICIENT_4R_2 0x13F1
1138#define MADERA_FRF_COEFFICIENT_4R_3 0x13F2
1139#define MADERA_FRF_COEFFICIENT_4R_4 0x13F3
1140#define CS47L35_FRF_COEFFICIENT_4L_1 0x13A0
1141#define CS47L35_FRF_COEFFICIENT_4L_2 0x13A1
1142#define CS47L35_FRF_COEFFICIENT_4L_3 0x13A2
1143#define CS47L35_FRF_COEFFICIENT_4L_4 0x13A3
1144#define CS47L35_FRF_COEFFICIENT_5L_1 0x13B0
1145#define CS47L35_FRF_COEFFICIENT_5L_2 0x13B1
1146#define CS47L35_FRF_COEFFICIENT_5L_3 0x13B2
1147#define CS47L35_FRF_COEFFICIENT_5L_4 0x13B3
1148#define CS47L35_FRF_COEFFICIENT_5R_1 0x13C0
1149#define CS47L35_FRF_COEFFICIENT_5R_2 0x13C1
1150#define CS47L35_FRF_COEFFICIENT_5R_3 0x13C2
1151#define CS47L35_FRF_COEFFICIENT_5R_4 0x13C3
1152#define MADERA_FRF_COEFFICIENT_5L_1 0x1400
1153#define MADERA_FRF_COEFFICIENT_5L_2 0x1401
1154#define MADERA_FRF_COEFFICIENT_5L_3 0x1402
1155#define MADERA_FRF_COEFFICIENT_5L_4 0x1403
1156#define MADERA_FRF_COEFFICIENT_5R_1 0x1410
1157#define MADERA_FRF_COEFFICIENT_5R_2 0x1411
1158#define MADERA_FRF_COEFFICIENT_5R_3 0x1412
1159#define MADERA_FRF_COEFFICIENT_5R_4 0x1413
1160#define MADERA_FRF_COEFFICIENT_6L_1 0x1420
1161#define MADERA_FRF_COEFFICIENT_6L_2 0x1421
1162#define MADERA_FRF_COEFFICIENT_6L_3 0x1422
1163#define MADERA_FRF_COEFFICIENT_6L_4 0x1423
1164#define MADERA_FRF_COEFFICIENT_6R_1 0x1430
1165#define MADERA_FRF_COEFFICIENT_6R_2 0x1431
1166#define MADERA_FRF_COEFFICIENT_6R_3 0x1432
1167#define MADERA_FRF_COEFFICIENT_6R_4 0x1433
1168#define MADERA_DFC1_CTRL 0x1480
1169#define MADERA_DFC1_RX 0x1482
1170#define MADERA_DFC1_TX 0x1484
1171#define MADERA_DFC2_CTRL 0x1486
1172#define MADERA_DFC2_RX 0x1488
1173#define MADERA_DFC2_TX 0x148A
1174#define MADERA_DFC3_CTRL 0x148C
1175#define MADERA_DFC3_RX 0x148E
1176#define MADERA_DFC3_TX 0x1490
1177#define MADERA_DFC4_CTRL 0x1492
1178#define MADERA_DFC4_RX 0x1494
1179#define MADERA_DFC4_TX 0x1496
1180#define MADERA_DFC5_CTRL 0x1498
1181#define MADERA_DFC5_RX 0x149A
1182#define MADERA_DFC5_TX 0x149C
1183#define MADERA_DFC6_CTRL 0x149E
1184#define MADERA_DFC6_RX 0x14A0
1185#define MADERA_DFC6_TX 0x14A2
1186#define MADERA_DFC7_CTRL 0x14A4
1187#define MADERA_DFC7_RX 0x14A6
1188#define MADERA_DFC7_TX 0x14A8
1189#define MADERA_DFC8_CTRL 0x14AA
1190#define MADERA_DFC8_RX 0x14AC
1191#define MADERA_DFC8_TX 0x14AE
1192#define MADERA_DFC_STATUS 0x14B6
1193#define MADERA_ADSP2_IRQ0 0x1600
1194#define MADERA_ADSP2_IRQ1 0x1601
1195#define MADERA_ADSP2_IRQ2 0x1602
1196#define MADERA_ADSP2_IRQ3 0x1603
1197#define MADERA_ADSP2_IRQ4 0x1604
1198#define MADERA_ADSP2_IRQ5 0x1605
1199#define MADERA_ADSP2_IRQ6 0x1606
1200#define MADERA_ADSP2_IRQ7 0x1607
1201#define MADERA_GPIO1_CTRL_1 0x1700
1202#define MADERA_GPIO1_CTRL_2 0x1701
1203#define MADERA_GPIO2_CTRL_1 0x1702
1204#define MADERA_GPIO2_CTRL_2 0x1703
1205#define MADERA_GPIO16_CTRL_1 0x171E
1206#define MADERA_GPIO16_CTRL_2 0x171F
1207#define MADERA_GPIO38_CTRL_1 0x174A
1208#define MADERA_GPIO38_CTRL_2 0x174B
1209#define MADERA_GPIO40_CTRL_1 0x174E
1210#define MADERA_GPIO40_CTRL_2 0x174F
1211#define MADERA_IRQ1_STATUS_1 0x1800
1212#define MADERA_IRQ1_STATUS_2 0x1801
1213#define MADERA_IRQ1_STATUS_6 0x1805
1214#define MADERA_IRQ1_STATUS_7 0x1806
1215#define MADERA_IRQ1_STATUS_9 0x1808
1216#define MADERA_IRQ1_STATUS_11 0x180A
1217#define MADERA_IRQ1_STATUS_12 0x180B
1218#define MADERA_IRQ1_STATUS_15 0x180E
1219#define MADERA_IRQ1_STATUS_33 0x1820
1220#define MADERA_IRQ1_MASK_1 0x1840
1221#define MADERA_IRQ1_MASK_2 0x1841
1222#define MADERA_IRQ1_MASK_6 0x1845
1223#define MADERA_IRQ1_MASK_33 0x1860
1224#define MADERA_IRQ1_RAW_STATUS_1 0x1880
1225#define MADERA_IRQ1_RAW_STATUS_2 0x1881
1226#define MADERA_IRQ1_RAW_STATUS_7 0x1886
1227#define MADERA_IRQ1_RAW_STATUS_15 0x188E
1228#define MADERA_IRQ1_RAW_STATUS_33 0x18A0
1229#define MADERA_INTERRUPT_DEBOUNCE_7 0x1A06
1230#define MADERA_INTERRUPT_DEBOUNCE_15 0x1A0E
1231#define MADERA_IRQ1_CTRL 0x1A80
1232#define MADERA_IRQ2_CTRL 0x1A82
1233#define MADERA_INTERRUPT_RAW_STATUS_1 0x1AA0
1234#define MADERA_WSEQ_SEQUENCE_1 0x3000
1235#define MADERA_WSEQ_SEQUENCE_252 0x31F6
1236#define CS47L35_OTP_HPDET_CAL_1 0x31F8
1237#define CS47L35_OTP_HPDET_CAL_2 0x31FA
1238#define MADERA_WSEQ_SEQUENCE_508 0x33F6
1239#define CS47L85_OTP_HPDET_CAL_1 0x33F8
1240#define CS47L85_OTP_HPDET_CAL_2 0x33FA
1241#define MADERA_OTP_HPDET_CAL_1 0x20004
1242#define MADERA_OTP_HPDET_CAL_2 0x20006
1243#define MADERA_DSP1_CONFIG_1 0x0FFE00
1244#define MADERA_DSP1_CONFIG_2 0x0FFE02
1245#define MADERA_DSP1_SCRATCH_1 0x0FFE40
1246#define MADERA_DSP1_SCRATCH_2 0x0FFE42
1247#define MADERA_DSP1_PMEM_ERR_ADDR___XMEM_ERR_ADDR 0xFFE7C
1248#define MADERA_DSP2_CONFIG_1 0x17FE00
1249#define MADERA_DSP2_CONFIG_2 0x17FE02
1250#define MADERA_DSP2_SCRATCH_1 0x17FE40
1251#define MADERA_DSP2_SCRATCH_2 0x17FE42
1252#define MADERA_DSP2_PMEM_ERR_ADDR___XMEM_ERR_ADDR 0x17FE7C
1253#define MADERA_DSP3_CONFIG_1 0x1FFE00
1254#define MADERA_DSP3_CONFIG_2 0x1FFE02
1255#define MADERA_DSP3_SCRATCH_1 0x1FFE40
1256#define MADERA_DSP3_SCRATCH_2 0x1FFE42
1257#define MADERA_DSP3_PMEM_ERR_ADDR___XMEM_ERR_ADDR 0x1FFE7C
1258#define MADERA_DSP4_CONFIG_1 0x27FE00
1259#define MADERA_DSP4_CONFIG_2 0x27FE02
1260#define MADERA_DSP4_SCRATCH_1 0x27FE40
1261#define MADERA_DSP4_SCRATCH_2 0x27FE42
1262#define MADERA_DSP4_PMEM_ERR_ADDR___XMEM_ERR_ADDR 0x27FE7C
1263#define MADERA_DSP5_CONFIG_1 0x2FFE00
1264#define MADERA_DSP5_CONFIG_2 0x2FFE02
1265#define MADERA_DSP5_SCRATCH_1 0x2FFE40
1266#define MADERA_DSP5_SCRATCH_2 0x2FFE42
1267#define MADERA_DSP5_PMEM_ERR_ADDR___XMEM_ERR_ADDR 0x2FFE7C
1268#define MADERA_DSP6_CONFIG_1 0x37FE00
1269#define MADERA_DSP6_CONFIG_2 0x37FE02
1270#define MADERA_DSP6_SCRATCH_1 0x37FE40
1271#define MADERA_DSP6_SCRATCH_2 0x37FE42
1272#define MADERA_DSP6_PMEM_ERR_ADDR___XMEM_ERR_ADDR 0x37FE7C
1273#define MADERA_DSP7_CONFIG_1 0x3FFE00
1274#define MADERA_DSP7_CONFIG_2 0x3FFE02
1275#define MADERA_DSP7_SCRATCH_1 0x3FFE40
1276#define MADERA_DSP7_SCRATCH_2 0x3FFE42
1277#define MADERA_DSP7_PMEM_ERR_ADDR___XMEM_ERR_ADDR 0x3FFE7C
1278
1279/* (0x0000) Software_Reset */
1280#define MADERA_SW_RST_DEV_ID1_MASK 0xFFFF
1281#define MADERA_SW_RST_DEV_ID1_SHIFT 0
1282#define MADERA_SW_RST_DEV_ID1_WIDTH 16
1283
1284/* (0x0001) Hardware_Revision */
1285#define MADERA_HW_REVISION_MASK 0x00FF
1286#define MADERA_HW_REVISION_SHIFT 0
1287#define MADERA_HW_REVISION_WIDTH 8
1288
1289/* (0x0020) Tone_Generator_1 */
1290#define MADERA_TONE2_ENA 0x0002
1291#define MADERA_TONE2_ENA_MASK 0x0002
1292#define MADERA_TONE2_ENA_SHIFT 1
1293#define MADERA_TONE2_ENA_WIDTH 1
1294#define MADERA_TONE1_ENA 0x0001
1295#define MADERA_TONE1_ENA_MASK 0x0001
1296#define MADERA_TONE1_ENA_SHIFT 0
1297#define MADERA_TONE1_ENA_WIDTH 1
1298
1299/* (0x0021) Tone_Generator_2 */
1300#define MADERA_TONE1_LVL_0_MASK 0xFFFF
1301#define MADERA_TONE1_LVL_0_SHIFT 0
1302#define MADERA_TONE1_LVL_0_WIDTH 16
1303
1304/* (0x0022) Tone_Generator_3 */
1305#define MADERA_TONE1_LVL_MASK 0x00FF
1306#define MADERA_TONE1_LVL_SHIFT 0
1307#define MADERA_TONE1_LVL_WIDTH 8
1308
1309/* (0x0023) Tone_Generator_4 */
1310#define MADERA_TONE2_LVL_0_MASK 0xFFFF
1311#define MADERA_TONE2_LVL_0_SHIFT 0
1312#define MADERA_TONE2_LVL_0_WIDTH 16
1313
1314/* (0x0024) Tone_Generator_5 */
1315#define MADERA_TONE2_LVL_MASK 0x00FF
1316#define MADERA_TONE2_LVL_SHIFT 0
1317#define MADERA_TONE2_LVL_WIDTH 8
1318
1319/* (0x0030) PWM_Drive_1 */
1320#define MADERA_PWM2_ENA 0x0002
1321#define MADERA_PWM2_ENA_MASK 0x0002
1322#define MADERA_PWM2_ENA_SHIFT 1
1323#define MADERA_PWM2_ENA_WIDTH 1
1324#define MADERA_PWM1_ENA 0x0001
1325#define MADERA_PWM1_ENA_MASK 0x0001
1326#define MADERA_PWM1_ENA_SHIFT 0
1327#define MADERA_PWM1_ENA_WIDTH 1
1328
1329/* (0x00A0) Comfort_Noise_Generator */
1330#define MADERA_NOISE_GEN_ENA 0x0020
1331#define MADERA_NOISE_GEN_ENA_MASK 0x0020
1332#define MADERA_NOISE_GEN_ENA_SHIFT 5
1333#define MADERA_NOISE_GEN_ENA_WIDTH 1
1334#define MADERA_NOISE_GEN_GAIN_MASK 0x001F
1335#define MADERA_NOISE_GEN_GAIN_SHIFT 0
1336#define MADERA_NOISE_GEN_GAIN_WIDTH 5
1337
1338/* (0x0100) Clock_32k_1 */
1339#define MADERA_CLK_32K_ENA 0x0040
1340#define MADERA_CLK_32K_ENA_MASK 0x0040
1341#define MADERA_CLK_32K_ENA_SHIFT 6
1342#define MADERA_CLK_32K_ENA_WIDTH 1
1343#define MADERA_CLK_32K_SRC_MASK 0x0003
1344#define MADERA_CLK_32K_SRC_SHIFT 0
1345#define MADERA_CLK_32K_SRC_WIDTH 2
1346
1347/* (0x0101) System_Clock_1 */
1348#define MADERA_SYSCLK_FRAC 0x8000
1349#define MADERA_SYSCLK_FRAC_MASK 0x8000
1350#define MADERA_SYSCLK_FRAC_SHIFT 15
1351#define MADERA_SYSCLK_FRAC_WIDTH 1
1352#define MADERA_SYSCLK_FREQ_MASK 0x0700
1353#define MADERA_SYSCLK_FREQ_SHIFT 8
1354#define MADERA_SYSCLK_FREQ_WIDTH 3
1355#define MADERA_SYSCLK_ENA 0x0040
1356#define MADERA_SYSCLK_ENA_MASK 0x0040
1357#define MADERA_SYSCLK_ENA_SHIFT 6
1358#define MADERA_SYSCLK_ENA_WIDTH 1
1359#define MADERA_SYSCLK_SRC_MASK 0x000F
1360#define MADERA_SYSCLK_SRC_SHIFT 0
1361#define MADERA_SYSCLK_SRC_WIDTH 4
1362
1363/* (0x0102) Sample_rate_1 */
1364#define MADERA_SAMPLE_RATE_1_MASK 0x001F
1365#define MADERA_SAMPLE_RATE_1_SHIFT 0
1366#define MADERA_SAMPLE_RATE_1_WIDTH 5
1367
1368/* (0x0103) Sample_rate_2 */
1369#define MADERA_SAMPLE_RATE_2_MASK 0x001F
1370#define MADERA_SAMPLE_RATE_2_SHIFT 0
1371#define MADERA_SAMPLE_RATE_2_WIDTH 5
1372
1373/* (0x0104) Sample_rate_3 */
1374#define MADERA_SAMPLE_RATE_3_MASK 0x001F
1375#define MADERA_SAMPLE_RATE_3_SHIFT 0
1376#define MADERA_SAMPLE_RATE_3_WIDTH 5
1377
1378/* (0x0112) Async_clock_1 */
1379#define MADERA_ASYNC_CLK_FREQ_MASK 0x0700
1380#define MADERA_ASYNC_CLK_FREQ_SHIFT 8
1381#define MADERA_ASYNC_CLK_FREQ_WIDTH 3
1382#define MADERA_ASYNC_CLK_ENA 0x0040
1383#define MADERA_ASYNC_CLK_ENA_MASK 0x0040
1384#define MADERA_ASYNC_CLK_ENA_SHIFT 6
1385#define MADERA_ASYNC_CLK_ENA_WIDTH 1
1386#define MADERA_ASYNC_CLK_SRC_MASK 0x000F
1387#define MADERA_ASYNC_CLK_SRC_SHIFT 0
1388#define MADERA_ASYNC_CLK_SRC_WIDTH 4
1389
1390/* (0x0113) Async_sample_rate_1 */
1391#define MADERA_ASYNC_SAMPLE_RATE_1_MASK 0x001F
1392#define MADERA_ASYNC_SAMPLE_RATE_1_SHIFT 0
1393#define MADERA_ASYNC_SAMPLE_RATE_1_WIDTH 5
1394
1395/* (0x0114) Async_sample_rate_2 */
1396#define MADERA_ASYNC_SAMPLE_RATE_2_MASK 0x001F
1397#define MADERA_ASYNC_SAMPLE_RATE_2_SHIFT 0
1398#define MADERA_ASYNC_SAMPLE_RATE_2_WIDTH 5
1399
1400/* (0x0120) DSP_Clock_1 */
1401#define MADERA_DSP_CLK_FREQ_LEGACY 0x0700
1402#define MADERA_DSP_CLK_FREQ_LEGACY_MASK 0x0700
1403#define MADERA_DSP_CLK_FREQ_LEGACY_SHIFT 8
1404#define MADERA_DSP_CLK_FREQ_LEGACY_WIDTH 3
1405#define MADERA_DSP_CLK_ENA 0x0040
1406#define MADERA_DSP_CLK_ENA_MASK 0x0040
1407#define MADERA_DSP_CLK_ENA_SHIFT 6
1408#define MADERA_DSP_CLK_ENA_WIDTH 1
1409#define MADERA_DSP_CLK_SRC 0x000F
1410#define MADERA_DSP_CLK_SRC_MASK 0x000F
1411#define MADERA_DSP_CLK_SRC_SHIFT 0
1412#define MADERA_DSP_CLK_SRC_WIDTH 4
1413
1414/* (0x0122) DSP_Clock_2 */
1415#define MADERA_DSP_CLK_FREQ_MASK 0x03FF
1416#define MADERA_DSP_CLK_FREQ_SHIFT 0
1417#define MADERA_DSP_CLK_FREQ_WIDTH 10
1418
1419/* (0x0149) Output_system_clock */
1420#define MADERA_OPCLK_ENA 0x8000
1421#define MADERA_OPCLK_ENA_MASK 0x8000
1422#define MADERA_OPCLK_ENA_SHIFT 15
1423#define MADERA_OPCLK_ENA_WIDTH 1
1424#define MADERA_OPCLK_DIV_MASK 0x00F8
1425#define MADERA_OPCLK_DIV_SHIFT 3
1426#define MADERA_OPCLK_DIV_WIDTH 5
1427#define MADERA_OPCLK_SEL_MASK 0x0007
1428#define MADERA_OPCLK_SEL_SHIFT 0
1429#define MADERA_OPCLK_SEL_WIDTH 3
1430
1431/* (0x014A) Output_async_clock */
1432#define MADERA_OPCLK_ASYNC_ENA 0x8000
1433#define MADERA_OPCLK_ASYNC_ENA_MASK 0x8000
1434#define MADERA_OPCLK_ASYNC_ENA_SHIFT 15
1435#define MADERA_OPCLK_ASYNC_ENA_WIDTH 1
1436#define MADERA_OPCLK_ASYNC_DIV_MASK 0x00F8
1437#define MADERA_OPCLK_ASYNC_DIV_SHIFT 3
1438#define MADERA_OPCLK_ASYNC_DIV_WIDTH 5
1439#define MADERA_OPCLK_ASYNC_SEL_MASK 0x0007
1440#define MADERA_OPCLK_ASYNC_SEL_SHIFT 0
1441#define MADERA_OPCLK_ASYNC_SEL_WIDTH 3
1442
1443/* (0x0171) FLL1_Control_1 */
1444#define MADERA_FLL1_FREERUN 0x0002
1445#define MADERA_FLL1_FREERUN_MASK 0x0002
1446#define MADERA_FLL1_FREERUN_SHIFT 1
1447#define MADERA_FLL1_FREERUN_WIDTH 1
1448#define MADERA_FLL1_ENA 0x0001
1449#define MADERA_FLL1_ENA_MASK 0x0001
1450#define MADERA_FLL1_ENA_SHIFT 0
1451#define MADERA_FLL1_ENA_WIDTH 1
1452
1453/* (0x0172) FLL1_Control_2 */
1454#define MADERA_FLL1_CTRL_UPD 0x8000
1455#define MADERA_FLL1_CTRL_UPD_MASK 0x8000
1456#define MADERA_FLL1_CTRL_UPD_SHIFT 15
1457#define MADERA_FLL1_CTRL_UPD_WIDTH 1
1458#define MADERA_FLL1_N_MASK 0x03FF
1459#define MADERA_FLL1_N_SHIFT 0
1460#define MADERA_FLL1_N_WIDTH 10
1461
1462/* (0x0173) FLL1_Control_3 */
1463#define MADERA_FLL1_THETA_MASK 0xFFFF
1464#define MADERA_FLL1_THETA_SHIFT 0
1465#define MADERA_FLL1_THETA_WIDTH 16
1466
1467/* (0x0174) FLL1_Control_4 */
1468#define MADERA_FLL1_LAMBDA_MASK 0xFFFF
1469#define MADERA_FLL1_LAMBDA_SHIFT 0
1470#define MADERA_FLL1_LAMBDA_WIDTH 16
1471
1472/* (0x0175) FLL1_Control_5 */
1473#define MADERA_FLL1_FRATIO_MASK 0x0F00
1474#define MADERA_FLL1_FRATIO_SHIFT 8
1475#define MADERA_FLL1_FRATIO_WIDTH 4
1476
1477/* (0x0176) FLL1_Control_6 */
1478#define MADERA_FLL1_REFCLK_DIV_MASK 0x00C0
1479#define MADERA_FLL1_REFCLK_DIV_SHIFT 6
1480#define MADERA_FLL1_REFCLK_DIV_WIDTH 2
1481#define MADERA_FLL1_REFCLK_SRC_MASK 0x000F
1482#define MADERA_FLL1_REFCLK_SRC_SHIFT 0
1483#define MADERA_FLL1_REFCLK_SRC_WIDTH 4
1484
1485/* (0x0177) FLL1_Loop_Filter_Test_1 */
1486#define MADERA_FLL1_FRC_INTEG_UPD 0x8000
1487#define MADERA_FLL1_FRC_INTEG_UPD_MASK 0x8000
1488#define MADERA_FLL1_FRC_INTEG_UPD_SHIFT 15
1489#define MADERA_FLL1_FRC_INTEG_UPD_WIDTH 1
1490#define MADERA_FLL1_FRC_INTEG_VAL_MASK 0x0FFF
1491#define MADERA_FLL1_FRC_INTEG_VAL_SHIFT 0
1492#define MADERA_FLL1_FRC_INTEG_VAL_WIDTH 12
1493
1494/* (0x0179) FLL1_Control_7 */
1495#define MADERA_FLL1_GAIN_MASK 0x003c
1496#define MADERA_FLL1_GAIN_SHIFT 2
1497#define MADERA_FLL1_GAIN_WIDTH 4
1498
1499/* (0x017A) FLL1_EFS_2 */
1500#define MADERA_FLL1_PHASE_GAIN_MASK 0xF000
1501#define MADERA_FLL1_PHASE_GAIN_SHIFT 12
1502#define MADERA_FLL1_PHASE_GAIN_WIDTH 4
1503#define MADERA_FLL1_PHASE_ENA_MASK 0x0800
1504#define MADERA_FLL1_PHASE_ENA_SHIFT 11
1505#define MADERA_FLL1_PHASE_ENA_WIDTH 1
1506
1507/* (0x0181) FLL1_Synchroniser_1 */
1508#define MADERA_FLL1_SYNC_ENA 0x0001
1509#define MADERA_FLL1_SYNC_ENA_MASK 0x0001
1510#define MADERA_FLL1_SYNC_ENA_SHIFT 0
1511#define MADERA_FLL1_SYNC_ENA_WIDTH 1
1512
1513/* (0x0182) FLL1_Synchroniser_2 */
1514#define MADERA_FLL1_SYNC_N_MASK 0x03FF
1515#define MADERA_FLL1_SYNC_N_SHIFT 0
1516#define MADERA_FLL1_SYNC_N_WIDTH 10
1517
1518/* (0x0183) FLL1_Synchroniser_3 */
1519#define MADERA_FLL1_SYNC_THETA_MASK 0xFFFF
1520#define MADERA_FLL1_SYNC_THETA_SHIFT 0
1521#define MADERA_FLL1_SYNC_THETA_WIDTH 16
1522
1523/* (0x0184) FLL1_Synchroniser_4 */
1524#define MADERA_FLL1_SYNC_LAMBDA_MASK 0xFFFF
1525#define MADERA_FLL1_SYNC_LAMBDA_SHIFT 0
1526#define MADERA_FLL1_SYNC_LAMBDA_WIDTH 16
1527
1528/* (0x0185) FLL1_Synchroniser_5 */
1529#define MADERA_FLL1_SYNC_FRATIO_MASK 0x0700
1530#define MADERA_FLL1_SYNC_FRATIO_SHIFT 8
1531#define MADERA_FLL1_SYNC_FRATIO_WIDTH 3
1532
1533/* (0x0186) FLL1_Synchroniser_6 */
1534#define MADERA_FLL1_SYNCCLK_DIV_MASK 0x00C0
1535#define MADERA_FLL1_SYNCCLK_DIV_SHIFT 6
1536#define MADERA_FLL1_SYNCCLK_DIV_WIDTH 2
1537#define MADERA_FLL1_SYNCCLK_SRC_MASK 0x000F
1538#define MADERA_FLL1_SYNCCLK_SRC_SHIFT 0
1539#define MADERA_FLL1_SYNCCLK_SRC_WIDTH 4
1540
1541/* (0x0187) FLL1_Synchroniser_7 */
1542#define MADERA_FLL1_SYNC_GAIN_MASK 0x003c
1543#define MADERA_FLL1_SYNC_GAIN_SHIFT 2
1544#define MADERA_FLL1_SYNC_GAIN_WIDTH 4
1545#define MADERA_FLL1_SYNC_DFSAT 0x0001
1546#define MADERA_FLL1_SYNC_DFSAT_MASK 0x0001
1547#define MADERA_FLL1_SYNC_DFSAT_SHIFT 0
1548#define MADERA_FLL1_SYNC_DFSAT_WIDTH 1
1549
1550/* (0x01D1) FLL_AO_Control_1 */
1551#define MADERA_FLL_AO_HOLD 0x0004
1552#define MADERA_FLL_AO_HOLD_MASK 0x0004
1553#define MADERA_FLL_AO_HOLD_SHIFT 2
1554#define MADERA_FLL_AO_HOLD_WIDTH 1
1555#define MADERA_FLL_AO_FREERUN 0x0002
1556#define MADERA_FLL_AO_FREERUN_MASK 0x0002
1557#define MADERA_FLL_AO_FREERUN_SHIFT 1
1558#define MADERA_FLL_AO_FREERUN_WIDTH 1
1559#define MADERA_FLL_AO_ENA 0x0001
1560#define MADERA_FLL_AO_ENA_MASK 0x0001
1561#define MADERA_FLL_AO_ENA_SHIFT 0
1562#define MADERA_FLL_AO_ENA_WIDTH 1
1563
1564/* (0x01D2) FLL_AO_Control_2 */
1565#define MADERA_FLL_AO_CTRL_UPD 0x8000
1566#define MADERA_FLL_AO_CTRL_UPD_MASK 0x8000
1567#define MADERA_FLL_AO_CTRL_UPD_SHIFT 15
1568#define MADERA_FLL_AO_CTRL_UPD_WIDTH 1
1569
1570/* (0x01D6) FLL_AO_Control_6 */
1571#define MADERA_FLL_AO_REFCLK_SRC_MASK 0x000F
1572#define MADERA_FLL_AO_REFCLK_SRC_SHIFT 0
1573#define MADERA_FLL_AO_REFCLK_SRC_WIDTH 4
1574
1575/* (0x0200) Mic_Charge_Pump_1 */
1576#define MADERA_CPMIC_BYPASS 0x0002
1577#define MADERA_CPMIC_BYPASS_MASK 0x0002
1578#define MADERA_CPMIC_BYPASS_SHIFT 1
1579#define MADERA_CPMIC_BYPASS_WIDTH 1
1580#define MADERA_CPMIC_ENA 0x0001
1581#define MADERA_CPMIC_ENA_MASK 0x0001
1582#define MADERA_CPMIC_ENA_SHIFT 0
1583#define MADERA_CPMIC_ENA_WIDTH 1
1584
1585/* (0x0210) LDO1_Control_1 */
1586#define MADERA_LDO1_VSEL_MASK 0x07E0
1587#define MADERA_LDO1_VSEL_SHIFT 5
1588#define MADERA_LDO1_VSEL_WIDTH 6
1589#define MADERA_LDO1_FAST 0x0010
1590#define MADERA_LDO1_FAST_MASK 0x0010
1591#define MADERA_LDO1_FAST_SHIFT 4
1592#define MADERA_LDO1_FAST_WIDTH 1
1593#define MADERA_LDO1_DISCH 0x0004
1594#define MADERA_LDO1_DISCH_MASK 0x0004
1595#define MADERA_LDO1_DISCH_SHIFT 2
1596#define MADERA_LDO1_DISCH_WIDTH 1
1597#define MADERA_LDO1_BYPASS 0x0002
1598#define MADERA_LDO1_BYPASS_MASK 0x0002
1599#define MADERA_LDO1_BYPASS_SHIFT 1
1600#define MADERA_LDO1_BYPASS_WIDTH 1
1601#define MADERA_LDO1_ENA 0x0001
1602#define MADERA_LDO1_ENA_MASK 0x0001
1603#define MADERA_LDO1_ENA_SHIFT 0
1604#define MADERA_LDO1_ENA_WIDTH 1
1605
1606/* (0x0213) LDO2_Control_1 */
1607#define MADERA_LDO2_VSEL_MASK 0x07E0
1608#define MADERA_LDO2_VSEL_SHIFT 5
1609#define MADERA_LDO2_VSEL_WIDTH 6
1610#define MADERA_LDO2_FAST 0x0010
1611#define MADERA_LDO2_FAST_MASK 0x0010
1612#define MADERA_LDO2_FAST_SHIFT 4
1613#define MADERA_LDO2_FAST_WIDTH 1
1614#define MADERA_LDO2_DISCH 0x0004
1615#define MADERA_LDO2_DISCH_MASK 0x0004
1616#define MADERA_LDO2_DISCH_SHIFT 2
1617#define MADERA_LDO2_DISCH_WIDTH 1
1618#define MADERA_LDO2_BYPASS 0x0002
1619#define MADERA_LDO2_BYPASS_MASK 0x0002
1620#define MADERA_LDO2_BYPASS_SHIFT 1
1621#define MADERA_LDO2_BYPASS_WIDTH 1
1622#define MADERA_LDO2_ENA 0x0001
1623#define MADERA_LDO2_ENA_MASK 0x0001
1624#define MADERA_LDO2_ENA_SHIFT 0
1625#define MADERA_LDO2_ENA_WIDTH 1
1626
1627/* (0x0218) Mic_Bias_Ctrl_1 */
1628#define MADERA_MICB1_ENA 0x0001
1629#define MADERA_MICB1_ENA_MASK 0x0001
1630#define MADERA_MICB1_ENA_SHIFT 0
1631#define MADERA_MICB1_ENA_WIDTH 1
1632
1633/* (0x021C) Mic_Bias_Ctrl_5 */
1634#define MADERA_MICB1D_ENA 0x1000
1635#define MADERA_MICB1D_ENA_MASK 0x1000
1636#define MADERA_MICB1D_ENA_SHIFT 12
1637#define MADERA_MICB1D_ENA_WIDTH 1
1638#define MADERA_MICB1C_ENA 0x0100
1639#define MADERA_MICB1C_ENA_MASK 0x0100
1640#define MADERA_MICB1C_ENA_SHIFT 8
1641#define MADERA_MICB1C_ENA_WIDTH 1
1642#define MADERA_MICB1B_ENA 0x0010
1643#define MADERA_MICB1B_ENA_MASK 0x0010
1644#define MADERA_MICB1B_ENA_SHIFT 4
1645#define MADERA_MICB1B_ENA_WIDTH 1
1646#define MADERA_MICB1A_ENA 0x0001
1647#define MADERA_MICB1A_ENA_MASK 0x0001
1648#define MADERA_MICB1A_ENA_SHIFT 0
1649#define MADERA_MICB1A_ENA_WIDTH 1
1650
1651/* (0x021E) Mic_Bias_Ctrl_6 */
1652#define MADERA_MICB2D_ENA 0x1000
1653#define MADERA_MICB2D_ENA_MASK 0x1000
1654#define MADERA_MICB2D_ENA_SHIFT 12
1655#define MADERA_MICB2D_ENA_WIDTH 1
1656#define MADERA_MICB2C_ENA 0x0100
1657#define MADERA_MICB2C_ENA_MASK 0x0100
1658#define MADERA_MICB2C_ENA_SHIFT 8
1659#define MADERA_MICB2C_ENA_WIDTH 1
1660#define MADERA_MICB2B_ENA 0x0010
1661#define MADERA_MICB2B_ENA_MASK 0x0010
1662#define MADERA_MICB2B_ENA_SHIFT 4
1663#define MADERA_MICB2B_ENA_WIDTH 1
1664#define MADERA_MICB2A_ENA 0x0001
1665#define MADERA_MICB2A_ENA_MASK 0x0001
1666#define MADERA_MICB2A_ENA_SHIFT 0
1667#define MADERA_MICB2A_ENA_WIDTH 1
1668
1669/* (0x0225) - HP Ctrl 1L */
1670#define MADERA_RMV_SHRT_HP1L 0x4000
1671#define MADERA_RMV_SHRT_HP1L_MASK 0x4000
1672#define MADERA_RMV_SHRT_HP1L_SHIFT 14
1673#define MADERA_RMV_SHRT_HP1L_WIDTH 1
1674#define MADERA_HP1L_FLWR 0x0004
1675#define MADERA_HP1L_FLWR_MASK 0x0004
1676#define MADERA_HP1L_FLWR_SHIFT 2
1677#define MADERA_HP1L_FLWR_WIDTH 1
1678#define MADERA_HP1L_SHRTI 0x0002
1679#define MADERA_HP1L_SHRTI_MASK 0x0002
1680#define MADERA_HP1L_SHRTI_SHIFT 1
1681#define MADERA_HP1L_SHRTI_WIDTH 1
1682#define MADERA_HP1L_SHRTO 0x0001
1683#define MADERA_HP1L_SHRTO_MASK 0x0001
1684#define MADERA_HP1L_SHRTO_SHIFT 0
1685#define MADERA_HP1L_SHRTO_WIDTH 1
1686
1687/* (0x0226) - HP Ctrl 1R */
1688#define MADERA_RMV_SHRT_HP1R 0x4000
1689#define MADERA_RMV_SHRT_HP1R_MASK 0x4000
1690#define MADERA_RMV_SHRT_HP1R_SHIFT 14
1691#define MADERA_RMV_SHRT_HP1R_WIDTH 1
1692#define MADERA_HP1R_FLWR 0x0004
1693#define MADERA_HP1R_FLWR_MASK 0x0004
1694#define MADERA_HP1R_FLWR_SHIFT 2
1695#define MADERA_HP1R_FLWR_WIDTH 1
1696#define MADERA_HP1R_SHRTI 0x0002
1697#define MADERA_HP1R_SHRTI_MASK 0x0002
1698#define MADERA_HP1R_SHRTI_SHIFT 1
1699#define MADERA_HP1R_SHRTI_WIDTH 1
1700#define MADERA_HP1R_SHRTO 0x0001
1701#define MADERA_HP1R_SHRTO_MASK 0x0001
1702#define MADERA_HP1R_SHRTO_SHIFT 0
1703#define MADERA_HP1R_SHRTO_WIDTH 1
1704
1705/* (0x0293) Accessory_Detect_Mode_1 */
1706#define MADERA_ACCDET_SRC 0x2000
1707#define MADERA_ACCDET_SRC_MASK 0x2000
1708#define MADERA_ACCDET_SRC_SHIFT 13
1709#define MADERA_ACCDET_SRC_WIDTH 1
1710#define MADERA_ACCDET_POLARITY_INV_ENA 0x0080
1711#define MADERA_ACCDET_POLARITY_INV_ENA_MASK 0x0080
1712#define MADERA_ACCDET_POLARITY_INV_ENA_SHIFT 7
1713#define MADERA_ACCDET_POLARITY_INV_ENA_WIDTH 1
1714#define MADERA_ACCDET_MODE_MASK 0x0007
1715#define MADERA_ACCDET_MODE_SHIFT 0
1716#define MADERA_ACCDET_MODE_WIDTH 3
1717
1718/* (0x0299) Headphone_Detect_0 */
1719#define MADERA_HPD_GND_SEL 0x0007
1720#define MADERA_HPD_GND_SEL_MASK 0x0007
1721#define MADERA_HPD_GND_SEL_SHIFT 0
1722#define MADERA_HPD_GND_SEL_WIDTH 3
1723#define MADERA_HPD_SENSE_SEL 0x00F0
1724#define MADERA_HPD_SENSE_SEL_MASK 0x00F0
1725#define MADERA_HPD_SENSE_SEL_SHIFT 4
1726#define MADERA_HPD_SENSE_SEL_WIDTH 4
1727#define MADERA_HPD_FRC_SEL 0x0F00
1728#define MADERA_HPD_FRC_SEL_MASK 0x0F00
1729#define MADERA_HPD_FRC_SEL_SHIFT 8
1730#define MADERA_HPD_FRC_SEL_WIDTH 4
1731#define MADERA_HPD_OUT_SEL 0x7000
1732#define MADERA_HPD_OUT_SEL_MASK 0x7000
1733#define MADERA_HPD_OUT_SEL_SHIFT 12
1734#define MADERA_HPD_OUT_SEL_WIDTH 3
1735#define MADERA_HPD_OVD_ENA_SEL 0x8000
1736#define MADERA_HPD_OVD_ENA_SEL_MASK 0x8000
1737#define MADERA_HPD_OVD_ENA_SEL_SHIFT 15
1738#define MADERA_HPD_OVD_ENA_SEL_WIDTH 1
1739
1740/* (0x029B) Headphone_Detect_1 */
1741#define MADERA_HP_IMPEDANCE_RANGE_MASK 0x0600
1742#define MADERA_HP_IMPEDANCE_RANGE_SHIFT 9
1743#define MADERA_HP_IMPEDANCE_RANGE_WIDTH 2
1744#define MADERA_HP_STEP_SIZE 0x0100
1745#define MADERA_HP_STEP_SIZE_MASK 0x0100
1746#define MADERA_HP_STEP_SIZE_SHIFT 8
1747#define MADERA_HP_STEP_SIZE_WIDTH 1
1748#define MADERA_HP_CLK_DIV_MASK 0x0018
1749#define MADERA_HP_CLK_DIV_SHIFT 3
1750#define MADERA_HP_CLK_DIV_WIDTH 2
1751#define MADERA_HP_RATE_MASK 0x0006
1752#define MADERA_HP_RATE_SHIFT 1
1753#define MADERA_HP_RATE_WIDTH 2
1754#define MADERA_HP_POLL 0x0001
1755#define MADERA_HP_POLL_MASK 0x0001
1756#define MADERA_HP_POLL_SHIFT 0
1757#define MADERA_HP_POLL_WIDTH 1
1758
1759/* (0x029C) Headphone_Detect_2 */
1760#define MADERA_HP_DONE_MASK 0x8000
1761#define MADERA_HP_DONE_SHIFT 15
1762#define MADERA_HP_DONE_WIDTH 1
1763#define MADERA_HP_LVL_MASK 0x7FFF
1764#define MADERA_HP_LVL_SHIFT 0
1765#define MADERA_HP_LVL_WIDTH 15
1766
1767/* (0x029D) Headphone_Detect_3 */
1768#define MADERA_HP_DACVAL_MASK 0x03FF
1769#define MADERA_HP_DACVAL_SHIFT 0
1770#define MADERA_HP_DACVAL_WIDTH 10
1771
1772/* (0x029F) - Headphone Detect 5 */
1773#define MADERA_HP_DACVAL_DOWN_MASK 0x03FF
1774#define MADERA_HP_DACVAL_DOWN_SHIFT 0
1775#define MADERA_HP_DACVAL_DOWN_WIDTH 10
1776
1777/* (0x02A2) Mic_Detect_1_Control_0 */
1778#define MADERA_MICD1_GND_MASK 0x0007
1779#define MADERA_MICD1_GND_SHIFT 0
1780#define MADERA_MICD1_GND_WIDTH 3
1781#define MADERA_MICD1_SENSE_MASK 0x00F0
1782#define MADERA_MICD1_SENSE_SHIFT 4
1783#define MADERA_MICD1_SENSE_WIDTH 4
1784#define MADERA_MICD1_ADC_MODE_MASK 0x8000
1785#define MADERA_MICD1_ADC_MODE_SHIFT 15
1786#define MADERA_MICD1_ADC_MODE_WIDTH 1
1787
1788/* (0x02A3) Mic_Detect_1_Control_1 */
1789#define MADERA_MICD_BIAS_STARTTIME_MASK 0xF000
1790#define MADERA_MICD_BIAS_STARTTIME_SHIFT 12
1791#define MADERA_MICD_BIAS_STARTTIME_WIDTH 4
1792#define MADERA_MICD_RATE_MASK 0x0F00
1793#define MADERA_MICD_RATE_SHIFT 8
1794#define MADERA_MICD_RATE_WIDTH 4
1795#define MADERA_MICD_BIAS_SRC_MASK 0x00F0
1796#define MADERA_MICD_BIAS_SRC_SHIFT 4
1797#define MADERA_MICD_BIAS_SRC_WIDTH 4
1798#define MADERA_MICD_DBTIME 0x0002
1799#define MADERA_MICD_DBTIME_MASK 0x0002
1800#define MADERA_MICD_DBTIME_SHIFT 1
1801#define MADERA_MICD_DBTIME_WIDTH 1
1802#define MADERA_MICD_ENA 0x0001
1803#define MADERA_MICD_ENA_MASK 0x0001
1804#define MADERA_MICD_ENA_SHIFT 0
1805#define MADERA_MICD_ENA_WIDTH 1
1806
1807/* (0x02A4) Mic_Detect_1_Control_2 */
1808#define MADERA_MICD_LVL_SEL_MASK 0x00FF
1809#define MADERA_MICD_LVL_SEL_SHIFT 0
1810#define MADERA_MICD_LVL_SEL_WIDTH 8
1811
1812/* (0x02A5) Mic_Detect_1_Control_3 */
1813#define MADERA_MICD_LVL_0 0x0004
1814#define MADERA_MICD_LVL_1 0x0008
1815#define MADERA_MICD_LVL_2 0x0010
1816#define MADERA_MICD_LVL_3 0x0020
1817#define MADERA_MICD_LVL_4 0x0040
1818#define MADERA_MICD_LVL_5 0x0080
1819#define MADERA_MICD_LVL_6 0x0100
1820#define MADERA_MICD_LVL_7 0x0200
1821#define MADERA_MICD_LVL_8 0x0400
1822#define MADERA_MICD_LVL_MASK 0x07FC
1823#define MADERA_MICD_LVL_SHIFT 2
1824#define MADERA_MICD_LVL_WIDTH 9
1825#define MADERA_MICD_VALID 0x0002
1826#define MADERA_MICD_VALID_MASK 0x0002
1827#define MADERA_MICD_VALID_SHIFT 1
1828#define MADERA_MICD_VALID_WIDTH 1
1829#define MADERA_MICD_STS 0x0001
1830#define MADERA_MICD_STS_MASK 0x0001
1831#define MADERA_MICD_STS_SHIFT 0
1832#define MADERA_MICD_STS_WIDTH 1
1833
1834/* (0x02AB) Mic_Detect_1_Control_4 */
1835#define MADERA_MICDET_ADCVAL_DIFF_MASK 0xFF00
1836#define MADERA_MICDET_ADCVAL_DIFF_SHIFT 8
1837#define MADERA_MICDET_ADCVAL_DIFF_WIDTH 8
1838#define MADERA_MICDET_ADCVAL_MASK 0x007F
1839#define MADERA_MICDET_ADCVAL_SHIFT 0
1840#define MADERA_MICDET_ADCVAL_WIDTH 7
1841
1842/* (0x02C6) Micd_Clamp_control */
1843#define MADERA_MICD_CLAMP_OVD 0x0010
1844#define MADERA_MICD_CLAMP_OVD_MASK 0x0010
1845#define MADERA_MICD_CLAMP_OVD_SHIFT 4
1846#define MADERA_MICD_CLAMP_OVD_WIDTH 1
1847#define MADERA_MICD_CLAMP_MODE_MASK 0x000F
1848#define MADERA_MICD_CLAMP_MODE_SHIFT 0
1849#define MADERA_MICD_CLAMP_MODE_WIDTH 4
1850
1851/* (0x02C8) GP_Switch_1 */
1852#define MADERA_SW2_MODE_MASK 0x000C
1853#define MADERA_SW2_MODE_SHIFT 2
1854#define MADERA_SW2_MODE_WIDTH 2
1855#define MADERA_SW1_MODE_MASK 0x0003
1856#define MADERA_SW1_MODE_SHIFT 0
1857#define MADERA_SW1_MODE_WIDTH 2
1858
1859/* (0x02D3) Jack_detect_analogue */
1860#define MADERA_JD2_ENA 0x0002
1861#define MADERA_JD2_ENA_MASK 0x0002
1862#define MADERA_JD2_ENA_SHIFT 1
1863#define MADERA_JD2_ENA_WIDTH 1
1864#define MADERA_JD1_ENA 0x0001
1865#define MADERA_JD1_ENA_MASK 0x0001
1866#define MADERA_JD1_ENA_SHIFT 0
1867#define MADERA_JD1_ENA_WIDTH 1
1868
1869/* (0x0300) Input_Enables */
1870#define MADERA_IN6L_ENA 0x0800
1871#define MADERA_IN6L_ENA_MASK 0x0800
1872#define MADERA_IN6L_ENA_SHIFT 11
1873#define MADERA_IN6L_ENA_WIDTH 1
1874#define MADERA_IN6R_ENA 0x0400
1875#define MADERA_IN6R_ENA_MASK 0x0400
1876#define MADERA_IN6R_ENA_SHIFT 10
1877#define MADERA_IN6R_ENA_WIDTH 1
1878#define MADERA_IN5L_ENA 0x0200
1879#define MADERA_IN5L_ENA_MASK 0x0200
1880#define MADERA_IN5L_ENA_SHIFT 9
1881#define MADERA_IN5L_ENA_WIDTH 1
1882#define MADERA_IN5R_ENA 0x0100
1883#define MADERA_IN5R_ENA_MASK 0x0100
1884#define MADERA_IN5R_ENA_SHIFT 8
1885#define MADERA_IN5R_ENA_WIDTH 1
1886#define MADERA_IN4L_ENA 0x0080
1887#define MADERA_IN4L_ENA_MASK 0x0080
1888#define MADERA_IN4L_ENA_SHIFT 7
1889#define MADERA_IN4L_ENA_WIDTH 1
1890#define MADERA_IN4R_ENA 0x0040
1891#define MADERA_IN4R_ENA_MASK 0x0040
1892#define MADERA_IN4R_ENA_SHIFT 6
1893#define MADERA_IN4R_ENA_WIDTH 1
1894#define MADERA_IN3L_ENA 0x0020
1895#define MADERA_IN3L_ENA_MASK 0x0020
1896#define MADERA_IN3L_ENA_SHIFT 5
1897#define MADERA_IN3L_ENA_WIDTH 1
1898#define MADERA_IN3R_ENA 0x0010
1899#define MADERA_IN3R_ENA_MASK 0x0010
1900#define MADERA_IN3R_ENA_SHIFT 4
1901#define MADERA_IN3R_ENA_WIDTH 1
1902#define MADERA_IN2L_ENA 0x0008
1903#define MADERA_IN2L_ENA_MASK 0x0008
1904#define MADERA_IN2L_ENA_SHIFT 3
1905#define MADERA_IN2L_ENA_WIDTH 1
1906#define MADERA_IN2R_ENA 0x0004
1907#define MADERA_IN2R_ENA_MASK 0x0004
1908#define MADERA_IN2R_ENA_SHIFT 2
1909#define MADERA_IN2R_ENA_WIDTH 1
1910#define MADERA_IN1L_ENA 0x0002
1911#define MADERA_IN1L_ENA_MASK 0x0002
1912#define MADERA_IN1L_ENA_SHIFT 1
1913#define MADERA_IN1L_ENA_WIDTH 1
1914#define MADERA_IN1R_ENA 0x0001
1915#define MADERA_IN1R_ENA_MASK 0x0001
1916#define MADERA_IN1R_ENA_SHIFT 0
1917#define MADERA_IN1R_ENA_WIDTH 1
1918
1919/* (0x0308) Input_Rate */
1920#define MADERA_IN_RATE_MASK 0xF800
1921#define MADERA_IN_RATE_SHIFT 11
1922#define MADERA_IN_RATE_WIDTH 5
1923#define MADERA_IN_MODE_MASK 0x0400
1924#define MADERA_IN_MODE_SHIFT 10
1925#define MADERA_IN_MODE_WIDTH 1
1926
1927/* (0x0309) Input_Volume_Ramp */
1928#define MADERA_IN_VD_RAMP_MASK 0x0070
1929#define MADERA_IN_VD_RAMP_SHIFT 4
1930#define MADERA_IN_VD_RAMP_WIDTH 3
1931#define MADERA_IN_VI_RAMP_MASK 0x0007
1932#define MADERA_IN_VI_RAMP_SHIFT 0
1933#define MADERA_IN_VI_RAMP_WIDTH 3
1934
1935/* (0x030C) HPF_Control */
1936#define MADERA_IN_HPF_CUT_MASK 0x0007
1937#define MADERA_IN_HPF_CUT_SHIFT 0
1938#define MADERA_IN_HPF_CUT_WIDTH 3
1939
1940/* (0x0310) IN1L_Control */
1941#define MADERA_IN1L_HPF_MASK 0x8000
1942#define MADERA_IN1L_HPF_SHIFT 15
1943#define MADERA_IN1L_HPF_WIDTH 1
1944#define MADERA_IN1_DMIC_SUP_MASK 0x1800
1945#define MADERA_IN1_DMIC_SUP_SHIFT 11
1946#define MADERA_IN1_DMIC_SUP_WIDTH 2
1947#define MADERA_IN1_MODE_MASK 0x0400
1948#define MADERA_IN1_MODE_SHIFT 10
1949#define MADERA_IN1_MODE_WIDTH 1
1950#define MADERA_IN1L_PGA_VOL_MASK 0x00FE
1951#define MADERA_IN1L_PGA_VOL_SHIFT 1
1952#define MADERA_IN1L_PGA_VOL_WIDTH 7
1953
1954/* (0x0311) ADC_Digital_Volume_1L */
1955#define MADERA_IN1L_SRC_MASK 0x4000
1956#define MADERA_IN1L_SRC_SHIFT 14
1957#define MADERA_IN1L_SRC_WIDTH 1
1958#define MADERA_IN1L_SRC_SE_MASK 0x2000
1959#define MADERA_IN1L_SRC_SE_SHIFT 13
1960#define MADERA_IN1L_SRC_SE_WIDTH 1
1961#define MADERA_IN1L_LP_MODE 0x0800
1962#define MADERA_IN1L_LP_MODE_MASK 0x0800
1963#define MADERA_IN1L_LP_MODE_SHIFT 11
1964#define MADERA_IN1L_LP_MODE_WIDTH 1
1965#define MADERA_IN_VU 0x0200
1966#define MADERA_IN_VU_MASK 0x0200
1967#define MADERA_IN_VU_SHIFT 9
1968#define MADERA_IN_VU_WIDTH 1
1969#define MADERA_IN1L_MUTE 0x0100
1970#define MADERA_IN1L_MUTE_MASK 0x0100
1971#define MADERA_IN1L_MUTE_SHIFT 8
1972#define MADERA_IN1L_MUTE_WIDTH 1
1973#define MADERA_IN1L_DIG_VOL_MASK 0x00FF
1974#define MADERA_IN1L_DIG_VOL_SHIFT 0
1975#define MADERA_IN1L_DIG_VOL_WIDTH 8
1976
1977/* (0x0312) DMIC1L_Control */
1978#define MADERA_IN1_OSR_MASK 0x0700
1979#define MADERA_IN1_OSR_SHIFT 8
1980#define MADERA_IN1_OSR_WIDTH 3
1981
1982/* (0x0313) IN1L_Rate_Control */
1983#define MADERA_IN1L_RATE_MASK 0xF800
1984#define MADERA_IN1L_RATE_SHIFT 11
1985#define MADERA_IN1L_RATE_WIDTH 5
1986
1987/* (0x0314) IN1R_Control */
1988#define MADERA_IN1R_HPF_MASK 0x8000
1989#define MADERA_IN1R_HPF_SHIFT 15
1990#define MADERA_IN1R_HPF_WIDTH 1
1991#define MADERA_IN1R_PGA_VOL_MASK 0x00FE
1992#define MADERA_IN1R_PGA_VOL_SHIFT 1
1993#define MADERA_IN1R_PGA_VOL_WIDTH 7
1994#define MADERA_IN1_DMICCLK_SRC_MASK 0x1800
1995#define MADERA_IN1_DMICCLK_SRC_SHIFT 11
1996#define MADERA_IN1_DMICCLK_SRC_WIDTH 2
1997
1998/* (0x0315) ADC_Digital_Volume_1R */
1999#define MADERA_IN1R_SRC_MASK 0x4000
2000#define MADERA_IN1R_SRC_SHIFT 14
2001#define MADERA_IN1R_SRC_WIDTH 1
2002#define MADERA_IN1R_SRC_SE_MASK 0x2000
2003#define MADERA_IN1R_SRC_SE_SHIFT 13
2004#define MADERA_IN1R_SRC_SE_WIDTH 1
2005#define MADERA_IN1R_LP_MODE 0x0800
2006#define MADERA_IN1R_LP_MODE_MASK 0x0800
2007#define MADERA_IN1R_LP_MODE_SHIFT 11
2008#define MADERA_IN1R_LP_MODE_WIDTH 1
2009#define MADERA_IN1R_MUTE 0x0100
2010#define MADERA_IN1R_MUTE_MASK 0x0100
2011#define MADERA_IN1R_MUTE_SHIFT 8
2012#define MADERA_IN1R_MUTE_WIDTH 1
2013#define MADERA_IN1R_DIG_VOL_MASK 0x00FF
2014#define MADERA_IN1R_DIG_VOL_SHIFT 0
2015#define MADERA_IN1R_DIG_VOL_WIDTH 8
2016
2017/* (0x0317) IN1R_Rate_Control */
2018#define MADERA_IN1R_RATE_MASK 0xF800
2019#define MADERA_IN1R_RATE_SHIFT 11
2020#define MADERA_IN1R_RATE_WIDTH 5
2021
2022/* (0x0318) IN2L_Control */
2023#define MADERA_IN2L_HPF_MASK 0x8000
2024#define MADERA_IN2L_HPF_SHIFT 15
2025#define MADERA_IN2L_HPF_WIDTH 1
2026#define MADERA_IN2_DMIC_SUP_MASK 0x1800
2027#define MADERA_IN2_DMIC_SUP_SHIFT 11
2028#define MADERA_IN2_DMIC_SUP_WIDTH 2
2029#define MADERA_IN2_MODE_MASK 0x0400
2030#define MADERA_IN2_MODE_SHIFT 10
2031#define MADERA_IN2_MODE_WIDTH 1
2032#define MADERA_IN2L_PGA_VOL_MASK 0x00FE
2033#define MADERA_IN2L_PGA_VOL_SHIFT 1
2034#define MADERA_IN2L_PGA_VOL_WIDTH 7
2035
2036/* (0x0319) ADC_Digital_Volume_2L */
2037#define MADERA_IN2L_SRC_MASK 0x4000
2038#define MADERA_IN2L_SRC_SHIFT 14
2039#define MADERA_IN2L_SRC_WIDTH 1
2040#define MADERA_IN2L_SRC_SE_MASK 0x2000
2041#define MADERA_IN2L_SRC_SE_SHIFT 13
2042#define MADERA_IN2L_SRC_SE_WIDTH 1
2043#define MADERA_IN2L_LP_MODE 0x0800
2044#define MADERA_IN2L_LP_MODE_MASK 0x0800
2045#define MADERA_IN2L_LP_MODE_SHIFT 11
2046#define MADERA_IN2L_LP_MODE_WIDTH 1
2047#define MADERA_IN2L_MUTE 0x0100
2048#define MADERA_IN2L_MUTE_MASK 0x0100
2049#define MADERA_IN2L_MUTE_SHIFT 8
2050#define MADERA_IN2L_MUTE_WIDTH 1
2051#define MADERA_IN2L_DIG_VOL_MASK 0x00FF
2052#define MADERA_IN2L_DIG_VOL_SHIFT 0
2053#define MADERA_IN2L_DIG_VOL_WIDTH 8
2054
2055/* (0x031A) DMIC2L_Control */
2056#define MADERA_IN2_OSR_MASK 0x0700
2057#define MADERA_IN2_OSR_SHIFT 8
2058#define MADERA_IN2_OSR_WIDTH 3
2059
2060/* (0x031C) IN2R_Control */
2061#define MADERA_IN2R_HPF_MASK 0x8000
2062#define MADERA_IN2R_HPF_SHIFT 15
2063#define MADERA_IN2R_HPF_WIDTH 1
2064#define MADERA_IN2R_PGA_VOL_MASK 0x00FE
2065#define MADERA_IN2R_PGA_VOL_SHIFT 1
2066#define MADERA_IN2R_PGA_VOL_WIDTH 7
2067#define MADERA_IN2_DMICCLK_SRC_MASK 0x1800
2068#define MADERA_IN2_DMICCLK_SRC_SHIFT 11
2069#define MADERA_IN2_DMICCLK_SRC_WIDTH 2
2070
2071/* (0x031D) ADC_Digital_Volume_2R */
2072#define MADERA_IN2R_SRC_MASK 0x4000
2073#define MADERA_IN2R_SRC_SHIFT 14
2074#define MADERA_IN2R_SRC_WIDTH 1
2075#define MADERA_IN2R_SRC_SE_MASK 0x2000
2076#define MADERA_IN2R_SRC_SE_SHIFT 13
2077#define MADERA_IN2R_SRC_SE_WIDTH 1
2078#define MADERA_IN2R_LP_MODE 0x0800
2079#define MADERA_IN2R_LP_MODE_MASK 0x0800
2080#define MADERA_IN2R_LP_MODE_SHIFT 11
2081#define MADERA_IN2R_LP_MODE_WIDTH 1
2082#define MADERA_IN2R_MUTE 0x0100
2083#define MADERA_IN2R_MUTE_MASK 0x0100
2084#define MADERA_IN2R_MUTE_SHIFT 8
2085#define MADERA_IN2R_MUTE_WIDTH 1
2086#define MADERA_IN2R_DIG_VOL_MASK 0x00FF
2087#define MADERA_IN2R_DIG_VOL_SHIFT 0
2088#define MADERA_IN2R_DIG_VOL_WIDTH 8
2089
2090/* (0x0320) IN3L_Control */
2091#define MADERA_IN3L_HPF_MASK 0x8000
2092#define MADERA_IN3L_HPF_SHIFT 15
2093#define MADERA_IN3L_HPF_WIDTH 1
2094#define MADERA_IN3_DMIC_SUP_MASK 0x1800
2095#define MADERA_IN3_DMIC_SUP_SHIFT 11
2096#define MADERA_IN3_DMIC_SUP_WIDTH 2
2097#define MADERA_IN3_MODE_MASK 0x0400
2098#define MADERA_IN3_MODE_SHIFT 10
2099#define MADERA_IN3_MODE_WIDTH 1
2100#define MADERA_IN3L_PGA_VOL_MASK 0x00FE
2101#define MADERA_IN3L_PGA_VOL_SHIFT 1
2102#define MADERA_IN3L_PGA_VOL_WIDTH 7
2103
2104/* (0x0321) ADC_Digital_Volume_3L */
2105#define MADERA_IN3L_MUTE 0x0100
2106#define MADERA_IN3L_MUTE_MASK 0x0100
2107#define MADERA_IN3L_MUTE_SHIFT 8
2108#define MADERA_IN3L_MUTE_WIDTH 1
2109#define MADERA_IN3L_DIG_VOL_MASK 0x00FF
2110#define MADERA_IN3L_DIG_VOL_SHIFT 0
2111#define MADERA_IN3L_DIG_VOL_WIDTH 8
2112
2113/* (0x0322) DMIC3L_Control */
2114#define MADERA_IN3_OSR_MASK 0x0700
2115#define MADERA_IN3_OSR_SHIFT 8
2116#define MADERA_IN3_OSR_WIDTH 3
2117
2118/* (0x0324) IN3R_Control */
2119#define MADERA_IN3R_HPF_MASK 0x8000
2120#define MADERA_IN3R_HPF_SHIFT 15
2121#define MADERA_IN3R_HPF_WIDTH 1
2122#define MADERA_IN3R_PGA_VOL_MASK 0x00FE
2123#define MADERA_IN3R_PGA_VOL_SHIFT 1
2124#define MADERA_IN3R_PGA_VOL_WIDTH 7
2125#define MADERA_IN3_DMICCLK_SRC_MASK 0x1800
2126#define MADERA_IN3_DMICCLK_SRC_SHIFT 11
2127#define MADERA_IN3_DMICCLK_SRC_WIDTH 2
2128
2129/* (0x0325) ADC_Digital_Volume_3R */
2130#define MADERA_IN3R_MUTE 0x0100
2131#define MADERA_IN3R_MUTE_MASK 0x0100
2132#define MADERA_IN3R_MUTE_SHIFT 8
2133#define MADERA_IN3R_MUTE_WIDTH 1
2134#define MADERA_IN3R_DIG_VOL_MASK 0x00FF
2135#define MADERA_IN3R_DIG_VOL_SHIFT 0
2136#define MADERA_IN3R_DIG_VOL_WIDTH 8
2137
2138/* (0x0328) IN4L_Control */
2139#define MADERA_IN4L_HPF_MASK 0x8000
2140#define MADERA_IN4L_HPF_SHIFT 15
2141#define MADERA_IN4L_HPF_WIDTH 1
2142#define MADERA_IN4_DMIC_SUP_MASK 0x1800
2143#define MADERA_IN4_DMIC_SUP_SHIFT 11
2144#define MADERA_IN4_DMIC_SUP_WIDTH 2
2145
2146/* (0x0329) ADC_Digital_Volume_4L */
2147#define MADERA_IN4L_MUTE 0x0100
2148#define MADERA_IN4L_MUTE_MASK 0x0100
2149#define MADERA_IN4L_MUTE_SHIFT 8
2150#define MADERA_IN4L_MUTE_WIDTH 1
2151#define MADERA_IN4L_DIG_VOL_MASK 0x00FF
2152#define MADERA_IN4L_DIG_VOL_SHIFT 0
2153#define MADERA_IN4L_DIG_VOL_WIDTH 8
2154
2155/* (0x032A) DMIC4L_Control */
2156#define MADERA_IN4_OSR_MASK 0x0700
2157#define MADERA_IN4_OSR_SHIFT 8
2158#define MADERA_IN4_OSR_WIDTH 3
2159
2160/* (0x032C) IN4R_Control */
2161#define MADERA_IN4R_HPF_MASK 0x8000
2162#define MADERA_IN4R_HPF_SHIFT 15
2163#define MADERA_IN4R_HPF_WIDTH 1
2164#define MADERA_IN4_DMICCLK_SRC_MASK 0x1800
2165#define MADERA_IN4_DMICCLK_SRC_SHIFT 11
2166#define MADERA_IN4_DMICCLK_SRC_WIDTH 2
2167
2168/* (0x032D) ADC_Digital_Volume_4R */
2169#define MADERA_IN4R_MUTE 0x0100
2170#define MADERA_IN4R_MUTE_MASK 0x0100
2171#define MADERA_IN4R_MUTE_SHIFT 8
2172#define MADERA_IN4R_MUTE_WIDTH 1
2173#define MADERA_IN4R_DIG_VOL_MASK 0x00FF
2174#define MADERA_IN4R_DIG_VOL_SHIFT 0
2175#define MADERA_IN4R_DIG_VOL_WIDTH 8
2176
2177/* (0x0330) IN5L_Control */
2178#define MADERA_IN5L_HPF_MASK 0x8000
2179#define MADERA_IN5L_HPF_SHIFT 15
2180#define MADERA_IN5L_HPF_WIDTH 1
2181#define MADERA_IN5_DMIC_SUP_MASK 0x1800
2182#define MADERA_IN5_DMIC_SUP_SHIFT 11
2183#define MADERA_IN5_DMIC_SUP_WIDTH 2
2184
2185/* (0x0331) ADC_Digital_Volume_5L */
2186#define MADERA_IN5L_MUTE 0x0100
2187#define MADERA_IN5L_MUTE_MASK 0x0100
2188#define MADERA_IN5L_MUTE_SHIFT 8
2189#define MADERA_IN5L_MUTE_WIDTH 1
2190#define MADERA_IN5L_DIG_VOL_MASK 0x00FF
2191#define MADERA_IN5L_DIG_VOL_SHIFT 0
2192#define MADERA_IN5L_DIG_VOL_WIDTH 8
2193
2194/* (0x0332) DMIC5L_Control */
2195#define MADERA_IN5_OSR_MASK 0x0700
2196#define MADERA_IN5_OSR_SHIFT 8
2197#define MADERA_IN5_OSR_WIDTH 3
2198
2199/* (0x0334) IN5R_Control */
2200#define MADERA_IN5R_HPF_MASK 0x8000
2201#define MADERA_IN5R_HPF_SHIFT 15
2202#define MADERA_IN5R_HPF_WIDTH 1
2203#define MADERA_IN5_DMICCLK_SRC_MASK 0x1800
2204#define MADERA_IN5_DMICCLK_SRC_SHIFT 11
2205#define MADERA_IN5_DMICCLK_SRC_WIDTH 2
2206
2207/* (0x0335) ADC_Digital_Volume_5R */
2208#define MADERA_IN5R_MUTE 0x0100
2209#define MADERA_IN5R_MUTE_MASK 0x0100
2210#define MADERA_IN5R_MUTE_SHIFT 8
2211#define MADERA_IN5R_MUTE_WIDTH 1
2212#define MADERA_IN5R_DIG_VOL_MASK 0x00FF
2213#define MADERA_IN5R_DIG_VOL_SHIFT 0
2214#define MADERA_IN5R_DIG_VOL_WIDTH 8
2215
2216/* (0x0338) IN6L_Control */
2217#define MADERA_IN6L_HPF_MASK 0x8000
2218#define MADERA_IN6L_HPF_SHIFT 15
2219#define MADERA_IN6L_HPF_WIDTH 1
2220#define MADERA_IN6_DMIC_SUP_MASK 0x1800
2221#define MADERA_IN6_DMIC_SUP_SHIFT 11
2222#define MADERA_IN6_DMIC_SUP_WIDTH 2
2223
2224/* (0x0339) ADC_Digital_Volume_6L */
2225#define MADERA_IN6L_MUTE 0x0100
2226#define MADERA_IN6L_MUTE_MASK 0x0100
2227#define MADERA_IN6L_MUTE_SHIFT 8
2228#define MADERA_IN6L_MUTE_WIDTH 1
2229#define MADERA_IN6L_DIG_VOL_MASK 0x00FF
2230#define MADERA_IN6L_DIG_VOL_SHIFT 0
2231#define MADERA_IN6L_DIG_VOL_WIDTH 8
2232
2233/* (0x033A) DMIC6L_Control */
2234#define MADERA_IN6_OSR_MASK 0x0700
2235#define MADERA_IN6_OSR_SHIFT 8
2236#define MADERA_IN6_OSR_WIDTH 3
2237
2238/* (0x033C) IN6R_Control */
2239#define MADERA_IN6R_HPF_MASK 0x8000
2240#define MADERA_IN6R_HPF_SHIFT 15
2241#define MADERA_IN6R_HPF_WIDTH 1
2242
2243/* (0x033D) ADC_Digital_Volume_6R */
2244#define MADERA_IN6R_MUTE 0x0100
2245#define MADERA_IN6R_MUTE_MASK 0x0100
2246#define MADERA_IN6R_MUTE_SHIFT 8
2247#define MADERA_IN6R_MUTE_WIDTH 1
2248#define MADERA_IN6R_DIG_VOL_MASK 0x00FF
2249#define MADERA_IN6R_DIG_VOL_SHIFT 0
2250#define MADERA_IN6R_DIG_VOL_WIDTH 8
2251
2252/* (0x033E) DMIC6R_Control */
2253#define MADERA_IN6_DMICCLK_SRC_MASK 0x1800
2254#define MADERA_IN6_DMICCLK_SRC_SHIFT 11
2255#define MADERA_IN6_DMICCLK_SRC_WIDTH 2
2256
2257/* (0x0400) Output_Enables_1 */
2258#define MADERA_EP_SEL 0x8000
2259#define MADERA_EP_SEL_MASK 0x8000
2260#define MADERA_EP_SEL_SHIFT 15
2261#define MADERA_EP_SEL_WIDTH 1
2262#define MADERA_OUT6L_ENA 0x0800
2263#define MADERA_OUT6L_ENA_MASK 0x0800
2264#define MADERA_OUT6L_ENA_SHIFT 11
2265#define MADERA_OUT6L_ENA_WIDTH 1
2266#define MADERA_OUT6R_ENA 0x0400
2267#define MADERA_OUT6R_ENA_MASK 0x0400
2268#define MADERA_OUT6R_ENA_SHIFT 10
2269#define MADERA_OUT6R_ENA_WIDTH 1
2270#define MADERA_OUT5L_ENA 0x0200
2271#define MADERA_OUT5L_ENA_MASK 0x0200
2272#define MADERA_OUT5L_ENA_SHIFT 9
2273#define MADERA_OUT5L_ENA_WIDTH 1
2274#define MADERA_OUT5R_ENA 0x0100
2275#define MADERA_OUT5R_ENA_MASK 0x0100
2276#define MADERA_OUT5R_ENA_SHIFT 8
2277#define MADERA_OUT5R_ENA_WIDTH 1
2278#define MADERA_OUT4L_ENA 0x0080
2279#define MADERA_OUT4L_ENA_MASK 0x0080
2280#define MADERA_OUT4L_ENA_SHIFT 7
2281#define MADERA_OUT4L_ENA_WIDTH 1
2282#define MADERA_OUT4R_ENA 0x0040
2283#define MADERA_OUT4R_ENA_MASK 0x0040
2284#define MADERA_OUT4R_ENA_SHIFT 6
2285#define MADERA_OUT4R_ENA_WIDTH 1
2286#define MADERA_OUT3L_ENA 0x0020
2287#define MADERA_OUT3L_ENA_MASK 0x0020
2288#define MADERA_OUT3L_ENA_SHIFT 5
2289#define MADERA_OUT3L_ENA_WIDTH 1
2290#define MADERA_OUT3R_ENA 0x0010
2291#define MADERA_OUT3R_ENA_MASK 0x0010
2292#define MADERA_OUT3R_ENA_SHIFT 4
2293#define MADERA_OUT3R_ENA_WIDTH 1
2294#define MADERA_OUT2L_ENA 0x0008
2295#define MADERA_OUT2L_ENA_MASK 0x0008
2296#define MADERA_OUT2L_ENA_SHIFT 3
2297#define MADERA_OUT2L_ENA_WIDTH 1
2298#define MADERA_OUT2R_ENA 0x0004
2299#define MADERA_OUT2R_ENA_MASK 0x0004
2300#define MADERA_OUT2R_ENA_SHIFT 2
2301#define MADERA_OUT2R_ENA_WIDTH 1
2302#define MADERA_OUT1L_ENA 0x0002
2303#define MADERA_OUT1L_ENA_MASK 0x0002
2304#define MADERA_OUT1L_ENA_SHIFT 1
2305#define MADERA_OUT1L_ENA_WIDTH 1
2306#define MADERA_OUT1R_ENA 0x0001
2307#define MADERA_OUT1R_ENA_MASK 0x0001
2308#define MADERA_OUT1R_ENA_SHIFT 0
2309#define MADERA_OUT1R_ENA_WIDTH 1
2310
2311/* (0x0409) Output_Volume_Ramp */
2312#define MADERA_OUT_VD_RAMP_MASK 0x0070
2313#define MADERA_OUT_VD_RAMP_SHIFT 4
2314#define MADERA_OUT_VD_RAMP_WIDTH 3
2315#define MADERA_OUT_VI_RAMP_MASK 0x0007
2316#define MADERA_OUT_VI_RAMP_SHIFT 0
2317#define MADERA_OUT_VI_RAMP_WIDTH 3
2318
2319/* (0x0410) Output_Path_Config_1L */
2320#define MADERA_OUT1_MONO 0x1000
2321#define MADERA_OUT1_MONO_MASK 0x1000
2322#define MADERA_OUT1_MONO_SHIFT 12
2323#define MADERA_OUT1_MONO_WIDTH 1
2324#define MADERA_OUT1L_ANC_SRC_MASK 0x0C00
2325#define MADERA_OUT1L_ANC_SRC_SHIFT 10
2326#define MADERA_OUT1L_ANC_SRC_WIDTH 2
2327
2328/* (0x0411) DAC_Digital_Volume_1L */
2329#define MADERA_OUT1L_VU 0x0200
2330#define MADERA_OUT1L_VU_MASK 0x0200
2331#define MADERA_OUT1L_VU_SHIFT 9
2332#define MADERA_OUT1L_VU_WIDTH 1
2333#define MADERA_OUT1L_MUTE 0x0100
2334#define MADERA_OUT1L_MUTE_MASK 0x0100
2335#define MADERA_OUT1L_MUTE_SHIFT 8
2336#define MADERA_OUT1L_MUTE_WIDTH 1
2337#define MADERA_OUT1L_VOL_MASK 0x00FF
2338#define MADERA_OUT1L_VOL_SHIFT 0
2339#define MADERA_OUT1L_VOL_WIDTH 8
2340
2341/* (0x0412) Output_Path_Config_1 */
2342#define MADERA_HP1_GND_SEL_MASK 0x0007
2343#define MADERA_HP1_GND_SEL_SHIFT 0
2344#define MADERA_HP1_GND_SEL_WIDTH 3
2345
2346/* (0x0414) Output_Path_Config_1R */
2347#define MADERA_OUT1R_ANC_SRC_MASK 0x0C00
2348#define MADERA_OUT1R_ANC_SRC_SHIFT 10
2349#define MADERA_OUT1R_ANC_SRC_WIDTH 2
2350
2351/* (0x0415) DAC_Digital_Volume_1R */
2352#define MADERA_OUT1R_MUTE 0x0100
2353#define MADERA_OUT1R_MUTE_MASK 0x0100
2354#define MADERA_OUT1R_MUTE_SHIFT 8
2355#define MADERA_OUT1R_MUTE_WIDTH 1
2356#define MADERA_OUT1R_VOL_MASK 0x00FF
2357#define MADERA_OUT1R_VOL_SHIFT 0
2358#define MADERA_OUT1R_VOL_WIDTH 8
2359
2360/* (0x0418) Output_Path_Config_2L */
2361#define MADERA_OUT2L_ANC_SRC_MASK 0x0C00
2362#define MADERA_OUT2L_ANC_SRC_SHIFT 10
2363#define MADERA_OUT2L_ANC_SRC_WIDTH 2
2364
2365/* (0x0419) DAC_Digital_Volume_2L */
2366#define MADERA_OUT2L_MUTE 0x0100
2367#define MADERA_OUT2L_MUTE_MASK 0x0100
2368#define MADERA_OUT2L_MUTE_SHIFT 8
2369#define MADERA_OUT2L_MUTE_WIDTH 1
2370#define MADERA_OUT2L_VOL_MASK 0x00FF
2371#define MADERA_OUT2L_VOL_SHIFT 0
2372#define MADERA_OUT2L_VOL_WIDTH 8
2373
2374/* (0x041A) Output_Path_Config_2 */
2375#define MADERA_HP2_GND_SEL_MASK 0x0007
2376#define MADERA_HP2_GND_SEL_SHIFT 0
2377#define MADERA_HP2_GND_SEL_WIDTH 3
2378
2379/* (0x041C) Output_Path_Config_2R */
2380#define MADERA_OUT2R_ANC_SRC_MASK 0x0C00
2381#define MADERA_OUT2R_ANC_SRC_SHIFT 10
2382#define MADERA_OUT2R_ANC_SRC_WIDTH 2
2383
2384/* (0x041D) DAC_Digital_Volume_2R */
2385#define MADERA_OUT2R_MUTE 0x0100
2386#define MADERA_OUT2R_MUTE_MASK 0x0100
2387#define MADERA_OUT2R_MUTE_SHIFT 8
2388#define MADERA_OUT2R_MUTE_WIDTH 1
2389#define MADERA_OUT2R_VOL_MASK 0x00FF
2390#define MADERA_OUT2R_VOL_SHIFT 0
2391#define MADERA_OUT2R_VOL_WIDTH 8
2392
2393/* (0x0420) Output_Path_Config_3L */
2394#define MADERA_OUT3L_ANC_SRC_MASK 0x0C00
2395#define MADERA_OUT3L_ANC_SRC_SHIFT 10
2396#define MADERA_OUT3L_ANC_SRC_WIDTH 2
2397
2398/* (0x0421) DAC_Digital_Volume_3L */
2399#define MADERA_OUT3L_MUTE 0x0100
2400#define MADERA_OUT3L_MUTE_MASK 0x0100
2401#define MADERA_OUT3L_MUTE_SHIFT 8
2402#define MADERA_OUT3L_MUTE_WIDTH 1
2403#define MADERA_OUT3L_VOL_MASK 0x00FF
2404#define MADERA_OUT3L_VOL_SHIFT 0
2405#define MADERA_OUT3L_VOL_WIDTH 8
2406
2407/* (0x0424) Output_Path_Config_3R */
2408#define MADERA_OUT3R_ANC_SRC_MASK 0x0C00
2409#define MADERA_OUT3R_ANC_SRC_SHIFT 10
2410#define MADERA_OUT3R_ANC_SRC_WIDTH 2
2411
2412/* (0x0425) DAC_Digital_Volume_3R */
2413#define MADERA_OUT3R_MUTE 0x0100
2414#define MADERA_OUT3R_MUTE_MASK 0x0100
2415#define MADERA_OUT3R_MUTE_SHIFT 8
2416#define MADERA_OUT3R_MUTE_WIDTH 1
2417#define MADERA_OUT3R_VOL_MASK 0x00FF
2418#define MADERA_OUT3R_VOL_SHIFT 0
2419#define MADERA_OUT3R_VOL_WIDTH 8
2420
2421/* (0x0428) Output_Path_Config_4L */
2422#define MADERA_OUT4L_ANC_SRC_MASK 0x0C00
2423#define MADERA_OUT4L_ANC_SRC_SHIFT 10
2424#define MADERA_OUT4L_ANC_SRC_WIDTH 2
2425
2426/* (0x0429) DAC_Digital_Volume_4L */
2427#define MADERA_OUT4L_MUTE 0x0100
2428#define MADERA_OUT4L_MUTE_MASK 0x0100
2429#define MADERA_OUT4L_MUTE_SHIFT 8
2430#define MADERA_OUT4L_MUTE_WIDTH 1
2431#define MADERA_OUT4L_VOL_MASK 0x00FF
2432#define MADERA_OUT4L_VOL_SHIFT 0
2433#define MADERA_OUT4L_VOL_WIDTH 8
2434
2435/* (0x042C) Output_Path_Config_4R */
2436#define MADERA_OUT4R_ANC_SRC_MASK 0x0C00
2437#define MADERA_OUT4R_ANC_SRC_SHIFT 10
2438#define MADERA_OUT4R_ANC_SRC_WIDTH 2
2439
2440/* (0x042D) DAC_Digital_Volume_4R */
2441#define MADERA_OUT4R_MUTE 0x0100
2442#define MADERA_OUT4R_MUTE_MASK 0x0100
2443#define MADERA_OUT4R_MUTE_SHIFT 8
2444#define MADERA_OUT4R_MUTE_WIDTH 1
2445#define MADERA_OUT4R_VOL_MASK 0x00FF
2446#define MADERA_OUT4R_VOL_SHIFT 0
2447#define MADERA_OUT4R_VOL_WIDTH 8
2448
2449/* (0x0430) Output_Path_Config_5L */
2450#define MADERA_OUT5_OSR 0x2000
2451#define MADERA_OUT5_OSR_MASK 0x2000
2452#define MADERA_OUT5_OSR_SHIFT 13
2453#define MADERA_OUT5_OSR_WIDTH 1
2454#define MADERA_OUT5L_ANC_SRC_MASK 0x0C00
2455#define MADERA_OUT5L_ANC_SRC_SHIFT 10
2456#define MADERA_OUT5L_ANC_SRC_WIDTH 2
2457
2458/* (0x0431) DAC_Digital_Volume_5L */
2459#define MADERA_OUT5L_MUTE 0x0100
2460#define MADERA_OUT5L_MUTE_MASK 0x0100
2461#define MADERA_OUT5L_MUTE_SHIFT 8
2462#define MADERA_OUT5L_MUTE_WIDTH 1
2463#define MADERA_OUT5L_VOL_MASK 0x00FF
2464#define MADERA_OUT5L_VOL_SHIFT 0
2465#define MADERA_OUT5L_VOL_WIDTH 8
2466
2467/* (0x0434) Output_Path_Config_5R */
2468#define MADERA_OUT5R_ANC_SRC_MASK 0x0C00
2469#define MADERA_OUT5R_ANC_SRC_SHIFT 10
2470#define MADERA_OUT5R_ANC_SRC_WIDTH 2
2471
2472/* (0x0435) DAC_Digital_Volume_5R */
2473#define MADERA_OUT5R_MUTE 0x0100
2474#define MADERA_OUT5R_MUTE_MASK 0x0100
2475#define MADERA_OUT5R_MUTE_SHIFT 8
2476#define MADERA_OUT5R_MUTE_WIDTH 1
2477#define MADERA_OUT5R_VOL_MASK 0x00FF
2478#define MADERA_OUT5R_VOL_SHIFT 0
2479#define MADERA_OUT5R_VOL_WIDTH 8
2480
2481/* (0x0438) Output_Path_Config_6L */
2482#define MADERA_OUT6_OSR 0x2000
2483#define MADERA_OUT6_OSR_MASK 0x2000
2484#define MADERA_OUT6_OSR_SHIFT 13
2485#define MADERA_OUT6_OSR_WIDTH 1
2486#define MADERA_OUT6L_ANC_SRC_MASK 0x0C00
2487#define MADERA_OUT6L_ANC_SRC_SHIFT 10
2488#define MADERA_OUT6L_ANC_SRC_WIDTH 2
2489
2490/* (0x0439) DAC_Digital_Volume_6L */
2491#define MADERA_OUT6L_MUTE 0x0100
2492#define MADERA_OUT6L_MUTE_MASK 0x0100
2493#define MADERA_OUT6L_MUTE_SHIFT 8
2494#define MADERA_OUT6L_MUTE_WIDTH 1
2495#define MADERA_OUT6L_VOL_MASK 0x00FF
2496#define MADERA_OUT6L_VOL_SHIFT 0
2497#define MADERA_OUT6L_VOL_WIDTH 8
2498
2499/* (0x043C) Output_Path_Config_6R */
2500#define MADERA_OUT6R_ANC_SRC_MASK 0x0C00
2501#define MADERA_OUT6R_ANC_SRC_SHIFT 10
2502#define MADERA_OUT6R_ANC_SRC_WIDTH 2
2503
2504/* (0x043D) DAC_Digital_Volume_6R */
2505#define MADERA_OUT6R_MUTE 0x0100
2506#define MADERA_OUT6R_MUTE_MASK 0x0100
2507#define MADERA_OUT6R_MUTE_SHIFT 8
2508#define MADERA_OUT6R_MUTE_WIDTH 1
2509#define MADERA_OUT6R_VOL_MASK 0x00FF
2510#define MADERA_OUT6R_VOL_SHIFT 0
2511#define MADERA_OUT6R_VOL_WIDTH 8
2512
2513/* (0x0450) - DAC AEC Control 1 */
2514#define MADERA_AEC1_LOOPBACK_SRC_MASK 0x003C
2515#define MADERA_AEC1_LOOPBACK_SRC_SHIFT 2
2516#define MADERA_AEC1_LOOPBACK_SRC_WIDTH 4
2517#define MADERA_AEC1_ENA_STS 0x0002
2518#define MADERA_AEC1_ENA_STS_MASK 0x0002
2519#define MADERA_AEC1_ENA_STS_SHIFT 1
2520#define MADERA_AEC1_ENA_STS_WIDTH 1
2521#define MADERA_AEC1_LOOPBACK_ENA 0x0001
2522#define MADERA_AEC1_LOOPBACK_ENA_MASK 0x0001
2523#define MADERA_AEC1_LOOPBACK_ENA_SHIFT 0
2524#define MADERA_AEC1_LOOPBACK_ENA_WIDTH 1
2525
2526/* (0x0451) DAC_AEC_Control_2 */
2527#define MADERA_AEC2_LOOPBACK_SRC_MASK 0x003C
2528#define MADERA_AEC2_LOOPBACK_SRC_SHIFT 2
2529#define MADERA_AEC2_LOOPBACK_SRC_WIDTH 4
2530#define MADERA_AEC2_ENA_STS 0x0002
2531#define MADERA_AEC2_ENA_STS_MASK 0x0002
2532#define MADERA_AEC2_ENA_STS_SHIFT 1
2533#define MADERA_AEC2_ENA_STS_WIDTH 1
2534#define MADERA_AEC2_LOOPBACK_ENA 0x0001
2535#define MADERA_AEC2_LOOPBACK_ENA_MASK 0x0001
2536#define MADERA_AEC2_LOOPBACK_ENA_SHIFT 0
2537#define MADERA_AEC2_LOOPBACK_ENA_WIDTH 1
2538
2539/* (0x0458) Noise_Gate_Control */
2540#define MADERA_NGATE_HOLD_MASK 0x0030
2541#define MADERA_NGATE_HOLD_SHIFT 4
2542#define MADERA_NGATE_HOLD_WIDTH 2
2543#define MADERA_NGATE_THR_MASK 0x000E
2544#define MADERA_NGATE_THR_SHIFT 1
2545#define MADERA_NGATE_THR_WIDTH 3
2546#define MADERA_NGATE_ENA 0x0001
2547#define MADERA_NGATE_ENA_MASK 0x0001
2548#define MADERA_NGATE_ENA_SHIFT 0
2549#define MADERA_NGATE_ENA_WIDTH 1
2550
2551/* (0x0490) PDM_SPK1_CTRL_1 */
2552#define MADERA_SPK1R_MUTE 0x2000
2553#define MADERA_SPK1R_MUTE_MASK 0x2000
2554#define MADERA_SPK1R_MUTE_SHIFT 13
2555#define MADERA_SPK1R_MUTE_WIDTH 1
2556#define MADERA_SPK1L_MUTE 0x1000
2557#define MADERA_SPK1L_MUTE_MASK 0x1000
2558#define MADERA_SPK1L_MUTE_SHIFT 12
2559#define MADERA_SPK1L_MUTE_WIDTH 1
2560#define MADERA_SPK1_MUTE_ENDIAN 0x0100
2561#define MADERA_SPK1_MUTE_ENDIAN_MASK 0x0100
2562#define MADERA_SPK1_MUTE_ENDIAN_SHIFT 8
2563#define MADERA_SPK1_MUTE_ENDIAN_WIDTH 1
2564#define MADERA_SPK1_MUTE_SEQ1_MASK 0x00FF
2565#define MADERA_SPK1_MUTE_SEQ1_SHIFT 0
2566#define MADERA_SPK1_MUTE_SEQ1_WIDTH 8
2567
2568/* (0x0491) PDM_SPK1_CTRL_2 */
2569#define MADERA_SPK1_FMT 0x0001
2570#define MADERA_SPK1_FMT_MASK 0x0001
2571#define MADERA_SPK1_FMT_SHIFT 0
2572#define MADERA_SPK1_FMT_WIDTH 1
2573
2574/* (0x0492) PDM_SPK2_CTRL_1 */
2575#define MADERA_SPK2R_MUTE 0x2000
2576#define MADERA_SPK2R_MUTE_MASK 0x2000
2577#define MADERA_SPK2R_MUTE_SHIFT 13
2578#define MADERA_SPK2R_MUTE_WIDTH 1
2579#define MADERA_SPK2L_MUTE 0x1000
2580#define MADERA_SPK2L_MUTE_MASK 0x1000
2581#define MADERA_SPK2L_MUTE_SHIFT 12
2582#define MADERA_SPK2L_MUTE_WIDTH 1
2583
2584/* (0x04A0) - HP1 Short Circuit Ctrl */
2585#define MADERA_HP1_SC_ENA 0x1000
2586#define MADERA_HP1_SC_ENA_MASK 0x1000
2587#define MADERA_HP1_SC_ENA_SHIFT 12
2588#define MADERA_HP1_SC_ENA_WIDTH 1
2589
2590/* (0x04A1) - HP2 Short Circuit Ctrl */
2591#define MADERA_HP2_SC_ENA 0x1000
2592#define MADERA_HP2_SC_ENA_MASK 0x1000
2593#define MADERA_HP2_SC_ENA_SHIFT 12
2594#define MADERA_HP2_SC_ENA_WIDTH 1
2595
2596/* (0x04A2) - HP3 Short Circuit Ctrl */
2597#define MADERA_HP3_SC_ENA 0x1000
2598#define MADERA_HP3_SC_ENA_MASK 0x1000
2599#define MADERA_HP3_SC_ENA_SHIFT 12
2600#define MADERA_HP3_SC_ENA_WIDTH 1
2601
2602/* (0x04A8) - HP_Test_Ctrl_5 */
2603#define MADERA_HP1L_ONEFLT 0x0100
2604#define MADERA_HP1L_ONEFLT_MASK 0x0100
2605#define MADERA_HP1L_ONEFLT_SHIFT 8
2606#define MADERA_HP1L_ONEFLT_WIDTH 1
2607
2608/* (0x04A9) - HP_Test_Ctrl_6 */
2609#define MADERA_HP1R_ONEFLT 0x0100
2610#define MADERA_HP1R_ONEFLT_MASK 0x0100
2611#define MADERA_HP1R_ONEFLT_SHIFT 8
2612#define MADERA_HP1R_ONEFLT_WIDTH 1
2613
2614/* (0x0500) AIF1_BCLK_Ctrl */
2615#define MADERA_AIF1_BCLK_INV 0x0080
2616#define MADERA_AIF1_BCLK_INV_MASK 0x0080
2617#define MADERA_AIF1_BCLK_INV_SHIFT 7
2618#define MADERA_AIF1_BCLK_INV_WIDTH 1
2619#define MADERA_AIF1_BCLK_MSTR 0x0020
2620#define MADERA_AIF1_BCLK_MSTR_MASK 0x0020
2621#define MADERA_AIF1_BCLK_MSTR_SHIFT 5
2622#define MADERA_AIF1_BCLK_MSTR_WIDTH 1
2623#define MADERA_AIF1_BCLK_FREQ_MASK 0x001F
2624#define MADERA_AIF1_BCLK_FREQ_SHIFT 0
2625#define MADERA_AIF1_BCLK_FREQ_WIDTH 5
2626
2627/* (0x0501) AIF1_Tx_Pin_Ctrl */
2628#define MADERA_AIF1TX_LRCLK_SRC 0x0008
2629#define MADERA_AIF1TX_LRCLK_SRC_MASK 0x0008
2630#define MADERA_AIF1TX_LRCLK_SRC_SHIFT 3
2631#define MADERA_AIF1TX_LRCLK_SRC_WIDTH 1
2632#define MADERA_AIF1TX_LRCLK_INV 0x0004
2633#define MADERA_AIF1TX_LRCLK_INV_MASK 0x0004
2634#define MADERA_AIF1TX_LRCLK_INV_SHIFT 2
2635#define MADERA_AIF1TX_LRCLK_INV_WIDTH 1
2636#define MADERA_AIF1TX_LRCLK_MSTR 0x0001
2637#define MADERA_AIF1TX_LRCLK_MSTR_MASK 0x0001
2638#define MADERA_AIF1TX_LRCLK_MSTR_SHIFT 0
2639#define MADERA_AIF1TX_LRCLK_MSTR_WIDTH 1
2640
2641/* (0x0502) AIF1_Rx_Pin_Ctrl */
2642#define MADERA_AIF1RX_LRCLK_INV 0x0004
2643#define MADERA_AIF1RX_LRCLK_INV_MASK 0x0004
2644#define MADERA_AIF1RX_LRCLK_INV_SHIFT 2
2645#define MADERA_AIF1RX_LRCLK_INV_WIDTH 1
2646#define MADERA_AIF1RX_LRCLK_FRC 0x0002
2647#define MADERA_AIF1RX_LRCLK_FRC_MASK 0x0002
2648#define MADERA_AIF1RX_LRCLK_FRC_SHIFT 1
2649#define MADERA_AIF1RX_LRCLK_FRC_WIDTH 1
2650#define MADERA_AIF1RX_LRCLK_MSTR 0x0001
2651#define MADERA_AIF1RX_LRCLK_MSTR_MASK 0x0001
2652#define MADERA_AIF1RX_LRCLK_MSTR_SHIFT 0
2653#define MADERA_AIF1RX_LRCLK_MSTR_WIDTH 1
2654
2655/* (0x0503) AIF1_Rate_Ctrl */
2656#define MADERA_AIF1_RATE_MASK 0xF800
2657#define MADERA_AIF1_RATE_SHIFT 11
2658#define MADERA_AIF1_RATE_WIDTH 5
2659#define MADERA_AIF1_TRI 0x0040
2660#define MADERA_AIF1_TRI_MASK 0x0040
2661#define MADERA_AIF1_TRI_SHIFT 6
2662#define MADERA_AIF1_TRI_WIDTH 1
2663
2664/* (0x0504) AIF1_Format */
2665#define MADERA_AIF1_FMT_MASK 0x0007
2666#define MADERA_AIF1_FMT_SHIFT 0
2667#define MADERA_AIF1_FMT_WIDTH 3
2668
2669/* (0x0506) AIF1_Rx_BCLK_Rate */
2670#define MADERA_AIF1RX_BCPF_MASK 0x1FFF
2671#define MADERA_AIF1RX_BCPF_SHIFT 0
2672#define MADERA_AIF1RX_BCPF_WIDTH 13
2673
2674/* (0x0507) AIF1_Frame_Ctrl_1 */
2675#define MADERA_AIF1TX_WL_MASK 0x3F00
2676#define MADERA_AIF1TX_WL_SHIFT 8
2677#define MADERA_AIF1TX_WL_WIDTH 6
2678#define MADERA_AIF1TX_SLOT_LEN_MASK 0x00FF
2679#define MADERA_AIF1TX_SLOT_LEN_SHIFT 0
2680#define MADERA_AIF1TX_SLOT_LEN_WIDTH 8
2681
2682/* (0x0508) AIF1_Frame_Ctrl_2 */
2683#define MADERA_AIF1RX_WL_MASK 0x3F00
2684#define MADERA_AIF1RX_WL_SHIFT 8
2685#define MADERA_AIF1RX_WL_WIDTH 6
2686#define MADERA_AIF1RX_SLOT_LEN_MASK 0x00FF
2687#define MADERA_AIF1RX_SLOT_LEN_SHIFT 0
2688#define MADERA_AIF1RX_SLOT_LEN_WIDTH 8
2689
2690/* (0x0509) AIF1_Frame_Ctrl_3 */
2691#define MADERA_AIF1TX1_SLOT_MASK 0x003F
2692#define MADERA_AIF1TX1_SLOT_SHIFT 0
2693#define MADERA_AIF1TX1_SLOT_WIDTH 6
2694
2695/* (0x0519) AIF1_Tx_Enables */
2696#define MADERA_AIF1TX8_ENA 0x0080
2697#define MADERA_AIF1TX8_ENA_MASK 0x0080
2698#define MADERA_AIF1TX8_ENA_SHIFT 7
2699#define MADERA_AIF1TX8_ENA_WIDTH 1
2700#define MADERA_AIF1TX7_ENA 0x0040
2701#define MADERA_AIF1TX7_ENA_MASK 0x0040
2702#define MADERA_AIF1TX7_ENA_SHIFT 6
2703#define MADERA_AIF1TX7_ENA_WIDTH 1
2704#define MADERA_AIF1TX6_ENA 0x0020
2705#define MADERA_AIF1TX6_ENA_MASK 0x0020
2706#define MADERA_AIF1TX6_ENA_SHIFT 5
2707#define MADERA_AIF1TX6_ENA_WIDTH 1
2708#define MADERA_AIF1TX5_ENA 0x0010
2709#define MADERA_AIF1TX5_ENA_MASK 0x0010
2710#define MADERA_AIF1TX5_ENA_SHIFT 4
2711#define MADERA_AIF1TX5_ENA_WIDTH 1
2712#define MADERA_AIF1TX4_ENA 0x0008
2713#define MADERA_AIF1TX4_ENA_MASK 0x0008
2714#define MADERA_AIF1TX4_ENA_SHIFT 3
2715#define MADERA_AIF1TX4_ENA_WIDTH 1
2716#define MADERA_AIF1TX3_ENA 0x0004
2717#define MADERA_AIF1TX3_ENA_MASK 0x0004
2718#define MADERA_AIF1TX3_ENA_SHIFT 2
2719#define MADERA_AIF1TX3_ENA_WIDTH 1
2720#define MADERA_AIF1TX2_ENA 0x0002
2721#define MADERA_AIF1TX2_ENA_MASK 0x0002
2722#define MADERA_AIF1TX2_ENA_SHIFT 1
2723#define MADERA_AIF1TX2_ENA_WIDTH 1
2724#define MADERA_AIF1TX1_ENA 0x0001
2725#define MADERA_AIF1TX1_ENA_MASK 0x0001
2726#define MADERA_AIF1TX1_ENA_SHIFT 0
2727#define MADERA_AIF1TX1_ENA_WIDTH 1
2728
2729/* (0x051A) AIF1_Rx_Enables */
2730#define MADERA_AIF1RX8_ENA 0x0080
2731#define MADERA_AIF1RX8_ENA_MASK 0x0080
2732#define MADERA_AIF1RX8_ENA_SHIFT 7
2733#define MADERA_AIF1RX8_ENA_WIDTH 1
2734#define MADERA_AIF1RX7_ENA 0x0040
2735#define MADERA_AIF1RX7_ENA_MASK 0x0040
2736#define MADERA_AIF1RX7_ENA_SHIFT 6
2737#define MADERA_AIF1RX7_ENA_WIDTH 1
2738#define MADERA_AIF1RX6_ENA 0x0020
2739#define MADERA_AIF1RX6_ENA_MASK 0x0020
2740#define MADERA_AIF1RX6_ENA_SHIFT 5
2741#define MADERA_AIF1RX6_ENA_WIDTH 1
2742#define MADERA_AIF1RX5_ENA 0x0010
2743#define MADERA_AIF1RX5_ENA_MASK 0x0010
2744#define MADERA_AIF1RX5_ENA_SHIFT 4
2745#define MADERA_AIF1RX5_ENA_WIDTH 1
2746#define MADERA_AIF1RX4_ENA 0x0008
2747#define MADERA_AIF1RX4_ENA_MASK 0x0008
2748#define MADERA_AIF1RX4_ENA_SHIFT 3
2749#define MADERA_AIF1RX4_ENA_WIDTH 1
2750#define MADERA_AIF1RX3_ENA 0x0004
2751#define MADERA_AIF1RX3_ENA_MASK 0x0004
2752#define MADERA_AIF1RX3_ENA_SHIFT 2
2753#define MADERA_AIF1RX3_ENA_WIDTH 1
2754#define MADERA_AIF1RX2_ENA 0x0002
2755#define MADERA_AIF1RX2_ENA_MASK 0x0002
2756#define MADERA_AIF1RX2_ENA_SHIFT 1
2757#define MADERA_AIF1RX2_ENA_WIDTH 1
2758#define MADERA_AIF1RX1_ENA 0x0001
2759#define MADERA_AIF1RX1_ENA_MASK 0x0001
2760#define MADERA_AIF1RX1_ENA_SHIFT 0
2761#define MADERA_AIF1RX1_ENA_WIDTH 1
2762
2763/* (0x0559) AIF2_Tx_Enables */
2764#define MADERA_AIF2TX8_ENA 0x0080
2765#define MADERA_AIF2TX8_ENA_MASK 0x0080
2766#define MADERA_AIF2TX8_ENA_SHIFT 7
2767#define MADERA_AIF2TX8_ENA_WIDTH 1
2768#define MADERA_AIF2TX7_ENA 0x0040
2769#define MADERA_AIF2TX7_ENA_MASK 0x0040
2770#define MADERA_AIF2TX7_ENA_SHIFT 6
2771#define MADERA_AIF2TX7_ENA_WIDTH 1
2772#define MADERA_AIF2TX6_ENA 0x0020
2773#define MADERA_AIF2TX6_ENA_MASK 0x0020
2774#define MADERA_AIF2TX6_ENA_SHIFT 5
2775#define MADERA_AIF2TX6_ENA_WIDTH 1
2776#define MADERA_AIF2TX5_ENA 0x0010
2777#define MADERA_AIF2TX5_ENA_MASK 0x0010
2778#define MADERA_AIF2TX5_ENA_SHIFT 4
2779#define MADERA_AIF2TX5_ENA_WIDTH 1
2780#define MADERA_AIF2TX4_ENA 0x0008
2781#define MADERA_AIF2TX4_ENA_MASK 0x0008
2782#define MADERA_AIF2TX4_ENA_SHIFT 3
2783#define MADERA_AIF2TX4_ENA_WIDTH 1
2784#define MADERA_AIF2TX3_ENA 0x0004
2785#define MADERA_AIF2TX3_ENA_MASK 0x0004
2786#define MADERA_AIF2TX3_ENA_SHIFT 2
2787#define MADERA_AIF2TX3_ENA_WIDTH 1
2788#define MADERA_AIF2TX2_ENA 0x0002
2789#define MADERA_AIF2TX2_ENA_MASK 0x0002
2790#define MADERA_AIF2TX2_ENA_SHIFT 1
2791#define MADERA_AIF2TX2_ENA_WIDTH 1
2792#define MADERA_AIF2TX1_ENA 0x0001
2793#define MADERA_AIF2TX1_ENA_MASK 0x0001
2794#define MADERA_AIF2TX1_ENA_SHIFT 0
2795#define MADERA_AIF2TX1_ENA_WIDTH 1
2796
2797/* (0x055A) AIF2_Rx_Enables */
2798#define MADERA_AIF2RX8_ENA 0x0080
2799#define MADERA_AIF2RX8_ENA_MASK 0x0080
2800#define MADERA_AIF2RX8_ENA_SHIFT 7
2801#define MADERA_AIF2RX8_ENA_WIDTH 1
2802#define MADERA_AIF2RX7_ENA 0x0040
2803#define MADERA_AIF2RX7_ENA_MASK 0x0040
2804#define MADERA_AIF2RX7_ENA_SHIFT 6
2805#define MADERA_AIF2RX7_ENA_WIDTH 1
2806#define MADERA_AIF2RX6_ENA 0x0020
2807#define MADERA_AIF2RX6_ENA_MASK 0x0020
2808#define MADERA_AIF2RX6_ENA_SHIFT 5
2809#define MADERA_AIF2RX6_ENA_WIDTH 1
2810#define MADERA_AIF2RX5_ENA 0x0010
2811#define MADERA_AIF2RX5_ENA_MASK 0x0010
2812#define MADERA_AIF2RX5_ENA_SHIFT 4
2813#define MADERA_AIF2RX5_ENA_WIDTH 1
2814#define MADERA_AIF2RX4_ENA 0x0008
2815#define MADERA_AIF2RX4_ENA_MASK 0x0008
2816#define MADERA_AIF2RX4_ENA_SHIFT 3
2817#define MADERA_AIF2RX4_ENA_WIDTH 1
2818#define MADERA_AIF2RX3_ENA 0x0004
2819#define MADERA_AIF2RX3_ENA_MASK 0x0004
2820#define MADERA_AIF2RX3_ENA_SHIFT 2
2821#define MADERA_AIF2RX3_ENA_WIDTH 1
2822#define MADERA_AIF2RX2_ENA 0x0002
2823#define MADERA_AIF2RX2_ENA_MASK 0x0002
2824#define MADERA_AIF2RX2_ENA_SHIFT 1
2825#define MADERA_AIF2RX2_ENA_WIDTH 1
2826#define MADERA_AIF2RX1_ENA 0x0001
2827#define MADERA_AIF2RX1_ENA_MASK 0x0001
2828#define MADERA_AIF2RX1_ENA_SHIFT 0
2829#define MADERA_AIF2RX1_ENA_WIDTH 1
2830
2831/* (0x0599) AIF3_Tx_Enables */
2832#define MADERA_AIF3TX2_ENA 0x0002
2833#define MADERA_AIF3TX2_ENA_MASK 0x0002
2834#define MADERA_AIF3TX2_ENA_SHIFT 1
2835#define MADERA_AIF3TX2_ENA_WIDTH 1
2836#define MADERA_AIF3TX1_ENA 0x0001
2837#define MADERA_AIF3TX1_ENA_MASK 0x0001
2838#define MADERA_AIF3TX1_ENA_SHIFT 0
2839#define MADERA_AIF3TX1_ENA_WIDTH 1
2840
2841/* (0x059A) AIF3_Rx_Enables */
2842#define MADERA_AIF3RX2_ENA 0x0002
2843#define MADERA_AIF3RX2_ENA_MASK 0x0002
2844#define MADERA_AIF3RX2_ENA_SHIFT 1
2845#define MADERA_AIF3RX2_ENA_WIDTH 1
2846#define MADERA_AIF3RX1_ENA 0x0001
2847#define MADERA_AIF3RX1_ENA_MASK 0x0001
2848#define MADERA_AIF3RX1_ENA_SHIFT 0
2849#define MADERA_AIF3RX1_ENA_WIDTH 1
2850
2851/* (0x05B9) AIF4_Tx_Enables */
2852#define MADERA_AIF4TX2_ENA 0x0002
2853#define MADERA_AIF4TX2_ENA_MASK 0x0002
2854#define MADERA_AIF4TX2_ENA_SHIFT 1
2855#define MADERA_AIF4TX2_ENA_WIDTH 1
2856#define MADERA_AIF4TX1_ENA 0x0001
2857#define MADERA_AIF4TX1_ENA_MASK 0x0001
2858#define MADERA_AIF4TX1_ENA_SHIFT 0
2859#define MADERA_AIF4TX1_ENA_WIDTH 1
2860
2861/* (0x05BA) AIF4_Rx_Enables */
2862#define MADERA_AIF4RX2_ENA 0x0002
2863#define MADERA_AIF4RX2_ENA_MASK 0x0002
2864#define MADERA_AIF4RX2_ENA_SHIFT 1
2865#define MADERA_AIF4RX2_ENA_WIDTH 1
2866#define MADERA_AIF4RX1_ENA 0x0001
2867#define MADERA_AIF4RX1_ENA_MASK 0x0001
2868#define MADERA_AIF4RX1_ENA_SHIFT 0
2869#define MADERA_AIF4RX1_ENA_WIDTH 1
2870
2871/* (0x05C2) SPD1_TX_Control */
2872#define MADERA_SPD1_VAL2 0x2000
2873#define MADERA_SPD1_VAL2_MASK 0x2000
2874#define MADERA_SPD1_VAL2_SHIFT 13
2875#define MADERA_SPD1_VAL2_WIDTH 1
2876#define MADERA_SPD1_VAL1 0x1000
2877#define MADERA_SPD1_VAL1_MASK 0x1000
2878#define MADERA_SPD1_VAL1_SHIFT 12
2879#define MADERA_SPD1_VAL1_WIDTH 1
2880#define MADERA_SPD1_RATE_MASK 0x00F0
2881#define MADERA_SPD1_RATE_SHIFT 4
2882#define MADERA_SPD1_RATE_WIDTH 4
2883#define MADERA_SPD1_ENA 0x0001
2884#define MADERA_SPD1_ENA_MASK 0x0001
2885#define MADERA_SPD1_ENA_SHIFT 0
2886#define MADERA_SPD1_ENA_WIDTH 1
2887
2888/* (0x05F5) SLIMbus_RX_Channel_Enable */
2889#define MADERA_SLIMRX8_ENA 0x0080
2890#define MADERA_SLIMRX8_ENA_MASK 0x0080
2891#define MADERA_SLIMRX8_ENA_SHIFT 7
2892#define MADERA_SLIMRX8_ENA_WIDTH 1
2893#define MADERA_SLIMRX7_ENA 0x0040
2894#define MADERA_SLIMRX7_ENA_MASK 0x0040
2895#define MADERA_SLIMRX7_ENA_SHIFT 6
2896#define MADERA_SLIMRX7_ENA_WIDTH 1
2897#define MADERA_SLIMRX6_ENA 0x0020
2898#define MADERA_SLIMRX6_ENA_MASK 0x0020
2899#define MADERA_SLIMRX6_ENA_SHIFT 5
2900#define MADERA_SLIMRX6_ENA_WIDTH 1
2901#define MADERA_SLIMRX5_ENA 0x0010
2902#define MADERA_SLIMRX5_ENA_MASK 0x0010
2903#define MADERA_SLIMRX5_ENA_SHIFT 4
2904#define MADERA_SLIMRX5_ENA_WIDTH 1
2905#define MADERA_SLIMRX4_ENA 0x0008
2906#define MADERA_SLIMRX4_ENA_MASK 0x0008
2907#define MADERA_SLIMRX4_ENA_SHIFT 3
2908#define MADERA_SLIMRX4_ENA_WIDTH 1
2909#define MADERA_SLIMRX3_ENA 0x0004
2910#define MADERA_SLIMRX3_ENA_MASK 0x0004
2911#define MADERA_SLIMRX3_ENA_SHIFT 2
2912#define MADERA_SLIMRX3_ENA_WIDTH 1
2913#define MADERA_SLIMRX2_ENA 0x0002
2914#define MADERA_SLIMRX2_ENA_MASK 0x0002
2915#define MADERA_SLIMRX2_ENA_SHIFT 1
2916#define MADERA_SLIMRX2_ENA_WIDTH 1
2917#define MADERA_SLIMRX1_ENA 0x0001
2918#define MADERA_SLIMRX1_ENA_MASK 0x0001
2919#define MADERA_SLIMRX1_ENA_SHIFT 0
2920#define MADERA_SLIMRX1_ENA_WIDTH 1
2921
2922/* (0x05F6) SLIMbus_TX_Channel_Enable */
2923#define MADERA_SLIMTX8_ENA 0x0080
2924#define MADERA_SLIMTX8_ENA_MASK 0x0080
2925#define MADERA_SLIMTX8_ENA_SHIFT 7
2926#define MADERA_SLIMTX8_ENA_WIDTH 1
2927#define MADERA_SLIMTX7_ENA 0x0040
2928#define MADERA_SLIMTX7_ENA_MASK 0x0040
2929#define MADERA_SLIMTX7_ENA_SHIFT 6
2930#define MADERA_SLIMTX7_ENA_WIDTH 1
2931#define MADERA_SLIMTX6_ENA 0x0020
2932#define MADERA_SLIMTX6_ENA_MASK 0x0020
2933#define MADERA_SLIMTX6_ENA_SHIFT 5
2934#define MADERA_SLIMTX6_ENA_WIDTH 1
2935#define MADERA_SLIMTX5_ENA 0x0010
2936#define MADERA_SLIMTX5_ENA_MASK 0x0010
2937#define MADERA_SLIMTX5_ENA_SHIFT 4
2938#define MADERA_SLIMTX5_ENA_WIDTH 1
2939#define MADERA_SLIMTX4_ENA 0x0008
2940#define MADERA_SLIMTX4_ENA_MASK 0x0008
2941#define MADERA_SLIMTX4_ENA_SHIFT 3
2942#define MADERA_SLIMTX4_ENA_WIDTH 1
2943#define MADERA_SLIMTX3_ENA 0x0004
2944#define MADERA_SLIMTX3_ENA_MASK 0x0004
2945#define MADERA_SLIMTX3_ENA_SHIFT 2
2946#define MADERA_SLIMTX3_ENA_WIDTH 1
2947#define MADERA_SLIMTX2_ENA 0x0002
2948#define MADERA_SLIMTX2_ENA_MASK 0x0002
2949#define MADERA_SLIMTX2_ENA_SHIFT 1
2950#define MADERA_SLIMTX2_ENA_WIDTH 1
2951#define MADERA_SLIMTX1_ENA 0x0001
2952#define MADERA_SLIMTX1_ENA_MASK 0x0001
2953#define MADERA_SLIMTX1_ENA_SHIFT 0
2954#define MADERA_SLIMTX1_ENA_WIDTH 1
2955
2956/* (0x0E10) EQ1_1 */
2957#define MADERA_EQ1_B1_GAIN_MASK 0xF800
2958#define MADERA_EQ1_B1_GAIN_SHIFT 11
2959#define MADERA_EQ1_B1_GAIN_WIDTH 5
2960#define MADERA_EQ1_B2_GAIN_MASK 0x07C0
2961#define MADERA_EQ1_B2_GAIN_SHIFT 6
2962#define MADERA_EQ1_B2_GAIN_WIDTH 5
2963#define MADERA_EQ1_B3_GAIN_MASK 0x003E
2964#define MADERA_EQ1_B3_GAIN_SHIFT 1
2965#define MADERA_EQ1_B3_GAIN_WIDTH 5
2966#define MADERA_EQ1_ENA 0x0001
2967#define MADERA_EQ1_ENA_MASK 0x0001
2968#define MADERA_EQ1_ENA_SHIFT 0
2969#define MADERA_EQ1_ENA_WIDTH 1
2970
2971/* (0x0E11) EQ1_2 */
2972#define MADERA_EQ1_B4_GAIN_MASK 0xF800
2973#define MADERA_EQ1_B4_GAIN_SHIFT 11
2974#define MADERA_EQ1_B4_GAIN_WIDTH 5
2975#define MADERA_EQ1_B5_GAIN_MASK 0x07C0
2976#define MADERA_EQ1_B5_GAIN_SHIFT 6
2977#define MADERA_EQ1_B5_GAIN_WIDTH 5
2978#define MADERA_EQ1_B1_MODE 0x0001
2979#define MADERA_EQ1_B1_MODE_MASK 0x0001
2980#define MADERA_EQ1_B1_MODE_SHIFT 0
2981#define MADERA_EQ1_B1_MODE_WIDTH 1
2982
2983/* (0x0E26) EQ2_1 */
2984#define MADERA_EQ2_B1_GAIN_MASK 0xF800
2985#define MADERA_EQ2_B1_GAIN_SHIFT 11
2986#define MADERA_EQ2_B1_GAIN_WIDTH 5
2987#define MADERA_EQ2_B2_GAIN_MASK 0x07C0
2988#define MADERA_EQ2_B2_GAIN_SHIFT 6
2989#define MADERA_EQ2_B2_GAIN_WIDTH 5
2990#define MADERA_EQ2_B3_GAIN_MASK 0x003E
2991#define MADERA_EQ2_B3_GAIN_SHIFT 1
2992#define MADERA_EQ2_B3_GAIN_WIDTH 5
2993#define MADERA_EQ2_ENA 0x0001
2994#define MADERA_EQ2_ENA_MASK 0x0001
2995#define MADERA_EQ2_ENA_SHIFT 0
2996#define MADERA_EQ2_ENA_WIDTH 1
2997
2998/* (0x0E27) EQ2_2 */
2999#define MADERA_EQ2_B4_GAIN_MASK 0xF800
3000#define MADERA_EQ2_B4_GAIN_SHIFT 11
3001#define MADERA_EQ2_B4_GAIN_WIDTH 5
3002#define MADERA_EQ2_B5_GAIN_MASK 0x07C0
3003#define MADERA_EQ2_B5_GAIN_SHIFT 6
3004#define MADERA_EQ2_B5_GAIN_WIDTH 5
3005#define MADERA_EQ2_B1_MODE 0x0001
3006#define MADERA_EQ2_B1_MODE_MASK 0x0001
3007#define MADERA_EQ2_B1_MODE_SHIFT 0
3008#define MADERA_EQ2_B1_MODE_WIDTH 1
3009
3010/* (0x0E3C) EQ3_1 */
3011#define MADERA_EQ3_B1_GAIN_MASK 0xF800
3012#define MADERA_EQ3_B1_GAIN_SHIFT 11
3013#define MADERA_EQ3_B1_GAIN_WIDTH 5
3014#define MADERA_EQ3_B2_GAIN_MASK 0x07C0
3015#define MADERA_EQ3_B2_GAIN_SHIFT 6
3016#define MADERA_EQ3_B2_GAIN_WIDTH 5
3017#define MADERA_EQ3_B3_GAIN_MASK 0x003E
3018#define MADERA_EQ3_B3_GAIN_SHIFT 1
3019#define MADERA_EQ3_B3_GAIN_WIDTH 5
3020#define MADERA_EQ3_ENA 0x0001
3021#define MADERA_EQ3_ENA_MASK 0x0001
3022#define MADERA_EQ3_ENA_SHIFT 0
3023#define MADERA_EQ3_ENA_WIDTH 1
3024
3025/* (0x0E3D) EQ3_2 */
3026#define MADERA_EQ3_B4_GAIN_MASK 0xF800
3027#define MADERA_EQ3_B4_GAIN_SHIFT 11
3028#define MADERA_EQ3_B4_GAIN_WIDTH 5
3029#define MADERA_EQ3_B5_GAIN_MASK 0x07C0
3030#define MADERA_EQ3_B5_GAIN_SHIFT 6
3031#define MADERA_EQ3_B5_GAIN_WIDTH 5
3032#define MADERA_EQ3_B1_MODE 0x0001
3033#define MADERA_EQ3_B1_MODE_MASK 0x0001
3034#define MADERA_EQ3_B1_MODE_SHIFT 0
3035#define MADERA_EQ3_B1_MODE_WIDTH 1
3036
3037/* (0x0E52) EQ4_1 */
3038#define MADERA_EQ4_B1_GAIN_MASK 0xF800
3039#define MADERA_EQ4_B1_GAIN_SHIFT 11
3040#define MADERA_EQ4_B1_GAIN_WIDTH 5
3041#define MADERA_EQ4_B2_GAIN_MASK 0x07C0
3042#define MADERA_EQ4_B2_GAIN_SHIFT 6
3043#define MADERA_EQ4_B2_GAIN_WIDTH 5
3044#define MADERA_EQ4_B3_GAIN_MASK 0x003E
3045#define MADERA_EQ4_B3_GAIN_SHIFT 1
3046#define MADERA_EQ4_B3_GAIN_WIDTH 5
3047#define MADERA_EQ4_ENA 0x0001
3048#define MADERA_EQ4_ENA_MASK 0x0001
3049#define MADERA_EQ4_ENA_SHIFT 0
3050#define MADERA_EQ4_ENA_WIDTH 1
3051
3052/* (0x0E53) EQ4_2 */
3053#define MADERA_EQ4_B4_GAIN_MASK 0xF800
3054#define MADERA_EQ4_B4_GAIN_SHIFT 11
3055#define MADERA_EQ4_B4_GAIN_WIDTH 5
3056#define MADERA_EQ4_B5_GAIN_MASK 0x07C0
3057#define MADERA_EQ4_B5_GAIN_SHIFT 6
3058#define MADERA_EQ4_B5_GAIN_WIDTH 5
3059#define MADERA_EQ4_B1_MODE 0x0001
3060#define MADERA_EQ4_B1_MODE_MASK 0x0001
3061#define MADERA_EQ4_B1_MODE_SHIFT 0
3062#define MADERA_EQ4_B1_MODE_WIDTH 1
3063
3064/* (0x0E80) DRC1_ctrl1 */
3065#define MADERA_DRC1L_ENA 0x0002
3066#define MADERA_DRC1L_ENA_MASK 0x0002
3067#define MADERA_DRC1L_ENA_SHIFT 1
3068#define MADERA_DRC1L_ENA_WIDTH 1
3069#define MADERA_DRC1R_ENA 0x0001
3070#define MADERA_DRC1R_ENA_MASK 0x0001
3071#define MADERA_DRC1R_ENA_SHIFT 0
3072#define MADERA_DRC1R_ENA_WIDTH 1
3073
3074/* (0x0E88) DRC2_ctrl1 */
3075#define MADERA_DRC2L_ENA 0x0002
3076#define MADERA_DRC2L_ENA_MASK 0x0002
3077#define MADERA_DRC2L_ENA_SHIFT 1
3078#define MADERA_DRC2L_ENA_WIDTH 1
3079#define MADERA_DRC2R_ENA 0x0001
3080#define MADERA_DRC2R_ENA_MASK 0x0001
3081#define MADERA_DRC2R_ENA_SHIFT 0
3082#define MADERA_DRC2R_ENA_WIDTH 1
3083
3084/* (0x0EC0) HPLPF1_1 */
3085#define MADERA_LHPF1_MODE 0x0002
3086#define MADERA_LHPF1_MODE_MASK 0x0002
3087#define MADERA_LHPF1_MODE_SHIFT 1
3088#define MADERA_LHPF1_MODE_WIDTH 1
3089#define MADERA_LHPF1_ENA 0x0001
3090#define MADERA_LHPF1_ENA_MASK 0x0001
3091#define MADERA_LHPF1_ENA_SHIFT 0
3092#define MADERA_LHPF1_ENA_WIDTH 1
3093
3094/* (0x0EC1) HPLPF1_2 */
3095#define MADERA_LHPF1_COEFF_MASK 0xFFFF
3096#define MADERA_LHPF1_COEFF_SHIFT 0
3097#define MADERA_LHPF1_COEFF_WIDTH 16
3098
3099/* (0x0EC4) HPLPF2_1 */
3100#define MADERA_LHPF2_MODE 0x0002
3101#define MADERA_LHPF2_MODE_MASK 0x0002
3102#define MADERA_LHPF2_MODE_SHIFT 1
3103#define MADERA_LHPF2_MODE_WIDTH 1
3104#define MADERA_LHPF2_ENA 0x0001
3105#define MADERA_LHPF2_ENA_MASK 0x0001
3106#define MADERA_LHPF2_ENA_SHIFT 0
3107#define MADERA_LHPF2_ENA_WIDTH 1
3108
3109/* (0x0EC5) HPLPF2_2 */
3110#define MADERA_LHPF2_COEFF_MASK 0xFFFF
3111#define MADERA_LHPF2_COEFF_SHIFT 0
3112#define MADERA_LHPF2_COEFF_WIDTH 16
3113
3114/* (0x0EC8) HPLPF3_1 */
3115#define MADERA_LHPF3_MODE 0x0002
3116#define MADERA_LHPF3_MODE_MASK 0x0002
3117#define MADERA_LHPF3_MODE_SHIFT 1
3118#define MADERA_LHPF3_MODE_WIDTH 1
3119#define MADERA_LHPF3_ENA 0x0001
3120#define MADERA_LHPF3_ENA_MASK 0x0001
3121#define MADERA_LHPF3_ENA_SHIFT 0
3122#define MADERA_LHPF3_ENA_WIDTH 1
3123
3124/* (0x0EC9) HPLPF3_2 */
3125#define MADERA_LHPF3_COEFF_MASK 0xFFFF
3126#define MADERA_LHPF3_COEFF_SHIFT 0
3127#define MADERA_LHPF3_COEFF_WIDTH 16
3128
3129/* (0x0ECC) HPLPF4_1 */
3130#define MADERA_LHPF4_MODE 0x0002
3131#define MADERA_LHPF4_MODE_MASK 0x0002
3132#define MADERA_LHPF4_MODE_SHIFT 1
3133#define MADERA_LHPF4_MODE_WIDTH 1
3134#define MADERA_LHPF4_ENA 0x0001
3135#define MADERA_LHPF4_ENA_MASK 0x0001
3136#define MADERA_LHPF4_ENA_SHIFT 0
3137#define MADERA_LHPF4_ENA_WIDTH 1
3138
3139/* (0x0ECD) HPLPF4_2 */
3140#define MADERA_LHPF4_COEFF_MASK 0xFFFF
3141#define MADERA_LHPF4_COEFF_SHIFT 0
3142#define MADERA_LHPF4_COEFF_WIDTH 16
3143
3144/* (0x0ED0) ASRC2_ENABLE */
3145#define MADERA_ASRC2_IN2L_ENA 0x0008
3146#define MADERA_ASRC2_IN2L_ENA_MASK 0x0008
3147#define MADERA_ASRC2_IN2L_ENA_SHIFT 3
3148#define MADERA_ASRC2_IN2L_ENA_WIDTH 1
3149#define MADERA_ASRC2_IN2R_ENA 0x0004
3150#define MADERA_ASRC2_IN2R_ENA_MASK 0x0004
3151#define MADERA_ASRC2_IN2R_ENA_SHIFT 2
3152#define MADERA_ASRC2_IN2R_ENA_WIDTH 1
3153#define MADERA_ASRC2_IN1L_ENA 0x0002
3154#define MADERA_ASRC2_IN1L_ENA_MASK 0x0002
3155#define MADERA_ASRC2_IN1L_ENA_SHIFT 1
3156#define MADERA_ASRC2_IN1L_ENA_WIDTH 1
3157#define MADERA_ASRC2_IN1R_ENA 0x0001
3158#define MADERA_ASRC2_IN1R_ENA_MASK 0x0001
3159#define MADERA_ASRC2_IN1R_ENA_SHIFT 0
3160#define MADERA_ASRC2_IN1R_ENA_WIDTH 1
3161
3162/* (0x0ED2) ASRC2_RATE1 */
3163#define MADERA_ASRC2_RATE1_MASK 0xF800
3164#define MADERA_ASRC2_RATE1_SHIFT 11
3165#define MADERA_ASRC2_RATE1_WIDTH 5
3166
3167/* (0x0ED3) ASRC2_RATE2 */
3168#define MADERA_ASRC2_RATE2_MASK 0xF800
3169#define MADERA_ASRC2_RATE2_SHIFT 11
3170#define MADERA_ASRC2_RATE2_WIDTH 5
3171
3172/* (0x0EE0) ASRC1_ENABLE */
3173#define MADERA_ASRC1_IN2L_ENA 0x0008
3174#define MADERA_ASRC1_IN2L_ENA_MASK 0x0008
3175#define MADERA_ASRC1_IN2L_ENA_SHIFT 3
3176#define MADERA_ASRC1_IN2L_ENA_WIDTH 1
3177#define MADERA_ASRC1_IN2R_ENA 0x0004
3178#define MADERA_ASRC1_IN2R_ENA_MASK 0x0004
3179#define MADERA_ASRC1_IN2R_ENA_SHIFT 2
3180#define MADERA_ASRC1_IN2R_ENA_WIDTH 1
3181#define MADERA_ASRC1_IN1L_ENA 0x0002
3182#define MADERA_ASRC1_IN1L_ENA_MASK 0x0002
3183#define MADERA_ASRC1_IN1L_ENA_SHIFT 1
3184#define MADERA_ASRC1_IN1L_ENA_WIDTH 1
3185#define MADERA_ASRC1_IN1R_ENA 0x0001
3186#define MADERA_ASRC1_IN1R_ENA_MASK 0x0001
3187#define MADERA_ASRC1_IN1R_ENA_SHIFT 0
3188#define MADERA_ASRC1_IN1R_ENA_WIDTH 1
3189
3190/* (0x0EE2) ASRC1_RATE1 */
3191#define MADERA_ASRC1_RATE1_MASK 0xF800
3192#define MADERA_ASRC1_RATE1_SHIFT 11
3193#define MADERA_ASRC1_RATE1_WIDTH 5
3194
3195/* (0x0EE3) ASRC1_RATE2 */
3196#define MADERA_ASRC1_RATE2_MASK 0xF800
3197#define MADERA_ASRC1_RATE2_SHIFT 11
3198#define MADERA_ASRC1_RATE2_WIDTH 5
3199
3200/* (0x0EF0) - ISRC1 CTRL 1 */
3201#define MADERA_ISRC1_FSH_MASK 0xF800
3202#define MADERA_ISRC1_FSH_SHIFT 11
3203#define MADERA_ISRC1_FSH_WIDTH 5
3204#define MADERA_ISRC1_CLK_SEL_MASK 0x0700
3205#define MADERA_ISRC1_CLK_SEL_SHIFT 8
3206#define MADERA_ISRC1_CLK_SEL_WIDTH 3
3207
3208/* (0x0EF1) ISRC1_CTRL_2 */
3209#define MADERA_ISRC1_FSL_MASK 0xF800
3210#define MADERA_ISRC1_FSL_SHIFT 11
3211#define MADERA_ISRC1_FSL_WIDTH 5
3212
3213/* (0x0EF2) ISRC1_CTRL_3 */
3214#define MADERA_ISRC1_INT1_ENA 0x8000
3215#define MADERA_ISRC1_INT1_ENA_MASK 0x8000
3216#define MADERA_ISRC1_INT1_ENA_SHIFT 15
3217#define MADERA_ISRC1_INT1_ENA_WIDTH 1
3218#define MADERA_ISRC1_INT2_ENA 0x4000
3219#define MADERA_ISRC1_INT2_ENA_MASK 0x4000
3220#define MADERA_ISRC1_INT2_ENA_SHIFT 14
3221#define MADERA_ISRC1_INT2_ENA_WIDTH 1
3222#define MADERA_ISRC1_INT3_ENA 0x2000
3223#define MADERA_ISRC1_INT3_ENA_MASK 0x2000
3224#define MADERA_ISRC1_INT3_ENA_SHIFT 13
3225#define MADERA_ISRC1_INT3_ENA_WIDTH 1
3226#define MADERA_ISRC1_INT4_ENA 0x1000
3227#define MADERA_ISRC1_INT4_ENA_MASK 0x1000
3228#define MADERA_ISRC1_INT4_ENA_SHIFT 12
3229#define MADERA_ISRC1_INT4_ENA_WIDTH 1
3230#define MADERA_ISRC1_DEC1_ENA 0x0200
3231#define MADERA_ISRC1_DEC1_ENA_MASK 0x0200
3232#define MADERA_ISRC1_DEC1_ENA_SHIFT 9
3233#define MADERA_ISRC1_DEC1_ENA_WIDTH 1
3234#define MADERA_ISRC1_DEC2_ENA 0x0100
3235#define MADERA_ISRC1_DEC2_ENA_MASK 0x0100
3236#define MADERA_ISRC1_DEC2_ENA_SHIFT 8
3237#define MADERA_ISRC1_DEC2_ENA_WIDTH 1
3238#define MADERA_ISRC1_DEC3_ENA 0x0080
3239#define MADERA_ISRC1_DEC3_ENA_MASK 0x0080
3240#define MADERA_ISRC1_DEC3_ENA_SHIFT 7
3241#define MADERA_ISRC1_DEC3_ENA_WIDTH 1
3242#define MADERA_ISRC1_DEC4_ENA 0x0040
3243#define MADERA_ISRC1_DEC4_ENA_MASK 0x0040
3244#define MADERA_ISRC1_DEC4_ENA_SHIFT 6
3245#define MADERA_ISRC1_DEC4_ENA_WIDTH 1
3246#define MADERA_ISRC1_NOTCH_ENA 0x0001
3247#define MADERA_ISRC1_NOTCH_ENA_MASK 0x0001
3248#define MADERA_ISRC1_NOTCH_ENA_SHIFT 0
3249#define MADERA_ISRC1_NOTCH_ENA_WIDTH 1
3250
3251/* (0x0EF3) ISRC2_CTRL_1 */
3252#define MADERA_ISRC2_FSH_MASK 0xF800
3253#define MADERA_ISRC2_FSH_SHIFT 11
3254#define MADERA_ISRC2_FSH_WIDTH 5
3255#define MADERA_ISRC2_CLK_SEL_MASK 0x0700
3256#define MADERA_ISRC2_CLK_SEL_SHIFT 8
3257#define MADERA_ISRC2_CLK_SEL_WIDTH 3
3258
3259/* (0x0EF4) ISRC2_CTRL_2 */
3260#define MADERA_ISRC2_FSL_MASK 0xF800
3261#define MADERA_ISRC2_FSL_SHIFT 11
3262#define MADERA_ISRC2_FSL_WIDTH 5
3263
3264/* (0x0EF5) ISRC2_CTRL_3 */
3265#define MADERA_ISRC2_INT1_ENA 0x8000
3266#define MADERA_ISRC2_INT1_ENA_MASK 0x8000
3267#define MADERA_ISRC2_INT1_ENA_SHIFT 15
3268#define MADERA_ISRC2_INT1_ENA_WIDTH 1
3269#define MADERA_ISRC2_INT2_ENA 0x4000
3270#define MADERA_ISRC2_INT2_ENA_MASK 0x4000
3271#define MADERA_ISRC2_INT2_ENA_SHIFT 14
3272#define MADERA_ISRC2_INT2_ENA_WIDTH 1
3273#define MADERA_ISRC2_INT3_ENA 0x2000
3274#define MADERA_ISRC2_INT3_ENA_MASK 0x2000
3275#define MADERA_ISRC2_INT3_ENA_SHIFT 13
3276#define MADERA_ISRC2_INT3_ENA_WIDTH 1
3277#define MADERA_ISRC2_INT4_ENA 0x1000
3278#define MADERA_ISRC2_INT4_ENA_MASK 0x1000
3279#define MADERA_ISRC2_INT4_ENA_SHIFT 12
3280#define MADERA_ISRC2_INT4_ENA_WIDTH 1
3281#define MADERA_ISRC2_DEC1_ENA 0x0200
3282#define MADERA_ISRC2_DEC1_ENA_MASK 0x0200
3283#define MADERA_ISRC2_DEC1_ENA_SHIFT 9
3284#define MADERA_ISRC2_DEC1_ENA_WIDTH 1
3285#define MADERA_ISRC2_DEC2_ENA 0x0100
3286#define MADERA_ISRC2_DEC2_ENA_MASK 0x0100
3287#define MADERA_ISRC2_DEC2_ENA_SHIFT 8
3288#define MADERA_ISRC2_DEC2_ENA_WIDTH 1
3289#define MADERA_ISRC2_DEC3_ENA 0x0080
3290#define MADERA_ISRC2_DEC3_ENA_MASK 0x0080
3291#define MADERA_ISRC2_DEC3_ENA_SHIFT 7
3292#define MADERA_ISRC2_DEC3_ENA_WIDTH 1
3293#define MADERA_ISRC2_DEC4_ENA 0x0040
3294#define MADERA_ISRC2_DEC4_ENA_MASK 0x0040
3295#define MADERA_ISRC2_DEC4_ENA_SHIFT 6
3296#define MADERA_ISRC2_DEC4_ENA_WIDTH 1
3297#define MADERA_ISRC2_NOTCH_ENA 0x0001
3298#define MADERA_ISRC2_NOTCH_ENA_MASK 0x0001
3299#define MADERA_ISRC2_NOTCH_ENA_SHIFT 0
3300#define MADERA_ISRC2_NOTCH_ENA_WIDTH 1
3301
3302/* (0x0EF6) ISRC3_CTRL_1 */
3303#define MADERA_ISRC3_FSH_MASK 0xF800
3304#define MADERA_ISRC3_FSH_SHIFT 11
3305#define MADERA_ISRC3_FSH_WIDTH 5
3306#define MADERA_ISRC3_CLK_SEL_MASK 0x0700
3307#define MADERA_ISRC3_CLK_SEL_SHIFT 8
3308#define MADERA_ISRC3_CLK_SEL_WIDTH 3
3309
3310/* (0x0EF7) ISRC3_CTRL_2 */
3311#define MADERA_ISRC3_FSL_MASK 0xF800
3312#define MADERA_ISRC3_FSL_SHIFT 11
3313#define MADERA_ISRC3_FSL_WIDTH 5
3314
3315/* (0x0EF8) ISRC3_CTRL_3 */
3316#define MADERA_ISRC3_INT1_ENA 0x8000
3317#define MADERA_ISRC3_INT1_ENA_MASK 0x8000
3318#define MADERA_ISRC3_INT1_ENA_SHIFT 15
3319#define MADERA_ISRC3_INT1_ENA_WIDTH 1
3320#define MADERA_ISRC3_INT2_ENA 0x4000
3321#define MADERA_ISRC3_INT2_ENA_MASK 0x4000
3322#define MADERA_ISRC3_INT2_ENA_SHIFT 14
3323#define MADERA_ISRC3_INT2_ENA_WIDTH 1
3324#define MADERA_ISRC3_INT3_ENA 0x2000
3325#define MADERA_ISRC3_INT3_ENA_MASK 0x2000
3326#define MADERA_ISRC3_INT3_ENA_SHIFT 13
3327#define MADERA_ISRC3_INT3_ENA_WIDTH 1
3328#define MADERA_ISRC3_INT4_ENA 0x1000
3329#define MADERA_ISRC3_INT4_ENA_MASK 0x1000
3330#define MADERA_ISRC3_INT4_ENA_SHIFT 12
3331#define MADERA_ISRC3_INT4_ENA_WIDTH 1
3332#define MADERA_ISRC3_DEC1_ENA 0x0200
3333#define MADERA_ISRC3_DEC1_ENA_MASK 0x0200
3334#define MADERA_ISRC3_DEC1_ENA_SHIFT 9
3335#define MADERA_ISRC3_DEC1_ENA_WIDTH 1
3336#define MADERA_ISRC3_DEC2_ENA 0x0100
3337#define MADERA_ISRC3_DEC2_ENA_MASK 0x0100
3338#define MADERA_ISRC3_DEC2_ENA_SHIFT 8
3339#define MADERA_ISRC3_DEC2_ENA_WIDTH 1
3340#define MADERA_ISRC3_DEC3_ENA 0x0080
3341#define MADERA_ISRC3_DEC3_ENA_MASK 0x0080
3342#define MADERA_ISRC3_DEC3_ENA_SHIFT 7
3343#define MADERA_ISRC3_DEC3_ENA_WIDTH 1
3344#define MADERA_ISRC3_DEC4_ENA 0x0040
3345#define MADERA_ISRC3_DEC4_ENA_MASK 0x0040
3346#define MADERA_ISRC3_DEC4_ENA_SHIFT 6
3347#define MADERA_ISRC3_DEC4_ENA_WIDTH 1
3348#define MADERA_ISRC3_NOTCH_ENA 0x0001
3349#define MADERA_ISRC3_NOTCH_ENA_MASK 0x0001
3350#define MADERA_ISRC3_NOTCH_ENA_SHIFT 0
3351#define MADERA_ISRC3_NOTCH_ENA_WIDTH 1
3352
3353/* (0x0EF9) ISRC4_CTRL_1 */
3354#define MADERA_ISRC4_FSH_MASK 0xF800
3355#define MADERA_ISRC4_FSH_SHIFT 11
3356#define MADERA_ISRC4_FSH_WIDTH 5
3357#define MADERA_ISRC4_CLK_SEL_MASK 0x0700
3358#define MADERA_ISRC4_CLK_SEL_SHIFT 8
3359#define MADERA_ISRC4_CLK_SEL_WIDTH 3
3360
3361/* (0x0EFA) ISRC4_CTRL_2 */
3362#define MADERA_ISRC4_FSL_MASK 0xF800
3363#define MADERA_ISRC4_FSL_SHIFT 11
3364#define MADERA_ISRC4_FSL_WIDTH 5
3365
3366/* (0x0EFB) ISRC4_CTRL_3 */
3367#define MADERA_ISRC4_INT1_ENA 0x8000
3368#define MADERA_ISRC4_INT1_ENA_MASK 0x8000
3369#define MADERA_ISRC4_INT1_ENA_SHIFT 15
3370#define MADERA_ISRC4_INT1_ENA_WIDTH 1
3371#define MADERA_ISRC4_INT2_ENA 0x4000
3372#define MADERA_ISRC4_INT2_ENA_MASK 0x4000
3373#define MADERA_ISRC4_INT2_ENA_SHIFT 14
3374#define MADERA_ISRC4_INT2_ENA_WIDTH 1
3375#define MADERA_ISRC4_INT3_ENA 0x2000
3376#define MADERA_ISRC4_INT3_ENA_MASK 0x2000
3377#define MADERA_ISRC4_INT3_ENA_SHIFT 13
3378#define MADERA_ISRC4_INT3_ENA_WIDTH 1
3379#define MADERA_ISRC4_INT4_ENA 0x1000
3380#define MADERA_ISRC4_INT4_ENA_MASK 0x1000
3381#define MADERA_ISRC4_INT4_ENA_SHIFT 12
3382#define MADERA_ISRC4_INT4_ENA_WIDTH 1
3383#define MADERA_ISRC4_DEC1_ENA 0x0200
3384#define MADERA_ISRC4_DEC1_ENA_MASK 0x0200
3385#define MADERA_ISRC4_DEC1_ENA_SHIFT 9
3386#define MADERA_ISRC4_DEC1_ENA_WIDTH 1
3387#define MADERA_ISRC4_DEC2_ENA 0x0100
3388#define MADERA_ISRC4_DEC2_ENA_MASK 0x0100
3389#define MADERA_ISRC4_DEC2_ENA_SHIFT 8
3390#define MADERA_ISRC4_DEC2_ENA_WIDTH 1
3391#define MADERA_ISRC4_DEC3_ENA 0x0080
3392#define MADERA_ISRC4_DEC3_ENA_MASK 0x0080
3393#define MADERA_ISRC4_DEC3_ENA_SHIFT 7
3394#define MADERA_ISRC4_DEC3_ENA_WIDTH 1
3395#define MADERA_ISRC4_DEC4_ENA 0x0040
3396#define MADERA_ISRC4_DEC4_ENA_MASK 0x0040
3397#define MADERA_ISRC4_DEC4_ENA_SHIFT 6
3398#define MADERA_ISRC4_DEC4_ENA_WIDTH 1
3399#define MADERA_ISRC4_NOTCH_ENA 0x0001
3400#define MADERA_ISRC4_NOTCH_ENA_MASK 0x0001
3401#define MADERA_ISRC4_NOTCH_ENA_SHIFT 0
3402#define MADERA_ISRC4_NOTCH_ENA_WIDTH 1
3403
3404/* (0x0F00) Clock_Control */
3405#define MADERA_EXT_NG_SEL_CLR 0x0080
3406#define MADERA_EXT_NG_SEL_CLR_MASK 0x0080
3407#define MADERA_EXT_NG_SEL_CLR_SHIFT 7
3408#define MADERA_EXT_NG_SEL_CLR_WIDTH 1
3409#define MADERA_EXT_NG_SEL_SET 0x0040
3410#define MADERA_EXT_NG_SEL_SET_MASK 0x0040
3411#define MADERA_EXT_NG_SEL_SET_SHIFT 6
3412#define MADERA_EXT_NG_SEL_SET_WIDTH 1
3413#define MADERA_CLK_R_ENA_CLR 0x0020
3414#define MADERA_CLK_R_ENA_CLR_MASK 0x0020
3415#define MADERA_CLK_R_ENA_CLR_SHIFT 5
3416#define MADERA_CLK_R_ENA_CLR_WIDTH 1
3417#define MADERA_CLK_R_ENA_SET 0x0010
3418#define MADERA_CLK_R_ENA_SET_MASK 0x0010
3419#define MADERA_CLK_R_ENA_SET_SHIFT 4
3420#define MADERA_CLK_R_ENA_SET_WIDTH 1
3421#define MADERA_CLK_NG_ENA_CLR 0x0008
3422#define MADERA_CLK_NG_ENA_CLR_MASK 0x0008
3423#define MADERA_CLK_NG_ENA_CLR_SHIFT 3
3424#define MADERA_CLK_NG_ENA_CLR_WIDTH 1
3425#define MADERA_CLK_NG_ENA_SET 0x0004
3426#define MADERA_CLK_NG_ENA_SET_MASK 0x0004
3427#define MADERA_CLK_NG_ENA_SET_SHIFT 2
3428#define MADERA_CLK_NG_ENA_SET_WIDTH 1
3429#define MADERA_CLK_L_ENA_CLR 0x0002
3430#define MADERA_CLK_L_ENA_CLR_MASK 0x0002
3431#define MADERA_CLK_L_ENA_CLR_SHIFT 1
3432#define MADERA_CLK_L_ENA_CLR_WIDTH 1
3433#define MADERA_CLK_L_ENA_SET 0x0001
3434#define MADERA_CLK_L_ENA_SET_MASK 0x0001
3435#define MADERA_CLK_L_ENA_SET_SHIFT 0
3436#define MADERA_CLK_L_ENA_SET_WIDTH 1
3437
3438/* (0x0F01) ANC_SRC */
3439#define MADERA_IN_RXANCR_SEL_MASK 0x0070
3440#define MADERA_IN_RXANCR_SEL_SHIFT 4
3441#define MADERA_IN_RXANCR_SEL_WIDTH 3
3442#define MADERA_IN_RXANCL_SEL_MASK 0x0007
3443#define MADERA_IN_RXANCL_SEL_SHIFT 0
3444#define MADERA_IN_RXANCL_SEL_WIDTH 3
3445
3446/* (0x0F17) FCL_ADC_reformatter_control */
3447#define MADERA_FCL_MIC_MODE_SEL 0x000C
3448#define MADERA_FCL_MIC_MODE_SEL_SHIFT 2
3449#define MADERA_FCL_MIC_MODE_SEL_WIDTH 2
3450
3451/* (0x0F73) FCR_ADC_reformatter_control */
3452#define MADERA_FCR_MIC_MODE_SEL 0x000C
3453#define MADERA_FCR_MIC_MODE_SEL_SHIFT 2
3454#define MADERA_FCR_MIC_MODE_SEL_WIDTH 2
3455
3456/* (0x1480) DFC1_CTRL_W0 */
3457#define MADERA_DFC1_RATE_MASK 0x007C
3458#define MADERA_DFC1_RATE_SHIFT 2
3459#define MADERA_DFC1_RATE_WIDTH 5
3460#define MADERA_DFC1_DITH_ENA 0x0002
3461#define MADERA_DFC1_DITH_ENA_MASK 0x0002
3462#define MADERA_DFC1_DITH_ENA_SHIFT 1
3463#define MADERA_DFC1_DITH_ENA_WIDTH 1
3464#define MADERA_DFC1_ENA 0x0001
3465#define MADERA_DFC1_ENA_MASK 0x0001
3466#define MADERA_DFC1_ENA_SHIFT 0
3467#define MADERA_DFC1_ENA_WIDTH 1
3468
3469/* (0x1482) DFC1_RX_W0 */
3470#define MADERA_DFC1_RX_DATA_WIDTH_MASK 0x1F00
3471#define MADERA_DFC1_RX_DATA_WIDTH_SHIFT 8
3472#define MADERA_DFC1_RX_DATA_WIDTH_WIDTH 5
3473
3474#define MADERA_DFC1_RX_DATA_TYPE_MASK 0x0007
3475#define MADERA_DFC1_RX_DATA_TYPE_SHIFT 0
3476#define MADERA_DFC1_RX_DATA_TYPE_WIDTH 3
3477
3478/* (0x1484) DFC1_TX_W0 */
3479#define MADERA_DFC1_TX_DATA_WIDTH_MASK 0x1F00
3480#define MADERA_DFC1_TX_DATA_WIDTH_SHIFT 8
3481#define MADERA_DFC1_TX_DATA_WIDTH_WIDTH 5
3482
3483#define MADERA_DFC1_TX_DATA_TYPE_MASK 0x0007
3484#define MADERA_DFC1_TX_DATA_TYPE_SHIFT 0
3485#define MADERA_DFC1_TX_DATA_TYPE_WIDTH 3
3486
3487/* (0x1600) ADSP2_IRQ0 */
3488#define MADERA_DSP_IRQ2 0x0002
3489#define MADERA_DSP_IRQ1 0x0001
3490
3491/* (0x1601) ADSP2_IRQ1 */
3492#define MADERA_DSP_IRQ4 0x0002
3493#define MADERA_DSP_IRQ3 0x0001
3494
3495/* (0x1602) ADSP2_IRQ2 */
3496#define MADERA_DSP_IRQ6 0x0002
3497#define MADERA_DSP_IRQ5 0x0001
3498
3499/* (0x1603) ADSP2_IRQ3 */
3500#define MADERA_DSP_IRQ8 0x0002
3501#define MADERA_DSP_IRQ7 0x0001
3502
3503/* (0x1604) ADSP2_IRQ4 */
3504#define MADERA_DSP_IRQ10 0x0002
3505#define MADERA_DSP_IRQ9 0x0001
3506
3507/* (0x1605) ADSP2_IRQ5 */
3508#define MADERA_DSP_IRQ12 0x0002
3509#define MADERA_DSP_IRQ11 0x0001
3510
3511/* (0x1606) ADSP2_IRQ6 */
3512#define MADERA_DSP_IRQ14 0x0002
3513#define MADERA_DSP_IRQ13 0x0001
3514
3515/* (0x1607) ADSP2_IRQ7 */
3516#define MADERA_DSP_IRQ16 0x0002
3517#define MADERA_DSP_IRQ15 0x0001
3518
3519/* (0x1700) GPIO1_CTRL_1 */
3520#define MADERA_GP1_LVL 0x8000
3521#define MADERA_GP1_LVL_MASK 0x8000
3522#define MADERA_GP1_LVL_SHIFT 15
3523#define MADERA_GP1_LVL_WIDTH 1
3524#define MADERA_GP1_OP_CFG 0x4000
3525#define MADERA_GP1_OP_CFG_MASK 0x4000
3526#define MADERA_GP1_OP_CFG_SHIFT 14
3527#define MADERA_GP1_OP_CFG_WIDTH 1
3528#define MADERA_GP1_DB 0x2000
3529#define MADERA_GP1_DB_MASK 0x2000
3530#define MADERA_GP1_DB_SHIFT 13
3531#define MADERA_GP1_DB_WIDTH 1
3532#define MADERA_GP1_POL 0x1000
3533#define MADERA_GP1_POL_MASK 0x1000
3534#define MADERA_GP1_POL_SHIFT 12
3535#define MADERA_GP1_POL_WIDTH 1
3536#define MADERA_GP1_IP_CFG 0x0800
3537#define MADERA_GP1_IP_CFG_MASK 0x0800
3538#define MADERA_GP1_IP_CFG_SHIFT 11
3539#define MADERA_GP1_IP_CFG_WIDTH 1
3540#define MADERA_GP1_FN_MASK 0x03FF
3541#define MADERA_GP1_FN_SHIFT 0
3542#define MADERA_GP1_FN_WIDTH 10
3543
3544/* (0x1701) GPIO1_CTRL_2 */
3545#define MADERA_GP1_DIR 0x8000
3546#define MADERA_GP1_DIR_MASK 0x8000
3547#define MADERA_GP1_DIR_SHIFT 15
3548#define MADERA_GP1_DIR_WIDTH 1
3549#define MADERA_GP1_PU 0x4000
3550#define MADERA_GP1_PU_MASK 0x4000
3551#define MADERA_GP1_PU_SHIFT 14
3552#define MADERA_GP1_PU_WIDTH 1
3553#define MADERA_GP1_PD 0x2000
3554#define MADERA_GP1_PD_MASK 0x2000
3555#define MADERA_GP1_PD_SHIFT 13
3556#define MADERA_GP1_PD_WIDTH 1
3557#define MADERA_GP1_DRV_STR_MASK 0x1800
3558#define MADERA_GP1_DRV_STR_SHIFT 11
3559#define MADERA_GP1_DRV_STR_WIDTH 2
3560
3561/* (0x1800) IRQ1_Status_1 */
3562#define MADERA_CTRLIF_ERR_EINT1 0x1000
3563#define MADERA_CTRLIF_ERR_EINT1_MASK 0x1000
3564#define MADERA_CTRLIF_ERR_EINT1_SHIFT 12
3565#define MADERA_CTRLIF_ERR_EINT1_WIDTH 1
3566#define MADERA_SYSCLK_FAIL_EINT1 0x0200
3567#define MADERA_SYSCLK_FAIL_EINT1_MASK 0x0200
3568#define MADERA_SYSCLK_FAIL_EINT1_SHIFT 9
3569#define MADERA_SYSCLK_FAIL_EINT1_WIDTH 1
3570#define MADERA_CLOCK_DETECT_EINT1 0x0100
3571#define MADERA_CLOCK_DETECT_EINT1_MASK 0x0100
3572#define MADERA_CLOCK_DETECT_EINT1_SHIFT 8
3573#define MADERA_CLOCK_DETECT_EINT1_WIDTH 1
3574#define MADERA_BOOT_DONE_EINT1 0x0080
3575#define MADERA_BOOT_DONE_EINT1_MASK 0x0080
3576#define MADERA_BOOT_DONE_EINT1_SHIFT 7
3577#define MADERA_BOOT_DONE_EINT1_WIDTH 1
3578
3579/* (0x1801) IRQ1_Status_2 */
3580#define MADERA_FLLAO_LOCK_EINT1 0x0800
3581#define MADERA_FLLAO_LOCK_EINT1_MASK 0x0800
3582#define MADERA_FLLAO_LOCK_EINT1_SHIFT 11
3583#define MADERA_FLLAO_LOCK_EINT1_WIDTH 1
3584#define MADERA_FLL3_LOCK_EINT1 0x0400
3585#define MADERA_FLL3_LOCK_EINT1_MASK 0x0400
3586#define MADERA_FLL3_LOCK_EINT1_SHIFT 10
3587#define MADERA_FLL3_LOCK_EINT1_WIDTH 1
3588#define MADERA_FLL2_LOCK_EINT1 0x0200
3589#define MADERA_FLL2_LOCK_EINT1_MASK 0x0200
3590#define MADERA_FLL2_LOCK_EINT1_SHIFT 9
3591#define MADERA_FLL2_LOCK_EINT1_WIDTH 1
3592#define MADERA_FLL1_LOCK_EINT1 0x0100
3593#define MADERA_FLL1_LOCK_EINT1_MASK 0x0100
3594#define MADERA_FLL1_LOCK_EINT1_SHIFT 8
3595#define MADERA_FLL1_LOCK_EINT1_WIDTH 1
3596
3597/* (0x1805) IRQ1_Status_6 */
3598#define MADERA_MICDET2_EINT1 0x0200
3599#define MADERA_MICDET2_EINT1_MASK 0x0200
3600#define MADERA_MICDET2_EINT1_SHIFT 9
3601#define MADERA_MICDET2_EINT1_WIDTH 1
3602#define MADERA_MICDET1_EINT1 0x0100
3603#define MADERA_MICDET1_EINT1_MASK 0x0100
3604#define MADERA_MICDET1_EINT1_SHIFT 8
3605#define MADERA_MICDET1_EINT1_WIDTH 1
3606#define MADERA_HPDET_EINT1 0x0001
3607#define MADERA_HPDET_EINT1_MASK 0x0001
3608#define MADERA_HPDET_EINT1_SHIFT 0
3609#define MADERA_HPDET_EINT1_WIDTH 1
3610
3611/* (0x1806) IRQ1_Status_7 */
3612#define MADERA_MICD_CLAMP_FALL_EINT1 0x0020
3613#define MADERA_MICD_CLAMP_FALL_EINT1_MASK 0x0020
3614#define MADERA_MICD_CLAMP_FALL_EINT1_SHIFT 5
3615#define MADERA_MICD_CLAMP_FALL_EINT1_WIDTH 1
3616#define MADERA_MICD_CLAMP_RISE_EINT1 0x0010
3617#define MADERA_MICD_CLAMP_RISE_EINT1_MASK 0x0010
3618#define MADERA_MICD_CLAMP_RISE_EINT1_SHIFT 4
3619#define MADERA_MICD_CLAMP_RISE_EINT1_WIDTH 1
3620#define MADERA_JD2_FALL_EINT1 0x0008
3621#define MADERA_JD2_FALL_EINT1_MASK 0x0008
3622#define MADERA_JD2_FALL_EINT1_SHIFT 3
3623#define MADERA_JD2_FALL_EINT1_WIDTH 1
3624#define MADERA_JD2_RISE_EINT1 0x0004
3625#define MADERA_JD2_RISE_EINT1_MASK 0x0004
3626#define MADERA_JD2_RISE_EINT1_SHIFT 2
3627#define MADERA_JD2_RISE_EINT1_WIDTH 1
3628#define MADERA_JD1_FALL_EINT1 0x0002
3629#define MADERA_JD1_FALL_EINT1_MASK 0x0002
3630#define MADERA_JD1_FALL_EINT1_SHIFT 1
3631#define MADERA_JD1_FALL_EINT1_WIDTH 1
3632#define MADERA_JD1_RISE_EINT1 0x0001
3633#define MADERA_JD1_RISE_EINT1_MASK 0x0001
3634#define MADERA_JD1_RISE_EINT1_SHIFT 0
3635#define MADERA_JD1_RISE_EINT1_WIDTH 1
3636
3637/* (0x1808) IRQ1_Status_9 */
3638#define MADERA_ASRC2_IN2_LOCK_EINT1 0x0800
3639#define MADERA_ASRC2_IN2_LOCK_EINT1_MASK 0x0800
3640#define MADERA_ASRC2_IN2_LOCK_EINT1_SHIFT 11
3641#define MADERA_ASRC2_IN2_LOCK_EINT1_WIDTH 1
3642#define MADERA_ASRC2_IN1_LOCK_EINT1 0x0400
3643#define MADERA_ASRC2_IN1_LOCK_EINT1_MASK 0x0400
3644#define MADERA_ASRC2_IN1_LOCK_EINT1_SHIFT 10
3645#define MADERA_ASRC2_IN1_LOCK_EINT1_WIDTH 1
3646#define MADERA_ASRC1_IN2_LOCK_EINT1 0x0200
3647#define MADERA_ASRC1_IN2_LOCK_EINT1_MASK 0x0200
3648#define MADERA_ASRC1_IN2_LOCK_EINT1_SHIFT 9
3649#define MADERA_ASRC1_IN2_LOCK_EINT1_WIDTH 1
3650#define MADERA_ASRC1_IN1_LOCK_EINT1 0x0100
3651#define MADERA_ASRC1_IN1_LOCK_EINT1_MASK 0x0100
3652#define MADERA_ASRC1_IN1_LOCK_EINT1_SHIFT 8
3653#define MADERA_ASRC1_IN1_LOCK_EINT1_WIDTH 1
3654#define MADERA_DRC2_SIG_DET_EINT1 0x0002
3655#define MADERA_DRC2_SIG_DET_EINT1_MASK 0x0002
3656#define MADERA_DRC2_SIG_DET_EINT1_SHIFT 1
3657#define MADERA_DRC2_SIG_DET_EINT1_WIDTH 1
3658#define MADERA_DRC1_SIG_DET_EINT1 0x0001
3659#define MADERA_DRC1_SIG_DET_EINT1_MASK 0x0001
3660#define MADERA_DRC1_SIG_DET_EINT1_SHIFT 0
3661#define MADERA_DRC1_SIG_DET_EINT1_WIDTH 1
3662
3663/* (0x180A) IRQ1_Status_11 */
3664#define MADERA_DSP_IRQ16_EINT1 0x8000
3665#define MADERA_DSP_IRQ16_EINT1_MASK 0x8000
3666#define MADERA_DSP_IRQ16_EINT1_SHIFT 15
3667#define MADERA_DSP_IRQ16_EINT1_WIDTH 1
3668#define MADERA_DSP_IRQ15_EINT1 0x4000
3669#define MADERA_DSP_IRQ15_EINT1_MASK 0x4000
3670#define MADERA_DSP_IRQ15_EINT1_SHIFT 14
3671#define MADERA_DSP_IRQ15_EINT1_WIDTH 1
3672#define MADERA_DSP_IRQ14_EINT1 0x2000
3673#define MADERA_DSP_IRQ14_EINT1_MASK 0x2000
3674#define MADERA_DSP_IRQ14_EINT1_SHIFT 13
3675#define MADERA_DSP_IRQ14_EINT1_WIDTH 1
3676#define MADERA_DSP_IRQ13_EINT1 0x1000
3677#define MADERA_DSP_IRQ13_EINT1_MASK 0x1000
3678#define MADERA_DSP_IRQ13_EINT1_SHIFT 12
3679#define MADERA_DSP_IRQ13_EINT1_WIDTH 1
3680#define MADERA_DSP_IRQ12_EINT1 0x0800
3681#define MADERA_DSP_IRQ12_EINT1_MASK 0x0800
3682#define MADERA_DSP_IRQ12_EINT1_SHIFT 11
3683#define MADERA_DSP_IRQ12_EINT1_WIDTH 1
3684#define MADERA_DSP_IRQ11_EINT1 0x0400
3685#define MADERA_DSP_IRQ11_EINT1_MASK 0x0400
3686#define MADERA_DSP_IRQ11_EINT1_SHIFT 10
3687#define MADERA_DSP_IRQ11_EINT1_WIDTH 1
3688#define MADERA_DSP_IRQ10_EINT1 0x0200
3689#define MADERA_DSP_IRQ10_EINT1_MASK 0x0200
3690#define MADERA_DSP_IRQ10_EINT1_SHIFT 9
3691#define MADERA_DSP_IRQ10_EINT1_WIDTH 1
3692#define MADERA_DSP_IRQ9_EINT1 0x0100
3693#define MADERA_DSP_IRQ9_EINT1_MASK 0x0100
3694#define MADERA_DSP_IRQ9_EINT1_SHIFT 8
3695#define MADERA_DSP_IRQ9_EINT1_WIDTH 1
3696#define MADERA_DSP_IRQ8_EINT1 0x0080
3697#define MADERA_DSP_IRQ8_EINT1_MASK 0x0080
3698#define MADERA_DSP_IRQ8_EINT1_SHIFT 7
3699#define MADERA_DSP_IRQ8_EINT1_WIDTH 1
3700#define MADERA_DSP_IRQ7_EINT1 0x0040
3701#define MADERA_DSP_IRQ7_EINT1_MASK 0x0040
3702#define MADERA_DSP_IRQ7_EINT1_SHIFT 6
3703#define MADERA_DSP_IRQ7_EINT1_WIDTH 1
3704#define MADERA_DSP_IRQ6_EINT1 0x0020
3705#define MADERA_DSP_IRQ6_EINT1_MASK 0x0020
3706#define MADERA_DSP_IRQ6_EINT1_SHIFT 5
3707#define MADERA_DSP_IRQ6_EINT1_WIDTH 1
3708#define MADERA_DSP_IRQ5_EINT1 0x0010
3709#define MADERA_DSP_IRQ5_EINT1_MASK 0x0010
3710#define MADERA_DSP_IRQ5_EINT1_SHIFT 4
3711#define MADERA_DSP_IRQ5_EINT1_WIDTH 1
3712#define MADERA_DSP_IRQ4_EINT1 0x0008
3713#define MADERA_DSP_IRQ4_EINT1_MASK 0x0008
3714#define MADERA_DSP_IRQ4_EINT1_SHIFT 3
3715#define MADERA_DSP_IRQ4_EINT1_WIDTH 1
3716#define MADERA_DSP_IRQ3_EINT1 0x0004
3717#define MADERA_DSP_IRQ3_EINT1_MASK 0x0004
3718#define MADERA_DSP_IRQ3_EINT1_SHIFT 2
3719#define MADERA_DSP_IRQ3_EINT1_WIDTH 1
3720#define MADERA_DSP_IRQ2_EINT1 0x0002
3721#define MADERA_DSP_IRQ2_EINT1_MASK 0x0002
3722#define MADERA_DSP_IRQ2_EINT1_SHIFT 1
3723#define MADERA_DSP_IRQ2_EINT1_WIDTH 1
3724#define MADERA_DSP_IRQ1_EINT1 0x0001
3725#define MADERA_DSP_IRQ1_EINT1_MASK 0x0001
3726#define MADERA_DSP_IRQ1_EINT1_SHIFT 0
3727#define MADERA_DSP_IRQ1_EINT1_WIDTH 1
3728
3729/* (0x180B) IRQ1_Status_12 */
3730#define MADERA_SPKOUTR_SC_EINT1 0x0080
3731#define MADERA_SPKOUTR_SC_EINT1_MASK 0x0080
3732#define MADERA_SPKOUTR_SC_EINT1_SHIFT 7
3733#define MADERA_SPKOUTR_SC_EINT1_WIDTH 1
3734#define MADERA_SPKOUTL_SC_EINT1 0x0040
3735#define MADERA_SPKOUTL_SC_EINT1_MASK 0x0040
3736#define MADERA_SPKOUTL_SC_EINT1_SHIFT 6
3737#define MADERA_SPKOUTL_SC_EINT1_WIDTH 1
3738#define MADERA_HP3R_SC_EINT1 0x0020
3739#define MADERA_HP3R_SC_EINT1_MASK 0x0020
3740#define MADERA_HP3R_SC_EINT1_SHIFT 5
3741#define MADERA_HP3R_SC_EINT1_WIDTH 1
3742#define MADERA_HP3L_SC_EINT1 0x0010
3743#define MADERA_HP3L_SC_EINT1_MASK 0x0010
3744#define MADERA_HP3L_SC_EINT1_SHIFT 4
3745#define MADERA_HP3L_SC_EINT1_WIDTH 1
3746#define MADERA_HP2R_SC_EINT1 0x0008
3747#define MADERA_HP2R_SC_EINT1_MASK 0x0008
3748#define MADERA_HP2R_SC_EINT1_SHIFT 3
3749#define MADERA_HP2R_SC_EINT1_WIDTH 1
3750#define MADERA_HP2L_SC_EINT1 0x0004
3751#define MADERA_HP2L_SC_EINT1_MASK 0x0004
3752#define MADERA_HP2L_SC_EINT1_SHIFT 2
3753#define MADERA_HP2L_SC_EINT1_WIDTH 1
3754#define MADERA_HP1R_SC_EINT1 0x0002
3755#define MADERA_HP1R_SC_EINT1_MASK 0x0002
3756#define MADERA_HP1R_SC_EINT1_SHIFT 1
3757#define MADERA_HP1R_SC_EINT1_WIDTH 1
3758#define MADERA_HP1L_SC_EINT1 0x0001
3759#define MADERA_HP1L_SC_EINT1_MASK 0x0001
3760#define MADERA_HP1L_SC_EINT1_SHIFT 0
3761#define MADERA_HP1L_SC_EINT1_WIDTH 1
3762
3763/* (0x180E) IRQ1_Status_15 */
3764#define MADERA_SPK_OVERHEAT_WARN_EINT1 0x0004
3765#define MADERA_SPK_OVERHEAT_WARN_EINT1_MASK 0x0004
3766#define MADERA_SPK_OVERHEAT_WARN_EINT1_SHIFT 2
3767#define MADERA_SPK_OVERHEAT_WARN_EINT1_WIDTH 1
3768#define MADERA_SPK_OVERHEAT_EINT1 0x0002
3769#define MADERA_SPK_OVERHEAT_EINT1_MASK 0x0002
3770#define MADERA_SPK_OVERHEAT_EINT1_SHIFT 1
3771#define MADERA_SPK_OVERHEAT_EINT1_WIDTH 1
3772#define MADERA_SPK_SHUTDOWN_EINT1 0x0001
3773#define MADERA_SPK_SHUTDOWN_EINT1_MASK 0x0001
3774#define MADERA_SPK_SHUTDOWN_EINT1_SHIFT 0
3775#define MADERA_SPK_SHUTDOWN_EINT1_WIDTH 1
3776
3777/* (0x1820) - IRQ1 Status 33 */
3778#define MADERA_DSP7_BUS_ERR_EINT1 0x0040
3779#define MADERA_DSP7_BUS_ERR_EINT1_MASK 0x0040
3780#define MADERA_DSP7_BUS_ERR_EINT1_SHIFT 6
3781#define MADERA_DSP7_BUS_ERR_EINT1_WIDTH 1
3782#define MADERA_DSP6_BUS_ERR_EINT1 0x0020
3783#define MADERA_DSP6_BUS_ERR_EINT1_MASK 0x0020
3784#define MADERA_DSP6_BUS_ERR_EINT1_SHIFT 5
3785#define MADERA_DSP6_BUS_ERR_EINT1_WIDTH 1
3786#define MADERA_DSP5_BUS_ERR_EINT1 0x0010
3787#define MADERA_DSP5_BUS_ERR_EINT1_MASK 0x0010
3788#define MADERA_DSP5_BUS_ERR_EINT1_SHIFT 4
3789#define MADERA_DSP5_BUS_ERR_EINT1_WIDTH 1
3790#define MADERA_DSP4_BUS_ERR_EINT1 0x0008
3791#define MADERA_DSP4_BUS_ERR_EINT1_MASK 0x0008
3792#define MADERA_DSP4_BUS_ERR_EINT1_SHIFT 3
3793#define MADERA_DSP4_BUS_ERR_EINT1_WIDTH 1
3794#define MADERA_DSP3_BUS_ERR_EINT1 0x0004
3795#define MADERA_DSP3_BUS_ERR_EINT1_MASK 0x0004
3796#define MADERA_DSP3_BUS_ERR_EINT1_SHIFT 2
3797#define MADERA_DSP3_BUS_ERR_EINT1_WIDTH 1
3798#define MADERA_DSP2_BUS_ERR_EINT1 0x0002
3799#define MADERA_DSP2_BUS_ERR_EINT1_MASK 0x0002
3800#define MADERA_DSP2_BUS_ERR_EINT1_SHIFT 1
3801#define MADERA_DSP2_BUS_ERR_EINT1_WIDTH 1
3802#define MADERA_DSP1_BUS_ERR_EINT1 0x0001
3803#define MADERA_DSP1_BUS_ERR_EINT1_MASK 0x0001
3804#define MADERA_DSP1_BUS_ERR_EINT1_SHIFT 0
3805#define MADERA_DSP1_BUS_ERR_EINT1_WIDTH 1
3806
3807/* (0x1845) IRQ1_Mask_6 */
3808#define MADERA_IM_MICDET2_EINT1 0x0200
3809#define MADERA_IM_MICDET2_EINT1_MASK 0x0200
3810#define MADERA_IM_MICDET2_EINT1_SHIFT 9
3811#define MADERA_IM_MICDET2_EINT1_WIDTH 1
3812#define MADERA_IM_MICDET1_EINT1 0x0100
3813#define MADERA_IM_MICDET1_EINT1_MASK 0x0100
3814#define MADERA_IM_MICDET1_EINT1_SHIFT 8
3815#define MADERA_IM_MICDET1_EINT1_WIDTH 1
3816#define MADERA_IM_HPDET_EINT1 0x0001
3817#define MADERA_IM_HPDET_EINT1_MASK 0x0001
3818#define MADERA_IM_HPDET_EINT1_SHIFT 0
3819#define MADERA_IM_HPDET_EINT1_WIDTH 1
3820/* (0x184E) IRQ1_Mask_15 */
3821#define MADERA_IM_SPK_OVERHEAT_WARN_EINT1 0x0004
3822#define MADERA_IM_SPK_OVERHEAT_WARN_EINT1_MASK 0x0004
3823#define MADERA_IM_SPK_OVERHEAT_WARN_EINT1_SHIFT 2
3824#define MADERA_IM_SPK_OVERHEAT_WARN_EINT1_WIDTH 1
3825#define MADERA_IM_SPK_OVERHEAT_EINT1 0x0002
3826#define MADERA_IM_SPK_OVERHEAT_EINT1_MASK 0x0002
3827#define MADERA_IM_SPK_OVERHEAT_EINT1_SHIFT 1
3828#define MADERA_IM_SPK_OVERHEAT_EINT1_WIDTH 1
3829#define MADERA_IM_SPK_SHUTDOWN_EINT1 0x0001
3830#define MADERA_IM_SPK_SHUTDOWN_EINT1_MASK 0x0001
3831#define MADERA_IM_SPK_SHUTDOWN_EINT1_SHIFT 0
3832#define MADERA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1
3833
3834/* (0x1880) - IRQ1 Raw Status 1 */
3835#define MADERA_CTRLIF_ERR_STS1 0x1000
3836#define MADERA_CTRLIF_ERR_STS1_MASK 0x1000
3837#define MADERA_CTRLIF_ERR_STS1_SHIFT 12
3838#define MADERA_CTRLIF_ERR_STS1_WIDTH 1
3839#define MADERA_SYSCLK_FAIL_STS1 0x0200
3840#define MADERA_SYSCLK_FAIL_STS1_MASK 0x0200
3841#define MADERA_SYSCLK_FAIL_STS1_SHIFT 9
3842#define MADERA_SYSCLK_FAIL_STS1_WIDTH 1
3843#define MADERA_CLOCK_DETECT_STS1 0x0100
3844#define MADERA_CLOCK_DETECT_STS1_MASK 0x0100
3845#define MADERA_CLOCK_DETECT_STS1_SHIFT 8
3846#define MADERA_CLOCK_DETECT_STS1_WIDTH 1
3847#define MADERA_BOOT_DONE_STS1 0x0080
3848#define MADERA_BOOT_DONE_STS1_MASK 0x0080
3849#define MADERA_BOOT_DONE_STS1_SHIFT 7
3850#define MADERA_BOOT_DONE_STS1_WIDTH 1
3851
3852/* (0x1881) - IRQ1 Raw Status 2 */
3853#define MADERA_FLL3_LOCK_STS1 0x0400
3854#define MADERA_FLL3_LOCK_STS1_MASK 0x0400
3855#define MADERA_FLL3_LOCK_STS1_SHIFT 10
3856#define MADERA_FLL3_LOCK_STS1_WIDTH 1
3857#define MADERA_FLL2_LOCK_STS1 0x0200
3858#define MADERA_FLL2_LOCK_STS1_MASK 0x0200
3859#define MADERA_FLL2_LOCK_STS1_SHIFT 9
3860#define MADERA_FLL2_LOCK_STS1_WIDTH 1
3861#define MADERA_FLL1_LOCK_STS1 0x0100
3862#define MADERA_FLL1_LOCK_STS1_MASK 0x0100
3863#define MADERA_FLL1_LOCK_STS1_SHIFT 8
3864#define MADERA_FLL1_LOCK_STS1_WIDTH 1
3865
3866/* (0x1886) - IRQ1 Raw Status 7 */
3867#define MADERA_MICD_CLAMP_FALL_STS1 0x0020
3868#define MADERA_MICD_CLAMP_FALL_STS1_MASK 0x0020
3869#define MADERA_MICD_CLAMP_FALL_STS1_SHIFT 5
3870#define MADERA_MICD_CLAMP_FALL_STS1_WIDTH 1
3871#define MADERA_MICD_CLAMP_RISE_STS1 0x0010
3872#define MADERA_MICD_CLAMP_RISE_STS1_MASK 0x0010
3873#define MADERA_MICD_CLAMP_RISE_STS1_SHIFT 4
3874#define MADERA_MICD_CLAMP_RISE_STS1_WIDTH 1
3875#define MADERA_JD2_FALL_STS1 0x0008
3876#define MADERA_JD2_FALL_STS1_MASK 0x0008
3877#define MADERA_JD2_FALL_STS1_SHIFT 3
3878#define MADERA_JD2_FALL_STS1_WIDTH 1
3879#define MADERA_JD2_RISE_STS1 0x0004
3880#define MADERA_JD2_RISE_STS1_MASK 0x0004
3881#define MADERA_JD2_RISE_STS1_SHIFT 2
3882#define MADERA_JD2_RISE_STS1_WIDTH 1
3883#define MADERA_JD1_FALL_STS1 0x0002
3884#define MADERA_JD1_FALL_STS1_MASK 0x0002
3885#define MADERA_JD1_FALL_STS1_SHIFT 1
3886#define MADERA_JD1_FALL_STS1_WIDTH 1
3887#define MADERA_JD1_RISE_STS1 0x0001
3888#define MADERA_JD1_RISE_STS1_MASK 0x0001
3889#define MADERA_JD1_RISE_STS1_SHIFT 0
3890#define MADERA_JD1_RISE_STS1_WIDTH 1
3891
3892/* (0x188E) - IRQ1 Raw Status 15 */
3893#define MADERA_SPK_OVERHEAT_WARN_STS1 0x0004
3894#define MADERA_SPK_OVERHEAT_WARN_STS1_MASK 0x0004
3895#define MADERA_SPK_OVERHEAT_WARN_STS1_SHIFT 2
3896#define MADERA_SPK_OVERHEAT_WARN_STS1_WIDTH 1
3897#define MADERA_SPK_OVERHEAT_STS1 0x0002
3898#define MADERA_SPK_OVERHEAT_STS1_MASK 0x0002
3899#define MADERA_SPK_OVERHEAT_STS1_SHIFT 1
3900#define MADERA_SPK_OVERHEAT_STS1_WIDTH 1
3901#define MADERA_SPK_SHUTDOWN_STS1 0x0001
3902#define MADERA_SPK_SHUTDOWN_STS1_MASK 0x0001
3903#define MADERA_SPK_SHUTDOWN_STS1_SHIFT 0
3904#define MADERA_SPK_SHUTDOWN_STS1_WIDTH 1
3905
3906/* (0x1A06) Interrupt_Debounce_7 */
3907#define MADERA_MICD_CLAMP_DB 0x0010
3908#define MADERA_MICD_CLAMP_DB_MASK 0x0010
3909#define MADERA_MICD_CLAMP_DB_SHIFT 4
3910#define MADERA_MICD_CLAMP_DB_WIDTH 1
3911#define MADERA_JD2_DB 0x0004
3912#define MADERA_JD2_DB_MASK 0x0004
3913#define MADERA_JD2_DB_SHIFT 2
3914#define MADERA_JD2_DB_WIDTH 1
3915#define MADERA_JD1_DB 0x0001
3916#define MADERA_JD1_DB_MASK 0x0001
3917#define MADERA_JD1_DB_SHIFT 0
3918#define MADERA_JD1_DB_WIDTH 1
3919
3920/* (0x1A0E) Interrupt_Debounce_15 */
3921#define MADERA_SPK_OVERHEAT_WARN_DB 0x0004
3922#define MADERA_SPK_OVERHEAT_WARN_DB_MASK 0x0004
3923#define MADERA_SPK_OVERHEAT_WARN_DB_SHIFT 2
3924#define MADERA_SPK_OVERHEAT_WARN_DB_WIDTH 1
3925#define MADERA_SPK_OVERHEAT_DB 0x0002
3926#define MADERA_SPK_OVERHEAT_DB_MASK 0x0002
3927#define MADERA_SPK_OVERHEAT_DB_SHIFT 1
3928#define MADERA_SPK_OVERHEAT_DB_WIDTH 1
3929
3930/* (0x1A80) IRQ1_CTRL */
3931#define MADERA_IM_IRQ1 0x0800
3932#define MADERA_IM_IRQ1_MASK 0x0800
3933#define MADERA_IM_IRQ1_SHIFT 11
3934#define MADERA_IM_IRQ1_WIDTH 1
3935#define MADERA_IRQ_POL 0x0400
3936#define MADERA_IRQ_POL_MASK 0x0400
3937#define MADERA_IRQ_POL_SHIFT 10
3938#define MADERA_IRQ_POL_WIDTH 1
3939
3940/* (0x20004) OTP_HPDET_Cal_1 */
3941#define MADERA_OTP_HPDET_CALIB_OFFSET_11 0xFF000000
3942#define MADERA_OTP_HPDET_CALIB_OFFSET_11_MASK 0xFF000000
3943#define MADERA_OTP_HPDET_CALIB_OFFSET_11_SHIFT 24
3944#define MADERA_OTP_HPDET_CALIB_OFFSET_11_WIDTH 8
3945#define MADERA_OTP_HPDET_CALIB_OFFSET_10 0x00FF0000
3946#define MADERA_OTP_HPDET_CALIB_OFFSET_10_MASK 0x00FF0000
3947#define MADERA_OTP_HPDET_CALIB_OFFSET_10_SHIFT 16
3948#define MADERA_OTP_HPDET_CALIB_OFFSET_10_WIDTH 8
3949#define MADERA_OTP_HPDET_CALIB_OFFSET_01 0x0000FF00
3950#define MADERA_OTP_HPDET_CALIB_OFFSET_01_MASK 0x0000FF00
3951#define MADERA_OTP_HPDET_CALIB_OFFSET_01_SHIFT 8
3952#define MADERA_OTP_HPDET_CALIB_OFFSET_01_WIDTH 8
3953#define MADERA_OTP_HPDET_CALIB_OFFSET_00 0x000000FF
3954#define MADERA_OTP_HPDET_CALIB_OFFSET_00_MASK 0x000000FF
3955#define MADERA_OTP_HPDET_CALIB_OFFSET_00_SHIFT 0
3956#define MADERA_OTP_HPDET_CALIB_OFFSET_00_WIDTH 8
3957
3958/* (0x20006) OTP_HPDET_Cal_2 */
3959#define MADERA_OTP_HPDET_GRADIENT_1X 0x0000FF00
3960#define MADERA_OTP_HPDET_GRADIENT_1X_MASK 0x0000FF00
3961#define MADERA_OTP_HPDET_GRADIENT_1X_SHIFT 8
3962#define MADERA_OTP_HPDET_GRADIENT_1X_WIDTH 8
3963#define MADERA_OTP_HPDET_GRADIENT_0X 0x000000FF
3964#define MADERA_OTP_HPDET_GRADIENT_0X_MASK 0x000000FF
3965#define MADERA_OTP_HPDET_GRADIENT_0X_SHIFT 0
3966#define MADERA_OTP_HPDET_GRADIENT_0X_WIDTH 8
3967
3968#endif
diff --git a/include/linux/mfd/rave-sp.h b/include/linux/mfd/rave-sp.h
index fe0ce7bc59cf..11eef77ef976 100644
--- a/include/linux/mfd/rave-sp.h
+++ b/include/linux/mfd/rave-sp.h
@@ -21,6 +21,7 @@ enum rave_sp_command {
21 RAVE_SP_CMD_STATUS = 0xA0, 21 RAVE_SP_CMD_STATUS = 0xA0,
22 RAVE_SP_CMD_SW_WDT = 0xA1, 22 RAVE_SP_CMD_SW_WDT = 0xA1,
23 RAVE_SP_CMD_PET_WDT = 0xA2, 23 RAVE_SP_CMD_PET_WDT = 0xA2,
24 RAVE_SP_CMD_RMB_EEPROM = 0xA4,
24 RAVE_SP_CMD_SET_BACKLIGHT = 0xA6, 25 RAVE_SP_CMD_SET_BACKLIGHT = 0xA6,
25 RAVE_SP_CMD_RESET = 0xA7, 26 RAVE_SP_CMD_RESET = 0xA7,
26 RAVE_SP_CMD_RESET_REASON = 0xA8, 27 RAVE_SP_CMD_RESET_REASON = 0xA8,
diff --git a/include/linux/mfd/rohm-bd718x7.h b/include/linux/mfd/rohm-bd718x7.h
new file mode 100644
index 000000000000..a528747f8aed
--- /dev/null
+++ b/include/linux/mfd/rohm-bd718x7.h
@@ -0,0 +1,332 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* Copyright (C) 2018 ROHM Semiconductors */
3
4#ifndef __LINUX_MFD_BD71837_H__
5#define __LINUX_MFD_BD71837_H__
6
7#include <linux/regmap.h>
8
9enum {
10 BD71837_BUCK1 = 0,
11 BD71837_BUCK2,
12 BD71837_BUCK3,
13 BD71837_BUCK4,
14 BD71837_BUCK5,
15 BD71837_BUCK6,
16 BD71837_BUCK7,
17 BD71837_BUCK8,
18 BD71837_LDO1,
19 BD71837_LDO2,
20 BD71837_LDO3,
21 BD71837_LDO4,
22 BD71837_LDO5,
23 BD71837_LDO6,
24 BD71837_LDO7,
25 BD71837_REGULATOR_CNT,
26};
27
28#define BD71837_BUCK1_VOLTAGE_NUM 0x40
29#define BD71837_BUCK2_VOLTAGE_NUM 0x40
30#define BD71837_BUCK3_VOLTAGE_NUM 0x40
31#define BD71837_BUCK4_VOLTAGE_NUM 0x40
32
33#define BD71837_BUCK5_VOLTAGE_NUM 0x08
34#define BD71837_BUCK6_VOLTAGE_NUM 0x04
35#define BD71837_BUCK7_VOLTAGE_NUM 0x08
36#define BD71837_BUCK8_VOLTAGE_NUM 0x40
37
38#define BD71837_LDO1_VOLTAGE_NUM 0x04
39#define BD71837_LDO2_VOLTAGE_NUM 0x02
40#define BD71837_LDO3_VOLTAGE_NUM 0x10
41#define BD71837_LDO4_VOLTAGE_NUM 0x10
42#define BD71837_LDO5_VOLTAGE_NUM 0x10
43#define BD71837_LDO6_VOLTAGE_NUM 0x10
44#define BD71837_LDO7_VOLTAGE_NUM 0x10
45
46enum {
47 BD71837_REG_REV = 0x00,
48 BD71837_REG_SWRESET = 0x01,
49 BD71837_REG_I2C_DEV = 0x02,
50 BD71837_REG_PWRCTRL0 = 0x03,
51 BD71837_REG_PWRCTRL1 = 0x04,
52 BD71837_REG_BUCK1_CTRL = 0x05,
53 BD71837_REG_BUCK2_CTRL = 0x06,
54 BD71837_REG_BUCK3_CTRL = 0x07,
55 BD71837_REG_BUCK4_CTRL = 0x08,
56 BD71837_REG_BUCK5_CTRL = 0x09,
57 BD71837_REG_BUCK6_CTRL = 0x0A,
58 BD71837_REG_BUCK7_CTRL = 0x0B,
59 BD71837_REG_BUCK8_CTRL = 0x0C,
60 BD71837_REG_BUCK1_VOLT_RUN = 0x0D,
61 BD71837_REG_BUCK1_VOLT_IDLE = 0x0E,
62 BD71837_REG_BUCK1_VOLT_SUSP = 0x0F,
63 BD71837_REG_BUCK2_VOLT_RUN = 0x10,
64 BD71837_REG_BUCK2_VOLT_IDLE = 0x11,
65 BD71837_REG_BUCK3_VOLT_RUN = 0x12,
66 BD71837_REG_BUCK4_VOLT_RUN = 0x13,
67 BD71837_REG_BUCK5_VOLT = 0x14,
68 BD71837_REG_BUCK6_VOLT = 0x15,
69 BD71837_REG_BUCK7_VOLT = 0x16,
70 BD71837_REG_BUCK8_VOLT = 0x17,
71 BD71837_REG_LDO1_VOLT = 0x18,
72 BD71837_REG_LDO2_VOLT = 0x19,
73 BD71837_REG_LDO3_VOLT = 0x1A,
74 BD71837_REG_LDO4_VOLT = 0x1B,
75 BD71837_REG_LDO5_VOLT = 0x1C,
76 BD71837_REG_LDO6_VOLT = 0x1D,
77 BD71837_REG_LDO7_VOLT = 0x1E,
78 BD71837_REG_TRANS_COND0 = 0x1F,
79 BD71837_REG_TRANS_COND1 = 0x20,
80 BD71837_REG_VRFAULTEN = 0x21,
81 BD71837_REG_MVRFLTMASK0 = 0x22,
82 BD71837_REG_MVRFLTMASK1 = 0x23,
83 BD71837_REG_MVRFLTMASK2 = 0x24,
84 BD71837_REG_RCVCFG = 0x25,
85 BD71837_REG_RCVNUM = 0x26,
86 BD71837_REG_PWRONCONFIG0 = 0x27,
87 BD71837_REG_PWRONCONFIG1 = 0x28,
88 BD71837_REG_RESETSRC = 0x29,
89 BD71837_REG_MIRQ = 0x2A,
90 BD71837_REG_IRQ = 0x2B,
91 BD71837_REG_IN_MON = 0x2C,
92 BD71837_REG_POW_STATE = 0x2D,
93 BD71837_REG_OUT32K = 0x2E,
94 BD71837_REG_REGLOCK = 0x2F,
95 BD71837_REG_OTPVER = 0xFF,
96 BD71837_MAX_REGISTER = 0x100,
97};
98
99#define REGLOCK_PWRSEQ 0x1
100#define REGLOCK_VREG 0x10
101
102/* Generic BUCK control masks */
103#define BD71837_BUCK_SEL 0x02
104#define BD71837_BUCK_EN 0x01
105#define BD71837_BUCK_RUN_ON 0x04
106
107/* Generic LDO masks */
108#define BD71837_LDO_SEL 0x80
109#define BD71837_LDO_EN 0x40
110
111/* BD71837 BUCK ramp rate CTRL reg bits */
112#define BUCK_RAMPRATE_MASK 0xC0
113#define BUCK_RAMPRATE_10P00MV 0x0
114#define BUCK_RAMPRATE_5P00MV 0x1
115#define BUCK_RAMPRATE_2P50MV 0x2
116#define BUCK_RAMPRATE_1P25MV 0x3
117
118/* BD71837_REG_BUCK1_VOLT_RUN bits */
119#define BUCK1_RUN_MASK 0x3F
120#define BUCK1_RUN_DEFAULT 0x14
121
122/* BD71837_REG_BUCK1_VOLT_SUSP bits */
123#define BUCK1_SUSP_MASK 0x3F
124#define BUCK1_SUSP_DEFAULT 0x14
125
126/* BD71837_REG_BUCK1_VOLT_IDLE bits */
127#define BUCK1_IDLE_MASK 0x3F
128#define BUCK1_IDLE_DEFAULT 0x14
129
130/* BD71837_REG_BUCK2_VOLT_RUN bits */
131#define BUCK2_RUN_MASK 0x3F
132#define BUCK2_RUN_DEFAULT 0x1E
133
134/* BD71837_REG_BUCK2_VOLT_IDLE bits */
135#define BUCK2_IDLE_MASK 0x3F
136#define BUCK2_IDLE_DEFAULT 0x14
137
138/* BD71837_REG_BUCK3_VOLT_RUN bits */
139#define BUCK3_RUN_MASK 0x3F
140#define BUCK3_RUN_DEFAULT 0x1E
141
142/* BD71837_REG_BUCK4_VOLT_RUN bits */
143#define BUCK4_RUN_MASK 0x3F
144#define BUCK4_RUN_DEFAULT 0x1E
145
146/* BD71837_REG_BUCK5_VOLT bits */
147#define BUCK5_MASK 0x07
148#define BUCK5_DEFAULT 0x02
149
150/* BD71837_REG_BUCK6_VOLT bits */
151#define BUCK6_MASK 0x03
152#define BUCK6_DEFAULT 0x03
153
154/* BD71837_REG_BUCK7_VOLT bits */
155#define BUCK7_MASK 0x07
156#define BUCK7_DEFAULT 0x03
157
158/* BD71837_REG_BUCK8_VOLT bits */
159#define BUCK8_MASK 0x3F
160#define BUCK8_DEFAULT 0x1E
161
162/* BD71837_REG_IRQ bits */
163#define IRQ_SWRST 0x40
164#define IRQ_PWRON_S 0x20
165#define IRQ_PWRON_L 0x10
166#define IRQ_PWRON 0x08
167#define IRQ_WDOG 0x04
168#define IRQ_ON_REQ 0x02
169#define IRQ_STBY_REQ 0x01
170
171/* BD71837_REG_OUT32K bits */
172#define BD71837_OUT32K_EN 0x01
173
174/* BD71837 gated clock rate */
175#define BD71837_CLK_RATE 32768
176
177/* ROHM BD71837 irqs */
178enum {
179 BD71837_INT_STBY_REQ,
180 BD71837_INT_ON_REQ,
181 BD71837_INT_WDOG,
182 BD71837_INT_PWRBTN,
183 BD71837_INT_PWRBTN_L,
184 BD71837_INT_PWRBTN_S,
185 BD71837_INT_SWRST
186};
187
188/* ROHM BD71837 interrupt masks */
189#define BD71837_INT_SWRST_MASK 0x40
190#define BD71837_INT_PWRBTN_S_MASK 0x20
191#define BD71837_INT_PWRBTN_L_MASK 0x10
192#define BD71837_INT_PWRBTN_MASK 0x8
193#define BD71837_INT_WDOG_MASK 0x4
194#define BD71837_INT_ON_REQ_MASK 0x2
195#define BD71837_INT_STBY_REQ_MASK 0x1
196
197/* BD71837_REG_LDO1_VOLT bits */
198#define LDO1_MASK 0x03
199
200/* BD71837_REG_LDO1_VOLT bits */
201#define LDO2_MASK 0x20
202
203/* BD71837_REG_LDO3_VOLT bits */
204#define LDO3_MASK 0x0F
205
206/* BD71837_REG_LDO4_VOLT bits */
207#define LDO4_MASK 0x0F
208
209/* BD71837_REG_LDO5_VOLT bits */
210#define LDO5_MASK 0x0F
211
212/* BD71837_REG_LDO6_VOLT bits */
213#define LDO6_MASK 0x0F
214
215/* BD71837_REG_LDO7_VOLT bits */
216#define LDO7_MASK 0x0F
217
218/* Register write induced reset settings */
219
220/*
221 * Even though the bit zero is not SWRESET type we still want to write zero
222 * to it when changing type. Bit zero is 'SWRESET' trigger bit and if we
223 * write 1 to it we will trigger the action. So always write 0 to it when
224 * changning SWRESET action - no matter what we read from it.
225 */
226#define BD71837_SWRESET_TYPE_MASK 7
227#define BD71837_SWRESET_TYPE_DISABLED 0
228#define BD71837_SWRESET_TYPE_COLD 4
229#define BD71837_SWRESET_TYPE_WARM 6
230
231#define BD71837_SWRESET_RESET_MASK 1
232#define BD71837_SWRESET_RESET 1
233
234/* Poweroff state transition conditions */
235
236#define BD718XX_ON_REQ_POWEROFF_MASK 1
237#define BD718XX_SWRESET_POWEROFF_MASK 2
238#define BD718XX_WDOG_POWEROFF_MASK 4
239#define BD718XX_KEY_L_POWEROFF_MASK 8
240
241#define BD718XX_POWOFF_TO_SNVS 0
242#define BD718XX_POWOFF_TO_RDY 0xF
243
244#define BD718XX_POWOFF_TIME_MASK 0xF0
245enum {
246 BD718XX_POWOFF_TIME_5MS = 0,
247 BD718XX_POWOFF_TIME_10MS,
248 BD718XX_POWOFF_TIME_15MS,
249 BD718XX_POWOFF_TIME_20MS,
250 BD718XX_POWOFF_TIME_25MS,
251 BD718XX_POWOFF_TIME_30MS,
252 BD718XX_POWOFF_TIME_35MS,
253 BD718XX_POWOFF_TIME_40MS,
254 BD718XX_POWOFF_TIME_45MS,
255 BD718XX_POWOFF_TIME_50MS,
256 BD718XX_POWOFF_TIME_75MS,
257 BD718XX_POWOFF_TIME_100MS,
258 BD718XX_POWOFF_TIME_250MS,
259 BD718XX_POWOFF_TIME_500MS,
260 BD718XX_POWOFF_TIME_750MS,
261 BD718XX_POWOFF_TIME_1500MS
262};
263
264/* Poweron sequence state transition conditions */
265#define BD718XX_RDY_TO_SNVS_MASK 0xF
266#define BD718XX_SNVS_TO_RUN_MASK 0xF0
267
268#define BD718XX_PWR_TRIG_KEY_L 1
269#define BD718XX_PWR_TRIG_KEY_S 2
270#define BD718XX_PWR_TRIG_PMIC_ON 4
271#define BD718XX_PWR_TRIG_VSYS_UVLO 8
272#define BD718XX_RDY_TO_SNVS_SIFT 0
273#define BD718XX_SNVS_TO_RUN_SIFT 4
274
275#define BD718XX_PWRBTN_PRESS_DURATION_MASK 0xF
276
277/* Timeout value for detecting short press */
278enum {
279 BD718XX_PWRBTN_SHORT_PRESS_10MS = 0,
280 BD718XX_PWRBTN_SHORT_PRESS_500MS,
281 BD718XX_PWRBTN_SHORT_PRESS_1000MS,
282 BD718XX_PWRBTN_SHORT_PRESS_1500MS,
283 BD718XX_PWRBTN_SHORT_PRESS_2000MS,
284 BD718XX_PWRBTN_SHORT_PRESS_2500MS,
285 BD718XX_PWRBTN_SHORT_PRESS_3000MS,
286 BD718XX_PWRBTN_SHORT_PRESS_3500MS,
287 BD718XX_PWRBTN_SHORT_PRESS_4000MS,
288 BD718XX_PWRBTN_SHORT_PRESS_4500MS,
289 BD718XX_PWRBTN_SHORT_PRESS_5000MS,
290 BD718XX_PWRBTN_SHORT_PRESS_5500MS,
291 BD718XX_PWRBTN_SHORT_PRESS_6000MS,
292 BD718XX_PWRBTN_SHORT_PRESS_6500MS,
293 BD718XX_PWRBTN_SHORT_PRESS_7000MS,
294 BD718XX_PWRBTN_SHORT_PRESS_7500MS
295};
296
297/* Timeout value for detecting LONG press */
298enum {
299 BD718XX_PWRBTN_LONG_PRESS_10MS = 0,
300 BD718XX_PWRBTN_LONG_PRESS_1S,
301 BD718XX_PWRBTN_LONG_PRESS_2S,
302 BD718XX_PWRBTN_LONG_PRESS_3S,
303 BD718XX_PWRBTN_LONG_PRESS_4S,
304 BD718XX_PWRBTN_LONG_PRESS_5S,
305 BD718XX_PWRBTN_LONG_PRESS_6S,
306 BD718XX_PWRBTN_LONG_PRESS_7S,
307 BD718XX_PWRBTN_LONG_PRESS_8S,
308 BD718XX_PWRBTN_LONG_PRESS_9S,
309 BD718XX_PWRBTN_LONG_PRESS_10S,
310 BD718XX_PWRBTN_LONG_PRESS_11S,
311 BD718XX_PWRBTN_LONG_PRESS_12S,
312 BD718XX_PWRBTN_LONG_PRESS_13S,
313 BD718XX_PWRBTN_LONG_PRESS_14S,
314 BD718XX_PWRBTN_LONG_PRESS_15S
315};
316
317struct bd71837_pmic;
318struct bd71837_clk;
319
320struct bd71837 {
321 struct device *dev;
322 struct regmap *regmap;
323 unsigned long int id;
324
325 int chip_irq;
326 struct regmap_irq_chip_data *irq_data;
327
328 struct bd71837_pmic *pmic;
329 struct bd71837_clk *clk;
330};
331
332#endif /* __LINUX_MFD_BD71837_H__ */
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index e06f5f79eaef..6c1ad160ed87 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -457,4 +457,7 @@
457#define MCLK_DIR(x) (x == 1 ? IMX6UL_GPR1_SAI1_MCLK_DIR : x == 2 ? \ 457#define MCLK_DIR(x) (x == 1 ? IMX6UL_GPR1_SAI1_MCLK_DIR : x == 2 ? \
458 IMX6UL_GPR1_SAI2_MCLK_DIR : IMX6UL_GPR1_SAI3_MCLK_DIR) 458 IMX6UL_GPR1_SAI2_MCLK_DIR : IMX6UL_GPR1_SAI3_MCLK_DIR)
459 459
460/* For imx6sll iomux gpr register field define */
461#define IMX6SLL_GPR5_AFCG_X_BYPASS_MASK (0x1f << 11)
462
460#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ 463#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 91f92215ca74..77866214ab51 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -90,6 +90,9 @@
90/* Some controllers have a CBSY bit */ 90/* Some controllers have a CBSY bit */
91#define TMIO_MMC_HAVE_CBSY BIT(11) 91#define TMIO_MMC_HAVE_CBSY BIT(11)
92 92
93/* Some controllers that support HS400 use use 4 taps while others use 8. */
94#define TMIO_MMC_HAVE_4TAP_HS400 BIT(13)
95
93int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 96int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
94int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 97int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
95void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 98void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 90c60524a496..b19c370fe81a 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -222,6 +222,12 @@ struct wm8994_pdata {
222 */ 222 */
223 bool spkmode_pu; 223 bool spkmode_pu;
224 224
225 /*
226 * CS/ADDR must be pulled internally by the device on this
227 * system.
228 */
229 bool csnaddr_pd;
230
225 /** 231 /**
226 * Maximum number of channels clocks will be generated for, 232 * Maximum number of channels clocks will be generated for,
227 * useful for systems where and I2S bus with multiple data 233 * useful for systems where and I2S bus with multiple data
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 122e7e9d3091..dca6ab4eaa99 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -630,6 +630,7 @@ struct mlx4_caps {
630 u32 vf_caps; 630 u32 vf_caps;
631 bool wol_port[MLX4_MAX_PORTS + 1]; 631 bool wol_port[MLX4_MAX_PORTS + 1];
632 struct mlx4_rate_limit_caps rl_caps; 632 struct mlx4_rate_limit_caps rl_caps;
633 u32 health_buffer_addrs;
633}; 634};
634 635
635struct mlx4_buf_list { 636struct mlx4_buf_list {
@@ -851,6 +852,12 @@ struct mlx4_vf_dev {
851 u8 n_ports; 852 u8 n_ports;
852}; 853};
853 854
855struct mlx4_fw_crdump {
856 bool snapshot_enable;
857 struct devlink_region *region_crspace;
858 struct devlink_region *region_fw_health;
859};
860
854enum mlx4_pci_status { 861enum mlx4_pci_status {
855 MLX4_PCI_STATUS_DISABLED, 862 MLX4_PCI_STATUS_DISABLED,
856 MLX4_PCI_STATUS_ENABLED, 863 MLX4_PCI_STATUS_ENABLED,
@@ -871,6 +878,7 @@ struct mlx4_dev_persistent {
871 u8 interface_state; 878 u8 interface_state;
872 struct mutex pci_status_mutex; /* sync pci state */ 879 struct mutex pci_status_mutex; /* sync pci state */
873 enum mlx4_pci_status pci_status; 880 enum mlx4_pci_status pci_status;
881 struct mlx4_fw_crdump crdump;
874}; 882};
875 883
876struct mlx4_dev { 884struct mlx4_dev {
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 02f72ebf31a7..11fa4e66afc5 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -332,6 +332,13 @@ enum mlx5_event {
332 332
333 MLX5_EVENT_TYPE_FPGA_ERROR = 0x20, 333 MLX5_EVENT_TYPE_FPGA_ERROR = 0x20,
334 MLX5_EVENT_TYPE_FPGA_QP_ERROR = 0x21, 334 MLX5_EVENT_TYPE_FPGA_QP_ERROR = 0x21,
335
336 MLX5_EVENT_TYPE_DEVICE_TRACER = 0x26,
337};
338
339enum {
340 MLX5_TRACER_SUBTYPE_OWNERSHIP_CHANGE = 0x0,
341 MLX5_TRACER_SUBTYPE_TRACES_AVAILABLE = 0x1,
335}; 342};
336 343
337enum { 344enum {
@@ -750,7 +757,7 @@ enum {
750 757
751#define MLX5_MINI_CQE_ARRAY_SIZE 8 758#define MLX5_MINI_CQE_ARRAY_SIZE 8
752 759
753static inline int mlx5_get_cqe_format(struct mlx5_cqe64 *cqe) 760static inline u8 mlx5_get_cqe_format(struct mlx5_cqe64 *cqe)
754{ 761{
755 return (cqe->op_own >> 2) & 0x3; 762 return (cqe->op_own >> 2) & 0x3;
756} 763}
@@ -770,14 +777,14 @@ static inline u8 get_cqe_l3_hdr_type(struct mlx5_cqe64 *cqe)
770 return (cqe->l4_l3_hdr_type >> 2) & 0x3; 777 return (cqe->l4_l3_hdr_type >> 2) & 0x3;
771} 778}
772 779
773static inline u8 cqe_is_tunneled(struct mlx5_cqe64 *cqe) 780static inline bool cqe_is_tunneled(struct mlx5_cqe64 *cqe)
774{ 781{
775 return cqe->outer_l3_tunneled & 0x1; 782 return cqe->outer_l3_tunneled & 0x1;
776} 783}
777 784
778static inline int cqe_has_vlan(struct mlx5_cqe64 *cqe) 785static inline bool cqe_has_vlan(struct mlx5_cqe64 *cqe)
779{ 786{
780 return !!(cqe->l4_l3_hdr_type & 0x1); 787 return cqe->l4_l3_hdr_type & 0x1;
781} 788}
782 789
783static inline u64 get_cqe_ts(struct mlx5_cqe64 *cqe) 790static inline u64 get_cqe_ts(struct mlx5_cqe64 *cqe)
@@ -939,9 +946,9 @@ enum {
939}; 946};
940 947
941enum { 948enum {
942 MLX5_ESW_VPORT_ADMIN_STATE_DOWN = 0x0, 949 MLX5_VPORT_ADMIN_STATE_DOWN = 0x0,
943 MLX5_ESW_VPORT_ADMIN_STATE_UP = 0x1, 950 MLX5_VPORT_ADMIN_STATE_UP = 0x1,
944 MLX5_ESW_VPORT_ADMIN_STATE_AUTO = 0x2, 951 MLX5_VPORT_ADMIN_STATE_AUTO = 0x2,
945}; 952};
946 953
947enum { 954enum {
@@ -1071,6 +1078,9 @@ enum mlx5_qcam_feature_groups {
1071#define MLX5_CAP_GEN(mdev, cap) \ 1078#define MLX5_CAP_GEN(mdev, cap) \
1072 MLX5_GET(cmd_hca_cap, mdev->caps.hca_cur[MLX5_CAP_GENERAL], cap) 1079 MLX5_GET(cmd_hca_cap, mdev->caps.hca_cur[MLX5_CAP_GENERAL], cap)
1073 1080
1081#define MLX5_CAP_GEN_64(mdev, cap) \
1082 MLX5_GET64(cmd_hca_cap, mdev->caps.hca_cur[MLX5_CAP_GENERAL], cap)
1083
1074#define MLX5_CAP_GEN_MAX(mdev, cap) \ 1084#define MLX5_CAP_GEN_MAX(mdev, cap) \
1075 MLX5_GET(cmd_hca_cap, mdev->caps.hca_max[MLX5_CAP_GENERAL], cap) 1085 MLX5_GET(cmd_hca_cap, mdev->caps.hca_max[MLX5_CAP_GENERAL], cap)
1076 1086
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 83957920653a..7a452716de4b 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -138,9 +138,14 @@ enum {
138 MLX5_REG_HOST_ENDIANNESS = 0x7004, 138 MLX5_REG_HOST_ENDIANNESS = 0x7004,
139 MLX5_REG_MCIA = 0x9014, 139 MLX5_REG_MCIA = 0x9014,
140 MLX5_REG_MLCR = 0x902b, 140 MLX5_REG_MLCR = 0x902b,
141 MLX5_REG_MTRC_CAP = 0x9040,
142 MLX5_REG_MTRC_CONF = 0x9041,
143 MLX5_REG_MTRC_STDB = 0x9042,
144 MLX5_REG_MTRC_CTRL = 0x9043,
141 MLX5_REG_MPCNT = 0x9051, 145 MLX5_REG_MPCNT = 0x9051,
142 MLX5_REG_MTPPS = 0x9053, 146 MLX5_REG_MTPPS = 0x9053,
143 MLX5_REG_MTPPSE = 0x9054, 147 MLX5_REG_MTPPSE = 0x9054,
148 MLX5_REG_MPEGC = 0x9056,
144 MLX5_REG_MCQI = 0x9061, 149 MLX5_REG_MCQI = 0x9061,
145 MLX5_REG_MCC = 0x9062, 150 MLX5_REG_MCC = 0x9062,
146 MLX5_REG_MCDA = 0x9063, 151 MLX5_REG_MCDA = 0x9063,
@@ -812,6 +817,9 @@ struct mlx5_clock {
812 struct mlx5_pps pps_info; 817 struct mlx5_pps pps_info;
813}; 818};
814 819
820struct mlx5_fw_tracer;
821struct mlx5_vxlan;
822
815struct mlx5_core_dev { 823struct mlx5_core_dev {
816 struct pci_dev *pdev; 824 struct pci_dev *pdev;
817 /* sync pci state */ 825 /* sync pci state */
@@ -843,6 +851,7 @@ struct mlx5_core_dev {
843 atomic_t num_qps; 851 atomic_t num_qps;
844 u32 issi; 852 u32 issi;
845 struct mlx5e_resources mlx5e_res; 853 struct mlx5e_resources mlx5e_res;
854 struct mlx5_vxlan *vxlan;
846 struct { 855 struct {
847 struct mlx5_rsvd_gids reserved_gids; 856 struct mlx5_rsvd_gids reserved_gids;
848 u32 roce_en; 857 u32 roce_en;
@@ -856,6 +865,7 @@ struct mlx5_core_dev {
856 struct mlx5_clock clock; 865 struct mlx5_clock clock;
857 struct mlx5_ib_clock_info *clock_info; 866 struct mlx5_ib_clock_info *clock_info;
858 struct page *clock_info_page; 867 struct page *clock_info_page;
868 struct mlx5_fw_tracer *tracer;
859}; 869};
860 870
861struct mlx5_db { 871struct mlx5_db {
@@ -1079,8 +1089,6 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev,
1079 struct mlx5_core_mkey *mkey); 1089 struct mlx5_core_mkey *mkey);
1080int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey, 1090int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey,
1081 u32 *out, int outlen); 1091 u32 *out, int outlen);
1082int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *_mkey,
1083 u32 *mkey);
1084int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn); 1092int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
1085int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); 1093int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn);
1086int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb, 1094int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb,
@@ -1227,14 +1235,11 @@ struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
1227{ 1235{
1228 return ERR_PTR(-EOPNOTSUPP); 1236 return ERR_PTR(-EOPNOTSUPP);
1229} 1237}
1230
1231static inline void mlx5_rdma_netdev_free(struct net_device *netdev) {}
1232#else 1238#else
1233struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev, 1239struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
1234 struct ib_device *ibdev, 1240 struct ib_device *ibdev,
1235 const char *name, 1241 const char *name,
1236 void (*setup)(struct net_device *)); 1242 void (*setup)(struct net_device *));
1237void mlx5_rdma_netdev_free(struct net_device *netdev);
1238#endif /* CONFIG_MLX5_CORE_IPOIB */ 1243#endif /* CONFIG_MLX5_CORE_IPOIB */
1239 1244
1240struct mlx5_profile { 1245struct mlx5_profile {
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 757b4a30281e..804516e4f483 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -89,6 +89,7 @@ struct mlx5_flow_destination {
89 enum mlx5_flow_destination_type type; 89 enum mlx5_flow_destination_type type;
90 union { 90 union {
91 u32 tir_num; 91 u32 tir_num;
92 u32 ft_num;
92 struct mlx5_flow_table *ft; 93 struct mlx5_flow_table *ft;
93 struct mlx5_fc *counter; 94 struct mlx5_fc *counter;
94 struct { 95 struct {
@@ -152,6 +153,8 @@ struct mlx5_fs_vlan {
152 u8 prio; 153 u8 prio;
153}; 154};
154 155
156#define MLX5_FS_VLAN_DEPTH 2
157
155struct mlx5_flow_act { 158struct mlx5_flow_act {
156 u32 action; 159 u32 action;
157 bool has_flow_tag; 160 bool has_flow_tag;
@@ -159,7 +162,7 @@ struct mlx5_flow_act {
159 u32 encap_id; 162 u32 encap_id;
160 u32 modify_id; 163 u32 modify_id;
161 uintptr_t esp_id; 164 uintptr_t esp_id;
162 struct mlx5_fs_vlan vlan; 165 struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH];
163 struct ib_counters *counters; 166 struct ib_counters *counters;
164}; 167};
165 168
@@ -175,7 +178,7 @@ mlx5_add_flow_rules(struct mlx5_flow_table *ft,
175 struct mlx5_flow_spec *spec, 178 struct mlx5_flow_spec *spec,
176 struct mlx5_flow_act *flow_act, 179 struct mlx5_flow_act *flow_act,
177 struct mlx5_flow_destination *dest, 180 struct mlx5_flow_destination *dest,
178 int dest_num); 181 int num_dest);
179void mlx5_del_flow_rules(struct mlx5_flow_handle *fr); 182void mlx5_del_flow_rules(struct mlx5_flow_handle *fr);
180 183
181int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler, 184int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler,
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index ac281f5ec9b8..f043d65b9bac 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -76,6 +76,16 @@ enum {
76}; 76};
77 77
78enum { 78enum {
79 MLX5_GENERAL_OBJ_TYPES_CAP_UCTX = (1ULL << 4),
80 MLX5_GENERAL_OBJ_TYPES_CAP_UMEM = (1ULL << 5),
81};
82
83enum {
84 MLX5_OBJ_TYPE_UCTX = 0x0004,
85 MLX5_OBJ_TYPE_UMEM = 0x0005,
86};
87
88enum {
79 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100, 89 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
80 MLX5_CMD_OP_QUERY_ADAPTER = 0x101, 90 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
81 MLX5_CMD_OP_INIT_HCA = 0x102, 91 MLX5_CMD_OP_INIT_HCA = 0x102,
@@ -237,11 +247,16 @@ enum {
237 MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e, 247 MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e,
238 MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940, 248 MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940,
239 MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941, 249 MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941,
250 MLX5_CMD_OP_QUERY_MODIFY_HEADER_CONTEXT = 0x942,
240 MLX5_CMD_OP_FPGA_CREATE_QP = 0x960, 251 MLX5_CMD_OP_FPGA_CREATE_QP = 0x960,
241 MLX5_CMD_OP_FPGA_MODIFY_QP = 0x961, 252 MLX5_CMD_OP_FPGA_MODIFY_QP = 0x961,
242 MLX5_CMD_OP_FPGA_QUERY_QP = 0x962, 253 MLX5_CMD_OP_FPGA_QUERY_QP = 0x962,
243 MLX5_CMD_OP_FPGA_DESTROY_QP = 0x963, 254 MLX5_CMD_OP_FPGA_DESTROY_QP = 0x963,
244 MLX5_CMD_OP_FPGA_QUERY_QP_COUNTERS = 0x964, 255 MLX5_CMD_OP_FPGA_QUERY_QP_COUNTERS = 0x964,
256 MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00,
257 MLX5_CMD_OP_MODIFY_GENERAL_OBJECT = 0xa01,
258 MLX5_CMD_OP_QUERY_GENERAL_OBJECT = 0xa02,
259 MLX5_CMD_OP_DESTROY_GENERAL_OBJECT = 0xa03,
245 MLX5_CMD_OP_MAX 260 MLX5_CMD_OP_MAX
246}; 261};
247 262
@@ -326,7 +341,10 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
326 u8 reserved_at_9[0x1]; 341 u8 reserved_at_9[0x1];
327 u8 pop_vlan[0x1]; 342 u8 pop_vlan[0x1];
328 u8 push_vlan[0x1]; 343 u8 push_vlan[0x1];
329 u8 reserved_at_c[0x14]; 344 u8 reserved_at_c[0x1];
345 u8 pop_vlan_2[0x1];
346 u8 push_vlan_2[0x1];
347 u8 reserved_at_f[0x11];
330 348
331 u8 reserved_at_20[0x2]; 349 u8 reserved_at_20[0x2];
332 u8 log_max_ft_size[0x6]; 350 u8 log_max_ft_size[0x6];
@@ -654,7 +672,9 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {
654 u8 swp[0x1]; 672 u8 swp[0x1];
655 u8 swp_csum[0x1]; 673 u8 swp_csum[0x1];
656 u8 swp_lso[0x1]; 674 u8 swp_lso[0x1];
657 u8 reserved_at_23[0x1b]; 675 u8 reserved_at_23[0xd];
676 u8 max_vxlan_udp_ports[0x8];
677 u8 reserved_at_38[0x6];
658 u8 max_geneve_opt_len[0x1]; 678 u8 max_geneve_opt_len[0x1];
659 u8 tunnel_stateless_geneve_rx[0x1]; 679 u8 tunnel_stateless_geneve_rx[0x1];
660 680
@@ -874,7 +894,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
874 u8 log_max_eq_sz[0x8]; 894 u8 log_max_eq_sz[0x8];
875 u8 reserved_at_e8[0x2]; 895 u8 reserved_at_e8[0x2];
876 u8 log_max_mkey[0x6]; 896 u8 log_max_mkey[0x6];
877 u8 reserved_at_f0[0xc]; 897 u8 reserved_at_f0[0x8];
898 u8 dump_fill_mkey[0x1];
899 u8 reserved_at_f9[0x3];
878 u8 log_max_eq[0x4]; 900 u8 log_max_eq[0x4];
879 901
880 u8 max_indirection[0x8]; 902 u8 max_indirection[0x8];
@@ -1113,7 +1135,12 @@ struct mlx5_ifc_cmd_hca_cap_bits {
1113 u8 reserved_at_3f8[0x3]; 1135 u8 reserved_at_3f8[0x3];
1114 u8 log_max_current_uc_list[0x5]; 1136 u8 log_max_current_uc_list[0x5];
1115 1137
1116 u8 reserved_at_400[0x80]; 1138 u8 general_obj_types[0x40];
1139
1140 u8 reserved_at_440[0x20];
1141
1142 u8 reserved_at_460[0x10];
1143 u8 max_num_eqs[0x10];
1117 1144
1118 u8 reserved_at_480[0x3]; 1145 u8 reserved_at_480[0x3];
1119 u8 log_max_l2_table[0x5]; 1146 u8 log_max_l2_table[0x5];
@@ -1162,6 +1189,7 @@ enum mlx5_flow_destination_type {
1162 1189
1163 MLX5_FLOW_DESTINATION_TYPE_PORT = 0x99, 1190 MLX5_FLOW_DESTINATION_TYPE_PORT = 0x99,
1164 MLX5_FLOW_DESTINATION_TYPE_COUNTER = 0x100, 1191 MLX5_FLOW_DESTINATION_TYPE_COUNTER = 0x100,
1192 MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM = 0x101,
1165}; 1193};
1166 1194
1167struct mlx5_ifc_dest_format_struct_bits { 1195struct mlx5_ifc_dest_format_struct_bits {
@@ -1668,7 +1696,11 @@ struct mlx5_ifc_eth_extended_cntrs_grp_data_layout_bits {
1668 1696
1669 u8 rx_buffer_full_low[0x20]; 1697 u8 rx_buffer_full_low[0x20];
1670 1698
1671 u8 reserved_at_1c0[0x600]; 1699 u8 rx_icrc_encapsulated_high[0x20];
1700
1701 u8 rx_icrc_encapsulated_low[0x20];
1702
1703 u8 reserved_at_200[0x5c0];
1672}; 1704};
1673 1705
1674struct mlx5_ifc_eth_3635_cntrs_grp_data_layout_bits { 1706struct mlx5_ifc_eth_3635_cntrs_grp_data_layout_bits {
@@ -2367,6 +2399,8 @@ enum {
2367 MLX5_FLOW_CONTEXT_ACTION_MOD_HDR = 0x40, 2399 MLX5_FLOW_CONTEXT_ACTION_MOD_HDR = 0x40,
2368 MLX5_FLOW_CONTEXT_ACTION_VLAN_POP = 0x80, 2400 MLX5_FLOW_CONTEXT_ACTION_VLAN_POP = 0x80,
2369 MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH = 0x100, 2401 MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH = 0x100,
2402 MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2 = 0x400,
2403 MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 = 0x800,
2370}; 2404};
2371 2405
2372struct mlx5_ifc_vlan_bits { 2406struct mlx5_ifc_vlan_bits {
@@ -2397,7 +2431,9 @@ struct mlx5_ifc_flow_context_bits {
2397 2431
2398 u8 modify_header_id[0x20]; 2432 u8 modify_header_id[0x20];
2399 2433
2400 u8 reserved_at_100[0x100]; 2434 struct mlx5_ifc_vlan_bits push_vlan_2;
2435
2436 u8 reserved_at_120[0xe0];
2401 2437
2402 struct mlx5_ifc_fte_match_param_bits match_value; 2438 struct mlx5_ifc_fte_match_param_bits match_value;
2403 2439
@@ -3733,8 +3769,8 @@ struct mlx5_ifc_query_vport_state_out_bits {
3733}; 3769};
3734 3770
3735enum { 3771enum {
3736 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT = 0x0, 3772 MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT = 0x0,
3737 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT = 0x1, 3773 MLX5_VPORT_STATE_OP_MOD_ESW_VPORT = 0x1,
3738}; 3774};
3739 3775
3740struct mlx5_ifc_query_vport_state_in_bits { 3776struct mlx5_ifc_query_vport_state_in_bits {
@@ -8030,9 +8066,23 @@ struct mlx5_ifc_peir_reg_bits {
8030 u8 error_type[0x8]; 8066 u8 error_type[0x8];
8031}; 8067};
8032 8068
8033struct mlx5_ifc_pcam_enhanced_features_bits { 8069struct mlx5_ifc_mpegc_reg_bits {
8034 u8 reserved_at_0[0x76]; 8070 u8 reserved_at_0[0x30];
8071 u8 field_select[0x10];
8035 8072
8073 u8 tx_overflow_sense[0x1];
8074 u8 mark_cqe[0x1];
8075 u8 mark_cnp[0x1];
8076 u8 reserved_at_43[0x1b];
8077 u8 tx_lossy_overflow_oper[0x2];
8078
8079 u8 reserved_at_60[0x100];
8080};
8081
8082struct mlx5_ifc_pcam_enhanced_features_bits {
8083 u8 reserved_at_0[0x6d];
8084 u8 rx_icrc_encapsulated_counter[0x1];
8085 u8 reserved_at_6e[0x8];
8036 u8 pfcc_mask[0x1]; 8086 u8 pfcc_mask[0x1];
8037 u8 reserved_at_77[0x4]; 8087 u8 reserved_at_77[0x4];
8038 u8 rx_buffer_fullness_counters[0x1]; 8088 u8 rx_buffer_fullness_counters[0x1];
@@ -8077,7 +8127,11 @@ struct mlx5_ifc_pcam_reg_bits {
8077}; 8127};
8078 8128
8079struct mlx5_ifc_mcam_enhanced_features_bits { 8129struct mlx5_ifc_mcam_enhanced_features_bits {
8080 u8 reserved_at_0[0x7b]; 8130 u8 reserved_at_0[0x74];
8131 u8 mark_tx_action_cnp[0x1];
8132 u8 mark_tx_action_cqe[0x1];
8133 u8 dynamic_tx_overflow[0x1];
8134 u8 reserved_at_77[0x4];
8081 u8 pcie_outbound_stalled[0x1]; 8135 u8 pcie_outbound_stalled[0x1];
8082 u8 tx_overflow_buffer_pkt[0x1]; 8136 u8 tx_overflow_buffer_pkt[0x1];
8083 u8 mtpps_enh_out_per_adj[0x1]; 8137 u8 mtpps_enh_out_per_adj[0x1];
@@ -8092,7 +8146,11 @@ struct mlx5_ifc_mcam_access_reg_bits {
8092 u8 mcqi[0x1]; 8146 u8 mcqi[0x1];
8093 u8 reserved_at_1f[0x1]; 8147 u8 reserved_at_1f[0x1];
8094 8148
8095 u8 regs_95_to_64[0x20]; 8149 u8 regs_95_to_87[0x9];
8150 u8 mpegc[0x1];
8151 u8 regs_85_to_68[0x12];
8152 u8 tracer_registers[0x4];
8153
8096 u8 regs_63_to_32[0x20]; 8154 u8 regs_63_to_32[0x20];
8097 u8 regs_31_to_0[0x20]; 8155 u8 regs_31_to_0[0x20];
8098}; 8156};
@@ -9115,4 +9173,113 @@ struct mlx5_ifc_dealloc_memic_out_bits {
9115 u8 reserved_at_40[0x40]; 9173 u8 reserved_at_40[0x40];
9116}; 9174};
9117 9175
9176struct mlx5_ifc_general_obj_in_cmd_hdr_bits {
9177 u8 opcode[0x10];
9178 u8 uid[0x10];
9179
9180 u8 reserved_at_20[0x10];
9181 u8 obj_type[0x10];
9182
9183 u8 obj_id[0x20];
9184
9185 u8 reserved_at_60[0x20];
9186};
9187
9188struct mlx5_ifc_general_obj_out_cmd_hdr_bits {
9189 u8 status[0x8];
9190 u8 reserved_at_8[0x18];
9191
9192 u8 syndrome[0x20];
9193
9194 u8 obj_id[0x20];
9195
9196 u8 reserved_at_60[0x20];
9197};
9198
9199struct mlx5_ifc_umem_bits {
9200 u8 modify_field_select[0x40];
9201
9202 u8 reserved_at_40[0x5b];
9203 u8 log_page_size[0x5];
9204
9205 u8 page_offset[0x20];
9206
9207 u8 num_of_mtt[0x40];
9208
9209 struct mlx5_ifc_mtt_bits mtt[0];
9210};
9211
9212struct mlx5_ifc_uctx_bits {
9213 u8 modify_field_select[0x40];
9214
9215 u8 reserved_at_40[0x1c0];
9216};
9217
9218struct mlx5_ifc_create_umem_in_bits {
9219 struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
9220 struct mlx5_ifc_umem_bits umem;
9221};
9222
9223struct mlx5_ifc_create_uctx_in_bits {
9224 struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
9225 struct mlx5_ifc_uctx_bits uctx;
9226};
9227
9228struct mlx5_ifc_mtrc_string_db_param_bits {
9229 u8 string_db_base_address[0x20];
9230
9231 u8 reserved_at_20[0x8];
9232 u8 string_db_size[0x18];
9233};
9234
9235struct mlx5_ifc_mtrc_cap_bits {
9236 u8 trace_owner[0x1];
9237 u8 trace_to_memory[0x1];
9238 u8 reserved_at_2[0x4];
9239 u8 trc_ver[0x2];
9240 u8 reserved_at_8[0x14];
9241 u8 num_string_db[0x4];
9242
9243 u8 first_string_trace[0x8];
9244 u8 num_string_trace[0x8];
9245 u8 reserved_at_30[0x28];
9246
9247 u8 log_max_trace_buffer_size[0x8];
9248
9249 u8 reserved_at_60[0x20];
9250
9251 struct mlx5_ifc_mtrc_string_db_param_bits string_db_param[8];
9252
9253 u8 reserved_at_280[0x180];
9254};
9255
9256struct mlx5_ifc_mtrc_conf_bits {
9257 u8 reserved_at_0[0x1c];
9258 u8 trace_mode[0x4];
9259 u8 reserved_at_20[0x18];
9260 u8 log_trace_buffer_size[0x8];
9261 u8 trace_mkey[0x20];
9262 u8 reserved_at_60[0x3a0];
9263};
9264
9265struct mlx5_ifc_mtrc_stdb_bits {
9266 u8 string_db_index[0x4];
9267 u8 reserved_at_4[0x4];
9268 u8 read_size[0x18];
9269 u8 start_offset[0x20];
9270 u8 string_db_data[0];
9271};
9272
9273struct mlx5_ifc_mtrc_ctrl_bits {
9274 u8 trace_status[0x2];
9275 u8 reserved_at_2[0x2];
9276 u8 arm_event[0x1];
9277 u8 reserved_at_5[0xb];
9278 u8 modify_field_select[0x10];
9279 u8 reserved_at_20[0x2b];
9280 u8 current_timestamp52_32[0x15];
9281 u8 current_timestamp31_0[0x20];
9282 u8 reserved_at_80[0x180];
9283};
9284
9118#endif /* MLX5_IFC_H */ 9285#endif /* MLX5_IFC_H */
diff --git a/include/linux/mlx5/mlx5_ifc_fpga.h b/include/linux/mlx5/mlx5_ifc_fpga.h
index 64d0f40d4cc3..37e065a80a43 100644
--- a/include/linux/mlx5/mlx5_ifc_fpga.h
+++ b/include/linux/mlx5/mlx5_ifc_fpga.h
@@ -576,6 +576,7 @@ struct mlx5_ifc_fpga_ipsec_sa {
576enum fpga_tls_cmds { 576enum fpga_tls_cmds {
577 CMD_SETUP_STREAM = 0x1001, 577 CMD_SETUP_STREAM = 0x1001,
578 CMD_TEARDOWN_STREAM = 0x1002, 578 CMD_TEARDOWN_STREAM = 0x1002,
579 CMD_RESYNC_RX = 0x1003,
579}; 580};
580 581
581#define MLX5_TLS_1_2 (0) 582#define MLX5_TLS_1_2 (0)
diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h
index 9208cb8809ac..7e7c6dfcfb09 100644
--- a/include/linux/mlx5/vport.h
+++ b/include/linux/mlx5/vport.h
@@ -43,8 +43,6 @@ enum {
43}; 43};
44 44
45u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); 45u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport);
46u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
47 u16 vport);
48int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, 46int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
49 u16 vport, u8 state); 47 u16 vport, u8 state);
50int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, 48int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 68a5121694ef..a61ebe8ad4ca 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -456,6 +456,7 @@ static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm)
456{ 456{
457 static const struct vm_operations_struct dummy_vm_ops = {}; 457 static const struct vm_operations_struct dummy_vm_ops = {};
458 458
459 memset(vma, 0, sizeof(*vma));
459 vma->vm_mm = mm; 460 vma->vm_mm = mm;
460 vma->vm_ops = &dummy_vm_ops; 461 vma->vm_ops = &dummy_vm_ops;
461 INIT_LIST_HEAD(&vma->anon_vma_chain); 462 INIT_LIST_HEAD(&vma->anon_vma_chain);
@@ -727,10 +728,10 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
727 return pte; 728 return pte;
728} 729}
729 730
730int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg, 731vm_fault_t alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
731 struct page *page); 732 struct page *page);
732int finish_fault(struct vm_fault *vmf); 733vm_fault_t finish_fault(struct vm_fault *vmf);
733int finish_mkwrite_fault(struct vm_fault *vmf); 734vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf);
734#endif 735#endif
735 736
736/* 737/*
@@ -959,15 +960,6 @@ static inline int page_zone_id(struct page *page)
959 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; 960 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
960} 961}
961 962
962static inline int zone_to_nid(struct zone *zone)
963{
964#ifdef CONFIG_NUMA
965 return zone->node;
966#else
967 return 0;
968#endif
969}
970
971#ifdef NODE_NOT_IN_PAGE_FLAGS 963#ifdef NODE_NOT_IN_PAGE_FLAGS
972extern int page_to_nid(const struct page *page); 964extern int page_to_nid(const struct page *page);
973#else 965#else
@@ -1411,8 +1403,8 @@ int generic_error_remove_page(struct address_space *mapping, struct page *page);
1411int invalidate_inode_page(struct page *page); 1403int invalidate_inode_page(struct page *page);
1412 1404
1413#ifdef CONFIG_MMU 1405#ifdef CONFIG_MMU
1414extern int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, 1406extern vm_fault_t handle_mm_fault(struct vm_area_struct *vma,
1415 unsigned int flags); 1407 unsigned long address, unsigned int flags);
1416extern int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, 1408extern int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
1417 unsigned long address, unsigned int fault_flags, 1409 unsigned long address, unsigned int fault_flags,
1418 bool *unlocked); 1410 bool *unlocked);
@@ -1421,7 +1413,7 @@ void unmap_mapping_pages(struct address_space *mapping,
1421void unmap_mapping_range(struct address_space *mapping, 1413void unmap_mapping_range(struct address_space *mapping,
1422 loff_t const holebegin, loff_t const holelen, int even_cows); 1414 loff_t const holebegin, loff_t const holelen, int even_cows);
1423#else 1415#else
1424static inline int handle_mm_fault(struct vm_area_struct *vma, 1416static inline vm_fault_t handle_mm_fault(struct vm_area_struct *vma,
1425 unsigned long address, unsigned int flags) 1417 unsigned long address, unsigned int flags)
1426{ 1418{
1427 /* should never happen if there's no MMU */ 1419 /* should never happen if there's no MMU */
@@ -2023,7 +2015,7 @@ static inline spinlock_t *pud_lock(struct mm_struct *mm, pud_t *pud)
2023 2015
2024extern void __init pagecache_init(void); 2016extern void __init pagecache_init(void);
2025extern void free_area_init(unsigned long * zones_size); 2017extern void free_area_init(unsigned long * zones_size);
2026extern void free_area_init_node(int nid, unsigned long * zones_size, 2018extern void __init free_area_init_node(int nid, unsigned long * zones_size,
2027 unsigned long zone_start_pfn, unsigned long *zholes_size); 2019 unsigned long zone_start_pfn, unsigned long *zholes_size);
2028extern void free_initmem(void); 2020extern void free_initmem(void);
2029 2021
@@ -2571,7 +2563,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma,
2571#define FOLL_COW 0x4000 /* internal GUP flag */ 2563#define FOLL_COW 0x4000 /* internal GUP flag */
2572#define FOLL_ANON 0x8000 /* don't do file mappings */ 2564#define FOLL_ANON 0x8000 /* don't do file mappings */
2573 2565
2574static inline int vm_fault_to_errno(int vm_fault, int foll_flags) 2566static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags)
2575{ 2567{
2576 if (vm_fault & VM_FAULT_OOM) 2568 if (vm_fault & VM_FAULT_OOM)
2577 return -ENOMEM; 2569 return -ENOMEM;
@@ -2665,12 +2657,7 @@ extern int randomize_va_space;
2665const char * arch_vma_name(struct vm_area_struct *vma); 2657const char * arch_vma_name(struct vm_area_struct *vma);
2666void print_vma_addr(char *prefix, unsigned long rip); 2658void print_vma_addr(char *prefix, unsigned long rip);
2667 2659
2668void sparse_mem_maps_populate_node(struct page **map_map, 2660void *sparse_buffer_alloc(unsigned long size);
2669 unsigned long pnum_begin,
2670 unsigned long pnum_end,
2671 unsigned long map_count,
2672 int nodeid);
2673
2674struct page *sparse_mem_map_populate(unsigned long pnum, int nid, 2661struct page *sparse_mem_map_populate(unsigned long pnum, int nid,
2675 struct vmem_altmap *altmap); 2662 struct vmem_altmap *altmap);
2676pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); 2663pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
@@ -2744,6 +2731,7 @@ enum mf_action_page_type {
2744 MF_MSG_TRUNCATED_LRU, 2731 MF_MSG_TRUNCATED_LRU,
2745 MF_MSG_BUDDY, 2732 MF_MSG_BUDDY,
2746 MF_MSG_BUDDY_2ND, 2733 MF_MSG_BUDDY_2ND,
2734 MF_MSG_DAX,
2747 MF_MSG_UNKNOWN, 2735 MF_MSG_UNKNOWN,
2748}; 2736};
2749 2737
@@ -2752,7 +2740,8 @@ extern void clear_huge_page(struct page *page,
2752 unsigned long addr_hint, 2740 unsigned long addr_hint,
2753 unsigned int pages_per_huge_page); 2741 unsigned int pages_per_huge_page);
2754extern void copy_user_huge_page(struct page *dst, struct page *src, 2742extern void copy_user_huge_page(struct page *dst, struct page *src,
2755 unsigned long addr, struct vm_area_struct *vma, 2743 unsigned long addr_hint,
2744 struct vm_area_struct *vma,
2756 unsigned int pages_per_huge_page); 2745 unsigned int pages_per_huge_page);
2757extern long copy_huge_page_from_user(struct page *dst_page, 2746extern long copy_huge_page_from_user(struct page *dst_page,
2758 const void __user *usr_src, 2747 const void __user *usr_src,
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index efdc24dd9e97..cd2bc939efd0 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -139,7 +139,10 @@ struct page {
139 unsigned long _pt_pad_1; /* compound_head */ 139 unsigned long _pt_pad_1; /* compound_head */
140 pgtable_t pmd_huge_pte; /* protected by page->ptl */ 140 pgtable_t pmd_huge_pte; /* protected by page->ptl */
141 unsigned long _pt_pad_2; /* mapping */ 141 unsigned long _pt_pad_2; /* mapping */
142 struct mm_struct *pt_mm; /* x86 pgds only */ 142 union {
143 struct mm_struct *pt_mm; /* x86 pgds only */
144 atomic_t pt_frag_refcount; /* powerpc */
145 };
143#if ALLOC_SPLIT_PTLOCKS 146#if ALLOC_SPLIT_PTLOCKS
144 spinlock_t *ptl; 147 spinlock_t *ptl;
145#else 148#else
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 64300a48dcce..beed7121c781 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -146,6 +146,13 @@ struct mmc_host_ops {
146 146
147 /* Prepare HS400 target operating frequency depending host driver */ 147 /* Prepare HS400 target operating frequency depending host driver */
148 int (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios); 148 int (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios);
149
150 /* Prepare for switching from HS400 to HS200 */
151 void (*hs400_downgrade)(struct mmc_host *host);
152
153 /* Complete selection of HS400 */
154 void (*hs400_complete)(struct mmc_host *host);
155
149 /* Prepare enhanced strobe depending host driver */ 156 /* Prepare enhanced strobe depending host driver */
150 void (*hs400_enhanced_strobe)(struct mmc_host *host, 157 void (*hs400_enhanced_strobe)(struct mmc_host *host,
151 struct mmc_ios *ios); 158 struct mmc_ios *ios);
@@ -474,9 +481,6 @@ static inline void *mmc_priv(struct mmc_host *host)
474#define mmc_classdev(x) (&(x)->class_dev) 481#define mmc_classdev(x) (&(x)->class_dev)
475#define mmc_hostname(x) (dev_name(&(x)->class_dev)) 482#define mmc_hostname(x) (dev_name(&(x)->class_dev))
476 483
477int mmc_power_save_host(struct mmc_host *host);
478int mmc_power_restore_host(struct mmc_host *host);
479
480void mmc_detect_change(struct mmc_host *, unsigned long delay); 484void mmc_detect_change(struct mmc_host *, unsigned long delay);
481void mmc_request_done(struct mmc_host *, struct mmc_request *); 485void mmc_request_done(struct mmc_host *, struct mmc_request *);
482void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq); 486void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq);
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 3ffc27aaeeaf..897a87c4c827 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -144,7 +144,7 @@ static inline bool mmc_op_multi(u32 opcode)
144#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */ 144#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */
145#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */ 145#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */
146#define R1_ERASE_RESET (1 << 13) /* sr, c */ 146#define R1_ERASE_RESET (1 << 13) /* sr, c */
147#define R1_STATUS(x) (x & 0xFFFFE000) 147#define R1_STATUS(x) (x & 0xFFF9A000)
148#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 148#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
149#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 149#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
150#define R1_SWITCH_ERROR (1 << 7) /* sx, c */ 150#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 392e6af82701..133ba78820ee 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -151,13 +151,15 @@ struct mmu_notifier_ops {
151 * address space but may still be referenced by sptes until 151 * address space but may still be referenced by sptes until
152 * the last refcount is dropped. 152 * the last refcount is dropped.
153 * 153 *
154 * If both of these callbacks cannot block, and invalidate_range 154 * If blockable argument is set to false then the callback cannot
155 * cannot block, mmu_notifier_ops.flags should have 155 * sleep and has to return with -EAGAIN. 0 should be returned
156 * MMU_INVALIDATE_DOES_NOT_BLOCK set. 156 * otherwise.
157 *
157 */ 158 */
158 void (*invalidate_range_start)(struct mmu_notifier *mn, 159 int (*invalidate_range_start)(struct mmu_notifier *mn,
159 struct mm_struct *mm, 160 struct mm_struct *mm,
160 unsigned long start, unsigned long end); 161 unsigned long start, unsigned long end,
162 bool blockable);
161 void (*invalidate_range_end)(struct mmu_notifier *mn, 163 void (*invalidate_range_end)(struct mmu_notifier *mn,
162 struct mm_struct *mm, 164 struct mm_struct *mm,
163 unsigned long start, unsigned long end); 165 unsigned long start, unsigned long end);
@@ -229,8 +231,9 @@ extern int __mmu_notifier_test_young(struct mm_struct *mm,
229 unsigned long address); 231 unsigned long address);
230extern void __mmu_notifier_change_pte(struct mm_struct *mm, 232extern void __mmu_notifier_change_pte(struct mm_struct *mm,
231 unsigned long address, pte_t pte); 233 unsigned long address, pte_t pte);
232extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm, 234extern int __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
233 unsigned long start, unsigned long end); 235 unsigned long start, unsigned long end,
236 bool blockable);
234extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm, 237extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
235 unsigned long start, unsigned long end, 238 unsigned long start, unsigned long end,
236 bool only_end); 239 bool only_end);
@@ -281,7 +284,15 @@ static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
281 unsigned long start, unsigned long end) 284 unsigned long start, unsigned long end)
282{ 285{
283 if (mm_has_notifiers(mm)) 286 if (mm_has_notifiers(mm))
284 __mmu_notifier_invalidate_range_start(mm, start, end); 287 __mmu_notifier_invalidate_range_start(mm, start, end, true);
288}
289
290static inline int mmu_notifier_invalidate_range_start_nonblock(struct mm_struct *mm,
291 unsigned long start, unsigned long end)
292{
293 if (mm_has_notifiers(mm))
294 return __mmu_notifier_invalidate_range_start(mm, start, end, false);
295 return 0;
285} 296}
286 297
287static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm, 298static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
@@ -461,6 +472,12 @@ static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
461{ 472{
462} 473}
463 474
475static inline int mmu_notifier_invalidate_range_start_nonblock(struct mm_struct *mm,
476 unsigned long start, unsigned long end)
477{
478 return 0;
479}
480
464static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm, 481static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
465 unsigned long start, unsigned long end) 482 unsigned long start, unsigned long end)
466{ 483{
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 32699b2dc52a..1e22d96734e0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -755,25 +755,6 @@ static inline bool pgdat_is_empty(pg_data_t *pgdat)
755 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages; 755 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages;
756} 756}
757 757
758static inline int zone_id(const struct zone *zone)
759{
760 struct pglist_data *pgdat = zone->zone_pgdat;
761
762 return zone - pgdat->node_zones;
763}
764
765#ifdef CONFIG_ZONE_DEVICE
766static inline bool is_dev_zone(const struct zone *zone)
767{
768 return zone_id(zone) == ZONE_DEVICE;
769}
770#else
771static inline bool is_dev_zone(const struct zone *zone)
772{
773 return false;
774}
775#endif
776
777#include <linux/memory_hotplug.h> 758#include <linux/memory_hotplug.h>
778 759
779void build_all_zonelists(pg_data_t *pgdat); 760void build_all_zonelists(pg_data_t *pgdat);
@@ -824,6 +805,18 @@ static inline int local_memory_node(int node_id) { return node_id; };
824 */ 805 */
825#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) 806#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
826 807
808#ifdef CONFIG_ZONE_DEVICE
809static inline bool is_dev_zone(const struct zone *zone)
810{
811 return zone_idx(zone) == ZONE_DEVICE;
812}
813#else
814static inline bool is_dev_zone(const struct zone *zone)
815{
816 return false;
817}
818#endif
819
827/* 820/*
828 * Returns true if a zone has pages managed by the buddy allocator. 821 * Returns true if a zone has pages managed by the buddy allocator.
829 * All the reclaim decisions have to use this function rather than 822 * All the reclaim decisions have to use this function rather than
@@ -841,6 +834,25 @@ static inline bool populated_zone(struct zone *zone)
841 return zone->present_pages; 834 return zone->present_pages;
842} 835}
843 836
837#ifdef CONFIG_NUMA
838static inline int zone_to_nid(struct zone *zone)
839{
840 return zone->node;
841}
842
843static inline void zone_set_nid(struct zone *zone, int nid)
844{
845 zone->node = nid;
846}
847#else
848static inline int zone_to_nid(struct zone *zone)
849{
850 return 0;
851}
852
853static inline void zone_set_nid(struct zone *zone, int nid) {}
854#endif
855
844extern int movable_zone; 856extern int movable_zone;
845 857
846#ifdef CONFIG_HIGHMEM 858#ifdef CONFIG_HIGHMEM
@@ -956,12 +968,7 @@ static inline int zonelist_zone_idx(struct zoneref *zoneref)
956 968
957static inline int zonelist_node_idx(struct zoneref *zoneref) 969static inline int zonelist_node_idx(struct zoneref *zoneref)
958{ 970{
959#ifdef CONFIG_NUMA 971 return zone_to_nid(zoneref->zone);
960 /* zone_to_nid not available in this context */
961 return zoneref->zone->node;
962#else
963 return 0;
964#endif /* CONFIG_NUMA */
965} 972}
966 973
967struct zoneref *__next_zones_zonelist(struct zoneref *z, 974struct zoneref *__next_zones_zonelist(struct zoneref *z,
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 96a71a648eed..1298a7daa57d 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -746,4 +746,19 @@ struct tb_service_id {
746#define TBSVC_MATCH_PROTOCOL_VERSION 0x0004 746#define TBSVC_MATCH_PROTOCOL_VERSION 0x0004
747#define TBSVC_MATCH_PROTOCOL_REVISION 0x0008 747#define TBSVC_MATCH_PROTOCOL_REVISION 0x0008
748 748
749/* USB Type-C Alternate Modes */
750
751#define TYPEC_ANY_MODE 0x7
752
753/**
754 * struct typec_device_id - USB Type-C alternate mode identifiers
755 * @svid: Standard or Vendor ID
756 * @mode: Mode index
757 */
758struct typec_device_id {
759 __u16 svid;
760 __u8 mode;
761 kernel_ulong_t driver_data;
762};
763
749#endif /* LINUX_MOD_DEVICETABLE_H */ 764#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index d44df9b2c131..f807f15bebbe 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -266,7 +266,7 @@ extern int modules_disabled; /* for sysctl */
266/* Get/put a kernel symbol (calls must be symmetric) */ 266/* Get/put a kernel symbol (calls must be symmetric) */
267void *__symbol_get(const char *symbol); 267void *__symbol_get(const char *symbol);
268void *__symbol_get_gpl(const char *symbol); 268void *__symbol_get_gpl(const char *symbol);
269#define symbol_get(x) ((typeof(&x))(__symbol_get(VMLINUX_SYMBOL_STR(x)))) 269#define symbol_get(x) ((typeof(&x))(__symbol_get(__stringify(x))))
270 270
271/* modules using other modules: kdb wants to see this. */ 271/* modules using other modules: kdb wants to see this. */
272struct module_use { 272struct module_use {
@@ -575,7 +575,7 @@ extern void __noreturn __module_put_and_exit(struct module *mod,
575#ifdef CONFIG_MODULE_UNLOAD 575#ifdef CONFIG_MODULE_UNLOAD
576int module_refcount(struct module *mod); 576int module_refcount(struct module *mod);
577void __symbol_put(const char *symbol); 577void __symbol_put(const char *symbol);
578#define symbol_put(x) __symbol_put(VMLINUX_SYMBOL_STR(x)) 578#define symbol_put(x) __symbol_put(__stringify(x))
579void symbol_put_addr(void *addr); 579void symbol_put_addr(void *addr);
580 580
581/* Sometimes we know we already have a refcount, and it's easier not 581/* Sometimes we know we already have a refcount, and it's easier not
diff --git a/include/linux/mroute_base.h b/include/linux/mroute_base.h
index d633f737b3c6..6675b9f81979 100644
--- a/include/linux/mroute_base.h
+++ b/include/linux/mroute_base.h
@@ -2,7 +2,7 @@
2#define __LINUX_MROUTE_BASE_H 2#define __LINUX_MROUTE_BASE_H
3 3
4#include <linux/netdevice.h> 4#include <linux/netdevice.h>
5#include <linux/rhashtable.h> 5#include <linux/rhashtable-types.h>
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <net/net_namespace.h> 7#include <net/net_namespace.h>
8#include <net/sock.h> 8#include <net/sock.h>
@@ -254,6 +254,7 @@ struct mr_table {
254 atomic_t cache_resolve_queue_len; 254 atomic_t cache_resolve_queue_len;
255 bool mroute_do_assert; 255 bool mroute_do_assert;
256 bool mroute_do_pim; 256 bool mroute_do_pim;
257 bool mroute_do_wrvifwhole;
257 int mroute_reg_vif_num; 258 int mroute_reg_vif_num;
258}; 259};
259 260
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a86c4fa93115..cd0be91bdefa 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -67,9 +67,11 @@ struct mtd_erase_region_info {
67 * @datbuf: data buffer - if NULL only oob data are read/written 67 * @datbuf: data buffer - if NULL only oob data are read/written
68 * @oobbuf: oob data buffer 68 * @oobbuf: oob data buffer
69 * 69 *
70 * Note, it is allowed to read more than one OOB area at one go, but not write. 70 * Note, some MTD drivers do not allow you to write more than one OOB area at
71 * The interface assumes that the OOB write requests program only one page's 71 * one go. If you try to do that on such an MTD device, -EINVAL will be
72 * OOB area. 72 * returned. If you want to make your implementation portable on all kind of MTD
73 * devices you should split the write request into several sub-requests when the
74 * request crosses a page boundary.
73 */ 75 */
74struct mtd_oob_ops { 76struct mtd_oob_ops {
75 unsigned int mode; 77 unsigned int mode;
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 3e8ec3b8a39c..efb2345359bb 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -21,11 +21,10 @@
21#include <linux/mtd/mtd.h> 21#include <linux/mtd/mtd.h>
22#include <linux/mtd/flashchip.h> 22#include <linux/mtd/flashchip.h>
23#include <linux/mtd/bbm.h> 23#include <linux/mtd/bbm.h>
24#include <linux/of.h>
24#include <linux/types.h> 25#include <linux/types.h>
25 26
26struct mtd_info;
27struct nand_flash_dev; 27struct nand_flash_dev;
28struct device_node;
29 28
30/* Scan and identify a NAND device */ 29/* Scan and identify a NAND device */
31int nand_scan_with_ids(struct mtd_info *mtd, int max_chips, 30int nand_scan_with_ids(struct mtd_info *mtd, int max_chips,
@@ -36,17 +35,6 @@ static inline int nand_scan(struct mtd_info *mtd, int max_chips)
36 return nand_scan_with_ids(mtd, max_chips, NULL); 35 return nand_scan_with_ids(mtd, max_chips, NULL);
37} 36}
38 37
39/*
40 * Separate phases of nand_scan(), allowing board driver to intervene
41 * and override command or ECC setup according to flash type.
42 */
43int nand_scan_ident(struct mtd_info *mtd, int max_chips,
44 struct nand_flash_dev *table);
45int nand_scan_tail(struct mtd_info *mtd);
46
47/* Unregister the MTD device and free resources held by the NAND device */
48void nand_release(struct mtd_info *mtd);
49
50/* Internal helper for board drivers which need to override command function */ 38/* Internal helper for board drivers which need to override command function */
51void nand_wait_ready(struct mtd_info *mtd); 39void nand_wait_ready(struct mtd_info *mtd);
52 40
@@ -121,6 +109,7 @@ enum nand_ecc_algo {
121 NAND_ECC_UNKNOWN, 109 NAND_ECC_UNKNOWN,
122 NAND_ECC_HAMMING, 110 NAND_ECC_HAMMING,
123 NAND_ECC_BCH, 111 NAND_ECC_BCH,
112 NAND_ECC_RS,
124}; 113};
125 114
126/* 115/*
@@ -218,6 +207,12 @@ enum nand_ecc_algo {
218 */ 207 */
219#define NAND_WAIT_TCCS 0x00200000 208#define NAND_WAIT_TCCS 0x00200000
220 209
210/*
211 * Whether the NAND chip is a boot medium. Drivers might use this information
212 * to select ECC algorithms supported by the boot ROM or similar restrictions.
213 */
214#define NAND_IS_BOOT_MEDIUM 0x00400000
215
221/* Options set by nand scan */ 216/* Options set by nand scan */
222/* Nand scan has allocated controller struct */ 217/* Nand scan has allocated controller struct */
223#define NAND_CONTROLLER_ALLOC 0x80000000 218#define NAND_CONTROLLER_ALLOC 0x80000000
@@ -230,6 +225,17 @@ enum nand_ecc_algo {
230/* Keep gcc happy */ 225/* Keep gcc happy */
231struct nand_chip; 226struct nand_chip;
232 227
228/* ONFI version bits */
229#define ONFI_VERSION_1_0 BIT(1)
230#define ONFI_VERSION_2_0 BIT(2)
231#define ONFI_VERSION_2_1 BIT(3)
232#define ONFI_VERSION_2_2 BIT(4)
233#define ONFI_VERSION_2_3 BIT(5)
234#define ONFI_VERSION_3_0 BIT(6)
235#define ONFI_VERSION_3_1 BIT(7)
236#define ONFI_VERSION_3_2 BIT(8)
237#define ONFI_VERSION_4_0 BIT(9)
238
233/* ONFI features */ 239/* ONFI features */
234#define ONFI_FEATURE_16_BIT_BUS (1 << 0) 240#define ONFI_FEATURE_16_BIT_BUS (1 << 0)
235#define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7) 241#define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7)
@@ -470,13 +476,13 @@ struct onfi_params {
470 */ 476 */
471struct nand_parameters { 477struct nand_parameters {
472 /* Generic parameters */ 478 /* Generic parameters */
473 char model[100]; 479 const char *model;
474 bool supports_set_get_features; 480 bool supports_set_get_features;
475 DECLARE_BITMAP(set_feature_list, ONFI_FEATURE_NUMBER); 481 DECLARE_BITMAP(set_feature_list, ONFI_FEATURE_NUMBER);
476 DECLARE_BITMAP(get_feature_list, ONFI_FEATURE_NUMBER); 482 DECLARE_BITMAP(get_feature_list, ONFI_FEATURE_NUMBER);
477 483
478 /* ONFI parameters */ 484 /* ONFI parameters */
479 struct onfi_params onfi; 485 struct onfi_params *onfi;
480}; 486};
481 487
482/* The maximum expected count of bytes in the NAND ID sequence */ 488/* The maximum expected count of bytes in the NAND ID sequence */
@@ -493,20 +499,42 @@ struct nand_id {
493}; 499};
494 500
495/** 501/**
496 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 502 * struct nand_controller_ops - Controller operations
503 *
504 * @attach_chip: this method is called after the NAND detection phase after
505 * flash ID and MTD fields such as erase size, page size and OOB
506 * size have been set up. ECC requirements are available if
507 * provided by the NAND chip or device tree. Typically used to
508 * choose the appropriate ECC configuration and allocate
509 * associated resources.
510 * This hook is optional.
511 * @detach_chip: free all resources allocated/claimed in
512 * nand_controller_ops->attach_chip().
513 * This hook is optional.
514 */
515struct nand_controller_ops {
516 int (*attach_chip)(struct nand_chip *chip);
517 void (*detach_chip)(struct nand_chip *chip);
518};
519
520/**
521 * struct nand_controller - Structure used to describe a NAND controller
522 *
497 * @lock: protection lock 523 * @lock: protection lock
498 * @active: the mtd device which holds the controller currently 524 * @active: the mtd device which holds the controller currently
499 * @wq: wait queue to sleep on if a NAND operation is in 525 * @wq: wait queue to sleep on if a NAND operation is in
500 * progress used instead of the per chip wait queue 526 * progress used instead of the per chip wait queue
501 * when a hw controller is available. 527 * when a hw controller is available.
528 * @ops: NAND controller operations.
502 */ 529 */
503struct nand_hw_control { 530struct nand_controller {
504 spinlock_t lock; 531 spinlock_t lock;
505 struct nand_chip *active; 532 struct nand_chip *active;
506 wait_queue_head_t wq; 533 wait_queue_head_t wq;
534 const struct nand_controller_ops *ops;
507}; 535};
508 536
509static inline void nand_hw_control_init(struct nand_hw_control *nfc) 537static inline void nand_controller_init(struct nand_controller *nfc)
510{ 538{
511 nfc->active = NULL; 539 nfc->active = NULL;
512 spin_lock_init(&nfc->lock); 540 spin_lock_init(&nfc->lock);
@@ -778,11 +806,15 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
778 * implementation) if any. 806 * implementation) if any.
779 * @cleanup: the ->init() function may have allocated resources, ->cleanup() 807 * @cleanup: the ->init() function may have allocated resources, ->cleanup()
780 * is here to let vendor specific code release those resources. 808 * is here to let vendor specific code release those resources.
809 * @fixup_onfi_param_page: apply vendor specific fixups to the ONFI parameter
810 * page. This is called after the checksum is verified.
781 */ 811 */
782struct nand_manufacturer_ops { 812struct nand_manufacturer_ops {
783 void (*detect)(struct nand_chip *chip); 813 void (*detect)(struct nand_chip *chip);
784 int (*init)(struct nand_chip *chip); 814 int (*init)(struct nand_chip *chip);
785 void (*cleanup)(struct nand_chip *chip); 815 void (*cleanup)(struct nand_chip *chip);
816 void (*fixup_onfi_param_page)(struct nand_chip *chip,
817 struct nand_onfi_params *p);
786}; 818};
787 819
788/** 820/**
@@ -986,14 +1018,14 @@ struct nand_subop {
986 unsigned int last_instr_end_off; 1018 unsigned int last_instr_end_off;
987}; 1019};
988 1020
989int nand_subop_get_addr_start_off(const struct nand_subop *subop, 1021unsigned int nand_subop_get_addr_start_off(const struct nand_subop *subop,
990 unsigned int op_id); 1022 unsigned int op_id);
991int nand_subop_get_num_addr_cyc(const struct nand_subop *subop, 1023unsigned int nand_subop_get_num_addr_cyc(const struct nand_subop *subop,
992 unsigned int op_id); 1024 unsigned int op_id);
993int nand_subop_get_data_start_off(const struct nand_subop *subop, 1025unsigned int nand_subop_get_data_start_off(const struct nand_subop *subop,
994 unsigned int op_id); 1026 unsigned int op_id);
995int nand_subop_get_data_len(const struct nand_subop *subop, 1027unsigned int nand_subop_get_data_len(const struct nand_subop *subop,
996 unsigned int op_id); 1028 unsigned int op_id);
997 1029
998/** 1030/**
999 * struct nand_op_parser_addr_constraints - Constraints for address instructions 1031 * struct nand_op_parser_addr_constraints - Constraints for address instructions
@@ -1176,9 +1208,9 @@ int nand_op_parser_exec_op(struct nand_chip *chip,
1176 * setting the read-retry mode. Mostly needed for MLC NAND. 1208 * setting the read-retry mode. Mostly needed for MLC NAND.
1177 * @ecc: [BOARDSPECIFIC] ECC control structure 1209 * @ecc: [BOARDSPECIFIC] ECC control structure
1178 * @buf_align: minimum buffer alignment required by a platform 1210 * @buf_align: minimum buffer alignment required by a platform
1179 * @hwcontrol: platform-specific hardware control structure 1211 * @dummy_controller: dummy controller implementation for drivers that can
1212 * only control a single chip
1180 * @erase: [REPLACEABLE] erase function 1213 * @erase: [REPLACEABLE] erase function
1181 * @scan_bbt: [REPLACEABLE] function to scan bad block table
1182 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring 1214 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring
1183 * data from array to read regs (tR). 1215 * data from array to read regs (tR).
1184 * @state: [INTERN] the current state of the NAND device 1216 * @state: [INTERN] the current state of the NAND device
@@ -1271,7 +1303,6 @@ struct nand_chip {
1271 const struct nand_operation *op, 1303 const struct nand_operation *op,
1272 bool check_only); 1304 bool check_only);
1273 int (*erase)(struct mtd_info *mtd, int page); 1305 int (*erase)(struct mtd_info *mtd, int page);
1274 int (*scan_bbt)(struct mtd_info *mtd);
1275 int (*set_features)(struct mtd_info *mtd, struct nand_chip *chip, 1306 int (*set_features)(struct mtd_info *mtd, struct nand_chip *chip,
1276 int feature_addr, uint8_t *subfeature_para); 1307 int feature_addr, uint8_t *subfeature_para);
1277 int (*get_features)(struct mtd_info *mtd, struct nand_chip *chip, 1308 int (*get_features)(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1314,11 +1345,11 @@ struct nand_chip {
1314 flstate_t state; 1345 flstate_t state;
1315 1346
1316 uint8_t *oob_poi; 1347 uint8_t *oob_poi;
1317 struct nand_hw_control *controller; 1348 struct nand_controller *controller;
1318 1349
1319 struct nand_ecc_ctrl ecc; 1350 struct nand_ecc_ctrl ecc;
1320 unsigned long buf_align; 1351 unsigned long buf_align;
1321 struct nand_hw_control hwcontrol; 1352 struct nand_controller dummy_controller;
1322 1353
1323 uint8_t *bbt; 1354 uint8_t *bbt;
1324 struct nand_bbt_descr *bbt_td; 1355 struct nand_bbt_descr *bbt_td;
@@ -1517,14 +1548,12 @@ extern const struct nand_manufacturer_ops micron_nand_manuf_ops;
1517extern const struct nand_manufacturer_ops amd_nand_manuf_ops; 1548extern const struct nand_manufacturer_ops amd_nand_manuf_ops;
1518extern const struct nand_manufacturer_ops macronix_nand_manuf_ops; 1549extern const struct nand_manufacturer_ops macronix_nand_manuf_ops;
1519 1550
1520int nand_default_bbt(struct mtd_info *mtd); 1551int nand_create_bbt(struct nand_chip *chip);
1521int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs); 1552int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
1522int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs); 1553int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs);
1523int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 1554int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
1524int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 1555int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
1525 int allowbbt); 1556 int allowbbt);
1526int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
1527 size_t *retlen, uint8_t *buf);
1528 1557
1529/** 1558/**
1530 * struct platform_nand_chip - chip level device structure 1559 * struct platform_nand_chip - chip level device structure
@@ -1555,14 +1584,12 @@ struct platform_device;
1555 * struct platform_nand_ctrl - controller level device structure 1584 * struct platform_nand_ctrl - controller level device structure
1556 * @probe: platform specific function to probe/setup hardware 1585 * @probe: platform specific function to probe/setup hardware
1557 * @remove: platform specific function to remove/teardown hardware 1586 * @remove: platform specific function to remove/teardown hardware
1558 * @hwcontrol: platform specific hardware control structure
1559 * @dev_ready: platform specific function to read ready/busy pin 1587 * @dev_ready: platform specific function to read ready/busy pin
1560 * @select_chip: platform specific chip select function 1588 * @select_chip: platform specific chip select function
1561 * @cmd_ctrl: platform specific function for controlling 1589 * @cmd_ctrl: platform specific function for controlling
1562 * ALE/CLE/nCE. Also used to write command and address 1590 * ALE/CLE/nCE. Also used to write command and address
1563 * @write_buf: platform specific function for write buffer 1591 * @write_buf: platform specific function for write buffer
1564 * @read_buf: platform specific function for read buffer 1592 * @read_buf: platform specific function for read buffer
1565 * @read_byte: platform specific function to read one byte from chip
1566 * @priv: private data to transport driver specific settings 1593 * @priv: private data to transport driver specific settings
1567 * 1594 *
1568 * All fields are optional and depend on the hardware driver requirements 1595 * All fields are optional and depend on the hardware driver requirements
@@ -1570,13 +1597,11 @@ struct platform_device;
1570struct platform_nand_ctrl { 1597struct platform_nand_ctrl {
1571 int (*probe)(struct platform_device *pdev); 1598 int (*probe)(struct platform_device *pdev);
1572 void (*remove)(struct platform_device *pdev); 1599 void (*remove)(struct platform_device *pdev);
1573 void (*hwcontrol)(struct mtd_info *mtd, int cmd);
1574 int (*dev_ready)(struct mtd_info *mtd); 1600 int (*dev_ready)(struct mtd_info *mtd);
1575 void (*select_chip)(struct mtd_info *mtd, int chip); 1601 void (*select_chip)(struct mtd_info *mtd, int chip);
1576 void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl); 1602 void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl);
1577 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); 1603 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
1578 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); 1604 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
1579 unsigned char (*read_byte)(struct mtd_info *mtd);
1580 void *priv; 1605 void *priv;
1581}; 1606};
1582 1607
@@ -1593,10 +1618,10 @@ struct platform_nand_data {
1593/* return the supported asynchronous timing mode. */ 1618/* return the supported asynchronous timing mode. */
1594static inline int onfi_get_async_timing_mode(struct nand_chip *chip) 1619static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
1595{ 1620{
1596 if (!chip->parameters.onfi.version) 1621 if (!chip->parameters.onfi)
1597 return ONFI_TIMING_MODE_UNKNOWN; 1622 return ONFI_TIMING_MODE_UNKNOWN;
1598 1623
1599 return chip->parameters.onfi.async_timing_mode; 1624 return chip->parameters.onfi->async_timing_mode;
1600} 1625}
1601 1626
1602int onfi_fill_data_interface(struct nand_chip *chip, 1627int onfi_fill_data_interface(struct nand_chip *chip,
@@ -1641,14 +1666,8 @@ int nand_check_erased_ecc_chunk(void *data, int datalen,
1641 void *extraoob, int extraooblen, 1666 void *extraoob, int extraooblen,
1642 int threshold); 1667 int threshold);
1643 1668
1644int nand_check_ecc_caps(struct nand_chip *chip, 1669int nand_ecc_choose_conf(struct nand_chip *chip,
1645 const struct nand_ecc_caps *caps, int oobavail); 1670 const struct nand_ecc_caps *caps, int oobavail);
1646
1647int nand_match_ecc_req(struct nand_chip *chip,
1648 const struct nand_ecc_caps *caps, int oobavail);
1649
1650int nand_maximize_ecc(struct nand_chip *chip,
1651 const struct nand_ecc_caps *caps, int oobavail);
1652 1671
1653/* Default write_oob implementation */ 1672/* Default write_oob implementation */
1654int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip, int page); 1673int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip, int page);
@@ -1674,10 +1693,14 @@ int nand_get_set_features_notsupp(struct mtd_info *mtd, struct nand_chip *chip,
1674/* Default read_page_raw implementation */ 1693/* Default read_page_raw implementation */
1675int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, 1694int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
1676 uint8_t *buf, int oob_required, int page); 1695 uint8_t *buf, int oob_required, int page);
1696int nand_read_page_raw_notsupp(struct mtd_info *mtd, struct nand_chip *chip,
1697 u8 *buf, int oob_required, int page);
1677 1698
1678/* Default write_page_raw implementation */ 1699/* Default write_page_raw implementation */
1679int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, 1700int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
1680 const uint8_t *buf, int oob_required, int page); 1701 const uint8_t *buf, int oob_required, int page);
1702int nand_write_page_raw_notsupp(struct mtd_info *mtd, struct nand_chip *chip,
1703 const u8 *buf, int oob_required, int page);
1681 1704
1682/* Reset and initialize a NAND device */ 1705/* Reset and initialize a NAND device */
1683int nand_reset(struct nand_chip *chip, int chipnr); 1706int nand_reset(struct nand_chip *chip, int chipnr);
@@ -1711,8 +1734,13 @@ int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len,
1711int nand_write_data_op(struct nand_chip *chip, const void *buf, 1734int nand_write_data_op(struct nand_chip *chip, const void *buf,
1712 unsigned int len, bool force_8bit); 1735 unsigned int len, bool force_8bit);
1713 1736
1714/* Free resources held by the NAND device */ 1737/*
1738 * Free resources held by the NAND device, must be called on error after a
1739 * sucessful nand_scan().
1740 */
1715void nand_cleanup(struct nand_chip *chip); 1741void nand_cleanup(struct nand_chip *chip);
1742/* Unregister the MTD device and calls nand_cleanup() */
1743void nand_release(struct mtd_info *mtd);
1716 1744
1717/* Default extended ID decoding function */ 1745/* Default extended ID decoding function */
1718void nand_decode_ext_id(struct nand_chip *chip); 1746void nand_decode_ext_id(struct nand_chip *chip);
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index e60da0d34cc1..c922e97f205a 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -235,6 +235,7 @@ enum spi_nor_option_flags {
235 SNOR_F_S3AN_ADDR_DEFAULT = BIT(3), 235 SNOR_F_S3AN_ADDR_DEFAULT = BIT(3),
236 SNOR_F_READY_XSR_RDY = BIT(4), 236 SNOR_F_READY_XSR_RDY = BIT(4),
237 SNOR_F_USE_CLSR = BIT(5), 237 SNOR_F_USE_CLSR = BIT(5),
238 SNOR_F_BROKEN_RESET = BIT(6),
238}; 239};
239 240
240/** 241/**
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
new file mode 100644
index 000000000000..088ff96c3eb6
--- /dev/null
+++ b/include/linux/mtd/spinand.h
@@ -0,0 +1,421 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2016-2017 Micron Technology, Inc.
4 *
5 * Authors:
6 * Peter Pan <peterpandong@micron.com>
7 */
8#ifndef __LINUX_MTD_SPINAND_H
9#define __LINUX_MTD_SPINAND_H
10
11#include <linux/mutex.h>
12#include <linux/bitops.h>
13#include <linux/device.h>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/nand.h>
16#include <linux/spi/spi.h>
17#include <linux/spi/spi-mem.h>
18
19/**
20 * Standard SPI NAND flash operations
21 */
22
23#define SPINAND_RESET_OP \
24 SPI_MEM_OP(SPI_MEM_OP_CMD(0xff, 1), \
25 SPI_MEM_OP_NO_ADDR, \
26 SPI_MEM_OP_NO_DUMMY, \
27 SPI_MEM_OP_NO_DATA)
28
29#define SPINAND_WR_EN_DIS_OP(enable) \
30 SPI_MEM_OP(SPI_MEM_OP_CMD((enable) ? 0x06 : 0x04, 1), \
31 SPI_MEM_OP_NO_ADDR, \
32 SPI_MEM_OP_NO_DUMMY, \
33 SPI_MEM_OP_NO_DATA)
34
35#define SPINAND_READID_OP(ndummy, buf, len) \
36 SPI_MEM_OP(SPI_MEM_OP_CMD(0x9f, 1), \
37 SPI_MEM_OP_NO_ADDR, \
38 SPI_MEM_OP_DUMMY(ndummy, 1), \
39 SPI_MEM_OP_DATA_IN(len, buf, 1))
40
41#define SPINAND_SET_FEATURE_OP(reg, valptr) \
42 SPI_MEM_OP(SPI_MEM_OP_CMD(0x1f, 1), \
43 SPI_MEM_OP_ADDR(1, reg, 1), \
44 SPI_MEM_OP_NO_DUMMY, \
45 SPI_MEM_OP_DATA_OUT(1, valptr, 1))
46
47#define SPINAND_GET_FEATURE_OP(reg, valptr) \
48 SPI_MEM_OP(SPI_MEM_OP_CMD(0x0f, 1), \
49 SPI_MEM_OP_ADDR(1, reg, 1), \
50 SPI_MEM_OP_NO_DUMMY, \
51 SPI_MEM_OP_DATA_IN(1, valptr, 1))
52
53#define SPINAND_BLK_ERASE_OP(addr) \
54 SPI_MEM_OP(SPI_MEM_OP_CMD(0xd8, 1), \
55 SPI_MEM_OP_ADDR(3, addr, 1), \
56 SPI_MEM_OP_NO_DUMMY, \
57 SPI_MEM_OP_NO_DATA)
58
59#define SPINAND_PAGE_READ_OP(addr) \
60 SPI_MEM_OP(SPI_MEM_OP_CMD(0x13, 1), \
61 SPI_MEM_OP_ADDR(3, addr, 1), \
62 SPI_MEM_OP_NO_DUMMY, \
63 SPI_MEM_OP_NO_DATA)
64
65#define SPINAND_PAGE_READ_FROM_CACHE_OP(fast, addr, ndummy, buf, len) \
66 SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \
67 SPI_MEM_OP_ADDR(2, addr, 1), \
68 SPI_MEM_OP_DUMMY(ndummy, 1), \
69 SPI_MEM_OP_DATA_IN(len, buf, 1))
70
71#define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \
72 SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \
73 SPI_MEM_OP_ADDR(2, addr, 1), \
74 SPI_MEM_OP_DUMMY(ndummy, 1), \
75 SPI_MEM_OP_DATA_IN(len, buf, 2))
76
77#define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \
78 SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \
79 SPI_MEM_OP_ADDR(2, addr, 1), \
80 SPI_MEM_OP_DUMMY(ndummy, 1), \
81 SPI_MEM_OP_DATA_IN(len, buf, 4))
82
83#define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \
84 SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
85 SPI_MEM_OP_ADDR(2, addr, 2), \
86 SPI_MEM_OP_DUMMY(ndummy, 2), \
87 SPI_MEM_OP_DATA_IN(len, buf, 2))
88
89#define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \
90 SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \
91 SPI_MEM_OP_ADDR(2, addr, 4), \
92 SPI_MEM_OP_DUMMY(ndummy, 4), \
93 SPI_MEM_OP_DATA_IN(len, buf, 4))
94
95#define SPINAND_PROG_EXEC_OP(addr) \
96 SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \
97 SPI_MEM_OP_ADDR(3, addr, 1), \
98 SPI_MEM_OP_NO_DUMMY, \
99 SPI_MEM_OP_NO_DATA)
100
101#define SPINAND_PROG_LOAD(reset, addr, buf, len) \
102 SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0x02 : 0x84, 1), \
103 SPI_MEM_OP_ADDR(2, addr, 1), \
104 SPI_MEM_OP_NO_DUMMY, \
105 SPI_MEM_OP_DATA_OUT(len, buf, 1))
106
107#define SPINAND_PROG_LOAD_X4(reset, addr, buf, len) \
108 SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0x32 : 0x34, 1), \
109 SPI_MEM_OP_ADDR(2, addr, 1), \
110 SPI_MEM_OP_NO_DUMMY, \
111 SPI_MEM_OP_DATA_OUT(len, buf, 4))
112
113/**
114 * Standard SPI NAND flash commands
115 */
116#define SPINAND_CMD_PROG_LOAD_X4 0x32
117#define SPINAND_CMD_PROG_LOAD_RDM_DATA_X4 0x34
118
119/* feature register */
120#define REG_BLOCK_LOCK 0xa0
121#define BL_ALL_UNLOCKED 0x00
122
123/* configuration register */
124#define REG_CFG 0xb0
125#define CFG_OTP_ENABLE BIT(6)
126#define CFG_ECC_ENABLE BIT(4)
127#define CFG_QUAD_ENABLE BIT(0)
128
129/* status register */
130#define REG_STATUS 0xc0
131#define STATUS_BUSY BIT(0)
132#define STATUS_ERASE_FAILED BIT(2)
133#define STATUS_PROG_FAILED BIT(3)
134#define STATUS_ECC_MASK GENMASK(5, 4)
135#define STATUS_ECC_NO_BITFLIPS (0 << 4)
136#define STATUS_ECC_HAS_BITFLIPS (1 << 4)
137#define STATUS_ECC_UNCOR_ERROR (2 << 4)
138
139struct spinand_op;
140struct spinand_device;
141
142#define SPINAND_MAX_ID_LEN 4
143
144/**
145 * struct spinand_id - SPI NAND id structure
146 * @data: buffer containing the id bytes. Currently 4 bytes large, but can
147 * be extended if required
148 * @len: ID length
149 *
150 * struct_spinand_id->data contains all bytes returned after a READ_ID command,
151 * including dummy bytes if the chip does not emit ID bytes right after the
152 * READ_ID command. The responsibility to extract real ID bytes is left to
153 * struct_manufacurer_ops->detect().
154 */
155struct spinand_id {
156 u8 data[SPINAND_MAX_ID_LEN];
157 int len;
158};
159
160/**
161 * struct manufacurer_ops - SPI NAND manufacturer specific operations
162 * @detect: detect a SPI NAND device. Every time a SPI NAND device is probed
163 * the core calls the struct_manufacurer_ops->detect() hook of each
164 * registered manufacturer until one of them return 1. Note that
165 * the first thing to check in this hook is that the manufacturer ID
166 * in struct_spinand_device->id matches the manufacturer whose
167 * ->detect() hook has been called. Should return 1 if there's a
168 * match, 0 if the manufacturer ID does not match and a negative
169 * error code otherwise. When true is returned, the core assumes
170 * that properties of the NAND chip (spinand->base.memorg and
171 * spinand->base.eccreq) have been filled
172 * @init: initialize a SPI NAND device
173 * @cleanup: cleanup a SPI NAND device
174 *
175 * Each SPI NAND manufacturer driver should implement this interface so that
176 * NAND chips coming from this vendor can be detected and initialized properly.
177 */
178struct spinand_manufacturer_ops {
179 int (*detect)(struct spinand_device *spinand);
180 int (*init)(struct spinand_device *spinand);
181 void (*cleanup)(struct spinand_device *spinand);
182};
183
184/**
185 * struct spinand_manufacturer - SPI NAND manufacturer instance
186 * @id: manufacturer ID
187 * @name: manufacturer name
188 * @ops: manufacturer operations
189 */
190struct spinand_manufacturer {
191 u8 id;
192 char *name;
193 const struct spinand_manufacturer_ops *ops;
194};
195
196/* SPI NAND manufacturers */
197extern const struct spinand_manufacturer macronix_spinand_manufacturer;
198extern const struct spinand_manufacturer micron_spinand_manufacturer;
199extern const struct spinand_manufacturer winbond_spinand_manufacturer;
200
201/**
202 * struct spinand_op_variants - SPI NAND operation variants
203 * @ops: the list of variants for a given operation
204 * @nops: the number of variants
205 *
206 * Some operations like read-from-cache/write-to-cache have several variants
207 * depending on the number of IO lines you use to transfer data or address
208 * cycles. This structure is a way to describe the different variants supported
209 * by a chip and let the core pick the best one based on the SPI mem controller
210 * capabilities.
211 */
212struct spinand_op_variants {
213 const struct spi_mem_op *ops;
214 unsigned int nops;
215};
216
217#define SPINAND_OP_VARIANTS(name, ...) \
218 const struct spinand_op_variants name = { \
219 .ops = (struct spi_mem_op[]) { __VA_ARGS__ }, \
220 .nops = sizeof((struct spi_mem_op[]){ __VA_ARGS__ }) / \
221 sizeof(struct spi_mem_op), \
222 }
223
224/**
225 * spinand_ecc_info - description of the on-die ECC implemented by a SPI NAND
226 * chip
227 * @get_status: get the ECC status. Should return a positive number encoding
228 * the number of corrected bitflips if correction was possible or
229 * -EBADMSG if there are uncorrectable errors. I can also return
230 * other negative error codes if the error is not caused by
231 * uncorrectable bitflips
232 * @ooblayout: the OOB layout used by the on-die ECC implementation
233 */
234struct spinand_ecc_info {
235 int (*get_status)(struct spinand_device *spinand, u8 status);
236 const struct mtd_ooblayout_ops *ooblayout;
237};
238
239#define SPINAND_HAS_QE_BIT BIT(0)
240
241/**
242 * struct spinand_info - Structure used to describe SPI NAND chips
243 * @model: model name
244 * @devid: device ID
245 * @flags: OR-ing of the SPINAND_XXX flags
246 * @memorg: memory organization
247 * @eccreq: ECC requirements
248 * @eccinfo: on-die ECC info
249 * @op_variants: operations variants
250 * @op_variants.read_cache: variants of the read-cache operation
251 * @op_variants.write_cache: variants of the write-cache operation
252 * @op_variants.update_cache: variants of the update-cache operation
253 * @select_target: function used to select a target/die. Required only for
254 * multi-die chips
255 *
256 * Each SPI NAND manufacturer driver should have a spinand_info table
257 * describing all the chips supported by the driver.
258 */
259struct spinand_info {
260 const char *model;
261 u8 devid;
262 u32 flags;
263 struct nand_memory_organization memorg;
264 struct nand_ecc_req eccreq;
265 struct spinand_ecc_info eccinfo;
266 struct {
267 const struct spinand_op_variants *read_cache;
268 const struct spinand_op_variants *write_cache;
269 const struct spinand_op_variants *update_cache;
270 } op_variants;
271 int (*select_target)(struct spinand_device *spinand,
272 unsigned int target);
273};
274
275#define SPINAND_INFO_OP_VARIANTS(__read, __write, __update) \
276 { \
277 .read_cache = __read, \
278 .write_cache = __write, \
279 .update_cache = __update, \
280 }
281
282#define SPINAND_ECCINFO(__ooblayout, __get_status) \
283 .eccinfo = { \
284 .ooblayout = __ooblayout, \
285 .get_status = __get_status, \
286 }
287
288#define SPINAND_SELECT_TARGET(__func) \
289 .select_target = __func,
290
291#define SPINAND_INFO(__model, __id, __memorg, __eccreq, __op_variants, \
292 __flags, ...) \
293 { \
294 .model = __model, \
295 .devid = __id, \
296 .memorg = __memorg, \
297 .eccreq = __eccreq, \
298 .op_variants = __op_variants, \
299 .flags = __flags, \
300 __VA_ARGS__ \
301 }
302
303/**
304 * struct spinand_device - SPI NAND device instance
305 * @base: NAND device instance
306 * @spimem: pointer to the SPI mem object
307 * @lock: lock used to serialize accesses to the NAND
308 * @id: NAND ID as returned by READ_ID
309 * @flags: NAND flags
310 * @op_templates: various SPI mem op templates
311 * @op_templates.read_cache: read cache op template
312 * @op_templates.write_cache: write cache op template
313 * @op_templates.update_cache: update cache op template
314 * @select_target: select a specific target/die. Usually called before sending
315 * a command addressing a page or an eraseblock embedded in
316 * this die. Only required if your chip exposes several dies
317 * @cur_target: currently selected target/die
318 * @eccinfo: on-die ECC information
319 * @cfg_cache: config register cache. One entry per die
320 * @databuf: bounce buffer for data
321 * @oobbuf: bounce buffer for OOB data
322 * @scratchbuf: buffer used for everything but page accesses. This is needed
323 * because the spi-mem interface explicitly requests that buffers
324 * passed in spi_mem_op be DMA-able, so we can't based the bufs on
325 * the stack
326 * @manufacturer: SPI NAND manufacturer information
327 * @priv: manufacturer private data
328 */
329struct spinand_device {
330 struct nand_device base;
331 struct spi_mem *spimem;
332 struct mutex lock;
333 struct spinand_id id;
334 u32 flags;
335
336 struct {
337 const struct spi_mem_op *read_cache;
338 const struct spi_mem_op *write_cache;
339 const struct spi_mem_op *update_cache;
340 } op_templates;
341
342 int (*select_target)(struct spinand_device *spinand,
343 unsigned int target);
344 unsigned int cur_target;
345
346 struct spinand_ecc_info eccinfo;
347
348 u8 *cfg_cache;
349 u8 *databuf;
350 u8 *oobbuf;
351 u8 *scratchbuf;
352 const struct spinand_manufacturer *manufacturer;
353 void *priv;
354};
355
356/**
357 * mtd_to_spinand() - Get the SPI NAND device attached to an MTD instance
358 * @mtd: MTD instance
359 *
360 * Return: the SPI NAND device attached to @mtd.
361 */
362static inline struct spinand_device *mtd_to_spinand(struct mtd_info *mtd)
363{
364 return container_of(mtd_to_nanddev(mtd), struct spinand_device, base);
365}
366
367/**
368 * spinand_to_mtd() - Get the MTD device embedded in a SPI NAND device
369 * @spinand: SPI NAND device
370 *
371 * Return: the MTD device embedded in @spinand.
372 */
373static inline struct mtd_info *spinand_to_mtd(struct spinand_device *spinand)
374{
375 return nanddev_to_mtd(&spinand->base);
376}
377
378/**
379 * nand_to_spinand() - Get the SPI NAND device embedding an NAND object
380 * @nand: NAND object
381 *
382 * Return: the SPI NAND device embedding @nand.
383 */
384static inline struct spinand_device *nand_to_spinand(struct nand_device *nand)
385{
386 return container_of(nand, struct spinand_device, base);
387}
388
389/**
390 * spinand_to_nand() - Get the NAND device embedded in a SPI NAND object
391 * @spinand: SPI NAND device
392 *
393 * Return: the NAND device embedded in @spinand.
394 */
395static inline struct nand_device *
396spinand_to_nand(struct spinand_device *spinand)
397{
398 return &spinand->base;
399}
400
401/**
402 * spinand_set_of_node - Attach a DT node to a SPI NAND device
403 * @spinand: SPI NAND device
404 * @np: DT node
405 *
406 * Attach a DT node to a SPI NAND device.
407 */
408static inline void spinand_set_of_node(struct spinand_device *spinand,
409 struct device_node *np)
410{
411 nanddev_set_of_node(&spinand->base, np);
412}
413
414int spinand_match_and_init(struct spinand_device *dev,
415 const struct spinand_info *table,
416 unsigned int table_size, u8 devid);
417
418int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
419int spinand_select_target(struct spinand_device *spinand, unsigned int target);
420
421#endif /* __LINUX_MTD_SPINAND_H */
diff --git a/include/linux/net.h b/include/linux/net.h
index 6554d3ba4396..e0930678c8bf 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -114,7 +114,7 @@ struct socket {
114 114
115 unsigned long flags; 115 unsigned long flags;
116 116
117 struct socket_wq __rcu *wq; 117 struct socket_wq *wq;
118 118
119 struct file *file; 119 struct file *file;
120 struct sock *sk; 120 struct sock *sk;
diff --git a/include/linux/net_dim.h b/include/linux/net_dim.h
index db99240d00bd..c79e859408e6 100644
--- a/include/linux/net_dim.h
+++ b/include/linux/net_dim.h
@@ -363,7 +363,6 @@ static inline void net_dim_sample(u16 event_ctr,
363} 363}
364 364
365#define NET_DIM_NEVENTS 64 365#define NET_DIM_NEVENTS 64
366#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
367#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1)) 366#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1))
368 367
369static inline void net_dim_calc_stats(struct net_dim_sample *start, 368static inline void net_dim_calc_stats(struct net_dim_sample *start,
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 623bb8ced060..2b2a6dce1630 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -79,6 +79,7 @@ enum {
79 NETIF_F_HW_ESP_TX_CSUM_BIT, /* ESP with TX checksum offload */ 79 NETIF_F_HW_ESP_TX_CSUM_BIT, /* ESP with TX checksum offload */
80 NETIF_F_RX_UDP_TUNNEL_PORT_BIT, /* Offload of RX port for UDP tunnels */ 80 NETIF_F_RX_UDP_TUNNEL_PORT_BIT, /* Offload of RX port for UDP tunnels */
81 NETIF_F_HW_TLS_TX_BIT, /* Hardware TLS TX offload */ 81 NETIF_F_HW_TLS_TX_BIT, /* Hardware TLS TX offload */
82 NETIF_F_HW_TLS_RX_BIT, /* Hardware TLS RX offload */
82 83
83 NETIF_F_GRO_HW_BIT, /* Hardware Generic receive offload */ 84 NETIF_F_GRO_HW_BIT, /* Hardware Generic receive offload */
84 NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */ 85 NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */
@@ -151,6 +152,7 @@ enum {
151#define NETIF_F_HW_TLS_RECORD __NETIF_F(HW_TLS_RECORD) 152#define NETIF_F_HW_TLS_RECORD __NETIF_F(HW_TLS_RECORD)
152#define NETIF_F_GSO_UDP_L4 __NETIF_F(GSO_UDP_L4) 153#define NETIF_F_GSO_UDP_L4 __NETIF_F(GSO_UDP_L4)
153#define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) 154#define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX)
155#define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX)
154 156
155#define for_each_netdev_feature(mask_addr, bit) \ 157#define for_each_netdev_feature(mask_addr, bit) \
156 for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) 158 for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3d0cc0b5cec2..ca5ab98053c8 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -302,6 +302,17 @@ struct netdev_boot_setup {
302 302
303int __init netdev_boot_setup(char *str); 303int __init netdev_boot_setup(char *str);
304 304
305struct gro_list {
306 struct list_head list;
307 int count;
308};
309
310/*
311 * size of gro hash buckets, must less than bit number of
312 * napi_struct::gro_bitmask
313 */
314#define GRO_HASH_BUCKETS 8
315
305/* 316/*
306 * Structure for NAPI scheduling similar to tasklet but with weighting 317 * Structure for NAPI scheduling similar to tasklet but with weighting
307 */ 318 */
@@ -316,13 +327,13 @@ struct napi_struct {
316 327
317 unsigned long state; 328 unsigned long state;
318 int weight; 329 int weight;
319 unsigned int gro_count; 330 unsigned long gro_bitmask;
320 int (*poll)(struct napi_struct *, int); 331 int (*poll)(struct napi_struct *, int);
321#ifdef CONFIG_NETPOLL 332#ifdef CONFIG_NETPOLL
322 int poll_owner; 333 int poll_owner;
323#endif 334#endif
324 struct net_device *dev; 335 struct net_device *dev;
325 struct sk_buff *gro_list; 336 struct gro_list gro_hash[GRO_HASH_BUCKETS];
326 struct sk_buff *skb; 337 struct sk_buff *skb;
327 struct hrtimer timer; 338 struct hrtimer timer;
328 struct list_head dev_list; 339 struct list_head dev_list;
@@ -569,6 +580,9 @@ struct netdev_queue {
569 * (/sys/class/net/DEV/Q/trans_timeout) 580 * (/sys/class/net/DEV/Q/trans_timeout)
570 */ 581 */
571 unsigned long trans_timeout; 582 unsigned long trans_timeout;
583
584 /* Subordinate device that the queue has been assigned to */
585 struct net_device *sb_dev;
572/* 586/*
573 * write-mostly part 587 * write-mostly part
574 */ 588 */
@@ -730,10 +744,15 @@ struct xps_map {
730 */ 744 */
731struct xps_dev_maps { 745struct xps_dev_maps {
732 struct rcu_head rcu; 746 struct rcu_head rcu;
733 struct xps_map __rcu *cpu_map[0]; 747 struct xps_map __rcu *attr_map[0]; /* Either CPUs map or RXQs map */
734}; 748};
735#define XPS_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \ 749
750#define XPS_CPU_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \
736 (nr_cpu_ids * (_tcs) * sizeof(struct xps_map *))) 751 (nr_cpu_ids * (_tcs) * sizeof(struct xps_map *)))
752
753#define XPS_RXQ_DEV_MAPS_SIZE(_tcs, _rxqs) (sizeof(struct xps_dev_maps) +\
754 (_rxqs * (_tcs) * sizeof(struct xps_map *)))
755
737#endif /* CONFIG_XPS */ 756#endif /* CONFIG_XPS */
738 757
739#define TC_MAX_QUEUE 16 758#define TC_MAX_QUEUE 16
@@ -779,7 +798,8 @@ static inline bool netdev_phys_item_id_same(struct netdev_phys_item_id *a,
779} 798}
780 799
781typedef u16 (*select_queue_fallback_t)(struct net_device *dev, 800typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
782 struct sk_buff *skb); 801 struct sk_buff *skb,
802 struct net_device *sb_dev);
783 803
784enum tc_setup_type { 804enum tc_setup_type {
785 TC_SETUP_QDISC_MQPRIO, 805 TC_SETUP_QDISC_MQPRIO,
@@ -792,6 +812,7 @@ enum tc_setup_type {
792 TC_SETUP_QDISC_RED, 812 TC_SETUP_QDISC_RED,
793 TC_SETUP_QDISC_PRIO, 813 TC_SETUP_QDISC_PRIO,
794 TC_SETUP_QDISC_MQ, 814 TC_SETUP_QDISC_MQ,
815 TC_SETUP_QDISC_ETF,
795}; 816};
796 817
797/* These structures hold the attributes of bpf state that are being passed 818/* These structures hold the attributes of bpf state that are being passed
@@ -807,11 +828,8 @@ enum bpf_netdev_command {
807 */ 828 */
808 XDP_SETUP_PROG, 829 XDP_SETUP_PROG,
809 XDP_SETUP_PROG_HW, 830 XDP_SETUP_PROG_HW,
810 /* Check if a bpf program is set on the device. The callee should
811 * set @prog_attached to one of XDP_ATTACHED_* values, note that "true"
812 * is equivalent to XDP_ATTACHED_DRV.
813 */
814 XDP_QUERY_PROG, 831 XDP_QUERY_PROG,
832 XDP_QUERY_PROG_HW,
815 /* BPF program for offload callbacks, invoked at program load time. */ 833 /* BPF program for offload callbacks, invoked at program load time. */
816 BPF_OFFLOAD_VERIFIER_PREP, 834 BPF_OFFLOAD_VERIFIER_PREP,
817 BPF_OFFLOAD_TRANSLATE, 835 BPF_OFFLOAD_TRANSLATE,
@@ -835,9 +853,8 @@ struct netdev_bpf {
835 struct bpf_prog *prog; 853 struct bpf_prog *prog;
836 struct netlink_ext_ack *extack; 854 struct netlink_ext_ack *extack;
837 }; 855 };
838 /* XDP_QUERY_PROG */ 856 /* XDP_QUERY_PROG, XDP_QUERY_PROG_HW */
839 struct { 857 struct {
840 u8 prog_attached;
841 u32 prog_id; 858 u32 prog_id;
842 /* flags with which program was installed */ 859 /* flags with which program was installed */
843 u32 prog_flags; 860 u32 prog_flags;
@@ -855,10 +872,10 @@ struct netdev_bpf {
855 struct { 872 struct {
856 struct bpf_offloaded_map *offmap; 873 struct bpf_offloaded_map *offmap;
857 }; 874 };
858 /* XDP_SETUP_XSK_UMEM */ 875 /* XDP_QUERY_XSK_UMEM, XDP_SETUP_XSK_UMEM */
859 struct { 876 struct {
860 struct xdp_umem *umem; 877 struct xdp_umem *umem; /* out for query*/
861 u16 queue_id; 878 u16 queue_id; /* in for query */
862 } xsk; 879 } xsk;
863 }; 880 };
864}; 881};
@@ -891,6 +908,8 @@ struct tlsdev_ops {
891 void (*tls_dev_del)(struct net_device *netdev, 908 void (*tls_dev_del)(struct net_device *netdev,
892 struct tls_context *ctx, 909 struct tls_context *ctx,
893 enum tls_offload_ctx_dir direction); 910 enum tls_offload_ctx_dir direction);
911 void (*tls_dev_resync_rx)(struct net_device *netdev,
912 struct sock *sk, u32 seq, u64 rcd_sn);
894}; 913};
895#endif 914#endif
896 915
@@ -942,7 +961,8 @@ struct dev_ifalias {
942 * those the driver believes to be appropriate. 961 * those the driver believes to be appropriate.
943 * 962 *
944 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, 963 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,
945 * void *accel_priv, select_queue_fallback_t fallback); 964 * struct net_device *sb_dev,
965 * select_queue_fallback_t fallback);
946 * Called to decide which queue to use when device supports multiple 966 * Called to decide which queue to use when device supports multiple
947 * transmit queues. 967 * transmit queues.
948 * 968 *
@@ -1214,7 +1234,7 @@ struct net_device_ops {
1214 netdev_features_t features); 1234 netdev_features_t features);
1215 u16 (*ndo_select_queue)(struct net_device *dev, 1235 u16 (*ndo_select_queue)(struct net_device *dev,
1216 struct sk_buff *skb, 1236 struct sk_buff *skb,
1217 void *accel_priv, 1237 struct net_device *sb_dev,
1218 select_queue_fallback_t fallback); 1238 select_queue_fallback_t fallback);
1219 void (*ndo_change_rx_flags)(struct net_device *dev, 1239 void (*ndo_change_rx_flags)(struct net_device *dev,
1220 int flags); 1240 int flags);
@@ -1909,7 +1929,8 @@ struct net_device {
1909 int watchdog_timeo; 1929 int watchdog_timeo;
1910 1930
1911#ifdef CONFIG_XPS 1931#ifdef CONFIG_XPS
1912 struct xps_dev_maps __rcu *xps_maps; 1932 struct xps_dev_maps __rcu *xps_cpus_map;
1933 struct xps_dev_maps __rcu *xps_rxqs_map;
1913#endif 1934#endif
1914#ifdef CONFIG_NET_CLS_ACT 1935#ifdef CONFIG_NET_CLS_ACT
1915 struct mini_Qdisc __rcu *miniq_egress; 1936 struct mini_Qdisc __rcu *miniq_egress;
@@ -1978,7 +1999,7 @@ struct net_device {
1978#ifdef CONFIG_DCB 1999#ifdef CONFIG_DCB
1979 const struct dcbnl_rtnl_ops *dcbnl_ops; 2000 const struct dcbnl_rtnl_ops *dcbnl_ops;
1980#endif 2001#endif
1981 u8 num_tc; 2002 s16 num_tc;
1982 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; 2003 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
1983 u8 prio_tc_map[TC_BITMASK + 1]; 2004 u8 prio_tc_map[TC_BITMASK + 1];
1984 2005
@@ -2032,6 +2053,17 @@ int netdev_get_num_tc(struct net_device *dev)
2032 return dev->num_tc; 2053 return dev->num_tc;
2033} 2054}
2034 2055
2056void netdev_unbind_sb_channel(struct net_device *dev,
2057 struct net_device *sb_dev);
2058int netdev_bind_sb_channel_queue(struct net_device *dev,
2059 struct net_device *sb_dev,
2060 u8 tc, u16 count, u16 offset);
2061int netdev_set_sb_channel(struct net_device *dev, u16 channel);
2062static inline int netdev_get_sb_channel(struct net_device *dev)
2063{
2064 return max_t(int, -dev->num_tc, 0);
2065}
2066
2035static inline 2067static inline
2036struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, 2068struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
2037 unsigned int index) 2069 unsigned int index)
@@ -2076,7 +2108,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
2076 2108
2077struct netdev_queue *netdev_pick_tx(struct net_device *dev, 2109struct netdev_queue *netdev_pick_tx(struct net_device *dev,
2078 struct sk_buff *skb, 2110 struct sk_buff *skb,
2079 void *accel_priv); 2111 struct net_device *sb_dev);
2080 2112
2081/* returns the headroom that the master device needs to take in account 2113/* returns the headroom that the master device needs to take in account
2082 * when forwarding to this dev 2114 * when forwarding to this dev
@@ -2255,10 +2287,10 @@ static inline int gro_recursion_inc_test(struct sk_buff *skb)
2255 return ++NAPI_GRO_CB(skb)->recursion_counter == GRO_RECURSION_LIMIT; 2287 return ++NAPI_GRO_CB(skb)->recursion_counter == GRO_RECURSION_LIMIT;
2256} 2288}
2257 2289
2258typedef struct sk_buff **(*gro_receive_t)(struct sk_buff **, struct sk_buff *); 2290typedef struct sk_buff *(*gro_receive_t)(struct list_head *, struct sk_buff *);
2259static inline struct sk_buff **call_gro_receive(gro_receive_t cb, 2291static inline struct sk_buff *call_gro_receive(gro_receive_t cb,
2260 struct sk_buff **head, 2292 struct list_head *head,
2261 struct sk_buff *skb) 2293 struct sk_buff *skb)
2262{ 2294{
2263 if (unlikely(gro_recursion_inc_test(skb))) { 2295 if (unlikely(gro_recursion_inc_test(skb))) {
2264 NAPI_GRO_CB(skb)->flush |= 1; 2296 NAPI_GRO_CB(skb)->flush |= 1;
@@ -2268,12 +2300,12 @@ static inline struct sk_buff **call_gro_receive(gro_receive_t cb,
2268 return cb(head, skb); 2300 return cb(head, skb);
2269} 2301}
2270 2302
2271typedef struct sk_buff **(*gro_receive_sk_t)(struct sock *, struct sk_buff **, 2303typedef struct sk_buff *(*gro_receive_sk_t)(struct sock *, struct list_head *,
2272 struct sk_buff *); 2304 struct sk_buff *);
2273static inline struct sk_buff **call_gro_receive_sk(gro_receive_sk_t cb, 2305static inline struct sk_buff *call_gro_receive_sk(gro_receive_sk_t cb,
2274 struct sock *sk, 2306 struct sock *sk,
2275 struct sk_buff **head, 2307 struct list_head *head,
2276 struct sk_buff *skb) 2308 struct sk_buff *skb)
2277{ 2309{
2278 if (unlikely(gro_recursion_inc_test(skb))) { 2310 if (unlikely(gro_recursion_inc_test(skb))) {
2279 NAPI_GRO_CB(skb)->flush |= 1; 2311 NAPI_GRO_CB(skb)->flush |= 1;
@@ -2290,6 +2322,9 @@ struct packet_type {
2290 struct net_device *, 2322 struct net_device *,
2291 struct packet_type *, 2323 struct packet_type *,
2292 struct net_device *); 2324 struct net_device *);
2325 void (*list_func) (struct list_head *,
2326 struct packet_type *,
2327 struct net_device *);
2293 bool (*id_match)(struct packet_type *ptype, 2328 bool (*id_match)(struct packet_type *ptype,
2294 struct sock *sk); 2329 struct sock *sk);
2295 void *af_packet_priv; 2330 void *af_packet_priv;
@@ -2299,8 +2334,8 @@ struct packet_type {
2299struct offload_callbacks { 2334struct offload_callbacks {
2300 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 2335 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
2301 netdev_features_t features); 2336 netdev_features_t features);
2302 struct sk_buff **(*gro_receive)(struct sk_buff **head, 2337 struct sk_buff *(*gro_receive)(struct list_head *head,
2303 struct sk_buff *skb); 2338 struct sk_buff *skb);
2304 int (*gro_complete)(struct sk_buff *skb, int nhoff); 2339 int (*gro_complete)(struct sk_buff *skb, int nhoff);
2305}; 2340};
2306 2341
@@ -2537,8 +2572,14 @@ void dev_close(struct net_device *dev);
2537void dev_close_many(struct list_head *head, bool unlink); 2572void dev_close_many(struct list_head *head, bool unlink);
2538void dev_disable_lro(struct net_device *dev); 2573void dev_disable_lro(struct net_device *dev);
2539int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb); 2574int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb);
2575u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb,
2576 struct net_device *sb_dev,
2577 select_queue_fallback_t fallback);
2578u16 dev_pick_tx_cpu_id(struct net_device *dev, struct sk_buff *skb,
2579 struct net_device *sb_dev,
2580 select_queue_fallback_t fallback);
2540int dev_queue_xmit(struct sk_buff *skb); 2581int dev_queue_xmit(struct sk_buff *skb);
2541int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv); 2582int dev_queue_xmit_accel(struct sk_buff *skb, struct net_device *sb_dev);
2542int dev_direct_xmit(struct sk_buff *skb, u16 queue_id); 2583int dev_direct_xmit(struct sk_buff *skb, u16 queue_id);
2543int register_netdevice(struct net_device *dev); 2584int register_netdevice(struct net_device *dev);
2544void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); 2585void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
@@ -2568,7 +2609,7 @@ struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
2568struct net_device *dev_get_by_napi_id(unsigned int napi_id); 2609struct net_device *dev_get_by_napi_id(unsigned int napi_id);
2569int netdev_get_name(struct net *net, char *name, int ifindex); 2610int netdev_get_name(struct net *net, char *name, int ifindex);
2570int dev_restart(struct net_device *dev); 2611int dev_restart(struct net_device *dev);
2571int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); 2612int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
2572 2613
2573static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 2614static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
2574{ 2615{
@@ -2784,13 +2825,13 @@ static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
2784} 2825}
2785 2826
2786#ifdef CONFIG_XFRM_OFFLOAD 2827#ifdef CONFIG_XFRM_OFFLOAD
2787static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff **pp, int flush) 2828static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff *pp, int flush)
2788{ 2829{
2789 if (PTR_ERR(pp) != -EINPROGRESS) 2830 if (PTR_ERR(pp) != -EINPROGRESS)
2790 NAPI_GRO_CB(skb)->flush |= flush; 2831 NAPI_GRO_CB(skb)->flush |= flush;
2791} 2832}
2792static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb, 2833static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb,
2793 struct sk_buff **pp, 2834 struct sk_buff *pp,
2794 int flush, 2835 int flush,
2795 struct gro_remcsum *grc) 2836 struct gro_remcsum *grc)
2796{ 2837{
@@ -2801,12 +2842,12 @@ static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb,
2801 } 2842 }
2802} 2843}
2803#else 2844#else
2804static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff **pp, int flush) 2845static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff *pp, int flush)
2805{ 2846{
2806 NAPI_GRO_CB(skb)->flush |= flush; 2847 NAPI_GRO_CB(skb)->flush |= flush;
2807} 2848}
2808static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb, 2849static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb,
2809 struct sk_buff **pp, 2850 struct sk_buff *pp,
2810 int flush, 2851 int flush,
2811 struct gro_remcsum *grc) 2852 struct gro_remcsum *grc)
2812{ 2853{
@@ -3278,6 +3319,92 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
3278#ifdef CONFIG_XPS 3319#ifdef CONFIG_XPS
3279int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 3320int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
3280 u16 index); 3321 u16 index);
3322int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask,
3323 u16 index, bool is_rxqs_map);
3324
3325/**
3326 * netif_attr_test_mask - Test a CPU or Rx queue set in a mask
3327 * @j: CPU/Rx queue index
3328 * @mask: bitmask of all cpus/rx queues
3329 * @nr_bits: number of bits in the bitmask
3330 *
3331 * Test if a CPU or Rx queue index is set in a mask of all CPU/Rx queues.
3332 */
3333static inline bool netif_attr_test_mask(unsigned long j,
3334 const unsigned long *mask,
3335 unsigned int nr_bits)
3336{
3337 cpu_max_bits_warn(j, nr_bits);
3338 return test_bit(j, mask);
3339}
3340
3341/**
3342 * netif_attr_test_online - Test for online CPU/Rx queue
3343 * @j: CPU/Rx queue index
3344 * @online_mask: bitmask for CPUs/Rx queues that are online
3345 * @nr_bits: number of bits in the bitmask
3346 *
3347 * Returns true if a CPU/Rx queue is online.
3348 */
3349static inline bool netif_attr_test_online(unsigned long j,
3350 const unsigned long *online_mask,
3351 unsigned int nr_bits)
3352{
3353 cpu_max_bits_warn(j, nr_bits);
3354
3355 if (online_mask)
3356 return test_bit(j, online_mask);
3357
3358 return (j < nr_bits);
3359}
3360
3361/**
3362 * netif_attrmask_next - get the next CPU/Rx queue in a cpu/Rx queues mask
3363 * @n: CPU/Rx queue index
3364 * @srcp: the cpumask/Rx queue mask pointer
3365 * @nr_bits: number of bits in the bitmask
3366 *
3367 * Returns >= nr_bits if no further CPUs/Rx queues set.
3368 */
3369static inline unsigned int netif_attrmask_next(int n, const unsigned long *srcp,
3370 unsigned int nr_bits)
3371{
3372 /* -1 is a legal arg here. */
3373 if (n != -1)
3374 cpu_max_bits_warn(n, nr_bits);
3375
3376 if (srcp)
3377 return find_next_bit(srcp, nr_bits, n + 1);
3378
3379 return n + 1;
3380}
3381
3382/**
3383 * netif_attrmask_next_and - get the next CPU/Rx queue in *src1p & *src2p
3384 * @n: CPU/Rx queue index
3385 * @src1p: the first CPUs/Rx queues mask pointer
3386 * @src2p: the second CPUs/Rx queues mask pointer
3387 * @nr_bits: number of bits in the bitmask
3388 *
3389 * Returns >= nr_bits if no further CPUs/Rx queues set in both.
3390 */
3391static inline int netif_attrmask_next_and(int n, const unsigned long *src1p,
3392 const unsigned long *src2p,
3393 unsigned int nr_bits)
3394{
3395 /* -1 is a legal arg here. */
3396 if (n != -1)
3397 cpu_max_bits_warn(n, nr_bits);
3398
3399 if (src1p && src2p)
3400 return find_next_and_bit(src1p, src2p, nr_bits, n + 1);
3401 else if (src1p)
3402 return find_next_bit(src1p, nr_bits, n + 1);
3403 else if (src2p)
3404 return find_next_bit(src2p, nr_bits, n + 1);
3405
3406 return n + 1;
3407}
3281#else 3408#else
3282static inline int netif_set_xps_queue(struct net_device *dev, 3409static inline int netif_set_xps_queue(struct net_device *dev,
3283 const struct cpumask *mask, 3410 const struct cpumask *mask,
@@ -3285,6 +3412,13 @@ static inline int netif_set_xps_queue(struct net_device *dev,
3285{ 3412{
3286 return 0; 3413 return 0;
3287} 3414}
3415
3416static inline int __netif_set_xps_queue(struct net_device *dev,
3417 const unsigned long *mask,
3418 u16 index, bool is_rxqs_map)
3419{
3420 return 0;
3421}
3288#endif 3422#endif
3289 3423
3290/** 3424/**
@@ -3304,8 +3438,9 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq);
3304int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq); 3438int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq);
3305#else 3439#else
3306static inline int netif_set_real_num_rx_queues(struct net_device *dev, 3440static inline int netif_set_real_num_rx_queues(struct net_device *dev,
3307 unsigned int rxq) 3441 unsigned int rxqs)
3308{ 3442{
3443 dev->real_num_rx_queues = rxqs;
3309 return 0; 3444 return 0;
3310} 3445}
3311#endif 3446#endif
@@ -3384,6 +3519,7 @@ int netif_rx(struct sk_buff *skb);
3384int netif_rx_ni(struct sk_buff *skb); 3519int netif_rx_ni(struct sk_buff *skb);
3385int netif_receive_skb(struct sk_buff *skb); 3520int netif_receive_skb(struct sk_buff *skb);
3386int netif_receive_skb_core(struct sk_buff *skb); 3521int netif_receive_skb_core(struct sk_buff *skb);
3522void netif_receive_skb_list(struct list_head *head);
3387gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); 3523gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
3388void napi_gro_flush(struct napi_struct *napi, bool flush_old); 3524void napi_gro_flush(struct napi_struct *napi, bool flush_old);
3389struct sk_buff *napi_get_frags(struct napi_struct *napi); 3525struct sk_buff *napi_get_frags(struct napi_struct *napi);
@@ -3418,6 +3554,8 @@ int dev_set_alias(struct net_device *, const char *, size_t);
3418int dev_get_alias(const struct net_device *, char *, size_t); 3554int dev_get_alias(const struct net_device *, char *, size_t);
3419int dev_change_net_namespace(struct net_device *, struct net *, const char *); 3555int dev_change_net_namespace(struct net_device *, struct net *, const char *);
3420int __dev_set_mtu(struct net_device *, int); 3556int __dev_set_mtu(struct net_device *, int);
3557int dev_set_mtu_ext(struct net_device *dev, int mtu,
3558 struct netlink_ext_ack *extack);
3421int dev_set_mtu(struct net_device *, int); 3559int dev_set_mtu(struct net_device *, int);
3422int dev_change_tx_queue_len(struct net_device *, unsigned long); 3560int dev_change_tx_queue_len(struct net_device *, unsigned long);
3423void dev_set_group(struct net_device *, int); 3561void dev_set_group(struct net_device *, int);
@@ -3435,8 +3573,9 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
3435typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf); 3573typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf);
3436int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, 3574int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
3437 int fd, u32 flags); 3575 int fd, u32 flags);
3438void __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op, 3576u32 __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op,
3439 struct netdev_bpf *xdp); 3577 enum bpf_netdev_command cmd);
3578int xdp_umem_query(struct net_device *dev, u16 queue_id);
3440 3579
3441int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 3580int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
3442int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 3581int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index dd2052f0efb7..07efffd0c759 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -288,6 +288,24 @@ NF_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, struct
288 return ret; 288 return ret;
289} 289}
290 290
291static inline void
292NF_HOOK_LIST(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk,
293 struct list_head *head, struct net_device *in, struct net_device *out,
294 int (*okfn)(struct net *, struct sock *, struct sk_buff *))
295{
296 struct sk_buff *skb, *next;
297 struct list_head sublist;
298
299 INIT_LIST_HEAD(&sublist);
300 list_for_each_entry_safe(skb, next, head, list) {
301 list_del(&skb->list);
302 if (nf_hook(pf, hook, net, sk, skb, in, out, okfn) == 1)
303 list_add_tail(&skb->list, &sublist);
304 }
305 /* Put passed packets back on main list */
306 list_splice(&sublist, head);
307}
308
291/* Call setsockopt() */ 309/* Call setsockopt() */
292int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 310int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
293 unsigned int len); 311 unsigned int len);
@@ -369,6 +387,14 @@ NF_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk,
369 return okfn(net, sk, skb); 387 return okfn(net, sk, skb);
370} 388}
371 389
390static inline void
391NF_HOOK_LIST(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk,
392 struct list_head *head, struct net_device *in, struct net_device *out,
393 int (*okfn)(struct net *, struct sock *, struct sk_buff *))
394{
395 /* nothing to do */
396}
397
372static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, 398static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net,
373 struct sock *sk, struct sk_buff *skb, 399 struct sock *sk, struct sk_buff *skb,
374 struct net_device *indev, struct net_device *outdev, 400 struct net_device *indev, struct net_device *outdev,
@@ -388,8 +414,17 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
388 414
389extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu; 415extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu;
390void nf_ct_attach(struct sk_buff *, const struct sk_buff *); 416void nf_ct_attach(struct sk_buff *, const struct sk_buff *);
417struct nf_conntrack_tuple;
418bool nf_ct_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple,
419 const struct sk_buff *skb);
391#else 420#else
392static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 421static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
422struct nf_conntrack_tuple;
423static inline bool nf_ct_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple,
424 const struct sk_buff *skb)
425{
426 return false;
427}
393#endif 428#endif
394 429
395struct nf_conn; 430struct nf_conn;
@@ -398,6 +433,8 @@ enum ip_conntrack_info;
398struct nf_ct_hook { 433struct nf_ct_hook {
399 int (*update)(struct net *net, struct sk_buff *skb); 434 int (*update)(struct net *net, struct sk_buff *skb);
400 void (*destroy)(struct nf_conntrack *); 435 void (*destroy)(struct nf_conntrack *);
436 bool (*get_tuple_skb)(struct nf_conntrack_tuple *,
437 const struct sk_buff *);
401}; 438};
402extern struct nf_ct_hook __rcu *nf_ct_hook; 439extern struct nf_ct_hook __rcu *nf_ct_hook;
403 440
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 3ecc3050be0e..4a520d3304a2 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -29,6 +29,7 @@ struct nfnetlink_subsystem {
29 __u8 subsys_id; /* nfnetlink subsystem ID */ 29 __u8 subsys_id; /* nfnetlink subsystem ID */
30 __u8 cb_count; /* number of callbacks */ 30 __u8 cb_count; /* number of callbacks */
31 const struct nfnl_callback *cb; /* callback for individual types */ 31 const struct nfnl_callback *cb; /* callback for individual types */
32 struct module *owner;
32 int (*commit)(struct net *net, struct sk_buff *skb); 33 int (*commit)(struct net *net, struct sk_buff *skb);
33 int (*abort)(struct net *net, struct sk_buff *skb); 34 int (*abort)(struct net *net, struct sk_buff *skb);
34 void (*cleanup)(struct net *net); 35 void (*cleanup)(struct net *net);
diff --git a/include/linux/netfilter/nf_osf.h b/include/linux/netfilter/nfnetlink_osf.h
index 0e114c492fb8..ecf7dab81e9e 100644
--- a/include/linux/netfilter/nf_osf.h
+++ b/include/linux/netfilter/nfnetlink_osf.h
@@ -1,16 +1,8 @@
1#include <uapi/linux/netfilter/nf_osf.h> 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _NFOSF_H
3#define _NFOSF_H
2 4
3/* Initial window size option state machine: multiple of mss, mtu or 5#include <uapi/linux/netfilter/nfnetlink_osf.h>
4 * plain numeric value. Can also be made as plain numeric value which
5 * is not a multiple of specified value.
6 */
7enum nf_osf_window_size_options {
8 OSF_WSS_PLAIN = 0,
9 OSF_WSS_MSS,
10 OSF_WSS_MTU,
11 OSF_WSS_MODULO,
12 OSF_WSS_MAX,
13};
14 6
15enum osf_fmatch_states { 7enum osf_fmatch_states {
16 /* Packet does not match the fingerprint */ 8 /* Packet does not match the fingerprint */
@@ -21,6 +13,8 @@ enum osf_fmatch_states {
21 FMATCH_OPT_WRONG, 13 FMATCH_OPT_WRONG,
22}; 14};
23 15
16extern struct list_head nf_osf_fingers[2];
17
24struct nf_osf_finger { 18struct nf_osf_finger {
25 struct rcu_head rcu_head; 19 struct rcu_head rcu_head;
26 struct list_head finger_entry; 20 struct list_head finger_entry;
@@ -31,3 +25,8 @@ bool nf_osf_match(const struct sk_buff *skb, u_int8_t family,
31 int hooknum, struct net_device *in, struct net_device *out, 25 int hooknum, struct net_device *in, struct net_device *out,
32 const struct nf_osf_info *info, struct net *net, 26 const struct nf_osf_info *info, struct net *net,
33 const struct list_head *nf_osf_fingers); 27 const struct list_head *nf_osf_fingers);
28
29const char *nf_osf_find(const struct sk_buff *skb,
30 const struct list_head *nf_osf_fingers);
31
32#endif /* _NFOSF_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index b671fdfd212b..fa0686500970 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -5,17 +5,6 @@
5#include <uapi/linux/netfilter_bridge.h> 5#include <uapi/linux/netfilter_bridge.h>
6#include <linux/skbuff.h> 6#include <linux/skbuff.h>
7 7
8enum nf_br_hook_priorities {
9 NF_BR_PRI_FIRST = INT_MIN,
10 NF_BR_PRI_NAT_DST_BRIDGED = -300,
11 NF_BR_PRI_FILTER_BRIDGED = -200,
12 NF_BR_PRI_BRNF = 0,
13 NF_BR_PRI_NAT_DST_OTHER = 100,
14 NF_BR_PRI_FILTER_OTHER = 200,
15 NF_BR_PRI_NAT_SRC = 300,
16 NF_BR_PRI_LAST = INT_MAX,
17};
18
19#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 8#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
20 9
21int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb); 10int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb);
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index b31dabfdb453..95ab5cc64422 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -23,9 +23,6 @@ struct nf_queue_entry;
23#ifdef CONFIG_INET 23#ifdef CONFIG_INET
24__sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 24__sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
25 unsigned int dataoff, u_int8_t protocol); 25 unsigned int dataoff, u_int8_t protocol);
26__sum16 nf_ip_checksum_partial(struct sk_buff *skb, unsigned int hook,
27 unsigned int dataoff, unsigned int len,
28 u_int8_t protocol);
29int nf_ip_route(struct net *net, struct dst_entry **dst, struct flowi *fl, 26int nf_ip_route(struct net *net, struct dst_entry **dst, struct flowi *fl,
30 bool strict); 27 bool strict);
31int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry); 28int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry);
@@ -35,14 +32,6 @@ static inline __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
35{ 32{
36 return 0; 33 return 0;
37} 34}
38static inline __sum16 nf_ip_checksum_partial(struct sk_buff *skb,
39 unsigned int hook,
40 unsigned int dataoff,
41 unsigned int len,
42 u_int8_t protocol)
43{
44 return 0;
45}
46static inline int nf_ip_route(struct net *net, struct dst_entry **dst, 35static inline int nf_ip_route(struct net *net, struct dst_entry **dst,
47 struct flowi *fl, bool strict) 36 struct flowi *fl, bool strict)
48{ 37{
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 288c597e75b3..c0dc4dd78887 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -30,11 +30,6 @@ struct nf_ipv6_ops {
30 void (*route_input)(struct sk_buff *skb); 30 void (*route_input)(struct sk_buff *skb);
31 int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, 31 int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
32 int (*output)(struct net *, struct sock *, struct sk_buff *)); 32 int (*output)(struct net *, struct sock *, struct sk_buff *));
33 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
34 unsigned int dataoff, u_int8_t protocol);
35 __sum16 (*checksum_partial)(struct sk_buff *skb, unsigned int hook,
36 unsigned int dataoff, unsigned int len,
37 u_int8_t protocol);
38 int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl, 33 int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl,
39 bool strict); 34 bool strict);
40 int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry); 35 int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry);
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index f3075d6c7e82..71f121b66ca8 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -170,7 +170,6 @@ netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
170struct netlink_callback { 170struct netlink_callback {
171 struct sk_buff *skb; 171 struct sk_buff *skb;
172 const struct nlmsghdr *nlh; 172 const struct nlmsghdr *nlh;
173 int (*start)(struct netlink_callback *);
174 int (*dump)(struct sk_buff * skb, 173 int (*dump)(struct sk_buff * skb,
175 struct netlink_callback *cb); 174 struct netlink_callback *cb);
176 int (*done)(struct netlink_callback *cb); 175 int (*done)(struct netlink_callback *cb);
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 57ffaa20d564..1b06f0b28453 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -374,6 +374,13 @@ enum lock_type4 {
374 NFS4_WRITEW_LT = 4 374 NFS4_WRITEW_LT = 4
375}; 375};
376 376
377enum change_attr_type4 {
378 NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR = 0,
379 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER = 1,
380 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS = 2,
381 NFS4_CHANGE_TYPE_IS_TIME_METADATA = 3,
382 NFS4_CHANGE_TYPE_IS_UNDEFINED = 4
383};
377 384
378/* Mandatory Attributes */ 385/* Mandatory Attributes */
379#define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0) 386#define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0)
@@ -441,6 +448,7 @@ enum lock_type4 {
441#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 448#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
442#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 449#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
443#define FATTR4_WORD2_CLONE_BLKSIZE (1UL << 13) 450#define FATTR4_WORD2_CLONE_BLKSIZE (1UL << 13)
451#define FATTR4_WORD2_CHANGE_ATTR_TYPE (1UL << 15)
444#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16) 452#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
445#define FATTR4_WORD2_MODE_UMASK (1UL << 17) 453#define FATTR4_WORD2_MODE_UMASK (1UL << 17)
446 454
@@ -527,6 +535,7 @@ enum {
527 NFSPROC4_CLNT_LAYOUTSTATS, 535 NFSPROC4_CLNT_LAYOUTSTATS,
528 NFSPROC4_CLNT_CLONE, 536 NFSPROC4_CLNT_CLONE,
529 NFSPROC4_CLNT_COPY, 537 NFSPROC4_CLNT_COPY,
538 NFSPROC4_CLNT_OFFLOAD_CANCEL,
530 539
531 NFSPROC4_CLNT_LOOKUPP, 540 NFSPROC4_CLNT_LOOKUPP,
532}; 541};
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2f129bbfaae8..a0831e9d19c9 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -185,6 +185,17 @@ struct nfs_inode {
185 struct inode vfs_inode; 185 struct inode vfs_inode;
186}; 186};
187 187
188struct nfs4_copy_state {
189 struct list_head copies;
190 nfs4_stateid stateid;
191 struct completion completion;
192 uint64_t count;
193 struct nfs_writeverf verf;
194 int error;
195 int flags;
196 struct nfs4_state *parent_state;
197};
198
188/* 199/*
189 * Access bit flags 200 * Access bit flags
190 */ 201 */
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 74ae3e1d19a0..bf39d9c92201 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -28,7 +28,6 @@ struct nfs41_impl_id;
28struct nfs_client { 28struct nfs_client {
29 refcount_t cl_count; 29 refcount_t cl_count;
30 atomic_t cl_mds_count; 30 atomic_t cl_mds_count;
31 seqcount_t cl_callback_count;
32 int cl_cons_state; /* current construction state (-ve: init error) */ 31 int cl_cons_state; /* current construction state (-ve: init error) */
33#define NFS_CS_READY 0 /* ready to be used */ 32#define NFS_CS_READY 0 /* ready to be used */
34#define NFS_CS_INITING 1 /* busy initialising */ 33#define NFS_CS_INITING 1 /* busy initialising */
@@ -122,6 +121,7 @@ struct nfs_client {
122#endif 121#endif
123 122
124 struct net *cl_net; 123 struct net *cl_net;
124 struct list_head pending_cb_stateids;
125}; 125};
126 126
127/* 127/*
@@ -209,6 +209,7 @@ struct nfs_server {
209 struct list_head state_owners_lru; 209 struct list_head state_owners_lru;
210 struct list_head layouts; 210 struct list_head layouts;
211 struct list_head delegations; 211 struct list_head delegations;
212 struct list_head ss_copies;
212 213
213 unsigned long mig_gen; 214 unsigned long mig_gen;
214 unsigned long mig_status; 215 unsigned long mig_status;
@@ -256,5 +257,6 @@ struct nfs_server {
256#define NFS_CAP_LAYOUTSTATS (1U << 22) 257#define NFS_CAP_LAYOUTSTATS (1U << 22)
257#define NFS_CAP_CLONE (1U << 23) 258#define NFS_CAP_CLONE (1U << 23)
258#define NFS_CAP_COPY (1U << 24) 259#define NFS_CAP_COPY (1U << 24)
260#define NFS_CAP_OFFLOAD_CANCEL (1U << 25)
259 261
260#endif 262#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 712eed156d09..bd1c889a9ed9 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -271,7 +271,6 @@ struct nfs4_layoutget {
271 struct nfs4_layoutget_args args; 271 struct nfs4_layoutget_args args;
272 struct nfs4_layoutget_res res; 272 struct nfs4_layoutget_res res;
273 struct rpc_cred *cred; 273 struct rpc_cred *cred;
274 unsigned callback_count;
275 gfp_t gfp_flags; 274 gfp_t gfp_flags;
276}; 275};
277 276
@@ -1389,9 +1388,11 @@ struct nfs42_copy_args {
1389 u64 dst_pos; 1388 u64 dst_pos;
1390 1389
1391 u64 count; 1390 u64 count;
1391 bool sync;
1392}; 1392};
1393 1393
1394struct nfs42_write_res { 1394struct nfs42_write_res {
1395 nfs4_stateid stateid;
1395 u64 count; 1396 u64 count;
1396 struct nfs_writeverf verifier; 1397 struct nfs_writeverf verifier;
1397}; 1398};
@@ -1404,6 +1405,18 @@ struct nfs42_copy_res {
1404 struct nfs_commitres commit_res; 1405 struct nfs_commitres commit_res;
1405}; 1406};
1406 1407
1408struct nfs42_offload_status_args {
1409 struct nfs4_sequence_args osa_seq_args;
1410 struct nfs_fh *osa_src_fh;
1411 nfs4_stateid osa_stateid;
1412};
1413
1414struct nfs42_offload_status_res {
1415 struct nfs4_sequence_res osr_seq_res;
1416 uint64_t osr_count;
1417 int osr_status;
1418};
1419
1407struct nfs42_seek_args { 1420struct nfs42_seek_args {
1408 struct nfs4_sequence_args seq_args; 1421 struct nfs4_sequence_args seq_args;
1409 1422
diff --git a/include/linux/node.h b/include/linux/node.h
index 6d336e38d155..257bb3d6d014 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -33,10 +33,10 @@ typedef void (*node_registration_func_t)(struct node *);
33 33
34#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA) 34#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
35extern int link_mem_sections(int nid, unsigned long start_pfn, 35extern int link_mem_sections(int nid, unsigned long start_pfn,
36 unsigned long nr_pages, bool check_nid); 36 unsigned long end_pfn);
37#else 37#else
38static inline int link_mem_sections(int nid, unsigned long start_pfn, 38static inline int link_mem_sections(int nid, unsigned long start_pfn,
39 unsigned long nr_pages, bool check_nid) 39 unsigned long end_pfn)
40{ 40{
41 return 0; 41 return 0;
42} 42}
@@ -54,12 +54,14 @@ static inline int register_one_node(int nid)
54 54
55 if (node_online(nid)) { 55 if (node_online(nid)) {
56 struct pglist_data *pgdat = NODE_DATA(nid); 56 struct pglist_data *pgdat = NODE_DATA(nid);
57 unsigned long start_pfn = pgdat->node_start_pfn;
58 unsigned long end_pfn = start_pfn + pgdat->node_spanned_pages;
57 59
58 error = __register_one_node(nid); 60 error = __register_one_node(nid);
59 if (error) 61 if (error)
60 return error; 62 return error;
61 /* link memory sections under this node */ 63 /* link memory sections under this node */
62 error = link_mem_sections(nid, pgdat->node_start_pfn, pgdat->node_spanned_pages, true); 64 error = link_mem_sections(nid, start_pfn, end_pfn);
63 } 65 }
64 66
65 return error; 67 return error;
@@ -69,7 +71,7 @@ extern void unregister_one_node(int nid);
69extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); 71extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
70extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); 72extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
71extern int register_mem_sect_under_node(struct memory_block *mem_blk, 73extern int register_mem_sect_under_node(struct memory_block *mem_blk,
72 int nid, bool check_nid); 74 void *arg);
73extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, 75extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
74 unsigned long phys_index); 76 unsigned long phys_index);
75 77
@@ -99,7 +101,7 @@ static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
99 return 0; 101 return 0;
100} 102}
101static inline int register_mem_sect_under_node(struct memory_block *mem_blk, 103static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
102 int nid, bool check_nid) 104 void *arg)
103{ 105{
104 return 0; 106 return 0;
105} 107}
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 1fbde8a880d9..5a30ad594ccc 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -518,7 +518,7 @@ static inline int node_random(const nodemask_t *mask)
518 * NODEMASK_ALLOC(type, name) allocates an object with a specified type and 518 * NODEMASK_ALLOC(type, name) allocates an object with a specified type and
519 * name. 519 * name.
520 */ 520 */
521#if NODES_SHIFT > 8 /* nodemask_t > 256 bytes */ 521#if NODES_SHIFT > 8 /* nodemask_t > 32 bytes */
522#define NODEMASK_ALLOC(type, name, gfp_flags) \ 522#define NODEMASK_ALLOC(type, name, gfp_flags) \
523 type *name = kmalloc(sizeof(*name), gfp_flags) 523 type *name = kmalloc(sizeof(*name), gfp_flags)
524#define NODEMASK_FREE(m) kfree(m) 524#define NODEMASK_FREE(m) kfree(m)
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 2950ce957656..68e91ef5494c 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -242,7 +242,12 @@ struct nvme_id_ctrl {
242 __le32 sanicap; 242 __le32 sanicap;
243 __le32 hmminds; 243 __le32 hmminds;
244 __le16 hmmaxd; 244 __le16 hmmaxd;
245 __u8 rsvd338[174]; 245 __u8 rsvd338[4];
246 __u8 anatt;
247 __u8 anacap;
248 __le32 anagrpmax;
249 __le32 nanagrpid;
250 __u8 rsvd352[160];
246 __u8 sqes; 251 __u8 sqes;
247 __u8 cqes; 252 __u8 cqes;
248 __le16 maxcmd; 253 __le16 maxcmd;
@@ -254,11 +259,12 @@ struct nvme_id_ctrl {
254 __le16 awun; 259 __le16 awun;
255 __le16 awupf; 260 __le16 awupf;
256 __u8 nvscc; 261 __u8 nvscc;
257 __u8 rsvd531; 262 __u8 nwpc;
258 __le16 acwu; 263 __le16 acwu;
259 __u8 rsvd534[2]; 264 __u8 rsvd534[2];
260 __le32 sgls; 265 __le32 sgls;
261 __u8 rsvd540[228]; 266 __le32 mnan;
267 __u8 rsvd544[224];
262 char subnqn[256]; 268 char subnqn[256];
263 __u8 rsvd1024[768]; 269 __u8 rsvd1024[768];
264 __le32 ioccsz; 270 __le32 ioccsz;
@@ -312,7 +318,11 @@ struct nvme_id_ns {
312 __le16 nabspf; 318 __le16 nabspf;
313 __le16 noiob; 319 __le16 noiob;
314 __u8 nvmcap[16]; 320 __u8 nvmcap[16];
315 __u8 rsvd64[40]; 321 __u8 rsvd64[28];
322 __le32 anagrpid;
323 __u8 rsvd96[3];
324 __u8 nsattr;
325 __u8 rsvd100[4];
316 __u8 nguid[16]; 326 __u8 nguid[16];
317 __u8 eui64[8]; 327 __u8 eui64[8];
318 struct nvme_lbaf lbaf[16]; 328 struct nvme_lbaf lbaf[16];
@@ -425,6 +435,32 @@ struct nvme_effects_log {
425 __u8 resv[2048]; 435 __u8 resv[2048];
426}; 436};
427 437
438enum nvme_ana_state {
439 NVME_ANA_OPTIMIZED = 0x01,
440 NVME_ANA_NONOPTIMIZED = 0x02,
441 NVME_ANA_INACCESSIBLE = 0x03,
442 NVME_ANA_PERSISTENT_LOSS = 0x04,
443 NVME_ANA_CHANGE = 0x0f,
444};
445
446struct nvme_ana_group_desc {
447 __le32 grpid;
448 __le32 nnsids;
449 __le64 chgcnt;
450 __u8 state;
451 __u8 rsvd17[15];
452 __le32 nsids[];
453};
454
455/* flag for the log specific field of the ANA log */
456#define NVME_ANA_LOG_RGO (1 << 0)
457
458struct nvme_ana_rsp_hdr {
459 __le64 chgcnt;
460 __le16 ngrps;
461 __le16 rsvd10[3];
462};
463
428enum { 464enum {
429 NVME_SMART_CRIT_SPARE = 1 << 0, 465 NVME_SMART_CRIT_SPARE = 1 << 0,
430 NVME_SMART_CRIT_TEMPERATURE = 1 << 1, 466 NVME_SMART_CRIT_TEMPERATURE = 1 << 1,
@@ -444,11 +480,13 @@ enum {
444enum { 480enum {
445 NVME_AER_NOTICE_NS_CHANGED = 0x00, 481 NVME_AER_NOTICE_NS_CHANGED = 0x00,
446 NVME_AER_NOTICE_FW_ACT_STARTING = 0x01, 482 NVME_AER_NOTICE_FW_ACT_STARTING = 0x01,
483 NVME_AER_NOTICE_ANA = 0x03,
447}; 484};
448 485
449enum { 486enum {
450 NVME_AEN_CFG_NS_ATTR = 1 << 8, 487 NVME_AEN_CFG_NS_ATTR = 1 << 8,
451 NVME_AEN_CFG_FW_ACT = 1 << 9, 488 NVME_AEN_CFG_FW_ACT = 1 << 9,
489 NVME_AEN_CFG_ANA_CHANGE = 1 << 11,
452}; 490};
453 491
454struct nvme_lba_range_type { 492struct nvme_lba_range_type {
@@ -749,15 +787,22 @@ enum {
749 NVME_FEAT_HOST_MEM_BUF = 0x0d, 787 NVME_FEAT_HOST_MEM_BUF = 0x0d,
750 NVME_FEAT_TIMESTAMP = 0x0e, 788 NVME_FEAT_TIMESTAMP = 0x0e,
751 NVME_FEAT_KATO = 0x0f, 789 NVME_FEAT_KATO = 0x0f,
790 NVME_FEAT_HCTM = 0x10,
791 NVME_FEAT_NOPSC = 0x11,
792 NVME_FEAT_RRL = 0x12,
793 NVME_FEAT_PLM_CONFIG = 0x13,
794 NVME_FEAT_PLM_WINDOW = 0x14,
752 NVME_FEAT_SW_PROGRESS = 0x80, 795 NVME_FEAT_SW_PROGRESS = 0x80,
753 NVME_FEAT_HOST_ID = 0x81, 796 NVME_FEAT_HOST_ID = 0x81,
754 NVME_FEAT_RESV_MASK = 0x82, 797 NVME_FEAT_RESV_MASK = 0x82,
755 NVME_FEAT_RESV_PERSIST = 0x83, 798 NVME_FEAT_RESV_PERSIST = 0x83,
799 NVME_FEAT_WRITE_PROTECT = 0x84,
756 NVME_LOG_ERROR = 0x01, 800 NVME_LOG_ERROR = 0x01,
757 NVME_LOG_SMART = 0x02, 801 NVME_LOG_SMART = 0x02,
758 NVME_LOG_FW_SLOT = 0x03, 802 NVME_LOG_FW_SLOT = 0x03,
759 NVME_LOG_CHANGED_NS = 0x04, 803 NVME_LOG_CHANGED_NS = 0x04,
760 NVME_LOG_CMD_EFFECTS = 0x05, 804 NVME_LOG_CMD_EFFECTS = 0x05,
805 NVME_LOG_ANA = 0x0c,
761 NVME_LOG_DISC = 0x70, 806 NVME_LOG_DISC = 0x70,
762 NVME_LOG_RESERVATION = 0x80, 807 NVME_LOG_RESERVATION = 0x80,
763 NVME_FWACT_REPL = (0 << 3), 808 NVME_FWACT_REPL = (0 << 3),
@@ -765,6 +810,14 @@ enum {
765 NVME_FWACT_ACTV = (2 << 3), 810 NVME_FWACT_ACTV = (2 << 3),
766}; 811};
767 812
813/* NVMe Namespace Write Protect State */
814enum {
815 NVME_NS_NO_WRITE_PROTECT = 0,
816 NVME_NS_WRITE_PROTECT,
817 NVME_NS_WRITE_PROTECT_POWER_CYCLE,
818 NVME_NS_WRITE_PROTECT_PERMANENT,
819};
820
768#define NVME_MAX_CHANGED_NAMESPACES 1024 821#define NVME_MAX_CHANGED_NAMESPACES 1024
769 822
770struct nvme_identify { 823struct nvme_identify {
@@ -880,7 +933,7 @@ struct nvme_get_log_page_command {
880 __u64 rsvd2[2]; 933 __u64 rsvd2[2];
881 union nvme_data_ptr dptr; 934 union nvme_data_ptr dptr;
882 __u8 lid; 935 __u8 lid;
883 __u8 rsvd10; 936 __u8 lsp; /* upper 4 bits reserved */
884 __le16 numdl; 937 __le16 numdl;
885 __le16 numdu; 938 __le16 numdu;
886 __u16 rsvd11; 939 __u16 rsvd11;
@@ -1111,6 +1164,8 @@ enum {
1111 NVME_SC_SGL_INVALID_OFFSET = 0x16, 1164 NVME_SC_SGL_INVALID_OFFSET = 0x16,
1112 NVME_SC_SGL_INVALID_SUBTYPE = 0x17, 1165 NVME_SC_SGL_INVALID_SUBTYPE = 0x17,
1113 1166
1167 NVME_SC_NS_WRITE_PROTECTED = 0x20,
1168
1114 NVME_SC_LBA_RANGE = 0x80, 1169 NVME_SC_LBA_RANGE = 0x80,
1115 NVME_SC_CAP_EXCEEDED = 0x81, 1170 NVME_SC_CAP_EXCEEDED = 0x81,
1116 NVME_SC_NS_NOT_READY = 0x82, 1171 NVME_SC_NS_NOT_READY = 0x82,
@@ -1180,6 +1235,13 @@ enum {
1180 NVME_SC_ACCESS_DENIED = 0x286, 1235 NVME_SC_ACCESS_DENIED = 0x286,
1181 NVME_SC_UNWRITTEN_BLOCK = 0x287, 1236 NVME_SC_UNWRITTEN_BLOCK = 0x287,
1182 1237
1238 /*
1239 * Path-related Errors:
1240 */
1241 NVME_SC_ANA_PERSISTENT_LOSS = 0x301,
1242 NVME_SC_ANA_INACCESSIBLE = 0x302,
1243 NVME_SC_ANA_TRANSITION = 0x303,
1244
1183 NVME_SC_DNR = 0x4000, 1245 NVME_SC_DNR = 0x4000,
1184}; 1246};
1185 1247
diff --git a/include/linux/of.h b/include/linux/of.h
index 4d25e4f952d9..99b0ebf49632 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -256,6 +256,9 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
256#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 256#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
257#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 257#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
258 258
259extern bool of_node_name_eq(const struct device_node *np, const char *name);
260extern bool of_node_name_prefix(const struct device_node *np, const char *prefix);
261
259static inline const char *of_node_full_name(const struct device_node *np) 262static inline const char *of_node_full_name(const struct device_node *np)
260{ 263{
261 return np ? np->full_name : "<no-node>"; 264 return np ? np->full_name : "<no-node>";
@@ -290,6 +293,8 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
290extern struct device_node *of_get_next_available_child( 293extern struct device_node *of_get_next_available_child(
291 const struct device_node *node, struct device_node *prev); 294 const struct device_node *node, struct device_node *prev);
292 295
296extern struct device_node *of_get_compatible_child(const struct device_node *parent,
297 const char *compatible);
293extern struct device_node *of_get_child_by_name(const struct device_node *node, 298extern struct device_node *of_get_child_by_name(const struct device_node *node,
294 const char *name); 299 const char *name);
295 300
@@ -561,6 +566,16 @@ static inline struct device_node *to_of_node(const struct fwnode_handle *fwnode)
561 return NULL; 566 return NULL;
562} 567}
563 568
569static inline bool of_node_name_eq(const struct device_node *np, const char *name)
570{
571 return false;
572}
573
574static inline bool of_node_name_prefix(const struct device_node *np, const char *prefix)
575{
576 return false;
577}
578
564static inline const char* of_node_full_name(const struct device_node *np) 579static inline const char* of_node_full_name(const struct device_node *np)
565{ 580{
566 return "<no-node>"; 581 return "<no-node>";
@@ -632,6 +647,12 @@ static inline bool of_have_populated_dt(void)
632 return false; 647 return false;
633} 648}
634 649
650static inline struct device_node *of_get_compatible_child(const struct device_node *parent,
651 const char *compatible)
652{
653 return NULL;
654}
655
635static inline struct device_node *of_get_child_by_name( 656static inline struct device_node *of_get_child_by_name(
636 const struct device_node *node, 657 const struct device_node *node,
637 const char *name) 658 const char *name)
@@ -967,6 +988,18 @@ static inline struct device_node *of_find_matching_node(
967 return of_find_matching_node_and_match(from, matches, NULL); 988 return of_find_matching_node_and_match(from, matches, NULL);
968} 989}
969 990
991static inline const char *of_node_get_device_type(const struct device_node *np)
992{
993 return of_get_property(np, "type", NULL);
994}
995
996static inline bool of_node_is_type(const struct device_node *np, const char *type)
997{
998 const char *match = of_node_get_device_type(np);
999
1000 return np && match && type && !strcmp(match, type);
1001}
1002
970/** 1003/**
971 * of_property_count_u8_elems - Count the number of u8 elements in a property 1004 * of_property_count_u8_elems - Count the number of u8 elements in a property
972 * 1005 *
diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h
index 4fa654e4b5a9..f3d40dd7bb66 100644
--- a/include/linux/of_iommu.h
+++ b/include/linux/of_iommu.h
@@ -32,8 +32,4 @@ static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
32 32
33#endif /* CONFIG_OF_IOMMU */ 33#endif /* CONFIG_OF_IOMMU */
34 34
35extern struct of_device_id __iommu_of_table;
36
37#define IOMMU_OF_DECLARE(name, compat) OF_DECLARE_1(iommu, name, compat, NULL)
38
39#endif /* __OF_IOMMU_H */ 35#endif /* __OF_IOMMU_H */
diff --git a/include/linux/omap-mailbox.h b/include/linux/omap-mailbox.h
index c726bd833761..6dbcd2da0332 100644
--- a/include/linux/omap-mailbox.h
+++ b/include/linux/omap-mailbox.h
@@ -1,9 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * omap-mailbox: interprocessor communication module for OMAP 3 * omap-mailbox: interprocessor communication module for OMAP
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */ 4 */
8 5
9#ifndef OMAP_MAILBOX_H 6#ifndef OMAP_MAILBOX_H
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 6adac113e96d..69864a547663 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -88,14 +88,14 @@ static inline bool mm_is_oom_victim(struct mm_struct *mm)
88 * 88 *
89 * Return 0 when the PF is safe VM_FAULT_SIGBUS otherwise. 89 * Return 0 when the PF is safe VM_FAULT_SIGBUS otherwise.
90 */ 90 */
91static inline int check_stable_address_space(struct mm_struct *mm) 91static inline vm_fault_t check_stable_address_space(struct mm_struct *mm)
92{ 92{
93 if (unlikely(test_bit(MMF_UNSTABLE, &mm->flags))) 93 if (unlikely(test_bit(MMF_UNSTABLE, &mm->flags)))
94 return VM_FAULT_SIGBUS; 94 return VM_FAULT_SIGBUS;
95 return 0; 95 return 0;
96} 96}
97 97
98void __oom_reap_task_mm(struct mm_struct *mm); 98bool __oom_reap_task_mm(struct mm_struct *mm);
99 99
100extern unsigned long oom_badness(struct task_struct *p, 100extern unsigned long oom_badness(struct task_struct *p,
101 struct mem_cgroup *memcg, const nodemask_t *nodemask, 101 struct mem_cgroup *memcg, const nodemask_t *nodemask,
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index e6b240b6196c..379affc63e24 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -21,4 +21,9 @@
21 21
22#include <uapi/linux/openvswitch.h> 22#include <uapi/linux/openvswitch.h>
23 23
24#define OVS_CLONE_ATTR_EXEC 0 /* Specify an u32 value. When nonzero,
25 * actions in clone will not change flow
26 * keys. False otherwise.
27 */
28
24#endif /* _LINUX_OPENVSWITCH_H */ 29#endif /* _LINUX_OPENVSWITCH_H */
diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index 8712ff70995f..40b48e2133cb 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -202,6 +202,37 @@
202 202
203#endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */ 203#endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
204 204
205/** check_shl_overflow() - Calculate a left-shifted value and check overflow
206 *
207 * @a: Value to be shifted
208 * @s: How many bits left to shift
209 * @d: Pointer to where to store the result
210 *
211 * Computes *@d = (@a << @s)
212 *
213 * Returns true if '*d' cannot hold the result or when 'a << s' doesn't
214 * make sense. Example conditions:
215 * - 'a << s' causes bits to be lost when stored in *d.
216 * - 's' is garbage (e.g. negative) or so large that the result of
217 * 'a << s' is guaranteed to be 0.
218 * - 'a' is negative.
219 * - 'a << s' sets the sign bit, if any, in '*d'.
220 *
221 * '*d' will hold the results of the attempted shift, but is not
222 * considered "safe for use" if false is returned.
223 */
224#define check_shl_overflow(a, s, d) ({ \
225 typeof(a) _a = a; \
226 typeof(s) _s = s; \
227 typeof(d) _d = d; \
228 u64 _a_full = _a; \
229 unsigned int _to_shift = \
230 _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \
231 *_d = (_a_full << _to_shift); \
232 (_to_shift != _s || *_d < 0 || _a < 0 || \
233 (*_d >> _to_shift) != _a); \
234})
235
205/** 236/**
206 * array_size() - Calculate size of 2-dimensional array. 237 * array_size() - Calculate size of 2-dimensional array.
207 * 238 *
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 901943e4754b..74bee8cecf4c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -369,8 +369,13 @@ PAGEFLAG_FALSE(Uncached)
369PAGEFLAG(HWPoison, hwpoison, PF_ANY) 369PAGEFLAG(HWPoison, hwpoison, PF_ANY)
370TESTSCFLAG(HWPoison, hwpoison, PF_ANY) 370TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
371#define __PG_HWPOISON (1UL << PG_hwpoison) 371#define __PG_HWPOISON (1UL << PG_hwpoison)
372extern bool set_hwpoison_free_buddy_page(struct page *page);
372#else 373#else
373PAGEFLAG_FALSE(HWPoison) 374PAGEFLAG_FALSE(HWPoison)
375static inline bool set_hwpoison_free_buddy_page(struct page *page)
376{
377 return 0;
378}
374#define __PG_HWPOISON 0 379#define __PG_HWPOISON 0
375#endif 380#endif
376 381
diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h
index ca5461efae2f..f84f167ec04c 100644
--- a/include/linux/page_ext.h
+++ b/include/linux/page_ext.h
@@ -16,18 +16,7 @@ struct page_ext_operations {
16 16
17#ifdef CONFIG_PAGE_EXTENSION 17#ifdef CONFIG_PAGE_EXTENSION
18 18
19/*
20 * page_ext->flags bits:
21 *
22 * PAGE_EXT_DEBUG_POISON is set for poisoned pages. This is used to
23 * implement generic debug pagealloc feature. The pages are filled with
24 * poison patterns and set this flag after free_pages(). The poisoned
25 * pages are verified whether the patterns are not corrupted and clear
26 * the flag before alloc_pages().
27 */
28
29enum page_ext_flags { 19enum page_ext_flags {
30 PAGE_EXT_DEBUG_POISON, /* Page is poisoned */
31 PAGE_EXT_DEBUG_GUARD, 20 PAGE_EXT_DEBUG_GUARD,
32 PAGE_EXT_OWNER, 21 PAGE_EXT_OWNER,
33#if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT) 22#if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
@@ -61,7 +50,7 @@ static inline void page_ext_init(void)
61} 50}
62#endif 51#endif
63 52
64struct page_ext *lookup_page_ext(struct page *page); 53struct page_ext *lookup_page_ext(const struct page *page);
65 54
66#else /* !CONFIG_PAGE_EXTENSION */ 55#else /* !CONFIG_PAGE_EXTENSION */
67struct page_ext; 56struct page_ext;
@@ -70,7 +59,7 @@ static inline void pgdat_page_ext_init(struct pglist_data *pgdat)
70{ 59{
71} 60}
72 61
73static inline struct page_ext *lookup_page_ext(struct page *page) 62static inline struct page_ext *lookup_page_ext(const struct page *page)
74{ 63{
75 return NULL; 64 return NULL;
76} 65}
diff --git a/include/linux/pci-dma-compat.h b/include/linux/pci-dma-compat.h
index 0dd1a3f7b309..c3f1b44ade29 100644
--- a/include/linux/pci-dma-compat.h
+++ b/include/linux/pci-dma-compat.h
@@ -8,10 +8,10 @@
8#include <linux/dma-mapping.h> 8#include <linux/dma-mapping.h>
9 9
10/* This defines the direction arg to the DMA mapping routines. */ 10/* This defines the direction arg to the DMA mapping routines. */
11#define PCI_DMA_BIDIRECTIONAL 0 11#define PCI_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL
12#define PCI_DMA_TODEVICE 1 12#define PCI_DMA_TODEVICE DMA_TO_DEVICE
13#define PCI_DMA_FROMDEVICE 2 13#define PCI_DMA_FROMDEVICE DMA_FROM_DEVICE
14#define PCI_DMA_NONE 3 14#define PCI_DMA_NONE DMA_NONE
15 15
16static inline void * 16static inline void *
17pci_alloc_consistent(struct pci_dev *hwdev, size_t size, 17pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
index 243eaa5a66ff..37dab8116901 100644
--- a/include/linux/pci-epc.h
+++ b/include/linux/pci-epc.h
@@ -17,6 +17,7 @@ enum pci_epc_irq_type {
17 PCI_EPC_IRQ_UNKNOWN, 17 PCI_EPC_IRQ_UNKNOWN,
18 PCI_EPC_IRQ_LEGACY, 18 PCI_EPC_IRQ_LEGACY,
19 PCI_EPC_IRQ_MSI, 19 PCI_EPC_IRQ_MSI,
20 PCI_EPC_IRQ_MSIX,
20}; 21};
21 22
22/** 23/**
@@ -30,7 +31,11 @@ enum pci_epc_irq_type {
30 * capability register 31 * capability register
31 * @get_msi: ops to get the number of MSI interrupts allocated by the RC from 32 * @get_msi: ops to get the number of MSI interrupts allocated by the RC from
32 * the MSI capability register 33 * the MSI capability register
33 * @raise_irq: ops to raise a legacy or MSI interrupt 34 * @set_msix: ops to set the requested number of MSI-X interrupts in the
35 * MSI-X capability register
36 * @get_msix: ops to get the number of MSI-X interrupts allocated by the RC
37 * from the MSI-X capability register
38 * @raise_irq: ops to raise a legacy, MSI or MSI-X interrupt
34 * @start: ops to start the PCI link 39 * @start: ops to start the PCI link
35 * @stop: ops to stop the PCI link 40 * @stop: ops to stop the PCI link
36 * @owner: the module owner containing the ops 41 * @owner: the module owner containing the ops
@@ -48,8 +53,10 @@ struct pci_epc_ops {
48 phys_addr_t addr); 53 phys_addr_t addr);
49 int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts); 54 int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts);
50 int (*get_msi)(struct pci_epc *epc, u8 func_no); 55 int (*get_msi)(struct pci_epc *epc, u8 func_no);
56 int (*set_msix)(struct pci_epc *epc, u8 func_no, u16 interrupts);
57 int (*get_msix)(struct pci_epc *epc, u8 func_no);
51 int (*raise_irq)(struct pci_epc *epc, u8 func_no, 58 int (*raise_irq)(struct pci_epc *epc, u8 func_no,
52 enum pci_epc_irq_type type, u8 interrupt_num); 59 enum pci_epc_irq_type type, u16 interrupt_num);
53 int (*start)(struct pci_epc *epc); 60 int (*start)(struct pci_epc *epc);
54 void (*stop)(struct pci_epc *epc); 61 void (*stop)(struct pci_epc *epc);
55 struct module *owner; 62 struct module *owner;
@@ -95,6 +102,7 @@ struct pci_epc {
95 102
96#define EPC_FEATURE_NO_LINKUP_NOTIFIER BIT(0) 103#define EPC_FEATURE_NO_LINKUP_NOTIFIER BIT(0)
97#define EPC_FEATURE_BAR_MASK (BIT(1) | BIT(2) | BIT(3)) 104#define EPC_FEATURE_BAR_MASK (BIT(1) | BIT(2) | BIT(3))
105#define EPC_FEATURE_MSIX_AVAILABLE BIT(4)
98#define EPC_FEATURE_SET_BAR(features, bar) \ 106#define EPC_FEATURE_SET_BAR(features, bar) \
99 (features |= (EPC_FEATURE_BAR_MASK & (bar << 1))) 107 (features |= (EPC_FEATURE_BAR_MASK & (bar << 1)))
100#define EPC_FEATURE_GET_BAR(features) \ 108#define EPC_FEATURE_GET_BAR(features) \
@@ -144,8 +152,10 @@ void pci_epc_unmap_addr(struct pci_epc *epc, u8 func_no,
144 phys_addr_t phys_addr); 152 phys_addr_t phys_addr);
145int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts); 153int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts);
146int pci_epc_get_msi(struct pci_epc *epc, u8 func_no); 154int pci_epc_get_msi(struct pci_epc *epc, u8 func_no);
155int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts);
156int pci_epc_get_msix(struct pci_epc *epc, u8 func_no);
147int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no, 157int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no,
148 enum pci_epc_irq_type type, u8 interrupt_num); 158 enum pci_epc_irq_type type, u16 interrupt_num);
149int pci_epc_start(struct pci_epc *epc); 159int pci_epc_start(struct pci_epc *epc);
150void pci_epc_stop(struct pci_epc *epc); 160void pci_epc_stop(struct pci_epc *epc);
151struct pci_epc *pci_epc_get(const char *epc_name); 161struct pci_epc *pci_epc_get(const char *epc_name);
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
index 4e7764935fa8..ec02f58758c8 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -119,6 +119,7 @@ struct pci_epf {
119 struct pci_epf_header *header; 119 struct pci_epf_header *header;
120 struct pci_epf_bar bar[6]; 120 struct pci_epf_bar bar[6];
121 u8 msi_interrupts; 121 u8 msi_interrupts;
122 u16 msix_interrupts;
122 u8 func_no; 123 u8 func_no;
123 124
124 struct pci_epc *epc; 125 struct pci_epc *epc;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c133ccfa002e..e72ca8dd6241 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -261,6 +261,9 @@ enum pci_bus_speed {
261 PCI_SPEED_UNKNOWN = 0xff, 261 PCI_SPEED_UNKNOWN = 0xff,
262}; 262};
263 263
264enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev);
265enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev);
266
264struct pci_cap_saved_data { 267struct pci_cap_saved_data {
265 u16 cap_nr; 268 u16 cap_nr;
266 bool cap_extended; 269 bool cap_extended;
@@ -299,6 +302,7 @@ struct pci_dev {
299 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 302 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
300#ifdef CONFIG_PCIEAER 303#ifdef CONFIG_PCIEAER
301 u16 aer_cap; /* AER capability offset */ 304 u16 aer_cap; /* AER capability offset */
305 struct aer_stats *aer_stats; /* AER stats for this device */
302#endif 306#endif
303 u8 pcie_cap; /* PCIe capability offset */ 307 u8 pcie_cap; /* PCIe capability offset */
304 u8 msi_cap; /* MSI capability offset */ 308 u8 msi_cap; /* MSI capability offset */
@@ -350,6 +354,7 @@ struct pci_dev {
350 unsigned int ltr_path:1; /* Latency Tolerance Reporting 354 unsigned int ltr_path:1; /* Latency Tolerance Reporting
351 supported from root to here */ 355 supported from root to here */
352#endif 356#endif
357 unsigned int eetlp_prefix_path:1; /* End-to-End TLP Prefix */
353 358
354 pci_channel_state_t error_state; /* Current connectivity state */ 359 pci_channel_state_t error_state; /* Current connectivity state */
355 struct device dev; /* Generic device interface */ 360 struct device dev; /* Generic device interface */
@@ -387,6 +392,7 @@ struct pci_dev {
387 unsigned int is_virtfn:1; 392 unsigned int is_virtfn:1;
388 unsigned int reset_fn:1; 393 unsigned int reset_fn:1;
389 unsigned int is_hotplug_bridge:1; 394 unsigned int is_hotplug_bridge:1;
395 unsigned int shpc_managed:1; /* SHPC owned by shpchp */
390 unsigned int is_thunderbolt:1; /* Thunderbolt controller */ 396 unsigned int is_thunderbolt:1; /* Thunderbolt controller */
391 unsigned int __aer_firmware_first_valid:1; 397 unsigned int __aer_firmware_first_valid:1;
392 unsigned int __aer_firmware_first:1; 398 unsigned int __aer_firmware_first:1;
@@ -818,6 +824,21 @@ struct pci_driver {
818 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ 824 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
819 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 825 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
820 826
827/**
828 * PCI_DEVICE_DATA - macro used to describe a specific PCI device in very short form
829 * @vend: the vendor name (without PCI_VENDOR_ID_ prefix)
830 * @dev: the device name (without PCI_DEVICE_ID_<vend>_ prefix)
831 * @data: the driver data to be filled
832 *
833 * This macro is used to create a struct pci_device_id that matches a
834 * specific PCI device. The subvendor, and subdevice fields will be set
835 * to PCI_ANY_ID.
836 */
837#define PCI_DEVICE_DATA(vend, dev, data) \
838 .vendor = PCI_VENDOR_ID_##vend, .device = PCI_DEVICE_ID_##vend##_##dev, \
839 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0, \
840 .driver_data = (kernel_ulong_t)(data)
841
821enum { 842enum {
822 PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */ 843 PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */
823 PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */ 844 PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */
@@ -1088,20 +1109,17 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,
1088 enum pci_bus_speed *speed, 1109 enum pci_bus_speed *speed,
1089 enum pcie_link_width *width); 1110 enum pcie_link_width *width);
1090void pcie_print_link_status(struct pci_dev *dev); 1111void pcie_print_link_status(struct pci_dev *dev);
1112bool pcie_has_flr(struct pci_dev *dev);
1091int pcie_flr(struct pci_dev *dev); 1113int pcie_flr(struct pci_dev *dev);
1092int __pci_reset_function_locked(struct pci_dev *dev); 1114int __pci_reset_function_locked(struct pci_dev *dev);
1093int pci_reset_function(struct pci_dev *dev); 1115int pci_reset_function(struct pci_dev *dev);
1094int pci_reset_function_locked(struct pci_dev *dev); 1116int pci_reset_function_locked(struct pci_dev *dev);
1095int pci_try_reset_function(struct pci_dev *dev); 1117int pci_try_reset_function(struct pci_dev *dev);
1096int pci_probe_reset_slot(struct pci_slot *slot); 1118int pci_probe_reset_slot(struct pci_slot *slot);
1097int pci_reset_slot(struct pci_slot *slot);
1098int pci_try_reset_slot(struct pci_slot *slot);
1099int pci_probe_reset_bus(struct pci_bus *bus); 1119int pci_probe_reset_bus(struct pci_bus *bus);
1100int pci_reset_bus(struct pci_bus *bus); 1120int pci_reset_bus(struct pci_dev *dev);
1101int pci_try_reset_bus(struct pci_bus *bus);
1102void pci_reset_secondary_bus(struct pci_dev *dev); 1121void pci_reset_secondary_bus(struct pci_dev *dev);
1103void pcibios_reset_secondary_bus(struct pci_dev *dev); 1122void pcibios_reset_secondary_bus(struct pci_dev *dev);
1104int pci_reset_bridge_secondary_bus(struct pci_dev *dev);
1105void pci_update_resource(struct pci_dev *dev, int resno); 1123void pci_update_resource(struct pci_dev *dev, int resno);
1106int __must_check pci_assign_resource(struct pci_dev *dev, int i); 1124int __must_check pci_assign_resource(struct pci_dev *dev, int i);
1107int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); 1125int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
@@ -1121,7 +1139,6 @@ int pci_enable_rom(struct pci_dev *pdev);
1121void pci_disable_rom(struct pci_dev *pdev); 1139void pci_disable_rom(struct pci_dev *pdev);
1122void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 1140void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
1123void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 1141void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
1124size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
1125void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); 1142void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);
1126 1143
1127/* Power management related routines */ 1144/* Power management related routines */
@@ -1469,13 +1486,9 @@ static inline bool pcie_aspm_support_enabled(void) { return false; }
1469#endif 1486#endif
1470 1487
1471#ifdef CONFIG_PCIEAER 1488#ifdef CONFIG_PCIEAER
1472void pci_no_aer(void);
1473bool pci_aer_available(void); 1489bool pci_aer_available(void);
1474int pci_aer_init(struct pci_dev *dev);
1475#else 1490#else
1476static inline void pci_no_aer(void) { }
1477static inline bool pci_aer_available(void) { return false; } 1491static inline bool pci_aer_available(void) { return false; }
1478static inline int pci_aer_init(struct pci_dev *d) { return -ENODEV; }
1479#endif 1492#endif
1480 1493
1481#ifdef CONFIG_PCIE_ECRC 1494#ifdef CONFIG_PCIE_ECRC
@@ -1796,7 +1809,11 @@ struct pci_fixup {
1796 u16 device; /* Or PCI_ANY_ID */ 1809 u16 device; /* Or PCI_ANY_ID */
1797 u32 class; /* Or PCI_ANY_ID */ 1810 u32 class; /* Or PCI_ANY_ID */
1798 unsigned int class_shift; /* should be 0, 8, 16 */ 1811 unsigned int class_shift; /* should be 0, 8, 16 */
1812#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
1813 int hook_offset;
1814#else
1799 void (*hook)(struct pci_dev *dev); 1815 void (*hook)(struct pci_dev *dev);
1816#endif
1800}; 1817};
1801 1818
1802enum pci_fixup_pass { 1819enum pci_fixup_pass {
@@ -1810,12 +1827,28 @@ enum pci_fixup_pass {
1810 pci_fixup_suspend_late, /* pci_device_suspend_late() */ 1827 pci_fixup_suspend_late, /* pci_device_suspend_late() */
1811}; 1828};
1812 1829
1830#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
1831#define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
1832 class_shift, hook) \
1833 __ADDRESSABLE(hook) \
1834 asm(".section " #sec ", \"a\" \n" \
1835 ".balign 16 \n" \
1836 ".short " #vendor ", " #device " \n" \
1837 ".long " #class ", " #class_shift " \n" \
1838 ".long " #hook " - . \n" \
1839 ".previous \n");
1840#define DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
1841 class_shift, hook) \
1842 __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
1843 class_shift, hook)
1844#else
1813/* Anonymous variables would be nice... */ 1845/* Anonymous variables would be nice... */
1814#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ 1846#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
1815 class_shift, hook) \ 1847 class_shift, hook) \
1816 static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \ 1848 static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \
1817 __attribute__((__section__(#section), aligned((sizeof(void *))))) \ 1849 __attribute__((__section__(#section), aligned((sizeof(void *))))) \
1818 = { vendor, device, class, class_shift, hook }; 1850 = { vendor, device, class, class_shift, hook };
1851#endif
1819 1852
1820#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ 1853#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \
1821 class_shift, hook) \ 1854 class_shift, hook) \
@@ -1877,20 +1910,9 @@ enum pci_fixup_pass {
1877 1910
1878#ifdef CONFIG_PCI_QUIRKS 1911#ifdef CONFIG_PCI_QUIRKS
1879void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1912void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1880int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1881int pci_dev_specific_enable_acs(struct pci_dev *dev);
1882#else 1913#else
1883static inline void pci_fixup_device(enum pci_fixup_pass pass, 1914static inline void pci_fixup_device(enum pci_fixup_pass pass,
1884 struct pci_dev *dev) { } 1915 struct pci_dev *dev) { }
1885static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
1886 u16 acs_flags)
1887{
1888 return -ENOTTY;
1889}
1890static inline int pci_dev_specific_enable_acs(struct pci_dev *dev)
1891{
1892 return -ENOTTY;
1893}
1894#endif 1916#endif
1895 1917
1896void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1918void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index cf5e22103f68..a6d6650a0490 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -80,15 +80,12 @@ struct hotplug_slot_info {
80 * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot 80 * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot
81 * @info: pointer to the &struct hotplug_slot_info for the initial values for 81 * @info: pointer to the &struct hotplug_slot_info for the initial values for
82 * this slot. 82 * this slot.
83 * @release: called during pci_hp_deregister to free memory allocated in a
84 * hotplug_slot structure.
85 * @private: used by the hotplug pci controller driver to store whatever it 83 * @private: used by the hotplug pci controller driver to store whatever it
86 * needs. 84 * needs.
87 */ 85 */
88struct hotplug_slot { 86struct hotplug_slot {
89 struct hotplug_slot_ops *ops; 87 struct hotplug_slot_ops *ops;
90 struct hotplug_slot_info *info; 88 struct hotplug_slot_info *info;
91 void (*release) (struct hotplug_slot *slot);
92 void *private; 89 void *private;
93 90
94 /* Variables below this are for use only by the hotplug pci core. */ 91 /* Variables below this are for use only by the hotplug pci core. */
@@ -104,13 +101,23 @@ static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
104int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr, 101int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr,
105 const char *name, struct module *owner, 102 const char *name, struct module *owner,
106 const char *mod_name); 103 const char *mod_name);
107int pci_hp_deregister(struct hotplug_slot *slot); 104int __pci_hp_initialize(struct hotplug_slot *slot, struct pci_bus *bus, int nr,
105 const char *name, struct module *owner,
106 const char *mod_name);
107int pci_hp_add(struct hotplug_slot *slot);
108
109void pci_hp_del(struct hotplug_slot *slot);
110void pci_hp_destroy(struct hotplug_slot *slot);
111void pci_hp_deregister(struct hotplug_slot *slot);
112
108int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot, 113int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot,
109 struct hotplug_slot_info *info); 114 struct hotplug_slot_info *info);
110 115
111/* use a define to avoid include chaining to get THIS_MODULE & friends */ 116/* use a define to avoid include chaining to get THIS_MODULE & friends */
112#define pci_hp_register(slot, pbus, devnr, name) \ 117#define pci_hp_register(slot, pbus, devnr, name) \
113 __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME) 118 __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME)
119#define pci_hp_initialize(slot, bus, nr, name) \
120 __pci_hp_initialize(slot, bus, nr, name, THIS_MODULE, KBUILD_MODNAME)
114 121
115/* PCI Setting Record (Type 0) */ 122/* PCI Setting Record (Type 0) */
116struct hpp_type0 { 123struct hpp_type0 {
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 29502238e510..d157983b84cf 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1668,6 +1668,7 @@
1668#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 1668#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112
1669 1669
1670#define PCI_VENDOR_ID_PMC_Sierra 0x11f8 1670#define PCI_VENDOR_ID_PMC_Sierra 0x11f8
1671#define PCI_VENDOR_ID_MICROSEMI 0x11f8
1671 1672
1672#define PCI_VENDOR_ID_RP 0x11fe 1673#define PCI_VENDOR_ID_RP 0x11fe
1673#define PCI_DEVICE_ID_RP32INTF 0x0001 1674#define PCI_DEVICE_ID_RP32INTF 0x0001
@@ -2541,6 +2542,7 @@
2541#define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200 2542#define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200
2542#define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240 2543#define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240
2543#define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000 2544#define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000
2545#define PCI_DEVICE_ID_NETRONOME_NFP5000 0x5000
2544#define PCI_DEVICE_ID_NETRONOME_NFP6000 0x6000 2546#define PCI_DEVICE_ID_NETRONOME_NFP6000 0x6000
2545#define PCI_DEVICE_ID_NETRONOME_NFP6000_VF 0x6003 2547#define PCI_DEVICE_ID_NETRONOME_NFP6000_VF 0x6003
2546 2548
@@ -3082,4 +3084,6 @@
3082 3084
3083#define PCI_VENDOR_ID_OCZ 0x1b85 3085#define PCI_VENDOR_ID_OCZ 0x1b85
3084 3086
3087#define PCI_VENDOR_ID_NCUBE 0x10ff
3088
3085#endif /* _LINUX_PCI_IDS_H */ 3089#endif /* _LINUX_PCI_IDS_H */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 296bbe49d5d1..70b7123f38c7 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -149,4 +149,6 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
149 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \ 149 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \
150 __alignof__(type)) 150 __alignof__(type))
151 151
152extern unsigned long pcpu_nr_pages(void);
153
152#endif /* __LINUX_PERCPU_H */ 154#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h
deleted file mode 100644
index 07d78e4653bc..000000000000
--- a/include/linux/percpu_ida.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __PERCPU_IDA_H__
3#define __PERCPU_IDA_H__
4
5#include <linux/types.h>
6#include <linux/bitops.h>
7#include <linux/init.h>
8#include <linux/sched.h>
9#include <linux/spinlock_types.h>
10#include <linux/wait.h>
11#include <linux/cpumask.h>
12
13struct percpu_ida_cpu;
14
15struct percpu_ida {
16 /*
17 * number of tags available to be allocated, as passed to
18 * percpu_ida_init()
19 */
20 unsigned nr_tags;
21 unsigned percpu_max_size;
22 unsigned percpu_batch_size;
23
24 struct percpu_ida_cpu __percpu *tag_cpu;
25
26 /*
27 * Bitmap of cpus that (may) have tags on their percpu freelists:
28 * steal_tags() uses this to decide when to steal tags, and which cpus
29 * to try stealing from.
30 *
31 * It's ok for a freelist to be empty when its bit is set - steal_tags()
32 * will just keep looking - but the bitmap _must_ be set whenever a
33 * percpu freelist does have tags.
34 */
35 cpumask_t cpus_have_tags;
36
37 struct {
38 spinlock_t lock;
39 /*
40 * When we go to steal tags from another cpu (see steal_tags()),
41 * we want to pick a cpu at random. Cycling through them every
42 * time we steal is a bit easier and more or less equivalent:
43 */
44 unsigned cpu_last_stolen;
45
46 /* For sleeping on allocation failure */
47 wait_queue_head_t wait;
48
49 /*
50 * Global freelist - it's a stack where nr_free points to the
51 * top
52 */
53 unsigned nr_free;
54 unsigned *freelist;
55 } ____cacheline_aligned_in_smp;
56};
57
58/*
59 * Number of tags we move between the percpu freelist and the global freelist at
60 * a time
61 */
62#define IDA_DEFAULT_PCPU_BATCH_MOVE 32U
63/* Max size of percpu freelist, */
64#define IDA_DEFAULT_PCPU_SIZE ((IDA_DEFAULT_PCPU_BATCH_MOVE * 3) / 2)
65
66int percpu_ida_alloc(struct percpu_ida *pool, int state);
67void percpu_ida_free(struct percpu_ida *pool, unsigned tag);
68
69void percpu_ida_destroy(struct percpu_ida *pool);
70int __percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags,
71 unsigned long max_size, unsigned long batch_size);
72static inline int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags)
73{
74 return __percpu_ida_init(pool, nr_tags, IDA_DEFAULT_PCPU_SIZE,
75 IDA_DEFAULT_PCPU_BATCH_MOVE);
76}
77
78typedef int (*percpu_ida_cb)(unsigned, void *);
79int percpu_ida_for_each_free(struct percpu_ida *pool, percpu_ida_cb fn,
80 void *data);
81
82unsigned percpu_ida_free_tags(struct percpu_ida *pool, int cpu);
83#endif /* __PERCPU_IDA_H__ */
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
index ad5444491975..10f92e1d8e7b 100644
--- a/include/linux/perf/arm_pmu.h
+++ b/include/linux/perf/arm_pmu.h
@@ -25,6 +25,12 @@
25 */ 25 */
26#define ARMPMU_MAX_HWEVENTS 32 26#define ARMPMU_MAX_HWEVENTS 32
27 27
28/*
29 * ARM PMU hw_event flags
30 */
31/* Event uses a 64bit counter */
32#define ARMPMU_EVT_64BIT 1
33
28#define HW_OP_UNSUPPORTED 0xFFFF 34#define HW_OP_UNSUPPORTED 0xFFFF
29#define C(_x) PERF_COUNT_HW_CACHE_##_x 35#define C(_x) PERF_COUNT_HW_CACHE_##_x
30#define CACHE_OP_UNSUPPORTED 0xFFFF 36#define CACHE_OP_UNSUPPORTED 0xFFFF
@@ -87,14 +93,13 @@ struct arm_pmu {
87 struct perf_event *event); 93 struct perf_event *event);
88 int (*set_event_filter)(struct hw_perf_event *evt, 94 int (*set_event_filter)(struct hw_perf_event *evt,
89 struct perf_event_attr *attr); 95 struct perf_event_attr *attr);
90 u32 (*read_counter)(struct perf_event *event); 96 u64 (*read_counter)(struct perf_event *event);
91 void (*write_counter)(struct perf_event *event, u32 val); 97 void (*write_counter)(struct perf_event *event, u64 val);
92 void (*start)(struct arm_pmu *); 98 void (*start)(struct arm_pmu *);
93 void (*stop)(struct arm_pmu *); 99 void (*stop)(struct arm_pmu *);
94 void (*reset)(void *); 100 void (*reset)(void *);
95 int (*map_event)(struct perf_event *event); 101 int (*map_event)(struct perf_event *event);
96 int num_events; 102 int num_events;
97 u64 max_period;
98 bool secure_access; /* 32-bit ARM only */ 103 bool secure_access; /* 32-bit ARM only */
99#define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40 104#define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40
100 DECLARE_BITMAP(pmceid_bitmap, ARMV8_PMUV3_MAX_COMMON_EVENTS); 105 DECLARE_BITMAP(pmceid_bitmap, ARMV8_PMUV3_MAX_COMMON_EVENTS);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 6cd09098427c..cd6f637cbbfb 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -825,6 +825,16 @@ static inline bool phy_interrupt_is_valid(struct phy_device *phydev)
825} 825}
826 826
827/** 827/**
828 * phy_polling_mode - Convenience function for testing whether polling is
829 * used to detect PHY status changes
830 * @phydev: the phy_device struct
831 */
832static inline bool phy_polling_mode(struct phy_device *phydev)
833{
834 return phydev->irq == PHY_POLL;
835}
836
837/**
828 * phy_is_internal - Convenience function for testing if a PHY is internal 838 * phy_is_internal - Convenience function for testing if a PHY is internal
829 * @phydev: the phy_device struct 839 * @phydev: the phy_device struct
830 */ 840 */
@@ -942,6 +952,8 @@ void phy_start(struct phy_device *phydev);
942void phy_stop(struct phy_device *phydev); 952void phy_stop(struct phy_device *phydev);
943int phy_start_aneg(struct phy_device *phydev); 953int phy_start_aneg(struct phy_device *phydev);
944int phy_aneg_done(struct phy_device *phydev); 954int phy_aneg_done(struct phy_device *phydev);
955int phy_speed_down(struct phy_device *phydev, bool sync);
956int phy_speed_up(struct phy_device *phydev);
945 957
946int phy_stop_interrupts(struct phy_device *phydev); 958int phy_stop_interrupts(struct phy_device *phydev);
947int phy_restart_aneg(struct phy_device *phydev); 959int phy_restart_aneg(struct phy_device *phydev);
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 50eeae025f1e..021fc6595856 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -234,5 +234,6 @@ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
234#define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode) 234#define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode)
235 235
236void phylink_set_port_modes(unsigned long *bits); 236void phylink_set_port_modes(unsigned long *bits);
237void phylink_helper_basex_speed(struct phylink_link_state *state);
237 238
238#endif 239#endif
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 7633d55d9a24..14a9a39da9c7 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -7,11 +7,10 @@
7enum pid_type 7enum pid_type
8{ 8{
9 PIDTYPE_PID, 9 PIDTYPE_PID,
10 PIDTYPE_TGID,
10 PIDTYPE_PGID, 11 PIDTYPE_PGID,
11 PIDTYPE_SID, 12 PIDTYPE_SID,
12 PIDTYPE_MAX, 13 PIDTYPE_MAX,
13 /* only valid to __task_pid_nr_ns() */
14 __PIDTYPE_TGID
15}; 14};
16 15
17/* 16/*
@@ -67,12 +66,6 @@ struct pid
67 66
68extern struct pid init_struct_pid; 67extern struct pid init_struct_pid;
69 68
70struct pid_link
71{
72 struct hlist_node node;
73 struct pid *pid;
74};
75
76static inline struct pid *get_pid(struct pid *pid) 69static inline struct pid *get_pid(struct pid *pid)
77{ 70{
78 if (pid) 71 if (pid)
@@ -177,7 +170,7 @@ pid_t pid_vnr(struct pid *pid);
177 do { \ 170 do { \
178 if ((pid) != NULL) \ 171 if ((pid) != NULL) \
179 hlist_for_each_entry_rcu((task), \ 172 hlist_for_each_entry_rcu((task), \
180 &(pid)->tasks[type], pids[type].node) { 173 &(pid)->tasks[type], pid_links[type]) {
181 174
182 /* 175 /*
183 * Both old and new leaders may be attached to 176 * Both old and new leaders may be attached to
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index 09eb80f2574a..8dd85d302b90 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -28,7 +28,8 @@ struct seq_file;
28 * is not available on this controller this should return -ENOTSUPP 28 * is not available on this controller this should return -ENOTSUPP
29 * and if it is available but disabled it should return -EINVAL 29 * and if it is available but disabled it should return -EINVAL
30 * @pin_config_set: configure an individual pin 30 * @pin_config_set: configure an individual pin
31 * @pin_config_group_get: get configurations for an entire pin group 31 * @pin_config_group_get: get configurations for an entire pin group; should
32 * return -ENOTSUPP and -EINVAL using the same rules as pin_config_get.
32 * @pin_config_group_set: configure all pins in a group 33 * @pin_config_group_set: configure all pins in a group
33 * @pin_config_dbg_parse_modify: optional debugfs to modify a pin configuration 34 * @pin_config_dbg_parse_modify: optional debugfs to modify a pin configuration
34 * @pin_config_dbg_show: optional debugfs display hook that will provide 35 * @pin_config_dbg_show: optional debugfs display hook that will provide
diff --git a/include/linux/platform_data/ams-delta-fiq.h b/include/linux/platform_data/ams-delta-fiq.h
new file mode 100644
index 000000000000..cf4589ccb720
--- /dev/null
+++ b/include/linux/platform_data/ams-delta-fiq.h
@@ -0,0 +1,58 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2
3/*
4 * include/linux/platform_data/ams-delta-fiq.h
5 *
6 * Taken from the original Amstrad modifications to fiq.h
7 *
8 * Copyright (c) 2004 Amstrad Plc
9 * Copyright (c) 2006 Matt Callow
10 * Copyright (c) 2010 Janusz Krzysztofik
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16#ifndef __LINUX_PLATFORM_DATA_AMS_DELTA_FIQ_H
17#define __LINUX_PLATFORM_DATA_AMS_DELTA_FIQ_H
18
19/*
20 * These are the offsets from the beginning of the fiq_buffer. They are put here
21 * since the buffer and header need to be accessed by drivers servicing devices
22 * which generate GPIO interrupts - e.g. keyboard, modem, hook switch.
23 */
24#define FIQ_MASK 0
25#define FIQ_STATE 1
26#define FIQ_KEYS_CNT 2
27#define FIQ_TAIL_OFFSET 3
28#define FIQ_HEAD_OFFSET 4
29#define FIQ_BUF_LEN 5
30#define FIQ_KEY 6
31#define FIQ_MISSED_KEYS 7
32#define FIQ_BUFFER_START 8
33#define FIQ_GPIO_INT_MASK 9
34#define FIQ_KEYS_HICNT 10
35#define FIQ_IRQ_PEND 11
36#define FIQ_SIR_CODE_L1 12
37#define IRQ_SIR_CODE_L2 13
38
39#define FIQ_CNT_INT_00 14
40#define FIQ_CNT_INT_KEY 15
41#define FIQ_CNT_INT_MDM 16
42#define FIQ_CNT_INT_03 17
43#define FIQ_CNT_INT_HSW 18
44#define FIQ_CNT_INT_05 19
45#define FIQ_CNT_INT_06 20
46#define FIQ_CNT_INT_07 21
47#define FIQ_CNT_INT_08 22
48#define FIQ_CNT_INT_09 23
49#define FIQ_CNT_INT_10 24
50#define FIQ_CNT_INT_11 25
51#define FIQ_CNT_INT_12 26
52#define FIQ_CNT_INT_13 27
53#define FIQ_CNT_INT_14 28
54#define FIQ_CNT_INT_15 29
55
56#define FIQ_CIRC_BUFF 30 /*Start of circular buffer */
57
58#endif
diff --git a/include/linux/platform_data/bt-nokia-h4p.h b/include/linux/platform_data/bt-nokia-h4p.h
deleted file mode 100644
index 30d169dfadf3..000000000000
--- a/include/linux/platform_data/bt-nokia-h4p.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * This file is part of Nokia H4P bluetooth driver
3 *
4 * Copyright (C) 2010 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22
23/**
24 * struct hci_h4p_platform data - hci_h4p Platform data structure
25 */
26struct hci_h4p_platform_data {
27 int chip_type;
28 int bt_sysclk;
29 unsigned int bt_wakeup_gpio;
30 unsigned int host_wakeup_gpio;
31 unsigned int reset_gpio;
32 int reset_gpio_shared;
33 unsigned int uart_irq;
34 phys_addr_t uart_base;
35 const char *uart_iclk;
36 const char *uart_fclk;
37 void (*set_pm_limits)(struct device *dev, bool set);
38};
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
index 90ae19ca828f..57a5a35e0073 100644
--- a/include/linux/platform_data/gpio-davinci.h
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -22,6 +22,7 @@
22#include <asm-generic/gpio.h> 22#include <asm-generic/gpio.h>
23 23
24#define MAX_REGS_BANKS 5 24#define MAX_REGS_BANKS 5
25#define MAX_INT_PER_BANK 32
25 26
26struct davinci_gpio_platform_data { 27struct davinci_gpio_platform_data {
27 u32 ngpio; 28 u32 ngpio;
@@ -41,7 +42,7 @@ struct davinci_gpio_controller {
41 spinlock_t lock; 42 spinlock_t lock;
42 void __iomem *regs[MAX_REGS_BANKS]; 43 void __iomem *regs[MAX_REGS_BANKS];
43 int gpio_unbanked; 44 int gpio_unbanked;
44 unsigned int base_irq; 45 int irqs[MAX_INT_PER_BANK];
45 unsigned int base; 46 unsigned int base;
46}; 47};
47 48
diff --git a/include/linux/platform_data/i2c-hid.h b/include/linux/platform_data/i2c-hid.h
index 1fb088239d12..c628bb5e1061 100644
--- a/include/linux/platform_data/i2c-hid.h
+++ b/include/linux/platform_data/i2c-hid.h
@@ -12,14 +12,13 @@
12#ifndef __LINUX_I2C_HID_H 12#ifndef __LINUX_I2C_HID_H
13#define __LINUX_I2C_HID_H 13#define __LINUX_I2C_HID_H
14 14
15#include <linux/regulator/consumer.h>
15#include <linux/types.h> 16#include <linux/types.h>
16 17
17struct regulator;
18
19/** 18/**
20 * struct i2chid_platform_data - used by hid over i2c implementation. 19 * struct i2chid_platform_data - used by hid over i2c implementation.
21 * @hid_descriptor_address: i2c register where the HID descriptor is stored. 20 * @hid_descriptor_address: i2c register where the HID descriptor is stored.
22 * @supply: regulator for powering on the device. 21 * @supplies: regulators for powering on the device.
23 * @post_power_delay_ms: delay after powering on before device is usable. 22 * @post_power_delay_ms: delay after powering on before device is usable.
24 * 23 *
25 * Note that it is the responsibility of the platform driver (or the acpi 5.0 24 * Note that it is the responsibility of the platform driver (or the acpi 5.0
@@ -35,7 +34,7 @@ struct regulator;
35 */ 34 */
36struct i2c_hid_platform_data { 35struct i2c_hid_platform_data {
37 u16 hid_descriptor_address; 36 u16 hid_descriptor_address;
38 struct regulator *supply; 37 struct regulator_bulk_data supplies[2];
39 int post_power_delay_ms; 38 int post_power_delay_ms;
40}; 39};
41 40
diff --git a/include/linux/platform_data/i2c-ocores.h b/include/linux/platform_data/i2c-ocores.h
index 01edd96fe1f7..113d6b12f650 100644
--- a/include/linux/platform_data/i2c-ocores.h
+++ b/include/linux/platform_data/i2c-ocores.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * i2c-ocores.h - definitions for the i2c-ocores interface 2 * i2c-ocores.h - definitions for the i2c-ocores interface
3 * 3 *
4 * Peter Korsgaard <jacmet@sunsite.dk> 4 * Peter Korsgaard <peter@korsgaard.com>
5 * 5 *
6 * This file is licensed under the terms of the GNU General Public License 6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any 7 * version 2. This program is licensed "as is" without any warranty of any
diff --git a/include/linux/platform_data/ina2xx.h b/include/linux/platform_data/ina2xx.h
index 9abc0ca7259b..9f0aa1b48c78 100644
--- a/include/linux/platform_data/ina2xx.h
+++ b/include/linux/platform_data/ina2xx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Driver for Texas Instruments INA219, INA226 power monitor chips 2 * Driver for Texas Instruments INA219, INA226 power monitor chips
3 * 3 *
4 * Copyright (C) 2012 Lothar Felten <l-felten@ti.com> 4 * Copyright (C) 2012 Lothar Felten <lothar.felten@gmail.com>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/linux/platform_data/jz4740/jz4740_nand.h b/include/linux/platform_data/jz4740/jz4740_nand.h
new file mode 100644
index 000000000000..bc571f6d5ced
--- /dev/null
+++ b/include/linux/platform_data/jz4740/jz4740_nand.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC NAND controller driver
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __JZ4740_NAND_H__
17#define __JZ4740_NAND_H__
18
19#include <linux/mtd/rawnand.h>
20#include <linux/mtd/partitions.h>
21
22#define JZ_NAND_NUM_BANKS 4
23
24struct jz_nand_platform_data {
25 int num_partitions;
26 struct mtd_partition *partitions;
27
28 unsigned char banks[JZ_NAND_NUM_BANKS];
29
30 void (*ident_callback)(struct platform_device *, struct mtd_info *,
31 struct mtd_partition **, int *num_partitions);
32};
33
34#endif
diff --git a/include/linux/platform_data/media/sii9234.h b/include/linux/platform_data/media/sii9234.h
deleted file mode 100644
index 6a4a809fe9a3..000000000000
--- a/include/linux/platform_data/media/sii9234.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Driver header for SII9234 MHL converter chip.
3 *
4 * Copyright (c) 2011 Samsung Electronics, Co. Ltd
5 * Contact: Tomasz Stanislawski <t.stanislaws@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef SII9234_H
14#define SII9234_H
15
16/**
17 * @gpio_n_reset: GPIO driving nRESET pin
18 */
19
20struct sii9234_platform_data {
21 int gpio_n_reset;
22};
23
24#endif /* SII9234_H */
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index 7daa78a2f342..640dec8b5b0c 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -34,7 +34,6 @@ enum cd_types {
34 * @cd_gpio: gpio for card_detect interrupt 34 * @cd_gpio: gpio for card_detect interrupt
35 * @wp_type: type of write_protect method (see wp_types enum above) 35 * @wp_type: type of write_protect method (see wp_types enum above)
36 * @cd_type: type of card_detect method (see cd_types enum above) 36 * @cd_type: type of card_detect method (see cd_types enum above)
37 * @support_vsel: indicate it supports 1.8v switching
38 */ 37 */
39 38
40struct esdhc_platform_data { 39struct esdhc_platform_data {
@@ -43,7 +42,6 @@ struct esdhc_platform_data {
43 enum wp_types wp_type; 42 enum wp_types wp_type;
44 enum cd_types cd_type; 43 enum cd_types cd_type;
45 int max_bus_width; 44 int max_bus_width;
46 bool support_vsel;
47 unsigned int delay_line; 45 unsigned int delay_line;
48 unsigned int tuning_step; /* The delay cell steps in tuning procedure */ 46 unsigned int tuning_step; /* The delay cell steps in tuning procedure */
49 unsigned int tuning_start_tap; /* The start delay cell point in tuning procedure */ 47 unsigned int tuning_start_tap; /* The start delay cell point in tuning procedure */
diff --git a/include/linux/platform_data/mmp_dma.h b/include/linux/platform_data/mmp_dma.h
index d1397c8ed94e..6397b9c8149a 100644
--- a/include/linux/platform_data/mmp_dma.h
+++ b/include/linux/platform_data/mmp_dma.h
@@ -12,9 +12,13 @@
12#ifndef MMP_DMA_H 12#ifndef MMP_DMA_H
13#define MMP_DMA_H 13#define MMP_DMA_H
14 14
15struct dma_slave_map;
16
15struct mmp_dma_platdata { 17struct mmp_dma_platdata {
16 int dma_channels; 18 int dma_channels;
17 int nb_requestors; 19 int nb_requestors;
20 int slave_map_cnt;
21 const struct dma_slave_map *slave_map;
18}; 22};
19 23
20#endif /* MMP_DMA_H */ 24#endif /* MMP_DMA_H */
diff --git a/include/linux/platform_data/mtd-davinci-aemif.h b/include/linux/platform_data/mtd-davinci-aemif.h
index 97948ac2bb9b..a403dd51dacc 100644
--- a/include/linux/platform_data/mtd-davinci-aemif.h
+++ b/include/linux/platform_data/mtd-davinci-aemif.h
@@ -33,5 +33,4 @@ struct davinci_aemif_timing {
33 u8 ta; 33 u8 ta;
34}; 34};
35 35
36int davinci_aemif_setup(struct platform_device *pdev);
37#endif 36#endif
diff --git a/include/linux/platform_data/mtd-orion_nand.h b/include/linux/platform_data/mtd-orion_nand.h
index a7ce77c7c1a8..34828eb85982 100644
--- a/include/linux/platform_data/mtd-orion_nand.h
+++ b/include/linux/platform_data/mtd-orion_nand.h
@@ -12,7 +12,6 @@
12 */ 12 */
13struct orion_nand_data { 13struct orion_nand_data {
14 struct mtd_partition *parts; 14 struct mtd_partition *parts;
15 int (*dev_ready)(struct mtd_info *mtd);
16 u32 nr_parts; 15 u32 nr_parts;
17 u8 ale; /* address line number connected to ALE */ 16 u8 ale; /* address line number connected to ALE */
18 u8 cle; /* address line number connected to CLE */ 17 u8 cle; /* address line number connected to CLE */
diff --git a/include/linux/platform_data/pm33xx.h b/include/linux/platform_data/pm33xx.h
index f9bed2a0af9d..fbf5ed73c7cc 100644
--- a/include/linux/platform_data/pm33xx.h
+++ b/include/linux/platform_data/pm33xx.h
@@ -12,6 +12,29 @@
12#include <linux/kbuild.h> 12#include <linux/kbuild.h>
13#include <linux/types.h> 13#include <linux/types.h>
14 14
15/*
16 * WFI Flags for sleep code control
17 *
18 * These flags allow PM code to exclude certain operations from happening
19 * in the low level ASM code found in sleep33xx.S and sleep43xx.S
20 *
21 * WFI_FLAG_FLUSH_CACHE: Flush the ARM caches and disable caching. Only
22 * needed when MPU will lose context.
23 * WFI_FLAG_SELF_REFRESH: Let EMIF place DDR memory into self-refresh and
24 * disable EMIF.
25 * WFI_FLAG_SAVE_EMIF: Save context of all EMIF registers and restore in
26 * resume path. Only needed if PER domain loses context
27 * and must also have WFI_FLAG_SELF_REFRESH set.
28 * WFI_FLAG_WAKE_M3: Disable MPU clock or clockdomain to cause wkup_m3 to
29 * execute when WFI instruction executes.
30 * WFI_FLAG_RTC_ONLY: Configure the RTC to enter RTC+DDR mode.
31 */
32#define WFI_FLAG_FLUSH_CACHE BIT(0)
33#define WFI_FLAG_SELF_REFRESH BIT(1)
34#define WFI_FLAG_SAVE_EMIF BIT(2)
35#define WFI_FLAG_WAKE_M3 BIT(3)
36#define WFI_FLAG_RTC_ONLY BIT(4)
37
15#ifndef __ASSEMBLER__ 38#ifndef __ASSEMBLER__
16struct am33xx_pm_sram_addr { 39struct am33xx_pm_sram_addr {
17 void (*do_wfi)(void); 40 void (*do_wfi)(void);
@@ -19,12 +42,15 @@ struct am33xx_pm_sram_addr {
19 unsigned long *resume_offset; 42 unsigned long *resume_offset;
20 unsigned long *emif_sram_table; 43 unsigned long *emif_sram_table;
21 unsigned long *ro_sram_data; 44 unsigned long *ro_sram_data;
45 unsigned long resume_address;
22}; 46};
23 47
24struct am33xx_pm_platform_data { 48struct am33xx_pm_platform_data {
25 int (*init)(void); 49 int (*init)(void);
26 int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long)); 50 int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long),
51 unsigned long args);
27 struct am33xx_pm_sram_addr *(*get_sram_addrs)(void); 52 struct am33xx_pm_sram_addr *(*get_sram_addrs)(void);
53 void __iomem *(*get_rtc_base_addr)(void);
28}; 54};
29 55
30struct am33xx_pm_sram_data { 56struct am33xx_pm_sram_data {
@@ -36,6 +62,7 @@ struct am33xx_pm_sram_data {
36struct am33xx_pm_ro_sram_data { 62struct am33xx_pm_ro_sram_data {
37 u32 amx3_pm_sram_data_virt; 63 u32 amx3_pm_sram_data_virt;
38 u32 amx3_pm_sram_data_phys; 64 u32 amx3_pm_sram_data_phys;
65 void __iomem *rtc_base_virt;
39} __packed __aligned(8); 66} __packed __aligned(8);
40 67
41#endif /* __ASSEMBLER__ */ 68#endif /* __ASSEMBLER__ */
diff --git a/include/linux/platform_data/sh_ipmmu.h b/include/linux/platform_data/sh_ipmmu.h
deleted file mode 100644
index 39f7405cdac5..000000000000
--- a/include/linux/platform_data/sh_ipmmu.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* sh_ipmmu.h
2 *
3 * Copyright (C) 2012 Hideki EIRAKU
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 */
9
10#ifndef __SH_IPMMU_H__
11#define __SH_IPMMU_H__
12
13struct shmobile_ipmmu_platform_data {
14 const char * const *dev_names;
15 unsigned int num_dev_names;
16};
17
18#endif /* __SH_IPMMU_H__ */
diff --git a/include/linux/platform_data/ti-sysc.h b/include/linux/platform_data/ti-sysc.h
index 990aad477458..2efa3470a451 100644
--- a/include/linux/platform_data/ti-sysc.h
+++ b/include/linux/platform_data/ti-sysc.h
@@ -14,6 +14,7 @@ enum ti_sysc_module_type {
14 TI_SYSC_OMAP4_SR, 14 TI_SYSC_OMAP4_SR,
15 TI_SYSC_OMAP4_MCASP, 15 TI_SYSC_OMAP4_MCASP,
16 TI_SYSC_OMAP4_USB_HOST_FS, 16 TI_SYSC_OMAP4_USB_HOST_FS,
17 TI_SYSC_DRA7_MCAN,
17}; 18};
18 19
19struct ti_sysc_cookie { 20struct ti_sysc_cookie {
diff --git a/include/linux/platform_data/txx9/ndfmc.h b/include/linux/platform_data/txx9/ndfmc.h
new file mode 100644
index 000000000000..fc172627d54e
--- /dev/null
+++ b/include/linux/platform_data/txx9/ndfmc.h
@@ -0,0 +1,30 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * (C) Copyright TOSHIBA CORPORATION 2007
7 */
8#ifndef __TXX9_NDFMC_H
9#define __TXX9_NDFMC_H
10
11#define NDFMC_PLAT_FLAG_USE_BSPRT 0x01
12#define NDFMC_PLAT_FLAG_NO_RSTR 0x02
13#define NDFMC_PLAT_FLAG_HOLDADD 0x04
14#define NDFMC_PLAT_FLAG_DUMMYWRITE 0x08
15
16struct txx9ndfmc_platform_data {
17 unsigned int shift;
18 unsigned int gbus_clock;
19 unsigned int hold; /* hold time in nanosecond */
20 unsigned int spw; /* strobe pulse width in nanosecond */
21 unsigned int flags;
22 unsigned char ch_mask; /* available channel bitmask */
23 unsigned char wp_mask; /* write-protect bitmask */
24 unsigned char wide_mask; /* 16bit-nand bitmask */
25};
26
27void txx9_ndfmc_init(unsigned long baseaddr,
28 const struct txx9ndfmc_platform_data *plat_data);
29
30#endif /* __TXX9_NDFMC_H */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 3097c943fab9..1a9f38f27f65 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -12,13 +12,13 @@
12#define _PLATFORM_DEVICE_H_ 12#define _PLATFORM_DEVICE_H_
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h>
16 15
17#define PLATFORM_DEVID_NONE (-1) 16#define PLATFORM_DEVID_NONE (-1)
18#define PLATFORM_DEVID_AUTO (-2) 17#define PLATFORM_DEVID_AUTO (-2)
19 18
20struct mfd_cell; 19struct mfd_cell;
21struct property_entry; 20struct property_entry;
21struct platform_device_id;
22 22
23struct platform_device { 23struct platform_device {
24 const char *name; 24 const char *name;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index cb8d84090cfb..776c546d581a 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -239,6 +239,8 @@ unsigned int of_genpd_opp_to_performance_state(struct device *dev,
239int genpd_dev_pm_attach(struct device *dev); 239int genpd_dev_pm_attach(struct device *dev);
240struct device *genpd_dev_pm_attach_by_id(struct device *dev, 240struct device *genpd_dev_pm_attach_by_id(struct device *dev,
241 unsigned int index); 241 unsigned int index);
242struct device *genpd_dev_pm_attach_by_name(struct device *dev,
243 char *name);
242#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ 244#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
243static inline int of_genpd_add_provider_simple(struct device_node *np, 245static inline int of_genpd_add_provider_simple(struct device_node *np,
244 struct generic_pm_domain *genpd) 246 struct generic_pm_domain *genpd)
@@ -290,6 +292,12 @@ static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev,
290 return NULL; 292 return NULL;
291} 293}
292 294
295static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev,
296 char *name)
297{
298 return NULL;
299}
300
293static inline 301static inline
294struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) 302struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
295{ 303{
@@ -301,6 +309,8 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
301int dev_pm_domain_attach(struct device *dev, bool power_on); 309int dev_pm_domain_attach(struct device *dev, bool power_on);
302struct device *dev_pm_domain_attach_by_id(struct device *dev, 310struct device *dev_pm_domain_attach_by_id(struct device *dev,
303 unsigned int index); 311 unsigned int index);
312struct device *dev_pm_domain_attach_by_name(struct device *dev,
313 char *name);
304void dev_pm_domain_detach(struct device *dev, bool power_off); 314void dev_pm_domain_detach(struct device *dev, bool power_off);
305void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); 315void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd);
306#else 316#else
@@ -313,6 +323,11 @@ static inline struct device *dev_pm_domain_attach_by_id(struct device *dev,
313{ 323{
314 return NULL; 324 return NULL;
315} 325}
326static inline struct device *dev_pm_domain_attach_by_name(struct device *dev,
327 char *name)
328{
329 return NULL;
330}
316static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {} 331static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
317static inline void dev_pm_domain_set(struct device *dev, 332static inline void dev_pm_domain_set(struct device *dev,
318 struct dev_pm_domain *pd) {} 333 struct dev_pm_domain *pd) {}
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index b21c4bd96b84..f80769175c56 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -269,6 +269,7 @@ struct power_supply {
269 spinlock_t changed_lock; 269 spinlock_t changed_lock;
270 bool changed; 270 bool changed;
271 bool initialized; 271 bool initialized;
272 bool removing;
272 atomic_t use_cnt; 273 atomic_t use_cnt;
273#ifdef CONFIG_THERMAL 274#ifdef CONFIG_THERMAL
274 struct thermal_zone_device *tzd; 275 struct thermal_zone_device *tzd;
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 5bd3f151da78..c01813c3fbe9 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -150,7 +150,7 @@
150 */ 150 */
151#define in_atomic_preempt_off() (preempt_count() != PREEMPT_DISABLE_OFFSET) 151#define in_atomic_preempt_off() (preempt_count() != PREEMPT_DISABLE_OFFSET)
152 152
153#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) 153#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_TRACE_PREEMPT_TOGGLE)
154extern void preempt_count_add(int val); 154extern void preempt_count_add(int val);
155extern void preempt_count_sub(int val); 155extern void preempt_count_sub(int val);
156#define preempt_count_dec_and_test() \ 156#define preempt_count_dec_and_test() \
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 6d7e800affd8..cf3eccfe1543 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -50,15 +50,15 @@ static inline const char *printk_skip_headers(const char *buffer)
50/* We show everything that is MORE important than this.. */ 50/* We show everything that is MORE important than this.. */
51#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ 51#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
52#define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ 52#define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */
53#define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */
54#define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ 53#define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */
55#define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ 54#define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */
56 55
57/* 56/*
58 * Default used to be hard-coded at 7, we're now allowing it to be set from 57 * Default used to be hard-coded at 7, quiet used to be hardcoded at 4,
59 * kernel config. 58 * we're now allowing both to be set from kernel config.
60 */ 59 */
61#define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT 60#define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT
61#define CONSOLE_LOGLEVEL_QUIET CONFIG_CONSOLE_LOGLEVEL_QUIET
62 62
63extern int console_printk[]; 63extern int console_printk[];
64 64
@@ -148,9 +148,13 @@ void early_printk(const char *s, ...) { }
148#ifdef CONFIG_PRINTK_NMI 148#ifdef CONFIG_PRINTK_NMI
149extern void printk_nmi_enter(void); 149extern void printk_nmi_enter(void);
150extern void printk_nmi_exit(void); 150extern void printk_nmi_exit(void);
151extern void printk_nmi_direct_enter(void);
152extern void printk_nmi_direct_exit(void);
151#else 153#else
152static inline void printk_nmi_enter(void) { } 154static inline void printk_nmi_enter(void) { }
153static inline void printk_nmi_exit(void) { } 155static inline void printk_nmi_exit(void) { }
156static inline void printk_nmi_direct_enter(void) { }
157static inline void printk_nmi_direct_exit(void) { }
154#endif /* PRINTK_NMI */ 158#endif /* PRINTK_NMI */
155 159
156#ifdef CONFIG_PRINTK 160#ifdef CONFIG_PRINTK
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 626fc65c4336..d0e1f1522a78 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -129,7 +129,7 @@ int open_related_ns(struct ns_common *ns,
129 struct ns_common *(*get_ns)(struct ns_common *ns)); 129 struct ns_common *(*get_ns)(struct ns_common *ns));
130 130
131/* get the associated pid namespace for a file in procfs */ 131/* get the associated pid namespace for a file in procfs */
132static inline struct pid_namespace *proc_pid_ns(struct inode *inode) 132static inline struct pid_namespace *proc_pid_ns(const struct inode *inode)
133{ 133{
134 return inode->i_sb->s_fs_info; 134 return inode->i_sb->s_fs_info;
135} 135}
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 037bf0ef1ae9..4f36431c380b 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -214,8 +214,6 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
214 task_set_jobctl_pending(child, JOBCTL_TRAP_STOP); 214 task_set_jobctl_pending(child, JOBCTL_TRAP_STOP);
215 else 215 else
216 sigaddset(&child->pending.signal, SIGSTOP); 216 sigaddset(&child->pending.signal, SIGSTOP);
217
218 set_tsk_thread_flag(child, TIF_SIGPENDING);
219 } 217 }
220 else 218 else
221 child->ptracer_cred = NULL; 219 child->ptracer_cred = NULL;
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 8461b18e4608..13b4244d44c1 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -171,6 +171,14 @@
171#define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass */ 171#define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass */
172#define SSACD_ACPS(x) ((x) << 4) /* Audio clock PLL select */ 172#define SSACD_ACPS(x) ((x) << 4) /* Audio clock PLL select */
173#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */ 173#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */
174#define SSACD_ACDS_1 (0)
175#define SSACD_ACDS_2 (1)
176#define SSACD_ACDS_4 (2)
177#define SSACD_ACDS_8 (3)
178#define SSACD_ACDS_16 (4)
179#define SSACD_ACDS_32 (5)
180#define SSACD_SCDB_4X (0)
181#define SSACD_SCDB_1X (1)
174#define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */ 182#define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */
175 183
176/* LPSS SSP */ 184/* LPSS SSP */
@@ -212,8 +220,6 @@ struct ssp_device {
212 int type; 220 int type;
213 int use_count; 221 int use_count;
214 int irq; 222 int irq;
215 int drcmr_rx;
216 int drcmr_tx;
217 223
218 struct device_node *of_node; 224 struct device_node *of_node;
219}; 225};
diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
index b401b962afff..5d65521260b3 100644
--- a/include/linux/qcom_scm.h
+++ b/include/linux/qcom_scm.h
@@ -87,6 +87,10 @@ static inline int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr,
87static inline int 87static inline int
88qcom_scm_pas_auth_and_reset(u32 peripheral) { return -ENODEV; } 88qcom_scm_pas_auth_and_reset(u32 peripheral) { return -ENODEV; }
89static inline int qcom_scm_pas_shutdown(u32 peripheral) { return -ENODEV; } 89static inline int qcom_scm_pas_shutdown(u32 peripheral) { return -ENODEV; }
90static inline int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
91 unsigned int *src,
92 struct qcom_scm_vmperm *newvm,
93 int dest_cnt) { return -ENODEV; }
90static inline void qcom_scm_cpu_power_down(u32 flags) {} 94static inline void qcom_scm_cpu_power_down(u32 flags) {}
91static inline u32 qcom_scm_get_version(void) { return 0; } 95static inline u32 qcom_scm_get_version(void) { return 0; }
92static inline u32 96static inline u32
diff --git a/include/linux/qed/qed_eth_if.h b/include/linux/qed/qed_eth_if.h
index 2978fa4add42..a1310482c4ed 100644
--- a/include/linux/qed/qed_eth_if.h
+++ b/include/linux/qed/qed_eth_if.h
@@ -39,6 +39,10 @@
39#include <linux/qed/qed_if.h> 39#include <linux/qed/qed_if.h>
40#include <linux/qed/qed_iov_if.h> 40#include <linux/qed/qed_iov_if.h>
41 41
42/* 64 max queues * (1 rx + 4 tx-cos + 1 xdp) */
43#define QED_MIN_L2_CONS (2 + NUM_PHYS_TCS_4PORT_K2)
44#define QED_MAX_L2_CONS (64 * (QED_MIN_L2_CONS))
45
42struct qed_queue_start_common_params { 46struct qed_queue_start_common_params {
43 /* Should always be relative to entity sending this. */ 47 /* Should always be relative to entity sending this. */
44 u8 vport_id; 48 u8 vport_id;
@@ -49,6 +53,8 @@ struct qed_queue_start_common_params {
49 53
50 struct qed_sb_info *p_sb; 54 struct qed_sb_info *p_sb;
51 u8 sb_idx; 55 u8 sb_idx;
56
57 u8 tc;
52}; 58};
53 59
54struct qed_rxq_start_ret_params { 60struct qed_rxq_start_ret_params {
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index b4040023cbfb..8cd34645e892 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -759,6 +759,9 @@ struct qed_generic_tlvs {
759 u8 mac[QED_TLV_MAC_COUNT][ETH_ALEN]; 759 u8 mac[QED_TLV_MAC_COUNT][ETH_ALEN];
760}; 760};
761 761
762#define QED_I2C_DEV_ADDR_A0 0xA0
763#define QED_I2C_DEV_ADDR_A2 0xA2
764
762#define QED_NVM_SIGNATURE 0x12435687 765#define QED_NVM_SIGNATURE 0x12435687
763 766
764enum qed_nvm_flash_cmd { 767enum qed_nvm_flash_cmd {
@@ -1026,6 +1029,18 @@ struct qed_common_ops {
1026 * @param enabled - true iff WoL should be enabled. 1029 * @param enabled - true iff WoL should be enabled.
1027 */ 1030 */
1028 int (*update_wol) (struct qed_dev *cdev, bool enabled); 1031 int (*update_wol) (struct qed_dev *cdev, bool enabled);
1032
1033/**
1034 * @brief read_module_eeprom
1035 *
1036 * @param cdev
1037 * @param buf - buffer
1038 * @param dev_addr - PHY device memory region
1039 * @param offset - offset into eeprom contents to be read
1040 * @param len - buffer length, i.e., max bytes to be read
1041 */
1042 int (*read_module_eeprom)(struct qed_dev *cdev,
1043 char *buf, u8 dev_addr, u32 offset, u32 len);
1029}; 1044};
1030 1045
1031#define MASK_FIELD(_name, _value) \ 1046#define MASK_FIELD(_name, _value) \
diff --git a/include/linux/quota.h b/include/linux/quota.h
index ca9772c8e48b..f32dd270b8e3 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -408,13 +408,7 @@ struct qc_type_state {
408 408
409struct qc_state { 409struct qc_state {
410 unsigned int s_incoredqs; /* Number of dquots in core */ 410 unsigned int s_incoredqs; /* Number of dquots in core */
411 /* 411 struct qc_type_state s_state[MAXQUOTAS]; /* Per quota type information */
412 * Per quota type information. The array should really have
413 * max(MAXQUOTAS, XQM_MAXQUOTAS) entries. BUILD_BUG_ON in
414 * quota_getinfo() makes sure XQM_MAXQUOTAS is large enough. Once VFS
415 * supports project quotas, this can be changed to MAXQUOTAS
416 */
417 struct qc_type_state s_state[XQM_MAXQUOTAS];
418}; 412};
419 413
420/* Structure for communicating via ->set_info */ 414/* Structure for communicating via ->set_info */
diff --git a/include/linux/random.h b/include/linux/random.h
index 2ddf13b4281e..445a0ea4ff49 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -36,9 +36,10 @@ extern void add_interrupt_randomness(int irq, int irq_flags) __latent_entropy;
36 36
37extern void get_random_bytes(void *buf, int nbytes); 37extern void get_random_bytes(void *buf, int nbytes);
38extern int wait_for_random_bytes(void); 38extern int wait_for_random_bytes(void);
39extern bool rng_is_initialized(void);
39extern int add_random_ready_callback(struct random_ready_callback *rdy); 40extern int add_random_ready_callback(struct random_ready_callback *rdy);
40extern void del_random_ready_callback(struct random_ready_callback *rdy); 41extern void del_random_ready_callback(struct random_ready_callback *rdy);
41extern void get_random_bytes_arch(void *buf, int nbytes); 42extern int __must_check get_random_bytes_arch(void *buf, int nbytes);
42 43
43#ifndef MODULE 44#ifndef MODULE
44extern const struct file_operations random_fops, urandom_fops; 45extern const struct file_operations random_fops, urandom_fops;
diff --git a/include/linux/reciprocal_div.h b/include/linux/reciprocal_div.h
index e031e9f2f9d8..585ce89c0f33 100644
--- a/include/linux/reciprocal_div.h
+++ b/include/linux/reciprocal_div.h
@@ -25,6 +25,9 @@ struct reciprocal_value {
25 u8 sh1, sh2; 25 u8 sh1, sh2;
26}; 26};
27 27
28/* "reciprocal_value" and "reciprocal_divide" together implement the basic
29 * version of the algorithm described in Figure 4.1 of the paper.
30 */
28struct reciprocal_value reciprocal_value(u32 d); 31struct reciprocal_value reciprocal_value(u32 d);
29 32
30static inline u32 reciprocal_divide(u32 a, struct reciprocal_value R) 33static inline u32 reciprocal_divide(u32 a, struct reciprocal_value R)
@@ -33,4 +36,69 @@ static inline u32 reciprocal_divide(u32 a, struct reciprocal_value R)
33 return (t + ((a - t) >> R.sh1)) >> R.sh2; 36 return (t + ((a - t) >> R.sh1)) >> R.sh2;
34} 37}
35 38
39struct reciprocal_value_adv {
40 u32 m;
41 u8 sh, exp;
42 bool is_wide_m;
43};
44
45/* "reciprocal_value_adv" implements the advanced version of the algorithm
46 * described in Figure 4.2 of the paper except when "divisor > (1U << 31)" whose
47 * ceil(log2(d)) result will be 32 which then requires u128 divide on host. The
48 * exception case could be easily handled before calling "reciprocal_value_adv".
49 *
50 * The advanced version requires more complex calculation to get the reciprocal
51 * multiplier and other control variables, but then could reduce the required
52 * emulation operations.
53 *
54 * It makes no sense to use this advanced version for host divide emulation,
55 * those extra complexities for calculating multiplier etc could completely
56 * waive our saving on emulation operations.
57 *
58 * However, it makes sense to use it for JIT divide code generation for which
59 * we are willing to trade performance of JITed code with that of host. As shown
60 * by the following pseudo code, the required emulation operations could go down
61 * from 6 (the basic version) to 3 or 4.
62 *
63 * To use the result of "reciprocal_value_adv", suppose we want to calculate
64 * n/d, the pseudo C code will be:
65 *
66 * struct reciprocal_value_adv rvalue;
67 * u8 pre_shift, exp;
68 *
69 * // handle exception case.
70 * if (d >= (1U << 31)) {
71 * result = n >= d;
72 * return;
73 * }
74 *
75 * rvalue = reciprocal_value_adv(d, 32)
76 * exp = rvalue.exp;
77 * if (rvalue.is_wide_m && !(d & 1)) {
78 * // floor(log2(d & (2^32 -d)))
79 * pre_shift = fls(d & -d) - 1;
80 * rvalue = reciprocal_value_adv(d >> pre_shift, 32 - pre_shift);
81 * } else {
82 * pre_shift = 0;
83 * }
84 *
85 * // code generation starts.
86 * if (imm == 1U << exp) {
87 * result = n >> exp;
88 * } else if (rvalue.is_wide_m) {
89 * // pre_shift must be zero when reached here.
90 * t = (n * rvalue.m) >> 32;
91 * result = n - t;
92 * result >>= 1;
93 * result += t;
94 * result >>= rvalue.sh - 1;
95 * } else {
96 * if (pre_shift)
97 * result = n >> pre_shift;
98 * result = ((u64)result * rvalue.m) >> 32;
99 * result >>= rvalue.sh;
100 * }
101 */
102struct reciprocal_value_adv reciprocal_value_adv(u32 d, u8 prec);
103
36#endif /* _LINUX_RECIPROCAL_DIV_H */ 104#endif /* _LINUX_RECIPROCAL_DIV_H */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4f38068ffb71..379505a53722 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -268,6 +268,13 @@ typedef void (*regmap_unlock)(void *);
268 * field is NULL but precious_table (see below) is not, the 268 * field is NULL but precious_table (see below) is not, the
269 * check is performed on such table (a register is precious if 269 * check is performed on such table (a register is precious if
270 * it belongs to one of the ranges specified by precious_table). 270 * it belongs to one of the ranges specified by precious_table).
271 * @readable_noinc_reg: Optional callback returning true if the register
272 * supports multiple read operations without incrementing
273 * the register number. If this field is NULL but
274 * rd_noinc_table (see below) is not, the check is
275 * performed on such table (a register is no increment
276 * readable if it belongs to one of the ranges specified
277 * by rd_noinc_table).
271 * @disable_locking: This regmap is either protected by external means or 278 * @disable_locking: This regmap is either protected by external means or
272 * is guaranteed not be be accessed from multiple threads. 279 * is guaranteed not be be accessed from multiple threads.
273 * Don't use any locking mechanisms. 280 * Don't use any locking mechanisms.
@@ -295,6 +302,7 @@ typedef void (*regmap_unlock)(void *);
295 * @rd_table: As above, for read access. 302 * @rd_table: As above, for read access.
296 * @volatile_table: As above, for volatile registers. 303 * @volatile_table: As above, for volatile registers.
297 * @precious_table: As above, for precious registers. 304 * @precious_table: As above, for precious registers.
305 * @rd_noinc_table: As above, for no increment readable registers.
298 * @reg_defaults: Power on reset values for registers (for use with 306 * @reg_defaults: Power on reset values for registers (for use with
299 * register cache support). 307 * register cache support).
300 * @num_reg_defaults: Number of elements in reg_defaults. 308 * @num_reg_defaults: Number of elements in reg_defaults.
@@ -344,6 +352,7 @@ struct regmap_config {
344 bool (*readable_reg)(struct device *dev, unsigned int reg); 352 bool (*readable_reg)(struct device *dev, unsigned int reg);
345 bool (*volatile_reg)(struct device *dev, unsigned int reg); 353 bool (*volatile_reg)(struct device *dev, unsigned int reg);
346 bool (*precious_reg)(struct device *dev, unsigned int reg); 354 bool (*precious_reg)(struct device *dev, unsigned int reg);
355 bool (*readable_noinc_reg)(struct device *dev, unsigned int reg);
347 356
348 bool disable_locking; 357 bool disable_locking;
349 regmap_lock lock; 358 regmap_lock lock;
@@ -360,6 +369,7 @@ struct regmap_config {
360 const struct regmap_access_table *rd_table; 369 const struct regmap_access_table *rd_table;
361 const struct regmap_access_table *volatile_table; 370 const struct regmap_access_table *volatile_table;
362 const struct regmap_access_table *precious_table; 371 const struct regmap_access_table *precious_table;
372 const struct regmap_access_table *rd_noinc_table;
363 const struct reg_default *reg_defaults; 373 const struct reg_default *reg_defaults;
364 unsigned int num_reg_defaults; 374 unsigned int num_reg_defaults;
365 enum regcache_type cache_type; 375 enum regcache_type cache_type;
@@ -514,6 +524,10 @@ struct regmap *__regmap_init_i2c(struct i2c_client *i2c,
514 const struct regmap_config *config, 524 const struct regmap_config *config,
515 struct lock_class_key *lock_key, 525 struct lock_class_key *lock_key,
516 const char *lock_name); 526 const char *lock_name);
527struct regmap *__regmap_init_sccb(struct i2c_client *i2c,
528 const struct regmap_config *config,
529 struct lock_class_key *lock_key,
530 const char *lock_name);
517struct regmap *__regmap_init_slimbus(struct slim_device *slimbus, 531struct regmap *__regmap_init_slimbus(struct slim_device *slimbus,
518 const struct regmap_config *config, 532 const struct regmap_config *config,
519 struct lock_class_key *lock_key, 533 struct lock_class_key *lock_key,
@@ -558,6 +572,10 @@ struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c,
558 const struct regmap_config *config, 572 const struct regmap_config *config,
559 struct lock_class_key *lock_key, 573 struct lock_class_key *lock_key,
560 const char *lock_name); 574 const char *lock_name);
575struct regmap *__devm_regmap_init_sccb(struct i2c_client *i2c,
576 const struct regmap_config *config,
577 struct lock_class_key *lock_key,
578 const char *lock_name);
561struct regmap *__devm_regmap_init_spi(struct spi_device *dev, 579struct regmap *__devm_regmap_init_spi(struct spi_device *dev,
562 const struct regmap_config *config, 580 const struct regmap_config *config,
563 struct lock_class_key *lock_key, 581 struct lock_class_key *lock_key,
@@ -646,6 +664,19 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,
646 i2c, config) 664 i2c, config)
647 665
648/** 666/**
667 * regmap_init_sccb() - Initialise register map
668 *
669 * @i2c: Device that will be interacted with
670 * @config: Configuration for register map
671 *
672 * The return value will be an ERR_PTR() on error or a valid pointer to
673 * a struct regmap.
674 */
675#define regmap_init_sccb(i2c, config) \
676 __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \
677 i2c, config)
678
679/**
649 * regmap_init_slimbus() - Initialise register map 680 * regmap_init_slimbus() - Initialise register map
650 * 681 *
651 * @slimbus: Device that will be interacted with 682 * @slimbus: Device that will be interacted with
@@ -798,6 +829,20 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
798 i2c, config) 829 i2c, config)
799 830
800/** 831/**
832 * devm_regmap_init_sccb() - Initialise managed register map
833 *
834 * @i2c: Device that will be interacted with
835 * @config: Configuration for register map
836 *
837 * The return value will be an ERR_PTR() on error or a valid pointer
838 * to a struct regmap. The regmap will be automatically freed by the
839 * device management code.
840 */
841#define devm_regmap_init_sccb(i2c, config) \
842 __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \
843 i2c, config)
844
845/**
801 * devm_regmap_init_spi() - Initialise register map 846 * devm_regmap_init_spi() - Initialise register map
802 * 847 *
803 * @dev: Device that will be interacted with 848 * @dev: Device that will be interacted with
@@ -946,6 +991,8 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg,
946int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 991int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
947int regmap_raw_read(struct regmap *map, unsigned int reg, 992int regmap_raw_read(struct regmap *map, unsigned int reg,
948 void *val, size_t val_len); 993 void *val, size_t val_len);
994int regmap_noinc_read(struct regmap *map, unsigned int reg,
995 void *val, size_t val_len);
949int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, 996int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
950 size_t val_count); 997 size_t val_count);
951int regmap_update_bits_base(struct regmap *map, unsigned int reg, 998int regmap_update_bits_base(struct regmap *map, unsigned int reg,
@@ -1196,6 +1243,13 @@ static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
1196 return -EINVAL; 1243 return -EINVAL;
1197} 1244}
1198 1245
1246static inline int regmap_noinc_read(struct regmap *map, unsigned int reg,
1247 void *val, size_t val_len)
1248{
1249 WARN_ONCE(1, "regmap API is disabled");
1250 return -EINVAL;
1251}
1252
1199static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, 1253static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
1200 void *val, size_t val_count) 1254 void *val, size_t val_count)
1201{ 1255{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index fc2dc8df476f..0fd8fbb74763 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -46,7 +46,7 @@ enum regulator_status {
46/** 46/**
47 * struct regulator_linear_range - specify linear voltage ranges 47 * struct regulator_linear_range - specify linear voltage ranges
48 * 48 *
49 * Specify a range of voltages for regulator_map_linar_range() and 49 * Specify a range of voltages for regulator_map_linear_range() and
50 * regulator_list_linear_range(). 50 * regulator_list_linear_range().
51 * 51 *
52 * @min_uV: Lowest voltage in range 52 * @min_uV: Lowest voltage in range
@@ -220,7 +220,7 @@ struct regulator_ops {
220 /* set regulator suspend operating mode (defined in consumer.h) */ 220 /* set regulator suspend operating mode (defined in consumer.h) */
221 int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); 221 int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
222 222
223 int (*resume_early)(struct regulator_dev *rdev); 223 int (*resume)(struct regulator_dev *rdev);
224 224
225 int (*set_pull_down) (struct regulator_dev *); 225 int (*set_pull_down) (struct regulator_dev *);
226}; 226};
diff --git a/include/linux/regulator/pfuze100.h b/include/linux/regulator/pfuze100.h
index e0ccf46f66cf..cb5aecd40f07 100644
--- a/include/linux/regulator/pfuze100.h
+++ b/include/linux/regulator/pfuze100.h
@@ -64,6 +64,17 @@
64#define PFUZE3000_VLDO3 11 64#define PFUZE3000_VLDO3 11
65#define PFUZE3000_VLDO4 12 65#define PFUZE3000_VLDO4 12
66 66
67#define PFUZE3001_SW1 0
68#define PFUZE3001_SW2 1
69#define PFUZE3001_SW3 2
70#define PFUZE3001_VSNVS 3
71#define PFUZE3001_VLDO1 4
72#define PFUZE3001_VLDO2 5
73#define PFUZE3001_VCCSD 6
74#define PFUZE3001_V33 7
75#define PFUZE3001_VLDO3 8
76#define PFUZE3001_VLDO4 9
77
67struct regulator_init_data; 78struct regulator_init_data;
68 79
69struct pfuze_regulator_platform_data { 80struct pfuze_regulator_platform_data {
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index dfdaede9139e..e3c5d856b6da 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -477,15 +477,19 @@ struct rproc {
477/** 477/**
478 * struct rproc_subdev - subdevice tied to a remoteproc 478 * struct rproc_subdev - subdevice tied to a remoteproc
479 * @node: list node related to the rproc subdevs list 479 * @node: list node related to the rproc subdevs list
480 * @probe: probe function, called as the rproc is started 480 * @prepare: prepare function, called before the rproc is started
481 * @remove: remove function, called as the rproc is being stopped, the @crashed 481 * @start: start function, called after the rproc has been started
482 * parameter indicates if this originates from the a recovery 482 * @stop: stop function, called before the rproc is stopped; the @crashed
483 * parameter indicates if this originates from a recovery
484 * @unprepare: unprepare function, called after the rproc has been stopped
483 */ 485 */
484struct rproc_subdev { 486struct rproc_subdev {
485 struct list_head node; 487 struct list_head node;
486 488
487 int (*probe)(struct rproc_subdev *subdev); 489 int (*prepare)(struct rproc_subdev *subdev);
488 void (*remove)(struct rproc_subdev *subdev, bool crashed); 490 int (*start)(struct rproc_subdev *subdev);
491 void (*stop)(struct rproc_subdev *subdev, bool crashed);
492 void (*unprepare)(struct rproc_subdev *subdev);
489}; 493};
490 494
491/* we currently support only two vrings per rvdev */ 495/* we currently support only two vrings per rvdev */
@@ -566,10 +570,7 @@ static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev)
566 return rvdev->rproc; 570 return rvdev->rproc;
567} 571}
568 572
569void rproc_add_subdev(struct rproc *rproc, 573void rproc_add_subdev(struct rproc *rproc, struct rproc_subdev *subdev);
570 struct rproc_subdev *subdev,
571 int (*probe)(struct rproc_subdev *subdev),
572 void (*remove)(struct rproc_subdev *subdev, bool crashed));
573 574
574void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev); 575void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev);
575 576
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index e6a0031d1b1f..8ad2487a86d5 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -66,7 +66,7 @@ struct rfkill_ops {
66 66
67#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) 67#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
68/** 68/**
69 * rfkill_alloc - allocate rfkill structure 69 * rfkill_alloc - Allocate rfkill structure
70 * @name: name of the struct -- the string is not copied internally 70 * @name: name of the struct -- the string is not copied internally
71 * @parent: device that has rf switch on it 71 * @parent: device that has rf switch on it
72 * @type: type of the switch (RFKILL_TYPE_*) 72 * @type: type of the switch (RFKILL_TYPE_*)
@@ -112,7 +112,7 @@ void rfkill_pause_polling(struct rfkill *rfkill);
112/** 112/**
113 * rfkill_resume_polling(struct rfkill *rfkill) 113 * rfkill_resume_polling(struct rfkill *rfkill)
114 * 114 *
115 * Pause polling -- say transmitter is off for other reasons. 115 * Resume polling
116 * NOTE: not necessary for suspend/resume -- in that case the 116 * NOTE: not necessary for suspend/resume -- in that case the
117 * core stops polling anyway 117 * core stops polling anyway
118 */ 118 */
@@ -130,7 +130,7 @@ void rfkill_resume_polling(struct rfkill *rfkill);
130void rfkill_unregister(struct rfkill *rfkill); 130void rfkill_unregister(struct rfkill *rfkill);
131 131
132/** 132/**
133 * rfkill_destroy - free rfkill structure 133 * rfkill_destroy - Free rfkill structure
134 * @rfkill: rfkill structure to be destroyed 134 * @rfkill: rfkill structure to be destroyed
135 * 135 *
136 * Destroys the rfkill structure. 136 * Destroys the rfkill structure.
@@ -140,7 +140,7 @@ void rfkill_destroy(struct rfkill *rfkill);
140/** 140/**
141 * rfkill_set_hw_state - Set the internal rfkill hardware block state 141 * rfkill_set_hw_state - Set the internal rfkill hardware block state
142 * @rfkill: pointer to the rfkill class to modify. 142 * @rfkill: pointer to the rfkill class to modify.
143 * @state: the current hardware block state to set 143 * @blocked: the current hardware block state to set
144 * 144 *
145 * rfkill drivers that get events when the hard-blocked state changes 145 * rfkill drivers that get events when the hard-blocked state changes
146 * use this function to notify the rfkill core (and through that also 146 * use this function to notify the rfkill core (and through that also
@@ -161,7 +161,7 @@ bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
161/** 161/**
162 * rfkill_set_sw_state - Set the internal rfkill software block state 162 * rfkill_set_sw_state - Set the internal rfkill software block state
163 * @rfkill: pointer to the rfkill class to modify. 163 * @rfkill: pointer to the rfkill class to modify.
164 * @state: the current software block state to set 164 * @blocked: the current software block state to set
165 * 165 *
166 * rfkill drivers that get events when the soft-blocked state changes 166 * rfkill drivers that get events when the soft-blocked state changes
167 * (yes, some platforms directly act on input but allow changing again) 167 * (yes, some platforms directly act on input but allow changing again)
@@ -183,7 +183,7 @@ bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked);
183/** 183/**
184 * rfkill_init_sw_state - Initialize persistent software block state 184 * rfkill_init_sw_state - Initialize persistent software block state
185 * @rfkill: pointer to the rfkill class to modify. 185 * @rfkill: pointer to the rfkill class to modify.
186 * @state: the current software block state to set 186 * @blocked: the current software block state to set
187 * 187 *
188 * rfkill drivers that preserve their software block state over power off 188 * rfkill drivers that preserve their software block state over power off
189 * use this function to notify the rfkill core (and through that also 189 * use this function to notify the rfkill core (and through that also
@@ -208,17 +208,17 @@ void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked);
208void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw); 208void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw);
209 209
210/** 210/**
211 * rfkill_blocked - query rfkill block 211 * rfkill_blocked - Query rfkill block state
212 * 212 *
213 * @rfkill: rfkill struct to query 213 * @rfkill: rfkill struct to query
214 */ 214 */
215bool rfkill_blocked(struct rfkill *rfkill); 215bool rfkill_blocked(struct rfkill *rfkill);
216 216
217/** 217/**
218 * rfkill_find_type - Helpper for finding rfkill type by name 218 * rfkill_find_type - Helper for finding rfkill type by name
219 * @name: the name of the type 219 * @name: the name of the type
220 * 220 *
221 * Returns enum rfkill_type that conrresponds the name. 221 * Returns enum rfkill_type that corresponds to the name.
222 */ 222 */
223enum rfkill_type rfkill_find_type(const char *name); 223enum rfkill_type rfkill_find_type(const char *name);
224 224
@@ -296,7 +296,7 @@ static inline enum rfkill_type rfkill_find_type(const char *name)
296const char *rfkill_get_led_trigger_name(struct rfkill *rfkill); 296const char *rfkill_get_led_trigger_name(struct rfkill *rfkill);
297 297
298/** 298/**
299 * rfkill_set_led_trigger_name -- set the LED trigger name 299 * rfkill_set_led_trigger_name - Set the LED trigger name
300 * @rfkill: rfkill struct 300 * @rfkill: rfkill struct
301 * @name: LED trigger name 301 * @name: LED trigger name
302 * 302 *
diff --git a/include/linux/rhashtable-types.h b/include/linux/rhashtable-types.h
new file mode 100644
index 000000000000..763d613ce2c2
--- /dev/null
+++ b/include/linux/rhashtable-types.h
@@ -0,0 +1,137 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Resizable, Scalable, Concurrent Hash Table
4 *
5 * Simple structures that might be needed in include
6 * files.
7 */
8
9#ifndef _LINUX_RHASHTABLE_TYPES_H
10#define _LINUX_RHASHTABLE_TYPES_H
11
12#include <linux/atomic.h>
13#include <linux/compiler.h>
14#include <linux/mutex.h>
15#include <linux/workqueue.h>
16
17struct rhash_head {
18 struct rhash_head __rcu *next;
19};
20
21struct rhlist_head {
22 struct rhash_head rhead;
23 struct rhlist_head __rcu *next;
24};
25
26struct bucket_table;
27
28/**
29 * struct rhashtable_compare_arg - Key for the function rhashtable_compare
30 * @ht: Hash table
31 * @key: Key to compare against
32 */
33struct rhashtable_compare_arg {
34 struct rhashtable *ht;
35 const void *key;
36};
37
38typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed);
39typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 len, u32 seed);
40typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg,
41 const void *obj);
42
43/**
44 * struct rhashtable_params - Hash table construction parameters
45 * @nelem_hint: Hint on number of elements, should be 75% of desired size
46 * @key_len: Length of key
47 * @key_offset: Offset of key in struct to be hashed
48 * @head_offset: Offset of rhash_head in struct to be hashed
49 * @max_size: Maximum size while expanding
50 * @min_size: Minimum size while shrinking
51 * @locks_mul: Number of bucket locks to allocate per cpu (default: 32)
52 * @automatic_shrinking: Enable automatic shrinking of tables
53 * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash)
54 * @obj_hashfn: Function to hash object
55 * @obj_cmpfn: Function to compare key with object
56 */
57struct rhashtable_params {
58 u16 nelem_hint;
59 u16 key_len;
60 u16 key_offset;
61 u16 head_offset;
62 unsigned int max_size;
63 u16 min_size;
64 bool automatic_shrinking;
65 u8 locks_mul;
66 rht_hashfn_t hashfn;
67 rht_obj_hashfn_t obj_hashfn;
68 rht_obj_cmpfn_t obj_cmpfn;
69};
70
71/**
72 * struct rhashtable - Hash table handle
73 * @tbl: Bucket table
74 * @key_len: Key length for hashfn
75 * @max_elems: Maximum number of elements in table
76 * @p: Configuration parameters
77 * @rhlist: True if this is an rhltable
78 * @run_work: Deferred worker to expand/shrink asynchronously
79 * @mutex: Mutex to protect current/future table swapping
80 * @lock: Spin lock to protect walker list
81 * @nelems: Number of elements in table
82 */
83struct rhashtable {
84 struct bucket_table __rcu *tbl;
85 unsigned int key_len;
86 unsigned int max_elems;
87 struct rhashtable_params p;
88 bool rhlist;
89 struct work_struct run_work;
90 struct mutex mutex;
91 spinlock_t lock;
92 atomic_t nelems;
93};
94
95/**
96 * struct rhltable - Hash table with duplicate objects in a list
97 * @ht: Underlying rhtable
98 */
99struct rhltable {
100 struct rhashtable ht;
101};
102
103/**
104 * struct rhashtable_walker - Hash table walker
105 * @list: List entry on list of walkers
106 * @tbl: The table that we were walking over
107 */
108struct rhashtable_walker {
109 struct list_head list;
110 struct bucket_table *tbl;
111};
112
113/**
114 * struct rhashtable_iter - Hash table iterator
115 * @ht: Table to iterate through
116 * @p: Current pointer
117 * @list: Current hash list pointer
118 * @walker: Associated rhashtable walker
119 * @slot: Current slot
120 * @skip: Number of entries to skip in slot
121 */
122struct rhashtable_iter {
123 struct rhashtable *ht;
124 struct rhash_head *p;
125 struct rhlist_head *list;
126 struct rhashtable_walker walker;
127 unsigned int slot;
128 unsigned int skip;
129 bool end_of_table;
130};
131
132int rhashtable_init(struct rhashtable *ht,
133 const struct rhashtable_params *params);
134int rhltable_init(struct rhltable *hlt,
135 const struct rhashtable_params *params);
136
137#endif /* _LINUX_RHASHTABLE_TYPES_H */
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 4e1f535c2034..eb7111039247 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Resizable, Scalable, Concurrent Hash Table 3 * Resizable, Scalable, Concurrent Hash Table
3 * 4 *
@@ -17,37 +18,18 @@
17#ifndef _LINUX_RHASHTABLE_H 18#ifndef _LINUX_RHASHTABLE_H
18#define _LINUX_RHASHTABLE_H 19#define _LINUX_RHASHTABLE_H
19 20
20#include <linux/atomic.h>
21#include <linux/compiler.h>
22#include <linux/err.h> 21#include <linux/err.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/jhash.h> 23#include <linux/jhash.h>
25#include <linux/list_nulls.h> 24#include <linux/list_nulls.h>
26#include <linux/workqueue.h> 25#include <linux/workqueue.h>
27#include <linux/mutex.h>
28#include <linux/rculist.h> 26#include <linux/rculist.h>
29 27
28#include <linux/rhashtable-types.h>
30/* 29/*
31 * The end of the chain is marked with a special nulls marks which has 30 * The end of the chain is marked with a special nulls marks which has
32 * the following format: 31 * the least significant bit set.
33 *
34 * +-------+-----------------------------------------------------+-+
35 * | Base | Hash |1|
36 * +-------+-----------------------------------------------------+-+
37 *
38 * Base (4 bits) : Reserved to distinguish between multiple tables.
39 * Specified via &struct rhashtable_params.nulls_base.
40 * Hash (27 bits): Full hash (unmasked) of first element added to bucket
41 * 1 (1 bit) : Nulls marker (always set)
42 *
43 * The remaining bits of the next pointer remain unused for now.
44 */ 32 */
45#define RHT_BASE_BITS 4
46#define RHT_HASH_BITS 27
47#define RHT_BASE_SHIFT RHT_HASH_BITS
48
49/* Base bits plus 1 bit for nulls marker */
50#define RHT_HASH_RESERVED_SPACE (RHT_BASE_BITS + 1)
51 33
52/* Maximum chain length before rehash 34/* Maximum chain length before rehash
53 * 35 *
@@ -64,15 +46,6 @@
64 */ 46 */
65#define RHT_ELASTICITY 16u 47#define RHT_ELASTICITY 16u
66 48
67struct rhash_head {
68 struct rhash_head __rcu *next;
69};
70
71struct rhlist_head {
72 struct rhash_head rhead;
73 struct rhlist_head __rcu *next;
74};
75
76/** 49/**
77 * struct bucket_table - Table of hash buckets 50 * struct bucket_table - Table of hash buckets
78 * @size: Number of hash buckets 51 * @size: Number of hash buckets
@@ -102,132 +75,14 @@ struct bucket_table {
102 struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; 75 struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp;
103}; 76};
104 77
105/** 78#define INIT_RHT_NULLS_HEAD(ptr) \
106 * struct rhashtable_compare_arg - Key for the function rhashtable_compare 79 ((ptr) = (typeof(ptr)) NULLS_MARKER(0))
107 * @ht: Hash table
108 * @key: Key to compare against
109 */
110struct rhashtable_compare_arg {
111 struct rhashtable *ht;
112 const void *key;
113};
114
115typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed);
116typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 len, u32 seed);
117typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg,
118 const void *obj);
119
120struct rhashtable;
121
122/**
123 * struct rhashtable_params - Hash table construction parameters
124 * @nelem_hint: Hint on number of elements, should be 75% of desired size
125 * @key_len: Length of key
126 * @key_offset: Offset of key in struct to be hashed
127 * @head_offset: Offset of rhash_head in struct to be hashed
128 * @max_size: Maximum size while expanding
129 * @min_size: Minimum size while shrinking
130 * @locks_mul: Number of bucket locks to allocate per cpu (default: 32)
131 * @automatic_shrinking: Enable automatic shrinking of tables
132 * @nulls_base: Base value to generate nulls marker
133 * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash)
134 * @obj_hashfn: Function to hash object
135 * @obj_cmpfn: Function to compare key with object
136 */
137struct rhashtable_params {
138 u16 nelem_hint;
139 u16 key_len;
140 u16 key_offset;
141 u16 head_offset;
142 unsigned int max_size;
143 u16 min_size;
144 bool automatic_shrinking;
145 u8 locks_mul;
146 u32 nulls_base;
147 rht_hashfn_t hashfn;
148 rht_obj_hashfn_t obj_hashfn;
149 rht_obj_cmpfn_t obj_cmpfn;
150};
151
152/**
153 * struct rhashtable - Hash table handle
154 * @tbl: Bucket table
155 * @key_len: Key length for hashfn
156 * @max_elems: Maximum number of elements in table
157 * @p: Configuration parameters
158 * @rhlist: True if this is an rhltable
159 * @run_work: Deferred worker to expand/shrink asynchronously
160 * @mutex: Mutex to protect current/future table swapping
161 * @lock: Spin lock to protect walker list
162 * @nelems: Number of elements in table
163 */
164struct rhashtable {
165 struct bucket_table __rcu *tbl;
166 unsigned int key_len;
167 unsigned int max_elems;
168 struct rhashtable_params p;
169 bool rhlist;
170 struct work_struct run_work;
171 struct mutex mutex;
172 spinlock_t lock;
173 atomic_t nelems;
174};
175
176/**
177 * struct rhltable - Hash table with duplicate objects in a list
178 * @ht: Underlying rhtable
179 */
180struct rhltable {
181 struct rhashtable ht;
182};
183
184/**
185 * struct rhashtable_walker - Hash table walker
186 * @list: List entry on list of walkers
187 * @tbl: The table that we were walking over
188 */
189struct rhashtable_walker {
190 struct list_head list;
191 struct bucket_table *tbl;
192};
193
194/**
195 * struct rhashtable_iter - Hash table iterator
196 * @ht: Table to iterate through
197 * @p: Current pointer
198 * @list: Current hash list pointer
199 * @walker: Associated rhashtable walker
200 * @slot: Current slot
201 * @skip: Number of entries to skip in slot
202 */
203struct rhashtable_iter {
204 struct rhashtable *ht;
205 struct rhash_head *p;
206 struct rhlist_head *list;
207 struct rhashtable_walker walker;
208 unsigned int slot;
209 unsigned int skip;
210 bool end_of_table;
211};
212
213static inline unsigned long rht_marker(const struct rhashtable *ht, u32 hash)
214{
215 return NULLS_MARKER(ht->p.nulls_base + hash);
216}
217
218#define INIT_RHT_NULLS_HEAD(ptr, ht, hash) \
219 ((ptr) = (typeof(ptr)) rht_marker(ht, hash))
220 80
221static inline bool rht_is_a_nulls(const struct rhash_head *ptr) 81static inline bool rht_is_a_nulls(const struct rhash_head *ptr)
222{ 82{
223 return ((unsigned long) ptr & 1); 83 return ((unsigned long) ptr & 1);
224} 84}
225 85
226static inline unsigned long rht_get_nulls_value(const struct rhash_head *ptr)
227{
228 return ((unsigned long) ptr) >> 1;
229}
230
231static inline void *rht_obj(const struct rhashtable *ht, 86static inline void *rht_obj(const struct rhashtable *ht,
232 const struct rhash_head *he) 87 const struct rhash_head *he)
233{ 88{
@@ -237,7 +92,7 @@ static inline void *rht_obj(const struct rhashtable *ht,
237static inline unsigned int rht_bucket_index(const struct bucket_table *tbl, 92static inline unsigned int rht_bucket_index(const struct bucket_table *tbl,
238 unsigned int hash) 93 unsigned int hash)
239{ 94{
240 return (hash >> RHT_HASH_RESERVED_SPACE) & (tbl->size - 1); 95 return hash & (tbl->size - 1);
241} 96}
242 97
243static inline unsigned int rht_key_get_hash(struct rhashtable *ht, 98static inline unsigned int rht_key_get_hash(struct rhashtable *ht,
@@ -376,11 +231,6 @@ static inline int lockdep_rht_bucket_is_held(const struct bucket_table *tbl,
376} 231}
377#endif /* CONFIG_PROVE_LOCKING */ 232#endif /* CONFIG_PROVE_LOCKING */
378 233
379int rhashtable_init(struct rhashtable *ht,
380 const struct rhashtable_params *params);
381int rhltable_init(struct rhltable *hlt,
382 const struct rhashtable_params *params);
383
384void *rhashtable_insert_slow(struct rhashtable *ht, const void *key, 234void *rhashtable_insert_slow(struct rhashtable *ht, const void *key,
385 struct rhash_head *obj); 235 struct rhash_head *obj);
386 236
@@ -745,7 +595,7 @@ static inline void *__rhashtable_insert_fast(
745 lock = rht_bucket_lock(tbl, hash); 595 lock = rht_bucket_lock(tbl, hash);
746 spin_lock_bh(lock); 596 spin_lock_bh(lock);
747 597
748 if (unlikely(rht_dereference_bucket(tbl->future_tbl, tbl, hash))) { 598 if (unlikely(rcu_access_pointer(tbl->future_tbl))) {
749slow_path: 599slow_path:
750 spin_unlock_bh(lock); 600 spin_unlock_bh(lock);
751 rcu_read_unlock(); 601 rcu_read_unlock();
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 003d09ab308d..0940fda59872 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -164,8 +164,8 @@ void ring_buffer_record_disable(struct ring_buffer *buffer);
164void ring_buffer_record_enable(struct ring_buffer *buffer); 164void ring_buffer_record_enable(struct ring_buffer *buffer);
165void ring_buffer_record_off(struct ring_buffer *buffer); 165void ring_buffer_record_off(struct ring_buffer *buffer);
166void ring_buffer_record_on(struct ring_buffer *buffer); 166void ring_buffer_record_on(struct ring_buffer *buffer);
167int ring_buffer_record_is_on(struct ring_buffer *buffer); 167bool ring_buffer_record_is_on(struct ring_buffer *buffer);
168int ring_buffer_record_is_set_on(struct ring_buffer *buffer); 168bool ring_buffer_record_is_set_on(struct ring_buffer *buffer);
169void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); 169void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu);
170void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); 170void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
171 171
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 6268208760e9..6aedc30003e7 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -87,16 +87,11 @@ struct rtc_class_ops {
87 int (*set_offset)(struct device *, long offset); 87 int (*set_offset)(struct device *, long offset);
88}; 88};
89 89
90typedef struct rtc_task {
91 void (*func)(void *private_data);
92 void *private_data;
93} rtc_task_t;
94
95
96struct rtc_timer { 90struct rtc_timer {
97 struct rtc_task task;
98 struct timerqueue_node node; 91 struct timerqueue_node node;
99 ktime_t period; 92 ktime_t period;
93 void (*func)(void *private_data);
94 void *private_data;
100 int enabled; 95 int enabled;
101}; 96};
102 97
@@ -121,8 +116,6 @@ struct rtc_device {
121 wait_queue_head_t irq_queue; 116 wait_queue_head_t irq_queue;
122 struct fasync_struct *async_queue; 117 struct fasync_struct *async_queue;
123 118
124 struct rtc_task *irq_task;
125 spinlock_t irq_task_lock;
126 int irq_freq; 119 int irq_freq;
127 int max_user_freq; 120 int max_user_freq;
128 121
@@ -204,14 +197,8 @@ extern void rtc_update_irq(struct rtc_device *rtc,
204extern struct rtc_device *rtc_class_open(const char *name); 197extern struct rtc_device *rtc_class_open(const char *name);
205extern void rtc_class_close(struct rtc_device *rtc); 198extern void rtc_class_close(struct rtc_device *rtc);
206 199
207extern int rtc_irq_register(struct rtc_device *rtc, 200extern int rtc_irq_set_state(struct rtc_device *rtc, int enabled);
208 struct rtc_task *task); 201extern int rtc_irq_set_freq(struct rtc_device *rtc, int freq);
209extern void rtc_irq_unregister(struct rtc_device *rtc,
210 struct rtc_task *task);
211extern int rtc_irq_set_state(struct rtc_device *rtc,
212 struct rtc_task *task, int enabled);
213extern int rtc_irq_set_freq(struct rtc_device *rtc,
214 struct rtc_task *task, int freq);
215extern int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled); 202extern int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled);
216extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled); 203extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled);
217extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, 204extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc,
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index e6539536dea9..804a50983ec5 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -23,6 +23,8 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25 25
26struct seq_file;
27
26/** 28/**
27 * struct sbitmap_word - Word in a &struct sbitmap. 29 * struct sbitmap_word - Word in a &struct sbitmap.
28 */ 30 */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index dac5086e3815..977cb57d7bc9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -722,8 +722,8 @@ struct task_struct {
722 unsigned restore_sigmask:1; 722 unsigned restore_sigmask:1;
723#endif 723#endif
724#ifdef CONFIG_MEMCG 724#ifdef CONFIG_MEMCG
725 unsigned memcg_may_oom:1; 725 unsigned in_user_fault:1;
726#ifndef CONFIG_SLOB 726#ifdef CONFIG_MEMCG_KMEM
727 unsigned memcg_kmem_skip_account:1; 727 unsigned memcg_kmem_skip_account:1;
728#endif 728#endif
729#endif 729#endif
@@ -734,6 +734,10 @@ struct task_struct {
734 /* disallow userland-initiated cgroup migration */ 734 /* disallow userland-initiated cgroup migration */
735 unsigned no_cgroup_migration:1; 735 unsigned no_cgroup_migration:1;
736#endif 736#endif
737#ifdef CONFIG_BLK_CGROUP
738 /* to be used once the psi infrastructure lands upstream. */
739 unsigned use_memdelay:1;
740#endif
737 741
738 unsigned long atomic_flags; /* Flags requiring atomic access. */ 742 unsigned long atomic_flags; /* Flags requiring atomic access. */
739 743
@@ -775,7 +779,8 @@ struct task_struct {
775 struct list_head ptrace_entry; 779 struct list_head ptrace_entry;
776 780
777 /* PID/PID hash table linkage. */ 781 /* PID/PID hash table linkage. */
778 struct pid_link pids[PIDTYPE_MAX]; 782 struct pid *thread_pid;
783 struct hlist_node pid_links[PIDTYPE_MAX];
779 struct list_head thread_group; 784 struct list_head thread_group;
780 struct list_head thread_node; 785 struct list_head thread_node;
781 786
@@ -849,6 +854,7 @@ struct task_struct {
849#endif 854#endif
850#ifdef CONFIG_DETECT_HUNG_TASK 855#ifdef CONFIG_DETECT_HUNG_TASK
851 unsigned long last_switch_count; 856 unsigned long last_switch_count;
857 unsigned long last_switch_time;
852#endif 858#endif
853 /* Filesystem information: */ 859 /* Filesystem information: */
854 struct fs_struct *fs; 860 struct fs_struct *fs;
@@ -1148,6 +1154,13 @@ struct task_struct {
1148 1154
1149 /* Number of pages to reclaim on returning to userland: */ 1155 /* Number of pages to reclaim on returning to userland: */
1150 unsigned int memcg_nr_pages_over_high; 1156 unsigned int memcg_nr_pages_over_high;
1157
1158 /* Used by memcontrol for targeted memcg charge: */
1159 struct mem_cgroup *active_memcg;
1160#endif
1161
1162#ifdef CONFIG_BLK_CGROUP
1163 struct request_queue *throttle_queue;
1151#endif 1164#endif
1152 1165
1153#ifdef CONFIG_UPROBES 1166#ifdef CONFIG_UPROBES
@@ -1198,27 +1211,7 @@ struct task_struct {
1198 1211
1199static inline struct pid *task_pid(struct task_struct *task) 1212static inline struct pid *task_pid(struct task_struct *task)
1200{ 1213{
1201 return task->pids[PIDTYPE_PID].pid; 1214 return task->thread_pid;
1202}
1203
1204static inline struct pid *task_tgid(struct task_struct *task)
1205{
1206 return task->group_leader->pids[PIDTYPE_PID].pid;
1207}
1208
1209/*
1210 * Without tasklist or RCU lock it is not safe to dereference
1211 * the result of task_pgrp/task_session even if task == current,
1212 * we can race with another thread doing sys_setsid/sys_setpgid.
1213 */
1214static inline struct pid *task_pgrp(struct task_struct *task)
1215{
1216 return task->group_leader->pids[PIDTYPE_PGID].pid;
1217}
1218
1219static inline struct pid *task_session(struct task_struct *task)
1220{
1221 return task->group_leader->pids[PIDTYPE_SID].pid;
1222} 1215}
1223 1216
1224/* 1217/*
@@ -1267,7 +1260,7 @@ static inline pid_t task_tgid_nr(struct task_struct *tsk)
1267 */ 1260 */
1268static inline int pid_alive(const struct task_struct *p) 1261static inline int pid_alive(const struct task_struct *p)
1269{ 1262{
1270 return p->pids[PIDTYPE_PID].pid != NULL; 1263 return p->thread_pid != NULL;
1271} 1264}
1272 1265
1273static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1266static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
@@ -1293,12 +1286,12 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1293 1286
1294static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1287static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1295{ 1288{
1296 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, ns); 1289 return __task_pid_nr_ns(tsk, PIDTYPE_TGID, ns);
1297} 1290}
1298 1291
1299static inline pid_t task_tgid_vnr(struct task_struct *tsk) 1292static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1300{ 1293{
1301 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, NULL); 1294 return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL);
1302} 1295}
1303 1296
1304static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns) 1297static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
index 44d356f5e47c..aebb370a0006 100644
--- a/include/linux/sched/mm.h
+++ b/include/linux/sched/mm.h
@@ -248,6 +248,43 @@ static inline void memalloc_noreclaim_restore(unsigned int flags)
248 current->flags = (current->flags & ~PF_MEMALLOC) | flags; 248 current->flags = (current->flags & ~PF_MEMALLOC) | flags;
249} 249}
250 250
251#ifdef CONFIG_MEMCG
252/**
253 * memalloc_use_memcg - Starts the remote memcg charging scope.
254 * @memcg: memcg to charge.
255 *
256 * This function marks the beginning of the remote memcg charging scope. All the
257 * __GFP_ACCOUNT allocations till the end of the scope will be charged to the
258 * given memcg.
259 *
260 * NOTE: This function is not nesting safe.
261 */
262static inline void memalloc_use_memcg(struct mem_cgroup *memcg)
263{
264 WARN_ON_ONCE(current->active_memcg);
265 current->active_memcg = memcg;
266}
267
268/**
269 * memalloc_unuse_memcg - Ends the remote memcg charging scope.
270 *
271 * This function marks the end of the remote memcg charging scope started by
272 * memalloc_use_memcg().
273 */
274static inline void memalloc_unuse_memcg(void)
275{
276 current->active_memcg = NULL;
277}
278#else
279static inline void memalloc_use_memcg(struct mem_cgroup *memcg)
280{
281}
282
283static inline void memalloc_unuse_memcg(void)
284{
285}
286#endif
287
251#ifdef CONFIG_MEMBARRIER 288#ifdef CONFIG_MEMBARRIER
252enum { 289enum {
253 MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY = (1U << 0), 290 MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY = (1U << 0),
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 113d1ad1ced7..1be35729c2c5 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -69,6 +69,11 @@ struct thread_group_cputimer {
69 bool checking_timer; 69 bool checking_timer;
70}; 70};
71 71
72struct multiprocess_signals {
73 sigset_t signal;
74 struct hlist_node node;
75};
76
72/* 77/*
73 * NOTE! "signal_struct" does not have its own 78 * NOTE! "signal_struct" does not have its own
74 * locking, because a shared signal_struct always 79 * locking, because a shared signal_struct always
@@ -90,6 +95,9 @@ struct signal_struct {
90 /* shared signal handling: */ 95 /* shared signal handling: */
91 struct sigpending shared_pending; 96 struct sigpending shared_pending;
92 97
98 /* For collecting multiprocess signals during fork */
99 struct hlist_head multiprocess;
100
93 /* thread group exit support */ 101 /* thread group exit support */
94 int group_exit_code; 102 int group_exit_code;
95 /* overloaded: 103 /* overloaded:
@@ -146,7 +154,8 @@ struct signal_struct {
146 154
147#endif 155#endif
148 156
149 struct pid *leader_pid; 157 /* PID/PID hash table linkage. */
158 struct pid *pids[PIDTYPE_MAX];
150 159
151#ifdef CONFIG_NO_HZ_FULL 160#ifdef CONFIG_NO_HZ_FULL
152 atomic_t tick_dep_mask; 161 atomic_t tick_dep_mask;
@@ -314,7 +323,7 @@ int force_sig_pkuerr(void __user *addr, u32 pkey);
314int force_sig_ptrace_errno_trap(int errno, void __user *addr); 323int force_sig_ptrace_errno_trap(int errno, void __user *addr);
315 324
316extern int send_sig_info(int, struct siginfo *, struct task_struct *); 325extern int send_sig_info(int, struct siginfo *, struct task_struct *);
317extern int force_sigsegv(int, struct task_struct *); 326extern void force_sigsegv(int sig, struct task_struct *p);
318extern int force_sig_info(int, struct siginfo *, struct task_struct *); 327extern int force_sig_info(int, struct siginfo *, struct task_struct *);
319extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); 328extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
320extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); 329extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
@@ -329,7 +338,7 @@ extern int send_sig(int, struct task_struct *, int);
329extern int zap_other_threads(struct task_struct *p); 338extern int zap_other_threads(struct task_struct *p);
330extern struct sigqueue *sigqueue_alloc(void); 339extern struct sigqueue *sigqueue_alloc(void);
331extern void sigqueue_free(struct sigqueue *); 340extern void sigqueue_free(struct sigqueue *);
332extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); 341extern int send_sigqueue(struct sigqueue *, struct pid *, enum pid_type);
333extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 342extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
334 343
335static inline int restart_syscall(void) 344static inline int restart_syscall(void)
@@ -371,6 +380,7 @@ static inline int signal_pending_state(long state, struct task_struct *p)
371 */ 380 */
372extern void recalc_sigpending_and_wake(struct task_struct *t); 381extern void recalc_sigpending_and_wake(struct task_struct *t);
373extern void recalc_sigpending(void); 382extern void recalc_sigpending(void);
383extern void calculate_sigpending(void);
374 384
375extern void signal_wake_up_state(struct task_struct *t, unsigned int state); 385extern void signal_wake_up_state(struct task_struct *t, unsigned int state);
376 386
@@ -383,6 +393,8 @@ static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume)
383 signal_wake_up_state(t, resume ? __TASK_TRACED : 0); 393 signal_wake_up_state(t, resume ? __TASK_TRACED : 0);
384} 394}
385 395
396void task_join_group_stop(struct task_struct *task);
397
386#ifdef TIF_RESTORE_SIGMASK 398#ifdef TIF_RESTORE_SIGMASK
387/* 399/*
388 * Legacy restore_sigmask accessors. These are inefficient on 400 * Legacy restore_sigmask accessors. These are inefficient on
@@ -556,6 +568,37 @@ extern bool current_is_single_threaded(void);
556typedef int (*proc_visitor)(struct task_struct *p, void *data); 568typedef int (*proc_visitor)(struct task_struct *p, void *data);
557void walk_process_tree(struct task_struct *top, proc_visitor, void *); 569void walk_process_tree(struct task_struct *top, proc_visitor, void *);
558 570
571static inline
572struct pid *task_pid_type(struct task_struct *task, enum pid_type type)
573{
574 struct pid *pid;
575 if (type == PIDTYPE_PID)
576 pid = task_pid(task);
577 else
578 pid = task->signal->pids[type];
579 return pid;
580}
581
582static inline struct pid *task_tgid(struct task_struct *task)
583{
584 return task->signal->pids[PIDTYPE_TGID];
585}
586
587/*
588 * Without tasklist or RCU lock it is not safe to dereference
589 * the result of task_pgrp/task_session even if task == current,
590 * we can race with another thread doing sys_setsid/sys_setpgid.
591 */
592static inline struct pid *task_pgrp(struct task_struct *task)
593{
594 return task->signal->pids[PIDTYPE_PGID];
595}
596
597static inline struct pid *task_session(struct task_struct *task)
598{
599 return task->signal->pids[PIDTYPE_SID];
600}
601
559static inline int get_nr_threads(struct task_struct *tsk) 602static inline int get_nr_threads(struct task_struct *tsk)
560{ 603{
561 return tsk->signal->nr_threads; 604 return tsk->signal->nr_threads;
@@ -574,7 +617,7 @@ static inline bool thread_group_leader(struct task_struct *p)
574 */ 617 */
575static inline bool has_group_leader_pid(struct task_struct *p) 618static inline bool has_group_leader_pid(struct task_struct *p)
576{ 619{
577 return task_pid(p) == p->signal->leader_pid; 620 return task_pid(p) == task_tgid(p);
578} 621}
579 622
580static inline 623static inline
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 913488d828cb..a9c32daeb9d8 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -10,6 +10,7 @@ struct ctl_table;
10extern int sysctl_hung_task_check_count; 10extern int sysctl_hung_task_check_count;
11extern unsigned int sysctl_hung_task_panic; 11extern unsigned int sysctl_hung_task_panic;
12extern unsigned long sysctl_hung_task_timeout_secs; 12extern unsigned long sysctl_hung_task_timeout_secs;
13extern unsigned long sysctl_hung_task_check_interval_secs;
13extern int sysctl_hung_task_warnings; 14extern int sysctl_hung_task_warnings;
14extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, 15extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
15 void __user *buffer, 16 void __user *buffer,
diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h
index 96fe289c4c6e..39ad98c09c58 100644
--- a/include/linux/sched/user.h
+++ b/include/linux/sched/user.h
@@ -4,6 +4,7 @@
4 4
5#include <linux/uidgid.h> 5#include <linux/uidgid.h>
6#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <linux/refcount.h>
7#include <linux/ratelimit.h> 8#include <linux/ratelimit.h>
8 9
9struct key; 10struct key;
@@ -12,7 +13,7 @@ struct key;
12 * Some day this will be a full-fledged user tracking system.. 13 * Some day this will be a full-fledged user tracking system..
13 */ 14 */
14struct user_struct { 15struct user_struct {
15 atomic_t __count; /* reference count */ 16 refcount_t __count; /* reference count */
16 atomic_t processes; /* How many processes does this user have? */ 17 atomic_t processes; /* How many processes does this user have? */
17 atomic_t sigpending; /* How many pending signals does this user have? */ 18 atomic_t sigpending; /* How many pending signals does this user have? */
18#ifdef CONFIG_FANOTIFY 19#ifdef CONFIG_FANOTIFY
@@ -59,7 +60,7 @@ extern struct user_struct root_user;
59extern struct user_struct * alloc_uid(kuid_t); 60extern struct user_struct * alloc_uid(kuid_t);
60static inline struct user_struct *get_uid(struct user_struct *u) 61static inline struct user_struct *get_uid(struct user_struct *u)
61{ 62{
62 atomic_inc(&u->__count); 63 refcount_inc(&u->__count);
63 return u; 64 return u;
64} 65}
65extern void free_uid(struct user_struct *); 66extern void free_uid(struct user_struct *);
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index b36c76635f18..83d94341e003 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -801,4 +801,11 @@ struct sctp_strreset_resptsn {
801 __be32 receivers_next_tsn; 801 __be32 receivers_next_tsn;
802}; 802};
803 803
804enum {
805 SCTP_DSCP_SET_MASK = 0x1,
806 SCTP_DSCP_VAL_MASK = 0xfc,
807 SCTP_FLOWLABEL_SET_MASK = 0x100000,
808 SCTP_FLOWLABEL_VAL_MASK = 0xfffff
809};
810
804#endif /* __LINUX_SCTP_H__ */ 811#endif /* __LINUX_SCTP_H__ */
diff --git a/include/linux/security.h b/include/linux/security.h
index 63030c85ee19..75f4156c84d7 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -159,6 +159,27 @@ extern int mmap_min_addr_handler(struct ctl_table *table, int write,
159typedef int (*initxattrs) (struct inode *inode, 159typedef int (*initxattrs) (struct inode *inode,
160 const struct xattr *xattr_array, void *fs_data); 160 const struct xattr *xattr_array, void *fs_data);
161 161
162
163/* Keep the kernel_load_data_id enum in sync with kernel_read_file_id */
164#define __data_id_enumify(ENUM, dummy) LOADING_ ## ENUM,
165#define __data_id_stringify(dummy, str) #str,
166
167enum kernel_load_data_id {
168 __kernel_read_file_id(__data_id_enumify)
169};
170
171static const char * const kernel_load_data_str[] = {
172 __kernel_read_file_id(__data_id_stringify)
173};
174
175static inline const char *kernel_load_data_id_str(enum kernel_load_data_id id)
176{
177 if ((unsigned)id >= LOADING_MAX_ID)
178 return kernel_load_data_str[LOADING_UNKNOWN];
179
180 return kernel_load_data_str[id];
181}
182
162#ifdef CONFIG_SECURITY 183#ifdef CONFIG_SECURITY
163 184
164struct security_mnt_opts { 185struct security_mnt_opts {
@@ -309,7 +330,7 @@ void security_file_set_fowner(struct file *file);
309int security_file_send_sigiotask(struct task_struct *tsk, 330int security_file_send_sigiotask(struct task_struct *tsk,
310 struct fown_struct *fown, int sig); 331 struct fown_struct *fown, int sig);
311int security_file_receive(struct file *file); 332int security_file_receive(struct file *file);
312int security_file_open(struct file *file, const struct cred *cred); 333int security_file_open(struct file *file);
313int security_task_alloc(struct task_struct *task, unsigned long clone_flags); 334int security_task_alloc(struct task_struct *task, unsigned long clone_flags);
314void security_task_free(struct task_struct *task); 335void security_task_free(struct task_struct *task);
315int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 336int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
@@ -320,6 +341,7 @@ void security_cred_getsecid(const struct cred *c, u32 *secid);
320int security_kernel_act_as(struct cred *new, u32 secid); 341int security_kernel_act_as(struct cred *new, u32 secid);
321int security_kernel_create_files_as(struct cred *new, struct inode *inode); 342int security_kernel_create_files_as(struct cred *new, struct inode *inode);
322int security_kernel_module_request(char *kmod_name); 343int security_kernel_module_request(char *kmod_name);
344int security_kernel_load_data(enum kernel_load_data_id id);
323int security_kernel_read_file(struct file *file, enum kernel_read_file_id id); 345int security_kernel_read_file(struct file *file, enum kernel_read_file_id id);
324int security_kernel_post_read_file(struct file *file, char *buf, loff_t size, 346int security_kernel_post_read_file(struct file *file, char *buf, loff_t size,
325 enum kernel_read_file_id id); 347 enum kernel_read_file_id id);
@@ -858,8 +880,7 @@ static inline int security_file_receive(struct file *file)
858 return 0; 880 return 0;
859} 881}
860 882
861static inline int security_file_open(struct file *file, 883static inline int security_file_open(struct file *file)
862 const struct cred *cred)
863{ 884{
864 return 0; 885 return 0;
865} 886}
@@ -909,6 +930,11 @@ static inline int security_kernel_module_request(char *kmod_name)
909 return 0; 930 return 0;
910} 931}
911 932
933static inline int security_kernel_load_data(enum kernel_load_data_id id)
934{
935 return 0;
936}
937
912static inline int security_kernel_read_file(struct file *file, 938static inline int security_kernel_read_file(struct file *file,
913 enum kernel_read_file_id id) 939 enum kernel_read_file_id id)
914{ 940{
diff --git a/include/linux/selection.h b/include/linux/selection.h
index 5b278ce99d8d..a8f5b97b216f 100644
--- a/include/linux/selection.h
+++ b/include/linux/selection.h
@@ -32,6 +32,7 @@ extern unsigned char default_blu[];
32 32
33extern unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed); 33extern unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed);
34extern u16 screen_glyph(struct vc_data *vc, int offset); 34extern u16 screen_glyph(struct vc_data *vc, int offset);
35extern u32 screen_glyph_unicode(struct vc_data *vc, int offset);
35extern void complement_pos(struct vc_data *vc, int offset); 36extern void complement_pos(struct vc_data *vc, int offset);
36extern void invert_screen(struct vc_data *vc, int offset, int count, int shift); 37extern void invert_screen(struct vc_data *vc, int offset, int count, int shift);
37 38
@@ -42,4 +43,9 @@ extern u16 vcs_scr_readw(struct vc_data *vc, const u16 *org);
42extern void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org); 43extern void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org);
43extern void vcs_scr_updated(struct vc_data *vc); 44extern void vcs_scr_updated(struct vc_data *vc);
44 45
46extern int vc_uniscr_check(struct vc_data *vc);
47extern void vc_uniscr_copy_line(struct vc_data *vc, void *dest, int viewed,
48 unsigned int row, unsigned int col,
49 unsigned int nr);
50
45#endif 51#endif
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 76b9db71e489..18e21427bce4 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -160,6 +160,9 @@ extern void serial8250_do_shutdown(struct uart_port *port);
160extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 160extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
161 unsigned int oldstate); 161 unsigned int oldstate);
162extern void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl); 162extern void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl);
163extern void serial8250_do_set_divisor(struct uart_port *port, unsigned int baud,
164 unsigned int quot,
165 unsigned int quot_frac);
163extern int fsl8250_handle_irq(struct uart_port *port); 166extern int fsl8250_handle_irq(struct uart_port *port);
164int serial8250_handle_irq(struct uart_port *port, unsigned int iir); 167int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
165unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr); 168unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 06ea4eeb09ab..406edae44ca3 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -127,6 +127,13 @@ struct uart_port {
127 struct ktermios *); 127 struct ktermios *);
128 unsigned int (*get_mctrl)(struct uart_port *); 128 unsigned int (*get_mctrl)(struct uart_port *);
129 void (*set_mctrl)(struct uart_port *, unsigned int); 129 void (*set_mctrl)(struct uart_port *, unsigned int);
130 unsigned int (*get_divisor)(struct uart_port *,
131 unsigned int baud,
132 unsigned int *frac);
133 void (*set_divisor)(struct uart_port *,
134 unsigned int baud,
135 unsigned int quot,
136 unsigned int quot_frac);
130 int (*startup)(struct uart_port *port); 137 int (*startup)(struct uart_port *port);
131 void (*shutdown)(struct uart_port *port); 138 void (*shutdown)(struct uart_port *port);
132 void (*throttle)(struct uart_port *port); 139 void (*throttle)(struct uart_port *port);
diff --git a/include/linux/set_memory.h b/include/linux/set_memory.h
index da5178216da5..2a986d282a97 100644
--- a/include/linux/set_memory.h
+++ b/include/linux/set_memory.h
@@ -17,6 +17,20 @@ static inline int set_memory_x(unsigned long addr, int numpages) { return 0; }
17static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; } 17static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
18#endif 18#endif
19 19
20#ifndef set_mce_nospec
21static inline int set_mce_nospec(unsigned long pfn)
22{
23 return 0;
24}
25#endif
26
27#ifndef clear_mce_nospec
28static inline int clear_mce_nospec(unsigned long pfn)
29{
30 return 0;
31}
32#endif
33
20#ifndef CONFIG_ARCH_HAS_MEM_ENCRYPT 34#ifndef CONFIG_ARCH_HAS_MEM_ENCRYPT
21static inline int set_memory_encrypted(unsigned long addr, int numpages) 35static inline int set_memory_encrypted(unsigned long addr, int numpages)
22{ 36{
diff --git a/include/linux/sfp.h b/include/linux/sfp.h
index ebce9e24906a..d37518e89db2 100644
--- a/include/linux/sfp.h
+++ b/include/linux/sfp.h
@@ -231,6 +231,50 @@ struct sfp_eeprom_id {
231 struct sfp_eeprom_ext ext; 231 struct sfp_eeprom_ext ext;
232} __packed; 232} __packed;
233 233
234struct sfp_diag {
235 __be16 temp_high_alarm;
236 __be16 temp_low_alarm;
237 __be16 temp_high_warn;
238 __be16 temp_low_warn;
239 __be16 volt_high_alarm;
240 __be16 volt_low_alarm;
241 __be16 volt_high_warn;
242 __be16 volt_low_warn;
243 __be16 bias_high_alarm;
244 __be16 bias_low_alarm;
245 __be16 bias_high_warn;
246 __be16 bias_low_warn;
247 __be16 txpwr_high_alarm;
248 __be16 txpwr_low_alarm;
249 __be16 txpwr_high_warn;
250 __be16 txpwr_low_warn;
251 __be16 rxpwr_high_alarm;
252 __be16 rxpwr_low_alarm;
253 __be16 rxpwr_high_warn;
254 __be16 rxpwr_low_warn;
255 __be16 laser_temp_high_alarm;
256 __be16 laser_temp_low_alarm;
257 __be16 laser_temp_high_warn;
258 __be16 laser_temp_low_warn;
259 __be16 tec_cur_high_alarm;
260 __be16 tec_cur_low_alarm;
261 __be16 tec_cur_high_warn;
262 __be16 tec_cur_low_warn;
263 __be32 cal_rxpwr4;
264 __be32 cal_rxpwr3;
265 __be32 cal_rxpwr2;
266 __be32 cal_rxpwr1;
267 __be32 cal_rxpwr0;
268 __be16 cal_txi_slope;
269 __be16 cal_txi_offset;
270 __be16 cal_txpwr_slope;
271 __be16 cal_txpwr_offset;
272 __be16 cal_t_slope;
273 __be16 cal_t_offset;
274 __be16 cal_v_slope;
275 __be16 cal_v_offset;
276} __packed;
277
234/* SFP EEPROM registers */ 278/* SFP EEPROM registers */
235enum { 279enum {
236 SFP_PHYS_ID = 0x00, 280 SFP_PHYS_ID = 0x00,
@@ -384,7 +428,33 @@ enum {
384 SFP_TEC_CUR = 0x6c, 428 SFP_TEC_CUR = 0x6c,
385 429
386 SFP_STATUS = 0x6e, 430 SFP_STATUS = 0x6e,
387 SFP_ALARM = 0x70, 431 SFP_ALARM0 = 0x70,
432 SFP_ALARM0_TEMP_HIGH = BIT(7),
433 SFP_ALARM0_TEMP_LOW = BIT(6),
434 SFP_ALARM0_VCC_HIGH = BIT(5),
435 SFP_ALARM0_VCC_LOW = BIT(4),
436 SFP_ALARM0_TX_BIAS_HIGH = BIT(3),
437 SFP_ALARM0_TX_BIAS_LOW = BIT(2),
438 SFP_ALARM0_TXPWR_HIGH = BIT(1),
439 SFP_ALARM0_TXPWR_LOW = BIT(0),
440
441 SFP_ALARM1 = 0x71,
442 SFP_ALARM1_RXPWR_HIGH = BIT(7),
443 SFP_ALARM1_RXPWR_LOW = BIT(6),
444
445 SFP_WARN0 = 0x74,
446 SFP_WARN0_TEMP_HIGH = BIT(7),
447 SFP_WARN0_TEMP_LOW = BIT(6),
448 SFP_WARN0_VCC_HIGH = BIT(5),
449 SFP_WARN0_VCC_LOW = BIT(4),
450 SFP_WARN0_TX_BIAS_HIGH = BIT(3),
451 SFP_WARN0_TX_BIAS_LOW = BIT(2),
452 SFP_WARN0_TXPWR_HIGH = BIT(1),
453 SFP_WARN0_TXPWR_LOW = BIT(0),
454
455 SFP_WARN1 = 0x75,
456 SFP_WARN1_RXPWR_HIGH = BIT(7),
457 SFP_WARN1_RXPWR_LOW = BIT(6),
388 458
389 SFP_EXT_STATUS = 0x76, 459 SFP_EXT_STATUS = 0x76,
390 SFP_VSL = 0x78, 460 SFP_VSL = 0x78,
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
index 6794490f25b2..9443cafd1969 100644
--- a/include/linux/shrinker.h
+++ b/include/linux/shrinker.h
@@ -12,6 +12,9 @@
12struct shrink_control { 12struct shrink_control {
13 gfp_t gfp_mask; 13 gfp_t gfp_mask;
14 14
15 /* current node being shrunk (for NUMA aware shrinkers) */
16 int nid;
17
15 /* 18 /*
16 * How many objects scan_objects should scan and try to reclaim. 19 * How many objects scan_objects should scan and try to reclaim.
17 * This is reset before every call, so it is safe for callees 20 * This is reset before every call, so it is safe for callees
@@ -26,20 +29,20 @@ struct shrink_control {
26 */ 29 */
27 unsigned long nr_scanned; 30 unsigned long nr_scanned;
28 31
29 /* current node being shrunk (for NUMA aware shrinkers) */
30 int nid;
31
32 /* current memcg being shrunk (for memcg aware shrinkers) */ 32 /* current memcg being shrunk (for memcg aware shrinkers) */
33 struct mem_cgroup *memcg; 33 struct mem_cgroup *memcg;
34}; 34};
35 35
36#define SHRINK_STOP (~0UL) 36#define SHRINK_STOP (~0UL)
37#define SHRINK_EMPTY (~0UL - 1)
37/* 38/*
38 * A callback you can register to apply pressure to ageable caches. 39 * A callback you can register to apply pressure to ageable caches.
39 * 40 *
40 * @count_objects should return the number of freeable items in the cache. If 41 * @count_objects should return the number of freeable items in the cache. If
41 * there are no objects to free or the number of freeable items cannot be 42 * there are no objects to free, it should return SHRINK_EMPTY, while 0 is
42 * determined, it should return 0. No deadlock checks should be done during the 43 * returned in cases of the number of freeable items cannot be determined
44 * or shrinker should skip this cache for this time (e.g., their number
45 * is below shrinkable limit). No deadlock checks should be done during the
43 * count callback - the shrinker relies on aggregating scan counts that couldn't 46 * count callback - the shrinker relies on aggregating scan counts that couldn't
44 * be executed due to potential deadlocks to be run at a later call when the 47 * be executed due to potential deadlocks to be run at a later call when the
45 * deadlock condition is no longer pending. 48 * deadlock condition is no longer pending.
@@ -60,12 +63,16 @@ struct shrinker {
60 unsigned long (*scan_objects)(struct shrinker *, 63 unsigned long (*scan_objects)(struct shrinker *,
61 struct shrink_control *sc); 64 struct shrink_control *sc);
62 65
63 int seeks; /* seeks to recreate an obj */
64 long batch; /* reclaim batch size, 0 = default */ 66 long batch; /* reclaim batch size, 0 = default */
65 unsigned long flags; 67 int seeks; /* seeks to recreate an obj */
68 unsigned flags;
66 69
67 /* These are for internal use */ 70 /* These are for internal use */
68 struct list_head list; 71 struct list_head list;
72#ifdef CONFIG_MEMCG_KMEM
73 /* ID in shrinker_idr */
74 int id;
75#endif
69 /* objs pending delete, per node */ 76 /* objs pending delete, per node */
70 atomic_long_t *nr_deferred; 77 atomic_long_t *nr_deferred;
71}; 78};
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 3c5200137b24..3d4cd5db30a9 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -254,18 +254,20 @@ static inline int valid_signal(unsigned long sig)
254 254
255struct timespec; 255struct timespec;
256struct pt_regs; 256struct pt_regs;
257enum pid_type;
257 258
258extern int next_signal(struct sigpending *pending, sigset_t *mask); 259extern int next_signal(struct sigpending *pending, sigset_t *mask);
259extern int do_send_sig_info(int sig, struct siginfo *info, 260extern int do_send_sig_info(int sig, struct siginfo *info,
260 struct task_struct *p, bool group); 261 struct task_struct *p, enum pid_type type);
261extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); 262extern int group_send_sig_info(int sig, struct siginfo *info,
263 struct task_struct *p, enum pid_type type);
262extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 264extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
263extern int sigprocmask(int, sigset_t *, sigset_t *); 265extern int sigprocmask(int, sigset_t *, sigset_t *);
264extern void set_current_blocked(sigset_t *); 266extern void set_current_blocked(sigset_t *);
265extern void __set_current_blocked(const sigset_t *); 267extern void __set_current_blocked(const sigset_t *);
266extern int show_unhandled_signals; 268extern int show_unhandled_signals;
267 269
268extern int get_signal(struct ksignal *ksig); 270extern bool get_signal(struct ksignal *ksig);
269extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); 271extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
270extern void exit_signals(struct task_struct *tsk); 272extern void exit_signals(struct task_struct *tsk);
271extern void kernel_sigaction(int, __sighandler_t); 273extern void kernel_sigaction(int, __sighandler_t);
@@ -287,7 +289,7 @@ static inline void disallow_signal(int sig)
287 289
288extern struct kmem_cache *sighand_cachep; 290extern struct kmem_cache *sighand_cachep;
289 291
290int unhandled_signal(struct task_struct *tsk, int sig); 292extern bool unhandled_signal(struct task_struct *tsk, int sig);
291 293
292/* 294/*
293 * In POSIX a signal is sent either to a specific thread (Linux task) 295 * In POSIX a signal is sent either to a specific thread (Linux task)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 610a201126ee..17a13e4785fc 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -641,6 +641,7 @@ typedef unsigned char *sk_buff_data_t;
641 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 641 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
642 * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL 642 * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL
643 * @dst_pending_confirm: need to confirm neighbour 643 * @dst_pending_confirm: need to confirm neighbour
644 * @decrypted: Decrypted SKB
644 * @napi_id: id of the NAPI struct this skb came from 645 * @napi_id: id of the NAPI struct this skb came from
645 * @secmark: security marking 646 * @secmark: security marking
646 * @mark: Generic packet mark 647 * @mark: Generic packet mark
@@ -675,12 +676,16 @@ struct sk_buff {
675 * UDP receive path is one user. 676 * UDP receive path is one user.
676 */ 677 */
677 unsigned long dev_scratch; 678 unsigned long dev_scratch;
678 int ip_defrag_offset;
679 }; 679 };
680 }; 680 };
681 struct rb_node rbnode; /* used in netem & tcp stack */ 681 struct rb_node rbnode; /* used in netem, ip4 defrag, and tcp stack */
682 struct list_head list;
683 };
684
685 union {
686 struct sock *sk;
687 int ip_defrag_offset;
682 }; 688 };
683 struct sock *sk;
684 689
685 union { 690 union {
686 ktime_t tstamp; 691 ktime_t tstamp;
@@ -791,6 +796,9 @@ struct sk_buff {
791 __u8 tc_redirected:1; 796 __u8 tc_redirected:1;
792 __u8 tc_from_ingress:1; 797 __u8 tc_from_ingress:1;
793#endif 798#endif
799#ifdef CONFIG_TLS_DEVICE
800 __u8 decrypted:1;
801#endif
794 802
795#ifdef CONFIG_NET_SCHED 803#ifdef CONFIG_NET_SCHED
796 __u16 tc_index; /* traffic control index */ 804 __u16 tc_index; /* traffic control index */
@@ -1030,6 +1038,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
1030} 1038}
1031 1039
1032struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 1040struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
1041void skb_headers_offset_update(struct sk_buff *skb, int off);
1033int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); 1042int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
1034struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); 1043struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
1035void skb_copy_header(struct sk_buff *new, const struct sk_buff *old); 1044void skb_copy_header(struct sk_buff *new, const struct sk_buff *old);
@@ -2354,7 +2363,7 @@ static inline void skb_probe_transport_header(struct sk_buff *skb,
2354 if (skb_transport_header_was_set(skb)) 2363 if (skb_transport_header_was_set(skb))
2355 return; 2364 return;
2356 2365
2357 if (skb_flow_dissect_flow_keys_basic(skb, &keys, 0, 0, 0, 0, 0)) 2366 if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0))
2358 skb_set_transport_header(skb, keys.control.thoff); 2367 skb_set_transport_header(skb, keys.control.thoff);
2359 else 2368 else
2360 skb_set_transport_header(skb, offset_hint); 2369 skb_set_transport_header(skb, offset_hint);
@@ -2580,7 +2589,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
2580 kfree_skb(skb); 2589 kfree_skb(skb);
2581} 2590}
2582 2591
2583void skb_rbtree_purge(struct rb_root *root); 2592unsigned int skb_rbtree_purge(struct rb_root *root);
2584 2593
2585void *netdev_alloc_frag(unsigned int fragsz); 2594void *netdev_alloc_frag(unsigned int fragsz);
2586 2595
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 14e3fe4bd6a1..ed9cbddeb4a6 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -97,7 +97,7 @@
97# define SLAB_FAILSLAB 0 97# define SLAB_FAILSLAB 0
98#endif 98#endif
99/* Account to memcg */ 99/* Account to memcg */
100#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) 100#ifdef CONFIG_MEMCG_KMEM
101# define SLAB_ACCOUNT ((slab_flags_t __force)0x04000000U) 101# define SLAB_ACCOUNT ((slab_flags_t __force)0x04000000U)
102#else 102#else
103# define SLAB_ACCOUNT 0 103# define SLAB_ACCOUNT 0
diff --git a/include/linux/slimbus.h b/include/linux/slimbus.h
index c36cf121d2cd..12c9719b2a55 100644
--- a/include/linux/slimbus.h
+++ b/include/linux/slimbus.h
@@ -14,16 +14,16 @@ extern struct bus_type slimbus_bus;
14 14
15/** 15/**
16 * struct slim_eaddr - Enumeration address for a SLIMbus device 16 * struct slim_eaddr - Enumeration address for a SLIMbus device
17 * @manf_id: Manufacturer Id for the device
18 * @prod_code: Product code
19 * @dev_index: Device index
20 * @instance: Instance value 17 * @instance: Instance value
18 * @dev_index: Device index
19 * @prod_code: Product code
20 * @manf_id: Manufacturer Id for the device
21 */ 21 */
22struct slim_eaddr { 22struct slim_eaddr {
23 u16 manf_id;
24 u16 prod_code;
25 u8 dev_index;
26 u8 instance; 23 u8 instance;
24 u8 dev_index;
25 u16 prod_code;
26 u16 manf_id;
27} __packed; 27} __packed;
28 28
29/** 29/**
@@ -48,6 +48,8 @@ struct slim_controller;
48 * @ctrl: slim controller instance. 48 * @ctrl: slim controller instance.
49 * @laddr: 1-byte Logical address of this device. 49 * @laddr: 1-byte Logical address of this device.
50 * @is_laddr_valid: indicates if the laddr is valid or not 50 * @is_laddr_valid: indicates if the laddr is valid or not
51 * @stream_list: List of streams on this device
52 * @stream_list_lock: lock to protect the stream list
51 * 53 *
52 * This is the client/device handle returned when a SLIMbus 54 * This is the client/device handle returned when a SLIMbus
53 * device is registered with a controller. 55 * device is registered with a controller.
@@ -60,6 +62,8 @@ struct slim_device {
60 enum slim_device_status status; 62 enum slim_device_status status;
61 u8 laddr; 63 u8 laddr;
62 bool is_laddr_valid; 64 bool is_laddr_valid;
65 struct list_head stream_list;
66 spinlock_t stream_list_lock;
63}; 67};
64 68
65#define to_slim_device(d) container_of(d, struct slim_device, dev) 69#define to_slim_device(d) container_of(d, struct slim_device, dev)
@@ -108,6 +112,36 @@ struct slim_val_inf {
108 struct completion *comp; 112 struct completion *comp;
109}; 113};
110 114
115#define SLIM_DEVICE_MAX_CHANNELS 256
116/* A SLIMBus Device may have frmo 0 to 31 Ports (inclusive) */
117#define SLIM_DEVICE_MAX_PORTS 32
118
119/**
120 * struct slim_stream_config - SLIMbus stream configuration
121 * Configuring a stream is done at hw_params or prepare call
122 * from audio drivers where they have all the required information
123 * regarding rate, number of channels and so on.
124 * There is a 1:1 mapping of channel and ports.
125 *
126 * @rate: data rate
127 * @bps: bits per data sample
128 * @ch_count: number of channels
129 * @chs: pointer to list of channel numbers
130 * @port_mask: port mask of ports to use for this stream
131 * @direction: direction of the stream, SNDRV_PCM_STREAM_PLAYBACK
132 * or SNDRV_PCM_STREAM_CAPTURE.
133 */
134struct slim_stream_config {
135 unsigned int rate;
136 unsigned int bps;
137 /* MAX 256 channels */
138 unsigned int ch_count;
139 unsigned int *chs;
140 /* Max 32 ports per device */
141 unsigned long port_mask;
142 int direction;
143};
144
111/* 145/*
112 * use a macro to avoid include chaining to get THIS_MODULE 146 * use a macro to avoid include chaining to get THIS_MODULE
113 */ 147 */
@@ -138,6 +172,8 @@ static inline void slim_set_devicedata(struct slim_device *dev, void *data)
138 dev_set_drvdata(&dev->dev, data); 172 dev_set_drvdata(&dev->dev, data);
139} 173}
140 174
175struct slim_device *of_slim_get_device(struct slim_controller *ctrl,
176 struct device_node *np);
141struct slim_device *slim_get_device(struct slim_controller *ctrl, 177struct slim_device *slim_get_device(struct slim_controller *ctrl,
142 struct slim_eaddr *e_addr); 178 struct slim_eaddr *e_addr);
143int slim_get_logical_addr(struct slim_device *sbdev); 179int slim_get_logical_addr(struct slim_device *sbdev);
@@ -161,4 +197,16 @@ int slim_readb(struct slim_device *sdev, u32 addr);
161int slim_writeb(struct slim_device *sdev, u32 addr, u8 value); 197int slim_writeb(struct slim_device *sdev, u32 addr, u8 value);
162int slim_read(struct slim_device *sdev, u32 addr, size_t count, u8 *val); 198int slim_read(struct slim_device *sdev, u32 addr, size_t count, u8 *val);
163int slim_write(struct slim_device *sdev, u32 addr, size_t count, u8 *val); 199int slim_write(struct slim_device *sdev, u32 addr, size_t count, u8 *val);
200
201/* SLIMbus Stream apis */
202struct slim_stream_runtime;
203struct slim_stream_runtime *slim_stream_allocate(struct slim_device *dev,
204 const char *sname);
205int slim_stream_prepare(struct slim_stream_runtime *stream,
206 struct slim_stream_config *c);
207int slim_stream_enable(struct slim_stream_runtime *stream);
208int slim_stream_disable(struct slim_stream_runtime *stream);
209int slim_stream_unprepare(struct slim_stream_runtime *stream);
210int slim_stream_free(struct slim_stream_runtime *stream);
211
164#endif /* _LINUX_SLIMBUS_H */ 212#endif /* _LINUX_SLIMBUS_H */
diff --git a/include/linux/soc/qcom/llcc-qcom.h b/include/linux/soc/qcom/llcc-qcom.h
new file mode 100644
index 000000000000..7e3b9c605ab2
--- /dev/null
+++ b/include/linux/soc/qcom/llcc-qcom.h
@@ -0,0 +1,180 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
4 *
5 */
6
7#include <linux/platform_device.h>
8#ifndef __LLCC_QCOM__
9#define __LLCC_QCOM__
10
11#define LLCC_CPUSS 1
12#define LLCC_VIDSC0 2
13#define LLCC_VIDSC1 3
14#define LLCC_ROTATOR 4
15#define LLCC_VOICE 5
16#define LLCC_AUDIO 6
17#define LLCC_MDMHPGRW 7
18#define LLCC_MDM 8
19#define LLCC_CMPT 10
20#define LLCC_GPUHTW 11
21#define LLCC_GPU 12
22#define LLCC_MMUHWT 13
23#define LLCC_CMPTDMA 15
24#define LLCC_DISP 16
25#define LLCC_VIDFW 17
26#define LLCC_MDMHPFX 20
27#define LLCC_MDMPNG 21
28#define LLCC_AUDHW 22
29
30/**
31 * llcc_slice_desc - Cache slice descriptor
32 * @slice_id: llcc slice id
33 * @slice_size: Size allocated for the llcc slice
34 */
35struct llcc_slice_desc {
36 u32 slice_id;
37 size_t slice_size;
38};
39
40/**
41 * llcc_slice_config - Data associated with the llcc slice
42 * @usecase_id: usecase id for which the llcc slice is used
43 * @slice_id: llcc slice id assigned to each slice
44 * @max_cap: maximum capacity of the llcc slice
45 * @priority: priority of the llcc slice
46 * @fixed_size: whether the llcc slice can grow beyond its size
47 * @bonus_ways: bonus ways associated with llcc slice
48 * @res_ways: reserved ways associated with llcc slice
49 * @cache_mode: mode of the llcc slice
50 * @probe_target_ways: Probe only reserved and bonus ways on a cache miss
51 * @dis_cap_alloc: Disable capacity based allocation
52 * @retain_on_pc: Retain through power collapse
53 * @activate_on_init: activate the slice on init
54 */
55struct llcc_slice_config {
56 u32 usecase_id;
57 u32 slice_id;
58 u32 max_cap;
59 u32 priority;
60 bool fixed_size;
61 u32 bonus_ways;
62 u32 res_ways;
63 u32 cache_mode;
64 u32 probe_target_ways;
65 bool dis_cap_alloc;
66 bool retain_on_pc;
67 bool activate_on_init;
68};
69
70/**
71 * llcc_drv_data - Data associated with the llcc driver
72 * @regmap: regmap associated with the llcc device
73 * @cfg: pointer to the data structure for slice configuration
74 * @lock: mutex associated with each slice
75 * @cfg_size: size of the config data table
76 * @max_slices: max slices as read from device tree
77 * @bcast_off: Offset of the broadcast bank
78 * @num_banks: Number of llcc banks
79 * @bitmap: Bit map to track the active slice ids
80 * @offsets: Pointer to the bank offsets array
81 */
82struct llcc_drv_data {
83 struct regmap *regmap;
84 const struct llcc_slice_config *cfg;
85 struct mutex lock;
86 u32 cfg_size;
87 u32 max_slices;
88 u32 bcast_off;
89 u32 num_banks;
90 unsigned long *bitmap;
91 u32 *offsets;
92};
93
94#if IS_ENABLED(CONFIG_QCOM_LLCC)
95/**
96 * llcc_slice_getd - get llcc slice descriptor
97 * @uid: usecase_id of the client
98 */
99struct llcc_slice_desc *llcc_slice_getd(u32 uid);
100
101/**
102 * llcc_slice_putd - llcc slice descritpor
103 * @desc: Pointer to llcc slice descriptor
104 */
105void llcc_slice_putd(struct llcc_slice_desc *desc);
106
107/**
108 * llcc_get_slice_id - get slice id
109 * @desc: Pointer to llcc slice descriptor
110 */
111int llcc_get_slice_id(struct llcc_slice_desc *desc);
112
113/**
114 * llcc_get_slice_size - llcc slice size
115 * @desc: Pointer to llcc slice descriptor
116 */
117size_t llcc_get_slice_size(struct llcc_slice_desc *desc);
118
119/**
120 * llcc_slice_activate - Activate the llcc slice
121 * @desc: Pointer to llcc slice descriptor
122 */
123int llcc_slice_activate(struct llcc_slice_desc *desc);
124
125/**
126 * llcc_slice_deactivate - Deactivate the llcc slice
127 * @desc: Pointer to llcc slice descriptor
128 */
129int llcc_slice_deactivate(struct llcc_slice_desc *desc);
130
131/**
132 * qcom_llcc_probe - program the sct table
133 * @pdev: platform device pointer
134 * @table: soc sct table
135 * @sz: Size of the config table
136 */
137int qcom_llcc_probe(struct platform_device *pdev,
138 const struct llcc_slice_config *table, u32 sz);
139#else
140static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid)
141{
142 return NULL;
143}
144
145static inline void llcc_slice_putd(struct llcc_slice_desc *desc)
146{
147
148};
149
150static inline int llcc_get_slice_id(struct llcc_slice_desc *desc)
151{
152 return -EINVAL;
153}
154
155static inline size_t llcc_get_slice_size(struct llcc_slice_desc *desc)
156{
157 return 0;
158}
159static inline int llcc_slice_activate(struct llcc_slice_desc *desc)
160{
161 return -EINVAL;
162}
163
164static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc)
165{
166 return -EINVAL;
167}
168static inline int qcom_llcc_probe(struct platform_device *pdev,
169 const struct llcc_slice_config *table, u32 sz)
170{
171 return -ENODEV;
172}
173
174static inline int qcom_llcc_remove(struct platform_device *pdev)
175{
176 return -ENODEV;
177}
178#endif
179
180#endif
diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/mdt_loader.h
index 5b98bbdabc25..944b06aefb0f 100644
--- a/include/linux/soc/qcom/mdt_loader.h
+++ b/include/linux/soc/qcom/mdt_loader.h
@@ -17,4 +17,8 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw,
17 phys_addr_t mem_phys, size_t mem_size, 17 phys_addr_t mem_phys, size_t mem_size,
18 phys_addr_t *reloc_base); 18 phys_addr_t *reloc_base);
19 19
20int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
21 const char *fw_name, int pas_id, void *mem_region,
22 phys_addr_t mem_phys, size_t mem_size,
23 phys_addr_t *reloc_base);
20#endif 24#endif
diff --git a/include/linux/soc/renesas/rcar-sysc.h b/include/linux/soc/renesas/rcar-sysc.h
index 8a6086d2e9c3..00fae6fd234d 100644
--- a/include/linux/soc/renesas/rcar-sysc.h
+++ b/include/linux/soc/renesas/rcar-sysc.h
@@ -2,16 +2,7 @@
2#ifndef __LINUX_SOC_RENESAS_RCAR_SYSC_H__ 2#ifndef __LINUX_SOC_RENESAS_RCAR_SYSC_H__
3#define __LINUX_SOC_RENESAS_RCAR_SYSC_H__ 3#define __LINUX_SOC_RENESAS_RCAR_SYSC_H__
4 4
5#include <linux/types.h> 5int rcar_sysc_power_down_cpu(unsigned int cpu);
6 6int rcar_sysc_power_up_cpu(unsigned int cpu);
7struct rcar_sysc_ch {
8 u16 chan_offs;
9 u8 chan_bit;
10 u8 isr_bit;
11};
12
13int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch);
14int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch);
15void rcar_sysc_init(phys_addr_t base, u32 syscier);
16 7
17#endif /* __LINUX_SOC_RENESAS_RCAR_SYSC_H__ */ 8#endif /* __LINUX_SOC_RENESAS_RCAR_SYSC_H__ */
diff --git a/include/linux/soc/samsung/exynos-regs-pmu.h b/include/linux/soc/samsung/exynos-regs-pmu.h
index 66dcb9ec273a..5addaf5ccbce 100644
--- a/include/linux/soc/samsung/exynos-regs-pmu.h
+++ b/include/linux/soc/samsung/exynos-regs-pmu.h
@@ -42,7 +42,9 @@
42#define EXYNOS_SWRESET 0x0400 42#define EXYNOS_SWRESET 0x0400
43 43
44#define S5P_WAKEUP_STAT 0x0600 44#define S5P_WAKEUP_STAT 0x0600
45#define S5P_EINT_WAKEUP_MASK 0x0604 45/* Value for EXYNOS_EINT_WAKEUP_MASK disabling all external wakeup interrupts */
46#define EXYNOS_EINT_WAKEUP_MASK_DISABLED 0xffffffff
47#define EXYNOS_EINT_WAKEUP_MASK 0x0604
46#define S5P_WAKEUP_MASK 0x0608 48#define S5P_WAKEUP_MASK 0x0608
47#define S5P_WAKEUP_MASK2 0x0614 49#define S5P_WAKEUP_MASK2 0x0614
48 50
@@ -180,6 +182,9 @@
180#define S5P_CORE_WAKEUP_FROM_LOCAL_CFG (0x3 << 8) 182#define S5P_CORE_WAKEUP_FROM_LOCAL_CFG (0x3 << 8)
181#define S5P_CORE_AUTOWAKEUP_EN (1 << 31) 183#define S5P_CORE_AUTOWAKEUP_EN (1 << 31)
182 184
185/* Only for S5Pv210 */
186#define S5PV210_EINT_WAKEUP_MASK 0xC004
187
183/* Only for EXYNOS4210 */ 188/* Only for EXYNOS4210 */
184#define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154 189#define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154
185#define S5P_CMU_RESET_LCD1_LOWPWR 0x1174 190#define S5P_CMU_RESET_LCD1_LOWPWR 0x1174
@@ -641,6 +646,7 @@
641 | EXYNOS5420_KFC_USE_STANDBY_WFI3) 646 | EXYNOS5420_KFC_USE_STANDBY_WFI3)
642 647
643/* For EXYNOS5433 */ 648/* For EXYNOS5433 */
649#define EXYNOS5433_EINT_WAKEUP_MASK (0x060C)
644#define EXYNOS5433_USBHOST30_PHY_CONTROL (0x0728) 650#define EXYNOS5433_USBHOST30_PHY_CONTROL (0x0728)
645#define EXYNOS5433_PAD_RETENTION_AUD_OPTION (0x3028) 651#define EXYNOS5433_PAD_RETENTION_AUD_OPTION (0x3028)
646#define EXYNOS5433_PAD_RETENTION_MMC2_OPTION (0x30C8) 652#define EXYNOS5433_PAD_RETENTION_MMC2_OPTION (0x30C8)
diff --git a/include/linux/spi/adi_spi3.h b/include/linux/spi/adi_spi3.h
deleted file mode 100644
index c84123aa1d06..000000000000
--- a/include/linux/spi/adi_spi3.h
+++ /dev/null
@@ -1,254 +0,0 @@
1/*
2 * Analog Devices SPI3 controller driver
3 *
4 * Copyright (c) 2014 Analog Devices Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef _ADI_SPI3_H_
17#define _ADI_SPI3_H_
18
19#include <linux/types.h>
20
21/* SPI_CONTROL */
22#define SPI_CTL_EN 0x00000001 /* Enable */
23#define SPI_CTL_MSTR 0x00000002 /* Master/Slave */
24#define SPI_CTL_PSSE 0x00000004 /* controls modf error in master mode */
25#define SPI_CTL_ODM 0x00000008 /* Open Drain Mode */
26#define SPI_CTL_CPHA 0x00000010 /* Clock Phase */
27#define SPI_CTL_CPOL 0x00000020 /* Clock Polarity */
28#define SPI_CTL_ASSEL 0x00000040 /* Slave Select Pin Control */
29#define SPI_CTL_SELST 0x00000080 /* Slave Select Polarity in-between transfers */
30#define SPI_CTL_EMISO 0x00000100 /* Enable MISO */
31#define SPI_CTL_SIZE 0x00000600 /* Word Transfer Size */
32#define SPI_CTL_SIZE08 0x00000000 /* SIZE: 8 bits */
33#define SPI_CTL_SIZE16 0x00000200 /* SIZE: 16 bits */
34#define SPI_CTL_SIZE32 0x00000400 /* SIZE: 32 bits */
35#define SPI_CTL_LSBF 0x00001000 /* LSB First */
36#define SPI_CTL_FCEN 0x00002000 /* Flow-Control Enable */
37#define SPI_CTL_FCCH 0x00004000 /* Flow-Control Channel Selection */
38#define SPI_CTL_FCPL 0x00008000 /* Flow-Control Polarity */
39#define SPI_CTL_FCWM 0x00030000 /* Flow-Control Water-Mark */
40#define SPI_CTL_FIFO0 0x00000000 /* FCWM: TFIFO empty or RFIFO Full */
41#define SPI_CTL_FIFO1 0x00010000 /* FCWM: TFIFO 75% or more empty or RFIFO 75% or more full */
42#define SPI_CTL_FIFO2 0x00020000 /* FCWM: TFIFO 50% or more empty or RFIFO 50% or more full */
43#define SPI_CTL_FMODE 0x00040000 /* Fast-mode Enable */
44#define SPI_CTL_MIOM 0x00300000 /* Multiple I/O Mode */
45#define SPI_CTL_MIO_DIS 0x00000000 /* MIOM: Disable */
46#define SPI_CTL_MIO_DUAL 0x00100000 /* MIOM: Enable DIOM (Dual I/O Mode) */
47#define SPI_CTL_MIO_QUAD 0x00200000 /* MIOM: Enable QUAD (Quad SPI Mode) */
48#define SPI_CTL_SOSI 0x00400000 /* Start on MOSI */
49/* SPI_RX_CONTROL */
50#define SPI_RXCTL_REN 0x00000001 /* Receive Channel Enable */
51#define SPI_RXCTL_RTI 0x00000004 /* Receive Transfer Initiate */
52#define SPI_RXCTL_RWCEN 0x00000008 /* Receive Word Counter Enable */
53#define SPI_RXCTL_RDR 0x00000070 /* Receive Data Request */
54#define SPI_RXCTL_RDR_DIS 0x00000000 /* RDR: Disabled */
55#define SPI_RXCTL_RDR_NE 0x00000010 /* RDR: RFIFO not empty */
56#define SPI_RXCTL_RDR_25 0x00000020 /* RDR: RFIFO 25% full */
57#define SPI_RXCTL_RDR_50 0x00000030 /* RDR: RFIFO 50% full */
58#define SPI_RXCTL_RDR_75 0x00000040 /* RDR: RFIFO 75% full */
59#define SPI_RXCTL_RDR_FULL 0x00000050 /* RDR: RFIFO full */
60#define SPI_RXCTL_RDO 0x00000100 /* Receive Data Over-Run */
61#define SPI_RXCTL_RRWM 0x00003000 /* FIFO Regular Water-Mark */
62#define SPI_RXCTL_RWM_0 0x00000000 /* RRWM: RFIFO Empty */
63#define SPI_RXCTL_RWM_25 0x00001000 /* RRWM: RFIFO 25% full */
64#define SPI_RXCTL_RWM_50 0x00002000 /* RRWM: RFIFO 50% full */
65#define SPI_RXCTL_RWM_75 0x00003000 /* RRWM: RFIFO 75% full */
66#define SPI_RXCTL_RUWM 0x00070000 /* FIFO Urgent Water-Mark */
67#define SPI_RXCTL_UWM_DIS 0x00000000 /* RUWM: Disabled */
68#define SPI_RXCTL_UWM_25 0x00010000 /* RUWM: RFIFO 25% full */
69#define SPI_RXCTL_UWM_50 0x00020000 /* RUWM: RFIFO 50% full */
70#define SPI_RXCTL_UWM_75 0x00030000 /* RUWM: RFIFO 75% full */
71#define SPI_RXCTL_UWM_FULL 0x00040000 /* RUWM: RFIFO full */
72/* SPI_TX_CONTROL */
73#define SPI_TXCTL_TEN 0x00000001 /* Transmit Channel Enable */
74#define SPI_TXCTL_TTI 0x00000004 /* Transmit Transfer Initiate */
75#define SPI_TXCTL_TWCEN 0x00000008 /* Transmit Word Counter Enable */
76#define SPI_TXCTL_TDR 0x00000070 /* Transmit Data Request */
77#define SPI_TXCTL_TDR_DIS 0x00000000 /* TDR: Disabled */
78#define SPI_TXCTL_TDR_NF 0x00000010 /* TDR: TFIFO not full */
79#define SPI_TXCTL_TDR_25 0x00000020 /* TDR: TFIFO 25% empty */
80#define SPI_TXCTL_TDR_50 0x00000030 /* TDR: TFIFO 50% empty */
81#define SPI_TXCTL_TDR_75 0x00000040 /* TDR: TFIFO 75% empty */
82#define SPI_TXCTL_TDR_EMPTY 0x00000050 /* TDR: TFIFO empty */
83#define SPI_TXCTL_TDU 0x00000100 /* Transmit Data Under-Run */
84#define SPI_TXCTL_TRWM 0x00003000 /* FIFO Regular Water-Mark */
85#define SPI_TXCTL_RWM_FULL 0x00000000 /* TRWM: TFIFO full */
86#define SPI_TXCTL_RWM_25 0x00001000 /* TRWM: TFIFO 25% empty */
87#define SPI_TXCTL_RWM_50 0x00002000 /* TRWM: TFIFO 50% empty */
88#define SPI_TXCTL_RWM_75 0x00003000 /* TRWM: TFIFO 75% empty */
89#define SPI_TXCTL_TUWM 0x00070000 /* FIFO Urgent Water-Mark */
90#define SPI_TXCTL_UWM_DIS 0x00000000 /* TUWM: Disabled */
91#define SPI_TXCTL_UWM_25 0x00010000 /* TUWM: TFIFO 25% empty */
92#define SPI_TXCTL_UWM_50 0x00020000 /* TUWM: TFIFO 50% empty */
93#define SPI_TXCTL_UWM_75 0x00030000 /* TUWM: TFIFO 75% empty */
94#define SPI_TXCTL_UWM_EMPTY 0x00040000 /* TUWM: TFIFO empty */
95/* SPI_CLOCK */
96#define SPI_CLK_BAUD 0x0000FFFF /* Baud Rate */
97/* SPI_DELAY */
98#define SPI_DLY_STOP 0x000000FF /* Transfer delay time in multiples of SCK period */
99#define SPI_DLY_LEADX 0x00000100 /* Extended (1 SCK) LEAD Control */
100#define SPI_DLY_LAGX 0x00000200 /* Extended (1 SCK) LAG control */
101/* SPI_SSEL */
102#define SPI_SLVSEL_SSE1 0x00000002 /* SPISSEL1 Enable */
103#define SPI_SLVSEL_SSE2 0x00000004 /* SPISSEL2 Enable */
104#define SPI_SLVSEL_SSE3 0x00000008 /* SPISSEL3 Enable */
105#define SPI_SLVSEL_SSE4 0x00000010 /* SPISSEL4 Enable */
106#define SPI_SLVSEL_SSE5 0x00000020 /* SPISSEL5 Enable */
107#define SPI_SLVSEL_SSE6 0x00000040 /* SPISSEL6 Enable */
108#define SPI_SLVSEL_SSE7 0x00000080 /* SPISSEL7 Enable */
109#define SPI_SLVSEL_SSEL1 0x00000200 /* SPISSEL1 Value */
110#define SPI_SLVSEL_SSEL2 0x00000400 /* SPISSEL2 Value */
111#define SPI_SLVSEL_SSEL3 0x00000800 /* SPISSEL3 Value */
112#define SPI_SLVSEL_SSEL4 0x00001000 /* SPISSEL4 Value */
113#define SPI_SLVSEL_SSEL5 0x00002000 /* SPISSEL5 Value */
114#define SPI_SLVSEL_SSEL6 0x00004000 /* SPISSEL6 Value */
115#define SPI_SLVSEL_SSEL7 0x00008000 /* SPISSEL7 Value */
116/* SPI_RWC */
117#define SPI_RWC_VALUE 0x0000FFFF /* Received Word-Count */
118/* SPI_RWCR */
119#define SPI_RWCR_VALUE 0x0000FFFF /* Received Word-Count Reload */
120/* SPI_TWC */
121#define SPI_TWC_VALUE 0x0000FFFF /* Transmitted Word-Count */
122/* SPI_TWCR */
123#define SPI_TWCR_VALUE 0x0000FFFF /* Transmitted Word-Count Reload */
124/* SPI_IMASK */
125#define SPI_IMSK_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
126#define SPI_IMSK_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
127#define SPI_IMSK_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
128#define SPI_IMSK_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
129#define SPI_IMSK_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
130#define SPI_IMSK_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
131#define SPI_IMSK_RSM 0x00000100 /* Receive Start Interrupt Mask */
132#define SPI_IMSK_TSM 0x00000200 /* Transmit Start Interrupt Mask */
133#define SPI_IMSK_RFM 0x00000400 /* Receive Finish Interrupt Mask */
134#define SPI_IMSK_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
135/* SPI_IMASKCL */
136#define SPI_IMSK_CLR_RUW 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
137#define SPI_IMSK_CLR_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
138#define SPI_IMSK_CLR_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
139#define SPI_IMSK_CLR_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
140#define SPI_IMSK_CLR_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
141#define SPI_IMSK_CLR_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
142#define SPI_IMSK_CLR_RSM 0x00000100 /* Receive Start Interrupt Mask */
143#define SPI_IMSK_CLR_TSM 0x00000200 /* Transmit Start Interrupt Mask */
144#define SPI_IMSK_CLR_RFM 0x00000400 /* Receive Finish Interrupt Mask */
145#define SPI_IMSK_CLR_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
146/* SPI_IMASKST */
147#define SPI_IMSK_SET_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
148#define SPI_IMSK_SET_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
149#define SPI_IMSK_SET_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
150#define SPI_IMSK_SET_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
151#define SPI_IMSK_SET_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
152#define SPI_IMSK_SET_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
153#define SPI_IMSK_SET_RSM 0x00000100 /* Receive Start Interrupt Mask */
154#define SPI_IMSK_SET_TSM 0x00000200 /* Transmit Start Interrupt Mask */
155#define SPI_IMSK_SET_RFM 0x00000400 /* Receive Finish Interrupt Mask */
156#define SPI_IMSK_SET_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
157/* SPI_STATUS */
158#define SPI_STAT_SPIF 0x00000001 /* SPI Finished */
159#define SPI_STAT_RUWM 0x00000002 /* Receive Urgent Water-Mark Breached */
160#define SPI_STAT_TUWM 0x00000004 /* Transmit Urgent Water-Mark Breached */
161#define SPI_STAT_ROE 0x00000010 /* Receive Over-Run Error Indication */
162#define SPI_STAT_TUE 0x00000020 /* Transmit Under-Run Error Indication */
163#define SPI_STAT_TCE 0x00000040 /* Transmit Collision Error Indication */
164#define SPI_STAT_MODF 0x00000080 /* Mode Fault Error Indication */
165#define SPI_STAT_RS 0x00000100 /* Receive Start Indication */
166#define SPI_STAT_TS 0x00000200 /* Transmit Start Indication */
167#define SPI_STAT_RF 0x00000400 /* Receive Finish Indication */
168#define SPI_STAT_TF 0x00000800 /* Transmit Finish Indication */
169#define SPI_STAT_RFS 0x00007000 /* SPI_RFIFO status */
170#define SPI_STAT_RFIFO_EMPTY 0x00000000 /* RFS: RFIFO Empty */
171#define SPI_STAT_RFIFO_25 0x00001000 /* RFS: RFIFO 25% Full */
172#define SPI_STAT_RFIFO_50 0x00002000 /* RFS: RFIFO 50% Full */
173#define SPI_STAT_RFIFO_75 0x00003000 /* RFS: RFIFO 75% Full */
174#define SPI_STAT_RFIFO_FULL 0x00004000 /* RFS: RFIFO Full */
175#define SPI_STAT_TFS 0x00070000 /* SPI_TFIFO status */
176#define SPI_STAT_TFIFO_FULL 0x00000000 /* TFS: TFIFO full */
177#define SPI_STAT_TFIFO_25 0x00010000 /* TFS: TFIFO 25% empty */
178#define SPI_STAT_TFIFO_50 0x00020000 /* TFS: TFIFO 50% empty */
179#define SPI_STAT_TFIFO_75 0x00030000 /* TFS: TFIFO 75% empty */
180#define SPI_STAT_TFIFO_EMPTY 0x00040000 /* TFS: TFIFO empty */
181#define SPI_STAT_FCS 0x00100000 /* Flow-Control Stall Indication */
182#define SPI_STAT_RFE 0x00400000 /* SPI_RFIFO Empty */
183#define SPI_STAT_TFF 0x00800000 /* SPI_TFIFO Full */
184/* SPI_ILAT */
185#define SPI_ILAT_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */
186#define SPI_ILAT_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */
187#define SPI_ILAT_ROI 0x00000010 /* Receive Over-Run Error Indication */
188#define SPI_ILAT_TUI 0x00000020 /* Transmit Under-Run Error Indication */
189#define SPI_ILAT_TCI 0x00000040 /* Transmit Collision Error Indication */
190#define SPI_ILAT_MFI 0x00000080 /* Mode Fault Error Indication */
191#define SPI_ILAT_RSI 0x00000100 /* Receive Start Indication */
192#define SPI_ILAT_TSI 0x00000200 /* Transmit Start Indication */
193#define SPI_ILAT_RFI 0x00000400 /* Receive Finish Indication */
194#define SPI_ILAT_TFI 0x00000800 /* Transmit Finish Indication */
195/* SPI_ILATCL */
196#define SPI_ILAT_CLR_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */
197#define SPI_ILAT_CLR_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */
198#define SPI_ILAT_CLR_ROI 0x00000010 /* Receive Over-Run Error Indication */
199#define SPI_ILAT_CLR_TUI 0x00000020 /* Transmit Under-Run Error Indication */
200#define SPI_ILAT_CLR_TCI 0x00000040 /* Transmit Collision Error Indication */
201#define SPI_ILAT_CLR_MFI 0x00000080 /* Mode Fault Error Indication */
202#define SPI_ILAT_CLR_RSI 0x00000100 /* Receive Start Indication */
203#define SPI_ILAT_CLR_TSI 0x00000200 /* Transmit Start Indication */
204#define SPI_ILAT_CLR_RFI 0x00000400 /* Receive Finish Indication */
205#define SPI_ILAT_CLR_TFI 0x00000800 /* Transmit Finish Indication */
206
207/*
208 * adi spi3 registers layout
209 */
210struct adi_spi_regs {
211 u32 revid;
212 u32 control;
213 u32 rx_control;
214 u32 tx_control;
215 u32 clock;
216 u32 delay;
217 u32 ssel;
218 u32 rwc;
219 u32 rwcr;
220 u32 twc;
221 u32 twcr;
222 u32 reserved0;
223 u32 emask;
224 u32 emaskcl;
225 u32 emaskst;
226 u32 reserved1;
227 u32 status;
228 u32 elat;
229 u32 elatcl;
230 u32 reserved2;
231 u32 rfifo;
232 u32 reserved3;
233 u32 tfifo;
234};
235
236#define MAX_CTRL_CS 8 /* cs in spi controller */
237
238/* device.platform_data for SSP controller devices */
239struct adi_spi3_master {
240 u16 num_chipselect;
241 u16 pin_req[7];
242};
243
244/* spi_board_info.controller_data for SPI slave devices,
245 * copied to spi_device.platform_data ... mostly for dma tuning
246 */
247struct adi_spi3_chip {
248 u32 control;
249 u16 cs_chg_udelay; /* Some devices require 16-bit delays */
250 u32 tx_dummy_val; /* tx value for rx only transfer */
251 bool enable_dma;
252};
253
254#endif /* _ADI_SPI3_H_ */
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index bb4bd15ae1f6..b2bd4b4127c4 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -3,7 +3,9 @@
3 * Copyright (C) 2018 Exceet Electronics GmbH 3 * Copyright (C) 2018 Exceet Electronics GmbH
4 * Copyright (C) 2018 Bootlin 4 * Copyright (C) 2018 Bootlin
5 * 5 *
6 * Author: Boris Brezillon <boris.brezillon@bootlin.com> 6 * Author:
7 * Peter Pan <peterpandong@micron.com>
8 * Boris Brezillon <boris.brezillon@bootlin.com>
7 */ 9 */
8 10
9#ifndef __LINUX_SPI_MEM_H 11#ifndef __LINUX_SPI_MEM_H
@@ -122,7 +124,8 @@ struct spi_mem_op {
122/** 124/**
123 * struct spi_mem - describes a SPI memory device 125 * struct spi_mem - describes a SPI memory device
124 * @spi: the underlying SPI device 126 * @spi: the underlying SPI device
125 * @drvpriv: spi_mem_drviver private data 127 * @drvpriv: spi_mem_driver private data
128 * @name: name of the SPI memory device
126 * 129 *
127 * Extra information that describe the SPI memory device and may be needed by 130 * Extra information that describe the SPI memory device and may be needed by
128 * the controller to properly handle this device should be placed here. 131 * the controller to properly handle this device should be placed here.
@@ -133,6 +136,7 @@ struct spi_mem_op {
133struct spi_mem { 136struct spi_mem {
134 struct spi_device *spi; 137 struct spi_device *spi;
135 void *drvpriv; 138 void *drvpriv;
139 const char *name;
136}; 140};
137 141
138/** 142/**
@@ -165,6 +169,13 @@ static inline void *spi_mem_get_drvdata(struct spi_mem *mem)
165 * limitations) 169 * limitations)
166 * @supports_op: check if an operation is supported by the controller 170 * @supports_op: check if an operation is supported by the controller
167 * @exec_op: execute a SPI memory operation 171 * @exec_op: execute a SPI memory operation
172 * @get_name: get a custom name for the SPI mem device from the controller.
173 * This might be needed if the controller driver has been ported
174 * to use the SPI mem layer and a custom name is used to keep
175 * mtdparts compatible.
176 * Note that if the implementation of this function allocates memory
177 * dynamically, then it should do so with devm_xxx(), as we don't
178 * have a ->free_name() function.
168 * 179 *
169 * This interface should be implemented by SPI controllers providing an 180 * This interface should be implemented by SPI controllers providing an
170 * high-level interface to execute SPI memory operation, which is usually the 181 * high-level interface to execute SPI memory operation, which is usually the
@@ -176,6 +187,7 @@ struct spi_controller_mem_ops {
176 const struct spi_mem_op *op); 187 const struct spi_mem_op *op);
177 int (*exec_op)(struct spi_mem *mem, 188 int (*exec_op)(struct spi_mem *mem,
178 const struct spi_mem_op *op); 189 const struct spi_mem_op *op);
190 const char *(*get_name)(struct spi_mem *mem);
179}; 191};
180 192
181/** 193/**
@@ -234,6 +246,8 @@ bool spi_mem_supports_op(struct spi_mem *mem,
234int spi_mem_exec_op(struct spi_mem *mem, 246int spi_mem_exec_op(struct spi_mem *mem,
235 const struct spi_mem_op *op); 247 const struct spi_mem_op *op);
236 248
249const char *spi_mem_get_name(struct spi_mem *mem);
250
237int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv, 251int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv,
238 struct module *owner); 252 struct module *owner);
239 253
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 51d8c060e513..b7e021b274dc 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -8,7 +8,7 @@ struct spi_bitbang {
8 struct mutex lock; 8 struct mutex lock;
9 u8 busy; 9 u8 busy;
10 u8 use_dma; 10 u8 use_dma;
11 u8 flags; /* extra spi->mode support */ 11 u16 flags; /* extra spi->mode support */
12 12
13 struct spi_master *master; 13 struct spi_master *master;
14 14
@@ -30,7 +30,8 @@ struct spi_bitbang {
30 /* txrx_word[SPI_MODE_*]() just looks like a shift register */ 30 /* txrx_word[SPI_MODE_*]() just looks like a shift register */
31 u32 (*txrx_word[4])(struct spi_device *spi, 31 u32 (*txrx_word[4])(struct spi_device *spi,
32 unsigned nsecs, 32 unsigned nsecs,
33 u32 word, u8 bits); 33 u32 word, u8 bits, unsigned flags);
34 int (*set_line_direction)(struct spi_device *spi, bool output);
34}; 35};
35 36
36/* you can call these default bitbang->master methods from your custom 37/* you can call these default bitbang->master methods from your custom
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 3190997df9ca..e089157dcf97 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -451,9 +451,20 @@ extern int _atomic_dec_and_lock_irqsave(atomic_t *atomic, spinlock_t *lock,
451#define atomic_dec_and_lock_irqsave(atomic, lock, flags) \ 451#define atomic_dec_and_lock_irqsave(atomic, lock, flags) \
452 __cond_lock(lock, _atomic_dec_and_lock_irqsave(atomic, lock, &(flags))) 452 __cond_lock(lock, _atomic_dec_and_lock_irqsave(atomic, lock, &(flags)))
453 453
454int alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask, 454int __alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask,
455 size_t max_size, unsigned int cpu_mult, 455 size_t max_size, unsigned int cpu_mult,
456 gfp_t gfp); 456 gfp_t gfp, const char *name,
457 struct lock_class_key *key);
458
459#define alloc_bucket_spinlocks(locks, lock_mask, max_size, cpu_mult, gfp) \
460 ({ \
461 static struct lock_class_key key; \
462 int ret; \
463 \
464 ret = __alloc_bucket_spinlocks(locks, lock_mask, max_size, \
465 cpu_mult, gfp, #locks, &key); \
466 ret; \
467 })
457 468
458void free_bucket_spinlocks(spinlock_t *locks); 469void free_bucket_spinlocks(spinlock_t *locks);
459 470
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 3e72a291c401..67135d4a8a30 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -170,6 +170,11 @@ static inline int srcu_read_lock_held(const struct srcu_struct *sp)
170#define srcu_dereference(p, sp) srcu_dereference_check((p), (sp), 0) 170#define srcu_dereference(p, sp) srcu_dereference_check((p), (sp), 0)
171 171
172/** 172/**
173 * srcu_dereference_notrace - no tracing and no lockdep calls from here
174 */
175#define srcu_dereference_notrace(p, sp) srcu_dereference_check((p), (sp), 1)
176
177/**
173 * srcu_read_lock - register a new reader for an SRCU-protected structure. 178 * srcu_read_lock - register a new reader for an SRCU-protected structure.
174 * @sp: srcu_struct in which to register the new reader. 179 * @sp: srcu_struct in which to register the new reader.
175 * 180 *
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 3b43655cabe6..0d5a2691e7e9 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -499,11 +499,9 @@ struct ssb_bus {
499 499
500 /* Internal-only stuff follows. Do not touch. */ 500 /* Internal-only stuff follows. Do not touch. */
501 struct list_head list; 501 struct list_head list;
502#ifdef CONFIG_SSB_DEBUG
503 /* Is the bus already powered up? */ 502 /* Is the bus already powered up? */
504 bool powered_up; 503 bool powered_up;
505 int power_warn_count; 504 int power_warn_count;
506#endif /* DEBUG */
507}; 505};
508 506
509enum ssb_quirks { 507enum ssb_quirks {
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 32feac5bbd75..c43e9a01b892 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -190,5 +190,6 @@ struct plat_stmmacenet_data {
190 bool tso_en; 190 bool tso_en;
191 int mac_port_sel_speed; 191 int mac_port_sel_speed;
192 bool en_tx_lpi_clockgating; 192 bool en_tx_lpi_clockgating;
193 int has_xgmac;
193}; 194};
194#endif 195#endif
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index d9af474a857d..58a6765c1c5e 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -125,7 +125,8 @@ struct rpc_authops {
125 struct module *owner; 125 struct module *owner;
126 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */ 126 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */
127 char * au_name; 127 char * au_name;
128 struct rpc_auth * (*create)(struct rpc_auth_create_args *, struct rpc_clnt *); 128 struct rpc_auth * (*create)(const struct rpc_auth_create_args *,
129 struct rpc_clnt *);
129 void (*destroy)(struct rpc_auth *); 130 void (*destroy)(struct rpc_auth *);
130 131
131 int (*hash_cred)(struct auth_cred *, unsigned int); 132 int (*hash_cred)(struct auth_cred *, unsigned int);
@@ -174,7 +175,7 @@ struct rpc_cred * rpc_lookup_generic_cred(struct auth_cred *, int, gfp_t);
174struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); 175struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
175int rpcauth_register(const struct rpc_authops *); 176int rpcauth_register(const struct rpc_authops *);
176int rpcauth_unregister(const struct rpc_authops *); 177int rpcauth_unregister(const struct rpc_authops *);
177struct rpc_auth * rpcauth_create(struct rpc_auth_create_args *, 178struct rpc_auth * rpcauth_create(const struct rpc_auth_create_args *,
178 struct rpc_clnt *); 179 struct rpc_clnt *);
179void rpcauth_release(struct rpc_auth *); 180void rpcauth_release(struct rpc_auth *);
180rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t, 181rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t,
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 9b11b6a0978c..73d5c4a870fa 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -156,6 +156,7 @@ int rpc_switch_client_transport(struct rpc_clnt *,
156 156
157void rpc_shutdown_client(struct rpc_clnt *); 157void rpc_shutdown_client(struct rpc_clnt *);
158void rpc_release_client(struct rpc_clnt *); 158void rpc_release_client(struct rpc_clnt *);
159void rpc_task_release_transport(struct rpc_task *);
159void rpc_task_release_client(struct rpc_task *); 160void rpc_task_release_client(struct rpc_task *);
160 161
161int rpcb_create_local(struct net *); 162int rpcb_create_local(struct net *);
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 9baed7b355b2..1b3751327575 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -82,7 +82,7 @@ void rpc_count_iostats(const struct rpc_task *,
82 struct rpc_iostats *); 82 struct rpc_iostats *);
83void rpc_count_iostats_metrics(const struct rpc_task *, 83void rpc_count_iostats_metrics(const struct rpc_task *,
84 struct rpc_iostats *); 84 struct rpc_iostats *);
85void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); 85void rpc_clnt_show_stats(struct seq_file *, struct rpc_clnt *);
86void rpc_free_iostats(struct rpc_iostats *); 86void rpc_free_iostats(struct rpc_iostats *);
87 87
88#else /* CONFIG_PROC_FS */ 88#else /* CONFIG_PROC_FS */
@@ -95,7 +95,7 @@ static inline void rpc_count_iostats_metrics(const struct rpc_task *task,
95{ 95{
96} 96}
97 97
98static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {} 98static inline void rpc_clnt_show_stats(struct seq_file *seq, struct rpc_clnt *clnt) {}
99static inline void rpc_free_iostats(struct rpc_iostats *stats) {} 99static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
100 100
101#endif /* CONFIG_PROC_FS */ 101#endif /* CONFIG_PROC_FS */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 574368e8a16f..73e130a840ce 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -496,9 +496,11 @@ void svc_reserve(struct svc_rqst *rqstp, int space);
496struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); 496struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
497char * svc_print_addr(struct svc_rqst *, char *, size_t); 497char * svc_print_addr(struct svc_rqst *, char *, size_t);
498unsigned int svc_fill_write_vector(struct svc_rqst *rqstp, 498unsigned int svc_fill_write_vector(struct svc_rqst *rqstp,
499 struct page **pages,
499 struct kvec *first, size_t total); 500 struct kvec *first, size_t total);
500char *svc_fill_symlink_pathname(struct svc_rqst *rqstp, 501char *svc_fill_symlink_pathname(struct svc_rqst *rqstp,
501 struct kvec *first, size_t total); 502 struct kvec *first, void *p,
503 size_t total);
502 504
503#define RPC_MAX_ADDRBUFLEN (63U) 505#define RPC_MAX_ADDRBUFLEN (63U)
504 506
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 7c3656505847..04e404a07882 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -31,6 +31,7 @@ struct svc_cred {
31 /* name of form servicetype@hostname, passed down by 31 /* name of form servicetype@hostname, passed down by
32 * rpc.svcgssd, or computed from the above: */ 32 * rpc.svcgssd, or computed from the above: */
33 char *cr_principal; 33 char *cr_principal;
34 char *cr_targ_princ;
34 struct gss_api_mech *cr_gss_mech; 35 struct gss_api_mech *cr_gss_mech;
35}; 36};
36 37
@@ -39,6 +40,7 @@ static inline void init_svc_cred(struct svc_cred *cred)
39 cred->cr_group_info = NULL; 40 cred->cr_group_info = NULL;
40 cred->cr_raw_principal = NULL; 41 cred->cr_raw_principal = NULL;
41 cred->cr_principal = NULL; 42 cred->cr_principal = NULL;
43 cred->cr_targ_princ = NULL;
42 cred->cr_gss_mech = NULL; 44 cred->cr_gss_mech = NULL;
43} 45}
44 46
@@ -48,6 +50,7 @@ static inline void free_svc_cred(struct svc_cred *cred)
48 put_group_info(cred->cr_group_info); 50 put_group_info(cred->cr_group_info);
49 kfree(cred->cr_raw_principal); 51 kfree(cred->cr_raw_principal);
50 kfree(cred->cr_principal); 52 kfree(cred->cr_principal);
53 kfree(cred->cr_targ_princ);
51 gss_mech_put(cred->cr_gss_mech); 54 gss_mech_put(cred->cr_gss_mech);
52 init_svc_cred(cred); 55 init_svc_cred(cred);
53} 56}
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 440b62f7502e..5a28ac9284f0 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -414,7 +414,7 @@ static inline bool hibernation_available(void) { return false; }
414#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ 414#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */
415#define PM_POST_RESTORE 0x0006 /* Restore failed */ 415#define PM_POST_RESTORE 0x0006 /* Restore failed */
416 416
417extern struct mutex pm_mutex; 417extern struct mutex system_transition_mutex;
418 418
419#ifdef CONFIG_PM_SLEEP 419#ifdef CONFIG_PM_SLEEP
420void save_processor_state(void); 420void save_processor_state(void);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index c063443d8638..8e2c11e692ba 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -447,7 +447,7 @@ extern void si_swapinfo(struct sysinfo *);
447extern swp_entry_t get_swap_page(struct page *page); 447extern swp_entry_t get_swap_page(struct page *page);
448extern void put_swap_page(struct page *page, swp_entry_t entry); 448extern void put_swap_page(struct page *page, swp_entry_t entry);
449extern swp_entry_t get_swap_page_of_type(int); 449extern swp_entry_t get_swap_page_of_type(int);
450extern int get_swap_pages(int n, bool cluster, swp_entry_t swp_entries[]); 450extern int get_swap_pages(int n, swp_entry_t swp_entries[], int entry_size);
451extern int add_swap_count_continuation(swp_entry_t, gfp_t); 451extern int add_swap_count_continuation(swp_entry_t, gfp_t);
452extern void swap_shmem_alloc(swp_entry_t); 452extern void swap_shmem_alloc(swp_entry_t);
453extern int swap_duplicate(swp_entry_t); 453extern int swap_duplicate(swp_entry_t);
@@ -629,7 +629,6 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
629 629
630 return memcg->swappiness; 630 return memcg->swappiness;
631} 631}
632
633#else 632#else
634static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) 633static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
635{ 634{
@@ -637,6 +636,16 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
637} 636}
638#endif 637#endif
639 638
639#if defined(CONFIG_SWAP) && defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
640extern void mem_cgroup_throttle_swaprate(struct mem_cgroup *memcg, int node,
641 gfp_t gfp_mask);
642#else
643static inline void mem_cgroup_throttle_swaprate(struct mem_cgroup *memcg,
644 int node, gfp_t gfp_mask)
645{
646}
647#endif
648
640#ifdef CONFIG_MEMCG_SWAP 649#ifdef CONFIG_MEMCG_SWAP
641extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry); 650extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry);
642extern int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry); 651extern int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry);
diff --git a/include/linux/swapfile.h b/include/linux/swapfile.h
index 06bd7b096167..e06febf62978 100644
--- a/include/linux/swapfile.h
+++ b/include/linux/swapfile.h
@@ -10,5 +10,7 @@ extern spinlock_t swap_lock;
10extern struct plist_head swap_active_head; 10extern struct plist_head swap_active_head;
11extern struct swap_info_struct *swap_info[]; 11extern struct swap_info_struct *swap_info[];
12extern int try_to_unuse(unsigned int, bool, unsigned long); 12extern int try_to_unuse(unsigned int, bool, unsigned long);
13extern unsigned long generic_max_swapfile_size(void);
14extern unsigned long max_swapfile_size(void);
13 15
14#endif /* _LINUX_SWAPFILE_H */ 16#endif /* _LINUX_SWAPFILE_H */
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 1d3877c39a00..22af9d8a84ae 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -4,6 +4,7 @@
4 4
5#include <linux/radix-tree.h> 5#include <linux/radix-tree.h>
6#include <linux/bug.h> 6#include <linux/bug.h>
7#include <linux/mm_types.h>
7 8
8/* 9/*
9 * swapcache pages are stored in the swapper_space radix tree. We want to 10 * swapcache pages are stored in the swapper_space radix tree. We want to
@@ -134,7 +135,7 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry)
134 return pfn_to_page(swp_offset(entry)); 135 return pfn_to_page(swp_offset(entry));
135} 136}
136 137
137int device_private_entry_fault(struct vm_area_struct *vma, 138vm_fault_t device_private_entry_fault(struct vm_area_struct *vma,
138 unsigned long addr, 139 unsigned long addr,
139 swp_entry_t entry, 140 swp_entry_t entry,
140 unsigned int flags, 141 unsigned int flags,
@@ -169,7 +170,7 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry)
169 return NULL; 170 return NULL;
170} 171}
171 172
172static inline int device_private_entry_fault(struct vm_area_struct *vma, 173static inline vm_fault_t device_private_entry_fault(struct vm_area_struct *vma,
173 unsigned long addr, 174 unsigned long addr,
174 swp_entry_t entry, 175 swp_entry_t entry,
175 unsigned int flags, 176 unsigned int flags,
@@ -340,11 +341,6 @@ static inline int is_hwpoison_entry(swp_entry_t entry)
340 return swp_type(entry) == SWP_HWPOISON; 341 return swp_type(entry) == SWP_HWPOISON;
341} 342}
342 343
343static inline bool test_set_page_hwpoison(struct page *page)
344{
345 return TestSetPageHWPoison(page);
346}
347
348static inline void num_poisoned_pages_inc(void) 344static inline void num_poisoned_pages_inc(void)
349{ 345{
350 atomic_long_inc(&num_poisoned_pages); 346 atomic_long_inc(&num_poisoned_pages);
@@ -367,11 +363,6 @@ static inline int is_hwpoison_entry(swp_entry_t swp)
367 return 0; 363 return 0;
368} 364}
369 365
370static inline bool test_set_page_hwpoison(struct page *page)
371{
372 return false;
373}
374
375static inline void num_poisoned_pages_inc(void) 366static inline void num_poisoned_pages_inc(void)
376{ 367{
377} 368}
diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h
index ec93e93371fa..ab400af6f0ce 100644
--- a/include/linux/switchtec.h
+++ b/include/linux/switchtec.h
@@ -19,10 +19,6 @@
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/cdev.h> 20#include <linux/cdev.h>
21 21
22#define MICROSEMI_VENDOR_ID 0x11f8
23#define MICROSEMI_NTB_CLASSCODE 0x068000
24#define MICROSEMI_MGMT_CLASSCODE 0x058000
25
26#define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024 22#define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024
27#define SWITCHTEC_MAX_PFF_CSR 48 23#define SWITCHTEC_MAX_PFF_CSR 48
28 24
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index ebb2f24027e8..2ff814c92f7f 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -81,6 +81,7 @@ union bpf_attr;
81#include <linux/unistd.h> 81#include <linux/unistd.h>
82#include <linux/quota.h> 82#include <linux/quota.h>
83#include <linux/key.h> 83#include <linux/key.h>
84#include <linux/personality.h>
84#include <trace/syscall.h> 85#include <trace/syscall.h>
85 86
86#ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER 87#ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
@@ -1282,4 +1283,14 @@ static inline long ksys_truncate(const char __user *pathname, loff_t length)
1282 return do_sys_truncate(pathname, length); 1283 return do_sys_truncate(pathname, length);
1283} 1284}
1284 1285
1286static inline unsigned int ksys_personality(unsigned int personality)
1287{
1288 unsigned int old = current->personality;
1289
1290 if (personality != 0xffffffff)
1291 set_personality(personality);
1292
1293 return old;
1294}
1295
1285#endif 1296#endif
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index b8bfdc173ec0..987cefa337de 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -91,9 +91,9 @@ struct attribute_group {
91 struct bin_attribute **bin_attrs; 91 struct bin_attribute **bin_attrs;
92}; 92};
93 93
94/** 94/*
95 * Use these macros to make defining attributes easier. See include/linux/device.h 95 * Use these macros to make defining attributes easier.
96 * for examples.. 96 * See include/linux/device.h for examples..
97 */ 97 */
98 98
99#define SYSFS_PREALLOC 010000 99#define SYSFS_PREALLOC 010000
@@ -237,6 +237,9 @@ int __must_check sysfs_create_files(struct kobject *kobj,
237 const struct attribute **attr); 237 const struct attribute **attr);
238int __must_check sysfs_chmod_file(struct kobject *kobj, 238int __must_check sysfs_chmod_file(struct kobject *kobj,
239 const struct attribute *attr, umode_t mode); 239 const struct attribute *attr, umode_t mode);
240struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj,
241 const struct attribute *attr);
242void sysfs_unbreak_active_protection(struct kernfs_node *kn);
240void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, 243void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
241 const void *ns); 244 const void *ns);
242bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr); 245bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
@@ -350,6 +353,17 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
350 return 0; 353 return 0;
351} 354}
352 355
356static inline struct kernfs_node *
357sysfs_break_active_protection(struct kobject *kobj,
358 const struct attribute *attr)
359{
360 return NULL;
361}
362
363static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn)
364{
365}
366
353static inline void sysfs_remove_file_ns(struct kobject *kobj, 367static inline void sysfs_remove_file_ns(struct kobject *kobj,
354 const struct attribute *attr, 368 const struct attribute *attr,
355 const void *ns) 369 const void *ns)
diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h
index c6aa8a3c42ed..b9626aa7e90c 100644
--- a/include/linux/t10-pi.h
+++ b/include/linux/t10-pi.h
@@ -37,9 +37,33 @@ struct t10_pi_tuple {
37#define T10_PI_APP_ESCAPE cpu_to_be16(0xffff) 37#define T10_PI_APP_ESCAPE cpu_to_be16(0xffff)
38#define T10_PI_REF_ESCAPE cpu_to_be32(0xffffffff) 38#define T10_PI_REF_ESCAPE cpu_to_be32(0xffffffff)
39 39
40static inline u32 t10_pi_ref_tag(struct request *rq)
41{
42#ifdef CONFIG_BLK_DEV_INTEGRITY
43 return blk_rq_pos(rq) >>
44 (rq->q->integrity.interval_exp - 9) & 0xffffffff;
45#else
46 return -1U;
47#endif
48}
49
40extern const struct blk_integrity_profile t10_pi_type1_crc; 50extern const struct blk_integrity_profile t10_pi_type1_crc;
41extern const struct blk_integrity_profile t10_pi_type1_ip; 51extern const struct blk_integrity_profile t10_pi_type1_ip;
42extern const struct blk_integrity_profile t10_pi_type3_crc; 52extern const struct blk_integrity_profile t10_pi_type3_crc;
43extern const struct blk_integrity_profile t10_pi_type3_ip; 53extern const struct blk_integrity_profile t10_pi_type3_ip;
44 54
55#ifdef CONFIG_BLK_DEV_INTEGRITY
56extern void t10_pi_prepare(struct request *rq, u8 protection_type);
57extern void t10_pi_complete(struct request *rq, u8 protection_type,
58 unsigned int intervals);
59#else
60static inline void t10_pi_complete(struct request *rq, u8 protection_type,
61 unsigned int intervals)
62{
63}
64static inline void t10_pi_prepare(struct request *rq, u8 protection_type)
65{
66}
67#endif
68
45#endif 69#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 72705eaf4b84..263e37271afd 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -89,7 +89,7 @@ struct tcp_sack_block {
89 89
90struct tcp_options_received { 90struct tcp_options_received {
91/* PAWS/RTTM data */ 91/* PAWS/RTTM data */
92 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ 92 int ts_recent_stamp;/* Time we stored ts_recent (for aging) */
93 u32 ts_recent; /* Time stamp to echo next */ 93 u32 ts_recent; /* Time stamp to echo next */
94 u32 rcv_tsval; /* Time stamp value */ 94 u32 rcv_tsval; /* Time stamp value */
95 u32 rcv_tsecr; /* Time stamp echo reply */ 95 u32 rcv_tsecr; /* Time stamp echo reply */
@@ -181,10 +181,16 @@ struct tcp_sock {
181 u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut 181 u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut
182 * total number of data segments sent. 182 * total number of data segments sent.
183 */ 183 */
184 u64 bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut
185 * total number of data bytes sent.
186 */
184 u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked 187 u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked
185 * sum(delta(snd_una)), or how many bytes 188 * sum(delta(snd_una)), or how many bytes
186 * were acked. 189 * were acked.
187 */ 190 */
191 u32 dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups
192 * total number of DSACK blocks received
193 */
188 u32 snd_una; /* First byte we want an ack for */ 194 u32 snd_una; /* First byte we want an ack for */
189 u32 snd_sml; /* Last byte of the most recently transmitted small packet */ 195 u32 snd_sml; /* Last byte of the most recently transmitted small packet */
190 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ 196 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
@@ -214,8 +220,7 @@ struct tcp_sock {
214#define TCP_RACK_RECOVERY_THRESH 16 220#define TCP_RACK_RECOVERY_THRESH 16
215 u8 reo_wnd_persist:5, /* No. of recovery since last adj */ 221 u8 reo_wnd_persist:5, /* No. of recovery since last adj */
216 dsack_seen:1, /* Whether DSACK seen after last adj */ 222 dsack_seen:1, /* Whether DSACK seen after last adj */
217 advanced:1, /* mstamp advanced since last lost marking */ 223 advanced:1; /* mstamp advanced since last lost marking */
218 reord:1; /* reordering detected */
219 } rack; 224 } rack;
220 u16 advmss; /* Advertised MSS */ 225 u16 advmss; /* Advertised MSS */
221 u8 compressed_ack; 226 u8 compressed_ack;
@@ -261,6 +266,7 @@ struct tcp_sock {
261 u8 ecn_flags; /* ECN status bits. */ 266 u8 ecn_flags; /* ECN status bits. */
262 u8 keepalive_probes; /* num of allowed keep alive probes */ 267 u8 keepalive_probes; /* num of allowed keep alive probes */
263 u32 reordering; /* Packet reordering metric. */ 268 u32 reordering; /* Packet reordering metric. */
269 u32 reord_seen; /* number of data packet reordering events */
264 u32 snd_up; /* Urgent pointer */ 270 u32 snd_up; /* Urgent pointer */
265 271
266/* 272/*
@@ -330,6 +336,9 @@ struct tcp_sock {
330 * the first SYN. */ 336 * the first SYN. */
331 u32 undo_marker; /* snd_una upon a new recovery episode. */ 337 u32 undo_marker; /* snd_una upon a new recovery episode. */
332 int undo_retrans; /* number of undoable retransmissions. */ 338 int undo_retrans; /* number of undoable retransmissions. */
339 u64 bytes_retrans; /* RFC4898 tcpEStatsPerfOctetsRetrans
340 * Total data bytes retransmitted
341 */
333 u32 total_retrans; /* Total retransmits for entire connection */ 342 u32 total_retrans; /* Total retransmits for entire connection */
334 343
335 u32 urg_seq; /* Seq of received urgent pointer */ 344 u32 urg_seq; /* Seq of received urgent pointer */
@@ -350,6 +359,7 @@ struct tcp_sock {
350#endif 359#endif
351 360
352/* Receiver side RTT estimation */ 361/* Receiver side RTT estimation */
362 u32 rcv_rtt_last_tsecr;
353 struct { 363 struct {
354 u32 rtt_us; 364 u32 rtt_us;
355 u32 seq; 365 u32 seq;
@@ -425,7 +435,7 @@ struct tcp_timewait_sock {
425 /* The time we sent the last out-of-window ACK: */ 435 /* The time we sent the last out-of-window ACK: */
426 u32 tw_last_oow_ack_time; 436 u32 tw_last_oow_ack_time;
427 437
428 long tw_ts_recent_stamp; 438 int tw_ts_recent_stamp;
429#ifdef CONFIG_TCP_MD5SIG 439#ifdef CONFIG_TCP_MD5SIG
430 struct tcp_md5sig_key *tw_md5_key; 440 struct tcp_md5sig_key *tw_md5_key;
431#endif 441#endif
diff --git a/include/linux/time32.h b/include/linux/time32.h
index 0b14f936100a..d1ae43c13e25 100644
--- a/include/linux/time32.h
+++ b/include/linux/time32.h
@@ -207,4 +207,19 @@ static inline s64 timeval_to_ns(const struct timeval *tv)
207extern struct timeval ns_to_timeval(const s64 nsec); 207extern struct timeval ns_to_timeval(const s64 nsec);
208extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec); 208extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec);
209 209
210/*
211 * New aliases for compat time functions. These will be used to replace
212 * the compat code so it can be shared between 32-bit and 64-bit builds
213 * both of which provide compatibility with old 32-bit tasks.
214 */
215#define old_time32_t compat_time_t
216#define old_timeval32 compat_timeval
217#define old_timespec32 compat_timespec
218#define old_itimerspec32 compat_itimerspec
219#define ns_to_old_timeval32 ns_to_compat_timeval
220#define get_old_itimerspec32 get_compat_itimerspec64
221#define put_old_itimerspec32 put_compat_itimerspec64
222#define get_old_timespec32 compat_get_timespec64
223#define put_old_timespec32 compat_put_timespec64
224
210#endif 225#endif
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index e79861418fd7..a5a3cfc3c2fa 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -21,6 +21,21 @@ extern int do_sys_settimeofday64(const struct timespec64 *tv,
21 const struct timezone *tz); 21 const struct timezone *tz);
22 22
23/* 23/*
24 * ktime_get() family: read the current time in a multitude of ways,
25 *
26 * The default time reference is CLOCK_MONOTONIC, starting at
27 * boot time but not counting the time spent in suspend.
28 * For other references, use the functions with "real", "clocktai",
29 * "boottime" and "raw" suffixes.
30 *
31 * To get the time in a different format, use the ones wit
32 * "ns", "ts64" and "seconds" suffix.
33 *
34 * See Documentation/core-api/timekeeping.rst for more details.
35 */
36
37
38/*
24 * timespec64 based interfaces 39 * timespec64 based interfaces
25 */ 40 */
26extern void ktime_get_raw_ts64(struct timespec64 *ts); 41extern void ktime_get_raw_ts64(struct timespec64 *ts);
@@ -243,8 +258,8 @@ extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot);
243extern int persistent_clock_is_local; 258extern int persistent_clock_is_local;
244 259
245extern void read_persistent_clock64(struct timespec64 *ts); 260extern void read_persistent_clock64(struct timespec64 *ts);
246void read_persistent_clock_and_boot_offset(struct timespec64 *wall_clock, 261void read_persistent_wall_and_boot_offset(struct timespec64 *wall_clock,
247 struct timespec64 *boot_offset); 262 struct timespec64 *boot_offset);
248extern int update_persistent_clock64(struct timespec64 now); 263extern int update_persistent_clock64(struct timespec64 now);
249 264
250/* 265/*
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index 06639fb6ab85..4609b94142d4 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -43,6 +43,8 @@ struct tpm_class_ops {
43 u8 (*status) (struct tpm_chip *chip); 43 u8 (*status) (struct tpm_chip *chip);
44 bool (*update_timeouts)(struct tpm_chip *chip, 44 bool (*update_timeouts)(struct tpm_chip *chip,
45 unsigned long *timeout_cap); 45 unsigned long *timeout_cap);
46 int (*go_idle)(struct tpm_chip *chip);
47 int (*cmd_ready)(struct tpm_chip *chip);
46 int (*request_locality)(struct tpm_chip *chip, int loc); 48 int (*request_locality)(struct tpm_chip *chip, int loc);
47 int (*relinquish_locality)(struct tpm_chip *chip, int loc); 49 int (*relinquish_locality)(struct tpm_chip *chip, int loc);
48 void (*clk_enable)(struct tpm_chip *chip, bool value); 50 void (*clk_enable)(struct tpm_chip *chip, bool value);
@@ -61,6 +63,7 @@ extern int tpm_seal_trusted(struct tpm_chip *chip,
61extern int tpm_unseal_trusted(struct tpm_chip *chip, 63extern int tpm_unseal_trusted(struct tpm_chip *chip,
62 struct trusted_key_payload *payload, 64 struct trusted_key_payload *payload,
63 struct trusted_key_options *options); 65 struct trusted_key_options *options);
66extern struct tpm_chip *tpm_default_chip(void);
64#else 67#else
65static inline int tpm_is_tpm2(struct tpm_chip *chip) 68static inline int tpm_is_tpm2(struct tpm_chip *chip)
66{ 69{
@@ -96,5 +99,9 @@ static inline int tpm_unseal_trusted(struct tpm_chip *chip,
96{ 99{
97 return -ENODEV; 100 return -ENODEV;
98} 101}
102static inline struct tpm_chip *tpm_default_chip(void)
103{
104 return NULL;
105}
99#endif 106#endif
100#endif 107#endif
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 4a8841963c2e..05589a3e37f4 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -51,6 +51,7 @@
51#include <linux/security.h> 51#include <linux/security.h>
52#include <linux/task_work.h> 52#include <linux/task_work.h>
53#include <linux/memcontrol.h> 53#include <linux/memcontrol.h>
54#include <linux/blk-cgroup.h>
54struct linux_binprm; 55struct linux_binprm;
55 56
56/* 57/*
@@ -192,6 +193,7 @@ static inline void tracehook_notify_resume(struct pt_regs *regs)
192 task_work_run(); 193 task_work_run();
193 194
194 mem_cgroup_handle_over_high(); 195 mem_cgroup_handle_over_high();
196 blkcg_maybe_throttle_current();
195} 197}
196 198
197#endif /* <linux/tracehook.h> */ 199#endif /* <linux/tracehook.h> */
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 19a690b559ca..041f7e56a289 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/srcu.h>
18#include <linux/errno.h> 19#include <linux/errno.h>
19#include <linux/types.h> 20#include <linux/types.h>
20#include <linux/cpumask.h> 21#include <linux/cpumask.h>
@@ -33,6 +34,8 @@ struct trace_eval_map {
33 34
34#define TRACEPOINT_DEFAULT_PRIO 10 35#define TRACEPOINT_DEFAULT_PRIO 10
35 36
37extern struct srcu_struct tracepoint_srcu;
38
36extern int 39extern int
37tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); 40tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data);
38extern int 41extern int
@@ -75,10 +78,16 @@ int unregister_tracepoint_module_notifier(struct notifier_block *nb)
75 * probe unregistration and the end of module exit to make sure there is no 78 * probe unregistration and the end of module exit to make sure there is no
76 * caller executing a probe when it is freed. 79 * caller executing a probe when it is freed.
77 */ 80 */
81#ifdef CONFIG_TRACEPOINTS
78static inline void tracepoint_synchronize_unregister(void) 82static inline void tracepoint_synchronize_unregister(void)
79{ 83{
84 synchronize_srcu(&tracepoint_srcu);
80 synchronize_sched(); 85 synchronize_sched();
81} 86}
87#else
88static inline void tracepoint_synchronize_unregister(void)
89{ }
90#endif
82 91
83#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS 92#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
84extern int syscall_regfunc(void); 93extern int syscall_regfunc(void);
@@ -129,18 +138,33 @@ extern void syscall_unregfunc(void);
129 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just 138 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
130 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". 139 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
131 */ 140 */
132#define __DO_TRACE(tp, proto, args, cond, rcucheck) \ 141#define __DO_TRACE(tp, proto, args, cond, rcuidle) \
133 do { \ 142 do { \
134 struct tracepoint_func *it_func_ptr; \ 143 struct tracepoint_func *it_func_ptr; \
135 void *it_func; \ 144 void *it_func; \
136 void *__data; \ 145 void *__data; \
146 int __maybe_unused idx = 0; \
137 \ 147 \
138 if (!(cond)) \ 148 if (!(cond)) \
139 return; \ 149 return; \
140 if (rcucheck) \ 150 \
151 /* srcu can't be used from NMI */ \
152 WARN_ON_ONCE(rcuidle && in_nmi()); \
153 \
154 /* keep srcu and sched-rcu usage consistent */ \
155 preempt_disable_notrace(); \
156 \
157 /* \
158 * For rcuidle callers, use srcu since sched-rcu \
159 * doesn't work from the idle path. \
160 */ \
161 if (rcuidle) { \
162 idx = srcu_read_lock_notrace(&tracepoint_srcu); \
141 rcu_irq_enter_irqson(); \ 163 rcu_irq_enter_irqson(); \
142 rcu_read_lock_sched_notrace(); \ 164 } \
143 it_func_ptr = rcu_dereference_sched((tp)->funcs); \ 165 \
166 it_func_ptr = rcu_dereference_raw((tp)->funcs); \
167 \
144 if (it_func_ptr) { \ 168 if (it_func_ptr) { \
145 do { \ 169 do { \
146 it_func = (it_func_ptr)->func; \ 170 it_func = (it_func_ptr)->func; \
@@ -148,9 +172,13 @@ extern void syscall_unregfunc(void);
148 ((void(*)(proto))(it_func))(args); \ 172 ((void(*)(proto))(it_func))(args); \
149 } while ((++it_func_ptr)->func); \ 173 } while ((++it_func_ptr)->func); \
150 } \ 174 } \
151 rcu_read_unlock_sched_notrace(); \ 175 \
152 if (rcucheck) \ 176 if (rcuidle) { \
153 rcu_irq_exit_irqson(); \ 177 rcu_irq_exit_irqson(); \
178 srcu_read_unlock_notrace(&tracepoint_srcu, idx);\
179 } \
180 \
181 preempt_enable_notrace(); \
154 } while (0) 182 } while (0)
155 183
156#ifndef MODULE 184#ifndef MODULE
@@ -225,6 +253,19 @@ extern void syscall_unregfunc(void);
225 return static_key_false(&__tracepoint_##name.key); \ 253 return static_key_false(&__tracepoint_##name.key); \
226 } 254 }
227 255
256#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
257#define __TRACEPOINT_ENTRY(name) \
258 asm(" .section \"__tracepoints_ptrs\", \"a\" \n" \
259 " .balign 4 \n" \
260 " .long __tracepoint_" #name " - . \n" \
261 " .previous \n")
262#else
263#define __TRACEPOINT_ENTRY(name) \
264 static struct tracepoint * const __tracepoint_ptr_##name __used \
265 __attribute__((section("__tracepoints_ptrs"))) = \
266 &__tracepoint_##name
267#endif
268
228/* 269/*
229 * We have no guarantee that gcc and the linker won't up-align the tracepoint 270 * We have no guarantee that gcc and the linker won't up-align the tracepoint
230 * structures, so we create an array of pointers that will be used for iteration 271 * structures, so we create an array of pointers that will be used for iteration
@@ -234,11 +275,9 @@ extern void syscall_unregfunc(void);
234 static const char __tpstrtab_##name[] \ 275 static const char __tpstrtab_##name[] \
235 __attribute__((section("__tracepoints_strings"))) = #name; \ 276 __attribute__((section("__tracepoints_strings"))) = #name; \
236 struct tracepoint __tracepoint_##name \ 277 struct tracepoint __tracepoint_##name \
237 __attribute__((section("__tracepoints"))) = \ 278 __attribute__((section("__tracepoints"), used)) = \
238 { __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\ 279 { __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\
239 static struct tracepoint * const __tracepoint_ptr_##name __used \ 280 __TRACEPOINT_ENTRY(name);
240 __attribute__((section("__tracepoints_ptrs"))) = \
241 &__tracepoint_##name;
242 281
243#define DEFINE_TRACE(name) \ 282#define DEFINE_TRACE(name) \
244 DEFINE_TRACE_FN(name, NULL, NULL); 283 DEFINE_TRACE_FN(name, NULL, NULL);
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 1ef64d4ad887..840894ca3fc0 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -119,13 +119,13 @@
119 119
120#include <linux/fs.h> 120#include <linux/fs.h>
121#include <linux/wait.h> 121#include <linux/wait.h>
122 122#include <linux/atomic.h>
123 123
124/* 124/*
125 * the semaphore definition 125 * the semaphore definition
126 */ 126 */
127struct ld_semaphore { 127struct ld_semaphore {
128 long count; 128 atomic_long_t count;
129 raw_spinlock_t wait_lock; 129 raw_spinlock_t wait_lock;
130 unsigned int wait_readers; 130 unsigned int wait_readers;
131 struct list_head read_wait; 131 struct list_head read_wait;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index ca840345571b..320d49d85484 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -74,8 +74,8 @@ struct udp_sock {
74 void (*encap_destroy)(struct sock *sk); 74 void (*encap_destroy)(struct sock *sk);
75 75
76 /* GRO functions for UDP socket */ 76 /* GRO functions for UDP socket */
77 struct sk_buff ** (*gro_receive)(struct sock *sk, 77 struct sk_buff * (*gro_receive)(struct sock *sk,
78 struct sk_buff **head, 78 struct list_head *head,
79 struct sk_buff *skb); 79 struct sk_buff *skb);
80 int (*gro_complete)(struct sock *sk, 80 int (*gro_complete)(struct sock *sk,
81 struct sk_buff *skb, 81 struct sk_buff *skb,
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 0a294e950df8..bb9d2084af03 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -121,7 +121,7 @@ extern bool is_swbp_insn(uprobe_opcode_t *insn);
121extern bool is_trap_insn(uprobe_opcode_t *insn); 121extern bool is_trap_insn(uprobe_opcode_t *insn);
122extern unsigned long uprobe_get_swbp_addr(struct pt_regs *regs); 122extern unsigned long uprobe_get_swbp_addr(struct pt_regs *regs);
123extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs); 123extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs);
124extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 124extern int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
125extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 125extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
126extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 126extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
127extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 127extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
diff --git a/include/linux/usb/audio-v3.h b/include/linux/usb/audio-v3.h
index a710e28b5215..6b708434b7f9 100644
--- a/include/linux/usb/audio-v3.h
+++ b/include/linux/usb/audio-v3.h
@@ -387,6 +387,12 @@ struct uac3_interrupt_data_msg {
387#define UAC3_CONNECTORS 0x0f 387#define UAC3_CONNECTORS 0x0f
388#define UAC3_POWER_DOMAIN 0x10 388#define UAC3_POWER_DOMAIN 0x10
389 389
390/* A.20 PROCESSING UNIT PROCESS TYPES */
391#define UAC3_PROCESS_UNDEFINED 0x00
392#define UAC3_PROCESS_UP_DOWNMIX 0x01
393#define UAC3_PROCESS_STEREO_EXTENDER 0x02
394#define UAC3_PROCESS_MULTI_FUNCTION 0x03
395
390/* A.22 AUDIO CLASS-SPECIFIC REQUEST CODES */ 396/* A.22 AUDIO CLASS-SPECIFIC REQUEST CODES */
391/* see audio-v2.h for the rest, which is identical to v2 */ 397/* see audio-v2.h for the rest, which is identical to v2 */
392#define UAC3_CS_REQ_INTEN 0x04 398#define UAC3_CS_REQ_INTEN 0x04
@@ -406,6 +412,15 @@ struct uac3_interrupt_data_msg {
406#define UAC3_TE_OVERFLOW 0x04 412#define UAC3_TE_OVERFLOW 0x04
407#define UAC3_TE_LATENCY 0x05 413#define UAC3_TE_LATENCY 0x05
408 414
415/* A.23.10 PROCESSING UNITS CONTROL SELECTROS */
416
417/* Up/Down Mixer */
418#define UAC3_UD_MODE_SELECT 0x01
419
420/* Stereo Extender */
421#define UAC3_EXT_WIDTH_CONTROL 0x01
422
423
409/* BADD predefined Unit/Terminal values */ 424/* BADD predefined Unit/Terminal values */
410#define UAC3_BADD_IT_ID1 1 /* Input Terminal ID1: bTerminalID = 1 */ 425#define UAC3_BADD_IT_ID1 1 /* Input Terminal ID1: bTerminalID = 1 */
411#define UAC3_BADD_FU_ID2 2 /* Feature Unit ID2: bUnitID = 2 */ 426#define UAC3_BADD_FU_ID2 2 /* Feature Unit ID2: bUnitID = 2 */
@@ -432,4 +447,8 @@ struct uac3_interrupt_data_msg {
432/* BADD sample rate is always fixed to 48kHz */ 447/* BADD sample rate is always fixed to 48kHz */
433#define UAC3_BADD_SAMPLING_RATE 48000 448#define UAC3_BADD_SAMPLING_RATE 48000
434 449
450/* BADD power domains recovery times in 50us increments */
451#define UAC3_BADD_PD_RECOVER_D1D0 0x0258 /* 30ms */
452#define UAC3_BADD_PD_RECOVER_D2D0 0x1770 /* 300ms */
453
435#endif /* __LINUX_USB_AUDIO_V3_H */ 454#endif /* __LINUX_USB_AUDIO_V3_H */
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 34a6ded6f319..97e2ddec18b1 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -322,6 +322,7 @@ struct hc_driver {
322 int (*bus_suspend)(struct usb_hcd *); 322 int (*bus_suspend)(struct usb_hcd *);
323 int (*bus_resume)(struct usb_hcd *); 323 int (*bus_resume)(struct usb_hcd *);
324 int (*start_port_reset)(struct usb_hcd *, unsigned port_num); 324 int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
325 unsigned long (*get_resuming_ports)(struct usb_hcd *);
325 326
326 /* force handover of high-speed port to full-speed companion */ 327 /* force handover of high-speed port to full-speed companion */
327 void (*relinquish_port)(struct usb_hcd *, int); 328 void (*relinquish_port)(struct usb_hcd *, int);
diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
index 09b570feb297..f2162e0fe531 100644
--- a/include/linux/usb/pd.h
+++ b/include/linux/usb/pd.h
@@ -15,6 +15,7 @@
15#ifndef __LINUX_USB_PD_H 15#ifndef __LINUX_USB_PD_H
16#define __LINUX_USB_PD_H 16#define __LINUX_USB_PD_H
17 17
18#include <linux/kernel.h>
18#include <linux/types.h> 19#include <linux/types.h>
19#include <linux/usb/typec.h> 20#include <linux/usb/typec.h>
20 21
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index b231b9314240..7e7fbfb84e8e 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -98,18 +98,10 @@ struct tcpc_config {
98#define TCPC_MUX_DP_ENABLED BIT(1) /* DP enabled */ 98#define TCPC_MUX_DP_ENABLED BIT(1) /* DP enabled */
99#define TCPC_MUX_POLARITY_INVERTED BIT(2) /* Polarity inverted */ 99#define TCPC_MUX_POLARITY_INVERTED BIT(2) /* Polarity inverted */
100 100
101/* Mux modes, decoded to attributes */
102enum tcpc_mux_mode {
103 TYPEC_MUX_NONE = 0, /* Open switch */
104 TYPEC_MUX_USB = TCPC_MUX_USB_ENABLED, /* USB only */
105 TYPEC_MUX_DP = TCPC_MUX_DP_ENABLED, /* DP only */
106 TYPEC_MUX_DOCK = TCPC_MUX_USB_ENABLED | /* Both USB and DP */
107 TCPC_MUX_DP_ENABLED,
108};
109
110/** 101/**
111 * struct tcpc_dev - Port configuration and callback functions 102 * struct tcpc_dev - Port configuration and callback functions
112 * @config: Pointer to port configuration 103 * @config: Pointer to port configuration
104 * @fwnode: Pointer to port fwnode
113 * @get_vbus: Called to read current VBUS state 105 * @get_vbus: Called to read current VBUS state
114 * @get_current_limit: 106 * @get_current_limit:
115 * Optional; called by the tcpm core when configured as a snk 107 * Optional; called by the tcpm core when configured as a snk
@@ -138,6 +130,7 @@ enum tcpc_mux_mode {
138 */ 130 */
139struct tcpc_dev { 131struct tcpc_dev {
140 const struct tcpc_config *config; 132 const struct tcpc_config *config;
133 struct fwnode_handle *fwnode;
141 134
142 int (*init)(struct tcpc_dev *dev); 135 int (*init)(struct tcpc_dev *dev);
143 int (*get_vbus)(struct tcpc_dev *dev); 136 int (*get_vbus)(struct tcpc_dev *dev);
diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h
index 672b39bb0adc..7df4ecabc78a 100644
--- a/include/linux/usb/typec.h
+++ b/include/linux/usb/typec.h
@@ -5,21 +5,18 @@
5 5
6#include <linux/types.h> 6#include <linux/types.h>
7 7
8/* XXX: Once we have a header for USB Power Delivery, this belongs there */
9#define ALTMODE_MAX_MODES 6
10
11/* USB Type-C Specification releases */ 8/* USB Type-C Specification releases */
12#define USB_TYPEC_REV_1_0 0x100 /* 1.0 */ 9#define USB_TYPEC_REV_1_0 0x100 /* 1.0 */
13#define USB_TYPEC_REV_1_1 0x110 /* 1.1 */ 10#define USB_TYPEC_REV_1_1 0x110 /* 1.1 */
14#define USB_TYPEC_REV_1_2 0x120 /* 1.2 */ 11#define USB_TYPEC_REV_1_2 0x120 /* 1.2 */
15 12
16struct typec_altmode;
17struct typec_partner; 13struct typec_partner;
18struct typec_cable; 14struct typec_cable;
19struct typec_plug; 15struct typec_plug;
20struct typec_port; 16struct typec_port;
21 17
22struct fwnode_handle; 18struct fwnode_handle;
19struct device;
23 20
24enum typec_port_type { 21enum typec_port_type {
25 TYPEC_PORT_SRC, 22 TYPEC_PORT_SRC,
@@ -93,39 +90,21 @@ int typec_partner_set_identity(struct typec_partner *partner);
93int typec_cable_set_identity(struct typec_cable *cable); 90int typec_cable_set_identity(struct typec_cable *cable);
94 91
95/* 92/*
96 * struct typec_mode_desc - Individual Mode of an Alternate Mode
97 * @index: Index of the Mode within the SVID
98 * @vdo: VDO returned by Discover Modes USB PD command
99 * @desc: Optional human readable description of the mode
100 * @roles: Only for ports. DRP if the mode is available in both roles
101 *
102 * Description of a mode of an Alternate Mode which a connector, cable plug or
103 * partner supports. Every mode will have it's own sysfs group. The details are
104 * the VDO returned by discover modes command, description for the mode and
105 * active flag telling has the mode being entered or not.
106 */
107struct typec_mode_desc {
108 int index;
109 u32 vdo;
110 char *desc;
111 /* Only used with ports */
112 enum typec_port_type roles;
113};
114
115/*
116 * struct typec_altmode_desc - USB Type-C Alternate Mode Descriptor 93 * struct typec_altmode_desc - USB Type-C Alternate Mode Descriptor
117 * @svid: Standard or Vendor ID 94 * @svid: Standard or Vendor ID
118 * @n_modes: Number of modes 95 * @mode: Index of the Mode
119 * @modes: Array of modes supported by the Alternate Mode 96 * @vdo: VDO returned by Discover Modes USB PD command
97 * @roles: Only for ports. DRP if the mode is available in both roles
120 * 98 *
121 * Representation of an Alternate Mode that has SVID assigned by USB-IF. The 99 * Description of an Alternate Mode which a connector, cable plug or partner
122 * array of modes will list the modes of a particular SVID that are supported by 100 * supports.
123 * a connector, partner of a cable plug.
124 */ 101 */
125struct typec_altmode_desc { 102struct typec_altmode_desc {
126 u16 svid; 103 u16 svid;
127 int n_modes; 104 u8 mode;
128 struct typec_mode_desc modes[ALTMODE_MAX_MODES]; 105 u32 vdo;
106 /* Only used with ports */
107 enum typec_port_data roles;
129}; 108};
130 109
131struct typec_altmode 110struct typec_altmode
@@ -141,8 +120,7 @@ void typec_unregister_altmode(struct typec_altmode *altmode);
141 120
142struct typec_port *typec_altmode2port(struct typec_altmode *alt); 121struct typec_port *typec_altmode2port(struct typec_altmode *alt);
143 122
144void typec_altmode_update_active(struct typec_altmode *alt, int mode, 123void typec_altmode_update_active(struct typec_altmode *alt, bool active);
145 bool active);
146 124
147enum typec_plug_index { 125enum typec_plug_index {
148 TYPEC_PLUG_SOP_P, 126 TYPEC_PLUG_SOP_P,
@@ -205,7 +183,6 @@ struct typec_partner_desc {
205 * @dr_set: Set Data Role 183 * @dr_set: Set Data Role
206 * @pr_set: Set Power Role 184 * @pr_set: Set Power Role
207 * @vconn_set: Set VCONN Role 185 * @vconn_set: Set VCONN Role
208 * @activate_mode: Enter/exit given Alternate Mode
209 * @port_type_set: Set port type 186 * @port_type_set: Set port type
210 * 187 *
211 * Static capabilities of a single USB Type-C port. 188 * Static capabilities of a single USB Type-C port.
@@ -231,12 +208,8 @@ struct typec_capability {
231 enum typec_role); 208 enum typec_role);
232 int (*vconn_set)(const struct typec_capability *, 209 int (*vconn_set)(const struct typec_capability *,
233 enum typec_role); 210 enum typec_role);
234
235 int (*activate_mode)(const struct typec_capability *,
236 int mode, int activate);
237 int (*port_type_set)(const struct typec_capability *, 211 int (*port_type_set)(const struct typec_capability *,
238 enum typec_port_type); 212 enum typec_port_type);
239
240}; 213};
241 214
242/* Specific to try_role(). Indicates the user want's to clear the preference. */ 215/* Specific to try_role(). Indicates the user want's to clear the preference. */
@@ -265,6 +238,10 @@ void typec_set_pwr_opmode(struct typec_port *port, enum typec_pwr_opmode mode);
265 238
266int typec_set_orientation(struct typec_port *port, 239int typec_set_orientation(struct typec_port *port,
267 enum typec_orientation orientation); 240 enum typec_orientation orientation);
241enum typec_orientation typec_get_orientation(struct typec_port *port);
268int typec_set_mode(struct typec_port *port, int mode); 242int typec_set_mode(struct typec_port *port, int mode);
269 243
244int typec_find_port_power_role(const char *name);
245int typec_find_power_role(const char *name);
246int typec_find_port_data_role(const char *name);
270#endif /* __LINUX_USB_TYPEC_H */ 247#endif /* __LINUX_USB_TYPEC_H */
diff --git a/include/linux/usb/typec_altmode.h b/include/linux/usb/typec_altmode.h
new file mode 100644
index 000000000000..9a88c74a1d0d
--- /dev/null
+++ b/include/linux/usb/typec_altmode.h
@@ -0,0 +1,160 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef __USB_TYPEC_ALTMODE_H
4#define __USB_TYPEC_ALTMODE_H
5
6#include <linux/mod_devicetable.h>
7#include <linux/usb/typec.h>
8#include <linux/device.h>
9
10#define MODE_DISCOVERY_MAX 6
11
12struct typec_altmode_ops;
13
14/**
15 * struct typec_altmode - USB Type-C alternate mode device
16 * @dev: Driver model's view of this device
17 * @svid: Standard or Vendor ID (SVID) of the alternate mode
18 * @mode: Index of the Mode
19 * @vdo: VDO returned by Discover Modes USB PD command
20 * @active: Tells has the mode been entered or not
21 * @desc: Optional human readable description of the mode
22 * @ops: Operations vector from the driver
23 */
24struct typec_altmode {
25 struct device dev;
26 u16 svid;
27 int mode;
28 u32 vdo;
29 unsigned int active:1;
30
31 char *desc;
32 const struct typec_altmode_ops *ops;
33};
34
35#define to_typec_altmode(d) container_of(d, struct typec_altmode, dev)
36
37static inline void typec_altmode_set_drvdata(struct typec_altmode *altmode,
38 void *data)
39{
40 dev_set_drvdata(&altmode->dev, data);
41}
42
43static inline void *typec_altmode_get_drvdata(struct typec_altmode *altmode)
44{
45 return dev_get_drvdata(&altmode->dev);
46}
47
48/**
49 * struct typec_altmode_ops - Alternate mode specific operations vector
50 * @enter: Operations to be executed with Enter Mode Command
51 * @exit: Operations to be executed with Exit Mode Command
52 * @attention: Callback for Attention Command
53 * @vdm: Callback for SVID specific commands
54 * @notify: Communication channel for platform and the alternate mode
55 * @activate: User callback for Enter/Exit Mode
56 */
57struct typec_altmode_ops {
58 int (*enter)(struct typec_altmode *altmode);
59 int (*exit)(struct typec_altmode *altmode);
60 void (*attention)(struct typec_altmode *altmode, u32 vdo);
61 int (*vdm)(struct typec_altmode *altmode, const u32 hdr,
62 const u32 *vdo, int cnt);
63 int (*notify)(struct typec_altmode *altmode, unsigned long conf,
64 void *data);
65 int (*activate)(struct typec_altmode *altmode, int activate);
66};
67
68int typec_altmode_enter(struct typec_altmode *altmode);
69int typec_altmode_exit(struct typec_altmode *altmode);
70void typec_altmode_attention(struct typec_altmode *altmode, u32 vdo);
71int typec_altmode_vdm(struct typec_altmode *altmode,
72 const u32 header, const u32 *vdo, int count);
73int typec_altmode_notify(struct typec_altmode *altmode, unsigned long conf,
74 void *data);
75const struct typec_altmode *
76typec_altmode_get_partner(struct typec_altmode *altmode);
77
78/*
79 * These are the connector states (USB, Safe and Alt Mode) defined in USB Type-C
80 * Specification. SVID specific connector states are expected to follow and
81 * start from the value TYPEC_STATE_MODAL.
82 */
83enum {
84 TYPEC_STATE_SAFE, /* USB Safe State */
85 TYPEC_STATE_USB, /* USB Operation */
86 TYPEC_STATE_MODAL, /* Alternate Modes */
87};
88
89/*
90 * For the muxes there is no difference between Accessory Modes and Alternate
91 * Modes, so the Accessory Modes are supplied with specific modal state values
92 * here. Unlike with Alternate Modes, where the mux will be linked with the
93 * alternate mode device, the mux for Accessory Modes will be linked with the
94 * port device instead.
95 *
96 * Port drivers can use TYPEC_MODE_AUDIO and TYPEC_MODE_DEBUG as the mode
97 * value for typec_set_mode() when accessory modes are supported.
98 */
99enum {
100 TYPEC_MODE_AUDIO = TYPEC_STATE_MODAL, /* Audio Accessory */
101 TYPEC_MODE_DEBUG, /* Debug Accessory */
102};
103
104#define TYPEC_MODAL_STATE(_state_) ((_state_) + TYPEC_STATE_MODAL)
105
106struct typec_altmode *typec_altmode_get_plug(struct typec_altmode *altmode,
107 enum typec_plug_index index);
108void typec_altmode_put_plug(struct typec_altmode *plug);
109
110struct typec_altmode *typec_match_altmode(struct typec_altmode **altmodes,
111 size_t n, u16 svid, u8 mode);
112
113struct typec_altmode *
114typec_altmode_register_notifier(struct device *dev, u16 svid, u8 mode,
115 struct notifier_block *nb);
116
117void typec_altmode_unregister_notifier(struct typec_altmode *adev,
118 struct notifier_block *nb);
119
120/**
121 * typec_altmode_get_orientation - Get cable plug orientation
122 * altmode: Handle to the alternate mode
123 */
124static inline enum typec_orientation
125typec_altmode_get_orientation(struct typec_altmode *altmode)
126{
127 return typec_get_orientation(typec_altmode2port(altmode));
128}
129
130/**
131 * struct typec_altmode_driver - USB Type-C alternate mode device driver
132 * @id_table: Null terminated array of SVIDs
133 * @probe: Callback for device binding
134 * @remove: Callback for device unbinding
135 * @driver: Device driver model driver
136 *
137 * These drivers will be bind to the partner alternate mode devices. They will
138 * handle all SVID specific communication.
139 */
140struct typec_altmode_driver {
141 const struct typec_device_id *id_table;
142 int (*probe)(struct typec_altmode *altmode);
143 void (*remove)(struct typec_altmode *altmode);
144 struct device_driver driver;
145};
146
147#define to_altmode_driver(d) container_of(d, struct typec_altmode_driver, \
148 driver)
149
150#define typec_altmode_register_driver(drv) \
151 __typec_altmode_register_driver(drv, THIS_MODULE)
152int __typec_altmode_register_driver(struct typec_altmode_driver *drv,
153 struct module *module);
154void typec_altmode_unregister_driver(struct typec_altmode_driver *drv);
155
156#define module_typec_altmode_driver(__typec_altmode_driver) \
157 module_driver(__typec_altmode_driver, typec_altmode_register_driver, \
158 typec_altmode_unregister_driver)
159
160#endif /* __USB_TYPEC_ALTMODE_H */
diff --git a/include/linux/usb/typec_dp.h b/include/linux/usb/typec_dp.h
new file mode 100644
index 000000000000..55ae781d60a9
--- /dev/null
+++ b/include/linux/usb/typec_dp.h
@@ -0,0 +1,95 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __USB_TYPEC_DP_H
3#define __USB_TYPEC_DP_H
4
5#include <linux/usb/typec_altmode.h>
6
7#define USB_TYPEC_DP_SID 0xff01
8#define USB_TYPEC_DP_MODE 1
9
10/*
11 * Connector states matching the pin assignments in DisplayPort Alt Mode
12 * Specification.
13 *
14 * These values are meant primarily to be used by the mux drivers, but they are
15 * also used as the "value" part in the alternate mode notification chain, so
16 * receivers of those notifications will always see them.
17 *
18 * Note. DisplayPort USB Type-C Alt Mode Specification version 1.0b deprecated
19 * pin assignments A, B and F, but they are still defined here for legacy
20 * purposes.
21 */
22enum {
23 TYPEC_DP_STATE_A = TYPEC_STATE_MODAL, /* Not supported after v1.0b */
24 TYPEC_DP_STATE_B, /* Not supported after v1.0b */
25 TYPEC_DP_STATE_C,
26 TYPEC_DP_STATE_D,
27 TYPEC_DP_STATE_E,
28 TYPEC_DP_STATE_F, /* Not supported after v1.0b */
29};
30
31/*
32 * struct typec_displayport_data - DisplayPort Alt Mode specific data
33 * @status: Status Update command VDO content
34 * @conf: Configure command VDO content
35 *
36 * This structure is delivered as the data part with the notifications. It
37 * contains the VDOs from the two DisplayPort Type-C alternate mode specific
38 * commands: Status Update and Configure.
39 *
40 * @status will show for example the status of the HPD signal.
41 */
42struct typec_displayport_data {
43 u32 status;
44 u32 conf;
45};
46
47enum {
48 DP_PIN_ASSIGN_A, /* Not supported after v1.0b */
49 DP_PIN_ASSIGN_B, /* Not supported after v1.0b */
50 DP_PIN_ASSIGN_C,
51 DP_PIN_ASSIGN_D,
52 DP_PIN_ASSIGN_E,
53 DP_PIN_ASSIGN_F, /* Not supported after v1.0b */
54};
55
56/* DisplayPort alt mode specific commands */
57#define DP_CMD_STATUS_UPDATE VDO_CMD_VENDOR(0)
58#define DP_CMD_CONFIGURE VDO_CMD_VENDOR(1)
59
60/* DisplayPort Capabilities VDO bits (returned with Discover Modes) */
61#define DP_CAP_CAPABILITY(_cap_) ((_cap_) & 3)
62#define DP_CAP_UFP_D 1
63#define DP_CAP_DFP_D 2
64#define DP_CAP_DFP_D_AND_UFP_D 3
65#define DP_CAP_DP_SIGNALING BIT(2) /* Always set */
66#define DP_CAP_GEN2 BIT(3) /* Reserved after v1.0b */
67#define DP_CAP_RECEPTACLE BIT(6)
68#define DP_CAP_USB BIT(7)
69#define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8)
70#define DP_CAP_UFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(23, 16)) >> 16)
71
72/* DisplayPort Status Update VDO bits */
73#define DP_STATUS_CONNECTION(_status_) ((_status_) & 3)
74#define DP_STATUS_CON_DISABLED 0
75#define DP_STATUS_CON_DFP_D 1
76#define DP_STATUS_CON_UFP_D 2
77#define DP_STATUS_CON_BOTH 3
78#define DP_STATUS_POWER_LOW BIT(2)
79#define DP_STATUS_ENABLED BIT(3)
80#define DP_STATUS_PREFER_MULTI_FUNC BIT(4)
81#define DP_STATUS_SWITCH_TO_USB BIT(5)
82#define DP_STATUS_EXIT_DP_MODE BIT(6)
83#define DP_STATUS_HPD_STATE BIT(7) /* 0 = HPD_Low, 1 = HPD_High */
84#define DP_STATUS_IRQ_HPD BIT(8)
85
86/* DisplayPort Configurations VDO bits */
87#define DP_CONF_CURRENTLY(_conf_) ((_conf_) & 3)
88#define DP_CONF_UFP_U_AS_DFP_D BIT(0)
89#define DP_CONF_UFP_U_AS_UFP_D BIT(1)
90#define DP_CONF_SIGNALING_DP BIT(2)
91#define DP_CONF_SIGNALING_GEN_2 BIT(3) /* Reserved after v1.0b */
92#define DP_CONF_PIN_ASSIGNEMENT_SHIFT 8
93#define DP_CONF_PIN_ASSIGNEMENT_MASK GENMASK(15, 8)
94
95#endif /* __USB_TYPEC_DP_H */
diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h
index 12c1b057834b..79293f630ee1 100644
--- a/include/linux/usb/typec_mux.h
+++ b/include/linux/usb/typec_mux.h
@@ -47,7 +47,7 @@ void typec_switch_put(struct typec_switch *sw);
47int typec_switch_register(struct typec_switch *sw); 47int typec_switch_register(struct typec_switch *sw);
48void typec_switch_unregister(struct typec_switch *sw); 48void typec_switch_unregister(struct typec_switch *sw);
49 49
50struct typec_mux *typec_mux_get(struct device *dev); 50struct typec_mux *typec_mux_get(struct device *dev, const char *name);
51void typec_mux_put(struct typec_mux *mux); 51void typec_mux_put(struct typec_mux *mux);
52int typec_mux_register(struct typec_mux *mux); 52int typec_mux_register(struct typec_mux *mux);
53void typec_mux_unregister(struct typec_mux *mux); 53void typec_mux_unregister(struct typec_mux *mux);
diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h
index e091f0a11b11..37c9eba75c98 100644
--- a/include/linux/userfaultfd_k.h
+++ b/include/linux/userfaultfd_k.h
@@ -28,7 +28,7 @@
28#define UFFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK) 28#define UFFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
29#define UFFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS) 29#define UFFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS)
30 30
31extern int handle_userfault(struct vm_fault *vmf, unsigned long reason); 31extern vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason);
32 32
33extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start, 33extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start,
34 unsigned long src_start, unsigned long len, 34 unsigned long src_start, unsigned long len,
@@ -77,7 +77,8 @@ extern void userfaultfd_unmap_complete(struct mm_struct *mm,
77#else /* CONFIG_USERFAULTFD */ 77#else /* CONFIG_USERFAULTFD */
78 78
79/* mm helpers */ 79/* mm helpers */
80static inline int handle_userfault(struct vm_fault *vmf, unsigned long reason) 80static inline vm_fault_t handle_userfault(struct vm_fault *vmf,
81 unsigned long reason)
81{ 82{
82 return VM_FAULT_SIGBUS; 83 return VM_FAULT_SIGBUS;
83} 84}
diff --git a/include/linux/verification.h b/include/linux/verification.h
index a10549a6c7cd..cfa4730d607a 100644
--- a/include/linux/verification.h
+++ b/include/linux/verification.h
@@ -13,6 +13,12 @@
13#define _LINUX_VERIFICATION_H 13#define _LINUX_VERIFICATION_H
14 14
15/* 15/*
16 * Indicate that both builtin trusted keys and secondary trusted keys
17 * should be used.
18 */
19#define VERIFY_USE_SECONDARY_KEYRING ((struct key *)1UL)
20
21/*
16 * The use to which an asymmetric key is being put. 22 * The use to which an asymmetric key is being put.
17 */ 23 */
18enum key_being_used_for { 24enum key_being_used_for {
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 77f0f0af3a71..a34539b7f750 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -84,8 +84,8 @@ enum vga_switcheroo_state {
84 * Client identifier. Audio clients use the same identifier & 0x100. 84 * Client identifier. Audio clients use the same identifier & 0x100.
85 */ 85 */
86enum vga_switcheroo_client_id { 86enum vga_switcheroo_client_id {
87 VGA_SWITCHEROO_UNKNOWN_ID = -1, 87 VGA_SWITCHEROO_UNKNOWN_ID = 0x1000,
88 VGA_SWITCHEROO_IGD, 88 VGA_SWITCHEROO_IGD = 0,
89 VGA_SWITCHEROO_DIS, 89 VGA_SWITCHEROO_DIS,
90 VGA_SWITCHEROO_MAX_CLIENTS, 90 VGA_SWITCHEROO_MAX_CLIENTS,
91}; 91};
@@ -151,7 +151,7 @@ int vga_switcheroo_register_client(struct pci_dev *dev,
151 bool driver_power_control); 151 bool driver_power_control);
152int vga_switcheroo_register_audio_client(struct pci_dev *pdev, 152int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
153 const struct vga_switcheroo_client_ops *ops, 153 const struct vga_switcheroo_client_ops *ops,
154 enum vga_switcheroo_client_id id); 154 struct pci_dev *vga_dev);
155 155
156void vga_switcheroo_client_fb_set(struct pci_dev *dev, 156void vga_switcheroo_client_fb_set(struct pci_dev *dev,
157 struct fb_info *info); 157 struct fb_info *info);
@@ -180,7 +180,7 @@ static inline int vga_switcheroo_register_handler(const struct vga_switcheroo_ha
180 enum vga_switcheroo_handler_flags_t handler_flags) { return 0; } 180 enum vga_switcheroo_handler_flags_t handler_flags) { return 0; }
181static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, 181static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
182 const struct vga_switcheroo_client_ops *ops, 182 const struct vga_switcheroo_client_ops *ops,
183 enum vga_switcheroo_client_id id) { return 0; } 183 struct pci_dev *vga_dev) { return 0; }
184static inline void vga_switcheroo_unregister_handler(void) {} 184static inline void vga_switcheroo_unregister_handler(void) {}
185static inline enum vga_switcheroo_handler_flags_t vga_switcheroo_handler_flags(void) { return 0; } 185static inline enum vga_switcheroo_handler_flags_t vga_switcheroo_handler_flags(void) { return 0; }
186static inline int vga_switcheroo_lock_ddc(struct pci_dev *pdev) { return -ENODEV; } 186static inline int vga_switcheroo_lock_ddc(struct pci_dev *pdev) { return -ENODEV; }
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 5559a2d31c46..32baf8e26735 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -79,7 +79,8 @@ struct virtio_config_ops {
79 u64 (*get_features)(struct virtio_device *vdev); 79 u64 (*get_features)(struct virtio_device *vdev);
80 int (*finalize_features)(struct virtio_device *vdev); 80 int (*finalize_features)(struct virtio_device *vdev);
81 const char *(*bus_name)(struct virtio_device *vdev); 81 const char *(*bus_name)(struct virtio_device *vdev);
82 int (*set_vq_affinity)(struct virtqueue *vq, int cpu); 82 int (*set_vq_affinity)(struct virtqueue *vq,
83 const struct cpumask *cpu_mask);
83 const struct cpumask *(*get_vq_affinity)(struct virtio_device *vdev, 84 const struct cpumask *(*get_vq_affinity)(struct virtio_device *vdev,
84 int index); 85 int index);
85}; 86};
@@ -236,11 +237,11 @@ const char *virtio_bus_name(struct virtio_device *vdev)
236 * 237 *
237 */ 238 */
238static inline 239static inline
239int virtqueue_set_affinity(struct virtqueue *vq, int cpu) 240int virtqueue_set_affinity(struct virtqueue *vq, const struct cpumask *cpu_mask)
240{ 241{
241 struct virtio_device *vdev = vq->vdev; 242 struct virtio_device *vdev = vq->vdev;
242 if (vdev->config->set_vq_affinity) 243 if (vdev->config->set_vq_affinity)
243 return vdev->config->set_vq_affinity(vq, cpu); 244 return vdev->config->set_vq_affinity(vq, cpu_mask);
244 return 0; 245 return 0;
245} 246}
246 247
diff --git a/include/linux/vmacache.h b/include/linux/vmacache.h
index a5b3aa8d281f..3e9a963edd6a 100644
--- a/include/linux/vmacache.h
+++ b/include/linux/vmacache.h
@@ -5,12 +5,6 @@
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
7 7
8/*
9 * Hash based on the page number. Provides a good hit rate for
10 * workloads with good locality and those with random accesses as well.
11 */
12#define VMACACHE_HASH(addr) ((addr >> PAGE_SHIFT) & VMACACHE_MASK)
13
14static inline void vmacache_flush(struct task_struct *tsk) 8static inline void vmacache_flush(struct task_struct *tsk)
15{ 9{
16 memset(tsk->vmacache.vmas, 0, sizeof(tsk->vmacache.vmas)); 10 memset(tsk->vmacache.vmas, 0, sizeof(tsk->vmacache.vmas));
diff --git a/include/linux/w1.h b/include/linux/w1.h
index 694101f744c7..3111585c371f 100644
--- a/include/linux/w1.h
+++ b/include/linux/w1.h
@@ -274,6 +274,8 @@ struct w1_family {
274 274
275 struct w1_family_ops *fops; 275 struct w1_family_ops *fops;
276 276
277 const struct of_device_id *of_match_table;
278
277 atomic_t refcnt; 279 atomic_t refcnt;
278}; 280};
279 281
diff --git a/include/linux/wkup_m3_ipc.h b/include/linux/wkup_m3_ipc.h
index d6ba7d39a62f..e497e621dbb7 100644
--- a/include/linux/wkup_m3_ipc.h
+++ b/include/linux/wkup_m3_ipc.h
@@ -40,6 +40,12 @@ struct wkup_m3_ipc {
40 struct mbox_chan *mbox; 40 struct mbox_chan *mbox;
41 41
42 struct wkup_m3_ipc_ops *ops; 42 struct wkup_m3_ipc_ops *ops;
43 int is_rtc_only;
44};
45
46struct wkup_m3_wakeup_src {
47 int irq_nr;
48 char src[10];
43}; 49};
44 50
45struct wkup_m3_ipc_ops { 51struct wkup_m3_ipc_ops {
@@ -48,8 +54,11 @@ struct wkup_m3_ipc_ops {
48 int (*prepare_low_power)(struct wkup_m3_ipc *m3_ipc, int state); 54 int (*prepare_low_power)(struct wkup_m3_ipc *m3_ipc, int state);
49 int (*finish_low_power)(struct wkup_m3_ipc *m3_ipc); 55 int (*finish_low_power)(struct wkup_m3_ipc *m3_ipc);
50 int (*request_pm_status)(struct wkup_m3_ipc *m3_ipc); 56 int (*request_pm_status)(struct wkup_m3_ipc *m3_ipc);
57 const char *(*request_wake_src)(struct wkup_m3_ipc *m3_ipc);
58 void (*set_rtc_only)(struct wkup_m3_ipc *m3_ipc);
51}; 59};
52 60
53struct wkup_m3_ipc *wkup_m3_ipc_get(void); 61struct wkup_m3_ipc *wkup_m3_ipc_get(void);
54void wkup_m3_ipc_put(struct wkup_m3_ipc *m3_ipc); 62void wkup_m3_ipc_put(struct wkup_m3_ipc *m3_ipc);
63void wkup_m3_set_rtc_only_mode(void);
55#endif /* _LINUX_WKUP_M3_IPC_H */ 64#endif /* _LINUX_WKUP_M3_IPC_H */
diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
index 39fda195bf78..3af7c0e03be5 100644
--- a/include/linux/ww_mutex.h
+++ b/include/linux/ww_mutex.h
@@ -6,8 +6,10 @@
6 * 6 *
7 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 7 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
8 * 8 *
9 * Wound/wait implementation: 9 * Wait/Die implementation:
10 * Copyright (C) 2013 Canonical Ltd. 10 * Copyright (C) 2013 Canonical Ltd.
11 * Choice of algorithm:
12 * Copyright (C) 2018 WMWare Inc.
11 * 13 *
12 * This file contains the main data structure and API definitions. 14 * This file contains the main data structure and API definitions.
13 */ 15 */
@@ -23,14 +25,17 @@ struct ww_class {
23 struct lock_class_key mutex_key; 25 struct lock_class_key mutex_key;
24 const char *acquire_name; 26 const char *acquire_name;
25 const char *mutex_name; 27 const char *mutex_name;
28 unsigned int is_wait_die;
26}; 29};
27 30
28struct ww_acquire_ctx { 31struct ww_acquire_ctx {
29 struct task_struct *task; 32 struct task_struct *task;
30 unsigned long stamp; 33 unsigned long stamp;
31 unsigned acquired; 34 unsigned int acquired;
35 unsigned short wounded;
36 unsigned short is_wait_die;
32#ifdef CONFIG_DEBUG_MUTEXES 37#ifdef CONFIG_DEBUG_MUTEXES
33 unsigned done_acquire; 38 unsigned int done_acquire;
34 struct ww_class *ww_class; 39 struct ww_class *ww_class;
35 struct ww_mutex *contending_lock; 40 struct ww_mutex *contending_lock;
36#endif 41#endif
@@ -38,8 +43,8 @@ struct ww_acquire_ctx {
38 struct lockdep_map dep_map; 43 struct lockdep_map dep_map;
39#endif 44#endif
40#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH 45#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
41 unsigned deadlock_inject_interval; 46 unsigned int deadlock_inject_interval;
42 unsigned deadlock_inject_countdown; 47 unsigned int deadlock_inject_countdown;
43#endif 48#endif
44}; 49};
45 50
@@ -58,17 +63,21 @@ struct ww_mutex {
58# define __WW_CLASS_MUTEX_INITIALIZER(lockname, class) 63# define __WW_CLASS_MUTEX_INITIALIZER(lockname, class)
59#endif 64#endif
60 65
61#define __WW_CLASS_INITIALIZER(ww_class) \ 66#define __WW_CLASS_INITIALIZER(ww_class, _is_wait_die) \
62 { .stamp = ATOMIC_LONG_INIT(0) \ 67 { .stamp = ATOMIC_LONG_INIT(0) \
63 , .acquire_name = #ww_class "_acquire" \ 68 , .acquire_name = #ww_class "_acquire" \
64 , .mutex_name = #ww_class "_mutex" } 69 , .mutex_name = #ww_class "_mutex" \
70 , .is_wait_die = _is_wait_die }
65 71
66#define __WW_MUTEX_INITIALIZER(lockname, class) \ 72#define __WW_MUTEX_INITIALIZER(lockname, class) \
67 { .base = __MUTEX_INITIALIZER(lockname.base) \ 73 { .base = __MUTEX_INITIALIZER(lockname.base) \
68 __WW_CLASS_MUTEX_INITIALIZER(lockname, class) } 74 __WW_CLASS_MUTEX_INITIALIZER(lockname, class) }
69 75
76#define DEFINE_WD_CLASS(classname) \
77 struct ww_class classname = __WW_CLASS_INITIALIZER(classname, 1)
78
70#define DEFINE_WW_CLASS(classname) \ 79#define DEFINE_WW_CLASS(classname) \
71 struct ww_class classname = __WW_CLASS_INITIALIZER(classname) 80 struct ww_class classname = __WW_CLASS_INITIALIZER(classname, 0)
72 81
73#define DEFINE_WW_MUTEX(mutexname, ww_class) \ 82#define DEFINE_WW_MUTEX(mutexname, ww_class) \
74 struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class) 83 struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class)
@@ -102,7 +111,7 @@ static inline void ww_mutex_init(struct ww_mutex *lock,
102 * 111 *
103 * Context-based w/w mutex acquiring can be done in any order whatsoever within 112 * Context-based w/w mutex acquiring can be done in any order whatsoever within
104 * a given lock class. Deadlocks will be detected and handled with the 113 * a given lock class. Deadlocks will be detected and handled with the
105 * wait/wound logic. 114 * wait/die logic.
106 * 115 *
107 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can 116 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can
108 * result in undetected deadlocks and is so forbidden. Mixing different contexts 117 * result in undetected deadlocks and is so forbidden. Mixing different contexts
@@ -123,6 +132,8 @@ static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
123 ctx->task = current; 132 ctx->task = current;
124 ctx->stamp = atomic_long_inc_return_relaxed(&ww_class->stamp); 133 ctx->stamp = atomic_long_inc_return_relaxed(&ww_class->stamp);
125 ctx->acquired = 0; 134 ctx->acquired = 0;
135 ctx->wounded = false;
136 ctx->is_wait_die = ww_class->is_wait_die;
126#ifdef CONFIG_DEBUG_MUTEXES 137#ifdef CONFIG_DEBUG_MUTEXES
127 ctx->ww_class = ww_class; 138 ctx->ww_class = ww_class;
128 ctx->done_acquire = 0; 139 ctx->done_acquire = 0;
@@ -195,13 +206,13 @@ static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
195 * Lock the w/w mutex exclusively for this task. 206 * Lock the w/w mutex exclusively for this task.
196 * 207 *
197 * Deadlocks within a given w/w class of locks are detected and handled with the 208 * Deadlocks within a given w/w class of locks are detected and handled with the
198 * wait/wound algorithm. If the lock isn't immediately avaiable this function 209 * wait/die algorithm. If the lock isn't immediately available this function
199 * will either sleep until it is (wait case). Or it selects the current context 210 * will either sleep until it is (wait case). Or it selects the current context
200 * for backing off by returning -EDEADLK (wound case). Trying to acquire the 211 * for backing off by returning -EDEADLK (die case). Trying to acquire the
201 * same lock with the same context twice is also detected and signalled by 212 * same lock with the same context twice is also detected and signalled by
202 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. 213 * returning -EALREADY. Returns 0 if the mutex was successfully acquired.
203 * 214 *
204 * In the wound case the caller must release all currently held w/w mutexes for 215 * In the die case the caller must release all currently held w/w mutexes for
205 * the given context and then wait for this contending lock to be available by 216 * the given context and then wait for this contending lock to be available by
206 * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this 217 * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this
207 * lock and proceed with trying to acquire further w/w mutexes (e.g. when 218 * lock and proceed with trying to acquire further w/w mutexes (e.g. when
@@ -226,14 +237,14 @@ extern int /* __must_check */ ww_mutex_lock(struct ww_mutex *lock, struct ww_acq
226 * Lock the w/w mutex exclusively for this task. 237 * Lock the w/w mutex exclusively for this task.
227 * 238 *
228 * Deadlocks within a given w/w class of locks are detected and handled with the 239 * Deadlocks within a given w/w class of locks are detected and handled with the
229 * wait/wound algorithm. If the lock isn't immediately avaiable this function 240 * wait/die algorithm. If the lock isn't immediately available this function
230 * will either sleep until it is (wait case). Or it selects the current context 241 * will either sleep until it is (wait case). Or it selects the current context
231 * for backing off by returning -EDEADLK (wound case). Trying to acquire the 242 * for backing off by returning -EDEADLK (die case). Trying to acquire the
232 * same lock with the same context twice is also detected and signalled by 243 * same lock with the same context twice is also detected and signalled by
233 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a 244 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a
234 * signal arrives while waiting for the lock then this function returns -EINTR. 245 * signal arrives while waiting for the lock then this function returns -EINTR.
235 * 246 *
236 * In the wound case the caller must release all currently held w/w mutexes for 247 * In the die case the caller must release all currently held w/w mutexes for
237 * the given context and then wait for this contending lock to be available by 248 * the given context and then wait for this contending lock to be available by
238 * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to 249 * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to
239 * not acquire this lock and proceed with trying to acquire further w/w mutexes 250 * not acquire this lock and proceed with trying to acquire further w/w mutexes
@@ -256,7 +267,7 @@ extern int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock,
256 * @lock: the mutex to be acquired 267 * @lock: the mutex to be acquired
257 * @ctx: w/w acquire context 268 * @ctx: w/w acquire context
258 * 269 *
259 * Acquires a w/w mutex with the given context after a wound case. This function 270 * Acquires a w/w mutex with the given context after a die case. This function
260 * will sleep until the lock becomes available. 271 * will sleep until the lock becomes available.
261 * 272 *
262 * The caller must have released all w/w mutexes already acquired with the 273 * The caller must have released all w/w mutexes already acquired with the
@@ -290,7 +301,7 @@ ww_mutex_lock_slow(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
290 * @lock: the mutex to be acquired 301 * @lock: the mutex to be acquired
291 * @ctx: w/w acquire context 302 * @ctx: w/w acquire context
292 * 303 *
293 * Acquires a w/w mutex with the given context after a wound case. This function 304 * Acquires a w/w mutex with the given context after a die case. This function
294 * will sleep until the lock becomes available and returns 0 when the lock has 305 * will sleep until the lock becomes available and returns 0 when the lock has
295 * been acquired. If a signal arrives while waiting for the lock then this 306 * been acquired. If a signal arrives while waiting for the lock then this
296 * function returns -EINTR. 307 * function returns -EINTR.