aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-05-29 22:54:21 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-05-29 22:54:21 -0400
commitd8f797c60661a90ee26ca9330cf85ede9aa2ec17 (patch)
tree5038609885fc3e4cb7f329d974875ac4411c6af5 /include/linux
parent8fd708157a592a376c4d0b3b2ba23b9e9f79caa5 (diff)
parent5ed02dbb497422bf225783f46e6eadd237d23d6b (diff)
Merge tag 'v4.12-rc3' into next
Sync with mainline to bring in changes in platform drovers dropping calls to sparse_keymap_free() so that we can remove it for good.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h72
-rw-r--r--include/linux/acpi_iort.h6
-rw-r--r--include/linux/amba/pl080.h50
-rw-r--r--include/linux/amba/pl330.h35
-rw-r--r--include/linux/amigaffs.h144
-rw-r--r--include/linux/ata.h5
-rw-r--r--include/linux/atmel_serial.h169
-rw-r--r--include/linux/atomic.h46
-rw-r--r--include/linux/audit.h7
-rw-r--r--include/linux/backing-dev-defs.h8
-rw-r--r--include/linux/backing-dev.h16
-rw-r--r--include/linux/bcma/bcma_driver_pci.h2
-rw-r--r--include/linux/bio.h13
-rw-r--r--include/linux/blk-mq.h31
-rw-r--r--include/linux/blk_types.h47
-rw-r--r--include/linux/blkdev.h130
-rw-r--r--include/linux/bpf.h36
-rw-r--r--include/linux/bpf_types.h36
-rw-r--r--include/linux/bpf_verifier.h9
-rw-r--r--include/linux/brcmphy.h3
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/bug.h2
-rw-r--r--include/linux/can/core.h11
-rw-r--r--include/linux/can/dev/peak_canfd.h308
-rw-r--r--include/linux/can/platform/ti_hecc.h44
-rw-r--r--include/linux/ccp.h68
-rw-r--r--include/linux/cdev.h5
-rw-r--r--include/linux/ceph/ceph_debug.h6
-rw-r--r--include/linux/ceph/ceph_features.h4
-rw-r--r--include/linux/ceph/ceph_fs.h14
-rw-r--r--include/linux/ceph/cls_lock_client.h5
-rw-r--r--include/linux/ceph/libceph.h8
-rw-r--r--include/linux/ceph/mdsmap.h7
-rw-r--r--include/linux/ceph/osd_client.h7
-rw-r--r--include/linux/ceph/pagelist.h6
-rw-r--r--include/linux/cgroup-defs.h12
-rw-r--r--include/linux/cgroup.h29
-rw-r--r--include/linux/clk.h4
-rw-r--r--include/linux/clk/tegra.h3
-rw-r--r--include/linux/clk/ti.h55
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/cma.h6
-rw-r--r--include/linux/coda_psdev.h1
-rw-r--r--include/linux/compat.h14
-rw-r--r--include/linux/console.h2
-rw-r--r--include/linux/coresight.h2
-rw-r--r--include/linux/cpufreq.h7
-rw-r--r--include/linux/cpuhotplug.h2
-rw-r--r--include/linux/cpumask.h14
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/crash_core.h69
-rw-r--r--include/linux/crypto.h2
-rw-r--r--include/linux/cryptohash.h5
-rw-r--r--include/linux/dax.h81
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/dell-led.h6
-rw-r--r--include/linux/devfreq.h30
-rw-r--r--include/linux/devfreq_cooling.h19
-rw-r--r--include/linux/device-mapper.h47
-rw-r--r--include/linux/dma-buf.h22
-rw-r--r--include/linux/dma-fence-array.h2
-rw-r--r--include/linux/dma-fence.h4
-rw-r--r--include/linux/dma-iommu.h6
-rw-r--r--include/linux/dma-mapping.h12
-rw-r--r--include/linux/dma_remapping.h1
-rw-r--r--include/linux/edac.h30
-rw-r--r--include/linux/efi-bgrt.h5
-rw-r--r--include/linux/efi.h5
-rw-r--r--include/linux/elevator.h14
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/etherdevice.h15
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/extcon.h21
-rw-r--r--include/linux/f2fs_fs.h17
-rw-r--r--include/linux/fcntl.h6
-rw-r--r--include/linux/filter.h30
-rw-r--r--include/linux/firmware/meson/meson_sm.h4
-rw-r--r--include/linux/flex_array.h67
-rw-r--r--include/linux/fpga/altera-pr-ip-core.h29
-rw-r--r--include/linux/fpga/fpga-mgr.h4
-rw-r--r--include/linux/fs.h29
-rw-r--r--include/linux/fscrypt_common.h11
-rw-r--r--include/linux/fscrypt_notsupp.h9
-rw-r--r--include/linux/fscrypt_supp.h74
-rw-r--r--include/linux/fsnotify_backend.h95
-rw-r--r--include/linux/ftrace.h94
-rw-r--r--include/linux/fwnode.h12
-rw-r--r--include/linux/genhd.h12
-rw-r--r--include/linux/gfp.h22
-rw-r--r--include/linux/gpio/consumer.h12
-rw-r--r--include/linux/gpio/driver.h6
-rw-r--r--include/linux/gpio/gpio-reg.h13
-rw-r--r--include/linux/hdmi.h1
-rw-r--r--include/linux/hid-sensor-hub.h2
-rw-r--r--include/linux/hid-sensor-ids.h8
-rw-r--r--include/linux/hid.h5
-rw-r--r--include/linux/hiddev.h12
-rw-r--r--include/linux/host1x.h1
-rw-r--r--include/linux/hrtimer.h6
-rw-r--r--include/linux/hwmon.h2
-rw-r--r--include/linux/hyperv.h127
-rw-r--r--include/linux/i2c.h10
-rw-r--r--include/linux/i2c/i2c-hid.h6
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/ieee80211.h77
-rw-r--r--include/linux/if_bridge.h1
-rw-r--r--include/linux/if_vlan.h18
-rw-r--r--include/linux/inet.h6
-rw-r--r--include/linux/inetdevice.h4
-rw-r--r--include/linux/init.h4
-rw-r--r--include/linux/init_task.h17
-rw-r--r--include/linux/intel-iommu.h18
-rw-r--r--include/linux/interrupt.h2
-rw-r--r--include/linux/io.h21
-rw-r--r--include/linux/iomap.h1
-rw-r--r--include/linux/iommu.h58
-rw-r--r--include/linux/iova.h91
-rw-r--r--include/linux/ipc.h7
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/linux/irqchip/arm-gic-v3.h14
-rw-r--r--include/linux/irqchip/arm-gic.h3
-rw-r--r--include/linux/irqchip/mips-gic.h1
-rw-r--r--include/linux/jbd2.h2
-rw-r--r--include/linux/jiffies.h11
-rw-r--r--include/linux/kbuild.h6
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/kexec.h57
-rw-r--r--include/linux/key-type.h8
-rw-r--r--include/linux/key.h39
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kprobes.h6
-rw-r--r--include/linux/kref.h6
-rw-r--r--include/linux/ksm.h5
-rw-r--r--include/linux/kvm_host.h92
-rw-r--r--include/linux/leds-pca9532.h4
-rw-r--r--include/linux/leds.h14
-rw-r--r--include/linux/libnvdimm.h8
-rw-r--r--include/linux/lightnvm.h13
-rw-r--r--include/linux/livepatch.h68
-rw-r--r--include/linux/lockd/bind.h24
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/lockdep.h3
-rw-r--r--include/linux/lsm_hooks.h34
-rw-r--r--include/linux/mailbox/brcm-message.h14
-rw-r--r--include/linux/memblock.h2
-rw-r--r--include/linux/memcontrol.h201
-rw-r--r--include/linux/mfd/arizona/pdata.h7
-rw-r--r--include/linux/mfd/axp20x.h44
-rw-r--r--include/linux/mfd/cros_ec.h21
-rw-r--r--include/linux/mfd/da9062/core.h29
-rw-r--r--include/linux/mfd/da9062/registers.h5
-rw-r--r--include/linux/mfd/intel_soc_pmic_bxtwc.h (renamed from include/linux/mfd/intel_bxtwc.h)4
-rw-r--r--include/linux/mfd/motorola-cpcap.h5
-rw-r--r--include/linux/mfd/mxs-lradc.h187
-rw-r--r--include/linux/mfd/stm32-timers.h2
-rw-r--r--include/linux/mfd/sun4i-gpadc.h6
-rw-r--r--include/linux/mfd/syscon/atmel-smc.h237
-rw-r--r--include/linux/mfd/syscon/exynos5-pmu.h33
-rw-r--r--include/linux/mfd/syscon/imx7-iomuxc-gpr.h4
-rw-r--r--include/linux/mfd/ti-lmu-register.h280
-rw-r--r--include/linux/mfd/ti-lmu.h87
-rw-r--r--include/linux/mfd/wm831x/core.h9
-rw-r--r--include/linux/mg_disk.h45
-rw-r--r--include/linux/migrate.h5
-rw-r--r--include/linux/mlx4/device.h5
-rw-r--r--include/linux/mlx5/device.h10
-rw-r--r--include/linux/mlx5/driver.h35
-rw-r--r--include/linux/mlx5/fs.h20
-rw-r--r--include/linux/mlx5/mlx5_ifc.h153
-rw-r--r--include/linux/mlx5/qp.h10
-rw-r--r--include/linux/mm.h41
-rw-r--r--include/linux/mm_types.h5
-rw-r--r--include/linux/mmc/card.h10
-rw-r--r--include/linux/mmc/host.h6
-rw-r--r--include/linux/mmc/sdio_func.h2
-rw-r--r--include/linux/mmu_notifier.h13
-rw-r--r--include/linux/mmzone.h12
-rw-r--r--include/linux/mod_devicetable.h10
-rw-r--r--include/linux/module.h12
-rw-r--r--include/linux/moduleparam.h65
-rw-r--r--include/linux/mpls.h5
-rw-r--r--include/linux/mtd/mtd.h7
-rw-r--r--include/linux/mtd/nand.h96
-rw-r--r--include/linux/namei.h1
-rw-r--r--include/linux/nd.h12
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdev_features.h8
-rw-r--r--include/linux/netdevice.h66
-rw-r--r--include/linux/netfilter/nfnetlink.h5
-rw-r--r--include/linux/netfilter/x_tables.h2
-rw-r--r--include/linux/netfilter_bridge/ebtables.h11
-rw-r--r--include/linux/netlink.h38
-rw-r--r--include/linux/nfs_fs.h17
-rw-r--r--include/linux/nfs_fs_sb.h2
-rw-r--r--include/linux/nfs_page.h5
-rw-r--r--include/linux/nfs_xdr.h3
-rw-r--r--include/linux/nvme-fc-driver.h114
-rw-r--r--include/linux/nvme-fc.h68
-rw-r--r--include/linux/nvme.h29
-rw-r--r--include/linux/of.h7
-rw-r--r--include/linux/of_device.h17
-rw-r--r--include/linux/of_fdt.h6
-rw-r--r--include/linux/of_gpio.h1
-rw-r--r--include/linux/of_mdio.h4
-rw-r--r--include/linux/of_pci.h11
-rw-r--r--include/linux/of_platform.h12
-rw-r--r--include/linux/page-isolation.h5
-rw-r--r--include/linux/pagemap.h4
-rw-r--r--include/linux/pci-ecam.h3
-rw-r--r--include/linux/pci-ep-cfs.h41
-rw-r--r--include/linux/pci-epc.h144
-rw-r--r--include/linux/pci-epf.h162
-rw-r--r--include/linux/pci.h122
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/pe.h177
-rw-r--r--include/linux/percpu-refcount.h1
-rw-r--r--include/linux/percpu.h1
-rw-r--r--include/linux/perf/arm_pmu.h29
-rw-r--r--include/linux/perf_event.h17
-rw-r--r--include/linux/phy.h109
-rw-r--r--include/linux/pinctrl/pinconf-generic.h3
-rw-r--r--include/linux/pinctrl/pinctrl.h3
-rw-r--r--include/linux/platform_data/iommu-omap.h20
-rw-r--r--include/linux/platform_data/isl9305.h2
-rw-r--r--include/linux/platform_data/itco_wdt.h4
-rw-r--r--include/linux/platform_data/pn544.h43
-rw-r--r--include/linux/platform_data/st21nfca.h33
-rw-r--r--include/linux/platform_data/video-imxfb.h1
-rw-r--r--include/linux/pm_domain.h2
-rw-r--r--include/linux/pm_wakeup.h25
-rw-r--r--include/linux/pmem.h23
-rw-r--r--include/linux/poll.h56
-rw-r--r--include/linux/posix-clock.h10
-rw-r--r--include/linux/posix-timers.h20
-rw-r--r--include/linux/power/bq24190_charger.h16
-rw-r--r--include/linux/power/max17042_battery.h9
-rw-r--r--include/linux/printk.h4
-rw-r--r--include/linux/proc_ns.h2
-rw-r--r--include/linux/property.h26
-rw-r--r--include/linux/pstore.h156
-rw-r--r--include/linux/ptr_ring.h63
-rw-r--r--include/linux/ptrace.h7
-rw-r--r--include/linux/qcom_scm.h6
-rw-r--r--include/linux/qed/common_hsi.h30
-rw-r--r--include/linux/qed/eth_common.h3
-rw-r--r--include/linux/qed/fcoe_common.h180
-rw-r--r--include/linux/qed/iscsi_common.h241
-rw-r--r--include/linux/qed/qed_eth_if.h32
-rw-r--r--include/linux/qed/qed_if.h64
-rw-r--r--include/linux/qed/qed_iscsi_if.h2
-rw-r--r--include/linux/qed/qed_roce_if.h2
-rw-r--r--include/linux/qed/rdma_common.h3
-rw-r--r--include/linux/qed/roce_common.h17
-rw-r--r--include/linux/qed/storage_common.h30
-rw-r--r--include/linux/qed/tcp_common.h1
-rw-r--r--include/linux/quotaops.h1
-rw-r--r--include/linux/ras.h13
-rw-r--r--include/linux/rcu_node_tree.h99
-rw-r--r--include/linux/rcu_segcblist.h90
-rw-r--r--include/linux/rculist.h3
-rw-r--r--include/linux/rcupdate.h22
-rw-r--r--include/linux/rcutiny.h24
-rw-r--r--include/linux/rcutree.h5
-rw-r--r--include/linux/refcount.h19
-rw-r--r--include/linux/regulator/arizona-ldo1.h24
-rw-r--r--include/linux/regulator/arizona-micsupp.h21
-rw-r--r--include/linux/regulator/consumer.h1
-rw-r--r--include/linux/regulator/driver.h18
-rw-r--r--include/linux/regulator/machine.h3
-rw-r--r--include/linux/regulator/pfuze100.h1
-rw-r--r--include/linux/reservation.h20
-rw-r--r--include/linux/reset.h22
-rw-r--r--include/linux/rhashtable.h68
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rmap.h47
-rw-r--r--include/linux/rodata_test.h1
-rw-r--r--include/linux/rpmsg/qcom_smd.h2
-rw-r--r--include/linux/sbitmap.h55
-rw-r--r--include/linux/sched.h31
-rw-r--r--include/linux/sched/mm.h38
-rw-r--r--include/linux/sched/rt.h23
-rw-r--r--include/linux/sched/signal.h1
-rw-r--r--include/linux/security.h20
-rw-r--r--include/linux/sem.h3
-rw-r--r--include/linux/serdev.h73
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/signal.h4
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/linux/slab.h6
-rw-r--r--include/linux/smp.h12
-rw-r--r--include/linux/soc/qcom/smd.h139
-rw-r--r--include/linux/soc/qcom/wcnss_ctrl.h11
-rw-r--r--include/linux/soc/renesas/rcar-rst.h5
-rw-r--r--include/linux/soc/samsung/exynos-regs-pmu.h16
-rw-r--r--include/linux/sock_diag.h1
-rw-r--r--include/linux/spi/spi.h10
-rw-r--r--include/linux/splice.h4
-rw-r--r--include/linux/srcu.h84
-rw-r--r--include/linux/srcuclassic.h115
-rw-r--r--include/linux/srcutiny.h93
-rw-r--r--include/linux/srcutree.h150
-rw-r--r--include/linux/stacktrace.h9
-rw-r--r--include/linux/stat.h1
-rw-r--r--include/linux/stmmac.h41
-rw-r--r--include/linux/string.h18
-rw-r--r--include/linux/sunrpc/rpc_rdma.h3
-rw-r--r--include/linux/sunrpc/svc.h4
-rw-r--r--include/linux/sunrpc/svc_rdma.h75
-rw-r--r--include/linux/suspend.h7
-rw-r--r--include/linux/swap.h5
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--include/linux/t10-pi.h8
-rw-r--r--include/linux/tcp.h14
-rw-r--r--include/linux/tee_drv.h277
-rw-r--r--include/linux/thread_info.h16
-rw-r--r--include/linux/tick.h1
-rw-r--r--include/linux/time.h3
-rw-r--r--include/linux/timekeeping.h20
-rw-r--r--include/linux/tpm.h3
-rw-r--r--include/linux/trace_events.h11
-rw-r--r--include/linux/tracepoint.h19
-rw-r--r--include/linux/tty.h22
-rw-r--r--include/linux/types.h2
-rw-r--r--include/linux/uaccess.h198
-rw-r--r--include/linux/udp.h2
-rw-r--r--include/linux/uio.h6
-rw-r--r--include/linux/uio_driver.h13
-rw-r--r--include/linux/usb.h73
-rw-r--r--include/linux/usb/composite.h6
-rw-r--r--include/linux/usb/gadget.h2
-rw-r--r--include/linux/usb/hcd.h8
-rw-r--r--include/linux/usb/of.h5
-rw-r--r--include/linux/usb/otg-fsm.h15
-rw-r--r--include/linux/usb/serial.h42
-rw-r--r--include/linux/usb/typec.h243
-rw-r--r--include/linux/usb/usbnet.h13
-rw-r--r--include/linux/usb/xhci-dbgp.h29
-rw-r--r--include/linux/virtio.h14
-rw-r--r--include/linux/virtio_config.h25
-rw-r--r--include/linux/virtio_ring.h3
-rw-r--r--include/linux/virtio_vsock.h1
-rw-r--r--include/linux/vm_event_item.h2
-rw-r--r--include/linux/vmalloc.h11
-rw-r--r--include/linux/vme.h12
-rw-r--r--include/linux/workqueue.h5
-rw-r--r--include/linux/writeback.h1
347 files changed, 7166 insertions, 3074 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 9b05886f9773..137e4a3d89c5 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -233,10 +233,6 @@ int acpi_numa_init (void);
233 233
234int acpi_table_init (void); 234int acpi_table_init (void);
235int acpi_table_parse(char *id, acpi_tbl_table_handler handler); 235int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
236int __init acpi_parse_entries(char *id, unsigned long table_size,
237 acpi_tbl_entry_handler handler,
238 struct acpi_table_header *table_header,
239 int entry_id, unsigned int max_entries);
240int __init acpi_table_parse_entries(char *id, unsigned long table_size, 236int __init acpi_table_parse_entries(char *id, unsigned long table_size,
241 int entry_id, 237 int entry_id,
242 acpi_tbl_entry_handler handler, 238 acpi_tbl_entry_handler handler,
@@ -595,6 +591,13 @@ enum acpi_reconfig_event {
595int acpi_reconfig_notifier_register(struct notifier_block *nb); 591int acpi_reconfig_notifier_register(struct notifier_block *nb);
596int acpi_reconfig_notifier_unregister(struct notifier_block *nb); 592int acpi_reconfig_notifier_unregister(struct notifier_block *nb);
597 593
594#ifdef CONFIG_ACPI_GTDT
595int acpi_gtdt_init(struct acpi_table_header *table, int *platform_timer_count);
596int acpi_gtdt_map_ppi(int type);
597bool acpi_gtdt_c3stop(int type);
598int acpi_arch_timer_mem_init(struct arch_timer_mem *timer_mem, int *timer_count);
599#endif
600
598#else /* !CONFIG_ACPI */ 601#else /* !CONFIG_ACPI */
599 602
600#define acpi_disabled 1 603#define acpi_disabled 1
@@ -611,6 +614,11 @@ static inline bool acpi_dev_found(const char *hid)
611 return false; 614 return false;
612} 615}
613 616
617static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
618{
619 return false;
620}
621
614static inline bool is_acpi_node(struct fwnode_handle *fwnode) 622static inline bool is_acpi_node(struct fwnode_handle *fwnode)
615{ 623{
616 return false; 624 return false;
@@ -762,8 +770,11 @@ static inline enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev)
762 return DEV_DMA_NOT_SUPPORTED; 770 return DEV_DMA_NOT_SUPPORTED;
763} 771}
764 772
765static inline void acpi_dma_configure(struct device *dev, 773static inline int acpi_dma_configure(struct device *dev,
766 enum dev_dma_attr attr) { } 774 enum dev_dma_attr attr)
775{
776 return 0;
777}
767 778
768static inline void acpi_dma_deconfigure(struct device *dev) { } 779static inline void acpi_dma_deconfigure(struct device *dev) { }
769 780
@@ -949,6 +960,10 @@ static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev)
949 adev->driver_gpios = NULL; 960 adev->driver_gpios = NULL;
950} 961}
951 962
963int devm_acpi_dev_add_driver_gpios(struct device *dev,
964 const struct acpi_gpio_mapping *gpios);
965void devm_acpi_dev_remove_driver_gpios(struct device *dev);
966
952int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index); 967int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index);
953#else 968#else
954static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev, 969static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
@@ -958,6 +973,13 @@ static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
958} 973}
959static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {} 974static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {}
960 975
976static inline int devm_acpi_dev_add_driver_gpios(struct device *dev,
977 const struct acpi_gpio_mapping *gpios)
978{
979 return -ENXIO;
980}
981static inline void devm_acpi_dev_remove_driver_gpios(struct device *dev) {}
982
961static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) 983static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
962{ 984{
963 return -ENXIO; 985 return -ENXIO;
@@ -997,8 +1019,16 @@ int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname,
997int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, 1019int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
998 enum dev_prop_type proptype, void *val, size_t nval); 1020 enum dev_prop_type proptype, void *val, size_t nval);
999 1021
1000struct fwnode_handle *acpi_get_next_subnode(struct device *dev, 1022struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
1001 struct fwnode_handle *subnode); 1023 struct fwnode_handle *child);
1024struct fwnode_handle *acpi_node_get_parent(struct fwnode_handle *fwnode);
1025
1026struct fwnode_handle *acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode,
1027 struct fwnode_handle *prev);
1028int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
1029 struct fwnode_handle **remote,
1030 struct fwnode_handle **port,
1031 struct fwnode_handle **endpoint);
1002 1032
1003struct acpi_probe_entry; 1033struct acpi_probe_entry;
1004typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *, 1034typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
@@ -1115,12 +1145,34 @@ static inline int acpi_dev_prop_read(struct acpi_device *adev,
1115 return -ENXIO; 1145 return -ENXIO;
1116} 1146}
1117 1147
1118static inline struct fwnode_handle *acpi_get_next_subnode(struct device *dev, 1148static inline struct fwnode_handle *
1119 struct fwnode_handle *subnode) 1149acpi_get_next_subnode(struct fwnode_handle *fwnode, struct fwnode_handle *child)
1120{ 1150{
1121 return NULL; 1151 return NULL;
1122} 1152}
1123 1153
1154static inline struct fwnode_handle *
1155acpi_node_get_parent(struct fwnode_handle *fwnode)
1156{
1157 return NULL;
1158}
1159
1160static inline struct fwnode_handle *
1161acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode,
1162 struct fwnode_handle *prev)
1163{
1164 return ERR_PTR(-ENXIO);
1165}
1166
1167static inline int
1168acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
1169 struct fwnode_handle **remote,
1170 struct fwnode_handle **port,
1171 struct fwnode_handle **endpoint)
1172{
1173 return -ENXIO;
1174}
1175
1124#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \ 1176#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \
1125 static const void * __acpi_table_##name[] \ 1177 static const void * __acpi_table_##name[] \
1126 __attribute__((unused)) \ 1178 __attribute__((unused)) \
diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h
index 77e08099e554..3ff9acea8616 100644
--- a/include/linux/acpi_iort.h
+++ b/include/linux/acpi_iort.h
@@ -34,6 +34,8 @@ void acpi_iort_init(void);
34bool iort_node_match(u8 type); 34bool iort_node_match(u8 type);
35u32 iort_msi_map_rid(struct device *dev, u32 req_id); 35u32 iort_msi_map_rid(struct device *dev, u32 req_id);
36struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id); 36struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id);
37void acpi_configure_pmsi_domain(struct device *dev);
38int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
37/* IOMMU interface */ 39/* IOMMU interface */
38void iort_set_dma_mask(struct device *dev); 40void iort_set_dma_mask(struct device *dev);
39const struct iommu_ops *iort_iommu_configure(struct device *dev); 41const struct iommu_ops *iort_iommu_configure(struct device *dev);
@@ -45,6 +47,7 @@ static inline u32 iort_msi_map_rid(struct device *dev, u32 req_id)
45static inline struct irq_domain *iort_get_device_domain(struct device *dev, 47static inline struct irq_domain *iort_get_device_domain(struct device *dev,
46 u32 req_id) 48 u32 req_id)
47{ return NULL; } 49{ return NULL; }
50static inline void acpi_configure_pmsi_domain(struct device *dev) { }
48/* IOMMU interface */ 51/* IOMMU interface */
49static inline void iort_set_dma_mask(struct device *dev) { } 52static inline void iort_set_dma_mask(struct device *dev) { }
50static inline 53static inline
@@ -52,7 +55,4 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
52{ return NULL; } 55{ return NULL; }
53#endif 56#endif
54 57
55#define IORT_ACPI_DECLARE(name, table_id, fn) \
56 ACPI_DECLARE_PROBE_ENTRY(iort, name, table_id, 0, NULL, 0, fn)
57
58#endif /* __ACPI_IORT_H__ */ 58#endif /* __ACPI_IORT_H__ */
diff --git a/include/linux/amba/pl080.h b/include/linux/amba/pl080.h
index 91b84a7f0539..580b5323a717 100644
--- a/include/linux/amba/pl080.h
+++ b/include/linux/amba/pl080.h
@@ -38,24 +38,16 @@
38#define PL080_SOFT_LSREQ (0x2C) 38#define PL080_SOFT_LSREQ (0x2C)
39 39
40#define PL080_CONFIG (0x30) 40#define PL080_CONFIG (0x30)
41#define PL080_CONFIG_M2_BE (1 << 2) 41#define PL080_CONFIG_M2_BE BIT(2)
42#define PL080_CONFIG_M1_BE (1 << 1) 42#define PL080_CONFIG_M1_BE BIT(1)
43#define PL080_CONFIG_ENABLE (1 << 0) 43#define PL080_CONFIG_ENABLE BIT(0)
44 44
45#define PL080_SYNC (0x34) 45#define PL080_SYNC (0x34)
46 46
47/* Per channel configuration registers */ 47/* Per channel configuration registers */
48 48
49#define PL080_Cx_STRIDE (0x20) 49/* Per channel configuration registers */
50#define PL080_Cx_BASE(x) ((0x100 + (x * 0x20))) 50#define PL080_Cx_BASE(x) ((0x100 + (x * 0x20)))
51#define PL080_Cx_SRC_ADDR(x) ((0x100 + (x * 0x20)))
52#define PL080_Cx_DST_ADDR(x) ((0x104 + (x * 0x20)))
53#define PL080_Cx_LLI(x) ((0x108 + (x * 0x20)))
54#define PL080_Cx_CONTROL(x) ((0x10C + (x * 0x20)))
55#define PL080_Cx_CONFIG(x) ((0x110 + (x * 0x20)))
56#define PL080S_Cx_CONTROL2(x) ((0x110 + (x * 0x20)))
57#define PL080S_Cx_CONFIG(x) ((0x114 + (x * 0x20)))
58
59#define PL080_CH_SRC_ADDR (0x00) 51#define PL080_CH_SRC_ADDR (0x00)
60#define PL080_CH_DST_ADDR (0x04) 52#define PL080_CH_DST_ADDR (0x04)
61#define PL080_CH_LLI (0x08) 53#define PL080_CH_LLI (0x08)
@@ -66,18 +58,18 @@
66 58
67#define PL080_LLI_ADDR_MASK (0x3fffffff << 2) 59#define PL080_LLI_ADDR_MASK (0x3fffffff << 2)
68#define PL080_LLI_ADDR_SHIFT (2) 60#define PL080_LLI_ADDR_SHIFT (2)
69#define PL080_LLI_LM_AHB2 (1 << 0) 61#define PL080_LLI_LM_AHB2 BIT(0)
70 62
71#define PL080_CONTROL_TC_IRQ_EN (1 << 31) 63#define PL080_CONTROL_TC_IRQ_EN BIT(31)
72#define PL080_CONTROL_PROT_MASK (0x7 << 28) 64#define PL080_CONTROL_PROT_MASK (0x7 << 28)
73#define PL080_CONTROL_PROT_SHIFT (28) 65#define PL080_CONTROL_PROT_SHIFT (28)
74#define PL080_CONTROL_PROT_CACHE (1 << 30) 66#define PL080_CONTROL_PROT_CACHE BIT(30)
75#define PL080_CONTROL_PROT_BUFF (1 << 29) 67#define PL080_CONTROL_PROT_BUFF BIT(29)
76#define PL080_CONTROL_PROT_SYS (1 << 28) 68#define PL080_CONTROL_PROT_SYS BIT(28)
77#define PL080_CONTROL_DST_INCR (1 << 27) 69#define PL080_CONTROL_DST_INCR BIT(27)
78#define PL080_CONTROL_SRC_INCR (1 << 26) 70#define PL080_CONTROL_SRC_INCR BIT(26)
79#define PL080_CONTROL_DST_AHB2 (1 << 25) 71#define PL080_CONTROL_DST_AHB2 BIT(25)
80#define PL080_CONTROL_SRC_AHB2 (1 << 24) 72#define PL080_CONTROL_SRC_AHB2 BIT(24)
81#define PL080_CONTROL_DWIDTH_MASK (0x7 << 21) 73#define PL080_CONTROL_DWIDTH_MASK (0x7 << 21)
82#define PL080_CONTROL_DWIDTH_SHIFT (21) 74#define PL080_CONTROL_DWIDTH_SHIFT (21)
83#define PL080_CONTROL_SWIDTH_MASK (0x7 << 18) 75#define PL080_CONTROL_SWIDTH_MASK (0x7 << 18)
@@ -103,20 +95,20 @@
103#define PL080_WIDTH_16BIT (0x1) 95#define PL080_WIDTH_16BIT (0x1)
104#define PL080_WIDTH_32BIT (0x2) 96#define PL080_WIDTH_32BIT (0x2)
105 97
106#define PL080N_CONFIG_ITPROT (1 << 20) 98#define PL080N_CONFIG_ITPROT BIT(20)
107#define PL080N_CONFIG_SECPROT (1 << 19) 99#define PL080N_CONFIG_SECPROT BIT(19)
108#define PL080_CONFIG_HALT (1 << 18) 100#define PL080_CONFIG_HALT BIT(18)
109#define PL080_CONFIG_ACTIVE (1 << 17) /* RO */ 101#define PL080_CONFIG_ACTIVE BIT(17) /* RO */
110#define PL080_CONFIG_LOCK (1 << 16) 102#define PL080_CONFIG_LOCK BIT(16)
111#define PL080_CONFIG_TC_IRQ_MASK (1 << 15) 103#define PL080_CONFIG_TC_IRQ_MASK BIT(15)
112#define PL080_CONFIG_ERR_IRQ_MASK (1 << 14) 104#define PL080_CONFIG_ERR_IRQ_MASK BIT(14)
113#define PL080_CONFIG_FLOW_CONTROL_MASK (0x7 << 11) 105#define PL080_CONFIG_FLOW_CONTROL_MASK (0x7 << 11)
114#define PL080_CONFIG_FLOW_CONTROL_SHIFT (11) 106#define PL080_CONFIG_FLOW_CONTROL_SHIFT (11)
115#define PL080_CONFIG_DST_SEL_MASK (0xf << 6) 107#define PL080_CONFIG_DST_SEL_MASK (0xf << 6)
116#define PL080_CONFIG_DST_SEL_SHIFT (6) 108#define PL080_CONFIG_DST_SEL_SHIFT (6)
117#define PL080_CONFIG_SRC_SEL_MASK (0xf << 1) 109#define PL080_CONFIG_SRC_SEL_MASK (0xf << 1)
118#define PL080_CONFIG_SRC_SEL_SHIFT (1) 110#define PL080_CONFIG_SRC_SEL_SHIFT (1)
119#define PL080_CONFIG_ENABLE (1 << 0) 111#define PL080_CONFIG_ENABLE BIT(0)
120 112
121#define PL080_FLOW_MEM2MEM (0x0) 113#define PL080_FLOW_MEM2MEM (0x0)
122#define PL080_FLOW_MEM2PER (0x1) 114#define PL080_FLOW_MEM2PER (0x1)
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h
deleted file mode 100644
index fe93758e8403..000000000000
--- a/include/linux/amba/pl330.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/* linux/include/linux/amba/pl330.h
2 *
3 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __AMBA_PL330_H_
13#define __AMBA_PL330_H_
14
15#include <linux/dmaengine.h>
16
17struct dma_pl330_platdata {
18 /*
19 * Number of valid peripherals connected to DMAC.
20 * This may be different from the value read from
21 * CR0, as the PL330 implementation might have 'holes'
22 * in the peri list or the peri could also be reached
23 * from another DMAC which the platform prefers.
24 */
25 u8 nr_valid_peri;
26 /* Array of valid peripherals */
27 u8 *peri_id;
28 /* Operational capabilities */
29 dma_cap_mask_t cap_mask;
30 /* Bytes to allocate for MC buffer */
31 unsigned mcbuf_sz;
32};
33
34extern bool pl330_filter(struct dma_chan *chan, void *param);
35#endif /* __AMBA_PL330_H_ */
diff --git a/include/linux/amigaffs.h b/include/linux/amigaffs.h
deleted file mode 100644
index 43b41c06aa37..000000000000
--- a/include/linux/amigaffs.h
+++ /dev/null
@@ -1,144 +0,0 @@
1#ifndef AMIGAFFS_H
2#define AMIGAFFS_H
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7#define FS_OFS 0x444F5300
8#define FS_FFS 0x444F5301
9#define FS_INTLOFS 0x444F5302
10#define FS_INTLFFS 0x444F5303
11#define FS_DCOFS 0x444F5304
12#define FS_DCFFS 0x444F5305
13#define MUFS_FS 0x6d754653 /* 'muFS' */
14#define MUFS_OFS 0x6d754600 /* 'muF\0' */
15#define MUFS_FFS 0x6d754601 /* 'muF\1' */
16#define MUFS_INTLOFS 0x6d754602 /* 'muF\2' */
17#define MUFS_INTLFFS 0x6d754603 /* 'muF\3' */
18#define MUFS_DCOFS 0x6d754604 /* 'muF\4' */
19#define MUFS_DCFFS 0x6d754605 /* 'muF\5' */
20
21#define T_SHORT 2
22#define T_LIST 16
23#define T_DATA 8
24
25#define ST_LINKFILE -4
26#define ST_FILE -3
27#define ST_ROOT 1
28#define ST_USERDIR 2
29#define ST_SOFTLINK 3
30#define ST_LINKDIR 4
31
32#define AFFS_ROOT_BMAPS 25
33
34struct affs_date {
35 __be32 days;
36 __be32 mins;
37 __be32 ticks;
38};
39
40struct affs_short_date {
41 __be16 days;
42 __be16 mins;
43 __be16 ticks;
44};
45
46struct affs_root_head {
47 __be32 ptype;
48 __be32 spare1;
49 __be32 spare2;
50 __be32 hash_size;
51 __be32 spare3;
52 __be32 checksum;
53 __be32 hashtable[1];
54};
55
56struct affs_root_tail {
57 __be32 bm_flag;
58 __be32 bm_blk[AFFS_ROOT_BMAPS];
59 __be32 bm_ext;
60 struct affs_date root_change;
61 u8 disk_name[32];
62 __be32 spare1;
63 __be32 spare2;
64 struct affs_date disk_change;
65 struct affs_date disk_create;
66 __be32 spare3;
67 __be32 spare4;
68 __be32 dcache;
69 __be32 stype;
70};
71
72struct affs_head {
73 __be32 ptype;
74 __be32 key;
75 __be32 block_count;
76 __be32 spare1;
77 __be32 first_data;
78 __be32 checksum;
79 __be32 table[1];
80};
81
82struct affs_tail {
83 __be32 spare1;
84 __be16 uid;
85 __be16 gid;
86 __be32 protect;
87 __be32 size;
88 u8 comment[92];
89 struct affs_date change;
90 u8 name[32];
91 __be32 spare2;
92 __be32 original;
93 __be32 link_chain;
94 __be32 spare[5];
95 __be32 hash_chain;
96 __be32 parent;
97 __be32 extension;
98 __be32 stype;
99};
100
101struct slink_front
102{
103 __be32 ptype;
104 __be32 key;
105 __be32 spare1[3];
106 __be32 checksum;
107 u8 symname[1]; /* depends on block size */
108};
109
110struct affs_data_head
111{
112 __be32 ptype;
113 __be32 key;
114 __be32 sequence;
115 __be32 size;
116 __be32 next;
117 __be32 checksum;
118 u8 data[1]; /* depends on block size */
119};
120
121/* Permission bits */
122
123#define FIBF_OTR_READ 0x8000
124#define FIBF_OTR_WRITE 0x4000
125#define FIBF_OTR_EXECUTE 0x2000
126#define FIBF_OTR_DELETE 0x1000
127#define FIBF_GRP_READ 0x0800
128#define FIBF_GRP_WRITE 0x0400
129#define FIBF_GRP_EXECUTE 0x0200
130#define FIBF_GRP_DELETE 0x0100
131
132#define FIBF_HIDDEN 0x0080
133#define FIBF_SCRIPT 0x0040
134#define FIBF_PURE 0x0020 /* no use under linux */
135#define FIBF_ARCHIVED 0x0010 /* never set, always cleared on write */
136#define FIBF_NOREAD 0x0008 /* 0 means allowed */
137#define FIBF_NOWRITE 0x0004 /* 0 means allowed */
138#define FIBF_NOEXECUTE 0x0002 /* 0 means allowed, ignored under linux */
139#define FIBF_NODELETE 0x0001 /* 0 means allowed */
140
141#define FIBF_OWNER 0x000F /* Bits pertaining to owner */
142#define FIBF_MASK 0xEE0E /* Bits modified by Linux */
143
144#endif
diff --git a/include/linux/ata.h b/include/linux/ata.h
index af6859b3a93d..ad7d9ee89ff0 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -817,11 +817,6 @@ static inline bool ata_id_sct_error_recovery_ctrl(const u16 *id)
817 return id[ATA_ID_SCT_CMD_XPORT] & (1 << 3) ? true : false; 817 return id[ATA_ID_SCT_CMD_XPORT] & (1 << 3) ? true : false;
818} 818}
819 819
820static inline bool ata_id_sct_write_same(const u16 *id)
821{
822 return id[ATA_ID_SCT_CMD_XPORT] & (1 << 2) ? true : false;
823}
824
825static inline bool ata_id_sct_long_sector_access(const u16 *id) 820static inline bool ata_id_sct_long_sector_access(const u16 *id)
826{ 821{
827 return id[ATA_ID_SCT_CMD_XPORT] & (1 << 1) ? true : false; 822 return id[ATA_ID_SCT_CMD_XPORT] & (1 << 1) ? true : false;
diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
deleted file mode 100644
index bd2560502f3c..000000000000
--- a/include/linux/atmel_serial.h
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 * include/linux/atmel_serial.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * USART registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef ATMEL_SERIAL_H
17#define ATMEL_SERIAL_H
18
19#define ATMEL_US_CR 0x00 /* Control Register */
20#define ATMEL_US_RSTRX BIT(2) /* Reset Receiver */
21#define ATMEL_US_RSTTX BIT(3) /* Reset Transmitter */
22#define ATMEL_US_RXEN BIT(4) /* Receiver Enable */
23#define ATMEL_US_RXDIS BIT(5) /* Receiver Disable */
24#define ATMEL_US_TXEN BIT(6) /* Transmitter Enable */
25#define ATMEL_US_TXDIS BIT(7) /* Transmitter Disable */
26#define ATMEL_US_RSTSTA BIT(8) /* Reset Status Bits */
27#define ATMEL_US_STTBRK BIT(9) /* Start Break */
28#define ATMEL_US_STPBRK BIT(10) /* Stop Break */
29#define ATMEL_US_STTTO BIT(11) /* Start Time-out */
30#define ATMEL_US_SENDA BIT(12) /* Send Address */
31#define ATMEL_US_RSTIT BIT(13) /* Reset Iterations */
32#define ATMEL_US_RSTNACK BIT(14) /* Reset Non Acknowledge */
33#define ATMEL_US_RETTO BIT(15) /* Rearm Time-out */
34#define ATMEL_US_DTREN BIT(16) /* Data Terminal Ready Enable */
35#define ATMEL_US_DTRDIS BIT(17) /* Data Terminal Ready Disable */
36#define ATMEL_US_RTSEN BIT(18) /* Request To Send Enable */
37#define ATMEL_US_RTSDIS BIT(19) /* Request To Send Disable */
38#define ATMEL_US_TXFCLR BIT(24) /* Transmit FIFO Clear */
39#define ATMEL_US_RXFCLR BIT(25) /* Receive FIFO Clear */
40#define ATMEL_US_TXFLCLR BIT(26) /* Transmit FIFO Lock Clear */
41#define ATMEL_US_FIFOEN BIT(30) /* FIFO enable */
42#define ATMEL_US_FIFODIS BIT(31) /* FIFO disable */
43
44#define ATMEL_US_MR 0x04 /* Mode Register */
45#define ATMEL_US_USMODE GENMASK(3, 0) /* Mode of the USART */
46#define ATMEL_US_USMODE_NORMAL 0
47#define ATMEL_US_USMODE_RS485 1
48#define ATMEL_US_USMODE_HWHS 2
49#define ATMEL_US_USMODE_MODEM 3
50#define ATMEL_US_USMODE_ISO7816_T0 4
51#define ATMEL_US_USMODE_ISO7816_T1 6
52#define ATMEL_US_USMODE_IRDA 8
53#define ATMEL_US_USCLKS GENMASK(5, 4) /* Clock Selection */
54#define ATMEL_US_USCLKS_MCK (0 << 4)
55#define ATMEL_US_USCLKS_MCK_DIV8 (1 << 4)
56#define ATMEL_US_USCLKS_SCK (3 << 4)
57#define ATMEL_US_CHRL GENMASK(7, 6) /* Character Length */
58#define ATMEL_US_CHRL_5 (0 << 6)
59#define ATMEL_US_CHRL_6 (1 << 6)
60#define ATMEL_US_CHRL_7 (2 << 6)
61#define ATMEL_US_CHRL_8 (3 << 6)
62#define ATMEL_US_SYNC BIT(8) /* Synchronous Mode Select */
63#define ATMEL_US_PAR GENMASK(11, 9) /* Parity Type */
64#define ATMEL_US_PAR_EVEN (0 << 9)
65#define ATMEL_US_PAR_ODD (1 << 9)
66#define ATMEL_US_PAR_SPACE (2 << 9)
67#define ATMEL_US_PAR_MARK (3 << 9)
68#define ATMEL_US_PAR_NONE (4 << 9)
69#define ATMEL_US_PAR_MULTI_DROP (6 << 9)
70#define ATMEL_US_NBSTOP GENMASK(13, 12) /* Number of Stop Bits */
71#define ATMEL_US_NBSTOP_1 (0 << 12)
72#define ATMEL_US_NBSTOP_1_5 (1 << 12)
73#define ATMEL_US_NBSTOP_2 (2 << 12)
74#define ATMEL_US_CHMODE GENMASK(15, 14) /* Channel Mode */
75#define ATMEL_US_CHMODE_NORMAL (0 << 14)
76#define ATMEL_US_CHMODE_ECHO (1 << 14)
77#define ATMEL_US_CHMODE_LOC_LOOP (2 << 14)
78#define ATMEL_US_CHMODE_REM_LOOP (3 << 14)
79#define ATMEL_US_MSBF BIT(16) /* Bit Order */
80#define ATMEL_US_MODE9 BIT(17) /* 9-bit Character Length */
81#define ATMEL_US_CLKO BIT(18) /* Clock Output Select */
82#define ATMEL_US_OVER BIT(19) /* Oversampling Mode */
83#define ATMEL_US_INACK BIT(20) /* Inhibit Non Acknowledge */
84#define ATMEL_US_DSNACK BIT(21) /* Disable Successive NACK */
85#define ATMEL_US_MAX_ITER GENMASK(26, 24) /* Max Iterations */
86#define ATMEL_US_FILTER BIT(28) /* Infrared Receive Line Filter */
87
88#define ATMEL_US_IER 0x08 /* Interrupt Enable Register */
89#define ATMEL_US_RXRDY BIT(0) /* Receiver Ready */
90#define ATMEL_US_TXRDY BIT(1) /* Transmitter Ready */
91#define ATMEL_US_RXBRK BIT(2) /* Break Received / End of Break */
92#define ATMEL_US_ENDRX BIT(3) /* End of Receiver Transfer */
93#define ATMEL_US_ENDTX BIT(4) /* End of Transmitter Transfer */
94#define ATMEL_US_OVRE BIT(5) /* Overrun Error */
95#define ATMEL_US_FRAME BIT(6) /* Framing Error */
96#define ATMEL_US_PARE BIT(7) /* Parity Error */
97#define ATMEL_US_TIMEOUT BIT(8) /* Receiver Time-out */
98#define ATMEL_US_TXEMPTY BIT(9) /* Transmitter Empty */
99#define ATMEL_US_ITERATION BIT(10) /* Max number of Repetitions Reached */
100#define ATMEL_US_TXBUFE BIT(11) /* Transmission Buffer Empty */
101#define ATMEL_US_RXBUFF BIT(12) /* Reception Buffer Full */
102#define ATMEL_US_NACK BIT(13) /* Non Acknowledge */
103#define ATMEL_US_RIIC BIT(16) /* Ring Indicator Input Change */
104#define ATMEL_US_DSRIC BIT(17) /* Data Set Ready Input Change */
105#define ATMEL_US_DCDIC BIT(18) /* Data Carrier Detect Input Change */
106#define ATMEL_US_CTSIC BIT(19) /* Clear to Send Input Change */
107#define ATMEL_US_RI BIT(20) /* RI */
108#define ATMEL_US_DSR BIT(21) /* DSR */
109#define ATMEL_US_DCD BIT(22) /* DCD */
110#define ATMEL_US_CTS BIT(23) /* CTS */
111
112#define ATMEL_US_IDR 0x0c /* Interrupt Disable Register */
113#define ATMEL_US_IMR 0x10 /* Interrupt Mask Register */
114#define ATMEL_US_CSR 0x14 /* Channel Status Register */
115#define ATMEL_US_RHR 0x18 /* Receiver Holding Register */
116#define ATMEL_US_THR 0x1c /* Transmitter Holding Register */
117#define ATMEL_US_SYNH BIT(15) /* Transmit/Receive Sync */
118
119#define ATMEL_US_BRGR 0x20 /* Baud Rate Generator Register */
120#define ATMEL_US_CD GENMASK(15, 0) /* Clock Divider */
121#define ATMEL_US_FP_OFFSET 16 /* Fractional Part */
122#define ATMEL_US_FP_MASK 0x7
123
124#define ATMEL_US_RTOR 0x24 /* Receiver Time-out Register for USART */
125#define ATMEL_UA_RTOR 0x28 /* Receiver Time-out Register for UART */
126#define ATMEL_US_TO GENMASK(15, 0) /* Time-out Value */
127
128#define ATMEL_US_TTGR 0x28 /* Transmitter Timeguard Register */
129#define ATMEL_US_TG GENMASK(7, 0) /* Timeguard Value */
130
131#define ATMEL_US_FIDI 0x40 /* FI DI Ratio Register */
132#define ATMEL_US_NER 0x44 /* Number of Errors Register */
133#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
134
135#define ATMEL_US_CMPR 0x90 /* Comparaison Register */
136#define ATMEL_US_FMR 0xa0 /* FIFO Mode Register */
137#define ATMEL_US_TXRDYM(data) (((data) & 0x3) << 0) /* TX Ready Mode */
138#define ATMEL_US_RXRDYM(data) (((data) & 0x3) << 4) /* RX Ready Mode */
139#define ATMEL_US_ONE_DATA 0x0
140#define ATMEL_US_TWO_DATA 0x1
141#define ATMEL_US_FOUR_DATA 0x2
142#define ATMEL_US_FRTSC BIT(7) /* FIFO RTS pin Control */
143#define ATMEL_US_TXFTHRES(thr) (((thr) & 0x3f) << 8) /* TX FIFO Threshold */
144#define ATMEL_US_RXFTHRES(thr) (((thr) & 0x3f) << 16) /* RX FIFO Threshold */
145#define ATMEL_US_RXFTHRES2(thr) (((thr) & 0x3f) << 24) /* RX FIFO Threshold2 */
146
147#define ATMEL_US_FLR 0xa4 /* FIFO Level Register */
148#define ATMEL_US_TXFL(reg) (((reg) >> 0) & 0x3f) /* TX FIFO Level */
149#define ATMEL_US_RXFL(reg) (((reg) >> 16) & 0x3f) /* RX FIFO Level */
150
151#define ATMEL_US_FIER 0xa8 /* FIFO Interrupt Enable Register */
152#define ATMEL_US_FIDR 0xac /* FIFO Interrupt Disable Register */
153#define ATMEL_US_FIMR 0xb0 /* FIFO Interrupt Mask Register */
154#define ATMEL_US_FESR 0xb4 /* FIFO Event Status Register */
155#define ATMEL_US_TXFEF BIT(0) /* Transmit FIFO Empty Flag */
156#define ATMEL_US_TXFFF BIT(1) /* Transmit FIFO Full Flag */
157#define ATMEL_US_TXFTHF BIT(2) /* Transmit FIFO Threshold Flag */
158#define ATMEL_US_RXFEF BIT(3) /* Receive FIFO Empty Flag */
159#define ATMEL_US_RXFFF BIT(4) /* Receive FIFO Full Flag */
160#define ATMEL_US_RXFTHF BIT(5) /* Receive FIFO Threshold Flag */
161#define ATMEL_US_TXFPTEF BIT(6) /* Transmit FIFO Pointer Error Flag */
162#define ATMEL_US_RXFPTEF BIT(7) /* Receive FIFO Pointer Error Flag */
163#define ATMEL_US_TXFLOCK BIT(8) /* Transmit FIFO Lock (FESR only) */
164#define ATMEL_US_RXFTHF2 BIT(9) /* Receive FIFO Threshold Flag 2 */
165
166#define ATMEL_US_NAME 0xf0 /* Ip Name */
167#define ATMEL_US_VERSION 0xfc /* Ip Version */
168
169#endif
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index e71835bf60a9..c56be7410130 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -423,6 +423,29 @@
423#endif 423#endif
424#endif /* atomic_cmpxchg_relaxed */ 424#endif /* atomic_cmpxchg_relaxed */
425 425
426#ifndef atomic_try_cmpxchg
427
428#define __atomic_try_cmpxchg(type, _p, _po, _n) \
429({ \
430 typeof(_po) __po = (_po); \
431 typeof(*(_po)) __r, __o = *__po; \
432 __r = atomic_cmpxchg##type((_p), __o, (_n)); \
433 if (unlikely(__r != __o)) \
434 *__po = __r; \
435 likely(__r == __o); \
436})
437
438#define atomic_try_cmpxchg(_p, _po, _n) __atomic_try_cmpxchg(, _p, _po, _n)
439#define atomic_try_cmpxchg_relaxed(_p, _po, _n) __atomic_try_cmpxchg(_relaxed, _p, _po, _n)
440#define atomic_try_cmpxchg_acquire(_p, _po, _n) __atomic_try_cmpxchg(_acquire, _p, _po, _n)
441#define atomic_try_cmpxchg_release(_p, _po, _n) __atomic_try_cmpxchg(_release, _p, _po, _n)
442
443#else /* atomic_try_cmpxchg */
444#define atomic_try_cmpxchg_relaxed atomic_try_cmpxchg
445#define atomic_try_cmpxchg_acquire atomic_try_cmpxchg
446#define atomic_try_cmpxchg_release atomic_try_cmpxchg
447#endif /* atomic_try_cmpxchg */
448
426/* cmpxchg_relaxed */ 449/* cmpxchg_relaxed */
427#ifndef cmpxchg_relaxed 450#ifndef cmpxchg_relaxed
428#define cmpxchg_relaxed cmpxchg 451#define cmpxchg_relaxed cmpxchg
@@ -996,6 +1019,29 @@ static inline int atomic_dec_if_positive(atomic_t *v)
996#endif 1019#endif
997#endif /* atomic64_cmpxchg_relaxed */ 1020#endif /* atomic64_cmpxchg_relaxed */
998 1021
1022#ifndef atomic64_try_cmpxchg
1023
1024#define __atomic64_try_cmpxchg(type, _p, _po, _n) \
1025({ \
1026 typeof(_po) __po = (_po); \
1027 typeof(*(_po)) __r, __o = *__po; \
1028 __r = atomic64_cmpxchg##type((_p), __o, (_n)); \
1029 if (unlikely(__r != __o)) \
1030 *__po = __r; \
1031 likely(__r == __o); \
1032})
1033
1034#define atomic64_try_cmpxchg(_p, _po, _n) __atomic64_try_cmpxchg(, _p, _po, _n)
1035#define atomic64_try_cmpxchg_relaxed(_p, _po, _n) __atomic64_try_cmpxchg(_relaxed, _p, _po, _n)
1036#define atomic64_try_cmpxchg_acquire(_p, _po, _n) __atomic64_try_cmpxchg(_acquire, _p, _po, _n)
1037#define atomic64_try_cmpxchg_release(_p, _po, _n) __atomic64_try_cmpxchg(_release, _p, _po, _n)
1038
1039#else /* atomic64_try_cmpxchg */
1040#define atomic64_try_cmpxchg_relaxed atomic64_try_cmpxchg
1041#define atomic64_try_cmpxchg_acquire atomic64_try_cmpxchg
1042#define atomic64_try_cmpxchg_release atomic64_try_cmpxchg
1043#endif /* atomic64_try_cmpxchg */
1044
999#ifndef atomic64_andnot 1045#ifndef atomic64_andnot
1000static inline void atomic64_andnot(long long i, atomic64_t *v) 1046static inline void atomic64_andnot(long long i, atomic64_t *v)
1001{ 1047{
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 504e784b7ffa..2150bdccfbab 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -163,8 +163,7 @@ extern void audit_log_task_info(struct audit_buffer *ab,
163extern int audit_update_lsm_rules(void); 163extern int audit_update_lsm_rules(void);
164 164
165 /* Private API (for audit.c only) */ 165 /* Private API (for audit.c only) */
166extern int audit_rule_change(int type, __u32 portid, int seq, 166extern int audit_rule_change(int type, int seq, void *data, size_t datasz);
167 void *data, size_t datasz);
168extern int audit_list_rules_send(struct sk_buff *request_skb, int seq); 167extern int audit_list_rules_send(struct sk_buff *request_skb, int seq);
169 168
170extern u32 audit_enabled; 169extern u32 audit_enabled;
@@ -332,7 +331,7 @@ static inline void audit_ptrace(struct task_struct *t)
332 /* Private API (for audit.c only) */ 331 /* Private API (for audit.c only) */
333extern unsigned int audit_serial(void); 332extern unsigned int audit_serial(void);
334extern int auditsc_get_stamp(struct audit_context *ctx, 333extern int auditsc_get_stamp(struct audit_context *ctx,
335 struct timespec *t, unsigned int *serial); 334 struct timespec64 *t, unsigned int *serial);
336extern int audit_set_loginuid(kuid_t loginuid); 335extern int audit_set_loginuid(kuid_t loginuid);
337 336
338static inline kuid_t audit_get_loginuid(struct task_struct *tsk) 337static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
@@ -511,7 +510,7 @@ static inline void __audit_seccomp(unsigned long syscall, long signr, int code)
511static inline void audit_seccomp(unsigned long syscall, long signr, int code) 510static inline void audit_seccomp(unsigned long syscall, long signr, int code)
512{ } 511{ }
513static inline int auditsc_get_stamp(struct audit_context *ctx, 512static inline int auditsc_get_stamp(struct audit_context *ctx,
514 struct timespec *t, unsigned int *serial) 513 struct timespec64 *t, unsigned int *serial)
515{ 514{
516 return 0; 515 return 0;
517} 516}
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
index ad955817916d..866c433e7d32 100644
--- a/include/linux/backing-dev-defs.h
+++ b/include/linux/backing-dev-defs.h
@@ -21,6 +21,7 @@ struct dentry;
21 */ 21 */
22enum wb_state { 22enum wb_state {
23 WB_registered, /* bdi_register() was done */ 23 WB_registered, /* bdi_register() was done */
24 WB_shutting_down, /* wb_shutdown() in progress */
24 WB_writeback_running, /* Writeback is in progress */ 25 WB_writeback_running, /* Writeback is in progress */
25 WB_has_dirty_io, /* Dirty inodes on ->b_{dirty|io|more_io} */ 26 WB_has_dirty_io, /* Dirty inodes on ->b_{dirty|io|more_io} */
26}; 27};
@@ -54,7 +55,9 @@ struct bdi_writeback_congested {
54 atomic_t refcnt; /* nr of attached wb's and blkg */ 55 atomic_t refcnt; /* nr of attached wb's and blkg */
55 56
56#ifdef CONFIG_CGROUP_WRITEBACK 57#ifdef CONFIG_CGROUP_WRITEBACK
57 struct backing_dev_info *bdi; /* the associated bdi */ 58 struct backing_dev_info *__bdi; /* the associated bdi, set to NULL
59 * on bdi unregistration. For memcg-wb
60 * internal use only! */
58 int blkcg_id; /* ID of the associated blkcg */ 61 int blkcg_id; /* ID of the associated blkcg */
59 struct rb_node rb_node; /* on bdi->cgwb_congestion_tree */ 62 struct rb_node rb_node; /* on bdi->cgwb_congestion_tree */
60#endif 63#endif
@@ -143,7 +146,7 @@ struct backing_dev_info {
143 congested_fn *congested_fn; /* Function pointer if device is md/dm */ 146 congested_fn *congested_fn; /* Function pointer if device is md/dm */
144 void *congested_data; /* Pointer to aux data for congested func */ 147 void *congested_data; /* Pointer to aux data for congested func */
145 148
146 char *name; 149 const char *name;
147 150
148 struct kref refcnt; /* Reference counter for the structure */ 151 struct kref refcnt; /* Reference counter for the structure */
149 unsigned int capabilities; /* Device capabilities */ 152 unsigned int capabilities; /* Device capabilities */
@@ -161,7 +164,6 @@ struct backing_dev_info {
161#ifdef CONFIG_CGROUP_WRITEBACK 164#ifdef CONFIG_CGROUP_WRITEBACK
162 struct radix_tree_root cgwb_tree; /* radix tree of active cgroup wbs */ 165 struct radix_tree_root cgwb_tree; /* radix tree of active cgroup wbs */
163 struct rb_root cgwb_congested_tree; /* their congested states */ 166 struct rb_root cgwb_congested_tree; /* their congested states */
164 atomic_t usage_cnt; /* counts both cgwbs and cgwb_contested's */
165#else 167#else
166 struct bdi_writeback_congested *wb_congested; 168 struct bdi_writeback_congested *wb_congested;
167#endif 169#endif
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index c52a48cb9a66..557d84063934 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -17,8 +17,6 @@
17#include <linux/backing-dev-defs.h> 17#include <linux/backing-dev-defs.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19 19
20int __must_check bdi_init(struct backing_dev_info *bdi);
21
22static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi) 20static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi)
23{ 21{
24 kref_get(&bdi->refcnt); 22 kref_get(&bdi->refcnt);
@@ -27,16 +25,18 @@ static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi)
27 25
28void bdi_put(struct backing_dev_info *bdi); 26void bdi_put(struct backing_dev_info *bdi);
29 27
30__printf(3, 4) 28__printf(2, 3)
31int bdi_register(struct backing_dev_info *bdi, struct device *parent, 29int bdi_register(struct backing_dev_info *bdi, const char *fmt, ...);
32 const char *fmt, ...); 30int bdi_register_va(struct backing_dev_info *bdi, const char *fmt,
33int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 31 va_list args);
34int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner); 32int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner);
35void bdi_unregister(struct backing_dev_info *bdi); 33void bdi_unregister(struct backing_dev_info *bdi);
36 34
37int __must_check bdi_setup_and_register(struct backing_dev_info *, char *);
38void bdi_destroy(struct backing_dev_info *bdi);
39struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id); 35struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id);
36static inline struct backing_dev_info *bdi_alloc(gfp_t gfp_mask)
37{
38 return bdi_alloc_node(gfp_mask, NUMA_NO_NODE);
39}
40 40
41void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, 41void wb_start_writeback(struct bdi_writeback *wb, long nr_pages,
42 bool range_cyclic, enum wb_reason reason); 42 bool range_cyclic, enum wb_reason reason);
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 9657f11d48a7..bca6a5e4ca3d 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -80,7 +80,7 @@ struct pci_dev;
80#define BCMA_CORE_PCI_MDIODATA_DEV_TX 0x1e /* SERDES TX Dev */ 80#define BCMA_CORE_PCI_MDIODATA_DEV_TX 0x1e /* SERDES TX Dev */
81#define BCMA_CORE_PCI_MDIODATA_DEV_RX 0x1f /* SERDES RX Dev */ 81#define BCMA_CORE_PCI_MDIODATA_DEV_RX 0x1f /* SERDES RX Dev */
82#define BCMA_CORE_PCI_PCIEIND_ADDR 0x0130 /* indirect access to the internal register */ 82#define BCMA_CORE_PCI_PCIEIND_ADDR 0x0130 /* indirect access to the internal register */
83#define BCMA_CORE_PCI_PCIEIND_DATA 0x0134 /* Data to/from the internal regsiter */ 83#define BCMA_CORE_PCI_PCIEIND_DATA 0x0134 /* Data to/from the internal register */
84#define BCMA_CORE_PCI_CLKREQENCTRL 0x0138 /* >= rev 6, Clkreq rdma control */ 84#define BCMA_CORE_PCI_CLKREQENCTRL 0x0138 /* >= rev 6, Clkreq rdma control */
85#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ 85#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */
86#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ 86#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 8e521194f6fc..d1b04b0e99cf 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -183,7 +183,7 @@ static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter,
183 183
184#define bio_iter_last(bvec, iter) ((iter).bi_size == (bvec).bv_len) 184#define bio_iter_last(bvec, iter) ((iter).bi_size == (bvec).bv_len)
185 185
186static inline unsigned __bio_segments(struct bio *bio, struct bvec_iter *bvec) 186static inline unsigned bio_segments(struct bio *bio)
187{ 187{
188 unsigned segs = 0; 188 unsigned segs = 0;
189 struct bio_vec bv; 189 struct bio_vec bv;
@@ -205,17 +205,12 @@ static inline unsigned __bio_segments(struct bio *bio, struct bvec_iter *bvec)
205 break; 205 break;
206 } 206 }
207 207
208 __bio_for_each_segment(bv, bio, iter, *bvec) 208 bio_for_each_segment(bv, bio, iter)
209 segs++; 209 segs++;
210 210
211 return segs; 211 return segs;
212} 212}
213 213
214static inline unsigned bio_segments(struct bio *bio)
215{
216 return __bio_segments(bio, &bio->bi_iter);
217}
218
219/* 214/*
220 * get a reference to a bio, so it won't disappear. the intended use is 215 * get a reference to a bio, so it won't disappear. the intended use is
221 * something like: 216 * something like:
@@ -383,14 +378,12 @@ extern struct bio_set *bioset_create_nobvec(unsigned int, unsigned int);
383extern void bioset_free(struct bio_set *); 378extern void bioset_free(struct bio_set *);
384extern mempool_t *biovec_create_pool(int pool_entries); 379extern mempool_t *biovec_create_pool(int pool_entries);
385 380
386extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); 381extern struct bio *bio_alloc_bioset(gfp_t, unsigned int, struct bio_set *);
387extern void bio_put(struct bio *); 382extern void bio_put(struct bio *);
388 383
389extern void __bio_clone_fast(struct bio *, struct bio *); 384extern void __bio_clone_fast(struct bio *, struct bio *);
390extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *); 385extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *);
391extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); 386extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
392extern struct bio *bio_clone_bioset_partial(struct bio *, gfp_t,
393 struct bio_set *, int, int);
394 387
395extern struct bio_set *fs_bio_set; 388extern struct bio_set *fs_bio_set;
396 389
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index b296a9006117..fcd641032f8d 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -15,7 +15,7 @@ struct blk_mq_hw_ctx {
15 unsigned long state; /* BLK_MQ_S_* flags */ 15 unsigned long state; /* BLK_MQ_S_* flags */
16 } ____cacheline_aligned_in_smp; 16 } ____cacheline_aligned_in_smp;
17 17
18 struct work_struct run_work; 18 struct delayed_work run_work;
19 cpumask_var_t cpumask; 19 cpumask_var_t cpumask;
20 int next_cpu; 20 int next_cpu;
21 int next_cpu_batch; 21 int next_cpu_batch;
@@ -51,14 +51,17 @@ struct blk_mq_hw_ctx {
51 51
52 atomic_t nr_active; 52 atomic_t nr_active;
53 53
54 struct delayed_work delay_work;
55
56 struct hlist_node cpuhp_dead; 54 struct hlist_node cpuhp_dead;
57 struct kobject kobj; 55 struct kobject kobj;
58 56
59 unsigned long poll_considered; 57 unsigned long poll_considered;
60 unsigned long poll_invoked; 58 unsigned long poll_invoked;
61 unsigned long poll_success; 59 unsigned long poll_success;
60
61#ifdef CONFIG_BLK_DEBUG_FS
62 struct dentry *debugfs_dir;
63 struct dentry *sched_debugfs_dir;
64#endif
62}; 65};
63 66
64struct blk_mq_tag_set { 67struct blk_mq_tag_set {
@@ -81,7 +84,6 @@ struct blk_mq_tag_set {
81 84
82struct blk_mq_queue_data { 85struct blk_mq_queue_data {
83 struct request *rq; 86 struct request *rq;
84 struct list_head *list;
85 bool last; 87 bool last;
86}; 88};
87 89
@@ -89,9 +91,9 @@ typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, const struct blk_mq_queue_data
89typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool); 91typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool);
90typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); 92typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);
91typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); 93typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
92typedef int (init_request_fn)(void *, struct request *, unsigned int, 94typedef int (init_request_fn)(struct blk_mq_tag_set *set, struct request *,
93 unsigned int, unsigned int); 95 unsigned int, unsigned int);
94typedef void (exit_request_fn)(void *, struct request *, unsigned int, 96typedef void (exit_request_fn)(struct blk_mq_tag_set *set, struct request *,
95 unsigned int); 97 unsigned int);
96typedef int (reinit_request_fn)(void *, struct request *); 98typedef int (reinit_request_fn)(void *, struct request *);
97 99
@@ -142,6 +144,14 @@ struct blk_mq_ops {
142 reinit_request_fn *reinit_request; 144 reinit_request_fn *reinit_request;
143 145
144 map_queues_fn *map_queues; 146 map_queues_fn *map_queues;
147
148#ifdef CONFIG_BLK_DEBUG_FS
149 /*
150 * Used by the debugfs implementation to show driver-specific
151 * information about a request.
152 */
153 void (*show_rq)(struct seq_file *m, struct request *rq);
154#endif
145}; 155};
146 156
147enum { 157enum {
@@ -152,7 +162,6 @@ enum {
152 BLK_MQ_F_SHOULD_MERGE = 1 << 0, 162 BLK_MQ_F_SHOULD_MERGE = 1 << 0,
153 BLK_MQ_F_TAG_SHARED = 1 << 1, 163 BLK_MQ_F_TAG_SHARED = 1 << 1,
154 BLK_MQ_F_SG_MERGE = 1 << 2, 164 BLK_MQ_F_SG_MERGE = 1 << 2,
155 BLK_MQ_F_DEFER_ISSUE = 1 << 4,
156 BLK_MQ_F_BLOCKING = 1 << 5, 165 BLK_MQ_F_BLOCKING = 1 << 5,
157 BLK_MQ_F_NO_SCHED = 1 << 6, 166 BLK_MQ_F_NO_SCHED = 1 << 6,
158 BLK_MQ_F_ALLOC_POLICY_START_BIT = 8, 167 BLK_MQ_F_ALLOC_POLICY_START_BIT = 8,
@@ -162,6 +171,7 @@ enum {
162 BLK_MQ_S_TAG_ACTIVE = 1, 171 BLK_MQ_S_TAG_ACTIVE = 1,
163 BLK_MQ_S_SCHED_RESTART = 2, 172 BLK_MQ_S_SCHED_RESTART = 2,
164 BLK_MQ_S_TAG_WAITING = 3, 173 BLK_MQ_S_TAG_WAITING = 3,
174 BLK_MQ_S_START_ON_RUN = 4,
165 175
166 BLK_MQ_MAX_DEPTH = 10240, 176 BLK_MQ_MAX_DEPTH = 10240,
167 177
@@ -228,8 +238,7 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
228 bool kick_requeue_list); 238 bool kick_requeue_list);
229void blk_mq_kick_requeue_list(struct request_queue *q); 239void blk_mq_kick_requeue_list(struct request_queue *q);
230void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs); 240void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
231void blk_mq_abort_requeue_list(struct request_queue *q); 241void blk_mq_complete_request(struct request *rq);
232void blk_mq_complete_request(struct request *rq, int error);
233 242
234bool blk_mq_queue_stopped(struct request_queue *q); 243bool blk_mq_queue_stopped(struct request_queue *q);
235void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx); 244void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx);
@@ -238,13 +247,15 @@ void blk_mq_stop_hw_queues(struct request_queue *q);
238void blk_mq_start_hw_queues(struct request_queue *q); 247void blk_mq_start_hw_queues(struct request_queue *q);
239void blk_mq_start_stopped_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); 248void blk_mq_start_stopped_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
240void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); 249void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
250void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
251void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
241void blk_mq_run_hw_queues(struct request_queue *q, bool async); 252void blk_mq_run_hw_queues(struct request_queue *q, bool async);
242void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); 253void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
243void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, 254void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
244 busy_tag_iter_fn *fn, void *priv); 255 busy_tag_iter_fn *fn, void *priv);
245void blk_mq_freeze_queue(struct request_queue *q); 256void blk_mq_freeze_queue(struct request_queue *q);
246void blk_mq_unfreeze_queue(struct request_queue *q); 257void blk_mq_unfreeze_queue(struct request_queue *q);
247void blk_mq_freeze_queue_start(struct request_queue *q); 258void blk_freeze_queue_start(struct request_queue *q);
248void blk_mq_freeze_queue_wait(struct request_queue *q); 259void blk_mq_freeze_queue_wait(struct request_queue *q);
249int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, 260int blk_mq_freeze_queue_wait_timeout(struct request_queue *q,
250 unsigned long timeout); 261 unsigned long timeout);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index d703acb55d0f..61339bc44400 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -17,6 +17,10 @@ struct io_context;
17struct cgroup_subsys_state; 17struct cgroup_subsys_state;
18typedef void (bio_end_io_t) (struct bio *); 18typedef void (bio_end_io_t) (struct bio *);
19 19
20struct blk_issue_stat {
21 u64 stat;
22};
23
20/* 24/*
21 * main unit of I/O for the block layer and lower layers (ie drivers and 25 * main unit of I/O for the block layer and lower layers (ie drivers and
22 * stacking drivers) 26 * stacking drivers)
@@ -29,7 +33,7 @@ struct bio {
29 * top bits REQ_OP. Use 33 * top bits REQ_OP. Use
30 * accessors. 34 * accessors.
31 */ 35 */
32 unsigned short bi_flags; /* status, command, etc */ 36 unsigned short bi_flags; /* status, etc and bvec pool number */
33 unsigned short bi_ioprio; 37 unsigned short bi_ioprio;
34 38
35 struct bvec_iter bi_iter; 39 struct bvec_iter bi_iter;
@@ -58,6 +62,10 @@ struct bio {
58 */ 62 */
59 struct io_context *bi_ioc; 63 struct io_context *bi_ioc;
60 struct cgroup_subsys_state *bi_css; 64 struct cgroup_subsys_state *bi_css;
65#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
66 void *bi_cg_private;
67 struct blk_issue_stat bi_issue_stat;
68#endif
61#endif 69#endif
62 union { 70 union {
63#if defined(CONFIG_BLK_DEV_INTEGRITY) 71#if defined(CONFIG_BLK_DEV_INTEGRITY)
@@ -102,12 +110,9 @@ struct bio {
102#define BIO_REFFED 8 /* bio has elevated ->bi_cnt */ 110#define BIO_REFFED 8 /* bio has elevated ->bi_cnt */
103#define BIO_THROTTLED 9 /* This bio has already been subjected to 111#define BIO_THROTTLED 9 /* This bio has already been subjected to
104 * throttling rules. Don't do it again. */ 112 * throttling rules. Don't do it again. */
105 113#define BIO_TRACE_COMPLETION 10 /* bio_endio() should trace the final completion
106/* 114 * of this bio. */
107 * Flags starting here get preserved by bio_reset() - this includes 115/* See BVEC_POOL_OFFSET below before adding new flags */
108 * BVEC_POOL_IDX()
109 */
110#define BIO_RESET_BITS 10
111 116
112/* 117/*
113 * We support 6 different bvec pools, the last one is magic in that it 118 * We support 6 different bvec pools, the last one is magic in that it
@@ -117,13 +122,22 @@ struct bio {
117#define BVEC_POOL_MAX (BVEC_POOL_NR - 1) 122#define BVEC_POOL_MAX (BVEC_POOL_NR - 1)
118 123
119/* 124/*
120 * Top 4 bits of bio flags indicate the pool the bvecs came from. We add 125 * Top 3 bits of bio flags indicate the pool the bvecs came from. We add
121 * 1 to the actual index so that 0 indicates that there are no bvecs to be 126 * 1 to the actual index so that 0 indicates that there are no bvecs to be
122 * freed. 127 * freed.
123 */ 128 */
124#define BVEC_POOL_BITS (4) 129#define BVEC_POOL_BITS (3)
125#define BVEC_POOL_OFFSET (16 - BVEC_POOL_BITS) 130#define BVEC_POOL_OFFSET (16 - BVEC_POOL_BITS)
126#define BVEC_POOL_IDX(bio) ((bio)->bi_flags >> BVEC_POOL_OFFSET) 131#define BVEC_POOL_IDX(bio) ((bio)->bi_flags >> BVEC_POOL_OFFSET)
132#if (1<< BVEC_POOL_BITS) < (BVEC_POOL_NR+1)
133# error "BVEC_POOL_BITS is too small"
134#endif
135
136/*
137 * Flags starting here get preserved by bio_reset() - this includes
138 * only BVEC_POOL_IDX()
139 */
140#define BIO_RESET_BITS BVEC_POOL_OFFSET
127 141
128/* 142/*
129 * Operations and flags common to the bio and request structures. 143 * Operations and flags common to the bio and request structures.
@@ -160,7 +174,7 @@ enum req_opf {
160 /* write the same sector many times */ 174 /* write the same sector many times */
161 REQ_OP_WRITE_SAME = 7, 175 REQ_OP_WRITE_SAME = 7,
162 /* write the zero filled sector many times */ 176 /* write the zero filled sector many times */
163 REQ_OP_WRITE_ZEROES = 8, 177 REQ_OP_WRITE_ZEROES = 9,
164 178
165 /* SCSI passthrough using struct scsi_request */ 179 /* SCSI passthrough using struct scsi_request */
166 REQ_OP_SCSI_IN = 32, 180 REQ_OP_SCSI_IN = 32,
@@ -187,6 +201,10 @@ enum req_flag_bits {
187 __REQ_PREFLUSH, /* request for cache flush */ 201 __REQ_PREFLUSH, /* request for cache flush */
188 __REQ_RAHEAD, /* read ahead, can fail anytime */ 202 __REQ_RAHEAD, /* read ahead, can fail anytime */
189 __REQ_BACKGROUND, /* background IO */ 203 __REQ_BACKGROUND, /* background IO */
204
205 /* command specific flags for REQ_OP_WRITE_ZEROES: */
206 __REQ_NOUNMAP, /* do not free blocks when zeroing */
207
190 __REQ_NR_BITS, /* stops here */ 208 __REQ_NR_BITS, /* stops here */
191}; 209};
192 210
@@ -204,6 +222,8 @@ enum req_flag_bits {
204#define REQ_RAHEAD (1ULL << __REQ_RAHEAD) 222#define REQ_RAHEAD (1ULL << __REQ_RAHEAD)
205#define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) 223#define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND)
206 224
225#define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP)
226
207#define REQ_FAILFAST_MASK \ 227#define REQ_FAILFAST_MASK \
208 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 228 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
209 229
@@ -283,12 +303,6 @@ static inline bool blk_qc_t_is_internal(blk_qc_t cookie)
283 return (cookie & BLK_QC_T_INTERNAL) != 0; 303 return (cookie & BLK_QC_T_INTERNAL) != 0;
284} 304}
285 305
286struct blk_issue_stat {
287 u64 time;
288};
289
290#define BLK_RQ_STAT_BATCH 64
291
292struct blk_rq_stat { 306struct blk_rq_stat {
293 s64 mean; 307 s64 mean;
294 u64 min; 308 u64 min;
@@ -296,7 +310,6 @@ struct blk_rq_stat {
296 s32 nr_samples; 310 s32 nr_samples;
297 s32 nr_batch; 311 s32 nr_batch;
298 u64 batch; 312 u64 batch;
299 s64 time;
300}; 313};
301 314
302#endif /* __LINUX_BLK_TYPES_H */ 315#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5a7da607ca04..ab92c4ea138b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -40,15 +40,20 @@ struct blkcg_gq;
40struct blk_flush_queue; 40struct blk_flush_queue;
41struct pr_ops; 41struct pr_ops;
42struct rq_wb; 42struct rq_wb;
43struct blk_queue_stats;
44struct blk_stat_callback;
43 45
44#define BLKDEV_MIN_RQ 4 46#define BLKDEV_MIN_RQ 4
45#define BLKDEV_MAX_RQ 128 /* Default maximum */ 47#define BLKDEV_MAX_RQ 128 /* Default maximum */
46 48
49/* Must be consisitent with blk_mq_poll_stats_bkt() */
50#define BLK_MQ_POLL_STATS_BKTS 16
51
47/* 52/*
48 * Maximum number of blkcg policies allowed to be registered concurrently. 53 * Maximum number of blkcg policies allowed to be registered concurrently.
49 * Defined here to simplify include dependency. 54 * Defined here to simplify include dependency.
50 */ 55 */
51#define BLKCG_MAX_POLS 2 56#define BLKCG_MAX_POLS 3
52 57
53typedef void (rq_end_io_fn)(struct request *, int); 58typedef void (rq_end_io_fn)(struct request *, int);
54 59
@@ -173,6 +178,7 @@ struct request {
173 struct rb_node rb_node; /* sort/lookup */ 178 struct rb_node rb_node; /* sort/lookup */
174 struct bio_vec special_vec; 179 struct bio_vec special_vec;
175 void *completion_data; 180 void *completion_data;
181 int error_count; /* for legacy drivers, don't use */
176 }; 182 };
177 183
178 /* 184 /*
@@ -213,16 +219,14 @@ struct request {
213 219
214 unsigned short ioprio; 220 unsigned short ioprio;
215 221
216 void *special; /* opaque pointer available for LLD use */ 222 unsigned int timeout;
217 223
218 int errors; 224 void *special; /* opaque pointer available for LLD use */
219 225
220 unsigned int extra_len; /* length of alignment and padding */ 226 unsigned int extra_len; /* length of alignment and padding */
221 227
222 unsigned long deadline; 228 unsigned long deadline;
223 struct list_head timeout_list; 229 struct list_head timeout_list;
224 unsigned int timeout;
225 int retries;
226 230
227 /* 231 /*
228 * completion callback. 232 * completion callback.
@@ -337,7 +341,6 @@ struct queue_limits {
337 unsigned char misaligned; 341 unsigned char misaligned;
338 unsigned char discard_misaligned; 342 unsigned char discard_misaligned;
339 unsigned char cluster; 343 unsigned char cluster;
340 unsigned char discard_zeroes_data;
341 unsigned char raid_partial_stripes_expensive; 344 unsigned char raid_partial_stripes_expensive;
342 enum blk_zoned_model zoned; 345 enum blk_zoned_model zoned;
343}; 346};
@@ -388,6 +391,7 @@ struct request_queue {
388 int nr_rqs[2]; /* # allocated [a]sync rqs */ 391 int nr_rqs[2]; /* # allocated [a]sync rqs */
389 int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */ 392 int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */
390 393
394 struct blk_queue_stats *stats;
391 struct rq_wb *rq_wb; 395 struct rq_wb *rq_wb;
392 396
393 /* 397 /*
@@ -505,8 +509,6 @@ struct request_queue {
505 unsigned int nr_sorted; 509 unsigned int nr_sorted;
506 unsigned int in_flight[2]; 510 unsigned int in_flight[2];
507 511
508 struct blk_rq_stat rq_stats[2];
509
510 /* 512 /*
511 * Number of active block driver functions for which blk_drain_queue() 513 * Number of active block driver functions for which blk_drain_queue()
512 * must wait. Must be incremented around functions that unlock the 514 * must wait. Must be incremented around functions that unlock the
@@ -516,6 +518,10 @@ struct request_queue {
516 518
517 unsigned int rq_timeout; 519 unsigned int rq_timeout;
518 int poll_nsec; 520 int poll_nsec;
521
522 struct blk_stat_callback *poll_cb;
523 struct blk_rq_stat poll_stat[BLK_MQ_POLL_STATS_BKTS];
524
519 struct timer_list timeout; 525 struct timer_list timeout;
520 struct work_struct timeout_work; 526 struct work_struct timeout_work;
521 struct list_head timeout_list; 527 struct list_head timeout_list;
@@ -573,7 +579,7 @@ struct request_queue {
573 579
574#ifdef CONFIG_BLK_DEBUG_FS 580#ifdef CONFIG_BLK_DEBUG_FS
575 struct dentry *debugfs_dir; 581 struct dentry *debugfs_dir;
576 struct dentry *mq_debugfs_dir; 582 struct dentry *sched_debugfs_dir;
577#endif 583#endif
578 584
579 bool mq_sysfs_init_done; 585 bool mq_sysfs_init_done;
@@ -610,7 +616,8 @@ struct request_queue {
610#define QUEUE_FLAG_FLUSH_NQ 25 /* flush not queueuable */ 616#define QUEUE_FLAG_FLUSH_NQ 25 /* flush not queueuable */
611#define QUEUE_FLAG_DAX 26 /* device supports DAX */ 617#define QUEUE_FLAG_DAX 26 /* device supports DAX */
612#define QUEUE_FLAG_STATS 27 /* track rq completion times */ 618#define QUEUE_FLAG_STATS 27 /* track rq completion times */
613#define QUEUE_FLAG_RESTART 28 /* queue needs restart at completion */ 619#define QUEUE_FLAG_POLL_STATS 28 /* collecting stats for hybrid polling */
620#define QUEUE_FLAG_REGISTERED 29 /* queue has been registered to a disk */
614 621
615#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 622#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
616 (1 << QUEUE_FLAG_STACKABLE) | \ 623 (1 << QUEUE_FLAG_STACKABLE) | \
@@ -919,6 +926,7 @@ extern int blk_register_queue(struct gendisk *disk);
919extern void blk_unregister_queue(struct gendisk *disk); 926extern void blk_unregister_queue(struct gendisk *disk);
920extern blk_qc_t generic_make_request(struct bio *bio); 927extern blk_qc_t generic_make_request(struct bio *bio);
921extern void blk_rq_init(struct request_queue *q, struct request *rq); 928extern void blk_rq_init(struct request_queue *q, struct request *rq);
929extern void blk_init_request_from_bio(struct request *req, struct bio *bio);
922extern void blk_put_request(struct request *); 930extern void blk_put_request(struct request *);
923extern void __blk_put_request(struct request_queue *, struct request *); 931extern void __blk_put_request(struct request_queue *, struct request *);
924extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 932extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
@@ -964,7 +972,7 @@ extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, uns
964extern int blk_rq_map_user_iov(struct request_queue *, struct request *, 972extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
965 struct rq_map_data *, const struct iov_iter *, 973 struct rq_map_data *, const struct iov_iter *,
966 gfp_t); 974 gfp_t);
967extern int blk_execute_rq(struct request_queue *, struct gendisk *, 975extern void blk_execute_rq(struct request_queue *, struct gendisk *,
968 struct request *, int); 976 struct request *, int);
969extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 977extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
970 struct request *, int, rq_end_io_fn *); 978 struct request *, int, rq_end_io_fn *);
@@ -1082,20 +1090,6 @@ static inline unsigned int blk_rq_count_bios(struct request *rq)
1082} 1090}
1083 1091
1084/* 1092/*
1085 * blk_rq_set_prio - associate a request with prio from ioc
1086 * @rq: request of interest
1087 * @ioc: target iocontext
1088 *
1089 * Assocate request prio with ioc prio so request based drivers
1090 * can leverage priority information.
1091 */
1092static inline void blk_rq_set_prio(struct request *rq, struct io_context *ioc)
1093{
1094 if (ioc)
1095 rq->ioprio = ioc->ioprio;
1096}
1097
1098/*
1099 * Request issue related functions. 1093 * Request issue related functions.
1100 */ 1094 */
1101extern struct request *blk_peek_request(struct request_queue *q); 1095extern struct request *blk_peek_request(struct request_queue *q);
@@ -1121,13 +1115,10 @@ extern void blk_finish_request(struct request *rq, int error);
1121extern bool blk_end_request(struct request *rq, int error, 1115extern bool blk_end_request(struct request *rq, int error,
1122 unsigned int nr_bytes); 1116 unsigned int nr_bytes);
1123extern void blk_end_request_all(struct request *rq, int error); 1117extern void blk_end_request_all(struct request *rq, int error);
1124extern bool blk_end_request_cur(struct request *rq, int error);
1125extern bool blk_end_request_err(struct request *rq, int error);
1126extern bool __blk_end_request(struct request *rq, int error, 1118extern bool __blk_end_request(struct request *rq, int error,
1127 unsigned int nr_bytes); 1119 unsigned int nr_bytes);
1128extern void __blk_end_request_all(struct request *rq, int error); 1120extern void __blk_end_request_all(struct request *rq, int error);
1129extern bool __blk_end_request_cur(struct request *rq, int error); 1121extern bool __blk_end_request_cur(struct request *rq, int error);
1130extern bool __blk_end_request_err(struct request *rq, int error);
1131 1122
1132extern void blk_complete_request(struct request *); 1123extern void blk_complete_request(struct request *);
1133extern void __blk_complete_request(struct request *); 1124extern void __blk_complete_request(struct request *);
@@ -1330,23 +1321,27 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
1330 return bqt->tag_index[tag]; 1321 return bqt->tag_index[tag];
1331} 1322}
1332 1323
1324extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *);
1325extern int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
1326 sector_t nr_sects, gfp_t gfp_mask, struct page *page);
1333 1327
1334#define BLKDEV_DISCARD_SECURE (1 << 0) /* issue a secure erase */ 1328#define BLKDEV_DISCARD_SECURE (1 << 0) /* issue a secure erase */
1335#define BLKDEV_DISCARD_ZERO (1 << 1) /* must reliably zero data */
1336 1329
1337extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *);
1338extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, 1330extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
1339 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags); 1331 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
1340extern int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, 1332extern int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
1341 sector_t nr_sects, gfp_t gfp_mask, int flags, 1333 sector_t nr_sects, gfp_t gfp_mask, int flags,
1342 struct bio **biop); 1334 struct bio **biop);
1343extern int blkdev_issue_write_same(struct block_device *bdev, sector_t sector, 1335
1344 sector_t nr_sects, gfp_t gfp_mask, struct page *page); 1336#define BLKDEV_ZERO_NOUNMAP (1 << 0) /* do not free blocks */
1337#define BLKDEV_ZERO_NOFALLBACK (1 << 1) /* don't write explicit zeroes */
1338
1345extern int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, 1339extern int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
1346 sector_t nr_sects, gfp_t gfp_mask, struct bio **biop, 1340 sector_t nr_sects, gfp_t gfp_mask, struct bio **biop,
1347 bool discard); 1341 unsigned flags);
1348extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, 1342extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
1349 sector_t nr_sects, gfp_t gfp_mask, bool discard); 1343 sector_t nr_sects, gfp_t gfp_mask, unsigned flags);
1344
1350static inline int sb_issue_discard(struct super_block *sb, sector_t block, 1345static inline int sb_issue_discard(struct super_block *sb, sector_t block,
1351 sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags) 1346 sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags)
1352{ 1347{
@@ -1360,7 +1355,7 @@ static inline int sb_issue_zeroout(struct super_block *sb, sector_t block,
1360 return blkdev_issue_zeroout(sb->s_bdev, 1355 return blkdev_issue_zeroout(sb->s_bdev,
1361 block << (sb->s_blocksize_bits - 9), 1356 block << (sb->s_blocksize_bits - 9),
1362 nr_blocks << (sb->s_blocksize_bits - 9), 1357 nr_blocks << (sb->s_blocksize_bits - 9),
1363 gfp_mask, true); 1358 gfp_mask, 0);
1364} 1359}
1365 1360
1366extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); 1361extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
@@ -1530,19 +1525,6 @@ static inline int bdev_discard_alignment(struct block_device *bdev)
1530 return q->limits.discard_alignment; 1525 return q->limits.discard_alignment;
1531} 1526}
1532 1527
1533static inline unsigned int queue_discard_zeroes_data(struct request_queue *q)
1534{
1535 if (q->limits.max_discard_sectors && q->limits.discard_zeroes_data == 1)
1536 return 1;
1537
1538 return 0;
1539}
1540
1541static inline unsigned int bdev_discard_zeroes_data(struct block_device *bdev)
1542{
1543 return queue_discard_zeroes_data(bdev_get_queue(bdev));
1544}
1545
1546static inline unsigned int bdev_write_same(struct block_device *bdev) 1528static inline unsigned int bdev_write_same(struct block_device *bdev)
1547{ 1529{
1548 struct request_queue *q = bdev_get_queue(bdev); 1530 struct request_queue *q = bdev_get_queue(bdev);
@@ -1673,12 +1655,36 @@ static inline bool bios_segs_mergeable(struct request_queue *q,
1673 return true; 1655 return true;
1674} 1656}
1675 1657
1676static inline bool bio_will_gap(struct request_queue *q, struct bio *prev, 1658static inline bool bio_will_gap(struct request_queue *q,
1677 struct bio *next) 1659 struct request *prev_rq,
1660 struct bio *prev,
1661 struct bio *next)
1678{ 1662{
1679 if (bio_has_data(prev) && queue_virt_boundary(q)) { 1663 if (bio_has_data(prev) && queue_virt_boundary(q)) {
1680 struct bio_vec pb, nb; 1664 struct bio_vec pb, nb;
1681 1665
1666 /*
1667 * don't merge if the 1st bio starts with non-zero
1668 * offset, otherwise it is quite difficult to respect
1669 * sg gap limit. We work hard to merge a huge number of small
1670 * single bios in case of mkfs.
1671 */
1672 if (prev_rq)
1673 bio_get_first_bvec(prev_rq->bio, &pb);
1674 else
1675 bio_get_first_bvec(prev, &pb);
1676 if (pb.bv_offset)
1677 return true;
1678
1679 /*
1680 * We don't need to worry about the situation that the
1681 * merged segment ends in unaligned virt boundary:
1682 *
1683 * - if 'pb' ends aligned, the merged segment ends aligned
1684 * - if 'pb' ends unaligned, the next bio must include
1685 * one single bvec of 'nb', otherwise the 'nb' can't
1686 * merge with 'pb'
1687 */
1682 bio_get_last_bvec(prev, &pb); 1688 bio_get_last_bvec(prev, &pb);
1683 bio_get_first_bvec(next, &nb); 1689 bio_get_first_bvec(next, &nb);
1684 1690
@@ -1691,18 +1697,19 @@ static inline bool bio_will_gap(struct request_queue *q, struct bio *prev,
1691 1697
1692static inline bool req_gap_back_merge(struct request *req, struct bio *bio) 1698static inline bool req_gap_back_merge(struct request *req, struct bio *bio)
1693{ 1699{
1694 return bio_will_gap(req->q, req->biotail, bio); 1700 return bio_will_gap(req->q, req, req->biotail, bio);
1695} 1701}
1696 1702
1697static inline bool req_gap_front_merge(struct request *req, struct bio *bio) 1703static inline bool req_gap_front_merge(struct request *req, struct bio *bio)
1698{ 1704{
1699 return bio_will_gap(req->q, bio, req->bio); 1705 return bio_will_gap(req->q, NULL, bio, req->bio);
1700} 1706}
1701 1707
1702int kblockd_schedule_work(struct work_struct *work); 1708int kblockd_schedule_work(struct work_struct *work);
1703int kblockd_schedule_work_on(int cpu, struct work_struct *work); 1709int kblockd_schedule_work_on(int cpu, struct work_struct *work);
1704int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay); 1710int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay);
1705int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay); 1711int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
1712int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
1706 1713
1707#ifdef CONFIG_BLK_CGROUP 1714#ifdef CONFIG_BLK_CGROUP
1708/* 1715/*
@@ -1916,28 +1923,12 @@ static inline bool integrity_req_gap_front_merge(struct request *req,
1916 1923
1917#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1924#endif /* CONFIG_BLK_DEV_INTEGRITY */
1918 1925
1919/**
1920 * struct blk_dax_ctl - control and output parameters for ->direct_access
1921 * @sector: (input) offset relative to a block_device
1922 * @addr: (output) kernel virtual address for @sector populated by driver
1923 * @pfn: (output) page frame number for @addr populated by driver
1924 * @size: (input) number of bytes requested
1925 */
1926struct blk_dax_ctl {
1927 sector_t sector;
1928 void *addr;
1929 long size;
1930 pfn_t pfn;
1931};
1932
1933struct block_device_operations { 1926struct block_device_operations {
1934 int (*open) (struct block_device *, fmode_t); 1927 int (*open) (struct block_device *, fmode_t);
1935 void (*release) (struct gendisk *, fmode_t); 1928 void (*release) (struct gendisk *, fmode_t);
1936 int (*rw_page)(struct block_device *, sector_t, struct page *, bool); 1929 int (*rw_page)(struct block_device *, sector_t, struct page *, bool);
1937 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1930 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1938 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1931 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1939 long (*direct_access)(struct block_device *, sector_t, void **, pfn_t *,
1940 long);
1941 unsigned int (*check_events) (struct gendisk *disk, 1932 unsigned int (*check_events) (struct gendisk *disk,
1942 unsigned int clearing); 1933 unsigned int clearing);
1943 /* ->media_changed() is DEPRECATED, use ->check_events() instead */ 1934 /* ->media_changed() is DEPRECATED, use ->check_events() instead */
@@ -1956,9 +1947,6 @@ extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int,
1956extern int bdev_read_page(struct block_device *, sector_t, struct page *); 1947extern int bdev_read_page(struct block_device *, sector_t, struct page *);
1957extern int bdev_write_page(struct block_device *, sector_t, struct page *, 1948extern int bdev_write_page(struct block_device *, sector_t, struct page *,
1958 struct writeback_control *); 1949 struct writeback_control *);
1959extern long bdev_direct_access(struct block_device *, struct blk_dax_ctl *);
1960extern int bdev_dax_supported(struct super_block *, int);
1961extern bool bdev_dax_capable(struct block_device *);
1962#else /* CONFIG_BLOCK */ 1950#else /* CONFIG_BLOCK */
1963 1951
1964struct block_device; 1952struct block_device;
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 909fc033173a..6bb38d76faf4 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -35,6 +35,7 @@ struct bpf_map_ops {
35 void *(*map_fd_get_ptr)(struct bpf_map *map, struct file *map_file, 35 void *(*map_fd_get_ptr)(struct bpf_map *map, struct file *map_file,
36 int fd); 36 int fd);
37 void (*map_fd_put_ptr)(void *ptr); 37 void (*map_fd_put_ptr)(void *ptr);
38 u32 (*map_gen_lookup)(struct bpf_map *map, struct bpf_insn *insn_buf);
38}; 39};
39 40
40struct bpf_map { 41struct bpf_map {
@@ -49,12 +50,7 @@ struct bpf_map {
49 const struct bpf_map_ops *ops; 50 const struct bpf_map_ops *ops;
50 struct work_struct work; 51 struct work_struct work;
51 atomic_t usercnt; 52 atomic_t usercnt;
52}; 53 struct bpf_map *inner_map_meta;
53
54struct bpf_map_type_list {
55 struct list_head list_node;
56 const struct bpf_map_ops *ops;
57 enum bpf_map_type type;
58}; 54};
59 55
60/* function argument constraints */ 56/* function argument constraints */
@@ -167,12 +163,8 @@ struct bpf_verifier_ops {
167 const struct bpf_insn *src, 163 const struct bpf_insn *src,
168 struct bpf_insn *dst, 164 struct bpf_insn *dst,
169 struct bpf_prog *prog); 165 struct bpf_prog *prog);
170}; 166 int (*test_run)(struct bpf_prog *prog, const union bpf_attr *kattr,
171 167 union bpf_attr __user *uattr);
172struct bpf_prog_type_list {
173 struct list_head list_node;
174 const struct bpf_verifier_ops *ops;
175 enum bpf_prog_type type;
176}; 168};
177 169
178struct bpf_prog_aux { 170struct bpf_prog_aux {
@@ -231,11 +223,21 @@ typedef unsigned long (*bpf_ctx_copy_t)(void *dst, const void *src,
231u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, 223u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size,
232 void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy); 224 void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy);
233 225
226int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
227 union bpf_attr __user *uattr);
228int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
229 union bpf_attr __user *uattr);
230
234#ifdef CONFIG_BPF_SYSCALL 231#ifdef CONFIG_BPF_SYSCALL
235DECLARE_PER_CPU(int, bpf_prog_active); 232DECLARE_PER_CPU(int, bpf_prog_active);
236 233
237void bpf_register_prog_type(struct bpf_prog_type_list *tl); 234#define BPF_PROG_TYPE(_id, _ops) \
238void bpf_register_map_type(struct bpf_map_type_list *tl); 235 extern const struct bpf_verifier_ops _ops;
236#define BPF_MAP_TYPE(_id, _ops) \
237 extern const struct bpf_map_ops _ops;
238#include <linux/bpf_types.h>
239#undef BPF_PROG_TYPE
240#undef BPF_MAP_TYPE
239 241
240struct bpf_prog *bpf_prog_get(u32 ufd); 242struct bpf_prog *bpf_prog_get(u32 ufd);
241struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type); 243struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type);
@@ -275,6 +277,8 @@ int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value);
275int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file, 277int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file,
276 void *key, void *value, u64 map_flags); 278 void *key, void *value, u64 map_flags);
277void bpf_fd_array_map_clear(struct bpf_map *map); 279void bpf_fd_array_map_clear(struct bpf_map *map);
280int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file,
281 void *key, void *value, u64 map_flags);
278 282
279/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and 283/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and
280 * forced to use 'long' read/writes to try to atomically copy long counters. 284 * forced to use 'long' read/writes to try to atomically copy long counters.
@@ -295,10 +299,6 @@ static inline void bpf_long_memcpy(void *dst, const void *src, u32 size)
295/* verify correctness of eBPF program */ 299/* verify correctness of eBPF program */
296int bpf_check(struct bpf_prog **fp, union bpf_attr *attr); 300int bpf_check(struct bpf_prog **fp, union bpf_attr *attr);
297#else 301#else
298static inline void bpf_register_prog_type(struct bpf_prog_type_list *tl)
299{
300}
301
302static inline struct bpf_prog *bpf_prog_get(u32 ufd) 302static inline struct bpf_prog *bpf_prog_get(u32 ufd)
303{ 303{
304 return ERR_PTR(-EOPNOTSUPP); 304 return ERR_PTR(-EOPNOTSUPP);
diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h
new file mode 100644
index 000000000000..03bf223f18be
--- /dev/null
+++ b/include/linux/bpf_types.h
@@ -0,0 +1,36 @@
1/* internal file - do not include directly */
2
3#ifdef CONFIG_NET
4BPF_PROG_TYPE(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter_prog_ops)
5BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act_prog_ops)
6BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_ACT, tc_cls_act_prog_ops)
7BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp_prog_ops)
8BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb_prog_ops)
9BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock_prog_ops)
10BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_inout_prog_ops)
11BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_inout_prog_ops)
12BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit_prog_ops)
13#endif
14#ifdef CONFIG_BPF_EVENTS
15BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe_prog_ops)
16BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint_prog_ops)
17BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event_prog_ops)
18#endif
19
20BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops)
21BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, percpu_array_map_ops)
22BPF_MAP_TYPE(BPF_MAP_TYPE_PROG_ARRAY, prog_array_map_ops)
23BPF_MAP_TYPE(BPF_MAP_TYPE_PERF_EVENT_ARRAY, perf_event_array_map_ops)
24#ifdef CONFIG_CGROUPS
25BPF_MAP_TYPE(BPF_MAP_TYPE_CGROUP_ARRAY, cgroup_array_map_ops)
26#endif
27BPF_MAP_TYPE(BPF_MAP_TYPE_HASH, htab_map_ops)
28BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_HASH, htab_percpu_map_ops)
29BPF_MAP_TYPE(BPF_MAP_TYPE_LRU_HASH, htab_lru_map_ops)
30BPF_MAP_TYPE(BPF_MAP_TYPE_LRU_PERCPU_HASH, htab_lru_percpu_map_ops)
31BPF_MAP_TYPE(BPF_MAP_TYPE_LPM_TRIE, trie_map_ops)
32#ifdef CONFIG_PERF_EVENTS
33BPF_MAP_TYPE(BPF_MAP_TYPE_STACK_TRACE, stack_map_ops)
34#endif
35BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_of_maps_map_ops)
36BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops)
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index a13b031dc6b8..d5093b52b485 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -40,6 +40,9 @@ struct bpf_reg_state {
40 */ 40 */
41 s64 min_value; 41 s64 min_value;
42 u64 max_value; 42 u64 max_value;
43 u32 min_align;
44 u32 aux_off;
45 u32 aux_off_align;
43}; 46};
44 47
45enum bpf_stack_slot_type { 48enum bpf_stack_slot_type {
@@ -66,7 +69,10 @@ struct bpf_verifier_state_list {
66}; 69};
67 70
68struct bpf_insn_aux_data { 71struct bpf_insn_aux_data {
69 enum bpf_reg_type ptr_type; /* pointer type for load/store insns */ 72 union {
73 enum bpf_reg_type ptr_type; /* pointer type for load/store insns */
74 struct bpf_map *map_ptr; /* pointer for call insn into lookup_elem */
75 };
70}; 76};
71 77
72#define MAX_USED_MAPS 64 /* max number of maps accessed by one eBPF program */ 78#define MAX_USED_MAPS 64 /* max number of maps accessed by one eBPF program */
@@ -84,6 +90,7 @@ struct bpf_verifier_env {
84 struct bpf_prog *prog; /* eBPF program being verified */ 90 struct bpf_prog *prog; /* eBPF program being verified */
85 struct bpf_verifier_stack_elem *head; /* stack of verifier states to be processed */ 91 struct bpf_verifier_stack_elem *head; /* stack of verifier states to be processed */
86 int stack_size; /* number of states to be processed */ 92 int stack_size; /* number of states to be processed */
93 bool strict_alignment; /* perform strict pointer alignment checks */
87 struct bpf_verifier_state cur_state; /* current verifier state */ 94 struct bpf_verifier_state cur_state; /* current verifier state */
88 struct bpf_verifier_state_list **explored_states; /* search pruning optimization */ 95 struct bpf_verifier_state_list **explored_states; /* search pruning optimization */
89 const struct bpf_ext_analyzer_ops *analyzer_ops; /* external analyzer ops */ 96 const struct bpf_ext_analyzer_ops *analyzer_ops; /* external analyzer ops */
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 55e517130311..abcda9b458ab 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -25,6 +25,9 @@
25#define PHY_ID_BCM57780 0x03625d90 25#define PHY_ID_BCM57780 0x03625d90
26 26
27#define PHY_ID_BCM7250 0xae025280 27#define PHY_ID_BCM7250 0xae025280
28#define PHY_ID_BCM7260 0xae025190
29#define PHY_ID_BCM7268 0xae025090
30#define PHY_ID_BCM7271 0xae0253b0
28#define PHY_ID_BCM7278 0xae0251a0 31#define PHY_ID_BCM7278 0xae0251a0
29#define PHY_ID_BCM7364 0xae025260 32#define PHY_ID_BCM7364 0xae025260
30#define PHY_ID_BCM7366 0x600d8490 33#define PHY_ID_BCM7366 0x600d8490
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 79591c3660cc..bd029e52ef5e 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -196,8 +196,6 @@ void ll_rw_block(int, int, int, struct buffer_head * bh[]);
196int sync_dirty_buffer(struct buffer_head *bh); 196int sync_dirty_buffer(struct buffer_head *bh);
197int __sync_dirty_buffer(struct buffer_head *bh, int op_flags); 197int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
198void write_dirty_buffer(struct buffer_head *bh, int op_flags); 198void write_dirty_buffer(struct buffer_head *bh, int op_flags);
199int _submit_bh(int op, int op_flags, struct buffer_head *bh,
200 unsigned long bio_flags);
201int submit_bh(int, int, struct buffer_head *); 199int submit_bh(int, int, struct buffer_head *);
202void write_boundary_block(struct block_device *bdev, 200void write_boundary_block(struct block_device *bdev,
203 sector_t bblock, unsigned blocksize); 201 sector_t bblock, unsigned blocksize);
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 5828489309bb..687b557fc5eb 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -105,7 +105,7 @@ static inline int is_warning_bug(const struct bug_entry *bug)
105 return bug->flags & BUGFLAG_WARNING; 105 return bug->flags & BUGFLAG_WARNING;
106} 106}
107 107
108const struct bug_entry *find_bug(unsigned long bugaddr); 108struct bug_entry *find_bug(unsigned long bugaddr);
109 109
110enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); 110enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);
111 111
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index df08a41d5be5..c9a17bb1221c 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> 6 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Urs Thuermann <urs.thuermann@volkswagen.de> 7 * Urs Thuermann <urs.thuermann@volkswagen.de>
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 8 * Copyright (c) 2002-2017 Volkswagen Group Electronic Research
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 */ 11 */
@@ -17,7 +17,7 @@
17#include <linux/skbuff.h> 17#include <linux/skbuff.h>
18#include <linux/netdevice.h> 18#include <linux/netdevice.h>
19 19
20#define CAN_VERSION "20120528" 20#define CAN_VERSION "20170425"
21 21
22/* increment this number each time you change some user-space interface */ 22/* increment this number each time you change some user-space interface */
23#define CAN_ABI_VERSION "9" 23#define CAN_ABI_VERSION "9"
@@ -45,12 +45,13 @@ struct can_proto {
45extern int can_proto_register(const struct can_proto *cp); 45extern int can_proto_register(const struct can_proto *cp);
46extern void can_proto_unregister(const struct can_proto *cp); 46extern void can_proto_unregister(const struct can_proto *cp);
47 47
48int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask, 48int can_rx_register(struct net *net, struct net_device *dev,
49 canid_t can_id, canid_t mask,
49 void (*func)(struct sk_buff *, void *), 50 void (*func)(struct sk_buff *, void *),
50 void *data, char *ident, struct sock *sk); 51 void *data, char *ident, struct sock *sk);
51 52
52extern void can_rx_unregister(struct net_device *dev, canid_t can_id, 53extern void can_rx_unregister(struct net *net, struct net_device *dev,
53 canid_t mask, 54 canid_t can_id, canid_t mask,
54 void (*func)(struct sk_buff *, void *), 55 void (*func)(struct sk_buff *, void *),
55 void *data); 56 void *data);
56 57
diff --git a/include/linux/can/dev/peak_canfd.h b/include/linux/can/dev/peak_canfd.h
new file mode 100644
index 000000000000..46dceef2cfa6
--- /dev/null
+++ b/include/linux/can/dev/peak_canfd.h
@@ -0,0 +1,308 @@
1/*
2 * CAN driver for PEAK System micro-CAN based adapters
3 *
4 * Copyright (C) 2003-2011 PEAK System-Technik GmbH
5 * Copyright (C) 2011-2013 Stephane Grosjean <s.grosjean@peak-system.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 */
16#ifndef PUCAN_H
17#define PUCAN_H
18
19/* uCAN commands opcodes list (low-order 10 bits) */
20#define PUCAN_CMD_NOP 0x000
21#define PUCAN_CMD_RESET_MODE 0x001
22#define PUCAN_CMD_NORMAL_MODE 0x002
23#define PUCAN_CMD_LISTEN_ONLY_MODE 0x003
24#define PUCAN_CMD_TIMING_SLOW 0x004
25#define PUCAN_CMD_TIMING_FAST 0x005
26#define PUCAN_CMD_SET_STD_FILTER 0x006
27#define PUCAN_CMD_RESERVED2 0x007
28#define PUCAN_CMD_FILTER_STD 0x008
29#define PUCAN_CMD_TX_ABORT 0x009
30#define PUCAN_CMD_WR_ERR_CNT 0x00a
31#define PUCAN_CMD_SET_EN_OPTION 0x00b
32#define PUCAN_CMD_CLR_DIS_OPTION 0x00c
33#define PUCAN_CMD_RX_BARRIER 0x010
34#define PUCAN_CMD_END_OF_COLLECTION 0x3ff
35
36/* uCAN received messages list */
37#define PUCAN_MSG_CAN_RX 0x0001
38#define PUCAN_MSG_ERROR 0x0002
39#define PUCAN_MSG_STATUS 0x0003
40#define PUCAN_MSG_BUSLOAD 0x0004
41
42#define PUCAN_MSG_CACHE_CRITICAL 0x0102
43
44/* uCAN transmitted messages */
45#define PUCAN_MSG_CAN_TX 0x1000
46
47/* uCAN command common header */
48struct __packed pucan_command {
49 __le16 opcode_channel;
50 u16 args[3];
51};
52
53/* return the opcode from the opcode_channel field of a command */
54static inline u16 pucan_cmd_get_opcode(struct pucan_command *c)
55{
56 return le16_to_cpu(c->opcode_channel) & 0x3ff;
57}
58
59#define PUCAN_TSLOW_BRP_BITS 10
60#define PUCAN_TSLOW_TSGEG1_BITS 8
61#define PUCAN_TSLOW_TSGEG2_BITS 7
62#define PUCAN_TSLOW_SJW_BITS 7
63
64#define PUCAN_TSLOW_BRP_MASK ((1 << PUCAN_TSLOW_BRP_BITS) - 1)
65#define PUCAN_TSLOW_TSEG1_MASK ((1 << PUCAN_TSLOW_TSGEG1_BITS) - 1)
66#define PUCAN_TSLOW_TSEG2_MASK ((1 << PUCAN_TSLOW_TSGEG2_BITS) - 1)
67#define PUCAN_TSLOW_SJW_MASK ((1 << PUCAN_TSLOW_SJW_BITS) - 1)
68
69/* uCAN TIMING_SLOW command fields */
70#define PUCAN_TSLOW_SJW_T(s, t) (((s) & PUCAN_TSLOW_SJW_MASK) | \
71 ((!!(t)) << 7))
72#define PUCAN_TSLOW_TSEG2(t) ((t) & PUCAN_TSLOW_TSEG2_MASK)
73#define PUCAN_TSLOW_TSEG1(t) ((t) & PUCAN_TSLOW_TSEG1_MASK)
74#define PUCAN_TSLOW_BRP(b) ((b) & PUCAN_TSLOW_BRP_MASK)
75
76struct __packed pucan_timing_slow {
77 __le16 opcode_channel;
78
79 u8 ewl; /* Error Warning limit */
80 u8 sjw_t; /* Sync Jump Width + Triple sampling */
81 u8 tseg2; /* Timing SEGment 2 */
82 u8 tseg1; /* Timing SEGment 1 */
83
84 __le16 brp; /* BaudRate Prescaler */
85};
86
87#define PUCAN_TFAST_BRP_BITS 10
88#define PUCAN_TFAST_TSGEG1_BITS 5
89#define PUCAN_TFAST_TSGEG2_BITS 4
90#define PUCAN_TFAST_SJW_BITS 4
91
92#define PUCAN_TFAST_BRP_MASK ((1 << PUCAN_TFAST_BRP_BITS) - 1)
93#define PUCAN_TFAST_TSEG1_MASK ((1 << PUCAN_TFAST_TSGEG1_BITS) - 1)
94#define PUCAN_TFAST_TSEG2_MASK ((1 << PUCAN_TFAST_TSGEG2_BITS) - 1)
95#define PUCAN_TFAST_SJW_MASK ((1 << PUCAN_TFAST_SJW_BITS) - 1)
96
97/* uCAN TIMING_FAST command fields */
98#define PUCAN_TFAST_SJW(s) ((s) & PUCAN_TFAST_SJW_MASK)
99#define PUCAN_TFAST_TSEG2(t) ((t) & PUCAN_TFAST_TSEG2_MASK)
100#define PUCAN_TFAST_TSEG1(t) ((t) & PUCAN_TFAST_TSEG1_MASK)
101#define PUCAN_TFAST_BRP(b) ((b) & PUCAN_TFAST_BRP_MASK)
102
103struct __packed pucan_timing_fast {
104 __le16 opcode_channel;
105
106 u8 unused;
107 u8 sjw; /* Sync Jump Width */
108 u8 tseg2; /* Timing SEGment 2 */
109 u8 tseg1; /* Timing SEGment 1 */
110
111 __le16 brp; /* BaudRate Prescaler */
112};
113
114/* uCAN FILTER_STD command fields */
115#define PUCAN_FLTSTD_ROW_IDX_BITS 6
116
117struct __packed pucan_filter_std {
118 __le16 opcode_channel;
119
120 __le16 idx;
121 __le32 mask; /* CAN-ID bitmask in idx range */
122};
123
124#define PUCAN_FLTSTD_ROW_IDX_MAX ((1 << PUCAN_FLTSTD_ROW_IDX_BITS) - 1)
125
126/* uCAN SET_STD_FILTER command fields */
127struct __packed pucan_std_filter {
128 __le16 opcode_channel;
129
130 u8 unused;
131 u8 idx;
132 __le32 mask; /* CAN-ID bitmask in idx range */
133};
134
135/* uCAN TX_ABORT commands fields */
136#define PUCAN_TX_ABORT_FLUSH 0x0001
137
138struct __packed pucan_tx_abort {
139 __le16 opcode_channel;
140
141 __le16 flags;
142 u32 unused;
143};
144
145/* uCAN WR_ERR_CNT command fields */
146#define PUCAN_WRERRCNT_TE 0x4000 /* Tx error cntr write Enable */
147#define PUCAN_WRERRCNT_RE 0x8000 /* Rx error cntr write Enable */
148
149struct __packed pucan_wr_err_cnt {
150 __le16 opcode_channel;
151
152 __le16 sel_mask;
153 u8 tx_counter; /* Tx error counter new value */
154 u8 rx_counter; /* Rx error counter new value */
155
156 u16 unused;
157};
158
159/* uCAN SET_EN/CLR_DIS _OPTION command fields */
160#define PUCAN_OPTION_ERROR 0x0001
161#define PUCAN_OPTION_BUSLOAD 0x0002
162#define PUCAN_OPTION_CANDFDISO 0x0004
163
164struct __packed pucan_options {
165 __le16 opcode_channel;
166
167 __le16 options;
168 u32 unused;
169};
170
171/* uCAN received messages global format */
172struct __packed pucan_msg {
173 __le16 size;
174 __le16 type;
175 __le32 ts_low;
176 __le32 ts_high;
177};
178
179/* uCAN flags for CAN/CANFD messages */
180#define PUCAN_MSG_SELF_RECEIVE 0x80
181#define PUCAN_MSG_ERROR_STATE_IND 0x40 /* error state indicator */
182#define PUCAN_MSG_BITRATE_SWITCH 0x20 /* bitrate switch */
183#define PUCAN_MSG_EXT_DATA_LEN 0x10 /* extended data length */
184#define PUCAN_MSG_SINGLE_SHOT 0x08
185#define PUCAN_MSG_LOOPED_BACK 0x04
186#define PUCAN_MSG_EXT_ID 0x02
187#define PUCAN_MSG_RTR 0x01
188
189struct __packed pucan_rx_msg {
190 __le16 size;
191 __le16 type;
192 __le32 ts_low;
193 __le32 ts_high;
194 __le32 tag_low;
195 __le32 tag_high;
196 u8 channel_dlc;
197 u8 client;
198 __le16 flags;
199 __le32 can_id;
200 u8 d[0];
201};
202
203/* uCAN error types */
204#define PUCAN_ERMSG_BIT_ERROR 0
205#define PUCAN_ERMSG_FORM_ERROR 1
206#define PUCAN_ERMSG_STUFF_ERROR 2
207#define PUCAN_ERMSG_OTHER_ERROR 3
208#define PUCAN_ERMSG_ERR_CNT_DEC 4
209
210struct __packed pucan_error_msg {
211 __le16 size;
212 __le16 type;
213 __le32 ts_low;
214 __le32 ts_high;
215 u8 channel_type_d;
216 u8 code_g;
217 u8 tx_err_cnt;
218 u8 rx_err_cnt;
219};
220
221static inline int pucan_error_get_channel(const struct pucan_error_msg *msg)
222{
223 return msg->channel_type_d & 0x0f;
224}
225
226#define PUCAN_RX_BARRIER 0x10
227#define PUCAN_BUS_PASSIVE 0x20
228#define PUCAN_BUS_WARNING 0x40
229#define PUCAN_BUS_BUSOFF 0x80
230
231struct __packed pucan_status_msg {
232 __le16 size;
233 __le16 type;
234 __le32 ts_low;
235 __le32 ts_high;
236 u8 channel_p_w_b;
237 u8 unused[3];
238};
239
240static inline int pucan_status_get_channel(const struct pucan_status_msg *msg)
241{
242 return msg->channel_p_w_b & 0x0f;
243}
244
245static inline int pucan_status_is_rx_barrier(const struct pucan_status_msg *msg)
246{
247 return msg->channel_p_w_b & PUCAN_RX_BARRIER;
248}
249
250static inline int pucan_status_is_passive(const struct pucan_status_msg *msg)
251{
252 return msg->channel_p_w_b & PUCAN_BUS_PASSIVE;
253}
254
255static inline int pucan_status_is_warning(const struct pucan_status_msg *msg)
256{
257 return msg->channel_p_w_b & PUCAN_BUS_WARNING;
258}
259
260static inline int pucan_status_is_busoff(const struct pucan_status_msg *msg)
261{
262 return msg->channel_p_w_b & PUCAN_BUS_BUSOFF;
263}
264
265/* uCAN transmitted message format */
266#define PUCAN_MSG_CHANNEL_DLC(c, d) (((c) & 0xf) | ((d) << 4))
267
268struct __packed pucan_tx_msg {
269 __le16 size;
270 __le16 type;
271 __le32 tag_low;
272 __le32 tag_high;
273 u8 channel_dlc;
274 u8 client;
275 __le16 flags;
276 __le32 can_id;
277 u8 d[0];
278};
279
280/* build the cmd opcode_channel field with respect to the correct endianness */
281static inline __le16 pucan_cmd_opcode_channel(int index, int opcode)
282{
283 return cpu_to_le16(((index) << 12) | ((opcode) & 0x3ff));
284}
285
286/* return the channel number part from any received message channel_dlc field */
287static inline int pucan_msg_get_channel(const struct pucan_rx_msg *msg)
288{
289 return msg->channel_dlc & 0xf;
290}
291
292/* return the dlc value from any received message channel_dlc field */
293static inline int pucan_msg_get_dlc(const struct pucan_rx_msg *msg)
294{
295 return msg->channel_dlc >> 4;
296}
297
298static inline int pucan_ermsg_get_channel(const struct pucan_error_msg *msg)
299{
300 return msg->channel_type_d & 0x0f;
301}
302
303static inline int pucan_stmsg_get_channel(const struct pucan_status_msg *msg)
304{
305 return msg->channel_p_w_b & 0x0f;
306}
307
308#endif
diff --git a/include/linux/can/platform/ti_hecc.h b/include/linux/can/platform/ti_hecc.h
deleted file mode 100644
index a52f47ca6c8a..000000000000
--- a/include/linux/can/platform/ti_hecc.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _CAN_PLATFORM_TI_HECC_H
2#define _CAN_PLATFORM_TI_HECC_H
3
4/*
5 * TI HECC (High End CAN Controller) driver platform header
6 *
7 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed as is WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20/**
21 * struct hecc_platform_data - HECC Platform Data
22 *
23 * @scc_hecc_offset: mostly 0 - should really never change
24 * @scc_ram_offset: SCC RAM offset
25 * @hecc_ram_offset: HECC RAM offset
26 * @mbx_offset: Mailbox RAM offset
27 * @int_line: Interrupt line to use - 0 or 1
28 * @version: version for future use
29 * @transceiver_switch: platform specific callback fn for transceiver control
30 *
31 * Platform data structure to get all platform specific settings.
32 * this structure also accounts the fact that the IP may have different
33 * RAM and mailbox offsets for different SOC's
34 */
35struct ti_hecc_platform_data {
36 u32 scc_hecc_offset;
37 u32 scc_ram_offset;
38 u32 hecc_ram_offset;
39 u32 mbx_offset;
40 u32 int_line;
41 u32 version;
42 void (*transceiver_switch) (int);
43};
44#endif /* !_CAN_PLATFORM_TI_HECC_H */
diff --git a/include/linux/ccp.h b/include/linux/ccp.h
index c41b8d99dd0e..3285c944194a 100644
--- a/include/linux/ccp.h
+++ b/include/linux/ccp.h
@@ -123,6 +123,10 @@ enum ccp_aes_mode {
123 CCP_AES_MODE_CFB, 123 CCP_AES_MODE_CFB,
124 CCP_AES_MODE_CTR, 124 CCP_AES_MODE_CTR,
125 CCP_AES_MODE_CMAC, 125 CCP_AES_MODE_CMAC,
126 CCP_AES_MODE_GHASH,
127 CCP_AES_MODE_GCTR,
128 CCP_AES_MODE_GCM,
129 CCP_AES_MODE_GMAC,
126 CCP_AES_MODE__LAST, 130 CCP_AES_MODE__LAST,
127}; 131};
128 132
@@ -137,6 +141,9 @@ enum ccp_aes_action {
137 CCP_AES_ACTION_ENCRYPT, 141 CCP_AES_ACTION_ENCRYPT,
138 CCP_AES_ACTION__LAST, 142 CCP_AES_ACTION__LAST,
139}; 143};
144/* Overloaded field */
145#define CCP_AES_GHASHAAD CCP_AES_ACTION_DECRYPT
146#define CCP_AES_GHASHFINAL CCP_AES_ACTION_ENCRYPT
140 147
141/** 148/**
142 * struct ccp_aes_engine - CCP AES operation 149 * struct ccp_aes_engine - CCP AES operation
@@ -181,6 +188,8 @@ struct ccp_aes_engine {
181 struct scatterlist *cmac_key; /* K1/K2 cmac key required for 188 struct scatterlist *cmac_key; /* K1/K2 cmac key required for
182 * final cmac cmd */ 189 * final cmac cmd */
183 u32 cmac_key_len; /* In bytes */ 190 u32 cmac_key_len; /* In bytes */
191
192 u32 aad_len; /* In bytes */
184}; 193};
185 194
186/***** XTS-AES engine *****/ 195/***** XTS-AES engine *****/
@@ -249,6 +258,8 @@ enum ccp_sha_type {
249 CCP_SHA_TYPE_1 = 1, 258 CCP_SHA_TYPE_1 = 1,
250 CCP_SHA_TYPE_224, 259 CCP_SHA_TYPE_224,
251 CCP_SHA_TYPE_256, 260 CCP_SHA_TYPE_256,
261 CCP_SHA_TYPE_384,
262 CCP_SHA_TYPE_512,
252 CCP_SHA_TYPE__LAST, 263 CCP_SHA_TYPE__LAST,
253}; 264};
254 265
@@ -290,6 +301,60 @@ struct ccp_sha_engine {
290 * final sha cmd */ 301 * final sha cmd */
291}; 302};
292 303
304/***** 3DES engine *****/
305enum ccp_des3_mode {
306 CCP_DES3_MODE_ECB = 0,
307 CCP_DES3_MODE_CBC,
308 CCP_DES3_MODE_CFB,
309 CCP_DES3_MODE__LAST,
310};
311
312enum ccp_des3_type {
313 CCP_DES3_TYPE_168 = 1,
314 CCP_DES3_TYPE__LAST,
315 };
316
317enum ccp_des3_action {
318 CCP_DES3_ACTION_DECRYPT = 0,
319 CCP_DES3_ACTION_ENCRYPT,
320 CCP_DES3_ACTION__LAST,
321};
322
323/**
324 * struct ccp_des3_engine - CCP SHA operation
325 * @type: Type of 3DES operation
326 * @mode: cipher mode
327 * @action: 3DES operation (decrypt/encrypt)
328 * @key: key to be used for this 3DES operation
329 * @key_len: length of key (in bytes)
330 * @iv: IV to be used for this AES operation
331 * @iv_len: length in bytes of iv
332 * @src: input data to be used for this operation
333 * @src_len: length of input data used for this operation (in bytes)
334 * @dst: output data produced by this operation
335 *
336 * Variables required to be set when calling ccp_enqueue_cmd():
337 * - type, mode, action, key, key_len, src, dst, src_len
338 * - iv, iv_len for any mode other than ECB
339 *
340 * The iv variable is used as both input and output. On completion of the
341 * 3DES operation the new IV overwrites the old IV.
342 */
343struct ccp_des3_engine {
344 enum ccp_des3_type type;
345 enum ccp_des3_mode mode;
346 enum ccp_des3_action action;
347
348 struct scatterlist *key;
349 u32 key_len; /* In bytes */
350
351 struct scatterlist *iv;
352 u32 iv_len; /* In bytes */
353
354 struct scatterlist *src, *dst;
355 u64 src_len; /* In bytes */
356};
357
293/***** RSA engine *****/ 358/***** RSA engine *****/
294/** 359/**
295 * struct ccp_rsa_engine - CCP RSA operation 360 * struct ccp_rsa_engine - CCP RSA operation
@@ -539,7 +604,7 @@ struct ccp_ecc_engine {
539enum ccp_engine { 604enum ccp_engine {
540 CCP_ENGINE_AES = 0, 605 CCP_ENGINE_AES = 0,
541 CCP_ENGINE_XTS_AES_128, 606 CCP_ENGINE_XTS_AES_128,
542 CCP_ENGINE_RSVD1, 607 CCP_ENGINE_DES3,
543 CCP_ENGINE_SHA, 608 CCP_ENGINE_SHA,
544 CCP_ENGINE_RSA, 609 CCP_ENGINE_RSA,
545 CCP_ENGINE_PASSTHRU, 610 CCP_ENGINE_PASSTHRU,
@@ -587,6 +652,7 @@ struct ccp_cmd {
587 union { 652 union {
588 struct ccp_aes_engine aes; 653 struct ccp_aes_engine aes;
589 struct ccp_xts_aes_engine xts; 654 struct ccp_xts_aes_engine xts;
655 struct ccp_des3_engine des3;
590 struct ccp_sha_engine sha; 656 struct ccp_sha_engine sha;
591 struct ccp_rsa_engine rsa; 657 struct ccp_rsa_engine rsa;
592 struct ccp_passthru_engine passthru; 658 struct ccp_passthru_engine passthru;
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index f8763615a5f2..408bc09ce497 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -4,6 +4,7 @@
4#include <linux/kobject.h> 4#include <linux/kobject.h>
5#include <linux/kdev_t.h> 5#include <linux/kdev_t.h>
6#include <linux/list.h> 6#include <linux/list.h>
7#include <linux/device.h>
7 8
8struct file_operations; 9struct file_operations;
9struct inode; 10struct inode;
@@ -26,6 +27,10 @@ void cdev_put(struct cdev *p);
26 27
27int cdev_add(struct cdev *, dev_t, unsigned); 28int cdev_add(struct cdev *, dev_t, unsigned);
28 29
30void cdev_set_parent(struct cdev *p, struct kobject *kobj);
31int cdev_device_add(struct cdev *cdev, struct device *dev);
32void cdev_device_del(struct cdev *cdev, struct device *dev);
33
29void cdev_del(struct cdev *); 34void cdev_del(struct cdev *);
30 35
31void cd_forget(struct inode *); 36void cd_forget(struct inode *);
diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
index aa2e19182d99..51c5bd64bd00 100644
--- a/include/linux/ceph/ceph_debug.h
+++ b/include/linux/ceph/ceph_debug.h
@@ -3,6 +3,8 @@
3 3
4#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 4#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
5 5
6#include <linux/string.h>
7
6#ifdef CONFIG_CEPH_LIB_PRETTYDEBUG 8#ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
7 9
8/* 10/*
@@ -12,12 +14,10 @@
12 */ 14 */
13 15
14# if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) 16# if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
15extern const char *ceph_file_part(const char *s, int len);
16# define dout(fmt, ...) \ 17# define dout(fmt, ...) \
17 pr_debug("%.*s %12.12s:%-4d : " fmt, \ 18 pr_debug("%.*s %12.12s:%-4d : " fmt, \
18 8 - (int)sizeof(KBUILD_MODNAME), " ", \ 19 8 - (int)sizeof(KBUILD_MODNAME), " ", \
19 ceph_file_part(__FILE__, sizeof(__FILE__)), \ 20 kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
20 __LINE__, ##__VA_ARGS__)
21# else 21# else
22/* faux printk call just to see any compiler warnings. */ 22/* faux printk call just to see any compiler warnings. */
23# define dout(fmt, ...) do { \ 23# define dout(fmt, ...) do { \
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index ae2f66833762..fd8b2953c78f 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -105,8 +105,10 @@ static inline u64 ceph_sanitize_features(u64 features)
105 */ 105 */
106#define CEPH_FEATURES_SUPPORTED_DEFAULT \ 106#define CEPH_FEATURES_SUPPORTED_DEFAULT \
107 (CEPH_FEATURE_NOSRCADDR | \ 107 (CEPH_FEATURE_NOSRCADDR | \
108 CEPH_FEATURE_FLOCK | \
108 CEPH_FEATURE_SUBSCRIBE2 | \ 109 CEPH_FEATURE_SUBSCRIBE2 | \
109 CEPH_FEATURE_RECONNECT_SEQ | \ 110 CEPH_FEATURE_RECONNECT_SEQ | \
111 CEPH_FEATURE_DIRLAYOUTHASH | \
110 CEPH_FEATURE_PGID64 | \ 112 CEPH_FEATURE_PGID64 | \
111 CEPH_FEATURE_PGPOOL3 | \ 113 CEPH_FEATURE_PGPOOL3 | \
112 CEPH_FEATURE_OSDENC | \ 114 CEPH_FEATURE_OSDENC | \
@@ -114,11 +116,13 @@ static inline u64 ceph_sanitize_features(u64 features)
114 CEPH_FEATURE_MSG_AUTH | \ 116 CEPH_FEATURE_MSG_AUTH | \
115 CEPH_FEATURE_CRUSH_TUNABLES2 | \ 117 CEPH_FEATURE_CRUSH_TUNABLES2 | \
116 CEPH_FEATURE_REPLY_CREATE_INODE | \ 118 CEPH_FEATURE_REPLY_CREATE_INODE | \
119 CEPH_FEATURE_MDSENC | \
117 CEPH_FEATURE_OSDHASHPSPOOL | \ 120 CEPH_FEATURE_OSDHASHPSPOOL | \
118 CEPH_FEATURE_OSD_CACHEPOOL | \ 121 CEPH_FEATURE_OSD_CACHEPOOL | \
119 CEPH_FEATURE_CRUSH_V2 | \ 122 CEPH_FEATURE_CRUSH_V2 | \
120 CEPH_FEATURE_EXPORT_PEER | \ 123 CEPH_FEATURE_EXPORT_PEER | \
121 CEPH_FEATURE_OSDMAP_ENC | \ 124 CEPH_FEATURE_OSDMAP_ENC | \
125 CEPH_FEATURE_MDS_INLINE_DATA | \
122 CEPH_FEATURE_CRUSH_TUNABLES3 | \ 126 CEPH_FEATURE_CRUSH_TUNABLES3 | \
123 CEPH_FEATURE_OSD_PRIMARY_AFFINITY | \ 127 CEPH_FEATURE_OSD_PRIMARY_AFFINITY | \
124 CEPH_FEATURE_MSGR_KEEPALIVE2 | \ 128 CEPH_FEATURE_MSGR_KEEPALIVE2 | \
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index f4b2ee18f38c..ad078ebe25d6 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -365,6 +365,19 @@ extern const char *ceph_mds_op_name(int op);
365#define CEPH_READDIR_FRAG_END (1<<0) 365#define CEPH_READDIR_FRAG_END (1<<0)
366#define CEPH_READDIR_FRAG_COMPLETE (1<<8) 366#define CEPH_READDIR_FRAG_COMPLETE (1<<8)
367#define CEPH_READDIR_HASH_ORDER (1<<9) 367#define CEPH_READDIR_HASH_ORDER (1<<9)
368#define CEPH_READDIR_OFFSET_HASH (1<<10)
369
370/*
371 * open request flags
372 */
373#define CEPH_O_RDONLY 00000000
374#define CEPH_O_WRONLY 00000001
375#define CEPH_O_RDWR 00000002
376#define CEPH_O_CREAT 00000100
377#define CEPH_O_EXCL 00000200
378#define CEPH_O_TRUNC 00001000
379#define CEPH_O_DIRECTORY 00200000
380#define CEPH_O_NOFOLLOW 00400000
368 381
369union ceph_mds_request_args { 382union ceph_mds_request_args {
370 struct { 383 struct {
@@ -384,6 +397,7 @@ union ceph_mds_request_args {
384 __le32 max_entries; /* how many dentries to grab */ 397 __le32 max_entries; /* how many dentries to grab */
385 __le32 max_bytes; 398 __le32 max_bytes;
386 __le16 flags; 399 __le16 flags;
400 __le32 offset_hash;
387 } __attribute__ ((packed)) readdir; 401 } __attribute__ ((packed)) readdir;
388 struct { 402 struct {
389 __le32 mode; 403 __le32 mode;
diff --git a/include/linux/ceph/cls_lock_client.h b/include/linux/ceph/cls_lock_client.h
index 84884d8d4710..0594d3bba774 100644
--- a/include/linux/ceph/cls_lock_client.h
+++ b/include/linux/ceph/cls_lock_client.h
@@ -37,6 +37,11 @@ int ceph_cls_break_lock(struct ceph_osd_client *osdc,
37 struct ceph_object_locator *oloc, 37 struct ceph_object_locator *oloc,
38 char *lock_name, char *cookie, 38 char *lock_name, char *cookie,
39 struct ceph_entity_name *locker); 39 struct ceph_entity_name *locker);
40int ceph_cls_set_cookie(struct ceph_osd_client *osdc,
41 struct ceph_object_id *oid,
42 struct ceph_object_locator *oloc,
43 char *lock_name, u8 type, char *old_cookie,
44 char *tag, char *new_cookie);
40 45
41void ceph_free_lockers(struct ceph_locker *lockers, u32 num_lockers); 46void ceph_free_lockers(struct ceph_locker *lockers, u32 num_lockers);
42 47
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 88cd5dc8e238..3229ae6c7846 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -14,6 +14,7 @@
14#include <linux/wait.h> 14#include <linux/wait.h>
15#include <linux/writeback.h> 15#include <linux/writeback.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/refcount.h>
17 18
18#include <linux/ceph/types.h> 19#include <linux/ceph/types.h>
19#include <linux/ceph/messenger.h> 20#include <linux/ceph/messenger.h>
@@ -161,7 +162,7 @@ struct ceph_client {
161 * dirtied. 162 * dirtied.
162 */ 163 */
163struct ceph_snap_context { 164struct ceph_snap_context {
164 atomic_t nref; 165 refcount_t nref;
165 u64 seq; 166 u64 seq;
166 u32 num_snaps; 167 u32 num_snaps;
167 u64 snaps[]; 168 u64 snaps[];
@@ -262,10 +263,7 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client);
262extern void ceph_destroy_options(struct ceph_options *opt); 263extern void ceph_destroy_options(struct ceph_options *opt);
263extern int ceph_compare_options(struct ceph_options *new_opt, 264extern int ceph_compare_options(struct ceph_options *new_opt,
264 struct ceph_client *client); 265 struct ceph_client *client);
265extern struct ceph_client *ceph_create_client(struct ceph_options *opt, 266struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private);
266 void *private,
267 u64 supported_features,
268 u64 required_features);
269struct ceph_entity_addr *ceph_client_addr(struct ceph_client *client); 267struct ceph_entity_addr *ceph_client_addr(struct ceph_client *client);
270u64 ceph_client_gid(struct ceph_client *client); 268u64 ceph_client_gid(struct ceph_client *client);
271extern void ceph_destroy_client(struct ceph_client *client); 269extern void ceph_destroy_client(struct ceph_client *client);
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
index 8ed5dc505fbb..d5f783f3226a 100644
--- a/include/linux/ceph/mdsmap.h
+++ b/include/linux/ceph/mdsmap.h
@@ -25,6 +25,7 @@ struct ceph_mdsmap {
25 u32 m_session_autoclose; /* seconds */ 25 u32 m_session_autoclose; /* seconds */
26 u64 m_max_file_size; 26 u64 m_max_file_size;
27 u32 m_max_mds; /* size of m_addr, m_state arrays */ 27 u32 m_max_mds; /* size of m_addr, m_state arrays */
28 int m_num_mds;
28 struct ceph_mds_info *m_info; 29 struct ceph_mds_info *m_info;
29 30
30 /* which object pools file data can be stored in */ 31 /* which object pools file data can be stored in */
@@ -40,7 +41,7 @@ struct ceph_mdsmap {
40static inline struct ceph_entity_addr * 41static inline struct ceph_entity_addr *
41ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w) 42ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
42{ 43{
43 if (w >= m->m_max_mds) 44 if (w >= m->m_num_mds)
44 return NULL; 45 return NULL;
45 return &m->m_info[w].addr; 46 return &m->m_info[w].addr;
46} 47}
@@ -48,14 +49,14 @@ ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
48static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w) 49static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w)
49{ 50{
50 BUG_ON(w < 0); 51 BUG_ON(w < 0);
51 if (w >= m->m_max_mds) 52 if (w >= m->m_num_mds)
52 return CEPH_MDS_STATE_DNE; 53 return CEPH_MDS_STATE_DNE;
53 return m->m_info[w].state; 54 return m->m_info[w].state;
54} 55}
55 56
56static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w) 57static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
57{ 58{
58 if (w >= 0 && w < m->m_max_mds) 59 if (w >= 0 && w < m->m_num_mds)
59 return m->m_info[w].laggy; 60 return m->m_info[w].laggy;
60 return false; 61 return false;
61} 62}
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index c125b5d9e13c..85650b415e73 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -5,6 +5,7 @@
5#include <linux/kref.h> 5#include <linux/kref.h>
6#include <linux/mempool.h> 6#include <linux/mempool.h>
7#include <linux/rbtree.h> 7#include <linux/rbtree.h>
8#include <linux/refcount.h>
8 9
9#include <linux/ceph/types.h> 10#include <linux/ceph/types.h>
10#include <linux/ceph/osdmap.h> 11#include <linux/ceph/osdmap.h>
@@ -27,7 +28,7 @@ typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *);
27 28
28/* a given osd we're communicating with */ 29/* a given osd we're communicating with */
29struct ceph_osd { 30struct ceph_osd {
30 atomic_t o_ref; 31 refcount_t o_ref;
31 struct ceph_osd_client *o_osdc; 32 struct ceph_osd_client *o_osdc;
32 int o_osd; 33 int o_osd;
33 int o_incarnation; 34 int o_incarnation;
@@ -186,12 +187,12 @@ struct ceph_osd_request {
186 struct timespec r_mtime; /* ditto */ 187 struct timespec r_mtime; /* ditto */
187 u64 r_data_offset; /* ditto */ 188 u64 r_data_offset; /* ditto */
188 bool r_linger; /* don't resend on failure */ 189 bool r_linger; /* don't resend on failure */
190 bool r_abort_on_full; /* return ENOSPC when full */
189 191
190 /* internal */ 192 /* internal */
191 unsigned long r_stamp; /* jiffies, send or check time */ 193 unsigned long r_stamp; /* jiffies, send or check time */
192 unsigned long r_start_stamp; /* jiffies */ 194 unsigned long r_start_stamp; /* jiffies */
193 int r_attempts; 195 int r_attempts;
194 struct ceph_eversion r_replay_version; /* aka reassert_version */
195 u32 r_last_force_resend; 196 u32 r_last_force_resend;
196 u32 r_map_dne_bound; 197 u32 r_map_dne_bound;
197 198
@@ -266,6 +267,7 @@ struct ceph_osd_client {
266 struct rb_root osds; /* osds */ 267 struct rb_root osds; /* osds */
267 struct list_head osd_lru; /* idle osds */ 268 struct list_head osd_lru; /* idle osds */
268 spinlock_t osd_lru_lock; 269 spinlock_t osd_lru_lock;
270 u32 epoch_barrier;
269 struct ceph_osd homeless_osd; 271 struct ceph_osd homeless_osd;
270 atomic64_t last_tid; /* tid of last request */ 272 atomic64_t last_tid; /* tid of last request */
271 u64 last_linger_id; 273 u64 last_linger_id;
@@ -304,6 +306,7 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
304 struct ceph_msg *msg); 306 struct ceph_msg *msg);
305extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, 307extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
306 struct ceph_msg *msg); 308 struct ceph_msg *msg);
309void ceph_osdc_update_epoch_barrier(struct ceph_osd_client *osdc, u32 eb);
307 310
308extern void osd_req_op_init(struct ceph_osd_request *osd_req, 311extern void osd_req_op_init(struct ceph_osd_request *osd_req,
309 unsigned int which, u16 opcode, u32 flags); 312 unsigned int which, u16 opcode, u32 flags);
diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h
index 13d71fe18b0c..75a7db21457d 100644
--- a/include/linux/ceph/pagelist.h
+++ b/include/linux/ceph/pagelist.h
@@ -2,7 +2,7 @@
2#define __FS_CEPH_PAGELIST_H 2#define __FS_CEPH_PAGELIST_H
3 3
4#include <asm/byteorder.h> 4#include <asm/byteorder.h>
5#include <linux/atomic.h> 5#include <linux/refcount.h>
6#include <linux/list.h> 6#include <linux/list.h>
7#include <linux/types.h> 7#include <linux/types.h>
8 8
@@ -13,7 +13,7 @@ struct ceph_pagelist {
13 size_t room; 13 size_t room;
14 struct list_head free_list; 14 struct list_head free_list;
15 size_t num_pages_free; 15 size_t num_pages_free;
16 atomic_t refcnt; 16 refcount_t refcnt;
17}; 17};
18 18
19struct ceph_pagelist_cursor { 19struct ceph_pagelist_cursor {
@@ -30,7 +30,7 @@ static inline void ceph_pagelist_init(struct ceph_pagelist *pl)
30 pl->room = 0; 30 pl->room = 0;
31 INIT_LIST_HEAD(&pl->free_list); 31 INIT_LIST_HEAD(&pl->free_list);
32 pl->num_pages_free = 0; 32 pl->num_pages_free = 0;
33 atomic_set(&pl->refcnt, 1); 33 refcount_set(&pl->refcnt, 1);
34} 34}
35 35
36extern void ceph_pagelist_release(struct ceph_pagelist *pl); 36extern void ceph_pagelist_release(struct ceph_pagelist *pl);
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 6a3f850cabab..21745946cae1 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -13,6 +13,7 @@
13#include <linux/wait.h> 13#include <linux/wait.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/rcupdate.h> 15#include <linux/rcupdate.h>
16#include <linux/refcount.h>
16#include <linux/percpu-refcount.h> 17#include <linux/percpu-refcount.h>
17#include <linux/percpu-rwsem.h> 18#include <linux/percpu-rwsem.h>
18#include <linux/workqueue.h> 19#include <linux/workqueue.h>
@@ -106,9 +107,6 @@ struct cgroup_subsys_state {
106 /* reference count - access via css_[try]get() and css_put() */ 107 /* reference count - access via css_[try]get() and css_put() */
107 struct percpu_ref refcnt; 108 struct percpu_ref refcnt;
108 109
109 /* PI: the parent css */
110 struct cgroup_subsys_state *parent;
111
112 /* siblings list anchored at the parent's ->children */ 110 /* siblings list anchored at the parent's ->children */
113 struct list_head sibling; 111 struct list_head sibling;
114 struct list_head children; 112 struct list_head children;
@@ -138,6 +136,12 @@ struct cgroup_subsys_state {
138 /* percpu_ref killing and RCU release */ 136 /* percpu_ref killing and RCU release */
139 struct rcu_head rcu_head; 137 struct rcu_head rcu_head;
140 struct work_struct destroy_work; 138 struct work_struct destroy_work;
139
140 /*
141 * PI: the parent css. Placed here for cache proximity to following
142 * fields of the containing structure.
143 */
144 struct cgroup_subsys_state *parent;
141}; 145};
142 146
143/* 147/*
@@ -156,7 +160,7 @@ struct css_set {
156 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 160 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
157 161
158 /* reference count */ 162 /* reference count */
159 atomic_t refcount; 163 refcount_t refcount;
160 164
161 /* the default cgroup associated with this css_set */ 165 /* the default cgroup associated with this css_set */
162 struct cgroup *dfl_cgrp; 166 struct cgroup *dfl_cgrp;
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index f6b43fbb141c..ed2573e149fa 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -17,11 +17,11 @@
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/kernfs.h> 18#include <linux/kernfs.h>
19#include <linux/jump_label.h> 19#include <linux/jump_label.h>
20#include <linux/nsproxy.h>
21#include <linux/types.h> 20#include <linux/types.h>
22#include <linux/ns_common.h> 21#include <linux/ns_common.h>
23#include <linux/nsproxy.h> 22#include <linux/nsproxy.h>
24#include <linux/user_namespace.h> 23#include <linux/user_namespace.h>
24#include <linux/refcount.h>
25 25
26#include <linux/cgroup-defs.h> 26#include <linux/cgroup-defs.h>
27 27
@@ -570,6 +570,25 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
570 pr_cont_kernfs_path(cgrp->kn); 570 pr_cont_kernfs_path(cgrp->kn);
571} 571}
572 572
573static inline void cgroup_init_kthreadd(void)
574{
575 /*
576 * kthreadd is inherited by all kthreads, keep it in the root so
577 * that the new kthreads are guaranteed to stay in the root until
578 * initialization is finished.
579 */
580 current->no_cgroup_migration = 1;
581}
582
583static inline void cgroup_kthread_ready(void)
584{
585 /*
586 * This kthread finished initialization. The creator should have
587 * set PF_NO_SETAFFINITY if this kthread should stay in the root.
588 */
589 current->no_cgroup_migration = 0;
590}
591
573#else /* !CONFIG_CGROUPS */ 592#else /* !CONFIG_CGROUPS */
574 593
575struct cgroup_subsys_state; 594struct cgroup_subsys_state;
@@ -590,6 +609,8 @@ static inline void cgroup_free(struct task_struct *p) {}
590 609
591static inline int cgroup_init_early(void) { return 0; } 610static inline int cgroup_init_early(void) { return 0; }
592static inline int cgroup_init(void) { return 0; } 611static inline int cgroup_init(void) { return 0; }
612static inline void cgroup_init_kthreadd(void) {}
613static inline void cgroup_kthread_ready(void) {}
593 614
594static inline bool task_under_cgroup_hierarchy(struct task_struct *task, 615static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
595 struct cgroup *ancestor) 616 struct cgroup *ancestor)
@@ -640,7 +661,7 @@ static inline void cgroup_sk_free(struct sock_cgroup_data *skcd) {}
640#endif /* CONFIG_CGROUP_DATA */ 661#endif /* CONFIG_CGROUP_DATA */
641 662
642struct cgroup_namespace { 663struct cgroup_namespace {
643 atomic_t count; 664 refcount_t count;
644 struct ns_common ns; 665 struct ns_common ns;
645 struct user_namespace *user_ns; 666 struct user_namespace *user_ns;
646 struct ucounts *ucounts; 667 struct ucounts *ucounts;
@@ -675,12 +696,12 @@ copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
675static inline void get_cgroup_ns(struct cgroup_namespace *ns) 696static inline void get_cgroup_ns(struct cgroup_namespace *ns)
676{ 697{
677 if (ns) 698 if (ns)
678 atomic_inc(&ns->count); 699 refcount_inc(&ns->count);
679} 700}
680 701
681static inline void put_cgroup_ns(struct cgroup_namespace *ns) 702static inline void put_cgroup_ns(struct cgroup_namespace *ns)
682{ 703{
683 if (ns && atomic_dec_and_test(&ns->count)) 704 if (ns && refcount_dec_and_test(&ns->count))
684 free_cgroup_ns(ns); 705 free_cgroup_ns(ns);
685} 706}
686 707
diff --git a/include/linux/clk.h b/include/linux/clk.h
index e9d36b3e49de..024cd07870d0 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -132,8 +132,8 @@ int clk_get_phase(struct clk *clk);
132 * @q: clk compared against p 132 * @q: clk compared against p
133 * 133 *
134 * Returns true if the two struct clk pointers both point to the same hardware 134 * Returns true if the two struct clk pointers both point to the same hardware
135 * clock node. Put differently, returns true if struct clk *p and struct clk *q 135 * clock node. Put differently, returns true if @p and @q
136 * share the same struct clk_core object. 136 * share the same &struct clk_core object.
137 * 137 *
138 * Returns false otherwise. Note that two NULL clks are treated as matching. 138 * Returns false otherwise. Note that two NULL clks are treated as matching.
139 */ 139 */
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
index 7007a5f48080..d23c9cf26993 100644
--- a/include/linux/clk/tegra.h
+++ b/include/linux/clk/tegra.h
@@ -125,5 +125,8 @@ extern void tegra210_xusb_pll_hw_control_enable(void);
125extern void tegra210_xusb_pll_hw_sequence_start(void); 125extern void tegra210_xusb_pll_hw_sequence_start(void);
126extern void tegra210_sata_pll_hw_control_enable(void); 126extern void tegra210_sata_pll_hw_control_enable(void);
127extern void tegra210_sata_pll_hw_sequence_start(void); 127extern void tegra210_sata_pll_hw_sequence_start(void);
128extern void tegra210_set_sata_pll_seq_sw(bool state);
129extern void tegra210_put_utmipll_in_iddq(void);
130extern void tegra210_put_utmipll_out_iddq(void);
128 131
129#endif /* __LINUX_CLK_TEGRA_H_ */ 132#endif /* __LINUX_CLK_TEGRA_H_ */
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index 6110fe09ed18..d18da839b810 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -19,6 +19,18 @@
19#include <linux/clkdev.h> 19#include <linux/clkdev.h>
20 20
21/** 21/**
22 * struct clk_omap_reg - OMAP register declaration
23 * @offset: offset from the master IP module base address
24 * @index: index of the master IP module
25 */
26struct clk_omap_reg {
27 void __iomem *ptr;
28 u16 offset;
29 u8 index;
30 u8 flags;
31};
32
33/**
22 * struct dpll_data - DPLL registers and integration data 34 * struct dpll_data - DPLL registers and integration data
23 * @mult_div1_reg: register containing the DPLL M and N bitfields 35 * @mult_div1_reg: register containing the DPLL M and N bitfields
24 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg 36 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
@@ -67,12 +79,12 @@
67 * can be placed into read-only space. 79 * can be placed into read-only space.
68 */ 80 */
69struct dpll_data { 81struct dpll_data {
70 void __iomem *mult_div1_reg; 82 struct clk_omap_reg mult_div1_reg;
71 u32 mult_mask; 83 u32 mult_mask;
72 u32 div1_mask; 84 u32 div1_mask;
73 struct clk_hw *clk_bypass; 85 struct clk_hw *clk_bypass;
74 struct clk_hw *clk_ref; 86 struct clk_hw *clk_ref;
75 void __iomem *control_reg; 87 struct clk_omap_reg control_reg;
76 u32 enable_mask; 88 u32 enable_mask;
77 unsigned long last_rounded_rate; 89 unsigned long last_rounded_rate;
78 u16 last_rounded_m; 90 u16 last_rounded_m;
@@ -84,8 +96,8 @@ struct dpll_data {
84 u16 max_divider; 96 u16 max_divider;
85 unsigned long max_rate; 97 unsigned long max_rate;
86 u8 modes; 98 u8 modes;
87 void __iomem *autoidle_reg; 99 struct clk_omap_reg autoidle_reg;
88 void __iomem *idlest_reg; 100 struct clk_omap_reg idlest_reg;
89 u32 autoidle_mask; 101 u32 autoidle_mask;
90 u32 freqsel_mask; 102 u32 freqsel_mask;
91 u32 idlest_mask; 103 u32 idlest_mask;
@@ -113,10 +125,10 @@ struct clk_hw_omap;
113 */ 125 */
114struct clk_hw_omap_ops { 126struct clk_hw_omap_ops {
115 void (*find_idlest)(struct clk_hw_omap *oclk, 127 void (*find_idlest)(struct clk_hw_omap *oclk,
116 void __iomem **idlest_reg, 128 struct clk_omap_reg *idlest_reg,
117 u8 *idlest_bit, u8 *idlest_val); 129 u8 *idlest_bit, u8 *idlest_val);
118 void (*find_companion)(struct clk_hw_omap *oclk, 130 void (*find_companion)(struct clk_hw_omap *oclk,
119 void __iomem **other_reg, 131 struct clk_omap_reg *other_reg,
120 u8 *other_bit); 132 u8 *other_bit);
121 void (*allow_idle)(struct clk_hw_omap *oclk); 133 void (*allow_idle)(struct clk_hw_omap *oclk);
122 void (*deny_idle)(struct clk_hw_omap *oclk); 134 void (*deny_idle)(struct clk_hw_omap *oclk);
@@ -129,8 +141,6 @@ struct clk_hw_omap_ops {
129 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) 141 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
130 * @flags: see "struct clk.flags possibilities" above 142 * @flags: see "struct clk.flags possibilities" above
131 * @clksel_reg: for clksel clks, register va containing src/divisor select 143 * @clksel_reg: for clksel clks, register va containing src/divisor select
132 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
133 * @clksel: for clksel clks, pointer to struct clksel for this clock
134 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock 144 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
135 * @clkdm_name: clockdomain name that this clock is contained in 145 * @clkdm_name: clockdomain name that this clock is contained in
136 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime 146 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
@@ -141,12 +151,10 @@ struct clk_hw_omap {
141 struct list_head node; 151 struct list_head node;
142 unsigned long fixed_rate; 152 unsigned long fixed_rate;
143 u8 fixed_div; 153 u8 fixed_div;
144 void __iomem *enable_reg; 154 struct clk_omap_reg enable_reg;
145 u8 enable_bit; 155 u8 enable_bit;
146 u8 flags; 156 u8 flags;
147 void __iomem *clksel_reg; 157 struct clk_omap_reg clksel_reg;
148 u32 clksel_mask;
149 const struct clksel *clksel;
150 struct dpll_data *dpll_data; 158 struct dpll_data *dpll_data;
151 const char *clkdm_name; 159 const char *clkdm_name;
152 struct clockdomain *clkdm; 160 struct clockdomain *clkdm;
@@ -172,7 +180,6 @@ struct clk_hw_omap {
172 * should be used. This is a temporary solution - a better approach 180 * should be used. This is a temporary solution - a better approach
173 * would be to associate clock type-specific data with the clock, 181 * would be to associate clock type-specific data with the clock,
174 * similar to the struct dpll_data approach. 182 * similar to the struct dpll_data approach.
175 * MEMMAP_ADDRESSING: Use memmap addressing to access clock registers.
176 */ 183 */
177#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */ 184#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
178#define CLOCK_IDLE_CONTROL (1 << 1) 185#define CLOCK_IDLE_CONTROL (1 << 1)
@@ -180,7 +187,6 @@ struct clk_hw_omap {
180#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */ 187#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
181#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ 188#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
182#define CLOCK_CLKOUTX2 (1 << 5) 189#define CLOCK_CLKOUTX2 (1 << 5)
183#define MEMMAP_ADDRESSING (1 << 6)
184 190
185/* CM_CLKEN_PLL*.EN* bit values - not all are available for every DPLL */ 191/* CM_CLKEN_PLL*.EN* bit values - not all are available for every DPLL */
186#define DPLL_LOW_POWER_STOP 0x1 192#define DPLL_LOW_POWER_STOP 0x1
@@ -202,21 +208,12 @@ enum {
202}; 208};
203 209
204/** 210/**
205 * struct clk_omap_reg - OMAP register declaration
206 * @offset: offset from the master IP module base address
207 * @index: index of the master IP module
208 */
209struct clk_omap_reg {
210 u16 offset;
211 u16 index;
212};
213
214/**
215 * struct ti_clk_ll_ops - low-level ops for clocks 211 * struct ti_clk_ll_ops - low-level ops for clocks
216 * @clk_readl: pointer to register read function 212 * @clk_readl: pointer to register read function
217 * @clk_writel: pointer to register write function 213 * @clk_writel: pointer to register write function
218 * @clkdm_clk_enable: pointer to clockdomain enable function 214 * @clkdm_clk_enable: pointer to clockdomain enable function
219 * @clkdm_clk_disable: pointer to clockdomain disable function 215 * @clkdm_clk_disable: pointer to clockdomain disable function
216 * @clkdm_lookup: pointer to clockdomain lookup function
220 * @cm_wait_module_ready: pointer to CM module wait ready function 217 * @cm_wait_module_ready: pointer to CM module wait ready function
221 * @cm_split_idlest_reg: pointer to CM module function to split idlest reg 218 * @cm_split_idlest_reg: pointer to CM module function to split idlest reg
222 * 219 *
@@ -227,20 +224,20 @@ struct clk_omap_reg {
227 * operations not provided directly by clock drivers. 224 * operations not provided directly by clock drivers.
228 */ 225 */
229struct ti_clk_ll_ops { 226struct ti_clk_ll_ops {
230 u32 (*clk_readl)(void __iomem *reg); 227 u32 (*clk_readl)(const struct clk_omap_reg *reg);
231 void (*clk_writel)(u32 val, void __iomem *reg); 228 void (*clk_writel)(u32 val, const struct clk_omap_reg *reg);
232 int (*clkdm_clk_enable)(struct clockdomain *clkdm, struct clk *clk); 229 int (*clkdm_clk_enable)(struct clockdomain *clkdm, struct clk *clk);
233 int (*clkdm_clk_disable)(struct clockdomain *clkdm, 230 int (*clkdm_clk_disable)(struct clockdomain *clkdm,
234 struct clk *clk); 231 struct clk *clk);
232 struct clockdomain * (*clkdm_lookup)(const char *name);
235 int (*cm_wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg, 233 int (*cm_wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg,
236 u8 idlest_shift); 234 u8 idlest_shift);
237 int (*cm_split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst, 235 int (*cm_split_idlest_reg)(struct clk_omap_reg *idlest_reg,
238 u8 *idlest_reg_id); 236 s16 *prcm_inst, u8 *idlest_reg_id);
239}; 237};
240 238
241#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw) 239#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
242 240
243void omap2_init_clk_clkdm(struct clk_hw *clk);
244int omap2_clk_disable_autoidle_all(void); 241int omap2_clk_disable_autoidle_all(void);
245int omap2_clk_enable_autoidle_all(void); 242int omap2_clk_enable_autoidle_all(void);
246int omap2_clk_allow_idle(struct clk *clk); 243int omap2_clk_allow_idle(struct clk *clk);
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 6d7edc3082f9..acc9ce05e5f0 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -182,7 +182,6 @@ extern u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *e
182extern void clockevents_register_device(struct clock_event_device *dev); 182extern void clockevents_register_device(struct clock_event_device *dev);
183extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu); 183extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);
184 184
185extern void clockevents_config(struct clock_event_device *dev, u32 freq);
186extern void clockevents_config_and_register(struct clock_event_device *dev, 185extern void clockevents_config_and_register(struct clock_event_device *dev,
187 u32 freq, unsigned long min_delta, 186 u32 freq, unsigned long min_delta,
188 unsigned long max_delta); 187 unsigned long max_delta);
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index cfc75848a35d..f2b10d9ebd04 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -120,7 +120,7 @@ struct clocksource {
120#define CLOCK_SOURCE_RESELECT 0x100 120#define CLOCK_SOURCE_RESELECT 0x100
121 121
122/* simplify initialization of mask field */ 122/* simplify initialization of mask field */
123#define CLOCKSOURCE_MASK(bits) (u64)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 123#define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0)
124 124
125static inline u32 clocksource_freq2mult(u32 freq, u32 shift_constant, u64 from) 125static inline u32 clocksource_freq2mult(u32 freq, u32 shift_constant, u64 from)
126{ 126{
diff --git a/include/linux/cma.h b/include/linux/cma.h
index 03f32d0bd1d8..3e8fbf5a5c73 100644
--- a/include/linux/cma.h
+++ b/include/linux/cma.h
@@ -21,15 +21,19 @@ struct cma;
21extern unsigned long totalcma_pages; 21extern unsigned long totalcma_pages;
22extern phys_addr_t cma_get_base(const struct cma *cma); 22extern phys_addr_t cma_get_base(const struct cma *cma);
23extern unsigned long cma_get_size(const struct cma *cma); 23extern unsigned long cma_get_size(const struct cma *cma);
24extern const char *cma_get_name(const struct cma *cma);
24 25
25extern int __init cma_declare_contiguous(phys_addr_t base, 26extern int __init cma_declare_contiguous(phys_addr_t base,
26 phys_addr_t size, phys_addr_t limit, 27 phys_addr_t size, phys_addr_t limit,
27 phys_addr_t alignment, unsigned int order_per_bit, 28 phys_addr_t alignment, unsigned int order_per_bit,
28 bool fixed, struct cma **res_cma); 29 bool fixed, const char *name, struct cma **res_cma);
29extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, 30extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
30 unsigned int order_per_bit, 31 unsigned int order_per_bit,
32 const char *name,
31 struct cma **res_cma); 33 struct cma **res_cma);
32extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, 34extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
33 gfp_t gfp_mask); 35 gfp_t gfp_mask);
34extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count); 36extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count);
37
38extern int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data);
35#endif 39#endif
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 5b8721efa948..31e4e1f1547c 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -15,7 +15,6 @@ struct venus_comm {
15 struct list_head vc_processing; 15 struct list_head vc_processing;
16 int vc_inuse; 16 int vc_inuse;
17 struct super_block *vc_sb; 17 struct super_block *vc_sb;
18 struct backing_dev_info bdi;
19 struct mutex vc_mutex; 18 struct mutex vc_mutex;
20}; 19};
21 20
diff --git a/include/linux/compat.h b/include/linux/compat.h
index aef47be2a5c1..1c5f3152cbb5 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -295,6 +295,13 @@ struct compat_old_sigaction {
295}; 295};
296#endif 296#endif
297 297
298struct compat_keyctl_kdf_params {
299 compat_uptr_t hashname;
300 compat_uptr_t otherinfo;
301 __u32 otherinfolen;
302 __u32 __spare[8];
303};
304
298struct compat_statfs; 305struct compat_statfs;
299struct compat_statfs64; 306struct compat_statfs64;
300struct compat_old_linux_dirent; 307struct compat_old_linux_dirent;
@@ -528,11 +535,6 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
528asmlinkage long compat_sys_getdents(unsigned int fd, 535asmlinkage long compat_sys_getdents(unsigned int fd,
529 struct compat_linux_dirent __user *dirent, 536 struct compat_linux_dirent __user *dirent,
530 unsigned int count); 537 unsigned int count);
531#ifdef __ARCH_WANT_COMPAT_SYS_GETDENTS64
532asmlinkage long compat_sys_getdents64(unsigned int fd,
533 struct linux_dirent64 __user *dirent,
534 unsigned int count);
535#endif
536asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, 538asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
537 unsigned int nr_segs, unsigned int flags); 539 unsigned int nr_segs, unsigned int flags);
538asmlinkage long compat_sys_open(const char __user *filename, int flags, 540asmlinkage long compat_sys_open(const char __user *filename, int flags,
@@ -723,6 +725,8 @@ asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
723asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32, 725asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32,
724 int, const char __user *); 726 int, const char __user *);
725 727
728asmlinkage long compat_sys_arch_prctl(int option, unsigned long arg2);
729
726/* 730/*
727 * For most but not all architectures, "am I in a compat syscall?" and 731 * For most but not all architectures, "am I in a compat syscall?" and
728 * "am I a compat task?" are the same question. For architectures on which 732 * "am I a compat task?" are the same question. For architectures on which
diff --git a/include/linux/console.h b/include/linux/console.h
index 5949d1855589..b8920a031a3e 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -212,4 +212,6 @@ extern bool vgacon_text_force(void);
212static inline bool vgacon_text_force(void) { return false; } 212static inline bool vgacon_text_force(void) { return false; }
213#endif 213#endif
214 214
215extern void console_init(void);
216
215#endif /* _LINUX_CONSOLE_H */ 217#endif /* _LINUX_CONSOLE_H */
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index 2a5982c37dfb..035c16c9a505 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -201,7 +201,7 @@ struct coresight_ops_sink {
201 void *sink_config); 201 void *sink_config);
202 unsigned long (*reset_buffer)(struct coresight_device *csdev, 202 unsigned long (*reset_buffer)(struct coresight_device *csdev,
203 struct perf_output_handle *handle, 203 struct perf_output_handle *handle,
204 void *sink_config, bool *lost); 204 void *sink_config);
205 void (*update_buffer)(struct coresight_device *csdev, 205 void (*update_buffer)(struct coresight_device *csdev,
206 struct perf_output_handle *handle, 206 struct perf_output_handle *handle,
207 void *sink_config); 207 void *sink_config);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 87165f06a307..a5ce0bbeadb5 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -120,6 +120,13 @@ struct cpufreq_policy {
120 bool fast_switch_possible; 120 bool fast_switch_possible;
121 bool fast_switch_enabled; 121 bool fast_switch_enabled;
122 122
123 /*
124 * Preferred average time interval between consecutive invocations of
125 * the driver to set the frequency for this policy. To be set by the
126 * scaling driver (0, which is the default, means no preference).
127 */
128 unsigned int transition_delay_us;
129
123 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */ 130 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
124 unsigned int cached_target_freq; 131 unsigned int cached_target_freq;
125 int cached_resolved_idx; 132 int cached_resolved_idx;
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 62d240e962f0..0f2a80377520 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -94,6 +94,7 @@ enum cpuhp_state {
94 CPUHP_AP_ARM_VFP_STARTING, 94 CPUHP_AP_ARM_VFP_STARTING,
95 CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING, 95 CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING,
96 CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING, 96 CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING,
97 CPUHP_AP_PERF_ARM_ACPI_STARTING,
97 CPUHP_AP_PERF_ARM_STARTING, 98 CPUHP_AP_PERF_ARM_STARTING,
98 CPUHP_AP_ARM_L2X0_STARTING, 99 CPUHP_AP_ARM_L2X0_STARTING,
99 CPUHP_AP_ARM_ARCH_TIMER_STARTING, 100 CPUHP_AP_ARM_ARCH_TIMER_STARTING,
@@ -137,6 +138,7 @@ enum cpuhp_state {
137 CPUHP_AP_PERF_ARM_CCN_ONLINE, 138 CPUHP_AP_PERF_ARM_CCN_ONLINE,
138 CPUHP_AP_PERF_ARM_L2X0_ONLINE, 139 CPUHP_AP_PERF_ARM_L2X0_ONLINE,
139 CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE, 140 CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE,
141 CPUHP_AP_PERF_ARM_QCOM_L3_ONLINE,
140 CPUHP_AP_WORKQUEUE_ONLINE, 142 CPUHP_AP_WORKQUEUE_ONLINE,
141 CPUHP_AP_RCUTREE_ONLINE, 143 CPUHP_AP_RCUTREE_ONLINE,
142 CPUHP_AP_ONLINE_DYN, 144 CPUHP_AP_ONLINE_DYN,
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 96f1e88b767c..2404ad238c0b 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -40,9 +40,9 @@ extern int nr_cpu_ids;
40#ifdef CONFIG_CPUMASK_OFFSTACK 40#ifdef CONFIG_CPUMASK_OFFSTACK
41/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also, 41/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
42 * not all bits may be allocated. */ 42 * not all bits may be allocated. */
43#define nr_cpumask_bits nr_cpu_ids 43#define nr_cpumask_bits ((unsigned int)nr_cpu_ids)
44#else 44#else
45#define nr_cpumask_bits NR_CPUS 45#define nr_cpumask_bits ((unsigned int)NR_CPUS)
46#endif 46#endif
47 47
48/* 48/*
@@ -667,6 +667,11 @@ void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
667void free_cpumask_var(cpumask_var_t mask); 667void free_cpumask_var(cpumask_var_t mask);
668void free_bootmem_cpumask_var(cpumask_var_t mask); 668void free_bootmem_cpumask_var(cpumask_var_t mask);
669 669
670static inline bool cpumask_available(cpumask_var_t mask)
671{
672 return mask != NULL;
673}
674
670#else 675#else
671typedef struct cpumask cpumask_var_t[1]; 676typedef struct cpumask cpumask_var_t[1];
672 677
@@ -708,6 +713,11 @@ static inline void free_cpumask_var(cpumask_var_t mask)
708static inline void free_bootmem_cpumask_var(cpumask_var_t mask) 713static inline void free_bootmem_cpumask_var(cpumask_var_t mask)
709{ 714{
710} 715}
716
717static inline bool cpumask_available(cpumask_var_t mask)
718{
719 return true;
720}
711#endif /* CONFIG_CPUMASK_OFFSTACK */ 721#endif /* CONFIG_CPUMASK_OFFSTACK */
712 722
713/* It's common to want to use cpu_all_mask in struct member initializers, 723/* It's common to want to use cpu_all_mask in struct member initializers,
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 611fce58d670..119a3f9604b0 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -42,7 +42,7 @@ static inline void cpuset_dec(void)
42 42
43extern int cpuset_init(void); 43extern int cpuset_init(void);
44extern void cpuset_init_smp(void); 44extern void cpuset_init_smp(void);
45extern void cpuset_update_active_cpus(bool cpu_online); 45extern void cpuset_update_active_cpus(void);
46extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 46extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
47extern void cpuset_cpus_allowed_fallback(struct task_struct *p); 47extern void cpuset_cpus_allowed_fallback(struct task_struct *p);
48extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 48extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
@@ -155,7 +155,7 @@ static inline bool cpusets_enabled(void) { return false; }
155static inline int cpuset_init(void) { return 0; } 155static inline int cpuset_init(void) { return 0; }
156static inline void cpuset_init_smp(void) {} 156static inline void cpuset_init_smp(void) {}
157 157
158static inline void cpuset_update_active_cpus(bool cpu_online) 158static inline void cpuset_update_active_cpus(void)
159{ 159{
160 partition_sched_domains(1, NULL, NULL); 160 partition_sched_domains(1, NULL, NULL);
161} 161}
diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
new file mode 100644
index 000000000000..541a197ba4a2
--- /dev/null
+++ b/include/linux/crash_core.h
@@ -0,0 +1,69 @@
1#ifndef LINUX_CRASH_CORE_H
2#define LINUX_CRASH_CORE_H
3
4#include <linux/linkage.h>
5#include <linux/elfcore.h>
6#include <linux/elf.h>
7
8#define CRASH_CORE_NOTE_NAME "CORE"
9#define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
10#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(CRASH_CORE_NOTE_NAME), 4)
11#define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
12
13#define CRASH_CORE_NOTE_BYTES ((CRASH_CORE_NOTE_HEAD_BYTES * 2) + \
14 CRASH_CORE_NOTE_NAME_BYTES + \
15 CRASH_CORE_NOTE_DESC_BYTES)
16
17#define VMCOREINFO_BYTES (4096)
18#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
19#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
20#define VMCOREINFO_NOTE_SIZE ((CRASH_CORE_NOTE_HEAD_BYTES * 2) + \
21 VMCOREINFO_NOTE_NAME_BYTES + \
22 VMCOREINFO_BYTES)
23
24typedef u32 note_buf_t[CRASH_CORE_NOTE_BYTES/4];
25
26void crash_save_vmcoreinfo(void);
27void arch_crash_save_vmcoreinfo(void);
28__printf(1, 2)
29void vmcoreinfo_append_str(const char *fmt, ...);
30phys_addr_t paddr_vmcoreinfo_note(void);
31
32#define VMCOREINFO_OSRELEASE(value) \
33 vmcoreinfo_append_str("OSRELEASE=%s\n", value)
34#define VMCOREINFO_PAGESIZE(value) \
35 vmcoreinfo_append_str("PAGESIZE=%ld\n", value)
36#define VMCOREINFO_SYMBOL(name) \
37 vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
38#define VMCOREINFO_SIZE(name) \
39 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
40 (unsigned long)sizeof(name))
41#define VMCOREINFO_STRUCT_SIZE(name) \
42 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
43 (unsigned long)sizeof(struct name))
44#define VMCOREINFO_OFFSET(name, field) \
45 vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
46 (unsigned long)offsetof(struct name, field))
47#define VMCOREINFO_LENGTH(name, value) \
48 vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
49#define VMCOREINFO_NUMBER(name) \
50 vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
51#define VMCOREINFO_CONFIG(name) \
52 vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
53
54extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
55extern size_t vmcoreinfo_size;
56extern size_t vmcoreinfo_max_size;
57
58Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
59 void *data, size_t data_len);
60void final_note(Elf_Word *buf);
61
62int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
63 unsigned long long *crash_size, unsigned long long *crash_base);
64int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
65 unsigned long long *crash_size, unsigned long long *crash_base);
66int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
67 unsigned long long *crash_size, unsigned long long *crash_base);
68
69#endif /* LINUX_CRASH_CORE_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index c0b0cf3d2d2f..84da9978e951 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -123,7 +123,7 @@
123/* 123/*
124 * Miscellaneous stuff. 124 * Miscellaneous stuff.
125 */ 125 */
126#define CRYPTO_MAX_ALG_NAME 64 126#define CRYPTO_MAX_ALG_NAME 128
127 127
128/* 128/*
129 * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual 129 * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
diff --git a/include/linux/cryptohash.h b/include/linux/cryptohash.h
index 3252799832cf..df4d3e943d28 100644
--- a/include/linux/cryptohash.h
+++ b/include/linux/cryptohash.h
@@ -10,9 +10,4 @@
10void sha_init(__u32 *buf); 10void sha_init(__u32 *buf);
11void sha_transform(__u32 *digest, const char *data, __u32 *W); 11void sha_transform(__u32 *digest, const char *data, __u32 *W);
12 12
13#define MD5_DIGEST_WORDS 4
14#define MD5_MESSAGE_BYTES 64
15
16void md5_transform(__u32 *hash, __u32 const *in);
17
18#endif 13#endif
diff --git a/include/linux/dax.h b/include/linux/dax.h
index d8a3dc042e1c..5ec1f6c47716 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -7,6 +7,74 @@
7#include <asm/pgtable.h> 7#include <asm/pgtable.h>
8 8
9struct iomap_ops; 9struct iomap_ops;
10struct dax_device;
11struct dax_operations {
12 /*
13 * direct_access: translate a device-relative
14 * logical-page-offset into an absolute physical pfn. Return the
15 * number of pages available for DAX at that pfn.
16 */
17 long (*direct_access)(struct dax_device *, pgoff_t, long,
18 void **, pfn_t *);
19};
20
21#if IS_ENABLED(CONFIG_DAX)
22struct dax_device *dax_get_by_host(const char *host);
23void put_dax(struct dax_device *dax_dev);
24#else
25static inline struct dax_device *dax_get_by_host(const char *host)
26{
27 return NULL;
28}
29
30static inline void put_dax(struct dax_device *dax_dev)
31{
32}
33#endif
34
35int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff);
36#if IS_ENABLED(CONFIG_FS_DAX)
37int __bdev_dax_supported(struct super_block *sb, int blocksize);
38static inline int bdev_dax_supported(struct super_block *sb, int blocksize)
39{
40 return __bdev_dax_supported(sb, blocksize);
41}
42
43static inline struct dax_device *fs_dax_get_by_host(const char *host)
44{
45 return dax_get_by_host(host);
46}
47
48static inline void fs_put_dax(struct dax_device *dax_dev)
49{
50 put_dax(dax_dev);
51}
52
53#else
54static inline int bdev_dax_supported(struct super_block *sb, int blocksize)
55{
56 return -EOPNOTSUPP;
57}
58
59static inline struct dax_device *fs_dax_get_by_host(const char *host)
60{
61 return NULL;
62}
63
64static inline void fs_put_dax(struct dax_device *dax_dev)
65{
66}
67#endif
68
69int dax_read_lock(void);
70void dax_read_unlock(int id);
71struct dax_device *alloc_dax(void *private, const char *host,
72 const struct dax_operations *ops);
73bool dax_alive(struct dax_device *dax_dev);
74void kill_dax(struct dax_device *dax_dev);
75void *dax_get_private(struct dax_device *dax_dev);
76long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
77 void **kaddr, pfn_t *pfn);
10 78
11/* 79/*
12 * We use lowest available bit in exceptional entry for locking, one bit for 80 * We use lowest available bit in exceptional entry for locking, one bit for
@@ -41,24 +109,19 @@ ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
41int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size, 109int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size,
42 const struct iomap_ops *ops); 110 const struct iomap_ops *ops);
43int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index); 111int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
44int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index);
45int dax_invalidate_mapping_entry_sync(struct address_space *mapping, 112int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
46 pgoff_t index); 113 pgoff_t index);
47void dax_wake_mapping_entry_waiter(struct address_space *mapping, 114void dax_wake_mapping_entry_waiter(struct address_space *mapping,
48 pgoff_t index, void *entry, bool wake_all); 115 pgoff_t index, void *entry, bool wake_all);
49 116
50#ifdef CONFIG_FS_DAX 117#ifdef CONFIG_FS_DAX
51struct page *read_dax_sector(struct block_device *bdev, sector_t n); 118int __dax_zero_page_range(struct block_device *bdev,
52int __dax_zero_page_range(struct block_device *bdev, sector_t sector, 119 struct dax_device *dax_dev, sector_t sector,
53 unsigned int offset, unsigned int length); 120 unsigned int offset, unsigned int length);
54#else 121#else
55static inline struct page *read_dax_sector(struct block_device *bdev,
56 sector_t n)
57{
58 return ERR_PTR(-ENXIO);
59}
60static inline int __dax_zero_page_range(struct block_device *bdev, 122static inline int __dax_zero_page_range(struct block_device *bdev,
61 sector_t sector, unsigned int offset, unsigned int length) 123 struct dax_device *dax_dev, sector_t sector,
124 unsigned int offset, unsigned int length)
62{ 125{
63 return -ENXIO; 126 return -ENXIO;
64} 127}
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 7dff776e6d16..9174b0d28582 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -74,7 +74,7 @@ static const struct file_operations __fops = { \
74 .release = simple_attr_release, \ 74 .release = simple_attr_release, \
75 .read = debugfs_attr_read, \ 75 .read = debugfs_attr_read, \
76 .write = debugfs_attr_write, \ 76 .write = debugfs_attr_write, \
77 .llseek = generic_file_llseek, \ 77 .llseek = no_llseek, \
78} 78}
79 79
80#if defined(CONFIG_DEBUG_FS) 80#if defined(CONFIG_DEBUG_FS)
diff --git a/include/linux/dell-led.h b/include/linux/dell-led.h
index 7009b8bec77b..3f033c48071e 100644
--- a/include/linux/dell-led.h
+++ b/include/linux/dell-led.h
@@ -1,10 +1,6 @@
1#ifndef __DELL_LED_H__ 1#ifndef __DELL_LED_H__
2#define __DELL_LED_H__ 2#define __DELL_LED_H__
3 3
4enum { 4int dell_micmute_led_set(int on);
5 DELL_LED_MICMUTE,
6};
7
8int dell_app_wmi_led_set(int whichled, int on);
9 5
10#endif 6#endif
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index e0acb0e5243b..6c220e4ebb6b 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -27,6 +27,7 @@
27#define DEVFREQ_POSTCHANGE (1) 27#define DEVFREQ_POSTCHANGE (1)
28 28
29struct devfreq; 29struct devfreq;
30struct devfreq_governor;
30 31
31/** 32/**
32 * struct devfreq_dev_status - Data given from devfreq user device to 33 * struct devfreq_dev_status - Data given from devfreq user device to
@@ -101,35 +102,6 @@ struct devfreq_dev_profile {
101}; 102};
102 103
103/** 104/**
104 * struct devfreq_governor - Devfreq policy governor
105 * @node: list node - contains registered devfreq governors
106 * @name: Governor's name
107 * @immutable: Immutable flag for governor. If the value is 1,
108 * this govenror is never changeable to other governor.
109 * @get_target_freq: Returns desired operating frequency for the device.
110 * Basically, get_target_freq will run
111 * devfreq_dev_profile.get_dev_status() to get the
112 * status of the device (load = busy_time / total_time).
113 * If no_central_polling is set, this callback is called
114 * only with update_devfreq() notified by OPP.
115 * @event_handler: Callback for devfreq core framework to notify events
116 * to governors. Events include per device governor
117 * init and exit, opp changes out of devfreq, suspend
118 * and resume of per device devfreq during device idle.
119 *
120 * Note that the callbacks are called with devfreq->lock locked by devfreq.
121 */
122struct devfreq_governor {
123 struct list_head node;
124
125 const char name[DEVFREQ_NAME_LEN];
126 const unsigned int immutable;
127 int (*get_target_freq)(struct devfreq *this, unsigned long *freq);
128 int (*event_handler)(struct devfreq *devfreq,
129 unsigned int event, void *data);
130};
131
132/**
133 * struct devfreq - Device devfreq structure 105 * struct devfreq - Device devfreq structure
134 * @node: list node - contains the devices with devfreq that have been 106 * @node: list node - contains the devices with devfreq that have been
135 * registered. 107 * registered.
diff --git a/include/linux/devfreq_cooling.h b/include/linux/devfreq_cooling.h
index c35d0c0e0ada..4635f95000a4 100644
--- a/include/linux/devfreq_cooling.h
+++ b/include/linux/devfreq_cooling.h
@@ -34,6 +34,23 @@
34 * If get_dynamic_power() is NULL, then the 34 * If get_dynamic_power() is NULL, then the
35 * dynamic power is calculated as 35 * dynamic power is calculated as
36 * @dyn_power_coeff * frequency * voltage^2 36 * @dyn_power_coeff * frequency * voltage^2
37 * @get_real_power: When this is set, the framework uses it to ask the
38 * device driver for the actual power.
39 * Some devices have more sophisticated methods
40 * (like power counters) to approximate the actual power
41 * that they use.
42 * This function provides more accurate data to the
43 * thermal governor. When the driver does not provide
44 * such function, framework just uses pre-calculated
45 * table and scale the power by 'utilization'
46 * (based on 'busy_time' and 'total_time' taken from
47 * devfreq 'last_status').
48 * The value returned by this function must be lower
49 * or equal than the maximum power value
50 * for the current state
51 * (which can be found in power_table[state]).
52 * When this interface is used, the power_table holds
53 * max total (static + dynamic) power value for each OPP.
37 */ 54 */
38struct devfreq_cooling_power { 55struct devfreq_cooling_power {
39 unsigned long (*get_static_power)(struct devfreq *devfreq, 56 unsigned long (*get_static_power)(struct devfreq *devfreq,
@@ -41,6 +58,8 @@ struct devfreq_cooling_power {
41 unsigned long (*get_dynamic_power)(struct devfreq *devfreq, 58 unsigned long (*get_dynamic_power)(struct devfreq *devfreq,
42 unsigned long freq, 59 unsigned long freq,
43 unsigned long voltage); 60 unsigned long voltage);
61 int (*get_real_power)(struct devfreq *df, u32 *power,
62 unsigned long freq, unsigned long voltage);
44 unsigned long dyn_power_coeff; 63 unsigned long dyn_power_coeff;
45}; 64};
46 65
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index a7e6903866fd..f4c639c0c362 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -22,11 +22,13 @@ struct bio_vec;
22/* 22/*
23 * Type of table, mapped_device's mempool and request_queue 23 * Type of table, mapped_device's mempool and request_queue
24 */ 24 */
25#define DM_TYPE_NONE 0 25enum dm_queue_mode {
26#define DM_TYPE_BIO_BASED 1 26 DM_TYPE_NONE = 0,
27#define DM_TYPE_REQUEST_BASED 2 27 DM_TYPE_BIO_BASED = 1,
28#define DM_TYPE_MQ_REQUEST_BASED 3 28 DM_TYPE_REQUEST_BASED = 2,
29#define DM_TYPE_DAX_BIO_BASED 4 29 DM_TYPE_MQ_REQUEST_BASED = 3,
30 DM_TYPE_DAX_BIO_BASED = 4,
31};
30 32
31typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; 33typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
32 34
@@ -128,13 +130,15 @@ typedef int (*dm_busy_fn) (struct dm_target *ti);
128 * < 0 : error 130 * < 0 : error
129 * >= 0 : the number of bytes accessible at the address 131 * >= 0 : the number of bytes accessible at the address
130 */ 132 */
131typedef long (*dm_direct_access_fn) (struct dm_target *ti, sector_t sector, 133typedef long (*dm_dax_direct_access_fn) (struct dm_target *ti, pgoff_t pgoff,
132 void **kaddr, pfn_t *pfn, long size); 134 long nr_pages, void **kaddr, pfn_t *pfn);
135#define PAGE_SECTORS (PAGE_SIZE / 512)
133 136
134void dm_error(const char *message); 137void dm_error(const char *message);
135 138
136struct dm_dev { 139struct dm_dev {
137 struct block_device *bdev; 140 struct block_device *bdev;
141 struct dax_device *dax_dev;
138 fmode_t mode; 142 fmode_t mode;
139 char name[16]; 143 char name[16];
140}; 144};
@@ -176,7 +180,7 @@ struct target_type {
176 dm_busy_fn busy; 180 dm_busy_fn busy;
177 dm_iterate_devices_fn iterate_devices; 181 dm_iterate_devices_fn iterate_devices;
178 dm_io_hints_fn io_hints; 182 dm_io_hints_fn io_hints;
179 dm_direct_access_fn direct_access; 183 dm_dax_direct_access_fn direct_access;
180 184
181 /* For internal device-mapper use. */ 185 /* For internal device-mapper use. */
182 struct list_head list; 186 struct list_head list;
@@ -221,6 +225,18 @@ struct target_type {
221 */ 225 */
222typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio); 226typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio);
223 227
228/*
229 * A target implements own bio data integrity.
230 */
231#define DM_TARGET_INTEGRITY 0x00000010
232#define dm_target_has_integrity(type) ((type)->features & DM_TARGET_INTEGRITY)
233
234/*
235 * A target passes integrity data to the lower device.
236 */
237#define DM_TARGET_PASSES_INTEGRITY 0x00000020
238#define dm_target_passes_integrity(type) ((type)->features & DM_TARGET_PASSES_INTEGRITY)
239
224struct dm_target { 240struct dm_target {
225 struct dm_table *table; 241 struct dm_table *table;
226 struct target_type *type; 242 struct target_type *type;
@@ -255,6 +271,12 @@ struct dm_target {
255 unsigned num_write_same_bios; 271 unsigned num_write_same_bios;
256 272
257 /* 273 /*
274 * The number of WRITE ZEROES bios that will be submitted to the target.
275 * The bio number can be accessed with dm_bio_get_target_bio_nr.
276 */
277 unsigned num_write_zeroes_bios;
278
279 /*
258 * The minimum number of extra bytes allocated in each io for the 280 * The minimum number of extra bytes allocated in each io for the
259 * target to use. 281 * target to use.
260 */ 282 */
@@ -290,11 +312,6 @@ struct dm_target {
290 * on max_io_len boundary. 312 * on max_io_len boundary.
291 */ 313 */
292 bool split_discard_bios:1; 314 bool split_discard_bios:1;
293
294 /*
295 * Set if this target does not return zeroes on discarded blocks.
296 */
297 bool discard_zeroes_data_unsupported:1;
298}; 315};
299 316
300/* Each target can link one of these into the table */ 317/* Each target can link one of these into the table */
@@ -464,7 +481,7 @@ void dm_table_add_target_callbacks(struct dm_table *t, struct dm_target_callback
464 * Useful for "hybrid" target (supports both bio-based 481 * Useful for "hybrid" target (supports both bio-based
465 * and request-based). 482 * and request-based).
466 */ 483 */
467void dm_table_set_type(struct dm_table *t, unsigned type); 484void dm_table_set_type(struct dm_table *t, enum dm_queue_mode type);
468 485
469/* 486/*
470 * Finally call this to make the table ready for use. 487 * Finally call this to make the table ready for use.
@@ -578,6 +595,7 @@ extern struct ratelimit_state dm_ratelimit_state;
578/* 595/*
579 * Definitions of return values from target end_io function. 596 * Definitions of return values from target end_io function.
580 */ 597 */
598#define DM_ENDIO_DONE 0
581#define DM_ENDIO_INCOMPLETE 1 599#define DM_ENDIO_INCOMPLETE 1
582#define DM_ENDIO_REQUEUE 2 600#define DM_ENDIO_REQUEUE 2
583 601
@@ -588,6 +606,7 @@ extern struct ratelimit_state dm_ratelimit_state;
588#define DM_MAPIO_REMAPPED 1 606#define DM_MAPIO_REMAPPED 1
589#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE 607#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
590#define DM_MAPIO_DELAY_REQUEUE 3 608#define DM_MAPIO_DELAY_REQUEUE 3
609#define DM_MAPIO_KILL 4
591 610
592#define dm_sector_div64(x, y)( \ 611#define dm_sector_div64(x, y)( \
593{ \ 612{ \
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index bfb3704fc6fc..79f27d60ec66 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -39,13 +39,13 @@ 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 * @kmap_atomic: maps a page from the buffer into kernel address 42 * @map_atomic: 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 * @kunmap_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 * @kmap: maps a page from the buffer into kernel address space. 47 * @map: maps a page from the buffer into kernel address space.
48 * @kunmap: [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.
51 * @vunmap: [optional] unmaps a vmap from the buffer 51 * @vunmap: [optional] unmaps a vmap from the buffer
@@ -206,10 +206,10 @@ struct dma_buf_ops {
206 * to be restarted. 206 * to be restarted.
207 */ 207 */
208 int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); 208 int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction);
209 void *(*kmap_atomic)(struct dma_buf *, unsigned long); 209 void *(*map_atomic)(struct dma_buf *, unsigned long);
210 void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *); 210 void (*unmap_atomic)(struct dma_buf *, unsigned long, void *);
211 void *(*kmap)(struct dma_buf *, unsigned long); 211 void *(*map)(struct dma_buf *, unsigned long);
212 void (*kunmap)(struct dma_buf *, unsigned long, void *); 212 void (*unmap)(struct dma_buf *, unsigned long, void *);
213 213
214 /** 214 /**
215 * @mmap: 215 * @mmap:
diff --git a/include/linux/dma-fence-array.h b/include/linux/dma-fence-array.h
index 5900945f962d..332a5420243c 100644
--- a/include/linux/dma-fence-array.h
+++ b/include/linux/dma-fence-array.h
@@ -83,4 +83,6 @@ struct dma_fence_array *dma_fence_array_create(int num_fences,
83 u64 context, unsigned seqno, 83 u64 context, unsigned seqno,
84 bool signal_on_any); 84 bool signal_on_any);
85 85
86bool dma_fence_match_context(struct dma_fence *fence, u64 context);
87
86#endif /* __LINUX_DMA_FENCE_ARRAY_H */ 88#endif /* __LINUX_DMA_FENCE_ARRAY_H */
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 6048fa404e57..a5195a7d6f77 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -229,7 +229,7 @@ static inline struct dma_fence *dma_fence_get_rcu(struct dma_fence *fence)
229 * 229 *
230 * Function returns NULL if no refcount could be obtained, or the fence. 230 * Function returns NULL if no refcount could be obtained, or the fence.
231 * This function handles acquiring a reference to a fence that may be 231 * This function handles acquiring a reference to a fence that may be
232 * reallocated within the RCU grace period (such as with SLAB_DESTROY_BY_RCU), 232 * reallocated within the RCU grace period (such as with SLAB_TYPESAFE_BY_RCU),
233 * so long as the caller is using RCU on the pointer to the fence. 233 * so long as the caller is using RCU on the pointer to the fence.
234 * 234 *
235 * An alternative mechanism is to employ a seqlock to protect a bunch of 235 * An alternative mechanism is to employ a seqlock to protect a bunch of
@@ -257,7 +257,7 @@ dma_fence_get_rcu_safe(struct dma_fence * __rcu *fencep)
257 * have successfully acquire a reference to it. If it no 257 * have successfully acquire a reference to it. If it no
258 * longer matches, we are holding a reference to some other 258 * longer matches, we are holding a reference to some other
259 * reallocated pointer. This is possible if the allocator 259 * reallocated pointer. This is possible if the allocator
260 * is using a freelist like SLAB_DESTROY_BY_RCU where the 260 * is using a freelist like SLAB_TYPESAFE_BY_RCU where the
261 * fence remains valid for the RCU grace period, but it 261 * fence remains valid for the RCU grace period, but it
262 * may be reallocated. When using such allocators, we are 262 * may be reallocated. When using such allocators, we are
263 * responsible for ensuring the reference we get is to 263 * responsible for ensuring the reference we get is to
diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
index 5725c94b1f12..4eac2670bfa1 100644
--- a/include/linux/dma-iommu.h
+++ b/include/linux/dma-iommu.h
@@ -20,6 +20,7 @@
20#include <asm/errno.h> 20#include <asm/errno.h>
21 21
22#ifdef CONFIG_IOMMU_DMA 22#ifdef CONFIG_IOMMU_DMA
23#include <linux/dma-mapping.h>
23#include <linux/iommu.h> 24#include <linux/iommu.h>
24#include <linux/msi.h> 25#include <linux/msi.h>
25 26
@@ -71,6 +72,7 @@ int iommu_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
71 72
72/* The DMA API isn't _quite_ the whole story, though... */ 73/* The DMA API isn't _quite_ the whole story, though... */
73void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg); 74void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg);
75void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);
74 76
75#else 77#else
76 78
@@ -100,6 +102,10 @@ static inline void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg)
100{ 102{
101} 103}
102 104
105static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list)
106{
107}
108
103#endif /* CONFIG_IOMMU_DMA */ 109#endif /* CONFIG_IOMMU_DMA */
104#endif /* __KERNEL__ */ 110#endif /* __KERNEL__ */
105#endif /* __DMA_IOMMU_H */ 111#endif /* __DMA_IOMMU_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 0977317c6835..4f3eecedca2d 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -728,6 +728,18 @@ dma_mark_declared_memory_occupied(struct device *dev,
728} 728}
729#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ 729#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */
730 730
731#ifdef CONFIG_HAS_DMA
732int dma_configure(struct device *dev);
733void dma_deconfigure(struct device *dev);
734#else
735static inline int dma_configure(struct device *dev)
736{
737 return 0;
738}
739
740static inline void dma_deconfigure(struct device *dev) {}
741#endif
742
731/* 743/*
732 * Managed DMA API 744 * Managed DMA API
733 */ 745 */
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index 187c10299722..90884072fa73 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -39,6 +39,7 @@ extern int iommu_calculate_agaw(struct intel_iommu *iommu);
39extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); 39extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
40extern int dmar_disabled; 40extern int dmar_disabled;
41extern int intel_iommu_enabled; 41extern int intel_iommu_enabled;
42extern int intel_iommu_tboot_noforce;
42#else 43#else
43static inline int iommu_calculate_agaw(struct intel_iommu *iommu) 44static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
44{ 45{
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 5b6adf964248..8ae0f45fafd6 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -28,12 +28,10 @@ struct device;
28#define EDAC_OPSTATE_INT 2 28#define EDAC_OPSTATE_INT 2
29 29
30extern int edac_op_state; 30extern int edac_op_state;
31extern int edac_err_assert;
32extern atomic_t edac_handlers;
33 31
34extern int edac_handler_set(void); 32struct bus_type *edac_get_sysfs_subsys(void);
35extern void edac_atomic_assert_error(void); 33int edac_get_report_status(void);
36extern struct bus_type *edac_get_sysfs_subsys(void); 34void edac_set_report_status(int new);
37 35
38enum { 36enum {
39 EDAC_REPORTING_ENABLED, 37 EDAC_REPORTING_ENABLED,
@@ -41,28 +39,6 @@ enum {
41 EDAC_REPORTING_FORCE 39 EDAC_REPORTING_FORCE
42}; 40};
43 41
44extern int edac_report_status;
45#ifdef CONFIG_EDAC
46static inline int get_edac_report_status(void)
47{
48 return edac_report_status;
49}
50
51static inline void set_edac_report_status(int new)
52{
53 edac_report_status = new;
54}
55#else
56static inline int get_edac_report_status(void)
57{
58 return EDAC_REPORTING_DISABLED;
59}
60
61static inline void set_edac_report_status(int new)
62{
63}
64#endif
65
66static inline void opstate_init(void) 42static inline void opstate_init(void)
67{ 43{
68 switch (edac_op_state) { 44 switch (edac_op_state) {
diff --git a/include/linux/efi-bgrt.h b/include/linux/efi-bgrt.h
index 2fd3993c370b..e6f624b53c3d 100644
--- a/include/linux/efi-bgrt.h
+++ b/include/linux/efi-bgrt.h
@@ -6,6 +6,7 @@
6#ifdef CONFIG_ACPI_BGRT 6#ifdef CONFIG_ACPI_BGRT
7 7
8void efi_bgrt_init(struct acpi_table_header *table); 8void efi_bgrt_init(struct acpi_table_header *table);
9int __init acpi_parse_bgrt(struct acpi_table_header *table);
9 10
10/* The BGRT data itself; only valid if bgrt_image != NULL. */ 11/* The BGRT data itself; only valid if bgrt_image != NULL. */
11extern size_t bgrt_image_size; 12extern size_t bgrt_image_size;
@@ -14,6 +15,10 @@ extern struct acpi_table_bgrt bgrt_tab;
14#else /* !CONFIG_ACPI_BGRT */ 15#else /* !CONFIG_ACPI_BGRT */
15 16
16static inline void efi_bgrt_init(struct acpi_table_header *table) {} 17static inline void efi_bgrt_init(struct acpi_table_header *table) {}
18static inline int __init acpi_parse_bgrt(struct acpi_table_header *table)
19{
20 return 0;
21}
17 22
18#endif /* !CONFIG_ACPI_BGRT */ 23#endif /* !CONFIG_ACPI_BGRT */
19 24
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 94d34e0be24f..ec36f42a2add 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1435,9 +1435,6 @@ static inline int efi_runtime_map_copy(void *buf, size_t bufsz)
1435 1435
1436/* prototypes shared between arch specific and generic stub code */ 1436/* prototypes shared between arch specific and generic stub code */
1437 1437
1438#define pr_efi(sys_table, msg) efi_printk(sys_table, "EFI stub: "msg)
1439#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
1440
1441void efi_printk(efi_system_table_t *sys_table_arg, char *str); 1438void efi_printk(efi_system_table_t *sys_table_arg, char *str);
1442 1439
1443void efi_free(efi_system_table_t *sys_table_arg, unsigned long size, 1440void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
@@ -1471,7 +1468,7 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
1471 unsigned long *load_addr, 1468 unsigned long *load_addr,
1472 unsigned long *load_size); 1469 unsigned long *load_size);
1473 1470
1474efi_status_t efi_parse_options(char *cmdline); 1471efi_status_t efi_parse_options(char const *cmdline);
1475 1472
1476efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, 1473efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg,
1477 struct screen_info *si, efi_guid_t *proto, 1474 struct screen_info *si, efi_guid_t *proto,
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index aebecc4ed088..9ec5e22846e0 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -8,6 +8,9 @@
8 8
9struct io_cq; 9struct io_cq;
10struct elevator_type; 10struct elevator_type;
11#ifdef CONFIG_BLK_DEBUG_FS
12struct blk_mq_debugfs_attr;
13#endif
11 14
12/* 15/*
13 * Return values from elevator merger 16 * Return values from elevator merger
@@ -93,6 +96,8 @@ struct blk_mq_hw_ctx;
93struct elevator_mq_ops { 96struct elevator_mq_ops {
94 int (*init_sched)(struct request_queue *, struct elevator_type *); 97 int (*init_sched)(struct request_queue *, struct elevator_type *);
95 void (*exit_sched)(struct elevator_queue *); 98 void (*exit_sched)(struct elevator_queue *);
99 int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int);
100 void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int);
96 101
97 bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); 102 bool (*allow_merge)(struct request_queue *, struct request *, struct bio *);
98 bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *); 103 bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *);
@@ -104,7 +109,7 @@ struct elevator_mq_ops {
104 void (*insert_requests)(struct blk_mq_hw_ctx *, struct list_head *, bool); 109 void (*insert_requests)(struct blk_mq_hw_ctx *, struct list_head *, bool);
105 struct request *(*dispatch_request)(struct blk_mq_hw_ctx *); 110 struct request *(*dispatch_request)(struct blk_mq_hw_ctx *);
106 bool (*has_work)(struct blk_mq_hw_ctx *); 111 bool (*has_work)(struct blk_mq_hw_ctx *);
107 void (*completed_request)(struct blk_mq_hw_ctx *, struct request *); 112 void (*completed_request)(struct request *);
108 void (*started_request)(struct request *); 113 void (*started_request)(struct request *);
109 void (*requeue_request)(struct request *); 114 void (*requeue_request)(struct request *);
110 struct request *(*former_request)(struct request_queue *, struct request *); 115 struct request *(*former_request)(struct request_queue *, struct request *);
@@ -142,6 +147,10 @@ struct elevator_type
142 char elevator_name[ELV_NAME_MAX]; 147 char elevator_name[ELV_NAME_MAX];
143 struct module *elevator_owner; 148 struct module *elevator_owner;
144 bool uses_mq; 149 bool uses_mq;
150#ifdef CONFIG_BLK_DEBUG_FS
151 const struct blk_mq_debugfs_attr *queue_debugfs_attrs;
152 const struct blk_mq_debugfs_attr *hctx_debugfs_attrs;
153#endif
145 154
146 /* managed by elevator core */ 155 /* managed by elevator core */
147 char icq_cache_name[ELV_NAME_MAX + 5]; /* elvname + "_io_cq" */ 156 char icq_cache_name[ELV_NAME_MAX + 5]; /* elvname + "_io_cq" */
@@ -211,8 +220,7 @@ extern ssize_t elv_iosched_show(struct request_queue *, char *);
211extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t); 220extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
212 221
213extern int elevator_init(struct request_queue *, char *); 222extern int elevator_init(struct request_queue *, char *);
214extern void elevator_exit(struct elevator_queue *); 223extern void elevator_exit(struct request_queue *, struct elevator_queue *);
215extern int elevator_change(struct request_queue *, const char *);
216extern bool elv_bio_merge_ok(struct request *, struct bio *); 224extern bool elv_bio_merge_ok(struct request *, struct bio *);
217extern struct elevator_queue *elevator_alloc(struct request_queue *, 225extern struct elevator_queue *elevator_alloc(struct request_queue *,
218 struct elevator_type *); 226 struct elevator_type *);
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 20fa8d8ae313..ba069e8f4f78 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -29,6 +29,7 @@ extern Elf32_Dyn _DYNAMIC [];
29#define elf_note elf32_note 29#define elf_note elf32_note
30#define elf_addr_t Elf32_Off 30#define elf_addr_t Elf32_Off
31#define Elf_Half Elf32_Half 31#define Elf_Half Elf32_Half
32#define Elf_Word Elf32_Word
32 33
33#else 34#else
34 35
@@ -39,6 +40,7 @@ extern Elf64_Dyn _DYNAMIC [];
39#define elf_note elf64_note 40#define elf_note elf64_note
40#define elf_addr_t Elf64_Off 41#define elf_addr_t Elf64_Off
41#define Elf_Half Elf64_Half 42#define Elf_Half Elf64_Half
43#define Elf_Word Elf64_Word
42 44
43#endif 45#endif
44 46
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index c62b709b1ce0..2d9f80848d4b 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -447,21 +447,6 @@ static inline void eth_addr_dec(u8 *addr)
447} 447}
448 448
449/** 449/**
450 * ether_addr_greater - Compare two Ethernet addresses
451 * @addr1: Pointer to a six-byte array containing the Ethernet address
452 * @addr2: Pointer other six-byte array containing the Ethernet address
453 *
454 * Compare two Ethernet addresses, returns true addr1 is greater than addr2
455 */
456static inline bool ether_addr_greater(const u8 *addr1, const u8 *addr2)
457{
458 u64 u1 = ether_addr_to_u64(addr1);
459 u64 u2 = ether_addr_to_u64(addr2);
460
461 return u1 > u2;
462}
463
464/**
465 * is_etherdev_addr - Tell if given Ethernet address belongs to the device. 450 * is_etherdev_addr - Tell if given Ethernet address belongs to the device.
466 * @dev: Pointer to a device structure 451 * @dev: Pointer to a device structure
467 * @addr: Pointer to a six-byte array containing the Ethernet address 452 * @addr: Pointer to a six-byte array containing the Ethernet address
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 9ded8c6d8176..83cc9863444b 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -60,6 +60,7 @@ enum ethtool_phys_id_state {
60enum { 60enum {
61 ETH_RSS_HASH_TOP_BIT, /* Configurable RSS hash function - Toeplitz */ 61 ETH_RSS_HASH_TOP_BIT, /* Configurable RSS hash function - Toeplitz */
62 ETH_RSS_HASH_XOR_BIT, /* Configurable RSS hash function - Xor */ 62 ETH_RSS_HASH_XOR_BIT, /* Configurable RSS hash function - Xor */
63 ETH_RSS_HASH_CRC32_BIT, /* Configurable RSS hash function - Crc32 */
63 64
64 /* 65 /*
65 * Add your fresh new hash function bits above and remember to update 66 * Add your fresh new hash function bits above and remember to update
@@ -73,6 +74,7 @@ enum {
73 74
74#define ETH_RSS_HASH_TOP __ETH_RSS_HASH(TOP) 75#define ETH_RSS_HASH_TOP __ETH_RSS_HASH(TOP)
75#define ETH_RSS_HASH_XOR __ETH_RSS_HASH(XOR) 76#define ETH_RSS_HASH_XOR __ETH_RSS_HASH(XOR)
77#define ETH_RSS_HASH_CRC32 __ETH_RSS_HASH(CRC32)
76 78
77#define ETH_RSS_HASH_UNKNOWN 0 79#define ETH_RSS_HASH_UNKNOWN 0
78#define ETH_RSS_HASH_NO_CHANGE 0 80#define ETH_RSS_HASH_NO_CHANGE 0
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 7010fb01a81a..7e206a9f88db 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -236,11 +236,11 @@ extern int extcon_set_property_capability(struct extcon_dev *edev,
236 unsigned int id, unsigned int prop); 236 unsigned int id, unsigned int prop);
237 237
238/* 238/*
239 * Following APIs are to monitor every action of a notifier. 239 * Following APIs are to monitor the status change of the external connectors.
240 * Registrar gets notified for every external port of a connection device. 240 * extcon_register_notifier(*edev, id, *nb) : Register a notifier block
241 * Probably this could be used to debug an action of notifier; however, 241 * for specific external connector of the extcon.
242 * we do not recommend to use this for normal 'notifiee' device drivers who 242 * extcon_register_notifier_all(*edev, *nb) : Register a notifier block
243 * want to be notified by a specific external port of the notifier. 243 * for all supported external connectors of the extcon.
244 */ 244 */
245extern int extcon_register_notifier(struct extcon_dev *edev, unsigned int id, 245extern int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
246 struct notifier_block *nb); 246 struct notifier_block *nb);
@@ -253,6 +253,17 @@ extern void devm_extcon_unregister_notifier(struct device *dev,
253 struct extcon_dev *edev, unsigned int id, 253 struct extcon_dev *edev, unsigned int id,
254 struct notifier_block *nb); 254 struct notifier_block *nb);
255 255
256extern int extcon_register_notifier_all(struct extcon_dev *edev,
257 struct notifier_block *nb);
258extern int extcon_unregister_notifier_all(struct extcon_dev *edev,
259 struct notifier_block *nb);
260extern int devm_extcon_register_notifier_all(struct device *dev,
261 struct extcon_dev *edev,
262 struct notifier_block *nb);
263extern void devm_extcon_unregister_notifier_all(struct device *dev,
264 struct extcon_dev *edev,
265 struct notifier_block *nb);
266
256/* 267/*
257 * Following API get the extcon device from devicetree. 268 * Following API get the extcon device from devicetree.
258 * This function use phandle of devicetree to get extcon device directly. 269 * This function use phandle of devicetree to get extcon device directly.
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index e2d239ed4c60..b6feed6547ce 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -32,9 +32,9 @@
32/* 0, 1(node nid), 2(meta nid) are reserved node id */ 32/* 0, 1(node nid), 2(meta nid) are reserved node id */
33#define F2FS_RESERVED_NODE_NUM 3 33#define F2FS_RESERVED_NODE_NUM 3
34 34
35#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) 35#define F2FS_ROOT_INO(sbi) ((sbi)->root_ino_num)
36#define F2FS_NODE_INO(sbi) (sbi->node_ino_num) 36#define F2FS_NODE_INO(sbi) ((sbi)->node_ino_num)
37#define F2FS_META_INO(sbi) (sbi->meta_ino_num) 37#define F2FS_META_INO(sbi) ((sbi)->meta_ino_num)
38 38
39#define F2FS_IO_SIZE(sbi) (1 << (sbi)->write_io_size_bits) /* Blocks */ 39#define F2FS_IO_SIZE(sbi) (1 << (sbi)->write_io_size_bits) /* Blocks */
40#define F2FS_IO_SIZE_KB(sbi) (1 << ((sbi)->write_io_size_bits + 2)) /* KB */ 40#define F2FS_IO_SIZE_KB(sbi) (1 << ((sbi)->write_io_size_bits + 2)) /* KB */
@@ -114,6 +114,7 @@ struct f2fs_super_block {
114/* 114/*
115 * For checkpoint 115 * For checkpoint
116 */ 116 */
117#define CP_TRIMMED_FLAG 0x00000100
117#define CP_NAT_BITS_FLAG 0x00000080 118#define CP_NAT_BITS_FLAG 0x00000080
118#define CP_CRC_RECOVERY_FLAG 0x00000040 119#define CP_CRC_RECOVERY_FLAG 0x00000040
119#define CP_FASTBOOT_FLAG 0x00000020 120#define CP_FASTBOOT_FLAG 0x00000020
@@ -161,7 +162,7 @@ struct f2fs_checkpoint {
161 */ 162 */
162#define F2FS_ORPHANS_PER_BLOCK 1020 163#define F2FS_ORPHANS_PER_BLOCK 1020
163 164
164#define GET_ORPHAN_BLOCKS(n) ((n + F2FS_ORPHANS_PER_BLOCK - 1) / \ 165#define GET_ORPHAN_BLOCKS(n) (((n) + F2FS_ORPHANS_PER_BLOCK - 1) / \
165 F2FS_ORPHANS_PER_BLOCK) 166 F2FS_ORPHANS_PER_BLOCK)
166 167
167struct f2fs_orphan_block { 168struct f2fs_orphan_block {
@@ -302,6 +303,12 @@ struct f2fs_nat_block {
302#define SIT_ENTRY_PER_BLOCK (PAGE_SIZE / sizeof(struct f2fs_sit_entry)) 303#define SIT_ENTRY_PER_BLOCK (PAGE_SIZE / sizeof(struct f2fs_sit_entry))
303 304
304/* 305/*
306 * F2FS uses 4 bytes to represent block address. As a result, supported size of
307 * disk is 16 TB and it equals to 16 * 1024 * 1024 / 2 segments.
308 */
309#define F2FS_MAX_SEGMENT ((16 * 1024 * 1024) / 2)
310
311/*
305 * Note that f2fs_sit_entry->vblocks has the following bit-field information. 312 * Note that f2fs_sit_entry->vblocks has the following bit-field information.
306 * [15:10] : allocation type such as CURSEG_XXXX_TYPE 313 * [15:10] : allocation type such as CURSEG_XXXX_TYPE
307 * [9:0] : valid block count 314 * [9:0] : valid block count
@@ -449,7 +456,7 @@ typedef __le32 f2fs_hash_t;
449#define F2FS_SLOT_LEN 8 456#define F2FS_SLOT_LEN 8
450#define F2FS_SLOT_LEN_BITS 3 457#define F2FS_SLOT_LEN_BITS 3
451 458
452#define GET_DENTRY_SLOTS(x) ((x + F2FS_SLOT_LEN - 1) >> F2FS_SLOT_LEN_BITS) 459#define GET_DENTRY_SLOTS(x) (((x) + F2FS_SLOT_LEN - 1) >> F2FS_SLOT_LEN_BITS)
453 460
454/* MAX level for dir lookup */ 461/* MAX level for dir lookup */
455#define MAX_DIR_HASH_DEPTH 63 462#define MAX_DIR_HASH_DEPTH 63
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 76ce329e656d..1b48d9c9a561 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -3,6 +3,12 @@
3 3
4#include <uapi/linux/fcntl.h> 4#include <uapi/linux/fcntl.h>
5 5
6/* list of all valid flags for the open/openat flags argument: */
7#define VALID_OPEN_FLAGS \
8 (O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | \
9 O_APPEND | O_NDELAY | O_NONBLOCK | O_NDELAY | __O_SYNC | O_DSYNC | \
10 FASYNC | O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | \
11 O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE)
6 12
7#ifndef force_o_largefile 13#ifndef force_o_largefile
8#define force_o_largefile() (BITS_PER_LONG != 32) 14#define force_o_largefile() (BITS_PER_LONG != 32)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index fbf7b39e8103..62d948f80730 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -7,6 +7,7 @@
7#include <stdarg.h> 7#include <stdarg.h>
8 8
9#include <linux/atomic.h> 9#include <linux/atomic.h>
10#include <linux/refcount.h>
10#include <linux/compat.h> 11#include <linux/compat.h>
11#include <linux/skbuff.h> 12#include <linux/skbuff.h>
12#include <linux/linkage.h> 13#include <linux/linkage.h>
@@ -18,7 +19,9 @@
18 19
19#include <net/sch_generic.h> 20#include <net/sch_generic.h>
20 21
21#include <asm/cacheflush.h> 22#ifdef CONFIG_ARCH_HAS_SET_MEMORY
23#include <asm/set_memory.h>
24#endif
22 25
23#include <uapi/linux/filter.h> 26#include <uapi/linux/filter.h>
24#include <uapi/linux/bpf.h> 27#include <uapi/linux/bpf.h>
@@ -269,6 +272,16 @@ struct bpf_prog_aux;
269 .off = OFF, \ 272 .off = OFF, \
270 .imm = IMM }) 273 .imm = IMM })
271 274
275/* Unconditional jumps, goto pc + off16 */
276
277#define BPF_JMP_A(OFF) \
278 ((struct bpf_insn) { \
279 .code = BPF_JMP | BPF_JA, \
280 .dst_reg = 0, \
281 .src_reg = 0, \
282 .off = OFF, \
283 .imm = 0 })
284
272/* Function call */ 285/* Function call */
273 286
274#define BPF_EMIT_CALL(FUNC) \ 287#define BPF_EMIT_CALL(FUNC) \
@@ -412,8 +425,7 @@ struct bpf_prog {
412 locked:1, /* Program image locked? */ 425 locked:1, /* Program image locked? */
413 gpl_compatible:1, /* Is filter GPL compatible? */ 426 gpl_compatible:1, /* Is filter GPL compatible? */
414 cb_access:1, /* Is control block accessed? */ 427 cb_access:1, /* Is control block accessed? */
415 dst_needed:1, /* Do we need dst entry? */ 428 dst_needed:1; /* Do we need dst entry? */
416 xdp_adjust_head:1; /* Adjusting pkt head? */
417 kmemcheck_bitfield_end(meta); 429 kmemcheck_bitfield_end(meta);
418 enum bpf_prog_type type; /* Type of BPF program */ 430 enum bpf_prog_type type; /* Type of BPF program */
419 u32 len; /* Number of filter blocks */ 431 u32 len; /* Number of filter blocks */
@@ -430,7 +442,7 @@ struct bpf_prog {
430}; 442};
431 443
432struct sk_filter { 444struct sk_filter {
433 atomic_t refcnt; 445 refcount_t refcnt;
434 struct rcu_head rcu; 446 struct rcu_head rcu;
435 struct bpf_prog *prog; 447 struct bpf_prog *prog;
436}; 448};
@@ -693,6 +705,11 @@ static inline bool bpf_jit_is_ebpf(void)
693# endif 705# endif
694} 706}
695 707
708static inline bool ebpf_jit_enabled(void)
709{
710 return bpf_jit_enable && bpf_jit_is_ebpf();
711}
712
696static inline bool bpf_prog_ebpf_jited(const struct bpf_prog *fp) 713static inline bool bpf_prog_ebpf_jited(const struct bpf_prog *fp)
697{ 714{
698 return fp->jited && bpf_jit_is_ebpf(); 715 return fp->jited && bpf_jit_is_ebpf();
@@ -753,6 +770,11 @@ void bpf_prog_kallsyms_del(struct bpf_prog *fp);
753 770
754#else /* CONFIG_BPF_JIT */ 771#else /* CONFIG_BPF_JIT */
755 772
773static inline bool ebpf_jit_enabled(void)
774{
775 return false;
776}
777
756static inline bool bpf_prog_ebpf_jited(const struct bpf_prog *fp) 778static inline bool bpf_prog_ebpf_jited(const struct bpf_prog *fp)
757{ 779{
758 return false; 780 return false;
diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h
index 8e953c6f394a..37a5eaea69dd 100644
--- a/include/linux/firmware/meson/meson_sm.h
+++ b/include/linux/firmware/meson/meson_sm.h
@@ -25,7 +25,7 @@ int meson_sm_call(unsigned int cmd_index, u32 *ret, u32 arg0, u32 arg1,
25 u32 arg2, u32 arg3, u32 arg4); 25 u32 arg2, u32 arg3, u32 arg4);
26int meson_sm_call_write(void *buffer, unsigned int b_size, unsigned int cmd_index, 26int meson_sm_call_write(void *buffer, unsigned int b_size, unsigned int cmd_index,
27 u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); 27 u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
28int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0, u32 arg1, 28int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index,
29 u32 arg2, u32 arg3, u32 arg4); 29 u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
30 30
31#endif /* _MESON_SM_FW_H_ */ 31#endif /* _MESON_SM_FW_H_ */
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index b6efb0c64408..11366b3ff0b4 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -61,16 +61,83 @@ struct flex_array {
61 FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \ 61 FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \
62 } 62 }
63 63
64/**
65 * flex_array_alloc() - Creates a flexible array.
66 * @element_size: individual object size.
67 * @total: maximum number of objects which can be stored.
68 * @flags: GFP flags
69 *
70 * Return: Returns an object of structure flex_array.
71 */
64struct flex_array *flex_array_alloc(int element_size, unsigned int total, 72struct flex_array *flex_array_alloc(int element_size, unsigned int total,
65 gfp_t flags); 73 gfp_t flags);
74
75/**
76 * flex_array_prealloc() - Ensures that memory for the elements indexed in the
77 * range defined by start and nr_elements has been allocated.
78 * @fa: array to allocate memory to.
79 * @start: start address
80 * @nr_elements: number of elements to be allocated.
81 * @flags: GFP flags
82 *
83 */
66int flex_array_prealloc(struct flex_array *fa, unsigned int start, 84int flex_array_prealloc(struct flex_array *fa, unsigned int start,
67 unsigned int nr_elements, gfp_t flags); 85 unsigned int nr_elements, gfp_t flags);
86
87/**
88 * flex_array_free() - Removes all elements of a flexible array.
89 * @fa: array to be freed.
90 */
68void flex_array_free(struct flex_array *fa); 91void flex_array_free(struct flex_array *fa);
92
93/**
94 * flex_array_free_parts() - Removes all elements of a flexible array, but
95 * leaves the array itself in place.
96 * @fa: array to be emptied.
97 */
69void flex_array_free_parts(struct flex_array *fa); 98void flex_array_free_parts(struct flex_array *fa);
99
100/**
101 * flex_array_put() - Stores data into a flexible array.
102 * @fa: array where element is to be stored.
103 * @element_nr: position to copy, must be less than the maximum specified when
104 * the array was created.
105 * @src: data source to be copied into the array.
106 * @flags: GFP flags
107 *
108 * Return: Returns zero on success, a negative error code otherwise.
109 */
70int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, 110int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,
71 gfp_t flags); 111 gfp_t flags);
112
113/**
114 * flex_array_clear() - Clears an individual element in the array, sets the
115 * given element to FLEX_ARRAY_FREE.
116 * @element_nr: element position to clear.
117 * @fa: array to which element to be cleared belongs.
118 *
119 * Return: Returns zero on success, -EINVAL otherwise.
120 */
72int flex_array_clear(struct flex_array *fa, unsigned int element_nr); 121int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
122
123/**
124 * flex_array_get() - Retrieves data into a flexible array.
125 *
126 * @element_nr: Element position to retrieve data from.
127 * @fa: array from which data is to be retrieved.
128 *
129 * Return: Returns a pointer to the data element, or NULL if that
130 * particular element has never been allocated.
131 */
73void *flex_array_get(struct flex_array *fa, unsigned int element_nr); 132void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
133
134/**
135 * flex_array_shrink() - Reduces the allocated size of an array.
136 * @fa: array to shrink.
137 *
138 * Return: Returns number of pages of memory actually freed.
139 *
140 */
74int flex_array_shrink(struct flex_array *fa); 141int flex_array_shrink(struct flex_array *fa);
75 142
76#define flex_array_put_ptr(fa, nr, src, gfp) \ 143#define flex_array_put_ptr(fa, nr, src, gfp) \
diff --git a/include/linux/fpga/altera-pr-ip-core.h b/include/linux/fpga/altera-pr-ip-core.h
new file mode 100644
index 000000000000..3810a9033f49
--- /dev/null
+++ b/include/linux/fpga/altera-pr-ip-core.h
@@ -0,0 +1,29 @@
1/*
2 * Driver for Altera Partial Reconfiguration IP Core
3 *
4 * Copyright (C) 2016 Intel Corporation
5 *
6 * Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation
7 * by Alan Tull <atull@opensource.altera.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms and conditions of the GNU General Public License,
11 * version 2, as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef _ALT_PR_IP_CORE_H
23#define _ALT_PR_IP_CORE_H
24#include <linux/io.h>
25
26int alt_pr_register(struct device *dev, void __iomem *reg_base);
27int alt_pr_unregister(struct device *dev);
28
29#endif /* _ALT_PR_IP_CORE_H */
diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h
index 57beb5d09bfc..b4ac24c4411d 100644
--- a/include/linux/fpga/fpga-mgr.h
+++ b/include/linux/fpga/fpga-mgr.h
@@ -70,17 +70,21 @@ enum fpga_mgr_states {
70 */ 70 */
71#define FPGA_MGR_PARTIAL_RECONFIG BIT(0) 71#define FPGA_MGR_PARTIAL_RECONFIG BIT(0)
72#define FPGA_MGR_EXTERNAL_CONFIG BIT(1) 72#define FPGA_MGR_EXTERNAL_CONFIG BIT(1)
73#define FPGA_MGR_ENCRYPTED_BITSTREAM BIT(2)
73 74
74/** 75/**
75 * struct fpga_image_info - information specific to a FPGA image 76 * struct fpga_image_info - information specific to a FPGA image
76 * @flags: boolean flags as defined above 77 * @flags: boolean flags as defined above
77 * @enable_timeout_us: maximum time to enable traffic through bridge (uSec) 78 * @enable_timeout_us: maximum time to enable traffic through bridge (uSec)
78 * @disable_timeout_us: maximum time to disable traffic through bridge (uSec) 79 * @disable_timeout_us: maximum time to disable traffic through bridge (uSec)
80 * @config_complete_timeout_us: maximum time for FPGA to switch to operating
81 * status in the write_complete op.
79 */ 82 */
80struct fpga_image_info { 83struct fpga_image_info {
81 u32 flags; 84 u32 flags;
82 u32 enable_timeout_us; 85 u32 enable_timeout_us;
83 u32 disable_timeout_us; 86 u32 disable_timeout_us;
87 u32 config_complete_timeout_us;
84}; 88};
85 89
86/** 90/**
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7251f7bb45e8..803e5a9b2654 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -29,7 +29,6 @@
29#include <linux/lockdep.h> 29#include <linux/lockdep.h>
30#include <linux/percpu-rwsem.h> 30#include <linux/percpu-rwsem.h>
31#include <linux/workqueue.h> 31#include <linux/workqueue.h>
32#include <linux/percpu-rwsem.h>
33#include <linux/delayed_call.h> 32#include <linux/delayed_call.h>
34 33
35#include <asm/byteorder.h> 34#include <asm/byteorder.h>
@@ -250,9 +249,8 @@ enum positive_aop_returns {
250 AOP_TRUNCATED_PAGE = 0x80001, 249 AOP_TRUNCATED_PAGE = 0x80001,
251}; 250};
252 251
253#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */ 252#define AOP_FLAG_CONT_EXPAND 0x0001 /* called from cont_expand */
254#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */ 253#define AOP_FLAG_NOFS 0x0002 /* used by filesystem to direct
255#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct
256 * helper code (eg buffer layer) 254 * helper code (eg buffer layer)
257 * to clear GFP_FS from alloc */ 255 * to clear GFP_FS from alloc */
258 256
@@ -546,6 +544,8 @@ is_uncached_acl(struct posix_acl *acl)
546#define IOP_XATTR 0x0008 544#define IOP_XATTR 0x0008
547#define IOP_DEFAULT_READLINK 0x0010 545#define IOP_DEFAULT_READLINK 0x0010
548 546
547struct fsnotify_mark_connector;
548
549/* 549/*
550 * Keep mostly read-only and often accessed (especially for 550 * Keep mostly read-only and often accessed (especially for
551 * the RCU path lookup and 'stat' data) fields at the beginning 551 * the RCU path lookup and 'stat' data) fields at the beginning
@@ -645,7 +645,7 @@ struct inode {
645 645
646#ifdef CONFIG_FSNOTIFY 646#ifdef CONFIG_FSNOTIFY
647 __u32 i_fsnotify_mask; /* all events this inode cares about */ 647 __u32 i_fsnotify_mask; /* all events this inode cares about */
648 struct hlist_head i_fsnotify_marks; 648 struct fsnotify_mark_connector __rcu *i_fsnotify_marks;
649#endif 649#endif
650 650
651#if IS_ENABLED(CONFIG_FS_ENCRYPTION) 651#if IS_ENABLED(CONFIG_FS_ENCRYPTION)
@@ -909,6 +909,8 @@ static inline struct file *get_file(struct file *f)
909#define FL_OFDLCK 1024 /* lock is "owned" by struct file */ 909#define FL_OFDLCK 1024 /* lock is "owned" by struct file */
910#define FL_LAYOUT 2048 /* outstanding pNFS layout */ 910#define FL_LAYOUT 2048 /* outstanding pNFS layout */
911 911
912#define FL_CLOSE_POSIX (FL_POSIX | FL_CLOSE)
913
912/* 914/*
913 * Special return value from posix_lock_file() and vfs_lock_file() for 915 * Special return value from posix_lock_file() and vfs_lock_file() for
914 * asynchronous locking. 916 * asynchronous locking.
@@ -1429,7 +1431,6 @@ static inline void i_gid_write(struct inode *inode, gid_t gid)
1429 inode->i_gid = make_kgid(inode->i_sb->s_user_ns, gid); 1431 inode->i_gid = make_kgid(inode->i_sb->s_user_ns, gid);
1430} 1432}
1431 1433
1432extern struct timespec current_fs_time(struct super_block *sb);
1433extern struct timespec current_time(struct inode *inode); 1434extern struct timespec current_time(struct inode *inode);
1434 1435
1435/* 1436/*
@@ -2121,6 +2122,9 @@ extern int vfs_ustat(dev_t, struct kstatfs *);
2121extern int freeze_super(struct super_block *super); 2122extern int freeze_super(struct super_block *super);
2122extern int thaw_super(struct super_block *super); 2123extern int thaw_super(struct super_block *super);
2123extern bool our_mnt(struct vfsmount *mnt); 2124extern bool our_mnt(struct vfsmount *mnt);
2125extern __printf(2, 3)
2126int super_setup_bdi_name(struct super_block *sb, char *fmt, ...);
2127extern int super_setup_bdi(struct super_block *sb);
2124 2128
2125extern int current_umask(void); 2129extern int current_umask(void);
2126 2130
@@ -2921,17 +2925,19 @@ extern int vfs_statx_fd(unsigned int, struct kstat *, u32, unsigned int);
2921 2925
2922static inline int vfs_stat(const char __user *filename, struct kstat *stat) 2926static inline int vfs_stat(const char __user *filename, struct kstat *stat)
2923{ 2927{
2924 return vfs_statx(AT_FDCWD, filename, 0, stat, STATX_BASIC_STATS); 2928 return vfs_statx(AT_FDCWD, filename, AT_NO_AUTOMOUNT,
2929 stat, STATX_BASIC_STATS);
2925} 2930}
2926static inline int vfs_lstat(const char __user *name, struct kstat *stat) 2931static inline int vfs_lstat(const char __user *name, struct kstat *stat)
2927{ 2932{
2928 return vfs_statx(AT_FDCWD, name, AT_SYMLINK_NOFOLLOW, 2933 return vfs_statx(AT_FDCWD, name, AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT,
2929 stat, STATX_BASIC_STATS); 2934 stat, STATX_BASIC_STATS);
2930} 2935}
2931static inline int vfs_fstatat(int dfd, const char __user *filename, 2936static inline int vfs_fstatat(int dfd, const char __user *filename,
2932 struct kstat *stat, int flags) 2937 struct kstat *stat, int flags)
2933{ 2938{
2934 return vfs_statx(dfd, filename, flags, stat, STATX_BASIC_STATS); 2939 return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT,
2940 stat, STATX_BASIC_STATS);
2935} 2941}
2936static inline int vfs_fstat(int fd, struct kstat *stat) 2942static inline int vfs_fstat(int fd, struct kstat *stat)
2937{ 2943{
@@ -2996,9 +3002,10 @@ extern const struct file_operations simple_dir_operations;
2996extern const struct inode_operations simple_dir_inode_operations; 3002extern const struct inode_operations simple_dir_inode_operations;
2997extern void make_empty_dir_inode(struct inode *inode); 3003extern void make_empty_dir_inode(struct inode *inode);
2998extern bool is_empty_dir_inode(struct inode *inode); 3004extern bool is_empty_dir_inode(struct inode *inode);
2999struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 3005struct tree_descr { const char *name; const struct file_operations *ops; int mode; };
3000struct dentry *d_alloc_name(struct dentry *, const char *); 3006struct dentry *d_alloc_name(struct dentry *, const char *);
3001extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *); 3007extern int simple_fill_super(struct super_block *, unsigned long,
3008 const struct tree_descr *);
3002extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); 3009extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
3003extern void simple_release_fs(struct vfsmount **mount, int *count); 3010extern void simple_release_fs(struct vfsmount **mount, int *count);
3004 3011
diff --git a/include/linux/fscrypt_common.h b/include/linux/fscrypt_common.h
index 10c1abfbac6c..0a30c106c1e5 100644
--- a/include/linux/fscrypt_common.h
+++ b/include/linux/fscrypt_common.h
@@ -46,17 +46,6 @@ struct fscrypt_symlink_data {
46 char encrypted_path[1]; 46 char encrypted_path[1];
47} __packed; 47} __packed;
48 48
49/**
50 * This function is used to calculate the disk space required to
51 * store a filename of length l in encrypted symlink format.
52 */
53static inline u32 fscrypt_symlink_data_len(u32 l)
54{
55 if (l < FS_CRYPTO_BLOCK_SIZE)
56 l = FS_CRYPTO_BLOCK_SIZE;
57 return (l + sizeof(struct fscrypt_symlink_data) - 1);
58}
59
60struct fscrypt_str { 49struct fscrypt_str {
61 unsigned char *name; 50 unsigned char *name;
62 u32 len; 51 u32 len;
diff --git a/include/linux/fscrypt_notsupp.h b/include/linux/fscrypt_notsupp.h
index 3511ca798804..ec406aed2f2f 100644
--- a/include/linux/fscrypt_notsupp.h
+++ b/include/linux/fscrypt_notsupp.h
@@ -147,6 +147,15 @@ static inline int fscrypt_fname_usr_to_disk(struct inode *inode,
147 return -EOPNOTSUPP; 147 return -EOPNOTSUPP;
148} 148}
149 149
150static inline bool fscrypt_match_name(const struct fscrypt_name *fname,
151 const u8 *de_name, u32 de_name_len)
152{
153 /* Encryption support disabled; use standard comparison */
154 if (de_name_len != fname->disk_name.len)
155 return false;
156 return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len);
157}
158
150/* bio.c */ 159/* bio.c */
151static inline void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx, 160static inline void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx,
152 struct bio *bio) 161 struct bio *bio)
diff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h
index a140f47e9b27..cd4e82c17304 100644
--- a/include/linux/fscrypt_supp.h
+++ b/include/linux/fscrypt_supp.h
@@ -57,6 +57,80 @@ extern int fscrypt_fname_disk_to_usr(struct inode *, u32, u32,
57extern int fscrypt_fname_usr_to_disk(struct inode *, const struct qstr *, 57extern int fscrypt_fname_usr_to_disk(struct inode *, const struct qstr *,
58 struct fscrypt_str *); 58 struct fscrypt_str *);
59 59
60#define FSCRYPT_FNAME_MAX_UNDIGESTED_SIZE 32
61
62/* Extracts the second-to-last ciphertext block; see explanation below */
63#define FSCRYPT_FNAME_DIGEST(name, len) \
64 ((name) + round_down((len) - FS_CRYPTO_BLOCK_SIZE - 1, \
65 FS_CRYPTO_BLOCK_SIZE))
66
67#define FSCRYPT_FNAME_DIGEST_SIZE FS_CRYPTO_BLOCK_SIZE
68
69/**
70 * fscrypt_digested_name - alternate identifier for an on-disk filename
71 *
72 * When userspace lists an encrypted directory without access to the key,
73 * filenames whose ciphertext is longer than FSCRYPT_FNAME_MAX_UNDIGESTED_SIZE
74 * bytes are shown in this abbreviated form (base64-encoded) rather than as the
75 * full ciphertext (base64-encoded). This is necessary to allow supporting
76 * filenames up to NAME_MAX bytes, since base64 encoding expands the length.
77 *
78 * To make it possible for filesystems to still find the correct directory entry
79 * despite not knowing the full on-disk name, we encode any filesystem-specific
80 * 'hash' and/or 'minor_hash' which the filesystem may need for its lookups,
81 * followed by the second-to-last ciphertext block of the filename. Due to the
82 * use of the CBC-CTS encryption mode, the second-to-last ciphertext block
83 * depends on the full plaintext. (Note that ciphertext stealing causes the
84 * last two blocks to appear "flipped".) This makes accidental collisions very
85 * unlikely: just a 1 in 2^128 chance for two filenames to collide even if they
86 * share the same filesystem-specific hashes.
87 *
88 * However, this scheme isn't immune to intentional collisions, which can be
89 * created by anyone able to create arbitrary plaintext filenames and view them
90 * without the key. Making the "digest" be a real cryptographic hash like
91 * SHA-256 over the full ciphertext would prevent this, although it would be
92 * less efficient and harder to implement, especially since the filesystem would
93 * need to calculate it for each directory entry examined during a search.
94 */
95struct fscrypt_digested_name {
96 u32 hash;
97 u32 minor_hash;
98 u8 digest[FSCRYPT_FNAME_DIGEST_SIZE];
99};
100
101/**
102 * fscrypt_match_name() - test whether the given name matches a directory entry
103 * @fname: the name being searched for
104 * @de_name: the name from the directory entry
105 * @de_name_len: the length of @de_name in bytes
106 *
107 * Normally @fname->disk_name will be set, and in that case we simply compare
108 * that to the name stored in the directory entry. The only exception is that
109 * if we don't have the key for an encrypted directory and a filename in it is
110 * very long, then we won't have the full disk_name and we'll instead need to
111 * match against the fscrypt_digested_name.
112 *
113 * Return: %true if the name matches, otherwise %false.
114 */
115static inline bool fscrypt_match_name(const struct fscrypt_name *fname,
116 const u8 *de_name, u32 de_name_len)
117{
118 if (unlikely(!fname->disk_name.name)) {
119 const struct fscrypt_digested_name *n =
120 (const void *)fname->crypto_buf.name;
121 if (WARN_ON_ONCE(fname->usr_fname->name[0] != '_'))
122 return false;
123 if (de_name_len <= FSCRYPT_FNAME_MAX_UNDIGESTED_SIZE)
124 return false;
125 return !memcmp(FSCRYPT_FNAME_DIGEST(de_name, de_name_len),
126 n->digest, FSCRYPT_FNAME_DIGEST_SIZE);
127 }
128
129 if (de_name_len != fname->disk_name.len)
130 return false;
131 return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len);
132}
133
60/* bio.c */ 134/* bio.c */
61extern void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *, struct bio *); 135extern void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *, struct bio *);
62extern void fscrypt_pullback_bio_page(struct page **, bool); 136extern void fscrypt_pullback_bio_page(struct page **, bool);
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index e6e689b5569e..c6c69318752b 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -80,6 +80,7 @@ struct fsnotify_event;
80struct fsnotify_mark; 80struct fsnotify_mark;
81struct fsnotify_event_private_data; 81struct fsnotify_event_private_data;
82struct fsnotify_fname; 82struct fsnotify_fname;
83struct fsnotify_iter_info;
83 84
84/* 85/*
85 * Each group much define these ops. The fsnotify infrastructure will call 86 * Each group much define these ops. The fsnotify infrastructure will call
@@ -98,10 +99,13 @@ struct fsnotify_ops {
98 struct fsnotify_mark *inode_mark, 99 struct fsnotify_mark *inode_mark,
99 struct fsnotify_mark *vfsmount_mark, 100 struct fsnotify_mark *vfsmount_mark,
100 u32 mask, const void *data, int data_type, 101 u32 mask, const void *data, int data_type,
101 const unsigned char *file_name, u32 cookie); 102 const unsigned char *file_name, u32 cookie,
103 struct fsnotify_iter_info *iter_info);
102 void (*free_group_priv)(struct fsnotify_group *group); 104 void (*free_group_priv)(struct fsnotify_group *group);
103 void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); 105 void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
104 void (*free_event)(struct fsnotify_event *event); 106 void (*free_event)(struct fsnotify_event *event);
107 /* called on final put+free to free memory */
108 void (*free_mark)(struct fsnotify_mark *mark);
105}; 109};
106 110
107/* 111/*
@@ -163,6 +167,8 @@ struct fsnotify_group {
163 struct fsnotify_event *overflow_event; /* Event we queue when the 167 struct fsnotify_event *overflow_event; /* Event we queue when the
164 * notification list is too 168 * notification list is too
165 * full */ 169 * full */
170 atomic_t user_waits; /* Number of tasks waiting for user
171 * response */
166 172
167 /* groups can define private fields here or use the void *private */ 173 /* groups can define private fields here or use the void *private */
168 union { 174 union {
@@ -195,6 +201,30 @@ struct fsnotify_group {
195#define FSNOTIFY_EVENT_INODE 2 201#define FSNOTIFY_EVENT_INODE 2
196 202
197/* 203/*
204 * Inode / vfsmount point to this structure which tracks all marks attached to
205 * the inode / vfsmount. The reference to inode / vfsmount is held by this
206 * structure. We destroy this structure when there are no more marks attached
207 * to it. The structure is protected by fsnotify_mark_srcu.
208 */
209struct fsnotify_mark_connector {
210 spinlock_t lock;
211#define FSNOTIFY_OBJ_TYPE_INODE 0x01
212#define FSNOTIFY_OBJ_TYPE_VFSMOUNT 0x02
213#define FSNOTIFY_OBJ_ALL_TYPES (FSNOTIFY_OBJ_TYPE_INODE | \
214 FSNOTIFY_OBJ_TYPE_VFSMOUNT)
215 unsigned int flags; /* Type of object [lock] */
216 union { /* Object pointer [lock] */
217 struct inode *inode;
218 struct vfsmount *mnt;
219 };
220 union {
221 struct hlist_head list;
222 /* Used listing heads to free after srcu period expires */
223 struct fsnotify_mark_connector *destroy_next;
224 };
225};
226
227/*
198 * A mark is simply an object attached to an in core inode which allows an 228 * A mark is simply an object attached to an in core inode which allows an
199 * fsnotify listener to indicate they are either no longer interested in events 229 * fsnotify listener to indicate they are either no longer interested in events
200 * of a type matching mask or only interested in those events. 230 * of a type matching mask or only interested in those events.
@@ -223,22 +253,16 @@ struct fsnotify_mark {
223 struct list_head g_list; 253 struct list_head g_list;
224 /* Protects inode / mnt pointers, flags, masks */ 254 /* Protects inode / mnt pointers, flags, masks */
225 spinlock_t lock; 255 spinlock_t lock;
226 /* List of marks for inode / vfsmount [obj_lock] */ 256 /* List of marks for inode / vfsmount [connector->lock, mark ref] */
227 struct hlist_node obj_list; 257 struct hlist_node obj_list;
228 union { /* Object pointer [mark->lock, group->mark_mutex] */ 258 /* Head of list of marks for an object [mark ref] */
229 struct inode *inode; /* inode this mark is associated with */ 259 struct fsnotify_mark_connector *connector;
230 struct vfsmount *mnt; /* vfsmount this mark is associated with */
231 };
232 /* Events types to ignore [mark->lock, group->mark_mutex] */ 260 /* Events types to ignore [mark->lock, group->mark_mutex] */
233 __u32 ignored_mask; 261 __u32 ignored_mask;
234#define FSNOTIFY_MARK_FLAG_INODE 0x01 262#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x01
235#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02 263#define FSNOTIFY_MARK_FLAG_ALIVE 0x02
236#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED 0x04 264#define FSNOTIFY_MARK_FLAG_ATTACHED 0x04
237#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
238#define FSNOTIFY_MARK_FLAG_ALIVE 0x10
239#define FSNOTIFY_MARK_FLAG_ATTACHED 0x20
240 unsigned int flags; /* flags [mark->lock] */ 265 unsigned int flags; /* flags [mark->lock] */
241 void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
242}; 266};
243 267
244#ifdef CONFIG_FSNOTIFY 268#ifdef CONFIG_FSNOTIFY
@@ -315,23 +339,18 @@ extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group
315 339
316/* functions used to manipulate the marks attached to inodes */ 340/* functions used to manipulate the marks attached to inodes */
317 341
318/* run all marks associated with a vfsmount and update mnt->mnt_fsnotify_mask */ 342/* Calculate mask of events for a list of marks */
319extern void fsnotify_recalc_vfsmount_mask(struct vfsmount *mnt); 343extern void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn);
320/* run all marks associated with an inode and update inode->i_fsnotify_mask */ 344extern void fsnotify_init_mark(struct fsnotify_mark *mark,
321extern void fsnotify_recalc_inode_mask(struct inode *inode); 345 struct fsnotify_group *group);
322extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark)); 346/* Find mark belonging to given group in the list of marks */
323/* find (and take a reference) to a mark associated with group and inode */ 347extern struct fsnotify_mark *fsnotify_find_mark(
324extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode); 348 struct fsnotify_mark_connector __rcu **connp,
325/* find (and take a reference) to a mark associated with group and vfsmount */ 349 struct fsnotify_group *group);
326extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt); 350/* attach the mark to the inode or vfsmount */
327/* set the ignored_mask of a mark */ 351extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct inode *inode,
328extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask); 352 struct vfsmount *mnt, int allow_dups);
329/* set the mask of a mark (might pin the object into memory */ 353extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
330extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask);
331/* attach the mark to both the group and the inode */
332extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
333 struct inode *inode, struct vfsmount *mnt, int allow_dups);
334extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark, struct fsnotify_group *group,
335 struct inode *inode, struct vfsmount *mnt, int allow_dups); 354 struct inode *inode, struct vfsmount *mnt, int allow_dups);
336/* given a group and a mark, flag mark to be freed when all references are dropped */ 355/* given a group and a mark, flag mark to be freed when all references are dropped */
337extern void fsnotify_destroy_mark(struct fsnotify_mark *mark, 356extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
@@ -340,15 +359,23 @@ extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
340extern void fsnotify_detach_mark(struct fsnotify_mark *mark); 359extern void fsnotify_detach_mark(struct fsnotify_mark *mark);
341/* free mark */ 360/* free mark */
342extern void fsnotify_free_mark(struct fsnotify_mark *mark); 361extern void fsnotify_free_mark(struct fsnotify_mark *mark);
362/* run all the marks in a group, and clear all of the marks attached to given object type */
363extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group, unsigned int type);
343/* run all the marks in a group, and clear all of the vfsmount marks */ 364/* run all the marks in a group, and clear all of the vfsmount marks */
344extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group); 365static inline void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group)
366{
367 fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_TYPE_VFSMOUNT);
368}
345/* run all the marks in a group, and clear all of the inode marks */ 369/* run all the marks in a group, and clear all of the inode marks */
346extern void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group); 370static inline void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group)
347/* run all the marks in a group, and clear all of the marks where mark->flags & flags is true*/ 371{
348extern void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, unsigned int flags); 372 fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_TYPE_INODE);
373}
349extern void fsnotify_get_mark(struct fsnotify_mark *mark); 374extern void fsnotify_get_mark(struct fsnotify_mark *mark);
350extern void fsnotify_put_mark(struct fsnotify_mark *mark); 375extern void fsnotify_put_mark(struct fsnotify_mark *mark);
351extern void fsnotify_unmount_inodes(struct super_block *sb); 376extern void fsnotify_unmount_inodes(struct super_block *sb);
377extern void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info);
378extern bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info);
352 379
353/* put here because inotify does some weird stuff when destroying watches */ 380/* put here because inotify does some weird stuff when destroying watches */
354extern void fsnotify_init_event(struct fsnotify_event *event, 381extern void fsnotify_init_event(struct fsnotify_event *event,
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 3633e8beff39..473f088aabea 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -42,8 +42,10 @@
42/* Main tracing buffer and events set up */ 42/* Main tracing buffer and events set up */
43#ifdef CONFIG_TRACING 43#ifdef CONFIG_TRACING
44void trace_init(void); 44void trace_init(void);
45void early_trace_init(void);
45#else 46#else
46static inline void trace_init(void) { } 47static inline void trace_init(void) { }
48static inline void early_trace_init(void) { }
47#endif 49#endif
48 50
49struct module; 51struct module;
@@ -70,7 +72,7 @@ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);
70 * CONTROL, SAVE_REGS, SAVE_REGS_IF_SUPPORTED, RECURSION_SAFE, STUB and 72 * CONTROL, SAVE_REGS, SAVE_REGS_IF_SUPPORTED, RECURSION_SAFE, STUB and
71 * IPMODIFY are a kind of attribute flags which can be set only before 73 * IPMODIFY are a kind of attribute flags which can be set only before
72 * registering the ftrace_ops, and can not be modified while registered. 74 * registering the ftrace_ops, and can not be modified while registered.
73 * Changing those attribute flags after regsitering ftrace_ops will 75 * Changing those attribute flags after registering ftrace_ops will
74 * cause unexpected results. 76 * cause unexpected results.
75 * 77 *
76 * ENABLED - set/unset when ftrace_ops is registered/unregistered 78 * ENABLED - set/unset when ftrace_ops is registered/unregistered
@@ -144,6 +146,10 @@ struct ftrace_ops_hash {
144 struct ftrace_hash *filter_hash; 146 struct ftrace_hash *filter_hash;
145 struct mutex regex_lock; 147 struct mutex regex_lock;
146}; 148};
149
150void ftrace_free_init_mem(void);
151#else
152static inline void ftrace_free_init_mem(void) { }
147#endif 153#endif
148 154
149/* 155/*
@@ -260,6 +266,7 @@ static inline int ftrace_nr_registered_ops(void)
260} 266}
261static inline void clear_ftrace_function(void) { } 267static inline void clear_ftrace_function(void) { }
262static inline void ftrace_kill(void) { } 268static inline void ftrace_kill(void) { }
269static inline void ftrace_free_init_mem(void) { }
263#endif /* CONFIG_FUNCTION_TRACER */ 270#endif /* CONFIG_FUNCTION_TRACER */
264 271
265#ifdef CONFIG_STACK_TRACER 272#ifdef CONFIG_STACK_TRACER
@@ -279,15 +286,45 @@ int
279stack_trace_sysctl(struct ctl_table *table, int write, 286stack_trace_sysctl(struct ctl_table *table, int write,
280 void __user *buffer, size_t *lenp, 287 void __user *buffer, size_t *lenp,
281 loff_t *ppos); 288 loff_t *ppos);
282#endif
283 289
284struct ftrace_func_command { 290/* DO NOT MODIFY THIS VARIABLE DIRECTLY! */
285 struct list_head list; 291DECLARE_PER_CPU(int, disable_stack_tracer);
286 char *name; 292
287 int (*func)(struct ftrace_hash *hash, 293/**
288 char *func, char *cmd, 294 * stack_tracer_disable - temporarily disable the stack tracer
289 char *params, int enable); 295 *
290}; 296 * There's a few locations (namely in RCU) where stack tracing
297 * cannot be executed. This function is used to disable stack
298 * tracing during those critical sections.
299 *
300 * This function must be called with preemption or interrupts
301 * disabled and stack_tracer_enable() must be called shortly after
302 * while preemption or interrupts are still disabled.
303 */
304static inline void stack_tracer_disable(void)
305{
306 /* Preemption or interupts must be disabled */
307 if (IS_ENABLED(CONFIG_PREEMPT_DEBUG))
308 WARN_ON_ONCE(!preempt_count() || !irqs_disabled());
309 this_cpu_inc(disable_stack_tracer);
310}
311
312/**
313 * stack_tracer_enable - re-enable the stack tracer
314 *
315 * After stack_tracer_disable() is called, stack_tracer_enable()
316 * must be called shortly afterward.
317 */
318static inline void stack_tracer_enable(void)
319{
320 if (IS_ENABLED(CONFIG_PREEMPT_DEBUG))
321 WARN_ON_ONCE(!preempt_count() || !irqs_disabled());
322 this_cpu_dec(disable_stack_tracer);
323}
324#else
325static inline void stack_tracer_disable(void) { }
326static inline void stack_tracer_enable(void) { }
327#endif
291 328
292#ifdef CONFIG_DYNAMIC_FTRACE 329#ifdef CONFIG_DYNAMIC_FTRACE
293 330
@@ -315,30 +352,6 @@ void ftrace_bug(int err, struct dyn_ftrace *rec);
315 352
316struct seq_file; 353struct seq_file;
317 354
318struct ftrace_probe_ops {
319 void (*func)(unsigned long ip,
320 unsigned long parent_ip,
321 void **data);
322 int (*init)(struct ftrace_probe_ops *ops,
323 unsigned long ip, void **data);
324 void (*free)(struct ftrace_probe_ops *ops,
325 unsigned long ip, void **data);
326 int (*print)(struct seq_file *m,
327 unsigned long ip,
328 struct ftrace_probe_ops *ops,
329 void *data);
330};
331
332extern int
333register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
334 void *data);
335extern void
336unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
337 void *data);
338extern void
339unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
340extern void unregister_ftrace_function_probe_all(char *glob);
341
342extern int ftrace_text_reserved(const void *start, const void *end); 355extern int ftrace_text_reserved(const void *start, const void *end);
343 356
344extern int ftrace_nr_registered_ops(void); 357extern int ftrace_nr_registered_ops(void);
@@ -400,9 +413,6 @@ void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
400void ftrace_free_filter(struct ftrace_ops *ops); 413void ftrace_free_filter(struct ftrace_ops *ops);
401void ftrace_ops_set_global_filter(struct ftrace_ops *ops); 414void ftrace_ops_set_global_filter(struct ftrace_ops *ops);
402 415
403int register_ftrace_command(struct ftrace_func_command *cmd);
404int unregister_ftrace_command(struct ftrace_func_command *cmd);
405
406enum { 416enum {
407 FTRACE_UPDATE_CALLS = (1 << 0), 417 FTRACE_UPDATE_CALLS = (1 << 0),
408 FTRACE_DISABLE_CALLS = (1 << 1), 418 FTRACE_DISABLE_CALLS = (1 << 1),
@@ -433,8 +443,8 @@ enum {
433 FTRACE_ITER_FILTER = (1 << 0), 443 FTRACE_ITER_FILTER = (1 << 0),
434 FTRACE_ITER_NOTRACE = (1 << 1), 444 FTRACE_ITER_NOTRACE = (1 << 1),
435 FTRACE_ITER_PRINTALL = (1 << 2), 445 FTRACE_ITER_PRINTALL = (1 << 2),
436 FTRACE_ITER_DO_HASH = (1 << 3), 446 FTRACE_ITER_DO_PROBES = (1 << 3),
437 FTRACE_ITER_HASH = (1 << 4), 447 FTRACE_ITER_PROBE = (1 << 4),
438 FTRACE_ITER_ENABLED = (1 << 5), 448 FTRACE_ITER_ENABLED = (1 << 5),
439}; 449};
440 450
@@ -618,14 +628,6 @@ static inline void ftrace_enable_daemon(void) { }
618static inline void ftrace_module_init(struct module *mod) { } 628static inline void ftrace_module_init(struct module *mod) { }
619static inline void ftrace_module_enable(struct module *mod) { } 629static inline void ftrace_module_enable(struct module *mod) { }
620static inline void ftrace_release_mod(struct module *mod) { } 630static inline void ftrace_release_mod(struct module *mod) { }
621static inline __init int register_ftrace_command(struct ftrace_func_command *cmd)
622{
623 return -EINVAL;
624}
625static inline __init int unregister_ftrace_command(char *cmd_name)
626{
627 return -EINVAL;
628}
629static inline int ftrace_text_reserved(const void *start, const void *end) 631static inline int ftrace_text_reserved(const void *start, const void *end)
630{ 632{
631 return 0; 633 return 0;
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 8bd28ce6d76e..3dff2398a5f0 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -27,4 +27,16 @@ struct fwnode_handle {
27 struct fwnode_handle *secondary; 27 struct fwnode_handle *secondary;
28}; 28};
29 29
30/**
31 * struct fwnode_endpoint - Fwnode graph endpoint
32 * @port: Port number
33 * @id: Endpoint id
34 * @local_fwnode: reference to the related fwnode
35 */
36struct fwnode_endpoint {
37 unsigned int port;
38 unsigned int id;
39 const struct fwnode_handle *local_fwnode;
40};
41
30#endif 42#endif
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 76f39754e7b0..acff9437e5c3 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -159,11 +159,11 @@ struct badblocks;
159#if defined(CONFIG_BLK_DEV_INTEGRITY) 159#if defined(CONFIG_BLK_DEV_INTEGRITY)
160 160
161struct blk_integrity { 161struct blk_integrity {
162 struct blk_integrity_profile *profile; 162 const struct blk_integrity_profile *profile;
163 unsigned char flags; 163 unsigned char flags;
164 unsigned char tuple_size; 164 unsigned char tuple_size;
165 unsigned char interval_exp; 165 unsigned char interval_exp;
166 unsigned char tag_size; 166 unsigned char tag_size;
167}; 167};
168 168
169#endif /* CONFIG_BLK_DEV_INTEGRITY */ 169#endif /* CONFIG_BLK_DEV_INTEGRITY */
@@ -722,11 +722,9 @@ static inline void part_nr_sects_write(struct hd_struct *part, sector_t size)
722#if defined(CONFIG_BLK_DEV_INTEGRITY) 722#if defined(CONFIG_BLK_DEV_INTEGRITY)
723extern void blk_integrity_add(struct gendisk *); 723extern void blk_integrity_add(struct gendisk *);
724extern void blk_integrity_del(struct gendisk *); 724extern void blk_integrity_del(struct gendisk *);
725extern void blk_integrity_revalidate(struct gendisk *);
726#else /* CONFIG_BLK_DEV_INTEGRITY */ 725#else /* CONFIG_BLK_DEV_INTEGRITY */
727static inline void blk_integrity_add(struct gendisk *disk) { } 726static inline void blk_integrity_add(struct gendisk *disk) { }
728static inline void blk_integrity_del(struct gendisk *disk) { } 727static inline void blk_integrity_del(struct gendisk *disk) { }
729static inline void blk_integrity_revalidate(struct gendisk *disk) { }
730#endif /* CONFIG_BLK_DEV_INTEGRITY */ 728#endif /* CONFIG_BLK_DEV_INTEGRITY */
731 729
732#else /* CONFIG_BLOCK */ 730#else /* CONFIG_BLOCK */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index db373b9d3223..2b1a44f5bdb6 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -40,6 +40,11 @@ struct vm_area_struct;
40#define ___GFP_DIRECT_RECLAIM 0x400000u 40#define ___GFP_DIRECT_RECLAIM 0x400000u
41#define ___GFP_WRITE 0x800000u 41#define ___GFP_WRITE 0x800000u
42#define ___GFP_KSWAPD_RECLAIM 0x1000000u 42#define ___GFP_KSWAPD_RECLAIM 0x1000000u
43#ifdef CONFIG_LOCKDEP
44#define ___GFP_NOLOCKDEP 0x4000000u
45#else
46#define ___GFP_NOLOCKDEP 0
47#endif
43/* If the above are modified, __GFP_BITS_SHIFT may need updating */ 48/* If the above are modified, __GFP_BITS_SHIFT may need updating */
44 49
45/* 50/*
@@ -179,8 +184,11 @@ struct vm_area_struct;
179#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) 184#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK)
180#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) 185#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
181 186
187/* Disable lockdep for GFP context tracking */
188#define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP)
189
182/* Room for N __GFP_FOO bits */ 190/* Room for N __GFP_FOO bits */
183#define __GFP_BITS_SHIFT 25 191#define __GFP_BITS_SHIFT (25 + IS_ENABLED(CONFIG_LOCKDEP))
184#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 192#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
185 193
186/* 194/*
@@ -202,8 +210,16 @@ struct vm_area_struct;
202 * 210 *
203 * GFP_NOIO will use direct reclaim to discard clean pages or slab pages 211 * GFP_NOIO will use direct reclaim to discard clean pages or slab pages
204 * that do not require the starting of any physical IO. 212 * that do not require the starting of any physical IO.
213 * Please try to avoid using this flag directly and instead use
214 * memalloc_noio_{save,restore} to mark the whole scope which cannot
215 * perform any IO with a short explanation why. All allocation requests
216 * will inherit GFP_NOIO implicitly.
205 * 217 *
206 * GFP_NOFS will use direct reclaim but will not use any filesystem interfaces. 218 * GFP_NOFS will use direct reclaim but will not use any filesystem interfaces.
219 * Please try to avoid using this flag directly and instead use
220 * memalloc_nofs_{save,restore} to mark the whole scope which cannot/shouldn't
221 * recurse into the FS layer with a short explanation why. All allocation
222 * requests will inherit GFP_NOFS implicitly.
207 * 223 *
208 * GFP_USER is for userspace allocations that also need to be directly 224 * GFP_USER is for userspace allocations that also need to be directly
209 * accessibly by the kernel or hardware. It is typically used by hardware 225 * accessibly by the kernel or hardware. It is typically used by hardware
@@ -297,8 +313,8 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
297 313
298/* 314/*
299 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the 315 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
300 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long 316 * zone to use given the lowest 4 bits of gfp_t. Entries are GFP_ZONES_SHIFT
301 * and there are 16 of them to cover all possible combinations of 317 * bits long and there are 16 of them to cover all possible combinations of
302 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM. 318 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM.
303 * 319 *
304 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA. 320 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 933d93656605..8f702fcbe485 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -170,14 +170,14 @@ static inline struct gpio_desc *__must_check
170gpiod_get_optional(struct device *dev, const char *con_id, 170gpiod_get_optional(struct device *dev, const char *con_id,
171 enum gpiod_flags flags) 171 enum gpiod_flags flags)
172{ 172{
173 return ERR_PTR(-ENOSYS); 173 return NULL;
174} 174}
175 175
176static inline struct gpio_desc *__must_check 176static inline struct gpio_desc *__must_check
177gpiod_get_index_optional(struct device *dev, const char *con_id, 177gpiod_get_index_optional(struct device *dev, const char *con_id,
178 unsigned int index, enum gpiod_flags flags) 178 unsigned int index, enum gpiod_flags flags)
179{ 179{
180 return ERR_PTR(-ENOSYS); 180 return NULL;
181} 181}
182 182
183static inline struct gpio_descs *__must_check 183static inline struct gpio_descs *__must_check
@@ -191,7 +191,7 @@ static inline struct gpio_descs *__must_check
191gpiod_get_array_optional(struct device *dev, const char *con_id, 191gpiod_get_array_optional(struct device *dev, const char *con_id,
192 enum gpiod_flags flags) 192 enum gpiod_flags flags)
193{ 193{
194 return ERR_PTR(-ENOSYS); 194 return NULL;
195} 195}
196 196
197static inline void gpiod_put(struct gpio_desc *desc) 197static inline void gpiod_put(struct gpio_desc *desc)
@@ -231,14 +231,14 @@ static inline struct gpio_desc *__must_check
231devm_gpiod_get_optional(struct device *dev, const char *con_id, 231devm_gpiod_get_optional(struct device *dev, const char *con_id,
232 enum gpiod_flags flags) 232 enum gpiod_flags flags)
233{ 233{
234 return ERR_PTR(-ENOSYS); 234 return NULL;
235} 235}
236 236
237static inline struct gpio_desc *__must_check 237static inline struct gpio_desc *__must_check
238devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 238devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
239 unsigned int index, enum gpiod_flags flags) 239 unsigned int index, enum gpiod_flags flags)
240{ 240{
241 return ERR_PTR(-ENOSYS); 241 return NULL;
242} 242}
243 243
244static inline struct gpio_descs *__must_check 244static inline struct gpio_descs *__must_check
@@ -252,7 +252,7 @@ static inline struct gpio_descs *__must_check
252devm_gpiod_get_array_optional(struct device *dev, const char *con_id, 252devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
253 enum gpiod_flags flags) 253 enum gpiod_flags flags)
254{ 254{
255 return ERR_PTR(-ENOSYS); 255 return NULL;
256} 256}
257 257
258static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) 258static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 846f3b989480..393582867afd 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -168,7 +168,7 @@ struct gpio_chip {
168 unsigned int irq_base; 168 unsigned int irq_base;
169 irq_flow_handler_t irq_handler; 169 irq_flow_handler_t irq_handler;
170 unsigned int irq_default_type; 170 unsigned int irq_default_type;
171 int irq_chained_parent; 171 unsigned int irq_chained_parent;
172 bool irq_nested; 172 bool irq_nested;
173 bool irq_need_valid_mask; 173 bool irq_need_valid_mask;
174 unsigned long *irq_valid_mask; 174 unsigned long *irq_valid_mask;
@@ -244,12 +244,12 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev,
244 244
245void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, 245void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
246 struct irq_chip *irqchip, 246 struct irq_chip *irqchip,
247 int parent_irq, 247 unsigned int parent_irq,
248 irq_flow_handler_t parent_handler); 248 irq_flow_handler_t parent_handler);
249 249
250void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip, 250void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip,
251 struct irq_chip *irqchip, 251 struct irq_chip *irqchip,
252 int parent_irq); 252 unsigned int parent_irq);
253 253
254int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, 254int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
255 struct irq_chip *irqchip, 255 struct irq_chip *irqchip,
diff --git a/include/linux/gpio/gpio-reg.h b/include/linux/gpio/gpio-reg.h
new file mode 100644
index 000000000000..90e0b9060e6d
--- /dev/null
+++ b/include/linux/gpio/gpio-reg.h
@@ -0,0 +1,13 @@
1#ifndef GPIO_REG_H
2#define GPIO_REG_H
3
4struct device;
5struct irq_domain;
6
7struct gpio_chip *gpio_reg_init(struct device *dev, void __iomem *reg,
8 int base, int num, const char *label, u32 direction, u32 def_out,
9 const char *const *names, struct irq_domain *irqdom, const int *irqs);
10
11int gpio_reg_resume(struct gpio_chip *gc);
12
13#endif
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index edbb4fc674ed..d271ff23984f 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -35,6 +35,7 @@ enum hdmi_infoframe_type {
35}; 35};
36 36
37#define HDMI_IEEE_OUI 0x000c03 37#define HDMI_IEEE_OUI 0x000c03
38#define HDMI_FORUM_IEEE_OUI 0xc45dd8
38#define HDMI_INFOFRAME_HEADER_SIZE 4 39#define HDMI_INFOFRAME_HEADER_SIZE 4
39#define HDMI_AVI_INFOFRAME_SIZE 13 40#define HDMI_AVI_INFOFRAME_SIZE 13
40#define HDMI_SPD_INFOFRAME_SIZE 25 41#define HDMI_SPD_INFOFRAME_SIZE 25
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 7ef111d3ecc5..f32d7c392c1e 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -231,6 +231,8 @@ struct hid_sensor_common {
231 unsigned usage_id; 231 unsigned usage_id;
232 atomic_t data_ready; 232 atomic_t data_ready;
233 atomic_t user_requested_state; 233 atomic_t user_requested_state;
234 int poll_interval;
235 int raw_hystersis;
234 struct iio_trigger *trigger; 236 struct iio_trigger *trigger;
235 int timestamp_ns_scale; 237 int timestamp_ns_scale;
236 struct hid_sensor_hub_attribute_info poll; 238 struct hid_sensor_hub_attribute_info poll;
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 30c7dc45e45f..761f86242473 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -45,6 +45,14 @@
45#define HID_USAGE_SENSOR_DATA_ATMOSPHERIC_PRESSURE 0x200430 45#define HID_USAGE_SENSOR_DATA_ATMOSPHERIC_PRESSURE 0x200430
46#define HID_USAGE_SENSOR_ATMOSPHERIC_PRESSURE 0x200431 46#define HID_USAGE_SENSOR_ATMOSPHERIC_PRESSURE 0x200431
47 47
48/* Tempreture (200033) */
49#define HID_USAGE_SENSOR_TEMPERATURE 0x200033
50#define HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE 0x200434
51
52/* humidity */
53#define HID_USAGE_SENSOR_HUMIDITY 0x200032
54#define HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY 0x200433
55
48/* Gyro 3D: (200076) */ 56/* Gyro 3D: (200076) */
49#define HID_USAGE_SENSOR_GYRO_3D 0x200076 57#define HID_USAGE_SENSOR_GYRO_3D 0x200076
50#define HID_USAGE_SENSOR_DATA_ANGL_VELOCITY 0x200456 58#define HID_USAGE_SENSOR_DATA_ANGL_VELOCITY 0x200456
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 28f38e2b8f30..5be325d890d9 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -268,6 +268,8 @@ struct hid_item {
268#define HID_CP_APPLICATIONLAUNCHBUTTONS 0x000c0180 268#define HID_CP_APPLICATIONLAUNCHBUTTONS 0x000c0180
269#define HID_CP_GENERICGUIAPPLICATIONCONTROLS 0x000c0200 269#define HID_CP_GENERICGUIAPPLICATIONCONTROLS 0x000c0200
270 270
271#define HID_DG_DEVICECONFIG 0x000d000e
272#define HID_DG_DEVICESETTINGS 0x000d0023
271#define HID_DG_CONFIDENCE 0x000d0047 273#define HID_DG_CONFIDENCE 0x000d0047
272#define HID_DG_WIDTH 0x000d0048 274#define HID_DG_WIDTH 0x000d0048
273#define HID_DG_HEIGHT 0x000d0049 275#define HID_DG_HEIGHT 0x000d0049
@@ -322,7 +324,7 @@ struct hid_item {
322#define HID_QUIRK_MULTI_INPUT 0x00000040 324#define HID_QUIRK_MULTI_INPUT 0x00000040
323#define HID_QUIRK_HIDINPUT_FORCE 0x00000080 325#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
324#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 326#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
325#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 327/* 0x00000200 reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */
326#define HID_QUIRK_ALWAYS_POLL 0x00000400 328#define HID_QUIRK_ALWAYS_POLL 0x00000400
327#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 329#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
328#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000 330#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000
@@ -541,7 +543,6 @@ struct hid_device { /* device report descriptor */
541 struct list_head inputs; /* The list of inputs */ 543 struct list_head inputs; /* The list of inputs */
542 void *hiddev; /* The hiddev structure */ 544 void *hiddev; /* The hiddev structure */
543 void *hidraw; 545 void *hidraw;
544 int minor; /* Hiddev minor number */
545 546
546 int open; /* is the device open by anyone? */ 547 int open; /* is the device open by anyone? */
547 char name[128]; /* Device name */ 548 char name[128]; /* Device name */
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index a5dd8148660b..921622222957 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -32,6 +32,18 @@
32 * In-kernel definitions. 32 * In-kernel definitions.
33 */ 33 */
34 34
35struct hiddev {
36 int minor;
37 int exist;
38 int open;
39 struct mutex existancelock;
40 wait_queue_head_t wait;
41 struct hid_device *hid;
42 struct list_head list;
43 spinlock_t list_lock;
44 bool initialized;
45};
46
35struct hid_device; 47struct hid_device;
36struct hid_usage; 48struct hid_usage;
37struct hid_field; 49struct hid_field;
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index 1ffbf2a8cb99..3d04aa1dc83e 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -26,6 +26,7 @@ enum host1x_class {
26 HOST1X_CLASS_HOST1X = 0x1, 26 HOST1X_CLASS_HOST1X = 0x1,
27 HOST1X_CLASS_GR2D = 0x51, 27 HOST1X_CLASS_GR2D = 0x51,
28 HOST1X_CLASS_GR2D_SB = 0x52, 28 HOST1X_CLASS_GR2D_SB = 0x52,
29 HOST1X_CLASS_VIC = 0x5D,
29 HOST1X_CLASS_GR3D = 0x60, 30 HOST1X_CLASS_GR3D = 0x60,
30}; 31};
31 32
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 249e579ecd4c..8c5b10eb7265 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -276,8 +276,6 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
276 return timer->base->cpu_base->hres_active; 276 return timer->base->cpu_base->hres_active;
277} 277}
278 278
279extern void hrtimer_peek_ahead_timers(void);
280
281/* 279/*
282 * The resolution of the clocks. The resolution value is returned in 280 * The resolution of the clocks. The resolution value is returned in
283 * the clock_getres() system call to give application programmers an 281 * the clock_getres() system call to give application programmers an
@@ -300,8 +298,6 @@ extern unsigned int hrtimer_resolution;
300 298
301#define hrtimer_resolution (unsigned int)LOW_RES_NSEC 299#define hrtimer_resolution (unsigned int)LOW_RES_NSEC
302 300
303static inline void hrtimer_peek_ahead_timers(void) { }
304
305static inline int hrtimer_is_hres_active(struct hrtimer *timer) 301static inline int hrtimer_is_hres_active(struct hrtimer *timer)
306{ 302{
307 return 0; 303 return 0;
@@ -456,7 +452,7 @@ static inline u64 hrtimer_forward_now(struct hrtimer *timer,
456} 452}
457 453
458/* Precise sleep: */ 454/* Precise sleep: */
459extern long hrtimer_nanosleep(struct timespec *rqtp, 455extern long hrtimer_nanosleep(struct timespec64 *rqtp,
460 struct timespec __user *rmtp, 456 struct timespec __user *rmtp,
461 const enum hrtimer_mode mode, 457 const enum hrtimer_mode mode,
462 const clockid_t clockid); 458 const clockid_t clockid);
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 88b673749121..ceb751987c40 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -337,7 +337,7 @@ struct hwmon_ops {
337 int (*read)(struct device *dev, enum hwmon_sensor_types type, 337 int (*read)(struct device *dev, enum hwmon_sensor_types type,
338 u32 attr, int channel, long *val); 338 u32 attr, int channel, long *val);
339 int (*read_string)(struct device *dev, enum hwmon_sensor_types type, 339 int (*read_string)(struct device *dev, enum hwmon_sensor_types type,
340 u32 attr, int channel, char **str); 340 u32 attr, int channel, const char **str);
341 int (*write)(struct device *dev, enum hwmon_sensor_types type, 341 int (*write)(struct device *dev, enum hwmon_sensor_types type,
342 u32 attr, int channel, long val); 342 u32 attr, int channel, long val);
343}; 343};
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 970771a5f739..e09fc8290c2f 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -491,6 +491,12 @@ struct vmbus_channel_rescind_offer {
491 u32 child_relid; 491 u32 child_relid;
492} __packed; 492} __packed;
493 493
494static inline u32
495hv_ringbuffer_pending_size(const struct hv_ring_buffer_info *rbi)
496{
497 return rbi->ring_buffer->pending_send_sz;
498}
499
494/* 500/*
495 * Request Offer -- no parameters, SynIC message contains the partition ID 501 * Request Offer -- no parameters, SynIC message contains the partition ID
496 * Set Snoop -- no parameters, SynIC message contains the partition ID 502 * Set Snoop -- no parameters, SynIC message contains the partition ID
@@ -524,10 +530,10 @@ struct vmbus_channel_open_channel {
524 u32 target_vp; 530 u32 target_vp;
525 531
526 /* 532 /*
527 * The upstream ring buffer begins at offset zero in the memory 533 * The upstream ring buffer begins at offset zero in the memory
528 * described by RingBufferGpadlHandle. The downstream ring buffer 534 * described by RingBufferGpadlHandle. The downstream ring buffer
529 * follows it at this offset (in pages). 535 * follows it at this offset (in pages).
530 */ 536 */
531 u32 downstream_ringbuffer_pageoffset; 537 u32 downstream_ringbuffer_pageoffset;
532 538
533 /* User-specific data to be passed along to the server endpoint. */ 539 /* User-specific data to be passed along to the server endpoint. */
@@ -1013,7 +1019,7 @@ extern int vmbus_open(struct vmbus_channel *channel,
1013 u32 recv_ringbuffersize, 1019 u32 recv_ringbuffersize,
1014 void *userdata, 1020 void *userdata,
1015 u32 userdatalen, 1021 u32 userdatalen,
1016 void(*onchannel_callback)(void *context), 1022 void (*onchannel_callback)(void *context),
1017 void *context); 1023 void *context);
1018 1024
1019extern void vmbus_close(struct vmbus_channel *channel); 1025extern void vmbus_close(struct vmbus_channel *channel);
@@ -1155,6 +1161,17 @@ static inline void *hv_get_drvdata(struct hv_device *dev)
1155 return dev_get_drvdata(&dev->device); 1161 return dev_get_drvdata(&dev->device);
1156} 1162}
1157 1163
1164struct hv_ring_buffer_debug_info {
1165 u32 current_interrupt_mask;
1166 u32 current_read_index;
1167 u32 current_write_index;
1168 u32 bytes_avail_toread;
1169 u32 bytes_avail_towrite;
1170};
1171
1172void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
1173 struct hv_ring_buffer_debug_info *debug_info);
1174
1158/* Vmbus interface */ 1175/* Vmbus interface */
1159#define vmbus_driver_register(driver) \ 1176#define vmbus_driver_register(driver) \
1160 __vmbus_driver_register(driver, THIS_MODULE, KBUILD_MODNAME) 1177 __vmbus_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
@@ -1428,7 +1445,7 @@ struct hyperv_service_callback {
1428 char *log_msg; 1445 char *log_msg;
1429 uuid_le data; 1446 uuid_le data;
1430 struct vmbus_channel *channel; 1447 struct vmbus_channel *channel;
1431 void (*callback) (void *context); 1448 void (*callback)(void *context);
1432}; 1449};
1433 1450
1434#define MAX_SRV_VER 0x7ffffff 1451#define MAX_SRV_VER 0x7ffffff
@@ -1504,16 +1521,6 @@ static inline void hv_signal_on_read(struct vmbus_channel *channel)
1504 cached_write_sz = hv_get_cached_bytes_to_write(rbi); 1521 cached_write_sz = hv_get_cached_bytes_to_write(rbi);
1505 if (cached_write_sz < pending_sz) 1522 if (cached_write_sz < pending_sz)
1506 vmbus_setevent(channel); 1523 vmbus_setevent(channel);
1507
1508 return;
1509}
1510
1511static inline void
1512init_cached_read_index(struct vmbus_channel *channel)
1513{
1514 struct hv_ring_buffer_info *rbi = &channel->inbound;
1515
1516 rbi->cached_read_index = rbi->ring_buffer->read_index;
1517} 1524}
1518 1525
1519/* 1526/*
@@ -1549,76 +1556,48 @@ static inline u32 hv_end_read(struct hv_ring_buffer_info *rbi)
1549/* 1556/*
1550 * An API to support in-place processing of incoming VMBUS packets. 1557 * An API to support in-place processing of incoming VMBUS packets.
1551 */ 1558 */
1552#define VMBUS_PKT_TRAILER 8
1553 1559
1554static inline struct vmpacket_descriptor * 1560/* Get data payload associated with descriptor */
1555get_next_pkt_raw(struct vmbus_channel *channel) 1561static inline void *hv_pkt_data(const struct vmpacket_descriptor *desc)
1556{ 1562{
1557 struct hv_ring_buffer_info *ring_info = &channel->inbound; 1563 return (void *)((unsigned long)desc + (desc->offset8 << 3));
1558 u32 priv_read_loc = ring_info->priv_read_index;
1559 void *ring_buffer = hv_get_ring_buffer(ring_info);
1560 u32 dsize = ring_info->ring_datasize;
1561 /*
1562 * delta is the difference between what is available to read and
1563 * what was already consumed in place. We commit read index after
1564 * the whole batch is processed.
1565 */
1566 u32 delta = priv_read_loc >= ring_info->ring_buffer->read_index ?
1567 priv_read_loc - ring_info->ring_buffer->read_index :
1568 (dsize - ring_info->ring_buffer->read_index) + priv_read_loc;
1569 u32 bytes_avail_toread = (hv_get_bytes_to_read(ring_info) - delta);
1570
1571 if (bytes_avail_toread < sizeof(struct vmpacket_descriptor))
1572 return NULL;
1573
1574 return ring_buffer + priv_read_loc;
1575} 1564}
1576 1565
1577/* 1566/* Get data size associated with descriptor */
1578 * A helper function to step through packets "in-place" 1567static inline u32 hv_pkt_datalen(const struct vmpacket_descriptor *desc)
1579 * This API is to be called after each successful call
1580 * get_next_pkt_raw().
1581 */
1582static inline void put_pkt_raw(struct vmbus_channel *channel,
1583 struct vmpacket_descriptor *desc)
1584{ 1568{
1585 struct hv_ring_buffer_info *ring_info = &channel->inbound; 1569 return (desc->len8 << 3) - (desc->offset8 << 3);
1586 u32 packetlen = desc->len8 << 3;
1587 u32 dsize = ring_info->ring_datasize;
1588
1589 /*
1590 * Include the packet trailer.
1591 */
1592 ring_info->priv_read_index += packetlen + VMBUS_PKT_TRAILER;
1593 ring_info->priv_read_index %= dsize;
1594} 1570}
1595 1571
1572
1573struct vmpacket_descriptor *
1574hv_pkt_iter_first(struct vmbus_channel *channel);
1575
1576struct vmpacket_descriptor *
1577__hv_pkt_iter_next(struct vmbus_channel *channel,
1578 const struct vmpacket_descriptor *pkt);
1579
1580void hv_pkt_iter_close(struct vmbus_channel *channel);
1581
1596/* 1582/*
1597 * This call commits the read index and potentially signals the host. 1583 * Get next packet descriptor from iterator
1598 * Here is the pattern for using the "in-place" consumption APIs: 1584 * If at end of list, return NULL and update host.
1599 *
1600 * init_cached_read_index();
1601 *
1602 * while (get_next_pkt_raw() {
1603 * process the packet "in-place";
1604 * put_pkt_raw();
1605 * }
1606 * if (packets processed in place)
1607 * commit_rd_index();
1608 */ 1585 */
1609static inline void commit_rd_index(struct vmbus_channel *channel) 1586static inline struct vmpacket_descriptor *
1587hv_pkt_iter_next(struct vmbus_channel *channel,
1588 const struct vmpacket_descriptor *pkt)
1610{ 1589{
1611 struct hv_ring_buffer_info *ring_info = &channel->inbound; 1590 struct vmpacket_descriptor *nxt;
1612 /* 1591
1613 * Make sure all reads are done before we update the read index since 1592 nxt = __hv_pkt_iter_next(channel, pkt);
1614 * the writer may start writing to the read area once the read index 1593 if (!nxt)
1615 * is updated. 1594 hv_pkt_iter_close(channel);
1616 */
1617 virt_rmb();
1618 ring_info->ring_buffer->read_index = ring_info->priv_read_index;
1619 1595
1620 hv_signal_on_read(channel); 1596 return nxt;
1621} 1597}
1622 1598
1599#define foreach_vmbus_pkt(pkt, channel) \
1600 for (pkt = hv_pkt_iter_first(channel); pkt; \
1601 pkt = hv_pkt_iter_next(channel, pkt))
1623 1602
1624#endif /* _HYPERV_H */ 1603#endif /* _HYPERV_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index c5bd8b8daf97..72d0ece70ed3 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -150,6 +150,7 @@ enum i2c_alert_protocol {
150 * @detect: Callback for device detection 150 * @detect: Callback for device detection
151 * @address_list: The I2C addresses to probe (for detect) 151 * @address_list: The I2C addresses to probe (for detect)
152 * @clients: List of detected clients we created (for i2c-core use only) 152 * @clients: List of detected clients we created (for i2c-core use only)
153 * @disable_i2c_core_irq_mapping: Tell the i2c-core to not do irq-mapping
153 * 154 *
154 * The driver.owner field should be set to the module owner of this driver. 155 * The driver.owner field should be set to the module owner of this driver.
155 * The driver.name field should be set to the name of this driver. 156 * The driver.name field should be set to the name of this driver.
@@ -213,6 +214,8 @@ struct i2c_driver {
213 int (*detect)(struct i2c_client *, struct i2c_board_info *); 214 int (*detect)(struct i2c_client *, struct i2c_board_info *);
214 const unsigned short *address_list; 215 const unsigned short *address_list;
215 struct list_head clients; 216 struct list_head clients;
217
218 bool disable_i2c_core_irq_mapping;
216}; 219};
217#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 220#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
218 221
@@ -829,11 +832,18 @@ static inline const struct of_device_id
829 832
830#if IS_ENABLED(CONFIG_ACPI) 833#if IS_ENABLED(CONFIG_ACPI)
831u32 i2c_acpi_find_bus_speed(struct device *dev); 834u32 i2c_acpi_find_bus_speed(struct device *dev);
835struct i2c_client *i2c_acpi_new_device(struct device *dev, int index,
836 struct i2c_board_info *info);
832#else 837#else
833static inline u32 i2c_acpi_find_bus_speed(struct device *dev) 838static inline u32 i2c_acpi_find_bus_speed(struct device *dev)
834{ 839{
835 return 0; 840 return 0;
836} 841}
842static inline struct i2c_client *i2c_acpi_new_device(struct device *dev,
843 int index, struct i2c_board_info *info)
844{
845 return NULL;
846}
837#endif /* CONFIG_ACPI */ 847#endif /* CONFIG_ACPI */
838 848
839#endif /* _LINUX_I2C_H */ 849#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/i2c-hid.h b/include/linux/i2c/i2c-hid.h
index 7aa901d92058..1fb088239d12 100644
--- a/include/linux/i2c/i2c-hid.h
+++ b/include/linux/i2c/i2c-hid.h
@@ -14,9 +14,13 @@
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16 16
17struct regulator;
18
17/** 19/**
18 * struct i2chid_platform_data - used by hid over i2c implementation. 20 * struct i2chid_platform_data - used by hid over i2c implementation.
19 * @hid_descriptor_address: i2c register where the HID descriptor is stored. 21 * @hid_descriptor_address: i2c register where the HID descriptor is stored.
22 * @supply: regulator for powering on the device.
23 * @post_power_delay_ms: delay after powering on before device is usable.
20 * 24 *
21 * Note that it is the responsibility of the platform driver (or the acpi 5.0 25 * Note that it is the responsibility of the platform driver (or the acpi 5.0
22 * driver, or the flattened device tree) to setup the irq related to the gpio in 26 * driver, or the flattened device tree) to setup the irq related to the gpio in
@@ -31,6 +35,8 @@
31 */ 35 */
32struct i2c_hid_platform_data { 36struct i2c_hid_platform_data {
33 u16 hid_descriptor_address; 37 u16 hid_descriptor_address;
38 struct regulator *supply;
39 int post_power_delay_ms;
34}; 40};
35 41
36#endif /* __LINUX_I2C_HID_H */ 42#endif /* __LINUX_I2C_HID_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 2f51c1724b5a..6980ca322074 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -88,7 +88,7 @@ static inline bool ata_pm_request(struct request *rq)
88 ide_req(rq)->type == ATA_PRIV_PM_RESUME); 88 ide_req(rq)->type == ATA_PRIV_PM_RESUME);
89} 89}
90 90
91/* Error codes returned in rq->errors to the higher part of the driver. */ 91/* Error codes returned in result to the higher part of the driver. */
92enum { 92enum {
93 IDE_DRV_ERROR_GENERAL = 101, 93 IDE_DRV_ERROR_GENERAL = 101,
94 IDE_DRV_ERROR_FILEMARK = 102, 94 IDE_DRV_ERROR_FILEMARK = 102,
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 0dd9498c694f..69033353d0d1 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -7,7 +7,7 @@
7 * Copyright (c) 2005, Devicescape Software, Inc. 7 * Copyright (c) 2005, Devicescape Software, Inc.
8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> 8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
9 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH 9 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
10 * Copyright (c) 2016 Intel Deutschland GmbH 10 * Copyright (c) 2016 - 2017 Intel Deutschland GmbH
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 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 13 * it under the terms of the GNU General Public License version 2 as
@@ -1411,6 +1411,8 @@ struct ieee80211_ht_operation {
1411#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3 1411#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
1412#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004 1412#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
1413#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010 1413#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
1414#define IEEE80211_HT_OP_MODE_CCFS2_SHIFT 5
1415#define IEEE80211_HT_OP_MODE_CCFS2_MASK 0x1fe0
1414 1416
1415/* for stbc_param */ 1417/* for stbc_param */
1416#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040 1418#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
@@ -1525,14 +1527,14 @@ enum ieee80211_vht_chanwidth {
1525 * This structure is the "VHT operation element" as 1527 * This structure is the "VHT operation element" as
1526 * described in 802.11ac D3.0 8.4.2.161 1528 * described in 802.11ac D3.0 8.4.2.161
1527 * @chan_width: Operating channel width 1529 * @chan_width: Operating channel width
1530 * @center_freq_seg0_idx: center freq segment 0 index
1528 * @center_freq_seg1_idx: center freq segment 1 index 1531 * @center_freq_seg1_idx: center freq segment 1 index
1529 * @center_freq_seg2_idx: center freq segment 2 index
1530 * @basic_mcs_set: VHT Basic MCS rate set 1532 * @basic_mcs_set: VHT Basic MCS rate set
1531 */ 1533 */
1532struct ieee80211_vht_operation { 1534struct ieee80211_vht_operation {
1533 u8 chan_width; 1535 u8 chan_width;
1536 u8 center_freq_seg0_idx;
1534 u8 center_freq_seg1_idx; 1537 u8 center_freq_seg1_idx;
1535 u8 center_freq_seg2_idx;
1536 __le16 basic_mcs_set; 1538 __le16 basic_mcs_set;
1537} __packed; 1539} __packed;
1538 1540
@@ -1721,6 +1723,9 @@ enum ieee80211_statuscode {
1721 WLAN_STATUS_REJECT_DSE_BAND = 96, 1723 WLAN_STATUS_REJECT_DSE_BAND = 96,
1722 WLAN_STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL = 99, 1724 WLAN_STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL = 99,
1723 WLAN_STATUS_DENIED_DUE_TO_SPECTRUM_MANAGEMENT = 103, 1725 WLAN_STATUS_DENIED_DUE_TO_SPECTRUM_MANAGEMENT = 103,
1726 /* 802.11ai */
1727 WLAN_STATUS_FILS_AUTHENTICATION_FAILURE = 108,
1728 WLAN_STATUS_UNKNOWN_AUTHENTICATION_SERVER = 109,
1724}; 1729};
1725 1730
1726 1731
@@ -2102,6 +2107,12 @@ enum ieee80211_key_len {
2102#define FILS_NONCE_LEN 16 2107#define FILS_NONCE_LEN 16
2103#define FILS_MAX_KEK_LEN 64 2108#define FILS_MAX_KEK_LEN 64
2104 2109
2110#define FILS_ERP_MAX_USERNAME_LEN 16
2111#define FILS_ERP_MAX_REALM_LEN 253
2112#define FILS_ERP_MAX_RRK_LEN 64
2113
2114#define PMK_MAX_LEN 48
2115
2105/* Public action codes */ 2116/* Public action codes */
2106enum ieee80211_pub_actioncode { 2117enum ieee80211_pub_actioncode {
2107 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4, 2118 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
@@ -2166,37 +2177,37 @@ enum ieee80211_tdls_actioncode {
2166#define WLAN_BSS_COEX_INFORMATION_REQUEST BIT(0) 2177#define WLAN_BSS_COEX_INFORMATION_REQUEST BIT(0)
2167 2178
2168/** 2179/**
2169 * enum - mesh synchronization method identifier 2180 * enum ieee80211_mesh_sync_method - mesh synchronization method identifier
2170 * 2181 *
2171 * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method 2182 * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method
2172 * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method 2183 * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method
2173 * that will be specified in a vendor specific information element 2184 * that will be specified in a vendor specific information element
2174 */ 2185 */
2175enum { 2186enum ieee80211_mesh_sync_method {
2176 IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1, 2187 IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1,
2177 IEEE80211_SYNC_METHOD_VENDOR = 255, 2188 IEEE80211_SYNC_METHOD_VENDOR = 255,
2178}; 2189};
2179 2190
2180/** 2191/**
2181 * enum - mesh path selection protocol identifier 2192 * enum ieee80211_mesh_path_protocol - mesh path selection protocol identifier
2182 * 2193 *
2183 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol 2194 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
2184 * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will 2195 * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will
2185 * be specified in a vendor specific information element 2196 * be specified in a vendor specific information element
2186 */ 2197 */
2187enum { 2198enum ieee80211_mesh_path_protocol {
2188 IEEE80211_PATH_PROTOCOL_HWMP = 1, 2199 IEEE80211_PATH_PROTOCOL_HWMP = 1,
2189 IEEE80211_PATH_PROTOCOL_VENDOR = 255, 2200 IEEE80211_PATH_PROTOCOL_VENDOR = 255,
2190}; 2201};
2191 2202
2192/** 2203/**
2193 * enum - mesh path selection metric identifier 2204 * enum ieee80211_mesh_path_metric - mesh path selection metric identifier
2194 * 2205 *
2195 * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric 2206 * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric
2196 * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be 2207 * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be
2197 * specified in a vendor specific information element 2208 * specified in a vendor specific information element
2198 */ 2209 */
2199enum { 2210enum ieee80211_mesh_path_metric {
2200 IEEE80211_PATH_METRIC_AIRTIME = 1, 2211 IEEE80211_PATH_METRIC_AIRTIME = 1,
2201 IEEE80211_PATH_METRIC_VENDOR = 255, 2212 IEEE80211_PATH_METRIC_VENDOR = 255,
2202}; 2213};
@@ -2305,6 +2316,32 @@ struct ieee80211_timeout_interval_ie {
2305 __le32 value; 2316 __le32 value;
2306} __packed; 2317} __packed;
2307 2318
2319/**
2320 * enum ieee80211_idle_options - BSS idle options
2321 * @WLAN_IDLE_OPTIONS_PROTECTED_KEEP_ALIVE: the station should send an RSN
2322 * protected frame to the AP to reset the idle timer at the AP for
2323 * the station.
2324 */
2325enum ieee80211_idle_options {
2326 WLAN_IDLE_OPTIONS_PROTECTED_KEEP_ALIVE = BIT(0),
2327};
2328
2329/**
2330 * struct ieee80211_bss_max_idle_period_ie
2331 *
2332 * This structure refers to "BSS Max idle period element"
2333 *
2334 * @max_idle_period: indicates the time period during which a station can
2335 * refrain from transmitting frames to its associated AP without being
2336 * disassociated. In units of 1000 TUs.
2337 * @idle_options: indicates the options associated with the BSS idle capability
2338 * as specified in &enum ieee80211_idle_options.
2339 */
2340struct ieee80211_bss_max_idle_period_ie {
2341 __le16 max_idle_period;
2342 u8 idle_options;
2343} __packed;
2344
2308/* BACK action code */ 2345/* BACK action code */
2309enum ieee80211_back_actioncode { 2346enum ieee80211_back_actioncode {
2310 WLAN_ACTION_ADDBA_REQ = 0, 2347 WLAN_ACTION_ADDBA_REQ = 0,
@@ -2345,13 +2382,21 @@ enum ieee80211_sa_query_action {
2345#define WLAN_CIPHER_SUITE_SMS4 SUITE(0x001472, 1) 2382#define WLAN_CIPHER_SUITE_SMS4 SUITE(0x001472, 1)
2346 2383
2347/* AKM suite selectors */ 2384/* AKM suite selectors */
2348#define WLAN_AKM_SUITE_8021X SUITE(0x000FAC, 1) 2385#define WLAN_AKM_SUITE_8021X SUITE(0x000FAC, 1)
2349#define WLAN_AKM_SUITE_PSK SUITE(0x000FAC, 2) 2386#define WLAN_AKM_SUITE_PSK SUITE(0x000FAC, 2)
2350#define WLAN_AKM_SUITE_8021X_SHA256 SUITE(0x000FAC, 5) 2387#define WLAN_AKM_SUITE_FT_8021X SUITE(0x000FAC, 3)
2351#define WLAN_AKM_SUITE_PSK_SHA256 SUITE(0x000FAC, 6) 2388#define WLAN_AKM_SUITE_FT_PSK SUITE(0x000FAC, 4)
2352#define WLAN_AKM_SUITE_TDLS SUITE(0x000FAC, 7) 2389#define WLAN_AKM_SUITE_8021X_SHA256 SUITE(0x000FAC, 5)
2353#define WLAN_AKM_SUITE_SAE SUITE(0x000FAC, 8) 2390#define WLAN_AKM_SUITE_PSK_SHA256 SUITE(0x000FAC, 6)
2354#define WLAN_AKM_SUITE_FT_OVER_SAE SUITE(0x000FAC, 9) 2391#define WLAN_AKM_SUITE_TDLS SUITE(0x000FAC, 7)
2392#define WLAN_AKM_SUITE_SAE SUITE(0x000FAC, 8)
2393#define WLAN_AKM_SUITE_FT_OVER_SAE SUITE(0x000FAC, 9)
2394#define WLAN_AKM_SUITE_8021X_SUITE_B SUITE(0x000FAC, 11)
2395#define WLAN_AKM_SUITE_8021X_SUITE_B_192 SUITE(0x000FAC, 12)
2396#define WLAN_AKM_SUITE_FILS_SHA256 SUITE(0x000FAC, 14)
2397#define WLAN_AKM_SUITE_FILS_SHA384 SUITE(0x000FAC, 15)
2398#define WLAN_AKM_SUITE_FT_FILS_SHA256 SUITE(0x000FAC, 16)
2399#define WLAN_AKM_SUITE_FT_FILS_SHA384 SUITE(0x000FAC, 17)
2355 2400
2356#define WLAN_MAX_KEY_LEN 32 2401#define WLAN_MAX_KEY_LEN 32
2357 2402
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index c5847dc75a93..0c16866a7aac 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -48,6 +48,7 @@ struct br_ip_list {
48#define BR_MCAST_FLOOD BIT(11) 48#define BR_MCAST_FLOOD BIT(11)
49#define BR_MULTICAST_TO_UNICAST BIT(12) 49#define BR_MULTICAST_TO_UNICAST BIT(12)
50#define BR_VLAN_TUNNEL BIT(13) 50#define BR_VLAN_TUNNEL BIT(13)
51#define BR_BCAST_FLOOD BIT(14)
51 52
52#define BR_DEFAULT_AGEING_TIME (300 * HZ) 53#define BR_DEFAULT_AGEING_TIME (300 * HZ)
53 54
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 8d5fcd6284ce..283dc2f5364d 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -614,14 +614,16 @@ static inline bool skb_vlan_tagged_multi(const struct sk_buff *skb)
614static inline netdev_features_t vlan_features_check(const struct sk_buff *skb, 614static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,
615 netdev_features_t features) 615 netdev_features_t features)
616{ 616{
617 if (skb_vlan_tagged_multi(skb)) 617 if (skb_vlan_tagged_multi(skb)) {
618 features = netdev_intersect_features(features, 618 /* In the case of multi-tagged packets, use a direct mask
619 NETIF_F_SG | 619 * instead of using netdev_interesect_features(), to make
620 NETIF_F_HIGHDMA | 620 * sure that only devices supporting NETIF_F_HW_CSUM will
621 NETIF_F_FRAGLIST | 621 * have checksum offloading support.
622 NETIF_F_HW_CSUM | 622 */
623 NETIF_F_HW_VLAN_CTAG_TX | 623 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |
624 NETIF_F_HW_VLAN_STAG_TX); 624 NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX |
625 NETIF_F_HW_VLAN_STAG_TX;
626 }
625 627
626 return features; 628 return features;
627} 629}
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 4cca05c9678e..636ebe87e6f8 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -43,6 +43,8 @@
43#define _LINUX_INET_H 43#define _LINUX_INET_H
44 44
45#include <linux/types.h> 45#include <linux/types.h>
46#include <net/net_namespace.h>
47#include <linux/socket.h>
46 48
47/* 49/*
48 * These mimic similar macros defined in user-space for inet_ntop(3). 50 * These mimic similar macros defined in user-space for inet_ntop(3).
@@ -54,4 +56,8 @@
54extern __be32 in_aton(const char *str); 56extern __be32 in_aton(const char *str);
55extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); 57extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
56extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); 58extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
59
60extern int inet_pton_with_scope(struct net *net, unsigned short af,
61 const char *src, const char *port, struct sockaddr_storage *addr);
62
57#endif /* _LINUX_INET_H */ 63#endif /* _LINUX_INET_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ee971f335a8b..a2e9d6ea1349 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -153,8 +153,8 @@ struct in_ifaddr {
153int register_inetaddr_notifier(struct notifier_block *nb); 153int register_inetaddr_notifier(struct notifier_block *nb);
154int unregister_inetaddr_notifier(struct notifier_block *nb); 154int unregister_inetaddr_notifier(struct notifier_block *nb);
155 155
156void inet_netconf_notify_devconf(struct net *net, int type, int ifindex, 156void inet_netconf_notify_devconf(struct net *net, int event, int type,
157 struct ipv4_devconf *devconf); 157 int ifindex, struct ipv4_devconf *devconf);
158 158
159struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref); 159struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref);
160static inline struct net_device *ip_dev_find(struct net *net, __be32 addr) 160static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
diff --git a/include/linux/init.h b/include/linux/init.h
index 79af0962fd52..94769d687cf0 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -39,7 +39,7 @@
39 39
40/* These are for everybody (although not all archs will actually 40/* These are for everybody (although not all archs will actually
41 discard it in modules) */ 41 discard it in modules) */
42#define __init __section(.init.text) __cold notrace __latent_entropy 42#define __init __section(.init.text) __cold __inittrace __latent_entropy
43#define __initdata __section(.init.data) 43#define __initdata __section(.init.data)
44#define __initconst __section(.init.rodata) 44#define __initconst __section(.init.rodata)
45#define __exitdata __section(.exit.data) 45#define __exitdata __section(.exit.data)
@@ -68,8 +68,10 @@
68 68
69#ifdef MODULE 69#ifdef MODULE
70#define __exitused 70#define __exitused
71#define __inittrace notrace
71#else 72#else
72#define __exitused __used 73#define __exitused __used
74#define __inittrace
73#endif 75#endif
74 76
75#define __exit __section(.exit.text) __exitused __cold notrace 77#define __exit __section(.exit.text) __exitused __cold notrace
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 91d9049f0039..e049526bc188 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -15,6 +15,7 @@
15#include <linux/sched/autogroup.h> 15#include <linux/sched/autogroup.h>
16#include <net/net_namespace.h> 16#include <net/net_namespace.h>
17#include <linux/sched/rt.h> 17#include <linux/sched/rt.h>
18#include <linux/livepatch.h>
18#include <linux/mm_types.h> 19#include <linux/mm_types.h>
19 20
20#include <asm/thread_info.h> 21#include <asm/thread_info.h>
@@ -181,6 +182,7 @@ extern struct cred init_cred;
181#ifdef CONFIG_RT_MUTEXES 182#ifdef CONFIG_RT_MUTEXES
182# define INIT_RT_MUTEXES(tsk) \ 183# define INIT_RT_MUTEXES(tsk) \
183 .pi_waiters = RB_ROOT, \ 184 .pi_waiters = RB_ROOT, \
185 .pi_top_task = NULL, \
184 .pi_waiters_leftmost = NULL, 186 .pi_waiters_leftmost = NULL,
185#else 187#else
186# define INIT_RT_MUTEXES(tsk) 188# define INIT_RT_MUTEXES(tsk)
@@ -202,6 +204,13 @@ extern struct cred init_cred;
202# define INIT_KASAN(tsk) 204# define INIT_KASAN(tsk)
203#endif 205#endif
204 206
207#ifdef CONFIG_LIVEPATCH
208# define INIT_LIVEPATCH(tsk) \
209 .patch_state = KLP_UNDEFINED,
210#else
211# define INIT_LIVEPATCH(tsk)
212#endif
213
205#ifdef CONFIG_THREAD_INFO_IN_TASK 214#ifdef CONFIG_THREAD_INFO_IN_TASK
206# define INIT_TASK_TI(tsk) \ 215# define INIT_TASK_TI(tsk) \
207 .thread_info = INIT_THREAD_INFO(tsk), \ 216 .thread_info = INIT_THREAD_INFO(tsk), \
@@ -210,6 +219,12 @@ extern struct cred init_cred;
210# define INIT_TASK_TI(tsk) 219# define INIT_TASK_TI(tsk)
211#endif 220#endif
212 221
222#ifdef CONFIG_SECURITY
223#define INIT_TASK_SECURITY .security = NULL,
224#else
225#define INIT_TASK_SECURITY
226#endif
227
213/* 228/*
214 * INIT_TASK is used to set up the first task table, touch at 229 * INIT_TASK is used to set up the first task table, touch at
215 * your own risk!. Base=0, limit=0x1fffff (=2MB) 230 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -288,6 +303,8 @@ extern struct cred init_cred;
288 INIT_VTIME(tsk) \ 303 INIT_VTIME(tsk) \
289 INIT_NUMA_BALANCING(tsk) \ 304 INIT_NUMA_BALANCING(tsk) \
290 INIT_KASAN(tsk) \ 305 INIT_KASAN(tsk) \
306 INIT_LIVEPATCH(tsk) \
307 INIT_TASK_SECURITY \
291} 308}
292 309
293 310
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index c573a52ae440..485a5b48f038 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -30,6 +30,8 @@
30#include <linux/mmu_notifier.h> 30#include <linux/mmu_notifier.h>
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>
34
33#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
34#include <asm/iommu.h> 36#include <asm/iommu.h>
35 37
@@ -72,24 +74,8 @@
72 74
73#define OFFSET_STRIDE (9) 75#define OFFSET_STRIDE (9)
74 76
75#ifdef CONFIG_64BIT
76#define dmar_readq(a) readq(a) 77#define dmar_readq(a) readq(a)
77#define dmar_writeq(a,v) writeq(v,a) 78#define dmar_writeq(a,v) writeq(v,a)
78#else
79static inline u64 dmar_readq(void __iomem *addr)
80{
81 u32 lo, hi;
82 lo = readl(addr);
83 hi = readl(addr + 4);
84 return (((u64) hi) << 32) + lo;
85}
86
87static inline void dmar_writeq(void __iomem *addr, u64 val)
88{
89 writel((u32)val, addr);
90 writel((u32)(val >> 32), addr + 4);
91}
92#endif
93 79
94#define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4) 80#define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
95#define DMAR_VER_MINOR(v) ((v) & 0x0f) 81#define DMAR_VER_MINOR(v) ((v) & 0x0f)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 53144e78a369..a6fba4804672 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -155,7 +155,7 @@ extern int __must_check
155request_percpu_irq(unsigned int irq, irq_handler_t handler, 155request_percpu_irq(unsigned int irq, irq_handler_t handler,
156 const char *devname, void __percpu *percpu_dev_id); 156 const char *devname, void __percpu *percpu_dev_id);
157 157
158extern void free_irq(unsigned int, void *); 158extern const void *free_irq(unsigned int, void *);
159extern void free_percpu_irq(unsigned int, void __percpu *); 159extern void free_percpu_irq(unsigned int, void __percpu *);
160 160
161struct device; 161struct device;
diff --git a/include/linux/io.h b/include/linux/io.h
index 82ef36eac8a1..2195d9ea4aaa 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -90,6 +90,27 @@ void devm_memunmap(struct device *dev, void *addr);
90 90
91void *__devm_memremap_pages(struct device *dev, struct resource *res); 91void *__devm_memremap_pages(struct device *dev, struct resource *res);
92 92
93#ifdef CONFIG_PCI
94/*
95 * The PCI specifications (Rev 3.0, 3.2.5 "Transaction Ordering and
96 * Posting") mandate non-posted configuration transactions. There is
97 * no ioremap API in the kernel that can guarantee non-posted write
98 * semantics across arches so provide a default implementation for
99 * mapping PCI config space that defaults to ioremap_nocache(); arches
100 * should override it if they have memory mapping implementations that
101 * guarantee non-posted writes semantics to make the memory mapping
102 * compliant with the PCI specification.
103 */
104#ifndef pci_remap_cfgspace
105#define pci_remap_cfgspace pci_remap_cfgspace
106static inline void __iomem *pci_remap_cfgspace(phys_addr_t offset,
107 size_t size)
108{
109 return ioremap_nocache(offset, size);
110}
111#endif
112#endif
113
93/* 114/*
94 * Some systems do not have legacy ISA devices. 115 * Some systems do not have legacy ISA devices.
95 * /dev/port is not a valid interface on these systems. 116 * /dev/port is not a valid interface on these systems.
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 7291810067eb..f753e788da31 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -41,6 +41,7 @@ struct iomap {
41 u16 type; /* type of mapping */ 41 u16 type; /* type of mapping */
42 u16 flags; /* flags for mapping */ 42 u16 flags; /* flags for mapping */
43 struct block_device *bdev; /* block device for I/O */ 43 struct block_device *bdev; /* block device for I/O */
44 struct dax_device *dax_dev; /* dax_dev for dax operations */
44}; 45};
45 46
46/* 47/*
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 2e4de0deee53..2cb54adc4a33 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -19,12 +19,12 @@
19#ifndef __LINUX_IOMMU_H 19#ifndef __LINUX_IOMMU_H
20#define __LINUX_IOMMU_H 20#define __LINUX_IOMMU_H
21 21
22#include <linux/scatterlist.h>
23#include <linux/device.h>
24#include <linux/types.h>
22#include <linux/errno.h> 25#include <linux/errno.h>
23#include <linux/err.h> 26#include <linux/err.h>
24#include <linux/of.h> 27#include <linux/of.h>
25#include <linux/types.h>
26#include <linux/scatterlist.h>
27#include <trace/events/iommu.h>
28 28
29#define IOMMU_READ (1 << 0) 29#define IOMMU_READ (1 << 0)
30#define IOMMU_WRITE (1 << 1) 30#define IOMMU_WRITE (1 << 1)
@@ -32,10 +32,13 @@
32#define IOMMU_NOEXEC (1 << 3) 32#define IOMMU_NOEXEC (1 << 3)
33#define IOMMU_MMIO (1 << 4) /* e.g. things like MSI doorbells */ 33#define IOMMU_MMIO (1 << 4) /* e.g. things like MSI doorbells */
34/* 34/*
35 * This is to make the IOMMU API setup privileged 35 * Where the bus hardware includes a privilege level as part of its access type
36 * mapppings accessible by the master only at higher 36 * markings, and certain devices are capable of issuing transactions marked as
37 * privileged execution level and inaccessible at 37 * either 'supervisor' or 'user', the IOMMU_PRIV flag requests that the other
38 * less privileged levels. 38 * given permission flags only apply to accesses at the higher privilege level,
39 * and that unprivileged transactions should have as little access as possible.
40 * This would usually imply the same permissions as kernel mappings on the CPU,
41 * if the IOMMU page table format is equivalent.
39 */ 42 */
40#define IOMMU_PRIV (1 << 5) 43#define IOMMU_PRIV (1 << 5)
41 44
@@ -336,46 +339,9 @@ extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
336 phys_addr_t offset, u64 size, 339 phys_addr_t offset, u64 size,
337 int prot); 340 int prot);
338extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr); 341extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr);
339/**
340 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
341 * @domain: the iommu domain where the fault has happened
342 * @dev: the device where the fault has happened
343 * @iova: the faulting address
344 * @flags: mmu fault flags (e.g. IOMMU_FAULT_READ/IOMMU_FAULT_WRITE/...)
345 *
346 * This function should be called by the low-level IOMMU implementations
347 * whenever IOMMU faults happen, to allow high-level users, that are
348 * interested in such events, to know about them.
349 *
350 * This event may be useful for several possible use cases:
351 * - mere logging of the event
352 * - dynamic TLB/PTE loading
353 * - if restarting of the faulting device is required
354 *
355 * Returns 0 on success and an appropriate error code otherwise (if dynamic
356 * PTE/TLB loading will one day be supported, implementations will be able
357 * to tell whether it succeeded or not according to this return value).
358 *
359 * Specifically, -ENOSYS is returned if a fault handler isn't installed
360 * (though fault handlers can also return -ENOSYS, in case they want to
361 * elicit the default behavior of the IOMMU drivers).
362 */
363static inline int report_iommu_fault(struct iommu_domain *domain,
364 struct device *dev, unsigned long iova, int flags)
365{
366 int ret = -ENOSYS;
367
368 /*
369 * if upper layers showed interest and installed a fault handler,
370 * invoke it.
371 */
372 if (domain->handler)
373 ret = domain->handler(domain, dev, iova, flags,
374 domain->handler_token);
375 342
376 trace_io_page_fault(dev, iova, flags); 343extern int report_iommu_fault(struct iommu_domain *domain, struct device *dev,
377 return ret; 344 unsigned long iova, int flags);
378}
379 345
380static inline size_t iommu_map_sg(struct iommu_domain *domain, 346static inline size_t iommu_map_sg(struct iommu_domain *domain,
381 unsigned long iova, struct scatterlist *sg, 347 unsigned long iova, struct scatterlist *sg,
diff --git a/include/linux/iova.h b/include/linux/iova.h
index f27bb2c62fca..e0a892ae45c0 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -82,6 +82,7 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova)
82 return iova >> iova_shift(iovad); 82 return iova >> iova_shift(iovad);
83} 83}
84 84
85#if IS_ENABLED(CONFIG_IOMMU_IOVA)
85int iova_cache_get(void); 86int iova_cache_get(void);
86void iova_cache_put(void); 87void iova_cache_put(void);
87 88
@@ -106,5 +107,95 @@ void put_iova_domain(struct iova_domain *iovad);
106struct iova *split_and_remove_iova(struct iova_domain *iovad, 107struct iova *split_and_remove_iova(struct iova_domain *iovad,
107 struct iova *iova, unsigned long pfn_lo, unsigned long pfn_hi); 108 struct iova *iova, unsigned long pfn_lo, unsigned long pfn_hi);
108void free_cpu_cached_iovas(unsigned int cpu, struct iova_domain *iovad); 109void free_cpu_cached_iovas(unsigned int cpu, struct iova_domain *iovad);
110#else
111static inline int iova_cache_get(void)
112{
113 return -ENOTSUPP;
114}
115
116static inline void iova_cache_put(void)
117{
118}
119
120static inline struct iova *alloc_iova_mem(void)
121{
122 return NULL;
123}
124
125static inline void free_iova_mem(struct iova *iova)
126{
127}
128
129static inline void free_iova(struct iova_domain *iovad, unsigned long pfn)
130{
131}
132
133static inline void __free_iova(struct iova_domain *iovad, struct iova *iova)
134{
135}
136
137static inline struct iova *alloc_iova(struct iova_domain *iovad,
138 unsigned long size,
139 unsigned long limit_pfn,
140 bool size_aligned)
141{
142 return NULL;
143}
144
145static inline void free_iova_fast(struct iova_domain *iovad,
146 unsigned long pfn,
147 unsigned long size)
148{
149}
150
151static inline unsigned long alloc_iova_fast(struct iova_domain *iovad,
152 unsigned long size,
153 unsigned long limit_pfn)
154{
155 return 0;
156}
157
158static inline struct iova *reserve_iova(struct iova_domain *iovad,
159 unsigned long pfn_lo,
160 unsigned long pfn_hi)
161{
162 return NULL;
163}
164
165static inline void copy_reserved_iova(struct iova_domain *from,
166 struct iova_domain *to)
167{
168}
169
170static inline void init_iova_domain(struct iova_domain *iovad,
171 unsigned long granule,
172 unsigned long start_pfn,
173 unsigned long pfn_32bit)
174{
175}
176
177static inline struct iova *find_iova(struct iova_domain *iovad,
178 unsigned long pfn)
179{
180 return NULL;
181}
182
183static inline void put_iova_domain(struct iova_domain *iovad)
184{
185}
186
187static inline struct iova *split_and_remove_iova(struct iova_domain *iovad,
188 struct iova *iova,
189 unsigned long pfn_lo,
190 unsigned long pfn_hi)
191{
192 return NULL;
193}
194
195static inline void free_cpu_cached_iovas(unsigned int cpu,
196 struct iova_domain *iovad)
197{
198}
199#endif
109 200
110#endif 201#endif
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 9d84942ae2e5..71fd92d81b26 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -8,8 +8,7 @@
8#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ 8#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
9 9
10/* used by in-kernel data structures */ 10/* used by in-kernel data structures */
11struct kern_ipc_perm 11struct kern_ipc_perm {
12{
13 spinlock_t lock; 12 spinlock_t lock;
14 bool deleted; 13 bool deleted;
15 int id; 14 int id;
@@ -18,9 +17,9 @@ struct kern_ipc_perm
18 kgid_t gid; 17 kgid_t gid;
19 kuid_t cuid; 18 kuid_t cuid;
20 kgid_t cgid; 19 kgid_t cgid;
21 umode_t mode; 20 umode_t mode;
22 unsigned long seq; 21 unsigned long seq;
23 void *security; 22 void *security;
24}; 23} ____cacheline_aligned_in_smp;
25 24
26#endif /* _LINUX_IPC_H */ 25#endif /* _LINUX_IPC_H */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 71be5b330d21..e1b442996f81 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -37,6 +37,7 @@ struct ipv6_devconf {
37 __s32 accept_ra_rtr_pref; 37 __s32 accept_ra_rtr_pref;
38 __s32 rtr_probe_interval; 38 __s32 rtr_probe_interval;
39#ifdef CONFIG_IPV6_ROUTE_INFO 39#ifdef CONFIG_IPV6_ROUTE_INFO
40 __s32 accept_ra_rt_info_min_plen;
40 __s32 accept_ra_rt_info_max_plen; 41 __s32 accept_ra_rt_info_max_plen;
41#endif 42#endif
42#endif 43#endif
@@ -70,6 +71,7 @@ struct ipv6_devconf {
70#endif 71#endif
71 __u32 enhanced_dad; 72 __u32 enhanced_dad;
72 __u32 addr_gen_mode; 73 __u32 addr_gen_mode;
74 __s32 disable_policy;
73 75
74 struct ctl_table_header *sysctl_header; 76 struct ctl_table_header *sysctl_header;
75}; 77};
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
index 97cbca19430d..fffb91202bc9 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -132,6 +132,9 @@
132#define GIC_BASER_SHAREABILITY(reg, type) \ 132#define GIC_BASER_SHAREABILITY(reg, type) \
133 (GIC_BASER_##type << reg##_SHAREABILITY_SHIFT) 133 (GIC_BASER_##type << reg##_SHAREABILITY_SHIFT)
134 134
135/* encode a size field of width @w containing @n - 1 units */
136#define GIC_ENCODE_SZ(n, w) (((unsigned long)(n) - 1) & GENMASK_ULL(((w) - 1), 0))
137
135#define GICR_PROPBASER_SHAREABILITY_SHIFT (10) 138#define GICR_PROPBASER_SHAREABILITY_SHIFT (10)
136#define GICR_PROPBASER_INNER_CACHEABILITY_SHIFT (7) 139#define GICR_PROPBASER_INNER_CACHEABILITY_SHIFT (7)
137#define GICR_PROPBASER_OUTER_CACHEABILITY_SHIFT (56) 140#define GICR_PROPBASER_OUTER_CACHEABILITY_SHIFT (56)
@@ -156,6 +159,8 @@
156#define GICR_PROPBASER_RaWaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWb) 159#define GICR_PROPBASER_RaWaWb GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWb)
157 160
158#define GICR_PROPBASER_IDBITS_MASK (0x1f) 161#define GICR_PROPBASER_IDBITS_MASK (0x1f)
162#define GICR_PROPBASER_ADDRESS(x) ((x) & GENMASK_ULL(51, 12))
163#define GICR_PENDBASER_ADDRESS(x) ((x) & GENMASK_ULL(51, 16))
159 164
160#define GICR_PENDBASER_SHAREABILITY_SHIFT (10) 165#define GICR_PENDBASER_SHAREABILITY_SHIFT (10)
161#define GICR_PENDBASER_INNER_CACHEABILITY_SHIFT (7) 166#define GICR_PENDBASER_INNER_CACHEABILITY_SHIFT (7)
@@ -232,12 +237,18 @@
232#define GITS_CTLR_QUIESCENT (1U << 31) 237#define GITS_CTLR_QUIESCENT (1U << 31)
233 238
234#define GITS_TYPER_PLPIS (1UL << 0) 239#define GITS_TYPER_PLPIS (1UL << 0)
240#define GITS_TYPER_ITT_ENTRY_SIZE_SHIFT 4
235#define GITS_TYPER_IDBITS_SHIFT 8 241#define GITS_TYPER_IDBITS_SHIFT 8
236#define GITS_TYPER_DEVBITS_SHIFT 13 242#define GITS_TYPER_DEVBITS_SHIFT 13
237#define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1) 243#define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1)
238#define GITS_TYPER_PTA (1UL << 19) 244#define GITS_TYPER_PTA (1UL << 19)
239#define GITS_TYPER_HWCOLLCNT_SHIFT 24 245#define GITS_TYPER_HWCOLLCNT_SHIFT 24
240 246
247#define GITS_IIDR_REV_SHIFT 12
248#define GITS_IIDR_REV_MASK (0xf << GITS_IIDR_REV_SHIFT)
249#define GITS_IIDR_REV(r) (((r) >> GITS_IIDR_REV_SHIFT) & 0xf)
250#define GITS_IIDR_PRODUCTID_SHIFT 24
251
241#define GITS_CBASER_VALID (1ULL << 63) 252#define GITS_CBASER_VALID (1ULL << 63)
242#define GITS_CBASER_SHAREABILITY_SHIFT (10) 253#define GITS_CBASER_SHAREABILITY_SHIFT (10)
243#define GITS_CBASER_INNER_CACHEABILITY_SHIFT (59) 254#define GITS_CBASER_INNER_CACHEABILITY_SHIFT (59)
@@ -290,6 +301,7 @@
290#define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7) 301#define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7)
291#define GITS_BASER_ENTRY_SIZE_SHIFT (48) 302#define GITS_BASER_ENTRY_SIZE_SHIFT (48)
292#define GITS_BASER_ENTRY_SIZE(r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1) 303#define GITS_BASER_ENTRY_SIZE(r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1)
304#define GITS_BASER_ENTRY_SIZE_MASK GENMASK_ULL(52, 48)
293#define GITS_BASER_SHAREABILITY_SHIFT (10) 305#define GITS_BASER_SHAREABILITY_SHIFT (10)
294#define GITS_BASER_InnerShareable \ 306#define GITS_BASER_InnerShareable \
295 GIC_BASER_SHAREABILITY(GITS_BASER, InnerShareable) 307 GIC_BASER_SHAREABILITY(GITS_BASER, InnerShareable)
@@ -337,9 +349,11 @@
337#define E_ITS_INT_UNMAPPED_INTERRUPT 0x010307 349#define E_ITS_INT_UNMAPPED_INTERRUPT 0x010307
338#define E_ITS_CLEAR_UNMAPPED_INTERRUPT 0x010507 350#define E_ITS_CLEAR_UNMAPPED_INTERRUPT 0x010507
339#define E_ITS_MAPD_DEVICE_OOR 0x010801 351#define E_ITS_MAPD_DEVICE_OOR 0x010801
352#define E_ITS_MAPD_ITTSIZE_OOR 0x010802
340#define E_ITS_MAPC_PROCNUM_OOR 0x010902 353#define E_ITS_MAPC_PROCNUM_OOR 0x010902
341#define E_ITS_MAPC_COLLECTION_OOR 0x010903 354#define E_ITS_MAPC_COLLECTION_OOR 0x010903
342#define E_ITS_MAPTI_UNMAPPED_DEVICE 0x010a04 355#define E_ITS_MAPTI_UNMAPPED_DEVICE 0x010a04
356#define E_ITS_MAPTI_ID_OOR 0x010a05
343#define E_ITS_MAPTI_PHYSICALID_OOR 0x010a06 357#define E_ITS_MAPTI_PHYSICALID_OOR 0x010a06
344#define E_ITS_INV_UNMAPPED_INTERRUPT 0x010c07 358#define E_ITS_INV_UNMAPPED_INTERRUPT 0x010c07
345#define E_ITS_INVALL_UNMAPPED_COLLECTION 0x010d09 359#define E_ITS_INVALL_UNMAPPED_COLLECTION 0x010d09
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index eafc965b3eb8..dc30f3d057eb 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -96,6 +96,9 @@
96#define GICH_MISR_EOI (1 << 0) 96#define GICH_MISR_EOI (1 << 0)
97#define GICH_MISR_U (1 << 1) 97#define GICH_MISR_U (1 << 1)
98 98
99#define GICV_PMR_PRIORITY_SHIFT 3
100#define GICV_PMR_PRIORITY_MASK (0x1f << GICV_PMR_PRIORITY_SHIFT)
101
99#ifndef __ASSEMBLY__ 102#ifndef __ASSEMBLY__
100 103
101#include <linux/irqdomain.h> 104#include <linux/irqdomain.h>
diff --git a/include/linux/irqchip/mips-gic.h b/include/linux/irqchip/mips-gic.h
index 7b49c71c968b..2b0e56619e53 100644
--- a/include/linux/irqchip/mips-gic.h
+++ b/include/linux/irqchip/mips-gic.h
@@ -258,7 +258,6 @@ extern unsigned int gic_present;
258extern void gic_init(unsigned long gic_base_addr, 258extern void gic_init(unsigned long gic_base_addr,
259 unsigned long gic_addrspace_size, unsigned int cpu_vec, 259 unsigned long gic_addrspace_size, unsigned int cpu_vec,
260 unsigned int irqbase); 260 unsigned int irqbase);
261extern void gic_clocksource_init(unsigned int);
262extern u64 gic_read_count(void); 261extern u64 gic_read_count(void);
263extern unsigned int gic_get_count_width(void); 262extern unsigned int gic_get_count_width(void);
264extern u64 gic_read_compare(void); 263extern u64 gic_read_compare(void);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index dfaa1f4dcb0c..606b6bce3a5b 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -491,6 +491,8 @@ struct jbd2_journal_handle
491 491
492 unsigned long h_start_jiffies; 492 unsigned long h_start_jiffies;
493 unsigned int h_requested_credits; 493 unsigned int h_requested_credits;
494
495 unsigned int saved_alloc_context;
494}; 496};
495 497
496 498
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 624215cebee5..36872fbb815d 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_JIFFIES_H 1#ifndef _LINUX_JIFFIES_H
2#define _LINUX_JIFFIES_H 2#define _LINUX_JIFFIES_H
3 3
4#include <linux/cache.h>
4#include <linux/math64.h> 5#include <linux/math64.h>
5#include <linux/kernel.h> 6#include <linux/kernel.h>
6#include <linux/types.h> 7#include <linux/types.h>
@@ -63,19 +64,13 @@ extern int register_refined_jiffies(long clock_tick_rate);
63/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ 64/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
64#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) 65#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
65 66
66/* some arch's have a small-data section that can be accessed register-relative
67 * but that can only take up to, say, 4-byte variables. jiffies being part of
68 * an 8-byte variable may not be correctly accessed unless we force the issue
69 */
70#define __jiffy_data __attribute__((section(".data")))
71
72/* 67/*
73 * The 64-bit value is not atomic - you MUST NOT read it 68 * The 64-bit value is not atomic - you MUST NOT read it
74 * without sampling the sequence number in jiffies_lock. 69 * without sampling the sequence number in jiffies_lock.
75 * get_jiffies_64() will do this for you as appropriate. 70 * get_jiffies_64() will do this for you as appropriate.
76 */ 71 */
77extern u64 __jiffy_data jiffies_64; 72extern u64 __cacheline_aligned_in_smp jiffies_64;
78extern unsigned long volatile __jiffy_data jiffies; 73extern unsigned long volatile __cacheline_aligned_in_smp jiffies;
79 74
80#if (BITS_PER_LONG < 64) 75#if (BITS_PER_LONG < 64)
81u64 get_jiffies_64(void); 76u64 get_jiffies_64(void);
diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h
index 22a72198c14b..4e80f3a9ad58 100644
--- a/include/linux/kbuild.h
+++ b/include/linux/kbuild.h
@@ -2,14 +2,14 @@
2#define __LINUX_KBUILD_H 2#define __LINUX_KBUILD_H
3 3
4#define DEFINE(sym, val) \ 4#define DEFINE(sym, val) \
5 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 5 asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val))
6 6
7#define BLANK() asm volatile("\n->" : : ) 7#define BLANK() asm volatile("\n.ascii \"->\"" : : )
8 8
9#define OFFSET(sym, str, mem) \ 9#define OFFSET(sym, str, mem) \
10 DEFINE(sym, offsetof(struct str, mem)) 10 DEFINE(sym, offsetof(struct str, mem))
11 11
12#define COMMENT(x) \ 12#define COMMENT(x) \
13 asm volatile("\n->#" x) 13 asm volatile("\n.ascii \"->#" x "\"")
14 14
15#endif 15#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4c26dc3a8295..13bc08aba704 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -47,6 +47,7 @@
47 47
48/* @a is a power of 2 value */ 48/* @a is a power of 2 value */
49#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) 49#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
50#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
50#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) 51#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
51#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) 52#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
52#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) 53#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
@@ -438,6 +439,7 @@ extern int get_option(char **str, int *pint);
438extern char *get_options(const char *str, int nints, int *ints); 439extern char *get_options(const char *str, int nints, int *ints);
439extern unsigned long long memparse(const char *ptr, char **retptr); 440extern unsigned long long memparse(const char *ptr, char **retptr);
440extern bool parse_option_str(const char *str, const char *option); 441extern bool parse_option_str(const char *str, const char *option);
442extern char *next_arg(char *args, char **param, char **val);
441 443
442extern int core_kernel_text(unsigned long addr); 444extern int core_kernel_text(unsigned long addr);
443extern int core_kernel_data(unsigned long addr); 445extern int core_kernel_data(unsigned long addr);
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index d419d0e51fe5..c9481ebcbc0c 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -14,17 +14,15 @@
14 14
15#if !defined(__ASSEMBLY__) 15#if !defined(__ASSEMBLY__)
16 16
17#include <linux/crash_core.h>
17#include <asm/io.h> 18#include <asm/io.h>
18 19
19#include <uapi/linux/kexec.h> 20#include <uapi/linux/kexec.h>
20 21
21#ifdef CONFIG_KEXEC_CORE 22#ifdef CONFIG_KEXEC_CORE
22#include <linux/list.h> 23#include <linux/list.h>
23#include <linux/linkage.h>
24#include <linux/compat.h> 24#include <linux/compat.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/elfcore.h>
27#include <linux/elf.h>
28#include <linux/module.h> 26#include <linux/module.h>
29#include <asm/kexec.h> 27#include <asm/kexec.h>
30 28
@@ -62,19 +60,15 @@
62#define KEXEC_CRASH_MEM_ALIGN PAGE_SIZE 60#define KEXEC_CRASH_MEM_ALIGN PAGE_SIZE
63#endif 61#endif
64 62
65#define KEXEC_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4) 63#define KEXEC_CORE_NOTE_NAME CRASH_CORE_NOTE_NAME
66#define KEXEC_CORE_NOTE_NAME "CORE" 64
67#define KEXEC_CORE_NOTE_NAME_BYTES ALIGN(sizeof(KEXEC_CORE_NOTE_NAME), 4)
68#define KEXEC_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
69/* 65/*
70 * The per-cpu notes area is a list of notes terminated by a "NULL" 66 * The per-cpu notes area is a list of notes terminated by a "NULL"
71 * note header. For kdump, the code in vmcore.c runs in the context 67 * note header. For kdump, the code in vmcore.c runs in the context
72 * of the second kernel to combine them into one note. 68 * of the second kernel to combine them into one note.
73 */ 69 */
74#ifndef KEXEC_NOTE_BYTES 70#ifndef KEXEC_NOTE_BYTES
75#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \ 71#define KEXEC_NOTE_BYTES CRASH_CORE_NOTE_BYTES
76 KEXEC_CORE_NOTE_NAME_BYTES + \
77 KEXEC_CORE_NOTE_DESC_BYTES )
78#endif 72#endif
79 73
80/* 74/*
@@ -256,33 +250,6 @@ extern void crash_kexec(struct pt_regs *);
256int kexec_should_crash(struct task_struct *); 250int kexec_should_crash(struct task_struct *);
257int kexec_crash_loaded(void); 251int kexec_crash_loaded(void);
258void crash_save_cpu(struct pt_regs *regs, int cpu); 252void crash_save_cpu(struct pt_regs *regs, int cpu);
259void crash_save_vmcoreinfo(void);
260void arch_crash_save_vmcoreinfo(void);
261__printf(1, 2)
262void vmcoreinfo_append_str(const char *fmt, ...);
263phys_addr_t paddr_vmcoreinfo_note(void);
264
265#define VMCOREINFO_OSRELEASE(value) \
266 vmcoreinfo_append_str("OSRELEASE=%s\n", value)
267#define VMCOREINFO_PAGESIZE(value) \
268 vmcoreinfo_append_str("PAGESIZE=%ld\n", value)
269#define VMCOREINFO_SYMBOL(name) \
270 vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
271#define VMCOREINFO_SIZE(name) \
272 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
273 (unsigned long)sizeof(name))
274#define VMCOREINFO_STRUCT_SIZE(name) \
275 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
276 (unsigned long)sizeof(struct name))
277#define VMCOREINFO_OFFSET(name, field) \
278 vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
279 (unsigned long)offsetof(struct name, field))
280#define VMCOREINFO_LENGTH(name, value) \
281 vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
282#define VMCOREINFO_NUMBER(name) \
283 vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
284#define VMCOREINFO_CONFIG(name) \
285 vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
286 253
287extern struct kimage *kexec_image; 254extern struct kimage *kexec_image;
288extern struct kimage *kexec_crash_image; 255extern struct kimage *kexec_crash_image;
@@ -303,31 +270,15 @@ extern int kexec_load_disabled;
303#define KEXEC_FILE_FLAGS (KEXEC_FILE_UNLOAD | KEXEC_FILE_ON_CRASH | \ 270#define KEXEC_FILE_FLAGS (KEXEC_FILE_UNLOAD | KEXEC_FILE_ON_CRASH | \
304 KEXEC_FILE_NO_INITRAMFS) 271 KEXEC_FILE_NO_INITRAMFS)
305 272
306#define VMCOREINFO_BYTES (4096)
307#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
308#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
309#define VMCOREINFO_NOTE_SIZE (KEXEC_NOTE_HEAD_BYTES*2 + VMCOREINFO_BYTES \
310 + VMCOREINFO_NOTE_NAME_BYTES)
311
312/* Location of a reserved region to hold the crash kernel. 273/* Location of a reserved region to hold the crash kernel.
313 */ 274 */
314extern struct resource crashk_res; 275extern struct resource crashk_res;
315extern struct resource crashk_low_res; 276extern struct resource crashk_low_res;
316typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
317extern note_buf_t __percpu *crash_notes; 277extern note_buf_t __percpu *crash_notes;
318extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
319extern size_t vmcoreinfo_size;
320extern size_t vmcoreinfo_max_size;
321 278
322/* flag to track if kexec reboot is in progress */ 279/* flag to track if kexec reboot is in progress */
323extern bool kexec_in_progress; 280extern bool kexec_in_progress;
324 281
325int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
326 unsigned long long *crash_size, unsigned long long *crash_base);
327int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
328 unsigned long long *crash_size, unsigned long long *crash_base);
329int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
330 unsigned long long *crash_size, unsigned long long *crash_base);
331int crash_shrink_memory(unsigned long new_size); 282int crash_shrink_memory(unsigned long new_size);
332size_t crash_get_memory_size(void); 283size_t crash_get_memory_size(void);
333void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); 284void crash_free_reserved_phys_range(unsigned long begin, unsigned long end);
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index eaee981c5558..8496cf64575c 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -147,6 +147,14 @@ struct key_type {
147 */ 147 */
148 request_key_actor_t request_key; 148 request_key_actor_t request_key;
149 149
150 /* Look up a keyring access restriction (optional)
151 *
152 * - NULL is a valid return value (meaning the requested restriction
153 * is known but will never block addition of a key)
154 * - should return -EINVAL if the restriction is unknown
155 */
156 struct key_restriction *(*lookup_restriction)(const char *params);
157
150 /* internal fields */ 158 /* internal fields */
151 struct list_head link; /* link in types list */ 159 struct list_head link; /* link in types list */
152 struct lock_class_key lock_class; /* key->sem lock class */ 160 struct lock_class_key lock_class; /* key->sem lock class */
diff --git a/include/linux/key.h b/include/linux/key.h
index e45212f2777e..0c9b93b0d1f7 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -23,6 +23,7 @@
23#include <linux/rwsem.h> 23#include <linux/rwsem.h>
24#include <linux/atomic.h> 24#include <linux/atomic.h>
25#include <linux/assoc_array.h> 25#include <linux/assoc_array.h>
26#include <linux/refcount.h>
26 27
27#ifdef __KERNEL__ 28#ifdef __KERNEL__
28#include <linux/uidgid.h> 29#include <linux/uidgid.h>
@@ -126,6 +127,17 @@ static inline bool is_key_possessed(const key_ref_t key_ref)
126 return (unsigned long) key_ref & 1UL; 127 return (unsigned long) key_ref & 1UL;
127} 128}
128 129
130typedef int (*key_restrict_link_func_t)(struct key *dest_keyring,
131 const struct key_type *type,
132 const union key_payload *payload,
133 struct key *restriction_key);
134
135struct key_restriction {
136 key_restrict_link_func_t check;
137 struct key *key;
138 struct key_type *keytype;
139};
140
129/*****************************************************************************/ 141/*****************************************************************************/
130/* 142/*
131 * authentication token / access credential / keyring 143 * authentication token / access credential / keyring
@@ -135,7 +147,7 @@ static inline bool is_key_possessed(const key_ref_t key_ref)
135 * - Kerberos TGTs and tickets 147 * - Kerberos TGTs and tickets
136 */ 148 */
137struct key { 149struct key {
138 atomic_t usage; /* number of references */ 150 refcount_t usage; /* number of references */
139 key_serial_t serial; /* key serial number */ 151 key_serial_t serial; /* key serial number */
140 union { 152 union {
141 struct list_head graveyard_link; 153 struct list_head graveyard_link;
@@ -205,18 +217,17 @@ struct key {
205 }; 217 };
206 218
207 /* This is set on a keyring to restrict the addition of a link to a key 219 /* This is set on a keyring to restrict the addition of a link to a key
208 * to it. If this method isn't provided then it is assumed that the 220 * to it. If this structure isn't provided then it is assumed that the
209 * keyring is open to any addition. It is ignored for non-keyring 221 * keyring is open to any addition. It is ignored for non-keyring
210 * keys. 222 * keys. Only set this value using keyring_restrict(), keyring_alloc(),
223 * or key_alloc().
211 * 224 *
212 * This is intended for use with rings of trusted keys whereby addition 225 * This is intended for use with rings of trusted keys whereby addition
213 * to the keyring needs to be controlled. KEY_ALLOC_BYPASS_RESTRICTION 226 * to the keyring needs to be controlled. KEY_ALLOC_BYPASS_RESTRICTION
214 * overrides this, allowing the kernel to add extra keys without 227 * overrides this, allowing the kernel to add extra keys without
215 * restriction. 228 * restriction.
216 */ 229 */
217 int (*restrict_link)(struct key *keyring, 230 struct key_restriction *restrict_link;
218 const struct key_type *type,
219 const union key_payload *payload);
220}; 231};
221 232
222extern struct key *key_alloc(struct key_type *type, 233extern struct key *key_alloc(struct key_type *type,
@@ -225,9 +236,7 @@ extern struct key *key_alloc(struct key_type *type,
225 const struct cred *cred, 236 const struct cred *cred,
226 key_perm_t perm, 237 key_perm_t perm,
227 unsigned long flags, 238 unsigned long flags,
228 int (*restrict_link)(struct key *, 239 struct key_restriction *restrict_link);
229 const struct key_type *,
230 const union key_payload *));
231 240
232 241
233#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */ 242#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */
@@ -242,7 +251,7 @@ extern void key_put(struct key *key);
242 251
243static inline struct key *__key_get(struct key *key) 252static inline struct key *__key_get(struct key *key)
244{ 253{
245 atomic_inc(&key->usage); 254 refcount_inc(&key->usage);
246 return key; 255 return key;
247} 256}
248 257
@@ -303,14 +312,13 @@ extern struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid
303 const struct cred *cred, 312 const struct cred *cred,
304 key_perm_t perm, 313 key_perm_t perm,
305 unsigned long flags, 314 unsigned long flags,
306 int (*restrict_link)(struct key *, 315 struct key_restriction *restrict_link,
307 const struct key_type *,
308 const union key_payload *),
309 struct key *dest); 316 struct key *dest);
310 317
311extern int restrict_link_reject(struct key *keyring, 318extern int restrict_link_reject(struct key *keyring,
312 const struct key_type *type, 319 const struct key_type *type,
313 const union key_payload *payload); 320 const union key_payload *payload,
321 struct key *restriction_key);
314 322
315extern int keyring_clear(struct key *keyring); 323extern int keyring_clear(struct key *keyring);
316 324
@@ -321,6 +329,9 @@ extern key_ref_t keyring_search(key_ref_t keyring,
321extern int keyring_add_key(struct key *keyring, 329extern int keyring_add_key(struct key *keyring,
322 struct key *key); 330 struct key *key);
323 331
332extern int keyring_restrict(key_ref_t keyring, const char *type,
333 const char *restriction);
334
324extern struct key *key_lookup(key_serial_t id); 335extern struct key *key_lookup(key_serial_t id);
325 336
326static inline key_serial_t key_serial(const struct key *key) 337static inline key_serial_t key_serial(const struct key *key)
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index e6284591599e..ca85cb80e99a 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -108,6 +108,8 @@ extern int __must_check kobject_rename(struct kobject *, const char *new_name);
108extern int __must_check kobject_move(struct kobject *, struct kobject *); 108extern int __must_check kobject_move(struct kobject *, struct kobject *);
109 109
110extern struct kobject *kobject_get(struct kobject *kobj); 110extern struct kobject *kobject_get(struct kobject *kobj);
111extern struct kobject * __must_check kobject_get_unless_zero(
112 struct kobject *kobj);
111extern void kobject_put(struct kobject *kobj); 113extern void kobject_put(struct kobject *kobj);
112 114
113extern const void *kobject_namespace(struct kobject *kobj); 115extern const void *kobject_namespace(struct kobject *kobj);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index c328e4f7dcad..541df0b5b815 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -267,6 +267,8 @@ extern int arch_init_kprobes(void);
267extern void show_registers(struct pt_regs *regs); 267extern void show_registers(struct pt_regs *regs);
268extern void kprobes_inc_nmissed_count(struct kprobe *p); 268extern void kprobes_inc_nmissed_count(struct kprobe *p);
269extern bool arch_within_kprobe_blacklist(unsigned long addr); 269extern bool arch_within_kprobe_blacklist(unsigned long addr);
270extern bool arch_function_offset_within_entry(unsigned long offset);
271extern bool function_offset_within_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset);
270 272
271extern bool within_kprobe_blacklist(unsigned long addr); 273extern bool within_kprobe_blacklist(unsigned long addr);
272 274
@@ -347,6 +349,9 @@ extern int proc_kprobes_optimization_handler(struct ctl_table *table,
347 int write, void __user *buffer, 349 int write, void __user *buffer,
348 size_t *length, loff_t *ppos); 350 size_t *length, loff_t *ppos);
349#endif 351#endif
352extern void wait_for_kprobe_optimizer(void);
353#else
354static inline void wait_for_kprobe_optimizer(void) { }
350#endif /* CONFIG_OPTPROBES */ 355#endif /* CONFIG_OPTPROBES */
351#ifdef CONFIG_KPROBES_ON_FTRACE 356#ifdef CONFIG_KPROBES_ON_FTRACE
352extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, 357extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
@@ -379,6 +384,7 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
379 return this_cpu_ptr(&kprobe_ctlblk); 384 return this_cpu_ptr(&kprobe_ctlblk);
380} 385}
381 386
387kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset);
382int register_kprobe(struct kprobe *p); 388int register_kprobe(struct kprobe *p);
383void unregister_kprobe(struct kprobe *p); 389void unregister_kprobe(struct kprobe *p);
384int register_kprobes(struct kprobe **kps, int num); 390int register_kprobes(struct kprobe **kps, int num);
diff --git a/include/linux/kref.h b/include/linux/kref.h
index f4156f88f557..29220724bf1c 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -66,8 +66,6 @@ static inline void kref_get(struct kref *kref)
66 */ 66 */
67static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)) 67static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref))
68{ 68{
69 WARN_ON(release == NULL);
70
71 if (refcount_dec_and_test(&kref->refcount)) { 69 if (refcount_dec_and_test(&kref->refcount)) {
72 release(kref); 70 release(kref);
73 return 1; 71 return 1;
@@ -79,8 +77,6 @@ static inline int kref_put_mutex(struct kref *kref,
79 void (*release)(struct kref *kref), 77 void (*release)(struct kref *kref),
80 struct mutex *lock) 78 struct mutex *lock)
81{ 79{
82 WARN_ON(release == NULL);
83
84 if (refcount_dec_and_mutex_lock(&kref->refcount, lock)) { 80 if (refcount_dec_and_mutex_lock(&kref->refcount, lock)) {
85 release(kref); 81 release(kref);
86 return 1; 82 return 1;
@@ -92,8 +88,6 @@ static inline int kref_put_lock(struct kref *kref,
92 void (*release)(struct kref *kref), 88 void (*release)(struct kref *kref),
93 spinlock_t *lock) 89 spinlock_t *lock)
94{ 90{
95 WARN_ON(release == NULL);
96
97 if (refcount_dec_and_lock(&kref->refcount, lock)) { 91 if (refcount_dec_and_lock(&kref->refcount, lock)) {
98 release(kref); 92 release(kref);
99 return 1; 93 return 1;
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index e1cfda4bee58..78b44a024eaa 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -61,7 +61,7 @@ static inline void set_page_stable_node(struct page *page,
61struct page *ksm_might_need_to_copy(struct page *page, 61struct page *ksm_might_need_to_copy(struct page *page,
62 struct vm_area_struct *vma, unsigned long address); 62 struct vm_area_struct *vma, unsigned long address);
63 63
64int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); 64void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
65void ksm_migrate_page(struct page *newpage, struct page *oldpage); 65void ksm_migrate_page(struct page *newpage, struct page *oldpage);
66 66
67#else /* !CONFIG_KSM */ 67#else /* !CONFIG_KSM */
@@ -94,10 +94,9 @@ static inline int page_referenced_ksm(struct page *page,
94 return 0; 94 return 0;
95} 95}
96 96
97static inline int rmap_walk_ksm(struct page *page, 97static inline void rmap_walk_ksm(struct page *page,
98 struct rmap_walk_control *rwc) 98 struct rmap_walk_control *rwc)
99{ 99{
100 return 0;
101} 100}
102 101
103static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) 102static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index d0250744507a..8c0664309815 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -115,14 +115,17 @@ static inline bool is_error_page(struct page *page)
115 return IS_ERR(page); 115 return IS_ERR(page);
116} 116}
117 117
118#define KVM_REQUEST_MASK GENMASK(7,0)
119#define KVM_REQUEST_NO_WAKEUP BIT(8)
120#define KVM_REQUEST_WAIT BIT(9)
118/* 121/*
119 * Architecture-independent vcpu->requests bit members 122 * Architecture-independent vcpu->requests bit members
120 * Bits 4-7 are reserved for more arch-independent bits. 123 * Bits 4-7 are reserved for more arch-independent bits.
121 */ 124 */
122#define KVM_REQ_TLB_FLUSH 0 125#define KVM_REQ_TLB_FLUSH (0 | KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
123#define KVM_REQ_MMU_RELOAD 1 126#define KVM_REQ_MMU_RELOAD (1 | KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
124#define KVM_REQ_PENDING_TIMER 2 127#define KVM_REQ_PENDING_TIMER 2
125#define KVM_REQ_UNHALT 3 128#define KVM_REQ_UNHALT 3
126 129
127#define KVM_USERSPACE_IRQ_SOURCE_ID 0 130#define KVM_USERSPACE_IRQ_SOURCE_ID 0
128#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 131#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -268,6 +271,12 @@ struct kvm_vcpu {
268 271
269static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu) 272static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
270{ 273{
274 /*
275 * The memory barrier ensures a previous write to vcpu->requests cannot
276 * be reordered with the read of vcpu->mode. It pairs with the general
277 * memory barrier following the write of vcpu->mode in VCPU RUN.
278 */
279 smp_mb__before_atomic();
271 return cmpxchg(&vcpu->mode, IN_GUEST_MODE, EXITING_GUEST_MODE); 280 return cmpxchg(&vcpu->mode, IN_GUEST_MODE, EXITING_GUEST_MODE);
272} 281}
273 282
@@ -375,8 +384,6 @@ struct kvm {
375 struct mutex slots_lock; 384 struct mutex slots_lock;
376 struct mm_struct *mm; /* userspace tied to this vm */ 385 struct mm_struct *mm; /* userspace tied to this vm */
377 struct kvm_memslots *memslots[KVM_ADDRESS_SPACE_NUM]; 386 struct kvm_memslots *memslots[KVM_ADDRESS_SPACE_NUM];
378 struct srcu_struct srcu;
379 struct srcu_struct irq_srcu;
380 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 387 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
381 388
382 /* 389 /*
@@ -403,7 +410,7 @@ struct kvm {
403 struct kvm_vm_stat stat; 410 struct kvm_vm_stat stat;
404 struct kvm_arch arch; 411 struct kvm_arch arch;
405 refcount_t users_count; 412 refcount_t users_count;
406#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET 413#ifdef CONFIG_KVM_MMIO
407 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; 414 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
408 spinlock_t ring_lock; 415 spinlock_t ring_lock;
409 struct list_head coalesced_zones; 416 struct list_head coalesced_zones;
@@ -429,6 +436,8 @@ struct kvm {
429 struct list_head devices; 436 struct list_head devices;
430 struct dentry *debugfs_dentry; 437 struct dentry *debugfs_dentry;
431 struct kvm_stat_data **debugfs_stat_data; 438 struct kvm_stat_data **debugfs_stat_data;
439 struct srcu_struct srcu;
440 struct srcu_struct irq_srcu;
432}; 441};
433 442
434#define kvm_err(fmt, ...) \ 443#define kvm_err(fmt, ...) \
@@ -490,6 +499,17 @@ static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id)
490 return NULL; 499 return NULL;
491} 500}
492 501
502static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu)
503{
504 struct kvm_vcpu *tmp;
505 int idx;
506
507 kvm_for_each_vcpu(idx, tmp, vcpu->kvm)
508 if (tmp == vcpu)
509 return idx;
510 BUG();
511}
512
493#define kvm_for_each_memslot(memslot, slots) \ 513#define kvm_for_each_memslot(memslot, slots) \
494 for (memslot = &slots->memslots[0]; \ 514 for (memslot = &slots->memslots[0]; \
495 memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\ 515 memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\
@@ -502,10 +522,10 @@ int __must_check vcpu_load(struct kvm_vcpu *vcpu);
502void vcpu_put(struct kvm_vcpu *vcpu); 522void vcpu_put(struct kvm_vcpu *vcpu);
503 523
504#ifdef __KVM_HAVE_IOAPIC 524#ifdef __KVM_HAVE_IOAPIC
505void kvm_vcpu_request_scan_ioapic(struct kvm *kvm); 525void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm);
506void kvm_arch_post_irq_routing_update(struct kvm *kvm); 526void kvm_arch_post_irq_routing_update(struct kvm *kvm);
507#else 527#else
508static inline void kvm_vcpu_request_scan_ioapic(struct kvm *kvm) 528static inline void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm)
509{ 529{
510} 530}
511static inline void kvm_arch_post_irq_routing_update(struct kvm *kvm) 531static inline void kvm_arch_post_irq_routing_update(struct kvm *kvm)
@@ -641,18 +661,18 @@ int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
641int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data, 661int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
642 unsigned long len); 662 unsigned long len);
643int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len); 663int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len);
644int kvm_vcpu_read_guest_cached(struct kvm_vcpu *vcpu, struct gfn_to_hva_cache *ghc, 664int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
645 void *data, unsigned long len); 665 void *data, unsigned long len);
646int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data, 666int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
647 int offset, int len); 667 int offset, int len);
648int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, 668int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
649 unsigned long len); 669 unsigned long len);
650int kvm_vcpu_write_guest_cached(struct kvm_vcpu *v, struct gfn_to_hva_cache *ghc, 670int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
651 void *data, unsigned long len); 671 void *data, unsigned long len);
652int kvm_vcpu_write_guest_offset_cached(struct kvm_vcpu *v, struct gfn_to_hva_cache *ghc, 672int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
653 void *data, int offset, unsigned long len); 673 void *data, int offset, unsigned long len);
654int kvm_vcpu_gfn_to_hva_cache_init(struct kvm_vcpu *v, struct gfn_to_hva_cache *ghc, 674int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
655 gpa_t gpa, unsigned long len); 675 gpa_t gpa, unsigned long len);
656int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); 676int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
657int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); 677int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
658struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); 678struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
@@ -682,7 +702,7 @@ void kvm_vcpu_mark_page_dirty(struct kvm_vcpu *vcpu, gfn_t gfn);
682void kvm_vcpu_block(struct kvm_vcpu *vcpu); 702void kvm_vcpu_block(struct kvm_vcpu *vcpu);
683void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu); 703void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu);
684void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu); 704void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu);
685void kvm_vcpu_wake_up(struct kvm_vcpu *vcpu); 705bool kvm_vcpu_wake_up(struct kvm_vcpu *vcpu);
686void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 706void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
687int kvm_vcpu_yield_to(struct kvm_vcpu *target); 707int kvm_vcpu_yield_to(struct kvm_vcpu *target);
688void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); 708void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu);
@@ -767,8 +787,6 @@ void kvm_arch_check_processor_compat(void *rtn);
767int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); 787int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
768int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); 788int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
769 789
770void *kvm_kvzalloc(unsigned long size);
771
772#ifndef __KVM_HAVE_ARCH_VM_ALLOC 790#ifndef __KVM_HAVE_ARCH_VM_ALLOC
773static inline struct kvm *kvm_arch_alloc_vm(void) 791static inline struct kvm *kvm_arch_alloc_vm(void)
774{ 792{
@@ -877,22 +895,6 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
877int kvm_request_irq_source_id(struct kvm *kvm); 895int kvm_request_irq_source_id(struct kvm *kvm);
878void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); 896void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
879 897
880#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
881int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
882void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
883#else
884static inline int kvm_iommu_map_pages(struct kvm *kvm,
885 struct kvm_memory_slot *slot)
886{
887 return 0;
888}
889
890static inline void kvm_iommu_unmap_pages(struct kvm *kvm,
891 struct kvm_memory_slot *slot)
892{
893}
894#endif
895
896/* 898/*
897 * search_memslots() and __gfn_to_memslot() are here because they are 899 * search_memslots() and __gfn_to_memslot() are here because they are
898 * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c. 900 * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c.
@@ -1025,6 +1027,7 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
1025#define KVM_MAX_IRQ_ROUTES 1024 1027#define KVM_MAX_IRQ_ROUTES 1024
1026#endif 1028#endif
1027 1029
1030bool kvm_arch_can_set_irq_routing(struct kvm *kvm);
1028int kvm_set_irq_routing(struct kvm *kvm, 1031int kvm_set_irq_routing(struct kvm *kvm,
1029 const struct kvm_irq_routing_entry *entries, 1032 const struct kvm_irq_routing_entry *entries,
1030 unsigned nr, 1033 unsigned nr,
@@ -1092,13 +1095,23 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
1092 * caller. Paired with the smp_mb__after_atomic in kvm_check_request. 1095 * caller. Paired with the smp_mb__after_atomic in kvm_check_request.
1093 */ 1096 */
1094 smp_wmb(); 1097 smp_wmb();
1095 set_bit(req, &vcpu->requests); 1098 set_bit(req & KVM_REQUEST_MASK, &vcpu->requests);
1099}
1100
1101static inline bool kvm_test_request(int req, struct kvm_vcpu *vcpu)
1102{
1103 return test_bit(req & KVM_REQUEST_MASK, &vcpu->requests);
1104}
1105
1106static inline void kvm_clear_request(int req, struct kvm_vcpu *vcpu)
1107{
1108 clear_bit(req & KVM_REQUEST_MASK, &vcpu->requests);
1096} 1109}
1097 1110
1098static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) 1111static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
1099{ 1112{
1100 if (test_bit(req, &vcpu->requests)) { 1113 if (kvm_test_request(req, vcpu)) {
1101 clear_bit(req, &vcpu->requests); 1114 kvm_clear_request(req, vcpu);
1102 1115
1103 /* 1116 /*
1104 * Ensure the rest of the request is visible to kvm_check_request's 1117 * Ensure the rest of the request is visible to kvm_check_request's
@@ -1165,7 +1178,6 @@ int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type);
1165void kvm_unregister_device_ops(u32 type); 1178void kvm_unregister_device_ops(u32 type);
1166 1179
1167extern struct kvm_device_ops kvm_mpic_ops; 1180extern struct kvm_device_ops kvm_mpic_ops;
1168extern struct kvm_device_ops kvm_xics_ops;
1169extern struct kvm_device_ops kvm_arm_vgic_v2_ops; 1181extern struct kvm_device_ops kvm_arm_vgic_v2_ops;
1170extern struct kvm_device_ops kvm_arm_vgic_v3_ops; 1182extern struct kvm_device_ops kvm_arm_vgic_v3_ops;
1171 1183
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h
index d215b4561180..5e240b2b4d58 100644
--- a/include/linux/leds-pca9532.h
+++ b/include/linux/leds-pca9532.h
@@ -22,7 +22,8 @@ enum pca9532_state {
22 PCA9532_OFF = 0x0, 22 PCA9532_OFF = 0x0,
23 PCA9532_ON = 0x1, 23 PCA9532_ON = 0x1,
24 PCA9532_PWM0 = 0x2, 24 PCA9532_PWM0 = 0x2,
25 PCA9532_PWM1 = 0x3 25 PCA9532_PWM1 = 0x3,
26 PCA9532_KEEP = 0xff,
26}; 27};
27 28
28struct pca9532_led { 29struct pca9532_led {
@@ -44,4 +45,3 @@ struct pca9532_platform_data {
44}; 45};
45 46
46#endif /* __LINUX_PCA9532_H */ 47#endif /* __LINUX_PCA9532_H */
47
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 38c0bd7ca107..64c56d454f7d 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -122,10 +122,16 @@ struct led_classdev {
122 struct mutex led_access; 122 struct mutex led_access;
123}; 123};
124 124
125extern int led_classdev_register(struct device *parent, 125extern int of_led_classdev_register(struct device *parent,
126 struct led_classdev *led_cdev); 126 struct device_node *np,
127extern int devm_led_classdev_register(struct device *parent, 127 struct led_classdev *led_cdev);
128 struct led_classdev *led_cdev); 128#define led_classdev_register(parent, led_cdev) \
129 of_led_classdev_register(parent, NULL, led_cdev)
130extern int devm_of_led_classdev_register(struct device *parent,
131 struct device_node *np,
132 struct led_classdev *led_cdev);
133#define devm_led_classdev_register(parent, led_cdev) \
134 devm_of_led_classdev_register(parent, NULL, led_cdev)
129extern void led_classdev_unregister(struct led_classdev *led_cdev); 135extern void led_classdev_unregister(struct led_classdev *led_cdev);
130extern void devm_led_classdev_unregister(struct device *parent, 136extern void devm_led_classdev_unregister(struct device *parent,
131 struct led_classdev *led_cdev); 137 struct led_classdev *led_cdev);
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index 77e7af32543f..6c807017128d 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -20,9 +20,11 @@
20 20
21enum { 21enum {
22 /* when a dimm supports both PMEM and BLK access a label is required */ 22 /* when a dimm supports both PMEM and BLK access a label is required */
23 NDD_ALIASING = 1 << 0, 23 NDD_ALIASING = 0,
24 /* unarmed memory devices may not persist writes */ 24 /* unarmed memory devices may not persist writes */
25 NDD_UNARMED = 1 << 1, 25 NDD_UNARMED = 1,
26 /* locked memory devices should not be accessed */
27 NDD_LOCKED = 2,
26 28
27 /* need to set a limit somewhere, but yes, this is likely overkill */ 29 /* need to set a limit somewhere, but yes, this is likely overkill */
28 ND_IOCTL_MAX_BUFLEN = SZ_4M, 30 ND_IOCTL_MAX_BUFLEN = SZ_4M,
@@ -120,7 +122,7 @@ static inline struct nd_blk_region_desc *to_blk_region_desc(
120} 122}
121 123
122int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length); 124int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length);
123void nvdimm_clear_from_poison_list(struct nvdimm_bus *nvdimm_bus, 125void nvdimm_forget_poison(struct nvdimm_bus *nvdimm_bus,
124 phys_addr_t start, unsigned int len); 126 phys_addr_t start, unsigned int len);
125struct nvdimm_bus *nvdimm_bus_register(struct device *parent, 127struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
126 struct nvdimm_bus_descriptor *nfit_desc); 128 struct nvdimm_bus_descriptor *nfit_desc);
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index ca45e4a088a9..7dfa56ebbc6d 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -56,7 +56,6 @@ typedef int (nvm_get_l2p_tbl_fn)(struct nvm_dev *, u64, u32,
56typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, u8 *); 56typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, u8 *);
57typedef int (nvm_op_set_bb_fn)(struct nvm_dev *, struct ppa_addr *, int, int); 57typedef int (nvm_op_set_bb_fn)(struct nvm_dev *, struct ppa_addr *, int, int);
58typedef int (nvm_submit_io_fn)(struct nvm_dev *, struct nvm_rq *); 58typedef int (nvm_submit_io_fn)(struct nvm_dev *, struct nvm_rq *);
59typedef int (nvm_erase_blk_fn)(struct nvm_dev *, struct nvm_rq *);
60typedef void *(nvm_create_dma_pool_fn)(struct nvm_dev *, char *); 59typedef void *(nvm_create_dma_pool_fn)(struct nvm_dev *, char *);
61typedef void (nvm_destroy_dma_pool_fn)(void *); 60typedef void (nvm_destroy_dma_pool_fn)(void *);
62typedef void *(nvm_dev_dma_alloc_fn)(struct nvm_dev *, void *, gfp_t, 61typedef void *(nvm_dev_dma_alloc_fn)(struct nvm_dev *, void *, gfp_t,
@@ -70,7 +69,6 @@ struct nvm_dev_ops {
70 nvm_op_set_bb_fn *set_bb_tbl; 69 nvm_op_set_bb_fn *set_bb_tbl;
71 70
72 nvm_submit_io_fn *submit_io; 71 nvm_submit_io_fn *submit_io;
73 nvm_erase_blk_fn *erase_block;
74 72
75 nvm_create_dma_pool_fn *create_dma_pool; 73 nvm_create_dma_pool_fn *create_dma_pool;
76 nvm_destroy_dma_pool_fn *destroy_dma_pool; 74 nvm_destroy_dma_pool_fn *destroy_dma_pool;
@@ -125,7 +123,7 @@ enum {
125 /* NAND Access Modes */ 123 /* NAND Access Modes */
126 NVM_IO_SUSPEND = 0x80, 124 NVM_IO_SUSPEND = 0x80,
127 NVM_IO_SLC_MODE = 0x100, 125 NVM_IO_SLC_MODE = 0x100,
128 NVM_IO_SCRAMBLE_DISABLE = 0x200, 126 NVM_IO_SCRAMBLE_ENABLE = 0x200,
129 127
130 /* Block Types */ 128 /* Block Types */
131 NVM_BLK_T_FREE = 0x0, 129 NVM_BLK_T_FREE = 0x0,
@@ -438,7 +436,8 @@ static inline int ppa_cmp_blk(struct ppa_addr ppa1, struct ppa_addr ppa2)
438 436
439typedef blk_qc_t (nvm_tgt_make_rq_fn)(struct request_queue *, struct bio *); 437typedef blk_qc_t (nvm_tgt_make_rq_fn)(struct request_queue *, struct bio *);
440typedef sector_t (nvm_tgt_capacity_fn)(void *); 438typedef sector_t (nvm_tgt_capacity_fn)(void *);
441typedef void *(nvm_tgt_init_fn)(struct nvm_tgt_dev *, struct gendisk *); 439typedef void *(nvm_tgt_init_fn)(struct nvm_tgt_dev *, struct gendisk *,
440 int flags);
442typedef void (nvm_tgt_exit_fn)(void *); 441typedef void (nvm_tgt_exit_fn)(void *);
443typedef int (nvm_tgt_sysfs_init_fn)(struct gendisk *); 442typedef int (nvm_tgt_sysfs_init_fn)(struct gendisk *);
444typedef void (nvm_tgt_sysfs_exit_fn)(struct gendisk *); 443typedef void (nvm_tgt_sysfs_exit_fn)(struct gendisk *);
@@ -479,10 +478,10 @@ extern int nvm_set_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr *,
479 int, int); 478 int, int);
480extern int nvm_max_phys_sects(struct nvm_tgt_dev *); 479extern int nvm_max_phys_sects(struct nvm_tgt_dev *);
481extern int nvm_submit_io(struct nvm_tgt_dev *, struct nvm_rq *); 480extern int nvm_submit_io(struct nvm_tgt_dev *, struct nvm_rq *);
482extern int nvm_set_rqd_ppalist(struct nvm_dev *, struct nvm_rq *, 481extern int nvm_erase_sync(struct nvm_tgt_dev *, struct ppa_addr *, int);
482extern int nvm_set_rqd_ppalist(struct nvm_tgt_dev *, struct nvm_rq *,
483 const struct ppa_addr *, int, int); 483 const struct ppa_addr *, int, int);
484extern void nvm_free_rqd_ppalist(struct nvm_dev *, struct nvm_rq *); 484extern void nvm_free_rqd_ppalist(struct nvm_tgt_dev *, struct nvm_rq *);
485extern int nvm_erase_blk(struct nvm_tgt_dev *, struct ppa_addr *, int);
486extern int nvm_get_l2p_tbl(struct nvm_tgt_dev *, u64, u32, nvm_l2p_update_fn *, 485extern int nvm_get_l2p_tbl(struct nvm_tgt_dev *, u64, u32, nvm_l2p_update_fn *,
487 void *); 486 void *);
488extern int nvm_get_area(struct nvm_tgt_dev *, sector_t *, sector_t); 487extern int nvm_get_area(struct nvm_tgt_dev *, sector_t *, sector_t);
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index 9072f04db616..194991ef9347 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -23,15 +23,16 @@
23 23
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/ftrace.h> 25#include <linux/ftrace.h>
26#include <linux/completion.h>
26 27
27#if IS_ENABLED(CONFIG_LIVEPATCH) 28#if IS_ENABLED(CONFIG_LIVEPATCH)
28 29
29#include <asm/livepatch.h> 30#include <asm/livepatch.h>
30 31
31enum klp_state { 32/* task patch states */
32 KLP_DISABLED, 33#define KLP_UNDEFINED -1
33 KLP_ENABLED 34#define KLP_UNPATCHED 0
34}; 35#define KLP_PATCHED 1
35 36
36/** 37/**
37 * struct klp_func - function structure for live patching 38 * struct klp_func - function structure for live patching
@@ -39,10 +40,29 @@ enum klp_state {
39 * @new_func: pointer to the patched function code 40 * @new_func: pointer to the patched function code
40 * @old_sympos: a hint indicating which symbol position the old function 41 * @old_sympos: a hint indicating which symbol position the old function
41 * can be found (optional) 42 * can be found (optional)
43 * @immediate: patch the func immediately, bypassing safety mechanisms
42 * @old_addr: the address of the function being patched 44 * @old_addr: the address of the function being patched
43 * @kobj: kobject for sysfs resources 45 * @kobj: kobject for sysfs resources
44 * @state: tracks function-level patch application state
45 * @stack_node: list node for klp_ops func_stack list 46 * @stack_node: list node for klp_ops func_stack list
47 * @old_size: size of the old function
48 * @new_size: size of the new function
49 * @patched: the func has been added to the klp_ops list
50 * @transition: the func is currently being applied or reverted
51 *
52 * The patched and transition variables define the func's patching state. When
53 * patching, a func is always in one of the following states:
54 *
55 * patched=0 transition=0: unpatched
56 * patched=0 transition=1: unpatched, temporary starting state
57 * patched=1 transition=1: patched, may be visible to some tasks
58 * patched=1 transition=0: patched, visible to all tasks
59 *
60 * And when unpatching, it goes in the reverse order:
61 *
62 * patched=1 transition=0: patched, visible to all tasks
63 * patched=1 transition=1: patched, may be visible to some tasks
64 * patched=0 transition=1: unpatched, temporary ending state
65 * patched=0 transition=0: unpatched
46 */ 66 */
47struct klp_func { 67struct klp_func {
48 /* external */ 68 /* external */
@@ -56,12 +76,15 @@ struct klp_func {
56 * in kallsyms for the given object is used. 76 * in kallsyms for the given object is used.
57 */ 77 */
58 unsigned long old_sympos; 78 unsigned long old_sympos;
79 bool immediate;
59 80
60 /* internal */ 81 /* internal */
61 unsigned long old_addr; 82 unsigned long old_addr;
62 struct kobject kobj; 83 struct kobject kobj;
63 enum klp_state state;
64 struct list_head stack_node; 84 struct list_head stack_node;
85 unsigned long old_size, new_size;
86 bool patched;
87 bool transition;
65}; 88};
66 89
67/** 90/**
@@ -70,8 +93,8 @@ struct klp_func {
70 * @funcs: function entries for functions to be patched in the object 93 * @funcs: function entries for functions to be patched in the object
71 * @kobj: kobject for sysfs resources 94 * @kobj: kobject for sysfs resources
72 * @mod: kernel module associated with the patched object 95 * @mod: kernel module associated with the patched object
73 * (NULL for vmlinux) 96 * (NULL for vmlinux)
74 * @state: tracks object-level patch application state 97 * @patched: the object's funcs have been added to the klp_ops list
75 */ 98 */
76struct klp_object { 99struct klp_object {
77 /* external */ 100 /* external */
@@ -81,26 +104,30 @@ struct klp_object {
81 /* internal */ 104 /* internal */
82 struct kobject kobj; 105 struct kobject kobj;
83 struct module *mod; 106 struct module *mod;
84 enum klp_state state; 107 bool patched;
85}; 108};
86 109
87/** 110/**
88 * struct klp_patch - patch structure for live patching 111 * struct klp_patch - patch structure for live patching
89 * @mod: reference to the live patch module 112 * @mod: reference to the live patch module
90 * @objs: object entries for kernel objects to be patched 113 * @objs: object entries for kernel objects to be patched
114 * @immediate: patch all funcs immediately, bypassing safety mechanisms
91 * @list: list node for global list of registered patches 115 * @list: list node for global list of registered patches
92 * @kobj: kobject for sysfs resources 116 * @kobj: kobject for sysfs resources
93 * @state: tracks patch-level application state 117 * @enabled: the patch is enabled (but operation may be incomplete)
118 * @finish: for waiting till it is safe to remove the patch module
94 */ 119 */
95struct klp_patch { 120struct klp_patch {
96 /* external */ 121 /* external */
97 struct module *mod; 122 struct module *mod;
98 struct klp_object *objs; 123 struct klp_object *objs;
124 bool immediate;
99 125
100 /* internal */ 126 /* internal */
101 struct list_head list; 127 struct list_head list;
102 struct kobject kobj; 128 struct kobject kobj;
103 enum klp_state state; 129 bool enabled;
130 struct completion finish;
104}; 131};
105 132
106#define klp_for_each_object(patch, obj) \ 133#define klp_for_each_object(patch, obj) \
@@ -123,10 +150,27 @@ void arch_klp_init_object_loaded(struct klp_patch *patch,
123int klp_module_coming(struct module *mod); 150int klp_module_coming(struct module *mod);
124void klp_module_going(struct module *mod); 151void klp_module_going(struct module *mod);
125 152
153void klp_copy_process(struct task_struct *child);
154void klp_update_patch_state(struct task_struct *task);
155
156static inline bool klp_patch_pending(struct task_struct *task)
157{
158 return test_tsk_thread_flag(task, TIF_PATCH_PENDING);
159}
160
161static inline bool klp_have_reliable_stack(void)
162{
163 return IS_ENABLED(CONFIG_STACKTRACE) &&
164 IS_ENABLED(CONFIG_HAVE_RELIABLE_STACKTRACE);
165}
166
126#else /* !CONFIG_LIVEPATCH */ 167#else /* !CONFIG_LIVEPATCH */
127 168
128static inline int klp_module_coming(struct module *mod) { return 0; } 169static inline int klp_module_coming(struct module *mod) { return 0; }
129static inline void klp_module_going(struct module *mod) { } 170static inline void klp_module_going(struct module *mod) {}
171static inline bool klp_patch_pending(struct task_struct *task) { return false; }
172static inline void klp_update_patch_state(struct task_struct *task) {}
173static inline void klp_copy_process(struct task_struct *child) {}
130 174
131#endif /* CONFIG_LIVEPATCH */ 175#endif /* CONFIG_LIVEPATCH */
132 176
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 140edab64446..05728396a1a1 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -18,6 +18,7 @@
18 18
19/* Dummy declarations */ 19/* Dummy declarations */
20struct svc_rqst; 20struct svc_rqst;
21struct rpc_task;
21 22
22/* 23/*
23 * This is the set of functions for lockd->nfsd communication 24 * This is the set of functions for lockd->nfsd communication
@@ -43,6 +44,7 @@ struct nlmclnt_initdata {
43 u32 nfs_version; 44 u32 nfs_version;
44 int noresvport; 45 int noresvport;
45 struct net *net; 46 struct net *net;
47 const struct nlmclnt_operations *nlmclnt_ops;
46}; 48};
47 49
48/* 50/*
@@ -52,8 +54,26 @@ struct nlmclnt_initdata {
52extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init); 54extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
53extern void nlmclnt_done(struct nlm_host *host); 55extern void nlmclnt_done(struct nlm_host *host);
54 56
55extern int nlmclnt_proc(struct nlm_host *host, int cmd, 57/*
56 struct file_lock *fl); 58 * NLM client operations provide a means to modify RPC processing of NLM
59 * requests. Callbacks receive a pointer to data passed into the call to
60 * nlmclnt_proc().
61 */
62struct nlmclnt_operations {
63 /* Called on successful allocation of nlm_rqst, use for allocation or
64 * reference counting. */
65 void (*nlmclnt_alloc_call)(void *);
66
67 /* Called in rpc_task_prepare for unlock. A return value of true
68 * indicates the callback has put the task to sleep on a waitqueue
69 * and NLM should not call rpc_call_start(). */
70 bool (*nlmclnt_unlock_prepare)(struct rpc_task*, void *);
71
72 /* Called when the nlm_rqst is freed, callbacks should clean up here */
73 void (*nlmclnt_release_call)(void *);
74};
75
76extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data);
57extern int lockd_up(struct net *net); 77extern int lockd_up(struct net *net);
58extern void lockd_down(struct net *net); 78extern void lockd_down(struct net *net);
59 79
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index b37dee3acaba..41f7b6a04d69 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -69,6 +69,7 @@ struct nlm_host {
69 char *h_addrbuf; /* address eyecatcher */ 69 char *h_addrbuf; /* address eyecatcher */
70 struct net *net; /* host net */ 70 struct net *net; /* host net */
71 char nodename[UNX_MAXNODENAME + 1]; 71 char nodename[UNX_MAXNODENAME + 1];
72 const struct nlmclnt_operations *h_nlmclnt_ops; /* Callback ops for NLM users */
72}; 73};
73 74
74/* 75/*
@@ -142,6 +143,7 @@ struct nlm_rqst {
142 struct nlm_block * a_block; 143 struct nlm_block * a_block;
143 unsigned int a_retries; /* Retry count */ 144 unsigned int a_retries; /* Retry count */
144 u8 a_owner[NLMCLNT_OHSIZE]; 145 u8 a_owner[NLMCLNT_OHSIZE];
146 void * a_callback_data; /* sent to nlmclnt_operations callbacks */
145}; 147};
146 148
147/* 149/*
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 1e327bb80838..fffe49f188e6 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -361,6 +361,8 @@ static inline void lock_set_subclass(struct lockdep_map *lock,
361 lock_set_class(lock, lock->name, lock->key, subclass, ip); 361 lock_set_class(lock, lock->name, lock->key, subclass, ip);
362} 362}
363 363
364extern void lock_downgrade(struct lockdep_map *lock, unsigned long ip);
365
364extern void lockdep_set_current_reclaim_state(gfp_t gfp_mask); 366extern void lockdep_set_current_reclaim_state(gfp_t gfp_mask);
365extern void lockdep_clear_current_reclaim_state(void); 367extern void lockdep_clear_current_reclaim_state(void);
366extern void lockdep_trace_alloc(gfp_t mask); 368extern void lockdep_trace_alloc(gfp_t mask);
@@ -411,6 +413,7 @@ static inline void lockdep_on(void)
411 413
412# define lock_acquire(l, s, t, r, c, n, i) do { } while (0) 414# define lock_acquire(l, s, t, r, c, n, i) do { } while (0)
413# define lock_release(l, n, i) do { } while (0) 415# define lock_release(l, n, i) do { } while (0)
416# define lock_downgrade(l, i) do { } while (0)
414# define lock_set_class(l, n, k, s, i) do { } while (0) 417# define lock_set_class(l, n, k, s, i) do { } while (0)
415# define lock_set_subclass(l, s, i) do { } while (0) 418# define lock_set_subclass(l, s, i) do { } while (0)
416# define lockdep_set_current_reclaim_state(g) do { } while (0) 419# define lockdep_set_current_reclaim_state(g) do { } while (0)
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index e29d4c62a3c8..080f34e66017 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -533,8 +533,13 @@
533 * manual page for definitions of the @clone_flags. 533 * manual page for definitions of the @clone_flags.
534 * @clone_flags contains the flags indicating what should be shared. 534 * @clone_flags contains the flags indicating what should be shared.
535 * Return 0 if permission is granted. 535 * Return 0 if permission is granted.
536 * @task_alloc:
537 * @task task being allocated.
538 * @clone_flags contains the flags indicating what should be shared.
539 * Handle allocation of task-related resources.
540 * Returns a zero on success, negative values on failure.
536 * @task_free: 541 * @task_free:
537 * @task task being freed 542 * @task task about to be freed.
538 * Handle release of task-related resources. (Note that this can be called 543 * Handle release of task-related resources. (Note that this can be called
539 * from interrupt context.) 544 * from interrupt context.)
540 * @cred_alloc_blank: 545 * @cred_alloc_blank:
@@ -630,10 +635,19 @@
630 * Check permission before getting the ioprio value of @p. 635 * Check permission before getting the ioprio value of @p.
631 * @p contains the task_struct of process. 636 * @p contains the task_struct of process.
632 * Return 0 if permission is granted. 637 * Return 0 if permission is granted.
638 * @task_prlimit:
639 * Check permission before getting and/or setting the resource limits of
640 * another task.
641 * @cred points to the cred structure for the current task.
642 * @tcred points to the cred structure for the target task.
643 * @flags contains the LSM_PRLIMIT_* flag bits indicating whether the
644 * resource limits are being read, modified, or both.
645 * Return 0 if permission is granted.
633 * @task_setrlimit: 646 * @task_setrlimit:
634 * Check permission before setting the resource limits of the current 647 * Check permission before setting the resource limits of process @p
635 * process for @resource to @new_rlim. The old resource limit values can 648 * for @resource to @new_rlim. The old resource limit values can
636 * be examined by dereferencing (current->signal->rlim + resource). 649 * be examined by dereferencing (p->signal->rlim + resource).
650 * @p points to the task_struct for the target task's group leader.
637 * @resource contains the resource whose limit is being set. 651 * @resource contains the resource whose limit is being set.
638 * @new_rlim contains the new limits for @resource. 652 * @new_rlim contains the new limits for @resource.
639 * Return 0 if permission is granted. 653 * Return 0 if permission is granted.
@@ -1473,6 +1487,7 @@ union security_list_options {
1473 int (*file_open)(struct file *file, const struct cred *cred); 1487 int (*file_open)(struct file *file, const struct cred *cred);
1474 1488
1475 int (*task_create)(unsigned long clone_flags); 1489 int (*task_create)(unsigned long clone_flags);
1490 int (*task_alloc)(struct task_struct *task, unsigned long clone_flags);
1476 void (*task_free)(struct task_struct *task); 1491 void (*task_free)(struct task_struct *task);
1477 int (*cred_alloc_blank)(struct cred *cred, gfp_t gfp); 1492 int (*cred_alloc_blank)(struct cred *cred, gfp_t gfp);
1478 void (*cred_free)(struct cred *cred); 1493 void (*cred_free)(struct cred *cred);
@@ -1494,6 +1509,8 @@ union security_list_options {
1494 int (*task_setnice)(struct task_struct *p, int nice); 1509 int (*task_setnice)(struct task_struct *p, int nice);
1495 int (*task_setioprio)(struct task_struct *p, int ioprio); 1510 int (*task_setioprio)(struct task_struct *p, int ioprio);
1496 int (*task_getioprio)(struct task_struct *p); 1511 int (*task_getioprio)(struct task_struct *p);
1512 int (*task_prlimit)(const struct cred *cred, const struct cred *tcred,
1513 unsigned int flags);
1497 int (*task_setrlimit)(struct task_struct *p, unsigned int resource, 1514 int (*task_setrlimit)(struct task_struct *p, unsigned int resource,
1498 struct rlimit *new_rlim); 1515 struct rlimit *new_rlim);
1499 int (*task_setscheduler)(struct task_struct *p); 1516 int (*task_setscheduler)(struct task_struct *p);
@@ -1737,6 +1754,7 @@ struct security_hook_heads {
1737 struct list_head file_receive; 1754 struct list_head file_receive;
1738 struct list_head file_open; 1755 struct list_head file_open;
1739 struct list_head task_create; 1756 struct list_head task_create;
1757 struct list_head task_alloc;
1740 struct list_head task_free; 1758 struct list_head task_free;
1741 struct list_head cred_alloc_blank; 1759 struct list_head cred_alloc_blank;
1742 struct list_head cred_free; 1760 struct list_head cred_free;
@@ -1755,6 +1773,7 @@ struct security_hook_heads {
1755 struct list_head task_setnice; 1773 struct list_head task_setnice;
1756 struct list_head task_setioprio; 1774 struct list_head task_setioprio;
1757 struct list_head task_getioprio; 1775 struct list_head task_getioprio;
1776 struct list_head task_prlimit;
1758 struct list_head task_setrlimit; 1777 struct list_head task_setrlimit;
1759 struct list_head task_setscheduler; 1778 struct list_head task_setscheduler;
1760 struct list_head task_getscheduler; 1779 struct list_head task_getscheduler;
@@ -1908,6 +1927,13 @@ static inline void security_delete_hooks(struct security_hook_list *hooks,
1908} 1927}
1909#endif /* CONFIG_SECURITY_SELINUX_DISABLE */ 1928#endif /* CONFIG_SECURITY_SELINUX_DISABLE */
1910 1929
1930/* Currently required to handle SELinux runtime hook disable. */
1931#ifdef CONFIG_SECURITY_WRITABLE_HOOKS
1932#define __lsm_ro_after_init
1933#else
1934#define __lsm_ro_after_init __ro_after_init
1935#endif /* CONFIG_SECURITY_WRITABLE_HOOKS */
1936
1911extern int __init security_module_enable(const char *module); 1937extern int __init security_module_enable(const char *module);
1912extern void __init capability_add_hooks(void); 1938extern void __init capability_add_hooks(void);
1913#ifdef CONFIG_SECURITY_YAMA 1939#ifdef CONFIG_SECURITY_YAMA
diff --git a/include/linux/mailbox/brcm-message.h b/include/linux/mailbox/brcm-message.h
index 6b55c938b401..c20b4843fc2d 100644
--- a/include/linux/mailbox/brcm-message.h
+++ b/include/linux/mailbox/brcm-message.h
@@ -16,6 +16,7 @@
16 16
17enum brcm_message_type { 17enum brcm_message_type {
18 BRCM_MESSAGE_UNKNOWN = 0, 18 BRCM_MESSAGE_UNKNOWN = 0,
19 BRCM_MESSAGE_BATCH,
19 BRCM_MESSAGE_SPU, 20 BRCM_MESSAGE_SPU,
20 BRCM_MESSAGE_SBA, 21 BRCM_MESSAGE_SBA,
21 BRCM_MESSAGE_MAX, 22 BRCM_MESSAGE_MAX,
@@ -23,24 +24,29 @@ enum brcm_message_type {
23 24
24struct brcm_sba_command { 25struct brcm_sba_command {
25 u64 cmd; 26 u64 cmd;
27 u64 *cmd_dma;
28 dma_addr_t cmd_dma_addr;
26#define BRCM_SBA_CMD_TYPE_A BIT(0) 29#define BRCM_SBA_CMD_TYPE_A BIT(0)
27#define BRCM_SBA_CMD_TYPE_B BIT(1) 30#define BRCM_SBA_CMD_TYPE_B BIT(1)
28#define BRCM_SBA_CMD_TYPE_C BIT(2) 31#define BRCM_SBA_CMD_TYPE_C BIT(2)
29#define BRCM_SBA_CMD_HAS_RESP BIT(3) 32#define BRCM_SBA_CMD_HAS_RESP BIT(3)
30#define BRCM_SBA_CMD_HAS_OUTPUT BIT(4) 33#define BRCM_SBA_CMD_HAS_OUTPUT BIT(4)
31 u64 flags; 34 u64 flags;
32 dma_addr_t input;
33 size_t input_len;
34 dma_addr_t resp; 35 dma_addr_t resp;
35 size_t resp_len; 36 size_t resp_len;
36 dma_addr_t output; 37 dma_addr_t data;
37 size_t output_len; 38 size_t data_len;
38}; 39};
39 40
40struct brcm_message { 41struct brcm_message {
41 enum brcm_message_type type; 42 enum brcm_message_type type;
42 union { 43 union {
43 struct { 44 struct {
45 struct brcm_message *msgs;
46 unsigned int msgs_queued;
47 unsigned int msgs_count;
48 } batch;
49 struct {
44 struct scatterlist *src; 50 struct scatterlist *src;
45 struct scatterlist *dst; 51 struct scatterlist *dst;
46 } spu; 52 } spu;
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index bdfc65af4152..4ce24a376262 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -93,6 +93,7 @@ int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size);
93int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); 93int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
94int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); 94int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
95int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); 95int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
96int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
96ulong choose_memblock_flags(void); 97ulong choose_memblock_flags(void);
97 98
98/* Low level functions */ 99/* Low level functions */
@@ -335,6 +336,7 @@ phys_addr_t memblock_mem_size(unsigned long limit_pfn);
335phys_addr_t memblock_start_of_DRAM(void); 336phys_addr_t memblock_start_of_DRAM(void);
336phys_addr_t memblock_end_of_DRAM(void); 337phys_addr_t memblock_end_of_DRAM(void);
337void memblock_enforce_memory_limit(phys_addr_t memory_limit); 338void memblock_enforce_memory_limit(phys_addr_t memory_limit);
339void memblock_cap_memory_range(phys_addr_t base, phys_addr_t size);
338void memblock_mem_limit_remove_map(phys_addr_t limit); 340void memblock_mem_limit_remove_map(phys_addr_t limit);
339bool memblock_is_memory(phys_addr_t addr); 341bool memblock_is_memory(phys_addr_t addr);
340int memblock_is_map_memory(phys_addr_t addr); 342int memblock_is_map_memory(phys_addr_t addr);
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index bb7250c45cb8..899949bbb2f9 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -35,48 +35,43 @@ struct page;
35struct mm_struct; 35struct mm_struct;
36struct kmem_cache; 36struct kmem_cache;
37 37
38/* 38/* Cgroup-specific page state, on top of universal node page state */
39 * The corresponding mem_cgroup_stat_names is defined in mm/memcontrol.c, 39enum memcg_stat_item {
40 * These two lists should keep in accord with each other. 40 MEMCG_CACHE = NR_VM_NODE_STAT_ITEMS,
41 */ 41 MEMCG_RSS,
42enum mem_cgroup_stat_index { 42 MEMCG_RSS_HUGE,
43 /* 43 MEMCG_SWAP,
44 * For MEM_CONTAINER_TYPE_ALL, usage = pagecache + rss. 44 MEMCG_SOCK,
45 */ 45 /* XXX: why are these zone and not node counters? */
46 MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */ 46 MEMCG_KERNEL_STACK_KB,
47 MEM_CGROUP_STAT_RSS, /* # of pages charged as anon rss */
48 MEM_CGROUP_STAT_RSS_HUGE, /* # of pages charged as anon huge */
49 MEM_CGROUP_STAT_FILE_MAPPED, /* # of pages charged as file rss */
50 MEM_CGROUP_STAT_DIRTY, /* # of dirty pages in page cache */
51 MEM_CGROUP_STAT_WRITEBACK, /* # of pages under writeback */
52 MEM_CGROUP_STAT_SWAP, /* # of pages, swapped out */
53 MEM_CGROUP_STAT_NSTATS,
54 /* default hierarchy stats */
55 MEMCG_KERNEL_STACK_KB = MEM_CGROUP_STAT_NSTATS,
56 MEMCG_SLAB_RECLAIMABLE, 47 MEMCG_SLAB_RECLAIMABLE,
57 MEMCG_SLAB_UNRECLAIMABLE, 48 MEMCG_SLAB_UNRECLAIMABLE,
58 MEMCG_SOCK,
59 MEMCG_NR_STAT, 49 MEMCG_NR_STAT,
60}; 50};
61 51
52/* Cgroup-specific events, on top of universal VM events */
53enum memcg_event_item {
54 MEMCG_LOW = NR_VM_EVENT_ITEMS,
55 MEMCG_HIGH,
56 MEMCG_MAX,
57 MEMCG_OOM,
58 MEMCG_NR_EVENTS,
59};
60
62struct mem_cgroup_reclaim_cookie { 61struct mem_cgroup_reclaim_cookie {
63 pg_data_t *pgdat; 62 pg_data_t *pgdat;
64 int priority; 63 int priority;
65 unsigned int generation; 64 unsigned int generation;
66}; 65};
67 66
68enum mem_cgroup_events_index { 67#ifdef CONFIG_MEMCG
69 MEM_CGROUP_EVENTS_PGPGIN, /* # of pages paged in */ 68
70 MEM_CGROUP_EVENTS_PGPGOUT, /* # of pages paged out */ 69#define MEM_CGROUP_ID_SHIFT 16
71 MEM_CGROUP_EVENTS_PGFAULT, /* # of page-faults */ 70#define MEM_CGROUP_ID_MAX USHRT_MAX
72 MEM_CGROUP_EVENTS_PGMAJFAULT, /* # of major page-faults */ 71
73 MEM_CGROUP_EVENTS_NSTATS, 72struct mem_cgroup_id {
74 /* default hierarchy events */ 73 int id;
75 MEMCG_LOW = MEM_CGROUP_EVENTS_NSTATS, 74 atomic_t ref;
76 MEMCG_HIGH,
77 MEMCG_MAX,
78 MEMCG_OOM,
79 MEMCG_NR_EVENTS,
80}; 75};
81 76
82/* 77/*
@@ -92,16 +87,6 @@ enum mem_cgroup_events_target {
92 MEM_CGROUP_NTARGETS, 87 MEM_CGROUP_NTARGETS,
93}; 88};
94 89
95#ifdef CONFIG_MEMCG
96
97#define MEM_CGROUP_ID_SHIFT 16
98#define MEM_CGROUP_ID_MAX USHRT_MAX
99
100struct mem_cgroup_id {
101 int id;
102 atomic_t ref;
103};
104
105struct mem_cgroup_stat_cpu { 90struct mem_cgroup_stat_cpu {
106 long count[MEMCG_NR_STAT]; 91 long count[MEMCG_NR_STAT];
107 unsigned long events[MEMCG_NR_EVENTS]; 92 unsigned long events[MEMCG_NR_EVENTS];
@@ -283,17 +268,10 @@ static inline bool mem_cgroup_disabled(void)
283 return !cgroup_subsys_enabled(memory_cgrp_subsys); 268 return !cgroup_subsys_enabled(memory_cgrp_subsys);
284} 269}
285 270
286/** 271static inline void mem_cgroup_event(struct mem_cgroup *memcg,
287 * mem_cgroup_events - count memory events against a cgroup 272 enum memcg_event_item event)
288 * @memcg: the memory cgroup
289 * @idx: the event index
290 * @nr: the number of events to account for
291 */
292static inline void mem_cgroup_events(struct mem_cgroup *memcg,
293 enum mem_cgroup_events_index idx,
294 unsigned int nr)
295{ 273{
296 this_cpu_add(memcg->stat->events[idx], nr); 274 this_cpu_inc(memcg->stat->events[event]);
297 cgroup_file_notify(&memcg->events_file); 275 cgroup_file_notify(&memcg->events_file);
298} 276}
299 277
@@ -494,8 +472,42 @@ extern int do_swap_account;
494void lock_page_memcg(struct page *page); 472void lock_page_memcg(struct page *page);
495void unlock_page_memcg(struct page *page); 473void unlock_page_memcg(struct page *page);
496 474
475static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
476 enum memcg_stat_item idx)
477{
478 long val = 0;
479 int cpu;
480
481 for_each_possible_cpu(cpu)
482 val += per_cpu(memcg->stat->count[idx], cpu);
483
484 if (val < 0)
485 val = 0;
486
487 return val;
488}
489
490static inline void mod_memcg_state(struct mem_cgroup *memcg,
491 enum memcg_stat_item idx, int val)
492{
493 if (!mem_cgroup_disabled())
494 this_cpu_add(memcg->stat->count[idx], val);
495}
496
497static inline void inc_memcg_state(struct mem_cgroup *memcg,
498 enum memcg_stat_item idx)
499{
500 mod_memcg_state(memcg, idx, 1);
501}
502
503static inline void dec_memcg_state(struct mem_cgroup *memcg,
504 enum memcg_stat_item idx)
505{
506 mod_memcg_state(memcg, idx, -1);
507}
508
497/** 509/**
498 * mem_cgroup_update_page_stat - update page state statistics 510 * mod_memcg_page_state - update page state statistics
499 * @page: the page 511 * @page: the page
500 * @idx: page state item to account 512 * @idx: page state item to account
501 * @val: number of pages (positive or negative) 513 * @val: number of pages (positive or negative)
@@ -506,28 +518,28 @@ void unlock_page_memcg(struct page *page);
506 * 518 *
507 * lock_page(page) or lock_page_memcg(page) 519 * lock_page(page) or lock_page_memcg(page)
508 * if (TestClearPageState(page)) 520 * if (TestClearPageState(page))
509 * mem_cgroup_update_page_stat(page, state, -1); 521 * mod_memcg_page_state(page, state, -1);
510 * unlock_page(page) or unlock_page_memcg(page) 522 * unlock_page(page) or unlock_page_memcg(page)
523 *
524 * Kernel pages are an exception to this, since they'll never move.
511 */ 525 */
512static inline void mem_cgroup_update_page_stat(struct page *page, 526static inline void mod_memcg_page_state(struct page *page,
513 enum mem_cgroup_stat_index idx, int val) 527 enum memcg_stat_item idx, int val)
514{ 528{
515 VM_BUG_ON(!(rcu_read_lock_held() || PageLocked(page)));
516
517 if (page->mem_cgroup) 529 if (page->mem_cgroup)
518 this_cpu_add(page->mem_cgroup->stat->count[idx], val); 530 mod_memcg_state(page->mem_cgroup, idx, val);
519} 531}
520 532
521static inline void mem_cgroup_inc_page_stat(struct page *page, 533static inline void inc_memcg_page_state(struct page *page,
522 enum mem_cgroup_stat_index idx) 534 enum memcg_stat_item idx)
523{ 535{
524 mem_cgroup_update_page_stat(page, idx, 1); 536 mod_memcg_page_state(page, idx, 1);
525} 537}
526 538
527static inline void mem_cgroup_dec_page_stat(struct page *page, 539static inline void dec_memcg_page_state(struct page *page,
528 enum mem_cgroup_stat_index idx) 540 enum memcg_stat_item idx)
529{ 541{
530 mem_cgroup_update_page_stat(page, idx, -1); 542 mod_memcg_page_state(page, idx, -1);
531} 543}
532 544
533unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, 545unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
@@ -544,20 +556,8 @@ static inline void mem_cgroup_count_vm_event(struct mm_struct *mm,
544 556
545 rcu_read_lock(); 557 rcu_read_lock();
546 memcg = mem_cgroup_from_task(rcu_dereference(mm->owner)); 558 memcg = mem_cgroup_from_task(rcu_dereference(mm->owner));
547 if (unlikely(!memcg)) 559 if (likely(memcg))
548 goto out; 560 this_cpu_inc(memcg->stat->events[idx]);
549
550 switch (idx) {
551 case PGFAULT:
552 this_cpu_inc(memcg->stat->events[MEM_CGROUP_EVENTS_PGFAULT]);
553 break;
554 case PGMAJFAULT:
555 this_cpu_inc(memcg->stat->events[MEM_CGROUP_EVENTS_PGMAJFAULT]);
556 break;
557 default:
558 BUG();
559 }
560out:
561 rcu_read_unlock(); 561 rcu_read_unlock();
562} 562}
563#ifdef CONFIG_TRANSPARENT_HUGEPAGE 563#ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -576,9 +576,8 @@ static inline bool mem_cgroup_disabled(void)
576 return true; 576 return true;
577} 577}
578 578
579static inline void mem_cgroup_events(struct mem_cgroup *memcg, 579static inline void mem_cgroup_event(struct mem_cgroup *memcg,
580 enum mem_cgroup_events_index idx, 580 enum memcg_event_item event)
581 unsigned int nr)
582{ 581{
583} 582}
584 583
@@ -740,19 +739,41 @@ static inline bool mem_cgroup_oom_synchronize(bool wait)
740 return false; 739 return false;
741} 740}
742 741
743static inline void mem_cgroup_update_page_stat(struct page *page, 742static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
744 enum mem_cgroup_stat_index idx, 743 enum memcg_stat_item idx)
745 int nr) 744{
745 return 0;
746}
747
748static inline void mod_memcg_state(struct mem_cgroup *memcg,
749 enum memcg_stat_item idx,
750 int nr)
751{
752}
753
754static inline void inc_memcg_state(struct mem_cgroup *memcg,
755 enum memcg_stat_item idx)
756{
757}
758
759static inline void dec_memcg_state(struct mem_cgroup *memcg,
760 enum memcg_stat_item idx)
761{
762}
763
764static inline void mod_memcg_page_state(struct page *page,
765 enum memcg_stat_item idx,
766 int nr)
746{ 767{
747} 768}
748 769
749static inline void mem_cgroup_inc_page_stat(struct page *page, 770static inline void inc_memcg_page_state(struct page *page,
750 enum mem_cgroup_stat_index idx) 771 enum memcg_stat_item idx)
751{ 772{
752} 773}
753 774
754static inline void mem_cgroup_dec_page_stat(struct page *page, 775static inline void dec_memcg_page_state(struct page *page,
755 enum mem_cgroup_stat_index idx) 776 enum memcg_stat_item idx)
756{ 777{
757} 778}
758 779
@@ -872,7 +893,7 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg)
872 * @val: number of pages (positive or negative) 893 * @val: number of pages (positive or negative)
873 */ 894 */
874static inline void memcg_kmem_update_page_stat(struct page *page, 895static inline void memcg_kmem_update_page_stat(struct page *page,
875 enum mem_cgroup_stat_index idx, int val) 896 enum memcg_stat_item idx, int val)
876{ 897{
877 if (memcg_kmem_enabled() && page->mem_cgroup) 898 if (memcg_kmem_enabled() && page->mem_cgroup)
878 this_cpu_add(page->mem_cgroup->stat->count[idx], val); 899 this_cpu_add(page->mem_cgroup->stat->count[idx], val);
@@ -901,7 +922,7 @@ static inline void memcg_put_cache_ids(void)
901} 922}
902 923
903static inline void memcg_kmem_update_page_stat(struct page *page, 924static inline void memcg_kmem_update_page_stat(struct page *page,
904 enum mem_cgroup_stat_index idx, int val) 925 enum memcg_stat_item idx, int val)
905{ 926{
906} 927}
907#endif /* CONFIG_MEMCG && !CONFIG_SLOB */ 928#endif /* CONFIG_MEMCG && !CONFIG_SLOB */
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 64faeeff698c..bfeecf179895 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -12,6 +12,8 @@
12#define _ARIZONA_PDATA_H 12#define _ARIZONA_PDATA_H
13 13
14#include <dt-bindings/mfd/arizona.h> 14#include <dt-bindings/mfd/arizona.h>
15#include <linux/regulator/arizona-ldo1.h>
16#include <linux/regulator/arizona-micsupp.h>
15 17
16#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 18#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
17#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */ 19#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
@@ -76,13 +78,12 @@ struct arizona_micd_range {
76 78
77struct arizona_pdata { 79struct arizona_pdata {
78 int reset; /** GPIO controlling /RESET, if any */ 80 int reset; /** GPIO controlling /RESET, if any */
79 int ldoena; /** GPIO controlling LODENA, if any */
80 81
81 /** Regulator configuration for MICVDD */ 82 /** Regulator configuration for MICVDD */
82 struct regulator_init_data *micvdd; 83 struct arizona_micsupp_pdata micvdd;
83 84
84 /** Regulator configuration for LDO1 */ 85 /** Regulator configuration for LDO1 */
85 struct regulator_init_data *ldo1; 86 struct arizona_ldo1_pdata ldo1;
86 87
87 /** If a direct 32kHz clock is provided on an MCLK specify it here */ 88 /** If a direct 32kHz clock is provided on an MCLK specify it here */
88 int clk32k_src; 89 int clk32k_src;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 0d9a1ff38393..cde56cfe8446 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -20,6 +20,7 @@ enum axp20x_variants {
20 AXP221_ID, 20 AXP221_ID,
21 AXP223_ID, 21 AXP223_ID,
22 AXP288_ID, 22 AXP288_ID,
23 AXP803_ID,
23 AXP806_ID, 24 AXP806_ID,
24 AXP809_ID, 25 AXP809_ID,
25 NR_AXP20X_VARIANTS, 26 NR_AXP20X_VARIANTS,
@@ -228,13 +229,13 @@ enum axp20x_variants {
228#define AXP20X_OCV_MAX 0xf 229#define AXP20X_OCV_MAX 0xf
229 230
230/* AXP22X specific registers */ 231/* AXP22X specific registers */
231#define AXP22X_PMIC_ADC_H 0x56 232#define AXP22X_PMIC_TEMP_H 0x56
232#define AXP22X_PMIC_ADC_L 0x57 233#define AXP22X_PMIC_TEMP_L 0x57
233#define AXP22X_TS_ADC_H 0x58 234#define AXP22X_TS_ADC_H 0x58
234#define AXP22X_TS_ADC_L 0x59 235#define AXP22X_TS_ADC_L 0x59
235#define AXP22X_BATLOW_THRES1 0xe6 236#define AXP22X_BATLOW_THRES1 0xe6
236 237
237/* AXP288 specific registers */ 238/* AXP288/AXP803 specific registers */
238#define AXP288_POWER_REASON 0x02 239#define AXP288_POWER_REASON 0x02
239#define AXP288_BC_GLOBAL 0x2c 240#define AXP288_BC_GLOBAL 0x2c
240#define AXP288_BC_VBUS_CNTL 0x2d 241#define AXP288_BC_VBUS_CNTL 0x2d
@@ -475,6 +476,43 @@ enum axp288_irqs {
475 AXP288_IRQ_BC_USB_CHNG, 476 AXP288_IRQ_BC_USB_CHNG,
476}; 477};
477 478
479enum axp803_irqs {
480 AXP803_IRQ_ACIN_OVER_V = 1,
481 AXP803_IRQ_ACIN_PLUGIN,
482 AXP803_IRQ_ACIN_REMOVAL,
483 AXP803_IRQ_VBUS_OVER_V,
484 AXP803_IRQ_VBUS_PLUGIN,
485 AXP803_IRQ_VBUS_REMOVAL,
486 AXP803_IRQ_BATT_PLUGIN,
487 AXP803_IRQ_BATT_REMOVAL,
488 AXP803_IRQ_BATT_ENT_ACT_MODE,
489 AXP803_IRQ_BATT_EXIT_ACT_MODE,
490 AXP803_IRQ_CHARG,
491 AXP803_IRQ_CHARG_DONE,
492 AXP803_IRQ_BATT_CHG_TEMP_HIGH,
493 AXP803_IRQ_BATT_CHG_TEMP_HIGH_END,
494 AXP803_IRQ_BATT_CHG_TEMP_LOW,
495 AXP803_IRQ_BATT_CHG_TEMP_LOW_END,
496 AXP803_IRQ_BATT_ACT_TEMP_HIGH,
497 AXP803_IRQ_BATT_ACT_TEMP_HIGH_END,
498 AXP803_IRQ_BATT_ACT_TEMP_LOW,
499 AXP803_IRQ_BATT_ACT_TEMP_LOW_END,
500 AXP803_IRQ_DIE_TEMP_HIGH,
501 AXP803_IRQ_GPADC,
502 AXP803_IRQ_LOW_PWR_LVL1,
503 AXP803_IRQ_LOW_PWR_LVL2,
504 AXP803_IRQ_TIMER,
505 AXP803_IRQ_PEK_RIS_EDGE,
506 AXP803_IRQ_PEK_FAL_EDGE,
507 AXP803_IRQ_PEK_SHORT,
508 AXP803_IRQ_PEK_LONG,
509 AXP803_IRQ_PEK_OVER_OFF,
510 AXP803_IRQ_GPIO1_INPUT,
511 AXP803_IRQ_GPIO0_INPUT,
512 AXP803_IRQ_BC_USB_CHNG,
513 AXP803_IRQ_MV_CHNG,
514};
515
478enum axp806_irqs { 516enum axp806_irqs {
479 AXP806_IRQ_DIE_TEMP_HIGH_LV1, 517 AXP806_IRQ_DIE_TEMP_HIGH_LV1,
480 AXP806_IRQ_DIE_TEMP_HIGH_LV2, 518 AXP806_IRQ_DIE_TEMP_HIGH_LV2,
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 7a01c94496f1..28baee63eaf6 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -35,10 +35,11 @@
35 * Max bus-specific overhead incurred by request/responses. 35 * Max bus-specific overhead incurred by request/responses.
36 * I2C requires 1 additional byte for requests. 36 * I2C requires 1 additional byte for requests.
37 * I2C requires 2 additional bytes for responses. 37 * I2C requires 2 additional bytes for responses.
38 * SPI requires up to 32 additional bytes for responses.
38 * */ 39 * */
39#define EC_PROTO_VERSION_UNKNOWN 0 40#define EC_PROTO_VERSION_UNKNOWN 0
40#define EC_MAX_REQUEST_OVERHEAD 1 41#define EC_MAX_REQUEST_OVERHEAD 1
41#define EC_MAX_RESPONSE_OVERHEAD 2 42#define EC_MAX_RESPONSE_OVERHEAD 32
42 43
43/* 44/*
44 * Command interface between EC and AP, for LPC, I2C and SPI interfaces. 45 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
@@ -304,4 +305,22 @@ extern struct attribute_group cros_ec_attr_group;
304extern struct attribute_group cros_ec_lightbar_attr_group; 305extern struct attribute_group cros_ec_lightbar_attr_group;
305extern struct attribute_group cros_ec_vbc_attr_group; 306extern struct attribute_group cros_ec_vbc_attr_group;
306 307
308/* ACPI GPE handler */
309#ifdef CONFIG_ACPI
310
311int cros_ec_acpi_install_gpe_handler(struct device *dev);
312void cros_ec_acpi_remove_gpe_handler(void);
313void cros_ec_acpi_clear_gpe(void);
314
315#else /* CONFIG_ACPI */
316
317static inline int cros_ec_acpi_install_gpe_handler(struct device *dev)
318{
319 return -ENODEV;
320}
321static inline void cros_ec_acpi_remove_gpe_handler(void) {}
322static inline void cros_ec_acpi_clear_gpe(void) {}
323
324#endif /* CONFIG_ACPI */
325
307#endif /* __LINUX_MFD_CROS_EC_H */ 326#endif /* __LINUX_MFD_CROS_EC_H */
diff --git a/include/linux/mfd/da9062/core.h b/include/linux/mfd/da9062/core.h
index 376ba84366a0..74d33a01ddae 100644
--- a/include/linux/mfd/da9062/core.h
+++ b/include/linux/mfd/da9062/core.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2015 Dialog Semiconductor Ltd. 2 * Copyright (C) 2015-2017 Dialog Semiconductor
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -18,7 +18,31 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/mfd/da9062/registers.h> 19#include <linux/mfd/da9062/registers.h>
20 20
21/* Interrupts */ 21enum da9062_compatible_types {
22 COMPAT_TYPE_DA9061 = 1,
23 COMPAT_TYPE_DA9062,
24};
25
26enum da9061_irqs {
27 /* IRQ A */
28 DA9061_IRQ_ONKEY,
29 DA9061_IRQ_WDG_WARN,
30 DA9061_IRQ_SEQ_RDY,
31 /* IRQ B*/
32 DA9061_IRQ_TEMP,
33 DA9061_IRQ_LDO_LIM,
34 DA9061_IRQ_DVC_RDY,
35 DA9061_IRQ_VDD_WARN,
36 /* IRQ C */
37 DA9061_IRQ_GPI0,
38 DA9061_IRQ_GPI1,
39 DA9061_IRQ_GPI2,
40 DA9061_IRQ_GPI3,
41 DA9061_IRQ_GPI4,
42
43 DA9061_NUM_IRQ,
44};
45
22enum da9062_irqs { 46enum da9062_irqs {
23 /* IRQ A */ 47 /* IRQ A */
24 DA9062_IRQ_ONKEY, 48 DA9062_IRQ_ONKEY,
@@ -45,6 +69,7 @@ struct da9062 {
45 struct device *dev; 69 struct device *dev;
46 struct regmap *regmap; 70 struct regmap *regmap;
47 struct regmap_irq_chip_data *regmap_irq; 71 struct regmap_irq_chip_data *regmap_irq;
72 enum da9062_compatible_types chip_type;
48}; 73};
49 74
50#endif /* __MFD_DA9062_CORE_H__ */ 75#endif /* __MFD_DA9062_CORE_H__ */
diff --git a/include/linux/mfd/da9062/registers.h b/include/linux/mfd/da9062/registers.h
index 97790d1b02c5..18d576aed902 100644
--- a/include/linux/mfd/da9062/registers.h
+++ b/include/linux/mfd/da9062/registers.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * registers.h - REGISTERS H for DA9062 2 * Copyright (C) 2015-2017 Dialog Semiconductor
3 * Copyright (C) 2015 Dialog Semiconductor Ltd.
4 * 3 *
5 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -18,6 +17,8 @@
18 17
19#define DA9062_PMIC_DEVICE_ID 0x62 18#define DA9062_PMIC_DEVICE_ID 0x62
20#define DA9062_PMIC_VARIANT_MRC_AA 0x01 19#define DA9062_PMIC_VARIANT_MRC_AA 0x01
20#define DA9062_PMIC_VARIANT_VRC_DA9061 0x01
21#define DA9062_PMIC_VARIANT_VRC_DA9062 0x02
21 22
22#define DA9062_I2C_PAGE_SEL_SHIFT 1 23#define DA9062_I2C_PAGE_SEL_SHIFT 1
23 24
diff --git a/include/linux/mfd/intel_bxtwc.h b/include/linux/mfd/intel_soc_pmic_bxtwc.h
index 1a0ee9d6efe9..0c351bc85d2d 100644
--- a/include/linux/mfd/intel_bxtwc.h
+++ b/include/linux/mfd/intel_soc_pmic_bxtwc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * intel_bxtwc.h - Header file for Intel Broxton Whiskey Cove PMIC 2 * Header file for Intel Broxton Whiskey Cove PMIC
3 * 3 *
4 * Copyright (C) 2015 Intel Corporation. All rights reserved. 4 * Copyright (C) 2015 Intel Corporation. All rights reserved.
5 * 5 *
@@ -13,8 +13,6 @@
13 * more details. 13 * more details.
14 */ 14 */
15 15
16#include <linux/mfd/intel_soc_pmic.h>
17
18#ifndef __INTEL_BXTWC_H__ 16#ifndef __INTEL_BXTWC_H__
19#define __INTEL_BXTWC_H__ 17#define __INTEL_BXTWC_H__
20 18
diff --git a/include/linux/mfd/motorola-cpcap.h b/include/linux/mfd/motorola-cpcap.h
index b4031c2b2214..aefc49cb7ba9 100644
--- a/include/linux/mfd/motorola-cpcap.h
+++ b/include/linux/mfd/motorola-cpcap.h
@@ -14,6 +14,9 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#include <linux/device.h>
18#include <linux/regmap.h>
19
17#define CPCAP_VENDOR_ST 0 20#define CPCAP_VENDOR_ST 0
18#define CPCAP_VENDOR_TI 1 21#define CPCAP_VENDOR_TI 1
19 22
@@ -290,3 +293,5 @@ static inline int cpcap_get_vendor(struct device *dev,
290 293
291 return 0; 294 return 0;
292} 295}
296
297extern int cpcap_sense_virq(struct regmap *regmap, int virq);
diff --git a/include/linux/mfd/mxs-lradc.h b/include/linux/mfd/mxs-lradc.h
new file mode 100644
index 000000000000..661a4521f723
--- /dev/null
+++ b/include/linux/mfd/mxs-lradc.h
@@ -0,0 +1,187 @@
1/*
2 * Freescale MXS Low Resolution Analog-to-Digital Converter driver
3 *
4 * Copyright (c) 2012 DENX Software Engineering, GmbH.
5 * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
6 *
7 * Author: Marek Vasut <marex@denx.de>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
19
20#ifndef __MFD_MXS_LRADC_H
21#define __MFD_MXS_LRADC_H
22
23#include <linux/bitops.h>
24#include <linux/io.h>
25#include <linux/stmp_device.h>
26
27#define LRADC_MAX_DELAY_CHANS 4
28#define LRADC_MAX_MAPPED_CHANS 8
29#define LRADC_MAX_TOTAL_CHANS 16
30
31#define LRADC_DELAY_TIMER_HZ 2000
32
33#define LRADC_CTRL0 0x00
34# define LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE BIT(23)
35# define LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE BIT(22)
36# define LRADC_CTRL0_MX28_YNNSW /* YM */ BIT(21)
37# define LRADC_CTRL0_MX28_YPNSW /* YP */ BIT(20)
38# define LRADC_CTRL0_MX28_YPPSW /* YP */ BIT(19)
39# define LRADC_CTRL0_MX28_XNNSW /* XM */ BIT(18)
40# define LRADC_CTRL0_MX28_XNPSW /* XM */ BIT(17)
41# define LRADC_CTRL0_MX28_XPPSW /* XP */ BIT(16)
42
43# define LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE BIT(20)
44# define LRADC_CTRL0_MX23_YM BIT(19)
45# define LRADC_CTRL0_MX23_XM BIT(18)
46# define LRADC_CTRL0_MX23_YP BIT(17)
47# define LRADC_CTRL0_MX23_XP BIT(16)
48
49# define LRADC_CTRL0_MX28_PLATE_MASK \
50 (LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE | \
51 LRADC_CTRL0_MX28_YNNSW | LRADC_CTRL0_MX28_YPNSW | \
52 LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW | \
53 LRADC_CTRL0_MX28_XNPSW | LRADC_CTRL0_MX28_XPPSW)
54
55# define LRADC_CTRL0_MX23_PLATE_MASK \
56 (LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE | \
57 LRADC_CTRL0_MX23_YM | LRADC_CTRL0_MX23_XM | \
58 LRADC_CTRL0_MX23_YP | LRADC_CTRL0_MX23_XP)
59
60#define LRADC_CTRL1 0x10
61#define LRADC_CTRL1_TOUCH_DETECT_IRQ_EN BIT(24)
62#define LRADC_CTRL1_LRADC_IRQ_EN(n) (1 << ((n) + 16))
63#define LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK (0x1fff << 16)
64#define LRADC_CTRL1_MX23_LRADC_IRQ_EN_MASK (0x01ff << 16)
65#define LRADC_CTRL1_LRADC_IRQ_EN_OFFSET 16
66#define LRADC_CTRL1_TOUCH_DETECT_IRQ BIT(8)
67#define LRADC_CTRL1_LRADC_IRQ(n) BIT(n)
68#define LRADC_CTRL1_MX28_LRADC_IRQ_MASK 0x1fff
69#define LRADC_CTRL1_MX23_LRADC_IRQ_MASK 0x01ff
70#define LRADC_CTRL1_LRADC_IRQ_OFFSET 0
71
72#define LRADC_CTRL2 0x20
73#define LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET 24
74#define LRADC_CTRL2_TEMPSENSE_PWD BIT(15)
75
76#define LRADC_STATUS 0x40
77#define LRADC_STATUS_TOUCH_DETECT_RAW BIT(0)
78
79#define LRADC_CH(n) (0x50 + (0x10 * (n)))
80#define LRADC_CH_ACCUMULATE BIT(29)
81#define LRADC_CH_NUM_SAMPLES_MASK (0x1f << 24)
82#define LRADC_CH_NUM_SAMPLES_OFFSET 24
83#define LRADC_CH_NUM_SAMPLES(x) \
84 ((x) << LRADC_CH_NUM_SAMPLES_OFFSET)
85#define LRADC_CH_VALUE_MASK 0x3ffff
86#define LRADC_CH_VALUE_OFFSET 0
87
88#define LRADC_DELAY(n) (0xd0 + (0x10 * (n)))
89#define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xffUL << 24)
90#define LRADC_DELAY_TRIGGER_LRADCS_OFFSET 24
91#define LRADC_DELAY_TRIGGER(x) \
92 (((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \
93 LRADC_DELAY_TRIGGER_LRADCS_MASK)
94#define LRADC_DELAY_KICK BIT(20)
95#define LRADC_DELAY_TRIGGER_DELAYS_MASK (0xf << 16)
96#define LRADC_DELAY_TRIGGER_DELAYS_OFFSET 16
97#define LRADC_DELAY_TRIGGER_DELAYS(x) \
98 (((x) << LRADC_DELAY_TRIGGER_DELAYS_OFFSET) & \
99 LRADC_DELAY_TRIGGER_DELAYS_MASK)
100#define LRADC_DELAY_LOOP_COUNT_MASK (0x1f << 11)
101#define LRADC_DELAY_LOOP_COUNT_OFFSET 11
102#define LRADC_DELAY_LOOP(x) \
103 (((x) << LRADC_DELAY_LOOP_COUNT_OFFSET) & \
104 LRADC_DELAY_LOOP_COUNT_MASK)
105#define LRADC_DELAY_DELAY_MASK 0x7ff
106#define LRADC_DELAY_DELAY_OFFSET 0
107#define LRADC_DELAY_DELAY(x) \
108 (((x) << LRADC_DELAY_DELAY_OFFSET) & \
109 LRADC_DELAY_DELAY_MASK)
110
111#define LRADC_CTRL4 0x140
112#define LRADC_CTRL4_LRADCSELECT_MASK(n) (0xf << ((n) * 4))
113#define LRADC_CTRL4_LRADCSELECT_OFFSET(n) ((n) * 4)
114#define LRADC_CTRL4_LRADCSELECT(n, x) \
115 (((x) << LRADC_CTRL4_LRADCSELECT_OFFSET(n)) & \
116 LRADC_CTRL4_LRADCSELECT_MASK(n))
117
118#define LRADC_RESOLUTION 12
119#define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1)
120
121#define BUFFER_VCHANS_LIMITED 0x3f
122#define BUFFER_VCHANS_ALL 0xff
123
124 /*
125 * Certain LRADC channels are shared between touchscreen
126 * and/or touch-buttons and generic LRADC block. Therefore when using
127 * either of these, these channels are not available for the regular
128 * sampling. The shared channels are as follows:
129 *
130 * CH0 -- Touch button #0
131 * CH1 -- Touch button #1
132 * CH2 -- Touch screen XPUL
133 * CH3 -- Touch screen YPLL
134 * CH4 -- Touch screen XNUL
135 * CH5 -- Touch screen YNLR
136 * CH6 -- Touch screen WIPER (5-wire only)
137 *
138 * The bit fields below represents which parts of the LRADC block are
139 * switched into special mode of operation. These channels can not
140 * be sampled as regular LRADC channels. The driver will refuse any
141 * attempt to sample these channels.
142 */
143#define CHAN_MASK_TOUCHBUTTON (BIT(1) | BIT(0))
144#define CHAN_MASK_TOUCHSCREEN_4WIRE (0xf << 2)
145#define CHAN_MASK_TOUCHSCREEN_5WIRE (0x1f << 2)
146
147enum mxs_lradc_id {
148 IMX23_LRADC,
149 IMX28_LRADC,
150};
151
152enum mxs_lradc_ts_wires {
153 MXS_LRADC_TOUCHSCREEN_NONE = 0,
154 MXS_LRADC_TOUCHSCREEN_4WIRE,
155 MXS_LRADC_TOUCHSCREEN_5WIRE,
156};
157
158/**
159 * struct mxs_lradc
160 * @soc: soc type (IMX23 or IMX28)
161 * @clk: 2 kHz clock for delay units
162 * @buffer_vchans: channels that can be used during buffered capture
163 * @touchscreen_wire: touchscreen type (4-wire or 5-wire)
164 * @use_touchbutton: button state (on or off)
165 */
166struct mxs_lradc {
167 enum mxs_lradc_id soc;
168 struct clk *clk;
169 u8 buffer_vchans;
170
171 enum mxs_lradc_ts_wires touchscreen_wire;
172 bool use_touchbutton;
173};
174
175static inline u32 mxs_lradc_irq_mask(struct mxs_lradc *lradc)
176{
177 switch (lradc->soc) {
178 case IMX23_LRADC:
179 return LRADC_CTRL1_MX23_LRADC_IRQ_MASK;
180 case IMX28_LRADC:
181 return LRADC_CTRL1_MX28_LRADC_IRQ_MASK;
182 default:
183 return 0;
184 }
185}
186
187#endif /* __MXS_LRADC_H */
diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h
index d0300045f04a..4a0abbc10ef6 100644
--- a/include/linux/mfd/stm32-timers.h
+++ b/include/linux/mfd/stm32-timers.h
@@ -21,6 +21,7 @@
21#define TIM_CCMR1 0x18 /* Capt/Comp 1 Mode Reg */ 21#define TIM_CCMR1 0x18 /* Capt/Comp 1 Mode Reg */
22#define TIM_CCMR2 0x1C /* Capt/Comp 2 Mode Reg */ 22#define TIM_CCMR2 0x1C /* Capt/Comp 2 Mode Reg */
23#define TIM_CCER 0x20 /* Capt/Comp Enable Reg */ 23#define TIM_CCER 0x20 /* Capt/Comp Enable Reg */
24#define TIM_CNT 0x24 /* Counter */
24#define TIM_PSC 0x28 /* Prescaler */ 25#define TIM_PSC 0x28 /* Prescaler */
25#define TIM_ARR 0x2c /* Auto-Reload Register */ 26#define TIM_ARR 0x2c /* Auto-Reload Register */
26#define TIM_CCR1 0x34 /* Capt/Comp Register 1 */ 27#define TIM_CCR1 0x34 /* Capt/Comp Register 1 */
@@ -30,6 +31,7 @@
30#define TIM_BDTR 0x44 /* Break and Dead-Time Reg */ 31#define TIM_BDTR 0x44 /* Break and Dead-Time Reg */
31 32
32#define TIM_CR1_CEN BIT(0) /* Counter Enable */ 33#define TIM_CR1_CEN BIT(0) /* Counter Enable */
34#define TIM_CR1_DIR BIT(4) /* Counter Direction */
33#define TIM_CR1_ARPE BIT(7) /* Auto-reload Preload Ena */ 35#define TIM_CR1_ARPE BIT(7) /* Auto-reload Preload Ena */
34#define TIM_CR2_MMS (BIT(4) | BIT(5) | BIT(6)) /* Master mode selection */ 36#define TIM_CR2_MMS (BIT(4) | BIT(5) | BIT(6)) /* Master mode selection */
35#define TIM_SMCR_SMS (BIT(0) | BIT(1) | BIT(2)) /* Slave mode selection */ 37#define TIM_SMCR_SMS (BIT(0) | BIT(1) | BIT(2)) /* Slave mode selection */
diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h
index d7a29f246d64..139872c2e0fe 100644
--- a/include/linux/mfd/sun4i-gpadc.h
+++ b/include/linux/mfd/sun4i-gpadc.h
@@ -28,6 +28,7 @@
28#define SUN4I_GPADC_CTRL1_TP_MODE_EN BIT(4) 28#define SUN4I_GPADC_CTRL1_TP_MODE_EN BIT(4)
29#define SUN4I_GPADC_CTRL1_TP_ADC_SELECT BIT(3) 29#define SUN4I_GPADC_CTRL1_TP_ADC_SELECT BIT(3)
30#define SUN4I_GPADC_CTRL1_ADC_CHAN_SELECT(x) (GENMASK(2, 0) & (x)) 30#define SUN4I_GPADC_CTRL1_ADC_CHAN_SELECT(x) (GENMASK(2, 0) & (x))
31#define SUN4I_GPADC_CTRL1_ADC_CHAN_MASK GENMASK(2, 0)
31 32
32/* TP_CTRL1 bits for sun6i SOCs */ 33/* TP_CTRL1 bits for sun6i SOCs */
33#define SUN6I_GPADC_CTRL1_TOUCH_PAN_CALI_EN BIT(7) 34#define SUN6I_GPADC_CTRL1_TOUCH_PAN_CALI_EN BIT(7)
@@ -35,6 +36,11 @@
35#define SUN6I_GPADC_CTRL1_TP_MODE_EN BIT(5) 36#define SUN6I_GPADC_CTRL1_TP_MODE_EN BIT(5)
36#define SUN6I_GPADC_CTRL1_TP_ADC_SELECT BIT(4) 37#define SUN6I_GPADC_CTRL1_TP_ADC_SELECT BIT(4)
37#define SUN6I_GPADC_CTRL1_ADC_CHAN_SELECT(x) (GENMASK(3, 0) & BIT(x)) 38#define SUN6I_GPADC_CTRL1_ADC_CHAN_SELECT(x) (GENMASK(3, 0) & BIT(x))
39#define SUN6I_GPADC_CTRL1_ADC_CHAN_MASK GENMASK(3, 0)
40
41/* TP_CTRL1 bits for sun8i SoCs */
42#define SUN8I_GPADC_CTRL1_CHOP_TEMP_EN BIT(8)
43#define SUN8I_GPADC_CTRL1_GPADC_CALI_EN BIT(7)
38 44
39#define SUN4I_GPADC_CTRL2 0x08 45#define SUN4I_GPADC_CTRL2 0x08
40 46
diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
index be6ebe64eebe..afa266169800 100644
--- a/include/linux/mfd/syscon/atmel-smc.h
+++ b/include/linux/mfd/syscon/atmel-smc.h
@@ -17,157 +17,92 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/regmap.h> 18#include <linux/regmap.h>
19 19
20#define AT91SAM9_SMC_GENERIC 0x00 20#define ATMEL_SMC_SETUP(cs) (((cs) * 0x10))
21#define AT91SAM9_SMC_GENERIC_BLK_SZ 0x10 21#define ATMEL_HSMC_SETUP(cs) (0x600 + ((cs) * 0x14))
22 22#define ATMEL_SMC_PULSE(cs) (((cs) * 0x10) + 0x4)
23#define SAMA5_SMC_GENERIC 0x600 23#define ATMEL_HSMC_PULSE(cs) (0x600 + ((cs) * 0x14) + 0x4)
24#define SAMA5_SMC_GENERIC_BLK_SZ 0x14 24#define ATMEL_SMC_CYCLE(cs) (((cs) * 0x10) + 0x8)
25 25#define ATMEL_HSMC_CYCLE(cs) (0x600 + ((cs) * 0x14) + 0x8)
26#define AT91SAM9_SMC_SETUP(o) ((o) + 0x00) 26#define ATMEL_SMC_NWE_SHIFT 0
27#define AT91SAM9_SMC_NWESETUP(x) (x) 27#define ATMEL_SMC_NCS_WR_SHIFT 8
28#define AT91SAM9_SMC_NCS_WRSETUP(x) ((x) << 8) 28#define ATMEL_SMC_NRD_SHIFT 16
29#define AT91SAM9_SMC_NRDSETUP(x) ((x) << 16) 29#define ATMEL_SMC_NCS_RD_SHIFT 24
30#define AT91SAM9_SMC_NCS_NRDSETUP(x) ((x) << 24) 30
31 31#define ATMEL_SMC_MODE(cs) (((cs) * 0x10) + 0xc)
32#define AT91SAM9_SMC_PULSE(o) ((o) + 0x04) 32#define ATMEL_HSMC_MODE(cs) (0x600 + ((cs) * 0x14) + 0x10)
33#define AT91SAM9_SMC_NWEPULSE(x) (x) 33#define ATMEL_SMC_MODE_READMODE_MASK BIT(0)
34#define AT91SAM9_SMC_NCS_WRPULSE(x) ((x) << 8) 34#define ATMEL_SMC_MODE_READMODE_NCS (0 << 0)
35#define AT91SAM9_SMC_NRDPULSE(x) ((x) << 16) 35#define ATMEL_SMC_MODE_READMODE_NRD (1 << 0)
36#define AT91SAM9_SMC_NCS_NRDPULSE(x) ((x) << 24) 36#define ATMEL_SMC_MODE_WRITEMODE_MASK BIT(1)
37 37#define ATMEL_SMC_MODE_WRITEMODE_NCS (0 << 1)
38#define AT91SAM9_SMC_CYCLE(o) ((o) + 0x08) 38#define ATMEL_SMC_MODE_WRITEMODE_NWE (1 << 1)
39#define AT91SAM9_SMC_NWECYCLE(x) (x) 39#define ATMEL_SMC_MODE_EXNWMODE_MASK GENMASK(5, 4)
40#define AT91SAM9_SMC_NRDCYCLE(x) ((x) << 16) 40#define ATMEL_SMC_MODE_EXNWMODE_DISABLE (0 << 4)
41 41#define ATMEL_SMC_MODE_EXNWMODE_FROZEN (2 << 4)
42#define AT91SAM9_SMC_MODE(o) ((o) + 0x0c) 42#define ATMEL_SMC_MODE_EXNWMODE_READY (3 << 4)
43#define SAMA5_SMC_MODE(o) ((o) + 0x10) 43#define ATMEL_SMC_MODE_BAT_MASK BIT(8)
44#define AT91_SMC_READMODE BIT(0) 44#define ATMEL_SMC_MODE_BAT_SELECT (0 << 8)
45#define AT91_SMC_READMODE_NCS (0 << 0) 45#define ATMEL_SMC_MODE_BAT_WRITE (1 << 8)
46#define AT91_SMC_READMODE_NRD (1 << 0) 46#define ATMEL_SMC_MODE_DBW_MASK GENMASK(13, 12)
47#define AT91_SMC_WRITEMODE BIT(1) 47#define ATMEL_SMC_MODE_DBW_8 (0 << 12)
48#define AT91_SMC_WRITEMODE_NCS (0 << 1) 48#define ATMEL_SMC_MODE_DBW_16 (1 << 12)
49#define AT91_SMC_WRITEMODE_NWE (1 << 1) 49#define ATMEL_SMC_MODE_DBW_32 (2 << 12)
50#define AT91_SMC_EXNWMODE GENMASK(5, 4) 50#define ATMEL_SMC_MODE_TDF_MASK GENMASK(19, 16)
51#define AT91_SMC_EXNWMODE_DISABLE (0 << 4) 51#define ATMEL_SMC_MODE_TDF(x) (((x) - 1) << 16)
52#define AT91_SMC_EXNWMODE_FROZEN (2 << 4) 52#define ATMEL_SMC_MODE_TDF_MAX 16
53#define AT91_SMC_EXNWMODE_READY (3 << 4) 53#define ATMEL_SMC_MODE_TDF_MIN 1
54#define AT91_SMC_BAT BIT(8) 54#define ATMEL_SMC_MODE_TDFMODE_OPTIMIZED BIT(20)
55#define AT91_SMC_BAT_SELECT (0 << 8) 55#define ATMEL_SMC_MODE_PMEN BIT(24)
56#define AT91_SMC_BAT_WRITE (1 << 8) 56#define ATMEL_SMC_MODE_PS_MASK GENMASK(29, 28)
57#define AT91_SMC_DBW GENMASK(13, 12) 57#define ATMEL_SMC_MODE_PS_4 (0 << 28)
58#define AT91_SMC_DBW_8 (0 << 12) 58#define ATMEL_SMC_MODE_PS_8 (1 << 28)
59#define AT91_SMC_DBW_16 (1 << 12) 59#define ATMEL_SMC_MODE_PS_16 (2 << 28)
60#define AT91_SMC_DBW_32 (2 << 12) 60#define ATMEL_SMC_MODE_PS_32 (3 << 28)
61#define AT91_SMC_TDF GENMASK(19, 16) 61
62#define AT91_SMC_TDF_(x) ((((x) - 1) << 16) & AT91_SMC_TDF) 62#define ATMEL_HSMC_TIMINGS(cs) (0x600 + ((cs) * 0x14) + 0xc)
63#define AT91_SMC_TDF_MAX 16 63#define ATMEL_HSMC_TIMINGS_OCMS BIT(12)
64#define AT91_SMC_TDFMODE_OPTIMIZED BIT(20) 64#define ATMEL_HSMC_TIMINGS_RBNSEL(x) ((x) << 28)
65#define AT91_SMC_PMEN BIT(24) 65#define ATMEL_HSMC_TIMINGS_NFSEL BIT(31)
66#define AT91_SMC_PS GENMASK(29, 28) 66#define ATMEL_HSMC_TIMINGS_TCLR_SHIFT 0
67#define AT91_SMC_PS_4 (0 << 28) 67#define ATMEL_HSMC_TIMINGS_TADL_SHIFT 4
68#define AT91_SMC_PS_8 (1 << 28) 68#define ATMEL_HSMC_TIMINGS_TAR_SHIFT 8
69#define AT91_SMC_PS_16 (2 << 28) 69#define ATMEL_HSMC_TIMINGS_TRR_SHIFT 16
70#define AT91_SMC_PS_32 (3 << 28) 70#define ATMEL_HSMC_TIMINGS_TWB_SHIFT 24
71 71
72 72/**
73/* 73 * struct atmel_smc_cs_conf - SMC CS config as described in the datasheet.
74 * This function converts a setup timing expressed in nanoseconds into an 74 * @setup: NCS/NWE/NRD setup timings (not applicable to at91rm9200)
75 * encoded value that can be written in the SMC_SETUP register. 75 * @pulse: NCS/NWE/NRD pulse timings (not applicable to at91rm9200)
76 * 76 * @cycle: NWE/NRD cycle timings (not applicable to at91rm9200)
77 * The following formula is described in atmel datasheets (section 77 * @timings: advanced NAND related timings (only applicable to HSMC)
78 * "SMC Setup Register"): 78 * @mode: all kind of config parameters (see the fields definition above).
79 * 79 * The mode fields are different on at91rm9200
80 * setup length = (128* SETUP[5] + SETUP[4:0])
81 *
82 * where setup length is the timing expressed in cycles.
83 */
84static inline u32 at91sam9_smc_setup_ns_to_cycles(unsigned int clk_rate,
85 u32 timing_ns)
86{
87 u32 clk_period = DIV_ROUND_UP(NSEC_PER_SEC, clk_rate);
88 u32 coded_cycles = 0;
89 u32 cycles;
90
91 cycles = DIV_ROUND_UP(timing_ns, clk_period);
92 if (cycles / 32) {
93 coded_cycles |= 1 << 5;
94 if (cycles < 128)
95 cycles = 0;
96 }
97
98 coded_cycles |= cycles % 32;
99
100 return coded_cycles;
101}
102
103/*
104 * This function converts a pulse timing expressed in nanoseconds into an
105 * encoded value that can be written in the SMC_PULSE register.
106 *
107 * The following formula is described in atmel datasheets (section
108 * "SMC Pulse Register"):
109 *
110 * pulse length = (256* PULSE[6] + PULSE[5:0])
111 *
112 * where pulse length is the timing expressed in cycles.
113 */ 80 */
114static inline u32 at91sam9_smc_pulse_ns_to_cycles(unsigned int clk_rate, 81struct atmel_smc_cs_conf {
115 u32 timing_ns) 82 u32 setup;
116{ 83 u32 pulse;
117 u32 clk_period = DIV_ROUND_UP(NSEC_PER_SEC, clk_rate); 84 u32 cycle;
118 u32 coded_cycles = 0; 85 u32 timings;
119 u32 cycles; 86 u32 mode;
120 87};
121 cycles = DIV_ROUND_UP(timing_ns, clk_period); 88
122 if (cycles / 64) { 89void atmel_smc_cs_conf_init(struct atmel_smc_cs_conf *conf);
123 coded_cycles |= 1 << 6; 90int atmel_smc_cs_conf_set_timing(struct atmel_smc_cs_conf *conf,
124 if (cycles < 256) 91 unsigned int shift,
125 cycles = 0; 92 unsigned int ncycles);
126 } 93int atmel_smc_cs_conf_set_setup(struct atmel_smc_cs_conf *conf,
127 94 unsigned int shift, unsigned int ncycles);
128 coded_cycles |= cycles % 64; 95int atmel_smc_cs_conf_set_pulse(struct atmel_smc_cs_conf *conf,
129 96 unsigned int shift, unsigned int ncycles);
130 return coded_cycles; 97int atmel_smc_cs_conf_set_cycle(struct atmel_smc_cs_conf *conf,
131} 98 unsigned int shift, unsigned int ncycles);
132 99void atmel_smc_cs_conf_apply(struct regmap *regmap, int cs,
133/* 100 const struct atmel_smc_cs_conf *conf);
134 * This function converts a cycle timing expressed in nanoseconds into an 101void atmel_hsmc_cs_conf_apply(struct regmap *regmap, int cs,
135 * encoded value that can be written in the SMC_CYCLE register. 102 const struct atmel_smc_cs_conf *conf);
136 * 103void atmel_smc_cs_conf_get(struct regmap *regmap, int cs,
137 * The following formula is described in atmel datasheets (section 104 struct atmel_smc_cs_conf *conf);
138 * "SMC Cycle Register"): 105void atmel_hsmc_cs_conf_get(struct regmap *regmap, int cs,
139 * 106 struct atmel_smc_cs_conf *conf);
140 * cycle length = (CYCLE[8:7]*256 + CYCLE[6:0])
141 *
142 * where cycle length is the timing expressed in cycles.
143 */
144static inline u32 at91sam9_smc_cycle_ns_to_cycles(unsigned int clk_rate,
145 u32 timing_ns)
146{
147 u32 clk_period = DIV_ROUND_UP(NSEC_PER_SEC, clk_rate);
148 u32 coded_cycles = 0;
149 u32 cycles;
150
151 cycles = DIV_ROUND_UP(timing_ns, clk_period);
152 if (cycles / 128) {
153 coded_cycles = cycles / 256;
154 cycles %= 256;
155 if (cycles >= 128) {
156 coded_cycles++;
157 cycles = 0;
158 }
159
160 if (coded_cycles > 0x3) {
161 coded_cycles = 0x3;
162 cycles = 0x7f;
163 }
164
165 coded_cycles <<= 7;
166 }
167
168 coded_cycles |= cycles % 128;
169
170 return coded_cycles;
171}
172 107
173#endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */ 108#endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */
diff --git a/include/linux/mfd/syscon/exynos5-pmu.h b/include/linux/mfd/syscon/exynos5-pmu.h
index c28ff21ca4d2..b4942a32b81d 100644
--- a/include/linux/mfd/syscon/exynos5-pmu.h
+++ b/include/linux/mfd/syscon/exynos5-pmu.h
@@ -12,41 +12,8 @@
12#ifndef _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_ 12#ifndef _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_
13#define _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_ 13#define _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_
14 14
15/* Exynos5 PMU register definitions */
16#define EXYNOS5_HDMI_PHY_CONTROL (0x700)
17#define EXYNOS5_USBDRD_PHY_CONTROL (0x704)
18
19/* Exynos5250 specific register definitions */
20#define EXYNOS5_USBHOST_PHY_CONTROL (0x708)
21#define EXYNOS5_EFNAND_PHY_CONTROL (0x70c)
22#define EXYNOS5_MIPI_PHY0_CONTROL (0x710)
23#define EXYNOS5_MIPI_PHY1_CONTROL (0x714)
24#define EXYNOS5_ADC_PHY_CONTROL (0x718)
25#define EXYNOS5_MTCADC_PHY_CONTROL (0x71c)
26#define EXYNOS5_DPTX_PHY_CONTROL (0x720)
27#define EXYNOS5_SATA_PHY_CONTROL (0x724)
28
29/* Exynos5420 specific register definitions */
30#define EXYNOS5420_USBDRD1_PHY_CONTROL (0x708)
31#define EXYNOS5420_USBHOST_PHY_CONTROL (0x70c)
32#define EXYNOS5420_MIPI_PHY0_CONTROL (0x714)
33#define EXYNOS5420_MIPI_PHY1_CONTROL (0x718)
34#define EXYNOS5420_MIPI_PHY2_CONTROL (0x71c)
35#define EXYNOS5420_ADC_PHY_CONTROL (0x720)
36#define EXYNOS5420_MTCADC_PHY_CONTROL (0x724)
37#define EXYNOS5420_DPTX_PHY_CONTROL (0x728)
38
39/* Exynos5433 specific register definitions */
40#define EXYNOS5433_USBHOST30_PHY_CONTROL (0x728)
41#define EXYNOS5433_MIPI_PHY0_CONTROL (0x710)
42#define EXYNOS5433_MIPI_PHY1_CONTROL (0x714)
43#define EXYNOS5433_MIPI_PHY2_CONTROL (0x718)
44
45#define EXYNOS5_PHY_ENABLE BIT(0) 15#define EXYNOS5_PHY_ENABLE BIT(0)
46#define EXYNOS5_MIPI_PHY_S_RESETN BIT(1) 16#define EXYNOS5_MIPI_PHY_S_RESETN BIT(1)
47#define EXYNOS5_MIPI_PHY_M_RESETN BIT(2) 17#define EXYNOS5_MIPI_PHY_M_RESETN BIT(2)
48 18
49#define EXYNOS5433_PAD_RETENTION_AUD_OPTION (0x3028)
50#define EXYNOS5433_PAD_INITIATE_WAKEUP_FROM_LOWPWR BIT(28)
51
52#endif /* _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_ */ 19#endif /* _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_ */
diff --git a/include/linux/mfd/syscon/imx7-iomuxc-gpr.h b/include/linux/mfd/syscon/imx7-iomuxc-gpr.h
index 4585d6105d68..abbd52466573 100644
--- a/include/linux/mfd/syscon/imx7-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx7-iomuxc-gpr.h
@@ -44,4 +44,8 @@
44 44
45#define IMX7D_GPR5_CSI_MUX_CONTROL_MIPI (0x1 << 4) 45#define IMX7D_GPR5_CSI_MUX_CONTROL_MIPI (0x1 << 4)
46 46
47#define IMX7D_GPR12_PCIE_PHY_REFCLK_SEL BIT(5)
48
49#define IMX7D_GPR22_PCIE_PHY_PLL_LOCKED BIT(31)
50
47#endif /* __LINUX_IMX7_IOMUXC_GPR_H */ 51#endif /* __LINUX_IMX7_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/ti-lmu-register.h b/include/linux/mfd/ti-lmu-register.h
new file mode 100644
index 000000000000..2125c7c02818
--- /dev/null
+++ b/include/linux/mfd/ti-lmu-register.h
@@ -0,0 +1,280 @@
1/*
2 * TI LMU (Lighting Management Unit) Device Register Map
3 *
4 * Copyright 2017 Texas Instruments
5 *
6 * Author: Milo Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __MFD_TI_LMU_REGISTER_H__
14#define __MFD_TI_LMU_REGISTER_H__
15
16#include <linux/bitops.h>
17
18/* LM3532 */
19#define LM3532_REG_OUTPUT_CFG 0x10
20#define LM3532_ILED1_CFG_MASK 0x03
21#define LM3532_ILED2_CFG_MASK 0x0C
22#define LM3532_ILED3_CFG_MASK 0x30
23#define LM3532_ILED1_CFG_SHIFT 0
24#define LM3532_ILED2_CFG_SHIFT 2
25#define LM3532_ILED3_CFG_SHIFT 4
26
27#define LM3532_REG_RAMPUP 0x12
28#define LM3532_REG_RAMPDN LM3532_REG_RAMPUP
29#define LM3532_RAMPUP_MASK 0x07
30#define LM3532_RAMPUP_SHIFT 0
31#define LM3532_RAMPDN_MASK 0x38
32#define LM3532_RAMPDN_SHIFT 3
33
34#define LM3532_REG_ENABLE 0x1D
35
36#define LM3532_REG_PWM_A_CFG 0x13
37#define LM3532_PWM_A_MASK 0x05 /* zone 0 */
38#define LM3532_PWM_ZONE_0 BIT(2)
39
40#define LM3532_REG_PWM_B_CFG 0x14
41#define LM3532_PWM_B_MASK 0x09 /* zone 1 */
42#define LM3532_PWM_ZONE_1 BIT(3)
43
44#define LM3532_REG_PWM_C_CFG 0x15
45#define LM3532_PWM_C_MASK 0x11 /* zone 2 */
46#define LM3532_PWM_ZONE_2 BIT(4)
47
48#define LM3532_REG_ZONE_CFG_A 0x16
49#define LM3532_REG_ZONE_CFG_B 0x18
50#define LM3532_REG_ZONE_CFG_C 0x1A
51#define LM3532_ZONE_MASK (BIT(2) | BIT(3) | BIT(4))
52#define LM3532_ZONE_0 0
53#define LM3532_ZONE_1 BIT(2)
54#define LM3532_ZONE_2 BIT(3)
55
56#define LM3532_REG_BRT_A 0x70 /* zone 0 */
57#define LM3532_REG_BRT_B 0x76 /* zone 1 */
58#define LM3532_REG_BRT_C 0x7C /* zone 2 */
59
60#define LM3532_MAX_REG 0x7E
61
62/* LM3631 */
63#define LM3631_REG_DEVCTRL 0x00
64#define LM3631_LCD_EN_MASK BIT(1)
65#define LM3631_BL_EN_MASK BIT(0)
66
67#define LM3631_REG_BRT_LSB 0x01
68#define LM3631_REG_BRT_MSB 0x02
69
70#define LM3631_REG_BL_CFG 0x06
71#define LM3631_BL_CHANNEL_MASK BIT(3)
72#define LM3631_BL_DUAL_CHANNEL 0
73#define LM3631_BL_SINGLE_CHANNEL BIT(3)
74#define LM3631_MAP_MASK BIT(5)
75#define LM3631_EXPONENTIAL_MAP 0
76
77#define LM3631_REG_BRT_MODE 0x08
78#define LM3631_MODE_MASK (BIT(1) | BIT(2) | BIT(3))
79#define LM3631_DEFAULT_MODE (BIT(1) | BIT(3))
80
81#define LM3631_REG_SLOPE 0x09
82#define LM3631_SLOPE_MASK 0xF0
83#define LM3631_SLOPE_SHIFT 4
84
85#define LM3631_REG_LDO_CTRL1 0x0A
86#define LM3631_EN_OREF_MASK BIT(0)
87#define LM3631_EN_VNEG_MASK BIT(1)
88#define LM3631_EN_VPOS_MASK BIT(2)
89
90#define LM3631_REG_LDO_CTRL2 0x0B
91#define LM3631_EN_CONT_MASK BIT(0)
92
93#define LM3631_REG_VOUT_CONT 0x0C
94#define LM3631_VOUT_CONT_MASK (BIT(6) | BIT(7))
95
96#define LM3631_REG_VOUT_BOOST 0x0C
97#define LM3631_REG_VOUT_POS 0x0D
98#define LM3631_REG_VOUT_NEG 0x0E
99#define LM3631_REG_VOUT_OREF 0x0F
100#define LM3631_VOUT_MASK 0x3F
101
102#define LM3631_REG_ENTIME_VCONT 0x0B
103#define LM3631_ENTIME_CONT_MASK 0x70
104
105#define LM3631_REG_ENTIME_VOREF 0x0F
106#define LM3631_REG_ENTIME_VPOS 0x10
107#define LM3631_REG_ENTIME_VNEG 0x11
108#define LM3631_ENTIME_MASK 0xF0
109#define LM3631_ENTIME_SHIFT 4
110
111#define LM3631_MAX_REG 0x16
112
113/* LM3632 */
114#define LM3632_REG_CONFIG1 0x02
115#define LM3632_OVP_MASK (BIT(5) | BIT(6) | BIT(7))
116#define LM3632_OVP_25V BIT(6)
117
118#define LM3632_REG_CONFIG2 0x03
119#define LM3632_SWFREQ_MASK BIT(7)
120#define LM3632_SWFREQ_1MHZ BIT(7)
121
122#define LM3632_REG_BRT_LSB 0x04
123#define LM3632_REG_BRT_MSB 0x05
124
125#define LM3632_REG_IO_CTRL 0x09
126#define LM3632_PWM_MASK BIT(6)
127#define LM3632_I2C_MODE 0
128#define LM3632_PWM_MODE BIT(6)
129
130#define LM3632_REG_ENABLE 0x0A
131#define LM3632_BL_EN_MASK BIT(0)
132#define LM3632_BL_CHANNEL_MASK (BIT(3) | BIT(4))
133#define LM3632_BL_SINGLE_CHANNEL BIT(4)
134#define LM3632_BL_DUAL_CHANNEL BIT(3)
135
136#define LM3632_REG_BIAS_CONFIG 0x0C
137#define LM3632_EXT_EN_MASK BIT(0)
138#define LM3632_EN_VNEG_MASK BIT(1)
139#define LM3632_EN_VPOS_MASK BIT(2)
140
141#define LM3632_REG_VOUT_BOOST 0x0D
142#define LM3632_REG_VOUT_POS 0x0E
143#define LM3632_REG_VOUT_NEG 0x0F
144#define LM3632_VOUT_MASK 0x3F
145
146#define LM3632_MAX_REG 0x10
147
148/* LM3633 */
149#define LM3633_REG_HVLED_OUTPUT_CFG 0x10
150#define LM3633_HVLED1_CFG_MASK BIT(0)
151#define LM3633_HVLED2_CFG_MASK BIT(1)
152#define LM3633_HVLED3_CFG_MASK BIT(2)
153#define LM3633_HVLED1_CFG_SHIFT 0
154#define LM3633_HVLED2_CFG_SHIFT 1
155#define LM3633_HVLED3_CFG_SHIFT 2
156
157#define LM3633_REG_BANK_SEL 0x11
158
159#define LM3633_REG_BL0_RAMP 0x12
160#define LM3633_REG_BL1_RAMP 0x13
161#define LM3633_BL_RAMPUP_MASK 0xF0
162#define LM3633_BL_RAMPUP_SHIFT 4
163#define LM3633_BL_RAMPDN_MASK 0x0F
164#define LM3633_BL_RAMPDN_SHIFT 0
165
166#define LM3633_REG_BL_RAMP_CONF 0x1B
167#define LM3633_BL_RAMP_MASK 0x0F
168#define LM3633_BL_RAMP_EACH 0x05
169
170#define LM3633_REG_PTN0_RAMP 0x1C
171#define LM3633_REG_PTN1_RAMP 0x1D
172#define LM3633_PTN_RAMPUP_MASK 0x70
173#define LM3633_PTN_RAMPUP_SHIFT 4
174#define LM3633_PTN_RAMPDN_MASK 0x07
175#define LM3633_PTN_RAMPDN_SHIFT 0
176
177#define LM3633_REG_LED_MAPPING_MODE 0x1F
178#define LM3633_LED_EXPONENTIAL BIT(1)
179
180#define LM3633_REG_IMAX_HVLED_A 0x20
181#define LM3633_REG_IMAX_HVLED_B 0x21
182#define LM3633_REG_IMAX_LVLED_BASE 0x22
183
184#define LM3633_REG_BL_FEEDBACK_ENABLE 0x28
185
186#define LM3633_REG_ENABLE 0x2B
187#define LM3633_LED_BANK_OFFSET 2
188
189#define LM3633_REG_PATTERN 0x2C
190
191#define LM3633_REG_BOOST_CFG 0x2D
192#define LM3633_OVP_MASK (BIT(1) | BIT(2))
193#define LM3633_OVP_40V 0x6
194
195#define LM3633_REG_PWM_CFG 0x2F
196#define LM3633_PWM_A_MASK BIT(0)
197#define LM3633_PWM_B_MASK BIT(1)
198
199#define LM3633_REG_BRT_HVLED_A_LSB 0x40
200#define LM3633_REG_BRT_HVLED_A_MSB 0x41
201#define LM3633_REG_BRT_HVLED_B_LSB 0x42
202#define LM3633_REG_BRT_HVLED_B_MSB 0x43
203
204#define LM3633_REG_BRT_LVLED_BASE 0x44
205
206#define LM3633_REG_PTN_DELAY 0x50
207
208#define LM3633_REG_PTN_LOWTIME 0x51
209
210#define LM3633_REG_PTN_HIGHTIME 0x52
211
212#define LM3633_REG_PTN_LOWBRT 0x53
213
214#define LM3633_REG_PTN_HIGHBRT LM3633_REG_BRT_LVLED_BASE
215
216#define LM3633_REG_BL_OPEN_FAULT_STATUS 0xB0
217
218#define LM3633_REG_BL_SHORT_FAULT_STATUS 0xB2
219
220#define LM3633_REG_MONITOR_ENABLE 0xB4
221
222#define LM3633_MAX_REG 0xB4
223
224/* LM3695 */
225#define LM3695_REG_GP 0x10
226#define LM3695_BL_CHANNEL_MASK BIT(3)
227#define LM3695_BL_DUAL_CHANNEL 0
228#define LM3695_BL_SINGLE_CHANNEL BIT(3)
229#define LM3695_BRT_RW_MASK BIT(2)
230#define LM3695_BL_EN_MASK BIT(0)
231
232#define LM3695_REG_BRT_LSB 0x13
233#define LM3695_REG_BRT_MSB 0x14
234
235#define LM3695_MAX_REG 0x14
236
237/* LM3697 */
238#define LM3697_REG_HVLED_OUTPUT_CFG 0x10
239#define LM3697_HVLED1_CFG_MASK BIT(0)
240#define LM3697_HVLED2_CFG_MASK BIT(1)
241#define LM3697_HVLED3_CFG_MASK BIT(2)
242#define LM3697_HVLED1_CFG_SHIFT 0
243#define LM3697_HVLED2_CFG_SHIFT 1
244#define LM3697_HVLED3_CFG_SHIFT 2
245
246#define LM3697_REG_BL0_RAMP 0x11
247#define LM3697_REG_BL1_RAMP 0x12
248#define LM3697_RAMPUP_MASK 0xF0
249#define LM3697_RAMPUP_SHIFT 4
250#define LM3697_RAMPDN_MASK 0x0F
251#define LM3697_RAMPDN_SHIFT 0
252
253#define LM3697_REG_RAMP_CONF 0x14
254#define LM3697_RAMP_MASK 0x0F
255#define LM3697_RAMP_EACH 0x05
256
257#define LM3697_REG_PWM_CFG 0x1C
258#define LM3697_PWM_A_MASK BIT(0)
259#define LM3697_PWM_B_MASK BIT(1)
260
261#define LM3697_REG_IMAX_A 0x17
262#define LM3697_REG_IMAX_B 0x18
263
264#define LM3697_REG_FEEDBACK_ENABLE 0x19
265
266#define LM3697_REG_BRT_A_LSB 0x20
267#define LM3697_REG_BRT_A_MSB 0x21
268#define LM3697_REG_BRT_B_LSB 0x22
269#define LM3697_REG_BRT_B_MSB 0x23
270
271#define LM3697_REG_ENABLE 0x24
272
273#define LM3697_REG_OPEN_FAULT_STATUS 0xB0
274
275#define LM3697_REG_SHORT_FAULT_STATUS 0xB2
276
277#define LM3697_REG_MONITOR_ENABLE 0xB4
278
279#define LM3697_MAX_REG 0xB4
280#endif
diff --git a/include/linux/mfd/ti-lmu.h b/include/linux/mfd/ti-lmu.h
new file mode 100644
index 000000000000..09d5f30384e5
--- /dev/null
+++ b/include/linux/mfd/ti-lmu.h
@@ -0,0 +1,87 @@
1/*
2 * TI LMU (Lighting Management Unit) Devices
3 *
4 * Copyright 2017 Texas Instruments
5 *
6 * Author: Milo Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __MFD_TI_LMU_H__
14#define __MFD_TI_LMU_H__
15
16#include <linux/gpio.h>
17#include <linux/notifier.h>
18#include <linux/regmap.h>
19
20/* Notifier event */
21#define LMU_EVENT_MONITOR_DONE 0x01
22
23enum ti_lmu_id {
24 LM3532,
25 LM3631,
26 LM3632,
27 LM3633,
28 LM3695,
29 LM3697,
30 LMU_MAX_ID,
31};
32
33enum ti_lmu_max_current {
34 LMU_IMAX_5mA,
35 LMU_IMAX_6mA,
36 LMU_IMAX_7mA = 0x03,
37 LMU_IMAX_8mA,
38 LMU_IMAX_9mA,
39 LMU_IMAX_10mA = 0x07,
40 LMU_IMAX_11mA,
41 LMU_IMAX_12mA,
42 LMU_IMAX_13mA,
43 LMU_IMAX_14mA,
44 LMU_IMAX_15mA = 0x0D,
45 LMU_IMAX_16mA,
46 LMU_IMAX_17mA,
47 LMU_IMAX_18mA,
48 LMU_IMAX_19mA,
49 LMU_IMAX_20mA = 0x13,
50 LMU_IMAX_21mA,
51 LMU_IMAX_22mA,
52 LMU_IMAX_23mA = 0x17,
53 LMU_IMAX_24mA,
54 LMU_IMAX_25mA,
55 LMU_IMAX_26mA,
56 LMU_IMAX_27mA = 0x1C,
57 LMU_IMAX_28mA,
58 LMU_IMAX_29mA,
59 LMU_IMAX_30mA,
60};
61
62enum lm363x_regulator_id {
63 LM3631_BOOST, /* Boost output */
64 LM3631_LDO_CONT, /* Display panel controller */
65 LM3631_LDO_OREF, /* Gamma reference */
66 LM3631_LDO_POS, /* Positive display bias output */
67 LM3631_LDO_NEG, /* Negative display bias output */
68 LM3632_BOOST, /* Boost output */
69 LM3632_LDO_POS, /* Positive display bias output */
70 LM3632_LDO_NEG, /* Negative display bias output */
71};
72
73/**
74 * struct ti_lmu
75 *
76 * @dev: Parent device pointer
77 * @regmap: Used for i2c communcation on accessing registers
78 * @en_gpio: GPIO for HWEN pin [Optional]
79 * @notifier: Notifier for reporting hwmon event
80 */
81struct ti_lmu {
82 struct device *dev;
83 struct regmap *regmap;
84 int en_gpio;
85 struct blocking_notifier_head notifier;
86};
87#endif
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 76c22648436f..b49fa67612f1 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -21,6 +21,8 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/regmap.h> 22#include <linux/regmap.h>
23#include <linux/mfd/wm831x/auxadc.h> 23#include <linux/mfd/wm831x/auxadc.h>
24#include <linux/mfd/wm831x/pdata.h>
25#include <linux/of.h>
24 26
25/* 27/*
26 * Register values. 28 * Register values.
@@ -367,6 +369,9 @@ struct wm831x {
367 369
368 struct regmap *regmap; 370 struct regmap *regmap;
369 371
372 struct wm831x_pdata pdata;
373 enum wm831x_parent type;
374
370 int irq; /* Our chip IRQ */ 375 int irq; /* Our chip IRQ */
371 struct mutex irq_lock; 376 struct mutex irq_lock;
372 struct irq_domain *irq_domain; 377 struct irq_domain *irq_domain;
@@ -412,7 +417,7 @@ int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
412int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg, 417int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
413 int count, u16 *buf); 418 int count, u16 *buf);
414 419
415int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq); 420int wm831x_device_init(struct wm831x *wm831x, int irq);
416void wm831x_device_exit(struct wm831x *wm831x); 421void wm831x_device_exit(struct wm831x *wm831x);
417int wm831x_device_suspend(struct wm831x *wm831x); 422int wm831x_device_suspend(struct wm831x *wm831x);
418void wm831x_device_shutdown(struct wm831x *wm831x); 423void wm831x_device_shutdown(struct wm831x *wm831x);
@@ -427,4 +432,6 @@ static inline int wm831x_irq(struct wm831x *wm831x, int irq)
427 432
428extern struct regmap_config wm831x_regmap_config; 433extern struct regmap_config wm831x_regmap_config;
429 434
435extern const struct of_device_id wm831x_of_match[];
436
430#endif 437#endif
diff --git a/include/linux/mg_disk.h b/include/linux/mg_disk.h
deleted file mode 100644
index e11f4d9f1c2e..000000000000
--- a/include/linux/mg_disk.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * include/linux/mg_disk.c
3 *
4 * Private data for mflash platform driver
5 *
6 * (c) 2008 mGine Co.,LTD
7 * (c) 2008 unsik Kim <donari75@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __MG_DISK_H__
15#define __MG_DISK_H__
16
17/* name for platform device */
18#define MG_DEV_NAME "mg_disk"
19
20/* names of GPIO resource */
21#define MG_RST_PIN "mg_rst"
22/* except MG_BOOT_DEV, reset-out pin should be assigned */
23#define MG_RSTOUT_PIN "mg_rstout"
24
25/* device attribution */
26/* use mflash as boot device */
27#define MG_BOOT_DEV (1 << 0)
28/* use mflash as storage device */
29#define MG_STORAGE_DEV (1 << 1)
30/* same as MG_STORAGE_DEV, but bootloader already done reset sequence */
31#define MG_STORAGE_DEV_SKIP_RST (1 << 2)
32
33/* private driver data */
34struct mg_drv_data {
35 /* disk resource */
36 u32 use_polling;
37
38 /* device attribution */
39 u32 dev_attr;
40
41 /* internally used */
42 void *host;
43};
44
45#endif
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index fa76b516fa47..48e24844b3c5 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -33,8 +33,9 @@ extern char *migrate_reason_names[MR_TYPES];
33#ifdef CONFIG_MIGRATION 33#ifdef CONFIG_MIGRATION
34 34
35extern void putback_movable_pages(struct list_head *l); 35extern void putback_movable_pages(struct list_head *l);
36extern int migrate_page(struct address_space *, 36extern int migrate_page(struct address_space *mapping,
37 struct page *, struct page *, enum migrate_mode); 37 struct page *newpage, struct page *page,
38 enum migrate_mode mode);
38extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free, 39extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
39 unsigned long private, enum migrate_mode mode, int reason); 40 unsigned long private, enum migrate_mode mode, int reason);
40extern int isolate_movable_page(struct page *page, isolate_mode_t mode); 41extern int isolate_movable_page(struct page *page, isolate_mode_t mode);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 1beb1ec2fbdf..d5bed0875d30 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -108,7 +108,7 @@ enum {
108 MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1) 108 MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1)
109}; 109};
110 110
111/* Driver supports 3 diffrent device methods to manage traffic steering: 111/* Driver supports 3 different device methods to manage traffic steering:
112 * -device managed - High level API for ib and eth flow steering. FW is 112 * -device managed - High level API for ib and eth flow steering. FW is
113 * managing flow steering tables. 113 * managing flow steering tables.
114 * - B0 steering mode - Common low level API for ib and (if supported) eth. 114 * - B0 steering mode - Common low level API for ib and (if supported) eth.
@@ -1011,8 +1011,7 @@ struct mlx4_mad_ifc {
1011#define mlx4_foreach_ib_transport_port(port, dev) \ 1011#define mlx4_foreach_ib_transport_port(port, dev) \
1012 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 1012 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
1013 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \ 1013 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
1014 ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE) || \ 1014 ((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_ETH))
1015 ((dev)->caps.flags2 & MLX4_DEV_CAP_FLAG2_ROCE_V1_V2))
1016 1015
1017#define MLX4_INVALID_SLAVE_ID 0xFF 1016#define MLX4_INVALID_SLAVE_ID 0xFF
1018#define MLX4_SINK_COUNTER_INDEX(dev) (dev->caps.max_counters - 1) 1017#define MLX4_SINK_COUNTER_INDEX(dev) (dev->caps.max_counters - 1)
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index dd9a263ed368..a940ec6a046c 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -787,8 +787,14 @@ enum {
787}; 787};
788 788
789enum { 789enum {
790 CQE_RSS_HTYPE_IP = 0x3 << 6, 790 CQE_RSS_HTYPE_IP = 0x3 << 2,
791 CQE_RSS_HTYPE_L4 = 0x3 << 2, 791 /* cqe->rss_hash_type[3:2] - IP destination selected for hash
792 * (00 = none, 01 = IPv4, 10 = IPv6, 11 = Reserved)
793 */
794 CQE_RSS_HTYPE_L4 = 0x3 << 6,
795 /* cqe->rss_hash_type[7:6] - L4 destination selected for hash
796 * (00 = none, 01 = TCP. 10 = UDP, 11 = IPSEC.SPI
797 */
792}; 798};
793 799
794enum { 800enum {
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 2fcff6b4503f..93273d9ea4d1 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -540,6 +540,7 @@ struct mlx5_fc_stats {
540 struct workqueue_struct *wq; 540 struct workqueue_struct *wq;
541 struct delayed_work work; 541 struct delayed_work work;
542 unsigned long next_query; 542 unsigned long next_query;
543 unsigned long sampling_interval; /* jiffies */
543}; 544};
544 545
545struct mlx5_eswitch; 546struct mlx5_eswitch;
@@ -728,6 +729,7 @@ struct mlx5e_resources {
728 u32 pdn; 729 u32 pdn;
729 struct mlx5_td td; 730 struct mlx5_td td;
730 struct mlx5_core_mkey mkey; 731 struct mlx5_core_mkey mkey;
732 struct mlx5_sq_bfreg bfreg;
731}; 733};
732 734
733struct mlx5_core_dev { 735struct mlx5_core_dev {
@@ -785,7 +787,12 @@ enum {
785 787
786typedef void (*mlx5_cmd_cbk_t)(int status, void *context); 788typedef void (*mlx5_cmd_cbk_t)(int status, void *context);
787 789
790enum {
791 MLX5_CMD_ENT_STATE_PENDING_COMP,
792};
793
788struct mlx5_cmd_work_ent { 794struct mlx5_cmd_work_ent {
795 unsigned long state;
789 struct mlx5_cmd_msg *in; 796 struct mlx5_cmd_msg *in;
790 struct mlx5_cmd_msg *out; 797 struct mlx5_cmd_msg *out;
791 void *uout; 798 void *uout;
@@ -890,12 +897,7 @@ static inline u16 cmdif_rev(struct mlx5_core_dev *dev)
890 897
891static inline void *mlx5_vzalloc(unsigned long size) 898static inline void *mlx5_vzalloc(unsigned long size)
892{ 899{
893 void *rtn; 900 return kvzalloc(size, GFP_KERNEL);
894
895 rtn = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
896 if (!rtn)
897 rtn = vzalloc(size);
898 return rtn;
899} 901}
900 902
901static inline u32 mlx5_base_mkey(const u32 key) 903static inline u32 mlx5_base_mkey(const u32 key)
@@ -979,7 +981,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
979void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); 981void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
980void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); 982void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
981struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); 983struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
982void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec); 984void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool forced);
983void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); 985void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type);
984int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, 986int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
985 int nent, u64 mask, const char *name, 987 int nent, u64 mask, const char *name,
@@ -1100,6 +1102,25 @@ struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev);
1100struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev); 1102struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev);
1101void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up); 1103void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up);
1102 1104
1105#ifndef CONFIG_MLX5_CORE_IPOIB
1106static inline
1107struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
1108 struct ib_device *ibdev,
1109 const char *name,
1110 void (*setup)(struct net_device *))
1111{
1112 return ERR_PTR(-EOPNOTSUPP);
1113}
1114
1115static inline void mlx5_rdma_netdev_free(struct net_device *netdev) {}
1116#else
1117struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
1118 struct ib_device *ibdev,
1119 const char *name,
1120 void (*setup)(struct net_device *));
1121void mlx5_rdma_netdev_free(struct net_device *netdev);
1122#endif /* CONFIG_MLX5_CORE_IPOIB */
1123
1103struct mlx5_profile { 1124struct mlx5_profile {
1104 u64 mask; 1125 u64 mask;
1105 u8 log_max_qp; 1126 u8 log_max_qp;
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 949b24b6c479..b25e7baa273e 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -104,12 +104,17 @@ mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
104 u32 level, 104 u32 level,
105 u32 flags); 105 u32 flags);
106 106
107struct mlx5_flow_table_attr {
108 int prio;
109 int max_fte;
110 u32 level;
111 u32 flags;
112};
113
107struct mlx5_flow_table * 114struct mlx5_flow_table *
108mlx5_create_flow_table(struct mlx5_flow_namespace *ns, 115mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
109 int prio, 116 struct mlx5_flow_table_attr *ft_attr);
110 int num_flow_table_entries, 117
111 u32 level,
112 u32 flags);
113struct mlx5_flow_table * 118struct mlx5_flow_table *
114mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns, 119mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
115 int prio, 120 int prio,
@@ -134,8 +139,13 @@ struct mlx5_flow_act {
134 u32 action; 139 u32 action;
135 u32 flow_tag; 140 u32 flow_tag;
136 u32 encap_id; 141 u32 encap_id;
142 u32 modify_id;
137}; 143};
138 144
145#define MLX5_DECLARE_FLOW_ACT(name) \
146 struct mlx5_flow_act name = {MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\
147 MLX5_FS_DEFAULT_FLOW_TAG, 0, 0}
148
139/* Single destination per rule. 149/* Single destination per rule.
140 * Group ID is implied by the match criteria. 150 * Group ID is implied by the match criteria.
141 */ 151 */
@@ -156,5 +166,7 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
156void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter); 166void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
157void mlx5_fc_query_cached(struct mlx5_fc *counter, 167void mlx5_fc_query_cached(struct mlx5_fc *counter,
158 u64 *bytes, u64 *packets, u64 *lastuse); 168 u64 *bytes, u64 *packets, u64 *lastuse);
169int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
170int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
159 171
160#endif 172#endif
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 838242697541..32de0724b400 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -227,6 +227,8 @@ enum {
227 MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c, 227 MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c,
228 MLX5_CMD_OP_ALLOC_ENCAP_HEADER = 0x93d, 228 MLX5_CMD_OP_ALLOC_ENCAP_HEADER = 0x93d,
229 MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e, 229 MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e,
230 MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940,
231 MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941,
230 MLX5_CMD_OP_MAX 232 MLX5_CMD_OP_MAX
231}; 233};
232 234
@@ -234,7 +236,7 @@ struct mlx5_ifc_flow_table_fields_supported_bits {
234 u8 outer_dmac[0x1]; 236 u8 outer_dmac[0x1];
235 u8 outer_smac[0x1]; 237 u8 outer_smac[0x1];
236 u8 outer_ether_type[0x1]; 238 u8 outer_ether_type[0x1];
237 u8 reserved_at_3[0x1]; 239 u8 outer_ip_version[0x1];
238 u8 outer_first_prio[0x1]; 240 u8 outer_first_prio[0x1];
239 u8 outer_first_cfi[0x1]; 241 u8 outer_first_cfi[0x1];
240 u8 outer_first_vid[0x1]; 242 u8 outer_first_vid[0x1];
@@ -263,7 +265,7 @@ struct mlx5_ifc_flow_table_fields_supported_bits {
263 u8 inner_dmac[0x1]; 265 u8 inner_dmac[0x1];
264 u8 inner_smac[0x1]; 266 u8 inner_smac[0x1];
265 u8 inner_ether_type[0x1]; 267 u8 inner_ether_type[0x1];
266 u8 reserved_at_23[0x1]; 268 u8 inner_ip_version[0x1];
267 u8 inner_first_prio[0x1]; 269 u8 inner_first_prio[0x1];
268 u8 inner_first_cfi[0x1]; 270 u8 inner_first_cfi[0x1];
269 u8 inner_first_vid[0x1]; 271 u8 inner_first_vid[0x1];
@@ -302,7 +304,8 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
302 304
303 u8 reserved_at_20[0x2]; 305 u8 reserved_at_20[0x2];
304 u8 log_max_ft_size[0x6]; 306 u8 log_max_ft_size[0x6];
305 u8 reserved_at_28[0x10]; 307 u8 log_max_modify_header_context[0x8];
308 u8 max_modify_header_actions[0x8];
306 u8 max_ft_level[0x8]; 309 u8 max_ft_level[0x8];
307 310
308 u8 reserved_at_40[0x20]; 311 u8 reserved_at_40[0x20];
@@ -368,7 +371,7 @@ struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
368 u8 cvlan_tag[0x1]; 371 u8 cvlan_tag[0x1];
369 u8 svlan_tag[0x1]; 372 u8 svlan_tag[0x1];
370 u8 frag[0x1]; 373 u8 frag[0x1];
371 u8 reserved_at_93[0x4]; 374 u8 ip_version[0x4];
372 u8 tcp_flags[0x9]; 375 u8 tcp_flags[0x9];
373 376
374 u8 tcp_sport[0x10]; 377 u8 tcp_sport[0x10];
@@ -869,7 +872,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
869 872
870 u8 compact_address_vector[0x1]; 873 u8 compact_address_vector[0x1];
871 u8 striding_rq[0x1]; 874 u8 striding_rq[0x1];
872 u8 reserved_at_202[0x2]; 875 u8 reserved_at_202[0x1];
876 u8 ipoib_enhanced_offloads[0x1];
873 u8 ipoib_basic_offloads[0x1]; 877 u8 ipoib_basic_offloads[0x1];
874 u8 reserved_at_205[0xa]; 878 u8 reserved_at_205[0xa];
875 u8 drain_sigerr[0x1]; 879 u8 drain_sigerr[0x1];
@@ -1452,7 +1456,9 @@ struct mlx5_ifc_ib_port_cntrs_grp_data_layout_bits {
1452 1456
1453 u8 vl_15_dropped[0x10]; 1457 u8 vl_15_dropped[0x10];
1454 1458
1455 u8 reserved_at_a0[0xa0]; 1459 u8 reserved_at_a0[0x80];
1460
1461 u8 port_xmit_wait[0x20];
1456}; 1462};
1457 1463
1458struct mlx5_ifc_eth_per_traffic_grp_data_layout_bits { 1464struct mlx5_ifc_eth_per_traffic_grp_data_layout_bits {
@@ -2190,6 +2196,7 @@ enum {
2190 MLX5_FLOW_CONTEXT_ACTION_COUNT = 0x8, 2196 MLX5_FLOW_CONTEXT_ACTION_COUNT = 0x8,
2191 MLX5_FLOW_CONTEXT_ACTION_ENCAP = 0x10, 2197 MLX5_FLOW_CONTEXT_ACTION_ENCAP = 0x10,
2192 MLX5_FLOW_CONTEXT_ACTION_DECAP = 0x20, 2198 MLX5_FLOW_CONTEXT_ACTION_DECAP = 0x20,
2199 MLX5_FLOW_CONTEXT_ACTION_MOD_HDR = 0x40,
2193}; 2200};
2194 2201
2195struct mlx5_ifc_flow_context_bits { 2202struct mlx5_ifc_flow_context_bits {
@@ -2211,7 +2218,9 @@ struct mlx5_ifc_flow_context_bits {
2211 2218
2212 u8 encap_id[0x20]; 2219 u8 encap_id[0x20];
2213 2220
2214 u8 reserved_at_e0[0x120]; 2221 u8 modify_header_id[0x20];
2222
2223 u8 reserved_at_100[0x100];
2215 2224
2216 struct mlx5_ifc_fte_match_param_bits match_value; 2225 struct mlx5_ifc_fte_match_param_bits match_value;
2217 2226
@@ -2287,7 +2296,9 @@ struct mlx5_ifc_tisc_bits {
2287 u8 reserved_at_120[0x8]; 2296 u8 reserved_at_120[0x8];
2288 u8 transport_domain[0x18]; 2297 u8 transport_domain[0x18];
2289 2298
2290 u8 reserved_at_140[0x3c0]; 2299 u8 reserved_at_140[0x8];
2300 u8 underlay_qpn[0x18];
2301 u8 reserved_at_160[0x3a0];
2291}; 2302};
2292 2303
2293enum { 2304enum {
@@ -4534,6 +4545,109 @@ struct mlx5_ifc_dealloc_encap_header_in_bits {
4534 u8 reserved_60[0x20]; 4545 u8 reserved_60[0x20];
4535}; 4546};
4536 4547
4548struct mlx5_ifc_set_action_in_bits {
4549 u8 action_type[0x4];
4550 u8 field[0xc];
4551 u8 reserved_at_10[0x3];
4552 u8 offset[0x5];
4553 u8 reserved_at_18[0x3];
4554 u8 length[0x5];
4555
4556 u8 data[0x20];
4557};
4558
4559struct mlx5_ifc_add_action_in_bits {
4560 u8 action_type[0x4];
4561 u8 field[0xc];
4562 u8 reserved_at_10[0x10];
4563
4564 u8 data[0x20];
4565};
4566
4567union mlx5_ifc_set_action_in_add_action_in_auto_bits {
4568 struct mlx5_ifc_set_action_in_bits set_action_in;
4569 struct mlx5_ifc_add_action_in_bits add_action_in;
4570 u8 reserved_at_0[0x40];
4571};
4572
4573enum {
4574 MLX5_ACTION_TYPE_SET = 0x1,
4575 MLX5_ACTION_TYPE_ADD = 0x2,
4576};
4577
4578enum {
4579 MLX5_ACTION_IN_FIELD_OUT_SMAC_47_16 = 0x1,
4580 MLX5_ACTION_IN_FIELD_OUT_SMAC_15_0 = 0x2,
4581 MLX5_ACTION_IN_FIELD_OUT_ETHERTYPE = 0x3,
4582 MLX5_ACTION_IN_FIELD_OUT_DMAC_47_16 = 0x4,
4583 MLX5_ACTION_IN_FIELD_OUT_DMAC_15_0 = 0x5,
4584 MLX5_ACTION_IN_FIELD_OUT_IP_DSCP = 0x6,
4585 MLX5_ACTION_IN_FIELD_OUT_TCP_FLAGS = 0x7,
4586 MLX5_ACTION_IN_FIELD_OUT_TCP_SPORT = 0x8,
4587 MLX5_ACTION_IN_FIELD_OUT_TCP_DPORT = 0x9,
4588 MLX5_ACTION_IN_FIELD_OUT_IP_TTL = 0xa,
4589 MLX5_ACTION_IN_FIELD_OUT_UDP_SPORT = 0xb,
4590 MLX5_ACTION_IN_FIELD_OUT_UDP_DPORT = 0xc,
4591 MLX5_ACTION_IN_FIELD_OUT_SIPV6_127_96 = 0xd,
4592 MLX5_ACTION_IN_FIELD_OUT_SIPV6_95_64 = 0xe,
4593 MLX5_ACTION_IN_FIELD_OUT_SIPV6_63_32 = 0xf,
4594 MLX5_ACTION_IN_FIELD_OUT_SIPV6_31_0 = 0x10,
4595 MLX5_ACTION_IN_FIELD_OUT_DIPV6_127_96 = 0x11,
4596 MLX5_ACTION_IN_FIELD_OUT_DIPV6_95_64 = 0x12,
4597 MLX5_ACTION_IN_FIELD_OUT_DIPV6_63_32 = 0x13,
4598 MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0 = 0x14,
4599 MLX5_ACTION_IN_FIELD_OUT_SIPV4 = 0x15,
4600 MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16,
4601};
4602
4603struct mlx5_ifc_alloc_modify_header_context_out_bits {
4604 u8 status[0x8];
4605 u8 reserved_at_8[0x18];
4606
4607 u8 syndrome[0x20];
4608
4609 u8 modify_header_id[0x20];
4610
4611 u8 reserved_at_60[0x20];
4612};
4613
4614struct mlx5_ifc_alloc_modify_header_context_in_bits {
4615 u8 opcode[0x10];
4616 u8 reserved_at_10[0x10];
4617
4618 u8 reserved_at_20[0x10];
4619 u8 op_mod[0x10];
4620
4621 u8 reserved_at_40[0x20];
4622
4623 u8 table_type[0x8];
4624 u8 reserved_at_68[0x10];
4625 u8 num_of_actions[0x8];
4626
4627 union mlx5_ifc_set_action_in_add_action_in_auto_bits actions[0];
4628};
4629
4630struct mlx5_ifc_dealloc_modify_header_context_out_bits {
4631 u8 status[0x8];
4632 u8 reserved_at_8[0x18];
4633
4634 u8 syndrome[0x20];
4635
4636 u8 reserved_at_40[0x40];
4637};
4638
4639struct mlx5_ifc_dealloc_modify_header_context_in_bits {
4640 u8 opcode[0x10];
4641 u8 reserved_at_10[0x10];
4642
4643 u8 reserved_at_20[0x10];
4644 u8 op_mod[0x10];
4645
4646 u8 modify_header_id[0x20];
4647
4648 u8 reserved_at_60[0x20];
4649};
4650
4537struct mlx5_ifc_query_dct_out_bits { 4651struct mlx5_ifc_query_dct_out_bits {
4538 u8 status[0x8]; 4652 u8 status[0x8];
4539 u8 reserved_at_8[0x18]; 4653 u8 reserved_at_8[0x18];
@@ -4623,17 +4737,17 @@ struct mlx5_ifc_query_cong_statistics_out_bits {
4623 4737
4624 u8 reserved_at_40[0x40]; 4738 u8 reserved_at_40[0x40];
4625 4739
4626 u8 cur_flows[0x20]; 4740 u8 rp_cur_flows[0x20];
4627 4741
4628 u8 sum_flows[0x20]; 4742 u8 sum_flows[0x20];
4629 4743
4630 u8 cnp_ignored_high[0x20]; 4744 u8 rp_cnp_ignored_high[0x20];
4631 4745
4632 u8 cnp_ignored_low[0x20]; 4746 u8 rp_cnp_ignored_low[0x20];
4633 4747
4634 u8 cnp_handled_high[0x20]; 4748 u8 rp_cnp_handled_high[0x20];
4635 4749
4636 u8 cnp_handled_low[0x20]; 4750 u8 rp_cnp_handled_low[0x20];
4637 4751
4638 u8 reserved_at_140[0x100]; 4752 u8 reserved_at_140[0x100];
4639 4753
@@ -4643,13 +4757,13 @@ struct mlx5_ifc_query_cong_statistics_out_bits {
4643 4757
4644 u8 accumulators_period[0x20]; 4758 u8 accumulators_period[0x20];
4645 4759
4646 u8 ecn_marked_roce_packets_high[0x20]; 4760 u8 np_ecn_marked_roce_packets_high[0x20];
4647 4761
4648 u8 ecn_marked_roce_packets_low[0x20]; 4762 u8 np_ecn_marked_roce_packets_low[0x20];
4649 4763
4650 u8 cnps_sent_high[0x20]; 4764 u8 np_cnp_sent_high[0x20];
4651 4765
4652 u8 cnps_sent_low[0x20]; 4766 u8 np_cnp_sent_low[0x20];
4653 4767
4654 u8 reserved_at_320[0x560]; 4768 u8 reserved_at_320[0x560];
4655}; 4769};
@@ -5013,6 +5127,7 @@ struct mlx5_ifc_modify_rq_out_bits {
5013 5127
5014enum { 5128enum {
5015 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD = 1ULL << 1, 5129 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD = 1ULL << 1,
5130 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_SCATTER_FCS = 1ULL << 2,
5016 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID = 1ULL << 3, 5131 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID = 1ULL << 3,
5017}; 5132};
5018 5133
@@ -8108,7 +8223,9 @@ struct mlx5_ifc_set_flow_table_root_in_bits {
8108 u8 reserved_at_a0[0x8]; 8223 u8 reserved_at_a0[0x8];
8109 u8 table_id[0x18]; 8224 u8 table_id[0x18];
8110 8225
8111 u8 reserved_at_c0[0x140]; 8226 u8 reserved_at_c0[0x8];
8227 u8 underlay_qpn[0x18];
8228 u8 reserved_at_e0[0x120];
8112}; 8229};
8113 8230
8114enum { 8231enum {
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 3096370fe831..bef80d0a0e30 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -295,6 +295,16 @@ struct mlx5_av {
295 u8 rgid[16]; 295 u8 rgid[16];
296}; 296};
297 297
298struct mlx5_ib_ah {
299 struct ib_ah ibah;
300 struct mlx5_av av;
301};
302
303static inline struct mlx5_ib_ah *to_mah(struct ib_ah *ibah)
304{
305 return container_of(ibah, struct mlx5_ib_ah, ibah);
306}
307
298struct mlx5_wqe_datagram_seg { 308struct mlx5_wqe_datagram_seg {
299 struct mlx5_av av; 309 struct mlx5_av av;
300}; 310};
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 00a8fa7e366a..7cb17c6b97de 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -432,6 +432,10 @@ static inline int pud_devmap(pud_t pud)
432{ 432{
433 return 0; 433 return 0;
434} 434}
435static inline int pgd_devmap(pgd_t pgd)
436{
437 return 0;
438}
435#endif 439#endif
436 440
437/* 441/*
@@ -514,6 +518,28 @@ static inline int is_vmalloc_or_module_addr(const void *x)
514} 518}
515#endif 519#endif
516 520
521extern void *kvmalloc_node(size_t size, gfp_t flags, int node);
522static inline void *kvmalloc(size_t size, gfp_t flags)
523{
524 return kvmalloc_node(size, flags, NUMA_NO_NODE);
525}
526static inline void *kvzalloc_node(size_t size, gfp_t flags, int node)
527{
528 return kvmalloc_node(size, flags | __GFP_ZERO, node);
529}
530static inline void *kvzalloc(size_t size, gfp_t flags)
531{
532 return kvmalloc(size, flags | __GFP_ZERO);
533}
534
535static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
536{
537 if (size != 0 && n > SIZE_MAX / size)
538 return NULL;
539
540 return kvmalloc(n * size, flags);
541}
542
517extern void kvfree(const void *addr); 543extern void kvfree(const void *addr);
518 544
519static inline atomic_t *compound_mapcount_ptr(struct page *page) 545static inline atomic_t *compound_mapcount_ptr(struct page *page)
@@ -758,19 +784,11 @@ static inline enum zone_type page_zonenum(const struct page *page)
758} 784}
759 785
760#ifdef CONFIG_ZONE_DEVICE 786#ifdef CONFIG_ZONE_DEVICE
761void get_zone_device_page(struct page *page);
762void put_zone_device_page(struct page *page);
763static inline bool is_zone_device_page(const struct page *page) 787static inline bool is_zone_device_page(const struct page *page)
764{ 788{
765 return page_zonenum(page) == ZONE_DEVICE; 789 return page_zonenum(page) == ZONE_DEVICE;
766} 790}
767#else 791#else
768static inline void get_zone_device_page(struct page *page)
769{
770}
771static inline void put_zone_device_page(struct page *page)
772{
773}
774static inline bool is_zone_device_page(const struct page *page) 792static inline bool is_zone_device_page(const struct page *page)
775{ 793{
776 return false; 794 return false;
@@ -786,9 +804,6 @@ static inline void get_page(struct page *page)
786 */ 804 */
787 VM_BUG_ON_PAGE(page_ref_count(page) <= 0, page); 805 VM_BUG_ON_PAGE(page_ref_count(page) <= 0, page);
788 page_ref_inc(page); 806 page_ref_inc(page);
789
790 if (unlikely(is_zone_device_page(page)))
791 get_zone_device_page(page);
792} 807}
793 808
794static inline void put_page(struct page *page) 809static inline void put_page(struct page *page)
@@ -797,9 +812,6 @@ static inline void put_page(struct page *page)
797 812
798 if (put_page_testzero(page)) 813 if (put_page_testzero(page))
799 __put_page(page); 814 __put_page(page);
800
801 if (unlikely(is_zone_device_page(page)))
802 put_zone_device_page(page);
803} 815}
804 816
805#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) 817#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
@@ -2497,7 +2509,6 @@ extern long copy_huge_page_from_user(struct page *dst_page,
2497#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ 2509#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
2498 2510
2499extern struct page_ext_operations debug_guardpage_ops; 2511extern struct page_ext_operations debug_guardpage_ops;
2500extern struct page_ext_operations page_poisoning_ops;
2501 2512
2502#ifdef CONFIG_DEBUG_PAGEALLOC 2513#ifdef CONFIG_DEBUG_PAGEALLOC
2503extern unsigned int _debug_guardpage_minorder; 2514extern unsigned int _debug_guardpage_minorder;
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index f60f45fe226f..45cdb27791a3 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -367,6 +367,11 @@ struct mm_struct {
367#endif 367#endif
368 unsigned long mmap_base; /* base of mmap area */ 368 unsigned long mmap_base; /* base of mmap area */
369 unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */ 369 unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */
370#ifdef CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES
371 /* Base adresses for compatible mmap() */
372 unsigned long mmap_compat_base;
373 unsigned long mmap_compat_legacy_base;
374#endif
370 unsigned long task_size; /* size of task vm space */ 375 unsigned long task_size; /* size of task vm space */
371 unsigned long highest_vm_end; /* highest vma end address */ 376 unsigned long highest_vm_end; /* highest vma end address */
372 pgd_t * pgd; 377 pgd_t * pgd;
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 77e61e0a216a..aad015e0152b 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -89,6 +89,7 @@ struct mmc_ext_csd {
89 unsigned int boot_ro_lock; /* ro lock support */ 89 unsigned int boot_ro_lock; /* ro lock support */
90 bool boot_ro_lockable; 90 bool boot_ro_lockable;
91 bool ffu_capable; /* Firmware upgrade support */ 91 bool ffu_capable; /* Firmware upgrade support */
92 bool cmdq_en; /* Command Queue enabled */
92 bool cmdq_support; /* Command Queue supported */ 93 bool cmdq_support; /* Command Queue supported */
93 unsigned int cmdq_depth; /* Command Queue depth */ 94 unsigned int cmdq_depth; /* Command Queue depth */
94#define MMC_FIRMWARE_LEN 8 95#define MMC_FIRMWARE_LEN 8
@@ -208,6 +209,7 @@ struct sdio_cis {
208struct mmc_host; 209struct mmc_host;
209struct sdio_func; 210struct sdio_func;
210struct sdio_func_tuple; 211struct sdio_func_tuple;
212struct mmc_queue_req;
211 213
212#define SDIO_MAX_FUNCS 7 214#define SDIO_MAX_FUNCS 7
213 215
@@ -267,6 +269,8 @@ struct mmc_card {
267#define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ 269#define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */
268#define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */ 270#define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */
269 271
272 bool reenable_cmdq; /* Re-enable Command Queue */
273
270 unsigned int erase_size; /* erase size in sectors */ 274 unsigned int erase_size; /* erase size in sectors */
271 unsigned int erase_shift; /* if erase unit is power 2 */ 275 unsigned int erase_shift; /* if erase unit is power 2 */
272 unsigned int pref_erase; /* in sectors */ 276 unsigned int pref_erase; /* in sectors */
@@ -300,6 +304,10 @@ struct mmc_card {
300 struct dentry *debugfs_root; 304 struct dentry *debugfs_root;
301 struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */ 305 struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */
302 unsigned int nr_parts; 306 unsigned int nr_parts;
307
308 struct mmc_queue_req *mqrq; /* Shared queue structure */
309 unsigned int bouncesz; /* Bounce buffer size */
310 int qdepth; /* Shared queue depth */
303}; 311};
304 312
305static inline bool mmc_large_sector(struct mmc_card *card) 313static inline bool mmc_large_sector(struct mmc_card *card)
@@ -307,6 +315,8 @@ static inline bool mmc_large_sector(struct mmc_card *card)
307 return card->ext_csd.data_sector_size == 4096; 315 return card->ext_csd.data_sector_size == 4096;
308} 316}
309 317
318bool mmc_card_is_blockaddr(struct mmc_card *card);
319
310#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) 320#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC)
311#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD) 321#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD)
312#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO) 322#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 83f1c4a9f03b..21385ac0c9b1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -17,6 +17,7 @@
17#include <linux/mmc/core.h> 17#include <linux/mmc/core.h>
18#include <linux/mmc/card.h> 18#include <linux/mmc/card.h>
19#include <linux/mmc/pm.h> 19#include <linux/mmc/pm.h>
20#include <linux/dma-direction.h>
20 21
21struct mmc_ios { 22struct mmc_ios {
22 unsigned int clock; /* clock rate */ 23 unsigned int clock; /* clock rate */
@@ -499,6 +500,11 @@ static inline bool mmc_can_retune(struct mmc_host *host)
499 return host->can_retune == 1; 500 return host->can_retune == 1;
500} 501}
501 502
503static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
504{
505 return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
506}
507
502int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error); 508int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
503int mmc_abort_tuning(struct mmc_host *host, u32 opcode); 509int mmc_abort_tuning(struct mmc_host *host, u32 opcode);
504 510
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index aab032a6ae61..97ca105347a6 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -53,7 +53,7 @@ struct sdio_func {
53 unsigned int state; /* function state */ 53 unsigned int state; /* function state */
54#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */ 54#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
55 55
56 u8 tmpbuf[4]; /* DMA:able scratch buffer */ 56 u8 *tmpbuf; /* DMA:able scratch buffer */
57 57
58 unsigned num_info; /* number of info strings */ 58 unsigned num_info; /* number of info strings */
59 const char **info; /* info strings */ 59 const char **info; /* info strings */
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 51891fb0d3ce..c91b3bcd158f 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -394,18 +394,6 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
394 ___pud; \ 394 ___pud; \
395}) 395})
396 396
397#define pmdp_huge_get_and_clear_notify(__mm, __haddr, __pmd) \
398({ \
399 unsigned long ___haddr = __haddr & HPAGE_PMD_MASK; \
400 pmd_t ___pmd; \
401 \
402 ___pmd = pmdp_huge_get_and_clear(__mm, __haddr, __pmd); \
403 mmu_notifier_invalidate_range(__mm, ___haddr, \
404 ___haddr + HPAGE_PMD_SIZE); \
405 \
406 ___pmd; \
407})
408
409/* 397/*
410 * set_pte_at_notify() sets the pte _after_ running the notifier. 398 * set_pte_at_notify() sets the pte _after_ running the notifier.
411 * This is safe to start by updating the secondary MMUs, because the primary MMU 399 * This is safe to start by updating the secondary MMUs, because the primary MMU
@@ -489,7 +477,6 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
489#define ptep_clear_flush_notify ptep_clear_flush 477#define ptep_clear_flush_notify ptep_clear_flush
490#define pmdp_huge_clear_flush_notify pmdp_huge_clear_flush 478#define pmdp_huge_clear_flush_notify pmdp_huge_clear_flush
491#define pudp_huge_clear_flush_notify pudp_huge_clear_flush 479#define pudp_huge_clear_flush_notify pudp_huge_clear_flush
492#define pmdp_huge_get_and_clear_notify pmdp_huge_get_and_clear
493#define set_pte_at_notify set_pte_at 480#define set_pte_at_notify set_pte_at
494 481
495#endif /* CONFIG_MMU_NOTIFIER */ 482#endif /* CONFIG_MMU_NOTIFIER */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 8e02b3750fe0..ebaccd4e7d8c 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -35,7 +35,7 @@
35 */ 35 */
36#define PAGE_ALLOC_COSTLY_ORDER 3 36#define PAGE_ALLOC_COSTLY_ORDER 3
37 37
38enum { 38enum migratetype {
39 MIGRATE_UNMOVABLE, 39 MIGRATE_UNMOVABLE,
40 MIGRATE_MOVABLE, 40 MIGRATE_MOVABLE,
41 MIGRATE_RECLAIMABLE, 41 MIGRATE_RECLAIMABLE,
@@ -74,6 +74,11 @@ extern char * const migratetype_names[MIGRATE_TYPES];
74# define is_migrate_cma_page(_page) false 74# define is_migrate_cma_page(_page) false
75#endif 75#endif
76 76
77static inline bool is_migrate_movable(int mt)
78{
79 return is_migrate_cma(mt) || mt == MIGRATE_MOVABLE;
80}
81
77#define for_each_migratetype_order(order, type) \ 82#define for_each_migratetype_order(order, type) \
78 for (order = 0; order < MAX_ORDER; order++) \ 83 for (order = 0; order < MAX_ORDER; order++) \
79 for (type = 0; type < MIGRATE_TYPES; type++) 84 for (type = 0; type < MIGRATE_TYPES; type++)
@@ -149,7 +154,6 @@ enum node_stat_item {
149 NR_UNEVICTABLE, /* " " " " " */ 154 NR_UNEVICTABLE, /* " " " " " */
150 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */ 155 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
151 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */ 156 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
152 NR_PAGES_SCANNED, /* pages scanned since last reclaim */
153 WORKINGSET_REFAULT, 157 WORKINGSET_REFAULT,
154 WORKINGSET_ACTIVATE, 158 WORKINGSET_ACTIVATE,
155 WORKINGSET_NODERECLAIM, 159 WORKINGSET_NODERECLAIM,
@@ -226,6 +230,8 @@ struct lruvec {
226 struct zone_reclaim_stat reclaim_stat; 230 struct zone_reclaim_stat reclaim_stat;
227 /* Evictions & activations on the inactive file list */ 231 /* Evictions & activations on the inactive file list */
228 atomic_long_t inactive_age; 232 atomic_long_t inactive_age;
233 /* Refaults at the time of last reclaim cycle */
234 unsigned long refaults;
229#ifdef CONFIG_MEMCG 235#ifdef CONFIG_MEMCG
230 struct pglist_data *pgdat; 236 struct pglist_data *pgdat;
231#endif 237#endif
@@ -630,6 +636,8 @@ typedef struct pglist_data {
630 int kswapd_order; 636 int kswapd_order;
631 enum zone_type kswapd_classzone_idx; 637 enum zone_type kswapd_classzone_idx;
632 638
639 int kswapd_failures; /* Number of 'reclaimed == 0' runs */
640
633#ifdef CONFIG_COMPACTION 641#ifdef CONFIG_COMPACTION
634 int kcompactd_max_order; 642 int kcompactd_max_order;
635 enum zone_type kcompactd_classzone_idx; 643 enum zone_type kcompactd_classzone_idx;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 8850fcaf50db..566fda587fcf 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -428,6 +428,16 @@ struct i2c_device_id {
428 kernel_ulong_t driver_data; /* Data private to the driver */ 428 kernel_ulong_t driver_data; /* Data private to the driver */
429}; 429};
430 430
431/* pci_epf */
432
433#define PCI_EPF_NAME_SIZE 20
434#define PCI_EPF_MODULE_PREFIX "pci_epf:"
435
436struct pci_epf_device_id {
437 char name[PCI_EPF_NAME_SIZE];
438 kernel_ulong_t driver_data;
439};
440
431/* spi */ 441/* spi */
432 442
433#define SPI_NAME_SIZE 32 443#define SPI_NAME_SIZE 32
diff --git a/include/linux/module.h b/include/linux/module.h
index 0297c5cd7cdf..21f56393602f 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -493,6 +493,7 @@ static inline int module_is_live(struct module *mod)
493struct module *__module_text_address(unsigned long addr); 493struct module *__module_text_address(unsigned long addr);
494struct module *__module_address(unsigned long addr); 494struct module *__module_address(unsigned long addr);
495bool is_module_address(unsigned long addr); 495bool is_module_address(unsigned long addr);
496bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr);
496bool is_module_percpu_address(unsigned long addr); 497bool is_module_percpu_address(unsigned long addr);
497bool is_module_text_address(unsigned long addr); 498bool is_module_text_address(unsigned long addr);
498 499
@@ -582,7 +583,7 @@ extern bool try_module_get(struct module *module);
582extern void module_put(struct module *module); 583extern void module_put(struct module *module);
583 584
584#else /*!CONFIG_MODULE_UNLOAD*/ 585#else /*!CONFIG_MODULE_UNLOAD*/
585static inline int try_module_get(struct module *module) 586static inline bool try_module_get(struct module *module)
586{ 587{
587 return !module || module_is_live(module); 588 return !module || module_is_live(module);
588} 589}
@@ -660,6 +661,11 @@ static inline bool is_module_percpu_address(unsigned long addr)
660 return false; 661 return false;
661} 662}
662 663
664static inline bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr)
665{
666 return false;
667}
668
663static inline bool is_module_text_address(unsigned long addr) 669static inline bool is_module_text_address(unsigned long addr)
664{ 670{
665 return false; 671 return false;
@@ -674,9 +680,9 @@ static inline void __module_get(struct module *module)
674{ 680{
675} 681}
676 682
677static inline int try_module_get(struct module *module) 683static inline bool try_module_get(struct module *module)
678{ 684{
679 return 1; 685 return true;
680} 686}
681 687
682static inline void module_put(struct module *module) 688static inline void module_put(struct module *module)
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 52666d90ca94..6be1949ebcdf 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -60,9 +60,11 @@ struct kernel_param_ops {
60 * Flags available for kernel_param 60 * Flags available for kernel_param
61 * 61 *
62 * UNSAFE - the parameter is dangerous and setting it will taint the kernel 62 * UNSAFE - the parameter is dangerous and setting it will taint the kernel
63 * HWPARAM - Hardware param not permitted in lockdown mode
63 */ 64 */
64enum { 65enum {
65 KERNEL_PARAM_FL_UNSAFE = (1 << 0) 66 KERNEL_PARAM_FL_UNSAFE = (1 << 0),
67 KERNEL_PARAM_FL_HWPARAM = (1 << 1),
66}; 68};
67 69
68struct kernel_param { 70struct kernel_param {
@@ -451,6 +453,67 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
451 perm, -1, 0); \ 453 perm, -1, 0); \
452 __MODULE_PARM_TYPE(name, "array of " #type) 454 __MODULE_PARM_TYPE(name, "array of " #type)
453 455
456enum hwparam_type {
457 hwparam_ioport, /* Module parameter configures an I/O port */
458 hwparam_iomem, /* Module parameter configures an I/O mem address */
459 hwparam_ioport_or_iomem, /* Module parameter could be either, depending on other option */
460 hwparam_irq, /* Module parameter configures an I/O port */
461 hwparam_dma, /* Module parameter configures a DMA channel */
462 hwparam_dma_addr, /* Module parameter configures a DMA buffer address */
463 hwparam_other, /* Module parameter configures some other value */
464};
465
466/**
467 * module_param_hw_named - A parameter representing a hw parameters
468 * @name: a valid C identifier which is the parameter name.
469 * @value: the actual lvalue to alter.
470 * @type: the type of the parameter
471 * @hwtype: what the value represents (enum hwparam_type)
472 * @perm: visibility in sysfs.
473 *
474 * Usually it's a good idea to have variable names and user-exposed names the
475 * same, but that's harder if the variable must be non-static or is inside a
476 * structure. This allows exposure under a different name.
477 */
478#define module_param_hw_named(name, value, type, hwtype, perm) \
479 param_check_##type(name, &(value)); \
480 __module_param_call(MODULE_PARAM_PREFIX, name, \
481 &param_ops_##type, &value, \
482 perm, -1, \
483 KERNEL_PARAM_FL_HWPARAM | (hwparam_##hwtype & 0)); \
484 __MODULE_PARM_TYPE(name, #type)
485
486#define module_param_hw(name, type, hwtype, perm) \
487 module_param_hw_named(name, name, type, hwtype, perm)
488
489/**
490 * module_param_hw_array - A parameter representing an array of hw parameters
491 * @name: the name of the array variable
492 * @type: the type, as per module_param()
493 * @hwtype: what the value represents (enum hwparam_type)
494 * @nump: optional pointer filled in with the number written
495 * @perm: visibility in sysfs
496 *
497 * Input and output are as comma-separated values. Commas inside values
498 * don't work properly (eg. an array of charp).
499 *
500 * ARRAY_SIZE(@name) is used to determine the number of elements in the
501 * array, so the definition must be visible.
502 */
503#define module_param_hw_array(name, type, hwtype, nump, perm) \
504 param_check_##type(name, &(name)[0]); \
505 static const struct kparam_array __param_arr_##name \
506 = { .max = ARRAY_SIZE(name), .num = nump, \
507 .ops = &param_ops_##type, \
508 .elemsize = sizeof(name[0]), .elem = name }; \
509 __module_param_call(MODULE_PARAM_PREFIX, name, \
510 &param_array_ops, \
511 .arr = &__param_arr_##name, \
512 perm, -1, \
513 KERNEL_PARAM_FL_HWPARAM | (hwparam_##hwtype & 0)); \
514 __MODULE_PARM_TYPE(name, "array of " #type)
515
516
454extern const struct kernel_param_ops param_array_ops; 517extern const struct kernel_param_ops param_array_ops;
455 518
456extern const struct kernel_param_ops param_ops_string; 519extern const struct kernel_param_ops param_ops_string;
diff --git a/include/linux/mpls.h b/include/linux/mpls.h
index 9999145bc190..384fb22b6c43 100644
--- a/include/linux/mpls.h
+++ b/include/linux/mpls.h
@@ -3,4 +3,9 @@
3 3
4#include <uapi/linux/mpls.h> 4#include <uapi/linux/mpls.h>
5 5
6#define MPLS_TTL_MASK (MPLS_LS_TTL_MASK >> MPLS_LS_TTL_SHIFT)
7#define MPLS_BOS_MASK (MPLS_LS_S_MASK >> MPLS_LS_S_SHIFT)
8#define MPLS_TC_MASK (MPLS_LS_TC_MASK >> MPLS_LS_TC_SHIFT)
9#define MPLS_LABEL_MASK (MPLS_LS_LABEL_MASK >> MPLS_LS_LABEL_SHIFT)
10
6#endif /* _LINUX_MPLS_H */ 11#endif /* _LINUX_MPLS_H */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index eebdc63cf6af..f8a2ef239c60 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -334,11 +334,6 @@ struct mtd_info {
334 int (*_get_device) (struct mtd_info *mtd); 334 int (*_get_device) (struct mtd_info *mtd);
335 void (*_put_device) (struct mtd_info *mtd); 335 void (*_put_device) (struct mtd_info *mtd);
336 336
337 /* Backing device capabilities for this device
338 * - provides mmap capabilities
339 */
340 struct backing_dev_info *backing_dev_info;
341
342 struct notifier_block reboot_notifier; /* default mode before reboot */ 337 struct notifier_block reboot_notifier; /* default mode before reboot */
343 338
344 /* ECC status information */ 339 /* ECC status information */
@@ -393,7 +388,7 @@ static inline void mtd_set_of_node(struct mtd_info *mtd,
393 388
394static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd) 389static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
395{ 390{
396 return mtd->dev.of_node; 391 return dev_of_node(&mtd->dev);
397} 392}
398 393
399static inline int mtd_oobavail(struct mtd_info *mtd, struct mtd_oob_ops *ops) 394static inline int mtd_oobavail(struct mtd_info *mtd, struct mtd_oob_ops *ops)
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 9591e0fbe5bd..8f67b1581683 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -366,26 +366,6 @@ struct onfi_ext_param_page {
366 */ 366 */
367} __packed; 367} __packed;
368 368
369struct nand_onfi_vendor_micron {
370 u8 two_plane_read;
371 u8 read_cache;
372 u8 read_unique_id;
373 u8 dq_imped;
374 u8 dq_imped_num_settings;
375 u8 dq_imped_feat_addr;
376 u8 rb_pulldown_strength;
377 u8 rb_pulldown_strength_feat_addr;
378 u8 rb_pulldown_strength_num_settings;
379 u8 otp_mode;
380 u8 otp_page_start;
381 u8 otp_data_prot_addr;
382 u8 otp_num_pages;
383 u8 otp_feat_addr;
384 u8 read_retry_options;
385 u8 reserved[72];
386 u8 param_revision;
387} __packed;
388
389struct jedec_ecc_info { 369struct jedec_ecc_info {
390 u8 ecc_bits; 370 u8 ecc_bits;
391 u8 codeword_size; 371 u8 codeword_size;
@@ -465,6 +445,17 @@ struct nand_jedec_params {
465} __packed; 445} __packed;
466 446
467/** 447/**
448 * struct nand_id - NAND id structure
449 * @data: buffer containing the id bytes. Currently 8 bytes large, but can
450 * be extended if required.
451 * @len: ID length.
452 */
453struct nand_id {
454 u8 data[8];
455 int len;
456};
457
458/**
468 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 459 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
469 * @lock: protection lock 460 * @lock: protection lock
470 * @active: the mtd device which holds the controller currently 461 * @active: the mtd device which holds the controller currently
@@ -525,7 +516,7 @@ static inline void nand_hw_control_init(struct nand_hw_control *nfc)
525 * out-of-band data). 516 * out-of-band data).
526 * @read_page: function to read a page according to the ECC generator 517 * @read_page: function to read a page according to the ECC generator
527 * requirements; returns maximum number of bitflips corrected in 518 * requirements; returns maximum number of bitflips corrected in
528 * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error 519 * any single ECC step, -EIO hw error
529 * @read_subpage: function to read parts of the page covered by ECC; 520 * @read_subpage: function to read parts of the page covered by ECC;
530 * returns same as read_page() 521 * returns same as read_page()
531 * @write_subpage: function to write parts of the page covered by ECC. 522 * @write_subpage: function to write parts of the page covered by ECC.
@@ -721,6 +712,20 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
721} 712}
722 713
723/** 714/**
715 * struct nand_manufacturer_ops - NAND Manufacturer operations
716 * @detect: detect the NAND memory organization and capabilities
717 * @init: initialize all vendor specific fields (like the ->read_retry()
718 * implementation) if any.
719 * @cleanup: the ->init() function may have allocated resources, ->cleanup()
720 * is here to let vendor specific code release those resources.
721 */
722struct nand_manufacturer_ops {
723 void (*detect)(struct nand_chip *chip);
724 int (*init)(struct nand_chip *chip);
725 void (*cleanup)(struct nand_chip *chip);
726};
727
728/**
724 * struct nand_chip - NAND Private Flash Chip Data 729 * struct nand_chip - NAND Private Flash Chip Data
725 * @mtd: MTD device registered to the MTD framework 730 * @mtd: MTD device registered to the MTD framework
726 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the 731 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the
@@ -750,6 +755,7 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
750 * setting the read-retry mode. Mostly needed for MLC NAND. 755 * setting the read-retry mode. Mostly needed for MLC NAND.
751 * @ecc: [BOARDSPECIFIC] ECC control structure 756 * @ecc: [BOARDSPECIFIC] ECC control structure
752 * @buffers: buffer structure for read/write 757 * @buffers: buffer structure for read/write
758 * @buf_align: minimum buffer alignment required by a platform
753 * @hwcontrol: platform-specific hardware control structure 759 * @hwcontrol: platform-specific hardware control structure
754 * @erase: [REPLACEABLE] erase function 760 * @erase: [REPLACEABLE] erase function
755 * @scan_bbt: [REPLACEABLE] function to scan bad block table 761 * @scan_bbt: [REPLACEABLE] function to scan bad block table
@@ -793,6 +799,7 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
793 * @pagebuf_bitflips: [INTERN] holds the bitflip count for the page which is 799 * @pagebuf_bitflips: [INTERN] holds the bitflip count for the page which is
794 * currently in data_buf. 800 * currently in data_buf.
795 * @subpagesize: [INTERN] holds the subpagesize 801 * @subpagesize: [INTERN] holds the subpagesize
802 * @id: [INTERN] holds NAND ID
796 * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded), 803 * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded),
797 * non 0 if ONFI supported. 804 * non 0 if ONFI supported.
798 * @jedec_version: [INTERN] holds the chip JEDEC version (BCD encoded), 805 * @jedec_version: [INTERN] holds the chip JEDEC version (BCD encoded),
@@ -822,7 +829,7 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
822 * @errstat: [OPTIONAL] hardware specific function to perform 829 * @errstat: [OPTIONAL] hardware specific function to perform
823 * additional error status checks (determine if errors are 830 * additional error status checks (determine if errors are
824 * correctable). 831 * correctable).
825 * @write_page: [REPLACEABLE] High-level page write function 832 * @manufacturer: [INTERN] Contains manufacturer information
826 */ 833 */
827 834
828struct nand_chip { 835struct nand_chip {
@@ -847,9 +854,6 @@ struct nand_chip {
847 int (*scan_bbt)(struct mtd_info *mtd); 854 int (*scan_bbt)(struct mtd_info *mtd);
848 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, 855 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,
849 int status, int page); 856 int status, int page);
850 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
851 uint32_t offset, int data_len, const uint8_t *buf,
852 int oob_required, int page, int cached, int raw);
853 int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, 857 int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
854 int feature_addr, uint8_t *subfeature_para); 858 int feature_addr, uint8_t *subfeature_para);
855 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, 859 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
@@ -881,6 +885,7 @@ struct nand_chip {
881 int badblockpos; 885 int badblockpos;
882 int badblockbits; 886 int badblockbits;
883 887
888 struct nand_id id;
884 int onfi_version; 889 int onfi_version;
885 int jedec_version; 890 int jedec_version;
886 union { 891 union {
@@ -901,6 +906,7 @@ struct nand_chip {
901 906
902 struct nand_ecc_ctrl ecc; 907 struct nand_ecc_ctrl ecc;
903 struct nand_buffers *buffers; 908 struct nand_buffers *buffers;
909 unsigned long buf_align;
904 struct nand_hw_control hwcontrol; 910 struct nand_hw_control hwcontrol;
905 911
906 uint8_t *bbt; 912 uint8_t *bbt;
@@ -910,6 +916,11 @@ struct nand_chip {
910 struct nand_bbt_descr *badblock_pattern; 916 struct nand_bbt_descr *badblock_pattern;
911 917
912 void *priv; 918 void *priv;
919
920 struct {
921 const struct nand_manufacturer *desc;
922 void *priv;
923 } manufacturer;
913}; 924};
914 925
915extern const struct mtd_ooblayout_ops nand_ooblayout_sp_ops; 926extern const struct mtd_ooblayout_ops nand_ooblayout_sp_ops;
@@ -946,6 +957,17 @@ static inline void nand_set_controller_data(struct nand_chip *chip, void *priv)
946 chip->priv = priv; 957 chip->priv = priv;
947} 958}
948 959
960static inline void nand_set_manufacturer_data(struct nand_chip *chip,
961 void *priv)
962{
963 chip->manufacturer.priv = priv;
964}
965
966static inline void *nand_get_manufacturer_data(struct nand_chip *chip)
967{
968 return chip->manufacturer.priv;
969}
970
949/* 971/*
950 * NAND Flash Manufacturer ID Codes 972 * NAND Flash Manufacturer ID Codes
951 */ 973 */
@@ -1049,17 +1071,33 @@ struct nand_flash_dev {
1049}; 1071};
1050 1072
1051/** 1073/**
1052 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure 1074 * struct nand_manufacturer - NAND Flash Manufacturer structure
1053 * @name: Manufacturer name 1075 * @name: Manufacturer name
1054 * @id: manufacturer ID code of device. 1076 * @id: manufacturer ID code of device.
1077 * @ops: manufacturer operations
1055*/ 1078*/
1056struct nand_manufacturers { 1079struct nand_manufacturer {
1057 int id; 1080 int id;
1058 char *name; 1081 char *name;
1082 const struct nand_manufacturer_ops *ops;
1059}; 1083};
1060 1084
1085const struct nand_manufacturer *nand_get_manufacturer(u8 id);
1086
1087static inline const char *
1088nand_manufacturer_name(const struct nand_manufacturer *manufacturer)
1089{
1090 return manufacturer ? manufacturer->name : "Unknown";
1091}
1092
1061extern struct nand_flash_dev nand_flash_ids[]; 1093extern struct nand_flash_dev nand_flash_ids[];
1062extern struct nand_manufacturers nand_manuf_ids[]; 1094
1095extern const struct nand_manufacturer_ops toshiba_nand_manuf_ops;
1096extern const struct nand_manufacturer_ops samsung_nand_manuf_ops;
1097extern const struct nand_manufacturer_ops hynix_nand_manuf_ops;
1098extern const struct nand_manufacturer_ops micron_nand_manuf_ops;
1099extern const struct nand_manufacturer_ops amd_nand_manuf_ops;
1100extern const struct nand_manufacturer_ops macronix_nand_manuf_ops;
1063 1101
1064int nand_default_bbt(struct mtd_info *mtd); 1102int nand_default_bbt(struct mtd_info *mtd);
1065int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs); 1103int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
@@ -1226,4 +1264,6 @@ int nand_reset(struct nand_chip *chip, int chipnr);
1226/* Free resources held by the NAND device */ 1264/* Free resources held by the NAND device */
1227void nand_cleanup(struct nand_chip *chip); 1265void nand_cleanup(struct nand_chip *chip);
1228 1266
1267/* Default extended ID decoding function */
1268void nand_decode_ext_id(struct nand_chip *chip);
1229#endif /* __LINUX_MTD_NAND_H */ 1269#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index f29abda31e6d..8b4794e83196 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -44,6 +44,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
44#define LOOKUP_JUMPED 0x1000 44#define LOOKUP_JUMPED 0x1000
45#define LOOKUP_ROOT 0x2000 45#define LOOKUP_ROOT 0x2000
46#define LOOKUP_EMPTY 0x4000 46#define LOOKUP_EMPTY 0x4000
47#define LOOKUP_DOWN 0x8000
47 48
48extern int path_pts(struct path *path); 49extern int path_pts(struct path *path);
49 50
diff --git a/include/linux/nd.h b/include/linux/nd.h
index fa66aeed441a..194b8e002ea7 100644
--- a/include/linux/nd.h
+++ b/include/linux/nd.h
@@ -48,7 +48,7 @@ struct nd_namespace_common {
48 struct device dev; 48 struct device dev;
49 struct device *claim; 49 struct device *claim;
50 int (*rw_bytes)(struct nd_namespace_common *, resource_size_t offset, 50 int (*rw_bytes)(struct nd_namespace_common *, resource_size_t offset,
51 void *buf, size_t size, int rw); 51 void *buf, size_t size, int rw, unsigned long flags);
52}; 52};
53 53
54static inline struct nd_namespace_common *to_ndns(struct device *dev) 54static inline struct nd_namespace_common *to_ndns(struct device *dev)
@@ -134,9 +134,10 @@ static inline struct nd_namespace_blk *to_nd_namespace_blk(const struct device *
134 * @buf is up-to-date upon return from this routine. 134 * @buf is up-to-date upon return from this routine.
135 */ 135 */
136static inline int nvdimm_read_bytes(struct nd_namespace_common *ndns, 136static inline int nvdimm_read_bytes(struct nd_namespace_common *ndns,
137 resource_size_t offset, void *buf, size_t size) 137 resource_size_t offset, void *buf, size_t size,
138 unsigned long flags)
138{ 139{
139 return ndns->rw_bytes(ndns, offset, buf, size, READ); 140 return ndns->rw_bytes(ndns, offset, buf, size, READ, flags);
140} 141}
141 142
142/** 143/**
@@ -152,9 +153,10 @@ static inline int nvdimm_read_bytes(struct nd_namespace_common *ndns,
152 * to media is handled internal to the @ndns driver, if at all. 153 * to media is handled internal to the @ndns driver, if at all.
153 */ 154 */
154static inline int nvdimm_write_bytes(struct nd_namespace_common *ndns, 155static inline int nvdimm_write_bytes(struct nd_namespace_common *ndns,
155 resource_size_t offset, void *buf, size_t size) 156 resource_size_t offset, void *buf, size_t size,
157 unsigned long flags)
156{ 158{
157 return ndns->rw_bytes(ndns, offset, buf, size, WRITE); 159 return ndns->rw_bytes(ndns, offset, buf, size, WRITE, flags);
158} 160}
159 161
160#define MODULE_ALIAS_ND_DEVICE(type) \ 162#define MODULE_ALIAS_ND_DEVICE(type) \
diff --git a/include/linux/net.h b/include/linux/net.h
index 0620f5e18c96..abcfa46a2bd9 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -298,6 +298,9 @@ int kernel_sendpage(struct socket *sock, struct page *page, int offset,
298int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 298int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
299int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how); 299int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how);
300 300
301/* Routine returns the IP overhead imposed by a (caller-protected) socket. */
302u32 kernel_sock_ip_overhead(struct sock *sk);
303
301#define MODULE_ALIAS_NETPROTO(proto) \ 304#define MODULE_ALIAS_NETPROTO(proto) \
302 MODULE_ALIAS("net-pf-" __stringify(proto)) 305 MODULE_ALIAS("net-pf-" __stringify(proto))
303 306
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 9a0419594e84..1d4737cffc71 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -54,8 +54,9 @@ enum {
54 */ 54 */
55 NETIF_F_GSO_TUNNEL_REMCSUM_BIT, /* ... TUNNEL with TSO & REMCSUM */ 55 NETIF_F_GSO_TUNNEL_REMCSUM_BIT, /* ... TUNNEL with TSO & REMCSUM */
56 NETIF_F_GSO_SCTP_BIT, /* ... SCTP fragmentation */ 56 NETIF_F_GSO_SCTP_BIT, /* ... SCTP fragmentation */
57 NETIF_F_GSO_ESP_BIT, /* ... ESP with TSO */
57 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 58 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
58 NETIF_F_GSO_SCTP_BIT, 59 NETIF_F_GSO_ESP_BIT,
59 60
60 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 61 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
61 NETIF_F_SCTP_CRC_BIT, /* SCTP checksum offload */ 62 NETIF_F_SCTP_CRC_BIT, /* SCTP checksum offload */
@@ -73,6 +74,8 @@ enum {
73 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */ 74 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */
74 75
75 NETIF_F_HW_TC_BIT, /* Offload TC infrastructure */ 76 NETIF_F_HW_TC_BIT, /* Offload TC infrastructure */
77 NETIF_F_HW_ESP_BIT, /* Hardware ESP transformation offload */
78 NETIF_F_HW_ESP_TX_CSUM_BIT, /* ESP with TX checksum offload */
76 79
77 /* 80 /*
78 * Add your fresh new feature above and remember to update 81 * Add your fresh new feature above and remember to update
@@ -129,11 +132,14 @@ enum {
129#define NETIF_F_GSO_PARTIAL __NETIF_F(GSO_PARTIAL) 132#define NETIF_F_GSO_PARTIAL __NETIF_F(GSO_PARTIAL)
130#define NETIF_F_GSO_TUNNEL_REMCSUM __NETIF_F(GSO_TUNNEL_REMCSUM) 133#define NETIF_F_GSO_TUNNEL_REMCSUM __NETIF_F(GSO_TUNNEL_REMCSUM)
131#define NETIF_F_GSO_SCTP __NETIF_F(GSO_SCTP) 134#define NETIF_F_GSO_SCTP __NETIF_F(GSO_SCTP)
135#define NETIF_F_GSO_ESP __NETIF_F(GSO_ESP)
132#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 136#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
133#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 137#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
134#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 138#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
135#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD) 139#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD)
136#define NETIF_F_HW_TC __NETIF_F(HW_TC) 140#define NETIF_F_HW_TC __NETIF_F(HW_TC)
141#define NETIF_F_HW_ESP __NETIF_F(HW_ESP)
142#define NETIF_F_HW_ESP_TX_CSUM __NETIF_F(HW_ESP_TX_CSUM)
137 143
138#define for_each_netdev_feature(mask_addr, bit) \ 144#define for_each_netdev_feature(mask_addr, bit) \
139 for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) 145 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 97456b2539e4..3f39d27decf4 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -41,7 +41,6 @@
41 41
42#include <linux/ethtool.h> 42#include <linux/ethtool.h>
43#include <net/net_namespace.h> 43#include <net/net_namespace.h>
44#include <net/dsa.h>
45#ifdef CONFIG_DCB 44#ifdef CONFIG_DCB
46#include <net/dcbnl.h> 45#include <net/dcbnl.h>
47#endif 46#endif
@@ -57,6 +56,8 @@
57struct netpoll_info; 56struct netpoll_info;
58struct device; 57struct device;
59struct phy_device; 58struct phy_device;
59struct dsa_switch_tree;
60
60/* 802.11 specific */ 61/* 802.11 specific */
61struct wireless_dev; 62struct wireless_dev;
62/* 802.15.4 specific */ 63/* 802.15.4 specific */
@@ -236,8 +237,7 @@ struct netdev_hw_addr_list {
236 netdev_hw_addr_list_for_each(ha, &(dev)->mc) 237 netdev_hw_addr_list_for_each(ha, &(dev)->mc)
237 238
238struct hh_cache { 239struct hh_cache {
239 u16 hh_len; 240 unsigned int hh_len;
240 u16 __pad;
241 seqlock_t hh_lock; 241 seqlock_t hh_lock;
242 242
243 /* cached hardware header; allow for machine alignment needs. */ 243 /* cached hardware header; allow for machine alignment needs. */
@@ -786,11 +786,11 @@ struct tc_cls_u32_offload;
786struct tc_to_netdev { 786struct tc_to_netdev {
787 unsigned int type; 787 unsigned int type;
788 union { 788 union {
789 u8 tc;
790 struct tc_cls_u32_offload *cls_u32; 789 struct tc_cls_u32_offload *cls_u32;
791 struct tc_cls_flower_offload *cls_flower; 790 struct tc_cls_flower_offload *cls_flower;
792 struct tc_cls_matchall_offload *cls_mall; 791 struct tc_cls_matchall_offload *cls_mall;
793 struct tc_cls_bpf_offload *cls_bpf; 792 struct tc_cls_bpf_offload *cls_bpf;
793 struct tc_mqprio_qopt *mqprio;
794 }; 794 };
795 bool egress_dev; 795 bool egress_dev;
796}; 796};
@@ -813,16 +813,31 @@ enum xdp_netdev_command {
813 XDP_QUERY_PROG, 813 XDP_QUERY_PROG,
814}; 814};
815 815
816struct netlink_ext_ack;
817
816struct netdev_xdp { 818struct netdev_xdp {
817 enum xdp_netdev_command command; 819 enum xdp_netdev_command command;
818 union { 820 union {
819 /* XDP_SETUP_PROG */ 821 /* XDP_SETUP_PROG */
820 struct bpf_prog *prog; 822 struct {
823 struct bpf_prog *prog;
824 struct netlink_ext_ack *extack;
825 };
821 /* XDP_QUERY_PROG */ 826 /* XDP_QUERY_PROG */
822 bool prog_attached; 827 bool prog_attached;
823 }; 828 };
824}; 829};
825 830
831#ifdef CONFIG_XFRM_OFFLOAD
832struct xfrmdev_ops {
833 int (*xdo_dev_state_add) (struct xfrm_state *x);
834 void (*xdo_dev_state_delete) (struct xfrm_state *x);
835 void (*xdo_dev_state_free) (struct xfrm_state *x);
836 bool (*xdo_dev_offload_ok) (struct sk_buff *skb,
837 struct xfrm_state *x);
838};
839#endif
840
826/* 841/*
827 * This structure defines the management hooks for network devices. 842 * This structure defines the management hooks for network devices.
828 * The following hooks can be defined; unless noted otherwise, they are 843 * The following hooks can be defined; unless noted otherwise, they are
@@ -1696,6 +1711,10 @@ struct net_device {
1696 const struct ndisc_ops *ndisc_ops; 1711 const struct ndisc_ops *ndisc_ops;
1697#endif 1712#endif
1698 1713
1714#ifdef CONFIG_XFRM
1715 const struct xfrmdev_ops *xfrmdev_ops;
1716#endif
1717
1699 const struct header_ops *header_ops; 1718 const struct header_ops *header_ops;
1700 1719
1701 unsigned int flags; 1720 unsigned int flags;
@@ -1715,7 +1734,7 @@ struct net_device {
1715 unsigned int max_mtu; 1734 unsigned int max_mtu;
1716 unsigned short type; 1735 unsigned short type;
1717 unsigned short hard_header_len; 1736 unsigned short hard_header_len;
1718 unsigned short min_header_len; 1737 unsigned char min_header_len;
1719 1738
1720 unsigned short needed_headroom; 1739 unsigned short needed_headroom;
1721 unsigned short needed_tailroom; 1740 unsigned short needed_tailroom;
@@ -1776,6 +1795,7 @@ struct net_device {
1776 unsigned int real_num_rx_queues; 1795 unsigned int real_num_rx_queues;
1777#endif 1796#endif
1778 1797
1798 struct bpf_prog __rcu *xdp_prog;
1779 unsigned long gro_flush_timeout; 1799 unsigned long gro_flush_timeout;
1780 rx_handler_func_t __rcu *rx_handler; 1800 rx_handler_func_t __rcu *rx_handler;
1781 void __rcu *rx_handler_data; 1801 void __rcu *rx_handler_data;
@@ -1894,6 +1914,13 @@ struct net_device {
1894}; 1914};
1895#define to_net_dev(d) container_of(d, struct net_device, dev) 1915#define to_net_dev(d) container_of(d, struct net_device, dev)
1896 1916
1917static inline bool netif_elide_gro(const struct net_device *dev)
1918{
1919 if (!(dev->features & NETIF_F_GRO) || dev->xdp_prog)
1920 return true;
1921 return false;
1922}
1923
1897#define NETDEV_ALIGN 32 1924#define NETDEV_ALIGN 32
1898 1925
1899static inline 1926static inline
@@ -2004,15 +2031,6 @@ void dev_net_set(struct net_device *dev, struct net *net)
2004 write_pnet(&dev->nd_net, net); 2031 write_pnet(&dev->nd_net, net);
2005} 2032}
2006 2033
2007static inline bool netdev_uses_dsa(struct net_device *dev)
2008{
2009#if IS_ENABLED(CONFIG_NET_DSA)
2010 if (dev->dsa_ptr != NULL)
2011 return dsa_uses_tagged_protocol(dev->dsa_ptr);
2012#endif
2013 return false;
2014}
2015
2016/** 2034/**
2017 * netdev_priv - access network device private data 2035 * netdev_priv - access network device private data
2018 * @dev: network device 2036 * @dev: network device
@@ -3278,10 +3296,15 @@ int dev_get_phys_port_id(struct net_device *dev,
3278int dev_get_phys_port_name(struct net_device *dev, 3296int dev_get_phys_port_name(struct net_device *dev,
3279 char *name, size_t len); 3297 char *name, size_t len);
3280int dev_change_proto_down(struct net_device *dev, bool proto_down); 3298int dev_change_proto_down(struct net_device *dev, bool proto_down);
3281int dev_change_xdp_fd(struct net_device *dev, int fd, u32 flags);
3282struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); 3299struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
3283struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 3300struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
3284 struct netdev_queue *txq, int *ret); 3301 struct netdev_queue *txq, int *ret);
3302
3303typedef int (*xdp_op_t)(struct net_device *dev, struct netdev_xdp *xdp);
3304int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
3305 int fd, u32 flags);
3306bool __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op);
3307
3285int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 3308int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
3286int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 3309int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
3287bool is_skb_forwardable(const struct net_device *dev, 3310bool is_skb_forwardable(const struct net_device *dev,
@@ -3305,6 +3328,7 @@ static __always_inline int ____dev_forward_skb(struct net_device *dev,
3305void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); 3328void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
3306 3329
3307extern int netdev_budget; 3330extern int netdev_budget;
3331extern unsigned int netdev_budget_usecs;
3308 3332
3309/* Called by rtnetlink.c:rtnl_unlock() */ 3333/* Called by rtnetlink.c:rtnl_unlock() */
3310void netdev_run_todo(void); 3334void netdev_run_todo(void);
@@ -3394,10 +3418,10 @@ static inline void netif_dormant_off(struct net_device *dev)
3394} 3418}
3395 3419
3396/** 3420/**
3397 * netif_dormant - test if carrier present 3421 * netif_dormant - test if device is dormant
3398 * @dev: network device 3422 * @dev: network device
3399 * 3423 *
3400 * Check if carrier is present on device 3424 * Check if device is dormant.
3401 */ 3425 */
3402static inline bool netif_dormant(const struct net_device *dev) 3426static inline bool netif_dormant(const struct net_device *dev)
3403{ 3427{
@@ -4078,6 +4102,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
4078 BUILD_BUG_ON(SKB_GSO_PARTIAL != (NETIF_F_GSO_PARTIAL >> NETIF_F_GSO_SHIFT)); 4102 BUILD_BUG_ON(SKB_GSO_PARTIAL != (NETIF_F_GSO_PARTIAL >> NETIF_F_GSO_SHIFT));
4079 BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> NETIF_F_GSO_SHIFT)); 4103 BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> NETIF_F_GSO_SHIFT));
4080 BUILD_BUG_ON(SKB_GSO_SCTP != (NETIF_F_GSO_SCTP >> NETIF_F_GSO_SHIFT)); 4104 BUILD_BUG_ON(SKB_GSO_SCTP != (NETIF_F_GSO_SCTP >> NETIF_F_GSO_SHIFT));
4105 BUILD_BUG_ON(SKB_GSO_ESP != (NETIF_F_GSO_ESP >> NETIF_F_GSO_SHIFT));
4081 4106
4082 return (features & feature) == feature; 4107 return (features & feature) == feature;
4083} 4108}
@@ -4180,6 +4205,11 @@ static inline bool netif_is_ovs_master(const struct net_device *dev)
4180 return dev->priv_flags & IFF_OPENVSWITCH; 4205 return dev->priv_flags & IFF_OPENVSWITCH;
4181} 4206}
4182 4207
4208static inline bool netif_is_ovs_port(const struct net_device *dev)
4209{
4210 return dev->priv_flags & IFF_OVS_DATAPATH;
4211}
4212
4183static inline bool netif_is_team_master(const struct net_device *dev) 4213static inline bool netif_is_team_master(const struct net_device *dev)
4184{ 4214{
4185 return dev->priv_flags & IFF_TEAM; 4215 return dev->priv_flags & IFF_TEAM;
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 1b49209dd5c7..996711d8a7b4 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -41,6 +41,11 @@ int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
41int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid, 41int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
42 int flags); 42 int flags);
43 43
44static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type)
45{
46 return subsys << 8 | msg_type;
47}
48
44void nfnl_lock(__u8 subsys_id); 49void nfnl_lock(__u8 subsys_id);
45void nfnl_unlock(__u8 subsys_id); 50void nfnl_unlock(__u8 subsys_id);
46#ifdef CONFIG_PROVE_LOCKING 51#ifdef CONFIG_PROVE_LOCKING
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index be378cf47fcc..b3044c2c62cb 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -294,7 +294,7 @@ int xt_match_to_user(const struct xt_entry_match *m,
294int xt_target_to_user(const struct xt_entry_target *t, 294int xt_target_to_user(const struct xt_entry_target *t,
295 struct xt_entry_target __user *u); 295 struct xt_entry_target __user *u);
296int xt_data_to_user(void __user *dst, const void *src, 296int xt_data_to_user(void __user *dst, const void *src,
297 int usersize, int size); 297 int usersize, int size, int aligned_size);
298 298
299void *xt_copy_counters_from_user(const void __user *user, unsigned int len, 299void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
300 struct xt_counters_info *info, bool compat); 300 struct xt_counters_info *info, bool compat);
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 984b2112c77b..e0cbf17af780 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -109,8 +109,10 @@ struct ebt_table {
109#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \ 109#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
110 ~(__alignof__(struct _xt_align)-1)) 110 ~(__alignof__(struct _xt_align)-1))
111extern struct ebt_table *ebt_register_table(struct net *net, 111extern struct ebt_table *ebt_register_table(struct net *net,
112 const struct ebt_table *table); 112 const struct ebt_table *table,
113extern void ebt_unregister_table(struct net *net, struct ebt_table *table); 113 const struct nf_hook_ops *);
114extern void ebt_unregister_table(struct net *net, struct ebt_table *table,
115 const struct nf_hook_ops *);
114extern unsigned int ebt_do_table(struct sk_buff *skb, 116extern unsigned int ebt_do_table(struct sk_buff *skb,
115 const struct nf_hook_state *state, 117 const struct nf_hook_state *state,
116 struct ebt_table *table); 118 struct ebt_table *table);
@@ -123,4 +125,9 @@ extern unsigned int ebt_do_table(struct sk_buff *skb,
123/* True if the target is not a standard target */ 125/* True if the target is not a standard target */
124#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) 126#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0)
125 127
128static inline bool ebt_invalid_target(int target)
129{
130 return (target < -NUM_STANDARD_TARGETS || target >= 0);
131}
132
126#endif 133#endif
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index da14ab61f363..5fff5ba5964e 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -62,11 +62,47 @@ netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg)
62 return __netlink_kernel_create(net, unit, THIS_MODULE, cfg); 62 return __netlink_kernel_create(net, unit, THIS_MODULE, cfg);
63} 63}
64 64
65/* this can be increased when necessary - don't expose to userland */
66#define NETLINK_MAX_COOKIE_LEN 20
67
68/**
69 * struct netlink_ext_ack - netlink extended ACK report struct
70 * @_msg: message string to report - don't access directly, use
71 * %NL_SET_ERR_MSG
72 * @bad_attr: attribute with error
73 * @cookie: cookie data to return to userspace (for success)
74 * @cookie_len: actual cookie data length
75 */
76struct netlink_ext_ack {
77 const char *_msg;
78 const struct nlattr *bad_attr;
79 u8 cookie[NETLINK_MAX_COOKIE_LEN];
80 u8 cookie_len;
81};
82
83/* Always use this macro, this allows later putting the
84 * message into a separate section or such for things
85 * like translation or listing all possible messages.
86 * Currently string formatting is not supported (due
87 * to the lack of an output buffer.)
88 */
89#define NL_SET_ERR_MSG(extack, msg) do { \
90 static const char __msg[] = (msg); \
91 struct netlink_ext_ack *__extack = (extack); \
92 \
93 if (__extack) \
94 __extack->_msg = __msg; \
95} while (0)
96
97#define NL_SET_ERR_MSG_MOD(extack, msg) \
98 NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
99
65extern void netlink_kernel_release(struct sock *sk); 100extern void netlink_kernel_release(struct sock *sk);
66extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); 101extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
67extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 102extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
68extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group); 103extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group);
69extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 104extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
105 const struct netlink_ext_ack *extack);
70extern int netlink_has_listeners(struct sock *sk, unsigned int group); 106extern int netlink_has_listeners(struct sock *sk, unsigned int group);
71 107
72extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); 108extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 287f34161086..bb0eb2c9acca 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -76,6 +76,7 @@ struct nfs_open_context {
76#define NFS_CONTEXT_ERROR_WRITE (0) 76#define NFS_CONTEXT_ERROR_WRITE (0)
77#define NFS_CONTEXT_RESEND_WRITES (1) 77#define NFS_CONTEXT_RESEND_WRITES (1)
78#define NFS_CONTEXT_BAD (2) 78#define NFS_CONTEXT_BAD (2)
79#define NFS_CONTEXT_UNLOCK (3)
79 int error; 80 int error;
80 81
81 struct list_head list; 82 struct list_head list;
@@ -499,25 +500,13 @@ extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned
499 */ 500 */
500extern int nfs_sync_inode(struct inode *inode); 501extern int nfs_sync_inode(struct inode *inode);
501extern int nfs_wb_all(struct inode *inode); 502extern int nfs_wb_all(struct inode *inode);
502extern int nfs_wb_single_page(struct inode *inode, struct page *page, bool launder); 503extern int nfs_wb_page(struct inode *inode, struct page *page);
503extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 504extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
504extern int nfs_commit_inode(struct inode *, int); 505extern int nfs_commit_inode(struct inode *, int);
505extern struct nfs_commit_data *nfs_commitdata_alloc(void); 506extern struct nfs_commit_data *nfs_commitdata_alloc(bool never_fail);
506extern void nfs_commit_free(struct nfs_commit_data *data); 507extern void nfs_commit_free(struct nfs_commit_data *data);
507 508
508static inline int 509static inline int
509nfs_wb_launder_page(struct inode *inode, struct page *page)
510{
511 return nfs_wb_single_page(inode, page, true);
512}
513
514static inline int
515nfs_wb_page(struct inode *inode, struct page *page)
516{
517 return nfs_wb_single_page(inode, page, false);
518}
519
520static inline int
521nfs_have_writebacks(struct inode *inode) 510nfs_have_writebacks(struct inode *inode)
522{ 511{
523 return NFS_I(inode)->nrequests != 0; 512 return NFS_I(inode)->nrequests != 0;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b34097c67848..e418a1096662 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -133,7 +133,6 @@ struct nfs_server {
133 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 133 struct rpc_clnt * client_acl; /* ACL RPC client handle */
134 struct nlm_host *nlm_host; /* NLM client handle */ 134 struct nlm_host *nlm_host; /* NLM client handle */
135 struct nfs_iostats __percpu *io_stats; /* I/O statistics */ 135 struct nfs_iostats __percpu *io_stats; /* I/O statistics */
136 struct backing_dev_info backing_dev_info;
137 atomic_long_t writeback; /* number of writeback pages */ 136 atomic_long_t writeback; /* number of writeback pages */
138 int flags; /* various flags */ 137 int flags; /* various flags */
139 unsigned int caps; /* server capabilities */ 138 unsigned int caps; /* server capabilities */
@@ -222,6 +221,7 @@ struct nfs_server {
222 u32 mountd_version; 221 u32 mountd_version;
223 unsigned short mountd_port; 222 unsigned short mountd_port;
224 unsigned short mountd_protocol; 223 unsigned short mountd_protocol;
224 struct rpc_wait_queue uoc_rpcwaitq;
225}; 225};
226 226
227/* Server capabilities */ 227/* Server capabilities */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 957049f72290..247cc3d3498f 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -64,7 +64,6 @@ struct nfs_pageio_ops {
64}; 64};
65 65
66struct nfs_rw_ops { 66struct nfs_rw_ops {
67 const fmode_t rw_mode;
68 struct nfs_pgio_header *(*rw_alloc_header)(void); 67 struct nfs_pgio_header *(*rw_alloc_header)(void);
69 void (*rw_free_header)(struct nfs_pgio_header *); 68 void (*rw_free_header)(struct nfs_pgio_header *);
70 int (*rw_done)(struct rpc_task *, struct nfs_pgio_header *, 69 int (*rw_done)(struct rpc_task *, struct nfs_pgio_header *,
@@ -124,7 +123,8 @@ extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
124 const struct nfs_pgio_completion_ops *compl_ops, 123 const struct nfs_pgio_completion_ops *compl_ops,
125 const struct nfs_rw_ops *rw_ops, 124 const struct nfs_rw_ops *rw_ops,
126 size_t bsize, 125 size_t bsize,
127 int how); 126 int how,
127 gfp_t gfp_flags);
128extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 128extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
129 struct nfs_page *); 129 struct nfs_page *);
130extern int nfs_pageio_resend(struct nfs_pageio_descriptor *, 130extern int nfs_pageio_resend(struct nfs_pageio_descriptor *,
@@ -141,6 +141,7 @@ extern int nfs_page_group_lock(struct nfs_page *, bool);
141extern void nfs_page_group_lock_wait(struct nfs_page *); 141extern void nfs_page_group_lock_wait(struct nfs_page *);
142extern void nfs_page_group_unlock(struct nfs_page *); 142extern void nfs_page_group_unlock(struct nfs_page *);
143extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); 143extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
144extern bool nfs_async_iocounter_wait(struct rpc_task *, struct nfs_lock_context *);
144 145
145/* 146/*
146 * Lock the page of an asynchronous request 147 * Lock the page of an asynchronous request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 348f7c158084..b28c83475ee8 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1383,6 +1383,7 @@ struct nfs42_copy_res {
1383 struct nfs42_write_res write_res; 1383 struct nfs42_write_res write_res;
1384 bool consecutive; 1384 bool consecutive;
1385 bool synchronous; 1385 bool synchronous;
1386 struct nfs_commitres commit_res;
1386}; 1387};
1387 1388
1388struct nfs42_seek_args { 1389struct nfs42_seek_args {
@@ -1427,6 +1428,7 @@ struct nfs_pgio_header {
1427 struct list_head pages; 1428 struct list_head pages;
1428 struct nfs_page *req; 1429 struct nfs_page *req;
1429 struct nfs_writeverf verf; /* Used for writes */ 1430 struct nfs_writeverf verf; /* Used for writes */
1431 fmode_t rw_mode;
1430 struct pnfs_layout_segment *lseg; 1432 struct pnfs_layout_segment *lseg;
1431 loff_t io_start; 1433 loff_t io_start;
1432 const struct rpc_call_ops *mds_ops; 1434 const struct rpc_call_ops *mds_ops;
@@ -1550,6 +1552,7 @@ struct nfs_rpc_ops {
1550 const struct inode_operations *dir_inode_ops; 1552 const struct inode_operations *dir_inode_ops;
1551 const struct inode_operations *file_inode_ops; 1553 const struct inode_operations *file_inode_ops;
1552 const struct file_operations *file_ops; 1554 const struct file_operations *file_ops;
1555 const struct nlmclnt_operations *nlmclnt_ops;
1553 1556
1554 int (*getroot) (struct nfs_server *, struct nfs_fh *, 1557 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1555 struct nfs_fsinfo *); 1558 struct nfs_fsinfo *);
diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h
index f21471f7ee40..6c8c5d8041b7 100644
--- a/include/linux/nvme-fc-driver.h
+++ b/include/linux/nvme-fc-driver.h
@@ -27,8 +27,8 @@
27 27
28/* FC Port role bitmask - can merge with FC Port Roles in fc transport */ 28/* FC Port role bitmask - can merge with FC Port Roles in fc transport */
29#define FC_PORT_ROLE_NVME_INITIATOR 0x10 29#define FC_PORT_ROLE_NVME_INITIATOR 0x10
30#define FC_PORT_ROLE_NVME_TARGET 0x11 30#define FC_PORT_ROLE_NVME_TARGET 0x20
31#define FC_PORT_ROLE_NVME_DISCOVERY 0x12 31#define FC_PORT_ROLE_NVME_DISCOVERY 0x40
32 32
33 33
34/** 34/**
@@ -137,9 +137,9 @@ enum nvmefc_fcp_datadir {
137 * transferred. Should equal payload_length on success. 137 * transferred. Should equal payload_length on success.
138 * @rcv_rsplen: length, in bytes, of the FCP RSP IU received. 138 * @rcv_rsplen: length, in bytes, of the FCP RSP IU received.
139 * @status: Completion status of the FCP operation. must be 0 upon success, 139 * @status: Completion status of the FCP operation. must be 0 upon success,
140 * NVME_SC_FC_xxx value upon failure. Note: this is NOT a 140 * negative errno value upon failure (ex: -EIO). Note: this is
141 * reflection of the NVME CQE completion status. Only the status 141 * NOT a reflection of the NVME CQE completion status. Only the
142 * of the FCP operation at the NVME-FC level. 142 * status of the FCP operation at the NVME-FC level.
143 */ 143 */
144struct nvmefc_fcp_req { 144struct nvmefc_fcp_req {
145 void *cmdaddr; 145 void *cmdaddr;
@@ -533,9 +533,6 @@ enum {
533 * rsp as well 533 * rsp as well
534 */ 534 */
535 NVMET_FCOP_RSP = 4, /* send rsp frame */ 535 NVMET_FCOP_RSP = 4, /* send rsp frame */
536 NVMET_FCOP_ABORT = 5, /* abort exchange via ABTS */
537 NVMET_FCOP_BA_ACC = 6, /* send BA_ACC */
538 NVMET_FCOP_BA_RJT = 7, /* send BA_RJT */
539}; 536};
540 537
541/** 538/**
@@ -572,8 +569,6 @@ enum {
572 * upon compeletion of the operation. The nvmet-fc layer will also set a 569 * upon compeletion of the operation. The nvmet-fc layer will also set a
573 * private pointer for its own use in the done routine. 570 * private pointer for its own use in the done routine.
574 * 571 *
575 * Note: the LLDD must never fail a NVMET_FCOP_ABORT request !!
576 *
577 * Values set by the NVMET-FC layer prior to calling the LLDD fcp_op 572 * Values set by the NVMET-FC layer prior to calling the LLDD fcp_op
578 * entrypoint. 573 * entrypoint.
579 * @op: Indicates the FCP IU operation to perform (see NVMET_FCOP_xxx) 574 * @op: Indicates the FCP IU operation to perform (see NVMET_FCOP_xxx)
@@ -647,13 +642,21 @@ enum {
647 * sequence in one LLDD operation. Errors during Data 642 * sequence in one LLDD operation. Errors during Data
648 * sequence transmit must not allow RSP sequence to be sent. 643 * sequence transmit must not allow RSP sequence to be sent.
649 */ 644 */
650 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED = (1 << 1), 645 NVMET_FCTGTFEAT_CMD_IN_ISR = (1 << 1),
651 /* Bit 1: When 0, the LLDD will deliver FCP CMD 646 /* Bit 2: When 0, the LLDD is calling the cmd rcv handler
652 * on the CPU it should be affinitized to. Thus work will 647 * in a non-isr context, allowing the transport to finish
653 * be scheduled on the cpu received on. When 1, the LLDD 648 * op completion in the calling context. When 1, the LLDD
654 * may not deliver the CMD on the CPU it should be worked 649 * is calling the cmd rcv handler in an ISR context,
655 * on. The transport should pick a cpu to schedule the work 650 * requiring the transport to transition to a workqueue
656 * on. 651 * for op completion.
652 */
653 NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 2),
654 /* Bit 3: When 0, the LLDD is calling the op done handler
655 * in a non-isr context, allowing the transport to finish
656 * op completion in the calling context. When 1, the LLDD
657 * is calling the op done handler in an ISR context,
658 * requiring the transport to transition to a workqueue
659 * for op completion.
657 */ 660 */
658}; 661};
659 662
@@ -725,12 +728,12 @@ struct nvmet_fc_target_port {
725 * be freed/released. 728 * be freed/released.
726 * Entrypoint is Mandatory. 729 * Entrypoint is Mandatory.
727 * 730 *
728 * @fcp_op: Called to perform a data transfer, transmit a response, or 731 * @fcp_op: Called to perform a data transfer or transmit a response.
729 * abort an FCP opertion. The nvmefc_tgt_fcp_req structure is the same 732 * The nvmefc_tgt_fcp_req structure is the same LLDD-supplied
730 * LLDD-supplied exchange structure specified in the 733 * exchange structure specified in the nvmet_fc_rcv_fcp_req() call
731 * nvmet_fc_rcv_fcp_req() call made when the FCP CMD IU was received. 734 * made when the FCP CMD IU was received. The op field in the
732 * The op field in the structure shall indicate the operation for 735 * structure shall indicate the operation for the LLDD to perform
733 * the LLDD to perform relative to the io. 736 * relative to the io.
734 * NVMET_FCOP_READDATA operation: the LLDD is to send the 737 * NVMET_FCOP_READDATA operation: the LLDD is to send the
735 * payload data (described by sglist) to the host in 1 or 738 * payload data (described by sglist) to the host in 1 or
736 * more FC sequences (preferrably 1). Note: the fc-nvme layer 739 * more FC sequences (preferrably 1). Note: the fc-nvme layer
@@ -752,29 +755,31 @@ struct nvmet_fc_target_port {
752 * successfully, the LLDD is to update the nvmefc_tgt_fcp_req 755 * successfully, the LLDD is to update the nvmefc_tgt_fcp_req
753 * transferred_length field and may subsequently transmit the 756 * transferred_length field and may subsequently transmit the
754 * FCP_RSP iu payload (described by rspbuf, rspdma, rsplen). 757 * FCP_RSP iu payload (described by rspbuf, rspdma, rsplen).
755 * The LLDD is to await FCP_CONF reception to confirm the RSP 758 * If FCP_CONF is supported, the LLDD is to await FCP_CONF
756 * reception by the host. The LLDD may retramsit the FCP_RSP iu 759 * reception to confirm the RSP reception by the host. The LLDD
757 * if necessary per FC-NVME. Upon reception of FCP_CONF, or upon 760 * may retramsit the FCP_RSP iu if necessary per FC-NVME. Upon
758 * FCP_CONF failure, the LLDD is to set the nvmefc_tgt_fcp_req 761 * transmission of the FCP_RSP iu if FCP_CONF is not supported,
759 * fcp_error field and consider the operation complete.. 762 * or upon success/failure of FCP_CONF if it is supported, the
763 * LLDD is to set the nvmefc_tgt_fcp_req fcp_error field and
764 * consider the operation complete.
760 * NVMET_FCOP_RSP: the LLDD is to transmit the FCP_RSP iu payload 765 * NVMET_FCOP_RSP: the LLDD is to transmit the FCP_RSP iu payload
761 * (described by rspbuf, rspdma, rsplen). The LLDD is to await 766 * (described by rspbuf, rspdma, rsplen). If FCP_CONF is
762 * FCP_CONF reception to confirm the RSP reception by the host. 767 * supported, the LLDD is to await FCP_CONF reception to confirm
763 * The LLDD may retramsit the FCP_RSP iu if necessary per FC-NVME. 768 * the RSP reception by the host. The LLDD may retramsit the
764 * Upon reception of FCP_CONF, or upon FCP_CONF failure, the 769 * FCP_RSP iu if FCP_CONF is not received per FC-NVME. Upon
770 * transmission of the FCP_RSP iu if FCP_CONF is not supported,
771 * or upon success/failure of FCP_CONF if it is supported, the
765 * LLDD is to set the nvmefc_tgt_fcp_req fcp_error field and 772 * LLDD is to set the nvmefc_tgt_fcp_req fcp_error field and
766 * consider the operation complete.. 773 * consider the operation complete.
767 * NVMET_FCOP_ABORT: the LLDD is to terminate the exchange
768 * corresponding to the fcp operation. The LLDD shall send
769 * ABTS and follow FC exchange abort-multi rules, including
770 * ABTS retries and possible logout.
771 * Upon completing the indicated operation, the LLDD is to set the 774 * Upon completing the indicated operation, the LLDD is to set the
772 * status fields for the operation (tranferred_length and fcp_error 775 * status fields for the operation (tranferred_length and fcp_error
773 * status) in the request, then all the "done" routine 776 * status) in the request, then call the "done" routine
774 * indicated in the fcp request. Upon return from the "done" 777 * indicated in the fcp request. After the operation completes,
775 * routine for either a NVMET_FCOP_RSP or NVMET_FCOP_ABORT operation 778 * regardless of whether the FCP_RSP iu was successfully transmit,
776 * the fc-nvme layer will not longer reference the fcp request, 779 * the LLDD-supplied exchange structure must remain valid until the
777 * allowing the LLDD to free/release the fcp request. 780 * transport calls the fcp_req_release() callback to return ownership
781 * of the exchange structure back to the LLDD so that it may be used
782 * for another fcp command.
778 * Note: when calling the done routine for READDATA or WRITEDATA 783 * Note: when calling the done routine for READDATA or WRITEDATA
779 * operations, the fc-nvme layer may immediate convert, in the same 784 * operations, the fc-nvme layer may immediate convert, in the same
780 * thread and before returning to the LLDD, the fcp operation to 785 * thread and before returning to the LLDD, the fcp operation to
@@ -786,6 +791,22 @@ struct nvmet_fc_target_port {
786 * Returns 0 on success, -<errno> on failure (Ex: -EIO) 791 * Returns 0 on success, -<errno> on failure (Ex: -EIO)
787 * Entrypoint is Mandatory. 792 * Entrypoint is Mandatory.
788 * 793 *
794 * @fcp_abort: Called by the transport to abort an active command.
795 * The command may be in-between operations (nothing active in LLDD)
796 * or may have an active WRITEDATA operation pending. The LLDD is to
797 * initiate the ABTS process for the command and return from the
798 * callback. The ABTS does not need to be complete on the command.
799 * The fcp_abort callback inherently cannot fail. After the
800 * fcp_abort() callback completes, the transport will wait for any
801 * outstanding operation (if there was one) to complete, then will
802 * call the fcp_req_release() callback to return the command's
803 * exchange context back to the LLDD.
804 *
805 * @fcp_req_release: Called by the transport to return a nvmefc_tgt_fcp_req
806 * to the LLDD after all operations on the fcp operation are complete.
807 * This may be due to the command completing or upon completion of
808 * abort cleanup.
809 *
789 * @max_hw_queues: indicates the maximum number of hw queues the LLDD 810 * @max_hw_queues: indicates the maximum number of hw queues the LLDD
790 * supports for cpu affinitization. 811 * supports for cpu affinitization.
791 * Value is Mandatory. Must be at least 1. 812 * Value is Mandatory. Must be at least 1.
@@ -820,7 +841,11 @@ struct nvmet_fc_target_template {
820 int (*xmt_ls_rsp)(struct nvmet_fc_target_port *tgtport, 841 int (*xmt_ls_rsp)(struct nvmet_fc_target_port *tgtport,
821 struct nvmefc_tgt_ls_req *tls_req); 842 struct nvmefc_tgt_ls_req *tls_req);
822 int (*fcp_op)(struct nvmet_fc_target_port *tgtport, 843 int (*fcp_op)(struct nvmet_fc_target_port *tgtport,
823 struct nvmefc_tgt_fcp_req *); 844 struct nvmefc_tgt_fcp_req *fcpreq);
845 void (*fcp_abort)(struct nvmet_fc_target_port *tgtport,
846 struct nvmefc_tgt_fcp_req *fcpreq);
847 void (*fcp_req_release)(struct nvmet_fc_target_port *tgtport,
848 struct nvmefc_tgt_fcp_req *fcpreq);
824 849
825 u32 max_hw_queues; 850 u32 max_hw_queues;
826 u16 max_sgl_segments; 851 u16 max_sgl_segments;
@@ -848,4 +873,7 @@ int nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port *tgtport,
848 struct nvmefc_tgt_fcp_req *fcpreq, 873 struct nvmefc_tgt_fcp_req *fcpreq,
849 void *cmdiubuf, u32 cmdiubuf_len); 874 void *cmdiubuf, u32 cmdiubuf_len);
850 875
876void nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *tgtport,
877 struct nvmefc_tgt_fcp_req *fcpreq);
878
851#endif /* _NVME_FC_DRIVER_H */ 879#endif /* _NVME_FC_DRIVER_H */
diff --git a/include/linux/nvme-fc.h b/include/linux/nvme-fc.h
index 4b45226bd604..e997c4a49a88 100644
--- a/include/linux/nvme-fc.h
+++ b/include/linux/nvme-fc.h
@@ -16,8 +16,7 @@
16 */ 16 */
17 17
18/* 18/*
19 * This file contains definitions relative to FC-NVME r1.11 and a few 19 * This file contains definitions relative to FC-NVME r1.14 (16-020vB).
20 * newer items
21 */ 20 */
22 21
23#ifndef _NVME_FC_H 22#ifndef _NVME_FC_H
@@ -47,8 +46,15 @@ struct nvme_fc_cmd_iu {
47 46
48#define NVME_FC_SIZEOF_ZEROS_RSP 12 47#define NVME_FC_SIZEOF_ZEROS_RSP 12
49 48
49enum {
50 FCNVME_SC_SUCCESS = 0,
51 FCNVME_SC_INVALID_FIELD = 1,
52 FCNVME_SC_INVALID_CONNID = 2,
53};
54
50struct nvme_fc_ersp_iu { 55struct nvme_fc_ersp_iu {
51 __u8 rsvd0[2]; 56 __u8 status_code;
57 __u8 rsvd1;
52 __be16 iu_len; 58 __be16 iu_len;
53 __be32 rsn; 59 __be32 rsn;
54 __be32 xfrd_len; 60 __be32 xfrd_len;
@@ -58,7 +64,7 @@ struct nvme_fc_ersp_iu {
58}; 64};
59 65
60 66
61/* FC-NVME r1.03/16-119v0 NVME Link Services */ 67/* FC-NVME Link Services */
62enum { 68enum {
63 FCNVME_LS_RSVD = 0, 69 FCNVME_LS_RSVD = 0,
64 FCNVME_LS_RJT = 1, 70 FCNVME_LS_RJT = 1,
@@ -68,7 +74,7 @@ enum {
68 FCNVME_LS_DISCONNECT = 5, 74 FCNVME_LS_DISCONNECT = 5,
69}; 75};
70 76
71/* FC-NVME r1.03/16-119v0 NVME Link Service Descriptors */ 77/* FC-NVME Link Service Descriptors */
72enum { 78enum {
73 FCNVME_LSDESC_RSVD = 0x0, 79 FCNVME_LSDESC_RSVD = 0x0,
74 FCNVME_LSDESC_RQST = 0x1, 80 FCNVME_LSDESC_RQST = 0x1,
@@ -92,7 +98,6 @@ static inline __be32 fcnvme_lsdesc_len(size_t sz)
92 return cpu_to_be32(sz - (2 * sizeof(u32))); 98 return cpu_to_be32(sz - (2 * sizeof(u32)));
93} 99}
94 100
95
96struct fcnvme_ls_rqst_w0 { 101struct fcnvme_ls_rqst_w0 {
97 u8 ls_cmd; /* FCNVME_LS_xxx */ 102 u8 ls_cmd; /* FCNVME_LS_xxx */
98 u8 zeros[3]; 103 u8 zeros[3];
@@ -106,8 +111,53 @@ struct fcnvme_lsdesc_rqst {
106 __be32 rsvd12; 111 __be32 rsvd12;
107}; 112};
108 113
114/* FC-NVME LS RJT reason_code values */
115enum fcnvme_ls_rjt_reason {
116 FCNVME_RJT_RC_NONE = 0,
117 /* no reason - not to be sent */
118
119 FCNVME_RJT_RC_INVAL = 0x01,
120 /* invalid NVMe_LS command code */
121
122 FCNVME_RJT_RC_LOGIC = 0x03,
123 /* logical error */
124
125 FCNVME_RJT_RC_UNAB = 0x09,
126 /* unable to perform command request */
127
128 FCNVME_RJT_RC_UNSUP = 0x0b,
129 /* command not supported */
130
131 FCNVME_RJT_RC_INPROG = 0x0e,
132 /* command already in progress */
109 133
134 FCNVME_RJT_RC_INV_ASSOC = 0x40,
135 /* Invalid Association ID*/
110 136
137 FCNVME_RJT_RC_INV_CONN = 0x41,
138 /* Invalid Connection ID*/
139
140 FCNVME_RJT_RC_VENDOR = 0xff,
141 /* vendor specific error */
142};
143
144/* FC-NVME LS RJT reason_explanation values */
145enum fcnvme_ls_rjt_explan {
146 FCNVME_RJT_EXP_NONE = 0x00,
147 /* No additional explanation */
148
149 FCNVME_RJT_EXP_OXID_RXID = 0x17,
150 /* invalid OX_ID-RX_ID combination */
151
152 FCNVME_RJT_EXP_INSUF_RES = 0x29,
153 /* insufficient resources */
154
155 FCNVME_RJT_EXP_UNAB_DATA = 0x2a,
156 /* unable to supply requested data */
157
158 FCNVME_RJT_EXP_INV_LEN = 0x2d,
159 /* Invalid payload length */
160};
111 161
112/* FCNVME_LSDESC_RJT */ 162/* FCNVME_LSDESC_RJT */
113struct fcnvme_lsdesc_rjt { 163struct fcnvme_lsdesc_rjt {
@@ -119,15 +169,15 @@ struct fcnvme_lsdesc_rjt {
119 * Reject reason and explanaction codes are generic 169 * Reject reason and explanaction codes are generic
120 * to ELs's from LS-3. 170 * to ELs's from LS-3.
121 */ 171 */
122 u8 reason_code; 172 u8 reason_code; /* fcnvme_ls_rjt_reason */
123 u8 reason_explanation; 173 u8 reason_explanation; /* fcnvme_ls_rjt_explan */
124 174
125 u8 vendor; 175 u8 vendor;
126 __be32 rsvd12; 176 __be32 rsvd12;
127}; 177};
128 178
129 179
130#define FCNVME_ASSOC_HOSTID_LEN 64 180#define FCNVME_ASSOC_HOSTID_LEN 16
131#define FCNVME_ASSOC_HOSTNQN_LEN 256 181#define FCNVME_ASSOC_HOSTNQN_LEN 256
132#define FCNVME_ASSOC_SUBNQN_LEN 256 182#define FCNVME_ASSOC_SUBNQN_LEN 256
133 183
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index c43d435d4225..b625bacf37ef 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -64,26 +64,26 @@ enum {
64 * RDMA_QPTYPE field 64 * RDMA_QPTYPE field
65 */ 65 */
66enum { 66enum {
67 NVMF_RDMA_QPTYPE_CONNECTED = 0, /* Reliable Connected */ 67 NVMF_RDMA_QPTYPE_CONNECTED = 1, /* Reliable Connected */
68 NVMF_RDMA_QPTYPE_DATAGRAM = 1, /* Reliable Datagram */ 68 NVMF_RDMA_QPTYPE_DATAGRAM = 2, /* Reliable Datagram */
69}; 69};
70 70
71/* RDMA QP Service Type codes for Discovery Log Page entry TSAS 71/* RDMA QP Service Type codes for Discovery Log Page entry TSAS
72 * RDMA_QPTYPE field 72 * RDMA_QPTYPE field
73 */ 73 */
74enum { 74enum {
75 NVMF_RDMA_PRTYPE_NOT_SPECIFIED = 0, /* No Provider Specified */ 75 NVMF_RDMA_PRTYPE_NOT_SPECIFIED = 1, /* No Provider Specified */
76 NVMF_RDMA_PRTYPE_IB = 1, /* InfiniBand */ 76 NVMF_RDMA_PRTYPE_IB = 2, /* InfiniBand */
77 NVMF_RDMA_PRTYPE_ROCE = 2, /* InfiniBand RoCE */ 77 NVMF_RDMA_PRTYPE_ROCE = 3, /* InfiniBand RoCE */
78 NVMF_RDMA_PRTYPE_ROCEV2 = 3, /* InfiniBand RoCEV2 */ 78 NVMF_RDMA_PRTYPE_ROCEV2 = 4, /* InfiniBand RoCEV2 */
79 NVMF_RDMA_PRTYPE_IWARP = 4, /* IWARP */ 79 NVMF_RDMA_PRTYPE_IWARP = 5, /* IWARP */
80}; 80};
81 81
82/* RDMA Connection Management Service Type codes for Discovery Log Page 82/* RDMA Connection Management Service Type codes for Discovery Log Page
83 * entry TSAS RDMA_CMS field 83 * entry TSAS RDMA_CMS field
84 */ 84 */
85enum { 85enum {
86 NVMF_RDMA_CMS_RDMA_CM = 0, /* Sockets based enpoint addressing */ 86 NVMF_RDMA_CMS_RDMA_CM = 1, /* Sockets based endpoint addressing */
87}; 87};
88 88
89#define NVMF_AQ_DEPTH 32 89#define NVMF_AQ_DEPTH 32
@@ -245,6 +245,7 @@ enum {
245 NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3, 245 NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3,
246 NVME_CTRL_VWC_PRESENT = 1 << 0, 246 NVME_CTRL_VWC_PRESENT = 1 << 0,
247 NVME_CTRL_OACS_SEC_SUPP = 1 << 0, 247 NVME_CTRL_OACS_SEC_SUPP = 1 << 0,
248 NVME_CTRL_OACS_DBBUF_SUPP = 1 << 7,
248}; 249};
249 250
250struct nvme_lbaf { 251struct nvme_lbaf {
@@ -603,6 +604,7 @@ enum nvme_admin_opcode {
603 nvme_admin_download_fw = 0x11, 604 nvme_admin_download_fw = 0x11,
604 nvme_admin_ns_attach = 0x15, 605 nvme_admin_ns_attach = 0x15,
605 nvme_admin_keep_alive = 0x18, 606 nvme_admin_keep_alive = 0x18,
607 nvme_admin_dbbuf = 0x7C,
606 nvme_admin_format_nvm = 0x80, 608 nvme_admin_format_nvm = 0x80,
607 nvme_admin_security_send = 0x81, 609 nvme_admin_security_send = 0x81,
608 nvme_admin_security_recv = 0x82, 610 nvme_admin_security_recv = 0x82,
@@ -874,6 +876,16 @@ struct nvmf_property_get_command {
874 __u8 resv4[16]; 876 __u8 resv4[16];
875}; 877};
876 878
879struct nvme_dbbuf {
880 __u8 opcode;
881 __u8 flags;
882 __u16 command_id;
883 __u32 rsvd1[5];
884 __le64 prp1;
885 __le64 prp2;
886 __u32 rsvd12[6];
887};
888
877struct nvme_command { 889struct nvme_command {
878 union { 890 union {
879 struct nvme_common_command common; 891 struct nvme_common_command common;
@@ -893,6 +905,7 @@ struct nvme_command {
893 struct nvmf_connect_command connect; 905 struct nvmf_connect_command connect;
894 struct nvmf_property_set_command prop_set; 906 struct nvmf_property_set_command prop_set;
895 struct nvmf_property_get_command prop_get; 907 struct nvmf_property_get_command prop_get;
908 struct nvme_dbbuf dbbuf;
896 }; 909 };
897}; 910};
898 911
diff --git a/include/linux/of.h b/include/linux/of.h
index 21e6323de0f3..50fcdb54087f 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -159,6 +159,8 @@ static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
159 container_of(fwnode, struct device_node, fwnode) : NULL; 159 container_of(fwnode, struct device_node, fwnode) : NULL;
160} 160}
161 161
162#define of_fwnode_handle(node) (&(node)->fwnode)
163
162static inline bool of_have_populated_dt(void) 164static inline bool of_have_populated_dt(void)
163{ 165{
164 return of_root != NULL; 166 return of_root != NULL;
@@ -292,6 +294,9 @@ extern int of_property_count_elems_of_size(const struct device_node *np,
292extern int of_property_read_u32_index(const struct device_node *np, 294extern int of_property_read_u32_index(const struct device_node *np,
293 const char *propname, 295 const char *propname,
294 u32 index, u32 *out_value); 296 u32 index, u32 *out_value);
297extern int of_property_read_u64_index(const struct device_node *np,
298 const char *propname,
299 u32 index, u64 *out_value);
295extern int of_property_read_variable_u8_array(const struct device_node *np, 300extern int of_property_read_variable_u8_array(const struct device_node *np,
296 const char *propname, u8 *out_values, 301 const char *propname, u8 *out_values,
297 size_t sz_min, size_t sz_max); 302 size_t sz_min, size_t sz_max);
@@ -602,6 +607,8 @@ static inline struct device_node *of_find_node_with_property(
602 return NULL; 607 return NULL;
603} 608}
604 609
610#define of_fwnode_handle(node) NULL
611
605static inline bool of_have_populated_dt(void) 612static inline bool of_have_populated_dt(void)
606{ 613{
607 return false; 614 return false;
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index c12dace043f3..b4ad8b4f8506 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -34,8 +34,7 @@ extern void of_device_unregister(struct platform_device *ofdev);
34 34
35extern const void *of_device_get_match_data(const struct device *dev); 35extern const void *of_device_get_match_data(const struct device *dev);
36 36
37extern ssize_t of_device_get_modalias(struct device *dev, 37extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len);
38 char *str, ssize_t len);
39extern int of_device_request_module(struct device *dev); 38extern int of_device_request_module(struct device *dev);
40 39
41extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env); 40extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
@@ -55,7 +54,8 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
55 return of_node_get(cpu_dev->of_node); 54 return of_node_get(cpu_dev->of_node);
56} 55}
57 56
58void of_dma_configure(struct device *dev, struct device_node *np); 57int of_dma_configure(struct device *dev, struct device_node *np);
58void of_dma_deconfigure(struct device *dev);
59#else /* CONFIG_OF */ 59#else /* CONFIG_OF */
60 60
61static inline int of_driver_match_device(struct device *dev, 61static inline int of_driver_match_device(struct device *dev,
@@ -72,8 +72,8 @@ static inline const void *of_device_get_match_data(const struct device *dev)
72 return NULL; 72 return NULL;
73} 73}
74 74
75static inline int of_device_get_modalias(struct device *dev, 75static inline int of_device_modalias(struct device *dev,
76 char *str, ssize_t len) 76 char *str, ssize_t len)
77{ 77{
78 return -ENODEV; 78 return -ENODEV;
79} 79}
@@ -103,7 +103,12 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
103{ 103{
104 return NULL; 104 return NULL;
105} 105}
106static inline void of_dma_configure(struct device *dev, struct device_node *np) 106
107static inline int of_dma_configure(struct device *dev, struct device_node *np)
108{
109 return 0;
110}
111static inline void of_dma_deconfigure(struct device *dev)
107{} 112{}
108#endif /* CONFIG_OF */ 113#endif /* CONFIG_OF */
109 114
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 271b3fdf0070..1dfbfd0d8040 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -54,6 +54,11 @@ extern char __dtb_end[];
54extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, 54extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
55 int depth, void *data), 55 int depth, void *data),
56 void *data); 56 void *data);
57extern int of_scan_flat_dt_subnodes(unsigned long node,
58 int (*it)(unsigned long node,
59 const char *uname,
60 void *data),
61 void *data);
57extern int of_get_flat_dt_subnode_by_name(unsigned long node, 62extern int of_get_flat_dt_subnode_by_name(unsigned long node,
58 const char *uname); 63 const char *uname);
59extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, 64extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
@@ -62,6 +67,7 @@ extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
62extern int of_flat_dt_match(unsigned long node, const char *const *matches); 67extern int of_flat_dt_match(unsigned long node, const char *const *matches);
63extern unsigned long of_get_flat_dt_root(void); 68extern unsigned long of_get_flat_dt_root(void);
64extern int of_get_flat_dt_size(void); 69extern int of_get_flat_dt_size(void);
70extern uint32_t of_get_flat_dt_phandle(unsigned long node);
65 71
66extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 72extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
67 int depth, void *data); 73 int depth, void *data);
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 3f87ea5b8bee..1e089d5a182b 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -30,6 +30,7 @@ struct device_node;
30enum of_gpio_flags { 30enum of_gpio_flags {
31 OF_GPIO_ACTIVE_LOW = 0x1, 31 OF_GPIO_ACTIVE_LOW = 0x1,
32 OF_GPIO_SINGLE_ENDED = 0x2, 32 OF_GPIO_SINGLE_ENDED = 0x2,
33 OF_GPIO_OPEN_DRAIN = 0x4,
33}; 34};
34 35
35#ifdef CONFIG_OF_GPIO 36#ifdef CONFIG_OF_GPIO
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index a58cca8bcb29..ba35ba520487 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -12,7 +12,7 @@
12#include <linux/phy.h> 12#include <linux/phy.h>
13#include <linux/of.h> 13#include <linux/of.h>
14 14
15#ifdef CONFIG_OF 15#if IS_ENABLED(CONFIG_OF_MDIO)
16extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); 16extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
17extern struct phy_device *of_phy_find_device(struct device_node *phy_np); 17extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
18extern struct phy_device *of_phy_connect(struct net_device *dev, 18extern struct phy_device *of_phy_connect(struct net_device *dev,
@@ -32,7 +32,7 @@ extern int of_phy_register_fixed_link(struct device_node *np);
32extern void of_phy_deregister_fixed_link(struct device_node *np); 32extern void of_phy_deregister_fixed_link(struct device_node *np);
33extern bool of_phy_is_fixed_link(struct device_node *np); 33extern bool of_phy_is_fixed_link(struct device_node *np);
34 34
35#else /* CONFIG_OF */ 35#else /* CONFIG_OF_MDIO */
36static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 36static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
37{ 37{
38 /* 38 /*
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 0e0974eceb80..518c8d20647a 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -85,15 +85,4 @@ static inline int of_pci_get_host_bridge_resources(struct device_node *dev,
85} 85}
86#endif 86#endif
87 87
88#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
89int of_pci_msi_chip_add(struct msi_controller *chip);
90void of_pci_msi_chip_remove(struct msi_controller *chip);
91struct msi_controller *of_pci_find_msi_chip_by_node(struct device_node *of_node);
92#else
93static inline int of_pci_msi_chip_add(struct msi_controller *chip) { return -EINVAL; }
94static inline void of_pci_msi_chip_remove(struct msi_controller *chip) { }
95static inline struct msi_controller *
96of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; }
97#endif
98
99#endif 88#endif
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 956a1006aefc..e0d1946270f3 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -64,6 +64,7 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
64 const char *bus_id, 64 const char *bus_id,
65 struct device *parent); 65 struct device *parent);
66 66
67extern int of_platform_device_destroy(struct device *dev, void *data);
67extern int of_platform_bus_probe(struct device_node *root, 68extern int of_platform_bus_probe(struct device_node *root,
68 const struct of_device_id *matches, 69 const struct of_device_id *matches,
69 struct device *parent); 70 struct device *parent);
@@ -76,6 +77,10 @@ extern int of_platform_default_populate(struct device_node *root,
76 const struct of_dev_auxdata *lookup, 77 const struct of_dev_auxdata *lookup,
77 struct device *parent); 78 struct device *parent);
78extern void of_platform_depopulate(struct device *parent); 79extern void of_platform_depopulate(struct device *parent);
80
81extern int devm_of_platform_populate(struct device *dev);
82
83extern void devm_of_platform_depopulate(struct device *dev);
79#else 84#else
80static inline int of_platform_populate(struct device_node *root, 85static inline int of_platform_populate(struct device_node *root,
81 const struct of_device_id *matches, 86 const struct of_device_id *matches,
@@ -91,6 +96,13 @@ static inline int of_platform_default_populate(struct device_node *root,
91 return -ENODEV; 96 return -ENODEV;
92} 97}
93static inline void of_platform_depopulate(struct device *parent) { } 98static inline void of_platform_depopulate(struct device *parent) { }
99
100static inline int devm_of_platform_populate(struct device *dev)
101{
102 return -ENODEV;
103}
104
105static inline void devm_of_platform_depopulate(struct device *dev) { }
94#endif 106#endif
95 107
96#if defined(CONFIG_OF_DYNAMIC) && defined(CONFIG_OF_ADDRESS) 108#if defined(CONFIG_OF_DYNAMIC) && defined(CONFIG_OF_ADDRESS)
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 047d64706f2a..d4cd2014fa6f 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -33,10 +33,7 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
33 bool skip_hwpoisoned_pages); 33 bool skip_hwpoisoned_pages);
34void set_pageblock_migratetype(struct page *page, int migratetype); 34void set_pageblock_migratetype(struct page *page, int migratetype);
35int move_freepages_block(struct zone *zone, struct page *page, 35int move_freepages_block(struct zone *zone, struct page *page,
36 int migratetype); 36 int migratetype, int *num_movable);
37int move_freepages(struct zone *zone,
38 struct page *start_page, struct page *end_page,
39 int migratetype);
40 37
41/* 38/*
42 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. 39 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 84943e8057ef..316a19f6b635 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -148,7 +148,7 @@ static inline int page_cache_get_speculative(struct page *page)
148 148
149#ifdef CONFIG_TINY_RCU 149#ifdef CONFIG_TINY_RCU
150# ifdef CONFIG_PREEMPT_COUNT 150# ifdef CONFIG_PREEMPT_COUNT
151 VM_BUG_ON(!in_atomic()); 151 VM_BUG_ON(!in_atomic() && !irqs_disabled());
152# endif 152# endif
153 /* 153 /*
154 * Preempt must be disabled here - we rely on rcu_read_lock doing 154 * Preempt must be disabled here - we rely on rcu_read_lock doing
@@ -186,7 +186,7 @@ static inline int page_cache_add_speculative(struct page *page, int count)
186 186
187#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) 187#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
188# ifdef CONFIG_PREEMPT_COUNT 188# ifdef CONFIG_PREEMPT_COUNT
189 VM_BUG_ON(!in_atomic()); 189 VM_BUG_ON(!in_atomic() && !irqs_disabled());
190# endif 190# endif
191 VM_BUG_ON_PAGE(page_count(page) == 0, page); 191 VM_BUG_ON_PAGE(page_count(page) == 0, page);
192 page_ref_add(page, count); 192 page_ref_add(page, count);
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
index f0d2b9451270..809c2f1873ac 100644
--- a/include/linux/pci-ecam.h
+++ b/include/linux/pci-ecam.h
@@ -16,6 +16,7 @@
16#ifndef DRIVERS_PCI_ECAM_H 16#ifndef DRIVERS_PCI_ECAM_H
17#define DRIVERS_PCI_ECAM_H 17#define DRIVERS_PCI_ECAM_H
18 18
19#include <linux/pci.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21 22
@@ -68,7 +69,7 @@ extern struct pci_ecam_ops xgene_v1_pcie_ecam_ops; /* APM X-Gene PCIe v1 */
68extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */ 69extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */
69#endif 70#endif
70 71
71#ifdef CONFIG_PCI_HOST_GENERIC 72#ifdef CONFIG_PCI_HOST_COMMON
72/* for DT-based PCI controllers that support ECAM */ 73/* for DT-based PCI controllers that support ECAM */
73int pci_host_common_probe(struct platform_device *pdev, 74int pci_host_common_probe(struct platform_device *pdev,
74 struct pci_ecam_ops *ops); 75 struct pci_ecam_ops *ops);
diff --git a/include/linux/pci-ep-cfs.h b/include/linux/pci-ep-cfs.h
new file mode 100644
index 000000000000..263b89ea5705
--- /dev/null
+++ b/include/linux/pci-ep-cfs.h
@@ -0,0 +1,41 @@
1/**
2 * PCI Endpoint ConfigFS header file
3 *
4 * Copyright (C) 2017 Texas Instruments
5 * Author: Kishon Vijay Abraham I <kishon@ti.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 version 2 of
9 * the License as published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_PCI_EP_CFS_H
13#define __LINUX_PCI_EP_CFS_H
14
15#include <linux/configfs.h>
16
17#ifdef CONFIG_PCI_ENDPOINT_CONFIGFS
18struct config_group *pci_ep_cfs_add_epc_group(const char *name);
19void pci_ep_cfs_remove_epc_group(struct config_group *group);
20struct config_group *pci_ep_cfs_add_epf_group(const char *name);
21void pci_ep_cfs_remove_epf_group(struct config_group *group);
22#else
23static inline struct config_group *pci_ep_cfs_add_epc_group(const char *name)
24{
25 return 0;
26}
27
28static inline void pci_ep_cfs_remove_epc_group(struct config_group *group)
29{
30}
31
32static inline struct config_group *pci_ep_cfs_add_epf_group(const char *name)
33{
34 return 0;
35}
36
37static inline void pci_ep_cfs_remove_epf_group(struct config_group *group)
38{
39}
40#endif
41#endif /* __LINUX_PCI_EP_CFS_H */
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
new file mode 100644
index 000000000000..af5edbf3eea3
--- /dev/null
+++ b/include/linux/pci-epc.h
@@ -0,0 +1,144 @@
1/**
2 * PCI Endpoint *Controller* (EPC) header file
3 *
4 * Copyright (C) 2017 Texas Instruments
5 * Author: Kishon Vijay Abraham I <kishon@ti.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 version 2 of
9 * the License as published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_PCI_EPC_H
13#define __LINUX_PCI_EPC_H
14
15#include <linux/pci-epf.h>
16
17struct pci_epc;
18
19enum pci_epc_irq_type {
20 PCI_EPC_IRQ_UNKNOWN,
21 PCI_EPC_IRQ_LEGACY,
22 PCI_EPC_IRQ_MSI,
23};
24
25/**
26 * struct pci_epc_ops - set of function pointers for performing EPC operations
27 * @write_header: ops to populate configuration space header
28 * @set_bar: ops to configure the BAR
29 * @clear_bar: ops to reset the BAR
30 * @map_addr: ops to map CPU address to PCI address
31 * @unmap_addr: ops to unmap CPU address and PCI address
32 * @set_msi: ops to set the requested number of MSI interrupts in the MSI
33 * capability register
34 * @get_msi: ops to get the number of MSI interrupts allocated by the RC from
35 * the MSI capability register
36 * @raise_irq: ops to raise a legacy or MSI interrupt
37 * @start: ops to start the PCI link
38 * @stop: ops to stop the PCI link
39 * @owner: the module owner containing the ops
40 */
41struct pci_epc_ops {
42 int (*write_header)(struct pci_epc *pci_epc,
43 struct pci_epf_header *hdr);
44 int (*set_bar)(struct pci_epc *epc, enum pci_barno bar,
45 dma_addr_t bar_phys, size_t size, int flags);
46 void (*clear_bar)(struct pci_epc *epc, enum pci_barno bar);
47 int (*map_addr)(struct pci_epc *epc, phys_addr_t addr,
48 u64 pci_addr, size_t size);
49 void (*unmap_addr)(struct pci_epc *epc, phys_addr_t addr);
50 int (*set_msi)(struct pci_epc *epc, u8 interrupts);
51 int (*get_msi)(struct pci_epc *epc);
52 int (*raise_irq)(struct pci_epc *pci_epc,
53 enum pci_epc_irq_type type, u8 interrupt_num);
54 int (*start)(struct pci_epc *epc);
55 void (*stop)(struct pci_epc *epc);
56 struct module *owner;
57};
58
59/**
60 * struct pci_epc_mem - address space of the endpoint controller
61 * @phys_base: physical base address of the PCI address space
62 * @size: the size of the PCI address space
63 * @bitmap: bitmap to manage the PCI address space
64 * @pages: number of bits representing the address region
65 */
66struct pci_epc_mem {
67 phys_addr_t phys_base;
68 size_t size;
69 unsigned long *bitmap;
70 int pages;
71};
72
73/**
74 * struct pci_epc - represents the PCI EPC device
75 * @dev: PCI EPC device
76 * @pci_epf: list of endpoint functions present in this EPC device
77 * @ops: function pointers for performing endpoint operations
78 * @mem: address space of the endpoint controller
79 * @max_functions: max number of functions that can be configured in this EPC
80 * @group: configfs group representing the PCI EPC device
81 * @lock: spinlock to protect pci_epc ops
82 */
83struct pci_epc {
84 struct device dev;
85 struct list_head pci_epf;
86 const struct pci_epc_ops *ops;
87 struct pci_epc_mem *mem;
88 u8 max_functions;
89 struct config_group *group;
90 /* spinlock to protect against concurrent access of EP controller */
91 spinlock_t lock;
92};
93
94#define to_pci_epc(device) container_of((device), struct pci_epc, dev)
95
96#define pci_epc_create(dev, ops) \
97 __pci_epc_create((dev), (ops), THIS_MODULE)
98#define devm_pci_epc_create(dev, ops) \
99 __devm_pci_epc_create((dev), (ops), THIS_MODULE)
100
101static inline void epc_set_drvdata(struct pci_epc *epc, void *data)
102{
103 dev_set_drvdata(&epc->dev, data);
104}
105
106static inline void *epc_get_drvdata(struct pci_epc *epc)
107{
108 return dev_get_drvdata(&epc->dev);
109}
110
111struct pci_epc *
112__devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
113 struct module *owner);
114struct pci_epc *
115__pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
116 struct module *owner);
117void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc);
118void pci_epc_destroy(struct pci_epc *epc);
119int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf);
120void pci_epc_linkup(struct pci_epc *epc);
121void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf);
122int pci_epc_write_header(struct pci_epc *epc, struct pci_epf_header *hdr);
123int pci_epc_set_bar(struct pci_epc *epc, enum pci_barno bar,
124 dma_addr_t bar_phys, size_t size, int flags);
125void pci_epc_clear_bar(struct pci_epc *epc, int bar);
126int pci_epc_map_addr(struct pci_epc *epc, phys_addr_t phys_addr,
127 u64 pci_addr, size_t size);
128void pci_epc_unmap_addr(struct pci_epc *epc, phys_addr_t phys_addr);
129int pci_epc_set_msi(struct pci_epc *epc, u8 interrupts);
130int pci_epc_get_msi(struct pci_epc *epc);
131int pci_epc_raise_irq(struct pci_epc *epc, enum pci_epc_irq_type type,
132 u8 interrupt_num);
133int pci_epc_start(struct pci_epc *epc);
134void pci_epc_stop(struct pci_epc *epc);
135struct pci_epc *pci_epc_get(const char *epc_name);
136void pci_epc_put(struct pci_epc *epc);
137
138int pci_epc_mem_init(struct pci_epc *epc, phys_addr_t phys_addr, size_t size);
139void pci_epc_mem_exit(struct pci_epc *epc);
140void __iomem *pci_epc_mem_alloc_addr(struct pci_epc *epc,
141 phys_addr_t *phys_addr, size_t size);
142void pci_epc_mem_free_addr(struct pci_epc *epc, phys_addr_t phys_addr,
143 void __iomem *virt_addr, size_t size);
144#endif /* __LINUX_PCI_EPC_H */
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
new file mode 100644
index 000000000000..0d529cb90143
--- /dev/null
+++ b/include/linux/pci-epf.h
@@ -0,0 +1,162 @@
1/**
2 * PCI Endpoint *Function* (EPF) header file
3 *
4 * Copyright (C) 2017 Texas Instruments
5 * Author: Kishon Vijay Abraham I <kishon@ti.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 version 2 of
9 * the License as published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_PCI_EPF_H
13#define __LINUX_PCI_EPF_H
14
15#include <linux/device.h>
16#include <linux/mod_devicetable.h>
17
18struct pci_epf;
19
20enum pci_interrupt_pin {
21 PCI_INTERRUPT_UNKNOWN,
22 PCI_INTERRUPT_INTA,
23 PCI_INTERRUPT_INTB,
24 PCI_INTERRUPT_INTC,
25 PCI_INTERRUPT_INTD,
26};
27
28enum pci_barno {
29 BAR_0,
30 BAR_1,
31 BAR_2,
32 BAR_3,
33 BAR_4,
34 BAR_5,
35};
36
37/**
38 * struct pci_epf_header - represents standard configuration header
39 * @vendorid: identifies device manufacturer
40 * @deviceid: identifies a particular device
41 * @revid: specifies a device-specific revision identifier
42 * @progif_code: identifies a specific register-level programming interface
43 * @subclass_code: identifies more specifically the function of the device
44 * @baseclass_code: broadly classifies the type of function the device performs
45 * @cache_line_size: specifies the system cacheline size in units of DWORDs
46 * @subsys_vendor_id: vendor of the add-in card or subsystem
47 * @subsys_id: id specific to vendor
48 * @interrupt_pin: interrupt pin the device (or device function) uses
49 */
50struct pci_epf_header {
51 u16 vendorid;
52 u16 deviceid;
53 u8 revid;
54 u8 progif_code;
55 u8 subclass_code;
56 u8 baseclass_code;
57 u8 cache_line_size;
58 u16 subsys_vendor_id;
59 u16 subsys_id;
60 enum pci_interrupt_pin interrupt_pin;
61};
62
63/**
64 * struct pci_epf_ops - set of function pointers for performing EPF operations
65 * @bind: ops to perform when a EPC device has been bound to EPF device
66 * @unbind: ops to perform when a binding has been lost between a EPC device
67 * and EPF device
68 * @linkup: ops to perform when the EPC device has established a connection with
69 * a host system
70 */
71struct pci_epf_ops {
72 int (*bind)(struct pci_epf *epf);
73 void (*unbind)(struct pci_epf *epf);
74 void (*linkup)(struct pci_epf *epf);
75};
76
77/**
78 * struct pci_epf_driver - represents the PCI EPF driver
79 * @probe: ops to perform when a new EPF device has been bound to the EPF driver
80 * @remove: ops to perform when the binding between the EPF device and EPF
81 * driver is broken
82 * @driver: PCI EPF driver
83 * @ops: set of function pointers for performing EPF operations
84 * @owner: the owner of the module that registers the PCI EPF driver
85 * @group: configfs group corresponding to the PCI EPF driver
86 * @id_table: identifies EPF devices for probing
87 */
88struct pci_epf_driver {
89 int (*probe)(struct pci_epf *epf);
90 int (*remove)(struct pci_epf *epf);
91
92 struct device_driver driver;
93 struct pci_epf_ops *ops;
94 struct module *owner;
95 struct config_group *group;
96 const struct pci_epf_device_id *id_table;
97};
98
99#define to_pci_epf_driver(drv) (container_of((drv), struct pci_epf_driver, \
100 driver))
101
102/**
103 * struct pci_epf_bar - represents the BAR of EPF device
104 * @phys_addr: physical address that should be mapped to the BAR
105 * @size: the size of the address space present in BAR
106 */
107struct pci_epf_bar {
108 dma_addr_t phys_addr;
109 size_t size;
110};
111
112/**
113 * struct pci_epf - represents the PCI EPF device
114 * @dev: the PCI EPF device
115 * @name: the name of the PCI EPF device
116 * @header: represents standard configuration header
117 * @bar: represents the BAR of EPF device
118 * @msi_interrupts: number of MSI interrupts required by this function
119 * @func_no: unique function number within this endpoint device
120 * @epc: the EPC device to which this EPF device is bound
121 * @driver: the EPF driver to which this EPF device is bound
122 * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc
123 */
124struct pci_epf {
125 struct device dev;
126 const char *name;
127 struct pci_epf_header *header;
128 struct pci_epf_bar bar[6];
129 u8 msi_interrupts;
130 u8 func_no;
131
132 struct pci_epc *epc;
133 struct pci_epf_driver *driver;
134 struct list_head list;
135};
136
137#define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev)
138
139#define pci_epf_register_driver(driver) \
140 __pci_epf_register_driver((driver), THIS_MODULE)
141
142static inline void epf_set_drvdata(struct pci_epf *epf, void *data)
143{
144 dev_set_drvdata(&epf->dev, data);
145}
146
147static inline void *epf_get_drvdata(struct pci_epf *epf)
148{
149 return dev_get_drvdata(&epf->dev);
150}
151
152struct pci_epf *pci_epf_create(const char *name);
153void pci_epf_destroy(struct pci_epf *epf);
154int __pci_epf_register_driver(struct pci_epf_driver *driver,
155 struct module *owner);
156void pci_epf_unregister_driver(struct pci_epf_driver *driver);
157void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar);
158void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);
159int pci_epf_bind(struct pci_epf *epf);
160void pci_epf_unbind(struct pci_epf *epf);
161void pci_epf_linkup(struct pci_epf *epf);
162#endif /* __LINUX_PCI_EPF_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index eb3da1a04e6c..8039f9f0ca05 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -28,6 +28,7 @@
28#include <linux/kobject.h> 28#include <linux/kobject.h>
29#include <linux/atomic.h> 29#include <linux/atomic.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/interrupt.h>
31#include <linux/io.h> 32#include <linux/io.h>
32#include <linux/resource_ext.h> 33#include <linux/resource_ext.h>
33#include <uapi/linux/pci.h> 34#include <uapi/linux/pci.h>
@@ -178,6 +179,15 @@ enum pci_dev_flags {
178 PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), 179 PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7),
179 /* Get VPD from function 0 VPD */ 180 /* Get VPD from function 0 VPD */
180 PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8), 181 PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8),
182 /* a non-root bridge where translation occurs, stop alias search here */
183 PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9),
184 /* Do not use FLR even if device advertises PCI_AF_CAP */
185 PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10),
186 /*
187 * Resume before calling the driver's system suspend hooks, disabling
188 * the direct_complete optimization.
189 */
190 PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11),
181}; 191};
182 192
183enum pci_irq_reroute_variant { 193enum pci_irq_reroute_variant {
@@ -358,6 +368,7 @@ struct pci_dev {
358 unsigned int is_virtfn:1; 368 unsigned int is_virtfn:1;
359 unsigned int reset_fn:1; 369 unsigned int reset_fn:1;
360 unsigned int is_hotplug_bridge:1; 370 unsigned int is_hotplug_bridge:1;
371 unsigned int is_thunderbolt:1; /* Thunderbolt controller */
361 unsigned int __aer_firmware_first_valid:1; 372 unsigned int __aer_firmware_first_valid:1;
362 unsigned int __aer_firmware_first:1; 373 unsigned int __aer_firmware_first:1;
363 unsigned int broken_intx_masking:1; 374 unsigned int broken_intx_masking:1;
@@ -396,6 +407,8 @@ struct pci_dev {
396 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ 407 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
397 size_t romlen; /* Length of ROM if it's not from the BAR */ 408 size_t romlen; /* Length of ROM if it's not from the BAR */
398 char *driver_override; /* Driver name to force a match */ 409 char *driver_override; /* Driver name to force a match */
410
411 unsigned long priv_flags; /* Private flags for the pci driver */
399}; 412};
400 413
401static inline struct pci_dev *pci_physfn(struct pci_dev *dev) 414static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
@@ -940,32 +953,12 @@ int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn,
940 953
941struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); 954struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops);
942 955
943static inline int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) 956int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val);
944{ 957int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val);
945 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); 958int pci_read_config_dword(const struct pci_dev *dev, int where, u32 *val);
946} 959int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val);
947static inline int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) 960int pci_write_config_word(const struct pci_dev *dev, int where, u16 val);
948{ 961int pci_write_config_dword(const struct pci_dev *dev, int where, u32 val);
949 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
950}
951static inline int pci_read_config_dword(const struct pci_dev *dev, int where,
952 u32 *val)
953{
954 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
955}
956static inline int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val)
957{
958 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
959}
960static inline int pci_write_config_word(const struct pci_dev *dev, int where, u16 val)
961{
962 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
963}
964static inline int pci_write_config_dword(const struct pci_dev *dev, int where,
965 u32 val)
966{
967 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
968}
969 962
970int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); 963int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val);
971int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val); 964int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val);
@@ -1052,6 +1045,7 @@ int pcie_get_mps(struct pci_dev *dev);
1052int pcie_set_mps(struct pci_dev *dev, int mps); 1045int pcie_set_mps(struct pci_dev *dev, int mps);
1053int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed, 1046int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
1054 enum pcie_link_width *width); 1047 enum pcie_link_width *width);
1048void pcie_flr(struct pci_dev *dev);
1055int __pci_reset_function(struct pci_dev *dev); 1049int __pci_reset_function(struct pci_dev *dev);
1056int __pci_reset_function_locked(struct pci_dev *dev); 1050int __pci_reset_function_locked(struct pci_dev *dev);
1057int pci_reset_function(struct pci_dev *dev); 1051int pci_reset_function(struct pci_dev *dev);
@@ -1072,6 +1066,11 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags);
1072bool pci_device_is_present(struct pci_dev *pdev); 1066bool pci_device_is_present(struct pci_dev *pdev);
1073void pci_ignore_hotplug(struct pci_dev *dev); 1067void pci_ignore_hotplug(struct pci_dev *dev);
1074 1068
1069int __printf(6, 7) pci_request_irq(struct pci_dev *dev, unsigned int nr,
1070 irq_handler_t handler, irq_handler_t thread_fn, void *dev_id,
1071 const char *fmt, ...);
1072void pci_free_irq(struct pci_dev *dev, unsigned int nr, void *dev_id);
1073
1075/* ROM control related routines */ 1074/* ROM control related routines */
1076int pci_enable_rom(struct pci_dev *pdev); 1075int pci_enable_rom(struct pci_dev *pdev);
1077void pci_disable_rom(struct pci_dev *pdev); 1076void pci_disable_rom(struct pci_dev *pdev);
@@ -1199,6 +1198,11 @@ unsigned long pci_address_to_pio(phys_addr_t addr);
1199phys_addr_t pci_pio_to_address(unsigned long pio); 1198phys_addr_t pci_pio_to_address(unsigned long pio);
1200int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr); 1199int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr);
1201void pci_unmap_iospace(struct resource *res); 1200void pci_unmap_iospace(struct resource *res);
1201void __iomem *devm_pci_remap_cfgspace(struct device *dev,
1202 resource_size_t offset,
1203 resource_size_t size);
1204void __iomem *devm_pci_remap_cfg_resource(struct device *dev,
1205 struct resource *res);
1202 1206
1203static inline pci_bus_addr_t pci_bus_address(struct pci_dev *pdev, int bar) 1207static inline pci_bus_addr_t pci_bus_address(struct pci_dev *pdev, int bar)
1204{ 1208{
@@ -1297,11 +1301,8 @@ struct msix_entry {
1297 1301
1298#ifdef CONFIG_PCI_MSI 1302#ifdef CONFIG_PCI_MSI
1299int pci_msi_vec_count(struct pci_dev *dev); 1303int pci_msi_vec_count(struct pci_dev *dev);
1300void pci_msi_shutdown(struct pci_dev *dev);
1301void pci_disable_msi(struct pci_dev *dev); 1304void pci_disable_msi(struct pci_dev *dev);
1302int pci_msix_vec_count(struct pci_dev *dev); 1305int pci_msix_vec_count(struct pci_dev *dev);
1303int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1304void pci_msix_shutdown(struct pci_dev *dev);
1305void pci_disable_msix(struct pci_dev *dev); 1306void pci_disable_msix(struct pci_dev *dev);
1306void pci_restore_msi_state(struct pci_dev *dev); 1307void pci_restore_msi_state(struct pci_dev *dev);
1307int pci_msi_enabled(void); 1308int pci_msi_enabled(void);
@@ -1327,13 +1328,8 @@ int pci_irq_get_node(struct pci_dev *pdev, int vec);
1327 1328
1328#else 1329#else
1329static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } 1330static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; }
1330static inline void pci_msi_shutdown(struct pci_dev *dev) { }
1331static inline void pci_disable_msi(struct pci_dev *dev) { } 1331static inline void pci_disable_msi(struct pci_dev *dev) { }
1332static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } 1332static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; }
1333static inline int pci_enable_msix(struct pci_dev *dev,
1334 struct msix_entry *entries, int nvec)
1335{ return -ENOSYS; }
1336static inline void pci_msix_shutdown(struct pci_dev *dev) { }
1337static inline void pci_disable_msix(struct pci_dev *dev) { } 1333static inline void pci_disable_msix(struct pci_dev *dev) { }
1338static inline void pci_restore_msi_state(struct pci_dev *dev) { } 1334static inline void pci_restore_msi_state(struct pci_dev *dev) { }
1339static inline int pci_msi_enabled(void) { return 0; } 1335static inline int pci_msi_enabled(void) { return 0; }
@@ -1351,9 +1347,9 @@ pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
1351 unsigned int max_vecs, unsigned int flags, 1347 unsigned int max_vecs, unsigned int flags,
1352 const struct irq_affinity *aff_desc) 1348 const struct irq_affinity *aff_desc)
1353{ 1349{
1354 if (min_vecs > 1) 1350 if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq)
1355 return -EINVAL; 1351 return 1;
1356 return 1; 1352 return -ENOSPC;
1357} 1353}
1358 1354
1359static inline void pci_free_irq_vectors(struct pci_dev *dev) 1355static inline void pci_free_irq_vectors(struct pci_dev *dev)
@@ -1626,6 +1622,36 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
1626 1622
1627#include <asm/pci.h> 1623#include <asm/pci.h>
1628 1624
1625/* These two functions provide almost identical functionality. Depennding
1626 * on the architecture, one will be implemented as a wrapper around the
1627 * other (in drivers/pci/mmap.c).
1628 *
1629 * pci_mmap_resource_range() maps a specific BAR, and vm->vm_pgoff
1630 * is expected to be an offset within that region.
1631 *
1632 * pci_mmap_page_range() is the legacy architecture-specific interface,
1633 * which accepts a "user visible" resource address converted by
1634 * pci_resource_to_user(), as used in the legacy mmap() interface in
1635 * /proc/bus/pci/.
1636 */
1637int pci_mmap_resource_range(struct pci_dev *dev, int bar,
1638 struct vm_area_struct *vma,
1639 enum pci_mmap_state mmap_state, int write_combine);
1640int pci_mmap_page_range(struct pci_dev *pdev, int bar,
1641 struct vm_area_struct *vma,
1642 enum pci_mmap_state mmap_state, int write_combine);
1643
1644#ifndef arch_can_pci_mmap_wc
1645#define arch_can_pci_mmap_wc() 0
1646#endif
1647
1648#ifndef arch_can_pci_mmap_io
1649#define arch_can_pci_mmap_io() 0
1650#define pci_iobar_pfn(pdev, bar, vma) (-EINVAL)
1651#else
1652int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma);
1653#endif
1654
1629#ifndef pci_root_bus_fwnode 1655#ifndef pci_root_bus_fwnode
1630#define pci_root_bus_fwnode(bus) NULL 1656#define pci_root_bus_fwnode(bus) NULL
1631#endif 1657#endif
@@ -2160,6 +2186,28 @@ static inline bool pci_ari_enabled(struct pci_bus *bus)
2160 return bus->self && bus->self->ari_enabled; 2186 return bus->self && bus->self->ari_enabled;
2161} 2187}
2162 2188
2189/**
2190 * pci_is_thunderbolt_attached - whether device is on a Thunderbolt daisy chain
2191 * @pdev: PCI device to check
2192 *
2193 * Walk upwards from @pdev and check for each encountered bridge if it's part
2194 * of a Thunderbolt controller. Reaching the host bridge means @pdev is not
2195 * Thunderbolt-attached. (But rather soldered to the mainboard usually.)
2196 */
2197static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
2198{
2199 struct pci_dev *parent = pdev;
2200
2201 if (pdev->is_thunderbolt)
2202 return true;
2203
2204 while ((parent = pci_upstream_bridge(parent)))
2205 if (parent->is_thunderbolt)
2206 return true;
2207
2208 return false;
2209}
2210
2163/* provide the legacy pci_dma_* API */ 2211/* provide the legacy pci_dma_* API */
2164#include <linux/pci-dma-compat.h> 2212#include <linux/pci-dma-compat.h>
2165 2213
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index a4f77feecbb0..5f6b71d15393 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -862,6 +862,8 @@
862#define PCI_DEVICE_ID_TI_X620 0xac8d 862#define PCI_DEVICE_ID_TI_X620 0xac8d
863#define PCI_DEVICE_ID_TI_X420 0xac8e 863#define PCI_DEVICE_ID_TI_X420 0xac8e
864#define PCI_DEVICE_ID_TI_XX20_FM 0xac8f 864#define PCI_DEVICE_ID_TI_XX20_FM 0xac8f
865#define PCI_DEVICE_ID_TI_DRA74x 0xb500
866#define PCI_DEVICE_ID_TI_DRA72x 0xb501
865 867
866#define PCI_VENDOR_ID_SONY 0x104d 868#define PCI_VENDOR_ID_SONY 0x104d
867 869
diff --git a/include/linux/pe.h b/include/linux/pe.h
index e170b95e763b..143ce75be5f0 100644
--- a/include/linux/pe.h
+++ b/include/linux/pe.h
@@ -23,34 +23,6 @@
23 23
24#define MZ_MAGIC 0x5a4d /* "MZ" */ 24#define MZ_MAGIC 0x5a4d /* "MZ" */
25 25
26struct mz_hdr {
27 uint16_t magic; /* MZ_MAGIC */
28 uint16_t lbsize; /* size of last used block */
29 uint16_t blocks; /* pages in file, 0x3 */
30 uint16_t relocs; /* relocations */
31 uint16_t hdrsize; /* header size in "paragraphs" */
32 uint16_t min_extra_pps; /* .bss */
33 uint16_t max_extra_pps; /* runtime limit for the arena size */
34 uint16_t ss; /* relative stack segment */
35 uint16_t sp; /* initial %sp register */
36 uint16_t checksum; /* word checksum */
37 uint16_t ip; /* initial %ip register */
38 uint16_t cs; /* initial %cs relative to load segment */
39 uint16_t reloc_table_offset; /* offset of the first relocation */
40 uint16_t overlay_num; /* overlay number. set to 0. */
41 uint16_t reserved0[4]; /* reserved */
42 uint16_t oem_id; /* oem identifier */
43 uint16_t oem_info; /* oem specific */
44 uint16_t reserved1[10]; /* reserved */
45 uint32_t peaddr; /* address of pe header */
46 char message[64]; /* message to print */
47};
48
49struct mz_reloc {
50 uint16_t offset;
51 uint16_t segment;
52};
53
54#define PE_MAGIC 0x00004550 /* "PE\0\0" */ 26#define PE_MAGIC 0x00004550 /* "PE\0\0" */
55#define PE_OPT_MAGIC_PE32 0x010b 27#define PE_OPT_MAGIC_PE32 0x010b
56#define PE_OPT_MAGIC_PE32_ROM 0x0107 28#define PE_OPT_MAGIC_PE32_ROM 0x0107
@@ -62,6 +34,7 @@ struct mz_reloc {
62#define IMAGE_FILE_MACHINE_AMD64 0x8664 34#define IMAGE_FILE_MACHINE_AMD64 0x8664
63#define IMAGE_FILE_MACHINE_ARM 0x01c0 35#define IMAGE_FILE_MACHINE_ARM 0x01c0
64#define IMAGE_FILE_MACHINE_ARMV7 0x01c4 36#define IMAGE_FILE_MACHINE_ARMV7 0x01c4
37#define IMAGE_FILE_MACHINE_ARM64 0xaa64
65#define IMAGE_FILE_MACHINE_EBC 0x0ebc 38#define IMAGE_FILE_MACHINE_EBC 0x0ebc
66#define IMAGE_FILE_MACHINE_I386 0x014c 39#define IMAGE_FILE_MACHINE_I386 0x014c
67#define IMAGE_FILE_MACHINE_IA64 0x0200 40#define IMAGE_FILE_MACHINE_IA64 0x0200
@@ -98,17 +71,6 @@ struct mz_reloc {
98#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 71#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
99#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 72#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
100 73
101struct pe_hdr {
102 uint32_t magic; /* PE magic */
103 uint16_t machine; /* machine type */
104 uint16_t sections; /* number of sections */
105 uint32_t timestamp; /* time_t */
106 uint32_t symbol_table; /* symbol table offset */
107 uint32_t symbols; /* number of symbols */
108 uint16_t opt_hdr_size; /* size of optional header */
109 uint16_t flags; /* flags */
110};
111
112#define IMAGE_FILE_OPT_ROM_MAGIC 0x107 74#define IMAGE_FILE_OPT_ROM_MAGIC 0x107
113#define IMAGE_FILE_OPT_PE32_MAGIC 0x10b 75#define IMAGE_FILE_OPT_PE32_MAGIC 0x10b
114#define IMAGE_FILE_OPT_PE32_PLUS_MAGIC 0x20b 76#define IMAGE_FILE_OPT_PE32_PLUS_MAGIC 0x20b
@@ -134,6 +96,95 @@ struct pe_hdr {
134#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 96#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
135#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 97#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
136 98
99/* they actually defined 0x00000000 as well, but I think we'll skip that one. */
100#define IMAGE_SCN_RESERVED_0 0x00000001
101#define IMAGE_SCN_RESERVED_1 0x00000002
102#define IMAGE_SCN_RESERVED_2 0x00000004
103#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* don't pad - obsolete */
104#define IMAGE_SCN_RESERVED_3 0x00000010
105#define IMAGE_SCN_CNT_CODE 0x00000020 /* .text */
106#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* .data */
107#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
108#define IMAGE_SCN_LNK_OTHER 0x00000100 /* reserved */
109#define IMAGE_SCN_LNK_INFO 0x00000200 /* .drectve comments */
110#define IMAGE_SCN_RESERVED_4 0x00000400
111#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* .o only - scn to be rm'd*/
112#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* .o only - COMDAT data */
113#define IMAGE_SCN_RESERVED_5 0x00002000 /* spec omits this */
114#define IMAGE_SCN_RESERVED_6 0x00004000 /* spec omits this */
115#define IMAGE_SCN_GPREL 0x00008000 /* global pointer referenced data */
116/* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
117#define IMAGE_SCN_MEM_PURGEABLE 0x00010000 /* reserved for "future" use */
118#define IMAGE_SCN_16BIT 0x00020000 /* reserved for "future" use */
119#define IMAGE_SCN_LOCKED 0x00040000 /* reserved for "future" use */
120#define IMAGE_SCN_PRELOAD 0x00080000 /* reserved for "future" use */
121/* and here they just stuck a 1-byte integer in the middle of a bitfield */
122#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 /* it does what it says on the box */
123#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
124#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
125#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
126#define IMAGE_SCN_ALIGN_16BYTES 0x00500000
127#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
128#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
129#define IMAGE_SCN_ALIGN_128BYTES 0x00800000
130#define IMAGE_SCN_ALIGN_256BYTES 0x00900000
131#define IMAGE_SCN_ALIGN_512BYTES 0x00a00000
132#define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
133#define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
134#define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
135#define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
136#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
137#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
138#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* cannot be cached */
139#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* not pageable */
140#define IMAGE_SCN_MEM_SHARED 0x10000000 /* can be shared */
141#define IMAGE_SCN_MEM_EXECUTE 0x20000000 /* can be executed as code */
142#define IMAGE_SCN_MEM_READ 0x40000000 /* readable */
143#define IMAGE_SCN_MEM_WRITE 0x80000000 /* writeable */
144
145#define IMAGE_DEBUG_TYPE_CODEVIEW 2
146
147#ifndef __ASSEMBLY__
148
149struct mz_hdr {
150 uint16_t magic; /* MZ_MAGIC */
151 uint16_t lbsize; /* size of last used block */
152 uint16_t blocks; /* pages in file, 0x3 */
153 uint16_t relocs; /* relocations */
154 uint16_t hdrsize; /* header size in "paragraphs" */
155 uint16_t min_extra_pps; /* .bss */
156 uint16_t max_extra_pps; /* runtime limit for the arena size */
157 uint16_t ss; /* relative stack segment */
158 uint16_t sp; /* initial %sp register */
159 uint16_t checksum; /* word checksum */
160 uint16_t ip; /* initial %ip register */
161 uint16_t cs; /* initial %cs relative to load segment */
162 uint16_t reloc_table_offset; /* offset of the first relocation */
163 uint16_t overlay_num; /* overlay number. set to 0. */
164 uint16_t reserved0[4]; /* reserved */
165 uint16_t oem_id; /* oem identifier */
166 uint16_t oem_info; /* oem specific */
167 uint16_t reserved1[10]; /* reserved */
168 uint32_t peaddr; /* address of pe header */
169 char message[64]; /* message to print */
170};
171
172struct mz_reloc {
173 uint16_t offset;
174 uint16_t segment;
175};
176
177struct pe_hdr {
178 uint32_t magic; /* PE magic */
179 uint16_t machine; /* machine type */
180 uint16_t sections; /* number of sections */
181 uint32_t timestamp; /* time_t */
182 uint32_t symbol_table; /* symbol table offset */
183 uint32_t symbols; /* number of symbols */
184 uint16_t opt_hdr_size; /* size of optional header */
185 uint16_t flags; /* flags */
186};
187
137/* the fact that pe32 isn't padded where pe32+ is 64-bit means union won't 188/* the fact that pe32 isn't padded where pe32+ is 64-bit means union won't
138 * work right. vomit. */ 189 * work right. vomit. */
139struct pe32_opt_hdr { 190struct pe32_opt_hdr {
@@ -243,52 +294,6 @@ struct section_header {
243 uint32_t flags; 294 uint32_t flags;
244}; 295};
245 296
246/* they actually defined 0x00000000 as well, but I think we'll skip that one. */
247#define IMAGE_SCN_RESERVED_0 0x00000001
248#define IMAGE_SCN_RESERVED_1 0x00000002
249#define IMAGE_SCN_RESERVED_2 0x00000004
250#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* don't pad - obsolete */
251#define IMAGE_SCN_RESERVED_3 0x00000010
252#define IMAGE_SCN_CNT_CODE 0x00000020 /* .text */
253#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* .data */
254#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
255#define IMAGE_SCN_LNK_OTHER 0x00000100 /* reserved */
256#define IMAGE_SCN_LNK_INFO 0x00000200 /* .drectve comments */
257#define IMAGE_SCN_RESERVED_4 0x00000400
258#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* .o only - scn to be rm'd*/
259#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* .o only - COMDAT data */
260#define IMAGE_SCN_RESERVED_5 0x00002000 /* spec omits this */
261#define IMAGE_SCN_RESERVED_6 0x00004000 /* spec omits this */
262#define IMAGE_SCN_GPREL 0x00008000 /* global pointer referenced data */
263/* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
264#define IMAGE_SCN_MEM_PURGEABLE 0x00010000 /* reserved for "future" use */
265#define IMAGE_SCN_16BIT 0x00020000 /* reserved for "future" use */
266#define IMAGE_SCN_LOCKED 0x00040000 /* reserved for "future" use */
267#define IMAGE_SCN_PRELOAD 0x00080000 /* reserved for "future" use */
268/* and here they just stuck a 1-byte integer in the middle of a bitfield */
269#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 /* it does what it says on the box */
270#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
271#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
272#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
273#define IMAGE_SCN_ALIGN_16BYTES 0x00500000
274#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
275#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
276#define IMAGE_SCN_ALIGN_128BYTES 0x00800000
277#define IMAGE_SCN_ALIGN_256BYTES 0x00900000
278#define IMAGE_SCN_ALIGN_512BYTES 0x00a00000
279#define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
280#define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
281#define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
282#define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
283#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
284#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
285#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* cannot be cached */
286#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* not pageable */
287#define IMAGE_SCN_MEM_SHARED 0x10000000 /* can be shared */
288#define IMAGE_SCN_MEM_EXECUTE 0x20000000 /* can be executed as code */
289#define IMAGE_SCN_MEM_READ 0x40000000 /* readable */
290#define IMAGE_SCN_MEM_WRITE 0x80000000 /* writeable */
291
292enum x64_coff_reloc_type { 297enum x64_coff_reloc_type {
293 IMAGE_REL_AMD64_ABSOLUTE = 0, 298 IMAGE_REL_AMD64_ABSOLUTE = 0,
294 IMAGE_REL_AMD64_ADDR64, 299 IMAGE_REL_AMD64_ADDR64,
@@ -445,4 +450,6 @@ struct win_certificate {
445 uint16_t cert_type; 450 uint16_t cert_type;
446}; 451};
447 452
453#endif /* !__ASSEMBLY__ */
454
448#endif /* __LINUX_PE_H */ 455#endif /* __LINUX_PE_H */
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 3a481a49546e..c13dceb87b60 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -99,6 +99,7 @@ int __must_check percpu_ref_init(struct percpu_ref *ref,
99void percpu_ref_exit(struct percpu_ref *ref); 99void percpu_ref_exit(struct percpu_ref *ref);
100void percpu_ref_switch_to_atomic(struct percpu_ref *ref, 100void percpu_ref_switch_to_atomic(struct percpu_ref *ref,
101 percpu_ref_func_t *confirm_switch); 101 percpu_ref_func_t *confirm_switch);
102void percpu_ref_switch_to_atomic_sync(struct percpu_ref *ref);
102void percpu_ref_switch_to_percpu(struct percpu_ref *ref); 103void percpu_ref_switch_to_percpu(struct percpu_ref *ref);
103void percpu_ref_kill_and_confirm(struct percpu_ref *ref, 104void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
104 percpu_ref_func_t *confirm_kill); 105 percpu_ref_func_t *confirm_kill);
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 56939d3f6e53..491b3f5a5f8a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -110,6 +110,7 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size,
110#endif 110#endif
111 111
112extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); 112extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align);
113extern bool __is_kernel_percpu_address(unsigned long addr, unsigned long *can_addr);
113extern bool is_kernel_percpu_address(unsigned long addr); 114extern bool is_kernel_percpu_address(unsigned long addr);
114 115
115#if !defined(CONFIG_SMP) || !defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) 116#if !defined(CONFIG_SMP) || !defined(CONFIG_HAVE_SETUP_PER_CPU_AREA)
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
index 8462da266089..1360dd6d5e61 100644
--- a/include/linux/perf/arm_pmu.h
+++ b/include/linux/perf/arm_pmu.h
@@ -75,6 +75,8 @@ struct pmu_hw_events {
75 * already have to allocate this struct per cpu. 75 * already have to allocate this struct per cpu.
76 */ 76 */
77 struct arm_pmu *percpu_pmu; 77 struct arm_pmu *percpu_pmu;
78
79 int irq;
78}; 80};
79 81
80enum armpmu_attr_groups { 82enum armpmu_attr_groups {
@@ -88,7 +90,6 @@ struct arm_pmu {
88 struct pmu pmu; 90 struct pmu pmu;
89 cpumask_t active_irqs; 91 cpumask_t active_irqs;
90 cpumask_t supported_cpus; 92 cpumask_t supported_cpus;
91 int *irq_affinity;
92 char *name; 93 char *name;
93 irqreturn_t (*handle_irq)(int irq_num, void *dev); 94 irqreturn_t (*handle_irq)(int irq_num, void *dev);
94 void (*enable)(struct perf_event *event); 95 void (*enable)(struct perf_event *event);
@@ -104,12 +105,8 @@ struct arm_pmu {
104 void (*start)(struct arm_pmu *); 105 void (*start)(struct arm_pmu *);
105 void (*stop)(struct arm_pmu *); 106 void (*stop)(struct arm_pmu *);
106 void (*reset)(void *); 107 void (*reset)(void *);
107 int (*request_irq)(struct arm_pmu *, irq_handler_t handler);
108 void (*free_irq)(struct arm_pmu *);
109 int (*map_event)(struct perf_event *event); 108 int (*map_event)(struct perf_event *event);
110 int num_events; 109 int num_events;
111 atomic_t active_events;
112 struct mutex reserve_mutex;
113 u64 max_period; 110 u64 max_period;
114 bool secure_access; /* 32-bit ARM only */ 111 bool secure_access; /* 32-bit ARM only */
115#define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40 112#define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40
@@ -120,6 +117,9 @@ struct arm_pmu {
120 struct notifier_block cpu_pm_nb; 117 struct notifier_block cpu_pm_nb;
121 /* the attr_groups array must be NULL-terminated */ 118 /* the attr_groups array must be NULL-terminated */
122 const struct attribute_group *attr_groups[ARMPMU_NR_ATTR_GROUPS + 1]; 119 const struct attribute_group *attr_groups[ARMPMU_NR_ATTR_GROUPS + 1];
120
121 /* Only to be used by ACPI probing code */
122 unsigned long acpi_cpuid;
123}; 123};
124 124
125#define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu)) 125#define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu))
@@ -135,10 +135,12 @@ int armpmu_map_event(struct perf_event *event,
135 [PERF_COUNT_HW_CACHE_RESULT_MAX], 135 [PERF_COUNT_HW_CACHE_RESULT_MAX],
136 u32 raw_event_mask); 136 u32 raw_event_mask);
137 137
138typedef int (*armpmu_init_fn)(struct arm_pmu *);
139
138struct pmu_probe_info { 140struct pmu_probe_info {
139 unsigned int cpuid; 141 unsigned int cpuid;
140 unsigned int mask; 142 unsigned int mask;
141 int (*init)(struct arm_pmu *); 143 armpmu_init_fn init;
142}; 144};
143 145
144#define PMU_PROBE(_cpuid, _mask, _fn) \ 146#define PMU_PROBE(_cpuid, _mask, _fn) \
@@ -160,6 +162,21 @@ int arm_pmu_device_probe(struct platform_device *pdev,
160 const struct of_device_id *of_table, 162 const struct of_device_id *of_table,
161 const struct pmu_probe_info *probe_table); 163 const struct pmu_probe_info *probe_table);
162 164
165#ifdef CONFIG_ACPI
166int arm_pmu_acpi_probe(armpmu_init_fn init_fn);
167#else
168static inline int arm_pmu_acpi_probe(armpmu_init_fn init_fn) { return 0; }
169#endif
170
171/* Internal functions only for core arm_pmu code */
172struct arm_pmu *armpmu_alloc(void);
173void armpmu_free(struct arm_pmu *pmu);
174int armpmu_register(struct arm_pmu *pmu);
175int armpmu_request_irqs(struct arm_pmu *armpmu);
176void armpmu_free_irqs(struct arm_pmu *armpmu);
177int armpmu_request_irq(struct arm_pmu *armpmu, int cpu);
178void armpmu_free_irq(struct arm_pmu *armpmu, int cpu);
179
163#define ARMV8_PMU_PDEV_NAME "armv8-pmu" 180#define ARMV8_PMU_PDEV_NAME "armv8-pmu"
164 181
165#endif /* CONFIG_ARM_PMU */ 182#endif /* CONFIG_ARM_PMU */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 000fdb211c7d..24a635887f28 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -165,6 +165,13 @@ struct hw_perf_event {
165 struct list_head bp_list; 165 struct list_head bp_list;
166 }; 166 };
167#endif 167#endif
168 struct { /* amd_iommu */
169 u8 iommu_bank;
170 u8 iommu_cntr;
171 u16 padding;
172 u64 conf;
173 u64 conf1;
174 };
168 }; 175 };
169 /* 176 /*
170 * If the event is a per task event, this will point to the task in 177 * If the event is a per task event, this will point to the task in
@@ -801,6 +808,7 @@ struct perf_output_handle {
801 struct ring_buffer *rb; 808 struct ring_buffer *rb;
802 unsigned long wakeup; 809 unsigned long wakeup;
803 unsigned long size; 810 unsigned long size;
811 u64 aux_flags;
804 union { 812 union {
805 void *addr; 813 void *addr;
806 unsigned long head; 814 unsigned long head;
@@ -849,10 +857,11 @@ perf_cgroup_from_task(struct task_struct *task, struct perf_event_context *ctx)
849extern void *perf_aux_output_begin(struct perf_output_handle *handle, 857extern void *perf_aux_output_begin(struct perf_output_handle *handle,
850 struct perf_event *event); 858 struct perf_event *event);
851extern void perf_aux_output_end(struct perf_output_handle *handle, 859extern void perf_aux_output_end(struct perf_output_handle *handle,
852 unsigned long size, bool truncated); 860 unsigned long size);
853extern int perf_aux_output_skip(struct perf_output_handle *handle, 861extern int perf_aux_output_skip(struct perf_output_handle *handle,
854 unsigned long size); 862 unsigned long size);
855extern void *perf_get_aux(struct perf_output_handle *handle); 863extern void *perf_get_aux(struct perf_output_handle *handle);
864extern void perf_aux_output_flag(struct perf_output_handle *handle, u64 flags);
856 865
857extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); 866extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
858extern void perf_pmu_unregister(struct pmu *pmu); 867extern void perf_pmu_unregister(struct pmu *pmu);
@@ -1112,6 +1121,7 @@ extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks
1112 1121
1113extern void perf_event_exec(void); 1122extern void perf_event_exec(void);
1114extern void perf_event_comm(struct task_struct *tsk, bool exec); 1123extern void perf_event_comm(struct task_struct *tsk, bool exec);
1124extern void perf_event_namespaces(struct task_struct *tsk);
1115extern void perf_event_fork(struct task_struct *tsk); 1125extern void perf_event_fork(struct task_struct *tsk);
1116 1126
1117/* Callchains */ 1127/* Callchains */
@@ -1267,8 +1277,8 @@ static inline void *
1267perf_aux_output_begin(struct perf_output_handle *handle, 1277perf_aux_output_begin(struct perf_output_handle *handle,
1268 struct perf_event *event) { return NULL; } 1278 struct perf_event *event) { return NULL; }
1269static inline void 1279static inline void
1270perf_aux_output_end(struct perf_output_handle *handle, unsigned long size, 1280perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
1271 bool truncated) { } 1281 { }
1272static inline int 1282static inline int
1273perf_aux_output_skip(struct perf_output_handle *handle, 1283perf_aux_output_skip(struct perf_output_handle *handle,
1274 unsigned long size) { return -EINVAL; } 1284 unsigned long size) { return -EINVAL; }
@@ -1315,6 +1325,7 @@ static inline int perf_unregister_guest_info_callbacks
1315static inline void perf_event_mmap(struct vm_area_struct *vma) { } 1325static inline void perf_event_mmap(struct vm_area_struct *vma) { }
1316static inline void perf_event_exec(void) { } 1326static inline void perf_event_exec(void) { }
1317static inline void perf_event_comm(struct task_struct *tsk, bool exec) { } 1327static inline void perf_event_comm(struct task_struct *tsk, bool exec) { }
1328static inline void perf_event_namespaces(struct task_struct *tsk) { }
1318static inline void perf_event_fork(struct task_struct *tsk) { } 1329static inline void perf_event_fork(struct task_struct *tsk) { }
1319static inline void perf_event_init(void) { } 1330static inline void perf_event_init(void) { }
1320static inline int perf_swevent_get_recursion_context(void) { return -1; } 1331static inline int perf_swevent_get_recursion_context(void) { return -1; }
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 43a774873aa9..e76e4adbc7c7 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -217,6 +217,13 @@ struct mii_bus {
217 * matching its address 217 * matching its address
218 */ 218 */
219 int irq[PHY_MAX_ADDR]; 219 int irq[PHY_MAX_ADDR];
220
221 /* GPIO reset pulse width in microseconds */
222 int reset_delay_us;
223 /* Number of reset GPIOs */
224 int num_reset_gpios;
225 /* Array of RESET GPIO descriptors */
226 struct gpio_desc **reset_gpiod;
220}; 227};
221#define to_mii_bus(d) container_of(d, struct mii_bus, dev) 228#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
222 229
@@ -587,23 +594,29 @@ struct phy_driver {
587 */ 594 */
588 void (*link_change_notify)(struct phy_device *dev); 595 void (*link_change_notify)(struct phy_device *dev);
589 596
590 /* A function provided by a phy specific driver to override the 597 /*
591 * the PHY driver framework support for reading a MMD register 598 * Phy specific driver override for reading a MMD register.
592 * from the PHY. If not supported, return -1. This function is 599 * This function is optional for PHY specific drivers. When
593 * optional for PHY specific drivers, if not provided then the 600 * not provided, the default MMD read function will be used
594 * default MMD read function is used by the PHY framework. 601 * by phy_read_mmd(), which will use either a direct read for
602 * Clause 45 PHYs or an indirect read for Clause 22 PHYs.
603 * devnum is the MMD device number within the PHY device,
604 * regnum is the register within the selected MMD device.
595 */ 605 */
596 int (*read_mmd_indirect)(struct phy_device *dev, int ptrad, 606 int (*read_mmd)(struct phy_device *dev, int devnum, u16 regnum);
597 int devnum, int regnum); 607
598 608 /*
599 /* A function provided by a phy specific driver to override the 609 * Phy specific driver override for writing a MMD register.
600 * the PHY driver framework support for writing a MMD register 610 * This function is optional for PHY specific drivers. When
601 * from the PHY. This function is optional for PHY specific drivers, 611 * not provided, the default MMD write function will be used
602 * if not provided then the default MMD read function is used by 612 * by phy_write_mmd(), which will use either a direct write for
603 * the PHY framework. 613 * Clause 45 PHYs, or an indirect write for Clause 22 PHYs.
614 * devnum is the MMD device number within the PHY device,
615 * regnum is the register within the selected MMD device.
616 * val is the value to be written.
604 */ 617 */
605 void (*write_mmd_indirect)(struct phy_device *dev, int ptrad, 618 int (*write_mmd)(struct phy_device *dev, int devnum, u16 regnum,
606 int devnum, int regnum, u32 val); 619 u16 val);
607 620
608 /* Get the size and type of the eeprom contained within a plug-in 621 /* Get the size and type of the eeprom contained within a plug-in
609 * module */ 622 * module */
@@ -651,25 +664,7 @@ struct phy_fixup {
651 * 664 *
652 * Same rules as for phy_read(); 665 * Same rules as for phy_read();
653 */ 666 */
654static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum) 667int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
655{
656 if (!phydev->is_c45)
657 return -EOPNOTSUPP;
658
659 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr,
660 MII_ADDR_C45 | (devad << 16) | (regnum & 0xffff));
661}
662
663/**
664 * phy_read_mmd_indirect - reads data from the MMD registers
665 * @phydev: The PHY device bus
666 * @prtad: MMD Address
667 * @addr: PHY address on the MII bus
668 *
669 * Description: it reads data from the MMD registers (clause 22 to access to
670 * clause 45) of the specified phy address.
671 */
672int phy_read_mmd_indirect(struct phy_device *phydev, int prtad, int devad);
673 668
674/** 669/**
675 * phy_read - Convenience function for reading a given PHY register 670 * phy_read - Convenience function for reading a given PHY register
@@ -752,35 +747,29 @@ static inline bool phy_is_pseudo_fixed_link(struct phy_device *phydev)
752 * 747 *
753 * Same rules as for phy_write(); 748 * Same rules as for phy_write();
754 */ 749 */
755static inline int phy_write_mmd(struct phy_device *phydev, int devad, 750int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
756 u32 regnum, u16 val)
757{
758 if (!phydev->is_c45)
759 return -EOPNOTSUPP;
760
761 regnum = MII_ADDR_C45 | ((devad & 0x1f) << 16) | (regnum & 0xffff);
762
763 return mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, val);
764}
765
766/**
767 * phy_write_mmd_indirect - writes data to the MMD registers
768 * @phydev: The PHY device
769 * @prtad: MMD Address
770 * @devad: MMD DEVAD
771 * @data: data to write in the MMD register
772 *
773 * Description: Write data from the MMD registers of the specified
774 * phy address.
775 */
776void phy_write_mmd_indirect(struct phy_device *phydev, int prtad,
777 int devad, u32 data);
778 751
779struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 752struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
780 bool is_c45, 753 bool is_c45,
781 struct phy_c45_device_ids *c45_ids); 754 struct phy_c45_device_ids *c45_ids);
755#if IS_ENABLED(CONFIG_PHYLIB)
782struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); 756struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
783int phy_device_register(struct phy_device *phy); 757int phy_device_register(struct phy_device *phy);
758void phy_device_free(struct phy_device *phydev);
759#else
760static inline
761struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
762{
763 return NULL;
764}
765
766static inline int phy_device_register(struct phy_device *phy)
767{
768 return 0;
769}
770
771static inline void phy_device_free(struct phy_device *phydev) { }
772#endif /* CONFIG_PHYLIB */
784void phy_device_remove(struct phy_device *phydev); 773void phy_device_remove(struct phy_device *phydev);
785int phy_init_hw(struct phy_device *phydev); 774int phy_init_hw(struct phy_device *phydev);
786int phy_suspend(struct phy_device *phydev); 775int phy_suspend(struct phy_device *phydev);
@@ -852,6 +841,7 @@ void phy_change_work(struct work_struct *work);
852void phy_mac_interrupt(struct phy_device *phydev, int new_link); 841void phy_mac_interrupt(struct phy_device *phydev, int new_link);
853void phy_start_machine(struct phy_device *phydev); 842void phy_start_machine(struct phy_device *phydev);
854void phy_stop_machine(struct phy_device *phydev); 843void phy_stop_machine(struct phy_device *phydev);
844void phy_trigger_machine(struct phy_device *phydev, bool sync);
855int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); 845int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
856int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); 846int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
857int phy_ethtool_ksettings_get(struct phy_device *phydev, 847int phy_ethtool_ksettings_get(struct phy_device *phydev,
@@ -861,7 +851,6 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
861int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); 851int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
862int phy_start_interrupts(struct phy_device *phydev); 852int phy_start_interrupts(struct phy_device *phydev);
863void phy_print_status(struct phy_device *phydev); 853void phy_print_status(struct phy_device *phydev);
864void phy_device_free(struct phy_device *phydev);
865int phy_set_max_speed(struct phy_device *phydev, u32 max_speed); 854int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
866 855
867int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask, 856int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
@@ -888,8 +877,10 @@ int phy_ethtool_set_link_ksettings(struct net_device *ndev,
888 const struct ethtool_link_ksettings *cmd); 877 const struct ethtool_link_ksettings *cmd);
889int phy_ethtool_nway_reset(struct net_device *ndev); 878int phy_ethtool_nway_reset(struct net_device *ndev);
890 879
880#if IS_ENABLED(CONFIG_PHYLIB)
891int __init mdio_bus_init(void); 881int __init mdio_bus_init(void);
892void mdio_bus_exit(void); 882void mdio_bus_exit(void);
883#endif
893 884
894extern struct bus_type mdio_bus_type; 885extern struct bus_type mdio_bus_type;
895 886
@@ -900,7 +891,7 @@ struct mdio_board_info {
900 const void *platform_data; 891 const void *platform_data;
901}; 892};
902 893
903#if IS_ENABLED(CONFIG_PHYLIB) 894#if IS_ENABLED(CONFIG_MDIO_DEVICE)
904int mdiobus_register_board_info(const struct mdio_board_info *info, 895int mdiobus_register_board_info(const struct mdio_board_info *info,
905 unsigned int n); 896 unsigned int n);
906#else 897#else
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 7620eb127cff..279e3c5326e3 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -42,6 +42,8 @@
42 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high 42 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high
43 * impedance to VDD). If the argument is != 0 pull-up is enabled, 43 * impedance to VDD). If the argument is != 0 pull-up is enabled,
44 * if it is 0, pull-up is total, i.e. the pin is connected to VDD. 44 * if it is 0, pull-up is total, i.e. the pin is connected to VDD.
45 * @PIN_CONFIG_BIDIRECTIONAL: the pin will be configured to allow simultaneous
46 * input and output operations.
45 * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open 47 * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open
46 * collector) which means it is usually wired with other output ports 48 * collector) which means it is usually wired with other output ports
47 * which are then pulled up with an external resistor. Setting this 49 * which are then pulled up with an external resistor. Setting this
@@ -96,6 +98,7 @@ enum pin_config_param {
96 PIN_CONFIG_BIAS_PULL_DOWN, 98 PIN_CONFIG_BIAS_PULL_DOWN,
97 PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, 99 PIN_CONFIG_BIAS_PULL_PIN_DEFAULT,
98 PIN_CONFIG_BIAS_PULL_UP, 100 PIN_CONFIG_BIAS_PULL_UP,
101 PIN_CONFIG_BIDIRECTIONAL,
99 PIN_CONFIG_DRIVE_OPEN_DRAIN, 102 PIN_CONFIG_DRIVE_OPEN_DRAIN,
100 PIN_CONFIG_DRIVE_OPEN_SOURCE, 103 PIN_CONFIG_DRIVE_OPEN_SOURCE,
101 PIN_CONFIG_DRIVE_PUSH_PULL, 104 PIN_CONFIG_DRIVE_PUSH_PULL,
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 8ce2d87a238b..5e45385c5bdc 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -145,8 +145,9 @@ struct pinctrl_desc {
145extern int pinctrl_register_and_init(struct pinctrl_desc *pctldesc, 145extern int pinctrl_register_and_init(struct pinctrl_desc *pctldesc,
146 struct device *dev, void *driver_data, 146 struct device *dev, void *driver_data,
147 struct pinctrl_dev **pctldev); 147 struct pinctrl_dev **pctldev);
148extern int pinctrl_enable(struct pinctrl_dev *pctldev);
148 149
149/* Please use pinctrl_register_and_init() instead */ 150/* Please use pinctrl_register_and_init() and pinctrl_enable() instead */
150extern struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, 151extern struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
151 struct device *dev, void *driver_data); 152 struct device *dev, void *driver_data);
152 153
diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h
index 0496d171700a..e8b12dbf6170 100644
--- a/include/linux/platform_data/iommu-omap.h
+++ b/include/linux/platform_data/iommu-omap.h
@@ -12,28 +12,8 @@
12 12
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14 14
15#define MMU_REG_SIZE 256
16
17/**
18 * struct iommu_arch_data - omap iommu private data
19 * @name: name of the iommu device
20 * @iommu_dev: handle of the iommu device
21 *
22 * This is an omap iommu private data object, which binds an iommu user
23 * to its iommu device. This object should be placed at the iommu user's
24 * dev_archdata so generic IOMMU API can be used without having to
25 * utilize omap-specific plumbing anymore.
26 */
27struct omap_iommu_arch_data {
28 const char *name;
29 struct omap_iommu *iommu_dev;
30};
31
32struct iommu_platform_data { 15struct iommu_platform_data {
33 const char *name;
34 const char *reset_name; 16 const char *reset_name;
35 int nr_tlb_entries;
36
37 int (*assert_reset)(struct platform_device *pdev, const char *name); 17 int (*assert_reset)(struct platform_device *pdev, const char *name);
38 int (*deassert_reset)(struct platform_device *pdev, const char *name); 18 int (*deassert_reset)(struct platform_device *pdev, const char *name);
39}; 19};
diff --git a/include/linux/platform_data/isl9305.h b/include/linux/platform_data/isl9305.h
index 1419133fa69e..4ac1a070af0a 100644
--- a/include/linux/platform_data/isl9305.h
+++ b/include/linux/platform_data/isl9305.h
@@ -24,7 +24,7 @@
24struct regulator_init_data; 24struct regulator_init_data;
25 25
26struct isl9305_pdata { 26struct isl9305_pdata {
27 struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR]; 27 struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR + 1];
28}; 28};
29 29
30#endif 30#endif
diff --git a/include/linux/platform_data/itco_wdt.h b/include/linux/platform_data/itco_wdt.h
index f16542c77ff7..0e95527edf25 100644
--- a/include/linux/platform_data/itco_wdt.h
+++ b/include/linux/platform_data/itco_wdt.h
@@ -14,6 +14,10 @@
14struct itco_wdt_platform_data { 14struct itco_wdt_platform_data {
15 char name[32]; 15 char name[32];
16 unsigned int version; 16 unsigned int version;
17 /* private data to be passed to update_no_reboot_bit API */
18 void *no_reboot_priv;
19 /* pointer for platform specific no reboot update function */
20 int (*update_no_reboot_bit)(void *priv, bool set);
17}; 21};
18 22
19#endif /* _ITCO_WDT_H_ */ 23#endif /* _ITCO_WDT_H_ */
diff --git a/include/linux/platform_data/pn544.h b/include/linux/platform_data/pn544.h
deleted file mode 100644
index 5ce1ab983f44..000000000000
--- a/include/linux/platform_data/pn544.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Driver include for the PN544 NFC chip.
3 *
4 * Copyright (C) Nokia Corporation
5 *
6 * Author: Jari Vanhala <ext-jari.vanhala@nokia.com>
7 * Contact: Matti Aaltoenn <matti.j.aaltonen@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef _PN544_H_
23#define _PN544_H_
24
25#include <linux/i2c.h>
26
27enum {
28 NFC_GPIO_ENABLE,
29 NFC_GPIO_FW_RESET,
30 NFC_GPIO_IRQ
31};
32
33/* board config */
34struct pn544_nfc_platform_data {
35 int (*request_resources) (struct i2c_client *client);
36 void (*free_resources) (void);
37 void (*enable) (int fw);
38 int (*test) (void);
39 void (*disable) (void);
40 int (*get_gpio)(int type);
41};
42
43#endif /* _PN544_H_ */
diff --git a/include/linux/platform_data/st21nfca.h b/include/linux/platform_data/st21nfca.h
deleted file mode 100644
index cc2bdafb0c69..000000000000
--- a/include/linux/platform_data/st21nfca.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Driver include for the ST21NFCA NFC chip.
3 *
4 * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions 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,
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 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef _ST21NFCA_HCI_H_
20#define _ST21NFCA_HCI_H_
21
22#include <linux/i2c.h>
23
24#define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci"
25
26struct st21nfca_nfc_platform_data {
27 unsigned int gpio_ena;
28 unsigned int irq_polarity;
29 bool is_ese_present;
30 bool is_uicc_present;
31};
32
33#endif /* _ST21NFCA_HCI_H_ */
diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
index a5c0a71ec914..cf9348b376ac 100644
--- a/include/linux/platform_data/video-imxfb.h
+++ b/include/linux/platform_data/video-imxfb.h
@@ -50,6 +50,7 @@
50struct imx_fb_videomode { 50struct imx_fb_videomode {
51 struct fb_videomode mode; 51 struct fb_videomode mode;
52 u32 pcr; 52 u32 pcr;
53 bool aus_mode;
53 unsigned char bpp; 54 unsigned char bpp;
54}; 55};
55 56
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 5339ed5bd6f9..b7803a251044 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -20,6 +20,7 @@
20/* Defines used for the flags field in the struct generic_pm_domain */ 20/* Defines used for the flags field in the struct generic_pm_domain */
21#define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */ 21#define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */
22#define GENPD_FLAG_IRQ_SAFE (1U << 1) /* PM domain operates in atomic */ 22#define GENPD_FLAG_IRQ_SAFE (1U << 1) /* PM domain operates in atomic */
23#define GENPD_FLAG_ALWAYS_ON (1U << 2) /* PM domain is always powered on */
23 24
24enum gpd_status { 25enum gpd_status {
25 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 26 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -117,6 +118,7 @@ struct generic_pm_domain_data {
117 struct pm_domain_data base; 118 struct pm_domain_data base;
118 struct gpd_timing_data td; 119 struct gpd_timing_data td;
119 struct notifier_block nb; 120 struct notifier_block nb;
121 void *data;
120}; 122};
121 123
122#ifdef CONFIG_PM_GENERIC_DOMAINS 124#ifdef CONFIG_PM_GENERIC_DOMAINS
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index a3447932df1f..4c2cba7ec1d4 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -106,8 +106,8 @@ extern void __pm_stay_awake(struct wakeup_source *ws);
106extern void pm_stay_awake(struct device *dev); 106extern void pm_stay_awake(struct device *dev);
107extern void __pm_relax(struct wakeup_source *ws); 107extern void __pm_relax(struct wakeup_source *ws);
108extern void pm_relax(struct device *dev); 108extern void pm_relax(struct device *dev);
109extern void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec); 109extern void pm_wakeup_ws_event(struct wakeup_source *ws, unsigned int msec, bool hard);
110extern void pm_wakeup_event(struct device *dev, unsigned int msec); 110extern void pm_wakeup_dev_event(struct device *dev, unsigned int msec, bool hard);
111 111
112#else /* !CONFIG_PM_SLEEP */ 112#else /* !CONFIG_PM_SLEEP */
113 113
@@ -182,9 +182,11 @@ static inline void __pm_relax(struct wakeup_source *ws) {}
182 182
183static inline void pm_relax(struct device *dev) {} 183static inline void pm_relax(struct device *dev) {}
184 184
185static inline void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec) {} 185static inline void pm_wakeup_ws_event(struct wakeup_source *ws,
186 unsigned int msec, bool hard) {}
186 187
187static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {} 188static inline void pm_wakeup_dev_event(struct device *dev, unsigned int msec,
189 bool hard) {}
188 190
189#endif /* !CONFIG_PM_SLEEP */ 191#endif /* !CONFIG_PM_SLEEP */
190 192
@@ -201,4 +203,19 @@ static inline void wakeup_source_trash(struct wakeup_source *ws)
201 wakeup_source_drop(ws); 203 wakeup_source_drop(ws);
202} 204}
203 205
206static inline void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec)
207{
208 return pm_wakeup_ws_event(ws, msec, false);
209}
210
211static inline void pm_wakeup_event(struct device *dev, unsigned int msec)
212{
213 return pm_wakeup_dev_event(dev, msec, false);
214}
215
216static inline void pm_wakeup_hard_event(struct device *dev)
217{
218 return pm_wakeup_dev_event(dev, 0, true);
219}
220
204#endif /* _LINUX_PM_WAKEUP_H */ 221#endif /* _LINUX_PM_WAKEUP_H */
diff --git a/include/linux/pmem.h b/include/linux/pmem.h
index e856c2cb0fe8..71ecf3d46aac 100644
--- a/include/linux/pmem.h
+++ b/include/linux/pmem.h
@@ -31,12 +31,6 @@ static inline void arch_memcpy_to_pmem(void *dst, const void *src, size_t n)
31 BUG(); 31 BUG();
32} 32}
33 33
34static inline int arch_memcpy_from_pmem(void *dst, const void *src, size_t n)
35{
36 BUG();
37 return -EFAULT;
38}
39
40static inline size_t arch_copy_from_iter_pmem(void *addr, size_t bytes, 34static inline size_t arch_copy_from_iter_pmem(void *addr, size_t bytes,
41 struct iov_iter *i) 35 struct iov_iter *i)
42{ 36{
@@ -65,23 +59,6 @@ static inline bool arch_has_pmem_api(void)
65 return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API); 59 return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API);
66} 60}
67 61
68/*
69 * memcpy_from_pmem - read from persistent memory with error handling
70 * @dst: destination buffer
71 * @src: source buffer
72 * @size: transfer length
73 *
74 * Returns 0 on success negative error code on failure.
75 */
76static inline int memcpy_from_pmem(void *dst, void const *src, size_t size)
77{
78 if (arch_has_pmem_api())
79 return arch_memcpy_from_pmem(dst, src, size);
80 else
81 memcpy(dst, src, size);
82 return 0;
83}
84
85/** 62/**
86 * memcpy_to_pmem - copy data to persistent memory 63 * memcpy_to_pmem - copy data to persistent memory
87 * @dst: destination buffer for the copy 64 * @dst: destination buffer for the copy
diff --git a/include/linux/poll.h b/include/linux/poll.h
index a46d6755035e..75ffc5729e4c 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -98,64 +98,8 @@ extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
98 ktime_t *expires, unsigned long slack); 98 ktime_t *expires, unsigned long slack);
99extern u64 select_estimate_accuracy(struct timespec64 *tv); 99extern u64 select_estimate_accuracy(struct timespec64 *tv);
100 100
101
102static inline int poll_schedule(struct poll_wqueues *pwq, int state)
103{
104 return poll_schedule_timeout(pwq, state, NULL, 0);
105}
106
107/*
108 * Scalable version of the fd_set.
109 */
110
111typedef struct {
112 unsigned long *in, *out, *ex;
113 unsigned long *res_in, *res_out, *res_ex;
114} fd_set_bits;
115
116/*
117 * How many longwords for "nr" bits?
118 */
119#define FDS_BITPERLONG (8*sizeof(long))
120#define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
121#define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long))
122
123/*
124 * We do a VERIFY_WRITE here even though we are only reading this time:
125 * we'll write to it eventually..
126 *
127 * Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
128 */
129static inline
130int get_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
131{
132 nr = FDS_BYTES(nr);
133 if (ufdset)
134 return copy_from_user(fdset, ufdset, nr) ? -EFAULT : 0;
135
136 memset(fdset, 0, nr);
137 return 0;
138}
139
140static inline unsigned long __must_check
141set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
142{
143 if (ufdset)
144 return __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
145 return 0;
146}
147
148static inline
149void zero_fd_set(unsigned long nr, unsigned long *fdset)
150{
151 memset(fdset, 0, FDS_BYTES(nr));
152}
153
154#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1) 101#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1)
155 102
156extern int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time);
157extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
158 struct timespec64 *end_time);
159extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, 103extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
160 fd_set __user *exp, struct timespec64 *end_time); 104 fd_set __user *exp, struct timespec64 *end_time);
161 105
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
index 34c4498b800f..83b22ae9ae12 100644
--- a/include/linux/posix-clock.h
+++ b/include/linux/posix-clock.h
@@ -59,23 +59,23 @@ struct posix_clock_operations {
59 59
60 int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx); 60 int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);
61 61
62 int (*clock_gettime)(struct posix_clock *pc, struct timespec *ts); 62 int (*clock_gettime)(struct posix_clock *pc, struct timespec64 *ts);
63 63
64 int (*clock_getres) (struct posix_clock *pc, struct timespec *ts); 64 int (*clock_getres) (struct posix_clock *pc, struct timespec64 *ts);
65 65
66 int (*clock_settime)(struct posix_clock *pc, 66 int (*clock_settime)(struct posix_clock *pc,
67 const struct timespec *ts); 67 const struct timespec64 *ts);
68 68
69 int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit); 69 int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
70 70
71 int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit); 71 int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
72 72
73 void (*timer_gettime)(struct posix_clock *pc, 73 void (*timer_gettime)(struct posix_clock *pc,
74 struct k_itimer *kit, struct itimerspec *tsp); 74 struct k_itimer *kit, struct itimerspec64 *tsp);
75 75
76 int (*timer_settime)(struct posix_clock *pc, 76 int (*timer_settime)(struct posix_clock *pc,
77 struct k_itimer *kit, int flags, 77 struct k_itimer *kit, int flags,
78 struct itimerspec *tsp, struct itimerspec *old); 78 struct itimerspec64 *tsp, struct itimerspec64 *old);
79 /* 79 /*
80 * Optional character device methods: 80 * Optional character device methods:
81 */ 81 */
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 64aa189efe21..8c1e43ab14a9 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -87,22 +87,22 @@ struct k_itimer {
87}; 87};
88 88
89struct k_clock { 89struct k_clock {
90 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); 90 int (*clock_getres) (const clockid_t which_clock, struct timespec64 *tp);
91 int (*clock_set) (const clockid_t which_clock, 91 int (*clock_set) (const clockid_t which_clock,
92 const struct timespec *tp); 92 const struct timespec64 *tp);
93 int (*clock_get) (const clockid_t which_clock, struct timespec * tp); 93 int (*clock_get) (const clockid_t which_clock, struct timespec64 *tp);
94 int (*clock_adj) (const clockid_t which_clock, struct timex *tx); 94 int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
95 int (*timer_create) (struct k_itimer *timer); 95 int (*timer_create) (struct k_itimer *timer);
96 int (*nsleep) (const clockid_t which_clock, int flags, 96 int (*nsleep) (const clockid_t which_clock, int flags,
97 struct timespec *, struct timespec __user *); 97 struct timespec64 *, struct timespec __user *);
98 long (*nsleep_restart) (struct restart_block *restart_block); 98 long (*nsleep_restart) (struct restart_block *restart_block);
99 int (*timer_set) (struct k_itimer * timr, int flags, 99 int (*timer_set) (struct k_itimer *timr, int flags,
100 struct itimerspec * new_setting, 100 struct itimerspec64 *new_setting,
101 struct itimerspec * old_setting); 101 struct itimerspec64 *old_setting);
102 int (*timer_del) (struct k_itimer * timr); 102 int (*timer_del) (struct k_itimer *timr);
103#define TIMER_RETRY 1 103#define TIMER_RETRY 1
104 void (*timer_get) (struct k_itimer * timr, 104 void (*timer_get) (struct k_itimer *timr,
105 struct itimerspec * cur_setting); 105 struct itimerspec64 *cur_setting);
106}; 106};
107 107
108extern struct k_clock clock_posix_cpu; 108extern struct k_clock clock_posix_cpu;
diff --git a/include/linux/power/bq24190_charger.h b/include/linux/power/bq24190_charger.h
deleted file mode 100644
index 9f0283721cbc..000000000000
--- a/include/linux/power/bq24190_charger.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Platform data for the TI bq24190 battery charger driver.
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 */
8
9#ifndef _BQ24190_CHARGER_H_
10#define _BQ24190_CHARGER_H_
11
12struct bq24190_platform_data {
13 unsigned int gpio_int; /* GPIO pin that's connected to INT# */
14};
15
16#endif
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index 522757ac9cd4..a7ed29baf44a 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -24,8 +24,15 @@
24#define __MAX17042_BATTERY_H_ 24#define __MAX17042_BATTERY_H_
25 25
26#define MAX17042_STATUS_BattAbsent (1 << 3) 26#define MAX17042_STATUS_BattAbsent (1 << 3)
27#define MAX17042_BATTERY_FULL (100) 27#define MAX17042_BATTERY_FULL (95) /* Recommend. FullSOCThr value */
28#define MAX17042_DEFAULT_SNS_RESISTOR (10000) 28#define MAX17042_DEFAULT_SNS_RESISTOR (10000)
29#define MAX17042_DEFAULT_VMIN (3000)
30#define MAX17042_DEFAULT_VMAX (4500) /* LiHV cell max */
31#define MAX17042_DEFAULT_TEMP_MIN (0) /* For sys without temp sensor */
32#define MAX17042_DEFAULT_TEMP_MAX (700) /* 70 degrees Celcius */
33
34/* Consider RepCap which is less then 10 units below FullCAP full */
35#define MAX17042_FULL_THRESHOLD 10
29 36
30#define MAX17042_CHARACTERIZATION_DATA_SIZE 48 37#define MAX17042_CHARACTERIZATION_DATA_SIZE 48
31 38
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 571257e0f53d..e10f27468322 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -198,7 +198,7 @@ extern void wake_up_klogd(void);
198 198
199char *log_buf_addr_get(void); 199char *log_buf_addr_get(void);
200u32 log_buf_len_get(void); 200u32 log_buf_len_get(void);
201void log_buf_kexec_setup(void); 201void log_buf_vmcoreinfo_setup(void);
202void __init setup_log_buf(int early); 202void __init setup_log_buf(int early);
203__printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...); 203__printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...);
204void dump_stack_print_info(const char *log_lvl); 204void dump_stack_print_info(const char *log_lvl);
@@ -246,7 +246,7 @@ static inline u32 log_buf_len_get(void)
246 return 0; 246 return 0;
247} 247}
248 248
249static inline void log_buf_kexec_setup(void) 249static inline void log_buf_vmcoreinfo_setup(void)
250{ 250{
251} 251}
252 252
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
index 12cb8bd81d2d..58ab28d81fc2 100644
--- a/include/linux/proc_ns.h
+++ b/include/linux/proc_ns.h
@@ -14,6 +14,7 @@ struct inode;
14 14
15struct proc_ns_operations { 15struct proc_ns_operations {
16 const char *name; 16 const char *name;
17 const char *real_ns_name;
17 int type; 18 int type;
18 struct ns_common *(*get)(struct task_struct *task); 19 struct ns_common *(*get)(struct task_struct *task);
19 void (*put)(struct ns_common *ns); 20 void (*put)(struct ns_common *ns);
@@ -26,6 +27,7 @@ extern const struct proc_ns_operations netns_operations;
26extern const struct proc_ns_operations utsns_operations; 27extern const struct proc_ns_operations utsns_operations;
27extern const struct proc_ns_operations ipcns_operations; 28extern const struct proc_ns_operations ipcns_operations;
28extern const struct proc_ns_operations pidns_operations; 29extern const struct proc_ns_operations pidns_operations;
30extern const struct proc_ns_operations pidns_for_children_operations;
29extern const struct proc_ns_operations userns_operations; 31extern const struct proc_ns_operations userns_operations;
30extern const struct proc_ns_operations mntns_operations; 32extern const struct proc_ns_operations mntns_operations;
31extern const struct proc_ns_operations cgroupns_operations; 33extern const struct proc_ns_operations cgroupns_operations;
diff --git a/include/linux/property.h b/include/linux/property.h
index 64e3a9c6d95f..2f482616a2f2 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -33,6 +33,8 @@ enum dev_dma_attr {
33 DEV_DMA_COHERENT, 33 DEV_DMA_COHERENT,
34}; 34};
35 35
36struct fwnode_handle *dev_fwnode(struct device *dev);
37
36bool device_property_present(struct device *dev, const char *propname); 38bool device_property_present(struct device *dev, const char *propname);
37int device_property_read_u8_array(struct device *dev, const char *propname, 39int device_property_read_u8_array(struct device *dev, const char *propname,
38 u8 *val, size_t nval); 40 u8 *val, size_t nval);
@@ -70,6 +72,15 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode,
70int fwnode_property_match_string(struct fwnode_handle *fwnode, 72int fwnode_property_match_string(struct fwnode_handle *fwnode,
71 const char *propname, const char *string); 73 const char *propname, const char *string);
72 74
75struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode);
76struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode);
77struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *fwnode,
78 struct fwnode_handle *child);
79
80#define fwnode_for_each_child_node(fwnode, child) \
81 for (child = fwnode_get_next_child_node(fwnode, NULL); child; \
82 child = fwnode_get_next_child_node(fwnode, child))
83
73struct fwnode_handle *device_get_next_child_node(struct device *dev, 84struct fwnode_handle *device_get_next_child_node(struct device *dev,
74 struct fwnode_handle *child); 85 struct fwnode_handle *child);
75 86
@@ -77,9 +88,12 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,
77 for (child = device_get_next_child_node(dev, NULL); child; \ 88 for (child = device_get_next_child_node(dev, NULL); child; \
78 child = device_get_next_child_node(dev, child)) 89 child = device_get_next_child_node(dev, child))
79 90
91struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *fwnode,
92 const char *childname);
80struct fwnode_handle *device_get_named_child_node(struct device *dev, 93struct fwnode_handle *device_get_named_child_node(struct device *dev,
81 const char *childname); 94 const char *childname);
82 95
96void fwnode_handle_get(struct fwnode_handle *fwnode);
83void fwnode_handle_put(struct fwnode_handle *fwnode); 97void fwnode_handle_put(struct fwnode_handle *fwnode);
84 98
85unsigned int device_get_child_node_count(struct device *dev); 99unsigned int device_get_child_node_count(struct device *dev);
@@ -258,4 +272,16 @@ int device_get_phy_mode(struct device *dev);
258 272
259void *device_get_mac_address(struct device *dev, char *addr, int alen); 273void *device_get_mac_address(struct device *dev, char *addr, int alen);
260 274
275struct fwnode_handle *fwnode_graph_get_next_endpoint(
276 struct fwnode_handle *fwnode, struct fwnode_handle *prev);
277struct fwnode_handle *fwnode_graph_get_remote_port_parent(
278 struct fwnode_handle *fwnode);
279struct fwnode_handle *fwnode_graph_get_remote_port(
280 struct fwnode_handle *fwnode);
281struct fwnode_handle *fwnode_graph_get_remote_endpoint(
282 struct fwnode_handle *fwnode);
283
284int fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode,
285 struct fwnode_endpoint *endpoint);
286
261#endif /* _LINUX_PROPERTY_H_ */ 287#endif /* _LINUX_PROPERTY_H_ */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 0da29cae009b..e2233f50f428 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -30,7 +30,9 @@
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/types.h> 31#include <linux/types.h>
32 32
33/* types */ 33struct module;
34
35/* pstore record types (see fs/pstore/inode.c for filename templates) */
34enum pstore_type_id { 36enum pstore_type_id {
35 PSTORE_TYPE_DMESG = 0, 37 PSTORE_TYPE_DMESG = 0,
36 PSTORE_TYPE_MCE = 1, 38 PSTORE_TYPE_MCE = 1,
@@ -45,42 +47,146 @@ enum pstore_type_id {
45 PSTORE_TYPE_UNKNOWN = 255 47 PSTORE_TYPE_UNKNOWN = 255
46}; 48};
47 49
48struct module; 50struct pstore_info;
51/**
52 * struct pstore_record - details of a pstore record entry
53 * @psi: pstore backend driver information
54 * @type: pstore record type
55 * @id: per-type unique identifier for record
56 * @time: timestamp of the record
57 * @buf: pointer to record contents
58 * @size: size of @buf
59 * @ecc_notice_size:
60 * ECC information for @buf
61 *
62 * Valid for PSTORE_TYPE_DMESG @type:
63 *
64 * @count: Oops count since boot
65 * @reason: kdump reason for notification
66 * @part: position in a multipart record
67 * @compressed: whether the buffer is compressed
68 *
69 */
70struct pstore_record {
71 struct pstore_info *psi;
72 enum pstore_type_id type;
73 u64 id;
74 struct timespec time;
75 char *buf;
76 ssize_t size;
77 ssize_t ecc_notice_size;
49 78
79 int count;
80 enum kmsg_dump_reason reason;
81 unsigned int part;
82 bool compressed;
83};
84
85/**
86 * struct pstore_info - backend pstore driver structure
87 *
88 * @owner: module which is repsonsible for this backend driver
89 * @name: name of the backend driver
90 *
91 * @buf_lock: spinlock to serialize access to @buf
92 * @buf: preallocated crash dump buffer
93 * @bufsize: size of @buf available for crash dump writes
94 *
95 * @read_mutex: serializes @open, @read, @close, and @erase callbacks
96 * @flags: bitfield of frontends the backend can accept writes for
97 * @data: backend-private pointer passed back during callbacks
98 *
99 * Callbacks:
100 *
101 * @open:
102 * Notify backend that pstore is starting a full read of backend
103 * records. Followed by one or more @read calls, and a final @close.
104 *
105 * @psi: in: pointer to the struct pstore_info for the backend
106 *
107 * Returns 0 on success, and non-zero on error.
108 *
109 * @close:
110 * Notify backend that pstore has finished a full read of backend
111 * records. Always preceded by an @open call and one or more @read
112 * calls.
113 *
114 * @psi: in: pointer to the struct pstore_info for the backend
115 *
116 * Returns 0 on success, and non-zero on error. (Though pstore will
117 * ignore the error.)
118 *
119 * @read:
120 * Read next available backend record. Called after a successful
121 * @open.
122 *
123 * @record:
124 * pointer to record to populate. @buf should be allocated
125 * by the backend and filled. At least @type and @id should
126 * be populated, since these are used when creating pstorefs
127 * file names.
128 *
129 * Returns record size on success, zero when no more records are
130 * available, or negative on error.
131 *
132 * @write:
133 * A newly generated record needs to be written to backend storage.
134 *
135 * @record:
136 * pointer to record metadata. When @type is PSTORE_TYPE_DMESG,
137 * @buf will be pointing to the preallocated @psi.buf, since
138 * memory allocation may be broken during an Oops. Regardless,
139 * @buf must be proccesed or copied before returning. The
140 * backend is also expected to write @id with something that
141 8 can help identify this record to a future @erase callback.
142 *
143 * Returns 0 on success, and non-zero on error.
144 *
145 * @write_user:
146 * Perform a frontend write to a backend record, using a specified
147 * buffer that is coming directly from userspace, instead of the
148 * @record @buf.
149 *
150 * @record: pointer to record metadata.
151 * @buf: pointer to userspace contents to write to backend
152 *
153 * Returns 0 on success, and non-zero on error.
154 *
155 * @erase:
156 * Delete a record from backend storage. Different backends
157 * identify records differently, so entire original record is
158 * passed back to assist in identification of what the backend
159 * should remove from storage.
160 *
161 * @record: pointer to record metadata.
162 *
163 * Returns 0 on success, and non-zero on error.
164 *
165 */
50struct pstore_info { 166struct pstore_info {
51 struct module *owner; 167 struct module *owner;
52 char *name; 168 char *name;
53 spinlock_t buf_lock; /* serialize access to 'buf' */ 169
170 spinlock_t buf_lock;
54 char *buf; 171 char *buf;
55 size_t bufsize; 172 size_t bufsize;
56 struct mutex read_mutex; /* serialize open/read/close */ 173
174 struct mutex read_mutex;
175
57 int flags; 176 int flags;
177 void *data;
178
58 int (*open)(struct pstore_info *psi); 179 int (*open)(struct pstore_info *psi);
59 int (*close)(struct pstore_info *psi); 180 int (*close)(struct pstore_info *psi);
60 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 181 ssize_t (*read)(struct pstore_record *record);
61 int *count, struct timespec *time, char **buf, 182 int (*write)(struct pstore_record *record);
62 bool *compressed, ssize_t *ecc_notice_size, 183 int (*write_user)(struct pstore_record *record,
63 struct pstore_info *psi); 184 const char __user *buf);
64 int (*write)(enum pstore_type_id type, 185 int (*erase)(struct pstore_record *record);
65 enum kmsg_dump_reason reason, u64 *id,
66 unsigned int part, int count, bool compressed,
67 size_t size, struct pstore_info *psi);
68 int (*write_buf)(enum pstore_type_id type,
69 enum kmsg_dump_reason reason, u64 *id,
70 unsigned int part, const char *buf, bool compressed,
71 size_t size, struct pstore_info *psi);
72 int (*write_buf_user)(enum pstore_type_id type,
73 enum kmsg_dump_reason reason, u64 *id,
74 unsigned int part, const char __user *buf,
75 bool compressed, size_t size, struct pstore_info *psi);
76 int (*erase)(enum pstore_type_id type, u64 id,
77 int count, struct timespec time,
78 struct pstore_info *psi);
79 void *data;
80}; 186};
81 187
188/* Supported frontends */
82#define PSTORE_FLAGS_DMESG (1 << 0) 189#define PSTORE_FLAGS_DMESG (1 << 0)
83#define PSTORE_FLAGS_FRAGILE PSTORE_FLAGS_DMESG
84#define PSTORE_FLAGS_CONSOLE (1 << 1) 190#define PSTORE_FLAGS_CONSOLE (1 << 1)
85#define PSTORE_FLAGS_FTRACE (1 << 2) 191#define PSTORE_FLAGS_FTRACE (1 << 2)
86#define PSTORE_FLAGS_PMSG (1 << 3) 192#define PSTORE_FLAGS_PMSG (1 << 3)
diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h
index 6c70444da3b9..6b2e0dd88569 100644
--- a/include/linux/ptr_ring.h
+++ b/include/linux/ptr_ring.h
@@ -34,11 +34,13 @@
34struct ptr_ring { 34struct ptr_ring {
35 int producer ____cacheline_aligned_in_smp; 35 int producer ____cacheline_aligned_in_smp;
36 spinlock_t producer_lock; 36 spinlock_t producer_lock;
37 int consumer ____cacheline_aligned_in_smp; 37 int consumer_head ____cacheline_aligned_in_smp; /* next valid entry */
38 int consumer_tail; /* next entry to invalidate */
38 spinlock_t consumer_lock; 39 spinlock_t consumer_lock;
39 /* Shared consumer/producer data */ 40 /* Shared consumer/producer data */
40 /* Read-only by both the producer and the consumer */ 41 /* Read-only by both the producer and the consumer */
41 int size ____cacheline_aligned_in_smp; /* max entries in queue */ 42 int size ____cacheline_aligned_in_smp; /* max entries in queue */
43 int batch; /* number of entries to consume in a batch */
42 void **queue; 44 void **queue;
43}; 45};
44 46
@@ -170,7 +172,7 @@ static inline int ptr_ring_produce_bh(struct ptr_ring *r, void *ptr)
170static inline void *__ptr_ring_peek(struct ptr_ring *r) 172static inline void *__ptr_ring_peek(struct ptr_ring *r)
171{ 173{
172 if (likely(r->size)) 174 if (likely(r->size))
173 return r->queue[r->consumer]; 175 return r->queue[r->consumer_head];
174 return NULL; 176 return NULL;
175} 177}
176 178
@@ -231,9 +233,38 @@ static inline bool ptr_ring_empty_bh(struct ptr_ring *r)
231/* Must only be called after __ptr_ring_peek returned !NULL */ 233/* Must only be called after __ptr_ring_peek returned !NULL */
232static inline void __ptr_ring_discard_one(struct ptr_ring *r) 234static inline void __ptr_ring_discard_one(struct ptr_ring *r)
233{ 235{
234 r->queue[r->consumer++] = NULL; 236 /* Fundamentally, what we want to do is update consumer
235 if (unlikely(r->consumer >= r->size)) 237 * index and zero out the entry so producer can reuse it.
236 r->consumer = 0; 238 * Doing it naively at each consume would be as simple as:
239 * r->queue[r->consumer++] = NULL;
240 * if (unlikely(r->consumer >= r->size))
241 * r->consumer = 0;
242 * but that is suboptimal when the ring is full as producer is writing
243 * out new entries in the same cache line. Defer these updates until a
244 * batch of entries has been consumed.
245 */
246 int head = r->consumer_head++;
247
248 /* Once we have processed enough entries invalidate them in
249 * the ring all at once so producer can reuse their space in the ring.
250 * We also do this when we reach end of the ring - not mandatory
251 * but helps keep the implementation simple.
252 */
253 if (unlikely(r->consumer_head - r->consumer_tail >= r->batch ||
254 r->consumer_head >= r->size)) {
255 /* Zero out entries in the reverse order: this way we touch the
256 * cache line that producer might currently be reading the last;
257 * producer won't make progress and touch other cache lines
258 * besides the first one until we write out all entries.
259 */
260 while (likely(head >= r->consumer_tail))
261 r->queue[head--] = NULL;
262 r->consumer_tail = r->consumer_head;
263 }
264 if (unlikely(r->consumer_head >= r->size)) {
265 r->consumer_head = 0;
266 r->consumer_tail = 0;
267 }
237} 268}
238 269
239static inline void *__ptr_ring_consume(struct ptr_ring *r) 270static inline void *__ptr_ring_consume(struct ptr_ring *r)
@@ -345,14 +376,27 @@ static inline void **__ptr_ring_init_queue_alloc(int size, gfp_t gfp)
345 return kzalloc(ALIGN(size * sizeof(void *), SMP_CACHE_BYTES), gfp); 376 return kzalloc(ALIGN(size * sizeof(void *), SMP_CACHE_BYTES), gfp);
346} 377}
347 378
379static inline void __ptr_ring_set_size(struct ptr_ring *r, int size)
380{
381 r->size = size;
382 r->batch = SMP_CACHE_BYTES * 2 / sizeof(*(r->queue));
383 /* We need to set batch at least to 1 to make logic
384 * in __ptr_ring_discard_one work correctly.
385 * Batching too much (because ring is small) would cause a lot of
386 * burstiness. Needs tuning, for now disable batching.
387 */
388 if (r->batch > r->size / 2 || !r->batch)
389 r->batch = 1;
390}
391
348static inline int ptr_ring_init(struct ptr_ring *r, int size, gfp_t gfp) 392static inline int ptr_ring_init(struct ptr_ring *r, int size, gfp_t gfp)
349{ 393{
350 r->queue = __ptr_ring_init_queue_alloc(size, gfp); 394 r->queue = __ptr_ring_init_queue_alloc(size, gfp);
351 if (!r->queue) 395 if (!r->queue)
352 return -ENOMEM; 396 return -ENOMEM;
353 397
354 r->size = size; 398 __ptr_ring_set_size(r, size);
355 r->producer = r->consumer = 0; 399 r->producer = r->consumer_head = r->consumer_tail = 0;
356 spin_lock_init(&r->producer_lock); 400 spin_lock_init(&r->producer_lock);
357 spin_lock_init(&r->consumer_lock); 401 spin_lock_init(&r->consumer_lock);
358 402
@@ -373,9 +417,10 @@ static inline void **__ptr_ring_swap_queue(struct ptr_ring *r, void **queue,
373 else if (destroy) 417 else if (destroy)
374 destroy(ptr); 418 destroy(ptr);
375 419
376 r->size = size; 420 __ptr_ring_set_size(r, size);
377 r->producer = producer; 421 r->producer = producer;
378 r->consumer = 0; 422 r->consumer_head = 0;
423 r->consumer_tail = 0;
379 old = r->queue; 424 old = r->queue;
380 r->queue = queue; 425 r->queue = queue;
381 426
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 422bc2e4cb6a..ef3eb8bbfee4 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -54,7 +54,8 @@ extern int ptrace_request(struct task_struct *child, long request,
54 unsigned long addr, unsigned long data); 54 unsigned long addr, unsigned long data);
55extern void ptrace_notify(int exit_code); 55extern void ptrace_notify(int exit_code);
56extern void __ptrace_link(struct task_struct *child, 56extern void __ptrace_link(struct task_struct *child,
57 struct task_struct *new_parent); 57 struct task_struct *new_parent,
58 const struct cred *ptracer_cred);
58extern void __ptrace_unlink(struct task_struct *child); 59extern void __ptrace_unlink(struct task_struct *child);
59extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead); 60extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead);
60#define PTRACE_MODE_READ 0x01 61#define PTRACE_MODE_READ 0x01
@@ -206,7 +207,7 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
206 207
207 if (unlikely(ptrace) && current->ptrace) { 208 if (unlikely(ptrace) && current->ptrace) {
208 child->ptrace = current->ptrace; 209 child->ptrace = current->ptrace;
209 __ptrace_link(child, current->parent); 210 __ptrace_link(child, current->parent, current->ptracer_cred);
210 211
211 if (child->ptrace & PT_SEIZED) 212 if (child->ptrace & PT_SEIZED)
212 task_set_jobctl_pending(child, JOBCTL_TRAP_STOP); 213 task_set_jobctl_pending(child, JOBCTL_TRAP_STOP);
@@ -215,6 +216,8 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
215 216
216 set_tsk_thread_flag(child, TIF_SIGPENDING); 217 set_tsk_thread_flag(child, TIF_SIGPENDING);
217 } 218 }
219 else
220 child->ptracer_cred = NULL;
218} 221}
219 222
220/** 223/**
diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
index d32f6f1a5225..e5380471c2cd 100644
--- a/include/linux/qcom_scm.h
+++ b/include/linux/qcom_scm.h
@@ -40,6 +40,9 @@ extern int qcom_scm_pas_shutdown(u32 peripheral);
40extern void qcom_scm_cpu_power_down(u32 flags); 40extern void qcom_scm_cpu_power_down(u32 flags);
41extern u32 qcom_scm_get_version(void); 41extern u32 qcom_scm_get_version(void);
42extern int qcom_scm_set_remote_state(u32 state, u32 id); 42extern int qcom_scm_set_remote_state(u32 state, u32 id);
43extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);
44extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size);
45extern int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare);
43#else 46#else
44static inline 47static inline
45int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus) 48int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
@@ -67,5 +70,8 @@ static inline void qcom_scm_cpu_power_down(u32 flags) {}
67static inline u32 qcom_scm_get_version(void) { return 0; } 70static inline u32 qcom_scm_get_version(void) { return 0; }
68static inline u32 71static inline u32
69qcom_scm_set_remote_state(u32 state,u32 id) { return -ENODEV; } 72qcom_scm_set_remote_state(u32 state,u32 id) { return -ENODEV; }
73static inline int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) { return -ENODEV; }
74static inline int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size) { return -ENODEV; }
75static inline int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) { return -ENODEV; }
70#endif 76#endif
71#endif 77#endif
diff --git a/include/linux/qed/common_hsi.h b/include/linux/qed/common_hsi.h
index 52966b9bfde3..fbab6e0514f0 100644
--- a/include/linux/qed/common_hsi.h
+++ b/include/linux/qed/common_hsi.h
@@ -100,8 +100,8 @@
100#define MAX_NUM_LL2_TX_STATS_COUNTERS 32 100#define MAX_NUM_LL2_TX_STATS_COUNTERS 32
101 101
102#define FW_MAJOR_VERSION 8 102#define FW_MAJOR_VERSION 8
103#define FW_MINOR_VERSION 10 103#define FW_MINOR_VERSION 15
104#define FW_REVISION_VERSION 10 104#define FW_REVISION_VERSION 3
105#define FW_ENGINEERING_VERSION 0 105#define FW_ENGINEERING_VERSION 0
106 106
107/***********************/ 107/***********************/
@@ -187,6 +187,9 @@
187 187
188/* DEMS */ 188/* DEMS */
189#define DQ_DEMS_LEGACY 0 189#define DQ_DEMS_LEGACY 0
190#define DQ_DEMS_TOE_MORE_TO_SEND 3
191#define DQ_DEMS_TOE_LOCAL_ADV_WND 4
192#define DQ_DEMS_ROCE_CQ_CONS 7
190 193
191/* XCM agg val selection */ 194/* XCM agg val selection */
192#define DQ_XCM_AGG_VAL_SEL_WORD2 0 195#define DQ_XCM_AGG_VAL_SEL_WORD2 0
@@ -214,6 +217,9 @@
214#define DQ_XCM_ISCSI_MORE_TO_SEND_SEQ_CMD DQ_XCM_AGG_VAL_SEL_REG3 217#define DQ_XCM_ISCSI_MORE_TO_SEND_SEQ_CMD DQ_XCM_AGG_VAL_SEL_REG3
215#define DQ_XCM_ISCSI_EXP_STAT_SN_CMD DQ_XCM_AGG_VAL_SEL_REG6 218#define DQ_XCM_ISCSI_EXP_STAT_SN_CMD DQ_XCM_AGG_VAL_SEL_REG6
216#define DQ_XCM_ROCE_SQ_PROD_CMD DQ_XCM_AGG_VAL_SEL_WORD4 219#define DQ_XCM_ROCE_SQ_PROD_CMD DQ_XCM_AGG_VAL_SEL_WORD4
220#define DQ_XCM_TOE_TX_BD_PROD_CMD DQ_XCM_AGG_VAL_SEL_WORD4
221#define DQ_XCM_TOE_MORE_TO_SEND_SEQ_CMD DQ_XCM_AGG_VAL_SEL_REG3
222#define DQ_XCM_TOE_LOCAL_ADV_WND_SEQ_CMD DQ_XCM_AGG_VAL_SEL_REG4
217 223
218/* UCM agg val selection (HW) */ 224/* UCM agg val selection (HW) */
219#define DQ_UCM_AGG_VAL_SEL_WORD0 0 225#define DQ_UCM_AGG_VAL_SEL_WORD0 0
@@ -269,6 +275,8 @@
269#define DQ_XCM_ISCSI_DQ_FLUSH_CMD BIT(DQ_XCM_AGG_FLG_SHIFT_CF19) 275#define DQ_XCM_ISCSI_DQ_FLUSH_CMD BIT(DQ_XCM_AGG_FLG_SHIFT_CF19)
270#define DQ_XCM_ISCSI_SLOW_PATH_CMD BIT(DQ_XCM_AGG_FLG_SHIFT_CF22) 276#define DQ_XCM_ISCSI_SLOW_PATH_CMD BIT(DQ_XCM_AGG_FLG_SHIFT_CF22)
271#define DQ_XCM_ISCSI_PROC_ONLY_CLEANUP_CMD BIT(DQ_XCM_AGG_FLG_SHIFT_CF23) 277#define DQ_XCM_ISCSI_PROC_ONLY_CLEANUP_CMD BIT(DQ_XCM_AGG_FLG_SHIFT_CF23)
278#define DQ_XCM_TOE_DQ_FLUSH_CMD BIT(DQ_XCM_AGG_FLG_SHIFT_CF19)
279#define DQ_XCM_TOE_SLOW_PATH_CMD BIT(DQ_XCM_AGG_FLG_SHIFT_CF22)
272 280
273/* UCM agg counter flag selection (HW) */ 281/* UCM agg counter flag selection (HW) */
274#define DQ_UCM_AGG_FLG_SHIFT_CF0 0 282#define DQ_UCM_AGG_FLG_SHIFT_CF0 0
@@ -285,6 +293,9 @@
285#define DQ_UCM_ETH_PMD_RX_ARM_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF5) 293#define DQ_UCM_ETH_PMD_RX_ARM_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF5)
286#define DQ_UCM_ROCE_CQ_ARM_SE_CF_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF4) 294#define DQ_UCM_ROCE_CQ_ARM_SE_CF_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF4)
287#define DQ_UCM_ROCE_CQ_ARM_CF_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF5) 295#define DQ_UCM_ROCE_CQ_ARM_CF_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF5)
296#define DQ_UCM_TOE_TIMER_STOP_ALL_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF3)
297#define DQ_UCM_TOE_SLOW_PATH_CF_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF4)
298#define DQ_UCM_TOE_DQ_CF_CMD BIT(DQ_UCM_AGG_FLG_SHIFT_CF5)
288 299
289/* TCM agg counter flag selection (HW) */ 300/* TCM agg counter flag selection (HW) */
290#define DQ_TCM_AGG_FLG_SHIFT_CF0 0 301#define DQ_TCM_AGG_FLG_SHIFT_CF0 0
@@ -301,6 +312,9 @@
301#define DQ_TCM_FCOE_TIMER_STOP_ALL_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF3) 312#define DQ_TCM_FCOE_TIMER_STOP_ALL_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF3)
302#define DQ_TCM_ISCSI_FLUSH_Q0_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF1) 313#define DQ_TCM_ISCSI_FLUSH_Q0_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF1)
303#define DQ_TCM_ISCSI_TIMER_STOP_ALL_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF3) 314#define DQ_TCM_ISCSI_TIMER_STOP_ALL_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF3)
315#define DQ_TCM_TOE_FLUSH_Q0_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF1)
316#define DQ_TCM_TOE_TIMER_STOP_ALL_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF3)
317#define DQ_TCM_IWARP_POST_RQ_CF_CMD BIT(DQ_TCM_AGG_FLG_SHIFT_CF1)
304 318
305/* PWM address mapping */ 319/* PWM address mapping */
306#define DQ_PWM_OFFSET_DPM_BASE 0x0 320#define DQ_PWM_OFFSET_DPM_BASE 0x0
@@ -689,6 +703,16 @@ struct iscsi_eqe_data {
689#define ISCSI_EQE_DATA_RESERVED0_SHIFT 7 703#define ISCSI_EQE_DATA_RESERVED0_SHIFT 7
690}; 704};
691 705
706struct rdma_eqe_destroy_qp {
707 __le32 cid;
708 u8 reserved[4];
709};
710
711union rdma_eqe_data {
712 struct regpair async_handle;
713 struct rdma_eqe_destroy_qp rdma_destroy_qp_data;
714};
715
692struct malicious_vf_eqe_data { 716struct malicious_vf_eqe_data {
693 u8 vf_id; 717 u8 vf_id;
694 u8 err_id; 718 u8 err_id;
@@ -705,9 +729,9 @@ union event_ring_data {
705 u8 bytes[8]; 729 u8 bytes[8];
706 struct vf_pf_channel_eqe_data vf_pf_channel; 730 struct vf_pf_channel_eqe_data vf_pf_channel;
707 struct iscsi_eqe_data iscsi_info; 731 struct iscsi_eqe_data iscsi_info;
732 union rdma_eqe_data rdma_data;
708 struct malicious_vf_eqe_data malicious_vf; 733 struct malicious_vf_eqe_data malicious_vf;
709 struct initial_cleanup_eqe_data vf_init_cleanup; 734 struct initial_cleanup_eqe_data vf_init_cleanup;
710 struct regpair roce_handle;
711}; 735};
712 736
713/* Event Ring Entry */ 737/* Event Ring Entry */
diff --git a/include/linux/qed/eth_common.h b/include/linux/qed/eth_common.h
index 4b402fb0eaad..34d93eb5bfba 100644
--- a/include/linux/qed/eth_common.h
+++ b/include/linux/qed/eth_common.h
@@ -49,6 +49,9 @@
49#define ETH_RX_CQE_PAGE_SIZE_BYTES 4096 49#define ETH_RX_CQE_PAGE_SIZE_BYTES 4096
50#define ETH_RX_NUM_NEXT_PAGE_BDS 2 50#define ETH_RX_NUM_NEXT_PAGE_BDS 2
51 51
52#define ETH_MAX_TUNN_LSO_INNER_IPV4_OFFSET 253
53#define ETH_MAX_TUNN_LSO_INNER_IPV6_OFFSET 251
54
52#define ETH_TX_MIN_BDS_PER_NON_LSO_PKT 1 55#define ETH_TX_MIN_BDS_PER_NON_LSO_PKT 1
53#define ETH_TX_MAX_BDS_PER_NON_LSO_PACKET 18 56#define ETH_TX_MAX_BDS_PER_NON_LSO_PACKET 18
54#define ETH_TX_MAX_BDS_PER_LSO_PACKET 255 57#define ETH_TX_MAX_BDS_PER_LSO_PACKET 255
diff --git a/include/linux/qed/fcoe_common.h b/include/linux/qed/fcoe_common.h
index 2e417a45c5f7..947a635d04bb 100644
--- a/include/linux/qed/fcoe_common.h
+++ b/include/linux/qed/fcoe_common.h
@@ -109,13 +109,6 @@ struct fcoe_conn_terminate_ramrod_data {
109 struct regpair terminate_params_addr; 109 struct regpair terminate_params_addr;
110}; 110};
111 111
112struct fcoe_fast_sgl_ctx {
113 struct regpair sgl_start_addr;
114 __le32 sgl_byte_offset;
115 __le16 task_reuse_cnt;
116 __le16 init_offset_in_first_sge;
117};
118
119struct fcoe_slow_sgl_ctx { 112struct fcoe_slow_sgl_ctx {
120 struct regpair base_sgl_addr; 113 struct regpair base_sgl_addr;
121 __le16 curr_sge_off; 114 __le16 curr_sge_off;
@@ -124,23 +117,16 @@ struct fcoe_slow_sgl_ctx {
124 __le16 reserved; 117 __le16 reserved;
125}; 118};
126 119
127struct fcoe_sge {
128 struct regpair sge_addr;
129 __le16 size;
130 __le16 reserved0;
131 u8 reserved1[3];
132 u8 is_valid_sge;
133};
134
135union fcoe_data_desc_ctx {
136 struct fcoe_fast_sgl_ctx fast;
137 struct fcoe_slow_sgl_ctx slow;
138 struct fcoe_sge single_sge;
139};
140
141union fcoe_dix_desc_ctx { 120union fcoe_dix_desc_ctx {
142 struct fcoe_slow_sgl_ctx dix_sgl; 121 struct fcoe_slow_sgl_ctx dix_sgl;
143 struct fcoe_sge cached_dix_sge; 122 struct scsi_sge cached_dix_sge;
123};
124
125struct fcoe_fast_sgl_ctx {
126 struct regpair sgl_start_addr;
127 __le32 sgl_byte_offset;
128 __le16 task_reuse_cnt;
129 __le16 init_offset_in_first_sge;
144}; 130};
145 131
146struct fcoe_fcp_cmd_payload { 132struct fcoe_fcp_cmd_payload {
@@ -172,57 +158,6 @@ enum fcoe_mode_type {
172 MAX_FCOE_MODE_TYPE 158 MAX_FCOE_MODE_TYPE
173}; 159};
174 160
175struct fcoe_mstorm_fcoe_task_st_ctx_fp {
176 __le16 flags;
177#define FCOE_MSTORM_FCOE_TASK_ST_CTX_FP_RSRV0_MASK 0x7FFF
178#define FCOE_MSTORM_FCOE_TASK_ST_CTX_FP_RSRV0_SHIFT 0
179#define FCOE_MSTORM_FCOE_TASK_ST_CTX_FP_MP_INCLUDE_FC_HEADER_MASK 0x1
180#define FCOE_MSTORM_FCOE_TASK_ST_CTX_FP_MP_INCLUDE_FC_HEADER_SHIFT 15
181 __le16 difDataResidue;
182 __le16 parent_id;
183 __le16 single_sge_saved_offset;
184 __le32 data_2_trns_rem;
185 __le32 offset_in_io;
186 union fcoe_dix_desc_ctx dix_desc;
187 union fcoe_data_desc_ctx data_desc;
188};
189
190struct fcoe_mstorm_fcoe_task_st_ctx_non_fp {
191 __le16 flags;
192#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_HOST_INTERFACE_MASK 0x3
193#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_HOST_INTERFACE_SHIFT 0
194#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_DIF_TO_PEER_MASK 0x1
195#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_DIF_TO_PEER_SHIFT 2
196#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_VALIDATE_DIX_APP_TAG_MASK 0x1
197#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_VALIDATE_DIX_APP_TAG_SHIFT 3
198#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_INTERVAL_SIZE_LOG_MASK 0xF
199#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_INTERVAL_SIZE_LOG_SHIFT 4
200#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_DIX_BLOCK_SIZE_MASK 0x3
201#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_DIX_BLOCK_SIZE_SHIFT 8
202#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_RESERVED_MASK 0x1
203#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_RESERVED_SHIFT 10
204#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_HAS_FIRST_PACKET_ARRIVED_MASK 0x1
205#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_HAS_FIRST_PACKET_ARRIVED_SHIFT 11
206#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_VALIDATE_DIX_REF_TAG_MASK 0x1
207#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_VALIDATE_DIX_REF_TAG_SHIFT 12
208#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_DIX_CACHED_SGE_FLG_MASK 0x1
209#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_DIX_CACHED_SGE_FLG_SHIFT 13
210#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_OFFSET_IN_IO_VALID_MASK 0x1
211#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_OFFSET_IN_IO_VALID_SHIFT 14
212#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_DIF_SUPPORTED_MASK 0x1
213#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_DIF_SUPPORTED_SHIFT 15
214 u8 tx_rx_sgl_mode;
215#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_TX_SGL_MODE_MASK 0x7
216#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_TX_SGL_MODE_SHIFT 0
217#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_RX_SGL_MODE_MASK 0x7
218#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_RX_SGL_MODE_SHIFT 3
219#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_RSRV1_MASK 0x3
220#define FCOE_MSTORM_FCOE_TASK_ST_CTX_NON_FP_RSRV1_SHIFT 6
221 u8 rsrv2;
222 __le32 num_prm_zero_read;
223 struct regpair rsp_buf_addr;
224};
225
226struct fcoe_rx_stat { 161struct fcoe_rx_stat {
227 struct regpair fcoe_rx_byte_cnt; 162 struct regpair fcoe_rx_byte_cnt;
228 struct regpair fcoe_rx_data_pkt_cnt; 163 struct regpair fcoe_rx_data_pkt_cnt;
@@ -236,16 +171,6 @@ struct fcoe_rx_stat {
236 __le32 rsrv; 171 __le32 rsrv;
237}; 172};
238 173
239enum fcoe_sgl_mode {
240 FCOE_SLOW_SGL,
241 FCOE_SINGLE_FAST_SGE,
242 FCOE_2_FAST_SGE,
243 FCOE_3_FAST_SGE,
244 FCOE_4_FAST_SGE,
245 FCOE_MUL_FAST_SGES,
246 MAX_FCOE_SGL_MODE
247};
248
249struct fcoe_stat_ramrod_data { 174struct fcoe_stat_ramrod_data {
250 struct regpair stat_params_addr; 175 struct regpair stat_params_addr;
251}; 176};
@@ -328,22 +253,24 @@ union fcoe_tx_info_union_ctx {
328struct ystorm_fcoe_task_st_ctx { 253struct ystorm_fcoe_task_st_ctx {
329 u8 task_type; 254 u8 task_type;
330 u8 sgl_mode; 255 u8 sgl_mode;
331#define YSTORM_FCOE_TASK_ST_CTX_TX_SGL_MODE_MASK 0x7 256#define YSTORM_FCOE_TASK_ST_CTX_TX_SGL_MODE_MASK 0x1
332#define YSTORM_FCOE_TASK_ST_CTX_TX_SGL_MODE_SHIFT 0 257#define YSTORM_FCOE_TASK_ST_CTX_TX_SGL_MODE_SHIFT 0
333#define YSTORM_FCOE_TASK_ST_CTX_RSRV_MASK 0x1F 258#define YSTORM_FCOE_TASK_ST_CTX_RSRV_MASK 0x7F
334#define YSTORM_FCOE_TASK_ST_CTX_RSRV_SHIFT 3 259#define YSTORM_FCOE_TASK_ST_CTX_RSRV_SHIFT 1
335 u8 cached_dix_sge; 260 u8 cached_dix_sge;
336 u8 expect_first_xfer; 261 u8 expect_first_xfer;
337 __le32 num_pbf_zero_write; 262 __le32 num_pbf_zero_write;
338 union protection_info_union_ctx protection_info_union; 263 union protection_info_union_ctx protection_info_union;
339 __le32 data_2_trns_rem; 264 __le32 data_2_trns_rem;
265 struct scsi_sgl_params sgl_params;
266 u8 reserved1[12];
340 union fcoe_tx_info_union_ctx tx_info_union; 267 union fcoe_tx_info_union_ctx tx_info_union;
341 union fcoe_dix_desc_ctx dix_desc; 268 union fcoe_dix_desc_ctx dix_desc;
342 union fcoe_data_desc_ctx data_desc; 269 struct scsi_cached_sges data_desc;
343 __le16 ox_id; 270 __le16 ox_id;
344 __le16 rx_id; 271 __le16 rx_id;
345 __le32 task_rety_identifier; 272 __le32 task_rety_identifier;
346 __le32 reserved1[2]; 273 u8 reserved2[8];
347}; 274};
348 275
349struct ystorm_fcoe_task_ag_ctx { 276struct ystorm_fcoe_task_ag_ctx {
@@ -484,22 +411,22 @@ struct tstorm_fcoe_task_ag_ctx {
484struct fcoe_tstorm_fcoe_task_st_ctx_read_write { 411struct fcoe_tstorm_fcoe_task_st_ctx_read_write {
485 union fcoe_cleanup_addr_exp_ro_union cleanup_addr_exp_ro_union; 412 union fcoe_cleanup_addr_exp_ro_union cleanup_addr_exp_ro_union;
486 __le16 flags; 413 __le16 flags;
487#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RX_SGL_MODE_MASK 0x7 414#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RX_SGL_MODE_MASK 0x1
488#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RX_SGL_MODE_SHIFT 0 415#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RX_SGL_MODE_SHIFT 0
489#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_EXP_FIRST_FRAME_MASK 0x1 416#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_EXP_FIRST_FRAME_MASK 0x1
490#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_EXP_FIRST_FRAME_SHIFT 3 417#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_EXP_FIRST_FRAME_SHIFT 1
491#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_ACTIVE_MASK 0x1 418#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_ACTIVE_MASK 0x1
492#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_ACTIVE_SHIFT 4 419#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_ACTIVE_SHIFT 2
493#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_TIMEOUT_MASK 0x1 420#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_TIMEOUT_MASK 0x1
494#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_TIMEOUT_SHIFT 5 421#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_TIMEOUT_SHIFT 3
495#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SINGLE_PKT_IN_EX_MASK 0x1 422#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SINGLE_PKT_IN_EX_MASK 0x1
496#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SINGLE_PKT_IN_EX_SHIFT 6 423#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SINGLE_PKT_IN_EX_SHIFT 4
497#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_OOO_RX_SEQ_STAT_MASK 0x1 424#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_OOO_RX_SEQ_STAT_MASK 0x1
498#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_OOO_RX_SEQ_STAT_SHIFT 7 425#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_OOO_RX_SEQ_STAT_SHIFT 5
499#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_CQ_ADD_ADV_MASK 0x3 426#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_CQ_ADD_ADV_MASK 0x3
500#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_CQ_ADD_ADV_SHIFT 8 427#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_CQ_ADD_ADV_SHIFT 6
501#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RSRV1_MASK 0x3F 428#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RSRV1_MASK 0xFF
502#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RSRV1_SHIFT 10 429#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RSRV1_SHIFT 8
503 __le16 seq_cnt; 430 __le16 seq_cnt;
504 u8 seq_id; 431 u8 seq_id;
505 u8 ooo_rx_seq_id; 432 u8 ooo_rx_seq_id;
@@ -582,8 +509,34 @@ struct mstorm_fcoe_task_ag_ctx {
582}; 509};
583 510
584struct mstorm_fcoe_task_st_ctx { 511struct mstorm_fcoe_task_st_ctx {
585 struct fcoe_mstorm_fcoe_task_st_ctx_non_fp non_fp; 512 struct regpair rsp_buf_addr;
586 struct fcoe_mstorm_fcoe_task_st_ctx_fp fp; 513 __le32 rsrv[2];
514 struct scsi_sgl_params sgl_params;
515 __le32 data_2_trns_rem;
516 __le32 data_buffer_offset;
517 __le16 parent_id;
518 __le16 flags;
519#define MSTORM_FCOE_TASK_ST_CTX_INTERVAL_SIZE_LOG_MASK 0xF
520#define MSTORM_FCOE_TASK_ST_CTX_INTERVAL_SIZE_LOG_SHIFT 0
521#define MSTORM_FCOE_TASK_ST_CTX_HOST_INTERFACE_MASK 0x3
522#define MSTORM_FCOE_TASK_ST_CTX_HOST_INTERFACE_SHIFT 4
523#define MSTORM_FCOE_TASK_ST_CTX_DIF_TO_PEER_MASK 0x1
524#define MSTORM_FCOE_TASK_ST_CTX_DIF_TO_PEER_SHIFT 6
525#define MSTORM_FCOE_TASK_ST_CTX_MP_INCLUDE_FC_HEADER_MASK 0x1
526#define MSTORM_FCOE_TASK_ST_CTX_MP_INCLUDE_FC_HEADER_SHIFT 7
527#define MSTORM_FCOE_TASK_ST_CTX_DIX_BLOCK_SIZE_MASK 0x3
528#define MSTORM_FCOE_TASK_ST_CTX_DIX_BLOCK_SIZE_SHIFT 8
529#define MSTORM_FCOE_TASK_ST_CTX_VALIDATE_DIX_REF_TAG_MASK 0x1
530#define MSTORM_FCOE_TASK_ST_CTX_VALIDATE_DIX_REF_TAG_SHIFT 10
531#define MSTORM_FCOE_TASK_ST_CTX_DIX_CACHED_SGE_FLG_MASK 0x1
532#define MSTORM_FCOE_TASK_ST_CTX_DIX_CACHED_SGE_FLG_SHIFT 11
533#define MSTORM_FCOE_TASK_ST_CTX_DIF_SUPPORTED_MASK 0x1
534#define MSTORM_FCOE_TASK_ST_CTX_DIF_SUPPORTED_SHIFT 12
535#define MSTORM_FCOE_TASK_ST_CTX_TX_SGL_MODE_MASK 0x1
536#define MSTORM_FCOE_TASK_ST_CTX_TX_SGL_MODE_SHIFT 13
537#define MSTORM_FCOE_TASK_ST_CTX_RESERVED_MASK 0x3
538#define MSTORM_FCOE_TASK_ST_CTX_RESERVED_SHIFT 14
539 struct scsi_cached_sges data_desc;
587}; 540};
588 541
589struct ustorm_fcoe_task_ag_ctx { 542struct ustorm_fcoe_task_ag_ctx {
@@ -646,6 +599,7 @@ struct ustorm_fcoe_task_ag_ctx {
646 599
647struct fcoe_task_context { 600struct fcoe_task_context {
648 struct ystorm_fcoe_task_st_ctx ystorm_st_context; 601 struct ystorm_fcoe_task_st_ctx ystorm_st_context;
602 struct regpair ystorm_st_padding[2];
649 struct tdif_task_context tdif_context; 603 struct tdif_task_context tdif_context;
650 struct ystorm_fcoe_task_ag_ctx ystorm_ag_context; 604 struct ystorm_fcoe_task_ag_ctx ystorm_ag_context;
651 struct tstorm_fcoe_task_ag_ctx tstorm_ag_context; 605 struct tstorm_fcoe_task_ag_ctx tstorm_ag_context;
@@ -668,20 +622,20 @@ struct fcoe_tx_stat {
668struct fcoe_wqe { 622struct fcoe_wqe {
669 __le16 task_id; 623 __le16 task_id;
670 __le16 flags; 624 __le16 flags;
671#define FCOE_WQE_REQ_TYPE_MASK 0xF 625#define FCOE_WQE_REQ_TYPE_MASK 0xF
672#define FCOE_WQE_REQ_TYPE_SHIFT 0 626#define FCOE_WQE_REQ_TYPE_SHIFT 0
673#define FCOE_WQE_SGL_MODE_MASK 0x7 627#define FCOE_WQE_SGL_MODE_MASK 0x1
674#define FCOE_WQE_SGL_MODE_SHIFT 4 628#define FCOE_WQE_SGL_MODE_SHIFT 4
675#define FCOE_WQE_CONTINUATION_MASK 0x1 629#define FCOE_WQE_CONTINUATION_MASK 0x1
676#define FCOE_WQE_CONTINUATION_SHIFT 7 630#define FCOE_WQE_CONTINUATION_SHIFT 5
677#define FCOE_WQE_INVALIDATE_PTU_MASK 0x1 631#define FCOE_WQE_SEND_AUTO_RSP_MASK 0x1
678#define FCOE_WQE_INVALIDATE_PTU_SHIFT 8 632#define FCOE_WQE_SEND_AUTO_RSP_SHIFT 6
679#define FCOE_WQE_SUPER_IO_MASK 0x1 633#define FCOE_WQE_RESERVED_MASK 0x1
680#define FCOE_WQE_SUPER_IO_SHIFT 9 634#define FCOE_WQE_RESERVED_SHIFT 7
681#define FCOE_WQE_SEND_AUTO_RSP_MASK 0x1 635#define FCOE_WQE_NUM_SGES_MASK 0xF
682#define FCOE_WQE_SEND_AUTO_RSP_SHIFT 10 636#define FCOE_WQE_NUM_SGES_SHIFT 8
683#define FCOE_WQE_RESERVED0_MASK 0x1F 637#define FCOE_WQE_RESERVED1_MASK 0xF
684#define FCOE_WQE_RESERVED0_SHIFT 11 638#define FCOE_WQE_RESERVED1_SHIFT 12
685 union fcoe_additional_info_union additional_info_union; 639 union fcoe_additional_info_union additional_info_union;
686}; 640};
687 641
diff --git a/include/linux/qed/iscsi_common.h b/include/linux/qed/iscsi_common.h
index 4c5747babcf6..69949f8e354b 100644
--- a/include/linux/qed/iscsi_common.h
+++ b/include/linux/qed/iscsi_common.h
@@ -39,17 +39,9 @@
39/* iSCSI HSI constants */ 39/* iSCSI HSI constants */
40#define ISCSI_DEFAULT_MTU (1500) 40#define ISCSI_DEFAULT_MTU (1500)
41 41
42/* Current iSCSI HSI version number composed of two fields (16 bit) */
43#define ISCSI_HSI_MAJOR_VERSION (0)
44#define ISCSI_HSI_MINOR_VERSION (0)
45
46/* KWQ (kernel work queue) layer codes */ 42/* KWQ (kernel work queue) layer codes */
47#define ISCSI_SLOW_PATH_LAYER_CODE (6) 43#define ISCSI_SLOW_PATH_LAYER_CODE (6)
48 44
49/* CQE completion status */
50#define ISCSI_EQE_COMPLETION_SUCCESS (0x0)
51#define ISCSI_EQE_RST_CONN_RCVD (0x1)
52
53/* iSCSI parameter defaults */ 45/* iSCSI parameter defaults */
54#define ISCSI_DEFAULT_HEADER_DIGEST (0) 46#define ISCSI_DEFAULT_HEADER_DIGEST (0)
55#define ISCSI_DEFAULT_DATA_DIGEST (0) 47#define ISCSI_DEFAULT_DATA_DIGEST (0)
@@ -68,6 +60,10 @@
68#define ISCSI_MIN_VAL_MAX_OUTSTANDING_R2T (1) 60#define ISCSI_MIN_VAL_MAX_OUTSTANDING_R2T (1)
69#define ISCSI_MAX_VAL_MAX_OUTSTANDING_R2T (0xff) 61#define ISCSI_MAX_VAL_MAX_OUTSTANDING_R2T (0xff)
70 62
63#define ISCSI_AHS_CNTL_SIZE 4
64
65#define ISCSI_WQE_NUM_SGES_SLOWIO (0xf)
66
71/* iSCSI reserved params */ 67/* iSCSI reserved params */
72#define ISCSI_ITT_ALL_ONES (0xffffffff) 68#define ISCSI_ITT_ALL_ONES (0xffffffff)
73#define ISCSI_TTT_ALL_ONES (0xffffffff) 69#define ISCSI_TTT_ALL_ONES (0xffffffff)
@@ -173,19 +169,6 @@ struct iscsi_async_msg_hdr {
173 __le32 reserved7; 169 __le32 reserved7;
174}; 170};
175 171
176struct iscsi_sge {
177 struct regpair sge_addr;
178 __le16 sge_len;
179 __le16 reserved0;
180 __le32 reserved1;
181};
182
183struct iscsi_cached_sge_ctx {
184 struct iscsi_sge sge;
185 struct regpair reserved;
186 __le32 dsgl_curr_offset[2];
187};
188
189struct iscsi_cmd_hdr { 172struct iscsi_cmd_hdr {
190 __le16 reserved1; 173 __le16 reserved1;
191 u8 flags_attr; 174 u8 flags_attr;
@@ -229,8 +212,13 @@ struct iscsi_common_hdr {
229#define ISCSI_COMMON_HDR_DATA_SEG_LEN_SHIFT 0 212#define ISCSI_COMMON_HDR_DATA_SEG_LEN_SHIFT 0
230#define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_MASK 0xFF 213#define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_MASK 0xFF
231#define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_SHIFT 24 214#define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_SHIFT 24
232 __le32 lun_reserved[4]; 215 struct regpair lun_reserved;
233 __le32 data[6]; 216 __le32 itt;
217 __le32 ttt;
218 __le32 cmdstat_sn;
219 __le32 exp_statcmd_sn;
220 __le32 max_cmd_sn;
221 __le32 data[3];
234}; 222};
235 223
236struct iscsi_conn_offload_params { 224struct iscsi_conn_offload_params {
@@ -246,8 +234,10 @@ struct iscsi_conn_offload_params {
246#define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_SHIFT 0 234#define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_SHIFT 0
247#define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_MASK 0x1 235#define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_MASK 0x1
248#define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_SHIFT 1 236#define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_SHIFT 1
249#define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_MASK 0x3F 237#define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_MASK 0x1
250#define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_SHIFT 2 238#define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_SHIFT 2
239#define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_MASK 0x1F
240#define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_SHIFT 3
251 u8 pbl_page_size_log; 241 u8 pbl_page_size_log;
252 u8 pbe_page_size_log; 242 u8 pbe_page_size_log;
253 u8 default_cq; 243 u8 default_cq;
@@ -278,8 +268,12 @@ struct iscsi_conn_update_ramrod_params {
278#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_SHIFT 2 268#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_SHIFT 2
279#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_MASK 0x1 269#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_MASK 0x1
280#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_SHIFT 3 270#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_SHIFT 3
281#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_RESERVED1_MASK 0xF 271#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_MASK 0x1
282#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_RESERVED1_SHIFT 4 272#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_SHIFT 4
273#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_MASK 0x1
274#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_SHIFT 5
275#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_RESERVED1_MASK 0x3
276#define ISCSI_CONN_UPDATE_RAMROD_PARAMS_RESERVED1_SHIFT 6
283 u8 reserved0[3]; 277 u8 reserved0[3];
284 __le32 max_seq_size; 278 __le32 max_seq_size;
285 __le32 max_send_pdu_length; 279 __le32 max_send_pdu_length;
@@ -312,7 +306,7 @@ struct iscsi_ext_cdb_cmd_hdr {
312 __le32 expected_transfer_length; 306 __le32 expected_transfer_length;
313 __le32 cmd_sn; 307 __le32 cmd_sn;
314 __le32 exp_stat_sn; 308 __le32 exp_stat_sn;
315 struct iscsi_sge cdb_sge; 309 struct scsi_sge cdb_sge;
316}; 310};
317 311
318struct iscsi_login_req_hdr { 312struct iscsi_login_req_hdr {
@@ -519,8 +513,8 @@ struct iscsi_logout_response_hdr {
519 __le32 exp_cmd_sn; 513 __le32 exp_cmd_sn;
520 __le32 max_cmd_sn; 514 __le32 max_cmd_sn;
521 __le32 reserved4; 515 __le32 reserved4;
522 __le16 time2retain; 516 __le16 time_2_retain;
523 __le16 time2wait; 517 __le16 time_2_wait;
524 __le32 reserved5[1]; 518 __le32 reserved5[1];
525}; 519};
526 520
@@ -602,7 +596,7 @@ struct iscsi_tmf_response_hdr {
602#define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 596#define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24
603 struct regpair reserved0; 597 struct regpair reserved0;
604 __le32 itt; 598 __le32 itt;
605 __le32 rtt; 599 __le32 reserved1;
606 __le32 stat_sn; 600 __le32 stat_sn;
607 __le32 exp_cmd_sn; 601 __le32 exp_cmd_sn;
608 __le32 max_cmd_sn; 602 __le32 max_cmd_sn;
@@ -641,7 +635,7 @@ struct iscsi_reject_hdr {
641#define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_MASK 0xFF 635#define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_MASK 0xFF
642#define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_SHIFT 24 636#define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_SHIFT 24
643 struct regpair reserved0; 637 struct regpair reserved0;
644 __le32 reserved1; 638 __le32 all_ones;
645 __le32 reserved2; 639 __le32 reserved2;
646 __le32 stat_sn; 640 __le32 stat_sn;
647 __le32 exp_cmd_sn; 641 __le32 exp_cmd_sn;
@@ -688,7 +682,9 @@ struct iscsi_cqe_solicited {
688 __le16 itid; 682 __le16 itid;
689 u8 task_type; 683 u8 task_type;
690 u8 fw_dbg_field; 684 u8 fw_dbg_field;
691 __le32 reserved1[2]; 685 u8 caused_conn_err;
686 u8 reserved0[3];
687 __le32 reserved1[1];
692 union iscsi_task_hdr iscsi_hdr; 688 union iscsi_task_hdr iscsi_hdr;
693}; 689};
694 690
@@ -727,35 +723,6 @@ enum iscsi_cqe_unsolicited_type {
727 MAX_ISCSI_CQE_UNSOLICITED_TYPE 723 MAX_ISCSI_CQE_UNSOLICITED_TYPE
728}; 724};
729 725
730struct iscsi_virt_sgl_ctx {
731 struct regpair sgl_base;
732 struct regpair dsgl_base;
733 __le32 sgl_initial_offset;
734 __le32 dsgl_initial_offset;
735 __le32 dsgl_curr_offset[2];
736};
737
738struct iscsi_sgl_var_params {
739 u8 sgl_ptr;
740 u8 dsgl_ptr;
741 __le16 sge_offset;
742 __le16 dsge_offset;
743};
744
745struct iscsi_phys_sgl_ctx {
746 struct regpair sgl_base;
747 struct regpair dsgl_base;
748 u8 sgl_size;
749 u8 dsgl_size;
750 __le16 reserved;
751 struct iscsi_sgl_var_params var_params[2];
752};
753
754union iscsi_data_desc_ctx {
755 struct iscsi_virt_sgl_ctx virt_sgl;
756 struct iscsi_phys_sgl_ctx phys_sgl;
757 struct iscsi_cached_sge_ctx cached_sge;
758};
759 726
760struct iscsi_debug_modes { 727struct iscsi_debug_modes {
761 u8 flags; 728 u8 flags;
@@ -771,8 +738,10 @@ struct iscsi_debug_modes {
771#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_SHIFT 4 738#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_SHIFT 4
772#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_MASK 0x1 739#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_MASK 0x1
773#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_SHIFT 5 740#define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_SHIFT 5
774#define ISCSI_DEBUG_MODES_RESERVED0_MASK 0x3 741#define ISCSI_DEBUG_MODES_ASSERT_IF_DATA_DIGEST_ERROR_MASK 0x1
775#define ISCSI_DEBUG_MODES_RESERVED0_SHIFT 6 742#define ISCSI_DEBUG_MODES_ASSERT_IF_DATA_DIGEST_ERROR_SHIFT 6
743#define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_ERROR_MASK 0x1
744#define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_ERROR_SHIFT 7
776}; 745};
777 746
778struct iscsi_dif_flags { 747struct iscsi_dif_flags {
@@ -806,7 +775,6 @@ enum iscsi_eqe_opcode {
806 ISCSI_EVENT_TYPE_ASYN_FIN_WAIT2, 775 ISCSI_EVENT_TYPE_ASYN_FIN_WAIT2,
807 ISCSI_EVENT_TYPE_ISCSI_CONN_ERROR, 776 ISCSI_EVENT_TYPE_ISCSI_CONN_ERROR,
808 ISCSI_EVENT_TYPE_TCP_CONN_ERROR, 777 ISCSI_EVENT_TYPE_TCP_CONN_ERROR,
809 ISCSI_EVENT_TYPE_ASYN_DELETE_OOO_ISLES,
810 MAX_ISCSI_EQE_OPCODE 778 MAX_ISCSI_EQE_OPCODE
811}; 779};
812 780
@@ -856,31 +824,11 @@ enum iscsi_error_types {
856 ISCSI_CONN_ERROR_PROTOCOL_ERR_DIF_TX, 824 ISCSI_CONN_ERROR_PROTOCOL_ERR_DIF_TX,
857 ISCSI_CONN_ERROR_SENSE_DATA_LENGTH, 825 ISCSI_CONN_ERROR_SENSE_DATA_LENGTH,
858 ISCSI_CONN_ERROR_DATA_PLACEMENT_ERROR, 826 ISCSI_CONN_ERROR_DATA_PLACEMENT_ERROR,
827 ISCSI_CONN_ERROR_INVALID_ITT,
859 ISCSI_ERROR_UNKNOWN, 828 ISCSI_ERROR_UNKNOWN,
860 MAX_ISCSI_ERROR_TYPES 829 MAX_ISCSI_ERROR_TYPES
861}; 830};
862 831
863struct iscsi_mflags {
864 u8 mflags;
865#define ISCSI_MFLAGS_SLOW_IO_MASK 0x1
866#define ISCSI_MFLAGS_SLOW_IO_SHIFT 0
867#define ISCSI_MFLAGS_SINGLE_SGE_MASK 0x1
868#define ISCSI_MFLAGS_SINGLE_SGE_SHIFT 1
869#define ISCSI_MFLAGS_RESERVED_MASK 0x3F
870#define ISCSI_MFLAGS_RESERVED_SHIFT 2
871};
872
873struct iscsi_sgl {
874 struct regpair sgl_addr;
875 __le16 updated_sge_size;
876 __le16 updated_sge_offset;
877 __le32 byte_offset;
878};
879
880union iscsi_mstorm_sgl {
881 struct iscsi_sgl sgl_struct;
882 struct iscsi_sge single_sge;
883};
884 832
885enum iscsi_ramrod_cmd_id { 833enum iscsi_ramrod_cmd_id {
886 ISCSI_RAMROD_CMD_ID_UNUSED = 0, 834 ISCSI_RAMROD_CMD_ID_UNUSED = 0,
@@ -896,10 +844,10 @@ enum iscsi_ramrod_cmd_id {
896 844
897struct iscsi_reg1 { 845struct iscsi_reg1 {
898 __le32 reg1_map; 846 __le32 reg1_map;
899#define ISCSI_REG1_NUM_FAST_SGES_MASK 0x7 847#define ISCSI_REG1_NUM_SGES_MASK 0xF
900#define ISCSI_REG1_NUM_FAST_SGES_SHIFT 0 848#define ISCSI_REG1_NUM_SGES_SHIFT 0
901#define ISCSI_REG1_RESERVED1_MASK 0x1FFFFFFF 849#define ISCSI_REG1_RESERVED1_MASK 0xFFFFFFF
902#define ISCSI_REG1_RESERVED1_SHIFT 3 850#define ISCSI_REG1_RESERVED1_SHIFT 4
903}; 851};
904 852
905union iscsi_seq_num { 853union iscsi_seq_num {
@@ -967,22 +915,33 @@ struct iscsi_spe_func_init {
967}; 915};
968 916
969struct ystorm_iscsi_task_state { 917struct ystorm_iscsi_task_state {
970 union iscsi_data_desc_ctx sgl_ctx_union; 918 struct scsi_cached_sges data_desc;
971 __le32 buffer_offset[2]; 919 struct scsi_sgl_params sgl_params;
972 __le16 bytes_nxt_dif;
973 __le16 rxmit_bytes_nxt_dif;
974 union iscsi_seq_num seq_num_union;
975 u8 dif_bytes_leftover;
976 u8 rxmit_dif_bytes_leftover;
977 __le16 reuse_count;
978 struct iscsi_dif_flags dif_flags;
979 u8 local_comp;
980 __le32 exp_r2t_sn; 920 __le32 exp_r2t_sn;
981 __le32 sgl_offset[2]; 921 __le32 buffer_offset;
922 union iscsi_seq_num seq_num;
923 struct iscsi_dif_flags dif_flags;
924 u8 flags;
925#define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_MASK 0x1
926#define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_SHIFT 0
927#define YSTORM_ISCSI_TASK_STATE_SLOW_IO_MASK 0x1
928#define YSTORM_ISCSI_TASK_STATE_SLOW_IO_SHIFT 1
929#define YSTORM_ISCSI_TASK_STATE_RESERVED0_MASK 0x3F
930#define YSTORM_ISCSI_TASK_STATE_RESERVED0_SHIFT 2
931};
932
933struct ystorm_iscsi_task_rxmit_opt {
934 __le32 fast_rxmit_sge_offset;
935 __le32 scan_start_buffer_offset;
936 __le32 fast_rxmit_buffer_offset;
937 u8 scan_start_sgl_index;
938 u8 fast_rxmit_sgl_index;
939 __le16 reserved;
982}; 940};
983 941
984struct ystorm_iscsi_task_st_ctx { 942struct ystorm_iscsi_task_st_ctx {
985 struct ystorm_iscsi_task_state state; 943 struct ystorm_iscsi_task_state state;
944 struct ystorm_iscsi_task_rxmit_opt rxmit_opt;
986 union iscsi_task_hdr pdu_hdr; 945 union iscsi_task_hdr pdu_hdr;
987}; 946};
988 947
@@ -1152,25 +1111,16 @@ struct ustorm_iscsi_task_ag_ctx {
1152}; 1111};
1153 1112
1154struct mstorm_iscsi_task_st_ctx { 1113struct mstorm_iscsi_task_st_ctx {
1155 union iscsi_mstorm_sgl sgl_union; 1114 struct scsi_cached_sges data_desc;
1156 struct iscsi_dif_flags dif_flags; 1115 struct scsi_sgl_params sgl_params;
1157 struct iscsi_mflags flags; 1116 __le32 rem_task_size;
1158 u8 sgl_size; 1117 __le32 data_buffer_offset;
1159 u8 host_sge_index;
1160 __le16 dix_cur_sge_offset;
1161 __le16 dix_cur_sge_size;
1162 __le32 data_offset_rtid;
1163 u8 dif_offset;
1164 u8 dix_sgl_size;
1165 u8 dix_sge_index;
1166 u8 task_type; 1118 u8 task_type;
1119 struct iscsi_dif_flags dif_flags;
1120 u8 reserved0[2];
1167 struct regpair sense_db; 1121 struct regpair sense_db;
1168 struct regpair dix_sgl_cur_sge; 1122 __le32 expected_itt;
1169 __le32 rem_task_size; 1123 __le32 reserved1;
1170 __le16 reuse_count;
1171 __le16 dif_data_residue;
1172 u8 reserved0[4];
1173 __le32 reserved1[1];
1174}; 1124};
1175 1125
1176struct ustorm_iscsi_task_st_ctx { 1126struct ustorm_iscsi_task_st_ctx {
@@ -1184,7 +1134,7 @@ struct ustorm_iscsi_task_st_ctx {
1184#define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_SHIFT 0 1134#define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_SHIFT 0
1185#define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_MASK 0x7F 1135#define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_MASK 0x7F
1186#define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_SHIFT 1 1136#define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_SHIFT 1
1187 u8 reserved2; 1137 struct iscsi_dif_flags dif_flags;
1188 __le16 reserved3; 1138 __le16 reserved3;
1189 __le32 reserved4; 1139 __le32 reserved4;
1190 __le32 reserved5; 1140 __le32 reserved5;
@@ -1207,10 +1157,10 @@ struct ustorm_iscsi_task_st_ctx {
1207#define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_SHIFT 2 1157#define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_SHIFT 2
1208#define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_MASK 0x1 1158#define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_MASK 0x1
1209#define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_SHIFT 3 1159#define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_SHIFT 3
1210#define USTORM_ISCSI_TASK_ST_CTX_TOTALDATAACKED_DONE_MASK 0x1 1160#define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_MASK 0x1
1211#define USTORM_ISCSI_TASK_ST_CTX_TOTALDATAACKED_DONE_SHIFT 4 1161#define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_SHIFT 4
1212#define USTORM_ISCSI_TASK_ST_CTX_HQSCANNED_DONE_MASK 0x1 1162#define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_MASK 0x1
1213#define USTORM_ISCSI_TASK_ST_CTX_HQSCANNED_DONE_SHIFT 5 1163#define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_SHIFT 5
1214#define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_MASK 0x1 1164#define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_MASK 0x1
1215#define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_SHIFT 6 1165#define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_SHIFT 6
1216#define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_MASK 0x1 1166#define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_MASK 0x1
@@ -1220,7 +1170,6 @@ struct ustorm_iscsi_task_st_ctx {
1220 1170
1221struct iscsi_task_context { 1171struct iscsi_task_context {
1222 struct ystorm_iscsi_task_st_ctx ystorm_st_context; 1172 struct ystorm_iscsi_task_st_ctx ystorm_st_context;
1223 struct regpair ystorm_st_padding[2];
1224 struct ystorm_iscsi_task_ag_ctx ystorm_ag_context; 1173 struct ystorm_iscsi_task_ag_ctx ystorm_ag_context;
1225 struct regpair ystorm_ag_padding[2]; 1174 struct regpair ystorm_ag_padding[2];
1226 struct tdif_task_context tdif_context; 1175 struct tdif_task_context tdif_context;
@@ -1272,32 +1221,22 @@ struct iscsi_uhqe {
1272#define ISCSI_UHQE_TASK_ID_LO_SHIFT 24 1221#define ISCSI_UHQE_TASK_ID_LO_SHIFT 24
1273}; 1222};
1274 1223
1275struct iscsi_wqe_field {
1276 __le32 contlen_cdbsize_field;
1277#define ISCSI_WQE_FIELD_CONT_LEN_MASK 0xFFFFFF
1278#define ISCSI_WQE_FIELD_CONT_LEN_SHIFT 0
1279#define ISCSI_WQE_FIELD_CDB_SIZE_MASK 0xFF
1280#define ISCSI_WQE_FIELD_CDB_SIZE_SHIFT 24
1281};
1282
1283union iscsi_wqe_field_union {
1284 struct iscsi_wqe_field cont_field;
1285 __le32 prev_tid;
1286};
1287 1224
1288struct iscsi_wqe { 1225struct iscsi_wqe {
1289 __le16 task_id; 1226 __le16 task_id;
1290 u8 flags; 1227 u8 flags;
1291#define ISCSI_WQE_WQE_TYPE_MASK 0x7 1228#define ISCSI_WQE_WQE_TYPE_MASK 0x7
1292#define ISCSI_WQE_WQE_TYPE_SHIFT 0 1229#define ISCSI_WQE_WQE_TYPE_SHIFT 0
1293#define ISCSI_WQE_NUM_FAST_SGES_MASK 0x7 1230#define ISCSI_WQE_NUM_SGES_MASK 0xF
1294#define ISCSI_WQE_NUM_FAST_SGES_SHIFT 3 1231#define ISCSI_WQE_NUM_SGES_SHIFT 3
1295#define ISCSI_WQE_PTU_INVALIDATE_MASK 0x1
1296#define ISCSI_WQE_PTU_INVALIDATE_SHIFT 6
1297#define ISCSI_WQE_RESPONSE_MASK 0x1 1232#define ISCSI_WQE_RESPONSE_MASK 0x1
1298#define ISCSI_WQE_RESPONSE_SHIFT 7 1233#define ISCSI_WQE_RESPONSE_SHIFT 7
1299 struct iscsi_dif_flags prot_flags; 1234 struct iscsi_dif_flags prot_flags;
1300 union iscsi_wqe_field_union cont_prevtid_union; 1235 __le32 contlen_cdbsize;
1236#define ISCSI_WQE_CONT_LEN_MASK 0xFFFFFF
1237#define ISCSI_WQE_CONT_LEN_SHIFT 0
1238#define ISCSI_WQE_CDB_SIZE_MASK 0xFF
1239#define ISCSI_WQE_CDB_SIZE_SHIFT 24
1301}; 1240};
1302 1241
1303enum iscsi_wqe_type { 1242enum iscsi_wqe_type {
@@ -1318,17 +1257,15 @@ struct iscsi_xhqe {
1318 u8 total_ahs_length; 1257 u8 total_ahs_length;
1319 u8 opcode; 1258 u8 opcode;
1320 u8 flags; 1259 u8 flags;
1321#define ISCSI_XHQE_NUM_FAST_SGES_MASK 0x7 1260#define ISCSI_XHQE_FINAL_MASK 0x1
1322#define ISCSI_XHQE_NUM_FAST_SGES_SHIFT 0 1261#define ISCSI_XHQE_FINAL_SHIFT 0
1323#define ISCSI_XHQE_FINAL_MASK 0x1 1262#define ISCSI_XHQE_STATUS_BIT_MASK 0x1
1324#define ISCSI_XHQE_FINAL_SHIFT 3 1263#define ISCSI_XHQE_STATUS_BIT_SHIFT 1
1325#define ISCSI_XHQE_SUPER_IO_MASK 0x1 1264#define ISCSI_XHQE_NUM_SGES_MASK 0xF
1326#define ISCSI_XHQE_SUPER_IO_SHIFT 4 1265#define ISCSI_XHQE_NUM_SGES_SHIFT 2
1327#define ISCSI_XHQE_STATUS_BIT_MASK 0x1 1266#define ISCSI_XHQE_RESERVED0_MASK 0x3
1328#define ISCSI_XHQE_STATUS_BIT_SHIFT 5 1267#define ISCSI_XHQE_RESERVED0_SHIFT 6
1329#define ISCSI_XHQE_RESERVED_MASK 0x3 1268 union iscsi_seq_num seq_num;
1330#define ISCSI_XHQE_RESERVED_SHIFT 6
1331 union iscsi_seq_num seq_num_union;
1332 __le16 reserved1; 1269 __le16 reserved1;
1333}; 1270};
1334 1271
diff --git a/include/linux/qed/qed_eth_if.h b/include/linux/qed/qed_eth_if.h
index 4cd1f0ccfa36..d66d16a559e1 100644
--- a/include/linux/qed/qed_eth_if.h
+++ b/include/linux/qed/qed_eth_if.h
@@ -158,15 +158,27 @@ struct qed_tunn_params {
158struct qed_eth_cb_ops { 158struct qed_eth_cb_ops {
159 struct qed_common_cb_ops common; 159 struct qed_common_cb_ops common;
160 void (*force_mac) (void *dev, u8 *mac, bool forced); 160 void (*force_mac) (void *dev, u8 *mac, bool forced);
161 void (*ports_update)(void *dev, u16 vxlan_port, u16 geneve_port);
161}; 162};
162 163
163#define QED_MAX_PHC_DRIFT_PPB 291666666 164#define QED_MAX_PHC_DRIFT_PPB 291666666
164 165
165enum qed_ptp_filter_type { 166enum qed_ptp_filter_type {
166 QED_PTP_FILTER_L2, 167 QED_PTP_FILTER_NONE,
167 QED_PTP_FILTER_IPV4, 168 QED_PTP_FILTER_ALL,
168 QED_PTP_FILTER_IPV4_IPV6, 169 QED_PTP_FILTER_V1_L4_EVENT,
169 QED_PTP_FILTER_L2_IPV4_IPV6 170 QED_PTP_FILTER_V1_L4_GEN,
171 QED_PTP_FILTER_V2_L4_EVENT,
172 QED_PTP_FILTER_V2_L4_GEN,
173 QED_PTP_FILTER_V2_L2_EVENT,
174 QED_PTP_FILTER_V2_L2_GEN,
175 QED_PTP_FILTER_V2_EVENT,
176 QED_PTP_FILTER_V2_GEN
177};
178
179enum qed_ptp_hwtstamp_tx_type {
180 QED_PTP_HWTSTAMP_TX_OFF,
181 QED_PTP_HWTSTAMP_TX_ON,
170}; 182};
171 183
172#ifdef CONFIG_DCB 184#ifdef CONFIG_DCB
@@ -229,8 +241,8 @@ struct qed_eth_dcbnl_ops {
229#endif 241#endif
230 242
231struct qed_eth_ptp_ops { 243struct qed_eth_ptp_ops {
232 int (*hwtstamp_tx_on)(struct qed_dev *); 244 int (*cfg_filters)(struct qed_dev *, enum qed_ptp_filter_type,
233 int (*cfg_rx_filters)(struct qed_dev *, enum qed_ptp_filter_type); 245 enum qed_ptp_hwtstamp_tx_type);
234 int (*read_rx_ts)(struct qed_dev *, u64 *); 246 int (*read_rx_ts)(struct qed_dev *, u64 *);
235 int (*read_tx_ts)(struct qed_dev *, u64 *); 247 int (*read_tx_ts)(struct qed_dev *, u64 *);
236 int (*read_cc)(struct qed_dev *, u64 *); 248 int (*read_cc)(struct qed_dev *, u64 *);
@@ -301,6 +313,14 @@ struct qed_eth_ops {
301 313
302 int (*tunn_config)(struct qed_dev *cdev, 314 int (*tunn_config)(struct qed_dev *cdev,
303 struct qed_tunn_params *params); 315 struct qed_tunn_params *params);
316
317 int (*ntuple_filter_config)(struct qed_dev *cdev, void *cookie,
318 dma_addr_t mapping, u16 length,
319 u16 vport_id, u16 rx_queue_id,
320 bool add_filter);
321
322 int (*configure_arfs_searcher)(struct qed_dev *cdev,
323 bool en_searcher);
304}; 324};
305 325
306const struct qed_eth_ops *qed_get_eth_ops(void); 326const struct qed_eth_ops *qed_get_eth_ops(void);
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index fde56c436f71..c70ac13a97e6 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -144,6 +144,7 @@ struct qed_dcbx_operational_params {
144 bool enabled; 144 bool enabled;
145 bool ieee; 145 bool ieee;
146 bool cee; 146 bool cee;
147 bool local;
147 u32 err; 148 u32 err;
148}; 149};
149 150
@@ -178,6 +179,12 @@ struct qed_eth_pf_params {
178 * to update_pf_params routine invoked before slowpath start 179 * to update_pf_params routine invoked before slowpath start
179 */ 180 */
180 u16 num_cons; 181 u16 num_cons;
182
183 /* To enable arfs, previous to HW-init a positive number needs to be
184 * set [as filters require allocated searcher ILT memory].
185 * This will set the maximal number of configured steering-filters.
186 */
187 u32 num_arfs_filters;
181}; 188};
182 189
183struct qed_fcoe_pf_params { 190struct qed_fcoe_pf_params {
@@ -263,7 +270,6 @@ struct qed_rdma_pf_params {
263 * the doorbell BAR). 270 * the doorbell BAR).
264 */ 271 */
265 u32 min_dpis; /* number of requested DPIs */ 272 u32 min_dpis; /* number of requested DPIs */
266 u32 num_mrs; /* number of requested memory regions */
267 u32 num_qps; /* number of requested Queue Pairs */ 273 u32 num_qps; /* number of requested Queue Pairs */
268 u32 num_srqs; /* number of requested SRQ */ 274 u32 num_srqs; /* number of requested SRQ */
269 u8 roce_edpm_mode; /* see QED_ROCE_EDPM_MODE_ENABLE */ 275 u8 roce_edpm_mode; /* see QED_ROCE_EDPM_MODE_ENABLE */
@@ -300,6 +306,11 @@ struct qed_sb_info {
300 struct qed_dev *cdev; 306 struct qed_dev *cdev;
301}; 307};
302 308
309enum qed_dev_type {
310 QED_DEV_TYPE_BB,
311 QED_DEV_TYPE_AH,
312};
313
303struct qed_dev_info { 314struct qed_dev_info {
304 unsigned long pci_mem_start; 315 unsigned long pci_mem_start;
305 unsigned long pci_mem_end; 316 unsigned long pci_mem_end;
@@ -325,6 +336,13 @@ struct qed_dev_info {
325 u16 mtu; 336 u16 mtu;
326 337
327 bool wol_support; 338 bool wol_support;
339
340 enum qed_dev_type dev_type;
341
342 /* Output parameters for qede */
343 bool vxlan_enable;
344 bool gre_enable;
345 bool geneve_enable;
328}; 346};
329 347
330enum qed_sb_type { 348enum qed_sb_type {
@@ -421,6 +439,7 @@ struct qed_int_info {
421}; 439};
422 440
423struct qed_common_cb_ops { 441struct qed_common_cb_ops {
442 void (*arfs_filter_op)(void *dev, void *fltr, u8 fw_rc);
424 void (*link_update)(void *dev, 443 void (*link_update)(void *dev,
425 struct qed_link_output *link); 444 struct qed_link_output *link);
426 void (*dcbx_aen)(void *dev, struct qed_dcbx_get *get, u32 mib_type); 445 void (*dcbx_aen)(void *dev, struct qed_dcbx_get *get, u32 mib_type);
@@ -616,7 +635,7 @@ struct qed_common_ops {
616 * @return 0 on success, error otherwise. 635 * @return 0 on success, error otherwise.
617 */ 636 */
618 int (*set_coalesce)(struct qed_dev *cdev, u16 rx_coal, u16 tx_coal, 637 int (*set_coalesce)(struct qed_dev *cdev, u16 rx_coal, u16 tx_coal,
619 u8 qid, u16 sb_id); 638 u16 qid, u16 sb_id);
620 639
621/** 640/**
622 * @brief set_led - Configure LED mode 641 * @brief set_led - Configure LED mode
@@ -752,7 +771,7 @@ enum qed_mf_mode {
752 QED_MF_NPAR, 771 QED_MF_NPAR,
753}; 772};
754 773
755struct qed_eth_stats { 774struct qed_eth_stats_common {
756 u64 no_buff_discards; 775 u64 no_buff_discards;
757 u64 packet_too_big_discard; 776 u64 packet_too_big_discard;
758 u64 ttl0_discard; 777 u64 ttl0_discard;
@@ -784,11 +803,6 @@ struct qed_eth_stats {
784 u64 rx_256_to_511_byte_packets; 803 u64 rx_256_to_511_byte_packets;
785 u64 rx_512_to_1023_byte_packets; 804 u64 rx_512_to_1023_byte_packets;
786 u64 rx_1024_to_1518_byte_packets; 805 u64 rx_1024_to_1518_byte_packets;
787 u64 rx_1519_to_1522_byte_packets;
788 u64 rx_1519_to_2047_byte_packets;
789 u64 rx_2048_to_4095_byte_packets;
790 u64 rx_4096_to_9216_byte_packets;
791 u64 rx_9217_to_16383_byte_packets;
792 u64 rx_crc_errors; 806 u64 rx_crc_errors;
793 u64 rx_mac_crtl_frames; 807 u64 rx_mac_crtl_frames;
794 u64 rx_pause_frames; 808 u64 rx_pause_frames;
@@ -805,14 +819,8 @@ struct qed_eth_stats {
805 u64 tx_256_to_511_byte_packets; 819 u64 tx_256_to_511_byte_packets;
806 u64 tx_512_to_1023_byte_packets; 820 u64 tx_512_to_1023_byte_packets;
807 u64 tx_1024_to_1518_byte_packets; 821 u64 tx_1024_to_1518_byte_packets;
808 u64 tx_1519_to_2047_byte_packets;
809 u64 tx_2048_to_4095_byte_packets;
810 u64 tx_4096_to_9216_byte_packets;
811 u64 tx_9217_to_16383_byte_packets;
812 u64 tx_pause_frames; 822 u64 tx_pause_frames;
813 u64 tx_pfc_frames; 823 u64 tx_pfc_frames;
814 u64 tx_lpi_entry_count;
815 u64 tx_total_collisions;
816 u64 brb_truncates; 824 u64 brb_truncates;
817 u64 brb_discards; 825 u64 brb_discards;
818 u64 rx_mac_bytes; 826 u64 rx_mac_bytes;
@@ -827,6 +835,34 @@ struct qed_eth_stats {
827 u64 tx_mac_ctrl_frames; 835 u64 tx_mac_ctrl_frames;
828}; 836};
829 837
838struct qed_eth_stats_bb {
839 u64 rx_1519_to_1522_byte_packets;
840 u64 rx_1519_to_2047_byte_packets;
841 u64 rx_2048_to_4095_byte_packets;
842 u64 rx_4096_to_9216_byte_packets;
843 u64 rx_9217_to_16383_byte_packets;
844 u64 tx_1519_to_2047_byte_packets;
845 u64 tx_2048_to_4095_byte_packets;
846 u64 tx_4096_to_9216_byte_packets;
847 u64 tx_9217_to_16383_byte_packets;
848 u64 tx_lpi_entry_count;
849 u64 tx_total_collisions;
850};
851
852struct qed_eth_stats_ah {
853 u64 rx_1519_to_max_byte_packets;
854 u64 tx_1519_to_max_byte_packets;
855};
856
857struct qed_eth_stats {
858 struct qed_eth_stats_common common;
859
860 union {
861 struct qed_eth_stats_bb bb;
862 struct qed_eth_stats_ah ah;
863 };
864};
865
830#define QED_SB_IDX 0x0002 866#define QED_SB_IDX 0x0002
831 867
832#define RX_PI 0 868#define RX_PI 0
diff --git a/include/linux/qed/qed_iscsi_if.h b/include/linux/qed/qed_iscsi_if.h
index f70bb81b8b6a..3414649133d2 100644
--- a/include/linux/qed/qed_iscsi_if.h
+++ b/include/linux/qed/qed_iscsi_if.h
@@ -67,6 +67,8 @@ struct qed_dev_iscsi_info {
67 67
68 void __iomem *primary_dbq_rq_addr; 68 void __iomem *primary_dbq_rq_addr;
69 void __iomem *secondary_bdq_rq_addr; 69 void __iomem *secondary_bdq_rq_addr;
70
71 u8 num_cqs;
70}; 72};
71 73
72struct qed_iscsi_id_params { 74struct qed_iscsi_id_params {
diff --git a/include/linux/qed/qed_roce_if.h b/include/linux/qed/qed_roce_if.h
index f742d4312c9d..cbb2ff0ce4bc 100644
--- a/include/linux/qed/qed_roce_if.h
+++ b/include/linux/qed/qed_roce_if.h
@@ -240,6 +240,7 @@ struct qed_rdma_add_user_out_params {
240 u64 dpi_addr; 240 u64 dpi_addr;
241 u64 dpi_phys_addr; 241 u64 dpi_phys_addr;
242 u32 dpi_size; 242 u32 dpi_size;
243 u16 wid_count;
243}; 244};
244 245
245enum roce_mode { 246enum roce_mode {
@@ -533,6 +534,7 @@ enum qed_rdma_type {
533struct qed_dev_rdma_info { 534struct qed_dev_rdma_info {
534 struct qed_dev_info common; 535 struct qed_dev_info common;
535 enum qed_rdma_type rdma_type; 536 enum qed_rdma_type rdma_type;
537 u8 user_dpm_enabled;
536}; 538};
537 539
538struct qed_rdma_ops { 540struct qed_rdma_ops {
diff --git a/include/linux/qed/rdma_common.h b/include/linux/qed/rdma_common.h
index f773aa5e746f..72c770f9f666 100644
--- a/include/linux/qed/rdma_common.h
+++ b/include/linux/qed/rdma_common.h
@@ -52,7 +52,8 @@
52#define RDMA_MAX_PDS (64 * 1024) 52#define RDMA_MAX_PDS (64 * 1024)
53 53
54#define RDMA_NUM_STATISTIC_COUNTERS MAX_NUM_VPORTS 54#define RDMA_NUM_STATISTIC_COUNTERS MAX_NUM_VPORTS
55#define RDMA_NUM_STATISTIC_COUNTERS_BB MAX_NUM_VPORTS_BB 55#define RDMA_NUM_STATISTIC_COUNTERS_K2 MAX_NUM_VPORTS_K2
56#define RDMA_NUM_STATISTIC_COUNTERS_BB MAX_NUM_VPORTS_BB
56 57
57#define RDMA_TASK_TYPE (PROTOCOLID_ROCE) 58#define RDMA_TASK_TYPE (PROTOCOLID_ROCE)
58 59
diff --git a/include/linux/qed/roce_common.h b/include/linux/qed/roce_common.h
index bad02df213df..866f063026de 100644
--- a/include/linux/qed/roce_common.h
+++ b/include/linux/qed/roce_common.h
@@ -38,4 +38,21 @@
38 38
39#define ROCE_MAX_QPS (32 * 1024) 39#define ROCE_MAX_QPS (32 * 1024)
40 40
41enum roce_async_events_type {
42 ROCE_ASYNC_EVENT_NONE = 0,
43 ROCE_ASYNC_EVENT_COMM_EST = 1,
44 ROCE_ASYNC_EVENT_SQ_DRAINED,
45 ROCE_ASYNC_EVENT_SRQ_LIMIT,
46 ROCE_ASYNC_EVENT_LAST_WQE_REACHED,
47 ROCE_ASYNC_EVENT_CQ_ERR,
48 ROCE_ASYNC_EVENT_LOCAL_INVALID_REQUEST_ERR,
49 ROCE_ASYNC_EVENT_LOCAL_CATASTROPHIC_ERR,
50 ROCE_ASYNC_EVENT_LOCAL_ACCESS_ERR,
51 ROCE_ASYNC_EVENT_QP_CATASTROPHIC_ERR,
52 ROCE_ASYNC_EVENT_CQ_OVERFLOW_ERR,
53 ROCE_ASYNC_EVENT_SRQ_EMPTY,
54 ROCE_ASYNC_EVENT_DESTROY_QP_DONE,
55 MAX_ROCE_ASYNC_EVENTS_TYPE
56};
57
41#endif /* __ROCE_COMMON__ */ 58#endif /* __ROCE_COMMON__ */
diff --git a/include/linux/qed/storage_common.h b/include/linux/qed/storage_common.h
index 03f3e37ab059..08df82a096b6 100644
--- a/include/linux/qed/storage_common.h
+++ b/include/linux/qed/storage_common.h
@@ -40,6 +40,8 @@
40#define BDQ_ID_IMM_DATA (1) 40#define BDQ_ID_IMM_DATA (1)
41#define BDQ_NUM_IDS (2) 41#define BDQ_NUM_IDS (2)
42 42
43#define SCSI_NUM_SGES_SLOW_SGL_THR 8
44
43#define BDQ_MAX_EXTERNAL_RING_SIZE (1 << 15) 45#define BDQ_MAX_EXTERNAL_RING_SIZE (1 << 15)
44 46
45struct scsi_bd { 47struct scsi_bd {
@@ -52,6 +54,16 @@ struct scsi_bdq_ram_drv_data {
52 __le16 reserved0[3]; 54 __le16 reserved0[3];
53}; 55};
54 56
57struct scsi_sge {
58 struct regpair sge_addr;
59 __le32 sge_len;
60 __le32 reserved;
61};
62
63struct scsi_cached_sges {
64 struct scsi_sge sge[4];
65};
66
55struct scsi_drv_cmdq { 67struct scsi_drv_cmdq {
56 __le16 cmdq_cons; 68 __le16 cmdq_cons;
57 __le16 reserved0; 69 __le16 reserved0;
@@ -99,11 +111,19 @@ struct scsi_ram_per_bdq_resource_drv_data {
99 struct scsi_bdq_ram_drv_data drv_data_per_bdq_id[BDQ_NUM_IDS]; 111 struct scsi_bdq_ram_drv_data drv_data_per_bdq_id[BDQ_NUM_IDS];
100}; 112};
101 113
102struct scsi_sge { 114enum scsi_sgl_mode {
103 struct regpair sge_addr; 115 SCSI_TX_SLOW_SGL,
104 __le16 sge_len; 116 SCSI_FAST_SGL,
105 __le16 reserved0; 117 MAX_SCSI_SGL_MODE
106 __le32 reserved1; 118};
119
120struct scsi_sgl_params {
121 struct regpair sgl_addr;
122 __le32 sgl_total_length;
123 __le32 sge_offset;
124 __le16 sgl_num_sges;
125 u8 sgl_index;
126 u8 reserved;
107}; 127};
108 128
109struct scsi_terminate_extra_params { 129struct scsi_terminate_extra_params {
diff --git a/include/linux/qed/tcp_common.h b/include/linux/qed/tcp_common.h
index 46fe7856f1b2..a5e843268f0e 100644
--- a/include/linux/qed/tcp_common.h
+++ b/include/linux/qed/tcp_common.h
@@ -173,6 +173,7 @@ enum tcp_seg_placement_event {
173 TCP_EVENT_ADD_ISLE_RIGHT, 173 TCP_EVENT_ADD_ISLE_RIGHT,
174 TCP_EVENT_ADD_ISLE_LEFT, 174 TCP_EVENT_ADD_ISLE_LEFT,
175 TCP_EVENT_JOIN, 175 TCP_EVENT_JOIN,
176 TCP_EVENT_DELETE_ISLES,
176 TCP_EVENT_NOP, 177 TCP_EVENT_NOP,
177 MAX_TCP_SEG_PLACEMENT_EVENT 178 MAX_TCP_SEG_PLACEMENT_EVENT
178}; 179};
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 799a63d0e1a8..9c6f768b7d32 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -162,7 +162,6 @@ static inline bool sb_has_quota_active(struct super_block *sb, int type)
162 * Operations supported for diskquotas. 162 * Operations supported for diskquotas.
163 */ 163 */
164extern const struct dquot_operations dquot_operations; 164extern const struct dquot_operations dquot_operations;
165extern const struct quotactl_ops dquot_quotactl_ops;
166extern const struct quotactl_ops dquot_quotactl_sysfile_ops; 165extern const struct quotactl_ops dquot_quotactl_sysfile_ops;
167 166
168#else 167#else
diff --git a/include/linux/ras.h b/include/linux/ras.h
index 2aceeafd6fe5..ffb147185e8d 100644
--- a/include/linux/ras.h
+++ b/include/linux/ras.h
@@ -1,14 +1,25 @@
1#ifndef __RAS_H__ 1#ifndef __RAS_H__
2#define __RAS_H__ 2#define __RAS_H__
3 3
4#include <asm/errno.h>
5
4#ifdef CONFIG_DEBUG_FS 6#ifdef CONFIG_DEBUG_FS
5int ras_userspace_consumers(void); 7int ras_userspace_consumers(void);
6void ras_debugfs_init(void); 8void ras_debugfs_init(void);
7int ras_add_daemon_trace(void); 9int ras_add_daemon_trace(void);
8#else 10#else
9static inline int ras_userspace_consumers(void) { return 0; } 11static inline int ras_userspace_consumers(void) { return 0; }
10static inline void ras_debugfs_init(void) { return; } 12static inline void ras_debugfs_init(void) { }
11static inline int ras_add_daemon_trace(void) { return 0; } 13static inline int ras_add_daemon_trace(void) { return 0; }
12#endif 14#endif
13 15
16#ifdef CONFIG_RAS_CEC
17void __init cec_init(void);
18int __init parse_cec_param(char *str);
19int cec_add_elem(u64 pfn);
20#else
21static inline void __init cec_init(void) { }
22static inline int cec_add_elem(u64 pfn) { return -ENODEV; }
14#endif 23#endif
24
25#endif /* __RAS_H__ */
diff --git a/include/linux/rcu_node_tree.h b/include/linux/rcu_node_tree.h
new file mode 100644
index 000000000000..4b766b61e1a0
--- /dev/null
+++ b/include/linux/rcu_node_tree.h
@@ -0,0 +1,99 @@
1/*
2 * RCU node combining tree definitions. These are used to compute
3 * global attributes while avoiding common-case global contention. A key
4 * property that these computations rely on is a tournament-style approach
5 * where only one of the tasks contending a lower level in the tree need
6 * advance to the next higher level. If properly configured, this allows
7 * unlimited scalability while maintaining a constant level of contention
8 * on the root node.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, you can access it online at
22 * http://www.gnu.org/licenses/gpl-2.0.html.
23 *
24 * Copyright IBM Corporation, 2017
25 *
26 * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
27 */
28
29#ifndef __LINUX_RCU_NODE_TREE_H
30#define __LINUX_RCU_NODE_TREE_H
31
32/*
33 * Define shape of hierarchy based on NR_CPUS, CONFIG_RCU_FANOUT, and
34 * CONFIG_RCU_FANOUT_LEAF.
35 * In theory, it should be possible to add more levels straightforwardly.
36 * In practice, this did work well going from three levels to four.
37 * Of course, your mileage may vary.
38 */
39
40#ifdef CONFIG_RCU_FANOUT
41#define RCU_FANOUT CONFIG_RCU_FANOUT
42#else /* #ifdef CONFIG_RCU_FANOUT */
43# ifdef CONFIG_64BIT
44# define RCU_FANOUT 64
45# else
46# define RCU_FANOUT 32
47# endif
48#endif /* #else #ifdef CONFIG_RCU_FANOUT */
49
50#ifdef CONFIG_RCU_FANOUT_LEAF
51#define RCU_FANOUT_LEAF CONFIG_RCU_FANOUT_LEAF
52#else /* #ifdef CONFIG_RCU_FANOUT_LEAF */
53#define RCU_FANOUT_LEAF 16
54#endif /* #else #ifdef CONFIG_RCU_FANOUT_LEAF */
55
56#define RCU_FANOUT_1 (RCU_FANOUT_LEAF)
57#define RCU_FANOUT_2 (RCU_FANOUT_1 * RCU_FANOUT)
58#define RCU_FANOUT_3 (RCU_FANOUT_2 * RCU_FANOUT)
59#define RCU_FANOUT_4 (RCU_FANOUT_3 * RCU_FANOUT)
60
61#if NR_CPUS <= RCU_FANOUT_1
62# define RCU_NUM_LVLS 1
63# define NUM_RCU_LVL_0 1
64# define NUM_RCU_NODES NUM_RCU_LVL_0
65# define NUM_RCU_LVL_INIT { NUM_RCU_LVL_0 }
66# define RCU_NODE_NAME_INIT { "rcu_node_0" }
67# define RCU_FQS_NAME_INIT { "rcu_node_fqs_0" }
68#elif NR_CPUS <= RCU_FANOUT_2
69# define RCU_NUM_LVLS 2
70# define NUM_RCU_LVL_0 1
71# define NUM_RCU_LVL_1 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1)
72# define NUM_RCU_NODES (NUM_RCU_LVL_0 + NUM_RCU_LVL_1)
73# define NUM_RCU_LVL_INIT { NUM_RCU_LVL_0, NUM_RCU_LVL_1 }
74# define RCU_NODE_NAME_INIT { "rcu_node_0", "rcu_node_1" }
75# define RCU_FQS_NAME_INIT { "rcu_node_fqs_0", "rcu_node_fqs_1" }
76#elif NR_CPUS <= RCU_FANOUT_3
77# define RCU_NUM_LVLS 3
78# define NUM_RCU_LVL_0 1
79# define NUM_RCU_LVL_1 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_2)
80# define NUM_RCU_LVL_2 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1)
81# define NUM_RCU_NODES (NUM_RCU_LVL_0 + NUM_RCU_LVL_1 + NUM_RCU_LVL_2)
82# define NUM_RCU_LVL_INIT { NUM_RCU_LVL_0, NUM_RCU_LVL_1, NUM_RCU_LVL_2 }
83# define RCU_NODE_NAME_INIT { "rcu_node_0", "rcu_node_1", "rcu_node_2" }
84# define RCU_FQS_NAME_INIT { "rcu_node_fqs_0", "rcu_node_fqs_1", "rcu_node_fqs_2" }
85#elif NR_CPUS <= RCU_FANOUT_4
86# define RCU_NUM_LVLS 4
87# define NUM_RCU_LVL_0 1
88# define NUM_RCU_LVL_1 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_3)
89# define NUM_RCU_LVL_2 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_2)
90# define NUM_RCU_LVL_3 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1)
91# define NUM_RCU_NODES (NUM_RCU_LVL_0 + NUM_RCU_LVL_1 + NUM_RCU_LVL_2 + NUM_RCU_LVL_3)
92# define NUM_RCU_LVL_INIT { NUM_RCU_LVL_0, NUM_RCU_LVL_1, NUM_RCU_LVL_2, NUM_RCU_LVL_3 }
93# define RCU_NODE_NAME_INIT { "rcu_node_0", "rcu_node_1", "rcu_node_2", "rcu_node_3" }
94# define RCU_FQS_NAME_INIT { "rcu_node_fqs_0", "rcu_node_fqs_1", "rcu_node_fqs_2", "rcu_node_fqs_3" }
95#else
96# error "CONFIG_RCU_FANOUT insufficient for NR_CPUS"
97#endif /* #if (NR_CPUS) <= RCU_FANOUT_1 */
98
99#endif /* __LINUX_RCU_NODE_TREE_H */
diff --git a/include/linux/rcu_segcblist.h b/include/linux/rcu_segcblist.h
new file mode 100644
index 000000000000..ba4d2621d9ca
--- /dev/null
+++ b/include/linux/rcu_segcblist.h
@@ -0,0 +1,90 @@
1/*
2 * RCU segmented callback lists
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, you can access it online at
16 * http://www.gnu.org/licenses/gpl-2.0.html.
17 *
18 * Copyright IBM Corporation, 2017
19 *
20 * Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
21 */
22
23#ifndef __INCLUDE_LINUX_RCU_SEGCBLIST_H
24#define __INCLUDE_LINUX_RCU_SEGCBLIST_H
25
26/* Simple unsegmented callback lists. */
27struct rcu_cblist {
28 struct rcu_head *head;
29 struct rcu_head **tail;
30 long len;
31 long len_lazy;
32};
33
34#define RCU_CBLIST_INITIALIZER(n) { .head = NULL, .tail = &n.head }
35
36/* Complicated segmented callback lists. ;-) */
37
38/*
39 * Index values for segments in rcu_segcblist structure.
40 *
41 * The segments are as follows:
42 *
43 * [head, *tails[RCU_DONE_TAIL]):
44 * Callbacks whose grace period has elapsed, and thus can be invoked.
45 * [*tails[RCU_DONE_TAIL], *tails[RCU_WAIT_TAIL]):
46 * Callbacks waiting for the current GP from the current CPU's viewpoint.
47 * [*tails[RCU_WAIT_TAIL], *tails[RCU_NEXT_READY_TAIL]):
48 * Callbacks that arrived before the next GP started, again from
49 * the current CPU's viewpoint. These can be handled by the next GP.
50 * [*tails[RCU_NEXT_READY_TAIL], *tails[RCU_NEXT_TAIL]):
51 * Callbacks that might have arrived after the next GP started.
52 * There is some uncertainty as to when a given GP starts and
53 * ends, but a CPU knows the exact times if it is the one starting
54 * or ending the GP. Other CPUs know that the previous GP ends
55 * before the next one starts.
56 *
57 * Note that RCU_WAIT_TAIL cannot be empty unless RCU_NEXT_READY_TAIL is also
58 * empty.
59 *
60 * The ->gp_seq[] array contains the grace-period number at which the
61 * corresponding segment of callbacks will be ready to invoke. A given
62 * element of this array is meaningful only when the corresponding segment
63 * is non-empty, and it is never valid for RCU_DONE_TAIL (whose callbacks
64 * are already ready to invoke) or for RCU_NEXT_TAIL (whose callbacks have
65 * not yet been assigned a grace-period number).
66 */
67#define RCU_DONE_TAIL 0 /* Also RCU_WAIT head. */
68#define RCU_WAIT_TAIL 1 /* Also RCU_NEXT_READY head. */
69#define RCU_NEXT_READY_TAIL 2 /* Also RCU_NEXT head. */
70#define RCU_NEXT_TAIL 3
71#define RCU_CBLIST_NSEGS 4
72
73struct rcu_segcblist {
74 struct rcu_head *head;
75 struct rcu_head **tails[RCU_CBLIST_NSEGS];
76 unsigned long gp_seq[RCU_CBLIST_NSEGS];
77 long len;
78 long len_lazy;
79};
80
81#define RCU_SEGCBLIST_INITIALIZER(n) \
82{ \
83 .head = NULL, \
84 .tails[RCU_DONE_TAIL] = &n.head, \
85 .tails[RCU_WAIT_TAIL] = &n.head, \
86 .tails[RCU_NEXT_READY_TAIL] = &n.head, \
87 .tails[RCU_NEXT_TAIL] = &n.head, \
88}
89
90#endif /* __INCLUDE_LINUX_RCU_SEGCBLIST_H */
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 4f7a9561b8c4..b1fd8bf85fdc 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -509,7 +509,8 @@ static inline void hlist_add_tail_rcu(struct hlist_node *n,
509{ 509{
510 struct hlist_node *i, *last = NULL; 510 struct hlist_node *i, *last = NULL;
511 511
512 for (i = hlist_first_rcu(h); i; i = hlist_next_rcu(i)) 512 /* Note: write side code, so rcu accessors are not needed. */
513 for (i = h->first; i; i = i->next)
513 last = i; 514 last = i;
514 515
515 if (last) { 516 if (last) {
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index de88b33c0974..e1e5d002fdb9 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -97,6 +97,7 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
97 unsigned long secs, 97 unsigned long secs,
98 unsigned long c_old, 98 unsigned long c_old,
99 unsigned long c); 99 unsigned long c);
100bool rcu_irq_enter_disabled(void);
100#else 101#else
101static inline void rcutorture_get_gp_data(enum rcutorture_type test_type, 102static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
102 int *flags, 103 int *flags,
@@ -113,6 +114,10 @@ static inline void rcutorture_record_test_transition(void)
113static inline void rcutorture_record_progress(unsigned long vernum) 114static inline void rcutorture_record_progress(unsigned long vernum)
114{ 115{
115} 116}
117static inline bool rcu_irq_enter_disabled(void)
118{
119 return false;
120}
116#ifdef CONFIG_RCU_TRACE 121#ifdef CONFIG_RCU_TRACE
117void do_trace_rcu_torture_read(const char *rcutorturename, 122void do_trace_rcu_torture_read(const char *rcutorturename,
118 struct rcu_head *rhp, 123 struct rcu_head *rhp,
@@ -363,15 +368,20 @@ static inline void rcu_init_nohz(void)
363#ifdef CONFIG_TASKS_RCU 368#ifdef CONFIG_TASKS_RCU
364#define TASKS_RCU(x) x 369#define TASKS_RCU(x) x
365extern struct srcu_struct tasks_rcu_exit_srcu; 370extern struct srcu_struct tasks_rcu_exit_srcu;
366#define rcu_note_voluntary_context_switch(t) \ 371#define rcu_note_voluntary_context_switch_lite(t) \
367 do { \ 372 do { \
368 rcu_all_qs(); \
369 if (READ_ONCE((t)->rcu_tasks_holdout)) \ 373 if (READ_ONCE((t)->rcu_tasks_holdout)) \
370 WRITE_ONCE((t)->rcu_tasks_holdout, false); \ 374 WRITE_ONCE((t)->rcu_tasks_holdout, false); \
371 } while (0) 375 } while (0)
376#define rcu_note_voluntary_context_switch(t) \
377 do { \
378 rcu_all_qs(); \
379 rcu_note_voluntary_context_switch_lite(t); \
380 } while (0)
372#else /* #ifdef CONFIG_TASKS_RCU */ 381#else /* #ifdef CONFIG_TASKS_RCU */
373#define TASKS_RCU(x) do { } while (0) 382#define TASKS_RCU(x) do { } while (0)
374#define rcu_note_voluntary_context_switch(t) rcu_all_qs() 383#define rcu_note_voluntary_context_switch_lite(t) do { } while (0)
384#define rcu_note_voluntary_context_switch(t) rcu_all_qs()
375#endif /* #else #ifdef CONFIG_TASKS_RCU */ 385#endif /* #else #ifdef CONFIG_TASKS_RCU */
376 386
377/** 387/**
@@ -1127,11 +1137,11 @@ do { \
1127 * if the UNLOCK and LOCK are executed by the same CPU or if the 1137 * if the UNLOCK and LOCK are executed by the same CPU or if the
1128 * UNLOCK and LOCK operate on the same lock variable. 1138 * UNLOCK and LOCK operate on the same lock variable.
1129 */ 1139 */
1130#ifdef CONFIG_PPC 1140#ifdef CONFIG_ARCH_WEAK_RELEASE_ACQUIRE
1131#define smp_mb__after_unlock_lock() smp_mb() /* Full ordering for lock. */ 1141#define smp_mb__after_unlock_lock() smp_mb() /* Full ordering for lock. */
1132#else /* #ifdef CONFIG_PPC */ 1142#else /* #ifdef CONFIG_ARCH_WEAK_RELEASE_ACQUIRE */
1133#define smp_mb__after_unlock_lock() do { } while (0) 1143#define smp_mb__after_unlock_lock() do { } while (0)
1134#endif /* #else #ifdef CONFIG_PPC */ 1144#endif /* #else #ifdef CONFIG_ARCH_WEAK_RELEASE_ACQUIRE */
1135 1145
1136 1146
1137#endif /* __LINUX_RCUPDATE_H */ 1147#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index b452953e21c8..74d9c3a1feee 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -33,6 +33,11 @@ static inline int rcu_dynticks_snap(struct rcu_dynticks *rdtp)
33 return 0; 33 return 0;
34} 34}
35 35
36static inline bool rcu_eqs_special_set(int cpu)
37{
38 return false; /* Never flag non-existent other CPUs! */
39}
40
36static inline unsigned long get_state_synchronize_rcu(void) 41static inline unsigned long get_state_synchronize_rcu(void)
37{ 42{
38 return 0; 43 return 0;
@@ -87,10 +92,11 @@ static inline void kfree_call_rcu(struct rcu_head *head,
87 call_rcu(head, func); 92 call_rcu(head, func);
88} 93}
89 94
90static inline void rcu_note_context_switch(void) 95#define rcu_note_context_switch(preempt) \
91{ 96 do { \
92 rcu_sched_qs(); 97 rcu_sched_qs(); \
93} 98 rcu_note_voluntary_context_switch_lite(current); \
99 } while (0)
94 100
95/* 101/*
96 * Take advantage of the fact that there is only one CPU, which 102 * Take advantage of the fact that there is only one CPU, which
@@ -212,14 +218,14 @@ static inline void exit_rcu(void)
212{ 218{
213} 219}
214 220
215#ifdef CONFIG_DEBUG_LOCK_ALLOC 221#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SRCU)
216extern int rcu_scheduler_active __read_mostly; 222extern int rcu_scheduler_active __read_mostly;
217void rcu_scheduler_starting(void); 223void rcu_scheduler_starting(void);
218#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 224#else /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SRCU) */
219static inline void rcu_scheduler_starting(void) 225static inline void rcu_scheduler_starting(void)
220{ 226{
221} 227}
222#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 228#endif /* #else #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SRCU) */
223 229
224#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) 230#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE)
225 231
@@ -237,6 +243,10 @@ static inline bool rcu_is_watching(void)
237 243
238#endif /* #else defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */ 244#endif /* #else defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
239 245
246static inline void rcu_request_urgent_qs_task(struct task_struct *t)
247{
248}
249
240static inline void rcu_all_qs(void) 250static inline void rcu_all_qs(void)
241{ 251{
242 barrier(); /* Avoid RCU read-side critical sections leaking across. */ 252 barrier(); /* Avoid RCU read-side critical sections leaking across. */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 63a4e4cf40a5..0bacb6b2af69 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -30,7 +30,7 @@
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33void rcu_note_context_switch(void); 33void rcu_note_context_switch(bool preempt);
34int rcu_needs_cpu(u64 basem, u64 *nextevt); 34int rcu_needs_cpu(u64 basem, u64 *nextevt);
35void rcu_cpu_stall_reset(void); 35void rcu_cpu_stall_reset(void);
36 36
@@ -41,7 +41,7 @@ void rcu_cpu_stall_reset(void);
41 */ 41 */
42static inline void rcu_virt_note_context_switch(int cpu) 42static inline void rcu_virt_note_context_switch(int cpu)
43{ 43{
44 rcu_note_context_switch(); 44 rcu_note_context_switch(false);
45} 45}
46 46
47void synchronize_rcu_bh(void); 47void synchronize_rcu_bh(void);
@@ -108,6 +108,7 @@ void rcu_scheduler_starting(void);
108extern int rcu_scheduler_active __read_mostly; 108extern int rcu_scheduler_active __read_mostly;
109 109
110bool rcu_is_watching(void); 110bool rcu_is_watching(void);
111void rcu_request_urgent_qs_task(struct task_struct *t);
111 112
112void rcu_all_qs(void); 113void rcu_all_qs(void);
113 114
diff --git a/include/linux/refcount.h b/include/linux/refcount.h
index 0023fee4bbbc..b34aa649d204 100644
--- a/include/linux/refcount.h
+++ b/include/linux/refcount.h
@@ -6,17 +6,36 @@
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8 8
9/**
10 * refcount_t - variant of atomic_t specialized for reference counts
11 * @refs: atomic_t counter field
12 *
13 * The counter saturates at UINT_MAX and will not move once
14 * there. This avoids wrapping the counter and causing 'spurious'
15 * use-after-free bugs.
16 */
9typedef struct refcount_struct { 17typedef struct refcount_struct {
10 atomic_t refs; 18 atomic_t refs;
11} refcount_t; 19} refcount_t;
12 20
13#define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), } 21#define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), }
14 22
23/**
24 * refcount_set - set a refcount's value
25 * @r: the refcount
26 * @n: value to which the refcount will be set
27 */
15static inline void refcount_set(refcount_t *r, unsigned int n) 28static inline void refcount_set(refcount_t *r, unsigned int n)
16{ 29{
17 atomic_set(&r->refs, n); 30 atomic_set(&r->refs, n);
18} 31}
19 32
33/**
34 * refcount_read - get a refcount's value
35 * @r: the refcount
36 *
37 * Return: the refcount's value
38 */
20static inline unsigned int refcount_read(const refcount_t *r) 39static inline unsigned int refcount_read(const refcount_t *r)
21{ 40{
22 return atomic_read(&r->refs); 41 return atomic_read(&r->refs);
diff --git a/include/linux/regulator/arizona-ldo1.h b/include/linux/regulator/arizona-ldo1.h
new file mode 100644
index 000000000000..c685f1277c63
--- /dev/null
+++ b/include/linux/regulator/arizona-ldo1.h
@@ -0,0 +1,24 @@
1/*
2 * Platform data for Arizona LDO1 regulator
3 *
4 * Copyright 2017 Cirrus Logic
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
11#ifndef ARIZONA_LDO1_H
12#define ARIZONA_LDO1_H
13
14struct regulator_init_data;
15
16struct arizona_ldo1_pdata {
17 /** GPIO controlling LDOENA, if any */
18 int ldoena;
19
20 /** Regulator configuration for LDO1 */
21 const struct regulator_init_data *init_data;
22};
23
24#endif
diff --git a/include/linux/regulator/arizona-micsupp.h b/include/linux/regulator/arizona-micsupp.h
new file mode 100644
index 000000000000..616842619c00
--- /dev/null
+++ b/include/linux/regulator/arizona-micsupp.h
@@ -0,0 +1,21 @@
1/*
2 * Platform data for Arizona micsupp regulator
3 *
4 * Copyright 2017 Cirrus Logic
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
11#ifndef ARIZONA_MICSUPP_H
12#define ARIZONA_MICSUPP_H
13
14struct regulator_init_data;
15
16struct arizona_micsupp_pdata {
17 /** Regulator configuration for micsupp */
18 const struct regulator_init_data *init_data;
19};
20
21#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index ea0fffa5faeb..df176d7c2b87 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -119,6 +119,7 @@ struct regmap;
119#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200 119#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200
120#define REGULATOR_EVENT_PRE_DISABLE 0x400 120#define REGULATOR_EVENT_PRE_DISABLE 0x400
121#define REGULATOR_EVENT_ABORT_DISABLE 0x800 121#define REGULATOR_EVENT_ABORT_DISABLE 0x800
122#define REGULATOR_EVENT_ENABLE 0x1000
122 123
123/* 124/*
124 * Regulator errors that can be queried using regulator_get_error_flags 125 * Regulator errors that can be queried using regulator_get_error_flags
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index dac8e7b16bc6..94417b4226bd 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -292,6 +292,14 @@ enum regulator_type {
292 * set_active_discharge 292 * set_active_discharge
293 * @active_discharge_reg: Register for control when using regmap 293 * @active_discharge_reg: Register for control when using regmap
294 * set_active_discharge 294 * set_active_discharge
295 * @soft_start_reg: Register for control when using regmap set_soft_start
296 * @soft_start_mask: Mask for control when using regmap set_soft_start
297 * @soft_start_val_on: Enabling value for control when using regmap
298 * set_soft_start
299 * @pull_down_reg: Register for control when using regmap set_pull_down
300 * @pull_down_mask: Mask for control when using regmap set_pull_down
301 * @pull_down_val_on: Enabling value for control when using regmap
302 * set_pull_down
295 * 303 *
296 * @enable_time: Time taken for initial enable of regulator (in uS). 304 * @enable_time: Time taken for initial enable of regulator (in uS).
297 * @off_on_delay: guard time (in uS), before re-enabling a regulator 305 * @off_on_delay: guard time (in uS), before re-enabling a regulator
@@ -345,6 +353,12 @@ struct regulator_desc {
345 unsigned int active_discharge_off; 353 unsigned int active_discharge_off;
346 unsigned int active_discharge_mask; 354 unsigned int active_discharge_mask;
347 unsigned int active_discharge_reg; 355 unsigned int active_discharge_reg;
356 unsigned int soft_start_reg;
357 unsigned int soft_start_mask;
358 unsigned int soft_start_val_on;
359 unsigned int pull_down_reg;
360 unsigned int pull_down_mask;
361 unsigned int pull_down_val_on;
348 362
349 unsigned int enable_time; 363 unsigned int enable_time;
350 364
@@ -429,6 +443,8 @@ struct regulator_dev {
429 struct regulator_enable_gpio *ena_pin; 443 struct regulator_enable_gpio *ena_pin;
430 unsigned int ena_gpio_state:1; 444 unsigned int ena_gpio_state:1;
431 445
446 unsigned int is_switch:1;
447
432 /* time when this regulator was disabled last time */ 448 /* time when this regulator was disabled last time */
433 unsigned long last_off_jiffy; 449 unsigned long last_off_jiffy;
434}; 450};
@@ -476,6 +492,8 @@ int regulator_set_voltage_time_sel(struct regulator_dev *rdev,
476 unsigned int new_selector); 492 unsigned int new_selector);
477int regulator_set_bypass_regmap(struct regulator_dev *rdev, bool enable); 493int regulator_set_bypass_regmap(struct regulator_dev *rdev, bool enable);
478int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable); 494int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable);
495int regulator_set_soft_start_regmap(struct regulator_dev *rdev);
496int regulator_set_pull_down_regmap(struct regulator_dev *rdev);
479 497
480int regulator_set_active_discharge_regmap(struct regulator_dev *rdev, 498int regulator_set_active_discharge_regmap(struct regulator_dev *rdev,
481 bool enable); 499 bool enable);
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index c9f795e9a2ee..117699d1f7df 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -108,6 +108,8 @@ struct regulator_state {
108 * @initial_state: Suspend state to set by default. 108 * @initial_state: Suspend state to set by default.
109 * @initial_mode: Mode to set at startup. 109 * @initial_mode: Mode to set at startup.
110 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 110 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
111 * @settling_time: Time to settle down after voltage change when voltage
112 * change is non-linear (unit: microseconds).
111 * @active_discharge: Enable/disable active discharge. The enum 113 * @active_discharge: Enable/disable active discharge. The enum
112 * regulator_active_discharge values are used for 114 * regulator_active_discharge values are used for
113 * initialisation. 115 * initialisation.
@@ -149,6 +151,7 @@ struct regulation_constraints {
149 unsigned int initial_mode; 151 unsigned int initial_mode;
150 152
151 unsigned int ramp_delay; 153 unsigned int ramp_delay;
154 unsigned int settling_time;
152 unsigned int enable_time; 155 unsigned int enable_time;
153 156
154 unsigned int active_discharge; 157 unsigned int active_discharge;
diff --git a/include/linux/regulator/pfuze100.h b/include/linux/regulator/pfuze100.h
index 70c6c66c5bcf..e0ccf46f66cf 100644
--- a/include/linux/regulator/pfuze100.h
+++ b/include/linux/regulator/pfuze100.h
@@ -48,6 +48,7 @@
48#define PFUZE200_VGEN4 10 48#define PFUZE200_VGEN4 10
49#define PFUZE200_VGEN5 11 49#define PFUZE200_VGEN5 11
50#define PFUZE200_VGEN6 12 50#define PFUZE200_VGEN6 12
51#define PFUZE200_COIN 13
51 52
52#define PFUZE3000_SW1A 0 53#define PFUZE3000_SW1A 0
53#define PFUZE3000_SW1B 1 54#define PFUZE3000_SW1B 1
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
index 2b5a4679daea..156cfd330b66 100644
--- a/include/linux/reservation.h
+++ b/include/linux/reservation.h
@@ -167,6 +167,26 @@ reservation_object_lock(struct reservation_object *obj,
167} 167}
168 168
169/** 169/**
170 * reservation_object_trylock - trylock the reservation object
171 * @obj: the reservation object
172 *
173 * Tries to lock the reservation object for exclusive access and modification.
174 * Note, that the lock is only against other writers, readers will run
175 * concurrently with a writer under RCU. The seqlock is used to notify readers
176 * if they overlap with a writer.
177 *
178 * Also note that since no context is provided, no deadlock protection is
179 * possible.
180 *
181 * Returns true if the lock was acquired, false otherwise.
182 */
183static inline bool __must_check
184reservation_object_trylock(struct reservation_object *obj)
185{
186 return ww_mutex_trylock(&obj->lock);
187}
188
189/**
170 * reservation_object_unlock - unlock the reservation object 190 * reservation_object_unlock - unlock the reservation object
171 * @obj: the reservation object 191 * @obj: the reservation object
172 * 192 *
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 96fb139bdd08..13d8681210d5 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -15,6 +15,9 @@ int reset_control_status(struct reset_control *rstc);
15struct reset_control *__of_reset_control_get(struct device_node *node, 15struct reset_control *__of_reset_control_get(struct device_node *node,
16 const char *id, int index, bool shared, 16 const char *id, int index, bool shared,
17 bool optional); 17 bool optional);
18struct reset_control *__reset_control_get(struct device *dev, const char *id,
19 int index, bool shared,
20 bool optional);
18void reset_control_put(struct reset_control *rstc); 21void reset_control_put(struct reset_control *rstc);
19struct reset_control *__devm_reset_control_get(struct device *dev, 22struct reset_control *__devm_reset_control_get(struct device *dev,
20 const char *id, int index, bool shared, 23 const char *id, int index, bool shared,
@@ -72,6 +75,13 @@ static inline struct reset_control *__of_reset_control_get(
72 return optional ? NULL : ERR_PTR(-ENOTSUPP); 75 return optional ? NULL : ERR_PTR(-ENOTSUPP);
73} 76}
74 77
78static inline struct reset_control *__reset_control_get(
79 struct device *dev, const char *id,
80 int index, bool shared, bool optional)
81{
82 return optional ? NULL : ERR_PTR(-ENOTSUPP);
83}
84
75static inline struct reset_control *__devm_reset_control_get( 85static inline struct reset_control *__devm_reset_control_get(
76 struct device *dev, const char *id, 86 struct device *dev, const char *id,
77 int index, bool shared, bool optional) 87 int index, bool shared, bool optional)
@@ -102,8 +112,7 @@ __must_check reset_control_get_exclusive(struct device *dev, const char *id)
102#ifndef CONFIG_RESET_CONTROLLER 112#ifndef CONFIG_RESET_CONTROLLER
103 WARN_ON(1); 113 WARN_ON(1);
104#endif 114#endif
105 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false, 115 return __reset_control_get(dev, id, 0, false, false);
106 false);
107} 116}
108 117
109/** 118/**
@@ -131,22 +140,19 @@ __must_check reset_control_get_exclusive(struct device *dev, const char *id)
131static inline struct reset_control *reset_control_get_shared( 140static inline struct reset_control *reset_control_get_shared(
132 struct device *dev, const char *id) 141 struct device *dev, const char *id)
133{ 142{
134 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true, 143 return __reset_control_get(dev, id, 0, true, false);
135 false);
136} 144}
137 145
138static inline struct reset_control *reset_control_get_optional_exclusive( 146static inline struct reset_control *reset_control_get_optional_exclusive(
139 struct device *dev, const char *id) 147 struct device *dev, const char *id)
140{ 148{
141 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false, 149 return __reset_control_get(dev, id, 0, false, true);
142 true);
143} 150}
144 151
145static inline struct reset_control *reset_control_get_optional_shared( 152static inline struct reset_control *reset_control_get_optional_shared(
146 struct device *dev, const char *id) 153 struct device *dev, const char *id)
147{ 154{
148 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true, 155 return __reset_control_get(dev, id, 0, true, true);
149 true);
150} 156}
151 157
152/** 158/**
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 092292b6675e..7d56a7ea2b2e 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -49,6 +49,21 @@
49/* Base bits plus 1 bit for nulls marker */ 49/* Base bits plus 1 bit for nulls marker */
50#define RHT_HASH_RESERVED_SPACE (RHT_BASE_BITS + 1) 50#define RHT_HASH_RESERVED_SPACE (RHT_BASE_BITS + 1)
51 51
52/* Maximum chain length before rehash
53 *
54 * The maximum (not average) chain length grows with the size of the hash
55 * table, at a rate of (log N)/(log log N).
56 *
57 * The value of 16 is selected so that even if the hash table grew to
58 * 2^32 you would not expect the maximum chain length to exceed it
59 * unless we are under attack (or extremely unlucky).
60 *
61 * As this limit is only to detect attacks, we don't need to set it to a
62 * lower value as you'd need the chain length to vastly exceed 16 to have
63 * any real effect on the system.
64 */
65#define RHT_ELASTICITY 16u
66
52struct rhash_head { 67struct rhash_head {
53 struct rhash_head __rcu *next; 68 struct rhash_head __rcu *next;
54}; 69};
@@ -110,29 +125,25 @@ struct rhashtable;
110 * @key_len: Length of key 125 * @key_len: Length of key
111 * @key_offset: Offset of key in struct to be hashed 126 * @key_offset: Offset of key in struct to be hashed
112 * @head_offset: Offset of rhash_head in struct to be hashed 127 * @head_offset: Offset of rhash_head in struct to be hashed
113 * @insecure_max_entries: Maximum number of entries (may be exceeded)
114 * @max_size: Maximum size while expanding 128 * @max_size: Maximum size while expanding
115 * @min_size: Minimum size while shrinking 129 * @min_size: Minimum size while shrinking
116 * @nulls_base: Base value to generate nulls marker
117 * @insecure_elasticity: Set to true to disable chain length checks
118 * @automatic_shrinking: Enable automatic shrinking of tables
119 * @locks_mul: Number of bucket locks to allocate per cpu (default: 128) 130 * @locks_mul: Number of bucket locks to allocate per cpu (default: 128)
131 * @automatic_shrinking: Enable automatic shrinking of tables
132 * @nulls_base: Base value to generate nulls marker
120 * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash) 133 * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash)
121 * @obj_hashfn: Function to hash object 134 * @obj_hashfn: Function to hash object
122 * @obj_cmpfn: Function to compare key with object 135 * @obj_cmpfn: Function to compare key with object
123 */ 136 */
124struct rhashtable_params { 137struct rhashtable_params {
125 size_t nelem_hint; 138 u16 nelem_hint;
126 size_t key_len; 139 u16 key_len;
127 size_t key_offset; 140 u16 key_offset;
128 size_t head_offset; 141 u16 head_offset;
129 unsigned int insecure_max_entries;
130 unsigned int max_size; 142 unsigned int max_size;
131 unsigned int min_size; 143 u16 min_size;
132 u32 nulls_base;
133 bool insecure_elasticity;
134 bool automatic_shrinking; 144 bool automatic_shrinking;
135 size_t locks_mul; 145 u8 locks_mul;
146 u32 nulls_base;
136 rht_hashfn_t hashfn; 147 rht_hashfn_t hashfn;
137 rht_obj_hashfn_t obj_hashfn; 148 rht_obj_hashfn_t obj_hashfn;
138 rht_obj_cmpfn_t obj_cmpfn; 149 rht_obj_cmpfn_t obj_cmpfn;
@@ -143,8 +154,8 @@ struct rhashtable_params {
143 * @tbl: Bucket table 154 * @tbl: Bucket table
144 * @nelems: Number of elements in table 155 * @nelems: Number of elements in table
145 * @key_len: Key length for hashfn 156 * @key_len: Key length for hashfn
146 * @elasticity: Maximum chain length before rehash
147 * @p: Configuration parameters 157 * @p: Configuration parameters
158 * @max_elems: Maximum number of elements in table
148 * @rhlist: True if this is an rhltable 159 * @rhlist: True if this is an rhltable
149 * @run_work: Deferred worker to expand/shrink asynchronously 160 * @run_work: Deferred worker to expand/shrink asynchronously
150 * @mutex: Mutex to protect current/future table swapping 161 * @mutex: Mutex to protect current/future table swapping
@@ -154,8 +165,8 @@ struct rhashtable {
154 struct bucket_table __rcu *tbl; 165 struct bucket_table __rcu *tbl;
155 atomic_t nelems; 166 atomic_t nelems;
156 unsigned int key_len; 167 unsigned int key_len;
157 unsigned int elasticity;
158 struct rhashtable_params p; 168 struct rhashtable_params p;
169 unsigned int max_elems;
159 bool rhlist; 170 bool rhlist;
160 struct work_struct run_work; 171 struct work_struct run_work;
161 struct mutex mutex; 172 struct mutex mutex;
@@ -318,8 +329,7 @@ static inline bool rht_grow_above_100(const struct rhashtable *ht,
318static inline bool rht_grow_above_max(const struct rhashtable *ht, 329static inline bool rht_grow_above_max(const struct rhashtable *ht,
319 const struct bucket_table *tbl) 330 const struct bucket_table *tbl)
320{ 331{
321 return ht->p.insecure_max_entries && 332 return atomic_read(&ht->nelems) >= ht->max_elems;
322 atomic_read(&ht->nelems) >= ht->p.insecure_max_entries;
323} 333}
324 334
325/* The bucket lock is selected based on the hash and protects mutations 335/* The bucket lock is selected based on the hash and protects mutations
@@ -726,7 +736,7 @@ slow_path:
726 return rhashtable_insert_slow(ht, key, obj); 736 return rhashtable_insert_slow(ht, key, obj);
727 } 737 }
728 738
729 elasticity = ht->elasticity; 739 elasticity = RHT_ELASTICITY;
730 pprev = rht_bucket_insert(ht, tbl, hash); 740 pprev = rht_bucket_insert(ht, tbl, hash);
731 data = ERR_PTR(-ENOMEM); 741 data = ERR_PTR(-ENOMEM);
732 if (!pprev) 742 if (!pprev)
@@ -916,6 +926,28 @@ static inline int rhashtable_lookup_insert_fast(
916} 926}
917 927
918/** 928/**
929 * rhashtable_lookup_get_insert_fast - lookup and insert object into hash table
930 * @ht: hash table
931 * @obj: pointer to hash head inside object
932 * @params: hash table parameters
933 *
934 * Just like rhashtable_lookup_insert_fast(), but this function returns the
935 * object if it exists, NULL if it did not and the insertion was successful,
936 * and an ERR_PTR otherwise.
937 */
938static inline void *rhashtable_lookup_get_insert_fast(
939 struct rhashtable *ht, struct rhash_head *obj,
940 const struct rhashtable_params params)
941{
942 const char *key = rht_obj(ht, obj);
943
944 BUG_ON(ht->p.obj_hashfn);
945
946 return __rhashtable_insert_fast(ht, key + ht->p.key_offset, obj, params,
947 false);
948}
949
950/**
919 * rhashtable_lookup_insert_key - search and insert object to hash table 951 * rhashtable_lookup_insert_key - search and insert object to hash table
920 * with explicit key 952 * with explicit key
921 * @ht: hash table 953 * @ht: hash table
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index b6d4568795a7..ee9b461af095 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -185,7 +185,7 @@ size_t ring_buffer_page_len(void *page);
185 185
186 186
187void *ring_buffer_alloc_read_page(struct ring_buffer *buffer, int cpu); 187void *ring_buffer_alloc_read_page(struct ring_buffer *buffer, int cpu);
188void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); 188void ring_buffer_free_read_page(struct ring_buffer *buffer, int cpu, void *data);
189int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page, 189int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page,
190 size_t len, int cpu, int full); 190 size_t len, int cpu, int full);
191 191
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 8c89e902df3e..43ef2c30cb0f 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -83,19 +83,17 @@ struct anon_vma_chain {
83}; 83};
84 84
85enum ttu_flags { 85enum ttu_flags {
86 TTU_UNMAP = 1, /* unmap mode */ 86 TTU_MIGRATION = 0x1, /* migration mode */
87 TTU_MIGRATION = 2, /* migration mode */ 87 TTU_MUNLOCK = 0x2, /* munlock mode */
88 TTU_MUNLOCK = 4, /* munlock mode */ 88
89 TTU_LZFREE = 8, /* lazy free mode */ 89 TTU_SPLIT_HUGE_PMD = 0x4, /* split huge PMD if any */
90 TTU_SPLIT_HUGE_PMD = 16, /* split huge PMD if any */ 90 TTU_IGNORE_MLOCK = 0x8, /* ignore mlock */
91 91 TTU_IGNORE_ACCESS = 0x10, /* don't age */
92 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */ 92 TTU_IGNORE_HWPOISON = 0x20, /* corrupted page is recoverable */
93 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */ 93 TTU_BATCH_FLUSH = 0x40, /* Batch TLB flushes where possible
94 TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */
95 TTU_BATCH_FLUSH = (1 << 11), /* Batch TLB flushes where possible
96 * and caller guarantees they will 94 * and caller guarantees they will
97 * do a final flush if necessary */ 95 * do a final flush if necessary */
98 TTU_RMAP_LOCKED = (1 << 12) /* do not grab rmap lock: 96 TTU_RMAP_LOCKED = 0x80 /* do not grab rmap lock:
99 * caller holds it */ 97 * caller holds it */
100}; 98};
101 99
@@ -193,9 +191,7 @@ static inline void page_dup_rmap(struct page *page, bool compound)
193int page_referenced(struct page *, int is_locked, 191int page_referenced(struct page *, int is_locked,
194 struct mem_cgroup *memcg, unsigned long *vm_flags); 192 struct mem_cgroup *memcg, unsigned long *vm_flags);
195 193
196#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) 194bool try_to_unmap(struct page *, enum ttu_flags flags);
197
198int try_to_unmap(struct page *, enum ttu_flags flags);
199 195
200/* Avoid racy checks */ 196/* Avoid racy checks */
201#define PVMW_SYNC (1 << 0) 197#define PVMW_SYNC (1 << 0)
@@ -239,7 +235,7 @@ int page_mkclean(struct page *);
239 * called in munlock()/munmap() path to check for other vmas holding 235 * called in munlock()/munmap() path to check for other vmas holding
240 * the page mlocked. 236 * the page mlocked.
241 */ 237 */
242int try_to_munlock(struct page *); 238void try_to_munlock(struct page *);
243 239
244void remove_migration_ptes(struct page *old, struct page *new, bool locked); 240void remove_migration_ptes(struct page *old, struct page *new, bool locked);
245 241
@@ -261,15 +257,19 @@ int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
261 */ 257 */
262struct rmap_walk_control { 258struct rmap_walk_control {
263 void *arg; 259 void *arg;
264 int (*rmap_one)(struct page *page, struct vm_area_struct *vma, 260 /*
261 * Return false if page table scanning in rmap_walk should be stopped.
262 * Otherwise, return true.
263 */
264 bool (*rmap_one)(struct page *page, struct vm_area_struct *vma,
265 unsigned long addr, void *arg); 265 unsigned long addr, void *arg);
266 int (*done)(struct page *page); 266 int (*done)(struct page *page);
267 struct anon_vma *(*anon_lock)(struct page *page); 267 struct anon_vma *(*anon_lock)(struct page *page);
268 bool (*invalid_vma)(struct vm_area_struct *vma, void *arg); 268 bool (*invalid_vma)(struct vm_area_struct *vma, void *arg);
269}; 269};
270 270
271int rmap_walk(struct page *page, struct rmap_walk_control *rwc); 271void rmap_walk(struct page *page, struct rmap_walk_control *rwc);
272int rmap_walk_locked(struct page *page, struct rmap_walk_control *rwc); 272void rmap_walk_locked(struct page *page, struct rmap_walk_control *rwc);
273 273
274#else /* !CONFIG_MMU */ 274#else /* !CONFIG_MMU */
275 275
@@ -285,7 +285,7 @@ static inline int page_referenced(struct page *page, int is_locked,
285 return 0; 285 return 0;
286} 286}
287 287
288#define try_to_unmap(page, refs) SWAP_FAIL 288#define try_to_unmap(page, refs) false
289 289
290static inline int page_mkclean(struct page *page) 290static inline int page_mkclean(struct page *page)
291{ 291{
@@ -295,13 +295,4 @@ static inline int page_mkclean(struct page *page)
295 295
296#endif /* CONFIG_MMU */ 296#endif /* CONFIG_MMU */
297 297
298/*
299 * Return values of try_to_unmap
300 */
301#define SWAP_SUCCESS 0
302#define SWAP_AGAIN 1
303#define SWAP_FAIL 2
304#define SWAP_MLOCK 3
305#define SWAP_LZFREE 4
306
307#endif /* _LINUX_RMAP_H */ 298#endif /* _LINUX_RMAP_H */
diff --git a/include/linux/rodata_test.h b/include/linux/rodata_test.h
index ea05f6c51413..84766bcdd01f 100644
--- a/include/linux/rodata_test.h
+++ b/include/linux/rodata_test.h
@@ -14,7 +14,6 @@
14#define _RODATA_TEST_H 14#define _RODATA_TEST_H
15 15
16#ifdef CONFIG_DEBUG_RODATA_TEST 16#ifdef CONFIG_DEBUG_RODATA_TEST
17extern const int rodata_test_data;
18void rodata_test(void); 17void rodata_test(void);
19#else 18#else
20static inline void rodata_test(void) {} 19static inline void rodata_test(void) {}
diff --git a/include/linux/rpmsg/qcom_smd.h b/include/linux/rpmsg/qcom_smd.h
index 8ec8b6439b25..f27917e0a101 100644
--- a/include/linux/rpmsg/qcom_smd.h
+++ b/include/linux/rpmsg/qcom_smd.h
@@ -6,7 +6,7 @@
6 6
7struct qcom_smd_edge; 7struct qcom_smd_edge;
8 8
9#if IS_ENABLED(CONFIG_RPMSG_QCOM_SMD) || IS_ENABLED(CONFIG_QCOM_SMD) 9#if IS_ENABLED(CONFIG_RPMSG_QCOM_SMD)
10 10
11struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent, 11struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
12 struct device_node *node); 12 struct device_node *node);
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index d4e0a204c118..a1904aadbc45 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -176,6 +176,25 @@ void sbitmap_resize(struct sbitmap *sb, unsigned int depth);
176int sbitmap_get(struct sbitmap *sb, unsigned int alloc_hint, bool round_robin); 176int sbitmap_get(struct sbitmap *sb, unsigned int alloc_hint, bool round_robin);
177 177
178/** 178/**
179 * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap,
180 * limiting the depth used from each word.
181 * @sb: Bitmap to allocate from.
182 * @alloc_hint: Hint for where to start searching for a free bit.
183 * @shallow_depth: The maximum number of bits to allocate from a single word.
184 *
185 * This rather specific operation allows for having multiple users with
186 * different allocation limits. E.g., there can be a high-priority class that
187 * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow()
188 * with a @shallow_depth of (1 << (@sb->shift - 1)). Then, the low-priority
189 * class can only allocate half of the total bits in the bitmap, preventing it
190 * from starving out the high-priority class.
191 *
192 * Return: Non-negative allocated bit number if successful, -1 otherwise.
193 */
194int sbitmap_get_shallow(struct sbitmap *sb, unsigned int alloc_hint,
195 unsigned long shallow_depth);
196
197/**
179 * sbitmap_any_bit_set() - Check for a set bit in a &struct sbitmap. 198 * sbitmap_any_bit_set() - Check for a set bit in a &struct sbitmap.
180 * @sb: Bitmap to check. 199 * @sb: Bitmap to check.
181 * 200 *
@@ -326,6 +345,19 @@ void sbitmap_queue_resize(struct sbitmap_queue *sbq, unsigned int depth);
326int __sbitmap_queue_get(struct sbitmap_queue *sbq); 345int __sbitmap_queue_get(struct sbitmap_queue *sbq);
327 346
328/** 347/**
348 * __sbitmap_queue_get_shallow() - Try to allocate a free bit from a &struct
349 * sbitmap_queue, limiting the depth used from each word, with preemption
350 * already disabled.
351 * @sbq: Bitmap queue to allocate from.
352 * @shallow_depth: The maximum number of bits to allocate from a single word.
353 * See sbitmap_get_shallow().
354 *
355 * Return: Non-negative allocated bit number if successful, -1 otherwise.
356 */
357int __sbitmap_queue_get_shallow(struct sbitmap_queue *sbq,
358 unsigned int shallow_depth);
359
360/**
329 * sbitmap_queue_get() - Try to allocate a free bit from a &struct 361 * sbitmap_queue_get() - Try to allocate a free bit from a &struct
330 * sbitmap_queue. 362 * sbitmap_queue.
331 * @sbq: Bitmap queue to allocate from. 363 * @sbq: Bitmap queue to allocate from.
@@ -346,6 +378,29 @@ static inline int sbitmap_queue_get(struct sbitmap_queue *sbq,
346} 378}
347 379
348/** 380/**
381 * sbitmap_queue_get_shallow() - Try to allocate a free bit from a &struct
382 * sbitmap_queue, limiting the depth used from each word.
383 * @sbq: Bitmap queue to allocate from.
384 * @cpu: Output parameter; will contain the CPU we ran on (e.g., to be passed to
385 * sbitmap_queue_clear()).
386 * @shallow_depth: The maximum number of bits to allocate from a single word.
387 * See sbitmap_get_shallow().
388 *
389 * Return: Non-negative allocated bit number if successful, -1 otherwise.
390 */
391static inline int sbitmap_queue_get_shallow(struct sbitmap_queue *sbq,
392 unsigned int *cpu,
393 unsigned int shallow_depth)
394{
395 int nr;
396
397 *cpu = get_cpu();
398 nr = __sbitmap_queue_get_shallow(sbq, shallow_depth);
399 put_cpu();
400 return nr;
401}
402
403/**
349 * sbitmap_queue_clear() - Free an allocated bit and wake up waiters on a 404 * sbitmap_queue_clear() - Free an allocated bit and wake up waiters on a
350 * &struct sbitmap_queue. 405 * &struct sbitmap_queue.
351 * @sbq: Bitmap to free from. 406 * @sbq: Bitmap to free from.
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d67eee84fd43..2b69fc650201 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -186,7 +186,7 @@ extern long io_schedule_timeout(long timeout);
186extern void io_schedule(void); 186extern void io_schedule(void);
187 187
188/** 188/**
189 * struct prev_cputime - snaphsot of system and user cputime 189 * struct prev_cputime - snapshot of system and user cputime
190 * @utime: time spent in user mode 190 * @utime: time spent in user mode
191 * @stime: time spent in system mode 191 * @stime: time spent in system mode
192 * @lock: protects the above two fields 192 * @lock: protects the above two fields
@@ -604,6 +604,10 @@ struct task_struct {
604#ifdef CONFIG_COMPAT_BRK 604#ifdef CONFIG_COMPAT_BRK
605 unsigned brk_randomized:1; 605 unsigned brk_randomized:1;
606#endif 606#endif
607#ifdef CONFIG_CGROUPS
608 /* disallow userland-initiated cgroup migration */
609 unsigned no_cgroup_migration:1;
610#endif
607 611
608 unsigned long atomic_flags; /* Flags requiring atomic access. */ 612 unsigned long atomic_flags; /* Flags requiring atomic access. */
609 613
@@ -775,6 +779,8 @@ struct task_struct {
775 /* PI waiters blocked on a rt_mutex held by this task: */ 779 /* PI waiters blocked on a rt_mutex held by this task: */
776 struct rb_root pi_waiters; 780 struct rb_root pi_waiters;
777 struct rb_node *pi_waiters_leftmost; 781 struct rb_node *pi_waiters_leftmost;
782 /* Updated under owner's pi_lock and rq lock */
783 struct task_struct *pi_top_task;
778 /* Deadlock detection and priority inheritance handling: */ 784 /* Deadlock detection and priority inheritance handling: */
779 struct rt_mutex_waiter *pi_blocked_on; 785 struct rt_mutex_waiter *pi_blocked_on;
780#endif 786#endif
@@ -1038,6 +1044,13 @@ struct task_struct {
1038 /* A live task holds one reference: */ 1044 /* A live task holds one reference: */
1039 atomic_t stack_refcount; 1045 atomic_t stack_refcount;
1040#endif 1046#endif
1047#ifdef CONFIG_LIVEPATCH
1048 int patch_state;
1049#endif
1050#ifdef CONFIG_SECURITY
1051 /* Used by LSM modules for access restriction: */
1052 void *security;
1053#endif
1041 /* CPU-specific state of this task: */ 1054 /* CPU-specific state of this task: */
1042 struct thread_struct thread; 1055 struct thread_struct thread;
1043 1056
@@ -1211,9 +1224,9 @@ extern struct pid *cad_pid;
1211#define PF_USED_ASYNC 0x00004000 /* Used async_schedule*(), used by module init */ 1224#define PF_USED_ASYNC 0x00004000 /* Used async_schedule*(), used by module init */
1212#define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */ 1225#define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */
1213#define PF_FROZEN 0x00010000 /* Frozen for system suspend */ 1226#define PF_FROZEN 0x00010000 /* Frozen for system suspend */
1214#define PF_FSTRANS 0x00020000 /* Inside a filesystem transaction */ 1227#define PF_KSWAPD 0x00020000 /* I am kswapd */
1215#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1228#define PF_MEMALLOC_NOFS 0x00040000 /* All allocation requests will inherit GFP_NOFS */
1216#define PF_MEMALLOC_NOIO 0x00080000 /* Allocating memory without IO involved */ 1229#define PF_MEMALLOC_NOIO 0x00080000 /* All allocation requests will inherit GFP_NOIO */
1217#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1230#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1218#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1231#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1219#define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */ 1232#define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */
@@ -1256,7 +1269,6 @@ extern struct pid *cad_pid;
1256#define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */ 1269#define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */
1257#define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */ 1270#define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */
1258#define PFA_SPREAD_SLAB 2 /* Spread some slab caches over cpuset */ 1271#define PFA_SPREAD_SLAB 2 /* Spread some slab caches over cpuset */
1259#define PFA_LMK_WAITING 3 /* Lowmemorykiller is waiting */
1260 1272
1261 1273
1262#define TASK_PFA_TEST(name, func) \ 1274#define TASK_PFA_TEST(name, func) \
@@ -1282,14 +1294,11 @@ TASK_PFA_TEST(SPREAD_SLAB, spread_slab)
1282TASK_PFA_SET(SPREAD_SLAB, spread_slab) 1294TASK_PFA_SET(SPREAD_SLAB, spread_slab)
1283TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab) 1295TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab)
1284 1296
1285TASK_PFA_TEST(LMK_WAITING, lmk_waiting)
1286TASK_PFA_SET(LMK_WAITING, lmk_waiting)
1287
1288static inline void 1297static inline void
1289tsk_restore_flags(struct task_struct *task, unsigned long orig_flags, unsigned long flags) 1298current_restore_flags(unsigned long orig_flags, unsigned long flags)
1290{ 1299{
1291 task->flags &= ~flags; 1300 current->flags &= ~flags;
1292 task->flags |= orig_flags & flags; 1301 current->flags |= orig_flags & flags;
1293} 1302}
1294 1303
1295extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial); 1304extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial);
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
index 830953ebb391..2b24a6974847 100644
--- a/include/linux/sched/mm.h
+++ b/include/linux/sched/mm.h
@@ -149,13 +149,21 @@ static inline bool in_vfork(struct task_struct *tsk)
149 return ret; 149 return ret;
150} 150}
151 151
152/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags 152/*
153 * __GFP_FS is also cleared as it implies __GFP_IO. 153 * Applies per-task gfp context to the given allocation flags.
154 * PF_MEMALLOC_NOIO implies GFP_NOIO
155 * PF_MEMALLOC_NOFS implies GFP_NOFS
154 */ 156 */
155static inline gfp_t memalloc_noio_flags(gfp_t flags) 157static inline gfp_t current_gfp_context(gfp_t flags)
156{ 158{
159 /*
160 * NOIO implies both NOIO and NOFS and it is a weaker context
161 * so always make sure it makes precendence
162 */
157 if (unlikely(current->flags & PF_MEMALLOC_NOIO)) 163 if (unlikely(current->flags & PF_MEMALLOC_NOIO))
158 flags &= ~(__GFP_IO | __GFP_FS); 164 flags &= ~(__GFP_IO | __GFP_FS);
165 else if (unlikely(current->flags & PF_MEMALLOC_NOFS))
166 flags &= ~__GFP_FS;
159 return flags; 167 return flags;
160} 168}
161 169
@@ -171,4 +179,28 @@ static inline void memalloc_noio_restore(unsigned int flags)
171 current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags; 179 current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags;
172} 180}
173 181
182static inline unsigned int memalloc_nofs_save(void)
183{
184 unsigned int flags = current->flags & PF_MEMALLOC_NOFS;
185 current->flags |= PF_MEMALLOC_NOFS;
186 return flags;
187}
188
189static inline void memalloc_nofs_restore(unsigned int flags)
190{
191 current->flags = (current->flags & ~PF_MEMALLOC_NOFS) | flags;
192}
193
194static inline unsigned int memalloc_noreclaim_save(void)
195{
196 unsigned int flags = current->flags & PF_MEMALLOC;
197 current->flags |= PF_MEMALLOC;
198 return flags;
199}
200
201static inline void memalloc_noreclaim_restore(unsigned int flags)
202{
203 current->flags = (current->flags & ~PF_MEMALLOC) | flags;
204}
205
174#endif /* _LINUX_SCHED_MM_H */ 206#endif /* _LINUX_SCHED_MM_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 3bd668414f61..f93329aba31a 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -18,27 +18,20 @@ static inline int rt_task(struct task_struct *p)
18} 18}
19 19
20#ifdef CONFIG_RT_MUTEXES 20#ifdef CONFIG_RT_MUTEXES
21extern int rt_mutex_getprio(struct task_struct *p); 21/*
22extern void rt_mutex_setprio(struct task_struct *p, int prio); 22 * Must hold either p->pi_lock or task_rq(p)->lock.
23extern int rt_mutex_get_effective_prio(struct task_struct *task, int newprio); 23 */
24extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task); 24static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *p)
25{
26 return p->pi_top_task;
27}
28extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task);
25extern void rt_mutex_adjust_pi(struct task_struct *p); 29extern void rt_mutex_adjust_pi(struct task_struct *p);
26static inline bool tsk_is_pi_blocked(struct task_struct *tsk) 30static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
27{ 31{
28 return tsk->pi_blocked_on != NULL; 32 return tsk->pi_blocked_on != NULL;
29} 33}
30#else 34#else
31static inline int rt_mutex_getprio(struct task_struct *p)
32{
33 return p->normal_prio;
34}
35
36static inline int rt_mutex_get_effective_prio(struct task_struct *task,
37 int newprio)
38{
39 return newprio;
40}
41
42static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task) 35static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
43{ 36{
44 return NULL; 37 return NULL;
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 2cf446704cd4..c06d63b3a583 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -293,7 +293,6 @@ extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *,
293 const struct cred *, u32); 293 const struct cred *, u32);
294extern int kill_pgrp(struct pid *pid, int sig, int priv); 294extern int kill_pgrp(struct pid *pid, int sig, int priv);
295extern int kill_pid(struct pid *pid, int sig, int priv); 295extern int kill_pid(struct pid *pid, int sig, int priv);
296extern int kill_proc_info(int, struct siginfo *, pid_t);
297extern __must_check bool do_notify_parent(struct task_struct *, int); 296extern __must_check bool do_notify_parent(struct task_struct *, int);
298extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); 297extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
299extern void force_sig(int, struct task_struct *); 298extern void force_sig(int, struct task_struct *);
diff --git a/include/linux/security.h b/include/linux/security.h
index 96899fad7016..af675b576645 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -133,6 +133,10 @@ extern unsigned long dac_mmap_min_addr;
133/* setfsuid or setfsgid, id0 == fsuid or fsgid */ 133/* setfsuid or setfsgid, id0 == fsuid or fsgid */
134#define LSM_SETID_FS 8 134#define LSM_SETID_FS 8
135 135
136/* Flags for security_task_prlimit(). */
137#define LSM_PRLIMIT_READ 1
138#define LSM_PRLIMIT_WRITE 2
139
136/* forward declares to avoid warnings */ 140/* forward declares to avoid warnings */
137struct sched_param; 141struct sched_param;
138struct request_sock; 142struct request_sock;
@@ -304,6 +308,7 @@ int security_file_send_sigiotask(struct task_struct *tsk,
304int security_file_receive(struct file *file); 308int security_file_receive(struct file *file);
305int security_file_open(struct file *file, const struct cred *cred); 309int security_file_open(struct file *file, const struct cred *cred);
306int security_task_create(unsigned long clone_flags); 310int security_task_create(unsigned long clone_flags);
311int security_task_alloc(struct task_struct *task, unsigned long clone_flags);
307void security_task_free(struct task_struct *task); 312void security_task_free(struct task_struct *task);
308int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 313int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
309void security_cred_free(struct cred *cred); 314void security_cred_free(struct cred *cred);
@@ -324,6 +329,8 @@ void security_task_getsecid(struct task_struct *p, u32 *secid);
324int security_task_setnice(struct task_struct *p, int nice); 329int security_task_setnice(struct task_struct *p, int nice);
325int security_task_setioprio(struct task_struct *p, int ioprio); 330int security_task_setioprio(struct task_struct *p, int ioprio);
326int security_task_getioprio(struct task_struct *p); 331int security_task_getioprio(struct task_struct *p);
332int security_task_prlimit(const struct cred *cred, const struct cred *tcred,
333 unsigned int flags);
327int security_task_setrlimit(struct task_struct *p, unsigned int resource, 334int security_task_setrlimit(struct task_struct *p, unsigned int resource,
328 struct rlimit *new_rlim); 335 struct rlimit *new_rlim);
329int security_task_setscheduler(struct task_struct *p); 336int security_task_setscheduler(struct task_struct *p);
@@ -855,6 +862,12 @@ static inline int security_task_create(unsigned long clone_flags)
855 return 0; 862 return 0;
856} 863}
857 864
865static inline int security_task_alloc(struct task_struct *task,
866 unsigned long clone_flags)
867{
868 return 0;
869}
870
858static inline void security_task_free(struct task_struct *task) 871static inline void security_task_free(struct task_struct *task)
859{ } 872{ }
860 873
@@ -949,6 +962,13 @@ static inline int security_task_getioprio(struct task_struct *p)
949 return 0; 962 return 0;
950} 963}
951 964
965static inline int security_task_prlimit(const struct cred *cred,
966 const struct cred *tcred,
967 unsigned int flags)
968{
969 return 0;
970}
971
952static inline int security_task_setrlimit(struct task_struct *p, 972static inline int security_task_setrlimit(struct task_struct *p,
953 unsigned int resource, 973 unsigned int resource,
954 struct rlimit *new_rlim) 974 struct rlimit *new_rlim)
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 4fc222f8755d..9edec926e9d9 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -10,8 +10,7 @@ struct task_struct;
10 10
11/* One sem_array data structure for each set of semaphores in the system. */ 11/* One sem_array data structure for each set of semaphores in the system. */
12struct sem_array { 12struct sem_array {
13 struct kern_ipc_perm ____cacheline_aligned_in_smp 13 struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */
14 sem_perm; /* permissions .. see ipc.h */
15 time_t sem_ctime; /* last change time */ 14 time_t sem_ctime; /* last change time */
16 struct sem *sem_base; /* ptr to first semaphore in array */ 15 struct sem *sem_base; /* ptr to first semaphore in array */
17 struct list_head pending_alter; /* pending operations */ 16 struct list_head pending_alter; /* pending operations */
diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index 9519da6253a8..e69402d4a8ae 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -15,6 +15,8 @@
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/termios.h>
19#include <linux/delay.h>
18 20
19struct serdev_controller; 21struct serdev_controller;
20struct serdev_device; 22struct serdev_device;
@@ -39,12 +41,16 @@ struct serdev_device_ops {
39 * @nr: Device number on serdev bus. 41 * @nr: Device number on serdev bus.
40 * @ctrl: serdev controller managing this device. 42 * @ctrl: serdev controller managing this device.
41 * @ops: Device operations. 43 * @ops: Device operations.
44 * @write_comp Completion used by serdev_device_write() internally
45 * @write_lock Lock to serialize access when writing data
42 */ 46 */
43struct serdev_device { 47struct serdev_device {
44 struct device dev; 48 struct device dev;
45 int nr; 49 int nr;
46 struct serdev_controller *ctrl; 50 struct serdev_controller *ctrl;
47 const struct serdev_device_ops *ops; 51 const struct serdev_device_ops *ops;
52 struct completion write_comp;
53 struct mutex write_lock;
48}; 54};
49 55
50static inline struct serdev_device *to_serdev_device(struct device *d) 56static inline struct serdev_device *to_serdev_device(struct device *d)
@@ -81,6 +87,9 @@ struct serdev_controller_ops {
81 void (*close)(struct serdev_controller *); 87 void (*close)(struct serdev_controller *);
82 void (*set_flow_control)(struct serdev_controller *, bool); 88 void (*set_flow_control)(struct serdev_controller *, bool);
83 unsigned int (*set_baudrate)(struct serdev_controller *, unsigned int); 89 unsigned int (*set_baudrate)(struct serdev_controller *, unsigned int);
90 void (*wait_until_sent)(struct serdev_controller *, long);
91 int (*get_tiocm)(struct serdev_controller *);
92 int (*set_tiocm)(struct serdev_controller *, unsigned int, unsigned int);
84}; 93};
85 94
86/** 95/**
@@ -165,7 +174,7 @@ static inline void serdev_controller_write_wakeup(struct serdev_controller *ctrl
165 if (!serdev || !serdev->ops->write_wakeup) 174 if (!serdev || !serdev->ops->write_wakeup)
166 return; 175 return;
167 176
168 serdev->ops->write_wakeup(ctrl->serdev); 177 serdev->ops->write_wakeup(serdev);
169} 178}
170 179
171static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl, 180static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl,
@@ -177,7 +186,7 @@ static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl,
177 if (!serdev || !serdev->ops->receive_buf) 186 if (!serdev || !serdev->ops->receive_buf)
178 return -EINVAL; 187 return -EINVAL;
179 188
180 return serdev->ops->receive_buf(ctrl->serdev, data, count); 189 return serdev->ops->receive_buf(serdev, data, count);
181} 190}
182 191
183#if IS_ENABLED(CONFIG_SERIAL_DEV_BUS) 192#if IS_ENABLED(CONFIG_SERIAL_DEV_BUS)
@@ -187,6 +196,11 @@ void serdev_device_close(struct serdev_device *);
187unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int); 196unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);
188void serdev_device_set_flow_control(struct serdev_device *, bool); 197void serdev_device_set_flow_control(struct serdev_device *, bool);
189int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t); 198int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t);
199void serdev_device_wait_until_sent(struct serdev_device *, long);
200int serdev_device_get_tiocm(struct serdev_device *);
201int serdev_device_set_tiocm(struct serdev_device *, int, int);
202void serdev_device_write_wakeup(struct serdev_device *);
203int serdev_device_write(struct serdev_device *, const unsigned char *, size_t, unsigned long);
190void serdev_device_write_flush(struct serdev_device *); 204void serdev_device_write_flush(struct serdev_device *);
191int serdev_device_write_room(struct serdev_device *); 205int serdev_device_write_room(struct serdev_device *);
192 206
@@ -223,7 +237,23 @@ static inline unsigned int serdev_device_set_baudrate(struct serdev_device *sdev
223 return 0; 237 return 0;
224} 238}
225static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {} 239static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {}
226static inline int serdev_device_write_buf(struct serdev_device *sdev, const unsigned char *buf, size_t count) 240static inline int serdev_device_write_buf(struct serdev_device *serdev,
241 const unsigned char *buf,
242 size_t count)
243{
244 return -ENODEV;
245}
246static inline void serdev_device_wait_until_sent(struct serdev_device *sdev, long timeout) {}
247static inline int serdev_device_get_tiocm(struct serdev_device *serdev)
248{
249 return -ENOTSUPP;
250}
251static inline int serdev_device_set_tiocm(struct serdev_device *serdev, int set, int clear)
252{
253 return -ENOTSUPP;
254}
255static inline int serdev_device_write(struct serdev_device *sdev, const unsigned char *buf,
256 size_t count, unsigned long timeout)
227{ 257{
228 return -ENODEV; 258 return -ENODEV;
229} 259}
@@ -238,6 +268,36 @@ static inline int serdev_device_write_room(struct serdev_device *sdev)
238 268
239#endif /* CONFIG_SERIAL_DEV_BUS */ 269#endif /* CONFIG_SERIAL_DEV_BUS */
240 270
271static inline bool serdev_device_get_cts(struct serdev_device *serdev)
272{
273 int status = serdev_device_get_tiocm(serdev);
274 return !!(status & TIOCM_CTS);
275}
276
277static inline int serdev_device_wait_for_cts(struct serdev_device *serdev, bool state, int timeout_ms)
278{
279 unsigned long timeout;
280 bool signal;
281
282 timeout = jiffies + msecs_to_jiffies(timeout_ms);
283 while (time_is_after_jiffies(timeout)) {
284 signal = serdev_device_get_cts(serdev);
285 if (signal == state)
286 return 0;
287 usleep_range(1000, 2000);
288 }
289
290 return -ETIMEDOUT;
291}
292
293static inline int serdev_device_set_rts(struct serdev_device *serdev, bool enable)
294{
295 if (enable)
296 return serdev_device_set_tiocm(serdev, TIOCM_RTS, 0);
297 else
298 return serdev_device_set_tiocm(serdev, 0, TIOCM_RTS);
299}
300
241/* 301/*
242 * serdev hooks into TTY core 302 * serdev hooks into TTY core
243 */ 303 */
@@ -248,7 +308,7 @@ struct tty_driver;
248struct device *serdev_tty_port_register(struct tty_port *port, 308struct device *serdev_tty_port_register(struct tty_port *port,
249 struct device *parent, 309 struct device *parent,
250 struct tty_driver *drv, int idx); 310 struct tty_driver *drv, int idx);
251void serdev_tty_port_unregister(struct tty_port *port); 311int serdev_tty_port_unregister(struct tty_port *port);
252#else 312#else
253static inline struct device *serdev_tty_port_register(struct tty_port *port, 313static inline struct device *serdev_tty_port_register(struct tty_port *port,
254 struct device *parent, 314 struct device *parent,
@@ -256,7 +316,10 @@ static inline struct device *serdev_tty_port_register(struct tty_port *port,
256{ 316{
257 return ERR_PTR(-ENODEV); 317 return ERR_PTR(-ENODEV);
258} 318}
259static inline void serdev_tty_port_unregister(struct tty_port *port) {} 319static inline int serdev_tty_port_unregister(struct tty_port *port)
320{
321 return -ENODEV;
322}
260#endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */ 323#endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */
261 324
262#endif /*_LINUX_SERDEV_H */ 325#endif /*_LINUX_SERDEV_H */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 58484fb35cc8..64d892f1e5cd 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -247,6 +247,7 @@ struct uart_port {
247 unsigned char suspended; 247 unsigned char suspended;
248 unsigned char irq_wake; 248 unsigned char irq_wake;
249 unsigned char unused[2]; 249 unsigned char unused[2];
250 const char *name; /* port name */
250 struct attribute_group *attr_group; /* port specific attributes */ 251 struct attribute_group *attr_group; /* port specific attributes */
251 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ 252 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */
252 struct serial_rs485 rs485; 253 struct serial_rs485 rs485;
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 94ad6eea9550..1f5a16620693 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -390,10 +390,6 @@ int unhandled_signal(struct task_struct *tsk, int sig);
390#define sig_kernel_ignore(sig) siginmask(sig, SIG_KERNEL_IGNORE_MASK) 390#define sig_kernel_ignore(sig) siginmask(sig, SIG_KERNEL_IGNORE_MASK)
391#define sig_kernel_stop(sig) siginmask(sig, SIG_KERNEL_STOP_MASK) 391#define sig_kernel_stop(sig) siginmask(sig, SIG_KERNEL_STOP_MASK)
392 392
393#define sig_user_defined(t, signr) \
394 (((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \
395 ((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN))
396
397#define sig_fatal(t, signr) \ 393#define sig_fatal(t, signr) \
398 (!siginmask(signr, SIG_KERNEL_IGNORE_MASK|SIG_KERNEL_STOP_MASK) && \ 394 (!siginmask(signr, SIG_KERNEL_IGNORE_MASK|SIG_KERNEL_STOP_MASK) && \
399 (t)->sighand->action[(signr)-1].sa.sa_handler == SIG_DFL) 395 (t)->sighand->action[(signr)-1].sa.sa_handler == SIG_DFL)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c776abd86937..a098d95b3d84 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -413,14 +413,15 @@ struct ubuf_info {
413 * the end of the header data, ie. at skb->end. 413 * the end of the header data, ie. at skb->end.
414 */ 414 */
415struct skb_shared_info { 415struct skb_shared_info {
416 unsigned short _unused;
416 unsigned char nr_frags; 417 unsigned char nr_frags;
417 __u8 tx_flags; 418 __u8 tx_flags;
418 unsigned short gso_size; 419 unsigned short gso_size;
419 /* Warning: this field is not always filled in (UFO)! */ 420 /* Warning: this field is not always filled in (UFO)! */
420 unsigned short gso_segs; 421 unsigned short gso_segs;
421 unsigned short gso_type;
422 struct sk_buff *frag_list; 422 struct sk_buff *frag_list;
423 struct skb_shared_hwtstamps hwtstamps; 423 struct skb_shared_hwtstamps hwtstamps;
424 unsigned int gso_type;
424 u32 tskey; 425 u32 tskey;
425 __be32 ip6_frag_id; 426 __be32 ip6_frag_id;
426 427
@@ -491,6 +492,8 @@ enum {
491 SKB_GSO_TUNNEL_REMCSUM = 1 << 14, 492 SKB_GSO_TUNNEL_REMCSUM = 1 << 14,
492 493
493 SKB_GSO_SCTP = 1 << 15, 494 SKB_GSO_SCTP = 1 << 15,
495
496 SKB_GSO_ESP = 1 << 16,
494}; 497};
495 498
496#if BITS_PER_LONG > 32 499#if BITS_PER_LONG > 32
@@ -3113,7 +3116,7 @@ struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy,
3113 3116
3114static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len) 3117static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len)
3115{ 3118{
3116 return copy_from_iter(data, len, &msg->msg_iter) == len ? 0 : -EFAULT; 3119 return copy_from_iter_full(data, len, &msg->msg_iter) ? 0 : -EFAULT;
3117} 3120}
3118 3121
3119static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len) 3122static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 3c37a8c51921..04a7f7993e67 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -28,7 +28,7 @@
28#define SLAB_STORE_USER 0x00010000UL /* DEBUG: Store the last owner for bug hunting */ 28#define SLAB_STORE_USER 0x00010000UL /* DEBUG: Store the last owner for bug hunting */
29#define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */ 29#define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */
30/* 30/*
31 * SLAB_DESTROY_BY_RCU - **WARNING** READ THIS! 31 * SLAB_TYPESAFE_BY_RCU - **WARNING** READ THIS!
32 * 32 *
33 * This delays freeing the SLAB page by a grace period, it does _NOT_ 33 * This delays freeing the SLAB page by a grace period, it does _NOT_
34 * delay object freeing. This means that if you do kmem_cache_free() 34 * delay object freeing. This means that if you do kmem_cache_free()
@@ -61,8 +61,10 @@
61 * 61 *
62 * rcu_read_lock before reading the address, then rcu_read_unlock after 62 * rcu_read_lock before reading the address, then rcu_read_unlock after
63 * taking the spinlock within the structure expected at that address. 63 * taking the spinlock within the structure expected at that address.
64 *
65 * Note that SLAB_TYPESAFE_BY_RCU was originally named SLAB_DESTROY_BY_RCU.
64 */ 66 */
65#define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ 67#define SLAB_TYPESAFE_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */
66#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ 68#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */
67#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ 69#define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */
68 70
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8e0cb7a0f836..68123c1fe549 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -120,6 +120,13 @@ extern unsigned int setup_max_cpus;
120extern void __init setup_nr_cpu_ids(void); 120extern void __init setup_nr_cpu_ids(void);
121extern void __init smp_init(void); 121extern void __init smp_init(void);
122 122
123extern int __boot_cpu_id;
124
125static inline int get_boot_cpu_id(void)
126{
127 return __boot_cpu_id;
128}
129
123#else /* !SMP */ 130#else /* !SMP */
124 131
125static inline void smp_send_stop(void) { } 132static inline void smp_send_stop(void) { }
@@ -158,6 +165,11 @@ static inline void smp_init(void) { up_late_init(); }
158static inline void smp_init(void) { } 165static inline void smp_init(void) { }
159#endif 166#endif
160 167
168static inline int get_boot_cpu_id(void)
169{
170 return 0;
171}
172
161#endif /* !SMP */ 173#endif /* !SMP */
162 174
163/* 175/*
diff --git a/include/linux/soc/qcom/smd.h b/include/linux/soc/qcom/smd.h
deleted file mode 100644
index f148e0ffbec7..000000000000
--- a/include/linux/soc/qcom/smd.h
+++ /dev/null
@@ -1,139 +0,0 @@
1#ifndef __QCOM_SMD_H__
2#define __QCOM_SMD_H__
3
4#include <linux/device.h>
5#include <linux/mod_devicetable.h>
6
7struct qcom_smd;
8struct qcom_smd_channel;
9struct qcom_smd_lookup;
10
11/**
12 * struct qcom_smd_id - struct used for matching a smd device
13 * @name: name of the channel
14 */
15struct qcom_smd_id {
16 char name[20];
17};
18
19/**
20 * struct qcom_smd_device - smd device struct
21 * @dev: the device struct
22 * @channel: handle to the smd channel for this device
23 */
24struct qcom_smd_device {
25 struct device dev;
26 struct qcom_smd_channel *channel;
27};
28
29typedef int (*qcom_smd_cb_t)(struct qcom_smd_channel *, const void *, size_t);
30
31/**
32 * struct qcom_smd_driver - smd driver struct
33 * @driver: underlying device driver
34 * @smd_match_table: static channel match table
35 * @probe: invoked when the smd channel is found
36 * @remove: invoked when the smd channel is closed
37 * @callback: invoked when an inbound message is received on the channel,
38 * should return 0 on success or -EBUSY if the data cannot be
39 * consumed at this time
40 */
41struct qcom_smd_driver {
42 struct device_driver driver;
43 const struct qcom_smd_id *smd_match_table;
44
45 int (*probe)(struct qcom_smd_device *dev);
46 void (*remove)(struct qcom_smd_device *dev);
47 qcom_smd_cb_t callback;
48};
49
50#if IS_ENABLED(CONFIG_QCOM_SMD)
51
52int qcom_smd_driver_register(struct qcom_smd_driver *drv);
53void qcom_smd_driver_unregister(struct qcom_smd_driver *drv);
54
55struct qcom_smd_channel *qcom_smd_open_channel(struct qcom_smd_channel *channel,
56 const char *name,
57 qcom_smd_cb_t cb);
58void qcom_smd_close_channel(struct qcom_smd_channel *channel);
59void *qcom_smd_get_drvdata(struct qcom_smd_channel *channel);
60void qcom_smd_set_drvdata(struct qcom_smd_channel *channel, void *data);
61int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len);
62
63
64struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
65 struct device_node *node);
66int qcom_smd_unregister_edge(struct qcom_smd_edge *edge);
67
68#else
69
70static inline int qcom_smd_driver_register(struct qcom_smd_driver *drv)
71{
72 return -ENXIO;
73}
74
75static inline void qcom_smd_driver_unregister(struct qcom_smd_driver *drv)
76{
77 /* This shouldn't be possible */
78 WARN_ON(1);
79}
80
81static inline struct qcom_smd_channel *
82qcom_smd_open_channel(struct qcom_smd_channel *channel,
83 const char *name,
84 qcom_smd_cb_t cb)
85{
86 /* This shouldn't be possible */
87 WARN_ON(1);
88 return NULL;
89}
90
91static inline void qcom_smd_close_channel(struct qcom_smd_channel *channel)
92{
93 /* This shouldn't be possible */
94 WARN_ON(1);
95}
96
97static inline void *qcom_smd_get_drvdata(struct qcom_smd_channel *channel)
98{
99 /* This shouldn't be possible */
100 WARN_ON(1);
101 return NULL;
102}
103
104static inline void qcom_smd_set_drvdata(struct qcom_smd_channel *channel, void *data)
105{
106 /* This shouldn't be possible */
107 WARN_ON(1);
108}
109
110static inline int qcom_smd_send(struct qcom_smd_channel *channel,
111 const void *data, int len)
112{
113 /* This shouldn't be possible */
114 WARN_ON(1);
115 return -ENXIO;
116}
117
118static inline struct qcom_smd_edge *
119qcom_smd_register_edge(struct device *parent,
120 struct device_node *node)
121{
122 return ERR_PTR(-ENXIO);
123}
124
125static inline int qcom_smd_unregister_edge(struct qcom_smd_edge *edge)
126{
127 /* This shouldn't be possible */
128 WARN_ON(1);
129 return -ENXIO;
130}
131
132#endif
133
134#define module_qcom_smd_driver(__smd_driver) \
135 module_driver(__smd_driver, qcom_smd_driver_register, \
136 qcom_smd_driver_unregister)
137
138
139#endif
diff --git a/include/linux/soc/qcom/wcnss_ctrl.h b/include/linux/soc/qcom/wcnss_ctrl.h
index eab64976a73b..a4dd4d7c711d 100644
--- a/include/linux/soc/qcom/wcnss_ctrl.h
+++ b/include/linux/soc/qcom/wcnss_ctrl.h
@@ -1,16 +1,19 @@
1#ifndef __WCNSS_CTRL_H__ 1#ifndef __WCNSS_CTRL_H__
2#define __WCNSS_CTRL_H__ 2#define __WCNSS_CTRL_H__
3 3
4#include <linux/soc/qcom/smd.h> 4#include <linux/rpmsg.h>
5 5
6#if IS_ENABLED(CONFIG_QCOM_WCNSS_CTRL) 6#if IS_ENABLED(CONFIG_QCOM_WCNSS_CTRL)
7 7
8struct qcom_smd_channel *qcom_wcnss_open_channel(void *wcnss, const char *name, qcom_smd_cb_t cb); 8struct rpmsg_endpoint *qcom_wcnss_open_channel(void *wcnss, const char *name,
9 rpmsg_rx_cb_t cb, void *priv);
9 10
10#else 11#else
11 12
12static inline struct qcom_smd_channel* 13static struct rpmsg_endpoint *qcom_wcnss_open_channel(void *wcnss,
13qcom_wcnss_open_channel(void *wcnss, const char *name, qcom_smd_cb_t cb) 14 const char *name,
15 rpmsg_rx_cb_t cb,
16 void *priv)
14{ 17{
15 WARN_ON(1); 18 WARN_ON(1);
16 return ERR_PTR(-ENXIO); 19 return ERR_PTR(-ENXIO);
diff --git a/include/linux/soc/renesas/rcar-rst.h b/include/linux/soc/renesas/rcar-rst.h
index a18e0783946b..787e7ad53d45 100644
--- a/include/linux/soc/renesas/rcar-rst.h
+++ b/include/linux/soc/renesas/rcar-rst.h
@@ -1,6 +1,11 @@
1#ifndef __LINUX_SOC_RENESAS_RCAR_RST_H__ 1#ifndef __LINUX_SOC_RENESAS_RCAR_RST_H__
2#define __LINUX_SOC_RENESAS_RCAR_RST_H__ 2#define __LINUX_SOC_RENESAS_RCAR_RST_H__
3 3
4#if defined(CONFIG_ARCH_RCAR_GEN1) || defined(CONFIG_ARCH_RCAR_GEN2) || \
5 defined(CONFIG_ARCH_R8A7795) || defined(CONFIG_ARCH_R8A7796)
4int rcar_rst_read_mode_pins(u32 *mode); 6int rcar_rst_read_mode_pins(u32 *mode);
7#else
8static inline int rcar_rst_read_mode_pins(u32 *mode) { return -ENODEV; }
9#endif
5 10
6#endif /* __LINUX_SOC_RENESAS_RCAR_RST_H__ */ 11#endif /* __LINUX_SOC_RENESAS_RCAR_RST_H__ */
diff --git a/include/linux/soc/samsung/exynos-regs-pmu.h b/include/linux/soc/samsung/exynos-regs-pmu.h
index 49df0a01a2cc..bebdde5dccd6 100644
--- a/include/linux/soc/samsung/exynos-regs-pmu.h
+++ b/include/linux/soc/samsung/exynos-regs-pmu.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010-2015 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com 3 * http://www.samsung.com
4 * 4 *
5 * EXYNOS - Power management unit definition 5 * EXYNOS - Power management unit definition
@@ -50,6 +50,14 @@
50#define S5P_WAKEUP_MASK 0x0608 50#define S5P_WAKEUP_MASK 0x0608
51#define S5P_WAKEUP_MASK2 0x0614 51#define S5P_WAKEUP_MASK2 0x0614
52 52
53/* MIPI_PHYn_CONTROL, valid for Exynos3250, Exynos4, Exynos5250 and Exynos5433 */
54#define EXYNOS4_MIPI_PHY_CONTROL(n) (0x0710 + (n) * 4)
55/* Phy enable bit, common for all phy registers, not only MIPI */
56#define EXYNOS4_PHY_ENABLE (1 << 0)
57#define EXYNOS4_MIPI_PHY_SRESETN (1 << 1)
58#define EXYNOS4_MIPI_PHY_MRESETN (1 << 2)
59#define EXYNOS4_MIPI_PHY_RESET_MASK (3 << 1)
60
53#define S5P_INFORM0 0x0800 61#define S5P_INFORM0 0x0800
54#define S5P_INFORM1 0x0804 62#define S5P_INFORM1 0x0804
55#define S5P_INFORM5 0x0814 63#define S5P_INFORM5 0x0814
@@ -342,6 +350,8 @@
342 350
343#define EXYNOS5_AUTO_WDTRESET_DISABLE 0x0408 351#define EXYNOS5_AUTO_WDTRESET_DISABLE 0x0408
344#define EXYNOS5_MASK_WDTRESET_REQUEST 0x040C 352#define EXYNOS5_MASK_WDTRESET_REQUEST 0x040C
353#define EXYNOS5_USBDRD_PHY_CONTROL 0x0704
354#define EXYNOS5_DPTX_PHY_CONTROL 0x0720
345 355
346#define EXYNOS5_USE_RETENTION BIT(4) 356#define EXYNOS5_USE_RETENTION BIT(4)
347#define EXYNOS5_SYS_WDTRESET (1 << 20) 357#define EXYNOS5_SYS_WDTRESET (1 << 20)
@@ -495,6 +505,9 @@
495#define EXYNOS5420_KFC_CORE_RESET(_nr) \ 505#define EXYNOS5420_KFC_CORE_RESET(_nr) \
496 ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) << (_nr)) 506 ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) << (_nr))
497 507
508#define EXYNOS5420_USBDRD1_PHY_CONTROL 0x0708
509#define EXYNOS5420_MIPI_PHY_CONTROL(n) (0x0714 + (n) * 4)
510#define EXYNOS5420_DPTX_PHY_CONTROL 0x0728
498#define EXYNOS5420_ARM_CORE2_SYS_PWR_REG 0x1020 511#define EXYNOS5420_ARM_CORE2_SYS_PWR_REG 0x1020
499#define EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG 0x1024 512#define EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG 0x1024
500#define EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG 0x1028 513#define EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG 0x1028
@@ -632,6 +645,7 @@
632 | EXYNOS5420_KFC_USE_STANDBY_WFI3) 645 | EXYNOS5420_KFC_USE_STANDBY_WFI3)
633 646
634/* For EXYNOS5433 */ 647/* For EXYNOS5433 */
648#define EXYNOS5433_USBHOST30_PHY_CONTROL (0x0728)
635#define EXYNOS5433_PAD_RETENTION_AUD_OPTION (0x3028) 649#define EXYNOS5433_PAD_RETENTION_AUD_OPTION (0x3028)
636#define EXYNOS5433_PAD_RETENTION_MMC2_OPTION (0x30C8) 650#define EXYNOS5433_PAD_RETENTION_MMC2_OPTION (0x30C8)
637#define EXYNOS5433_PAD_RETENTION_TOP_OPTION (0x3108) 651#define EXYNOS5433_PAD_RETENTION_TOP_OPTION (0x3108)
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index a0596ca0e80a..a2f8109bb215 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -24,6 +24,7 @@ void sock_diag_unregister(const struct sock_diag_handler *h);
24void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 24void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
25void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 25void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
26 26
27u64 sock_gen_cookie(struct sock *sk);
27int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie); 28int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie);
28void sock_diag_save_cookie(struct sock *sk, __u32 *cookie); 29void sock_diag_save_cookie(struct sock *sk, __u32 *cookie);
29 30
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 75c6bd0ac605..935bd2854ff1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -23,6 +23,7 @@
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24 24
25struct dma_chan; 25struct dma_chan;
26struct property_entry;
26struct spi_master; 27struct spi_master;
27struct spi_transfer; 28struct spi_transfer;
28struct spi_flash_read_message; 29struct spi_flash_read_message;
@@ -375,6 +376,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
375 * @unprepare_message: undo any work done by prepare_message(). 376 * @unprepare_message: undo any work done by prepare_message().
376 * @spi_flash_read: to support spi-controller hardwares that provide 377 * @spi_flash_read: to support spi-controller hardwares that provide
377 * accelerated interface to read from flash devices. 378 * accelerated interface to read from flash devices.
379 * @spi_flash_can_dma: analogous to can_dma() interface, but for
380 * controllers implementing spi_flash_read.
378 * @flash_read_supported: spi device supports flash read 381 * @flash_read_supported: spi device supports flash read
379 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 382 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
380 * number. Any individual value may be -ENOENT for CS lines that 383 * number. Any individual value may be -ENOENT for CS lines that
@@ -538,6 +541,8 @@ struct spi_master {
538 struct spi_message *message); 541 struct spi_message *message);
539 int (*spi_flash_read)(struct spi_device *spi, 542 int (*spi_flash_read)(struct spi_device *spi,
540 struct spi_flash_read_message *msg); 543 struct spi_flash_read_message *msg);
544 bool (*spi_flash_can_dma)(struct spi_device *spi,
545 struct spi_flash_read_message *msg);
541 bool (*flash_read_supported)(struct spi_device *spi); 546 bool (*flash_read_supported)(struct spi_device *spi);
542 547
543 /* 548 /*
@@ -891,7 +896,7 @@ static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags
891 unsigned i; 896 unsigned i;
892 struct spi_transfer *t = (struct spi_transfer *)(m + 1); 897 struct spi_transfer *t = (struct spi_transfer *)(m + 1);
893 898
894 INIT_LIST_HEAD(&m->transfers); 899 spi_message_init_no_memset(m);
895 for (i = 0; i < ntrans; i++, t++) 900 for (i = 0; i < ntrans; i++, t++)
896 spi_message_add_tail(t, m); 901 spi_message_add_tail(t, m);
897 } 902 }
@@ -1209,6 +1214,7 @@ int spi_flash_read(struct spi_device *spi,
1209 * @modalias: Initializes spi_device.modalias; identifies the driver. 1214 * @modalias: Initializes spi_device.modalias; identifies the driver.
1210 * @platform_data: Initializes spi_device.platform_data; the particular 1215 * @platform_data: Initializes spi_device.platform_data; the particular
1211 * data stored there is driver-specific. 1216 * data stored there is driver-specific.
1217 * @properties: Additional device properties for the device.
1212 * @controller_data: Initializes spi_device.controller_data; some 1218 * @controller_data: Initializes spi_device.controller_data; some
1213 * controllers need hints about hardware setup, e.g. for DMA. 1219 * controllers need hints about hardware setup, e.g. for DMA.
1214 * @irq: Initializes spi_device.irq; depends on how the board is wired. 1220 * @irq: Initializes spi_device.irq; depends on how the board is wired.
@@ -1241,10 +1247,12 @@ struct spi_board_info {
1241 * 1247 *
1242 * platform_data goes to spi_device.dev.platform_data, 1248 * platform_data goes to spi_device.dev.platform_data,
1243 * controller_data goes to spi_device.controller_data, 1249 * controller_data goes to spi_device.controller_data,
1250 * device properties are copied and attached to spi_device,
1244 * irq is copied too 1251 * irq is copied too
1245 */ 1252 */
1246 char modalias[SPI_NAME_SIZE]; 1253 char modalias[SPI_NAME_SIZE];
1247 const void *platform_data; 1254 const void *platform_data;
1255 const struct property_entry *properties;
1248 void *controller_data; 1256 void *controller_data;
1249 int irq; 1257 int irq;
1250 1258
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 00a21166e268..db42746bdfea 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -20,6 +20,8 @@
20#define SPLICE_F_MORE (0x04) /* expect more data */ 20#define SPLICE_F_MORE (0x04) /* expect more data */
21#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */ 21#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */
22 22
23#define SPLICE_F_ALL (SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT)
24
23/* 25/*
24 * Passed to the actors 26 * Passed to the actors
25 */ 27 */
@@ -55,7 +57,6 @@ struct splice_pipe_desc {
55 struct partial_page *partial; /* pages[] may not be contig */ 57 struct partial_page *partial; /* pages[] may not be contig */
56 int nr_pages; /* number of populated pages in map */ 58 int nr_pages; /* number of populated pages in map */
57 unsigned int nr_pages_max; /* pages[] & partial[] arrays size */ 59 unsigned int nr_pages_max; /* pages[] & partial[] arrays size */
58 unsigned int flags; /* splice flags */
59 const struct pipe_buf_operations *ops;/* ops associated with output pipe */ 60 const struct pipe_buf_operations *ops;/* ops associated with output pipe */
60 void (*spd_release)(struct splice_pipe_desc *, unsigned int); 61 void (*spd_release)(struct splice_pipe_desc *, unsigned int);
61}; 62};
@@ -82,7 +83,6 @@ extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
82 */ 83 */
83extern int splice_grow_spd(const struct pipe_inode_info *, struct splice_pipe_desc *); 84extern int splice_grow_spd(const struct pipe_inode_info *, struct splice_pipe_desc *);
84extern void splice_shrink_spd(struct splice_pipe_desc *); 85extern void splice_shrink_spd(struct splice_pipe_desc *);
85extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
86 86
87extern const struct pipe_buf_operations page_cache_pipe_buf_ops; 87extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
88extern const struct pipe_buf_operations default_pipe_buf_ops; 88extern const struct pipe_buf_operations default_pipe_buf_ops;
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index a598cf3ac70c..167ad8831aaf 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -22,7 +22,7 @@
22 * Lai Jiangshan <laijs@cn.fujitsu.com> 22 * Lai Jiangshan <laijs@cn.fujitsu.com>
23 * 23 *
24 * For detailed explanation of Read-Copy Update mechanism see - 24 * For detailed explanation of Read-Copy Update mechanism see -
25 * Documentation/RCU/ *.txt 25 * Documentation/RCU/ *.txt
26 * 26 *
27 */ 27 */
28 28
@@ -32,35 +32,9 @@
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/rcupdate.h> 33#include <linux/rcupdate.h>
34#include <linux/workqueue.h> 34#include <linux/workqueue.h>
35#include <linux/rcu_segcblist.h>
35 36
36struct srcu_array { 37struct srcu_struct;
37 unsigned long lock_count[2];
38 unsigned long unlock_count[2];
39};
40
41struct rcu_batch {
42 struct rcu_head *head, **tail;
43};
44
45#define RCU_BATCH_INIT(name) { NULL, &(name.head) }
46
47struct srcu_struct {
48 unsigned long completed;
49 struct srcu_array __percpu *per_cpu_ref;
50 spinlock_t queue_lock; /* protect ->batch_queue, ->running */
51 bool running;
52 /* callbacks just queued */
53 struct rcu_batch batch_queue;
54 /* callbacks try to do the first check_zero */
55 struct rcu_batch batch_check0;
56 /* callbacks done with the first check_zero and the flip */
57 struct rcu_batch batch_check1;
58 struct rcu_batch batch_done;
59 struct delayed_work work;
60#ifdef CONFIG_DEBUG_LOCK_ALLOC
61 struct lockdep_map dep_map;
62#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
63};
64 38
65#ifdef CONFIG_DEBUG_LOCK_ALLOC 39#ifdef CONFIG_DEBUG_LOCK_ALLOC
66 40
@@ -82,46 +56,15 @@ int init_srcu_struct(struct srcu_struct *sp);
82#define __SRCU_DEP_MAP_INIT(srcu_name) 56#define __SRCU_DEP_MAP_INIT(srcu_name)
83#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 57#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
84 58
85void process_srcu(struct work_struct *work); 59#ifdef CONFIG_TINY_SRCU
86 60#include <linux/srcutiny.h>
87#define __SRCU_STRUCT_INIT(name) \ 61#elif defined(CONFIG_TREE_SRCU)
88 { \ 62#include <linux/srcutree.h>
89 .completed = -300, \ 63#elif defined(CONFIG_CLASSIC_SRCU)
90 .per_cpu_ref = &name##_srcu_array, \ 64#include <linux/srcuclassic.h>
91 .queue_lock = __SPIN_LOCK_UNLOCKED(name.queue_lock), \ 65#else
92 .running = false, \ 66#error "Unknown SRCU implementation specified to kernel configuration"
93 .batch_queue = RCU_BATCH_INIT(name.batch_queue), \ 67#endif
94 .batch_check0 = RCU_BATCH_INIT(name.batch_check0), \
95 .batch_check1 = RCU_BATCH_INIT(name.batch_check1), \
96 .batch_done = RCU_BATCH_INIT(name.batch_done), \
97 .work = __DELAYED_WORK_INITIALIZER(name.work, process_srcu, 0),\
98 __SRCU_DEP_MAP_INIT(name) \
99 }
100
101/*
102 * Define and initialize a srcu struct at build time.
103 * Do -not- call init_srcu_struct() nor cleanup_srcu_struct() on it.
104 *
105 * Note that although DEFINE_STATIC_SRCU() hides the name from other
106 * files, the per-CPU variable rules nevertheless require that the
107 * chosen name be globally unique. These rules also prohibit use of
108 * DEFINE_STATIC_SRCU() within a function. If these rules are too
109 * restrictive, declare the srcu_struct manually. For example, in
110 * each file:
111 *
112 * static struct srcu_struct my_srcu;
113 *
114 * Then, before the first use of each my_srcu, manually initialize it:
115 *
116 * init_srcu_struct(&my_srcu);
117 *
118 * See include/linux/percpu-defs.h for the rules on per-CPU variables.
119 */
120#define __DEFINE_SRCU(name, is_static) \
121 static DEFINE_PER_CPU(struct srcu_array, name##_srcu_array);\
122 is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name)
123#define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */)
124#define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static)
125 68
126/** 69/**
127 * call_srcu() - Queue a callback for invocation after an SRCU grace period 70 * call_srcu() - Queue a callback for invocation after an SRCU grace period
@@ -147,9 +90,6 @@ void cleanup_srcu_struct(struct srcu_struct *sp);
147int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp); 90int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
148void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); 91void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
149void synchronize_srcu(struct srcu_struct *sp); 92void synchronize_srcu(struct srcu_struct *sp);
150void synchronize_srcu_expedited(struct srcu_struct *sp);
151unsigned long srcu_batches_completed(struct srcu_struct *sp);
152void srcu_barrier(struct srcu_struct *sp);
153 93
154#ifdef CONFIG_DEBUG_LOCK_ALLOC 94#ifdef CONFIG_DEBUG_LOCK_ALLOC
155 95
diff --git a/include/linux/srcuclassic.h b/include/linux/srcuclassic.h
new file mode 100644
index 000000000000..5753f7322262
--- /dev/null
+++ b/include/linux/srcuclassic.h
@@ -0,0 +1,115 @@
1/*
2 * Sleepable Read-Copy Update mechanism for mutual exclusion,
3 * classic v4.11 variant.
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; either version 2 of the License, or
8 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, you can access it online at
17 * http://www.gnu.org/licenses/gpl-2.0.html.
18 *
19 * Copyright (C) IBM Corporation, 2017
20 *
21 * Author: Paul McKenney <paulmck@us.ibm.com>
22 */
23
24#ifndef _LINUX_SRCU_CLASSIC_H
25#define _LINUX_SRCU_CLASSIC_H
26
27struct srcu_array {
28 unsigned long lock_count[2];
29 unsigned long unlock_count[2];
30};
31
32struct rcu_batch {
33 struct rcu_head *head, **tail;
34};
35
36#define RCU_BATCH_INIT(name) { NULL, &(name.head) }
37
38struct srcu_struct {
39 unsigned long completed;
40 struct srcu_array __percpu *per_cpu_ref;
41 spinlock_t queue_lock; /* protect ->batch_queue, ->running */
42 bool running;
43 /* callbacks just queued */
44 struct rcu_batch batch_queue;
45 /* callbacks try to do the first check_zero */
46 struct rcu_batch batch_check0;
47 /* callbacks done with the first check_zero and the flip */
48 struct rcu_batch batch_check1;
49 struct rcu_batch batch_done;
50 struct delayed_work work;
51#ifdef CONFIG_DEBUG_LOCK_ALLOC
52 struct lockdep_map dep_map;
53#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
54};
55
56void process_srcu(struct work_struct *work);
57
58#define __SRCU_STRUCT_INIT(name) \
59 { \
60 .completed = -300, \
61 .per_cpu_ref = &name##_srcu_array, \
62 .queue_lock = __SPIN_LOCK_UNLOCKED(name.queue_lock), \
63 .running = false, \
64 .batch_queue = RCU_BATCH_INIT(name.batch_queue), \
65 .batch_check0 = RCU_BATCH_INIT(name.batch_check0), \
66 .batch_check1 = RCU_BATCH_INIT(name.batch_check1), \
67 .batch_done = RCU_BATCH_INIT(name.batch_done), \
68 .work = __DELAYED_WORK_INITIALIZER(name.work, process_srcu, 0),\
69 __SRCU_DEP_MAP_INIT(name) \
70 }
71
72/*
73 * Define and initialize a srcu struct at build time.
74 * Do -not- call init_srcu_struct() nor cleanup_srcu_struct() on it.
75 *
76 * Note that although DEFINE_STATIC_SRCU() hides the name from other
77 * files, the per-CPU variable rules nevertheless require that the
78 * chosen name be globally unique. These rules also prohibit use of
79 * DEFINE_STATIC_SRCU() within a function. If these rules are too
80 * restrictive, declare the srcu_struct manually. For example, in
81 * each file:
82 *
83 * static struct srcu_struct my_srcu;
84 *
85 * Then, before the first use of each my_srcu, manually initialize it:
86 *
87 * init_srcu_struct(&my_srcu);
88 *
89 * See include/linux/percpu-defs.h for the rules on per-CPU variables.
90 */
91#define __DEFINE_SRCU(name, is_static) \
92 static DEFINE_PER_CPU(struct srcu_array, name##_srcu_array);\
93 is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name)
94#define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */)
95#define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static)
96
97void synchronize_srcu_expedited(struct srcu_struct *sp);
98void srcu_barrier(struct srcu_struct *sp);
99unsigned long srcu_batches_completed(struct srcu_struct *sp);
100
101static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
102 struct srcu_struct *sp, int *flags,
103 unsigned long *gpnum,
104 unsigned long *completed)
105{
106 if (test_type != SRCU_FLAVOR)
107 return;
108 *flags = 0;
109 *completed = sp->completed;
110 *gpnum = *completed;
111 if (sp->batch_queue.head || sp->batch_check0.head || sp->batch_check0.head)
112 (*gpnum)++;
113}
114
115#endif
diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h
new file mode 100644
index 000000000000..42311ee0334f
--- /dev/null
+++ b/include/linux/srcutiny.h
@@ -0,0 +1,93 @@
1/*
2 * Sleepable Read-Copy Update mechanism for mutual exclusion,
3 * tiny variant.
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; either version 2 of the License, or
8 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, you can access it online at
17 * http://www.gnu.org/licenses/gpl-2.0.html.
18 *
19 * Copyright (C) IBM Corporation, 2017
20 *
21 * Author: Paul McKenney <paulmck@us.ibm.com>
22 */
23
24#ifndef _LINUX_SRCU_TINY_H
25#define _LINUX_SRCU_TINY_H
26
27#include <linux/swait.h>
28
29struct srcu_struct {
30 int srcu_lock_nesting[2]; /* srcu_read_lock() nesting depth. */
31 struct swait_queue_head srcu_wq;
32 /* Last srcu_read_unlock() wakes GP. */
33 unsigned long srcu_gp_seq; /* GP seq # for callback tagging. */
34 struct rcu_segcblist srcu_cblist;
35 /* Pending SRCU callbacks. */
36 int srcu_idx; /* Current reader array element. */
37 bool srcu_gp_running; /* GP workqueue running? */
38 bool srcu_gp_waiting; /* GP waiting for readers? */
39 struct work_struct srcu_work; /* For driving grace periods. */
40#ifdef CONFIG_DEBUG_LOCK_ALLOC
41 struct lockdep_map dep_map;
42#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
43};
44
45void srcu_drive_gp(struct work_struct *wp);
46
47#define __SRCU_STRUCT_INIT(name) \
48{ \
49 .srcu_wq = __SWAIT_QUEUE_HEAD_INITIALIZER(name.srcu_wq), \
50 .srcu_cblist = RCU_SEGCBLIST_INITIALIZER(name.srcu_cblist), \
51 .srcu_work = __WORK_INITIALIZER(name.srcu_work, srcu_drive_gp), \
52 __SRCU_DEP_MAP_INIT(name) \
53}
54
55/*
56 * This odd _STATIC_ arrangement is needed for API compatibility with
57 * Tree SRCU, which needs some per-CPU data.
58 */
59#define DEFINE_SRCU(name) \
60 struct srcu_struct name = __SRCU_STRUCT_INIT(name)
61#define DEFINE_STATIC_SRCU(name) \
62 static struct srcu_struct name = __SRCU_STRUCT_INIT(name)
63
64void synchronize_srcu(struct srcu_struct *sp);
65
66static inline void synchronize_srcu_expedited(struct srcu_struct *sp)
67{
68 synchronize_srcu(sp);
69}
70
71static inline void srcu_barrier(struct srcu_struct *sp)
72{
73 synchronize_srcu(sp);
74}
75
76static inline unsigned long srcu_batches_completed(struct srcu_struct *sp)
77{
78 return 0;
79}
80
81static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
82 struct srcu_struct *sp, int *flags,
83 unsigned long *gpnum,
84 unsigned long *completed)
85{
86 if (test_type != SRCU_FLAVOR)
87 return;
88 *flags = 0;
89 *completed = sp->srcu_gp_seq;
90 *gpnum = *completed;
91}
92
93#endif
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
new file mode 100644
index 000000000000..32e86d85fd11
--- /dev/null
+++ b/include/linux/srcutree.h
@@ -0,0 +1,150 @@
1/*
2 * Sleepable Read-Copy Update mechanism for mutual exclusion,
3 * tree variant.
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; either version 2 of the License, or
8 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, you can access it online at
17 * http://www.gnu.org/licenses/gpl-2.0.html.
18 *
19 * Copyright (C) IBM Corporation, 2017
20 *
21 * Author: Paul McKenney <paulmck@us.ibm.com>
22 */
23
24#ifndef _LINUX_SRCU_TREE_H
25#define _LINUX_SRCU_TREE_H
26
27#include <linux/rcu_node_tree.h>
28#include <linux/completion.h>
29
30struct srcu_node;
31struct srcu_struct;
32
33/*
34 * Per-CPU structure feeding into leaf srcu_node, similar in function
35 * to rcu_node.
36 */
37struct srcu_data {
38 /* Read-side state. */
39 unsigned long srcu_lock_count[2]; /* Locks per CPU. */
40 unsigned long srcu_unlock_count[2]; /* Unlocks per CPU. */
41
42 /* Update-side state. */
43 spinlock_t lock ____cacheline_internodealigned_in_smp;
44 struct rcu_segcblist srcu_cblist; /* List of callbacks.*/
45 unsigned long srcu_gp_seq_needed; /* Furthest future GP needed. */
46 unsigned long srcu_gp_seq_needed_exp; /* Furthest future exp GP. */
47 bool srcu_cblist_invoking; /* Invoking these CBs? */
48 struct delayed_work work; /* Context for CB invoking. */
49 struct rcu_head srcu_barrier_head; /* For srcu_barrier() use. */
50 struct srcu_node *mynode; /* Leaf srcu_node. */
51 unsigned long grpmask; /* Mask for leaf srcu_node */
52 /* ->srcu_data_have_cbs[]. */
53 int cpu;
54 struct srcu_struct *sp;
55};
56
57/*
58 * Node in SRCU combining tree, similar in function to rcu_data.
59 */
60struct srcu_node {
61 spinlock_t lock;
62 unsigned long srcu_have_cbs[4]; /* GP seq for children */
63 /* having CBs, but only */
64 /* is > ->srcu_gq_seq. */
65 unsigned long srcu_data_have_cbs[4]; /* Which srcu_data structs */
66 /* have CBs for given GP? */
67 unsigned long srcu_gp_seq_needed_exp; /* Furthest future exp GP. */
68 struct srcu_node *srcu_parent; /* Next up in tree. */
69 int grplo; /* Least CPU for node. */
70 int grphi; /* Biggest CPU for node. */
71};
72
73/*
74 * Per-SRCU-domain structure, similar in function to rcu_state.
75 */
76struct srcu_struct {
77 struct srcu_node node[NUM_RCU_NODES]; /* Combining tree. */
78 struct srcu_node *level[RCU_NUM_LVLS + 1];
79 /* First node at each level. */
80 struct mutex srcu_cb_mutex; /* Serialize CB preparation. */
81 spinlock_t gp_lock; /* protect ->srcu_cblist */
82 struct mutex srcu_gp_mutex; /* Serialize GP work. */
83 unsigned int srcu_idx; /* Current rdr array element. */
84 unsigned long srcu_gp_seq; /* Grace-period seq #. */
85 unsigned long srcu_gp_seq_needed; /* Latest gp_seq needed. */
86 unsigned long srcu_gp_seq_needed_exp; /* Furthest future exp GP. */
87 unsigned long srcu_last_gp_end; /* Last GP end timestamp (ns) */
88 struct srcu_data __percpu *sda; /* Per-CPU srcu_data array. */
89 unsigned long srcu_barrier_seq; /* srcu_barrier seq #. */
90 struct mutex srcu_barrier_mutex; /* Serialize barrier ops. */
91 struct completion srcu_barrier_completion;
92 /* Awaken barrier rq at end. */
93 atomic_t srcu_barrier_cpu_cnt; /* # CPUs not yet posting a */
94 /* callback for the barrier */
95 /* operation. */
96 struct delayed_work work;
97#ifdef CONFIG_DEBUG_LOCK_ALLOC
98 struct lockdep_map dep_map;
99#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
100};
101
102/* Values for state variable (bottom bits of ->srcu_gp_seq). */
103#define SRCU_STATE_IDLE 0
104#define SRCU_STATE_SCAN1 1
105#define SRCU_STATE_SCAN2 2
106
107void process_srcu(struct work_struct *work);
108
109#define __SRCU_STRUCT_INIT(name) \
110 { \
111 .sda = &name##_srcu_data, \
112 .gp_lock = __SPIN_LOCK_UNLOCKED(name.gp_lock), \
113 .srcu_gp_seq_needed = 0 - 1, \
114 __SRCU_DEP_MAP_INIT(name) \
115 }
116
117/*
118 * Define and initialize a srcu struct at build time.
119 * Do -not- call init_srcu_struct() nor cleanup_srcu_struct() on it.
120 *
121 * Note that although DEFINE_STATIC_SRCU() hides the name from other
122 * files, the per-CPU variable rules nevertheless require that the
123 * chosen name be globally unique. These rules also prohibit use of
124 * DEFINE_STATIC_SRCU() within a function. If these rules are too
125 * restrictive, declare the srcu_struct manually. For example, in
126 * each file:
127 *
128 * static struct srcu_struct my_srcu;
129 *
130 * Then, before the first use of each my_srcu, manually initialize it:
131 *
132 * init_srcu_struct(&my_srcu);
133 *
134 * See include/linux/percpu-defs.h for the rules on per-CPU variables.
135 */
136#define __DEFINE_SRCU(name, is_static) \
137 static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data);\
138 is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name)
139#define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */)
140#define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static)
141
142void synchronize_srcu_expedited(struct srcu_struct *sp);
143void srcu_barrier(struct srcu_struct *sp);
144unsigned long srcu_batches_completed(struct srcu_struct *sp);
145
146void srcutorture_get_gp_data(enum rcutorture_type test_type,
147 struct srcu_struct *sp, int *flags,
148 unsigned long *gpnum, unsigned long *completed);
149
150#endif
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 0a34489a46b6..4205f71a5f0e 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -18,6 +18,8 @@ extern void save_stack_trace_regs(struct pt_regs *regs,
18 struct stack_trace *trace); 18 struct stack_trace *trace);
19extern void save_stack_trace_tsk(struct task_struct *tsk, 19extern void save_stack_trace_tsk(struct task_struct *tsk,
20 struct stack_trace *trace); 20 struct stack_trace *trace);
21extern int save_stack_trace_tsk_reliable(struct task_struct *tsk,
22 struct stack_trace *trace);
21 23
22extern void print_stack_trace(struct stack_trace *trace, int spaces); 24extern void print_stack_trace(struct stack_trace *trace, int spaces);
23extern int snprint_stack_trace(char *buf, size_t size, 25extern int snprint_stack_trace(char *buf, size_t size,
@@ -29,12 +31,13 @@ extern void save_stack_trace_user(struct stack_trace *trace);
29# define save_stack_trace_user(trace) do { } while (0) 31# define save_stack_trace_user(trace) do { } while (0)
30#endif 32#endif
31 33
32#else 34#else /* !CONFIG_STACKTRACE */
33# define save_stack_trace(trace) do { } while (0) 35# define save_stack_trace(trace) do { } while (0)
34# define save_stack_trace_tsk(tsk, trace) do { } while (0) 36# define save_stack_trace_tsk(tsk, trace) do { } while (0)
35# define save_stack_trace_user(trace) do { } while (0) 37# define save_stack_trace_user(trace) do { } while (0)
36# define print_stack_trace(trace, spaces) do { } while (0) 38# define print_stack_trace(trace, spaces) do { } while (0)
37# define snprint_stack_trace(buf, size, trace, spaces) do { } while (0) 39# define snprint_stack_trace(buf, size, trace, spaces) do { } while (0)
38#endif 40# define save_stack_trace_tsk_reliable(tsk, trace) ({ -ENOSYS; })
41#endif /* CONFIG_STACKTRACE */
39 42
40#endif 43#endif /* __LINUX_STACKTRACE_H */
diff --git a/include/linux/stat.h b/include/linux/stat.h
index c76e524fb34b..64b6b3aece21 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -26,6 +26,7 @@ struct kstat {
26 unsigned int nlink; 26 unsigned int nlink;
27 uint32_t blksize; /* Preferred I/O size */ 27 uint32_t blksize; /* Preferred I/O size */
28 u64 attributes; 28 u64 attributes;
29 u64 attributes_mask;
29#define KSTAT_ATTR_FS_IOC_FLAGS \ 30#define KSTAT_ATTR_FS_IOC_FLAGS \
30 (STATX_ATTR_COMPRESSED | \ 31 (STATX_ATTR_COMPRESSED | \
31 STATX_ATTR_IMMUTABLE | \ 32 STATX_ATTR_IMMUTABLE | \
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index fc273e9d5f67..3921cb9dfadb 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -28,6 +28,9 @@
28 28
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30 30
31#define MTL_MAX_RX_QUEUES 8
32#define MTL_MAX_TX_QUEUES 8
33
31#define STMMAC_RX_COE_NONE 0 34#define STMMAC_RX_COE_NONE 0
32#define STMMAC_RX_COE_TYPE1 1 35#define STMMAC_RX_COE_TYPE1 1
33#define STMMAC_RX_COE_TYPE2 2 36#define STMMAC_RX_COE_TYPE2 2
@@ -44,6 +47,18 @@
44#define STMMAC_CSR_150_250M 0x4 /* MDC = clk_scr_i/102 */ 47#define STMMAC_CSR_150_250M 0x4 /* MDC = clk_scr_i/102 */
45#define STMMAC_CSR_250_300M 0x5 /* MDC = clk_scr_i/122 */ 48#define STMMAC_CSR_250_300M 0x5 /* MDC = clk_scr_i/122 */
46 49
50/* MTL algorithms identifiers */
51#define MTL_TX_ALGORITHM_WRR 0x0
52#define MTL_TX_ALGORITHM_WFQ 0x1
53#define MTL_TX_ALGORITHM_DWRR 0x2
54#define MTL_TX_ALGORITHM_SP 0x3
55#define MTL_RX_ALGORITHM_SP 0x4
56#define MTL_RX_ALGORITHM_WSP 0x5
57
58/* RX/TX Queue Mode */
59#define MTL_QUEUE_AVB 0x0
60#define MTL_QUEUE_DCB 0x1
61
47/* The MDC clock could be set higher than the IEEE 802.3 62/* The MDC clock could be set higher than the IEEE 802.3
48 * specified frequency limit 0f 2.5 MHz, by programming a clock divider 63 * specified frequency limit 0f 2.5 MHz, by programming a clock divider
49 * of value different than the above defined values. The resultant MDIO 64 * of value different than the above defined values. The resultant MDIO
@@ -109,6 +124,26 @@ struct stmmac_axi {
109 bool axi_rb; 124 bool axi_rb;
110}; 125};
111 126
127struct stmmac_rxq_cfg {
128 u8 mode_to_use;
129 u8 chan;
130 u8 pkt_route;
131 bool use_prio;
132 u32 prio;
133};
134
135struct stmmac_txq_cfg {
136 u8 weight;
137 u8 mode_to_use;
138 /* Credit Base Shaper parameters */
139 u32 send_slope;
140 u32 idle_slope;
141 u32 high_credit;
142 u32 low_credit;
143 bool use_prio;
144 u32 prio;
145};
146
112struct plat_stmmacenet_data { 147struct plat_stmmacenet_data {
113 int bus_id; 148 int bus_id;
114 int phy_addr; 149 int phy_addr;
@@ -133,6 +168,12 @@ struct plat_stmmacenet_data {
133 int unicast_filter_entries; 168 int unicast_filter_entries;
134 int tx_fifo_size; 169 int tx_fifo_size;
135 int rx_fifo_size; 170 int rx_fifo_size;
171 u8 rx_queues_to_use;
172 u8 tx_queues_to_use;
173 u8 rx_sched_algorithm;
174 u8 tx_sched_algorithm;
175 struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES];
176 struct stmmac_txq_cfg tx_queues_cfg[MTL_MAX_TX_QUEUES];
136 void (*fix_mac_speed)(void *priv, unsigned int speed); 177 void (*fix_mac_speed)(void *priv, unsigned int speed);
137 int (*init)(struct platform_device *pdev, void *priv); 178 int (*init)(struct platform_device *pdev, void *priv);
138 void (*exit)(struct platform_device *pdev, void *priv); 179 void (*exit)(struct platform_device *pdev, void *priv);
diff --git a/include/linux/string.h b/include/linux/string.h
index 26b6f6a66f83..537918f8a98e 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -114,6 +114,14 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
114#ifndef __HAVE_ARCH_MEMCHR 114#ifndef __HAVE_ARCH_MEMCHR
115extern void * memchr(const void *,int,__kernel_size_t); 115extern void * memchr(const void *,int,__kernel_size_t);
116#endif 116#endif
117#ifndef __HAVE_ARCH_MEMCPY_MCSAFE
118static inline __must_check int memcpy_mcsafe(void *dst, const void *src,
119 size_t cnt)
120{
121 memcpy(dst, src, cnt);
122 return 0;
123}
124#endif
117void *memchr_inv(const void *s, int c, size_t n); 125void *memchr_inv(const void *s, int c, size_t n);
118char *strreplace(char *s, char old, char new); 126char *strreplace(char *s, char old, char new);
119 127
@@ -135,6 +143,16 @@ static inline int strtobool(const char *s, bool *res)
135} 143}
136 144
137int match_string(const char * const *array, size_t n, const char *string); 145int match_string(const char * const *array, size_t n, const char *string);
146int __sysfs_match_string(const char * const *array, size_t n, const char *s);
147
148/**
149 * sysfs_match_string - matches given string in an array
150 * @_a: array of strings
151 * @_s: string to match with
152 *
153 * Helper for __sysfs_match_string(). Calculates the size of @a automatically.
154 */
155#define sysfs_match_string(_a, _s) __sysfs_match_string(_a, ARRAY_SIZE(_a), _s)
138 156
139#ifdef CONFIG_BINARY_PRINTF 157#ifdef CONFIG_BINARY_PRINTF
140int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); 158int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
index 245fc59b7324..b7e85b341a54 100644
--- a/include/linux/sunrpc/rpc_rdma.h
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -143,6 +143,9 @@ enum rpcrdma_proc {
143#define rdma_done cpu_to_be32(RDMA_DONE) 143#define rdma_done cpu_to_be32(RDMA_DONE)
144#define rdma_error cpu_to_be32(RDMA_ERROR) 144#define rdma_error cpu_to_be32(RDMA_ERROR)
145 145
146#define err_vers cpu_to_be32(ERR_VERS)
147#define err_chunk cpu_to_be32(ERR_CHUNK)
148
146/* 149/*
147 * Private extension to RPC-over-RDMA Version One. 150 * Private extension to RPC-over-RDMA Version One.
148 * Message passed during RDMA-CM connection set-up. 151 * Message passed during RDMA-CM connection set-up.
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index e770abeed32d..94631026f79c 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -336,8 +336,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p)
336{ 336{
337 char *cp = (char *)p; 337 char *cp = (char *)p;
338 struct kvec *vec = &rqstp->rq_arg.head[0]; 338 struct kvec *vec = &rqstp->rq_arg.head[0];
339 return cp >= (char*)vec->iov_base 339 return cp == (char *)vec->iov_base + vec->iov_len;
340 && cp <= (char*)vec->iov_base + vec->iov_len;
341} 340}
342 341
343static inline int 342static inline int
@@ -474,6 +473,7 @@ void svc_pool_map_put(void);
474struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 473struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
475 struct svc_serv_ops *); 474 struct svc_serv_ops *);
476int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 475int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
476int svc_set_num_threads_sync(struct svc_serv *, struct svc_pool *, int);
477int svc_pool_stats_open(struct svc_serv *serv, struct file *file); 477int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
478void svc_destroy(struct svc_serv *); 478void svc_destroy(struct svc_serv *);
479void svc_shutdown_net(struct svc_serv *, struct net *); 479void svc_shutdown_net(struct svc_serv *, struct net *);
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index b105f73e3ca2..f3787d800ba4 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -48,6 +48,12 @@
48#include <rdma/rdma_cm.h> 48#include <rdma/rdma_cm.h>
49#define SVCRDMA_DEBUG 49#define SVCRDMA_DEBUG
50 50
51/* Default and maximum inline threshold sizes */
52enum {
53 RPCRDMA_DEF_INLINE_THRESH = 4096,
54 RPCRDMA_MAX_INLINE_THRESH = 65536
55};
56
51/* RPC/RDMA parameters and stats */ 57/* RPC/RDMA parameters and stats */
52extern unsigned int svcrdma_ord; 58extern unsigned int svcrdma_ord;
53extern unsigned int svcrdma_max_requests; 59extern unsigned int svcrdma_max_requests;
@@ -85,27 +91,11 @@ struct svc_rdma_op_ctxt {
85 enum dma_data_direction direction; 91 enum dma_data_direction direction;
86 int count; 92 int count;
87 unsigned int mapped_sges; 93 unsigned int mapped_sges;
88 struct ib_sge sge[RPCSVC_MAXPAGES]; 94 struct ib_send_wr send_wr;
95 struct ib_sge sge[1 + RPCRDMA_MAX_INLINE_THRESH / PAGE_SIZE];
89 struct page *pages[RPCSVC_MAXPAGES]; 96 struct page *pages[RPCSVC_MAXPAGES];
90}; 97};
91 98
92/*
93 * NFS_ requests are mapped on the client side by the chunk lists in
94 * the RPCRDMA header. During the fetching of the RPC from the client
95 * and the writing of the reply to the client, the memory in the
96 * client and the memory in the server must be mapped as contiguous
97 * vaddr/len for access by the hardware. These data strucures keep
98 * these mappings.
99 *
100 * For an RDMA_WRITE, the 'sge' maps the RPC REPLY. For RDMA_READ, the
101 * 'sge' in the svc_rdma_req_map maps the server side RPC reply and the
102 * 'ch' field maps the read-list of the RPCRDMA header to the 'sge'
103 * mapping of the reply.
104 */
105struct svc_rdma_chunk_sge {
106 int start; /* sge no for this chunk */
107 int count; /* sge count for this chunk */
108};
109struct svc_rdma_fastreg_mr { 99struct svc_rdma_fastreg_mr {
110 struct ib_mr *mr; 100 struct ib_mr *mr;
111 struct scatterlist *sg; 101 struct scatterlist *sg;
@@ -114,15 +104,7 @@ struct svc_rdma_fastreg_mr {
114 enum dma_data_direction direction; 104 enum dma_data_direction direction;
115 struct list_head frmr_list; 105 struct list_head frmr_list;
116}; 106};
117struct svc_rdma_req_map { 107
118 struct list_head free;
119 unsigned long count;
120 union {
121 struct kvec sge[RPCSVC_MAXPAGES];
122 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES];
123 unsigned long lkey[RPCSVC_MAXPAGES];
124 };
125};
126#define RDMACTXT_F_LAST_CTXT 2 108#define RDMACTXT_F_LAST_CTXT 2
127 109
128#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */ 110#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */
@@ -144,14 +126,15 @@ struct svcxprt_rdma {
144 u32 sc_max_requests; /* Max requests */ 126 u32 sc_max_requests; /* Max requests */
145 u32 sc_max_bc_requests;/* Backward credits */ 127 u32 sc_max_bc_requests;/* Backward credits */
146 int sc_max_req_size; /* Size of each RQ WR buf */ 128 int sc_max_req_size; /* Size of each RQ WR buf */
129 u8 sc_port_num;
147 130
148 struct ib_pd *sc_pd; 131 struct ib_pd *sc_pd;
149 132
150 spinlock_t sc_ctxt_lock; 133 spinlock_t sc_ctxt_lock;
151 struct list_head sc_ctxts; 134 struct list_head sc_ctxts;
152 int sc_ctxt_used; 135 int sc_ctxt_used;
153 spinlock_t sc_map_lock; 136 spinlock_t sc_rw_ctxt_lock;
154 struct list_head sc_maps; 137 struct list_head sc_rw_ctxts;
155 138
156 struct list_head sc_rq_dto_q; 139 struct list_head sc_rq_dto_q;
157 spinlock_t sc_rq_dto_lock; 140 spinlock_t sc_rq_dto_lock;
@@ -181,9 +164,7 @@ struct svcxprt_rdma {
181/* The default ORD value is based on two outstanding full-size writes with a 164/* The default ORD value is based on two outstanding full-size writes with a
182 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */ 165 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */
183#define RPCRDMA_ORD (64/4) 166#define RPCRDMA_ORD (64/4)
184#define RPCRDMA_SQ_DEPTH_MULT 8
185#define RPCRDMA_MAX_REQUESTS 32 167#define RPCRDMA_MAX_REQUESTS 32
186#define RPCRDMA_MAX_REQ_SIZE 4096
187 168
188/* Typical ULP usage of BC requests is NFSv4.1 backchannel. Our 169/* Typical ULP usage of BC requests is NFSv4.1 backchannel. Our
189 * current NFSv4.1 implementation supports one backchannel slot. 170 * current NFSv4.1 implementation supports one backchannel slot.
@@ -201,19 +182,11 @@ static inline void svc_rdma_count_mappings(struct svcxprt_rdma *rdma,
201 182
202/* svc_rdma_backchannel.c */ 183/* svc_rdma_backchannel.c */
203extern int svc_rdma_handle_bc_reply(struct rpc_xprt *xprt, 184extern int svc_rdma_handle_bc_reply(struct rpc_xprt *xprt,
204 struct rpcrdma_msg *rmsgp, 185 __be32 *rdma_resp,
205 struct xdr_buf *rcvbuf); 186 struct xdr_buf *rcvbuf);
206 187
207/* svc_rdma_marshal.c */ 188/* svc_rdma_marshal.c */
208extern int svc_rdma_xdr_decode_req(struct xdr_buf *); 189extern int svc_rdma_xdr_decode_req(struct xdr_buf *);
209extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *,
210 struct rpcrdma_msg *,
211 enum rpcrdma_errcode, __be32 *);
212extern void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *, int);
213extern void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *, int);
214extern void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *, int,
215 __be32, __be64, u32);
216extern unsigned int svc_rdma_xdr_get_reply_hdr_len(__be32 *rdma_resp);
217 190
218/* svc_rdma_recvfrom.c */ 191/* svc_rdma_recvfrom.c */
219extern int svc_rdma_recvfrom(struct svc_rqst *); 192extern int svc_rdma_recvfrom(struct svc_rqst *);
@@ -224,16 +197,25 @@ extern int rdma_read_chunk_frmr(struct svcxprt_rdma *, struct svc_rqst *,
224 struct svc_rdma_op_ctxt *, int *, u32 *, 197 struct svc_rdma_op_ctxt *, int *, u32 *,
225 u32, u32, u64, bool); 198 u32, u32, u64, bool);
226 199
200/* svc_rdma_rw.c */
201extern void svc_rdma_destroy_rw_ctxts(struct svcxprt_rdma *rdma);
202extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma,
203 __be32 *wr_ch, struct xdr_buf *xdr);
204extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
205 __be32 *rp_ch, bool writelist,
206 struct xdr_buf *xdr);
207
227/* svc_rdma_sendto.c */ 208/* svc_rdma_sendto.c */
228extern int svc_rdma_map_xdr(struct svcxprt_rdma *, struct xdr_buf *, 209extern int svc_rdma_map_reply_hdr(struct svcxprt_rdma *rdma,
229 struct svc_rdma_req_map *, bool); 210 struct svc_rdma_op_ctxt *ctxt,
211 __be32 *rdma_resp, unsigned int len);
212extern int svc_rdma_post_send_wr(struct svcxprt_rdma *rdma,
213 struct svc_rdma_op_ctxt *ctxt,
214 int num_sge, u32 inv_rkey);
230extern int svc_rdma_sendto(struct svc_rqst *); 215extern int svc_rdma_sendto(struct svc_rqst *);
231extern void svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
232 int);
233 216
234/* svc_rdma_transport.c */ 217/* svc_rdma_transport.c */
235extern void svc_rdma_wc_send(struct ib_cq *, struct ib_wc *); 218extern void svc_rdma_wc_send(struct ib_cq *, struct ib_wc *);
236extern void svc_rdma_wc_write(struct ib_cq *, struct ib_wc *);
237extern void svc_rdma_wc_reg(struct ib_cq *, struct ib_wc *); 219extern void svc_rdma_wc_reg(struct ib_cq *, struct ib_wc *);
238extern void svc_rdma_wc_read(struct ib_cq *, struct ib_wc *); 220extern void svc_rdma_wc_read(struct ib_cq *, struct ib_wc *);
239extern void svc_rdma_wc_inv(struct ib_cq *, struct ib_wc *); 221extern void svc_rdma_wc_inv(struct ib_cq *, struct ib_wc *);
@@ -244,9 +226,6 @@ extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
244extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); 226extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
245extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); 227extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
246extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt); 228extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt);
247extern struct svc_rdma_req_map *svc_rdma_get_req_map(struct svcxprt_rdma *);
248extern void svc_rdma_put_req_map(struct svcxprt_rdma *,
249 struct svc_rdma_req_map *);
250extern struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *); 229extern struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *);
251extern void svc_rdma_put_frmr(struct svcxprt_rdma *, 230extern void svc_rdma_put_frmr(struct svcxprt_rdma *,
252 struct svc_rdma_fastreg_mr *); 231 struct svc_rdma_fastreg_mr *);
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index d9718378a8be..0b1cf32edfd7 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -189,6 +189,8 @@ struct platform_suspend_ops {
189struct platform_freeze_ops { 189struct platform_freeze_ops {
190 int (*begin)(void); 190 int (*begin)(void);
191 int (*prepare)(void); 191 int (*prepare)(void);
192 void (*wake)(void);
193 void (*sync)(void);
192 void (*restore)(void); 194 void (*restore)(void);
193 void (*end)(void); 195 void (*end)(void);
194}; 196};
@@ -428,7 +430,8 @@ extern unsigned int pm_wakeup_irq;
428 430
429extern bool pm_wakeup_pending(void); 431extern bool pm_wakeup_pending(void);
430extern void pm_system_wakeup(void); 432extern void pm_system_wakeup(void);
431extern void pm_wakeup_clear(void); 433extern void pm_system_cancel_wakeup(void);
434extern void pm_wakeup_clear(bool reset);
432extern void pm_system_irq_wakeup(unsigned int irq_number); 435extern void pm_system_irq_wakeup(unsigned int irq_number);
433extern bool pm_get_wakeup_count(unsigned int *count, bool block); 436extern bool pm_get_wakeup_count(unsigned int *count, bool block);
434extern bool pm_save_wakeup_count(unsigned int count); 437extern bool pm_save_wakeup_count(unsigned int count);
@@ -478,7 +481,7 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
478 481
479static inline bool pm_wakeup_pending(void) { return false; } 482static inline bool pm_wakeup_pending(void) { return false; }
480static inline void pm_system_wakeup(void) {} 483static inline void pm_system_wakeup(void) {}
481static inline void pm_wakeup_clear(void) {} 484static inline void pm_wakeup_clear(bool reset) {}
482static inline void pm_system_irq_wakeup(unsigned int irq_number) {} 485static inline void pm_system_irq_wakeup(unsigned int irq_number) {}
483 486
484static inline void lock_system_sleep(void) {} 487static inline void lock_system_sleep(void) {}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 45e91dd6716d..ba5882419a7d 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -279,7 +279,7 @@ extern void lru_add_drain_cpu(int cpu);
279extern void lru_add_drain_all(void); 279extern void lru_add_drain_all(void);
280extern void rotate_reclaimable_page(struct page *page); 280extern void rotate_reclaimable_page(struct page *page);
281extern void deactivate_file_page(struct page *page); 281extern void deactivate_file_page(struct page *page);
282extern void deactivate_page(struct page *page); 282extern void mark_page_lazyfree(struct page *page);
283extern void swap_setup(void); 283extern void swap_setup(void);
284 284
285extern void add_page_to_unevictable_list(struct page *page); 285extern void add_page_to_unevictable_list(struct page *page);
@@ -411,9 +411,6 @@ struct backing_dev_info;
411extern int init_swap_address_space(unsigned int type, unsigned long nr_pages); 411extern int init_swap_address_space(unsigned int type, unsigned long nr_pages);
412extern void exit_swap_address_space(unsigned int type); 412extern void exit_swap_address_space(unsigned int type);
413 413
414extern int get_swap_slots(int n, swp_entry_t *slots);
415extern void swapcache_free_batch(swp_entry_t *entries, int n);
416
417#else /* CONFIG_SWAP */ 414#else /* CONFIG_SWAP */
418 415
419#define swap_address_space(entry) (NULL) 416#define swap_address_space(entry) (NULL)
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index b7e82049fec7..80d07816def0 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -180,7 +180,6 @@ extern void setup_sysctl_set(struct ctl_table_set *p,
180 int (*is_seen)(struct ctl_table_set *)); 180 int (*is_seen)(struct ctl_table_set *));
181extern void retire_sysctl_set(struct ctl_table_set *set); 181extern void retire_sysctl_set(struct ctl_table_set *set);
182 182
183void register_sysctl_root(struct ctl_table_root *root);
184struct ctl_table_header *__register_sysctl_table( 183struct ctl_table_header *__register_sysctl_table(
185 struct ctl_table_set *set, 184 struct ctl_table_set *set,
186 const char *path, struct ctl_table *table); 185 const char *path, struct ctl_table *table);
diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h
index 9fba9dd33544..9375d23a24e7 100644
--- a/include/linux/t10-pi.h
+++ b/include/linux/t10-pi.h
@@ -34,9 +34,9 @@ struct t10_pi_tuple {
34}; 34};
35 35
36 36
37extern struct blk_integrity_profile t10_pi_type1_crc; 37extern const struct blk_integrity_profile t10_pi_type1_crc;
38extern struct blk_integrity_profile t10_pi_type1_ip; 38extern const struct blk_integrity_profile t10_pi_type1_ip;
39extern struct blk_integrity_profile t10_pi_type3_crc; 39extern const struct blk_integrity_profile t10_pi_type3_crc;
40extern struct blk_integrity_profile t10_pi_type3_ip; 40extern const struct blk_integrity_profile t10_pi_type3_ip;
41 41
42#endif 42#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index cfc2d9506ce8..b6d5adcee8fc 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -233,12 +233,14 @@ struct tcp_sock {
233 u8 syn_data:1, /* SYN includes data */ 233 u8 syn_data:1, /* SYN includes data */
234 syn_fastopen:1, /* SYN includes Fast Open option */ 234 syn_fastopen:1, /* SYN includes Fast Open option */
235 syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */ 235 syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */
236 syn_fastopen_ch:1, /* Active TFO re-enabling probe */
236 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */ 237 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
237 save_syn:1, /* Save headers of SYN packet */ 238 save_syn:1, /* Save headers of SYN packet */
238 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */ 239 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
239 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 240 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
240 241
241/* RTT measurement */ 242/* RTT measurement */
243 struct skb_mstamp tcp_mstamp; /* most recent packet received/sent */
242 u32 srtt_us; /* smoothed round trip time << 3 in usecs */ 244 u32 srtt_us; /* smoothed round trip time << 3 in usecs */
243 u32 mdev_us; /* medium deviation */ 245 u32 mdev_us; /* medium deviation */
244 u32 mdev_max_us; /* maximal mdev for the last rtt period */ 246 u32 mdev_max_us; /* maximal mdev for the last rtt period */
@@ -331,16 +333,16 @@ struct tcp_sock {
331 333
332/* Receiver side RTT estimation */ 334/* Receiver side RTT estimation */
333 struct { 335 struct {
334 u32 rtt; 336 u32 rtt_us;
335 u32 seq; 337 u32 seq;
336 u32 time; 338 struct skb_mstamp time;
337 } rcv_rtt_est; 339 } rcv_rtt_est;
338 340
339/* Receiver queue space */ 341/* Receiver queue space */
340 struct { 342 struct {
341 int space; 343 int space;
342 u32 seq; 344 u32 seq;
343 u32 time; 345 struct skb_mstamp time;
344 } rcvq_space; 346 } rcvq_space;
345 347
346/* TCP-specific MTU probe information. */ 348/* TCP-specific MTU probe information. */
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
new file mode 100644
index 000000000000..0f175b8f6456
--- /dev/null
+++ b/include/linux/tee_drv.h
@@ -0,0 +1,277 @@
1/*
2 * Copyright (c) 2015-2016, Linaro Limited
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef __TEE_DRV_H
16#define __TEE_DRV_H
17
18#include <linux/types.h>
19#include <linux/idr.h>
20#include <linux/list.h>
21#include <linux/tee.h>
22
23/*
24 * The file describes the API provided by the generic TEE driver to the
25 * specific TEE driver.
26 */
27
28#define TEE_SHM_MAPPED 0x1 /* Memory mapped by the kernel */
29#define TEE_SHM_DMA_BUF 0x2 /* Memory with dma-buf handle */
30
31struct tee_device;
32struct tee_shm;
33struct tee_shm_pool;
34
35/**
36 * struct tee_context - driver specific context on file pointer data
37 * @teedev: pointer to this drivers struct tee_device
38 * @list_shm: List of shared memory object owned by this context
39 * @data: driver specific context data, managed by the driver
40 */
41struct tee_context {
42 struct tee_device *teedev;
43 struct list_head list_shm;
44 void *data;
45};
46
47struct tee_param_memref {
48 size_t shm_offs;
49 size_t size;
50 struct tee_shm *shm;
51};
52
53struct tee_param_value {
54 u64 a;
55 u64 b;
56 u64 c;
57};
58
59struct tee_param {
60 u64 attr;
61 union {
62 struct tee_param_memref memref;
63 struct tee_param_value value;
64 } u;
65};
66
67/**
68 * struct tee_driver_ops - driver operations vtable
69 * @get_version: returns version of driver
70 * @open: called when the device file is opened
71 * @release: release this open file
72 * @open_session: open a new session
73 * @close_session: close a session
74 * @invoke_func: invoke a trusted function
75 * @cancel_req: request cancel of an ongoing invoke or open
76 * @supp_revc: called for supplicant to get a command
77 * @supp_send: called for supplicant to send a response
78 */
79struct tee_driver_ops {
80 void (*get_version)(struct tee_device *teedev,
81 struct tee_ioctl_version_data *vers);
82 int (*open)(struct tee_context *ctx);
83 void (*release)(struct tee_context *ctx);
84 int (*open_session)(struct tee_context *ctx,
85 struct tee_ioctl_open_session_arg *arg,
86 struct tee_param *param);
87 int (*close_session)(struct tee_context *ctx, u32 session);
88 int (*invoke_func)(struct tee_context *ctx,
89 struct tee_ioctl_invoke_arg *arg,
90 struct tee_param *param);
91 int (*cancel_req)(struct tee_context *ctx, u32 cancel_id, u32 session);
92 int (*supp_recv)(struct tee_context *ctx, u32 *func, u32 *num_params,
93 struct tee_param *param);
94 int (*supp_send)(struct tee_context *ctx, u32 ret, u32 num_params,
95 struct tee_param *param);
96};
97
98/**
99 * struct tee_desc - Describes the TEE driver to the subsystem
100 * @name: name of driver
101 * @ops: driver operations vtable
102 * @owner: module providing the driver
103 * @flags: Extra properties of driver, defined by TEE_DESC_* below
104 */
105#define TEE_DESC_PRIVILEGED 0x1
106struct tee_desc {
107 const char *name;
108 const struct tee_driver_ops *ops;
109 struct module *owner;
110 u32 flags;
111};
112
113/**
114 * tee_device_alloc() - Allocate a new struct tee_device instance
115 * @teedesc: Descriptor for this driver
116 * @dev: Parent device for this device
117 * @pool: Shared memory pool, NULL if not used
118 * @driver_data: Private driver data for this device
119 *
120 * Allocates a new struct tee_device instance. The device is
121 * removed by tee_device_unregister().
122 *
123 * @returns a pointer to a 'struct tee_device' or an ERR_PTR on failure
124 */
125struct tee_device *tee_device_alloc(const struct tee_desc *teedesc,
126 struct device *dev,
127 struct tee_shm_pool *pool,
128 void *driver_data);
129
130/**
131 * tee_device_register() - Registers a TEE device
132 * @teedev: Device to register
133 *
134 * tee_device_unregister() need to be called to remove the @teedev if
135 * this function fails.
136 *
137 * @returns < 0 on failure
138 */
139int tee_device_register(struct tee_device *teedev);
140
141/**
142 * tee_device_unregister() - Removes a TEE device
143 * @teedev: Device to unregister
144 *
145 * This function should be called to remove the @teedev even if
146 * tee_device_register() hasn't been called yet. Does nothing if
147 * @teedev is NULL.
148 */
149void tee_device_unregister(struct tee_device *teedev);
150
151/**
152 * struct tee_shm_pool_mem_info - holds information needed to create a shared
153 * memory pool
154 * @vaddr: Virtual address of start of pool
155 * @paddr: Physical address of start of pool
156 * @size: Size in bytes of the pool
157 */
158struct tee_shm_pool_mem_info {
159 unsigned long vaddr;
160 phys_addr_t paddr;
161 size_t size;
162};
163
164/**
165 * tee_shm_pool_alloc_res_mem() - Create a shared memory pool from reserved
166 * memory range
167 * @priv_info: Information for driver private shared memory pool
168 * @dmabuf_info: Information for dma-buf shared memory pool
169 *
170 * Start and end of pools will must be page aligned.
171 *
172 * Allocation with the flag TEE_SHM_DMA_BUF set will use the range supplied
173 * in @dmabuf, others will use the range provided by @priv.
174 *
175 * @returns pointer to a 'struct tee_shm_pool' or an ERR_PTR on failure.
176 */
177struct tee_shm_pool *
178tee_shm_pool_alloc_res_mem(struct tee_shm_pool_mem_info *priv_info,
179 struct tee_shm_pool_mem_info *dmabuf_info);
180
181/**
182 * tee_shm_pool_free() - Free a shared memory pool
183 * @pool: The shared memory pool to free
184 *
185 * The must be no remaining shared memory allocated from this pool when
186 * this function is called.
187 */
188void tee_shm_pool_free(struct tee_shm_pool *pool);
189
190/**
191 * tee_get_drvdata() - Return driver_data pointer
192 * @returns the driver_data pointer supplied to tee_register().
193 */
194void *tee_get_drvdata(struct tee_device *teedev);
195
196/**
197 * tee_shm_alloc() - Allocate shared memory
198 * @ctx: Context that allocates the shared memory
199 * @size: Requested size of shared memory
200 * @flags: Flags setting properties for the requested shared memory.
201 *
202 * Memory allocated as global shared memory is automatically freed when the
203 * TEE file pointer is closed. The @flags field uses the bits defined by
204 * TEE_SHM_* above. TEE_SHM_MAPPED must currently always be set. If
205 * TEE_SHM_DMA_BUF global shared memory will be allocated and associated
206 * with a dma-buf handle, else driver private memory.
207 *
208 * @returns a pointer to 'struct tee_shm'
209 */
210struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags);
211
212/**
213 * tee_shm_free() - Free shared memory
214 * @shm: Handle to shared memory to free
215 */
216void tee_shm_free(struct tee_shm *shm);
217
218/**
219 * tee_shm_put() - Decrease reference count on a shared memory handle
220 * @shm: Shared memory handle
221 */
222void tee_shm_put(struct tee_shm *shm);
223
224/**
225 * tee_shm_va2pa() - Get physical address of a virtual address
226 * @shm: Shared memory handle
227 * @va: Virtual address to tranlsate
228 * @pa: Returned physical address
229 * @returns 0 on success and < 0 on failure
230 */
231int tee_shm_va2pa(struct tee_shm *shm, void *va, phys_addr_t *pa);
232
233/**
234 * tee_shm_pa2va() - Get virtual address of a physical address
235 * @shm: Shared memory handle
236 * @pa: Physical address to tranlsate
237 * @va: Returned virtual address
238 * @returns 0 on success and < 0 on failure
239 */
240int tee_shm_pa2va(struct tee_shm *shm, phys_addr_t pa, void **va);
241
242/**
243 * tee_shm_get_va() - Get virtual address of a shared memory plus an offset
244 * @shm: Shared memory handle
245 * @offs: Offset from start of this shared memory
246 * @returns virtual address of the shared memory + offs if offs is within
247 * the bounds of this shared memory, else an ERR_PTR
248 */
249void *tee_shm_get_va(struct tee_shm *shm, size_t offs);
250
251/**
252 * tee_shm_get_pa() - Get physical address of a shared memory plus an offset
253 * @shm: Shared memory handle
254 * @offs: Offset from start of this shared memory
255 * @pa: Physical address to return
256 * @returns 0 if offs is within the bounds of this shared memory, else an
257 * error code.
258 */
259int tee_shm_get_pa(struct tee_shm *shm, size_t offs, phys_addr_t *pa);
260
261/**
262 * tee_shm_get_id() - Get id of a shared memory object
263 * @shm: Shared memory handle
264 * @returns id
265 */
266int tee_shm_get_id(struct tee_shm *shm);
267
268/**
269 * tee_shm_get_from_id() - Find shared memory object and increase reference
270 * count
271 * @ctx: Context owning the shared memory
272 * @id: Id of shared memory object
273 * @returns a pointer to 'struct tee_shm' on success or an ERR_PTR on failure
274 */
275struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id);
276
277#endif /*__TEE_DRV_H*/
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 58373875e8ee..d7d3ea637dd0 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -22,6 +22,18 @@
22#endif 22#endif
23 23
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25
26/*
27 * For per-arch arch_within_stack_frames() implementations, defined in
28 * asm/thread_info.h.
29 */
30enum {
31 BAD_STACK = -1,
32 NOT_STACK = 0,
33 GOOD_FRAME,
34 GOOD_STACK,
35};
36
25#include <asm/thread_info.h> 37#include <asm/thread_info.h>
26 38
27#ifdef __KERNEL__ 39#ifdef __KERNEL__
@@ -101,6 +113,10 @@ static inline void check_object_size(const void *ptr, unsigned long n,
101{ } 113{ }
102#endif /* CONFIG_HARDENED_USERCOPY */ 114#endif /* CONFIG_HARDENED_USERCOPY */
103 115
116#ifndef arch_setup_new_exec
117static inline void arch_setup_new_exec(void) { }
118#endif
119
104#endif /* __KERNEL__ */ 120#endif /* __KERNEL__ */
105 121
106#endif /* _LINUX_THREAD_INFO_H */ 122#endif /* _LINUX_THREAD_INFO_H */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index a04fea19676f..fe01e68bf520 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -117,6 +117,7 @@ extern void tick_nohz_idle_enter(void);
117extern void tick_nohz_idle_exit(void); 117extern void tick_nohz_idle_exit(void);
118extern void tick_nohz_irq_exit(void); 118extern void tick_nohz_irq_exit(void);
119extern ktime_t tick_nohz_get_sleep_length(void); 119extern ktime_t tick_nohz_get_sleep_length(void);
120extern unsigned long tick_nohz_get_idle_calls(void);
120extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 121extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
121extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 122extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
122#else /* !CONFIG_NO_HZ_COMMON */ 123#else /* !CONFIG_NO_HZ_COMMON */
diff --git a/include/linux/time.h b/include/linux/time.h
index 23f0f5ce3090..c0543f5f25de 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -151,9 +151,6 @@ static inline bool timespec_inject_offset_valid(const struct timespec *ts)
151 return true; 151 return true;
152} 152}
153 153
154#define CURRENT_TIME (current_kernel_time())
155#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
156
157/* Some architectures do not supply their own clocksource. 154/* Some architectures do not supply their own clocksource.
158 * This is mainly the case in architectures that get their 155 * This is mainly the case in architectures that get their
159 * inter-tick times by reading the counter on their interval 156 * inter-tick times by reading the counter on their interval
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b598cbc7b576..ddc229ff6d1e 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -19,21 +19,6 @@ extern void do_gettimeofday(struct timeval *tv);
19extern int do_settimeofday64(const struct timespec64 *ts); 19extern int do_settimeofday64(const struct timespec64 *ts);
20extern int do_sys_settimeofday64(const struct timespec64 *tv, 20extern int do_sys_settimeofday64(const struct timespec64 *tv,
21 const struct timezone *tz); 21 const struct timezone *tz);
22static inline int do_sys_settimeofday(const struct timespec *tv,
23 const struct timezone *tz)
24{
25 struct timespec64 ts64;
26
27 if (!tv)
28 return do_sys_settimeofday64(NULL, tz);
29
30 if (!timespec_valid(tv))
31 return -EINVAL;
32
33 ts64 = timespec_to_timespec64(*tv);
34 return do_sys_settimeofday64(&ts64, tz);
35}
36
37/* 22/*
38 * Kernel time accessors 23 * Kernel time accessors
39 */ 24 */
@@ -273,6 +258,11 @@ static inline void timekeeping_clocktai(struct timespec *ts)
273 *ts = ktime_to_timespec(ktime_get_clocktai()); 258 *ts = ktime_to_timespec(ktime_get_clocktai());
274} 259}
275 260
261static inline void timekeeping_clocktai64(struct timespec64 *ts)
262{
263 *ts = ktime_to_timespec64(ktime_get_clocktai());
264}
265
276/* 266/*
277 * RTC specific 267 * RTC specific
278 */ 268 */
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index da158f06e0b2..5a090f5ab335 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -48,7 +48,8 @@ struct tpm_class_ops {
48 u8 (*status) (struct tpm_chip *chip); 48 u8 (*status) (struct tpm_chip *chip);
49 bool (*update_timeouts)(struct tpm_chip *chip, 49 bool (*update_timeouts)(struct tpm_chip *chip,
50 unsigned long *timeout_cap); 50 unsigned long *timeout_cap);
51 51 int (*request_locality)(struct tpm_chip *chip, int loc);
52 void (*relinquish_locality)(struct tpm_chip *chip, int loc);
52}; 53};
53 54
54#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) 55#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE)
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index 0af63c4381b9..a556805eff8a 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -138,16 +138,7 @@ enum print_line_t {
138 TRACE_TYPE_NO_CONSUME = 3 /* Handled but ask to not consume */ 138 TRACE_TYPE_NO_CONSUME = 3 /* Handled but ask to not consume */
139}; 139};
140 140
141/* 141enum print_line_t trace_handle_return(struct trace_seq *s);
142 * Several functions return TRACE_TYPE_PARTIAL_LINE if the trace_seq
143 * overflowed, and TRACE_TYPE_HANDLED otherwise. This helper function
144 * simplifies those functions and keeps them in sync.
145 */
146static inline enum print_line_t trace_handle_return(struct trace_seq *s)
147{
148 return trace_seq_has_overflowed(s) ?
149 TRACE_TYPE_PARTIAL_LINE : TRACE_TYPE_HANDLED;
150}
151 142
152void tracing_generic_entry_update(struct trace_entry *entry, 143void tracing_generic_entry_update(struct trace_entry *entry,
153 unsigned long flags, 144 unsigned long flags,
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index f72fcfe0e66a..cc48cb2ce209 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -128,7 +128,7 @@ extern void syscall_unregfunc(void);
128 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just 128 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
129 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". 129 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
130 */ 130 */
131#define __DO_TRACE(tp, proto, args, cond, prercu, postrcu) \ 131#define __DO_TRACE(tp, proto, args, cond, rcucheck) \
132 do { \ 132 do { \
133 struct tracepoint_func *it_func_ptr; \ 133 struct tracepoint_func *it_func_ptr; \
134 void *it_func; \ 134 void *it_func; \
@@ -136,7 +136,11 @@ extern void syscall_unregfunc(void);
136 \ 136 \
137 if (!(cond)) \ 137 if (!(cond)) \
138 return; \ 138 return; \
139 prercu; \ 139 if (rcucheck) { \
140 if (WARN_ON_ONCE(rcu_irq_enter_disabled())) \
141 return; \
142 rcu_irq_enter_irqson(); \
143 } \
140 rcu_read_lock_sched_notrace(); \ 144 rcu_read_lock_sched_notrace(); \
141 it_func_ptr = rcu_dereference_sched((tp)->funcs); \ 145 it_func_ptr = rcu_dereference_sched((tp)->funcs); \
142 if (it_func_ptr) { \ 146 if (it_func_ptr) { \
@@ -147,20 +151,19 @@ extern void syscall_unregfunc(void);
147 } while ((++it_func_ptr)->func); \ 151 } while ((++it_func_ptr)->func); \
148 } \ 152 } \
149 rcu_read_unlock_sched_notrace(); \ 153 rcu_read_unlock_sched_notrace(); \
150 postrcu; \ 154 if (rcucheck) \
155 rcu_irq_exit_irqson(); \
151 } while (0) 156 } while (0)
152 157
153#ifndef MODULE 158#ifndef MODULE
154#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args) \ 159#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args) \
155 static inline void trace_##name##_rcuidle(proto) \ 160 static inline void trace_##name##_rcuidle(proto) \
156 { \ 161 { \
157 if (static_key_false(&__tracepoint_##name.key)) \ 162 if (static_key_false(&__tracepoint_##name.key)) \
158 __DO_TRACE(&__tracepoint_##name, \ 163 __DO_TRACE(&__tracepoint_##name, \
159 TP_PROTO(data_proto), \ 164 TP_PROTO(data_proto), \
160 TP_ARGS(data_args), \ 165 TP_ARGS(data_args), \
161 TP_CONDITION(cond), \ 166 TP_CONDITION(cond), 1); \
162 rcu_irq_enter_irqson(), \
163 rcu_irq_exit_irqson()); \
164 } 167 }
165#else 168#else
166#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args) 169#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args)
@@ -186,7 +189,7 @@ extern void syscall_unregfunc(void);
186 __DO_TRACE(&__tracepoint_##name, \ 189 __DO_TRACE(&__tracepoint_##name, \
187 TP_PROTO(data_proto), \ 190 TP_PROTO(data_proto), \
188 TP_ARGS(data_args), \ 191 TP_ARGS(data_args), \
189 TP_CONDITION(cond),,); \ 192 TP_CONDITION(cond), 0); \
190 if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \ 193 if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
191 rcu_read_lock_sched_notrace(); \ 194 rcu_read_lock_sched_notrace(); \
192 rcu_dereference_sched(__tracepoint_##name.funcs);\ 195 rcu_dereference_sched(__tracepoint_##name.funcs);\
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1017e904c0a3..eccb4ec30a8a 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -390,7 +390,6 @@ static inline bool tty_throttled(struct tty_struct *tty)
390} 390}
391 391
392#ifdef CONFIG_TTY 392#ifdef CONFIG_TTY
393extern void console_init(void);
394extern void tty_kref_put(struct tty_struct *tty); 393extern void tty_kref_put(struct tty_struct *tty);
395extern struct pid *tty_get_pgrp(struct tty_struct *tty); 394extern struct pid *tty_get_pgrp(struct tty_struct *tty);
396extern void tty_vhangup_self(void); 395extern void tty_vhangup_self(void);
@@ -402,8 +401,6 @@ extern struct tty_struct *get_current_tty(void);
402extern int __init tty_init(void); 401extern int __init tty_init(void);
403extern const char *tty_name(const struct tty_struct *tty); 402extern const char *tty_name(const struct tty_struct *tty);
404#else 403#else
405static inline void console_init(void)
406{ }
407static inline void tty_kref_put(struct tty_struct *tty) 404static inline void tty_kref_put(struct tty_struct *tty)
408{ } 405{ }
409static inline struct pid *tty_get_pgrp(struct tty_struct *tty) 406static inline struct pid *tty_get_pgrp(struct tty_struct *tty)
@@ -478,9 +475,13 @@ extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
478extern int is_current_pgrp_orphaned(void); 475extern int is_current_pgrp_orphaned(void);
479extern void tty_hangup(struct tty_struct *tty); 476extern void tty_hangup(struct tty_struct *tty);
480extern void tty_vhangup(struct tty_struct *tty); 477extern void tty_vhangup(struct tty_struct *tty);
478extern void tty_vhangup_session(struct tty_struct *tty);
481extern int tty_hung_up_p(struct file *filp); 479extern int tty_hung_up_p(struct file *filp);
482extern void do_SAK(struct tty_struct *tty); 480extern void do_SAK(struct tty_struct *tty);
483extern void __do_SAK(struct tty_struct *tty); 481extern void __do_SAK(struct tty_struct *tty);
482extern void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty);
483extern int tty_signal_session_leader(struct tty_struct *tty, int exit_session);
484extern void session_clear_tty(struct pid *session);
484extern void no_tty(void); 485extern void no_tty(void);
485extern void tty_buffer_free_all(struct tty_port *port); 486extern void tty_buffer_free_all(struct tty_port *port);
486extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); 487extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld);
@@ -528,6 +529,8 @@ extern void tty_ldisc_flush(struct tty_struct *tty);
528extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 529extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
529extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, 530extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
530 unsigned int cmd, unsigned long arg); 531 unsigned int cmd, unsigned long arg);
532extern long tty_jobctrl_ioctl(struct tty_struct *tty, struct tty_struct *real_tty,
533 struct file *file, unsigned int cmd, unsigned long arg);
531extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 534extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
532extern void tty_default_fops(struct file_operations *fops); 535extern void tty_default_fops(struct file_operations *fops);
533extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx); 536extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx);
@@ -555,6 +558,15 @@ extern struct device *tty_port_register_device_attr(struct tty_port *port,
555 struct tty_driver *driver, unsigned index, 558 struct tty_driver *driver, unsigned index,
556 struct device *device, void *drvdata, 559 struct device *device, void *drvdata,
557 const struct attribute_group **attr_grp); 560 const struct attribute_group **attr_grp);
561extern struct device *tty_port_register_device_serdev(struct tty_port *port,
562 struct tty_driver *driver, unsigned index,
563 struct device *device);
564extern struct device *tty_port_register_device_attr_serdev(struct tty_port *port,
565 struct tty_driver *driver, unsigned index,
566 struct device *device, void *drvdata,
567 const struct attribute_group **attr_grp);
568extern void tty_port_unregister_device(struct tty_port *port,
569 struct tty_driver *driver, unsigned index);
558extern int tty_port_alloc_xmit_buf(struct tty_port *port); 570extern int tty_port_alloc_xmit_buf(struct tty_port *port);
559extern void tty_port_free_xmit_buf(struct tty_port *port); 571extern void tty_port_free_xmit_buf(struct tty_port *port);
560extern void tty_port_destroy(struct tty_port *port); 572extern void tty_port_destroy(struct tty_port *port);
@@ -669,7 +681,11 @@ extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p,
669 681
670/* n_tty.c */ 682/* n_tty.c */
671extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); 683extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
684#ifdef CONFIG_TTY
672extern void __init n_tty_init(void); 685extern void __init n_tty_init(void);
686#else
687static inline void n_tty_init(void) { }
688#endif
673 689
674/* tty_audit.c */ 690/* tty_audit.c */
675#ifdef CONFIG_AUDIT 691#ifdef CONFIG_AUDIT
diff --git a/include/linux/types.h b/include/linux/types.h
index 1e7bd24848fc..258099a4ed82 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -209,7 +209,7 @@ struct ustat {
209 * naturally due ABI requirements, but some architectures (like CRIS) have 209 * naturally due ABI requirements, but some architectures (like CRIS) have
210 * weird ABI and we need to ask it explicitly. 210 * weird ABI and we need to ask it explicitly.
211 * 211 *
212 * The alignment is required to guarantee that bits 0 and 1 of @next will be 212 * The alignment is required to guarantee that bit 0 of @next will be
213 * clear under normal conditions -- as long as we use call_rcu(), 213 * clear under normal conditions -- as long as we use call_rcu(),
214 * call_rcu_bh(), call_rcu_sched(), or call_srcu() to queue callback. 214 * call_rcu_bh(), call_rcu_sched(), or call_srcu() to queue callback.
215 * 215 *
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index f30c187ed785..201418d5e15c 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -2,8 +2,199 @@
2#define __LINUX_UACCESS_H__ 2#define __LINUX_UACCESS_H__
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/thread_info.h>
6#include <linux/kasan-checks.h>
7
8#define VERIFY_READ 0
9#define VERIFY_WRITE 1
10
11#define uaccess_kernel() segment_eq(get_fs(), KERNEL_DS)
12
5#include <asm/uaccess.h> 13#include <asm/uaccess.h>
6 14
15/*
16 * Architectures should provide two primitives (raw_copy_{to,from}_user())
17 * and get rid of their private instances of copy_{to,from}_user() and
18 * __copy_{to,from}_user{,_inatomic}().
19 *
20 * raw_copy_{to,from}_user(to, from, size) should copy up to size bytes and
21 * return the amount left to copy. They should assume that access_ok() has
22 * already been checked (and succeeded); they should *not* zero-pad anything.
23 * No KASAN or object size checks either - those belong here.
24 *
25 * Both of these functions should attempt to copy size bytes starting at from
26 * into the area starting at to. They must not fetch or store anything
27 * outside of those areas. Return value must be between 0 (everything
28 * copied successfully) and size (nothing copied).
29 *
30 * If raw_copy_{to,from}_user(to, from, size) returns N, size - N bytes starting
31 * at to must become equal to the bytes fetched from the corresponding area
32 * starting at from. All data past to + size - N must be left unmodified.
33 *
34 * If copying succeeds, the return value must be 0. If some data cannot be
35 * fetched, it is permitted to copy less than had been fetched; the only
36 * hard requirement is that not storing anything at all (i.e. returning size)
37 * should happen only when nothing could be copied. In other words, you don't
38 * have to squeeze as much as possible - it is allowed, but not necessary.
39 *
40 * For raw_copy_from_user() to always points to kernel memory and no faults
41 * on store should happen. Interpretation of from is affected by set_fs().
42 * For raw_copy_to_user() it's the other way round.
43 *
44 * Both can be inlined - it's up to architectures whether it wants to bother
45 * with that. They should not be used directly; they are used to implement
46 * the 6 functions (copy_{to,from}_user(), __copy_{to,from}_user_inatomic())
47 * that are used instead. Out of those, __... ones are inlined. Plain
48 * copy_{to,from}_user() might or might not be inlined. If you want them
49 * inlined, have asm/uaccess.h define INLINE_COPY_{TO,FROM}_USER.
50 *
51 * NOTE: only copy_from_user() zero-pads the destination in case of short copy.
52 * Neither __copy_from_user() nor __copy_from_user_inatomic() zero anything
53 * at all; their callers absolutely must check the return value.
54 *
55 * Biarch ones should also provide raw_copy_in_user() - similar to the above,
56 * but both source and destination are __user pointers (affected by set_fs()
57 * as usual) and both source and destination can trigger faults.
58 */
59
60static __always_inline unsigned long
61__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
62{
63 kasan_check_write(to, n);
64 check_object_size(to, n, false);
65 return raw_copy_from_user(to, from, n);
66}
67
68static __always_inline unsigned long
69__copy_from_user(void *to, const void __user *from, unsigned long n)
70{
71 might_fault();
72 kasan_check_write(to, n);
73 check_object_size(to, n, false);
74 return raw_copy_from_user(to, from, n);
75}
76
77/**
78 * __copy_to_user_inatomic: - Copy a block of data into user space, with less checking.
79 * @to: Destination address, in user space.
80 * @from: Source address, in kernel space.
81 * @n: Number of bytes to copy.
82 *
83 * Context: User context only.
84 *
85 * Copy data from kernel space to user space. Caller must check
86 * the specified block with access_ok() before calling this function.
87 * The caller should also make sure he pins the user space address
88 * so that we don't result in page fault and sleep.
89 */
90static __always_inline unsigned long
91__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
92{
93 kasan_check_read(from, n);
94 check_object_size(from, n, true);
95 return raw_copy_to_user(to, from, n);
96}
97
98static __always_inline unsigned long
99__copy_to_user(void __user *to, const void *from, unsigned long n)
100{
101 might_fault();
102 kasan_check_read(from, n);
103 check_object_size(from, n, true);
104 return raw_copy_to_user(to, from, n);
105}
106
107#ifdef INLINE_COPY_FROM_USER
108static inline unsigned long
109_copy_from_user(void *to, const void __user *from, unsigned long n)
110{
111 unsigned long res = n;
112 if (likely(access_ok(VERIFY_READ, from, n)))
113 res = raw_copy_from_user(to, from, n);
114 if (unlikely(res))
115 memset(to + (n - res), 0, res);
116 return res;
117}
118#else
119extern unsigned long
120_copy_from_user(void *, const void __user *, unsigned long);
121#endif
122
123#ifdef INLINE_COPY_TO_USER
124static inline unsigned long
125_copy_to_user(void __user *to, const void *from, unsigned long n)
126{
127 if (access_ok(VERIFY_WRITE, to, n))
128 n = raw_copy_to_user(to, from, n);
129 return n;
130}
131#else
132extern unsigned long
133_copy_to_user(void __user *, const void *, unsigned long);
134#endif
135
136extern void __compiletime_error("usercopy buffer size is too small")
137__bad_copy_user(void);
138
139static inline void copy_user_overflow(int size, unsigned long count)
140{
141 WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
142}
143
144static __always_inline unsigned long __must_check
145copy_from_user(void *to, const void __user *from, unsigned long n)
146{
147 int sz = __compiletime_object_size(to);
148
149 might_fault();
150 kasan_check_write(to, n);
151
152 if (likely(sz < 0 || sz >= n)) {
153 check_object_size(to, n, false);
154 n = _copy_from_user(to, from, n);
155 } else if (!__builtin_constant_p(n))
156 copy_user_overflow(sz, n);
157 else
158 __bad_copy_user();
159
160 return n;
161}
162
163static __always_inline unsigned long __must_check
164copy_to_user(void __user *to, const void *from, unsigned long n)
165{
166 int sz = __compiletime_object_size(from);
167
168 kasan_check_read(from, n);
169 might_fault();
170
171 if (likely(sz < 0 || sz >= n)) {
172 check_object_size(from, n, true);
173 n = _copy_to_user(to, from, n);
174 } else if (!__builtin_constant_p(n))
175 copy_user_overflow(sz, n);
176 else
177 __bad_copy_user();
178
179 return n;
180}
181#ifdef CONFIG_COMPAT
182static __always_inline unsigned long __must_check
183__copy_in_user(void __user *to, const void *from, unsigned long n)
184{
185 might_fault();
186 return raw_copy_in_user(to, from, n);
187}
188static __always_inline unsigned long __must_check
189copy_in_user(void __user *to, const void *from, unsigned long n)
190{
191 might_fault();
192 if (access_ok(VERIFY_WRITE, to, n) && access_ok(VERIFY_READ, from, n))
193 n = raw_copy_in_user(to, from, n);
194 return n;
195}
196#endif
197
7static __always_inline void pagefault_disabled_inc(void) 198static __always_inline void pagefault_disabled_inc(void)
8{ 199{
9 current->pagefault_disabled++; 200 current->pagefault_disabled++;
@@ -12,7 +203,6 @@ static __always_inline void pagefault_disabled_inc(void)
12static __always_inline void pagefault_disabled_dec(void) 203static __always_inline void pagefault_disabled_dec(void)
13{ 204{
14 current->pagefault_disabled--; 205 current->pagefault_disabled--;
15 WARN_ON(current->pagefault_disabled < 0);
16} 206}
17 207
18/* 208/*
@@ -67,12 +257,6 @@ static inline unsigned long __copy_from_user_inatomic_nocache(void *to,
67 return __copy_from_user_inatomic(to, from, n); 257 return __copy_from_user_inatomic(to, from, n);
68} 258}
69 259
70static inline unsigned long __copy_from_user_nocache(void *to,
71 const void __user *from, unsigned long n)
72{
73 return __copy_from_user(to, from, n);
74}
75
76#endif /* ARCH_HAS_NOCACHE_UACCESS */ 260#endif /* ARCH_HAS_NOCACHE_UACCESS */
77 261
78/* 262/*
diff --git a/include/linux/udp.h b/include/linux/udp.h
index c0f530809d1f..6cb4061a720d 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -115,6 +115,6 @@ static inline bool udp_get_no_check6_rx(struct sock *sk)
115#define udp_portaddr_for_each_entry_rcu(__sk, list) \ 115#define udp_portaddr_for_each_entry_rcu(__sk, list) \
116 hlist_for_each_entry_rcu(__sk, list, __sk_common.skc_portaddr_node) 116 hlist_for_each_entry_rcu(__sk, list, __sk_common.skc_portaddr_node)
117 117
118#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) 118#define IS_UDPLITE(__sk) (__sk->sk_protocol == IPPROTO_UDPLITE)
119 119
120#endif /* _LINUX_UDP_H */ 120#endif /* _LINUX_UDP_H */
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 804e34c6f981..f2d36a3d3005 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -39,7 +39,10 @@ struct iov_iter {
39 }; 39 };
40 union { 40 union {
41 unsigned long nr_segs; 41 unsigned long nr_segs;
42 int idx; 42 struct {
43 int idx;
44 int start_idx;
45 };
43 }; 46 };
44}; 47};
45 48
@@ -81,6 +84,7 @@ unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
81size_t iov_iter_copy_from_user_atomic(struct page *page, 84size_t iov_iter_copy_from_user_atomic(struct page *page,
82 struct iov_iter *i, unsigned long offset, size_t bytes); 85 struct iov_iter *i, unsigned long offset, size_t bytes);
83void iov_iter_advance(struct iov_iter *i, size_t bytes); 86void iov_iter_advance(struct iov_iter *i, size_t bytes);
87void iov_iter_revert(struct iov_iter *i, size_t bytes);
84int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); 88int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
85size_t iov_iter_single_seg_count(const struct iov_iter *i); 89size_t iov_iter_single_seg_count(const struct iov_iter *i);
86size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, 90size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 32c0e83d6239..3c85c81b0027 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -23,11 +23,13 @@ struct uio_map;
23/** 23/**
24 * struct uio_mem - description of a UIO memory region 24 * struct uio_mem - description of a UIO memory region
25 * @name: name of the memory region for identification 25 * @name: name of the memory region for identification
26 * @addr: address of the device's memory (phys_addr is used since 26 * @addr: address of the device's memory rounded to page
27 * addr can be logical, virtual, or physical & phys_addr_t 27 * size (phys_addr is used since addr can be
28 * should always be large enough to handle any of the 28 * logical, virtual, or physical & phys_addr_t
29 * address types) 29 * should always be large enough to handle any of
30 * @size: size of IO 30 * the address types)
31 * @offs: offset of device memory within the page
32 * @size: size of IO (multiple of page size)
31 * @memtype: type of memory addr points to 33 * @memtype: type of memory addr points to
32 * @internal_addr: ioremap-ped version of addr, for driver internal use 34 * @internal_addr: ioremap-ped version of addr, for driver internal use
33 * @map: for use by the UIO core only. 35 * @map: for use by the UIO core only.
@@ -35,6 +37,7 @@ struct uio_map;
35struct uio_mem { 37struct uio_mem {
36 const char *name; 38 const char *name;
37 phys_addr_t addr; 39 phys_addr_t addr;
40 unsigned long offs;
38 resource_size_t size; 41 resource_size_t size;
39 int memtype; 42 int memtype;
40 void __iomem *internal_addr; 43 void __iomem *internal_addr;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7e68259360de..cb9fbd54386e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -99,6 +99,76 @@ enum usb_interface_condition {
99 USB_INTERFACE_UNBINDING, 99 USB_INTERFACE_UNBINDING,
100}; 100};
101 101
102int __must_check
103usb_find_common_endpoints(struct usb_host_interface *alt,
104 struct usb_endpoint_descriptor **bulk_in,
105 struct usb_endpoint_descriptor **bulk_out,
106 struct usb_endpoint_descriptor **int_in,
107 struct usb_endpoint_descriptor **int_out);
108
109int __must_check
110usb_find_common_endpoints_reverse(struct usb_host_interface *alt,
111 struct usb_endpoint_descriptor **bulk_in,
112 struct usb_endpoint_descriptor **bulk_out,
113 struct usb_endpoint_descriptor **int_in,
114 struct usb_endpoint_descriptor **int_out);
115
116static inline int __must_check
117usb_find_bulk_in_endpoint(struct usb_host_interface *alt,
118 struct usb_endpoint_descriptor **bulk_in)
119{
120 return usb_find_common_endpoints(alt, bulk_in, NULL, NULL, NULL);
121}
122
123static inline int __must_check
124usb_find_bulk_out_endpoint(struct usb_host_interface *alt,
125 struct usb_endpoint_descriptor **bulk_out)
126{
127 return usb_find_common_endpoints(alt, NULL, bulk_out, NULL, NULL);
128}
129
130static inline int __must_check
131usb_find_int_in_endpoint(struct usb_host_interface *alt,
132 struct usb_endpoint_descriptor **int_in)
133{
134 return usb_find_common_endpoints(alt, NULL, NULL, int_in, NULL);
135}
136
137static inline int __must_check
138usb_find_int_out_endpoint(struct usb_host_interface *alt,
139 struct usb_endpoint_descriptor **int_out)
140{
141 return usb_find_common_endpoints(alt, NULL, NULL, NULL, int_out);
142}
143
144static inline int __must_check
145usb_find_last_bulk_in_endpoint(struct usb_host_interface *alt,
146 struct usb_endpoint_descriptor **bulk_in)
147{
148 return usb_find_common_endpoints_reverse(alt, bulk_in, NULL, NULL, NULL);
149}
150
151static inline int __must_check
152usb_find_last_bulk_out_endpoint(struct usb_host_interface *alt,
153 struct usb_endpoint_descriptor **bulk_out)
154{
155 return usb_find_common_endpoints_reverse(alt, NULL, bulk_out, NULL, NULL);
156}
157
158static inline int __must_check
159usb_find_last_int_in_endpoint(struct usb_host_interface *alt,
160 struct usb_endpoint_descriptor **int_in)
161{
162 return usb_find_common_endpoints_reverse(alt, NULL, NULL, int_in, NULL);
163}
164
165static inline int __must_check
166usb_find_last_int_out_endpoint(struct usb_host_interface *alt,
167 struct usb_endpoint_descriptor **int_out)
168{
169 return usb_find_common_endpoints_reverse(alt, NULL, NULL, NULL, int_out);
170}
171
102/** 172/**
103 * struct usb_interface - what usb device drivers talk to 173 * struct usb_interface - what usb device drivers talk to
104 * @altsetting: array of interface structures, one for each alternate 174 * @altsetting: array of interface structures, one for each alternate
@@ -248,7 +318,7 @@ void usb_put_intf(struct usb_interface *intf);
248 * struct usb_interface (which persists only as long as its configuration 318 * struct usb_interface (which persists only as long as its configuration
249 * is installed). The altsetting arrays can be accessed through these 319 * is installed). The altsetting arrays can be accessed through these
250 * structures at any time, permitting comparison of configurations and 320 * structures at any time, permitting comparison of configurations and
251 * providing support for the /proc/bus/usb/devices pseudo-file. 321 * providing support for the /sys/kernel/debug/usb/devices pseudo-file.
252 */ 322 */
253struct usb_interface_cache { 323struct usb_interface_cache {
254 unsigned num_altsetting; /* number of alternate settings */ 324 unsigned num_altsetting; /* number of alternate settings */
@@ -354,6 +424,7 @@ struct usb_devmap {
354 */ 424 */
355struct usb_bus { 425struct usb_bus {
356 struct device *controller; /* host/master side hardware */ 426 struct device *controller; /* host/master side hardware */
427 struct device *sysdev; /* as seen from firmware or bus */
357 int busnum; /* Bus number (in order of reg) */ 428 int busnum; /* Bus number (in order of reg) */
358 const char *bus_name; /* stable id (PCI slot_name etc) */ 429 const char *bus_name; /* stable id (PCI slot_name etc) */
359 u8 uses_dma; /* Does the host controller use DMA? */ 430 u8 uses_dma; /* Does the host controller use DMA? */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 4616a49a1c2e..f665d2ceac20 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -451,6 +451,7 @@ static inline struct usb_composite_driver *to_cdriver(
451 * sure doing that won't hurt too much. 451 * sure doing that won't hurt too much.
452 * 452 *
453 * One notion for how to handle Wireless USB devices involves: 453 * One notion for how to handle Wireless USB devices involves:
454 *
454 * (a) a second gadget here, discovery mechanism TBD, but likely 455 * (a) a second gadget here, discovery mechanism TBD, but likely
455 * needing separate "register/unregister WUSB gadget" calls; 456 * needing separate "register/unregister WUSB gadget" calls;
456 * (b) updates to usb_gadget to include flags "is it wireless", 457 * (b) updates to usb_gadget to include flags "is it wireless",
@@ -503,8 +504,9 @@ struct usb_composite_dev {
503 /* protects deactivations and delayed_status counts*/ 504 /* protects deactivations and delayed_status counts*/
504 spinlock_t lock; 505 spinlock_t lock;
505 506
506 unsigned setup_pending:1; 507 /* public: */
507 unsigned os_desc_pending:1; 508 unsigned int setup_pending:1;
509 unsigned int os_desc_pending:1;
508}; 510};
509 511
510extern int usb_string_id(struct usb_composite_dev *c); 512extern int usb_string_id(struct usb_composite_dev *c);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e4516e9ded0f..fbc22a39e7bc 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -188,7 +188,7 @@ struct usb_ep_caps {
188 * @caps:The structure describing types and directions supported by endoint. 188 * @caps:The structure describing types and directions supported by endoint.
189 * @maxpacket:The maximum packet size used on this endpoint. The initial 189 * @maxpacket:The maximum packet size used on this endpoint. The initial
190 * value can sometimes be reduced (hardware allowing), according to 190 * value can sometimes be reduced (hardware allowing), according to
191 * the endpoint descriptor used to configure the endpoint. 191 * the endpoint descriptor used to configure the endpoint.
192 * @maxpacket_limit:The maximum packet size value which can be handled by this 192 * @maxpacket_limit:The maximum packet size value which can be handled by this
193 * endpoint. It's set once by UDC driver when endpoint is initialized, and 193 * endpoint. It's set once by UDC driver when endpoint is initialized, and
194 * should not be changed. Should not be confused with maxpacket. 194 * should not be changed. Should not be confused with maxpacket.
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 40edf6a8533e..50398b69ca44 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -148,6 +148,7 @@ struct usb_hcd {
148 unsigned rh_registered:1;/* is root hub registered? */ 148 unsigned rh_registered:1;/* is root hub registered? */
149 unsigned rh_pollable:1; /* may we poll the root hub? */ 149 unsigned rh_pollable:1; /* may we poll the root hub? */
150 unsigned msix_enabled:1; /* driver has MSI-X enabled? */ 150 unsigned msix_enabled:1; /* driver has MSI-X enabled? */
151 unsigned msi_enabled:1; /* driver has MSI enabled? */
151 unsigned remove_phy:1; /* auto-remove USB phy */ 152 unsigned remove_phy:1; /* auto-remove USB phy */
152 153
153 /* The next flag is a stopgap, to be removed when all the HCDs 154 /* The next flag is a stopgap, to be removed when all the HCDs
@@ -437,6 +438,9 @@ extern int usb_hcd_alloc_bandwidth(struct usb_device *udev,
437 struct usb_host_interface *new_alt); 438 struct usb_host_interface *new_alt);
438extern int usb_hcd_get_frame_number(struct usb_device *udev); 439extern int usb_hcd_get_frame_number(struct usb_device *udev);
439 440
441struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver,
442 struct device *sysdev, struct device *dev, const char *bus_name,
443 struct usb_hcd *primary_hcd);
440extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, 444extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
441 struct device *dev, const char *bus_name); 445 struct device *dev, const char *bus_name);
442extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver, 446extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
@@ -453,7 +457,7 @@ extern int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1);
453struct platform_device; 457struct platform_device;
454extern void usb_hcd_platform_shutdown(struct platform_device *dev); 458extern void usb_hcd_platform_shutdown(struct platform_device *dev);
455 459
456#ifdef CONFIG_PCI 460#ifdef CONFIG_USB_PCI
457struct pci_dev; 461struct pci_dev;
458struct pci_device_id; 462struct pci_device_id;
459extern int usb_hcd_pci_probe(struct pci_dev *dev, 463extern int usb_hcd_pci_probe(struct pci_dev *dev,
@@ -466,7 +470,7 @@ extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
466#ifdef CONFIG_PM 470#ifdef CONFIG_PM
467extern const struct dev_pm_ops usb_hcd_pci_pm_ops; 471extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
468#endif 472#endif
469#endif /* CONFIG_PCI */ 473#endif /* CONFIG_USB_PCI */
470 474
471/* pci-ish (pdev null is ok) buffer alloc/mapping support */ 475/* pci-ish (pdev null is ok) buffer alloc/mapping support */
472void usb_init_pool_max(void); 476void usb_init_pool_max(void);
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index 5ff9032ee1b4..4031f47629ec 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -18,6 +18,7 @@ int of_usb_update_otg_caps(struct device_node *np,
18 struct usb_otg_caps *otg_caps); 18 struct usb_otg_caps *otg_caps);
19struct device_node *usb_of_get_child_node(struct device_node *parent, 19struct device_node *usb_of_get_child_node(struct device_node *parent,
20 int portnum); 20 int portnum);
21struct device *usb_of_get_companion_dev(struct device *dev);
21#else 22#else
22static inline enum usb_dr_mode 23static inline enum usb_dr_mode
23of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0) 24of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0)
@@ -38,6 +39,10 @@ static inline struct device_node *usb_of_get_child_node
38{ 39{
39 return NULL; 40 return NULL;
40} 41}
42static inline struct device *usb_of_get_companion_dev(struct device *dev)
43{
44 return NULL;
45}
41#endif 46#endif
42 47
43#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT) 48#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index 7a0350535cb1..a0a8f878503c 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -21,21 +21,6 @@
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22#include <linux/errno.h> 22#include <linux/errno.h>
23 23
24#undef VERBOSE
25
26#ifdef VERBOSE
27#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
28 __func__, ## args)
29#else
30#define VDBG(stuff...) do {} while (0)
31#endif
32
33#ifdef VERBOSE
34#define MPC_LOC printk("Current Location [%s]:[%d]\n", __FILE__, __LINE__)
35#else
36#define MPC_LOC do {} while (0)
37#endif
38
39#define PROTO_UNDEF (0) 24#define PROTO_UNDEF (0)
40#define PROTO_HOST (1) 25#define PROTO_HOST (1)
41#define PROTO_GADGET (2) 26#define PROTO_GADGET (2)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 704a1ab8240c..e2f0ab07eea5 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -20,7 +20,7 @@
20#include <linux/kfifo.h> 20#include <linux/kfifo.h>
21 21
22/* The maximum number of ports one device can grab at once */ 22/* The maximum number of ports one device can grab at once */
23#define MAX_NUM_PORTS 8 23#define MAX_NUM_PORTS 16
24 24
25/* parity check flag */ 25/* parity check flag */
26#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 26#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
@@ -159,10 +159,10 @@ struct usb_serial {
159 unsigned char minors_reserved:1; 159 unsigned char minors_reserved:1;
160 unsigned char num_ports; 160 unsigned char num_ports;
161 unsigned char num_port_pointers; 161 unsigned char num_port_pointers;
162 char num_interrupt_in; 162 unsigned char num_interrupt_in;
163 char num_interrupt_out; 163 unsigned char num_interrupt_out;
164 char num_bulk_in; 164 unsigned char num_bulk_in;
165 char num_bulk_out; 165 unsigned char num_bulk_out;
166 struct usb_serial_port *port[MAX_NUM_PORTS]; 166 struct usb_serial_port *port[MAX_NUM_PORTS];
167 struct kref kref; 167 struct kref kref;
168 struct mutex disc_mutex; 168 struct mutex disc_mutex;
@@ -181,6 +181,17 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
181 serial->private = data; 181 serial->private = data;
182} 182}
183 183
184struct usb_serial_endpoints {
185 unsigned char num_bulk_in;
186 unsigned char num_bulk_out;
187 unsigned char num_interrupt_in;
188 unsigned char num_interrupt_out;
189 struct usb_endpoint_descriptor *bulk_in[MAX_NUM_PORTS];
190 struct usb_endpoint_descriptor *bulk_out[MAX_NUM_PORTS];
191 struct usb_endpoint_descriptor *interrupt_in[MAX_NUM_PORTS];
192 struct usb_endpoint_descriptor *interrupt_out[MAX_NUM_PORTS];
193};
194
184/** 195/**
185 * usb_serial_driver - describes a usb serial driver 196 * usb_serial_driver - describes a usb serial driver
186 * @description: pointer to a string that describes this driver. This string 197 * @description: pointer to a string that describes this driver. This string
@@ -188,12 +199,17 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
188 * @id_table: pointer to a list of usb_device_id structures that define all 199 * @id_table: pointer to a list of usb_device_id structures that define all
189 * of the devices this structure can support. 200 * of the devices this structure can support.
190 * @num_ports: the number of different ports this device will have. 201 * @num_ports: the number of different ports this device will have.
202 * @num_bulk_in: minimum number of bulk-in endpoints
203 * @num_bulk_out: minimum number of bulk-out endpoints
204 * @num_interrupt_in: minimum number of interrupt-in endpoints
205 * @num_interrupt_out: minimum number of interrupt-out endpoints
191 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer 206 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
192 * (0 = end-point size) 207 * (0 = end-point size)
193 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) 208 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
194 * @calc_num_ports: pointer to a function to determine how many ports this 209 * @calc_num_ports: pointer to a function to determine how many ports this
195 * device has dynamically. It will be called after the probe() 210 * device has dynamically. It can also be used to verify the number of
196 * callback is called, but before attach() 211 * endpoints or to modify the port-endpoint mapping. It will be called
212 * after the probe() callback is called, but before attach().
197 * @probe: pointer to the driver's probe function. 213 * @probe: pointer to the driver's probe function.
198 * This will be called when the device is inserted into the system, 214 * This will be called when the device is inserted into the system,
199 * but before the device has been fully initialized by the usb_serial 215 * but before the device has been fully initialized by the usb_serial
@@ -227,19 +243,26 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
227struct usb_serial_driver { 243struct usb_serial_driver {
228 const char *description; 244 const char *description;
229 const struct usb_device_id *id_table; 245 const struct usb_device_id *id_table;
230 char num_ports;
231 246
232 struct list_head driver_list; 247 struct list_head driver_list;
233 struct device_driver driver; 248 struct device_driver driver;
234 struct usb_driver *usb_driver; 249 struct usb_driver *usb_driver;
235 struct usb_dynids dynids; 250 struct usb_dynids dynids;
236 251
252 unsigned char num_ports;
253
254 unsigned char num_bulk_in;
255 unsigned char num_bulk_out;
256 unsigned char num_interrupt_in;
257 unsigned char num_interrupt_out;
258
237 size_t bulk_in_size; 259 size_t bulk_in_size;
238 size_t bulk_out_size; 260 size_t bulk_out_size;
239 261
240 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 262 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
241 int (*attach)(struct usb_serial *serial); 263 int (*attach)(struct usb_serial *serial);
242 int (*calc_num_ports) (struct usb_serial *serial); 264 int (*calc_num_ports)(struct usb_serial *serial,
265 struct usb_serial_endpoints *epds);
243 266
244 void (*disconnect)(struct usb_serial *serial); 267 void (*disconnect)(struct usb_serial *serial);
245 void (*release)(struct usb_serial *serial); 268 void (*release)(struct usb_serial *serial);
@@ -356,7 +379,6 @@ extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
356extern int usb_serial_bus_register(struct usb_serial_driver *device); 379extern int usb_serial_bus_register(struct usb_serial_driver *device);
357extern void usb_serial_bus_deregister(struct usb_serial_driver *device); 380extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
358 381
359extern struct usb_serial_driver usb_serial_generic_device;
360extern struct bus_type usb_serial_bus_type; 382extern struct bus_type usb_serial_bus_type;
361extern struct tty_driver *usb_serial_tty_driver; 383extern struct tty_driver *usb_serial_tty_driver;
362 384
diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h
new file mode 100644
index 000000000000..ec78204964ab
--- /dev/null
+++ b/include/linux/usb/typec.h
@@ -0,0 +1,243 @@
1
2#ifndef __LINUX_USB_TYPEC_H
3#define __LINUX_USB_TYPEC_H
4
5#include <linux/types.h>
6
7/* XXX: Once we have a header for USB Power Delivery, this belongs there */
8#define ALTMODE_MAX_MODES 6
9
10/* USB Type-C Specification releases */
11#define USB_TYPEC_REV_1_0 0x100 /* 1.0 */
12#define USB_TYPEC_REV_1_1 0x110 /* 1.1 */
13#define USB_TYPEC_REV_1_2 0x120 /* 1.2 */
14
15struct typec_altmode;
16struct typec_partner;
17struct typec_cable;
18struct typec_plug;
19struct typec_port;
20
21struct fwnode_handle;
22
23enum typec_port_type {
24 TYPEC_PORT_DFP,
25 TYPEC_PORT_UFP,
26 TYPEC_PORT_DRP,
27};
28
29enum typec_plug_type {
30 USB_PLUG_NONE,
31 USB_PLUG_TYPE_A,
32 USB_PLUG_TYPE_B,
33 USB_PLUG_TYPE_C,
34 USB_PLUG_CAPTIVE,
35};
36
37enum typec_data_role {
38 TYPEC_DEVICE,
39 TYPEC_HOST,
40};
41
42enum typec_role {
43 TYPEC_SINK,
44 TYPEC_SOURCE,
45};
46
47enum typec_pwr_opmode {
48 TYPEC_PWR_MODE_USB,
49 TYPEC_PWR_MODE_1_5A,
50 TYPEC_PWR_MODE_3_0A,
51 TYPEC_PWR_MODE_PD,
52};
53
54enum typec_accessory {
55 TYPEC_ACCESSORY_NONE,
56 TYPEC_ACCESSORY_AUDIO,
57 TYPEC_ACCESSORY_DEBUG,
58};
59
60#define TYPEC_MAX_ACCESSORY 3
61
62/*
63 * struct usb_pd_identity - USB Power Delivery identity data
64 * @id_header: ID Header VDO
65 * @cert_stat: Cert Stat VDO
66 * @product: Product VDO
67 *
68 * USB power delivery Discover Identity command response data.
69 *
70 * REVISIT: This is USB Power Delivery specific information, so this structure
71 * probable belongs to USB Power Delivery header file once we have them.
72 */
73struct usb_pd_identity {
74 u32 id_header;
75 u32 cert_stat;
76 u32 product;
77};
78
79int typec_partner_set_identity(struct typec_partner *partner);
80int typec_cable_set_identity(struct typec_cable *cable);
81
82/*
83 * struct typec_mode_desc - Individual Mode of an Alternate Mode
84 * @index: Index of the Mode within the SVID
85 * @vdo: VDO returned by Discover Modes USB PD command
86 * @desc: Optional human readable description of the mode
87 * @roles: Only for ports. DRP if the mode is available in both roles
88 *
89 * Description of a mode of an Alternate Mode which a connector, cable plug or
90 * partner supports. Every mode will have it's own sysfs group. The details are
91 * the VDO returned by discover modes command, description for the mode and
92 * active flag telling has the mode being entered or not.
93 */
94struct typec_mode_desc {
95 int index;
96 u32 vdo;
97 char *desc;
98 /* Only used with ports */
99 enum typec_port_type roles;
100};
101
102/*
103 * struct typec_altmode_desc - USB Type-C Alternate Mode Descriptor
104 * @svid: Standard or Vendor ID
105 * @n_modes: Number of modes
106 * @modes: Array of modes supported by the Alternate Mode
107 *
108 * Representation of an Alternate Mode that has SVID assigned by USB-IF. The
109 * array of modes will list the modes of a particular SVID that are supported by
110 * a connector, partner of a cable plug.
111 */
112struct typec_altmode_desc {
113 u16 svid;
114 int n_modes;
115 struct typec_mode_desc modes[ALTMODE_MAX_MODES];
116};
117
118struct typec_altmode
119*typec_partner_register_altmode(struct typec_partner *partner,
120 struct typec_altmode_desc *desc);
121struct typec_altmode
122*typec_plug_register_altmode(struct typec_plug *plug,
123 struct typec_altmode_desc *desc);
124struct typec_altmode
125*typec_port_register_altmode(struct typec_port *port,
126 struct typec_altmode_desc *desc);
127void typec_unregister_altmode(struct typec_altmode *altmode);
128
129struct typec_port *typec_altmode2port(struct typec_altmode *alt);
130
131void typec_altmode_update_active(struct typec_altmode *alt, int mode,
132 bool active);
133
134enum typec_plug_index {
135 TYPEC_PLUG_SOP_P,
136 TYPEC_PLUG_SOP_PP,
137};
138
139/*
140 * struct typec_plug_desc - USB Type-C Cable Plug Descriptor
141 * @index: SOP Prime for the plug connected to DFP and SOP Double Prime for the
142 * plug connected to UFP
143 *
144 * Represents USB Type-C Cable Plug.
145 */
146struct typec_plug_desc {
147 enum typec_plug_index index;
148};
149
150/*
151 * struct typec_cable_desc - USB Type-C Cable Descriptor
152 * @type: The plug type from USB PD Cable VDO
153 * @active: Is the cable active or passive
154 * @identity: Result of Discover Identity command
155 *
156 * Represents USB Type-C Cable attached to USB Type-C port.
157 */
158struct typec_cable_desc {
159 enum typec_plug_type type;
160 unsigned int active:1;
161 struct usb_pd_identity *identity;
162};
163
164/*
165 * struct typec_partner_desc - USB Type-C Partner Descriptor
166 * @usb_pd: USB Power Delivery support
167 * @accessory: Audio, Debug or none.
168 * @identity: Discover Identity command data
169 *
170 * Details about a partner that is attached to USB Type-C port. If @identity
171 * member exists when partner is registered, a directory named "identity" is
172 * created to sysfs for the partner device.
173 */
174struct typec_partner_desc {
175 unsigned int usb_pd:1;
176 enum typec_accessory accessory;
177 struct usb_pd_identity *identity;
178};
179
180/*
181 * struct typec_capability - USB Type-C Port Capabilities
182 * @role: DFP (Host-only), UFP (Device-only) or DRP (Dual Role)
183 * @revision: USB Type-C Specification release. Binary coded decimal
184 * @pd_revision: USB Power Delivery Specification revision if supported
185 * @prefer_role: Initial role preference
186 * @accessory: Supported Accessory Modes
187 * @fwnode: Optional fwnode of the port
188 * @try_role: Set data role preference for DRP port
189 * @dr_set: Set Data Role
190 * @pr_set: Set Power Role
191 * @vconn_set: Set VCONN Role
192 * @activate_mode: Enter/exit given Alternate Mode
193 *
194 * Static capabilities of a single USB Type-C port.
195 */
196struct typec_capability {
197 enum typec_port_type type;
198 u16 revision; /* 0120H = "1.2" */
199 u16 pd_revision; /* 0300H = "3.0" */
200 int prefer_role;
201 enum typec_accessory accessory[TYPEC_MAX_ACCESSORY];
202
203 struct fwnode_handle *fwnode;
204
205 int (*try_role)(const struct typec_capability *,
206 int role);
207
208 int (*dr_set)(const struct typec_capability *,
209 enum typec_data_role);
210 int (*pr_set)(const struct typec_capability *,
211 enum typec_role);
212 int (*vconn_set)(const struct typec_capability *,
213 enum typec_role);
214
215 int (*activate_mode)(const struct typec_capability *,
216 int mode, int activate);
217};
218
219/* Specific to try_role(). Indicates the user want's to clear the preference. */
220#define TYPEC_NO_PREFERRED_ROLE (-1)
221
222struct typec_port *typec_register_port(struct device *parent,
223 const struct typec_capability *cap);
224void typec_unregister_port(struct typec_port *port);
225
226struct typec_partner *typec_register_partner(struct typec_port *port,
227 struct typec_partner_desc *desc);
228void typec_unregister_partner(struct typec_partner *partner);
229
230struct typec_cable *typec_register_cable(struct typec_port *port,
231 struct typec_cable_desc *desc);
232void typec_unregister_cable(struct typec_cable *cable);
233
234struct typec_plug *typec_register_plug(struct typec_cable *cable,
235 struct typec_plug_desc *desc);
236void typec_unregister_plug(struct typec_plug *plug);
237
238void typec_set_data_role(struct typec_port *port, enum typec_data_role role);
239void typec_set_pwr_role(struct typec_port *port, enum typec_role role);
240void typec_set_vconn_role(struct typec_port *port, enum typec_role role);
241void typec_set_pwr_opmode(struct typec_port *port, enum typec_pwr_opmode mode);
242
243#endif /* __LINUX_USB_TYPEC_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 6e0ce8c7b8cb..97116379db5f 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -64,6 +64,8 @@ struct usbnet {
64 struct usb_anchor deferred; 64 struct usb_anchor deferred;
65 struct tasklet_struct bh; 65 struct tasklet_struct bh;
66 66
67 struct pcpu_sw_netstats __percpu *stats64;
68
67 struct work_struct kevent; 69 struct work_struct kevent;
68 unsigned long flags; 70 unsigned long flags;
69# define EVENT_TX_HALT 0 71# define EVENT_TX_HALT 0
@@ -204,6 +206,7 @@ struct cdc_state {
204}; 206};
205 207
206extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); 208extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
209extern int usbnet_ether_cdc_bind(struct usbnet *dev, struct usb_interface *intf);
207extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *); 210extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
208extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); 211extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
209extern void usbnet_cdc_status(struct usbnet *, struct urb *); 212extern void usbnet_cdc_status(struct usbnet *, struct urb *);
@@ -261,10 +264,10 @@ extern void usbnet_pause_rx(struct usbnet *);
261extern void usbnet_resume_rx(struct usbnet *); 264extern void usbnet_resume_rx(struct usbnet *);
262extern void usbnet_purge_paused_rxq(struct usbnet *); 265extern void usbnet_purge_paused_rxq(struct usbnet *);
263 266
264extern int usbnet_get_settings(struct net_device *net, 267extern int usbnet_get_link_ksettings(struct net_device *net,
265 struct ethtool_cmd *cmd); 268 struct ethtool_link_ksettings *cmd);
266extern int usbnet_set_settings(struct net_device *net, 269extern int usbnet_set_link_ksettings(struct net_device *net,
267 struct ethtool_cmd *cmd); 270 const struct ethtool_link_ksettings *cmd);
268extern u32 usbnet_get_link(struct net_device *net); 271extern u32 usbnet_get_link(struct net_device *net);
269extern u32 usbnet_get_msglevel(struct net_device *); 272extern u32 usbnet_get_msglevel(struct net_device *);
270extern void usbnet_set_msglevel(struct net_device *, u32); 273extern void usbnet_set_msglevel(struct net_device *, u32);
@@ -278,5 +281,7 @@ extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags);
278extern void usbnet_status_stop(struct usbnet *dev); 281extern void usbnet_status_stop(struct usbnet *dev);
279 282
280extern void usbnet_update_max_qlen(struct usbnet *dev); 283extern void usbnet_update_max_qlen(struct usbnet *dev);
284extern void usbnet_get_stats64(struct net_device *dev,
285 struct rtnl_link_stats64 *stats);
281 286
282#endif /* __LINUX_USB_USBNET_H */ 287#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb/xhci-dbgp.h b/include/linux/usb/xhci-dbgp.h
new file mode 100644
index 000000000000..80c1cca1f529
--- /dev/null
+++ b/include/linux/usb/xhci-dbgp.h
@@ -0,0 +1,29 @@
1/*
2 * Standalone xHCI debug capability driver
3 *
4 * Copyright (C) 2016 Intel Corporation
5 *
6 * Author: Lu Baolu <baolu.lu@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __LINUX_XHCI_DBGP_H
14#define __LINUX_XHCI_DBGP_H
15
16#ifdef CONFIG_EARLY_PRINTK_USB_XDBC
17int __init early_xdbc_parse_parameter(char *s);
18int __init early_xdbc_setup_hardware(void);
19void __init early_xdbc_register_console(void);
20#else
21static inline int __init early_xdbc_setup_hardware(void)
22{
23 return -ENODEV;
24}
25static inline void __init early_xdbc_register_console(void)
26{
27}
28#endif /* CONFIG_EARLY_PRINTK_USB_XDBC */
29#endif /* __LINUX_XHCI_DBGP_H */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 04b0d3f95043..28b0e965360f 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -44,6 +44,12 @@ int virtqueue_add_inbuf(struct virtqueue *vq,
44 void *data, 44 void *data,
45 gfp_t gfp); 45 gfp_t gfp);
46 46
47int virtqueue_add_inbuf_ctx(struct virtqueue *vq,
48 struct scatterlist sg[], unsigned int num,
49 void *data,
50 void *ctx,
51 gfp_t gfp);
52
47int virtqueue_add_sgs(struct virtqueue *vq, 53int virtqueue_add_sgs(struct virtqueue *vq,
48 struct scatterlist *sgs[], 54 struct scatterlist *sgs[],
49 unsigned int out_sgs, 55 unsigned int out_sgs,
@@ -59,6 +65,9 @@ bool virtqueue_notify(struct virtqueue *vq);
59 65
60void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); 66void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
61 67
68void *virtqueue_get_buf_ctx(struct virtqueue *vq, unsigned int *len,
69 void **ctx);
70
62void virtqueue_disable_cb(struct virtqueue *vq); 71void virtqueue_disable_cb(struct virtqueue *vq);
63 72
64bool virtqueue_enable_cb(struct virtqueue *vq); 73bool virtqueue_enable_cb(struct virtqueue *vq);
@@ -156,9 +165,13 @@ int virtio_device_restore(struct virtio_device *dev);
156 * @feature_table_legacy: same as feature_table but when working in legacy mode. 165 * @feature_table_legacy: same as feature_table but when working in legacy mode.
157 * @feature_table_size_legacy: number of entries in feature table legacy array. 166 * @feature_table_size_legacy: number of entries in feature table legacy array.
158 * @probe: the function to call when a device is found. Returns 0 or -errno. 167 * @probe: the function to call when a device is found. Returns 0 or -errno.
168 * @scan: optional function to call after successful probe; intended
169 * for virtio-scsi to invoke a scan.
159 * @remove: the function to call when a device is removed. 170 * @remove: the function to call when a device is removed.
160 * @config_changed: optional function to call when the device configuration 171 * @config_changed: optional function to call when the device configuration
161 * changes; may be called in interrupt context. 172 * changes; may be called in interrupt context.
173 * @freeze: optional function to call during suspend/hibernation.
174 * @restore: optional function to call on resume.
162 */ 175 */
163struct virtio_driver { 176struct virtio_driver {
164 struct device_driver driver; 177 struct device_driver driver;
@@ -167,6 +180,7 @@ struct virtio_driver {
167 unsigned int feature_table_size; 180 unsigned int feature_table_size;
168 const unsigned int *feature_table_legacy; 181 const unsigned int *feature_table_legacy;
169 unsigned int feature_table_size_legacy; 182 unsigned int feature_table_size_legacy;
183 int (*validate)(struct virtio_device *dev);
170 int (*probe)(struct virtio_device *dev); 184 int (*probe)(struct virtio_device *dev);
171 void (*scan)(struct virtio_device *dev); 185 void (*scan)(struct virtio_device *dev);
172 void (*remove)(struct virtio_device *dev); 186 void (*remove)(struct virtio_device *dev);
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 8355bab175e1..0133d8a12ccd 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -72,7 +72,8 @@ struct virtio_config_ops {
72 void (*reset)(struct virtio_device *vdev); 72 void (*reset)(struct virtio_device *vdev);
73 int (*find_vqs)(struct virtio_device *, unsigned nvqs, 73 int (*find_vqs)(struct virtio_device *, unsigned nvqs,
74 struct virtqueue *vqs[], vq_callback_t *callbacks[], 74 struct virtqueue *vqs[], vq_callback_t *callbacks[],
75 const char * const names[], struct irq_affinity *desc); 75 const char * const names[], const bool *ctx,
76 struct irq_affinity *desc);
76 void (*del_vqs)(struct virtio_device *); 77 void (*del_vqs)(struct virtio_device *);
77 u64 (*get_features)(struct virtio_device *vdev); 78 u64 (*get_features)(struct virtio_device *vdev);
78 int (*finalize_features)(struct virtio_device *vdev); 79 int (*finalize_features)(struct virtio_device *vdev);
@@ -173,12 +174,32 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
173 vq_callback_t *callbacks[] = { c }; 174 vq_callback_t *callbacks[] = { c };
174 const char *names[] = { n }; 175 const char *names[] = { n };
175 struct virtqueue *vq; 176 struct virtqueue *vq;
176 int err = vdev->config->find_vqs(vdev, 1, &vq, callbacks, names, NULL); 177 int err = vdev->config->find_vqs(vdev, 1, &vq, callbacks, names, NULL,
178 NULL);
177 if (err < 0) 179 if (err < 0)
178 return ERR_PTR(err); 180 return ERR_PTR(err);
179 return vq; 181 return vq;
180} 182}
181 183
184static inline
185int virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
186 struct virtqueue *vqs[], vq_callback_t *callbacks[],
187 const char * const names[],
188 struct irq_affinity *desc)
189{
190 return vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names, NULL, desc);
191}
192
193static inline
194int virtio_find_vqs_ctx(struct virtio_device *vdev, unsigned nvqs,
195 struct virtqueue *vqs[], vq_callback_t *callbacks[],
196 const char * const names[], const bool *ctx,
197 struct irq_affinity *desc)
198{
199 return vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names, ctx,
200 desc);
201}
202
182/** 203/**
183 * virtio_device_ready - enable vq use in probe function 204 * virtio_device_ready - enable vq use in probe function
184 * @vdev: the device 205 * @vdev: the device
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index e8d36938f09a..270cfa81830e 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -71,6 +71,7 @@ struct virtqueue *vring_create_virtqueue(unsigned int index,
71 struct virtio_device *vdev, 71 struct virtio_device *vdev,
72 bool weak_barriers, 72 bool weak_barriers,
73 bool may_reduce_num, 73 bool may_reduce_num,
74 bool ctx,
74 bool (*notify)(struct virtqueue *vq), 75 bool (*notify)(struct virtqueue *vq),
75 void (*callback)(struct virtqueue *vq), 76 void (*callback)(struct virtqueue *vq),
76 const char *name); 77 const char *name);
@@ -80,6 +81,7 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index,
80 struct vring vring, 81 struct vring vring,
81 struct virtio_device *vdev, 82 struct virtio_device *vdev,
82 bool weak_barriers, 83 bool weak_barriers,
84 bool ctx,
83 bool (*notify)(struct virtqueue *), 85 bool (*notify)(struct virtqueue *),
84 void (*callback)(struct virtqueue *), 86 void (*callback)(struct virtqueue *),
85 const char *name); 87 const char *name);
@@ -93,6 +95,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int index,
93 unsigned int vring_align, 95 unsigned int vring_align,
94 struct virtio_device *vdev, 96 struct virtio_device *vdev,
95 bool weak_barriers, 97 bool weak_barriers,
98 bool ctx,
96 void *pages, 99 void *pages,
97 bool (*notify)(struct virtqueue *vq), 100 bool (*notify)(struct virtqueue *vq),
98 void (*callback)(struct virtqueue *vq), 101 void (*callback)(struct virtqueue *vq),
diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
index 584f9a647ad4..ab13f0743da8 100644
--- a/include/linux/virtio_vsock.h
+++ b/include/linux/virtio_vsock.h
@@ -153,5 +153,6 @@ void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt);
153void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vsock_pkt *pkt); 153void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vsock_pkt *pkt);
154u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); 154u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted);
155void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); 155void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit);
156void virtio_transport_deliver_tap_pkt(struct virtio_vsock_pkt *pkt);
156 157
157#endif /* _LINUX_VIRTIO_VSOCK_H */ 158#endif /* _LINUX_VIRTIO_VSOCK_H */
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index a80b7b59cf33..d84ae90ccd5c 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -25,7 +25,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
25 FOR_ALL_ZONES(PGALLOC), 25 FOR_ALL_ZONES(PGALLOC),
26 FOR_ALL_ZONES(ALLOCSTALL), 26 FOR_ALL_ZONES(ALLOCSTALL),
27 FOR_ALL_ZONES(PGSCAN_SKIP), 27 FOR_ALL_ZONES(PGSCAN_SKIP),
28 PGFREE, PGACTIVATE, PGDEACTIVATE, 28 PGFREE, PGACTIVATE, PGDEACTIVATE, PGLAZYFREE,
29 PGFAULT, PGMAJFAULT, 29 PGFAULT, PGMAJFAULT,
30 PGLAZYFREED, 30 PGLAZYFREED,
31 PGREFILL, 31 PGREFILL,
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index d68edffbf142..2d92dd002abd 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -80,6 +80,17 @@ extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
80 unsigned long start, unsigned long end, gfp_t gfp_mask, 80 unsigned long start, unsigned long end, gfp_t gfp_mask,
81 pgprot_t prot, unsigned long vm_flags, int node, 81 pgprot_t prot, unsigned long vm_flags, int node,
82 const void *caller); 82 const void *caller);
83#ifndef CONFIG_MMU
84extern void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags);
85static inline void *__vmalloc_node_flags_caller(unsigned long size, int node,
86 gfp_t flags, void *caller)
87{
88 return __vmalloc_node_flags(size, node, flags);
89}
90#else
91extern void *__vmalloc_node_flags_caller(unsigned long size,
92 int node, gfp_t flags, void *caller);
93#endif
83 94
84extern void vfree(const void *addr); 95extern void vfree(const void *addr);
85extern void vfree_atomic(const void *addr); 96extern void vfree_atomic(const void *addr);
diff --git a/include/linux/vme.h b/include/linux/vme.h
index ec5e8bf6118e..25874da3f2e1 100644
--- a/include/linux/vme.h
+++ b/include/linux/vme.h
@@ -92,7 +92,7 @@ extern struct bus_type vme_bus_type;
92#define VME_SLOT_ALL -2 92#define VME_SLOT_ALL -2
93 93
94/** 94/**
95 * Structure representing a VME device 95 * struct vme_dev - Structure representing a VME device
96 * @num: The device number 96 * @num: The device number
97 * @bridge: Pointer to the bridge device this device is on 97 * @bridge: Pointer to the bridge device this device is on
98 * @dev: Internal device structure 98 * @dev: Internal device structure
@@ -107,6 +107,16 @@ struct vme_dev {
107 struct list_head bridge_list; 107 struct list_head bridge_list;
108}; 108};
109 109
110/**
111 * struct vme_driver - Structure representing a VME driver
112 * @name: Driver name, should be unique among VME drivers and usually the same
113 * as the module name.
114 * @match: Callback used to determine whether probe should be run.
115 * @probe: Callback for device binding, called when new device is detected.
116 * @remove: Callback, called on device removal.
117 * @driver: Underlying generic device driver structure.
118 * @devices: List of VME devices (struct vme_dev) associated with this driver.
119 */
110struct vme_driver { 120struct vme_driver {
111 const char *name; 121 const char *name;
112 int (*match)(struct vme_dev *); 122 int (*match)(struct vme_dev *);
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index bde063cefd04..c102ef65cb64 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -608,8 +608,13 @@ static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
608{ 608{
609 return fn(arg); 609 return fn(arg);
610} 610}
611static inline long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg)
612{
613 return fn(arg);
614}
611#else 615#else
612long work_on_cpu(int cpu, long (*fn)(void *), void *arg); 616long work_on_cpu(int cpu, long (*fn)(void *), void *arg);
617long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg);
613#endif /* CONFIG_SMP */ 618#endif /* CONFIG_SMP */
614 619
615#ifdef CONFIG_FREEZER 620#ifdef CONFIG_FREEZER
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a3c0cbd7c888..d5815794416c 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -237,6 +237,7 @@ static inline void inode_attach_wb(struct inode *inode, struct page *page)
237static inline void inode_detach_wb(struct inode *inode) 237static inline void inode_detach_wb(struct inode *inode)
238{ 238{
239 if (inode->i_wb) { 239 if (inode->i_wb) {
240 WARN_ON_ONCE(!(inode->i_state & I_CLEAR));
240 wb_put(inode->i_wb); 241 wb_put(inode->i_wb);
241 inode->i_wb = NULL; 242 inode->i_wb = NULL;
242 } 243 }