aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/processor.h10
-rw-r--r--include/acpi/video.h2
-rw-r--r--include/asm-generic/io-64-nonatomic-hi-lo.h14
-rw-r--r--include/asm-generic/io-64-nonatomic-lo-hi.h14
-rw-r--r--include/asm-generic/percpu.h410
-rw-r--r--include/asm-generic/qrwlock.h166
-rw-r--r--include/asm-generic/qrwlock_types.h21
-rw-r--r--include/asm-generic/vmlinux.lds.h12
-rw-r--r--include/crypto/aead.h4
-rw-r--r--include/crypto/algapi.h6
-rw-r--r--include/crypto/des.h3
-rw-r--r--include/crypto/drbg.h290
-rw-r--r--include/crypto/hash.h4
-rw-r--r--include/crypto/internal/skcipher.h3
-rw-r--r--include/crypto/scatterwalk.h6
-rw-r--r--include/crypto/skcipher.h4
-rw-r--r--include/drm/drmP.h54
-rw-r--r--include/drm/drm_crtc.h92
-rw-r--r--include/drm/drm_crtc_helper.h6
-rw-r--r--include/drm/drm_dp_helper.h88
-rw-r--r--include/drm/drm_edid.h5
-rw-r--r--include/drm/drm_fb_helper.h2
-rw-r--r--include/drm/drm_flip_work.h1
-rw-r--r--include/drm/drm_mipi_dsi.h2
-rw-r--r--include/drm/drm_modes.h2
-rw-r--r--include/drm/drm_modeset_lock.h126
-rw-r--r--include/drm/drm_plane_helper.h24
-rw-r--r--include/drm/i915_pciids.h36
-rw-r--r--include/drm/i915_powerwell.h5
-rw-r--r--include/drm/ttm/ttm_bo_api.h5
-rw-r--r--include/dt-bindings/clk/ti-dra7-atl.h40
-rw-r--r--include/dt-bindings/clock/clps711x-clock.h27
-rw-r--r--include/dt-bindings/clock/exynos4.h25
-rw-r--r--include/dt-bindings/clock/exynos5250.h2
-rw-r--r--include/dt-bindings/clock/exynos5420.h5
-rw-r--r--include/dt-bindings/clock/exynos5440.h2
-rw-r--r--include/dt-bindings/clock/imx6sl-clock.h3
-rw-r--r--include/dt-bindings/clock/qcom,gcc-apq8084.h351
-rw-r--r--include/dt-bindings/clock/qcom,gcc-ipq806x.h293
-rw-r--r--include/dt-bindings/clock/qcom,gcc-msm8960.h11
-rw-r--r--include/dt-bindings/clock/qcom,mmcc-apq8084.h183
-rw-r--r--include/dt-bindings/clock/qcom,mmcc-msm8960.h8
-rw-r--r--include/dt-bindings/clock/rk3066a-cru.h35
-rw-r--r--include/dt-bindings/clock/rk3188-cru-common.h249
-rw-r--r--include/dt-bindings/clock/rk3188-cru.h51
-rw-r--r--include/dt-bindings/clock/rk3288-cru.h278
-rw-r--r--include/dt-bindings/clock/stih415-clks.h1
-rw-r--r--include/dt-bindings/clock/stih416-clks.h1
-rw-r--r--include/dt-bindings/mfd/palmas.h18
-rw-r--r--include/dt-bindings/pinctrl/dra.h7
-rw-r--r--include/dt-bindings/reset/qcom,gcc-apq8084.h109
-rw-r--r--include/dt-bindings/reset/qcom,gcc-ipq806x.h132
-rw-r--r--include/dt-bindings/reset/qcom,gcc-msm8960.h16
-rw-r--r--include/dt-bindings/reset/qcom,mmcc-apq8084.h64
-rw-r--r--include/dt-bindings/reset/qcom,mmcc-msm8960.h8
-rw-r--r--include/linux/ahci_platform.h4
-rw-r--r--include/linux/amba/xilinx_dma.h47
-rw-r--r--include/linux/ath9k_platform.h2
-rw-r--r--include/linux/bio.h13
-rw-r--r--include/linux/blk-mq.h4
-rw-r--r--include/linux/blk_types.h4
-rw-r--r--include/linux/blkdev.h24
-rw-r--r--include/linux/can/core.h6
-rw-r--r--include/linux/can/dev.h6
-rw-r--r--include/linux/can/led.h6
-rw-r--r--include/linux/can/platform/cc770.h6
-rw-r--r--include/linux/can/platform/mcp251x.h6
-rw-r--r--include/linux/can/platform/rcar_can.h17
-rw-r--r--include/linux/can/platform/sja1000.h6
-rw-r--r--include/linux/can/platform/ti_hecc.h6
-rw-r--r--include/linux/can/skb.h6
-rw-r--r--include/linux/capability.h2
-rw-r--r--include/linux/ceph/ceph_fs.h2
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/ceph/mon_client.h11
-rw-r--r--include/linux/cgroup.h415
-rw-r--r--include/linux/cgroup_subsys.h11
-rw-r--r--include/linux/clk-provider.h5
-rw-r--r--include/linux/clk/clk-conf.h20
-rw-r--r--include/linux/clk/ti.h35
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/cpufreq.h29
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--include/linux/cpumask.h10
-rw-r--r--include/linux/crc7.h8
-rw-r--r--include/linux/crypto.h8
-rw-r--r--include/linux/dell-led.h10
-rw-r--r--include/linux/device-mapper.h10
-rw-r--r--include/linux/dmaengine.h2
-rw-r--r--include/linux/efi.h63
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/ethtool.h21
-rw-r--r--include/linux/f2fs_fs.h8
-rw-r--r--include/linux/filter.h384
-rw-r--r--include/linux/fs.h49
-rw-r--r--include/linux/ftrace.h92
-rw-r--r--include/linux/ftrace_event.h6
-rw-r--r--include/linux/gpio_keys.h48
-rw-r--r--include/linux/hugetlb.h1
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h27
-rw-r--r--include/linux/i2c/twl.h4
-rw-r--r--include/linux/ieee80211.h1
-rw-r--r--include/linux/if_bridge.h19
-rw-r--r--include/linux/if_link.h3
-rw-r--r--include/linux/if_macvlan.h3
-rw-r--r--include/linux/if_vlan.h4
-rw-r--r--include/linux/init_task.h9
-rw-r--r--include/linux/input-polldev.h3
-rw-r--r--include/linux/input/pixcir_ts.h44
-rw-r--r--include/linux/input/touchscreen.h22
-rw-r--r--include/linux/irq_work.h5
-rw-r--r--include/linux/irqchip/arm-gic-v3.h200
-rw-r--r--include/linux/isdn/capiutil.h5
-rw-r--r--include/linux/kernfs.h2
-rw-r--r--include/linux/key.h11
-rw-r--r--include/linux/kprobes.h23
-rw-r--r--include/linux/kthread.h13
-rw-r--r--include/linux/ktime.h24
-rw-r--r--include/linux/kvm_host.h2
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/mfd/samsung/rtc.h86
-rw-r--r--include/linux/mlx4/device.h19
-rw-r--r--include/linux/mlx5/driver.h1
-rw-r--r--include/linux/mmc/card.h29
-rw-r--r--include/linux/mmc/dw_mmc.h14
-rw-r--r--include/linux/mmc/host.h59
-rw-r--r--include/linux/mmc/mmc.h23
-rw-r--r--include/linux/mmc/sdhci.h15
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/msi.h3
-rw-r--r--include/linux/mtd/nand.h10
-rw-r--r--include/linux/mtd/pfow.h3
-rw-r--r--include/linux/mtd/spi-nor.h214
-rw-r--r--include/linux/mutex.h8
-rw-r--r--include/linux/netdev_features.h4
-rw-r--r--include/linux/netdevice.h106
-rw-r--r--include/linux/netfilter/nfnetlink_acct.h8
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/nfs.h5
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfs_fs.h9
-rw-r--r--include/linux/nfs_page.h46
-rw-r--r--include/linux/nfs_xdr.h106
-rw-r--r--include/linux/nfsd/debug.h19
-rw-r--r--include/linux/nfsd/export.h110
-rw-r--r--include/linux/nfsd/nfsfh.h63
-rw-r--r--include/linux/nfsd/stats.h45
-rw-r--r--include/linux/nl802154.h31
-rw-r--r--include/linux/nmi.h12
-rw-r--r--include/linux/nvme.h14
-rw-r--r--include/linux/of_fdt.h3
-rw-r--r--include/linux/of_mdio.h23
-rw-r--r--include/linux/omap-dma.h19
-rw-r--r--include/linux/omap-dmaengine.h21
-rw-r--r--include/linux/osq_lock.h27
-rw-r--r--include/linux/page-flags.h15
-rw-r--r--include/linux/pagemap.h12
-rw-r--r--include/linux/pci.h21
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/percpu-defs.h384
-rw-r--r--include/linux/percpu-refcount.h92
-rw-r--r--include/linux/percpu.h673
-rw-r--r--include/linux/perf_event.h18
-rw-r--r--include/linux/phy.h17
-rw-r--r--include/linux/phy_fixed.h16
-rw-r--r--include/linux/platform_data/ata-samsung_cf.h1
-rw-r--r--include/linux/platform_data/elm.h3
-rw-r--r--include/linux/platform_data/intel-mid_wdt.h22
-rw-r--r--include/linux/platform_data/leds-pca9685.h35
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h5
-rw-r--r--include/linux/platform_data/mtd-nand-pxa3xx.h3
-rw-r--r--include/linux/platform_data/omap4-keypad.h13
-rw-r--r--include/linux/platform_data/pwm-renesas-tpu.h16
-rw-r--r--include/linux/platform_data/shtc1.h23
-rw-r--r--include/linux/platform_data/st21nfca.h32
-rw-r--r--include/linux/profile.h1
-rw-r--r--include/linux/ptrace.h3
-rw-r--r--include/linux/pwm.h6
-rw-r--r--include/linux/pwm_backlight.h5
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/rcupdate.h91
-rw-r--r--include/linux/regulator/consumer.h5
-rw-r--r--include/linux/rfkill-gpio.h10
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rtmutex.h6
-rw-r--r--include/linux/rwsem-spinlock.h8
-rw-r--r--include/linux/rwsem.h33
-rw-r--r--include/linux/sched.h42
-rw-r--r--include/linux/security.h6
-rw-r--r--include/linux/seqlock.h2
-rw-r--r--include/linux/shdma-base.h1
-rw-r--r--include/linux/skbuff.h172
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/at86rf230.h14
-rw-r--r--include/linux/splice.h10
-rw-r--r--include/linux/ssb/ssb.h1
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--include/linux/sunrpc/svc.h13
-rw-r--r--include/linux/sunrpc/svc_rdma.h3
-rw-r--r--include/linux/sunrpc/svc_xprt.h2
-rw-r--r--include/linux/sunrpc/xdr.h3
-rw-r--r--include/linux/sunrpc/xprt.h6
-rw-r--r--include/linux/suspend.h2
-rw-r--r--include/linux/tcp.h10
-rw-r--r--include/linux/tick.h29
-rw-r--r--include/linux/trace_seq.h46
-rw-r--r--include/linux/tracepoint.h10
-rw-r--r--include/linux/udp.h24
-rw-r--r--include/linux/uio.h66
-rw-r--r--include/linux/uprobes.h4
-rw-r--r--include/linux/usb/cdc_ncm.h35
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_scsi.h15
-rw-r--r--include/linux/wait.h125
-rw-r--r--include/linux/workqueue.h40
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/media/videobuf2-core.h1
-rw-r--r--include/net/6lowpan.h1
-rw-r--r--include/net/addrconf.h5
-rw-r--r--include/net/af_ieee802154.h10
-rw-r--r--include/net/bluetooth/hci.h22
-rw-r--r--include/net/bluetooth/hci_core.h24
-rw-r--r--include/net/bluetooth/mgmt.h15
-rw-r--r--include/net/bluetooth/rfcomm.h6
-rw-r--r--include/net/cfg80211.h275
-rw-r--r--include/net/checksum.h2
-rw-r--r--include/net/dsa.h5
-rw-r--r--include/net/gre.h5
-rw-r--r--include/net/ieee802154.h9
-rw-r--r--include/net/ieee802154_netdev.h187
-rw-r--r--include/net/inet_ecn.h2
-rw-r--r--include/net/inet_hashtables.h8
-rw-r--r--include/net/inet_sock.h10
-rw-r--r--include/net/inetpeer.h17
-rw-r--r--include/net/ip.h74
-rw-r--r--include/net/ip6_checksum.h19
-rw-r--r--include/net/ip6_route.h2
-rw-r--r--include/net/ipv6.h24
-rw-r--r--include/net/mac80211.h155
-rw-r--r--include/net/neighbour.h1
-rw-r--r--include/net/net_namespace.h8
-rw-r--r--include/net/netfilter/nf_nat.h2
-rw-r--r--include/net/netfilter/nf_tables.h142
-rw-r--r--include/net/netfilter/nft_meta.h36
-rw-r--r--include/net/netns/ieee802154_6lowpan.h2
-rw-r--r--include/net/netns/ipv4.h7
-rw-r--r--include/net/netns/ipv6.h1
-rw-r--r--include/net/netns/nftables.h2
-rw-r--r--include/net/nfc/digital.h4
-rw-r--r--include/net/nfc/hci.h1
-rw-r--r--include/net/nfc/nfc.h3
-rw-r--r--include/net/pkt_cls.h2
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/protocol.h1
-rw-r--r--include/net/regulatory.h6
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/secure_seq.h2
-rw-r--r--include/net/snmp.h32
-rw-r--r--include/net/sock.h22
-rw-r--r--include/net/tcp.h47
-rw-r--r--include/net/tso.h20
-rw-r--r--include/net/udp.h22
-rw-r--r--include/net/vxlan.h14
-rw-r--r--include/net/xfrm.h57
-rw-r--r--include/rdma/ib_verbs.h11
-rw-r--r--include/rdma/iw_portmap.h199
-rw-r--r--include/rdma/rdma_netlink.h23
-rw-r--r--include/scsi/osd_protocol.h10
-rw-r--r--include/scsi/scsi_cmnd.h26
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_driver.h9
-rw-r--r--include/sound/core.h2
-rw-r--r--include/sound/pcm.h2
-rw-r--r--include/target/iscsi/iscsi_transport.h3
-rw-r--r--include/target/target_core_backend.h1
-rw-r--r--include/trace/events/ext4.h9
-rw-r--r--include/trace/events/f2fs.h146
-rw-r--r--include/trace/events/power.h84
-rw-r--r--include/trace/events/sched.h20
-rw-r--r--include/trace/ftrace.h99
-rw-r--r--include/trace/syscall.h15
-rw-r--r--include/uapi/drm/drm_mode.h16
-rw-r--r--include/uapi/drm/i915_drm.h17
-rw-r--r--include/uapi/drm/radeon_drm.h2
-rw-r--r--include/uapi/linux/audit.h9
-rw-r--r--include/uapi/linux/btrfs.h20
-rw-r--r--include/uapi/linux/can.h6
-rw-r--r--include/uapi/linux/can/bcm.h6
-rw-r--r--include/uapi/linux/can/error.h6
-rw-r--r--include/uapi/linux/can/gw.h6
-rw-r--r--include/uapi/linux/can/netlink.h6
-rw-r--r--include/uapi/linux/can/raw.h6
-rw-r--r--include/uapi/linux/capability.h7
-rw-r--r--include/uapi/linux/ethtool.h35
-rw-r--r--include/uapi/linux/filter.h3
-rw-r--r--include/uapi/linux/fuse.h3
-rw-r--r--include/uapi/linux/if_fddi.h90
-rw-r--r--include/uapi/linux/if_link.h12
-rw-r--r--include/uapi/linux/if_tunnel.h2
-rw-r--r--include/uapi/linux/kvm.h7
-rw-r--r--include/uapi/linux/kvm_para.h3
-rw-r--r--include/uapi/linux/l2tp.h2
-rw-r--r--include/uapi/linux/neighbour.h1
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h37
-rw-r--r--include/uapi/linux/netfilter/nfnetlink.h2
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_acct.h9
-rw-r--r--include/uapi/linux/nfc.h16
-rw-r--r--include/uapi/linux/nfsd/nfsfh.h32
-rw-r--r--include/uapi/linux/nl80211.h67
-rw-r--r--include/uapi/linux/nvme.h50
-rw-r--r--include/uapi/linux/openvswitch.h4
-rw-r--r--include/uapi/linux/perf_event.h13
-rw-r--r--include/uapi/linux/tipc.h23
-rw-r--r--include/uapi/linux/tipc_config.h10
-rw-r--r--include/uapi/linux/udp.h2
-rw-r--r--include/uapi/linux/usb/functionfs.h7
-rw-r--r--include/uapi/mtd/mtd-abi.h1
-rw-r--r--include/uapi/rdma/rdma_netlink.h96
-rw-r--r--include/uapi/sound/compress_offload.h14
-rw-r--r--include/uapi/sound/compress_params.h14
-rw-r--r--include/video/imx-ipu-v3.h347
-rw-r--r--include/xen/grant_table.h1
-rw-r--r--include/xen/interface/io/netif.h53
-rw-r--r--include/xen/interface/platform.h123
-rw-r--r--include/xen/xen-ops.h11
328 files changed, 9165 insertions, 2630 deletions
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 6eb1d3cb5104..9b9b6f29bbf3 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -53,7 +53,7 @@ struct acpi_power_register {
53 u8 bit_offset; 53 u8 bit_offset;
54 u8 access_size; 54 u8 access_size;
55 u64 address; 55 u64 address;
56} __attribute__ ((packed)); 56} __packed;
57 57
58struct acpi_processor_cx { 58struct acpi_processor_cx {
59 u8 valid; 59 u8 valid;
@@ -83,7 +83,7 @@ struct acpi_psd_package {
83 u64 domain; 83 u64 domain;
84 u64 coord_type; 84 u64 coord_type;
85 u64 num_processors; 85 u64 num_processors;
86} __attribute__ ((packed)); 86} __packed;
87 87
88struct acpi_pct_register { 88struct acpi_pct_register {
89 u8 descriptor; 89 u8 descriptor;
@@ -93,7 +93,7 @@ struct acpi_pct_register {
93 u8 bit_offset; 93 u8 bit_offset;
94 u8 reserved; 94 u8 reserved;
95 u64 address; 95 u64 address;
96} __attribute__ ((packed)); 96} __packed;
97 97
98struct acpi_processor_px { 98struct acpi_processor_px {
99 u64 core_frequency; /* megahertz */ 99 u64 core_frequency; /* megahertz */
@@ -124,7 +124,7 @@ struct acpi_tsd_package {
124 u64 domain; 124 u64 domain;
125 u64 coord_type; 125 u64 coord_type;
126 u64 num_processors; 126 u64 num_processors;
127} __attribute__ ((packed)); 127} __packed;
128 128
129struct acpi_ptc_register { 129struct acpi_ptc_register {
130 u8 descriptor; 130 u8 descriptor;
@@ -134,7 +134,7 @@ struct acpi_ptc_register {
134 u8 bit_offset; 134 u8 bit_offset;
135 u8 reserved; 135 u8 reserved;
136 u64 address; 136 u64 address;
137} __attribute__ ((packed)); 137} __packed;
138 138
139struct acpi_processor_tx_tss { 139struct acpi_processor_tx_tss {
140 u64 freqpercentage; /* */ 140 u64 freqpercentage; /* */
diff --git a/include/acpi/video.h b/include/acpi/video.h
index ea4c7bbded4d..843ef1adfbfa 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -22,6 +22,7 @@ extern void acpi_video_unregister(void);
22extern void acpi_video_unregister_backlight(void); 22extern void acpi_video_unregister_backlight(void);
23extern int acpi_video_get_edid(struct acpi_device *device, int type, 23extern int acpi_video_get_edid(struct acpi_device *device, int type,
24 int device_id, void **edid); 24 int device_id, void **edid);
25extern bool acpi_video_verify_backlight_support(void);
25#else 26#else
26static inline int acpi_video_register(void) { return 0; } 27static inline int acpi_video_register(void) { return 0; }
27static inline void acpi_video_unregister(void) { return; } 28static inline void acpi_video_unregister(void) { return; }
@@ -31,6 +32,7 @@ static inline int acpi_video_get_edid(struct acpi_device *device, int type,
31{ 32{
32 return -ENODEV; 33 return -ENODEV;
33} 34}
35static inline bool acpi_video_verify_backlight_support(void) { return false; }
34#endif 36#endif
35 37
36#endif 38#endif
diff --git a/include/asm-generic/io-64-nonatomic-hi-lo.h b/include/asm-generic/io-64-nonatomic-hi-lo.h
index a6806a94250d..2e29d13fc154 100644
--- a/include/asm-generic/io-64-nonatomic-hi-lo.h
+++ b/include/asm-generic/io-64-nonatomic-hi-lo.h
@@ -4,8 +4,7 @@
4#include <linux/io.h> 4#include <linux/io.h>
5#include <asm-generic/int-ll64.h> 5#include <asm-generic/int-ll64.h>
6 6
7#ifndef readq 7static inline __u64 hi_lo_readq(const volatile void __iomem *addr)
8static inline __u64 readq(const volatile void __iomem *addr)
9{ 8{
10 const volatile u32 __iomem *p = addr; 9 const volatile u32 __iomem *p = addr;
11 u32 low, high; 10 u32 low, high;
@@ -15,14 +14,19 @@ static inline __u64 readq(const volatile void __iomem *addr)
15 14
16 return low + ((u64)high << 32); 15 return low + ((u64)high << 32);
17} 16}
18#endif
19 17
20#ifndef writeq 18static inline void hi_lo_writeq(__u64 val, volatile void __iomem *addr)
21static inline void writeq(__u64 val, volatile void __iomem *addr)
22{ 19{
23 writel(val >> 32, addr + 4); 20 writel(val >> 32, addr + 4);
24 writel(val, addr); 21 writel(val, addr);
25} 22}
23
24#ifndef readq
25#define readq hi_lo_readq
26#endif
27
28#ifndef writeq
29#define writeq hi_lo_writeq
26#endif 30#endif
27 31
28#endif /* _ASM_IO_64_NONATOMIC_HI_LO_H_ */ 32#endif /* _ASM_IO_64_NONATOMIC_HI_LO_H_ */
diff --git a/include/asm-generic/io-64-nonatomic-lo-hi.h b/include/asm-generic/io-64-nonatomic-lo-hi.h
index ca546b1ff8b5..0efacff0a1ce 100644
--- a/include/asm-generic/io-64-nonatomic-lo-hi.h
+++ b/include/asm-generic/io-64-nonatomic-lo-hi.h
@@ -4,8 +4,7 @@
4#include <linux/io.h> 4#include <linux/io.h>
5#include <asm-generic/int-ll64.h> 5#include <asm-generic/int-ll64.h>
6 6
7#ifndef readq 7static inline __u64 lo_hi_readq(const volatile void __iomem *addr)
8static inline __u64 readq(const volatile void __iomem *addr)
9{ 8{
10 const volatile u32 __iomem *p = addr; 9 const volatile u32 __iomem *p = addr;
11 u32 low, high; 10 u32 low, high;
@@ -15,14 +14,19 @@ static inline __u64 readq(const volatile void __iomem *addr)
15 14
16 return low + ((u64)high << 32); 15 return low + ((u64)high << 32);
17} 16}
18#endif
19 17
20#ifndef writeq 18static inline void lo_hi_writeq(__u64 val, volatile void __iomem *addr)
21static inline void writeq(__u64 val, volatile void __iomem *addr)
22{ 19{
23 writel(val, addr); 20 writel(val, addr);
24 writel(val >> 32, addr + 4); 21 writel(val >> 32, addr + 4);
25} 22}
23
24#ifndef readq
25#define readq lo_hi_readq
26#endif
27
28#ifndef writeq
29#define writeq lo_hi_writeq
26#endif 30#endif
27 31
28#endif /* _ASM_IO_64_NONATOMIC_LO_HI_H_ */ 32#endif /* _ASM_IO_64_NONATOMIC_LO_HI_H_ */
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 0703aa75b5e8..4d9f233c4ba8 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -36,93 +36,385 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
36#endif 36#endif
37 37
38/* 38/*
39 * Add a offset to a pointer but keep the pointer as is. 39 * Arch may define arch_raw_cpu_ptr() to provide more efficient address
40 * 40 * translations for raw_cpu_ptr().
41 * Only S390 provides its own means of moving the pointer.
42 */ 41 */
43#ifndef SHIFT_PERCPU_PTR 42#ifndef arch_raw_cpu_ptr
44/* Weird cast keeps both GCC and sparse happy. */ 43#define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
45#define SHIFT_PERCPU_PTR(__p, __offset) ({ \
46 __verify_pcpu_ptr((__p)); \
47 RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)); \
48})
49#endif 44#endif
50 45
51/* 46#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
52 * A percpu variable may point to a discarded regions. The following are 47extern void setup_per_cpu_areas(void);
53 * established ways to produce a usable pointer from the percpu variable
54 * offset.
55 */
56#define per_cpu(var, cpu) \
57 (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu)))
58
59#ifndef raw_cpu_ptr
60#define raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
61#endif 48#endif
62#ifdef CONFIG_DEBUG_PREEMPT 49
63#define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) 50#endif /* SMP */
51
52#ifndef PER_CPU_BASE_SECTION
53#ifdef CONFIG_SMP
54#define PER_CPU_BASE_SECTION ".data..percpu"
64#else 55#else
65#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) 56#define PER_CPU_BASE_SECTION ".data"
57#endif
66#endif 58#endif
67 59
68#define __get_cpu_var(var) (*this_cpu_ptr(&(var))) 60#ifndef PER_CPU_ATTRIBUTES
69#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) 61#define PER_CPU_ATTRIBUTES
62#endif
70 63
71#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA 64#ifndef PER_CPU_DEF_ATTRIBUTES
72extern void setup_per_cpu_areas(void); 65#define PER_CPU_DEF_ATTRIBUTES
73#endif 66#endif
74 67
75#else /* ! SMP */ 68#define raw_cpu_generic_to_op(pcp, val, op) \
69do { \
70 *raw_cpu_ptr(&(pcp)) op val; \
71} while (0)
76 72
77#define VERIFY_PERCPU_PTR(__p) ({ \ 73#define raw_cpu_generic_add_return(pcp, val) \
78 __verify_pcpu_ptr((__p)); \ 74({ \
79 (typeof(*(__p)) __kernel __force *)(__p); \ 75 raw_cpu_add(pcp, val); \
76 raw_cpu_read(pcp); \
80}) 77})
81 78
82#define per_cpu(var, cpu) (*((void)(cpu), VERIFY_PERCPU_PTR(&(var)))) 79#define raw_cpu_generic_xchg(pcp, nval) \
83#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) 80({ \
84#define __raw_get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) 81 typeof(pcp) __ret; \
85#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) 82 __ret = raw_cpu_read(pcp); \
86#define raw_cpu_ptr(ptr) this_cpu_ptr(ptr) 83 raw_cpu_write(pcp, nval); \
84 __ret; \
85})
87 86
88#endif /* SMP */ 87#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
88({ \
89 typeof(pcp) __ret; \
90 __ret = raw_cpu_read(pcp); \
91 if (__ret == (oval)) \
92 raw_cpu_write(pcp, nval); \
93 __ret; \
94})
89 95
90#ifndef PER_CPU_BASE_SECTION 96#define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
91#ifdef CONFIG_SMP 97({ \
92#define PER_CPU_BASE_SECTION ".data..percpu" 98 int __ret = 0; \
93#else 99 if (raw_cpu_read(pcp1) == (oval1) && \
94#define PER_CPU_BASE_SECTION ".data" 100 raw_cpu_read(pcp2) == (oval2)) { \
101 raw_cpu_write(pcp1, nval1); \
102 raw_cpu_write(pcp2, nval2); \
103 __ret = 1; \
104 } \
105 (__ret); \
106})
107
108#define this_cpu_generic_read(pcp) \
109({ \
110 typeof(pcp) __ret; \
111 preempt_disable(); \
112 __ret = *this_cpu_ptr(&(pcp)); \
113 preempt_enable(); \
114 __ret; \
115})
116
117#define this_cpu_generic_to_op(pcp, val, op) \
118do { \
119 unsigned long __flags; \
120 raw_local_irq_save(__flags); \
121 *raw_cpu_ptr(&(pcp)) op val; \
122 raw_local_irq_restore(__flags); \
123} while (0)
124
125#define this_cpu_generic_add_return(pcp, val) \
126({ \
127 typeof(pcp) __ret; \
128 unsigned long __flags; \
129 raw_local_irq_save(__flags); \
130 raw_cpu_add(pcp, val); \
131 __ret = raw_cpu_read(pcp); \
132 raw_local_irq_restore(__flags); \
133 __ret; \
134})
135
136#define this_cpu_generic_xchg(pcp, nval) \
137({ \
138 typeof(pcp) __ret; \
139 unsigned long __flags; \
140 raw_local_irq_save(__flags); \
141 __ret = raw_cpu_read(pcp); \
142 raw_cpu_write(pcp, nval); \
143 raw_local_irq_restore(__flags); \
144 __ret; \
145})
146
147#define this_cpu_generic_cmpxchg(pcp, oval, nval) \
148({ \
149 typeof(pcp) __ret; \
150 unsigned long __flags; \
151 raw_local_irq_save(__flags); \
152 __ret = raw_cpu_read(pcp); \
153 if (__ret == (oval)) \
154 raw_cpu_write(pcp, nval); \
155 raw_local_irq_restore(__flags); \
156 __ret; \
157})
158
159#define this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
160({ \
161 int __ret; \
162 unsigned long __flags; \
163 raw_local_irq_save(__flags); \
164 __ret = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \
165 oval1, oval2, nval1, nval2); \
166 raw_local_irq_restore(__flags); \
167 __ret; \
168})
169
170#ifndef raw_cpu_read_1
171#define raw_cpu_read_1(pcp) (*raw_cpu_ptr(&(pcp)))
95#endif 172#endif
173#ifndef raw_cpu_read_2
174#define raw_cpu_read_2(pcp) (*raw_cpu_ptr(&(pcp)))
175#endif
176#ifndef raw_cpu_read_4
177#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))
178#endif
179#ifndef raw_cpu_read_8
180#define raw_cpu_read_8(pcp) (*raw_cpu_ptr(&(pcp)))
96#endif 181#endif
97 182
98#ifdef CONFIG_SMP 183#ifndef raw_cpu_write_1
184#define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
185#endif
186#ifndef raw_cpu_write_2
187#define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
188#endif
189#ifndef raw_cpu_write_4
190#define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
191#endif
192#ifndef raw_cpu_write_8
193#define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
194#endif
99 195
100#ifdef MODULE 196#ifndef raw_cpu_add_1
101#define PER_CPU_SHARED_ALIGNED_SECTION "" 197#define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
102#define PER_CPU_ALIGNED_SECTION "" 198#endif
103#else 199#ifndef raw_cpu_add_2
104#define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned" 200#define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
105#define PER_CPU_ALIGNED_SECTION "..shared_aligned" 201#endif
202#ifndef raw_cpu_add_4
203#define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
204#endif
205#ifndef raw_cpu_add_8
206#define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
106#endif 207#endif
107#define PER_CPU_FIRST_SECTION "..first"
108 208
109#else 209#ifndef raw_cpu_and_1
210#define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
211#endif
212#ifndef raw_cpu_and_2
213#define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
214#endif
215#ifndef raw_cpu_and_4
216#define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
217#endif
218#ifndef raw_cpu_and_8
219#define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
220#endif
221
222#ifndef raw_cpu_or_1
223#define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
224#endif
225#ifndef raw_cpu_or_2
226#define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
227#endif
228#ifndef raw_cpu_or_4
229#define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
230#endif
231#ifndef raw_cpu_or_8
232#define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
233#endif
110 234
111#define PER_CPU_SHARED_ALIGNED_SECTION "" 235#ifndef raw_cpu_add_return_1
112#define PER_CPU_ALIGNED_SECTION "..shared_aligned" 236#define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val)
113#define PER_CPU_FIRST_SECTION "" 237#endif
238#ifndef raw_cpu_add_return_2
239#define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val)
240#endif
241#ifndef raw_cpu_add_return_4
242#define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val)
243#endif
244#ifndef raw_cpu_add_return_8
245#define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
246#endif
114 247
248#ifndef raw_cpu_xchg_1
249#define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
250#endif
251#ifndef raw_cpu_xchg_2
252#define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
253#endif
254#ifndef raw_cpu_xchg_4
255#define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
256#endif
257#ifndef raw_cpu_xchg_8
258#define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
115#endif 259#endif
116 260
117#ifndef PER_CPU_ATTRIBUTES 261#ifndef raw_cpu_cmpxchg_1
118#define PER_CPU_ATTRIBUTES 262#define raw_cpu_cmpxchg_1(pcp, oval, nval) \
263 raw_cpu_generic_cmpxchg(pcp, oval, nval)
264#endif
265#ifndef raw_cpu_cmpxchg_2
266#define raw_cpu_cmpxchg_2(pcp, oval, nval) \
267 raw_cpu_generic_cmpxchg(pcp, oval, nval)
268#endif
269#ifndef raw_cpu_cmpxchg_4
270#define raw_cpu_cmpxchg_4(pcp, oval, nval) \
271 raw_cpu_generic_cmpxchg(pcp, oval, nval)
272#endif
273#ifndef raw_cpu_cmpxchg_8
274#define raw_cpu_cmpxchg_8(pcp, oval, nval) \
275 raw_cpu_generic_cmpxchg(pcp, oval, nval)
119#endif 276#endif
120 277
121#ifndef PER_CPU_DEF_ATTRIBUTES 278#ifndef raw_cpu_cmpxchg_double_1
122#define PER_CPU_DEF_ATTRIBUTES 279#define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
280 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
281#endif
282#ifndef raw_cpu_cmpxchg_double_2
283#define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
284 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
285#endif
286#ifndef raw_cpu_cmpxchg_double_4
287#define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
288 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
289#endif
290#ifndef raw_cpu_cmpxchg_double_8
291#define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
292 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
293#endif
294
295#ifndef this_cpu_read_1
296#define this_cpu_read_1(pcp) this_cpu_generic_read(pcp)
297#endif
298#ifndef this_cpu_read_2
299#define this_cpu_read_2(pcp) this_cpu_generic_read(pcp)
300#endif
301#ifndef this_cpu_read_4
302#define this_cpu_read_4(pcp) this_cpu_generic_read(pcp)
303#endif
304#ifndef this_cpu_read_8
305#define this_cpu_read_8(pcp) this_cpu_generic_read(pcp)
123#endif 306#endif
124 307
125/* Keep until we have removed all uses of __this_cpu_ptr */ 308#ifndef this_cpu_write_1
126#define __this_cpu_ptr raw_cpu_ptr 309#define this_cpu_write_1(pcp, val) this_cpu_generic_to_op(pcp, val, =)
310#endif
311#ifndef this_cpu_write_2
312#define this_cpu_write_2(pcp, val) this_cpu_generic_to_op(pcp, val, =)
313#endif
314#ifndef this_cpu_write_4
315#define this_cpu_write_4(pcp, val) this_cpu_generic_to_op(pcp, val, =)
316#endif
317#ifndef this_cpu_write_8
318#define this_cpu_write_8(pcp, val) this_cpu_generic_to_op(pcp, val, =)
319#endif
320
321#ifndef this_cpu_add_1
322#define this_cpu_add_1(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
323#endif
324#ifndef this_cpu_add_2
325#define this_cpu_add_2(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
326#endif
327#ifndef this_cpu_add_4
328#define this_cpu_add_4(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
329#endif
330#ifndef this_cpu_add_8
331#define this_cpu_add_8(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
332#endif
333
334#ifndef this_cpu_and_1
335#define this_cpu_and_1(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
336#endif
337#ifndef this_cpu_and_2
338#define this_cpu_and_2(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
339#endif
340#ifndef this_cpu_and_4
341#define this_cpu_and_4(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
342#endif
343#ifndef this_cpu_and_8
344#define this_cpu_and_8(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
345#endif
346
347#ifndef this_cpu_or_1
348#define this_cpu_or_1(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
349#endif
350#ifndef this_cpu_or_2
351#define this_cpu_or_2(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
352#endif
353#ifndef this_cpu_or_4
354#define this_cpu_or_4(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
355#endif
356#ifndef this_cpu_or_8
357#define this_cpu_or_8(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
358#endif
359
360#ifndef this_cpu_add_return_1
361#define this_cpu_add_return_1(pcp, val) this_cpu_generic_add_return(pcp, val)
362#endif
363#ifndef this_cpu_add_return_2
364#define this_cpu_add_return_2(pcp, val) this_cpu_generic_add_return(pcp, val)
365#endif
366#ifndef this_cpu_add_return_4
367#define this_cpu_add_return_4(pcp, val) this_cpu_generic_add_return(pcp, val)
368#endif
369#ifndef this_cpu_add_return_8
370#define this_cpu_add_return_8(pcp, val) this_cpu_generic_add_return(pcp, val)
371#endif
372
373#ifndef this_cpu_xchg_1
374#define this_cpu_xchg_1(pcp, nval) this_cpu_generic_xchg(pcp, nval)
375#endif
376#ifndef this_cpu_xchg_2
377#define this_cpu_xchg_2(pcp, nval) this_cpu_generic_xchg(pcp, nval)
378#endif
379#ifndef this_cpu_xchg_4
380#define this_cpu_xchg_4(pcp, nval) this_cpu_generic_xchg(pcp, nval)
381#endif
382#ifndef this_cpu_xchg_8
383#define this_cpu_xchg_8(pcp, nval) this_cpu_generic_xchg(pcp, nval)
384#endif
385
386#ifndef this_cpu_cmpxchg_1
387#define this_cpu_cmpxchg_1(pcp, oval, nval) \
388 this_cpu_generic_cmpxchg(pcp, oval, nval)
389#endif
390#ifndef this_cpu_cmpxchg_2
391#define this_cpu_cmpxchg_2(pcp, oval, nval) \
392 this_cpu_generic_cmpxchg(pcp, oval, nval)
393#endif
394#ifndef this_cpu_cmpxchg_4
395#define this_cpu_cmpxchg_4(pcp, oval, nval) \
396 this_cpu_generic_cmpxchg(pcp, oval, nval)
397#endif
398#ifndef this_cpu_cmpxchg_8
399#define this_cpu_cmpxchg_8(pcp, oval, nval) \
400 this_cpu_generic_cmpxchg(pcp, oval, nval)
401#endif
402
403#ifndef this_cpu_cmpxchg_double_1
404#define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
405 this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
406#endif
407#ifndef this_cpu_cmpxchg_double_2
408#define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
409 this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
410#endif
411#ifndef this_cpu_cmpxchg_double_4
412#define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
413 this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
414#endif
415#ifndef this_cpu_cmpxchg_double_8
416#define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
417 this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
418#endif
127 419
128#endif /* _ASM_GENERIC_PERCPU_H_ */ 420#endif /* _ASM_GENERIC_PERCPU_H_ */
diff --git a/include/asm-generic/qrwlock.h b/include/asm-generic/qrwlock.h
new file mode 100644
index 000000000000..6383d54bf983
--- /dev/null
+++ b/include/asm-generic/qrwlock.h
@@ -0,0 +1,166 @@
1/*
2 * Queue read/write lock
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 * (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
15 *
16 * Authors: Waiman Long <waiman.long@hp.com>
17 */
18#ifndef __ASM_GENERIC_QRWLOCK_H
19#define __ASM_GENERIC_QRWLOCK_H
20
21#include <linux/atomic.h>
22#include <asm/barrier.h>
23#include <asm/processor.h>
24
25#include <asm-generic/qrwlock_types.h>
26
27/*
28 * Writer states & reader shift and bias
29 */
30#define _QW_WAITING 1 /* A writer is waiting */
31#define _QW_LOCKED 0xff /* A writer holds the lock */
32#define _QW_WMASK 0xff /* Writer mask */
33#define _QR_SHIFT 8 /* Reader count shift */
34#define _QR_BIAS (1U << _QR_SHIFT)
35
36/*
37 * External function declarations
38 */
39extern void queue_read_lock_slowpath(struct qrwlock *lock);
40extern void queue_write_lock_slowpath(struct qrwlock *lock);
41
42/**
43 * queue_read_can_lock- would read_trylock() succeed?
44 * @lock: Pointer to queue rwlock structure
45 */
46static inline int queue_read_can_lock(struct qrwlock *lock)
47{
48 return !(atomic_read(&lock->cnts) & _QW_WMASK);
49}
50
51/**
52 * queue_write_can_lock- would write_trylock() succeed?
53 * @lock: Pointer to queue rwlock structure
54 */
55static inline int queue_write_can_lock(struct qrwlock *lock)
56{
57 return !atomic_read(&lock->cnts);
58}
59
60/**
61 * queue_read_trylock - try to acquire read lock of a queue rwlock
62 * @lock : Pointer to queue rwlock structure
63 * Return: 1 if lock acquired, 0 if failed
64 */
65static inline int queue_read_trylock(struct qrwlock *lock)
66{
67 u32 cnts;
68
69 cnts = atomic_read(&lock->cnts);
70 if (likely(!(cnts & _QW_WMASK))) {
71 cnts = (u32)atomic_add_return(_QR_BIAS, &lock->cnts);
72 if (likely(!(cnts & _QW_WMASK)))
73 return 1;
74 atomic_sub(_QR_BIAS, &lock->cnts);
75 }
76 return 0;
77}
78
79/**
80 * queue_write_trylock - try to acquire write lock of a queue rwlock
81 * @lock : Pointer to queue rwlock structure
82 * Return: 1 if lock acquired, 0 if failed
83 */
84static inline int queue_write_trylock(struct qrwlock *lock)
85{
86 u32 cnts;
87
88 cnts = atomic_read(&lock->cnts);
89 if (unlikely(cnts))
90 return 0;
91
92 return likely(atomic_cmpxchg(&lock->cnts,
93 cnts, cnts | _QW_LOCKED) == cnts);
94}
95/**
96 * queue_read_lock - acquire read lock of a queue rwlock
97 * @lock: Pointer to queue rwlock structure
98 */
99static inline void queue_read_lock(struct qrwlock *lock)
100{
101 u32 cnts;
102
103 cnts = atomic_add_return(_QR_BIAS, &lock->cnts);
104 if (likely(!(cnts & _QW_WMASK)))
105 return;
106
107 /* The slowpath will decrement the reader count, if necessary. */
108 queue_read_lock_slowpath(lock);
109}
110
111/**
112 * queue_write_lock - acquire write lock of a queue rwlock
113 * @lock : Pointer to queue rwlock structure
114 */
115static inline void queue_write_lock(struct qrwlock *lock)
116{
117 /* Optimize for the unfair lock case where the fair flag is 0. */
118 if (atomic_cmpxchg(&lock->cnts, 0, _QW_LOCKED) == 0)
119 return;
120
121 queue_write_lock_slowpath(lock);
122}
123
124/**
125 * queue_read_unlock - release read lock of a queue rwlock
126 * @lock : Pointer to queue rwlock structure
127 */
128static inline void queue_read_unlock(struct qrwlock *lock)
129{
130 /*
131 * Atomically decrement the reader count
132 */
133 smp_mb__before_atomic();
134 atomic_sub(_QR_BIAS, &lock->cnts);
135}
136
137#ifndef queue_write_unlock
138/**
139 * queue_write_unlock - release write lock of a queue rwlock
140 * @lock : Pointer to queue rwlock structure
141 */
142static inline void queue_write_unlock(struct qrwlock *lock)
143{
144 /*
145 * If the writer field is atomic, it can be cleared directly.
146 * Otherwise, an atomic subtraction will be used to clear it.
147 */
148 smp_mb__before_atomic();
149 atomic_sub(_QW_LOCKED, &lock->cnts);
150}
151#endif
152
153/*
154 * Remapping rwlock architecture specific functions to the corresponding
155 * queue rwlock functions.
156 */
157#define arch_read_can_lock(l) queue_read_can_lock(l)
158#define arch_write_can_lock(l) queue_write_can_lock(l)
159#define arch_read_lock(l) queue_read_lock(l)
160#define arch_write_lock(l) queue_write_lock(l)
161#define arch_read_trylock(l) queue_read_trylock(l)
162#define arch_write_trylock(l) queue_write_trylock(l)
163#define arch_read_unlock(l) queue_read_unlock(l)
164#define arch_write_unlock(l) queue_write_unlock(l)
165
166#endif /* __ASM_GENERIC_QRWLOCK_H */
diff --git a/include/asm-generic/qrwlock_types.h b/include/asm-generic/qrwlock_types.h
new file mode 100644
index 000000000000..4d76f24df518
--- /dev/null
+++ b/include/asm-generic/qrwlock_types.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_GENERIC_QRWLOCK_TYPES_H
2#define __ASM_GENERIC_QRWLOCK_TYPES_H
3
4#include <linux/types.h>
5#include <asm/spinlock_types.h>
6
7/*
8 * The queue read/write lock data structure
9 */
10
11typedef struct qrwlock {
12 atomic_t cnts;
13 arch_spinlock_t lock;
14} arch_rwlock_t;
15
16#define __ARCH_RW_LOCK_UNLOCKED { \
17 .cnts = ATOMIC_INIT(0), \
18 .lock = __ARCH_SPIN_LOCK_UNLOCKED, \
19}
20
21#endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index d647637cd699..c1c0b0cf39b4 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -109,6 +109,15 @@
109#define BRANCH_PROFILE() 109#define BRANCH_PROFILE()
110#endif 110#endif
111 111
112#ifdef CONFIG_KPROBES
113#define KPROBE_BLACKLIST() . = ALIGN(8); \
114 VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
115 *(_kprobe_blacklist) \
116 VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
117#else
118#define KPROBE_BLACKLIST()
119#endif
120
112#ifdef CONFIG_EVENT_TRACING 121#ifdef CONFIG_EVENT_TRACING
113#define FTRACE_EVENTS() . = ALIGN(8); \ 122#define FTRACE_EVENTS() . = ALIGN(8); \
114 VMLINUX_SYMBOL(__start_ftrace_events) = .; \ 123 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
@@ -478,6 +487,7 @@
478 *(.init.rodata) \ 487 *(.init.rodata) \
479 FTRACE_EVENTS() \ 488 FTRACE_EVENTS() \
480 TRACE_SYSCALLS() \ 489 TRACE_SYSCALLS() \
490 KPROBE_BLACKLIST() \
481 MEM_DISCARD(init.rodata) \ 491 MEM_DISCARD(init.rodata) \
482 CLK_OF_TABLES() \ 492 CLK_OF_TABLES() \
483 RESERVEDMEM_OF_TABLES() \ 493 RESERVEDMEM_OF_TABLES() \
@@ -683,7 +693,7 @@
683 . = ALIGN(PAGE_SIZE); \ 693 . = ALIGN(PAGE_SIZE); \
684 *(.data..percpu..page_aligned) \ 694 *(.data..percpu..page_aligned) \
685 . = ALIGN(cacheline); \ 695 . = ALIGN(cacheline); \
686 *(.data..percpu..readmostly) \ 696 *(.data..percpu..read_mostly) \
687 . = ALIGN(cacheline); \ 697 . = ALIGN(cacheline); \
688 *(.data..percpu) \ 698 *(.data..percpu) \
689 *(.data..percpu..shared_aligned) \ 699 *(.data..percpu..shared_aligned) \
diff --git a/include/crypto/aead.h b/include/crypto/aead.h
index 0edf949f6369..94b19be67574 100644
--- a/include/crypto/aead.h
+++ b/include/crypto/aead.h
@@ -75,9 +75,9 @@ static inline void aead_givcrypt_free(struct aead_givcrypt_request *req)
75 75
76static inline void aead_givcrypt_set_callback( 76static inline void aead_givcrypt_set_callback(
77 struct aead_givcrypt_request *req, u32 flags, 77 struct aead_givcrypt_request *req, u32 flags,
78 crypto_completion_t complete, void *data) 78 crypto_completion_t compl, void *data)
79{ 79{
80 aead_request_set_callback(&req->areq, flags, complete, data); 80 aead_request_set_callback(&req->areq, flags, compl, data);
81} 81}
82 82
83static inline void aead_givcrypt_set_crypt(struct aead_givcrypt_request *req, 83static inline void aead_givcrypt_set_crypt(struct aead_givcrypt_request *req,
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 016c2f110f63..623a59c1ff5a 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -410,4 +410,10 @@ static inline int crypto_memneq(const void *a, const void *b, size_t size)
410 return __crypto_memneq(a, b, size) != 0UL ? 1 : 0; 410 return __crypto_memneq(a, b, size) != 0UL ? 1 : 0;
411} 411}
412 412
413static inline void crypto_yield(u32 flags)
414{
415 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
416 cond_resched();
417}
418
413#endif /* _CRYPTO_ALGAPI_H */ 419#endif /* _CRYPTO_ALGAPI_H */
diff --git a/include/crypto/des.h b/include/crypto/des.h
index 2971c6304ade..fc6274c6bb26 100644
--- a/include/crypto/des.h
+++ b/include/crypto/des.h
@@ -16,4 +16,7 @@
16 16
17extern unsigned long des_ekey(u32 *pe, const u8 *k); 17extern unsigned long des_ekey(u32 *pe, const u8 *k);
18 18
19extern int __des3_ede_setkey(u32 *expkey, u32 *flags, const u8 *key,
20 unsigned int keylen);
21
19#endif /* __CRYPTO_DES_H */ 22#endif /* __CRYPTO_DES_H */
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
new file mode 100644
index 000000000000..831d786976c5
--- /dev/null
+++ b/include/crypto/drbg.h
@@ -0,0 +1,290 @@
1/*
2 * DRBG based on NIST SP800-90A
3 *
4 * Copyright Stephan Mueller <smueller@chronox.de>, 2014
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, and the entire permission notice in its entirety,
11 * including the disclaimer of warranties.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote
16 * products derived from this software without specific prior
17 * written permission.
18 *
19 * ALTERNATIVELY, this product may be distributed under the terms of
20 * the GNU General Public License, in which case the provisions of the GPL are
21 * required INSTEAD OF the above restrictions. (This clause is
22 * necessary due to a potential bad interaction between the GPL and
23 * the restrictions contained in a BSD-style copyright.)
24 *
25 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
28 * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
31 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
35 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
36 * DAMAGE.
37 */
38
39#ifndef _DRBG_H
40#define _DRBG_H
41
42
43#include <linux/random.h>
44#include <linux/scatterlist.h>
45#include <crypto/hash.h>
46#include <linux/module.h>
47#include <linux/crypto.h>
48#include <linux/slab.h>
49#include <crypto/internal/rng.h>
50#include <crypto/rng.h>
51#include <linux/fips.h>
52#include <linux/spinlock.h>
53#include <linux/list.h>
54
55/*
56 * Concatenation Helper and string operation helper
57 *
58 * SP800-90A requires the concatenation of different data. To avoid copying
59 * buffers around or allocate additional memory, the following data structure
60 * is used to point to the original memory with its size. In addition, it
61 * is used to build a linked list. The linked list defines the concatenation
62 * of individual buffers. The order of memory block referenced in that
63 * linked list determines the order of concatenation.
64 */
65struct drbg_string {
66 const unsigned char *buf;
67 size_t len;
68 struct list_head list;
69};
70
71static inline void drbg_string_fill(struct drbg_string *string,
72 const unsigned char *buf, size_t len)
73{
74 string->buf = buf;
75 string->len = len;
76 INIT_LIST_HEAD(&string->list);
77}
78
79struct drbg_state;
80typedef uint32_t drbg_flag_t;
81
82struct drbg_core {
83 drbg_flag_t flags; /* flags for the cipher */
84 __u8 statelen; /* maximum state length */
85 /*
86 * maximum length of personalization string or additional input
87 * string -- exponent for base 2
88 */
89 __u8 max_addtllen;
90 /* maximum bits per RNG request -- exponent for base 2*/
91 __u8 max_bits;
92 /* maximum number of requests -- exponent for base 2 */
93 __u8 max_req;
94 __u8 blocklen_bytes; /* block size of output in bytes */
95 char cra_name[CRYPTO_MAX_ALG_NAME]; /* mapping to kernel crypto API */
96 /* kernel crypto API backend cipher name */
97 char backend_cra_name[CRYPTO_MAX_ALG_NAME];
98};
99
100struct drbg_state_ops {
101 int (*update)(struct drbg_state *drbg, struct list_head *seed,
102 int reseed);
103 int (*generate)(struct drbg_state *drbg,
104 unsigned char *buf, unsigned int buflen,
105 struct list_head *addtl);
106 int (*crypto_init)(struct drbg_state *drbg);
107 int (*crypto_fini)(struct drbg_state *drbg);
108
109};
110
111struct drbg_test_data {
112 struct drbg_string *testentropy; /* TEST PARAMETER: test entropy */
113};
114
115struct drbg_state {
116 spinlock_t drbg_lock; /* lock around DRBG */
117 unsigned char *V; /* internal state 10.1.1.1 1a) */
118 /* hash: static value 10.1.1.1 1b) hmac / ctr: key */
119 unsigned char *C;
120 /* Number of RNG requests since last reseed -- 10.1.1.1 1c) */
121 size_t reseed_ctr;
122 /* some memory the DRBG can use for its operation */
123 unsigned char *scratchpad;
124 void *priv_data; /* Cipher handle */
125 bool seeded; /* DRBG fully seeded? */
126 bool pr; /* Prediction resistance enabled? */
127#ifdef CONFIG_CRYPTO_FIPS
128 bool fips_primed; /* Continuous test primed? */
129 unsigned char *prev; /* FIPS 140-2 continuous test value */
130#endif
131 const struct drbg_state_ops *d_ops;
132 const struct drbg_core *core;
133 struct drbg_test_data *test_data;
134};
135
136static inline __u8 drbg_statelen(struct drbg_state *drbg)
137{
138 if (drbg && drbg->core)
139 return drbg->core->statelen;
140 return 0;
141}
142
143static inline __u8 drbg_blocklen(struct drbg_state *drbg)
144{
145 if (drbg && drbg->core)
146 return drbg->core->blocklen_bytes;
147 return 0;
148}
149
150static inline __u8 drbg_keylen(struct drbg_state *drbg)
151{
152 if (drbg && drbg->core)
153 return (drbg->core->statelen - drbg->core->blocklen_bytes);
154 return 0;
155}
156
157static inline size_t drbg_max_request_bytes(struct drbg_state *drbg)
158{
159 /* max_bits is in bits, but buflen is in bytes */
160 return (1 << (drbg->core->max_bits - 3));
161}
162
163static inline size_t drbg_max_addtl(struct drbg_state *drbg)
164{
165 return (1UL<<(drbg->core->max_addtllen));
166}
167
168static inline size_t drbg_max_requests(struct drbg_state *drbg)
169{
170 return (1UL<<(drbg->core->max_req));
171}
172
173/*
174 * kernel crypto API input data structure for DRBG generate in case dlen
175 * is set to 0
176 */
177struct drbg_gen {
178 unsigned char *outbuf; /* output buffer for random numbers */
179 unsigned int outlen; /* size of output buffer */
180 struct drbg_string *addtl; /* additional information string */
181 struct drbg_test_data *test_data; /* test data */
182};
183
184/*
185 * This is a wrapper to the kernel crypto API function of
186 * crypto_rng_get_bytes() to allow the caller to provide additional data.
187 *
188 * @drng DRBG handle -- see crypto_rng_get_bytes
189 * @outbuf output buffer -- see crypto_rng_get_bytes
190 * @outlen length of output buffer -- see crypto_rng_get_bytes
191 * @addtl_input additional information string input buffer
192 * @addtllen length of additional information string buffer
193 *
194 * return
195 * see crypto_rng_get_bytes
196 */
197static inline int crypto_drbg_get_bytes_addtl(struct crypto_rng *drng,
198 unsigned char *outbuf, unsigned int outlen,
199 struct drbg_string *addtl)
200{
201 int ret;
202 struct drbg_gen genbuf;
203 genbuf.outbuf = outbuf;
204 genbuf.outlen = outlen;
205 genbuf.addtl = addtl;
206 genbuf.test_data = NULL;
207 ret = crypto_rng_get_bytes(drng, (u8 *)&genbuf, 0);
208 return ret;
209}
210
211/*
212 * TEST code
213 *
214 * This is a wrapper to the kernel crypto API function of
215 * crypto_rng_get_bytes() to allow the caller to provide additional data and
216 * allow furnishing of test_data
217 *
218 * @drng DRBG handle -- see crypto_rng_get_bytes
219 * @outbuf output buffer -- see crypto_rng_get_bytes
220 * @outlen length of output buffer -- see crypto_rng_get_bytes
221 * @addtl_input additional information string input buffer
222 * @addtllen length of additional information string buffer
223 * @test_data filled test data
224 *
225 * return
226 * see crypto_rng_get_bytes
227 */
228static inline int crypto_drbg_get_bytes_addtl_test(struct crypto_rng *drng,
229 unsigned char *outbuf, unsigned int outlen,
230 struct drbg_string *addtl,
231 struct drbg_test_data *test_data)
232{
233 int ret;
234 struct drbg_gen genbuf;
235 genbuf.outbuf = outbuf;
236 genbuf.outlen = outlen;
237 genbuf.addtl = addtl;
238 genbuf.test_data = test_data;
239 ret = crypto_rng_get_bytes(drng, (u8 *)&genbuf, 0);
240 return ret;
241}
242
243/*
244 * TEST code
245 *
246 * This is a wrapper to the kernel crypto API function of
247 * crypto_rng_reset() to allow the caller to provide test_data
248 *
249 * @drng DRBG handle -- see crypto_rng_reset
250 * @pers personalization string input buffer
251 * @perslen length of additional information string buffer
252 * @test_data filled test data
253 *
254 * return
255 * see crypto_rng_reset
256 */
257static inline int crypto_drbg_reset_test(struct crypto_rng *drng,
258 struct drbg_string *pers,
259 struct drbg_test_data *test_data)
260{
261 int ret;
262 struct drbg_gen genbuf;
263 genbuf.outbuf = NULL;
264 genbuf.outlen = 0;
265 genbuf.addtl = pers;
266 genbuf.test_data = test_data;
267 ret = crypto_rng_reset(drng, (u8 *)&genbuf, 0);
268 return ret;
269}
270
271/* DRBG type flags */
272#define DRBG_CTR ((drbg_flag_t)1<<0)
273#define DRBG_HMAC ((drbg_flag_t)1<<1)
274#define DRBG_HASH ((drbg_flag_t)1<<2)
275#define DRBG_TYPE_MASK (DRBG_CTR | DRBG_HMAC | DRBG_HASH)
276/* DRBG strength flags */
277#define DRBG_STRENGTH128 ((drbg_flag_t)1<<3)
278#define DRBG_STRENGTH192 ((drbg_flag_t)1<<4)
279#define DRBG_STRENGTH256 ((drbg_flag_t)1<<5)
280#define DRBG_STRENGTH_MASK (DRBG_STRENGTH128 | DRBG_STRENGTH192 | \
281 DRBG_STRENGTH256)
282
283enum drbg_prefixes {
284 DRBG_PREFIX0 = 0x00,
285 DRBG_PREFIX1,
286 DRBG_PREFIX2,
287 DRBG_PREFIX3
288};
289
290#endif /* _DRBG_H */
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 26cb1eb16f4c..a39195539601 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -238,10 +238,10 @@ static inline struct ahash_request *ahash_request_cast(
238 238
239static inline void ahash_request_set_callback(struct ahash_request *req, 239static inline void ahash_request_set_callback(struct ahash_request *req,
240 u32 flags, 240 u32 flags,
241 crypto_completion_t complete, 241 crypto_completion_t compl,
242 void *data) 242 void *data)
243{ 243{
244 req->base.complete = complete; 244 req->base.complete = compl;
245 req->base.data = data; 245 req->base.data = data;
246 req->base.flags = flags; 246 req->base.flags = flags;
247} 247}
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index 06e8b32d541c..b3a46c515d1b 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -81,8 +81,7 @@ static inline int skcipher_enqueue_givcrypt(
81static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( 81static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt(
82 struct crypto_queue *queue) 82 struct crypto_queue *queue)
83{ 83{
84 return __crypto_dequeue_request( 84 return skcipher_givcrypt_cast(crypto_dequeue_request(queue));
85 queue, offsetof(struct skcipher_givcrypt_request, creq.base));
86} 85}
87 86
88static inline void *skcipher_givcrypt_reqctx( 87static inline void *skcipher_givcrypt_reqctx(
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index 6a626a507b8c..7ef512f8631c 100644
--- a/include/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -25,12 +25,6 @@
25#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27 27
28static inline void crypto_yield(u32 flags)
29{
30 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
31 cond_resched();
32}
33
34static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num, 28static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num,
35 struct scatterlist *sg2) 29 struct scatterlist *sg2)
36{ 30{
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index 25fd6126522d..07d245f073d1 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -86,9 +86,9 @@ static inline void skcipher_givcrypt_free(struct skcipher_givcrypt_request *req)
86 86
87static inline void skcipher_givcrypt_set_callback( 87static inline void skcipher_givcrypt_set_callback(
88 struct skcipher_givcrypt_request *req, u32 flags, 88 struct skcipher_givcrypt_request *req, u32 flags,
89 crypto_completion_t complete, void *data) 89 crypto_completion_t compl, void *data)
90{ 90{
91 ablkcipher_request_set_callback(&req->creq, flags, complete, data); 91 ablkcipher_request_set_callback(&req->creq, flags, compl, data);
92} 92}
93 93
94static inline void skcipher_givcrypt_set_crypt( 94static inline void skcipher_givcrypt_set_crypt(
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index a7c2a862b4f4..8af71a8e2c00 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -143,11 +143,6 @@ int drm_err(const char *func, const char *format, ...);
143#define DRIVER_PRIME 0x4000 143#define DRIVER_PRIME 0x4000
144#define DRIVER_RENDER 0x8000 144#define DRIVER_RENDER 0x8000
145 145
146#define DRIVER_BUS_PCI 0x1
147#define DRIVER_BUS_PLATFORM 0x2
148#define DRIVER_BUS_USB 0x3
149#define DRIVER_BUS_HOST1X 0x4
150
151/***********************************************************************/ 146/***********************************************************************/
152/** \name Begin the DRM... */ 147/** \name Begin the DRM... */
153/*@{*/ 148/*@{*/
@@ -239,8 +234,6 @@ int drm_err(const char *func, const char *format, ...);
239/** \name Internal types and structures */ 234/** \name Internal types and structures */
240/*@{*/ 235/*@{*/
241 236
242#define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x)
243
244#define DRM_IF_VERSION(maj, min) (maj << 16 | min) 237#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
245 238
246/** 239/**
@@ -731,13 +724,7 @@ struct drm_master {
731#define DRM_SCANOUTPOS_ACCURATE (1 << 2) 724#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
732 725
733struct drm_bus { 726struct drm_bus {
734 int bus_type;
735 int (*get_irq)(struct drm_device *dev);
736 const char *(*get_name)(struct drm_device *dev);
737 int (*set_busid)(struct drm_device *dev, struct drm_master *master); 727 int (*set_busid)(struct drm_device *dev, struct drm_master *master);
738 int (*set_unique)(struct drm_device *dev, struct drm_master *master,
739 struct drm_unique *unique);
740 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
741}; 728};
742 729
743/** 730/**
@@ -974,11 +961,6 @@ struct drm_driver {
974 const struct drm_ioctl_desc *ioctls; 961 const struct drm_ioctl_desc *ioctls;
975 int num_ioctls; 962 int num_ioctls;
976 const struct file_operations *fops; 963 const struct file_operations *fops;
977 union {
978 struct pci_driver *pci;
979 struct platform_device *platform_device;
980 struct usb_driver *usb;
981 } kdriver;
982 struct drm_bus *bus; 964 struct drm_bus *bus;
983 965
984 /* List of devices hanging off this driver with stealth attach. */ 966 /* List of devices hanging off this driver with stealth attach. */
@@ -1040,14 +1022,17 @@ struct drm_pending_vblank_event {
1040}; 1022};
1041 1023
1042struct drm_vblank_crtc { 1024struct drm_vblank_crtc {
1025 struct drm_device *dev; /* pointer to the drm_device */
1043 wait_queue_head_t queue; /**< VBLANK wait queue */ 1026 wait_queue_head_t queue; /**< VBLANK wait queue */
1044 struct timeval time[DRM_VBLANKTIME_RBSIZE]; /**< timestamp of current count */ 1027 struct timeval time[DRM_VBLANKTIME_RBSIZE]; /**< timestamp of current count */
1028 struct timer_list disable_timer; /* delayed disable timer */
1045 atomic_t count; /**< number of VBLANK interrupts */ 1029 atomic_t count; /**< number of VBLANK interrupts */
1046 atomic_t refcount; /* number of users of vblank interruptsper crtc */ 1030 atomic_t refcount; /* number of users of vblank interruptsper crtc */
1047 u32 last; /* protected by dev->vbl_lock, used */ 1031 u32 last; /* protected by dev->vbl_lock, used */
1048 /* for wraparound handling */ 1032 /* for wraparound handling */
1049 u32 last_wait; /* Last vblank seqno waited per CRTC */ 1033 u32 last_wait; /* Last vblank seqno waited per CRTC */
1050 unsigned int inmodeset; /* Display driver is setting mode */ 1034 unsigned int inmodeset; /* Display driver is setting mode */
1035 int crtc; /* crtc index */
1051 bool enabled; /* so we don't call enable more than 1036 bool enabled; /* so we don't call enable more than
1052 once per disable */ 1037 once per disable */
1053}; 1038};
@@ -1058,7 +1043,6 @@ struct drm_vblank_crtc {
1058 */ 1043 */
1059struct drm_device { 1044struct drm_device {
1060 struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ 1045 struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */
1061 char *devname; /**< For /proc/interrupts */
1062 int if_version; /**< Highest interface version set */ 1046 int if_version; /**< Highest interface version set */
1063 1047
1064 /** \name Lifetime Management */ 1048 /** \name Lifetime Management */
@@ -1072,18 +1056,19 @@ struct drm_device {
1072 struct drm_minor *render; /**< Render node */ 1056 struct drm_minor *render; /**< Render node */
1073 atomic_t unplugged; /**< Flag whether dev is dead */ 1057 atomic_t unplugged; /**< Flag whether dev is dead */
1074 struct inode *anon_inode; /**< inode for private address-space */ 1058 struct inode *anon_inode; /**< inode for private address-space */
1059 char *unique; /**< unique name of the device */
1075 /*@} */ 1060 /*@} */
1076 1061
1077 /** \name Locks */ 1062 /** \name Locks */
1078 /*@{ */ 1063 /*@{ */
1079 spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
1080 struct mutex struct_mutex; /**< For others */ 1064 struct mutex struct_mutex; /**< For others */
1081 struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */ 1065 struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */
1082 /*@} */ 1066 /*@} */
1083 1067
1084 /** \name Usage Counters */ 1068 /** \name Usage Counters */
1085 /*@{ */ 1069 /*@{ */
1086 int open_count; /**< Outstanding files open */ 1070 int open_count; /**< Outstanding files open, protected by drm_global_mutex. */
1071 spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */
1087 int buf_use; /**< Buffers in use -- cannot alloc */ 1072 int buf_use; /**< Buffers in use -- cannot alloc */
1088 atomic_t buf_alloc; /**< Buffer allocation in progress */ 1073 atomic_t buf_alloc; /**< Buffer allocation in progress */
1089 /*@} */ 1074 /*@} */
@@ -1114,6 +1099,8 @@ struct drm_device {
1114 /** \name Context support */ 1099 /** \name Context support */
1115 /*@{ */ 1100 /*@{ */
1116 bool irq_enabled; /**< True if irq handler is enabled */ 1101 bool irq_enabled; /**< True if irq handler is enabled */
1102 int irq;
1103
1117 __volatile__ long context_flag; /**< Context swapping flag */ 1104 __volatile__ long context_flag; /**< Context swapping flag */
1118 int last_context; /**< Last current context */ 1105 int last_context; /**< Last current context */
1119 /*@} */ 1106 /*@} */
@@ -1134,7 +1121,6 @@ struct drm_device {
1134 1121
1135 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ 1122 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */
1136 spinlock_t vbl_lock; 1123 spinlock_t vbl_lock;
1137 struct timer_list vblank_disable_timer;
1138 1124
1139 u32 max_vblank_count; /**< size of vblank counter register */ 1125 u32 max_vblank_count; /**< size of vblank counter register */
1140 1126
@@ -1186,11 +1172,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
1186 return ((dev->driver->driver_features & feature) ? 1 : 0); 1172 return ((dev->driver->driver_features & feature) ? 1 : 0);
1187} 1173}
1188 1174
1189static inline int drm_dev_to_irq(struct drm_device *dev)
1190{
1191 return dev->driver->bus->get_irq(dev);
1192}
1193
1194static inline void drm_device_set_unplugged(struct drm_device *dev) 1175static inline void drm_device_set_unplugged(struct drm_device *dev)
1195{ 1176{
1196 smp_wmb(); 1177 smp_wmb();
@@ -1204,11 +1185,6 @@ static inline int drm_device_is_unplugged(struct drm_device *dev)
1204 return ret; 1185 return ret;
1205} 1186}
1206 1187
1207static inline bool drm_modeset_is_locked(struct drm_device *dev)
1208{
1209 return mutex_is_locked(&dev->mode_config.mutex);
1210}
1211
1212static inline bool drm_is_render_client(const struct drm_file *file_priv) 1188static inline bool drm_is_render_client(const struct drm_file *file_priv)
1213{ 1189{
1214 return file_priv->minor->type == DRM_MINOR_RENDER; 1190 return file_priv->minor->type == DRM_MINOR_RENDER;
@@ -1310,7 +1286,7 @@ extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
1310/* Cache management (drm_cache.c) */ 1286/* Cache management (drm_cache.c) */
1311void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 1287void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
1312void drm_clflush_sg(struct sg_table *st); 1288void drm_clflush_sg(struct sg_table *st);
1313void drm_clflush_virt_range(char *addr, unsigned long length); 1289void drm_clflush_virt_range(void *addr, unsigned long length);
1314 1290
1315 /* Locking IOCTL support (drm_lock.h) */ 1291 /* Locking IOCTL support (drm_lock.h) */
1316extern int drm_lock(struct drm_device *dev, void *data, 1292extern int drm_lock(struct drm_device *dev, void *data,
@@ -1363,7 +1339,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
1363 /* IRQ support (drm_irq.h) */ 1339 /* IRQ support (drm_irq.h) */
1364extern int drm_control(struct drm_device *dev, void *data, 1340extern int drm_control(struct drm_device *dev, void *data,
1365 struct drm_file *file_priv); 1341 struct drm_file *file_priv);
1366extern int drm_irq_install(struct drm_device *dev); 1342extern int drm_irq_install(struct drm_device *dev, int irq);
1367extern int drm_irq_uninstall(struct drm_device *dev); 1343extern int drm_irq_uninstall(struct drm_device *dev);
1368 1344
1369extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); 1345extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
@@ -1377,8 +1353,14 @@ extern void drm_send_vblank_event(struct drm_device *dev, int crtc,
1377extern bool drm_handle_vblank(struct drm_device *dev, int crtc); 1353extern bool drm_handle_vblank(struct drm_device *dev, int crtc);
1378extern int drm_vblank_get(struct drm_device *dev, int crtc); 1354extern int drm_vblank_get(struct drm_device *dev, int crtc);
1379extern void drm_vblank_put(struct drm_device *dev, int crtc); 1355extern void drm_vblank_put(struct drm_device *dev, int crtc);
1356extern int drm_crtc_vblank_get(struct drm_crtc *crtc);
1357extern void drm_crtc_vblank_put(struct drm_crtc *crtc);
1380extern void drm_vblank_off(struct drm_device *dev, int crtc); 1358extern void drm_vblank_off(struct drm_device *dev, int crtc);
1359extern void drm_vblank_on(struct drm_device *dev, int crtc);
1360extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
1361extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
1381extern void drm_vblank_cleanup(struct drm_device *dev); 1362extern void drm_vblank_cleanup(struct drm_device *dev);
1363
1382extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, 1364extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
1383 struct timeval *tvblank, unsigned flags); 1365 struct timeval *tvblank, unsigned flags);
1384extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, 1366extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
@@ -1522,6 +1504,9 @@ extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
1522 size_t align); 1504 size_t align);
1523extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); 1505extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1524extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); 1506extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1507extern int drm_pci_set_unique(struct drm_device *dev,
1508 struct drm_master *master,
1509 struct drm_unique *u);
1525 1510
1526 /* sysfs support (drm_sysfs.c) */ 1511 /* sysfs support (drm_sysfs.c) */
1527struct drm_sysfs_class; 1512struct drm_sysfs_class;
@@ -1631,6 +1616,7 @@ void drm_dev_ref(struct drm_device *dev);
1631void drm_dev_unref(struct drm_device *dev); 1616void drm_dev_unref(struct drm_device *dev);
1632int drm_dev_register(struct drm_device *dev, unsigned long flags); 1617int drm_dev_register(struct drm_device *dev, unsigned long flags);
1633void drm_dev_unregister(struct drm_device *dev); 1618void drm_dev_unregister(struct drm_device *dev);
1619int drm_dev_set_unique(struct drm_device *dev, const char *fmt, ...);
1634 1620
1635struct drm_minor *drm_minor_acquire(unsigned int minor_id); 1621struct drm_minor *drm_minor_acquire(unsigned int minor_id);
1636void drm_minor_release(struct drm_minor *minor); 1622void drm_minor_release(struct drm_minor *minor);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e55fccbe7c42..251b75e6bf7a 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -33,6 +33,7 @@
33#include <linux/hdmi.h> 33#include <linux/hdmi.h>
34#include <drm/drm_mode.h> 34#include <drm/drm_mode.h>
35#include <drm/drm_fourcc.h> 35#include <drm/drm_fourcc.h>
36#include <drm/drm_modeset_lock.h>
36 37
37struct drm_device; 38struct drm_device;
38struct drm_mode_set; 39struct drm_mode_set;
@@ -50,6 +51,7 @@ struct drm_clip_rect;
50#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 51#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
51#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee 52#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
52#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd 53#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd
54#define DRM_MODE_OBJECT_ANY 0
53 55
54struct drm_mode_object { 56struct drm_mode_object {
55 uint32_t id; 57 uint32_t id;
@@ -64,6 +66,15 @@ struct drm_object_properties {
64 uint64_t values[DRM_OBJECT_MAX_PROPERTY]; 66 uint64_t values[DRM_OBJECT_MAX_PROPERTY];
65}; 67};
66 68
69static inline int64_t U642I64(uint64_t val)
70{
71 return (int64_t)*((int64_t *)&val);
72}
73static inline uint64_t I642U64(int64_t val)
74{
75 return (uint64_t)*((uint64_t *)&val);
76}
77
67enum drm_connector_force { 78enum drm_connector_force {
68 DRM_FORCE_UNSPECIFIED, 79 DRM_FORCE_UNSPECIFIED,
69 DRM_FORCE_OFF, 80 DRM_FORCE_OFF,
@@ -110,6 +121,9 @@ struct drm_display_info {
110 enum subpixel_order subpixel_order; 121 enum subpixel_order subpixel_order;
111 u32 color_formats; 122 u32 color_formats;
112 123
124 /* Mask of supported hdmi deep color modes */
125 u8 edid_hdmi_dc_modes;
126
113 u8 cea_rev; 127 u8 cea_rev;
114}; 128};
115 129
@@ -190,10 +204,15 @@ struct drm_property {
190 char name[DRM_PROP_NAME_LEN]; 204 char name[DRM_PROP_NAME_LEN];
191 uint32_t num_values; 205 uint32_t num_values;
192 uint64_t *values; 206 uint64_t *values;
207 struct drm_device *dev;
193 208
194 struct list_head enum_blob_list; 209 struct list_head enum_blob_list;
195}; 210};
196 211
212void drm_modeset_lock_all(struct drm_device *dev);
213void drm_modeset_unlock_all(struct drm_device *dev);
214void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
215
197struct drm_crtc; 216struct drm_crtc;
198struct drm_connector; 217struct drm_connector;
199struct drm_encoder; 218struct drm_encoder;
@@ -269,6 +288,7 @@ struct drm_crtc_funcs {
269 * drm_crtc - central CRTC control structure 288 * drm_crtc - central CRTC control structure
270 * @dev: parent DRM device 289 * @dev: parent DRM device
271 * @head: list management 290 * @head: list management
291 * @mutex: per-CRTC locking
272 * @base: base KMS object for ID tracking etc. 292 * @base: base KMS object for ID tracking etc.
273 * @primary: primary plane for this CRTC 293 * @primary: primary plane for this CRTC
274 * @cursor: cursor plane for this CRTC 294 * @cursor: cursor plane for this CRTC
@@ -303,7 +323,7 @@ struct drm_crtc {
303 * state, ...) and a write lock for everything which can be update 323 * state, ...) and a write lock for everything which can be update
304 * without a full modeset (fb, cursor data, ...) 324 * without a full modeset (fb, cursor data, ...)
305 */ 325 */
306 struct mutex mutex; 326 struct drm_modeset_lock mutex;
307 327
308 struct drm_mode_object base; 328 struct drm_mode_object base;
309 329
@@ -400,6 +420,7 @@ struct drm_encoder_funcs {
400 * @dev: parent DRM device 420 * @dev: parent DRM device
401 * @head: list management 421 * @head: list management
402 * @base: base KMS object 422 * @base: base KMS object
423 * @name: encoder name
403 * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h 424 * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h
404 * @possible_crtcs: bitmask of potential CRTC bindings 425 * @possible_crtcs: bitmask of potential CRTC bindings
405 * @possible_clones: bitmask of potential sibling encoders for cloning 426 * @possible_clones: bitmask of potential sibling encoders for cloning
@@ -416,6 +437,7 @@ struct drm_encoder {
416 struct list_head head; 437 struct list_head head;
417 438
418 struct drm_mode_object base; 439 struct drm_mode_object base;
440 char *name;
419 int encoder_type; 441 int encoder_type;
420 uint32_t possible_crtcs; 442 uint32_t possible_crtcs;
421 uint32_t possible_clones; 443 uint32_t possible_clones;
@@ -444,6 +466,7 @@ struct drm_encoder {
444 * @attr: sysfs attributes 466 * @attr: sysfs attributes
445 * @head: list management 467 * @head: list management
446 * @base: base KMS object 468 * @base: base KMS object
469 * @name: connector name
447 * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h 470 * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
448 * @connector_type_id: index into connector type enum 471 * @connector_type_id: index into connector type enum
449 * @interlace_allowed: can this connector handle interlaced modes? 472 * @interlace_allowed: can this connector handle interlaced modes?
@@ -482,6 +505,7 @@ struct drm_connector {
482 505
483 struct drm_mode_object base; 506 struct drm_mode_object base;
484 507
508 char *name;
485 int connector_type; 509 int connector_type;
486 int connector_type_id; 510 int connector_type_id;
487 bool interlace_allowed; 511 bool interlace_allowed;
@@ -723,6 +747,8 @@ struct drm_mode_group {
723 */ 747 */
724struct drm_mode_config { 748struct drm_mode_config {
725 struct mutex mutex; /* protects configuration (mode lists etc.) */ 749 struct mutex mutex; /* protects configuration (mode lists etc.) */
750 struct drm_modeset_lock connection_mutex; /* protects connector->encoder and encoder->crtc links */
751 struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */
726 struct mutex idr_mutex; /* for IDR management */ 752 struct mutex idr_mutex; /* for IDR management */
727 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 753 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
728 /* this is limited to one for now */ 754 /* this is limited to one for now */
@@ -823,10 +849,6 @@ struct drm_prop_enum_list {
823 char *name; 849 char *name;
824}; 850};
825 851
826extern void drm_modeset_lock_all(struct drm_device *dev);
827extern void drm_modeset_unlock_all(struct drm_device *dev);
828extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
829
830extern int drm_crtc_init_with_planes(struct drm_device *dev, 852extern int drm_crtc_init_with_planes(struct drm_device *dev,
831 struct drm_crtc *crtc, 853 struct drm_crtc *crtc,
832 struct drm_plane *primary, 854 struct drm_plane *primary,
@@ -905,7 +927,6 @@ extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
905 927
906extern void drm_encoder_cleanup(struct drm_encoder *encoder); 928extern void drm_encoder_cleanup(struct drm_encoder *encoder);
907 929
908extern const char *drm_get_connector_name(const struct drm_connector *connector);
909extern const char *drm_get_connector_status_name(enum drm_connector_status status); 930extern const char *drm_get_connector_status_name(enum drm_connector_status status);
910extern const char *drm_get_subpixel_order_name(enum subpixel_order order); 931extern const char *drm_get_subpixel_order_name(enum subpixel_order order);
911extern const char *drm_get_dpms_name(int val); 932extern const char *drm_get_dpms_name(int val);
@@ -915,6 +936,7 @@ extern const char *drm_get_tv_subconnector_name(int val);
915extern const char *drm_get_tv_select_name(int val); 936extern const char *drm_get_tv_select_name(int val);
916extern void drm_fb_release(struct drm_file *file_priv); 937extern void drm_fb_release(struct drm_file *file_priv);
917extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 938extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
939extern void drm_mode_group_destroy(struct drm_mode_group *group);
918extern bool drm_probe_ddc(struct i2c_adapter *adapter); 940extern bool drm_probe_ddc(struct i2c_adapter *adapter);
919extern struct edid *drm_get_edid(struct drm_connector *connector, 941extern struct edid *drm_get_edid(struct drm_connector *connector,
920 struct i2c_adapter *adapter); 942 struct i2c_adapter *adapter);
@@ -926,6 +948,23 @@ extern void drm_mode_config_cleanup(struct drm_device *dev);
926 948
927extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 949extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
928 struct edid *edid); 950 struct edid *edid);
951
952static inline bool drm_property_type_is(struct drm_property *property,
953 uint32_t type)
954{
955 /* instanceof for props.. handles extended type vs original types: */
956 if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
957 return (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type;
958 return property->flags & type;
959}
960
961static inline bool drm_property_type_valid(struct drm_property *property)
962{
963 if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
964 return !(property->flags & DRM_MODE_PROP_LEGACY_TYPE);
965 return !!(property->flags & DRM_MODE_PROP_LEGACY_TYPE);
966}
967
929extern int drm_object_property_set_value(struct drm_mode_object *obj, 968extern int drm_object_property_set_value(struct drm_mode_object *obj,
930 struct drm_property *property, 969 struct drm_property *property,
931 uint64_t val); 970 uint64_t val);
@@ -959,6 +998,11 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
959struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 998struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
960 const char *name, 999 const char *name,
961 uint64_t min, uint64_t max); 1000 uint64_t min, uint64_t max);
1001struct drm_property *drm_property_create_signed_range(struct drm_device *dev,
1002 int flags, const char *name,
1003 int64_t min, int64_t max);
1004struct drm_property *drm_property_create_object(struct drm_device *dev,
1005 int flags, const char *name, uint32_t type);
962extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); 1006extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
963extern int drm_property_add_enum(struct drm_property *property, int index, 1007extern int drm_property_add_enum(struct drm_property *property, int index,
964 uint64_t value, const char *name); 1008 uint64_t value, const char *name);
@@ -967,7 +1011,6 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats
967 char *formats[]); 1011 char *formats[]);
968extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 1012extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
969extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 1013extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
970extern const char *drm_get_encoder_name(const struct drm_encoder *encoder);
971 1014
972extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 1015extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
973 struct drm_encoder *encoder); 1016 struct drm_encoder *encoder);
@@ -975,6 +1018,7 @@ extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
975 int gamma_size); 1018 int gamma_size);
976extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, 1019extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
977 uint32_t id, uint32_t type); 1020 uint32_t id, uint32_t type);
1021
978/* IOCTLs */ 1022/* IOCTLs */
979extern int drm_mode_getresources(struct drm_device *dev, 1023extern int drm_mode_getresources(struct drm_device *dev,
980 void *data, struct drm_file *file_priv); 1024 void *data, struct drm_file *file_priv);
@@ -1020,6 +1064,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
1020extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 1064extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
1021 void *data, struct drm_file *file_priv); 1065 void *data, struct drm_file *file_priv);
1022extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); 1066extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
1067extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
1023extern bool drm_detect_hdmi_monitor(struct edid *edid); 1068extern bool drm_detect_hdmi_monitor(struct edid *edid);
1024extern bool drm_detect_monitor_audio(struct edid *edid); 1069extern bool drm_detect_monitor_audio(struct edid *edid);
1025extern bool drm_rgb_quant_range_selectable(struct edid *edid); 1070extern bool drm_rgb_quant_range_selectable(struct edid *edid);
@@ -1057,6 +1102,15 @@ extern int drm_format_vert_chroma_subsampling(uint32_t format);
1057extern const char *drm_get_format_name(uint32_t format); 1102extern const char *drm_get_format_name(uint32_t format);
1058 1103
1059/* Helpers */ 1104/* Helpers */
1105
1106static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
1107 uint32_t id)
1108{
1109 struct drm_mode_object *mo;
1110 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE);
1111 return mo ? obj_to_plane(mo) : NULL;
1112}
1113
1060static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, 1114static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
1061 uint32_t id) 1115 uint32_t id)
1062{ 1116{
@@ -1073,6 +1127,30 @@ static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
1073 return mo ? obj_to_encoder(mo) : NULL; 1127 return mo ? obj_to_encoder(mo) : NULL;
1074} 1128}
1075 1129
1130static inline struct drm_connector *drm_connector_find(struct drm_device *dev,
1131 uint32_t id)
1132{
1133 struct drm_mode_object *mo;
1134 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR);
1135 return mo ? obj_to_connector(mo) : NULL;
1136}
1137
1138static inline struct drm_property *drm_property_find(struct drm_device *dev,
1139 uint32_t id)
1140{
1141 struct drm_mode_object *mo;
1142 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
1143 return mo ? obj_to_property(mo) : NULL;
1144}
1145
1146static inline struct drm_property_blob *
1147drm_property_blob_find(struct drm_device *dev, uint32_t id)
1148{
1149 struct drm_mode_object *mo;
1150 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB);
1151 return mo ? obj_to_blob(mo) : NULL;
1152}
1153
1076/* Plane list iterator for legacy (overlay only) planes. */ 1154/* Plane list iterator for legacy (overlay only) planes. */
1077#define drm_for_each_legacy_plane(plane, planelist) \ 1155#define drm_for_each_legacy_plane(plane, planelist) \
1078 list_for_each_entry(plane, planelist, head) \ 1156 list_for_each_entry(plane, planelist, head) \
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 36a5febac2a6..a3d75fefd010 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -114,7 +114,7 @@ struct drm_encoder_helper_funcs {
114/** 114/**
115 * drm_connector_helper_funcs - helper operations for connectors 115 * drm_connector_helper_funcs - helper operations for connectors
116 * @get_modes: get mode list for this connector 116 * @get_modes: get mode list for this connector
117 * @mode_valid: is this mode valid on the given connector? 117 * @mode_valid (optional): is this mode valid on the given connector?
118 * 118 *
119 * The helper operations are called by the mid-layer CRTC helper. 119 * The helper operations are called by the mid-layer CRTC helper.
120 */ 120 */
@@ -165,6 +165,10 @@ extern void drm_helper_resume_force_mode(struct drm_device *dev);
165extern int drm_helper_probe_single_connector_modes(struct drm_connector 165extern int drm_helper_probe_single_connector_modes(struct drm_connector
166 *connector, uint32_t maxX, 166 *connector, uint32_t maxX,
167 uint32_t maxY); 167 uint32_t maxY);
168extern int drm_helper_probe_single_connector_modes_nomerge(struct drm_connector
169 *connector,
170 uint32_t maxX,
171 uint32_t maxY);
168extern void drm_kms_helper_poll_init(struct drm_device *dev); 172extern void drm_kms_helper_poll_init(struct drm_device *dev);
169extern void drm_kms_helper_poll_fini(struct drm_device *dev); 173extern void drm_kms_helper_poll_fini(struct drm_device *dev);
170extern bool drm_helper_hpd_irq_event(struct drm_device *dev); 174extern bool drm_helper_hpd_irq_event(struct drm_device *dev);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index cfcacec5b89d..a21568bf1514 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -37,6 +37,7 @@
37 * eDP: Embedded DisplayPort version 1 37 * eDP: Embedded DisplayPort version 1
38 * DPI: DisplayPort Interoperability Guideline v1.1a 38 * DPI: DisplayPort Interoperability Guideline v1.1a
39 * 1.2: DisplayPort 1.2 39 * 1.2: DisplayPort 1.2
40 * MST: Multistream Transport - part of DP 1.2a
40 * 41 *
41 * 1.2 formally includes both eDP and DPI definitions. 42 * 1.2 formally includes both eDP and DPI definitions.
42 */ 43 */
@@ -103,9 +104,14 @@
103#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ 104#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */
104 105
105/* Multiple stream transport */ 106/* Multiple stream transport */
107#define DP_FAUX_CAP 0x020 /* 1.2 */
108# define DP_FAUX_CAP_1 (1 << 0)
109
106#define DP_MSTM_CAP 0x021 /* 1.2 */ 110#define DP_MSTM_CAP 0x021 /* 1.2 */
107# define DP_MST_CAP (1 << 0) 111# define DP_MST_CAP (1 << 0)
108 112
113#define DP_GUID 0x030 /* 1.2 */
114
109#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ 115#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */
110# define DP_PSR_IS_SUPPORTED 1 116# define DP_PSR_IS_SUPPORTED 1
111#define DP_PSR_CAPS 0x071 /* XXX 1.2? */ 117#define DP_PSR_CAPS 0x071 /* XXX 1.2? */
@@ -221,6 +227,16 @@
221# define DP_PSR_CRC_VERIFICATION (1 << 2) 227# define DP_PSR_CRC_VERIFICATION (1 << 2)
222# define DP_PSR_FRAME_CAPTURE (1 << 3) 228# define DP_PSR_FRAME_CAPTURE (1 << 3)
223 229
230#define DP_ADAPTER_CTRL 0x1a0
231# define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0)
232
233#define DP_BRANCH_DEVICE_CTRL 0x1a1
234# define DP_BRANCH_DEVICE_IRQ_HPD (1 << 0)
235
236#define DP_PAYLOAD_ALLOCATE_SET 0x1c0
237#define DP_PAYLOAD_ALLOCATE_START_TIME_SLOT 0x1c1
238#define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2
239
224#define DP_SINK_COUNT 0x200 240#define DP_SINK_COUNT 0x200
225/* prior to 1.2 bit 7 was reserved mbz */ 241/* prior to 1.2 bit 7 was reserved mbz */
226# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f)) 242# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f))
@@ -230,6 +246,9 @@
230# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0) 246# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0)
231# define DP_AUTOMATED_TEST_REQUEST (1 << 1) 247# define DP_AUTOMATED_TEST_REQUEST (1 << 1)
232# define DP_CP_IRQ (1 << 2) 248# define DP_CP_IRQ (1 << 2)
249# define DP_MCCS_IRQ (1 << 3)
250# define DP_DOWN_REP_MSG_RDY (1 << 4) /* 1.2 MST */
251# define DP_UP_REQ_MSG_RDY (1 << 5) /* 1.2 MST */
233# define DP_SINK_SPECIFIC_IRQ (1 << 6) 252# define DP_SINK_SPECIFIC_IRQ (1 << 6)
234 253
235#define DP_LANE0_1_STATUS 0x202 254#define DP_LANE0_1_STATUS 0x202
@@ -291,9 +310,18 @@
291# define DP_TEST_NAK (1 << 1) 310# define DP_TEST_NAK (1 << 1)
292# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) 311# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2)
293 312
313#define DP_TEST_EDID_CHECKSUM 0x261
314
294#define DP_TEST_SINK 0x270 315#define DP_TEST_SINK 0x270
295#define DP_TEST_SINK_START (1 << 0) 316#define DP_TEST_SINK_START (1 << 0)
296 317
318#define DP_PAYLOAD_TABLE_UPDATE_STATUS 0x2c0 /* 1.2 MST */
319# define DP_PAYLOAD_TABLE_UPDATED (1 << 0)
320# define DP_PAYLOAD_ACT_HANDLED (1 << 1)
321
322#define DP_VC_PAYLOAD_ID_SLOT_1 0x2c1 /* 1.2 MST */
323/* up to ID_SLOT_63 at 0x2ff */
324
297#define DP_SOURCE_OUI 0x300 325#define DP_SOURCE_OUI 0x300
298#define DP_SINK_OUI 0x400 326#define DP_SINK_OUI 0x400
299#define DP_BRANCH_OUI 0x500 327#define DP_BRANCH_OUI 0x500
@@ -303,6 +331,21 @@
303# define DP_SET_POWER_D3 0x2 331# define DP_SET_POWER_D3 0x2
304# define DP_SET_POWER_MASK 0x3 332# define DP_SET_POWER_MASK 0x3
305 333
334#define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */
335#define DP_SIDEBAND_MSG_UP_REP_BASE 0x1200 /* 1.2 MST */
336#define DP_SIDEBAND_MSG_DOWN_REP_BASE 0x1400 /* 1.2 MST */
337#define DP_SIDEBAND_MSG_UP_REQ_BASE 0x1600 /* 1.2 MST */
338
339#define DP_SINK_COUNT_ESI 0x2002 /* 1.2 */
340/* 0-5 sink count */
341# define DP_SINK_COUNT_CP_READY (1 << 6)
342
343#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 0x2003 /* 1.2 */
344
345#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1 0x2004 /* 1.2 */
346
347#define DP_LINK_SERVICE_IRQ_VECTOR_ESI0 0x2005 /* 1.2 */
348
306#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */ 349#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */
307# define DP_PSR_LINK_CRC_ERROR (1 << 0) 350# define DP_PSR_LINK_CRC_ERROR (1 << 0)
308# define DP_PSR_RFB_STORAGE_ERROR (1 << 1) 351# define DP_PSR_RFB_STORAGE_ERROR (1 << 1)
@@ -319,6 +362,43 @@
319# define DP_PSR_SINK_INTERNAL_ERROR 7 362# define DP_PSR_SINK_INTERNAL_ERROR 7
320# define DP_PSR_SINK_STATE_MASK 0x07 363# define DP_PSR_SINK_STATE_MASK 0x07
321 364
365/* DP 1.2 Sideband message defines */
366/* peer device type - DP 1.2a Table 2-92 */
367#define DP_PEER_DEVICE_NONE 0x0
368#define DP_PEER_DEVICE_SOURCE_OR_SST 0x1
369#define DP_PEER_DEVICE_MST_BRANCHING 0x2
370#define DP_PEER_DEVICE_SST_SINK 0x3
371#define DP_PEER_DEVICE_DP_LEGACY_CONV 0x4
372
373/* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */
374#define DP_LINK_ADDRESS 0x01
375#define DP_CONNECTION_STATUS_NOTIFY 0x02
376#define DP_ENUM_PATH_RESOURCES 0x10
377#define DP_ALLOCATE_PAYLOAD 0x11
378#define DP_QUERY_PAYLOAD 0x12
379#define DP_RESOURCE_STATUS_NOTIFY 0x13
380#define DP_CLEAR_PAYLOAD_ID_TABLE 0x14
381#define DP_REMOTE_DPCD_READ 0x20
382#define DP_REMOTE_DPCD_WRITE 0x21
383#define DP_REMOTE_I2C_READ 0x22
384#define DP_REMOTE_I2C_WRITE 0x23
385#define DP_POWER_UP_PHY 0x24
386#define DP_POWER_DOWN_PHY 0x25
387#define DP_SINK_EVENT_NOTIFY 0x30
388#define DP_QUERY_STREAM_ENC_STATUS 0x38
389
390/* DP 1.2 MST sideband nak reasons - table 2.84 */
391#define DP_NAK_WRITE_FAILURE 0x01
392#define DP_NAK_INVALID_READ 0x02
393#define DP_NAK_CRC_FAILURE 0x03
394#define DP_NAK_BAD_PARAM 0x04
395#define DP_NAK_DEFER 0x05
396#define DP_NAK_LINK_FAILURE 0x06
397#define DP_NAK_NO_RESOURCES 0x07
398#define DP_NAK_DPCD_FAIL 0x08
399#define DP_NAK_I2C_NAK 0x09
400#define DP_NAK_ALLOCATE_FAIL 0x0a
401
322#define MODE_I2C_START 1 402#define MODE_I2C_START 1
323#define MODE_I2C_WRITE 2 403#define MODE_I2C_WRITE 2
324#define MODE_I2C_READ 4 404#define MODE_I2C_READ 4
@@ -431,8 +511,10 @@ struct drm_dp_aux_msg {
431 511
432/** 512/**
433 * struct drm_dp_aux - DisplayPort AUX channel 513 * struct drm_dp_aux - DisplayPort AUX channel
514 * @name: user-visible name of this AUX channel and the I2C-over-AUX adapter
434 * @ddc: I2C adapter that can be used for I2C-over-AUX communication 515 * @ddc: I2C adapter that can be used for I2C-over-AUX communication
435 * @dev: pointer to struct device that is the parent for this AUX channel 516 * @dev: pointer to struct device that is the parent for this AUX channel
517 * @hw_mutex: internal mutex used for locking transfers
436 * @transfer: transfers a message representing a single AUX transaction 518 * @transfer: transfers a message representing a single AUX transaction
437 * 519 *
438 * The .dev field should be set to a pointer to the device that implements 520 * The .dev field should be set to a pointer to the device that implements
@@ -465,7 +547,7 @@ struct drm_dp_aux {
465 const char *name; 547 const char *name;
466 struct i2c_adapter ddc; 548 struct i2c_adapter ddc;
467 struct device *dev; 549 struct device *dev;
468 550 struct mutex hw_mutex;
469 ssize_t (*transfer)(struct drm_dp_aux *aux, 551 ssize_t (*transfer)(struct drm_dp_aux *aux,
470 struct drm_dp_aux_msg *msg); 552 struct drm_dp_aux_msg *msg);
471}; 553};
@@ -524,7 +606,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
524int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); 606int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
525int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link); 607int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
526 608
527int drm_dp_aux_register_i2c_bus(struct drm_dp_aux *aux); 609int drm_dp_aux_register(struct drm_dp_aux *aux);
528void drm_dp_aux_unregister_i2c_bus(struct drm_dp_aux *aux); 610void drm_dp_aux_unregister(struct drm_dp_aux *aux);
529 611
530#endif /* _DRM_DP_HELPER_H_ */ 612#endif /* _DRM_DP_HELPER_H_ */
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index a1441c5ac63d..b96031d947a0 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -202,6 +202,11 @@ struct detailed_timing {
202#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6) 202#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6)
203#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7) 203#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7)
204 204
205#define DRM_EDID_HDMI_DC_48 (1 << 6)
206#define DRM_EDID_HDMI_DC_36 (1 << 5)
207#define DRM_EDID_HDMI_DC_30 (1 << 4)
208#define DRM_EDID_HDMI_DC_Y444 (1 << 3)
209
205struct edid { 210struct edid {
206 u8 header[8]; 211 u8 header[8];
207 /* Vendor & product info */ 212 /* Vendor & product info */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 6e622f7d481d..7997246d4039 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -108,7 +108,7 @@ int drm_fb_helper_set_par(struct fb_info *info);
108int drm_fb_helper_check_var(struct fb_var_screeninfo *var, 108int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
109 struct fb_info *info); 109 struct fb_info *info);
110 110
111bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); 111bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper);
112void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 112void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
113 uint32_t fb_width, uint32_t fb_height); 113 uint32_t fb_width, uint32_t fb_height);
114void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 114void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h
index 35c776ae7d3b..9eed34dcd6af 100644
--- a/include/drm/drm_flip_work.h
+++ b/include/drm/drm_flip_work.h
@@ -57,6 +57,7 @@ typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val);
57 * @count: number of committed items 57 * @count: number of committed items
58 * @func: callback fxn called for each committed item 58 * @func: callback fxn called for each committed item
59 * @worker: worker which calls @func 59 * @worker: worker which calls @func
60 * @fifo: queue of committed items
60 */ 61 */
61struct drm_flip_work { 62struct drm_flip_work {
62 const char *name; 63 const char *name;
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 7209df15a3cd..944f33f8ba38 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -135,11 +135,13 @@ ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
135 * @driver: device driver model driver 135 * @driver: device driver model driver
136 * @probe: callback for device binding 136 * @probe: callback for device binding
137 * @remove: callback for device unbinding 137 * @remove: callback for device unbinding
138 * @shutdown: called at shutdown time to quiesce the device
138 */ 139 */
139struct mipi_dsi_driver { 140struct mipi_dsi_driver {
140 struct device_driver driver; 141 struct device_driver driver;
141 int(*probe)(struct mipi_dsi_device *dsi); 142 int(*probe)(struct mipi_dsi_device *dsi);
142 int(*remove)(struct mipi_dsi_device *dsi); 143 int(*remove)(struct mipi_dsi_device *dsi);
144 void (*shutdown)(struct mipi_dsi_device *dsi);
143}; 145};
144 146
145#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver) 147#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver)
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index 2dbbf9976669..91d0582f924e 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -223,7 +223,7 @@ void drm_mode_validate_size(struct drm_device *dev,
223void drm_mode_prune_invalid(struct drm_device *dev, 223void drm_mode_prune_invalid(struct drm_device *dev,
224 struct list_head *mode_list, bool verbose); 224 struct list_head *mode_list, bool verbose);
225void drm_mode_sort(struct list_head *mode_list); 225void drm_mode_sort(struct list_head *mode_list);
226void drm_mode_connector_list_update(struct drm_connector *connector); 226void drm_mode_connector_list_update(struct drm_connector *connector, bool merge_type_bits);
227 227
228/* parsing cmdline modes */ 228/* parsing cmdline modes */
229bool 229bool
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
new file mode 100644
index 000000000000..402aa7a6a058
--- /dev/null
+++ b/include/drm/drm_modeset_lock.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 2014 Red Hat
3 * Author: Rob Clark <robdclark@gmail.com>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef DRM_MODESET_LOCK_H_
25#define DRM_MODESET_LOCK_H_
26
27#include <linux/ww_mutex.h>
28
29struct drm_modeset_lock;
30
31/**
32 * drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx)
33 * @ww_ctx: base acquire ctx
34 * @contended: used internally for -EDEADLK handling
35 * @locked: list of held locks
36 *
37 * Each thread competing for a set of locks must use one acquire
38 * ctx. And if any lock fxn returns -EDEADLK, it must backoff and
39 * retry.
40 */
41struct drm_modeset_acquire_ctx {
42
43 struct ww_acquire_ctx ww_ctx;
44
45 /**
46 * Contended lock: if a lock is contended you should only call
47 * drm_modeset_backoff() which drops locks and slow-locks the
48 * contended lock.
49 */
50 struct drm_modeset_lock *contended;
51
52 /**
53 * list of held locks (drm_modeset_lock)
54 */
55 struct list_head locked;
56};
57
58/**
59 * drm_modeset_lock - used for locking modeset resources.
60 * @mutex: resource locking
61 * @head: used to hold it's place on state->locked list when
62 * part of an atomic update
63 *
64 * Used for locking CRTCs and other modeset resources.
65 */
66struct drm_modeset_lock {
67 /**
68 * modeset lock
69 */
70 struct ww_mutex mutex;
71
72 /**
73 * Resources that are locked as part of an atomic update are added
74 * to a list (so we know what to unlock at the end).
75 */
76 struct list_head head;
77};
78
79extern struct ww_class crtc_ww_class;
80
81void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
82 uint32_t flags);
83void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx);
84void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx);
85void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);
86int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx);
87
88/**
89 * drm_modeset_lock_init - initialize lock
90 * @lock: lock to init
91 */
92static inline void drm_modeset_lock_init(struct drm_modeset_lock *lock)
93{
94 ww_mutex_init(&lock->mutex, &crtc_ww_class);
95 INIT_LIST_HEAD(&lock->head);
96}
97
98/**
99 * drm_modeset_lock_fini - cleanup lock
100 * @lock: lock to cleanup
101 */
102static inline void drm_modeset_lock_fini(struct drm_modeset_lock *lock)
103{
104 WARN_ON(!list_empty(&lock->head));
105}
106
107/**
108 * drm_modeset_is_locked - equivalent to mutex_is_locked()
109 * @lock: lock to check
110 */
111static inline bool drm_modeset_is_locked(struct drm_modeset_lock *lock)
112{
113 return ww_mutex_is_locked(&lock->mutex);
114}
115
116int drm_modeset_lock(struct drm_modeset_lock *lock,
117 struct drm_modeset_acquire_ctx *ctx);
118int drm_modeset_lock_interruptible(struct drm_modeset_lock *lock,
119 struct drm_modeset_acquire_ctx *ctx);
120void drm_modeset_unlock(struct drm_modeset_lock *lock);
121
122struct drm_device;
123int drm_modeset_lock_all_crtcs(struct drm_device *dev,
124 struct drm_modeset_acquire_ctx *ctx);
125
126#endif /* DRM_MODESET_LOCK_H_ */
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index 09824becee3e..52e6870534b2 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -24,6 +24,17 @@
24#ifndef DRM_PLANE_HELPER_H 24#ifndef DRM_PLANE_HELPER_H
25#define DRM_PLANE_HELPER_H 25#define DRM_PLANE_HELPER_H
26 26
27#include <drm/drm_rect.h>
28
29/*
30 * Drivers that don't allow primary plane scaling may pass this macro in place
31 * of the min/max scale parameters of the update checker function.
32 *
33 * Due to src being in 16.16 fixed point and dest being in integer pixels,
34 * 1<<16 represents no scaling.
35 */
36#define DRM_PLANE_HELPER_NO_SCALING (1<<16)
37
27/** 38/**
28 * DOC: plane helpers 39 * DOC: plane helpers
29 * 40 *
@@ -31,6 +42,17 @@
31 * planes. 42 * planes.
32 */ 43 */
33 44
45extern int drm_plane_helper_check_update(struct drm_plane *plane,
46 struct drm_crtc *crtc,
47 struct drm_framebuffer *fb,
48 struct drm_rect *src,
49 struct drm_rect *dest,
50 const struct drm_rect *clip,
51 int min_scale,
52 int max_scale,
53 bool can_position,
54 bool can_update_disabled,
55 bool *visible);
34extern int drm_primary_helper_update(struct drm_plane *plane, 56extern int drm_primary_helper_update(struct drm_plane *plane,
35 struct drm_crtc *crtc, 57 struct drm_crtc *crtc,
36 struct drm_framebuffer *fb, 58 struct drm_framebuffer *fb,
@@ -42,7 +64,7 @@ extern int drm_primary_helper_disable(struct drm_plane *plane);
42extern void drm_primary_helper_destroy(struct drm_plane *plane); 64extern void drm_primary_helper_destroy(struct drm_plane *plane);
43extern const struct drm_plane_funcs drm_primary_helper_funcs; 65extern const struct drm_plane_funcs drm_primary_helper_funcs;
44extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev, 66extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
45 uint32_t *formats, 67 const uint32_t *formats,
46 int num_formats); 68 int num_formats);
47 69
48 70
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index 012d58fa8ff0..a70d45647898 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -223,14 +223,40 @@
223 _INTEL_BDW_D(gt, 0x160A, info), /* Server */ \ 223 _INTEL_BDW_D(gt, 0x160A, info), /* Server */ \
224 _INTEL_BDW_D(gt, 0x160D, info) /* Workstation */ 224 _INTEL_BDW_D(gt, 0x160D, info) /* Workstation */
225 225
226#define INTEL_BDW_M_IDS(info) \ 226#define INTEL_BDW_GT12M_IDS(info) \
227 _INTEL_BDW_M_IDS(1, info), \ 227 _INTEL_BDW_M_IDS(1, info), \
228 _INTEL_BDW_M_IDS(2, info), \ 228 _INTEL_BDW_M_IDS(2, info)
229 _INTEL_BDW_M_IDS(3, info)
230 229
231#define INTEL_BDW_D_IDS(info) \ 230#define INTEL_BDW_GT12D_IDS(info) \
232 _INTEL_BDW_D_IDS(1, info), \ 231 _INTEL_BDW_D_IDS(1, info), \
233 _INTEL_BDW_D_IDS(2, info), \ 232 _INTEL_BDW_D_IDS(2, info)
233
234#define INTEL_BDW_GT3M_IDS(info) \
235 _INTEL_BDW_M_IDS(3, info)
236
237#define INTEL_BDW_GT3D_IDS(info) \
234 _INTEL_BDW_D_IDS(3, info) 238 _INTEL_BDW_D_IDS(3, info)
235 239
240#define INTEL_BDW_RSVDM_IDS(info) \
241 _INTEL_BDW_M_IDS(4, info)
242
243#define INTEL_BDW_RSVDD_IDS(info) \
244 _INTEL_BDW_D_IDS(4, info)
245
246#define INTEL_BDW_M_IDS(info) \
247 INTEL_BDW_GT12M_IDS(info), \
248 INTEL_BDW_GT3M_IDS(info), \
249 INTEL_BDW_RSVDM_IDS(info)
250
251#define INTEL_BDW_D_IDS(info) \
252 INTEL_BDW_GT12D_IDS(info), \
253 INTEL_BDW_GT3D_IDS(info), \
254 INTEL_BDW_RSVDD_IDS(info)
255
256#define INTEL_CHV_IDS(info) \
257 INTEL_VGA_DEVICE(0x22b0, info), \
258 INTEL_VGA_DEVICE(0x22b1, info), \
259 INTEL_VGA_DEVICE(0x22b2, info), \
260 INTEL_VGA_DEVICE(0x22b3, info)
261
236#endif /* _I915_PCIIDS_H */ 262#endif /* _I915_PCIIDS_H */
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h
index cfdc884405b7..baa6f11b1837 100644
--- a/include/drm/i915_powerwell.h
+++ b/include/drm/i915_powerwell.h
@@ -30,7 +30,8 @@
30#define _I915_POWERWELL_H_ 30#define _I915_POWERWELL_H_
31 31
32/* For use by hda_i915 driver */ 32/* For use by hda_i915 driver */
33extern void i915_request_power_well(void); 33extern int i915_request_power_well(void);
34extern void i915_release_power_well(void); 34extern int i915_release_power_well(void);
35extern int i915_get_cdclk_freq(void);
35 36
36#endif /* _I915_POWERWELL_H_ */ 37#endif /* _I915_POWERWELL_H_ */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index ee127ec33c60..7526c5bf5610 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -485,13 +485,12 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
485 void (*destroy) (struct ttm_buffer_object *)); 485 void (*destroy) (struct ttm_buffer_object *));
486 486
487/** 487/**
488 * ttm_bo_synccpu_object_init 488 * ttm_bo_create
489 * 489 *
490 * @bdev: Pointer to a ttm_bo_device struct. 490 * @bdev: Pointer to a ttm_bo_device struct.
491 * @bo: Pointer to a ttm_buffer_object to be initialized.
492 * @size: Requested size of buffer object. 491 * @size: Requested size of buffer object.
493 * @type: Requested type of buffer object. 492 * @type: Requested type of buffer object.
494 * @flags: Initial placement flags. 493 * @placement: Initial placement.
495 * @page_alignment: Data alignment in pages. 494 * @page_alignment: Data alignment in pages.
496 * @interruptible: If needing to sleep while waiting for GPU resources, 495 * @interruptible: If needing to sleep while waiting for GPU resources,
497 * sleep interruptible. 496 * sleep interruptible.
diff --git a/include/dt-bindings/clk/ti-dra7-atl.h b/include/dt-bindings/clk/ti-dra7-atl.h
new file mode 100644
index 000000000000..42dd4164f6f4
--- /dev/null
+++ b/include/dt-bindings/clk/ti-dra7-atl.h
@@ -0,0 +1,40 @@
1/*
2 * This header provides constants for DRA7 ATL (Audio Tracking Logic)
3 *
4 * The constants defined in this header are used in dts files
5 *
6 * Copyright (C) 2013 Texas Instruments, Inc.
7 *
8 * Peter Ujfalusi <peter.ujfalusi@ti.com>
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 version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
15 * kind, whether express or implied; without even the implied warranty
16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
19
20#ifndef _DT_BINDINGS_CLK_DRA7_ATL_H
21#define _DT_BINDINGS_CLK_DRA7_ATL_H
22
23#define DRA7_ATL_WS_MCASP1_FSR 0
24#define DRA7_ATL_WS_MCASP1_FSX 1
25#define DRA7_ATL_WS_MCASP2_FSR 2
26#define DRA7_ATL_WS_MCASP2_FSX 3
27#define DRA7_ATL_WS_MCASP3_FSX 4
28#define DRA7_ATL_WS_MCASP4_FSX 5
29#define DRA7_ATL_WS_MCASP5_FSX 6
30#define DRA7_ATL_WS_MCASP6_FSX 7
31#define DRA7_ATL_WS_MCASP7_FSX 8
32#define DRA7_ATL_WS_MCASP8_FSX 9
33#define DRA7_ATL_WS_MCASP8_AHCLKX 10
34#define DRA7_ATL_WS_XREF_CLK3 11
35#define DRA7_ATL_WS_XREF_CLK0 12
36#define DRA7_ATL_WS_XREF_CLK1 13
37#define DRA7_ATL_WS_XREF_CLK2 14
38#define DRA7_ATL_WS_OSC1_X1 15
39
40#endif
diff --git a/include/dt-bindings/clock/clps711x-clock.h b/include/dt-bindings/clock/clps711x-clock.h
new file mode 100644
index 000000000000..0c4c80b63242
--- /dev/null
+++ b/include/dt-bindings/clock/clps711x-clock.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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
10#ifndef __DT_BINDINGS_CLOCK_CLPS711X_H
11#define __DT_BINDINGS_CLOCK_CLPS711X_H
12
13#define CLPS711X_CLK_DUMMY 0
14#define CLPS711X_CLK_CPU 1
15#define CLPS711X_CLK_BUS 2
16#define CLPS711X_CLK_PLL 3
17#define CLPS711X_CLK_TIMERREF 4
18#define CLPS711X_CLK_TIMER1 5
19#define CLPS711X_CLK_TIMER2 6
20#define CLPS711X_CLK_PWM 7
21#define CLPS711X_CLK_SPIREF 8
22#define CLPS711X_CLK_SPI 9
23#define CLPS711X_CLK_UART 10
24#define CLPS711X_CLK_TICK 11
25#define CLPS711X_CLK_MAX 12
26
27#endif
diff --git a/include/dt-bindings/clock/exynos4.h b/include/dt-bindings/clock/exynos4.h
index 1106ca540a96..459bd2bd411f 100644
--- a/include/dt-bindings/clock/exynos4.h
+++ b/include/dt-bindings/clock/exynos4.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Andrzej Haja <a.hajda@samsung.com> 3 * Author: Andrzej Hajda <a.hajda@samsung.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
@@ -34,6 +34,11 @@
34#define CLK_MOUT_CORE 19 34#define CLK_MOUT_CORE 19
35#define CLK_MOUT_APLL 20 35#define CLK_MOUT_APLL 20
36#define CLK_SCLK_HDMIPHY 22 36#define CLK_SCLK_HDMIPHY 22
37#define CLK_OUT_DMC 23
38#define CLK_OUT_TOP 24
39#define CLK_OUT_LEFTBUS 25
40#define CLK_OUT_RIGHTBUS 26
41#define CLK_OUT_CPU 27
37 42
38/* gate for special clocks (sclk) */ 43/* gate for special clocks (sclk) */
39#define CLK_SCLK_FIMC0 128 44#define CLK_SCLK_FIMC0 128
@@ -230,6 +235,24 @@
230#define CLK_MOUT_G3D 394 235#define CLK_MOUT_G3D 394
231#define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */ 236#define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */
232 237
238/* gate clocks - ppmu */
239#define CLK_PPMULEFT 400
240#define CLK_PPMURIGHT 401
241#define CLK_PPMUCAMIF 402
242#define CLK_PPMUTV 403
243#define CLK_PPMUMFC_L 404
244#define CLK_PPMUMFC_R 405
245#define CLK_PPMUG3D 406
246#define CLK_PPMUIMAGE 407
247#define CLK_PPMULCD0 408
248#define CLK_PPMULCD1 409 /* Exynos4210 only */
249#define CLK_PPMUFILE 410
250#define CLK_PPMUGPS 411
251#define CLK_PPMUDMC0 412
252#define CLK_PPMUDMC1 413
253#define CLK_PPMUCPU 414
254#define CLK_PPMUACP 415
255
233/* div clocks */ 256/* div clocks */
234#define CLK_DIV_ISP0 450 /* Exynos4x12 only */ 257#define CLK_DIV_ISP0 450 /* Exynos4x12 only */
235#define CLK_DIV_ISP1 451 /* Exynos4x12 only */ 258#define CLK_DIV_ISP1 451 /* Exynos4x12 only */
diff --git a/include/dt-bindings/clock/exynos5250.h b/include/dt-bindings/clock/exynos5250.h
index be6e97c54f54..4273891dc78e 100644
--- a/include/dt-bindings/clock/exynos5250.h
+++ b/include/dt-bindings/clock/exynos5250.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Andrzej Haja <a.hajda@samsung.com> 3 * Author: Andrzej Hajda <a.hajda@samsung.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/dt-bindings/clock/exynos5420.h b/include/dt-bindings/clock/exynos5420.h
index 97dcb89d37d3..8dc0913f1775 100644
--- a/include/dt-bindings/clock/exynos5420.h
+++ b/include/dt-bindings/clock/exynos5420.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Andrzej Haja <a.hajda@samsung.com> 3 * Author: Andrzej Hajda <a.hajda@samsung.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
@@ -63,7 +63,6 @@
63#define CLK_SCLK_MPHY_IXTAL24 161 63#define CLK_SCLK_MPHY_IXTAL24 161
64 64
65/* gate clocks */ 65/* gate clocks */
66#define CLK_ACLK66_PERIC 256
67#define CLK_UART0 257 66#define CLK_UART0 257
68#define CLK_UART1 258 67#define CLK_UART1 258
69#define CLK_UART2 259 68#define CLK_UART2 259
@@ -203,6 +202,8 @@
203#define CLK_MOUT_G3D 641 202#define CLK_MOUT_G3D 641
204#define CLK_MOUT_VPLL 642 203#define CLK_MOUT_VPLL 642
205#define CLK_MOUT_MAUDIO0 643 204#define CLK_MOUT_MAUDIO0 643
205#define CLK_MOUT_USER_ACLK333 644
206#define CLK_MOUT_SW_ACLK333 645
206 207
207/* divider clocks */ 208/* divider clocks */
208#define CLK_DOUT_PIXEL 768 209#define CLK_DOUT_PIXEL 768
diff --git a/include/dt-bindings/clock/exynos5440.h b/include/dt-bindings/clock/exynos5440.h
index 70cd85077fa9..c66fc405a79a 100644
--- a/include/dt-bindings/clock/exynos5440.h
+++ b/include/dt-bindings/clock/exynos5440.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Andrzej Haja <a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 3 * Author: Andrzej Hajda <a.hajda@samsung.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/dt-bindings/clock/imx6sl-clock.h b/include/dt-bindings/clock/imx6sl-clock.h
index 7cf5c9969336..b91dd462ba85 100644
--- a/include/dt-bindings/clock/imx6sl-clock.h
+++ b/include/dt-bindings/clock/imx6sl-clock.h
@@ -145,6 +145,7 @@
145#define IMX6SL_CLK_USDHC4 132 145#define IMX6SL_CLK_USDHC4 132
146#define IMX6SL_CLK_PLL4_AUDIO_DIV 133 146#define IMX6SL_CLK_PLL4_AUDIO_DIV 133
147#define IMX6SL_CLK_SPBA 134 147#define IMX6SL_CLK_SPBA 134
148#define IMX6SL_CLK_END 135 148#define IMX6SL_CLK_ENET 135
149#define IMX6SL_CLK_END 136
149 150
150#endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */ 151#endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */
diff --git a/include/dt-bindings/clock/qcom,gcc-apq8084.h b/include/dt-bindings/clock/qcom,gcc-apq8084.h
new file mode 100644
index 000000000000..2c0da566c46a
--- /dev/null
+++ b/include/dt-bindings/clock/qcom,gcc-apq8084.h
@@ -0,0 +1,351 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
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#ifndef _DT_BINDINGS_CLK_APQ_GCC_8084_H
15#define _DT_BINDINGS_CLK_APQ_GCC_8084_H
16
17#define GPLL0 0
18#define GPLL0_VOTE 1
19#define GPLL1 2
20#define GPLL1_VOTE 3
21#define GPLL2 4
22#define GPLL2_VOTE 5
23#define GPLL3 6
24#define GPLL3_VOTE 7
25#define GPLL4 8
26#define GPLL4_VOTE 9
27#define CONFIG_NOC_CLK_SRC 10
28#define PERIPH_NOC_CLK_SRC 11
29#define SYSTEM_NOC_CLK_SRC 12
30#define BLSP_UART_SIM_CLK_SRC 13
31#define QDSS_TSCTR_CLK_SRC 14
32#define UFS_AXI_CLK_SRC 15
33#define RPM_CLK_SRC 16
34#define KPSS_AHB_CLK_SRC 17
35#define QDSS_AT_CLK_SRC 18
36#define BIMC_DDR_CLK_SRC 19
37#define USB30_MASTER_CLK_SRC 20
38#define USB30_SEC_MASTER_CLK_SRC 21
39#define USB_HSIC_AHB_CLK_SRC 22
40#define MMSS_BIMC_GFX_CLK_SRC 23
41#define QDSS_STM_CLK_SRC 24
42#define ACC_CLK_SRC 25
43#define SEC_CTRL_CLK_SRC 26
44#define BLSP1_QUP1_I2C_APPS_CLK_SRC 27
45#define BLSP1_QUP1_SPI_APPS_CLK_SRC 28
46#define BLSP1_QUP2_I2C_APPS_CLK_SRC 29
47#define BLSP1_QUP2_SPI_APPS_CLK_SRC 30
48#define BLSP1_QUP3_I2C_APPS_CLK_SRC 31
49#define BLSP1_QUP3_SPI_APPS_CLK_SRC 32
50#define BLSP1_QUP4_I2C_APPS_CLK_SRC 33
51#define BLSP1_QUP4_SPI_APPS_CLK_SRC 34
52#define BLSP1_QUP5_I2C_APPS_CLK_SRC 35
53#define BLSP1_QUP5_SPI_APPS_CLK_SRC 36
54#define BLSP1_QUP6_I2C_APPS_CLK_SRC 37
55#define BLSP1_QUP6_SPI_APPS_CLK_SRC 38
56#define BLSP1_UART1_APPS_CLK_SRC 39
57#define BLSP1_UART2_APPS_CLK_SRC 40
58#define BLSP1_UART3_APPS_CLK_SRC 41
59#define BLSP1_UART4_APPS_CLK_SRC 42
60#define BLSP1_UART5_APPS_CLK_SRC 43
61#define BLSP1_UART6_APPS_CLK_SRC 44
62#define BLSP2_QUP1_I2C_APPS_CLK_SRC 45
63#define BLSP2_QUP1_SPI_APPS_CLK_SRC 46
64#define BLSP2_QUP2_I2C_APPS_CLK_SRC 47
65#define BLSP2_QUP2_SPI_APPS_CLK_SRC 48
66#define BLSP2_QUP3_I2C_APPS_CLK_SRC 49
67#define BLSP2_QUP3_SPI_APPS_CLK_SRC 50
68#define BLSP2_QUP4_I2C_APPS_CLK_SRC 51
69#define BLSP2_QUP4_SPI_APPS_CLK_SRC 52
70#define BLSP2_QUP5_I2C_APPS_CLK_SRC 53
71#define BLSP2_QUP5_SPI_APPS_CLK_SRC 54
72#define BLSP2_QUP6_I2C_APPS_CLK_SRC 55
73#define BLSP2_QUP6_SPI_APPS_CLK_SRC 56
74#define BLSP2_UART1_APPS_CLK_SRC 57
75#define BLSP2_UART2_APPS_CLK_SRC 58
76#define BLSP2_UART3_APPS_CLK_SRC 59
77#define BLSP2_UART4_APPS_CLK_SRC 60
78#define BLSP2_UART5_APPS_CLK_SRC 61
79#define BLSP2_UART6_APPS_CLK_SRC 62
80#define CE1_CLK_SRC 63
81#define CE2_CLK_SRC 64
82#define CE3_CLK_SRC 65
83#define GP1_CLK_SRC 66
84#define GP2_CLK_SRC 67
85#define GP3_CLK_SRC 68
86#define PDM2_CLK_SRC 69
87#define QDSS_TRACECLKIN_CLK_SRC 70
88#define RBCPR_CLK_SRC 71
89#define SATA_ASIC0_CLK_SRC 72
90#define SATA_PMALIVE_CLK_SRC 73
91#define SATA_RX_CLK_SRC 74
92#define SATA_RX_OOB_CLK_SRC 75
93#define SDCC1_APPS_CLK_SRC 76
94#define SDCC2_APPS_CLK_SRC 77
95#define SDCC3_APPS_CLK_SRC 78
96#define SDCC4_APPS_CLK_SRC 79
97#define GCC_SNOC_BUS_TIMEOUT0_AHB_CLK 80
98#define SPMI_AHB_CLK_SRC 81
99#define SPMI_SER_CLK_SRC 82
100#define TSIF_REF_CLK_SRC 83
101#define USB30_MOCK_UTMI_CLK_SRC 84
102#define USB30_SEC_MOCK_UTMI_CLK_SRC 85
103#define USB_HS_SYSTEM_CLK_SRC 86
104#define USB_HSIC_CLK_SRC 87
105#define USB_HSIC_IO_CAL_CLK_SRC 88
106#define USB_HSIC_MOCK_UTMI_CLK_SRC 89
107#define USB_HSIC_SYSTEM_CLK_SRC 90
108#define GCC_BAM_DMA_AHB_CLK 91
109#define GCC_BAM_DMA_INACTIVITY_TIMERS_CLK 92
110#define DDR_CLK_SRC 93
111#define GCC_BIMC_CFG_AHB_CLK 94
112#define GCC_BIMC_CLK 95
113#define GCC_BIMC_KPSS_AXI_CLK 96
114#define GCC_BIMC_SLEEP_CLK 97
115#define GCC_BIMC_SYSNOC_AXI_CLK 98
116#define GCC_BIMC_XO_CLK 99
117#define GCC_BLSP1_AHB_CLK 100
118#define GCC_BLSP1_SLEEP_CLK 101
119#define GCC_BLSP1_QUP1_I2C_APPS_CLK 102
120#define GCC_BLSP1_QUP1_SPI_APPS_CLK 103
121#define GCC_BLSP1_QUP2_I2C_APPS_CLK 104
122#define GCC_BLSP1_QUP2_SPI_APPS_CLK 105
123#define GCC_BLSP1_QUP3_I2C_APPS_CLK 106
124#define GCC_BLSP1_QUP3_SPI_APPS_CLK 107
125#define GCC_BLSP1_QUP4_I2C_APPS_CLK 108
126#define GCC_BLSP1_QUP4_SPI_APPS_CLK 109
127#define GCC_BLSP1_QUP5_I2C_APPS_CLK 110
128#define GCC_BLSP1_QUP5_SPI_APPS_CLK 111
129#define GCC_BLSP1_QUP6_I2C_APPS_CLK 112
130#define GCC_BLSP1_QUP6_SPI_APPS_CLK 113
131#define GCC_BLSP1_UART1_APPS_CLK 114
132#define GCC_BLSP1_UART1_SIM_CLK 115
133#define GCC_BLSP1_UART2_APPS_CLK 116
134#define GCC_BLSP1_UART2_SIM_CLK 117
135#define GCC_BLSP1_UART3_APPS_CLK 118
136#define GCC_BLSP1_UART3_SIM_CLK 119
137#define GCC_BLSP1_UART4_APPS_CLK 120
138#define GCC_BLSP1_UART4_SIM_CLK 121
139#define GCC_BLSP1_UART5_APPS_CLK 122
140#define GCC_BLSP1_UART5_SIM_CLK 123
141#define GCC_BLSP1_UART6_APPS_CLK 124
142#define GCC_BLSP1_UART6_SIM_CLK 125
143#define GCC_BLSP2_AHB_CLK 126
144#define GCC_BLSP2_SLEEP_CLK 127
145#define GCC_BLSP2_QUP1_I2C_APPS_CLK 128
146#define GCC_BLSP2_QUP1_SPI_APPS_CLK 129
147#define GCC_BLSP2_QUP2_I2C_APPS_CLK 130
148#define GCC_BLSP2_QUP2_SPI_APPS_CLK 131
149#define GCC_BLSP2_QUP3_I2C_APPS_CLK 132
150#define GCC_BLSP2_QUP3_SPI_APPS_CLK 133
151#define GCC_BLSP2_QUP4_I2C_APPS_CLK 134
152#define GCC_BLSP2_QUP4_SPI_APPS_CLK 135
153#define GCC_BLSP2_QUP5_I2C_APPS_CLK 136
154#define GCC_BLSP2_QUP5_SPI_APPS_CLK 137
155#define GCC_BLSP2_QUP6_I2C_APPS_CLK 138
156#define GCC_BLSP2_QUP6_SPI_APPS_CLK 139
157#define GCC_BLSP2_UART1_APPS_CLK 140
158#define GCC_BLSP2_UART1_SIM_CLK 141
159#define GCC_BLSP2_UART2_APPS_CLK 142
160#define GCC_BLSP2_UART2_SIM_CLK 143
161#define GCC_BLSP2_UART3_APPS_CLK 144
162#define GCC_BLSP2_UART3_SIM_CLK 145
163#define GCC_BLSP2_UART4_APPS_CLK 146
164#define GCC_BLSP2_UART4_SIM_CLK 147
165#define GCC_BLSP2_UART5_APPS_CLK 148
166#define GCC_BLSP2_UART5_SIM_CLK 149
167#define GCC_BLSP2_UART6_APPS_CLK 150
168#define GCC_BLSP2_UART6_SIM_CLK 151
169#define GCC_BOOT_ROM_AHB_CLK 152
170#define GCC_CE1_AHB_CLK 153
171#define GCC_CE1_AXI_CLK 154
172#define GCC_CE1_CLK 155
173#define GCC_CE2_AHB_CLK 156
174#define GCC_CE2_AXI_CLK 157
175#define GCC_CE2_CLK 158
176#define GCC_CE3_AHB_CLK 159
177#define GCC_CE3_AXI_CLK 160
178#define GCC_CE3_CLK 161
179#define GCC_CNOC_BUS_TIMEOUT0_AHB_CLK 162
180#define GCC_CNOC_BUS_TIMEOUT1_AHB_CLK 163
181#define GCC_CNOC_BUS_TIMEOUT2_AHB_CLK 164
182#define GCC_CNOC_BUS_TIMEOUT3_AHB_CLK 165
183#define GCC_CNOC_BUS_TIMEOUT4_AHB_CLK 166
184#define GCC_CNOC_BUS_TIMEOUT5_AHB_CLK 167
185#define GCC_CNOC_BUS_TIMEOUT6_AHB_CLK 168
186#define GCC_CNOC_BUS_TIMEOUT7_AHB_CLK 169
187#define GCC_CFG_NOC_AHB_CLK 170
188#define GCC_CFG_NOC_DDR_CFG_CLK 171
189#define GCC_CFG_NOC_RPM_AHB_CLK 172
190#define GCC_COPSS_SMMU_AHB_CLK 173
191#define GCC_COPSS_SMMU_AXI_CLK 174
192#define GCC_DCD_XO_CLK 175
193#define GCC_BIMC_DDR_CH0_CLK 176
194#define GCC_BIMC_DDR_CH1_CLK 177
195#define GCC_BIMC_DDR_CPLL0_CLK 178
196#define GCC_BIMC_DDR_CPLL1_CLK 179
197#define GCC_BIMC_GFX_CLK 180
198#define GCC_DDR_DIM_CFG_CLK 181
199#define GCC_DDR_DIM_SLEEP_CLK 182
200#define GCC_DEHR_CLK 183
201#define GCC_AHB_CLK 184
202#define GCC_IM_SLEEP_CLK 185
203#define GCC_XO_CLK 186
204#define GCC_XO_DIV4_CLK 187
205#define GCC_GP1_CLK 188
206#define GCC_GP2_CLK 189
207#define GCC_GP3_CLK 190
208#define GCC_IMEM_AXI_CLK 191
209#define GCC_IMEM_CFG_AHB_CLK 192
210#define GCC_KPSS_AHB_CLK 193
211#define GCC_KPSS_AXI_CLK 194
212#define GCC_LPASS_MPORT_AXI_CLK 195
213#define GCC_LPASS_Q6_AXI_CLK 196
214#define GCC_LPASS_SWAY_CLK 197
215#define GCC_MMSS_BIMC_GFX_CLK 198
216#define GCC_MMSS_NOC_AT_CLK 199
217#define GCC_MMSS_NOC_CFG_AHB_CLK 200
218#define GCC_MMSS_VPU_MAPLE_SYS_NOC_AXI_CLK 201
219#define GCC_OCMEM_NOC_CFG_AHB_CLK 202
220#define GCC_OCMEM_SYS_NOC_AXI_CLK 203
221#define GCC_MPM_AHB_CLK 204
222#define GCC_MSG_RAM_AHB_CLK 205
223#define GCC_NOC_CONF_XPU_AHB_CLK 206
224#define GCC_PDM2_CLK 207
225#define GCC_PDM_AHB_CLK 208
226#define GCC_PDM_XO4_CLK 209
227#define GCC_PERIPH_NOC_AHB_CLK 210
228#define GCC_PERIPH_NOC_AT_CLK 211
229#define GCC_PERIPH_NOC_CFG_AHB_CLK 212
230#define GCC_PERIPH_NOC_USB_HSIC_AHB_CLK 213
231#define GCC_PERIPH_NOC_MPU_CFG_AHB_CLK 214
232#define GCC_PERIPH_XPU_AHB_CLK 215
233#define GCC_PNOC_BUS_TIMEOUT0_AHB_CLK 216
234#define GCC_PNOC_BUS_TIMEOUT1_AHB_CLK 217
235#define GCC_PNOC_BUS_TIMEOUT2_AHB_CLK 218
236#define GCC_PNOC_BUS_TIMEOUT3_AHB_CLK 219
237#define GCC_PNOC_BUS_TIMEOUT4_AHB_CLK 220
238#define GCC_PRNG_AHB_CLK 221
239#define GCC_QDSS_AT_CLK 222
240#define GCC_QDSS_CFG_AHB_CLK 223
241#define GCC_QDSS_DAP_AHB_CLK 224
242#define GCC_QDSS_DAP_CLK 225
243#define GCC_QDSS_ETR_USB_CLK 226
244#define GCC_QDSS_STM_CLK 227
245#define GCC_QDSS_TRACECLKIN_CLK 228
246#define GCC_QDSS_TSCTR_DIV16_CLK 229
247#define GCC_QDSS_TSCTR_DIV2_CLK 230
248#define GCC_QDSS_TSCTR_DIV3_CLK 231
249#define GCC_QDSS_TSCTR_DIV4_CLK 232
250#define GCC_QDSS_TSCTR_DIV8_CLK 233
251#define GCC_QDSS_RBCPR_XPU_AHB_CLK 234
252#define GCC_RBCPR_AHB_CLK 235
253#define GCC_RBCPR_CLK 236
254#define GCC_RPM_BUS_AHB_CLK 237
255#define GCC_RPM_PROC_HCLK 238
256#define GCC_RPM_SLEEP_CLK 239
257#define GCC_RPM_TIMER_CLK 240
258#define GCC_SATA_ASIC0_CLK 241
259#define GCC_SATA_AXI_CLK 242
260#define GCC_SATA_CFG_AHB_CLK 243
261#define GCC_SATA_PMALIVE_CLK 244
262#define GCC_SATA_RX_CLK 245
263#define GCC_SATA_RX_OOB_CLK 246
264#define GCC_SDCC1_AHB_CLK 247
265#define GCC_SDCC1_APPS_CLK 248
266#define GCC_SDCC1_CDCCAL_FF_CLK 249
267#define GCC_SDCC1_CDCCAL_SLEEP_CLK 250
268#define GCC_SDCC2_AHB_CLK 251
269#define GCC_SDCC2_APPS_CLK 252
270#define GCC_SDCC2_INACTIVITY_TIMERS_CLK 253
271#define GCC_SDCC3_AHB_CLK 254
272#define GCC_SDCC3_APPS_CLK 255
273#define GCC_SDCC3_INACTIVITY_TIMERS_CLK 256
274#define GCC_SDCC4_AHB_CLK 257
275#define GCC_SDCC4_APPS_CLK 258
276#define GCC_SDCC4_INACTIVITY_TIMERS_CLK 259
277#define GCC_SEC_CTRL_ACC_CLK 260
278#define GCC_SEC_CTRL_AHB_CLK 261
279#define GCC_SEC_CTRL_BOOT_ROM_PATCH_CLK 262
280#define GCC_SEC_CTRL_CLK 263
281#define GCC_SEC_CTRL_SENSE_CLK 264
282#define GCC_SNOC_BUS_TIMEOUT2_AHB_CLK 265
283#define GCC_SNOC_BUS_TIMEOUT3_AHB_CLK 266
284#define GCC_SPDM_BIMC_CY_CLK 267
285#define GCC_SPDM_CFG_AHB_CLK 268
286#define GCC_SPDM_DEBUG_CY_CLK 269
287#define GCC_SPDM_FF_CLK 270
288#define GCC_SPDM_MSTR_AHB_CLK 271
289#define GCC_SPDM_PNOC_CY_CLK 272
290#define GCC_SPDM_RPM_CY_CLK 273
291#define GCC_SPDM_SNOC_CY_CLK 274
292#define GCC_SPMI_AHB_CLK 275
293#define GCC_SPMI_CNOC_AHB_CLK 276
294#define GCC_SPMI_SER_CLK 277
295#define GCC_SPSS_AHB_CLK 278
296#define GCC_SNOC_CNOC_AHB_CLK 279
297#define GCC_SNOC_PNOC_AHB_CLK 280
298#define GCC_SYS_NOC_AT_CLK 281
299#define GCC_SYS_NOC_AXI_CLK 282
300#define GCC_SYS_NOC_KPSS_AHB_CLK 283
301#define GCC_SYS_NOC_QDSS_STM_AXI_CLK 284
302#define GCC_SYS_NOC_UFS_AXI_CLK 285
303#define GCC_SYS_NOC_USB3_AXI_CLK 286
304#define GCC_SYS_NOC_USB3_SEC_AXI_CLK 287
305#define GCC_TCSR_AHB_CLK 288
306#define GCC_TLMM_AHB_CLK 289
307#define GCC_TLMM_CLK 290
308#define GCC_TSIF_AHB_CLK 291
309#define GCC_TSIF_INACTIVITY_TIMERS_CLK 292
310#define GCC_TSIF_REF_CLK 293
311#define GCC_UFS_AHB_CLK 294
312#define GCC_UFS_AXI_CLK 295
313#define GCC_UFS_RX_CFG_CLK 296
314#define GCC_UFS_RX_SYMBOL_0_CLK 297
315#define GCC_UFS_RX_SYMBOL_1_CLK 298
316#define GCC_UFS_TX_CFG_CLK 299
317#define GCC_UFS_TX_SYMBOL_0_CLK 300
318#define GCC_UFS_TX_SYMBOL_1_CLK 301
319#define GCC_USB2A_PHY_SLEEP_CLK 302
320#define GCC_USB2B_PHY_SLEEP_CLK 303
321#define GCC_USB30_MASTER_CLK 304
322#define GCC_USB30_MOCK_UTMI_CLK 305
323#define GCC_USB30_SLEEP_CLK 306
324#define GCC_USB30_SEC_MASTER_CLK 307
325#define GCC_USB30_SEC_MOCK_UTMI_CLK 308
326#define GCC_USB30_SEC_SLEEP_CLK 309
327#define GCC_USB_HS_AHB_CLK 310
328#define GCC_USB_HS_INACTIVITY_TIMERS_CLK 311
329#define GCC_USB_HS_SYSTEM_CLK 312
330#define GCC_USB_HSIC_AHB_CLK 313
331#define GCC_USB_HSIC_CLK 314
332#define GCC_USB_HSIC_IO_CAL_CLK 315
333#define GCC_USB_HSIC_IO_CAL_SLEEP_CLK 316
334#define GCC_USB_HSIC_MOCK_UTMI_CLK 317
335#define GCC_USB_HSIC_SYSTEM_CLK 318
336#define PCIE_0_AUX_CLK_SRC 319
337#define PCIE_0_PIPE_CLK_SRC 320
338#define PCIE_1_AUX_CLK_SRC 321
339#define PCIE_1_PIPE_CLK_SRC 322
340#define GCC_PCIE_0_AUX_CLK 323
341#define GCC_PCIE_0_CFG_AHB_CLK 324
342#define GCC_PCIE_0_MSTR_AXI_CLK 325
343#define GCC_PCIE_0_PIPE_CLK 326
344#define GCC_PCIE_0_SLV_AXI_CLK 327
345#define GCC_PCIE_1_AUX_CLK 328
346#define GCC_PCIE_1_CFG_AHB_CLK 329
347#define GCC_PCIE_1_MSTR_AXI_CLK 330
348#define GCC_PCIE_1_PIPE_CLK 331
349#define GCC_PCIE_1_SLV_AXI_CLK 332
350
351#endif
diff --git a/include/dt-bindings/clock/qcom,gcc-ipq806x.h b/include/dt-bindings/clock/qcom,gcc-ipq806x.h
new file mode 100644
index 000000000000..b857cadb0bd4
--- /dev/null
+++ b/include/dt-bindings/clock/qcom,gcc-ipq806x.h
@@ -0,0 +1,293 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
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#ifndef _DT_BINDINGS_CLK_GCC_IPQ806X_H
15#define _DT_BINDINGS_CLK_GCC_IPQ806X_H
16
17#define AFAB_CLK_SRC 0
18#define QDSS_STM_CLK 1
19#define SCSS_A_CLK 2
20#define SCSS_H_CLK 3
21#define AFAB_CORE_CLK 4
22#define SCSS_XO_SRC_CLK 5
23#define AFAB_EBI1_CH0_A_CLK 6
24#define AFAB_EBI1_CH1_A_CLK 7
25#define AFAB_AXI_S0_FCLK 8
26#define AFAB_AXI_S1_FCLK 9
27#define AFAB_AXI_S2_FCLK 10
28#define AFAB_AXI_S3_FCLK 11
29#define AFAB_AXI_S4_FCLK 12
30#define SFAB_CORE_CLK 13
31#define SFAB_AXI_S0_FCLK 14
32#define SFAB_AXI_S1_FCLK 15
33#define SFAB_AXI_S2_FCLK 16
34#define SFAB_AXI_S3_FCLK 17
35#define SFAB_AXI_S4_FCLK 18
36#define SFAB_AXI_S5_FCLK 19
37#define SFAB_AHB_S0_FCLK 20
38#define SFAB_AHB_S1_FCLK 21
39#define SFAB_AHB_S2_FCLK 22
40#define SFAB_AHB_S3_FCLK 23
41#define SFAB_AHB_S4_FCLK 24
42#define SFAB_AHB_S5_FCLK 25
43#define SFAB_AHB_S6_FCLK 26
44#define SFAB_AHB_S7_FCLK 27
45#define QDSS_AT_CLK_SRC 28
46#define QDSS_AT_CLK 29
47#define QDSS_TRACECLKIN_CLK_SRC 30
48#define QDSS_TRACECLKIN_CLK 31
49#define QDSS_TSCTR_CLK_SRC 32
50#define QDSS_TSCTR_CLK 33
51#define SFAB_ADM0_M0_A_CLK 34
52#define SFAB_ADM0_M1_A_CLK 35
53#define SFAB_ADM0_M2_H_CLK 36
54#define ADM0_CLK 37
55#define ADM0_PBUS_CLK 38
56#define IMEM0_A_CLK 39
57#define QDSS_H_CLK 40
58#define PCIE_A_CLK 41
59#define PCIE_AUX_CLK 42
60#define PCIE_H_CLK 43
61#define PCIE_PHY_CLK 44
62#define SFAB_CLK_SRC 45
63#define SFAB_LPASS_Q6_A_CLK 46
64#define SFAB_AFAB_M_A_CLK 47
65#define AFAB_SFAB_M0_A_CLK 48
66#define AFAB_SFAB_M1_A_CLK 49
67#define SFAB_SATA_S_H_CLK 50
68#define DFAB_CLK_SRC 51
69#define DFAB_CLK 52
70#define SFAB_DFAB_M_A_CLK 53
71#define DFAB_SFAB_M_A_CLK 54
72#define DFAB_SWAY0_H_CLK 55
73#define DFAB_SWAY1_H_CLK 56
74#define DFAB_ARB0_H_CLK 57
75#define DFAB_ARB1_H_CLK 58
76#define PPSS_H_CLK 59
77#define PPSS_PROC_CLK 60
78#define PPSS_TIMER0_CLK 61
79#define PPSS_TIMER1_CLK 62
80#define PMEM_A_CLK 63
81#define DMA_BAM_H_CLK 64
82#define SIC_H_CLK 65
83#define SPS_TIC_H_CLK 66
84#define CFPB_2X_CLK_SRC 67
85#define CFPB_CLK 68
86#define CFPB0_H_CLK 69
87#define CFPB1_H_CLK 70
88#define CFPB2_H_CLK 71
89#define SFAB_CFPB_M_H_CLK 72
90#define CFPB_MASTER_H_CLK 73
91#define SFAB_CFPB_S_H_CLK 74
92#define CFPB_SPLITTER_H_CLK 75
93#define TSIF_H_CLK 76
94#define TSIF_INACTIVITY_TIMERS_CLK 77
95#define TSIF_REF_SRC 78
96#define TSIF_REF_CLK 79
97#define CE1_H_CLK 80
98#define CE1_CORE_CLK 81
99#define CE1_SLEEP_CLK 82
100#define CE2_H_CLK 83
101#define CE2_CORE_CLK 84
102#define SFPB_H_CLK_SRC 85
103#define SFPB_H_CLK 86
104#define SFAB_SFPB_M_H_CLK 87
105#define SFAB_SFPB_S_H_CLK 88
106#define RPM_PROC_CLK 89
107#define RPM_BUS_H_CLK 90
108#define RPM_SLEEP_CLK 91
109#define RPM_TIMER_CLK 92
110#define RPM_MSG_RAM_H_CLK 93
111#define PMIC_ARB0_H_CLK 94
112#define PMIC_ARB1_H_CLK 95
113#define PMIC_SSBI2_SRC 96
114#define PMIC_SSBI2_CLK 97
115#define SDC1_H_CLK 98
116#define SDC2_H_CLK 99
117#define SDC3_H_CLK 100
118#define SDC4_H_CLK 101
119#define SDC1_SRC 102
120#define SDC1_CLK 103
121#define SDC2_SRC 104
122#define SDC2_CLK 105
123#define SDC3_SRC 106
124#define SDC3_CLK 107
125#define SDC4_SRC 108
126#define SDC4_CLK 109
127#define USB_HS1_H_CLK 110
128#define USB_HS1_XCVR_SRC 111
129#define USB_HS1_XCVR_CLK 112
130#define USB_HSIC_H_CLK 113
131#define USB_HSIC_XCVR_SRC 114
132#define USB_HSIC_XCVR_CLK 115
133#define USB_HSIC_SYSTEM_CLK_SRC 116
134#define USB_HSIC_SYSTEM_CLK 117
135#define CFPB0_C0_H_CLK 118
136#define CFPB0_D0_H_CLK 119
137#define CFPB0_C1_H_CLK 120
138#define CFPB0_D1_H_CLK 121
139#define USB_FS1_H_CLK 122
140#define USB_FS1_XCVR_SRC 123
141#define USB_FS1_XCVR_CLK 124
142#define USB_FS1_SYSTEM_CLK 125
143#define GSBI_COMMON_SIM_SRC 126
144#define GSBI1_H_CLK 127
145#define GSBI2_H_CLK 128
146#define GSBI3_H_CLK 129
147#define GSBI4_H_CLK 130
148#define GSBI5_H_CLK 131
149#define GSBI6_H_CLK 132
150#define GSBI7_H_CLK 133
151#define GSBI1_QUP_SRC 134
152#define GSBI1_QUP_CLK 135
153#define GSBI2_QUP_SRC 136
154#define GSBI2_QUP_CLK 137
155#define GSBI3_QUP_SRC 138
156#define GSBI3_QUP_CLK 139
157#define GSBI4_QUP_SRC 140
158#define GSBI4_QUP_CLK 141
159#define GSBI5_QUP_SRC 142
160#define GSBI5_QUP_CLK 143
161#define GSBI6_QUP_SRC 144
162#define GSBI6_QUP_CLK 145
163#define GSBI7_QUP_SRC 146
164#define GSBI7_QUP_CLK 147
165#define GSBI1_UART_SRC 148
166#define GSBI1_UART_CLK 149
167#define GSBI2_UART_SRC 150
168#define GSBI2_UART_CLK 151
169#define GSBI3_UART_SRC 152
170#define GSBI3_UART_CLK 153
171#define GSBI4_UART_SRC 154
172#define GSBI4_UART_CLK 155
173#define GSBI5_UART_SRC 156
174#define GSBI5_UART_CLK 157
175#define GSBI6_UART_SRC 158
176#define GSBI6_UART_CLK 159
177#define GSBI7_UART_SRC 160
178#define GSBI7_UART_CLK 161
179#define GSBI1_SIM_CLK 162
180#define GSBI2_SIM_CLK 163
181#define GSBI3_SIM_CLK 164
182#define GSBI4_SIM_CLK 165
183#define GSBI5_SIM_CLK 166
184#define GSBI6_SIM_CLK 167
185#define GSBI7_SIM_CLK 168
186#define USB_HSIC_HSIC_CLK_SRC 169
187#define USB_HSIC_HSIC_CLK 170
188#define USB_HSIC_HSIO_CAL_CLK 171
189#define SPDM_CFG_H_CLK 172
190#define SPDM_MSTR_H_CLK 173
191#define SPDM_FF_CLK_SRC 174
192#define SPDM_FF_CLK 175
193#define SEC_CTRL_CLK 176
194#define SEC_CTRL_ACC_CLK_SRC 177
195#define SEC_CTRL_ACC_CLK 178
196#define TLMM_H_CLK 179
197#define TLMM_CLK 180
198#define SATA_H_CLK 181
199#define SATA_CLK_SRC 182
200#define SATA_RXOOB_CLK 183
201#define SATA_PMALIVE_CLK 184
202#define SATA_PHY_REF_CLK 185
203#define SATA_A_CLK 186
204#define SATA_PHY_CFG_CLK 187
205#define TSSC_CLK_SRC 188
206#define TSSC_CLK 189
207#define PDM_SRC 190
208#define PDM_CLK 191
209#define GP0_SRC 192
210#define GP0_CLK 193
211#define GP1_SRC 194
212#define GP1_CLK 195
213#define GP2_SRC 196
214#define GP2_CLK 197
215#define MPM_CLK 198
216#define EBI1_CLK_SRC 199
217#define EBI1_CH0_CLK 200
218#define EBI1_CH1_CLK 201
219#define EBI1_2X_CLK 202
220#define EBI1_CH0_DQ_CLK 203
221#define EBI1_CH1_DQ_CLK 204
222#define EBI1_CH0_CA_CLK 205
223#define EBI1_CH1_CA_CLK 206
224#define EBI1_XO_CLK 207
225#define SFAB_SMPSS_S_H_CLK 208
226#define PRNG_SRC 209
227#define PRNG_CLK 210
228#define PXO_SRC 211
229#define SPDM_CY_PORT0_CLK 212
230#define SPDM_CY_PORT1_CLK 213
231#define SPDM_CY_PORT2_CLK 214
232#define SPDM_CY_PORT3_CLK 215
233#define SPDM_CY_PORT4_CLK 216
234#define SPDM_CY_PORT5_CLK 217
235#define SPDM_CY_PORT6_CLK 218
236#define SPDM_CY_PORT7_CLK 219
237#define PLL0 220
238#define PLL0_VOTE 221
239#define PLL3 222
240#define PLL3_VOTE 223
241#define PLL4 224
242#define PLL4_VOTE 225
243#define PLL8 226
244#define PLL8_VOTE 227
245#define PLL9 228
246#define PLL10 229
247#define PLL11 230
248#define PLL12 231
249#define PLL14 232
250#define PLL14_VOTE 233
251#define PLL18 234
252#define CE5_SRC 235
253#define CE5_H_CLK 236
254#define CE5_CORE_CLK 237
255#define CE3_SLEEP_CLK 238
256#define SFAB_AHB_S8_FCLK 239
257#define SPDM_CY_PORT8_CLK 246
258#define PCIE_ALT_REF_SRC 247
259#define PCIE_ALT_REF_CLK 248
260#define PCIE_1_A_CLK 249
261#define PCIE_1_AUX_CLK 250
262#define PCIE_1_H_CLK 251
263#define PCIE_1_PHY_CLK 252
264#define PCIE_1_ALT_REF_SRC 253
265#define PCIE_1_ALT_REF_CLK 254
266#define PCIE_2_A_CLK 255
267#define PCIE_2_AUX_CLK 256
268#define PCIE_2_H_CLK 257
269#define PCIE_2_PHY_CLK 258
270#define PCIE_2_ALT_REF_SRC 259
271#define PCIE_2_ALT_REF_CLK 260
272#define EBI2_CLK 261
273#define USB30_SLEEP_CLK 262
274#define USB30_UTMI_SRC 263
275#define USB30_0_UTMI_CLK 264
276#define USB30_1_UTMI_CLK 265
277#define USB30_MASTER_SRC 266
278#define USB30_0_MASTER_CLK 267
279#define USB30_1_MASTER_CLK 268
280#define GMAC_CORE1_CLK_SRC 269
281#define GMAC_CORE2_CLK_SRC 270
282#define GMAC_CORE3_CLK_SRC 271
283#define GMAC_CORE4_CLK_SRC 272
284#define GMAC_CORE1_CLK 273
285#define GMAC_CORE2_CLK 274
286#define GMAC_CORE3_CLK 275
287#define GMAC_CORE4_CLK 276
288#define UBI32_CORE1_CLK_SRC 277
289#define UBI32_CORE2_CLK_SRC 278
290#define UBI32_CORE1_CLK 279
291#define UBI32_CORE2_CLK 280
292
293#endif
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8960.h b/include/dt-bindings/clock/qcom,gcc-msm8960.h
index f9f547146a15..7d20eedfee98 100644
--- a/include/dt-bindings/clock/qcom,gcc-msm8960.h
+++ b/include/dt-bindings/clock/qcom,gcc-msm8960.h
@@ -308,5 +308,16 @@
308#define PLL13 292 308#define PLL13 292
309#define PLL14 293 309#define PLL14 293
310#define PLL14_VOTE 294 310#define PLL14_VOTE 294
311#define USB_HS3_H_CLK 295
312#define USB_HS3_XCVR_SRC 296
313#define USB_HS3_XCVR_CLK 297
314#define USB_HS4_H_CLK 298
315#define USB_HS4_XCVR_SRC 299
316#define USB_HS4_XCVR_CLK 300
317#define SATA_PHY_CFG_CLK 301
318#define SATA_A_CLK 302
319#define CE3_SRC 303
320#define CE3_CORE_CLK 304
321#define CE3_H_CLK 305
311 322
312#endif 323#endif
diff --git a/include/dt-bindings/clock/qcom,mmcc-apq8084.h b/include/dt-bindings/clock/qcom,mmcc-apq8084.h
new file mode 100644
index 000000000000..a929f86d0ddd
--- /dev/null
+++ b/include/dt-bindings/clock/qcom,mmcc-apq8084.h
@@ -0,0 +1,183 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
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#ifndef _DT_BINDINGS_CLK_APQ_MMCC_8084_H
15#define _DT_BINDINGS_CLK_APQ_MMCC_8084_H
16
17#define MMSS_AHB_CLK_SRC 0
18#define MMSS_AXI_CLK_SRC 1
19#define MMPLL0 2
20#define MMPLL0_VOTE 3
21#define MMPLL1 4
22#define MMPLL1_VOTE 5
23#define MMPLL2 6
24#define MMPLL3 7
25#define MMPLL4 8
26#define CSI0_CLK_SRC 9
27#define CSI1_CLK_SRC 10
28#define CSI2_CLK_SRC 11
29#define CSI3_CLK_SRC 12
30#define VCODEC0_CLK_SRC 13
31#define VFE0_CLK_SRC 14
32#define VFE1_CLK_SRC 15
33#define MDP_CLK_SRC 16
34#define PCLK0_CLK_SRC 17
35#define PCLK1_CLK_SRC 18
36#define OCMEMNOC_CLK_SRC 19
37#define GFX3D_CLK_SRC 20
38#define JPEG0_CLK_SRC 21
39#define JPEG1_CLK_SRC 22
40#define JPEG2_CLK_SRC 23
41#define EDPPIXEL_CLK_SRC 24
42#define EXTPCLK_CLK_SRC 25
43#define VP_CLK_SRC 26
44#define CCI_CLK_SRC 27
45#define CAMSS_GP0_CLK_SRC 28
46#define CAMSS_GP1_CLK_SRC 29
47#define MCLK0_CLK_SRC 30
48#define MCLK1_CLK_SRC 31
49#define MCLK2_CLK_SRC 32
50#define MCLK3_CLK_SRC 33
51#define CSI0PHYTIMER_CLK_SRC 34
52#define CSI1PHYTIMER_CLK_SRC 35
53#define CSI2PHYTIMER_CLK_SRC 36
54#define CPP_CLK_SRC 37
55#define BYTE0_CLK_SRC 38
56#define BYTE1_CLK_SRC 39
57#define EDPAUX_CLK_SRC 40
58#define EDPLINK_CLK_SRC 41
59#define ESC0_CLK_SRC 42
60#define ESC1_CLK_SRC 43
61#define HDMI_CLK_SRC 44
62#define VSYNC_CLK_SRC 45
63#define RBCPR_CLK_SRC 46
64#define RBBMTIMER_CLK_SRC 47
65#define MAPLE_CLK_SRC 48
66#define VDP_CLK_SRC 49
67#define VPU_BUS_CLK_SRC 50
68#define MMSS_CXO_CLK 51
69#define MMSS_SLEEPCLK_CLK 52
70#define AVSYNC_AHB_CLK 53
71#define AVSYNC_EDPPIXEL_CLK 54
72#define AVSYNC_EXTPCLK_CLK 55
73#define AVSYNC_PCLK0_CLK 56
74#define AVSYNC_PCLK1_CLK 57
75#define AVSYNC_VP_CLK 58
76#define CAMSS_AHB_CLK 59
77#define CAMSS_CCI_CCI_AHB_CLK 60
78#define CAMSS_CCI_CCI_CLK 61
79#define CAMSS_CSI0_AHB_CLK 62
80#define CAMSS_CSI0_CLK 63
81#define CAMSS_CSI0PHY_CLK 64
82#define CAMSS_CSI0PIX_CLK 65
83#define CAMSS_CSI0RDI_CLK 66
84#define CAMSS_CSI1_AHB_CLK 67
85#define CAMSS_CSI1_CLK 68
86#define CAMSS_CSI1PHY_CLK 69
87#define CAMSS_CSI1PIX_CLK 70
88#define CAMSS_CSI1RDI_CLK 71
89#define CAMSS_CSI2_AHB_CLK 72
90#define CAMSS_CSI2_CLK 73
91#define CAMSS_CSI2PHY_CLK 74
92#define CAMSS_CSI2PIX_CLK 75
93#define CAMSS_CSI2RDI_CLK 76
94#define CAMSS_CSI3_AHB_CLK 77
95#define CAMSS_CSI3_CLK 78
96#define CAMSS_CSI3PHY_CLK 79
97#define CAMSS_CSI3PIX_CLK 80
98#define CAMSS_CSI3RDI_CLK 81
99#define CAMSS_CSI_VFE0_CLK 82
100#define CAMSS_CSI_VFE1_CLK 83
101#define CAMSS_GP0_CLK 84
102#define CAMSS_GP1_CLK 85
103#define CAMSS_ISPIF_AHB_CLK 86
104#define CAMSS_JPEG_JPEG0_CLK 87
105#define CAMSS_JPEG_JPEG1_CLK 88
106#define CAMSS_JPEG_JPEG2_CLK 89
107#define CAMSS_JPEG_JPEG_AHB_CLK 90
108#define CAMSS_JPEG_JPEG_AXI_CLK 91
109#define CAMSS_MCLK0_CLK 92
110#define CAMSS_MCLK1_CLK 93
111#define CAMSS_MCLK2_CLK 94
112#define CAMSS_MCLK3_CLK 95
113#define CAMSS_MICRO_AHB_CLK 96
114#define CAMSS_PHY0_CSI0PHYTIMER_CLK 97
115#define CAMSS_PHY1_CSI1PHYTIMER_CLK 98
116#define CAMSS_PHY2_CSI2PHYTIMER_CLK 99
117#define CAMSS_TOP_AHB_CLK 100
118#define CAMSS_VFE_CPP_AHB_CLK 101
119#define CAMSS_VFE_CPP_CLK 102
120#define CAMSS_VFE_VFE0_CLK 103
121#define CAMSS_VFE_VFE1_CLK 104
122#define CAMSS_VFE_VFE_AHB_CLK 105
123#define CAMSS_VFE_VFE_AXI_CLK 106
124#define MDSS_AHB_CLK 107
125#define MDSS_AXI_CLK 108
126#define MDSS_BYTE0_CLK 109
127#define MDSS_BYTE1_CLK 110
128#define MDSS_EDPAUX_CLK 111
129#define MDSS_EDPLINK_CLK 112
130#define MDSS_EDPPIXEL_CLK 113
131#define MDSS_ESC0_CLK 114
132#define MDSS_ESC1_CLK 115
133#define MDSS_EXTPCLK_CLK 116
134#define MDSS_HDMI_AHB_CLK 117
135#define MDSS_HDMI_CLK 118
136#define MDSS_MDP_CLK 119
137#define MDSS_MDP_LUT_CLK 120
138#define MDSS_PCLK0_CLK 121
139#define MDSS_PCLK1_CLK 122
140#define MDSS_VSYNC_CLK 123
141#define MMSS_RBCPR_AHB_CLK 124
142#define MMSS_RBCPR_CLK 125
143#define MMSS_SPDM_AHB_CLK 126
144#define MMSS_SPDM_AXI_CLK 127
145#define MMSS_SPDM_CSI0_CLK 128
146#define MMSS_SPDM_GFX3D_CLK 129
147#define MMSS_SPDM_JPEG0_CLK 130
148#define MMSS_SPDM_JPEG1_CLK 131
149#define MMSS_SPDM_JPEG2_CLK 132
150#define MMSS_SPDM_MDP_CLK 133
151#define MMSS_SPDM_PCLK0_CLK 134
152#define MMSS_SPDM_PCLK1_CLK 135
153#define MMSS_SPDM_VCODEC0_CLK 136
154#define MMSS_SPDM_VFE0_CLK 137
155#define MMSS_SPDM_VFE1_CLK 138
156#define MMSS_SPDM_RM_AXI_CLK 139
157#define MMSS_SPDM_RM_OCMEMNOC_CLK 140
158#define MMSS_MISC_AHB_CLK 141
159#define MMSS_MMSSNOC_AHB_CLK 142
160#define MMSS_MMSSNOC_BTO_AHB_CLK 143
161#define MMSS_MMSSNOC_AXI_CLK 144
162#define MMSS_S0_AXI_CLK 145
163#define OCMEMCX_AHB_CLK 146
164#define OCMEMCX_OCMEMNOC_CLK 147
165#define OXILI_OCMEMGX_CLK 148
166#define OXILI_GFX3D_CLK 149
167#define OXILI_RBBMTIMER_CLK 150
168#define OXILICX_AHB_CLK 151
169#define VENUS0_AHB_CLK 152
170#define VENUS0_AXI_CLK 153
171#define VENUS0_CORE0_VCODEC_CLK 154
172#define VENUS0_CORE1_VCODEC_CLK 155
173#define VENUS0_OCMEMNOC_CLK 156
174#define VENUS0_VCODEC0_CLK 157
175#define VPU_AHB_CLK 158
176#define VPU_AXI_CLK 159
177#define VPU_BUS_CLK 160
178#define VPU_CXO_CLK 161
179#define VPU_MAPLE_CLK 162
180#define VPU_SLEEP_CLK 163
181#define VPU_VDP_CLK 164
182
183#endif
diff --git a/include/dt-bindings/clock/qcom,mmcc-msm8960.h b/include/dt-bindings/clock/qcom,mmcc-msm8960.h
index 5868ef14a777..85041b28f97f 100644
--- a/include/dt-bindings/clock/qcom,mmcc-msm8960.h
+++ b/include/dt-bindings/clock/qcom,mmcc-msm8960.h
@@ -133,5 +133,13 @@
133#define CSIPHY0_TIMER_CLK 116 133#define CSIPHY0_TIMER_CLK 116
134#define PLL1 117 134#define PLL1 117
135#define PLL2 118 135#define PLL2 118
136#define RGB_TV_CLK 119
137#define NPL_TV_CLK 120
138#define VCAP_AHB_CLK 121
139#define VCAP_AXI_CLK 122
140#define VCAP_SRC 123
141#define VCAP_CLK 124
142#define VCAP_NPL_CLK 125
143#define PLL15 126
136 144
137#endif 145#endif
diff --git a/include/dt-bindings/clock/rk3066a-cru.h b/include/dt-bindings/clock/rk3066a-cru.h
new file mode 100644
index 000000000000..bc1ed1dbd855
--- /dev/null
+++ b/include/dt-bindings/clock/rk3066a-cru.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
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
16#include <dt-bindings/clock/rk3188-cru-common.h>
17
18/* soft-reset indices */
19#define SRST_SRST1 0
20#define SRST_SRST2 1
21
22#define SRST_L2MEM 18
23#define SRST_I2S0 23
24#define SRST_I2S1 24
25#define SRST_I2S2 25
26#define SRST_TIMER2 29
27
28#define SRST_GPIO4 36
29#define SRST_GPIO6 38
30
31#define SRST_TSADC 92
32
33#define SRST_HDMI 96
34#define SRST_HDMI_APB 97
35#define SRST_CIF1 111
diff --git a/include/dt-bindings/clock/rk3188-cru-common.h b/include/dt-bindings/clock/rk3188-cru-common.h
new file mode 100644
index 000000000000..750ee60e75fb
--- /dev/null
+++ b/include/dt-bindings/clock/rk3188-cru-common.h
@@ -0,0 +1,249 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
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
16/* core clocks from */
17#define PLL_APLL 1
18#define PLL_DPLL 2
19#define PLL_CPLL 3
20#define PLL_GPLL 4
21#define CORE_PERI 5
22#define CORE_L2C 6
23
24/* sclk gates (special clocks) */
25#define SCLK_UART0 64
26#define SCLK_UART1 65
27#define SCLK_UART2 66
28#define SCLK_UART3 67
29#define SCLK_MAC 68
30#define SCLK_SPI0 69
31#define SCLK_SPI1 70
32#define SCLK_SARADC 71
33#define SCLK_SDMMC 72
34#define SCLK_SDIO 73
35#define SCLK_EMMC 74
36#define SCLK_I2S0 75
37#define SCLK_I2S1 76
38#define SCLK_I2S2 77
39#define SCLK_SPDIF 78
40#define SCLK_CIF0 79
41#define SCLK_CIF1 80
42#define SCLK_OTGPHY0 81
43#define SCLK_OTGPHY1 82
44#define SCLK_HSADC 83
45#define SCLK_TIMER0 84
46#define SCLK_TIMER1 85
47#define SCLK_TIMER2 86
48#define SCLK_TIMER3 87
49#define SCLK_TIMER4 88
50#define SCLK_TIMER5 89
51#define SCLK_TIMER6 90
52#define SCLK_JTAG 91
53#define SCLK_SMC 92
54
55#define DCLK_LCDC0 190
56#define DCLK_LCDC1 191
57
58/* aclk gates */
59#define ACLK_DMA1 192
60#define ACLK_DMA2 193
61#define ACLK_GPS 194
62#define ACLK_LCDC0 195
63#define ACLK_LCDC1 196
64#define ACLK_GPU 197
65#define ACLK_SMC 198
66#define ACLK_CIF 199
67#define ACLK_IPP 200
68#define ACLK_RGA 201
69#define ACLK_CIF0 202
70
71/* pclk gates */
72#define PCLK_GRF 320
73#define PCLK_PMU 321
74#define PCLK_TIMER0 322
75#define PCLK_TIMER1 323
76#define PCLK_TIMER2 324
77#define PCLK_TIMER3 325
78#define PCLK_PWM01 326
79#define PCLK_PWM23 327
80#define PCLK_SPI0 328
81#define PCLK_SPI1 329
82#define PCLK_SARADC 330
83#define PCLK_WDT 331
84#define PCLK_UART0 332
85#define PCLK_UART1 333
86#define PCLK_UART2 334
87#define PCLK_UART3 335
88#define PCLK_I2C0 336
89#define PCLK_I2C1 337
90#define PCLK_I2C2 338
91#define PCLK_I2C3 339
92#define PCLK_I2C4 340
93#define PCLK_GPIO0 341
94#define PCLK_GPIO1 342
95#define PCLK_GPIO2 343
96#define PCLK_GPIO3 344
97#define PCLK_GPIO4 345
98#define PCLK_GPIO6 346
99#define PCLK_EFUSE 347
100#define PCLK_TZPC 348
101#define PCLK_TSADC 349
102
103/* hclk gates */
104#define HCLK_SDMMC 448
105#define HCLK_SDIO 449
106#define HCLK_EMMC 450
107#define HCLK_OTG0 451
108#define HCLK_EMAC 452
109#define HCLK_SPDIF 453
110#define HCLK_I2S0 454
111#define HCLK_I2S1 455
112#define HCLK_I2S2 456
113#define HCLK_OTG1 457
114#define HCLK_HSIC 458
115#define HCLK_HSADC 459
116#define HCLK_PIDF 460
117#define HCLK_LCDC0 461
118#define HCLK_LCDC1 462
119#define HCLK_ROM 463
120#define HCLK_CIF0 464
121#define HCLK_IPP 465
122#define HCLK_RGA 466
123#define HCLK_NANDC0 467
124
125#define CLK_NR_CLKS (HCLK_NANDC0 + 1)
126
127/* soft-reset indices */
128#define SRST_MCORE 2
129#define SRST_CORE0 3
130#define SRST_CORE1 4
131#define SRST_MCORE_DBG 7
132#define SRST_CORE0_DBG 8
133#define SRST_CORE1_DBG 9
134#define SRST_CORE0_WDT 12
135#define SRST_CORE1_WDT 13
136#define SRST_STRC_SYS 14
137#define SRST_L2C 15
138
139#define SRST_CPU_AHB 17
140#define SRST_AHB2APB 19
141#define SRST_DMA1 20
142#define SRST_INTMEM 21
143#define SRST_ROM 22
144#define SRST_SPDIF 26
145#define SRST_TIMER0 27
146#define SRST_TIMER1 28
147#define SRST_EFUSE 30
148
149#define SRST_GPIO0 32
150#define SRST_GPIO1 33
151#define SRST_GPIO2 34
152#define SRST_GPIO3 35
153
154#define SRST_UART0 39
155#define SRST_UART1 40
156#define SRST_UART2 41
157#define SRST_UART3 42
158#define SRST_I2C0 43
159#define SRST_I2C1 44
160#define SRST_I2C2 45
161#define SRST_I2C3 46
162#define SRST_I2C4 47
163
164#define SRST_PWM0 48
165#define SRST_PWM1 49
166#define SRST_DAP_PO 50
167#define SRST_DAP 51
168#define SRST_DAP_SYS 52
169#define SRST_TPIU_ATB 53
170#define SRST_PMU_APB 54
171#define SRST_GRF 55
172#define SRST_PMU 56
173#define SRST_PERI_AXI 57
174#define SRST_PERI_AHB 58
175#define SRST_PERI_APB 59
176#define SRST_PERI_NIU 60
177#define SRST_CPU_PERI 61
178#define SRST_EMEM_PERI 62
179#define SRST_USB_PERI 63
180
181#define SRST_DMA2 64
182#define SRST_SMC 65
183#define SRST_MAC 66
184#define SRST_NANC0 68
185#define SRST_USBOTG0 69
186#define SRST_USBPHY0 70
187#define SRST_OTGC0 71
188#define SRST_USBOTG1 72
189#define SRST_USBPHY1 73
190#define SRST_OTGC1 74
191#define SRST_HSADC 76
192#define SRST_PIDFILTER 77
193#define SRST_DDR_MSCH 79
194
195#define SRST_TZPC 80
196#define SRST_SDMMC 81
197#define SRST_SDIO 82
198#define SRST_EMMC 83
199#define SRST_SPI0 84
200#define SRST_SPI1 85
201#define SRST_WDT 86
202#define SRST_SARADC 87
203#define SRST_DDRPHY 88
204#define SRST_DDRPHY_APB 89
205#define SRST_DDRCTL 90
206#define SRST_DDRCTL_APB 91
207#define SRST_DDRPUB 93
208
209#define SRST_VIO0_AXI 98
210#define SRST_VIO0_AHB 99
211#define SRST_LCDC0_AXI 100
212#define SRST_LCDC0_AHB 101
213#define SRST_LCDC0_DCLK 102
214#define SRST_LCDC1_AXI 103
215#define SRST_LCDC1_AHB 104
216#define SRST_LCDC1_DCLK 105
217#define SRST_IPP_AXI 106
218#define SRST_IPP_AHB 107
219#define SRST_RGA_AXI 108
220#define SRST_RGA_AHB 109
221#define SRST_CIF0 110
222
223#define SRST_VCODEC_AXI 112
224#define SRST_VCODEC_AHB 113
225#define SRST_VIO1_AXI 114
226#define SRST_VCODEC_CPU 115
227#define SRST_VCODEC_NIU 116
228#define SRST_GPU 120
229#define SRST_GPU_NIU 122
230#define SRST_TFUN_ATB 125
231#define SRST_TFUN_APB 126
232#define SRST_CTI4_APB 127
233
234#define SRST_TPIU_APB 128
235#define SRST_TRACE 129
236#define SRST_CORE_DBG 130
237#define SRST_DBG_APB 131
238#define SRST_CTI0 132
239#define SRST_CTI0_APB 133
240#define SRST_CTI1 134
241#define SRST_CTI1_APB 135
242#define SRST_PTM_CORE0 136
243#define SRST_PTM_CORE1 137
244#define SRST_PTM0 138
245#define SRST_PTM0_ATB 139
246#define SRST_PTM1 140
247#define SRST_PTM1_ATB 141
248#define SRST_CTM 142
249#define SRST_TS 143
diff --git a/include/dt-bindings/clock/rk3188-cru.h b/include/dt-bindings/clock/rk3188-cru.h
new file mode 100644
index 000000000000..9fac8edd3f9d
--- /dev/null
+++ b/include/dt-bindings/clock/rk3188-cru.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
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
16#include <dt-bindings/clock/rk3188-cru-common.h>
17
18/* soft-reset indices */
19#define SRST_PTM_CORE2 0
20#define SRST_PTM_CORE3 1
21#define SRST_CORE2 5
22#define SRST_CORE3 6
23#define SRST_CORE2_DBG 10
24#define SRST_CORE3_DBG 11
25
26#define SRST_TIMER2 16
27#define SRST_TIMER4 23
28#define SRST_I2S0 24
29#define SRST_TIMER5 25
30#define SRST_TIMER3 29
31#define SRST_TIMER6 31
32
33#define SRST_PTM3 36
34#define SRST_PTM3_ATB 37
35
36#define SRST_GPS 67
37#define SRST_HSICPHY 75
38#define SRST_TIMER 78
39
40#define SRST_PTM2 92
41#define SRST_CORE2_WDT 94
42#define SRST_CORE3_WDT 95
43
44#define SRST_PTM2_ATB 111
45
46#define SRST_HSIC 117
47#define SRST_CTI2 118
48#define SRST_CTI2_APB 119
49#define SRST_GPU_BRIDGE 121
50#define SRST_CTI3 123
51#define SRST_CTI3_APB 124
diff --git a/include/dt-bindings/clock/rk3288-cru.h b/include/dt-bindings/clock/rk3288-cru.h
new file mode 100644
index 000000000000..ebcb460ea4ad
--- /dev/null
+++ b/include/dt-bindings/clock/rk3288-cru.h
@@ -0,0 +1,278 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
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
16/* core clocks */
17#define PLL_APLL 1
18#define PLL_DPLL 2
19#define PLL_CPLL 3
20#define PLL_GPLL 4
21#define PLL_NPLL 5
22
23/* sclk gates (special clocks) */
24#define SCLK_GPU 64
25#define SCLK_SPI0 65
26#define SCLK_SPI1 66
27#define SCLK_SPI2 67
28#define SCLK_SDMMC 68
29#define SCLK_SDIO0 69
30#define SCLK_SDIO1 70
31#define SCLK_EMMC 71
32#define SCLK_TSADC 72
33#define SCLK_SARADC 73
34#define SCLK_PS2C 74
35#define SCLK_NANDC0 75
36#define SCLK_NANDC1 76
37#define SCLK_UART0 77
38#define SCLK_UART1 78
39#define SCLK_UART2 79
40#define SCLK_UART3 80
41#define SCLK_UART4 81
42#define SCLK_I2S0 82
43#define SCLK_SPDIF 83
44#define SCLK_SPDIF8CH 84
45#define SCLK_TIMER0 85
46#define SCLK_TIMER1 86
47#define SCLK_TIMER2 87
48#define SCLK_TIMER3 88
49#define SCLK_TIMER4 89
50#define SCLK_TIMER5 90
51#define SCLK_TIMER6 91
52#define SCLK_HSADC 92
53#define SCLK_OTGPHY0 93
54#define SCLK_OTGPHY1 94
55#define SCLK_OTGPHY2 95
56#define SCLK_OTG_ADP 96
57#define SCLK_HSICPHY480M 97
58#define SCLK_HSICPHY12M 98
59#define SCLK_MACREF 99
60#define SCLK_LCDC_PWM0 100
61#define SCLK_LCDC_PWM1 101
62#define SCLK_MAC_RX 102
63#define SCLK_MAC_TX 103
64
65#define DCLK_VOP0 190
66#define DCLK_VOP1 191
67
68/* aclk gates */
69#define ACLK_GPU 192
70#define ACLK_DMAC1 193
71#define ACLK_DMAC2 194
72#define ACLK_MMU 195
73#define ACLK_GMAC 196
74#define ACLK_VOP0 197
75#define ACLK_VOP1 198
76#define ACLK_CRYPTO 199
77#define ACLK_RGA 200
78
79/* pclk gates */
80#define PCLK_GPIO0 320
81#define PCLK_GPIO1 321
82#define PCLK_GPIO2 322
83#define PCLK_GPIO3 323
84#define PCLK_GPIO4 324
85#define PCLK_GPIO5 325
86#define PCLK_GPIO6 326
87#define PCLK_GPIO7 327
88#define PCLK_GPIO8 328
89#define PCLK_GRF 329
90#define PCLK_SGRF 330
91#define PCLK_PMU 331
92#define PCLK_I2C0 332
93#define PCLK_I2C1 333
94#define PCLK_I2C2 334
95#define PCLK_I2C3 335
96#define PCLK_I2C4 336
97#define PCLK_I2C5 337
98#define PCLK_SPI0 338
99#define PCLK_SPI1 339
100#define PCLK_SPI2 340
101#define PCLK_UART0 341
102#define PCLK_UART1 342
103#define PCLK_UART2 343
104#define PCLK_UART3 344
105#define PCLK_UART4 345
106#define PCLK_TSADC 346
107#define PCLK_SARADC 347
108#define PCLK_SIM 348
109#define PCLK_GMAC 349
110#define PCLK_PWM 350
111#define PCLK_RKPWM 351
112#define PCLK_PS2C 352
113#define PCLK_TIMER 353
114#define PCLK_TZPC 354
115
116/* hclk gates */
117#define HCLK_GPS 448
118#define HCLK_OTG0 449
119#define HCLK_USBHOST0 450
120#define HCLK_USBHOST1 451
121#define HCLK_HSIC 452
122#define HCLK_NANDC0 453
123#define HCLK_NANDC1 454
124#define HCLK_TSP 455
125#define HCLK_SDMMC 456
126#define HCLK_SDIO0 457
127#define HCLK_SDIO1 458
128#define HCLK_EMMC 459
129#define HCLK_HSADC 460
130#define HCLK_CRYPTO 461
131#define HCLK_I2S0 462
132#define HCLK_SPDIF 463
133#define HCLK_SPDIF8CH 464
134#define HCLK_VOP0 465
135#define HCLK_VOP1 466
136#define HCLK_ROM 467
137#define HCLK_IEP 468
138#define HCLK_ISP 469
139#define HCLK_RGA 470
140
141#define CLK_NR_CLKS (HCLK_RGA + 1)
142
143/* soft-reset indices */
144#define SRST_CORE0 0
145#define SRST_CORE1 1
146#define SRST_CORE2 2
147#define SRST_CORE3 3
148#define SRST_CORE0_PO 4
149#define SRST_CORE1_PO 5
150#define SRST_CORE2_PO 6
151#define SRST_CORE3_PO 7
152#define SRST_PDCORE_STRSYS 8
153#define SRST_PDBUS_STRSYS 9
154#define SRST_L2C 10
155#define SRST_TOPDBG 11
156#define SRST_CORE0_DBG 12
157#define SRST_CORE1_DBG 13
158#define SRST_CORE2_DBG 14
159#define SRST_CORE3_DBG 15
160
161#define SRST_PDBUG_AHB_ARBITOR 16
162#define SRST_EFUSE256 17
163#define SRST_DMAC1 18
164#define SRST_INTMEM 19
165#define SRST_ROM 20
166#define SRST_SPDIF8CH 21
167#define SRST_TIMER 22
168#define SRST_I2S0 23
169#define SRST_SPDIF 24
170#define SRST_TIMER0 25
171#define SRST_TIMER1 26
172#define SRST_TIMER2 27
173#define SRST_TIMER3 28
174#define SRST_TIMER4 29
175#define SRST_TIMER5 30
176#define SRST_EFUSE 31
177
178#define SRST_GPIO0 32
179#define SRST_GPIO1 33
180#define SRST_GPIO2 34
181#define SRST_GPIO3 35
182#define SRST_GPIO4 36
183#define SRST_GPIO5 37
184#define SRST_GPIO6 38
185#define SRST_GPIO7 39
186#define SRST_GPIO8 40
187#define SRST_I2C0 42
188#define SRST_I2C1 43
189#define SRST_I2C2 44
190#define SRST_I2C3 45
191#define SRST_I2C4 46
192#define SRST_I2C5 47
193
194#define SRST_DWPWM 48
195#define SRST_MMC_PERI 49
196#define SRST_PERIPH_MMU 50
197#define SRST_DAP 51
198#define SRST_DAP_SYS 52
199#define SRST_TPIU 53
200#define SRST_PMU_APB 54
201#define SRST_GRF 55
202#define SRST_PMU 56
203#define SRST_PERIPH_AXI 57
204#define SRST_PERIPH_AHB 58
205#define SRST_PERIPH_APB 59
206#define SRST_PERIPH_NIU 60
207#define SRST_PDPERI_AHB_ARBI 61
208#define SRST_EMEM 62
209#define SRST_USB_PERI 63
210
211#define SRST_DMAC2 64
212#define SRST_MAC 66
213#define SRST_GPS 67
214#define SRST_RKPWM 69
215#define SRST_CCP 71
216#define SRST_USBHOST0 72
217#define SRST_HSIC 73
218#define SRST_HSIC_AUX 74
219#define SRST_HSIC_PHY 75
220#define SRST_HSADC 76
221#define SRST_NANDC0 77
222#define SRST_NANDC1 78
223
224#define SRST_TZPC 80
225#define SRST_SPI0 83
226#define SRST_SPI1 84
227#define SRST_SPI2 85
228#define SRST_SARADC 87
229#define SRST_PDALIVE_NIU 88
230#define SRST_PDPMU_INTMEM 89
231#define SRST_PDPMU_NIU 90
232#define SRST_SGRF 91
233
234#define SRST_VIO_ARBI 96
235#define SRST_RGA_NIU 97
236#define SRST_VIO0_NIU_AXI 98
237#define SRST_VIO_NIU_AHB 99
238#define SRST_LCDC0_AXI 100
239#define SRST_LCDC0_AHB 101
240#define SRST_LCDC0_DCLK 102
241#define SRST_VIO1_NIU_AXI 103
242#define SRST_VIP 104
243#define SRST_RGA_CORE 105
244#define SRST_IEP_AXI 106
245#define SRST_IEP_AHB 107
246#define SRST_RGA_AXI 108
247#define SRST_RGA_AHB 109
248#define SRST_ISP 110
249#define SRST_EDP 111
250
251#define SRST_VCODEC_AXI 112
252#define SRST_VCODEC_AHB 113
253#define SRST_VIO_H2P 114
254#define SRST_MIPIDSI0 115
255#define SRST_MIPIDSI1 116
256#define SRST_MIPICSI 117
257#define SRST_LVDS_PHY 118
258#define SRST_LVDS_CON 119
259#define SRST_GPU 120
260#define SRST_HDMI 121
261#define SRST_CORE_PVTM 124
262#define SRST_GPU_PVTM 125
263
264#define SRST_MMC0 128
265#define SRST_SDIO0 129
266#define SRST_SDIO1 130
267#define SRST_EMMC 131
268#define SRST_USBOTG_AHB 132
269#define SRST_USBOTG_PHY 133
270#define SRST_USBOTG_CON 134
271#define SRST_USBHOST0_AHB 135
272#define SRST_USBHOST0_PHY 136
273#define SRST_USBHOST0_CON 137
274#define SRST_USBHOST1_AHB 138
275#define SRST_USBHOST1_PHY 139
276#define SRST_USBHOST1_CON 140
277#define SRST_USB_ADP 141
278#define SRST_ACC_EFUSE 142
diff --git a/include/dt-bindings/clock/stih415-clks.h b/include/dt-bindings/clock/stih415-clks.h
index 0d2c7397e028..d80caa68aebd 100644
--- a/include/dt-bindings/clock/stih415-clks.h
+++ b/include/dt-bindings/clock/stih415-clks.h
@@ -10,6 +10,7 @@
10#define CLK_ETH1_PHY 4 10#define CLK_ETH1_PHY 4
11 11
12/* CLOCKGEN A1 */ 12/* CLOCKGEN A1 */
13#define CLK_ICN_IF_2 0
13#define CLK_GMAC0_PHY 3 14#define CLK_GMAC0_PHY 3
14 15
15#endif 16#endif
diff --git a/include/dt-bindings/clock/stih416-clks.h b/include/dt-bindings/clock/stih416-clks.h
index 552c779eb6af..f9bdbd13568d 100644
--- a/include/dt-bindings/clock/stih416-clks.h
+++ b/include/dt-bindings/clock/stih416-clks.h
@@ -10,6 +10,7 @@
10#define CLK_ETH1_PHY 4 10#define CLK_ETH1_PHY 4
11 11
12/* CLOCKGEN A1 */ 12/* CLOCKGEN A1 */
13#define CLK_ICN_IF_2 0
13#define CLK_GMAC0_PHY 3 14#define CLK_GMAC0_PHY 3
14 15
15#endif 16#endif
diff --git a/include/dt-bindings/mfd/palmas.h b/include/dt-bindings/mfd/palmas.h
new file mode 100644
index 000000000000..2c8ac4841385
--- /dev/null
+++ b/include/dt-bindings/mfd/palmas.h
@@ -0,0 +1,18 @@
1/*
2 * This header provides macros for Palmas device bindings.
3 *
4 * Copyright (c) 2013, NVIDIA Corporation.
5 *
6 * Author: Laxman Dewangan <ldewangan@nvidia.com>
7 *
8 */
9
10#ifndef __DT_BINDINGS_PALMAS_H__
11#define __DT_BINDINGS_PALMAS_H
12
13/* External control pins */
14#define PALMAS_EXT_CONTROL_PIN_ENABLE1 1
15#define PALMAS_EXT_CONTROL_PIN_ENABLE2 2
16#define PALMAS_EXT_CONTROL_PIN_NSLEEP 3
17
18#endif /* __DT_BINDINGS_PALMAS_H */
diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h
index 002a2855c046..3d33794e4f3e 100644
--- a/include/dt-bindings/pinctrl/dra.h
+++ b/include/dt-bindings/pinctrl/dra.h
@@ -30,7 +30,8 @@
30#define MUX_MODE14 0xe 30#define MUX_MODE14 0xe
31#define MUX_MODE15 0xf 31#define MUX_MODE15 0xf
32 32
33#define PULL_ENA (1 << 16) 33#define PULL_ENA (0 << 16)
34#define PULL_DIS (1 << 16)
34#define PULL_UP (1 << 17) 35#define PULL_UP (1 << 17)
35#define INPUT_EN (1 << 18) 36#define INPUT_EN (1 << 18)
36#define SLEWCONTROL (1 << 19) 37#define SLEWCONTROL (1 << 19)
@@ -38,10 +39,10 @@
38#define WAKEUP_EVENT (1 << 25) 39#define WAKEUP_EVENT (1 << 25)
39 40
40/* Active pin states */ 41/* Active pin states */
41#define PIN_OUTPUT 0 42#define PIN_OUTPUT (0 | PULL_DIS)
42#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP) 43#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)
43#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) 44#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA)
44#define PIN_INPUT INPUT_EN 45#define PIN_INPUT (INPUT_EN | PULL_DIS)
45#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL) 46#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)
46#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP) 47#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
47#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN) 48#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN)
diff --git a/include/dt-bindings/reset/qcom,gcc-apq8084.h b/include/dt-bindings/reset/qcom,gcc-apq8084.h
new file mode 100644
index 000000000000..527caaf48e3d
--- /dev/null
+++ b/include/dt-bindings/reset/qcom,gcc-apq8084.h
@@ -0,0 +1,109 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
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#ifndef _DT_BINDINGS_RESET_APQ_GCC_8084_H
15#define _DT_BINDINGS_RESET_APQ_GCC_8084_H
16
17#define GCC_SYSTEM_NOC_BCR 0
18#define GCC_CONFIG_NOC_BCR 1
19#define GCC_PERIPH_NOC_BCR 2
20#define GCC_IMEM_BCR 3
21#define GCC_MMSS_BCR 4
22#define GCC_QDSS_BCR 5
23#define GCC_USB_30_BCR 6
24#define GCC_USB3_PHY_BCR 7
25#define GCC_USB_HS_HSIC_BCR 8
26#define GCC_USB_HS_BCR 9
27#define GCC_USB2A_PHY_BCR 10
28#define GCC_USB2B_PHY_BCR 11
29#define GCC_SDCC1_BCR 12
30#define GCC_SDCC2_BCR 13
31#define GCC_SDCC3_BCR 14
32#define GCC_SDCC4_BCR 15
33#define GCC_BLSP1_BCR 16
34#define GCC_BLSP1_QUP1_BCR 17
35#define GCC_BLSP1_UART1_BCR 18
36#define GCC_BLSP1_QUP2_BCR 19
37#define GCC_BLSP1_UART2_BCR 20
38#define GCC_BLSP1_QUP3_BCR 21
39#define GCC_BLSP1_UART3_BCR 22
40#define GCC_BLSP1_QUP4_BCR 23
41#define GCC_BLSP1_UART4_BCR 24
42#define GCC_BLSP1_QUP5_BCR 25
43#define GCC_BLSP1_UART5_BCR 26
44#define GCC_BLSP1_QUP6_BCR 27
45#define GCC_BLSP1_UART6_BCR 28
46#define GCC_BLSP2_BCR 29
47#define GCC_BLSP2_QUP1_BCR 30
48#define GCC_BLSP2_UART1_BCR 31
49#define GCC_BLSP2_QUP2_BCR 32
50#define GCC_BLSP2_UART2_BCR 33
51#define GCC_BLSP2_QUP3_BCR 34
52#define GCC_BLSP2_UART3_BCR 35
53#define GCC_BLSP2_QUP4_BCR 36
54#define GCC_BLSP2_UART4_BCR 37
55#define GCC_BLSP2_QUP5_BCR 38
56#define GCC_BLSP2_UART5_BCR 39
57#define GCC_BLSP2_QUP6_BCR 40
58#define GCC_BLSP2_UART6_BCR 41
59#define GCC_PDM_BCR 42
60#define GCC_PRNG_BCR 43
61#define GCC_BAM_DMA_BCR 44
62#define GCC_TSIF_BCR 45
63#define GCC_TCSR_BCR 46
64#define GCC_BOOT_ROM_BCR 47
65#define GCC_MSG_RAM_BCR 48
66#define GCC_TLMM_BCR 49
67#define GCC_MPM_BCR 50
68#define GCC_MPM_AHB_RESET 51
69#define GCC_MPM_NON_AHB_RESET 52
70#define GCC_SEC_CTRL_BCR 53
71#define GCC_SPMI_BCR 54
72#define GCC_SPDM_BCR 55
73#define GCC_CE1_BCR 56
74#define GCC_CE2_BCR 57
75#define GCC_BIMC_BCR 58
76#define GCC_SNOC_BUS_TIMEOUT0_BCR 59
77#define GCC_SNOC_BUS_TIMEOUT2_BCR 60
78#define GCC_PNOC_BUS_TIMEOUT0_BCR 61
79#define GCC_PNOC_BUS_TIMEOUT1_BCR 62
80#define GCC_PNOC_BUS_TIMEOUT2_BCR 63
81#define GCC_PNOC_BUS_TIMEOUT3_BCR 64
82#define GCC_PNOC_BUS_TIMEOUT4_BCR 65
83#define GCC_CNOC_BUS_TIMEOUT0_BCR 66
84#define GCC_CNOC_BUS_TIMEOUT1_BCR 67
85#define GCC_CNOC_BUS_TIMEOUT2_BCR 68
86#define GCC_CNOC_BUS_TIMEOUT3_BCR 69
87#define GCC_CNOC_BUS_TIMEOUT4_BCR 70
88#define GCC_CNOC_BUS_TIMEOUT5_BCR 71
89#define GCC_CNOC_BUS_TIMEOUT6_BCR 72
90#define GCC_DEHR_BCR 73
91#define GCC_RBCPR_BCR 74
92#define GCC_MSS_RESTART 75
93#define GCC_LPASS_RESTART 76
94#define GCC_WCSS_RESTART 77
95#define GCC_VENUS_RESTART 78
96#define GCC_COPSS_SMMU_BCR 79
97#define GCC_SPSS_BCR 80
98#define GCC_PCIE_0_BCR 81
99#define GCC_PCIE_0_PHY_BCR 82
100#define GCC_PCIE_1_BCR 83
101#define GCC_PCIE_1_PHY_BCR 84
102#define GCC_USB_30_SEC_BCR 85
103#define GCC_USB3_SEC_PHY_BCR 86
104#define GCC_SATA_BCR 87
105#define GCC_CE3_BCR 88
106#define GCC_UFS_BCR 89
107#define GCC_USB30_PHY_COM_BCR 90
108
109#endif
diff --git a/include/dt-bindings/reset/qcom,gcc-ipq806x.h b/include/dt-bindings/reset/qcom,gcc-ipq806x.h
new file mode 100644
index 000000000000..0ad5ef930b5d
--- /dev/null
+++ b/include/dt-bindings/reset/qcom,gcc-ipq806x.h
@@ -0,0 +1,132 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
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#ifndef _DT_BINDINGS_RESET_IPQ_806X_H
15#define _DT_BINDINGS_RESET_IPQ_806X_H
16
17#define QDSS_STM_RESET 0
18#define AFAB_SMPSS_S_RESET 1
19#define AFAB_SMPSS_M1_RESET 2
20#define AFAB_SMPSS_M0_RESET 3
21#define AFAB_EBI1_CH0_RESET 4
22#define AFAB_EBI1_CH1_RESET 5
23#define SFAB_ADM0_M0_RESET 6
24#define SFAB_ADM0_M1_RESET 7
25#define SFAB_ADM0_M2_RESET 8
26#define ADM0_C2_RESET 9
27#define ADM0_C1_RESET 10
28#define ADM0_C0_RESET 11
29#define ADM0_PBUS_RESET 12
30#define ADM0_RESET 13
31#define QDSS_CLKS_SW_RESET 14
32#define QDSS_POR_RESET 15
33#define QDSS_TSCTR_RESET 16
34#define QDSS_HRESET_RESET 17
35#define QDSS_AXI_RESET 18
36#define QDSS_DBG_RESET 19
37#define SFAB_PCIE_M_RESET 20
38#define SFAB_PCIE_S_RESET 21
39#define PCIE_EXT_RESET 22
40#define PCIE_PHY_RESET 23
41#define PCIE_PCI_RESET 24
42#define PCIE_POR_RESET 25
43#define PCIE_HCLK_RESET 26
44#define PCIE_ACLK_RESET 27
45#define SFAB_LPASS_RESET 28
46#define SFAB_AFAB_M_RESET 29
47#define AFAB_SFAB_M0_RESET 30
48#define AFAB_SFAB_M1_RESET 31
49#define SFAB_SATA_S_RESET 32
50#define SFAB_DFAB_M_RESET 33
51#define DFAB_SFAB_M_RESET 34
52#define DFAB_SWAY0_RESET 35
53#define DFAB_SWAY1_RESET 36
54#define DFAB_ARB0_RESET 37
55#define DFAB_ARB1_RESET 38
56#define PPSS_PROC_RESET 39
57#define PPSS_RESET 40
58#define DMA_BAM_RESET 41
59#define SPS_TIC_H_RESET 42
60#define SFAB_CFPB_M_RESET 43
61#define SFAB_CFPB_S_RESET 44
62#define TSIF_H_RESET 45
63#define CE1_H_RESET 46
64#define CE1_CORE_RESET 47
65#define CE1_SLEEP_RESET 48
66#define CE2_H_RESET 49
67#define CE2_CORE_RESET 50
68#define SFAB_SFPB_M_RESET 51
69#define SFAB_SFPB_S_RESET 52
70#define RPM_PROC_RESET 53
71#define PMIC_SSBI2_RESET 54
72#define SDC1_RESET 55
73#define SDC2_RESET 56
74#define SDC3_RESET 57
75#define SDC4_RESET 58
76#define USB_HS1_RESET 59
77#define USB_HSIC_RESET 60
78#define USB_FS1_XCVR_RESET 61
79#define USB_FS1_RESET 62
80#define GSBI1_RESET 63
81#define GSBI2_RESET 64
82#define GSBI3_RESET 65
83#define GSBI4_RESET 66
84#define GSBI5_RESET 67
85#define GSBI6_RESET 68
86#define GSBI7_RESET 69
87#define SPDM_RESET 70
88#define SEC_CTRL_RESET 71
89#define TLMM_H_RESET 72
90#define SFAB_SATA_M_RESET 73
91#define SATA_RESET 74
92#define TSSC_RESET 75
93#define PDM_RESET 76
94#define MPM_H_RESET 77
95#define MPM_RESET 78
96#define SFAB_SMPSS_S_RESET 79
97#define PRNG_RESET 80
98#define SFAB_CE3_M_RESET 81
99#define SFAB_CE3_S_RESET 82
100#define CE3_SLEEP_RESET 83
101#define PCIE_1_M_RESET 84
102#define PCIE_1_S_RESET 85
103#define PCIE_1_EXT_RESET 86
104#define PCIE_1_PHY_RESET 87
105#define PCIE_1_PCI_RESET 88
106#define PCIE_1_POR_RESET 89
107#define PCIE_1_HCLK_RESET 90
108#define PCIE_1_ACLK_RESET 91
109#define PCIE_2_M_RESET 92
110#define PCIE_2_S_RESET 93
111#define PCIE_2_EXT_RESET 94
112#define PCIE_2_PHY_RESET 95
113#define PCIE_2_PCI_RESET 96
114#define PCIE_2_POR_RESET 97
115#define PCIE_2_HCLK_RESET 98
116#define PCIE_2_ACLK_RESET 99
117#define SFAB_USB30_S_RESET 100
118#define SFAB_USB30_M_RESET 101
119#define USB30_0_PORT2_HS_PHY_RESET 102
120#define USB30_0_MASTER_RESET 103
121#define USB30_0_SLEEP_RESET 104
122#define USB30_0_UTMI_PHY_RESET 105
123#define USB30_0_POWERON_RESET 106
124#define USB30_0_PHY_RESET 107
125#define USB30_1_MASTER_RESET 108
126#define USB30_1_SLEEP_RESET 109
127#define USB30_1_UTMI_PHY_RESET 110
128#define USB30_1_POWERON_RESET 111
129#define USB30_1_PHY_RESET 112
130#define NSSFB0_RESET 113
131#define NSSFB1_RESET 114
132#endif
diff --git a/include/dt-bindings/reset/qcom,gcc-msm8960.h b/include/dt-bindings/reset/qcom,gcc-msm8960.h
index 07edd0e65eed..47c8686955da 100644
--- a/include/dt-bindings/reset/qcom,gcc-msm8960.h
+++ b/include/dt-bindings/reset/qcom,gcc-msm8960.h
@@ -114,5 +114,21 @@
114#define SFAB_SMPSS_S_RESET 97 114#define SFAB_SMPSS_S_RESET 97
115#define PRNG_RESET 98 115#define PRNG_RESET 98
116#define RIVA_RESET 99 116#define RIVA_RESET 99
117#define USB_HS3_RESET 100
118#define USB_HS4_RESET 101
119#define CE3_RESET 102
120#define PCIE_EXT_PCI_RESET 103
121#define PCIE_PHY_RESET 104
122#define PCIE_PCI_RESET 105
123#define PCIE_POR_RESET 106
124#define PCIE_HCLK_RESET 107
125#define PCIE_ACLK_RESET 108
126#define CE3_H_RESET 109
127#define SFAB_CE3_M_RESET 110
128#define SFAB_CE3_S_RESET 111
129#define SATA_RESET 112
130#define CE3_SLEEP_RESET 113
131#define GSS_SLP_RESET 114
132#define GSS_RESET 115
117 133
118#endif 134#endif
diff --git a/include/dt-bindings/reset/qcom,mmcc-apq8084.h b/include/dt-bindings/reset/qcom,mmcc-apq8084.h
new file mode 100644
index 000000000000..c1671396531d
--- /dev/null
+++ b/include/dt-bindings/reset/qcom,mmcc-apq8084.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
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#ifndef _DT_BINDINGS_RESET_APQ_MMCC_8084_H
15#define _DT_BINDINGS_RESET_APQ_MMCC_8084_H
16
17#define MMSS_SPDM_RESET 0
18#define MMSS_SPDM_RM_RESET 1
19#define VENUS0_RESET 2
20#define VPU_RESET 3
21#define MDSS_RESET 4
22#define AVSYNC_RESET 5
23#define CAMSS_PHY0_RESET 6
24#define CAMSS_PHY1_RESET 7
25#define CAMSS_PHY2_RESET 8
26#define CAMSS_CSI0_RESET 9
27#define CAMSS_CSI0PHY_RESET 10
28#define CAMSS_CSI0RDI_RESET 11
29#define CAMSS_CSI0PIX_RESET 12
30#define CAMSS_CSI1_RESET 13
31#define CAMSS_CSI1PHY_RESET 14
32#define CAMSS_CSI1RDI_RESET 15
33#define CAMSS_CSI1PIX_RESET 16
34#define CAMSS_CSI2_RESET 17
35#define CAMSS_CSI2PHY_RESET 18
36#define CAMSS_CSI2RDI_RESET 19
37#define CAMSS_CSI2PIX_RESET 20
38#define CAMSS_CSI3_RESET 21
39#define CAMSS_CSI3PHY_RESET 22
40#define CAMSS_CSI3RDI_RESET 23
41#define CAMSS_CSI3PIX_RESET 24
42#define CAMSS_ISPIF_RESET 25
43#define CAMSS_CCI_RESET 26
44#define CAMSS_MCLK0_RESET 27
45#define CAMSS_MCLK1_RESET 28
46#define CAMSS_MCLK2_RESET 29
47#define CAMSS_MCLK3_RESET 30
48#define CAMSS_GP0_RESET 31
49#define CAMSS_GP1_RESET 32
50#define CAMSS_TOP_RESET 33
51#define CAMSS_AHB_RESET 34
52#define CAMSS_MICRO_RESET 35
53#define CAMSS_JPEG_RESET 36
54#define CAMSS_VFE_RESET 37
55#define CAMSS_CSI_VFE0_RESET 38
56#define CAMSS_CSI_VFE1_RESET 39
57#define OXILI_RESET 40
58#define OXILICX_RESET 41
59#define OCMEMCX_RESET 42
60#define MMSS_RBCRP_RESET 43
61#define MMSSNOCAHB_RESET 44
62#define MMSSNOCAXI_RESET 45
63
64#endif
diff --git a/include/dt-bindings/reset/qcom,mmcc-msm8960.h b/include/dt-bindings/reset/qcom,mmcc-msm8960.h
index ba36ec680118..11741113a841 100644
--- a/include/dt-bindings/reset/qcom,mmcc-msm8960.h
+++ b/include/dt-bindings/reset/qcom,mmcc-msm8960.h
@@ -89,5 +89,13 @@
89#define CSI2_RESET 72 89#define CSI2_RESET 72
90#define CSI_RDI1_RESET 73 90#define CSI_RDI1_RESET 73
91#define CSI_RDI2_RESET 74 91#define CSI_RDI2_RESET 74
92#define GFX3D_AXI_RESET 75
93#define VCAP_AXI_RESET 76
94#define SMMU_VCAP_AHB_RESET 77
95#define VCAP_AHB_RESET 78
96#define CSI_RDI_RESET 79
97#define CSI_PIX_RESET 80
98#define VCAP_NPL_RESET 81
99#define VCAP_RESET 82
92 100
93#endif 101#endif
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 1f16d502600c..09a947e8bc87 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -43,9 +43,7 @@ struct ahci_host_priv *ahci_platform_get_resources(
43 struct platform_device *pdev); 43 struct platform_device *pdev);
44int ahci_platform_init_host(struct platform_device *pdev, 44int ahci_platform_init_host(struct platform_device *pdev,
45 struct ahci_host_priv *hpriv, 45 struct ahci_host_priv *hpriv,
46 const struct ata_port_info *pi_template, 46 const struct ata_port_info *pi_template);
47 unsigned int force_port_map,
48 unsigned int mask_port_map);
49 47
50int ahci_platform_suspend_host(struct device *dev); 48int ahci_platform_suspend_host(struct device *dev);
51int ahci_platform_resume_host(struct device *dev); 49int ahci_platform_resume_host(struct device *dev);
diff --git a/include/linux/amba/xilinx_dma.h b/include/linux/amba/xilinx_dma.h
new file mode 100644
index 000000000000..34b98f276ed0
--- /dev/null
+++ b/include/linux/amba/xilinx_dma.h
@@ -0,0 +1,47 @@
1/*
2 * Xilinx DMA Engine drivers support header file
3 *
4 * Copyright (C) 2010-2014 Xilinx, Inc. All rights reserved.
5 *
6 * This 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 __DMA_XILINX_DMA_H
13#define __DMA_XILINX_DMA_H
14
15#include <linux/dma-mapping.h>
16#include <linux/dmaengine.h>
17
18/**
19 * struct xilinx_vdma_config - VDMA Configuration structure
20 * @frm_dly: Frame delay
21 * @gen_lock: Whether in gen-lock mode
22 * @master: Master that it syncs to
23 * @frm_cnt_en: Enable frame count enable
24 * @park: Whether wants to park
25 * @park_frm: Frame to park on
26 * @coalesc: Interrupt coalescing threshold
27 * @delay: Delay counter
28 * @reset: Reset Channel
29 * @ext_fsync: External Frame Sync source
30 */
31struct xilinx_vdma_config {
32 int frm_dly;
33 int gen_lock;
34 int master;
35 int frm_cnt_en;
36 int park;
37 int park_frm;
38 int coalesc;
39 int delay;
40 int reset;
41 int ext_fsync;
42};
43
44int xilinx_vdma_channel_set_config(struct dma_chan *dchan,
45 struct xilinx_vdma_config *cfg);
46
47#endif
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index 8598f8eacb20..a495a959e8a7 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -36,6 +36,8 @@ struct ath9k_platform_data {
36 36
37 int (*get_mac_revision)(void); 37 int (*get_mac_revision)(void);
38 int (*external_reset)(void); 38 int (*external_reset)(void);
39
40 bool use_eeprom;
39}; 41};
40 42
41#endif /* _LINUX_ATH9K_PLATFORM_H */ 43#endif /* _LINUX_ATH9K_PLATFORM_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 5a645769f020..d2633ee099d9 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -186,6 +186,15 @@ static inline void *bio_data(struct bio *bio)
186#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ 186#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
187 __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q))) 187 __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q)))
188 188
189/*
190 * Check if adding a bio_vec after bprv with offset would create a gap in
191 * the SG list. Most drivers don't care about this, but some do.
192 */
193static inline bool bvec_gap_to_prev(struct bio_vec *bprv, unsigned int offset)
194{
195 return offset || ((bprv->bv_offset + bprv->bv_len) & (PAGE_SIZE - 1));
196}
197
189#define bio_io_error(bio) bio_endio((bio), -EIO) 198#define bio_io_error(bio) bio_endio((bio), -EIO)
190 199
191/* 200/*
@@ -644,10 +653,6 @@ struct biovec_slab {
644 653
645#if defined(CONFIG_BLK_DEV_INTEGRITY) 654#if defined(CONFIG_BLK_DEV_INTEGRITY)
646 655
647
648
649#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
650
651#define bip_for_each_vec(bvl, bip, iter) \ 656#define bip_for_each_vec(bvl, bip, iter) \
652 for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter) 657 for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter)
653 658
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 0feedebfde48..eb726b9c5762 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -42,7 +42,7 @@ struct blk_mq_hw_ctx {
42 unsigned int nr_ctx; 42 unsigned int nr_ctx;
43 struct blk_mq_ctx **ctxs; 43 struct blk_mq_ctx **ctxs;
44 44
45 unsigned int wait_index; 45 atomic_t wait_index;
46 46
47 struct blk_mq_tags *tags; 47 struct blk_mq_tags *tags;
48 48
@@ -135,7 +135,7 @@ enum {
135 BLK_MQ_S_STOPPED = 0, 135 BLK_MQ_S_STOPPED = 0,
136 BLK_MQ_S_TAG_ACTIVE = 1, 136 BLK_MQ_S_TAG_ACTIVE = 1,
137 137
138 BLK_MQ_MAX_DEPTH = 2048, 138 BLK_MQ_MAX_DEPTH = 10240,
139 139
140 BLK_MQ_CPU_WORK_BATCH = 8, 140 BLK_MQ_CPU_WORK_BATCH = 8,
141}; 141};
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index d8e4cea23a25..66c2167f04a9 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -5,8 +5,6 @@
5#ifndef __LINUX_BLK_TYPES_H 5#ifndef __LINUX_BLK_TYPES_H
6#define __LINUX_BLK_TYPES_H 6#define __LINUX_BLK_TYPES_H
7 7
8#ifdef CONFIG_BLOCK
9
10#include <linux/types.h> 8#include <linux/types.h>
11 9
12struct bio_set; 10struct bio_set;
@@ -28,6 +26,8 @@ struct bio_vec {
28 unsigned int bv_offset; 26 unsigned int bv_offset;
29}; 27};
30 28
29#ifdef CONFIG_BLOCK
30
31struct bvec_iter { 31struct bvec_iter {
32 sector_t bi_sector; /* device address in 512 byte 32 sector_t bi_sector; /* device address in 512 byte
33 sectors */ 33 sectors */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 3cd426e971db..8699bcf5f099 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -280,6 +280,7 @@ struct queue_limits {
280 unsigned long seg_boundary_mask; 280 unsigned long seg_boundary_mask;
281 281
282 unsigned int max_hw_sectors; 282 unsigned int max_hw_sectors;
283 unsigned int chunk_sectors;
283 unsigned int max_sectors; 284 unsigned int max_sectors;
284 unsigned int max_segment_size; 285 unsigned int max_segment_size;
285 unsigned int physical_block_size; 286 unsigned int physical_block_size;
@@ -511,6 +512,7 @@ struct request_queue {
511#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ 512#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */
512#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ 513#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */
513#define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ 514#define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/
515#define QUEUE_FLAG_SG_GAPS 22 /* queue doesn't support SG gaps */
514 516
515#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 517#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
516 (1 << QUEUE_FLAG_STACKABLE) | \ 518 (1 << QUEUE_FLAG_STACKABLE) | \
@@ -795,6 +797,7 @@ extern void __blk_put_request(struct request_queue *, struct request *);
795extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 797extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
796extern struct request *blk_make_request(struct request_queue *, struct bio *, 798extern struct request *blk_make_request(struct request_queue *, struct bio *,
797 gfp_t); 799 gfp_t);
800extern void blk_rq_set_block_pc(struct request *);
798extern void blk_requeue_request(struct request_queue *, struct request *); 801extern void blk_requeue_request(struct request_queue *, struct request *);
799extern void blk_add_request_payload(struct request *rq, struct page *page, 802extern void blk_add_request_payload(struct request *rq, struct page *page,
800 unsigned int len); 803 unsigned int len);
@@ -910,6 +913,20 @@ static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,
910 return q->limits.max_sectors; 913 return q->limits.max_sectors;
911} 914}
912 915
916/*
917 * Return maximum size of a request at given offset. Only valid for
918 * file system requests.
919 */
920static inline unsigned int blk_max_size_offset(struct request_queue *q,
921 sector_t offset)
922{
923 if (!q->limits.chunk_sectors)
924 return q->limits.max_sectors;
925
926 return q->limits.chunk_sectors -
927 (offset & (q->limits.chunk_sectors - 1));
928}
929
913static inline unsigned int blk_rq_get_max_sectors(struct request *rq) 930static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
914{ 931{
915 struct request_queue *q = rq->q; 932 struct request_queue *q = rq->q;
@@ -917,7 +934,11 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
917 if (unlikely(rq->cmd_type == REQ_TYPE_BLOCK_PC)) 934 if (unlikely(rq->cmd_type == REQ_TYPE_BLOCK_PC))
918 return q->limits.max_hw_sectors; 935 return q->limits.max_hw_sectors;
919 936
920 return blk_queue_get_max_sectors(q, rq->cmd_flags); 937 if (!q->limits.chunk_sectors)
938 return blk_queue_get_max_sectors(q, rq->cmd_flags);
939
940 return min(blk_max_size_offset(q, blk_rq_pos(rq)),
941 blk_queue_get_max_sectors(q, rq->cmd_flags));
921} 942}
922 943
923static inline unsigned int blk_rq_count_bios(struct request *rq) 944static inline unsigned int blk_rq_count_bios(struct request *rq)
@@ -983,6 +1004,7 @@ extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
983extern void blk_queue_bounce_limit(struct request_queue *, u64); 1004extern void blk_queue_bounce_limit(struct request_queue *, u64);
984extern void blk_limits_max_hw_sectors(struct queue_limits *, unsigned int); 1005extern void blk_limits_max_hw_sectors(struct queue_limits *, unsigned int);
985extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); 1006extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
1007extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int);
986extern void blk_queue_max_segments(struct request_queue *, unsigned short); 1008extern void blk_queue_max_segments(struct request_queue *, unsigned short);
987extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 1009extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
988extern void blk_queue_max_discard_sectors(struct request_queue *q, 1010extern void blk_queue_max_discard_sectors(struct request_queue *q,
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index 78c6c52073ad..a0875001b13c 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -10,8 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#ifndef CAN_CORE_H 13#ifndef _CAN_CORE_H
14#define CAN_CORE_H 14#define _CAN_CORE_H
15 15
16#include <linux/can.h> 16#include <linux/can.h>
17#include <linux/skbuff.h> 17#include <linux/skbuff.h>
@@ -58,4 +58,4 @@ extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
58extern int can_send(struct sk_buff *skb, int loop); 58extern int can_send(struct sk_buff *skb, int loop);
59extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 59extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
60 60
61#endif /* CAN_CORE_H */ 61#endif /* !_CAN_CORE_H */
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 3ce5e526525f..6992afc6ba7f 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -10,8 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#ifndef CAN_DEV_H 13#ifndef _CAN_DEV_H
14#define CAN_DEV_H 14#define _CAN_DEV_H
15 15
16#include <linux/can.h> 16#include <linux/can.h>
17#include <linux/can/netlink.h> 17#include <linux/can/netlink.h>
@@ -132,4 +132,4 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
132struct sk_buff *alloc_can_err_skb(struct net_device *dev, 132struct sk_buff *alloc_can_err_skb(struct net_device *dev,
133 struct can_frame **cf); 133 struct can_frame **cf);
134 134
135#endif /* CAN_DEV_H */ 135#endif /* !_CAN_DEV_H */
diff --git a/include/linux/can/led.h b/include/linux/can/led.h
index 9c1167baf273..e0475c5cbb92 100644
--- a/include/linux/can/led.h
+++ b/include/linux/can/led.h
@@ -6,8 +6,8 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#ifndef CAN_LED_H 9#ifndef _CAN_LED_H
10#define CAN_LED_H 10#define _CAN_LED_H
11 11
12#include <linux/if.h> 12#include <linux/if.h>
13#include <linux/leds.h> 13#include <linux/leds.h>
@@ -48,4 +48,4 @@ static inline void can_led_notifier_exit(void)
48 48
49#endif 49#endif
50 50
51#endif 51#endif /* !_CAN_LED_H */
diff --git a/include/linux/can/platform/cc770.h b/include/linux/can/platform/cc770.h
index 7702641f87ee..78b2d44f04cf 100644
--- a/include/linux/can/platform/cc770.h
+++ b/include/linux/can/platform/cc770.h
@@ -1,5 +1,5 @@
1#ifndef _CAN_PLATFORM_CC770_H_ 1#ifndef _CAN_PLATFORM_CC770_H
2#define _CAN_PLATFORM_CC770_H_ 2#define _CAN_PLATFORM_CC770_H
3 3
4/* CPU Interface Register (0x02) */ 4/* CPU Interface Register (0x02) */
5#define CPUIF_CEN 0x01 /* Clock Out Enable */ 5#define CPUIF_CEN 0x01 /* Clock Out Enable */
@@ -30,4 +30,4 @@ struct cc770_platform_data {
30 u8 bcr; /* Bus Configuration Register */ 30 u8 bcr; /* Bus Configuration Register */
31}; 31};
32 32
33#endif /* !_CAN_PLATFORM_CC770_H_ */ 33#endif /* !_CAN_PLATFORM_CC770_H */
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index dc029dba7a03..d44fcae274ff 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -1,5 +1,5 @@
1#ifndef __CAN_PLATFORM_MCP251X_H__ 1#ifndef _CAN_PLATFORM_MCP251X_H
2#define __CAN_PLATFORM_MCP251X_H__ 2#define _CAN_PLATFORM_MCP251X_H
3 3
4/* 4/*
5 * 5 *
@@ -18,4 +18,4 @@ struct mcp251x_platform_data {
18 unsigned long oscillator_frequency; 18 unsigned long oscillator_frequency;
19}; 19};
20 20
21#endif /* __CAN_PLATFORM_MCP251X_H__ */ 21#endif /* !_CAN_PLATFORM_MCP251X_H */
diff --git a/include/linux/can/platform/rcar_can.h b/include/linux/can/platform/rcar_can.h
new file mode 100644
index 000000000000..0f4a2f3df504
--- /dev/null
+++ b/include/linux/can/platform/rcar_can.h
@@ -0,0 +1,17 @@
1#ifndef _CAN_PLATFORM_RCAR_CAN_H_
2#define _CAN_PLATFORM_RCAR_CAN_H_
3
4#include <linux/types.h>
5
6/* Clock Select Register settings */
7enum CLKR {
8 CLKR_CLKP1 = 0, /* Peripheral clock (clkp1) */
9 CLKR_CLKP2 = 1, /* Peripheral clock (clkp2) */
10 CLKR_CLKEXT = 3 /* Externally input clock */
11};
12
13struct rcar_can_platform_data {
14 enum CLKR clock_select; /* Clock source select */
15};
16
17#endif /* !_CAN_PLATFORM_RCAR_CAN_H_ */
diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h
index 96f8fcc78d78..93570b61ec6c 100644
--- a/include/linux/can/platform/sja1000.h
+++ b/include/linux/can/platform/sja1000.h
@@ -1,5 +1,5 @@
1#ifndef _CAN_PLATFORM_SJA1000_H_ 1#ifndef _CAN_PLATFORM_SJA1000_H
2#define _CAN_PLATFORM_SJA1000_H_ 2#define _CAN_PLATFORM_SJA1000_H
3 3
4/* clock divider register */ 4/* clock divider register */
5#define CDR_CLKOUT_MASK 0x07 5#define CDR_CLKOUT_MASK 0x07
@@ -32,4 +32,4 @@ struct sja1000_platform_data {
32 u8 cdr; /* clock divider register */ 32 u8 cdr; /* clock divider register */
33}; 33};
34 34
35#endif /* !_CAN_PLATFORM_SJA1000_H_ */ 35#endif /* !_CAN_PLATFORM_SJA1000_H */
diff --git a/include/linux/can/platform/ti_hecc.h b/include/linux/can/platform/ti_hecc.h
index af17cb3f7a84..a52f47ca6c8a 100644
--- a/include/linux/can/platform/ti_hecc.h
+++ b/include/linux/can/platform/ti_hecc.h
@@ -1,5 +1,5 @@
1#ifndef __CAN_PLATFORM_TI_HECC_H__ 1#ifndef _CAN_PLATFORM_TI_HECC_H
2#define __CAN_PLATFORM_TI_HECC_H__ 2#define _CAN_PLATFORM_TI_HECC_H
3 3
4/* 4/*
5 * TI HECC (High End CAN Controller) driver platform header 5 * TI HECC (High End CAN Controller) driver platform header
@@ -41,4 +41,4 @@ struct ti_hecc_platform_data {
41 u32 version; 41 u32 version;
42 void (*transceiver_switch) (int); 42 void (*transceiver_switch) (int);
43}; 43};
44#endif 44#endif /* !_CAN_PLATFORM_TI_HECC_H */
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index f9bbbb472663..cc00d15c6107 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -7,8 +7,8 @@
7 * 7 *
8 */ 8 */
9 9
10#ifndef CAN_SKB_H 10#ifndef _CAN_SKB_H
11#define CAN_SKB_H 11#define _CAN_SKB_H
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/skbuff.h> 14#include <linux/skbuff.h>
@@ -80,4 +80,4 @@ static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb)
80 return skb; 80 return skb;
81} 81}
82 82
83#endif /* CAN_SKB_H */ 83#endif /* !_CAN_SKB_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index a6ee1f9a5018..84b13ad67c1c 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -210,7 +210,7 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
210 struct user_namespace *ns, int cap); 210 struct user_namespace *ns, int cap);
211extern bool capable(int cap); 211extern bool capable(int cap);
212extern bool ns_capable(struct user_namespace *ns, int cap); 212extern bool ns_capable(struct user_namespace *ns, int cap);
213extern bool inode_capable(const struct inode *inode, int cap); 213extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
214extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); 214extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
215 215
216/* audit system wants to get cap info from files as well */ 216/* audit system wants to get cap info from files as well */
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 5f6db18d72e8..3c97d5e9b951 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -625,6 +625,8 @@ int ceph_flags_to_mode(int flags);
625 CEPH_CAP_LINK_EXCL | \ 625 CEPH_CAP_LINK_EXCL | \
626 CEPH_CAP_XATTR_EXCL | \ 626 CEPH_CAP_XATTR_EXCL | \
627 CEPH_CAP_FILE_EXCL) 627 CEPH_CAP_FILE_EXCL)
628#define CEPH_CAP_ANY_FILE_RD (CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE | \
629 CEPH_CAP_FILE_SHARED)
628#define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \ 630#define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
629 CEPH_CAP_FILE_EXCL) 631 CEPH_CAP_FILE_EXCL)
630#define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR) 632#define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 2f49aa4c4f7f..279b0afac1c1 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -222,8 +222,6 @@ extern void ceph_copy_to_page_vector(struct page **pages,
222extern void ceph_copy_from_page_vector(struct page **pages, 222extern void ceph_copy_from_page_vector(struct page **pages,
223 void *data, 223 void *data,
224 loff_t off, size_t len); 224 loff_t off, size_t len);
225extern int ceph_copy_page_vector_to_user(struct page **pages, void __user *data,
226 loff_t off, size_t len);
227extern void ceph_zero_page_vector_range(int off, int len, struct page **pages); 225extern void ceph_zero_page_vector_range(int off, int len, struct page **pages);
228 226
229 227
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index a486f390dfbe..deb47e45ac7c 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -40,9 +40,9 @@ struct ceph_mon_request {
40}; 40};
41 41
42/* 42/*
43 * ceph_mon_generic_request is being used for the statfs and poolop requests 43 * ceph_mon_generic_request is being used for the statfs, poolop and
44 * which are bening done a bit differently because we need to get data back 44 * mon_get_version requests which are being done a bit differently
45 * to the caller 45 * because we need to get data back to the caller
46 */ 46 */
47struct ceph_mon_generic_request { 47struct ceph_mon_generic_request {
48 struct kref kref; 48 struct kref kref;
@@ -104,10 +104,15 @@ extern int ceph_monc_got_mdsmap(struct ceph_mon_client *monc, u32 have);
104extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have); 104extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have);
105 105
106extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc); 106extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc);
107extern int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,
108 unsigned long timeout);
107 109
108extern int ceph_monc_do_statfs(struct ceph_mon_client *monc, 110extern int ceph_monc_do_statfs(struct ceph_mon_client *monc,
109 struct ceph_statfs *buf); 111 struct ceph_statfs *buf);
110 112
113extern int ceph_monc_do_get_version(struct ceph_mon_client *monc,
114 const char *what, u64 *newest);
115
111extern int ceph_monc_open_session(struct ceph_mon_client *monc); 116extern int ceph_monc_open_session(struct ceph_mon_client *monc);
112 117
113extern int ceph_monc_validate_auth(struct ceph_mon_client *monc); 118extern int ceph_monc_validate_auth(struct ceph_mon_client *monc);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index d60904b9e505..b5223c570eba 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -21,6 +21,7 @@
21#include <linux/percpu-refcount.h> 21#include <linux/percpu-refcount.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/kernfs.h> 23#include <linux/kernfs.h>
24#include <linux/wait.h>
24 25
25#ifdef CONFIG_CGROUPS 26#ifdef CONFIG_CGROUPS
26 27
@@ -47,21 +48,45 @@ enum cgroup_subsys_id {
47}; 48};
48#undef SUBSYS 49#undef SUBSYS
49 50
50/* Per-subsystem/per-cgroup state maintained by the system. */ 51/*
52 * Per-subsystem/per-cgroup state maintained by the system. This is the
53 * fundamental structural building block that controllers deal with.
54 *
55 * Fields marked with "PI:" are public and immutable and may be accessed
56 * directly without synchronization.
57 */
51struct cgroup_subsys_state { 58struct cgroup_subsys_state {
52 /* the cgroup that this css is attached to */ 59 /* PI: the cgroup that this css is attached to */
53 struct cgroup *cgroup; 60 struct cgroup *cgroup;
54 61
55 /* the cgroup subsystem that this css is attached to */ 62 /* PI: the cgroup subsystem that this css is attached to */
56 struct cgroup_subsys *ss; 63 struct cgroup_subsys *ss;
57 64
58 /* reference count - access via css_[try]get() and css_put() */ 65 /* reference count - access via css_[try]get() and css_put() */
59 struct percpu_ref refcnt; 66 struct percpu_ref refcnt;
60 67
61 /* the parent css */ 68 /* PI: the parent css */
62 struct cgroup_subsys_state *parent; 69 struct cgroup_subsys_state *parent;
63 70
64 unsigned long flags; 71 /* siblings list anchored at the parent's ->children */
72 struct list_head sibling;
73 struct list_head children;
74
75 /*
76 * PI: Subsys-unique ID. 0 is unused and root is always 1. The
77 * matching css can be looked up using css_from_id().
78 */
79 int id;
80
81 unsigned int flags;
82
83 /*
84 * Monotonically increasing unique serial number which defines a
85 * uniform order among all csses. It's guaranteed that all
86 * ->children lists are in the ascending order of ->serial_nr and
87 * used to allow interrupting and resuming iterations.
88 */
89 u64 serial_nr;
65 90
66 /* percpu_ref killing and RCU release */ 91 /* percpu_ref killing and RCU release */
67 struct rcu_head rcu_head; 92 struct rcu_head rcu_head;
@@ -70,8 +95,9 @@ struct cgroup_subsys_state {
70 95
71/* bits in struct cgroup_subsys_state flags field */ 96/* bits in struct cgroup_subsys_state flags field */
72enum { 97enum {
73 CSS_ROOT = (1 << 0), /* this CSS is the root of the subsystem */ 98 CSS_NO_REF = (1 << 0), /* no reference counting for this css */
74 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */ 99 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */
100 CSS_RELEASED = (1 << 2), /* refcnt reached zero, released */
75}; 101};
76 102
77/** 103/**
@@ -82,8 +108,7 @@ enum {
82 */ 108 */
83static inline void css_get(struct cgroup_subsys_state *css) 109static inline void css_get(struct cgroup_subsys_state *css)
84{ 110{
85 /* We don't need to reference count the root state */ 111 if (!(css->flags & CSS_NO_REF))
86 if (!(css->flags & CSS_ROOT))
87 percpu_ref_get(&css->refcnt); 112 percpu_ref_get(&css->refcnt);
88} 113}
89 114
@@ -91,35 +116,51 @@ static inline void css_get(struct cgroup_subsys_state *css)
91 * css_tryget - try to obtain a reference on the specified css 116 * css_tryget - try to obtain a reference on the specified css
92 * @css: target css 117 * @css: target css
93 * 118 *
94 * Obtain a reference on @css if it's alive. The caller naturally needs to 119 * Obtain a reference on @css unless it already has reached zero and is
95 * ensure that @css is accessible but doesn't have to be holding a 120 * being released. This function doesn't care whether @css is on or
121 * offline. The caller naturally needs to ensure that @css is accessible
122 * but doesn't have to be holding a reference on it - IOW, RCU protected
123 * access is good enough for this function. Returns %true if a reference
124 * count was successfully obtained; %false otherwise.
125 */
126static inline bool css_tryget(struct cgroup_subsys_state *css)
127{
128 if (!(css->flags & CSS_NO_REF))
129 return percpu_ref_tryget(&css->refcnt);
130 return true;
131}
132
133/**
134 * css_tryget_online - try to obtain a reference on the specified css if online
135 * @css: target css
136 *
137 * Obtain a reference on @css if it's online. The caller naturally needs
138 * to ensure that @css is accessible but doesn't have to be holding a
96 * reference on it - IOW, RCU protected access is good enough for this 139 * reference on it - IOW, RCU protected access is good enough for this
97 * function. Returns %true if a reference count was successfully obtained; 140 * function. Returns %true if a reference count was successfully obtained;
98 * %false otherwise. 141 * %false otherwise.
99 */ 142 */
100static inline bool css_tryget(struct cgroup_subsys_state *css) 143static inline bool css_tryget_online(struct cgroup_subsys_state *css)
101{ 144{
102 if (css->flags & CSS_ROOT) 145 if (!(css->flags & CSS_NO_REF))
103 return true; 146 return percpu_ref_tryget_live(&css->refcnt);
104 return percpu_ref_tryget(&css->refcnt); 147 return true;
105} 148}
106 149
107/** 150/**
108 * css_put - put a css reference 151 * css_put - put a css reference
109 * @css: target css 152 * @css: target css
110 * 153 *
111 * Put a reference obtained via css_get() and css_tryget(). 154 * Put a reference obtained via css_get() and css_tryget_online().
112 */ 155 */
113static inline void css_put(struct cgroup_subsys_state *css) 156static inline void css_put(struct cgroup_subsys_state *css)
114{ 157{
115 if (!(css->flags & CSS_ROOT)) 158 if (!(css->flags & CSS_NO_REF))
116 percpu_ref_put(&css->refcnt); 159 percpu_ref_put(&css->refcnt);
117} 160}
118 161
119/* bits in struct cgroup flags field */ 162/* bits in struct cgroup flags field */
120enum { 163enum {
121 /* Control Group is dead */
122 CGRP_DEAD,
123 /* 164 /*
124 * Control Group has previously had a child cgroup or a task, 165 * Control Group has previously had a child cgroup or a task,
125 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) 166 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
@@ -133,48 +174,45 @@ enum {
133 * specified at mount time and thus is implemented here. 174 * specified at mount time and thus is implemented here.
134 */ 175 */
135 CGRP_CPUSET_CLONE_CHILDREN, 176 CGRP_CPUSET_CLONE_CHILDREN,
136 /* see the comment above CGRP_ROOT_SANE_BEHAVIOR for details */
137 CGRP_SANE_BEHAVIOR,
138}; 177};
139 178
140struct cgroup { 179struct cgroup {
180 /* self css with NULL ->ss, points back to this cgroup */
181 struct cgroup_subsys_state self;
182
141 unsigned long flags; /* "unsigned long" so bitops work */ 183 unsigned long flags; /* "unsigned long" so bitops work */
142 184
143 /* 185 /*
144 * idr allocated in-hierarchy ID. 186 * idr allocated in-hierarchy ID.
145 * 187 *
146 * The ID of the root cgroup is always 0, and a new cgroup 188 * ID 0 is not used, the ID of the root cgroup is always 1, and a
147 * will be assigned with a smallest available ID. 189 * new cgroup will be assigned with a smallest available ID.
148 * 190 *
149 * Allocating/Removing ID must be protected by cgroup_mutex. 191 * Allocating/Removing ID must be protected by cgroup_mutex.
150 */ 192 */
151 int id; 193 int id;
152 194
153 /* the number of attached css's */
154 int nr_css;
155
156 atomic_t refcnt;
157
158 /* 195 /*
159 * We link our 'sibling' struct into our parent's 'children'. 196 * If this cgroup contains any tasks, it contributes one to
160 * Our children link their 'sibling' into our 'children'. 197 * populated_cnt. All children with non-zero popuplated_cnt of
198 * their own contribute one. The count is zero iff there's no task
199 * in this cgroup or its subtree.
161 */ 200 */
162 struct list_head sibling; /* my parent's children */ 201 int populated_cnt;
163 struct list_head children; /* my children */
164 202
165 struct cgroup *parent; /* my parent */
166 struct kernfs_node *kn; /* cgroup kernfs entry */ 203 struct kernfs_node *kn; /* cgroup kernfs entry */
204 struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */
167 205
168 /* 206 /*
169 * Monotonically increasing unique serial number which defines a 207 * The bitmask of subsystems enabled on the child cgroups.
170 * uniform order among all cgroups. It's guaranteed that all 208 * ->subtree_control is the one configured through
171 * ->children lists are in the ascending order of ->serial_nr. 209 * "cgroup.subtree_control" while ->child_subsys_mask is the
172 * It's used to allow interrupting and resuming iterations. 210 * effective one which may have more subsystems enabled.
211 * Controller knobs are made available iff it's enabled in
212 * ->subtree_control.
173 */ 213 */
174 u64 serial_nr; 214 unsigned int subtree_control;
175 215 unsigned int child_subsys_mask;
176 /* The bitmask of subsystems attached to this cgroup */
177 unsigned long subsys_mask;
178 216
179 /* Private pointers for each registered subsystem */ 217 /* Private pointers for each registered subsystem */
180 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT]; 218 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
@@ -188,6 +226,15 @@ struct cgroup {
188 struct list_head cset_links; 226 struct list_head cset_links;
189 227
190 /* 228 /*
229 * On the default hierarchy, a css_set for a cgroup with some
230 * susbsys disabled will point to css's which are associated with
231 * the closest ancestor which has the subsys enabled. The
232 * following lists all css_sets which point to this cgroup's css
233 * for the given subsystem.
234 */
235 struct list_head e_csets[CGROUP_SUBSYS_COUNT];
236
237 /*
191 * Linked list running through all cgroups that can 238 * Linked list running through all cgroups that can
192 * potentially be reaped by the release agent. Protected by 239 * potentially be reaped by the release agent. Protected by
193 * release_list_lock 240 * release_list_lock
@@ -201,77 +248,17 @@ struct cgroup {
201 struct list_head pidlists; 248 struct list_head pidlists;
202 struct mutex pidlist_mutex; 249 struct mutex pidlist_mutex;
203 250
204 /* dummy css with NULL ->ss, points back to this cgroup */ 251 /* used to wait for offlining of csses */
205 struct cgroup_subsys_state dummy_css; 252 wait_queue_head_t offline_waitq;
206
207 /* For css percpu_ref killing and RCU-protected deletion */
208 struct rcu_head rcu_head;
209 struct work_struct destroy_work;
210}; 253};
211 254
212#define MAX_CGROUP_ROOT_NAMELEN 64 255#define MAX_CGROUP_ROOT_NAMELEN 64
213 256
214/* cgroup_root->flags */ 257/* cgroup_root->flags */
215enum { 258enum {
216 /* 259 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), /* __DEVEL__sane_behavior specified */
217 * Unfortunately, cgroup core and various controllers are riddled
218 * with idiosyncrasies and pointless options. The following flag,
219 * when set, will force sane behavior - some options are forced on,
220 * others are disallowed, and some controllers will change their
221 * hierarchical or other behaviors.
222 *
223 * The set of behaviors affected by this flag are still being
224 * determined and developed and the mount option for this flag is
225 * prefixed with __DEVEL__. The prefix will be dropped once we
226 * reach the point where all behaviors are compatible with the
227 * planned unified hierarchy, which will automatically turn on this
228 * flag.
229 *
230 * The followings are the behaviors currently affected this flag.
231 *
232 * - Mount options "noprefix", "xattr", "clone_children",
233 * "release_agent" and "name" are disallowed.
234 *
235 * - When mounting an existing superblock, mount options should
236 * match.
237 *
238 * - Remount is disallowed.
239 *
240 * - rename(2) is disallowed.
241 *
242 * - "tasks" is removed. Everything should be at process
243 * granularity. Use "cgroup.procs" instead.
244 *
245 * - "cgroup.procs" is not sorted. pids will be unique unless they
246 * got recycled inbetween reads.
247 *
248 * - "release_agent" and "notify_on_release" are removed.
249 * Replacement notification mechanism will be implemented.
250 *
251 * - "cgroup.clone_children" is removed.
252 *
253 * - If mount is requested with sane_behavior but without any
254 * subsystem, the default unified hierarchy is mounted.
255 *
256 * - cpuset: tasks will be kept in empty cpusets when hotplug happens
257 * and take masks of ancestors with non-empty cpus/mems, instead of
258 * being moved to an ancestor.
259 *
260 * - cpuset: a task can be moved into an empty cpuset, and again it
261 * takes masks of ancestors.
262 *
263 * - memcg: use_hierarchy is on by default and the cgroup file for
264 * the flag is not created.
265 *
266 * - blkcg: blk-throttle becomes properly hierarchical.
267 */
268 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
269
270 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */ 260 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */
271 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */ 261 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */
272
273 /* mount options live below bit 16 */
274 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1,
275}; 262};
276 263
277/* 264/*
@@ -282,6 +269,9 @@ enum {
282struct cgroup_root { 269struct cgroup_root {
283 struct kernfs_root *kf_root; 270 struct kernfs_root *kf_root;
284 271
272 /* The bitmask of subsystems attached to this hierarchy */
273 unsigned int subsys_mask;
274
285 /* Unique id for this hierarchy. */ 275 /* Unique id for this hierarchy. */
286 int hierarchy_id; 276 int hierarchy_id;
287 277
@@ -295,7 +285,7 @@ struct cgroup_root {
295 struct list_head root_list; 285 struct list_head root_list;
296 286
297 /* Hierarchy-specific flags */ 287 /* Hierarchy-specific flags */
298 unsigned long flags; 288 unsigned int flags;
299 289
300 /* IDs for cgroups in this hierarchy */ 290 /* IDs for cgroups in this hierarchy */
301 struct idr cgroup_idr; 291 struct idr cgroup_idr;
@@ -342,6 +332,9 @@ struct css_set {
342 */ 332 */
343 struct list_head cgrp_links; 333 struct list_head cgrp_links;
344 334
335 /* the default cgroup associated with this css_set */
336 struct cgroup *dfl_cgrp;
337
345 /* 338 /*
346 * Set of subsystem states, one for each subsystem. This array is 339 * Set of subsystem states, one for each subsystem. This array is
347 * immutable after creation apart from the init_css_set during 340 * immutable after creation apart from the init_css_set during
@@ -366,6 +359,15 @@ struct css_set {
366 struct cgroup *mg_src_cgrp; 359 struct cgroup *mg_src_cgrp;
367 struct css_set *mg_dst_cset; 360 struct css_set *mg_dst_cset;
368 361
362 /*
363 * On the default hierarhcy, ->subsys[ssid] may point to a css
364 * attached to an ancestor instead of the cgroup this css_set is
365 * associated with. The following node is anchored at
366 * ->subsys[ssid]->cgroup->e_csets[ssid] and provides a way to
367 * iterate through all css's attached to a given cgroup.
368 */
369 struct list_head e_cset_node[CGROUP_SUBSYS_COUNT];
370
369 /* For RCU-protected deletion */ 371 /* For RCU-protected deletion */
370 struct rcu_head rcu_head; 372 struct rcu_head rcu_head;
371}; 373};
@@ -382,9 +384,11 @@ struct css_set {
382enum { 384enum {
383 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */ 385 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
384 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ 386 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
385 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
386 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ 387 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
387 CFTYPE_ONLY_ON_DFL = (1 << 4), /* only on default hierarchy */ 388
389 /* internal flags, do not use outside cgroup core proper */
390 __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */
391 __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */
388}; 392};
389 393
390#define MAX_CFTYPE_NAME 64 394#define MAX_CFTYPE_NAME 64
@@ -405,8 +409,7 @@ struct cftype {
405 409
406 /* 410 /*
407 * The maximum length of string, excluding trailing nul, that can 411 * The maximum length of string, excluding trailing nul, that can
408 * be passed to write_string. If < PAGE_SIZE-1, PAGE_SIZE-1 is 412 * be passed to write. If < PAGE_SIZE-1, PAGE_SIZE-1 is assumed.
409 * assumed.
410 */ 413 */
411 size_t max_write_len; 414 size_t max_write_len;
412 415
@@ -453,19 +456,13 @@ struct cftype {
453 s64 val); 456 s64 val);
454 457
455 /* 458 /*
456 * write_string() is passed a nul-terminated kernelspace 459 * write() is the generic write callback which maps directly to
457 * buffer of maximum length determined by max_write_len. 460 * kernfs write operation and overrides all other operations.
458 * Returns 0 or -ve error code. 461 * Maximum write size is determined by ->max_write_len. Use
462 * of_css/cft() to access the associated css and cft.
459 */ 463 */
460 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft, 464 ssize_t (*write)(struct kernfs_open_file *of,
461 char *buffer); 465 char *buf, size_t nbytes, loff_t off);
462 /*
463 * trigger() callback can be used to get some kick from the
464 * userspace, when the actual string written is not important
465 * at all. The private field can be used to determine the
466 * kick type for multiplexing.
467 */
468 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event);
469 466
470#ifdef CONFIG_DEBUG_LOCK_ALLOC 467#ifdef CONFIG_DEBUG_LOCK_ALLOC
471 struct lock_class_key lockdep_key; 468 struct lock_class_key lockdep_key;
@@ -475,20 +472,64 @@ struct cftype {
475extern struct cgroup_root cgrp_dfl_root; 472extern struct cgroup_root cgrp_dfl_root;
476extern struct css_set init_css_set; 473extern struct css_set init_css_set;
477 474
475/**
476 * cgroup_on_dfl - test whether a cgroup is on the default hierarchy
477 * @cgrp: the cgroup of interest
478 *
479 * The default hierarchy is the v2 interface of cgroup and this function
480 * can be used to test whether a cgroup is on the default hierarchy for
481 * cases where a subsystem should behave differnetly depending on the
482 * interface version.
483 *
484 * The set of behaviors which change on the default hierarchy are still
485 * being determined and the mount option is prefixed with __DEVEL__.
486 *
487 * List of changed behaviors:
488 *
489 * - Mount options "noprefix", "xattr", "clone_children", "release_agent"
490 * and "name" are disallowed.
491 *
492 * - When mounting an existing superblock, mount options should match.
493 *
494 * - Remount is disallowed.
495 *
496 * - rename(2) is disallowed.
497 *
498 * - "tasks" is removed. Everything should be at process granularity. Use
499 * "cgroup.procs" instead.
500 *
501 * - "cgroup.procs" is not sorted. pids will be unique unless they got
502 * recycled inbetween reads.
503 *
504 * - "release_agent" and "notify_on_release" are removed. Replacement
505 * notification mechanism will be implemented.
506 *
507 * - "cgroup.clone_children" is removed.
508 *
509 * - "cgroup.subtree_populated" is available. Its value is 0 if the cgroup
510 * and its descendants contain no task; otherwise, 1. The file also
511 * generates kernfs notification which can be monitored through poll and
512 * [di]notify when the value of the file changes.
513 *
514 * - cpuset: tasks will be kept in empty cpusets when hotplug happens and
515 * take masks of ancestors with non-empty cpus/mems, instead of being
516 * moved to an ancestor.
517 *
518 * - cpuset: a task can be moved into an empty cpuset, and again it takes
519 * masks of ancestors.
520 *
521 * - memcg: use_hierarchy is on by default and the cgroup file for the flag
522 * is not created.
523 *
524 * - blkcg: blk-throttle becomes properly hierarchical.
525 *
526 * - debug: disallowed on the default hierarchy.
527 */
478static inline bool cgroup_on_dfl(const struct cgroup *cgrp) 528static inline bool cgroup_on_dfl(const struct cgroup *cgrp)
479{ 529{
480 return cgrp->root == &cgrp_dfl_root; 530 return cgrp->root == &cgrp_dfl_root;
481} 531}
482 532
483/*
484 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
485 * function can be called as long as @cgrp is accessible.
486 */
487static inline bool cgroup_sane_behavior(const struct cgroup *cgrp)
488{
489 return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR;
490}
491
492/* no synchronization, the result can only be used as a hint */ 533/* no synchronization, the result can only be used as a hint */
493static inline bool cgroup_has_tasks(struct cgroup *cgrp) 534static inline bool cgroup_has_tasks(struct cgroup *cgrp)
494{ 535{
@@ -504,14 +545,24 @@ static inline ino_t cgroup_ino(struct cgroup *cgrp)
504 return 0; 545 return 0;
505} 546}
506 547
507static inline struct cftype *seq_cft(struct seq_file *seq) 548/* cft/css accessors for cftype->write() operation */
549static inline struct cftype *of_cft(struct kernfs_open_file *of)
508{ 550{
509 struct kernfs_open_file *of = seq->private;
510
511 return of->kn->priv; 551 return of->kn->priv;
512} 552}
513 553
514struct cgroup_subsys_state *seq_css(struct seq_file *seq); 554struct cgroup_subsys_state *of_css(struct kernfs_open_file *of);
555
556/* cft/css accessors for cftype->seq_*() operations */
557static inline struct cftype *seq_cft(struct seq_file *seq)
558{
559 return of_cft(seq->private);
560}
561
562static inline struct cgroup_subsys_state *seq_css(struct seq_file *seq)
563{
564 return of_css(seq->private);
565}
515 566
516/* 567/*
517 * Name / path handling functions. All are thin wrappers around the kernfs 568 * Name / path handling functions. All are thin wrappers around the kernfs
@@ -541,7 +592,8 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
541 592
542char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); 593char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
543 594
544int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 595int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
596int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
545int cgroup_rm_cftypes(struct cftype *cfts); 597int cgroup_rm_cftypes(struct cftype *cfts);
546 598
547bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 599bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
@@ -573,6 +625,7 @@ struct cgroup_subsys {
573 int (*css_online)(struct cgroup_subsys_state *css); 625 int (*css_online)(struct cgroup_subsys_state *css);
574 void (*css_offline)(struct cgroup_subsys_state *css); 626 void (*css_offline)(struct cgroup_subsys_state *css);
575 void (*css_free)(struct cgroup_subsys_state *css); 627 void (*css_free)(struct cgroup_subsys_state *css);
628 void (*css_reset)(struct cgroup_subsys_state *css);
576 629
577 int (*can_attach)(struct cgroup_subsys_state *css, 630 int (*can_attach)(struct cgroup_subsys_state *css,
578 struct cgroup_taskset *tset); 631 struct cgroup_taskset *tset);
@@ -612,14 +665,30 @@ struct cgroup_subsys {
612 /* link to parent, protected by cgroup_lock() */ 665 /* link to parent, protected by cgroup_lock() */
613 struct cgroup_root *root; 666 struct cgroup_root *root;
614 667
668 /* idr for css->id */
669 struct idr css_idr;
670
615 /* 671 /*
616 * List of cftypes. Each entry is the first entry of an array 672 * List of cftypes. Each entry is the first entry of an array
617 * terminated by zero length name. 673 * terminated by zero length name.
618 */ 674 */
619 struct list_head cfts; 675 struct list_head cfts;
620 676
621 /* base cftypes, automatically registered with subsys itself */ 677 /*
622 struct cftype *base_cftypes; 678 * Base cftypes which are automatically registered. The two can
679 * point to the same array.
680 */
681 struct cftype *dfl_cftypes; /* for the default hierarchy */
682 struct cftype *legacy_cftypes; /* for the legacy hierarchies */
683
684 /*
685 * A subsystem may depend on other subsystems. When such subsystem
686 * is enabled on a cgroup, the depended-upon subsystems are enabled
687 * together if available. Subsystems enabled due to dependency are
688 * not visible to userland until explicitly enabled. The following
689 * specifies the mask of subsystems that this one depends on.
690 */
691 unsigned int depends_on;
623}; 692};
624 693
625#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys; 694#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys;
@@ -627,19 +696,6 @@ struct cgroup_subsys {
627#undef SUBSYS 696#undef SUBSYS
628 697
629/** 698/**
630 * css_parent - find the parent css
631 * @css: the target cgroup_subsys_state
632 *
633 * Return the parent css of @css. This function is guaranteed to return
634 * non-NULL parent as long as @css isn't the root.
635 */
636static inline
637struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
638{
639 return css->parent;
640}
641
642/**
643 * task_css_set_check - obtain a task's css_set with extra access conditions 699 * task_css_set_check - obtain a task's css_set with extra access conditions
644 * @task: the task to obtain css_set for 700 * @task: the task to obtain css_set for
645 * @__c: extra condition expression to be passed to rcu_dereference_check() 701 * @__c: extra condition expression to be passed to rcu_dereference_check()
@@ -731,14 +787,14 @@ struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss);
731 * @pos: the css * to use as the loop cursor 787 * @pos: the css * to use as the loop cursor
732 * @parent: css whose children to walk 788 * @parent: css whose children to walk
733 * 789 *
734 * Walk @parent's children. Must be called under rcu_read_lock(). A child 790 * Walk @parent's children. Must be called under rcu_read_lock().
735 * css which hasn't finished ->css_online() or already has finished
736 * ->css_offline() may show up during traversal and it's each subsystem's
737 * responsibility to verify that each @pos is alive.
738 * 791 *
739 * If a subsystem synchronizes against the parent in its ->css_online() and 792 * If a subsystem synchronizes ->css_online() and the start of iteration, a
740 * before starting iterating, a css which finished ->css_online() is 793 * css which finished ->css_online() is guaranteed to be visible in the
741 * guaranteed to be visible in the future iterations. 794 * future iterations and will stay visible until the last reference is put.
795 * A css which hasn't finished ->css_online() or already finished
796 * ->css_offline() may show up during traversal. It's each subsystem's
797 * responsibility to synchronize against on/offlining.
742 * 798 *
743 * It is allowed to temporarily drop RCU read lock during iteration. The 799 * It is allowed to temporarily drop RCU read lock during iteration. The
744 * caller is responsible for ensuring that @pos remains accessible until 800 * caller is responsible for ensuring that @pos remains accessible until
@@ -761,17 +817,16 @@ css_rightmost_descendant(struct cgroup_subsys_state *pos);
761 * @root: css whose descendants to walk 817 * @root: css whose descendants to walk
762 * 818 *
763 * Walk @root's descendants. @root is included in the iteration and the 819 * Walk @root's descendants. @root is included in the iteration and the
764 * first node to be visited. Must be called under rcu_read_lock(). A 820 * first node to be visited. Must be called under rcu_read_lock().
765 * descendant css which hasn't finished ->css_online() or already has
766 * finished ->css_offline() may show up during traversal and it's each
767 * subsystem's responsibility to verify that each @pos is alive.
768 * 821 *
769 * If a subsystem synchronizes against the parent in its ->css_online() and 822 * If a subsystem synchronizes ->css_online() and the start of iteration, a
770 * before starting iterating, and synchronizes against @pos on each 823 * css which finished ->css_online() is guaranteed to be visible in the
771 * iteration, any descendant css which finished ->css_online() is 824 * future iterations and will stay visible until the last reference is put.
772 * guaranteed to be visible in the future iterations. 825 * A css which hasn't finished ->css_online() or already finished
826 * ->css_offline() may show up during traversal. It's each subsystem's
827 * responsibility to synchronize against on/offlining.
773 * 828 *
774 * In other words, the following guarantees that a descendant can't escape 829 * For example, the following guarantees that a descendant can't escape
775 * state updates of its ancestors. 830 * state updates of its ancestors.
776 * 831 *
777 * my_online(@css) 832 * my_online(@css)
@@ -827,18 +882,34 @@ css_next_descendant_post(struct cgroup_subsys_state *pos,
827 * 882 *
828 * Similar to css_for_each_descendant_pre() but performs post-order 883 * Similar to css_for_each_descendant_pre() but performs post-order
829 * traversal instead. @root is included in the iteration and the last 884 * traversal instead. @root is included in the iteration and the last
830 * node to be visited. Note that the walk visibility guarantee described 885 * node to be visited.
831 * in pre-order walk doesn't apply the same to post-order walks. 886 *
887 * If a subsystem synchronizes ->css_online() and the start of iteration, a
888 * css which finished ->css_online() is guaranteed to be visible in the
889 * future iterations and will stay visible until the last reference is put.
890 * A css which hasn't finished ->css_online() or already finished
891 * ->css_offline() may show up during traversal. It's each subsystem's
892 * responsibility to synchronize against on/offlining.
893 *
894 * Note that the walk visibility guarantee example described in pre-order
895 * walk doesn't apply the same to post-order walks.
832 */ 896 */
833#define css_for_each_descendant_post(pos, css) \ 897#define css_for_each_descendant_post(pos, css) \
834 for ((pos) = css_next_descendant_post(NULL, (css)); (pos); \ 898 for ((pos) = css_next_descendant_post(NULL, (css)); (pos); \
835 (pos) = css_next_descendant_post((pos), (css))) 899 (pos) = css_next_descendant_post((pos), (css)))
836 900
901bool css_has_online_children(struct cgroup_subsys_state *css);
902
837/* A css_task_iter should be treated as an opaque object */ 903/* A css_task_iter should be treated as an opaque object */
838struct css_task_iter { 904struct css_task_iter {
839 struct cgroup_subsys_state *origin_css; 905 struct cgroup_subsys *ss;
840 struct list_head *cset_link; 906
841 struct list_head *task; 907 struct list_head *cset_pos;
908 struct list_head *cset_head;
909
910 struct list_head *task_pos;
911 struct list_head *tasks_head;
912 struct list_head *mg_tasks_head;
842}; 913};
843 914
844void css_task_iter_start(struct cgroup_subsys_state *css, 915void css_task_iter_start(struct cgroup_subsys_state *css,
@@ -849,8 +920,8 @@ void css_task_iter_end(struct css_task_iter *it);
849int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 920int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
850int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 921int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
851 922
852struct cgroup_subsys_state *css_tryget_from_dir(struct dentry *dentry, 923struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
853 struct cgroup_subsys *ss); 924 struct cgroup_subsys *ss);
854 925
855#else /* !CONFIG_CGROUPS */ 926#else /* !CONFIG_CGROUPS */
856 927
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 768fe44e19f0..98c4f9b12b03 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -7,10 +7,6 @@
7SUBSYS(cpuset) 7SUBSYS(cpuset)
8#endif 8#endif
9 9
10#if IS_ENABLED(CONFIG_CGROUP_DEBUG)
11SUBSYS(debug)
12#endif
13
14#if IS_ENABLED(CONFIG_CGROUP_SCHED) 10#if IS_ENABLED(CONFIG_CGROUP_SCHED)
15SUBSYS(cpu) 11SUBSYS(cpu)
16#endif 12#endif
@@ -50,6 +46,13 @@ SUBSYS(net_prio)
50#if IS_ENABLED(CONFIG_CGROUP_HUGETLB) 46#if IS_ENABLED(CONFIG_CGROUP_HUGETLB)
51SUBSYS(hugetlb) 47SUBSYS(hugetlb)
52#endif 48#endif
49
50/*
51 * The following subsystems are not supported on the default hierarchy.
52 */
53#if IS_ENABLED(CONFIG_CGROUP_DEBUG)
54SUBSYS(debug)
55#endif
53/* 56/*
54 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS. 57 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
55 */ 58 */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 0c287dbbb144..411dd7eb2653 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -619,5 +619,10 @@ static inline void clk_writel(u32 val, u32 __iomem *reg)
619 619
620#endif /* platform dependent I/O accessors */ 620#endif /* platform dependent I/O accessors */
621 621
622#ifdef CONFIG_DEBUG_FS
623struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode,
624 void *data, const struct file_operations *fops);
625#endif
626
622#endif /* CONFIG_COMMON_CLK */ 627#endif /* CONFIG_COMMON_CLK */
623#endif /* CLK_PROVIDER_H */ 628#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk/clk-conf.h b/include/linux/clk/clk-conf.h
new file mode 100644
index 000000000000..f3050e15f833
--- /dev/null
+++ b/include/linux/clk/clk-conf.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2014 Samsung Electronics Co., Ltd.
3 * Sylwester Nawrocki <s.nawrocki@samsung.com>
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 version 2 as
7 * published by the Free Software Foundation.
8 */
9
10struct device_node;
11
12#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
13int of_clk_set_defaults(struct device_node *node, bool clk_supplier);
14#else
15static inline int of_clk_set_defaults(struct device_node *node,
16 bool clk_supplier)
17{
18 return 0;
19}
20#endif
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index 4a21a872dbbd..e8d8a35034a5 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -41,6 +41,8 @@
41 * @idlest_reg: register containing the DPLL idle status bitfield 41 * @idlest_reg: register containing the DPLL idle status bitfield
42 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg 42 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
43 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg 43 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
44 * @dcc_mask: mask of the DPLL DCC correction bitfield @mult_div1_reg
45 * @dcc_rate: rate atleast which DCC @dcc_mask must be set
44 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg 46 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
45 * @lpmode_mask: mask of the DPLL low-power mode bitfield in @control_reg 47 * @lpmode_mask: mask of the DPLL low-power mode bitfield in @control_reg
46 * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in @control_reg 48 * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in @control_reg
@@ -86,6 +88,8 @@ struct dpll_data {
86 u32 idlest_mask; 88 u32 idlest_mask;
87 u32 dco_mask; 89 u32 dco_mask;
88 u32 sddiv_mask; 90 u32 sddiv_mask;
91 u32 dcc_mask;
92 unsigned long dcc_rate;
89 u32 lpmode_mask; 93 u32 lpmode_mask;
90 u32 m4xen_mask; 94 u32 m4xen_mask;
91 u8 auto_recal_bit; 95 u8 auto_recal_bit;
@@ -94,7 +98,26 @@ struct dpll_data {
94 u8 flags; 98 u8 flags;
95}; 99};
96 100
97struct clk_hw_omap_ops; 101struct clk_hw_omap;
102
103/**
104 * struct clk_hw_omap_ops - OMAP clk ops
105 * @find_idlest: find idlest register information for a clock
106 * @find_companion: find companion clock register information for a clock,
107 * basically converts CM_ICLKEN* <-> CM_FCLKEN*
108 * @allow_idle: enables autoidle hardware functionality for a clock
109 * @deny_idle: prevent autoidle hardware functionality for a clock
110 */
111struct clk_hw_omap_ops {
112 void (*find_idlest)(struct clk_hw_omap *oclk,
113 void __iomem **idlest_reg,
114 u8 *idlest_bit, u8 *idlest_val);
115 void (*find_companion)(struct clk_hw_omap *oclk,
116 void __iomem **other_reg,
117 u8 *other_bit);
118 void (*allow_idle)(struct clk_hw_omap *oclk);
119 void (*deny_idle)(struct clk_hw_omap *oclk);
120};
98 121
99/** 122/**
100 * struct clk_hw_omap - OMAP struct clk 123 * struct clk_hw_omap - OMAP struct clk
@@ -259,6 +282,12 @@ int omap2_dflt_clk_enable(struct clk_hw *hw);
259void omap2_dflt_clk_disable(struct clk_hw *hw); 282void omap2_dflt_clk_disable(struct clk_hw *hw);
260int omap2_dflt_clk_is_enabled(struct clk_hw *hw); 283int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
261void omap3_clk_lock_dpll5(void); 284void omap3_clk_lock_dpll5(void);
285unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
286 unsigned long parent_rate);
287int omap2_reprogram_dpllcore(struct clk_hw *clk, unsigned long rate,
288 unsigned long parent_rate);
289void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw);
290void omap2xxx_clkt_vps_init(void);
262 291
263void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index); 292void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index);
264void ti_dt_clocks_register(struct ti_dt_clk *oclks); 293void ti_dt_clocks_register(struct ti_dt_clk *oclks);
@@ -278,6 +307,8 @@ int omap5xxx_dt_clk_init(void);
278int dra7xx_dt_clk_init(void); 307int dra7xx_dt_clk_init(void);
279int am33xx_dt_clk_init(void); 308int am33xx_dt_clk_init(void);
280int am43xx_dt_clk_init(void); 309int am43xx_dt_clk_init(void);
310int omap2420_dt_clk_init(void);
311int omap2430_dt_clk_init(void);
281 312
282#ifdef CONFIG_OF 313#ifdef CONFIG_OF
283void of_ti_clk_allow_autoidle_all(void); 314void of_ti_clk_allow_autoidle_all(void);
@@ -287,6 +318,8 @@ static inline void of_ti_clk_allow_autoidle_all(void) { }
287static inline void of_ti_clk_deny_autoidle_all(void) { } 318static inline void of_ti_clk_deny_autoidle_all(void) { }
288#endif 319#endif
289 320
321extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
322extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
290extern const struct clk_hw_omap_ops clkhwops_omap3_dpll; 323extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;
291extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx; 324extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx;
292extern const struct clk_hw_omap_ops clkhwops_wait; 325extern const struct clk_hw_omap_ops clkhwops_wait;
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 64fdfe1cfcf0..d5ad7b1118fc 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -383,7 +383,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
383/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ 383/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
384#ifdef CONFIG_KPROBES 384#ifdef CONFIG_KPROBES
385# define __kprobes __attribute__((__section__(".kprobes.text"))) 385# define __kprobes __attribute__((__section__(".kprobes.text")))
386# define nokprobe_inline __always_inline
386#else 387#else
387# define __kprobes 388# define __kprobes
389# define nokprobe_inline inline
388#endif 390#endif
389#endif /* __LINUX_COMPILER_H */ 391#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 3f458896d45c..8f8ae95c6e27 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -75,6 +75,7 @@ struct cpufreq_policy {
75 unsigned int max; /* in kHz */ 75 unsigned int max; /* in kHz */
76 unsigned int cur; /* in kHz, only needed if cpufreq 76 unsigned int cur; /* in kHz, only needed if cpufreq
77 * governors are used */ 77 * governors are used */
78 unsigned int restore_freq; /* = policy->cur before transition */
78 unsigned int suspend_freq; /* freq to set during suspend */ 79 unsigned int suspend_freq; /* freq to set during suspend */
79 80
80 unsigned int policy; /* see above */ 81 unsigned int policy; /* see above */
@@ -221,11 +222,35 @@ struct cpufreq_driver {
221 222
222 /* define one out of two */ 223 /* define one out of two */
223 int (*setpolicy) (struct cpufreq_policy *policy); 224 int (*setpolicy) (struct cpufreq_policy *policy);
225
226 /*
227 * On failure, should always restore frequency to policy->restore_freq
228 * (i.e. old freq).
229 */
224 int (*target) (struct cpufreq_policy *policy, /* Deprecated */ 230 int (*target) (struct cpufreq_policy *policy, /* Deprecated */
225 unsigned int target_freq, 231 unsigned int target_freq,
226 unsigned int relation); 232 unsigned int relation);
227 int (*target_index) (struct cpufreq_policy *policy, 233 int (*target_index) (struct cpufreq_policy *policy,
228 unsigned int index); 234 unsigned int index);
235 /*
236 * Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION
237 * unset.
238 *
239 * get_intermediate should return a stable intermediate frequency
240 * platform wants to switch to and target_intermediate() should set CPU
241 * to to that frequency, before jumping to the frequency corresponding
242 * to 'index'. Core will take care of sending notifications and driver
243 * doesn't have to handle them in target_intermediate() or
244 * target_index().
245 *
246 * Drivers can return '0' from get_intermediate() in case they don't
247 * wish to switch to intermediate frequency for some target frequency.
248 * In that case core will directly call ->target_index().
249 */
250 unsigned int (*get_intermediate)(struct cpufreq_policy *policy,
251 unsigned int index);
252 int (*target_intermediate)(struct cpufreq_policy *policy,
253 unsigned int index);
229 254
230 /* should be defined, if possible */ 255 /* should be defined, if possible */
231 unsigned int (*get) (unsigned int cpu); 256 unsigned int (*get) (unsigned int cpu);
@@ -457,8 +482,8 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
457 *********************************************************************/ 482 *********************************************************************/
458 483
459/* Special Values of .frequency field */ 484/* Special Values of .frequency field */
460#define CPUFREQ_ENTRY_INVALID ~0 485#define CPUFREQ_ENTRY_INVALID ~0u
461#define CPUFREQ_TABLE_END ~1 486#define CPUFREQ_TABLE_END ~1u
462/* Special Values of .flags field */ 487/* Special Values of .flags field */
463#define CPUFREQ_BOOST_FREQ (1 << 0) 488#define CPUFREQ_BOOST_FREQ (1 << 0)
464 489
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index c51a436135c4..25e0df6155a4 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -84,6 +84,7 @@ struct cpuidle_device {
84}; 84};
85 85
86DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 86DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
87DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
87 88
88/** 89/**
89 * cpuidle_get_last_residency - retrieves the last state's residency time 90 * cpuidle_get_last_residency - retrieves the last state's residency time
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d08e4d2a9b92..2997af6d2ccd 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -142,6 +142,13 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask,
142 return 1; 142 return 1;
143} 143}
144 144
145static inline int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
146{
147 set_bit(0, cpumask_bits(dstp));
148
149 return 0;
150}
151
145#define for_each_cpu(cpu, mask) \ 152#define for_each_cpu(cpu, mask) \
146 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 153 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
147#define for_each_cpu_not(cpu, mask) \ 154#define for_each_cpu_not(cpu, mask) \
@@ -192,6 +199,7 @@ static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp)
192 199
193int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); 200int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *);
194int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); 201int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
202int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
195 203
196/** 204/**
197 * for_each_cpu - iterate over every cpu in a mask 205 * for_each_cpu - iterate over every cpu in a mask
@@ -600,7 +608,7 @@ static inline int cpulist_scnprintf(char *buf, int len,
600static inline int cpumask_parse(const char *buf, struct cpumask *dstp) 608static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
601{ 609{
602 char *nl = strchr(buf, '\n'); 610 char *nl = strchr(buf, '\n');
603 int len = nl ? nl - buf : strlen(buf); 611 unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
604 612
605 return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits); 613 return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
606} 614}
diff --git a/include/linux/crc7.h b/include/linux/crc7.h
index 1786e772d5c6..d590765106f3 100644
--- a/include/linux/crc7.h
+++ b/include/linux/crc7.h
@@ -2,13 +2,13 @@
2#define _LINUX_CRC7_H 2#define _LINUX_CRC7_H
3#include <linux/types.h> 3#include <linux/types.h>
4 4
5extern const u8 crc7_syndrome_table[256]; 5extern const u8 crc7_be_syndrome_table[256];
6 6
7static inline u8 crc7_byte(u8 crc, u8 data) 7static inline u8 crc7_be_byte(u8 crc, u8 data)
8{ 8{
9 return crc7_syndrome_table[(crc << 1) ^ data]; 9 return crc7_be_syndrome_table[crc ^ data];
10} 10}
11 11
12extern u8 crc7(u8 crc, const u8 *buffer, size_t len); 12extern u8 crc7_be(u8 crc, const u8 *buffer, size_t len);
13 13
14#endif 14#endif
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index b92eadf92d72..d45e949699ea 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -710,9 +710,9 @@ static inline void ablkcipher_request_free(struct ablkcipher_request *req)
710 710
711static inline void ablkcipher_request_set_callback( 711static inline void ablkcipher_request_set_callback(
712 struct ablkcipher_request *req, 712 struct ablkcipher_request *req,
713 u32 flags, crypto_completion_t complete, void *data) 713 u32 flags, crypto_completion_t compl, void *data)
714{ 714{
715 req->base.complete = complete; 715 req->base.complete = compl;
716 req->base.data = data; 716 req->base.data = data;
717 req->base.flags = flags; 717 req->base.flags = flags;
718} 718}
@@ -841,10 +841,10 @@ static inline void aead_request_free(struct aead_request *req)
841 841
842static inline void aead_request_set_callback(struct aead_request *req, 842static inline void aead_request_set_callback(struct aead_request *req,
843 u32 flags, 843 u32 flags,
844 crypto_completion_t complete, 844 crypto_completion_t compl,
845 void *data) 845 void *data)
846{ 846{
847 req->base.complete = complete; 847 req->base.complete = compl;
848 req->base.data = data; 848 req->base.data = data;
849 req->base.flags = flags; 849 req->base.flags = flags;
850} 850}
diff --git a/include/linux/dell-led.h b/include/linux/dell-led.h
new file mode 100644
index 000000000000..7009b8bec77b
--- /dev/null
+++ b/include/linux/dell-led.h
@@ -0,0 +1,10 @@
1#ifndef __DELL_LED_H__
2#define __DELL_LED_H__
3
4enum {
5 DELL_LED_MICMUTE,
6};
7
8int dell_app_wmi_led_set(int whichled, int on);
9
10#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 63da56ed9796..e1707de043ae 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -115,12 +115,6 @@ typedef int (*dm_busy_fn) (struct dm_target *ti);
115 115
116void dm_error(const char *message); 116void dm_error(const char *message);
117 117
118/*
119 * Combine device limits.
120 */
121int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
122 sector_t start, sector_t len, void *data);
123
124struct dm_dev { 118struct dm_dev {
125 struct block_device *bdev; 119 struct block_device *bdev;
126 fmode_t mode; 120 fmode_t mode;
@@ -132,7 +126,7 @@ struct dm_dev {
132 * are opened/closed correctly. 126 * are opened/closed correctly.
133 */ 127 */
134int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, 128int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
135 struct dm_dev **result); 129 struct dm_dev **result);
136void dm_put_device(struct dm_target *ti, struct dm_dev *d); 130void dm_put_device(struct dm_target *ti, struct dm_dev *d);
137 131
138/* 132/*
@@ -291,6 +285,7 @@ struct dm_target_io {
291 struct dm_io *io; 285 struct dm_io *io;
292 struct dm_target *ti; 286 struct dm_target *ti;
293 unsigned target_bio_nr; 287 unsigned target_bio_nr;
288 unsigned *len_ptr;
294 struct bio clone; 289 struct bio clone;
295}; 290};
296 291
@@ -401,6 +396,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
401struct gendisk *dm_disk(struct mapped_device *md); 396struct gendisk *dm_disk(struct mapped_device *md);
402int dm_suspended(struct dm_target *ti); 397int dm_suspended(struct dm_target *ti);
403int dm_noflush_suspending(struct dm_target *ti); 398int dm_noflush_suspending(struct dm_target *ti);
399void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors);
404union map_info *dm_get_rq_mapinfo(struct request *rq); 400union map_info *dm_get_rq_mapinfo(struct request *rq);
405 401
406struct queue_limits *dm_get_queue_limits(struct mapped_device *md); 402struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 72cb0ddb9678..d2c5cc7c583c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -292,7 +292,7 @@ struct dma_chan_dev {
292}; 292};
293 293
294/** 294/**
295 * enum dma_slave_buswidth - defines bus with of the DMA slave 295 * enum dma_slave_buswidth - defines bus width of the DMA slave
296 * device, source or target buses 296 * device, source or target buses
297 */ 297 */
298enum dma_slave_buswidth { 298enum dma_slave_buswidth {
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 41bbf8ba4ba8..efc681fd5895 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -20,6 +20,7 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/pfn.h> 21#include <linux/pfn.h>
22#include <linux/pstore.h> 22#include <linux/pstore.h>
23#include <linux/reboot.h>
23 24
24#include <asm/page.h> 25#include <asm/page.h>
25 26
@@ -521,6 +522,8 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
521 int *reset_type); 522 int *reset_type);
522typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size); 523typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size);
523 524
525void efi_native_runtime_setup(void);
526
524/* 527/*
525 * EFI Configuration Table and GUID definitions 528 * EFI Configuration Table and GUID definitions
526 */ 529 */
@@ -870,11 +873,13 @@ extern int __init efi_uart_console_only (void);
870extern void efi_initialize_iomem_resources(struct resource *code_resource, 873extern void efi_initialize_iomem_resources(struct resource *code_resource,
871 struct resource *data_resource, struct resource *bss_resource); 874 struct resource *data_resource, struct resource *bss_resource);
872extern void efi_get_time(struct timespec *now); 875extern void efi_get_time(struct timespec *now);
873extern int efi_set_rtc_mmss(const struct timespec *now);
874extern void efi_reserve_boot_services(void); 876extern void efi_reserve_boot_services(void);
875extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose); 877extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose);
876extern struct efi_memory_map memmap; 878extern struct efi_memory_map memmap;
877 879
880extern int efi_reboot_quirk_mode;
881extern bool efi_poweroff_required(void);
882
878/* Iterate through an efi_memory_map */ 883/* Iterate through an efi_memory_map */
879#define for_each_efi_memory_desc(m, md) \ 884#define for_each_efi_memory_desc(m, md) \
880 for ((md) = (m)->map; \ 885 for ((md) = (m)->map; \
@@ -916,7 +921,8 @@ extern int __init efi_setup_pcdp_console(char *);
916#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ 921#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
917#define EFI_MEMMAP 4 /* Can we use EFI memory map? */ 922#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
918#define EFI_64BIT 5 /* Is the firmware 64-bit? */ 923#define EFI_64BIT 5 /* Is the firmware 64-bit? */
919#define EFI_ARCH_1 6 /* First arch-specific bit */ 924#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */
925#define EFI_ARCH_1 7 /* First arch-specific bit */
920 926
921#ifdef CONFIG_EFI 927#ifdef CONFIG_EFI
922/* 928/*
@@ -926,11 +932,14 @@ static inline bool efi_enabled(int feature)
926{ 932{
927 return test_bit(feature, &efi.flags) != 0; 933 return test_bit(feature, &efi.flags) != 0;
928} 934}
935extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
929#else 936#else
930static inline bool efi_enabled(int feature) 937static inline bool efi_enabled(int feature)
931{ 938{
932 return false; 939 return false;
933} 940}
941static inline void
942efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
934#endif 943#endif
935 944
936/* 945/*
@@ -1031,12 +1040,8 @@ struct efivar_operations {
1031struct efivars { 1040struct efivars {
1032 /* 1041 /*
1033 * ->lock protects two things: 1042 * ->lock protects two things:
1034 * 1) ->list - adds, removals, reads, writes 1043 * 1) efivarfs_list and efivars_sysfs_list
1035 * 2) ops.[gs]et_variable() calls. 1044 * 2) ->ops calls
1036 * It must not be held when creating sysfs entries or calling kmalloc.
1037 * ops.get_next_variable() is only called from register_efivars()
1038 * or efivar_update_sysfs_entries(),
1039 * which is protected by the BKL, so that path is safe.
1040 */ 1045 */
1041 spinlock_t lock; 1046 spinlock_t lock;
1042 struct kset *kset; 1047 struct kset *kset;
@@ -1161,4 +1166,46 @@ static inline void
1161efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {} 1166efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {}
1162#endif 1167#endif
1163 1168
1169/* prototypes shared between arch specific and generic stub code */
1170
1171#define pr_efi(sys_table, msg) efi_printk(sys_table, "EFI stub: "msg)
1172#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
1173
1174void efi_printk(efi_system_table_t *sys_table_arg, char *str);
1175
1176void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
1177 unsigned long addr);
1178
1179char *efi_convert_cmdline(efi_system_table_t *sys_table_arg,
1180 efi_loaded_image_t *image, int *cmd_line_len);
1181
1182efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
1183 efi_memory_desc_t **map,
1184 unsigned long *map_size,
1185 unsigned long *desc_size,
1186 u32 *desc_ver,
1187 unsigned long *key_ptr);
1188
1189efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
1190 unsigned long size, unsigned long align,
1191 unsigned long *addr);
1192
1193efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
1194 unsigned long size, unsigned long align,
1195 unsigned long *addr, unsigned long max);
1196
1197efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg,
1198 unsigned long *image_addr,
1199 unsigned long image_size,
1200 unsigned long alloc_size,
1201 unsigned long preferred_addr,
1202 unsigned long alignment);
1203
1204efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
1205 efi_loaded_image_t *image,
1206 char *cmd_line, char *option_string,
1207 unsigned long max_addr,
1208 unsigned long *load_addr,
1209 unsigned long *load_size);
1210
1164#endif /* _LINUX_EFI_H */ 1211#endif /* _LINUX_EFI_H */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index df63bd3a8cf1..45a91474487d 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -133,7 +133,6 @@ extern struct request *elv_latter_request(struct request_queue *, struct request
133extern int elv_register_queue(struct request_queue *q); 133extern int elv_register_queue(struct request_queue *q);
134extern void elv_unregister_queue(struct request_queue *q); 134extern void elv_unregister_queue(struct request_queue *q);
135extern int elv_may_queue(struct request_queue *, int); 135extern int elv_may_queue(struct request_queue *, int);
136extern void elv_abort_queue(struct request_queue *);
137extern void elv_completed_request(struct request_queue *, struct request *); 136extern void elv_completed_request(struct request_queue *, struct request *);
138extern int elv_set_request(struct request_queue *q, struct request *rq, 137extern int elv_set_request(struct request_queue *q, struct request *rq,
139 struct bio *bio, gfp_t gfp_mask); 138 struct bio *bio, gfp_t gfp_mask);
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 0a114d05f68d..e658229fee39 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -154,13 +154,20 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
154 * @reset: Reset (part of) the device, as specified by a bitmask of 154 * @reset: Reset (part of) the device, as specified by a bitmask of
155 * flags from &enum ethtool_reset_flags. Returns a negative 155 * flags from &enum ethtool_reset_flags. Returns a negative
156 * error code or zero. 156 * error code or zero.
157 * @get_rxfh_key_size: Get the size of the RX flow hash key.
158 * Returns zero if not supported for this specific device.
157 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table. 159 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
158 * Returns zero if not supported for this specific device. 160 * Returns zero if not supported for this specific device.
159 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. 161 * @get_rxfh: Get the contents of the RX flow hash indirection table and hash
160 * Will not be called if @get_rxfh_indir_size returns zero. 162 * key.
163 * Will only be called if one or both of @get_rxfh_indir_size and
164 * @get_rxfh_key_size are implemented and return non-zero.
161 * Returns a negative error code or zero. 165 * Returns a negative error code or zero.
162 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. 166 * @set_rxfh: Set the contents of the RX flow hash indirection table and/or
163 * Will not be called if @get_rxfh_indir_size returns zero. 167 * hash key. In case only the indirection table or hash key is to be
168 * changed, the other argument will be %NULL.
169 * Will only be called if one or both of @get_rxfh_indir_size and
170 * @get_rxfh_key_size are implemented and return non-zero.
164 * Returns a negative error code or zero. 171 * Returns a negative error code or zero.
165 * @get_channels: Get number of channels. 172 * @get_channels: Get number of channels.
166 * @set_channels: Set number of channels. Returns a negative error code or 173 * @set_channels: Set number of channels. Returns a negative error code or
@@ -232,9 +239,11 @@ struct ethtool_ops {
232 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 239 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
233 int (*flash_device)(struct net_device *, struct ethtool_flash *); 240 int (*flash_device)(struct net_device *, struct ethtool_flash *);
234 int (*reset)(struct net_device *, u32 *); 241 int (*reset)(struct net_device *, u32 *);
242 u32 (*get_rxfh_key_size)(struct net_device *);
235 u32 (*get_rxfh_indir_size)(struct net_device *); 243 u32 (*get_rxfh_indir_size)(struct net_device *);
236 int (*get_rxfh_indir)(struct net_device *, u32 *); 244 int (*get_rxfh)(struct net_device *, u32 *indir, u8 *key);
237 int (*set_rxfh_indir)(struct net_device *, const u32 *); 245 int (*set_rxfh)(struct net_device *, const u32 *indir,
246 const u8 *key);
238 void (*get_channels)(struct net_device *, struct ethtool_channels *); 247 void (*get_channels)(struct net_device *, struct ethtool_channels *);
239 int (*set_channels)(struct net_device *, struct ethtool_channels *); 248 int (*set_channels)(struct net_device *, struct ethtool_channels *);
240 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); 249 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index df53e1753a76..6ff0b0b42d47 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -19,6 +19,7 @@
19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */ 19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */ 20#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */ 21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE)
22 23
23#define NULL_ADDR ((block_t)0) /* used as block_t addresses */ 24#define NULL_ADDR ((block_t)0) /* used as block_t addresses */
24#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ 25#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
@@ -75,6 +76,7 @@ struct f2fs_super_block {
75 __le16 volume_name[512]; /* volume name */ 76 __le16 volume_name[512]; /* volume name */
76 __le32 extension_count; /* # of extensions below */ 77 __le32 extension_count; /* # of extensions below */
77 __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */ 78 __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */
79 __le32 cp_payload;
78} __packed; 80} __packed;
79 81
80/* 82/*
@@ -146,6 +148,9 @@ struct f2fs_extent {
146#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ 148#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
147#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ 149#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
148 150
151#define ADDRS_PER_PAGE(page, fi) \
152 (IS_INODE(page) ? ADDRS_PER_INODE(fi) : ADDRS_PER_BLOCK)
153
149#define NODE_DIR1_BLOCK (DEF_ADDRS_PER_INODE + 1) 154#define NODE_DIR1_BLOCK (DEF_ADDRS_PER_INODE + 1)
150#define NODE_DIR2_BLOCK (DEF_ADDRS_PER_INODE + 2) 155#define NODE_DIR2_BLOCK (DEF_ADDRS_PER_INODE + 2)
151#define NODE_IND1_BLOCK (DEF_ADDRS_PER_INODE + 3) 156#define NODE_IND1_BLOCK (DEF_ADDRS_PER_INODE + 3)
@@ -391,6 +396,9 @@ typedef __le32 f2fs_hash_t;
391/* MAX level for dir lookup */ 396/* MAX level for dir lookup */
392#define MAX_DIR_HASH_DEPTH 63 397#define MAX_DIR_HASH_DEPTH 63
393 398
399/* MAX buckets in one level of dir */
400#define MAX_DIR_BUCKETS (1 << ((MAX_DIR_HASH_DEPTH / 2) - 1))
401
394#define SIZE_OF_DIR_ENTRY 11 /* by byte */ 402#define SIZE_OF_DIR_ENTRY 11 /* by byte */
395#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \ 403#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
396 BITS_PER_BYTE) 404 BITS_PER_BYTE)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 024fd03e5d18..a7e3c48d73a7 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -37,21 +37,270 @@
37#define BPF_CALL 0x80 /* function call */ 37#define BPF_CALL 0x80 /* function call */
38#define BPF_EXIT 0x90 /* function return */ 38#define BPF_EXIT 0x90 /* function return */
39 39
40/* Register numbers */
41enum {
42 BPF_REG_0 = 0,
43 BPF_REG_1,
44 BPF_REG_2,
45 BPF_REG_3,
46 BPF_REG_4,
47 BPF_REG_5,
48 BPF_REG_6,
49 BPF_REG_7,
50 BPF_REG_8,
51 BPF_REG_9,
52 BPF_REG_10,
53 __MAX_BPF_REG,
54};
55
40/* BPF has 10 general purpose 64-bit registers and stack frame. */ 56/* BPF has 10 general purpose 64-bit registers and stack frame. */
41#define MAX_BPF_REG 11 57#define MAX_BPF_REG __MAX_BPF_REG
58
59/* ArgX, context and stack frame pointer register positions. Note,
60 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
61 * calls in BPF_CALL instruction.
62 */
63#define BPF_REG_ARG1 BPF_REG_1
64#define BPF_REG_ARG2 BPF_REG_2
65#define BPF_REG_ARG3 BPF_REG_3
66#define BPF_REG_ARG4 BPF_REG_4
67#define BPF_REG_ARG5 BPF_REG_5
68#define BPF_REG_CTX BPF_REG_6
69#define BPF_REG_FP BPF_REG_10
70
71/* Additional register mappings for converted user programs. */
72#define BPF_REG_A BPF_REG_0
73#define BPF_REG_X BPF_REG_7
74#define BPF_REG_TMP BPF_REG_8
42 75
43/* BPF program can access up to 512 bytes of stack space. */ 76/* BPF program can access up to 512 bytes of stack space. */
44#define MAX_BPF_STACK 512 77#define MAX_BPF_STACK 512
45 78
46/* Arg1, context and stack frame pointer register positions. */ 79/* Helper macros for filter block array initializers. */
47#define ARG1_REG 1 80
48#define CTX_REG 6 81/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
49#define FP_REG 10 82
83#define BPF_ALU64_REG(OP, DST, SRC) \
84 ((struct sock_filter_int) { \
85 .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \
86 .dst_reg = DST, \
87 .src_reg = SRC, \
88 .off = 0, \
89 .imm = 0 })
90
91#define BPF_ALU32_REG(OP, DST, SRC) \
92 ((struct sock_filter_int) { \
93 .code = BPF_ALU | BPF_OP(OP) | BPF_X, \
94 .dst_reg = DST, \
95 .src_reg = SRC, \
96 .off = 0, \
97 .imm = 0 })
98
99/* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */
100
101#define BPF_ALU64_IMM(OP, DST, IMM) \
102 ((struct sock_filter_int) { \
103 .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \
104 .dst_reg = DST, \
105 .src_reg = 0, \
106 .off = 0, \
107 .imm = IMM })
108
109#define BPF_ALU32_IMM(OP, DST, IMM) \
110 ((struct sock_filter_int) { \
111 .code = BPF_ALU | BPF_OP(OP) | BPF_K, \
112 .dst_reg = DST, \
113 .src_reg = 0, \
114 .off = 0, \
115 .imm = IMM })
116
117/* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */
118
119#define BPF_ENDIAN(TYPE, DST, LEN) \
120 ((struct sock_filter_int) { \
121 .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \
122 .dst_reg = DST, \
123 .src_reg = 0, \
124 .off = 0, \
125 .imm = LEN })
126
127/* Short form of mov, dst_reg = src_reg */
128
129#define BPF_MOV64_REG(DST, SRC) \
130 ((struct sock_filter_int) { \
131 .code = BPF_ALU64 | BPF_MOV | BPF_X, \
132 .dst_reg = DST, \
133 .src_reg = SRC, \
134 .off = 0, \
135 .imm = 0 })
136
137#define BPF_MOV32_REG(DST, SRC) \
138 ((struct sock_filter_int) { \
139 .code = BPF_ALU | BPF_MOV | BPF_X, \
140 .dst_reg = DST, \
141 .src_reg = SRC, \
142 .off = 0, \
143 .imm = 0 })
144
145/* Short form of mov, dst_reg = imm32 */
146
147#define BPF_MOV64_IMM(DST, IMM) \
148 ((struct sock_filter_int) { \
149 .code = BPF_ALU64 | BPF_MOV | BPF_K, \
150 .dst_reg = DST, \
151 .src_reg = 0, \
152 .off = 0, \
153 .imm = IMM })
154
155#define BPF_MOV32_IMM(DST, IMM) \
156 ((struct sock_filter_int) { \
157 .code = BPF_ALU | BPF_MOV | BPF_K, \
158 .dst_reg = DST, \
159 .src_reg = 0, \
160 .off = 0, \
161 .imm = IMM })
162
163/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */
164
165#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \
166 ((struct sock_filter_int) { \
167 .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \
168 .dst_reg = DST, \
169 .src_reg = SRC, \
170 .off = 0, \
171 .imm = IMM })
172
173#define BPF_MOV32_RAW(TYPE, DST, SRC, IMM) \
174 ((struct sock_filter_int) { \
175 .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \
176 .dst_reg = DST, \
177 .src_reg = SRC, \
178 .off = 0, \
179 .imm = IMM })
180
181/* Direct packet access, R0 = *(uint *) (skb->data + imm32) */
182
183#define BPF_LD_ABS(SIZE, IMM) \
184 ((struct sock_filter_int) { \
185 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \
186 .dst_reg = 0, \
187 .src_reg = 0, \
188 .off = 0, \
189 .imm = IMM })
190
191/* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */
192
193#define BPF_LD_IND(SIZE, SRC, IMM) \
194 ((struct sock_filter_int) { \
195 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \
196 .dst_reg = 0, \
197 .src_reg = SRC, \
198 .off = 0, \
199 .imm = IMM })
200
201/* Memory load, dst_reg = *(uint *) (src_reg + off16) */
202
203#define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \
204 ((struct sock_filter_int) { \
205 .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \
206 .dst_reg = DST, \
207 .src_reg = SRC, \
208 .off = OFF, \
209 .imm = 0 })
210
211/* Memory store, *(uint *) (dst_reg + off16) = src_reg */
212
213#define BPF_STX_MEM(SIZE, DST, SRC, OFF) \
214 ((struct sock_filter_int) { \
215 .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \
216 .dst_reg = DST, \
217 .src_reg = SRC, \
218 .off = OFF, \
219 .imm = 0 })
220
221/* Memory store, *(uint *) (dst_reg + off16) = imm32 */
222
223#define BPF_ST_MEM(SIZE, DST, OFF, IMM) \
224 ((struct sock_filter_int) { \
225 .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \
226 .dst_reg = DST, \
227 .src_reg = 0, \
228 .off = OFF, \
229 .imm = IMM })
230
231/* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */
232
233#define BPF_JMP_REG(OP, DST, SRC, OFF) \
234 ((struct sock_filter_int) { \
235 .code = BPF_JMP | BPF_OP(OP) | BPF_X, \
236 .dst_reg = DST, \
237 .src_reg = SRC, \
238 .off = OFF, \
239 .imm = 0 })
240
241/* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */
242
243#define BPF_JMP_IMM(OP, DST, IMM, OFF) \
244 ((struct sock_filter_int) { \
245 .code = BPF_JMP | BPF_OP(OP) | BPF_K, \
246 .dst_reg = DST, \
247 .src_reg = 0, \
248 .off = OFF, \
249 .imm = IMM })
250
251/* Function call */
252
253#define BPF_EMIT_CALL(FUNC) \
254 ((struct sock_filter_int) { \
255 .code = BPF_JMP | BPF_CALL, \
256 .dst_reg = 0, \
257 .src_reg = 0, \
258 .off = 0, \
259 .imm = ((FUNC) - __bpf_call_base) })
260
261/* Raw code statement block */
262
263#define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \
264 ((struct sock_filter_int) { \
265 .code = CODE, \
266 .dst_reg = DST, \
267 .src_reg = SRC, \
268 .off = OFF, \
269 .imm = IMM })
270
271/* Program exit */
272
273#define BPF_EXIT_INSN() \
274 ((struct sock_filter_int) { \
275 .code = BPF_JMP | BPF_EXIT, \
276 .dst_reg = 0, \
277 .src_reg = 0, \
278 .off = 0, \
279 .imm = 0 })
280
281#define bytes_to_bpf_size(bytes) \
282({ \
283 int bpf_size = -EINVAL; \
284 \
285 if (bytes == sizeof(u8)) \
286 bpf_size = BPF_B; \
287 else if (bytes == sizeof(u16)) \
288 bpf_size = BPF_H; \
289 else if (bytes == sizeof(u32)) \
290 bpf_size = BPF_W; \
291 else if (bytes == sizeof(u64)) \
292 bpf_size = BPF_DW; \
293 \
294 bpf_size; \
295})
296
297/* Macro to invoke filter function. */
298#define SK_RUN_FILTER(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi)
50 299
51struct sock_filter_int { 300struct sock_filter_int {
52 __u8 code; /* opcode */ 301 __u8 code; /* opcode */
53 __u8 a_reg:4; /* dest register */ 302 __u8 dst_reg:4; /* dest register */
54 __u8 x_reg:4; /* source register */ 303 __u8 src_reg:4; /* source register */
55 __s16 off; /* signed offset */ 304 __s16 off; /* signed offset */
56 __s32 imm; /* signed immediate constant */ 305 __s32 imm; /* signed immediate constant */
57}; 306};
@@ -97,21 +346,16 @@ static inline unsigned int sk_filter_size(unsigned int proglen)
97#define sk_filter_proglen(fprog) \ 346#define sk_filter_proglen(fprog) \
98 (fprog->len * sizeof(fprog->filter[0])) 347 (fprog->len * sizeof(fprog->filter[0]))
99 348
100#define SK_RUN_FILTER(filter, ctx) \
101 (*filter->bpf_func)(ctx, filter->insnsi)
102
103int sk_filter(struct sock *sk, struct sk_buff *skb); 349int sk_filter(struct sock *sk, struct sk_buff *skb);
104 350
105u32 sk_run_filter_int_seccomp(const struct seccomp_data *ctx, 351void sk_filter_select_runtime(struct sk_filter *fp);
106 const struct sock_filter_int *insni); 352void sk_filter_free(struct sk_filter *fp);
107u32 sk_run_filter_int_skb(const struct sk_buff *ctx,
108 const struct sock_filter_int *insni);
109 353
110int sk_convert_filter(struct sock_filter *prog, int len, 354int sk_convert_filter(struct sock_filter *prog, int len,
111 struct sock_filter_int *new_prog, int *new_len); 355 struct sock_filter_int *new_prog, int *new_len);
112 356
113int sk_unattached_filter_create(struct sk_filter **pfp, 357int sk_unattached_filter_create(struct sk_filter **pfp,
114 struct sock_fprog *fprog); 358 struct sock_fprog_kern *fprog);
115void sk_unattached_filter_destroy(struct sk_filter *fp); 359void sk_unattached_filter_destroy(struct sk_filter *fp);
116 360
117int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 361int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
@@ -120,11 +364,48 @@ int sk_detach_filter(struct sock *sk);
120int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 364int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
121int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, 365int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
122 unsigned int len); 366 unsigned int len);
123void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to);
124 367
125void sk_filter_charge(struct sock *sk, struct sk_filter *fp); 368void sk_filter_charge(struct sock *sk, struct sk_filter *fp);
126void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp); 369void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
127 370
371u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
372void bpf_int_jit_compile(struct sk_filter *fp);
373
374#define BPF_ANC BIT(15)
375
376static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
377{
378 BUG_ON(ftest->code & BPF_ANC);
379
380 switch (ftest->code) {
381 case BPF_LD | BPF_W | BPF_ABS:
382 case BPF_LD | BPF_H | BPF_ABS:
383 case BPF_LD | BPF_B | BPF_ABS:
384#define BPF_ANCILLARY(CODE) case SKF_AD_OFF + SKF_AD_##CODE: \
385 return BPF_ANC | SKF_AD_##CODE
386 switch (ftest->k) {
387 BPF_ANCILLARY(PROTOCOL);
388 BPF_ANCILLARY(PKTTYPE);
389 BPF_ANCILLARY(IFINDEX);
390 BPF_ANCILLARY(NLATTR);
391 BPF_ANCILLARY(NLATTR_NEST);
392 BPF_ANCILLARY(MARK);
393 BPF_ANCILLARY(QUEUE);
394 BPF_ANCILLARY(HATYPE);
395 BPF_ANCILLARY(RXHASH);
396 BPF_ANCILLARY(CPU);
397 BPF_ANCILLARY(ALU_XOR_X);
398 BPF_ANCILLARY(VLAN_TAG);
399 BPF_ANCILLARY(VLAN_TAG_PRESENT);
400 BPF_ANCILLARY(PAY_OFFSET);
401 BPF_ANCILLARY(RANDOM);
402 }
403 /* Fallthrough. */
404 default:
405 return ftest->code;
406 }
407}
408
128#ifdef CONFIG_BPF_JIT 409#ifdef CONFIG_BPF_JIT
129#include <stdarg.h> 410#include <stdarg.h>
130#include <linux/linkage.h> 411#include <linux/linkage.h>
@@ -144,85 +425,20 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
144} 425}
145#else 426#else
146#include <linux/slab.h> 427#include <linux/slab.h>
428
147static inline void bpf_jit_compile(struct sk_filter *fp) 429static inline void bpf_jit_compile(struct sk_filter *fp)
148{ 430{
149} 431}
432
150static inline void bpf_jit_free(struct sk_filter *fp) 433static inline void bpf_jit_free(struct sk_filter *fp)
151{ 434{
152 kfree(fp); 435 kfree(fp);
153} 436}
154#endif 437#endif /* CONFIG_BPF_JIT */
155 438
156static inline int bpf_tell_extensions(void) 439static inline int bpf_tell_extensions(void)
157{ 440{
158 return SKF_AD_MAX; 441 return SKF_AD_MAX;
159} 442}
160 443
161enum {
162 BPF_S_RET_K = 1,
163 BPF_S_RET_A,
164 BPF_S_ALU_ADD_K,
165 BPF_S_ALU_ADD_X,
166 BPF_S_ALU_SUB_K,
167 BPF_S_ALU_SUB_X,
168 BPF_S_ALU_MUL_K,
169 BPF_S_ALU_MUL_X,
170 BPF_S_ALU_DIV_X,
171 BPF_S_ALU_MOD_K,
172 BPF_S_ALU_MOD_X,
173 BPF_S_ALU_AND_K,
174 BPF_S_ALU_AND_X,
175 BPF_S_ALU_OR_K,
176 BPF_S_ALU_OR_X,
177 BPF_S_ALU_XOR_K,
178 BPF_S_ALU_XOR_X,
179 BPF_S_ALU_LSH_K,
180 BPF_S_ALU_LSH_X,
181 BPF_S_ALU_RSH_K,
182 BPF_S_ALU_RSH_X,
183 BPF_S_ALU_NEG,
184 BPF_S_LD_W_ABS,
185 BPF_S_LD_H_ABS,
186 BPF_S_LD_B_ABS,
187 BPF_S_LD_W_LEN,
188 BPF_S_LD_W_IND,
189 BPF_S_LD_H_IND,
190 BPF_S_LD_B_IND,
191 BPF_S_LD_IMM,
192 BPF_S_LDX_W_LEN,
193 BPF_S_LDX_B_MSH,
194 BPF_S_LDX_IMM,
195 BPF_S_MISC_TAX,
196 BPF_S_MISC_TXA,
197 BPF_S_ALU_DIV_K,
198 BPF_S_LD_MEM,
199 BPF_S_LDX_MEM,
200 BPF_S_ST,
201 BPF_S_STX,
202 BPF_S_JMP_JA,
203 BPF_S_JMP_JEQ_K,
204 BPF_S_JMP_JEQ_X,
205 BPF_S_JMP_JGE_K,
206 BPF_S_JMP_JGE_X,
207 BPF_S_JMP_JGT_K,
208 BPF_S_JMP_JGT_X,
209 BPF_S_JMP_JSET_K,
210 BPF_S_JMP_JSET_X,
211 /* Ancillary data */
212 BPF_S_ANC_PROTOCOL,
213 BPF_S_ANC_PKTTYPE,
214 BPF_S_ANC_IFINDEX,
215 BPF_S_ANC_NLATTR,
216 BPF_S_ANC_NLATTR_NEST,
217 BPF_S_ANC_MARK,
218 BPF_S_ANC_QUEUE,
219 BPF_S_ANC_HATYPE,
220 BPF_S_ANC_RXHASH,
221 BPF_S_ANC_CPU,
222 BPF_S_ANC_ALU_XOR_X,
223 BPF_S_ANC_VLAN_TAG,
224 BPF_S_ANC_VLAN_TAG_PRESENT,
225 BPF_S_ANC_PAY_OFFSET,
226};
227
228#endif /* __LINUX_FILTER_H__ */ 444#endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c3f46e499dd0..2daccaf4b547 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -128,6 +128,10 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
128#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000) 128#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000)
129/* Write access to underlying fs */ 129/* Write access to underlying fs */
130#define FMODE_WRITER ((__force fmode_t)0x10000) 130#define FMODE_WRITER ((__force fmode_t)0x10000)
131/* Has read method(s) */
132#define FMODE_CAN_READ ((__force fmode_t)0x20000)
133/* Has write method(s) */
134#define FMODE_CAN_WRITE ((__force fmode_t)0x40000)
131 135
132/* File was opened by fanotify and shouldn't generate fanotify events */ 136/* File was opened by fanotify and shouldn't generate fanotify events */
133#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 137#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
@@ -343,8 +347,7 @@ struct address_space_operations {
343 void (*invalidatepage) (struct page *, unsigned int, unsigned int); 347 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
344 int (*releasepage) (struct page *, gfp_t); 348 int (*releasepage) (struct page *, gfp_t);
345 void (*freepage)(struct page *); 349 void (*freepage)(struct page *);
346 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 350 ssize_t (*direct_IO)(int, struct kiocb *, struct iov_iter *iter, loff_t offset);
347 loff_t offset, unsigned long nr_segs);
348 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 351 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
349 void **, unsigned long *); 352 void **, unsigned long *);
350 /* 353 /*
@@ -830,7 +833,7 @@ static inline struct file *get_file(struct file *f)
830 * 833 *
831 * Lockd stuffs a "host" pointer into this. 834 * Lockd stuffs a "host" pointer into this.
832 */ 835 */
833typedef struct files_struct *fl_owner_t; 836typedef void *fl_owner_t;
834 837
835struct file_lock_operations { 838struct file_lock_operations {
836 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 839 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
@@ -1448,6 +1451,8 @@ struct block_device_operations;
1448#define HAVE_COMPAT_IOCTL 1 1451#define HAVE_COMPAT_IOCTL 1
1449#define HAVE_UNLOCKED_IOCTL 1 1452#define HAVE_UNLOCKED_IOCTL 1
1450 1453
1454struct iov_iter;
1455
1451struct file_operations { 1456struct file_operations {
1452 struct module *owner; 1457 struct module *owner;
1453 loff_t (*llseek) (struct file *, loff_t, int); 1458 loff_t (*llseek) (struct file *, loff_t, int);
@@ -1455,6 +1460,8 @@ struct file_operations {
1455 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 1460 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
1456 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1461 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1457 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1462 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1463 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
1464 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
1458 int (*iterate) (struct file *, struct dir_context *); 1465 int (*iterate) (struct file *, struct dir_context *);
1459 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1466 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1460 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1467 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
@@ -1914,6 +1921,12 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1914 1921
1915static inline int break_deleg(struct inode *inode, unsigned int mode) 1922static inline int break_deleg(struct inode *inode, unsigned int mode)
1916{ 1923{
1924 /*
1925 * Since this check is lockless, we must ensure that any refcounts
1926 * taken are done before checking inode->i_flock. Otherwise, we could
1927 * end up racing with tasks trying to set a new lease on this file.
1928 */
1929 smp_mb();
1917 if (inode->i_flock) 1930 if (inode->i_flock)
1918 return __break_lease(inode, mode, FL_DELEG); 1931 return __break_lease(inode, mode, FL_DELEG);
1919 return 0; 1932 return 0;
@@ -2404,20 +2417,18 @@ extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2404extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr, 2417extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr,
2405 unsigned long size, pgoff_t pgoff); 2418 unsigned long size, pgoff_t pgoff);
2406int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2419int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2407extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2420extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
2408extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long); 2421extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
2409extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2422extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *);
2410extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *, 2423extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t);
2411 unsigned long *, loff_t, size_t, size_t);
2412extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); 2424extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
2413extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); 2425extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2414extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 2426extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2415extern int generic_segment_checks(const struct iovec *iov, 2427extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2416 unsigned long *nr_segs, size_t *count, int access_flags); 2428extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2417 2429
2418/* fs/block_dev.c */ 2430/* fs/block_dev.c */
2419extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2431extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from);
2420 unsigned long nr_segs, loff_t pos);
2421extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2432extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2422 int datasync); 2433 int datasync);
2423extern void block_sync_page(struct page *page); 2434extern void block_sync_page(struct page *page);
@@ -2427,7 +2438,7 @@ extern ssize_t generic_file_splice_read(struct file *, loff_t *,
2427 struct pipe_inode_info *, size_t, unsigned int); 2438 struct pipe_inode_info *, size_t, unsigned int);
2428extern ssize_t default_file_splice_read(struct file *, loff_t *, 2439extern ssize_t default_file_splice_read(struct file *, loff_t *,
2429 struct pipe_inode_info *, size_t, unsigned int); 2440 struct pipe_inode_info *, size_t, unsigned int);
2430extern ssize_t generic_file_splice_write(struct pipe_inode_info *, 2441extern ssize_t iter_file_splice_write(struct pipe_inode_info *,
2431 struct file *, loff_t *, size_t, unsigned int); 2442 struct file *, loff_t *, size_t, unsigned int);
2432extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2443extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2433 struct file *out, loff_t *, size_t len, unsigned int flags); 2444 struct file *out, loff_t *, size_t len, unsigned int flags);
@@ -2477,16 +2488,16 @@ enum {
2477void dio_end_io(struct bio *bio, int error); 2488void dio_end_io(struct bio *bio, int error);
2478 2489
2479ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2490ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2480 struct block_device *bdev, const struct iovec *iov, loff_t offset, 2491 struct block_device *bdev, struct iov_iter *iter, loff_t offset,
2481 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, 2492 get_block_t get_block, dio_iodone_t end_io,
2482 dio_submit_t submit_io, int flags); 2493 dio_submit_t submit_io, int flags);
2483 2494
2484static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2495static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2485 struct inode *inode, const struct iovec *iov, loff_t offset, 2496 struct inode *inode, struct iov_iter *iter, loff_t offset,
2486 unsigned long nr_segs, get_block_t get_block) 2497 get_block_t get_block)
2487{ 2498{
2488 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 2499 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iter,
2489 offset, nr_segs, get_block, NULL, NULL, 2500 offset, get_block, NULL, NULL,
2490 DIO_LOCKING | DIO_SKIP_HOLES); 2501 DIO_LOCKING | DIO_SKIP_HOLES);
2491} 2502}
2492#endif 2503#endif
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 2018751cad9e..6bb5e3f2a3b4 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -33,8 +33,7 @@
33 * features, then it must call an indirect function that 33 * features, then it must call an indirect function that
34 * does. Or at least does enough to prevent any unwelcomed side effects. 34 * does. Or at least does enough to prevent any unwelcomed side effects.
35 */ 35 */
36#if !defined(CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST) || \ 36#if !ARCH_SUPPORTS_FTRACE_OPS
37 !ARCH_SUPPORTS_FTRACE_OPS
38# define FTRACE_FORCE_LIST_FUNC 1 37# define FTRACE_FORCE_LIST_FUNC 1
39#else 38#else
40# define FTRACE_FORCE_LIST_FUNC 0 39# define FTRACE_FORCE_LIST_FUNC 0
@@ -62,9 +61,6 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
62 * set in the flags member. 61 * set in the flags member.
63 * 62 *
64 * ENABLED - set/unset when ftrace_ops is registered/unregistered 63 * ENABLED - set/unset when ftrace_ops is registered/unregistered
65 * GLOBAL - set manualy by ftrace_ops user to denote the ftrace_ops
66 * is part of the global tracers sharing the same filter
67 * via set_ftrace_* debugfs files.
68 * DYNAMIC - set when ftrace_ops is registered to denote dynamically 64 * DYNAMIC - set when ftrace_ops is registered to denote dynamically
69 * allocated ftrace_ops which need special care 65 * allocated ftrace_ops which need special care
70 * CONTROL - set manualy by ftrace_ops user to denote the ftrace_ops 66 * CONTROL - set manualy by ftrace_ops user to denote the ftrace_ops
@@ -96,15 +92,14 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
96 */ 92 */
97enum { 93enum {
98 FTRACE_OPS_FL_ENABLED = 1 << 0, 94 FTRACE_OPS_FL_ENABLED = 1 << 0,
99 FTRACE_OPS_FL_GLOBAL = 1 << 1, 95 FTRACE_OPS_FL_DYNAMIC = 1 << 1,
100 FTRACE_OPS_FL_DYNAMIC = 1 << 2, 96 FTRACE_OPS_FL_CONTROL = 1 << 2,
101 FTRACE_OPS_FL_CONTROL = 1 << 3, 97 FTRACE_OPS_FL_SAVE_REGS = 1 << 3,
102 FTRACE_OPS_FL_SAVE_REGS = 1 << 4, 98 FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 4,
103 FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 5, 99 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 5,
104 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6, 100 FTRACE_OPS_FL_STUB = 1 << 6,
105 FTRACE_OPS_FL_STUB = 1 << 7, 101 FTRACE_OPS_FL_INITIALIZED = 1 << 7,
106 FTRACE_OPS_FL_INITIALIZED = 1 << 8, 102 FTRACE_OPS_FL_DELETED = 1 << 8,
107 FTRACE_OPS_FL_DELETED = 1 << 9,
108}; 103};
109 104
110/* 105/*
@@ -122,17 +117,18 @@ struct ftrace_ops {
122 ftrace_func_t func; 117 ftrace_func_t func;
123 struct ftrace_ops *next; 118 struct ftrace_ops *next;
124 unsigned long flags; 119 unsigned long flags;
125 int __percpu *disabled;
126 void *private; 120 void *private;
121 int __percpu *disabled;
127#ifdef CONFIG_DYNAMIC_FTRACE 122#ifdef CONFIG_DYNAMIC_FTRACE
123 int nr_trampolines;
128 struct ftrace_hash *notrace_hash; 124 struct ftrace_hash *notrace_hash;
129 struct ftrace_hash *filter_hash; 125 struct ftrace_hash *filter_hash;
126 struct ftrace_hash *tramp_hash;
130 struct mutex regex_lock; 127 struct mutex regex_lock;
128 unsigned long trampoline;
131#endif 129#endif
132}; 130};
133 131
134extern int function_trace_stop;
135
136/* 132/*
137 * Type of the current tracing. 133 * Type of the current tracing.
138 */ 134 */
@@ -144,32 +140,6 @@ enum ftrace_tracing_type_t {
144/* Current tracing type, default is FTRACE_TYPE_ENTER */ 140/* Current tracing type, default is FTRACE_TYPE_ENTER */
145extern enum ftrace_tracing_type_t ftrace_tracing_type; 141extern enum ftrace_tracing_type_t ftrace_tracing_type;
146 142
147/**
148 * ftrace_stop - stop function tracer.
149 *
150 * A quick way to stop the function tracer. Note this an on off switch,
151 * it is not something that is recursive like preempt_disable.
152 * This does not disable the calling of mcount, it only stops the
153 * calling of functions from mcount.
154 */
155static inline void ftrace_stop(void)
156{
157 function_trace_stop = 1;
158}
159
160/**
161 * ftrace_start - start the function tracer.
162 *
163 * This function is the inverse of ftrace_stop. This does not enable
164 * the function tracing if the function tracer is disabled. This only
165 * sets the function tracer flag to continue calling the functions
166 * from mcount.
167 */
168static inline void ftrace_start(void)
169{
170 function_trace_stop = 0;
171}
172
173/* 143/*
174 * The ftrace_ops must be a static and should also 144 * The ftrace_ops must be a static and should also
175 * be read_mostly. These functions do modify read_mostly variables 145 * be read_mostly. These functions do modify read_mostly variables
@@ -246,8 +216,6 @@ static inline int ftrace_nr_registered_ops(void)
246} 216}
247static inline void clear_ftrace_function(void) { } 217static inline void clear_ftrace_function(void) { }
248static inline void ftrace_kill(void) { } 218static inline void ftrace_kill(void) { }
249static inline void ftrace_stop(void) { }
250static inline void ftrace_start(void) { }
251#endif /* CONFIG_FUNCTION_TRACER */ 219#endif /* CONFIG_FUNCTION_TRACER */
252 220
253#ifdef CONFIG_STACK_TRACER 221#ifdef CONFIG_STACK_TRACER
@@ -321,13 +289,20 @@ extern int ftrace_nr_registered_ops(void);
321 * from tracing that function. 289 * from tracing that function.
322 */ 290 */
323enum { 291enum {
324 FTRACE_FL_ENABLED = (1UL << 29), 292 FTRACE_FL_ENABLED = (1UL << 31),
325 FTRACE_FL_REGS = (1UL << 30), 293 FTRACE_FL_REGS = (1UL << 30),
326 FTRACE_FL_REGS_EN = (1UL << 31) 294 FTRACE_FL_REGS_EN = (1UL << 29),
295 FTRACE_FL_TRAMP = (1UL << 28),
296 FTRACE_FL_TRAMP_EN = (1UL << 27),
327}; 297};
328 298
329#define FTRACE_FL_MASK (0x7UL << 29) 299#define FTRACE_REF_MAX_SHIFT 27
330#define FTRACE_REF_MAX ((1UL << 29) - 1) 300#define FTRACE_FL_BITS 5
301#define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1)
302#define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT)
303#define FTRACE_REF_MAX ((1UL << FTRACE_REF_MAX_SHIFT) - 1)
304
305#define ftrace_rec_count(rec) ((rec)->flags & ~FTRACE_FL_MASK)
331 306
332struct dyn_ftrace { 307struct dyn_ftrace {
333 unsigned long ip; /* address of mcount call-site */ 308 unsigned long ip; /* address of mcount call-site */
@@ -366,14 +341,12 @@ enum {
366 * IGNORE - The function is already what we want it to be 341 * IGNORE - The function is already what we want it to be
367 * MAKE_CALL - Start tracing the function 342 * MAKE_CALL - Start tracing the function
368 * MODIFY_CALL - Stop saving regs for the function 343 * MODIFY_CALL - Stop saving regs for the function
369 * MODIFY_CALL_REGS - Start saving regs for the function
370 * MAKE_NOP - Stop tracing the function 344 * MAKE_NOP - Stop tracing the function
371 */ 345 */
372enum { 346enum {
373 FTRACE_UPDATE_IGNORE, 347 FTRACE_UPDATE_IGNORE,
374 FTRACE_UPDATE_MAKE_CALL, 348 FTRACE_UPDATE_MAKE_CALL,
375 FTRACE_UPDATE_MODIFY_CALL, 349 FTRACE_UPDATE_MODIFY_CALL,
376 FTRACE_UPDATE_MODIFY_CALL_REGS,
377 FTRACE_UPDATE_MAKE_NOP, 350 FTRACE_UPDATE_MAKE_NOP,
378}; 351};
379 352
@@ -404,6 +377,8 @@ int ftrace_update_record(struct dyn_ftrace *rec, int enable);
404int ftrace_test_record(struct dyn_ftrace *rec, int enable); 377int ftrace_test_record(struct dyn_ftrace *rec, int enable);
405void ftrace_run_stop_machine(int command); 378void ftrace_run_stop_machine(int command);
406unsigned long ftrace_location(unsigned long ip); 379unsigned long ftrace_location(unsigned long ip);
380unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec);
381unsigned long ftrace_get_addr_curr(struct dyn_ftrace *rec);
407 382
408extern ftrace_func_t ftrace_trace_function; 383extern ftrace_func_t ftrace_trace_function;
409 384
@@ -435,6 +410,10 @@ void ftrace_modify_all_code(int command);
435#define FTRACE_ADDR ((unsigned long)ftrace_caller) 410#define FTRACE_ADDR ((unsigned long)ftrace_caller)
436#endif 411#endif
437 412
413#ifndef FTRACE_GRAPH_ADDR
414#define FTRACE_GRAPH_ADDR ((unsigned long)ftrace_graph_caller)
415#endif
416
438#ifndef FTRACE_REGS_ADDR 417#ifndef FTRACE_REGS_ADDR
439#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS 418#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
440# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller) 419# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)
@@ -443,6 +422,16 @@ void ftrace_modify_all_code(int command);
443#endif 422#endif
444#endif 423#endif
445 424
425/*
426 * If an arch would like functions that are only traced
427 * by the function graph tracer to jump directly to its own
428 * trampoline, then they can define FTRACE_GRAPH_TRAMP_ADDR
429 * to be that address to jump to.
430 */
431#ifndef FTRACE_GRAPH_TRAMP_ADDR
432#define FTRACE_GRAPH_TRAMP_ADDR ((unsigned long) 0)
433#endif
434
446#ifdef CONFIG_FUNCTION_GRAPH_TRACER 435#ifdef CONFIG_FUNCTION_GRAPH_TRACER
447extern void ftrace_graph_caller(void); 436extern void ftrace_graph_caller(void);
448extern int ftrace_enable_ftrace_graph_caller(void); 437extern int ftrace_enable_ftrace_graph_caller(void);
@@ -740,6 +729,7 @@ extern char __irqentry_text_end[];
740extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 729extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
741 trace_func_graph_ent_t entryfunc); 730 trace_func_graph_ent_t entryfunc);
742 731
732extern bool ftrace_graph_is_dead(void);
743extern void ftrace_graph_stop(void); 733extern void ftrace_graph_stop(void);
744 734
745/* The current handlers in use */ 735/* The current handlers in use */
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index d16da3e53bc7..06c6faa9e5cc 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -38,6 +38,9 @@ const char *ftrace_print_symbols_seq_u64(struct trace_seq *p,
38 *symbol_array); 38 *symbol_array);
39#endif 39#endif
40 40
41const char *ftrace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr,
42 unsigned int bitmask_size);
43
41const char *ftrace_print_hex_seq(struct trace_seq *p, 44const char *ftrace_print_hex_seq(struct trace_seq *p,
42 const unsigned char *buf, int len); 45 const unsigned char *buf, int len);
43 46
@@ -269,7 +272,6 @@ struct ftrace_event_call {
269 struct trace_event event; 272 struct trace_event event;
270 const char *print_fmt; 273 const char *print_fmt;
271 struct event_filter *filter; 274 struct event_filter *filter;
272 struct list_head *files;
273 void *mod; 275 void *mod;
274 void *data; 276 void *data;
275 /* 277 /*
@@ -401,8 +403,6 @@ enum event_trigger_type {
401 ETT_EVENT_ENABLE = (1 << 3), 403 ETT_EVENT_ENABLE = (1 << 3),
402}; 404};
403 405
404extern void destroy_preds(struct ftrace_event_file *file);
405extern void destroy_call_preds(struct ftrace_event_call *call);
406extern int filter_match_preds(struct event_filter *filter, void *rec); 406extern int filter_match_preds(struct event_filter *filter, void *rec);
407 407
408extern int filter_check_discard(struct ftrace_event_file *file, void *rec, 408extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index a7e977ff4abf..8b622468952c 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -3,29 +3,53 @@
3 3
4struct device; 4struct device;
5 5
6/**
7 * struct gpio_keys_button - configuration parameters
8 * @code: input event code (KEY_*, SW_*)
9 * @gpio: %-1 if this key does not support gpio
10 * @active_low: %true indicates that button is considered
11 * depressed when gpio is low
12 * @desc: label that will be attached to button's gpio
13 * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS)
14 * @wakeup: configure the button as a wake-up source
15 * @debounce_interval: debounce ticks interval in msecs
16 * @can_disable: %true indicates that userspace is allowed to
17 * disable button via sysfs
18 * @value: axis value for %EV_ABS
19 * @irq: Irq number in case of interrupt keys
20 */
6struct gpio_keys_button { 21struct gpio_keys_button {
7 /* Configuration parameters */ 22 unsigned int code;
8 unsigned int code; /* input event code (KEY_*, SW_*) */ 23 int gpio;
9 int gpio; /* -1 if this key does not support gpio */
10 int active_low; 24 int active_low;
11 const char *desc; 25 const char *desc;
12 unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */ 26 unsigned int type;
13 int wakeup; /* configure the button as a wake-up source */ 27 int wakeup;
14 int debounce_interval; /* debounce ticks interval in msecs */ 28 int debounce_interval;
15 bool can_disable; 29 bool can_disable;
16 int value; /* axis value for EV_ABS */ 30 int value;
17 unsigned int irq; /* Irq number in case of interrupt keys */ 31 unsigned int irq;
18}; 32};
19 33
34/**
35 * struct gpio_keys_platform_data - platform data for gpio_keys driver
36 * @buttons: pointer to array of &gpio_keys_button structures
37 * describing buttons attached to the device
38 * @nbuttons: number of elements in @buttons array
39 * @poll_interval: polling interval in msecs - for polling driver only
40 * @rep: enable input subsystem auto repeat
41 * @enable: platform hook for enabling the device
42 * @disable: platform hook for disabling the device
43 * @name: input device name
44 */
20struct gpio_keys_platform_data { 45struct gpio_keys_platform_data {
21 struct gpio_keys_button *buttons; 46 struct gpio_keys_button *buttons;
22 int nbuttons; 47 int nbuttons;
23 unsigned int poll_interval; /* polling interval in msecs - 48 unsigned int poll_interval;
24 for polling driver only */ 49 unsigned int rep:1;
25 unsigned int rep:1; /* enable input subsystem auto repeat */
26 int (*enable)(struct device *dev); 50 int (*enable)(struct device *dev);
27 void (*disable)(struct device *dev); 51 void (*disable)(struct device *dev);
28 const char *name; /* input device name */ 52 const char *name;
29}; 53};
30 54
31#endif 55#endif
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 255cd5cc0754..a23c096b3080 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -80,6 +80,7 @@ int dequeue_hwpoisoned_huge_page(struct page *page);
80bool isolate_huge_page(struct page *page, struct list_head *list); 80bool isolate_huge_page(struct page *page, struct list_head *list);
81void putback_active_hugepage(struct page *page); 81void putback_active_hugepage(struct page *page);
82bool is_hugepage_active(struct page *page); 82bool is_hugepage_active(struct page *page);
83void free_huge_page(struct page *page);
83 84
84#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 85#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
85pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); 86pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index 99e379b74398..3891dc1de21c 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -15,35 +15,14 @@
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17 17
18/* For key_map array */
19#define MXT_NUM_GPIO 4
20
21/* Orient */
22#define MXT_NORMAL 0x0
23#define MXT_DIAGONAL 0x1
24#define MXT_HORIZONTAL_FLIP 0x2
25#define MXT_ROTATED_90_COUNTER 0x3
26#define MXT_VERTICAL_FLIP 0x4
27#define MXT_ROTATED_90 0x5
28#define MXT_ROTATED_180 0x6
29#define MXT_DIAGONAL_COUNTER 0x7
30
31/* The platform data for the Atmel maXTouch touchscreen driver */ 18/* The platform data for the Atmel maXTouch touchscreen driver */
32struct mxt_platform_data { 19struct mxt_platform_data {
33 const u8 *config; 20 const u8 *config;
34 size_t config_length; 21 size_t config_length;
35 22 u32 config_crc;
36 unsigned int x_line;
37 unsigned int y_line;
38 unsigned int x_size;
39 unsigned int y_size;
40 unsigned int blen;
41 unsigned int threshold;
42 unsigned int voltage;
43 unsigned char orient;
44 unsigned long irqflags; 23 unsigned long irqflags;
45 bool is_tp; 24 u8 t19_num_keys;
46 const unsigned int key_map[MXT_NUM_GPIO]; 25 const unsigned int *t19_keymap;
47}; 26};
48 27
49#endif /* __LINUX_ATMEL_MXT_TS_H */ 28#endif /* __LINUX_ATMEL_MXT_TS_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index d2b16704624c..8cfb50f38529 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -498,7 +498,10 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
498#define RES_GRP_ALL 0x7 /* All resource groups */ 498#define RES_GRP_ALL 0x7 /* All resource groups */
499 499
500#define RES_TYPE2_R0 0x0 500#define RES_TYPE2_R0 0x0
501#define RES_TYPE2_R1 0x1
502#define RES_TYPE2_R2 0x2
501 503
504#define RES_TYPE_R0 0x0
502#define RES_TYPE_ALL 0x7 505#define RES_TYPE_ALL 0x7
503 506
504/* Resource states */ 507/* Resource states */
@@ -671,6 +674,7 @@ struct twl4030_power_data {
671 struct twl4030_script **scripts; 674 struct twl4030_script **scripts;
672 unsigned num; 675 unsigned num;
673 struct twl4030_resconfig *resource_config; 676 struct twl4030_resconfig *resource_config;
677 struct twl4030_resconfig *board_config;
674#define TWL4030_RESCONFIG_UNDEF ((u8)-1) 678#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
675 bool use_poweroff; /* Board is wired for TWL poweroff */ 679 bool use_poweroff; /* Board is wired for TWL poweroff */
676}; 680};
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index f194ccb8539c..6bff13f74050 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1711,6 +1711,7 @@ enum ieee80211_eid {
1711 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, 1711 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
1712 WLAN_EID_MULTIPLE_BSSID = 71, 1712 WLAN_EID_MULTIPLE_BSSID = 71,
1713 WLAN_EID_BSS_COEX_2040 = 72, 1713 WLAN_EID_BSS_COEX_2040 = 72,
1714 WLAN_EID_BSS_INTOLERANT_CHL_REPORT = 73,
1714 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, 1715 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
1715 WLAN_EID_RIC_DESCRIPTOR = 75, 1716 WLAN_EID_RIC_DESCRIPTOR = 75,
1716 WLAN_EID_MMIE = 76, 1717 WLAN_EID_MMIE = 76,
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 1085ffeef956..fd22789d7b2e 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -16,9 +16,28 @@
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <uapi/linux/if_bridge.h> 17#include <uapi/linux/if_bridge.h>
18 18
19struct br_ip {
20 union {
21 __be32 ip4;
22#if IS_ENABLED(CONFIG_IPV6)
23 struct in6_addr ip6;
24#endif
25 } u;
26 __be16 proto;
27 __u16 vid;
28};
29
30struct br_ip_list {
31 struct list_head list;
32 struct br_ip addr;
33};
34
19extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 35extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
20 36
21typedef int br_should_route_hook_t(struct sk_buff *skb); 37typedef int br_should_route_hook_t(struct sk_buff *skb);
22extern br_should_route_hook_t __rcu *br_should_route_hook; 38extern br_should_route_hook_t __rcu *br_should_route_hook;
39int br_multicast_list_adjacent(struct net_device *dev,
40 struct list_head *br_ip_list);
41bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto);
23 42
24#endif 43#endif
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index a86784dec3d3..119130e9298b 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -10,8 +10,9 @@ struct ifla_vf_info {
10 __u8 mac[32]; 10 __u8 mac[32];
11 __u32 vlan; 11 __u32 vlan;
12 __u32 qos; 12 __u32 qos;
13 __u32 tx_rate;
14 __u32 spoofchk; 13 __u32 spoofchk;
15 __u32 linkstate; 14 __u32 linkstate;
15 __u32 min_tx_rate;
16 __u32 max_tx_rate;
16}; 17};
17#endif /* _LINUX_IF_LINK_H */ 18#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index a9a53b12397b..6b2c7cf352a5 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -57,6 +57,9 @@ struct macvlan_dev {
57 netdev_features_t tap_features; 57 netdev_features_t tap_features;
58 int minor; 58 int minor;
59 int nest_level; 59 int nest_level;
60#ifdef CONFIG_NET_POLL_CONTROLLER
61 struct netpoll *netpoll;
62#endif
60}; 63};
61 64
62static inline void macvlan_count_rx(const struct macvlan_dev *vlan, 65static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index b2acc4a1b13c..4967916fe4ac 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -106,7 +106,7 @@ struct vlan_pcpu_stats {
106 106
107#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 107#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
108 108
109extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, 109extern struct net_device *__vlan_find_dev_deep_rcu(struct net_device *real_dev,
110 __be16 vlan_proto, u16 vlan_id); 110 __be16 vlan_proto, u16 vlan_id);
111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
112extern u16 vlan_dev_vlan_id(const struct net_device *dev); 112extern u16 vlan_dev_vlan_id(const struct net_device *dev);
@@ -206,7 +206,7 @@ static inline int vlan_get_encap_level(struct net_device *dev)
206} 206}
207#else 207#else
208static inline struct net_device * 208static inline struct net_device *
209__vlan_find_dev_deep(struct net_device *real_dev, 209__vlan_find_dev_deep_rcu(struct net_device *real_dev,
210 __be16 vlan_proto, u16 vlan_id) 210 __be16 vlan_proto, u16 vlan_id)
211{ 211{
212 return NULL; 212 return NULL;
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 6df7f9fe0d01..2bb4c4f3531a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -102,12 +102,6 @@ extern struct group_info init_groups;
102#define INIT_IDS 102#define INIT_IDS
103#endif 103#endif
104 104
105#ifdef CONFIG_RCU_BOOST
106#define INIT_TASK_RCU_BOOST() \
107 .rcu_boost_mutex = NULL,
108#else
109#define INIT_TASK_RCU_BOOST()
110#endif
111#ifdef CONFIG_TREE_PREEMPT_RCU 105#ifdef CONFIG_TREE_PREEMPT_RCU
112#define INIT_TASK_RCU_TREE_PREEMPT() \ 106#define INIT_TASK_RCU_TREE_PREEMPT() \
113 .rcu_blocked_node = NULL, 107 .rcu_blocked_node = NULL,
@@ -119,8 +113,7 @@ extern struct group_info init_groups;
119 .rcu_read_lock_nesting = 0, \ 113 .rcu_read_lock_nesting = 0, \
120 .rcu_read_unlock_special = 0, \ 114 .rcu_read_unlock_special = 0, \
121 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ 115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
122 INIT_TASK_RCU_TREE_PREEMPT() \ 116 INIT_TASK_RCU_TREE_PREEMPT()
123 INIT_TASK_RCU_BOOST()
124#else 117#else
125#define INIT_TASK_RCU_PREEMPT(tsk) 118#define INIT_TASK_RCU_PREEMPT(tsk)
126#endif 119#endif
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
index ce0b72464eb8..2465182670db 100644
--- a/include/linux/input-polldev.h
+++ b/include/linux/input-polldev.h
@@ -48,9 +48,12 @@ struct input_polled_dev {
48 48
49/* private: */ 49/* private: */
50 struct delayed_work work; 50 struct delayed_work work;
51
52 bool devres_managed;
51}; 53};
52 54
53struct input_polled_dev *input_allocate_polled_device(void); 55struct input_polled_dev *input_allocate_polled_device(void);
56struct input_polled_dev *devm_input_allocate_polled_device(struct device *dev);
54void input_free_polled_device(struct input_polled_dev *dev); 57void input_free_polled_device(struct input_polled_dev *dev);
55int input_register_polled_device(struct input_polled_dev *dev); 58int input_register_polled_device(struct input_polled_dev *dev);
56void input_unregister_polled_device(struct input_polled_dev *dev); 59void input_unregister_polled_device(struct input_polled_dev *dev);
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 7163d91c0373..160cf353aa39 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -1,10 +1,52 @@
1#ifndef _PIXCIR_I2C_TS_H 1#ifndef _PIXCIR_I2C_TS_H
2#define _PIXCIR_I2C_TS_H 2#define _PIXCIR_I2C_TS_H
3 3
4/*
5 * Register map
6 */
7#define PIXCIR_REG_POWER_MODE 51
8#define PIXCIR_REG_INT_MODE 52
9
10/*
11 * Power modes:
12 * active: max scan speed
13 * idle: lower scan speed with automatic transition to active on touch
14 * halt: datasheet says sleep but this is more like halt as the chip
15 * clocks are cut and it can only be brought out of this mode
16 * using the RESET pin.
17 */
18enum pixcir_power_mode {
19 PIXCIR_POWER_ACTIVE,
20 PIXCIR_POWER_IDLE,
21 PIXCIR_POWER_HALT,
22};
23
24#define PIXCIR_POWER_MODE_MASK 0x03
25#define PIXCIR_POWER_ALLOW_IDLE (1UL << 2)
26
27/*
28 * Interrupt modes:
29 * periodical: interrupt is asserted periodicaly
30 * diff coordinates: interrupt is asserted when coordinates change
31 * level on touch: interrupt level asserted during touch
32 * pulse on touch: interrupt pulse asserted druing touch
33 *
34 */
35enum pixcir_int_mode {
36 PIXCIR_INT_PERIODICAL,
37 PIXCIR_INT_DIFF_COORD,
38 PIXCIR_INT_LEVEL_TOUCH,
39 PIXCIR_INT_PULSE_TOUCH,
40};
41
42#define PIXCIR_INT_MODE_MASK 0x03
43#define PIXCIR_INT_ENABLE (1UL << 3)
44#define PIXCIR_INT_POL_HIGH (1UL << 2)
45
4struct pixcir_ts_platform_data { 46struct pixcir_ts_platform_data {
5 int (*attb_read_val)(void);
6 int x_max; 47 int x_max;
7 int y_max; 48 int y_max;
49 int gpio_attb; /* GPIO connected to ATTB line */
8}; 50};
9 51
10#endif 52#endif
diff --git a/include/linux/input/touchscreen.h b/include/linux/input/touchscreen.h
new file mode 100644
index 000000000000..08a5ef6e8f25
--- /dev/null
+++ b/include/linux/input/touchscreen.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (c) 2014 Sebastian Reichel <sre@kernel.org>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 */
8
9#ifndef _TOUCHSCREEN_H
10#define _TOUCHSCREEN_H
11
12#include <linux/input.h>
13
14#ifdef CONFIG_OF
15void touchscreen_parse_of_params(struct input_dev *dev);
16#else
17static inline void touchscreen_parse_of_params(struct input_dev *dev)
18{
19}
20#endif
21
22#endif
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index 19ae05d4b8ec..bf9422c3aefe 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -33,6 +33,11 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
33#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), } 33#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), }
34 34
35bool irq_work_queue(struct irq_work *work); 35bool irq_work_queue(struct irq_work *work);
36
37#ifdef CONFIG_SMP
38bool irq_work_queue_on(struct irq_work *work, int cpu);
39#endif
40
36void irq_work_run(void); 41void irq_work_run(void);
37void irq_work_sync(struct irq_work *work); 42void irq_work_sync(struct irq_work *work);
38 43
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
new file mode 100644
index 000000000000..03a4ea37ba86
--- /dev/null
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -0,0 +1,200 @@
1/*
2 * Copyright (C) 2013, 2014 ARM Limited, All Rights Reserved.
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * 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#ifndef __LINUX_IRQCHIP_ARM_GIC_V3_H
19#define __LINUX_IRQCHIP_ARM_GIC_V3_H
20
21#include <asm/sysreg.h>
22
23/*
24 * Distributor registers. We assume we're running non-secure, with ARE
25 * being set. Secure-only and non-ARE registers are not described.
26 */
27#define GICD_CTLR 0x0000
28#define GICD_TYPER 0x0004
29#define GICD_IIDR 0x0008
30#define GICD_STATUSR 0x0010
31#define GICD_SETSPI_NSR 0x0040
32#define GICD_CLRSPI_NSR 0x0048
33#define GICD_SETSPI_SR 0x0050
34#define GICD_CLRSPI_SR 0x0058
35#define GICD_SEIR 0x0068
36#define GICD_ISENABLER 0x0100
37#define GICD_ICENABLER 0x0180
38#define GICD_ISPENDR 0x0200
39#define GICD_ICPENDR 0x0280
40#define GICD_ISACTIVER 0x0300
41#define GICD_ICACTIVER 0x0380
42#define GICD_IPRIORITYR 0x0400
43#define GICD_ICFGR 0x0C00
44#define GICD_IROUTER 0x6000
45#define GICD_PIDR2 0xFFE8
46
47#define GICD_CTLR_RWP (1U << 31)
48#define GICD_CTLR_ARE_NS (1U << 4)
49#define GICD_CTLR_ENABLE_G1A (1U << 1)
50#define GICD_CTLR_ENABLE_G1 (1U << 0)
51
52#define GICD_IROUTER_SPI_MODE_ONE (0U << 31)
53#define GICD_IROUTER_SPI_MODE_ANY (1U << 31)
54
55#define GIC_PIDR2_ARCH_MASK 0xf0
56#define GIC_PIDR2_ARCH_GICv3 0x30
57#define GIC_PIDR2_ARCH_GICv4 0x40
58
59/*
60 * Re-Distributor registers, offsets from RD_base
61 */
62#define GICR_CTLR GICD_CTLR
63#define GICR_IIDR 0x0004
64#define GICR_TYPER 0x0008
65#define GICR_STATUSR GICD_STATUSR
66#define GICR_WAKER 0x0014
67#define GICR_SETLPIR 0x0040
68#define GICR_CLRLPIR 0x0048
69#define GICR_SEIR GICD_SEIR
70#define GICR_PROPBASER 0x0070
71#define GICR_PENDBASER 0x0078
72#define GICR_INVLPIR 0x00A0
73#define GICR_INVALLR 0x00B0
74#define GICR_SYNCR 0x00C0
75#define GICR_MOVLPIR 0x0100
76#define GICR_MOVALLR 0x0110
77#define GICR_PIDR2 GICD_PIDR2
78
79#define GICR_WAKER_ProcessorSleep (1U << 1)
80#define GICR_WAKER_ChildrenAsleep (1U << 2)
81
82/*
83 * Re-Distributor registers, offsets from SGI_base
84 */
85#define GICR_ISENABLER0 GICD_ISENABLER
86#define GICR_ICENABLER0 GICD_ICENABLER
87#define GICR_ISPENDR0 GICD_ISPENDR
88#define GICR_ICPENDR0 GICD_ICPENDR
89#define GICR_ISACTIVER0 GICD_ISACTIVER
90#define GICR_ICACTIVER0 GICD_ICACTIVER
91#define GICR_IPRIORITYR0 GICD_IPRIORITYR
92#define GICR_ICFGR0 GICD_ICFGR
93
94#define GICR_TYPER_VLPIS (1U << 1)
95#define GICR_TYPER_LAST (1U << 4)
96
97/*
98 * CPU interface registers
99 */
100#define ICC_CTLR_EL1_EOImode_drop_dir (0U << 1)
101#define ICC_CTLR_EL1_EOImode_drop (1U << 1)
102#define ICC_SRE_EL1_SRE (1U << 0)
103
104/*
105 * Hypervisor interface registers (SRE only)
106 */
107#define ICH_LR_VIRTUAL_ID_MASK ((1UL << 32) - 1)
108
109#define ICH_LR_EOI (1UL << 41)
110#define ICH_LR_GROUP (1UL << 60)
111#define ICH_LR_STATE (3UL << 62)
112#define ICH_LR_PENDING_BIT (1UL << 62)
113#define ICH_LR_ACTIVE_BIT (1UL << 63)
114
115#define ICH_MISR_EOI (1 << 0)
116#define ICH_MISR_U (1 << 1)
117
118#define ICH_HCR_EN (1 << 0)
119#define ICH_HCR_UIE (1 << 1)
120
121#define ICH_VMCR_CTLR_SHIFT 0
122#define ICH_VMCR_CTLR_MASK (0x21f << ICH_VMCR_CTLR_SHIFT)
123#define ICH_VMCR_BPR1_SHIFT 18
124#define ICH_VMCR_BPR1_MASK (7 << ICH_VMCR_BPR1_SHIFT)
125#define ICH_VMCR_BPR0_SHIFT 21
126#define ICH_VMCR_BPR0_MASK (7 << ICH_VMCR_BPR0_SHIFT)
127#define ICH_VMCR_PMR_SHIFT 24
128#define ICH_VMCR_PMR_MASK (0xffUL << ICH_VMCR_PMR_SHIFT)
129
130#define ICC_EOIR1_EL1 sys_reg(3, 0, 12, 12, 1)
131#define ICC_IAR1_EL1 sys_reg(3, 0, 12, 12, 0)
132#define ICC_SGI1R_EL1 sys_reg(3, 0, 12, 11, 5)
133#define ICC_PMR_EL1 sys_reg(3, 0, 4, 6, 0)
134#define ICC_CTLR_EL1 sys_reg(3, 0, 12, 12, 4)
135#define ICC_SRE_EL1 sys_reg(3, 0, 12, 12, 5)
136#define ICC_GRPEN1_EL1 sys_reg(3, 0, 12, 12, 7)
137
138#define ICC_IAR1_EL1_SPURIOUS 0x3ff
139
140#define ICC_SRE_EL2 sys_reg(3, 4, 12, 9, 5)
141
142#define ICC_SRE_EL2_SRE (1 << 0)
143#define ICC_SRE_EL2_ENABLE (1 << 3)
144
145/*
146 * System register definitions
147 */
148#define ICH_VSEIR_EL2 sys_reg(3, 4, 12, 9, 4)
149#define ICH_HCR_EL2 sys_reg(3, 4, 12, 11, 0)
150#define ICH_VTR_EL2 sys_reg(3, 4, 12, 11, 1)
151#define ICH_MISR_EL2 sys_reg(3, 4, 12, 11, 2)
152#define ICH_EISR_EL2 sys_reg(3, 4, 12, 11, 3)
153#define ICH_ELSR_EL2 sys_reg(3, 4, 12, 11, 5)
154#define ICH_VMCR_EL2 sys_reg(3, 4, 12, 11, 7)
155
156#define __LR0_EL2(x) sys_reg(3, 4, 12, 12, x)
157#define __LR8_EL2(x) sys_reg(3, 4, 12, 13, x)
158
159#define ICH_LR0_EL2 __LR0_EL2(0)
160#define ICH_LR1_EL2 __LR0_EL2(1)
161#define ICH_LR2_EL2 __LR0_EL2(2)
162#define ICH_LR3_EL2 __LR0_EL2(3)
163#define ICH_LR4_EL2 __LR0_EL2(4)
164#define ICH_LR5_EL2 __LR0_EL2(5)
165#define ICH_LR6_EL2 __LR0_EL2(6)
166#define ICH_LR7_EL2 __LR0_EL2(7)
167#define ICH_LR8_EL2 __LR8_EL2(0)
168#define ICH_LR9_EL2 __LR8_EL2(1)
169#define ICH_LR10_EL2 __LR8_EL2(2)
170#define ICH_LR11_EL2 __LR8_EL2(3)
171#define ICH_LR12_EL2 __LR8_EL2(4)
172#define ICH_LR13_EL2 __LR8_EL2(5)
173#define ICH_LR14_EL2 __LR8_EL2(6)
174#define ICH_LR15_EL2 __LR8_EL2(7)
175
176#define __AP0Rx_EL2(x) sys_reg(3, 4, 12, 8, x)
177#define ICH_AP0R0_EL2 __AP0Rx_EL2(0)
178#define ICH_AP0R1_EL2 __AP0Rx_EL2(1)
179#define ICH_AP0R2_EL2 __AP0Rx_EL2(2)
180#define ICH_AP0R3_EL2 __AP0Rx_EL2(3)
181
182#define __AP1Rx_EL2(x) sys_reg(3, 4, 12, 9, x)
183#define ICH_AP1R0_EL2 __AP1Rx_EL2(0)
184#define ICH_AP1R1_EL2 __AP1Rx_EL2(1)
185#define ICH_AP1R2_EL2 __AP1Rx_EL2(2)
186#define ICH_AP1R3_EL2 __AP1Rx_EL2(3)
187
188#ifndef __ASSEMBLY__
189
190#include <linux/stringify.h>
191
192static inline void gic_write_eoir(u64 irq)
193{
194 asm volatile("msr_s " __stringify(ICC_EOIR1_EL1) ", %0" : : "r" (irq));
195 isb();
196}
197
198#endif
199
200#endif
diff --git a/include/linux/isdn/capiutil.h b/include/linux/isdn/capiutil.h
index 5a52f2c94f3f..44bd6046e6e2 100644
--- a/include/linux/isdn/capiutil.h
+++ b/include/linux/isdn/capiutil.h
@@ -164,11 +164,6 @@ unsigned capi_cmsg_header(_cmsg * cmsg, __u16 _ApplId,
164 __u8 _Command, __u8 _Subcommand, 164 __u8 _Command, __u8 _Subcommand,
165 __u16 _Messagenumber, __u32 _Controller); 165 __u16 _Messagenumber, __u32 _Controller);
166 166
167/*
168 * capi_info2str generated a readable string for Capi2.0 reasons.
169 */
170char *capi_info2str(__u16 reason);
171
172/*-----------------------------------------------------------------------*/ 167/*-----------------------------------------------------------------------*/
173 168
174/* 169/*
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 17aa1cce6f8e..30faf797c2c3 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -91,6 +91,7 @@ struct kernfs_elem_attr {
91 const struct kernfs_ops *ops; 91 const struct kernfs_ops *ops;
92 struct kernfs_open_node *open; 92 struct kernfs_open_node *open;
93 loff_t size; 93 loff_t size;
94 struct kernfs_node *notify_next; /* for kernfs_notify() */
94}; 95};
95 96
96/* 97/*
@@ -304,6 +305,7 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
304 struct kernfs_root *root, unsigned long magic, 305 struct kernfs_root *root, unsigned long magic,
305 bool *new_sb_created, const void *ns); 306 bool *new_sb_created, const void *ns);
306void kernfs_kill_sb(struct super_block *sb); 307void kernfs_kill_sb(struct super_block *sb);
308struct super_block *kernfs_pin_sb(struct kernfs_root *root, const void *ns);
307 309
308void kernfs_init(void); 310void kernfs_init(void);
309 311
diff --git a/include/linux/key.h b/include/linux/key.h
index 3ae45f09589b..017b0826642f 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -309,6 +309,17 @@ static inline key_serial_t key_serial(const struct key *key)
309 309
310extern void key_set_timeout(struct key *, unsigned); 310extern void key_set_timeout(struct key *, unsigned);
311 311
312/*
313 * The permissions required on a key that we're looking up.
314 */
315#define KEY_NEED_VIEW 0x01 /* Require permission to view attributes */
316#define KEY_NEED_READ 0x02 /* Require permission to read content */
317#define KEY_NEED_WRITE 0x04 /* Require permission to update / modify */
318#define KEY_NEED_SEARCH 0x08 /* Require permission to search (keyring) or find (key) */
319#define KEY_NEED_LINK 0x10 /* Require permission to link */
320#define KEY_NEED_SETATTR 0x20 /* Require permission to change attributes */
321#define KEY_NEED_ALL 0x3f /* All the above permissions */
322
312/** 323/**
313 * key_is_instantiated - Determine if a key has been positively instantiated 324 * key_is_instantiated - Determine if a key has been positively instantiated
314 * @key: The key to check. 325 * @key: The key to check.
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 925eaf28fca9..f7296e57d614 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -205,10 +205,10 @@ struct kretprobe_blackpoint {
205 void *addr; 205 void *addr;
206}; 206};
207 207
208struct kprobe_blackpoint { 208struct kprobe_blacklist_entry {
209 const char *name; 209 struct list_head list;
210 unsigned long start_addr; 210 unsigned long start_addr;
211 unsigned long range; 211 unsigned long end_addr;
212}; 212};
213 213
214#ifdef CONFIG_KPROBES 214#ifdef CONFIG_KPROBES
@@ -265,6 +265,7 @@ extern void arch_disarm_kprobe(struct kprobe *p);
265extern int arch_init_kprobes(void); 265extern int arch_init_kprobes(void);
266extern void show_registers(struct pt_regs *regs); 266extern void show_registers(struct pt_regs *regs);
267extern void kprobes_inc_nmissed_count(struct kprobe *p); 267extern void kprobes_inc_nmissed_count(struct kprobe *p);
268extern bool arch_within_kprobe_blacklist(unsigned long addr);
268 269
269struct kprobe_insn_cache { 270struct kprobe_insn_cache {
270 struct mutex mutex; 271 struct mutex mutex;
@@ -355,7 +356,7 @@ static inline void reset_current_kprobe(void)
355 356
356static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) 357static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
357{ 358{
358 return (&__get_cpu_var(kprobe_ctlblk)); 359 return this_cpu_ptr(&kprobe_ctlblk);
359} 360}
360 361
361int register_kprobe(struct kprobe *p); 362int register_kprobe(struct kprobe *p);
@@ -476,4 +477,18 @@ static inline int enable_jprobe(struct jprobe *jp)
476 return enable_kprobe(&jp->kp); 477 return enable_kprobe(&jp->kp);
477} 478}
478 479
480#ifdef CONFIG_KPROBES
481/*
482 * Blacklist ganerating macro. Specify functions which is not probed
483 * by using this macro.
484 */
485#define __NOKPROBE_SYMBOL(fname) \
486static unsigned long __used \
487 __attribute__((section("_kprobe_blacklist"))) \
488 _kbl_addr_##fname = (unsigned long)fname;
489#define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname)
490#else
491#define NOKPROBE_SYMBOL(fname)
492#endif
493
479#endif /* _LINUX_KPROBES_H */ 494#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 7dcef3317689..13d55206ccf6 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -73,7 +73,6 @@ struct kthread_worker {
73struct kthread_work { 73struct kthread_work {
74 struct list_head node; 74 struct list_head node;
75 kthread_work_func_t func; 75 kthread_work_func_t func;
76 wait_queue_head_t done;
77 struct kthread_worker *worker; 76 struct kthread_worker *worker;
78}; 77};
79 78
@@ -85,7 +84,6 @@ struct kthread_work {
85#define KTHREAD_WORK_INIT(work, fn) { \ 84#define KTHREAD_WORK_INIT(work, fn) { \
86 .node = LIST_HEAD_INIT((work).node), \ 85 .node = LIST_HEAD_INIT((work).node), \
87 .func = (fn), \ 86 .func = (fn), \
88 .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \
89 } 87 }
90 88
91#define DEFINE_KTHREAD_WORKER(worker) \ 89#define DEFINE_KTHREAD_WORKER(worker) \
@@ -95,22 +93,16 @@ struct kthread_work {
95 struct kthread_work work = KTHREAD_WORK_INIT(work, fn) 93 struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
96 94
97/* 95/*
98 * kthread_worker.lock and kthread_work.done need their own lockdep class 96 * kthread_worker.lock needs its own lockdep class key when defined on
99 * keys if they are defined on stack with lockdep enabled. Use the 97 * stack with lockdep enabled. Use the following macros in such cases.
100 * following macros when defining them on stack.
101 */ 98 */
102#ifdef CONFIG_LOCKDEP 99#ifdef CONFIG_LOCKDEP
103# define KTHREAD_WORKER_INIT_ONSTACK(worker) \ 100# define KTHREAD_WORKER_INIT_ONSTACK(worker) \
104 ({ init_kthread_worker(&worker); worker; }) 101 ({ init_kthread_worker(&worker); worker; })
105# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \ 102# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \
106 struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) 103 struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker)
107# define KTHREAD_WORK_INIT_ONSTACK(work, fn) \
108 ({ init_kthread_work((&work), fn); work; })
109# define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) \
110 struct kthread_work work = KTHREAD_WORK_INIT_ONSTACK(work, fn)
111#else 104#else
112# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker) 105# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker)
113# define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) DEFINE_KTHREAD_WORK(work, fn)
114#endif 106#endif
115 107
116extern void __init_kthread_worker(struct kthread_worker *worker, 108extern void __init_kthread_worker(struct kthread_worker *worker,
@@ -127,7 +119,6 @@ extern void __init_kthread_worker(struct kthread_worker *worker,
127 memset((work), 0, sizeof(struct kthread_work)); \ 119 memset((work), 0, sizeof(struct kthread_work)); \
128 INIT_LIST_HEAD(&(work)->node); \ 120 INIT_LIST_HEAD(&(work)->node); \
129 (work)->func = (fn); \ 121 (work)->func = (fn); \
130 init_waitqueue_head(&(work)->done); \
131 } while (0) 122 } while (0)
132 123
133int kthread_worker_fn(void *worker_ptr); 124int kthread_worker_fn(void *worker_ptr);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 31c0cd1c941a..de9e46e6bcc9 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -304,6 +304,30 @@ static inline int ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
304 return 0; 304 return 0;
305} 305}
306 306
307/**
308 * ktime_after - Compare if a ktime_t value is bigger than another one.
309 * @cmp1: comparable1
310 * @cmp2: comparable2
311 *
312 * Return: true if cmp1 happened after cmp2.
313 */
314static inline bool ktime_after(const ktime_t cmp1, const ktime_t cmp2)
315{
316 return ktime_compare(cmp1, cmp2) > 0;
317}
318
319/**
320 * ktime_before - Compare if a ktime_t value is smaller than another one.
321 * @cmp1: comparable1
322 * @cmp2: comparable2
323 *
324 * Return: true if cmp1 happened before cmp2.
325 */
326static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2)
327{
328 return ktime_compare(cmp1, cmp2) < 0;
329}
330
307static inline s64 ktime_to_us(const ktime_t kt) 331static inline s64 ktime_to_us(const ktime_t kt)
308{ 332{
309 struct timeval tv = ktime_to_timeval(kt); 333 struct timeval tv = ktime_to_timeval(kt);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 970c68197c69..ec4e3bd83d47 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -586,7 +586,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
586 586
587void kvm_vcpu_block(struct kvm_vcpu *vcpu); 587void kvm_vcpu_block(struct kvm_vcpu *vcpu);
588void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 588void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
589bool kvm_vcpu_yield_to(struct kvm_vcpu *target); 589int kvm_vcpu_yield_to(struct kvm_vcpu *target);
590void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); 590void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu);
591void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); 591void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
592void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); 592void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5ab4e3a76721..92abb497ab14 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -593,6 +593,7 @@ struct ata_host {
593 struct device *dev; 593 struct device *dev;
594 void __iomem * const *iomap; 594 void __iomem * const *iomap;
595 unsigned int n_ports; 595 unsigned int n_ports;
596 unsigned int n_tags; /* nr of NCQ tags */
596 void *private_data; 597 void *private_data;
597 struct ata_port_operations *ops; 598 struct ata_port_operations *ops;
598 unsigned long flags; 599 unsigned long flags;
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index dcaad79f54ed..219d79627c05 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -17,13 +17,13 @@
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/kref.h> 18#include <linux/kref.h>
19#include <linux/utsname.h> 19#include <linux/utsname.h>
20#include <linux/nfsd/nfsfh.h>
21#include <linux/lockd/bind.h> 20#include <linux/lockd/bind.h>
22#include <linux/lockd/xdr.h> 21#include <linux/lockd/xdr.h>
23#ifdef CONFIG_LOCKD_V4 22#ifdef CONFIG_LOCKD_V4
24#include <linux/lockd/xdr4.h> 23#include <linux/lockd/xdr4.h>
25#endif 24#endif
26#include <linux/lockd/debug.h> 25#include <linux/lockd/debug.h>
26#include <linux/sunrpc/svc.h>
27 27
28/* 28/*
29 * Version string 29 * Version string
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h
index 3e02b768d537..b6401e7661c7 100644
--- a/include/linux/mfd/samsung/rtc.h
+++ b/include/linux/mfd/samsung/rtc.h
@@ -18,38 +18,38 @@
18#ifndef __LINUX_MFD_SEC_RTC_H 18#ifndef __LINUX_MFD_SEC_RTC_H
19#define __LINUX_MFD_SEC_RTC_H 19#define __LINUX_MFD_SEC_RTC_H
20 20
21enum sec_rtc_reg { 21enum s5m_rtc_reg {
22 SEC_RTC_SEC, 22 S5M_RTC_SEC,
23 SEC_RTC_MIN, 23 S5M_RTC_MIN,
24 SEC_RTC_HOUR, 24 S5M_RTC_HOUR,
25 SEC_RTC_WEEKDAY, 25 S5M_RTC_WEEKDAY,
26 SEC_RTC_DATE, 26 S5M_RTC_DATE,
27 SEC_RTC_MONTH, 27 S5M_RTC_MONTH,
28 SEC_RTC_YEAR1, 28 S5M_RTC_YEAR1,
29 SEC_RTC_YEAR2, 29 S5M_RTC_YEAR2,
30 SEC_ALARM0_SEC, 30 S5M_ALARM0_SEC,
31 SEC_ALARM0_MIN, 31 S5M_ALARM0_MIN,
32 SEC_ALARM0_HOUR, 32 S5M_ALARM0_HOUR,
33 SEC_ALARM0_WEEKDAY, 33 S5M_ALARM0_WEEKDAY,
34 SEC_ALARM0_DATE, 34 S5M_ALARM0_DATE,
35 SEC_ALARM0_MONTH, 35 S5M_ALARM0_MONTH,
36 SEC_ALARM0_YEAR1, 36 S5M_ALARM0_YEAR1,
37 SEC_ALARM0_YEAR2, 37 S5M_ALARM0_YEAR2,
38 SEC_ALARM1_SEC, 38 S5M_ALARM1_SEC,
39 SEC_ALARM1_MIN, 39 S5M_ALARM1_MIN,
40 SEC_ALARM1_HOUR, 40 S5M_ALARM1_HOUR,
41 SEC_ALARM1_WEEKDAY, 41 S5M_ALARM1_WEEKDAY,
42 SEC_ALARM1_DATE, 42 S5M_ALARM1_DATE,
43 SEC_ALARM1_MONTH, 43 S5M_ALARM1_MONTH,
44 SEC_ALARM1_YEAR1, 44 S5M_ALARM1_YEAR1,
45 SEC_ALARM1_YEAR2, 45 S5M_ALARM1_YEAR2,
46 SEC_ALARM0_CONF, 46 S5M_ALARM0_CONF,
47 SEC_ALARM1_CONF, 47 S5M_ALARM1_CONF,
48 SEC_RTC_STATUS, 48 S5M_RTC_STATUS,
49 SEC_WTSR_SMPL_CNTL, 49 S5M_WTSR_SMPL_CNTL,
50 SEC_RTC_UDR_CON, 50 S5M_RTC_UDR_CON,
51 51
52 SEC_RTC_REG_MAX, 52 S5M_RTC_REG_MAX,
53}; 53};
54 54
55enum s2mps_rtc_reg { 55enum s2mps_rtc_reg {
@@ -88,9 +88,9 @@ enum s2mps_rtc_reg {
88#define HOUR_12 (1 << 7) 88#define HOUR_12 (1 << 7)
89#define HOUR_AMPM (1 << 6) 89#define HOUR_AMPM (1 << 6)
90#define HOUR_PM (1 << 5) 90#define HOUR_PM (1 << 5)
91#define ALARM0_STATUS (1 << 1) 91#define S5M_ALARM0_STATUS (1 << 1)
92#define ALARM1_STATUS (1 << 2) 92#define S5M_ALARM1_STATUS (1 << 2)
93#define UPDATE_AD (1 << 0) 93#define S5M_UPDATE_AD (1 << 0)
94 94
95#define S2MPS_ALARM0_STATUS (1 << 2) 95#define S2MPS_ALARM0_STATUS (1 << 2)
96#define S2MPS_ALARM1_STATUS (1 << 1) 96#define S2MPS_ALARM1_STATUS (1 << 1)
@@ -101,16 +101,26 @@ enum s2mps_rtc_reg {
101#define MODEL24_SHIFT 1 101#define MODEL24_SHIFT 1
102#define MODEL24_MASK (1 << MODEL24_SHIFT) 102#define MODEL24_MASK (1 << MODEL24_SHIFT)
103/* RTC Update Register1 */ 103/* RTC Update Register1 */
104#define RTC_UDR_SHIFT 0 104#define S5M_RTC_UDR_SHIFT 0
105#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT) 105#define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT)
106#define S2MPS_RTC_WUDR_SHIFT 4 106#define S2MPS_RTC_WUDR_SHIFT 4
107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) 107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT)
108#define S2MPS_RTC_RUDR_SHIFT 0 108#define S2MPS_RTC_RUDR_SHIFT 0
109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) 109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT)
110#define RTC_TCON_SHIFT 1 110#define RTC_TCON_SHIFT 1
111#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT) 111#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT)
112#define RTC_TIME_EN_SHIFT 3 112#define S5M_RTC_TIME_EN_SHIFT 3
113#define RTC_TIME_EN_MASK (1 << RTC_TIME_EN_SHIFT) 113#define S5M_RTC_TIME_EN_MASK (1 << S5M_RTC_TIME_EN_SHIFT)
114/*
115 * UDR_T field in S5M_RTC_UDR_CON register determines the time needed
116 * for updating alarm and time registers. Default is 7.32 ms.
117 */
118#define S5M_RTC_UDR_T_SHIFT 6
119#define S5M_RTC_UDR_T_MASK (0x3 << S5M_RTC_UDR_T_SHIFT)
120#define S5M_RTC_UDR_T_7320_US (0x0 << S5M_RTC_UDR_T_SHIFT)
121#define S5M_RTC_UDR_T_1830_US (0x1 << S5M_RTC_UDR_T_SHIFT)
122#define S5M_RTC_UDR_T_3660_US (0x2 << S5M_RTC_UDR_T_SHIFT)
123#define S5M_RTC_UDR_T_450_US (0x3 << S5M_RTC_UDR_T_SHIFT)
114 124
115/* RTC Hour register */ 125/* RTC Hour register */
116#define HOUR_PM_SHIFT 6 126#define HOUR_PM_SHIFT 6
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index ba87bd21295a..35b51e7af886 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -401,6 +401,7 @@ struct mlx4_caps {
401 int max_rq_desc_sz; 401 int max_rq_desc_sz;
402 int max_qp_init_rdma; 402 int max_qp_init_rdma;
403 int max_qp_dest_rdma; 403 int max_qp_dest_rdma;
404 u32 *qp0_qkey;
404 u32 *qp0_proxy; 405 u32 *qp0_proxy;
405 u32 *qp1_proxy; 406 u32 *qp1_proxy;
406 u32 *qp0_tunnel; 407 u32 *qp0_tunnel;
@@ -449,7 +450,6 @@ struct mlx4_caps {
449 int reserved_qps_base[MLX4_NUM_QP_REGION]; 450 int reserved_qps_base[MLX4_NUM_QP_REGION];
450 int log_num_macs; 451 int log_num_macs;
451 int log_num_vlans; 452 int log_num_vlans;
452 int log_num_prios;
453 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; 453 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
454 u8 supported_type[MLX4_MAX_PORTS + 1]; 454 u8 supported_type[MLX4_MAX_PORTS + 1];
455 u8 suggested_type[MLX4_MAX_PORTS + 1]; 455 u8 suggested_type[MLX4_MAX_PORTS + 1];
@@ -577,6 +577,7 @@ struct mlx4_cq {
577 577
578 u32 cons_index; 578 u32 cons_index;
579 579
580 u16 irq;
580 __be32 *set_ci_db; 581 __be32 *set_ci_db;
581 __be32 *arm_db; 582 __be32 *arm_db;
582 int arm_sn; 583 int arm_sn;
@@ -837,7 +838,7 @@ static inline int mlx4_is_slave(struct mlx4_dev *dev)
837} 838}
838 839
839int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 840int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
840 struct mlx4_buf *buf); 841 struct mlx4_buf *buf, gfp_t gfp);
841void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 842void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
842static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) 843static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset)
843{ 844{
@@ -874,9 +875,10 @@ int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw);
874int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 875int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
875 int start_index, int npages, u64 *page_list); 876 int start_index, int npages, u64 *page_list);
876int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 877int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
877 struct mlx4_buf *buf); 878 struct mlx4_buf *buf, gfp_t gfp);
878 879
879int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order); 880int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order,
881 gfp_t gfp);
880void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db); 882void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db);
881 883
882int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, 884int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
@@ -892,7 +894,8 @@ void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
892int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 894int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base);
893void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 895void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
894 896
895int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp); 897int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp,
898 gfp_t gfp);
896void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); 899void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp);
897 900
898int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn, 901int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn,
@@ -1162,6 +1165,8 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap,
1162 int *vector); 1165 int *vector);
1163void mlx4_release_eq(struct mlx4_dev *dev, int vec); 1166void mlx4_release_eq(struct mlx4_dev *dev, int vec);
1164 1167
1168int mlx4_eq_get_irq(struct mlx4_dev *dev, int vec);
1169
1165int mlx4_get_phys_port_id(struct mlx4_dev *dev); 1170int mlx4_get_phys_port_id(struct mlx4_dev *dev);
1166int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port); 1171int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port);
1167int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port); 1172int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port);
@@ -1234,4 +1239,8 @@ int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port);
1234int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port); 1239int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port);
1235 1240
1236int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port); 1241int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port);
1242int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port);
1243int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port);
1244int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
1245 int enable);
1237#endif /* MLX4_DEVICE_H */ 1246#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 93cef6313e72..2bce4aad2570 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -427,7 +427,6 @@ struct mlx5_core_mr {
427 u64 size; 427 u64 size;
428 u32 key; 428 u32 key;
429 u32 pd; 429 u32 pd;
430 u32 access;
431}; 430};
432 431
433struct mlx5_core_srq { 432struct mlx5_core_srq {
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index b73027298b3a..d424b9de3aff 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -63,12 +63,12 @@ struct mmc_ext_csd {
63 unsigned int power_off_longtime; /* Units: ms */ 63 unsigned int power_off_longtime; /* Units: ms */
64 u8 power_off_notification; /* state */ 64 u8 power_off_notification; /* state */
65 unsigned int hs_max_dtr; 65 unsigned int hs_max_dtr;
66 unsigned int hs200_max_dtr;
66#define MMC_HIGH_26_MAX_DTR 26000000 67#define MMC_HIGH_26_MAX_DTR 26000000
67#define MMC_HIGH_52_MAX_DTR 52000000 68#define MMC_HIGH_52_MAX_DTR 52000000
68#define MMC_HIGH_DDR_MAX_DTR 52000000 69#define MMC_HIGH_DDR_MAX_DTR 52000000
69#define MMC_HS200_MAX_DTR 200000000 70#define MMC_HS200_MAX_DTR 200000000
70 unsigned int sectors; 71 unsigned int sectors;
71 unsigned int card_type;
72 unsigned int hc_erase_size; /* In sectors */ 72 unsigned int hc_erase_size; /* In sectors */
73 unsigned int hc_erase_timeout; /* In milliseconds */ 73 unsigned int hc_erase_timeout; /* In milliseconds */
74 unsigned int sec_trim_mult; /* Secure trim multiplier */ 74 unsigned int sec_trim_mult; /* Secure trim multiplier */
@@ -110,6 +110,7 @@ struct mmc_ext_csd {
110 u8 raw_pwr_cl_200_360; /* 237 */ 110 u8 raw_pwr_cl_200_360; /* 237 */
111 u8 raw_pwr_cl_ddr_52_195; /* 238 */ 111 u8 raw_pwr_cl_ddr_52_195; /* 238 */
112 u8 raw_pwr_cl_ddr_52_360; /* 239 */ 112 u8 raw_pwr_cl_ddr_52_360; /* 239 */
113 u8 raw_pwr_cl_ddr_200_360; /* 253 */
113 u8 raw_bkops_status; /* 246 */ 114 u8 raw_bkops_status; /* 246 */
114 u8 raw_sectors[4]; /* 212 - 4 bytes */ 115 u8 raw_sectors[4]; /* 212 - 4 bytes */
115 116
@@ -194,6 +195,7 @@ struct sdio_cis {
194}; 195};
195 196
196struct mmc_host; 197struct mmc_host;
198struct mmc_ios;
197struct sdio_func; 199struct sdio_func;
198struct sdio_func_tuple; 200struct sdio_func_tuple;
199 201
@@ -250,15 +252,11 @@ struct mmc_card {
250 unsigned int state; /* (our) card state */ 252 unsigned int state; /* (our) card state */
251#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ 253#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
252#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 254#define MMC_STATE_READONLY (1<<1) /* card is read-only */
253#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ 255#define MMC_STATE_BLOCKADDR (1<<2) /* card uses block-addressing */
254#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 256#define MMC_CARD_SDXC (1<<3) /* card is SDXC */
255#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ 257#define MMC_CARD_REMOVED (1<<4) /* card has been removed */
256#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 258#define MMC_STATE_DOING_BKOPS (1<<5) /* card is doing BKOPS */
257#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 259#define MMC_STATE_SUSPENDED (1<<6) /* card is suspended */
258#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
259#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
260#define MMC_STATE_DOING_BKOPS (1<<10) /* card is doing BKOPS */
261#define MMC_STATE_SUSPENDED (1<<11) /* card is suspended */
262 unsigned int quirks; /* card quirks */ 260 unsigned int quirks; /* card quirks */
263#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 261#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
264#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 262#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -301,6 +299,7 @@ struct mmc_card {
301 struct sdio_func_tuple *tuples; /* unknown common tuples */ 299 struct sdio_func_tuple *tuples; /* unknown common tuples */
302 300
303 unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */ 301 unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */
302 unsigned int mmc_avail_type; /* supported device type by both host and card */
304 303
305 struct dentry *debugfs_root; 304 struct dentry *debugfs_root;
306 struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */ 305 struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */
@@ -353,7 +352,7 @@ struct mmc_fixup {
353#define CID_OEMID_ANY ((unsigned short) -1) 352#define CID_OEMID_ANY ((unsigned short) -1)
354#define CID_NAME_ANY (NULL) 353#define CID_NAME_ANY (NULL)
355 354
356#define END_FIXUP { 0 } 355#define END_FIXUP { NULL }
357 356
358#define _FIXUP_EXT(_name, _manfid, _oemid, _rev_start, _rev_end, \ 357#define _FIXUP_EXT(_name, _manfid, _oemid, _rev_start, _rev_end, \
359 _cis_vendor, _cis_device, \ 358 _cis_vendor, _cis_device, \
@@ -418,11 +417,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
418 417
419#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 418#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
420#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 419#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
421#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
422#define mmc_card_hs200(c) ((c)->state & MMC_STATE_HIGHSPEED_200)
423#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 420#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
424#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
425#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
426#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 421#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
427#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED)) 422#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
428#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS) 423#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS)
@@ -430,11 +425,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
430 425
431#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 426#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
432#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 427#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
433#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
434#define mmc_card_set_hs200(c) ((c)->state |= MMC_STATE_HIGHSPEED_200)
435#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 428#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
436#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
437#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
438#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 429#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
439#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED) 430#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
440#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS) 431#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS)
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 6ce7d2cd3c7a..babaea93bca6 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -248,20 +248,6 @@ struct dw_mci_board {
248 /* delay in mS before detecting cards after interrupt */ 248 /* delay in mS before detecting cards after interrupt */
249 u32 detect_delay_ms; 249 u32 detect_delay_ms;
250 250
251 int (*init)(u32 slot_id, irq_handler_t , void *);
252 int (*get_ro)(u32 slot_id);
253 int (*get_cd)(u32 slot_id);
254 int (*get_ocr)(u32 slot_id);
255 int (*get_bus_wd)(u32 slot_id);
256 /*
257 * Enable power to selected slot and set voltage to desired level.
258 * Voltage levels are specified using MMC_VDD_xxx defines defined
259 * in linux/mmc/host.h file.
260 */
261 void (*setpower)(u32 slot_id, u32 volt);
262 void (*exit)(u32 slot_id);
263 void (*select_slot)(u32 slot_id);
264
265 struct dw_mci_dma_ops *dma_ops; 251 struct dw_mci_dma_ops *dma_ops;
266 struct dma_pdata *data; 252 struct dma_pdata *data;
267 struct block_settings *blk_settings; 253 struct block_settings *blk_settings;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index cb61ea4d6945..7960424d0bc0 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -17,6 +17,7 @@
17#include <linux/fault-inject.h> 17#include <linux/fault-inject.h>
18 18
19#include <linux/mmc/core.h> 19#include <linux/mmc/core.h>
20#include <linux/mmc/card.h>
20#include <linux/mmc/pm.h> 21#include <linux/mmc/pm.h>
21 22
22struct mmc_ios { 23struct mmc_ios {
@@ -58,13 +59,9 @@ struct mmc_ios {
58#define MMC_TIMING_UHS_SDR50 5 59#define MMC_TIMING_UHS_SDR50 5
59#define MMC_TIMING_UHS_SDR104 6 60#define MMC_TIMING_UHS_SDR104 6
60#define MMC_TIMING_UHS_DDR50 7 61#define MMC_TIMING_UHS_DDR50 7
61#define MMC_TIMING_MMC_HS200 8 62#define MMC_TIMING_MMC_DDR52 8
62 63#define MMC_TIMING_MMC_HS200 9
63#define MMC_SDR_MODE 0 64#define MMC_TIMING_MMC_HS400 10
64#define MMC_1_2V_DDR_MODE 1
65#define MMC_1_8V_DDR_MODE 2
66#define MMC_1_2V_SDR_MODE 3
67#define MMC_1_8V_SDR_MODE 4
68 65
69 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ 66 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
70 67
@@ -136,6 +133,9 @@ struct mmc_host_ops {
136 133
137 /* The tuning command opcode value is different for SD and eMMC cards */ 134 /* The tuning command opcode value is different for SD and eMMC cards */
138 int (*execute_tuning)(struct mmc_host *host, u32 opcode); 135 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
136
137 /* Prepare HS400 target operating frequency depending host driver */
138 int (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios);
139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
140 void (*hw_reset)(struct mmc_host *host); 140 void (*hw_reset)(struct mmc_host *host);
141 void (*card_event)(struct mmc_host *host); 141 void (*card_event)(struct mmc_host *host);
@@ -278,6 +278,11 @@ struct mmc_host {
278#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 278#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
279 MMC_CAP2_PACKED_WR) 279 MMC_CAP2_PACKED_WR)
280#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 280#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
281#define MMC_CAP2_HS400_1_8V (1 << 15) /* Can support HS400 1.8V */
282#define MMC_CAP2_HS400_1_2V (1 << 16) /* Can support HS400 1.2V */
283#define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \
284 MMC_CAP2_HS400_1_2V)
285#define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
281 286
282 mmc_pm_flag_t pm_caps; /* supported pm features */ 287 mmc_pm_flag_t pm_caps; /* supported pm features */
283 288
@@ -318,6 +323,8 @@ struct mmc_host {
318 int rescan_disable; /* disable card detection */ 323 int rescan_disable; /* disable card detection */
319 int rescan_entered; /* used with nonremovable devices */ 324 int rescan_entered; /* used with nonremovable devices */
320 325
326 bool trigger_card_event; /* card_event necessary */
327
321 struct mmc_card *card; /* device attached to this host */ 328 struct mmc_card *card; /* device attached to this host */
322 329
323 wait_queue_head_t wq; 330 wait_queue_head_t wq;
@@ -391,12 +398,13 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
391 wake_up_process(host->sdio_irq_thread); 398 wake_up_process(host->sdio_irq_thread);
392} 399}
393 400
401void sdio_run_irqs(struct mmc_host *host);
402
394#ifdef CONFIG_REGULATOR 403#ifdef CONFIG_REGULATOR
395int mmc_regulator_get_ocrmask(struct regulator *supply); 404int mmc_regulator_get_ocrmask(struct regulator *supply);
396int mmc_regulator_set_ocr(struct mmc_host *mmc, 405int mmc_regulator_set_ocr(struct mmc_host *mmc,
397 struct regulator *supply, 406 struct regulator *supply,
398 unsigned short vdd_bit); 407 unsigned short vdd_bit);
399int mmc_regulator_get_supply(struct mmc_host *mmc);
400#else 408#else
401static inline int mmc_regulator_get_ocrmask(struct regulator *supply) 409static inline int mmc_regulator_get_ocrmask(struct regulator *supply)
402{ 410{
@@ -409,13 +417,10 @@ static inline int mmc_regulator_set_ocr(struct mmc_host *mmc,
409{ 417{
410 return 0; 418 return 0;
411} 419}
412
413static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
414{
415 return 0;
416}
417#endif 420#endif
418 421
422int mmc_regulator_get_supply(struct mmc_host *mmc);
423
419int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 424int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
420 425
421static inline int mmc_card_is_removable(struct mmc_host *host) 426static inline int mmc_card_is_removable(struct mmc_host *host)
@@ -475,4 +480,32 @@ static inline unsigned int mmc_host_clk_rate(struct mmc_host *host)
475 return host->ios.clock; 480 return host->ios.clock;
476} 481}
477#endif 482#endif
483
484static inline int mmc_card_hs(struct mmc_card *card)
485{
486 return card->host->ios.timing == MMC_TIMING_SD_HS ||
487 card->host->ios.timing == MMC_TIMING_MMC_HS;
488}
489
490static inline int mmc_card_uhs(struct mmc_card *card)
491{
492 return card->host->ios.timing >= MMC_TIMING_UHS_SDR12 &&
493 card->host->ios.timing <= MMC_TIMING_UHS_DDR50;
494}
495
496static inline bool mmc_card_hs200(struct mmc_card *card)
497{
498 return card->host->ios.timing == MMC_TIMING_MMC_HS200;
499}
500
501static inline bool mmc_card_ddr52(struct mmc_card *card)
502{
503 return card->host->ios.timing == MMC_TIMING_MMC_DDR52;
504}
505
506static inline bool mmc_card_hs400(struct mmc_card *card)
507{
508 return card->host->ios.timing == MMC_TIMING_MMC_HS400;
509}
510
478#endif /* LINUX_MMC_HOST_H */ 511#endif /* LINUX_MMC_HOST_H */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 50bcde3677ca..64ec963ed347 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -325,6 +325,7 @@ struct _mmc_csd {
325#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ 325#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */
326#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ 326#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
327#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ 327#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
328#define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */
328#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ 329#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
329#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ 330#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
330#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */ 331#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */
@@ -354,18 +355,25 @@ struct _mmc_csd {
354#define EXT_CSD_CMD_SET_SECURE (1<<1) 355#define EXT_CSD_CMD_SET_SECURE (1<<1)
355#define EXT_CSD_CMD_SET_CPSECURE (1<<2) 356#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
356 357
357#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 358#define EXT_CSD_CARD_TYPE_HS_26 (1<<0) /* Card can run at 26MHz */
358#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 359#define EXT_CSD_CARD_TYPE_HS_52 (1<<1) /* Card can run at 52MHz */
359#define EXT_CSD_CARD_TYPE_MASK 0x3F /* Mask out reserved bits */ 360#define EXT_CSD_CARD_TYPE_HS (EXT_CSD_CARD_TYPE_HS_26 | \
361 EXT_CSD_CARD_TYPE_HS_52)
360#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ 362#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
361 /* DDR mode @1.8V or 3V I/O */ 363 /* DDR mode @1.8V or 3V I/O */
362#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ 364#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
363 /* DDR mode @1.2V I/O */ 365 /* DDR mode @1.2V I/O */
364#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ 366#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
365 | EXT_CSD_CARD_TYPE_DDR_1_2V) 367 | EXT_CSD_CARD_TYPE_DDR_1_2V)
366#define EXT_CSD_CARD_TYPE_SDR_1_8V (1<<4) /* Card can run at 200MHz */ 368#define EXT_CSD_CARD_TYPE_HS200_1_8V (1<<4) /* Card can run at 200MHz */
367#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */ 369#define EXT_CSD_CARD_TYPE_HS200_1_2V (1<<5) /* Card can run at 200MHz */
368 /* SDR mode @1.2V I/O */ 370 /* SDR mode @1.2V I/O */
371#define EXT_CSD_CARD_TYPE_HS200 (EXT_CSD_CARD_TYPE_HS200_1_8V | \
372 EXT_CSD_CARD_TYPE_HS200_1_2V)
373#define EXT_CSD_CARD_TYPE_HS400_1_8V (1<<6) /* Card can run at 200MHz DDR, 1.8V */
374#define EXT_CSD_CARD_TYPE_HS400_1_2V (1<<7) /* Card can run at 200MHz DDR, 1.2V */
375#define EXT_CSD_CARD_TYPE_HS400 (EXT_CSD_CARD_TYPE_HS400_1_8V | \
376 EXT_CSD_CARD_TYPE_HS400_1_2V)
369 377
370#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 378#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
371#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 379#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
@@ -373,6 +381,11 @@ struct _mmc_csd {
373#define EXT_CSD_DDR_BUS_WIDTH_4 5 /* Card is in 4 bit DDR mode */ 381#define EXT_CSD_DDR_BUS_WIDTH_4 5 /* Card is in 4 bit DDR mode */
374#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */ 382#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */
375 383
384#define EXT_CSD_TIMING_BC 0 /* Backwards compatility */
385#define EXT_CSD_TIMING_HS 1 /* High speed */
386#define EXT_CSD_TIMING_HS200 2 /* HS200 */
387#define EXT_CSD_TIMING_HS400 3 /* HS400 */
388
376#define EXT_CSD_SEC_ER_EN BIT(0) 389#define EXT_CSD_SEC_ER_EN BIT(0)
377#define EXT_CSD_SEC_BD_BLK_EN BIT(2) 390#define EXT_CSD_SEC_BD_BLK_EN BIT(2)
378#define EXT_CSD_SEC_GB_CL_EN BIT(4) 391#define EXT_CSD_SEC_GB_CL_EN BIT(4)
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 7be12b883485..08abe9941884 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -57,12 +57,8 @@ struct sdhci_host {
57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) 57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15)
58/* Controller reports inverted write-protect state */ 58/* Controller reports inverted write-protect state */
59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) 59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16)
60/* Controller has nonstandard clock management */
61#define SDHCI_QUIRK_NONSTANDARD_CLOCK (1<<17)
62/* Controller does not like fast PIO transfers */ 60/* Controller does not like fast PIO transfers */
63#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18) 61#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18)
64/* Controller losing signal/interrupt enable states after reset */
65#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1<<19)
66/* Controller has to be forced to use block size of 2048 bytes */ 62/* Controller has to be forced to use block size of 2048 bytes */
67#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20) 63#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
68/* Controller cannot do multi-block transfers */ 64/* Controller cannot do multi-block transfers */
@@ -147,6 +143,7 @@ struct sdhci_host {
147 143
148 bool runtime_suspended; /* Host is runtime suspended */ 144 bool runtime_suspended; /* Host is runtime suspended */
149 bool bus_on; /* Bus power prevents runtime suspend */ 145 bool bus_on; /* Bus power prevents runtime suspend */
146 bool preset_enabled; /* Preset is enabled */
150 147
151 struct mmc_request *mrq; /* Current request */ 148 struct mmc_request *mrq; /* Current request */
152 struct mmc_command *cmd; /* Current command */ 149 struct mmc_command *cmd; /* Current command */
@@ -164,8 +161,7 @@ struct sdhci_host {
164 dma_addr_t adma_addr; /* Mapped ADMA descr. table */ 161 dma_addr_t adma_addr; /* Mapped ADMA descr. table */
165 dma_addr_t align_addr; /* Mapped bounce buffer */ 162 dma_addr_t align_addr; /* Mapped bounce buffer */
166 163
167 struct tasklet_struct card_tasklet; /* Tasklet structures */ 164 struct tasklet_struct finish_tasklet; /* Tasklet structures */
168 struct tasklet_struct finish_tasklet;
169 165
170 struct timer_list timer; /* Timer for timeouts */ 166 struct timer_list timer; /* Timer for timeouts */
171 167
@@ -177,6 +173,13 @@ struct sdhci_host {
177 unsigned int ocr_avail_mmc; 173 unsigned int ocr_avail_mmc;
178 u32 ocr_mask; /* available voltages */ 174 u32 ocr_mask; /* available voltages */
179 175
176 unsigned timing; /* Current timing */
177
178 u32 thread_isr;
179
180 /* cached registers */
181 u32 ier;
182
180 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ 183 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */
181 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ 184 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */
182 185
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 204a67743804..b1990c5524e1 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -321,7 +321,7 @@ extern bool parameq(const char *name1, const char *name2);
321extern bool parameqn(const char *name1, const char *name2, size_t n); 321extern bool parameqn(const char *name1, const char *name2, size_t n);
322 322
323/* Called on module insert or kernel boot */ 323/* Called on module insert or kernel boot */
324extern int parse_args(const char *name, 324extern char *parse_args(const char *name,
325 char *args, 325 char *args,
326 const struct kernel_param *params, 326 const struct kernel_param *params,
327 unsigned num, 327 unsigned num,
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 92a2f991262a..8103f32f6d87 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -25,7 +25,8 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg);
25struct msi_desc { 25struct msi_desc {
26 struct { 26 struct {
27 __u8 is_msix : 1; 27 __u8 is_msix : 1;
28 __u8 multiple: 3; /* log2 number of messages */ 28 __u8 multiple: 3; /* log2 num of messages allocated */
29 __u8 multi_cap : 3; /* log2 num of messages supported */
29 __u8 maskbit : 1; /* mask-pending bit supported ? */ 30 __u8 maskbit : 1; /* mask-pending bit supported ? */
30 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
31 __u8 pos; /* Location of the msi capability */ 32 __u8 pos; /* Location of the msi capability */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 450d61ec7f06..2f0af2891f0f 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -176,6 +176,11 @@ typedef enum {
176/* Chip may not exist, so silence any errors in scan */ 176/* Chip may not exist, so silence any errors in scan */
177#define NAND_SCAN_SILENT_NODEV 0x00040000 177#define NAND_SCAN_SILENT_NODEV 0x00040000
178/* 178/*
179 * This option could be defined by controller drivers to protect against
180 * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers
181 */
182#define NAND_USE_BOUNCE_BUFFER 0x00080000
183/*
179 * Autodetect nand buswidth with readid/onfi. 184 * Autodetect nand buswidth with readid/onfi.
180 * This suppose the driver will configure the hardware in 8 bits mode 185 * This suppose the driver will configure the hardware in 8 bits mode
181 * when calling nand_scan_ident, and update its configuration 186 * when calling nand_scan_ident, and update its configuration
@@ -552,8 +557,7 @@ struct nand_buffers {
552 * @ecc: [BOARDSPECIFIC] ECC control structure 557 * @ecc: [BOARDSPECIFIC] ECC control structure
553 * @buffers: buffer structure for read/write 558 * @buffers: buffer structure for read/write
554 * @hwcontrol: platform-specific hardware control structure 559 * @hwcontrol: platform-specific hardware control structure
555 * @erase_cmd: [INTERN] erase command write function, selectable due 560 * @erase: [REPLACEABLE] erase function
556 * to AND support.
557 * @scan_bbt: [REPLACEABLE] function to scan bad block table 561 * @scan_bbt: [REPLACEABLE] function to scan bad block table
558 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring 562 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring
559 * data from array to read regs (tR). 563 * data from array to read regs (tR).
@@ -637,7 +641,7 @@ struct nand_chip {
637 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, 641 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column,
638 int page_addr); 642 int page_addr);
639 int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this); 643 int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
640 void (*erase_cmd)(struct mtd_info *mtd, int page); 644 int (*erase)(struct mtd_info *mtd, int page);
641 int (*scan_bbt)(struct mtd_info *mtd); 645 int (*scan_bbt)(struct mtd_info *mtd);
642 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, 646 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,
643 int status, int page); 647 int status, int page);
diff --git a/include/linux/mtd/pfow.h b/include/linux/mtd/pfow.h
index b730d4f84655..42ff7ff09bf5 100644
--- a/include/linux/mtd/pfow.h
+++ b/include/linux/mtd/pfow.h
@@ -101,9 +101,6 @@ static inline void send_pfow_command(struct map_info *map,
101 unsigned long len, map_word *datum) 101 unsigned long len, map_word *datum)
102{ 102{
103 int bits_per_chip = map_bankwidth(map) * 8; 103 int bits_per_chip = map_bankwidth(map) * 8;
104 int chipnum;
105 struct lpddr_private *lpddr = map->fldrv_priv;
106 chipnum = adr >> lpddr->chipshift;
107 104
108 map_write(map, CMD(cmd_code), map->pfow_base + PFOW_COMMAND_CODE); 105 map_write(map, CMD(cmd_code), map->pfow_base + PFOW_COMMAND_CODE);
109 map_write(map, CMD(adr & ((1<<bits_per_chip) - 1)), 106 map_write(map, CMD(adr & ((1<<bits_per_chip) - 1)),
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
new file mode 100644
index 000000000000..53241842a7ab
--- /dev/null
+++ b/include/linux/mtd/spi-nor.h
@@ -0,0 +1,214 @@
1/*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc.
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
10#ifndef __LINUX_MTD_SPI_NOR_H
11#define __LINUX_MTD_SPI_NOR_H
12
13/*
14 * Note on opcode nomenclature: some opcodes have a format like
15 * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number
16 * of I/O lines used for the opcode, address, and data (respectively). The
17 * FUNCTION has an optional suffix of '4', to represent an opcode which
18 * requires a 4-byte (32-bit) address.
19 */
20
21/* Flash opcodes. */
22#define SPINOR_OP_WREN 0x06 /* Write enable */
23#define SPINOR_OP_RDSR 0x05 /* Read status register */
24#define SPINOR_OP_WRSR 0x01 /* Write status register 1 byte */
25#define SPINOR_OP_READ 0x03 /* Read data bytes (low frequency) */
26#define SPINOR_OP_READ_FAST 0x0b /* Read data bytes (high frequency) */
27#define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */
28#define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */
29#define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */
30#define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */
31#define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
32#define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */
33#define SPINOR_OP_CHIP_ERASE 0xc7 /* Erase whole flash chip */
34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */
35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */
36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */
37
38/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
39#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */
40#define SPINOR_OP_READ4_FAST 0x0c /* Read data bytes (high frequency) */
41#define SPINOR_OP_READ4_1_1_2 0x3c /* Read data bytes (Dual SPI) */
42#define SPINOR_OP_READ4_1_1_4 0x6c /* Read data bytes (Quad SPI) */
43#define SPINOR_OP_PP_4B 0x12 /* Page program (up to 256 bytes) */
44#define SPINOR_OP_SE_4B 0xdc /* Sector erase (usually 64KiB) */
45
46/* Used for SST flashes only. */
47#define SPINOR_OP_BP 0x02 /* Byte program */
48#define SPINOR_OP_WRDI 0x04 /* Write disable */
49#define SPINOR_OP_AAI_WP 0xad /* Auto address increment word program */
50
51/* Used for Macronix and Winbond flashes. */
52#define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */
53#define SPINOR_OP_EX4B 0xe9 /* Exit 4-byte mode */
54
55/* Used for Spansion flashes only. */
56#define SPINOR_OP_BRWR 0x17 /* Bank register write */
57
58/* Status Register bits. */
59#define SR_WIP 1 /* Write in progress */
60#define SR_WEL 2 /* Write enable latch */
61/* meaning of other SR_* bits may differ between vendors */
62#define SR_BP0 4 /* Block protect 0 */
63#define SR_BP1 8 /* Block protect 1 */
64#define SR_BP2 0x10 /* Block protect 2 */
65#define SR_SRWD 0x80 /* SR write protect */
66
67#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */
68
69/* Configuration Register bits. */
70#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */
71
72enum read_mode {
73 SPI_NOR_NORMAL = 0,
74 SPI_NOR_FAST,
75 SPI_NOR_DUAL,
76 SPI_NOR_QUAD,
77};
78
79/**
80 * struct spi_nor_xfer_cfg - Structure for defining a Serial Flash transfer
81 * @wren: command for "Write Enable", or 0x00 for not required
82 * @cmd: command for operation
83 * @cmd_pins: number of pins to send @cmd (1, 2, 4)
84 * @addr: address for operation
85 * @addr_pins: number of pins to send @addr (1, 2, 4)
86 * @addr_width: number of address bytes
87 * (3,4, or 0 for address not required)
88 * @mode: mode data
89 * @mode_pins: number of pins to send @mode (1, 2, 4)
90 * @mode_cycles: number of mode cycles (0 for mode not required)
91 * @dummy_cycles: number of dummy cycles (0 for dummy not required)
92 */
93struct spi_nor_xfer_cfg {
94 u8 wren;
95 u8 cmd;
96 u8 cmd_pins;
97 u32 addr;
98 u8 addr_pins;
99 u8 addr_width;
100 u8 mode;
101 u8 mode_pins;
102 u8 mode_cycles;
103 u8 dummy_cycles;
104};
105
106#define SPI_NOR_MAX_CMD_SIZE 8
107enum spi_nor_ops {
108 SPI_NOR_OPS_READ = 0,
109 SPI_NOR_OPS_WRITE,
110 SPI_NOR_OPS_ERASE,
111 SPI_NOR_OPS_LOCK,
112 SPI_NOR_OPS_UNLOCK,
113};
114
115/**
116 * struct spi_nor - Structure for defining a the SPI NOR layer
117 * @mtd: point to a mtd_info structure
118 * @lock: the lock for the read/write/erase/lock/unlock operations
119 * @dev: point to a spi device, or a spi nor controller device.
120 * @page_size: the page size of the SPI NOR
121 * @addr_width: number of address bytes
122 * @erase_opcode: the opcode for erasing a sector
123 * @read_opcode: the read opcode
124 * @read_dummy: the dummy needed by the read operation
125 * @program_opcode: the program opcode
126 * @flash_read: the mode of the read
127 * @sst_write_second: used by the SST write operation
128 * @cfg: used by the read_xfer/write_xfer
129 * @cmd_buf: used by the write_reg
130 * @prepare: [OPTIONAL] do some preparations for the
131 * read/write/erase/lock/unlock operations
132 * @unprepare: [OPTIONAL] do some post work after the
133 * read/write/erase/lock/unlock operations
134 * @read_xfer: [OPTIONAL] the read fundamental primitive
135 * @write_xfer: [OPTIONAL] the writefundamental primitive
136 * @read_reg: [DRIVER-SPECIFIC] read out the register
137 * @write_reg: [DRIVER-SPECIFIC] write data to the register
138 * @read_id: [REPLACEABLE] read out the ID data, and find
139 * the proper spi_device_id
140 * @wait_till_ready: [REPLACEABLE] wait till the NOR becomes ready
141 * @read: [DRIVER-SPECIFIC] read data from the SPI NOR
142 * @write: [DRIVER-SPECIFIC] write data to the SPI NOR
143 * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR
144 * at the offset @offs
145 * @priv: the private data
146 */
147struct spi_nor {
148 struct mtd_info *mtd;
149 struct mutex lock;
150 struct device *dev;
151 u32 page_size;
152 u8 addr_width;
153 u8 erase_opcode;
154 u8 read_opcode;
155 u8 read_dummy;
156 u8 program_opcode;
157 enum read_mode flash_read;
158 bool sst_write_second;
159 struct spi_nor_xfer_cfg cfg;
160 u8 cmd_buf[SPI_NOR_MAX_CMD_SIZE];
161
162 int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops);
163 void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops);
164 int (*read_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg,
165 u8 *buf, size_t len);
166 int (*write_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg,
167 u8 *buf, size_t len);
168 int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
169 int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len,
170 int write_enable);
171 const struct spi_device_id *(*read_id)(struct spi_nor *nor);
172 int (*wait_till_ready)(struct spi_nor *nor);
173
174 int (*read)(struct spi_nor *nor, loff_t from,
175 size_t len, size_t *retlen, u_char *read_buf);
176 void (*write)(struct spi_nor *nor, loff_t to,
177 size_t len, size_t *retlen, const u_char *write_buf);
178 int (*erase)(struct spi_nor *nor, loff_t offs);
179
180 void *priv;
181};
182
183/**
184 * spi_nor_scan() - scan the SPI NOR
185 * @nor: the spi_nor structure
186 * @id: the spi_device_id provided by the driver
187 * @mode: the read mode supported by the driver
188 *
189 * The drivers can use this fuction to scan the SPI NOR.
190 * In the scanning, it will try to get all the necessary information to
191 * fill the mtd_info{} and the spi_nor{}.
192 *
193 * The board may assigns a spi_device_id with @id which be used to compared with
194 * the spi_device_id detected by the scanning.
195 *
196 * Return: 0 for success, others for failure.
197 */
198int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
199 enum read_mode mode);
200extern const struct spi_device_id spi_nor_ids[];
201
202/**
203 * spi_nor_match_id() - find the spi_device_id by the name
204 * @name: the name of the spi_device_id
205 *
206 * The drivers use this function to find the spi_device_id
207 * specified by the @name.
208 *
209 * Return: returns the right spi_device_id pointer on success,
210 * and returns NULL on failure.
211 */
212const struct spi_device_id *spi_nor_match_id(char *name);
213
214#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 11692dea18aa..8d5535c58cc2 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -17,6 +17,7 @@
17#include <linux/lockdep.h> 17#include <linux/lockdep.h>
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19#include <asm/processor.h> 19#include <asm/processor.h>
20#include <linux/osq_lock.h>
20 21
21/* 22/*
22 * Simple, straightforward mutexes with strict semantics: 23 * Simple, straightforward mutexes with strict semantics:
@@ -46,7 +47,6 @@
46 * - detects multi-task circular deadlocks and prints out all affected 47 * - detects multi-task circular deadlocks and prints out all affected
47 * locks and tasks (and only those tasks) 48 * locks and tasks (and only those tasks)
48 */ 49 */
49struct optimistic_spin_queue;
50struct mutex { 50struct mutex {
51 /* 1: unlocked, 0: locked, negative: locked, possible waiters */ 51 /* 1: unlocked, 0: locked, negative: locked, possible waiters */
52 atomic_t count; 52 atomic_t count;
@@ -56,7 +56,7 @@ struct mutex {
56 struct task_struct *owner; 56 struct task_struct *owner;
57#endif 57#endif
58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER 58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
59 struct optimistic_spin_queue *osq; /* Spinner MCS lock */ 59 struct optimistic_spin_queue osq; /* Spinner MCS lock */
60#endif 60#endif
61#ifdef CONFIG_DEBUG_MUTEXES 61#ifdef CONFIG_DEBUG_MUTEXES
62 const char *name; 62 const char *name;
@@ -176,8 +176,4 @@ extern void mutex_unlock(struct mutex *lock);
176 176
177extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 177extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
178 178
179#ifndef arch_mutex_cpu_relax
180# define arch_mutex_cpu_relax() cpu_relax()
181#endif
182
183#endif /* __LINUX_MUTEX_H */ 179#endif /* __LINUX_MUTEX_H */
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index c26d0ec2ef3a..d99800cbdcf3 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -42,9 +42,11 @@ enum {
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ 42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 NETIF_F_GSO_GRE_CSUM_BIT, /* ... GRE with csum with TSO */
45 NETIF_F_GSO_IPIP_BIT, /* ... IPIP tunnel with TSO */ 46 NETIF_F_GSO_IPIP_BIT, /* ... IPIP tunnel with TSO */
46 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */ 47 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */
47 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ 48 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
49 NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */
48 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */ 50 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */
49 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 51 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
50 NETIF_F_GSO_MPLS_BIT, 52 NETIF_F_GSO_MPLS_BIT,
@@ -111,9 +113,11 @@ enum {
111#define NETIF_F_RXFCS __NETIF_F(RXFCS) 113#define NETIF_F_RXFCS __NETIF_F(RXFCS)
112#define NETIF_F_RXALL __NETIF_F(RXALL) 114#define NETIF_F_RXALL __NETIF_F(RXALL)
113#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) 115#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
116#define NETIF_F_GSO_GRE_CSUM __NETIF_F(GSO_GRE_CSUM)
114#define NETIF_F_GSO_IPIP __NETIF_F(GSO_IPIP) 117#define NETIF_F_GSO_IPIP __NETIF_F(GSO_IPIP)
115#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT) 118#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT)
116#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) 119#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
120#define NETIF_F_GSO_UDP_TUNNEL_CSUM __NETIF_F(GSO_UDP_TUNNEL_CSUM)
117#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS) 121#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS)
118#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 122#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
119#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 123#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6c1ae9fd9505..66f9a04ec270 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -56,9 +56,6 @@ struct device;
56struct phy_device; 56struct phy_device;
57/* 802.11 specific */ 57/* 802.11 specific */
58struct wireless_dev; 58struct wireless_dev;
59 /* source back-compat hooks */
60#define SET_ETHTOOL_OPS(netdev,ops) \
61 ( (netdev)->ethtool_ops = (ops) )
62 59
63void netdev_set_default_ethtool_ops(struct net_device *dev, 60void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops); 61 const struct ethtool_ops *ops);
@@ -853,7 +850,8 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
853 * SR-IOV management functions. 850 * SR-IOV management functions.
854 * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); 851 * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
855 * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); 852 * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
856 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); 853 * int (*ndo_set_vf_rate)(struct net_device *dev, int vf, int min_tx_rate,
854 * int max_tx_rate);
857 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); 855 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
858 * int (*ndo_get_vf_config)(struct net_device *dev, 856 * int (*ndo_get_vf_config)(struct net_device *dev,
859 * int vf, struct ifla_vf_info *ivf); 857 * int vf, struct ifla_vf_info *ivf);
@@ -1047,8 +1045,9 @@ struct net_device_ops {
1047 int queue, u8 *mac); 1045 int queue, u8 *mac);
1048 int (*ndo_set_vf_vlan)(struct net_device *dev, 1046 int (*ndo_set_vf_vlan)(struct net_device *dev,
1049 int queue, u16 vlan, u8 qos); 1047 int queue, u16 vlan, u8 qos);
1050 int (*ndo_set_vf_tx_rate)(struct net_device *dev, 1048 int (*ndo_set_vf_rate)(struct net_device *dev,
1051 int vf, int rate); 1049 int vf, int min_tx_rate,
1050 int max_tx_rate);
1052 int (*ndo_set_vf_spoofchk)(struct net_device *dev, 1051 int (*ndo_set_vf_spoofchk)(struct net_device *dev,
1053 int vf, bool setting); 1052 int vf, bool setting);
1054 int (*ndo_get_vf_config)(struct net_device *dev, 1053 int (*ndo_get_vf_config)(struct net_device *dev,
@@ -2634,6 +2633,7 @@ int dev_get_phys_port_id(struct net_device *dev,
2634 struct netdev_phys_port_id *ppid); 2633 struct netdev_phys_port_id *ppid);
2635int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2634int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2636 struct netdev_queue *txq); 2635 struct netdev_queue *txq);
2636int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2637int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2637int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2638bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb); 2638bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
2639 2639
@@ -3003,6 +3003,15 @@ int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
3003 struct netdev_hw_addr_list *from_list, int addr_len); 3003 struct netdev_hw_addr_list *from_list, int addr_len);
3004void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, 3004void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
3005 struct netdev_hw_addr_list *from_list, int addr_len); 3005 struct netdev_hw_addr_list *from_list, int addr_len);
3006int __hw_addr_sync_dev(struct netdev_hw_addr_list *list,
3007 struct net_device *dev,
3008 int (*sync)(struct net_device *, const unsigned char *),
3009 int (*unsync)(struct net_device *,
3010 const unsigned char *));
3011void __hw_addr_unsync_dev(struct netdev_hw_addr_list *list,
3012 struct net_device *dev,
3013 int (*unsync)(struct net_device *,
3014 const unsigned char *));
3006void __hw_addr_init(struct netdev_hw_addr_list *list); 3015void __hw_addr_init(struct netdev_hw_addr_list *list);
3007 3016
3008/* Functions used for device addresses handling */ 3017/* Functions used for device addresses handling */
@@ -3023,6 +3032,38 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from);
3023void dev_uc_flush(struct net_device *dev); 3032void dev_uc_flush(struct net_device *dev);
3024void dev_uc_init(struct net_device *dev); 3033void dev_uc_init(struct net_device *dev);
3025 3034
3035/**
3036 * __dev_uc_sync - Synchonize device's unicast list
3037 * @dev: device to sync
3038 * @sync: function to call if address should be added
3039 * @unsync: function to call if address should be removed
3040 *
3041 * Add newly added addresses to the interface, and release
3042 * addresses that have been deleted.
3043 **/
3044static inline int __dev_uc_sync(struct net_device *dev,
3045 int (*sync)(struct net_device *,
3046 const unsigned char *),
3047 int (*unsync)(struct net_device *,
3048 const unsigned char *))
3049{
3050 return __hw_addr_sync_dev(&dev->uc, dev, sync, unsync);
3051}
3052
3053/**
3054 * __dev_uc_unsync - Remove synchonized addresses from device
3055 * @dev: device to sync
3056 * @unsync: function to call if address should be removed
3057 *
3058 * Remove all addresses that were added to the device by dev_uc_sync().
3059 **/
3060static inline void __dev_uc_unsync(struct net_device *dev,
3061 int (*unsync)(struct net_device *,
3062 const unsigned char *))
3063{
3064 __hw_addr_unsync_dev(&dev->uc, dev, unsync);
3065}
3066
3026/* Functions used for multicast addresses handling */ 3067/* Functions used for multicast addresses handling */
3027int dev_mc_add(struct net_device *dev, const unsigned char *addr); 3068int dev_mc_add(struct net_device *dev, const unsigned char *addr);
3028int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); 3069int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
@@ -3035,6 +3076,38 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from);
3035void dev_mc_flush(struct net_device *dev); 3076void dev_mc_flush(struct net_device *dev);
3036void dev_mc_init(struct net_device *dev); 3077void dev_mc_init(struct net_device *dev);
3037 3078
3079/**
3080 * __dev_mc_sync - Synchonize device's multicast list
3081 * @dev: device to sync
3082 * @sync: function to call if address should be added
3083 * @unsync: function to call if address should be removed
3084 *
3085 * Add newly added addresses to the interface, and release
3086 * addresses that have been deleted.
3087 **/
3088static inline int __dev_mc_sync(struct net_device *dev,
3089 int (*sync)(struct net_device *,
3090 const unsigned char *),
3091 int (*unsync)(struct net_device *,
3092 const unsigned char *))
3093{
3094 return __hw_addr_sync_dev(&dev->mc, dev, sync, unsync);
3095}
3096
3097/**
3098 * __dev_mc_unsync - Remove synchonized addresses from device
3099 * @dev: device to sync
3100 * @unsync: function to call if address should be removed
3101 *
3102 * Remove all addresses that were added to the device by dev_mc_sync().
3103 **/
3104static inline void __dev_mc_unsync(struct net_device *dev,
3105 int (*unsync)(struct net_device *,
3106 const unsigned char *))
3107{
3108 __hw_addr_unsync_dev(&dev->mc, dev, unsync);
3109}
3110
3038/* Functions used for secondary unicast and multicast support */ 3111/* Functions used for secondary unicast and multicast support */
3039void dev_set_rx_mode(struct net_device *dev); 3112void dev_set_rx_mode(struct net_device *dev);
3040void __dev_set_rx_mode(struct net_device *dev); 3113void __dev_set_rx_mode(struct net_device *dev);
@@ -3180,6 +3253,20 @@ const char *netdev_drivername(const struct net_device *dev);
3180 3253
3181void linkwatch_run_queue(void); 3254void linkwatch_run_queue(void);
3182 3255
3256static inline netdev_features_t netdev_intersect_features(netdev_features_t f1,
3257 netdev_features_t f2)
3258{
3259 if (f1 & NETIF_F_GEN_CSUM)
3260 f1 |= (NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
3261 if (f2 & NETIF_F_GEN_CSUM)
3262 f2 |= (NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
3263 f1 &= f2;
3264 if (f1 & NETIF_F_GEN_CSUM)
3265 f1 &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
3266
3267 return f1;
3268}
3269
3183static inline netdev_features_t netdev_get_wanted_features( 3270static inline netdev_features_t netdev_get_wanted_features(
3184 struct net_device *dev) 3271 struct net_device *dev)
3185{ 3272{
@@ -3218,6 +3305,13 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
3218 BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT)); 3305 BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
3219 BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT)); 3306 BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
3220 BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT)); 3307 BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
3308 BUILD_BUG_ON(SKB_GSO_GRE != (NETIF_F_GSO_GRE >> NETIF_F_GSO_SHIFT));
3309 BUILD_BUG_ON(SKB_GSO_GRE_CSUM != (NETIF_F_GSO_GRE_CSUM >> NETIF_F_GSO_SHIFT));
3310 BUILD_BUG_ON(SKB_GSO_IPIP != (NETIF_F_GSO_IPIP >> NETIF_F_GSO_SHIFT));
3311 BUILD_BUG_ON(SKB_GSO_SIT != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT));
3312 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT));
3313 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT));
3314 BUILD_BUG_ON(SKB_GSO_MPLS != (NETIF_F_GSO_MPLS >> NETIF_F_GSO_SHIFT));
3221 3315
3222 return (features & feature) == feature; 3316 return (features & feature) == feature;
3223} 3317}
diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h
index b2e85e59f760..6ec975748742 100644
--- a/include/linux/netfilter/nfnetlink_acct.h
+++ b/include/linux/netfilter/nfnetlink_acct.h
@@ -3,11 +3,17 @@
3 3
4#include <uapi/linux/netfilter/nfnetlink_acct.h> 4#include <uapi/linux/netfilter/nfnetlink_acct.h>
5 5
6enum {
7 NFACCT_NO_QUOTA = -1,
8 NFACCT_UNDERQUOTA,
9 NFACCT_OVERQUOTA,
10};
6 11
7struct nf_acct; 12struct nf_acct;
8 13
9struct nf_acct *nfnl_acct_find_get(const char *filter_name); 14struct nf_acct *nfnl_acct_find_get(const char *filter_name);
10void nfnl_acct_put(struct nf_acct *acct); 15void nfnl_acct_put(struct nf_acct *acct);
11void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct); 16void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
12 17extern int nfnl_acct_overquota(const struct sk_buff *skb,
18 struct nf_acct *nfacct);
13#endif /* _NFNL_ACCT_H */ 19#endif /* _NFNL_ACCT_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 034cda789a15..9e572daa15d5 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -46,7 +46,8 @@ struct netlink_kernel_cfg {
46 unsigned int flags; 46 unsigned int flags;
47 void (*input)(struct sk_buff *skb); 47 void (*input)(struct sk_buff *skb);
48 struct mutex *cb_mutex; 48 struct mutex *cb_mutex;
49 void (*bind)(int group); 49 int (*bind)(int group);
50 void (*unbind)(int group);
50 bool (*compare)(struct net *net, struct sock *sk); 51 bool (*compare)(struct net *net, struct sock *sk);
51}; 52};
52 53
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index 3e794c12e90a..610af5155ef2 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -46,6 +46,9 @@ static inline void nfs_copy_fh(struct nfs_fh *target, const struct nfs_fh *sourc
46enum nfs3_stable_how { 46enum nfs3_stable_how {
47 NFS_UNSTABLE = 0, 47 NFS_UNSTABLE = 0,
48 NFS_DATA_SYNC = 1, 48 NFS_DATA_SYNC = 1,
49 NFS_FILE_SYNC = 2 49 NFS_FILE_SYNC = 2,
50
51 /* used by direct.c to mark verf as invalid */
52 NFS_INVALID_STABLE_HOW = -1
50}; 53};
51#endif /* _LINUX_NFS_H */ 54#endif /* _LINUX_NFS_H */
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 12c2cb947df5..a1e3064a8d99 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -399,8 +399,6 @@ enum lock_type4 {
399#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 399#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
400#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 400#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
401#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16) 401#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
402#define FATTR4_WORD2_CHANGE_SECURITY_LABEL \
403 (1UL << 17)
404 402
405/* MDS threshold bitmap bits */ 403/* MDS threshold bitmap bits */
406#define THRESHOLD_RD (1UL << 0) 404#define THRESHOLD_RD (1UL << 0)
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index fa6918b0f829..e30f6059ecd6 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -459,13 +459,12 @@ extern int nfs3_removexattr (struct dentry *, const char *name);
459/* 459/*
460 * linux/fs/nfs/direct.c 460 * linux/fs/nfs/direct.c
461 */ 461 */
462extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, 462extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t);
463 unsigned long);
464extern ssize_t nfs_file_direct_read(struct kiocb *iocb, 463extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
465 const struct iovec *iov, unsigned long nr_segs, 464 struct iov_iter *iter,
466 loff_t pos, bool uio); 465 loff_t pos, bool uio);
467extern ssize_t nfs_file_direct_write(struct kiocb *iocb, 466extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
468 const struct iovec *iov, unsigned long nr_segs, 467 struct iov_iter *iter,
469 loff_t pos, bool uio); 468 loff_t pos, bool uio);
470 469
471/* 470/*
@@ -520,7 +519,6 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
520extern int nfs_writepages(struct address_space *, struct writeback_control *); 519extern int nfs_writepages(struct address_space *, struct writeback_control *);
521extern int nfs_flush_incompatible(struct file *file, struct page *page); 520extern int nfs_flush_incompatible(struct file *file, struct page *page);
522extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 521extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
523extern void nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
524 522
525/* 523/*
526 * Try to write back everything synchronously (but check the 524 * Try to write back everything synchronously (but check the
@@ -553,7 +551,6 @@ nfs_have_writebacks(struct inode *inode)
553extern int nfs_readpage(struct file *, struct page *); 551extern int nfs_readpage(struct file *, struct page *);
554extern int nfs_readpages(struct file *, struct address_space *, 552extern int nfs_readpages(struct file *, struct address_space *,
555 struct list_head *, unsigned); 553 struct list_head *, unsigned);
556extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
557extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, 554extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
558 struct page *); 555 struct page *);
559 556
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 92ce5783b707..7d9096d95d4a 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -22,12 +22,17 @@
22 * Valid flags for a dirty buffer 22 * Valid flags for a dirty buffer
23 */ 23 */
24enum { 24enum {
25 PG_BUSY = 0, 25 PG_BUSY = 0, /* nfs_{un}lock_request */
26 PG_MAPPED, 26 PG_MAPPED, /* page private set for buffered io */
27 PG_CLEAN, 27 PG_CLEAN, /* write succeeded */
28 PG_NEED_COMMIT, 28 PG_COMMIT_TO_DS, /* used by pnfs layouts */
29 PG_NEED_RESCHED, 29 PG_INODE_REF, /* extra ref held by inode (head req only) */
30 PG_COMMIT_TO_DS, 30 PG_HEADLOCK, /* page group lock of wb_head */
31 PG_TEARDOWN, /* page group sync for destroy */
32 PG_UNLOCKPAGE, /* page group sync bit in read path */
33 PG_UPTODATE, /* page group sync bit in read path */
34 PG_WB_END, /* page group sync bit in write path */
35 PG_REMOVE, /* page group sync bit in write path */
31}; 36};
32 37
33struct nfs_inode; 38struct nfs_inode;
@@ -43,15 +48,29 @@ struct nfs_page {
43 struct kref wb_kref; /* reference count */ 48 struct kref wb_kref; /* reference count */
44 unsigned long wb_flags; 49 unsigned long wb_flags;
45 struct nfs_write_verifier wb_verf; /* Commit cookie */ 50 struct nfs_write_verifier wb_verf; /* Commit cookie */
51 struct nfs_page *wb_this_page; /* list of reqs for this page */
52 struct nfs_page *wb_head; /* head pointer for req list */
46}; 53};
47 54
48struct nfs_pageio_descriptor; 55struct nfs_pageio_descriptor;
49struct nfs_pageio_ops { 56struct nfs_pageio_ops {
50 void (*pg_init)(struct nfs_pageio_descriptor *, struct nfs_page *); 57 void (*pg_init)(struct nfs_pageio_descriptor *, struct nfs_page *);
51 bool (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *); 58 size_t (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *,
59 struct nfs_page *);
52 int (*pg_doio)(struct nfs_pageio_descriptor *); 60 int (*pg_doio)(struct nfs_pageio_descriptor *);
53}; 61};
54 62
63struct nfs_rw_ops {
64 const fmode_t rw_mode;
65 struct nfs_rw_header *(*rw_alloc_header)(void);
66 void (*rw_free_header)(struct nfs_rw_header *);
67 void (*rw_release)(struct nfs_pgio_data *);
68 int (*rw_done)(struct rpc_task *, struct nfs_pgio_data *, struct inode *);
69 void (*rw_result)(struct rpc_task *, struct nfs_pgio_data *);
70 void (*rw_initiate)(struct nfs_pgio_data *, struct rpc_message *,
71 struct rpc_task_setup *, int);
72};
73
55struct nfs_pageio_descriptor { 74struct nfs_pageio_descriptor {
56 struct list_head pg_list; 75 struct list_head pg_list;
57 unsigned long pg_bytes_written; 76 unsigned long pg_bytes_written;
@@ -63,6 +82,7 @@ struct nfs_pageio_descriptor {
63 82
64 struct inode *pg_inode; 83 struct inode *pg_inode;
65 const struct nfs_pageio_ops *pg_ops; 84 const struct nfs_pageio_ops *pg_ops;
85 const struct nfs_rw_ops *pg_rw_ops;
66 int pg_ioflags; 86 int pg_ioflags;
67 int pg_error; 87 int pg_error;
68 const struct rpc_call_ops *pg_rpc_callops; 88 const struct rpc_call_ops *pg_rpc_callops;
@@ -75,29 +95,33 @@ struct nfs_pageio_descriptor {
75#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 95#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
76 96
77extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, 97extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
78 struct inode *inode,
79 struct page *page, 98 struct page *page,
99 struct nfs_page *last,
80 unsigned int offset, 100 unsigned int offset,
81 unsigned int count); 101 unsigned int count);
82extern void nfs_release_request(struct nfs_page *req); 102extern void nfs_release_request(struct nfs_page *);
83 103
84 104
85extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, 105extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
86 struct inode *inode, 106 struct inode *inode,
87 const struct nfs_pageio_ops *pg_ops, 107 const struct nfs_pageio_ops *pg_ops,
88 const struct nfs_pgio_completion_ops *compl_ops, 108 const struct nfs_pgio_completion_ops *compl_ops,
109 const struct nfs_rw_ops *rw_ops,
89 size_t bsize, 110 size_t bsize,
90 int how); 111 int how);
91extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 112extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
92 struct nfs_page *); 113 struct nfs_page *);
93extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); 114extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
94extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); 115extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
95extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, 116extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
96 struct nfs_page *prev, 117 struct nfs_page *prev,
97 struct nfs_page *req); 118 struct nfs_page *req);
98extern int nfs_wait_on_request(struct nfs_page *); 119extern int nfs_wait_on_request(struct nfs_page *);
99extern void nfs_unlock_request(struct nfs_page *req); 120extern void nfs_unlock_request(struct nfs_page *req);
100extern void nfs_unlock_and_release_request(struct nfs_page *req); 121extern void nfs_unlock_and_release_request(struct nfs_page *);
122extern void nfs_page_group_lock(struct nfs_page *);
123extern void nfs_page_group_unlock(struct nfs_page *);
124extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
101 125
102/* 126/*
103 * Lock the page of an asynchronous request 127 * Lock the page of an asynchronous request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 6fb5b2335b59..9a1396e70310 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -489,31 +489,21 @@ struct nfs4_delegreturnres {
489}; 489};
490 490
491/* 491/*
492 * Arguments to the read call. 492 * Arguments to the write call.
493 */ 493 */
494struct nfs_readargs { 494struct nfs_write_verifier {
495 struct nfs4_sequence_args seq_args; 495 char data[8];
496 struct nfs_fh * fh;
497 struct nfs_open_context *context;
498 struct nfs_lock_context *lock_context;
499 nfs4_stateid stateid;
500 __u64 offset;
501 __u32 count;
502 unsigned int pgbase;
503 struct page ** pages;
504}; 496};
505 497
506struct nfs_readres { 498struct nfs_writeverf {
507 struct nfs4_sequence_res seq_res; 499 struct nfs_write_verifier verifier;
508 struct nfs_fattr * fattr; 500 enum nfs3_stable_how committed;
509 __u32 count;
510 int eof;
511}; 501};
512 502
513/* 503/*
514 * Arguments to the write call. 504 * Arguments shared by the read and write call.
515 */ 505 */
516struct nfs_writeargs { 506struct nfs_pgio_args {
517 struct nfs4_sequence_args seq_args; 507 struct nfs4_sequence_args seq_args;
518 struct nfs_fh * fh; 508 struct nfs_fh * fh;
519 struct nfs_open_context *context; 509 struct nfs_open_context *context;
@@ -521,27 +511,20 @@ struct nfs_writeargs {
521 nfs4_stateid stateid; 511 nfs4_stateid stateid;
522 __u64 offset; 512 __u64 offset;
523 __u32 count; 513 __u32 count;
524 enum nfs3_stable_how stable;
525 unsigned int pgbase; 514 unsigned int pgbase;
526 struct page ** pages; 515 struct page ** pages;
527 const u32 * bitmask; 516 const u32 * bitmask; /* used by write */
528}; 517 enum nfs3_stable_how stable; /* used by write */
529
530struct nfs_write_verifier {
531 char data[8];
532}; 518};
533 519
534struct nfs_writeverf { 520struct nfs_pgio_res {
535 struct nfs_write_verifier verifier;
536 enum nfs3_stable_how committed;
537};
538
539struct nfs_writeres {
540 struct nfs4_sequence_res seq_res; 521 struct nfs4_sequence_res seq_res;
541 struct nfs_fattr * fattr; 522 struct nfs_fattr * fattr;
542 struct nfs_writeverf * verf;
543 __u32 count; 523 __u32 count;
544 const struct nfs_server *server; 524 int eof; /* used by read */
525 struct nfs_writeverf * verf; /* used by write */
526 const struct nfs_server *server; /* used by write */
527
545}; 528};
546 529
547/* 530/*
@@ -1129,6 +1112,7 @@ struct pnfs_commit_bucket {
1129 struct list_head committing; 1112 struct list_head committing;
1130 struct pnfs_layout_segment *wlseg; 1113 struct pnfs_layout_segment *wlseg;
1131 struct pnfs_layout_segment *clseg; 1114 struct pnfs_layout_segment *clseg;
1115 struct nfs_writeverf direct_verf;
1132}; 1116};
1133 1117
1134struct pnfs_ds_commit_info { 1118struct pnfs_ds_commit_info {
@@ -1264,20 +1248,6 @@ struct nfs_page_array {
1264 struct page *page_array[NFS_PAGEVEC_SIZE]; 1248 struct page *page_array[NFS_PAGEVEC_SIZE];
1265}; 1249};
1266 1250
1267struct nfs_read_data {
1268 struct nfs_pgio_header *header;
1269 struct list_head list;
1270 struct rpc_task task;
1271 struct nfs_fattr fattr; /* fattr storage */
1272 struct nfs_readargs args;
1273 struct nfs_readres res;
1274 unsigned long timestamp; /* For lease renewal */
1275 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
1276 __u64 mds_offset;
1277 struct nfs_page_array pages;
1278 struct nfs_client *ds_clp; /* pNFS data server */
1279};
1280
1281/* used as flag bits in nfs_pgio_header */ 1251/* used as flag bits in nfs_pgio_header */
1282enum { 1252enum {
1283 NFS_IOHDR_ERROR = 0, 1253 NFS_IOHDR_ERROR = 0,
@@ -1287,19 +1257,22 @@ enum {
1287 NFS_IOHDR_NEED_RESCHED, 1257 NFS_IOHDR_NEED_RESCHED,
1288}; 1258};
1289 1259
1260struct nfs_pgio_data;
1261
1290struct nfs_pgio_header { 1262struct nfs_pgio_header {
1291 struct inode *inode; 1263 struct inode *inode;
1292 struct rpc_cred *cred; 1264 struct rpc_cred *cred;
1293 struct list_head pages; 1265 struct list_head pages;
1294 struct list_head rpc_list; 1266 struct nfs_pgio_data *data;
1295 atomic_t refcnt; 1267 atomic_t refcnt;
1296 struct nfs_page *req; 1268 struct nfs_page *req;
1297 struct nfs_writeverf *verf; 1269 struct nfs_writeverf verf; /* Used for writes */
1298 struct pnfs_layout_segment *lseg; 1270 struct pnfs_layout_segment *lseg;
1299 loff_t io_start; 1271 loff_t io_start;
1300 const struct rpc_call_ops *mds_ops; 1272 const struct rpc_call_ops *mds_ops;
1301 void (*release) (struct nfs_pgio_header *hdr); 1273 void (*release) (struct nfs_pgio_header *hdr);
1302 const struct nfs_pgio_completion_ops *completion_ops; 1274 const struct nfs_pgio_completion_ops *completion_ops;
1275 const struct nfs_rw_ops *rw_ops;
1303 struct nfs_direct_req *dreq; 1276 struct nfs_direct_req *dreq;
1304 void *layout_private; 1277 void *layout_private;
1305 spinlock_t lock; 1278 spinlock_t lock;
@@ -1310,30 +1283,24 @@ struct nfs_pgio_header {
1310 unsigned long flags; 1283 unsigned long flags;
1311}; 1284};
1312 1285
1313struct nfs_read_header { 1286struct nfs_pgio_data {
1314 struct nfs_pgio_header header;
1315 struct nfs_read_data rpc_data;
1316};
1317
1318struct nfs_write_data {
1319 struct nfs_pgio_header *header; 1287 struct nfs_pgio_header *header;
1320 struct list_head list;
1321 struct rpc_task task; 1288 struct rpc_task task;
1322 struct nfs_fattr fattr; 1289 struct nfs_fattr fattr;
1323 struct nfs_writeverf verf; 1290 struct nfs_writeverf verf; /* Used for writes */
1324 struct nfs_writeargs args; /* argument struct */ 1291 struct nfs_pgio_args args; /* argument struct */
1325 struct nfs_writeres res; /* result struct */ 1292 struct nfs_pgio_res res; /* result struct */
1326 unsigned long timestamp; /* For lease renewal */ 1293 unsigned long timestamp; /* For lease renewal */
1327 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data); 1294 int (*pgio_done_cb) (struct rpc_task *task, struct nfs_pgio_data *data);
1328 __u64 mds_offset; /* Filelayout dense stripe */ 1295 __u64 mds_offset; /* Filelayout dense stripe */
1329 struct nfs_page_array pages; 1296 struct nfs_page_array pages;
1330 struct nfs_client *ds_clp; /* pNFS data server */ 1297 struct nfs_client *ds_clp; /* pNFS data server */
1298 int ds_idx; /* ds index if ds_clp is set */
1331}; 1299};
1332 1300
1333struct nfs_write_header { 1301struct nfs_rw_header {
1334 struct nfs_pgio_header header; 1302 struct nfs_pgio_header header;
1335 struct nfs_write_data rpc_data; 1303 struct nfs_pgio_data rpc_data;
1336 struct nfs_writeverf verf;
1337}; 1304};
1338 1305
1339struct nfs_mds_commit_info { 1306struct nfs_mds_commit_info {
@@ -1465,16 +1432,11 @@ struct nfs_rpc_ops {
1465 struct nfs_pathconf *); 1432 struct nfs_pathconf *);
1466 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1433 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1467 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); 1434 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1468 void (*read_setup) (struct nfs_read_data *, struct rpc_message *); 1435 int (*pgio_rpc_prepare)(struct rpc_task *, struct nfs_pgio_data *);
1469 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, 1436 void (*read_setup) (struct nfs_pgio_data *, struct rpc_message *);
1470 const struct nfs_pgio_completion_ops *); 1437 int (*read_done) (struct rpc_task *, struct nfs_pgio_data *);
1471 int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); 1438 void (*write_setup) (struct nfs_pgio_data *, struct rpc_message *);
1472 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1439 int (*write_done) (struct rpc_task *, struct nfs_pgio_data *);
1473 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1474 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
1475 const struct nfs_pgio_completion_ops *);
1476 int (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1477 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1478 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1440 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1479 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1441 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1480 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *); 1442 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
diff --git a/include/linux/nfsd/debug.h b/include/linux/nfsd/debug.h
deleted file mode 100644
index 19ef8375b577..000000000000
--- a/include/linux/nfsd/debug.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/linux/nfsd/debug.h
3 *
4 * Debugging-related stuff for nfsd
5 *
6 * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
7 */
8#ifndef LINUX_NFSD_DEBUG_H
9#define LINUX_NFSD_DEBUG_H
10
11#include <uapi/linux/nfsd/debug.h>
12
13# undef ifdebug
14# ifdef NFSD_DEBUG
15# define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag)
16# else
17# define ifdebug(flag) if (0)
18# endif
19#endif /* LINUX_NFSD_DEBUG_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
deleted file mode 100644
index 7898c997dfea..000000000000
--- a/include/linux/nfsd/export.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * include/linux/nfsd/export.h
3 *
4 * Public declarations for NFS exports. The definitions for the
5 * syscall interface are in nfsctl.h
6 *
7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
8 */
9#ifndef NFSD_EXPORT_H
10#define NFSD_EXPORT_H
11
12# include <linux/nfsd/nfsfh.h>
13#include <uapi/linux/nfsd/export.h>
14
15/*
16 * FS Locations
17 */
18
19#define MAX_FS_LOCATIONS 128
20
21struct nfsd4_fs_location {
22 char *hosts; /* colon separated list of hosts */
23 char *path; /* slash separated list of path components */
24};
25
26struct nfsd4_fs_locations {
27 uint32_t locations_count;
28 struct nfsd4_fs_location *locations;
29/* If we're not actually serving this data ourselves (only providing a
30 * list of replicas that do serve it) then we set "migrated": */
31 int migrated;
32};
33
34/*
35 * We keep an array of pseudoflavors with the export, in order from most
36 * to least preferred. For the foreseeable future, we don't expect more
37 * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
38 * spkm3i, and spkm3p (and using all 8 at once should be rare).
39 */
40#define MAX_SECINFO_LIST 8
41
42struct exp_flavor_info {
43 u32 pseudoflavor;
44 u32 flags;
45};
46
47struct svc_export {
48 struct cache_head h;
49 struct auth_domain * ex_client;
50 int ex_flags;
51 struct path ex_path;
52 kuid_t ex_anon_uid;
53 kgid_t ex_anon_gid;
54 int ex_fsid;
55 unsigned char * ex_uuid; /* 16 byte fsid */
56 struct nfsd4_fs_locations ex_fslocs;
57 int ex_nflavors;
58 struct exp_flavor_info ex_flavors[MAX_SECINFO_LIST];
59 struct cache_detail *cd;
60};
61
62/* an "export key" (expkey) maps a filehandlefragement to an
63 * svc_export for a given client. There can be several per export,
64 * for the different fsid types.
65 */
66struct svc_expkey {
67 struct cache_head h;
68
69 struct auth_domain * ek_client;
70 int ek_fsidtype;
71 u32 ek_fsid[6];
72
73 struct path ek_path;
74};
75
76#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC))
77#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
78#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
79
80int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
81__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
82
83/*
84 * Function declarations
85 */
86int nfsd_export_init(struct net *);
87void nfsd_export_shutdown(struct net *);
88void nfsd_export_flush(struct net *);
89struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
90 struct path *);
91struct svc_export * rqst_exp_parent(struct svc_rqst *,
92 struct path *);
93struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *);
94int exp_rootfh(struct net *, struct auth_domain *,
95 char *path, struct knfsd_fh *, int maxsize);
96__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
97__be32 nfserrno(int errno);
98
99static inline void exp_put(struct svc_export *exp)
100{
101 cache_put(&exp->h, exp->cd);
102}
103
104static inline void exp_get(struct svc_export *exp)
105{
106 cache_get(&exp->h);
107}
108struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
109
110#endif /* NFSD_EXPORT_H */
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
deleted file mode 100644
index a93593f1fa4e..000000000000
--- a/include/linux/nfsd/nfsfh.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * include/linux/nfsd/nfsfh.h
3 *
4 * This file describes the layout of the file handles as passed
5 * over the wire.
6 *
7 * Earlier versions of knfsd used to sign file handles using keyed MD5
8 * or SHA. I've removed this code, because it doesn't give you more
9 * security than blocking external access to port 2049 on your firewall.
10 *
11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
12 */
13#ifndef _LINUX_NFSD_FH_H
14#define _LINUX_NFSD_FH_H
15
16# include <linux/sunrpc/svc.h>
17#include <uapi/linux/nfsd/nfsfh.h>
18
19static inline __u32 ino_t_to_u32(ino_t ino)
20{
21 return (__u32) ino;
22}
23
24static inline ino_t u32_to_ino_t(__u32 uino)
25{
26 return (ino_t) uino;
27}
28
29/*
30 * This is the internal representation of an NFS handle used in knfsd.
31 * pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
32 */
33typedef struct svc_fh {
34 struct knfsd_fh fh_handle; /* FH data */
35 struct dentry * fh_dentry; /* validated dentry */
36 struct svc_export * fh_export; /* export pointer */
37 int fh_maxsize; /* max size for fh_handle */
38
39 unsigned char fh_locked; /* inode locked by us */
40 unsigned char fh_want_write; /* remount protection taken */
41
42#ifdef CONFIG_NFSD_V3
43 unsigned char fh_post_saved; /* post-op attrs saved */
44 unsigned char fh_pre_saved; /* pre-op attrs saved */
45
46 /* Pre-op attributes saved during fh_lock */
47 __u64 fh_pre_size; /* size before operation */
48 struct timespec fh_pre_mtime; /* mtime before oper */
49 struct timespec fh_pre_ctime; /* ctime before oper */
50 /*
51 * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode)
52 * to find out if it is valid.
53 */
54 u64 fh_pre_change;
55
56 /* Post-op attributes saved in fh_unlock */
57 struct kstat fh_post_attr; /* full attrs after operation */
58 u64 fh_post_change; /* nfsv4 change; see above */
59#endif /* CONFIG_NFSD_V3 */
60
61} svc_fh;
62
63#endif /* _LINUX_NFSD_FH_H */
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
deleted file mode 100644
index e75b2544ff12..000000000000
--- a/include/linux/nfsd/stats.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/include/linux/nfsd/stats.h
3 *
4 * Statistics for NFS server.
5 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */
8#ifndef LINUX_NFSD_STATS_H
9#define LINUX_NFSD_STATS_H
10
11#include <uapi/linux/nfsd/stats.h>
12
13
14struct nfsd_stats {
15 unsigned int rchits; /* repcache hits */
16 unsigned int rcmisses; /* repcache hits */
17 unsigned int rcnocache; /* uncached reqs */
18 unsigned int fh_stale; /* FH stale error */
19 unsigned int fh_lookup; /* dentry cached */
20 unsigned int fh_anon; /* anon file dentry returned */
21 unsigned int fh_nocache_dir; /* filehandle not found in dcache */
22 unsigned int fh_nocache_nondir; /* filehandle not found in dcache */
23 unsigned int io_read; /* bytes returned to read requests */
24 unsigned int io_write; /* bytes passed in write requests */
25 unsigned int th_cnt; /* number of available threads */
26 unsigned int th_usage[10]; /* number of ticks during which n perdeciles
27 * of available threads were in use */
28 unsigned int th_fullcnt; /* number of times last free thread was used */
29 unsigned int ra_size; /* size of ra cache */
30 unsigned int ra_depth[11]; /* number of times ra entry was found that deep
31 * in the cache (10percentiles). [10] = not found */
32#ifdef CONFIG_NFSD_V4
33 unsigned int nfs4_opcount[LAST_NFS4_OP + 1]; /* count of individual nfsv4 operations */
34#endif
35
36};
37
38
39extern struct nfsd_stats nfsdstats;
40extern struct svc_stat nfsd_svcstats;
41
42void nfsd_stat_init(void);
43void nfsd_stat_shutdown(void);
44
45#endif /* LINUX_NFSD_STATS_H */
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index c8d7f3965fff..20163b9a0eae 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -80,6 +80,22 @@ enum {
80 80
81 IEEE802154_ATTR_FRAME_RETRIES, 81 IEEE802154_ATTR_FRAME_RETRIES,
82 82
83 IEEE802154_ATTR_LLSEC_ENABLED,
84 IEEE802154_ATTR_LLSEC_SECLEVEL,
85 IEEE802154_ATTR_LLSEC_KEY_MODE,
86 IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT,
87 IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED,
88 IEEE802154_ATTR_LLSEC_KEY_ID,
89 IEEE802154_ATTR_LLSEC_FRAME_COUNTER,
90 IEEE802154_ATTR_LLSEC_KEY_BYTES,
91 IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES,
92 IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS,
93 IEEE802154_ATTR_LLSEC_FRAME_TYPE,
94 IEEE802154_ATTR_LLSEC_CMD_FRAME_ID,
95 IEEE802154_ATTR_LLSEC_SECLEVELS,
96 IEEE802154_ATTR_LLSEC_DEV_OVERRIDE,
97 IEEE802154_ATTR_LLSEC_DEV_KEY_MODE,
98
83 __IEEE802154_ATTR_MAX, 99 __IEEE802154_ATTR_MAX,
84}; 100};
85 101
@@ -134,6 +150,21 @@ enum {
134 150
135 IEEE802154_SET_MACPARAMS, 151 IEEE802154_SET_MACPARAMS,
136 152
153 IEEE802154_LLSEC_GETPARAMS,
154 IEEE802154_LLSEC_SETPARAMS,
155 IEEE802154_LLSEC_LIST_KEY,
156 IEEE802154_LLSEC_ADD_KEY,
157 IEEE802154_LLSEC_DEL_KEY,
158 IEEE802154_LLSEC_LIST_DEV,
159 IEEE802154_LLSEC_ADD_DEV,
160 IEEE802154_LLSEC_DEL_DEV,
161 IEEE802154_LLSEC_LIST_DEVKEY,
162 IEEE802154_LLSEC_ADD_DEVKEY,
163 IEEE802154_LLSEC_DEL_DEVKEY,
164 IEEE802154_LLSEC_LIST_SECLEVEL,
165 IEEE802154_LLSEC_ADD_SECLEVEL,
166 IEEE802154_LLSEC_DEL_SECLEVEL,
167
137 __IEEE802154_CMD_MAX, 168 __IEEE802154_CMD_MAX,
138}; 169};
139 170
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 6a45fb583ff1..447775ee2c4b 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -32,15 +32,24 @@ static inline void touch_nmi_watchdog(void)
32#ifdef arch_trigger_all_cpu_backtrace 32#ifdef arch_trigger_all_cpu_backtrace
33static inline bool trigger_all_cpu_backtrace(void) 33static inline bool trigger_all_cpu_backtrace(void)
34{ 34{
35 arch_trigger_all_cpu_backtrace(); 35 arch_trigger_all_cpu_backtrace(true);
36 36
37 return true; 37 return true;
38} 38}
39static inline bool trigger_allbutself_cpu_backtrace(void)
40{
41 arch_trigger_all_cpu_backtrace(false);
42 return true;
43}
39#else 44#else
40static inline bool trigger_all_cpu_backtrace(void) 45static inline bool trigger_all_cpu_backtrace(void)
41{ 46{
42 return false; 47 return false;
43} 48}
49static inline bool trigger_allbutself_cpu_backtrace(void)
50{
51 return false;
52}
44#endif 53#endif
45 54
46#ifdef CONFIG_LOCKUP_DETECTOR 55#ifdef CONFIG_LOCKUP_DETECTOR
@@ -48,6 +57,7 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *);
48u64 hw_nmi_get_sample_period(int watchdog_thresh); 57u64 hw_nmi_get_sample_period(int watchdog_thresh);
49extern int watchdog_user_enabled; 58extern int watchdog_user_enabled;
50extern int watchdog_thresh; 59extern int watchdog_thresh;
60extern int sysctl_softlockup_all_cpu_backtrace;
51struct ctl_table; 61struct ctl_table;
52extern int proc_dowatchdog(struct ctl_table *, int , 62extern int proc_dowatchdog(struct ctl_table *, int ,
53 void __user *, size_t *, loff_t *); 63 void __user *, size_t *, loff_t *);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index a50173ca1d72..2bf403195c09 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Definitions for the NVM Express interface 2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011-2013, Intel Corporation. 3 * Copyright (c) 2011-2014, Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -10,10 +10,6 @@
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details. 12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 */ 13 */
18 14
19#ifndef _LINUX_NVME_H 15#ifndef _LINUX_NVME_H
@@ -66,8 +62,8 @@ enum {
66 62
67#define NVME_VS(major, minor) (major << 16 | minor) 63#define NVME_VS(major, minor) (major << 16 | minor)
68 64
69extern unsigned char io_timeout; 65extern unsigned char nvme_io_timeout;
70#define NVME_IO_TIMEOUT (io_timeout * HZ) 66#define NVME_IO_TIMEOUT (nvme_io_timeout * HZ)
71 67
72/* 68/*
73 * Represents an NVM Express device. Each nvme_dev is a PCI function. 69 * Represents an NVM Express device. Each nvme_dev is a PCI function.
@@ -94,7 +90,7 @@ struct nvme_dev {
94 struct miscdevice miscdev; 90 struct miscdevice miscdev;
95 work_func_t reset_workfn; 91 work_func_t reset_workfn;
96 struct work_struct reset_work; 92 struct work_struct reset_work;
97 struct notifier_block nb; 93 struct work_struct cpu_work;
98 char name[12]; 94 char name[12];
99 char serial[20]; 95 char serial[20];
100 char model[40]; 96 char model[40];
@@ -103,6 +99,7 @@ struct nvme_dev {
103 u32 stripe_size; 99 u32 stripe_size;
104 u16 oncs; 100 u16 oncs;
105 u16 abort_limit; 101 u16 abort_limit;
102 u8 vwc;
106 u8 initialized; 103 u8 initialized;
107}; 104};
108 105
@@ -159,7 +156,6 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
159void nvme_unmap_user_pages(struct nvme_dev *dev, int write, 156void nvme_unmap_user_pages(struct nvme_dev *dev, int write,
160 struct nvme_iod *iod); 157 struct nvme_iod *iod);
161int nvme_submit_io_cmd(struct nvme_dev *, struct nvme_command *, u32 *); 158int nvme_submit_io_cmd(struct nvme_dev *, struct nvme_command *, u32 *);
162int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns);
163int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *, 159int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *,
164 u32 *result); 160 u32 *result);
165int nvme_identify(struct nvme_dev *, unsigned nsid, unsigned cns, 161int nvme_identify(struct nvme_dev *, unsigned nsid, unsigned cns,
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 05117899fcb4..0ff360d5b3b3 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -73,6 +73,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
73 int depth, void *data); 73 int depth, void *data);
74 74
75extern bool early_init_dt_scan(void *params); 75extern bool early_init_dt_scan(void *params);
76extern bool early_init_dt_verify(void *params);
77extern void early_init_dt_scan_nodes(void);
76 78
77extern const char *of_flat_dt_get_machine_name(void); 79extern const char *of_flat_dt_get_machine_name(void);
78extern const void *of_flat_dt_match_machine(const void *default_match, 80extern const void *of_flat_dt_match_machine(const void *default_match,
@@ -84,6 +86,7 @@ extern void unflatten_and_copy_device_tree(void);
84extern void early_init_devtree(void *); 86extern void early_init_devtree(void *);
85extern void early_get_first_memblock_info(void *, phys_addr_t *); 87extern void early_get_first_memblock_info(void *, phys_addr_t *);
86extern u64 fdt_translate_address(const void *blob, int node_offset); 88extern u64 fdt_translate_address(const void *blob, int node_offset);
89extern void of_fdt_limit_memory(int limit);
87#else /* CONFIG_OF_FLATTREE */ 90#else /* CONFIG_OF_FLATTREE */
88static inline void early_init_fdt_scan_reserved_mem(void) {} 91static inline void early_init_fdt_scan_reserved_mem(void) {}
89static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 92static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 881a7c3571f4..d449018d0726 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -22,9 +22,6 @@ extern struct phy_device *of_phy_connect(struct net_device *dev,
22struct phy_device *of_phy_attach(struct net_device *dev, 22struct phy_device *of_phy_attach(struct net_device *dev,
23 struct device_node *phy_np, u32 flags, 23 struct device_node *phy_np, u32 flags,
24 phy_interface_t iface); 24 phy_interface_t iface);
25extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
26 void (*hndlr)(struct net_device *),
27 phy_interface_t iface);
28 25
29extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
30 27
@@ -59,17 +56,25 @@ static inline struct phy_device *of_phy_attach(struct net_device *dev,
59 return NULL; 56 return NULL;
60} 57}
61 58
62static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, 59static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
63 void (*hndlr)(struct net_device *),
64 phy_interface_t iface)
65{ 60{
66 return NULL; 61 return NULL;
67} 62}
63#endif /* CONFIG_OF */
68 64
69static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np) 65#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)
66extern int of_phy_register_fixed_link(struct device_node *np);
67extern bool of_phy_is_fixed_link(struct device_node *np);
68#else
69static inline int of_phy_register_fixed_link(struct device_node *np)
70{ 70{
71 return NULL; 71 return -ENOSYS;
72} 72}
73#endif /* CONFIG_OF */ 73static inline bool of_phy_is_fixed_link(struct device_node *np)
74{
75 return false;
76}
77#endif
78
74 79
75#endif /* __LINUX_OF_MDIO_H */ 80#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index c29a6dee6bec..88e6ea4a5d36 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -1,23 +1,6 @@
1/*
2 * OMAP DMA Engine support
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#ifndef __LINUX_OMAP_DMA_H 1#ifndef __LINUX_OMAP_DMA_H
9#define __LINUX_OMAP_DMA_H 2#define __LINUX_OMAP_DMA_H
10 3#include <linux/omap-dmaengine.h>
11struct dma_chan;
12
13#if defined(CONFIG_DMA_OMAP) || (defined(CONFIG_DMA_OMAP_MODULE) && defined(MODULE))
14bool omap_dma_filter_fn(struct dma_chan *, void *);
15#else
16static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
17{
18 return false;
19}
20#endif
21 4
22/* 5/*
23 * Legacy OMAP DMA handling defines and functions 6 * Legacy OMAP DMA handling defines and functions
diff --git a/include/linux/omap-dmaengine.h b/include/linux/omap-dmaengine.h
new file mode 100644
index 000000000000..8e6906c72e90
--- /dev/null
+++ b/include/linux/omap-dmaengine.h
@@ -0,0 +1,21 @@
1/*
2 * OMAP DMA Engine support
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#ifndef __LINUX_OMAP_DMAENGINE_H
9#define __LINUX_OMAP_DMAENGINE_H
10
11struct dma_chan;
12
13#if defined(CONFIG_DMA_OMAP) || (defined(CONFIG_DMA_OMAP_MODULE) && defined(MODULE))
14bool omap_dma_filter_fn(struct dma_chan *, void *);
15#else
16static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
17{
18 return false;
19}
20#endif
21#endif /* __LINUX_OMAP_DMAENGINE_H */
diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h
new file mode 100644
index 000000000000..90230d5811c5
--- /dev/null
+++ b/include/linux/osq_lock.h
@@ -0,0 +1,27 @@
1#ifndef __LINUX_OSQ_LOCK_H
2#define __LINUX_OSQ_LOCK_H
3
4/*
5 * An MCS like lock especially tailored for optimistic spinning for sleeping
6 * lock implementations (mutex, rwsem, etc).
7 */
8
9#define OSQ_UNLOCKED_VAL (0)
10
11struct optimistic_spin_queue {
12 /*
13 * Stores an encoded value of the CPU # of the tail node in the queue.
14 * If the queue is empty, then it's set to OSQ_UNLOCKED_VAL.
15 */
16 atomic_t tail;
17};
18
19/* Init macro and function. */
20#define OSQ_LOCK_UNLOCKED { ATOMIC_INIT(OSQ_UNLOCKED_VAL) }
21
22static inline void osq_lock_init(struct optimistic_spin_queue *lock)
23{
24 atomic_set(&lock->tail, OSQ_UNLOCKED_VAL);
25}
26
27#endif
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 2093eb72785e..8304959ad336 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -319,13 +319,23 @@ CLEARPAGEFLAG(Uptodate, uptodate)
319extern void cancel_dirty_page(struct page *page, unsigned int account_size); 319extern void cancel_dirty_page(struct page *page, unsigned int account_size);
320 320
321int test_clear_page_writeback(struct page *page); 321int test_clear_page_writeback(struct page *page);
322int test_set_page_writeback(struct page *page); 322int __test_set_page_writeback(struct page *page, bool keep_write);
323
324#define test_set_page_writeback(page) \
325 __test_set_page_writeback(page, false)
326#define test_set_page_writeback_keepwrite(page) \
327 __test_set_page_writeback(page, true)
323 328
324static inline void set_page_writeback(struct page *page) 329static inline void set_page_writeback(struct page *page)
325{ 330{
326 test_set_page_writeback(page); 331 test_set_page_writeback(page);
327} 332}
328 333
334static inline void set_page_writeback_keepwrite(struct page *page)
335{
336 test_set_page_writeback_keepwrite(page);
337}
338
329#ifdef CONFIG_PAGEFLAGS_EXTENDED 339#ifdef CONFIG_PAGEFLAGS_EXTENDED
330/* 340/*
331 * System with lots of page flags available. This allows separate 341 * System with lots of page flags available. This allows separate
@@ -350,6 +360,9 @@ static inline void ClearPageCompound(struct page *page)
350 ClearPageHead(page); 360 ClearPageHead(page);
351} 361}
352#endif 362#endif
363
364#define PG_head_mask ((1L << PG_head))
365
353#else 366#else
354/* 367/*
355 * Reduce page flag use as much as possible by overlapping 368 * Reduce page flag use as much as possible by overlapping
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0a97b583ee8d..e1474ae18c88 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -399,6 +399,18 @@ static inline struct page *read_mapping_page(struct address_space *mapping,
399} 399}
400 400
401/* 401/*
402 * Get the offset in PAGE_SIZE.
403 * (TODO: hugepage should have ->index in PAGE_SIZE)
404 */
405static inline pgoff_t page_to_pgoff(struct page *page)
406{
407 if (unlikely(PageHeadHuge(page)))
408 return page->index << compound_order(page);
409 else
410 return page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
411}
412
413/*
402 * Return byte-offset into filesystem object for page. 414 * Return byte-offset into filesystem object for page.
403 */ 415 */
404static inline loff_t page_offset(struct page *page) 416static inline loff_t page_offset(struct page *page)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 71d9673c1b2c..6ed3647b38df 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -164,13 +164,17 @@ enum pci_dev_flags {
164 /* INTX_DISABLE in PCI_COMMAND register disables MSI 164 /* INTX_DISABLE in PCI_COMMAND register disables MSI
165 * generation too. 165 * generation too.
166 */ 166 */
167 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, 167 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) (1 << 0),
168 /* Device configuration is irrevocably lost if disabled into D3 */ 168 /* Device configuration is irrevocably lost if disabled into D3 */
169 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 169 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) (1 << 1),
170 /* Provide indication device is assigned by a Virtual Machine Manager */ 170 /* Provide indication device is assigned by a Virtual Machine Manager */
171 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, 171 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) (1 << 2),
172 /* Flag for quirk use to store if quirk-specific ACS is enabled */ 172 /* Flag for quirk use to store if quirk-specific ACS is enabled */
173 PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) 8, 173 PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) (1 << 3),
174 /* Flag to indicate the device uses dma_alias_devfn */
175 PCI_DEV_FLAGS_DMA_ALIAS_DEVFN = (__force pci_dev_flags_t) (1 << 4),
176 /* Use a PCIe-to-PCI bridge alias even if !pci_is_pcie */
177 PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = (__force pci_dev_flags_t) (1 << 5),
174}; 178};
175 179
176enum pci_irq_reroute_variant { 180enum pci_irq_reroute_variant {
@@ -268,6 +272,7 @@ struct pci_dev {
268 u8 rom_base_reg; /* which config register controls the ROM */ 272 u8 rom_base_reg; /* which config register controls the ROM */
269 u8 pin; /* which interrupt pin this device uses */ 273 u8 pin; /* which interrupt pin this device uses */
270 u16 pcie_flags_reg; /* cached PCIe Capabilities Register */ 274 u16 pcie_flags_reg; /* cached PCIe Capabilities Register */
275 u8 dma_alias_devfn;/* devfn of DMA alias, if any */
271 276
272 struct pci_driver *driver; /* which driver has allocated this device */ 277 struct pci_driver *driver; /* which driver has allocated this device */
273 u64 dma_mask; /* Mask of the bits of bus address this 278 u64 dma_mask; /* Mask of the bits of bus address this
@@ -973,6 +978,8 @@ int pci_try_reset_slot(struct pci_slot *slot);
973int pci_probe_reset_bus(struct pci_bus *bus); 978int pci_probe_reset_bus(struct pci_bus *bus);
974int pci_reset_bus(struct pci_bus *bus); 979int pci_reset_bus(struct pci_bus *bus);
975int pci_try_reset_bus(struct pci_bus *bus); 980int pci_try_reset_bus(struct pci_bus *bus);
981void pci_reset_secondary_bus(struct pci_dev *dev);
982void pcibios_reset_secondary_bus(struct pci_dev *dev);
976void pci_reset_bridge_secondary_bus(struct pci_dev *dev); 983void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
977void pci_update_resource(struct pci_dev *dev, int resno); 984void pci_update_resource(struct pci_dev *dev, int resno);
978int __must_check pci_assign_resource(struct pci_dev *dev, int i); 985int __must_check pci_assign_resource(struct pci_dev *dev, int i);
@@ -1181,7 +1188,6 @@ int pci_msix_vec_count(struct pci_dev *dev);
1181int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); 1188int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1182void pci_msix_shutdown(struct pci_dev *dev); 1189void pci_msix_shutdown(struct pci_dev *dev);
1183void pci_disable_msix(struct pci_dev *dev); 1190void pci_disable_msix(struct pci_dev *dev);
1184void msi_remove_pci_irq_vectors(struct pci_dev *dev);
1185void pci_restore_msi_state(struct pci_dev *dev); 1191void pci_restore_msi_state(struct pci_dev *dev);
1186int pci_msi_enabled(void); 1192int pci_msi_enabled(void);
1187int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); 1193int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
@@ -1212,7 +1218,6 @@ static inline int pci_enable_msix(struct pci_dev *dev,
1212{ return -ENOSYS; } 1218{ return -ENOSYS; }
1213static inline void pci_msix_shutdown(struct pci_dev *dev) { } 1219static inline void pci_msix_shutdown(struct pci_dev *dev) { }
1214static inline void pci_disable_msix(struct pci_dev *dev) { } 1220static inline void pci_disable_msix(struct pci_dev *dev) { }
1215static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) { }
1216static inline void pci_restore_msi_state(struct pci_dev *dev) { } 1221static inline void pci_restore_msi_state(struct pci_dev *dev) { }
1217static inline int pci_msi_enabled(void) { return 0; } 1222static inline int pci_msi_enabled(void) { return 0; }
1218static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, 1223static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec,
@@ -1809,6 +1814,10 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
1809} 1814}
1810#endif 1815#endif
1811 1816
1817int pci_for_each_dma_alias(struct pci_dev *pdev,
1818 int (*fn)(struct pci_dev *pdev,
1819 u16 alias, void *data), void *data);
1820
1812/** 1821/**
1813 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device 1822 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
1814 * @pdev: the PCI device 1823 * @pdev: the PCI device
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7fa31731c854..6ed0bb73a864 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -6,6 +6,8 @@
6 * Do not add new entries to this file unless the definitions 6 * Do not add new entries to this file unless the definitions
7 * are shared between multiple drivers. 7 * are shared between multiple drivers.
8 */ 8 */
9#ifndef _LINUX_PCI_IDS_H
10#define _LINUX_PCI_IDS_H
9 11
10/* Device classes and subclasses */ 12/* Device classes and subclasses */
11 13
@@ -2968,3 +2970,5 @@
2968#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 2970#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
2969 2971
2970#define PCI_VENDOR_ID_OCZ 0x1b85 2972#define PCI_VENDOR_ID_OCZ 0x1b85
2973
2974#endif /* _LINUX_PCI_IDS_H */
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index a5fc7d01aad6..cfd56046ecec 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -1,6 +1,40 @@
1/*
2 * linux/percpu-defs.h - basic definitions for percpu areas
3 *
4 * DO NOT INCLUDE DIRECTLY OUTSIDE PERCPU IMPLEMENTATION PROPER.
5 *
6 * This file is separate from linux/percpu.h to avoid cyclic inclusion
7 * dependency from arch header files. Only to be included from
8 * asm/percpu.h.
9 *
10 * This file includes macros necessary to declare percpu sections and
11 * variables, and definitions of percpu accessors and operations. It
12 * should provide enough percpu features to arch header files even when
13 * they can only include asm/percpu.h to avoid cyclic inclusion dependency.
14 */
15
1#ifndef _LINUX_PERCPU_DEFS_H 16#ifndef _LINUX_PERCPU_DEFS_H
2#define _LINUX_PERCPU_DEFS_H 17#define _LINUX_PERCPU_DEFS_H
3 18
19#ifdef CONFIG_SMP
20
21#ifdef MODULE
22#define PER_CPU_SHARED_ALIGNED_SECTION ""
23#define PER_CPU_ALIGNED_SECTION ""
24#else
25#define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned"
26#define PER_CPU_ALIGNED_SECTION "..shared_aligned"
27#endif
28#define PER_CPU_FIRST_SECTION "..first"
29
30#else
31
32#define PER_CPU_SHARED_ALIGNED_SECTION ""
33#define PER_CPU_ALIGNED_SECTION "..shared_aligned"
34#define PER_CPU_FIRST_SECTION ""
35
36#endif
37
4/* 38/*
5 * Base implementations of per-CPU variable declarations and definitions, where 39 * Base implementations of per-CPU variable declarations and definitions, where
6 * the section in which the variable is to be placed is provided by the 40 * the section in which the variable is to be placed is provided by the
@@ -19,19 +53,6 @@
19 __attribute__((section(".discard"), unused)) 53 __attribute__((section(".discard"), unused))
20 54
21/* 55/*
22 * Macro which verifies @ptr is a percpu pointer without evaluating
23 * @ptr. This is to be used in percpu accessors to verify that the
24 * input parameter is a percpu pointer.
25 *
26 * + 0 is required in order to convert the pointer type from a
27 * potential array type to a pointer to a single item of the array.
28 */
29#define __verify_pcpu_ptr(ptr) do { \
30 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
31 (void)__vpp_verify; \
32} while (0)
33
34/*
35 * s390 and alpha modules require percpu variables to be defined as 56 * s390 and alpha modules require percpu variables to be defined as
36 * weak to force the compiler to generate GOT based external 57 * weak to force the compiler to generate GOT based external
37 * references for them. This is necessary because percpu sections 58 * references for them. This is necessary because percpu sections
@@ -146,10 +167,10 @@
146 * Declaration/definition used for per-CPU variables that must be read mostly. 167 * Declaration/definition used for per-CPU variables that must be read mostly.
147 */ 168 */
148#define DECLARE_PER_CPU_READ_MOSTLY(type, name) \ 169#define DECLARE_PER_CPU_READ_MOSTLY(type, name) \
149 DECLARE_PER_CPU_SECTION(type, name, "..readmostly") 170 DECLARE_PER_CPU_SECTION(type, name, "..read_mostly")
150 171
151#define DEFINE_PER_CPU_READ_MOSTLY(type, name) \ 172#define DEFINE_PER_CPU_READ_MOSTLY(type, name) \
152 DEFINE_PER_CPU_SECTION(type, name, "..readmostly") 173 DEFINE_PER_CPU_SECTION(type, name, "..read_mostly")
153 174
154/* 175/*
155 * Intermodule exports for per-CPU variables. sparse forgets about 176 * Intermodule exports for per-CPU variables. sparse forgets about
@@ -164,4 +185,337 @@
164#define EXPORT_PER_CPU_SYMBOL_GPL(var) 185#define EXPORT_PER_CPU_SYMBOL_GPL(var)
165#endif 186#endif
166 187
188/*
189 * Accessors and operations.
190 */
191#ifndef __ASSEMBLY__
192
193/*
194 * __verify_pcpu_ptr() verifies @ptr is a percpu pointer without evaluating
195 * @ptr and is invoked once before a percpu area is accessed by all
196 * accessors and operations. This is performed in the generic part of
197 * percpu and arch overrides don't need to worry about it; however, if an
198 * arch wants to implement an arch-specific percpu accessor or operation,
199 * it may use __verify_pcpu_ptr() to verify the parameters.
200 *
201 * + 0 is required in order to convert the pointer type from a
202 * potential array type to a pointer to a single item of the array.
203 */
204#define __verify_pcpu_ptr(ptr) \
205do { \
206 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
207 (void)__vpp_verify; \
208} while (0)
209
210#ifdef CONFIG_SMP
211
212/*
213 * Add an offset to a pointer but keep the pointer as-is. Use RELOC_HIDE()
214 * to prevent the compiler from making incorrect assumptions about the
215 * pointer value. The weird cast keeps both GCC and sparse happy.
216 */
217#define SHIFT_PERCPU_PTR(__p, __offset) \
218 RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
219
220#define per_cpu_ptr(ptr, cpu) \
221({ \
222 __verify_pcpu_ptr(ptr); \
223 SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \
224})
225
226#define raw_cpu_ptr(ptr) \
227({ \
228 __verify_pcpu_ptr(ptr); \
229 arch_raw_cpu_ptr(ptr); \
230})
231
232#ifdef CONFIG_DEBUG_PREEMPT
233#define this_cpu_ptr(ptr) \
234({ \
235 __verify_pcpu_ptr(ptr); \
236 SHIFT_PERCPU_PTR(ptr, my_cpu_offset); \
237})
238#else
239#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
240#endif
241
242#else /* CONFIG_SMP */
243
244#define VERIFY_PERCPU_PTR(__p) \
245({ \
246 __verify_pcpu_ptr(__p); \
247 (typeof(*(__p)) __kernel __force *)(__p); \
248})
249
250#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
251#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
252#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
253
254#endif /* CONFIG_SMP */
255
256#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var)))
258#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
259
260/* keep until we have removed all uses of __this_cpu_ptr */
261#define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
262
263/*
264 * Must be an lvalue. Since @var must be a simple identifier,
265 * we force a syntax error here if it isn't.
266 */
267#define get_cpu_var(var) \
268(*({ \
269 preempt_disable(); \
270 this_cpu_ptr(&var); \
271}))
272
273/*
274 * The weird & is necessary because sparse considers (void)(var) to be
275 * a direct dereference of percpu variable (var).
276 */
277#define put_cpu_var(var) \
278do { \
279 (void)&(var); \
280 preempt_enable(); \
281} while (0)
282
283#define get_cpu_ptr(var) \
284({ \
285 preempt_disable(); \
286 this_cpu_ptr(var); \
287})
288
289#define put_cpu_ptr(var) \
290do { \
291 (void)(var); \
292 preempt_enable(); \
293} while (0)
294
295/*
296 * Branching function to split up a function into a set of functions that
297 * are called for different scalar sizes of the objects handled.
298 */
299
300extern void __bad_size_call_parameter(void);
301
302#ifdef CONFIG_DEBUG_PREEMPT
303extern void __this_cpu_preempt_check(const char *op);
304#else
305static inline void __this_cpu_preempt_check(const char *op) { }
306#endif
307
308#define __pcpu_size_call_return(stem, variable) \
309({ \
310 typeof(variable) pscr_ret__; \
311 __verify_pcpu_ptr(&(variable)); \
312 switch(sizeof(variable)) { \
313 case 1: pscr_ret__ = stem##1(variable); break; \
314 case 2: pscr_ret__ = stem##2(variable); break; \
315 case 4: pscr_ret__ = stem##4(variable); break; \
316 case 8: pscr_ret__ = stem##8(variable); break; \
317 default: \
318 __bad_size_call_parameter(); break; \
319 } \
320 pscr_ret__; \
321})
322
323#define __pcpu_size_call_return2(stem, variable, ...) \
324({ \
325 typeof(variable) pscr2_ret__; \
326 __verify_pcpu_ptr(&(variable)); \
327 switch(sizeof(variable)) { \
328 case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
329 case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \
330 case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \
331 case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \
332 default: \
333 __bad_size_call_parameter(); break; \
334 } \
335 pscr2_ret__; \
336})
337
338/*
339 * Special handling for cmpxchg_double. cmpxchg_double is passed two
340 * percpu variables. The first has to be aligned to a double word
341 * boundary and the second has to follow directly thereafter.
342 * We enforce this on all architectures even if they don't support
343 * a double cmpxchg instruction, since it's a cheap requirement, and it
344 * avoids breaking the requirement for architectures with the instruction.
345 */
346#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
347({ \
348 bool pdcrb_ret__; \
349 __verify_pcpu_ptr(&(pcp1)); \
350 BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
351 VM_BUG_ON((unsigned long)(&(pcp1)) % (2 * sizeof(pcp1))); \
352 VM_BUG_ON((unsigned long)(&(pcp2)) != \
353 (unsigned long)(&(pcp1)) + sizeof(pcp1)); \
354 switch(sizeof(pcp1)) { \
355 case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
356 case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
357 case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
358 case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
359 default: \
360 __bad_size_call_parameter(); break; \
361 } \
362 pdcrb_ret__; \
363})
364
365#define __pcpu_size_call(stem, variable, ...) \
366do { \
367 __verify_pcpu_ptr(&(variable)); \
368 switch(sizeof(variable)) { \
369 case 1: stem##1(variable, __VA_ARGS__);break; \
370 case 2: stem##2(variable, __VA_ARGS__);break; \
371 case 4: stem##4(variable, __VA_ARGS__);break; \
372 case 8: stem##8(variable, __VA_ARGS__);break; \
373 default: \
374 __bad_size_call_parameter();break; \
375 } \
376} while (0)
377
378/*
379 * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
380 *
381 * Optimized manipulation for memory allocated through the per cpu
382 * allocator or for addresses of per cpu variables.
383 *
384 * These operation guarantee exclusivity of access for other operations
385 * on the *same* processor. The assumption is that per cpu data is only
386 * accessed by a single processor instance (the current one).
387 *
388 * The arch code can provide optimized implementation by defining macros
389 * for certain scalar sizes. F.e. provide this_cpu_add_2() to provide per
390 * cpu atomic operations for 2 byte sized RMW actions. If arch code does
391 * not provide operations for a scalar size then the fallback in the
392 * generic code will be used.
393 *
394 * cmpxchg_double replaces two adjacent scalars at once. The first two
395 * parameters are per cpu variables which have to be of the same size. A
396 * truth value is returned to indicate success or failure (since a double
397 * register result is difficult to handle). There is very limited hardware
398 * support for these operations, so only certain sizes may work.
399 */
400
401/*
402 * Operations for contexts where we do not want to do any checks for
403 * preemptions. Unless strictly necessary, always use [__]this_cpu_*()
404 * instead.
405 *
406 * If there is no other protection through preempt disable and/or disabling
407 * interupts then one of these RMW operations can show unexpected behavior
408 * because the execution thread was rescheduled on another processor or an
409 * interrupt occurred and the same percpu variable was modified from the
410 * interrupt context.
411 */
412#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)
413#define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, pcp, val)
414#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
415#define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, pcp, val)
416#define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, pcp, val)
417#define raw_cpu_add_return(pcp, val) __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
418#define raw_cpu_xchg(pcp, nval) __pcpu_size_call_return2(raw_cpu_xchg_, pcp, nval)
419#define raw_cpu_cmpxchg(pcp, oval, nval) \
420 __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
421#define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
422 __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)
423
424#define raw_cpu_sub(pcp, val) raw_cpu_add(pcp, -(val))
425#define raw_cpu_inc(pcp) raw_cpu_add(pcp, 1)
426#define raw_cpu_dec(pcp) raw_cpu_sub(pcp, 1)
427#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
428#define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1)
429#define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1)
430
431/*
432 * Operations for contexts that are safe from preemption/interrupts. These
433 * operations verify that preemption is disabled.
434 */
435#define __this_cpu_read(pcp) \
436({ \
437 __this_cpu_preempt_check("read"); \
438 raw_cpu_read(pcp); \
439})
440
441#define __this_cpu_write(pcp, val) \
442({ \
443 __this_cpu_preempt_check("write"); \
444 raw_cpu_write(pcp, val); \
445})
446
447#define __this_cpu_add(pcp, val) \
448({ \
449 __this_cpu_preempt_check("add"); \
450 raw_cpu_add(pcp, val); \
451})
452
453#define __this_cpu_and(pcp, val) \
454({ \
455 __this_cpu_preempt_check("and"); \
456 raw_cpu_and(pcp, val); \
457})
458
459#define __this_cpu_or(pcp, val) \
460({ \
461 __this_cpu_preempt_check("or"); \
462 raw_cpu_or(pcp, val); \
463})
464
465#define __this_cpu_add_return(pcp, val) \
466({ \
467 __this_cpu_preempt_check("add_return"); \
468 raw_cpu_add_return(pcp, val); \
469})
470
471#define __this_cpu_xchg(pcp, nval) \
472({ \
473 __this_cpu_preempt_check("xchg"); \
474 raw_cpu_xchg(pcp, nval); \
475})
476
477#define __this_cpu_cmpxchg(pcp, oval, nval) \
478({ \
479 __this_cpu_preempt_check("cmpxchg"); \
480 raw_cpu_cmpxchg(pcp, oval, nval); \
481})
482
483#define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
484({ __this_cpu_preempt_check("cmpxchg_double"); \
485 raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2); \
486})
487
488#define __this_cpu_sub(pcp, val) __this_cpu_add(pcp, -(typeof(pcp))(val))
489#define __this_cpu_inc(pcp) __this_cpu_add(pcp, 1)
490#define __this_cpu_dec(pcp) __this_cpu_sub(pcp, 1)
491#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
492#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
493#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
494
495/*
496 * Operations with implied preemption protection. These operations can be
497 * used without worrying about preemption. Note that interrupts may still
498 * occur while an operation is in progress and if the interrupt modifies
499 * the variable too then RMW actions may not be reliable.
500 */
501#define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, pcp)
502#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
503#define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val)
504#define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, pcp, val)
505#define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, pcp, val)
506#define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
507#define this_cpu_xchg(pcp, nval) __pcpu_size_call_return2(this_cpu_xchg_, pcp, nval)
508#define this_cpu_cmpxchg(pcp, oval, nval) \
509 __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
510#define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
511 __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)
512
513#define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val))
514#define this_cpu_inc(pcp) this_cpu_add(pcp, 1)
515#define this_cpu_dec(pcp) this_cpu_sub(pcp, 1)
516#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
517#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
518#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
519
520#endif /* __ASSEMBLY__ */
167#endif /* _LINUX_PERCPU_DEFS_H */ 521#endif /* _LINUX_PERCPU_DEFS_H */
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 0afb48fd449d..3dfbf237cd8f 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -57,11 +57,9 @@ struct percpu_ref {
57 atomic_t count; 57 atomic_t count;
58 /* 58 /*
59 * The low bit of the pointer indicates whether the ref is in percpu 59 * The low bit of the pointer indicates whether the ref is in percpu
60 * mode; if set, then get/put will manipulate the atomic_t (this is a 60 * mode; if set, then get/put will manipulate the atomic_t.
61 * hack because we need to keep the pointer around for
62 * percpu_ref_kill_rcu())
63 */ 61 */
64 unsigned __percpu *pcpu_count; 62 unsigned long pcpu_count_ptr;
65 percpu_ref_func_t *release; 63 percpu_ref_func_t *release;
66 percpu_ref_func_t *confirm_kill; 64 percpu_ref_func_t *confirm_kill;
67 struct rcu_head rcu; 65 struct rcu_head rcu;
@@ -69,7 +67,8 @@ struct percpu_ref {
69 67
70int __must_check percpu_ref_init(struct percpu_ref *ref, 68int __must_check percpu_ref_init(struct percpu_ref *ref,
71 percpu_ref_func_t *release); 69 percpu_ref_func_t *release);
72void percpu_ref_cancel_init(struct percpu_ref *ref); 70void percpu_ref_reinit(struct percpu_ref *ref);
71void percpu_ref_exit(struct percpu_ref *ref);
73void percpu_ref_kill_and_confirm(struct percpu_ref *ref, 72void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
74 percpu_ref_func_t *confirm_kill); 73 percpu_ref_func_t *confirm_kill);
75 74
@@ -88,12 +87,28 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
88 return percpu_ref_kill_and_confirm(ref, NULL); 87 return percpu_ref_kill_and_confirm(ref, NULL);
89} 88}
90 89
91#define PCPU_STATUS_BITS 2
92#define PCPU_STATUS_MASK ((1 << PCPU_STATUS_BITS) - 1)
93#define PCPU_REF_PTR 0
94#define PCPU_REF_DEAD 1 90#define PCPU_REF_DEAD 1
95 91
96#define REF_STATUS(count) (((unsigned long) count) & PCPU_STATUS_MASK) 92/*
93 * Internal helper. Don't use outside percpu-refcount proper. The
94 * function doesn't return the pointer and let the caller test it for NULL
95 * because doing so forces the compiler to generate two conditional
96 * branches as it can't assume that @ref->pcpu_count is not NULL.
97 */
98static inline bool __pcpu_ref_alive(struct percpu_ref *ref,
99 unsigned __percpu **pcpu_countp)
100{
101 unsigned long pcpu_ptr = ACCESS_ONCE(ref->pcpu_count_ptr);
102
103 /* paired with smp_store_release() in percpu_ref_reinit() */
104 smp_read_barrier_depends();
105
106 if (unlikely(pcpu_ptr & PCPU_REF_DEAD))
107 return false;
108
109 *pcpu_countp = (unsigned __percpu *)pcpu_ptr;
110 return true;
111}
97 112
98/** 113/**
99 * percpu_ref_get - increment a percpu refcount 114 * percpu_ref_get - increment a percpu refcount
@@ -107,9 +122,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
107 122
108 rcu_read_lock_sched(); 123 rcu_read_lock_sched();
109 124
110 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 125 if (__pcpu_ref_alive(ref, &pcpu_count))
111
112 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
113 this_cpu_inc(*pcpu_count); 126 this_cpu_inc(*pcpu_count);
114 else 127 else
115 atomic_inc(&ref->count); 128 atomic_inc(&ref->count);
@@ -121,6 +134,34 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
121 * percpu_ref_tryget - try to increment a percpu refcount 134 * percpu_ref_tryget - try to increment a percpu refcount
122 * @ref: percpu_ref to try-get 135 * @ref: percpu_ref to try-get
123 * 136 *
137 * Increment a percpu refcount unless its count already reached zero.
138 * Returns %true on success; %false on failure.
139 *
140 * The caller is responsible for ensuring that @ref stays accessible.
141 */
142static inline bool percpu_ref_tryget(struct percpu_ref *ref)
143{
144 unsigned __percpu *pcpu_count;
145 int ret = false;
146
147 rcu_read_lock_sched();
148
149 if (__pcpu_ref_alive(ref, &pcpu_count)) {
150 this_cpu_inc(*pcpu_count);
151 ret = true;
152 } else {
153 ret = atomic_inc_not_zero(&ref->count);
154 }
155
156 rcu_read_unlock_sched();
157
158 return ret;
159}
160
161/**
162 * percpu_ref_tryget_live - try to increment a live percpu refcount
163 * @ref: percpu_ref to try-get
164 *
124 * Increment a percpu refcount unless it has already been killed. Returns 165 * Increment a percpu refcount unless it has already been killed. Returns
125 * %true on success; %false on failure. 166 * %true on success; %false on failure.
126 * 167 *
@@ -128,17 +169,17 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
128 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be 169 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be
129 * used. After the confirm_kill callback is invoked, it's guaranteed that 170 * used. After the confirm_kill callback is invoked, it's guaranteed that
130 * no new reference will be given out by percpu_ref_tryget(). 171 * no new reference will be given out by percpu_ref_tryget().
172 *
173 * The caller is responsible for ensuring that @ref stays accessible.
131 */ 174 */
132static inline bool percpu_ref_tryget(struct percpu_ref *ref) 175static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
133{ 176{
134 unsigned __percpu *pcpu_count; 177 unsigned __percpu *pcpu_count;
135 int ret = false; 178 int ret = false;
136 179
137 rcu_read_lock_sched(); 180 rcu_read_lock_sched();
138 181
139 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 182 if (__pcpu_ref_alive(ref, &pcpu_count)) {
140
141 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
142 this_cpu_inc(*pcpu_count); 183 this_cpu_inc(*pcpu_count);
143 ret = true; 184 ret = true;
144 } 185 }
@@ -161,9 +202,7 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
161 202
162 rcu_read_lock_sched(); 203 rcu_read_lock_sched();
163 204
164 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 205 if (__pcpu_ref_alive(ref, &pcpu_count))
165
166 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
167 this_cpu_dec(*pcpu_count); 206 this_cpu_dec(*pcpu_count);
168 else if (unlikely(atomic_dec_and_test(&ref->count))) 207 else if (unlikely(atomic_dec_and_test(&ref->count)))
169 ref->release(ref); 208 ref->release(ref);
@@ -171,4 +210,19 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
171 rcu_read_unlock_sched(); 210 rcu_read_unlock_sched();
172} 211}
173 212
213/**
214 * percpu_ref_is_zero - test whether a percpu refcount reached zero
215 * @ref: percpu_ref to test
216 *
217 * Returns %true if @ref reached zero.
218 */
219static inline bool percpu_ref_is_zero(struct percpu_ref *ref)
220{
221 unsigned __percpu *pcpu_count;
222
223 if (__pcpu_ref_alive(ref, &pcpu_count))
224 return false;
225 return !atomic_read(&ref->count);
226}
227
174#endif 228#endif
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 495c6543a8f2..6f61b61b7996 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -23,32 +23,6 @@
23 PERCPU_MODULE_RESERVE) 23 PERCPU_MODULE_RESERVE)
24#endif 24#endif
25 25
26/*
27 * Must be an lvalue. Since @var must be a simple identifier,
28 * we force a syntax error here if it isn't.
29 */
30#define get_cpu_var(var) (*({ \
31 preempt_disable(); \
32 &__get_cpu_var(var); }))
33
34/*
35 * The weird & is necessary because sparse considers (void)(var) to be
36 * a direct dereference of percpu variable (var).
37 */
38#define put_cpu_var(var) do { \
39 (void)&(var); \
40 preempt_enable(); \
41} while (0)
42
43#define get_cpu_ptr(var) ({ \
44 preempt_disable(); \
45 this_cpu_ptr(var); })
46
47#define put_cpu_ptr(var) do { \
48 (void)(var); \
49 preempt_enable(); \
50} while (0)
51
52/* minimum unit size, also is the maximum supported allocation size */ 26/* minimum unit size, also is the maximum supported allocation size */
53#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10) 27#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10)
54 28
@@ -140,17 +114,6 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size,
140 pcpu_fc_populate_pte_fn_t populate_pte_fn); 114 pcpu_fc_populate_pte_fn_t populate_pte_fn);
141#endif 115#endif
142 116
143/*
144 * Use this to get to a cpu's version of the per-cpu object
145 * dynamically allocated. Non-atomic access to the current CPU's
146 * version should probably be combined with get_cpu()/put_cpu().
147 */
148#ifdef CONFIG_SMP
149#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)))
150#else
151#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); })
152#endif
153
154extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); 117extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align);
155extern bool is_kernel_percpu_address(unsigned long addr); 118extern bool is_kernel_percpu_address(unsigned long addr);
156 119
@@ -166,640 +129,4 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166#define alloc_percpu(type) \ 129#define alloc_percpu(type) \
167 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 130 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
168 131
169/*
170 * Branching function to split up a function into a set of functions that
171 * are called for different scalar sizes of the objects handled.
172 */
173
174extern void __bad_size_call_parameter(void);
175
176#ifdef CONFIG_DEBUG_PREEMPT
177extern void __this_cpu_preempt_check(const char *op);
178#else
179static inline void __this_cpu_preempt_check(const char *op) { }
180#endif
181
182#define __pcpu_size_call_return(stem, variable) \
183({ typeof(variable) pscr_ret__; \
184 __verify_pcpu_ptr(&(variable)); \
185 switch(sizeof(variable)) { \
186 case 1: pscr_ret__ = stem##1(variable);break; \
187 case 2: pscr_ret__ = stem##2(variable);break; \
188 case 4: pscr_ret__ = stem##4(variable);break; \
189 case 8: pscr_ret__ = stem##8(variable);break; \
190 default: \
191 __bad_size_call_parameter();break; \
192 } \
193 pscr_ret__; \
194})
195
196#define __pcpu_size_call_return2(stem, variable, ...) \
197({ \
198 typeof(variable) pscr2_ret__; \
199 __verify_pcpu_ptr(&(variable)); \
200 switch(sizeof(variable)) { \
201 case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
202 case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \
203 case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \
204 case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \
205 default: \
206 __bad_size_call_parameter(); break; \
207 } \
208 pscr2_ret__; \
209})
210
211/*
212 * Special handling for cmpxchg_double. cmpxchg_double is passed two
213 * percpu variables. The first has to be aligned to a double word
214 * boundary and the second has to follow directly thereafter.
215 * We enforce this on all architectures even if they don't support
216 * a double cmpxchg instruction, since it's a cheap requirement, and it
217 * avoids breaking the requirement for architectures with the instruction.
218 */
219#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
220({ \
221 bool pdcrb_ret__; \
222 __verify_pcpu_ptr(&pcp1); \
223 BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
224 VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \
225 VM_BUG_ON((unsigned long)(&pcp2) != \
226 (unsigned long)(&pcp1) + sizeof(pcp1)); \
227 switch(sizeof(pcp1)) { \
228 case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
229 case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
230 case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
231 case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
232 default: \
233 __bad_size_call_parameter(); break; \
234 } \
235 pdcrb_ret__; \
236})
237
238#define __pcpu_size_call(stem, variable, ...) \
239do { \
240 __verify_pcpu_ptr(&(variable)); \
241 switch(sizeof(variable)) { \
242 case 1: stem##1(variable, __VA_ARGS__);break; \
243 case 2: stem##2(variable, __VA_ARGS__);break; \
244 case 4: stem##4(variable, __VA_ARGS__);break; \
245 case 8: stem##8(variable, __VA_ARGS__);break; \
246 default: \
247 __bad_size_call_parameter();break; \
248 } \
249} while (0)
250
251/*
252 * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
253 *
254 * Optimized manipulation for memory allocated through the per cpu
255 * allocator or for addresses of per cpu variables.
256 *
257 * These operation guarantee exclusivity of access for other operations
258 * on the *same* processor. The assumption is that per cpu data is only
259 * accessed by a single processor instance (the current one).
260 *
261 * The first group is used for accesses that must be done in a
262 * preemption safe way since we know that the context is not preempt
263 * safe. Interrupts may occur. If the interrupt modifies the variable
264 * too then RMW actions will not be reliable.
265 *
266 * The arch code can provide optimized functions in two ways:
267 *
268 * 1. Override the function completely. F.e. define this_cpu_add().
269 * The arch must then ensure that the various scalar format passed
270 * are handled correctly.
271 *
272 * 2. Provide functions for certain scalar sizes. F.e. provide
273 * this_cpu_add_2() to provide per cpu atomic operations for 2 byte
274 * sized RMW actions. If arch code does not provide operations for
275 * a scalar size then the fallback in the generic code will be
276 * used.
277 */
278
279#define _this_cpu_generic_read(pcp) \
280({ typeof(pcp) ret__; \
281 preempt_disable(); \
282 ret__ = *this_cpu_ptr(&(pcp)); \
283 preempt_enable(); \
284 ret__; \
285})
286
287#ifndef this_cpu_read
288# ifndef this_cpu_read_1
289# define this_cpu_read_1(pcp) _this_cpu_generic_read(pcp)
290# endif
291# ifndef this_cpu_read_2
292# define this_cpu_read_2(pcp) _this_cpu_generic_read(pcp)
293# endif
294# ifndef this_cpu_read_4
295# define this_cpu_read_4(pcp) _this_cpu_generic_read(pcp)
296# endif
297# ifndef this_cpu_read_8
298# define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp)
299# endif
300# define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, (pcp))
301#endif
302
303#define _this_cpu_generic_to_op(pcp, val, op) \
304do { \
305 unsigned long flags; \
306 raw_local_irq_save(flags); \
307 *raw_cpu_ptr(&(pcp)) op val; \
308 raw_local_irq_restore(flags); \
309} while (0)
310
311#ifndef this_cpu_write
312# ifndef this_cpu_write_1
313# define this_cpu_write_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
314# endif
315# ifndef this_cpu_write_2
316# define this_cpu_write_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
317# endif
318# ifndef this_cpu_write_4
319# define this_cpu_write_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
320# endif
321# ifndef this_cpu_write_8
322# define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
323# endif
324# define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, (pcp), (val))
325#endif
326
327#ifndef this_cpu_add
328# ifndef this_cpu_add_1
329# define this_cpu_add_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
330# endif
331# ifndef this_cpu_add_2
332# define this_cpu_add_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
333# endif
334# ifndef this_cpu_add_4
335# define this_cpu_add_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
336# endif
337# ifndef this_cpu_add_8
338# define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
339# endif
340# define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, (pcp), (val))
341#endif
342
343#ifndef this_cpu_sub
344# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val))
345#endif
346
347#ifndef this_cpu_inc
348# define this_cpu_inc(pcp) this_cpu_add((pcp), 1)
349#endif
350
351#ifndef this_cpu_dec
352# define this_cpu_dec(pcp) this_cpu_sub((pcp), 1)
353#endif
354
355#ifndef this_cpu_and
356# ifndef this_cpu_and_1
357# define this_cpu_and_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
358# endif
359# ifndef this_cpu_and_2
360# define this_cpu_and_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
361# endif
362# ifndef this_cpu_and_4
363# define this_cpu_and_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
364# endif
365# ifndef this_cpu_and_8
366# define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
367# endif
368# define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, (pcp), (val))
369#endif
370
371#ifndef this_cpu_or
372# ifndef this_cpu_or_1
373# define this_cpu_or_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
374# endif
375# ifndef this_cpu_or_2
376# define this_cpu_or_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
377# endif
378# ifndef this_cpu_or_4
379# define this_cpu_or_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
380# endif
381# ifndef this_cpu_or_8
382# define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
383# endif
384# define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
385#endif
386
387#define _this_cpu_generic_add_return(pcp, val) \
388({ \
389 typeof(pcp) ret__; \
390 unsigned long flags; \
391 raw_local_irq_save(flags); \
392 raw_cpu_add(pcp, val); \
393 ret__ = raw_cpu_read(pcp); \
394 raw_local_irq_restore(flags); \
395 ret__; \
396})
397
398#ifndef this_cpu_add_return
399# ifndef this_cpu_add_return_1
400# define this_cpu_add_return_1(pcp, val) _this_cpu_generic_add_return(pcp, val)
401# endif
402# ifndef this_cpu_add_return_2
403# define this_cpu_add_return_2(pcp, val) _this_cpu_generic_add_return(pcp, val)
404# endif
405# ifndef this_cpu_add_return_4
406# define this_cpu_add_return_4(pcp, val) _this_cpu_generic_add_return(pcp, val)
407# endif
408# ifndef this_cpu_add_return_8
409# define this_cpu_add_return_8(pcp, val) _this_cpu_generic_add_return(pcp, val)
410# endif
411# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
412#endif
413
414#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
415#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
416#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
417
418#define _this_cpu_generic_xchg(pcp, nval) \
419({ typeof(pcp) ret__; \
420 unsigned long flags; \
421 raw_local_irq_save(flags); \
422 ret__ = raw_cpu_read(pcp); \
423 raw_cpu_write(pcp, nval); \
424 raw_local_irq_restore(flags); \
425 ret__; \
426})
427
428#ifndef this_cpu_xchg
429# ifndef this_cpu_xchg_1
430# define this_cpu_xchg_1(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
431# endif
432# ifndef this_cpu_xchg_2
433# define this_cpu_xchg_2(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
434# endif
435# ifndef this_cpu_xchg_4
436# define this_cpu_xchg_4(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
437# endif
438# ifndef this_cpu_xchg_8
439# define this_cpu_xchg_8(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
440# endif
441# define this_cpu_xchg(pcp, nval) \
442 __pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval)
443#endif
444
445#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \
446({ \
447 typeof(pcp) ret__; \
448 unsigned long flags; \
449 raw_local_irq_save(flags); \
450 ret__ = raw_cpu_read(pcp); \
451 if (ret__ == (oval)) \
452 raw_cpu_write(pcp, nval); \
453 raw_local_irq_restore(flags); \
454 ret__; \
455})
456
457#ifndef this_cpu_cmpxchg
458# ifndef this_cpu_cmpxchg_1
459# define this_cpu_cmpxchg_1(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
460# endif
461# ifndef this_cpu_cmpxchg_2
462# define this_cpu_cmpxchg_2(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
463# endif
464# ifndef this_cpu_cmpxchg_4
465# define this_cpu_cmpxchg_4(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
466# endif
467# ifndef this_cpu_cmpxchg_8
468# define this_cpu_cmpxchg_8(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
469# endif
470# define this_cpu_cmpxchg(pcp, oval, nval) \
471 __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
472#endif
473
474/*
475 * cmpxchg_double replaces two adjacent scalars at once. The first
476 * two parameters are per cpu variables which have to be of the same
477 * size. A truth value is returned to indicate success or failure
478 * (since a double register result is difficult to handle). There is
479 * very limited hardware support for these operations, so only certain
480 * sizes may work.
481 */
482#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
483({ \
484 int ret__; \
485 unsigned long flags; \
486 raw_local_irq_save(flags); \
487 ret__ = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \
488 oval1, oval2, nval1, nval2); \
489 raw_local_irq_restore(flags); \
490 ret__; \
491})
492
493#ifndef this_cpu_cmpxchg_double
494# ifndef this_cpu_cmpxchg_double_1
495# define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
496 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
497# endif
498# ifndef this_cpu_cmpxchg_double_2
499# define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
500 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
501# endif
502# ifndef this_cpu_cmpxchg_double_4
503# define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
504 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
505# endif
506# ifndef this_cpu_cmpxchg_double_8
507# define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
508 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
509# endif
510# define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
511 __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
512#endif
513
514/*
515 * Generic percpu operations for contexts where we do not want to do
516 * any checks for preemptiosn.
517 *
518 * If there is no other protection through preempt disable and/or
519 * disabling interupts then one of these RMW operations can show unexpected
520 * behavior because the execution thread was rescheduled on another processor
521 * or an interrupt occurred and the same percpu variable was modified from
522 * the interrupt context.
523 */
524#ifndef raw_cpu_read
525# ifndef raw_cpu_read_1
526# define raw_cpu_read_1(pcp) (*raw_cpu_ptr(&(pcp)))
527# endif
528# ifndef raw_cpu_read_2
529# define raw_cpu_read_2(pcp) (*raw_cpu_ptr(&(pcp)))
530# endif
531# ifndef raw_cpu_read_4
532# define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))
533# endif
534# ifndef raw_cpu_read_8
535# define raw_cpu_read_8(pcp) (*raw_cpu_ptr(&(pcp)))
536# endif
537# define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, (pcp))
538#endif
539
540#define raw_cpu_generic_to_op(pcp, val, op) \
541do { \
542 *raw_cpu_ptr(&(pcp)) op val; \
543} while (0)
544
545
546#ifndef raw_cpu_write
547# ifndef raw_cpu_write_1
548# define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
549# endif
550# ifndef raw_cpu_write_2
551# define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
552# endif
553# ifndef raw_cpu_write_4
554# define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
555# endif
556# ifndef raw_cpu_write_8
557# define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
558# endif
559# define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, (pcp), (val))
560#endif
561
562#ifndef raw_cpu_add
563# ifndef raw_cpu_add_1
564# define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
565# endif
566# ifndef raw_cpu_add_2
567# define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
568# endif
569# ifndef raw_cpu_add_4
570# define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
571# endif
572# ifndef raw_cpu_add_8
573# define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
574# endif
575# define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, (pcp), (val))
576#endif
577
578#ifndef raw_cpu_sub
579# define raw_cpu_sub(pcp, val) raw_cpu_add((pcp), -(val))
580#endif
581
582#ifndef raw_cpu_inc
583# define raw_cpu_inc(pcp) raw_cpu_add((pcp), 1)
584#endif
585
586#ifndef raw_cpu_dec
587# define raw_cpu_dec(pcp) raw_cpu_sub((pcp), 1)
588#endif
589
590#ifndef raw_cpu_and
591# ifndef raw_cpu_and_1
592# define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
593# endif
594# ifndef raw_cpu_and_2
595# define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
596# endif
597# ifndef raw_cpu_and_4
598# define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
599# endif
600# ifndef raw_cpu_and_8
601# define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
602# endif
603# define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, (pcp), (val))
604#endif
605
606#ifndef raw_cpu_or
607# ifndef raw_cpu_or_1
608# define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
609# endif
610# ifndef raw_cpu_or_2
611# define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
612# endif
613# ifndef raw_cpu_or_4
614# define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
615# endif
616# ifndef raw_cpu_or_8
617# define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
618# endif
619# define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, (pcp), (val))
620#endif
621
622#define raw_cpu_generic_add_return(pcp, val) \
623({ \
624 raw_cpu_add(pcp, val); \
625 raw_cpu_read(pcp); \
626})
627
628#ifndef raw_cpu_add_return
629# ifndef raw_cpu_add_return_1
630# define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val)
631# endif
632# ifndef raw_cpu_add_return_2
633# define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val)
634# endif
635# ifndef raw_cpu_add_return_4
636# define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val)
637# endif
638# ifndef raw_cpu_add_return_8
639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
640# endif
641# define raw_cpu_add_return(pcp, val) \
642 __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
643#endif
644
645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
646#define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1)
647#define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1)
648
649#define raw_cpu_generic_xchg(pcp, nval) \
650({ typeof(pcp) ret__; \
651 ret__ = raw_cpu_read(pcp); \
652 raw_cpu_write(pcp, nval); \
653 ret__; \
654})
655
656#ifndef raw_cpu_xchg
657# ifndef raw_cpu_xchg_1
658# define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
659# endif
660# ifndef raw_cpu_xchg_2
661# define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
662# endif
663# ifndef raw_cpu_xchg_4
664# define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
665# endif
666# ifndef raw_cpu_xchg_8
667# define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
668# endif
669# define raw_cpu_xchg(pcp, nval) \
670 __pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval)
671#endif
672
673#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
674({ \
675 typeof(pcp) ret__; \
676 ret__ = raw_cpu_read(pcp); \
677 if (ret__ == (oval)) \
678 raw_cpu_write(pcp, nval); \
679 ret__; \
680})
681
682#ifndef raw_cpu_cmpxchg
683# ifndef raw_cpu_cmpxchg_1
684# define raw_cpu_cmpxchg_1(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
685# endif
686# ifndef raw_cpu_cmpxchg_2
687# define raw_cpu_cmpxchg_2(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
688# endif
689# ifndef raw_cpu_cmpxchg_4
690# define raw_cpu_cmpxchg_4(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
691# endif
692# ifndef raw_cpu_cmpxchg_8
693# define raw_cpu_cmpxchg_8(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
694# endif
695# define raw_cpu_cmpxchg(pcp, oval, nval) \
696 __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
697#endif
698
699#define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
700({ \
701 int __ret = 0; \
702 if (raw_cpu_read(pcp1) == (oval1) && \
703 raw_cpu_read(pcp2) == (oval2)) { \
704 raw_cpu_write(pcp1, (nval1)); \
705 raw_cpu_write(pcp2, (nval2)); \
706 __ret = 1; \
707 } \
708 (__ret); \
709})
710
711#ifndef raw_cpu_cmpxchg_double
712# ifndef raw_cpu_cmpxchg_double_1
713# define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
714 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
715# endif
716# ifndef raw_cpu_cmpxchg_double_2
717# define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
718 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
719# endif
720# ifndef raw_cpu_cmpxchg_double_4
721# define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
722 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
723# endif
724# ifndef raw_cpu_cmpxchg_double_8
725# define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
726 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
727# endif
728# define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
729 __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
730#endif
731
732/*
733 * Generic percpu operations for context that are safe from preemption/interrupts.
734 */
735#ifndef __this_cpu_read
736# define __this_cpu_read(pcp) \
737 (__this_cpu_preempt_check("read"),__pcpu_size_call_return(raw_cpu_read_, (pcp)))
738#endif
739
740#ifndef __this_cpu_write
741# define __this_cpu_write(pcp, val) \
742do { __this_cpu_preempt_check("write"); \
743 __pcpu_size_call(raw_cpu_write_, (pcp), (val)); \
744} while (0)
745#endif
746
747#ifndef __this_cpu_add
748# define __this_cpu_add(pcp, val) \
749do { __this_cpu_preempt_check("add"); \
750 __pcpu_size_call(raw_cpu_add_, (pcp), (val)); \
751} while (0)
752#endif
753
754#ifndef __this_cpu_sub
755# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val))
756#endif
757
758#ifndef __this_cpu_inc
759# define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1)
760#endif
761
762#ifndef __this_cpu_dec
763# define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1)
764#endif
765
766#ifndef __this_cpu_and
767# define __this_cpu_and(pcp, val) \
768do { __this_cpu_preempt_check("and"); \
769 __pcpu_size_call(raw_cpu_and_, (pcp), (val)); \
770} while (0)
771
772#endif
773
774#ifndef __this_cpu_or
775# define __this_cpu_or(pcp, val) \
776do { __this_cpu_preempt_check("or"); \
777 __pcpu_size_call(raw_cpu_or_, (pcp), (val)); \
778} while (0)
779#endif
780
781#ifndef __this_cpu_add_return
782# define __this_cpu_add_return(pcp, val) \
783 (__this_cpu_preempt_check("add_return"),__pcpu_size_call_return2(raw_cpu_add_return_, pcp, val))
784#endif
785
786#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
787#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
788#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
789
790#ifndef __this_cpu_xchg
791# define __this_cpu_xchg(pcp, nval) \
792 (__this_cpu_preempt_check("xchg"),__pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval))
793#endif
794
795#ifndef __this_cpu_cmpxchg
796# define __this_cpu_cmpxchg(pcp, oval, nval) \
797 (__this_cpu_preempt_check("cmpxchg"),__pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval))
798#endif
799
800#ifndef __this_cpu_cmpxchg_double
801# define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
802 (__this_cpu_preempt_check("cmpxchg_double"),__pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)))
803#endif
804
805#endif /* __LINUX_PERCPU_H */ 132#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index a9209118d80f..707617a8c0f6 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -167,6 +167,11 @@ struct perf_event;
167#define PERF_EVENT_TXN 0x1 167#define PERF_EVENT_TXN 0x1
168 168
169/** 169/**
170 * pmu::capabilities flags
171 */
172#define PERF_PMU_CAP_NO_INTERRUPT 0x01
173
174/**
170 * struct pmu - generic performance monitoring unit 175 * struct pmu - generic performance monitoring unit
171 */ 176 */
172struct pmu { 177struct pmu {
@@ -178,6 +183,11 @@ struct pmu {
178 const char *name; 183 const char *name;
179 int type; 184 int type;
180 185
186 /*
187 * various common per-pmu feature flags
188 */
189 int capabilities;
190
181 int * __percpu pmu_disable_count; 191 int * __percpu pmu_disable_count;
182 struct perf_cpu_context * __percpu pmu_cpu_context; 192 struct perf_cpu_context * __percpu pmu_cpu_context;
183 int task_ctx_nr; 193 int task_ctx_nr;
@@ -696,7 +706,8 @@ extern struct perf_guest_info_callbacks *perf_guest_cbs;
696extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 706extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
697extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 707extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
698 708
699extern void perf_event_comm(struct task_struct *tsk); 709extern void perf_event_exec(void);
710extern void perf_event_comm(struct task_struct *tsk, bool exec);
700extern void perf_event_fork(struct task_struct *tsk); 711extern void perf_event_fork(struct task_struct *tsk);
701 712
702/* Callchains */ 713/* Callchains */
@@ -773,7 +784,7 @@ extern void perf_event_enable(struct perf_event *event);
773extern void perf_event_disable(struct perf_event *event); 784extern void perf_event_disable(struct perf_event *event);
774extern int __perf_event_disable(void *info); 785extern int __perf_event_disable(void *info);
775extern void perf_event_task_tick(void); 786extern void perf_event_task_tick(void);
776#else 787#else /* !CONFIG_PERF_EVENTS: */
777static inline void 788static inline void
778perf_event_task_sched_in(struct task_struct *prev, 789perf_event_task_sched_in(struct task_struct *prev,
779 struct task_struct *task) { } 790 struct task_struct *task) { }
@@ -803,7 +814,8 @@ static inline int perf_unregister_guest_info_callbacks
803(struct perf_guest_info_callbacks *callbacks) { return 0; } 814(struct perf_guest_info_callbacks *callbacks) { return 0; }
804 815
805static inline void perf_event_mmap(struct vm_area_struct *vma) { } 816static inline void perf_event_mmap(struct vm_area_struct *vma) { }
806static inline void perf_event_comm(struct task_struct *tsk) { } 817static inline void perf_event_exec(void) { }
818static inline void perf_event_comm(struct task_struct *tsk, bool exec) { }
807static inline void perf_event_fork(struct task_struct *tsk) { } 819static inline void perf_event_fork(struct task_struct *tsk) { }
808static inline void perf_event_init(void) { } 820static inline void perf_event_init(void) { }
809static inline int perf_swevent_get_recursion_context(void) { return -1; } 821static inline int perf_swevent_get_recursion_context(void) { return -1; }
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 4d0221fd0688..68041446c450 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -198,6 +198,13 @@ static inline struct mii_bus *mdiobus_alloc(void)
198int mdiobus_register(struct mii_bus *bus); 198int mdiobus_register(struct mii_bus *bus);
199void mdiobus_unregister(struct mii_bus *bus); 199void mdiobus_unregister(struct mii_bus *bus);
200void mdiobus_free(struct mii_bus *bus); 200void mdiobus_free(struct mii_bus *bus);
201struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv);
202static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev)
203{
204 return devm_mdiobus_alloc_size(dev, 0);
205}
206
207void devm_mdiobus_free(struct device *dev, struct mii_bus *bus);
201struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); 208struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
202int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); 209int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
203int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); 210int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
@@ -529,6 +536,15 @@ struct phy_driver {
529 /* See set_wol, but for checking whether Wake on LAN is enabled. */ 536 /* See set_wol, but for checking whether Wake on LAN is enabled. */
530 void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); 537 void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
531 538
539 /*
540 * Called to inform a PHY device driver when the core is about to
541 * change the link state. This callback is supposed to be used as
542 * fixup hook for drivers that need to take action when the link
543 * state changes. Drivers are by no means allowed to mess with the
544 * PHY device structure in their implementations.
545 */
546 void (*link_change_notify)(struct phy_device *dev);
547
532 struct device_driver driver; 548 struct device_driver driver;
533}; 549};
534#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 550#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
@@ -666,6 +682,7 @@ static inline int phy_read_status(struct phy_device *phydev)
666 return phydev->drv->read_status(phydev); 682 return phydev->drv->read_status(phydev);
667} 683}
668 684
685int genphy_config_init(struct phy_device *phydev);
669int genphy_setup_forced(struct phy_device *phydev); 686int genphy_setup_forced(struct phy_device *phydev);
670int genphy_restart_aneg(struct phy_device *phydev); 687int genphy_restart_aneg(struct phy_device *phydev);
671int genphy_config_aneg(struct phy_device *phydev); 688int genphy_config_aneg(struct phy_device *phydev);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 509d8f5f984e..ae612acebb53 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -9,15 +9,31 @@ struct fixed_phy_status {
9 int asym_pause; 9 int asym_pause;
10}; 10};
11 11
12struct device_node;
13
12#ifdef CONFIG_FIXED_PHY 14#ifdef CONFIG_FIXED_PHY
13extern int fixed_phy_add(unsigned int irq, int phy_id, 15extern int fixed_phy_add(unsigned int irq, int phy_id,
14 struct fixed_phy_status *status); 16 struct fixed_phy_status *status);
17extern int fixed_phy_register(unsigned int irq,
18 struct fixed_phy_status *status,
19 struct device_node *np);
20extern void fixed_phy_del(int phy_addr);
15#else 21#else
16static inline int fixed_phy_add(unsigned int irq, int phy_id, 22static inline int fixed_phy_add(unsigned int irq, int phy_id,
17 struct fixed_phy_status *status) 23 struct fixed_phy_status *status)
18{ 24{
19 return -ENODEV; 25 return -ENODEV;
20} 26}
27static inline int fixed_phy_register(unsigned int irq,
28 struct fixed_phy_status *status,
29 struct device_node *np)
30{
31 return -ENODEV;
32}
33static inline int fixed_phy_del(int phy_addr)
34{
35 return -ENODEV;
36}
21#endif /* CONFIG_FIXED_PHY */ 37#endif /* CONFIG_FIXED_PHY */
22 38
23/* 39/*
diff --git a/include/linux/platform_data/ata-samsung_cf.h b/include/linux/platform_data/ata-samsung_cf.h
index c2049e3d7444..748e71642c4a 100644
--- a/include/linux/platform_data/ata-samsung_cf.h
+++ b/include/linux/platform_data/ata-samsung_cf.h
@@ -29,7 +29,6 @@ extern void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata);
29 29
30/* architecture-specific IDE configuration */ 30/* architecture-specific IDE configuration */
31extern void s3c64xx_ide_setup_gpio(void); 31extern void s3c64xx_ide_setup_gpio(void);
32extern void s5pc100_ide_setup_gpio(void);
33extern void s5pv210_ide_setup_gpio(void); 32extern void s5pv210_ide_setup_gpio(void);
34 33
35#endif /*__ATA_SAMSUNG_CF_H */ 34#endif /*__ATA_SAMSUNG_CF_H */
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
index 4edb40676b3f..780d1e97f620 100644
--- a/include/linux/platform_data/elm.h
+++ b/include/linux/platform_data/elm.h
@@ -21,6 +21,7 @@
21enum bch_ecc { 21enum bch_ecc {
22 BCH4_ECC = 0, 22 BCH4_ECC = 0,
23 BCH8_ECC, 23 BCH8_ECC,
24 BCH16_ECC,
24}; 25};
25 26
26/* ELM support 8 error syndrome process */ 27/* ELM support 8 error syndrome process */
@@ -38,7 +39,7 @@ struct elm_errorvec {
38 bool error_reported; 39 bool error_reported;
39 bool error_uncorrectable; 40 bool error_uncorrectable;
40 int error_count; 41 int error_count;
41 int error_loc[ERROR_VECTOR_MAX]; 42 int error_loc[16];
42}; 43};
43 44
44void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, 45void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
diff --git a/include/linux/platform_data/intel-mid_wdt.h b/include/linux/platform_data/intel-mid_wdt.h
new file mode 100644
index 000000000000..b98253466ace
--- /dev/null
+++ b/include/linux/platform_data/intel-mid_wdt.h
@@ -0,0 +1,22 @@
1/*
2 * intel-mid_wdt: generic Intel MID SCU watchdog driver
3 *
4 * Copyright (C) 2014 Intel Corporation. All rights reserved.
5 * Contact: David Cohen <david.a.cohen@linux.intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of version 2 of the GNU General
9 * Public License as published by the Free Software Foundation.
10 */
11
12#ifndef __INTEL_MID_WDT_H__
13#define __INTEL_MID_WDT_H__
14
15#include <linux/platform_device.h>
16
17struct intel_mid_wdt_pdata {
18 int irq;
19 int (*probe)(struct platform_device *pdev);
20};
21
22#endif /*__INTEL_MID_WDT_H__*/
diff --git a/include/linux/platform_data/leds-pca9685.h b/include/linux/platform_data/leds-pca9685.h
deleted file mode 100644
index 778e9e4249cc..000000000000
--- a/include/linux/platform_data/leds-pca9685.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Copyright 2013 Maximilian Güntner <maximilian.guentner@gmail.com>
3 *
4 * This file is subject to the terms and conditions of version 2 of
5 * the GNU General Public License. See the file COPYING in the main
6 * directory of this archive for more details.
7 *
8 * Based on leds-pca963x.h by Peter Meerwald <p.meerwald@bct-electronic.com>
9 *
10 * LED driver for the NXP PCA9685 PWM chip
11 *
12 */
13
14#ifndef __LINUX_PCA9685_H
15#define __LINUX_PCA9685_H
16
17#include <linux/leds.h>
18
19enum pca9685_outdrv {
20 PCA9685_OPEN_DRAIN,
21 PCA9685_TOTEM_POLE,
22};
23
24enum pca9685_inverted {
25 PCA9685_NOT_INVERTED,
26 PCA9685_INVERTED,
27};
28
29struct pca9685_platform_data {
30 struct led_platform_data leds;
31 enum pca9685_outdrv outdrv;
32 enum pca9685_inverted inverted;
33};
34
35#endif /* __LINUX_PCA9685_H */
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 3e9dd6676b97..660c029d694f 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -31,6 +31,8 @@ enum omap_ecc {
31 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW, 31 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
32 /* 8-bit ECC calculation by GPMC, Error detection by ELM */ 32 /* 8-bit ECC calculation by GPMC, Error detection by ELM */
33 OMAP_ECC_BCH8_CODE_HW, 33 OMAP_ECC_BCH8_CODE_HW,
34 /* 16-bit ECC calculation by GPMC, Error detection by ELM */
35 OMAP_ECC_BCH16_CODE_HW,
34}; 36};
35 37
36struct gpmc_nand_regs { 38struct gpmc_nand_regs {
@@ -50,6 +52,9 @@ struct gpmc_nand_regs {
50 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER]; 52 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
51 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER]; 53 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
52 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER]; 54 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
55 void __iomem *gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER];
56 void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
57 void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
53}; 58};
54 59
55struct omap_nand_platform_data { 60struct omap_nand_platform_data {
diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h
index a94147124929..ac4ea2e641c7 100644
--- a/include/linux/platform_data/mtd-nand-pxa3xx.h
+++ b/include/linux/platform_data/mtd-nand-pxa3xx.h
@@ -58,6 +58,9 @@ struct pxa3xx_nand_platform_data {
58 /* use an flash-based bad block table */ 58 /* use an flash-based bad block table */
59 bool flash_bbt; 59 bool flash_bbt;
60 60
61 /* requested ECC strength and ECC step size */
62 int ecc_strength, ecc_step_size;
63
61 const struct mtd_partition *parts[NUM_CHIP_SELECT]; 64 const struct mtd_partition *parts[NUM_CHIP_SELECT];
62 unsigned int nr_parts[NUM_CHIP_SELECT]; 65 unsigned int nr_parts[NUM_CHIP_SELECT];
63 66
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h
deleted file mode 100644
index 4eef5fb05a17..000000000000
--- a/include/linux/platform_data/omap4-keypad.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __LINUX_INPUT_OMAP4_KEYPAD_H
2#define __LINUX_INPUT_OMAP4_KEYPAD_H
3
4#include <linux/input/matrix_keypad.h>
5
6struct omap4_keypad_platform_data {
7 const struct matrix_keymap_data *keymap_data;
8
9 u8 rows;
10 u8 cols;
11};
12
13#endif /* __LINUX_INPUT_OMAP4_KEYPAD_H */
diff --git a/include/linux/platform_data/pwm-renesas-tpu.h b/include/linux/platform_data/pwm-renesas-tpu.h
deleted file mode 100644
index a7220b10ddab..000000000000
--- a/include/linux/platform_data/pwm-renesas-tpu.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __PWM_RENESAS_TPU_H__
2#define __PWM_RENESAS_TPU_H__
3
4#include <linux/pwm.h>
5
6#define TPU_CHANNEL_MAX 4
7
8struct tpu_pwm_channel_data {
9 enum pwm_polarity polarity;
10};
11
12struct tpu_pwm_platform_data {
13 struct tpu_pwm_channel_data channels[TPU_CHANNEL_MAX];
14};
15
16#endif /* __PWM_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/shtc1.h b/include/linux/platform_data/shtc1.h
new file mode 100644
index 000000000000..7b8c353f7dc8
--- /dev/null
+++ b/include/linux/platform_data/shtc1.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2014 Sensirion AG, Switzerland
3 * Author: Johannes Winkelmann <johannes.winkelmann@sensirion.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __SHTC1_H_
17#define __SHTC1_H_
18
19struct shtc1_platform_data {
20 bool blocking_io;
21 bool high_precision;
22};
23#endif /* __SHTC1_H_ */
diff --git a/include/linux/platform_data/st21nfca.h b/include/linux/platform_data/st21nfca.h
new file mode 100644
index 000000000000..1730312398ff
--- /dev/null
+++ b/include/linux/platform_data/st21nfca.h
@@ -0,0 +1,32 @@
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_irq;
28 unsigned int gpio_ena;
29 unsigned int irq_polarity;
30};
31
32#endif /* _ST21NFCA_HCI_H_ */
diff --git a/include/linux/profile.h b/include/linux/profile.h
index aaad3861beb8..b537a25ffa17 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -44,6 +44,7 @@ extern int prof_on __read_mostly;
44int profile_init(void); 44int profile_init(void);
45int profile_setup(char *str); 45int profile_setup(char *str);
46void profile_tick(int type); 46void profile_tick(int type);
47int setup_profiling_timer(unsigned int multiplier);
47 48
48/* 49/*
49 * Add multiple profiler hits to a given address: 50 * Add multiple profiler hits to a given address:
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 077904c8b70d..cc79eff4a1ad 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -334,6 +334,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
334 * calling arch_ptrace_stop() when it would be superfluous. For example, 334 * calling arch_ptrace_stop() when it would be superfluous. For example,
335 * if the thread has not been back to user mode since the last stop, the 335 * if the thread has not been back to user mode since the last stop, the
336 * thread state might indicate that nothing needs to be done. 336 * thread state might indicate that nothing needs to be done.
337 *
338 * This is guaranteed to be invoked once before a task stops for ptrace and
339 * may include arch-specific operations necessary prior to a ptrace stop.
337 */ 340 */
338#define arch_ptrace_stop_needed(code, info) (0) 341#define arch_ptrace_stop_needed(code, info) (0)
339#endif 342#endif
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 4717f54051cb..e90628cac8fa 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -274,14 +274,18 @@ struct pwm_lookup {
274 unsigned int index; 274 unsigned int index;
275 const char *dev_id; 275 const char *dev_id;
276 const char *con_id; 276 const char *con_id;
277 unsigned int period;
278 enum pwm_polarity polarity;
277}; 279};
278 280
279#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id) \ 281#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id, _period, _polarity) \
280 { \ 282 { \
281 .provider = _provider, \ 283 .provider = _provider, \
282 .index = _index, \ 284 .index = _index, \
283 .dev_id = _dev_id, \ 285 .dev_id = _dev_id, \
284 .con_id = _con_id, \ 286 .con_id = _con_id, \
287 .period = _period, \
288 .polarity = _polarity \
285 } 289 }
286 290
287#if IS_ENABLED(CONFIG_PWM) 291#if IS_ENABLED(CONFIG_PWM)
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 2de2e275b2cb..efdd9227a49c 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -6,9 +6,6 @@
6 6
7#include <linux/backlight.h> 7#include <linux/backlight.h>
8 8
9/* TODO: convert to gpiod_*() API once it has been merged */
10#define PWM_BACKLIGHT_GPIO_ACTIVE_LOW (1 << 0)
11
12struct platform_pwm_backlight_data { 9struct platform_pwm_backlight_data {
13 int pwm_id; 10 int pwm_id;
14 unsigned int max_brightness; 11 unsigned int max_brightness;
@@ -16,8 +13,8 @@ struct platform_pwm_backlight_data {
16 unsigned int lth_brightness; 13 unsigned int lth_brightness;
17 unsigned int pwm_period_ns; 14 unsigned int pwm_period_ns;
18 unsigned int *levels; 15 unsigned int *levels;
16 /* TODO remove once all users are switched to gpiod_* API */
19 int enable_gpio; 17 int enable_gpio;
20 unsigned long enable_gpio_flags;
21 int (*init)(struct device *dev); 18 int (*init)(struct device *dev);
22 int (*notify)(struct device *dev, int brightness); 19 int (*notify)(struct device *dev, int brightness);
23 void (*notify_after)(struct device *dev, int brightness); 20 void (*notify_after)(struct device *dev, int brightness);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index cc7494a35429..0f3c5d38da1f 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -329,6 +329,7 @@ struct quotactl_ops {
329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
330 int (*set_xstate)(struct super_block *, unsigned int, int); 330 int (*set_xstate)(struct super_block *, unsigned int, int);
331 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *); 331 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
332 int (*rm_xquota)(struct super_block *, unsigned int);
332}; 333};
333 334
334struct quota_format_type { 335struct quota_format_type {
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 5a75d19aa661..d231aa17b1d7 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -44,7 +44,6 @@
44#include <linux/debugobjects.h> 44#include <linux/debugobjects.h>
45#include <linux/bug.h> 45#include <linux/bug.h>
46#include <linux/compiler.h> 46#include <linux/compiler.h>
47#include <linux/percpu.h>
48#include <asm/barrier.h> 47#include <asm/barrier.h>
49 48
50extern int rcu_expedited; /* for sysctl */ 49extern int rcu_expedited; /* for sysctl */
@@ -300,41 +299,6 @@ bool __rcu_is_watching(void);
300#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 299#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
301 300
302/* 301/*
303 * Hooks for cond_resched() and friends to avoid RCU CPU stall warnings.
304 */
305
306#define RCU_COND_RESCHED_LIM 256 /* ms vs. 100s of ms. */
307DECLARE_PER_CPU(int, rcu_cond_resched_count);
308void rcu_resched(void);
309
310/*
311 * Is it time to report RCU quiescent states?
312 *
313 * Note unsynchronized access to rcu_cond_resched_count. Yes, we might
314 * increment some random CPU's count, and possibly also load the result from
315 * yet another CPU's count. We might even clobber some other CPU's attempt
316 * to zero its counter. This is all OK because the goal is not precision,
317 * but rather reasonable amortization of rcu_note_context_switch() overhead
318 * and extremely high probability of avoiding RCU CPU stall warnings.
319 * Note that this function has to be preempted in just the wrong place,
320 * many thousands of times in a row, for anything bad to happen.
321 */
322static inline bool rcu_should_resched(void)
323{
324 return raw_cpu_inc_return(rcu_cond_resched_count) >=
325 RCU_COND_RESCHED_LIM;
326}
327
328/*
329 * Report quiscent states to RCU if it is time to do so.
330 */
331static inline void rcu_cond_resched(void)
332{
333 if (unlikely(rcu_should_resched()))
334 rcu_resched();
335}
336
337/*
338 * Infrastructure to implement the synchronize_() primitives in 302 * Infrastructure to implement the synchronize_() primitives in
339 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 303 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
340 */ 304 */
@@ -358,9 +322,19 @@ void wait_rcu_gp(call_rcu_func_t crf);
358 * initialization. 322 * initialization.
359 */ 323 */
360#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD 324#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
325void init_rcu_head(struct rcu_head *head);
326void destroy_rcu_head(struct rcu_head *head);
361void init_rcu_head_on_stack(struct rcu_head *head); 327void init_rcu_head_on_stack(struct rcu_head *head);
362void destroy_rcu_head_on_stack(struct rcu_head *head); 328void destroy_rcu_head_on_stack(struct rcu_head *head);
363#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 329#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
330static inline void init_rcu_head(struct rcu_head *head)
331{
332}
333
334static inline void destroy_rcu_head(struct rcu_head *head)
335{
336}
337
364static inline void init_rcu_head_on_stack(struct rcu_head *head) 338static inline void init_rcu_head_on_stack(struct rcu_head *head)
365{ 339{
366} 340}
@@ -852,15 +826,14 @@ static inline void rcu_preempt_sleep_check(void)
852 * read-side critical section that would block in a !PREEMPT kernel. 826 * read-side critical section that would block in a !PREEMPT kernel.
853 * But if you want the full story, read on! 827 * But if you want the full story, read on!
854 * 828 *
855 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU), it 829 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU),
856 * is illegal to block while in an RCU read-side critical section. In 830 * it is illegal to block while in an RCU read-side critical section.
857 * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU) 831 * In preemptible RCU implementations (TREE_PREEMPT_RCU) in CONFIG_PREEMPT
858 * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may 832 * kernel builds, RCU read-side critical sections may be preempted,
859 * be preempted, but explicit blocking is illegal. Finally, in preemptible 833 * but explicit blocking is illegal. Finally, in preemptible RCU
860 * RCU implementations in real-time (with -rt patchset) kernel builds, 834 * implementations in real-time (with -rt patchset) kernel builds, RCU
861 * RCU read-side critical sections may be preempted and they may also 835 * read-side critical sections may be preempted and they may also block, but
862 * block, but only when acquiring spinlocks that are subject to priority 836 * only when acquiring spinlocks that are subject to priority inheritance.
863 * inheritance.
864 */ 837 */
865static inline void rcu_read_lock(void) 838static inline void rcu_read_lock(void)
866{ 839{
@@ -884,6 +857,34 @@ static inline void rcu_read_lock(void)
884/** 857/**
885 * rcu_read_unlock() - marks the end of an RCU read-side critical section. 858 * rcu_read_unlock() - marks the end of an RCU read-side critical section.
886 * 859 *
860 * In most situations, rcu_read_unlock() is immune from deadlock.
861 * However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
862 * is responsible for deboosting, which it does via rt_mutex_unlock().
863 * Unfortunately, this function acquires the scheduler's runqueue and
864 * priority-inheritance spinlocks. This means that deadlock could result
865 * if the caller of rcu_read_unlock() already holds one of these locks or
866 * any lock that is ever acquired while holding them.
867 *
868 * That said, RCU readers are never priority boosted unless they were
869 * preempted. Therefore, one way to avoid deadlock is to make sure
870 * that preemption never happens within any RCU read-side critical
871 * section whose outermost rcu_read_unlock() is called with one of
872 * rt_mutex_unlock()'s locks held. Such preemption can be avoided in
873 * a number of ways, for example, by invoking preempt_disable() before
874 * critical section's outermost rcu_read_lock().
875 *
876 * Given that the set of locks acquired by rt_mutex_unlock() might change
877 * at any time, a somewhat more future-proofed approach is to make sure
878 * that that preemption never happens within any RCU read-side critical
879 * section whose outermost rcu_read_unlock() is called with irqs disabled.
880 * This approach relies on the fact that rt_mutex_unlock() currently only
881 * acquires irq-disabled locks.
882 *
883 * The second of these two approaches is best in most situations,
884 * however, the first approach can also be useful, at least to those
885 * developers willing to keep abreast of the set of locks acquired by
886 * rt_mutex_unlock().
887 *
887 * See rcu_read_lock() for more information. 888 * See rcu_read_lock() for more information.
888 */ 889 */
889static inline void rcu_read_unlock(void) 890static inline void rcu_read_unlock(void)
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index a2d9d81038d1..14ec18d5e18b 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -395,6 +395,11 @@ static inline void regulator_bulk_free(int num_consumers,
395{ 395{
396} 396}
397 397
398static inline int regulator_can_change_voltage(struct regulator *regulator)
399{
400 return 0;
401}
402
398static inline int regulator_set_voltage(struct regulator *regulator, 403static inline int regulator_set_voltage(struct regulator *regulator,
399 int min_uV, int max_uV) 404 int min_uV, int max_uV)
400{ 405{
diff --git a/include/linux/rfkill-gpio.h b/include/linux/rfkill-gpio.h
index 4d09f6eab359..20bcb55498cd 100644
--- a/include/linux/rfkill-gpio.h
+++ b/include/linux/rfkill-gpio.h
@@ -27,21 +27,11 @@
27 * struct rfkill_gpio_platform_data - platform data for rfkill gpio device. 27 * struct rfkill_gpio_platform_data - platform data for rfkill gpio device.
28 * for unused gpio's, the expected value is -1. 28 * for unused gpio's, the expected value is -1.
29 * @name: name for the gpio rf kill instance 29 * @name: name for the gpio rf kill instance
30 * @reset_gpio: GPIO which is used for reseting rfkill switch
31 * @shutdown_gpio: GPIO which is used for shutdown of rfkill switch
32 * @power_clk_name: [optional] name of clk to turn off while blocked
33 * @gpio_runtime_close: clean up platform specific gpio configuration
34 * @gpio_runtime_setup: set up platform specific gpio configuration
35 */ 30 */
36 31
37struct rfkill_gpio_platform_data { 32struct rfkill_gpio_platform_data {
38 char *name; 33 char *name;
39 int reset_gpio;
40 int shutdown_gpio;
41 const char *power_clk_name;
42 enum rfkill_type type; 34 enum rfkill_type type;
43 void (*gpio_runtime_close)(struct platform_device *);
44 int (*gpio_runtime_setup)(struct platform_device *);
45}; 35};
46 36
47#endif /* __RFKILL_GPIO_H */ 37#endif /* __RFKILL_GPIO_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index d69cf637a15a..49a4d6f59108 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
97 __ring_buffer_alloc((size), (flags), &__key); \ 97 __ring_buffer_alloc((size), (flags), &__key); \
98}) 98})
99 99
100void ring_buffer_wait(struct ring_buffer *buffer, int cpu); 100int ring_buffer_wait(struct ring_buffer *buffer, int cpu);
101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, 101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
102 struct file *filp, poll_table *poll_table); 102 struct file *filp, poll_table *poll_table);
103 103
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 3aed8d737e1a..1abba5ce2a2f 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -90,11 +90,9 @@ extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
90extern void rt_mutex_destroy(struct rt_mutex *lock); 90extern void rt_mutex_destroy(struct rt_mutex *lock);
91 91
92extern void rt_mutex_lock(struct rt_mutex *lock); 92extern void rt_mutex_lock(struct rt_mutex *lock);
93extern int rt_mutex_lock_interruptible(struct rt_mutex *lock, 93extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
94 int detect_deadlock);
95extern int rt_mutex_timed_lock(struct rt_mutex *lock, 94extern int rt_mutex_timed_lock(struct rt_mutex *lock,
96 struct hrtimer_sleeper *timeout, 95 struct hrtimer_sleeper *timeout);
97 int detect_deadlock);
98 96
99extern int rt_mutex_trylock(struct rt_mutex *lock); 97extern int rt_mutex_trylock(struct rt_mutex *lock);
100 98
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index d5b13bc07a0b..561e8615528d 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -15,13 +15,13 @@
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16/* 16/*
17 * the rw-semaphore definition 17 * the rw-semaphore definition
18 * - if activity is 0 then there are no active readers or writers 18 * - if count is 0 then there are no active readers or writers
19 * - if activity is +ve then that is the number of active readers 19 * - if count is +ve then that is the number of active readers
20 * - if activity is -1 then there is one active writer 20 * - if count is -1 then there is one active writer
21 * - if wait_list is not empty, then there are processes waiting for the semaphore 21 * - if wait_list is not empty, then there are processes waiting for the semaphore
22 */ 22 */
23struct rw_semaphore { 23struct rw_semaphore {
24 __s32 activity; 24 __s32 count;
25 raw_spinlock_t wait_lock; 25 raw_spinlock_t wait_lock;
26 struct list_head wait_list; 26 struct list_head wait_list;
27#ifdef CONFIG_DEBUG_LOCK_ALLOC 27#ifdef CONFIG_DEBUG_LOCK_ALLOC
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 03f3b05e8ec1..035d3c57fc8a 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -13,8 +13,10 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16
17#include <linux/atomic.h> 16#include <linux/atomic.h>
17#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
18#include <linux/osq_lock.h>
19#endif
18 20
19struct rw_semaphore; 21struct rw_semaphore;
20 22
@@ -23,9 +25,17 @@ struct rw_semaphore;
23#else 25#else
24/* All arch specific implementations share the same struct */ 26/* All arch specific implementations share the same struct */
25struct rw_semaphore { 27struct rw_semaphore {
26 long count; 28 long count;
27 raw_spinlock_t wait_lock; 29 struct list_head wait_list;
28 struct list_head wait_list; 30 raw_spinlock_t wait_lock;
31#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
32 struct optimistic_spin_queue osq; /* spinner MCS lock */
33 /*
34 * Write owner. Used as a speculative check to see
35 * if the owner is running on the cpu.
36 */
37 struct task_struct *owner;
38#endif
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 39#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lockdep_map dep_map; 40 struct lockdep_map dep_map;
31#endif 41#endif
@@ -55,10 +65,17 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem)
55# define __RWSEM_DEP_MAP_INIT(lockname) 65# define __RWSEM_DEP_MAP_INIT(lockname)
56#endif 66#endif
57 67
58#define __RWSEM_INITIALIZER(name) \ 68#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
59 { RWSEM_UNLOCKED_VALUE, \ 69#define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED, .owner = NULL
60 __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ 70#else
61 LIST_HEAD_INIT((name).wait_list) \ 71#define __RWSEM_OPT_INIT(lockname)
72#endif
73
74#define __RWSEM_INITIALIZER(name) \
75 { .count = RWSEM_UNLOCKED_VALUE, \
76 .wait_list = LIST_HEAD_INIT((name).wait_list), \
77 .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock) \
78 __RWSEM_OPT_INIT(name) \
62 __RWSEM_DEP_MAP_INIT(name) } 79 __RWSEM_DEP_MAP_INIT(name) }
63 80
64#define DECLARE_RWSEM(name) \ 81#define DECLARE_RWSEM(name) \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ea74596014a2..42cac4dc2157 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -847,10 +847,10 @@ enum cpu_idle_type {
847}; 847};
848 848
849/* 849/*
850 * Increase resolution of cpu_power calculations 850 * Increase resolution of cpu_capacity calculations
851 */ 851 */
852#define SCHED_POWER_SHIFT 10 852#define SCHED_CAPACITY_SHIFT 10
853#define SCHED_POWER_SCALE (1L << SCHED_POWER_SHIFT) 853#define SCHED_CAPACITY_SCALE (1L << SCHED_CAPACITY_SHIFT)
854 854
855/* 855/*
856 * sched-domains (multiprocessor balancing) declarations: 856 * sched-domains (multiprocessor balancing) declarations:
@@ -862,7 +862,7 @@ enum cpu_idle_type {
862#define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */ 862#define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */
863#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */ 863#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */
864#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ 864#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
865#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ 865#define SD_SHARE_CPUCAPACITY 0x0080 /* Domain members share cpu power */
866#define SD_SHARE_POWERDOMAIN 0x0100 /* Domain members share power domain */ 866#define SD_SHARE_POWERDOMAIN 0x0100 /* Domain members share power domain */
867#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 867#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
868#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 868#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
@@ -872,21 +872,21 @@ enum cpu_idle_type {
872#define SD_NUMA 0x4000 /* cross-node balancing */ 872#define SD_NUMA 0x4000 /* cross-node balancing */
873 873
874#ifdef CONFIG_SCHED_SMT 874#ifdef CONFIG_SCHED_SMT
875static inline const int cpu_smt_flags(void) 875static inline int cpu_smt_flags(void)
876{ 876{
877 return SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES; 877 return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES;
878} 878}
879#endif 879#endif
880 880
881#ifdef CONFIG_SCHED_MC 881#ifdef CONFIG_SCHED_MC
882static inline const int cpu_core_flags(void) 882static inline int cpu_core_flags(void)
883{ 883{
884 return SD_SHARE_PKG_RESOURCES; 884 return SD_SHARE_PKG_RESOURCES;
885} 885}
886#endif 886#endif
887 887
888#ifdef CONFIG_NUMA 888#ifdef CONFIG_NUMA
889static inline const int cpu_numa_flags(void) 889static inline int cpu_numa_flags(void)
890{ 890{
891 return SD_NUMA; 891 return SD_NUMA;
892} 892}
@@ -999,14 +999,14 @@ void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
999bool cpus_share_cache(int this_cpu, int that_cpu); 999bool cpus_share_cache(int this_cpu, int that_cpu);
1000 1000
1001typedef const struct cpumask *(*sched_domain_mask_f)(int cpu); 1001typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
1002typedef const int (*sched_domain_flags_f)(void); 1002typedef int (*sched_domain_flags_f)(void);
1003 1003
1004#define SDTL_OVERLAP 0x01 1004#define SDTL_OVERLAP 0x01
1005 1005
1006struct sd_data { 1006struct sd_data {
1007 struct sched_domain **__percpu sd; 1007 struct sched_domain **__percpu sd;
1008 struct sched_group **__percpu sg; 1008 struct sched_group **__percpu sg;
1009 struct sched_group_power **__percpu sgp; 1009 struct sched_group_capacity **__percpu sgc;
1010}; 1010};
1011 1011
1012struct sched_domain_topology_level { 1012struct sched_domain_topology_level {
@@ -1270,9 +1270,6 @@ struct task_struct {
1270#ifdef CONFIG_TREE_PREEMPT_RCU 1270#ifdef CONFIG_TREE_PREEMPT_RCU
1271 struct rcu_node *rcu_blocked_node; 1271 struct rcu_node *rcu_blocked_node;
1272#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 1272#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1273#ifdef CONFIG_RCU_BOOST
1274 struct rt_mutex *rcu_boost_mutex;
1275#endif /* #ifdef CONFIG_RCU_BOOST */
1276 1273
1277#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1274#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1278 struct sched_info sched_info; 1275 struct sched_info sched_info;
@@ -1440,8 +1437,6 @@ struct task_struct {
1440 struct rb_node *pi_waiters_leftmost; 1437 struct rb_node *pi_waiters_leftmost;
1441 /* Deadlock detection and priority inheritance handling */ 1438 /* Deadlock detection and priority inheritance handling */
1442 struct rt_mutex_waiter *pi_blocked_on; 1439 struct rt_mutex_waiter *pi_blocked_on;
1443 /* Top pi_waiters task */
1444 struct task_struct *pi_top_task;
1445#endif 1440#endif
1446 1441
1447#ifdef CONFIG_DEBUG_MUTEXES 1442#ifdef CONFIG_DEBUG_MUTEXES
@@ -2009,9 +2004,6 @@ static inline void rcu_copy_process(struct task_struct *p)
2009#ifdef CONFIG_TREE_PREEMPT_RCU 2004#ifdef CONFIG_TREE_PREEMPT_RCU
2010 p->rcu_blocked_node = NULL; 2005 p->rcu_blocked_node = NULL;
2011#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 2006#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
2012#ifdef CONFIG_RCU_BOOST
2013 p->rcu_boost_mutex = NULL;
2014#endif /* #ifdef CONFIG_RCU_BOOST */
2015 INIT_LIST_HEAD(&p->rcu_node_entry); 2007 INIT_LIST_HEAD(&p->rcu_node_entry);
2016} 2008}
2017 2009
@@ -2173,7 +2165,7 @@ static inline void sched_autogroup_fork(struct signal_struct *sig) { }
2173static inline void sched_autogroup_exit(struct signal_struct *sig) { } 2165static inline void sched_autogroup_exit(struct signal_struct *sig) { }
2174#endif 2166#endif
2175 2167
2176extern bool yield_to(struct task_struct *p, bool preempt); 2168extern int yield_to(struct task_struct *p, bool preempt);
2177extern void set_user_nice(struct task_struct *p, long nice); 2169extern void set_user_nice(struct task_struct *p, long nice);
2178extern int task_prio(const struct task_struct *p); 2170extern int task_prio(const struct task_struct *p);
2179/** 2171/**
@@ -2421,7 +2413,11 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, i
2421struct task_struct *fork_idle(int); 2413struct task_struct *fork_idle(int);
2422extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2414extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2423 2415
2424extern void set_task_comm(struct task_struct *tsk, const char *from); 2416extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec);
2417static inline void set_task_comm(struct task_struct *tsk, const char *from)
2418{
2419 __set_task_comm(tsk, from, false);
2420}
2425extern char *get_task_comm(char *to, struct task_struct *tsk); 2421extern char *get_task_comm(char *to, struct task_struct *tsk);
2426 2422
2427#ifdef CONFIG_SMP 2423#ifdef CONFIG_SMP
@@ -2784,7 +2780,7 @@ static inline bool __must_check current_set_polling_and_test(void)
2784 2780
2785 /* 2781 /*
2786 * Polling state must be visible before we test NEED_RESCHED, 2782 * Polling state must be visible before we test NEED_RESCHED,
2787 * paired by resched_task() 2783 * paired by resched_curr()
2788 */ 2784 */
2789 smp_mb__after_atomic(); 2785 smp_mb__after_atomic();
2790 2786
@@ -2802,7 +2798,7 @@ static inline bool __must_check current_clr_polling_and_test(void)
2802 2798
2803 /* 2799 /*
2804 * Polling state must be visible before we test NEED_RESCHED, 2800 * Polling state must be visible before we test NEED_RESCHED,
2805 * paired by resched_task() 2801 * paired by resched_curr()
2806 */ 2802 */
2807 smp_mb__after_atomic(); 2803 smp_mb__after_atomic();
2808 2804
@@ -2834,7 +2830,7 @@ static inline void current_clr_polling(void)
2834 * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also 2830 * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also
2835 * fold. 2831 * fold.
2836 */ 2832 */
2837 smp_mb(); /* paired with resched_task() */ 2833 smp_mb(); /* paired with resched_curr() */
2838 2834
2839 preempt_fold_need_resched(); 2835 preempt_fold_need_resched();
2840} 2836}
diff --git a/include/linux/security.h b/include/linux/security.h
index 6478ce3252c7..9c6b9722ff48 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1708,7 +1708,7 @@ struct security_operations {
1708 void (*key_free) (struct key *key); 1708 void (*key_free) (struct key *key);
1709 int (*key_permission) (key_ref_t key_ref, 1709 int (*key_permission) (key_ref_t key_ref,
1710 const struct cred *cred, 1710 const struct cred *cred,
1711 key_perm_t perm); 1711 unsigned perm);
1712 int (*key_getsecurity)(struct key *key, char **_buffer); 1712 int (*key_getsecurity)(struct key *key, char **_buffer);
1713#endif /* CONFIG_KEYS */ 1713#endif /* CONFIG_KEYS */
1714 1714
@@ -3034,7 +3034,7 @@ static inline int security_path_chroot(struct path *path)
3034int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags); 3034int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags);
3035void security_key_free(struct key *key); 3035void security_key_free(struct key *key);
3036int security_key_permission(key_ref_t key_ref, 3036int security_key_permission(key_ref_t key_ref,
3037 const struct cred *cred, key_perm_t perm); 3037 const struct cred *cred, unsigned perm);
3038int security_key_getsecurity(struct key *key, char **_buffer); 3038int security_key_getsecurity(struct key *key, char **_buffer);
3039 3039
3040#else 3040#else
@@ -3052,7 +3052,7 @@ static inline void security_key_free(struct key *key)
3052 3052
3053static inline int security_key_permission(key_ref_t key_ref, 3053static inline int security_key_permission(key_ref_t key_ref,
3054 const struct cred *cred, 3054 const struct cred *cred,
3055 key_perm_t perm) 3055 unsigned perm)
3056{ 3056{
3057 return 0; 3057 return 0;
3058} 3058}
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 535f158977b9..8cf350325dc6 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -164,8 +164,6 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
164static inline unsigned raw_seqcount_begin(const seqcount_t *s) 164static inline unsigned raw_seqcount_begin(const seqcount_t *s)
165{ 165{
166 unsigned ret = ACCESS_ONCE(s->sequence); 166 unsigned ret = ACCESS_ONCE(s->sequence);
167
168 seqcount_lockdep_reader_access(s);
169 smp_rmb(); 167 smp_rmb();
170 return ret & ~1; 168 return ret & ~1;
171} 169}
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index f92c0a43c54c..abdf1f229dc3 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -54,6 +54,7 @@ struct shdma_desc {
54 dma_cookie_t cookie; 54 dma_cookie_t cookie;
55 int chunks; 55 int chunks;
56 int mark; 56 int mark;
57 bool cyclic; /* used as cyclic transfer */
57}; 58};
58 59
59struct shdma_chan { 60struct shdma_chan {
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 08074a810164..ec89301ada41 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -338,13 +338,18 @@ enum {
338 338
339 SKB_GSO_GRE = 1 << 6, 339 SKB_GSO_GRE = 1 << 6,
340 340
341 SKB_GSO_IPIP = 1 << 7, 341 SKB_GSO_GRE_CSUM = 1 << 7,
342 342
343 SKB_GSO_SIT = 1 << 8, 343 SKB_GSO_IPIP = 1 << 8,
344 344
345 SKB_GSO_UDP_TUNNEL = 1 << 9, 345 SKB_GSO_SIT = 1 << 9,
346
347 SKB_GSO_UDP_TUNNEL = 1 << 10,
348
349 SKB_GSO_UDP_TUNNEL_CSUM = 1 << 11,
350
351 SKB_GSO_MPLS = 1 << 12,
346 352
347 SKB_GSO_MPLS = 1 << 10,
348}; 353};
349 354
350#if BITS_PER_LONG > 32 355#if BITS_PER_LONG > 32
@@ -426,7 +431,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
426 * @csum_start: Offset from skb->head where checksumming should start 431 * @csum_start: Offset from skb->head where checksumming should start
427 * @csum_offset: Offset from csum_start where checksum should be stored 432 * @csum_offset: Offset from csum_start where checksum should be stored
428 * @priority: Packet queueing priority 433 * @priority: Packet queueing priority
429 * @local_df: allow local fragmentation 434 * @ignore_df: allow local fragmentation
430 * @cloned: Head may be cloned (check refcnt to be sure) 435 * @cloned: Head may be cloned (check refcnt to be sure)
431 * @ip_summed: Driver fed us an IP checksum 436 * @ip_summed: Driver fed us an IP checksum
432 * @nohdr: Payload reference only, must not modify header 437 * @nohdr: Payload reference only, must not modify header
@@ -514,7 +519,7 @@ struct sk_buff {
514 }; 519 };
515 __u32 priority; 520 __u32 priority;
516 kmemcheck_bitfield_begin(flags1); 521 kmemcheck_bitfield_begin(flags1);
517 __u8 local_df:1, 522 __u8 ignore_df:1,
518 cloned:1, 523 cloned:1,
519 ip_summed:2, 524 ip_summed:2,
520 nohdr:1, 525 nohdr:1,
@@ -567,7 +572,10 @@ struct sk_buff {
567 * headers if needed 572 * headers if needed
568 */ 573 */
569 __u8 encapsulation:1; 574 __u8 encapsulation:1;
570 /* 6/8 bit hole (depending on ndisc_nodetype presence) */ 575 __u8 encap_hdr_csum:1;
576 __u8 csum_valid:1;
577 __u8 csum_complete_sw:1;
578 /* 3/5 bit hole (depending on ndisc_nodetype presence) */
571 kmemcheck_bitfield_end(flags2); 579 kmemcheck_bitfield_end(flags2);
572 580
573#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 581#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -739,7 +747,13 @@ struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
739int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); 747int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
740struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); 748struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
741struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority); 749struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
742struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask); 750struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
751 gfp_t gfp_mask, bool fclone);
752static inline struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom,
753 gfp_t gfp_mask)
754{
755 return __pskb_copy_fclone(skb, headroom, gfp_mask, false);
756}
743 757
744int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask); 758int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask);
745struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 759struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
@@ -1840,6 +1854,18 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1840 return pskb_may_pull(skb, skb_network_offset(skb) + len); 1854 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1841} 1855}
1842 1856
1857static inline void skb_pop_rcv_encapsulation(struct sk_buff *skb)
1858{
1859 /* Only continue with checksum unnecessary if device indicated
1860 * it is valid across encapsulation (skb->encapsulation was set).
1861 */
1862 if (skb->ip_summed == CHECKSUM_UNNECESSARY && !skb->encapsulation)
1863 skb->ip_summed = CHECKSUM_NONE;
1864
1865 skb->encapsulation = 0;
1866 skb->csum_valid = 0;
1867}
1868
1843/* 1869/*
1844 * CPUs often take a performance hit when accessing unaligned memory 1870 * CPUs often take a performance hit when accessing unaligned memory
1845 * locations. The actual performance hit varies, it can be small if the 1871 * locations. The actual performance hit varies, it can be small if the
@@ -2233,6 +2259,14 @@ static inline struct sk_buff *pskb_copy(struct sk_buff *skb,
2233 return __pskb_copy(skb, skb_headroom(skb), gfp_mask); 2259 return __pskb_copy(skb, skb_headroom(skb), gfp_mask);
2234} 2260}
2235 2261
2262
2263static inline struct sk_buff *pskb_copy_for_clone(struct sk_buff *skb,
2264 gfp_t gfp_mask)
2265{
2266 return __pskb_copy_fclone(skb, skb_headroom(skb), gfp_mask, true);
2267}
2268
2269
2236/** 2270/**
2237 * skb_clone_writable - is the header of a clone writable 2271 * skb_clone_writable - is the header of a clone writable
2238 * @skb: buffer to check 2272 * @skb: buffer to check
@@ -2716,7 +2750,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb);
2716 2750
2717static inline int skb_csum_unnecessary(const struct sk_buff *skb) 2751static inline int skb_csum_unnecessary(const struct sk_buff *skb)
2718{ 2752{
2719 return skb->ip_summed & CHECKSUM_UNNECESSARY; 2753 return ((skb->ip_summed & CHECKSUM_UNNECESSARY) || skb->csum_valid);
2720} 2754}
2721 2755
2722/** 2756/**
@@ -2741,6 +2775,103 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2741 0 : __skb_checksum_complete(skb); 2775 0 : __skb_checksum_complete(skb);
2742} 2776}
2743 2777
2778/* Check if we need to perform checksum complete validation.
2779 *
2780 * Returns true if checksum complete is needed, false otherwise
2781 * (either checksum is unnecessary or zero checksum is allowed).
2782 */
2783static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
2784 bool zero_okay,
2785 __sum16 check)
2786{
2787 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) {
2788 skb->csum_valid = 1;
2789 return false;
2790 }
2791
2792 return true;
2793}
2794
2795/* For small packets <= CHECKSUM_BREAK peform checksum complete directly
2796 * in checksum_init.
2797 */
2798#define CHECKSUM_BREAK 76
2799
2800/* Validate (init) checksum based on checksum complete.
2801 *
2802 * Return values:
2803 * 0: checksum is validated or try to in skb_checksum_complete. In the latter
2804 * case the ip_summed will not be CHECKSUM_UNNECESSARY and the pseudo
2805 * checksum is stored in skb->csum for use in __skb_checksum_complete
2806 * non-zero: value of invalid checksum
2807 *
2808 */
2809static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
2810 bool complete,
2811 __wsum psum)
2812{
2813 if (skb->ip_summed == CHECKSUM_COMPLETE) {
2814 if (!csum_fold(csum_add(psum, skb->csum))) {
2815 skb->csum_valid = 1;
2816 return 0;
2817 }
2818 }
2819
2820 skb->csum = psum;
2821
2822 if (complete || skb->len <= CHECKSUM_BREAK) {
2823 __sum16 csum;
2824
2825 csum = __skb_checksum_complete(skb);
2826 skb->csum_valid = !csum;
2827 return csum;
2828 }
2829
2830 return 0;
2831}
2832
2833static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
2834{
2835 return 0;
2836}
2837
2838/* Perform checksum validate (init). Note that this is a macro since we only
2839 * want to calculate the pseudo header which is an input function if necessary.
2840 * First we try to validate without any computation (checksum unnecessary) and
2841 * then calculate based on checksum complete calling the function to compute
2842 * pseudo header.
2843 *
2844 * Return values:
2845 * 0: checksum is validated or try to in skb_checksum_complete
2846 * non-zero: value of invalid checksum
2847 */
2848#define __skb_checksum_validate(skb, proto, complete, \
2849 zero_okay, check, compute_pseudo) \
2850({ \
2851 __sum16 __ret = 0; \
2852 skb->csum_valid = 0; \
2853 if (__skb_checksum_validate_needed(skb, zero_okay, check)) \
2854 __ret = __skb_checksum_validate_complete(skb, \
2855 complete, compute_pseudo(skb, proto)); \
2856 __ret; \
2857})
2858
2859#define skb_checksum_init(skb, proto, compute_pseudo) \
2860 __skb_checksum_validate(skb, proto, false, false, 0, compute_pseudo)
2861
2862#define skb_checksum_init_zero_check(skb, proto, check, compute_pseudo) \
2863 __skb_checksum_validate(skb, proto, false, true, check, compute_pseudo)
2864
2865#define skb_checksum_validate(skb, proto, compute_pseudo) \
2866 __skb_checksum_validate(skb, proto, true, false, 0, compute_pseudo)
2867
2868#define skb_checksum_validate_zero_check(skb, proto, check, \
2869 compute_pseudo) \
2870 __skb_checksum_validate_(skb, proto, true, true, check, compute_pseudo)
2871
2872#define skb_checksum_simple_validate(skb) \
2873 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
2874
2744#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2875#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2745void nf_conntrack_destroy(struct nf_conntrack *nfct); 2876void nf_conntrack_destroy(struct nf_conntrack *nfct);
2746static inline void nf_conntrack_put(struct nf_conntrack *nfct) 2877static inline void nf_conntrack_put(struct nf_conntrack *nfct)
@@ -2895,6 +3026,7 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2895struct skb_gso_cb { 3026struct skb_gso_cb {
2896 int mac_offset; 3027 int mac_offset;
2897 int encap_level; 3028 int encap_level;
3029 __u16 csum_start;
2898}; 3030};
2899#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) 3031#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
2900 3032
@@ -2919,6 +3051,28 @@ static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra)
2919 return 0; 3051 return 0;
2920} 3052}
2921 3053
3054/* Compute the checksum for a gso segment. First compute the checksum value
3055 * from the start of transport header to SKB_GSO_CB(skb)->csum_start, and
3056 * then add in skb->csum (checksum from csum_start to end of packet).
3057 * skb->csum and csum_start are then updated to reflect the checksum of the
3058 * resultant packet starting from the transport header-- the resultant checksum
3059 * is in the res argument (i.e. normally zero or ~ of checksum of a pseudo
3060 * header.
3061 */
3062static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res)
3063{
3064 int plen = SKB_GSO_CB(skb)->csum_start - skb_headroom(skb) -
3065 skb_transport_offset(skb);
3066 __u16 csum;
3067
3068 csum = csum_fold(csum_partial(skb_transport_header(skb),
3069 plen, skb->csum));
3070 skb->csum = res;
3071 SKB_GSO_CB(skb)->csum_start -= plen;
3072
3073 return csum;
3074}
3075
2922static inline bool skb_is_gso(const struct sk_buff *skb) 3076static inline bool skb_is_gso(const struct sk_buff *skb)
2923{ 3077{
2924 return skb_shinfo(skb)->gso_size; 3078 return skb_shinfo(skb)->gso_size;
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 8e98297f1388..ec538fc287a6 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -305,8 +305,6 @@ struct ucred {
305/* IPX options */ 305/* IPX options */
306#define IPX_TYPE 1 306#define IPX_TYPE 1
307 307
308extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
309 int offset, int len);
310extern int csum_partial_copy_fromiovecend(unsigned char *kdata, 308extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
311 struct iovec *iov, 309 struct iovec *iov,
312 int offset, 310 int offset,
@@ -315,8 +313,6 @@ extern unsigned long iov_pages(const struct iovec *iov, int offset,
315 unsigned long nr_segs); 313 unsigned long nr_segs);
316 314
317extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); 315extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
318extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
319 int offset, int len);
320extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); 316extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
321extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 317extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
322 318
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h
index aa327a8105ad..b2b1afbb3202 100644
--- a/include/linux/spi/at86rf230.h
+++ b/include/linux/spi/at86rf230.h
@@ -26,20 +26,6 @@ struct at86rf230_platform_data {
26 int rstn; 26 int rstn;
27 int slp_tr; 27 int slp_tr;
28 int dig2; 28 int dig2;
29
30 /* Setting the irq_type will configure the driver to request
31 * the platform irq trigger type according to the given value
32 * and configure the interrupt polarity of the device to the
33 * corresponding polarity.
34 *
35 * Allowed values are: IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING,
36 * IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW
37 *
38 * Setting it to 0, the driver does not touch the trigger type
39 * configuration of the interrupt and sets the interrupt polarity
40 * of the device to high active (the default value).
41 */
42 int irq_type;
43}; 29};
44 30
45#endif 31#endif
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 0e43906d2fda..da2751d3b93d 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -70,16 +70,6 @@ extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
70 splice_actor *); 70 splice_actor *);
71extern ssize_t __splice_from_pipe(struct pipe_inode_info *, 71extern ssize_t __splice_from_pipe(struct pipe_inode_info *,
72 struct splice_desc *, splice_actor *); 72 struct splice_desc *, splice_actor *);
73extern int splice_from_pipe_feed(struct pipe_inode_info *, struct splice_desc *,
74 splice_actor *);
75extern int splice_from_pipe_next(struct pipe_inode_info *,
76 struct splice_desc *);
77extern void splice_from_pipe_begin(struct splice_desc *);
78extern void splice_from_pipe_end(struct pipe_inode_info *,
79 struct splice_desc *);
80extern int pipe_to_file(struct pipe_inode_info *, struct pipe_buffer *,
81 struct splice_desc *);
82
83extern ssize_t splice_to_pipe(struct pipe_inode_info *, 73extern ssize_t splice_to_pipe(struct pipe_inode_info *,
84 struct splice_pipe_desc *); 74 struct splice_pipe_desc *);
85extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, 75extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 07ef9b82b66d..4568a5cc9ab8 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -33,6 +33,7 @@ struct ssb_sprom {
33 u8 et1phyaddr; /* MII address for enet1 */ 33 u8 et1phyaddr; /* MII address for enet1 */
34 u8 et0mdcport; /* MDIO for enet0 */ 34 u8 et0mdcport; /* MDIO for enet0 */
35 u8 et1mdcport; /* MDIO for enet1 */ 35 u8 et1mdcport; /* MDIO for enet1 */
36 u16 dev_id; /* Device ID overriding e.g. PCI ID */
36 u16 board_rev; /* Board revision number from SPROM. */ 37 u16 board_rev; /* Board revision number from SPROM. */
37 u16 board_num; /* Board number from SPROM. */ 38 u16 board_num; /* Board number from SPROM. */
38 u16 board_type; /* Board type from SPROM. */ 39 u16 board_type; /* Board type from SPROM. */
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index ad7dbe2cfecd..1a8959944c5f 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -236,7 +236,7 @@ void * rpc_malloc(struct rpc_task *, size_t);
236void rpc_free(void *); 236void rpc_free(void *);
237int rpciod_up(void); 237int rpciod_up(void);
238void rpciod_down(void); 238void rpciod_down(void);
239int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 239int __rpc_wait_for_completion_task(struct rpc_task *task, wait_bit_action_f *);
240#ifdef RPC_DEBUG 240#ifdef RPC_DEBUG
241struct net; 241struct net;
242void rpc_show_tasks(struct net *); 242void rpc_show_tasks(struct net *);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 04e763221246..1bc7cd05b22e 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -244,6 +244,7 @@ struct svc_rqst {
244 struct page * rq_pages[RPCSVC_MAXPAGES]; 244 struct page * rq_pages[RPCSVC_MAXPAGES];
245 struct page * *rq_respages; /* points into rq_pages */ 245 struct page * *rq_respages; /* points into rq_pages */
246 struct page * *rq_next_page; /* next reply page to use */ 246 struct page * *rq_next_page; /* next reply page to use */
247 struct page * *rq_page_end; /* one past the last page */
247 248
248 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */ 249 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */
249 250
@@ -254,11 +255,15 @@ struct svc_rqst {
254 u32 rq_prot; /* IP protocol */ 255 u32 rq_prot; /* IP protocol */
255 unsigned short 256 unsigned short
256 rq_secure : 1; /* secure port */ 257 rq_secure : 1; /* secure port */
258 unsigned short rq_local : 1; /* local request */
257 259
258 void * rq_argp; /* decoded arguments */ 260 void * rq_argp; /* decoded arguments */
259 void * rq_resp; /* xdr'd results */ 261 void * rq_resp; /* xdr'd results */
260 void * rq_auth_data; /* flavor-specific data */ 262 void * rq_auth_data; /* flavor-specific data */
261 263 int rq_auth_slack; /* extra space xdr code
264 * should leave in head
265 * for krb5i, krb5p.
266 */
262 int rq_reserved; /* space on socket outq 267 int rq_reserved; /* space on socket outq
263 * reserved for this request 268 * reserved for this request
264 */ 269 */
@@ -454,11 +459,7 @@ char * svc_print_addr(struct svc_rqst *, char *, size_t);
454 */ 459 */
455static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space) 460static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space)
456{ 461{
457 int added_space = 0; 462 svc_reserve(rqstp, space + rqstp->rq_auth_slack);
458
459 if (rqstp->rq_authop->flavour)
460 added_space = RPC_MAX_AUTH_SIZE;
461 svc_reserve(rqstp, space + added_space);
462} 463}
463 464
464#endif /* SUNRPC_SVC_H */ 465#endif /* SUNRPC_SVC_H */
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index 0b8e3e6bdacf..5cf99a016368 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -115,14 +115,13 @@ struct svc_rdma_fastreg_mr {
115 struct list_head frmr_list; 115 struct list_head frmr_list;
116}; 116};
117struct svc_rdma_req_map { 117struct svc_rdma_req_map {
118 struct svc_rdma_fastreg_mr *frmr;
119 unsigned long count; 118 unsigned long count;
120 union { 119 union {
121 struct kvec sge[RPCSVC_MAXPAGES]; 120 struct kvec sge[RPCSVC_MAXPAGES];
122 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; 121 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES];
122 unsigned long lkey[RPCSVC_MAXPAGES];
123 }; 123 };
124}; 124};
125#define RDMACTXT_F_FAST_UNREG 1
126#define RDMACTXT_F_LAST_CTXT 2 125#define RDMACTXT_F_LAST_CTXT 2
127 126
128#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */ 127#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index b05963f09ebf..7235040a19b2 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -24,6 +24,7 @@ struct svc_xprt_ops {
24 void (*xpo_release_rqst)(struct svc_rqst *); 24 void (*xpo_release_rqst)(struct svc_rqst *);
25 void (*xpo_detach)(struct svc_xprt *); 25 void (*xpo_detach)(struct svc_xprt *);
26 void (*xpo_free)(struct svc_xprt *); 26 void (*xpo_free)(struct svc_xprt *);
27 int (*xpo_secure_port)(struct svc_rqst *);
27}; 28};
28 29
29struct svc_xprt_class { 30struct svc_xprt_class {
@@ -63,6 +64,7 @@ struct svc_xprt {
63#define XPT_DETACHED 10 /* detached from tempsocks list */ 64#define XPT_DETACHED 10 /* detached from tempsocks list */
64#define XPT_LISTENER 11 /* listening endpoint */ 65#define XPT_LISTENER 11 /* listening endpoint */
65#define XPT_CACHE_AUTH 12 /* cache auth info */ 66#define XPT_CACHE_AUTH 12 /* cache auth info */
67#define XPT_LOCAL 13 /* connection from loopback interface */
66 68
67 struct svc_serv *xpt_server; /* service for transport */ 69 struct svc_serv *xpt_server; /* service for transport */
68 atomic_t xpt_reserved; /* space on outq that is rsvd */ 70 atomic_t xpt_reserved; /* space on outq that is rsvd */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 15f9204ee70b..70c6b92e15a7 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -215,6 +215,9 @@ typedef int (*kxdrdproc_t)(void *rqstp, struct xdr_stream *xdr, void *obj);
215 215
216extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); 216extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
217extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); 217extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
218extern void xdr_commit_encode(struct xdr_stream *xdr);
219extern void xdr_truncate_encode(struct xdr_stream *xdr, size_t len);
220extern int xdr_restrict_buflen(struct xdr_stream *xdr, int newbuflen);
218extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, 221extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
219 unsigned int base, unsigned int len); 222 unsigned int base, unsigned int len);
220extern unsigned int xdr_stream_pos(const struct xdr_stream *xdr); 223extern unsigned int xdr_stream_pos(const struct xdr_stream *xdr);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3876f0f1dfd3..fcbfe8783243 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -24,6 +24,12 @@
24#define RPC_MAX_SLOT_TABLE_LIMIT (65536U) 24#define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
25#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT 25#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT
26 26
27#define RPC_CWNDSHIFT (8U)
28#define RPC_CWNDSCALE (1U << RPC_CWNDSHIFT)
29#define RPC_INITCWND RPC_CWNDSCALE
30#define RPC_MAXCWND(xprt) ((xprt)->max_reqs << RPC_CWNDSHIFT)
31#define RPCXPRT_CONGESTED(xprt) ((xprt)->cong >= (xprt)->cwnd)
32
27/* 33/*
28 * This describes a timeout strategy 34 * This describes a timeout strategy
29 */ 35 */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index f76994b9396c..519064e0c943 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -327,6 +327,7 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
327extern void hibernation_set_ops(const struct platform_hibernation_ops *ops); 327extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
328extern int hibernate(void); 328extern int hibernate(void);
329extern bool system_entering_hibernation(void); 329extern bool system_entering_hibernation(void);
330extern bool hibernation_available(void);
330asmlinkage int swsusp_save(void); 331asmlinkage int swsusp_save(void);
331extern struct pbe *restore_pblist; 332extern struct pbe *restore_pblist;
332#else /* CONFIG_HIBERNATION */ 333#else /* CONFIG_HIBERNATION */
@@ -339,6 +340,7 @@ static inline void swsusp_unset_page_free(struct page *p) {}
339static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {} 340static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {}
340static inline int hibernate(void) { return -ENOSYS; } 341static inline int hibernate(void) { return -ENOSYS; }
341static inline bool system_entering_hibernation(void) { return false; } 342static inline bool system_entering_hibernation(void) { return false; }
343static inline bool hibernation_available(void) { return false; }
342#endif /* CONFIG_HIBERNATION */ 344#endif /* CONFIG_HIBERNATION */
343 345
344/* Hibernation and suspend events */ 346/* Hibernation and suspend events */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 239946868142..a0513210798f 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -197,7 +197,8 @@ struct tcp_sock {
197 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ 197 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
198 syn_data:1, /* SYN includes data */ 198 syn_data:1, /* SYN includes data */
199 syn_fastopen:1, /* SYN includes Fast Open option */ 199 syn_fastopen:1, /* SYN includes Fast Open option */
200 syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ 200 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
201 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
201 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 202 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
202 203
203/* RTT measurement */ 204/* RTT measurement */
@@ -209,6 +210,8 @@ struct tcp_sock {
209 210
210 u32 packets_out; /* Packets which are "in flight" */ 211 u32 packets_out; /* Packets which are "in flight" */
211 u32 retrans_out; /* Retransmitted packets out */ 212 u32 retrans_out; /* Retransmitted packets out */
213 u32 max_packets_out; /* max packets_out in last window */
214 u32 max_packets_seq; /* right edge of max_packets_out flight */
212 215
213 u16 urg_data; /* Saved octet of OOB data and control flags */ 216 u16 urg_data; /* Saved octet of OOB data and control flags */
214 u8 ecn_flags; /* ECN status bits. */ 217 u8 ecn_flags; /* ECN status bits. */
@@ -365,11 +368,6 @@ static inline bool tcp_passive_fastopen(const struct sock *sk)
365 tcp_sk(sk)->fastopen_rsk != NULL); 368 tcp_sk(sk)->fastopen_rsk != NULL);
366} 369}
367 370
368static inline bool fastopen_cookie_present(struct tcp_fastopen_cookie *foc)
369{
370 return foc->len != -1;
371}
372
373extern void tcp_sock_destruct(struct sock *sk); 371extern void tcp_sock_destruct(struct sock *sk);
374 372
375static inline int fastopen_init_queue(struct sock *sk, int backlog) 373static inline int fastopen_init_queue(struct sock *sk, int backlog)
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b84773cb9f4c..059052306831 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -12,6 +12,7 @@
12#include <linux/hrtimer.h> 12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h> 13#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h> 14#include <linux/cpumask.h>
15#include <linux/sched.h>
15 16
16#ifdef CONFIG_GENERIC_CLOCKEVENTS 17#ifdef CONFIG_GENERIC_CLOCKEVENTS
17 18
@@ -162,6 +163,7 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
162#ifdef CONFIG_NO_HZ_FULL 163#ifdef CONFIG_NO_HZ_FULL
163extern bool tick_nohz_full_running; 164extern bool tick_nohz_full_running;
164extern cpumask_var_t tick_nohz_full_mask; 165extern cpumask_var_t tick_nohz_full_mask;
166extern cpumask_var_t housekeeping_mask;
165 167
166static inline bool tick_nohz_full_enabled(void) 168static inline bool tick_nohz_full_enabled(void)
167{ 169{
@@ -181,7 +183,13 @@ static inline bool tick_nohz_full_cpu(int cpu)
181 183
182extern void tick_nohz_init(void); 184extern void tick_nohz_init(void);
183extern void __tick_nohz_full_check(void); 185extern void __tick_nohz_full_check(void);
184extern void tick_nohz_full_kick(void); 186extern void tick_nohz_full_kick_cpu(int cpu);
187
188static inline void tick_nohz_full_kick(void)
189{
190 tick_nohz_full_kick_cpu(smp_processor_id());
191}
192
185extern void tick_nohz_full_kick_all(void); 193extern void tick_nohz_full_kick_all(void);
186extern void __tick_nohz_task_switch(struct task_struct *tsk); 194extern void __tick_nohz_task_switch(struct task_struct *tsk);
187#else 195#else
@@ -189,11 +197,30 @@ static inline void tick_nohz_init(void) { }
189static inline bool tick_nohz_full_enabled(void) { return false; } 197static inline bool tick_nohz_full_enabled(void) { return false; }
190static inline bool tick_nohz_full_cpu(int cpu) { return false; } 198static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void __tick_nohz_full_check(void) { } 199static inline void __tick_nohz_full_check(void) { }
200static inline void tick_nohz_full_kick_cpu(int cpu) { }
192static inline void tick_nohz_full_kick(void) { } 201static inline void tick_nohz_full_kick(void) { }
193static inline void tick_nohz_full_kick_all(void) { } 202static inline void tick_nohz_full_kick_all(void) { }
194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { } 203static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
195#endif 204#endif
196 205
206static inline bool is_housekeeping_cpu(int cpu)
207{
208#ifdef CONFIG_NO_HZ_FULL
209 if (tick_nohz_full_enabled())
210 return cpumask_test_cpu(cpu, housekeeping_mask);
211#endif
212 return true;
213}
214
215static inline void housekeeping_affine(struct task_struct *t)
216{
217#ifdef CONFIG_NO_HZ_FULL
218 if (tick_nohz_full_enabled())
219 set_cpus_allowed_ptr(t, housekeeping_mask);
220
221#endif
222}
223
197static inline void tick_nohz_full_check(void) 224static inline void tick_nohz_full_check(void)
198{ 225{
199 if (tick_nohz_full_enabled()) 226 if (tick_nohz_full_enabled())
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index a32d86ec8bf2..ea6c9dea79e3 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -25,6 +25,21 @@ trace_seq_init(struct trace_seq *s)
25 s->full = 0; 25 s->full = 0;
26} 26}
27 27
28/**
29 * trace_seq_buffer_ptr - return pointer to next location in buffer
30 * @s: trace sequence descriptor
31 *
32 * Returns the pointer to the buffer where the next write to
33 * the buffer will happen. This is useful to save the location
34 * that is about to be written to and then return the result
35 * of that write.
36 */
37static inline unsigned char *
38trace_seq_buffer_ptr(struct trace_seq *s)
39{
40 return s->buffer + s->len;
41}
42
28/* 43/*
29 * Currently only defined when tracing is enabled. 44 * Currently only defined when tracing is enabled.
30 */ 45 */
@@ -36,16 +51,18 @@ int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
36extern int 51extern int
37trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); 52trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
38extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); 53extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
39extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, 54extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
40 size_t cnt); 55 int cnt);
41extern int trace_seq_puts(struct trace_seq *s, const char *str); 56extern int trace_seq_puts(struct trace_seq *s, const char *str);
42extern int trace_seq_putc(struct trace_seq *s, unsigned char c); 57extern int trace_seq_putc(struct trace_seq *s, unsigned char c);
43extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len); 58extern int trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len);
44extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 59extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
45 size_t len); 60 unsigned int len);
46extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
47extern int trace_seq_path(struct trace_seq *s, const struct path *path); 61extern int trace_seq_path(struct trace_seq *s, const struct path *path);
48 62
63extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
64 int nmaskbits);
65
49#else /* CONFIG_TRACING */ 66#else /* CONFIG_TRACING */
50static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) 67static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
51{ 68{
@@ -57,12 +74,19 @@ trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
57 return 0; 74 return 0;
58} 75}
59 76
77static inline int
78trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
79 int nmaskbits)
80{
81 return 0;
82}
83
60static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s) 84static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
61{ 85{
62 return 0; 86 return 0;
63} 87}
64static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, 88static inline int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
65 size_t cnt) 89 int cnt)
66{ 90{
67 return 0; 91 return 0;
68} 92}
@@ -75,19 +99,15 @@ static inline int trace_seq_putc(struct trace_seq *s, unsigned char c)
75 return 0; 99 return 0;
76} 100}
77static inline int 101static inline int
78trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len) 102trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len)
79{ 103{
80 return 0; 104 return 0;
81} 105}
82static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 106static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
83 size_t len) 107 unsigned int len)
84{ 108{
85 return 0; 109 return 0;
86} 110}
87static inline void *trace_seq_reserve(struct trace_seq *s, size_t len)
88{
89 return NULL;
90}
91static inline int trace_seq_path(struct trace_seq *s, const struct path *path) 111static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
92{ 112{
93 return 0; 113 return 0;
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 9d30ee469c2a..2e2a5f7717e5 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -185,6 +185,11 @@ extern void syscall_unregfunc(void);
185 static inline void \ 185 static inline void \
186 check_trace_callback_type_##name(void (*cb)(data_proto)) \ 186 check_trace_callback_type_##name(void (*cb)(data_proto)) \
187 { \ 187 { \
188 } \
189 static inline bool \
190 trace_##name##_enabled(void) \
191 { \
192 return static_key_false(&__tracepoint_##name.key); \
188 } 193 }
189 194
190/* 195/*
@@ -230,6 +235,11 @@ extern void syscall_unregfunc(void);
230 } \ 235 } \
231 static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \ 236 static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
232 { \ 237 { \
238 } \
239 static inline bool \
240 trace_##name##_enabled(void) \
241 { \
242 return false; \
233 } 243 }
234 244
235#define DEFINE_TRACE_FN(name, reg, unreg) 245#define DEFINE_TRACE_FN(name, reg, unreg)
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 42278bbf7a88..247cfdcc4b08 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -47,7 +47,9 @@ struct udp_sock {
47#define udp_portaddr_node inet.sk.__sk_common.skc_portaddr_node 47#define udp_portaddr_node inet.sk.__sk_common.skc_portaddr_node
48 int pending; /* Any pending frames ? */ 48 int pending; /* Any pending frames ? */
49 unsigned int corkflag; /* Cork is required */ 49 unsigned int corkflag; /* Cork is required */
50 __u16 encap_type; /* Is this an Encapsulation socket? */ 50 __u8 encap_type; /* Is this an Encapsulation socket? */
51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
52 no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */
51 /* 53 /*
52 * Following member retains the information to create a UDP header 54 * Following member retains the information to create a UDP header
53 * when the socket is uncorked. 55 * when the socket is uncorked.
@@ -76,6 +78,26 @@ static inline struct udp_sock *udp_sk(const struct sock *sk)
76 return (struct udp_sock *)sk; 78 return (struct udp_sock *)sk;
77} 79}
78 80
81static inline void udp_set_no_check6_tx(struct sock *sk, bool val)
82{
83 udp_sk(sk)->no_check6_tx = val;
84}
85
86static inline void udp_set_no_check6_rx(struct sock *sk, bool val)
87{
88 udp_sk(sk)->no_check6_rx = val;
89}
90
91static inline bool udp_get_no_check6_tx(struct sock *sk)
92{
93 return udp_sk(sk)->no_check6_tx;
94}
95
96static inline bool udp_get_no_check6_rx(struct sock *sk)
97{
98 return udp_sk(sk)->no_check6_rx;
99}
100
79#define udp_portaddr_for_each_entry(__sk, node, list) \ 101#define udp_portaddr_for_each_entry(__sk, node, list) \
80 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) 102 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)
81 103
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 199bcc34241b..09a7cffc224e 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -19,11 +19,21 @@ struct kvec {
19 size_t iov_len; 19 size_t iov_len;
20}; 20};
21 21
22enum {
23 ITER_IOVEC = 0,
24 ITER_KVEC = 2,
25 ITER_BVEC = 4,
26};
27
22struct iov_iter { 28struct iov_iter {
23 const struct iovec *iov; 29 int type;
24 unsigned long nr_segs;
25 size_t iov_offset; 30 size_t iov_offset;
26 size_t count; 31 size_t count;
32 union {
33 const struct iovec *iov;
34 const struct bio_vec *bvec;
35 };
36 unsigned long nr_segs;
27}; 37};
28 38
29/* 39/*
@@ -53,6 +63,7 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
53} 63}
54 64
55#define iov_for_each(iov, iter, start) \ 65#define iov_for_each(iov, iter, start) \
66 if (!((start).type & ITER_BVEC)) \
56 for (iter = (start); \ 67 for (iter = (start); \
57 (iter).count && \ 68 (iter).count && \
58 ((iov = iov_iter_iovec(&(iter))), 1); \ 69 ((iov = iov_iter_iovec(&(iter))), 1); \
@@ -62,32 +73,59 @@ unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
62 73
63size_t iov_iter_copy_from_user_atomic(struct page *page, 74size_t iov_iter_copy_from_user_atomic(struct page *page,
64 struct iov_iter *i, unsigned long offset, size_t bytes); 75 struct iov_iter *i, unsigned long offset, size_t bytes);
65size_t iov_iter_copy_from_user(struct page *page,
66 struct iov_iter *i, unsigned long offset, size_t bytes);
67void iov_iter_advance(struct iov_iter *i, size_t bytes); 76void iov_iter_advance(struct iov_iter *i, size_t bytes);
68int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); 77int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
69size_t iov_iter_single_seg_count(const struct iov_iter *i); 78size_t iov_iter_single_seg_count(const struct iov_iter *i);
70size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, 79size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
71 struct iov_iter *i); 80 struct iov_iter *i);
81size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes,
82 struct iov_iter *i);
83unsigned long iov_iter_alignment(const struct iov_iter *i);
84void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
85 unsigned long nr_segs, size_t count);
86ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
87 size_t maxsize, size_t *start);
88ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
89 size_t maxsize, size_t *start);
90int iov_iter_npages(const struct iov_iter *i, int maxpages);
72 91
73static inline void iov_iter_init(struct iov_iter *i, 92static inline size_t iov_iter_count(struct iov_iter *i)
74 const struct iovec *iov, unsigned long nr_segs,
75 size_t count, size_t written)
76{ 93{
77 i->iov = iov; 94 return i->count;
78 i->nr_segs = nr_segs; 95}
79 i->iov_offset = 0;
80 i->count = count + written;
81 96
82 iov_iter_advance(i, written); 97/*
98 * Cap the iov_iter by given limit; note that the second argument is
99 * *not* the new size - it's upper limit for such. Passing it a value
100 * greater than the amount of data in iov_iter is fine - it'll just do
101 * nothing in that case.
102 */
103static inline void iov_iter_truncate(struct iov_iter *i, u64 count)
104{
105 /*
106 * count doesn't have to fit in size_t - comparison extends both
107 * operands to u64 here and any value that would be truncated by
108 * conversion in assignement is by definition greater than all
109 * values of size_t, including old i->count.
110 */
111 if (i->count > count)
112 i->count = count;
83} 113}
84 114
85static inline size_t iov_iter_count(struct iov_iter *i) 115/*
116 * reexpand a previously truncated iterator; count must be no more than how much
117 * we had shrunk it.
118 */
119static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
86{ 120{
87 return i->count; 121 i->count = count;
88} 122}
89 123
90int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 124int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
91int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); 125int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len);
126int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
127 int offset, int len);
128int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
129 int offset, int len);
92 130
93#endif 131#endif
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index c52f827ba6ce..4f844c6b03ee 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -103,6 +103,7 @@ extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, u
103extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 103extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
104extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 104extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs);
106extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
107extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
108extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 109extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
@@ -133,6 +134,9 @@ extern void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
133#else /* !CONFIG_UPROBES */ 134#else /* !CONFIG_UPROBES */
134struct uprobes_state { 135struct uprobes_state {
135}; 136};
137
138#define uprobe_get_trap_addr(regs) instruction_pointer(regs)
139
136static inline int 140static inline int
137uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc) 141uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
138{ 142{
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 44b38b92236a..7c9b484735c5 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -52,6 +52,10 @@
52#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */ 52#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */
53#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */ 53#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */
54 54
55/* Initial NTB length */
56#define CDC_NCM_NTB_DEF_SIZE_TX 16384 /* bytes */
57#define CDC_NCM_NTB_DEF_SIZE_RX 16384 /* bytes */
58
55/* Minimum value for MaxDatagramSize, ch. 6.2.9 */ 59/* Minimum value for MaxDatagramSize, ch. 6.2.9 */
56#define CDC_NCM_MIN_DATAGRAM_SIZE 1514 /* bytes */ 60#define CDC_NCM_MIN_DATAGRAM_SIZE 1514 /* bytes */
57 61
@@ -72,16 +76,9 @@
72/* Restart the timer, if amount of datagrams is less than given value */ 76/* Restart the timer, if amount of datagrams is less than given value */
73#define CDC_NCM_RESTART_TIMER_DATAGRAM_CNT 3 77#define CDC_NCM_RESTART_TIMER_DATAGRAM_CNT 3
74#define CDC_NCM_TIMER_PENDING_CNT 2 78#define CDC_NCM_TIMER_PENDING_CNT 2
75#define CDC_NCM_TIMER_INTERVAL (400UL * NSEC_PER_USEC) 79#define CDC_NCM_TIMER_INTERVAL_USEC 400UL
76 80#define CDC_NCM_TIMER_INTERVAL_MIN 5UL
77/* The following macro defines the minimum header space */ 81#define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC)
78#define CDC_NCM_MIN_HDR_SIZE \
79 (sizeof(struct usb_cdc_ncm_nth16) + sizeof(struct usb_cdc_ncm_ndp16) + \
80 (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16))
81
82#define CDC_NCM_NDP_SIZE \
83 (sizeof(struct usb_cdc_ncm_ndp16) + \
84 (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16))
85 82
86#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ 83#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
87 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) 84 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
@@ -107,6 +104,9 @@ struct cdc_ncm_ctx {
107 spinlock_t mtx; 104 spinlock_t mtx;
108 atomic_t stop; 105 atomic_t stop;
109 106
107 u32 timer_interval;
108 u32 max_ndp_size;
109
110 u32 tx_timer_pending; 110 u32 tx_timer_pending;
111 u32 tx_curr_frame_num; 111 u32 tx_curr_frame_num;
112 u32 rx_max; 112 u32 rx_max;
@@ -118,10 +118,21 @@ struct cdc_ncm_ctx {
118 u16 tx_ndp_modulus; 118 u16 tx_ndp_modulus;
119 u16 tx_seq; 119 u16 tx_seq;
120 u16 rx_seq; 120 u16 rx_seq;
121 u16 connected; 121 u16 min_tx_pkt;
122
123 /* statistics */
124 u32 tx_curr_frame_payload;
125 u32 tx_reason_ntb_full;
126 u32 tx_reason_ndp_full;
127 u32 tx_reason_timeout;
128 u32 tx_reason_max_datagram;
129 u64 tx_overhead;
130 u64 tx_ntbs;
131 u64 rx_overhead;
132 u64 rx_ntbs;
122}; 133};
123 134
124u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf); 135u8 cdc_ncm_select_altsetting(struct usb_interface *intf);
125int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); 136int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting);
126void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); 137void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
127struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); 138struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 1a64b26046ed..9b7de1b46437 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -70,7 +70,9 @@
70 US_FLAG(NEEDS_CAP16, 0x00400000) \ 70 US_FLAG(NEEDS_CAP16, 0x00400000) \
71 /* cannot handle READ_CAPACITY_10 */ \ 71 /* cannot handle READ_CAPACITY_10 */ \
72 US_FLAG(IGNORE_UAS, 0x00800000) \ 72 US_FLAG(IGNORE_UAS, 0x00800000) \
73 /* Device advertises UAS but it is broken */ 73 /* Device advertises UAS but it is broken */ \
74 US_FLAG(BROKEN_FUA, 0x01000000) \
75 /* Cannot handle FUA in WRITE or READ CDBs */ \
74 76
75#define US_FLAG(name, value) US_FL_##name = value , 77#define US_FLAG(name, value) US_FL_##name = value ,
76enum { US_DO_ALL_FLAGS }; 78enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index e4abb84199be..b46671e28de2 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -106,6 +106,8 @@ static inline struct virtio_device *dev_to_virtio(struct device *_dev)
106int register_virtio_device(struct virtio_device *dev); 106int register_virtio_device(struct virtio_device *dev);
107void unregister_virtio_device(struct virtio_device *dev); 107void unregister_virtio_device(struct virtio_device *dev);
108 108
109void virtio_break_device(struct virtio_device *dev);
110
109/** 111/**
110 * virtio_driver - operations for a virtio I/O driver 112 * virtio_driver - operations for a virtio I/O driver
111 * @driver: underlying device driver (populate name and owner). 113 * @driver: underlying device driver (populate name and owner).
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h
index 4195b97a3def..de429d1f4357 100644
--- a/include/linux/virtio_scsi.h
+++ b/include/linux/virtio_scsi.h
@@ -35,11 +35,23 @@ struct virtio_scsi_cmd_req {
35 u8 lun[8]; /* Logical Unit Number */ 35 u8 lun[8]; /* Logical Unit Number */
36 u64 tag; /* Command identifier */ 36 u64 tag; /* Command identifier */
37 u8 task_attr; /* Task attribute */ 37 u8 task_attr; /* Task attribute */
38 u8 prio; 38 u8 prio; /* SAM command priority field */
39 u8 crn; 39 u8 crn;
40 u8 cdb[VIRTIO_SCSI_CDB_SIZE]; 40 u8 cdb[VIRTIO_SCSI_CDB_SIZE];
41} __packed; 41} __packed;
42 42
43/* SCSI command request, followed by protection information */
44struct virtio_scsi_cmd_req_pi {
45 u8 lun[8]; /* Logical Unit Number */
46 u64 tag; /* Command identifier */
47 u8 task_attr; /* Task attribute */
48 u8 prio; /* SAM command priority field */
49 u8 crn;
50 u32 pi_bytesout; /* DataOUT PI Number of bytes */
51 u32 pi_bytesin; /* DataIN PI Number of bytes */
52 u8 cdb[VIRTIO_SCSI_CDB_SIZE];
53} __packed;
54
43/* Response, followed by sense data and data-in */ 55/* Response, followed by sense data and data-in */
44struct virtio_scsi_cmd_resp { 56struct virtio_scsi_cmd_resp {
45 u32 sense_len; /* Sense data length */ 57 u32 sense_len; /* Sense data length */
@@ -97,6 +109,7 @@ struct virtio_scsi_config {
97#define VIRTIO_SCSI_F_INOUT 0 109#define VIRTIO_SCSI_F_INOUT 0
98#define VIRTIO_SCSI_F_HOTPLUG 1 110#define VIRTIO_SCSI_F_HOTPLUG 1
99#define VIRTIO_SCSI_F_CHANGE 2 111#define VIRTIO_SCSI_F_CHANGE 2
112#define VIRTIO_SCSI_F_T10_PI 3
100 113
101/* Response codes */ 114/* Response codes */
102#define VIRTIO_SCSI_S_OK 0 115#define VIRTIO_SCSI_S_OK 0
diff --git a/include/linux/wait.h b/include/linux/wait.h
index bd68819f0815..6fb1ba5f9b2f 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -25,6 +25,7 @@ struct wait_bit_key {
25 void *flags; 25 void *flags;
26 int bit_nr; 26 int bit_nr;
27#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
28 unsigned long private;
28}; 29};
29 30
30struct wait_bit_queue { 31struct wait_bit_queue {
@@ -141,18 +142,19 @@ __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old)
141 list_del(&old->task_list); 142 list_del(&old->task_list);
142} 143}
143 144
145typedef int wait_bit_action_f(struct wait_bit_key *);
144void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 146void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
145void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 147void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
146void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 148void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); 149void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr);
148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 150void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
149void __wake_up_bit(wait_queue_head_t *, void *, int); 151void __wake_up_bit(wait_queue_head_t *, void *, int);
150int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 152int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_action_f *, unsigned);
151int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 153int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_action_f *, unsigned);
152void wake_up_bit(void *, int); 154void wake_up_bit(void *, int);
153void wake_up_atomic_t(atomic_t *); 155void wake_up_atomic_t(atomic_t *);
154int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned); 156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned);
155int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned); 157int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned);
156int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned); 158int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
157wait_queue_head_t *bit_waitqueue(void *, int); 159wait_queue_head_t *bit_waitqueue(void *, int);
158 160
@@ -854,11 +856,14 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
854 (wait)->flags = 0; \ 856 (wait)->flags = 0; \
855 } while (0) 857 } while (0)
856 858
859
860extern int bit_wait(struct wait_bit_key *);
861extern int bit_wait_io(struct wait_bit_key *);
862
857/** 863/**
858 * wait_on_bit - wait for a bit to be cleared 864 * wait_on_bit - wait for a bit to be cleared
859 * @word: the word being waited on, a kernel virtual address 865 * @word: the word being waited on, a kernel virtual address
860 * @bit: the bit of the word being waited on 866 * @bit: the bit of the word being waited on
861 * @action: the function used to sleep, which may take special actions
862 * @mode: the task state to sleep in 867 * @mode: the task state to sleep in
863 * 868 *
864 * There is a standard hashed waitqueue table for generic use. This 869 * There is a standard hashed waitqueue table for generic use. This
@@ -867,9 +872,62 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
867 * call wait_on_bit() in threads waiting for the bit to clear. 872 * call wait_on_bit() in threads waiting for the bit to clear.
868 * One uses wait_on_bit() where one is waiting for the bit to clear, 873 * One uses wait_on_bit() where one is waiting for the bit to clear,
869 * but has no intention of setting it. 874 * but has no intention of setting it.
875 * Returned value will be zero if the bit was cleared, or non-zero
876 * if the process received a signal and the mode permitted wakeup
877 * on that signal.
878 */
879static inline int
880wait_on_bit(void *word, int bit, unsigned mode)
881{
882 if (!test_bit(bit, word))
883 return 0;
884 return out_of_line_wait_on_bit(word, bit,
885 bit_wait,
886 mode);
887}
888
889/**
890 * wait_on_bit_io - wait for a bit to be cleared
891 * @word: the word being waited on, a kernel virtual address
892 * @bit: the bit of the word being waited on
893 * @mode: the task state to sleep in
894 *
895 * Use the standard hashed waitqueue table to wait for a bit
896 * to be cleared. This is similar to wait_on_bit(), but calls
897 * io_schedule() instead of schedule() for the actual waiting.
898 *
899 * Returned value will be zero if the bit was cleared, or non-zero
900 * if the process received a signal and the mode permitted wakeup
901 * on that signal.
902 */
903static inline int
904wait_on_bit_io(void *word, int bit, unsigned mode)
905{
906 if (!test_bit(bit, word))
907 return 0;
908 return out_of_line_wait_on_bit(word, bit,
909 bit_wait_io,
910 mode);
911}
912
913/**
914 * wait_on_bit_action - wait for a bit to be cleared
915 * @word: the word being waited on, a kernel virtual address
916 * @bit: the bit of the word being waited on
917 * @action: the function used to sleep, which may take special actions
918 * @mode: the task state to sleep in
919 *
920 * Use the standard hashed waitqueue table to wait for a bit
921 * to be cleared, and allow the waiting action to be specified.
922 * This is like wait_on_bit() but allows fine control of how the waiting
923 * is done.
924 *
925 * Returned value will be zero if the bit was cleared, or non-zero
926 * if the process received a signal and the mode permitted wakeup
927 * on that signal.
870 */ 928 */
871static inline int 929static inline int
872wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) 930wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
873{ 931{
874 if (!test_bit(bit, word)) 932 if (!test_bit(bit, word))
875 return 0; 933 return 0;
@@ -880,7 +938,6 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
880 * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it 938 * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it
881 * @word: the word being waited on, a kernel virtual address 939 * @word: the word being waited on, a kernel virtual address
882 * @bit: the bit of the word being waited on 940 * @bit: the bit of the word being waited on
883 * @action: the function used to sleep, which may take special actions
884 * @mode: the task state to sleep in 941 * @mode: the task state to sleep in
885 * 942 *
886 * There is a standard hashed waitqueue table for generic use. This 943 * There is a standard hashed waitqueue table for generic use. This
@@ -891,9 +948,61 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
891 * wait_on_bit() in threads waiting to be able to set the bit. 948 * wait_on_bit() in threads waiting to be able to set the bit.
892 * One uses wait_on_bit_lock() where one is waiting for the bit to 949 * One uses wait_on_bit_lock() where one is waiting for the bit to
893 * clear with the intention of setting it, and when done, clearing it. 950 * clear with the intention of setting it, and when done, clearing it.
951 *
952 * Returns zero if the bit was (eventually) found to be clear and was
953 * set. Returns non-zero if a signal was delivered to the process and
954 * the @mode allows that signal to wake the process.
955 */
956static inline int
957wait_on_bit_lock(void *word, int bit, unsigned mode)
958{
959 if (!test_and_set_bit(bit, word))
960 return 0;
961 return out_of_line_wait_on_bit_lock(word, bit, bit_wait, mode);
962}
963
964/**
965 * wait_on_bit_lock_io - wait for a bit to be cleared, when wanting to set it
966 * @word: the word being waited on, a kernel virtual address
967 * @bit: the bit of the word being waited on
968 * @mode: the task state to sleep in
969 *
970 * Use the standard hashed waitqueue table to wait for a bit
971 * to be cleared and then to atomically set it. This is similar
972 * to wait_on_bit(), but calls io_schedule() instead of schedule()
973 * for the actual waiting.
974 *
975 * Returns zero if the bit was (eventually) found to be clear and was
976 * set. Returns non-zero if a signal was delivered to the process and
977 * the @mode allows that signal to wake the process.
978 */
979static inline int
980wait_on_bit_lock_io(void *word, int bit, unsigned mode)
981{
982 if (!test_and_set_bit(bit, word))
983 return 0;
984 return out_of_line_wait_on_bit_lock(word, bit, bit_wait_io, mode);
985}
986
987/**
988 * wait_on_bit_lock_action - wait for a bit to be cleared, when wanting to set it
989 * @word: the word being waited on, a kernel virtual address
990 * @bit: the bit of the word being waited on
991 * @action: the function used to sleep, which may take special actions
992 * @mode: the task state to sleep in
993 *
994 * Use the standard hashed waitqueue table to wait for a bit
995 * to be cleared and then to set it, and allow the waiting action
996 * to be specified.
997 * This is like wait_on_bit() but allows fine control of how the waiting
998 * is done.
999 *
1000 * Returns zero if the bit was (eventually) found to be clear and was
1001 * set. Returns non-zero if a signal was delivered to the process and
1002 * the @mode allows that signal to wake the process.
894 */ 1003 */
895static inline int 1004static inline int
896wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode) 1005wait_on_bit_lock_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
897{ 1006{
898 if (!test_and_set_bit(bit, word)) 1007 if (!test_and_set_bit(bit, word))
899 return 0; 1008 return 0;
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 1b22c42e9c2d..a0cc2e95ed1b 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -56,9 +56,8 @@ enum {
56 WORK_NR_COLORS = (1 << WORK_STRUCT_COLOR_BITS) - 1, 56 WORK_NR_COLORS = (1 << WORK_STRUCT_COLOR_BITS) - 1,
57 WORK_NO_COLOR = WORK_NR_COLORS, 57 WORK_NO_COLOR = WORK_NR_COLORS,
58 58
59 /* special cpu IDs */ 59 /* not bound to any CPU, prefer the local CPU */
60 WORK_CPU_UNBOUND = NR_CPUS, 60 WORK_CPU_UNBOUND = NR_CPUS,
61 WORK_CPU_END = NR_CPUS + 1,
62 61
63 /* 62 /*
64 * Reserve 7 bits off of pwq pointer w/ debugobjects turned off. 63 * Reserve 7 bits off of pwq pointer w/ debugobjects turned off.
@@ -274,13 +273,6 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
274#define delayed_work_pending(w) \ 273#define delayed_work_pending(w) \
275 work_pending(&(w)->work) 274 work_pending(&(w)->work)
276 275
277/**
278 * work_clear_pending - for internal use only, mark a work item as not pending
279 * @work: The work item in question
280 */
281#define work_clear_pending(work) \
282 clear_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))
283
284/* 276/*
285 * Workqueue flags and constants. For details, please refer to 277 * Workqueue flags and constants. For details, please refer to
286 * Documentation/workqueue.txt. 278 * Documentation/workqueue.txt.
@@ -340,6 +332,9 @@ enum {
340 * short queue flush time. Don't queue works which can run for too 332 * short queue flush time. Don't queue works which can run for too
341 * long. 333 * long.
342 * 334 *
335 * system_highpri_wq is similar to system_wq but for work items which
336 * require WQ_HIGHPRI.
337 *
343 * system_long_wq is similar to system_wq but may host long running 338 * system_long_wq is similar to system_wq but may host long running
344 * works. Queue flushing might take relatively long. 339 * works. Queue flushing might take relatively long.
345 * 340 *
@@ -358,26 +353,13 @@ enum {
358 * 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info. 353 * 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info.
359 */ 354 */
360extern struct workqueue_struct *system_wq; 355extern struct workqueue_struct *system_wq;
356extern struct workqueue_struct *system_highpri_wq;
361extern struct workqueue_struct *system_long_wq; 357extern struct workqueue_struct *system_long_wq;
362extern struct workqueue_struct *system_unbound_wq; 358extern struct workqueue_struct *system_unbound_wq;
363extern struct workqueue_struct *system_freezable_wq; 359extern struct workqueue_struct *system_freezable_wq;
364extern struct workqueue_struct *system_power_efficient_wq; 360extern struct workqueue_struct *system_power_efficient_wq;
365extern struct workqueue_struct *system_freezable_power_efficient_wq; 361extern struct workqueue_struct *system_freezable_power_efficient_wq;
366 362
367static inline struct workqueue_struct * __deprecated __system_nrt_wq(void)
368{
369 return system_wq;
370}
371
372static inline struct workqueue_struct * __deprecated __system_nrt_freezable_wq(void)
373{
374 return system_freezable_wq;
375}
376
377/* equivlalent to system_wq and system_freezable_wq, deprecated */
378#define system_nrt_wq __system_nrt_wq()
379#define system_nrt_freezable_wq __system_nrt_freezable_wq()
380
381extern struct workqueue_struct * 363extern struct workqueue_struct *
382__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, 364__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
383 struct lock_class_key *key, const char *lock_name, ...) __printf(1, 6); 365 struct lock_class_key *key, const char *lock_name, ...) __printf(1, 6);
@@ -587,18 +569,6 @@ static inline bool keventd_up(void)
587 return system_wq != NULL; 569 return system_wq != NULL;
588} 570}
589 571
590/* used to be different but now identical to flush_work(), deprecated */
591static inline bool __deprecated flush_work_sync(struct work_struct *work)
592{
593 return flush_work(work);
594}
595
596/* used to be different but now identical to flush_delayed_work(), deprecated */
597static inline bool __deprecated flush_delayed_work_sync(struct delayed_work *dwork)
598{
599 return flush_delayed_work(dwork);
600}
601
602#ifndef CONFIG_SMP 572#ifndef CONFIG_SMP
603static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg) 573static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
604{ 574{
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 5777c13849ba..a219be961c0a 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -90,7 +90,6 @@ struct writeback_control {
90 * fs/fs-writeback.c 90 * fs/fs-writeback.c
91 */ 91 */
92struct bdi_writeback; 92struct bdi_writeback;
93int inode_wait(void *);
94void writeback_inodes_sb(struct super_block *, enum wb_reason reason); 93void writeback_inodes_sb(struct super_block *, enum wb_reason reason);
95void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, 94void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
96 enum wb_reason reason); 95 enum wb_reason reason);
@@ -105,7 +104,7 @@ void inode_wait_for_writeback(struct inode *inode);
105static inline void wait_on_inode(struct inode *inode) 104static inline void wait_on_inode(struct inode *inode)
106{ 105{
107 might_sleep(); 106 might_sleep();
108 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); 107 wait_on_bit(&inode->i_state, __I_NEW, TASK_UNINTERRUPTIBLE);
109} 108}
110 109
111/* 110/*
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index bca25dc53f9d..8fab6fa0dbfb 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -432,6 +432,7 @@ void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no);
432void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no); 432void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
433 433
434void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state); 434void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state);
435void vb2_discard_done(struct vb2_queue *q);
435int vb2_wait_for_all_buffers(struct vb2_queue *q); 436int vb2_wait_for_all_buffers(struct vb2_queue *q);
436 437
437int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); 438int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index f7d372b7d4ff..79b530fb2c4d 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -54,6 +54,7 @@
54#define __6LOWPAN_H__ 54#define __6LOWPAN_H__
55 55
56#include <net/ipv6.h> 56#include <net/ipv6.h>
57#include <net/net_namespace.h>
57 58
58#define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */ 59#define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */
59#define UIP_IPH_LEN 40 /* ipv6 fixed header size */ 60#define UIP_IPH_LEN 40 /* ipv6 fixed header size */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 933a9f22a05f..f679877bb601 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -306,11 +306,6 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr,
306 htonl(0xFF000000) | addr->s6_addr32[3]); 306 htonl(0xFF000000) | addr->s6_addr32[3]);
307} 307}
308 308
309static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
310{
311 return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
312}
313
314static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 309static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
315{ 310{
316#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 311#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h
index f79ae2aa76d6..085940f7eeec 100644
--- a/include/net/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -57,6 +57,14 @@ struct sockaddr_ieee802154 {
57/* get/setsockopt */ 57/* get/setsockopt */
58#define SOL_IEEE802154 0 58#define SOL_IEEE802154 0
59 59
60#define WPAN_WANTACK 0 60#define WPAN_WANTACK 0
61#define WPAN_SECURITY 1
62#define WPAN_SECURITY_LEVEL 2
63
64#define WPAN_SECURITY_DEFAULT 0
65#define WPAN_SECURITY_OFF 1
66#define WPAN_SECURITY_ON 2
67
68#define WPAN_SECURITY_LEVEL_DEFAULT (-1)
61 69
62#endif 70#endif
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index be150cf8cd43..16587dcd6a91 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -367,6 +367,7 @@ enum {
367#define HCI_ERROR_REMOTE_POWER_OFF 0x15 367#define HCI_ERROR_REMOTE_POWER_OFF 0x15
368#define HCI_ERROR_LOCAL_HOST_TERM 0x16 368#define HCI_ERROR_LOCAL_HOST_TERM 0x16
369#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 369#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
370#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c
370 371
371/* Flow control modes */ 372/* Flow control modes */
372#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 373#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
@@ -1053,6 +1054,17 @@ struct hci_cp_write_page_scan_activity {
1053 __le16 window; 1054 __le16 window;
1054} __packed; 1055} __packed;
1055 1056
1057#define HCI_OP_READ_TX_POWER 0x0c2d
1058struct hci_cp_read_tx_power {
1059 __le16 handle;
1060 __u8 type;
1061} __packed;
1062struct hci_rp_read_tx_power {
1063 __u8 status;
1064 __le16 handle;
1065 __s8 tx_power;
1066} __packed;
1067
1056#define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 1068#define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46
1057struct hci_rp_read_page_scan_type { 1069struct hci_rp_read_page_scan_type {
1058 __u8 status; 1070 __u8 status;
@@ -1063,6 +1075,16 @@ struct hci_rp_read_page_scan_type {
1063 #define PAGE_SCAN_TYPE_STANDARD 0x00 1075 #define PAGE_SCAN_TYPE_STANDARD 0x00
1064 #define PAGE_SCAN_TYPE_INTERLACED 0x01 1076 #define PAGE_SCAN_TYPE_INTERLACED 0x01
1065 1077
1078#define HCI_OP_READ_RSSI 0x1405
1079struct hci_cp_read_rssi {
1080 __le16 handle;
1081} __packed;
1082struct hci_rp_read_rssi {
1083 __u8 status;
1084 __le16 handle;
1085 __s8 rssi;
1086} __packed;
1087
1066#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 1088#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
1067struct hci_rp_read_local_amp_info { 1089struct hci_rp_read_local_amp_info {
1068 __u8 status; 1090 __u8 status;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 5f8bc05694ac..b386bf17e6c2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -68,6 +68,11 @@ struct discovery_state {
68 struct list_head unknown; /* Name state not known */ 68 struct list_head unknown; /* Name state not known */
69 struct list_head resolve; /* Name needs to be resolved */ 69 struct list_head resolve; /* Name needs to be resolved */
70 __u32 timestamp; 70 __u32 timestamp;
71 bdaddr_t last_adv_addr;
72 u8 last_adv_addr_type;
73 s8 last_adv_rssi;
74 u8 last_adv_data[HCI_MAX_AD_LENGTH];
75 u8 last_adv_data_len;
71}; 76};
72 77
73struct hci_conn_hash { 78struct hci_conn_hash {
@@ -140,6 +145,10 @@ struct oob_data {
140/* Default LE RPA expiry time, 15 minutes */ 145/* Default LE RPA expiry time, 15 minutes */
141#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60) 146#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60)
142 147
148/* Default min/max age of connection information (1s/3s) */
149#define DEFAULT_CONN_INFO_MIN_AGE 1000
150#define DEFAULT_CONN_INFO_MAX_AGE 3000
151
143struct amp_assoc { 152struct amp_assoc {
144 __u16 len; 153 __u16 len;
145 __u16 offset; 154 __u16 offset;
@@ -194,6 +203,9 @@ struct hci_dev {
194 __u16 le_scan_window; 203 __u16 le_scan_window;
195 __u16 le_conn_min_interval; 204 __u16 le_conn_min_interval;
196 __u16 le_conn_max_interval; 205 __u16 le_conn_max_interval;
206 __u16 discov_interleaved_timeout;
207 __u16 conn_info_min_age;
208 __u16 conn_info_max_age;
197 __u8 ssp_debug_mode; 209 __u8 ssp_debug_mode;
198 210
199 __u16 devid_source; 211 __u16 devid_source;
@@ -368,8 +380,13 @@ struct hci_conn {
368 __u16 setting; 380 __u16 setting;
369 __u16 le_conn_min_interval; 381 __u16 le_conn_min_interval;
370 __u16 le_conn_max_interval; 382 __u16 le_conn_max_interval;
383 __s8 rssi;
384 __s8 tx_power;
385 __s8 max_tx_power;
371 unsigned long flags; 386 unsigned long flags;
372 387
388 unsigned long conn_info_timestamp;
389
373 __u8 remote_cap; 390 __u8 remote_cap;
374 __u8 remote_auth; 391 __u8 remote_auth;
375 __u8 remote_id; 392 __u8 remote_id;
@@ -1204,8 +1221,8 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1204 */ 1221 */
1205#define DISCOV_LE_SCAN_WIN 0x12 1222#define DISCOV_LE_SCAN_WIN 0x12
1206#define DISCOV_LE_SCAN_INT 0x12 1223#define DISCOV_LE_SCAN_INT 0x12
1207#define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240) 1224#define DISCOV_LE_TIMEOUT 10240 /* msec */
1208#define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120) 1225#define DISCOV_INTERLEAVED_TIMEOUT 5120 /* msec */
1209#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 1226#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04
1210#define DISCOV_BREDR_INQUIRY_LEN 0x08 1227#define DISCOV_BREDR_INQUIRY_LEN 0x08
1211 1228
@@ -1265,7 +1282,8 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1265 u8 *randomizer256, u8 status); 1282 u8 *randomizer256, u8 status);
1266void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1283void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1267 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1284 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
1268 u8 ssp, u8 *eir, u16 eir_len); 1285 u8 ssp, u8 *eir, u16 eir_len, u8 *scan_rsp,
1286 u8 scan_rsp_len);
1269void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1287void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1270 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1288 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1271void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1289void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index d4b571c2f9fd..bcffc9ae0c89 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -181,6 +181,9 @@ struct mgmt_cp_load_link_keys {
181} __packed; 181} __packed;
182#define MGMT_LOAD_LINK_KEYS_SIZE 3 182#define MGMT_LOAD_LINK_KEYS_SIZE 3
183 183
184#define MGMT_LTK_UNAUTHENTICATED 0x00
185#define MGMT_LTK_AUTHENTICATED 0x01
186
184struct mgmt_ltk_info { 187struct mgmt_ltk_info {
185 struct mgmt_addr_info addr; 188 struct mgmt_addr_info addr;
186 __u8 type; 189 __u8 type;
@@ -409,6 +412,18 @@ struct mgmt_cp_load_irks {
409} __packed; 412} __packed;
410#define MGMT_LOAD_IRKS_SIZE 2 413#define MGMT_LOAD_IRKS_SIZE 2
411 414
415#define MGMT_OP_GET_CONN_INFO 0x0031
416struct mgmt_cp_get_conn_info {
417 struct mgmt_addr_info addr;
418} __packed;
419#define MGMT_GET_CONN_INFO_SIZE MGMT_ADDR_INFO_SIZE
420struct mgmt_rp_get_conn_info {
421 struct mgmt_addr_info addr;
422 __s8 rssi;
423 __s8 tx_power;
424 __s8 max_tx_power;
425} __packed;
426
412#define MGMT_EV_CMD_COMPLETE 0x0001 427#define MGMT_EV_CMD_COMPLETE 0x0001
413struct mgmt_ev_cmd_complete { 428struct mgmt_ev_cmd_complete {
414 __le16 opcode; 429 __le16 opcode;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 2611cc389d7d..578b83127af1 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -173,7 +173,7 @@ struct rfcomm_dlc {
173 struct sk_buff_head tx_queue; 173 struct sk_buff_head tx_queue;
174 struct timer_list timer; 174 struct timer_list timer;
175 175
176 spinlock_t lock; 176 struct mutex lock;
177 unsigned long state; 177 unsigned long state;
178 unsigned long flags; 178 unsigned long flags;
179 atomic_t refcnt; 179 atomic_t refcnt;
@@ -244,8 +244,8 @@ int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig);
244void rfcomm_dlc_accept(struct rfcomm_dlc *d); 244void rfcomm_dlc_accept(struct rfcomm_dlc *d);
245struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel); 245struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel);
246 246
247#define rfcomm_dlc_lock(d) spin_lock(&d->lock) 247#define rfcomm_dlc_lock(d) mutex_lock(&d->lock)
248#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) 248#define rfcomm_dlc_unlock(d) mutex_unlock(&d->lock)
249 249
250static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d) 250static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d)
251{ 251{
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f856e5a746fa..e46c437944f7 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -109,6 +109,13 @@ enum ieee80211_band {
109 * channel as the control or any of the secondary channels. 109 * channel as the control or any of the secondary channels.
110 * This may be due to the driver or due to regulatory bandwidth 110 * This may be due to the driver or due to regulatory bandwidth
111 * restrictions. 111 * restrictions.
112 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
113 * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT
114 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
115 * on this channel.
116 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
117 * on this channel.
118 *
112 */ 119 */
113enum ieee80211_channel_flags { 120enum ieee80211_channel_flags {
114 IEEE80211_CHAN_DISABLED = 1<<0, 121 IEEE80211_CHAN_DISABLED = 1<<0,
@@ -120,6 +127,10 @@ enum ieee80211_channel_flags {
120 IEEE80211_CHAN_NO_OFDM = 1<<6, 127 IEEE80211_CHAN_NO_OFDM = 1<<6,
121 IEEE80211_CHAN_NO_80MHZ = 1<<7, 128 IEEE80211_CHAN_NO_80MHZ = 1<<7,
122 IEEE80211_CHAN_NO_160MHZ = 1<<8, 129 IEEE80211_CHAN_NO_160MHZ = 1<<8,
130 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
131 IEEE80211_CHAN_GO_CONCURRENT = 1<<10,
132 IEEE80211_CHAN_NO_20MHZ = 1<<11,
133 IEEE80211_CHAN_NO_10MHZ = 1<<12,
123}; 134};
124 135
125#define IEEE80211_CHAN_NO_HT40 \ 136#define IEEE80211_CHAN_NO_HT40 \
@@ -330,8 +341,8 @@ struct vif_params {
330 * @seq_len: length of @seq. 341 * @seq_len: length of @seq.
331 */ 342 */
332struct key_params { 343struct key_params {
333 u8 *key; 344 const u8 *key;
334 u8 *seq; 345 const u8 *seq;
335 int key_len; 346 int key_len;
336 int seq_len; 347 int seq_len;
337 u32 cipher; 348 u32 cipher;
@@ -441,10 +452,13 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
441 * cfg80211_chandef_dfs_required - checks if radar detection is required 452 * cfg80211_chandef_dfs_required - checks if radar detection is required
442 * @wiphy: the wiphy to validate against 453 * @wiphy: the wiphy to validate against
443 * @chandef: the channel definition to check 454 * @chandef: the channel definition to check
444 * Return: 1 if radar detection is required, 0 if it is not, < 0 on error 455 * @iftype: the interface type as specified in &enum nl80211_iftype
456 * Returns:
457 * 1 if radar detection is required, 0 if it is not, < 0 on error
445 */ 458 */
446int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 459int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
447 const struct cfg80211_chan_def *chandef); 460 const struct cfg80211_chan_def *chandef,
461 enum nl80211_iftype iftype);
448 462
449/** 463/**
450 * ieee80211_chandef_rate_flags - returns rate flags for a channel 464 * ieee80211_chandef_rate_flags - returns rate flags for a channel
@@ -654,7 +668,6 @@ struct cfg80211_acl_data {
654 * @p2p_opp_ps: P2P opportunistic PS 668 * @p2p_opp_ps: P2P opportunistic PS
655 * @acl: ACL configuration used by the drivers which has support for 669 * @acl: ACL configuration used by the drivers which has support for
656 * MAC address based access control 670 * MAC address based access control
657 * @radar_required: set if radar detection is required
658 */ 671 */
659struct cfg80211_ap_settings { 672struct cfg80211_ap_settings {
660 struct cfg80211_chan_def chandef; 673 struct cfg80211_chan_def chandef;
@@ -672,7 +685,6 @@ struct cfg80211_ap_settings {
672 u8 p2p_ctwindow; 685 u8 p2p_ctwindow;
673 bool p2p_opp_ps; 686 bool p2p_opp_ps;
674 const struct cfg80211_acl_data *acl; 687 const struct cfg80211_acl_data *acl;
675 bool radar_required;
676}; 688};
677 689
678/** 690/**
@@ -682,8 +694,10 @@ struct cfg80211_ap_settings {
682 * 694 *
683 * @chandef: defines the channel to use after the switch 695 * @chandef: defines the channel to use after the switch
684 * @beacon_csa: beacon data while performing the switch 696 * @beacon_csa: beacon data while performing the switch
685 * @counter_offset_beacon: offset for the counter within the beacon (tail) 697 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
686 * @counter_offset_presp: offset for the counter within the probe response 698 * @counter_offsets_presp: offsets of the counters within the probe response
699 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
700 * @n_counter_offsets_presp: number of csa counters in the probe response
687 * @beacon_after: beacon data to be used on the new channel 701 * @beacon_after: beacon data to be used on the new channel
688 * @radar_required: whether radar detection is required on the new channel 702 * @radar_required: whether radar detection is required on the new channel
689 * @block_tx: whether transmissions should be blocked while changing 703 * @block_tx: whether transmissions should be blocked while changing
@@ -692,7 +706,10 @@ struct cfg80211_ap_settings {
692struct cfg80211_csa_settings { 706struct cfg80211_csa_settings {
693 struct cfg80211_chan_def chandef; 707 struct cfg80211_chan_def chandef;
694 struct cfg80211_beacon_data beacon_csa; 708 struct cfg80211_beacon_data beacon_csa;
695 u16 counter_offset_beacon, counter_offset_presp; 709 const u16 *counter_offsets_beacon;
710 const u16 *counter_offsets_presp;
711 unsigned int n_counter_offsets_beacon;
712 unsigned int n_counter_offsets_presp;
696 struct cfg80211_beacon_data beacon_after; 713 struct cfg80211_beacon_data beacon_after;
697 bool radar_required; 714 bool radar_required;
698 bool block_tx; 715 bool block_tx;
@@ -856,36 +873,38 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
856 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 873 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
857 * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled 874 * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled
858 * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled 875 * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled
876 * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled
859 */ 877 */
860enum station_info_flags { 878enum station_info_flags {
861 STATION_INFO_INACTIVE_TIME = 1<<0, 879 STATION_INFO_INACTIVE_TIME = BIT(0),
862 STATION_INFO_RX_BYTES = 1<<1, 880 STATION_INFO_RX_BYTES = BIT(1),
863 STATION_INFO_TX_BYTES = 1<<2, 881 STATION_INFO_TX_BYTES = BIT(2),
864 STATION_INFO_LLID = 1<<3, 882 STATION_INFO_LLID = BIT(3),
865 STATION_INFO_PLID = 1<<4, 883 STATION_INFO_PLID = BIT(4),
866 STATION_INFO_PLINK_STATE = 1<<5, 884 STATION_INFO_PLINK_STATE = BIT(5),
867 STATION_INFO_SIGNAL = 1<<6, 885 STATION_INFO_SIGNAL = BIT(6),
868 STATION_INFO_TX_BITRATE = 1<<7, 886 STATION_INFO_TX_BITRATE = BIT(7),
869 STATION_INFO_RX_PACKETS = 1<<8, 887 STATION_INFO_RX_PACKETS = BIT(8),
870 STATION_INFO_TX_PACKETS = 1<<9, 888 STATION_INFO_TX_PACKETS = BIT(9),
871 STATION_INFO_TX_RETRIES = 1<<10, 889 STATION_INFO_TX_RETRIES = BIT(10),
872 STATION_INFO_TX_FAILED = 1<<11, 890 STATION_INFO_TX_FAILED = BIT(11),
873 STATION_INFO_RX_DROP_MISC = 1<<12, 891 STATION_INFO_RX_DROP_MISC = BIT(12),
874 STATION_INFO_SIGNAL_AVG = 1<<13, 892 STATION_INFO_SIGNAL_AVG = BIT(13),
875 STATION_INFO_RX_BITRATE = 1<<14, 893 STATION_INFO_RX_BITRATE = BIT(14),
876 STATION_INFO_BSS_PARAM = 1<<15, 894 STATION_INFO_BSS_PARAM = BIT(15),
877 STATION_INFO_CONNECTED_TIME = 1<<16, 895 STATION_INFO_CONNECTED_TIME = BIT(16),
878 STATION_INFO_ASSOC_REQ_IES = 1<<17, 896 STATION_INFO_ASSOC_REQ_IES = BIT(17),
879 STATION_INFO_STA_FLAGS = 1<<18, 897 STATION_INFO_STA_FLAGS = BIT(18),
880 STATION_INFO_BEACON_LOSS_COUNT = 1<<19, 898 STATION_INFO_BEACON_LOSS_COUNT = BIT(19),
881 STATION_INFO_T_OFFSET = 1<<20, 899 STATION_INFO_T_OFFSET = BIT(20),
882 STATION_INFO_LOCAL_PM = 1<<21, 900 STATION_INFO_LOCAL_PM = BIT(21),
883 STATION_INFO_PEER_PM = 1<<22, 901 STATION_INFO_PEER_PM = BIT(22),
884 STATION_INFO_NONPEER_PM = 1<<23, 902 STATION_INFO_NONPEER_PM = BIT(23),
885 STATION_INFO_RX_BYTES64 = 1<<24, 903 STATION_INFO_RX_BYTES64 = BIT(24),
886 STATION_INFO_TX_BYTES64 = 1<<25, 904 STATION_INFO_TX_BYTES64 = BIT(25),
887 STATION_INFO_CHAIN_SIGNAL = 1<<26, 905 STATION_INFO_CHAIN_SIGNAL = BIT(26),
888 STATION_INFO_CHAIN_SIGNAL_AVG = 1<<27, 906 STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27),
907 STATION_INFO_EXPECTED_THROUGHPUT = BIT(28),
889}; 908};
890 909
891/** 910/**
@@ -1007,6 +1026,8 @@ struct sta_bss_parameters {
1007 * @local_pm: local mesh STA power save mode 1026 * @local_pm: local mesh STA power save mode
1008 * @peer_pm: peer mesh STA power save mode 1027 * @peer_pm: peer mesh STA power save mode
1009 * @nonpeer_pm: non-peer mesh STA power save mode 1028 * @nonpeer_pm: non-peer mesh STA power save mode
1029 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1030 * towards this station.
1010 */ 1031 */
1011struct station_info { 1032struct station_info {
1012 u32 filled; 1033 u32 filled;
@@ -1045,6 +1066,8 @@ struct station_info {
1045 enum nl80211_mesh_power_mode peer_pm; 1066 enum nl80211_mesh_power_mode peer_pm;
1046 enum nl80211_mesh_power_mode nonpeer_pm; 1067 enum nl80211_mesh_power_mode nonpeer_pm;
1047 1068
1069 u32 expected_throughput;
1070
1048 /* 1071 /*
1049 * Note: Add a new enum station_info_flags value for each new field and 1072 * Note: Add a new enum station_info_flags value for each new field and
1050 * use it to check which fields are initialized. 1073 * use it to check which fields are initialized.
@@ -1052,6 +1075,19 @@ struct station_info {
1052}; 1075};
1053 1076
1054/** 1077/**
1078 * cfg80211_get_station - retrieve information about a given station
1079 * @dev: the device where the station is supposed to be connected to
1080 * @mac_addr: the mac address of the station of interest
1081 * @sinfo: pointer to the structure to fill with the information
1082 *
1083 * Returns 0 on success and sinfo is filled with the available information
1084 * otherwise returns a negative error code and the content of sinfo has to be
1085 * considered undefined.
1086 */
1087int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1088 struct station_info *sinfo);
1089
1090/**
1055 * enum monitor_flags - monitor flags 1091 * enum monitor_flags - monitor flags
1056 * 1092 *
1057 * Monitor interface configuration flags. Note that these must be the bits 1093 * Monitor interface configuration flags. Note that these must be the bits
@@ -1152,7 +1188,7 @@ struct bss_parameters {
1152 int use_cts_prot; 1188 int use_cts_prot;
1153 int use_short_preamble; 1189 int use_short_preamble;
1154 int use_short_slot_time; 1190 int use_short_slot_time;
1155 u8 *basic_rates; 1191 const u8 *basic_rates;
1156 u8 basic_rates_len; 1192 u8 basic_rates_len;
1157 int ap_isolate; 1193 int ap_isolate;
1158 int ht_opmode; 1194 int ht_opmode;
@@ -1682,10 +1718,10 @@ struct cfg80211_disassoc_request {
1682 * @ht_capa_mask: The bits of ht_capa which are to be used. 1718 * @ht_capa_mask: The bits of ht_capa which are to be used.
1683 */ 1719 */
1684struct cfg80211_ibss_params { 1720struct cfg80211_ibss_params {
1685 u8 *ssid; 1721 const u8 *ssid;
1686 u8 *bssid; 1722 const u8 *bssid;
1687 struct cfg80211_chan_def chandef; 1723 struct cfg80211_chan_def chandef;
1688 u8 *ie; 1724 const u8 *ie;
1689 u8 ssid_len, ie_len; 1725 u8 ssid_len, ie_len;
1690 u16 beacon_interval; 1726 u16 beacon_interval;
1691 u32 basic_rates; 1727 u32 basic_rates;
@@ -1794,8 +1830,8 @@ struct cfg80211_bitrate_mask {
1794 * @pmkid: The PMK material itself. 1830 * @pmkid: The PMK material itself.
1795 */ 1831 */
1796struct cfg80211_pmksa { 1832struct cfg80211_pmksa {
1797 u8 *bssid; 1833 const u8 *bssid;
1798 u8 *pmkid; 1834 const u8 *pmkid;
1799}; 1835};
1800 1836
1801/** 1837/**
@@ -1810,7 +1846,7 @@ struct cfg80211_pmksa {
1810 * memory, free @mask only! 1846 * memory, free @mask only!
1811 */ 1847 */
1812struct cfg80211_pkt_pattern { 1848struct cfg80211_pkt_pattern {
1813 u8 *mask, *pattern; 1849 const u8 *mask, *pattern;
1814 int pattern_len; 1850 int pattern_len;
1815 int pkt_offset; 1851 int pkt_offset;
1816}; 1852};
@@ -1974,6 +2010,8 @@ struct cfg80211_update_ft_ies_params {
1974 * @len: buffer length 2010 * @len: buffer length
1975 * @no_cck: don't use cck rates for this frame 2011 * @no_cck: don't use cck rates for this frame
1976 * @dont_wait_for_ack: tells the low level not to wait for an ack 2012 * @dont_wait_for_ack: tells the low level not to wait for an ack
2013 * @n_csa_offsets: length of csa_offsets array
2014 * @csa_offsets: array of all the csa offsets in the frame
1977 */ 2015 */
1978struct cfg80211_mgmt_tx_params { 2016struct cfg80211_mgmt_tx_params {
1979 struct ieee80211_channel *chan; 2017 struct ieee80211_channel *chan;
@@ -1983,6 +2021,8 @@ struct cfg80211_mgmt_tx_params {
1983 size_t len; 2021 size_t len;
1984 bool no_cck; 2022 bool no_cck;
1985 bool dont_wait_for_ack; 2023 bool dont_wait_for_ack;
2024 int n_csa_offsets;
2025 const u16 *csa_offsets;
1986}; 2026};
1987 2027
1988/** 2028/**
@@ -2278,6 +2318,10 @@ struct cfg80211_qos_map {
2278 * @channel_switch: initiate channel-switch procedure (with CSA) 2318 * @channel_switch: initiate channel-switch procedure (with CSA)
2279 * 2319 *
2280 * @set_qos_map: Set QoS mapping information to the driver 2320 * @set_qos_map: Set QoS mapping information to the driver
2321 *
2322 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
2323 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
2324 * changes during the lifetime of the BSS.
2281 */ 2325 */
2282struct cfg80211_ops { 2326struct cfg80211_ops {
2283 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 2327 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2320,28 +2364,29 @@ struct cfg80211_ops {
2320 2364
2321 2365
2322 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 2366 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
2323 u8 *mac, struct station_parameters *params); 2367 const u8 *mac,
2368 struct station_parameters *params);
2324 int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 2369 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
2325 u8 *mac); 2370 const u8 *mac);
2326 int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 2371 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
2327 u8 *mac, struct station_parameters *params); 2372 const u8 *mac,
2373 struct station_parameters *params);
2328 int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 2374 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
2329 u8 *mac, struct station_info *sinfo); 2375 const u8 *mac, struct station_info *sinfo);
2330 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 2376 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
2331 int idx, u8 *mac, struct station_info *sinfo); 2377 int idx, u8 *mac, struct station_info *sinfo);
2332 2378
2333 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 2379 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
2334 u8 *dst, u8 *next_hop); 2380 const u8 *dst, const u8 *next_hop);
2335 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 2381 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
2336 u8 *dst); 2382 const u8 *dst);
2337 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 2383 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
2338 u8 *dst, u8 *next_hop); 2384 const u8 *dst, const u8 *next_hop);
2339 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 2385 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
2340 u8 *dst, u8 *next_hop, 2386 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
2341 struct mpath_info *pinfo);
2342 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 2387 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
2343 int idx, u8 *dst, u8 *next_hop, 2388 int idx, u8 *dst, u8 *next_hop,
2344 struct mpath_info *pinfo); 2389 struct mpath_info *pinfo);
2345 int (*get_mesh_config)(struct wiphy *wiphy, 2390 int (*get_mesh_config)(struct wiphy *wiphy,
2346 struct net_device *dev, 2391 struct net_device *dev,
2347 struct mesh_config *conf); 2392 struct mesh_config *conf);
@@ -2471,11 +2516,11 @@ struct cfg80211_ops {
2471 struct cfg80211_gtk_rekey_data *data); 2516 struct cfg80211_gtk_rekey_data *data);
2472 2517
2473 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2518 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2474 u8 *peer, u8 action_code, u8 dialog_token, 2519 const u8 *peer, u8 action_code, u8 dialog_token,
2475 u16 status_code, u32 peer_capability, 2520 u16 status_code, u32 peer_capability,
2476 const u8 *buf, size_t len); 2521 const u8 *buf, size_t len);
2477 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2522 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2478 u8 *peer, enum nl80211_tdls_operation oper); 2523 const u8 *peer, enum nl80211_tdls_operation oper);
2479 2524
2480 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 2525 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
2481 const u8 *peer, u64 *cookie); 2526 const u8 *peer, u64 *cookie);
@@ -2521,9 +2566,13 @@ struct cfg80211_ops {
2521 int (*channel_switch)(struct wiphy *wiphy, 2566 int (*channel_switch)(struct wiphy *wiphy,
2522 struct net_device *dev, 2567 struct net_device *dev,
2523 struct cfg80211_csa_settings *params); 2568 struct cfg80211_csa_settings *params);
2569
2524 int (*set_qos_map)(struct wiphy *wiphy, 2570 int (*set_qos_map)(struct wiphy *wiphy,
2525 struct net_device *dev, 2571 struct net_device *dev,
2526 struct cfg80211_qos_map *qos_map); 2572 struct cfg80211_qos_map *qos_map);
2573
2574 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
2575 struct cfg80211_chan_def *chandef);
2527}; 2576};
2528 2577
2529/* 2578/*
@@ -2618,6 +2667,7 @@ struct ieee80211_iface_limit {
2618 * between infrastructure and AP types must match. This is required 2667 * between infrastructure and AP types must match. This is required
2619 * only in special cases. 2668 * only in special cases.
2620 * @radar_detect_widths: bitmap of channel widths supported for radar detection 2669 * @radar_detect_widths: bitmap of channel widths supported for radar detection
2670 * @radar_detect_regions: bitmap of regions supported for radar detection
2621 * 2671 *
2622 * With this structure the driver can describe which interface 2672 * With this structure the driver can describe which interface
2623 * combinations it supports concurrently. 2673 * combinations it supports concurrently.
@@ -2675,6 +2725,7 @@ struct ieee80211_iface_combination {
2675 u8 n_limits; 2725 u8 n_limits;
2676 bool beacon_int_infra_match; 2726 bool beacon_int_infra_match;
2677 u8 radar_detect_widths; 2727 u8 radar_detect_widths;
2728 u8 radar_detect_regions;
2678}; 2729};
2679 2730
2680struct ieee80211_txrx_stypes { 2731struct ieee80211_txrx_stypes {
@@ -2905,6 +2956,17 @@ struct wiphy_vendor_command {
2905 * (including P2P GO) or 0 to indicate no such limit is advertised. The 2956 * (including P2P GO) or 0 to indicate no such limit is advertised. The
2906 * driver is allowed to advertise a theoretical limit that it can reach in 2957 * driver is allowed to advertise a theoretical limit that it can reach in
2907 * some cases, but may not always reach. 2958 * some cases, but may not always reach.
2959 *
2960 * @max_num_csa_counters: Number of supported csa_counters in beacons
2961 * and probe responses. This value should be set if the driver
2962 * wishes to limit the number of csa counters. Default (0) means
2963 * infinite.
2964 * @max_adj_channel_rssi_comp: max offset of between the channel on which the
2965 * frame was sent and the channel on which the frame was heard for which
2966 * the reported rssi is still valid. If a driver is able to compensate the
2967 * low rssi when a frame is heard on different channel, then it should set
2968 * this variable to the maximal offset for which it can compensate.
2969 * This value should be set in MHz.
2908 */ 2970 */
2909struct wiphy { 2971struct wiphy {
2910 /* assign these fields before you register the wiphy */ 2972 /* assign these fields before you register the wiphy */
@@ -3022,6 +3084,9 @@ struct wiphy {
3022 3084
3023 u16 max_ap_assoc_sta; 3085 u16 max_ap_assoc_sta;
3024 3086
3087 u8 max_num_csa_counters;
3088 u8 max_adj_channel_rssi_comp;
3089
3025 char priv[0] __aligned(NETDEV_ALIGN); 3090 char priv[0] __aligned(NETDEV_ALIGN);
3026}; 3091};
3027 3092
@@ -3194,6 +3259,7 @@ struct cfg80211_cached_keys;
3194 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3259 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3195 * @event_list: (private) list for internal event processing 3260 * @event_list: (private) list for internal event processing
3196 * @event_lock: (private) lock for event list 3261 * @event_lock: (private) lock for event list
3262 * @owner_nlportid: (private) owner socket port ID
3197 */ 3263 */
3198struct wireless_dev { 3264struct wireless_dev {
3199 struct wiphy *wiphy; 3265 struct wiphy *wiphy;
@@ -3241,13 +3307,15 @@ struct wireless_dev {
3241 unsigned long cac_start_time; 3307 unsigned long cac_start_time;
3242 unsigned int cac_time_ms; 3308 unsigned int cac_time_ms;
3243 3309
3310 u32 owner_nlportid;
3311
3244#ifdef CONFIG_CFG80211_WEXT 3312#ifdef CONFIG_CFG80211_WEXT
3245 /* wext data */ 3313 /* wext data */
3246 struct { 3314 struct {
3247 struct cfg80211_ibss_params ibss; 3315 struct cfg80211_ibss_params ibss;
3248 struct cfg80211_connect_params connect; 3316 struct cfg80211_connect_params connect;
3249 struct cfg80211_cached_keys *keys; 3317 struct cfg80211_cached_keys *keys;
3250 u8 *ie; 3318 const u8 *ie;
3251 size_t ie_len; 3319 size_t ie_len;
3252 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3320 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
3253 u8 ssid[IEEE80211_MAX_SSID_LEN]; 3321 u8 ssid[IEEE80211_MAX_SSID_LEN];
@@ -3488,7 +3556,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
3488 * Return: 0 on success, or a negative error code. 3556 * Return: 0 on success, or a negative error code.
3489 */ 3557 */
3490int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3558int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
3491 enum nl80211_iftype iftype, u8 *bssid, bool qos); 3559 enum nl80211_iftype iftype, const u8 *bssid,
3560 bool qos);
3492 3561
3493/** 3562/**
3494 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 3563 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
@@ -3600,7 +3669,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
3600 * default channel settings will be disregarded. If no rule is found for a 3669 * default channel settings will be disregarded. If no rule is found for a
3601 * channel on the regulatory domain the channel will be disabled. 3670 * channel on the regulatory domain the channel will be disabled.
3602 * Drivers using this for a wiphy should also set the wiphy flag 3671 * Drivers using this for a wiphy should also set the wiphy flag
3603 * WIPHY_FLAG_CUSTOM_REGULATORY or cfg80211 will set it for the wiphy 3672 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
3604 * that called this helper. 3673 * that called this helper.
3605 */ 3674 */
3606void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 3675void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
@@ -4289,7 +4358,7 @@ void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
4289 * and not try to connect to any AP any more. 4358 * and not try to connect to any AP any more.
4290 */ 4359 */
4291void cfg80211_disconnected(struct net_device *dev, u16 reason, 4360void cfg80211_disconnected(struct net_device *dev, u16 reason,
4292 u8 *ie, size_t ie_len, gfp_t gfp); 4361 const u8 *ie, size_t ie_len, gfp_t gfp);
4293 4362
4294/** 4363/**
4295 * cfg80211_ready_on_channel - notification of remain_on_channel start 4364 * cfg80211_ready_on_channel - notification of remain_on_channel start
@@ -4543,12 +4612,14 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
4543 * cfg80211_reg_can_beacon - check if beaconing is allowed 4612 * cfg80211_reg_can_beacon - check if beaconing is allowed
4544 * @wiphy: the wiphy 4613 * @wiphy: the wiphy
4545 * @chandef: the channel definition 4614 * @chandef: the channel definition
4615 * @iftype: interface type
4546 * 4616 *
4547 * Return: %true if there is no secondary channel or the secondary channel(s) 4617 * Return: %true if there is no secondary channel or the secondary channel(s)
4548 * can be used for beaconing (i.e. is not a radar channel etc.) 4618 * can be used for beaconing (i.e. is not a radar channel etc.)
4549 */ 4619 */
4550bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 4620bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
4551 struct cfg80211_chan_def *chandef); 4621 struct cfg80211_chan_def *chandef,
4622 enum nl80211_iftype iftype);
4552 4623
4553/* 4624/*
4554 * cfg80211_ch_switch_notify - update wdev channel and notify userspace 4625 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
@@ -4694,6 +4765,84 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
4694 */ 4765 */
4695unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 4766unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
4696 4767
4768/**
4769 * cfg80211_check_combinations - check interface combinations
4770 *
4771 * @wiphy: the wiphy
4772 * @num_different_channels: the number of different channels we want
4773 * to use for verification
4774 * @radar_detect: a bitmap where each bit corresponds to a channel
4775 * width where radar detection is needed, as in the definition of
4776 * &struct ieee80211_iface_combination.@radar_detect_widths
4777 * @iftype_num: array with the numbers of interfaces of each interface
4778 * type. The index is the interface type as specified in &enum
4779 * nl80211_iftype.
4780 *
4781 * This function can be called by the driver to check whether a
4782 * combination of interfaces and their types are allowed according to
4783 * the interface combinations.
4784 */
4785int cfg80211_check_combinations(struct wiphy *wiphy,
4786 const int num_different_channels,
4787 const u8 radar_detect,
4788 const int iftype_num[NUM_NL80211_IFTYPES]);
4789
4790/**
4791 * cfg80211_iter_combinations - iterate over matching combinations
4792 *
4793 * @wiphy: the wiphy
4794 * @num_different_channels: the number of different channels we want
4795 * to use for verification
4796 * @radar_detect: a bitmap where each bit corresponds to a channel
4797 * width where radar detection is needed, as in the definition of
4798 * &struct ieee80211_iface_combination.@radar_detect_widths
4799 * @iftype_num: array with the numbers of interfaces of each interface
4800 * type. The index is the interface type as specified in &enum
4801 * nl80211_iftype.
4802 * @iter: function to call for each matching combination
4803 * @data: pointer to pass to iter function
4804 *
4805 * This function can be called by the driver to check what possible
4806 * combinations it fits in at a given moment, e.g. for channel switching
4807 * purposes.
4808 */
4809int cfg80211_iter_combinations(struct wiphy *wiphy,
4810 const int num_different_channels,
4811 const u8 radar_detect,
4812 const int iftype_num[NUM_NL80211_IFTYPES],
4813 void (*iter)(const struct ieee80211_iface_combination *c,
4814 void *data),
4815 void *data);
4816
4817/*
4818 * cfg80211_stop_iface - trigger interface disconnection
4819 *
4820 * @wiphy: the wiphy
4821 * @wdev: wireless device
4822 * @gfp: context flags
4823 *
4824 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
4825 * disconnected.
4826 *
4827 * Note: This doesn't need any locks and is asynchronous.
4828 */
4829void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
4830 gfp_t gfp);
4831
4832/**
4833 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
4834 * @wiphy: the wiphy to shut down
4835 *
4836 * This function shuts down all interfaces belonging to this wiphy by
4837 * calling dev_close() (and treating non-netdev interfaces as needed).
4838 * It shouldn't really be used unless there are some fatal device errors
4839 * that really can't be recovered in any other way.
4840 *
4841 * Callers must hold the RTNL and be able to deal with callbacks into
4842 * the driver while the function is running.
4843 */
4844void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
4845
4697/* Logging, debugging and troubleshooting/diagnostic helpers. */ 4846/* Logging, debugging and troubleshooting/diagnostic helpers. */
4698 4847
4699/* wiphy_printk helpers, similar to dev_printk */ 4848/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/checksum.h b/include/net/checksum.h
index a28f4e0f6251..87cb1903640d 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -57,12 +57,14 @@ static __inline__ __wsum csum_and_copy_to_user
57} 57}
58#endif 58#endif
59 59
60#ifndef HAVE_ARCH_CSUM_ADD
60static inline __wsum csum_add(__wsum csum, __wsum addend) 61static inline __wsum csum_add(__wsum csum, __wsum addend)
61{ 62{
62 u32 res = (__force u32)csum; 63 u32 res = (__force u32)csum;
63 res += (__force u32)addend; 64 res += (__force u32)addend;
64 return (__force __wsum)(res + (res < (__force u32)addend)); 65 return (__force __wsum)(res + (res < (__force u32)addend));
65} 66}
67#endif
66 68
67static inline __wsum csum_sub(__wsum csum, __wsum addend) 69static inline __wsum csum_sub(__wsum csum, __wsum addend)
68{ 70{
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 7828ebf99ee1..6efce384451e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -181,6 +181,11 @@ struct dsa_switch_driver {
181void register_switch_driver(struct dsa_switch_driver *type); 181void register_switch_driver(struct dsa_switch_driver *type);
182void unregister_switch_driver(struct dsa_switch_driver *type); 182void unregister_switch_driver(struct dsa_switch_driver *type);
183 183
184static inline void *ds_to_priv(struct dsa_switch *ds)
185{
186 return (void *)(ds + 1);
187}
188
184/* 189/*
185 * The original DSA tag format and some other tag formats have no 190 * The original DSA tag format and some other tag formats have no
186 * ethertype, which means that we need to add a little hack to the 191 * ethertype, which means that we need to add a little hack to the
diff --git a/include/net/gre.h b/include/net/gre.h
index 70046a0b0b89..b53182018743 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -37,9 +37,10 @@ void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
37 int hdr_len); 37 int hdr_len);
38 38
39static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb, 39static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb,
40 bool gre_csum) 40 bool csum)
41{ 41{
42 return iptunnel_handle_offloads(skb, gre_csum, SKB_GSO_GRE); 42 return iptunnel_handle_offloads(skb, csum,
43 csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE);
43} 44}
44 45
45 46
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h
index c7ae0ac528dc..0aa7122e8f15 100644
--- a/include/net/ieee802154.h
+++ b/include/net/ieee802154.h
@@ -79,6 +79,15 @@
79#define IEEE802154_SCF_KEY_SHORT_INDEX 2 79#define IEEE802154_SCF_KEY_SHORT_INDEX 2
80#define IEEE802154_SCF_KEY_HW_INDEX 3 80#define IEEE802154_SCF_KEY_HW_INDEX 3
81 81
82#define IEEE802154_SCF_SECLEVEL_NONE 0
83#define IEEE802154_SCF_SECLEVEL_MIC32 1
84#define IEEE802154_SCF_SECLEVEL_MIC64 2
85#define IEEE802154_SCF_SECLEVEL_MIC128 3
86#define IEEE802154_SCF_SECLEVEL_ENC 4
87#define IEEE802154_SCF_SECLEVEL_ENC_MIC32 5
88#define IEEE802154_SCF_SECLEVEL_ENC_MIC64 6
89#define IEEE802154_SCF_SECLEVEL_ENC_MIC128 7
90
82/* MAC footer size */ 91/* MAC footer size */
83#define IEEE802154_MFR_SIZE 2 /* 2 octets */ 92#define IEEE802154_MFR_SIZE 2 /* 2 octets */
84 93
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 5a719ca892f4..3b53c8e405e4 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -27,6 +27,7 @@
27#ifndef IEEE802154_NETDEVICE_H 27#ifndef IEEE802154_NETDEVICE_H
28#define IEEE802154_NETDEVICE_H 28#define IEEE802154_NETDEVICE_H
29 29
30#include <net/ieee802154.h>
30#include <net/af_ieee802154.h> 31#include <net/af_ieee802154.h>
31#include <linux/netdevice.h> 32#include <linux/netdevice.h>
32#include <linux/skbuff.h> 33#include <linux/skbuff.h>
@@ -114,6 +115,34 @@ int ieee802154_hdr_pull(struct sk_buff *skb, struct ieee802154_hdr *hdr);
114int ieee802154_hdr_peek_addrs(const struct sk_buff *skb, 115int ieee802154_hdr_peek_addrs(const struct sk_buff *skb,
115 struct ieee802154_hdr *hdr); 116 struct ieee802154_hdr *hdr);
116 117
118/* parses the full 802.15.4 header a given skb and stores them into hdr,
119 * performing pan id decompression and length checks to be suitable for use in
120 * header_ops.parse
121 */
122int ieee802154_hdr_peek(const struct sk_buff *skb, struct ieee802154_hdr *hdr);
123
124int ieee802154_max_payload(const struct ieee802154_hdr *hdr);
125
126static inline int
127ieee802154_sechdr_authtag_len(const struct ieee802154_sechdr *sec)
128{
129 switch (sec->level) {
130 case IEEE802154_SCF_SECLEVEL_MIC32:
131 case IEEE802154_SCF_SECLEVEL_ENC_MIC32:
132 return 4;
133 case IEEE802154_SCF_SECLEVEL_MIC64:
134 case IEEE802154_SCF_SECLEVEL_ENC_MIC64:
135 return 8;
136 case IEEE802154_SCF_SECLEVEL_MIC128:
137 case IEEE802154_SCF_SECLEVEL_ENC_MIC128:
138 return 16;
139 case IEEE802154_SCF_SECLEVEL_NONE:
140 case IEEE802154_SCF_SECLEVEL_ENC:
141 default:
142 return 0;
143 }
144}
145
117static inline int ieee802154_hdr_length(struct sk_buff *skb) 146static inline int ieee802154_hdr_length(struct sk_buff *skb)
118{ 147{
119 struct ieee802154_hdr hdr; 148 struct ieee802154_hdr hdr;
@@ -193,8 +222,12 @@ static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa,
193 */ 222 */
194struct ieee802154_mac_cb { 223struct ieee802154_mac_cb {
195 u8 lqi; 224 u8 lqi;
196 u8 flags; 225 u8 type;
197 u8 seq; 226 bool ackreq;
227 bool secen;
228 bool secen_override;
229 u8 seclevel;
230 bool seclevel_override;
198 struct ieee802154_addr source; 231 struct ieee802154_addr source;
199 struct ieee802154_addr dest; 232 struct ieee802154_addr dest;
200}; 233};
@@ -204,25 +237,96 @@ static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
204 return (struct ieee802154_mac_cb *)skb->cb; 237 return (struct ieee802154_mac_cb *)skb->cb;
205} 238}
206 239
207#define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1) 240static inline struct ieee802154_mac_cb *mac_cb_init(struct sk_buff *skb)
208
209#define MAC_CB_FLAG_ACKREQ (1 << 3)
210#define MAC_CB_FLAG_SECEN (1 << 4)
211
212static inline bool mac_cb_is_ackreq(struct sk_buff *skb)
213{ 241{
214 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ; 242 BUILD_BUG_ON(sizeof(struct ieee802154_mac_cb) > sizeof(skb->cb));
215}
216 243
217static inline bool mac_cb_is_secen(struct sk_buff *skb) 244 memset(skb->cb, 0, sizeof(struct ieee802154_mac_cb));
218{ 245 return mac_cb(skb);
219 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
220} 246}
221 247
222static inline int mac_cb_type(struct sk_buff *skb) 248#define IEEE802154_LLSEC_KEY_SIZE 16
223{ 249
224 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK; 250struct ieee802154_llsec_key_id {
225} 251 u8 mode;
252 u8 id;
253 union {
254 struct ieee802154_addr device_addr;
255 __le32 short_source;
256 __le64 extended_source;
257 };
258};
259
260struct ieee802154_llsec_key {
261 u8 frame_types;
262 u32 cmd_frame_ids;
263 u8 key[IEEE802154_LLSEC_KEY_SIZE];
264};
265
266struct ieee802154_llsec_key_entry {
267 struct list_head list;
268
269 struct ieee802154_llsec_key_id id;
270 struct ieee802154_llsec_key *key;
271};
272
273struct ieee802154_llsec_device_key {
274 struct list_head list;
275
276 struct ieee802154_llsec_key_id key_id;
277 u32 frame_counter;
278};
279
280enum {
281 IEEE802154_LLSEC_DEVKEY_IGNORE,
282 IEEE802154_LLSEC_DEVKEY_RESTRICT,
283 IEEE802154_LLSEC_DEVKEY_RECORD,
284
285 __IEEE802154_LLSEC_DEVKEY_MAX,
286};
287
288struct ieee802154_llsec_device {
289 struct list_head list;
290
291 __le16 pan_id;
292 __le16 short_addr;
293 __le64 hwaddr;
294 u32 frame_counter;
295 bool seclevel_exempt;
296
297 u8 key_mode;
298 struct list_head keys;
299};
300
301struct ieee802154_llsec_seclevel {
302 struct list_head list;
303
304 u8 frame_type;
305 u8 cmd_frame_id;
306 bool device_override;
307 u32 sec_levels;
308};
309
310struct ieee802154_llsec_params {
311 bool enabled;
312
313 __be32 frame_counter;
314 u8 out_level;
315 struct ieee802154_llsec_key_id out_key;
316
317 __le64 default_key_source;
318
319 __le16 pan_id;
320 __le64 hwaddr;
321 __le64 coord_hwaddr;
322 __le16 coord_shortaddr;
323};
324
325struct ieee802154_llsec_table {
326 struct list_head keys;
327 struct list_head devices;
328 struct list_head security_levels;
329};
226 330
227#define IEEE802154_MAC_SCAN_ED 0 331#define IEEE802154_MAC_SCAN_ED 0
228#define IEEE802154_MAC_SCAN_ACTIVE 1 332#define IEEE802154_MAC_SCAN_ACTIVE 1
@@ -242,6 +346,53 @@ struct ieee802154_mac_params {
242}; 346};
243 347
244struct wpan_phy; 348struct wpan_phy;
349
350enum {
351 IEEE802154_LLSEC_PARAM_ENABLED = 1 << 0,
352 IEEE802154_LLSEC_PARAM_FRAME_COUNTER = 1 << 1,
353 IEEE802154_LLSEC_PARAM_OUT_LEVEL = 1 << 2,
354 IEEE802154_LLSEC_PARAM_OUT_KEY = 1 << 3,
355 IEEE802154_LLSEC_PARAM_KEY_SOURCE = 1 << 4,
356 IEEE802154_LLSEC_PARAM_PAN_ID = 1 << 5,
357 IEEE802154_LLSEC_PARAM_HWADDR = 1 << 6,
358 IEEE802154_LLSEC_PARAM_COORD_HWADDR = 1 << 7,
359 IEEE802154_LLSEC_PARAM_COORD_SHORTADDR = 1 << 8,
360};
361
362struct ieee802154_llsec_ops {
363 int (*get_params)(struct net_device *dev,
364 struct ieee802154_llsec_params *params);
365 int (*set_params)(struct net_device *dev,
366 const struct ieee802154_llsec_params *params,
367 int changed);
368
369 int (*add_key)(struct net_device *dev,
370 const struct ieee802154_llsec_key_id *id,
371 const struct ieee802154_llsec_key *key);
372 int (*del_key)(struct net_device *dev,
373 const struct ieee802154_llsec_key_id *id);
374
375 int (*add_dev)(struct net_device *dev,
376 const struct ieee802154_llsec_device *llsec_dev);
377 int (*del_dev)(struct net_device *dev, __le64 dev_addr);
378
379 int (*add_devkey)(struct net_device *dev,
380 __le64 device_addr,
381 const struct ieee802154_llsec_device_key *key);
382 int (*del_devkey)(struct net_device *dev,
383 __le64 device_addr,
384 const struct ieee802154_llsec_device_key *key);
385
386 int (*add_seclevel)(struct net_device *dev,
387 const struct ieee802154_llsec_seclevel *sl);
388 int (*del_seclevel)(struct net_device *dev,
389 const struct ieee802154_llsec_seclevel *sl);
390
391 void (*lock_table)(struct net_device *dev);
392 void (*get_table)(struct net_device *dev,
393 struct ieee802154_llsec_table **t);
394 void (*unlock_table)(struct net_device *dev);
395};
245/* 396/*
246 * This should be located at net_device->ml_priv 397 * This should be located at net_device->ml_priv
247 * 398 *
@@ -272,6 +423,8 @@ struct ieee802154_mlme_ops {
272 void (*get_mac_params)(struct net_device *dev, 423 void (*get_mac_params)(struct net_device *dev,
273 struct ieee802154_mac_params *params); 424 struct ieee802154_mac_params *params);
274 425
426 struct ieee802154_llsec_ops *llsec;
427
275 /* The fields below are required. */ 428 /* The fields below are required. */
276 429
277 struct wpan_phy *(*get_phy)(const struct net_device *dev); 430 struct wpan_phy *(*get_phy)(const struct net_device *dev);
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 3bd22795c3e2..84b20835b736 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -150,7 +150,7 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
150} 150}
151 151
152/* 152/*
153 * RFC 6080 4.2 153 * RFC 6040 4.2
154 * To decapsulate the inner header at the tunnel egress, a compliant 154 * To decapsulate the inner header at the tunnel egress, a compliant
155 * tunnel egress MUST set the outgoing ECN field to the codepoint at the 155 * tunnel egress MUST set the outgoing ECN field to the codepoint at the
156 * intersection of the appropriate arriving inner header (row) and outer 156 * intersection of the appropriate arriving inner header (row) and outer
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 1bdb47715def..dd1950a7e273 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -292,12 +292,12 @@ static inline struct sock *inet_lookup_listener(struct net *net,
292#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 292#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
293 const __addrpair __name = (__force __addrpair) ( \ 293 const __addrpair __name = (__force __addrpair) ( \
294 (((__force __u64)(__be32)(__saddr)) << 32) | \ 294 (((__force __u64)(__be32)(__saddr)) << 32) | \
295 ((__force __u64)(__be32)(__daddr))); 295 ((__force __u64)(__be32)(__daddr)))
296#else /* __LITTLE_ENDIAN */ 296#else /* __LITTLE_ENDIAN */
297#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 297#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
298 const __addrpair __name = (__force __addrpair) ( \ 298 const __addrpair __name = (__force __addrpair) ( \
299 (((__force __u64)(__be32)(__daddr)) << 32) | \ 299 (((__force __u64)(__be32)(__daddr)) << 32) | \
300 ((__force __u64)(__be32)(__saddr))); 300 ((__force __u64)(__be32)(__saddr)))
301#endif /* __BIG_ENDIAN */ 301#endif /* __BIG_ENDIAN */
302#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 302#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
303 (((__sk)->sk_portpair == (__ports)) && \ 303 (((__sk)->sk_portpair == (__ports)) && \
@@ -306,7 +306,9 @@ static inline struct sock *inet_lookup_listener(struct net *net,
306 ((__sk)->sk_bound_dev_if == (__dif))) && \ 306 ((__sk)->sk_bound_dev_if == (__dif))) && \
307 net_eq(sock_net(__sk), (__net))) 307 net_eq(sock_net(__sk), (__net)))
308#else /* 32-bit arch */ 308#else /* 32-bit arch */
309#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 309#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
310 const int __name __deprecated __attribute__((unused))
311
310#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 312#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
311 (((__sk)->sk_portpair == (__ports)) && \ 313 (((__sk)->sk_portpair == (__ports)) && \
312 ((__sk)->sk_daddr == (__saddr)) && \ 314 ((__sk)->sk_daddr == (__saddr)) && \
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 1833c3f389ee..b1edf17bec01 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -90,6 +90,7 @@ struct inet_request_sock {
90 kmemcheck_bitfield_end(flags); 90 kmemcheck_bitfield_end(flags);
91 struct ip_options_rcu *opt; 91 struct ip_options_rcu *opt;
92 struct sk_buff *pktopts; 92 struct sk_buff *pktopts;
93 u32 ir_mark;
93}; 94};
94 95
95static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) 96static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
@@ -97,6 +98,15 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
97 return (struct inet_request_sock *)sk; 98 return (struct inet_request_sock *)sk;
98} 99}
99 100
101static inline u32 inet_request_mark(struct sock *sk, struct sk_buff *skb)
102{
103 if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept) {
104 return skb->mark;
105 } else {
106 return sk->sk_mark;
107 }
108}
109
100struct inet_cork { 110struct inet_cork {
101 unsigned int flags; 111 unsigned int flags;
102 __be32 addr; 112 __be32 addr;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 058271bde27a..01d590ee5e7e 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -41,14 +41,13 @@ struct inet_peer {
41 struct rcu_head gc_rcu; 41 struct rcu_head gc_rcu;
42 }; 42 };
43 /* 43 /*
44 * Once inet_peer is queued for deletion (refcnt == -1), following fields 44 * Once inet_peer is queued for deletion (refcnt == -1), following field
45 * are not available: rid, ip_id_count 45 * is not available: rid
46 * We can share memory with rcu_head to help keep inet_peer small. 46 * We can share memory with rcu_head to help keep inet_peer small.
47 */ 47 */
48 union { 48 union {
49 struct { 49 struct {
50 atomic_t rid; /* Frag reception counter */ 50 atomic_t rid; /* Frag reception counter */
51 atomic_t ip_id_count; /* IP ID for the next packet */
52 }; 51 };
53 struct rcu_head rcu; 52 struct rcu_head rcu;
54 struct inet_peer *gc_next; 53 struct inet_peer *gc_next;
@@ -165,21 +164,11 @@ bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
165void inetpeer_invalidate_tree(struct inet_peer_base *); 164void inetpeer_invalidate_tree(struct inet_peer_base *);
166 165
167/* 166/*
168 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 167 * temporary check to make sure we dont access rid, tcp_ts,
169 * tcp_ts_stamp if no refcount is taken on inet_peer 168 * tcp_ts_stamp if no refcount is taken on inet_peer
170 */ 169 */
171static inline void inet_peer_refcheck(const struct inet_peer *p) 170static inline void inet_peer_refcheck(const struct inet_peer *p)
172{ 171{
173 WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0); 172 WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0);
174} 173}
175
176
177/* can be called with or without local BH being disabled */
178static inline int inet_getid(struct inet_peer *p, int more)
179{
180 more++;
181 inet_peer_refcheck(p);
182 return atomic_add_return(more, &p->ip_id_count) - more;
183}
184
185#endif /* _NET_INETPEER_H */ 174#endif /* _NET_INETPEER_H */
diff --git a/include/net/ip.h b/include/net/ip.h
index 3ec2b0fb9d83..7596eb22e1ce 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -196,35 +196,31 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
196#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 196#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
197#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 197#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
198 198
199unsigned long snmp_fold_field(void __percpu *mib[], int offt); 199unsigned long snmp_fold_field(void __percpu *mib, int offt);
200#if BITS_PER_LONG==32 200#if BITS_PER_LONG==32
201u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off); 201u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off);
202#else 202#else
203static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off) 203static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_off)
204{ 204{
205 return snmp_fold_field(mib, offt); 205 return snmp_fold_field(mib, offt);
206} 206}
207#endif 207#endif
208int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
209
210static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
211{
212 int i;
213
214 BUG_ON(ptr == NULL);
215 for (i = 0; i < SNMP_ARRAY_SZ; i++) {
216 free_percpu(ptr[i]);
217 ptr[i] = NULL;
218 }
219}
220 208
221void inet_get_local_port_range(struct net *net, int *low, int *high); 209void inet_get_local_port_range(struct net *net, int *low, int *high);
222 210
223extern unsigned long *sysctl_local_reserved_ports; 211#ifdef CONFIG_SYSCTL
224static inline int inet_is_reserved_local_port(int port) 212static inline int inet_is_local_reserved_port(struct net *net, int port)
225{ 213{
226 return test_bit(port, sysctl_local_reserved_ports); 214 if (!net->ipv4.sysctl_local_reserved_ports)
215 return 0;
216 return test_bit(port, net->ipv4.sysctl_local_reserved_ports);
227} 217}
218#else
219static inline int inet_is_local_reserved_port(struct net *net, int port)
220{
221 return 0;
222}
223#endif
228 224
229extern int sysctl_ip_nonlocal_bind; 225extern int sysctl_ip_nonlocal_bind;
230 226
@@ -243,6 +239,9 @@ void ipfrag_init(void);
243 239
244void ip_static_sysctl_init(void); 240void ip_static_sysctl_init(void);
245 241
242#define IP4_REPLY_MARK(net, mark) \
243 ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0)
244
246static inline bool ip_is_fragment(const struct iphdr *iph) 245static inline bool ip_is_fragment(const struct iphdr *iph)
247{ 246{
248 return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; 247 return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0;
@@ -281,7 +280,7 @@ static inline bool ip_sk_use_pmtu(const struct sock *sk)
281 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; 280 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
282} 281}
283 282
284static inline bool ip_sk_local_df(const struct sock *sk) 283static inline bool ip_sk_ignore_df(const struct sock *sk)
285{ 284{
286 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO || 285 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO ||
287 inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT; 286 inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT;
@@ -310,36 +309,39 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
310 } 309 }
311} 310}
312 311
313void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); 312u32 ip_idents_reserve(u32 hash, int segs);
313void __ip_select_ident(struct iphdr *iph, int segs);
314 314
315static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk) 315static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs)
316{ 316{
317 struct iphdr *iph = ip_hdr(skb); 317 struct iphdr *iph = ip_hdr(skb);
318 318
319 if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { 319 if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) {
320 /* This is only to work around buggy Windows95/2000 320 /* This is only to work around buggy Windows95/2000
321 * VJ compression implementations. If the ID field 321 * VJ compression implementations. If the ID field
322 * does not change, they drop every other packet in 322 * does not change, they drop every other packet in
323 * a TCP stream using header compression. 323 * a TCP stream using header compression.
324 */ 324 */
325 iph->id = (sk && inet_sk(sk)->inet_daddr) ? 325 if (sk && inet_sk(sk)->inet_daddr) {
326 htons(inet_sk(sk)->inet_id++) : 0; 326 iph->id = htons(inet_sk(sk)->inet_id);
327 } else 327 inet_sk(sk)->inet_id += segs;
328 __ip_select_ident(iph, dst, 0); 328 } else {
329 iph->id = 0;
330 }
331 } else {
332 __ip_select_ident(iph, segs);
333 }
329} 334}
330 335
331static inline void ip_select_ident_more(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk, int more) 336static inline void ip_select_ident(struct sk_buff *skb, struct sock *sk)
332{ 337{
333 struct iphdr *iph = ip_hdr(skb); 338 ip_select_ident_segs(skb, sk, 1);
339}
334 340
335 if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { 341static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto)
336 if (sk && inet_sk(sk)->inet_daddr) { 342{
337 iph->id = htons(inet_sk(sk)->inet_id); 343 return csum_tcpudp_nofold(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
338 inet_sk(sk)->inet_id += 1 + more; 344 skb->len, proto, 0);
339 } else
340 iph->id = 0;
341 } else
342 __ip_select_ident(iph, dst, more);
343} 345}
344 346
345/* 347/*
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 9e3c540c1b11..55236cb71174 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -41,6 +41,13 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
41 __wsum csum); 41 __wsum csum);
42#endif 42#endif
43 43
44static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto)
45{
46 return ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
47 &ipv6_hdr(skb)->daddr,
48 skb->len, proto, 0));
49}
50
44static __inline__ __sum16 tcp_v6_check(int len, 51static __inline__ __sum16 tcp_v6_check(int len,
45 const struct in6_addr *saddr, 52 const struct in6_addr *saddr,
46 const struct in6_addr *daddr, 53 const struct in6_addr *daddr,
@@ -75,5 +82,17 @@ static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
75} 82}
76#endif 83#endif
77 84
85static inline __sum16 udp_v6_check(int len,
86 const struct in6_addr *saddr,
87 const struct in6_addr *daddr,
88 __wsum base)
89{
90 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_UDP, base);
91}
92
93void udp6_set_csum(bool nocheck, struct sk_buff *skb,
94 const struct in6_addr *saddr,
95 const struct in6_addr *daddr, int len);
96
78int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); 97int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
79#endif 98#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 216cecce65e9..1d09b46c1e48 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -186,7 +186,7 @@ static inline bool ip6_sk_accept_pmtu(const struct sock *sk)
186 inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT; 186 inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT;
187} 187}
188 188
189static inline bool ip6_sk_local_df(const struct sock *sk) 189static inline bool ip6_sk_ignore_df(const struct sock *sk)
190{ 190{
191 return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO || 191 return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO ||
192 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT; 192 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index d640925bc454..574337fe72dd 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -113,6 +113,9 @@ struct frag_hdr {
113#define IP6_MF 0x0001 113#define IP6_MF 0x0001
114#define IP6_OFFSET 0xFFF8 114#define IP6_OFFSET 0xFFF8
115 115
116#define IP6_REPLY_MARK(net, mark) \
117 ((net)->ipv6.sysctl.fwmark_reflect ? (mark) : 0)
118
116#include <net/sock.h> 119#include <net/sock.h>
117 120
118/* sysctls */ 121/* sysctls */
@@ -583,6 +586,11 @@ static inline bool ipv6_addr_orchid(const struct in6_addr *a)
583 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); 586 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010);
584} 587}
585 588
589static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
590{
591 return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
592}
593
586static inline void ipv6_addr_set_v4mapped(const __be32 addr, 594static inline void ipv6_addr_set_v4mapped(const __be32 addr,
587 struct in6_addr *v4mapped) 595 struct in6_addr *v4mapped)
588{ 596{
@@ -660,10 +668,22 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
660 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 668 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
661} 669}
662 670
663void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
664
665int ip6_dst_hoplimit(struct dst_entry *dst); 671int ip6_dst_hoplimit(struct dst_entry *dst);
666 672
673static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6,
674 struct dst_entry *dst)
675{
676 int hlimit;
677
678 if (ipv6_addr_is_multicast(&fl6->daddr))
679 hlimit = np->mcast_hops;
680 else
681 hlimit = np->hop_limit;
682 if (hlimit < 0)
683 hlimit = ip6_dst_hoplimit(dst);
684 return hlimit;
685}
686
667/* 687/*
668 * Header manipulation 688 * Header manipulation
669 */ 689 */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 8248e3909fdf..421b6ecb4b2c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -189,6 +189,43 @@ struct ieee80211_chanctx_conf {
189}; 189};
190 190
191/** 191/**
192 * enum ieee80211_chanctx_switch_mode - channel context switch mode
193 * @CHANCTX_SWMODE_REASSIGN_VIF: Both old and new contexts already
194 * exist (and will continue to exist), but the virtual interface
195 * needs to be switched from one to the other.
196 * @CHANCTX_SWMODE_SWAP_CONTEXTS: The old context exists but will stop
197 * to exist with this call, the new context doesn't exist but
198 * will be active after this call, the virtual interface switches
199 * from the old to the new (note that the driver may of course
200 * implement this as an on-the-fly chandef switch of the existing
201 * hardware context, but the mac80211 pointer for the old context
202 * will cease to exist and only the new one will later be used
203 * for changes/removal.)
204 */
205enum ieee80211_chanctx_switch_mode {
206 CHANCTX_SWMODE_REASSIGN_VIF,
207 CHANCTX_SWMODE_SWAP_CONTEXTS,
208};
209
210/**
211 * struct ieee80211_vif_chanctx_switch - vif chanctx switch information
212 *
213 * This is structure is used to pass information about a vif that
214 * needs to switch from one chanctx to another. The
215 * &ieee80211_chanctx_switch_mode defines how the switch should be
216 * done.
217 *
218 * @vif: the vif that should be switched from old_ctx to new_ctx
219 * @old_ctx: the old context to which the vif was assigned
220 * @new_ctx: the new context to which the vif must be assigned
221 */
222struct ieee80211_vif_chanctx_switch {
223 struct ieee80211_vif *vif;
224 struct ieee80211_chanctx_conf *old_ctx;
225 struct ieee80211_chanctx_conf *new_ctx;
226};
227
228/**
192 * enum ieee80211_bss_change - BSS change notification flags 229 * enum ieee80211_bss_change - BSS change notification flags
193 * 230 *
194 * These flags are used with the bss_info_changed() callback 231 * These flags are used with the bss_info_changed() callback
@@ -1113,7 +1150,9 @@ enum ieee80211_vif_flags {
1113 * @addr: address of this interface 1150 * @addr: address of this interface
1114 * @p2p: indicates whether this AP or STA interface is a p2p 1151 * @p2p: indicates whether this AP or STA interface is a p2p
1115 * interface, i.e. a GO or p2p-sta respectively 1152 * interface, i.e. a GO or p2p-sta respectively
1116 * @csa_active: marks whether a channel switch is going on 1153 * @csa_active: marks whether a channel switch is going on. Internally it is
1154 * write-protected by sdata_lock and local->mtx so holding either is fine
1155 * for read access.
1117 * @driver_flags: flags/capabilities the driver has for this interface, 1156 * @driver_flags: flags/capabilities the driver has for this interface,
1118 * these need to be set (or cleared) when the interface is added 1157 * these need to be set (or cleared) when the interface is added
1119 * or, if supported by the driver, the interface type is changed 1158 * or, if supported by the driver, the interface type is changed
@@ -1202,14 +1241,18 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
1202 * fall back to software crypto. Note that this flag deals only with 1241 * fall back to software crypto. Note that this flag deals only with
1203 * RX, if your crypto engine can't deal with TX you can also set the 1242 * RX, if your crypto engine can't deal with TX you can also set the
1204 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. 1243 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
1244 * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
1245 * driver for a CCMP key to indicate that is requires IV generation
1246 * only for managment frames (MFP).
1205 */ 1247 */
1206enum ieee80211_key_flags { 1248enum ieee80211_key_flags {
1207 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 1249 IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0),
1208 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 1250 IEEE80211_KEY_FLAG_GENERATE_IV = BIT(1),
1209 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 1251 IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(2),
1210 IEEE80211_KEY_FLAG_SW_MGMT_TX = 1<<4, 1252 IEEE80211_KEY_FLAG_PAIRWISE = BIT(3),
1211 IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, 1253 IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(4),
1212 IEEE80211_KEY_FLAG_RX_MGMT = 1<<6, 1254 IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(5),
1255 IEEE80211_KEY_FLAG_RX_MGMT = BIT(6),
1213}; 1256};
1214 1257
1215/** 1258/**
@@ -1370,6 +1413,7 @@ struct ieee80211_sta_rates {
1370 * the station moves to associated state. 1413 * the station moves to associated state.
1371 * @smps_mode: current SMPS mode (off, static or dynamic) 1414 * @smps_mode: current SMPS mode (off, static or dynamic)
1372 * @rates: rate control selection table 1415 * @rates: rate control selection table
1416 * @tdls: indicates whether the STA is a TDLS peer
1373 */ 1417 */
1374struct ieee80211_sta { 1418struct ieee80211_sta {
1375 u32 supp_rates[IEEE80211_NUM_BANDS]; 1419 u32 supp_rates[IEEE80211_NUM_BANDS];
@@ -1384,6 +1428,7 @@ struct ieee80211_sta {
1384 enum ieee80211_sta_rx_bandwidth bandwidth; 1428 enum ieee80211_sta_rx_bandwidth bandwidth;
1385 enum ieee80211_smps_mode smps_mode; 1429 enum ieee80211_smps_mode smps_mode;
1386 struct ieee80211_sta_rates __rcu *rates; 1430 struct ieee80211_sta_rates __rcu *rates;
1431 bool tdls;
1387 1432
1388 /* must be last */ 1433 /* must be last */
1389 u8 drv_priv[0] __aligned(sizeof(void *)); 1434 u8 drv_priv[0] __aligned(sizeof(void *));
@@ -1555,6 +1600,12 @@ struct ieee80211_tx_control {
1555 * for a single active channel while using channel contexts. When support 1600 * for a single active channel while using channel contexts. When support
1556 * is not enabled the default action is to disconnect when getting the 1601 * is not enabled the default action is to disconnect when getting the
1557 * CSA frame. 1602 * CSA frame.
1603 *
1604 * @IEEE80211_HW_CHANGE_RUNNING_CHANCTX: The hardware can change a
1605 * channel context on-the-fly. This is needed for channel switch
1606 * on single-channel hardware. It can also be used as an
1607 * optimization in certain channel switch cases with
1608 * multi-channel.
1558 */ 1609 */
1559enum ieee80211_hw_flags { 1610enum ieee80211_hw_flags {
1560 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1611 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1586,6 +1637,7 @@ enum ieee80211_hw_flags {
1586 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1637 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1587 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, 1638 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27,
1588 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, 1639 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28,
1640 IEEE80211_HW_CHANGE_RUNNING_CHANCTX = 1<<29,
1589}; 1641};
1590 1642
1591/** 1643/**
@@ -2609,6 +2661,7 @@ enum ieee80211_roc_type {
2609 * of queues to flush, which is useful if different virtual interfaces 2661 * of queues to flush, which is useful if different virtual interfaces
2610 * use different hardware queues; it may also indicate all queues. 2662 * use different hardware queues; it may also indicate all queues.
2611 * If the parameter @drop is set to %true, pending frames may be dropped. 2663 * If the parameter @drop is set to %true, pending frames may be dropped.
2664 * Note that vif can be NULL.
2612 * The callback can sleep. 2665 * The callback can sleep.
2613 * 2666 *
2614 * @channel_switch: Drivers that need (or want) to offload the channel 2667 * @channel_switch: Drivers that need (or want) to offload the channel
@@ -2720,6 +2773,11 @@ enum ieee80211_roc_type {
2720 * to vif. Possible use is for hw queue remapping. 2773 * to vif. Possible use is for hw queue remapping.
2721 * @unassign_vif_chanctx: Notifies device driver about channel context being 2774 * @unassign_vif_chanctx: Notifies device driver about channel context being
2722 * unbound from vif. 2775 * unbound from vif.
2776 * @switch_vif_chanctx: switch a number of vifs from one chanctx to
2777 * another, as specified in the list of
2778 * @ieee80211_vif_chanctx_switch passed to the driver, according
2779 * to the mode defined in &ieee80211_chanctx_switch_mode.
2780 *
2723 * @start_ap: Start operation on the AP interface, this is called after all the 2781 * @start_ap: Start operation on the AP interface, this is called after all the
2724 * information in bss_conf is set and beacon can be retrieved. A channel 2782 * information in bss_conf is set and beacon can be retrieved. A channel
2725 * context is bound before this is called. Note that if the driver uses 2783 * context is bound before this is called. Note that if the driver uses
@@ -2753,6 +2811,10 @@ enum ieee80211_roc_type {
2753 * information in bss_conf is set up and the beacon can be retrieved. A 2811 * information in bss_conf is set up and the beacon can be retrieved. A
2754 * channel context is bound before this is called. 2812 * channel context is bound before this is called.
2755 * @leave_ibss: Leave the IBSS again. 2813 * @leave_ibss: Leave the IBSS again.
2814 *
2815 * @get_expected_throughput: extract the expected throughput towards the
2816 * specified station. The returned value is expressed in Kbps. It returns 0
2817 * if the RC algorithm does not have proper data to provide.
2756 */ 2818 */
2757struct ieee80211_ops { 2819struct ieee80211_ops {
2758 void (*tx)(struct ieee80211_hw *hw, 2820 void (*tx)(struct ieee80211_hw *hw,
@@ -2871,7 +2933,8 @@ struct ieee80211_ops {
2871 struct netlink_callback *cb, 2933 struct netlink_callback *cb,
2872 void *data, int len); 2934 void *data, int len);
2873#endif 2935#endif
2874 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); 2936 void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2937 u32 queues, bool drop);
2875 void (*channel_switch)(struct ieee80211_hw *hw, 2938 void (*channel_switch)(struct ieee80211_hw *hw,
2876 struct ieee80211_channel_switch *ch_switch); 2939 struct ieee80211_channel_switch *ch_switch);
2877 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); 2940 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
@@ -2931,6 +2994,10 @@ struct ieee80211_ops {
2931 void (*unassign_vif_chanctx)(struct ieee80211_hw *hw, 2994 void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
2932 struct ieee80211_vif *vif, 2995 struct ieee80211_vif *vif,
2933 struct ieee80211_chanctx_conf *ctx); 2996 struct ieee80211_chanctx_conf *ctx);
2997 int (*switch_vif_chanctx)(struct ieee80211_hw *hw,
2998 struct ieee80211_vif_chanctx_switch *vifs,
2999 int n_vifs,
3000 enum ieee80211_chanctx_switch_mode mode);
2934 3001
2935 void (*restart_complete)(struct ieee80211_hw *hw); 3002 void (*restart_complete)(struct ieee80211_hw *hw);
2936 3003
@@ -2945,6 +3012,7 @@ struct ieee80211_ops {
2945 3012
2946 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 3013 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2947 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 3014 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
3015 u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
2948}; 3016};
2949 3017
2950/** 3018/**
@@ -3394,6 +3462,47 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
3394 */ 3462 */
3395void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); 3463void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
3396 3464
3465#define IEEE80211_MAX_CSA_COUNTERS_NUM 2
3466
3467/**
3468 * struct ieee80211_mutable_offsets - mutable beacon offsets
3469 * @tim_offset: position of TIM element
3470 * @tim_length: size of TIM element
3471 * @csa_counter_offs: array of IEEE80211_MAX_CSA_COUNTERS_NUM offsets
3472 * to CSA counters. This array can contain zero values which
3473 * should be ignored.
3474 */
3475struct ieee80211_mutable_offsets {
3476 u16 tim_offset;
3477 u16 tim_length;
3478
3479 u16 csa_counter_offs[IEEE80211_MAX_CSA_COUNTERS_NUM];
3480};
3481
3482/**
3483 * ieee80211_beacon_get_template - beacon template generation function
3484 * @hw: pointer obtained from ieee80211_alloc_hw().
3485 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3486 * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
3487 * receive the offsets that may be updated by the driver.
3488 *
3489 * If the driver implements beaconing modes, it must use this function to
3490 * obtain the beacon template.
3491 *
3492 * This function should be used if the beacon frames are generated by the
3493 * device, and then the driver must use the returned beacon as the template
3494 * The driver or the device are responsible to update the DTIM and, when
3495 * applicable, the CSA count.
3496 *
3497 * The driver is responsible for freeing the returned skb.
3498 *
3499 * Return: The beacon template. %NULL on error.
3500 */
3501struct sk_buff *
3502ieee80211_beacon_get_template(struct ieee80211_hw *hw,
3503 struct ieee80211_vif *vif,
3504 struct ieee80211_mutable_offsets *offs);
3505
3397/** 3506/**
3398 * ieee80211_beacon_get_tim - beacon generation function 3507 * ieee80211_beacon_get_tim - beacon generation function
3399 * @hw: pointer obtained from ieee80211_alloc_hw(). 3508 * @hw: pointer obtained from ieee80211_alloc_hw().
@@ -3405,16 +3514,12 @@ void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
3405 * Set to 0 if invalid (in non-AP modes). 3514 * Set to 0 if invalid (in non-AP modes).
3406 * 3515 *
3407 * If the driver implements beaconing modes, it must use this function to 3516 * If the driver implements beaconing modes, it must use this function to
3408 * obtain the beacon frame/template. 3517 * obtain the beacon frame.
3409 * 3518 *
3410 * If the beacon frames are generated by the host system (i.e., not in 3519 * If the beacon frames are generated by the host system (i.e., not in
3411 * hardware/firmware), the driver uses this function to get each beacon 3520 * hardware/firmware), the driver uses this function to get each beacon
3412 * frame from mac80211 -- it is responsible for calling this function 3521 * frame from mac80211 -- it is responsible for calling this function exactly
3413 * before the beacon is needed (e.g. based on hardware interrupt). 3522 * once before the beacon is needed (e.g. based on hardware interrupt).
3414 *
3415 * If the beacon frames are generated by the device, then the driver
3416 * must use the returned beacon as the template and change the TIM IE
3417 * according to the current DTIM parameters/TIM bitmap.
3418 * 3523 *
3419 * The driver is responsible for freeing the returned skb. 3524 * The driver is responsible for freeing the returned skb.
3420 * 3525 *
@@ -3440,6 +3545,20 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
3440} 3545}
3441 3546
3442/** 3547/**
3548 * ieee80211_csa_update_counter - request mac80211 to decrement the csa counter
3549 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3550 *
3551 * The csa counter should be updated after each beacon transmission.
3552 * This function is called implicitly when
3553 * ieee80211_beacon_get/ieee80211_beacon_get_tim are called, however if the
3554 * beacon frames are generated by the device, the driver should call this
3555 * function after each beacon transmission to sync mac80211's csa counters.
3556 *
3557 * Return: new csa counter value
3558 */
3559u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif);
3560
3561/**
3443 * ieee80211_csa_finish - notify mac80211 about channel switch 3562 * ieee80211_csa_finish - notify mac80211 about channel switch
3444 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3563 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3445 * 3564 *
@@ -4467,6 +4586,8 @@ struct rate_control_ops {
4467 void (*add_sta_debugfs)(void *priv, void *priv_sta, 4586 void (*add_sta_debugfs)(void *priv, void *priv_sta,
4468 struct dentry *dir); 4587 struct dentry *dir);
4469 void (*remove_sta_debugfs)(void *priv, void *priv_sta); 4588 void (*remove_sta_debugfs)(void *priv, void *priv_sta);
4589
4590 u32 (*get_expected_throughput)(void *priv_sta);
4470}; 4591};
4471 4592
4472static inline int rate_supported(struct ieee80211_sta *sta, 4593static inline int rate_supported(struct ieee80211_sta *sta,
@@ -4576,7 +4697,9 @@ conf_is_ht40(struct ieee80211_conf *conf)
4576static inline bool 4697static inline bool
4577conf_is_ht(struct ieee80211_conf *conf) 4698conf_is_ht(struct ieee80211_conf *conf)
4578{ 4699{
4579 return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT; 4700 return (conf->chandef.width != NL80211_CHAN_WIDTH_5) &&
4701 (conf->chandef.width != NL80211_CHAN_WIDTH_10) &&
4702 (conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT);
4580} 4703}
4581 4704
4582static inline enum nl80211_iftype 4705static inline enum nl80211_iftype
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 7277caf3743d..47f425464f84 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -203,7 +203,6 @@ struct neigh_table {
203 void (*proxy_redo)(struct sk_buff *skb); 203 void (*proxy_redo)(struct sk_buff *skb);
204 char *id; 204 char *id;
205 struct neigh_parms parms; 205 struct neigh_parms parms;
206 /* HACK. gc_* should follow parms without a gap! */
207 int gc_interval; 206 int gc_interval;
208 int gc_thresh1; 207 int gc_thresh1;
209 int gc_thresh2; 208 int gc_thresh2;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 5f9eb260990f..361d26077196 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -373,6 +373,14 @@ static inline void rt_genid_bump_ipv6(struct net *net)
373} 373}
374#endif 374#endif
375 375
376#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
377static inline struct netns_ieee802154_lowpan *
378net_ieee802154_lowpan(struct net *net)
379{
380 return &net->ieee802154_lowpan;
381}
382#endif
383
376/* For callers who don't really care about whether it's IPv4 or IPv6 */ 384/* For callers who don't really care about whether it's IPv4 or IPv6 */
377static inline void rt_genid_bump_all(struct net *net) 385static inline void rt_genid_bump_all(struct net *net)
378{ 386{
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 07eaaf604092..a71dd333ac68 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -48,6 +48,8 @@ unsigned int nf_nat_setup_info(struct nf_conn *ct,
48extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct, 48extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct,
49 unsigned int hooknum); 49 unsigned int hooknum);
50 50
51struct nf_conn_nat *nf_ct_nat_ext_add(struct nf_conn *ct);
52
51/* Is this tuple already taken? (not by us)*/ 53/* Is this tuple already taken? (not by us)*/
52int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, 54int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
53 const struct nf_conn *ignored_conntrack); 55 const struct nf_conn *ignored_conntrack);
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index e6bc14d8fa9a..c4d86198d3d6 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -6,6 +6,7 @@
6#include <linux/netfilter/nfnetlink.h> 6#include <linux/netfilter/nfnetlink.h>
7#include <linux/netfilter/x_tables.h> 7#include <linux/netfilter/x_tables.h>
8#include <linux/netfilter/nf_tables.h> 8#include <linux/netfilter/nf_tables.h>
9#include <linux/u64_stats_sync.h>
9#include <net/netlink.h> 10#include <net/netlink.h>
10 11
11#define NFT_JUMP_STACK_SIZE 16 12#define NFT_JUMP_STACK_SIZE 16
@@ -72,21 +73,23 @@ static inline void nft_data_debug(const struct nft_data *data)
72 * struct nft_ctx - nf_tables rule/set context 73 * struct nft_ctx - nf_tables rule/set context
73 * 74 *
74 * @net: net namespace 75 * @net: net namespace
75 * @skb: netlink skb
76 * @nlh: netlink message header
77 * @afi: address family info 76 * @afi: address family info
78 * @table: the table the chain is contained in 77 * @table: the table the chain is contained in
79 * @chain: the chain the rule is contained in 78 * @chain: the chain the rule is contained in
80 * @nla: netlink attributes 79 * @nla: netlink attributes
80 * @portid: netlink portID of the original message
81 * @seq: netlink sequence number
82 * @report: notify via unicast netlink message
81 */ 83 */
82struct nft_ctx { 84struct nft_ctx {
83 struct net *net; 85 struct net *net;
84 const struct sk_buff *skb; 86 struct nft_af_info *afi;
85 const struct nlmsghdr *nlh; 87 struct nft_table *table;
86 const struct nft_af_info *afi; 88 struct nft_chain *chain;
87 const struct nft_table *table;
88 const struct nft_chain *chain;
89 const struct nlattr * const *nla; 89 const struct nlattr * const *nla;
90 u32 portid;
91 u32 seq;
92 bool report;
90}; 93};
91 94
92struct nft_data_desc { 95struct nft_data_desc {
@@ -146,6 +149,44 @@ struct nft_set_iter {
146}; 149};
147 150
148/** 151/**
152 * struct nft_set_desc - description of set elements
153 *
154 * @klen: key length
155 * @dlen: data length
156 * @size: number of set elements
157 */
158struct nft_set_desc {
159 unsigned int klen;
160 unsigned int dlen;
161 unsigned int size;
162};
163
164/**
165 * enum nft_set_class - performance class
166 *
167 * @NFT_LOOKUP_O_1: constant, O(1)
168 * @NFT_LOOKUP_O_LOG_N: logarithmic, O(log N)
169 * @NFT_LOOKUP_O_N: linear, O(N)
170 */
171enum nft_set_class {
172 NFT_SET_CLASS_O_1,
173 NFT_SET_CLASS_O_LOG_N,
174 NFT_SET_CLASS_O_N,
175};
176
177/**
178 * struct nft_set_estimate - estimation of memory and performance
179 * characteristics
180 *
181 * @size: required memory
182 * @class: lookup performance class
183 */
184struct nft_set_estimate {
185 unsigned int size;
186 enum nft_set_class class;
187};
188
189/**
149 * struct nft_set_ops - nf_tables set operations 190 * struct nft_set_ops - nf_tables set operations
150 * 191 *
151 * @lookup: look up an element within the set 192 * @lookup: look up an element within the set
@@ -174,7 +215,11 @@ struct nft_set_ops {
174 struct nft_set_iter *iter); 215 struct nft_set_iter *iter);
175 216
176 unsigned int (*privsize)(const struct nlattr * const nla[]); 217 unsigned int (*privsize)(const struct nlattr * const nla[]);
218 bool (*estimate)(const struct nft_set_desc *desc,
219 u32 features,
220 struct nft_set_estimate *est);
177 int (*init)(const struct nft_set *set, 221 int (*init)(const struct nft_set *set,
222 const struct nft_set_desc *desc,
178 const struct nlattr * const nla[]); 223 const struct nlattr * const nla[]);
179 void (*destroy)(const struct nft_set *set); 224 void (*destroy)(const struct nft_set *set);
180 225
@@ -194,6 +239,8 @@ void nft_unregister_set(struct nft_set_ops *ops);
194 * @name: name of the set 239 * @name: name of the set
195 * @ktype: key type (numeric type defined by userspace, not used in the kernel) 240 * @ktype: key type (numeric type defined by userspace, not used in the kernel)
196 * @dtype: data type (verdict or numeric type defined by userspace) 241 * @dtype: data type (verdict or numeric type defined by userspace)
242 * @size: maximum set size
243 * @nelems: number of elements
197 * @ops: set ops 244 * @ops: set ops
198 * @flags: set flags 245 * @flags: set flags
199 * @klen: key length 246 * @klen: key length
@@ -206,6 +253,8 @@ struct nft_set {
206 char name[IFNAMSIZ]; 253 char name[IFNAMSIZ];
207 u32 ktype; 254 u32 ktype;
208 u32 dtype; 255 u32 dtype;
256 u32 size;
257 u32 nelems;
209 /* runtime data below here */ 258 /* runtime data below here */
210 const struct nft_set_ops *ops ____cacheline_aligned; 259 const struct nft_set_ops *ops ____cacheline_aligned;
211 u16 flags; 260 u16 flags;
@@ -222,6 +271,8 @@ static inline void *nft_set_priv(const struct nft_set *set)
222 271
223struct nft_set *nf_tables_set_lookup(const struct nft_table *table, 272struct nft_set *nf_tables_set_lookup(const struct nft_table *table,
224 const struct nlattr *nla); 273 const struct nlattr *nla);
274struct nft_set *nf_tables_set_lookup_byid(const struct net *net,
275 const struct nlattr *nla);
225 276
226/** 277/**
227 * struct nft_set_binding - nf_tables set binding 278 * struct nft_set_binding - nf_tables set binding
@@ -341,18 +392,75 @@ struct nft_rule {
341}; 392};
342 393
343/** 394/**
344 * struct nft_rule_trans - nf_tables rule update in transaction 395 * struct nft_trans - nf_tables object update in transaction
345 * 396 *
397 * @rcu_head: rcu head to defer release of transaction data
346 * @list: used internally 398 * @list: used internally
347 * @ctx: rule context 399 * @msg_type: message type
348 * @rule: rule that needs to be updated 400 * @ctx: transaction context
401 * @data: internal information related to the transaction
349 */ 402 */
350struct nft_rule_trans { 403struct nft_trans {
404 struct rcu_head rcu_head;
351 struct list_head list; 405 struct list_head list;
406 int msg_type;
352 struct nft_ctx ctx; 407 struct nft_ctx ctx;
408 char data[0];
409};
410
411struct nft_trans_rule {
353 struct nft_rule *rule; 412 struct nft_rule *rule;
354}; 413};
355 414
415#define nft_trans_rule(trans) \
416 (((struct nft_trans_rule *)trans->data)->rule)
417
418struct nft_trans_set {
419 struct nft_set *set;
420 u32 set_id;
421};
422
423#define nft_trans_set(trans) \
424 (((struct nft_trans_set *)trans->data)->set)
425#define nft_trans_set_id(trans) \
426 (((struct nft_trans_set *)trans->data)->set_id)
427
428struct nft_trans_chain {
429 bool update;
430 char name[NFT_CHAIN_MAXNAMELEN];
431 struct nft_stats __percpu *stats;
432 u8 policy;
433};
434
435#define nft_trans_chain_update(trans) \
436 (((struct nft_trans_chain *)trans->data)->update)
437#define nft_trans_chain_name(trans) \
438 (((struct nft_trans_chain *)trans->data)->name)
439#define nft_trans_chain_stats(trans) \
440 (((struct nft_trans_chain *)trans->data)->stats)
441#define nft_trans_chain_policy(trans) \
442 (((struct nft_trans_chain *)trans->data)->policy)
443
444struct nft_trans_table {
445 bool update;
446 bool enable;
447};
448
449#define nft_trans_table_update(trans) \
450 (((struct nft_trans_table *)trans->data)->update)
451#define nft_trans_table_enable(trans) \
452 (((struct nft_trans_table *)trans->data)->enable)
453
454struct nft_trans_elem {
455 struct nft_set *set;
456 struct nft_set_elem elem;
457};
458
459#define nft_trans_elem_set(trans) \
460 (((struct nft_trans_elem *)trans->data)->set)
461#define nft_trans_elem(trans) \
462 (((struct nft_trans_elem *)trans->data)->elem)
463
356static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) 464static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
357{ 465{
358 return (struct nft_expr *)&rule->data[0]; 466 return (struct nft_expr *)&rule->data[0];
@@ -385,6 +493,7 @@ static inline void *nft_userdata(const struct nft_rule *rule)
385 493
386enum nft_chain_flags { 494enum nft_chain_flags {
387 NFT_BASE_CHAIN = 0x1, 495 NFT_BASE_CHAIN = 0x1,
496 NFT_CHAIN_INACTIVE = 0x2,
388}; 497};
389 498
390/** 499/**
@@ -395,9 +504,9 @@ enum nft_chain_flags {
395 * @net: net namespace that this chain belongs to 504 * @net: net namespace that this chain belongs to
396 * @table: table that this chain belongs to 505 * @table: table that this chain belongs to
397 * @handle: chain handle 506 * @handle: chain handle
398 * @flags: bitmask of enum nft_chain_flags
399 * @use: number of jump references to this chain 507 * @use: number of jump references to this chain
400 * @level: length of longest path to this chain 508 * @level: length of longest path to this chain
509 * @flags: bitmask of enum nft_chain_flags
401 * @name: name of the chain 510 * @name: name of the chain
402 */ 511 */
403struct nft_chain { 512struct nft_chain {
@@ -406,9 +515,9 @@ struct nft_chain {
406 struct net *net; 515 struct net *net;
407 struct nft_table *table; 516 struct nft_table *table;
408 u64 handle; 517 u64 handle;
409 u8 flags; 518 u32 use;
410 u16 use;
411 u16 level; 519 u16 level;
520 u8 flags;
412 char name[NFT_CHAIN_MAXNAMELEN]; 521 char name[NFT_CHAIN_MAXNAMELEN];
413}; 522};
414 523
@@ -420,8 +529,9 @@ enum nft_chain_type {
420}; 529};
421 530
422struct nft_stats { 531struct nft_stats {
423 u64 bytes; 532 u64 bytes;
424 u64 pkts; 533 u64 pkts;
534 struct u64_stats_sync syncp;
425}; 535};
426 536
427#define NFT_HOOK_OPS_MAX 2 537#define NFT_HOOK_OPS_MAX 2
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h
new file mode 100644
index 000000000000..0ee47c3e2e31
--- /dev/null
+++ b/include/net/netfilter/nft_meta.h
@@ -0,0 +1,36 @@
1#ifndef _NFT_META_H_
2#define _NFT_META_H_
3
4struct nft_meta {
5 enum nft_meta_keys key:8;
6 union {
7 enum nft_registers dreg:8;
8 enum nft_registers sreg:8;
9 };
10};
11
12extern const struct nla_policy nft_meta_policy[];
13
14int nft_meta_get_init(const struct nft_ctx *ctx,
15 const struct nft_expr *expr,
16 const struct nlattr * const tb[]);
17
18int nft_meta_set_init(const struct nft_ctx *ctx,
19 const struct nft_expr *expr,
20 const struct nlattr * const tb[]);
21
22int nft_meta_get_dump(struct sk_buff *skb,
23 const struct nft_expr *expr);
24
25int nft_meta_set_dump(struct sk_buff *skb,
26 const struct nft_expr *expr);
27
28void nft_meta_get_eval(const struct nft_expr *expr,
29 struct nft_data data[NFT_REG_MAX + 1],
30 const struct nft_pktinfo *pkt);
31
32void nft_meta_set_eval(const struct nft_expr *expr,
33 struct nft_data data[NFT_REG_MAX + 1],
34 const struct nft_pktinfo *pkt);
35
36#endif
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h
index 079030c853d8..e2070960bac0 100644
--- a/include/net/netns/ieee802154_6lowpan.h
+++ b/include/net/netns/ieee802154_6lowpan.h
@@ -16,7 +16,7 @@ struct netns_sysctl_lowpan {
16struct netns_ieee802154_lowpan { 16struct netns_ieee802154_lowpan {
17 struct netns_sysctl_lowpan sysctl; 17 struct netns_sysctl_lowpan sysctl;
18 struct netns_frags frags; 18 struct netns_frags frags;
19 u16 max_dsize; 19 int max_dsize;
20}; 20};
21 21
22#endif 22#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index b2704fd0ec80..aec5e12f9f19 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -77,10 +77,17 @@ struct netns_ipv4 {
77 int sysctl_ip_no_pmtu_disc; 77 int sysctl_ip_no_pmtu_disc;
78 int sysctl_ip_fwd_use_pmtu; 78 int sysctl_ip_fwd_use_pmtu;
79 79
80 int sysctl_fwmark_reflect;
81 int sysctl_tcp_fwmark_accept;
82
80 struct ping_group_range ping_group_range; 83 struct ping_group_range ping_group_range;
81 84
82 atomic_t dev_addr_genid; 85 atomic_t dev_addr_genid;
83 86
87#ifdef CONFIG_SYSCTL
88 unsigned long *sysctl_local_reserved_ports;
89#endif
90
84#ifdef CONFIG_IP_MROUTE 91#ifdef CONFIG_IP_MROUTE
85#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES 92#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
86 struct mr_table *mrt; 93 struct mr_table *mrt;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 21edaf1f7916..19d3446e59d2 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -30,6 +30,7 @@ struct netns_sysctl_ipv6 {
30 int flowlabel_consistency; 30 int flowlabel_consistency;
31 int icmpv6_time; 31 int icmpv6_time;
32 int anycast_src_echo_reply; 32 int anycast_src_echo_reply;
33 int fwmark_reflect;
33}; 34};
34 35
35struct netns_ipv6 { 36struct netns_ipv6 {
diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h
index 26a394cb91a8..eee608b12cc9 100644
--- a/include/net/netns/nftables.h
+++ b/include/net/netns/nftables.h
@@ -13,8 +13,8 @@ struct netns_nftables {
13 struct nft_af_info *inet; 13 struct nft_af_info *inet;
14 struct nft_af_info *arp; 14 struct nft_af_info *arp;
15 struct nft_af_info *bridge; 15 struct nft_af_info *bridge;
16 unsigned int base_seq;
16 u8 gencursor; 17 u8 gencursor;
17 u8 genctr;
18}; 18};
19 19
20#endif 20#endif
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
index 7655cfe27c34..bdf55c3b7a19 100644
--- a/include/net/nfc/digital.h
+++ b/include/net/nfc/digital.h
@@ -36,6 +36,7 @@ enum {
36 NFC_DIGITAL_RF_TECH_212F, 36 NFC_DIGITAL_RF_TECH_212F,
37 NFC_DIGITAL_RF_TECH_424F, 37 NFC_DIGITAL_RF_TECH_424F,
38 NFC_DIGITAL_RF_TECH_ISO15693, 38 NFC_DIGITAL_RF_TECH_ISO15693,
39 NFC_DIGITAL_RF_TECH_106B,
39 40
40 NFC_DIGITAL_RF_TECH_LAST, 41 NFC_DIGITAL_RF_TECH_LAST,
41}; 42};
@@ -62,6 +63,9 @@ enum {
62 NFC_DIGITAL_FRAMING_ISO15693_INVENTORY, 63 NFC_DIGITAL_FRAMING_ISO15693_INVENTORY,
63 NFC_DIGITAL_FRAMING_ISO15693_T5T, 64 NFC_DIGITAL_FRAMING_ISO15693_T5T,
64 65
66 NFC_DIGITAL_FRAMING_NFCB,
67 NFC_DIGITAL_FRAMING_NFCB_T4T,
68
65 NFC_DIGITAL_FRAMING_LAST, 69 NFC_DIGITAL_FRAMING_LAST,
66}; 70};
67 71
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 03c4650b548c..61286db54388 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -27,6 +27,7 @@ struct nfc_hci_dev;
27struct nfc_hci_ops { 27struct nfc_hci_ops {
28 int (*open) (struct nfc_hci_dev *hdev); 28 int (*open) (struct nfc_hci_dev *hdev);
29 void (*close) (struct nfc_hci_dev *hdev); 29 void (*close) (struct nfc_hci_dev *hdev);
30 int (*load_session) (struct nfc_hci_dev *hdev);
30 int (*hci_ready) (struct nfc_hci_dev *hdev); 31 int (*hci_ready) (struct nfc_hci_dev *hdev);
31 /* 32 /*
32 * xmit must always send the complete buffer before 33 * xmit must always send the complete buffer before
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 2e8b40c16274..6c583e244de2 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -264,4 +264,7 @@ int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
264int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); 264int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
265struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx); 265struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx);
266 266
267void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb,
268 u8 payload_type, u8 direction);
269
267#endif /* __NET_NFC_H */ 270#endif /* __NET_NFC_H */
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index a2441fb1428f..6da46dcf1049 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -136,7 +136,7 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
136 136
137int tcf_exts_validate(struct net *net, struct tcf_proto *tp, 137int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
138 struct nlattr **tb, struct nlattr *rate_tlv, 138 struct nlattr **tb, struct nlattr *rate_tlv,
139 struct tcf_exts *exts); 139 struct tcf_exts *exts, bool ovr);
140void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); 140void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts);
141void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, 141void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
142 struct tcf_exts *src); 142 struct tcf_exts *src);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 891d80d2c4d2..ec030cd76616 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -96,7 +96,7 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
96 struct nlattr *tab); 96 struct nlattr *tab);
97void qdisc_put_rtab(struct qdisc_rate_table *tab); 97void qdisc_put_rtab(struct qdisc_rate_table *tab);
98void qdisc_put_stab(struct qdisc_size_table *tab); 98void qdisc_put_stab(struct qdisc_size_table *tab);
99void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc); 99void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc);
100int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, 100int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
101 struct net_device *dev, struct netdev_queue *txq, 101 struct net_device *dev, struct netdev_queue *txq,
102 spinlock_t *root_lock); 102 spinlock_t *root_lock);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index a7e986b08147..d6fcc1fcdb5b 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -86,7 +86,6 @@ struct inet_protosw {
86 struct proto *prot; 86 struct proto *prot;
87 const struct proto_ops *ops; 87 const struct proto_ops *ops;
88 88
89 char no_check; /* checksum on rcv/xmit/none? */
90 unsigned char flags; /* See INET_PROTOSW_* below. */ 89 unsigned char flags; /* See INET_PROTOSW_* below. */
91}; 90};
92#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ 91#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 75fc1f5a948d..259992444e80 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -131,6 +131,11 @@ struct regulatory_request {
131 * all country IE information processed by the regulatory core. This will 131 * all country IE information processed by the regulatory core. This will
132 * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will 132 * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will
133 * be ignored. 133 * be ignored.
134 * @REGULATORY_ENABLE_RELAX_NO_IR: for devices that wish to allow the
135 * NO_IR relaxation, which enables transmissions on channels on which
136 * otherwise initiating radiation is not allowed. This will enable the
137 * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration
138 * option
134 */ 139 */
135enum ieee80211_regulatory_flags { 140enum ieee80211_regulatory_flags {
136 REGULATORY_CUSTOM_REG = BIT(0), 141 REGULATORY_CUSTOM_REG = BIT(0),
@@ -138,6 +143,7 @@ enum ieee80211_regulatory_flags {
138 REGULATORY_DISABLE_BEACON_HINTS = BIT(2), 143 REGULATORY_DISABLE_BEACON_HINTS = BIT(2),
139 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), 144 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3),
140 REGULATORY_COUNTRY_IE_IGNORE = BIT(4), 145 REGULATORY_COUNTRY_IE_IGNORE = BIT(4),
146 REGULATORY_ENABLE_RELAX_NO_IR = BIT(5),
141}; 147};
142 148
143struct ieee80211_freq_range { 149struct ieee80211_freq_range {
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index d062f81c692f..624f9857c83e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -199,7 +199,7 @@ struct tcf_proto_ops {
199 int (*change)(struct net *net, struct sk_buff *, 199 int (*change)(struct net *net, struct sk_buff *,
200 struct tcf_proto*, unsigned long, 200 struct tcf_proto*, unsigned long,
201 u32 handle, struct nlattr **, 201 u32 handle, struct nlattr **,
202 unsigned long *); 202 unsigned long *, bool);
203 int (*delete)(struct tcf_proto*, unsigned long); 203 int (*delete)(struct tcf_proto*, unsigned long);
204 void (*walk)(struct tcf_proto*, struct tcf_walker *arg); 204 void (*walk)(struct tcf_proto*, struct tcf_walker *arg);
205 205
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 0dfcc92600e8..f38588bf3462 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -838,10 +838,10 @@ struct sctp_transport {
838 unsigned long sackdelay; 838 unsigned long sackdelay;
839 __u32 sackfreq; 839 __u32 sackfreq;
840 840
841 /* When was the last time (in jiffies) that we heard from this 841 /* When was the last time that we heard from this transport? We use
842 * transport? We use this to pick new active and retran paths. 842 * this to pick new active and retran paths.
843 */ 843 */
844 unsigned long last_time_heard; 844 ktime_t last_time_heard;
845 845
846 /* Last time(in jiffies) when cwnd is reduced due to the congestion 846 /* Last time(in jiffies) when cwnd is reduced due to the congestion
847 * indication based on ECNE chunk. 847 * indication based on ECNE chunk.
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h
index f257486f17be..3f36d45b714a 100644
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@ -3,8 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6__u32 secure_ip_id(__be32 daddr);
7__u32 secure_ipv6_id(const __be32 daddr[4]);
8u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); 6u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
9u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, 7u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
10 __be16 dport); 8 __be16 dport);
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 71596261fa99..f1f27fdbb0d5 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -116,51 +116,49 @@ struct linux_xfrm_mib {
116 unsigned long mibs[LINUX_MIB_XFRMMAX]; 116 unsigned long mibs[LINUX_MIB_XFRMMAX];
117}; 117};
118 118
119#define SNMP_ARRAY_SZ 1
120
121#define DEFINE_SNMP_STAT(type, name) \ 119#define DEFINE_SNMP_STAT(type, name) \
122 __typeof__(type) __percpu *name[SNMP_ARRAY_SZ] 120 __typeof__(type) __percpu *name
123#define DEFINE_SNMP_STAT_ATOMIC(type, name) \ 121#define DEFINE_SNMP_STAT_ATOMIC(type, name) \
124 __typeof__(type) *name 122 __typeof__(type) *name
125#define DECLARE_SNMP_STAT(type, name) \ 123#define DECLARE_SNMP_STAT(type, name) \
126 extern __typeof__(type) __percpu *name[SNMP_ARRAY_SZ] 124 extern __typeof__(type) __percpu *name
127 125
128#define SNMP_INC_STATS_BH(mib, field) \ 126#define SNMP_INC_STATS_BH(mib, field) \
129 __this_cpu_inc(mib[0]->mibs[field]) 127 __this_cpu_inc(mib->mibs[field])
130 128
131#define SNMP_INC_STATS_USER(mib, field) \ 129#define SNMP_INC_STATS_USER(mib, field) \
132 this_cpu_inc(mib[0]->mibs[field]) 130 this_cpu_inc(mib->mibs[field])
133 131
134#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ 132#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \
135 atomic_long_inc(&mib->mibs[field]) 133 atomic_long_inc(&mib->mibs[field])
136 134
137#define SNMP_INC_STATS(mib, field) \ 135#define SNMP_INC_STATS(mib, field) \
138 this_cpu_inc(mib[0]->mibs[field]) 136 this_cpu_inc(mib->mibs[field])
139 137
140#define SNMP_DEC_STATS(mib, field) \ 138#define SNMP_DEC_STATS(mib, field) \
141 this_cpu_dec(mib[0]->mibs[field]) 139 this_cpu_dec(mib->mibs[field])
142 140
143#define SNMP_ADD_STATS_BH(mib, field, addend) \ 141#define SNMP_ADD_STATS_BH(mib, field, addend) \
144 __this_cpu_add(mib[0]->mibs[field], addend) 142 __this_cpu_add(mib->mibs[field], addend)
145 143
146#define SNMP_ADD_STATS_USER(mib, field, addend) \ 144#define SNMP_ADD_STATS_USER(mib, field, addend) \
147 this_cpu_add(mib[0]->mibs[field], addend) 145 this_cpu_add(mib->mibs[field], addend)
148 146
149#define SNMP_ADD_STATS(mib, field, addend) \ 147#define SNMP_ADD_STATS(mib, field, addend) \
150 this_cpu_add(mib[0]->mibs[field], addend) 148 this_cpu_add(mib->mibs[field], addend)
151/* 149/*
152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" 150 * Use "__typeof__(*mib) *ptr" instead of "__typeof__(mib) ptr"
153 * to make @ptr a non-percpu pointer. 151 * to make @ptr a non-percpu pointer.
154 */ 152 */
155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 153#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
156 do { \ 154 do { \
157 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \ 155 __typeof__(*mib->mibs) *ptr = mib->mibs; \
158 this_cpu_inc(ptr[basefield##PKTS]); \ 156 this_cpu_inc(ptr[basefield##PKTS]); \
159 this_cpu_add(ptr[basefield##OCTETS], addend); \ 157 this_cpu_add(ptr[basefield##OCTETS], addend); \
160 } while (0) 158 } while (0)
161#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 159#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
162 do { \ 160 do { \
163 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \ 161 __typeof__(*mib->mibs) *ptr = mib->mibs; \
164 __this_cpu_inc(ptr[basefield##PKTS]); \ 162 __this_cpu_inc(ptr[basefield##PKTS]); \
165 __this_cpu_add(ptr[basefield##OCTETS], addend); \ 163 __this_cpu_add(ptr[basefield##OCTETS], addend); \
166 } while (0) 164 } while (0)
@@ -170,7 +168,7 @@ struct linux_xfrm_mib {
170 168
171#define SNMP_ADD_STATS64_BH(mib, field, addend) \ 169#define SNMP_ADD_STATS64_BH(mib, field, addend) \
172 do { \ 170 do { \
173 __typeof__(*mib[0]) *ptr = __this_cpu_ptr((mib)[0]); \ 171 __typeof__(*mib) *ptr = __this_cpu_ptr(mib); \
174 u64_stats_update_begin(&ptr->syncp); \ 172 u64_stats_update_begin(&ptr->syncp); \
175 ptr->mibs[field] += addend; \ 173 ptr->mibs[field] += addend; \
176 u64_stats_update_end(&ptr->syncp); \ 174 u64_stats_update_end(&ptr->syncp); \
@@ -191,8 +189,8 @@ struct linux_xfrm_mib {
191#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) 189#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
192#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ 190#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
193 do { \ 191 do { \
194 __typeof__(*mib[0]) *ptr; \ 192 __typeof__(*mib) *ptr; \
195 ptr = __this_cpu_ptr((mib)[0]); \ 193 ptr = __this_cpu_ptr(mib); \
196 u64_stats_update_begin(&ptr->syncp); \ 194 u64_stats_update_begin(&ptr->syncp); \
197 ptr->mibs[basefield##PKTS]++; \ 195 ptr->mibs[basefield##PKTS]++; \
198 ptr->mibs[basefield##OCTETS] += addend; \ 196 ptr->mibs[basefield##OCTETS] += addend; \
diff --git a/include/net/sock.h b/include/net/sock.h
index 21569cf456ed..156350745700 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -243,7 +243,8 @@ struct cg_proto;
243 * @sk_sndbuf: size of send buffer in bytes 243 * @sk_sndbuf: size of send buffer in bytes
244 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 244 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
245 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings 245 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
246 * @sk_no_check: %SO_NO_CHECK setting, whether or not checkup packets 246 * @sk_no_check_tx: %SO_NO_CHECK setting, set checksum in TX packets
247 * @sk_no_check_rx: allow zero checksum in RX packets
247 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 248 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
248 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK) 249 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
249 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 250 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
@@ -371,7 +372,8 @@ struct sock {
371 struct sk_buff_head sk_write_queue; 372 struct sk_buff_head sk_write_queue;
372 kmemcheck_bitfield_begin(flags); 373 kmemcheck_bitfield_begin(flags);
373 unsigned int sk_shutdown : 2, 374 unsigned int sk_shutdown : 2,
374 sk_no_check : 2, 375 sk_no_check_tx : 1,
376 sk_no_check_rx : 1,
375 sk_userlocks : 4, 377 sk_userlocks : 4,
376 sk_protocol : 8, 378 sk_protocol : 8,
377 sk_type : 16; 379 sk_type : 16;
@@ -1728,8 +1730,8 @@ sk_dst_get(struct sock *sk)
1728 1730
1729 rcu_read_lock(); 1731 rcu_read_lock();
1730 dst = rcu_dereference(sk->sk_dst_cache); 1732 dst = rcu_dereference(sk->sk_dst_cache);
1731 if (dst) 1733 if (dst && !atomic_inc_not_zero(&dst->__refcnt))
1732 dst_hold(dst); 1734 dst = NULL;
1733 rcu_read_unlock(); 1735 rcu_read_unlock();
1734 return dst; 1736 return dst;
1735} 1737}
@@ -1766,9 +1768,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
1766static inline void 1768static inline void
1767sk_dst_set(struct sock *sk, struct dst_entry *dst) 1769sk_dst_set(struct sock *sk, struct dst_entry *dst)
1768{ 1770{
1769 spin_lock(&sk->sk_dst_lock); 1771 struct dst_entry *old_dst;
1770 __sk_dst_set(sk, dst); 1772
1771 spin_unlock(&sk->sk_dst_lock); 1773 sk_tx_queue_clear(sk);
1774 old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);
1775 dst_release(old_dst);
1772} 1776}
1773 1777
1774static inline void 1778static inline void
@@ -1780,9 +1784,7 @@ __sk_dst_reset(struct sock *sk)
1780static inline void 1784static inline void
1781sk_dst_reset(struct sock *sk) 1785sk_dst_reset(struct sock *sk)
1782{ 1786{
1783 spin_lock(&sk->sk_dst_lock); 1787 sk_dst_set(sk, NULL);
1784 __sk_dst_reset(sk);
1785 spin_unlock(&sk->sk_dst_lock);
1786} 1788}
1787 1789
1788struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1790struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 87d877408188..7286db80e8b8 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -220,8 +220,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
220#define TFO_SERVER_ENABLE 2 220#define TFO_SERVER_ENABLE 2
221#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */ 221#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */
222 222
223/* Process SYN data but skip cookie validation */
224#define TFO_SERVER_COOKIE_NOT_CHKED 0x100
225/* Accept SYN data w/o any cookie option */ 223/* Accept SYN data w/o any cookie option */
226#define TFO_SERVER_COOKIE_NOT_REQD 0x200 224#define TFO_SERVER_COOKIE_NOT_REQD 0x200
227 225
@@ -230,10 +228,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
230 */ 228 */
231#define TFO_SERVER_WO_SOCKOPT1 0x400 229#define TFO_SERVER_WO_SOCKOPT1 0x400
232#define TFO_SERVER_WO_SOCKOPT2 0x800 230#define TFO_SERVER_WO_SOCKOPT2 0x800
233/* Always create TFO child sockets on a TFO listener even when
234 * cookie/data not present. (For testing purpose!)
235 */
236#define TFO_SERVER_ALWAYS 0x1000
237 231
238extern struct inet_timewait_death_row tcp_death_row; 232extern struct inet_timewait_death_row tcp_death_row;
239 233
@@ -541,7 +535,7 @@ void tcp_retransmit_timer(struct sock *sk);
541void tcp_xmit_retransmit_queue(struct sock *); 535void tcp_xmit_retransmit_queue(struct sock *);
542void tcp_simple_retransmit(struct sock *); 536void tcp_simple_retransmit(struct sock *);
543int tcp_trim_head(struct sock *, struct sk_buff *, u32); 537int tcp_trim_head(struct sock *, struct sk_buff *, u32);
544int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); 538int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int, gfp_t);
545 539
546void tcp_send_probe0(struct sock *); 540void tcp_send_probe0(struct sock *);
547void tcp_send_partial(struct sock *); 541void tcp_send_partial(struct sock *);
@@ -558,7 +552,6 @@ void tcp_send_loss_probe(struct sock *sk);
558bool tcp_schedule_loss_probe(struct sock *sk); 552bool tcp_schedule_loss_probe(struct sock *sk);
559 553
560/* tcp_input.c */ 554/* tcp_input.c */
561void tcp_cwnd_application_limited(struct sock *sk);
562void tcp_resume_early_retransmit(struct sock *sk); 555void tcp_resume_early_retransmit(struct sock *sk);
563void tcp_rearm_rto(struct sock *sk); 556void tcp_rearm_rto(struct sock *sk);
564void tcp_reset(struct sock *sk); 557void tcp_reset(struct sock *sk);
@@ -797,7 +790,7 @@ struct tcp_congestion_ops {
797 /* return slow start threshold (required) */ 790 /* return slow start threshold (required) */
798 u32 (*ssthresh)(struct sock *sk); 791 u32 (*ssthresh)(struct sock *sk);
799 /* do new cwnd calculation (required) */ 792 /* do new cwnd calculation (required) */
800 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 793 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked);
801 /* call before changing ca_state (optional) */ 794 /* call before changing ca_state (optional) */
802 void (*set_state)(struct sock *sk, u8 new_state); 795 void (*set_state)(struct sock *sk, u8 new_state);
803 /* call when cwnd event occurs (optional) */ 796 /* call when cwnd event occurs (optional) */
@@ -829,7 +822,7 @@ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
829 822
830extern struct tcp_congestion_ops tcp_init_congestion_ops; 823extern struct tcp_congestion_ops tcp_init_congestion_ops;
831u32 tcp_reno_ssthresh(struct sock *sk); 824u32 tcp_reno_ssthresh(struct sock *sk);
832void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 825void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked);
833extern struct tcp_congestion_ops tcp_reno; 826extern struct tcp_congestion_ops tcp_reno;
834 827
835static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 828static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -975,7 +968,30 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp)
975{ 968{
976 return tp->snd_una + tp->snd_wnd; 969 return tp->snd_una + tp->snd_wnd;
977} 970}
978bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); 971
972/* We follow the spirit of RFC2861 to validate cwnd but implement a more
973 * flexible approach. The RFC suggests cwnd should not be raised unless
974 * it was fully used previously. And that's exactly what we do in
975 * congestion avoidance mode. But in slow start we allow cwnd to grow
976 * as long as the application has used half the cwnd.
977 * Example :
978 * cwnd is 10 (IW10), but application sends 9 frames.
979 * We allow cwnd to reach 18 when all frames are ACKed.
980 * This check is safe because it's as aggressive as slow start which already
981 * risks 100% overshoot. The advantage is that we discourage application to
982 * either send more filler packets or data to artificially blow up the cwnd
983 * usage, and allow application-limited process to probe bw more aggressively.
984 */
985static inline bool tcp_is_cwnd_limited(const struct sock *sk)
986{
987 const struct tcp_sock *tp = tcp_sk(sk);
988
989 /* If in slow start, ensure cwnd grows to twice what was ACKed. */
990 if (tp->snd_cwnd <= tp->snd_ssthresh)
991 return tp->snd_cwnd < 2 * tp->max_packets_out;
992
993 return tp->is_cwnd_limited;
994}
979 995
980static inline void tcp_check_probe_timer(struct sock *sk) 996static inline void tcp_check_probe_timer(struct sock *sk)
981{ 997{
@@ -1103,6 +1119,9 @@ static inline void tcp_openreq_init(struct request_sock *req,
1103 ireq->ir_num = ntohs(tcp_hdr(skb)->dest); 1119 ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
1104} 1120}
1105 1121
1122extern void tcp_openreq_init_rwin(struct request_sock *req,
1123 struct sock *sk, struct dst_entry *dst);
1124
1106void tcp_enter_memory_pressure(struct sock *sk); 1125void tcp_enter_memory_pressure(struct sock *sk);
1107 1126
1108static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1127static inline int keepalive_intvl_when(const struct tcp_sock *tp)
@@ -1312,8 +1331,10 @@ void tcp_free_fastopen_req(struct tcp_sock *tp);
1312 1331
1313extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; 1332extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1314int tcp_fastopen_reset_cipher(void *key, unsigned int len); 1333int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1315void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, 1334bool tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
1316 struct tcp_fastopen_cookie *foc); 1335 struct request_sock *req,
1336 struct tcp_fastopen_cookie *foc,
1337 struct dst_entry *dst);
1317void tcp_fastopen_init_key_once(bool publish); 1338void tcp_fastopen_init_key_once(bool publish);
1318#define TCP_FASTOPEN_KEY_LENGTH 16 1339#define TCP_FASTOPEN_KEY_LENGTH 16
1319 1340
diff --git a/include/net/tso.h b/include/net/tso.h
new file mode 100644
index 000000000000..47e5444f7d15
--- /dev/null
+++ b/include/net/tso.h
@@ -0,0 +1,20 @@
1#ifndef _TSO_H
2#define _TSO_H
3
4#include <net/ip.h>
5
6struct tso_t {
7 int next_frag_idx;
8 void *data;
9 size_t size;
10 u16 ip_id;
11 u32 tcp_seq;
12};
13
14int tso_count_descs(struct sk_buff *skb);
15void tso_build_hdr(struct sk_buff *skb, char *hdr, struct tso_t *tso,
16 int size, bool is_last);
17void tso_build_data(struct sk_buff *skb, struct tso_t *tso, int size);
18void tso_start(struct sk_buff *skb, struct tso_t *tso);
19
20#endif /* _TSO_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index a24f0f3e107f..68a1fefe3dfe 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -95,15 +95,6 @@ static inline struct udp_hslot *udp_hashslot2(struct udp_table *table,
95 return &table->hash2[hash & table->mask]; 95 return &table->hash2[hash & table->mask];
96} 96}
97 97
98/* Note: this must match 'valbool' in sock_setsockopt */
99#define UDP_CSUM_NOXMIT 1
100
101/* Used by SunRPC/xprt layer. */
102#define UDP_CSUM_NORCV 2
103
104/* Default, as per the RFC, is to always do csums. */
105#define UDP_CSUM_DEFAULT 0
106
107extern struct proto udp_prot; 98extern struct proto udp_prot;
108 99
109extern atomic_long_t udp_memory_allocated; 100extern atomic_long_t udp_memory_allocated;
@@ -120,7 +111,9 @@ struct sk_buff;
120 */ 111 */
121static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) 112static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
122{ 113{
123 return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov); 114 return (UDP_SKB_CB(skb)->cscov == skb->len ?
115 __skb_checksum_complete(skb) :
116 __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov));
124} 117}
125 118
126static inline int udp_lib_checksum_complete(struct sk_buff *skb) 119static inline int udp_lib_checksum_complete(struct sk_buff *skb)
@@ -156,6 +149,15 @@ static inline __wsum udp_csum(struct sk_buff *skb)
156 return csum; 149 return csum;
157} 150}
158 151
152static inline __sum16 udp_v4_check(int len, __be32 saddr,
153 __be32 daddr, __wsum base)
154{
155 return csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base);
156}
157
158void udp_set_csum(bool nocheck, struct sk_buff *skb,
159 __be32 saddr, __be32 daddr, int len);
160
159/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ 161/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
160static inline void udp_lib_hash(struct sock *sk) 162static inline void udp_lib_hash(struct sock *sk)
161{ 163{
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 5deef1ae78c9..12196ce661d9 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -24,16 +24,26 @@ struct vxlan_sock {
24 struct udp_offload udp_offloads; 24 struct udp_offload udp_offloads;
25}; 25};
26 26
27#define VXLAN_F_LEARN 0x01
28#define VXLAN_F_PROXY 0x02
29#define VXLAN_F_RSC 0x04
30#define VXLAN_F_L2MISS 0x08
31#define VXLAN_F_L3MISS 0x10
32#define VXLAN_F_IPV6 0x20
33#define VXLAN_F_UDP_CSUM 0x40
34#define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80
35#define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100
36
27struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, 37struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
28 vxlan_rcv_t *rcv, void *data, 38 vxlan_rcv_t *rcv, void *data,
29 bool no_share, bool ipv6); 39 bool no_share, u32 flags);
30 40
31void vxlan_sock_release(struct vxlan_sock *vs); 41void vxlan_sock_release(struct vxlan_sock *vs);
32 42
33int vxlan_xmit_skb(struct vxlan_sock *vs, 43int vxlan_xmit_skb(struct vxlan_sock *vs,
34 struct rtable *rt, struct sk_buff *skb, 44 struct rtable *rt, struct sk_buff *skb,
35 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
36 __be16 src_port, __be16 dst_port, __be32 vni); 46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet);
37 47
38__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb); 48__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);
39 49
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 116e9c7e19cb..721e9c3b11bd 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -691,13 +691,6 @@ struct xfrm_spi_skb_cb {
691 691
692#define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) 692#define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0]))
693 693
694/* Audit Information */
695struct xfrm_audit {
696 u32 secid;
697 kuid_t loginuid;
698 unsigned int sessionid;
699};
700
701#ifdef CONFIG_AUDITSYSCALL 694#ifdef CONFIG_AUDITSYSCALL
702static inline struct audit_buffer *xfrm_audit_start(const char *op) 695static inline struct audit_buffer *xfrm_audit_start(const char *op)
703{ 696{
@@ -713,30 +706,24 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
713 return audit_buf; 706 return audit_buf;
714} 707}
715 708
716static inline void xfrm_audit_helper_usrinfo(kuid_t auid, unsigned int ses, u32 secid, 709static inline void xfrm_audit_helper_usrinfo(bool task_valid,
717 struct audit_buffer *audit_buf) 710 struct audit_buffer *audit_buf)
718{ 711{
719 char *secctx; 712 const unsigned int auid = from_kuid(&init_user_ns, task_valid ?
720 u32 secctx_len; 713 audit_get_loginuid(current) :
721 714 INVALID_UID);
722 audit_log_format(audit_buf, " auid=%u ses=%u", 715 const unsigned int ses = task_valid ? audit_get_sessionid(current) :
723 from_kuid(&init_user_ns, auid), ses); 716 (unsigned int) -1;
724 if (secid != 0 && 717
725 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { 718 audit_log_format(audit_buf, " auid=%u ses=%u", auid, ses);
726 audit_log_format(audit_buf, " subj=%s", secctx); 719 audit_log_task_context(audit_buf);
727 security_release_secctx(secctx, secctx_len); 720}
728 } else 721
729 audit_log_task_context(audit_buf); 722void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, bool task_valid);
730} 723void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
731 724 bool task_valid);
732void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, kuid_t auid, 725void xfrm_audit_state_add(struct xfrm_state *x, int result, bool task_valid);
733 unsigned int ses, u32 secid); 726void xfrm_audit_state_delete(struct xfrm_state *x, int result, bool task_valid);
734void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, kuid_t auid,
735 unsigned int ses, u32 secid);
736void xfrm_audit_state_add(struct xfrm_state *x, int result, kuid_t auid,
737 unsigned int ses, u32 secid);
738void xfrm_audit_state_delete(struct xfrm_state *x, int result, kuid_t auid,
739 unsigned int ses, u32 secid);
740void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 727void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
741 struct sk_buff *skb); 728 struct sk_buff *skb);
742void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb, 729void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb,
@@ -749,22 +736,22 @@ void xfrm_audit_state_icvfail(struct xfrm_state *x, struct sk_buff *skb,
749#else 736#else
750 737
751static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 738static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
752 kuid_t auid, unsigned int ses, u32 secid) 739 bool task_valid)
753{ 740{
754} 741}
755 742
756static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 743static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
757 kuid_t auid, unsigned int ses, u32 secid) 744 bool task_valid)
758{ 745{
759} 746}
760 747
761static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, 748static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
762 kuid_t auid, unsigned int ses, u32 secid) 749 bool task_valid)
763{ 750{
764} 751}
765 752
766static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, 753static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
767 kuid_t auid, unsigned int ses, u32 secid) 754 bool task_valid)
768{ 755{
769} 756}
770 757
@@ -1508,7 +1495,7 @@ struct xfrmk_spdinfo {
1508 1495
1509struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, u32 seq); 1496struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, u32 seq);
1510int xfrm_state_delete(struct xfrm_state *x); 1497int xfrm_state_delete(struct xfrm_state *x);
1511int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1498int xfrm_state_flush(struct net *net, u8 proto, bool task_valid);
1512void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); 1499void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
1513void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); 1500void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
1514u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); 1501u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
@@ -1603,7 +1590,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1603 int *err); 1590 int *err);
1604struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, 1591struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir,
1605 u32 id, int delete, int *err); 1592 u32 id, int delete, int *err);
1606int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); 1593int xfrm_policy_flush(struct net *net, u8 type, bool task_valid);
1607u32 xfrm_get_acqseq(void); 1594u32 xfrm_get_acqseq(void);
1608int verify_spi_info(u8 proto, u32 min, u32 max); 1595int verify_spi_info(u8 proto, u32 min, u32 max);
1609int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1596int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index acd825182977..7ccef342f724 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -80,8 +80,8 @@ enum rdma_transport_type {
80 RDMA_TRANSPORT_USNIC_UDP 80 RDMA_TRANSPORT_USNIC_UDP
81}; 81};
82 82
83enum rdma_transport_type 83__attribute_const__ enum rdma_transport_type
84rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; 84rdma_node_get_transport(enum rdma_node_type node_type);
85 85
86enum rdma_link_layer { 86enum rdma_link_layer {
87 IB_LINK_LAYER_UNSPECIFIED, 87 IB_LINK_LAYER_UNSPECIFIED,
@@ -466,14 +466,14 @@ enum ib_rate {
466 * converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec. 466 * converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec.
467 * @rate: rate to convert. 467 * @rate: rate to convert.
468 */ 468 */
469int ib_rate_to_mult(enum ib_rate rate) __attribute_const__; 469__attribute_const__ int ib_rate_to_mult(enum ib_rate rate);
470 470
471/** 471/**
472 * ib_rate_to_mbps - Convert the IB rate enum to Mbps. 472 * ib_rate_to_mbps - Convert the IB rate enum to Mbps.
473 * For example, IB_RATE_2_5_GBPS will be converted to 2500. 473 * For example, IB_RATE_2_5_GBPS will be converted to 2500.
474 * @rate: rate to convert. 474 * @rate: rate to convert.
475 */ 475 */
476int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__; 476__attribute_const__ int ib_rate_to_mbps(enum ib_rate rate);
477 477
478enum ib_mr_create_flags { 478enum ib_mr_create_flags {
479 IB_MR_SIGNATURE_EN = 1, 479 IB_MR_SIGNATURE_EN = 1,
@@ -604,7 +604,7 @@ struct ib_mr_status {
604 * enum. 604 * enum.
605 * @mult: multiple to convert. 605 * @mult: multiple to convert.
606 */ 606 */
607enum ib_rate mult_to_ib_rate(int mult) __attribute_const__; 607__attribute_const__ enum ib_rate mult_to_ib_rate(int mult);
608 608
609struct ib_ah_attr { 609struct ib_ah_attr {
610 struct ib_global_route grh; 610 struct ib_global_route grh;
@@ -783,6 +783,7 @@ enum ib_qp_create_flags {
783 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1, 783 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
784 IB_QP_CREATE_NETIF_QP = 1 << 5, 784 IB_QP_CREATE_NETIF_QP = 1 << 5,
785 IB_QP_CREATE_SIGNATURE_EN = 1 << 6, 785 IB_QP_CREATE_SIGNATURE_EN = 1 << 6,
786 IB_QP_CREATE_USE_GFP_NOIO = 1 << 7,
786 /* reserve bits 26-31 for low level drivers' internal use */ 787 /* reserve bits 26-31 for low level drivers' internal use */
787 IB_QP_CREATE_RESERVED_START = 1 << 26, 788 IB_QP_CREATE_RESERVED_START = 1 << 26,
788 IB_QP_CREATE_RESERVED_END = 1 << 31, 789 IB_QP_CREATE_RESERVED_END = 1 << 31,
diff --git a/include/rdma/iw_portmap.h b/include/rdma/iw_portmap.h
new file mode 100644
index 000000000000..928b2775e992
--- /dev/null
+++ b/include/rdma/iw_portmap.h
@@ -0,0 +1,199 @@
1/*
2 * Copyright (c) 2014 Intel Corporation. All rights reserved.
3 * Copyright (c) 2014 Chelsio, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 */
33#ifndef _IW_PORTMAP_H
34#define _IW_PORTMAP_H
35
36#define IWPM_ULIBNAME_SIZE 32
37#define IWPM_DEVNAME_SIZE 32
38#define IWPM_IFNAME_SIZE 16
39#define IWPM_IPADDR_SIZE 16
40
41enum {
42 IWPM_INVALID_NLMSG_ERR = 10,
43 IWPM_CREATE_MAPPING_ERR,
44 IWPM_DUPLICATE_MAPPING_ERR,
45 IWPM_UNKNOWN_MAPPING_ERR,
46 IWPM_CLIENT_DEV_INFO_ERR,
47 IWPM_USER_LIB_INFO_ERR,
48 IWPM_REMOTE_QUERY_REJECT
49};
50
51struct iwpm_dev_data {
52 char dev_name[IWPM_DEVNAME_SIZE];
53 char if_name[IWPM_IFNAME_SIZE];
54};
55
56struct iwpm_sa_data {
57 struct sockaddr_storage loc_addr;
58 struct sockaddr_storage mapped_loc_addr;
59 struct sockaddr_storage rem_addr;
60 struct sockaddr_storage mapped_rem_addr;
61};
62
63/**
64 * iwpm_init - Allocate resources for the iwarp port mapper
65 *
66 * Should be called when network interface goes up.
67 */
68int iwpm_init(u8);
69
70/**
71 * iwpm_exit - Deallocate resources for the iwarp port mapper
72 *
73 * Should be called when network interface goes down.
74 */
75int iwpm_exit(u8);
76
77/**
78 * iwpm_valid_pid - Check if the userspace iwarp port mapper pid is valid
79 *
80 * Returns true if the pid is greater than zero, otherwise returns false
81 */
82int iwpm_valid_pid(void);
83
84/**
85 * iwpm_register_pid - Send a netlink query to userspace
86 * to get the iwarp port mapper pid
87 * @pm_msg: Contains driver info to send to the userspace port mapper
88 * @nl_client: The index of the netlink client
89 */
90int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client);
91
92/**
93 * iwpm_add_mapping - Send a netlink add mapping request to
94 * the userspace port mapper
95 * @pm_msg: Contains the local ip/tcp address info to send
96 * @nl_client: The index of the netlink client
97 *
98 * If the request is successful, the pm_msg stores
99 * the port mapper response (mapped address info)
100 */
101int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
102
103/**
104 * iwpm_add_and_query_mapping - Send a netlink add and query mapping request
105 * to the userspace port mapper
106 * @pm_msg: Contains the local and remote ip/tcp address info to send
107 * @nl_client: The index of the netlink client
108 *
109 * If the request is successful, the pm_msg stores the
110 * port mapper response (mapped local and remote address info)
111 */
112int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
113
114/**
115 * iwpm_remove_mapping - Send a netlink remove mapping request
116 * to the userspace port mapper
117 *
118 * @local_addr: Local ip/tcp address to remove
119 * @nl_client: The index of the netlink client
120 */
121int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client);
122
123/**
124 * iwpm_register_pid_cb - Process the port mapper response to
125 * iwpm_register_pid query
126 * @skb:
127 * @cb: Contains the received message (payload and netlink header)
128 *
129 * If successful, the function receives the userspace port mapper pid
130 * which is used in future communication with the port mapper
131 */
132int iwpm_register_pid_cb(struct sk_buff *, struct netlink_callback *);
133
134/**
135 * iwpm_add_mapping_cb - Process the port mapper response to
136 * iwpm_add_mapping request
137 * @skb:
138 * @cb: Contains the received message (payload and netlink header)
139 */
140int iwpm_add_mapping_cb(struct sk_buff *, struct netlink_callback *);
141
142/**
143 * iwpm_add_and_query_mapping_cb - Process the port mapper response to
144 * iwpm_add_and_query_mapping request
145 * @skb:
146 * @cb: Contains the received message (payload and netlink header)
147 */
148int iwpm_add_and_query_mapping_cb(struct sk_buff *, struct netlink_callback *);
149
150/**
151 * iwpm_mapping_error_cb - Process port mapper notification for error
152 *
153 * @skb:
154 * @cb: Contains the received message (payload and netlink header)
155 */
156int iwpm_mapping_error_cb(struct sk_buff *, struct netlink_callback *);
157
158/**
159 * iwpm_mapping_info_cb - Process a notification that the userspace
160 * port mapper daemon is started
161 * @skb:
162 * @cb: Contains the received message (payload and netlink header)
163 *
164 * Using the received port mapper pid, send all the local mapping
165 * info records to the userspace port mapper
166 */
167int iwpm_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
168
169/**
170 * iwpm_ack_mapping_info_cb - Process the port mapper ack for
171 * the provided local mapping info records
172 * @skb:
173 * @cb: Contains the received message (payload and netlink header)
174 */
175int iwpm_ack_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
176
177/**
178 * iwpm_create_mapinfo - Store local and mapped IPv4/IPv6 address
179 * info in a hash table
180 * @local_addr: Local ip/tcp address
181 * @mapped_addr: Mapped local ip/tcp address
182 * @nl_client: The index of the netlink client
183 */
184int iwpm_create_mapinfo(struct sockaddr_storage *local_addr,
185 struct sockaddr_storage *mapped_addr, u8 nl_client);
186
187/**
188 * iwpm_remove_mapinfo - Remove local and mapped IPv4/IPv6 address
189 * info from the hash table
190 * @local_addr: Local ip/tcp address
191 * @mapped_addr: Mapped local ip/tcp address
192 *
193 * Returns err code if mapping info is not found in the hash table,
194 * otherwise returns 0
195 */
196int iwpm_remove_mapinfo(struct sockaddr_storage *local_addr,
197 struct sockaddr_storage *mapped_addr);
198
199#endif /* _IW_PORTMAP_H */
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index e38de79eeb48..0790882e0c9b 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -43,7 +43,7 @@ int ibnl_remove_client(int index);
43 * Returns the allocated buffer on success and NULL on failure. 43 * Returns the allocated buffer on success and NULL on failure.
44 */ 44 */
45void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq, 45void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
46 int len, int client, int op); 46 int len, int client, int op, int flags);
47/** 47/**
48 * Put a new attribute in a supplied skb. 48 * Put a new attribute in a supplied skb.
49 * @skb: The netlink skb. 49 * @skb: The netlink skb.
@@ -56,4 +56,25 @@ void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
56int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh, 56int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
57 int len, void *data, int type); 57 int len, void *data, int type);
58 58
59/**
60 * Send the supplied skb to a specific userspace PID.
61 * @skb: The netlink skb
62 * @nlh: Header of the netlink message to send
63 * @pid: Userspace netlink process ID
64 * Returns 0 on success or a negative error code.
65 */
66int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
67 __u32 pid);
68
69/**
70 * Send the supplied skb to a netlink group.
71 * @skb: The netlink skb
72 * @nlh: Header of the netlink message to send
73 * @group: Netlink group ID
74 * @flags: allocation flags
75 * Returns 0 on success or a negative error code.
76 */
77int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
78 unsigned int group, gfp_t flags);
79
59#endif /* _RDMA_NETLINK_H */ 80#endif /* _RDMA_NETLINK_H */
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index 25ac6283b9c7..a2594afe05c7 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -263,16 +263,16 @@ static inline struct osd_cdb_head *osd_cdb_head(struct osd_cdb *ocdb)
263 * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD 263 * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD
264 */ 264 */
265#define OSD_ACT___(Name, Num) \ 265#define OSD_ACT___(Name, Num) \
266 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), \ 266 OSD_ACT_##Name = cpu_to_be16(0x8880 + Num), \
267 OSDv1_ACT_##Name = __constant_cpu_to_be16(0x8800 + Num), 267 OSDv1_ACT_##Name = cpu_to_be16(0x8800 + Num),
268 268
269/* V2 only actions */ 269/* V2 only actions */
270#define OSD_ACT_V2(Name, Num) \ 270#define OSD_ACT_V2(Name, Num) \
271 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), 271 OSD_ACT_##Name = cpu_to_be16(0x8880 + Num),
272 272
273#define OSD_ACT_V1_V2(Name, Num1, Num2) \ 273#define OSD_ACT_V1_V2(Name, Num1, Num2) \
274 OSD_ACT_##Name = __constant_cpu_to_be16(Num2), \ 274 OSD_ACT_##Name = cpu_to_be16(Num2), \
275 OSDv1_ACT_##Name = __constant_cpu_to_be16(Num1), 275 OSDv1_ACT_##Name = cpu_to_be16(Num1),
276 276
277enum osd_service_actions { 277enum osd_service_actions {
278 OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00) 278 OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00)
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index dd7c998221b3..e0ae71098144 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -7,6 +7,7 @@
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/timer.h> 8#include <linux/timer.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10#include <scsi/scsi_device.h>
10 11
11struct Scsi_Host; 12struct Scsi_Host;
12struct scsi_device; 13struct scsi_device;
@@ -133,6 +134,15 @@ struct scsi_cmnd {
133 unsigned char tag; /* SCSI-II queued command tag */ 134 unsigned char tag; /* SCSI-II queued command tag */
134}; 135};
135 136
137/*
138 * Return the driver private allocation behind the command.
139 * Only works if cmd_size is set in the host template.
140 */
141static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd)
142{
143 return cmd + 1;
144}
145
136/* make sure not to use it with REQ_TYPE_BLOCK_PC commands */ 146/* make sure not to use it with REQ_TYPE_BLOCK_PC commands */
137static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) 147static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
138{ 148{
@@ -306,4 +316,20 @@ static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
306 cmd->result = (cmd->result & 0x00ffffff) | (status << 24); 316 cmd->result = (cmd->result & 0x00ffffff) | (status << 24);
307} 317}
308 318
319static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
320{
321 unsigned int xfer_len = scsi_out(scmd)->length;
322 unsigned int prot_op = scsi_get_prot_op(scmd);
323 unsigned int sector_size = scmd->device->sector_size;
324
325 switch (prot_op) {
326 case SCSI_PROT_NORMAL:
327 case SCSI_PROT_WRITE_STRIP:
328 case SCSI_PROT_READ_INSERT:
329 return xfer_len;
330 }
331
332 return xfer_len + (xfer_len >> ilog2(sector_size)) * 8;
333}
334
309#endif /* _SCSI_SCSI_CMND_H */ 335#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 5853c913d2b0..27ab31017f09 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -173,6 +173,7 @@ struct scsi_device {
173 unsigned is_visible:1; /* is the device visible in sysfs */ 173 unsigned is_visible:1; /* is the device visible in sysfs */
174 unsigned wce_default_on:1; /* Cache is ON by default */ 174 unsigned wce_default_on:1; /* Cache is ON by default */
175 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ 175 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
176 unsigned broken_fua:1; /* Don't set FUA bit */
176 177
177 atomic_t disk_events_disable_depth; /* disable depth for disk events */ 178 atomic_t disk_events_disable_depth; /* disable depth for disk events */
178 179
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 20fdfc2526ad..36c4114ed9bc 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -4,17 +4,17 @@
4#include <linux/device.h> 4#include <linux/device.h>
5 5
6struct module; 6struct module;
7struct request;
7struct scsi_cmnd; 8struct scsi_cmnd;
8struct scsi_device; 9struct scsi_device;
9struct request;
10struct request_queue;
11
12 10
13struct scsi_driver { 11struct scsi_driver {
14 struct module *owner; 12 struct module *owner;
15 struct device_driver gendrv; 13 struct device_driver gendrv;
16 14
17 void (*rescan)(struct device *); 15 void (*rescan)(struct device *);
16 int (*init_command)(struct scsi_cmnd *);
17 void (*uninit_command)(struct scsi_cmnd *);
18 int (*done)(struct scsi_cmnd *); 18 int (*done)(struct scsi_cmnd *);
19 int (*eh_action)(struct scsi_cmnd *, int); 19 int (*eh_action)(struct scsi_cmnd *, int);
20}; 20};
@@ -31,8 +31,5 @@ extern int scsi_register_interface(struct class_interface *);
31 31
32int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req); 32int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req);
33int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req); 33int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req);
34int scsi_prep_state_check(struct scsi_device *sdev, struct request *req);
35int scsi_prep_return(struct request_queue *q, struct request *req, int ret);
36int scsi_prep_fn(struct request_queue *, struct request *);
37 34
38#endif /* _SCSI_SCSI_DRIVER_H */ 35#endif /* _SCSI_SCSI_DRIVER_H */
diff --git a/include/sound/core.h b/include/sound/core.h
index eedda2cdfe57..1df3f2fe5350 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -116,6 +116,8 @@ struct snd_card {
116 int user_ctl_count; /* count of all user controls */ 116 int user_ctl_count; /* count of all user controls */
117 struct list_head controls; /* all controls for this card */ 117 struct list_head controls; /* all controls for this card */
118 struct list_head ctl_files; /* active control files */ 118 struct list_head ctl_files; /* active control files */
119 struct mutex user_ctl_lock; /* protects user controls against
120 concurrent access */
119 121
120 struct snd_info_entry *proc_root; /* root for soundcard specific files */ 122 struct snd_info_entry *proc_root; /* root for soundcard specific files */
121 struct snd_info_entry *proc_id; /* the card id */ 123 struct snd_info_entry *proc_id; /* the card id */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index b4d6697085fe..d854fb31c000 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -932,7 +932,7 @@ static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
932 struct timespec *tv) 932 struct timespec *tv)
933{ 933{
934 if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC) 934 if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC)
935 do_posix_clock_monotonic_gettime(tv); 935 ktime_get_ts(tv);
936 else 936 else
937 getnstimeofday(tv); 937 getnstimeofday(tv);
938} 938}
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index 33b487b5da92..daef9daa500c 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -70,7 +70,8 @@ extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
70extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *, 70extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
71 struct iscsi_tm_rsp *); 71 struct iscsi_tm_rsp *);
72extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *, 72extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
73 struct iscsi_text_rsp *); 73 struct iscsi_text_rsp *,
74 enum iscsit_transport_type);
74extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *, 75extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
75 struct iscsi_reject *); 76 struct iscsi_reject *);
76extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *, 77extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 3a1c1eea1fff..9adc1bca1178 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -59,6 +59,7 @@ int transport_subsystem_register(struct se_subsystem_api *);
59void transport_subsystem_release(struct se_subsystem_api *); 59void transport_subsystem_release(struct se_subsystem_api *);
60 60
61void target_complete_cmd(struct se_cmd *, u8); 61void target_complete_cmd(struct se_cmd *, u8);
62void target_complete_cmd_with_length(struct se_cmd *, u8, int);
62 63
63sense_reason_t spc_parse_cdb(struct se_cmd *cmd, unsigned int *size); 64sense_reason_t spc_parse_cdb(struct se_cmd *cmd, unsigned int *size);
64sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd); 65sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd);
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 6a1a0245474f..d4f70a7fe876 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -36,7 +36,7 @@ struct extent_status;
36 36
37#define show_map_flags(flags) __print_flags(flags, "|", \ 37#define show_map_flags(flags) __print_flags(flags, "|", \
38 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \ 38 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \
39 { EXT4_GET_BLOCKS_UNINIT_EXT, "UNINIT" }, \ 39 { EXT4_GET_BLOCKS_UNWRIT_EXT, "UNWRIT" }, \
40 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \ 40 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \
41 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \ 41 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \
42 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \ 42 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \
@@ -51,7 +51,6 @@ struct extent_status;
51 { EXT4_MAP_MAPPED, "M" }, \ 51 { EXT4_MAP_MAPPED, "M" }, \
52 { EXT4_MAP_UNWRITTEN, "U" }, \ 52 { EXT4_MAP_UNWRITTEN, "U" }, \
53 { EXT4_MAP_BOUNDARY, "B" }, \ 53 { EXT4_MAP_BOUNDARY, "B" }, \
54 { EXT4_MAP_UNINIT, "u" }, \
55 { EXT4_MAP_FROM_CLUSTER, "C" }) 54 { EXT4_MAP_FROM_CLUSTER, "C" })
56 55
57#define show_free_flags(flags) __print_flags(flags, "|", \ 56#define show_free_flags(flags) __print_flags(flags, "|", \
@@ -1497,7 +1496,7 @@ DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1497 TP_ARGS(inode) 1496 TP_ARGS(inode)
1498); 1497);
1499 1498
1500/* 'ux' is the uninitialized extent. */ 1499/* 'ux' is the unwritten extent. */
1501TRACE_EVENT(ext4_ext_convert_to_initialized_enter, 1500TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1502 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, 1501 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1503 struct ext4_extent *ux), 1502 struct ext4_extent *ux),
@@ -1533,7 +1532,7 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1533); 1532);
1534 1533
1535/* 1534/*
1536 * 'ux' is the uninitialized extent. 1535 * 'ux' is the unwritten extent.
1537 * 'ix' is the initialized extent to which blocks are transferred. 1536 * 'ix' is the initialized extent to which blocks are transferred.
1538 */ 1537 */
1539TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath, 1538TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
@@ -1811,7 +1810,7 @@ DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1811 TP_ARGS(sb, group, start, len) 1810 TP_ARGS(sb, group, start, len)
1812); 1811);
1813 1812
1814TRACE_EVENT(ext4_ext_handle_uninitialized_extents, 1813TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1815 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags, 1814 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1816 unsigned int allocated, ext4_fsblk_t newblock), 1815 unsigned int allocated, ext4_fsblk_t newblock),
1817 1816
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 67f38faac589..b983990b4a9f 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -659,6 +659,66 @@ DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio,
659 TP_CONDITION(bio) 659 TP_CONDITION(bio)
660); 660);
661 661
662TRACE_EVENT(f2fs_write_begin,
663
664 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
665 unsigned int flags),
666
667 TP_ARGS(inode, pos, len, flags),
668
669 TP_STRUCT__entry(
670 __field(dev_t, dev)
671 __field(ino_t, ino)
672 __field(loff_t, pos)
673 __field(unsigned int, len)
674 __field(unsigned int, flags)
675 ),
676
677 TP_fast_assign(
678 __entry->dev = inode->i_sb->s_dev;
679 __entry->ino = inode->i_ino;
680 __entry->pos = pos;
681 __entry->len = len;
682 __entry->flags = flags;
683 ),
684
685 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
686 show_dev_ino(__entry),
687 (unsigned long long)__entry->pos,
688 __entry->len,
689 __entry->flags)
690);
691
692TRACE_EVENT(f2fs_write_end,
693
694 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
695 unsigned int copied),
696
697 TP_ARGS(inode, pos, len, copied),
698
699 TP_STRUCT__entry(
700 __field(dev_t, dev)
701 __field(ino_t, ino)
702 __field(loff_t, pos)
703 __field(unsigned int, len)
704 __field(unsigned int, copied)
705 ),
706
707 TP_fast_assign(
708 __entry->dev = inode->i_sb->s_dev;
709 __entry->ino = inode->i_ino;
710 __entry->pos = pos;
711 __entry->len = len;
712 __entry->copied = copied;
713 ),
714
715 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
716 show_dev_ino(__entry),
717 (unsigned long long)__entry->pos,
718 __entry->len,
719 __entry->copied)
720);
721
662DECLARE_EVENT_CLASS(f2fs__page, 722DECLARE_EVENT_CLASS(f2fs__page,
663 723
664 TP_PROTO(struct page *page, int type), 724 TP_PROTO(struct page *page, int type),
@@ -672,6 +732,7 @@ DECLARE_EVENT_CLASS(f2fs__page,
672 __field(int, dir) 732 __field(int, dir)
673 __field(pgoff_t, index) 733 __field(pgoff_t, index)
674 __field(int, dirty) 734 __field(int, dirty)
735 __field(int, uptodate)
675 ), 736 ),
676 737
677 TP_fast_assign( 738 TP_fast_assign(
@@ -681,14 +742,31 @@ DECLARE_EVENT_CLASS(f2fs__page,
681 __entry->dir = S_ISDIR(page->mapping->host->i_mode); 742 __entry->dir = S_ISDIR(page->mapping->host->i_mode);
682 __entry->index = page->index; 743 __entry->index = page->index;
683 __entry->dirty = PageDirty(page); 744 __entry->dirty = PageDirty(page);
745 __entry->uptodate = PageUptodate(page);
684 ), 746 ),
685 747
686 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, dirty = %d", 748 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
749 "dirty = %d, uptodate = %d",
687 show_dev_ino(__entry), 750 show_dev_ino(__entry),
688 show_block_type(__entry->type), 751 show_block_type(__entry->type),
689 show_file_type(__entry->dir), 752 show_file_type(__entry->dir),
690 (unsigned long)__entry->index, 753 (unsigned long)__entry->index,
691 __entry->dirty) 754 __entry->dirty,
755 __entry->uptodate)
756);
757
758DEFINE_EVENT(f2fs__page, f2fs_writepage,
759
760 TP_PROTO(struct page *page, int type),
761
762 TP_ARGS(page, type)
763);
764
765DEFINE_EVENT(f2fs__page, f2fs_readpage,
766
767 TP_PROTO(struct page *page, int type),
768
769 TP_ARGS(page, type)
692); 770);
693 771
694DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty, 772DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
@@ -705,6 +783,70 @@ DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
705 TP_ARGS(page, type) 783 TP_ARGS(page, type)
706); 784);
707 785
786TRACE_EVENT(f2fs_writepages,
787
788 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
789
790 TP_ARGS(inode, wbc, type),
791
792 TP_STRUCT__entry(
793 __field(dev_t, dev)
794 __field(ino_t, ino)
795 __field(int, type)
796 __field(int, dir)
797 __field(long, nr_to_write)
798 __field(long, pages_skipped)
799 __field(loff_t, range_start)
800 __field(loff_t, range_end)
801 __field(pgoff_t, writeback_index)
802 __field(int, sync_mode)
803 __field(char, for_kupdate)
804 __field(char, for_background)
805 __field(char, tagged_writepages)
806 __field(char, for_reclaim)
807 __field(char, range_cyclic)
808 __field(char, for_sync)
809 ),
810
811 TP_fast_assign(
812 __entry->dev = inode->i_sb->s_dev;
813 __entry->ino = inode->i_ino;
814 __entry->type = type;
815 __entry->dir = S_ISDIR(inode->i_mode);
816 __entry->nr_to_write = wbc->nr_to_write;
817 __entry->pages_skipped = wbc->pages_skipped;
818 __entry->range_start = wbc->range_start;
819 __entry->range_end = wbc->range_end;
820 __entry->writeback_index = inode->i_mapping->writeback_index;
821 __entry->sync_mode = wbc->sync_mode;
822 __entry->for_kupdate = wbc->for_kupdate;
823 __entry->for_background = wbc->for_background;
824 __entry->tagged_writepages = wbc->tagged_writepages;
825 __entry->for_reclaim = wbc->for_reclaim;
826 __entry->range_cyclic = wbc->range_cyclic;
827 __entry->for_sync = wbc->for_sync;
828 ),
829
830 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
831 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
832 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
833 show_dev_ino(__entry),
834 show_block_type(__entry->type),
835 show_file_type(__entry->dir),
836 __entry->nr_to_write,
837 __entry->pages_skipped,
838 __entry->range_start,
839 __entry->range_end,
840 (unsigned long)__entry->writeback_index,
841 __entry->sync_mode,
842 __entry->for_kupdate,
843 __entry->for_background,
844 __entry->tagged_writepages,
845 __entry->for_reclaim,
846 __entry->range_cyclic,
847 __entry->for_sync)
848);
849
708TRACE_EVENT(f2fs_submit_page_mbio, 850TRACE_EVENT(f2fs_submit_page_mbio,
709 851
710 TP_PROTO(struct page *page, int rw, int type, block_t blk_addr), 852 TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 9a7e08d61258..d19840b0cac8 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -7,6 +7,9 @@
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/pm_qos.h> 8#include <linux/pm_qos.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10#include <linux/ftrace_event.h>
11
12#define TPS(x) tracepoint_string(x)
10 13
11DECLARE_EVENT_CLASS(cpu, 14DECLARE_EVENT_CLASS(cpu,
12 15
@@ -90,6 +93,17 @@ TRACE_EVENT(pstate_sample,
90#define PWR_EVENT_EXIT -1 93#define PWR_EVENT_EXIT -1
91#endif 94#endif
92 95
96#define pm_verb_symbolic(event) \
97 __print_symbolic(event, \
98 { PM_EVENT_SUSPEND, "suspend" }, \
99 { PM_EVENT_RESUME, "resume" }, \
100 { PM_EVENT_FREEZE, "freeze" }, \
101 { PM_EVENT_QUIESCE, "quiesce" }, \
102 { PM_EVENT_HIBERNATE, "hibernate" }, \
103 { PM_EVENT_THAW, "thaw" }, \
104 { PM_EVENT_RESTORE, "restore" }, \
105 { PM_EVENT_RECOVER, "recover" })
106
93DEFINE_EVENT(cpu, cpu_frequency, 107DEFINE_EVENT(cpu, cpu_frequency,
94 108
95 TP_PROTO(unsigned int frequency, unsigned int cpu_id), 109 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
@@ -97,58 +111,76 @@ DEFINE_EVENT(cpu, cpu_frequency,
97 TP_ARGS(frequency, cpu_id) 111 TP_ARGS(frequency, cpu_id)
98); 112);
99 113
100TRACE_EVENT(machine_suspend, 114TRACE_EVENT(device_pm_callback_start,
101 115
102 TP_PROTO(unsigned int state), 116 TP_PROTO(struct device *dev, const char *pm_ops, int event),
103 117
104 TP_ARGS(state), 118 TP_ARGS(dev, pm_ops, event),
105 119
106 TP_STRUCT__entry( 120 TP_STRUCT__entry(
107 __field( u32, state ) 121 __string(device, dev_name(dev))
122 __string(driver, dev_driver_string(dev))
123 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
124 __string(pm_ops, pm_ops ? pm_ops : "none ")
125 __field(int, event)
108 ), 126 ),
109 127
110 TP_fast_assign( 128 TP_fast_assign(
111 __entry->state = state; 129 __assign_str(device, dev_name(dev));
130 __assign_str(driver, dev_driver_string(dev));
131 __assign_str(parent,
132 dev->parent ? dev_name(dev->parent) : "none");
133 __assign_str(pm_ops, pm_ops ? pm_ops : "none ");
134 __entry->event = event;
112 ), 135 ),
113 136
114 TP_printk("state=%lu", (unsigned long)__entry->state) 137 TP_printk("%s %s, parent: %s, %s[%s]", __get_str(driver),
138 __get_str(device), __get_str(parent), __get_str(pm_ops),
139 pm_verb_symbolic(__entry->event))
115); 140);
116 141
117TRACE_EVENT(device_pm_report_time, 142TRACE_EVENT(device_pm_callback_end,
118 143
119 TP_PROTO(struct device *dev, const char *pm_ops, s64 ops_time, 144 TP_PROTO(struct device *dev, int error),
120 char *pm_event_str, int error),
121 145
122 TP_ARGS(dev, pm_ops, ops_time, pm_event_str, error), 146 TP_ARGS(dev, error),
123 147
124 TP_STRUCT__entry( 148 TP_STRUCT__entry(
125 __string(device, dev_name(dev)) 149 __string(device, dev_name(dev))
126 __string(driver, dev_driver_string(dev)) 150 __string(driver, dev_driver_string(dev))
127 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
128 __string(pm_ops, pm_ops ? pm_ops : "none ")
129 __string(pm_event_str, pm_event_str)
130 __field(s64, ops_time)
131 __field(int, error) 151 __field(int, error)
132 ), 152 ),
133 153
134 TP_fast_assign( 154 TP_fast_assign(
135 const char *tmp = dev->parent ? dev_name(dev->parent) : "none";
136 const char *tmp_i = pm_ops ? pm_ops : "none ";
137
138 __assign_str(device, dev_name(dev)); 155 __assign_str(device, dev_name(dev));
139 __assign_str(driver, dev_driver_string(dev)); 156 __assign_str(driver, dev_driver_string(dev));
140 __assign_str(parent, tmp);
141 __assign_str(pm_ops, tmp_i);
142 __assign_str(pm_event_str, pm_event_str);
143 __entry->ops_time = ops_time;
144 __entry->error = error; 157 __entry->error = error;
145 ), 158 ),
146 159
147 /* ops_str has an extra space at the end */ 160 TP_printk("%s %s, err=%d",
148 TP_printk("%s %s parent=%s state=%s ops=%snsecs=%lld err=%d", 161 __get_str(driver), __get_str(device), __entry->error)
149 __get_str(driver), __get_str(device), __get_str(parent), 162);
150 __get_str(pm_event_str), __get_str(pm_ops), 163
151 __entry->ops_time, __entry->error) 164TRACE_EVENT(suspend_resume,
165
166 TP_PROTO(const char *action, int val, bool start),
167
168 TP_ARGS(action, val, start),
169
170 TP_STRUCT__entry(
171 __field(const char *, action)
172 __field(int, val)
173 __field(bool, start)
174 ),
175
176 TP_fast_assign(
177 __entry->action = action;
178 __entry->val = val;
179 __entry->start = start;
180 ),
181
182 TP_printk("%s[%u] %s", __entry->action, (unsigned int)__entry->val,
183 (__entry->start)?"begin":"end")
152); 184);
153 185
154DECLARE_EVENT_CLASS(wakeup_source, 186DECLARE_EVENT_CLASS(wakeup_source,
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 67e1bbf83695..0a68d5ae584e 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -530,6 +530,26 @@ TRACE_EVENT(sched_swap_numa,
530 __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid, 530 __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid,
531 __entry->dst_cpu, __entry->dst_nid) 531 __entry->dst_cpu, __entry->dst_nid)
532); 532);
533
534/*
535 * Tracepoint for waking a polling cpu without an IPI.
536 */
537TRACE_EVENT(sched_wake_idle_without_ipi,
538
539 TP_PROTO(int cpu),
540
541 TP_ARGS(cpu),
542
543 TP_STRUCT__entry(
544 __field( int, cpu )
545 ),
546
547 TP_fast_assign(
548 __entry->cpu = cpu;
549 ),
550
551 TP_printk("cpu=%d", __entry->cpu)
552);
533#endif /* _TRACE_SCHED_H */ 553#endif /* _TRACE_SCHED_H */
534 554
535/* This part must be outside protection */ 555/* This part must be outside protection */
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 0a1a4f7caf09..26b4f2e13275 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -44,6 +44,12 @@
44#undef __field_ext 44#undef __field_ext
45#define __field_ext(type, item, filter_type) type item; 45#define __field_ext(type, item, filter_type) type item;
46 46
47#undef __field_struct
48#define __field_struct(type, item) type item;
49
50#undef __field_struct_ext
51#define __field_struct_ext(type, item, filter_type) type item;
52
47#undef __array 53#undef __array
48#define __array(type, item, len) type item[len]; 54#define __array(type, item, len) type item[len];
49 55
@@ -53,6 +59,9 @@
53#undef __string 59#undef __string
54#define __string(item, src) __dynamic_array(char, item, -1) 60#define __string(item, src) __dynamic_array(char, item, -1)
55 61
62#undef __bitmask
63#define __bitmask(item, nr_bits) __dynamic_array(char, item, -1)
64
56#undef TP_STRUCT__entry 65#undef TP_STRUCT__entry
57#define TP_STRUCT__entry(args...) args 66#define TP_STRUCT__entry(args...) args
58 67
@@ -119,6 +128,12 @@
119#undef __field_ext 128#undef __field_ext
120#define __field_ext(type, item, filter_type) 129#define __field_ext(type, item, filter_type)
121 130
131#undef __field_struct
132#define __field_struct(type, item)
133
134#undef __field_struct_ext
135#define __field_struct_ext(type, item, filter_type)
136
122#undef __array 137#undef __array
123#define __array(type, item, len) 138#define __array(type, item, len)
124 139
@@ -128,6 +143,9 @@
128#undef __string 143#undef __string
129#define __string(item, src) __dynamic_array(char, item, -1) 144#define __string(item, src) __dynamic_array(char, item, -1)
130 145
146#undef __bitmask
147#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
148
131#undef DECLARE_EVENT_CLASS 149#undef DECLARE_EVENT_CLASS
132#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 150#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
133 struct ftrace_data_offsets_##call { \ 151 struct ftrace_data_offsets_##call { \
@@ -197,9 +215,22 @@
197#define __get_dynamic_array(field) \ 215#define __get_dynamic_array(field) \
198 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 216 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
199 217
218#undef __get_dynamic_array_len
219#define __get_dynamic_array_len(field) \
220 ((__entry->__data_loc_##field >> 16) & 0xffff)
221
200#undef __get_str 222#undef __get_str
201#define __get_str(field) (char *)__get_dynamic_array(field) 223#define __get_str(field) (char *)__get_dynamic_array(field)
202 224
225#undef __get_bitmask
226#define __get_bitmask(field) \
227 ({ \
228 void *__bitmask = __get_dynamic_array(field); \
229 unsigned int __bitmask_size; \
230 __bitmask_size = __get_dynamic_array_len(field); \
231 ftrace_print_bitmask_seq(p, __bitmask, __bitmask_size); \
232 })
233
203#undef __print_flags 234#undef __print_flags
204#define __print_flags(flag, delim, flag_array...) \ 235#define __print_flags(flag, delim, flag_array...) \
205 ({ \ 236 ({ \
@@ -296,9 +327,21 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
296 if (ret) \ 327 if (ret) \
297 return ret; 328 return ret;
298 329
330#undef __field_struct_ext
331#define __field_struct_ext(type, item, filter_type) \
332 ret = trace_define_field(event_call, #type, #item, \
333 offsetof(typeof(field), item), \
334 sizeof(field.item), \
335 0, filter_type); \
336 if (ret) \
337 return ret;
338
299#undef __field 339#undef __field
300#define __field(type, item) __field_ext(type, item, FILTER_OTHER) 340#define __field(type, item) __field_ext(type, item, FILTER_OTHER)
301 341
342#undef __field_struct
343#define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER)
344
302#undef __array 345#undef __array
303#define __array(type, item, len) \ 346#define __array(type, item, len) \
304 do { \ 347 do { \
@@ -322,6 +365,9 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
322#undef __string 365#undef __string
323#define __string(item, src) __dynamic_array(char, item, -1) 366#define __string(item, src) __dynamic_array(char, item, -1)
324 367
368#undef __bitmask
369#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
370
325#undef DECLARE_EVENT_CLASS 371#undef DECLARE_EVENT_CLASS
326#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ 372#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
327static int notrace __init \ 373static int notrace __init \
@@ -357,6 +403,12 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
357#undef __field_ext 403#undef __field_ext
358#define __field_ext(type, item, filter_type) 404#define __field_ext(type, item, filter_type)
359 405
406#undef __field_struct
407#define __field_struct(type, item)
408
409#undef __field_struct_ext
410#define __field_struct_ext(type, item, filter_type)
411
360#undef __array 412#undef __array
361#define __array(type, item, len) 413#define __array(type, item, len)
362 414
@@ -372,6 +424,29 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
372#define __string(item, src) __dynamic_array(char, item, \ 424#define __string(item, src) __dynamic_array(char, item, \
373 strlen((src) ? (const char *)(src) : "(null)") + 1) 425 strlen((src) ? (const char *)(src) : "(null)") + 1)
374 426
427/*
428 * __bitmask_size_in_bytes_raw is the number of bytes needed to hold
429 * num_possible_cpus().
430 */
431#define __bitmask_size_in_bytes_raw(nr_bits) \
432 (((nr_bits) + 7) / 8)
433
434#define __bitmask_size_in_longs(nr_bits) \
435 ((__bitmask_size_in_bytes_raw(nr_bits) + \
436 ((BITS_PER_LONG / 8) - 1)) / (BITS_PER_LONG / 8))
437
438/*
439 * __bitmask_size_in_bytes is the number of bytes needed to hold
440 * num_possible_cpus() padded out to the nearest long. This is what
441 * is saved in the buffer, just to be consistent.
442 */
443#define __bitmask_size_in_bytes(nr_bits) \
444 (__bitmask_size_in_longs(nr_bits) * (BITS_PER_LONG / 8))
445
446#undef __bitmask
447#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, \
448 __bitmask_size_in_longs(nr_bits))
449
375#undef DECLARE_EVENT_CLASS 450#undef DECLARE_EVENT_CLASS
376#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 451#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
377static inline notrace int ftrace_get_offsets_##call( \ 452static inline notrace int ftrace_get_offsets_##call( \
@@ -505,6 +580,9 @@ static inline notrace int ftrace_get_offsets_##call( \
505#undef __field 580#undef __field
506#define __field(type, item) 581#define __field(type, item)
507 582
583#undef __field_struct
584#define __field_struct(type, item)
585
508#undef __array 586#undef __array
509#define __array(type, item, len) 587#define __array(type, item, len)
510 588
@@ -513,12 +591,22 @@ static inline notrace int ftrace_get_offsets_##call( \
513 __entry->__data_loc_##item = __data_offsets.item; 591 __entry->__data_loc_##item = __data_offsets.item;
514 592
515#undef __string 593#undef __string
516#define __string(item, src) __dynamic_array(char, item, -1) \ 594#define __string(item, src) __dynamic_array(char, item, -1)
517 595
518#undef __assign_str 596#undef __assign_str
519#define __assign_str(dst, src) \ 597#define __assign_str(dst, src) \
520 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); 598 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)");
521 599
600#undef __bitmask
601#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
602
603#undef __get_bitmask
604#define __get_bitmask(field) (char *)__get_dynamic_array(field)
605
606#undef __assign_bitmask
607#define __assign_bitmask(dst, src, nr_bits) \
608 memcpy(__get_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits))
609
522#undef TP_fast_assign 610#undef TP_fast_assign
523#define TP_fast_assign(args...) args 611#define TP_fast_assign(args...) args
524 612
@@ -585,7 +673,9 @@ static inline void ftrace_test_probe_##call(void) \
585#undef __print_symbolic 673#undef __print_symbolic
586#undef __print_hex 674#undef __print_hex
587#undef __get_dynamic_array 675#undef __get_dynamic_array
676#undef __get_dynamic_array_len
588#undef __get_str 677#undef __get_str
678#undef __get_bitmask
589 679
590#undef TP_printk 680#undef TP_printk
591#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) 681#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
@@ -648,9 +738,16 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
648#define __get_dynamic_array(field) \ 738#define __get_dynamic_array(field) \
649 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 739 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
650 740
741#undef __get_dynamic_array_len
742#define __get_dynamic_array_len(field) \
743 ((__entry->__data_loc_##field >> 16) & 0xffff)
744
651#undef __get_str 745#undef __get_str
652#define __get_str(field) (char *)__get_dynamic_array(field) 746#define __get_str(field) (char *)__get_dynamic_array(field)
653 747
748#undef __get_bitmask
749#define __get_bitmask(field) (char *)__get_dynamic_array(field)
750
654#undef __perf_addr 751#undef __perf_addr
655#define __perf_addr(a) (__addr = (a)) 752#define __perf_addr(a) (__addr = (a))
656 753
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index fed853f3d7aa..9674145e2f6a 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -4,6 +4,7 @@
4#include <linux/tracepoint.h> 4#include <linux/tracepoint.h>
5#include <linux/unistd.h> 5#include <linux/unistd.h>
6#include <linux/ftrace_event.h> 6#include <linux/ftrace_event.h>
7#include <linux/thread_info.h>
7 8
8#include <asm/ptrace.h> 9#include <asm/ptrace.h>
9 10
@@ -32,4 +33,18 @@ struct syscall_metadata {
32 struct ftrace_event_call *exit_event; 33 struct ftrace_event_call *exit_event;
33}; 34};
34 35
36#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
37static inline void syscall_tracepoint_update(struct task_struct *p)
38{
39 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
40 set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
41 else
42 clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
43}
44#else
45static inline void syscall_tracepoint_update(struct task_struct *p)
46{
47}
48#endif
49
35#endif /* _TRACE_SYSCALL_H */ 50#endif /* _TRACE_SYSCALL_H */
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index f104c2603ebe..def54f9e07ca 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -181,6 +181,7 @@ struct drm_mode_get_plane_res {
181#define DRM_MODE_ENCODER_TVDAC 4 181#define DRM_MODE_ENCODER_TVDAC 4
182#define DRM_MODE_ENCODER_VIRTUAL 5 182#define DRM_MODE_ENCODER_VIRTUAL 5
183#define DRM_MODE_ENCODER_DSI 6 183#define DRM_MODE_ENCODER_DSI 6
184#define DRM_MODE_ENCODER_DPMST 7
184 185
185struct drm_mode_get_encoder { 186struct drm_mode_get_encoder {
186 __u32 encoder_id; 187 __u32 encoder_id;
@@ -251,6 +252,21 @@ struct drm_mode_get_connector {
251#define DRM_MODE_PROP_BLOB (1<<4) 252#define DRM_MODE_PROP_BLOB (1<<4)
252#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ 253#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */
253 254
255/* non-extended types: legacy bitmask, one bit per type: */
256#define DRM_MODE_PROP_LEGACY_TYPE ( \
257 DRM_MODE_PROP_RANGE | \
258 DRM_MODE_PROP_ENUM | \
259 DRM_MODE_PROP_BLOB | \
260 DRM_MODE_PROP_BITMASK)
261
262/* extended-types: rather than continue to consume a bit per type,
263 * grab a chunk of the bits to use as integer type id.
264 */
265#define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0
266#define DRM_MODE_PROP_TYPE(n) ((n) << 6)
267#define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1)
268#define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2)
269
254struct drm_mode_property_enum { 270struct drm_mode_property_enum {
255 __u64 value; 271 __u64 value;
256 char name[DRM_PROP_NAME_LEN]; 272 char name[DRM_PROP_NAME_LEN];
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 126bfaa8bb6b..ff57f07c3249 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -223,6 +223,7 @@ typedef struct _drm_i915_sarea {
223#define DRM_I915_GEM_GET_CACHING 0x30 223#define DRM_I915_GEM_GET_CACHING 0x30
224#define DRM_I915_REG_READ 0x31 224#define DRM_I915_REG_READ 0x31
225#define DRM_I915_GET_RESET_STATS 0x32 225#define DRM_I915_GET_RESET_STATS 0x32
226#define DRM_I915_GEM_USERPTR 0x33
226 227
227#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 228#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
228#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 229#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -273,6 +274,7 @@ typedef struct _drm_i915_sarea {
273#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) 274#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
274#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) 275#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
275#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) 276#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
277#define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr)
276 278
277/* Allow drivers to submit batchbuffers directly to hardware, relying 279/* Allow drivers to submit batchbuffers directly to hardware, relying
278 * on the security mechanisms provided by hardware. 280 * on the security mechanisms provided by hardware.
@@ -337,6 +339,7 @@ typedef struct drm_i915_irq_wait {
337#define I915_PARAM_HAS_EXEC_NO_RELOC 25 339#define I915_PARAM_HAS_EXEC_NO_RELOC 25
338#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 340#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26
339#define I915_PARAM_HAS_WT 27 341#define I915_PARAM_HAS_WT 27
342#define I915_PARAM_CMD_PARSER_VERSION 28
340 343
341typedef struct drm_i915_getparam { 344typedef struct drm_i915_getparam {
342 int param; 345 int param;
@@ -1049,4 +1052,18 @@ struct drm_i915_reset_stats {
1049 __u32 pad; 1052 __u32 pad;
1050}; 1053};
1051 1054
1055struct drm_i915_gem_userptr {
1056 __u64 user_ptr;
1057 __u64 user_size;
1058 __u32 flags;
1059#define I915_USERPTR_READ_ONLY 0x1
1060#define I915_USERPTR_UNSYNCHRONIZED 0x80000000
1061 /**
1062 * Returned handle for the object.
1063 *
1064 * Object handles are nonzero.
1065 */
1066 __u32 handle;
1067};
1068
1052#endif /* _UAPI_I915_DRM_H_ */ 1069#endif /* _UAPI_I915_DRM_H_ */
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index aefa2f6afa3b..1cc0b610f162 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -1007,7 +1007,7 @@ struct drm_radeon_cs {
1007#define RADEON_INFO_NUM_BYTES_MOVED 0x1d 1007#define RADEON_INFO_NUM_BYTES_MOVED 0x1d
1008#define RADEON_INFO_VRAM_USAGE 0x1e 1008#define RADEON_INFO_VRAM_USAGE 0x1e
1009#define RADEON_INFO_GTT_USAGE 0x1f 1009#define RADEON_INFO_GTT_USAGE 0x1f
1010 1010#define RADEON_INFO_ACTIVE_CU_COUNT 0x20
1011 1011
1012struct drm_radeon_info { 1012struct drm_radeon_info {
1013 uint32_t request; 1013 uint32_t request;
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 4c31a366be16..3b9ff33e1768 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -342,6 +342,7 @@ enum {
342#define __AUDIT_ARCH_64BIT 0x80000000 342#define __AUDIT_ARCH_64BIT 0x80000000
343#define __AUDIT_ARCH_LE 0x40000000 343#define __AUDIT_ARCH_LE 0x40000000
344 344
345#define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
345#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 346#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
346#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) 347#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
347#define AUDIT_ARCH_ARMEB (EM_ARM) 348#define AUDIT_ARCH_ARMEB (EM_ARM)
@@ -385,6 +386,14 @@ enum {
385 */ 386 */
386#define AUDIT_MESSAGE_TEXT_MAX 8560 387#define AUDIT_MESSAGE_TEXT_MAX 8560
387 388
389/* Multicast Netlink socket groups (default up to 32) */
390enum audit_nlgrps {
391 AUDIT_NLGRP_NONE, /* Group 0 not used */
392 AUDIT_NLGRP_READLOG, /* "best effort" read only socket */
393 __AUDIT_NLGRP_MAX
394};
395#define AUDIT_NLGRP_MAX (__AUDIT_NLGRP_MAX - 1)
396
388struct audit_status { 397struct audit_status {
389 __u32 mask; /* Bit mask for valid entries */ 398 __u32 mask; /* Bit mask for valid entries */
390 __u32 enabled; /* 1 = enabled, 0 = disabled */ 399 __u32 enabled; /* 1 = enabled, 0 = disabled */
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index b4d69092fbdb..2f47824e7a36 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -38,6 +38,7 @@ struct btrfs_ioctl_vol_args {
38#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) 38#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
39#define BTRFS_FSID_SIZE 16 39#define BTRFS_FSID_SIZE 16
40#define BTRFS_UUID_SIZE 16 40#define BTRFS_UUID_SIZE 16
41#define BTRFS_UUID_UNPARSED_SIZE 37
41 42
42#define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) 43#define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
43 44
@@ -181,7 +182,11 @@ struct btrfs_ioctl_fs_info_args {
181 __u64 max_id; /* out */ 182 __u64 max_id; /* out */
182 __u64 num_devices; /* out */ 183 __u64 num_devices; /* out */
183 __u8 fsid[BTRFS_FSID_SIZE]; /* out */ 184 __u8 fsid[BTRFS_FSID_SIZE]; /* out */
184 __u64 reserved[124]; /* pad to 1k */ 185 __u32 nodesize; /* out */
186 __u32 sectorsize; /* out */
187 __u32 clone_alignment; /* out */
188 __u32 reserved32;
189 __u64 reserved[122]; /* pad to 1k */
185}; 190};
186 191
187struct btrfs_ioctl_feature_flags { 192struct btrfs_ioctl_feature_flags {
@@ -211,7 +216,8 @@ struct btrfs_balance_args {
211 216
212 __u64 flags; 217 __u64 flags;
213 218
214 __u64 unused[8]; 219 __u64 limit; /* limit number of processed chunks */
220 __u64 unused[7];
215} __attribute__ ((__packed__)); 221} __attribute__ ((__packed__));
216 222
217/* report balance progress to userspace */ 223/* report balance progress to userspace */
@@ -301,6 +307,14 @@ struct btrfs_ioctl_search_args {
301 char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; 307 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
302}; 308};
303 309
310struct btrfs_ioctl_search_args_v2 {
311 struct btrfs_ioctl_search_key key; /* in/out - search parameters */
312 __u64 buf_size; /* in - size of buffer
313 * out - on EOVERFLOW: needed size
314 * to store item */
315 __u64 buf[0]; /* out - found items */
316};
317
304struct btrfs_ioctl_clone_range_args { 318struct btrfs_ioctl_clone_range_args {
305 __s64 src_fd; 319 __s64 src_fd;
306 __u64 src_offset, src_length; 320 __u64 src_offset, src_length;
@@ -553,6 +567,8 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
553 struct btrfs_ioctl_defrag_range_args) 567 struct btrfs_ioctl_defrag_range_args)
554#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ 568#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
555 struct btrfs_ioctl_search_args) 569 struct btrfs_ioctl_search_args)
570#define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
571 struct btrfs_ioctl_search_args_v2)
556#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ 572#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \
557 struct btrfs_ioctl_ino_lookup_args) 573 struct btrfs_ioctl_ino_lookup_args)
558#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64) 574#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h
index 5d9d1d140718..41892f720057 100644
--- a/include/uapi/linux/can.h
+++ b/include/uapi/linux/can.h
@@ -42,8 +42,8 @@
42 * DAMAGE. 42 * DAMAGE.
43 */ 43 */
44 44
45#ifndef CAN_H 45#ifndef _UAPI_CAN_H
46#define CAN_H 46#define _UAPI_CAN_H
47 47
48#include <linux/types.h> 48#include <linux/types.h>
49#include <linux/socket.h> 49#include <linux/socket.h>
@@ -191,4 +191,4 @@ struct can_filter {
191 191
192#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ 192#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */
193 193
194#endif /* CAN_H */ 194#endif /* !_UAPI_CAN_H */
diff --git a/include/uapi/linux/can/bcm.h b/include/uapi/linux/can/bcm.h
index 382251a1d214..89ddb9dc9bdf 100644
--- a/include/uapi/linux/can/bcm.h
+++ b/include/uapi/linux/can/bcm.h
@@ -41,8 +41,8 @@
41 * DAMAGE. 41 * DAMAGE.
42 */ 42 */
43 43
44#ifndef CAN_BCM_H 44#ifndef _UAPI_CAN_BCM_H
45#define CAN_BCM_H 45#define _UAPI_CAN_BCM_H
46 46
47#include <linux/types.h> 47#include <linux/types.h>
48#include <linux/can.h> 48#include <linux/can.h>
@@ -95,4 +95,4 @@ enum {
95#define TX_RESET_MULTI_IDX 0x0200 95#define TX_RESET_MULTI_IDX 0x0200
96#define RX_RTR_FRAME 0x0400 96#define RX_RTR_FRAME 0x0400
97 97
98#endif /* CAN_BCM_H */ 98#endif /* !_UAPI_CAN_BCM_H */
diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h
index b63204545320..c247446ab25a 100644
--- a/include/uapi/linux/can/error.h
+++ b/include/uapi/linux/can/error.h
@@ -41,8 +41,8 @@
41 * DAMAGE. 41 * DAMAGE.
42 */ 42 */
43 43
44#ifndef CAN_ERROR_H 44#ifndef _UAPI_CAN_ERROR_H
45#define CAN_ERROR_H 45#define _UAPI_CAN_ERROR_H
46 46
47#define CAN_ERR_DLC 8 /* dlc for error message frames */ 47#define CAN_ERR_DLC 8 /* dlc for error message frames */
48 48
@@ -120,4 +120,4 @@
120 120
121/* controller specific additional information / data[5..7] */ 121/* controller specific additional information / data[5..7] */
122 122
123#endif /* CAN_ERROR_H */ 123#endif /* _UAPI_CAN_ERROR_H */
diff --git a/include/uapi/linux/can/gw.h b/include/uapi/linux/can/gw.h
index 844c8964bdfe..3e6184cf2f6d 100644
--- a/include/uapi/linux/can/gw.h
+++ b/include/uapi/linux/can/gw.h
@@ -41,8 +41,8 @@
41 * DAMAGE. 41 * DAMAGE.
42 */ 42 */
43 43
44#ifndef CAN_GW_H 44#ifndef _UAPI_CAN_GW_H
45#define CAN_GW_H 45#define _UAPI_CAN_GW_H
46 46
47#include <linux/types.h> 47#include <linux/types.h>
48#include <linux/can.h> 48#include <linux/can.h>
@@ -200,4 +200,4 @@ enum {
200 * Beware of sending unpacked or aligned structs! 200 * Beware of sending unpacked or aligned structs!
201 */ 201 */
202 202
203#endif 203#endif /* !_UAPI_CAN_GW_H */
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index 7e2e1863db16..813d11f54977 100644
--- a/include/uapi/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
@@ -15,8 +15,8 @@
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 */ 16 */
17 17
18#ifndef CAN_NETLINK_H 18#ifndef _UAPI_CAN_NETLINK_H
19#define CAN_NETLINK_H 19#define _UAPI_CAN_NETLINK_H
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22 22
@@ -130,4 +130,4 @@ enum {
130 130
131#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) 131#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
132 132
133#endif /* CAN_NETLINK_H */ 133#endif /* !_UAPI_CAN_NETLINK_H */
diff --git a/include/uapi/linux/can/raw.h b/include/uapi/linux/can/raw.h
index c7d8c334e0ce..78ec76fd89a6 100644
--- a/include/uapi/linux/can/raw.h
+++ b/include/uapi/linux/can/raw.h
@@ -42,8 +42,8 @@
42 * DAMAGE. 42 * DAMAGE.
43 */ 43 */
44 44
45#ifndef CAN_RAW_H 45#ifndef _UAPI_CAN_RAW_H
46#define CAN_RAW_H 46#define _UAPI_CAN_RAW_H
47 47
48#include <linux/can.h> 48#include <linux/can.h>
49 49
@@ -59,4 +59,4 @@ enum {
59 CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */ 59 CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */
60}; 60};
61 61
62#endif 62#endif /* !_UAPI_CAN_RAW_H */
diff --git a/include/uapi/linux/capability.h b/include/uapi/linux/capability.h
index 154dd6d3c8fe..12c37a197d24 100644
--- a/include/uapi/linux/capability.h
+++ b/include/uapi/linux/capability.h
@@ -347,7 +347,12 @@ struct vfs_cap_data {
347 347
348#define CAP_BLOCK_SUSPEND 36 348#define CAP_BLOCK_SUSPEND 36
349 349
350#define CAP_LAST_CAP CAP_BLOCK_SUSPEND 350/* Allow reading the audit log via multicast netlink socket */
351
352#define CAP_AUDIT_READ 37
353
354
355#define CAP_LAST_CAP CAP_AUDIT_READ
351 356
352#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) 357#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
353 358
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index fd161e91b6d7..e3c7a719c76b 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -847,6 +847,38 @@ struct ethtool_rxfh_indir {
847}; 847};
848 848
849/** 849/**
850 * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
851 * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
852 * @rss_context: RSS context identifier.
853 * @indir_size: On entry, the array size of the user buffer for the
854 * indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
855 * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH,
856 * the array size of the hardware indirection table.
857 * @key_size: On entry, the array size of the user buffer for the hash key,
858 * which may be zero. On return from %ETHTOOL_GRSSH, the size of the
859 * hardware hash key.
860 * @rsvd: Reserved for future extensions.
861 * @rss_config: RX ring/queue index for each hash value i.e., indirection table
862 * of @indir_size __u32 elements, followed by hash key of @key_size
863 * bytes.
864 *
865 * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the
866 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
867 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
868 * and a @indir_size of zero means the indir table should be reset to default
869 * values.
870 */
871struct ethtool_rxfh {
872 __u32 cmd;
873 __u32 rss_context;
874 __u32 indir_size;
875 __u32 key_size;
876 __u32 rsvd[2];
877 __u32 rss_config[0];
878};
879#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
880
881/**
850 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter 882 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
851 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 883 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
852 * @h_u: Flow field values to match (dependent on @flow_type) 884 * @h_u: Flow field values to match (dependent on @flow_type)
@@ -1118,6 +1150,9 @@ enum ethtool_sfeatures_retval_bits {
1118#define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */ 1150#define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */
1119#define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */ 1151#define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */
1120 1152
1153#define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */
1154#define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */
1155
1121/* compatibility with older code */ 1156/* compatibility with older code */
1122#define SPARC_ETH_GSET ETHTOOL_GSET 1157#define SPARC_ETH_GSET ETHTOOL_GSET
1123#define SPARC_ETH_SSET ETHTOOL_SSET 1158#define SPARC_ETH_SSET ETHTOOL_SSET
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h
index 8eb9ccaa5b48..253b4d42cf2b 100644
--- a/include/uapi/linux/filter.h
+++ b/include/uapi/linux/filter.h
@@ -130,7 +130,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
130#define SKF_AD_VLAN_TAG 44 130#define SKF_AD_VLAN_TAG 44
131#define SKF_AD_VLAN_TAG_PRESENT 48 131#define SKF_AD_VLAN_TAG_PRESENT 48
132#define SKF_AD_PAY_OFFSET 52 132#define SKF_AD_PAY_OFFSET 52
133#define SKF_AD_MAX 56 133#define SKF_AD_RANDOM 56
134#define SKF_AD_MAX 60
134#define SKF_NET_OFF (-0x100000) 135#define SKF_NET_OFF (-0x100000)
135#define SKF_LL_OFF (-0x200000) 136#define SKF_LL_OFF (-0x200000)
136 137
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 40b5ca8a1b1f..25084a052a1e 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -101,6 +101,7 @@
101 * - add FATTR_CTIME 101 * - add FATTR_CTIME
102 * - add ctime and ctimensec to fuse_setattr_in 102 * - add ctime and ctimensec to fuse_setattr_in
103 * - add FUSE_RENAME2 request 103 * - add FUSE_RENAME2 request
104 * - add FUSE_NO_OPEN_SUPPORT flag
104 */ 105 */
105 106
106#ifndef _LINUX_FUSE_H 107#ifndef _LINUX_FUSE_H
@@ -229,6 +230,7 @@ struct fuse_file_lock {
229 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 230 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
230 * FUSE_ASYNC_DIO: asynchronous direct I/O submission 231 * FUSE_ASYNC_DIO: asynchronous direct I/O submission
231 * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes 232 * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
233 * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
232 */ 234 */
233#define FUSE_ASYNC_READ (1 << 0) 235#define FUSE_ASYNC_READ (1 << 0)
234#define FUSE_POSIX_LOCKS (1 << 1) 236#define FUSE_POSIX_LOCKS (1 << 1)
@@ -247,6 +249,7 @@ struct fuse_file_lock {
247#define FUSE_READDIRPLUS_AUTO (1 << 14) 249#define FUSE_READDIRPLUS_AUTO (1 << 14)
248#define FUSE_ASYNC_DIO (1 << 15) 250#define FUSE_ASYNC_DIO (1 << 15)
249#define FUSE_WRITEBACK_CACHE (1 << 16) 251#define FUSE_WRITEBACK_CACHE (1 << 16)
252#define FUSE_NO_OPEN_SUPPORT (1 << 17)
250 253
251/** 254/**
252 * CUSE INIT request/reply flags 255 * CUSE INIT request/reply flags
diff --git a/include/uapi/linux/if_fddi.h b/include/uapi/linux/if_fddi.h
index 0d36909c3aef..1086cd9f6754 100644
--- a/include/uapi/linux/if_fddi.h
+++ b/include/uapi/linux/if_fddi.h
@@ -30,74 +30,76 @@
30 * Define max and min legal sizes. The frame sizes do not include 30 * Define max and min legal sizes. The frame sizes do not include
31 * 4 byte FCS/CRC (frame check sequence). 31 * 4 byte FCS/CRC (frame check sequence).
32 */ 32 */
33#define FDDI_K_ALEN 6 /* Octets in one FDDI address */ 33#define FDDI_K_ALEN 6 /* Octets in one FDDI address */
34#define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */ 34#define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */
35#define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */ 35#define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */
36#define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans FCS */ 36#define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans
37#define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans FCS */ 37 FCS */
38#define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans
39 FCS */
38#define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */ 40#define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */
39#define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */ 41#define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */
40#define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */ 42#define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */
41#define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */ 43#define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */
44#define FDDI_K_OUI_LEN 3 /* Octets in OUI in 802.2 SNAP
45 header */
42 46
43/* Define FDDI Frame Control (FC) Byte values */ 47/* Define FDDI Frame Control (FC) Byte values */
44#define FDDI_FC_K_VOID 0x00 48#define FDDI_FC_K_VOID 0x00
45#define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80 49#define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80
46#define FDDI_FC_K_RESTRICTED_TOKEN 0xC0 50#define FDDI_FC_K_RESTRICTED_TOKEN 0xC0
47#define FDDI_FC_K_SMT_MIN 0x41 51#define FDDI_FC_K_SMT_MIN 0x41
48#define FDDI_FC_K_SMT_MAX 0x4F 52#define FDDI_FC_K_SMT_MAX 0x4F
49#define FDDI_FC_K_MAC_MIN 0xC1 53#define FDDI_FC_K_MAC_MIN 0xC1
50#define FDDI_FC_K_MAC_MAX 0xCF 54#define FDDI_FC_K_MAC_MAX 0xCF
51#define FDDI_FC_K_ASYNC_LLC_MIN 0x50 55#define FDDI_FC_K_ASYNC_LLC_MIN 0x50
52#define FDDI_FC_K_ASYNC_LLC_DEF 0x54 56#define FDDI_FC_K_ASYNC_LLC_DEF 0x54
53#define FDDI_FC_K_ASYNC_LLC_MAX 0x5F 57#define FDDI_FC_K_ASYNC_LLC_MAX 0x5F
54#define FDDI_FC_K_SYNC_LLC_MIN 0xD0 58#define FDDI_FC_K_SYNC_LLC_MIN 0xD0
55#define FDDI_FC_K_SYNC_LLC_MAX 0xD7 59#define FDDI_FC_K_SYNC_LLC_MAX 0xD7
56#define FDDI_FC_K_IMPLEMENTOR_MIN 0x60 60#define FDDI_FC_K_IMPLEMENTOR_MIN 0x60
57#define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F 61#define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F
58#define FDDI_FC_K_RESERVED_MIN 0x70 62#define FDDI_FC_K_RESERVED_MIN 0x70
59#define FDDI_FC_K_RESERVED_MAX 0x7F 63#define FDDI_FC_K_RESERVED_MAX 0x7F
60 64
61/* Define LLC and SNAP constants */ 65/* Define LLC and SNAP constants */
62#define FDDI_EXTENDED_SAP 0xAA 66#define FDDI_EXTENDED_SAP 0xAA
63#define FDDI_UI_CMD 0x03 67#define FDDI_UI_CMD 0x03
64 68
65/* Define 802.2 Type 1 header */ 69/* Define 802.2 Type 1 header */
66struct fddi_8022_1_hdr { 70struct fddi_8022_1_hdr {
67 __u8 dsap; /* destination service access point */ 71 __u8 dsap; /* destination service access point */
68 __u8 ssap; /* source service access point */ 72 __u8 ssap; /* source service access point */
69 __u8 ctrl; /* control byte #1 */ 73 __u8 ctrl; /* control byte #1 */
70} __attribute__((packed)); 74} __attribute__((packed));
71 75
72/* Define 802.2 Type 2 header */ 76/* Define 802.2 Type 2 header */
73struct fddi_8022_2_hdr { 77struct fddi_8022_2_hdr {
74 __u8 dsap; /* destination service access point */ 78 __u8 dsap; /* destination service access point */
75 __u8 ssap; /* source service access point */ 79 __u8 ssap; /* source service access point */
76 __u8 ctrl_1; /* control byte #1 */ 80 __u8 ctrl_1; /* control byte #1 */
77 __u8 ctrl_2; /* control byte #2 */ 81 __u8 ctrl_2; /* control byte #2 */
78} __attribute__((packed)); 82} __attribute__((packed));
79 83
80/* Define 802.2 SNAP header */ 84/* Define 802.2 SNAP header */
81#define FDDI_K_OUI_LEN 3
82struct fddi_snap_hdr { 85struct fddi_snap_hdr {
83 __u8 dsap; /* always 0xAA */ 86 __u8 dsap; /* always 0xAA */
84 __u8 ssap; /* always 0xAA */ 87 __u8 ssap; /* always 0xAA */
85 __u8 ctrl; /* always 0x03 */ 88 __u8 ctrl; /* always 0x03 */
86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ 89 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
87 __be16 ethertype; /* packet type ID field */ 90 __be16 ethertype; /* packet type ID field */
88} __attribute__((packed)); 91} __attribute__((packed));
89 92
90/* Define FDDI LLC frame header */ 93/* Define FDDI LLC frame header */
91struct fddihdr { 94struct fddihdr {
92 __u8 fc; /* frame control */ 95 __u8 fc; /* frame control */
93 __u8 daddr[FDDI_K_ALEN]; /* destination address */ 96 __u8 daddr[FDDI_K_ALEN]; /* destination address */
94 __u8 saddr[FDDI_K_ALEN]; /* source address */ 97 __u8 saddr[FDDI_K_ALEN]; /* source address */
95 union 98 union {
96 { 99 struct fddi_8022_1_hdr llc_8022_1;
97 struct fddi_8022_1_hdr llc_8022_1; 100 struct fddi_8022_2_hdr llc_8022_2;
98 struct fddi_8022_2_hdr llc_8022_2; 101 struct fddi_snap_hdr llc_snap;
99 struct fddi_snap_hdr llc_snap; 102 } hdr;
100 } hdr;
101} __attribute__((packed)); 103} __attribute__((packed));
102 104
103 105
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 9a7f7ace6649..b38534895db5 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -319,6 +319,9 @@ enum {
319 IFLA_VXLAN_PORT, /* destination port */ 319 IFLA_VXLAN_PORT, /* destination port */
320 IFLA_VXLAN_GROUP6, 320 IFLA_VXLAN_GROUP6,
321 IFLA_VXLAN_LOCAL6, 321 IFLA_VXLAN_LOCAL6,
322 IFLA_VXLAN_UDP_CSUM,
323 IFLA_VXLAN_UDP_ZERO_CSUM6_TX,
324 IFLA_VXLAN_UDP_ZERO_CSUM6_RX,
322 __IFLA_VXLAN_MAX 325 __IFLA_VXLAN_MAX
323}; 326};
324#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) 327#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
@@ -399,9 +402,10 @@ enum {
399 IFLA_VF_UNSPEC, 402 IFLA_VF_UNSPEC,
400 IFLA_VF_MAC, /* Hardware queue specific attributes */ 403 IFLA_VF_MAC, /* Hardware queue specific attributes */
401 IFLA_VF_VLAN, 404 IFLA_VF_VLAN,
402 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ 405 IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */
403 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ 406 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
404 IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ 407 IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */
408 IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */
405 __IFLA_VF_MAX, 409 __IFLA_VF_MAX,
406}; 410};
407 411
@@ -423,6 +427,12 @@ struct ifla_vf_tx_rate {
423 __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ 427 __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
424}; 428};
425 429
430struct ifla_vf_rate {
431 __u32 vf;
432 __u32 min_tx_rate; /* Min Bandwidth in Mbps */
433 __u32 max_tx_rate; /* Max Bandwidth in Mbps */
434};
435
426struct ifla_vf_spoofchk { 436struct ifla_vf_spoofchk {
427 __u32 vf; 437 __u32 vf;
428 __u32 setting; 438 __u32 setting;
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index aee73d0611fb..3bce9e9d9f7c 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -100,7 +100,7 @@ enum {
100#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) 100#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
101 101
102/* VTI-mode i_flags */ 102/* VTI-mode i_flags */
103#define VTI_ISVTI 0x0001 103#define VTI_ISVTI ((__force __be16)0x0001)
104 104
105enum { 105enum {
106 IFLA_VTI_UNSPEC, 106 IFLA_VTI_UNSPEC,
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index e11d8f170a62..9b744af871d7 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -399,13 +399,18 @@ struct kvm_vapic_addr {
399 __u64 vapic_addr; 399 __u64 vapic_addr;
400}; 400};
401 401
402/* for KVM_SET_MPSTATE */ 402/* for KVM_SET_MP_STATE */
403 403
404/* not all states are valid on all architectures */
404#define KVM_MP_STATE_RUNNABLE 0 405#define KVM_MP_STATE_RUNNABLE 0
405#define KVM_MP_STATE_UNINITIALIZED 1 406#define KVM_MP_STATE_UNINITIALIZED 1
406#define KVM_MP_STATE_INIT_RECEIVED 2 407#define KVM_MP_STATE_INIT_RECEIVED 2
407#define KVM_MP_STATE_HALTED 3 408#define KVM_MP_STATE_HALTED 3
408#define KVM_MP_STATE_SIPI_RECEIVED 4 409#define KVM_MP_STATE_SIPI_RECEIVED 4
410#define KVM_MP_STATE_STOPPED 5
411#define KVM_MP_STATE_CHECK_STOP 6
412#define KVM_MP_STATE_OPERATING 7
413#define KVM_MP_STATE_LOAD 8
409 414
410struct kvm_mp_state { 415struct kvm_mp_state {
411 __u32 mp_state; 416 __u32 mp_state;
diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h
index 2841f86eae0b..bf6cd7d5cac2 100644
--- a/include/uapi/linux/kvm_para.h
+++ b/include/uapi/linux/kvm_para.h
@@ -20,6 +20,9 @@
20#define KVM_HC_FEATURES 3 20#define KVM_HC_FEATURES 3
21#define KVM_HC_PPC_MAP_MAGIC_PAGE 4 21#define KVM_HC_PPC_MAP_MAGIC_PAGE 4
22#define KVM_HC_KICK_CPU 5 22#define KVM_HC_KICK_CPU 5
23#define KVM_HC_MIPS_GET_CLOCK_FREQ 6
24#define KVM_HC_MIPS_EXIT_VM 7
25#define KVM_HC_MIPS_CONSOLE_OUTPUT 8
23 26
24/* 27/*
25 * hypercalls use architecture specific 28 * hypercalls use architecture specific
diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h
index 8adb68160327..21caa2631c20 100644
--- a/include/uapi/linux/l2tp.h
+++ b/include/uapi/linux/l2tp.h
@@ -124,6 +124,8 @@ enum {
124 L2TP_ATTR_STATS, /* nested */ 124 L2TP_ATTR_STATS, /* nested */
125 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */ 125 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
126 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */ 126 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
127 L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* u8 */
128 L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* u8 */
127 __L2TP_ATTR_MAX, 129 __L2TP_ATTR_MAX,
128}; 130};
129 131
diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
index d3ef583104e0..4a1d7e96dfe3 100644
--- a/include/uapi/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
@@ -24,6 +24,7 @@ enum {
24 NDA_PORT, 24 NDA_PORT,
25 NDA_VNI, 25 NDA_VNI,
26 NDA_IFINDEX, 26 NDA_IFINDEX,
27 NDA_MASTER,
27 __NDA_MAX 28 __NDA_MAX
28}; 29};
29 30
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index c88ccbfda5f1..2a88f645a5d8 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -212,6 +212,29 @@ enum nft_set_flags {
212}; 212};
213 213
214/** 214/**
215 * enum nft_set_policies - set selection policy
216 *
217 * @NFT_SET_POL_PERFORMANCE: prefer high performance over low memory use
218 * @NFT_SET_POL_MEMORY: prefer low memory use over high performance
219 */
220enum nft_set_policies {
221 NFT_SET_POL_PERFORMANCE,
222 NFT_SET_POL_MEMORY,
223};
224
225/**
226 * enum nft_set_desc_attributes - set element description
227 *
228 * @NFTA_SET_DESC_SIZE: number of elements in set (NLA_U32)
229 */
230enum nft_set_desc_attributes {
231 NFTA_SET_DESC_UNSPEC,
232 NFTA_SET_DESC_SIZE,
233 __NFTA_SET_DESC_MAX
234};
235#define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1)
236
237/**
215 * enum nft_set_attributes - nf_tables set netlink attributes 238 * enum nft_set_attributes - nf_tables set netlink attributes
216 * 239 *
217 * @NFTA_SET_TABLE: table name (NLA_STRING) 240 * @NFTA_SET_TABLE: table name (NLA_STRING)
@@ -221,6 +244,9 @@ enum nft_set_flags {
221 * @NFTA_SET_KEY_LEN: key data length (NLA_U32) 244 * @NFTA_SET_KEY_LEN: key data length (NLA_U32)
222 * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32) 245 * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32)
223 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32) 246 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32)
247 * @NFTA_SET_POLICY: selection policy (NLA_U32)
248 * @NFTA_SET_DESC: set description (NLA_NESTED)
249 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
224 */ 250 */
225enum nft_set_attributes { 251enum nft_set_attributes {
226 NFTA_SET_UNSPEC, 252 NFTA_SET_UNSPEC,
@@ -231,6 +257,9 @@ enum nft_set_attributes {
231 NFTA_SET_KEY_LEN, 257 NFTA_SET_KEY_LEN,
232 NFTA_SET_DATA_TYPE, 258 NFTA_SET_DATA_TYPE,
233 NFTA_SET_DATA_LEN, 259 NFTA_SET_DATA_LEN,
260 NFTA_SET_POLICY,
261 NFTA_SET_DESC,
262 NFTA_SET_ID,
234 __NFTA_SET_MAX 263 __NFTA_SET_MAX
235}; 264};
236#define NFTA_SET_MAX (__NFTA_SET_MAX - 1) 265#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
@@ -266,12 +295,14 @@ enum nft_set_elem_attributes {
266 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING) 295 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING)
267 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING) 296 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING)
268 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes) 297 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes)
298 * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
269 */ 299 */
270enum nft_set_elem_list_attributes { 300enum nft_set_elem_list_attributes {
271 NFTA_SET_ELEM_LIST_UNSPEC, 301 NFTA_SET_ELEM_LIST_UNSPEC,
272 NFTA_SET_ELEM_LIST_TABLE, 302 NFTA_SET_ELEM_LIST_TABLE,
273 NFTA_SET_ELEM_LIST_SET, 303 NFTA_SET_ELEM_LIST_SET,
274 NFTA_SET_ELEM_LIST_ELEMENTS, 304 NFTA_SET_ELEM_LIST_ELEMENTS,
305 NFTA_SET_ELEM_LIST_SET_ID,
275 __NFTA_SET_ELEM_LIST_MAX 306 __NFTA_SET_ELEM_LIST_MAX
276}; 307};
277#define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1) 308#define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1)
@@ -457,12 +488,14 @@ enum nft_cmp_attributes {
457 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING) 488 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING)
458 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers) 489 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers)
459 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers) 490 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers)
491 * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
460 */ 492 */
461enum nft_lookup_attributes { 493enum nft_lookup_attributes {
462 NFTA_LOOKUP_UNSPEC, 494 NFTA_LOOKUP_UNSPEC,
463 NFTA_LOOKUP_SET, 495 NFTA_LOOKUP_SET,
464 NFTA_LOOKUP_SREG, 496 NFTA_LOOKUP_SREG,
465 NFTA_LOOKUP_DREG, 497 NFTA_LOOKUP_DREG,
498 NFTA_LOOKUP_SET_ID,
466 __NFTA_LOOKUP_MAX 499 __NFTA_LOOKUP_MAX
467}; 500};
468#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) 501#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1)
@@ -536,6 +569,8 @@ enum nft_exthdr_attributes {
536 * @NFT_META_SECMARK: packet secmark (skb->secmark) 569 * @NFT_META_SECMARK: packet secmark (skb->secmark)
537 * @NFT_META_NFPROTO: netfilter protocol 570 * @NFT_META_NFPROTO: netfilter protocol
538 * @NFT_META_L4PROTO: layer 4 protocol number 571 * @NFT_META_L4PROTO: layer 4 protocol number
572 * @NFT_META_BRI_IIFNAME: packet input bridge interface name
573 * @NFT_META_BRI_OIFNAME: packet output bridge interface name
539 */ 574 */
540enum nft_meta_keys { 575enum nft_meta_keys {
541 NFT_META_LEN, 576 NFT_META_LEN,
@@ -555,6 +590,8 @@ enum nft_meta_keys {
555 NFT_META_SECMARK, 590 NFT_META_SECMARK,
556 NFT_META_NFPROTO, 591 NFT_META_NFPROTO,
557 NFT_META_L4PROTO, 592 NFT_META_L4PROTO,
593 NFT_META_BRI_IIFNAME,
594 NFT_META_BRI_OIFNAME,
558}; 595};
559 596
560/** 597/**
diff --git a/include/uapi/linux/netfilter/nfnetlink.h b/include/uapi/linux/netfilter/nfnetlink.h
index 596ddd45253c..354a7e5e50f2 100644
--- a/include/uapi/linux/netfilter/nfnetlink.h
+++ b/include/uapi/linux/netfilter/nfnetlink.h
@@ -20,6 +20,8 @@ enum nfnetlink_groups {
20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY 20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY
21 NFNLGRP_NFTABLES, 21 NFNLGRP_NFTABLES,
22#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES 22#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES
23 NFNLGRP_ACCT_QUOTA,
24#define NFNLGRP_ACCT_QUOTA NFNLGRP_ACCT_QUOTA
23 __NFNLGRP_MAX, 25 __NFNLGRP_MAX,
24}; 26};
25#define NFNLGRP_MAX (__NFNLGRP_MAX - 1) 27#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
diff --git a/include/uapi/linux/netfilter/nfnetlink_acct.h b/include/uapi/linux/netfilter/nfnetlink_acct.h
index c7b6269e760b..51404ec19022 100644
--- a/include/uapi/linux/netfilter/nfnetlink_acct.h
+++ b/include/uapi/linux/netfilter/nfnetlink_acct.h
@@ -10,15 +10,24 @@ enum nfnl_acct_msg_types {
10 NFNL_MSG_ACCT_GET, 10 NFNL_MSG_ACCT_GET,
11 NFNL_MSG_ACCT_GET_CTRZERO, 11 NFNL_MSG_ACCT_GET_CTRZERO,
12 NFNL_MSG_ACCT_DEL, 12 NFNL_MSG_ACCT_DEL,
13 NFNL_MSG_ACCT_OVERQUOTA,
13 NFNL_MSG_ACCT_MAX 14 NFNL_MSG_ACCT_MAX
14}; 15};
15 16
17enum nfnl_acct_flags {
18 NFACCT_F_QUOTA_PKTS = (1 << 0),
19 NFACCT_F_QUOTA_BYTES = (1 << 1),
20 NFACCT_F_OVERQUOTA = (1 << 2), /* can't be set from userspace */
21};
22
16enum nfnl_acct_type { 23enum nfnl_acct_type {
17 NFACCT_UNSPEC, 24 NFACCT_UNSPEC,
18 NFACCT_NAME, 25 NFACCT_NAME,
19 NFACCT_PKTS, 26 NFACCT_PKTS,
20 NFACCT_BYTES, 27 NFACCT_BYTES,
21 NFACCT_USE, 28 NFACCT_USE,
29 NFACCT_FLAGS,
30 NFACCT_QUOTA,
22 __NFACCT_MAX 31 __NFACCT_MAX
23}; 32};
24#define NFACCT_MAX (__NFACCT_MAX - 1) 33#define NFACCT_MAX (__NFACCT_MAX - 1)
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 9789dc95b6a8..9b19b4461928 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -273,11 +273,19 @@ struct sockaddr_nfc_llcp {
273 * First byte is the adapter index 273 * First byte is the adapter index
274 * Second byte contains flags 274 * Second byte contains flags
275 * - 0x01 - Direction (0=RX, 1=TX) 275 * - 0x01 - Direction (0=RX, 1=TX)
276 * - 0x02-0x80 - Reserved 276 * - 0x02-0x04 - Payload type (000=LLCP, 001=NCI, 010=HCI, 011=Digital,
277 * 100=Proprietary)
278 * - 0x05-0x80 - Reserved
277 **/ 279 **/
278#define NFC_LLCP_RAW_HEADER_SIZE 2 280#define NFC_RAW_HEADER_SIZE 2
279#define NFC_LLCP_DIRECTION_RX 0x00 281#define NFC_DIRECTION_RX 0x00
280#define NFC_LLCP_DIRECTION_TX 0x01 282#define NFC_DIRECTION_TX 0x01
283
284#define RAW_PAYLOAD_LLCP 0
285#define RAW_PAYLOAD_NCI 1
286#define RAW_PAYLOAD_HCI 2
287#define RAW_PAYLOAD_DIGITAL 3
288#define RAW_PAYLOAD_PROPRIETARY 4
281 289
282/* socket option names */ 290/* socket option names */
283#define NFC_LLCP_RW 0 291#define NFC_LLCP_RW 0
diff --git a/include/uapi/linux/nfsd/nfsfh.h b/include/uapi/linux/nfsd/nfsfh.h
index 616e3b396476..20391235d088 100644
--- a/include/uapi/linux/nfsd/nfsfh.h
+++ b/include/uapi/linux/nfsd/nfsfh.h
@@ -1,13 +1,7 @@
1/* 1/*
2 * include/linux/nfsd/nfsfh.h
3 *
4 * This file describes the layout of the file handles as passed 2 * This file describes the layout of the file handles as passed
5 * over the wire. 3 * over the wire.
6 * 4 *
7 * Earlier versions of knfsd used to sign file handles using keyed MD5
8 * or SHA. I've removed this code, because it doesn't give you more
9 * security than blocking external access to port 2049 on your firewall.
10 *
11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> 5 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
12 */ 6 */
13 7
@@ -37,7 +31,7 @@ struct nfs_fhbase_old {
37}; 31};
38 32
39/* 33/*
40 * This is the new flexible, extensible style NFSv2/v3 file handle. 34 * This is the new flexible, extensible style NFSv2/v3/v4 file handle.
41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000 35 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
42 * 36 *
43 * The file handle starts with a sequence of four-byte words. 37 * The file handle starts with a sequence of four-byte words.
@@ -47,14 +41,7 @@ struct nfs_fhbase_old {
47 * 41 *
48 * All four-byte values are in host-byte-order. 42 * All four-byte values are in host-byte-order.
49 * 43 *
50 * The auth_type field specifies how the filehandle can be authenticated 44 * The auth_type field is deprecated and must be set to 0.
51 * This might allow a file to be confirmed to be in a writable part of a
52 * filetree without checking the path from it up to the root.
53 * Current values:
54 * 0 - No authentication. fb_auth is 0 bytes long
55 * Possible future values:
56 * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle
57 * prefixed by a secret and with the important export flags.
58 * 45 *
59 * The fsid_type identifies how the filesystem (or export point) is 46 * The fsid_type identifies how the filesystem (or export point) is
60 * encoded. 47 * encoded.
@@ -71,14 +58,9 @@ struct nfs_fhbase_old {
71 * 7 - 8 byte inode number and 16 byte uuid 58 * 7 - 8 byte inode number and 16 byte uuid
72 * 59 *
73 * The fileid_type identified how the file within the filesystem is encoded. 60 * The fileid_type identified how the file within the filesystem is encoded.
74 * This is (will be) passed to, and set by, the underlying filesystem if it supports 61 * The values for this field are filesystem specific, exccept that
75 * filehandle operations. The filesystem must not use the value '0' or '0xff' and may 62 * filesystems must not use the values '0' or '0xff'. 'See enum fid_type'
76 * only use the values 1 and 2 as defined below: 63 * in include/linux/exportfs.h for currently registered values.
77 * Current values:
78 * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes.
79 * 1 - 32bit inode number, 32 bit generation number.
80 * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
81 *
82 */ 64 */
83struct nfs_fhbase_new { 65struct nfs_fhbase_new {
84 __u8 fb_version; /* == 1, even => nfs_fhbase_old */ 66 __u8 fb_version; /* == 1, even => nfs_fhbase_old */
@@ -114,9 +96,9 @@ struct knfsd_fh {
114#define fh_fsid_type fh_base.fh_new.fb_fsid_type 96#define fh_fsid_type fh_base.fh_new.fb_fsid_type
115#define fh_auth_type fh_base.fh_new.fb_auth_type 97#define fh_auth_type fh_base.fh_new.fb_auth_type
116#define fh_fileid_type fh_base.fh_new.fb_fileid_type 98#define fh_fileid_type fh_base.fh_new.fb_fileid_type
117#define fh_auth fh_base.fh_new.fb_auth
118#define fh_fsid fh_base.fh_new.fb_auth 99#define fh_fsid fh_base.fh_new.fb_auth
119 100
120 101/* Do not use, provided for userspace compatiblity. */
102#define fh_auth fh_base.fh_new.fb_auth
121 103
122#endif /* _UAPI_LINUX_NFSD_FH_H */ 104#endif /* _UAPI_LINUX_NFSD_FH_H */
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 194c1eab04d8..be9519b52bb1 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -503,6 +503,9 @@
503 * TX status event pertaining to the TX request. 503 * TX status event pertaining to the TX request.
504 * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the 504 * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
505 * management frames at CCK rate or not in 2GHz band. 505 * management frames at CCK rate or not in 2GHz band.
506 * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA
507 * counters which will be updated to the current value. This attribute
508 * is used during CSA period.
506 * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this 509 * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
507 * command may be used with the corresponding cookie to cancel the wait 510 * command may be used with the corresponding cookie to cancel the wait
508 * time if it is known that it is no longer necessary. 511 * time if it is known that it is no longer necessary.
@@ -1525,10 +1528,10 @@ enum nl80211_commands {
1525 * operation). 1528 * operation).
1526 * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information 1529 * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information
1527 * for the time while performing a channel switch. 1530 * for the time while performing a channel switch.
1528 * @NL80211_ATTR_CSA_C_OFF_BEACON: Offset of the channel switch counter 1531 * @NL80211_ATTR_CSA_C_OFF_BEACON: An array of offsets (u16) to the channel
1529 * field in the beacons tail (%NL80211_ATTR_BEACON_TAIL). 1532 * switch counters in the beacons tail (%NL80211_ATTR_BEACON_TAIL).
1530 * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter 1533 * @NL80211_ATTR_CSA_C_OFF_PRESP: An array of offsets (u16) to the channel
1531 * field in the probe response (%NL80211_ATTR_PROBE_RESP). 1534 * switch counters in the probe response (%NL80211_ATTR_PROBE_RESP).
1532 * 1535 *
1533 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32. 1536 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.
1534 * As specified in the &enum nl80211_rxmgmt_flags. 1537 * As specified in the &enum nl80211_rxmgmt_flags.
@@ -1576,9 +1579,18 @@ enum nl80211_commands {
1576 * advertise values that cannot always be met. In such cases, an attempt 1579 * advertise values that cannot always be met. In such cases, an attempt
1577 * to add a new station entry with @NL80211_CMD_NEW_STATION may fail. 1580 * to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
1578 * 1581 *
1582 * @NL80211_ATTR_CSA_C_OFFSETS_TX: An array of csa counter offsets (u16) which
1583 * should be updated when the frame is transmitted.
1584 * @NL80211_ATTR_MAX_CSA_COUNTERS: U8 attribute used to advertise the maximum
1585 * supported number of csa counters.
1586 *
1579 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. 1587 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
1580 * As specified in the &enum nl80211_tdls_peer_capability. 1588 * As specified in the &enum nl80211_tdls_peer_capability.
1581 * 1589 *
1590 * @NL80211_ATTR_IFACE_SOCKET_OWNER: flag attribute, if set during interface
1591 * creation then the new interface will be owned by the netlink socket
1592 * that created it and will be destroyed when the socket is closed
1593 *
1582 * @NL80211_ATTR_MAX: highest attribute number currently defined 1594 * @NL80211_ATTR_MAX: highest attribute number currently defined
1583 * @__NL80211_ATTR_AFTER_LAST: internal use 1595 * @__NL80211_ATTR_AFTER_LAST: internal use
1584 */ 1596 */
@@ -1914,6 +1926,11 @@ enum nl80211_attrs {
1914 1926
1915 NL80211_ATTR_TDLS_PEER_CAPABILITY, 1927 NL80211_ATTR_TDLS_PEER_CAPABILITY,
1916 1928
1929 NL80211_ATTR_IFACE_SOCKET_OWNER,
1930
1931 NL80211_ATTR_CSA_C_OFFSETS_TX,
1932 NL80211_ATTR_MAX_CSA_COUNTERS,
1933
1917 /* add attributes here, update the policy in nl80211.c */ 1934 /* add attributes here, update the policy in nl80211.c */
1918 1935
1919 __NL80211_ATTR_AFTER_LAST, 1936 __NL80211_ATTR_AFTER_LAST,
@@ -2182,6 +2199,8 @@ enum nl80211_sta_bss_param {
2182 * Contains a nested array of signal strength attributes (u8, dBm) 2199 * Contains a nested array of signal strength attributes (u8, dBm)
2183 * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average 2200 * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average
2184 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL. 2201 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL.
2202 * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the
2203 * 802.11 header (u32, kbps)
2185 * @__NL80211_STA_INFO_AFTER_LAST: internal 2204 * @__NL80211_STA_INFO_AFTER_LAST: internal
2186 * @NL80211_STA_INFO_MAX: highest possible station info attribute 2205 * @NL80211_STA_INFO_MAX: highest possible station info attribute
2187 */ 2206 */
@@ -2213,6 +2232,7 @@ enum nl80211_sta_info {
2213 NL80211_STA_INFO_TX_BYTES64, 2232 NL80211_STA_INFO_TX_BYTES64,
2214 NL80211_STA_INFO_CHAIN_SIGNAL, 2233 NL80211_STA_INFO_CHAIN_SIGNAL,
2215 NL80211_STA_INFO_CHAIN_SIGNAL_AVG, 2234 NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
2235 NL80211_STA_INFO_EXPECTED_THROUGHPUT,
2216 2236
2217 /* keep last */ 2237 /* keep last */
2218 __NL80211_STA_INFO_AFTER_LAST, 2238 __NL80211_STA_INFO_AFTER_LAST,
@@ -2336,9 +2356,34 @@ enum nl80211_band_attr {
2336 * using this channel as the primary or any of the secondary channels 2356 * using this channel as the primary or any of the secondary channels
2337 * isn't possible 2357 * isn't possible
2338 * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds. 2358 * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
2359 * @NL80211_FREQUENCY_ATTR_INDOOR_ONLY: Only indoor use is permitted on this
2360 * channel. A channel that has the INDOOR_ONLY attribute can only be
2361 * used when there is a clear assessment that the device is operating in
2362 * an indoor surroundings, i.e., it is connected to AC power (and not
2363 * through portable DC inverters) or is under the control of a master
2364 * that is acting as an AP and is connected to AC power.
2365 * @NL80211_FREQUENCY_ATTR_GO_CONCURRENT: GO operation is allowed on this
2366 * channel if it's connected concurrently to a BSS on the same channel on
2367 * the 2 GHz band or to a channel in the same UNII band (on the 5 GHz
2368 * band), and IEEE80211_CHAN_RADAR is not set. Instantiating a GO on a
2369 * channel that has the GO_CONCURRENT attribute set can be done when there
2370 * is a clear assessment that the device is operating under the guidance of
2371 * an authorized master, i.e., setting up a GO while the device is also
2372 * connected to an AP with DFS and radar detection on the UNII band (it is
2373 * up to user-space, i.e., wpa_supplicant to perform the required
2374 * verifications)
2375 * @NL80211_FREQUENCY_ATTR_NO_20MHZ: 20 MHz operation is not allowed
2376 * on this channel in current regulatory domain.
2377 * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed
2378 * on this channel in current regulatory domain.
2339 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number 2379 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
2340 * currently defined 2380 * currently defined
2341 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use 2381 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
2382 *
2383 * See https://apps.fcc.gov/eas/comments/GetPublishedDocument.html?id=327&tn=528122
2384 * for more information on the FCC description of the relaxations allowed
2385 * by NL80211_FREQUENCY_ATTR_INDOOR_ONLY and
2386 * NL80211_FREQUENCY_ATTR_GO_CONCURRENT.
2342 */ 2387 */
2343enum nl80211_frequency_attr { 2388enum nl80211_frequency_attr {
2344 __NL80211_FREQUENCY_ATTR_INVALID, 2389 __NL80211_FREQUENCY_ATTR_INVALID,
@@ -2355,6 +2400,10 @@ enum nl80211_frequency_attr {
2355 NL80211_FREQUENCY_ATTR_NO_80MHZ, 2400 NL80211_FREQUENCY_ATTR_NO_80MHZ,
2356 NL80211_FREQUENCY_ATTR_NO_160MHZ, 2401 NL80211_FREQUENCY_ATTR_NO_160MHZ,
2357 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME, 2402 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME,
2403 NL80211_FREQUENCY_ATTR_INDOOR_ONLY,
2404 NL80211_FREQUENCY_ATTR_GO_CONCURRENT,
2405 NL80211_FREQUENCY_ATTR_NO_20MHZ,
2406 NL80211_FREQUENCY_ATTR_NO_10MHZ,
2358 2407
2359 /* keep last */ 2408 /* keep last */
2360 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 2409 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -2573,10 +2622,13 @@ enum nl80211_dfs_regions {
2573 * present has been registered with the wireless core that 2622 * present has been registered with the wireless core that
2574 * has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a 2623 * has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a
2575 * supported feature. 2624 * supported feature.
2625 * @NL80211_USER_REG_HINT_INDOOR: a user sent an hint indicating that the
2626 * platform is operating in an indoor environment.
2576 */ 2627 */
2577enum nl80211_user_reg_hint_type { 2628enum nl80211_user_reg_hint_type {
2578 NL80211_USER_REG_HINT_USER = 0, 2629 NL80211_USER_REG_HINT_USER = 0,
2579 NL80211_USER_REG_HINT_CELL_BASE = 1, 2630 NL80211_USER_REG_HINT_CELL_BASE = 1,
2631 NL80211_USER_REG_HINT_INDOOR = 2,
2580}; 2632};
2581 2633
2582/** 2634/**
@@ -3650,6 +3702,8 @@ enum nl80211_iface_limit_attrs {
3650 * different channels may be used within this group. 3702 * different channels may be used within this group.
3651 * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap 3703 * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap
3652 * of supported channel widths for radar detection. 3704 * of supported channel widths for radar detection.
3705 * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap
3706 * of supported regulatory regions for radar detection.
3653 * @NUM_NL80211_IFACE_COMB: number of attributes 3707 * @NUM_NL80211_IFACE_COMB: number of attributes
3654 * @MAX_NL80211_IFACE_COMB: highest attribute number 3708 * @MAX_NL80211_IFACE_COMB: highest attribute number
3655 * 3709 *
@@ -3683,6 +3737,7 @@ enum nl80211_if_combination_attrs {
3683 NL80211_IFACE_COMB_STA_AP_BI_MATCH, 3737 NL80211_IFACE_COMB_STA_AP_BI_MATCH,
3684 NL80211_IFACE_COMB_NUM_CHANNELS, 3738 NL80211_IFACE_COMB_NUM_CHANNELS,
3685 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, 3739 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
3740 NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
3686 3741
3687 /* keep last */ 3742 /* keep last */
3688 NUM_NL80211_IFACE_COMB, 3743 NUM_NL80211_IFACE_COMB,
@@ -3893,6 +3948,9 @@ enum nl80211_ap_sme_features {
3893 * interface. An active monitor interface behaves like a normal monitor 3948 * interface. An active monitor interface behaves like a normal monitor
3894 * interface, but gets added to the driver. It ensures that incoming 3949 * interface, but gets added to the driver. It ensures that incoming
3895 * unicast packets directed at the configured interface address get ACKed. 3950 * unicast packets directed at the configured interface address get ACKed.
3951 * @NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE: This driver supports dynamic
3952 * channel bandwidth change (e.g., HT 20 <-> 40 MHz channel) during the
3953 * lifetime of a BSS.
3896 */ 3954 */
3897enum nl80211_feature_flags { 3955enum nl80211_feature_flags {
3898 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3956 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3913,6 +3971,7 @@ enum nl80211_feature_flags {
3913 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, 3971 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15,
3914 NL80211_FEATURE_USERSPACE_MPM = 1 << 16, 3972 NL80211_FEATURE_USERSPACE_MPM = 1 << 16,
3915 NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17, 3973 NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17,
3974 NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = 1 << 18,
3916}; 3975};
3917 3976
3918/** 3977/**
diff --git a/include/uapi/linux/nvme.h b/include/uapi/linux/nvme.h
index 096fe1c6f83d..29a7d8619d8d 100644
--- a/include/uapi/linux/nvme.h
+++ b/include/uapi/linux/nvme.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Definitions for the NVM Express interface 2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011-2013, Intel Corporation. 3 * Copyright (c) 2011-2014, Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -10,10 +10,6 @@
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details. 12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 */ 13 */
18 14
19#ifndef _UAPI_LINUX_NVME_H 15#ifndef _UAPI_LINUX_NVME_H
@@ -31,7 +27,12 @@ struct nvme_id_power_state {
31 __u8 read_lat; 27 __u8 read_lat;
32 __u8 write_tput; 28 __u8 write_tput;
33 __u8 write_lat; 29 __u8 write_lat;
34 __u8 rsvd16[16]; 30 __le16 idle_power;
31 __u8 idle_scale;
32 __u8 rsvd19;
33 __le16 active_power;
34 __u8 active_work_scale;
35 __u8 rsvd23[9];
35}; 36};
36 37
37enum { 38enum {
@@ -49,7 +50,9 @@ struct nvme_id_ctrl {
49 __u8 ieee[3]; 50 __u8 ieee[3];
50 __u8 mic; 51 __u8 mic;
51 __u8 mdts; 52 __u8 mdts;
52 __u8 rsvd78[178]; 53 __u16 cntlid;
54 __u32 ver;
55 __u8 rsvd84[172];
53 __le16 oacs; 56 __le16 oacs;
54 __u8 acl; 57 __u8 acl;
55 __u8 aerl; 58 __u8 aerl;
@@ -57,7 +60,11 @@ struct nvme_id_ctrl {
57 __u8 lpa; 60 __u8 lpa;
58 __u8 elpe; 61 __u8 elpe;
59 __u8 npss; 62 __u8 npss;
60 __u8 rsvd264[248]; 63 __u8 avscc;
64 __u8 apsta;
65 __le16 wctemp;
66 __le16 cctemp;
67 __u8 rsvd270[242];
61 __u8 sqes; 68 __u8 sqes;
62 __u8 cqes; 69 __u8 cqes;
63 __u8 rsvd514[2]; 70 __u8 rsvd514[2];
@@ -68,7 +75,12 @@ struct nvme_id_ctrl {
68 __u8 vwc; 75 __u8 vwc;
69 __le16 awun; 76 __le16 awun;
70 __le16 awupf; 77 __le16 awupf;
71 __u8 rsvd530[1518]; 78 __u8 nvscc;
79 __u8 rsvd531;
80 __le16 acwu;
81 __u8 rsvd534[2];
82 __le32 sgls;
83 __u8 rsvd540[1508];
72 struct nvme_id_power_state psd[32]; 84 struct nvme_id_power_state psd[32];
73 __u8 vs[1024]; 85 __u8 vs[1024];
74}; 86};
@@ -77,6 +89,7 @@ enum {
77 NVME_CTRL_ONCS_COMPARE = 1 << 0, 89 NVME_CTRL_ONCS_COMPARE = 1 << 0,
78 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1, 90 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
79 NVME_CTRL_ONCS_DSM = 1 << 2, 91 NVME_CTRL_ONCS_DSM = 1 << 2,
92 NVME_CTRL_VWC_PRESENT = 1 << 0,
80}; 93};
81 94
82struct nvme_lbaf { 95struct nvme_lbaf {
@@ -95,7 +108,15 @@ struct nvme_id_ns {
95 __u8 mc; 108 __u8 mc;
96 __u8 dpc; 109 __u8 dpc;
97 __u8 dps; 110 __u8 dps;
98 __u8 rsvd30[98]; 111 __u8 nmic;
112 __u8 rescap;
113 __u8 fpi;
114 __u8 rsvd33;
115 __le16 nawun;
116 __le16 nawupf;
117 __le16 nacwu;
118 __u8 rsvd40[80];
119 __u8 eui64[8];
99 struct nvme_lbaf lbaf[16]; 120 struct nvme_lbaf lbaf[16];
100 __u8 rsvd192[192]; 121 __u8 rsvd192[192];
101 __u8 vs[3712]; 122 __u8 vs[3712];
@@ -126,7 +147,10 @@ struct nvme_smart_log {
126 __u8 unsafe_shutdowns[16]; 147 __u8 unsafe_shutdowns[16];
127 __u8 media_errors[16]; 148 __u8 media_errors[16];
128 __u8 num_err_log_entries[16]; 149 __u8 num_err_log_entries[16];
129 __u8 rsvd192[320]; 150 __le32 warning_temp_time;
151 __le32 critical_comp_time;
152 __le16 temp_sensor[8];
153 __u8 rsvd216[296];
130}; 154};
131 155
132enum { 156enum {
@@ -282,6 +306,10 @@ enum {
282 NVME_FEAT_WRITE_ATOMIC = 0x0a, 306 NVME_FEAT_WRITE_ATOMIC = 0x0a,
283 NVME_FEAT_ASYNC_EVENT = 0x0b, 307 NVME_FEAT_ASYNC_EVENT = 0x0b,
284 NVME_FEAT_SW_PROGRESS = 0x0c, 308 NVME_FEAT_SW_PROGRESS = 0x0c,
309 NVME_LOG_ERROR = 0x01,
310 NVME_LOG_SMART = 0x02,
311 NVME_LOG_FW_SLOT = 0x03,
312 NVME_LOG_RESERVATION = 0x80,
285 NVME_FWACT_REPL = (0 << 3), 313 NVME_FWACT_REPL = (0 << 3),
286 NVME_FWACT_REPL_ACTV = (1 << 3), 314 NVME_FWACT_REPL_ACTV = (1 << 3),
287 NVME_FWACT_ACTV = (2 << 3), 315 NVME_FWACT_ACTV = (2 << 3),
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 970553cbbc8e..0b979ee4bfc0 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -395,7 +395,9 @@ struct ovs_key_nd {
395 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying 395 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
396 * the actions to take for packets that match the key. Always present in 396 * the actions to take for packets that match the key. Always present in
397 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for 397 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
398 * %OVS_FLOW_CMD_SET requests. 398 * %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without
399 * %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions,
400 * an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given.
399 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this 401 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
400 * flow. Present in notifications if the stats would be nonzero. Ignored in 402 * flow. Present in notifications if the stats would be nonzero. Ignored in
401 * requests. 403 * requests.
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index e3fc8f09d110..9269de254874 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -163,8 +163,9 @@ enum perf_branch_sample_type {
163 PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */ 163 PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */
164 PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */ 164 PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */
165 PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */ 165 PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */
166 PERF_SAMPLE_BRANCH_COND = 1U << 10, /* conditional branches */
166 167
167 PERF_SAMPLE_BRANCH_MAX = 1U << 10, /* non-ABI */ 168 PERF_SAMPLE_BRANCH_MAX = 1U << 11, /* non-ABI */
168}; 169};
169 170
170#define PERF_SAMPLE_BRANCH_PLM_ALL \ 171#define PERF_SAMPLE_BRANCH_PLM_ALL \
@@ -301,8 +302,8 @@ struct perf_event_attr {
301 exclude_callchain_kernel : 1, /* exclude kernel callchains */ 302 exclude_callchain_kernel : 1, /* exclude kernel callchains */
302 exclude_callchain_user : 1, /* exclude user callchains */ 303 exclude_callchain_user : 1, /* exclude user callchains */
303 mmap2 : 1, /* include mmap with inode data */ 304 mmap2 : 1, /* include mmap with inode data */
304 305 comm_exec : 1, /* flag comm events that are due to an exec */
305 __reserved_1 : 40; 306 __reserved_1 : 39;
306 307
307 union { 308 union {
308 __u32 wakeup_events; /* wakeup every n events */ 309 __u32 wakeup_events; /* wakeup every n events */
@@ -501,7 +502,12 @@ struct perf_event_mmap_page {
501#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) 502#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
502#define PERF_RECORD_MISC_GUEST_USER (5 << 0) 503#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
503 504
505/*
506 * PERF_RECORD_MISC_MMAP_DATA and PERF_RECORD_MISC_COMM_EXEC are used on
507 * different events so can reuse the same bit position.
508 */
504#define PERF_RECORD_MISC_MMAP_DATA (1 << 13) 509#define PERF_RECORD_MISC_MMAP_DATA (1 << 13)
510#define PERF_RECORD_MISC_COMM_EXEC (1 << 13)
505/* 511/*
506 * Indicates that the content of PERF_SAMPLE_IP points to 512 * Indicates that the content of PERF_SAMPLE_IP points to
507 * the actual instruction that triggered the event. See also 513 * the actual instruction that triggered the event. See also
@@ -699,6 +705,7 @@ enum perf_event_type {
699 * u32 min; 705 * u32 min;
700 * u64 ino; 706 * u64 ino;
701 * u64 ino_generation; 707 * u64 ino_generation;
708 * u32 prot, flags;
702 * char filename[]; 709 * char filename[];
703 * struct sample_id sample_id; 710 * struct sample_id sample_id;
704 * }; 711 * };
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index 852373d27dbb..6f71b9b41595 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -38,6 +38,7 @@
38#define _LINUX_TIPC_H_ 38#define _LINUX_TIPC_H_
39 39
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/sockios.h>
41 42
42/* 43/*
43 * TIPC addressing primitives 44 * TIPC addressing primitives
@@ -87,6 +88,7 @@ static inline unsigned int tipc_node(__u32 addr)
87 88
88#define TIPC_CFG_SRV 0 /* configuration service name type */ 89#define TIPC_CFG_SRV 0 /* configuration service name type */
89#define TIPC_TOP_SRV 1 /* topology service name type */ 90#define TIPC_TOP_SRV 1 /* topology service name type */
91#define TIPC_LINK_STATE 2 /* link state name type */
90#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */ 92#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */
91 93
92/* 94/*
@@ -206,4 +208,25 @@ struct sockaddr_tipc {
206#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ 208#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */
207#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */ 209#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */
208 210
211/*
212 * Maximum sizes of TIPC bearer-related names (including terminating NULL)
213 * The string formatting for each name element is:
214 * media: media
215 * interface: media:interface name
216 * link: Z.C.N:interface-Z.C.N:interface
217 *
218 */
219
220#define TIPC_MAX_MEDIA_NAME 16
221#define TIPC_MAX_IF_NAME 16
222#define TIPC_MAX_BEARER_NAME 32
223#define TIPC_MAX_LINK_NAME 60
224
225#define SIOCGETLINKNAME SIOCPROTOPRIVATE
226
227struct tipc_sioc_ln_req {
228 __u32 peer;
229 __u32 bearer_id;
230 char linkname[TIPC_MAX_LINK_NAME];
231};
209#endif 232#endif
diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
index 6b0bff09b3a7..41a76acbb305 100644
--- a/include/uapi/linux/tipc_config.h
+++ b/include/uapi/linux/tipc_config.h
@@ -39,6 +39,7 @@
39 39
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/string.h> 41#include <linux/string.h>
42#include <linux/tipc.h>
42#include <asm/byteorder.h> 43#include <asm/byteorder.h>
43 44
44#ifndef __KERNEL__ 45#ifndef __KERNEL__
@@ -155,15 +156,6 @@
155#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */ 156#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */
156 157
157/* 158/*
158 * Maximum sizes of TIPC bearer-related names (including terminating NUL)
159 */
160
161#define TIPC_MAX_MEDIA_NAME 16 /* format = media */
162#define TIPC_MAX_IF_NAME 16 /* format = interface */
163#define TIPC_MAX_BEARER_NAME 32 /* format = media:interface */
164#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */
165
166/*
167 * Link priority limits (min, default, max, media default) 159 * Link priority limits (min, default, max, media default)
168 */ 160 */
169 161
diff --git a/include/uapi/linux/udp.h b/include/uapi/linux/udp.h
index e2bcfd75a30d..16574ea18f0c 100644
--- a/include/uapi/linux/udp.h
+++ b/include/uapi/linux/udp.h
@@ -29,6 +29,8 @@ struct udphdr {
29/* UDP socket options */ 29/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */ 30#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
32#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP6X */
33#define UDP_NO_CHECK6_RX 102 /* Disable accpeting checksum for UDP6 */
32 34
33/* UDP encapsulation types */ 35/* UDP encapsulation types */
34#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ 36#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
index 2a4b4a72a4f9..24b68c59dcf8 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -33,6 +33,13 @@ struct usb_endpoint_descriptor_no_audio {
33 __u8 bInterval; 33 __u8 bInterval;
34} __attribute__((packed)); 34} __attribute__((packed));
35 35
36/* Legacy format, deprecated as of 3.14. */
37struct usb_functionfs_descs_head {
38 __le32 magic;
39 __le32 length;
40 __le32 fs_count;
41 __le32 hs_count;
42} __attribute__((packed, deprecated));
36 43
37/* 44/*
38 * Descriptors format: 45 * Descriptors format:
diff --git a/include/uapi/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h
index e272ea060e38..763bb6950402 100644
--- a/include/uapi/mtd/mtd-abi.h
+++ b/include/uapi/mtd/mtd-abi.h
@@ -109,6 +109,7 @@ struct mtd_write_req {
109#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) 109#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
110#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) 110#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
111#define MTD_CAP_NANDFLASH (MTD_WRITEABLE) 111#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
112#define MTD_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
112 113
113/* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */ 114/* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */
114#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended) 115#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended)
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 8297285b6288..de69170a30ce 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -4,7 +4,16 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6enum { 6enum {
7 RDMA_NL_RDMA_CM = 1 7 RDMA_NL_RDMA_CM = 1,
8 RDMA_NL_NES,
9 RDMA_NL_C4IW,
10 RDMA_NL_NUM_CLIENTS
11};
12
13enum {
14 RDMA_NL_GROUP_CM = 1,
15 RDMA_NL_GROUP_IWPM,
16 RDMA_NL_NUM_GROUPS
8}; 17};
9 18
10#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10) 19#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
@@ -22,6 +31,18 @@ enum {
22 RDMA_NL_RDMA_CM_NUM_ATTR, 31 RDMA_NL_RDMA_CM_NUM_ATTR,
23}; 32};
24 33
34/* iwarp port mapper op-codes */
35enum {
36 RDMA_NL_IWPM_REG_PID = 0,
37 RDMA_NL_IWPM_ADD_MAPPING,
38 RDMA_NL_IWPM_QUERY_MAPPING,
39 RDMA_NL_IWPM_REMOVE_MAPPING,
40 RDMA_NL_IWPM_HANDLE_ERR,
41 RDMA_NL_IWPM_MAPINFO,
42 RDMA_NL_IWPM_MAPINFO_NUM,
43 RDMA_NL_IWPM_NUM_OPS
44};
45
25struct rdma_cm_id_stats { 46struct rdma_cm_id_stats {
26 __u32 qp_num; 47 __u32 qp_num;
27 __u32 bound_dev_if; 48 __u32 bound_dev_if;
@@ -33,5 +54,78 @@ struct rdma_cm_id_stats {
33 __u8 qp_type; 54 __u8 qp_type;
34}; 55};
35 56
57enum {
58 IWPM_NLA_REG_PID_UNSPEC = 0,
59 IWPM_NLA_REG_PID_SEQ,
60 IWPM_NLA_REG_IF_NAME,
61 IWPM_NLA_REG_IBDEV_NAME,
62 IWPM_NLA_REG_ULIB_NAME,
63 IWPM_NLA_REG_PID_MAX
64};
65
66enum {
67 IWPM_NLA_RREG_PID_UNSPEC = 0,
68 IWPM_NLA_RREG_PID_SEQ,
69 IWPM_NLA_RREG_IBDEV_NAME,
70 IWPM_NLA_RREG_ULIB_NAME,
71 IWPM_NLA_RREG_ULIB_VER,
72 IWPM_NLA_RREG_PID_ERR,
73 IWPM_NLA_RREG_PID_MAX
74
75};
76
77enum {
78 IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
79 IWPM_NLA_MANAGE_MAPPING_SEQ,
80 IWPM_NLA_MANAGE_ADDR,
81 IWPM_NLA_MANAGE_MAPPED_LOC_ADDR,
82 IWPM_NLA_RMANAGE_MAPPING_ERR,
83 IWPM_NLA_RMANAGE_MAPPING_MAX
84};
85
86#define IWPM_NLA_MANAGE_MAPPING_MAX 3
87#define IWPM_NLA_QUERY_MAPPING_MAX 4
88#define IWPM_NLA_MAPINFO_SEND_MAX 3
89
90enum {
91 IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
92 IWPM_NLA_QUERY_MAPPING_SEQ,
93 IWPM_NLA_QUERY_LOCAL_ADDR,
94 IWPM_NLA_QUERY_REMOTE_ADDR,
95 IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
96 IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
97 IWPM_NLA_RQUERY_MAPPING_ERR,
98 IWPM_NLA_RQUERY_MAPPING_MAX
99};
100
101enum {
102 IWPM_NLA_MAPINFO_REQ_UNSPEC = 0,
103 IWPM_NLA_MAPINFO_ULIB_NAME,
104 IWPM_NLA_MAPINFO_ULIB_VER,
105 IWPM_NLA_MAPINFO_REQ_MAX
106};
107
108enum {
109 IWPM_NLA_MAPINFO_UNSPEC = 0,
110 IWPM_NLA_MAPINFO_LOCAL_ADDR,
111 IWPM_NLA_MAPINFO_MAPPED_ADDR,
112 IWPM_NLA_MAPINFO_MAX
113};
114
115enum {
116 IWPM_NLA_MAPINFO_NUM_UNSPEC = 0,
117 IWPM_NLA_MAPINFO_SEQ,
118 IWPM_NLA_MAPINFO_SEND_NUM,
119 IWPM_NLA_MAPINFO_ACK_NUM,
120 IWPM_NLA_MAPINFO_NUM_MAX
121};
122
123enum {
124 IWPM_NLA_ERR_UNSPEC = 0,
125 IWPM_NLA_ERR_SEQ,
126 IWPM_NLA_ERR_CODE,
127 IWPM_NLA_ERR_MAX
128};
129
36 130
37#endif /* _UAPI_RDMA_NETLINK_H */ 131#endif /* _UAPI_RDMA_NETLINK_H */
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index 5759810e1c1b..1964026b5e09 100644
--- a/include/uapi/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
@@ -39,7 +39,7 @@
39struct snd_compressed_buffer { 39struct snd_compressed_buffer {
40 __u32 fragment_size; 40 __u32 fragment_size;
41 __u32 fragments; 41 __u32 fragments;
42}; 42} __attribute__((packed, aligned(4)));
43 43
44/** 44/**
45 * struct snd_compr_params: compressed stream params 45 * struct snd_compr_params: compressed stream params
@@ -51,7 +51,7 @@ struct snd_compr_params {
51 struct snd_compressed_buffer buffer; 51 struct snd_compressed_buffer buffer;
52 struct snd_codec codec; 52 struct snd_codec codec;
53 __u8 no_wake_mode; 53 __u8 no_wake_mode;
54}; 54} __attribute__((packed, aligned(4)));
55 55
56/** 56/**
57 * struct snd_compr_tstamp: timestamp descriptor 57 * struct snd_compr_tstamp: timestamp descriptor
@@ -70,7 +70,7 @@ struct snd_compr_tstamp {
70 __u32 pcm_frames; 70 __u32 pcm_frames;
71 __u32 pcm_io_frames; 71 __u32 pcm_io_frames;
72 __u32 sampling_rate; 72 __u32 sampling_rate;
73}; 73} __attribute__((packed, aligned(4)));
74 74
75/** 75/**
76 * struct snd_compr_avail: avail descriptor 76 * struct snd_compr_avail: avail descriptor
@@ -80,7 +80,7 @@ struct snd_compr_tstamp {
80struct snd_compr_avail { 80struct snd_compr_avail {
81 __u64 avail; 81 __u64 avail;
82 struct snd_compr_tstamp tstamp; 82 struct snd_compr_tstamp tstamp;
83}; 83} __attribute__((packed, aligned(4)));
84 84
85enum snd_compr_direction { 85enum snd_compr_direction {
86 SND_COMPRESS_PLAYBACK = 0, 86 SND_COMPRESS_PLAYBACK = 0,
@@ -107,7 +107,7 @@ struct snd_compr_caps {
107 __u32 max_fragments; 107 __u32 max_fragments;
108 __u32 codecs[MAX_NUM_CODECS]; 108 __u32 codecs[MAX_NUM_CODECS];
109 __u32 reserved[11]; 109 __u32 reserved[11];
110}; 110} __attribute__((packed, aligned(4)));
111 111
112/** 112/**
113 * struct snd_compr_codec_caps: query capability of codec 113 * struct snd_compr_codec_caps: query capability of codec
@@ -119,7 +119,7 @@ struct snd_compr_codec_caps {
119 __u32 codec; 119 __u32 codec;
120 __u32 num_descriptors; 120 __u32 num_descriptors;
121 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; 121 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
122}; 122} __attribute__((packed, aligned(4)));
123 123
124/** 124/**
125 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the 125 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the
@@ -140,7 +140,7 @@ enum {
140struct snd_compr_metadata { 140struct snd_compr_metadata {
141 __u32 key; 141 __u32 key;
142 __u32 value[8]; 142 __u32 value[8];
143}; 143} __attribute__((packed, aligned(4)));
144 144
145/** 145/**
146 * compress path ioctl definitions 146 * compress path ioctl definitions
diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/compress_params.h
index 165e7059de75..d9bd9ca0d5b0 100644
--- a/include/uapi/sound/compress_params.h
+++ b/include/uapi/sound/compress_params.h
@@ -268,7 +268,7 @@ struct snd_enc_vorbis {
268 __u32 max_bit_rate; 268 __u32 max_bit_rate;
269 __u32 min_bit_rate; 269 __u32 min_bit_rate;
270 __u32 downmix; 270 __u32 downmix;
271}; 271} __attribute__((packed, aligned(4)));
272 272
273 273
274/** 274/**
@@ -284,7 +284,7 @@ struct snd_enc_real {
284 __u32 quant_bits; 284 __u32 quant_bits;
285 __u32 start_region; 285 __u32 start_region;
286 __u32 num_regions; 286 __u32 num_regions;
287}; 287} __attribute__((packed, aligned(4)));
288 288
289/** 289/**
290 * struct snd_enc_flac 290 * struct snd_enc_flac
@@ -308,12 +308,12 @@ struct snd_enc_real {
308struct snd_enc_flac { 308struct snd_enc_flac {
309 __u32 num; 309 __u32 num;
310 __u32 gain; 310 __u32 gain;
311}; 311} __attribute__((packed, aligned(4)));
312 312
313struct snd_enc_generic { 313struct snd_enc_generic {
314 __u32 bw; /* encoder bandwidth */ 314 __u32 bw; /* encoder bandwidth */
315 __s32 reserved[15]; 315 __s32 reserved[15];
316}; 316} __attribute__((packed, aligned(4)));
317 317
318union snd_codec_options { 318union snd_codec_options {
319 struct snd_enc_wma wma; 319 struct snd_enc_wma wma;
@@ -321,7 +321,7 @@ union snd_codec_options {
321 struct snd_enc_real real; 321 struct snd_enc_real real;
322 struct snd_enc_flac flac; 322 struct snd_enc_flac flac;
323 struct snd_enc_generic generic; 323 struct snd_enc_generic generic;
324}; 324} __attribute__((packed, aligned(4)));
325 325
326/** struct snd_codec_desc - description of codec capabilities 326/** struct snd_codec_desc - description of codec capabilities
327 * @max_ch: Maximum number of audio channels 327 * @max_ch: Maximum number of audio channels
@@ -358,7 +358,7 @@ struct snd_codec_desc {
358 __u32 formats; 358 __u32 formats;
359 __u32 min_buffer; 359 __u32 min_buffer;
360 __u32 reserved[15]; 360 __u32 reserved[15];
361}; 361} __attribute__((packed, aligned(4)));
362 362
363/** struct snd_codec 363/** struct snd_codec
364 * @id: Identifies the supported audio encoder/decoder. 364 * @id: Identifies the supported audio encoder/decoder.
@@ -399,6 +399,6 @@ struct snd_codec {
399 __u32 align; 399 __u32 align;
400 union snd_codec_options options; 400 union snd_codec_options options;
401 __u32 reserved[3]; 401 __u32 reserved[3];
402}; 402} __attribute__((packed, aligned(4)));
403 403
404#endif 404#endif
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
new file mode 100644
index 000000000000..3e43e22cdff9
--- /dev/null
+++ b/include/video/imx-ipu-v3.h
@@ -0,0 +1,347 @@
1/*
2 * Copyright 2005-2009 Freescale Semiconductor, Inc.
3 *
4 * The code contained herein is licensed under the GNU Lesser General
5 * Public License. You may obtain a copy of the GNU Lesser General
6 * Public License Version 2.1 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/lgpl-license.html
9 * http://www.gnu.org/copyleft/lgpl.html
10 */
11
12#ifndef __DRM_IPU_H__
13#define __DRM_IPU_H__
14
15#include <linux/types.h>
16#include <linux/videodev2.h>
17#include <linux/bitmap.h>
18#include <linux/fb.h>
19
20struct ipu_soc;
21
22enum ipuv3_type {
23 IPUV3EX,
24 IPUV3M,
25 IPUV3H,
26};
27
28#define IPU_PIX_FMT_GBR24 v4l2_fourcc('G', 'B', 'R', '3')
29
30/*
31 * Bitfield of Display Interface signal polarities.
32 */
33struct ipu_di_signal_cfg {
34 unsigned datamask_en:1;
35 unsigned interlaced:1;
36 unsigned odd_field_first:1;
37 unsigned clksel_en:1;
38 unsigned clkidle_en:1;
39 unsigned data_pol:1; /* true = inverted */
40 unsigned clk_pol:1; /* true = rising edge */
41 unsigned enable_pol:1;
42 unsigned Hsync_pol:1; /* true = active high */
43 unsigned Vsync_pol:1;
44
45 u16 width;
46 u16 height;
47 u32 pixel_fmt;
48 u16 h_start_width;
49 u16 h_sync_width;
50 u16 h_end_width;
51 u16 v_start_width;
52 u16 v_sync_width;
53 u16 v_end_width;
54 u32 v_to_h_sync;
55 unsigned long pixelclock;
56#define IPU_DI_CLKMODE_SYNC (1 << 0)
57#define IPU_DI_CLKMODE_EXT (1 << 1)
58 unsigned long clkflags;
59
60 u8 hsync_pin;
61 u8 vsync_pin;
62};
63
64enum ipu_color_space {
65 IPUV3_COLORSPACE_RGB,
66 IPUV3_COLORSPACE_YUV,
67 IPUV3_COLORSPACE_UNKNOWN,
68};
69
70struct ipuv3_channel;
71
72enum ipu_channel_irq {
73 IPU_IRQ_EOF = 0,
74 IPU_IRQ_NFACK = 64,
75 IPU_IRQ_NFB4EOF = 128,
76 IPU_IRQ_EOS = 192,
77};
78
79int ipu_map_irq(struct ipu_soc *ipu, int irq);
80int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel,
81 enum ipu_channel_irq irq);
82
83#define IPU_IRQ_DP_SF_START (448 + 2)
84#define IPU_IRQ_DP_SF_END (448 + 3)
85#define IPU_IRQ_BG_SF_END IPU_IRQ_DP_SF_END,
86#define IPU_IRQ_DC_FC_0 (448 + 8)
87#define IPU_IRQ_DC_FC_1 (448 + 9)
88#define IPU_IRQ_DC_FC_2 (448 + 10)
89#define IPU_IRQ_DC_FC_3 (448 + 11)
90#define IPU_IRQ_DC_FC_4 (448 + 12)
91#define IPU_IRQ_DC_FC_6 (448 + 13)
92#define IPU_IRQ_VSYNC_PRE_0 (448 + 14)
93#define IPU_IRQ_VSYNC_PRE_1 (448 + 15)
94
95/*
96 * IPU Image DMA Controller (idmac) functions
97 */
98struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel);
99void ipu_idmac_put(struct ipuv3_channel *);
100
101int ipu_idmac_enable_channel(struct ipuv3_channel *channel);
102int ipu_idmac_disable_channel(struct ipuv3_channel *channel);
103int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms);
104
105void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
106 bool doublebuffer);
107int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel);
108void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num);
109
110/*
111 * IPU Display Controller (dc) functions
112 */
113struct ipu_dc;
114struct ipu_di;
115struct ipu_dc *ipu_dc_get(struct ipu_soc *ipu, int channel);
116void ipu_dc_put(struct ipu_dc *dc);
117int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced,
118 u32 pixel_fmt, u32 width);
119void ipu_dc_enable(struct ipu_soc *ipu);
120void ipu_dc_enable_channel(struct ipu_dc *dc);
121void ipu_dc_disable_channel(struct ipu_dc *dc);
122void ipu_dc_disable(struct ipu_soc *ipu);
123
124/*
125 * IPU Display Interface (di) functions
126 */
127struct ipu_di *ipu_di_get(struct ipu_soc *ipu, int disp);
128void ipu_di_put(struct ipu_di *);
129int ipu_di_disable(struct ipu_di *);
130int ipu_di_enable(struct ipu_di *);
131int ipu_di_get_num(struct ipu_di *);
132int ipu_di_init_sync_panel(struct ipu_di *, struct ipu_di_signal_cfg *sig);
133
134/*
135 * IPU Display Multi FIFO Controller (dmfc) functions
136 */
137struct dmfc_channel;
138int ipu_dmfc_enable_channel(struct dmfc_channel *dmfc);
139void ipu_dmfc_disable_channel(struct dmfc_channel *dmfc);
140int ipu_dmfc_alloc_bandwidth(struct dmfc_channel *dmfc,
141 unsigned long bandwidth_mbs, int burstsize);
142void ipu_dmfc_free_bandwidth(struct dmfc_channel *dmfc);
143int ipu_dmfc_init_channel(struct dmfc_channel *dmfc, int width);
144struct dmfc_channel *ipu_dmfc_get(struct ipu_soc *ipu, int ipuv3_channel);
145void ipu_dmfc_put(struct dmfc_channel *dmfc);
146
147/*
148 * IPU Display Processor (dp) functions
149 */
150#define IPU_DP_FLOW_SYNC_BG 0
151#define IPU_DP_FLOW_SYNC_FG 1
152#define IPU_DP_FLOW_ASYNC0_BG 2
153#define IPU_DP_FLOW_ASYNC0_FG 3
154#define IPU_DP_FLOW_ASYNC1_BG 4
155#define IPU_DP_FLOW_ASYNC1_FG 5
156
157struct ipu_dp *ipu_dp_get(struct ipu_soc *ipu, unsigned int flow);
158void ipu_dp_put(struct ipu_dp *);
159int ipu_dp_enable(struct ipu_soc *ipu);
160int ipu_dp_enable_channel(struct ipu_dp *dp);
161void ipu_dp_disable_channel(struct ipu_dp *dp);
162void ipu_dp_disable(struct ipu_soc *ipu);
163int ipu_dp_setup_channel(struct ipu_dp *dp,
164 enum ipu_color_space in, enum ipu_color_space out);
165int ipu_dp_set_window_pos(struct ipu_dp *, u16 x_pos, u16 y_pos);
166int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha,
167 bool bg_chan);
168
169/*
170 * IPU CMOS Sensor Interface (csi) functions
171 */
172int ipu_csi_enable(struct ipu_soc *ipu, int csi);
173int ipu_csi_disable(struct ipu_soc *ipu, int csi);
174
175/*
176 * IPU Sensor Multiple FIFO Controller (SMFC) functions
177 */
178int ipu_smfc_enable(struct ipu_soc *ipu);
179int ipu_smfc_disable(struct ipu_soc *ipu);
180int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id);
181int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize);
182
183#define IPU_CPMEM_WORD(word, ofs, size) ((((word) * 160 + (ofs)) << 8) | (size))
184
185#define IPU_FIELD_UBO IPU_CPMEM_WORD(0, 46, 22)
186#define IPU_FIELD_VBO IPU_CPMEM_WORD(0, 68, 22)
187#define IPU_FIELD_IOX IPU_CPMEM_WORD(0, 90, 4)
188#define IPU_FIELD_RDRW IPU_CPMEM_WORD(0, 94, 1)
189#define IPU_FIELD_SO IPU_CPMEM_WORD(0, 113, 1)
190#define IPU_FIELD_SLY IPU_CPMEM_WORD(1, 102, 14)
191#define IPU_FIELD_SLUV IPU_CPMEM_WORD(1, 128, 14)
192
193#define IPU_FIELD_XV IPU_CPMEM_WORD(0, 0, 10)
194#define IPU_FIELD_YV IPU_CPMEM_WORD(0, 10, 9)
195#define IPU_FIELD_XB IPU_CPMEM_WORD(0, 19, 13)
196#define IPU_FIELD_YB IPU_CPMEM_WORD(0, 32, 12)
197#define IPU_FIELD_NSB_B IPU_CPMEM_WORD(0, 44, 1)
198#define IPU_FIELD_CF IPU_CPMEM_WORD(0, 45, 1)
199#define IPU_FIELD_SX IPU_CPMEM_WORD(0, 46, 12)
200#define IPU_FIELD_SY IPU_CPMEM_WORD(0, 58, 11)
201#define IPU_FIELD_NS IPU_CPMEM_WORD(0, 69, 10)
202#define IPU_FIELD_SDX IPU_CPMEM_WORD(0, 79, 7)
203#define IPU_FIELD_SM IPU_CPMEM_WORD(0, 86, 10)
204#define IPU_FIELD_SCC IPU_CPMEM_WORD(0, 96, 1)
205#define IPU_FIELD_SCE IPU_CPMEM_WORD(0, 97, 1)
206#define IPU_FIELD_SDY IPU_CPMEM_WORD(0, 98, 7)
207#define IPU_FIELD_SDRX IPU_CPMEM_WORD(0, 105, 1)
208#define IPU_FIELD_SDRY IPU_CPMEM_WORD(0, 106, 1)
209#define IPU_FIELD_BPP IPU_CPMEM_WORD(0, 107, 3)
210#define IPU_FIELD_DEC_SEL IPU_CPMEM_WORD(0, 110, 2)
211#define IPU_FIELD_DIM IPU_CPMEM_WORD(0, 112, 1)
212#define IPU_FIELD_BNDM IPU_CPMEM_WORD(0, 114, 3)
213#define IPU_FIELD_BM IPU_CPMEM_WORD(0, 117, 2)
214#define IPU_FIELD_ROT IPU_CPMEM_WORD(0, 119, 1)
215#define IPU_FIELD_HF IPU_CPMEM_WORD(0, 120, 1)
216#define IPU_FIELD_VF IPU_CPMEM_WORD(0, 121, 1)
217#define IPU_FIELD_THE IPU_CPMEM_WORD(0, 122, 1)
218#define IPU_FIELD_CAP IPU_CPMEM_WORD(0, 123, 1)
219#define IPU_FIELD_CAE IPU_CPMEM_WORD(0, 124, 1)
220#define IPU_FIELD_FW IPU_CPMEM_WORD(0, 125, 13)
221#define IPU_FIELD_FH IPU_CPMEM_WORD(0, 138, 12)
222#define IPU_FIELD_EBA0 IPU_CPMEM_WORD(1, 0, 29)
223#define IPU_FIELD_EBA1 IPU_CPMEM_WORD(1, 29, 29)
224#define IPU_FIELD_ILO IPU_CPMEM_WORD(1, 58, 20)
225#define IPU_FIELD_NPB IPU_CPMEM_WORD(1, 78, 7)
226#define IPU_FIELD_PFS IPU_CPMEM_WORD(1, 85, 4)
227#define IPU_FIELD_ALU IPU_CPMEM_WORD(1, 89, 1)
228#define IPU_FIELD_ALBM IPU_CPMEM_WORD(1, 90, 3)
229#define IPU_FIELD_ID IPU_CPMEM_WORD(1, 93, 2)
230#define IPU_FIELD_TH IPU_CPMEM_WORD(1, 95, 7)
231#define IPU_FIELD_SL IPU_CPMEM_WORD(1, 102, 14)
232#define IPU_FIELD_WID0 IPU_CPMEM_WORD(1, 116, 3)
233#define IPU_FIELD_WID1 IPU_CPMEM_WORD(1, 119, 3)
234#define IPU_FIELD_WID2 IPU_CPMEM_WORD(1, 122, 3)
235#define IPU_FIELD_WID3 IPU_CPMEM_WORD(1, 125, 3)
236#define IPU_FIELD_OFS0 IPU_CPMEM_WORD(1, 128, 5)
237#define IPU_FIELD_OFS1 IPU_CPMEM_WORD(1, 133, 5)
238#define IPU_FIELD_OFS2 IPU_CPMEM_WORD(1, 138, 5)
239#define IPU_FIELD_OFS3 IPU_CPMEM_WORD(1, 143, 5)
240#define IPU_FIELD_SXYS IPU_CPMEM_WORD(1, 148, 1)
241#define IPU_FIELD_CRE IPU_CPMEM_WORD(1, 149, 1)
242#define IPU_FIELD_DEC_SEL2 IPU_CPMEM_WORD(1, 150, 1)
243
244struct ipu_cpmem_word {
245 u32 data[5];
246 u32 res[3];
247};
248
249struct ipu_ch_param {
250 struct ipu_cpmem_word word[2];
251};
252
253void ipu_ch_param_write_field(struct ipu_ch_param __iomem *base, u32 wbs, u32 v);
254u32 ipu_ch_param_read_field(struct ipu_ch_param __iomem *base, u32 wbs);
255struct ipu_ch_param __iomem *ipu_get_cpmem(struct ipuv3_channel *channel);
256void ipu_ch_param_dump(struct ipu_ch_param __iomem *p);
257
258static inline void ipu_ch_param_zero(struct ipu_ch_param __iomem *p)
259{
260 int i;
261 void __iomem *base = p;
262
263 for (i = 0; i < sizeof(*p) / sizeof(u32); i++)
264 writel(0, base + i * sizeof(u32));
265}
266
267static inline void ipu_cpmem_set_buffer(struct ipu_ch_param __iomem *p,
268 int bufnum, dma_addr_t buf)
269{
270 if (bufnum)
271 ipu_ch_param_write_field(p, IPU_FIELD_EBA1, buf >> 3);
272 else
273 ipu_ch_param_write_field(p, IPU_FIELD_EBA0, buf >> 3);
274}
275
276static inline void ipu_cpmem_set_resolution(struct ipu_ch_param __iomem *p,
277 int xres, int yres)
278{
279 ipu_ch_param_write_field(p, IPU_FIELD_FW, xres - 1);
280 ipu_ch_param_write_field(p, IPU_FIELD_FH, yres - 1);
281}
282
283static inline void ipu_cpmem_set_stride(struct ipu_ch_param __iomem *p,
284 int stride)
285{
286 ipu_ch_param_write_field(p, IPU_FIELD_SLY, stride - 1);
287}
288
289void ipu_cpmem_set_high_priority(struct ipuv3_channel *channel);
290
291struct ipu_rgb {
292 struct fb_bitfield red;
293 struct fb_bitfield green;
294 struct fb_bitfield blue;
295 struct fb_bitfield transp;
296 int bits_per_pixel;
297};
298
299struct ipu_image {
300 struct v4l2_pix_format pix;
301 struct v4l2_rect rect;
302 dma_addr_t phys;
303};
304
305int ipu_cpmem_set_format_passthrough(struct ipu_ch_param __iomem *p,
306 int width);
307
308int ipu_cpmem_set_format_rgb(struct ipu_ch_param __iomem *,
309 const struct ipu_rgb *rgb);
310
311static inline void ipu_cpmem_interlaced_scan(struct ipu_ch_param *p,
312 int stride)
313{
314 ipu_ch_param_write_field(p, IPU_FIELD_SO, 1);
315 ipu_ch_param_write_field(p, IPU_FIELD_ILO, stride / 8);
316 ipu_ch_param_write_field(p, IPU_FIELD_SLY, (stride * 2) - 1);
317};
318
319void ipu_cpmem_set_yuv_planar(struct ipu_ch_param __iomem *p, u32 pixel_format,
320 int stride, int height);
321void ipu_cpmem_set_yuv_interleaved(struct ipu_ch_param __iomem *p,
322 u32 pixel_format);
323void ipu_cpmem_set_yuv_planar_full(struct ipu_ch_param __iomem *p,
324 u32 pixel_format, int stride, int u_offset, int v_offset);
325int ipu_cpmem_set_fmt(struct ipu_ch_param __iomem *cpmem, u32 pixelformat);
326int ipu_cpmem_set_image(struct ipu_ch_param __iomem *cpmem,
327 struct ipu_image *image);
328
329enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc);
330enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat);
331
332static inline void ipu_cpmem_set_burstsize(struct ipu_ch_param __iomem *p,
333 int burstsize)
334{
335 ipu_ch_param_write_field(p, IPU_FIELD_NPB, burstsize - 1);
336};
337
338struct ipu_client_platformdata {
339 int csi;
340 int di;
341 int dc;
342 int dp;
343 int dmfc;
344 int dma[2];
345};
346
347#endif /* __DRM_IPU_H__ */
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index a5af2a26d94f..5c1aba154b64 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -170,6 +170,7 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
170 unmap->dev_bus_addr = 0; 170 unmap->dev_bus_addr = 0;
171} 171}
172 172
173int arch_gnttab_init(unsigned long nr_shared, unsigned long nr_status);
173int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes, 174int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,
174 unsigned long max_nr_gframes, 175 unsigned long max_nr_gframes,
175 void **__shared); 176 void **__shared);
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index c50061db6098..70054cc0708d 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -51,6 +51,59 @@
51 */ 51 */
52 52
53/* 53/*
54 * Multiple transmit and receive queues:
55 * If supported, the backend will write the key "multi-queue-max-queues" to
56 * the directory for that vif, and set its value to the maximum supported
57 * number of queues.
58 * Frontends that are aware of this feature and wish to use it can write the
59 * key "multi-queue-num-queues", set to the number they wish to use, which
60 * must be greater than zero, and no more than the value reported by the backend
61 * in "multi-queue-max-queues".
62 *
63 * Queues replicate the shared rings and event channels.
64 * "feature-split-event-channels" may optionally be used when using
65 * multiple queues, but is not mandatory.
66 *
67 * Each queue consists of one shared ring pair, i.e. there must be the same
68 * number of tx and rx rings.
69 *
70 * For frontends requesting just one queue, the usual event-channel and
71 * ring-ref keys are written as before, simplifying the backend processing
72 * to avoid distinguishing between a frontend that doesn't understand the
73 * multi-queue feature, and one that does, but requested only one queue.
74 *
75 * Frontends requesting two or more queues must not write the toplevel
76 * event-channel (or event-channel-{tx,rx}) and {tx,rx}-ring-ref keys,
77 * instead writing those keys under sub-keys having the name "queue-N" where
78 * N is the integer ID of the queue for which those keys belong. Queues
79 * are indexed from zero. For example, a frontend with two queues and split
80 * event channels must write the following set of queue-related keys:
81 *
82 * /local/domain/1/device/vif/0/multi-queue-num-queues = "2"
83 * /local/domain/1/device/vif/0/queue-0 = ""
84 * /local/domain/1/device/vif/0/queue-0/tx-ring-ref = "<ring-ref-tx0>"
85 * /local/domain/1/device/vif/0/queue-0/rx-ring-ref = "<ring-ref-rx0>"
86 * /local/domain/1/device/vif/0/queue-0/event-channel-tx = "<evtchn-tx0>"
87 * /local/domain/1/device/vif/0/queue-0/event-channel-rx = "<evtchn-rx0>"
88 * /local/domain/1/device/vif/0/queue-1 = ""
89 * /local/domain/1/device/vif/0/queue-1/tx-ring-ref = "<ring-ref-tx1>"
90 * /local/domain/1/device/vif/0/queue-1/rx-ring-ref = "<ring-ref-rx1"
91 * /local/domain/1/device/vif/0/queue-1/event-channel-tx = "<evtchn-tx1>"
92 * /local/domain/1/device/vif/0/queue-1/event-channel-rx = "<evtchn-rx1>"
93 *
94 * If there is any inconsistency in the XenStore data, the backend may
95 * choose not to connect any queues, instead treating the request as an
96 * error. This includes scenarios where more (or fewer) queues were
97 * requested than the frontend provided details for.
98 *
99 * Mapping of packets to queues is considered to be a function of the
100 * transmitting system (backend or frontend) and is not negotiated
101 * between the two. Guests are free to transmit packets on any queue
102 * they choose, provided it has been set up correctly. Guests must be
103 * prepared to receive packets on any queue they have requested be set up.
104 */
105
106/*
54 * "feature-no-csum-offload" should be used to turn IPv4 TCP/UDP checksum 107 * "feature-no-csum-offload" should be used to turn IPv4 TCP/UDP checksum
55 * offload off or on. If it is missing then the feature is assumed to be on. 108 * offload off or on. If it is missing then the feature is assumed to be on.
56 * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum 109 * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index f1331e3e7271..5cc49ea8d840 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -108,11 +108,113 @@ struct xenpf_platform_quirk {
108}; 108};
109DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t); 109DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t);
110 110
111#define XENPF_efi_runtime_call 49
112#define XEN_EFI_get_time 1
113#define XEN_EFI_set_time 2
114#define XEN_EFI_get_wakeup_time 3
115#define XEN_EFI_set_wakeup_time 4
116#define XEN_EFI_get_next_high_monotonic_count 5
117#define XEN_EFI_get_variable 6
118#define XEN_EFI_set_variable 7
119#define XEN_EFI_get_next_variable_name 8
120#define XEN_EFI_query_variable_info 9
121#define XEN_EFI_query_capsule_capabilities 10
122#define XEN_EFI_update_capsule 11
123
124struct xenpf_efi_runtime_call {
125 uint32_t function;
126 /*
127 * This field is generally used for per sub-function flags (defined
128 * below), except for the XEN_EFI_get_next_high_monotonic_count case,
129 * where it holds the single returned value.
130 */
131 uint32_t misc;
132 xen_ulong_t status;
133 union {
134#define XEN_EFI_GET_TIME_SET_CLEARS_NS 0x00000001
135 struct {
136 struct xenpf_efi_time {
137 uint16_t year;
138 uint8_t month;
139 uint8_t day;
140 uint8_t hour;
141 uint8_t min;
142 uint8_t sec;
143 uint32_t ns;
144 int16_t tz;
145 uint8_t daylight;
146 } time;
147 uint32_t resolution;
148 uint32_t accuracy;
149 } get_time;
150
151 struct xenpf_efi_time set_time;
152
153#define XEN_EFI_GET_WAKEUP_TIME_ENABLED 0x00000001
154#define XEN_EFI_GET_WAKEUP_TIME_PENDING 0x00000002
155 struct xenpf_efi_time get_wakeup_time;
156
157#define XEN_EFI_SET_WAKEUP_TIME_ENABLE 0x00000001
158#define XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY 0x00000002
159 struct xenpf_efi_time set_wakeup_time;
160
161#define XEN_EFI_VARIABLE_NON_VOLATILE 0x00000001
162#define XEN_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
163#define XEN_EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
164 struct {
165 GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */
166 xen_ulong_t size;
167 GUEST_HANDLE(void) data;
168 struct xenpf_efi_guid {
169 uint32_t data1;
170 uint16_t data2;
171 uint16_t data3;
172 uint8_t data4[8];
173 } vendor_guid;
174 } get_variable, set_variable;
175
176 struct {
177 xen_ulong_t size;
178 GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */
179 struct xenpf_efi_guid vendor_guid;
180 } get_next_variable_name;
181
182 struct {
183 uint32_t attr;
184 uint64_t max_store_size;
185 uint64_t remain_store_size;
186 uint64_t max_size;
187 } query_variable_info;
188
189 struct {
190 GUEST_HANDLE(void) capsule_header_array;
191 xen_ulong_t capsule_count;
192 uint64_t max_capsule_size;
193 uint32_t reset_type;
194 } query_capsule_capabilities;
195
196 struct {
197 GUEST_HANDLE(void) capsule_header_array;
198 xen_ulong_t capsule_count;
199 uint64_t sg_list; /* machine address */
200 } update_capsule;
201 } u;
202};
203DEFINE_GUEST_HANDLE_STRUCT(xenpf_efi_runtime_call);
204
205#define XEN_FW_EFI_VERSION 0
206#define XEN_FW_EFI_CONFIG_TABLE 1
207#define XEN_FW_EFI_VENDOR 2
208#define XEN_FW_EFI_MEM_INFO 3
209#define XEN_FW_EFI_RT_VERSION 4
210
111#define XENPF_firmware_info 50 211#define XENPF_firmware_info 50
112#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ 212#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */
113#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ 213#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
114#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */ 214#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */
215#define XEN_FW_EFI_INFO 4 /* from EFI */
115#define XEN_FW_KBD_SHIFT_FLAGS 5 /* Int16, Fn02: Get keyboard shift flags. */ 216#define XEN_FW_KBD_SHIFT_FLAGS 5 /* Int16, Fn02: Get keyboard shift flags. */
217
116struct xenpf_firmware_info { 218struct xenpf_firmware_info {
117 /* IN variables. */ 219 /* IN variables. */
118 uint32_t type; 220 uint32_t type;
@@ -144,6 +246,26 @@ struct xenpf_firmware_info {
144 GUEST_HANDLE(uchar) edid; 246 GUEST_HANDLE(uchar) edid;
145 } vbeddc_info; /* XEN_FW_VBEDDC_INFO */ 247 } vbeddc_info; /* XEN_FW_VBEDDC_INFO */
146 248
249 union xenpf_efi_info {
250 uint32_t version;
251 struct {
252 uint64_t addr; /* EFI_CONFIGURATION_TABLE */
253 uint32_t nent;
254 } cfg;
255 struct {
256 uint32_t revision;
257 uint32_t bufsz; /* input, in bytes */
258 GUEST_HANDLE(void) name;
259 /* UCS-2/UTF-16 string */
260 } vendor;
261 struct {
262 uint64_t addr;
263 uint64_t size;
264 uint64_t attr;
265 uint32_t type;
266 } mem;
267 } efi_info; /* XEN_FW_EFI_INFO */
268
147 uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */ 269 uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */
148 } u; 270 } u;
149}; 271};
@@ -362,6 +484,7 @@ struct xen_platform_op {
362 struct xenpf_read_memtype read_memtype; 484 struct xenpf_read_memtype read_memtype;
363 struct xenpf_microcode_update microcode; 485 struct xenpf_microcode_update microcode;
364 struct xenpf_platform_quirk platform_quirk; 486 struct xenpf_platform_quirk platform_quirk;
487 struct xenpf_efi_runtime_call efi_runtime_call;
365 struct xenpf_firmware_info firmware_info; 488 struct xenpf_firmware_info firmware_info;
366 struct xenpf_enter_acpi_sleep enter_acpi_sleep; 489 struct xenpf_enter_acpi_sleep enter_acpi_sleep;
367 struct xenpf_change_freq change_freq; 490 struct xenpf_change_freq change_freq;
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 0b3149ed7eaa..7491ee5d8164 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <linux/notifier.h> 5#include <linux/notifier.h>
6#include <linux/efi.h>
6#include <asm/xen/interface.h> 7#include <asm/xen/interface.h>
7 8
8DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); 9DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
@@ -35,4 +36,14 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
35 int numpgs, struct page **pages); 36 int numpgs, struct page **pages);
36 37
37bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); 38bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
39
40#ifdef CONFIG_XEN_EFI
41extern efi_system_table_t *xen_efi_probe(void);
42#else
43static inline efi_system_table_t __init *xen_efi_probe(void)
44{
45 return NULL;
46}
47#endif
48
38#endif /* INCLUDE_XEN_OPS_H */ 49#endif /* INCLUDE_XEN_OPS_H */